text
stringlengths
4
6.14k
#include <stdio.h> int main(){ int currentGrade = 0; double currentGradeWeight = 0.0; int finalWorth = 0; double finalScoreWeight = 0.0; int finalScore = 0; int finalGrade = 0; double pointsOutOf = 100.0; printf("What is your current grade? "); scanf("%d", &currentGrade); printf("How much is the final worth? "); scanf("%d", &finalWorth); printf("What is your final exam score? "); scanf("%d", &finalScore); currentGradeWeight = (currentGrade / pointsOutOf) * (pointsOutOf - finalWorth); finalScoreWeight = (finalScore / pointsOutOf) * (finalWorth); finalGrade = (currentGradeWeight + finalScoreWeight) + 0.99; printf("Your final grade is %d", finalGrade); printf("%%"); return 0; }
/**************************************************************************** Copyright (c) 2013-2015 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CCDATAVISITOR_H__ #define __CCDATAVISITOR_H__ /// @cond DO_NOT_SHOW #include "platform/CCPlatformMacros.h" #include <string> NS_CC_BEGIN class Ref; class __Bool; class __Integer; class __Float; class __Double; class __String; class __Array; class __Dictionary; class __Set; /** * Visitor that helps to perform action that depends on polymorphic object type * * Use cases: * - data serialization, * - pretty printing of Ref* * - safe value reading from Array, __Dictionary, Set * * Usage: * 1. subclass DataVisitor * 2. overload visit() methods for object that you need to handle * 3. handle other objects in visitObject() * 4. pass your visitor to Object::acceptVisitor() */ class CC_DLL DataVisitor { public: /** * @js NA * @lua NA */ virtual ~DataVisitor() {} /** default method, called from non-overloaded methods and for unrecognized objects */ virtual void visitObject(const Ref *p) = 0; virtual void visit(const __Bool *p); virtual void visit(const __Integer *p); virtual void visit(const __Float *p); virtual void visit(const __Double *p); virtual void visit(const __String *p); virtual void visit(const __Array *p); virtual void visit(const __Dictionary *p); virtual void visit(const __Set *p); }; class CC_DLL PrettyPrinter : public DataVisitor { public: PrettyPrinter(int indentLevel = 0); virtual void clear(); virtual std::string getResult(); virtual void visitObject(const Ref *p); virtual void visit(const __Bool * p); virtual void visit(const __Integer *p); virtual void visit(const __Float *p); virtual void visit(const __Double *p); virtual void visit(const __String *p); virtual void visit(const __Array *p); virtual void visit(const __Dictionary *p); virtual void visit(const __Set *p); private: void setIndentLevel(int indentLevel); int _indentLevel; std::string _indentStr; std::string _result; }; /** * @endcond */ NS_CC_END /// @endcond #endif // __CCDATAVISITOR_H__
/* ** VelaTron, Copyright (C) 2001-2012 Mikhael Goikhman, migo@freeshell.org ** ** 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 _FULLSCREEN_H #define _FULLSCREEN_H extern int toggle_full_screen(); #endif
#include <SFML/Graphics/Font.hpp> namespace OstrichRiders { sf::Font &GetDefaultFont(); }
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $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 The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QBS_PROJECTFILEUPDATER_H #define QBS_PROJECTFILEUPDATER_H #include "projectdata.h" #include <tools/error.h> #include <tools/codelocation.h> #include <QStringList> namespace QbsQmlJS { namespace AST { class UiProgram; } } namespace qbs { namespace Internal { class ProjectFileUpdater { public: void apply(); CodeLocation itemPosition() const { return m_itemPosition; } int lineOffset() const { return m_lineOffset; } protected: ProjectFileUpdater(const QString &projectFile); QString projectFile() const { return m_projectFile; } void setLineOffset(int offset) { m_lineOffset = offset; } void setItemPosition(const CodeLocation &cl) { m_itemPosition = cl; } private: virtual void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) = 0; enum LineEndingType { UnknownLineEndings, UnixLineEndings, WindowsLineEndings, MixedLineEndings }; static LineEndingType guessLineEndingType(const QByteArray &text); static void convertToUnixLineEndings(QByteArray *text, LineEndingType oldLineEndings); static void convertFromUnixLineEndings(QByteArray *text, LineEndingType newLineEndings); const QString m_projectFile; CodeLocation m_itemPosition; int m_lineOffset; }; class ProjectFileGroupInserter : public ProjectFileUpdater { public: ProjectFileGroupInserter(const ProductData &product, const QString &groupName); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast); const ProductData m_product; const QString m_groupName; }; class ProjectFileFilesAdder : public ProjectFileUpdater { public: ProjectFileFilesAdder(const ProductData &product, const GroupData &group, const QStringList &files); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast); const ProductData m_product; const GroupData m_group; const QStringList m_files; }; class ProjectFileFilesRemover : public ProjectFileUpdater { public: ProjectFileFilesRemover(const ProductData &product, const GroupData &group, const QStringList &files); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast); const ProductData m_product; const GroupData m_group; const QStringList m_files; }; class ProjectFileGroupRemover : public ProjectFileUpdater { public: ProjectFileGroupRemover(const ProductData &product, const GroupData &group); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast); const ProductData m_product; const GroupData m_group; }; } // namespace Internal } // namespace qbs #endif // Include guard.
// stdafx.h : ±ê׼ϵͳ°üº¬ÎļþµÄ°üº¬Îļþ£¬ // »òÊǾ­³£Ê¹Óõ«²»³£¸ü¸ÄµÄ // ÌØ¶¨ÓÚÏîÄ¿µÄ°üº¬Îļþ // #pragma once #include "targetver.h" #define WIN32_LEAN_AND_MEAN // ´Ó Windows Í·ÎļþÖÐÅųý¼«ÉÙʹÓõÄÐÅÏ¢ // Windows Í·Îļþ: #include <WinSock2.h> #pragma comment(lib,"ws2_32.lib") // TODO: ÔÚ´Ë´¦ÒýÓóÌÐòÐèÒªµÄÆäËûÍ·Îļþ #include <boost/noncopyable.hpp> #include <boost/filesystem.hpp> #include <boost/unordered_map.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <boost/foreach.hpp> #include <boost/typeof/typeof.hpp> #ifdef _DEBUG #define KG_DEBUG_USE_DEBUG #else //#define KG_DEBUG_USE_RELEASE #endif #include <kg/debug.hpp> #include <kg/windows/console.hpp>
#include "cpm.h" write(fd, buf, nbytes) uchar fd; ushort nbytes; char * buf; { register struct fcb * fc; uchar size, offs, luid; short c; ushort count; char buffer[SECSIZE]; if(fd >= MAXFILE) return -1; fc = &_fcb[fd]; offs = CPMWCON; count = nbytes; switch(fc->use) { case U_PUN: while(nbytes--) { _sigchk(); bdos(CPMWPUN, *buf++); } return count; case U_LST: offs = CPMWLST; case U_CON: while(nbytes--) { _sigchk(); c = *buf++; bdos(offs, c); } return count; case U_WRITE: case U_RDWR: luid = getuid(); while(nbytes) { _sigchk(); setuid(fc->uid); offs = fc->rwp%SECSIZE; if((size = SECSIZE - offs) > nbytes) size = nbytes; _putrno(fc->ranrec, fc->rwp/SECSIZE); if(size == SECSIZE) { bdos(CPMSDMA, buf); #ifdef LARGE_MODEL bdos(CPMDSEG, (int)((long)buf >> 16)); /* set DMA segment */ #endif } else { bdos(CPMSDMA, buffer); #ifdef LARGE_MODEL bdos(CPMDSEG, (int)((long)buffer >> 16)); /* set DMA segment */ #endif buffer[0] = CPMETX; bmove(buffer, buffer+1, SECSIZE-1); bdos(CPMRRAN, fc); bmove(buf, buffer+offs, size); } if(bdos(CPMWRAN, fc)) break; buf += size; fc->rwp += size; nbytes -= size; setuid(luid); } setuid(luid); return count-nbytes; default: return -1; } } 
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com> // // 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 the mozilla.org home page #ifndef EIGEN_FIXEDSIZEVECTOR_H #define EIGEN_FIXEDSIZEVECTOR_H namespace Eigen { /** \class MaxSizeVector * \ingroup Core * * \brief The MaxSizeVector class. * * The %MaxSizeVector provides a subset of std::vector functionality. * * The goal is to provide basic std::vector operations when using * std::vector is not an option (e.g. on GPU or when compiling using * FMA/AVX, as this can cause either compilation failures or illegal * instruction failures). * * Beware: The constructors are not API compatible with these of * std::vector. */ template <typename T> class MaxSizeVector { public: // Construct a new MaxSizeVector, reserve n elements. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit MaxSizeVector(size_t n) : reserve_(n), size_(0), data_(static_cast<T*>(internal::aligned_malloc(n * sizeof(T)))) { for (size_t i = 0; i < n; ++i) { new (&data_[i]) T; } } // Construct a new MaxSizeVector, reserve and resize to n. // Copy the init value to all elements. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE MaxSizeVector(size_t n, const T& init) : reserve_(n), size_(n), data_(static_cast<T*>(internal::aligned_malloc(n * sizeof(T)))) { for (size_t i = 0; i < n; ++i) { new (&data_[i]) T(init); } } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~MaxSizeVector() { for (size_t i = 0; i < size_; ++i) { data_[i].~T(); } internal::aligned_free(data_); } void resize(size_t n) { eigen_assert(n <= reserve_); for (size_t i = size_; i < n; ++i) { new (&data_[i]) T; } for (size_t i = n; i < size_; ++i) { data_[i].~T(); } size_ = n; } // Append new elements (up to reserved size). EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void push_back(const T& t) { eigen_assert(size_ < reserve_); data_[size_++] = t; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& operator[] (size_t i) const { eigen_assert(i < size_); return data_[i]; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& operator[] (size_t i) { eigen_assert(i < size_); return data_[i]; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& back() { eigen_assert(size_ > 0); return data_[size_ - 1]; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& back() const { eigen_assert(size_ > 0); return data_[size_ - 1]; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void pop_back() { // NOTE: This does not destroy the value at the end the way // std::vector's version of pop_back() does. That happens when // the Vector is destroyed. eigen_assert(size_ > 0); size_--; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t size() const { return size_; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool empty() const { return size_ == 0; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* data() { return data_; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T* data() const { return data_; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* begin() { return data_; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* end() { return data_ + size_; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T* begin() const { return data_; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T* end() const { return data_ + size_; } private: size_t reserve_; size_t size_; T* data_; }; } // namespace Eigen #endif // EIGEN_FIXEDSIZEVECTOR_H
/****************************************************************************** ** Copyright (c) 2006-2017, Calaos. All Rights Reserved. ** ** This file is part of Calaos. ** ** Calaos 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. ** ** Calaos 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 Foobar; if not, write to the Free Software ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ** ******************************************************************************/ #ifndef EXTERNPROC_H #define EXTERNPROC_H #include "Utils.h" #include "Calaos.h" #include <jansson.h> #include "Jansson_Addition.h" namespace uvw { //Forward declare classes here to prevent long build time //because of uvw.hpp being header only class PipeHandle; class ProcessHandle; } /* * Small framing for messages * +-------+--------------+-------+------------+ * | START | TYPE | SIZE | DATA ..... | * | 0x2 | 0x1 reserved | 2bytes| | * +-------+--------------+-------+------------+ * * type is not used for now * size of data is max: 2 bytes : 65536 bytes of data */ class ExternProcMessage { public: ExternProcMessage(); ExternProcMessage(string data); bool isValid() const { return isvalid; } string getPayload() const { return payload; } void clear(); bool processFrameData(string &data); string getRawData(); enum TypeCode { TypeUnkown = 0x00, TypeMessage = 0x21, }; private: enum { StateReadHeader, StateReadPayload }; int state; int opcode; uint32_t payload_length; string payload; bool isvalid; }; class ExternProcServer: public sigc::trackable { public: ExternProcServer(string pathprefix); ~ExternProcServer(); void sendMessage(const string &data); void startProcess(const string &process, const string &name, const string &args = string()); void terminate(); sigc::signal<void, const string &> messageReceived; sigc::signal<void> processExited; sigc::signal<void> processConnected; private: std::shared_ptr<uvw::PipeHandle> ipcServer, pipe; string sockpath; string recv_buffer; ExternProcMessage currentFrame; std::shared_ptr<uvw::ProcessHandle> process_exe; string process_stdout; std::shared_ptr<uvw::PipeHandle> client; bool isStarted = false; bool hasFailedStarting = false; void processData(const string &data); }; class ExternProcClient: public sigc::trackable { public: ExternProcClient(int &argc, char **&argv); virtual ~ExternProcClient(); bool connectSocket(); void sendMessage(const string &data); //setup if called first and if false is returned, //process quit virtual bool setup(int &argc, char **&argv) = 0; virtual int procMain() = 0; //the main function is this one protected: virtual void readTimeout() = 0; virtual void messageReceived(const string &msg) = 0; //implement this when adding a file descriptor to the main loop //when something happens on this fd, this function is called. //return false to stop main loop, true otherwise virtual bool handleFdSet(int fd) { return true; } //minimal mainloop void run(int timeoutms = 5000); //append FD to be monitored by main loop void appendFd(int fd); void removeFd(int fd); //for external mainloop int getSocketFd() { return sockfd; } bool processSocketRecv(); //call if something needs to be read from socket private: string sockpath; string name; int sockfd; string recv_buffer; ExternProcMessage currentFrame; list<int> userFds; }; #define EXTERN_PROC_CLIENT_CTOR(class_name) \ class_name(int &__argc, char **&__argv): ExternProcClient(__argc, __argv) {} #define EXTERN_PROC_CLIENT_MAIN(class_name) \ int main(int argc, char **argv) \ { \ class_name inst(argc, argv); \ if (inst.setup(argc, argv)) \ return inst.procMain(); \ return 1; \ } #endif // EXTERNPROC_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 CONTEXTPANEWIDGETIMAGE_H #define CONTEXTPANEWIDGETIMAGE_H #include "qmleditorwidgets_global.h" #include "contextpanewidget.h" #include <qdrawutil.h> #include <QLabel> #include <QPointer> QT_BEGIN_NAMESPACE namespace Ui { class ContextPaneWidgetImage; class ContextPaneWidgetBorderImage; } class QLabel; class QSlider; QT_END_NAMESPACE namespace QmlJS { class PropertyReader; } namespace QmlEditorWidgets { class FileWidget; class PreviewLabel : public QLabel { Q_OBJECT public: PreviewLabel(QWidget *parent = 0); void setZoom(int); void setIsBorderImage(bool b); void setMargins(int left, int top, int right, int bottom); int leftMarging() const { return m_left; } int topMarging() const { return m_top; } int rightMarging() const { return m_right; } int bottomMarging() const { return m_bottom; } signals: void leftMarginChanged(); void topMarginChanged(); void bottomMarginChanged(); void rightMarginChanged(); protected: void paintEvent(QPaintEvent *event); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); void mouseMoveEvent(QMouseEvent * event); void leaveEvent(QEvent* event ); private: bool m_showBorders; int m_left, m_right, m_top, m_bottom; bool m_dragging_left; bool m_dragging_right; bool m_dragging_top; bool m_dragging_bottom; QPoint m_startPos; int m_zoom; bool m_borderImage; QLabel *m_hooverInfo; }; class PreviewDialog : public DragWidget { Q_OBJECT public: PreviewDialog(QWidget *parent = 0); void setPixmap(const QPixmap &p, int zoom = 1); void setZoom(int z); void setIsBorderImage(bool b); PreviewLabel *previewLabel() const; int zoom() { return m_zoom; } public slots: void onTogglePane(); void onSliderMoved(int value); protected: void wheelEvent(QWheelEvent* event); private: PreviewLabel *m_label; QSlider *m_slider; QLabel *m_zoomLabel; int m_zoom; QPixmap m_pixmap; bool m_borderImage; }; class QMLEDITORWIDGETS_EXPORT ContextPaneWidgetImage : public QWidget { Q_OBJECT public: explicit ContextPaneWidgetImage(QWidget *parent = 0, bool borderImage = false); ~ContextPaneWidgetImage(); void setProperties(QmlJS::PropertyReader *propertyReader); void setPath(const QString& path); PreviewDialog* previewDialog(); signals: void propertyChanged(const QString &, const QVariant &); void removeProperty(const QString &); void removeAndChangeProperty(const QString &, const QString &, const QVariant &, bool removeFirst); public slots: void onStretchChanged(); void onVerticalStretchChanged(); void onHorizontalStretchChanged(); void onFileNameChanged(); void onPixmapDoubleClicked(); void setPixmap(const QString &fileName); void onLeftMarginsChanged(); void onTopMarginsChanged(); void onBottomMarginsChanged(); void onRightMarginsChanged(); protected: void changeEvent(QEvent *e); void hideEvent(QHideEvent* event); void showEvent(QShowEvent* event); private: Ui::ContextPaneWidgetImage *ui; Ui::ContextPaneWidgetBorderImage *uiBorderImage; QString m_path; QPointer<PreviewDialog> m_previewDialog; FileWidget *m_fileWidget; QLabel *m_sizeLabel; bool m_borderImage; bool previewWasVisible; }; class LabelFilter: public QObject { Q_OBJECT public: LabelFilter(QObject* parent =0) : QObject(parent) {} signals: void doubleClicked(); protected: bool eventFilter(QObject *obj, QEvent *event); }; class WheelFilter: public QObject { Q_OBJECT public: WheelFilter(QObject* parent =0) : QObject(parent) {} void setTarget(QObject *target) { m_target = target; } protected: bool eventFilter(QObject *obj, QEvent *event); QObject *m_target; }; } //QmlDesigner #endif // CONTEXTPANEWIDGETIMAGE_H
// .................................................................... // teamplay.h - teamplay defines typedef enum { TM_NONE, TM_AUTO, TM_CASHMATCH, TM_GRABDALOOT, TM_GANGBANG // Ridah, 27-may-99, just normal deathmatch, but with Kings/Pins teams } teamplay_mode_t; typedef enum { TEAM_NONE, TEAM_1, TEAM_2, } teams_t; #define MAX_CASH_PLAYER 150 // make this a cvar? #define MAX_BAGCASH_PLAYER 200 // make this a cvar? // .................................................................... extern char *team_names[]; extern teamplay_mode_t teamplay_mode; extern int num_cash_items; extern int team_cash[3]; // cash per team, 0 is neutral so just ignore extern float last_safe_withdrawal[3]; extern float last_safe_deposit[3]; // .................................................................... // Spawn functions void SP_dm_cashspawn( edict_t *self ); void SP_dm_safebag( edict_t *self ); void SP_dm_props_banner (edict_t *self); // .................................................................... // Other declarations void Teamplay_ValidateSkin( edict_t *self ); qboolean Teamplay_ValidateJoinTeam( edict_t *self, int teamindex ); void Teamplay_InitTeamplay (void);
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-IEs" * found in "../support/ngap-r16.1.0/38413-g10.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ #include "NGAP_RRCState.h" /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static asn_oer_constraints_t asn_OER_type_NGAP_RRCState_constr_1 CC_NOTUSED = { { 0, 0 }, -1}; static asn_per_constraints_t asn_PER_type_NGAP_RRCState_constr_1 CC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static const asn_INTEGER_enum_map_t asn_MAP_NGAP_RRCState_value2enum_1[] = { { 0, 8, "inactive" }, { 1, 9, "connected" } /* This list is extensible */ }; static const unsigned int asn_MAP_NGAP_RRCState_enum2value_1[] = { 1, /* connected(1) */ 0 /* inactive(0) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_NGAP_RRCState_specs_1 = { asn_MAP_NGAP_RRCState_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_NGAP_RRCState_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 3, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_NGAP_RRCState_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NGAP_RRCState = { "RRCState", "RRCState", &asn_OP_NativeEnumerated, asn_DEF_NGAP_RRCState_tags_1, sizeof(asn_DEF_NGAP_RRCState_tags_1) /sizeof(asn_DEF_NGAP_RRCState_tags_1[0]), /* 1 */ asn_DEF_NGAP_RRCState_tags_1, /* Same as above */ sizeof(asn_DEF_NGAP_RRCState_tags_1) /sizeof(asn_DEF_NGAP_RRCState_tags_1[0]), /* 1 */ { &asn_OER_type_NGAP_RRCState_constr_1, &asn_PER_type_NGAP_RRCState_constr_1, NativeEnumerated_constraint }, 0, 0, /* Defined elsewhere */ &asn_SPC_NGAP_RRCState_specs_1 /* Additional specs */ };
/* Copyright (c) Christian Krippendorf * * This file is part of UMounter. * * UMounter 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. * * UMounter 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 Foobar. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UMOUNTER_AUTOMOUNTER_PRIVATE_H #define UMOUNTER_AUTOMOUNTER_PRIVATE_H struct _UMounterAutomounterPrivate { UMounterConfig *config; UMounterVolumes *volumes; UMounterRulesParser *rulesparser; }; #endif /* UMOUNTER_AUTOMOUNTER_PRIVATE_H */
#define DINT #include "../../SuiteSparse/UMFPACK/Source/umf_free.c"
#include "gsl_gsl_math.h" #include "gsl_gsl_cblas.h" #include "cblas_cblas.h" #include "cblas_error_cblas_l3.h" void cblas_chemm (const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const int M, const int N, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc) { #define BASE float #include "cblas_source_hemm.h" #undef BASE }
/* ---------------------------------------------------------------------- * YATS (http://github.com/Ifsttar/YATS). This file is part of YATS. * * YATS (Yet Another Traffic Simulation) is a simple and efficient * Traffic Simulator used for reasearch purpose * Copyright (C) 2013-2014 - IFSTTAR - Julien Saunier and Julien Gagneux * YATS 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. * * YATS 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 or * see <http://ww.gnu.org/licenses/> * * For more information, please consult: <http://github.com/Ifsttar/YATS> or * send an email to scientific.computing@ifsttar.fr * * To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton * Cité Descartes, Champs sur Marne F-77447 Marne la Vallée Cedex 2 FRANCE * or write to scientific.computing@ifsttar.fr * ----------------------------------------------------------------------*/ // stdafx.h : fichier Include pour les fichiers Include système standard, // ou les fichiers Include spécifiques aux projets qui sont utilisés fréquemment, // et sont rarement modifiés // #pragma once #include <stdio.h> //#include <tchar.h> #include <iostream> #include <cstdlib> //#include "stdlib.h" #include "SDL.h" #include <boost/filesystem.hpp> #include <vector> #include <sstream> #include <time.h> // math //#include <math.h> #include <cmath> // for the utilisation of Max() or min() fct #include <algorithm> // for the utilisation of string and file #include <string> #include <fstream> //#include <direct.h> // navigation dans les fichier windows _mkdir _rmdir #include <ctime> // SDLGFX #include <SDL_rotozoom.h> // classe interne au projet #include "PointSim.h" #include "Vehicle.h" #include "SourceSim.h" #include "Road.h" #include "TimerSDL.h" #include "NodeSim.h" #include "EnvironmentSim.h" #include "RoadLink.h" //#include "VueEnvSim.h" // TODO: faites référence ici aux en-têtes supplémentaires nécessaires au programme
/* * Copyright (C) 2015, Clarive Software, All Rights Reserved * * This file is part of clax. * * Clax 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. * * Clax 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 Clax. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CLAX_HTTP_H #define CLAX_HTTP_H #define MAX_ELEMENT_SIZE 2048 #include <stdio.h> #include <stdarg.h> #include "http-parser/http_parser.h" #include "multipart-parser-c/multipart_parser.h" #include "clax.h" #include "clax_ctx.h" #include "clax_util.h" #include "clax_http_multipart.h" typedef int (*clax_http_chunk_cb_t)(char *buf, size_t len, va_list a_list); typedef struct { enum http_method method; char url[MAX_ELEMENT_SIZE]; char path_info[MAX_ELEMENT_SIZE]; clax_kv_list_t headers; size_t content_length; unsigned char *body; size_t body_len; clax_kv_list_t query_params; clax_kv_list_t body_params; multipart_parser *multipart_parser; multipart_parser_settings multipart_callbacks; char multipart_boundary[70]; clax_http_multipart_list_t multiparts; int multipart_status; /* Flags */ char headers_done; char message_done; char is_complete; char continue_expected; } clax_http_request_t; typedef struct { unsigned int status_code; clax_kv_list_t headers; FILE *body_fh; clax_big_buf_t body; void (*body_cb)(void *ctx, clax_http_chunk_cb_t chunk_cb, ...); void *body_cb_ctx; } clax_http_response_t; typedef int (*recv_cb_t)(void *ctx, unsigned char *buf, size_t len); typedef int (*send_cb_t)(void *ctx, const unsigned char *buf, size_t len); /* Public */ void clax_http_request_init(clax_http_request_t *request, char *tempdir); void clax_http_request_free(clax_http_request_t *request); void clax_http_response_init(clax_http_response_t *response, char *tempdir, size_t max_size); void clax_http_response_free(clax_http_response_t *response); int clax_http_dispatch(clax_ctx_t *clax_ctx, send_cb_t send_cb, recv_cb_t recv_cb, void *ctx); int clax_http_is_proxy(clax_http_request_t *req); void clax_http_dispatch_proxy(clax_ctx_t *clax_ctx, http_parser *parser, clax_http_request_t *req, clax_http_response_t *res, recv_cb_t recv_cb, send_cb_t send_cb, void *ctx); const char *clax_http_extract_kv(const char *str, const char *key, size_t *len); int clax_http_chunked(char *buf, size_t len, va_list a_list_); /* Private */ void clax_http_parse_urlencoded(clax_kv_list_t *params, const char *buf, size_t len); int clax_http_write_response(void *ctx, send_cb_t send_cb, clax_http_response_t *response); int clax_http_read_parse(void *ctx, recv_cb_t recv_cb, http_parser *parser, clax_http_request_t *request); int clax_http_parse(http_parser *parser, clax_http_request_t *request, const char *buf, size_t len); const char *clax_http_status_message(int code); size_t clax_http_url_decode(char *str); int clax_http_check_basic_auth(char *header, char *username, char *password); #endif
/*------------------------------------------------------------------------- * * passwordcheck.c * * * Copyright (c) 2009-2010, PostgreSQL Global Development Group * * Author: Laurenz Albe <laurenz.albe@wien.gv.at> * * IDENTIFICATION * $PostgreSQL: pgsql/contrib/passwordcheck/passwordcheck.c,v 1.3 2010/02/26 02:00:32 momjian Exp $ * *------------------------------------------------------------------------- */ #include "postgres.h" #include <ctype.h> #ifdef USE_CRACKLIB #include <crack.h> #endif #include "commands/user.h" #include "fmgr.h" #include "libpq/md5.h" PG_MODULE_MAGIC; /* passwords shorter than this will be rejected */ #define MIN_PWD_LENGTH 8 extern void _PG_init(void); /* * check_password * * performs checks on an encrypted or unencrypted password * ereport's if not acceptable * * username: name of role being created or changed * password: new password (possibly already encrypted) * password_type: PASSWORD_TYPE_PLAINTEXT or PASSWORD_TYPE_MD5 (there * could be other encryption schemes in future) * validuntil_time: password expiration time, as a timestamptz Datum * validuntil_null: true if password expiration time is NULL * * This sample implementation doesn't pay any attention to the password * expiration time, but you might wish to insist that it be non-null and * not too far in the future. */ static void check_password(const char *username, const char *password, int password_type, Datum validuntil_time, bool validuntil_null) { int namelen = strlen(username); int pwdlen = strlen(password); char encrypted[MD5_PASSWD_LEN + 1]; int i; bool pwd_has_letter, pwd_has_nonletter; switch (password_type) { case PASSWORD_TYPE_MD5: /* * Unfortunately we cannot perform exhaustive checks on encrypted * passwords - we are restricted to guessing. (Alternatively, we * could insist on the password being presented non-encrypted, but * that has its own security disadvantages.) * * We only check for username = password. */ if (!pg_md5_encrypt(username, username, namelen, encrypted)) elog(ERROR, "password encryption failed"); if (strcmp(password, encrypted) == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("password must not contain user name"))); break; case PASSWORD_TYPE_PLAINTEXT: /* * For unencrypted passwords we can perform better checks */ /* enforce minimum length */ if (pwdlen < MIN_PWD_LENGTH) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("password is too short"))); /* check if the password contains the username */ if (strstr(password, username)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("password must not contain user name"))); /* check if the password contains both letters and non-letters */ pwd_has_letter = false; pwd_has_nonletter = false; for (i = 0; i < pwdlen; i++) { /* * isalpha() does not work for multibyte encodings but let's * consider non-ASCII characters non-letters */ if (isalpha((unsigned char) password[i])) pwd_has_letter = true; else pwd_has_nonletter = true; } if (!pwd_has_letter || !pwd_has_nonletter) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("password must contain both letters and nonletters"))); #ifdef USE_CRACKLIB /* call cracklib to check password */ if (FascistCheck(password, CRACKLIB_DICTPATH)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("password is easily cracked"))); #endif break; default: elog(ERROR, "unrecognized password type: %d", password_type); break; } /* all checks passed, password is ok */ } /* * Module initialization function */ void _PG_init(void) { /* activate password checks when the module is loaded */ check_password_hook = check_password; }
#ifndef __CQUIZMANAGER__H__ #define __CQUIZMANAGER__H__ #include <map> #include <thread> #include <time.h> #include "seasocks/PrintfLogger.h" #include "CUser.h" #include "CWsQuizHandler.h" class CQuizManager { private: typedef std::pair<std::string, CUser> PairUser; typedef std::map<std::string, CUser> MapUser; typedef MapUser::iterator MapUserIt; typedef MapUser::const_iterator MapUserCIt; public: CQuizManager(std::shared_ptr<seasocks::Logger> spLogger, std::shared_ptr<CWsQuizHandler> spWsQuizHandler); ~CQuizManager(void) throw(); private: void HandleMessageQuiz (const std::string& id, const std::string& mi, const nlohmann::json::const_iterator citJsData); void HandleDisconnectQuiz(const std::string& id); private: void ThreadTest(void); void ThreadTestOne(const bool good); std::string ThreadUser2Team(const std::string& user); void ThreadWait(const time_t waitSec); private: std::shared_ptr<CWsQuizHandler> m_spWsQuizHandler; std::shared_ptr<seasocks::Logger> m_spLogger; boost::signals2::connection m_WsQuizHandlerMessageConnection; boost::signals2::connection m_WsQuizHandlerDisconnectConnection; bool m_TestThreadStop; std::thread m_TestThread; std::mutex m_Lock; MapUser m_Users; }; #endif //__CQUIZMANAGER__H__
#ifndef CPLANEMESH_H #define CPLANEMESH_H // Lib #include "lib_core_global.h" // Foundations #include "CMesh.h" static const real DefaultPlaneMeshSize = 1.; static const int DefaultPlaneMeshQuadCount = 3; class LIB_CORE_SHARED_EXPORT CPlaneMesh : public CMesh { public: enum EnumPlaneAxis { ePlaneXY, ePlaneXZ, ePlaneYZ }; //! Constructeur CPlaneMesh(real dLength = DefaultPlaneMeshSize, real dWidth = DefaultPlaneMeshSize, int iLengthSquareCount = DefaultPlaneMeshQuadCount, int iWidthSquareCount = DefaultPlaneMeshQuadCount); void init( EnumPlaneAxis ePlaneAxis, real dLength, real dWidth, int iLengthSquareCount, int iWidthSquareCount, real fLengthTextureRepeat = 1.0, real fWidthTextureRepeat = 1.0) { m_ePlaneAxis = ePlaneAxis; m_dLength = dLength; m_dWidth = dWidth; m_iLengthQuadCount = iLengthSquareCount; m_iWidthQuadCount = iWidthSquareCount; m_fLengthTextureRepeat = fLengthTextureRepeat; m_fWidthTextureRepeat = fWidthTextureRepeat; update(); } //! Destructeur virtual ~CPlaneMesh(); protected: virtual void updateGeometry(); CSubMesh* m_pGridBuffer; EnumPlaneAxis m_ePlaneAxis; real m_dLength; real m_dWidth; int m_iLengthQuadCount; int m_iWidthQuadCount; real m_fLengthTextureRepeat; real m_fWidthTextureRepeat; }; #endif // CPLANEMESH_H
/* Copyright (C) 2015-2017 Olof Hagsand This file is part of GRIDEYE. GRIDEYE 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. GRIDEYE 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 GRIDEYE; see the file LICENSE. If not, see <http://www.gnu.org/licenses/>. This include file defines the API of a GRIDEYE plugin. The grideye_agent dynamically links and loads any plugin that is found in the plugin directory (typically /usr/local/lib/grideye). The copyright of a plugin is the author's own. The author may set any license he/she wishes. The act of loading a plugin with grideye_agent does not affect the copyright of the plugin, nor its license Likewise, the loading of a plugin does not affect the ownership or license of the grideye_agent which is stated at the top of thsi file. */ /* Version of grideye plugin. */ #define GRIDEYE_PLUGIN_VERSION 2 /* Version of grideye plugin. */ #define GRIDEYE_PLUGIN_MAGIC 0x3f687f03 /* Name of plugin init function (must be called this) */ #define PLUGIN_INIT_FN_V2 "grideye_plugin_init_v2" /* Type of plugin init function */ typedef void * (grideye_plugin_init_t)(int version); /* Type of plugin exit function */ typedef int (grideye_plugin_exit_t)(void); /* * The options defined in v2 are: * largefile, writefile, device */ /* Type of plugin generic setopt function */ typedef int (grideye_plugin_setopt_t)(const char *optname, char *value); /* Type of plugin test function */ typedef int (grideye_plugin_test_t)(char *instr, char **outstr); /* grideye agent plugin init struct for the api * Note: Implicit init function, see PLUGIN_INIT_FN_V2 */ struct grideye_plugin_api_v2{ /* Version. Should be 2 */ int gp_version; int gp_magic; /* Plugin name */ char *gp_name; /* test input and output format: xml, csv, json */ char *gp_input_format; char *gp_output_format; /* Generic setopt function */ grideye_plugin_setopt_t *gp_setopt_fn; /* Test function with xml|json input and output */ grideye_plugin_test_t *gp_test_fn; grideye_plugin_exit_t *gp_exit_fn; };
/* ======================================================================== D O O M R e t r o The classic, refined DOOM source port. For Windows PC. ======================================================================== Copyright © 1993-2022 by id Software LLC, a ZeniMax Media company. Copyright © 2013-2022 by Brad Harding <mailto:brad@doomretro.com>. DOOM Retro is a fork of Chocolate DOOM. For a list of credits, see <https://github.com/bradharding/doomretro/wiki/CREDITS>. This file is a part of DOOM Retro. DOOM Retro 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. DOOM Retro 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 DOOM Retro. If not, see <https://www.gnu.org/licenses/>. DOOM is a registered trademark of id Software LLC, a ZeniMax Media company, in the US and/or other countries, and is used without permission. All other trademarks are the property of their respective holders. DOOM Retro is in no way affiliated with nor endorsed by id Software. ======================================================================== */ #include "m_misc.h" int myargc; char **myargv; // // M_CheckParm // Checks for the given parameter // in the program's command line arguments. // Returns the argument number (1 to argc-1) // or 0 if not present // int M_CheckParmWithArgs(const char *check, int num_args, int start) { for (int i = start; i < myargc - num_args; i++) if (M_StringCompare(check, myargv[i])) return i; return 0; } int M_CheckParmsWithArgs(const char *check1, const char *check2, const char *check3, int num_args, int start) { for (int i = start; i < myargc - num_args; i++) if ((*check1 && M_StringCompare(check1, myargv[i])) || (*check2 && M_StringCompare(check2, myargv[i])) || (*check3 && M_StringCompare(check3, myargv[i]))) return i; return 0; } int M_CheckParm(const char *check) { return M_CheckParmWithArgs(check, 0, 1); }
/** * us_timer.h : Microsecond timer * Copyright (C) 2019 Appiko * * 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/>. */ /** * @addtogroup group_peripheral_modules * @{ * * @defgroup group_us_timer Microsecond timer * @brief Driver to use micro-second timers using the TIMER peripheral * * @note This module utilizes the PCLK1M clock for its functioning * @{ */ #ifndef CODEBASE_PERIPHERAL_MODULES_US_TIMER_H_ #define CODEBASE_PERIPHERAL_MODULES_US_TIMER_H_ #include <stdint.h> #include <stdbool.h> #include "nrf.h" #include "nrf_peripherals.h" #include "common_util.h" #if SYS_CFG_PRESENT == 1 #include "sys_config.h" #endif #ifndef TIMER_USED_US_TIMER #define TIMER_USED_US_TIMER 3 #endif /** Specify which TIMER peripheral would be used for the us timer module */ #define US_TIMER_USED TIMER_USED_US_TIMER ///The number of CC registers in the TIMER peripheral used for us timer #define US_TIMER_CC_COUNT CONCAT_3(TIMER, US_TIMER_USED, _CC_NUM) /** * @brief Enumeration used for specifying the timers that can be used with this TIMER peripheral */ typedef enum { US_TIMER0, //!< Microsecond Timer 0 US_TIMER1, //!< Microsecond Timer 1 US_TIMER2, //!< Microsecond Timer 2 US_TIMER3, //!< Microsecond Timer 3 #if (US_TIMER_CC_COUNT == 6) US_TIMER4, //!< Microsecond Timer 4 US_TIMER5, //!< Microsecond Timer 5 #endif US_TIMER_MAX//!< Not a timer, just used to find the number of timers }us_timer_num; /** * @brief Enumeration to specify the mode of operation of the timer */ typedef enum { US_SINGLE_CALL, //!< One shot call of the timer US_REPEATED_CALL//!< Repeated call of the timer }us_timer_mode; /** * @brief Initialize the TIMER peripheral to use as a micro-second timer. * @param irq_priority The priority of the interrupt level at which the callback * function is called */ void us_timer_init(uint32_t irq_priority); /** * Start a micro-second timer * @param id ID of the timer to be used from @ref us_timer_num * @param mode Mode of the timer as specified in @ref us_timer_mode * @param time_us The number microseconds after which the timer expires * @param handler Pointer to a function which needs to be called when the timer expires * * @note Starting an already started will restart the timer with the current number of ticks passed. * @ref us_timer_get_on_status can be used to check if a timer is already running. */ void us_timer_start(us_timer_num id, us_timer_mode mode, uint32_t time_us, void (*handler)(void)); /** * Stop a micro-second timer * @param id ID of the timer to be stopped * * @note Stopping an already stopped timer will not be an issue */ void us_timer_stop(us_timer_num id); /** * Returns if a timer is on * @param id ID of timer being enquired * @return Boolean value indicating if a timer is ON */ bool us_timer_get_on_status(us_timer_num id); #endif /* CODEBASE_PERIPHERAL_MODULES_US_TIMER_H_ */ /** * @} * @} */
/* ** Copyright 2008 Luke Hodkinson ** ** This file is part of pcu. ** ** pcu 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. ** ** pcu 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 pcu. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <string.h> #include <assert.h> #include <mpi.h> #include "types.h" #include "utils.h" #include "source.h" #include "test.h" #include "suite.h" void pcu_source_init( pcu_source_t* src ) { assert( src ); memset( src, 0, sizeof(pcu_source_t) ); } pcu_source_t* pcu_source_create( int result, const char* type, const char* file, int line, const char* expr, const char* msg, pcu_test_t* test ) { pcu_source_t* src; src = (pcu_source_t*)malloc( sizeof(pcu_source_t) ); src->result = result; src->type = pcu_strdup( type ); src->file = pcu_strdup( file ); src->line = line; src->expr = pcu_strdup( expr ); src->msg = pcu_strdup( msg ); src->test = test; src->next = NULL; MPI_Comm_rank( MPI_COMM_WORLD, &src->rank ); return src; } int pcu_source_getPackLen( pcu_source_t* src ) { int len = 0; len += sizeof(int); len += sizeof(int); len += strlen( src->type ) + 1; len += sizeof(int); len += strlen( src->file ) + 1; len += sizeof(int); len += sizeof(int); len += strlen( src->expr ) + 1; len += sizeof(int); if( src->msg ) len += strlen( src->msg ) + 1; len += sizeof(int); return len; } void pcu_source_pack( pcu_source_t* src, void* buf ) { char* tmp = (char*)buf; int len; assert( tmp ); *((int*)tmp) = src->result; tmp += sizeof(int); len = strlen( src->type ) + 1; *((int*)tmp) = len; tmp += sizeof(int); memcpy( tmp, src->type, len * sizeof(char) ); tmp += len; len = strlen( src->file ) + 1; *((int*)tmp) = len; tmp += sizeof(int); memcpy( tmp, src->file, len * sizeof(char) ); tmp += len; *((int*)tmp) = src->line; tmp += sizeof(int); len = strlen( src->expr ) + 1; *((int*)tmp) = len; tmp += sizeof(int); memcpy( tmp, src->expr, len * sizeof(char) ); tmp += len; if( src->msg ) { len = strlen( src->msg ) + 1; *((int*)tmp) = len; tmp += sizeof(int); memcpy( tmp, src->msg, len * sizeof(char) ); tmp += len; } else { *((int*)tmp) = 0; tmp += sizeof(int); } *((int*)tmp) = src->rank; tmp += sizeof(int); } void pcu_source_unpack( pcu_source_t* src, void* buf ) { char* tmp = (char*)buf; int len; pcu_source_clear( src ); src->result = *(int*)tmp; tmp += sizeof(int); len = *(int*)tmp; tmp += sizeof(int); src->type = pcu_memdup( tmp, len ); tmp += len; len = *(int*)tmp; tmp += sizeof(int); src->file = pcu_memdup( tmp, len ); tmp += len; src->line = *(int*)tmp; tmp += sizeof(int); len = *(int*)tmp; tmp += sizeof(int); src->expr = pcu_memdup( tmp, len ); tmp += len; len = *(int*)tmp; tmp += sizeof(int); if( len ) { src->msg = pcu_memdup( tmp, len ); tmp += len; } src->rank = *(int*)tmp; tmp += sizeof(int); src->next = NULL; } void pcu_source_clear( pcu_source_t* src ) { assert( src ); if( src->type ) { free( src->type ); src->type = NULL; } if( src->file ) { free( src->file ); src->file = NULL; } if( src->expr ) { free( src->expr ); src->expr = NULL; } if( src->msg ) { free( src->msg ); src->msg = NULL; } }
/* * This file is part of 'turbobrain'. * * 'turbobrain' 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. * * 'turbobrain' 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 'turbobrain'. If not, see http://www.gnu.org/licenses/. */ #ifndef fungus_ptr_h #define fungus_ptr_h template<typename T> using ptr = T *; template<typename T> using ptr_const = T const *; #endif
/* -*-objc-*- NSRulerView.h The NSRulerView class. Copyright (C) 1999-2002 Free Software Foundation, Inc. Author: Michael Hanni <mhanni@sprintmail.com> Date: Feb 1999 Author: Fred Kiefer <FredKiefer@gmx.de> Date: Sept 2001 Author: Diego Kreutz (kreutz@inf.ufsm.br) Date: January 2002 This file is part of the GNUstep GUI Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/> or write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GNUstep_H_NSRulerView #define _GNUstep_H_NSRulerView #include <AppKit/NSView.h> /* Declaring classes, rather than #including the full class header, * results in much faster compilations. */ @class NSScrollView; @class NSString; @class NSArray; @class NSRulerMarker; @class NSCoder; @class NSEvent; typedef enum { NSHorizontalRuler, NSVerticalRuler } NSRulerOrientation; @class GSRulerUnit; @interface NSRulerView : NSView { GSRulerUnit *_unit; NSScrollView *_scrollView; NSView *_clientView; // Not retained NSView *_accessoryView; float _originOffset; NSMutableArray *_markers; NSRulerOrientation _orientation; float _ruleThickness; float _reservedThicknessForAccessoryView; float _reservedThicknessForMarkers; /* Cached values. It's a little expensive to calculate them and they * change only when the unit or the originOffset is changed or when * clientView changes it's size or zooming factor. This cache is * invalidated by -invalidateHashMarks method. */ BOOL _cacheIsValid; float _markDistance; float _labelDistance; int _marksToBigMark; int _marksToMidMark; int _marksToLabel; float _UNUSED; float _unitToRuler; NSString *_labelFormat; } - (id) initWithScrollView: (NSScrollView *)aScrollView orientation: (NSRulerOrientation)o; + (void) registerUnitWithName: (NSString *)uName abbreviation:(NSString *)abbreviation unitToPointsConversionFactor:(float)conversionFactor stepUpCycle:(NSArray *)stepUpCycle stepDownCycle:(NSArray *)stepDownCycle; - (void) setMeasurementUnits: (NSString *)uName; - (NSString *) measurementUnits; - (void) setClientView: (NSView *)aView; - (NSView *) clientView; - (void) setAccessoryView: (NSView *)aView; - (NSView *) accessoryView; - (void) setOriginOffset: (float)offset; - (float) originOffset; - (void) setMarkers: (NSArray *)newMarkers; - (NSArray *) markers; - (void) addMarker: (NSRulerMarker *)aMarker; - (void) removeMarker: (NSRulerMarker *)aMarker; - (BOOL) trackMarker: (NSRulerMarker *)aMarker withMouseEvent: (NSEvent *)theEvent; - (void) moveRulerlineFromLocation: (float)oldLoc toLocation: (float)newLoc; - (void) drawHashMarksAndLabelsInRect: (NSRect)aRect; - (void) drawMarkersInRect: (NSRect)aRect; - (void) invalidateHashMarks; - (void) setScrollView:(NSScrollView *) scrollView; - (NSScrollView *) scrollView; - (void) setOrientation: (NSRulerOrientation)o; - (NSRulerOrientation) orientation; - (void) setReservedThicknessForAccessoryView: (float)thickness; - (float) reservedThicknessForAccessoryView; - (void) setReservedThicknessForMarkers: (float)thickness; - (float) reservedThicknessForMarkers; - (void) setRuleThickness: (float)thickness; - (float) ruleThickness; - (float) requiredThickness; - (float) baselineLocation; - (BOOL) isFlipped; @end /* * Methods Implemented by the client view ... FIXME/TODO: we currently * do not send all these messages to the client view ... while we * should! */ @interface NSObject (NSRulerViewClientView) - (void)rulerView: (NSRulerView *)aRulerView didAddMarker: (NSRulerMarker *)aMarker; - (void)rulerView: (NSRulerView *)aRulerView didMoveMarker: (NSRulerMarker *)aMarker; - (void)rulerView: (NSRulerView *)aRulerView didRemoveMarker: (NSRulerMarker *)aMarker; - (void)rulerView: (NSRulerView *)aRulerView handleMouseDown: (NSEvent *)theEvent; - (BOOL)rulerView: (NSRulerView *)aRulerView shouldAddMarker: (NSRulerMarker *)aMarker; - (BOOL)rulerView: (NSRulerView *)aRulerView shouldMoveMarker: (NSRulerMarker *)aMarker; - (BOOL)rulerView: (NSRulerView *)aRulerView shouldRemoveMarker: (NSRulerMarker *)aMarker; - (float)rulerView: (NSRulerView *)aRulerView willAddMarker: (NSRulerMarker *)aMarker atLocation: (float)location; - (float)rulerView: (NSRulerView *)aRulerView willMoveMarker: (NSRulerMarker *)aMarker toLocation: (float)location; - (void)rulerView: (NSRulerView *)aRulerView willSetClientView: (NSView *)newClient; @end #endif /* _GNUstep_H_NSRulerView */
/* * Copyright (C) 2014 Henrik Fröhling * * Snipit 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. * * Snipit 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 Snipit; if not, see * <http://www.gnu.org/licenses>. */ #ifndef SNIPIT_UI_DIALOGS_ADDNEWPROJECTDIALOG_H #define SNIPIT_UI_DIALOGS_ADDNEWPROJECTDIALOG_H #include "ui/dialogs/adddialog.h" class QDateTimeEdit; class QGroupBox; class QHBoxLayout; class QLabel; class QLineEdit; class QRadioButton; class QTextEdit; class QVBoxLayout; namespace ui { namespace dialogs { class AddNewProjectDialog final : public AddDialog { Q_OBJECT public: explicit AddNewProjectDialog(QWidget *parent = nullptr); explicit AddNewProjectDialog(int languageID, QWidget *parent = nullptr); ~AddNewProjectDialog(); private slots: void onRdBtnAutomaticCreatedClicked(); void onRdBtnAutomaticModifiedClicked(); void onRdBtnManualCreatedClicked(); void onRdBtnManualModifiedClicked(); void onBtnSaveClicked() override final; private: QLabel *m_pLblName; QLabel *m_pLblVersion; QLabel *m_pLblDescription; QLineEdit *m_pTxtName; QDateTimeEdit *m_pDTCreated; QDateTimeEdit *m_pDTModified; QLineEdit *m_pTxtVersion; QTextEdit *m_pTxtDescription; QGroupBox *m_pGrpBoxCreated; QGroupBox *m_pGrpBoxModified; QVBoxLayout *m_pVLayoutGrpBoxCreated; QVBoxLayout *m_pVLayoutGrpBoxModified; QRadioButton *m_pRdBtnAutomaticCreated; QRadioButton *m_pRdBtnManualCreated; QRadioButton *m_pRdBtnAutomaticModified; QRadioButton *m_pRdBtnManualModified; QHBoxLayout *m_pHLayoutCreated; QHBoxLayout *m_pHLayoutModified; }; } // end namespace dialogs } // end namespace ui #endif // SNIPIT_UI_DIALOGS_ADDNEWPROJECTDIALOG_H
/* Ventistipes * Copyright (C) 2013 Toon Schoenmakers * * 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 "safefree.h" #include <stdlib.h> void safefree(void **pp) { if (pp) { free(*pp); *pp = NULL; } }
/* * mach-x6410.c * * Copyright (c) 2007-2010 jianjun jiang <jerryjianjun@gmail.com> * official site: http://xboot.org * * 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 * */ #include <xboot.h> #include <s3c6410-cp15.h> #include <s3c6410/reg-gpio.h> #include <s3c6410/reg-wdg.h> extern u8_t __text_start[]; extern u8_t __text_end[]; extern u8_t __romdisk_start[]; extern u8_t __romdisk_end[]; extern u8_t __data_shadow_start[]; extern u8_t __data_shadow_end[]; extern u8_t __data_start[]; extern u8_t __data_end[]; extern u8_t __bss_start[]; extern u8_t __bss_end[]; extern u8_t __heap_start[]; extern u8_t __heap_end[]; extern u8_t __stack_start[]; extern u8_t __stack_end[]; static void mach_init(void) { /* gpk0 high level for power lock */ writel(S3C6410_GPKCON0, (readl(S3C6410_GPKCON0) & ~(0xf<<0)) | (0x1<<0)); writel(S3C6410_GPKPUD, (readl(S3C6410_GPKPUD) & ~(0x3<<0)) | (0x2<<0)); writel(S3C6410_GPKDAT, (readl(S3C6410_GPKDAT) & ~(0x1<<0)) | (0x1<<0)); } static bool_t mach_sleep(void) { return FALSE; } static bool_t mach_halt(void) { /* gpk0 low level for power down */ writel(S3C6410_GPKCON0, (readl(S3C6410_GPKCON0) & ~(0xf<<0)) | (0x1<<0)); writel(S3C6410_GPKPUD, (readl(S3C6410_GPKPUD) & ~(0x3<<0)) | (0x2<<0)); writel(S3C6410_GPKDAT, (readl(S3C6410_GPKDAT) & ~(0x1<<0)) | (0x0<<0)); return TRUE; } static bool_t mach_reset(void) { /* disable watchdog */ writel(S3C6410_WTCON, 0x0000); /* initialize watchdog timer count register */ writel(S3C6410_WTCNT, 0x0001); /* enable watchdog timer; assert reset at timer timeout */ writel(S3C6410_WTCON, 0x0021); return TRUE; } static enum mode_t mach_getmode(void) { u32_t gpn; /* set gpn5 intput and pull up */ writel(S3C6410_GPNCON, (readl(S3C6410_GPNCON) & ~(0x3<<10)) | (0x0<<10)); writel(S3C6410_GPNPUD, (readl(S3C6410_GPNPUD) & ~(0x3<<10)) | (0x2<<10)); /* gpn5 with key down */ gpn = readl(S3C6410_GPNDAT) & 0x20; if(gpn != 0x20) return MODE_MENU; return MODE_MENU; } static bool_t mach_batinfo(struct battery_info * info) { if(!info) return FALSE; info->charging = FALSE; info->voltage = 3700; info->current = 300; info->temperature = 200; info->capacity = 100; return TRUE; } static bool_t mach_cleanup(void) { /* disable irq */ irq_disable(); /* disable fiq */ fiq_disable(); /* disable icache */ icache_disable(); /* disable dcache */ dcache_disable(); /* disable mmu */ mmu_disable(); /* disable vic */ vic_disable(); return TRUE; } static bool_t mach_authentication(void) { return TRUE; } /* * A portable machine interface. */ static struct machine x6410 = { .info = { .board_name = "x6410", .board_desc = "the 9tripod's development board", .board_id = "0", .cpu_name = "s3c6410x", .cpu_desc = "based on arm11 by samsung", .cpu_id = "0x410fb760", }, .res = { .mem_banks = { [0] = { .start = 0x50000000, .end = 0x50000000 + SZ_128M - 1, }, [1] = { .start = 0, .end = 0, }, }, .xtal = 12*1000*1000, }, .link = { .text_start = (const ptrdiff_t)__text_start, .text_end = (const ptrdiff_t)__text_end, .romdisk_start = (const ptrdiff_t)__romdisk_start, .romdisk_end = (const ptrdiff_t)__romdisk_end, .data_shadow_start = (const ptrdiff_t)__data_shadow_start, .data_shadow_end = (const ptrdiff_t)__data_shadow_end, .data_start = (const ptrdiff_t)__data_start, .data_end = (const ptrdiff_t)__data_end, .bss_start = (const ptrdiff_t)__bss_start, .bss_end = (const ptrdiff_t)__bss_end, .heap_start = (const ptrdiff_t)__heap_start, .heap_end = (const ptrdiff_t)__heap_end, .stack_start = (const ptrdiff_t)__stack_start, .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { .init = mach_init, .sleep = mach_sleep, .halt = mach_halt, .reset = mach_reset, }, .misc = { .getmode = mach_getmode, .batinfo = mach_batinfo, .cleanup = mach_cleanup, .authentication = mach_authentication, }, .priv = NULL, }; static __init void mach_x6410_init(void) { if(!register_machine(&x6410)) LOG_E("failed to register machine 'x6410'"); } module_init(mach_x6410_init, LEVEL_MACH);
/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Network Auth module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef REDDITMODEL_H #define REDDITMODEL_H #include "redditwrapper.h" #include <QtCore> QT_FORWARD_DECLARE_CLASS(QNetworkReply) class RedditModel : public QAbstractTableModel { Q_OBJECT public: RedditModel(QObject *parent = nullptr); RedditModel(const QString &clientId, QObject *parent = nullptr); virtual int rowCount(const QModelIndex &parent) const override; virtual int columnCount(const QModelIndex &parent) const override; virtual QVariant data(const QModelIndex &index, int role) const override; void grant(); signals: void error(const QString &errorString); private slots: void update(); private: RedditWrapper redditWrapper; QPointer<QNetworkReply> liveThreadReply; QList<QJsonObject> threads; }; #endif // REDDITMODEL_H
/* * libEtPan! -- a mail stuff library * * Copyright (C) 2001, 2005 - DINH Viet Hoa * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the libEtPan! project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. */ /* * $Id: mailsmtp_ssl.c,v 1.16 2006/12/26 13:13:25 hoa Exp $ */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include "mailsmtp_socket.h" #include "mailsmtp.h" #include "connect.h" #include <stdlib.h> #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #define DEFAULT_SMTPS_PORT 465 #define SERVICE_NAME_SMTPS "smtps" #define SERVICE_TYPE_TCP "tcp" int mailsmtp_ssl_connect(mailsmtp * session, const char * server, uint16_t port) { return mailsmtp_ssl_connect_with_callback(session, server, port, NULL, NULL); } int mailsmtp_ssl_connect_with_callback(mailsmtp * session, const char * server, uint16_t port, void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data) { int s; mailstream * stream; if (port == 0) { port = mail_get_service_port(SERVICE_NAME_SMTPS, SERVICE_TYPE_TCP); if (port == 0) port = DEFAULT_SMTPS_PORT; } /* Connection */ s = mail_tcp_connect(server, port); if (s == -1) return MAILSMTP_ERROR_CONNECTION_REFUSED; stream = mailstream_ssl_open(s); if (stream == NULL) { close(s); return MAILSMTP_ERROR_SSL; } return mailsmtp_connect(session, stream); }
/* * mbserver : Modbus interface for temperature sensors CRYCON18, SI-9300 * and SI Twickenham (or any similar) using Stéphane Raimbault's * <stephane.raimbault@gmail.com> Modbus C library libmodbus * * Copyright © 2013 Jesus Vasquez <jesusvasquez333@gmail.com> * * This file is part of mbserver. * * mbserver 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. * * mbserver 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 mbserver. If not, see <http://www.gnu.org/licenses/>. * * Version 1.0 * This version reads the temperature values from any of the configured * instrument at a fixed, defined rate and then writes these value onto * local memory that can be access from a remote Modbus/TCP client. * * Author: Jesus Vasquez * Created on: Jun 04, 2013 * Contact: jesusvasquez333@gmail.com * */ /*************************************************************/ /*********** OUTPUT ERROR CODE DEFINITIONS *******************/ /*************************************************************/ #define NO_ERR_CODE 0 // No error #define ERR_CODE_INVALID_TCP_PORT -1 // Invalid TCP port on configuration file #define ERR_CODE_INVALID_IP_ADDESS -2 // Invalid IP Addess on configuration file #define ERR_CODE_NO_SERVERS -3 // No server configured #define ERR_CODE_TOOMANY_SERVERS -4 // Too many server on configuration files #define ERR_CODE_THR_MALLOC_FAIL -5 // Thread allocation fail #define ERR_CODE_MB_MALLOC_FAIL -6 // Modbus memory mapping allocation fail #define ERR_CODE_TCP_THRPAR_MALLOC_FAIL -7 // TCP thread parameter allocation fail #define ERR_CODE_RS1_THRPAR_MALLOC_FAIL -8 // RS232 (type 1) thread parameter allocation fail #define ERR_CODE_RS2_THRPAR_MALLOC_FAIL -9 // RS232 (type 2) thread parameter allocation fail #define ERR_CODE_MB_CON_ALLOC_FAIL -10 // Libmodbus context allocation fail #define ERR_CODE_SELECT_FAIL -11 // Select() function fail #define ERR_CODE_SERIAL_PORT_OPEN_FAIL -12 // Error opening serial port #define ERR_SIGNAL_CAPTURE -20 // End signal captured
/** * D-LAN - A decentralized LAN file sharing software. * Copyright (C) 2010-2012 Greg Burri <greg.burri@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 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 DOWNLOADMANAGER_CONSTANTS_H #define DOWNLOADMANAGER_CONSTANTS_H #include <QString> namespace DM { const int RETRY_PEER_GET_HASHES_PERIOD = 10000; // [ms]. If the hashes cannot be retrieve frome a peer, we wait 10s before retrying. const int RETRY_GET_ENTRIES_PERIOD = 10000; // [ms]. If a directory can't be browsed, we wait 10s before retrying. const int RESTART_DOWNLOADS_PERIOD_IF_ERROR = 10000; // [ms]. If one or more download has a status >= 0x20 then it will be restarted periodically. // 2 -> 3 : BLAKE -> Sha-1 // 3 -> 4 : Replace Entry::complete by a status. const int FILE_QUEUE_VERSION = 4; } #endif
/* * CALCView is a Calc Block Editor * Copyright (C) 2003 * * Created by Tod Baudais * * This file is part of CALCView. * * CALCView 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. * * CALCView 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 CALCView. If not, see <http://www.gnu.org/licenses/>. */ // // File: Instruction_LAC.java // /* LAC Mxx (Load Accumulator) LAC Mxx loads the accumulator with contents of memory location xx, where xx is a one or two digit number, between 01 and 24 (or 1 and 24), that specifies the specific memory register whose contents are to be loaded into the accumulator. sptr(after) = sptr(before) + 1. CHECKED: March 28, 2003 */ #include "Instruction_Interface.h" struct Instruction_LAC: public Instruction_Interface { Instruction_LAC() { } void Run (Steps_Table_Model &steps, Stack_Table_Model &stack, Machine &reg) { Mem_Step *s = steps.Get_Current_Step (); try { float r = (float) reg.Index_To_Memory(s->Get_Register1())->Get_Value(); stack.Push(r); } catch (Exception_Stack_Overflow &e) { steps.Increment_Step(); if (reg.Index_To_Memory(PERROR)->Get_Value() == 0.0F) reg.Index_To_Memory(PERROR)->Set_Value(5); // error code throw e; } steps.Increment_Step(); } void Update_Register_Use (Mem_Step &s, Registers_Table_Model &reg) { reg.Use_Register (PERROR); if (s.Register_1()) reg.Use_Register (s.Get_Register1()); if (s.Register_2()) reg.Use_Register (s.Get_Register2()); } bool Check (Mem_Step &s, Machine &mem) { return s.Mxx_1() && s.Empty_2(); } };
/** * * \file * * \brief This module contains SAMG55 BSP APIs implementation. * * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ #include "bsp/include/nm_bsp.h" #include "common/include/nm_common.h" #include "asf.h" #include "conf_winc.h" static tpfNmBspIsr gpfIsr; static void chip_isr(uint32_t id, uint32_t mask) { if ((id == CONF_WINC_SPI_INT_PIO_ID) && (mask == CONF_WINC_SPI_INT_MASK)) { if (gpfIsr) { gpfIsr(); } } } /* * @fn init_chip_pins * @brief Initialize reset, chip enable and wake pin */ static void init_chip_pins(void) { ioport_init(); ioport_set_pin_dir(CONF_WINC_PIN_RESET, IOPORT_DIR_OUTPUT); ioport_set_pin_level(CONF_WINC_PIN_RESET, IOPORT_PIN_LEVEL_HIGH); ioport_set_pin_dir(CONF_WINC_PIN_CHIP_ENABLE, IOPORT_DIR_OUTPUT); ioport_set_pin_level(CONF_WINC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_HIGH); } /* * @fn nm_bsp_init * @brief Initialize BSP * @return 0 in case of success and -1 in case of failure */ sint8 nm_bsp_init(void) { gpfIsr = NULL; /* Initialize chip IOs. */ init_chip_pins(); /* Make sure a 1ms Systick is configured. */ if (!(SysTick->CTRL & SysTick_CTRL_ENABLE_Msk && SysTick->CTRL & SysTick_CTRL_TICKINT_Msk)) { delay_init(); } /* Perform chip reset. */ nm_bsp_reset(); return 0; } /** * @fn nm_bsp_deinit * @brief De-iInitialize BSP * @return 0 in case of success and -1 in case of failure */ sint8 nm_bsp_deinit(void) { ioport_set_pin_level(CONF_WINC_PIN_CHIP_ENABLE, false); ioport_set_pin_level(CONF_WINC_PIN_RESET, false); return M2M_SUCCESS; } /** * @fn nm_bsp_reset * @brief Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, * CHIP_EN high then RESET_N high */ void nm_bsp_reset(void) { ioport_set_pin_level(CONF_WINC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_LOW); ioport_set_pin_level(CONF_WINC_PIN_RESET, IOPORT_PIN_LEVEL_LOW); nm_bsp_sleep(100); ioport_set_pin_level(CONF_WINC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_HIGH); nm_bsp_sleep(100); ioport_set_pin_level(CONF_WINC_PIN_RESET, IOPORT_PIN_LEVEL_HIGH); nm_bsp_sleep(100); } /* * @fn nm_bsp_sleep * @brief Sleep in units of mSec * @param[IN] u32TimeMsec * Time in milliseconds */ void nm_bsp_sleep(uint32 u32TimeMsec) { while(u32TimeMsec--) { delay_ms(1); } } /* * @fn nm_bsp_register_isr * @brief Register interrupt service routine * @param[IN] pfIsr * Pointer to ISR handler */ void nm_bsp_register_isr(tpfNmBspIsr pfIsr) { gpfIsr = pfIsr; /* Configure PGIO pin for interrupt from SPI slave, used when slave has data to send. */ pmc_enable_periph_clk(CONF_WINC_SPI_INT_PIO_ID); pio_configure_pin(CONF_WINC_SPI_INT_PIN, PIO_TYPE_PIO_INPUT); pio_pull_up(CONF_WINC_SPI_INT_PIO, CONF_WINC_SPI_INT_MASK, PIO_PULLUP); /*Interrupt on falling edge*/ pio_handler_set(CONF_WINC_SPI_INT_PIO, CONF_WINC_SPI_INT_PIO_ID, CONF_WINC_SPI_INT_MASK, PIO_PULLUP | PIO_IT_FALL_EDGE, chip_isr); pio_get_interrupt_status(CONF_WINC_SPI_INT_PIO); pio_enable_interrupt(CONF_WINC_SPI_INT_PIO, CONF_WINC_SPI_INT_MASK); NVIC_EnableIRQ((IRQn_Type) CONF_WINC_SPI_INT_PIO_ID); pio_handler_set_priority(CONF_WINC_SPI_INT_PIO, (IRQn_Type)CONF_WINC_SPI_INT_PIO_ID, CONF_WINC_SPI_INT_PRIORITY); } /* * @fn nm_bsp_interrupt_ctrl * @brief Enable/Disable interrupts * @param[IN] u8Enable * '0' disable interrupts. '1' enable interrupts */ void nm_bsp_interrupt_ctrl(uint8 u8Enable) { if (u8Enable) { pio_get_interrupt_status(CONF_WINC_SPI_INT_PIO); pio_enable_interrupt(CONF_WINC_SPI_INT_PIO, CONF_WINC_SPI_INT_MASK); } else { pio_disable_interrupt(CONF_WINC_SPI_INT_PIO, CONF_WINC_SPI_INT_MASK); } }
#ifndef _PLAYER_ENTITY_H_ #define _PLAYER_ENTITY_H_ #include "entity.h" #include "texture_holder.h" #include <SFML/Graphics.hpp> class Player : public Entity { public: Player(Texture::ID id, TextureHolder &textures); virtual void drawCurrent(sf::RenderTarget &target, sf::RenderStates states) const; private: Texture::ID mType; sf::Sprite mSprite; }; #endif
// // Created by simon on 17-9-9. // #ifndef D_A_QUEUE_H #define D_A_QUEUE_H #include "../list/list.h" #include "../main.h" typedef struct queue_s queue_t; struct queue_s { list_node_t *head; list_node_t *tail; }; queue_t *queue_init(); void queue_enqueue(queue_t *queue, int data); int queue_dequeue(queue_t *queue); queue_t *destroy_queue(queue_t *queue); int queue_is_empty(queue_t *queue); #endif //D_A_QUEUE_H
/* * This file is part of the luftschleuse2 project. * * See https://github.com/muccc/luftschleuse2 for more information. * * Copyright (C) 2013 Tobias Schneider <schneider@muc.ccc.de> * * 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 "bus_process.h" #include "bus_handler.h" #include "serial_handler.h" #include "config.h" void bus_init(void) { } void bus_tick(void) { } void bus_process(void) { uint8_t channel = bus_readFrame(); uint8_t len = bus_getMessageLen(); if( len && channel ){ serial_sendFrame(channel, bus_getMessage(), len); } }
#include "config.h" static struct mutex_t *g_mutex; u32 g_count = 0; static void task_1_handle(void *argv) { for (;;) { mutex_acquire(g_mutex); for (u32 i = 0; i < 5; ++i) kprintf("A"); kprintf(" g_count: %d\n", ++g_count); mutex_release(g_mutex); task_yield(); } } static void task_2_handle(void *argv) { for (;;) { mutex_acquire(g_mutex); for (u32 i = 0; i < 5; ++i) kprintf("B"); kprintf(" g_count: %d\n", ++g_count); mutex_release(g_mutex); task_yield(); } } int mutex_test_main() { u32 ret = mutex_create(&g_mutex); KERN_ASSERT_EQ(ret, 0); KERN_ASSERT_NEQ(g_mutex, 0); struct task_param_t param_1 = { .stack_sz = 0x3000, .prio = 0, .name = "task1", .handle = task_1_handle }; task_handle_t handle1; KERN_ASSERT_EQ(task_create(param_1, &handle1), 0); struct task_t *task1 = task_at(handle1); struct task_param_t param_2 = { .stack_sz = 0x3000, .prio = 0, .name = "task2", .handle = task_2_handle }; task_handle_t handle2; KERN_ASSERT_EQ(task_create(param_2, &handle2), 0); struct task_t *task2 = task_at(handle2); (void)task2; task_resume(task1); return 0; }
/***************************************************************************** * * Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC * Produced at the Lawrence Livermore National Laboratory * All rights reserved. * * This file is part of VisIt. For details, see http://www.llnl.gov/visit/. The * full copyright notice is contained in the file COPYRIGHT located at the root * of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html. * * 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 disclaimer below. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the disclaimer (as noted below) in the * documentation and/or materials provided with the distribution. * - Neither the name of the UC/LLNL nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF * CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY 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. * *****************************************************************************/ // ************************************************************************* // // StackTimer.h // // ************************************************************************* // #ifndef STACK_TIMER_H #define STACK_TIMER_H #include <string> #include <TimingsManager.h> // **************************************************************************** // Class: StackTimer // // Purpose: // Simplified mechanism for timing blocks of code. Create a StackTimer on // the stack and it will record timing information when it goes out of // scope. For example: // // if(doLongComplicatedTask) { // StackTimer task_identifier("my task"); // this->Function(); // } // // For short blocks, it may be easier to use the macro: // // TimedCodeBlock("my task", this->Function()); // // Programmer: Tom Fogal // Creation: July 2, 2007 // // Modifications: // Kathleen Bonnell, Fri Jun 20 08:15:27 PDT 2008 // Moved constructor and destructor to 'C' file, in order for this class' // methods to be available on windows platform. // // Tom Fogal, Mon Aug 25 09:54:55 EDT 2008 // Made a std::string-based constructor. // // **************************************************************************** class MISC_API StackTimer { public: StackTimer(const std::string &); StackTimer(const char *msg); ~StackTimer(); private: // Unimplemented. It does not make sense to have a timer without a // message: there will be no way to identify it. StackTimer(); // Unimplemented. You should not be trying to pass timers around. StackTimer(const StackTimer &); const StackTimer & operator =(const StackTimer &); // Unimplemented. Allowing pointers would prevent automatic destruction // and defeat the whole purpose. static void *operator new(size_t); private: std::string message; int timer_index; }; #define TimedCodeBlock(msg, block) \ do { \ StackTimer _generic_stack_timer(msg); \ block; \ } while(0) #endif /* STACK_TIMER_H */
namespace internal { template<typename Scalar> void dogleg( const Matrix<Scalar, Dynamic, Dynamic> &qrfac, const Matrix<Scalar, Dynamic, 1> &diag, const Matrix<Scalar, Dynamic, 1> &qtb, Scalar delta, Matrix<Scalar, Dynamic, 1> &x) { typedef DenseIndex Index; /* Local variables */ Index i, j; Scalar sum, temp, alpha, bnorm; Scalar gnorm, qnorm; Scalar sgnorm; /* Function Body */ const Scalar epsmch = NumTraits<Scalar>::epsilon(); const Index n = qrfac.cols(); assert(n == qtb.size()); assert(n == x.size()); assert(n == diag.size()); Matrix<Scalar, Dynamic, 1> wa1(n), wa2(n); /* first, calculate the gauss-newton direction. */ for (j = n - 1; j >= 0; --j) { temp = qrfac(j, j); if (temp == 0.) { temp = epsmch * qrfac.col(j).head(j + 1).maxCoeff(); if (temp == 0.) temp = epsmch; } if (j == n - 1) x[j] = qtb[j] / temp; else x[j] = (qtb[j] - qrfac.row(j).tail(n - j - 1).dot(x.tail(n - j - 1))) / temp; } /* test whether the gauss-newton direction is acceptable. */ qnorm = diag.cwiseProduct(x).stableNorm(); if (qnorm <= delta) return; // TODO : this path is not tested by Eigen unit tests /* the gauss-newton direction is not acceptable. */ /* next, calculate the scaled gradient direction. */ wa1.fill(0.); for (j = 0; j < n; ++j) { wa1.tail(n - j) += qrfac.row(j).tail(n - j) * qtb[j]; wa1[j] /= diag[j]; } /* calculate the norm of the scaled gradient and test for */ /* the special case in which the scaled gradient is zero. */ gnorm = wa1.stableNorm(); sgnorm = 0.; alpha = delta / qnorm; if (gnorm == 0.) goto algo_end; /* calculate the point along the scaled gradient */ /* at which the quadratic is minimized. */ wa1.array() /= (diag * gnorm).array(); // TODO : once unit tests cover this part,: // wa2 = qrfac.template triangularView<Upper>() * wa1; for (j = 0; j < n; ++j) { sum = 0.; for (i = j; i < n; ++i) { sum += qrfac(j, i) * wa1[i]; } wa2[j] = sum; } temp = wa2.stableNorm(); sgnorm = gnorm / temp / temp; /* test whether the scaled gradient direction is acceptable. */ alpha = 0.; if (sgnorm >= delta) goto algo_end; /* the scaled gradient direction is not acceptable. */ /* finally, calculate the point along the dogleg */ /* at which the quadratic is minimized. */ bnorm = qtb.stableNorm(); temp = bnorm / gnorm * (bnorm / qnorm) * (sgnorm / delta); temp = temp - delta / qnorm * abs2(sgnorm / delta) + sqrt(abs2(temp - delta / qnorm) + (1. - abs2(delta / qnorm)) * (1. - abs2(sgnorm / delta))); alpha = delta / qnorm * (1. - abs2(sgnorm / delta)) / temp; algo_end: /* form appropriate convex combination of the gauss-newton */ /* direction and the scaled gradient direction. */ temp = (1. - alpha) * (std::min)(sgnorm, delta); x = temp * wa1 + alpha * x; } } // end namespace internal
#ifndef FLOCKING_H #define FLOCKING_H // System includes #include <vector> // Local includes #include "src/Utility/Vector.h" #include "src/ArtificialLife/abstractca.h" namespace alife { class Boid { public: Boid(int id, geometry::Vec3d location, geometry::Vec3i borderMin, geometry::Vec3i borderMax, bool borderWrapping, bool borderRepulsion, geometry::Vec3d acceleration, geometry::Vec3d velocity, double maxSpeed, double maxForce); void run(const std::vector<Boid*>& boids); void applyForce(geometry::Vec3d force); void update(); geometry::Vec3d steer(geometry::Vec3d target); void seek(geometry::Vec3d target); geometry::Vec3d separate(const std::vector<Boid*>& boids); void flock(const std::vector<Boid*>& boids); geometry::Vec3d align(const std::vector<Boid*>& boids); geometry::Vec3d cohesion(const std::vector<Boid*>& boids); void drift(); geometry::Vec3d steer(); void wrapToBorders(); void borderRepulse(); bool getBorderWrapping(); void setBorderWrapping(bool borderWrapping); int getID(); geometry::Vec3d getLocation(); geometry::Vec3d getVelocity(); geometry::Vec3d getAcceleration(); double getMaxForce(); double getMaxSpeed(); static double desiredSeparation; static double neighborDist; private: geometry::Vec3i borderMin, borderMax; bool borderWrapping, borderRepulsion; geometry::Vec3d location; geometry::Vec3d velocity; geometry::Vec3d acceleration; geometry::Vec3d target; geometry::Vec3d borderCenter; double driftAngle; double maxForce; // Maximum steering force double maxSpeed; // Maximum speed int id; }; class Flock { public: Flock(geometry::Vec3i borderMin = geometry::Vec3i(), geometry::Vec3i borderMax = geometry::Vec3i(), bool borderWrapping = false, bool borderRepulsion = false); ~Flock(); void run(); void seek(geometry::Vec3d target); void drift(); // Returns the boid id for the created boid int addBoid(geometry::Vec3d location, geometry::Vec3d acceleration = geometry::Vec3d(0,0,0), geometry::Vec3d velocity = geometry::Vec3d(cell::randomRange<int>(-100, 100) / 40.0, cell::randomRange<int>(-100, 100) / 40.0, cell::randomRange<int>(-100, 100) / 40.0 + 0.01), double maxSpeed = 5.0, double maxForce = 0.75); // Flock takes ownership of the the item and will free the memory upon removal or on the Flocks deconstructor int addBoid(Boid* boid); void removeBoid(int id); void clear(); const std::vector<Boid*>& getBoids(); bool getBorderWrapping(); void setBorderWrapping(bool borderWrapping); int getNumberOfBoids(); int size(); private: std::vector<Boid*> boids; geometry::Vec3i borderMin, borderMax; bool borderWrapping; bool borderRepulsion; int boidIDCounter; }; } // alife namespace #endif // FLOCKING_H
/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL3$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later 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 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QQUICKTUMBLER_P_H #define QQUICKTUMBLER_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include <QtCore/qvariant.h> #include <QtQml/qqmlcomponent.h> #include <QtQuickTemplates2/private/qquickcontrol_p.h> QT_BEGIN_NAMESPACE class QQuickTumblerAttached; class QQuickTumblerPrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumbler : public QQuickControl { Q_OBJECT Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL) Q_PROPERTY(int count READ count NOTIFY countChanged FINAL) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL) Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL) Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL) Q_PROPERTY(int visibleItemCount READ visibleItemCount WRITE setVisibleItemCount NOTIFY visibleItemCountChanged FINAL) Q_PROPERTY(bool wrap READ wrap WRITE setWrap RESET resetWrap NOTIFY wrapChanged FINAL REVISION 1) Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged FINAL REVISION 2) public: explicit QQuickTumbler(QQuickItem *parent = nullptr); ~QQuickTumbler(); QVariant model() const; void setModel(const QVariant &model); int count() const; int currentIndex() const; void setCurrentIndex(int currentIndex); QQuickItem *currentItem() const; QQmlComponent *delegate() const; void setDelegate(QQmlComponent *delegate); int visibleItemCount() const; void setVisibleItemCount(int visibleItemCount); bool wrap() const; void setWrap(bool wrap); void resetWrap(); bool isMoving() const; static QQuickTumblerAttached *qmlAttachedProperties(QObject *object); Q_SIGNALS: void modelChanged(); void countChanged(); void currentIndexChanged(); void currentItemChanged(); void delegateChanged(); void visibleItemCountChanged(); Q_REVISION(1) void wrapChanged(); Q_REVISION(2) void movingChanged(); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; void componentComplete() override; void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override; void keyPressEvent(QKeyEvent *event) override; void updatePolish() override; private: Q_DISABLE_COPY(QQuickTumbler) Q_DECLARE_PRIVATE(QQuickTumbler) Q_PRIVATE_SLOT(d_func(), void _q_updateItemWidths()) Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights()) Q_PRIVATE_SLOT(d_func(), void _q_onViewCurrentIndexChanged()) Q_PRIVATE_SLOT(d_func(), void _q_onViewCountChanged()) }; class QQuickTumblerAttachedPrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerAttached : public QObject { Q_OBJECT Q_PROPERTY(QQuickTumbler *tumbler READ tumbler CONSTANT) Q_PROPERTY(qreal displacement READ displacement NOTIFY displacementChanged FINAL) public: explicit QQuickTumblerAttached(QObject *parent = nullptr); ~QQuickTumblerAttached(); QQuickTumbler *tumbler() const; qreal displacement() const; Q_SIGNALS: void displacementChanged(); private: Q_DISABLE_COPY(QQuickTumblerAttached) Q_DECLARE_PRIVATE(QQuickTumblerAttached) Q_PRIVATE_SLOT(d_func(), void _q_calculateDisplacement()) }; QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickTumbler) QML_DECLARE_TYPEINFO(QQuickTumbler, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKTUMBLER_P_H
/************************************************************************* > File Name: 4-7.c > Author: lctagnes > Mail: agnes2729@sina.com > Created Time: 2015年12月15日 星期二 16时49分17秒 ************************************************************************/ #include "apue.h" #include <dirent.h> #include <limits.h> typedef int Myfunc(const char*, const struct stat*, int); static Myfunc myfunc; static int myftw(const char*, Myfunc*); static int dopath(Myfunc*); static long nreg, ndir, nblk, nfifo, nchr, nlink, nsock, nnum; static char *fullpath; const int PATH_LEN = 1024; #define FTW_F 1 #define FTW_D 2 #define FTW_DNR 3 #define FTW_NS 4 int main(int argc, char *argv[]) { int ret; if(argc != 2) fprintf(stderr, "Usage: ftw <starting-pathname>\n"); ret = myftw(argv[1], myfunc); nnum = nreg + ndir + nblk + nfifo + nchr + nlink + nsock; printf("reglar file = %7ld\n", nreg); printf("directory file = %7ld\n", ndir); printf("block file = %7ld\n", nblk); printf("char file = %7ld\n", nchr); printf("FIFO file = %7ld\n", nfifo); printf("link file = %7ld\n", nlink); printf("socket file = %7ld\n", nsock); printf("total file = %7ld\n", nnum); return ret; } static int myftw(const char *pathname , Myfunc *func) { int res; fullpath = (char *)malloc(PATH_LEN); strncpy(fullpath, pathname, PATH_LEN); fullpath[PATH_LEN - 1] = '\0'; res = dopath(func); free(fullpath); return res; } static int dopath(Myfunc *func) { struct stat statbuf; struct dirent *dirp; DIR *dp; int ret; char *ptr; int temp; temp = lstat(fullpath, &statbuf); if(temp < 0) { return func(fullpath, &statbuf, FTW_NS); } temp = S_ISDIR(statbuf.st_mode); if(temp == 0) { return func(fullpath, &statbuf, FTW_F); } ret = func(fullpath, &statbuf, FTW_D); if(ret != 0) return ret; ptr = fullpath + strlen(fullpath); *ptr++ = '/'; *ptr = 0; dp = opendir(fullpath); if(NULL == dp) return func(fullpath, &statbuf, FTW_DNR); while((dirp = readdir(dp)) != NULL) { if(strcmp(dirp->d_name, ".") == 0 || strcmp(dirp->d_name, "..") == 0) continue; strcpy(ptr, dirp->d_name); ret = dopath(func); if(ret!= 0) break; } ptr[-1] = 0; if(closedir(dp) < 0) { fprintf(stderr, "can't close directory %s\n", fullpath); } return ret; } static int myfunc(const char *pathname, const struct stat *statptr, int type) { switch(type) { case FTW_F: switch(statptr->st_mode & S_IFMT) { case S_IFREG: nreg++; printf("reg:%s\n", fullpath); break; case S_IFBLK: nblk++; printf("blk:%s\n", fullpath); break; case S_IFCHR: nchr++; printf("chr:%s\n", fullpath); break; case S_IFIFO: nfifo++; printf("fifo:%s\n", fullpath); break; case S_IFLNK: nlink++; printf("link:%s\n", fullpath); break; case S_IFSOCK: nsock++; printf("sock:%s\n", fullpath); break; case S_IFDIR: fprintf(stderr, "for S_IFDIR for %s\n", pathname); exit(1); } break; case FTW_D: ndir++; printf("dir:%s\n", fullpath); break; case FTW_DNR: fprintf(stderr, "can't read directory %s\n", pathname); break; case FTW_NS: fprintf(stderr, "stat error %s\n", pathname); break; default: fprintf(stderr, "unknown type %d for pathname %s\n", type, pathname); } return 0; }
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* wolf.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: pbondoer <pbondoer@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/06/12 08:35:18 by pbondoer #+# #+# */ /* Updated: 2016/12/20 16:24:29 by pbondoer ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef WOLF_H # define WOLF_H # include <stdint.h> # define WIN_WIDTH 1280 # define WIN_HEIGHT 720 # define VIEW_DIST 10 # define TEX_MAP_SIZE 20 # define HI_RES 0 typedef struct s_rgba { uint8_t b; uint8_t g; uint8_t r; uint8_t a; } t_rgba; typedef union u_color { int value; t_rgba rgba; } t_color; typedef struct s_image { void *image; char *ptr; int bpp; int stride; int endian; int width; int height; } t_image; typedef struct s_map { int width; int height; int **values; } t_map; typedef struct s_vector { float x; float y; } t_vector; typedef struct s_cast { int mx; int my; float sx; float sy; float dx; float dy; int stepx; int stepy; float wall; } t_cast; typedef struct s_ray { float x; float y; int side; float dist; float light; int height; t_image *texture; int tex_x; float fx; float fy; } t_ray; typedef struct s_player { float x; float y; t_vector d; t_vector p; } t_player; typedef struct s_mlx { void *mlx; void *window; t_image *image; t_map *map; t_player player; t_image *tex[TEX_MAP_SIZE]; int max_tex; t_image *floor; t_image *ceiling; } t_mlx; t_mlx *init(void); t_mlx *del_mlx(t_mlx *mlx); void render(t_mlx *mlx); int hook_mousedown(int button, int x, int y, t_mlx *mlx); int hook_mouseup(int button, int x, int y, t_mlx *mlx); int hook_mousemove(int x, int y, t_mlx *mlx); int hook_keydown(int key, t_mlx *mlx); int hook_expose(t_mlx *mlx); t_image *del_image(t_mlx *mlx, t_image *img); t_image *new_image(t_mlx *mlx, int w, int h); t_image *xpm_image(char *xpm, t_mlx *mlx); void clear_image(t_image *img); void image_set_pixel(t_image *image, int x, int y, int color); t_color get_pixel(t_image *image, int x, int y); t_color clerp(t_color c1, t_color c2, double p); /* ** Wolf3D functions */ void init_player(t_player *p, t_map *m); t_map *read_map(char *fd, int max); int get_tile(t_map *m, int x, int y); int is_full_map(t_map *m); int is_enclosed_map(t_map *m); void cast(t_ray *r, t_map *m, t_player *p, t_image *tex[]); void rotate_player(t_player *p, float angle); void move_player(t_player *p, t_map *m, float distance); int load_textures(t_mlx *mlx); void draw_minimap(t_mlx *mlx); #endif
/* 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-index-view.h" #include "mume-docdoc.h" #define _index_view_super_class mume_treeview_class #define _index_view_super_meta_class mume_treeview_meta_class struct _index_view { const char _[MUME_SIZEOF_TREEVIEW]; void *doc; }; struct _index_view_class { const char _[MUME_SIZEOF_TREEVIEW_CLASS]; }; MUME_STATIC_ASSERT(sizeof(struct _index_view) == MUME_SIZEOF_INDEX_VIEW); MUME_STATIC_ASSERT(sizeof(struct _index_view_class) == MUME_SIZEOF_INDEX_VIEW_CLASS); static void _index_view_reset(struct _index_view *self) { self->doc = NULL; } static void _index_view_clear(struct _index_view *self) { if (self->doc) mume_refobj_release(self->doc); _index_view_reset(self); } static void _index_view_build_tree( struct _index_view *self, void *parent, mume_tocitem_t *toc) { mume_tocitem_t *it; void *last = NULL; for (it = toc; it; it = it->next) { last = mume_treeview_insert( self, parent, last, it->title, 0); if (it->child) _index_view_build_tree(self, last, it->child); } } static void* _index_view_ctor( struct _index_view *self, int mode, va_list *app) { if (!_mume_ctor(_index_view_super_class(), self, mode, app)) return NULL; _index_view_reset(self); return self; } static void* _index_view_dtor(struct _index_view *self) { _index_view_clear(self); return _mume_dtor(_index_view_super_class(), self); } const void* mume_index_view_class(void) { static void *clazz; return clazz ? clazz : mume_setup_class( &clazz, mume_index_view_meta_class(), "index view", _index_view_super_class(), sizeof(struct _index_view), MUME_PROP_END, _mume_ctor, _index_view_ctor, _mume_dtor, _index_view_dtor, MUME_FUNC_END); } void* mume_index_view_new(void *parent, int x, int y, int w, int h) { return mume_new(mume_index_view_class(), parent, x, y, w, h); } void mume_index_view_set_doc(void *_self, void *doc) { struct _index_view *self = _self; mume_tocitem_t *toc; assert(mume_is_of(_self, mume_index_view_class())); assert(!doc || mume_is_of(doc, mume_docdoc_class())); _index_view_clear(self); self->doc = doc; if (NULL == self->doc) return; mume_refobj_addref(self->doc); toc = mume_docdoc_get_toc_tree(self->doc); if (toc) { _index_view_build_tree(self, mume_treeview_root(self), toc); mume_tocitem_destroy(toc); } } void* mume_index_view_get_doc(const void *_self) { const struct _index_view *self = _self; assert(mume_is_of(_self, mume_index_view_class())); return self->doc; }
/* Copyright 2014 IPB, Universite de Bordeaux, INRIA & CNRS ** ** This file is part of the Scotch software package for static mapping, ** graph partitioning and sparse matrix ordering. ** ** This software is governed by the CeCILL-C license under French law ** and abiding by the rules of distribution of free software. You can ** use, modify and/or redistribute the software under the terms of the ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following ** URL: "http://www.cecill.info". ** ** As a counterpart to the access to the source code and rights to copy, ** modify and redistribute granted by the license, users are provided ** only with a limited warranty and the software's author, the holder of ** the economic rights, and the successive licensors have only limited ** liability. ** ** In this respect, the user's attention is drawn to the risks associated ** with loading, using, modifying and/or developing or reproducing the ** software by the user in light of its specific status of free software, ** that may mean that it is complicated to manipulate, and that also ** therefore means that it is reserved for developers and experienced ** professionals having in-depth computer knowledge. Users are therefore ** encouraged to load and test the software's suitability as regards ** their requirements in conditions enabling the security of their ** systems and/or data to be ensured and, more generally, to use and ** operate it in the same conditions as regards security. ** ** The fact that you are presently reading this means that you have had ** knowledge of the CeCILL-C license and that you accept its terms. */ /************************************************************/ /** **/ /** NAME : test_scotch_dgraph_check.c **/ /** **/ /** AUTHOR : Francois PELLEGRINI **/ /** **/ /** FUNCTION : This module tests the operation of **/ /** the SCOTCH_dgraphCheck() routine. **/ /** **/ /** DATES : # Version 6.0 : from : 28 sep 2014 **/ /** to 28 sep 2014 **/ /** **/ /************************************************************/ /* ** The defines and includes. */ #include <mpi.h> #include <stdio.h> #if (((defined __STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || (defined HAVE_STDINT_H)) #include <stdint.h> #endif /* (((defined __STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || (defined HAVE_STDINT_H)) */ #include <stdlib.h> #include <sys/time.h> #include <sys/types.h> #include <pthread.h> #include <unistd.h> #include "ptscotch.h" #define errorProg SCOTCH_errorProg #define errorPrint SCOTCH_errorPrint /*********************/ /* */ /* The main routine. */ /* */ /*********************/ int main ( int argc, char * argv[]) { MPI_Comm proccomm; int procglbnbr; /* Number of processes sharing graph data */ int proclocnum; /* Number of this process */ SCOTCH_Dgraph grafdat; FILE * file; #ifdef SCOTCH_PTHREAD int thrdlvlreqval; int thrdlvlproval; #endif /* SCOTCH_PTHREAD */ errorProg (argv[0]); #ifdef SCOTCH_PTHREAD thrdlvlreqval = MPI_THREAD_MULTIPLE; if (MPI_Init_thread (&argc, &argv, thrdlvlreqval, &thrdlvlproval) != MPI_SUCCESS) errorPrint ("main: Cannot initialize (1)"); if (thrdlvlreqval > thrdlvlproval) errorPrint ("main: MPI implementation is not thread-safe: recompile without SCOTCH_PTHREAD"); #else /* SCOTCH_PTHREAD */ if (MPI_Init (&argc, &argv) != MPI_SUCCESS) errorPrint ("main: Cannot initialize (2)"); #endif /* SCOTCH_PTHREAD */ if (argc != 2) { errorPrint ("main: invalid number of parameters"); exit (1); } proccomm = MPI_COMM_WORLD; MPI_Comm_size (proccomm, &procglbnbr); /* Get communicator data */ MPI_Comm_rank (proccomm, &proclocnum); fprintf (stderr, "Proc %2d of %2d, pid %d\n", proclocnum, procglbnbr, getpid ()); #ifndef SCOTCH_CHECK_AUTO if (proclocnum == 0) { /* Synchronize on keybord input */ char c; printf ("Waiting for key press...\n"); scanf ("%c", &c); } #endif /* SCOTCH_CHECK_AUTO */ if (MPI_Barrier (proccomm) != MPI_SUCCESS) { /* Synchronize for debug */ errorPrint ("main: cannot communicate"); return (1); } if (SCOTCH_dgraphInit (&grafdat, proccomm) != 0) { /* Initialize source graph */ errorPrint ("main: cannot initialize graph"); return (1); } file = NULL; if ((proclocnum == 0) && ((file = fopen (argv[1], "r")) == NULL)) { errorPrint ("main: cannot open graph file"); return (1); } if (SCOTCH_dgraphLoad (&grafdat, file, 0, 0) != 0) { errorPrint ("main: cannot load graph"); return (1); } if (file != NULL) fclose (file); if (SCOTCH_dgraphCheck (&grafdat) != 0) { errorPrint ("main: invalid graph"); return (1); } if (MPI_Barrier (proccomm) != MPI_SUCCESS) { /* Synchronize for debug */ errorPrint ("main: cannot communicate"); return (1); } SCOTCH_dgraphExit (&grafdat); MPI_Finalize (); exit (0); }
#ifndef GAMEPLAY_H_ #define GAMEPLAY_H_ #include "include.h" typedef void (*action)(Board*, Board*); void getMoves(Board **); void getActions(Board **); Board * getDelta(Board **, int, int); void checkTarget(Board **, int, int, action); void checkSoldierRadius(Board **, int, int); int canShoot(Board **board, int x, int y); void getActionInf(Board *, Board *); void getActionDoc(Board *, Board *); void getActionCit(Board *, Board *); void getActionSol(Board **, Board *, Board *, int, int); void getActionNurse(Board *, Board *); int checkOutBounds(Board **, Directions, int, int); #endif
#include<stdio.h> #define LL long long int main() { LL p; while(scanf("%lld", &p)==1) { printf("%lld\n", p-1); } return 0; }
/* $OpenBSD: setvbuf.c,v 1.12 2015/01/13 07:18:21 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. */ #include <stdio.h> #include <stdlib.h> #include "local.h" /* * Set one of the three kinds of buffering, optionally including * a buffer. */ int setvbuf(FILE *fp, char *buf, int mode, size_t size) { int ret, flags; size_t iosize; int ttyflag; /* * Verify arguments. The `int' limit on `size' is due to this * particular implementation. Note, buf and size are ignored * when setting _IONBF. */ if (mode != _IONBF) if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0) return (EOF); /* * Write current buffer, if any. Discard unread input (including * ungetc data), cancel line buffering, and free old buffer if * malloc()ed. We also clear any eof condition, as if this were * a seek. */ FLOCKFILE(fp); ret = 0; (void)__sflush(fp); if (HASUB(fp)) FREEUB(fp); WCIO_FREE(fp); fp->_r = fp->_lbfsize = 0; flags = fp->_flags; if (flags & __SMBF) free((void *)fp->_bf._base); flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT | __SEOF); /* If setting unbuffered mode, skip all the hard work. */ if (mode == _IONBF) goto nbf; /* * Find optimal I/O size for seek optimization. This also returns * a `tty flag' to suggest that we check isatty(fd), but we do not * care since our caller told us how to buffer. */ flags |= __swhatbuf(fp, &iosize, &ttyflag); if (size == 0) { buf = NULL; /* force local allocation */ size = iosize; } /* Allocate buffer if needed. */ if (buf == NULL) { if ((buf = malloc(size)) == NULL) { /* * Unable to honor user's request. We will return * failure, but try again with file system size. */ ret = EOF; if (size != iosize) { size = iosize; buf = malloc(size); } } if (buf == NULL) { /* No luck; switch to unbuffered I/O. */ nbf: fp->_flags = flags | __SNBF; fp->_w = 0; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; FUNLOCKFILE(fp); return (ret); } flags |= __SMBF; } /* * We're committed to buffering from here, so make sure we've * registered to flush buffers on exit. */ if (!__sdidinit) __sinit(); /* * Kill any seek optimization if the buffer is not the * right size. * * SHOULD WE ALLOW MULTIPLES HERE (i.e., ok iff (size % iosize) == 0)? */ if (size != iosize) flags |= __SNPT; /* * Fix up the FILE fields. */ if (mode == _IOLBF) flags |= __SLBF; fp->_flags = flags; fp->_bf._base = fp->_p = (unsigned char *)buf; fp->_bf._size = size; /* fp->_lbfsize is still 0 */ if (flags & __SWR) { /* * Begin or continue writing: see __swsetup(). Note * that __SNBF is impossible (it was handled earlier). */ if (flags & __SLBF) { fp->_w = 0; fp->_lbfsize = -fp->_bf._size; } else fp->_w = size; } else { /* begin/continue reading, or stay in intermediate state */ fp->_w = 0; } FUNLOCKFILE(fp); return (ret); }
// // KaraokeMachine.h // Microlending // // Created by Leonard Ng'eno on 10/16/12. // // #import "Furniture.h" @interface KaraokeMachine : Furniture { } -(void)initWithLevel:(NSInteger)furnitureLevel; @end
/******************************************************************************* Eurecom OpenAirInterface 2 Copyright(c) 1999 - 2010 Eurecom This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA. The full GNU General Public License is included in this distribution in the file called "COPYING". Contact Information Openair Admin: openair_admin@eurecom.fr Openair Tech : openair_tech@eurecom.fr Forums : http://forums.eurecom.fsr/openairinterface Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France *******************************************************************************/ /*! \file structures.h * \brief structures used for the * \author M. Mosli * \date 2012 * \version 0.1 * \company Eurecom * \email: mosli@eurecom.fr */ #ifndef STRUCTURES_H #define STRUCTURES_H #ifndef __PHY_IMPLEMENTATION_DEFS_H__ #define Maxneighbor 64 #define NUMBER_OF_UE_MAX 64 #define NUMBER_OF_eNB_MAX 3 #ifndef NB_ANTENNAS_RX # define NB_ANTENNAS_RX 4 #endif #endif // // how to add an underlying map as OMV background typedef struct Geo { int x, y,z; //int Speedx, Speedy, Speedz; // speeds in each of direction int mobility_type; // model of mobility int node_type; int Neighbors; // number of neighboring nodes (distance between the node and its neighbors < 100) int Neighbor[NUMBER_OF_UE_MAX]; // array of its neighbors //relavent to UE only unsigned short state; unsigned short rnti; unsigned int connected_eNB; int RSSI[NB_ANTENNAS_RX]; int RSRP; int RSRQ; int Pathloss; /// more info to display } Geo; typedef struct Data_Flow_Unit { // int total_num_nodes; struct Geo geo[NUMBER_OF_eNB_MAX+NUMBER_OF_UE_MAX]; int end; } Data_Flow_Unit; #endif // STRUCTURES_H
/* * headerwidget.h * Copyright 2017 - ~, Apin <apin.klas@gmail.com> * * This file is part of Sultan. * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef HEADERWIDGET_H #define HEADERWIDGET_H #include "gui_global.h" #include <QVariant> #include <QWidget> class QLineEdit; class QComboBox; class QDateTimeEdit; namespace LibGUI { class GUISHARED_EXPORT HeaderWidget : public QWidget { Q_OBJECT public: enum Type { None, LineEdit, Combo, Date, DateStartEnd }; HeaderWidget(int index, int type, const QString &title, QWidget *parent = nullptr); inline QLineEdit *getLineEdit() { return mLineEdit; } inline QComboBox *getComboBox() { return mComboBox; } inline QDateTimeEdit *getDateEdit() { return mDateEdit; } inline QDateTimeEdit *getDateEnd() { return mDateEnd; } signals: void filterValueChanged(int index, QVariant value); private: int mIndex; QLineEdit *mLineEdit = nullptr; QComboBox *mComboBox = nullptr; QDateTimeEdit *mDateEdit = nullptr; QDateTimeEdit *mDateEnd = nullptr; private slots: void lineEditDone(); void comboChanged(); void dateChanged(); void dateStartEndChanged(); }; } // namespace LibGUI #endif // HEADERWIDGET_H
#include "unp.h" #include <sys/mman.h> /* * Allocate an array of "nchildren" longs in shared memory that can * be used as a counter by each child of how many clients it services. * See pp. 467-470 of "Advanced Programming in the Unix Environment". */ long * meter(int nchildren) { int fd; long *ptr; #ifdef MAP_ANON ptr = Mmap(0, nchildren*sizeof(long), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); #else fd = Open("/dev/zero", O_RDWR, 0); ptr = Mmap(0, nchildren*sizeof(long), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); Close(fd); #endif return(ptr); }
// ADOBE SYSTEMS INCORPORATED // Copyright 1993 - 2002 Adobe Systems Incorporated // All Rights Reserved // // NOTICE: Adobe permits you to use, modify, and distribute this // file in accordance with the terms of the Adobe license agreement // accompanying it. If you have received this file from a source // other than Adobe, then your use, modification, or distribution // of it requires the prior written permission of Adobe. // MFCPlugIn.h : main header file for the MFCPLUGIN DLL // #if !defined(AFX_MFCPLUGIN_H__57DC22DD_6AEA_11D3_BD7B_0060B0A13DC4__INCLUDED_) #define AFX_MFCPLUGIN_H__57DC22DD_6AEA_11D3_BD7B_0060B0A13DC4__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CMFCPlugInApp // See MFCPlugIn.cpp for the implementation of this class // class CMFCPlugInApp : public CWinApp { private: FilterRecord* m_pFilterRecord; intptr_t* m_pLongData; char* m_pData; public: CMFCPlugInApp(); void Entry(FilterRecord*,intptr_t*); void Exit(); void About(void); void Parameters(void); void Prepare(void); void Start(void); void Continue(void); void Finish(void); void DoUI(void); int m_Value; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMFCPlugInApp) //}}AFX_VIRTUAL //{{AFX_MSG(CMFCPlugInApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MFCPLUGIN_H__57DC22DD_6AEA_11D3_BD7B_0060B0A13DC4__INCLUDED_)
// // Copyright (C) 2001,2002,2003,2004 Jorge Daza Garcia-Blanes // // 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 // /* $Id$ */ #ifndef _DRQM_JOBS_TERRAGEN_H_ #define _DRQM_JOBS_TERRAGEN_H_ #include <gtk/gtk.h> #ifdef __CYGWIN #define KOJ_TERRAGEN_DFLT_VIEWCMD "tif" #else #define KOJ_TERRAGEN_DFLT_VIEWCMD "fcheck $DRQUEUE_RD/$DRQUEUE_IMAGE.$DRQUEUE_PADFRAME.tif" #endif struct drqmj_koji_terragen { GtkWidget *escriptfile; GtkWidget *fsscriptfile; /* File selector for the scene */ GtkWidget *eworldfile; GtkWidget *fsworldfile; /* File selector for the project directory */ GtkWidget *eterrainfile; GtkWidget *fsterrainfile; /* File selector for the config directory */ GtkWidget *eviewcmd; GtkWidget *escript; /* Entry script location */ GtkWidget *fsscript; /* File selectot for the script directory */ GtkWidget *efile_owner; /* Owner of the rendered files */ }; struct drqm_jobs_info; GtkWidget *jdd_koj_terragen_widgets (struct drqm_jobs_info *info); GtkWidget *dnj_koj_frame_terragen (struct drqm_jobs_info *info); #endif /* _DRQM_JOBS_TERRAGEN_H_ */
/*************************************************************************** * blitz/listinit.h Classes for initialization lists * * $Id: listinit.h 1414 2005-11-01 22:04:59Z cookedm $ * * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * * This code was relicensed under the modified BSD license for use in SciPy * by Todd Veldhuizen (see LICENSE.txt in the weave directory). * * * Suggestions: blitz-dev@oonumerics.org * Bugs: blitz-bugs@oonumerics.org * * For more information, please see the Blitz++ Home Page: * http://oonumerics.org/blitz/ * ***************************************************************************/ /* * Initialization lists provide a convenient way to set the elements * of an array. For example, * * Array<int,2> A(3,3); * A = 1, 0, 0, * 0, 1, 0, * 0, 0, 1; */ #ifndef BZ_LISTINIT_H #define BZ_LISTINIT_H BZ_NAMESPACE(blitz) template<typename T_numtype, typename T_iterator> class ListInitializer { public: ListInitializer(T_iterator iter) : iter_(iter) { } ListInitializer<T_numtype, T_iterator> operator,(T_numtype x) { *iter_ = x; return ListInitializer<T_numtype, T_iterator>(iter_ + 1); } private: ListInitializer(); protected: T_iterator iter_; }; template<typename T_array, typename T_iterator = _bz_typename T_array::T_numtype*> class ListInitializationSwitch { public: typedef _bz_typename T_array::T_numtype T_numtype; ListInitializationSwitch(const ListInitializationSwitch<T_array>& lis) : array_(lis.array_), value_(lis.value_), wipeOnDestruct_(true) { lis.disable(); } ListInitializationSwitch(T_array& array, T_numtype value) : array_(array), value_(value), wipeOnDestruct_(true) { } ~ListInitializationSwitch() { if (wipeOnDestruct_) array_.initialize(value_); } ListInitializer<T_numtype, T_iterator> operator,(T_numtype x) { wipeOnDestruct_ = false; T_iterator iter = array_.getInitializationIterator(); *iter = value_; T_iterator iter2 = iter + 1; *iter2 = x; return ListInitializer<T_numtype, T_iterator>(iter2 + 1); } void disable() const { wipeOnDestruct_ = false; } private: ListInitializationSwitch(); protected: T_array& array_; T_numtype value_; mutable bool wipeOnDestruct_; }; BZ_NAMESPACE_END #endif // BZ_LISTINIT_H
#pragma once #include <GCS_MAVLink/GCS.h> // default sensors are present and healthy: gyro, accelerometer, barometer, rate_control, attitude_stabilization, yaw_position, altitude control, x/y position control, motor_control #define MAVLINK_SENSOR_PRESENT_DEFAULT (MAV_SYS_STATUS_SENSOR_3D_GYRO | MAV_SYS_STATUS_SENSOR_3D_ACCEL | MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE | MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL | MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION | MAV_SYS_STATUS_SENSOR_YAW_POSITION | MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS) class GCS_MAVLINK_Tracker : public GCS_MAVLINK { public: protected: // telem_delay is not used by Tracker but is pure virtual, thus // this implementaiton. it probably *should* be used by Tracker, // as currently Tracker may brick XBees uint32_t telem_delay() const override { return 0; } AP_Rally *get_rally() const override { return nullptr; }; uint8_t sysid_my_gcs() const override; bool set_mode(uint8_t mode) override; MAV_RESULT _handle_command_preflight_calibration_baro() override; MAV_RESULT handle_command_long_packet(const mavlink_command_long_t &packet) override; int32_t global_position_int_relative_alt() const override { return 0; // what if we have been picked up and carried somewhere? } private: void packetReceived(const mavlink_status_t &status, mavlink_message_t &msg) override; void mavlink_check_target(const mavlink_message_t &msg); void handleMessage(mavlink_message_t * msg) override; bool handle_guided_request(AP_Mission::Mission_Command &cmd) override; void handle_change_alt_request(AP_Mission::Mission_Command &cmd) override; bool try_send_message(enum ap_message id) override; MAV_TYPE frame_type() const override; MAV_MODE base_mode() const override; uint32_t custom_mode() const override; MAV_STATE system_status() const override; };
/* * Copyright (C) 2009 Laird Breyer * * 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, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Author: Laird Breyer <laird@lbreyer.com> */ #include "common.h" #include "stdselect.h" #include "myerror.h" bool_t create_stdselect(stdselect_t *sel) { bool_t ok = TRUE; if( sel ) { ok &= create_wrap_xmatcher(&sel->paths, NULL); ok &= create_xpredicatelist(&sel->preds); ok &= create_xattributelist(&sel->atts); ok &= create_nhistory(&sel->history); sel->active = FALSE; sel->mindepth = INFDEPTH; sel->maxdepth = 0; return ok; } return FALSE; } bool_t reset_stdselect(stdselect_t *sel) { if( sel ) { reset_xmatcher(&sel->paths); reset_xpredicatelist(&sel->preds); reset_xattributelist(&sel->atts); reset_nhistory(&sel->history); push_level_nhistory(&sel->history, 0); sel->active = FALSE; sel->mindepth = INFDEPTH; sel->maxdepth = 0; return TRUE; } return FALSE; } bool_t free_stdselect(stdselect_t *sel) { if( sel ) { free_xmatcher(&sel->paths); free_xpredicatelist(&sel->preds); free_xattributelist(&sel->atts); free_nhistory(&sel->history); return TRUE; } return FALSE; } bool_t setup_xpaths_stdselect(stdselect_t *sel, cstringlst_t xpaths) { if( sel ) { if( !create_wrap_xmatcher(&sel->paths, xpaths) || !compile_xpredicatelist(&sel->preds, xpaths) || !compile_xattributelist(&sel->atts, xpaths) ) { errormsg(E_FATAL, "bad xpath list.\n"); } return TRUE; } return FALSE; } bool_t find_matching_xpath_stdselect(stdselect_t *sel, const xpath_t *xpath) { const char_t *path; const xmatcher_t *xm; const xpredicate_t *xp; const xattribute_t *xa; bool_t v, tmatch, amatch; int m, n; if( sel && xpath ) { path = string_xpath(xpath); xm = &sel->paths; tmatch = amatch = FALSE; for(n = 0; n < xm->xpath_count; n++) { xp = get_xpredicatelist(&sel->preds, n); xa = get_xattributelist(&sel->atts, n); m = match_no_att_no_pred_xpath(xm->xpath[n], NULL, path); v = valid_xpredicate(xp); tmatch |= (!xa->begin && ((m == 0) || (m == -1)) && v); amatch |= (xa->begin && xa->precheck && (m == 0) && v); } sel->attrib = amatch; return tmatch; } return FALSE; } /* may create or delete a node */ nhistory_node_t *getnode_stdselect(stdselect_t *sel, int depth) { nhistory_node_t *node = NULL; int topd; if( sel ) { topd = sel->history.node_memo.top; if( topd == depth ) { push_level_nhistory(&sel->history, depth); node = get_node_nhistory(&sel->history, depth); } else if( --topd == depth ) { node = get_node_nhistory(&sel->history, depth); } else if( --topd == depth ) { pop_level_nhistory(&sel->history, depth + 1); node = get_node_nhistory(&sel->history, depth); } if( !node ) { errormsg(E_FATAL, "fatal corruption in nhistory (depth=%d, top=%d)\n", depth, sel->history.node_memo.top); } } return node; } bool_t activate_tag_stdselect(stdselect_t *sel, int depth, const xpath_t *xpath, const char_t **att) { bool_t update; nhistory_node_t *node; if( sel && xpath && (sel->paths.xpath_count > 0) ) { node = getnode_stdselect(sel, depth); update = (node->tag == undefined); if( update && att ) { /* start-tag event */ update_xpredicatelist(&sel->preds, string_xpath(xpath), att); update_xattributelist(&sel->atts, att); } MEMOIZE_BOOL_NHIST( node->tag, find_matching_xpath_stdselect(sel, xpath) ); sel->active = (node->tag == active); if( update && sel->active ) { sel->mindepth = MIN(depth, sel->mindepth); sel->maxdepth = MAX(depth, sel->maxdepth); } return TRUE; } return FALSE; } bool_t activate_stringval_stdselect(stdselect_t *sel, int depth, const xpath_t *xpath) { nhistory_node_t *node; if( sel && xpath && (sel->paths.xpath_count > 0) ) { node = getnode_stdselect(sel, depth); MEMOIZE_BOOL_NHIST( node->stringval, find_matching_xpath_stdselect(sel, xpath) ); sel->active = (node->stringval == active); return TRUE; } return FALSE; } bool_t activate_node_stdselect(stdselect_t *sel, int depth, const xpath_t *xpath) { bool_t update; nhistory_node_t *node; if( sel && xpath && (sel->paths.xpath_count > 0) ) { node = getnode_stdselect(sel, depth); update = (node->node == undefined); if( update ) { update_xpredicatelist(&sel->preds, string_xpath(xpath), NULL); update_xattributelist(&sel->atts, NULL); } MEMOIZE_BOOL_NHIST( node->node, find_matching_xpath_stdselect(sel, xpath) ); sel->active = (node->node == active); return TRUE; } return FALSE; } bool_t activate_attribute_stdselect(stdselect_t *sel, int depth, const xpath_t *xpath, const char_t *name) { if( sel && xpath ) { sel->active = check_xattributelist(&sel->atts, string_xpath(xpath), name); return TRUE; } return FALSE; }
/* Set terminal (tty) into "raw" mode: no line or other processing done Terminal handling documentation: curses(3X) - screen handling library. tput(1) - shell based terminal handling. terminfo(4) - SYS V terminal database. termcap - BSD terminal database. Obsoleted by above. termio(7I) - terminal interface (ioctl(2) - I/O control). termios(3) - preferred terminal interface (tc* - terminal control). */ #include <termios.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> void tty_atexit(void); int tty_reset(void); void tty_raw(void); int screenio(void); void fatal(char *mess); static struct termios orig_termios; /* TERMinal I/O Structure */ static int ttyfd = STDIN_FILENO; /* STDIN_FILENO is 0 by default */ int main() { /* check that input is from a tty */ if (! isatty(ttyfd)) fatal("not on a tty"); /* store current tty settings in orig_termios */ if (tcgetattr(ttyfd,&orig_termios) < 0) fatal("can't get tty settings"); /* register the tty reset with the exit handler */ if (atexit(tty_atexit) != 0) fatal("atexit: can't register tty reset"); tty_raw(); /* put tty in raw mode */ screenio(); /* run application code */ return 0; /* tty_atexit will restore terminal */ } /* exit handler for tty reset */ void tty_atexit(void) /* NOTE: If the program terminates due to a signal */ { /* this code will not run. This is for exit()'s */ tty_reset(); /* only. For resetting the terminal after a signal, */ } /* a signal handler which calls tty_reset is needed. */ /* reset tty - useful also for restoring the terminal when this process wishes to temporarily relinquish the tty */ int tty_reset(void) { /* flush and reset */ if (tcsetattr(ttyfd,TCSAFLUSH,&orig_termios) < 0) return -1; return 0; } /* put terminal in raw mode - see termio(7I) for modes */ void tty_raw(void) { struct termios raw; raw = orig_termios; /* copy original and then modify below */ /* input modes - clear indicated ones giving: no break, no CR to NL, no parity check, no strip char, no start/stop output (sic) control */ raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); /* output modes - clear giving: no post processing such as NL to CR+NL */ raw.c_oflag &= ~(OPOST); /* control modes - set 8 bit chars */ raw.c_cflag |= (CS8); /* local modes - clear giving: echoing off, canonical off (no erase with backspace, ^U,...), no extended functions, no signal chars (^Z,^C) */ raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); /* control chars - set return condition: min number of bytes and timer */ //raw.c_cc[VMIN] = 5; raw.c_cc[VTIME] = 8; /* after 5 bytes or .8 seconds */ /* after first byte seen */ //raw.c_cc[VMIN] = 0; raw.c_cc[VTIME] = 0; /* immediate - anything */ //raw.c_cc[VMIN] = 2; raw.c_cc[VTIME] = 0; /* after two bytes, no timer */ raw.c_cc[VMIN] = 0; raw.c_cc[VTIME] = 8; /* after a byte or .8 seconds */ /* put terminal in raw mode after flushing */ if (tcsetattr(ttyfd,TCSAFLUSH,&raw) < 0) fatal("can't set raw mode"); } /* Read and write from tty - this is just toy code!! Prints T on timeout, quits on q input, prints Z if z input, goes up if u input, prints * for any other input character */ int screenio(void) { int bytesread; char c_in, c_out, up[]="\033[A"; char eightbitchars[256]; /* will not be a string! */ /* A little trick for putting all 8 bit characters in array */ {int i; for (i = 0; i < 256; i++) eightbitchars[i] = (char) i; } for (;;) {bytesread = read(ttyfd, &c_in, 1 /* read up to 1 byte */); if (bytesread < 0) fatal("read error"); if (bytesread == 0) /* 0 bytes inputed, must have timed out */ {c_out = 'T'; /* straight forward way to output 'T' */ write(STDOUT_FILENO, &c_out, 1); } else switch (c_in) /* 1 byte inputed */ {case 'q' : return 0; /* quit - no other way to quit - no EOF */ case 'z' : /* tricky way to output 'Z' */ write(STDOUT_FILENO, eightbitchars + 'Z', 1); break; case 'u' : write(STDOUT_FILENO, up, 3); /* write 3 bytes from string */ break; default : c_out = '*'; write(STDOUT_FILENO, &c_out, 1); } } } void fatal(char *message) { fprintf(stderr,"fatal error: %s\n",message); exit(1); }
/* * Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/> * Copyright (C) 2005-2012 MaNGOS <http://www.getmangos.com/> * Copyright (C) 2008-2012 Trinity <http://www.trinitycore.org/> * * 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 */ #ifndef DEF_TOC_H #define DEF_TOC_H enum eData { BOSS_GRAND_CHAMPIONS, BOSS_ARGENT_CHALLENGE_E, BOSS_ARGENT_CHALLENGE_P, BOSS_BLACK_KNIGHT, DATA_MOVEMENT_DONE, DATA_AGGRO_DONE, DATA_AGRO_DONE, DATA_LESSER_CHAMPIONS_DEFEATED, DATA_START, DATA_IN_POSITION, DATA_ARGENT_SOLDIER_DEFEATED, DATA_BLACK_KNIGHT, DATA_KNIGHT }; enum Data64 { DATA_ANNOUNCER, DATA_MAIN_GATE, DATA_MAIN_GATE1, DATA_GRAND_CHAMPION_VEHICLE_1, DATA_GRAND_CHAMPION_VEHICLE_2, DATA_GRAND_CHAMPION_VEHICLE_3, DATA_GRAND_CHAMPION_1, DATA_GRAND_CHAMPION_2, DATA_GRAND_CHAMPION_3 }; enum eNpcs { // Horde Champions NPC_MOKRA = 35572, NPC_ERESSEA = 35569, NPC_RUNOK = 35571, NPC_ZULTORE = 35570, NPC_VISCERI = 35617, // Alliance Champions NPC_JACOB = 34705, NPC_AMBROSE = 34702, NPC_COLOSOS = 34701, NPC_JAELYNE = 34657, NPC_LANA = 34703, // Crusader Champions NPC_EADRIC = 35119, NPC_PALETRESS = 34928, // Crusader mobs NPC_ARGENT_LIGHWIELDER = 35309, NPC_ARGENT_MONK = 35305, NPC_PRIESTESS = 35307, // Black Knight NPC_BLACK_KNIGHT = 35451, // Black Knight's add NPC_RISEN_JAEREN = 35545, NPC_RISEN_ARELAS = 35564, // Announcer NPC_JAEREN_AN = 35591, NPC_ARELAS_AN = 35592, // Memory MEMORY_ALGALON = 35052, MEMORY_ARCHIMONDE = 35041, MEMORY_CHROMAGGUS = 35033, MEMORY_CYANIGOSA = 35046, MEMORY_DELRISSA = 35043, MEMORY_ECK = 35047, MEMORY_ENTROPIUS = 35044, MEMORY_GRUUL = 35039, MEMORY_HAKKAR = 35034, MEMORY_HEIGAN = 35049, MEMORY_HEROD = 35030, MEMORY_HOGGER = 34942, MEMORY_IGNIS = 35050, MEMORY_ILLIDAN = 35042, MEMORY_INGVAR = 35045, MEMORY_KALITHRESH = 35037, MEMORY_LUCIFRON = 35031, MEMORY_MALCHEZAAR = 35038, MEMORY_MUTANUS = 35029, MEMORY_ONYXIA = 35048, MEMORY_THUNDERAAN = 35032, MEMORY_VANCLEEF = 35028, MEMORY_VASHJ = 35040, MEMORY_VEKNILASH = 35036, MEMORY_VEZAX = 35051, // Announcer Start Event NPC_JAEREN = 35004, NPC_ARELAS = 35005 }; enum eGameObjects { GO_MAIN_GATE = 195647, GO_MAIN_GATE1 = 195650, GO_CHAMPIONS_LOOT = 195709, GO_CHAMPIONS_LOOT_H = 195710, GO_EADRIC_LOOT = 195374, GO_EADRIC_LOOT_H = 195375, GO_PALETRESS_LOOT = 195323, GO_PALETRESS_LOOT_H = 195324 }; enum eVehicles { //Grand Champions Alliance Vehicles VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT = 35637, VEHICLE_AMBROSE_BOLTSPARK_MOUNT = 35633, VEHICLE_COLOSOS_MOUNT = 35768, VEHICLE_EVENSONG_MOUNT = 34658, VEHICLE_LANA_STOUTHAMMER_MOUNT = 35636, //Faction Champions (ALLIANCE) VEHICLE_DARNASSIA_NIGHTSABER = 33319, VEHICLE_EXODAR_ELEKK = 33318, VEHICLE_STORMWIND_STEED = 33217, VEHICLE_GNOMEREGAN_MECHANOSTRIDER = 33317, VEHICLE_IRONFORGE_RAM = 33316, //Grand Champions Horde Vehicles VEHICLE_MOKRA_SKILLCRUSHER_MOUNT = 35638, VEHICLE_ERESSEA_DAWNSINGER_MOUNT = 35635, VEHICLE_RUNOK_WILDMANE_MOUNT = 35640, VEHICLE_ZUL_TORE_MOUNT = 35641, VEHICLE_DEATHSTALKER_VESCERI_MOUNT = 35634, //Faction Champions (HORDE) VEHICLE_FORSAKE_WARHORSE = 33324, VEHICLE_THUNDER_BLUFF_KODO = 33322, VEHICLE_ORGRIMMAR_WOLF = 33320, VEHICLE_SILVERMOON_HAWKSTRIDER = 33323, VEHICLE_DARKSPEAR_RAPTOR = 33321, VEHICLE_ARGENT_WARHORSE = 35644, VEHICLE_ARGENT_BATTLEWORG = 36558, VEHICLE_GR = 35492, VEHICLE_BLACK_KNIGHT = 35491 }; #endif
/** * @file server.h * @brief * @author Alexandry Augustin * @version 1 * @date 2013-12-01 */ #ifndef BJ_SERVER_SERVER_H #define BJ_SERVER_SERVER_H /////////////////////////////////////////////////////////// #include <boost/asio.hpp> #include <boost/regex.hpp> #include <boost/noncopyable.hpp> /////////////////////////////////////////////////////////// namespace bj { namespace server { class facade; class session; class session_manager; /////////////////////////////////////////////////////////// class server: private boost::noncopyable { facade* _facade; boost::asio::ip::tcp::acceptor* _acceptor; //listens for incoming connections boost::asio::ip::tcp::endpoint& _endpoint; session* _session; //next connection to be accepted void handle_async_accept(const boost::system::error_code& ec); public: server(facade* f, boost::asio::ip::tcp::endpoint& endpoint); void init(); void start_accept(); //initiate an asynchronous accept operation void handle_stop(); //handle a request to stop the server boost::asio::ip::tcp::endpoint* get_endpoint(); }; /////////////////////////////////////////////////////////// } //namespace server } //namespace bj /////////////////////////////////////////////////////////// #endif
/* * 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/>. */ /** * @author Ratnadip Choudhury * @copyright Copyright (c) 2011, Robert Bosch Engineering and Business Solutions. All rights reserved. * * stdafx.h : include file for standard system include files, * or project specific include files that are used frequently, but * are changed infrequently */ #pragma once #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows Common Controls #include "afxtempl.h" #endif // _AFX_NO_AFXCMN_SUPPORT // Windows Header Files: //#include <windows.h> //#include <afxwin.h> // C RunTime Header Files #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <wtypes.h> #include <atlconv.h> #include <stdio.h> #include <locale.h> //#include <objbase.h> // TODO: reference additional headers your program requires here
/* * Copyright (c) 2015, EURECOM (www.eurecom.fr) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of the FreeBSD Project. */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "OctetString.h" #ifndef EMERGENCY_NUMBER_LIST_H_ #define EMERGENCY_NUMBER_LIST_H_ #define EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH 5 #define EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH 50 typedef struct EmergencyNumberList_tag { uint8_t lengthofemergency; uint8_t emergencyservicecategoryvalue:5; } EmergencyNumberList; int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len); int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len); void dump_emergency_number_list_xml(EmergencyNumberList *emergencynumberlist, uint8_t iei); #endif /* EMERGENCY NUMBER LIST_H_ */
/* * This file is part of Cleanflight. * * Cleanflight 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. * * Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> #include <stdint.h> #include <string.h> #include "platform.h" #if defined(USE_OSD) && defined(USE_CMS) #include "common/utils.h" #include "cms/cms.h" #include "cms/cms_types.h" #include "cms/cms_menu_osd.h" #include "fc/settings.h" #include "io/osd.h" static const OSD_Entry cmsx_menuAlarmsEntries[] = { OSD_LABEL_ENTRY("--- ALARMS ---"), OSD_SETTING_ENTRY_STEP("RSSI", SETTING_OSD_RSSI_ALARM, 5), OSD_SETTING_ENTRY("FLY TIME", SETTING_OSD_TIME_ALARM), OSD_SETTING_ENTRY("MAX ALT", SETTING_OSD_ALT_ALARM), OSD_BACK_ENTRY, OSD_END_ENTRY, }; const CMS_Menu cmsx_menuAlarms = { #ifdef CMS_MENU_DEBUG .GUARD_text = "MENUALARMS", .GUARD_type = OME_MENU, #endif .onEnter = NULL, .onExit = NULL, .onGlobalExit = NULL, .entries = cmsx_menuAlarmsEntries, }; #define OSD_OSD_ELEMENT_ENTRY(name, osd_item_id) {name, OME_VISIBLE, NULL, (void *)osd_item_id, 0} static const OSD_Entry menuOsdActiveElemsEntries[] = { OSD_LABEL_ENTRY("--- ACTIV ELEM ---"), OSD_OSD_ELEMENT_ENTRY("RSSI", OSD_RSSI_VALUE), OSD_OSD_ELEMENT_ENTRY("MAIN BATTERY", OSD_MAIN_BATT_VOLTAGE), OSD_OSD_ELEMENT_ENTRY("HORIZON", OSD_ARTIFICIAL_HORIZON), OSD_OSD_ELEMENT_ENTRY("HORIZON SIDEBARS", OSD_HORIZON_SIDEBARS), OSD_OSD_ELEMENT_ENTRY("UPTIME", OSD_ONTIME), OSD_OSD_ELEMENT_ENTRY("FLY TIME", OSD_FLYTIME), OSD_OSD_ELEMENT_ENTRY("FLY MODE", OSD_FLYMODE), OSD_OSD_ELEMENT_ENTRY("NAME", OSD_CRAFT_NAME), OSD_OSD_ELEMENT_ENTRY("THROTTLE", OSD_THROTTLE_POS), #ifdef VTX OSD_OSD_ELEMENT_ENTRY("VTX CHAN", OSD_VTX_CHANNEL), #endif // VTX OSD_OSD_ELEMENT_ENTRY("CURRENT (A)", OSD_CURRENT_DRAW), OSD_OSD_ELEMENT_ENTRY("USED MAH", OSD_MAH_DRAWN), #ifdef USE_GPS OSD_OSD_ELEMENT_ENTRY("HOME DIR.", OSD_HOME_DIR), OSD_OSD_ELEMENT_ENTRY("HOME DIST.", OSD_HOME_DIST), OSD_OSD_ELEMENT_ENTRY("GPS SPEED", OSD_GPS_SPEED), OSD_OSD_ELEMENT_ENTRY("GPS SATS.", OSD_GPS_SATS), OSD_OSD_ELEMENT_ENTRY("GPS LAT", OSD_GPS_LAT), OSD_OSD_ELEMENT_ENTRY("GPS LON.", OSD_GPS_LON), OSD_OSD_ELEMENT_ENTRY("HEADING", OSD_HEADING), #endif // GPS #if defined(USE_BARO) || defined(USE_GPS) OSD_OSD_ELEMENT_ENTRY("VARIO", OSD_VARIO), OSD_OSD_ELEMENT_ENTRY("VARIO NUM", OSD_VARIO_NUM), #endif // defined OSD_OSD_ELEMENT_ENTRY("ALTITUDE", OSD_ALTITUDE), OSD_OSD_ELEMENT_ENTRY("AIR SPEED", OSD_AIR_SPEED), OSD_BACK_ENTRY, OSD_END_ENTRY, }; const CMS_Menu menuOsdActiveElems = { #ifdef CMS_MENU_DEBUG .GUARD_text = "MENUOSDACT", .GUARD_type = OME_MENU, #endif .onEnter = NULL, .onExit = NULL, .onGlobalExit = NULL, .entries = menuOsdActiveElemsEntries }; static const OSD_Entry cmsx_menuOsdLayoutEntries[] = { OSD_LABEL_ENTRY("---SCREEN LAYOUT---"), OSD_SUBMENU_ENTRY("ACTIVE ELEM", &menuOsdActiveElems), OSD_BACK_ENTRY, OSD_END_ENTRY, }; const CMS_Menu cmsx_menuOsdLayout = { #ifdef CMS_MENU_DEBUG .GUARD_text = "MENULAYOUT", .GUARD_type = OME_MENU, #endif .onEnter = NULL, .onExit = NULL, .onGlobalExit = NULL, .entries = cmsx_menuOsdLayoutEntries }; #endif // CMS
//Created by KVClassFactory on Tue Mar 27 21:24:44 2018 //Author: John Frankland,,, #ifndef __EXAMPLESIMDATAANALYSIS_H #define __EXAMPLESIMDATAANALYSIS_H #include "KVEventSelector.h" #include "KVZmax.h" class ExampleSimDataAnalysis : public KVEventSelector { protected: Int_t mult, Z[200], A[200]; Double_t Vpar[200], Vper[200], E[200], Theta[200], Phi[200]; KVZmax* ZMAX; public: ExampleSimDataAnalysis() {} virtual ~ExampleSimDataAnalysis() {} void InitAnalysis(); void InitRun() {} Bool_t Analysis(); void EndRun() {} void EndAnalysis() {} ClassDef(ExampleSimDataAnalysis, 1) //Analysis of simulated events }; #endif
/********************************************************** * Version $Id$ *********************************************************/ /////////////////////////////////////////////////////////// // // // SAGA // // // // System for Automated Geoscientific Analyses // // // // User Interface // // // // Program: SAGA // // // //-------------------------------------------------------// // // // WKSP_Grid_System.h // // // // Copyright (C) 2005 by Olaf Conrad // // // //-------------------------------------------------------// // // // This file is part of 'SAGA - System for Automated // // Geoscientific Analyses'. SAGA 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; version 2 of the License. // // // // SAGA 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, 5th Floor, Boston, MA 02110-1301, // // USA. // // // //-------------------------------------------------------// // // // contact: Olaf Conrad // // Institute of Geography // // University of Goettingen // // Goldschmidtstr. 5 // // 37077 Goettingen // // Germany // // // // e-mail: oconrad@saga-gis.org // // // /////////////////////////////////////////////////////////// //--------------------------------------------------------- /////////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////////// //--------------------------------------------------------- #ifndef _HEADER_INCLUDED__SAGA_GUI__WKSP_Grid_System_H #define _HEADER_INCLUDED__SAGA_GUI__WKSP_Grid_System_H /////////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////////// //--------------------------------------------------------- #include <saga_api/saga_api.h> #include "wksp_base_manager.h" /////////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////////// //--------------------------------------------------------- class CWKSP_Grid_System : public CWKSP_Base_Manager { public: CWKSP_Grid_System(const CSG_Grid_System &System); virtual TWKSP_Item Get_Type (void) { return( WKSP_ITEM_Grid_System ); } virtual wxString Get_Name (void); virtual wxString Get_Description (void); virtual wxMenu * Get_Menu (void); class CWKSP_Grid * Get_Data (int i) { return( (class CWKSP_Grid *)Get_Item(i) ); } class CWKSP_Grid * Get_Data (CSG_Grid *pGrid); class CWKSP_Grid * Add_Data (CSG_Grid *pGrid); const CSG_Grid_System & Get_System (void) { return( m_System ); } private: CSG_Grid_System m_System; }; /////////////////////////////////////////////////////////// // // // // // // /////////////////////////////////////////////////////////// //--------------------------------------------------------- #endif // #ifndef _HEADER_INCLUDED__SAGA_GUI__WKSP_Grid_System_H
#define BEGIN_STUBS void register_stubs() { #define END_STUBS } #define STUB(p) register_stub(#p, p) #include "loader.h" #define __stub uint32_t uint32_t PTR_ARG(int i);
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> #define SERVPORT 1707 #define MAXDATASIZE 100 /*每次最大数据传输量 */ int main(int argc, char *argv[]) { int sockfd; int recvbytes; char hostname[1000]; char buf[MAXDATASIZE]; struct hostent *host; struct sockaddr_in serv_addr; printf("Please enter the server's hostname!\n"); scanf("%s",hostname); if((host=gethostbyname(hostname))==NULL) { perror("gethostbyname出错!"); exit(1); } if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror("socket创建出错!"); exit(1); } serv_addr.sin_family=AF_INET; serv_addr.sin_port=htons(SERVPORT); serv_addr.sin_addr = *((struct in_addr *)host->h_addr); bzero( &(serv_addr.sin_zero),8); if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr)) == -1) { perror("connect出错!"); exit(1); } if ((recvbytes=recv(sockfd, buf, MAXDATASIZE, 0)) ==-1) { perror("recv出错!"); exit(1); } buf[recvbytes] = '\0'; printf( "Received: %s",buf); close(sockfd); return 0; }
/** @file Vector.h @brief Wrapper for Trilinos/Epetra vector This file is part of the G+Smo library. 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/. Author(s): A. Mantzaflaris */ #pragma once #include <gsCore/gsForwardDeclarations.h> #include <gsCore/gsLinearAlgebra.h> #include <gsTrilinos/SparseMatrix.h> namespace gismo { namespace trilinos { class VectorPrivate; class GISMO_EXPORT Vector { public: Vector(); explicit Vector(const SparseMatrix & _map); Vector(const gsVector<real_t> & gsVec, const SparseMatrix & _map, const int rank = 0); explicit Vector(Epetra_Vector * v_ptr); ~Vector(); size_t size() const; size_t mySize() const; void setConstant(const double val); void setFrom(const SparseMatrix & _map); void copyTo(gsVector<real_t> & gsVec, const int rank = 0) const; void copyTo(gsMatrix<real_t> & gsVec, const int = 0) const { gsVector<real_t> tmp; copyTo(tmp); tmp.swap(gsVec); } Epetra_MultiVector * get() const; Teuchos::RCP<Epetra_MultiVector> getRCP() const; void print() const; private: Vector(const Vector& other); Vector& operator=(const Vector& other); private: VectorPrivate * my; }; }//namespace trilinos }// namespace gismo
#ifndef ELEMENTBROWSER_H #define ELEMENTBROWSER_H #include <QWidget> #include <QTreeWidget> #include <QVBoxLayout> #include <QList> #include "lib/BrowserElement.h" #include "gui/ContextMenu.h" // Base class for all tabs that can be displayed in the left // sidebar, other than the corpus tab class ElementBrowser : public QTreeWidget { Q_OBJECT public: ElementBrowser(QWidget *parent); public slots: void redraw(QList<IBrowserElement*> elements); protected: QList<IBrowserElement*> m_content; virtual void finalizeElements() = 0; virtual void displayElements() = 0; IBrowserElement *elementFromId(int id) const; IBrowserElement *elementFromTreeItem(QTreeWidgetItem *item); }; #endif // ELEMENTBROWSER_H
/* * This file is a part of Xpiks - cross platform application for * keywording and uploading images for microstocks * Copyright (C) 2014-2018 Taras Kushnir <kushnirTV@gmail.com> * * 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 IBASICMODELSOURCE_H #define IBASICMODELSOURCE_H namespace Artworks { class BasicKeywordsModel; class IBasicModelSource { public: virtual ~IBasicModelSource() {} virtual BasicKeywordsModel &getBasicModel() = 0; }; } #endif // IBASICMODELSOURCE_H
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include "common_local.h" int main(int argc, char *argv[]) { struct passwd *pw; pw = getpwnam("xichen"); assert(pw); printf("name:%s, passwd:%s, uid:%d, shell:%s, dir:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_shell, pw->pw_dir); return 0; }
/* ----------------------------------------------------------------- */ /* */ /* Copyright (c) 2010-2012 hkrn */ /* */ /* All rights reserved. */ /* */ /* 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 MMDAI project team nor the names of */ /* its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ /* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */ /* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */ /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */ /* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */ /* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ /* ----------------------------------------------------------------- */ #ifndef VPVL_ASSET_H_ #define VPVL_ASSET_H_ #include "vpvl/Common.h" struct aiScene; namespace Assimp { class Importer; } namespace vpvl { /** * @file * @author hkrn * * @section DESCRIPTION * * Asset class represents an accessory */ class Bone; class PMDModel; class VPVL_API Asset { public: class UserData { public: UserData() {} virtual ~UserData() {} }; static bool isSupported(); Asset(); ~Asset(); bool load(const char *path); bool load(const uint8_t *data, size_t size); void setName(const char *name); const char *name() const { return m_name; } const Vector3 &position() const { return m_position; } const Quaternion &rotation() const { return m_rotation; } const Scalar &scaleFactor() const { return m_scale; } const Scalar &opacity() const { return m_opacity; } uint32_t loadFlags() const { return m_flags; } PMDModel *parentModel() const { return m_parentModel; } Bone *parentBone() const { return m_parentBone; } UserData *userData() const { return m_userData; } const aiScene *getScene() const { return m_scene; } void setPosition(const Vector3 &value); void setRotation(const Quaternion &value); void setScaleFactor(const Scalar &value); void setOpacity(const Scalar &value); void setLoadFlags(uint32_t value); void setParentModel(PMDModel *value); void setParentBone(Bone *value); void setUserData(UserData *value); private: Assimp::Importer *m_importer; const aiScene *m_scene; UserData *m_userData; PMDModel *m_parentModel; Bone *m_parentBone; Vector3 m_position; Quaternion m_rotation; Scalar m_scale; Scalar m_opacity; uint32_t m_flags; char *m_name; VPVL_DISABLE_COPY_AND_ASSIGN(Asset) }; typedef Array<Asset*> AssetList; } /* namespace vpvl */ #endif
/* NSTask.h Copyright (c) 1996-2007, Apple Inc. All rights reserved. */ #import <Foundation/NSObject.h> @class NSString, NSArray, NSDictionary; @interface NSTask : NSObject // Create an NSTask which can be run at a later time // An NSTask can only be run once. Subsequent attempts to // run an NSTask will raise. // Upon task death a notification will be sent // { Name = NSTaskDidTerminateNotification; object = task; } // - (instancetype)init; // set parameters // these methods can only be done before a launch // if not set, use current // if not set, use current // set standard I/O channels; may be either an NSFileHandle or an NSPipe - (void)setStandardInput:(id)input; - (void)setStandardOutput:(id)output; - (void)setStandardError:(id)error; // get parameters @property (NS_NONATOMIC_IOSONLY, copy) NSString *launchPath; @property (NS_NONATOMIC_IOSONLY, copy) NSArray *arguments; @property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *environment; @property (NS_NONATOMIC_IOSONLY, copy) NSString *currentDirectoryPath; // get standard I/O channels; could be either an NSFileHandle or an NSPipe - (id)standardInput; - (id)standardOutput; - (id)standardError; // actions - (void)launch; - (void)interrupt; // Not always possible. Sends SIGINT. - (void)terminate; // Not always possible. Sends SIGTERM. @property (NS_NONATOMIC_IOSONLY, readonly) BOOL suspend; @property (NS_NONATOMIC_IOSONLY, readonly) BOOL resume; // status @property (NS_NONATOMIC_IOSONLY, readonly) int processIdentifier; @property (NS_NONATOMIC_IOSONLY, getter=isRunning, readonly) BOOL running; @property (NS_NONATOMIC_IOSONLY, readonly) int terminationStatus; @end @interface NSTask (NSTaskConveniences) + (NSTask *)launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments; // convenience; create and launch - (void)waitUntilExit; // poll the runLoop in defaultMode until task completes @end FOUNDATION_EXPORT NSString *const NSTaskDidTerminateNotification;
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-IEs" * found in "../support/ngap-r16.4.0/38413-g40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps -no-gen-BER -no-gen-XER -no-gen-OER -no-gen-UPER` */ #include "NGAP_LastVisitedGERANCellInformation.h" /* * This type is implemented using OCTET_STRING, * so here we adjust the DEF accordingly. */ static const ber_tlv_tag_t asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NGAP_LastVisitedGERANCellInformation = { "LastVisitedGERANCellInformation", "LastVisitedGERANCellInformation", &asn_OP_OCTET_STRING, asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1, sizeof(asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1) /sizeof(asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1[0]), /* 1 */ asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1, /* Same as above */ sizeof(asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1) /sizeof(asn_DEF_NGAP_LastVisitedGERANCellInformation_tags_1[0]), /* 1 */ { #if !defined(ASN_DISABLE_OER_SUPPORT) 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ OCTET_STRING_constraint }, 0, 0, /* No members */ &asn_SPC_OCTET_STRING_specs /* Additional specs */ };
/** ****************************************************************************** * @file mygpio_nodriver.h * @author Colella Gianni - Guida Ciro - Lombardi Daniele / Group IV - Sistemi Embedded 2016-2017 * @version V1.0 * @date 7-July-2017 * @brief library mygpio_nodriver gpio ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> #include <fcntl.h> #include <errno.h> #include "gpio_custom.h" /** * @brief Data Structure to manage data associated to GPIO custom peripheral */ typedef struct{ gpio_custom_TypeDef* gpio_custom; /*!< Contains virtual address (page offset included) and offset registers value of GPIO */ int gpio_phy_address; /*!< Physical address of GPIO */ int fd; /*!< Memory file descriptor */ int r_w; /*!< Saves operation's type to do with GPIO */ uint32_t r_or_w_value; /*!< Saves read/write value from/on GPIO */ }mygpio_TypeDef; /* GPIO port MACRO -----------------------------------------------------------*/ #define GPIO_PORT 0xF /*!< GPIO ports selected to read/write */ /* Colour MACRO --------------------------------------------------------------*/ #define RESET "\033[0m" /*!< Reset colour */ #define GREEN "\033[32m" /*!< Green colour */ #define BOLDWHITE "\033[1m\033[37m" /*!< Bold White colour */ /* GPIO operation MACRO ------------------------------------------------------*/ #define READ 1 /*!< Read operation is set */ #define WRITE 0 /*!< Write operation is set */ /* GPIO page MACRO -----------------------------------------------------------*/ #define PAGE_SIZE sysconf(_SC_PAGESIZE) /*!< Page size used by SO */ #define MASK_SIZE (~(PAGE_SIZE-1)) /*!< Bit mask to extract page address, without offset */ /* Function prototypes -------------------------------------------------------*/ void mygpio_usage(char *name); /*!< usage function is called to help the user */ int mygpio_parse_command(int argc,char **argv,mygpio_TypeDef* mygpio); /*!< parse_command function is called to parse arguments passed to driver */ int mygpio_open_memory(mygpio_TypeDef* mygpio); /*!< mygpio_open_memory function is called to open memory file */ void mygpio_read_gpio(mygpio_TypeDef* mygpio); /*!< mygpio_read_gpio function is called to do read operation from GPIO */ void mygpio_write_gpio(mygpio_TypeDef* mygpio); /*!< mygpio_write_gpio function is called to do write operation on GPIO */ void mygpio_close_memory(mygpio_TypeDef* mygpio);/*!< mygpio_close_memory function is called to close memory file */
/** ****************************************************************************** * @file FatFs/FatFs_uSD/Inc/main.h * @author MCD Application Team * @version V1.4.3 * @date 29-January-2016 * @brief Header for main.c module ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_hal.h" /* EVAL includes component */ #include "stm324x9i_eval.h" /* FatFs includes component */ #include "ff_gen_drv.h" #include "sd_diskio.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #endif /* __MAIN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* * (c) Copyright Ascensio System SIA 2010-2014 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, * EU, LV-1021. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ #pragma once #ifndef OOX_THEME_BEVELT_INCLUDE_H_ #define OOX_THEME_BEVELT_INCLUDE_H_ #include "./../WritingElement.h" namespace OOX { namespace Theme { class BevelT : public WritingElement { public: BevelT(); virtual ~BevelT(); explicit BevelT(const XML::XNode& node); const BevelT& operator =(const XML::XNode& node); public: virtual void fromXML(const XML::XNode& node); virtual const XML::XNode toXML() const; private: int m_w; int m_h; }; } } #endif // OOX_THEME_BEVELT_INCLUDE_H_
#define _GNU_SOURCE #include<sys/utsname.h> #include"tlpi_hdr.h" int main(int argc,char *argv[]) { struct utsname uts; if(uname(&uts)==-1) errExit("uname"); printf("Node name : %s\n",uts.nodename); printf("System name : %s\n",uts.sysname); printf("Release : %s\n",uts.release); printf("Version: %s\n",uts.version); printf("Machine: %s\n",uts.machine); #ifdef _GNU_SOURCE printf("Domain name : %s\n",uts.domainname); #endif exit(EXIT_SUCCESS); }
/* * opencog/learning/moses/eda/instance_set.h * * Copyright (C) 2002-2008 Novamente LLC * All Rights Reserved * * Written by Moshe Looks * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3 as * published by the Free Software Foundation and including the exceptions * at http://opencog.org/wiki/Licenses * * 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, write to: * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _EDA_INSTANCE_SET_H #define _EDA_INSTANCE_SET_H #include "field_set.h" #include "scoring.h" namespace eda { template<typename ScoreT> struct instance_set : public vector<scored_instance<ScoreT> > { typedef vector<scored_instance<ScoreT> > super; typedef boost::transform_iterator < opencog::select_tag, typename super::iterator, ScoreT&, ScoreT& > score_iterator; typedef boost::transform_iterator < opencog::select_tag, typename super::const_iterator, const ScoreT&, const ScoreT& > const_score_iterator; typedef boost::transform_iterator < opencog::select_item, typename super::iterator, instance&, instance& > instance_iterator; typedef boost::transform_iterator < opencog::select_item, typename super::const_iterator, const instance&, const instance& > const_instance_iterator; instance_set(int n, const field_set& fs) : super(n, instance(fs.packed_width())), _fields(fs) { } instance_set(const field_set& fs) : _fields(fs) { } void resize(int n) { super::resize(n, instance(_fields.packed_width())); } const field_set& fields() const { return _fields; } score_iterator begin_scores() { return score_iterator(this->begin()); } score_iterator end_scores() { return score_iterator(this->end()); } /*const_score_iterator begin_scores() const { return const_score_iterator(begin()); }*/ //instance_iterator begin_instances() { return instance_iterator(begin()); } //instance_iterator end_instances() { return instance_iterator(end()); } const_instance_iterator begin_instances() const { return const_instance_iterator(this->begin()); } const_instance_iterator end_instances() const { return const_instance_iterator(this->end()); } protected: field_set _fields; }; } //~namespace eda #endif
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "GameFramework/Actor.h" #include "opencv2/core.hpp" #include "opencv2/highgui.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/videoio.hpp" #include "WebcamReader.generated.h" UCLASS() class MOBILEOPENCV_API AWebcamReader : public AActor { GENERATED_BODY() public: // Sets default values for this actor's properties AWebcamReader(); // deallocates memory for the opencv fields ~AWebcamReader(); // Called when the game starts or when spawned virtual void BeginPlay() override; // Called every frame virtual void Tick(float DeltaSeconds) override; // The device ID opened by the Video Stream UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Webcam) int32 CameraID; // If the webcam images should be resized every frame UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Webcam) bool ShouldResize; // The targeted resize width and height (width, height) UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Webcam) FVector2D ResizeDeminsions; // The rate at which the color data array and video texture is updated (in frames per second) UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Webcam) float RefreshRate; // The refresh timer UPROPERTY(BlueprintReadWrite, Category = Webcam) float RefreshTimer; // Blueprint Event called every time the video frame is updated UFUNCTION(BlueprintNativeEvent, Category = Webcam) void OnNextVideoFrame(); // OpenCV fields cv::Mat* frame; cv::VideoCapture* stream; cv::Size* size; // OpenCV prototypes void UpdateFrame(); void UpdateTexture(); // If the stream has succesfully opened yet UPROPERTY(BlueprintReadWrite, Category = Webcam) bool isStreamOpen; // The videos width and height (width, height) UPROPERTY(BlueprintReadWrite, Category = Webcam) FVector2D VideoSize; // The current video frame's corresponding texture UPROPERTY(BlueprintReadWrite, Category = Webcam) UTexture2D* VideoTexture; // The current data array UPROPERTY(BlueprintReadWrite, Category = Webcam) TArray<FColor> Data; protected: // Use this function to update the texture rects you want to change: // NOTE: There is a method called UpdateTextureRegions in UTexture2D but it is compiled WITH_EDITOR and is not marked as ENGINE_API so it cannot be linked // from plugins. // FROM: https://wiki.unrealengine.com/Dynamic_Textures void UpdateTextureRegions(UTexture2D* Texture, int32 MipIndex, uint32 NumRegions, FUpdateTextureRegion2D* Regions, uint32 SrcPitch, uint32 SrcBpp, uint8* SrcData, bool bFreeData); // Pointer to update texture region 2D struct FUpdateTextureRegion2D* VideoUpdateTextureRegion; };
/* * Copyright (c) 2015 OpenALPR Technology, Inc. * Open source Automated License Plate Recognition [http://www.openalpr.com] * * This file is part of OpenALPR. * * OpenALPR 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 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 OPENALPR_DETECTORCPU_H #define OPENALPR_DETECTORCPU_H #include <vector> #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/core/core.hpp" #include "opencv2/ml/ml.hpp" #include "detector.h" namespace alpr { class DetectorCPU : public Detector { public: DetectorCPU(Config* config, PreWarp* prewarp); virtual ~DetectorCPU(); std::vector<cv::Rect> find_plates(cv::Mat frame, cv::Size min_plate_size, cv::Size max_plate_size); private: cv::CascadeClassifier plate_cascade; }; } #endif /* OPENALPR_DETECTORCPU_H */
/* * opencog/learning/PatternMiner/HTree.h * * Copyright (C) 2012 by OpenCog Foundation * All Rights Reserved * * Written by Shujing Ke <rainkekekeke@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3 as * published by the Free Software Foundation and including the exceptions * at http://opencog.org/wiki/Licenses * * 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, write to: * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _OPENCOG_PATTERNMINER_HTREE_H #define _OPENCOG_PATTERNMINER_HTREE_H #include <map> #include <vector> #include <opencog/atoms/base/Node.h> #include <opencog/atomspace/AtomSpace.h> namespace opencog { namespace PatternMining { class HTreeNode; struct ExtendRelation // to store a super pattern of a pattern { HTreeNode* extendedHTreeNode; // super pattern HTreeNode Handle sharedLink; // link in the original pattern that connect to new extended Link Handle newExtendedLink; // in super pattern (contains variables, not the instance link), without unifying Handle extendedNode; // node that being extended in the original AtomSpace (the value node, not its variable name node) bool isExtendedFromVar; }; struct SuperRelation_b // to store a super pattern of the same gram of a pattern { HTreeNode* superHTreeNode; // the super pattern HTreeNode Handle constNode; // the const Node }; struct SubRelation_b // to store a sub pattern of the same gram of a pattern { HTreeNode* subHTreeNode; // the sub pattern HTreeNode Handle constNode; // the const Node }; class HTreeNode { public: HandleSeq pattern; Handle quotedPatternLink; // only used when if_quote_output_pattern = true HandleSeqSeq instances; // the corresponding instances of this pattern in the original AtomSpace, only be used by breadth first mining std::set<HTreeNode*> parentLinks; std::set<HTreeNode*> childLinks; // set<string> instancesUidStrings;// all uid in each instance HandleSeq in all instances, in the form of 5152_815_201584. to prevent the same instance being count multiple times std::vector<ExtendRelation> superPatternRelations; // store all the connections to its super patterns std::vector<SuperRelation_b> superRelation_b_list; // store all the superRelation_b std::map<Handle, std::vector<SubRelation_b>> SubRelation_b_map;// map<VariableNode, vector<SubRelation_b>> unsigned int count; // Number of instances grounding this pattern unsigned int var_num; // Number of the variables in this pattern double interactionInformation; double nI_Surprisingness; double nII_Surprisingness; double nII_Surprisingness_b; // calculated from the other same gram patterns unsigned int max_b_subpattern_num; std::string surprisingnessInfo; // the middle info record the surpringness calculating process for this pattern HandleSeq sharedVarNodeList; // all the shared nodes in these links in the original AtomSpace, each handle is a shared node std::string to_string() const; HTreeNode() : count(0), var_num(0), interactionInformation(0.0), nI_Surprisingness(0.0), nII_Surprisingness(0.0), nII_Surprisingness_b(1.0), max_b_subpattern_num(0) {} }; class HTree { public: HTreeNode* rootNode; HTree() { rootNode = new HTreeNode(); // the rootNode with no parents } }; } // ~namespace PatterMining using namespace PatternMining; std::string oc_to_string(const std::map<Handle, std::vector<SubRelation_b>>& sm); std::string oc_to_string(const std::vector<SuperRelation_b>& srbs); std::string oc_to_string(const std::vector<SubRelation_b>& srbs); std::string oc_to_string(const SuperRelation_b& srb); std::string oc_to_string(const SubRelation_b& srb); std::string oc_to_string(const ExtendRelation& extrel); std::string oc_to_string(const std::vector<ExtendRelation>& extrel); std::string oc_to_string(const std::vector<std::vector<HTreeNode*>>& htrees); std::string oc_to_string(const std::vector<HTreeNode*>& htrees); std::string oc_to_string(const std::set<HTreeNode*>& htrees); std::string oc_to_string(const HTreeNode* htnptr); std::string oc_to_string(const HTreeNode& htn); std::string oc_to_string(const HTree& htree); /** * Template to simplify opencog container string convertion. Name is * the name of the container, it will output * * size = <size of the container> * <elname>[0]: * <content of first element> * ... * <elname>[size-1]: * <content of last element> * * The content of each element is obtained using oc_to_string. It * assumes that the content string of an element ends by endl. * * TODO: move this to cogutil */ template<typename C> std::string oc_to_string(const C& c, const std::string& elname) { std::stringstream ss; ss << "size = " << c.size() << std::endl; int i = 0; for (const auto& el : c) { ss << elname << "[" << i << "]:" << std::endl << oc_to_string(el); i++; } return ss.str(); } } // ~namespace opencog #endif //_OPENCOG_PATTERNMINER_HTREE_H
/* ****************************************************************************** * Copyright (C) 2014, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * quantityformatter.h */ #ifndef __QUANTITY_FORMATTER_H__ #define __QUANTITY_FORMATTER_H__ #include "unicode/utypes.h" #include "unicode/uobject.h" #if !UCONFIG_NO_FORMATTING U_NAMESPACE_BEGIN class SimplePatternFormatter; class UnicodeString; class PluralRules; class NumberFormat; class Formattable; class FieldPosition; /** * A plural aware formatter that is good for expressing a single quantity and * a unit. * <p> * First use the add() methods to add a pattern for each plural variant. * There must be a pattern for the "other" variant. * Then use the format() method. * <p> * Concurrent calls only to const methods on a QuantityFormatter object are * safe, but concurrent const and non-const method calls on a QuantityFormatter * object are not safe and require synchronization. * */ class U_I18N_API QuantityFormatter : public UMemory { public: /** * Default constructor. */ QuantityFormatter(); /** * Copy constructor. */ QuantityFormatter(const QuantityFormatter& other); /** * Assignment operator */ QuantityFormatter &operator=(const QuantityFormatter& other); /** * Destructor. */ ~QuantityFormatter(); /** * Removes all variants from this object including the "other" variant. */ void reset(); /** * Adds a plural variant. * * @param variant "zero", "one", "two", "few", "many", "other" * @param rawPattern the pattern for the variant e.g "{0} meters" * @param status any error returned here. * @return TRUE on success; FALSE if status was set to a non zero error. */ UBool add( const char *variant, const UnicodeString &rawPattern, UErrorCode &status); /** * returns TRUE if this object has at least the "other" variant. */ UBool isValid() const; /** * Gets the pattern formatter that would be used for a particular variant. * If isValid() returns TRUE, this method is guaranteed to return a * non-NULL value. */ const SimplePatternFormatter *getByVariant(const char *variant) const; /** * Formats a quantity with this object appending the result to appendTo. * At least the "other" variant must be added to this object for this * method to work. * * @param quantity the single quantity. * @param fmt formats the quantity * @param rules computes the plural variant to use. * @param appendTo result appended here. * @param status any error returned here. * @return appendTo */ UnicodeString &format( const Formattable &quantity, const NumberFormat &fmt, const PluralRules &rules, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const; private: SimplePatternFormatter *formatters[6]; }; U_NAMESPACE_END #endif #endif
/*©mit************************************************************************** * * * This file is part of FRIEND UNIFYING PLATFORM. * * Copyright (c) Friend Software Labs AS. All rights reserved. * * * * Licensed under the Source EULA. Please refer to the copy of the MIT License, * * found in the file license_mit.txt. * * * *****************************************************************************©*/ // // buffered string // #ifndef __BUFFERED_STRING_H__ #define __BUFFERED_STRING_H__ #include <core/types.h> #define BUF_STRING_MAX 1024 * 12 // // BufferString structure // typedef struct BufString { FQUAD bs_Size; // current data size FQUAD bs_Bufsize; // buffer size char *bs_Buffer; // pointer to buffer FQUAD buffer_increments; FQUAD previous_increment; } BufString; /** * Creates new buffered string object with a default buffer size * @return pointer to BufString object or NULL on failure */ BufString *BufStringNew(void); /** * Creates new buffered string object with a desired buffer size * @param initial_size desired initial size * @return pointer to BufString object */ BufString *BufStringNewSize(unsigned int initial_size); /** * Deallocated a buffered string object and its buffers * @param bs pointer to a buffered string object */ void BufStringDelete(BufString *bs); /** * Appends a string to an existing buffered string object. * @param bs pointer to BufString object * @param string_to_append string to be appended * @return 0 on success, 1 on failure, string in buffer is always null-terminated */ unsigned int BufStringAdd(BufString *bs, const char *string_to_append); /** * Appends a string with a defined length to an existing buffered string object. * @param bs pointer to BufString object * @param string_to_append string to be appended * @param string_to_append_length how many bytes from the string should be added * @return 0 on success, 1 on failure, string in buffer is always null-terminated */ unsigned int BufStringAddSize(BufString *bs, const char *string_to_append, unsigned int string_to_append_length); /** * Read file to buffered string * @param path path to file * @return BufString object in file inside or NULL when error appear */ BufString *BufStringRead(const char *path ); /** * Write buffered string into file * @param bs pointer to BufString object * @param path path to file * @return 0 when success otherwise error number */ int BufStringWrite( BufString *bs, const char *path ); #endif //__BUFFERED_STRING_H__
/* * ggt-gadget-pager.c * Copyright (C) 2010-2014 Adrian Perez <aperez@igalia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #define WNCK_I_KNOW_THIS_IS_UNSTABLE /* Needed for Wnck :P */ #include "ggt.h" #include <libwnck/libwnck.h> GtkWidget* ggt_pager_new (GGTraybar *app) { GtkWidget *pager; g_assert (app); pager = wnck_pager_new (); wnck_pager_set_display_mode (WNCK_PAGER (pager), WNCK_PAGER_DISPLAY_CONTENT); wnck_pager_set_orientation (WNCK_PAGER (pager), GTK_ORIENTATION_HORIZONTAL); wnck_pager_set_show_all (WNCK_PAGER (pager), TRUE); wnck_pager_set_n_rows (WNCK_PAGER (pager), 1); gtk_widget_set_size_request (pager, 0, 0); return pager; }
/* * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility) * * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _ATK_TEST_UTIL_H #define _ATK_TEST_UTIL_H #include <stdio.h> #include <unistd.h> #include <sys/time.h> #include <glib.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> #include <locale.h> #include "atk_suite.h" extern pid_t child_pid; void run_app (const char *file_name); AtspiAccessible *get_root_obj (const char *file_name); void terminate_app (void); void clean_exit_on_fail (); #endif /* _ATK_TEST_UTIL_H */
#ifndef SIXTRACKLIB_TESTLIB_COMMON_COMPARE_C99_H__ #define SIXTRACKLIB_TESTLIB_COMMON_COMPARE_C99_H__ #if !defined( SIXTRL_NO_SYSTEM_INCLUDES ) #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #endif /* !defined( SIXTRL_NO_SYSTEM_INCLUDES ) */ #if !defined( SIXTRL_NO_INCLUDES ) #include "sixtracklib/common/definitions.h" #endif /* !defined( SIXTRL_NO_INCLUDES ) */ #if !defined( _GPUCODE ) && defined( __cplusplus ) extern "C" { #endif /* !defined( _GPUCODE ) && defined( __cplusplus ) */ SIXTRL_STATIC SIXTRL_FN int NS(TestLibCompare_int64_attribute)( SIXTRL_INT64_T const lhs_attribute, SIXTRL_INT64_T const rhs_attribute ); SIXTRL_STATIC SIXTRL_FN int NS(TestLibCompare_real_attribute)( SIXTRL_REAL_T const lhs_attribute, SIXTRL_REAL_T const rhs_attribute ); SIXTRL_STATIC SIXTRL_FN int NS(TestLibCompare_real_attribute_with_treshold)( SIXTRL_REAL_T const lhs, SIXTRL_REAL_T const rhs, SIXTRL_REAL_T const treshold ); #if !defined( _GPUCODE ) && defined( __cplusplus ) } #endif /* !defined( _GPUCODE ) && defined( __cplusplus ) */ /* ************************************************************************* */ /* ************ Inline implementation ************** */ /* ************************************************************************* */ #if !defined( _GPUCODE ) && defined( __cplusplus ) extern "C" { #endif /* !defined( _GPUCODE ) && defined( __cplusplus ) */ SIXTRL_INLINE int NS(TestLibCompare_int64_attribute)( SIXTRL_INT64_T const lhs_attribute, SIXTRL_INT64_T const rhs_attribute ) { return ( lhs_attribute == rhs_attribute ) ? 0 : ( ( lhs_attribute > rhs_attribute ) ? +1 : -1 ); } SIXTRL_INLINE int NS(TestLibCompare_real_attribute)( SIXTRL_REAL_T const lhs, SIXTRL_REAL_T const rhs ) { SIXTRL_STATIC_VAR SIXTRL_REAL_T const ZERO = ( SIXTRL_REAL_T )0; return NS(TestLibCompare_real_attribute_with_treshold)( lhs, rhs, ZERO ); } SIXTRL_INLINE int NS(TestLibCompare_real_attribute_with_treshold)( SIXTRL_REAL_T const lhs, SIXTRL_REAL_T const rhs, SIXTRL_REAL_T const treshold ) { int cmp_result = ( int )-1; SIXTRL_STATIC_VAR SIXTRL_REAL_T const ZERO = ( SIXTRL_REAL_T )0.0; SIXTRL_REAL_T const delta = lhs - rhs; if( delta == ZERO ) { cmp_result = 0; } else if( treshold >= ZERO ) { cmp_result = 0; if( ( delta >= ZERO ) && ( delta > treshold ) ) { cmp_result = -1; } else if( ( delta < ZERO ) && ( delta < -treshold ) ) { cmp_result = +1; } } return cmp_result; } #if !defined( _GPUCODE ) && defined( __cplusplus ) } #endif /* !defined( _GPUCODE ) && defined( __cplusplus ) */ #endif /* SIXTRACKLIB_TESTLIB_COMMON_COMPARE_C99_H__ */ /* end: tests/sixtracklib/testlib/common/compare.h */
/*************************************************************************** HTMLview.mcc - HTMLview MUI Custom Class Copyright (C) 1997-2000 Allan Odgaard Copyright (C) 2005-2007 by HTMLview.mcc Open Source Team 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. HTMLview class Support Site: http://www.sf.net/projects/htmlview-mcc/ $Id: README 3 2007-03-11 09:31:30Z damato $ ***************************************************************************/ #include "SDI_compiler.h" #include "SDI_hook.h" #include "SDI_lib.h" #include "SDI_stdarg.h" #ifdef __amigaos4__ #include <proto/intuition.h> /* redefine some defines to allow complexer macro use later on */ #define DoMethod IDoMethod #define DoMethodA IDoMethodA #define DoSuperMethod IDoSuperMethod #define DoSuperMethodA IDoSuperMethodA #define SetSuperAttrs ISetSuperAttrs #define CoerceMethod ICoerceMethod #define CoerceMethodA ICoerceMethodA #define CallHookA CallHookPkt #ifdef OpenWindowTags #undef OpenWindowTags #define OpenWindowTags IIntuition->OpenWindowTags #endif #ifdef NewObject #undef NewObject #define NewObject IIntuition->NewObject #endif #define GETINTERFACE(iface, type, base) (iface = (type)GetInterface((struct Library *)(base), "main", 1L, NULL)) #define DROPINTERFACE(iface) (DropInterface((struct Interface *)iface), iface = NULL) #else #include <clib/alib_protos.h> #define GETINTERFACE(iface, type, base) TRUE #define DROPINTERFACE(iface) #endif /* ! __amigaos4__ */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * Copyright (C) 2013-2015 Richard Hughes <richard@hughsie.com> * Copyright (C) 2015 Colin Walters <walters@verbum.org> * * Licensed under the GNU Lesser General Public License Version 2.1 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __DNF_TYPES_H #define __DNF_TYPES_H #include <gio/gio.h> #ifdef __cplusplus namespace libdnf { struct PackageSet; } typedef struct libdnf::PackageSet DnfPackageSet; #else typedef struct PackageSet DnfPackageSet; #endif typedef struct _DnfContext DnfContext; typedef struct _DnfTransaction DnfTransaction; typedef struct _DnfRepoLoader DnfRepoLoader; typedef struct _DnfRepo DnfRepo; typedef struct _DnfState DnfState; typedef struct _DnfSack DnfSack; typedef struct _DnfReldep DnfReldep; typedef struct _DnfReldepList DnfReldepList; /** * DnfError: * @DNF_ERROR_FAILED: Failed with a non-specific error * @DNF_ERROR_INTERNAL_ERROR: Something horrible happened * @DNF_ERROR_CANNOT_GET_LOCK: Cannot get lock for action * @DNF_ERROR_CANCELLED: The action was cancelled * @DNF_ERROR_REPO_NOT_AVAILABLE: The repo is not available * @DNF_ERROR_CANNOT_FETCH_SOURCE: Cannot fetch a software repo * @DNF_ERROR_CANNOT_WRITE_REPO_CONFIG: Cannot write a repo config file * @DNF_ERROR_PACKAGE_CONFLICTS: Package conflict exists * @DNF_ERROR_NO_PACKAGES_TO_UPDATE: No packages to update * @DNF_ERROR_PACKAGE_INSTALL_BLOCKED: Package install was blocked * @DNF_ERROR_FILE_NOT_FOUND: File was not found * @DNF_ERROR_UNFINISHED_TRANSACTION: An unfinished transaction exists * @DNF_ERROR_GPG_SIGNATURE_INVALID: GPG signature was bad * @DNF_ERROR_FILE_INVALID: File was invalid or could not be read * @DNF_ERROR_REPO_NOT_FOUND: Source was not found * @DNF_ERROR_FAILED_CONFIG_PARSING: Configuration could not be read * @DNF_ERROR_PACKAGE_NOT_FOUND: Package was not found * @DNF_ERROR_INVALID_ARCHITECTURE: Invalid architecture * @DNF_ERROR_BAD_SELECTOR: The selector was in some way bad * @DNF_ERROR_NO_SOLUTION: No solution was possible * @DNF_ERROR_BAD_QUERY: The query was in some way bad * @DNF_ERROR_NO_CAPABILITY: This feature was not available * @DNF_ERROR_NO_SPACE: Out of disk space * * The error code. **/ typedef enum { DNF_ERROR_FAILED = 1, /* Since: 0.1.0 */ DNF_ERROR_INTERNAL_ERROR = 4, /* Since: 0.1.0 */ DNF_ERROR_CANNOT_GET_LOCK = 26, /* Since: 0.1.0 */ DNF_ERROR_CANCELLED = 17, /* Since: 0.1.0 */ DNF_ERROR_REPO_NOT_AVAILABLE = 37, /* Since: 0.1.0 */ DNF_ERROR_CANNOT_FETCH_SOURCE = 64, /* Since: 0.1.0 */ DNF_ERROR_CANNOT_WRITE_REPO_CONFIG = 28, /* Since: 0.1.0 */ DNF_ERROR_PACKAGE_CONFLICTS = 36, /* Since: 0.1.0 */ DNF_ERROR_NO_PACKAGES_TO_UPDATE = 27, /* Since: 0.1.0 */ DNF_ERROR_PACKAGE_INSTALL_BLOCKED = 39, /* Since: 0.1.0 */ DNF_ERROR_FILE_NOT_FOUND = 42, /* Since: 0.1.0 */ DNF_ERROR_UNFINISHED_TRANSACTION = 66, /* Since: 0.1.0 */ DNF_ERROR_GPG_SIGNATURE_INVALID = 30, /* Since: 0.1.0 */ DNF_ERROR_FILE_INVALID = 38, /* Since: 0.1.0 */ DNF_ERROR_REPO_NOT_FOUND = 19, /* Since: 0.1.0 */ DNF_ERROR_FAILED_CONFIG_PARSING = 24, /* Since: 0.1.0 */ DNF_ERROR_PACKAGE_NOT_FOUND = 8, /* Since: 0.1.0 */ DNF_ERROR_NO_SPACE = 46, /* Since: 0.2.3 */ DNF_ERROR_INVALID_ARCHITECTURE, /* Since: 0.7.0 */ DNF_ERROR_BAD_SELECTOR, /* Since: 0.7.0 */ DNF_ERROR_NO_SOLUTION, /* Since: 0.7.0 */ DNF_ERROR_BAD_QUERY, /* Since: 0.7.0 */ DNF_ERROR_CANNOT_WRITE_CACHE, /* Since: 0.7.0 */ DNF_ERROR_NO_CAPABILITY, /* Since: 0.7.0 */ DNF_ERROR_REMOVAL_OF_PROTECTED_PKG, /* Since: 0.7.0 */ /*< private >*/ DNF_ERROR_LAST } DnfError; #define DNF_ERROR (dnf_error_quark ()) #ifdef __cplusplus extern "C" { #endif GQuark dnf_error_quark (void); #ifdef __cplusplus } #endif #endif
/* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2009, 2010 Université de Bordeaux * Copyright (C) 2010 Mehdi Juhoor <mjuhoor@gmail.com> * Copyright (C) 2010, 2011 CNRS * * StarPU is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * StarPU is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU Lesser General Public License in COPYING.LGPL for more details. */ #include <starpu.h> #include <common/config.h> #include <datawizard/filters.h> void starpu_bcsr_filter_canonical_block(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f, unsigned id, STARPU_ATTRIBUTE_UNUSED unsigned nparts) { struct starpu_bcsr_interface *bcsr_father = (struct starpu_bcsr_interface *) father_interface; /* each chunk becomes a small dense matrix */ struct starpu_matrix_interface *matrix_child = (struct starpu_matrix_interface *) child_interface; size_t elemsize = bcsr_father->elemsize; uint32_t firstentry = bcsr_father->firstentry; /* size of the tiles */ uint32_t r = bcsr_father->r; uint32_t c = bcsr_father->c; uint32_t ptr_offset = c*r*id*elemsize; matrix_child->id = STARPU_MATRIX_INTERFACE_ID; matrix_child->nx = c; matrix_child->ny = r; matrix_child->ld = c; matrix_child->elemsize = elemsize; if (bcsr_father->nzval) { uint8_t *nzval = (uint8_t *)(bcsr_father->nzval); matrix_child->ptr = (uintptr_t)&nzval[firstentry + ptr_offset]; } }
/* PaProxy, re-implementation of pulseaudio client API over other backend Copyright (C) 2014 Max Kirillov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma once #include <pulse/def.h> #include <alsa/asoundlib.h> char* pap_strcat(char* str1, const char* str2); #define PAP_GROW(str, str_size) do { \ size_t new_allocated = ((str_size) > 0) ? ((str_size) * 2) : 10; \ (str) = pa_xrealloc((str), new_allocated * sizeof(str[0])); \ assert((str)); \ (str_size) = new_allocated; \ } while (0) const char* pap_format_name(int format); snd_pcm_format_t pcm_format_from_pa_format(pa_sample_format_t pa_format);
#include <stdio.h> #include "torpedo.h" void Torpedo_Init(Torpedo* t) { t->booster = t->warhead = t->homing = false; t->state = TORPEDOSTATE_STORAGE; t->heading = 0; t->distance = 0; } void Torpedo_SetState(Torpedo* t, TorpedoState state) { t->state = state; }
// // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser <nienhueser@kde.org> // #ifndef MARBLE_DECLARATIVE_POSITIONSOURCE_H #define MARBLE_DECLARATIVE_POSITIONSOURCE_H #include "Coordinate.h" #include <QObject> #include <QtQml/qqml.h> class MarbleWidget; class PositionSource : public QObject { Q_OBJECT Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged ) Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged ) Q_PROPERTY( QString source READ source WRITE setSource NOTIFY sourceChanged ) Q_PROPERTY( bool hasPosition READ hasPosition NOTIFY hasPositionChanged ) Q_PROPERTY( Coordinate* position READ position NOTIFY positionChanged ) Q_PROPERTY( qreal speed READ speed NOTIFY speedChanged ) public: explicit PositionSource( QObject* parent = 0); bool active() const; void setActive( bool active ); QString source() const; void setSource( const QString &source ); bool hasPosition() const; Coordinate* position(); MarbleWidget *map(); void setMap( MarbleWidget *map ); qreal speed() const; Q_SIGNALS: void mapChanged(); void activeChanged(); void sourceChanged(); void hasPositionChanged(); void positionChanged(); void speedChanged(); private Q_SLOTS: void updatePosition(); private: void start(); bool m_active; QString m_source; bool m_hasPosition; Coordinate m_position; QPointer<MarbleWidget> m_marbleWidget; qreal m_speed; }; #endif
/* The Battle Grounds 3 - A Source modification Copyright (C) 2017, The Battle Grounds 2 Team and Contributors The Battle Grounds 3 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 Battle Grounds 3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Contact information: Chel "Awesome" Trunk mail, in reverse: com . gmail @ latrunkster You may also contact the (future) team via the Battle Grounds website and/or forum at: battlegrounds3.com Note that because of the sheer volume of files in the Source SDK this notice cannot be put in all of them, but merely the ones that have any changes from the original SDK. In order to facilitate easy searching, all changes are and must be commented on the following form: //BG3 - <name of contributer>[ - <small description>] */ #ifdef WIN32 #pragma once #endif #include "cbase.h" #include "baseentity.h" //enumator for at what distance the bot using this waypoint should //stop using this waypoint and fight enemies instead enum ENavPointRange { MELEE, //use for closed, tight spaces MED_RANGE, //use for semi-open areas LONG_RANGE, //use for open areas }; class CBotNavpoint : public CServerOnlyPointEntity { DECLARE_CLASS(CBotNavpoint, CServerOnlyPointEntity); public: DECLARE_DATADESC(); CBotNavpoint() {} void Spawn(void) override; protected: string_t m_iszBritPoint; //next point for british team string_t m_iszAmerPoint; //next point for american team string_t m_iszAltPoint; //branch point that either team can use CBotNavpoint* m_pBritPoint; //these are parsed on spawn CBotNavpoint* m_pAmerPoint; CBotNavpoint* m_pAltPoint; float m_flBritAltChance; //chance that a brit will branch onto the alt path float m_flAmerAltChance; bool m_bForceBritAsForward; //for one-way paths that either team can use float m_flRadius; //at what range should a bot using this point start looking at enemies instead? ENavPointRange m_eRange; public: static CBotNavpoint* ClosestPointToPlayer(CBasePlayer* pPlayer, bool bCheckVis = false); CBotNavpoint* NextPointForPlayer(const CBasePlayer* pPlayer); bool PlayerWithinRadius(const CBasePlayer* pPlayer) const; inline float GetRadius() const { return m_flRadius; } Vector GetLookTarget() const; ENavPointRange GetEnemyNoticeRange() const { return m_eRange; } };
/***************************************************************************/ /** ** @copyright Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). ** ** @license Commercial Qt/LGPL 2.1 with Nokia exception/GPL 3.0 ** ** ** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (ivan.frade@nokia.com) ** ** This file is part of the QtSparql module (not yet part of the Qt Toolkit). ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU General ** Public License version 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: ** http://www.gnu.org/copyleft/gpl.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at ivan.frade@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QSPARQLQUERYMODEL_H #define QSPARQLQUERYMODEL_H #include <qsparqlconnection.h> #include <QSparqlQuery> #include <QtCore/qabstractitemmodel.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Sparql) class QSparqlQueryModelPrivate; class QSparqlError; class QSparqlResultRow; class Q_SPARQL_EXPORT QSparqlQueryModel: public QAbstractTableModel { Q_OBJECT Q_DECLARE_PRIVATE(QSparqlQueryModel) public: explicit QSparqlQueryModel(QObject *parent = 0); virtual ~QSparqlQueryModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QSparqlResultRow resultRow(int row) const; QSparqlResultRow resultRow() const; QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); void setQuery(const QSparqlQuery &query, QSparqlConnection &conn); QSparqlQuery query() const; virtual void clear(); // FIXME: do we need this? QSparqlError lastError() const; #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) virtual QHash<int, QByteArray> roleNames() const; #endif Q_SIGNALS: void finished(); void started(); protected: virtual void queryChange(); QModelIndex indexInQuery(const QModelIndex &item) const; void setLastError(const QSparqlError &error); private: QSparqlQueryModelPrivate* d; }; QT_END_NAMESPACE QT_END_HEADER #endif // QSPARQLQUERYMODEL_H
/**************************************************************************** ** ** Copyright (C) 2013 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 CPPLOCATORFILTER_H #define CPPLOCATORFILTER_H #include "cpplocatordata.h" #include "searchsymbols.h" #include <locator/ilocatorfilter.h> namespace CppTools { namespace Internal { class CppModelManager; class CppLocatorFilter : public Locator::ILocatorFilter { Q_OBJECT public: CppLocatorFilter(CppLocatorData *locatorData); ~CppLocatorFilter(); QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry); void accept(Locator::FilterEntry selection) const; void refresh(QFutureInterface<void> &future); private: virtual QList<QList<ModelItemInfo> > itemsToMatchUserInputAgainst() const; virtual Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); protected: CppLocatorData *m_data; }; } // namespace Internal } // namespace CppTools #endif // CPPLOCATORFILTER_H
#include <gtk/gtk.h> #include "my-list-store.h" #include "my-test-object.h" static void my_list_store_tree_model_iface_init (GtkTreeModelIface * iface); static int my_list_store_get_n_columns (GtkTreeModel * self); static GType my_list_store_get_column_type (GtkTreeModel * self, int column); static void my_list_store_get_value (GtkTreeModel * self, GtkTreeIter * iter, int column, GValue * value); /* MyListStore inherits from GtkListStore, and implements the GtkTreeStore * interface */ G_DEFINE_TYPE_EXTENDED (MyListStore, my_list_store, GTK_TYPE_LIST_STORE, 0, G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, my_list_store_tree_model_iface_init)); /* our parent's model iface */ static GtkTreeModelIface parent_iface = { 0, }; /* this method is called once to set up the class */ static void my_list_store_class_init (MyListStoreClass * class) { } /* this method is called once to set up the interface */ static void my_list_store_tree_model_iface_init (GtkTreeModelIface * iface) { /* this is where we override the interface methods */ /* first make a copy of our parent's interface to call later */ parent_iface = *iface; /* now put in our own overriding methods */ iface->get_n_columns = my_list_store_get_n_columns; iface->get_column_type = my_list_store_get_column_type; iface->get_value = my_list_store_get_value; } /* this method is called every time an instance of the class is created */ static void my_list_store_init (MyListStore * self) { /* initialise the underlying storage for the GtkListStore */ GType types[] = { MY_TYPE_TEST_OBJECT }; gtk_list_store_set_column_types (GTK_LIST_STORE (self), 1, types); } /** * my_list_store_add: * @self: the #MyListStore * @obj: a #MyTestObject to add to the list * @iter: a pointer to a #GtkTreeIter for the row (or NULL) * * Appends @obj to the list. */ void my_list_store_add (MyListStore * self, MyTestObject * obj, GtkTreeIter * iter) { GtkTreeIter iter1; /* validate our parameters */ g_return_if_fail (MY_IS_LIST_STORE (self)); g_return_if_fail (MY_IS_TEST_OBJECT (obj)); /* put this object in our data storage */ gtk_list_store_append (GTK_LIST_STORE (self), &iter1); gtk_list_store_set (GTK_LIST_STORE (self), &iter1, 0, obj, -1); /* here you would connect up signals (e.g. ::notify) to notice when your * object has changed */ /* return the iter if the user cares */ if (iter) *iter = iter1; } /* retreive an object from our parent's data storage, * unref the returned object when done */ static MyTestObject * my_list_store_get_object (MyListStore * self, GtkTreeIter * iter) { GValue value = { 0, }; MyTestObject *obj; /* validate our parameters */ g_return_val_if_fail (MY_IS_LIST_STORE (self), NULL); g_return_val_if_fail (iter != NULL, NULL); /* retreive the object using our parent's interface, take our own * reference to it */ parent_iface.get_value (GTK_TREE_MODEL (self), iter, 0, &value); obj = MY_TEST_OBJECT (g_value_dup_object (&value)); g_value_unset (&value); return obj; } /* this method returns the number of columns in our tree model */ static int my_list_store_get_n_columns (GtkTreeModel * self) { return N_COLUMNS; } /* this method returns the type of each column in our tree model */ static GType my_list_store_get_column_type (GtkTreeModel * self, int column) { GType types[] = { MY_TYPE_TEST_OBJECT, G_TYPE_INT, }; /* validate our parameters */ g_return_val_if_fail (MY_IS_LIST_STORE (self), G_TYPE_INVALID); g_return_val_if_fail (column >= 0 && column < N_COLUMNS, G_TYPE_INVALID); return types[column]; } /* this method retrieves the value for a particular column */ static void my_list_store_get_value (GtkTreeModel * self, GtkTreeIter * iter, int column, GValue * value) { MyTestObject *obj; /* validate our parameters */ g_return_if_fail (MY_IS_LIST_STORE (self)); g_return_if_fail (iter != NULL); g_return_if_fail (column >= 0 && column < N_COLUMNS); g_return_if_fail (value != NULL); /* get the object from our parent's storage */ obj = my_list_store_get_object (MY_LIST_STORE (self), iter); /* initialise our GValue to the required type */ g_value_init (value, my_list_store_get_column_type (GTK_TREE_MODEL (self), column)); switch (column) { case OBJECT_COLUMN: /* the object itself was requested */ g_value_set_object (value, obj); break; case ID_COLUMN: /* the objects id was requested */ g_value_set_int (value, my_test_object_get_id (obj)); break; default: g_assert_not_reached (); } /* release the reference gained from my_list_store_get_object() */ g_object_unref (obj); }
#ifndef oxygenanimationdata_h #define oxygenanimationdata_h /* * oxygenanimationdata.h * animation modes * ------------------- * * SPDX-FileCopyrightText: 2012 Hugo Pereira Da Costa <hugo.pereira@free.fr> * * Largely inspired from Qtcurve style * SPDX-FileCopyrightText: 2003-2010 Craig Drummond <craig.p.drummond@gmail.com> * * SPDX-License-Identifier: LGPL-2.0-or-later */ #include "oxygenanimationmodes.h" namespace Oxygen { //! invalid opacity static const double OpacityInvalid = -1; class AnimationData { public: //! constructor explicit AnimationData( double opacity = OpacityInvalid, AnimationMode mode = AnimationNone ): _opacity( opacity ), _mode( mode ) {} double _opacity; AnimationMode _mode; }; } #endif