text
stringlengths
4
6.14k
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <dlfcn.h> enum {EXIT, GENERATE_PRIME, TEST_PRIME}; enum { NOT_PRIME, PRIME }; void menu(); void call_functions(int option); void test_prime_call(); int main() { int option = 0; void* handle = dlopen("libprimo.so", RTLD_LAZY); int (*generate_prime)() = dlsym(handle, "generate_prime"); int (*test_prime)() = dlsym(handle, "test_prime"); do { menu(); scanf("%d", &option); call_functions(option); } while(option != EXIT); dlclose(handle); return 0; } void menu() { printf("Escolha uma opção.\n"); printf("1) Gerar um número primo.\n"); printf("2) Testar a primalidade de um primo.\n"); printf("0) Sair do programa.\n"); } void call_functions(int option) { int prime; switch(option) { case GENERATE_PRIME: prime = generate_prime(); printf("Numero primo gerado: %d\n", prime); break; case TEST_PRIME: test_prime_call(); break; case EXIT: printf("Bye!\n"); break; default: printf("Opção inválida! Digite uma das opções apresentadas no menu...\n"); break; } } void test_prime_call() { int number; int result; printf("Digite o número que você deseja testar: \n"); scanf("%d", &number); result = test_prime(number); if(result == PRIME) { printf("O numero %d é primo!\n", number); } else { printf("O numero %d não é primo!\n", number); } }
/* * gpio-watch, a tool for running scripts in response to gpio events * Copyright (C) 2014 Lars Kellogg-Stedman <lars@oddbit.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 _GPIO_H #define _GPIO_H #define EDGE_NONE 0 #define EDGE_RISING 1 #define EDGE_FALLING 2 #define EDGE_BOTH 3 #define EDGE_SWITCH 4 #define EDGESTRLEN 8 #define DIRECTION_IN 0 #define DIRECTION_OUT 1 #define EDGESTRLEN 8 #define DIRSTRLEN 4 #define GPIODIRLEN 8 #ifndef GPIO_BASE #define GPIO_BASE "/sys/class/gpio" #endif struct pin { int pin; int edge; }; int parse_direction(const char *direction); int parse_edge(const char *edge); void pin_export(int pin); int pin_set_edge(int pin, int edge); int pin_set_direction(int pin, int direction); #endif // _GPIO_H
#include "soc_common.h" #include <errno.h> #include <fcntl.h> #include <stdarg.h> #include <sys/ioctl.h> int ioctl(int sockfd, int request, ...) { int ret; int flags; int *value; va_list ap; sockfd = soc_get_fd(sockfd); if(sockfd < 0) { errno = -sockfd; return -1; } switch(request) { case FIONBIO: va_start(ap, request); value = va_arg(ap, int*); va_end(ap); if(value == NULL) { errno = EFAULT; return -1; } flags = fcntl(sockfd, F_GETFL, 0); if(flags == -1) return -1; if(*value) ret = fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); else ret = fcntl(sockfd, F_SETFL, flags & ~O_NONBLOCK); break; default: errno = ENOTTY; ret = -1; break; } return ret; }
/* * File: Physical.h * Author: jsmtux * * Created on December 18, 2012, 2:16 PM */ #ifndef PHYSICAL_H #define PHYSICAL_H #include "../../ProjectManagement/MXML.h" #include "Math/Vector3.h" #include "Resources/Resource.h" #include <map> class Timer; enum tShape{S_BOX,S_SPHERE,S_CAPSULE,S_UNIMPLEMENTED}; class Physical{ public: Physical(); Physical(MXML::Tag &code); Physical(string dir); btRigidBody* toRigidBody(); void fromXML(MXML::Tag &code); MXML::Tag toXML(); void setMass(float m){mass=m;} void setRestitution(float r){restitution=r;} void setFriction(float f){friction=f;} void setAngularFriction(float a){angularFriction=a;} float getMass(){return mass;} float getRestitution(){return restitution;} float getFriction(){return friction;} float getAngularFriction(){return angularFriction;} void addShape(Vector3 size, Vector3 offset, tShape category); void setContactResponse(bool responds); bool getContactResponse(); private: float mass; float restitution; float friction; float angularFriction; bool contactResponse=true; struct ShapeDefinition{ ShapeDefinition(){}; ShapeDefinition(Vector3 size, Vector3 offset, tShape shape):size(size), offset(offset), shapeCategory(shape){}; Vector3 size; Vector3 offset; tShape shapeCategory; btCollisionShape* toShape(){ switch(shapeCategory){ case S_SPHERE: return new btSphereShape(size.x); break; case S_BOX: return new btBoxShape(size); break; case S_CAPSULE: return new btCapsuleShape(size.x,size.y); } } }; vector<ShapeDefinition> shape; }; #endif /* PHYSICAL_H */
#include <ATen/ATen.h> #include <ATen/native/DispatchStub.h> #include <ATen/native/TensorIterator.h> namespace at { namespace native { using qrelu_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/); using qadd_fn = void (*)(Tensor& /*out*/, const Tensor& /*self*/, const Tensor& /*other*/); using qmaxpool_2d_fn = void (*)( const Tensor& qx, int64_t iC, // input/output channels int64_t iH, int64_t iW, // input sizes int64_t oH, int64_t oW, // output sizes int64_t kH, int64_t kW, // kernel size int64_t sH, int64_t sW, // strides int64_t pH, int64_t pW, // padding int64_t dH, int64_t dW, // dilation Tensor& qy); using qadaptive_avg_pool2d_fn = void (*)( const Tensor& qx, Tensor& qy, int64_t b, int64_t sizeD, int64_t isizeH, int64_t isizeW, int64_t osizeH, int64_t osizeW, int64_t istrideB, int64_t istrideD, int64_t istrideH, int64_t istrideW); using qavg_pool2d_fn = void (*)( const Tensor& qx, Tensor& qy, int64_t b, int64_t nInputPlane, int64_t inputWidth, int64_t inputHeight, int64_t outputWidth, int64_t outputHeight, int kW, int kH, int dW, int dH, int padW, int padH, bool count_include_pad, c10::optional<int64_t> divisor_override); using qupsample_bilinear2d_fn = void (*)( Tensor& output, const Tensor& input, int64_t input_height, int64_t input_width, int64_t output_height, int64_t output_width, int64_t nbatch, int64_t channels, bool align_corners); using qcat_nhwc_fn = Tensor (*)( const c10::List<Tensor>& qxs, int64_t dim, double scale, int64_t zero_point); using qtopk_fn = void(*)(Tensor&, Tensor&, const Tensor&, int64_t, int64_t, bool, bool); // using qavg_pool2d_fn DECLARE_DISPATCH(qrelu_fn, qrelu_stub); DECLARE_DISPATCH(qrelu_fn, qrelu6_stub); DECLARE_DISPATCH(qadd_fn, qadd_stub); DECLARE_DISPATCH(qadd_fn, qadd_relu_stub); DECLARE_DISPATCH(qmaxpool_2d_fn, qmaxpool_2d_nhwc_stub); DECLARE_DISPATCH(qadaptive_avg_pool2d_fn, qadaptive_avg_pool2d_nhwc_stub); DECLARE_DISPATCH(qavg_pool2d_fn, qavg_pool2d_nhwc_stub); DECLARE_DISPATCH(qupsample_bilinear2d_fn, qupsample_bilinear2d_nhwc_stub); DECLARE_DISPATCH(qcat_nhwc_fn, qcat_nhwc_stub); DECLARE_DISPATCH(qcat_nhwc_fn, qcat_relu_nhwc_stub); DECLARE_DISPATCH(qtopk_fn, qtopk_stub); } // namespace native } // namespace at
/* * Copyright (C) 2006-2015 Christopho, Solarus - http://www.solarus-games.org * * Solarus 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. * * Solarus 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 SOLARUS_STREAM_H #define SOLARUS_STREAM_H #include "solarus/Common.h" #include "solarus/entities/Detector.h" #include <string> namespace Solarus { /** * \brief A special terrain where the hero is moved towards a specific * direction. * * The hero may or may not resist to the movement of the stream, depending * on its properties. */ class Stream: public Detector { public: static constexpr EntityType ThisType = EntityType::STREAM; Stream( const std::string& name, int layer, const Point& xy, int direction, const std::string& sprite_name ); virtual EntityType get_type() const override; int get_speed() const; void set_speed(int speed); bool get_allow_movement() const; void set_allow_movement(bool allow_movement); bool get_allow_attack() const; void set_allow_attack(bool allow_attack); bool get_allow_item() const; void set_allow_item(bool allow_item); virtual void notify_direction_changed() override; virtual bool is_obstacle_for(Entity& other) override; virtual void notify_collision( Entity& entity_overlapping, CollisionMode collision_mode ) override; void activate(Entity& target); private: int speed; /**< Speed to apply in pixels per second. */ bool allow_movement; /**< Whether the player can move the hero in this stream. */ bool allow_attack; /**< Whether the player can use the sword in this stream. */ bool allow_item; /**< Whether the player can use equipment items in this stream. */ }; } #endif
// // ipaddress.h // // Circle - A C++ bare metal environment for Raspberry Pi // Copyright (C) 2015 R. Stange <rsta2@o2online.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/>. // #ifndef _circle_net_ipaddress_h #define _circle_net_ipaddress_h #include <circle/string.h> #include <circle/types.h> #define IP_ADDRESS_SIZE 4 class CIPAddress { public: CIPAddress (void); CIPAddress (u32 nAddress); CIPAddress (const u8 *pAddress); CIPAddress (const CIPAddress &rAddress); ~CIPAddress (void); boolean operator== (const CIPAddress &rAddress2) const; boolean operator!= (const CIPAddress &rAddress2) const; boolean operator== (const u8 *pAddress2) const; boolean operator!= (const u8 *pAddress2) const; void Set (u32 nAddress); void Set (const u8 *pAddress); void Set (const CIPAddress &rAddress); const u8 *Get (void) const; void CopyTo (u8 *pBuffer) const; unsigned GetSize (void) const; void Format (CString *pString) const; boolean OnSameNetwork (const CIPAddress &rAddress2, const u8 *pNetMask) const; public: static const CIPAddress AnyAddress; private: boolean m_bValid; u8 m_Address[IP_ADDRESS_SIZE]; }; #endif
#ifndef __DIV64_H__ #define __DIV64_H__ #include <xboot.h> #include <types.h> u64_t div64(u64_t num, u64_t den); u64_t mod64(u64_t num, u64_t den); u64_t div64_64(u64_t * num, u64_t den); #endif /* __DIV64_H__ */
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** 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 General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** 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-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef OLDSTYLE_CASTS_H #define OLDSTYLE_CASTS_H #include <QtCore/qobject.h> class OldStyleCast: public QObject { Q_OBJECT public: signals: public slots: inline void foo() {} inline int bar(int, int*, const int *, volatile int *, const int * volatile *) { return 0; } inline void slot(int, QObject * const) {} }; #endif // OLDSTYLE_CASTS_H
/* * ScatterGDX.h - scatter effect * * Copyright (c) 2017-2020 gi0e5b06 (on github.com) * * This file is part of LSMM - * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #ifndef SCATTERGDX_H #define SCATTERGDX_H #include "Effect.h" #include "ScatterGDXControls.h" #include "ValueBuffer.h" #include "lmms_math.h" class ScatterGDXEffect : public Effect { public: ScatterGDXEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key); virtual ~ScatterGDXEffect(); virtual bool processAudioBuffer(sampleFrame* buf, const fpp_t frames); virtual EffectControls* controls() { return &m_gdxControls; } protected: private: ScatterGDXControls m_gdxControls; sampleFrame* m_buffer; uint32_t m_len, m_prev; int32_t m_pos, m_time; int32_t m_start, m_end; friend class ScatterGDXControls; }; #endif
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _TRAVERSE_H #define _TRAVERSE_H #pragma ident "@(#)traverse.h 1.4 05/06/08 SMI" /* * Routines used to traverse tdesc trees, invoking user-supplied callbacks * as the tree is traversed. */ #ifdef __cplusplus extern "C" { #endif #include "ctftools.h" typedef int (*tdtrav_cb_f)(tdesc_t *, tdesc_t **, void *); typedef struct tdtrav_data { int vgen; tdtrav_cb_f *firstops; tdtrav_cb_f *preops; tdtrav_cb_f *postops; void *private; } tdtrav_data_t; void tdtrav_init(tdtrav_data_t *, int *, tdtrav_cb_f *, tdtrav_cb_f *, tdtrav_cb_f *, void *); int tdtraverse(tdesc_t *, tdesc_t **, tdtrav_data_t *); int iitraverse(iidesc_t *, int *, tdtrav_cb_f *, tdtrav_cb_f *, tdtrav_cb_f *, void *); int iitraverse_hash(hash_t *, int *, tdtrav_cb_f *, tdtrav_cb_f *, tdtrav_cb_f *, void *); int iitraverse_td(iidesc_t *ii, tdtrav_data_t *); int tdtrav_assert(tdesc_t *, tdesc_t **, void *); #ifdef __cplusplus } #endif #endif /* _TRAVERSE_H */
/* * Copyright (C) 2009 Christopho, Solarus - http://www.solarus-engine.org * * Solarus 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. * * Solarus 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 SOLARUS_LANGUAGE_SCREEN_H #define SOLARUS_LANGUAGE_SCREEN_H #include "Common.h" #include "Screen.h" /** * @brief Shows a screen to let the user choose his language. * * This screen is displayed only the first time the program is launched, * that is, when the configuration file does not exist or does not contains * the language setting yet. */ class LanguageScreen: public Screen { private: Transition *transition; Surface *intermediate_surface; std::string *language_codes; TextSurface **language_texts; int cursor_position; int first_visible_language; int nb_visible_languages; static const int max_visible_languages; int nb_languages; bool finished; void set_cursor_position(int cursor_position); public: // creation and destruction LanguageScreen(Solarus &solarus); ~LanguageScreen(); // update and display void notify_event(InputEvent &event); void update(); void display(Surface *destination_surface); }; #endif
/* Copyright 1991, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <X11/Xosdefs.h> #include <stdlib.h> #include <X11/fonts/fontmisc.h> #include "stubs.h" #define XK_LATIN1 #include <X11/keysymdef.h> #ifdef __SUNPRO_C #pragma weak serverGeneration #pragma weak register_fpe_functions #endif extern void BuiltinRegisterFpeFunctions(void); /* make sure everything initializes themselves at least once */ extern unsigned long serverGeneration; unsigned long __GetServerGeneration (void); unsigned long __GetServerGeneration (void) { OVERRIDE_DATA(serverGeneration); return serverGeneration; } weak void register_fpe_functions (void) { OVERRIDE_SYMBOL(register_fpe_functions); BuiltinRegisterFpeFunctions(); FontFileRegisterFpeFunctions(); #ifdef XFONT_FC fs_register_fpe_functions(); #endif }
/* * This file is part of SpellChecker plugin for Code::Blocks Studio * Copyright (C) 2009 Daniel Anselmi * * SpellChecker plugin 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. * * SpellChecker plugin 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 SpellChecker. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef __HUNSPELL_CHECK_INTERFACE__ #define __HUNSPELL_CHECK_INTERFACE__ // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/string.h" // spell checker/thingie #include "wx/process.h" #include "wx/txtstrm.h" #include "wx/file.h" #include "SpellCheckUserInterface.h" #include "PersonalDictionary.h" // Get rid of the warning about identifiers being truncated in the debugger. Using the STL collections // will produce this everywhere. Must disable at beginning of stdafx.h because it doesn't work if // placed elsewhere. #ifdef __VISUALC__ #pragma warning(disable:4786) #endif class Hunspell; class HunspellInterface : public wxSpellCheckEngineInterface { public: HunspellInterface(wxSpellCheckUserInterface* pDlg = NULL); ~HunspellInterface(); // Spell Checker functions virtual wxString GetSpellCheckEngineName() { return _T("Hunspell"); } virtual int InitializeSpellCheckEngine(); virtual int UninitializeSpellCheckEngine(); virtual int SetOption(SpellCheckEngineOption& Option); virtual void UpdatePossibleValues(SpellCheckEngineOption& OptionDependency, SpellCheckEngineOption& OptionToUpdate); virtual wxString CheckSpelling(wxString strText); wxArrayString GetSuggestions(const wxString& strMisspelledWord); virtual bool IsWordInDictionary(const wxString& strWord); virtual int AddWordToDictionary(const wxString& strWord); virtual int RemoveWordFromDictionary(const wxString& strWord); virtual wxArrayString GetWordListAsArray(); void OpenPersonalDictionary(const wxString& strPersonalDictionaryFile); PersonalDictionary* GetPersonalDictionary() { return &m_PersonalDictionary; } void AddCustomMySpellDictionary(const wxString& strDictionaryName, const wxString& strDictionaryFileRoot); void CleanCustomMySpellDictionaries() { m_CustomMySpellDictionaryMap.clear(); } virtual wxString GetCharacterEncoding(); private: void PopulateDictionaryMap(StringToStringMap* pLookupMap, const wxString& strDictionaryPath); void AddDictionaryElement(StringToStringMap* pLookupMap, const wxString& strDictionaryPath, const wxString& strDictionaryName, const wxString& strDictionaryFileRoot); wxString GetSelectedLanguage(); wxString GetAffixFileName(); wxString GetAffixFileName(const wxString& strDictionaryName); wxString GetDictionaryFileName(); wxString GetDictionaryFileName(const wxString& strDictionaryName); Hunspell* m_pHunspell; StringToStringMap m_DictionaryLookupMap; StringToStringMap m_CustomMySpellDictionaryMap; wxString m_strDictionaryPath; PersonalDictionary m_PersonalDictionary; }; #endif // __MYSPELL_CHECK_INTERFACE__
#pragma once #include "guid.h" #include "rpc_requester.h" #include "ring_change_notifier.h" #include "ring_oracle.h" #include <mordor/fibersynchronization.h> #include <mordor/iomanager.h> #include <mordor/socket.h> #include <boost/noncopyable.hpp> #include <map> #include <set> #include <vector> namespace lightning { class PingTracker; //! This manages the ring configuration on master. class RingManager : boost::noncopyable { public: typedef boost::shared_ptr<RingManager> ptr; RingManager(GroupConfiguration::ptr groupConfiguration, const Guid& hostGroupGuid, Mordor::IOManager* ioManager, boost::shared_ptr<Mordor::FiberEvent> hostDownEvent, RpcRequester::ptr requester, PingTracker::ptr acceptorPingTracker, RingOracle::ptr ringOracle, RingChangeNotifier::ptr ringChangeNotifier, uint64_t setRingTimeoutUs, uint64_t lookupRingRetryUs, uint64_t ringBroadcastIntervalUs); void run(); void broadcastRing(); private: void lookupRing(); bool trySetRing(); void waitForRingToBreak(); uint32_t generateRingId(const std::vector<uint32_t>& ring) const; //! Should redo this with ragel if it ever gets more states. enum State { LOOKING = 0, WAIT_ACK, OK }; GroupConfiguration::ptr groupConfiguration_; const Guid hostGroupGuid_; const uint64_t setRingTimeoutUs_; const uint64_t lookupRingRetryUs_; const uint64_t ringBroadcastIntervalUs_; Mordor::IOManager* ioManager_; boost::shared_ptr<Mordor::FiberEvent> hostDownEvent_; RpcRequester::ptr requester_; PingTracker::ptr acceptorPingTracker_; RingOracle::ptr ringOracle_; RingChangeNotifier::ptr ringChangeNotifier_; RingConfiguration::ptr currentRing_; RingConfiguration::ptr nextRing_; State currentState_; Mordor::FiberMutex mutex_; static const uint32_t kHashSeed = 239; }; } // namespace lightning
/* A Bison parser, made by GNU Bison 2.7. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_YY_Y_TAB_H_INCLUDED # define YY_YY_Y_TAB_H_INCLUDED /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif #if YYDEBUG extern int mu_sieve_yydebug; #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum mu_sieve_yytokentype { IDENT = 258, TAG = 259, NUMBER = 260, STRING = 261, MULTILINE = 262, REQUIRE = 263, IF = 264, ELSIF = 265, ELSE = 266, ANYOF = 267, ALLOF = 268, NOT = 269 }; #endif /* Tokens. */ #define IDENT 258 #define TAG 259 #define NUMBER 260 #define STRING 261 #define MULTILINE 262 #define REQUIRE 263 #define IF 264 #define ELSIF 265 #define ELSE 266 #define ANYOF 267 #define ALLOF 268 #define NOT 269 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 2058 of yacc.c */ #line 33 "sieve.y" char *string; size_t number; sieve_instr_t instr; mu_sieve_value_t *value; mu_list_t list; size_t pc; struct { size_t start; size_t end; } pclist; struct { char *ident; mu_list_t args; } command; struct { size_t begin; size_t cond; size_t branch; } branch; /* Line 2058 of yacc.c */ #line 108 "sieve-gram.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define mu_sieve_yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE mu_sieve_yylval; #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int mu_sieve_yyparse (void *YYPARSE_PARAM); #else int mu_sieve_yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int mu_sieve_yyparse (void); #else int mu_sieve_yyparse (); #endif #endif /* ! YYPARSE_PARAM */ #endif /* !YY_YY_Y_TAB_H_INCLUDED */
/** * Copyright (C) 2002-2013 by * Jeffrey Fulmer - <jeff@joedog.org>, et al. * This file is distributed as part of Siege * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *-- */ #ifndef BOOLEAN_H #define BOOLEAN_H typedef enum {boolean_false=0,boolean_true=1} BOOLEAN; #ifndef FALSE # define FALSE boolean_false #endif /*FALSE*/ #ifndef TRUE # define TRUE boolean_true #endif /*TRUE*/ #endif/*BOOLEAN_H*/
/* * This file is part of the libsigrok project. * * Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.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 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdlib.h> #include <check.h> #include "../include/libsigrok/libsigrok.h" #include "lib.h" int main(void) { int ret; Suite *s; SRunner *srunner; s = suite_create("mastersuite"); srunner = srunner_create(s); /* Add all testsuites to the master suite. */ srunner_add_suite(srunner, suite_core()); srunner_add_suite(srunner, suite_driver_all()); srunner_add_suite(srunner, suite_input_all()); srunner_add_suite(srunner, suite_input_binary()); srunner_add_suite(srunner, suite_output_all()); srunner_add_suite(srunner, suite_strutil()); srunner_add_suite(srunner, suite_version()); srunner_run_all(srunner, CK_VERBOSE); ret = srunner_ntests_failed(srunner); srunner_free(srunner); return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }
/* * Platformer Game Engine by Wohlstand, a free platform for game making * Copyright (c) 2014-2019 Vitaly Novichkov <admin@wohlnet.ru> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * 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/>. */ #pragma once #ifndef WLD_HISTORY_MANAGER_H #define WLD_HISTORY_MANAGER_H #include <QObject> #include "items/item_tile.h" #include "items/item_scene.h" #include "items/item_path.h" #include "items/item_level.h" #include "items/item_music.h" #include "items/item_point.h" class WldHistoryManager : public QObject { Q_OBJECT friend class WldScene; WldScene* m_scene; bool historyChanged; int historyIndex; QList<QSharedPointer<IHistoryElement> > operationList; public: explicit WldHistoryManager(WldScene* scene, QObject* parent = nullptr); void addRemoveHistory(WorldData removedItems); void addPlaceHistory(WorldData placedItems); void addOverwriteHistory(WorldData removedItems, WorldData placedItems); void addMoveHistory(WorldData sourceMovedItems, WorldData targetMovedItems); void addChangeWorldSettingsHistory(HistorySettings::WorldSettingSubType subtype, QVariant extraData); void addChangeSettingsHistory(WorldData modifiedItems, HistorySettings::WorldSettingSubType subType, QVariant extraData); void addRotateHistory(WorldData rotatedItems, WorldData unrotatedItems); void addFlipHistory(WorldData flippedItems, WorldData unflippedItems); void addTransformHistory(WorldData transformedItems, WorldData sourceItems); //history information int getHistroyIndex(); bool canUndo(); bool canRedo(); public slots: //history modifiers void historyBack(); void historyForward(); void updateHistoryBuffer(); signals: void refreshHistoryButtons(); void showStatusMessage(QString text, int delay=2000); }; #endif // WLD_HISTORY_MANAGER_H
#include "../../openexr-2.5.7/OpenEXR/IlmImf/ImfFastHuf.h"
/* * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU 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 * * neuralnet.h * * by Gary Wong, 1998 * $Id: neuralnet.h,v 1.31 2014/05/11 15:32:35 plm Exp $ */ #ifndef NEURALNET_H #define NEURALNET_H #include <stdio.h> #include "common.h" typedef struct _neuralnet { unsigned int cInput; unsigned int cHidden; unsigned int cOutput; unsigned int fDirect; int nTrained; float rBetaHidden; float rBetaOutput; float *arHiddenWeight; float *arOutputWeight; float *arHiddenThreshold; float *arOutputThreshold; } neuralnet; typedef enum { NNEVAL_NONE, NNEVAL_SAVE, NNEVAL_FROMBASE } NNEvalType; typedef enum { NNSTATE_NONE = -1, NNSTATE_INCREMENTAL, NNSTATE_DONE } NNStateType; typedef struct _NNState { NNStateType state; float *savedBase; float *savedIBase; #if !defined(USE_SIMD_INSTRUCTIONS) int cSavedIBase; #endif } NNState; extern int NeuralNetCreate(neuralnet * pnn, unsigned int cInput, unsigned int cHidden, unsigned int cOutput, float rBetaHidden, float rBetaOutput); extern void NeuralNetDestroy(neuralnet * pnn); #if !USE_SIMD_INSTRUCTIONS extern int NeuralNetEvaluate(const neuralnet * pnn, float arInput[], float arOutput[], NNState * pnState); #else extern int NeuralNetEvaluateSSE(const neuralnet * pnn, float arInput[], float arOutput[], NNState * pnState); #endif extern int NeuralNetLoad(neuralnet * pnn, FILE * pf); extern int NeuralNetLoadBinary(neuralnet * pnn, FILE * pf); extern int NeuralNetSaveBinary(const neuralnet * pnn, FILE * pf); extern int SIMD_Supported(void); /* Try to determine whetehr we are 64-bit or 32-bit */ #if _WIN32 || _WIN64 #if _WIN64 #define ENVIRONMENT64 #else #define ENVIRONMENT32 #endif #endif #if __GNUC__ #if __x86_64__ #define ENVIRONMENT64 #else #define ENVIRONMENT32 #endif #endif #endif
/***************************************************************************** * Copyright 2015-2020 Alexander Barthel alex@littlenavmap.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 ATOOLS_XPAIRPORTINDEX_H #define ATOOLS_XPAIRPORTINDEX_H #include "util/str.h" #include <QHash> #include <QSet> #include <QVariant> namespace atools { namespace geo { class Pos; } namespace fs { namespace common { /* * Filled when reading airports in the beginning of the compilation process. * Provides an index from airport ICAO to airport_id and runwayname/airport ICAO to runway_end_id. */ class AirportIndex { public: AirportIndex(); /* Add airport to index. Returns true if it was added. ident should be ICAO for X-Plane. * Uses a different set/hash than getAirportId and addAirportId */ bool addAirportIdent(const QString& airportIdent); /* Add airport id to index. Returns true if it was added. ident should be ICAO for X-Plane. */ bool addAirportId(const QString& airportIdent, int airportId, const atools::geo::Pos& pos); /* Get id packed in a variant or a null integer variant if not found. * Returns null if airport id is ENRT */ QVariant getAirportIdVar(const QString& airportIdent) const; /* As above but -1 for not found */ int getAirportId(const QString& airportIdent) const; /* Airport position or invalid pos if not found */ atools::geo::Pos getAirportPos(const QString& airportIdent) const; /* Add runway end id to index. Returns true if it was added. ident should be ICAO for X-Plane. */ void addRunwayEnd(const QString& airportIdent, const QString& runwayName, int runwayEndId, const atools::geo::Pos& runwayEndPos); /* Get runway end id packed in a variant or a null integer variant if not found. * Returns null if airport id is ENRT */ QVariant getRunwayEndIdVar(const QString& airportIdent, const QString& runwayName) const; /* As above but -1 for not found */ int getRunwayEndId(const QString& airportIdent, const QString& runwayName) const; /* Get position of runway end. Invalid pos if not found */ atools::geo::Pos getRunwayEndPos(const QString& airportIdent, const QString& runwayName) const; void addAirportIls(const QString& airportIdent, const QString& airportRegion, const QString& ilsIdent, int ilsId); int getAirportIlsId(const QString& airportIdent, const QString& airportRegion, const QString& ilsIdent) const; void addSkippedAirportIls(const QString& airportIdent, const QString& airportRegion, const QString& ilsIdent); bool hasSkippedAirportIls(const QString& airportIdent, const QString& airportRegion, const QString& ilsIdent) const; /* Returns true if ICAO duplicates appear */ bool addIdentIcaoMapping(const QString& airportIdent, const QString& icao); void clearSkippedIls() { skippedIlsSet.clear(); } void clear(); typedef atools::util::Str<8> Name; typedef atools::util::StrPair<8> Name2; typedef atools::util::StrTriple<8> Name3; private: // Airport ICAO to airport_id QHash<Name, int> identToIdMap; // Airport idents QSet<Name> airportIdents; // Maps airport idents to ICAO QHash<Name, Name> identToIcaoMap; QHash<Name, atools::geo::Pos> identToPosMap; // Airport ICAO and runway name to runway_end_id QHash<Name2, int> identRunwayNameToEndId; QHash<Name2, atools::geo::Pos> identRunwayNameToEndPos; // Airport ICAO, airport region and ILS ident to ils_id QHash<Name3, int> airportIlsIdMap; QSet<Name3> skippedIlsSet; }; } // namespace common } // namespace fs } // namespace atools Q_DECLARE_TYPEINFO(atools::fs::common::AirportIndex::Name, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(atools::fs::common::AirportIndex::Name2, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(atools::fs::common::AirportIndex::Name3, Q_PRIMITIVE_TYPE); #endif // ATOOLS_XPAIRPORTINDEX_H
#ifndef PRETTYITEMDELEGATE_H #define PRETTYITEMDELEGATE_H #include <QModelIndex> #include <QStyledItemDelegate> class QPainter; class QProgressBar; class PrettyItemDelegate : public QStyledItemDelegate { Q_OBJECT public: PrettyItemDelegate(QObject* parent, bool downloadInfo = false); ~PrettyItemDelegate(); QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const; void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const; QRect downloadButtonRect(QRect line) const; QRect authorRect(const QModelIndex& index) const; private: void createPlayIcon(); void paintBody( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const; void paintDownloadInfo( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; // active track painting void paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const; void paintPlayIcon(QPainter *painter) const; // Paints the video duration void drawTime(QPainter *painter, QString time, QRectF line) const; static const qreal THUMB_WIDTH; static const qreal THUMB_HEIGHT; static const qreal PADDING; QPixmap playIcon; QFont boldFont; QFont smallerFont; QFont smallerBoldFont; bool downloadInfo; QProgressBar *progressBar; }; #endif
/** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * 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/>. * */ #pragma once /** * endstops.h - manages endstops */ #include "../inc/MarlinConfig.h" #include <stdint.h> enum EndstopEnum : char { X_MIN, Y_MIN, Z_MIN, Z_MIN_PROBE, X_MAX, Y_MAX, Z_MAX, X2_MIN, X2_MAX, Y2_MIN, Y2_MAX, Z2_MIN, Z2_MAX, Z3_MIN, Z3_MAX, Z4_MIN, Z4_MAX }; class Endstops { public: #if HAS_EXTRA_ENDSTOPS typedef uint16_t esbits_t; TERN_(X_DUAL_ENDSTOPS, static float x2_endstop_adj); TERN_(Y_DUAL_ENDSTOPS, static float y2_endstop_adj); TERN_(Z_MULTI_ENDSTOPS, static float z2_endstop_adj); #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 static float z3_endstop_adj; #endif #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 static float z4_endstop_adj; #endif #else typedef uint8_t esbits_t; #endif private: static bool enabled, enabled_globally; static esbits_t live_state; static volatile uint8_t hit_state; // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index #if ENDSTOP_NOISE_THRESHOLD static esbits_t validated_live_state; static uint8_t endstop_poll_count; // Countdown from threshold for polling #endif public: Endstops() {}; /** * Initialize the endstop pins */ static void init(); /** * Are endstops or the probe set to abort the move? */ FORCE_INLINE static bool abort_enabled() { return enabled || TERN0(HAS_BED_PROBE, z_probe_enabled); } static inline bool global_enabled() { return enabled_globally; } /** * Periodic call to poll endstops if required. Called from temperature ISR */ static void poll(); /** * Update endstops bits from the pins. Apply filtering to get a verified state. * If abort_enabled() and moving towards a triggered switch, abort the current move. * Called from ISR contexts. */ static void update(); /** * Get Endstop hit state. */ FORCE_INLINE static uint8_t trigger_state() { return hit_state; } /** * Get current endstops state */ FORCE_INLINE static esbits_t state() { return #if ENDSTOP_NOISE_THRESHOLD validated_live_state #else live_state #endif ; } /** * Report endstop hits to serial. Called from loop(). */ static void event_handler(); /** * Report endstop states in response to M119 */ static void report_states(); // Enable / disable endstop checking globally static void enable_globally(const bool onoff=true); // Enable / disable endstop checking static void enable(const bool onoff=true); // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable static void not_homing(); #if ENABLED(VALIDATE_HOMING_ENDSTOPS) // If the last move failed to trigger an endstop, call kill static void validate_homing_move(); #else FORCE_INLINE static void validate_homing_move() { hit_on_purpose(); } #endif // Clear endstops (i.e., they were hit intentionally) to suppress the report FORCE_INLINE static void hit_on_purpose() { hit_state = 0; } // Enable / disable endstop z-probe checking #if HAS_BED_PROBE static volatile bool z_probe_enabled; static void enable_z_probe(const bool onoff=true); #endif static void resync(); // Debugging of endstops #if ENABLED(PINS_DEBUGGING) static bool monitor_flag; static void monitor(); static void run_monitor(); #endif #if ENABLED(SPI_ENDSTOPS) typedef struct { union { bool any; struct { bool x:1, y:1, z:1; }; }; } tmc_spi_homing_t; static tmc_spi_homing_t tmc_spi_homing; static void clear_endstop_state(); static bool tmc_spi_homing_check(); #endif }; extern Endstops endstops; /** * A class to save and change the endstop state, * then restore it when it goes out of scope. */ class TemporaryGlobalEndstopsState { bool saved; public: TemporaryGlobalEndstopsState(const bool enable) : saved(endstops.global_enabled()) { endstops.enable_globally(enable); } ~TemporaryGlobalEndstopsState() { endstops.enable_globally(saved); } };
/* file name: ch0501_ptr01.c author: Jung,JaeJoon(rgbi3307@nate.com, http://www.kernel.bz/) comments: Æ÷ÀÎÅÍ ±âÃÊ */ #include <stdio.h> main () { int x = 1, y = 2; int z[7] = {1, 2, 3, 4, 5, 6, 7}; int *ip; //ip´Â int¿¡ ´ëÇÑ Æ÷ÀÎÅÍÀÌ´Ù(ip is a pointer to int) int i; //º¯¼ö x¿Í yÀÇ ÁÖ¼Ò Ãâ·Â printf ("addr: %X, %X\n", &x, &y); //Á¤¼öÇü ¹è¿­ zÀÇ ÁÖ¼Ò Ãâ·Â for (i = 0; i < 7; i++) printf("%X, ", &z[i]); printf("\n"); ip = &x; //ip´Â x¸¦ °¡¸£Å²´Ù(ip points to x) y = *ip; //y´Â 1ÀÌ µÈ´Ù *ip = 0; //x´Â 0ÀÌ µÈ´Ù printf("ip=%X, x=%d, y=%d\n", ip, x, y); ip = &z[0]; //ip´Â z[0]¸¦ °¡¸£Å²´Ù(ip points to z[0]) *ip = *ip + 10; //z[0]°ª¿¡ 10À» ´õÇÑ´Ù y = *ip + 1; //*ip°ª¿¡ 1À» ´õÇÑ´Ù printf("ip=%X, x=%d, y=%d\n", ip, x, y); *ip += 1; //*ip°ª¿¡ 1À» ´õÇÑ´Ù x = ++*ip; //*ip°ª¿¡ 1À» ´õÇÑ´Ù printf("ip=%X, x=%d, y=%d\n", ip, x, y); x = *ip++; //ip ÁÖ¼Ò¸¦ Áõ°¡½ÃŲ´Ù y = (*ip)++; //*ip°ªÀ» Áõ°¡½ÃŲ´Ù. printf("ip=%X, x=%d, y=%d, *ip=%d\n", ip, x, y, *ip); printf("\nPress any key to end..."); getchar(); }
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__50E4147E_A508_4D85_BF0A_BA26676063F0__INCLUDED_) #define AFX_STDAFX_H__50E4147E_A508_4D85_BF0A_BA26676063F0__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__50E4147E_A508_4D85_BF0A_BA26676063F0__INCLUDED_)
/* * Copyright (C) 2016 Javad Doliskani, javad.doliskani@uwaterloo.ca * * 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 <stdio.h> #include <stdlib.h> #include <string.h> #include "sidh_elliptic_curve.h" #include "sidh_public_param.h" #include "sidh_isogeny.h" #include "sidh_private_key.h" #include "sidh_public_key.h" #include "sidh_shared_key.h" #include "sidh_util.h" #include "sidh_public_key_validation.h" #include <math.h> #include <time.h> #include <stdint.h> void test_key_exchange(const public_params_t paramsA, const public_params_t paramsB) { sidh_fp_init_chararacteristic(paramsA->characteristic); private_key_t Alice_private_key; sidh_private_key_init(Alice_private_key); sidh_private_key_generate(Alice_private_key, paramsA); printf("Alice's private key: \n"); sidh_private_key_print(Alice_private_key); printf("\n--------------------------------------------\n\n"); public_key_t Alice_public_key; sidh_public_key_init(Alice_public_key); point_t kernel_gen; sidh_point_init(kernel_gen); sidh_private_key_compute_kernel_gen(kernel_gen, Alice_private_key, paramsA->P, paramsA->Q, paramsA->le, paramsA->E); sidh_public_key_generate(Alice_public_key, kernel_gen, paramsA, paramsB); printf("Alice's public key: \n"); sidh_public_key_print(Alice_public_key); printf("\n--------------------------------------------\n\n"); private_key_t Bob_private_key; sidh_private_key_init(Bob_private_key); sidh_private_key_generate(Bob_private_key, paramsB); printf("Bob's private key: \n"); sidh_private_key_print(Bob_private_key); printf("\n--------------------------------------------\n\n"); public_key_t Bob_public_key; sidh_public_key_init(Bob_public_key); sidh_private_key_compute_kernel_gen(kernel_gen, Bob_private_key, paramsB->P, paramsB->Q, paramsB->le, paramsB->E); sidh_public_key_generate(Bob_public_key, kernel_gen, paramsB, paramsA); printf("Bob's public key: \n"); sidh_public_key_print(Bob_public_key); printf("\n--------------------------------------------\n\n"); fp2_element_t Alice_shared_key; sidh_fp2_init(Alice_shared_key); sidh_shared_key_generate(Alice_shared_key, Bob_public_key, Alice_private_key, paramsA); printf("Alice's shared key: \n"); printf("%s\n", sidh_fp2_get_str(Alice_shared_key)); printf("\n--------------------------------------------\n\n"); fp2_element_t Bob_shared_key; sidh_fp2_init(Bob_shared_key); sidh_shared_key_generate(Bob_shared_key, Alice_public_key, Bob_private_key, paramsB); printf("Bob's shared key: \n"); printf("%s\n", sidh_fp2_get_str(Bob_shared_key)); printf("\n--------------------------------------------\n\n"); sidh_private_key_clear(Alice_private_key); sidh_public_key_clear(Alice_public_key); sidh_private_key_clear(Bob_private_key); sidh_public_key_clear(Bob_public_key); sidh_point_clear(kernel_gen); sidh_fp2_clear(Alice_shared_key); sidh_fp2_clear(Bob_shared_key); } int main(int argc, char** argv) { char *input_params = "public_params_521"; if (argc > 1) { input_params = argv[1]; } public_params_t paramsA; public_params_t paramsB; sidh_public_params_init(paramsA); sidh_public_params_init(paramsB); if (!sidh_public_params_read(paramsA, paramsB, input_params)) return (EXIT_FAILURE); printf("Public parameters:\n"); sidh_public_params_print(paramsA, 0); sidh_public_params_print(paramsB, 1); printf("\n--------------------------------------------\n\n"); test_key_exchange(paramsA, paramsB); sidh_public_params_clear(paramsA); sidh_public_params_clear(paramsB); return (EXIT_SUCCESS); }
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_METRICS_STATS_COUNTERS_H_ #define BASE_METRICS_STATS_COUNTERS_H_ #pragma once #include <string> #include "base/base_export.h" #include "base/metrics/stats_table.h" #include "base/time.h" namespace base { // StatsCounters are dynamically created values which can be tracked in // the StatsTable. They are designed to be lightweight to create and // easy to use. // // Since StatsCounters can be created dynamically by name, there is // a hash table lookup to find the counter in the table. A StatsCounter // object can be created once and used across multiple threads safely. // // Example usage: // { // StatsCounter request_count("RequestCount"); // request_count.Increment(); // } // // Note that creating counters on the stack does work, however creating // the counter object requires a hash table lookup. For inner loops, it // may be better to create the counter either as a member of another object // (or otherwise outside of the loop) for maximum performance. // // Internally, a counter represents a value in a row of a StatsTable. // The row has a 32bit value for each process/thread in the table and also // a name (stored in the table metadata). // // NOTE: In order to make stats_counters usable in lots of different code, // avoid any dependencies inside this header file. // //------------------------------------------------------------------------------ // Define macros for ease of use. They also allow us to change definitions // as the implementation varies, or depending on compile options. //------------------------------------------------------------------------------ // First provide generic macros, which exist in production as well as debug. #define STATS_COUNTER(name, delta) do { \ base::StatsCounter counter(name); \ counter.Add(delta); \ } while (0) #define SIMPLE_STATS_COUNTER(name) STATS_COUNTER(name, 1) #define RATE_COUNTER(name, duration) do { \ base::StatsRate hit_count(name); \ hit_count.AddTime(duration); \ } while (0) // Define Debug vs non-debug flavors of macros. #ifndef NDEBUG #define DSTATS_COUNTER(name, delta) STATS_COUNTER(name, delta) #define DSIMPLE_STATS_COUNTER(name) SIMPLE_STATS_COUNTER(name) #define DRATE_COUNTER(name, duration) RATE_COUNTER(name, duration) #else // NDEBUG #define DSTATS_COUNTER(name, delta) do {} while (0) #define DSIMPLE_STATS_COUNTER(name) do {} while (0) #define DRATE_COUNTER(name, duration) do {} while (0) #endif // NDEBUG //------------------------------------------------------------------------------ // StatsCounter represents a counter in the StatsTable class. class BASE_EXPORT StatsCounter { public: // Create a StatsCounter object. explicit StatsCounter(const std::string& name); virtual ~StatsCounter(); // Sets the counter to a specific value. void Set(int value); // Increments the counter. void Increment() { Add(1); } virtual void Add(int value); // Decrements the counter. void Decrement() { Add(-1); } void Subtract(int value) { Add(-value); } // Is this counter enabled? // Returns false if table is full. bool Enabled() { return GetPtr() != NULL; } int value() { int* loc = GetPtr(); if (loc) return *loc; return 0; } protected: StatsCounter(); // Returns the cached address of this counter location. int* GetPtr(); std::string name_; // The counter id in the table. We initialize to -1 (an invalid value) // and then cache it once it has been looked up. The counter_id is // valid across all threads and processes. int32 counter_id_; }; // A StatsCounterTimer is a StatsCounter which keeps a timer during // the scope of the StatsCounterTimer. On destruction, it will record // its time measurement. class BASE_EXPORT StatsCounterTimer : protected StatsCounter { public: // Constructs and starts the timer. explicit StatsCounterTimer(const std::string& name); virtual ~StatsCounterTimer(); // Start the timer. void Start(); // Stop the timer and record the results. void Stop(); // Returns true if the timer is running. bool Running(); // Accept a TimeDelta to increment. virtual void AddTime(TimeDelta time); protected: // Compute the delta between start and stop, in milliseconds. void Record(); TimeTicks start_time_; TimeTicks stop_time_; }; // A StatsRate is a timer that keeps a count of the number of intervals added so // that several statistics can be produced: // min, max, avg, count, total class BASE_EXPORT StatsRate : public StatsCounterTimer { public: // Constructs and starts the timer. explicit StatsRate(const std::string& name); virtual ~StatsRate(); virtual void Add(int value); private: StatsCounter counter_; StatsCounter largest_add_; }; // Helper class for scoping a timer or rate. template<class T> class StatsScope { public: explicit StatsScope<T>(T& timer) : timer_(timer) { timer_.Start(); } ~StatsScope() { timer_.Stop(); } void Stop() { timer_.Stop(); } private: T& timer_; }; } // namespace base #endif // BASE_METRICS_STATS_COUNTERS_H_
/* * freeacq is the legal property of Víctor Enríquez Miguel. * * 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 Street, Fifth Floor, Boston, * MA 02110-1301, USA. * */ #ifndef _FREEACQ_LOG_WINDOW_H #define _FREEACQ_LOG_WINDOW_H G_BEGIN_DECLS #define FACQ_TYPE_LOG_WINDOW (facq_log_window_get_type()) #define FACQ_LOG_WINDOW(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst),FACQ_TYPE_LOG_WINDOW,FacqLogWindow)) #define FACQ_LOG_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),FACQ_TYPE_LOG_WINDOW, FacqLogWindowClass)) #define FACQ_IS_LOG_WINDOW(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst),FACQ_TYPE_LOG_WINDOW)) #define FACQ_IS_LOG_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),FACQ_TYPE_LOG_WINDOW)) #define FACQ_LOG_WINDOW_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst),FACQ_TYPE_LOG_WINDOW, FacqLogWindowClass)) typedef struct _FacqLogWindow FacqLogWindow; typedef struct _FacqLogWindowClass FacqLogWindowClass; typedef struct _FacqLogWindowPrivate FacqLogWindowPrivate; struct _FacqLogWindow { /*< private >*/ GObject parent_instance; FacqLogWindowPrivate *priv; }; struct _FacqLogWindowClass { /*< private >*/ GObjectClass parent_class; }; GType facq_log_window_get_type(void) G_GNUC_CONST; FacqLogWindow *facq_log_window_new(GtkWidget *top_window,const gchar *filename,guint lines,GError **err); void facq_log_window_free(FacqLogWindow *log_window); G_END_DECLS #endif
#pragma once #define MAX_BYTES 4096 #include <iostream> #include <fstream> #include <string> class Buffer { public: Buffer(std::string inputFile, std::streamoff startPosition, size_t bufferSize); ~Buffer(); char* get(const uint64_t position, const size_t size); private: void load(const uint64_t FRAGMENT); char* buffer; uint64_t currentFragment; std::ifstream* inputStream; const std::streamoff START_POSITION; const size_t BUFFER_SIZE; };
/* libltc - en+decode linear timecode Copyright (C) 2006-2012 Robin Gareus <robin@gareus.org> 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 library. If not, see <http://www.gnu.org/licenses/>. */ //#include <stdio.h> //#include <stdlib.h> //#include <string.h> //#include <math.h> /** * add values to the output buffer */ static int addvalues(LTCEncoder *e, int n) { const ltcsnd_sample_t tgtval = e->state ? e->enc_hi : e->enc_lo; if (e->offset + n >= e->bufsize) { #if 0 fprintf(stderr, "libltc: buffer overflow: %d/%lu\n", (int) e->offset, (unsigned long) e->bufsize); #endif return 1; } ltcsnd_sample_t * const wave = &(e->buf[e->offset]); const double tcf = e->filter_const; if (tcf > 0) { /* low-pass-filter * LTC signal should have a rise time of 40 us +/- 10 us. * * rise-time means from <10% to >90% of the signal. * in each call to addvalues() we start at 50%, so * here we need half-of it. (0.000020 sec) * * e->cutoff = 1.0 -exp( -1.0 / (sample_rate * .000020 / exp(1.0)) ); */ int i; ltcsnd_sample_t val = SAMPLE_CENTER; int m = (n+1)>>1; for (i = 0 ; i < m ; i++) { val = val + tcf * (tgtval - val); wave[n-i-1] = wave[i] = val; } } else { /* perfect square wave */ memset(wave, tgtval, n); } e->offset += n; return 0; } int encode_byte(LTCEncoder *e, int byte, double speed) { if (byte < 0 || byte > 9) return -1; if (speed ==0) return -1; int err = 0; const unsigned char c = ((unsigned char*)&e->f)[byte]; unsigned char b = (speed < 0)?128:1; // bit const double spc = e->samples_per_clock * fabs(speed); const double sph = e->samples_per_clock_2 * fabs(speed); do { int n; if ((c & b) == 0) { n = (int)(spc + e->sample_remainder); e->sample_remainder = spc + e->sample_remainder - n; e->state = !e->state; err |= addvalues(e, n); } else { n = (int)(sph + e->sample_remainder); e->sample_remainder = sph + e->sample_remainder - n; e->state = !e->state; err |= addvalues(e, n); n = (int)(sph + e->sample_remainder); e->sample_remainder = sph + e->sample_remainder - n; e->state = !e->state; err |= addvalues(e, n); } /* this is based on the assumption that with every compiler * ((unsigned char) 128)<<1 == ((unsigned char 1)>>1) == 0 */ if (speed < 0) b >>= 1; else b <<= 1; } while (b); return err; }
#ifndef AUTHAUTHORIZATION_H #define AUTHAUTHORIZATION_H // Generated by APIGenerator 1.0 // DO NOT EDIT!!! #include "../../types/basic.h" #include "../../types/telegramobject.h" #include "user.h" class AuthAuthorization: public TelegramObject { Q_OBJECT Q_PROPERTY(TLInt flags READ flags WRITE setFlags NOTIFY flagsChanged) Q_PROPERTY(TLInt tmpSessions READ tmpSessions WRITE setTmpSessions NOTIFY tmpSessionsChanged) Q_PROPERTY(User* user READ user WRITE setUser NOTIFY userChanged) Q_ENUMS(Constructors) public: enum Constructors { CtorAuthAuthorization = 0xcd050916, }; public: explicit AuthAuthorization(QObject* parent = 0); virtual void read(MTProtoStream* mtstream); virtual void write(MTProtoStream* mtstream); protected: virtual void compileFlags(); public: TLInt flags() const; void setFlags(TLInt flags); TLInt tmpSessions() const; void setTmpSessions(TLInt tmp_sessions); User* user() const; void setUser(User* user); signals: void flagsChanged(); void tmpSessionsChanged(); void userChanged(); private: TLInt _flags; TLInt _tmp_sessions; User* _user; }; #endif // AUTHAUTHORIZATION_H
/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * * RetroArch 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch 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 RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef __RARCH_CHEATS_H #define __RARCH_CHEATS_H typedef struct cheat_manager cheat_manager_t; cheat_manager_t* cheat_manager_new(const char *path); void cheat_manager_free(cheat_manager_t *handle); void cheat_manager_index_next(cheat_manager_t *handle); void cheat_manager_index_prev(cheat_manager_t *handle); void cheat_manager_toggle(cheat_manager_t *handle); #endif
// This file is part of MatrixPilot. // // http://code.google.com/p/gentlenav/ // // Copyright 2009-2011 MatrixPilot Team // See the AUTHORS.TXT file for a list of authors of MatrixPilot. // // MatrixPilot 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. // // MatrixPilot 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 MatrixPilot. If not, see <http://www.gnu.org/licenses/>. #include "USB/usb.h" #include "USB/usb_function_msd.h" #include "MDD_AT45D.h" //The LUN variable definition is critical to the MSD function driver. This // array is a structure of function pointers that are the functions that // will take care of each of the physical media. For each additional LUN // that is added to the system, an entry into this array needs to be added // so that the stack can know where to find the physical layer functions. // In this example the media initialization function is named // "MediaInitialize", the read capacity function is named "ReadCapacity", // etc. LUN_FUNCTIONS LUN[MAX_LUN + 1] = { { &MDD_AT45D_MediaInitialize, &MDD_AT45D_ReadCapacity, &MDD_AT45D_ReadSectorSize, &MDD_AT45D_MediaDetect, &MDD_AT45D_SectorRead, &MDD_AT45D_WriteProtectState, &MDD_AT45D_SectorWrite } }; // Standard Response to INQUIRY command stored in ROM const ROM InquiryResponse inq_resp = { 0x00, // peripheral device is connected, direct access block device 0x80, // removable 0x04, // version = 00=> does not conform to any standard, 4=> SPC-2 0x02, // response is in format specified by SPC-2 0x20, // n-4 = 36-4=32= 0x20 0x00, // sccs etc. 0x00, // bque=1 and cmdque=0,indicates simple queueing 00 is obsolete, // but as in case of other device, we are just using 00 0x00, // 00 obsolete, 0x80 for basic task queueing {'M','i','c','r','o','c','h','p' }, // this is the T10 assigned Vendor ID {'M','a','s','s',' ','S','t','o','r','a','g','e',' ',' ',' ',' ' }, {'0','0','0','1' } };
../../../linux-headers-3.0.0-12/include/linux/thread_info.h
#include <QtCore> #include <QtGui> #include <QtNetwork> #include <algorithm> #include <exception> #include <functional> #include <numeric> #ifdef INTERFACE_WIDGET #include <QtWidgets> #endif #ifdef INTERFACE_QUICK2 #include <QtQml> #include <QtQuick> #endif
/**************************************************************************** * Tano - An Open IP TV Player * Copyright (C) 2013 Tadej Novak <tadej@tano.si> * Based on ListModel by Christophe Dumez <dchris@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 TANO_LISTITEM_H_ #define TANO_LISTITEM_H_ #include <QtCore/QHash> #include <QtCore/QObject> #include <QtCore/QVariant> #include <QtGui/QPixmap> /*! \class ListItem ListItem.h core/ListItem.h \brief List item An abstract representation of a list item with basic properties */ class ListItem : public QObject { Q_OBJECT public: /*! \brief Empty constructor \param parent parent object (QObject *) */ ListItem(QObject *parent = 0) : QObject(parent) { } virtual ~ListItem() { } /*! \brief Item id \return unique item id (QString) */ virtual QString id() const = 0; /*! \brief Get item data \param role selected data role name (int) \return data for specific role (QVariant) */ virtual QVariant data(int role) const = 0; /*! \brief Convenience function for Qt::DisplayRole \return item display text (QString) */ virtual QString display() const = 0; /*! \brief Convenience function for Qt::DecorationRole \return item decoration/icon (QPixmap) */ virtual QPixmap decoration() const = 0; /*! \brief Supported item's role names \return item's supported role names (QHash<int, QByteArray>) */ virtual QHash<int, QByteArray> roleNames() const = 0; signals: /*! \brief Signal sent on data change */ void dataChanged(); }; #endif // TANO_LISTITEM_H_
/* * Copyright (C) 2015 Stuart Howarth <showarth@marxoft.co.uk> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MediakeyCaptureItem_H #define MediakeyCaptureItem_H #include <QObject> #include <qdeclarative.h> #include <remconcoreapitargetobserver.h> // link against RemConCoreApi.lib #include <remconcoreapitarget.h> // and #include <remconinterfaceselector.h> // RemConInterfaceBase.lib class QTimer; class MediakeyCaptureItemPrivate; class MediakeyCaptureItem : public QObject { Q_OBJECT Q_PROPERTY(qreal volume READ volume NOTIFY volumeChanged) public: MediakeyCaptureItem(QObject *parent = 0); qreal volume() const; void setVolume(qreal volume); private: void increaseVolume(); void decreaseVolume(); private slots: void onTimerTriggered(); signals: void volumeChanged(); private: MediakeyCaptureItemPrivate *d_ptr; private: // Friend class definitions friend class MediakeyCaptureItemPrivate; }; QML_DECLARE_TYPE(MediakeyCaptureItem) #endif // MediakeyCaptureItem_H
#ifndef LunaRenderer_Vulkan_h__ #define LunaRenderer_Vulkan_h__ #ifdef WIN32 #include "../LunaRenderer.h" #include <vulkan/vulkan.h> namespace Luna { class LunaRenderer_Vulkan : public LunaRenderer { }; } // LunaRenderer #endif // WIN32 #endif // LunaRenderer_Vulkan_h__
/* Copyright (C) 2010-2011, Bruce Ediger This file is part of acl. acl 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. acl 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 acl; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: cb.h,v 1.3 2011/06/12 18:19:11 bediger Exp $ */ struct queue *queueinit(void); void queuedestroy(struct queue *); void enqueue(struct queue *, int); int dequeue(struct queue *); int queueempty(struct queue *); void empty_error(struct queue *);
#ifndef MANTIDQTMANTIDWIDGETS_DATAPROCESSOROPTIONSTABLECOMMAND_H #define MANTIDQTMANTIDWIDGETS_DATAPROCESSOROPTIONSTABLECOMMAND_H #include "MantidQtWidgets/Common/DataProcessorUI/CommandBase.h" namespace MantidQt { namespace MantidWidgets { namespace DataProcessor { /** @class OptionsCommand OptionsCommand defines the action "Import .TBL" Copyright &copy; 2011-16 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid 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. Mantid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ class OptionsCommand : public CommandBase { public: OptionsCommand(DataProcessorPresenter *tablePresenter) : CommandBase(tablePresenter){}; OptionsCommand(const QDataProcessorWidget &widget) : CommandBase(widget){}; virtual ~OptionsCommand(){}; void execute() override { m_presenter->notify(DataProcessorPresenter::OptionsDialogFlag); }; QString name() override { return QString("Options"); } QString icon() override { return QString("://configure.png"); } QString tooltip() override { return QString("Options"); } QString whatsthis() override { return QString("Opens a dialog with some options for the table"); } QString shortcut() override { return QString(); } }; } } } #endif /*MANTIDQTMANTIDWIDGETS_DATAPROCESSOROPTIONSTABLECOMMAND_H*/
#define F_CPU 8000000UL #include <avr/io.h> #include <avr/interrupt.h> #include <inttypes.h> #include <util/delay.h> #include <stdlib.h> // 1WIRE CONFIG #define DQ 2 // pin DQ termometru DS1822-PAR #define THERM_DDRx DDRD #define THERM_PINx PIND #define STRONG_PULL_UP_DDR DDRC #define STRONG_PULL_UP_PORT PORTC #define STRONG_PULL_UP_PIN 1 #define SET_DQ THERM_DDRx &= ~(1 << DQ) // linia DQ w stan wysoki #define CLR_DQ THERM_DDRx |= (1 << DQ) // linia DQ w stan niski #define IN_DQ THERM_PINx & (1 << DQ) // sprawdzenie stanu linii DQ (odczyt) #define STRONG_PULL_UP_ON STRONG_PULL_UP_PORT |= (1 << STRONG_PULL_UP_PIN) #define STRONG_PULL_UP_OFF STRONG_PULL_UP_PORT &= ~(1 << STRONG_PULL_UP_PIN) double temperature=0.0; void OneWireReset(void) { CLR_DQ; // stan niski na linii 1wire _delay_us(480); // opoznienie ok 480us SET_DQ;// stan wysoki na linii 1wire _delay_us(480); // opoznienie ok 480 us } void OneWireWriteBit(uint8_t bit) { CLR_DQ; // stan niski na linii 1wire _delay_us(10); // opoznienie 10us if(bit) { SET_DQ; // jezeli parametr jest niezerowy to ustaw stan wysoki na linii } _delay_us(100); // opoznienie 100us SET_DQ; // stan wysoki na linii 1wire } uint8_t OneWireReadBit(void) { CLR_DQ; // stan niski na linii 1Wire _delay_us(3); // opoznienie 3us SET_DQ; // stan wysoki na linii 1Wire _delay_us(15); // opoznienie 15us if(IN_DQ) { return 1; } else { return 0; // testowanie linii, funkcja zwraca stan } } uint8_t OneWireReadByte(void) { uint8_t i; // iterator petli uint8_t value = 0; // odczytany bajt for (i=0;i<8;i++) { // odczyt 8 bitów z magistrali DQ if(OneWireReadBit()) { value|=0x01<<i; } _delay_us(9); // opoznienie 9us } return(value); } void OneWireWriteByte(uint8_t val) { uint8_t i; // iterator petli uint8_t temp; for (i=0; i<8; i++) { // wyslanie 8 bitów na magistrale 1-Wire temp = val >> i; temp &= 0x01; OneWireWriteBit(temp); } _delay_us(9); } void ReadTemperature() { uint8_t i; uint8_t scratchpad[9]; /* stratchpad[]: 0 - lsb 1 - msb 2 - T_{h} register 3 - T_{l} register 4 - configuartion register 5 - reserved 6 - reserved 7 - reserved 8 - crc */ STRONG_PULL_UP_OFF; OneWireReset(); // reset 1-Wire OneWireWriteByte(0xCC); // komenda skip ROM OneWireWriteByte(0x44); // komenda convertT STRONG_PULL_UP_ON; _delay_ms(750); // delay 750ms STRONG_PULL_UP_OFF; OneWireReset(); // reset 1Wire OneWireWriteByte(0xCC); // komenda skip ROM OneWireWriteByte(0xBE); // komenda read Scratchpad for(i=0; i<9; i++) { scratchpad[i] = OneWireReadByte(); } uint16_t buffer = scratchpad[0]; buffer |= (scratchpad[1] << 8); temperature = (double)(buffer / 16.0); } volatile uint8_t command; int main(void) { uint8_t maxFanSpeed = 255; uint8_t minFanSpeed = 80; uint8_t fanSpeed = minFanSpeed; double minTemperature = 23.5; double maxTemperature = 24.6875; // Fast PWM mode TCCR0 |= (1 << WGM01) | (1 << WGM00); // OC0 enabled, clear on match TCCR0 |= (1 << COM01) | (1 << COM00); // timer0 clock source prescaler TCCR0 |= (1 << CS00); // pin OC0 as output DDRB |= (1 << PB0); STRONG_PULL_UP_DDR |= (1 << STRONG_PULL_UP_PIN); // initialize interrupts sei(); while(1) { PORTC &= ~(1 << 1); ReadTemperature(); if (temperature < minTemperature && fanSpeed > minFanSpeed) { fanSpeed -= 1; } else if (temperature > maxTemperature && fanSpeed < maxFanSpeed - 20) { fanSpeed += 1; } OCR0 = 255 - fanSpeed; _delay_ms(500); } return 0; }
/* * 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/>. */ // // CMS things for blackbox and flashfs. // #include <stdbool.h> #include <stdint.h> #include <string.h> #include <ctype.h> #include "platform.h" #include "build/version.h" #ifdef CMS #include "drivers/system.h" #include "cms/cms.h" #include "cms/cms_types.h" #include "cms/cms_menu_blackbox.h" #include "config/config_profile.h" #include "config/config_master.h" #include "config/feature.h" #include "io/flashfs.h" #ifdef USE_FLASHFS static long cmsx_EraseFlash(displayPort_t *pDisplay, const void *ptr) { UNUSED(ptr); displayClearScreen(pDisplay); displayWrite(pDisplay, 5, 3, "ERASING FLASH..."); displayResync(pDisplay); // Was max7456RefreshAll(); Why at this timing? flashfsEraseCompletely(); while (!flashfsIsReady()) { delay(100); } displayClearScreen(pDisplay); displayResync(pDisplay); // Was max7456RefreshAll(); wedges during heavy SPI? return 0; } #endif // USE_FLASHFS static bool featureRead = false; static uint8_t cmsx_FeatureBlackbox; static long cmsx_Blackbox_FeatureRead(void) { if (!featureRead) { cmsx_FeatureBlackbox = feature(FEATURE_BLACKBOX) ? 1 : 0; featureRead = true; } return 0; } static long cmsx_Blackbox_FeatureWriteback(void) { if (cmsx_FeatureBlackbox) featureSet(FEATURE_BLACKBOX); else featureClear(FEATURE_BLACKBOX); return 0; } static OSD_Entry cmsx_menuBlackboxEntries[] = { { "-- BLACKBOX --", OME_Label, NULL, NULL, 0}, { "ENABLED", OME_Bool, NULL, &cmsx_FeatureBlackbox, 0 }, { "RATE DENOM", OME_UINT8, NULL, &(OSD_UINT8_t){ &blackboxConfig()->rate_denom,1,32,1 }, 0 }, #ifdef USE_FLASHFS { "ERASE FLASH", OME_Funcall, cmsx_EraseFlash, NULL, 0 }, #endif // USE_FLASHFS { "BACK", OME_Back, NULL, NULL, 0 }, { NULL, OME_END, NULL, NULL, 0 } }; CMS_Menu cmsx_menuBlackbox = { .GUARD_text = "MENUBB", .GUARD_type = OME_MENU, .onEnter = cmsx_Blackbox_FeatureRead, .onExit = NULL, .onGlobalExit = cmsx_Blackbox_FeatureWriteback, .entries = cmsx_menuBlackboxEntries }; #endif
// tex.h -- texture base class // // Copyright (C) 2008, 2010, 2011, 2013 Miles Bader <miles@gnu.org> // // This source code is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 3, or (at // your option) any later version. See the file COPYING for more details. // // Written by Miles Bader <miles@gnu.org> // #ifndef SNOGRAY_TEX_H #define SNOGRAY_TEX_H #include "util/ref.h" #include "tex-coords.h" namespace snogray { typedef float tparam_t; // A texture. // template<typename T> class Tex : public RefCounted { public: // Evaluate this texture at TEX_COORDS. // virtual T eval (const TexCoords &tex_coords) const = 0; }; // A textured value. It is either a constant value or refers to a // texture which can be used to generate a value. // template<typename T> class TexVal { public: TexVal (const T &val) : default_val (val) { } template<typename T2> TexVal (const Ref<Tex<T2> > &_tex) : tex (_tex), default_val (0) { } template<typename T2> TexVal (const Ref<const Tex<T2> > &_tex) : tex (_tex), default_val (0) { } TexVal &operator= (const T &val) { tex = 0; default_val = val; return *this; } template<typename T2> TexVal &operator= (const Ref<Tex<T2> > &_tex) { tex = _tex; return *this; } // Evaluate this texture at TEX_COORDS. // T eval (const TexCoords &tex_coords) const { return tex ? tex->eval (tex_coords) : default_val; } Ref<const Tex<T> > tex; T default_val; }; } #endif // SNOGRAY_TEX_H
// // UMLayerSCCPApplicationContextProtocol.h // ulibsccp // // Created by Andreas Fink on 24.01.17. // Copyright © 2017 Andreas Fink (andreas@fink.org). All rights reserved. // #import <Foundation/Foundation.h> #import "UMSCCP_FilterProtocol.h" @class UMLayerMTP3; @protocol UMLayerSCCPApplicationContextProtocol<NSObject,UMSCCP_FilterDelegateProtocol> - (UMLayerMTP3 *)getMTP3:(NSString *)name; - (UMLayerSCCP *)getSCCP:(NSString *)name; - (UMSynchronizedDictionary *)dbPools; - (NSString *)filterEnginesPath; - (id)licenseDirectory; - (UMPrometheus *)prometheus; @end
// ****************************************************************************** // Filename: Texture.h // Project: Vogue // Author: Steven Ball // // Purpose: // An OpenGL texture object. // // Revision History: // Initial Revision - 08/06/06 // // Copyright (c) 2005-2016, Steven Ball // ****************************************************************************** #pragma once #ifdef _WIN32 #include <windows.h> #endif //_WIN32 #include <GL/gl.h> #include <GL/glu.h> #pragma comment (lib, "opengl32") #pragma comment (lib, "glu32") #include <string> using namespace std; int LoadFileTGA(const char *filename, unsigned char **pixels, int *width, int *height, bool flipvert); int LoadFileBMP(const char *filename, unsigned char **pixels, int *width, int *height); //int LoadFileJPG(const char *filename, unsigned char **pixels, int *width, int *height); enum TextureFileType { TextureFileType_BMP = 0, TextureFileType_JPG, TextureFileType_TGA, }; class Texture { public: Texture(); ~Texture(); string GetFileName() const { return m_fileName; } int GetWidth(); int GetHeight(); int GetWidthPower2(); int GetHeightPower2(); GLuint GetId() const; TextureFileType GetFileType() const; bool Load(string fileName, int *width, int *height, int *width_power2, int *height_power2, bool refresh); void GenerateEmptyTexture(); void Bind(); private: string m_fileName; int m_width; int m_height; int m_width_power2; int m_height_power2; GLuint m_id; TextureFileType m_filetype; };
/*************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Qt Software Information (qt-info@nokia.com) ** ** ** Non-Open Source Usage ** ** Licensees may use this file in accordance with the Qt Beta Version ** License Agreement, Agreement version 2.2 provided with the Software or, ** alternatively, in accordance with the terms contained in a written ** agreement between you and Nokia. ** ** GNU General Public License Usage ** ** Alternatively, this file may be used under the terms of the GNU General ** Public License versions 2.0 or 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 GNU ** General Public Licensing requirements will be met: ** ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and ** http://www.gnu.org/copyleft/gpl.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt GPL Exception ** version 1.3, included in the file GPL_EXCEPTION.txt in this package. ** ***************************************************************************/ #ifndef MODULESPAGE_H #define MODULESPAGE_H #include <QtCore/QMap> #include <QtGui/QWizard> QT_BEGIN_NAMESPACE class QCheckBox; QT_END_NAMESPACE namespace Qt4ProjectManager { namespace Internal { class ModulesPage : public QWizardPage { Q_OBJECT public: explicit ModulesPage(QWidget* parent = 0); QString selectedModules() const; QString deselectedModules() const; void setModuleSelected(const QString &module, bool selected = true) const; void setModuleEnabled(const QString &module, bool enabled = true) const; // Return the key that goes into the Qt config line for a module static QString idOfModule(const QString &module); private: QMap<QString, QCheckBox*> m_moduleCheckBoxMap; QString modules(bool selected = true) const; }; } // namespace Internal } // namespace Qt4ProjectManager #endif // MODULESPAGE_H
#pragma once #include "sqltablemodel.h" #include <QTimer> #include <QWidget> namespace Ui { class WidgetFinanceiroCompra; } class WidgetFinanceiroCompra final : public QWidget { Q_OBJECT public: explicit WidgetFinanceiroCompra(QWidget *parent); ~WidgetFinanceiroCompra(); auto resetTables() -> void; auto updateTables() -> void; private: // attributes bool isSet = false; SqlTableModel model; Ui::WidgetFinanceiroCompra *ui; // methods auto montaFiltro() -> void; auto on_lineEditBusca_textChanged() -> void; auto on_table_activated(const QModelIndex &index) -> void; auto setConnections() -> void; auto setupTables() -> void; };
/* * This file is part of JustDoIt. * * Copyright 2011 Harald Held <harald.held@gmail.com> * * JustDoIt 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. * * JustDoIt 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 JustDoIt. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QtGui/QMainWindow> #include <QModelIndex> #include <QSystemTrayIcon> class QTimer; class QStringListModel; class UserData; class TaskTableModel; class TaskTableStringListComboboxDelegate; class TaskTableColorDoneDelegate; class TaskSortFilterProxyModel; class TaskTableDateTimeDelegate; class TaskTableLineEditDelegate; class TaskTableTextEditDelegate; class TaskTableRecurrenceDelegate; class Reminder; class PrintView; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); void setUsrData(UserData *uData); void setSaveFileName(const QString &xmlOutFileName); bool event(QEvent *event); protected: void changeEvent(QEvent *e); void closeEvent(QCloseEvent *event); void hideEvent(QHideEvent *event); void showEvent(QShowEvent *); private: Ui::MainWindow *ui; UserData *uData; QStringListModel *model_categories; QStringListModel *model_locations; TaskTableModel *model_tasks; TaskTableStringListComboboxDelegate *groupDelegate; TaskTableStringListComboboxDelegate *locationDelegate; TaskTableColorDoneDelegate *doneColorDelegate; TaskSortFilterProxyModel *sortFilterTasksProxy; TaskTableDateTimeDelegate *dueDate_delegate; TaskTableLineEditDelegate *titleDelegate; TaskTableTextEditDelegate *descriptionDelegate; TaskTableRecurrenceDelegate *recurrenceDelegate; QSystemTrayIcon *sti; QMenu *trayIconMenu; QAction *actStartVisibility; QAction *actHideToSysTray; QAction *actEnableReminders; QAction *actShowHide; QString saveFileName; QTimer *timer_autoSave; QTimer *timer_updateDefaultDueDateTime; Reminder *reminderWidget; QTimer *timer_reminder; PrintView *printView; QRect lastGeometry; void permuteColumns(); int numOfUnfinishedTasks() const; void initSystray(); void readSettings(); void writeSettings(); void purgeAllDoneTasks(); void center(); void handleRecurringTasks(const int &position); bool saveNeeded; bool startVisible; bool remindersEnabled; public slots: void saveXML(const QString &fileName = QString()); void updateStatusMesg(); void toggleVisibility(); void updateDefaultDueDateTime(); void deselectAllRows(); void enableReminders(bool); void disableReminders(bool); private slots: void saveData(); void groupData_changed(); void locationData_changed(); void taskData_changed(QModelIndex index); void on_button_addCategory_clicked(); void on_button_insertCategory_clicked(); void on_button_deleteCategory_clicked(); void on_button_addLocation_clicked(); void on_button_insertLocation_clicked(); void on_button_deleteLocation_clicked(); void on_button_addTask_clicked(); void on_button_deleteTask_clicked(); void on_tabWidget_currentChanged(int index); void on_button_add_clicked(); void on_button_clear_clicked(); void trayIcon_showHide_clicked(); void trayIcon_addTask_clicked(); void trayIcon_manageTasks_clicked(); void setStartVisible(bool visibleOnStart); void sysTrayIconClicked(QSystemTrayIcon::ActivationReason reason); void on_actionQuit_triggered(); void on_actionPurge_triggered(); void taskRowClicked(QModelIndex); void showReminder(); void showAboutMsg(); void on_pushButton_addAsThoughtOnly_clicked(); void on_actionPrint_triggered(); }; #endif // MAINWINDOW_H
#ifndef DISPLAYGLWIDGET_H #define DISPLAYGLWIDGET_H #include <QGLWidget> #include <QtOpenGL> #include <GL/glu.h> class DisplayGLWidget : public QGLWidget { Q_OBJECT public: explicit DisplayGLWidget(QWidget *parent = 0); void setPitchAngle(float angle); void setRollAngle(float angle); void setYawAngle(float angle); private: float pitchAngle; float rollAngle; float yawAngle; QColor qtRed; QColor qtGray; signals: public slots: protected: void initializeGL(); void paintGL(); void resizeGL(int width, int height); }; #endif // DISPLAYGLWIDGET_H
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * Copyright (C) 2010 Debarshi Ray <rishi@gnu.org> * Copyright (C) 2009 Santanu Sinha <santanu.sinha@gmail.com> * * Solang 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. * * Solang 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 SOLANG_NON_COPYABLE_H #define SOLANG_NON_COPYABLE_H namespace Solang { class NonCopyable { protected: NonCopyable(); ~NonCopyable(); private: // Blocked. NonCopyable(const NonCopyable & source); // Blocked. NonCopyable & operator=(const NonCopyable & source); }; } // namespace Solang #endif // SOLANG_NON_COPYABLE_H
/* $XFree86: xc/programs/Xserver/afb/afbhrzvert.c,v 3.1 2001/08/01 00:44:47 tsi Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium 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 X CONSORTIUM 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. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: afbhrzvert.c,v 1.15 94/04/17 20:28:24 dpw Exp $ */ #include "X.h" #include "gc.h" #include "window.h" #include "pixmap.h" #include "region.h" #include "afb.h" #include "maskbits.h" /* horizontal solid line abs(len) > 1 */ void afbHorzS(pbase, nlwidth, sizeDst, depthDst, x1, y1, len, rrops) PixelType *pbase; /* pointer to base of bitmap */ register int nlwidth; /* width in longwords of bitmap */ int sizeDst; int depthDst; int x1; /* initial point */ int y1; int len; /* length of line */ register unsigned char *rrops; { register PixelType *addrl; register PixelType startmask; register PixelType endmask; register int nlmiddle; register int d; int saveNLmiddle; /* force the line to go left to right but don't draw the last point */ if (len < 0) { x1 += len; x1 += 1; len = -len; } /* all bits inside same longword */ if ( ((x1 & PIM) + len) < PPW) { maskpartialbits(x1, len, startmask); for (d = 0; d < depthDst; d++) { addrl = afbScanline(pbase, x1, y1, nlwidth); pbase += sizeDst; /* @@@ NEXT PLANE @@@ */ switch (rrops[d]) { case RROP_BLACK: *addrl &= ~startmask; break; case RROP_WHITE: *addrl |= startmask; break; case RROP_INVERT: *addrl ^= startmask; break; case RROP_NOP: break; } /* switch */ } /* for (d = ...) */ } else { maskbits(x1, len, startmask, endmask, nlmiddle); saveNLmiddle = nlmiddle; for (d = 0; d < depthDst; d++) { addrl = afbScanline(pbase, x1, y1, nlwidth); pbase += sizeDst; /* @@@ NEXT PLANE @@@ */ nlmiddle = saveNLmiddle; switch (rrops[d]) { case RROP_BLACK: if (startmask) *addrl++ &= ~startmask; Duff (nlmiddle, *addrl++ = 0x0); if (endmask) *addrl &= ~endmask; break; case RROP_WHITE: if (startmask) *addrl++ |= startmask; Duff (nlmiddle, *addrl++ = ~0); if (endmask) *addrl |= endmask; break; case RROP_INVERT: if (startmask) *addrl++ ^= startmask; Duff (nlmiddle, *addrl++ ^= ~0); if (endmask) *addrl ^= endmask; break; case RROP_NOP: break; } /* switch */ } /* for (d = ... ) */ } } /* vertical solid line this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates better code. sigh. we know that len will never be 0 or 1, so it's OK to use it. */ void afbVertS(pbase, nlwidth, sizeDst, depthDst, x1, y1, len, rrops) PixelType *pbase; /* pointer to base of bitmap */ register int nlwidth; /* width in longwords of bitmap */ int sizeDst; int depthDst; int x1, y1; /* initial point */ register int len; /* length of line */ unsigned char *rrops; { register PixelType *addrl; register PixelType bitmask; int saveLen; int d; if (len < 0) { nlwidth = -nlwidth; len = -len; } saveLen = len; for (d = 0; d < depthDst; d++) { addrl = afbScanline(pbase, x1, y1, nlwidth); pbase += sizeDst; /* @@@ NEXT PLANE @@@ */ len = saveLen; switch (rrops[d]) { case RROP_BLACK: bitmask = rmask[x1 & PIM]; Duff(len, *addrl &= bitmask; afbScanlineInc(addrl, nlwidth) ); break; case RROP_WHITE: bitmask = mask[x1 & PIM]; Duff(len, *addrl |= bitmask; afbScanlineInc(addrl, nlwidth) ); break; case RROP_INVERT: bitmask = mask[x1 & PIM]; Duff(len, *addrl ^= bitmask; afbScanlineInc(addrl, nlwidth) ); break; case RROP_NOP: break; } /* switch */ } /* for (d = ...) */ }
/* SPDX-FileCopyrightText: 2008-2021 Graeme Gott <graeme@gottcode.org> SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef KAPOW_SESSION_MODEL_H #define KAPOW_SESSION_MODEL_H #include "session.h" #include <QAbstractItemModel> #include <QXmlStreamWriter> class SessionModel : public QAbstractItemModel { Q_OBJECT public: explicit SessionModel(QObject* parent = nullptr); QList<int> billedRows() const { return m_billed; } bool canBill() const { return !m_data.isEmpty() && !isBilled(m_data.size() - 1); } bool isBilled(int pos) const { return (!m_billed.isEmpty() && pos <= m_billed.last()); } void fixConflict(const QDateTime& current_start, QDateTime& current_stop) const; bool hasConflict(const QDateTime& current) const; Session session(int pos) const { return m_data.value(pos); } void beginLoad(); void endLoad(); bool add(const QDateTime& start, const QDateTime& stop, const QString& task); bool add(const Session& session); bool edit(int row, const Session& session); bool remove(int row); void setBilled(int row, bool billed); void setDecimalTotals(bool decimals); void setMaximumDateTime(const QDateTime& max); void toXml(QXmlStreamWriter& xml) const; int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex& child) const override; bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; signals: void billedStatusChanged(bool billed); private: void updateTotals(); private: QList<Session> m_data; QList<int> m_billed; QDateTime m_max_datetime; bool m_decimals; bool m_loaded; }; #endif // KAPOW_SESSION_MODEL_H
/* * Generated by class-dump 3.1.2. * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. */ #import "_ABCreateStringWithAddressDictionary.h" #import "NSURLConnectionDataDelegate-Protocol.h" #import "SDWebImageOperation-Protocol.h" @class NSMutableData, NSThread, NSURLConnection, NSURLCredential, NSURLRequest, NSURLResponse; @interface SDWebImageDownloaderOperation : _ABCreateStringWithAddressDictionary <NSURLConnectionDataDelegate, SDWebImageOperation> { unsigned long width; unsigned long height; int orientation; BOOL responseFromCached; BOOL _executing; BOOL _finished; BOOL _shouldDecompressImages; BOOL _shouldUseCredentialStorage; NSURLRequest *_request; NSURLCredential *_credential; unsigned int _options; int _expectedSize; NSURLResponse *_response; id _progressBlock; id _completedBlock; id _cancelBlock; NSMutableData *_imageData; NSURLConnection *_connection; NSThread *_thread; unsigned int _backgroundTaskId; } + (int)orientationFromPropertyValue:(int)fp8; - (void)setBackgroundTaskId:(unsigned int)fp8; - (unsigned int)backgroundTaskId; - (void)setThread:(id)fp8; - (id)thread; - (void)setConnection:(id)fp8; - (id)connection; - (void)setImageData:(id)fp8; - (id)imageData; - (void)setCancelBlock:(id)fp(null); - (id)cancelBlock; - (void)setCompletedBlock:(id)fp(null); - (id)completedBlock; - (void)setProgressBlock:(id)fp(null); - (id)progressBlock; - (void)setResponse:(id)fp8; - (id)response; - (void)setExpectedSize:(int)fp8; - (int)expectedSize; - (unsigned int)options; - (void)setCredential:(id)fp8; - (id)credential; - (void)setShouldUseCredentialStorage:(BOOL)fp8; - (BOOL)shouldUseCredentialStorage; - (void)setShouldDecompressImages:(BOOL)fp8; - (BOOL)shouldDecompressImages; - (id)request; - (BOOL)isFinished; - (BOOL)isExecuting; - (void).cxx_destruct; - (void)connection:(id)fp8 willSendRequestForAuthenticationChallenge:(id)fp12; - (BOOL)connectionShouldUseCredentialStorage:(id)fp8; - (BOOL)shouldContinueWhenAppEntersBackground; - (id)connection:(id)fp8 willCacheResponse:(id)fp12; - (void)connection:(id)fp8 didFailWithError:(id)fp12; - (void)connectionDidFinishLoading:(id)fp8; - (id)scaledImageForKey:(id)fp8 image:(id)fp12; - (void)connection:(id)fp8 didReceiveData:(id)fp12; - (void)connection:(id)fp8 didReceiveResponse:(id)fp12; - (BOOL)isConcurrent; - (void)setExecuting:(BOOL)fp8; - (void)setFinished:(BOOL)fp8; - (void)reset; - (void)done; - (void)cancelInternal; - (void)cancelInternalAndStop; - (void)cancel; - (void)start; - (id)initWithRequest:(id)fp8 options:(unsigned int)fp12 progress:(id)fp(null) completed:(void)fp16 cancelled:(id)fp(null); @end
/*************************************************************************** * Copyright (C) 2011 by Etrnls * * Etrnls@gmail.com * * * * This file is part of Evangel. * * * * Evangel 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. * * * * Evangel 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 Evangel. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ #ifndef ABSTRACTTASK_H #define ABSTRACTTASK_H #include <QObject> #include <QElapsedTimer> /*! * \brief The abstract task interface * * \author Etrnls <Etrnls@gmail.com> */ class AbstractTask : public QObject { Q_OBJECT Q_CLASSINFO("log", "AbstractTask") public: //! \brief Represents the state of the task enum State { RunningState, //!< Downloading & (maybe) uploading SharingState, //!< Uploading only PausedState, //!< Paused (a state which can switch to Running or Sharing fast) StoppedState, //!< Stopped (not completed yet) CompletedState, //!< Completed and stopped }; Q_ENUMS(State) AbstractTask() : downloaded(0), uploaded(0), state(StoppedState) { } virtual ~AbstractTask() { } virtual QString getName() const = 0; virtual qint64 getSize() const = 0; virtual qreal getProgress() const = 0; QString getStateString() const; inline State getState() const { return state; } inline qint64 getDownloaded() const { return downloaded; } inline qint64 getUploaded() const { return uploaded; } inline int getTransferTime() const { return state == RunningState || state == SharingState ? timer.elapsed() : 0; } public slots: virtual void start() = 0; virtual void pause() = 0; virtual void stop() = 0; signals: void stateChanged() const; protected: virtual void stateUpdating(State state) = 0; void setState(State state); qint64 downloaded; //!< Number of bytes downloaded qint64 uploaded; //!< Number of bytes uploaded QElapsedTimer timer; private: State state; }; #endif
/* BoundingVolume.h Author: Chris Serson Last Edited: October 14, 2016 Description: Classes and methods defining bounding volumes. Currently only BoundingSphere. Usage: - Proper shutdown is handled by the destructor. Future Work: - Add collision detection to Bounding Sphere. - Add Axis Aligned Bounding Box. - Add Object Oriented Bounding Box. - Add K-DOP. */ #pragma once #include <DirectXMath.h> using namespace DirectX; class BoundingSphere; // Find a bounding sphere by finding the circumcenter of 3 points and the distance from the points to the circumcenter BoundingSphere FindBoundingSphere(XMFLOAT3 a, XMFLOAT3 b, XMFLOAT3 c); class BoundingSphere { public: BoundingSphere(float r = 0.0f, XMFLOAT3 c = XMFLOAT3(0.0f, 0.0f, 0.0f)) : m_valRadius(r), m_vCenter(c) {} ~BoundingSphere() {} float GetRadius() { return m_valRadius; } void SetRadius(float r) { m_valRadius = r; } XMFLOAT3 GetCenter() { return m_vCenter; } void SetCenter(XMFLOAT3 c) { m_vCenter = c; } void SetCenter(float x, float y, float z) { m_vCenter = XMFLOAT3(x, y, z); } private: float m_valRadius; XMFLOAT3 m_vCenter; };
/* This file is part of the Neper software package. */ /* Copyright (C) 2003-2022, Romain Quey. */ /* See the COPYING file in the top-level directory. */ #ifdef __cplusplus extern "C" { #endif extern void net_mtess_flatten_gen (struct TESS *Tess, int TessId, struct TESS *pFTess, struct FLATTEN *pFlatten); #ifdef __cplusplus } #endif
#include "ship.h" #include <stdio.h> cargo **docks, **shipStr; pthread_mutex_t *countLock, *entryLock, nthLock; pthread_cond_t *dockLock, *loadLock, *unloadLock, shipDestroy; int *waitLoad, *waitUnload, *loading, *unloading; int *dockCap, **route, *tTime, *shipCap, *aTime, *rLen; void* shipMain(void*); int nth=0; struct timeval simStart; int **dockQ, *front, *rear; int Nd, Ns, Nc; int main() { int i,j; pthread_t tid; pthread_attr_t attr; scanf("%d%d%d", &Nd, &Ns, &Nc); dockLock = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)*Nd); loadLock = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)*Nd); unloadLock = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)*Nd); docks = (cargo**)calloc(sizeof(cargo*), Nd); shipStr = (cargo**)calloc(sizeof(cargo*), Ns); countLock = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)*Nd); entryLock = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)*Nd); dockCap = (int*)malloc(sizeof(int)*Nd); loading = (int*)malloc(sizeof(int)*Nd); unloading = (int*)malloc(sizeof(int)*Nd); dockQ = (int**)malloc(sizeof(int*)*Nd); front = (int*)malloc(sizeof(int)*Nd); rear = (int*)malloc(sizeof(int)*Nd); route = (int**)malloc(sizeof(int*)*Ns); tTime = (int*)malloc(sizeof(int)*Ns); shipCap = (int*)malloc(sizeof(int)*Ns); aTime = (int*)malloc(sizeof(int)*Ns); rLen = (int*)malloc(sizeof(int)*Ns); pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_cond_init(&shipDestroy, NULL); pthread_mutex_init(&nthLock, NULL); for(i=0;i<Nd;i++) { scanf("%d", dockCap+i); if(pthread_cond_init(dockLock+i, NULL)==-1||pthread_cond_init(loadLock+i, NULL)==-1||pthread_cond_init(unloadLock+i, NULL)) { puts("error on pthread_cond_init"); return 1; } if(pthread_mutex_init(entryLock+i, NULL)==-1||pthread_mutex_init(countLock+i,NULL)==-1) { puts("error on pthread_mutex_init"); return 1; } dockQ[i] = (int*)malloc(sizeof(int)*Ns); front[i]=rear[i]=0; loading[i]=unloading[i]=0; } for(i=0;i<Ns;i++) { scanf("%d%d%d%d", tTime+i, shipCap+i, aTime+i, rLen+i); route[i] = (int*)malloc(sizeof(int)*rLen[i]); for(j=0;j<rLen[i];j++) scanf("%d", route[i]+j); } for(i=0;i<Nc;i++) { scanf("%d", &j); cargo *new = malloc(sizeof(cargo)); scanf("%d", &new->dest); new->id=i; new->next=docks[j]; new->state=0; if(pthread_mutex_init(&new->mtx, NULL)==-1) { puts("error on cargo mutex_init"); return 1; } docks[j] = new; } InitWriteOutput(); gettimeofday(&simStart, NULL); for(i=0;i<Ns;i++) pthread_create(&tid, &attr, shipMain, (void*)(long)i); pthread_mutex_lock(&nthLock); while(nth>0) pthread_cond_wait(&shipDestroy, &nthLock); pthread_mutex_unlock(&nthLock); pthread_cond_destroy(&shipDestroy); pthread_mutex_destroy(&nthLock); for(i=0;i<Nd;i++) { pthread_cond_destroy(dockLock+i); pthread_cond_destroy(loadLock+i); pthread_cond_destroy(unloadLock+i); pthread_mutex_destroy(entryLock+i); pthread_mutex_destroy(countLock+i); free(dockQ[i]); cargo *it=docks[i]; while(it!=NULL) { docks[i]=it; it=it->next; pthread_mutex_destroy(&docks[i]->mtx); free(docks[i]); } } for(i=0;i<Ns;i++) { free(route[i]); cargo *it=shipStr[i]; while(it!=NULL) { shipStr[i]=it; it=it->next; free(shipStr[i]); } } free(route); free(countLock); free(entryLock); free(dockLock); free(loadLock); free(unloadLock); free(docks); free(shipStr); free(tTime); free(aTime); free(shipCap); free(rLen); free(dockQ); free(dockCap); free(front); free(rear); free(loading); free(unloading); return 0; }
#pragma once /*************************************************************** * This source files comes from the xLights project * https://www.xlights.org * https://github.com/smeighan/xLights * See the github commit history for a record of contributing * developers. * Copyright claimed based on commit dates recorded in Github * License: https://github.com/smeighan/xLights/blob/master/License.txt **************************************************************/ #include "Model.h" class SingleLineModel : public ModelWithScreenLocation<TwoPointScreenLocation> { public: SingleLineModel(wxXmlNode *node, const ModelManager &manager, bool zeroBased = false); SingleLineModel(int lights, const Model &base, int strand, int node = -1); SingleLineModel(const ModelManager &manager); virtual ~SingleLineModel(); void InitLine(); void Reset(int lights, const Model &base, int strand, int node = -1, bool forceDirection = false); virtual const std::vector<std::string> &GetBufferStyles() const override; virtual int GetLightsPerNode() const override { return parm3; } // default to one unless a model supports this virtual void AddTypeProperties(wxPropertyGridInterface* grid) override; virtual int OnPropertyGridChange(wxPropertyGridInterface *grid, wxPropertyGridEvent& event) override; virtual bool SupportsExportAsCustom() const override { return true; } virtual bool SupportsWiringView() const override { return false; } protected: static std::vector<std::string> LINE_BUFFER_STYLES; virtual void InitModel() override; private: };
/* This file is part of ghtml. ghtml 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. ghtml 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 ghtml. If not, see <http://www.gnu.org/licenses/>. */ void ghtml_webview_js_console_arguments (void * environment, void * console, int argc, char * argv[]) { void *jsArgData[argc + 1], *jsTemp; void **jsUsrArgs = (jsArgData + 1); int i = 0; // Set the "application path" argument. jsArgData[0] = (void *) JSValueMakeString( environment, jsTemp = JSStringCreateWithUTF8CString(ghtml_app_file) ); JSStringRelease(jsTemp); // Set remaining arguments for (i = 0; i < argc ; i++) { jsUsrArgs[i] = (void *) JSValueMakeString( environment, jsTemp = JSStringCreateWithUTF8CString(argv[i]) ); JSStringRelease(jsTemp); } void *jsarguments = seed_make_array( environment, jsArgData, argc + 1, NULL ); JSObjectSetProperty( environment, console, jsTemp = JSStringCreateWithUTF8CString("arguments"), jsarguments, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL ); JSStringRelease(jsTemp); }
/* This file is part of Helio Workstation. Helio 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. Helio 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 Helio. If not, see <http://www.gnu.org/licenses/>. */ #pragma once class CommandPaletteAction final : public ReferenceCountedObject { public: using Callback = Function<bool(TextEditor &ed)>; using Ptr = ReferenceCountedObjectPtr<CommandPaletteAction>; static CommandPaletteAction::Ptr action(String text, String hint, float order); CommandPaletteAction::Ptr withCallback(Callback callback); CommandPaletteAction::Ptr withColour(const Colour &colour); CommandPaletteAction::Ptr unfiltered(); const String &getName() const noexcept; const String &getHint() const noexcept; const Colour &getColor() const noexcept; const Callback getCallback() const noexcept; const bool isUnfiltered() const noexcept; void setMatch(int score, const uint8 *matches); int getMatchScore() const noexcept; float getOrder() const noexcept; const GlyphArrangement &getGlyphArrangement() const noexcept; private: CommandPaletteAction() = delete; CommandPaletteAction(String text, String hint, float order); String name; String hint; Colour colour = Colours::grey; Callback callback; int commandId = 0; bool shouldClosePalette = true; bool required = false; GlyphArrangement highlightedMatch; int matchScore = 0; // actions will be sorted by match, as user is entering the search text, // but we may also need ordering for the full list or items with the same match; // the context for this variable should be defined by action provider, // for example, timeline events will be ordered by position at the timeline // (see CommandPaletteActionSortByMatch) float order = 0.f; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CommandPaletteAction) }; class CommandPaletteActionsProvider { public: CommandPaletteActionsProvider() = default; virtual ~CommandPaletteActionsProvider() = default; using Prefix = juce_wchar; virtual bool usesPrefix(const Prefix prefix) const = 0; using Actions = ReferenceCountedArray<CommandPaletteAction>; const Actions &getFilteredActions() const { return this->filteredActions; } virtual void updateFilter(const String &pattern, bool skipPrefix); virtual void clearFilter(); protected: virtual const Actions &getActions() const = 0; private: Actions filteredActions; JUCE_DECLARE_WEAK_REFERENCEABLE(CommandPaletteActionsProvider) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CommandPaletteActionsProvider) };
#import <objc/objc.h> #import "UIKit/UIKit.h" // typedef NS_ENUM(NSInteger, ToastViewType) { ToastViewDefault, ToastViewInfo = ToastViewDefault, ToastViewError, ToastViewCancel = ToastViewError, ToastViewSuccess, ToastViewLoading, }; // @interface ToastView : UIView { } - (id)initWithTitle:(NSString *)title type:(ToastViewType)type; + (ToastView *)toastWithTitle:(NSString *)title type:(ToastViewType)type; + (ToastView *)toastWithTitle:(NSString *)title; + (ToastView *)toastWithInfo:(NSString *)info; + (ToastView *)toastWithError:(NSString *)error; + (ToastView *)toastWithCancel:(NSString *)cancel; + (ToastView *)toastWithSuccess:(NSString *)success; + (ToastView *)toastWithLoading:(NSString *)loading; + (ToastView *)toastWithLoading; + (void)dismissToast; @end // @interface UIView (ToastView) - (ToastView *)toastWithTitle:(NSString *)title type:(ToastViewType)type; - (ToastView *)toastWithTitle:(NSString *)title; - (ToastView *)toastWithInfo:(NSString *)info; - (ToastView *)toastWithError:(NSString *)error; - (ToastView *)toastWithCancel:(NSString *)cancel; - (ToastView *)toastWithSuccess:(NSString *)success; - (ToastView *)toastWithLoading:(NSString *)loading; - (ToastView *)toastWithLoading; - (void)dismissToast; @end
/* -*- c++ -*- */ /* * Copyright 2011-2013,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * * SPDX-License-Identifier: GPL-3.0-or-later * */ #ifndef INCLUDED_QTGUI_TIME_SINK_C_IMPL_H #define INCLUDED_QTGUI_TIME_SINK_C_IMPL_H #include <gnuradio/qtgui/time_sink_c.h> #include <gnuradio/high_res_timer.h> #include <gnuradio/qtgui/timedisplayform.h> namespace gr { namespace qtgui { class QTGUI_API time_sink_c_impl : public time_sink_c { private: void initialize(); int d_size, d_buffer_size; double d_samp_rate; const std::string d_name; unsigned int d_nconnections; const pmt::pmt_t d_tag_key; int d_index, d_start, d_end; std::vector<volk::vector<gr_complex>> d_cbuffers; std::vector<volk::vector<double>> d_buffers; std::vector<std::vector<gr::tag_t>> d_tags; // Required now for Qt; argc must be greater than 0 and argv // must have at least one valid character. Must be valid through // life of the qApplication: // http://harmattan-dev.nokia.com/docs/library/html/qt4/qapplication.html char d_zero; int d_argc = 1; char* d_argv = &d_zero; QWidget* d_parent; TimeDisplayForm* d_main_gui = nullptr; gr::high_res_timer_type d_update_time; gr::high_res_timer_type d_last_time; // Members used for triggering scope trigger_mode d_trigger_mode; trigger_slope d_trigger_slope; float d_trigger_level; int d_trigger_channel; int d_trigger_delay; pmt::pmt_t d_trigger_tag_key; bool d_triggered; int d_trigger_count; void _reset(); void _npoints_resize(); void _adjust_tags(int adj); void _gui_update_trigger(); void _test_trigger_tags(int nitems); void _test_trigger_norm(int nitems, gr_vector_const_void_star inputs); bool _test_trigger_slope(const gr_complex* in) const; // Handles message input port for displaying PDU samples. void handle_pdus(pmt::pmt_t msg); public: time_sink_c_impl(int size, double samp_rate, const std::string& name, unsigned int nconnections, QWidget* parent = NULL); ~time_sink_c_impl() override; bool check_topology(int ninputs, int noutputs) override; void exec_() override; QWidget* qwidget() override; #ifdef ENABLE_PYTHON PyObject* pyqwidget() override; #else void* pyqwidget(); #endif void set_y_axis(double min, double max) override; void set_y_label(const std::string& label, const std::string& unit = "") override; void set_update_time(double t) override; void set_title(const std::string& title) override; void set_line_label(unsigned int which, const std::string& label) override; void set_line_color(unsigned int which, const std::string& color) override; void set_line_width(unsigned int which, int width) override; void set_line_style(unsigned int which, int style) override; void set_line_marker(unsigned int which, int marker) override; void set_nsamps(const int size) override; void set_samp_rate(const double samp_rate) override; void set_line_alpha(unsigned int which, double alpha) override; void set_trigger_mode(trigger_mode mode, trigger_slope slope, float level, float delay, int channel, const std::string& tag_key = "") override; std::string title() override; std::string line_label(unsigned int which) override; std::string line_color(unsigned int which) override; int line_width(unsigned int which) override; int line_style(unsigned int which) override; int line_marker(unsigned int which) override; double line_alpha(unsigned int which) override; void set_size(int width, int height) override; int nsamps() const override; void enable_menu(bool en) override; void enable_grid(bool en) override; void enable_autoscale(bool en) override; void enable_stem_plot(bool en) override; void enable_semilogx(bool en) override; void enable_semilogy(bool en) override; void enable_control_panel(bool en) override; void enable_tags(unsigned int which, bool en) override; void enable_tags(bool en) override; void enable_axis_labels(bool en) override; void disable_legend() override; void reset() override; int work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) override; }; } /* namespace qtgui */ } /* namespace gr */ #endif /* INCLUDED_QTGUI_TIME_SINK_C_IMPL_H */
// // ScrollPlotView.h // iCash // // Created by Vitaly Merenkov on 02.03.13. // #import <Cocoa/Cocoa.h> @class PlotView; @interface ScrollPlotView : NSScrollView @property IBOutlet PlotView *plotView; @end
#include "event_threads.h" #include "psx.h" #include <lv2/process.h> #include <sys/file.h> #include <ppu-lv2.h> #include <sys/stat.h> #include <lv2/sysfs.h> #include <sysutil/disc.h> #include <sys/thread.h> #include <sys/event_queue.h> static sys_ppu_thread_t thread_id; static sys_event_queue_t evQ_sd; static sys_event_port_t portId; static volatile int event_thread_working = 0; static sys_event_queue_attr_t evQAttr_sd = { SYS_EVENT_QUEUE_FIFO, SYS_EVENT_QUEUE_PPU, "EvTh"}; static void Event_thread(void *a) { sys_event_t event_sd; void (*func)(void * priv) = NULL; while(1) { if(sysEventQueueReceive(evQ_sd, &event_sd, 0) < 0) break; if(event_sd.data_1 == 0x666) break; if(event_sd.data_1 == 0x555) { event_thread_working = 1; func = (void *) event_sd.data_2; if(func) func((void *) event_sd.data_3); event_thread_working = 0; } } sysThreadExit(0); } static int init = 0; void event_threads_init() { if(init) return; init = 1; #ifdef PSDEBUG int ret= #endif sysEventQueueCreate(&evQ_sd, &evQAttr_sd, 0xAAAA4242, 16); #ifdef PSDEBUG ret = #endif sysEventPortCreate(&portId, 1, 0xAAAA4242); #ifdef PSDEBUG ret = #endif sysEventPortConnectLocal(portId, evQ_sd); sysThreadCreate(&thread_id, Event_thread, NULL, 992, 0x100000/4, THREAD_JOINABLE, "Event_thread"); } void event_threads_finish() { u64 retval; if(!init) return; event_thread_send(0x666, 0, 0); sysThreadJoin(thread_id, &retval); sysEventPortDestroy(portId); sysEventQueueDestroy(evQ_sd, 0); init = 0; } int event_thread_send(u64 data0, u64 data1, u64 data2) { return sysEventPortSend(portId, data0, data1, data2); } void wait_event_thread() { while(event_thread_working) usleep(1000); }
/* * FinTP - Financial Transactions Processing Application * Copyright (C) 2013 Business Information Systems (Allevo) S.R.L. * * 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/> * or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania, * phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro. */ #ifndef EXTENSIONHASH_H #define EXTENSIONHASH_H #include <xalanc/Include/PlatformDefinitions.hpp> #include <xalanc/XPath/Function.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <xalanc/XalanTransformer/XalanTransformer.hpp> #include <xalanc/XPath/XObjectFactory.hpp> #include "../DllMain.h" XALAN_USING_XALAN(Function) XALAN_USING_XALAN(XPathExecutionContext) XALAN_USING_XALAN(XalanDOMString) XALAN_USING_XALAN(XalanNode) //XALAN_USING_XALAN(StaticStringToDOMString) XALAN_USING_XALAN(XObjectPtr) #ifdef XALAN_1_9 XALAN_USING_XALAN(MemoryManagerType) #endif namespace FinTP { class ExportedObject FunctionHash : public Function { public: virtual XObjectPtr execute( XPathExecutionContext& executionContext, XalanNode* context, const XObjectArgVectorType& args,const LocatorType* locator ) const; #ifdef XALAN_1_9 #if defined( XALAN_NO_COVARIANT_RETURN_TYPE ) virtual Function* clone( MemoryManagerType& theManager ) const; #else virtual FunctionHash* clone( MemoryManagerType& theManager ) const; #endif protected: const XalanDOMString& getError( XalanDOMString& theResult ) const; #else #if defined( XALAN_NO_COVARIANT_RETURN_TYPE ) virtual Function* clone() const; #else virtual FunctionHash* clone() const; #endif protected: const XalanDOMString getError() const; #endif private: // The assignment and equality operators are not implemented... FunctionHash& operator=( const FunctionHash& ); bool operator==( const FunctionHash& ) const; }; } #endif // EXTENSIONHASH_H
#ifndef IF_ELSE_IF_TRUE_H #define IF_ELSE_IF_TRUE_H #include "ibp/foundation/boolean.h" #include "ibp/foundation/integer.h" ibp::Integer foo( ibp::Integer x, ibp::Boolean y ); #endif
#ifndef _C14_re670_ #define _C14_re670_ #ifdef __cplusplus extern "C" { #endif extern EIF_INTEGER_32 F298_1998(EIF_REFERENCE); extern void EIF_Minit670(void); extern char *(*R1751[])(); #ifdef __cplusplus } #endif #endif
#ifndef VARIABLETERM_H #define VARIABLETERM_H #include"basicterm.h" #include"valuebase.h" #include"value.h" #include<string> #include<QString> #include<map> using Xeml::Document::BasicTerm; namespace Xeml { namespace Document{ class VariableTerm : public BasicTerm { private: std::map<ValueBase*,QString> * valuecollection; public: VariableTerm(); VariableTerm(QString _id); ~VariableTerm(); std::map<ValueBase*,QString> * get_valuecollection(); void add_value(ValueBase * _value); }; } } #endif // VARIABLETERM_H
/********************************************************************************/ /* 888888 888888888 88 888 88888 888 888 88888888 */ /* 8 8 8 8 8 8 8 8 8 8 */ /* 8 8 8 8 8 8 8 8 8 */ /* 8 888888888 8 8 8 8 8 8 8888888 */ /* 8 8888 8 8 8 8 8 8 8 8 */ /* 8 8 8 8 8 8 8 8 8 8 */ /* 888888 888888888 888 88 88888 88888888 88888888 */ /* */ /* A Three-Dimensional General Purpose Semiconductor Simulator. */ /* */ /* */ /* Copyright (C) 2007-2008 */ /* Cogenda Pte Ltd */ /* */ /* Please contact Cogenda Pte Ltd for license information */ /* */ /* Author: Gong Ding gdiso@ustc.edu */ /* */ /********************************************************************************/ // $Id: mesh_generation.h,v 1.9 2008/07/09 05:58:16 gdiso Exp $ #ifndef __mesh_generation_h__ #define __mesh_generation_h__ // C++ Includes ----------------------------------- #include <vector> // Local Includes ----------------------------------- #include "genius_common.h" #include "enum_elem_type.h" // needed for ElemType enum #include "point.h" #include "parser.h" #include "skeleton.h" #include "mesh_generation_base.h" class MeshGeneratorStruct : public MeshGeneratorBase { public: /** * Constructor. */ MeshGeneratorStruct (MeshBase& mesh) : MeshGeneratorBase(mesh), dscale(1e2), point_num(0), point_array3d(0), IX(0), IY(0), IZ(0), h_min(1e30), h_max(0.0) {} /** * destructor. */ virtual ~MeshGeneratorStruct() {} protected: /** * scale the dimension of geometry * the unit of dimension in input file should be um * default scale is multiply 1e2 to um */ Real dscale; /** * the total point number */ int point_num; /** * the 3D point array which makes the background point clouds */ SkeletonPoint ***point_array3d; /** * the bound box of 3D points array by index */ unsigned int IX,IY,IZ; /** * the bound box of point clouds by coordinate */ double xmin,xmax,ymin,ymax,zmin,zmax; /** * the min/max grid size */ double h_min, h_max; /** * the SkeletonLine in x dim */ SkeletonLine skeleton_line_x; /** * the SkeletonLine in y dim */ SkeletonLine skeleton_line_y; /** * the SkeletonLine in z dim */ SkeletonLine skeleton_line_z; /** * set_x_line: This function check and do X.MESH card * which init mesh line in x direction. */ int set_x_line(const Parser::Card &c); /** * set_y_line: This function check and do Y.MESH card * which init mesh line in y direction. */ int set_y_line(const Parser::Card &c); /** * set_z_line: This function check and do Z.MESH card * which init mesh line in z direction. */ int set_z_line(const Parser::Card &c); /** * @return the index of x direction skeleton line by x coordinate */ int find_skeleton_line_x(double x); /** * @return the index of y direction skeleton line by y coordinate */ int find_skeleton_line_y(double y); /** * @return the index of z direction skeleton line by z coordinate */ int find_skeleton_line_z(double z); }; #endif // #define __mesh_generation_h__
/** * \file IMP/isd/HybridMonteCarlo.h * \brief A hybrid monte carlo implementation * * Copyright 2007-2017 IMP Inventors. All rights reserved. * */ #ifndef IMPISD_HYBRID_MONTE_CARLO_H #define IMPISD_HYBRID_MONTE_CARLO_H #include <IMP/isd/isd_config.h> #include <IMP/core/MonteCarlo.h> #include <IMP/isd/MolecularDynamics.h> #include <IMP/isd/MolecularDynamicsMover.h> #include <IMP/macros.h> IMPISD_BEGIN_NAMESPACE //! Hybrid Monte Carlo optimizer // moves all xyz particles having a fixed mass with an MD proposal class IMPISDEXPORT HybridMonteCarlo : public core::MonteCarlo { public: HybridMonteCarlo(Model *m, Float kT = 1.0, unsigned steps = 100, Float timestep = 1.0, unsigned persistence = 1); Float get_kinetic_energy() const; Float get_potential_energy() const; Float get_total_energy() const; // set md timestep void set_timestep(Float ts); double get_timestep() const; // set number of md steps per mc step void set_number_of_md_steps(unsigned nsteps); unsigned get_number_of_md_steps() const; // set how many mc steps happen until you redraw the momenta void set_persistence(unsigned persistence = 1); unsigned get_persistence() const; // return pointer to isd::MolecularDynamics instance // useful if you want to set other stuff that is not exposed here MolecularDynamics *get_md() const; // evaluate should return the total energy double do_evaluate(const ParticleIndexes &) const; virtual void do_step(); IMP_OBJECT_METHODS(HybridMonteCarlo); private: unsigned num_md_steps_, persistence_; unsigned persistence_counter_; IMP::PointerMember<MolecularDynamicsMover> mv_; Pointer<MolecularDynamics> md_; }; IMPISD_END_NAMESPACE #endif /* IMPISD_HYBRID_MONTE_CARLO_H */
/** \file * \brief useable example of the Modular Multilevel Mixer * * \author Gereon Bartel * * \par License: * This file is part of the Open Graph Drawing Framework (OGDF). * * \par * Copyright (C)<br> * See README.md in the OGDF root directory for details. * * \par * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * Version 2 or 3 as published by the Free Software Foundation; * see the file LICENSE.txt included in the packaging of this file * for details. * * \par * 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. * * \par * You should have received a copy of the GNU General Public * License along with this program; if not, see * http://www.gnu.org/copyleft/gpl.html */ #pragma once #include <ogdf/module/LayoutModule.h> #include <ogdf/energybased/multilevel_mixer/MultilevelGraph.h> namespace ogdf { /** \brief An example Layout using the Modular Mutlievel Mixer * * This example is tuned for nice drawings for most types of graphs. * EdgeCoverMerger and BarycenterPlacer are used as merging and placement * strategies. The FastMultipoleEmbedder is for force calculation. * * For an easy variation of the Modular Multilevel Mixer copy the code in call. */ class OGDF_EXPORT MMMExampleNiceLayout : public LayoutModule { public: //! Constructor MMMExampleNiceLayout(); //! calculates a drawing for the Graph GA void call(GraphAttributes &GA) override; //! calculates a drawing for the Graph MLG void call(MultilevelGraph &MLG); private: }; } // namespace ogdf
#pragma once #include <malloc.h> #include <memory> namespace walberla { namespace simd { /** * STL-compliant allocator that allocates aligned memory. * \tparam T Type of the element to allocate. * \tparam Alignment Alignment of the allocation, e.g. 16. */ template <class T, size_t Alignment> struct aligned_allocator : public std::allocator<T> // Inherit construct(), destruct() etc. { typedef typename std::allocator<T>::size_type size_type; typedef typename std::allocator<T>::pointer pointer; typedef typename std::allocator<T>::const_pointer const_pointer; /// Defines an aligned allocator suitable for allocating elements of type /// @c U. template <class U> struct rebind { typedef aligned_allocator<U,Alignment> other; }; /// Default-constructs an allocator. aligned_allocator() throw() { } /// Copy-constructs an allocator. aligned_allocator(const aligned_allocator& other) throw() : std::allocator<T>(other) { } /// Convert-constructs an allocator. template <class U> aligned_allocator(const aligned_allocator<U,Alignment>&) throw() { } /// Destroys an allocator. ~aligned_allocator() throw() { } /// Allocates @c n elements of type @c T, aligned to a multiple of /// @c Alignment. pointer allocate(size_type n) { return allocate(n, const_pointer(0)); } /// Allocates @c n elements of type @c T, aligned to a multiple of /// @c Alignment. pointer allocate(size_type n, const_pointer /* hint */) { void *p; #ifndef _WIN32 if (posix_memalign(&p, Alignment, n*sizeof(T)) != 0) p = NULL; #else p = _aligned_malloc(n*sizeof(T), Alignment); #endif if (!p) throw std::bad_alloc(); return static_cast<pointer>(p); } /// Frees the memory previously allocated by an aligned allocator. void deallocate(pointer p, size_type /* n */) { #ifndef _WIN32 free(p); #else _aligned_free(p); #endif } }; /** * Checks whether two aligned allocators are equal. Two allocators are equal * if the memory allocated using one allocator can be deallocated by the other. * \returns Always @c true. */ template <class T1, size_t A1, class T2, size_t A2> bool operator == (const aligned_allocator<T1,A1> &, const aligned_allocator<T2,A2> &) { return true; } /** * Checks whether two aligned allocators are not equal. Two allocators are equal * if the memory allocated using one allocator can be deallocated by the other. * \returns Always @c false. */ template <class T1, size_t A1, class T2, size_t A2> bool operator != (const aligned_allocator<T1,A1> &, const aligned_allocator<T2,A2> &) { return false; } } // namespace simd } // namespace walberla
/* * Darmix-Core Copyright (C) 2013 Deremix * Integrated Files: CREDITS.md and LICENSE.md */ #ifdef WIN32 #ifndef _WIN32_SERVICE_ #define _WIN32_SERVICE_ bool WinServiceInstall(); bool WinServiceUninstall(); bool WinServiceRun(); #endif // _WIN32_SERVICE_ #endif // WIN32
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: ../pdfreporter-extensions/src/org/oss/pdfreporter/uses/org/oss/jshuntingyard/evaluator/interpreter/Evaluator.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator") #ifdef RESTRICT_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator #define INCLUDE_ALL_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator 0 #else #define INCLUDE_ALL_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator 1 #endif #undef RESTRICT_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator #if !defined (OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_) && (INCLUDE_ALL_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator || defined(INCLUDE_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator)) #define OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_ @protocol JavaUtilCollection; @protocol OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorFunctionElement; @protocol OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorFunctionElementArgument; @protocol OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterVariable; @interface OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator : NSObject #pragma mark Public - (instancetype)init; - (instancetype)initWithNSString:(NSString *)evalExpression; - (void)addFunctionWithOrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorFunctionElement:(id<OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorFunctionElement>)function; - (void)addFunctionsWithJavaUtilCollection:(id<JavaUtilCollection>)functions; - (void)bindVariableWithOrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterVariable:(id<OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterVariable>)variable; - (id<OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorFunctionElementArgument>)evaluate; - (void)parseWithNSString:(NSString *)evalExpression; @end J2OBJC_STATIC_INIT(OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator) FOUNDATION_EXPORT void OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_initWithNSString_(OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator *self, NSString *evalExpression); FOUNDATION_EXPORT OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator *new_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_initWithNSString_(NSString *evalExpression) NS_RETURNS_RETAINED; FOUNDATION_EXPORT OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator *create_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_initWithNSString_(NSString *evalExpression); FOUNDATION_EXPORT void OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_init(OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator *self); FOUNDATION_EXPORT OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator *new_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_init() NS_RETURNS_RETAINED; FOUNDATION_EXPORT OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator *create_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator_init(); J2OBJC_TYPE_LITERAL_HEADER(OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator) #endif #pragma pop_macro("INCLUDE_ALL_OrgOssPdfreporterUsesOrgOssJshuntingyardEvaluatorInterpreterEvaluator")
/* * Copyright (C) 2003-2022 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * * WeeChat 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. * * WeeChat 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 WeeChat. If not, see <https://www.gnu.org/licenses/>. */ #ifndef WEECHAT_PLUGIN_XFER_INFO_H #define WEECHAT_PLUGIN_XFER_INFO_H extern void xfer_info_init (); #endif /* WEECHAT_PLUGIN_XFER_INFO_H */
/* * @author: jelathro * @date: 10/24/13 * * Singly linked list (as compared * to a doubly linked or indexed * list) that contains generic items * called ListItem_t. */ #ifndef __LIST_H__ #define __LIST_H__ #include "ListItem.h" typedef struct List_t{ ListItem_t * head; } List_t; /* * Given list, Creates a new empty List_t and * returns its reference. */ List_t list_initialize(); /* * Given list, Creates a new ListItem_t and adds * it to the end of the List_t. This * returns an int accordingly if * successful or not. */ int list_add_item(List_t *, ListItem_t *); /* * Given list, Creates a new ListItem_t and adds * it after the index given. This returns * an int accordingly if successful * or not. */ int list_add_item_after(List_t *, int, ListItem_t *); /* * Given list, Creates a new ListItem_t and adds * it before the index given. This returns * an int accordingly if successful * or not. */ int list_add_item_before(List_t *, int, ListItem_t *); /* * Given list, Free's and removes head from * the List_t. */ int list_remove_item_head(List_t *, list_item_remove_callback_func); /* * Given list, Free's and removes tail from * List_t. */ int list_remove_item_tail(List_t *, list_item_remove_callback_func); /* * Given list, Free's and removes ListItem_t * and updates list "hole". */ int list_remove_item_at(List_t *, int, list_item_remove_callback_func); /* * Given list, Free's and removes list * and returns int according to success. */ int list_remove(List_t *, list_item_remove_callback_func); /* * Given list and callback function, list * will loop through all LitItem_t's and * call the function for it. */ int list_for_each(List_t *, list_item_callback_func); /* * Given list and index to find and * return ListItem_t data (void *). */ void * list_get_at(List_t *, int); /* * Given list and index to find and * set ListItem_t data (void *), * returns int on success accordingly. */ int list_set_at(List_t *, void *, int); #endif
#ifndef _PMINIT_H #define _PMINIT_H void pminit(); #endif
// _4.h // This file is part of the _4 program. // Copyright 2014 David Raymond McCortney II // // The _4 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. // // The _4 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 _4. If not, see <http://www.gnu.org/licenses/>. #pragma once #include <X11/X.h> #include <X11/Xlib.h> #include "board.h" #include "image.h" typedef enum { PLAYING, WIN, GAME_OVER } state_t; extern char WINMSG[]; // Win message. extern char CREMSG[]; // Credits message. extern const int B; // Dimensions of each block in pixels. extern const int BSTARTX, BSTARTY; // Start positions. // Shapes. extern const int _[]; // HHHH extern const int F[]; // HH extern const int H[]; // H HH extern const int L[]; // H HH H extern const int S[]; // H HH extern const int T[]; // HH HH HHH extern const int Z[]; // H HH // HH enum { // Colors. GREY, PINK, RED, ORANGE, LIME_GREEN, BLUE, ORCHID, MAX_COLOR, TRANSPARENT = 8, AREA_X = 10, // Width in blocks. AREA_Y = 20, // Height in blocks. MAX_LEVEL = 10, // Maximum number of levels. MAX_WHICH = 6, // Maximum number of shapes. GNUTEXT = 9, // Lines of text for copying and warranty. HELPTEXT = 9 // Lines of help text. }; extern const int MOD[MAX_LEVEL]; // Clock modulus. typedef struct { Display* display; // Connection to the X server. int screen; // Default number. Window root; // Display screen. Window window; // _4 area. XEvent event; // Asynchronous data. Atom deletion; // Destroy. unsigned long black, white; // Default. unsigned long color[MAX_COLOR]; // Named. GC context; // Graphics. image_t image; // Background. int clock; // Time. state_t state; // Track whether user is playing, game ended, etc. int level; // Difficulty. int x, y; // Current coordinates. int angle; // One unit is ninety degrees. int which; // Shape index. int which_next; // Next shape index. bool redraw; // Display is rendered if this is true. bool pause; // Halt. int goal; // Number of _4s required to advance. int score; // +1 for row, +100 for duo, +10K for trio, +1M for _4. board_t board; // Play area. XColor c; // Color allocation. Colormap m; // Map. } x11; #define IMGPATH "image.g.c" x11* _4init(int, char**, bool); void _4init_game_state(x11*); bool input(x11*); void stop_x11(x11*); void box(int, // Color. int, // Column. int, // Row. x11*); void shape(int, // Bitmap. int, // Color. int, // Column. int, // Row. x11*); void shapesub(int, // Bitmap. int, // Color. int, // Column. int, // Row. bool, // Forced if true, clipped otherwise. x11*); int pickshape(int, // Which shape. int); // Angle. void announce(const char*, // Display the given message as a bar x11*); // across the center of the screen. void announce_y(const char*, int, x11*); bool lose(x11*); // True if game lost, false otherwise. Also displays notice. void setgoal(x11*); // Set goal based on level.
//************** // Golden Gears Robotics // 2/7/15 // Hardware H //************** // Tyler Robbins - 2-7-15 - Added Hardware class definition. // Tyler Robbins - 2-8-15 - Added PIDrift object. #ifndef _HARDWARE_H_ #define _HARDWARE_H_ #include "WPILib.h" #include "ADXRS453Z.h" #include "PIDrift.h" enum Talons{FRONT_LEFT_WHEEL,FRONT_RIGHT_WHEEL,BACK_LEFT_WHEEL,BACK_RIGHT_WHEEL,ELEVATOR_MOTOR}; const float SPOOL_RADIUS = 1.25; // inches class Hardware{ public: ~Hardware(); void move(Joystick *joy); void ElevatorPeriodic(bool up=false, bool down=false, int gotop=-1); void toggleSolenoid(Solenoid *sol); void setSolenoid(Solenoid *sol, bool value); void resetDrift(); float shiftThrottle(float throt); float filterJoyValue(float val); ADXRS453Z* GetGyro(){ return ggnore; }; PIDrift* GetPIDrift(){ return drift; }; RobotDrive* GetDrive(){ return drive; }; CANTalon* GetTalon(Talons tal){ switch(tal){ case Talons::FRONT_RIGHT_WHEEL: return frontRight; case Talons::FRONT_LEFT_WHEEL: return frontLeft; case Talons::BACK_RIGHT_WHEEL: return backRight; case Talons::BACK_LEFT_WHEEL: return backLeft; case Talons::ELEVATOR_MOTOR: return elevator; } }; AnalogPotentiometer* GetPotentiometer(){ return poten; } static Hardware* GetInstance(); double GetGyroRate() { return ggnore->GetRate(); }; double GetGyroAngle() { return ggnore->GetAngle(); }; double GetGyroOffset() { return ggnore->GetOffset(); }; float GetPotenValue(){ return poten->Get(); }; private: Hardware(); void moveElevator(float pwr); void ElevatorUp(float percent); void ElevatorDown(float percent); void ElevatorGoTo(int pos); float stripDecimals(float num,int place); float convertDisToVolt(float dist); float convertVolToDist(float volt); float GetNextPosition(JoystickButton* buttons); CANTalon *frontLeft; CANTalon *frontRight; CANTalon *backLeft; CANTalon *backRight; CANTalon *elevator; AnalogPotentiometer *poten; RobotDrive *drive; ADXRS453Z *ggnore; PIDrift *drift; static Hardware* m_instance; }; #endif
#ifndef LIBXMP_MIXER_H #define LIBXMP_MIXER_H #define C4_PERIOD 428.0 #define SMIX_NUMVOC 128 /* default number of softmixer voices */ #define SMIX_SHIFT 16 #define SMIX_MASK 0xffff #define FILTER_SHIFT 16 #define ANTICLICK_SHIFT 3 #ifdef LIBXMP_PAULA_SIMULATOR #include "paula.h" #endif #define SMIX_MIXER(f) void f(struct mixer_voice *vi, int *buffer, \ int count, int vl, int vr, int step, int ramp, int delta_l, int delta_r) struct mixer_voice { int chn; /* channel number */ int root; /* */ int note; /* */ #define PAN_SURROUND 0x8000 int pan; /* */ int vol; /* */ double period; /* current period */ double pos; /* position in sample */ int pos0; /* position in sample before mixing */ int fidx; /* mixer function index */ int ins; /* instrument number */ int smp; /* sample number */ int end; /* loop end */ int act; /* nna info & status of voice */ int old_vl; /* previous volume, left channel */ int old_vr; /* previous volume, right channel */ int sleft; /* last left sample output, in 32bit */ int sright; /* last right sample output, in 32bit */ #define VOICE_RELEASE (1 << 0) #define ANTICLICK (1 << 1) #define SAMPLE_LOOP (1 << 2) int flags; /* flags */ void *sptr; /* sample pointer */ #ifdef LIBXMP_PAULA_SIMULATOR struct paula_state *paula; /* paula simulation state */ #endif #ifndef LIBXMP_CORE_DISABLE_IT struct { int r1; /* filter variables */ int r2; int l1; int l2; int a0; int b0; int b1; int cutoff; int resonance; } filter; #endif }; int mixer_on (struct context_data *, int, int, int); void mixer_off (struct context_data *); void mixer_setvol (struct context_data *, int, int); void mixer_seteffect (struct context_data *, int, int, int); void mixer_setpan (struct context_data *, int, int); int mixer_numvoices (struct context_data *, int); void mixer_softmixer (struct context_data *); void mixer_reset (struct context_data *); void mixer_setpatch (struct context_data *, int, int); void mixer_voicepos (struct context_data *, int, double); int mixer_getvoicepos (struct context_data *, int); void mixer_setnote (struct context_data *, int, int); void mixer_setperiod (struct context_data *, int, double); void mixer_release (struct context_data *, int, int); #endif /* LIBXMP_MIXER_H */
/******************************************************************* Part of the Fritzing project - http://fritzing.org Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de Fritzing 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. Fritzing 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 Fritzing. If not, see <http://www.gnu.org/licenses/>. ******************************************************************** $Revision: 6904 $: $Author: irascibl@gmail.com $: $Date: 2013-02-26 16:26:03 +0100 (Di, 26. Feb 2013) $ ********************************************************************/ #ifndef INSTALLEDFONTS_H #define INSTALLEDFONTS_H #include <QSet> #include <QString> #include <QMultiHash> class InstalledFonts { public: static QSet<QString> InstalledFontsList; static QMultiHash<QString, QString> InstalledFontsNameMapper; // family name to filename; SVG files seem to have to use filename // note: these static variables are initialized in fapplication.cpp }; #endif
/* * Cantata * * Copyright (c) 2011-2014 Craig Drummond <craig.p.drummond@gmail.com> * */ /* * Copyright (c) 2008 Sander Knopper (sander AT knopper DOT tk) and * Roeland Douma (roeland AT rullzer DOT com) * * This file is part of QtMPC. * * QtMPC 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. * * QtMPC 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 QtMPC. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MUSIC_LIBRARY_ITEM_ALBUM_H #define MUSIC_LIBRARY_ITEM_ALBUM_H #include <QList> #include <QVariant> #include <QSet> #include "musiclibraryitem.h" #include "mpd/song.h" class QPixmap; class MusicLibraryItemArtist; class MusicLibraryItemSong; class MusicLibraryItemAlbum : public MusicLibraryItemContainer { public: static void setSortByDate(bool sd); static bool sortByDate(); static bool lessThan(const MusicLibraryItem *a, const MusicLibraryItem *b); MusicLibraryItemAlbum(const QString &data, const QString &original, const QString &mbId, quint32 year, const QString &sort, MusicLibraryItemContainer *parent); virtual ~MusicLibraryItemAlbum(); QString displayData(bool full=false) const; #ifdef ENABLE_UBUNTU const QString & cover() const; #endif quint32 year() const { return m_year; } quint32 totalTime(); quint32 trackCount(); void addTracks(MusicLibraryItemAlbum *other); bool isSingleTracks() const { return Song::SingleTracks==m_type; } void setIsSingleTracks(); bool isSingleTrackFile(const Song &s) const { return m_singleTrackFiles.contains(s.file); } void append(MusicLibraryItem *i); void remove(int row); void remove(MusicLibraryItemSong *i); void removeAll(const QSet<QString> &fileNames); QMap<QString, Song> getSongs(const QSet<QString> &fileNames) const; Song::Type songType() const { return m_type; } Type itemType() const { return Type_Album; } const MusicLibraryItemSong * getCueFile() const; const QString & imageUrl() const { return m_imageUrl; } void setImageUrl(const QString &u) { m_imageUrl=u; } bool updateYear(); bool containsArtist(const QString &a); // Return orignal album name. If we are grouping by composer, then album will appear as "Album (Artist)" const QString & originalName() const { return m_originalName; } const QString & id() const { return m_id; } const QString & albumId() const { return m_id.isEmpty() ? m_itemData : m_id; } const QString & sortString() const { return m_sortString.isEmpty() ? m_itemData : m_sortString; } bool hasSort() const { return !m_sortString.isEmpty(); } #ifdef ENABLE_UBUNTU void setCover(const QString &c) { m_coverName="file://"+c; m_coverRequested=false; } const QString & coverName() { return m_coverName; } #endif Song coverSong() const; private: void setYear(const MusicLibraryItemSong *song); void updateStats(); private: quint32 m_year; quint16 m_yearOfTrack; quint16 m_yearOfDisc; quint32 m_totalTime; quint32 m_numTracks; QString m_originalName; QString m_sortString; QString m_id; mutable Song m_coverSong; #ifdef ENABLE_UBUNTU mutable bool m_coverRequested; mutable QString m_coverName; #endif Song::Type m_type; QSet<QString> m_singleTrackFiles; QString m_imageUrl; // m_artists is used to cache the list of artists in a various artists album // this is built when containsArtist() is called, and is mainly used by the // context view QSet<QString> m_artists; }; #endif
/*************************************************************************** * The FreeMedForms project is a set of free, open source medical * * applications. * * (C) 2008-2016 by Eric MAEKER, MD (France) <eric.maeker@gmail.com> * * All rights reserved. * * * * The FreeAccount plugins are free, open source FreeMedForms' plugins. * * (C) 2010-2011 by Pierre-Marie Desombre, MD <pm.desombre@medsyn.fr> * * and Eric Maeker, MD <eric.maeker@gmail.com> * * All rights reserved. * * * * 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 (COPYING.FREEMEDFORMS file). * * If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ /*************************************************************************** * Main Developers: Pierre-Marie DESOMBRE <pm.desombre@medsyn.fr>, * * Eric MAEKER, <eric.maeker@gmail.com> * * Contributors: * * NAME <MAIL@ADDRESS.COM> * ***************************************************************************/ #ifndef MOVEMENTSIO_H #define MOVEMENTSIO_H #include <accountplugin/account_exporter.h> #include <QStandardItemModel> #include <QHash> namespace AccountDB { class MovementModel; } class ACCOUNT_EXPORT MovementsIODb : public QObject { Q_OBJECT enum Icons { ICON_NOT_PREF = 0, ICON_PREF }; public: MovementsIODb(QObject *parent); ~MovementsIODb(); AccountDB::MovementModel *getModelMovements(QString &year); QStandardItemModel *getMovementsComboBoxModel(QObject *parent); QStringList getYearComboBoxModel(); QStandardItemModel *getBankComboBoxModel(QObject * parent); bool insertIntoMovements(QHash<int,QVariant> &hashValues); bool deleteMovement(int row, const QString & year); bool validMovement(int row); int getAvailableMovementId(QString & movementsComboBoxText); int getTypeOfMovement(QString & movementsComboBoxText); int getBankId(QString & bankComboBoxText); QString getBankNameFromId(int id); QString getUserUid(); QHash<QString,QString> hashChildrenAndParentsAvailableMovements(); bool containsFixAsset(int & row); private: QStringList listOfParents(); bool debitOrCreditInBankBalance(const QString & bank, double & value); AccountDB::MovementModel *m_modelMovements; QString m_user_uid; }; #endif
#ifndef BOSSBURSTTANK_H_ #define BOSSBURSTTANK_H_ #include "BurstTank.h" class BossBurstTank : public EnemyTank { public: BossBurstTank (Path* p = NULL) : EnemyTank(BOSS_BCIRCLE_R, new TankAI(new AimPolicy(), p?(MovementPolicy*)new PathPolicy():(MovementPolicy*)new SmartPolicy())) { setLives(3); setFirePolicy(new BurstFirePolicy(Difficulty::getInstance()->getEnemiesFireInterval()/2, IN_BURST_INTERVAL, NUM_BURST)); if (p) setPath(p); } eTankType getTankType () const { return BOSS_BURST; } double getInitialFiringDelay () const { return Difficulty::getInstance()->getBossFiringDelay(); } bool bounce (Entity* e, const Vector2& colPoint) { return shieldBounce(e, colPoint); } Rocket* createRocket(Tank* owner, const Vector2& pos, const Vector2& dir) { return new Rocket(owner, pos, dir, Difficulty::getInstance()->getEnemiesBurstRocketSpeed(), BOUNCE); } }; #endif /* BOSSBURSTTANK_H_ */
/********************************************************************* CombLayer : MCNP(X) Input builder * File: commonBeamInc/GratingUnit.h * * Copyright (c) 2004-2018 by Stuart Ansell * * 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 xraySystem_GratingUnit_h #define xraySystem_GratingUnit_h class Simulation; namespace xraySystem { class GrateHolder; /*! \class GratingUnit \author S. Ansell \version 1.0 \date September 2018 \brief Paired Mono-crystal mirror constant exit gap */ class GratingUnit : public attachSystem::ContainedComp, public attachSystem::FixedRotate, public attachSystem::ExternalCut, public attachSystem::CellMap, public attachSystem::SurfMap { private: double HArm; ///< Rotation arm [flat] double PArm; ///< rotation arm [vertical] double zLift; ///< Size of beam lift double mirrorTheta; ///< Mirror angle double mWidth; ///< Mirror width double mThick; ///< Mirror thick double mLength; ///< Mirror length double grateTheta; ///< Theta angle for grating int grateIndex; ///< Offset position of grating std::array<std::shared_ptr<GrateHolder>,3> grateArray; double mainGap; ///< Void gap between bars double mainBarCut; ///< Gap to allow beam double mainBarXLen; ///< X length of bars (to side support) double mainBarDepth; ///< Depth Z direction double mainBarYWidth; ///< Bar extent in beam direction double slidePlateZGap; ///< lift from the mirror surface double slidePlateThick; ///< slide bar double slidePlateWidth; ///< slide bar extra width double slidePlateLength; ///< slide bar extra length int mirrorMat; ///< Mirror xstal int mainMat; ///< Main metal int slideMat; ///< slide material void populate(const FuncDataBase&); void createUnitVector(const attachSystem::FixedComp&, const long int); void createSurfaces(); void createObjects(Simulation&); void createLinks(); public: GratingUnit(const std::string&); GratingUnit(const GratingUnit&); GratingUnit& operator=(const GratingUnit&); virtual ~GratingUnit(); void createAll(Simulation&, const attachSystem::FixedComp&, const long int); }; } #endif
/* * This file is part of Audio switch daemon. * Audio switch daemon 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. * * Audio switch daemon 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 Audio switch daemon. * If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <getopt.h> #include <stdio.h> #include <sys/types.h> #include <signal.h> #include "help.h" #include "version.h" #include "options.h" #include "arguments.h" /* * Parse Arguments, set Flags */ void parse_arguments(int argc, char *argv[]) { int c; int option_index = 0; /*Set defaults*/ daemon_flag = 1; sock_path = "/home/pi/.mpd/socket"; switch_pin = 17; while(1) { static struct option long_options[] = { {"no-daemon", no_argument, &daemon_flag, 0}, /* These options don’t set a flag.*/ {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"pin", required_argument, 0, 'p'}, {"socket", required_argument, 0, 's'}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "hvkP:s:p:c:",long_options, &option_index); if(c==-1) break; switch(c) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 'h': print_help(); exit(EXIT_SUCCESS); break; case 'v': print_version(); exit(EXIT_SUCCESS); break; case 'p': switch_pin=eval_pin(atoi(optarg)); break; case 's': sock_path = optarg; case '?': printf ("Unknown arguments. See asd --help for arguments.\n"); exit(EXIT_FAILURE); /* getopt_long already printed an error message. */ break; default: abort (); } } } /* * Check if pin is in usable GPIO range. * Return default (GPIO 17) if pin is out of range. * Otherwise return pin */ uint8_t eval_pin(int pin) { if ( pin < 0 || pin == 5 || pin ==6 || pin == 12 || pin == 13 || pin == 16 || pin == 19 || pin == 20 || pin == 26 || pin > 31) { fprintf(stdout,"Invalid pin, using default pin %d\n",DEFAULT_PIN); return DEFAULT_PIN; } else { return pin; } }
#ifndef PARTICLEHANDLE_H #define PARTICLEHANDLE_H 1 /** * @class ParticleHandle * @brief handles a decay structure to MyKin ploters * * @author Paul Seyfert * @date 2012-01-21 */ #include <map> #include <string> class MyKin; class ZooP; class ZooEv; class TDirectory; class ParticleHandle { private: MyKin* m_kinplot; std::map<int,ParticleHandle*> map; bool m_initialised; void initialise(const ZooP*); std::string m_prefix; public: void Fill(const ZooP*, const ZooEv*, double w=1.); void Write(TDirectory* dir); ParticleHandle(); ParticleHandle(std::string prefix); ~ParticleHandle(); }; #endif
/* $Id$ */ /* Copyright (c) 2013-2021 Pierre Pronchery <khorben@defora.org> */ /* 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 * HOLDER 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. */ /* This file is part of DeforaOS Desktop Player */ #include <unistd.h> #include <stdio.h> #include <string.h> #include <locale.h> #include <libintl.h> #include <gtk/gtk.h> #include <Desktop.h> #include "../include/Player.h" #include "../config.h" #define _(string) gettext(string) /* constants */ #ifndef PROGNAME_PLAYERCTL # define PROGNAME_PLAYERCTL "playerctl" #endif #ifndef PREFIX # define PREFIX "/usr/local" #endif #ifndef DATADIR # define DATADIR PREFIX "/share" #endif #ifndef LOCALEDIR # define LOCALEDIR DATADIR "/locale" #endif /* playerctl */ /* private */ /* prototypes */ static int _playerctl(PlayerMessage message, unsigned int arg1); static int _error(char const * message, int ret); static int _usage(void); /* functions */ /* playerctl */ static int _playerctl(PlayerMessage message, unsigned int arg1) { desktop_message_send(PLAYER_CLIENT_MESSAGE, message, arg1, 0); return 0; } /* error */ static int _error(char const * message, int ret) { fputs(PROGNAME_PLAYERCTL ": ", stderr); perror(message); return ret; } /* usage */ static int _usage(void) { fprintf(stderr, _("Usage: %s -FMmNPRpsu\n"), PROGNAME_PLAYERCTL); return 1; } /* public */ /* functions */ /* main */ int main(int argc, char * argv[]) { int o; int message = -1; unsigned int arg1 = 0; if(setlocale(LC_ALL, "") == NULL) _error("setlocale", 1); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); gtk_init(&argc, &argv); while((o = getopt(argc, argv, "FMmNPRpsu")) != -1) switch(o) { case 'F': message = PLAYER_MESSAGE_FORWARD; arg1 = 0; break; case 'm': message = PLAYER_MESSAGE_MUTE; arg1 = PLAYER_MUTE_MUTE; break; case 'M': message = PLAYER_MESSAGE_PREVIOUS; arg1 = 0; break; case 'N': message = PLAYER_MESSAGE_NEXT; arg1 = 0; break; case 'P': message = PLAYER_MESSAGE_PAUSE; arg1 = 0; break; case 'R': message = PLAYER_MESSAGE_REWIND; arg1 = 0; break; case 'p': message = PLAYER_MESSAGE_PLAY; arg1 = 0; break; case 's': message = PLAYER_MESSAGE_STOP; arg1 = 0; break; case 'u': message = PLAYER_MESSAGE_MUTE; arg1 = PLAYER_MUTE_UNMUTE; break; default: return _usage(); } if(argc != optind || message < 0) return _usage(); return (_playerctl(message, arg1) == 0) ? 0 : 2; }
/* * This file is part of KNLMeansCL, * Copyright(C) 2015-2020 Edoardo Brunetti. * * KNLMeansCL 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. * * KNLMeansCL 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 KNLMeansCL. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OCL_UTILS_H #define __OCL_UTILS_H #define CL_TARGET_OPENCL_VERSION 120 #ifdef __APPLE__ #include <OpenCL/opencl.h> #else #include <CL/opencl.h> #endif ////////////////////////////////////////// // Type Definition #define OCL_UTILS_DEVICE_TYPE_CPU (1 << 0) #define OCL_UTILS_DEVICE_TYPE_GPU (1 << 1) #define OCL_UTILS_DEVICE_TYPE_ACCELERATOR (1 << 2) #define OCL_UTILS_DEVICE_TYPE_AUTO (1 << 3) #define OCL_UTILS_MALLOC_ERROR 1 #define OCL_UTILS_NO_DEVICE_AVAILABLE 2 #define OCL_UTILS_INVALID_DEVICE_TYPE 3 #define OCL_UTILS_INVALID_VALUE 4 #define OCL_UTILS_OPENCL_1_0 10 #define OCL_UTILS_OPENCL_1_1 11 #define OCL_UTILS_OPENCL_1_2 12 #define OCL_UTILS_OPENCL_2_0 20 #define OCL_UTILS_OPENCL_2_1 21 #define OCL_UTILS_OPENCL_2_2 22 ////////////////////////////////////////// // Functions const char* oclUtilsErrorToString( cl_int err ); cl_int oclUtilsCheckPlatform( cl_platform_id platofrm, bool *compatible ); cl_int oclUtilsCheckDevice( cl_device_id device, bool *compatible ); cl_int oclUtilsGetIDs( cl_device_type device_type, cl_uint shf_device, cl_platform_id *platform, cl_device_id *device ); cl_int oclUtilsGetPlaformDeviceIDs( cl_uint device_type, cl_uint shf_device, cl_platform_id *platform, cl_device_id *device ); void oclUtilsDebugInfo( cl_platform_id platform, cl_device_id device, cl_program program, cl_int errcode ); #endif //__OCLUTILS_H__
#ifndef __DV_TEST_CONF_H__ #define __DV_TEST_CONF_H__ #include <netinet/in.h> #include "dv_server_conf.h" #define DV_CONF_BACKEND_ADDR_MAX_NUM 128 typedef struct _dv_backend_addr_t { char ba_addr[DV_IP_ADDRESS_LEN]; dv_u16 ba_port; } dv_backend_addr_t; typedef struct _dv_test_conf_t { dv_backend_addr_t cf_backend_addrs[DV_CONF_BACKEND_ADDR_MAX_NUM]; dv_u16 cf_backend_addr_num; dv_u16 cf_curr; } dv_test_conf_t; typedef struct _dv_test_conf_parse_t { char *cp_name; int cp_type; int (*cp_parser)(dv_backend_addr_t *addr, json_object *param); } dv_test_conf_parse_t; extern dv_test_conf_t dv_test_conf; extern int dv_test_conf_parse(dv_srv_conf_t *conf, char *file); #endif
#ifndef COMMON_H #define COMMON_H // ********** Globale Einstellungen zum Layout und zur Version ************** #define IICTEST #define USE_LED_BUILTIN String mVersionNr = "V01-00-03."; // ********** Ende der Einstellungen **************************************** #include <TimeLib.h> //<Time.h> http://www.arduino.cc/playground/Code/Time #define DEBUG_OUTPUT Serial #define DBG_OUTPUT_PORT Serial #ifdef IICTEST # ifdef USE_LED_BUILTIN String mVersionVariante = "iic."; # else String mVersionVariante = "i2c."; # endif #else String mVersionVariante = "min."; #endif //ifdef IIC #ifdef ARDUINO_ESP8266_NODEMCU const byte board = 1; String mVersionBoard = "nodemcu"; #elif ARDUINO_ESP8266_WEMOS_D1MINI const byte board = 2; String mVersionBoard = "d1_mini"; #else const byte board = 3; String mVersionBoard = "unknown"; #endif // enables OTA updates #include <ESP8266httpUpdate.h> #include <ESP8266WebServer.h> ESP8266WebServer server; #define LOGINLAENGE 32 #define COOKIE_MAX 10 #define COOKIE_ADMINISTRATOR 1 #define COOKIE_BENUTZER 2 const char * headerKeys[] = {"User-Agent","Set-Cookie","Cookie","Date","Content-Type","Connection"} ; size_t headerKeysCount = 6; char name_timer[LOGINLAENGE] = "Wifi 4-fach Timer"; char name_r[4][LOGINLAENGE]; char AdminName[LOGINLAENGE] = "admin\0"; char AdminPasswort[LOGINLAENGE] = "\0"; char UserName[LOGINLAENGE] = "user\0"; char UserPasswort[LOGINLAENGE] = "\0"; char UpdateServer[LOGINLAENGE] = "192.168.178.60\0"; char timeserver[LOGINLAENGE] = "time.nist.gov\0"; int UserCookie[COOKIE_MAX];// = [0,0,0,0,0,0,0,0,0,0]; int UserStatus[COOKIE_MAX];// = [0,0,0,0,0,0,0,0,0,0]; int UserNext=0; int UserCurrent = -1; boolean sommerzeit = false; const char* serverIndex = "<form method='POST' action='/upload' enctype='multipart/form-data'><input type='file' name='upload'><input type='submit' value='Upload'></form>"; // Timer unsigned long NTPTime = 0, RTCTime = 0, RTCSync = 0, ZeitTemp = 0, ZeitTempMin = 0, ZeitTempStd = 0, ZeitTempTag = 0; // Status byte NTPok = 0, WLANok = 0, IOok = 0, RTCok = 0, DISPLAYok = 0; boolean AP = 0; // Accesspoint Modus aus #endif
// // Created by artyom on 14.02.16. // #ifndef LAB1_SIMPLE_COUNT_H #define LAB1_SIMPLE_COUNT_H #include <stdio.h> #include <string.h> #include <stdlib.h> #include <omp.h> #include <thread> #include "utils.h" #ifdef WITH_OPENMP const int defaultThreadCount = omp_get_num_procs(); #else const int defaultThreadCount = std::thread::hardware_concurrency(); #endif void* countThread(void* arg); wordStat countWords(const char* text, size_t len) { char* workArray = new char[len + 1]; strncpy(workArray, text, len); workArray[len] = '\0'; const char* delim = " ,. \"!-?()"; char *saveptr; wordStat stat; char* pch = strtok_r(workArray, delim, &saveptr); while (pch != NULL) { int prevCount = stat.count(pch) ? stat[pch] : 0; stat[pch] = prevCount + 1; pch = strtok_r(NULL, delim, &saveptr); } delete[] workArray; return stat; } wordStat countWordsBlockwise(const char* text, size_t len, int blockCount) { wordStat stat; vector<size_t> blockStart; size_t blockSize = len / blockCount + 1; size_t startPos = 0; size_t endPos; // Fix borders for (int i = 0; i < blockCount; i++) { blockStart.push_back(startPos); endPos = startPos + blockSize; while (true) { if ((endPos > len) || (text[endPos] == ' ')) { break; } endPos++; } startPos = endPos + 1; if (startPos > len) { break; } } for (int i = 0; i < blockCount; i++) { startPos = blockStart[i]; endPos = i == (blockCount-1) ? len : blockStart[i + 1]; // Run countWords auto localMap = countWords(text + startPos, endPos - startPos); // Merge results for (auto& it: localMap) { int prevCount = stat.count(it.first) ? stat[it.first] : 0; stat[it.first] = prevCount + it.second; } } return stat; } #ifdef WITH_OPENMP wordStat countWordsOpenMP(const char* text, size_t len, int threadCount) { wordStat stat; vector<size_t> blockStart; size_t blockSize = len / threadCount + 1; size_t startPos = 0; size_t endPos; for (int i = 0; i < threadCount; i++) { blockStart.push_back(startPos); endPos = startPos + blockSize; while (true) { if ((endPos > len) || (text[endPos] == ' ')) { break; } endPos++; } startPos = endPos + 1; if (startPos > len) { break; } } #pragma omp parallel for for (int i = 0; i < threadCount; i++) { startPos = blockStart[i]; endPos = i == (threadCount-1) ? len : blockStart[i + 1]; auto localMap = countWords(text + startPos, endPos - startPos); #pragma omp critical(merge) for (auto& it: localMap) { int prevCount = stat.count(it.first) ? stat[it.first] : 0; stat[it.first] = prevCount + it.second; } } return stat; } #endif struct threadData { const char* text; size_t len; size_t start; size_t end; wordStat* stat; pthread_mutex_t* mutex; pthread_t thread_id; }; wordStat countWordsPthreads(const char* text, size_t len, int threadCount) { wordStat stat; vector<size_t> blockStart; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; size_t blockSize = len / threadCount + 1; size_t startPos = 0; size_t endPos; threadData data[threadCount]; for (int i = 0; i < threadCount; i++) { blockStart.push_back(startPos); endPos = startPos + blockSize; while (true) { if ((endPos > len) || (text[endPos] == ' ')) { break; } endPos++; } startPos = endPos + 1; if (startPos > len) { break; } } for (int i = 0; i < threadCount; i++) { data[i].text = text; data[i].len = len; data[i].start = blockStart[i]; data[i].end = i == (threadCount-1) ? len : blockStart[i + 1]; data[i].stat = &stat; data[i].mutex = &mutex; int s = pthread_create(&data[i].thread_id, NULL, &countThread, &data[i]); assert (s == 0); } for (int i = 0; i < threadCount; i++) { pthread_join(data[i].thread_id, NULL); } pthread_mutex_destroy(&mutex); return stat; } void* countThread(void* arg) { threadData data = *(threadData*) arg; size_t startPos = data.start; size_t endPos = data.end; auto localMap = countWords(data.text + startPos, endPos - startPos); pthread_mutex_lock(data.mutex); for (auto& it: localMap) { int prevCount = data.stat->count(it.first) ? (*data.stat)[it.first] : 0; (*data.stat)[it.first] = prevCount + it.second; } pthread_mutex_unlock(data.mutex); return NULL; } #endif //LAB1_SIMPLE_COUNT_H
//Mepinta //Copyright (c) 2011-2012, Joaquin G. Duo, mepinta@joaquinduo.com.ar // //This file is part of Mepinta. // //Mepinta 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. // //Mepinta 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 Mepinta. If not, see <http://www.gnu.org/licenses/>. #ifndef TYPEDCOLLECTORMANAGER_H_ #define TYPEDCOLLECTORMANAGER_H_ #include <mepintasdk/sdk.h> #include "iTypedPropertiesCollector.h" #include <vector> //This class is used to collect properties with multiple types. //Append many TypedPropertiesCollect instances and then run collectProperties. //This will avoid looping on the properties for each type. class TypedCollectorManager{ public: //args: Mepinta args //in_out_id: INPUT_PROPS, OUTPUT_PROPS //TODO: INPUT_OUTPUT_PROPS //last_prop_index: the last_prop_index of the declared variables // if it's -1 it will get the one from args TypedCollectorManager(MP_args* args, const int in_out_id=CUSTOM_INPUT_PROPS): args(args),in_out_id(in_out_id),first_prop_index(0) {} //append a TypedPropertiesCollector for a specific type void appendCollector(iTypedPropertiesCollector* collector); //pop the last TypedPropertiesCollector added iTypedPropertiesCollector* popCollector(); //iterate over the properties to filter then for each required type int collectProperties(); private: //Typed Collectors added std::vector<iTypedPropertiesCollector*> collectors; //processor args MP_args* args; //Are we processing the inputs or the outputs (default is inputs) int in_out_id; //Where do we start to visit the properties? int first_prop_index; }; #endif /* TYPEDCOLLECTORMANAGER_H_ */
/* * Copyright 2010-2013 OpenXcom Developers. * * This file is part of OpenXcom. * * OpenXcom 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. * * OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ARESAME_H #define ARESAME_H #include <limits> #include <cmath> template <class _Tx> inline bool AreSame(const _Tx& l, const _Tx& r) { return std::fabs(l-r) <= std::numeric_limits<_Tx>::epsilon(); } #endif
/******************************************************************************* OpenAirInterface Copyright(c) 1999 - 2014 Eurecom OpenAirInterface is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenAirInterface is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenAirInterface.The full GNU General Public License is included in this distribution in the file called "COPYING". If not, see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ #ifndef PGM_LINK_H_ #define PGM_LINK_H_ /* Define prototypes only if enabled */ #if defined(ENABLE_PGM_TRANSPORT) void bypass_tx_nack(unsigned int frame, unsigned int next_slot); int pgm_oai_init(char *if_name); int pgm_recv_msg(int group, uint8_t *buffer, uint32_t length, unsigned int frame, unsigned int next_slot); int pgm_link_send_msg(int group, uint8_t *data, uint32_t len); #endif #endif /* PGM_LINK_H_ */
/* * pi.c * * Compute pi to an arbitrary number of digits. Uses Machin's formula, * like everyone else on the planet: * * pi = 16 * arctan(1/5) - 4 * arctan(1/239) * * This is pretty effective for up to a few thousand digits, but it * gets pretty slow after that. * * 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/. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <time.h> #include "mpi.h" mp_err arctan(mp_digit mul, mp_digit x, mp_digit prec, mp_int *sum); int main(int argc, char *argv[]) { mp_err res; mp_digit ndigits; mp_int sum1, sum2; clock_t start, stop; int out = 0; /* Make the user specify precision on the command line */ if (argc < 2) { fprintf(stderr, "Usage: %s <num-digits>\n", argv[0]); return 1; } if ((ndigits = abs(atoi(argv[1]))) == 0) { fprintf(stderr, "%s: you must request at least 1 digit\n", argv[0]); return 1; } start = clock(); mp_init(&sum1); mp_init(&sum2); /* sum1 = 16 * arctan(1/5) */ if ((res = arctan(16, 5, ndigits, &sum1)) != MP_OKAY) { fprintf(stderr, "%s: arctan: %s\n", argv[0], mp_strerror(res)); out = 1; goto CLEANUP; } /* sum2 = 4 * arctan(1/239) */ if ((res = arctan(4, 239, ndigits, &sum2)) != MP_OKAY) { fprintf(stderr, "%s: arctan: %s\n", argv[0], mp_strerror(res)); out = 1; goto CLEANUP; } /* pi = sum1 - sum2 */ if ((res = mp_sub(&sum1, &sum2, &sum1)) != MP_OKAY) { fprintf(stderr, "%s: mp_sub: %s\n", argv[0], mp_strerror(res)); out = 1; goto CLEANUP; } stop = clock(); /* Write the output in decimal */ { char *buf = malloc(mp_radix_size(&sum1, 10)); if (buf == NULL) { fprintf(stderr, "%s: out of memory\n", argv[0]); out = 1; goto CLEANUP; } mp_todecimal(&sum1, buf); printf("%s\n", buf); free(buf); } fprintf(stderr, "Computation took %.2f sec.\n", (double)(stop - start) / CLOCKS_PER_SEC); CLEANUP: mp_clear(&sum1); mp_clear(&sum2); return out; } /* Compute sum := mul * arctan(1/x), to 'prec' digits of precision */ mp_err arctan(mp_digit mul, mp_digit x, mp_digit prec, mp_int *sum) { mp_int t, v; mp_digit q = 1, rd; mp_err res; int sign = 1; prec += 3; /* push inaccuracies off the end */ mp_init(&t); mp_set(&t, 10); mp_init(&v); if ((res = mp_expt_d(&t, prec, &t)) != MP_OKAY || /* get 10^prec */ (res = mp_mul_d(&t, mul, &t)) != MP_OKAY || /* ... times mul */ (res = mp_mul_d(&t, x, &t)) != MP_OKAY) /* ... times x */ goto CLEANUP; /* The extra multiplication by x in the above takes care of what would otherwise have to be a special case for 1 / x^1 during the first loop iteration. A little sneaky, but effective. We compute arctan(1/x) by the formula: 1 1 1 1 - - ----- + ----- - ----- + ... x 3 x^3 5 x^5 7 x^7 We multiply through by 'mul' beforehand, which gives us a couple more iterations and more precision */ x *= x; /* works as long as x < sqrt(RADIX), which it is here */ mp_zero(sum); do { if ((res = mp_div_d(&t, x, &t, &rd)) != MP_OKAY) goto CLEANUP; if (sign < 0 && rd != 0) mp_add_d(&t, 1, &t); if ((res = mp_div_d(&t, q, &v, &rd)) != MP_OKAY) goto CLEANUP; if (sign < 0 && rd != 0) mp_add_d(&v, 1, &v); if (sign > 0) res = mp_add(sum, &v, sum); else res = mp_sub(sum, &v, sum); if (res != MP_OKAY) goto CLEANUP; sign *= -1; q += 2; } while (mp_cmp_z(&t) != 0); /* Chop off inaccurate low-order digits */ mp_div_d(sum, 1000, sum, NULL); CLEANUP: mp_clear(&v); mp_clear(&t); return res; } /*------------------------------------------------------------------------*/ /* HERE THERE BE DRAGONS */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsCP1253ToUnicode_h___ #define nsCP1253ToUnicode_h___ #include "nsISupports.h" /** * A character set converter from CP1253 to Unicode. * * @created 20/Apr/1999 * @author Catalin Rotaru [CATA] */ NS_METHOD nsCP1253ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult); #endif /* nsCP1253ToUnicode_h___ */
/* * File: main.c * Author: Mike Peters * * Created on November 5, 2014, 12:11 PM */ #include <stdio.h> #include <stdlib.h> #include <p24Hxxxx.h> //#include <libpic30.h> #include "inc/comms.h" #include "inc/globals.h" #include "inc/chip_setup.h" /* * Words of Power */ _FBS(BWRP_WRPROTECT_OFF & BSS_NO_BOOT_CODE & RBS_NO_BOOT_RAM ) _FSS(SWRP_WRPROTECT_OFF & SSS_NO_SEC_CODE & RSS_NO_SEC_RAM ) _FGS(GWRP_OFF & GCP_OFF) _FOSCSEL( FNOSC_FRC & IESO_OFF) _FOSC(OSCIOFNC_ON & POSCMD_NONE & FCKSM_CSECMD) _FWDT( WDTPOST_PS8192 & WDTPRE_PR32 & WINDIS_OFF & FWDTEN_OFF) _FPOR( FPWRT_PWR128) _FICD( ICS_PGD1 & JTAGEN_OFF) int main(int argc, char** argv) { void Ludacris_Speed(void); //Make chip go fast Ludacris_Speed(); InitGlobals(); Setup_GO(); SystemsTest(); //printf("Ready\n"); while(1) { // __delay_ms(1000); // LATBbits.LATB5 ^= 1; //Nop(); if(COMMANDRCD == 1) { //printf("Processing Command\r\n"); Process_CMD(); } if (LEVELCHANGED == 1) { ReportLevelChanged(); } } return (EXIT_SUCCESS); } inline void Ludacris_Speed() { //This code from Microchip Family Ref. 39 Oscillator(Part III) //Configure PLL prescaler, PLL postscaler, PLL divisor PLLFBD = 41; // M = 43 CLKDIVbits.PLLPOST = 0; // N2 = 2 CLKDIVbits.PLLPRE = 0; // N1 = 2 // Initiate Clock Switch to Internal FRC with PLL (NOSC = 0b001) __builtin_write_OSCCONH(0x01); __builtin_write_OSCCONL(0x01); // Wait for Clock switch to occur while (OSCCONbits.COSC != 0b001); // Wait for PLL to lock while(OSCCONbits.LOCK != 1) {}; return; }
/* 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/. */ /* Authors: Michael Berg <michael.berg@zalf.de> //taken from https://gcc.gnu.org/wiki/Visibility Maintainers: Currently maintained by the authors. This file is part of the util library used by models created at the Institute of Landscape Systems Analysis at the ZALF. Copyright (C) Leibniz Centre for Agricultural Landscape Research (ZALF) */ #ifndef DLL_EXPORTS_H #define DLL_EXPORTS_H // Generic helper definitions for shared library support #if defined _WIN32 || defined __CYGWIN__ #define HELPER_DLL_IMPORT __declspec(dllimport) #define HELPER_DLL_EXPORT __declspec(dllexport) #define HELPER_DLL_LOCAL #else #if __GNUC__ >= 4 #define HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) #define HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #define HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden"))) #else #define HELPER_DLL_IMPORT #define HELPER_DLL_EXPORT #define HELPER_DLL_LOCAL #endif #endif // Now we use the generic helper definitions above to define DLL_API and DLL_LOCAL. // DLL_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build) // DLL_LOCAL is used for non-api symbols. #ifdef USE_DLL // defined if code is compiled as a DLL #ifdef DLL_EXPORTS // defined if we are building the DLL (instead of using it) #define DLL_API HELPER_DLL_EXPORT #else #define DLL_API HELPER_DLL_IMPORT #endif // DLL_EXPORTS #define DLL_LOCAL HELPER_DLL_LOCAL #else // MONICA_DLL is not defined: this means code is a static lib. #define DLL_API #define DLL_LOCAL #endif // USE_DLL #endif // DLL_EXPORTS_H