text
stringlengths 4
6.14k
|
|---|
/*
* XML Security Library
*
* globals.h: internal header only used during the compilation
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
*
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
*/
#ifndef __XMLSEC_GLOBALS_H__
#define __XMLSEC_GLOBALS_H__
/**
* Use autoconf defines if present.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#define IN_XMLSEC_CRYPTO
#define XMLSEC_PRIVATE
#define XMLSEC_GCRYPT_MAX_DIGEST_SIZE 256
#define XMLSEC_GCRYPT_REPORT_ERROR(err) \
"error code=%d; error message='%s'", \
(int)err, xmlSecErrorsSafeString(gcry_strerror((err)))
#endif /* ! __XMLSEC_GLOBALS_H__ */
|
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
freopen("pinyin.in", "r", stdin);
freopen("pinyin.out","w+",stdout);
int n, type, i, j;
char pinyin[1001];
scanf("%i", &n);
while(n--) {
scanf("%s", pinyin);
type = pinyin[strlen(pinyin) - 1] - '0';
for(i = 0; i < strlen(pinyin) - 1; i++) {
if(type != 5) {
switch(pinyin[i]) {
case 'a':
switch(type) {
case 1: putchar('1'); break;
case 2: putchar('7'); break;
case 3: putchar('!'); break;
case 4: putchar('&'); break;
}
break;
case 'o':
switch(type) {
case 1: putchar('2'); break;
case 2: putchar('8'); break;
case 3: putchar('@'); break;
case 4: putchar('*'); break;
}
break;
case 'e':
switch(type) {
case 1: putchar('3'); break;
case 2: putchar('9'); break;
case 3: putchar('#'); break;
case 4: putchar('('); break;
}
break;
case 'i':
switch(type) {
case 1: putchar('4'); break;
case 2: putchar('0'); break;
case 3: putchar('$'); break;
case 4: putchar(')'); break;
}
break;
case 'u':
switch(type) {
case 1: putchar('5'); break;
case 2: putchar('+'); break;
case 3: putchar('%'); break;
case 4: putchar('_'); break;
}
break;
case 'v':
switch(type) {
case 1: putchar('6'); break;
case 2: putchar('-'); break;
case 3: putchar('^'); break;
case 4: putchar('='); break;
}
break;
default:
putchar(pinyin[i]);
break;
}
} else {
putchar(pinyin[i]);
}
}
// ÂéÂéÔÙÒ²²»Óõ£ÐÄÎÒÍü¼Ç»»ÐÐÁË
putchar('\n');
}
return 0;
}
|
/*
* Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Essentia
*
* Essentia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
#ifndef ESSENTIA_IIR_H
#define ESSENTIA_IIR_H
#include "algorithmfactory.h"
#include "streamingalgorithmwrapper.h"
namespace essentia {
namespace standard {
class IIR : public Algorithm {
private:
Input<std::vector<Real> > _x;
Output<std::vector<Real> > _y;
std::vector<Real> _a;
std::vector<Real> _b;
std::vector<Real> _state;
public:
IIR() {
declareInput(_x, "signal", "the input signal");
declareOutput(_y, "signal", "the filtered signal");
}
void declareParameters() {
std::vector<Real> defaultParam(1, 1.0);
declareParameter("numerator", "the list of coefficients of the numerator. Often referred to as the B coefficient vector.", "", defaultParam);
declareParameter("denominator", "the list of coefficients of the denominator. Often referred to as the A coefficient vector.", "", defaultParam);
}
void configure();
void compute();
void reset();
static const char* name;
static const char* category;
static const char* description;
};
} // namespace standard
namespace streaming {
class IIR : public StreamingAlgorithmWrapper {
protected:
Sink<Real> _x;
Source<Real> _y;
static const int preferredSize = 4096;
public:
IIR() {
declareAlgorithm("IIR");
declareInput(_x, STREAM, preferredSize, "signal");
declareOutput(_y, STREAM, preferredSize, "signal");
_y.setBufferType(BufferUsage::forAudioStream);
}
};
} // namespace streaming
} // namespace essentia
#endif // ESSENTIA_IIR_H
|
#include <vector>
#include <string>
#include "socket_header.h"
#include "Interface/Thread.h"
#include "Interface/Pipe.h"
#include "Server.h"
class CServiceWorker;
class IService;
class CServiceAcceptor : public IThread
{
public:
CServiceAcceptor(IService * pService, std::string pName, unsigned short port, int pMaxClientsPerThread, IServer::BindTarget bindTarget);
~CServiceAcceptor();
void operator()(void);
private:
void AddToWorker(SOCKET pSocket, const std::string& endpoint);
bool init_socket_v4(unsigned short port, IServer::BindTarget bindTarget);
bool init_socket_v6(unsigned short port, IServer::BindTarget bindTarget);
std::vector<CServiceWorker*> workers;
SOCKET s;
SOCKET s_v6;
std::string name;
IService * service;
IPipe *exitpipe;
#ifndef _WIN32
int xpipe[2];
#endif
bool do_exit;
bool has_error;
int maxClientsPerThread;
};
|
/* GStreamer
* Copyright (C) <2014> William Manley <will@williammanley.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_NET_CONTROL_MESSAGE_META_H__
#define __GST_NET_CONTROL_MESSAGE_META_H__
#include <gst/gst.h>
#include <gio/gio.h>
G_BEGIN_DECLS
typedef struct _GstNetControlMessageMeta GstNetControlMessageMeta;
/**
* GstNetControlMessageMeta:
* @meta: the parent type
* @addr: a #GSocketControlMessage stored as metadata
*
* Buffer metadata for GSocket control messages, AKA ancillary data attached to
* data sent across a socket.
*/
struct _GstNetControlMessageMeta {
GstMeta meta;
GSocketControlMessage *message;
};
GType gst_net_control_message_meta_api_get_type (void);
#define GST_NET_CONTROL_MESSAGE_META_API_TYPE \
(gst_net_control_message_meta_api_get_type())
#define gst_buffer_get_net_control_message_meta(b) ((GstNetControlMessageMeta*)\
gst_buffer_get_meta((b),GST_NET_CONTROL_MESSAGE_META_API_TYPE))
/* implementation */
const GstMetaInfo *gst_net_control_message_meta_get_info (void);
#define GST_NET_CONTROL_MESSAGE_META_INFO \
(gst_net_control_message_meta_get_info())
GstNetControlMessageMeta * gst_buffer_add_net_control_message_meta (
GstBuffer *buffer, GSocketControlMessage *addr);
G_END_DECLS
#endif /* __GST_NET_CONTROL_MESSAGE_META_H__ */
|
/*
This file is part of the GSM3 communications library for Arduino
-- Multi-transport communications platform
-- Fully asynchronous
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
-- Voice calls
-- SMS
-- TCP/IP connections
-- HTTP basic clients
This library has been developed by Telefónica Digital - PDI -
- Physical Internet Lab, as part as its collaboration with
Arduino and the Open Hardware Community.
September-December 2012
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
The latest version of this library can always be found at
https://github.com/BlueVia/Official-Arduino
*/
#ifndef _GSM3SHIELDV1MODEMVERIFICATION_
#define _GSM3SHIELDV1MODEMVERIFICATION_
#include <GSM3ShieldV1AccessProvider.h>
#include <GSM3ShieldV1DirectModemProvider.h>
class GSM3ShieldV1ModemVerification
{
private:
GSM3ShieldV1DirectModemProvider modemAccess;
GSM3ShieldV1AccessProvider gsm; // Access provider to GSM/GPRS network
public:
/** Constructor */
GSM3ShieldV1ModemVerification();
/** Check modem response and restart it
*/
int begin();
/** Obtain modem IMEI (command AT)
@return modem IMEI number
*/
String getIMEI();
};
#endif
|
/*
* Copyright (C) 2013 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef FM_PATHEDIT_P_H
#define FM_PATHEDIT_P_H
#include <QObject>
#include <libfm/fm.h>
namespace Fm {
class PathEdit;
class PathEditJob : public QObject {
Q_OBJECT
public:
GCancellable* cancellable;
GFile* dirName;
QStringList subDirs;
PathEdit* edit;
bool triggeredByFocusInEvent;
~PathEditJob() {
g_object_unref(dirName);
g_object_unref(cancellable);
}
Q_SIGNALS:
void finished();
public Q_SLOTS:
void runJob();
};
}
#endif // FM_PATHEDIT_P_H
|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_SCALE_WIDGET_H
#define QWT_SCALE_WIDGET_H
#include "qwt_global.h"
#include "qwt_text.h"
#include "qwt_scale_draw.h"
#include <qwidget.h>
#include <qfont.h>
#include <qcolor.h>
#include <qstring.h>
class QPainter;
class QwtScaleTransformation;
class QwtScaleDiv;
class QwtColorMap;
/*!
\brief A Widget which contains a scale
This Widget can be used to decorate composite widgets with
a scale.
*/
class QWT_EXPORT QwtScaleWidget : public QWidget
{
Q_OBJECT
public:
/*!
Layout flags of the title
- TitleInverted\n
The title of vertical scales is painted from top to bottom. Otherwise
it is painted from bottom to top.
*/
enum LayoutFlag
{
TitleInverted = 1
};
explicit QwtScaleWidget( QWidget *parent = NULL );
explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget *parent = NULL );
virtual ~QwtScaleWidget();
Q_SIGNALS:
//! Signal emitted, whenever the scale divison changes
void scaleDivChanged();
public:
void setTitle( const QString &title );
void setTitle( const QwtText &title );
QwtText title() const;
void setLayoutFlag( LayoutFlag, bool on );
bool testLayoutFlag( LayoutFlag ) const;
void setBorderDist( int start, int end );
int startBorderDist() const;
int endBorderDist() const;
void getBorderDistHint( int &start, int &end ) const;
void getMinBorderDist( int &start, int &end ) const;
void setMinBorderDist( int start, int end );
void setMargin( int );
int margin() const;
void setSpacing( int td );
int spacing() const;
void setScaleDiv( QwtScaleTransformation *, const QwtScaleDiv &sd );
void setScaleDraw( QwtScaleDraw * );
const QwtScaleDraw *scaleDraw() const;
QwtScaleDraw *scaleDraw();
void setLabelAlignment( Qt::Alignment );
void setLabelRotation( double rotation );
void setColorBarEnabled( bool );
bool isColorBarEnabled() const;
void setColorBarWidth( int );
int colorBarWidth() const;
void setColorMap( const QwtInterval &, QwtColorMap * );
QwtInterval colorBarInterval() const;
const QwtColorMap *colorMap() const;
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
int titleHeightForWidth( int width ) const;
int dimForLength( int length, const QFont &scaleFont ) const;
void drawColorBar( QPainter *painter, const QRectF & ) const;
void drawTitle( QPainter *painter, QwtScaleDraw::Alignment,
const QRectF &rect ) const;
void setAlignment( QwtScaleDraw::Alignment );
QwtScaleDraw::Alignment alignment() const;
QRectF colorBarRect( const QRectF& ) const;
protected:
virtual void paintEvent( QPaintEvent * );
virtual void resizeEvent( QResizeEvent * );
void draw( QPainter *p ) const;
void scaleChange();
void layoutScale( bool update = true );
private:
void initScale( QwtScaleDraw::Alignment );
class PrivateData;
PrivateData *d_data;
};
#endif
|
/* Copyright (C) 2014 The libxml++ development team
*
* This file is part of libxml++.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LIBXMLPP_SCHEMABASE_H
#define __LIBXMLPP_SCHEMABASE_H
#include <libxml++/noncopyable.h>
namespace Glib
{
class ustring;
}
namespace xmlpp
{
class Document;
/** Base class for schemas, used for validation of XML files.
*
* @newin{2,38}
*/
class SchemaBase : NonCopyable
{
public:
SchemaBase();
~SchemaBase() override;
/** Parse a schema definition file.
* If another schema has been parsed before, that schema is replaced by the new one.
* @param filename The URL of the schema.
* @throws xmlpp::parse_error
*/
virtual void parse_file(const Glib::ustring& filename) = 0;
/** Parse a schema definition from a string.
* If another schema has been parsed before, that schema is replaced by the new one.
* @param contents The schema definition as a string.
* @throws xmlpp::parse_error
*/
virtual void parse_memory(const Glib::ustring& contents) = 0;
/** Parse a schema definition from a document.
* If another schema has been parsed before, that schema is replaced by the new one.
* @param document A preparsed document tree, containing the schema definition.
* @throws xmlpp::parse_error
*/
virtual void parse_document(const Document* document) = 0;
};
} // namespace xmlpp
#endif //__LIBXMLPP_SCHEMABASE_H
|
#ifndef SAMPLE_H
#define SAMPLE_H
extern const char sample_utf8[];
#endif
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef DOWNLOADER_H
#define DOWNLOADER_H
#include <QDir>
#include <QHash>
#include <QObject>
#include <QUrl>
QT_BEGIN_NAMESPACE
class QNetworkAccessManager;
class QNetworkRequest;
class QNetworkReply;
class QWidget;
QT_END_NAMESPACE
class Downloader : public QObject
{
Q_OBJECT
public:
Downloader(QWidget *parentWidget, QNetworkAccessManager *manager);
public slots:
QString chooseSaveFile(const QUrl &url);
void startDownload(const QNetworkRequest &request);
void saveFile(QNetworkReply *reply);
void finishDownload();
private:
QNetworkAccessManager *manager;
QNetworkReply *reply;
QHash<QString, QString> downloads;
QString path;
QWidget *parentWidget;
};
#endif
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef CPPINSERTQTPROPERTYMEMBERS_H
#define CPPINSERTQTPROPERTYMEMBERS_H
#include <cppeditor/cppquickfix.h>
#include <QtCore/QString>
namespace CPlusPlus {
class QtPropertyDeclarationAST;
class Class;
}
namespace TextEditor {
class RefactoringFile;
typedef QSharedPointer<RefactoringFile> RefactoringFilePtr;
}
namespace Utils {
class ChangeSet;
}
namespace CppTools {
class InsertionLocation;
}
namespace CppEditor {
namespace Internal {
class InsertQtPropertyMembers : public CppQuickFixFactory
{
Q_OBJECT
public:
virtual QList<CppQuickFixOperation::Ptr>
match(const QSharedPointer<const Internal::CppQuickFixAssistInterface> &interface);
private:
enum GenerateFlag {
GenerateGetter = 1 << 0,
GenerateSetter = 1 << 1,
GenerateSignal = 1 << 2,
GenerateStorage = 1 << 3
};
class Operation: public CppQuickFixOperation
{
public:
Operation(const QSharedPointer<const Internal::CppQuickFixAssistInterface> &interface,
int priority,
CPlusPlus::QtPropertyDeclarationAST *declaration, CPlusPlus::Class *klass,
int generateFlags,
const QString &getterName, const QString &setterName, const QString &signalName,
const QString &storageName);
virtual void performChanges(const CppTools::CppRefactoringFilePtr &file,
const CppTools::CppRefactoringChanges &refactoring);
private:
void insertAndIndent(const TextEditor::RefactoringFilePtr &file, Utils::ChangeSet *changeSet,
const CppTools::InsertionLocation &loc, const QString &text);
CPlusPlus::QtPropertyDeclarationAST *m_declaration;
CPlusPlus::Class *m_class;
int m_generateFlags;
QString m_getterName;
QString m_setterName;
QString m_signalName;
QString m_storageName;
};
};
} // namespace Internal
} // namespace CppEditor
#endif // CPPINSERTQTPROPERTYMEMBERS_H
|
/*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
* Authors: Michael Zucchi <notzed@ximian.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
#error "Only <camel/camel.h> can be included directly."
#endif
#ifndef CAMEL_BLOCK_FILE_H
#define CAMEL_BLOCK_FILE_H
#include <camel/camel-object.h>
#include <stdio.h>
#include <sys/types.h>
/* Standard GObject macros */
#define CAMEL_TYPE_BLOCK_FILE \
(camel_block_file_get_type ())
#define CAMEL_BLOCK_FILE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), CAMEL_TYPE_BLOCK_FILE, CamelBlockFile))
#define CAMEL_BLOCK_FILE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), CAMEL_TYPE_BLOCK_FILE, CamelBlockFileClass))
#define CAMEL_IS_BLOCK_FILE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), CAMEL_TYPE_BLOCK_FILE))
#define CAMEL_IS_BLOCK_FILE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), CAMEL_TYPE_BLOCK_FILE))
#define CAMEL_BLOCK_FILE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), CAMEL_TYPE_BLOCK_FILE, CamelBlockFileClass))
#define CAMEL_TYPE_KEY_FILE \
(camel_key_file_get_type ())
#define CAMEL_KEY_FILE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), CAMEL_TYPE_KEY_FILE, CamelKeyFile))
#define CAMEL_KEY_FILE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), CAMEL_TYPE_KEY_FILE, CamelKeyFileClass))
#define CAMEL_IS_KEY_FILE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), CAMEL_TYPE_KEY_FILE))
#define CAMEL_IS_KEY_FILE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), CAMEL_TYPE_KEY_FILE))
#define CAMEL_KEY_FILE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), CAMEL_TYPE_KEY_FILE, CamelKeyFileClass))
G_BEGIN_DECLS
typedef guint32 camel_block_t; /* block offset, absolute, bottom BLOCK_SIZE_BITS always 0 */
typedef guint32 camel_key_t; /* this is a bitfield of (block offset:BLOCK_SIZE_BITS) */
typedef struct _CamelBlockRoot CamelBlockRoot;
typedef struct _CamelBlock CamelBlock;
typedef struct _CamelBlockFile CamelBlockFile;
typedef struct _CamelBlockFileClass CamelBlockFileClass;
typedef struct _CamelBlockFilePrivate CamelBlockFilePrivate;
typedef enum {
CAMEL_BLOCK_FILE_SYNC = 1 << 0
} CamelBlockFileFlags;
#define CAMEL_BLOCK_SIZE (1024)
#define CAMEL_BLOCK_SIZE_BITS (10) /* # bits to contain block_size bytes */
typedef enum {
CAMEL_BLOCK_DIRTY = 1 << 0,
CAMEL_BLOCK_DETACHED = 1 << 1
} CamelBlockFlags;
struct _CamelBlockRoot {
gchar version[8]; /* version number */
guint32 flags; /* flags for file */
guint32 block_size; /* block size of this file */
camel_block_t free; /* free block list */
camel_block_t last; /* pointer to end of blocks */
/* subclasses tack on, but no more than CAMEL_BLOCK_SIZE! */
};
/* LRU cache of blocks */
struct _CamelBlock {
camel_block_t id;
CamelBlockFlags flags;
guint32 refcount;
guint32 align00;
guchar data[CAMEL_BLOCK_SIZE];
};
struct _CamelBlockFile {
CamelObject parent;
CamelBlockFilePrivate *priv;
gchar version[8];
gchar *path;
CamelBlockFileFlags flags;
gint fd;
gsize block_size;
CamelBlockRoot *root;
CamelBlock *root_block;
/* make private? */
gint block_cache_limit;
gint block_cache_count;
GQueue block_cache;
GHashTable *blocks;
};
struct _CamelBlockFileClass {
CamelObjectClass parent;
gint (*validate_root)(CamelBlockFile *);
gint (*init_root)(CamelBlockFile *);
};
GType camel_block_file_get_type (void);
CamelBlockFile *camel_block_file_new (const gchar *path,
gint flags,
const gchar version[8],
gsize block_size);
gint camel_block_file_rename (CamelBlockFile *bs,
const gchar *path);
gint camel_block_file_delete (CamelBlockFile *kf);
CamelBlock * camel_block_file_new_block (CamelBlockFile *bs);
gint camel_block_file_free_block (CamelBlockFile *bs,
camel_block_t id);
CamelBlock * camel_block_file_get_block (CamelBlockFile *bs,
camel_block_t id);
void camel_block_file_detach_block (CamelBlockFile *bs,
CamelBlock *bl);
void camel_block_file_attach_block (CamelBlockFile *bs,
CamelBlock *bl);
void camel_block_file_touch_block (CamelBlockFile *bs,
CamelBlock *bl);
void camel_block_file_unref_block (CamelBlockFile *bs,
CamelBlock *bl);
gint camel_block_file_sync_block (CamelBlockFile *bs,
CamelBlock *bl);
gint camel_block_file_sync (CamelBlockFile *bs);
/* ********************************************************************** */
typedef struct _CamelKeyFile CamelKeyFile;
typedef struct _CamelKeyFileClass CamelKeyFileClass;
typedef struct _CamelKeyFilePrivate CamelKeyFilePrivate;
struct _CamelKeyFile {
CamelObject parent;
CamelKeyFilePrivate *priv;
FILE *fp;
gchar *path;
gint flags;
goffset last;
};
struct _CamelKeyFileClass {
CamelObjectClass parent;
};
GType camel_key_file_get_type (void);
CamelKeyFile * camel_key_file_new (const gchar *path, gint flags, const gchar version[8]);
gint camel_key_file_rename (CamelKeyFile *kf, const gchar *path);
gint camel_key_file_delete (CamelKeyFile *kf);
gint camel_key_file_write (CamelKeyFile *kf, camel_block_t *parent, gsize len, camel_key_t *records);
gint camel_key_file_read (CamelKeyFile *kf, camel_block_t *start, gsize *len, camel_key_t **records);
G_END_DECLS
#endif /* CAMEL_BLOCK_FILE_H */
|
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Alexander Larsson <alexl@redhat.com>
*/
#ifndef __G_VFS_DAEMON_H__
#define __G_VFS_DAEMON_H__
#include <glib-object.h>
#include <gvfsjobsource.h>
#include <gmountsource.h>
#include <dbus/dbus.h>
G_BEGIN_DECLS
#define G_VFS_TYPE_DAEMON (g_vfs_daemon_get_type ())
#define G_VFS_DAEMON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_DAEMON, GVfsDaemon))
#define G_VFS_DAEMON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_DAEMON, GVfsDaemonClass))
#define G_VFS_IS_DAEMON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_DAEMON))
#define G_VFS_IS_DAEMON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_DAEMON))
#define G_VFS_DAEMON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_DAEMON, GVfsDaemonClass))
typedef struct _GVfsDaemon GVfsDaemon;
typedef struct _GVfsDaemonClass GVfsDaemonClass;
typedef struct _GVfsDaemonPrivate GVfsDaemonPrivate;
struct _GVfsDaemonClass
{
GObjectClass parent_class;
/* vtable */
};
GType g_vfs_daemon_get_type (void) G_GNUC_CONST;
GVfsDaemon *g_vfs_daemon_new (gboolean main_daemon,
gboolean replace);
void g_vfs_daemon_set_max_threads (GVfsDaemon *daemon,
gint max_threads);
void g_vfs_daemon_add_job_source (GVfsDaemon *daemon,
GVfsJobSource *job_source);
void g_vfs_daemon_queue_job (GVfsDaemon *daemon,
GVfsJob *job);
void g_vfs_daemon_register_path (GVfsDaemon *daemon,
const char *obj_path,
DBusObjectPathMessageFunction callback,
gpointer user_data);
void g_vfs_daemon_unregister_path (GVfsDaemon *daemon,
const char *obj_path);
void g_vfs_daemon_initiate_mount (GVfsDaemon *daemon,
GMountSpec *mount_spec,
GMountSource *mount_source,
gboolean is_automount,
DBusMessage *request);
GArray *g_vfs_daemon_get_blocking_processes (GVfsDaemon *daemon);
void g_vfs_daemon_run_job_in_thread (GVfsDaemon *daemon,
GVfsJob *job);
void g_vfs_daemon_close_active_channels (GVfsDaemon *daemon);
G_END_DECLS
#endif /* __G_VFS_DAEMON_H__ */
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtLocation module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QDECLARATIVEGEOMAPMOUSEAREA_H
#define QDECLARATIVEGEOMAPMOUSEAREA_H
#include "qdeclarativecoordinate_p.h"
#include "qdeclarativegeomap_p.h"
#include "qdeclarativegeomapmouseevent_p.h"
#include <QtQuick/QQuickItem>
#include <QtQuick/private/qquickmousearea_p.h>
QT_BEGIN_NAMESPACE
class QDeclarativeGeoMapMouseArea : public QQuickMouseArea
{
Q_OBJECT
public:
explicit QDeclarativeGeoMapMouseArea(QQuickItem *parent = 0);
~QDeclarativeGeoMapMouseArea();
Q_INVOKABLE QGeoCoordinate mouseToCoordinate(QQuickMouseEvent *event);
// From QQmlParserStatus
virtual void componentComplete();
protected:
// from QQuickItem
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void hoverEnterEvent(QHoverEvent *event);
void hoverMoveEvent(QHoverEvent *event);
void hoverLeaveEvent(QHoverEvent *event);
private Q_SLOTS:
void dragActiveChanged();
private:
QQuickItem *parentMapItem();
QDeclarativeGeoMap *map();
private:
bool componentCompleted_;
bool dragActive_;
};
QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeGeoMapMouseArea)
#endif
|
/* API declaration export attribute */
#define AL_API __attribute__((visibility("protected")))
#define ALC_API __attribute__((visibility("protected")))
/* Define to the library version */
#define ALSOFT_VERSION "1.16.0"
#ifdef IN_IDE_PARSER
/* KDevelop's parser doesn't recognize the C99-standard restrict keyword, but
* recent versions (at least 4.5.1) do recognize GCC's __restrict. */
#define restrict __restrict
#endif
/* Define any available alignment declaration */
#define ALIGN(x) __attribute__((aligned(x)))
/* Define if we have the C11 aligned_alloc function */
//#define HAVE_ALIGNED_ALLOC
/* Define if we have the posix_memalign function */
//#define HAVE_POSIX_MEMALIGN
/* Define if we have the _aligned_malloc function */
/* #undef HAVE__ALIGNED_MALLOC */
/* Define if we have SSE CPU extensions */
//#define HAVE_SSE
//#define HAVE_SSE2
//#define HAVE_SSE4_1
/* Define if we have ARM Neon CPU extensions */
/* #undef HAVE_NEON */
/* Define if we have FluidSynth support */
//#define HAVE_FLUIDSYNTH
/* Define if we have the ALSA backend */
//#define HAVE_ALSA
/* Define if we have the OSS backend */
//#define HAVE_OSS
/* Define if we have the Solaris backend */
/* #undef HAVE_SOLARIS */
/* Define if we have the SndIO backend */
/* #undef HAVE_SNDIO */
/* Define if we have the QSA backend */
/* #undef HAVE_QSA */
/* Define if we have the MMDevApi backend */
/* #undef HAVE_MMDEVAPI */
/* Define if we have the DSound backend */
/* #undef HAVE_DSOUND */
/* Define if we have the Windows Multimedia backend */
/* #undef HAVE_WINMM */
/* Define if we have the PortAudio backend */
/* #undef HAVE_PORTAUDIO */
/* Define if we have the PulseAudio backend */
//#define HAVE_PULSEAUDIO
/* Define if we have the CoreAudio backend */
/* #undef HAVE_COREAUDIO */
/* Define if we have the OpenSL backend */
#define HAVE_OPENSL
/* Define if we have the Wave Writer backend */
#define HAVE_WAVE
/* Define if we have the stat function */
#define HAVE_STAT
/* Define if we have the lrintf function */
#define HAVE_LRINTF
/* Define if we have the strtof function */
#define HAVE_STRTOF
/* Define if we have the __int64 type */
/* #undef HAVE___INT64 */
/* Define to the size of a long int type */
#define SIZEOF_LONG 4
/* Define to the size of a long long int type */
#define SIZEOF_LONG_LONG 8
/* Define if we have C99 variable-length array support */
#define HAVE_C99_VLA
/* Define if we have C99 _Bool support */
#define HAVE_C99_BOOL
/* Define if we have C11 _Static_assert support */
#define HAVE_C11_STATIC_ASSERT
/* Define if we have C11 _Alignas support */
#define HAVE_C11_ALIGNAS
/* Define if we have C11 _Atomic support */
//#define HAVE_C11_ATOMIC
/* Define if we have GCC's destructor attribute */
#define HAVE_GCC_DESTRUCTOR
/* Define if we have GCC's format attribute */
#define HAVE_GCC_FORMAT
/* Define if we have stdint.h */
#define HAVE_STDINT_H
/* Define if we have stdbool.h */
#define HAVE_STDBOOL_H
/* Define if we have stdalign.h */
#define HAVE_STDALIGN_H
/* Define if we have windows.h */
/* #undef HAVE_WINDOWS_H */
/* Define if we have dlfcn.h */
#define HAVE_DLFCN_H
/* Define if we have pthread_np.h */
/* #undef HAVE_PTHREAD_NP_H */
/* Define if we have alloca.h */
/* #undef HAVE_ALLOCA_H */
/* Define if we have malloc.h */
#define HAVE_MALLOC_H
/* Define if we have ftw.h */
#define HAVE_FTW_H
/* Define if we have io.h */
/* #undef HAVE_IO_H */
/* Define if we have strings.h */
#define HAVE_STRINGS_H
/* Define if we have cpuid.h */
//#define HAVE_CPUID_H
/* Define if we have intrin.h */
/* #undef HAVE_INTRIN_H */
/* Define if we have sys/sysconf.h */
/* #undef HAVE_SYS_SYSCONF_H */
/* Define if we have guiddef.h */
/* #undef HAVE_GUIDDEF_H */
/* Define if we have initguid.h */
/* #undef HAVE_INITGUID_H */
/* Define if we have ieeefp.h */
/* #undef HAVE_IEEEFP_H */
/* Define if we have float.h */
#define HAVE_FLOAT_H
/* Define if we have fenv.h */
#define HAVE_FENV_H
/* Define if we have GCC's __get_cpuid() */
//#define HAVE_GCC_GET_CPUID
/* Define if we have the __cpuid() intrinsic */
/* #undef HAVE_CPUID_INTRINSIC */
/* Define if we have _controlfp() */
/* #undef HAVE__CONTROLFP */
/* Define if we have __control87_2() */
/* #undef HAVE___CONTROL87_2 */
/* Define if we have ftw() */
#define HAVE_FTW
/* Define if we have _wfindfirst() */
/* #undef HAVE__WFINDFIRST */
/* Define if we have pthread_setschedparam() */
//#define HAVE_PTHREAD_SETSCHEDPARAM
/* Define if we have pthread_setname_np() */
//#define HAVE_PTHREAD_SETNAME_NP
/* Define if we have pthread_set_name_np() */
/* #undef HAVE_PTHREAD_SET_NAME_NP */
/* Define if we have pthread_mutexattr_setkind_np() */
/* #undef HAVE_PTHREAD_MUTEXATTR_SETKIND_NP */
/* Define if we have pthread_mutex_timedlock() */
//#define HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
/*
* SD-kortin ajuri
*/
#ifndef _SDCARD_H_
#define _SDCARD_H_
int SD_card_init();
int SD_read_lba(void *buff, unsigned long lba);
#endif
|
/* GStreamer RTP payloader unit tests
* Copyright (C) 2009 Axis Communications <dev-gstreamer@axis.com>
* @author Ognyan Tonchev <ognyan@axis.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/check/gstcheck.h>
#include <gst/base/gstbasesink.h>
#include <stdlib.h>
#include <unistd.h>
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
#define RTP_HEADER_SIZE 12
#define RTP_PAYLOAD_SIZE 1024
/*
* Number of bytes received in the render function when using buffer lists
*/
static guint render_list_bytes_received;
/*
* Render function for testing udpsink with buffer lists
*/
static GstFlowReturn
udpsink_render (GstBaseSink * sink, GstBufferList * list)
{
GstBufferListIterator *it;
fail_if (!list);
/*
* Count the size of the rtp header and the payload in the buffer list.
*/
it = gst_buffer_list_iterate (list);
/* Loop through all groups */
while (gst_buffer_list_iterator_next_group (it)) {
GstBuffer *buf;
/* Loop through all buffers in the current group */
while ((buf = gst_buffer_list_iterator_next (it))) {
guint size;
size = GST_BUFFER_SIZE (buf);
GST_DEBUG ("rendered %u bytes", size);
render_list_bytes_received += size;
}
}
gst_buffer_list_iterator_free (it);
return GST_FLOW_OK;
}
static void
_set_render_function (GstElement * bsink)
{
GstBaseSinkClass *bsclass;
bsclass = GST_BASE_SINK_GET_CLASS ((GstBaseSink *) bsink);
/* Add callback function for the buffer list tests */
bsclass->render_list = udpsink_render;
}
static GstBufferList *
_create_buffer_list (guint * data_size)
{
GstBufferList *list;
GstBufferListIterator *it;
GstBuffer *rtp_buffer;
GstBuffer *data_buffer;
list = gst_buffer_list_new ();
it = gst_buffer_list_iterate (list);
/*** First group, i.e. first packet. **/
/* Create the RTP header buffer */
rtp_buffer = gst_buffer_new ();
GST_BUFFER_MALLOCDATA (rtp_buffer) = g_malloc (RTP_HEADER_SIZE);
GST_BUFFER_DATA (rtp_buffer) = GST_BUFFER_MALLOCDATA (rtp_buffer);
GST_BUFFER_SIZE (rtp_buffer) = RTP_HEADER_SIZE;
memset (GST_BUFFER_DATA (rtp_buffer), 0, RTP_HEADER_SIZE);
/* Create the buffer that holds the payload */
data_buffer = gst_buffer_new ();
GST_BUFFER_MALLOCDATA (data_buffer) = g_malloc (RTP_PAYLOAD_SIZE);
GST_BUFFER_DATA (data_buffer) = GST_BUFFER_MALLOCDATA (data_buffer);
GST_BUFFER_SIZE (data_buffer) = RTP_PAYLOAD_SIZE;
memset (GST_BUFFER_DATA (data_buffer), 0, RTP_PAYLOAD_SIZE);
/* Create a new group to hold the rtp header and the payload */
gst_buffer_list_iterator_add_group (it);
gst_buffer_list_iterator_add (it, rtp_buffer);
gst_buffer_list_iterator_add (it, data_buffer);
/*** Second group, i.e. second packet. ***/
/* Create the RTP header buffer */
rtp_buffer = gst_buffer_new ();
GST_BUFFER_MALLOCDATA (rtp_buffer) = g_malloc (RTP_HEADER_SIZE);
GST_BUFFER_DATA (rtp_buffer) = GST_BUFFER_MALLOCDATA (rtp_buffer);
GST_BUFFER_SIZE (rtp_buffer) = RTP_HEADER_SIZE;
memset (GST_BUFFER_DATA (rtp_buffer), 0, RTP_HEADER_SIZE);
/* Create the buffer that holds the payload */
data_buffer = gst_buffer_new ();
GST_BUFFER_MALLOCDATA (data_buffer) = g_malloc (RTP_PAYLOAD_SIZE);
GST_BUFFER_DATA (data_buffer) = GST_BUFFER_MALLOCDATA (data_buffer);
GST_BUFFER_SIZE (data_buffer) = RTP_PAYLOAD_SIZE;
memset (GST_BUFFER_DATA (data_buffer), 0, RTP_PAYLOAD_SIZE);
/* Create a new group to hold the rtp header and the payload */
gst_buffer_list_iterator_add_group (it);
gst_buffer_list_iterator_add (it, rtp_buffer);
gst_buffer_list_iterator_add (it, data_buffer);
/* Calculate the size of the data */
*data_size = 2 * RTP_HEADER_SIZE + 2 * RTP_PAYLOAD_SIZE;
gst_buffer_list_iterator_free (it);
return list;
}
static void
udpsink_test (gboolean use_buffer_lists)
{
GstElement *udpsink;
GstPad *srcpad;
GstBufferList *list;
guint data_size;
list = _create_buffer_list (&data_size);
udpsink = gst_check_setup_element ("udpsink");
if (use_buffer_lists)
_set_render_function (udpsink);
srcpad = gst_check_setup_src_pad_by_name (udpsink, &srctemplate, "sink");
gst_element_set_state (udpsink, GST_STATE_PLAYING);
gst_pad_push_event (srcpad, gst_event_new_new_segment_full (FALSE, 1.0, 1.0,
GST_FORMAT_TIME, 0, -1, 0));
gst_pad_push_list (srcpad, list);
gst_check_teardown_pad_by_name (udpsink, "sink");
gst_check_teardown_element (udpsink);
if (use_buffer_lists)
fail_if (data_size != render_list_bytes_received);
}
GST_START_TEST (test_udpsink)
{
udpsink_test (FALSE);
}
GST_END_TEST;
GST_START_TEST (test_udpsink_bufferlist)
{
udpsink_test (TRUE);
}
GST_END_TEST;
/*
* Creates the test suite.
*
* Returns: pointer to the test suite.
*/
static Suite *
udpsink_suite ()
{
Suite *s = suite_create ("udpsink_test");
TCase *tc_chain = tcase_create ("linear");
/* Set timeout to 60 seconds. */
tcase_set_timeout (tc_chain, 60);
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_udpsink);
tcase_add_test (tc_chain, test_udpsink_bufferlist);
return s;
}
GST_CHECK_MAIN (udpsink)
|
#pragma once
#include <string>
#include <vector>
#include <memory>
#include <citygml/citygml_api.h>
#include <citygml/vecs.hpp>
#include <citygml/object.h>
namespace citygml {
class LinearRing;
/**
* @brief The TextureCoordinates class describes a mapping of texture coordinates to the vertices of a linear ring
*/
class LIBCITYGML_EXPORT TextureCoordinates : public Object {
public:
TextureCoordinates(std::string id, std::string targetID);
bool targets(const LinearRing& ring) const;
std::string getTargetLinearRingID() const;
const std::vector<TVec2f>& getCoords() const;
void setCoords(std::vector<TVec2f> texCoords);
bool eraseCoordinate(unsigned int i);
protected:
std::string m_targetID;
std::vector<TVec2f> m_coordlist;
};
}
|
/* workaround for building with old glibc / kernel headers */
#include <alsa/sound/type_compat.h>
#include <alsa/sound/uapi/asound.h>
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2013 CNRS
*
* StarPU is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* StarPU is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
*/
#include <config.h>
#include <core/perfmodel/perfmodel.h>
#include "../helper.h"
#include <unistd.h>
#ifdef STARPU_HAVE_WINDOWS
#include <io.h>
#include <fcntl.h>
#endif
#define STRING "booh"
static
int _check_number(double val, int checknan)
{
char *tmp = "starpu_XXXXXX";
char filename[100];
strcpy(filename, tmp);
#ifdef STARPU_HAVE_WINDOWS
_mktemp(filename);
#else
{
int id = mkstemp(filename);
/* fail */
if (id < 0)
{
FPRINTF(stderr, "Error when creating temp file\n");
return 1;
}
}
#endif
/* write the double value in the file followed by a predefined string */
FILE *f = fopen(filename, "w");
if (!f)
{
FPRINTF(stderr, "Error when opening file %s\n", filename);
return 1;
}
fprintf(f, "%lf %s\n", val, STRING);
fclose(f);
/* read the double value and the string back from the file */
f = fopen(filename, "r");
if (!f)
{
FPRINTF(stderr, "Error when opening file %s\n", filename);
return 1;
}
double lat;
char str[10];
int x = _starpu_read_double(f, "%lf", &lat);
int y = fscanf(f, "%s", str);
fclose(f);
unlink(filename);
/* check that what has been read is identical to what has been written */
int pass;
pass = (x == 1) && (y == 1);
pass = pass && strcmp(str, STRING) == 0;
if (checknan)
pass = pass && isnan(val) && isnan(lat);
else
pass = pass && lat == val;
return pass?0:1;
}
int main(int argc, char **argv)
{
int ret;
ret = _check_number(42.0, 0);
FPRINTF(stderr, "%s when reading %lf\n", ret==0?"Success":"Error", 42.0);
if (ret==0)
{
ret = _check_number(NAN, 1);
FPRINTF(stderr, "%s when reading %lf\n", ret==0?"Success":"Error", NAN);
}
return ret;
}
|
#ifndef LAYERINTERFACEINDICATOR_H
#define LAYERINTERFACEINDICATOR_H
// MOOSE includes
#include "InternalSideIndicator.h"
/**
* Computes the "error" as defined by the difference between the layers. Since,
* layer ids are arbitrary the
* magnitude of the error is not relevant, just that the error is above zero.
* Therefore, when a difference is computed
* the "error" is set to one. Thus, this should be used with the
* ErrorToleranceMarker.
*
* This inherits from InternalSideIndicator to gain access to neighbor
* information.
*/
class LayerInterfaceIndicator : public InternalSideIndicator
{
public:
static InputParameters validParams();
LayerInterfaceIndicator(const InputParameters & params);
/**
* This elminates the aggregation performed by the
* InternalSideIndicator::finalize,
* which is not needed here.
*/
virtual void finalize() override {}
protected:
/// Computes the difference in the layer ids
virtual void computeIndicator() override;
/**
* This method is not used.
*
* see computeIndicator
*/
virtual Real computeQpIntegral() final { return 0.0; }
/// Tolerence for considering a layer ids different
const Real & _tolerance;
};
#endif // LAYERINTERFACEINDICATOR_H
|
//
// IGREntityExCatalog.h
// exTVPlayer
//
// Created by Vitalii Parovishnyk on 12/19/15.
// Copyright © 2015 IGR Software. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class IGREntityExChanel, IGREntityExTrack;
NS_ASSUME_NONNULL_BEGIN
@interface IGREntityExCatalog : NSManagedObject
// Insert code here to declare functionality of your managed object subclass
+ (NSArray *)history;
+ (IGREntityExCatalog *)lastViewed;
+ (NSArray *)favorites;
@end
NS_ASSUME_NONNULL_END
#import "IGREntityExCatalog+CoreDataProperties.h"
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2021 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef LIBMESH_CONST_FUNCTION_H
#define LIBMESH_CONST_FUNCTION_H
// Local includes
#include "libmesh/dense_vector.h"
#include "libmesh/function_base.h"
#include "libmesh/point.h"
#include "libmesh/auto_ptr.h" // libmesh_make_unique
// C++ includes
#include <string>
namespace libMesh
{
/**
* Function that returns a single value that never changes. All
* overridden virtual functions are documented in function_base.h.
*
* \author Roy Stogner
* \date 2012
* \brief Function that returns a single value that never changes.
*/
template <typename Output=Number>
class ConstFunction : public FunctionBase<Output>
{
public:
explicit
ConstFunction (const Output & c) : _c(c)
{
this->_initialized = true;
this->_is_time_dependent = false;
}
/**
* The 5 special functions can be defaulted for this class.
*/
ConstFunction (ConstFunction &&) = default;
ConstFunction (const ConstFunction &) = default;
ConstFunction & operator= (const ConstFunction &) = default;
ConstFunction & operator= (ConstFunction &&) = default;
virtual ~ConstFunction () = default;
virtual Output operator() (const Point &,
const Real = 0) override
{ return _c; }
virtual void operator() (const Point &,
const Real,
DenseVector<Output> & output) override
{
unsigned int size = output.size();
for (unsigned int i=0; i != size; ++i)
output(i) = _c;
}
virtual std::unique_ptr<FunctionBase<Output>> clone() const override
{
return libmesh_make_unique<ConstFunction<Output>>(_c);
}
private:
Output _c;
};
} // namespace libMesh
#endif // LIBMESH_CONST_FUNCTION_H
|
/*
* MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
* Copyright (C) 2013-2020 Manav Bhatia and MAST authors
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __mast__structural_modal_eigenproblem_assembly_elem_operations_h__
#define __mast__structural_modal_eigenproblem_assembly_elem_operations_h__
// MAST includes
#include "base/eigenproblem_assembly_elem_operations.h"
namespace MAST {
// Forward declerations
class StructuralAssembly;
class StructuralModalEigenproblemAssemblyElemOperations:
public MAST::EigenproblemAssemblyElemOperations {
public:
/*!
* constructor associates the eigen system with this assembly object
*/
StructuralModalEigenproblemAssemblyElemOperations();
/*!
* destructor resets the association with the eigen system
* from this assembly object
*/
virtual ~StructuralModalEigenproblemAssemblyElemOperations();
/*!
* attached the incompatible solution object
*/
void attach_incompatible_solution_object(MAST::StructuralAssembly& str_assembly);
/*!
* clear the incompatible solution object
*/
void clear_incompatible_solution_object();
/*!
* sets the element solution(s) before calculations
*/
virtual void
set_elem_solution(const RealVectorX& sol);
/*!
* sets the element solution sensitivity before calculations
*/
virtual void
set_elem_solution_sensitivity(const RealVectorX& sol);
/*!
* performs the element calculations over \p elem, and returns
* the element matrices for the eigenproblem
* \f$ A x = \lambda B x \f$.
*/
virtual void
elem_calculations(RealMatrixX& mat_A,
RealMatrixX& mat_B);
/*!
* performs the element sensitivity calculations over \p elem,
* and returns the element matrices for the eigenproblem
* \f$ A x = \lambda B x \f$.
*/
virtual void
elem_sensitivity_calculations(const MAST::FunctionBase& f,
bool base_sol,
RealMatrixX& mat_A,
RealMatrixX& mat_B);
/*!
* performs the element topology sensitivity calculations over \p elem.
*/
virtual void
elem_topology_sensitivity_calculations(const MAST::FunctionBase& f,
bool base_sol,
RealMatrixX& mat_A,
RealMatrixX& mat_B);
/*!
* performs the element topology sensitivity calculations over \p elem.
*/
virtual void
elem_topology_sensitivity_calculations(const MAST::FunctionBase& f,
bool base_sol,
const MAST::FieldFunction<RealVectorX>& vel,
RealMatrixX& mat_A,
RealMatrixX& mat_B);
/*!
* sets the structural element y-vector if 1D element is used.
*/
virtual void
set_elem_data(unsigned int dim,
const libMesh::Elem& ref_elem,
MAST::GeomElem& elem) const;
/*!
* initializes the object for the geometric element \p elem. This
* expects the object to be in a cleared state, so the user should
* call \p clear_elem() between successive initializations.
*/
virtual void
init(const MAST::GeomElem& elem);
protected:
MAST::StructuralAssembly* _incompatible_sol_assembly;
};
}
#endif // __mast__structural_modal_eigenproblem_assembly_elem_operations_h__
|
#include <sys/wait.h>
#include "syscall.h"
#include "libc.h"
pid_t waitpid(pid_t pid, int *status, int options)
{
int r;
CANCELPT_BEGIN;
r = syscall(SYS_wait4, pid, status, options, 0);
if (r<0) CANCELPT_TRY;
CANCELPT_END;
return r;
}
|
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTESTLITEEGLINTEGRATION_H
#define QTESTLITEEGLINTEGRATION_H
#include "qeglconvenience.h"
class QXlibEglIntegration
{
public:
static VisualID getCompatibleVisualId(Display *display, EGLDisplay eglDisplay, EGLConfig config);
};
#endif // QTESTLITEEGLINTEGRATION_H
|
/* -*- C++ -*-
* mapredo
* Copyright (C) 2015 Kjell Irgens <hextremist@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
#ifndef _HEXTREME_MAPREDO_PLUGIN_LOADER_WIN32_H
#define _HEXTREME_MAPREDO_PLUGIN_LOADER_WIN32_H
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#include <filesystem>
#include <iostream>
#include "base.h"
class plugin_loader
{
public:
/**
* Create a loader able to provide new map-reduce objects from a
* plugin module.
* @param plugin_path absolute or relative path to .dll module file
*/
plugin_loader (std::string plugin_path) {
if (plugin_path.size() < 5
|| plugin_path.substr(plugin_path.size() - 4) != ".dll")
{
plugin_path += ".dll";
}
if (!load(plugin_path))
{
throw std::runtime_error ("Unable to find mapreduce plugin "
+ plugin_path);
}
}
~plugin_loader() {
typedef void (*destroy_t)(mapredo::base*);
auto destroyer = (destroy_t)GetProcAddress(_lib, "destroy");
auto err = GetLastError();
if (destroyer == nullptr)
{
TCHAR msg[1024];
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
msg,
1024,
NULL);
std::cerr << "Can not unload plugin: " << msg << "\n";
}
else
{
for (auto* obj: _mapred)
{
destroyer (obj);
}
}
FreeLibrary (_lib);
}
/**
* Get a new mapreducer object. The object is automatically destroyed
* with the plugin loader object.
*/
mapredo::base& get() {
auto* mapred = _creator();
if (!mapred)
{
throw std::runtime_error ("The create() function of \"" + _path
+ "\" returned a null pointer");
}
_mapred.push_back (mapred);
return *mapred;
}
private:
typedef mapredo::base* (*create_t)();
bool load (const std::string& path) {
const size_t error_msg_size = 1024;
TCHAR error_msg[error_msg_size];
std::tr2::sys::path load_path (path);
if (std::tr2::sys::exists (load_path))
{
SetErrorMode (SEM_FAILCRITICALERRORS);
_lib = LoadLibrary (path.c_str());
auto load_error = GetLastError();
if (_lib == NULL)
{
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
load_error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
error_msg,
error_msg_size,
NULL);
throw std::runtime_error (
std::string("Can not load plugin '" + path + "': ")
+ error_msg);
}
SetErrorMode(0);
_creator = (create_t)GetProcAddress(_lib, "create");
load_error = GetLastError();
if (_creator == nullptr)
{
FreeLibrary (_lib);
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
load_error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
error_msg,
error_msg_size,
NULL);
throw std::runtime_error (
std::string("Can not create plugin '" + path + ": ")
+ error_msg);
}
_path = path;
return true;
}
else return false;
}
create_t _creator;
std::vector<mapredo::base*> _mapred;
HMODULE _lib;
std::string _path;
};
#endif
#endif
|
/*
* LuaCompat.h
*
* Library that tries to hide almost all diferences
* between Lua versions
*
*/
#ifndef __LUACOMPAT_H
#define __LUACOMPAT_H
#if defined(__cplusplus)
extern "C" {
#endif
void luaCompat_openlib(lua_State* L, const char* libname, const struct luaL_reg* funcs);
void luaCompat_error(lua_State* L, const char* message);
int luaCompat_call(lua_State* L, int nargs, int nresults, const char** pErrMsg);
void luaCompat_newLuaType(lua_State* L, const char* module_name, const char* name);
void luaCompat_pushTypeByName(lua_State* L, const char* module, const char* type_name);
int luaCompat_newTypedObject(lua_State* L, void* object);
void luaCompat_setType(lua_State* L, int index);
void* luaCompat_getTypedObject(lua_State* L, int index);
int luaCompat_isOfType(lua_State* L, const char* module, const char* type);
void luaCompat_getType(lua_State* L, int index);
long luaCompat_getType2(lua_State* L, int index);
void luaCompat_pushPointer(lua_State* L, void *pointer);
void* luaCompat_getPointer(lua_State* L, int index);
void luaCompat_pushCBool(lua_State* L, int value);
int luaCompat_toCBool(lua_State* L, int index);
void luaCompat_pushBool(lua_State* L, int value);
void luaCompat_handleEqEvent(lua_State* L);
void luaCompat_handleGettableEvent(lua_State* L);
void luaCompat_handleSettableEvent(lua_State* L);
void luaCompat_handleNoIndexEvent(lua_State* L);
void luaCompat_handleGCEvent(lua_State* L);
void luaCompat_handleFuncCallEvent(lua_State* L);
void luaCompat_moduleCreate(lua_State* L, const char* module);
void luaCompat_moduleSet(lua_State* L, const char* module, const char* key);
void luaCompat_moduleGet(lua_State* L, const char* module, const char* key);
int luaCompat_upvalueIndex(lua_State* L, int which, int num_upvalues);
int luaCompat_getNumParams(lua_State* L, int num_upvalues);
void luaCompat_needStack(lua_State* L, long size);
void luaCompat_setglobal(lua_State* L);
void luaCompat_getglobal(lua_State* L);
int luaCompat_checkTagToCom(lua_State *L, int luaval);
#if defined(__cplusplus)
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#include <lua.h>
#ifdef __cplusplus
}
#endif
// defined just to avoid compiler erros
#ifdef LUA4
#define LUA_TBOOLEAN 0xabcdef
#define lua_toboolean(x,y) lua_tonumber((x),(y))
#ifdef __cplusplus
extern "C"
{
#endif
#include <luadebug.h>
#ifdef __cplusplus
}
#endif
#endif
#endif /* __LUACOMPAT_H */
|
//
// libavg - Media Playback Engine.
// Copyright (C) 2003-2021 Ulrich von Zadow
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Current versions can be found at www.libavg.de
//
#ifndef _SyncVideoDecoder_H_
#define _SyncVideoDecoder_H_
#include "../avgconfigwrapper.h"
#include "VideoDecoder.h"
namespace avg {
class FFMpegDemuxer;
class FFMpegFrameDecoder;
typedef boost::shared_ptr<FFMpegFrameDecoder> FFMpegFrameDecoderPtr;
class AVG_API SyncVideoDecoder: public VideoDecoder
{
public:
SyncVideoDecoder();
virtual ~SyncVideoDecoder();
virtual void open(const std::string& sFilename, bool bEnableSound);
virtual void startDecoding(bool bDeliverYCbCr, const AudioParams* pAP);
virtual void close();
virtual int getCurFrame() const;
virtual int getNumFramesQueued() const;
virtual float getCurTime() const;
virtual float getFPS() const;
virtual void setFPS(float fps);
virtual FrameAvailableCode getRenderedBmps(std::vector<BitmapPtr>& pBmps,
float timeWanted);
virtual void throwAwayFrame(float timeWanted);
virtual void seek(float destTime);
virtual void loop();
virtual bool isEOF() const;
private:
FrameAvailableCode readFrameForTime(AVFrame* pFrame, float timeWanted);
void readFrame(AVFrame* pFrame);
FFMpegFrameDecoderPtr m_pFrameDecoder;
bool m_bVideoSeekDone;
FFMpegDemuxer * m_pDemuxer;
bool m_bProcessingLastFrames;
bool m_bFirstPacket;
bool m_bUseStreamFPS;
float m_FPS;
AVFrame* m_pFrame;
};
typedef boost::shared_ptr<SyncVideoDecoder> SyncVideoDecoderPtr;
}
#endif
|
#ifndef SIXTRL_COMMON_BE_DIPEDGE_TRACK_C99_H__
#define SIXTRL_COMMON_BE_DIPEDGE_TRACK_C99_H__
#if !defined( SIXTRL_NO_INCLUDES )
#include "sixtracklib/common/definitions.h"
#include "sixtracklib/common/track/definitions.h"
#include "sixtracklib/common/internal/beam_elements_defines.h"
#include "sixtracklib/common/internal/objects_type_id.h"
#include "sixtracklib/common/particles.h"
#endif /* !defined( SIXTRL_NO_INCLUDES ) */
#if defined( __cplusplus ) && !defined( _GPUCODE )
extern "C" {
#endif /* C++, host */
struct NS(DipoleEdge);
SIXTRL_STATIC SIXTRL_FN NS(track_status_t) NS(Track_particle_dipedge)(
SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT particles,
NS(particle_num_elements_t) const particle_idx,
SIXTRL_BE_ARGPTR_DEC const struct NS(DipoleEdge)
*const SIXTRL_RESTRICT dipedge);
#if defined( __cplusplus ) && !defined( _GPUCODE )
}
#endif /* C++, host */
#if !defined( SIXTRL_NO_INCLUDES )
#include "sixtracklib/common/be_dipedge/be_dipedge.h"
#endif /* !defined( SIXTRL_NO_INCLUDES ) */
#if defined( __cplusplus ) && !defined( _GPUCODE )
extern "C" {
#endif /* C++, host */
SIXTRL_INLINE NS(track_status_t) NS(Track_particle_dipedge)(
SIXTRL_PARTICLE_ARGPTR_DEC NS(Particles)* SIXTRL_RESTRICT particles,
NS(particle_num_elements_t) const particle_idx,
SIXTRL_BE_ARGPTR_DEC const NS(DipoleEdge) *const SIXTRL_RESTRICT dipedge )
{
NS(Particles_add_to_px_value)( particles, particle_idx,
NS(DipoleEdge_r21)( dipedge ) *
NS(Particles_get_x_value)( particles, particle_idx ) );
NS(Particles_add_to_py_value)( particles, particle_idx,
NS(DipoleEdge_r43)( dipedge ) *
NS(Particles_get_y_value)( particles, particle_idx ) );
return SIXTRL_TRACK_SUCCESS;
}
#if defined( __cplusplus ) && !defined( _GPUCODE )
}
#endif /* C++, host */
#endif /* SIXTRL_COMMON_BE_DIPEDGE_TRACK_C99_H__ */
/* end: sixtracklib/common/be_dipedge/track.h */
|
/*
Copyright (C) 2011 Samsung Electronics
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* @file ewk_network.h
* @brief Describes the network API.
*/
#ifndef ewk_network_h
#define ewk_network_h
#include <Eina.h>
#include <libsoup/soup-session.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Sets the given proxy URI to network backend.
*
* @param proxy URI to set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI void ewk_network_proxy_uri_set(const char *proxy);
/**
* Gets the proxy URI from the network backend.
*
* The returned string should be freed by eina_stringshare_del() after use.
*
* @return current proxy URI or @c NULL if it's not set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI const char *ewk_network_proxy_uri_get(void);
/**
* Sets if network backend is online or not.
*
* @param online @c EINA_FALSE if network is disconnected
*/
EAPI void ewk_network_state_notifier_online_set(Eina_Bool online);
/**
* Returns whether HTTPS connections should check the received certificate and error out if it is invalid.
*
* By default, HTTPS connections are performed regardless of the validity of the certificate provided.
*
* @sa ewk_network_tls_ca_certificates_path_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI Eina_Bool ewk_network_tls_certificate_check_get(void);
/**
* Sets whether HTTPS connections should check the received certificate and error out if it is invalid.
*
* By default, HTTPS connections are performed regardless of the validity of the certificate provided.
*
* @param enable Whether to check the provided certificates or not.
*
* @sa ewk_network_tls_ca_certificates_path_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI void ewk_network_tls_certificate_check_set(Eina_Bool enable);
/**
* Returns the path to a file containing the platform's root X.509 CA certificates.
*
* The file is a list of concatenated PEM-format X.509 certificates used as root CA certificates.
* They are used to validate all the certificates received when a TLS connection (such as an HTTPS one) is made.
*
* If @c ewk_network_tls_certificate_check_get() returns @c EINA_TRUE, the certificates set by this function
* will be used to decide whether a certificate provided by a web site is invalid and the request should then
* be cancelled.
*
* By default, the path is not set, so all certificates are considered as not signed by a trusted root CA.
*
* @sa ewk_network_tls_certificate_check_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI const char *ewk_network_tls_ca_certificates_path_get(void);
/**
* Sets the path to a file containing the platform's root X.509 CA certificates.
*
* The file is a list of concatenated PEM-format X.509 certificates used as root CA certificates.
* They are used to validate all the certificates received when a TLS connection (such as an HTTPS one) is made.
*
* If @c ewk_network_tls_certificate_check_get() returns @c EINA_TRUE, the certificates set by this function
* will be used to decide whether a certificate provided by a web site is invalid and the request should then
* be cancelled.
*
* By default, the path is not set, so all certificates are considered as not signed by a trusted root CA.
*
* @param path The path to the certificate bundle.
*
* @sa ewk_network_tls_certificate_check_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI void ewk_network_tls_ca_certificates_path_set(const char *path);
/**
* Returns the default @c SoupSession used by all views.
*
* @return The default @c SoupSession in use.
*/
EAPI SoupSession *ewk_network_default_soup_session_get(void);
#ifdef __cplusplus
}
#endif
#endif // ewk_network_h
|
/* t-encrypt-large.c - Regression test for large amounts of data.
* Copyright (C) 2005 g10 Code GmbH
*
* This file is part of GPGME.
*
* GPGME is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* GPGME is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <https://gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/* We need to include config.h so that we know whether we are building
with large file system (LFS) support. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gpgme.h>
#include "t-support.h"
struct cb_parms
{
size_t bytes_to_send;
size_t bytes_received;
};
/* The read callback used by GPGME to read data. */
static ssize_t
read_cb (void *handle, void *buffer, size_t size)
{
struct cb_parms *parms = handle;
char *p = buffer;
for (; size && parms->bytes_to_send; size--, parms->bytes_to_send--)
*p++ = rand ();
return (p - (char*)buffer);
}
/* The write callback used by GPGME to write data. */
static ssize_t
write_cb (void *handle, const void *buffer, size_t size)
{
struct cb_parms *parms = handle;
(void)buffer;
parms->bytes_received += size;
return size;
}
static void
progress_cb (void *opaque, const char *what, int type, int current, int total)
{
/* This is just a dummy. */
(void)opaque;
(void)what;
(void)type;
(void)current;
(void)total;
}
int
main (int argc, char *argv[])
{
gpgme_ctx_t ctx;
gpgme_error_t err;
struct gpgme_data_cbs cbs;
gpgme_data_t in, out;
gpgme_key_t key[3] = { NULL, NULL, NULL };
gpgme_encrypt_result_t result;
size_t nbytes;
struct cb_parms parms;
if (argc > 1)
nbytes = atoi (argv[1]);
else
nbytes = 100000;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
memset (&cbs, 0, sizeof cbs);
cbs.read = read_cb;
cbs.write = write_cb;
memset (&parms, 0, sizeof parms);
parms.bytes_to_send = nbytes;
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_armor (ctx, 0);
/* Install a progress handler to enforce a bit of more work to the
gpgme i/o system. */
gpgme_set_progress_cb (ctx, progress_cb, NULL);
err = gpgme_data_new_from_cbs (&in, &cbs, &parms);
fail_if_err (err);
err = gpgme_data_new_from_cbs (&out, &cbs, &parms);
fail_if_err (err);
err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734",
&key[0], 0);
fail_if_err (err);
err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",
&key[1], 0);
fail_if_err (err);
err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
fail_if_err (err);
result = gpgme_op_encrypt_result (ctx);
if (result->invalid_recipients)
{
fprintf (stderr, "Invalid recipient encountered: %s\n",
result->invalid_recipients->fpr);
exit (1);
}
printf ("plaintext=%u bytes, ciphertext=%u bytes\n",
(unsigned int)nbytes, (unsigned int)parms.bytes_received);
gpgme_key_unref (key[0]);
gpgme_key_unref (key[1]);
gpgme_data_release (in);
gpgme_data_release (out);
gpgme_release (ctx);
return 0;
}
|
#pragma once
#include "Material.h"
#include "LinearInterpolation.h"
class Function;
class HeatConductionMaterial : public Material
{
public:
HeatConductionMaterial(const InputParameters & parameters);
protected:
virtual void computeProperties();
private:
void readFile();
void check();
std::string _property_file;
int _tpoint;
Real _epsilon;
VariableValue & _temperature;
MaterialProperty<Real> & _k;
MaterialProperty<Real> & _k_dT;
MaterialProperty<Real> & _cp;
MaterialProperty<Real> & _cp_dT;
MaterialProperty<Real> & _rho;
MaterialProperty<Real> & _rho_dT;
MaterialProperty<Real> & _epsilon_material;
LinearInterpolation _func_roe_T;
LinearInterpolation _func_k_T;
LinearInterpolation _func_cp_T;
std::vector<Real> _T_list;
std::vector<Real> _roe_list;
std::vector<Real> _k_list;
std::vector<Real> _cp_list;
};
template<>
InputParameters validParams<HeatConductionMaterial>();
|
/****************************************************************************
**
** Copyright (C) 2014 Kurt Pattyn <pattyn.kurt@gmail.com>.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWebSockets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWEBSOCKET_H
#define QWEBSOCKET_H
#include <QtCore/QUrl>
#include <QtNetwork/QAbstractSocket>
#ifndef QT_NO_NETWORKPROXY
#include <QtNetwork/QNetworkProxy>
#endif
#ifndef QT_NO_SSL
#include <QtNetwork/QSslError>
#include <QtNetwork/QSslConfiguration>
#endif
#include "QtWebSockets/qwebsockets_global.h"
#include "QtWebSockets/qwebsocketprotocol.h"
QT_BEGIN_NAMESPACE
class QTcpSocket;
class QWebSocketPrivate;
class QMaskGenerator;
class Q_WEBSOCKETS_EXPORT QWebSocket : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(QWebSocket)
Q_DECLARE_PRIVATE(QWebSocket)
public:
explicit QWebSocket(const QString &origin = QString(),
QWebSocketProtocol::Version version = QWebSocketProtocol::VersionLatest,
QObject *parent = 0);
virtual ~QWebSocket();
void abort();
QAbstractSocket::SocketError error() const;
QString errorString() const;
bool flush();
bool isValid() const;
QHostAddress localAddress() const;
quint16 localPort() const;
QAbstractSocket::PauseModes pauseMode() const;
QHostAddress peerAddress() const;
QString peerName() const;
quint16 peerPort() const;
#ifndef QT_NO_NETWORKPROXY
QNetworkProxy proxy() const;
void setProxy(const QNetworkProxy &networkProxy);
#endif
void setMaskGenerator(const QMaskGenerator *maskGenerator);
const QMaskGenerator *maskGenerator() const;
qint64 readBufferSize() const;
void setReadBufferSize(qint64 size);
void resume();
void setPauseMode(QAbstractSocket::PauseModes pauseMode);
QAbstractSocket::SocketState state() const;
QWebSocketProtocol::Version version() const;
QString resourceName() const;
QUrl requestUrl() const;
QString origin() const;
QWebSocketProtocol::CloseCode closeCode() const;
QString closeReason() const;
qint64 sendTextMessage(const QString &message);
qint64 sendBinaryMessage(const QByteArray &data);
#ifndef QT_NO_SSL
void ignoreSslErrors(const QList<QSslError> &errors);
void setSslConfiguration(const QSslConfiguration &sslConfiguration);
QSslConfiguration sslConfiguration() const;
#endif
public Q_SLOTS:
void close(QWebSocketProtocol::CloseCode closeCode = QWebSocketProtocol::CloseCodeNormal,
const QString &reason = QString());
void open(const QUrl &url);
void ping(const QByteArray &payload = QByteArray());
#ifndef QT_NO_SSL
void ignoreSslErrors();
#endif
Q_SIGNALS:
void aboutToClose();
void connected();
void disconnected();
void stateChanged(QAbstractSocket::SocketState state);
#ifndef QT_NO_NETWORKPROXY
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *pAuthenticator);
#endif
void readChannelFinished();
void textFrameReceived(const QString &frame, bool isLastFrame);
void binaryFrameReceived(const QByteArray &frame, bool isLastFrame);
void textMessageReceived(const QString &message);
void binaryMessageReceived(const QByteArray &message);
void error(QAbstractSocket::SocketError error);
void pong(quint64 elapsedTime, const QByteArray &payload);
void bytesWritten(qint64 bytes);
#ifndef QT_NO_SSL
void sslErrors(const QList<QSslError> &errors);
#endif
private:
QWebSocket(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version,
QObject *parent = Q_NULLPTR);
};
QT_END_NAMESPACE
#endif // QWEBSOCKET_H
|
// LICENSE: (Please see the file COPYING for details)
//
// NUS - Nemesis Utilities System: A C++ application development framework
// Copyright (C) 2006, 2008 Otavio Rodolfo Piske
//
// This file is part of NUS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation version 2.1
// of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef NSLOT_H
#define NSLOT_H
/**
\file nslot.h NSlot header
*/
#include "nevent.h"
#include "nslot1.hpp"
#endif // NSLOT_H
|
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil -*-
*
* Quadra, an action puzzle game
* Copyright (C) 1998-2000 Ludus Design
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef HEADER_LISTBOX
#define HEADER_LISTBOX
#include <vector>
#include "types.h"
#include "error.h"
#include "inter.h"
class Zone_listbox;
class Zone_listupdown: public Zone_text_select {
friend class Zone_listup;
friend class Zone_listdown;
Zone_listbox *parent;
int count;
public:
Zone_listupdown(Zone_listbox *par, const char *s, int py);
virtual void waiting();
virtual void leaved();
virtual void dirt();
};
class Zone_listup: public Zone_listupdown {
public:
Zone_listup(Zone_listbox *par);
virtual void clicked(int quel);
};
class Zone_listdown: public Zone_listupdown {
public:
Zone_listdown(Zone_listbox *par);
virtual void clicked(int quel);
};
class Listable {
public:
char list_name[64];
Font *font;
Listable(const char *s, Font *f=NULL);
virtual ~Listable() {
}
virtual bool is_equal(Listable *source);
};
class Zone_listtext: public Zone_text {
Zone_listbox *parent;
int quel;
bool high;
public:
Zone_listtext(Zone_listbox *par, int i);
virtual void clicked(int quel);
virtual void draw();
virtual void dirt();
virtual void entered();
virtual void leaved();
};
class Zone_listbox: public Zone_watch_int {
friend class Zone_listupdown;
friend class Zone_listup;
friend class Zone_listdown;
friend class Zone_listtext;
Bitmap *back;
Zone_listup *zup;
Zone_listdown *zdown;
Font *font2;
std::vector<Listable*> elements; // list of the list_box elements
int first_item; // first displayed item in list_box
std::vector<Zone_listtext*> list; // list of the displayed zone_text
std::vector<Listable*> sort_list; // temporary list of elements to sort
static int compare_sort(const void *arg1, const void *arg2);
Video_bitmap *screen;
public:
Zone_listbox(Inter* in, Bitmap *fond, Font *f, int *pval, int px, int py, int pw, int ph);
virtual ~Zone_listbox();
virtual void draw();
virtual void dirt();
virtual void enable();
virtual void disable();
virtual void process();
void add_item(const char *s) {
add_item(new Listable(s));
}
void add_item(Listable *e);
void replace_item(int i, Listable *e);
void remove_item(Listable *e);
void remove_item(int i);
Listable *get_selected();
void clear();
void sync_list();
void unselect();
void empty();
void select(int q);
int search(Listable *source);
bool in_listbox(const Zone *z); // asks if 'z' is an element of the listbox
void init_sort();
void add_sort(Listable *l);
void end_sort();
};
#endif
|
/*
* Copyright 2013 Mentor Graphics Corp.
* Copyright 2013 Mikhail Durnev
*
* mikhail_durnev@mentor.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <limits.h>
#include <linux/fs.h>
/* recursive directory creation */
int mkdir_p(const char* path, mode_t mode)
{
int result = 0;
char* path_copy = NULL;
int path_len = strlen(path);
char* p1 = NULL;
char* p2 = NULL;
if (path == NULL || path[0] != '/')
{
fprintf(stderr, "ERROR: Absolute path is required\n");
return -1;
}
path_copy = malloc(path_len + 1);
strcpy(path_copy, path);
p1 = p2 = path_copy + 1;
while (p2 != path_copy + path_len)
{
struct stat st;
p2 = strchr(p1, '/');
if (p2 == 0)
{
p2 = path_copy + path_len;
}
p2[0] = 0; /* replace '/' with end-of-line */
if (stat(path_copy, &st) != 0)
{
if (mkdir(path_copy, mode) != 0 && errno != EEXIST)
{
result = -1;
fprintf(stderr, "ERROR: Cannot create directory %s\n", path_copy);
break;
}
}
else if (!S_ISDIR(st.st_mode))
{
result = -1;
fprintf(stderr, "ERROR: File %s exists\n", path_copy);
break;
}
p2[0] = '/'; /* return '/' */
p1 = p2 + 1;
}
return result;
}
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vi: set tabstop=4 shiftwidth=4 expandtab: */
/* ***** BEGIN LICENSE BLOCK *****
* Copyright (C) 2009 Zmanda Incorporated. All Rights Reserved.
*
* This file is part of libzcloud.
*
* libzcloud is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (the LGPL)
* as published by the Free Software Foundation, either version 2.1 of
* the LGPL, or (at your option) any later version.
*
* libzcloud is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* ***** END LICENSE BLOCK ***** */
#ifndef __S3_UTIL_H__
#define __S3_UTIL_H__
#ifdef HAVE_REGEX_H
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
#include <regex.h>
#endif
#include <glib.h>
/*
* Constants
*/
/* number of raw bytes in MD5 hash */
#define S3_MD5_HASH_BYTE_LEN 16
/* length of an MD5 hash encoded as base64 (not including terminating NULL) */
#define S3_MD5_HASH_B64_LEN 25
/* length of an MD5 hash encoded as hexadecimal (not including terminating NULL) */
#define S3_MD5_HASH_HEX_LEN 32
/*
* Types
*/
#ifndef HAVE_REGEX_H
typedef GRegex* regex_t;
typedef gint regoff_t;
typedef struct
{
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
} regmatch_t;
typedef enum
{
REG_NOERROR = 0, /* Success. */
REG_NOMATCH /* Didn't find a match (for regexec). */
} reg_errcode_t;
#endif
/*
* Functions
*/
#ifndef USE_GETTEXT
/* we don't use gettextize, so hack around this ... */
#define _(str) (str)
#endif
/*
* Wrapper around regexec to handle programmer errors.
* Only returns if the regexec returns 0 (match) or REG_NOMATCH.
* See regexec(3) documentation for the rest.
*/
int
s3_regexec_wrap(regex_t *regex,
const char *str,
size_t nmatch,
regmatch_t pmatch[],
int eflags);
#ifndef HAVE_AMANDA_H
char*
find_regex_substring(const char* base_string,
const regmatch_t match);
#endif
/*
* Encode bytes using Base-64
*
* @note: GLib 2.12+ has a function for this (g_base64_encode)
* but we support much older versions. gnulib does as well, but its
* hard to use correctly (see its notes).
*
* @param to_enc: The data to encode.
* @returns: A new, null-terminated string or NULL if to_enc is NULL.
*/
gchar*
s3_base64_encode(const GByteArray *to_enc);
/*
* Encode bytes using hexadecimal
*
* @param to_enc: The data to encode.
* @returns: A new, null-terminated string or NULL if to_enc is NULL.
*/
gchar*
s3_hex_encode(const GByteArray *to_enc);
/*
* Compute the MD5 hash of a blob of data.
*
* @param to_hash: The data to compute the hash for.
* @returns: A new GByteArray containing the MD5 hash of data or
* NULL if to_hash is NULL.
*/
GByteArray*
s3_compute_md5_hash(const GByteArray *to_hash);
#endif
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- *
* gtksourcecompletionvim_wordsproposal.c
* This file is part of GtkSourceView
*
* Copyright (C) 2009 - Jesse van den Kieboom
*
* gtksourceview is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* gtksourceview is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gtksourcecompletionvimwordsproposal.h"
struct _GtkSourceCompletionVimWordsProposalPrivate
{
gchar *word;
gint use_count;
};
enum
{
UNUSED,
N_SIGNALS
};
static guint signals[N_SIGNALS];
static void gtk_source_completion_proposal_iface_init (gpointer g_iface, gpointer iface_data);
G_DEFINE_TYPE_WITH_CODE (GtkSourceCompletionVimWordsProposal,
gtk_source_completion_vim_words_proposal,
G_TYPE_OBJECT,
G_ADD_PRIVATE (GtkSourceCompletionVimWordsProposal)
G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL,
gtk_source_completion_proposal_iface_init))
static gchar *
gtk_source_completion_vim_words_proposal_get_text (GtkSourceCompletionProposal *proposal)
{
return g_strdup (GTK_SOURCE_COMPLETION_VIM_WORDS_PROPOSAL(proposal)->priv->word);
}
static void
gtk_source_completion_proposal_iface_init (gpointer g_iface,
gpointer iface_data)
{
GtkSourceCompletionProposalIface *iface = (GtkSourceCompletionProposalIface *)g_iface;
/* Interface data getter implementations */
iface->get_label = gtk_source_completion_vim_words_proposal_get_text;
iface->get_text = gtk_source_completion_vim_words_proposal_get_text;
}
static void
gtk_source_completion_vim_words_proposal_finalize (GObject *object)
{
GtkSourceCompletionVimWordsProposal *proposal;
proposal = GTK_SOURCE_COMPLETION_VIM_WORDS_PROPOSAL (object);
g_free (proposal->priv->word);
G_OBJECT_CLASS (gtk_source_completion_vim_words_proposal_parent_class)->finalize (object);
}
static void
gtk_source_completion_vim_words_proposal_class_init (GtkSourceCompletionVimWordsProposalClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_source_completion_vim_words_proposal_finalize;
signals[UNUSED] =
g_signal_new ("unused",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
static void
gtk_source_completion_vim_words_proposal_init (GtkSourceCompletionVimWordsProposal *self)
{
self->priv = gtk_source_completion_vim_words_proposal_get_instance_private (self);
self->priv->use_count = 1;
}
GtkSourceCompletionVimWordsProposal *
gtk_source_completion_vim_words_proposal_new (const gchar *word)
{
GtkSourceCompletionVimWordsProposal *proposal =
g_object_new (GTK_SOURCE_TYPE_COMPLETION_VIM_WORDS_PROPOSAL, NULL);
proposal->priv->word = g_strdup (word);
return proposal;
}
void
gtk_source_completion_vim_words_proposal_use (GtkSourceCompletionVimWordsProposal *proposal)
{
g_return_if_fail (GTK_SOURCE_IS_COMPLETION_VIM_WORDS_PROPOSAL (proposal));
g_atomic_int_inc (&proposal->priv->use_count);
}
void
gtk_source_completion_vim_words_proposal_unuse (GtkSourceCompletionVimWordsProposal *proposal)
{
g_return_if_fail (GTK_SOURCE_IS_COMPLETION_VIM_WORDS_PROPOSAL (proposal));
if (g_atomic_int_dec_and_test (&proposal->priv->use_count))
{
g_signal_emit (proposal, signals[UNUSED], 0);
}
}
const gchar *
gtk_source_completion_vim_words_proposal_get_word (GtkSourceCompletionVimWordsProposal *proposal)
{
g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_VIM_WORDS_PROPOSAL (proposal), NULL);
return proposal->priv->word;
}
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_DESCRIBECONFORMANCEPACKSTATUSREQUEST_H
#define QTAWS_DESCRIBECONFORMANCEPACKSTATUSREQUEST_H
#include "configservicerequest.h"
namespace QtAws {
namespace ConfigService {
class DescribeConformancePackStatusRequestPrivate;
class QTAWSCONFIGSERVICE_EXPORT DescribeConformancePackStatusRequest : public ConfigServiceRequest {
public:
DescribeConformancePackStatusRequest(const DescribeConformancePackStatusRequest &other);
DescribeConformancePackStatusRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(DescribeConformancePackStatusRequest)
};
} // namespace ConfigService
} // namespace QtAws
#endif
|
#ifndef __TESTNGPPST_WIN32_DLL_MODULE_LOADER_H
#define __TESTNGPPST_WIN32_DLL_MODULE_LOADER_H
#include <testngppst/testngppst.h>
#include <testngppst/runner/loaders/ModuleLoader.h>
TESTNGPPST_NS_START
struct Win32DllModuleLoaderImpl;
struct Win32DllModuleLoader : public ModuleLoader
{
Win32DllModuleLoader();
~Win32DllModuleLoader();
void load( const StringList& searchingPaths
, const std::string& modulePath);
void unload();
void* findSymbol(const std::string& symbol);
private:
Win32DllModuleLoaderImpl* This;
};
TESTNGPPST_NS_END
#endif
|
/*
* xfce4-sntray-plugin
* Copyright (C) 2019 Konstantin Pugin <ria.freelander@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SN_PROXY_H__
#define __SN_PROXY_H__
#include <gtk/gtk.h>
#include <stdbool.h>
G_BEGIN_DECLS
#define PROXY_PROP_BUS_NAME "bus-name"
#define PROXY_PROP_OBJ_PATH "object-path"
#define PROXY_PROP_ID "id"
#define PROXY_PROP_TITLE "title"
#define PROXY_PROP_CATEGORY "category"
#define PROXY_PROP_STATUS "status"
#define PROXY_PROP_LABEL "x-ayatana-label"
#define PROXY_PROP_LABEL_GUIDE "x-ayatana-label-guide"
#define PROXY_PROP_DESC "accessible-desc"
#define PROXY_PROP_ICON "icon"
#define PROXY_PROP_ICON_SIZE "icon-size"
#define PROXY_PROP_SYMBOLIC "use-symbolic"
#define PROXY_PROP_TOOLTIP_TITLE "tooltip-text"
#define PROXY_PROP_TOOLTIP_ICON "tooltip-icon"
#define PROXY_PROP_MENU_OBJECT_PATH "menu"
#define PROXY_PROP_ORDERING_INDEX "x-ayatana-ordering-index"
#define PROXY_SIGNAL_FAIL "fail"
#define PROXY_SIGNAL_INITIALIZED "initialized"
#define PROXY_DBUS_IFACE_DEFAULT "org.freedesktop.DBus"
#define PROXY_DBUS_PATH_DEFAULT "/org/freedesktop/DBus"
#define PROXY_DBUS_IFACE_PROPS "org.freedesktop.DBus.Properties"
#define PROXY_DBUS_IFACE_KDE "org.kde.StatusNotifierItem"
#define PROXY_SIGNAL_NAME_OWNER_CHANGED "NameOwnerChanged"
#define PROXY_KDE_METHOD_GET_ALL "GetAll"
G_DECLARE_FINAL_TYPE(SnProxy, sn_proxy, SN, PROXY, GObject)
G_GNUC_INTERNAL SnProxy *sn_proxy_new(const char *bus_name, const char *object_path);
G_GNUC_INTERNAL void sn_proxy_start(SnProxy *self);
G_GNUC_INTERNAL void sn_proxy_reload(SnProxy *self);
G_GNUC_INTERNAL void sn_proxy_context_menu(SnProxy *self, gint x_root, gint y_root);
G_GNUC_INTERNAL void sn_proxy_activate(SnProxy *self, gint x_root, gint y_root);
G_GNUC_INTERNAL void sn_proxy_secondary_activate(SnProxy *self, gint x_root, gint y_root);
G_GNUC_INTERNAL void sn_proxy_ayatana_secondary_activate(SnProxy *self, u_int32_t event_time);
G_GNUC_INTERNAL void sn_proxy_scroll(SnProxy *self, gint delta_x, gint delta_y);
G_END_DECLS
#endif /* !__SN_ITEM_H__ */
|
/* WithRequirements, copyright (C) 1991-2017 Gen Kiyooka, is distributed under
the GNU Lesser General Public License (GNU LGPL).
This file is part of WithRequirements.
WithRequirements is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License.
WithRequirements is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with WithRequirements. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __INC_REQUIRED_CFNETWORK_H
#define __INC_REQUIRED_CFNETWORK_H 1
#include "RequiredCPlusPlus.h"
#include "RequiredLogString.h"
#include "RequiredCoreFoundation.h"
GKX_ASSERT_C(void) __CFSocketRequiredBody(CFSocketError in_error, const_log_cstring_t in_function, const_log_cstring_t in_file, int in_line, const_log_cstring_t in_code);
GKX_ASSERT_INL_C(int) __CFSocketRequiredInline(CFSocketError in_error) {
return (in_error==kCFSocketSuccess);
}
GKX_ASSERT_INL_C(int) __CFSocketRequiredInlineVerbose(CFSocketError in_error, const_log_cstring_t in_file, const_log_cstring_t in_function, int in_line, const_log_cstring_t in_code) {
int requiredSuccess = __CFSocketRequiredInline(in_error);
if (!requiredSuccess)
__CFSocketRequiredBody(in_error, in_function, in_file, in_line, in_code);
return (requiredSuccess);
}
#define REQUIRED_CFSOCKET_VERBOSE(__cfsocketerror__) __CFSocketRequiredInlineVerbose((__cfsocketerror__), __CF_FILE__, __CF_FUNCTION__, __LINE__, __CF_PREFIX__ #__cfsocketerror__)
#define REQUIRED_CFSOCKET_QUIET(__cfsocketerror__) __CFSocketRequiredInline((__cfsocketerror__))
#define REQUIRED_CFSOCKET(__cfsocketerror__) REQUIRED_CFSOCKET_VERBOSE(__cfsocketerror__)
#if defined(_DEBUG) && (_DEBUG==1)
#define REQUIRED_CFSOCKET_DEBUG(__cfsocketerror__) REQUIRED_CFSOCKET_VERBOSE(__cfsocketerror__)
#else
#define REQUIRED_CFSOCKET_DEBUG(__cfsocketerror__) REQUIRED_CFSOCKET_QUIET(__cfsocketerror__)
#endif
GKX_ASSERT_C(void) __CFStreamErrorRequiredBody(const CFStreamError* in_error, const_log_cstring_t in_function, const_log_cstring_t in_file, int in_line, const_log_cstring_t in_code);
GKX_EXTERN_C(CFErrorRef) __CFStreamErrorCopyCFErrorRef(const CFStreamError* in_error);
GKX_ASSERT_INL_C(int) __CFStreamErrorRequiredInline(const CFStreamError* in_error) {
return (in_error==NULL) ? 0 :
(in_error->domain == 0) && (in_error->error == 0);
}
GKX_ASSERT_INL_C(int) __CFStreamErrorRequiredInlineVerbose(const CFStreamError* in_error, const_log_cstring_t in_file, const_log_cstring_t in_function, int in_line, const_log_cstring_t in_code) {
int requiredSuccess = __CFStreamErrorRequiredInline(in_error);
if (!requiredSuccess)
__CFStreamErrorRequiredBody(in_error, in_function, in_file, in_line, in_code);
return (requiredSuccess);
}
#define REQUIRED_CFSTREAMERROR_QUIET(__cfstreamerr__) __CFStreamErrorRequiredInline(__cfstreamerr__)
#define REQUIRED_CFSTREAMERROR_VERBOSE(__cfstreamerr__) __CFStreamErrorRequiredInlineVerbose(__cfstreamerr__, __CF_FILE__, __CF_FUNCTION__, __LINE__, __CF_PREFIX__ #__cfstreamerr__)
#define REQUIRED_CFSTREAMERROR(__cfstreamerr__) REQUIRED_CFSTREAMERROR_VERBOSE(__cfstreamerr__)
#if defined(_DEBUG) && (_DEBUG==1)
#define REQUIRED_CFSTREAMERROR_DEBUG(__cfstreamerr__) REQUIRED_CFSTREAMERROR_VERBOSE(__cfstreamerr__)
#else
#define REQUIRED_CFSTREAMERROR_DEBUG(__cfstreamerr__) REQUIRED_CFSTREAMERROR_QUIET(__cfstreamerr__)
#endif
#endif /* __INC_REQUIRED_CFNETWORK_H */
|
#include <xmp.h>
#include <stdio.h>
#include <stdlib.h>
#define N 4
int random_array[N], ans=0, val=0, i, result=0;
#pragma xmp nodes p[4]
#pragma xmp template t[4]
#pragma xmp distribute t[block] onto p
int main(void)
{
srand(0);
for(i=0;i<N;i++){
random_array[i] = rand();
ans = ans | random_array[i];
}
#pragma xmp loop on t[i]
for(i=0;i<N;i++)
val = random_array[i];
#pragma xmp reduction(|:val)
if(val != ans)
result = -1;
#pragma xmp reduction(+:result)
#pragma xmp task on p[0]
{
if(result == 0){
printf("PASS\n");
}
else{
fprintf(stderr, "ERROR\n");
exit(1);
}
}
return 0;
}
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_DESCRIBERESOURCEGROUPSRESPONSE_H
#define QTAWS_DESCRIBERESOURCEGROUPSRESPONSE_H
#include "inspectorresponse.h"
#include "describeresourcegroupsrequest.h"
namespace QtAws {
namespace Inspector {
class DescribeResourceGroupsResponsePrivate;
class QTAWSINSPECTOR_EXPORT DescribeResourceGroupsResponse : public InspectorResponse {
Q_OBJECT
public:
DescribeResourceGroupsResponse(const DescribeResourceGroupsRequest &request, QNetworkReply * const reply, QObject * const parent = 0);
virtual const DescribeResourceGroupsRequest * request() const Q_DECL_OVERRIDE;
protected slots:
virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(DescribeResourceGroupsResponse)
Q_DISABLE_COPY(DescribeResourceGroupsResponse)
};
} // namespace Inspector
} // namespace QtAws
#endif
|
// Created file "Lib\src\ksuser\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(KSMETHODSETID_Wave_Queued, 0x7432c160, 0x8827, 0x11cf, 0xa1, 0x02, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4);
|
#ifndef GENERICS_FIELDITERATOR_H
#define GENERICS_FIELDITERATOR_H
#include <iterator>
namespace generics {
template<typename Element>
class FieldIterator: public std::iterator<std::input_iterator_tag, Element, int> {
public:
FieldIterator() : m_Data(nullptr) {}
FieldIterator(Element * data) : m_Data(data) {}
FieldIterator(const FieldIterator<Element> & other) : m_Data(other.m_Data) {}
inline FieldIterator<Element> & operator=(const FieldIterator<Element> & other) {
m_Data = other.m_Data;
return *this;
}
inline bool operator==(const FieldIterator<Element> & other) { return (m_Data == other.m_Data); }
inline bool operator!=(const FieldIterator<Element> & other) { return (m_Data != other.m_Data); }
inline Element & operator*() { return *m_Data; }
inline FieldIterator<Element> & operator++() { ++m_Data; return *this; }
inline FieldIterator<Element> operator++(int) { return FieldIterator<Element>(m_Data++); }
inline FieldIterator<Element> & operator--() { --m_Data; return *this; }
inline FieldIterator<Element> operator--(int) { return FieldIterator<Element>(m_Data--); }
inline bool isNull() const { return !m_Data; }
protected:
Element * m_Data;
};
template<typename Element>
class FieldConstIterator: public std::iterator<std::input_iterator_tag, Element, int> {
public:
FieldConstIterator() : m_Data(nullptr) {}
FieldConstIterator(const Element * data) : m_Data(data) {}
FieldConstIterator(const FieldConstIterator<Element> & other) : m_Data(other.m_Data) {}
inline FieldConstIterator<Element> & operator=(const FieldConstIterator<Element> & other) {
m_Data = other.m_Data;
return *this;
}
inline bool operator==(const FieldConstIterator<Element> & other) const { return (m_Data == other.m_Data); }
inline bool operator!=(const FieldConstIterator<Element> & other) const { return (m_Data != other.m_Data); }
inline const Element & operator*() const { return *m_Data; }
inline FieldConstIterator<Element> & operator++() { ++m_Data; return *this; }
inline FieldConstIterator<Element> operator++(int) { return FieldConstIterator<Element>(m_Data++); }
inline FieldConstIterator<Element> & operator--() { --m_Data; return *this; }
inline FieldConstIterator<Element> operator--(int) { return FieldConstIterator<Element>(m_Data--); }
inline bool isNull() const { return !m_Data; }
protected:
const Element * m_Data;
};
template<typename Element>
class DeltaFieldConstForwardIterator: public std::iterator<std::input_iterator_tag, Element, int> {
public:
DeltaFieldConstForwardIterator() : m_Data(nullptr), m_PreviousSum(0) {}
DeltaFieldConstForwardIterator(const Element * data) : m_Data(data), m_PreviousSum(0) {}
DeltaFieldConstForwardIterator(const DeltaFieldConstForwardIterator<Element> & other) :
m_Data(other.m_Data), m_PreviousSum(other.m_PreviousSum) {}
inline DeltaFieldConstForwardIterator<Element> & operator=(const DeltaFieldConstForwardIterator<Element> & other) {
m_Data = other.m_Data;
m_PreviousSum = other.m_PreviousSum;
return *this;
}
inline bool operator==(const DeltaFieldConstForwardIterator<Element> & other) const { return (m_Data == other.m_Data); }
inline bool operator!=(const DeltaFieldConstForwardIterator<Element> & other) const { return (m_Data != other.m_Data); }
inline const Element operator*() const { return *m_Data + m_PreviousSum; }
inline DeltaFieldConstForwardIterator<Element> & operator++() {
m_PreviousSum += *m_Data;
m_Data++;
return *this;
}
inline DeltaFieldConstForwardIterator<Element> operator++(int) {
DeltaFieldConstForwardIterator<Element> oldSelf = *this;
this->operator++();
return oldSelf;
}
DeltaFieldConstForwardIterator<Element> & operator+=(unsigned int off) const {
for(; off >= 1; --off) {
operator++();
}
return *this;
}
DeltaFieldConstForwardIterator<Element> operator+(unsigned int off) const {
DeltaFieldConstForwardIterator<Element> oldSelf = *this;
for(; off >= 1; --off) {
++oldSelf;
}
return oldSelf;
}
inline bool isNull() const { return !m_Data; }
protected:
const Element * m_Data;
Element m_PreviousSum;
};
}
#endif // GENERICS_FIELDITERATOR_H
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_DESCRIBEVPCENDPOINTSERVICESREQUEST_H
#define QTAWS_DESCRIBEVPCENDPOINTSERVICESREQUEST_H
#include "ec2request.h"
namespace QtAws {
namespace EC2 {
class DescribeVpcEndpointServicesRequestPrivate;
class QTAWSEC2_EXPORT DescribeVpcEndpointServicesRequest : public Ec2Request {
public:
DescribeVpcEndpointServicesRequest(const DescribeVpcEndpointServicesRequest &other);
DescribeVpcEndpointServicesRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(DescribeVpcEndpointServicesRequest)
};
} // namespace EC2
} // namespace QtAws
#endif
|
// Created file "Lib\src\Uuid\X64\cguid_i"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(GUID_DEVCLASS_MEDIA, 0x4d36e96c, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18);
|
/*
Copyright (C) 2007 <SWGEmu>
This File is part of Core3.
This program is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General
Public License along with this program; if not, write to
the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linking Engine3 statically or dynamically with other modules
is making a combined work based on Engine3.
Thus, the terms and conditions of the GNU Lesser General Public License
cover the whole combination.
In addition, as a special exception, the copyright holders of Engine3
give you permission to combine Engine3 program with free software
programs or libraries that are released under the GNU LGPL and with
code included in the standard release of Core3 under the GNU LGPL
license (or modified versions of such code, with unchanged license).
You may copy and distribute such a system following the terms of the
GNU LGPL for Engine3 and the licenses of the other code concerned,
provided that you include the source code of that other code when
and as the GNU LGPL requires distribution of source code.
Note that people who make modified versions of Engine3 are not obligated
to grant this special exception for their modified versions;
it is their choice whether to do so. The GNU Lesser General Public License
gives permission to release a modified version without this exception;
this exception also makes it possible to release a modified version
which carries forward this exception.
*/
#ifndef PAWITHDRAWCOMMAND_H_
#define PAWITHDRAWCOMMAND_H_
#include "server/zone/objects/scene/SceneObject.h"
class PaWithdrawCommand : public QueueCommand {
public:
PaWithdrawCommand(const String& name, ZoneProcessServer* server)
: QueueCommand(name, server) {
}
int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) {
if (!checkStateMask(creature))
return INVALIDSTATE;
if (!checkInvalidLocomotions(creature))
return INVALIDLOCOMOTION;
return SUCCESS;
}
};
#endif //PAWITHDRAWCOMMAND_H_
|
/*
* Library restart_data type test program
*
* Copyright (C) 2006-2021, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <common.h>
#include <file_stream.h>
#include <types.h>
#if defined( HAVE_STDLIB_H ) || defined( WINAPI )
#include <stdlib.h>
#endif
#include "ewf_test_libcerror.h"
#include "ewf_test_libewf.h"
#include "ewf_test_macros.h"
#include "ewf_test_memory.h"
#include "ewf_test_unused.h"
#include "../libewf/libewf_restart_data.h"
#if defined( __GNUC__ ) && !defined( LIBEWF_DLL_IMPORT )
/* Tests the libewf_restart_data_parse function
* Returns 1 if successful or 0 if not
*/
int ewf_test_restart_data_parse(
void )
{
uint8_t restart_data[ 32 ] = {
0xff, 0xfe, 0x00, 0x00 };
libcerror_error_t *error = NULL;
int result = 0;
/* Test regular cases
*/
result = libewf_restart_data_parse(
restart_data,
32,
&error );
EWF_TEST_ASSERT_EQUAL_INT(
"result",
result,
1 );
EWF_TEST_ASSERT_IS_NULL(
"error",
error );
/* Test error cases
*/
result = libewf_restart_data_parse(
NULL,
32,
&error );
EWF_TEST_ASSERT_EQUAL_INT(
"result",
result,
-1 );
EWF_TEST_ASSERT_IS_NOT_NULL(
"error",
error );
libcerror_error_free(
&error );
result = libewf_restart_data_parse(
restart_data,
(size_t) SSIZE_MAX + 1,
&error );
EWF_TEST_ASSERT_EQUAL_INT(
"result",
result,
-1 );
EWF_TEST_ASSERT_IS_NOT_NULL(
"error",
error );
libcerror_error_free(
&error );
#if defined( HAVE_EWF_TEST_MEMORY )
/* Test libewf_restart_data_parse with malloc failing
*/
ewf_test_malloc_attempts_before_fail = 0;
result = libewf_restart_data_parse(
restart_data,
32,
&error );
if( ewf_test_malloc_attempts_before_fail != -1 )
{
ewf_test_malloc_attempts_before_fail = -1;
}
else
{
EWF_TEST_ASSERT_EQUAL_INT(
"result",
result,
-1 );
EWF_TEST_ASSERT_IS_NOT_NULL(
"error",
error );
libcerror_error_free(
&error );
}
#endif /* defined( HAVE_EWF_TEST_MEMORY ) */
return( 1 );
on_error:
if( error != NULL )
{
libcerror_error_free(
&error );
}
return( 0 );
}
#endif /* defined( __GNUC__ ) && !defined( LIBEWF_DLL_IMPORT ) */
/* The main program
*/
#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
int wmain(
int argc EWF_TEST_ATTRIBUTE_UNUSED,
wchar_t * const argv[] EWF_TEST_ATTRIBUTE_UNUSED )
#else
int main(
int argc EWF_TEST_ATTRIBUTE_UNUSED,
char * const argv[] EWF_TEST_ATTRIBUTE_UNUSED )
#endif
{
EWF_TEST_UNREFERENCED_PARAMETER( argc )
EWF_TEST_UNREFERENCED_PARAMETER( argv )
#if defined( __GNUC__ ) && !defined( LIBEWF_DLL_IMPORT )
EWF_TEST_RUN(
"libewf_restart_data_parse",
ewf_test_restart_data_parse );
#endif /* defined( __GNUC__ ) && !defined( LIBEWF_DLL_IMPORT ) */
return( EXIT_SUCCESS );
on_error:
return( EXIT_FAILURE );
}
|
/*
* Copyright (C) 2014 The AppCan Open Source Project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define F_PAGEINFO_DICT_SIZE 1
#define F_EBRW_VIEW_FLAG_LOAD_FINISHED 0x1
#define F_EBRW_VIEW_FLAG_USE_CONTENT_SIZE 0x2
#define F_EBRW_VIEW_FLAG_SHOW_KEYBOARD 0x4
#define F_EBRW_VIEW_FLAG_FORBID_ROTATE 0x8
#define F_EBRW_VIEW_FLAG_BOUNCE_VIEW_TOP_LOADING 0x10
#define F_EBRW_VIEW_FLAG_BOUNCE_VIEW_BOTTOM_LOADING 0x20
#define F_EBRW_VIEW_FLAG_BOUNCE_VIEW_TOP_REFRESH 0x40
#define F_EBRW_VIEW_FLAG_BOUNCE_VIEW_BOTTOM_REFRESH 0x80
#define F_EBRW_VIEW_FLAG_FORBID_CROSSDOMAIN 0x100
#define F_EBRW_VIEW_FLAG_HAS_AD 0x200
#define F_EBRW_VIEW_FLAG_OAUTH 0x400
#define F_EBRW_VIEW_FLAG_FIRST_LOAD_FINISHED 0x800
#define F_EBRW_VIEW_FLAG_CUSTOM_PROCESS_DATA 0x1000
#define WIDGETREPORT_WIDGETSTATUS_OPEN @"001"
#define WIDGETREPORT_WIDGETSTATUS_CLOSE @"000"
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import <AppCanKit/AppCanWindowObject.h>
@class EBrowserController;
@class CBrowserMainFrame;
@class EBrowserWindow;
@class WWidget;
@class EBrowserViewBounceView;
@class EBrowserWidgetContainer;
@class EBrowserHistory;
@class EBrowserHistoryEntry;
@class ACEBrowserView;
@class JSValue;
typedef NS_ENUM(NSInteger,ACEEBrowserViewType){
ACEEBrowserViewTypeMain = 0,
ACEEBrowserViewTypeSlibingTop,
ACEEBrowserViewTypeSlibingBottom,
ACEEBrowserViewTypePopover,
};
@interface EBrowserView : UIImageView<UIGestureRecognizerDelegate, WKNavigationDelegate,AppCanWebViewEngineObject,AppCanWindowObject>
@property (nonatomic,assign) NSString *muexObjName;
@property (nonatomic,readonly) EBrowserController *meBrwCtrler;
@property (nonatomic,weak) EBrowserWindow *meBrwWnd;
@property (nonatomic,readonly) WWidget *mwWgt;
@property (nonatomic,weak) NSMutableDictionary *mPageInfoDict;
@property (nonatomic,strong) EBrowserViewBounceView *mTopBounceView;
@property (nonatomic,strong) EBrowserViewBounceView *mBottomBounceView;
@property (nonatomic,weak) UIScrollView *mScrollView;
@property (nonatomic,assign) float lastScrollPointY;
@property (nonatomic,assign) float nowScrollPointY;
@property (nonatomic,assign) float bottom;
@property (nonatomic,assign)ACEEBrowserViewType mType;
@property (nonatomic,assign)int mFlag;
@property (nonatomic,assign)int mTopBounceState;
@property (nonatomic,assign)int mBottomBounceState;
@property (nonatomic,assign)int mAdType;
@property (nonatomic,assign)int mAdDisplayTime;
@property (nonatomic,assign)int mAdIntervalTime;
@property (nonatomic,assign)int mAdFlag;
@property (nonatomic,strong)NSURL *currentUrl;
@property (nonatomic,assign)BOOL isMuiltPopover;
@property (nonatomic,assign)BOOL isSwiped;
@property (nonatomic,strong) ACEBrowserView * meBrowserView;
/**
**UIWebView的方法和属性**************************************
**/
@property (nonatomic, readonly, assign) UIScrollView *scrollView;
- (void)loadRequest:(NSURLRequest *)request;
- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL;
- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName baseURL:(NSURL *)baseURL;
@property (nonatomic, readonly, assign) NSURLRequest *request;
- (void)reload;
- (void)stopLoading;
- (void)goBack;
- (void)goForward;
@property (nonatomic, readonly, getter=canGoBack) BOOL canGoBack;
@property (nonatomic, readonly, getter=canGoForward) BOOL canGoForward;
@property (nonatomic, readonly, getter=isLoading) BOOL loading;
/// 新的注入JS的方法封装,无返回值
- (void)ac_evaluateJavaScript:(NSString *)script;
- (void)ac_evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^ _Nullable)(_Nullable id, NSError * _Nullable error))completionHandler;
/// 旧的注入JS方法封装,返回值始终是nil
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
@property (nonatomic) BOOL scalesPageToFit;
@property (nonatomic) UIDataDetectorTypes dataDetectorTypes;
@property (nonatomic) BOOL allowsInlineMediaPlayback;
@property (nonatomic) BOOL mediaPlaybackRequiresUserAction;
@property (nonatomic) BOOL mediaPlaybackAllowsAirPlay;
//********************************************************
- (void)reuseWithFrame:(CGRect)frame BrwCtrler:(EBrowserController*)eInBrwCtrler Wgt:(WWidget*)inWgt BrwWnd:(EBrowserWindow*)eInBrwWnd UExObjName:(NSString*)inUExObjName Type:(ACEEBrowserViewType)inWndType;
- (id)initWithFrame:(CGRect)frame BrwCtrler:(EBrowserController*)eInBrwCtrler Wgt:(WWidget*)inWgt BrwWnd:(EBrowserWindow*)eInBrwWnd UExObjName:(NSString*)inUExObjName Type:(ACEEBrowserViewType)inWndType;
- (void)reset;
- (void)notifyPageStart;
- (void)notifyPageFinish;
- (void)notifyPageError;
- (void)loadUEXScript;
- (void)loadWidgetWithQuery:(NSString*)inQuery;
- (void)loadWithData:(NSString *)inData baseUrl:(NSURL *)inBaseUrl;
- (void)loadWithUrl: (NSURL*)inUrl;
- (void)setView;
- (NSURL*)curUrl;
- (void)clean;
- (void)cleanAllEexObjs;
- (EBrowserWidgetContainer*)brwWidgetContainer;
- (void)bounceViewStartLoadWithType:(int)inType;
- (void)bounceViewFinishLoadWithType:(int)inType;
- (void)topBounceViewRefresh;
- (void)stopAllNetService;
- (void)keyboardWillChangeFrame:(NSNotification *)notification;
- (void)registerKeyboardChangeEvent;
- (void)setExeJS:(NSString *)exeJS;
@end
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_LISTPHONENUMBERSOPTEDOUTREQUEST_P_H
#define QTAWS_LISTPHONENUMBERSOPTEDOUTREQUEST_P_H
#include "snsrequest_p.h"
#include "listphonenumbersoptedoutrequest.h"
namespace QtAws {
namespace SNS {
class ListPhoneNumbersOptedOutRequest;
class ListPhoneNumbersOptedOutRequestPrivate : public SnsRequestPrivate {
public:
ListPhoneNumbersOptedOutRequestPrivate(const SnsRequest::Action action,
ListPhoneNumbersOptedOutRequest * const q);
ListPhoneNumbersOptedOutRequestPrivate(const ListPhoneNumbersOptedOutRequestPrivate &other,
ListPhoneNumbersOptedOutRequest * const q);
private:
Q_DECLARE_PUBLIC(ListPhoneNumbersOptedOutRequest)
};
} // namespace SNS
} // namespace QtAws
#endif
|
// Created file "Lib\src\mfuuid\X64\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR, 0x1299023c, 0xbc28, 0x4f0a, 0x81, 0xec, 0xd3, 0x29, 0x5a, 0x8d, 0x81, 0x5d);
|
// Created file "Lib\src\Uuid\napcommon_i"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(IID_INapComponentInfo, 0xb475f925, 0xe3f7, 0x414c, 0x8c, 0x72, 0x1c, 0xee, 0x64, 0xb9, 0xd8, 0xf6);
|
#ifndef EVENTMANAGER_H
#define EVENTMANAGER_H
#include <SFML/Graphics.hpp>
class EventManager
{
public:
EventManager();
virtual ~EventManager();
void eventLoop(sf::RenderWindow &window);
protected:
sf::Event m_e;
private:
};
#endif // EVENTMANAGER_H
|
/* ****************************************************************************
* libcasio/format/mcs/cells.h -- description of the MCS cells format.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libcasio.
* libcasio is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libcasio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
#ifndef LIBCASIO_FORMAT_MCS_CELLS_H
# define LIBCASIO_FORMAT_MCS_CELLS_H
# include "../../cdefs.h"
# include "../../number.h"
# pragma pack(1)
CASIO_BEGIN_NAMESPACE
/* Lists, matrixes and vectors have exactly the same format.
* Lists only use the `height` (width is zero).
* Vectors are normal matrixes (the OS just won't use other rows).
*
* They have this header: */
typedef struct casio_mcs_cellsheader_s {
/* undocumented: probably the title? */
casio_uint8_t casio_mcs_cellsheader_title[8];
/* height */
casio_uint16_t casio_mcs_cellsheader_height;
/* width */
casio_uint16_t casio_mcs_cellsheader_width;
/* re-undocumented */
casio_uint8_t casio_mcs_cellsheader__undocumented[3];
/* undocumented byte (either 0x00 or 0x4F) */
casio_uint8_t casio_mcs_cellsheader__unknown;
} casio_mcs_cellsheader_t;
/* Then we have width*height BCD cells, which corresponds to the real parts,
* grouped by height.
*
* If at least one of the cells has an imaginary part (highest bit of the
* first nibble set), it is followed by a list of the imaginary parts, that
* has the same size that the real parts list, that is grouped the same way
* and that contains actual things (and not crap) only if the complex bit
* is set on the real part.
*
* Notice that imaginary parts in cells files require at least
* CASIOWIN 2.00. */
CASIO_END_NAMESPACE
# pragma pack()
#endif /* LIBCASIO_FORMAT_MCS_CELLS_H */
|
/*
******************************************************************************
* Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
******************************************************************************
*/
#pragma once
#include <string.h>
#include <stdint.h>
// ----------------------------------------------------------------
// Types
// ----------------------------------------------------------------
//! MT Device Types
typedef enum { DEV_UNKNOWN, DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200,
DEV_SARA_U260, DEV_SARA_U270, DEV_LEON_G200 } Dev;
//! SIM Status
typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim;
//! SIM Status
typedef enum { LPM_DISABLED, LPM_ENABLED, LPM_ACTIVE } Lpm;
//! Device status
typedef struct {
Dev dev; //!< Device Type
Lpm lpm; //!< Power Saving
Sim sim; //!< SIM Card Status
char ccid[20+1]; //!< Integrated Circuit Card ID
char imsi[15+1]; //!< International Mobile Station Identity
char imei[15+1]; //!< International Mobile Equipment Identity
char meid[18+1]; //!< Mobile Equipment IDentifier
char manu[16]; //!< Manufacturer (u-blox)
char model[16]; //!< Model Name (LISA-U200, LISA-C200 or SARA-G350)
char ver[16]; //!< Software Version
} DevStatus;
//! Registration Status
typedef enum { REG_UNKNOWN, REG_DENIED, REG_NONE, REG_HOME, REG_ROAMING } Reg;
//! Access Technology
typedef enum { ACT_UNKNOWN, ACT_GSM, ACT_EDGE, ACT_UTRAN, ACT_CDMA } AcT;
//! Network Status
typedef struct {
Reg csd; //!< CSD Registration Status (Circuit Switched Data)
Reg psd; //!< PSD Registration status (Packet Switched Data)
AcT act; //!< Access Technology
int rssi; //!< Received Signal Strength Indication (in dBm, range -113..-53)
int qual; //!< In UMTS RAT indicates the Energy per Chip/Noise ratio in dB levels
//!< of the current cell (see <ecn0_ lev> in +CGED command description),
//!< see 3GPP TS 45.008 [20] subclause 8.2.4
char opr[16+1]; //!< Operator Name
char num[32]; //!< Mobile Directory Number
unsigned short lac; //!< location area code in hexadecimal format (2 bytes in hex)
unsigned int ci; //!< Cell ID in hexadecimal format (2 to 4 bytes in hex)
} NetStatus;
#ifdef __cplusplus
//! Data Usage struct
struct MDM_DataUsage {
uint16_t size;
int cid;
int tx_session;
int rx_session;
int tx_total;
int rx_total;
MDM_DataUsage()
{
memset(this, 0, sizeof(*this));
size = sizeof(*this);
}
};
#else
typedef struct MDM_DataUsage MDM_DataUsage;
#endif
//! Bands
// NOTE: KEEP IN SYNC with band_enums[] array in spark_wiring_cellular_printable.h
typedef enum { BAND_DEFAULT=0, BAND_0=0, BAND_700=700, BAND_800=800, BAND_850=850,
BAND_900=900, BAND_1500=1500, BAND_1700=1700, BAND_1800=1800,
BAND_1900=1900, BAND_2100=2100, BAND_2600=2600 } MDM_Band;
#ifdef __cplusplus
//! Band Select struct
struct MDM_BandSelect {
uint16_t size;
int count;
MDM_Band band[5];
MDM_BandSelect()
{
memset(this, 0, sizeof(*this));
size = sizeof(*this);
}
};
#else
typedef struct MDM_BandSelect MDM_BandSelect;
#endif
//! An IP v4 address
typedef uint32_t MDM_IP;
#define NOIP ((MDM_IP)0) //!< No IP address
// IP number formating and conversion
#define IPSTR "%d.%d.%d.%d"
#define IPNUM(ip) ((ip)>>24)&0xff, \
((ip)>>16)&0xff, \
((ip)>> 8)&0xff, \
((ip)>> 0)&0xff
#define IPADR(a,b,c,d) ((((uint32_t)(a))<<24) | \
(((uint32_t)(b))<<16) | \
(((uint32_t)(c))<< 8) | \
(((uint32_t)(d))<< 0))
// ----------------------------------------------------------------
// Device
// ----------------------------------------------------------------
typedef enum { AUTH_NONE, AUTH_PAP, AUTH_CHAP, AUTH_DETECT } Auth;
// ----------------------------------------------------------------
// Sockets
// ----------------------------------------------------------------
//! Type of IP protocol
typedef enum { MDM_IPPROTO_TCP = 0, MDM_IPPROTO_UDP = 1 } IpProtocol;
//! Socket error return codes
#define MDM_SOCKET_ERROR (-1)
// ----------------------------------------------------------------
// Parsing
// ----------------------------------------------------------------
enum {
// waitFinalResp Responses
NOT_FOUND = 0,
WAIT = -1, // TIMEOUT
RESP_OK = -2,
RESP_ERROR = -3,
RESP_PROMPT = -4,
RESP_ABORTED = -5,
// getLine Responses
#define LENGTH(x) (x & 0x00FFFF) //!< extract/mask the length
#define TYPE(x) (x & 0xFF0000) //!< extract/mask the type
TYPE_UNKNOWN = 0x000000,
TYPE_OK = 0x110000,
TYPE_ERROR = 0x120000,
TYPE_RING = 0x210000,
TYPE_CONNECT = 0x220000,
TYPE_NOCARRIER = 0x230000,
TYPE_NODIALTONE = 0x240000,
TYPE_BUSY = 0x250000,
TYPE_NOANSWER = 0x260000,
TYPE_PROMPT = 0x300000,
TYPE_PLUS = 0x400000,
TYPE_TEXT = 0x500000,
TYPE_ABORTED = 0x600000,
TYPE_DBLNEWLINE = 0x700000,
// special timout constant
TIMEOUT_BLOCKING = 0xffffffff
};
|
// Created file "Lib\src\Uuid\X64\uiribbon_uuid"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(GUID_POWERBUTTON_ACTION_FLAGS, 0x857e7fac, 0x034b, 0x4704, 0xab, 0xb1, 0xbc, 0xa5, 0x4a, 0xa3, 0x14, 0x78);
|
// ============================================================================
//
// = LIBRARY
// ULib - c++ library
//
// = FILENAME
// client_rdb.h
//
// = AUTHOR
// Stefano Casazza
//
// ============================================================================
#ifndef U_RDB_CLIENT_H
#define U_RDB_CLIENT_H 1
#include <ulib/db/rdb.h>
#include <ulib/net/rpc/rpc.h>
#include <ulib/net/client/client.h>
/**
* @class URDBClient_Base
*
* @brief Creates and manages a client connection with a RDB server
*/
typedef void (*vPFprpr)(UStringRep*, UStringRep*);
class U_EXPORT URDBClient_Base : public UClient_Base {
public:
// SERVICES
void reset()
{
U_TRACE(0, "URDBClient_Base::reset()")
URPC::resetInfo();
}
bool isOK()
{
U_TRACE(0, "URDBClient_Base::isOK()")
U_RETURN(nResponseCode == 200);
}
bool readResponse();
bool processRequest(const char* token);
// Combines the old cdb file and the diffs in a new cdb file
bool closeReorganize();
// ------------------------------------------------------
// Write a key/value pair to a reliable database.
// ------------------------------------------------------
// RETURN VALUE
// ------------------------------------------------------
// 0: Everything was OK.
// -1: flags was RDB_INSERT and this key already existed.
// -3: disk full writing to the journal file
// ------------------------------------------------------
int store(const UString& key, const UString& data, int flag = RDB_INSERT);
// ---------------------------------------------------------
// Mark a key/value as deleted.
// ---------------------------------------------------------
// RETURN VALUE
// ---------------------------------------------------------
// 0: Everything was OK.
// -1: The entry was not in the database
// -2: The entry was already marked deleted in the hash-tree
// -3: disk full writing to the journal file
// ---------------------------------------------------------
int remove(const UString& key);
// ----------------------------------------------------------
// Substitute a key/value with a new key/value (remove+store)
// ----------------------------------------------------------
// RETURN VALUE
// ----------------------------------------------------------
// 0: Everything was OK
// -1: The entry was not in the database
// -2: The entry was marked deleted in the hash-tree
// -3: disk full writing to the journal file
// -4: flag was RDB_INSERT and the new key already existed
// ----------------------------------------------------------
int substitute(const UString& key, const UString& new_key, const UString& data, int flag = RDB_INSERT);
// operator []
UString operator[](const UString& key);
// TRANSACTION
bool beginTransaction();
bool abortTransaction();
bool commitTransaction();
// Call function for all entry
void callForAllEntry( vPFprpr function) { _callForAllEntry(function, false); }
void callForAllEntrySorted(vPFprpr function) { _callForAllEntry(function, true); }
// DEBUG
#if defined(U_STDCPP_ENABLE) && defined(DEBUG)
const char* dump(bool reset) const;
#endif
protected:
int nResponseCode;
// Costruttori
URDBClient_Base(UFileConfig* _cfg) : UClient_Base(_cfg)
{
U_TRACE_REGISTER_OBJECT(0, URDBClient_Base, "%p", _cfg)
URPC::allocate();
nResponseCode = 0;
}
~URDBClient_Base()
{
U_TRACE_UNREGISTER_OBJECT(0, URDBClient_Base)
delete URPC::rpc_info;
}
// Call function for all entry
void _callForAllEntry(vPFprpr function, bool sorted);
private:
void setStatus() U_NO_EXPORT;
#ifdef U_COMPILER_DELETE_MEMBERS
URDBClient_Base(const URDBClient_Base&) = delete;
URDBClient_Base& operator=(const URDBClient_Base&) = delete;
#else
URDBClient_Base(const URDBClient_Base&) : UClient_Base(0) {}
URDBClient_Base& operator=(const URDBClient_Base&) { return *this; }
#endif
};
template <class Socket> class U_EXPORT URDBClient : public URDBClient_Base {
public:
// COSTRUTTORI
URDBClient(UFileConfig* _cfg) : URDBClient_Base(_cfg)
{
U_TRACE_REGISTER_OBJECT(0, URDBClient, "%p", _cfg)
UClient_Base::socket = U_NEW(Socket(UClient_Base::bIPv6));
}
~URDBClient()
{
U_TRACE_UNREGISTER_OBJECT(0, URDBClient)
}
// DEBUG
#if defined(U_STDCPP_ENABLE) && defined(DEBUG)
const char* dump(bool _reset) const { return URDBClient_Base::dump(_reset); }
#endif
private:
#ifdef U_COMPILER_DELETE_MEMBERS
URDBClient(const URDBClient&) = delete;
URDBClient& operator=(const URDBClient&) = delete;
#else
URDBClient(const URDBClient&) : URDBClient_Base(0) {}
URDBClient& operator=(const URDBClient&) { return *this; }
#endif
};
#endif
|
/****************************************************************************************************************/
/* */
/* OpenNN: Open Neural Networks Library */
/* www.opennn.net */
/* */
/* N O R M A L I Z E D S Q U A R E D E R R O R C L A S S H E A D E R */
/* */
/* Roberto Lopez */
/* Artelnics - Making intelligent use of data */
/* robertolopez@artelnics.com */
/* */
/****************************************************************************************************************/
#ifndef __NORMALIZEDSQUAREDERROR_H__
#define __NORMALIZEDSQUAREDERROR_H__
// System includes
#include <string>
#include <sstream>
#include <iostream>
#include <fstream>
#include <limits>
#include <cmath>
// OpenNN includes
#include "error_term.h"
#include "data_set.h"
// TinyXml includes
#include "../tinyxml2/tinyxml2.h"
namespace OpenNN
{
/// This class represents the normalized squared error term.
/// This error term is used in data modeling problems.
/// If it has a value of unity then the neural network is predicting the data "in the mean",
/// A value of zero means perfect prediction of data.
class NormalizedSquaredError : public ErrorTerm
{
public:
// GENERAL CONSTRUCTOR
explicit NormalizedSquaredError(NeuralNetwork*, DataSet*);
// NEURAL NETWORK CONSTRUCTOR
explicit NormalizedSquaredError(NeuralNetwork*);
// DATA SET CONSTRUCTOR
explicit NormalizedSquaredError(DataSet*);
// DEFAULT CONSTRUCTOR
explicit NormalizedSquaredError(void);
// XML CONSTRUCTOR
explicit NormalizedSquaredError(const tinyxml2::XMLDocument&);
// DESTRUCTOR
virtual ~NormalizedSquaredError(void);
// METHODS
// Get methods
// Set methods
// Normalization coefficients
double calculate_normalization_coefficient(const Matrix<double>&, const Vector<double>&) const;
// Checking methods
void check(void) const;
// loss methods
double calculate_error(void) const;
double calculate_error(const Vector<double>&) const;
double calculate_selection_error(void) const;
Vector<double> calculate_error_normalization(const Vector<double>&) const;
Vector<double> calculate_error_normalization(const Vector<double>&, const Vector<double>&) const;
Vector<double> calculate_selection_error_normalization(const Vector<double>&) const;
Vector<double> calculate_output_gradient(const Vector<double>&, const Vector<double>&) const;
Matrix<double> calculate_output_Hessian(const Vector<double>&, const Vector<double>&) const;
Vector<double> calculate_gradient(void) const;
// Matrix<double> calculate_Hessian(void) const;
Vector<double> calculate_gradient_normalization(const Vector<double>&) const;
// Objective terms methods
Vector<double> calculate_terms(void) const;
Vector<double> calculate_terms(const Vector<double>&) const;
Matrix<double> calculate_terms_Jacobian(void) const;
ErrorTerm::FirstOrderTerms calculate_first_order_terms(void) const;
// Squared errors methods
Vector<double> calculate_squared_errors(void) const;
Vector<size_t> calculate_maximal_errors(const size_t& = 10) const;
std::string write_error_term_type(void) const;
// Serialization methods
tinyxml2::XMLDocument* to_XML(void) const;
void from_XML(const tinyxml2::XMLDocument&);
void write_XML(tinyxml2::XMLPrinter&) const;
// void read_XML( );
// std::string write_information(void) const;
private:
// MEMBERS
/// Mean values of all the target variables.
// Vector<double> training_target_mean;
};
}
#endif
// OpenNN: Open Neural Networks Library.
// Copyright (c) 2005-2016 Roberto Lopez.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <graphx.h>
/* Use some random color as the transparent one */
#define TRANSPARENT_COLOR 10
#define FONT_WIDTH 8
#define FONT_HEIGHT 8
/* Function prototypes */
void printu(char *str, int x, int y);
const char *my_str = "!!DEPPILF si txet sihT";
void main(void) {
/* Initialize the 8bpp graphics */
gfx_Begin();
gfx_FillScreen(gfx_black);
/* Setup the colors */
gfx_SetTextFGColor(gfx_white);
/* Set the transparent text background color */
gfx_SetTextBGColor(TRANSPARENT_COLOR);
gfx_SetTextTransparentColor(TRANSPARENT_COLOR);
gfx_SetMonospaceFont(FONT_WIDTH);
/* Print some upside down text */
printu(my_str, (LCD_WIDTH - gfx_GetStringWidth(my_str)) / 2, (LCD_HEIGHT - FONT_HEIGHT) / 2);
/* Wait for key */
while (!os_GetCSC());
/* Finish the graphics */
gfx_End();
}
void printu(char *str, int x, int y) {
gfx_TempSprite(my_char, 8, 8);
while (*str) {
gfx_TransparentSprite(gfx_RotateSpriteHalf(gfx_GetSpriteChar(*str), my_char), x, y);
x += gfx_GetCharWidth(*str++);
}
}
|
#pragma once
#include "Opcode.h"
namespace AISCRIPT
{
class Build_Bunkers : public Opcode
{
public:
// Ctor
Build_Bunkers(AISCRIPT::Enum::Enum n) : Opcode(n) {};
// Execute
virtual bool execute(aithread &thread) const;
};
}
|
/*This file is generated by luagen.*/
#include "lua_ftk_text_view.h"
#include "lua_ftk_callbacks.h"
static void tolua_reg_types (lua_State* L)
{
tolua_usertype(L, "FtkTextView");
}
static int lua_ftk_text_view_create(lua_State* L)
{
tolua_Error err = {0};
FtkTextView* retv;
FtkWidget* parent;
int x;
int y;
int width;
int height;
int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err) && tolua_isnumber(L, 5, 0, &err);
return_val_if_fail(param_ok, 0);
parent = tolua_tousertype(L, 1, 0);
x = tolua_tonumber(L, 2, 0);
y = tolua_tonumber(L, 3, 0);
width = tolua_tonumber(L, 4, 0);
height = tolua_tonumber(L, 5, 0);
retv = ftk_text_view_create(parent, x, y, width, height);
tolua_pushusertype(L, (FtkTextView*)retv, "FtkTextView");
return 1;
}
static int lua_ftk_text_view_get_text(lua_State* L)
{
tolua_Error err = {0};
char* retv;
FtkWidget* thiz;
int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
return_val_if_fail(param_ok, 0);
thiz = tolua_tousertype(L, 1, 0);
retv = ftk_text_view_get_text(thiz);
tolua_pushstring(L, (char*)retv);
return 1;
}
static int lua_ftk_text_view_set_text(lua_State* L)
{
tolua_Error err = {0};
Ret retv;
FtkWidget* thiz;
char* text;
int len;
int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);
return_val_if_fail(param_ok, 0);
thiz = tolua_tousertype(L, 1, 0);
text = (char*)tolua_tostring(L, 2, 0);
len = tolua_tonumber(L, 3, 0);
retv = ftk_text_view_set_text(thiz, text, len);
tolua_pushnumber(L, (lua_Number)retv);
return 1;
}
static int lua_ftk_text_view_insert_text(lua_State* L)
{
tolua_Error err = {0};
Ret retv;
FtkWidget* thiz;
int pos;
char* text;
int len;
int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isstring(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err);
return_val_if_fail(param_ok, 0);
thiz = tolua_tousertype(L, 1, 0);
pos = tolua_tonumber(L, 2, 0);
text = (char*)tolua_tostring(L, 3, 0);
len = tolua_tonumber(L, 4, 0);
retv = ftk_text_view_insert_text(thiz, pos, text, len);
tolua_pushnumber(L, (lua_Number)retv);
return 1;
}
static int lua_ftk_text_view_set_readonly(lua_State* L)
{
tolua_Error err = {0};
Ret retv;
FtkWidget* thiz;
int ro;
int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
return_val_if_fail(param_ok, 0);
thiz = tolua_tousertype(L, 1, 0);
ro = tolua_tonumber(L, 2, 0);
retv = ftk_text_view_set_readonly(thiz, ro);
tolua_pushnumber(L, (lua_Number)retv);
return 1;
}
int tolua_ftk_text_view_init(lua_State* L)
{
tolua_open(L);
tolua_reg_types(L);
tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL);
tolua_cclass(L,"FtkTextView", "FtkTextView", "FtkWidget", NULL);
tolua_beginmodule(L, "FtkTextView");
tolua_function(L, "Create", lua_ftk_text_view_create);
tolua_function(L, "GetText", lua_ftk_text_view_get_text);
tolua_function(L, "SetText", lua_ftk_text_view_set_text);
tolua_function(L, "InsertText", lua_ftk_text_view_insert_text);
tolua_function(L, "SetReadonly", lua_ftk_text_view_set_readonly);
tolua_endmodule(L);
tolua_endmodule(L);
return 1;
}
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_LISTEXPERIMENTSREQUEST_P_H
#define QTAWS_LISTEXPERIMENTSREQUEST_P_H
#include "fisrequest_p.h"
#include "listexperimentsrequest.h"
namespace QtAws {
namespace FIS {
class ListExperimentsRequest;
class ListExperimentsRequestPrivate : public FisRequestPrivate {
public:
ListExperimentsRequestPrivate(const FisRequest::Action action,
ListExperimentsRequest * const q);
ListExperimentsRequestPrivate(const ListExperimentsRequestPrivate &other,
ListExperimentsRequest * const q);
private:
Q_DECLARE_PUBLIC(ListExperimentsRequest)
};
} // namespace FIS
} // namespace QtAws
#endif
|
/*!
\file RecipeModel.h
\author Dane Gardner <dane.gardner@gmail.com>
\version
\section LICENSE
This file is part of the ThreeBrooks homebrew recipe application
Copyright (C) 2011-2013 Dane Gardner
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
\section DESCRIPTION
*/
#ifndef RECIPEMODEL_H
#define RECIPEMODEL_H
#include <QAbstractItemModel>
#include <QColor>
#include "Recipe.h"
class RecipeModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit RecipeModel(QObject *parent = 0);
Recipe *recipe() const { return _recipe; }
void setRecipe(Recipe *recipe) { _recipe = recipe; connect(_recipe, SIGNAL(dataChanged()), this, SLOT(recipeChanged())); }
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
protected:
Recipe *_recipe;
protected slots:
void recipeChanged();
};
#endif // RECIPEMODEL_H
|
#pragma once
namespace render
{
namespace scene
{
template<typename T>
struct Dimension2
{
T width = 0;
T height = 0;
};
} // namespace scene
} // namespace render
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
//*************************************************************************
// DESCRIPTION: Verilator: Node attributes/ expression widths
//
// Code available from: https://verilator.org
//
//*************************************************************************
//
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you
// can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
//
//*************************************************************************
#ifndef VERILATOR_V3RANDOMIZE_METHOD_H_
#define VERILATOR_V3RANDOMIZE_METHOD_H_
#include "config_build.h"
#include "verilatedos.h"
class AstClass;
class AstFunc;
class AstNetlist;
class V3Randomize final {
public:
static void randomizeNetlist(AstNetlist* nodep);
static AstFunc* newRandomizeFunc(AstClass* nodep);
};
#endif // Guard
|
/* mpfr_set_si_2exp -- set a MPFR number from a machine signed integer with
a shift
Copyright 2004, 2006-2021 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
The GNU MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MPFR Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
int
mpfr_set_si_2exp (mpfr_ptr x, long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode)
{
if (i == 0)
{
MPFR_SET_ZERO (x);
MPFR_SET_POS (x);
MPFR_RET (0);
}
#ifdef MPFR_LONG_WITHIN_LIMB
else
{
mp_size_t xn;
int cnt, nbits;
mp_limb_t ai, *xp;
int inex = 0;
/* Early underflow/overflow checking is necessary to avoid
integer overflow or errors due to special exponent values. */
if (MPFR_UNLIKELY (e < __gmpfr_emin - (mpfr_exp_t)
(sizeof (unsigned long) * CHAR_BIT + 1)))
return mpfr_underflow (x, rnd_mode == MPFR_RNDN ?
MPFR_RNDZ : rnd_mode, i < 0 ? -1 : 1);
if (MPFR_UNLIKELY (e >= __gmpfr_emax))
return mpfr_overflow (x, rnd_mode, i < 0 ? -1 : 1);
ai = SAFE_ABS (unsigned long, i);
MPFR_ASSERTN (SAFE_ABS (unsigned long, i) == ai);
/* Position of the highest limb */
xn = (MPFR_PREC (x) - 1) / GMP_NUMB_BITS;
count_leading_zeros (cnt, ai);
MPFR_ASSERTD (cnt < GMP_NUMB_BITS); /* OK since i != 0 */
xp = MPFR_MANT(x);
xp[xn] = ai << cnt;
/* Zero the xn lower limbs. */
MPN_ZERO(xp, xn);
MPFR_SET_SIGN (x, i < 0 ? MPFR_SIGN_NEG : MPFR_SIGN_POS);
nbits = GMP_NUMB_BITS - cnt;
e += nbits; /* exponent _before_ the rounding */
/* round if MPFR_PREC(x) smaller than length of i */
if (MPFR_UNLIKELY (MPFR_PREC (x) < nbits) &&
MPFR_UNLIKELY (mpfr_round_raw (xp + xn, xp + xn, nbits, i < 0,
MPFR_PREC (x), rnd_mode, &inex)))
{
e++;
xp[xn] = MPFR_LIMB_HIGHBIT;
}
MPFR_EXP (x) = e;
return mpfr_check_range (x, inex, rnd_mode);
}
#else
/* if a long does not fit into a limb, we use mpfr_set_z_2exp */
{
mpz_t z;
int inex;
mpz_init_set_si (z, i);
inex = mpfr_set_z_2exp (x, z, e, rnd_mode);
mpz_clear (z);
return inex;
}
#endif
}
|
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "IsoHeapImpl.h"
#include "StaticPerProcess.h"
#include "Vector.h"
namespace bmalloc {
class AllIsoHeaps : public StaticPerProcess<AllIsoHeaps> {
public:
AllIsoHeaps(const std::lock_guard<Mutex>&);
void add(IsoHeapImplBase*);
IsoHeapImplBase* head();
template<typename Func>
void forEach(const Func&);
private:
IsoHeapImplBase* m_head { nullptr };
};
DECLARE_STATIC_PER_PROCESS_STORAGE(AllIsoHeaps);
} // namespace bmalloc
|
#include <stdio.h>
int main() {
int number;
int first = 0;
int second = 1;
int fibonacci = 0;
int key = 1;
scanf("%d", &number);
if ( number < 0 ) {
key = 0;
number *= -1;
}
if ( number == 1 || number == 2 ) {
fibonacci = 1;
} else {
for ( int i = 1; i < number; i++ ) {
fibonacci = first + second;
first = second;
second = fibonacci;
}
}
if ( key == 0 && number % 2 == 0 ) {
fibonacci *= -1;
}
printf("%d\n", fibonacci);
return 0;
}
|
// UIImage+RoundedCorner.h
//
// Created by 余洪江 on 16/03/01.
// Copyright © MRJ. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (RoundedCorner)
- (UIImage *)roundedCornerImage:(NSInteger)cornerSize borderSize:(NSInteger)borderSize;
@end
|
//
// YHPTwoViewController.h
// 03-控制器View的生命周期
//
// Created by yhp on 16/4/10.
// Copyright © 2016年 YouHuaPei. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface YHPTwoViewController : UIViewController
@end
|
int main() {
int x = 1;
int y = x * 10;
return 0;
}
|
#include <defs.h>
#include <assert.h>
#include <thumips.h>
#include <picirq.h>
#include <asm/mipsregs.h>
static bool did_init = 0;
void
pic_enable(unsigned int irq) {
assert(irq < 8);
uint32_t sr = read_c0_status();
sr |= 1<<(irq + STATUSB_IP0);
write_c0_status(sr);
}
void pic_disable(unsigned int irq){
assert(irq < 8);
uint32_t sr = read_c0_status();
sr &= ~(1<<(irq + STATUSB_IP0));
write_c0_status(sr);
}
void
pic_init(void) {
uint32_t sr = read_c0_status();
/* disable all */
sr &= ~ST0_IM;
write_c0_status(sr);
did_init = 1;
}
|
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdlib.h>
#include "global.h"
#include "driver/encoder/encoder.h"
#include "driver/motor_ctrl/motor_ctrl.h"
#include "driver/l298/l298.h"
#include "driver/distance_sense/distance_sense.h"
#include "driver/line_sense/line_sense.h"
#include "driver/line_follower/line_follower.h"
#include "scheduler/scheduler.h"
#include "scheduler/led_task/led_task.h"
#include "scheduler/error_handler_task/error_handler_task.h"
#include "scheduler/uart_data_task/uart_data_task.h"
int main(void)
{
// Send message
printf("Hello World!!!\n");
// Initialization of distance sensor module
// distanceSenseInit();
// Initialization of line sensor module
// lineSenseInit();
// Initialization of l298 driver and stop motors
// encoderInit();
// l298Init();
// l298Stop(RIGHT);
// l298Stop(LEFT);
// l298SetPWMDuty(RIGHT, 0);
// l298SetPWMDuty(LEFT, 0);
// Initialization of motor control module
// motorInit();
// Initialization of lineFollower module
// lineFollowerInit();
// lineFollowerStart();
// Initialization of scheduler module and adding task for execution
// schedulerInit();
// Tasks using for lineFollower application
// schedulerAddTask(&encoderProcesingData, CYCLIC_TIMEx8);
// schedulerAddTask(&motorProcesingSpeed, CYCLIC_TIMEx8);
// schedulerAddTask(&lineFollowerUpdatePID, CYCLIC_TIMEx2);
// Tasks for system using (for info see tasks in /scheduler/tasks)
// schedulerAddTask(&uartDataTask, CYCLIC_TIMEx8);
// schedulerAddTask(&errorHandlerTask, CYCLIC_TIMEx8);
// schedulerAddTask(&ledTask, CYCLIC_TIMEx128);
// schedulerStart();
while(1)
{
// schedulerUpdate();
}
}
|
//
// TIHAppDelegate.h
// TodayInHistory
//
// Created by Serg Bayda on 10/29/09.
// Copyright __MyCompanyName__ 2009. All rights reserved.
//
@interface TIHAppDelegate : NSObject <UIApplicationDelegate>
{
UIWindow *window;
UINavigationController *navigationController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@end
|
/*
ToDo: http://man7.org/linux/man-pages/man2/readahead.2.html
*/
#include "mmbuf.h"
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
/*---
DATA
---*/
/*---
FUNCTIONS
---*/
static void handle_mmap_fail(struct mmbuf_obj *m);
void handle_mmap_fail(struct mmbuf_obj *m)
{
close(m->fd);
perror("Error mmapping the file");
exit(EXIT_FAILURE);
}
static void handle_madvise_error(struct mmbuf_obj *m);
void handle_madvise_error(struct mmbuf_obj *m)
{
//printf("I am he22re\n");
close(m->fd);
//printf("I am her2e\n");
perror("Error madvise the file");
//printf("I am her3e\n");
exit(EXIT_FAILURE);
//printf("I am he4re\n");
}
static int grow_file(struct mmbuf_obj *m, unsigned long amount);
static int grow_file(struct mmbuf_obj *m, unsigned long amount)
{
int result = lseek(m->fd, amount-1, SEEK_CUR);
if (result == -1)
{
close(m->fd);
perror("Error calling lseek() to 'stretch' the file");
exit(EXIT_FAILURE);
}
unsigned long old_file_size = m->filesize;
m->filesize = amount-1;
// Write to end of file to make it take on the size.
result = write(m->fd, "", 1);
if (m->map!=0)
{
printf("Warning remapping the file");
void *new_mapping = mremap(m->map, old_file_size, m->filesize, MREMAP_MAYMOVE);
if (new_mapping == MAP_FAILED)
{
close(m->fd);
perror("Error remapping the file\n");
exit(EXIT_FAILURE);
}
m->map = new_mapping;
}
return 0;
}
int mmbuf__setup(struct mmbuf_obj *m, char *file_path, char mode)
{
m->mode = mode;
// OPEN THE FILE
if (mode=='r')
m->fd = open(file_path, O_RDONLY, 0754);
else if (mode=='w')
{
m->fd = open(file_path, O_RDWR|O_TRUNC|O_CREAT, 0600);
}
if (m->fd == -1)
{
perror("Error opening file for reading");
exit(EXIT_FAILURE);
}
// GET THE FILE SIZE CREATE THE MAP
m->map = 0;
if (mode=='r')
{
m->filesize = lseek(m->fd, 0L, SEEK_END);
off_t curpos = lseek(m->fd, 0L, SEEK_SET);
if (curpos!=0)
{
fprintf(stderr, "Seek failed %ld\n", curpos);
perror("Error");
return -1;
}
m->map = mmap(0, m->filesize, PROT_READ, MAP_SHARED, m->fd, 0);
}
else if (mode=='w')
{
grow_file(m, BLOCKSIZE*BLOCKSIZE);
m->map = mmap(0, m->filesize, PROT_WRITE, MAP_SHARED, m->fd, 0);
m->write_offset = 0;
}
if (m->map == MAP_FAILED)
{
handle_mmap_fail(m);
}
unsigned char madvise_ret = madvise(m->map, m->filesize, MADV_SEQUENTIAL);
if (madvise_ret != 0)
{
handle_madvise_error(m);
}
m->dealocated_block_hi = 0;
return 0;
}
int mmbuf__close(struct mmbuf_obj *m)
{
if (m->mode=='w')
{
ftruncate(m->fd, m->write_offset-1);
}
if (munmap(m->map, m->filesize) == -1)
{
perror("Error un-mmapping the file");
}
close(m->fd);
return 0;
}
int mmbuf__get_data(struct mmbuf_obj *m, unsigned char **result_p, const unsigned long offset, const int length)
{
int available_data;
if (offset>(m->filesize))
{
available_data = 0;
}
if (offset+length>(m->filesize))
{
available_data = (m->filesize) - offset;
}
else
{
available_data = length;
}
//printf("hello %c %p\n", m->map[offset], m->map+offset);
*result_p = m->map+offset;
//printf("gets data got request for data %ld: %c\n", offset, m->map[offset]);
return available_data;
}
int mmbuf__free_data(struct mmbuf_obj *m, const unsigned long low, const unsigned long high)
{
if (low==0)
{
return 0;
}
unsigned long length;
unsigned long data_not_in_use_limit = low - 1;
unsigned long lnearest_block_boundary = data_not_in_use_limit &~(BLOCKSIZE-1);
if (lnearest_block_boundary > (m->dealocated_block_hi))
{
//printf("data_in_use low='%d' lnearest='%d', block_hi='%d'\n", low, lnearest_block_boundary, m->dealocated_block_hi);
length = lnearest_block_boundary - m->dealocated_block_hi;
int madvise_ret = madvise(m->map+m->dealocated_block_hi, length, MADV_DONTNEED);
if (madvise_ret != 0)
{
printf("Error number %d\n", errno);
handle_madvise_error(m);
}
else
{
m->dealocated_block_hi = lnearest_block_boundary;
}
}
return 0;
}
int mmbuf__write_data(struct mmbuf_obj *m, const unsigned char *source, const unsigned int length)
{
//Writing data may change the mapping if max size is hit
//printf("%p %p %d %d %ld\n", m->map, source, length, m->filesize, m->write_offset);
if ((m->write_offset + length) > (m->filesize))
{
printf("coring here \n");
printf("old_size='%ld' old_map_pt='%p'\n", m->filesize, m->map);
grow_file(m, m->filesize*1.5);
printf("new_size='%ld' new_map_pt='%p'\n", m->filesize, m->map);
}
memcpy((m->map)+(m->write_offset), source, length);
m->write_offset += length;
return 0;
}
|
#include "file_input.h"
int main(int argc, char **argv)
{
initCanInterface();
if(argc < 2)
{
fprintf(stderr, "got no arg\n");
// print help
fprintf(stderr, "Please use the help\n");
}
else if(argc == 2)
{
fprintf(stderr, "Got one args\n");
char* fileArray;
long len = readFile(argv[1], fileArray);
int i;
for(i = 0; i < len; ++i)
{
printf(fileArray[i]);
}
}
}
long readFile(char* filename, char* buffer)
{
FILE *fileptr;
long filelen;
fileptr = fopen(filename, "rb"); // Open the file in binary mode
fseek(fileptr, 0, SEEK_END); // Jump to the end of the file
filelen = ftell(fileptr); // Get the current byte offset in the file
rewind(fileptr); // Jump back to the beginning of the file
buffer = (char *)malloc((filelen+1)*sizeof(char)); // Enough memory for file + \0
fread(buffer, filelen, 1, fileptr); // Read in the entire file
fclose(fileptr); // Close the file
return filelen;
}
|
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <functional>
#include <memory>
#include <string>
#include <vector>
namespace infrt {
namespace host_context {
class KernelFrame;
using KernelImplementation = std::function<void(KernelFrame *frame)>;
/**
* Hold the kernels registered in the system.
*/
class KernelRegistry {
public:
KernelRegistry();
void AddKernel(const std::string &key, KernelImplementation fn);
void AddKernelAttrNameList(const std::string &key,
const std::vector<std::string> &names);
KernelImplementation GetKernel(const std::string &key) const;
std::vector<std::string> GetKernelList() const;
size_t size() const;
~KernelRegistry();
private:
class Impl;
std::unique_ptr<Impl> impl_;
};
//! The global CPU kernel registry.
KernelRegistry *GetCpuKernelRegistry();
} // namespace host_context
} // namespace infrt
/**
* compile function RegisterKernels in C way to avoid C++ name mangling.
*/
#ifdef __cplusplus
extern "C" {
#endif
void RegisterKernels(infrt::host_context::KernelRegistry *registry);
#ifdef __cplusplus
}
#endif
|
/*
* Copyright © 2014 Jason Ekstrand
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#define LOG_TAG "wayland.Pointer"
#include "wheatley.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
JNIEXPORT jlong JNICALL
Java_net_jlekstrand_wheatley_wayland_Pointer_createNative(JNIEnv *env,
jclass cls, jlong seatHandle)
{
struct wlb_seat *seat = (struct wlb_seat *)(intptr_t)seatHandle;
struct wlb_pointer *pointer;
pointer = wlb_pointer_create(seat);
if (pointer == NULL) {
ALOGD("wlb_pointer_create failed: %s\n", strerror(errno));
jni_util_throw_by_name(env, "java/lang/RuntimeException",
"Failed to create Pointer");
}
return (jlong)(intptr_t)pointer;
}
JNIEXPORT void JNICALL
Java_net_jlekstrand_wheatley_wayland_Pointer_destroyNative(JNIEnv *env,
jclass cls, jlong nativeHandle)
{
struct wlb_pointer *pointer = (struct wlb_pointer *)(intptr_t)nativeHandle;
wlb_pointer_destroy(pointer);
}
JNIEXPORT void JNICALL
Java_net_jlekstrand_wheatley_wayland_Pointer_enterOutputNative(JNIEnv *env,
jclass cls, jlong nativeHandle, jlong outputHandle, jfloat x, jfloat y)
{
struct wlb_pointer *pointer = (struct wlb_pointer *)(intptr_t)nativeHandle;
struct wlb_output *output = (struct wlb_output *)(intptr_t)outputHandle;
wlb_pointer_enter_output(pointer, output,
wl_fixed_from_double(x), wl_fixed_from_double(y));
}
JNIEXPORT void JNICALL
Java_net_jlekstrand_wheatley_wayland_Pointer_moveOnOutputNative(JNIEnv *env,
jclass cls, jlong nativeHandle, jint time, jlong outputHandle,
jfloat x, jfloat y)
{
struct wlb_pointer *pointer = (struct wlb_pointer *)(intptr_t)nativeHandle;
struct wlb_output *output = (struct wlb_output *)(intptr_t)outputHandle;
wlb_pointer_move_on_output(pointer, time, output,
wl_fixed_from_double(x), wl_fixed_from_double(y));
}
JNIEXPORT void JNICALL
Java_net_jlekstrand_wheatley_wayland_Pointer_buttonNative(JNIEnv *env,
jclass cls, jlong nativeHandle, jint time, jint button,
jboolean pressed)
{
struct wlb_pointer *pointer = (struct wlb_pointer *)(intptr_t)nativeHandle;
wlb_pointer_button(pointer, time, button,
pressed ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED);
}
JNIEXPORT void JNICALL
Java_net_jlekstrand_wheatley_wayland_Pointer_axisNative(JNIEnv *env,
jclass cls, jlong nativeHandle, jint time, jfloat xval, jfloat yval)
{
struct wlb_pointer *pointer = (struct wlb_pointer *)(intptr_t)nativeHandle;
wl_fixed_t fx, fy;
fx = wl_fixed_from_double(xval);
fy = wl_fixed_from_double(yval);
if (fx != 0)
wlb_pointer_axis(pointer, time, WL_POINTER_AXIS_HORIZONTAL_SCROLL, fx);
if (fy != 0)
wlb_pointer_axis(pointer, time, WL_POINTER_AXIS_VERTICAL_SCROLL, fy);
}
/* vim: set ts=4 sw=4 sts=4 expandtab: */
|
#ifndef CONSTDEF_H
#define CONSTDEF_H
#define MAX (30) /*ͼ×î´ó¶¥µãÊý*/
#define BUFFER_SIZE (256) /*ÎļþÃû³¤¶È*/
#define MAX_E_NUM (200) /*ͼ×î´ó±ßÊý*/
#define MB (1048576) /*1024*1024*/
#define WORK_SPACE ("E:\\myFlow_ICA_new\\") /*µ±Ç°ÏîÄ¿Ö÷¹¤×÷Ŀ¼*/
#define NUM_OF_SUB_GRAPH (20000) /*×î´óµÄϽç×ÓͼµÄ¸öÊý*/
#endif
|
//
// PICircularProgressView.h
// BMGestureScoring
//
// Created by BM on 15/11/4.
// Copyright © 2015年 BM. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PICircularProgressView : UIView
@property (nonatomic) double progress;
@property (nonatomic) NSInteger roundedHead UI_APPEARANCE_SELECTOR;
@property (nonatomic) NSInteger showShadow UI_APPEARANCE_SELECTOR;
//厚度
@property (nonatomic) CGFloat thicknessRatio UI_APPEARANCE_SELECTOR;
//环内颜色
@property (nonatomic, strong) UIColor *outerBackgroundColor UI_APPEARANCE_SELECTOR;
//环颜色
@property (nonatomic, strong) UIColor *progressFillColor UI_APPEARANCE_SELECTOR;
//上部颜色
@property (nonatomic, strong) UIColor *progressTopGradientColor UI_APPEARANCE_SELECTOR;
//下部颜色
@property (nonatomic, strong) UIColor *progressBottomGradientColor UI_APPEARANCE_SELECTOR;
@end
|
//
// Copyright (C) 2016 OpenSim Ltd.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//
#ifndef __INET_PHYSICALENVIRONMENTCANVASVISUALIZER_H
#define __INET_PHYSICALENVIRONMENTCANVASVISUALIZER_H
#include "inet/common/geometry/common/CanvasProjection.h"
#include "inet/visualizer/base/PhysicalEnvironmentVisualizerBase.h"
namespace inet {
namespace visualizer {
using namespace inet::physicalenvironment;
class INET_API PhysicalEnvironmentCanvasVisualizer : public PhysicalEnvironmentVisualizerBase
{
protected:
class ObjectPositionComparator
{
protected:
const Rotation &viewRotation;
public:
ObjectPositionComparator(const Rotation &viewRotation) : viewRotation(viewRotation) {}
bool operator() (const IPhysicalObject *left, const IPhysicalObject *right) const
{
return viewRotation.rotateVectorClockwise(left->getPosition()).z < viewRotation.rotateVectorClockwise(right->getPosition()).z;
}
};
protected:
/** @name Internal state */
//@{
const CanvasProjection *canvasProjection;
//@}
/** @name Graphics */
//@{
cGroupFigure *objectsLayer = nullptr;
//@}
protected:
virtual void initialize(int stage) override;
virtual void refreshDisplay() const override;
virtual void computeFacePoints(const IPhysicalObject *object, std::vector<std::vector<Coord> >& faces, const Rotation& rotation) const;
};
} // namespace visualizer
} // namespace inet
#endif // ifndef __INET_PHYSICALENVIRONMENTCANVASVISUALIZER_H
|
/* Copyright 2019 Kristofer Björnson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// @cond TBTK_FULL_DOCUMENTATION
/** @package TBTKcalc
* @file GaussianBasisGenerator.h
* @brief Generates a basis of @link GaussianState GaussianStates @endlink.
*
* @author Kristofer Björnson
*/
#ifndef COM_DAFER45_TBTK_GAUSSIAN_BASIS_GENERATOR
#define COM_DAFER45_TBTK_GAUSSIAN_BASIS_GENERATOR
#include "TBTK/GaussianState.h"
#include <unordered_map>
#include <vector>
#include <libint2.hpp>
namespace TBTK{
class GaussianBasisGenerator{
public:
/** Constructor. */
GaussianBasisGenerator();
/** Deleted copy constructor. */
GaussianBasisGenerator(
const GaussianBasisGenerator &gaussianBasisGenerator
) = delete;
/** Destructor. */
~GaussianBasisGenerator();
/** Deleted assignment operator. */
GaussianBasisGenerator& operator=(
const GaussianBasisGenerator &rhs
) = delete;
/** Generate a basis of @link GaussianState GaussianStates@endling. */
std::vector<GaussianState> generateBasis();
private:
std::vector<GaussianState> basisSet;
libint2::BasisSet libintBasisSet;
std::unordered_map<size_t, std::vector<size_t>> libintShellPairList;
std::vector<
std::vector<std::shared_ptr<libint2::ShellPair>>
> libintShellPairData;
std::vector<libint2::Atom> atoms;
static unsigned int instanceCounter;
/** Initialize the basis state generation algorithm. */
void initialize();
/** Initialize the basis set. */
void initializeBasisSet();
/** Calculate shell pairs. */
void computeShellPairs(double threshold = 1e-12);
/** Calculate single particle integral. */
void calculateSingleParticleTerms(
libint2::Operator o,
std::function<
void(
std::complex<double> value,
unsigned int linearBraIndex,
unsigned int linearKetIndex
)
> &&lambdaStoreResult
);
/** Calculate the two-body Fock integrals. */
void calculateTwoBodyFockTerms();
};
}; //End of namespace TBTK
#endif
/// @endcond
|
//
// MKAnnotationView+WebCache.h
// SDWebImage
//
// Created by Olivier Poitrey on 14/03/12.
// Copyright (c) 2012 Dailymotion. All rights reserved.
//
#import "MapKit/MapKit.h"
#import "SDWebImageManager.h"
/**
* Integrates SDWebImage async downloading and caching of remote images with MKAnnotationView.
*/
@interface MKAnnotationView (WebCache)
-(void)setImageWithString:(NSString*) url;
/**
* Set the imageView `image` with an `url`.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
*/
- (void)setImageWithURL:(NSURL *)url;
/**
* Set the imageView `image` with an `url` and a placeholder.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @see setImageWithURL:placeholderImage:options:
*/
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder;
/**
* Set the imageView `image` with an `url`, placeholder and custom options.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
*/
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options;
/**
* Set the imageView `image` with an `url`.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
* @param completedBlock A block called when operation has been completed. This block as no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache of from the network.
*/
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock;
/**
* Set the imageView `image` with an `url`, placeholder.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param completedBlock A block called when operation has been completed. This block as no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache of from the network.
*/
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock;
/**
* Set the imageView `image` with an `url`, placeholder and custom options.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
* @param completedBlock A block called when operation has been completed. This block as no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache of from the network.
*/
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock;
/**
* Cancel the current download
*/
- (void)cancelCurrentImageLoad;
@end
|
/*
* Copyright [1999-2017] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __FEATURESET_H__
#define __FEATURESET_H__
#include "DataModelTypes.h"
#include "EnsC.h"
struct FeatureSetStruct {
void **features;
int nFeature;
};
void *FeatureSet_addFeature(FeatureSet *fset, void *sf);
#define FeatureSet_getNumFeature(fs) (fs)->nFeature
#define FeatureSet_getFeatures(fs) (fs)->features
void *FeatureSet_getFeatureAt(FeatureSet *fset,int ind);
void FeatureSet_removeAll(FeatureSet *fs);
#endif
|
//
// SFCollapsableLabel.h
// SFiOSKit
//
// Created by yangzexin on 2/27/14.
// Copyright (c) 2014 yangzexin. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SFIBCompatibleView.h"
@interface SFCollapsableLabel : SFIBCompatibleView
@property (nonatomic, readonly) UILabel *label;
@property (nonatomic, assign) NSInteger numberOfVisibleLines;
@property (nonatomic, assign) BOOL collapsed;
@property (nonatomic, copy) NSString *text;
@property (nonatomic, strong) UIView *expandIndicatorView;
@property (nonatomic, copy) void(^collapseStateDidChange)(void);
- (void)fitToSuitableHeight;
@end
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2010 by iTestApp, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#if defined(USE_TI_FILESYSTEM) || defined(USE_TI_DATABASE)
#import "TiStreamProxy.h"
@interface TiFilesystemFileStreamProxy : TiStreamProxy<TiStreamInternal> {
@private
NSFileHandle *fileHandle;
TiStreamMode mode;
}
@end
#endif
|
/* Siconos is a program dedicated to modeling, simulation and control
* of non smooth dynamical systems.
*
* Copyright 2020 INRIA.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*!\file ConvexQP.h
\brief Definition of a structure to handle Convex Quadratic Problem.
*/
#ifndef CONVEXQP_H
#define CONVEXQP_H
#include <stdio.h> // for FILE
#include "NumericsFwd.h" // for ConvexQP, NumericsMatrix
#include "SiconosConfig.h" // for BUILD_AS_CPP // IWYU pragma: keep
/** \struct ConvexQP ConvexQP.h
*
*/
struct ConvexQP
{
int size; /**< size \f$ n \f$ */
int m; /**< m \f$ m \f$ */
void *env; /**< pointer onto env object (which is self is the simplest case)*/
NumericsMatrix *M; /**< Matrix M that defines the quadratic term in the cost function. **/
double *q; /**< vector q that defines the linear term in the cost function. **/
NumericsMatrix *A; /**< Matrix A that defines the constraints. If it is NULL, we assume that A is the identity matrix **/
double *b; /**< vector b that defines the constant term in the constraints. **/
void (*ProjectionOnC)(void *self, double *x, double * PX); /**< Projection on C */
double normConvexQP; /**< Norm of the problem to compute relative solution */
int istheNormConvexQPset; /**< Boolean to know if the norm is set
* If not (istheNormConvexQPset=0) it will be computed in the first call of convexQP_compute_error
* By default, set istheNormConvexQPset =0 */
void* set; /**< opaque struct that represent the set C (possibly empty) */
};
#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
extern "C"
{
#endif
/** display a ConvexQPProblem
* \param cqp the problem to display
*/
void convexQP_display(ConvexQP* cqp);
/** print a ConvexQPProblem in a file (numerics .dat format)
* \param cqp the problem to print out
* \param file the dest file
* \return ok if successfull
*/
int convexQP_printInFile(ConvexQP* cqp, FILE* file);
/** read a ConvexQPProblem in a file (numerics .dat format)
* \param cqp the problem to read
* \param file the target file
* \return ok if successfull
*/
int convexQP_newFromFile(ConvexQP* cqp, FILE* file);
/** free a ConvexQPProblem
* \param cqp the problem to free
*/
void convexQP_free(ConvexQP* cqp);
/** Clear ConvexQP structure: set all pointeurs to NULL, double and int to 0.
* \param cqp the problem to clear
*/
void convexQP_clear(ConvexQP* cqp);
/** new ConvexQP problem
* \param size size of the ambient space for the CQP
* \return a initialized ConvexQP struct
*/
ConvexQP* convexQP_new(int size);
/** get the environment from the struct
* \param cqp a ConvexQP problem
* \return the environment from the struct
*/
static inline void* convexQP_get_env(void* cqp)
{
return ((ConvexQP*) cqp)->env;
}
#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
}
#endif
#endif
|
/*
Copyright 2017-2019 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef LULLABY_CONTRIB_PLANAR_GRAB_PLANAR_GRAB_SYSTEM_H_
#define LULLABY_CONTRIB_PLANAR_GRAB_PLANAR_GRAB_SYSTEM_H_
#include <unordered_map>
#include "lullaby/events/input_events.h"
#include "lullaby/modules/ecs/component.h"
#include "lullaby/modules/ecs/system.h"
#include "lullaby/util/clock.h"
#include "lullaby/util/math.h"
#include "lullaby/util/optional.h"
namespace lull {
/// The PlanarGrabSystem allows the controller to manipulate entities' position
/// inside a plane constraint.
/// Grabbable entities must have a PlanarGrabbableDef, a TransformDef, and a
/// CollisionDef.
class PlanarGrabSystem : public System {
public:
explicit PlanarGrabSystem(Registry* registry);
~PlanarGrabSystem() override = default;
void Create(Entity entity, HashValue type, const Def* def) override;
void Destroy(Entity entity) override;
void AdvanceFrame(const Clock::duration& delta_time);
/// Get the world-space position of the point at which the |entity| was
/// grabbed. Optional will be unset if the entity is not grabbable.
Optional<mathfu::vec3> GetGrabOrigin(Entity entity);
/// Get the plane in which the given |entity| is being constrained.
/// Optional will be unset if the entity is not grabbable.
Optional<Plane> GetGrabPlane(Entity entity);
private:
struct Grabbable : Component {
explicit Grabbable(Entity entity) : Component(entity) {}
/// Normal which will define the orientation of the plane used to constrain
/// the objects movement. The origin of the plane is defined dynamically as
/// the location where the object is grabbed.
mathfu::vec3 plane_normal;
/// Whether the plane normal is defined in object-local or world space.
bool local_orientation;
};
struct GrabData {
explicit GrabData(Entity e, const mathfu::vec3& offset,
const mathfu::vec3& origin, const Plane& plane)
: entity(e),
grab_local_offset(offset),
grab_origin(origin),
plane(plane) {}
/// Entity being grabbed.
Entity entity;
/// Offset in local coordinates where the grab took place on the entity.
mathfu::vec3 grab_local_offset;
/// World-space position of the initial grab point.
mathfu::vec3 grab_origin;
/// Plane in which the entity's movement is constrained. This is defined in
/// world-space. If the entity's plane constraint is relative to its local
/// space, the conversion will happen when the entity is grabbed. This value
/// will be updated each frame to account for any movement of the entity
/// due to other systems.
Plane plane;
};
void OnGrab(const ClickEvent& event);
void OnGrabReleased(const ClickReleasedEvent& event);
std::unordered_map<Entity, Grabbable> grabbables_;
std::unordered_map<Entity, GrabData> grabbed_;
};
} // namespace lull
LULLABY_SETUP_TYPEID(lull::PlanarGrabSystem);
#endif // LULLABY_CONTRIB_PLANAR_GRAB_PLANAR_GRAB_SYSTEM_H_
|
//
// QUICKSTARTGetPasswordByPhoneResponse.h
// 手机找回密码.响应报文
//
// Created by 代码生成器1.0.
//
#import "MessageResponse.h"
@interface QUICKSTARTGetPasswordByPhoneResponse : MessageResponse
@end
|
/*-------------------------------------------------------------------------
flash.c - Program memory flashing process
Copyright 2006-2010 Pierre Gaufillet <pierre.gaufillet@magic.fr>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------*/
/* $Id$ */
/* Disable debug information by default as it breaks flash access */
#undef _DEBUG
#include "config.h"
#include "common_types.h"
#include <pic18fregs.h>
#include "debug.h"
#include "flash.h"
uint ep2_num_bytes_to_send;
const uchar *ep2_source_data;
void write_block(__data uchar *src)
{
static uchar i;
debug("write_block\n");
__asm
tblrd*-
__endasm;
for(i = 0; i < 32; i++)
{
TABLAT = *src;
debug("%uhx ", TABLAT);
src++;
__asm
tblwt+*
__endasm;
}
debug("\n");
// Beware : when WR is set, TBLPTR have to be inside the 32 byte range to be written
// so it should be decremented...
__asm
bsf _EECON1, 7 // EEPGD
bcf _EECON1, 6 // CFGS
bsf _EECON1, 2 // WREN
bcf _INTCON, 7 // GIE
// required erase sequence
movlw 0x55
movwf _EECON2
movlw 0xaa
movwf _EECON2
bsf _EECON1, 1 // WR
// stall here for 2ms
__endasm;
debug("write finished\n");
}
void erase_block()
{
// Erase a 64 bytes block
__asm
// address set by the caller
// Point to flash program memory
bsf _EECON1, 7 // EEPGD
bcf _EECON1, 6 // CFGS
bsf _EECON1, 2 // WREN
bsf _EECON1, 4 // FREE
bcf _INTCON, 7 // GIE
// required erase sequence
movlw 0x55
movwf _EECON2
movlw 0xaa
movwf _EECON2
bsf _EECON1, 1 // WR
// stall here for 2ms
__endasm;
}
|
#include "sqlite.h"
void Java_com_jmv_frre_moduloestudiante_SQLite_SQLiteDatabase_closedb(JNIEnv *env, jobject object, int sqliteHandle) {
sqlite3 *handle = (sqlite3 *)sqliteHandle;
int err = sqlite3_close(handle);
if (SQLITE_OK != err) {
throw_sqlite3_exception(env, handle, err);
}
}
void Java_com_jmv_frre_moduloestudiante_SQLite_SQLiteDatabase_beginTransaction(JNIEnv *env, jobject object, int sqliteHandle) {
sqlite3 *handle = (sqlite3 *)sqliteHandle;
sqlite3_exec(handle, "BEGIN", 0, 0, 0);
}
void Java_com_jmv_frre_moduloestudiante_SQLite_SQLiteDatabase_commitTransaction(JNIEnv *env, jobject object, int sqliteHandle) {
sqlite3 *handle = (sqlite3 *)sqliteHandle;
sqlite3_exec(handle, "COMMIT", 0, 0, 0);
}
int Java_com_jmv_frre_moduloestudiante_SQLite_SQLiteDatabase_opendb(JNIEnv *env, jobject object, jstring fileName, jstring tempDir) {
char const *fileNameStr = (*env)->GetStringUTFChars(env, fileName, 0);
char const *tempDirStr = (*env)->GetStringUTFChars(env, tempDir, 0);
if (sqlite3_temp_directory != 0) {
sqlite3_free(sqlite3_temp_directory);
}
sqlite3_temp_directory = sqlite3_mprintf("%s", tempDirStr);
sqlite3 *handle = 0;
int err = sqlite3_open(fileNameStr, &handle);
if (SQLITE_OK != err) {
throw_sqlite3_exception(env, handle, err);
}
if (fileNameStr != 0) {
(*env)->ReleaseStringUTFChars(env, fileName, fileNameStr);
}
if (tempDirStr != 0) {
(*env)->ReleaseStringUTFChars(env, tempDir, tempDirStr);
}
return (int)handle;
}
|
#include <cmath>
#define PI 3.14159265359
class Vector2d
{
public:
float x;
float y;
Vector2d(float=0, float=0);
static float radiansToDegrees(float radians); //Convert Radians into Degrees
static float degreesToRadians(float degrees); //Convert Degrees into Radians
static float rotationInRadiansFromVector(float vectorX, float vectorY); //Compute rotation from computed vector, returns rotation in radians
static float rotationInRadiansFromVector(float fromX, float fromY, float toX, float toY); //Compute vector and rotation from vector, returns rotation in radians
static float rotationInDegreesFromVector(float vectorX, float vectorY); //Compute rotation from computed vector, returns rotation in degrees
static float rotationInDegreesFromVector(float fromX, float fromY, float toX, float toY); //Compute vector and rotation from vector, returns rotation in degrees
static Vector2d pointToPointVector(float toX, float toY, float fromX, float fromY, float deltaTime = 1, float velocity = 1); //Compute vector, optional arguments, deltaTime, object velocity
static Vector2d vectorFromRotationInRadians(float rotationInRadians, float deltaTime = 1, float velocity = 1); //Compute vector from rotation in radians, optional arguments, deltaTime, object velocity
static Vector2d vectorFromRotationInDegrees(float rotationInDegrees, float deltaTime = 1, float velocity = 1); //Compute vector from rotation in degrees, optional arguments, deltaTime, object velocity
};
|
//
// KeyboardInputView.h
// Codea
//
// Created by Simeon Nasilowski on 14/01/12.
//
// Copyright 2012 Two Lives Left Pty. Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <UIKit/UIKit.h>
@class KeyboardInputView;
@protocol KeyboardInputViewDelegate <NSObject>
- (void) keyboardInputView:(KeyboardInputView*)view WillInsertText:(NSString*)text;
@end
@interface KeyboardInputView : UIView<UITextViewDelegate>
{
UITextView *hiddenTextView;
}
@property (assign, nonatomic) BOOL active;
@property (assign, nonatomic) id<KeyboardInputViewDelegate> delegate;
@property (readonly, nonatomic) NSString *currentText;
@end
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2018-2019 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
CFLAGS="-I$(realpath ../../include) -I$(realpath ../../build/generated)"
LDFLAGS="-L$(realpath ../../build/lib) -lcouchbase -Wl,-rpath=$(realpath ../../build/lib)"
make analytics
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libcouchbase/couchbase.h>
#include "cJSON.h"
static void fail(const char *msg)
{
printf("[\x1b[31mERROR\x1b[0m] %s\n", msg);
exit(EXIT_FAILURE);
}
static void check(lcb_STATUS err, const char *msg)
{
if (err != LCB_SUCCESS) {
char buf[1024] = {0};
snprintf(buf, sizeof(buf), "%s: %s\n", msg, lcb_strerror_short(err));
fail(buf);
}
}
static int err2color(lcb_STATUS err)
{
switch (err) {
case LCB_SUCCESS:
return 49;
default:
return 31;
}
}
static void row_callback(lcb_INSTANCE *instance, int type, const lcb_RESPANALYTICS *resp)
{
int *idx;
const char *row;
size_t nrow;
lcb_STATUS rc = lcb_respanalytics_status(resp);
lcb_respanalytics_cookie(resp, (void **)&idx);
lcb_respanalytics_row(resp, &row, &nrow);
if (rc != LCB_SUCCESS) {
const lcb_RESPHTTP *http;
printf("\x1b[31m%s\x1b[0m", lcb_strerror_short(rc));
lcb_respanalytics_http_response(resp, &http);
if (http) {
uint16_t status;
lcb_resphttp_http_status(http, &status);
printf(", HTTP status: %d", (int)status);
}
printf("\n");
if (nrow) {
cJSON *json;
char *data = calloc(nrow + 1, sizeof(char));
memcpy(data, row, nrow);
json = cJSON_Parse(data);
if (json && json->type == cJSON_Object) {
cJSON *errors = cJSON_GetObjectItem(json, "errors");
if (errors && errors->type == cJSON_Array) {
int ii, nerrors = cJSON_GetArraySize(errors);
for (ii = 0; ii < nerrors; ii++) {
cJSON *err = cJSON_GetArrayItem(errors, ii);
if (err && err->type == cJSON_Object) {
cJSON *code, *msg;
code = cJSON_GetObjectItem(err, "code");
msg = cJSON_GetObjectItem(err, "msg");
if (code && code->type == cJSON_Number && msg && msg->type == cJSON_String) {
printf(
"\x1b[1mcode\x1b[0m: \x1b[31m%d\x1b[0m, \x1b[1mmessage\x1b[0m: \x1b[31m%s\x1b[0m\n",
code->valueint, msg->valuestring);
}
}
}
}
}
free(data);
}
}
if (lcb_respanalytics_is_final(resp)) {
printf("\x1b[1mMETA:\x1b[0m ");
} else {
printf("\x1b[1mR%d:\x1b[0m ", (*idx)++);
}
printf("%.*s\n", (int)nrow, row);
if (lcb_respanalytics_is_final(resp)) {
printf("\n");
}
}
int main(int argc, char *argv[])
{
lcb_STATUS err;
lcb_INSTANCE *instance;
size_t ii;
if (argc < 2) {
printf("Usage: %s couchbase://host/beer-sample [ password [ username ] ]\n", argv[0]);
exit(EXIT_FAILURE);
}
{
lcb_CREATEOPTS *create_options = NULL;
lcb_createopts_create(&create_options, LCB_TYPE_BUCKET);
lcb_createopts_connstr(create_options, argv[1], strlen(argv[1]));
if (argc > 3) {
lcb_createopts_credentials(create_options, argv[3], strlen(argv[3]), argv[2], strlen(argv[2]));
}
check(lcb_create(&instance, create_options), "create couchbase handle");
lcb_createopts_destroy(create_options);
check(lcb_connect(instance), "schedule connection");
lcb_wait(instance);
check(lcb_get_bootstrap_status(instance), "bootstrap from cluster");
}
{
const char *stmt = "SELECT * FROM breweries LIMIT 2";
lcb_CMDANALYTICS *cmd;
int idx = 0;
lcb_cmdanalytics_create(&cmd);
lcb_cmdanalytics_callback(cmd, row_callback);
lcb_cmdanalytics_statement(cmd, stmt, strlen(stmt));
lcb_INGEST_OPTIONS *opts;
lcb_ingest_options_create(&opts);
lcb_ingest_options_method(opts, LCB_INGEST_METHOD_UPSERT);
lcb_cmdanalytics_ingest_options(cmd, opts);
check(lcb_analytics(instance, &idx, cmd), "schedule analytics query");
printf("----> \x1b[36m%s\x1b[0m\n", stmt);
lcb_ingest_options_destroy(opts);
lcb_cmdanalytics_destroy(cmd);
lcb_wait(instance);
}
/* Now that we're all done, close down the connection handle */
lcb_destroy(instance);
return 0;
}
|
/* Copyright 2015 Samsung Electronics Co., LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/***************************************************************************
* The mesh for rendering.
***************************************************************************/
#ifndef MESH_H_
#define MESH_H_
#include <map>
#include <memory>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include "glm/glm.hpp"
#include "util/gvr_gl.h"
#include "objects/components/bone.h"
#include "objects/hybrid_object.h"
#include "objects/shader_data.h"
#include "objects/bounding_volume.h"
#include "objects/vertex_bone_data.h"
#include "objects/vertex_buffer.h"
#include "objects/index_buffer.h"
#include "bounding_volume.h"
namespace gvr {
class Mesh: public HybridObject {
public:
Mesh(const char* descriptor);
Mesh(VertexBuffer& vbuf);
VertexBuffer* getVertexBuffer() const { return mVertices; }
IndexBuffer* getIndexBuffer() const { return mIndices; }
void setVertexBuffer(VertexBuffer* vbuf) { mVertices = vbuf; }
void setIndexBuffer(IndexBuffer* ibuf) { mIndices = ibuf; }
bool setVertices(const float* vertices, int nelems);
bool getVertices(float* vertices, int nelems);
bool setNormals(const float* normals, int nelems);
bool getNormals(float* normals, int nelems);
bool setIndices(const unsigned int* indices, int nindices);
bool setTriangles(const unsigned short* indices, int nindices);
bool getIndices(unsigned short* indices, int nindices);
bool getLongIndices(unsigned int* indices, int nindices);
bool setFloatVec(const char* attrName, const float* src, int nelems);
bool setIntVec(const char* attrName, const int* src, int nelems);
bool getFloatVec(const char* attrName, float* dest, int nelems);
bool getIntVec(const char* attrName, int* dest, int nelems);
bool getAttributeInfo(const char* attributeName, int& index, int& offset, int& size) const;
void forAllIndices(std::function<void(int iter, int index)> func);
void forAllVertices(const char* attrName, std::function<void(int iter, const float* vertex)> func) const;
void forAllTriangles(std::function<void(int iter, const float* V1, const float* V2, const float* V3)> func) const;
Mesh* createBoundingBox();
void getTransformedBoundingBoxInfo(glm::mat4 *M, float *transformed_bounding_box); //Get Bounding box info transformed by matrix
int getIndexSize() const
{
return mIndices ? mIndices->getIndexSize() : 0;
}
int getIndexCount() const
{
return mIndices ? mIndices->getIndexCount() : 0;
}
int getVertexCount() const
{
return mVertices->getVertexCount();
}
const BoundingVolume& getBoundingVolume();
bool hasBones() const
{
return vertexBoneData_.getNumBones();
}
void setBones(std::vector<Bone*>&& bones)
{
vertexBoneData_.setBones(std::move(bones));
}
VertexBoneData &getVertexBoneData()
{
return vertexBoneData_;
}
bool isDirty() const { return mVertices->isDirty(); }
private:
Mesh(const Mesh& mesh);
Mesh(Mesh&& mesh);
Mesh& operator=(const Mesh& mesh);
protected:
IndexBuffer* mIndices;
VertexBuffer* mVertices;
bool have_bounding_volume_;
BoundingVolume bounding_volume;
// Bone data for the shader
VertexBoneData vertexBoneData_;
std::unordered_set<std::shared_ptr<u_short>> dirty_flags_;
};
}
#endif
|
// -*- C++ -*-
// Copyright 2016-17 Richard Copley
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef object_h
#define object_h
#include "markov.h"
struct object_t
{
float m, l, r;
float hue;
float animation_time;
float locus_length;
unsigned starting_point;
polyhedron_select_t target;
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.