text
stringlengths
4
6.14k
/* * 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/>. */ /** * @file param.h * @author Richard Preen <rpreen@gmail.com> * @copyright The Authors. * @date 2015--2021. * @brief Functions for setting and printing parameters. */ #pragma once #include "loss.h" #include "xcsf.h" char * param_json_export(const struct XCSF *xcsf); void param_json_import(struct XCSF *xcsf, const char *json_str); void param_free(struct XCSF *xcsf); void param_print(const struct XCSF *xcsf); void param_init(struct XCSF *xcsf, const int x_dim, const int y_dim, const int n_actions); size_t param_load(struct XCSF *xcsf, FILE *fp); size_t param_save(const struct XCSF *xcsf, FILE *fp); /* setters */ void param_set_omp_num_threads(struct XCSF *xcsf, const int a); void param_set_pop_init(struct XCSF *xcsf, const bool a); void param_set_max_trials(struct XCSF *xcsf, const int a); void param_set_perf_trials(struct XCSF *xcsf, const int a); void param_set_pop_size(struct XCSF *xcsf, const int a); void param_set_loss_func_string(struct XCSF *xcsf, const char *a); void param_set_loss_func(struct XCSF *xcsf, const int a); void param_set_stateful(struct XCSF *xcsf, const bool a); void param_set_compaction(struct XCSF *xcsf, const bool a); void param_set_huber_delta(struct XCSF *xcsf, const double a); void param_set_gamma(struct XCSF *xcsf, const double a); void param_set_teletransportation(struct XCSF *xcsf, const int a); void param_set_p_explore(struct XCSF *xcsf, const double a); void param_set_alpha(struct XCSF *xcsf, const double a); void param_set_beta(struct XCSF *xcsf, const double a); void param_set_delta(struct XCSF *xcsf, const double a); void param_set_e0(struct XCSF *xcsf, const double a); void param_set_init_error(struct XCSF *xcsf, const double a); void param_set_init_fitness(struct XCSF *xcsf, const double a); void param_set_nu(struct XCSF *xcsf, const double a); void param_set_theta_del(struct XCSF *xcsf, const int a); void param_set_m_probation(struct XCSF *xcsf, const int a); void param_set_set_subsumption(struct XCSF *xcsf, const bool a); void param_set_theta_sub(struct XCSF *xcsf, const int a); void param_set_x_dim(struct XCSF *xcsf, const int a); void param_set_explore(struct XCSF *xcsf, const bool a); void param_set_y_dim(struct XCSF *xcsf, const int a); void param_set_n_actions(struct XCSF *xcsf, const int a);
/* * h3c.h * * Copyright 2019 Baoke Ren <1193443688@qq.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * */
#ifndef SYS_INCLUDE_H #define SYS_INCLUDE_H /* ========================================================================== ** * sys_include.h * * Copyright (C) 1998 by Christopher R. Hertel * * Email: crh@ubiqx.mn.org * -------------------------------------------------------------------------- ** * This header provides system declarations and data types used internally * by the ubiqx modules. * -------------------------------------------------------------------------- ** * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * -------------------------------------------------------------------------- ** * * You may want to replace this file with your own system specific header, * or you may find that this default header has everything you need. In * most cases, I expect the latter to be the case. The ubi_* modules were * written to be as clean as possible. On purpose. There are limits, * though. Variations in compilers, and competing standards have made it * difficult to write code that just compiles. In particular, the location * of a definition of NULL seems to be less than consistant. * * This header makes a good attempt to find NULL. If you find that you * need something more on your system make sure that you keep a copy of * your version so that it won't be overwritten by updates of the ubiqx * code. * * -------------------------------------------------------------------------- ** * * $Log: not supported by cvs2svn $ * Revision 1.1 2004/01/14 20:27:13 dwarren * XSB Prolog Profiling as command line option -p * * Revision 0.0 1998/06/02 02:20:49 crh * Initial Revision. * * ========================================================================== ** */ /* -------------------------------------------------------------------------- ** * Looking for NULL. * * The core ubiqx modules (all those beginning with 'ubi_') rely on very * little from the outside world. One exception is that we need a * defintion for NULL. This has turned out to be something of a problem, * as NULL is NOT always defined in the same place on different systems. * * Ahh... standards... * * K&R 2nd Ed. (pg 102) says NULL should be in <stdio.h>. I've heard * that it is in <locale.h> on some systems. I've also seen it in * <stddef.h> and <stdlib.h>. In most cases it's defined in multiple * places. We'll try several of them. If none of these work on your * system, please send E'mail and let me know where you get your NULL! * * The purpose of the mess below, then, is simply to supply a definition * of NULL to the ubi_*.c files. Keep in mind that C compilers (all * those of which I'm aware) will allow you to define a constant on the * command line, eg.: -DNULL=((void *)0). * * Also, 99.9% of the time, NULL is zero. I have been informed of at * least one exception. * * crh; may 1998 */ #ifndef NULL #include <stddef.h> #endif #ifndef NULL #include <stdlib.h> #endif #ifndef NULL #include <stdio.h> #endif #ifndef NULL #include <locale.h> #endif #ifndef NULL #define NULL ((void *)0) #endif /* ================================ The End ================================= */ #endif /* SYS_INCLUDE_H */
/* * Copyright Droids Corporation, Microb Technology, Eirbot (2005) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Revision : $Id: uart_config.h,v 1.2.2.2 2007-05-12 16:42:40 zer0 Exp $ * */ /* Droids-corp 2004 - Zer0 * config for uart module */ #ifndef UART_CONFIG_H #define UART_CONFIG_H /* * UART0 definitions */ /* compile uart0 fonctions, undefine it to pass compilation */ #define UART0_COMPILE /* enable uart0 if == 1, disable if == 0 */ #define UART0_ENABLED 1 /* enable uart0 interrupts if == 1, disable if == 0 */ #define UART0_INTERRUPT_ENABLED 1 #define UART0_BAUDRATE 38400 /* * if you enable this, the maximum baudrate you can reach is * higher, but the precision is lower. */ #define UART0_USE_DOUBLE_SPEED 0 //#define UART0_USE_DOUBLE_SPEED 1 #define UART0_RX_FIFO_SIZE 4 #define UART0_TX_FIFO_SIZE 4 //#define UART0_NBITS 5 //#define UART0_NBITS 6 //#define UART0_NBITS 7 #define UART0_NBITS 8 //#define UART0_NBITS 9 #define UART0_PARITY UART_PARTITY_NONE //#define UART0_PARITY UART_PARTITY_ODD //#define UART0_PARITY UART_PARTITY_EVEN #define UART0_STOP_BIT UART_STOP_BITS_1 //#define UART0_STOP_BIT UART_STOP_BITS_2 /* .... same for uart 1, 2, 3 ... */ #endif
/* iso2unicode Copyright (C) 2014 Center for Sprogteknologi, University of Copenhagen This file is part of makeUTF8. makeUTF8 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. makeUTF8 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 makeUTF8. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ISO2UNICODE_H #define ISO2UNICODE_H class duple { public: int eightbit; int isocodes; }; extern duple * duples; int * getCode(int isocode); int makeDuples(void); void deleteDuples(void); int getEightBit(int unicode); char * report(); #endif
/* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team * * 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/>. * */ #ifndef __SESSION_H__ #define __SESSION_H__ #ifdef HAVE_CONFIG_H #include "claws-features.h" #endif #include <glib.h> #include <time.h> #include <unistd.h> #include "socket.h" #define SESSION_BUFFSIZE 4096 typedef struct _Session Session; #define SESSION(obj) ((Session *)obj) typedef enum { SESSION_UNKNOWN, SESSION_IMAP, SESSION_NEWS, SESSION_SMTP, SESSION_POP3 } SessionType; typedef enum { SESSION_READY, SESSION_SEND, SESSION_RECV, SESSION_EOF, SESSION_TIMEOUT, SESSION_ERROR, SESSION_DISCONNECTED } SessionState; typedef enum { SESSION_MSG_NORMAL, SESSION_MSG_SEND_DATA, SESSION_MSG_RECV_DATA, SESSION_MSG_CONTROL, SESSION_MSG_ERROR, SESSION_MSG_UNKNOWN } SessionMsgType; typedef gint (*RecvMsgNotify) (Session *session, const gchar *msg, gpointer user_data); typedef gint (*RecvDataProgressiveNotify) (Session *session, guint cur_len, guint total_len, gpointer user_data); typedef gint (*RecvDataNotify) (Session *session, guint len, gpointer user_data); typedef gint (*SendDataProgressiveNotify) (Session *session, guint cur_len, guint total_len, gpointer user_data); typedef gint (*SendDataNotify) (Session *session, guint len, gpointer user_data); struct _Session { SessionType type; SockInfo *sock; gchar *server; gushort port; gboolean nonblocking; SessionState state; time_t last_access_time; GTimeVal tv_prev; gint conn_id; gint io_tag; gchar read_buf[SESSION_BUFFSIZE]; gchar *read_buf_p; gint read_buf_len; GString *read_msg_buf; GByteArray *read_data_buf; gchar *read_data_terminator; /* buffer for short messages */ gchar *write_buf; gchar *write_buf_p; gint write_buf_len; /* buffer for large data */ const guchar *write_data; const guchar *write_data_p; gint write_data_len; guint timeout_tag; guint timeout_interval; gpointer data; /* virtual methods to parse server responses */ gint (*recv_msg) (Session *session, const gchar *msg); gint (*send_data_finished) (Session *session, guint len); gint (*recv_data_finished) (Session *session, guchar *data, guint len); void (*destroy) (Session *session); /* notification functions */ RecvMsgNotify recv_msg_notify; RecvDataProgressiveNotify recv_data_progressive_notify; RecvDataNotify recv_data_notify; SendDataProgressiveNotify send_data_progressive_notify; SendDataNotify send_data_notify; gpointer recv_msg_notify_data; gpointer recv_data_progressive_notify_data; gpointer recv_data_notify_data; gpointer send_data_progressive_notify_data; gpointer send_data_notify_data; const void *account; gboolean is_smtp; #ifdef USE_GNUTLS SSLType ssl_type; #endif }; void session_init (Session *session, const void *prefs_account, gboolean is_smtp); gint session_connect (Session *session, const gchar *server, gushort port); gint session_disconnect (Session *session); void session_destroy (Session *session); gboolean session_is_running (Session *session); gboolean session_is_connected (Session *session); void session_set_access_time (Session *session); void session_set_timeout (Session *session, guint interval); void session_set_recv_message_notify (Session *session, RecvMsgNotify notify_func, gpointer data); void session_set_recv_data_progressive_notify (Session *session, RecvDataProgressiveNotify notify_func, gpointer data); void session_set_recv_data_notify (Session *session, RecvDataNotify notify_func, gpointer data); void session_set_send_data_progressive_notify (Session *session, SendDataProgressiveNotify notify_func, gpointer data); void session_set_send_data_notify (Session *session, SendDataNotify notify_func, gpointer data); #ifdef USE_GNUTLS gint session_start_tls (Session *session); #endif gint session_send_msg (Session *session, SessionMsgType type, const gchar *msg); gint session_recv_msg (Session *session); gint session_send_data (Session *session, const guchar *data, guint size); gint session_recv_data (Session *session, guint size, const gchar *terminator); #endif /* __SESSION_H__ */
/* * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <cpu.h> #include <dm.h> #include <errno.h> #include <asm/cpu.h> DECLARE_GLOBAL_DATA_PTR; int cpu_x86_bind(struct udevice *dev) { struct cpu_platdata *plat = dev_get_parent_platdata(dev); struct cpuid_result res; plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "intel,apic-id", -1); plat->family = gd->arch.x86; res = cpuid(1); plat->id[0] = res.eax; plat->id[1] = res.edx; return 0; } int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size) { const char *vendor = cpu_vendor_name(gd->arch.x86_vendor); if (size < (strlen(vendor) + 1)) return -ENOSPC; strcpy(buf, vendor); return 0; } int cpu_x86_get_desc(struct udevice *dev, char *buf, int size) { if (size < CPU_MAX_NAME_LEN) return -ENOSPC; cpu_get_name(buf); return 0; } static int cpu_x86_get_count(struct udevice *dev) { int node, cpu; int num = 0; node = fdt_path_offset(gd->fdt_blob, "/cpus"); if (node < 0) return -ENOENT; for (cpu = fdt_first_subnode(gd->fdt_blob, node); cpu >= 0; cpu = fdt_next_subnode(gd->fdt_blob, cpu)) { const char *device_type; device_type = fdt_getprop(gd->fdt_blob, cpu, "device_type", NULL); if (!device_type) continue; if (strcmp(device_type, "cpu") == 0) num++; } return num; } static const struct cpu_ops cpu_x86_ops = { .get_desc = cpu_x86_get_desc, .get_count = cpu_x86_get_count, .get_vendor = cpu_x86_get_vendor, }; static const struct udevice_id cpu_x86_ids[] = { { .compatible = "cpu-x86" }, { } }; U_BOOT_DRIVER(cpu_x86_drv) = { .name = "cpu_x86", .id = UCLASS_CPU, .of_match = cpu_x86_ids, .bind = cpu_x86_bind, .ops = &cpu_x86_ops, };
#ifndef NAMEPARSER_H #define NAMEPARSER_H #include <QString> #include <QDebug> #define FB_APP_KEY "1416908014988033" #define FB_APP_SECRET_KEY "f1yivkfZWkWN2QXvi8CXj_9Pdwk" class NameParser { public: NameParser(); ~NameParser(); QString generateLastFmLink(QString name); QString generateFacebookLink(QString name); private: }; #endif // NAMEPARSER_H
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef BEHAVIORDIALOG_H #define BEHAVIORDIALOG_H #include <modelnode.h> #include <propertyeditorvalue.h> #include <QPushButton> #include <QDialog> #include <QWeakPointer> #include <QScopedPointer> #include <qdeclarative.h> #include "ui_behaviordialog.h" namespace QmlDesigner { class BehaviorDialog; class BehaviorWidget : public QPushButton { Q_PROPERTY(PropertyEditorNodeWrapper* complexNode READ complexNode WRITE setComplexNode) Q_OBJECT public: explicit BehaviorWidget(QWidget *parent = 0); ModelNode modelNode() const {return m_modelNode; } QString propertyName() const {return m_propertyName; } PropertyEditorNodeWrapper* complexNode() const; void setComplexNode(PropertyEditorNodeWrapper* complexNode); public slots: void buttonPressed(bool); private: ModelNode m_modelNode; QString m_propertyName; PropertyEditorNodeWrapper* m_complexNode; QScopedPointer<BehaviorDialog> m_BehaviorDialog; }; class BehaviorDialog : public QDialog { Q_OBJECT public: explicit BehaviorDialog(QWidget *parent = 0); void setup(const ModelNode &node, const QString propertyName); public slots: virtual void accept(); virtual void reject(); static void registerDeclarativeType(); private: ModelNode m_modelNode; QString m_propertyName; QScopedPointer<Internal::Ui::BehaviorDialog> m_ui; }; } QML_DECLARE_TYPE(QmlDesigner::BehaviorWidget) #endif// BEHAVIORDIALOG_H
/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 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 General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Authors: * Eric Gregory <eric@yorba.org> */ #ifndef DATABASE_H #define DATABASE_H #include <QFile> #include <QObject> #include <QString> class AlbumTable; class MediaTable; class QSqlDatabase; class QSqlQuery; class Resource; const qint64 INVALID_ID = -1; /*! * \brief The Database class */ class Database : public QObject { Q_OBJECT public: Database(Resource *resource, QObject* parent = 0); ~Database(); void logSqlError(QSqlQuery& q) const; QSqlDatabase* getDB(); AlbumTable* getAlbumTable() const; MediaTable* getMediaTable() const; private: bool openDB(); int schemaVersion() const; void setSchemaVersion(int version); void upgradeSchema(int current_version); bool executeSqlFile(QFile& file); const QString &getSqlDir() const; QString getDBname() const; QString getDBBackupName() const; void restoreFromBackup(); void createBackup(); QString m_databaseDirectory; QString m_sqlSchemaDirectory; QSqlDatabase* m_db; AlbumTable* m_albumTable; MediaTable* m_mediaTable; }; #endif // DATABASE_H
/* * (C) 2003-2006 Gabest * (C) 2006-2014 see Authors.txt * * This file is part of WinnerMediaPlayer. * * WinnerMediaPlayer 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. * * WinnerMediaPlayer 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/>. * */ #pragma once // CSaveImageDialog class CSaveImageDialog : public CFileDialog { DECLARE_DYNAMIC(CSaveImageDialog) public: CSaveImageDialog( int quality, int levelPNG, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL); virtual ~CSaveImageDialog(); protected: DECLARE_MESSAGE_MAP() virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(); virtual BOOL OnFileNameOK(); HRESULT _CDialogEventHandler_CreateInstance(REFIID riid, void **ppv); public: int m_quality, m_levelPNG; CSpinButtonCtrl m_qualityctrl; }; // CSaveThumbnailsDialog class CSaveThumbnailsDialog : public CFileDialog { DECLARE_DYNAMIC(CSaveThumbnailsDialog) public: CSaveThumbnailsDialog( int rows, int cols, int width, int quality, int levelPNG, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL); virtual ~CSaveThumbnailsDialog(); protected: DECLARE_MESSAGE_MAP() virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(); virtual BOOL OnFileNameOK(); HRESULT _CDialogEventHandler_CreateInstance(REFIID riid, void **ppv); public: int m_rows, m_cols, m_width, m_quality, m_levelPNG; CSpinButtonCtrl m_rowsctrl, m_colsctrl, m_widthctrl, m_qualityctrl; }; // CDialogEventHandler class CDialogEventHandler : public IFileDialogEvents, public IFileDialogControlEvents { public: // IUnknown methods IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) { static const QITAB qit[] = { QITABENT(CDialogEventHandler, IFileDialogEvents), QITABENT(CDialogEventHandler, IFileDialogControlEvents), { 0 }, }; return QISearch(this, qit, riid, ppv); } IFACEMETHODIMP_(ULONG) AddRef() { return InterlockedIncrement(&_cRef); } IFACEMETHODIMP_(ULONG) Release() { long cRef = InterlockedDecrement(&_cRef); if (!cRef) { delete this; } return cRef; } // IFileDialogEvents IFACEMETHODIMP OnFileOk(IFileDialog * /* pfd */) { return E_NOTIMPL; } IFACEMETHODIMP OnFolderChanging(IFileDialog * /* pfd */, IShellItem * /* psi */) { return E_NOTIMPL; } IFACEMETHODIMP OnFolderChange(IFileDialog * /* pfd */) { return E_NOTIMPL; } IFACEMETHODIMP OnSelectionChange(IFileDialog * /* pfd */) { return E_NOTIMPL; } IFACEMETHODIMP OnShareViolation(IFileDialog * /* pfd */, IShellItem * /* psi */, FDE_SHAREVIOLATION_RESPONSE * /* pResponse */) { return E_NOTIMPL; } IFACEMETHODIMP OnTypeChange(IFileDialog * pfd); IFACEMETHODIMP OnOverwrite(IFileDialog * /* pfd */, IShellItem * /* psi */ , FDE_OVERWRITE_RESPONSE * /* pResponse */) { return E_NOTIMPL;} // IFileDialogControlEvents IFACEMETHODIMP OnItemSelected(IFileDialogCustomize * /* pfdc */, DWORD /* dwIDCtl */, DWORD /* dwIDItem */) { return E_NOTIMPL; } IFACEMETHODIMP OnButtonClicked(IFileDialogCustomize * /* pfdc */, DWORD /* pIDControl */) { return E_NOTIMPL; } IFACEMETHODIMP OnCheckButtonToggled(IFileDialogCustomize * /* pfdc */, DWORD /* dwIDCtl */, BOOL /* bChecked */) { return E_NOTIMPL; } IFACEMETHODIMP OnControlActivating(IFileDialogCustomize * /* pfdc */, DWORD /* dwIDCtl */) { return E_NOTIMPL; } CDialogEventHandler() : _cRef(1) { }; private: ~CDialogEventHandler() { }; long _cRef; };
/* readtokens.h -- Functions for reading tokens from an input stream. Copyright (C) 1990-1991, 1999, 2001-2004, 2009-2010 Free Software Foundation, Inc. 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/>. Written by Jim Meyering. */ #ifndef READTOKENS_H # define READTOKENS_H # include <stdio.h> struct tokenbuffer { size_t size; char *buffer; }; typedef struct tokenbuffer token_buffer; void init_tokenbuffer (token_buffer *tokenbuffer); size_t readtoken (FILE *stream, const char *delim, size_t n_delim, token_buffer *tokenbuffer); size_t readtokens (FILE *stream, size_t projected_n_tokens, const char *delim, size_t n_delim, char ***tokens_out, size_t **token_lengths); #endif /* not READTOKENS_H */
/* * This file is part of Torus. * Torus 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. * Torus 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 Torus. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __TORUS_DEBUG_H #define __TORUS_DEBUG_H #ifndef DEBUG_MODE #define DEBUG_MODE 0 #endif //DEBUG_MODE #if DEBUG_MODE > 0 #include <string> #include <sstream> #include <shell.h> #include <library/string.h> #define _DBG_MSG(x, y) TORUSSHELLECHO(x << "::" << remove_prefix(SOURCE_PATH, __FILE__) << "(" << __LINE__ << ")::" << __func__ << ": " << y); #else //DEBUG_MODE > 0 #define _DBG_MSG(x, y) #define debug_init() #define debug_halt() #endif #define DEBUG_ERROR(x) #define DEBUG_WARNING(x) #define DEBUG_NOTICE(x) #define DEBUG_INFO(x) #define DEBUG_MSG(x) #if DEBUG_MODE > 0 #undef DEBUG_ERROR #define DEBUG_ERROR(x) _DBG_MSG("[ERROR]", x) #endif #if DEBUG_MODE > 1 #undef DEBUG_WARNING #define DEBUG_WARNING(x) _DBG_MSG("[WARNING]", x) #endif #if DEBUG_MODE > 2 #undef DEBUG_NOTICE #define DEBUG_NOTICE(x) _DBG_MSG("[NOTICE]", x) #endif #if DEBUG_MODE > 3 #undef DEBUG_INFO #define DEBUG_INFO(x) _DBG_MSG("[INFO]", x) #endif #if DEBUG_MODE > 4 #undef DEBUG_MSG #define DEBUG_MSG(x) _DBG_MSG("[MSG]", x) #endif #endif //__TORUS_DEBUG_H
/******************************************************************************* * This file is part of KaHyPar. * * Copyright (C) 2017 Sebastian Schlag <sebastian.schlag@kit.edu> * Copyright (C) 2017 Tobias Heuer <tobias.heuer@gmx.net> * * KaHyPar 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. * * KaHyPar 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 KaHyPar. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ #pragma once #include <algorithm> #include <limits> #include <vector> #include "kahypar/datastructure/fast_reset_flag_array.h" #include "kahypar/datastructure/graph.h" #include "kahypar/definitions.h" #include "kahypar/macros.h" namespace kahypar { const bool dbg_modularity_function = false; class Modularity { private: using NodeID = HypernodeID; using EdgeWeight = HyperedgeWeight; using ClusterID = PartitionID; using Context = Configuration; using Edge = ds::Edge; using Graph = ds::Graph; public: explicit Modularity(Graph& graph) : _graph(graph), _internal_weight(graph.numNodes(), 0), _total_weight(graph.numNodes(), 0), _vis(graph.numNodes()) { for (const NodeID& node : _graph.nodes()) { ASSERT(static_cast<NodeID>(_graph.clusterID(node)) == node); _internal_weight[node] = _graph.selfloopWeight(node); _total_weight[node] = _graph.weightedDegree(node); } } void remove(const NodeID node, const EdgeWeight incident_community_weight) { ASSERT(node < _graph.numNodes(), "NodeID" << node << "doesn't exist!"); const ClusterID cid = _graph.clusterID(node); _internal_weight[cid] -= 2.0L * incident_community_weight + _graph.selfloopWeight(node); _total_weight[cid] -= _graph.weightedDegree(node); _graph.setClusterID(node, -1); } void insert(const NodeID node, const ClusterID new_cid, const EdgeWeight incident_community_weight) { ASSERT(node < _graph.numNodes(), "NodeID" << node << "doesn't exist!"); ASSERT(_graph.clusterID(node) == -1, "Node" << node << "isn't a isolated node!"); _internal_weight[new_cid] += 2.0L * incident_community_weight + _graph.selfloopWeight(node); _total_weight[new_cid] += _graph.weightedDegree(node); _graph.setClusterID(node, new_cid); ASSERT([&]() { if (!dbg_modularity_function) return true; const EdgeWeight q = quality(); return q < std::numeric_limits<EdgeWeight>::max(); } (), ""); } EdgeWeight gain(const NodeID node, const ClusterID cid, const EdgeWeight incident_community_weight) { ASSERT(node < _graph.numNodes(), "NodeID" << node << "doesn't exist!"); ASSERT(_graph.clusterID(node) == -1, "Node" << node << "isn't a isolated node!"); const EdgeWeight totc = _total_weight[cid]; const EdgeWeight m2 = _graph.totalWeight(); const EdgeWeight w_degree = _graph.weightedDegree(node); const EdgeWeight gain = incident_community_weight - totc * w_degree / m2; ASSERT([&]() { if (!dbg_modularity_function) return true; const EdgeWeight modularity_before = modularity(); insert(node, cid, incident_community_weight); const EdgeWeight modularity_after = modularity(); remove(node, incident_community_weight); const EdgeWeight real_gain = modularity_after - modularity_before; if (std::abs(2.0L * gain / m2 - real_gain) > Graph::kEpsilon) { //LOG << V(real_gain); // LOG << V(2.0L * gain / m2); return false; } return true; } (), "Gain calculation failed!"); return gain; } EdgeWeight quality() { EdgeWeight q = 0.0L; const EdgeWeight m2 = _graph.totalWeight(); for (const NodeID& node : _graph.nodes()) { if (_total_weight[node] > Graph::kEpsilon) { q += _internal_weight[node] - (_total_weight[node] * _total_weight[node]) / m2; } } q /= m2; ASSERT(!dbg_modularity_function || std::abs(q - modularity()) < Graph::kEpsilon, "Calculated modularity (q=" << q << ") is not equal with the real modularity " << "(modularity=" << modularity() << ")!"); return q; } private: FRIEND_TEST(AModularityMeasure, IsCorrectInitialized); FRIEND_TEST(AModularityMeasure, RemoveNodeFromCommunity); FRIEND_TEST(AModularityMeasure, InsertNodeInCommunity); FRIEND_TEST(AModularityMeasure, RemoveNodeFromCommunityWithMoreThanOneNode); EdgeWeight modularity() { EdgeWeight q = 0.0L; const EdgeWeight m2 = _graph.totalWeight(); for (const NodeID& u : _graph.nodes()) { for (const Edge& edge : _graph.incidentEdges(u)) { const NodeID v = edge.target_node; _vis.set(v, true); if (_graph.clusterID(u) == _graph.clusterID(v)) { q += edge.weight - (_graph.weightedDegree(u) * _graph.weightedDegree(v)) / m2; } } for (const NodeID& v : _graph.nodes()) { if (_graph.clusterID(u) == _graph.clusterID(v) && !_vis[v]) { q -= (_graph.weightedDegree(u) * _graph.weightedDegree(v)) / m2; } } _vis.reset(); } q /= m2; return q; } Graph& _graph; std::vector<EdgeWeight> _internal_weight; std::vector<EdgeWeight> _total_weight; ds::FastResetFlagArray<> _vis; }; } // namespace kahypar
/* * PROJECT: GEM-Tools library * FILE: gt_json.c * DATE: 01/06/2012 * DESCRIPTION: Helper functions for json output */ #include "gt_json.h" GT_INLINE JsonNode* gt_json_int_named_tuple(const uint64_t num_elements,...) { uint64_t i=0; va_list v_args; va_start(v_args,num_elements); JsonNode* a = json_mkobject(); char* key = NULL; uint64_t value = 0; for(i=0;i<num_elements;i++) { key = va_arg(v_args,char*); value = va_arg(v_args,uint64_t); json_append_member(a,key,json_mknumber(value)); } va_end(v_args); return a; } GT_INLINE JsonNode* gt_json_int_array(const uint64_t start,const uint64_t len,uint64_t* const data) { JsonNode* a = json_mkarray(); uint64_t i= 0; for (i=0;i<len;++i) { json_append_element(a,json_mknumber((double)data[start + i])); } return a; } GT_INLINE JsonNode* gt_json_int_hash(gt_shash* const data) { JsonNode* a = json_mkobject(); GT_SHASH_BEGIN_ITERATE(data,key,e,uint64_t) { json_append_member(a,key,json_mknumber((double)(*e))); } GT_SHASH_END_ITERATE return a; }
/* * $HEADER$ */ #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif extern const mca_base_component_t mca_memory_patcher_component; const mca_base_component_t *mca_memory_base_static_components[] = { &mca_memory_patcher_component, NULL }; #if defined(c_plusplus) || defined(__cplusplus) } #endif
/* include sem_open1 */ #include "unpipc.h" #include "semaphore.h" #include <stdarg.h> /* for variable arg lists */ #define MAX_TRIES 10 /* for waiting for initialization */ mysem_t * mysem_open(const char *pathname, int oflag, ... ) { int fd, i, created, save_errno; mode_t mode; va_list ap; mysem_t *sem, seminit; struct stat statbuff; unsigned int value; pthread_mutexattr_t mattr; pthread_condattr_t cattr; created = 0; sem = MAP_FAILED; /* [sic] */ again: if (oflag & O_CREAT) { va_start(ap, oflag); /* init ap to final named argument */ mode = va_arg(ap, va_mode_t) & ~S_IXUSR; value = va_arg(ap, unsigned int); va_end(ap); /* 4open and specify O_EXCL and user-execute */ fd = open(pathname, oflag | O_EXCL | O_RDWR, mode | S_IXUSR); if (fd < 0) { if (errno == EEXIST && (oflag & O_EXCL) == 0) goto exists; /* already exists, OK */ else return(SEM_FAILED); } created = 1; /* 4first one to create the file initializes it */ /* 4set the file size */ bzero(&seminit, sizeof(seminit)); if (write(fd, &seminit, sizeof(seminit)) != sizeof(seminit)) goto err; /* 4memory map the file */ sem = mmap(NULL, sizeof(mysem_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (sem == MAP_FAILED) goto err; /* 4initialize mutex, condition variable, and value */ if ( (i = pthread_mutexattr_init(&mattr)) != 0) goto pthreaderr; pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); i = pthread_mutex_init(&sem->sem_mutex, &mattr); pthread_mutexattr_destroy(&mattr); /* be sure to destroy */ if (i != 0) goto pthreaderr; if ( (i = pthread_condattr_init(&cattr)) != 0) goto pthreaderr; pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED); i = pthread_cond_init(&sem->sem_cond, &cattr); pthread_condattr_destroy(&cattr); /* be sure to destroy */ if (i != 0) goto pthreaderr; if ( (sem->sem_count = value) > sysconf(_SC_SEM_VALUE_MAX)) { errno = EINVAL; goto err; } /* 4initialization complete, turn off user-execute bit */ if (fchmod(fd, mode) == -1) goto err; close(fd); sem->sem_magic = SEM_MAGIC; return(sem); } /* end sem_open1 */ /* include sem_open2 */ exists: if ( (fd = open(pathname, O_RDWR)) < 0) { if (errno == ENOENT && (oflag & O_CREAT)) goto again; goto err; } sem = mmap(NULL, sizeof(mysem_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (sem == MAP_FAILED) goto err; /* 4make certain initialization is complete */ for (i = 0; i < MAX_TRIES; i++) { if (stat(pathname, &statbuff) == -1) { if (errno == ENOENT && (oflag & O_CREAT)) { close(fd); goto again; } goto err; } if ((statbuff.st_mode & S_IXUSR) == 0) { close(fd); sem->sem_magic = SEM_MAGIC; return(sem); } sleep(1); } errno = ETIMEDOUT; goto err; pthreaderr: errno = i; err: /* 4don't let munmap() or close() change errno */ save_errno = errno; if (created) unlink(pathname); if (sem != MAP_FAILED) munmap(sem, sizeof(mysem_t)); close(fd); errno = save_errno; return(SEM_FAILED); } /* end sem_open2 */ mysem_t * Mysem_open(const char *pathname, int oflag, ... ) { va_list ap; mode_t mode; mysem_t *sem; unsigned int value; if (oflag & O_CREAT) { va_start(ap, oflag); /* init ap to final named argument */ mode = va_arg(ap, va_mode_t); value = va_arg(ap, unsigned int); va_end(ap); if ( (sem = mysem_open(pathname, oflag, mode, value)) == SEM_FAILED) err_sys("mysem_open error for %s", pathname); } else { if ( (sem = mysem_open(pathname, oflag)) == SEM_FAILED) err_sys("mysem_open error for %s", pathname); } return(sem); }
#ifndef ARRAY_H #define ARRAY_H #include <stdarg.h> #define ARRTERM -1 struct _string_t { char *str; int strlen; }; typedef struct _string_t string_t; struct _array_t { int nitems; string_t **items; }; typedef struct _array_t array_t; string_t *string_new(int slen, char *strdata); void string_delete(string_t *string); array_t *array_new(); void array_delete(array_t *array); int va_array_add(array_t *aa, va_list ap); int array_add(array_t *aa, ...); int array_dup(array_t *dst, array_t *src); #endif
#include <sollya.h> int main(void) { sollya_obj_t f1, f2; sollya_lib_init(); f1 = sollya_lib_free_variable(); f2 = sollya_lib_log10(f1); sollya_lib_printf("%b", f2); sollya_lib_clear_obj(f1); sollya_lib_clear_obj(f2); sollya_lib_close(); return 0; }
/* * 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/>. */ #ifndef SIGNALS_H_ #define SIGNALS_H_ #include <csignal> #include <execinfo.h> #include <unistd.h> #include <libunwind.h> #include <boost/units/detail/utility.hpp> namespace exo { namespace signals { /** * Registers a Segmentation fault handler which in case results in Segfault exception. * If compiled with debug enabled it will additionally print a 10 frame backtrace on stdout */ void sigsegHandler( int signal, siginfo_t *si, void *arg ); /** * Registers a termination/interrupt handler to initialize shutdown. */ void sigtermHandler( int signal, siginfo_t *si, void *arg ); /** * Register signalhandlers, currently only a segfault exception throw is registered * TODO: check which other signals could be caught - http://en.wikipedia.org/wiki/Unix_signal */ void registerHandlers(); } } #endif /* SIGNALS_H_ */
/* An interface to read and write that retries (if necessary) until complete. Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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/>. */ #include "parser/config.h" /* Specification. */ #ifdef FULL_READ # include "parser/full-read.h" #else # include "parser/full-write.h" #endif #include <errno.h> #ifdef FULL_READ # include "parser/safe-read.h" # define safe_rw safe_read # define full_rw full_read # undef const # define const /* empty */ #else # include "parser/safe-write.h" # define safe_rw safe_write # define full_rw full_write #endif #ifdef FULL_READ /* Set errno to zero upon EOF. */ # define ZERO_BYTE_TRANSFER_ERRNO 0 #else /* Some buggy drivers return 0 when one tries to write beyond a device's end. (Example: Linux 1.2.13 on /dev/fd0.) Set errno to ENOSPC so they get a sensible diagnostic. */ # define ZERO_BYTE_TRANSFER_ERRNO ENOSPC #endif /* Write(read) COUNT bytes at BUF to(from) descriptor FD, retrying if interrupted or if a partial write(read) occurs. Return the number of bytes transferred. When writing, set errno if fewer than COUNT bytes are written. When reading, if fewer than COUNT bytes are read, you must examine errno to distinguish failure from EOF (errno == 0). */ size_t full_rw (int fd, const void *buf, size_t count) { size_t total = 0; const char *ptr = (const char *) buf; while (count > 0) { size_t n_rw = safe_rw (fd, ptr, count); if (n_rw == (size_t) -1) break; if (n_rw == 0) { errno = ZERO_BYTE_TRANSFER_ERRNO; break; } total += n_rw; ptr += n_rw; count -= n_rw; } return total; }
/*======================================================== * PackageImpl.h * @author Sergey Mikhtonyuk * @date 03 November 2008 =========================================================*/ #ifndef _MODULECLASS_H__ #define _MODULECLASS_H__ #include "ModuleAccessor.h" #include <exception> namespace Core { namespace SCOM { /// Module managing class /** Used to easily load the module and gain access to module map * @ingroup SCOM */ class Module : Utils::NonCopyable { /// Module init function type typedef void (*INIT_FUNC)(); /// Module shutdown function type typedef void (*SHUTDOWN_FUNC)(); void* mModule; ///< Module handle INIT_FUNC mInitFunc; ///< Init function SHUTDOWN_FUNC mShutdownFunc; ///< Init function ModuleAccessor mModuleAccessor;///< accessor to loaded module public: /// Creates uninitialized module object Module() : mModule(0), mInitFunc(0), mShutdownFunc(0) { } /// Creates and initializes module object Module(const char* moduleName) { if(SCOM_FAILED(Init(moduleName))) throw std::exception("Failed to initialize module"); } /// Unloads the package ~Module() { Shutdown(); UnloadPackage(); } /// Used to bind module object to some dll and extract module map accessor HResult Init(const char* moduleName); /// Calls module shutdown routine void Shutdown(); /// Checks if module is loaded and module map extracted bool IsLoaded() const { return (mModuleAccessor.IsInitialized() && mModule != 0); } /// Used to free library void UnloadPackage(); /// Creates instance of the class and tries to cast it to desired interface /** @param clsid CLS_ID of the class to create * @param riid Interface ID of interface to cast to * @param ppv location where to put the interface pointer */ HResult CreateInstance(SCOM_RIID clsid, SCOM_RIID riid, void** ppv) { // Redirect call return mModuleAccessor.CreateInstance(clsid, riid, ppv); } /// Creates first found implementation of specified interface /**@param riid Interface ID of desired interface * @param ppv location where to put the interface pointer */ HResult CreateInstance(SCOM_RIID riid, void** ppv) { // Redirect call return mModuleAccessor.CreateInstance(riid, ppv); } /// Returns first entry of module map MODULE_MAP_ENTRY* GetFirstEntry() { return mModuleAccessor.GetFirstEntry(); } }; } // namespace } // namespace #endif // _MODULECLASS_H__
/* gy-app-actions.c * * Copyright 2020 Jakub Czartek <kuba@linux.pl> * * 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/>. * * SPDX-License-Identifier: GPL-3.0-or-later */ #include "config.h" #include <glib/gi18n-lib.h> #include "gy-app.h" #include "gy-app-private.h" #include "gui/gy-window.h" #include "preferences/gy-prefs-window.h" static void gy_app_actions_new_window_cb (GSimpleAction *action G_GNUC_UNUSED, GVariant *parametr G_GNUC_UNUSED, gpointer data) { GyApp *app = GY_APP (data); GtkWidget *window; window = gy_window_new (app); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (window)); gtk_window_present (GTK_WINDOW (window)); } static void gy_app_actions_preferences_cb (GSimpleAction *action G_GNUC_UNUSED, GVariant *parametr G_GNUC_UNUSED, gpointer data) { GyApp *self = GY_APP (data); GtkWindow *toplevel = NULL; GtkWindow *window = NULL; GList *windows = NULL; windows = gtk_application_get_windows (GTK_APPLICATION (self)); for (; windows != NULL; windows = windows->next) { GtkWindow *win = windows->data; if (GY_IS_PREFS_WINDOW (win)) { gtk_window_present (win); return; } if (toplevel == NULL && GY_IS_WINDOW (win)) toplevel = win; } window = g_object_new (GY_TYPE_PREFS_WINDOW, "transient-for", toplevel, NULL); gtk_application_add_window (GTK_APPLICATION (self), window); gtk_window_present (window); } static void gy_app_actions_about_cb (GSimpleAction *action G_GNUC_UNUSED, GVariant *parameter G_GNUC_UNUSED, gpointer user_data) { GyApp *self = GY_APP (user_data); GList *windows, *iter; GtkWindow *parent = NULL; const gchar *authors[] = { "Jakub Czartek <kuba@linux.pl>", "Piotr Czartek", NULL }; const gchar **documenters = NULL; const gchar *translator_credits = _("translator_credits"); g_return_if_fail (GY_IS_APP (self)); windows = gtk_application_get_windows (GTK_APPLICATION (self)); for (iter = windows; iter ;iter = iter->next) { if (GY_IS_WINDOW (iter->data)) { parent = GTK_WINDOW (iter->data); break; } } gtk_show_about_dialog (parent, "name", "Gydict", "version", PACKAGE_VERSION, "comments", _("Look up words in different (commercial and free) multimedia dictionaries"), "license-type", GTK_LICENSE_GPL_2_0, "authors", authors, "documenters", documenters, "translator-credits", (strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL), "logo-icon-name", PACKAGE_NAME, NULL); } static void gy_app_actions_quit_cb (GSimpleAction *action G_GNUC_UNUSED, GVariant *parametr G_GNUC_UNUSED, gpointer data) { GyApp *app = GY_APP(data); GList * windows; /* Remove all windows registered application */ while ((windows = gtk_application_get_windows (GTK_APPLICATION (app)))) { gtk_application_remove_window (GTK_APPLICATION (app), GTK_WINDOW (windows->data)); } } static GActionEntry app_entries[] = { /* general action */ { "new-window", gy_app_actions_new_window_cb, NULL, NULL, NULL}, { "prefs", gy_app_actions_preferences_cb, NULL, NULL, NULL }, { "about", gy_app_actions_about_cb, NULL, NULL, NULL}, { "quit", gy_app_actions_quit_cb, NULL, NULL, NULL }, }; void _gy_app_action_init (GyApp *self) { g_action_map_add_action_entries (G_ACTION_MAP (self), app_entries, G_N_ELEMENTS (app_entries), self); }
#define PARDIM 200 // size of all parameters array (par1 - Ag, ... , par100 - alpha, ...) #define NDIM 85 // search parameters for optimization in the first NDIM (Ag, ..., Xx only) #define NRANDPHASE 1000 // number of iterations for the random phase #define NMINPHASE 1000 // number of iterations for minimization cooling down #define POPULATION 80 // size of the population #define NBEST 10 // number of best minima survive after the random phase #define SURVIVE 40 // number of elemenets go to the next round #define INVT 3. // cooling parameter // access to initial conditions (read already by MINUIT) extern struct init_name { char CPNAM[PARDIM][10]; } mn7nam_; extern struct init_coord { double U[PARDIM]; double ALIM[PARDIM]; double BLIM[PARDIM]; } mn7ext_; extern struct npar { int maxint; int NPAR; int maxext; int nu; } mn7npr_; extern struct debug { bool lprint; } doprint_; // description of a single point typedef struct Creature { double* position; int age; double chi2; } Creature; // the zoo operations inline void swap(int i, int j); inline int partition(int left, int right, int pivot); inline void qsort(int left, int right); // pointer to the chi2 calculator typedef double (*Fcn)(int*, double*, double*, double*, int*, int*); Fcn fcn; // c++ functions void genetic_search(Fcn fcn_in); void ini_zoo(); void eliminate(); void generate_new_creature(int position); void generate_offspring(int parent, int child, int generation); void print_candidate_parameters(int ipoint, int icand); double call_fcn(double* pars, int iflag = 4); void run_std_fcn(); void copy_file(const char* filename, const char* dirname); // wrapper to make the main search function callable from FORTRAN // the construction here seems to be fragile // fix it if possible extern "C" { void genetic_search_(Fcn fcn_in) { return genetic_search(fcn_in); }; } // make singleton to keep all the global info // let it be class to allow further development possible class Zoo { public: static Zoo* Instance(); static Creature* creatures[POPULATION]; static Creature* best_random[NBEST]; // number of non-zero members in mn7npr_.U[] static int NOptPars; // array of pointers to non-zero members in mn7npr_.U[] static int OptParPointers[NDIM]; // up and down limits for the parameters variations static double down_bound[NDIM]; static double up_bound[NDIM]; static double delta_bound[NDIM]; // names of the parameters static char par_names[NDIM][13]; private: // constructors are here to prohibit calls from outside Zoo() {}; Zoo(Zoo const&) {}; Zoo& operator=(Zoo const&) {return *this;}; static Zoo* pInstance; }; Creature* Zoo::creatures[POPULATION]; Creature* Zoo::best_random[NBEST]; int Zoo::NOptPars; int Zoo::OptParPointers[NDIM]; double Zoo::down_bound[NDIM]; double Zoo::up_bound[NDIM]; double Zoo::delta_bound[NDIM]; char Zoo::par_names[NDIM][13]; Zoo* Zoo::pInstance = NULL;
#ifndef KEEPASSUNLOCKDIALOG_H #define KEEPASSUNLOCKDIALOG_H #include <QDialog> class Database; class QLineEdit; class QPushButton; class QLabel; class QFile; class QCheckBox; class KeePassUnlockDialog : public QDialog { Q_OBJECT Database *m_keePassDatabase; QCheckBox *m_passwordCheckBox; QLineEdit *m_passwordEdit; QCheckBox *m_keyFileCheckBox; QLineEdit *m_keyPathEdit; QPushButton *m_keyPathBrowse; QLabel *m_warnLabel; QFile *m_databaseFile; public: KeePassUnlockDialog(QFile *file, QWidget *parent); Database *database() { return m_keePassDatabase; } public slots: void okayPressed(); void cancelPressed(); void keyPathBrowse(); void passwordTextEdited(); void keyFileTextEdited(); void passwordCheckBoxToggled(bool); void keyFileCheckBoxToggled(bool); }; #endif // KEEPASSUNLOCKDIALOG_H
/* * Copyright 2016 Takashi Inoue * * This file is part of EzPuzzles. * * EzPuzzles 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. * * EzPuzzles 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 EzPuzzles. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QSharedPointer> #include "ThreadFrameTimer.h" namespace Ui { class MainWindow; } class IGame; class SourceImage; class ThreadFrameTimer; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow() override; protected: void closeEvent(QCloseEvent *event) override; private slots: void on_actionFinalImage_triggered(bool checked); void on_actionNewGame_triggered(); void on_actionRestart_triggered(); void on_actionSaveLoad_triggered(); void saveGame(); void loadGame(); void onTickFrameTimer(QReadWriteLock *lock, QWaitCondition *wait); void updateTitle(QString); private: static constexpr char m_geometryKey[] = "MainWindow_Geometry"; static constexpr char m_windowStateKey[] = "MainWindow_WindowState"; void updateImageHistory(const QString &lastImagePath) const; void startNewGame(QSharedPointer<IGame> newGame); Ui::MainWindow *ui; ThreadFrameTimer *m_threadFrameTimer; QSharedPointer<IGame> m_game; bool m_isFinalImageShownFromUser = true; }; #endif // MAINWINDOW_H
#ifndef ORIENTATION_WIDGET_GUI_H #define ORIENTATION_WIDGET_GUI_H #include <QMainWindow> #include "ui_OrientationWidgetGUI.h" class vtkRenderer; class vtkEventQtSlotConnect; class vtkObject; class vtkCommand; class vtkMatrix4x4; #include <vtkSmartPointer.h> class OrientationGraphicRenderer; #include "ReorientProps.h" class OrientationWidgetGUI : public QMainWindow, public Ui::MainWindow { SmartPtr< OrientationGraphicRenderer > m_pRAIRenderer; ReorientProps m_ReorientProps; Q_OBJECT public: OrientationWidgetGUI(); ~OrientationWidgetGUI(); vtkSmartPointer < vtkMatrix4x4 > getMtrx4x4GUI(); public slots: void slotReorient(int anDummyRow, int anDummyCol); void slotPhiThetaPsi(double adbValue); void slotSelectNegativeOrientation(bool abInterpretNegativeOrientation3x3); }; #endif //ORIENTATION_WIDGET_GUI_H
/* Mume Reader - a full featured reading environment. * * Copyright © 2012 Soft Flag, Inc. * * 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/>. */ #include "mume-base.h" #include "test-util.h" /************************* myplugin.h *************************/ mume_public const void* myplugin_class(void); mume_public int myplugin_count(const void *self); /************************* point.c *************************/ struct _myplugin { const char _[MUME_SIZEOF_PLUGIN]; void *pcontext; char *name; int count; }; #define _myplugin_super_class mume_plugin_class void *_myplugin_class; static void* _myplugin_ctor( struct _myplugin *self, int mode, va_list *app) { if (!_mume_ctor(_myplugin_super_class(), self, mode, app)) return NULL; self->pcontext = va_arg(*app, void*); self->name = NULL; self->count = 0; return self; } static void* _myplugin_dtor(struct _myplugin *self) { free(self->name); return _mume_dtor(_myplugin_super_class(), self); } static int _myplugin_start(void *_self) { struct _myplugin *self = _self; ++self->count; mume_plugin_define_symbol( self, "defined_count", (void*)(intptr_t)myplugin_count); return _mume_plugin_start(_myplugin_super_class(), self); } static void _myplugin_stop(void *_self) { struct _myplugin *self = _self; --self->count; _mume_plugin_stop(_myplugin_super_class(), self); } const void* myplugin_class(void) { return _myplugin_class ? _myplugin_class : mume_setup_class( &_myplugin_class, mume_plugin_meta_class(), "myplugin", _myplugin_super_class(), sizeof(struct _myplugin), MUME_PROP_END, _mume_ctor, _myplugin_ctor, _mume_dtor, _myplugin_dtor, _mume_plugin_start, _myplugin_start, _mume_plugin_stop, _myplugin_stop, MUME_FUNC_END); } int myplugin_count(const void *_self) { const struct _myplugin *self = _self; return self->count; } /************************* test *************************/ void all_tests(void) { const char *myid = "myplugin"; const mume_plugin_info_t *pi; mume_plugin_info_t info = { "myplugin", "demo plugin", "1.0", "Tom", NULL, NULL, "myplugin_class" }; void *pcontext = mume_pcontext_new(); int (*count1)(const void*); int (*count2)(const void*); info.runtime_lib = test_name; /* Plugin state. */ test_assert(MUME_PLUGIN_UNINSTALLED == mume_pcontext_get_plugin_state(pcontext, myid)); test_assert(mume_pcontext_install_plugin(pcontext, &info)); test_assert(!mume_pcontext_install_plugin(pcontext, &info)); pi = mume_pcontext_get_plugin_info(pcontext, myid); test_assert(pi && pi != &info); test_assert(pi->identifier != info.identifier && pi->name != info.name && pi->version != info.version && pi->provider_name != info.provider_name && pi->plugin_path == info.plugin_path && pi->runtime_lib != info.runtime_lib && pi->runtime_symbol != info.runtime_symbol); test_assert(0 == strcmp(pi->identifier, info.identifier)); test_assert(0 == strcmp(pi->name, info.name)); test_assert(0 == strcmp(pi->version, info.version)); test_assert(0 == strcmp(pi->provider_name, info.provider_name)); test_assert(0 == strcmp(pi->runtime_lib, info.runtime_lib)); test_assert(0 == strcmp(pi->runtime_symbol, info.runtime_symbol)); test_assert(MUME_PLUGIN_INSTALLED == mume_pcontext_get_plugin_state(pcontext, myid)); test_assert(mume_pcontext_start_plugin(pcontext, myid)); test_assert(MUME_PLUGIN_ACTIVE == mume_pcontext_get_plugin_state(pcontext, myid)); mume_pcontext_stop_plugin(pcontext, myid); test_assert(MUME_PLUGIN_RESOLVED == mume_pcontext_get_plugin_state(pcontext, myid)); mume_pcontext_uninstall_plugin(pcontext, myid); test_assert(MUME_PLUGIN_UNINSTALLED == mume_pcontext_get_plugin_state(pcontext, myid)); /* Resolve symbols. */ test_assert(mume_pcontext_resolve_symbol( pcontext, myid, "myplugin_count") == NULL); test_assert(mume_pcontext_resolve_symbol( pcontext, myid, "defined_count") == NULL); test_assert(mume_pcontext_install_plugin(pcontext, &info)); count1 = (int(*)(const void*))(intptr_t)mume_pcontext_resolve_symbol( pcontext, myid, "myplugin_count"); test_assert(count1); count2 = (int(*)(const void*))(intptr_t)mume_pcontext_resolve_symbol( pcontext, myid, "defined_count"); test_assert(count2); test_assert(MUME_PLUGIN_ACTIVE == mume_pcontext_get_plugin_state(pcontext, myid)); mume_pcontext_stop_plugins(pcontext); mume_pcontext_uninstall_plugins(pcontext); test_assert(mume_pcontext_resolve_symbol( pcontext, myid, "myplugin_count") == NULL); test_assert(mume_pcontext_resolve_symbol( pcontext, myid, "defined_count") == NULL); test_assert(MUME_PLUGIN_UNINSTALLED == mume_pcontext_get_plugin_state(pcontext, myid)); mume_delete(pcontext); }
#include "../../src/animation/frontend/qclipblendvalue.h"
/* This file is part of Clementine. Copyright 2010, David Sansome <me@davidsansome.com> Copyright 2020, Jim Broadus <jbroadus@gmail.com> Clementine 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. Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBPLAYLISTITEM_H #define DBPLAYLISTITEM_H #include "core/song.h" #include "playlist/playlistitem.h" class DbPlaylistItem : public PlaylistItem { public: DbPlaylistItem(const QString& type); DbPlaylistItem(const QString& type, const Song& song); Song Metadata() const; void SetMetadata(const Song& song) { song_ = song; } QUrl Url() const; protected: QVariant DatabaseValue(DatabaseColumn column) const; protected: Song song_; }; #endif // DBPLAYLISTITEM_H
/* vec.h -- This file is part of Archimedes release 1.2.0. Archimedes is a simulator for Submicron 2D III-V semiconductor Devices. It implements the Monte Carlo method for the simulation of the semiclassical Boltzmann equation for both electrons and holes. It includes some quantum effects by means of effective potential method. It is also able to simulate applied magnetic fields along with self consistent Faraday equation. Copyright (C) 2004-2011 Jean Michel Sellier <jeanmichel.sellier@gmail.com> <jsellier@purdue.edu> 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, 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/>. */ #ifndef ARCHIMEDES_VEC_H #define ARCHIMEDES_VEC_H // struct to hold real xy data typedef struct Vec2 { double x; double y; } Vec2; // struct to hold real xyz data typedef struct Vec3 { double x; double y; double z; } Vec3; // struct to hold node index data typedef struct Index { int i; int j; } Index; // struct to hold size information typedef struct Dimensions { double width; double height; } Dimensions; #endif
/* * arch/um/kernel/elf_aux.c * * Scan the Elf auxiliary vector provided by the host to extract * information about vsyscall-page, etc. * * Copyright (C) 2004 Fujitsu Siemens Computers GmbH * Author: Bodo Stroesser (bodo.stroesser@fujitsu-siemens.com) */ #include <elf.h> #include <stddef.h> #include <init.h> #include <elf_user.h> #include <mem_user.h> typedef Elf32_auxv_t elf_auxv_t; /* These are initialized very early in boot and never changed */ char *elf_aux_platform; extern long elf_aux_hwcap; unsigned long vsyscall_ehdr; unsigned long vsyscall_end; unsigned long __kernel_vsyscall; __init void scan_elf_aux( char **envp) { long page_size = 0; elf_auxv_t *auxv; while ( *envp++ != NULL) ; for ( auxv = (elf_auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) { switch ( auxv->a_type ) { case AT_SYSINFO: __kernel_vsyscall = auxv->a_un.a_val; /* See if the page is under TASK_SIZE */ if (__kernel_vsyscall < (unsigned long) envp) { __kernel_vsyscall = 0; } break; case AT_SYSINFO_EHDR: vsyscall_ehdr = auxv->a_un.a_val; /* See if the page is under TASK_SIZE */ if (vsyscall_ehdr < (unsigned long) envp) { vsyscall_ehdr = 0; } break; case AT_HWCAP: elf_aux_hwcap = auxv->a_un.a_val; break; case AT_PLATFORM: /* elf.h removed the pointer elements from * a_un, so we have to use a_val, which is * all that's left. */ elf_aux_platform = (char *) (long) auxv->a_un.a_val; break; case AT_PAGESZ: page_size = auxv->a_un.a_val; break; } } if ( ! __kernel_vsyscall || ! vsyscall_ehdr || ! elf_aux_hwcap || ! elf_aux_platform || ! page_size || (vsyscall_ehdr % page_size) ) { __kernel_vsyscall = 0; vsyscall_ehdr = 0; elf_aux_hwcap = 0; elf_aux_platform = "i586"; } else { vsyscall_end = vsyscall_ehdr + page_size; } }
/* * Copyright (C) 2011-2013 Project SkyFire <http://www.projectskyfire.org/> * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2013 MaNGOS <http://getmangos.com/> * * 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/>. */ #ifndef SKYFIRE_WORLDPACKET_H #define SKYFIRE_WORLDPACKET_H #include "Common.h" #include "ByteBuffer.h" class WorldPacket : public ByteBuffer { public: // just container for later use WorldPacket() : ByteBuffer(0), m_opcode(0) { } explicit WorldPacket(uint32 opcode, size_t res = 200) : ByteBuffer(res), m_opcode(opcode) { } // copy constructor WorldPacket(const WorldPacket &packet) : ByteBuffer(packet), m_opcode(packet.m_opcode) { } void Initialize(uint32 opcode, size_t newres = 200) { clear(); _storage.reserve(newres); m_opcode = opcode; } uint32 GetOpcode() const { return m_opcode; } void SetOpcode(uint32 opcode) { m_opcode = opcode; } void compress(uint32 opcode); protected: uint32 m_opcode; void _compress(void* dst, uint32 *dst_size, const void* src, int src_size); }; #endif
#ifndef __VGTERRITORY_TIOREQUESTELEVATION_H__ #define __VGTERRITORY_TIOREQUESTELEVATION_H__ #include <vgTerritory/vgtDefinition.h> #include <vgKernel/vgkForward.h> #include <vgAsyn/vgaIoRequest.h> #include <vgTerritory/vgtElevationManager.h> namespace vgTerritory { /** @date 2008/09/08 9:24 @author leven @brief µÃµ½¸ß³ÌµÄioÇëÇó.×¢Òâ!±ØÐëΪͬ²½Ä£Ê½. ¹¹Ô캯ÊýÖÐÒѾ­É趨ÁËͬ²½Ä£Ê½. @see */ class VGT_EXPORT IoRequestElevation : public vgAsyn::IoRequest { public: IoRequestElevation( Elevation* elev ); virtual ~IoRequestElevation() { } virtual bool anotherThreadHandler(); virtual bool mainThreadHandler(); virtual bool isReallyNeedToSend(); private: int _lod; String _elevItemName; Elevation* _oldElev; }; }// end of namespace vgTerritory #endif // end of __VGTERRITORY_TIOREQUESTELEVATION_H__
#ifndef HASH_HEADER #define HASH_HEADER #define SYMBOL_LITINT 1 //isso ta aqui pq o do johann ta assim #define SYMBOL_ID 2 //acho que tem que tirar isso pq vai ser usado os definidos no parser.y #define SYMBOL_VAR 3 #define SYMBOL_VEC 4 #define SYMBOL_FUNC 5 #define DATATYPE_BYTE 1 #define DATATYPE_SHORT 2 #define DATATYPE_LONG 3 #define DATATYPE_FLOAT 4 #define DATATYPE_DOUBLE 5 #define SYMBOL_LST_INT 2 #define HASH_SIZE 997 typedef struct hash_node { char *text; int type; int datatype; int line; struct hash_node *next; } HASH_NODE; HASH_NODE *table[HASH_SIZE]; void hashInit(); void hashPrint(); int hashAddress(char *text); HASH_NODE *hashInsert (char *text, int type); HASH_NODE *hashFind (char *text); void initMe(); int getLineNumber(); int isRunning(); #endif
#include "unpipc.h" volatile sig_atomic_t caught_sigchld; void sig_chld(int signo) { caught_sigchld = 1; return; /* just interrupt door_call() */ } int main(int argc, char **argv) { int fd, rc; long ival, oval; door_arg_t arg; if (argc != 3) err_quit("usage: clientintr3 <server-pathname> <integer-value>"); fd = Open(argv[1], O_RDWR); /* open the door */ /* 4set up the arguments and pointer to result */ ival = atol(argv[2]); arg.data_ptr = (char *) &ival; /* data arguments */ arg.data_size = sizeof(long); /* size of data arguments */ arg.desc_ptr = NULL; arg.desc_num = 0; arg.rbuf = (char *) &oval; /* data results */ arg.rsize = sizeof(long); /* size of data results */ Signal(SIGCHLD, sig_chld); if (Fork() == 0) { sleep(2); /* child */ exit(0); /* generates SIGCHLD */ } /* 4parent: call server procedure and print result */ for ( ; ; ) { printf("calling door_call\n"); if ( (rc = door_call(fd, &arg)) == 0) break; /* success */ if (errno == EINTR && caught_sigchld) { caught_sigchld = 0; continue; /* call door_call() again */ } err_sys("door_call error"); } printf("result: %ld\n", oval); exit(0); }
/************************************************************************ ** ** @file vfilepropertyeditor.h ** @author hedgeware <internal(at)hedgeware.net> ** @date ** ** @brief ** @copyright ** All rights reserved. This program and the accompanying materials ** are made available under the terms of the GNU Lesser General Public License ** (LGPL) version 2.1 which accompanies this distribution, and is available at ** http://www.gnu.org/licenses/lgpl-2.1.html ** ** 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 VFILEPROPERTYEDITOR_H #define VFILEPROPERTYEDITOR_H #include "../vpropertyexplorer_global.h" #include <QWidget> #include <QToolButton> #include <QLineEdit> #include <QMimeData> namespace VPE { class VPROPERTYEXPLORERSHARED_EXPORT VFileEditWidget : public QWidget { Q_OBJECT public: VFileEditWidget(QWidget* parent, bool is_directory = false); virtual ~VFileEditWidget(); //! This function returns the file currently set to this editor QString getFile() const; //! Needed for proper event handling bool eventFilter(QObject* obj, QEvent* ev); //! Returns the directory/file setting //! \return True, if a directory dialog is being shown, false if a file dialog bool isDirectory(); signals: //! This signal is emitted when the user changed the curret file. //! Actions triggering this signal are either using the file dialog //! to select a new file or changing the file path in the line edit. void dataChangedByUser(const QString &getFile, VFileEditWidget* editor); //! This signal is emitted whenever dataChangedByUser() gets emmitted //! and is connected to the delegate's commitData() signal void commitData(QWidget* editor); public slots: //! Sets the current file, does not check if it is valid //! \param getFile The new filepath the widget should show //! \param emit_signal If true, this will emit the dataChangedByUser()-signal (if file differs from the current //! file) void setFile(const QString &getFile, bool emit_signal = false); //! Sets a filter for the file field //! \param dialog_filter The filter used for the File Dialog //! \param filter_list The list of file endings. The filters are being checked using regular expressions void setFilter(const QString& dialog_filter = QString(), const QStringList& filter_list = QStringList()); //! Sets whether the property stores a directory or a file void setDirectory(bool dir); private slots: //! This slot gets activated, when the "..." button gets clicked void onToolButtonClicked(); protected: void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent* event); void dragLeaveEvent(QDragLeaveEvent* event); void dropEvent(QDropEvent* event); //! This function checks the mime data, if it is compatible with the filters virtual bool checkMimeData(const QMimeData* data, QString& getFile) const; //! This checks, if a file is compatible with the filters virtual bool checkFileFilter(const QString& getFile) const; QString CurrentFilePath; QToolButton* ToolButton; QLineEdit* FileLineEdit; QString FileDialogFilter; QStringList FilterList; //! Specifies whether it is being looked for a directory (true) or a file (false, default) bool Directory; private: Q_DISABLE_COPY(VFileEditWidget) }; } #endif // VFILEPROPERTYEDITOR_H
#ifndef __LOGGING_H__ #define __LOGGING_H__ #include "config.h" #include <stdbool.h> #include <stdarg.h> #ifdef HAVE_SYSLOG_H #include <syslog.h> #else enum { LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, }; #endif /* debug flags */ extern bool opt_debug; extern bool opt_log_output; extern bool opt_realquiet; extern bool want_per_device_stats; /* global log_level, messages with lower or equal prio are logged */ extern int opt_log_level; extern int opt_log_show_date; #define LOGBUFSIZ 256 void applog(int prio, const char* fmt, ...); extern void _applog(int prio, const char *str, bool force); #define IN_FMT_FFL " in %s %s():%d" #define applogsiz(prio, _SIZ, fmt, ...) do { \ if (opt_debug || prio != LOG_DEBUG) { \ if (use_syslog || opt_log_output || prio <= opt_log_level) { \ char tmp42[_SIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ _applog(prio, tmp42, false); \ } \ } \ } while (0) #define forcelog(prio, fmt, ...) do { \ if (opt_debug || prio != LOG_DEBUG) { \ if (use_syslog || opt_log_output || prio <= opt_log_level) { \ char tmp42[LOGBUFSIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ _applog(prio, tmp42, true); \ } \ } \ } while (0) #define quit(status, fmt, ...) do { \ if (fmt) { \ char tmp42[LOGBUFSIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ _applog(LOG_ERR, tmp42, true); \ } \ _quit(status); \ } while (0) #define quithere(status, fmt, ...) do { \ if (fmt) { \ char tmp42[LOGBUFSIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt IN_FMT_FFL, \ ##__VA_ARGS__, __FILE__, __func__, __LINE__); \ _applog(LOG_ERR, tmp42, true); \ } \ _quit(status); \ } while (0) #define quitfrom(status, _file, _func, _line, fmt, ...) do { \ if (fmt) { \ char tmp42[LOGBUFSIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt IN_FMT_FFL, \ ##__VA_ARGS__, _file, _func, _line); \ _applog(LOG_ERR, tmp42, true); \ } \ _quit(status); \ } while (0) #ifdef HAVE_CURSES #define wlog(fmt, ...) do { \ char tmp42[LOGBUFSIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ _wlog(tmp42); \ } while (0) #define wlogprint(fmt, ...) do { \ char tmp42[LOGBUFSIZ]; \ snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ _wlogprint(tmp42); \ } while (0) #endif #endif /* __LOGGING_H__ */
#ifndef EL__BFU_TEXT_H #define EL__BFU_TEXT_H #include "util/color.h" struct dialog; struct terminal; struct widget_info_text { enum format_align align; unsigned int is_label:1; unsigned int is_scrollable:1; }; struct widget_data_info_text { /* The number of the first line that should be * displayed within the widget. * This is used only for scrollable text widgets */ int current; /* The number of lines saved in @cdata */ int lines; /* The dialog width to which the lines are wrapped. * This is used to check whether the lines must be * rewrapped. */ int max_width; #ifdef CONFIG_MOUSE /* For mouse scrollbar handling. See bfu/text.c.*/ /* Height of selected part of scrollbar. */ int scroller_height; /* Position of selected part of scrollbar. */ int scroller_y; /* Direction of last mouse scroll. Used to adjust * scrolling when selected bar part has a low height * (especially the 1 char height) */ int scroller_last_dir; #endif }; void add_dlg_text(struct dialog *dlg, unsigned char *text, enum format_align align, int bottom_pad); extern const struct widget_ops text_ops; void dlg_format_text_do(struct terminal *term, unsigned char *text, int x, int *y, int w, int *rw, struct color_pair *scolor, enum format_align align, int format_only); void dlg_format_text(struct terminal *term, struct widget_data *widget_data, int x, int *y, int dlg_width, int *real_width, int height, int format_only); #define text_is_scrollable(widget_data) \ ((widget_data)->widget->info.text.is_scrollable \ && (widget_data)->box.height > 0 \ && (widget_data)->info.text.lines > 0 \ && (widget_data)->box.height < (widget_data)->info.text.lines) #endif
/* engine.h GNU Chess protocol adapter Copyright (C) 2001-2011 Free Software Foundation, Inc. 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/>. */ // engine.h #ifndef ENGINE_H #define ENGINE_H // includes #include "io.h" #include "util.h" namespace adapter { // types struct engine_t { io_t io[1]; }; // variables extern engine_t Engine[1]; // functions extern bool engine_is_ok (const engine_t * engine); extern void engine_open (engine_t * engine); extern void engine_close (engine_t * engine); extern void engine_get (engine_t * engine, char string[], int size); extern void engine_send (engine_t * engine, const char format[], ...); extern void engine_send_queue (engine_t * engine, const char format[], ...); } // namespace adapter #endif // !defined ENGINE_H // end of engine.h
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo * This benchmark is part of SWSC */ #include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[4]; atomic_int atom_0_r1_1; atomic_int atom_1_r1_1; void *t0(void *arg){ label_1:; int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v3_r3 = v2_r1 ^ v2_r1; int v4_r3 = v3_r3 + 1; atomic_store_explicit(&vars[1], v4_r3, memory_order_seq_cst); int v20 = (v2_r1 == 1); atomic_store_explicit(&atom_0_r1_1, v20, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; int v6_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v7_r3 = v6_r1 ^ v6_r1; int v8_r3 = v7_r3 + 1; atomic_store_explicit(&vars[2], v8_r3, memory_order_seq_cst); int v10_r5 = atomic_load_explicit(&vars[2], memory_order_seq_cst); int v12_r6 = atomic_load_explicit(&vars[2], memory_order_seq_cst); int v13_r7 = v12_r6 ^ v12_r6; int v16_r8 = atomic_load_explicit(&vars[3+v13_r7], memory_order_seq_cst); atomic_store_explicit(&vars[3], 1, memory_order_seq_cst); atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); int v21 = (v6_r1 == 1); atomic_store_explicit(&atom_1_r1_1, v21, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; atomic_init(&vars[2], 0); atomic_init(&vars[1], 0); atomic_init(&vars[0], 0); atomic_init(&vars[3], 0); atomic_init(&atom_0_r1_1, 0); atomic_init(&atom_1_r1_1, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v17 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst); int v18 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst); int v19_conj = v17 & v18; if (v19_conj == 1) assert(0); return 0; }
#pragma once #include "../qtplus_global.h" //------------------------------------------------------------------------------------------------- // Qt #include <QObject> // Application #include "QMLEntity.h" //------------------------------------------------------------------------------------------------- // Forward declarations class QMLTreeContext; //------------------------------------------------------------------------------------------------- //! Defines a file import statement class QTPLUSSHARED_EXPORT QMLImport : public QMLEntity { Q_OBJECT public: //------------------------------------------------------------------------------------------------- // Constructors and destructor //------------------------------------------------------------------------------------------------- //! Constructor with name and content QMLImport(const QPoint& pPosition, QMLTreeContext* pContext, QMLEntity* pName, QMLEntity* pVersion = nullptr, QMLEntity* pAs = nullptr); //! Destructor virtual ~QMLImport(); //------------------------------------------------------------------------------------------------- // Setters //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- // Getters //------------------------------------------------------------------------------------------------- //! QMLEntity* name() const; //! QMLEntity* version() const; //! QMLEntity* as() const; //! Returns all members virtual QMap<QString, QMLEntity*> members() Q_DECL_OVERRIDE; //------------------------------------------------------------------------------------------------- // Overridden methods //------------------------------------------------------------------------------------------------- //! virtual void toQML(QTextStream& stream, QMLFormatter& formatter, const QMLEntity* pParent = nullptr) const Q_DECL_OVERRIDE; //! virtual CXMLNode toXMLNode(CXMLNodableContext* pContext, CXMLNodable* pParent) Q_DECL_OVERRIDE; //------------------------------------------------------------------------------------------------- // Properties //------------------------------------------------------------------------------------------------- protected: QMLEntity* m_pName; QMLEntity* m_pVersion; QMLEntity* m_pAs; };
/* avr_spi.h Copyright 2008, 2009 Michel Pollet <buserror@gmail.com> This file is part of simavr. simavr 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. simavr 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 simavr. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AVR_SPI_H_ #define AVR_SPI_H_ #include "sim_avr.h" enum { SPI_IRQ_INPUT = 0, SPI_IRQ_OUTPUT, SPI_IRQ_COUNT }; // add port number to get the real IRQ #define AVR_IOCTL_SPI_GETIRQ(_name) AVR_IOCTL_DEF('s','p','i',(_name)) typedef struct avr_spi_t { avr_io_t io; char name; avr_regbit_t disabled; // bit in the PRR avr_io_addr_t r_spdr; // data register avr_io_addr_t r_spcr; // control register avr_io_addr_t r_spsr; // status register avr_regbit_t spe; // spi enable avr_regbit_t mstr; // master/slave avr_regbit_t spr[4]; // clock divider avr_int_vector_t spi; // spi interrupt uint8_t input_data_register; } avr_spi_t; void avr_spi_init(avr_t * avr, avr_spi_t * port); #endif /* AVR_SPI_H_ */
/*---------------------------------------------------------------------------- Copyright: Radig Ulrich mailto: mail@ulrichradig.de Author: Radig Ulrich Remarks: known Problems: none Version: 02.12.2007 Description: empfangene UDP Daten auf Port 345 werden auf dem LCD ausgegeben Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder späteren Version. Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License. Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef _UDPLCDCLIENT_H #define _UDPLCDCLIENT_H #define UDP_LCD_DEBUG usart_write //#define UDP_LCD_DEBUG(...) #include <avr/io.h> #include <avr/pgmspace.h> #include "stack.h" #include "usart.h" #include "timer.h" #include "lcd.h" #define UDP_LCD_PORT 345 void udp_lcd_init(void); void udp_lcd_get(unsigned char); #endif
#ifndef PARSER_H #define PARSER_H #define MAX_VAR_NAME_LEN 32 #include "utils.h" /*#include <sys/mman.h> #include <unistd.h> */ typedef struct { const char *classname; const char *super; } ClassDef; typedef struct { const char *path, *mode; FILE *stream; int linenum, lineoffset; } File; #include "fsm.h" ClassDef get_class_def(File *f); void init_file(File *f, const char *path, const char *mode); bool is_valid_classname(char *name); #endif /* ifndef PARSER_H */
/* * Copyright 2013-2016 Freescale Semiconductor Inc. * * 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 the above-listed copyright holders nor the * names of any contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * * ALTERNATIVELY, this software may be distributed under the terms of the * GNU General Public License ("GPL") as published by the Free Software * Foundation, either version 2 of that License or (at your option) any * later version. * * 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 HOLDERS 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. */ /* * dpmng-cmd.h * * defines portal commands * */ #ifndef __FSL_DPMNG_CMD_H #define __FSL_DPMNG_CMD_H /* Command IDs */ #define DPMNG_CMDID_GET_CONT_ID 0x830 #define DPMNG_CMDID_GET_VERSION 0x831 struct dpmng_rsp_get_container_id { __le32 container_id; }; struct dpmng_rsp_get_version { __le32 revision; __le32 version_major; __le32 version_minor; }; #endif /* __FSL_DPMNG_CMD_H */
/* This file is part of Desperion. Copyright 2010, 2011 LittleScaraby, Nekkro Desperion 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. Desperion 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 Desperion. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OBJECT_ITEM_QUANTITY__ #define __OBJECT_ITEM_QUANTITY__ class ObjectItemQuantity : public DItem { public: int objectUID; int quantity; uint16 GetProtocol() const { return OBJECT_ITEM_QUANTITY; } ObjectItemQuantity() { } ObjectItemQuantity(int objectUID, int quantity) : DItem(), objectUID(objectUID), quantity(quantity) { } void Serialize(ByteBuffer& data) const { DItem::Serialize(data); data<<objectUID<<quantity; } void Deserialize(ByteBuffer& data) { DItem::Deserialize(data); data>>objectUID>>quantity; } }; typedef boost::shared_ptr<ObjectItemQuantity> ObjectItemQuantityPtr; #endif
/* * Copyright (c) 2009 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #if !KERNEL #include <stdlib.h> /* This demangler is part of the C++ ABI. We don't include it directly from * <cxxabi.h> so that we can avoid using C++ in the kernel linker. */ extern char * __cxa_demangle(const char* __mangled_name, char* __output_buffer, size_t* __length, int* __status); #endif /* !KERNEL */ #include "kxld_demangle.h" /******************************************************************************* *******************************************************************************/ const char * kxld_demangle(const char *str, char **buffer __unused, size_t *length __unused) { #if KERNEL return str; #else const char *rval = NULL; char *demangled = NULL; int status; if (!str) goto finish; rval = str; if (!buffer || !length) goto finish; /* Symbol names in the symbol table have an extra '_' prepended to them, * so we skip the first character to make the demangler happy. */ demangled = __cxa_demangle(str+1, *buffer, length, &status); if (!demangled || status) goto finish; *buffer = demangled; rval = demangled; finish: return rval; #endif }
/***************************************************************************** This file is part of QSS Solver. QSS Solver 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. QSS Solver 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 QSS Solver. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ #ifndef COMBOBOXDELEGATE_H_ #define CODEEDITOR_H_ #include <QItemDelegate> /** * */ class ComboBoxDelegate : public QItemDelegate { Q_OBJECT public: /** * * @param parent */ ComboBoxDelegate(QObject *parent = 0); /** * * @param parent * @param option * @param index * @return */ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; /** * * @param editor * @param index */ void setEditorData(QWidget *editor, const QModelIndex &index) const; /** * * @param editor * @param model * @param index */ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; /** * * @param editor * @param option * @param index */ void updateEditorGeometry(QWidget *editor, /** * */ const QStyleOptionViewItem &option, const QModelIndex &index) const; }; #endif /* CODEEDITOR_H_ */
#ifndef Lensing2_Lens_h #define Lensing2_Lens_h #include <ostream> #include "DNest4/code/RNG.h" namespace Lensing2 { class Lens { protected: public: virtual ~Lens() { } // Deflection angle formula virtual void alpha(double x, double y, double& ax, double& ay, bool update=false) = 0; // MCMC related stuff virtual void from_prior(DNest4::RNG& rng) = 0; virtual double perturb(DNest4::RNG& rng) = 0; virtual void print(std::ostream& out) const = 0; }; } // namespace Lensing2 #endif
// Permission to copy is granted provided that this header remains intact. // This software is provided with no warranties. //////////////////////////////////////////////////////////////////////////////// #ifndef TIMER_H #define TIMER_H #include <avr/interrupt.h> volatile unsigned char TimerFlag = 0; // TimerISR() sets this to 1. C programmer should clear to 0. // Internal variables for mapping AVR's ISR to our cleaner TimerISR model. unsigned long _avr_timer_M = 1; // Start count from here, down to 0. Default 1ms unsigned long _avr_timer_cntcurr = 0; // Current internal count of 1ms ticks // Set TimerISR() to tick every M ms void TimerSet(unsigned long M) { _avr_timer_M = M; _avr_timer_cntcurr = _avr_timer_M; } void TimerOn() { // AVR timer/counter controller register TCCR1 TCCR1B = 0x0B; // bit3 = 1: CTC mode (clear timer on compare) // bit2bit1bit0=011: prescaler /64 // 00001011: 0x0B // SO, 8 MHz clock or 8,000,000 /64 = 125,000 ticks/s // Thus, TCNT1 register will count at 125,000 ticks/s // AVR output compare register OCR1A. OCR1A = 125; // Timer interrupt will be generated when TCNT1==OCR1A // We want a 1 ms tick. 0.001 s * 125,000 ticks/s = 125 // So when TCNT1 register equals 125, // 1 ms has passed. Thus, we compare to 125. // AVR timer interrupt mask register TIMSK1 = 0x02; // bit1: OCIE1A -- enables compare match interrupt //Initialize avr counter TCNT1 = 0; // TimerISR will be called every _avr_timer_cntcurr milliseconds _avr_timer_cntcurr = _avr_timer_M; //Enable global interrupts SREG |= 0x80; // 0x80: 1000000 } void TimerOff() { TCCR1B = 0x00; // bit3bit2bit1bit0=0000: timer off } void TimerISR() { TimerFlag = 1; } // In our approach, the C programmer does not touch this ISR, but rather TimerISR() ISR(TIMER1_COMPA_vect) { // CPU automatically calls when TCNT0 == OCR0 (every 1 ms per TimerOn settings) _avr_timer_cntcurr--; // Count down to 0 rather than up to TOP if (_avr_timer_cntcurr == 0) { // results in a more efficient compare TimerISR(); // Call the ISR that the user uses _avr_timer_cntcurr = _avr_timer_M; } } #endif //TIMER_H
// // ProjectKetchup: // --------------- // // Copyright (c) 2008 Damien Chavarria // #ifndef BARVIEW_VECTOR_CONTROL_H #define BARVIEW_VECTOR_CONTROL_H #include "PKVectorControl.h" #include "PKChordLibraryDialog.h" // // Types // typedef enum { BAR_TYPE_SINGLE, BAR_TYPE_DOUBLE, BAR_TYPE_TRIPLE1, BAR_TYPE_TRIPLE2, BAR_TYPE_QUAD, } BarControlType; // // BarViewVectorControl // class BarViewVectorControl : public PKVectorControl { public: static std::string SELECTED_BOOL_PROPERTY; static std::string LINECOLOR_COLOR_PROPERTY; static std::string HOVERCOLOR_COLOR_PROPERTY; static std::string SELECTEDCOLOR_COLOR_PROPERTY; static std::string BARTYPE_UINT8_PROPERTY; static std::string REPEAT_LEFT_BOOL_PROPERTY; static std::string REPEAT_RIGHT_BOOL_PROPERTY; static std::string SECTION_MARKER_BOOL_PROPERTY; static std::string SECTION_NUMBER_UINT32_PROPERTY; static std::string HEADER_WSTRING_PROPERTY; public: BarViewVectorControl(); ~BarViewVectorControl(); // Setup void setChordNameForIndex(int32_t index, std::wstring name); void setChordLibraryStateForIndex(int32_t index, PKChordLibraryState *state); void setChordDiagramForIndex(int32_t index, PKChordDiagram *diagram); std::wstring getChordNameForIndex(int32_t index); PKChordLibraryState *getChordLibraryStateForIndex(int32_t index); PKChordDiagram *getChordDiagramForIndex(int32_t index); // PKVectorControl void drawVector(PKVectorEngine *engine, int32_t x, int32_t y); // PKCustomControl virtual void mouseDown(PKButtonType button, int x, int y, unsigned int mod); virtual void mouseUp(PKButtonType button, int x, int y, unsigned int mod); virtual void mouseMove(int x, int y, unsigned int mod); virtual void mouseLeave(); virtual void mouseDblClick(PKButtonType button, int x, int y, unsigned int mod); // PKObject virtual void selfPropertyChanged(PKProperty *prop, PKVariant *oldValue); private: bool hover; bool hit; bool x_hit; std::vector<PKChordDiagram *> diagrams; std::vector<std::wstring> chordNames; std::vector<PKChordLibraryState *> states; }; #endif // BARVIEW_VECTOR_CONTROL_H
#pragma once #include "stdafx.h" using namespace irr; using namespace gui; using namespace System; namespace IrrlichtLime { namespace GUI { /// <summary> /// Enumeration of available default skins. /// </summary> public enum class GUISkinType { /// <summary> /// Default windows look and feel. /// </summary> WindowsClassic = EGST_WINDOWS_CLASSIC, /// <summary> /// Like <see cref="WindowsClassic"/>, but with metallic shaded windows and buttons. /// </summary> WindowsMetallic = EGST_WINDOWS_METALLIC, /// <summary> /// Burning's skin. /// </summary> BurningSkin = EGST_BURNING_SKIN, /// <summary> /// An unknown skin, not serializable at present. /// </summary> Unknown = EGST_UNKNOWN }; } // end namespace GUI } // end namespace IrrlichtLime
/*************************************************************************************** * * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. * * By downloading, copying, installing or using the software you agree to this license. * If you do not agree to this license, do not download, install, * copy or use the software. * * Copyright (C) 2010-2014, Happytimesoft Corporation, all rights reserved. * * Redistribution and use in binary forms, with or without modification, are permitted. * * 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. * ****************************************************************************************/ #include "onvif/bm/sys_inc.h" #include "onvif/onvif/onvif.h" #include "onvif/onvif/onvif_cm.h" #include "onvif/onvif/onvif_analytics.h" #ifdef VIDEO_ANALYTICS /***************************************************************************************/ /** The possible return value ONVIF_ERR_NO_PROFILE ONVIF_ERR_NO_CONFIG */ ONVIF_RET onvif_AddVideoAnalyticsConfiguration(AddVideoAnalyticsConfiguration_REQ * p_req) { // todo : add video analytics configuration code ... int SdkResult = ONVIF_OK; SdkResult = my_onvif_AddVideoAnalyticsConfiguration(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_PROFILE */ ONVIF_RET onvif_RemoveVideoAnalyticsConfiguration(RemoveVideoAnalyticsConfiguration_REQ * p_req) { // todo : remove video analytics configuration code ... int SdkResult = ONVIF_OK; SdkResult = my_onvif_RemoveVideoAnalyticsConfiguration(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_CONFIG_MODIFY ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_SetVideoAnalyticsConfiguration(SetVideoAnalyticsConfiguration_REQ * p_req) { // todo : set video analytics configuration code ... int SdkResult = ONVIF_OK; SdkResult = my_onvif_SetVideoAnalyticsConfiguration(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG */ ONVIF_RET onvif_GetSupportedRules(GetSupportedRules_REQ * p_req, GetSupportedRules_RES * p_res) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_GetSupportedRules_ex(p_req,p_res); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_INVALID_RULE, ONVIF_ERR_RULE_ALREADY_EXIST ONVIF_ERR_TOO_MANY_RULES ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_CreateRules(CreateRules_REQ * p_req) { ONVIF_VACFG * p_va_cfg; ONVIF_CONFIG * p_config; if (NULL == p_req->Rule) { return ONVIF_ERR_INVALID_RULE; } int SdkResult = ONVIF_OK; SdkResult = my_onvif_CreateRules_ex(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_RULE_NOT_EXIST ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_DeleteRules(DeleteRules_REQ * p_req) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_DeleteRules_ex(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG */ ONVIF_RET onvif_GetRules(GetRules_REQ * p_req, GetRules_RES * p_res) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_GetRules_ex(p_req,p_res); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_INVALID_RULE, ONVIF_ERR_RULE_NOT_EXIST ONVIF_ERR_TOO_MANY_RULES ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_ModifyRules(ModifyRules_REQ * p_req) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_ModifyRules_ex(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_NAME_ALREADY_EXIST ONVIF_ERR_TOO_MANY_MODULES ONVIF_ERR_INVALID_MODULE ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_CreateAnalyticsModules(CreateAnalyticsModules_REQ * p_req) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_CreateAnalyticsModules(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_NAME_NOT_EXIST ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_DeleteAnalyticsModules(DeleteAnalyticsModules_REQ * p_req) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_DeleteAnalyticsModules(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG */ ONVIF_RET onvif_GetAnalyticsModules(GetAnalyticsModules_REQ * p_req, GetAnalyticsModules_RES * p_res) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_GetAnalyticsModules_ex(p_req,p_res); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } /** The possible return value ONVIF_ERR_NO_CONFIG ONVIF_ERR_NAME_NOT_EXIST ONVIF_ERR_TOO_MANY_MODULES ONVIF_ERR_INVALID_MODULE ONVIF_ERR_CONFIGURATION_CONFLICT */ ONVIF_RET onvif_ModifyAnalyticsModules(ModifyAnalyticsModules_REQ * p_req) { int SdkResult = ONVIF_OK; SdkResult = my_onvif_ModifyAnalyticsModules_ex(p_req); if(SdkResult != ONVIF_OK) { return SdkResult; } return ONVIF_OK; } #endif // end of VIDEO_ANALYTICS
/* -*- c++ -*- */ /* * Copyright 2004 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio 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, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_DAB_OFDM_SAMPLER_IMPL_H #define INCLUDED_DAB_OFDM_SAMPLER_IMPL_H #include <dab/ofdm_sampler.h> namespace gr { namespace dab { /*! * \brief cuts stream of DAB samples into symbol vectors * \ingroup DAB * \param fft_length length of the output vectors - number of samples per symbol without cyclic prefix * \param cp_length lengith of the cyclic prefix * \param symbols_per_frame number of symbols in a DAB frame, without Null symbol * \param gap If the gap is > 0, leave a gap at the end of the symbol, i.e. return some of the cyclic prefix instead of the end of the symbol * * input: port 0: complex - actual data; port 1: byte stream with trigger signal indicating the start of a frame * output: port 0: complex vectors - sampled data; port 1: byte stream with trigger signal indicating the start of a frame */ class ofdm_sampler_impl : public ofdm_sampler { private: enum state_t {STATE_NS, STATE_CP, STATE_SYM}; state_t d_state; unsigned int d_pos; // position inside OFDM symbol unsigned int d_fft_length; unsigned int d_cp_length; unsigned int d_symbols_per_frame; // total number of symbols in a DAB frame unsigned int d_sym_nr; // number of symbol inside DAB frame unsigned int d_gap; // gap from next symbol -> if gap>0: sample before end of frame unsigned int d_gap_left; // gap left to next symbol? public: ofdm_sampler_impl(unsigned int fft_length, unsigned int cp_length, unsigned int symbols_per_frame,unsigned int gap); void forecast (int noutput_items, gr_vector_int &ninput_items_required); int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; } } #endif /* INCLUDED_DAB_OFDM_SAMPLER_H */
/* * Copyright (C) 2014 The Android Open Source Project * * 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 ART_COMPILER_UTILS_DWARF_CFI_H_ #define ART_COMPILER_UTILS_DWARF_CFI_H_ #include <vector> namespace art { /** * @brief Enter a 'DW_CFA_advance_loc' into an FDE buffer * @param buf FDE buffer. * @param increment Amount by which to increase the current location. */ void DW_CFA_advance_loc(std::vector<uint8_t>* buf, uint32_t increment); /** * @brief Enter a 'DW_CFA_offset_extended_sf' into an FDE buffer * @param buf FDE buffer. * @param reg Register number. * @param offset Offset of register address from CFA. */ void DW_CFA_offset_extended_sf(std::vector<uint8_t>* buf, int reg, int32_t offset); /** * @brief Enter a 'DW_CFA_offset' into an FDE buffer * @param buf FDE buffer. * @param reg Register number. * @param offset Offset of register address from CFA. */ void DW_CFA_offset(std::vector<uint8_t>* buf, int reg, uint32_t offset); /** * @brief Enter a 'DW_CFA_def_cfa_offset' into an FDE buffer * @param buf FDE buffer. * @param offset New offset of CFA. */ void DW_CFA_def_cfa_offset(std::vector<uint8_t>* buf, int32_t offset); /** * @brief Enter a 'DW_CFA_remember_state' into an FDE buffer * @param buf FDE buffer. */ void DW_CFA_remember_state(std::vector<uint8_t>* buf); /** * @brief Enter a 'DW_CFA_restore_state' into an FDE buffer * @param buf FDE buffer. */ void DW_CFA_restore_state(std::vector<uint8_t>* buf); /** * @brief Write FDE header into an FDE buffer * @param buf FDE buffer. * @param is_64bit If FDE is for 64bit application. */ void WriteFDEHeader(std::vector<uint8_t>* buf, bool is_64bit); /** * @brief Set 'address_range' field of an FDE buffer * @param buf FDE buffer. * @param data Data value. * @param is_64bit If FDE is for 64bit application. */ void WriteFDEAddressRange(std::vector<uint8_t>* buf, uint64_t data, bool is_64bit); /** * @brief Set 'length' field of an FDE buffer * @param buf FDE buffer. * @param is_64bit If FDE is for 64bit application. */ void WriteCFILength(std::vector<uint8_t>* buf, bool is_64bit); /** * @brief Pad an FDE buffer with 0 until its size is a multiple of 4 * @param buf FDE buffer. */ void PadCFI(std::vector<uint8_t>* buf); } // namespace art #endif // ART_COMPILER_UTILS_DWARF_CFI_H_
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #ifndef _NGX_SHMTX_H_INCLUDED_ #define _NGX_SHMTX_H_INCLUDED_ #include <ngx_config.h> #include <ngx_core.h> typedef struct { ngx_atomic_t lock; #if (NGX_HAVE_POSIX_SEM) ngx_atomic_t wait; #endif } ngx_shmtx_sh_t; typedef struct { #if (NGX_HAVE_ATOMIC_OPS) ngx_atomic_t *lock; #if (NGX_HAVE_POSIX_SEM) ngx_atomic_t *wait; ngx_uint_t semaphore; sem_t sem; #endif #else ngx_fd_t fd; u_char *name; #endif ngx_uint_t spin; } ngx_shmtx_t; ngx_int_t ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr, u_char *name); void ngx_shmtx_destroy(ngx_shmtx_t *mtx); ngx_uint_t ngx_shmtx_trylock(ngx_shmtx_t *mtx); void ngx_shmtx_lock(ngx_shmtx_t *mtx); void ngx_shmtx_unlock(ngx_shmtx_t *mtx); ngx_uint_t ngx_shmtx_force_unlock(ngx_shmtx_t *mtx, ngx_pid_t pid); #endif /* _NGX_SHMTX_H_INCLUDED_ */
/******************************************************************************* OpenAirInterface Copyright(c) 1999 - 2014 Eurecom OpenAirInterface 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. OpenAirInterface 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 OpenAirInterface.The full GNU General Public License is included in this distribution in the file called "COPYING". If not, see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ /*! \file pdcp_util.c * \brief PDCP Util Methods * \author Baris Demiray * \date 2012 */ #include <assert.h> #include "UTIL/LOG/log.h" #include "pdcp_util.h" /* * Prints incoming byte stream in hexadecimal and readable form * * @param component Utilised as with macros defined in UTIL/LOG/log.h * @param data unsigned char* pointer for data buffer * @param size Number of octets in data buffer * @return none */ void util_print_hex_octets(comp_name_t component, unsigned char* data, unsigned long size) { if (data == NULL) { LOG_W(component, "Incoming buffer is NULL! Ignoring...\n"); return; } unsigned long octet_index = 0; LOG_T(component, " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n"); LOG_T(component, "-----+-------------------------------------------------|\n"); LOG_T(component, " 000 |"); for (octet_index = 0; octet_index < size; ++octet_index) { /* * Print every single octet in hexadecimal form */ LOG_T(component, "%02x.", data[octet_index]); /* * Align newline and pipes according to the octets in groups of 2 */ if (octet_index != 0 && (octet_index + 1) % 16 == 0) { LOG_T(component, " |\n"); LOG_T(component, " %03d |", octet_index); } } /* * Append enough spaces and put final pipe */ unsigned char index; for (index = octet_index; index < 16; ++index) { LOG_T(component, " "); } LOG_T(component, " \n"); } void util_flush_hex_octets(comp_name_t component, unsigned char* data, unsigned long size) { if (data == NULL) { LOG_W(component, "Incoming buffer is NULL! Ignoring...\n"); return; } printf("[PDCP]"); unsigned long octet_index = 0; for (octet_index = 0; octet_index < size; ++octet_index) { //LOG_T(component, "%02x.", data[octet_index]); printf("%02x.", data[octet_index]); } //LOG_T(component, " \n"); printf(" \n"); } /* * Prints binary representation of given octet prepending * passed log message * * @param Octet as an unsigned character * @return None */ void util_print_binary_representation(unsigned char* message, uint8_t octet) { unsigned char index = 0; unsigned char mask = 0x80; LOG_T(PDCP, "%s", message); for (index = 0; index < 8; ++index) { if (octet & mask) { LOG_T(PDCP, "1"); } else { LOG_T(PDCP, "0"); } mask /= 2; } LOG_T(PDCP, "\n"); } /* * Sets the bit of given octet at `index' * * @param octet 8-bit data * @param index Index of bit to be set * @return TRUE on success, FALSE otherwise */ boolean_t util_mark_nth_bit_of_octet(uint8_t* octet, uint8_t index) { uint8_t mask = 0x80; assert(octet != NULL); /* * Prepare mask */ mask >>= index; /* * Set relevant bit */ *octet |= mask; return TRUE; }
#ifndef NILLABLEPROPERTY_H #define NILLABLEPROPERTY_H // Librerías Internas #include "xsd_global.h" #include "core/PropertyAbs.h" // Librerías Externas #include "Enumeration.h" // Librerías Qt #include <QMetaEnum> #include <QObject> namespace Com { namespace Ecosoftware { namespace Engines { namespace Xsd { class XSDSHARED_EXPORT NillableProperty : public PropertyAbs { Q_OBJECT public: NillableProperty ( bool value = false ); NillableProperty ( const NillableProperty& ); ~NillableProperty (); bool getValue () const; void setValue ( bool value ); private: bool value; }; } } } } Q_DECLARE_METATYPE ( Com::Ecosoftware::Engines::Xsd::NillableProperty ) #endif // NILLABLEPROPERTY_H
#ifndef FILEMANAGER_H #define FILEMANAGER_H #include <set> #include <deque> #include <QUuid> #include <QObject> #include <QSettings> #include "ds/conversation.h" #include "ds/identity.h" #include "ds/file.h" #include "ds/registry.h" #include "ds/lru_cache.h" namespace ds { namespace core { class FileManager : public QObject { Q_OBJECT public: explicit FileManager(QObject &parent, QSettings& settings); File::ptr_t getFile(const int dbId); File::ptr_t getFile(const QByteArray& hash, Conversation& conversation); File::ptr_t getFileFromId(const QByteArray& fileId, Conversation& conversation); File::ptr_t getFileFromId(const QByteArray& fileId, const File::Direction direction); File::ptr_t getFileFromId(const QByteArray& fileId, const Contact& contact); File::ptr_t addFile(std::unique_ptr<FileData> data); void receivedFileOffer(Conversation& conversation, const PeerFileOffer& offer); void touch(const File::ptr_t& file); void onFileStateChanged(const File *file); signals: void fileAdded(const File::ptr_t& file); void fileDeleted(const int dbId); void fileStateChanged(const core::File *file); public slots: private: void hashIt(const File::ptr_t& file); Registry<int, File> registry_; LruCache<File::ptr_t> lru_cache_{3}; //std::set<File::ptr_t> hashing_; QSettings &settings_; }; }} #endif // FILEMANAGER_H
/*! * @file kernelinfo.c * @brief Retrieves offset information from the running Linux kernel and prints them in the kernel log. * * @author Manolis Stamatogiannakis <manolis.stamatogiannakis@vu.nl> * @copyright This work is licensed under the terms of the GNU GPL, version 2. * See the COPYING file in the top-level directory. */ #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ #include <linux/utsname.h> #include <linux/version.h> #include <linux/syscalls.h> #include <linux/security.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/file.h> #include <linux/fdtable.h> #include <linux/dcache.h> #include <linux/mount.h> /* * This function is used because to print offsets of members * of nested structs. It basically transforms '.' to '_', so * that we don't have to replicate all the nesting in the * structs used by the introspection program. * * E.g. for: * struct file { * ... * struct dentry { * struct *vfsmount; * struct *dentry; * } * ... * }; * * Caveat: Because a static buffer is returned, the function * can only be used once in each invocation of printk. */ #define MAX_MEMBER_NAME 31 static char *cp_memb(const char *s) { static char memb[MAX_MEMBER_NAME+1]; int i; for (i = 0; i<MAX_MEMBER_NAME && s[i]!='\0'; i++) { memb[i] = s[i] == '.' ? '_' : s[i]; } memb[i] = 0; return memb; } /* * The macro printing the config lines in the kernel log. */ #define PRINT_OFFSET(structp, memb, cfgname) printk(KERN_INFO "%s.%s_offset = %d", cfgname, cp_memb(#memb), (int)((void *)&(structp->memb) - (void *)structp)) int init_module(void) { struct cred credstruct; struct vm_area_struct vmastruct; struct dentry dentrystruct; struct file filestruct; struct thread_info threadinfostruct; struct files_struct filesstruct; /* mind the extra 's' :-P */ struct fdtable fdtablestruct; struct vfsmount vfsmountstruct; struct task_struct *ts_p; struct cred *cs_p; struct mm_struct *mms_p; struct vm_area_struct *vma_p; struct dentry *ds_p; struct file *fs_p; struct fdtable *fdt_p; struct thread_info *ti_p; struct files_struct *fss_p; struct vfsmount *vfsmnt_p; ts_p = &init_task; cs_p = &credstruct; mms_p = init_task.mm; vma_p = &vmastruct; ds_p = &dentrystruct; fs_p = &filestruct; ti_p = &threadinfostruct; fss_p = &filesstruct; fdt_p = &fdtablestruct; vfsmnt_p = &vfsmountstruct; printk(KERN_INFO "--KERNELINFO-BEGIN--\n"); printk(KERN_INFO "name = %s|%s|%s\n", utsname()->release, utsname()->version, utsname()->machine); printk(KERN_INFO "task.size = %zu\n", sizeof(init_task)); printk(KERN_INFO "#task.init_addr = 0x%08lX\n", (unsigned long)ts_p); printk(KERN_INFO "task.init_addr = %lu\n", (unsigned long)ts_p); PRINT_OFFSET(ti_p, task, "task"); PRINT_OFFSET(ts_p, tasks, "task"); PRINT_OFFSET(ts_p, pid, "task"); PRINT_OFFSET(ts_p, tgid, "task"); PRINT_OFFSET(ts_p, group_leader, "task"); PRINT_OFFSET(ts_p, thread_group, "task"); PRINT_OFFSET(ts_p, real_parent, "task"); PRINT_OFFSET(ts_p, parent, "task"); PRINT_OFFSET(ts_p, mm, "task"); PRINT_OFFSET(ts_p, stack, "task"); PRINT_OFFSET(ts_p, real_cred, "task"); PRINT_OFFSET(ts_p, cred, "task"); PRINT_OFFSET(ts_p, comm, "task"); printk(KERN_INFO "task.comm_size = %zu\n", sizeof(ts_p->comm)); PRINT_OFFSET(ts_p, files, "task"); PRINT_OFFSET(cs_p, uid, "cred"); PRINT_OFFSET(cs_p, gid, "cred"); PRINT_OFFSET(cs_p, euid, "cred"); PRINT_OFFSET(cs_p, egid, "cred"); PRINT_OFFSET(mms_p, mmap, "mm"); PRINT_OFFSET(mms_p, pgd, "mm"); PRINT_OFFSET(mms_p, arg_start, "mm"); PRINT_OFFSET(mms_p, start_brk, "mm"); PRINT_OFFSET(mms_p, brk, "mm"); PRINT_OFFSET(mms_p, start_stack, "mm"); PRINT_OFFSET(vma_p, vm_mm, "vma"); PRINT_OFFSET(vma_p, vm_start, "vma"); PRINT_OFFSET(vma_p, vm_end, "vma"); PRINT_OFFSET(vma_p, vm_next, "vma"); PRINT_OFFSET(vma_p, vm_flags, "vma"); /* used in reading OsiModules */ PRINT_OFFSET(vma_p, vm_file, "vma"); PRINT_OFFSET(fs_p, f_path.dentry, "fs"); PRINT_OFFSET(fs_p, f_path.mnt, "fs"); PRINT_OFFSET(fs_p, f_pos, "fs"); PRINT_OFFSET(vfsmnt_p, mnt_parent, "fs"); PRINT_OFFSET(vfsmnt_p, mnt_mountpoint, "fs"); PRINT_OFFSET(vfsmnt_p, mnt_root, "fs"); /* XXX: We don't use this anywhere. Marked for removal. */ /* used in reading FDs */ PRINT_OFFSET(fss_p, fdt, "fs"); PRINT_OFFSET(fss_p, fdtab, "fs"); PRINT_OFFSET(fdt_p, fd, "fs"); PRINT_OFFSET(ds_p, d_name, "fs"); PRINT_OFFSET(ds_p, d_iname, "fs"); PRINT_OFFSET(ds_p, d_parent, "fs"); printk(KERN_INFO "---KERNELINFO-END---\n"); /* Return a failure. We only want to print the info. */ return -1; } void cleanup_module(void) { printk(KERN_INFO "Information module removed.\n"); } MODULE_LICENSE("GPL"); /* vim:set tabstop=4 softtabstop=4 noexpandtab */
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 H_BLE_LL_RESOLV_ #define H_BLE_LL_RESOLV_ #ifdef __cplusplus extern "C" { #endif /* * An entry in the resolving list. * The identity address is stored in little endian format. * The local rpa is stored in little endian format. * The IRKs are stored in big endian format. * * Note: * rl_local_irk and rl_peer_irk need to be word aligned */ struct ble_ll_resolv_entry { uint8_t rl_addr_type; uint8_t rl_priv_mode; uint8_t rl_has_local; uint8_t rl_has_peer; uint8_t rl_local_irk[16]; uint8_t rl_peer_irk[16]; uint8_t rl_identity_addr[BLE_DEV_ADDR_LEN]; uint8_t rl_local_rpa[BLE_DEV_ADDR_LEN]; uint8_t rl_peer_rpa[BLE_DEV_ADDR_LEN]; }; extern struct ble_ll_resolv_entry g_ble_ll_resolv_list[]; /* Clear the resolving list */ int ble_ll_resolv_list_clr(void); /* Read the size of the resolving list */ int ble_ll_resolv_list_read_size(uint8_t *rspbuf, uint8_t *rsplen); /* Add a device to the resolving list */ int ble_ll_resolv_list_add(const uint8_t *cmdbuf, uint8_t len); /* Remove a device from the resolving list */ int ble_ll_resolv_list_rmv(const uint8_t *cmdbuf, uint8_t len); /* Address resolution enable command */ int ble_ll_resolv_enable_cmd(const uint8_t *cmdbuf, uint8_t len); int ble_ll_resolv_peer_addr_rd(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen); int ble_ll_resolv_local_addr_rd(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen); /* Finds 'addr' in resolving list. Doesnt check if address resolution enabled */ struct ble_ll_resolv_entry * ble_ll_resolv_list_find(const uint8_t *addr, uint8_t addr_type); /* Returns true if address resolution is enabled */ uint8_t ble_ll_resolv_enabled(void); /* Reset private address resolution */ void ble_ll_resolv_list_reset(void); /* Generate local or peer RPA. It is up to caller to make sure required IRK * is present on RL */ void ble_ll_resolv_get_priv_addr(struct ble_ll_resolv_entry *rl, int local, uint8_t *addr); void ble_ll_resolv_set_peer_rpa(int index, uint8_t *rpa); void ble_ll_resolv_set_local_rpa(int index, uint8_t *rpa); /* Generate a resolvable private address. */ int ble_ll_resolv_gen_rpa(uint8_t *addr, uint8_t addr_type, uint8_t *rpa, int local); /* Set the resolvable private address timeout */ int ble_ll_resolv_set_rpa_tmo(const uint8_t *cmdbuf, uint8_t len); /* Set the privacy mode */ int ble_ll_resolve_set_priv_mode(const uint8_t *cmdbuf, uint8_t len); /* Get the RPA timeout, in seconds */ uint32_t ble_ll_resolv_get_rpa_tmo(void); /* Resolve a resolvable private address */ int ble_ll_resolv_rpa(const uint8_t *rpa, const uint8_t *irk); /* Try to resolve peer RPA and return index on RL if matched */ int ble_ll_resolv_peer_rpa_any(const uint8_t *rpa); /* Initialize resolv*/ void ble_ll_resolv_init(void); #ifdef __cplusplus } #endif #endif
#include "Elem.h" typedef struct Nodo { Elem dato; struct Nodo *sig; } *Lista; typedef struct ApUltimo { Lista ultimo; } *Colac; // Signatura int random(int from, int to); int esNuevac(Colac); Colac nuevac(); Colac formarC(Elem, Colac); Colac rotar(Colac); void impColac(Colac); Colac randColac(int size); // fin signatura // inclusive random int random(int from, int to) { return rand() % (to + 1 - from) + from;; } int esNuevac(Colac c) {return c -> ultimo == NULL;} Colac nuevac() { Colac cc = (Colac) malloc(sizeof(struct ApUltimo)); cc -> ultimo = NULL; return cc; } Colac formarC(Elem e, Colac c) { Lista nuevo = (Lista) malloc(sizeof(struct Nodo)); nuevo -> dato = e; if (esNuevac(c)) nuevo -> sig = nuevo; else { // nuevo ultimo = primero de la cola nuevo -> sig = c -> ultimo -> sig; // ultimo = nuevo c -> ultimo -> sig = nuevo; } c -> ultimo = nuevo; return c; } Colac rotar(Colac c) { c -> ultimo = c -> ultimo -> sig; return c; } void impColac(Colac c) { Lista tmp = c -> ultimo; while (true) { cout << c -> ultimo -> sig -> dato << " "; c = rotar(c); if (c -> ultimo == tmp) break; } } Colac randColac(int size) { Colac c = nuevac(); while (size--) { Elem e = random(33, 126); c = formarC(e, c); } return c; }
#include <stdio.h> #include <pthread.h> pthread_mutex_t mx, my; int x=2, y=2; void *thread1() { int a; pthread_mutex_lock(&mx); a = x; pthread_mutex_lock(&my); y = y + a; y = y + a; y = y + a; y = y + a; y = y + a; pthread_mutex_unlock(&my); a = a + 1; pthread_mutex_lock(&my); y = y + a; y = y + a; y = y + a; y = y + a; y = y + a; pthread_mutex_unlock(&my); x = x + x + a; pthread_mutex_unlock(&mx); assert(x!=27); } void *thread2() { pthread_mutex_lock(&mx); x=x+2; x=x+2; x=x+2; x=x+2; x=x+2; pthread_mutex_unlock(&mx); } void *thread3() { pthread_mutex_lock(&my); y=y+2; y=y+2; y=y+2; y=y+2; y=y+2; pthread_mutex_unlock(&my); } int main() { pthread_t t1, t2, t3; pthread_mutex_init(&mx, 0); pthread_mutex_init(&my, 0); pthread_create(&t1, 0, thread1, 0); pthread_create(&t2, 0, thread2, 0); pthread_create(&t3, 0, thread3, 0); pthread_join(t1, 0); pthread_join(t2, 0); pthread_join(t3, 0); pthread_mutex_destroy(&mx); pthread_mutex_destroy(&my); return 0; } // Threader-OG '-no-main' returns 'program is correct' after 4m41s
#ifndef HELP_FUNCTIONS_H #define HELP_FUNCTIONS_H // Stdlib header file for input and output. #include <iostream> #include <stdlib.h> #include <vector> #include <string> #include <sstream> #include <fstream> #include <iomanip> // Nice libraries from C #include <cmath> #include <ctime> #include <cstdint> class Timer{ private: std::clock_t start; int nEvent; int dEvent; // spacing of time/event lattice int cEvent = 0; // current event int hours; int minutes; int seconds; public: Timer(){} Timer(int _nEvent, int _dEvent): nEvent(_nEvent),dEvent(_dEvent) {} ~Timer(){} void set_params(int _nEvent, int _dEvent){ nEvent = _nEvent; dEvent = _dEvent; } void start_timing(){ start = std::clock(); } void count_time(){ cEvent += dEvent; double time_processor = (std::clock() - start)/(( (double) CLOCKS_PER_SEC ) ); time_processor = time_processor*( ((double) nEvent)/cEvent-1); minutes = time_processor/60; hours = minutes/60; seconds = time_processor-60*minutes; minutes = minutes - hours*60; } void print_time(){ count_time(); cout << cEvent << " events created, ETA : " << hours << "h" << minutes << "m" << seconds << "s." << endl; } }; #endif // HELP_FUNCTIONS_H
/* getdomainname emulation for systems that doesn't have it. Copyright (C) 2003, 2006, 2008 Free Software Foundation, Inc. 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/>. */ /* Written by Simon Josefsson. */ #include <config.h> /* Specification. */ #include <unistd.h> #include <string.h> #include <errno.h> /* Return the NIS domain name of the machine. WARNING! The NIS domain name is unrelated to the fully qualified host name of the machine. It is also unrelated to email addresses. WARNING! The NIS domain name is usually the empty string or "(none)" when not using NIS. Put up to LEN bytes of the NIS domain name into NAME. Null terminate it if the name is shorter than LEN. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ int getdomainname (char *name, size_t len) { const char *result = ""; /* Hardcode your domain name if you want. */ size_t result_len = strlen (result); if (result_len > len) { errno = EINVAL; return -1; } memcpy (name, result, result_len); if (result_len < len) name[result_len] = '\0'; return 0; }
// // AppDelegate.h // SearchMeLi // // Created by Federico Diaz Real on 10/3/16. // Copyright © 2016 Federico Diaz Real. All rights reserved. // #import <UIKit/UIKit.h> #import "MLSearchViewController.h" @class MLSearchListViewController; @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) MLSearchViewController *viewController; @end
/* * Cantata * * Copyright (c) 2011-2017 Craig Drummond <craig.p.drummond@gmail.com> * * ---- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef DOCKMENU_H #define DOCKMENU_H #include <QMenu> class QAction; class MPDStatus; class DockMenu : public QMenu { Q_OBJECT public: DockMenu(QWidget *w); virtual ~DockMenu() { } void update(MPDStatus * const status); private: QAction *playPauseAction; }; #endif
/* Search character in piece of UTF-32 string. Copyright (C) 1999, 2002, 2006, 2009-2014 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. 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/>. */ #include <config.h> /* Specification. */ #include "unistr.h" uint32_t * u32_chr (const uint32_t *s, size_t n, ucs4_t uc) { for (; n > 0; s++, n--) { if (*s == uc) return (uint32_t *) s; } return NULL; }
/***************************************************************************** This file is part of QSS Solver. QSS Solver 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. QSS Solver 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 QSS Solver. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ #pragma once #include <iostream> #include <map> #include <math.h> #include <deps/sbg_graph/container_def.h> #include <util/logger.h> namespace SB { using namespace std; #define Inf numeric_limits<int>::max() template <template <typename Value, typename Hash = boost::hash<Value>, typename Pred = std::equal_to<Value>, typename Alloc = std::allocator<Value>> class CT> struct IntervalImp { IntervalImp() = default; IntervalImp(bool is_empty) { _lo = -1; _step = -1; _hi = -1; _empty = is_empty; }; IntervalImp(int vlo, int vstep, int vhi) { if (vlo >= 0 && vstep > 0 && vhi >= 0) { _empty = false; _lo = vlo; _step = vstep; if (vlo <= vhi && vhi < Inf) { int rem = std::fmod(vhi - vlo, vstep); _hi = vhi - rem; } else if (vlo <= vhi && vhi == Inf) { _hi = Inf; } else { _empty = true; } } else if (vlo >= 0 && vstep == 0 && vhi == vlo) { _empty = false; _lo = vlo; _hi = vhi; _step = 1; } else { _lo = -1; _step = -1; _hi = -1; _empty = true; } } int gcd(int a, int b) { if (b ==0) return b; int c; do { c = a % b; if (c > 0) { a = b; b = c; } } while (c != 0); return b; } int lcm(int a, int b) { if (b == 0) return 0; if (a < 0 || b < 0) return -1; return (a * b) / gcd(a, b); } int lo() const { return _lo; } int step() const { return _step; } int hi() const { return _hi; } bool empty() const { return _empty; } bool isIn(int x) { if (x < _lo || x > _hi || _empty) { return false; } float aux = fmod(x - _lo, _step); if (aux == 0) { return true; } return false; } IntervalImp cap(IntervalImp &other) { int max_low = max(_lo, other._lo), new_low = -1; int new_step = lcm(_step, other._step); int new_end = min(_hi, other._hi); if (!_empty && !other.empty()) { for (int i = 0; i < new_step; i++) { int elem = max_low + i; if (isIn(elem) && other.isIn(elem)) { new_low = elem; break; } } } else { return IntervalImp(true); } if (new_low < 0) { return IntervalImp(true); } return IntervalImp(new_low, new_step, new_end); } CT<IntervalImp> diff(IntervalImp &other) { CT<IntervalImp> res; IntervalImp cap_res = cap(other); if (cap_res._empty) { res.insert(*this); return res; } if (cap_res == *this) { return res; } // "Before" intersection if (_lo < cap_res.lo()) { IntervalImp diff_left = IntervalImp(_lo, 1, cap_res.lo() - 1); IntervalImp left = cap(diff_left); res.insert(left); } // "During" intersection if (cap_res.step() <= (cap_res.hi() - cap_res.lo())) { int n_inters = cap_res.step() / _step; for (int i = 1; i < n_inters; i++) { IntervalImp diff_middle = IntervalImp(cap_res.lo() + i * _step, cap_res.step(), cap_res.hi()); res.insert(diff_middle); } } // "After" intersection if (_hi > cap_res.hi()) { IntervalImp diff_right = IntervalImp(cap_res.hi() + 1, 1, _hi); IntervalImp right = cap(diff_right); res.insert(right); } return res; } int minElem() { return _lo; } // Cardinality of interval int size() { int res = (_hi - _lo) / _step + 1; return res; } bool operator==(const IntervalImp &other) const { return (_lo == other.lo()) && (_step == other.step()) && (_hi == other.hi()) && (_empty == other.empty()); } bool operator!=(const IntervalImp &other) const { return (_lo != other.lo()) || (_step != other.step()) || (_hi != other.hi()) || (_empty != other.empty()); } size_t hash() { return _lo; } protected: int _lo; int _step; int _hi; bool _empty; }; template <template <typename Value, typename Hash = boost::hash<Value>, typename Pred = std::equal_to<Value>, typename Alloc = std::allocator<Value>> class CT> size_t hash_value(IntervalImp<CT> inter) { return inter.hash(); } typedef IntervalImp<UnordCT> Interval; typedef UnordCT<Interval> UnordInterval; typedef OrdCT<Interval> OrdInterval; ostream &operator<<(ostream &out, Interval &i); } // namespace SB
//Вторая версия, с добивающими импульсами. Т.е., даем не один импульс, а несколько подряд #include <avr/io.h> #include <util/delay.h> #define F_CPU 1200000UL // Минимальная и максимальная задержки ударного импульса мс #define MINDELAY 4 #define MAXDELAY 5 // Количество подряд идущих импульсов #define PULSECOUNT 2 // Педаль на размыкание подключена к PB4. Активный уровень - низкий. #define PEDAL PB4 // Выход - PB3. Активный уровень - высокий. #define FIRE PB3 void delaymsMod(unsigned char ms) // Компилятор хочет, чтобы аргументом _delay_us была константа. // Поэтому приходится делать велокостыль. // кроме того, максимальная задержка в мкс = 768/частота чипа в мгц { for (unsigned char counter=0; counter<ms; counter++) { _delay_ms(1); } } unsigned char fireDelay(void) // Отключить компаратор. Включить АЦП. Получить уставку с переменного резистора. // Вычислить время, которое будет между переходом через 0 и подачей ударного импульса // Чем меньше это время, тем больший участок полупериода подается на электромагнит, // соответственно, сильнее удар. Выключить АЦП. { // ACD - отключение аналогового компаратора ACSR |= (1 << ACD); // бит 5 - ADLAR, ориентация данных. Чтобы использовать только 8 бит ADCH // биты 0-1 - настройка входа. 01 соотв. ADC1 (PB2) ADMUX |= 0b00100001; // ADPS2-1-0 задает делитель тактирования АЦП. 011 соотв. делителю 8 // Результирующая частота АЦП 150 кГц (1.2 МГц / 8) ADCSRA |= (1 << ADPS1) | (1 << ADPS0); //ADCSRA &= (0 << ADPS2); // Включить АЦП ADCSRA |= (1 << ADEN); // Начать преобразование ADCSRA |= (1 << ADSC); // Подождать, пока не сбросится бит преобразования while (ADCSRA & (1 << ADSC)); // Получить 8 бит данных unsigned char rawADC = ADCH; // Отключить АЦП ADCSRA &= ~(1 << ADEN); // Вычислить задержку return MINDELAY + rawADC * (MAXDELAY - MINDELAY) / 255; } void waitForZero(void) // Включить компаратор. Дождаться перехода через ноль. Выключить компаратор. { ACSR &= ~(1 << ACD); _delay_ms(1); while ((ACSR & 0b00100000) == 0b00100000); ACSR |= (1 << ACD); } unsigned char pedal(void) // Проверить нажатие педали. С подавлением дребезга. Педаль работает на размыкание. { unsigned char pressed = 0; // флаг нажатия // время, в течение которого должно не прерываться нажатие unsigned char pressedTime = 100; if (PINB & (1 << PEDAL)) // педаль нажата, цепь разомкнута, на входе 1 { pressed = 1; for (unsigned char counter=0; counter < pressedTime; counter++) { // если в течение заданного интервала педаль отпущена, цепь // замкнута, на входе 0 - сбросить флаг нажатия if ( !(PINB & (1 << PEDAL))) { pressed = 0; } _delay_ms(1); } } return pressed; } void fire(void) // ударный импульс длительностью 1 мс { PORTB |= (1 << FIRE); _delay_ms(1); PORTB &= ~(1 << FIRE); } void setup(void) { // режим порта DDRB=0b00001000; } int main(void) { setup(); while (1) { if (pedal()) { // по нажатию педали отработать заданное количество импульсов for (unsigned char counter = 0; counter < PULSECOUNT; counter++){ waitForZero(); delaymsMod(fireDelay()); fire(); } while(pedal()); // ничего не делать, пока педаль нажата } } return -1; // Никогда }
/* Test of u16_asnprintf() function. Copyright (C) 2007-2014 Free Software Foundation, Inc. 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "unistdio.h" #include <errno.h> #include <stdarg.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" #include "macros.h" #include "test-u16-asnprintf1.h" static void test_asnprintf () { test_function (u16_asnprintf); } int main (int argc, char *argv[]) { test_asnprintf (); return 0; }
/* This file is part of Mac Eve Tools. Mac Eve Tools 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. Mac Eve Tools 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 Mac Eve Tools. If not, see <http://www.gnu.org/licenses/>. Copyright Matt Tyson, 2009. */ #import <Cocoa/Cocoa.h> /** The `CharacterTemplate` class associates a monitored character with its API key. */ @interface CharacterTemplate : NSObject<NSCoding> { NSString *characterName; NSString *characterId; NSString *accountId; NSString *verificationCode; BOOL active; BOOL primary; } /** The character's name. */ @property (retain) NSString* characterName; /** The character's database ID. */ @property (retain) NSString* characterId; /** The API key's key ID. */ @property (retain) NSString* accountId; /** The API key's verification code. */ @property (retain) NSString* verificationCode; /** Whether the character is currently being monitored by Vitality. */ @property BOOL active; /** This field is currently unused. */ @property BOOL primary; -(CharacterTemplate*) initWithDetails:(NSString*)name accountId:(NSString*)acctId verificationCode:(NSString*)key charId:(NSString*)charId active:(BOOL)isActive primary:(BOOL)isPrimary; @end
#pragma once #include "OBSApi.h" #ifdef OBSINFOPLUGIN_EXPORTS #define OBSINFOPLUGIN_API extern "C" __declspec(dllexport) #else #define OBSINFOPLUGIN_API extern "C" __declspec(dllimport) #endif OBSINFOPLUGIN_API bool LoadPlugin(); OBSINFOPLUGIN_API void UnloadPlugin(); OBSINFOPLUGIN_API void OnStartStream(); OBSINFOPLUGIN_API void OnStopStream(); OBSINFOPLUGIN_API CTSTR GetPluginName(); OBSINFOPLUGIN_API CTSTR GetPluginDescription(); OBSINFOPLUGIN_API void ConfigPlugin(HWND hHandle);
#define SOFTWARE_VERSION_NUMBER 11 // version number * 10 #define MCWP FALSE // for general use uncomment this and comment next line //#define MCWP TRUE // for use in Weather stations uncomment this and comment previous line /* the linker options must be setup correctly for the start address used. The linker must have the following two statements -L-Pbootloader=7000h and -RESROM0010-7000 where the 7000 is replaced by the start_address. use 7000h if you are using the ICD and 7800h if not */ /* 25-07-2002 v1.1 Added EEprom to SFR fumction and writing EEprom from Hex file 24-05-2002 v1.0 Bootloader for the 18Fxx2 range of processors */ #define serial_enable_out RE2 // 10 enable max3222 0 = enable #define serial_enable_out_dir TRISE2 #define serial_TX_out RC6 // 25 serial TX line #define serial_TX_out_dir TRISC6 #define serial_RX_in RC7 // 26 serial RX line #define serial_RX_in_dir TRISC7 #define serialchip_shutdown_out RD4 // 27 RS232MAX serial chip powersave #define serialchip_shutdown_out_dir TRISD4 #define flash_chip_select_out RD0 // 19 flash memory CS #define flash_chip_select_out_dir TRISD0 #define ON 1 #define OFF 0 #define OUT 0 #define IN 1 #define FALSE 0 #define TRUE !FALSE
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef _nsDiskCacheStreams_h_ #define _nsDiskCacheStreams_h_ #include "mozilla/MemoryReporting.h" #include "nsDiskCacheBinding.h" #include "nsCache.h" #include "nsIInputStream.h" #include "nsIOutputStream.h" #include "mozilla/Atomics.h" class nsDiskCacheDevice; class nsDiskCacheStreamIO : public nsIOutputStream { public: explicit nsDiskCacheStreamIO(nsDiskCacheBinding * binding); NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM nsresult GetInputStream(uint32_t offset, nsIInputStream ** inputStream); nsresult GetOutputStream(uint32_t offset, nsIOutputStream ** outputStream); nsresult ClearBinding(); void IncrementInputStreamCount() { mInStreamCount++; } void DecrementInputStreamCount() { mInStreamCount--; NS_ASSERTION(mInStreamCount >= 0, "mInStreamCount has gone negative"); } size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); // GCC 2.95.2 requires this to be defined, although we never call it. // and OS/2 requires that it not be private nsDiskCacheStreamIO() { NS_NOTREACHED("oops"); } private: virtual ~nsDiskCacheStreamIO(); nsresult OpenCacheFile(int flags, PRFileDesc ** fd); nsresult ReadCacheBlocks(uint32_t bufferSize); nsresult FlushBufferToFile(); void UpdateFileSize(); void DeleteBuffer(); nsresult CloseOutputStream(); nsresult SeekAndTruncate(uint32_t offset); nsDiskCacheBinding * mBinding; // not an owning reference nsDiskCacheDevice * mDevice; mozilla::Atomic<int32_t> mInStreamCount; PRFileDesc * mFD; uint32_t mStreamEnd; // current size of data uint32_t mBufSize; // current end of buffer char * mBuffer; bool mOutputStreamIsOpen; }; #endif // _nsDiskCacheStreams_h_
// // Aspia Project // Copyright (C) 2020 Dmitry Chapyshev <dmitry@aspia.ru> // // 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 <https://www.gnu.org/licenses/>. // #ifndef CLIENT__UI__CLIENT_WINDOW_H #define CLIENT__UI__CLIENT_WINDOW_H #include "base/macros_magic.h" #include "client/client_config.h" #include "proto/desktop.pb.h" #include "ui_client_window.h" #include <QMainWindow> namespace client { class ClientWindow : public QMainWindow { Q_OBJECT public: explicit ClientWindow(QWidget* parent = nullptr); ~ClientWindow(); protected: // QMainWindow implementation. void closeEvent(QCloseEvent* event) override; private slots: void onLanguageChanged(QAction* action); void onSettings(); void onHelp(); void onAbout(); void sessionTypeChanged(int item_index); void sessionConfigButtonPressed(); void connectToHost(); private: void createLanguageMenu(const QString& current_locale); void reloadSessionTypes(); Ui::ClientWindow ui; DISALLOW_COPY_AND_ASSIGN(ClientWindow); }; } // namespace client #endif // CLIENT__UI__CLIENT_WINDOW_H
/* * Copyright (c) 2014 CPB9 team. See the COPYRIGHT file at the top-level directory. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "bmcl/Config.h" namespace bmcl { typedef void (*PanicHandler)(const char* msg); void setPanicHandler(PanicHandler handler); PanicHandler panicHandler(); PanicHandler defaultPanicHandler(); BMCL_NORETURN void panic(const char* msg); };
/***************************************************************************** * PokerTH - The open source texas holdem engine * * Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May * * * * This program 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, 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 Affero General Public License for more details. * * * * You should have received a copy of the GNU Affero General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * * * * Additional permission under GNU AGPL version 3 section 7 * * * * If you modify this program, or any covered work, by linking or * * combining it with the OpenSSL project's OpenSSL library (or a * * modified version of that library), containing parts covered by the * * terms of the OpenSSL or SSLeay licenses, the authors of PokerTH * * (Felix Hammer, Florian Thauer, Lothar May) grant you additional * * permission to convey the resulting work. * * Corresponding Source for a non-source form of such a combination * * shall include the source code for the parts of OpenSSL used as well * * as that of the covered work. * *****************************************************************************/ /* Server database interface. */ #ifndef _SERVERDBINTERFACE_H_ #define _SERVERDBINTERFACE_H_ #include <db/serverdbcallback.h> #include <string> #include <list> #include <vector> typedef std::list<DB_id> db_list; class ServerDBInterface { public: virtual ~ServerDBInterface(); virtual void Init(const std::string &host, const std::string &user, const std::string &pwd, const std::string &database, const std::string &encryptionKey) = 0; virtual void Start() = 0; virtual void Stop() = 0; virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName) = 0; virtual void AsyncCheckAvatarBlacklist(unsigned requestId, const std::string &avatarHash) = 0; virtual void PlayerPostLogin(DB_id playerId, const std::string &avatarHash, const std::string &avatarType) = 0; virtual void PlayerLogout(DB_id playerId) = 0; virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName) = 0; virtual void SetGamePlayerPlace(unsigned requestId, DB_id playerId, unsigned place) = 0; virtual void SetPlayerLastGames(unsigned requestId, DB_id playerId, std::vector<long> last_games, std::string playerIp) = 0; virtual void EndGame(unsigned requestId) = 0; virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, const std::string &avatarType, DB_id *byPlayerId) = 0; virtual void AsyncReportGame(unsigned requestId, unsigned replyId, DB_id *creatorPlayerId, unsigned gameId, const std::string &gameName, DB_id *byPlayerId) = 0; virtual void AsyncQueryAdminPlayers(unsigned requestId) = 0; virtual void AsyncBlockPlayer(unsigned requestId, unsigned replyId, DB_id playerId, int valid, int active) = 0; }; #endif
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "credit_management_status.h" char* OpenAPI_credit_management_status_ToString(OpenAPI_credit_management_status_e credit_management_status) { const char *credit_management_statusArray[] = { "NULL", "END_USER_SER_DENIED", "CREDIT_CTRL_NOT_APP", "AUTH_REJECTED", "USER_UNKNOWN", "RATING_FAILED" }; size_t sizeofArray = sizeof(credit_management_statusArray) / sizeof(credit_management_statusArray[0]); if (credit_management_status < sizeofArray) return (char *)credit_management_statusArray[credit_management_status]; else return (char *)"Unknown"; } OpenAPI_credit_management_status_e OpenAPI_credit_management_status_FromString(char* credit_management_status) { int stringToReturn = 0; const char *credit_management_statusArray[] = { "NULL", "END_USER_SER_DENIED", "CREDIT_CTRL_NOT_APP", "AUTH_REJECTED", "USER_UNKNOWN", "RATING_FAILED" }; size_t sizeofArray = sizeof(credit_management_statusArray) / sizeof(credit_management_statusArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(credit_management_status, credit_management_statusArray[stringToReturn]) == 0) { return stringToReturn; } stringToReturn++; } return 0; }
/* * AscEmu Framework based on ArcEmu MMORPG Server * Copyright (c) 2014-2019 AscEmu Team <http://www.ascemu.org> * Copyright (C) 2008-2012 ArcEmu Team <http://www.ArcEmu.org/> * * This program 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, either version 3 of the License, or * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef _AUTH_SHA1_H #define _AUTH_SHA1_H #include <cstdlib> #include "Common.hpp" #include <openssl/sha.h> #include "Auth/BigNumber.h" class Sha1Hash { public: Sha1Hash(); ~Sha1Hash(); void UpdateFinalizeBigNumbers(BigNumber* bn0, ...); void UpdateBigNumbers(BigNumber* bn0, ...); void UpdateData(const uint8* dta, int len); void UpdateData(const std::string & str); void Initialize(); void Finalize(); uint8* GetDigest(void) { return mDigest; }; int GetLength(void) { return SHA_DIGEST_LENGTH; }; BigNumber GetBigNumber(); private: SHA_CTX mC; uint8 mDigest[SHA_DIGEST_LENGTH]; }; #endif
#ifndef OFLUX_META_LOG_H #define OFLUX_META_LOG_H /* * OFlux: a domain specific language with event-based runtime for C++ programs * Copyright (C) 2008-2012 Mark Pichora <mark@oanda.com> OANDA Corp. * * This program 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, 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file OFluxMetaLog.h * @author Mark Pichora * Meta-programming computation of logarithms */ // find the highest bit of an unsigned value: // e.g: // 1 -> 0 // 2 -> 1 // 3 -> 1 // 4 -> 2 // 5 -> 2 // 6 -> 2 // ... namespace oflux { namespace lockfree { namespace allocator { template<size_t v> struct Log { enum { result = 1 + Log<(v >> 1)>::result }; }; // base cases: template<> struct Log<0> { Log(const char * msg = "cannot log 0"); }; template<> struct Log<1> { enum { result = 0 }; }; template< size_t divisor , bool is_pow_two=((1<<Log<divisor>::result)==divisor)> struct DivideBy { static inline size_t into(size_t onvalue) { return onvalue / divisor; } }; template< size_t divisor > struct DivideBy<divisor,true> { static inline size_t into(size_t onvalue) { return onvalue >> Log<divisor>::result; } }; } // namespace allocator } // namespace lockfree } // namespace oflux #endif // OFLUX_META_LOG_H
/** * @brief Command's `shm_psrv' backend * * @file cmd_shm_psrv.c */ /* ----------------------------------------------------------------------------- * Enduro/X Middleware Platform for Distributed Transaction Processing * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. * Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved. * This software is released under one of the following licenses: * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. * See LICENSE file for full text. * ----------------------------------------------------------------------------- * AGPL license: * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License, version 3 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 Affero General Public License, version 3 * for more details. * * You should have received a copy of the GNU Affero General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ----------------------------------------------------------------------------- * A commercial use license is available from Mavimax, Ltd * contact@mavimax.com * ----------------------------------------------------------------------------- */ #include <string.h> #include <stdio.h> #include <stdlib.h> #include <memory.h> #include <utlist.h> #include <ndrstandard.h> #include <ndebug.h> #include <userlog.h> #include <ndrxd.h> #include <ndrxdcmn.h> #include "cmd_processor.h" #include <atmi_shm.h> /*---------------------------Externs------------------------------------*/ extern ndrx_shm_t G_srvinfo; extern int G_max_servers; /*---------------------------Macros-------------------------------------*/ /*---------------------------Enums--------------------------------------*/ /*---------------------------Typedefs-----------------------------------*/ /*---------------------------Globals------------------------------------*/ /*---------------------------Statics------------------------------------*/ /*---------------------------Prototypes---------------------------------*/ /** * Modify reply according the data. * @param call * @param pm */ expublic void shm_psrv_reply_mod(command_reply_t *reply, size_t *send_size, mod_param_t *params) { command_reply_shm_psrv_t * shm_psrv_info = (command_reply_shm_psrv_t *)reply; shm_srvinfo_t *p_shm = (shm_srvinfo_t *)params->mod_param1; reply->msg_type = NDRXD_CALL_TYPE_PM_SHM_PSRV; /* calculate new send size */ *send_size += (sizeof(command_reply_shm_psrv_t) - sizeof(command_reply_t)); /* Copy data to reply structure */ shm_psrv_info->execerr = p_shm->execerr; shm_psrv_info->last_command_id = p_shm->last_command_id; NDRX_STRCPY_SAFE(shm_psrv_info->last_reply_q, p_shm->last_reply_q); shm_psrv_info->slot = params->param2; shm_psrv_info->srvid =p_shm->srvid; shm_psrv_info->status = p_shm->status; NDRX_LOG(log_debug, "magic: %ld", shm_psrv_info->rply.magic); } /** * Callback to report startup progress * @param call * @param pm * @return */ exprivate void shm_psrv_progress(command_call_t * call, shm_srvinfo_t *p_shm, int slot) { int ret=EXSUCCEED; mod_param_t params; NDRX_LOG(log_debug, "startup_progress enter"); memset(&params, 0, sizeof(mod_param_t)); /* pass to reply process model node */ params.mod_param1 = (void *)p_shm; params.param2 = slot; if (EXSUCCEED!=simple_command_reply(call, ret, NDRXD_CALL_FLAGS_RSPHAVE_MORE, /* hook up the reply */ &params, shm_psrv_reply_mod, 0L, 0, NULL)) { userlog("Failed to send progress back to [%s]", call->reply_queue); } NDRX_LOG(log_debug, "startup_progress exit"); } /** * Call to psc command * @param args * @return */ expublic int cmd_shm_psrv (command_call_t * call, char *data, size_t len, int context) { int ret=EXSUCCEED; int i; shm_srvinfo_t *srvinfo = (shm_srvinfo_t *) G_srvinfo.mem; /* We assume shm is OK! */ for (i=0; i<G_max_servers; i++) { if (srvinfo[i].srvid) { shm_psrv_progress(call, &srvinfo[i], i); } } if (EXSUCCEED!=simple_command_reply(call, ret, 0L, NULL, NULL, 0L, 0, NULL)) { userlog("Failed to send reply back to [%s]", call->reply_queue); } NDRX_LOG(log_warn, "cmd_shm_psrv returns with status %d", ret); out: return ret; } /* vim: set ts=4 sw=4 et smartindent: */
/* * Funambol is a mobile platform developed by Funambol, Inc. * Copyright (C) 2003 - 2007 Funambol, Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by * the Free Software Foundation with the addition of the following permission * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * 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 Affero General Public License * along with this program; if not, see http://www.gnu.org/licenses or write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. * * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License * version 3, these Appropriate Legal Notices must retain the display of the * "Powered by Funambol" logo. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display * the words "Powered by Funambol". */ #ifndef INCL_FTHREAD #define INCL_FTHREAD #include <e32std.h> #include "base/globalsdef.h" BEGIN_NAMESPACE TInt symbianRunWrapper(TAny* thread); TInt symbianTimeoutWrapper(TAny* thread); class FThread { protected: bool terminate; protected: FThread(); public: virtual ~FThread(); enum Priority { IdlePriority = EPriorityNull, LowestPriority = EPriorityMuchLess, LowPriority = EPriorityLess, NormalPriority = EPriorityNormal, HighPriority = EPriorityMore, HighestPriority = EPriorityMuchMore, TimeCriticalPriority = EPriorityRealTime, InheritPriority }; public: /** Starts this thread with the given priority. Threads entry point is the run method. */ virtual void start( Priority priority = InheritPriority ); /** Wait for this thread to finish its execution. This method is used to synchronize threads execution (similar to pthread_join) */ virtual void wait(); /** Wait for this thread to finish its execution or the timeout expires. If the thread terminates its execution before the timeout expires then true is returned, false otherwise. */ virtual bool wait(unsigned long timeout); /** Returns true iff the thread execution is terminated */ virtual bool finished() const; /** Returns true iff the thread is still running */ virtual bool running() const; /** Ask this thread to terminate its execution. But the thread is not forced to terminate. The thread must cooperate to terminate. */ virtual void softTerminate(); protected: virtual void run() = 0; public: /** * Suspend the current thread for the given time (milliseconds) */ static void sleep(long msec); private: bool isRunning; unsigned long timeout; RThread sthread; RTimer timer; static uint32_t id; TInt startTimeout(); friend TInt symbianRunWrapper(TAny* thread); friend TInt symbianTimeoutWrapper(TAny* thread); }; END_NAMESPACE #endif
int main(){ "This is /*not a comment*/" /* This is a comment */ /* C++ does not support /* nested comments */ */ /* This also contains a //nested comment */ "Keep this string" // this is a comment "//... " "This // is not a comment... " KEEPTHIS; // Another comment x = 1; // Also a comment, after x = 1; return 0; }
#pragma once #include <platform.h> // Many CryCommon files require that this is included first. #include <ISystem.h> #include <SQLite/sqlite3.h>
/* ============================================================================== This file is part of the juce_core module of the JUCE library. Copyright (c) 2015 - ROLI Ltd. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 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. ------------------------------------------------------------------------------ NOTE! This permissive ISC license applies ONLY to files within the juce_core module! All other JUCE modules are covered by a dual GPL/commercial license, so if you are using any other modules, be sure to check that you also comply with their license. For more details, visit www.juce.com ============================================================================== */ #ifndef JUCE_WIN32_COMSMARTPTR_H_INCLUDED #define JUCE_WIN32_COMSMARTPTR_H_INCLUDED #if !defined (_MSC_VER) template<typename Type> struct UUIDGetter { static CLSID get() { jassertfalse; return CLSID(); } }; #undef __uuidof #define __uuidof(x) UUIDGetter<x>::get() #endif inline GUID uuidFromString (const char* const s) noexcept { unsigned long p0; unsigned int p1, p2, p3, p4, p5, p6, p7, p8, p9, p10; #ifndef _MSC_VER sscanf #else sscanf_s #endif (s, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", &p0, &p1, &p2, &p3, &p4, &p5, &p6, &p7, &p8, &p9, &p10); GUID g = { p0, (uint16) p1, (uint16) p2, { (uint8) p3, (uint8) p4, (uint8) p5, (uint8) p6, (uint8) p7, (uint8) p8, (uint8) p9, (uint8) p10 }}; return g; } //============================================================================== /** A simple COM smart pointer. */ template <class ComClass> class ComSmartPtr { public: ComSmartPtr() throw() : p (0) {} ComSmartPtr (ComClass* const obj) : p (obj) { if (p) p->AddRef(); } ComSmartPtr (const ComSmartPtr<ComClass>& other) : p (other.p) { if (p) p->AddRef(); } ~ComSmartPtr() { release(); } operator ComClass*() const throw() { return p; } ComClass& operator*() const throw() { return *p; } ComClass* operator->() const throw() { return p; } ComSmartPtr& operator= (ComClass* const newP) { if (newP != 0) newP->AddRef(); release(); p = newP; return *this; } ComSmartPtr& operator= (const ComSmartPtr<ComClass>& newP) { return operator= (newP.p); } // Releases and nullifies this pointer and returns its address ComClass** resetAndGetPointerAddress() { release(); p = 0; return &p; } HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER) { HRESULT hr = ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress()); jassert (hr != CO_E_NOTINITIALIZED); // You haven't called CoInitialize for the current thread! return hr; } template <class OtherComClass> HRESULT QueryInterface (REFCLSID classUUID, ComSmartPtr<OtherComClass>& destObject) const { if (p == 0) return E_POINTER; return p->QueryInterface (classUUID, (void**) destObject.resetAndGetPointerAddress()); } template <class OtherComClass> HRESULT QueryInterface (ComSmartPtr<OtherComClass>& destObject) const { return this->QueryInterface (__uuidof (OtherComClass), destObject); } private: ComClass* p; void release() { if (p != 0) p->Release(); } ComClass** operator&() throw(); // private to avoid it being used accidentally }; //============================================================================== #define JUCE_COMRESULT HRESULT __stdcall //============================================================================== template <class ComClass> class ComBaseClassHelperBase : public ComClass { public: ComBaseClassHelperBase (unsigned int initialRefCount) : refCount (initialRefCount) {} virtual ~ComBaseClassHelperBase() {} ULONG __stdcall AddRef() { return ++refCount; } ULONG __stdcall Release() { const ULONG r = --refCount; if (r == 0) delete this; return r; } protected: ULONG refCount; JUCE_COMRESULT QueryInterface (REFIID refId, void** result) { if (refId == IID_IUnknown) return castToType <IUnknown> (result); *result = 0; return E_NOINTERFACE; } template <class Type> JUCE_COMRESULT castToType (void** result) { this->AddRef(); *result = dynamic_cast <Type*> (this); return S_OK; } }; /** Handy base class for writing COM objects, providing ref-counting and a basic QueryInterface method. */ template <class ComClass> class ComBaseClassHelper : public ComBaseClassHelperBase <ComClass> { public: ComBaseClassHelper (unsigned int initialRefCount = 1) : ComBaseClassHelperBase <ComClass> (initialRefCount) {} ~ComBaseClassHelper() {} JUCE_COMRESULT QueryInterface (REFIID refId, void** result) { if (refId == __uuidof (ComClass)) return this->template castToType <ComClass> (result); return ComBaseClassHelperBase <ComClass>::QueryInterface (refId, result); } }; #endif // JUCE_WIN32_COMSMARTPTR_H_INCLUDED
//****************************************************************************** /// /// @file backend/shape/truetype.h /// /// This module contains all defines, typedefs, and prototypes for `truetype.cpp`. /// /// @copyright /// @parblock /// /// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7. /// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd. /// /// POV-Ray 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, either version 3 of the /// License, or (at your option) any later version. /// /// POV-Ray 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 Affero General Public License for more details. /// /// You should have received a copy of the GNU Affero General Public License /// along with this program. If not, see <http://www.gnu.org/licenses/>. /// /// ---------------------------------------------------------------------------- /// /// POV-Ray is based on the popular DKB raytracer version 2.12. /// DKBTrace was originally written by David K. Buck. /// DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins. /// /// @endparblock /// //****************************************************************************** #ifndef TRUETYPE_H #define TRUETYPE_H #include "backend/scene/objects.h" namespace pov { class CSG; class Parser; class SceneData; /***************************************************************************** * Global preprocessor defines ******************************************************************************/ #define TTF_OBJECT (BASIC_OBJECT) /***************************************************************************** * Global typedefs ******************************************************************************/ typedef struct GlyphStruct *GlyphPtr; struct FontFileInfo; class TrueType : public ObjectBase { public: GlyphPtr glyph; /* (GlyphPtr) Pointer to the glyph */ DBL depth; /* Amount of extrusion */ TrueType(); virtual ~TrueType(); virtual ObjectPtr Copy(); virtual bool All_Intersections(const Ray&, IStack&, TraceThreadData *); virtual bool Inside(const Vector3d&, TraceThreadData *) const; virtual void Normal(Vector3d&, Intersection *, TraceThreadData *) const; virtual void Translate(const Vector3d&, const TRANSFORM *); virtual void Rotate(const Vector3d&, const TRANSFORM *); virtual void Scale(const Vector3d&, const TRANSFORM *); virtual void Transform(const TRANSFORM *); virtual void Compute_BBox(); static void ProcessNewTTF(CSG *Object, const char *filename, const int font_id, const UCS2 *text_string, DBL depth, const Vector3d& offset, Parser *parser, shared_ptr<SceneData>& sceneData); protected: bool Inside_Glyph(double x, double y, const GlyphStruct* glyph) const; int solve_quad(double *x, double *y, double mindist, DBL maxdist) const; void GetZeroOneHits(const GlyphStruct* glyph, const Vector3d& P, const Vector3d& D, DBL glyph_depth, double *t0, double *t1) const; bool GlyphIntersect(const Vector3d& P, const Vector3d& D, const GlyphStruct* glyph, DBL glyph_depth, const BasicRay &ray, IStack& Depth_Stack, TraceThreadData *Thread); }; void FreeFontInfo(FontFileInfo *ffi); } #endif
/******************************************************************************\ This file is part of the C! library. A.K.A the cbang library. Copyright (c) 2003-2019, Cauldron Development LLC Copyright (c) 2003-2017, Stanford University All rights reserved. The C! 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. The C! 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 C! library. If not, see <http://www.gnu.org/licenses/>. In addition, BSD licensing may be granted on a case by case basis by written permission from at least one of the copyright holders. You may request written permission by emailing the authors. For information regarding this software email: Joseph Coffland joseph@cauldrondevelopment.com \******************************************************************************/ #pragma once #include <cbang/Exception.h> #include <cbang/util/SmartFunctor.h> #include <cbang/util/Lockable.h> #include <cbang/log/Logger.h> namespace cb { /** * This class is like a smart pointer for Lockables. It guarantees that * the Lockable gets relocked when the SmartUnlock goes out of scope. This * makes unlocking safe when exceptions may be thrown. */ class SmartUnlock : public SmartConstFunctor<SmartUnlock> { const Lockable *lock; public: SmartUnlock(const Lockable *lock, bool alreadyUnlocked = false) : Super(this, &SmartUnlock::close, false), lock(lock) { if (!alreadyUnlocked) lock->unlock(); setEngaged(true); } protected: void close() const {lock->lock();} }; }
/* * GStreamer * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.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., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ /* Compatibility for OpenGL ES 2.0 */ #ifndef __GST_GL_ES2__ #define __GST_GL_ES2__ #include <glib.h> G_BEGIN_DECLS /* SUPPORTED */ //FIXME: #define GL_RGBA8 GL_RGBA #define GL_BGRA GL_RGBA #define GL_BGR GL_RGB #define GL_UNSIGNED_INT_8_8_8_8 GL_UNSIGNED_BYTE #define GL_UNSIGNED_INT_8_8_8_8_REV GL_UNSIGNED_BYTE //END FIXME /* UNSUPPORTED */ #define GL_YCBCR_MESA 0 #define GL_UNSIGNED_SHORT_8_8_MESA 0 #define GL_UNSIGNED_SHORT_8_8_MESA 0 #define GL_UNSIGNED_SHORT_8_8_REV_MESA 0 #define GL_COLOR_ATTACHMENT1 0 #define GL_COLOR_ATTACHMENT2 0 #define GL_TEXTURE_ENV 0 #define GL_TEXTURE_ENV_MODE 0 #define GL_DEPTH24_STENCIL8 0 G_END_DECLS #endif /* __GST_GL_ES2__ */
/******************************************************************************\ This file is part of the C! library. A.K.A the cbang library. Copyright (c) 2003-2019, Cauldron Development LLC Copyright (c) 2003-2017, Stanford University All rights reserved. The C! 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. The C! 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 C! library. If not, see <http://www.gnu.org/licenses/>. In addition, BSD licensing may be granted on a case by case basis by written permission from at least one of the copyright holders. You may request written permission by emailing the authors. For information regarding this software email: Joseph Coffland joseph@cauldrondevelopment.com \******************************************************************************/ #pragma once #include "FileLocation.h" namespace cb { class LocationRange { FileLocation start; FileLocation end; public: LocationRange() {} LocationRange(const FileLocation &loc) : start(loc), end(loc) {} LocationRange(const FileLocation &start, const FileLocation &end) : start(start), end(end) {} const FileLocation &getStart() const {return start;} FileLocation &getStart() {return start;} const FileLocation &getEnd() const {return end;} FileLocation &getEnd() {return end;} void print(std::ostream &stream) const; }; inline static std::ostream &operator<<(std::ostream &stream, const LocationRange &l) { l.print(stream); return stream; } }
/******************************************************************************\ This file is part of the C! library. A.K.A the cbang library. Copyright (c) 2003-2015, Cauldron Development LLC Copyright (c) 2003-2015, Stanford University All rights reserved. The C! 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. The C! 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 C! library. If not, see <http://www.gnu.org/licenses/>. In addition, BSD licensing may be granted on a case by case basis by written permission from at least one of the copyright holders. You may request written permission by emailing the authors. For information regarding this software email: Joseph Coffland joseph@cauldrondevelopment.com \******************************************************************************/ #ifndef CB_TAR_FILE_WRITER_H #define CB_TAR_FILE_WRITER_H #include "TarFile.h" #include <cbang/SmartPointer.h> #include <cbang/StdTypes.h> #include <ostream> #include <string> namespace cb { class TarFileWriter : public TarFile { struct private_t; private_t *pri; SmartPointer<std::ostream> stream; public: TarFileWriter(const std::string &path, std::ios::openmode mode, int perm = 0644, compression_t compression = TARFILE_AUTO); TarFileWriter(std::ostream &stream, compression_t compression); ~TarFileWriter(); void add(const std::string &path, const std::string &filename = std::string(), uint32_t mode = 0); void add(std::istream &in, const std::string &filename, uint64_t size, uint32_t mode = 0644); void add(const char *data, size_t size, const std::string &filename, uint32_t mode = 0644); using Tar::writeHeader; protected: void writeHeader(type_t type, const std::string &filename, uint64_t size, uint32_t mode); void addCompression(compression_t compression); }; } #endif // CB_TAR_FILE_WRITER_H
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2012 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 GLSLEDITOREDITABLE_H #define GLSLEDITOREDITABLE_H #include <texteditor/basetexteditor.h> namespace GLSLEditor { class GLSLTextEditorWidget; namespace Internal { class GLSLEditorEditable : public TextEditor::BaseTextEditor { Q_OBJECT public: explicit GLSLEditorEditable(GLSLTextEditorWidget *); bool duplicateSupported() const { return true; } Core::IEditor *duplicate(QWidget *parent); Core::Id id() const; bool isTemporary() const { return false; } bool open(QString *errorString, const QString &fileName, const QString &realFileName); Core::Id preferredModeType() const; }; } // namespace Internal } // namespace GLSLEditor #endif // GLSLEDITOREDITABLE_H
#ifndef _WNCKMM_WRAP_INIT_H #define _WNCKMM_WRAP_INIT_H /** This file is part of wnckmm Copyright (c) 2013 Povilas Kanapickas <povilas@radix.lt> 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/>. */ // wrap_init.cc is generated by tools/generate_wrap_init.pl namespace Wnck { void wrap_init(); } /* namespace Wnck */ #endif // _GDKMM_WRAP_INIT_H
/* * virsh-completer-network.c: virsh completer callbacks related to networks * * Copyright (C) 2019 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.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/>. */ #include <config.h> #include "virsh-completer-network.h" #include "viralloc.h" #include "virsh-network.h" #include "virsh.h" #include "virstring.h" char ** virshNetworkNameCompleter(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED, unsigned int flags) { virshControlPtr priv = ctl->privData; virNetworkPtr *nets = NULL; int nnets = 0; size_t i = 0; char **ret = NULL; VIR_AUTOSTRINGLIST tmp = NULL; virCheckFlags(VIR_CONNECT_LIST_NETWORKS_INACTIVE | VIR_CONNECT_LIST_NETWORKS_ACTIVE | VIR_CONNECT_LIST_NETWORKS_PERSISTENT, NULL); if (!priv->conn || virConnectIsAlive(priv->conn) <= 0) return NULL; if ((nnets = virConnectListAllNetworks(priv->conn, &nets, flags)) < 0) return NULL; if (VIR_ALLOC_N(tmp, nnets + 1) < 0) goto cleanup; for (i = 0; i < nnets; i++) { const char *name = virNetworkGetName(nets[i]); if (VIR_STRDUP(tmp[i], name) < 0) goto cleanup; } VIR_STEAL_PTR(ret, tmp); cleanup: for (i = 0; i < nnets; i++) virNetworkFree(nets[i]); VIR_FREE(nets); return ret; } char ** virshNetworkEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd ATTRIBUTE_UNUSED, unsigned int flags) { size_t i = 0; char **ret = NULL; VIR_AUTOSTRINGLIST tmp = NULL; virCheckFlags(0, NULL); if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0) goto cleanup; for (i = 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) { if (VIR_STRDUP(tmp[i], virshNetworkEventCallbacks[i].name) < 0) goto cleanup; } VIR_STEAL_PTR(ret, tmp); cleanup: return ret; } char ** virshNetworkPortUUIDCompleter(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED, unsigned int flags) { virshControlPtr priv = ctl->privData; virNetworkPtr net = NULL; virNetworkPortPtr *ports = NULL; int nports = 0; size_t i = 0; char **ret = NULL; virCheckFlags(0, NULL); if (!priv->conn || virConnectIsAlive(priv->conn) <= 0) return NULL; if (!(net = virshCommandOptNetwork(ctl, cmd, NULL))) return false; if ((nports = virNetworkListAllPorts(net, &ports, flags)) < 0) return NULL; if (VIR_ALLOC_N(ret, nports + 1) < 0) goto error; for (i = 0; i < nports; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; if (virNetworkPortGetUUIDString(ports[i], uuid) < 0 || VIR_STRDUP(ret[i], uuid) < 0) goto error; virNetworkPortFree(ports[i]); } VIR_FREE(ports); return ret; error: for (; i < nports; i++) virNetworkPortFree(ports[i]); VIR_FREE(ports); for (i = 0; i < nports; i++) VIR_FREE(ret[i]); VIR_FREE(ret); return NULL; }
/* Return information about the filesystem on which FILE resides. Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <_lfs_64.h> #include <string.h> #include <stddef.h> #include <sys/statfs.h> extern __typeof(statfs) __libc_statfs; /* Return information about the filesystem on which FILE resides. */ int statfs64 (const char *file, struct statfs64 *buf) { struct statfs buf32; if (__libc_statfs (file, &buf32) < 0) return -1; buf->f_type = buf32.f_type; buf->f_bsize = buf32.f_bsize; buf->f_blocks = buf32.f_blocks; buf->f_bfree = buf32.f_bfree; buf->f_bavail = buf32.f_bavail; buf->f_files = buf32.f_files; buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } libc_hidden_def(statfs64)
//SixTrackLib // //Authors: R. De Maria, G. Iadarola, D. Pellegrini, H. Jasim // //Copyright 2017 CERN. This software is distributed under the terms of the GNU //Lesser General Public License version 2.1, copied verbatim in the file //`COPYING''. // //In applying this licence, CERN does not waive the privileges and immunities //granted to it by virtue of its status as an Intergovernmental Organization or //submit itself to any jurisdiction. #ifndef _BEAM_ #define _BEAM_ #include "value.h" #include "particle.h" typedef struct Beam { uint64_t npart; Particle* particles; } Beam; #ifndef _GPUCODE #include <stdlib.h> Beam* Beam_new(uint64_t npart); #endif #endif
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtQml 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 QQUICKRECTANGLE_P_H #define QQUICKRECTANGLE_P_H #include "qquickitem.h" #include <QtGui/qbrush.h> #include <private/qtquickglobal_p.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class Q_AUTOTEST_EXPORT QQuickPen : public QObject { Q_OBJECT Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY penChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged) Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY penChanged) public: QQuickPen(QObject *parent=0); qreal width() const; void setWidth(qreal w); QColor color() const; void setColor(const QColor &c); bool pixelAligned() const; void setPixelAligned(bool aligned); bool isValid() const; Q_SIGNALS: void penChanged(); private: qreal m_width; QColor m_color; bool m_aligned : 1; bool m_valid : 1; }; class Q_AUTOTEST_EXPORT QQuickGradientStop : public QObject { Q_OBJECT Q_PROPERTY(qreal position READ position WRITE setPosition) Q_PROPERTY(QColor color READ color WRITE setColor) public: QQuickGradientStop(QObject *parent=0); qreal position() const; void setPosition(qreal position); QColor color() const; void setColor(const QColor &color); private: void updateGradient(); private: qreal m_position; QColor m_color; }; class Q_AUTOTEST_EXPORT QQuickGradient : public QObject { Q_OBJECT Q_PROPERTY(QQmlListProperty<QQuickGradientStop> stops READ stops) Q_CLASSINFO("DefaultProperty", "stops") public: QQuickGradient(QObject *parent=0); ~QQuickGradient(); QQmlListProperty<QQuickGradientStop> stops(); Q_SIGNALS: void updated(); private: void doUpdate(); private: QList<QQuickGradientStop *> m_stops; friend class QQuickRectangle; friend class QQuickGradientStop; }; class QQuickRectanglePrivate; class Q_AUTOTEST_EXPORT QQuickRectangle : public QQuickItem { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) Q_PROPERTY(QQuickGradient *gradient READ gradient WRITE setGradient RESET resetGradient) Q_PROPERTY(QQuickPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) public: QQuickRectangle(QQuickItem *parent=0); QColor color() const; void setColor(const QColor &); QQuickPen *border(); QQuickGradient *gradient() const; void setGradient(QQuickGradient *gradient); void resetGradient(); qreal radius() const; void setRadius(qreal radius); Q_SIGNALS: void colorChanged(); void radiusChanged(); protected: virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); private Q_SLOTS: void doUpdate(); private: Q_DISABLE_COPY(QQuickRectangle) Q_DECLARE_PRIVATE(QQuickRectangle) }; QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickPen) QML_DECLARE_TYPE(QQuickGradientStop) QML_DECLARE_TYPE(QQuickGradient) QML_DECLARE_TYPE(QQuickRectangle) QT_END_HEADER #endif // QQUICKRECTANGLE_P_H
// // Created by alex on 25/09/2015. // Missing functions inside shared lib #ifndef LUNATIC_LAPI_H #define LUNATIC_LAPI_H #include <lua.h> #include "lshared.h" int lapi_next(lua_State *L, lua_Object o, int i); #define lua_next(state, obj, index) lapi_next(state, obj, index); #endif //LUNATIC_LAPI_H
/* -*-c++-*- IfcPlusPlus - www.ifcplusplus.com - Copyright (C) 2011 Fabian Gerold * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #pragma once #include <vector> #include <map> #include <sstream> #include <string> #include "ifcpp/model/shared_ptr.h" #include "ifcpp/model/IfcPPObject.h" #include "ifcpp/model/IfcPPGlobal.h" #include "IfcRelDecomposes.h" class IFCPP_EXPORT IfcObjectDefinition; //ENTITY class IFCPP_EXPORT IfcRelNests : public IfcRelDecomposes { public: IfcRelNests(); IfcRelNests( int id ); ~IfcRelNests(); virtual shared_ptr<IfcPPObject> getDeepCopy( IfcPPCopyOptions& options ); virtual void getStepLine( std::stringstream& stream ) const; virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const; virtual void readStepArguments( const std::vector<std::wstring>& args, const boost::unordered_map<int,shared_ptr<IfcPPEntity> >& map ); virtual void setInverseCounterparts( shared_ptr<IfcPPEntity> ptr_self ); virtual void getAttributes( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes ); virtual void getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes ); virtual void unlinkFromInverseCounterparts(); virtual const char* className() const { return "IfcRelNests"; } // IfcRoot ----------------------------------------------------------- // attributes: // shared_ptr<IfcGloballyUniqueId> m_GlobalId; // shared_ptr<IfcOwnerHistory> m_OwnerHistory; //optional // shared_ptr<IfcLabel> m_Name; //optional // shared_ptr<IfcText> m_Description; //optional // IfcRelationship ----------------------------------------------------------- // IfcRelDecomposes ----------------------------------------------------------- // IfcRelNests ----------------------------------------------------------- // attributes: shared_ptr<IfcObjectDefinition> m_RelatingObject; std::vector<shared_ptr<IfcObjectDefinition> > m_RelatedObjects; };