text
stringlengths
4
6.14k
/****************************************************************************** * Spine Runtimes Software License * Version 2.3 * * Copyright (c) 2013-2015, Esoteric Software * All rights reserved. * * You are granted a perpetual, non-exclusive, non-sublicensable and * non-transferable license to use, install, execute and perform the Spine * Runtimes Software (the "Software") and derivative works solely for personal * or internal use. Without the written permission of Esoteric Software (see * Section 2 of the Spine Software License Agreement), you may not (a) modify, * translate, adapt or otherwise create derivative works, improvements of the * Software or develop new applications using the Software or (b) remove, * delete, alter or obscure any trademarks or any copyright, trademark, patent * or other intellectual property or proprietary rights notices on or in the * Software, including any copy thereof. Redistributions in binary or source * form must include this license and terms. * * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ #include <spine/Attachment.h> #include <spine/extension.h> #include <spine/Slot.h> typedef struct _spAttachmentVtable { void (*dispose) (spAttachment* self); } _spAttachmentVtable; void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType type, /**/ void (*dispose) (spAttachment* self)) { CONST_CAST(_spAttachmentVtable*, self->vtable) = NEW(_spAttachmentVtable); VTABLE(spAttachment, self) ->dispose = dispose; MALLOC_STR(self->name, name); CONST_CAST(spAttachmentType, self->type) = type; } void _spAttachment_deinit (spAttachment* self) { FREE(self->vtable); FREE(self->name); } void spAttachment_dispose (spAttachment* self) { VTABLE(spAttachment, self) ->dispose(self); }
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers /***************************************************************************** * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * OpenRCT2 is the work of many authors, a full list can be found in contributors.md * For more information, visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 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. * * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion #pragma once #include "../common.h" extern "C" { #include "../scenario.h" #include "../object_list.h" } /** * Class to export RollerCoaster Tycoon 2 scenarios (*.SC6) and saved games (*.SV6). */ class S6Exporter { public: bool ExportObjects; bool RemoveTracklessRides; S6Exporter(); void SaveGame(const utf8 * path); void SaveGame(SDL_RWops *rw); void SaveScenario(const utf8 * path); void SaveScenario(SDL_RWops *rw); void Export(); private: rct_s6_data _s6; void Save(SDL_RWops *rw, bool isScenario); };
/* * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com * Copyright (C) 2009-2019 EiskaltDC++ developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ #pragma once #if defined(__GNUC__) && !defined(__clang__) #if (__GNUC__ < 5) || (__GNUC__ == 5 && __GNUC_MINOR__ < 2) #error GCC 5.2 is required #endif #elif defined(__clang__) #if (__clang_major__ < 3) || (__clang_major__ == 3 && __clang_minor__ < 5) #error Clang 3.5 is required #endif #elif defined(_MSC_VER) #if _MSC_VER < 1800 || _MSC_FULL_VER < 180021114 #error Visual Studio 2013 with the Nov 2013 CTP is required #endif //disable the deprecated warnings for the CRT functions. #define _CRT_SECURE_NO_DEPRECATE 1 #define _ATL_SECURE_NO_DEPRECATE 1 #define _CRT_NON_CONFORMING_SWPRINTFS 1 #define strtoll _strtoi64 #else #error No supported compiler found #endif #if defined(_MSC_VER) #define _LL(x) x##ll #define _ULL(x) x##ull #define I64_FMT "%I64d" #define U64_FMT "%I64u" #elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8 #define _LL(x) x##l #define _ULL(x) x##ul #define I64_FMT "%ld" #define U64_FMT "%lu" #else #define _LL(x) x##ll #define _ULL(x) x##ull #define I64_FMT "%lld" #define U64_FMT "%llu" #endif #ifndef _REENTRANT # define _REENTRANT 1 #endif
#include"hpmmath.h" #include<limits.h> #include<time.h> # ifdef HPM_VC # include<intrin.h> # elif defined(HPM_GNUC) || defined(HPM_CLANG) # if defined(HPM_X86) || defined(HPM_X86_64) # include<x86intrin.h> # endif # endif HPM_IMP(void, hpm_vec4_randomfv, hpmvec4f* out){ unsigned int p; int result; const int n = 4; register int i; srand(time(NULL)); /* Iterate through each element. */ for (i = 0; i < n; i++) (*out)[i] = (hpmvecf) rand() / (hpmvecf) UINT_MAX; /* do{ result = _rdrand32_step(&p); if(result){ (*out)[i] = (hpmvecf)p / (hpmvecf)UINT_MAX; i++; } }while(i < n); */ } HPM_IMP(void, hpm_vec8_randomfv, hpmvec8f* out){ unsigned int p; int result; const int n = 8; register int i; srand(time(NULL)); /* Iterate through each element. */ for (i = 0; i < n; i++) (*out)[i] = (hpmvecf) rand() / (hpmvecf) UINT_MAX; /* do{ result = _rdrand32_step(&p); if(result){ (*out)[i] = (hpmvecf)p / (hpmvecf)UINT_MAX; i++; } }while(i < n); */ }
#pragma once #include "cocos2d.h" #include "cocos-ext.h" #include "string.h" #include "LoginScene.h" #include "PopLayer.h" #include "client.h" using namespace std; USING_NS_CC; USING_NS_CC_EXT; class TestLayer : public CCLayer, public EditBoxDelegate { public: TestLayer(void); ~TestLayer(void); static cocos2d::Scene* createScene(); CREATE_FUNC(TestLayer); virtual bool init(); EditBox* uEditBox; EditBox* pEditBox; void editBoxEditingDidBegin(EditBox *editBox); void editBoxEditingDidEnd(EditBox *editBox); void editBoxReturn(EditBox *editBox); void editBoxTextChanged(EditBox *editBox, const std::string &text); void btncallback1(CCObject* pSender); void btncallback2(CCObject* pSender); };
/* # Copyright (C) 2010-2011 DarkmoonCore <http://www.darkmooncore.org/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DEF_THE_STONECORE_H #define DEF_THE_STONECORE_H enum Data { DATA_CORBORUS_EVENT, DATA_SLABHIDE_EVENT, DATA_OZRUK_EVENT, DATA_HIGH_PRIESTESS_AZIL_EVENT, DATA_TEAM_IN_INSTANCE, }; enum Data64 { DATA_CORBORUS, DATA_SLABHIDE, DATA_OZRUK, DATA_HIGH_PRIESTESS_AZIL, }; enum CreatureIds { // Dungeon Bosses BOSS_CORBORUS = 43438, BOSS_SLABHIDE = 43214, BOSS_OZRUK = 42188, BOSS_HIGH_PRIESTESS_AZIL = 42333, // Trash mobs NPC_CRYSTALSPAWN_GIANT = 42810, NPC_IMP = 43014, NPC_MILLHOUSE_MANASTORM = 43391, NPC_ROCK_BORER = 43917, NPC_ROCK_BORER2 = 42845, NPC_STONECORE_BERSERKER = 43430, NPC_STONECORE_BRUISER = 42692, NPC_STONECORE_EARTHSHAPER = 43537, NPC_STONECORE_FLAYER = 42808, NPC_MAGMALORD = 42789, NPC_RIFT_CONJURER = 42691, NPC_STONECORE_SENTRY = 42695, NPC_STONECORE_WARBRINGER = 42696, // Various NPCs NPC_EARTHWARDEN_YRSA = 50048, NPC_STONECORE_TELEPORTER1 = 51396, NPC_STONECORE_TELEPORTER2 = 51397, }; enum GameObjectIds { GO_BROKEN_PILLAR = 207407, GO_TWILIGHT_DOCUMENTS = 207415, }; #endif
/*! * \file galileo_e1_tcp_connector_tracking_cc.h * \brief Interface of a TCP connector block based on code DLL + carrier PLL VEML (Very Early * Minus Late) tracking block for Galileo E1 signals * \author David Pubill, 2012. dpubill(at)cttc.es * Luis Esteve, 2012. luis(at)epsilon-formacion.com * Javier Arribas, 2011. jarribas(at)cttc.es * * Code DLL + carrier PLL according to the algorithms described in: * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, * A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, * Birkhauser, 2007 * * ------------------------------------------------------------------------- * * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver * * This file is part of GNSS-SDR. * * GNSS-SDR 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. * * GNSS-SDR 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 GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. * * ------------------------------------------------------------------------- */ #ifndef GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_CC_H #define GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_CC_H #include <fstream> #include <map> #include <string> #include <gnuradio/block.h> #include <volk/volk.h> #include "gnss_synchro.h" #include "cpu_multicorrelator.h" #include "tcp_communication.h" class Galileo_E1_Tcp_Connector_Tracking_cc; typedef boost::shared_ptr<Galileo_E1_Tcp_Connector_Tracking_cc> galileo_e1_tcp_connector_tracking_cc_sptr; galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, float very_early_late_space_chips, size_t port_ch0); /*! * \brief This class implements a code DLL + carrier PLL VEML (Very Early * Minus Late) tracking block for Galileo E1 signals */ class Galileo_E1_Tcp_Connector_Tracking_cc : public gr::block { public: ~Galileo_E1_Tcp_Connector_Tracking_cc(); void set_channel(uint32_t channel); void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro); void start_tracking(); int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); void forecast(int noutput_items, gr_vector_int &ninput_items_required); private: friend galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, float very_early_late_space_chips, size_t port_ch0); Galileo_E1_Tcp_Connector_Tracking_cc( int64_t fs_in, uint32_t vector_length, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, float very_early_late_space_chips, size_t port_ch0); void update_local_code(); void update_local_carrier(); // tracking configuration vars uint32_t d_vector_length; bool d_dump; Gnss_Synchro *d_acquisition_gnss_synchro; uint32_t d_channel; int64_t d_fs_in; int32_t d_correlation_length_samples; int32_t d_n_correlator_taps; float d_early_late_spc_chips; float d_very_early_late_spc_chips; gr_complex *d_ca_code; gr_complex *d_Very_Early; gr_complex *d_Early; gr_complex *d_Prompt; gr_complex *d_Late; gr_complex *d_Very_Late; // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; float d_next_rem_code_phase_samples; float d_rem_carr_phase_rad; // acquisition float d_acq_code_phase_samples; float d_acq_carrier_doppler_hz; // correlator float *d_local_code_shift_chips; gr_complex *d_correlator_outs; cpu_multicorrelator multicorrelator_cpu; // tracking vars double d_code_freq_chips; float d_carrier_doppler_hz; float d_acc_carrier_phase_rad; float d_acc_code_phase_secs; float d_code_phase_samples; size_t d_port_ch0; size_t d_port; int32_t d_listen_connection; float d_control_id; tcp_communication d_tcp_com; //PRN period in samples int32_t d_current_prn_length_samples; int32_t d_next_prn_length_samples; //processing samples counters uint64_t d_sample_counter; uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int32_t d_cn0_estimation_counter; gr_complex *d_Prompt_buffer; float d_carrier_lock_test; float d_CN0_SNV_dB_Hz; float d_carrier_lock_threshold; int32_t d_carrier_lock_fail_counter; // control vars bool d_enable_tracking; bool d_pull_in; // file dump std::string d_dump_filename; std::ofstream d_dump_file; std::map<std::string, std::string> systemName; std::string sys; }; #endif //GNSS_SDR_GALILEO_E1_TCP_CONNECTOR_TRACKING_CC_H
// #define __LOG_ON 1 // std #include <type.h> #include <dbg.h> // libs #include <printk.h> #include <string.h> // fs #include <minix.h> #include <inode.h> #include <dir.h> #include <p2i.h> #include <stat.h> // proc #include <proc.h> /* 抽取路径中的第一个名字, 返回余下部分 * skip the first elem of path, return this elem * - skipelem("a/b/c", name) = "b/c" name = a * - skipelem("////a//c", name) = "c" name = a * - skipelem("///", name) = 0 */ char *skipelem(char *path, char *name){ char *ns; int nlen; while (*path == '/'){ path++; } if (*path == '\0'){ return 0; } ns = path; while (*path != '/' && *path != '\0'){ path++; } nlen = path - ns; if (nlen >= NAME_LEN){ strncpy(name, ns, NAME_LEN); } else { strncpy(name, ns, nlen); name[nlen] = 0; } while (*path == '/'){ path++; } // printl("skipelem: name: %s, path: %s\n", name, path); return path; } static struct inode *_path2inode(char *path, int parent, char *name){ struct inode *ip, *next; ip = 0; if (*path == '/'){ ip = iget(ROOT_DEV, ROOT_INO); } else { ip = idup(proc->cwd); } /* NB: 这里是检测 path 的地址而非 值 */ while ((path = skipelem(path, name)) != 0){ /* read from disk */ ilock(ip); //print_i(ip); if (!S_ISDIR(ip->mode)){ iunlockput(ip); return 0; } if (parent && *path == '\0'){ iunlock(ip); return ip; } if ((next = dir_lookup(ip, name, 0)) == 0){ iunlockput(ip); return 0; } iunlockput(ip); ip = next; } if (parent){ iput(ip); return 0; } return ip; } struct inode *p2i(char *path){ char name[NAME_LEN]; return _path2inode(path, 0, name); } struct inode *p2ip(char *path, char *name){ return _path2inode(path, 1, name); }
/* * charset.h * Contains functions for working with character sets specific to Cryption * Created by Andrew Davis * Created on 3/11/2016 * Open source (GPL license) */ //disallow reinclusion #ifndef CHAR_INC_H #define CHAR_INC_H //include the log functions #include "log.h" //include the ELEMS macro #include "constants.h" //include true/false #include <stdbool.h> //this array holds the actual character set char set[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',',','.','!','?',' '}; //function prototypes //this function returns the size of the character set int charset_size(); //this function looks up a given character and returns its index. Returns -1 if character not in set. int char_index(char c); //this function looks up a character from an index and returns it. Will return -1 if index out of range. char lookup_char(int index); //this function returns true if its argument is in the character set, false if not bool charset_contains(char c); #endif
// This file was generated based on /usr/local/share/uno/Packages/Fuse.Nodes/1.3.1/Input/PointerEvents.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Input.PointerEventArgs.h> #include <Fuse.Scripting.IScriptEvent.h> namespace g{namespace Fuse{namespace Input{struct PointerEventData;}}} namespace g{namespace Fuse{namespace Input{struct PointerReleasedArgs;}}} namespace g{namespace Fuse{struct Visual;}} namespace g{ namespace Fuse{ namespace Input{ // public sealed class PointerReleasedArgs :55 // { ::g::Fuse::VisualEventArgs_type* PointerReleasedArgs_typeof(); void PointerReleasedArgs__ctor_3_fn(PointerReleasedArgs* __this, ::g::Fuse::Input::PointerEventData* data, ::g::Fuse::Visual* visual); void PointerReleasedArgs__New3_fn(::g::Fuse::Input::PointerEventData* data, ::g::Fuse::Visual* visual, PointerReleasedArgs** __retval); struct PointerReleasedArgs : ::g::Fuse::Input::PointerEventArgs { void ctor_3(::g::Fuse::Input::PointerEventData* data, ::g::Fuse::Visual* visual); static PointerReleasedArgs* New3(::g::Fuse::Input::PointerEventData* data, ::g::Fuse::Visual* visual); }; // } }}} // ::g::Fuse::Input
/* * Copyright (C) 2010 Marco Dalla Via (maek@paranoici.org) * * This file is part of Spring2D. * * Spring2D is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Spring2D 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 Public License for more details. * * You should have received a copy of the GNU Lesser Public License * along with Spring2D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __CONSTRAINTS_REGISTER_H__ #define __CONSTRAINTS_REGISTER_H__ #include "s2Settings.h" #include "s2Body.h" namespace Spring2D { // --------------------------------------------------------------------------- // A constraint class Constraint { public: Body* body[2]; Vector2 point[2]; Real length; bool cable; public: // Constructor Constraint ( Body* BODY1, const Vector2& POINT1, Body* BODY2, const Vector2& POINT2, const Real LENGTH, const bool CABLE) : length(LENGTH), cable(CABLE) { body[0] = BODY1; body[1] = BODY2; point[0] = POINT1; point[1] = POINT2; } }; // --------------------------------------------------------------------------- // The constraint list typedef std::list<Constraint*> ConstraintsList; // --------------------------------------------------------------------------- // The constraints register class ConstraintsRegister { public: // Destructor ~ConstraintsRegister () { constraintsList_.clear(); } // Register the given constraint bool registerConstraint (Constraint* CONSTRAINT) { constraintsList_.push_back(CONSTRAINT); return true; } // Unregister the given constraint bool unregisterConstraint (Constraint* CONSTRAINT) { for (ConstraintsList::iterator constraintsListI = constraintsList_.begin(); constraintsListI != constraintsList_.end(); ++constraintsListI) { // If the constraint is in the register if ((*constraintsListI) == CONSTRAINT) { constraintsList_.erase(constraintsListI); return true; } } // If the constraint is not in the register return false; } // Return the constraints list ConstraintsList* getConstraints () { return &constraintsList_; } private: ConstraintsList constraintsList_; }; } #endif // __CONSTRAINTS_REGISTER_H__
/***************************************************************************** * Copyright (C) 2004-2009 The PaGMO development team, * * Advanced Concepts Team (ACT), European Space Agency (ESA) * * http://apps.sourceforge.net/mediawiki/pagmo * * http://apps.sourceforge.net/mediawiki/pagmo/index.php?title=Developers * * http://apps.sourceforge.net/mediawiki/pagmo/index.php?title=Credits * * act@esa.int * * * * 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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *****************************************************************************/ // 13/02/2008: Initial version by Francesco Biscani. #ifndef PYGMO_UTILS_H #define PYGMO_UTILS_H #include <Python.h> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/serialization.hpp> #include <boost/python/class.hpp> #include <boost/python/dict.hpp> #include <boost/python/docstring_options.hpp> #include <boost/python/extract.hpp> #include <boost/python/tuple.hpp> #include <csignal> #include <sstream> #include <string> #include "exceptions.h" template <class T> inline T Py_copy_from_ctor(const T &x) { return T(x); } template <class T> inline T Py_deepcopy_from_ctor(const T &x, boost::python::dict) { return T(x); } // Serialization for python wrapper. namespace boost { namespace serialization { template <class Archive, class T> void serialize(Archive &, boost::python::wrapper<T> &, const unsigned int) {} }} // Generic pickle suite for C++ classes with default constructor. template <class T> struct generic_pickle_suite : boost::python::pickle_suite { static boost::python::tuple getinitargs(const T &) { return boost::python::make_tuple(); } static boost::python::tuple getstate(const T &x) { std::stringstream ss; boost::archive::text_oarchive oa(ss); oa << x; return boost::python::make_tuple(ss.str()); } static void setstate(T &x, boost::python::tuple state) { using namespace boost::python; if (len(state) != 1) { PyErr_SetObject(PyExc_ValueError,("expected 1-item tuple in call to __setstate__; got %s" % state).ptr()); throw_error_already_set(); } const std::string str = extract<std::string>(state[0]); std::stringstream ss(str); boost::archive::text_iarchive ia(ss); ia >> x; } }; // Generic pickle suite for C++ classes with default constructor extensible from Python. // Difference from above is that we need to take care of handling the derived class' dict. template <class T> struct python_class_pickle_suite: boost::python::pickle_suite { static boost::python::tuple getinitargs(const T &) { return boost::python::make_tuple(); } static boost::python::tuple getstate(boost::python::object obj) { T const &x = boost::python::extract<T const &>(obj)(); std::stringstream ss; boost::archive::text_oarchive oa(ss); oa << x; return boost::python::make_tuple(obj.attr("__dict__"),ss.str()); } static void setstate(boost::python::object obj, boost::python::tuple state) { using namespace boost::python; T &x = extract<T &>(obj)(); if (len(state) != 2) { PyErr_SetObject(PyExc_ValueError,("expected 2-item tuple in call to __setstate__; got %s" % state).ptr()); throw_error_already_set(); } // Restore the object's __dict__. dict d = extract<dict>(obj.attr("__dict__"))(); d.update(state[0]); // Restore the internal state of the C++ object. const std::string str = extract<std::string>(state[1]); std::stringstream ss(str); boost::archive::text_iarchive ia(ss); ia >> x; } static bool getstate_manages_dict() { return true; } }; template <class T> inline void py_cpp_loads(T &x, const std::string &s) { std::stringstream ss(s); boost::archive::text_iarchive ia(ss); ia >> x; } template <class T> inline std::string py_cpp_dumps(const T &x) { std::stringstream ss; boost::archive::text_oarchive oa(ss); oa << x; return ss.str(); } #define common_module_init() \ /* Initialise Python thread support. */ \ PyEval_InitThreads(); \ /* Translate exceptions for this module. */ \ translate_exceptions(); \ /* Disable docstring C++ signature. */ \ boost::python::docstring_options doc_options; \ doc_options.disable_cpp_signatures(); #endif
/* Copyright (C) 2010 Erik Hjortsberg <erik.hjortsberg@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef ENTEREDWORLDSTATE_H_ #define ENTEREDWORLDSTATE_H_ #include "StateBase.h" #include "ConnectedAdapter.h" #include "framework/ConsoleCommandWrapper.h" #include "framework/ConsoleObject.h" #include <Atlas/Objects/ObjectsFwd.h> #include <Atlas/Message/Element.h> #include <wfmath/vector.h> #include <wfmath/point.h> namespace WFMath { class Quaternion; } namespace Eris { class Avatar; class Account; class View; class Connection; class Entity; class TransferInfo; } namespace Ember { class TeleportRequestedState; /** * @brief State for when the user has entered into the world. For most cases this is the desired state. */ class EnteredWorldState: public virtual StateBase<void>, public ConsoleObject { public: EnteredWorldState(IState& parentState, Eris::Avatar& avatar, Eris::Account& account); virtual ~EnteredWorldState(); void runCommand(const std::string &, const std::string &); virtual IServerAdapter& getServerAdapter(); virtual bool logout(); const Ember::ConsoleCommandWrapper Say; const Ember::ConsoleCommandWrapper Emote; const Ember::ConsoleCommandWrapper Delete; const Ember::ConsoleCommandWrapper AdminTell; private: /** * @brief Holds the current avatar. */ Eris::Avatar& mAvatar; /** * @brief Holds the account object we are connected with. */ Eris::Account& mAccount; ConnectedAdapter mAdapter; Eris::Connection& getConnection() const; Eris::View& getView() const; }; } #endif /* ENTEREDWORLDSTATE_H_ */
/* This file is part of Cute Chess. Cute Chess 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. Cute Chess 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 Cute Chess. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ENGINECONFIGPROXYMODEL_H #define ENGINECONFIGPROXYMODEL_H #include <QSortFilterProxyModel> /*! * \brief A proxy model for sorting and filtering engine configurations. * * In addition to QSortFilterProxyModel's functionality, * EngineConfigurationProxyModel can filter engines based on their * features, eg. the chess variants they support. This is useful when * setting up games or tournaments. */ class EngineConfigurationProxyModel : public QSortFilterProxyModel { Q_OBJECT public: /*! Creates a new EngineConfigurationProxyModel. */ explicit EngineConfigurationProxyModel(QObject *parent = 0); /*! * Sets the chess variant used to filter the contents * of the source model to \a variant. */ void setFilterVariant(const QString& variant); protected: // Reimplemented from QSortFilterProxyModel virtual bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const; private: QString m_filterVariant; }; #endif // ENGINECONFIGPROXYMODEL_H
/* fuse_xattrs - Add xattrs support using sidecar files Copyright (C) 2016 Felipe Barriga Richards <felipe {at} felipebarriga.cl> Based on passthrough.c (libfuse example) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include <fuse.h> int xmp_getattr(const char *path, struct stat *stbuf); int xmp_access(const char *path, int mask); int xmp_readlink(const char *path, char *buf, size_t size); int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi); int xmp_mknod(const char *path, mode_t mode, dev_t rdev); int xmp_mkdir(const char *path, mode_t mode); int xmp_unlink(const char *path); int xmp_rmdir(const char *path); int xmp_symlink(const char *from, const char *to); int xmp_rename(const char *from, const char *to); int xmp_link(const char *from, const char *to); int xmp_chmod(const char *path, mode_t mode); int xmp_chown(const char *path, uid_t uid, gid_t gid); int xmp_truncate(const char *path, off_t size); int xmp_utimens(const char *path, const struct timespec ts[2]); int xmp_open(const char *path, struct fuse_file_info *fi); int xmp_create(const char *path, mode_t mode, struct fuse_file_info *fi); int xmp_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi); int xmp_write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi); int xmp_statfs(const char *path, struct statvfs *stbuf); int xmp_release(const char *path, struct fuse_file_info *fi); int xmp_fsync(const char *path, int isdatasync, struct fuse_file_info *fi); int xmp_fallocate(const char *path, int mode, off_t offset, off_t length, struct fuse_file_info *fi);
// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright (C) 2013 James Haley et al. // // 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/ // //-------------------------------------------------------------------------- // // DESCRIPTION: // Savegame I/O, archiving, persistence. // //----------------------------------------------------------------------------- #ifndef __P_SAVEG__ #define __P_SAVEG__ // Persistent storage/archiving. // These are the load / save game routines. class Thinker; class Mobj; class OutBuffer; class InBuffer; struct inventoryslot_t; struct spectransfer_t; struct mapthing_t; struct sector_t; struct line_t; class SaveArchive { protected: OutBuffer *savefile; // valid when saving InBuffer *loadfile; // valid when loading public: SaveArchive(OutBuffer *pSaveFile); SaveArchive(InBuffer *pLoadFile); // Accessors bool isSaving() const { return (savefile != NULL); } bool isLoading() const { return (loadfile != NULL); } OutBuffer *getSaveFile() { return savefile; } InBuffer *getLoadFile() { return loadfile; } // Methods void ArchiveCString(char *str, size_t maxLen); void ArchiveLString(char *&str, size_t &len); // WriteLString is valid during saving only. This is to accomodate const // char *'s which must be saved, and are read into temporary buffers // during loading. void WriteLString(const char *str, size_t len = 0); // Operators // Similar to ZDoom's FArchive class, these are symmetric - they are used // both for reading and writing. // Basic types: SaveArchive &operator << (int32_t &x); SaveArchive &operator << (uint32_t &x); SaveArchive &operator << (int16_t &x); SaveArchive &operator << (uint16_t &x); SaveArchive &operator << (int8_t &x); SaveArchive &operator << (uint8_t &x); SaveArchive &operator << (bool &x); SaveArchive &operator << (float &x); SaveArchive &operator << (double &x); // Pointers: SaveArchive &operator << (sector_t *&s); SaveArchive &operator << (line_t *&ln); // Structures: SaveArchive &operator << (spectransfer_t &st); SaveArchive &operator << (mapthing_t &mt); SaveArchive &operator << (inventoryslot_t &slot); }; // Global template functions for SaveArchive // // P_ArchiveArray // // Archives an array. The base element of the array must have an // operator << overload for SaveArchive. // template <typename T> void P_ArchiveArray(SaveArchive &arc, T *ptrArray, int numElements) { for(int i = 0; i < numElements; i++) arc << ptrArray[i]; } // haleyjd: These utilities are now needed for external serialization support // in Thinker-derived classes. unsigned int P_NumForThinker(Thinker *th); Thinker *P_ThinkerForNum(unsigned int n); void P_SetNewTarget(Mobj **mop, Mobj *targ); void P_SaveCurrentLevel(char *filename, char *description); void P_LoadGame(const char *filename); #endif //---------------------------------------------------------------------------- // // $Log: p_saveg.h,v $ // Revision 1.5 1998/05/03 23:10:40 killough // beautification // // Revision 1.4 1998/02/23 04:50:09 killough // Add automap marks and properties to saved state // // Revision 1.3 1998/02/17 06:26:04 killough // Remove unnecessary plat archive/unarchive funcs // // Revision 1.2 1998/01/26 19:27:26 phares // First rev with no ^Ms // // Revision 1.1.1.1 1998/01/19 14:03:06 rand // Lee's Jan 19 sources // //----------------------------------------------------------------------------
#ifndef CALENDARDIALOG_H #define CALENDARDIALOG_H #include <QDialog> #include <QDate> #include "export.h" namespace Ui { class calendarDialog; } class IMPWIDGETSLIB_EXPORT calendarDialog : public QDialog { Q_OBJECT public: explicit calendarDialog(QWidget *parent = 0); ~calendarDialog(); QDate getCurrentDate(); void setCurrentDate(QDate date); private slots: void on_calendarWidget_clicked(const QDate &date); void on_pushButton_clicked(); private: Ui::calendarDialog *ui; QDate currentDate; }; #endif // CALENDARDIALOG_H
/* * Empire - A multi-player, client/server Internet based war game. * Copyright (C) 1986-2017, Dave Pare, Jeff Bailey, Thomas Ruschak, * Ken Stevens, Steve McClure, Markus Armbruster * * Empire 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/>. * * --- * * See files README, COPYING and CREDITS in the root of the source * tree for related information and legal notices. It is expected * that future projects/authors will amend these files as needed. * * --- * * show.c: Give info on empire objects, planes, boats, nukes, etc. * * Known contributors to this file: * Julian Onions, 1988 * Steve McClure, 1997 */ #include <config.h> #include "commands.h" #include "nuke.h" #include "optlist.h" int show(void) { char *p; void (*cfunc)(int); void (*sfunc)(int); void (*bfunc)(int); struct natstr *natp; int tlev; char buf[1024]; int rlev; again: p = getstarg(player->argp[1], "Show what ('?' to list options)? ", buf); if (!p || !*p) return RET_SYN; if (*p == '?') { pr("bridge, item, land, news, nuke, plane, sect, ship, product, tower, updates\n"); goto again; } natp = getnatp(player->cnum); rlev = (int)(1.25 * natp->nat_level[NAT_RLEV]); if (!player->argp[3]) { tlev = (int)(1.25 * natp->nat_level[NAT_TLEV]); if (player->god) tlev = 1000; } else { tlev = (int)atoi(player->argp[3]); if (tlev > (int)(1.25 * natp->nat_level[NAT_TLEV]) && !player->god) tlev = (int)(1.25 * natp->nat_level[NAT_TLEV]); } if (player->god) rlev = 1000; switch (*p) { case 'b': show_bridge(99999); return RET_OK; case 't': show_tower(99999); return RET_OK; case 'i': show_item(99999); return RET_OK; case 'n': if (*(p + 1) == 'e') { show_news(99999); return RET_OK; } if (drnuke_const > MIN_DRNUKE_CONST) tlev = ((rlev / drnuke_const) > tlev ? tlev : (rlev / drnuke_const)); bfunc = show_nuke_build; cfunc = show_nuke_capab; sfunc = show_nuke_stats; break; case 'l': bfunc = show_land_build; sfunc = show_land_stats; cfunc = show_land_capab; break; case 'p': if (p[1] == 'r') { show_product(99999); return RET_OK; } bfunc = show_plane_build; sfunc = show_plane_stats; cfunc = show_plane_capab; break; case 's': if (*(p + 1) == 'e') { bfunc = show_sect_build; sfunc = show_sect_stats; cfunc = show_sect_capab; } else { bfunc = show_ship_build; sfunc = show_ship_stats; cfunc = show_ship_capab; } break; case 'u': show_updates(player->argp[2] ? atoi(player->argp[2]) : 8); return RET_OK; default: return RET_SYN; } p = getstarg(player->argp[2], "Build, stats, or capability data (b,s,c)? ", buf); if (!p || !*p) return RET_SYN; pr("Printing for tech level '%d'\n", tlev); if (*p == 'B' || *p == 'b') bfunc(tlev); else if (*p == 'C' || *p == 'c') cfunc(tlev); else if (*p == 'S' || *p == 's') sfunc(tlev); else return RET_SYN; return RET_OK; }
#include <stdio.h> #include <math.h> /* * Let P be an n-vertex polygon of equal sides inside a circle of radius R. * * Let P = A(1)A(2) ... A(n) A(1) (A(i) is a vertex) * Let O be the center of a circle. * * area(P) = n * area(OA(1)A(2)) * * The angle A(1) O A(2) is 2 * pi / n in radian * * So area(O A(1) A(2) ) = 1/2 * R^2 * sin (A(1) O A(2)) * * So area(P) = 1/2 * n * R^2 * sin (2 * pi / n) */ #define PI 3.14159265359 double computeAreaEnclosedEqualSidePolygon(double radius, int numV); int main(void) { int numV; double radius; while(scanf("%lf %d", &radius, &numV) > 0) { printf("%.3lf\n", computeAreaEnclosedEqualSidePolygon(radius, numV)); } return 0; } double computeAreaEnclosedEqualSidePolygon(double radius, int numV) { return 0.5 * numV * radius * radius * sin(2 * PI / numV); }
// // Copyright 2010, Darren Lafreniere // <http://www.lafarren.com/image-completer/> // // This file is part of lafarren.com's Image Completer. // // Image Completer 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. // // Image Completer 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 Image Completer, named License.txt. If not, see // <http://www.gnu.org/licenses/>. // #ifndef IMAGE_FLOAT_H #define IMAGE_FLOAT_H #include "LfnIcImage.h" namespace LfnIc { class ImageConst; /// A set of float components, where each component is [0.0, 1.0]. class PixelFloat { public: static const int NUM_CHANNELS = Image::Pixel::NUM_CHANNELS; float channel[NUM_CHANNELS]; inline PixelFloat(); inline PixelFloat& operator=(const PixelFloat& other); inline PixelFloat& operator+=(const PixelFloat& other); inline PixelFloat& operator-=(const PixelFloat& other); inline PixelFloat& operator*=(float x); }; /// An RGB tuple of floats, where each component is [0.0, 1.0]. /// We need this class for some of the debug functions which write out colored (RGB) patches. class PixelFloatRGB { public: static const int NUM_CHANNELS = 3; float channel[3]; inline PixelFloatRGB(); inline PixelFloatRGB& operator=(const PixelFloatRGB& other); inline PixelFloatRGB& operator+=(const PixelFloatRGB& other); inline PixelFloatRGB& operator-=(const PixelFloatRGB& other); inline PixelFloatRGB& operator*=(float x); }; /// /// A grid of RgbFloat pixels. /// class ImageFloat { public: ImageFloat(); ImageFloat(const ImageConst& input); ImageFloat(int width, int height); ImageFloat(int width, int height, const PixelFloat& initialPixel); void Create(int width, int height); void CopyTo(ImageFloat& output) const; void CopyTo(Image& output) const; inline int GetWidth() const { return m_width; } inline int GetHeight() const { return m_height; } PixelFloat& GetPixel(int x, int y); const PixelFloat& GetPixel(int x, int y) const; void SetPixel(int x, int y, const PixelFloat& pixel); inline PixelFloat* GetData() { return &m_data[0]; } inline const PixelFloat* GetData() const { return &m_data[0]; } private: ImageFloat(const ImageFloat& other) {} ImageFloat& operator=(const ImageFloat& other) { return *this; } int m_width; int m_height; std::vector<PixelFloat> m_data; }; // Image::Rgb <=> RgbFloat conversions. inline void CopyRgbValue(PixelFloat& to, const Image::Pixel& from); inline void CopyRgbValue(Image::Pixel& to, const PixelFloat& from); } // // Include the inline implementations // #define INCLUDING_IMAGE_FLOAT_INL #include "ImageFloat.inl" #undef INCLUDING_IMAGE_FLOAT_INL #endif // IMAGE_FLOAT_H
#ifndef ATOM_H #define ATOM_H #include "math/vec3.h" class Atom { private: float m_mass; public: vec3 initialPosition; vec3 position; vec3 velocity; vec3 force; Atom(double mass); void resetForce(); void resetVelocityMaxwellian(double temperature); double mass() { return m_mass; } void setMass(double mass) { m_mass = mass; } double distance(Atom *otherAtom); }; #endif
/*=============================================================================== Copyright (c) 2016 PTC Inc. All Rights Reserved. Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. Vuforia is a trademark of PTC Inc., registered in the United States and other countries. ===============================================================================*/ #import <UIKit/UIKit.h> @class Vuforiautils; // OverlayViewController class overrides one UIViewController method @interface OverlayViewController : UIViewController <UIActionSheetDelegate> { @protected UIView *optionsOverlayView; // the view for the options pop-up UIActionSheet *mainOptionsAS; // the options menu NSInteger selectedTarget; // remember the selected target so we can mark it NSInteger selectTargetIx; // index of the option that is 'Select Target' NSInteger autofocusContIx; // index of camera continuous autofocus button NSInteger autofocusSingleIx; // index of single-shot autofocus button (not used on most samples) NSInteger flashIx; // index of camera flash button (not used on most samples) struct tagCameraCapabilities { BOOL autofocus; BOOL autofocusContinuous; BOOL torch; } cameraCapabilities; enum { MENU_OPTION_WANTED = -1, MENU_OPTION_UNWANTED = -2 }; Vuforiautils *vUtils; } - (void) handleViewRotation:(UIInterfaceOrientation)interfaceOrientation; - (void) showOverlay; - (void) populateActionSheet; + (BOOL) doesOverlayHaveContent; // UIActionSheetDelegate event handlers (accessible by subclasses) - (void) mainOptionClickedButtonAtIndex:(NSInteger)buttonIndex; @end
#ifndef _BUBBLESORT_H_ #define _BUBBLESORT_H_ #include "Arrange.h" #include <iostream> template <class T> class BubbleSort : public Arrange<T> { public: // BubbleSort(void); // ~BubbleSort(void); void Sort(T *arr, int n); }; #endif template <class T> void BubbleSort<T>::Sort(T *arr, int n){ std::cout<<"Here is BubbleSort"<< std::endl; for (int i = n-1; i >= 1; i--) { for(int j =1; j <= (i-1); j++) { if (arr[j-1] > arr[j]) { this->Swap(arr[j], arr[j - 1]); } } } for (int i = 0; i<= n-1; i++) { std::cout<< arr[i] << std::endl; } }
//============================================================================== // Summary: // UICommentEditDialog: ±à¼­Åú×¢¶Ô»°¿ò // Usage: // // Remarks: // // Date: // 2013-04-08 // Author: // juguanhui@duokan.com //============================================================================== #ifndef _UICOMMENTEDITDIALOG_H_ #define _UICOMMENTEDITDIALOG_H_ #include "GUI/UIDialog.h" #include "GUI/UITextSingleLine.h" #include "GUI/UIPlainTextEdit.h" #include "GUI/UIButtonGroup.h" #ifdef KINDLE_FOR_TOUCH #include "GUI/UITouchComplexButton.h" #else #include "GUI/UIComplexButton.h" #endif enum EDIT_RESULT { GOTO_COMMENTORDIGEST = 0x3000, DELETE_COMMENT, SAVE_COMMENT, }; class UICommentEditDialog : public UIDialog { public: virtual LPCSTR GetClassName() const { return "UICommentEditDialog"; } UICommentEditDialog(UIContainer* pParent, int commentIndex = -1, std::string comment = std::string()); virtual ~UICommentEditDialog(); virtual HRESULT DrawBackGround(DK_IMAGE drawingImg); virtual void OnCommand(DWORD _dwCmdId, UIWindow* _pSender, DWORD _dwParam); #ifdef KINDLE_FOR_TOUCH virtual bool OnHookTouch(MoveEvent* moveEvent); #endif virtual std::string GetComment() { return m_boxComment.GetTextUTF8(); } DWORD GetCmdID() const { return m_resultCmdId; } private: void InitUI(); bool OnInputChange(const EventArgs& args); bool OnButtonClicked(const EventArgs& args); int m_commentIndex; UITextSingleLine m_txtTitle; UIPlainTextEdit m_boxComment; #ifdef KINDLE_FOR_TOUCH UITouchComplexButton m_btnViewComment; UITouchComplexButton m_btnDeleteComment; UITouchComplexButton m_btnExitOrCancel; UITouchComplexButton m_btnSave; #else UIComplexButton m_btnViewComment; UIComplexButton m_btnDeleteComment; UIComplexButton m_btnExitOrCancel; UIComplexButton m_btnSave; #endif UIButtonGroup m_btnGroup; std::string m_strPreComment; DWORD m_resultCmdId; }; #endif //_UICOMMENTEDITDIALOG_H_
/* * Copyright 2010 Tilera Corporation. 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, version 2. * * 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, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for * more details. * * This header defines a wrapper interface for managing hypervisor * device calls that will result in an interrupt at some later time. * In particular, this provides wrappers for hv_preada() and * hv_pwritea(). */ #ifndef _ASM_TILE_HV_DRIVER_H #define _ASM_TILE_HV_DRIVER_H #include <hv/hypervisor.h> struct hv_driver_cb; /* A callback to be invoked when an operation completes. */ typedef void hv_driver_callback_t(struct hv_driver_cb *cb, __hv32 result); /* * A structure to hold information about an outstanding call. * The driver must allocate a separate structure for each call. */ struct hv_driver_cb { hv_driver_callback_t *callback; /* Function to call on interrupt. */ void *dev; /* Driver-specific state variable. */ }; /* Wrapper for invoking hv_dev_preada(). */ static inline int tile_hv_dev_preada(int devhdl, __hv32 flags, __hv32 sgl_len, HV_SGL sgl[/* sgl_len */], __hv64 offset, struct hv_driver_cb *callback) { return hv_dev_preada(devhdl, flags, sgl_len, sgl, offset, (HV_IntArg)callback); } /* Wrapper for invoking hv_dev_pwritea(). */ static inline int tile_hv_dev_pwritea(int devhdl, __hv32 flags, __hv32 sgl_len, HV_SGL sgl[/* sgl_len */], __hv64 offset, struct hv_driver_cb *callback) { return hv_dev_pwritea(devhdl, flags, sgl_len, sgl, offset, (HV_IntArg)callback); } #endif /* _ASM_TILE_HV_DRIVER_H */
/* LAN_discovery.h * * LAN discovery implementation. * * Copyright (C) 2013 Tox project All Rights Reserved. * * This file is part of Tox. * * Tox 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. * * Tox 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 Tox. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef LAN_DISCOVERY_H #define LAN_DISCOVERY_H #include "DHT.h" /* Interval in seconds between LAN discovery packet sending. */ #define LAN_DISCOVERY_INTERVAL 10 /* Send a LAN discovery pcaket to the broadcast address with port port. */ int send_LANdiscovery(uint16_t port, DHT *dht); /* Sets up packet handlers. */ void LANdiscovery_init(DHT *dht); /* Clear packet handlers. */ void LANdiscovery_kill(DHT *dht); /* Is IP a local ip or not. */ bool Local_ip(IP ip); /* checks if a given IP isn't routable * * return 0 if ip is a LAN ip. * return -1 if it is not. */ int LAN_ip(IP ip); #endif
#ifndef ESQUELETO_H #define ESQUELETO_H #define GLUT_BUILDING_LIB #include <GL/glut.h> #include <iostream> #include <algorithm> #include <cmath> #ifndef M_PI #define M_PI 3.141592653589793 #endif using namespace std; #include "Extras.h" #include "MyFreenectDevice.h" // Numero de dedos #define ndirs 5 // Cosas variables para calcular el angulo #define distMinima 15 #define largoDedoMax 180.0 class Esqueleto { //private: public: Esqueleto(); Freenect::Freenect freenect; MyFreenectDevice* device; double freenect_angle; freenect_video_format requested_format; double centroX; double centroY; double profundidadMano; double angulo; double anguloDedo[ndirs]; double largoDedos[ndirs]; double depth[h][w]; double lastDepth[h][w]; double mask[h][w]; double profundidadCorte; void ActualizarCentro( ); void ActualizarAngulo( ); void ActualizarDedos( ); public: ~Esqueleto(); void CalibrarProfundidad(); void Actualizar( bool EnmascararProfundidad = true, bool calcularEsqueleto = true, bool marcarMovimiento = false ); void DibujarRaw( ); void DibujarMovimiento( ); void DibujarMano(bool contorno); void DibujarEsqueleto(); void SubirAngulo(); void BajarAngulo(); static Esqueleto* GetInstance(); int GetNumeroDedos(); void GetPosicionPuntaDedo(size_t nDedo, float &x, float &y, float &z);// if nDedo is GetNumeroDedos() hand center is given float Helper(int _x, int _y); }; #endif
#include "detector.h" #if _pragma_once_support #pragma once #endif #ifndef CHANGEAMOUNT_H #define CHANGEAMOUNT_H #include "ui_changeamount.h" class QLabel; class QSpinBox; // class for changing quantity of good/service with GUI class ChangeAmount : public QDialog, public Ui::ChangeAmount { Q_OBJECT public: ChangeAmount(QWidget *parent); ~ChangeAmount(); static ChangeAmount *instance(); void init(); QLabel *requiredAm; QLabel *givedOutAm; QSpinBox *requiredAmBox; QSpinBox *givedOutBox; private: static ChangeAmount *m_instance; }; #endif
/* * Copyright © 2009, 2010, Intel Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * Authors: Thomas Wood <thomas.wood@intel.com> */ #ifndef _SW_WINDOW_H #define _SW_WINDOW_H #include <mx/mx.h> G_BEGIN_DECLS #define SW_TYPE_WINDOW sw_window_get_type() #define SW_WINDOW(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ SW_TYPE_WINDOW, SwWindow)) #define SW_WINDOW_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ SW_TYPE_WINDOW, SwWindowClass)) #define SW_IS_WINDOW(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ SW_TYPE_WINDOW)) #define SW_IS_WINDOW_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ SW_TYPE_WINDOW)) #define SW_WINDOW_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ SW_TYPE_WINDOW, SwWindowClass)) typedef struct _SwWindow SwWindow; typedef struct _SwWindowClass SwWindowClass; typedef struct _SwWindowPrivate SwWindowPrivate; struct _SwWindow { MxWidget parent; SwWindowPrivate *priv; }; struct _SwWindowClass { MxWidgetClass parent_class; }; GType sw_window_get_type (void) G_GNUC_CONST; ClutterActor *sw_window_new (void); void sw_window_set_xid (SwWindow *window, gulong xid); gulong sw_window_get_xid (SwWindow *window); void sw_window_set_focused (SwWindow *window, gboolean focused); void sw_window_set_icon (SwWindow *window, ClutterTexture *icon); void sw_window_set_title (SwWindow *window, const gchar *title); void sw_window_set_thumbnail (SwWindow *window, ClutterActor *thumbnail); void sw_window_set_background (SwWindow *window, ClutterActor *thumbnail); void sw_window_workspace_changed (SwWindow *window, gint new_workspace); G_END_DECLS #endif /* _SW_WINDOW_H */
//------------------------------------------------------------------------------ // "Matrix Rain" - Interactive screensaver with webcam integration // copyright: (C) 2008, 2009, 2013, 2017 by Pavel Karneliuk // license: GNU General Public License v3 // e-mail: pavel.karneliuk@gmail.com //------------------------------------------------------------------------------ #pragma once //------------------------------------------------------------------------------ #include "blas.h" #include "gl_context.h" #include "stuff.h" #include "transform.h" //------------------------------------------------------------------------------ class GLRenderer : private GLContext { friend class AppWindow; public: inline const Version& version() const { return gl_version; } inline const GLubyte* renderer() const { return glGetString(GL_RENDERER); } inline const GLubyte* vendor() const { return glGetString(GL_VENDOR); } inline void present() { GLContext::swap_buffers(); } void reshape(unsigned int width, unsigned int height); unsigned int draw(); const Transform& get_transform() const { return transformation; } private: GLRenderer(class NativeWindow* win); const Version gl_version; Transform transformation; }; //------------------------------------------------------------------------------
/******************************************************************************** ** Form generated from reading UI file 'log.ui' ** ** Created by: Qt User Interface Compiler version 5.6.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_LOG_H #define UI_LOG_H #include <QtCore/QVariant> #include <QtWidgets/QAction> #include <QtWidgets/QApplication> #include <QtWidgets/QButtonGroup> #include <QtWidgets/QDialog> #include <QtWidgets/QHeaderView> #include <QtWidgets/QTextBrowser> QT_BEGIN_NAMESPACE class Ui_Log { public: QTextBrowser *textBrowser_log; void setupUi(QDialog *Log) { if (Log->objectName().isEmpty()) Log->setObjectName(QStringLiteral("Log")); Log->resize(460, 305); textBrowser_log = new QTextBrowser(Log); textBrowser_log->setObjectName(QStringLiteral("textBrowser_log")); textBrowser_log->setGeometry(QRect(10, 10, 441, 291)); QFont font; font.setFamily(QString::fromUtf8("\345\276\256\350\273\237\346\255\243\351\273\221\351\253\224")); font.setPointSize(12); textBrowser_log->setFont(font); retranslateUi(Log); QMetaObject::connectSlotsByName(Log); } // setupUi void retranslateUi(QDialog *Log) { Log->setWindowTitle(QApplication::translate("Log", "Log", 0)); } // retranslateUi }; namespace Ui { class Log: public Ui_Log {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_LOG_H
// DeadRSX Hardware Renderd Graphics Library // Author DarkhackerPS3 // -Thanks to Matt_P from EFNET #psl1ght for explaining stuff to me :P // DeadRSX 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. // DeadRSX 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 DeadRSX. If not, see <http://www.gnu.org/licenses/>. #pragma once #include <png.h> #include <pngdec/loadpng.h> #include <sysutil/video.h> #include <rsx/gcm.h> #define COLOR_NONE -1 #define COLOR_BLACK 0x00000000 #define COLOR_WHITE 0xffffffff #define COLOR_RED 0x00ff0000 #define COLOR_GREEN 0x0000ff00 #define COLOR_BLUE 0x000000ff #define Z_SCALE 1.0/65536.0 extern u32 *buffer[2]; extern gcmContextData *context; extern VideoResolution res; void deadrsx_init(); // initilize the screen void deadrsx_scale(); // scales the screen to 847x511 to support all tv screens void waitFlip(); void flip(s32 buffer); void setupRenderTarget(u32 currentBuffer); void deadrsx_background(u32 trueColor); void deadrsx_offset(u32 dooffset, int x, int y, int w, int h); void deadrsx_scaleoffset(u32 dooffset, int x, int y, int w, int h, int ow, int oh); void deadrsx_sprite(u32 dooffset, float x, float y, float w, float h, int ow, int oh, int tilex, int tiley, int ax, int ay); void deadrsx_loadfile(char inputpath[], PngDatas inputImage, u32 *inputOffset);
/* Read a thermo file and save all quantities inside a Thermo structure. Copyright (C) 2014-2017 Simone Conti Copyright (C) 2015 Université de Strasbourg */ #include <cygne/thermo.h> /* Read a system from file */ int thermo_readthermo(Thermo *A, const char *fname) { char *row=NULL, *key, *val; int nr, i; FILE *fp; /* Open input config file */ fp = cyg_fopen(fname, "r"); cyg_assert(fp!=NULL, CYG_FAILURE, "Error opening input file."); /* Read all elements */ while (str_getline(&row, fp) != -1) { /* Skip empty or comment lines */ if (str_isempty(row, "# \n\r\t\0")) continue; /* Parse all key:val pairs */ key = strtok(row, "="); val = strtok(NULL, "="); cyg_assert(val!=NULL, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); /* Temperature in kelvin */ if (strncmp(key, "temperature", 4)==0) { nr = sscanf(val, "%lf", &(A->T)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Number of moles */ else if (strncmp(key, "nmoles", 4)==0) { nr = sscanf(val, "%lf", &(A->n)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Volume (liters) */ else if (strncmp(key, "volume", 4)==0) { nr = sscanf(val, "%lf", &(A->V)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Molecular mass in g/mol */ else if (strncmp(key, "mass", 4)==0) { nr = sscanf(val, "%lf", &(A->m)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Translational degree of freedom */ else if (strncmp(key, "translations", 4)==0) { nr = sscanf(val, "%d", &(A->t)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Symmetry Number */ else if (strncmp(key, "sigma", 4)==0) { nr = sscanf(val, "%d", &(A->s)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Rotational degree of freedom and moments of inertia */ else if (strncmp(key, "rotations", 4)==0) { nr = sscanf(val, "%d", &(A->r)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); /* Read inertia moments in g/mol/A^2 */ if (A->r>0) { A->I = cyg_realloc(NULL, (A->r)*cyg_sizeof(double)); cyg_assert(A->I!=NULL, CYG_FAILURE, "Memory allocation failed!"); for (i=0; i<A->r; i++) { if (str_getline(&row, fp) != -1) { if (str_isempty(row, "#\n\0")) continue; nr=sscanf(row, "%lf", &(A->I[i])); cyg_assert(nr==1, CYG_FAILURE, "Impossible to read inertia moment #%d (expected #%d)", i, A->r); } } } } /* Vibrational degree of freedom and normal mode frequencies */ else if (strncmp(key, "vibrations", 4)==0) { nr = sscanf(val, "%d", &(A->v)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); /* Read vibrational modes in cm-1 */ A->nu = cyg_realloc(NULL, (A->v)*cyg_sizeof(double)); cyg_assert(A->nu!=NULL, CYG_FAILURE, "Memory allocation failed!"); for (i=0; i<A->v; i++) { if (str_getline(&row, fp) != -1) { if (str_isempty(row, "#\n\0")) continue; nr=sscanf(row, "%lf", &(A->nu[i])); cyg_assert(nr==1, CYG_FAILURE, "Impossible to read vibration #%d (expected #%d)", i, A->v); } } } /* Energy in kcal/mol */ else if (strncmp(key, "energy", 4)==0) { nr = sscanf(val, "%lf", &(A->E)); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Hessian matrix file */ else if (strncmp(key, "hessian", 4)==0) { char tmpstr[128]; nr = sscanf(val, "%127s", tmpstr); A->hessfile = strdup(tmpstr); cyg_assert(nr==1, CYG_FAILURE, "Invalid value <%s> for key <%s>", val, key); } /* Unknown Keyword */ else { cyg_logErr("Unknown keyword <%s>", key); return CYG_FAILURE; } } /* Clean and return */ fclose(fp); free(row); return CYG_SUCCESS; }
/* File: jagbytoploadindex.h Project: jaguar-bytecode Author: Douwe Vos Date: Nov 3, 2012 Web: http://www.natpad.net/ e-mail: dmvos2000(at)yahoo.com Copyright (C) 2012 Douwe Vos. 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 JAGBYTOPLOADINDEX_H_ #define JAGBYTOPLOADINDEX_H_ #include "../jagbytabstractmnemonic.h" #include "../jagbyttype.h" #include <caterpillar.h> G_BEGIN_DECLS #define JAG_BYT_TYPE_OP_LOAD_INDEX (jag_byt_op_load_index_get_type()) #define JAG_BYT_OP_LOAD_INDEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), jag_byt_op_load_index_get_type(), JagBytOpLoadIndex)) #define JAG_BYT_OP_LOAD_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAG_BYT_TYPE_OP_LOAD_INDEX, JagBytOpLoadIndexClass)) #define JAG_BYT_IS_OP_LOAD_INDEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAG_BYT_TYPE_OP_LOAD_INDEX)) #define JAG_BYT_IS_OP_LOAD_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAG_BYT_TYPE_OP_LOAD_INDEX)) #define JAG_BYT_OP_LOAD_INDEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAG_BYT_TYPE_OP_LOAD_INDEX, JagBytOpLoadIndexClass)) typedef struct _JagBytOpLoadIndex JagBytOpLoadIndex; typedef struct _JagBytOpLoadIndexPrivate JagBytOpLoadIndexPrivate; typedef struct _JagBytOpLoadIndexClass JagBytOpLoadIndexClass; struct _JagBytOpLoadIndex { JagBytAbstractMnemonic parent; }; struct _JagBytOpLoadIndexClass { JagBytAbstractMnemonicClass parent_class; }; GType jag_byt_op_load_index_get_type(); JagBytOpLoadIndex *jag_byt_op_load_index_new(JagBytOperation operation, int offset, JagBytType value_type, int frame_index, gboolean is_wide); int jag_byt_op_load_index_get_frame_index(JagBytOpLoadIndex *load_index); G_END_DECLS #endif /* JAGBYTOPLOADINDEX_H_ */
/**************************************************************************** * Tano - An Open IP TV Player * Copyright (C) 2013 Tadej Novak <tadej@tano.si> * * 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_SCHEDULETAB_H_ #define TANO_SCHEDULETAB_H_ #include <QtCore/QDate> #include <QtCore/QModelIndex> #include <QtWidgets/QMainWindow> class QComboBox; class QLabel; class QListView; class QStackedWidget; class QPushButton; class QToolBar; class Channel; class FancyLineEdit; class PlaylistDisplayWidget; class XmltvProgrammeFilterModel; class XmltvProgrammeModel; class ScheduleTab : public QMainWindow { Q_OBJECT public: explicit ScheduleTab(QWidget *parent = 0); ~ScheduleTab(); inline PlaylistDisplayWidget *playlist() { return _playlistWidget; } protected: void changeEvent(QEvent *e); public slots: void channel(Channel *channel); void reset(); void setEpg(const QString &channel, XmltvProgrammeModel *epg); void setPage(int id); signals: void changeTo(QWidget *); void itemSelected(const QString &); void requestEpg(const QString &); void requestRecord(const QString &); private slots: void change(); void info(); void programmeClicked(const QModelIndex &index); void processFilters(); void record(); void showMenu(const QPoint &pos); private: XmltvProgrammeModel *_model; XmltvProgrammeFilterModel *_filterModel; PlaylistDisplayWidget *_playlistWidget; QStackedWidget *_main; QListView *_view; QToolBar *_toolbarTop; QToolBar *_toolbarBottomType; QToolBar *_toolbarBottomSearch; QLabel *_labelTitle; QWidget *_noEpg; QLabel *_noEpgIcon; QLabel *_noEpgLabel; QPushButton *_noEpgButton; QComboBox *_selectDate; FancyLineEdit *_search; QAction *_change; QAction *_info; QAction *_record; QMenu *_rightMenu; QPoint _currentPos; }; #endif // TANO_SCHEDULETAB_H_
#include <m_pd.h> #include "g_canvas.h" #include "fatom.h" static t_class *fatom_class; void fatom_setup() { post("fatom setup"); fatom_class = class_new(gensym("fatom"), (t_newmethod)fatom_new, 0, sizeof(t_fatom),0,A_DEFSYM,0); fatom_setup_common(fatom_class); }
/* * Copyright (C) 2007-2013, the BAT core developer team * All rights reserved. * * For the licensing terms see doc/COPYING. * For documentation see http://mpp.mpg.de/bat */ // --------------------------------------------------------- #ifndef __BCMVCMEASUREMENT__H #define __BCMVCMEASUREMENT__H #include <string> #include <vector> // --------------------------------------------------------- class BCMVCMeasurement { public: // constructor // name: the name of the measurement BCMVCMeasurement(std::string name); // destructor ~BCMVCMeasurement(); // getters // return the name of the observable std::string GetName() { return fName; }; // return the index of the observable int GetObservable() { return fObservable; }; // return the central value double GetCentralValue() { return fCentralValue; }; // return the set of uncertainties std::vector<double> GetUncertainties() { return fUncertainties; }; // return a single uncertainty double GetUncertainty(int index) { return fUncertainties.at(index); }; // return the total uncertainty double GetTotalUncertainty(); // return the flag if the measurement is active or not bool GetFlagActive() { return fFlagActive; }; // setters // set the (index of the) observable this measurement corresponds to void SetObservable(int index) { fObservable = index; }; // set the central value of the measurement void SetCentralValue(double value) { fCentralValue = value; }; // set the uncertainties on the measurement void SetUncertainties(std::vector<double> uncertainties) { fUncertainties = uncertainties; }; // set flag if measurement is active for the combination void SetFlagActive(bool flag) { fFlagActive = flag; }; private: // the name of the measurement std::string fName; // the (index of the) observale this measurement corresponds to int fObservable; // the central value of the measurement double fCentralValue; // the uncertainties on the measurements std::vector<double> fUncertainties; // flag: active in combination (true) or not (false) bool fFlagActive; }; // --------------------------------------------------------- #endif
#ifndef GARFIELD_FAST_SIMULATION_H #define GARFIELD_FAST_SIMULATION_H //------------------------------------------------ // The Virtual Monte Carlo examples // Copyright (C) 2007 - 2016 Ivana Hrivnacova // All rights reserved. // // For the licensing terms see geant4_vmc/LICENSE. // Contact: root-vmc@cern.ch //------------------------------------------------- /// \file ExGarfield/geant4/include/FastSimulation.h /// \brief Definition of the ExGarfield::FastSimulation class /// /// ExGarfield garfieldpp example adapted to Virtual Monte Carlo. /// /// \date 28/10/2015 /// \author I. Hrivnacova; IPN, Orsay #include "TG4VUserFastSimulation.h" class GarfieldMessenger; namespace VMC { namespace ExGarfield { /// \ingroup ExGarfield /// \brief Special class for definition of fast simulation models /// /// \author I. Hrivnacova; IPN, Orsay class FastSimulation : public TG4VUserFastSimulation { public: FastSimulation(); virtual ~FastSimulation(); // methods virtual void Construct(); private: GarfieldMessenger* fMessenger; }; } // namespace ExGarfield } // namespace VMC #endif // GFLASH_FAST_SIMULATION_H
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { system(argv[1]); return 0; }
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <execinfo.h> #ifdef DEBUGLOG #define DLOG(format, args...) \ printf(format, ##args); #else #define DLOG(format, args...) \ (void*)0; #endif // DEBUGLOG #define TRACE_SIZE (100) #define DUMP_LOCATION ("./memory_count") #define MAX_STACK (10) void DumpTrace(void) { void *buffer[TRACE_SIZE] = { NULL }; char **trace = NULL; int size = backtrace(buffer, TRACE_SIZE); int flags = O_CREAT | O_RDWR | O_APPEND; mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO; int fd = open(DUMP_LOCATION, flags, mode); if (-1 == fd) { return; } int sz = size > MAX_STACK ? MAX_STACK : size; backtrace_symbols_fd(buffer, sz, fd); // trace = backtrace_symbols(buffer, size); // calls malloc write(fd, "--------------------\n\n", 22); close(fd); } #ifdef WRAP_MALLOC void* __real_malloc(size_t size); void* __wrap_malloc(size_t size) { DumpTrace(); DLOG(__func__) DLOG("\n"); void *ret = __real_malloc(size); return ret; } #endif // WRAP_MALLOC #ifdef WRAP_FREE void __real_free(void *ptr); void __wrap_free(void *ptr) { DumpTrace(); DLOG(__func__) DLOG("\n"); __real_free(ptr); } #endif // WRAP_FREE
/******************************************************************************* * Copyright (C) 2017-2022 Theodore Chang * * 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/>. ******************************************************************************/ /** * @class CircularHollow3D * @brief A CircularHollow3D class. * @author tlc * @date 14/03/2019 * @version 0.1.0 * @file CircularHollow3D.h * @addtogroup Section * @{ */ #ifndef CIRCULARHOLLOW3D_H #define CIRCULARHOLLOW3D_H #include <Section/Section3D/Section3D.h> class CircularHollow3D final : public Section3D { const double radius, thickness; const unsigned int_pt_num; public: CircularHollow3D(unsigned, // tag double, // radius double, // thickness unsigned, // material tag unsigned = 10, // number of integration points vec&& = {0., 0.} // eccentricity ); CircularHollow3D(unsigned, // tag vec&&, // dimension unsigned, // material tag unsigned = 10, // number of integration points vec&& = {0., 0.} // eccentricity ); void initialize(const shared_ptr<DomainBase>&) override; unique_ptr<Section> get_copy() override; void print() override; }; #endif //! @}
#ifndef _CAMERACORRESPONDENCECALIBRATION_H #define _CAMERACORRESPONDENCECALIBRATION_H #include "ofMain.h" #include "ofxOpenCv.h" #include "Scene.h" // camera correspondence calibration scene class CameraCorrespondenceCalibrationScene : public Scene { public: CameraCorrespondenceCalibrationScene(MyApplication* app, int hsize = 7, int vsize = 10, float squareLengthInMeters = 0.024f); virtual ~CameraCorrespondenceCalibrationScene(); virtual void update(); virtual void draw(); virtual void keyPressed(int key); private: ofTrueTypeFont _fnt; CvSize _patternSize; float _squareLength; CvPoint2D32f* _rgbCorners; CvPoint2D32f* _irCorners; CvPoint2D32f* _corners; bool _foundChessboard; enum { WAIT_FOR_RGB_CHESSBOARD, WAIT_FOR_IR_CHESSBOARD } _state; virtual void _calibrate(); }; // camera correspondence calibration scene 2 class CameraCorrespondenceCalibrationScene2 : public Scene { public: CameraCorrespondenceCalibrationScene2(MyApplication* app); virtual ~CameraCorrespondenceCalibrationScene2(); virtual void update(); virtual void draw(); virtual void mousePressed(int x, int y, int button); private: ofTrueTypeFont _fnt; std::vector<ofVec2f> _colorCorners; std::vector<ofVec2f> _depthCorners; virtual void _calibrate(); }; // camera correspondence calibration scene 3 class CameraCorrespondenceCalibrationScene3 : public Scene { public: CameraCorrespondenceCalibrationScene3(MyApplication* app, int hsize = 7, int vsize = 10); virtual ~CameraCorrespondenceCalibrationScene3(); virtual void update(); virtual void draw(); virtual void keyPressed(int key); private: ofTrueTypeFont _fnt; IplImage* _gray; std::vector<IplImage*> _rgbBoards; std::vector<IplImage*> _irBoards; std::vector<CvPoint2D32f*> _rgbCorners; std::vector<CvPoint2D32f*> _irCorners; int _cornerCount; CvPoint2D32f* _corners; virtual void _calibrate(); int _hsize, _vsize; bool _foundChessboard; }; // camera correspondence calibration scene calc class CameraCorrespondenceCalibrationSceneCalc : public Scene { public: CameraCorrespondenceCalibrationSceneCalc(MyApplication* app); virtual ~CameraCorrespondenceCalibrationSceneCalc(); virtual void update(); virtual void draw(); private: }; #endif
//------------------------------------------------------------------- // // Node.h // // author: Stefan Hachul // date : June 2006 // //-------------------------------------------------------------------- //Data structure for representing nodes and an int value (needed for class ogdf/list) //to perform bucket sort. #ifdef _MSC_VER #pragma once #endif #ifndef OGDF_NODE_H #define OGDF_NODE_H #include <ogdf/basic/Graph.h> #include <ogdf/basic/Graph_d.h> #include <iostream> namespace ogdf { class Node { friend int value(const Node& A){return A.value;} friend ostream &operator<< (ostream & output,const Node & A) { output <<"node index "; if(A.vertex == NULL) output<<"nil"; else output<<A.vertex->index(); output<<" value "<< A.value; return output; } friend istream &operator>> (istream & input,Node & A) { input >> A.value; return input; } public: Node(){vertex = NULL;value = 0;} //constructor ~Node(){;} //destructor void set_Node(node v,int a) {vertex = v;value = a;} int get_value() const {return value;} node get_node() const {return vertex;} private: node vertex; int value ; }; }//namespace ogdf #endif
// Copyright (c) 2009, Roland Kaminski <kaminski@cs.uni-potsdam.de> // // This file is part of gringo. // // gringo 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. // // gringo 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 gringo. If not, see <http://www.gnu.org/licenses/>. #pragma once #include <gringo/gringo.h> #include <gringo/aggrlit.h> #include <gringo/predlitrep.h> class GroundProgramBuilder { public: enum Type_Enum { LIT, TERM, AGGR_SUM, AGGR_COUNT, AGGR_AVG, AGGR_MIN, AGGR_MAX, AGGR_EVEN, AGGR_EVEN_SET, AGGR_ODD, AGGR_ODD_SET, AGGR_DISJUNCTION, STM_RULE, STM_CONSTRAINT, STM_SHOW, STM_HIDE, STM_EXTERNAL, STM_MINIMIZE, STM_MAXIMIZE, STM_MINIMIZE_SET, STM_MAXIMIZE_SET, STM_COMPUTE, META_GLOBALSHOW, META_GLOBALHIDE, META_SHOW, META_HIDE, META_EXTERNAL, USER }; typedef uint16_t Type; protected: struct Lit { static Lit create(Type type, uint32_t offset, uint32_t n) { Lit t; t.type = type; t.sign = false; t.offset = offset; t.n = n; return t; } bool sign; Type type; uint32_t offset; uint32_t n; }; typedef std::vector<Lit> LitVec; struct Literal : public PredLitRep { friend class GroundProgramBuilder; friend class OnlineParser; Literal() : PredLitRep(false, 0) { } }; public: struct Stack { Type type; uint32_t n; LitVec lits; LitVec aggrLits; ValVec vals; }; typedef std::auto_ptr<Stack> StackPtr; public: GroundProgramBuilder(Output *output); virtual void add(Type type, uint32_t n = 0); // call instead of add and later use add(StackPtr stm) StackPtr get(Type type, uint32_t n); void add(StackPtr stm); void addVal(const Val &val); void addSign(); Storage *storage(); protected: //void printAggrLits(AggrLit::Printer *printer, Lit &a, bool weight); void printLit(Printer *printer, uint32_t offset, bool head); PredLitRep *predLitRep(Lit &a); void pop(uint32_t n); void add(); virtual void doAdd() { } protected: Output *output_; StackPtr stack_; Literal lit_; };
// ---------------------------------------------------------------------------- // threads.h // // Copyright (C) 2007-2009 // Stelios Bounanos, M0GLD // // This file is part of fldigi. // // Fldigi 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. // // Fldigi 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 fldigi. If not, see <http://www.gnu.org/licenses/>. // ---------------------------------------------------------------------------- #ifndef THREADS_H_ #define THREADS_H_ #include <config.h> #include <pthread.h> #include <stdint.h> #include <semaphore.h> #ifndef WIN32 #if !HAVE_SEM_TIMEDWAIT # include <time.h> int sem_timedwait(sem_t* sem, const struct timespec* abs_timeout); #endif #else #include <time.h> #endif int sem_timedwait_rel(sem_t* sem, double rel_timeout); int pthread_cond_timedwait_rel(pthread_cond_t* cond, pthread_mutex_t* mutex, double rel_timeout); // qrunner threads enum { INVALID_TID = -1, TRX_TID, TOD_TID, QRZ_TID, RIGCTL_TID, NORIGCTL_TID, EQSL_TID, ADIF_RW_TID, ADIF_MERGE_TID, XMLRPC_TID, ARQ_TID, ARQSOCKET_TID, MACLOGGER_TID, KISS_TID, KISSSOCKET_TID, PSM_TID, AUDIO_ALERT_TID, FD_TID, N3FJP_TID, DXCC_TID, WKEY_TID, FLMAIN_TID, CWIO_TID, NUM_THREADS, NUM_QRUNNER_THREADS = NUM_THREADS - 1 }; #ifdef __linux__ void linux_log_tid(void); # define LOG_THREAD_ID() linux_log_tid() #else # define LOG_THREAD_ID() /* nothing */ #endif #if USE_TLS # define THREAD_ID_TYPE __thread intptr_t # define CREATE_THREAD_ID() thread_id_ = INVALID_TID # define SET_THREAD_ID(x) do { thread_id_ = (x); LOG_THREAD_ID(); } while (0) # define GET_THREAD_ID() thread_id_ #else # define THREAD_ID_TYPE pthread_key_t # define CREATE_THREAD_ID() pthread_key_create(&thread_id_, NULL) # define SET_THREAD_ID(x) do { pthread_setspecific(thread_id_, (const void *)(x + 1)); LOG_THREAD_ID(); } while (0) # define GET_THREAD_ID() ((intptr_t)pthread_getspecific(thread_id_) - 1) #endif // USE_TLS extern THREAD_ID_TYPE thread_id_; #ifndef NDEBUG # include "debug.h" bool thread_in_list(int id, const int* list); # define ENSURE_THREAD(...) \ do { \ int id_ = GET_THREAD_ID(); \ int t_[] = { __VA_ARGS__, INVALID_TID }; \ if (!thread_in_list(id_, t_)) \ LOG_ERROR("bad thread context: %d", id_); \ } while (0) # define ENSURE_NOT_THREAD(...) \ do { \ int id_ = GET_THREAD_ID(); \ int t_[] = { __VA_ARGS__, INVALID_TID }; \ if (thread_in_list(id_, t_)) \ LOG_ERROR("bad thread context: %d", id_); \ } while (0) #else # define ENSURE_THREAD(...) ((void)0) # define ENSURE_NOT_THREAD(...) ((void)0) #endif // ! NDEBUG // On POSIX systems we cancel threads by sending them SIGUSR2, // which will also interrupt blocking calls. On woe32 we use // pthread_cancel and there is no good/sane way to interrupt. #ifndef __WOE32__ #include <signal.h> # define SET_THREAD_CANCEL() \ do { \ sigset_t usr2; \ sigemptyset(&usr2); \ sigaddset(&usr2, SIGUSR2); \ pthread_sigmask(SIG_UNBLOCK, &usr2, NULL); \ } while (0) # define TEST_THREAD_CANCEL() /* nothing */ # define CANCEL_THREAD(t__) pthread_kill(t__, SIGUSR2) #else // threads have PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DEFERRED when created # define SET_THREAD_CANCEL() /* nothing */ # define TEST_THREAD_CANCEL() pthread_testcancel() # define CANCEL_THREAD(t__) pthread_cancel(t__); #endif /// This ensures that a mutex is always unlocked when leaving a function or block. class guard_lock { public: guard_lock(pthread_mutex_t* m); ~guard_lock(void); private: pthread_mutex_t* mutex; }; /// This wraps together a mutex and a condition variable which are used /// together very often for queues etc... class syncobj { pthread_mutex_t m_mutex ; pthread_cond_t m_cond ; public: syncobj(); ~syncobj(); pthread_mutex_t * mtxp(void) { return & m_mutex; } void signal(); bool wait( double seconds ); }; #endif // !THREADS_H_
/* serialize.h */ #ifndef SERIALIZE_H #define SERIALIZE_H #include "node_data.h" char *serialize(struct nli *node); struct nli *deserialize(char *buf); #endif
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* s_fdnotify.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: qperez <qperez42@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2014/12/03 09:37:51 by qperez #+# #+# */ /* Updated: 2014/12/04 10:31:49 by qperez ### ########.fr */ /* */ /* ************************************************************************** */ /* ** <This file contains fdnotify prototype> ** Copyright (C) <2014> Quentin Perez <qperez42@gmail.com> ** This file is part of 42-toolkit. ** 42-toolkit 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 S_FDNOTIFY_H # define S_FDNOTIFY_H # include <stdbool.h> # include <sys/select.h> # include <list/s_list.h> # include <fdnotify/s_fdnotify_event.h> typedef struct s_fdnotify { fd_set v_read; fd_set v_write; int v_max; struct timeval *p_timeout; struct timeval v_timeout; struct timeval v_savetimeout; } t_fdnotify; # define D_FDNOTIFY(funct) f_fdnotify_##funct bool f_fdnotify_init(t_fdnotify *v_this); void f_fdnotify_enable_timeout(t_fdnotify *v_this, int seconds, int useconds); void f_fdnotify_disable_timeout(t_fdnotify *v_this); bool f_fdnotify_get_event(t_fdnotify *v_this, t_fdnotify_event *ev, t_list *list, int *nb_interaction); void f_fdnotify_destroy(t_fdnotify *v_this); #endif
/* Copyright (C) 2012 Andrew Darqui This file is part of darqbot. darqbot 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. darqbot 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 darqbot. If not, see <http://www.gnu.org/licenses/>. Contact: [website: http://www.adarq.org] email: andrew.darqui@g m a i l . c o m */ #ifndef MODULE_H #define MODULE_H #include "bot.h" /* module stuff */ module_t *module_load (char *); module_t * module_unload(module_t *); void module_timerlist(void); void module_iolist(void); void module_list(void); char *module_path (char *); void module_load_all (void); void module_deactivate_dptr(void *); void module_deactivate(void *); void xmodule_free_destroy(void *); bot_t * module_unload_all(void); void module_add_subtrigs(module_t *, char *); void module_update(module_t *, char *) ; dlist_t * module_find_by_trig_dptr(char *); module_t * module_find_by_trig(char *); module_t * module_find_by_name(char *); void module_lock(char *); void module_unlock(char *); void module_update_stats(void); void module_sort(void); void modules_off(void) ; /* can process args or prior text */ #define MOD_PARSE_TOP_HALF \ { \ char * l_new_str=NULL; \ char * l_str_ptr=NULL; \ dlist_t * l_dl, *l_dptr; \ int l_c, l_should_strzero=0; \ l_str_ptr = eat_whitespace (dl_module_arg_after_options); \ if (!l_str_ptr || !strlen (l_str_ptr)) { \ l_str_ptr = bot->txt_data_out; \ puts("STRZERO"); \ l_should_strzero = 1; \ } \ if (!sNULL(l_str_ptr)) \ return bot; \ l_dl = tokenize (bot, l_str_ptr, TOKENIZE_NORMAL | TOKENIZE_LEAVESEP | TOKENIZE_LEAVEQUOTES, "\n"); \ if (!l_dl) return NULL; \ dlist_fornext (l_dl, l_dptr) { \ l_str_ptr = (char *) dlist_data (l_dptr); \ if (!l_str_ptr) continue; \ l_c = l_str_ptr[strlen (l_str_ptr) - 1]; \ if (l_c == '\n') { \ l_str_ptr[strlen (l_str_ptr) - 1] = '\0'; } \ #define MOD_PARSE_BOTTOM_HALF \ if (l_new_str) { \ printf("NEW_STR=%s\n", l_new_str); \ if (l_should_strzero) { \ strzero_bot_safe (bot->txt_data_out, sizeof (bot->txt_data_out)); \ l_should_strzero = 0; } \ strlcat_bot_safe (bot->txt_data_out, l_new_str, sizeof(bot->txt_data_out)-1); \ if (l_c == '\n') { \ charcat_bot_safe (bot->txt_data_out, l_c, sizeof (bot->txt_data_out) - 1); } \ free (l_new_str); \ } \ } \ tokenize_destroy(bot, &l_dl); \ } \ /* no need for any args, ie, ^backtrace */ #define MOD_PARSE_TOP_HALF_VOID \ { \ char * l_new_str=NULL; \ char * l_str_ptr=NULL; \ #define MOD_PARSE_BOTTOM_HALF_VOID \ if (l_new_str) { \ printf("NEW_STR=%s\n", l_new_str); \ strlcat_bot_safe (bot->txt_data_out, l_new_str, sizeof(bot->txt_data_out)-1); \ free (l_new_str); \ } \ }\ /* half_arg: process only an argument, ie, ^e hi, instead of hi |^e */ #define MOD_PARSE_TOP_HALF_ARG \ { \ char * l_new_str=NULL; \ char * l_str_ptr=NULL; \ if (!strlen ((l_str_ptr=eat_whitespace (dl_module_arg_after_options)))) { return NULL; } \ #define MOD_PARSE_BOTTOM_HALF_ARG \ if (l_new_str) { \ printf("NEW_STR=%s\n", l_new_str); \ strzero_bot_safe(bot->txt_data_out, sizeof(bot->txt_data_out)); \ strlcat_bot_safe (bot->txt_data_out, l_new_str, sizeof(bot->txt_data_out)-1); \ free (l_new_str); \ } \ }\ /* can process args or prior text */ #define MOD_PARSE_TOP_HALF_NODL \ { \ char * l_new_str=NULL; \ char * l_str_ptr=NULL; \ int l_should_strzero=0; \ l_str_ptr = eat_whitespace (dl_module_arg_after_options); \ if (!l_str_ptr || !strlen (l_str_ptr)) { \ l_str_ptr = bot->txt_data_out; \ puts("STRZERO"); \ l_should_strzero = 1; \ } \ #define MOD_PARSE_BOTTOM_HALF_NODL \ if (l_new_str) { \ printf("NEW_STR=%s\n", l_new_str); \ if (l_should_strzero) { \ strzero_bot_safe (bot->txt_data_out, sizeof (bot->txt_data_out)); \ l_should_strzero = 0; } \ strlcat_bot_safe(bot->txt_data_out, l_new_str, sizeof(bot->txt_data_out)-1); \ } \ } \ /* * OPTION PROCESSING BLOCK */ #define MOD_OPTIONS_TOP_HALF \ { \ dl_module_arg_after_options = bot->dl_module_arg; \ dl_options_ptr = &bot->dl_module_arg[1]; \ if (bot->dl_module_arg[0] == '(') \ { \ int len_options_area = 0; \ dl_module_arg_after_options = tokenize_find_closing_bracket (bot->dl_module_arg, '('); \ if (!dl_module_arg_after_options) return NULL; \ *dl_module_arg_after_options = '\0'; \ dl_module_arg_after_options++; \ len_options_area = dl_module_arg_after_options - bot->dl_module_arg; \ #define MOD_OPTIONS_BOTTOM_HALF \ } \ else { \ dl_options_ptr = ""; \ } \ } \ #endif
/* This file is part of Lyos. Lyos 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. Lyos 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 Lyos. If not, see <http://www.gnu.org/licenses/>. */ #include <lyos/types.h> #include <lyos/ipc.h> #include "sys/types.h" #include "stdio.h" #include "unistd.h" #include "stddef.h" #include <asm/protect.h> #include "lyos/const.h" #include "string.h" #include "lyos/proc.h" #include "lyos/global.h" #include "lyos/proto.h" #include <asm/const.h> #include <asm/proto.h> #ifdef CONFIG_SMP #include <asm/smp.h> #endif #include "lyos/cpulocals.h" #include <lyos/time.h> #include <lyos/clocksource.h> #include "apic.h" #include "acpi.h" #include <asm/hpet.h> #include <asm/div64.h> void* hpet_addr; void* hpet_vaddr; static int hpet_enabled = 0; static u64 hpet_freq; static u64 read_hpet(struct clocksource* cs) { return hpet_readl(HPET_COUNTER); } static struct clocksource hpet_clocksource = { .name = "hpet", .rating = 250, .read = read_hpet, .mask = 0xffffffffffffffff, }; int init_hpet() { struct acpi_hpet* hpet = acpi_get_hpet(); if (!hpet) return 0; hpet_addr = (void*)((uintptr_t)hpet->address.address); printk("ACPI: HPET id: 0x%x base: %p\n", hpet->block_id, hpet_addr); /* enable hpet */ u32 conf = hpet_read(HPET_CFG); conf |= HPET_CFG_ENABLE; hpet_write(HPET_CFG, conf); u32 hpet_period = hpet_read(HPET_PERIOD); u64 freq; freq = FSEC_PER_SEC; do_div(freq, hpet_period); hpet_freq = freq; register_clocksource_hz(&hpet_clocksource, (u32)hpet_freq); hpet_enabled = 1; return hpet_enabled; } int is_hpet_enabled() { return hpet_enabled; }
#pragma once #include "../render/volume.h" #include "../render/volume_detail.h" class MengerSponge : public VolumeVoxelmap { public: enum MODE { COLORS_RGBA }; MengerSponge( const char *name, Object *parent ); ~MengerSponge(); void setDepth( int ); void setMode( int ); private: void makeSponge(); int depth; int mode; voxelmap_t volume; svmipmap_t volume_svmm; };
/* * IRQ domain support for SH INTC subsystem * * Copyright (C) 2012 Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #define pr_fmt(fmt) "intc: " fmt #include <linux/irqdomain.h> #include <linux/sh_intc.h> #include <linux/export.h> #include "internals.h" /** * intc_irq_domain_evt_xlate() - Generic xlate for vectored IRQs. * * This takes care of exception vector to hwirq translation through * by way of evt2irq() translation. * * Note: For platforms that use a flat vector space without INTEVT this * basically just mimics irq_domain_xlate_onecell() by way of a nopped * out evt2irq() implementation. */ static int intc_evt_xlate(struct irq_domain *d, struct device_node *ctrlr, const u32 *intspec, unsigned int intsize, unsigned long *out_hwirq, unsigned int *out_type) { if (WARN_ON(intsize < 1)) { return -EINVAL; } *out_hwirq = evt2irq(intspec[0]); *out_type = IRQ_TYPE_NONE; return 0; } static const struct irq_domain_ops intc_evt_ops = { .xlate = intc_evt_xlate, }; void __init intc_irq_domain_init(struct intc_desc_int *d, struct intc_hw_desc *hw) { unsigned int irq_base, irq_end; /* * Quick linear revmap check */ irq_base = evt2irq(hw->vectors[0].vect); irq_end = evt2irq(hw->vectors[hw->nr_vectors - 1].vect); /* * Linear domains have a hard-wired assertion that IRQs start at * 0 in order to make some performance optimizations. Lamely * restrict the linear case to these conditions here, taking the * tree penalty for linear cases with non-zero hwirq bases. */ if (irq_base == 0 && irq_end == (irq_base + hw->nr_vectors - 1)) d->domain = irq_domain_add_linear(NULL, hw->nr_vectors, &intc_evt_ops, NULL); else { d->domain = irq_domain_add_tree(NULL, &intc_evt_ops, NULL); } BUG_ON(!d->domain); }
/* ** Copyright 2007-2013, 2017-2018 Sólyom Zoltán ** This file is part of zkanji, a free software released under the terms of the ** GNU General Public License version 3. See the file LICENSE for details. **/ #ifndef ZEVENTS_H #define ZEVENTS_H #include <QtEvents> // Header for custom events that automatically assign a type for themselves. // Usage: // Define either with ZEVENT(eventname), or derive from EventTBase<>. See examples below. // The new events are best added in this file, so this header is not needed in other headers, // only in source files. // Sending an event created this way: qApp->postEvent/sendEvent([reciever], new [EventTypeName]) // Handling the event: override QObject::event() in the class that needs to handle the custom // events. To check the type of the received event use: // if (event->type() == [EventTypeName]::Type()) { ... } // Template base for event type registering. Only used by EventTBase, and // shouldn't be relied on it in any other class. template<typename EventT> class EventTypeReg { public: static QEvent::Type Type() { if (regtype == -1) regtype = QEvent::registerEventType(); return (QEvent::Type)regtype; } private: static int regtype; }; template<typename EventT> int EventTypeReg<EventT>::regtype = -1; // Base class of all custom made events that register the event type at first // call. template<typename EventT> class EventTBase : public QEvent { public: EventTBase() : base(EventTypeReg<EventT>::Type()) {} static QEvent::Type Type() { return EventTypeReg<EventT>::Type(); } private: typedef QEvent base; }; // Every custom event must be derived from EventTBase<self type> // For simple events that don't require arguments this define generates code // for the class #define ZEVENT(eventname) class eventname : public EventTBase< eventname > { }; // The following types are events. Call their built in Type() function // when checking in the event handling of widgets. ZEVENT(InitWindowEvent) ZEVENT(StartEvent) ZEVENT(EndEvent) ZEVENT(EditorClosedEvent) ZEVENT(ConstructedEvent) ZEVENT(SaveSizeEvent) // Notifies a main window to change its active dictionary to another. class SetDictEvent : public EventTBase<SetDictEvent> { public: SetDictEvent(int dictindex); int index(); private: int dix; typedef EventTBase<SetDictEvent> base; }; // Asks a main window about its current active dictionary. The window should // call setResult in its event handler to specify the dictionary index. The // event must be sent with sendEvent as postEvent is executed at a random time // and the value can't be retrieved later. class GetDictEvent : public EventTBase<GetDictEvent> { public: GetDictEvent(); // Used when handling the event to return the current dictionary index. void setResult(int dictindex); // The value set by the handling window or -1 if the event hasn't been // handled. int result(); private: int dix; typedef EventTBase<GetDictEvent> base; }; // Asks a window whether it's important enough, to hide all tool windows that would otherwise // be topmost, and possibly hide the view from the important window. When the event is not // handled or setImportant() is not called, the result will be false. //class IsImportantWindowEvent : public EventTBase<IsImportantWindowEvent> //{ //public: // IsImportantWindowEvent(); // // void setImportant(); // bool result(); //private: // bool r; // typedef EventTBase<IsImportantWindowEvent> base; //}; // Notifies a tree model that it should remove its fake tree item which was // giving instructions to users but had no other role. class TreeItem; class TreeRemoveFakeItemEvent : public EventTBase<TreeRemoveFakeItemEvent> { public: TreeRemoveFakeItemEvent(TreeItem *parent); TreeItem* itemParent(); private: TreeItem *parent; typedef EventTBase<TreeRemoveFakeItemEvent> base; }; class TreeAddFakeItemEvent : public EventTBase<TreeAddFakeItemEvent> { public: TreeAddFakeItemEvent(TreeItem *parent); TreeItem* itemParent(); private: TreeItem *parent; typedef EventTBase<TreeAddFakeItemEvent> base; }; #endif // ZEVENTS_H
/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Authored by: Thomas Voss <thomas.voss@canonical.com> * Ricardo Mendoza <ricardo.mendoza@canonical.com> */ #ifndef BASE_BRIDGE_H_ #define BASE_BRIDGE_H_ #include <assert.h> #include <dlfcn.h> #include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #define MAX_MODULE_NAME 32 #define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden"))) namespace internal { template<typename Scope> class HIDDEN_SYMBOL Bridge { public: static Bridge<Scope>& instance() { static Bridge<Scope> bridge; return bridge; } void* resolve_symbol(const char* symbol, const char* module = "") const { static const char* test_modules = secure_getenv("UBUNTU_PLATFORM_API_TEST_OVERRIDE"); if (test_modules && strstr(test_modules, module)) { printf("Platform API: INFO: Overriding symbol '%s' with test version\n", symbol); return Scope::dlsym_fn(lib_override_handle, symbol); } else { return Scope::dlsym_fn(lib_handle, symbol); } } protected: Bridge() : lib_handle(Scope::dlopen_fn(Scope::path(), RTLD_LAZY)) { if (Scope::override_path() && secure_getenv("UBUNTU_PLATFORM_API_TEST_OVERRIDE")) lib_override_handle = (Scope::dlopen_fn(Scope::override_path(), RTLD_LAZY)); } ~Bridge() { } void* lib_handle; void* lib_override_handle; }; } #endif // BRIDGE_H_
/*************************************************************************** gloscope.h - description ------------------- begin : Jan 17 2004 copyright : (C) 2004 by Adam Pigg email : adam@piggz.co.uk ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef GLOSCOPE_H #define GLOSCOPE_H #include <config.h> #ifdef HAVE_QGLWIDGET #include "analyzerbase.h" /** *@author piggz */ typedef struct { float level; uint delay; } peak_tx; class GLAnalyzer : public Analyzer::Base3D { private: std::vector<float> m_oldy; std::vector<peak_tx> m_peaks; void drawCube(); void drawFrame(); void drawBar(float xPos, float height); void drawPeak(float xPos, float ypos); void drawFloor(); GLfloat x, y; public: GLAnalyzer(QWidget*); ~GLAnalyzer(); void analyze(const Scope&); protected: void initializeGL(); void resizeGL(int w, int h); void paintGL(); }; #endif #endif
#ifndef DIALOG_H #define DIALOG_H #include <QDialog> #include "mythread.h" namespace Ui { class Dialog; } class Dialog : public QDialog { Q_OBJECT public: explicit Dialog(QWidget *parent = 0); ~Dialog(); MyThread *mThread; private: Ui::Dialog *ui; public slots: void onNumberChanged(int); private slots: void on_pushButton_clicked(); void on_pushButton_2_clicked(); }; #endif // DIALOG_H
/* SUCHAI * NANOSATELLITE FLIGHT SOFTWARE * * Copyright 2013, Carlos Gonzalez Cortes, carlgonz@ug.uchile.cl * Copyright 2013, Tomas Opazo Toro, tomas.opazo.t@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/>. */ #include "cmdOBC.h" cmdFunction obc_Function[OBC_NCMD]; int obc_sysReq[OBC_NCMD]; /** * This function registers the list of command in the system, initializing the * functions array. This function must be called at every system start up. */ void obc_onResetCmdOBC(void) { obc_Function[(unsigned char)obc_id_reset] = obc_reset; obc_sysReq[(unsigned char)obc_id_reset] = CMD_SYSREQ_MIN; obc_Function[(unsigned char)obc_id_get_rtos_memory] = obc_get_rtos_memory; obc_sysReq[(unsigned char)obc_id_get_rtos_memory] = CMD_SYSREQ_MIN; } /** * Perform a microcontroller software reset * * @param param Not used * @return 1, but function never returns */ int obc_reset(void* param) { printf("Resetting system NOW!!\n"); OBC_SYS_RESET(); /* Never get here */ return 1; } /** * Performs debug taks over current RTOS. Get rtos memory usage in bytes * * @param param Not used * @return Availible heap memory in bytes */ int obc_get_rtos_memory(void *param) { size_t mem_heap = xPortGetFreeHeapSize(); printf("Free RTOS memory: %d\n", mem_heap); return mem_heap; }
// // Created by czllo on 2017/5/19. // #ifndef BINARY_TREE_BINARY_TREE_H #define BINARY_TREE_BINARY_TREE_H #include <iostream> #include <string> #include <cassert> template <typename T> struct Node { typedef T data_type; Node() : data(), left(NULL), right(NULL), parent(NULL) { } ~Node() { } data_type data; struct Node *left, *right, *parent; }; class BinaryTree { public: typedef int data_type; typedef struct Node<data_type> node_type; typedef node_type* node_pointer; BinaryTree() : root(NULL) { } ~BinaryTree() { } void Insert(const data_type &data) { node_pointer new_node = MakeNode(data); assert(new_node != NULL); Insert(new_node); } node_pointer Search(const data_type &data) { node_pointer x = root; while (x != NULL && x->data != data) { if (data < x->data) x = x->left; else x = x->right; } return x; // if (x == NULL || data == x->data) // return x; // if (data < x->data) // return Search(x->left); // else // return Search(x->right); } void Delete(const data_type &data) { node_pointer x = Search(data); if (x) Delete(x); FreeNode(x); } node_pointer Max() { if (root) return Max(root); return NULL; } node_pointer Min() { if (root) return Min(root); return NULL; } void InorderWalk() { InorderWalk(root); } private: node_pointer MakeNode(const data_type &data) { node_pointer node = new node_type; assert(node != NULL); node->data = data; return node; } void FreeNode(node_pointer x) { if (x) delete x; } void InorderWalk(node_pointer x) { if (x) { InorderWalk(x->left); std::cout << x->data << std::endl; InorderWalk(x->right); } } node_pointer Max(node_pointer x) { assert(NULL != x); while (NULL != x->right) { x = x->right; } return x; } node_pointer Min(node_pointer x) { assert(NULL != x); while (NULL != x->left) { x = x->left; } return x; } node_pointer Pre(node_pointer z) { if (NULL == z) return NULL; if (NULL != z->left) return Max(z->left); node_pointer y = z->parent; while (NULL != y && y->left == z) { z = y; y = y->parent; } return y; } node_pointer Next(node_pointer z) { if (NULL == z) return NULL; if (NULL != z->right) return Min(z->right); node_pointer y = z->parent; while(NULL != y && y->right == z) { z = y; y = y->parent; } return y; } void Insert(node_pointer z) { node_pointer x = root; node_pointer y = NULL; while (NULL != x) { y = x; (z->data < x->data) ? (x = x->left) : (x = x->right); } z->parent = y; if (y == NULL) { root = z; } else if (z->data > y->data) { y->right = z; } else { y->left = z; } } void Delete(node_pointer z) { assert(z != NULL); if (NULL == z->left) { Transplant(z, z->right); } else if (NULL == z->right) { Transplant(z, z->left); } else { node_pointer y = Min(z->right); if (y->parent != z) { Transplant(y, y->right); y->right = z->right; y->right->parent = y; } Transplant(z, y); y->left = z->left; y->left->parent = y; } } void Transplant(node_pointer u, node_pointer v) { assert(u != NULL); //v can be nil if (NULL == u->parent) root = v; else if (u->parent->left == u) u->parent->left = v; else u->parent->right = v; if (NULL != v) v->parent = u->parent; } private: node_pointer root; }; #endif //BINARY_TREE_BINARY_TREE_H
/* =========================================================================== Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. This file is part of Spearmint Source Code. Spearmint 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 of the License, or (at your option) any later version. Spearmint Source Code 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 Spearmint Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, Spearmint Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. =========================================================================== */ // cmdlib.h #ifndef __CMDLIB__ #define __CMDLIB__ #ifdef _MSC_VER #pragma warning(disable : 4244) // MIPS #pragma warning(disable : 4136) // X86 #pragma warning(disable : 4051) // ALPHA #pragma warning(disable : 4018) // signed/unsigned mismatch #pragma warning(disable : 4305) // truncate from double to float #endif #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <ctype.h> #include <time.h> #include <stdarg.h> #include <stdint.h> #ifndef __BYTEBOOL__ #define __BYTEBOOL__ typedef enum {false, true} qboolean; typedef unsigned char byte; #endif // the dec offsetof macro doesnt work very well... #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier) // set these before calling CheckParm extern int myargc; extern char **myargv; char *strupr (char *in); char *strlower (char *in); int Q_strncasecmp (char *s1, char *s2, int n); int Q_strcasecmp (char *s1, char *s2); void Q_getwd (char *out, size_t size); int Q_filelength (FILE *f); int FileTime (char *path); void Q_mkdir (char *path); extern char qdir[1024]; extern char gamedir[1024]; void SetQdirFromPath (char *path); char *ExpandArg (char *path); // from cmd line char *ExpandPath (char *path); // from scripts char *ExpandPathAndArchive (char *path); double I_FloatTime (void); void Error(char *error, ...) __attribute__ ((noreturn, format (printf, 1, 2))); void Warning(char *warning, ...) __attribute__ ((format (printf, 1, 2))); int CheckParm (char *check); FILE *SafeOpenWrite (char *filename); FILE *SafeOpenRead (char *filename); void SafeRead (FILE *f, void *buffer, int count); void SafeWrite (FILE *f, void *buffer, int count); int LoadFile (char *filename, void **bufferptr, int offset, int length); int TryLoadFile (char *filename, void **bufferptr); void SaveFile (char *filename, void *buffer, int count); qboolean FileExists (char *filename); void DefaultExtension (char *path, char *extension); void DefaultPath (char *path, char *basepath); void StripFilename (char *path); void StripExtension (char *path); void ExtractFilePath (char *path, char *dest); void ExtractFileBase (char *path, char *dest); void ExtractFileExtension (char *path, char *dest); int ParseNum (char *str); short BigShort (short l); short LittleShort (short l); int BigLong (int l); int LittleLong (int l); float BigFloat (float l); float LittleFloat (float l); char *COM_Parse (char *data); extern char com_token[1024]; extern qboolean com_eof; char *copystring(char *s); void CRC_Init(unsigned short *crcvalue); void CRC_ProcessByte(unsigned short *crcvalue, byte data); unsigned short CRC_Value(unsigned short crcvalue); void CreatePath (char *path); void QCopyFile (char *from, char *to); extern qboolean archive; extern char archivedir[1024]; extern qboolean verbose; void qprintf (char *format, ...) __attribute__ ((format (printf, 1, 2))); void ExpandWildcards (int *argc, char ***argv); // for compression routines typedef struct { byte *data; int count; } cblock_t; #endif
/* d3des.h - * * Headers and defines for d3des.c * Graven Imagery, 1992. * * THIS SOFTWARE PLACED IN THE PUBLIC DOMAIN BY THE AUTHOUR * 920825 19:42 EDST * * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge * (GEnie : OUTER; CIS : [71755,204]) */ #undef D2_DES #undef D3_DES #ifdef D3_DES #ifndef D2_DES #define D2_DES /* D2_DES is needed for D3_DES */ #endif #endif #define EN0 0 /* MODE == encrypt */ #define DE1 1 /* MODE == decrypt */ /* Useful on 68000-ish machines, but NOT USED here. */ typedef union { unsigned long blok[2]; unsigned short word[4]; unsigned char byte[8]; } M68K; typedef union { unsigned long dblok[4]; unsigned short dword[8]; unsigned char dbyte[16]; } M68K2; extern void deskey(unsigned char *, short); /* hexkey[8] MODE * Sets the internal key register according to the hexadecimal * key contained in the 8 bytes of hexkey, according to the DES, * for encryption or decryption according to MODE. */ extern void usekey(unsigned long *); /* cookedkey[32] * Loads the internal key register with the data in cookedkey. */ extern void cpkey(unsigned long *); /* cookedkey[32] * Copies the contents of the internal key register into the storage * located at &cookedkey[0]. */ extern void des(unsigned char *, unsigned char *); /* from[8] to[8] * Encrypts/Decrypts (according to the key currently loaded in the * internal key register) one block of eight bytes at address 'from' * into the block at address 'to'. They can be the same. */ #ifdef D2_DES #define desDkey(a,b) des2key((a),(b)) extern void des2key(unsigned char *, short); /* hexkey[16] MODE * Sets the internal key registerS according to the hexadecimal * keyS contained in the 16 bytes of hexkey, according to the DES, * for DOUBLE encryption or decryption according to MODE. * NOTE: this clobbers all three key registers! */ extern void Ddes(unsigned char *, unsigned char *); /* from[8] to[8] * Encrypts/Decrypts (according to the keyS currently loaded in the * internal key registerS) one block of eight bytes at address 'from' * into the block at address 'to'. They can be the same. */ extern void D2des(unsigned char *, unsigned char *); /* from[16] to[16] * Encrypts/Decrypts (according to the keyS currently loaded in the * internal key registerS) one block of SIXTEEN bytes at address 'from' * into the block at address 'to'. They can be the same. */ extern void makekey(char *, unsigned char *); /* *password, single-length key[8] * With a double-length default key, this routine hashes a NULL-terminated * string into an eight-byte random-looking key, suitable for use with the * deskey() routine. */ #define makeDkey(a,b) make2key((a),(b)) extern void make2key(char *, unsigned char *); /* *password, double-length key[16] * With a double-length default key, this routine hashes a NULL-terminated * string into a sixteen-byte random-looking key, suitable for use with the * des2key() routine. */ #ifndef D3_DES /* D2_DES only */ #define useDkey(a) use2key((a)) #define cpDkey(a) cp2key((a)) extern void use2key(unsigned long *); /* cookedkey[64] * Loads the internal key registerS with the data in cookedkey. * NOTE: this clobbers all three key registers! */ extern voi cp2key(unsigned long *); /* cookedkey[64] * Copies the contents of the internal key registerS into the storage * located at &cookedkey[0]. */ #else /* D3_DES too */ #define useDkey(a) use3key((a)) #define cpDkey(a) cp3key((a)) extern void des3key(unsigned char *, short); /* hexkey[24] MODE * Sets the internal key registerS according to the hexadecimal * keyS contained in the 24 bytes of hexkey, according to the DES, * for DOUBLE encryption or decryption according to MODE. */ extern void use3key(unsigned long *); /* cookedkey[96] * Loads the 3 internal key registerS with the data in cookedkey. */ extern void cp3key(unsigned long *); /* cookedkey[96] * Copies the contents of the 3 internal key registerS into the storage * located at &cookedkey[0]. */ extern void make3key(char *, unsigned char *); /* *password, triple-length key[24] * With a triple-length default key, this routine hashes a NULL-terminated * string into a twenty-four-byte random-looking key, suitable for use with * the des3key() routine. */ #endif /* D3_DES */ #endif /* D2_DES */ /* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery ********************************************************************/
/* ide-build-system.h * * Copyright (C) 2015 Christian Hergert <christian@hergert.me> * * 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 IDE_BUILD_SYSTEM_H #define IDE_BUILD_SYSTEM_H #include <gio/gio.h> #include "ide-object.h" G_BEGIN_DECLS #define IDE_TYPE_BUILD_SYSTEM (ide_build_system_get_type()) G_DECLARE_INTERFACE (IdeBuildSystem, ide_build_system, IDE, BUILD_SYSTEM, IdeObject) struct _IdeBuildSystemInterface { GTypeInterface parent_iface; gint (*get_priority) (IdeBuildSystem *system); IdeBuilder *(*get_builder) (IdeBuildSystem *system, IdeConfiguration *configuration, GError **error); void (*get_build_flags_async) (IdeBuildSystem *self, IdeFile *file, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gchar **(*get_build_flags_finish) (IdeBuildSystem *self, GAsyncResult *result, GError **error); void (*get_build_targets_async) (IdeBuildSystem *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); GPtrArray *(*get_build_targets_finish) (IdeBuildSystem *self, GAsyncResult *result, GError **error); }; gint ide_build_system_get_priority (IdeBuildSystem *self); void ide_build_system_get_build_flags_async (IdeBuildSystem *self, IdeFile *file, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gchar **ide_build_system_get_build_flags_finish (IdeBuildSystem *self, GAsyncResult *result, GError **error); void ide_build_system_new_async (IdeContext *context, GFile *project_file, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); IdeBuildSystem *ide_build_system_new_finish (GAsyncResult *result, GError **error); IdeBuilder *ide_build_system_get_builder (IdeBuildSystem *system, IdeConfiguration *configuration, GError **error); void ide_build_system_get_build_targets_async (IdeBuildSystem *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); GPtrArray *ide_build_system_get_build_targets_finish (IdeBuildSystem *self, GAsyncResult *result, GError **error); G_END_DECLS #endif /* IDE_BUILD_SYSTEM_H */
#pragma once #include <glm/glm.hpp> #define PLAYER_RADIUS 0.23f #define PLAYER_STAND_HEIGHT 1.5f #define PLAYER_CROUCH_HEIGHT 0.9f /* eye offset is down from top of player capsule (height) */ #define EYE_OFFSET_Z 0.1f struct player { float angle; float elev; glm::vec3 pos; glm::vec3 dir; /* computed */ glm::vec3 eye; /* computed */ glm::vec2 move; float height; /* filled by physics */ unsigned int active_tool_slot; bool jump; bool use; bool cycle_mode; bool reset; bool crouch; bool crouch_end; bool gravity; bool use_tool; bool alt_use_tool; bool long_use_tool; bool long_alt_use_tool; bool ui_dirty; /* used within physics to toggle gravity */ bool disable_gravity; bool fire_projectile; };
/* * cmdlnopts.c - the only function that parce cmdln args and returns glob parameters * * Copyright 2013 Edward V. Emelianoff <eddy@sao.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 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. */ #include "cmdlnopts.h" #include "main.h" /* * here are global parameters initialisation */ glob_pars G; // internal global parameters structure int help = 0; // whether to show help string glob_pars Gdefault = { .videodev = "/dev/video0", .videochannel = 0, .listchannels = FALSE, .nodaemon = FALSE, .port = "54321", .nsum = 1, }; /* * Define command line options by filling structure: * name has_arg flag val type argptr help */ myoption cmdlnopts[] = { /// "ÏÔÏÂÒÁÚÉÔØ ÜÔÏ ÓÏÏÂÝÅÎÉÅ" {"help", 0, NULL, 'h', arg_int, APTR(&help), N_("show this help")}, /// "ÐÕÔØ Ë ÕÓÔÒÏÊÓÔ×Õ ×ÉÄÅÏÚÁÈ×ÁÔÁ" {"videodev",1, NULL, 'd', arg_string, APTR(&G.videodev), N_("input video device")}, /// "ÎÏÍÅÒ ËÁÎÁÌÁ ÚÁÈ×ÁÔÁ" {"channel", 1, NULL, 'n', arg_int, APTR(&G.videochannel),N_("capture channel number")}, /// "ÏÔÏÂÒÁÚÉÔØ ÄÏÓÔÕÐÎÙÊ ÓÐÉÓÏË ËÁÎÁÌÏ×" {"list-channels",0,NULL,'l', arg_none, APTR(&G.listchannels),N_("list avaiable channels")}, /// "ÎÅ ÐÅÒÅÈÏÄÉÔØ × ÆÏÎÏ×ÙÊ ÒÅÖÉÍ" {"foreground",0,NULL, 'f', arg_none, APTR(&G.nodaemon), N_("work in foreground")}, /// ÓÕÍÍÉÒÏ×ÁÔØ N ÉÚÏÂÒÁÖÅÎÉÊ {"sum", 1, NULL, 's', arg_int, APTR(&G.nsum), N_("sum N images")}, /// "ÎÏÍÅÒ ÐÏÒÔÁ" {"port", 1, NULL, 'p', arg_string, APTR(&G.port), N_("port number")}, // ... end_option }; /** * Parce command line options and return dynamically allocated structure * to global parameters * @param argc - copy of argc from main * @param argv - copy of argv from main * @return allocated structure with global parameters */ glob_pars *parce_args(int argc, char **argv){ int i; void *ptr; ptr = memcpy(&G, &Gdefault, sizeof(G)); assert(ptr); // ptr = memcpy(&M, &Mdefault, sizeof(M)); assert(ptr); // G.Mirror = &M; // format of help: "Usage: progname [args]\n" /// "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÁÒÇÕÍÅÎÔÙ]\n\n\tçÄÅ ÁÒÇÕÍÅÎÔÙ:\n" change_helpstring(_("Usage: %s [args]\n\n\tWhere args are:\n")); // parse arguments parceargs(&argc, &argv, cmdlnopts); if(help) showhelp(-1, cmdlnopts); if(argc > 0){ /// "éÇÎÏÒÉÒÕÀ ÁÒÇÕÍÅÎÔ[Ù]:" printf("\n%s\n", _("Ignore argument[s]:")); for (i = 0; i < argc; i++) printf("\t%s\n", argv[i]); } return &G; }
// From the software distribution accompanying the textbook // "A Practical Introduction to Data Structures and Algorithm Analysis, // Third Edition (C++)" by Clifford A. Shaffer. // Source code Copyright (C) 2007-2011 by Clifford A. Shaffer. // This is the file to include in your code if you want access to the // complete AList template class // First, get the declaration for the base list class #include "list.h" // This is the declaration for AList. It is split into two parts // because it is too big to fit on one book page template <typename E> // Array-based list implementation class AList : public List<E> { private: int maxSize; // Maximum size of list int listSize; // Number of list items now int curr; // Position of current element E* listArray; // Array holding list elements public: AList(int size=defaultSize) { // Constructor maxSize = size; listSize = curr = 0; listArray = new E[maxSize]; } ~AList() { delete [] listArray; } // Destructor void clear() { // Reinitialize the list delete [] listArray; // Remove the array listSize = curr = 0; // Reset the size listArray = new E[maxSize]; // Recreate array } // Insert "it" at current position void insert(const E& it) { Assert(listSize < maxSize, "List capacity exceeded"); for(int i=listSize; i>curr; i--) // Shift elements up listArray[i] = listArray[i-1]; // to make room listArray[curr] = it; listSize++; // Increment list size } void append(const E& it) { // Append "it" Assert(listSize < maxSize, "List capacity exceeded"); listArray[listSize++] = it; } // Remove and return the current element. E remove() { Assert((curr>=0) && (curr < listSize), "No element"); E it = listArray[curr]; // Copy the element for(int i=curr; i<listSize-1; i++) // Shift them down listArray[i] = listArray[i+1]; listSize--; // Decrement size return it; } void moveToStart() { curr = 0; } // Reset position void moveToEnd() { curr = listSize; } // Set at end void prev() { if (curr != 0) curr--; } // Back up void next() { if (curr < listSize) curr++; } // Next // Return list size int length() const { return listSize; } // Return current position int currPos() const { return curr; } // Set current list position to "pos" void moveToPos(int pos) { Assert ((pos>=0)&&(pos<=listSize), "Pos out of range"); curr = pos; } const E& getValue() const { // Return current element Assert((curr>=0)&&(curr<listSize),"No current element"); return listArray[curr]; } };
// // GitHubSignInViewController.h // Xenonscript // // Created by Chen Zhibo on 7/30/15. // Copyright © 2015 Chen Zhibo. All rights reserved. // #import <UIKit/UIKit.h> @interface GitHubSignInViewController : UITableViewController @end
/*************************************************************************** copyright : (C) 2002 - 2008 by Scott Wheeler email : wheeler@kde.org ***************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License version * * 2.1 as published by the Free Software Foundation. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * * 02110-1301 USA * * * * Alternatively, this file is available under the Mozilla Public * * License Version 1.1. You may obtain a copy of the License at * * http://www.mozilla.org/MPL/ * ***************************************************************************/ #ifndef TAGLIB_AUDIOPROPERTIES_H #define TAGLIB_AUDIOPROPERTIES_H #include "taglib_export.h" #include "tstring.h" namespace Strawberry_TagLib { namespace TagLib { //! A simple, abstract interface to common audio properties /*! * The values here are common to most audio formats. * For more specific, codec dependent values, please see see the subclasses APIs. * This is meant to compliment the TagLib::File and TagLib::Tag APIs in providing a simple * interface that is sufficient for most applications. */ class TAGLIB_EXPORT AudioProperties { public: /*! * Reading audio properties from a file can sometimes be very time consuming * and for the most accurate results can often involve reading the entire file. * Because in many situations speed is critical or the accuracy of the values * is not particularly important this allows the level of desired accuracy to be set. */ enum ReadStyle { //! Read as little of the file as possible Fast, //! Read more of the file and make better values guesses Average, //! Read as much of the file as needed to report accurate values Accurate }; /*! * Destroys this AudioProperties instance. */ virtual ~AudioProperties(); /*! * Returns the length of the file in seconds. The length is rounded down to the nearest whole second. * * \see lengthInMilliseconds() */ virtual int lengthInSeconds() const = 0; /*! * Returns the length of the file in milliseconds. * * \see lengthInSeconds() */ virtual int lengthInMilliseconds() const = 0; /*! * Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. * For variable bitrate formats this is either the average or nominal bitrate. */ virtual int bitrate() const = 0; /*! * Returns the sample rate in Hz. */ virtual int sampleRate() const = 0; /*! * Returns the number of audio channels. */ virtual int channels() const = 0; /*! * Returns description of the audio file. */ virtual String toString() const; protected: /*! * Construct an audio properties instance. * This is protected as this class should not be instantiated directly, * but should be instantiated via its subclasses and can be fetched from the FileRef or File APIs. */ explicit AudioProperties(); private: AudioProperties(const AudioProperties&); AudioProperties &operator=(const AudioProperties&); class AudioPropertiesPrivate; AudioPropertiesPrivate *d; }; } // namespace TagLib } // namespace Strawberry_TagLib #endif
/* * Copyright 2015 - 2021, GIBIS-Unifesp and the wiRedPanda contributors * SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef LOGICTFLIPFLOP_H #define LOGICTFLIPFLOP_H #include "logicelement.h" class LogicTFlipFlop : public LogicElement { public: explicit LogicTFlipFlop(); /* LogicElement interface */ protected: void _updateLogic(const std::vector<bool> &inputs) override; private: bool lastClk; bool lastValue; }; #endif // LOGICTFLIPFLOP_H
/* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-2002 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #include "zutil.h" struct internal_state {int dummy;}; /* for buggy compilers */ #ifndef STDC extern void exit OF((int)); #endif #ifndef PALMOS const char *z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; const char * ZEXPORT zlibVersion() { return ZLIB_VERSION; } #ifdef DEBUG # ifndef verbose # define verbose 0 # endif int z_verbose = verbose; void z_error (m) char *m; { fprintf(stderr, "%s\n", m); exit(1); } #endif /* exported to allow conversion of error code to string for compress() and * uncompress() */ const char * ZEXPORT zError(err) int err; { return ERR_MSG(err); } #ifndef HAVE_MEMCPY void zmemcpy(dest, source, len) Bytef* dest; const Bytef* source; uInt len; { if (len == 0) return; do { *dest++ = *source++; /* ??? to be unrolled */ } while (--len != 0); } int zmemcmp(s1, s2, len) const Bytef* s1; const Bytef* s2; uInt len; { uInt j; for (j = 0; j < len; j++) { if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; } return 0; } void zmemzero(dest, len) Bytef* dest; uInt len; { if (len == 0 || dest == Z_NULL) return; do { *dest++ = 0; /* ??? to be unrolled */ } while (--len != 0); } #endif #endif #ifdef __TURBOC__ #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) /* Small and medium model in Turbo C are for now limited to near allocation * with reduced MAX_WBITS and MAX_MEM_LEVEL */ # define MY_ZCALLOC /* Turbo C malloc() does not allow dynamic allocation of 64K bytes * and farmalloc(64K) returns a pointer with an offset of 8, so we * must fix the pointer. Warning: the pointer must be put back to its * original form in order to free it, use zcfree(). */ #define MAX_PTR 10 /* 10*64K = 640K */ local int next_ptr = 0; typedef struct ptr_table_s { voidpf org_ptr; voidpf new_ptr; } ptr_table; local ptr_table table[MAX_PTR]; /* This table is used to remember the original form of pointers * to large buffers (64K). Such pointers are normalized with a zero offset. * Since MSDOS is not a preemptive multitasking OS, this table is not * protected from concurrent access. This hack doesn't work anyway on * a protected system like OS/2. Use Microsoft C instead. */ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) { voidpf buf = opaque; /* just to make some compilers happy */ ulg bsize = (ulg)items*size; /* If we allocate less than 65520 bytes, we assume that farmalloc * will return a usable pointer which doesn't have to be normalized. */ if (bsize < 65520L) { buf = farmalloc(bsize); if (*(ush*)&buf != 0) return buf; } else { buf = farmalloc(bsize + 16L); } if (buf == NULL || next_ptr >= MAX_PTR) return NULL; table[next_ptr].org_ptr = buf; /* Normalize the pointer to seg:0 */ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; *(ush*)&buf = 0; table[next_ptr++].new_ptr = buf; return buf; } void zcfree (voidpf opaque, voidpf ptr) { int n; if (*(ush*)&ptr != 0) { /* object < 64K */ farfree(ptr); return; } /* Find the original pointer */ for (n = 0; n < next_ptr; n++) { if (ptr != table[n].new_ptr) continue; farfree(table[n].org_ptr); while (++n < next_ptr) { table[n-1] = table[n]; } next_ptr--; return; } ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } #endif #endif /* __TURBOC__ */ #if defined(M_I86) && !defined(__32BIT__) /* Microsoft C in 16-bit mode */ # define MY_ZCALLOC #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) # define _halloc halloc # define _hfree hfree #endif voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) { if (opaque) opaque = 0; /* to make compiler happy */ return _halloc((long)items, size); } void zcfree (voidpf opaque, voidpf ptr) { if (opaque) opaque = 0; /* to make compiler happy */ _hfree(ptr); } #endif /* MSC */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif voidpf zcalloc (opaque, items, size) voidpf opaque; unsigned items; unsigned size; { #ifndef PALMOS if (opaque) items += size - size; /* make compiler happy */ return (voidpf)calloc(items, size); #else voidpf x; UInt32 free, max; x = (voidpf) malloc(items*size); if(x == Z_NULL) { MemHeapFreeBytes(0, &free, &max); if(items*size > max) MemHeapCompact(0); MemHeapFreeBytes(0, &free, &max); if(max >= size) x = (voidpf) malloc(items*size); } if(x != Z_NULL) zmemzero(x,items*size); return x; #endif } void zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { free(ptr); if (opaque) return; /* make compiler happy */ } #endif /* MY_ZCALLOC */
/* Properties of Unicode characters. Copyright (C) 2002, 2006-2007, 2009-2014 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include "unictype.h" #include "bitmap.h" /* Define u_property_pattern_syntax table. */ #include "pr_pattern_syntax.h" bool uc_is_property_pattern_syntax (ucs4_t uc) { return bitmap_lookup (&u_property_pattern_syntax, uc); } const uc_property_t UC_PROPERTY_PATTERN_SYNTAX = { &uc_is_property_pattern_syntax };
#include <stdio.h> int main(void){ int key=911; int *p_addr=NULL; p_addr=&key; printf("If I know the name of the variable,I can get it's value by name: %d\n",key); printf("If I know the address of the variable is %x,then I also can get it's value by address: %d\n",p_addr,*p_addr); return 0; }
#ifndef TRUNCATIONOPTIONWINDOW_H_ #define TRUNCATIONOPTIONWINDOW_H_ #include "../ui_truncationOptionWindow.h" #include <QtGui> #include <QDialog> class TruncationOptionWindow : public QDialog { Q_OBJECT public: TruncationOptionWindow(QWidget *parent); TruncationOptionWindow(const std::vector<int> &vect_truncation_option, const QStringList &list_cycles, const QStringList &list_groups, QWidget *parent = 0); ~TruncationOptionWindow(); QPushButton *getApplyButton(); bool isCycleButtonSelected(); bool isGroupButtonSelected(); int getCycleIndex(); int getGroupIndex(); private slots: void switchBoxes(int i); void resetTruncationOptionWindow(); private: // attributes Ui::TruncationOptionWindow ui_truncationOption; QStringList m_list_cycles; QStringList m_list_groups; void initTruncationOptionWindow(const std::vector<int> &vect_truncation_option); }; #endif /* TRUNCATIONOPTIONWINDOW_H_ */
/* p0f - type definitions and minor macros --------------------------------------- Copyright (C) 2012 by Michal Zalewski <lcamtuf@coredump.cx> Distributed under the terms and conditions of GNU LGPL. */ #ifndef _HAVE_TYPES_H #define _HAVE_TYPES_H #include <stdint.h> typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; #ifndef MIN # define MIN(_a,_b) ((_a) > (_b) ? (_b) : (_a)) # define MAX(_a,_b) ((_a) > (_b) ? (_a) : (_b)) #endif /* !MIN */ /* Macros for non-aligned memory access. */ #ifdef ALIGN_ACCESS # include <string.h> # define RD16(_val) ({ u16 _ret; memcpy(&_ret, &(_val), 2); _ret; }) # define RD32(_val) ({ u32 _ret; memcpy(&_ret, &(_val), 4); _ret; }) # define RD16p(_ptr) ({ u16 _ret; memcpy(&_ret, _ptr, 2); _ret; }) # define RD32p(_ptr) ({ u32 _ret; memcpy(&_ret, _ptr, 4); _ret; }) #else # define RD16(_val) ((u16)_val) # define RD32(_val) ((u32)_val) # define RD16p(_ptr) (*((u16*)(_ptr))) # define RD32p(_ptr) (*((u32*)(_ptr))) #endif /* ^ALIGN_ACCESS */ #endif /* ! _HAVE_TYPES_H */
/* EEPROM based configuration data storage structure Whole flight controller configuration is being stored inside an CONFIG structure that can be accesed as data union (which is required for easy manipulation with the configuration data over serial and easy way of storing this data in EEPROM). This method allow us to do "smart" memory checking with the new data against data stored in EEPROM, which means we doesn't have to re-write whole configuration union inside the EEPROM, but we just modify bytes that changed. This will protect EEPROM from unnecessary writes, extending its lifetime (because EEPROM writes are limited, actual number of writes depends on the chip). */ #if defined(__MK20DX128__) #define EEPROM_SIZE 512 #endif /*ToDo: check the real size for the MK20DX256 */ #if defined(__MK20DX256__) #define EEPROM_SIZE 512 //ToDo: Check this value, I expect 2048 #endif #define EEPROM_VERSION 5 struct AXIS_MAP_struct { uint8_t axis1:2; uint8_t axis1_sign:1; uint8_t axis2:2; uint8_t axis2_sign:1; uint8_t axis3:2; uint8_t axis3_sign:1; uint8_t initialized:1; }; struct __attribute__((packed)) CONFIG_struct { uint8_t version; bool calibrateESC; uint16_t minimumArmedThrottle; // Sensor axis map struct AXIS_MAP_struct GYRO_AXIS_MAP; struct AXIS_MAP_struct ACCEL_AXIS_MAP; struct AXIS_MAP_struct MAG_AXIS_MAP; // Accelerometer int16_t ACCEL_BIAS[3]; // RX uint8_t CHANNEL_ASSIGNMENT[16]; uint64_t CHANNEL_FUNCTIONS[4]; // Attitude float PID_YAW_c[4]; float PID_PITCH_c[4]; float PID_ROLL_c[4]; // Rate float PID_YAW_m[4]; float PID_PITCH_m[4]; float PID_ROLL_m[4]; float PID_BARO[4]; float PID_SONAR[4]; // GPS float PID_GPS[4]; }; union CONFIG_union { struct CONFIG_struct data; uint8_t raw[sizeof(struct CONFIG_struct)]; }; CONFIG_union CONFIG; void initializeEEPROM(void) { // Default settings should be initialized here CONFIG.data.version = EEPROM_VERSION; CONFIG.data.calibrateESC = 0; CONFIG.data.minimumArmedThrottle = 1100; // Accelerometer CONFIG.data.ACCEL_BIAS[XAXIS] = 0; CONFIG.data.ACCEL_BIAS[YAXIS] = 0; CONFIG.data.ACCEL_BIAS[ZAXIS] = 0; // RX CONFIG.data.CHANNEL_ASSIGNMENT[0] = 0; CONFIG.data.CHANNEL_ASSIGNMENT[1] = 1; CONFIG.data.CHANNEL_ASSIGNMENT[2] = 2; CONFIG.data.CHANNEL_ASSIGNMENT[3] = 3; CONFIG.data.CHANNEL_ASSIGNMENT[4] = 4; CONFIG.data.CHANNEL_ASSIGNMENT[5] = 5; CONFIG.data.CHANNEL_ASSIGNMENT[6] = 6; CONFIG.data.CHANNEL_ASSIGNMENT[7] = 7; CONFIG.data.CHANNEL_ASSIGNMENT[8] = 8; CONFIG.data.CHANNEL_ASSIGNMENT[9] = 9; CONFIG.data.CHANNEL_ASSIGNMENT[10] = 10; CONFIG.data.CHANNEL_ASSIGNMENT[11] = 11; CONFIG.data.CHANNEL_ASSIGNMENT[12] = 12; CONFIG.data.CHANNEL_ASSIGNMENT[13] = 13; CONFIG.data.CHANNEL_ASSIGNMENT[14] = 14; CONFIG.data.CHANNEL_ASSIGNMENT[15] = 15; CONFIG.data.CHANNEL_FUNCTIONS[0] = 0x04; // mode select ("stable mode" is set to trigger on AUX1-HIGH by default) CONFIG.data.CHANNEL_FUNCTIONS[1] = 0x00; // baro select CONFIG.data.CHANNEL_FUNCTIONS[2] = 0x00; // sonar select CONFIG.data.CHANNEL_FUNCTIONS[3] = 0x00; // GPS select // Altitude CONFIG.data.PID_YAW_c[P] = 4.0; CONFIG.data.PID_YAW_c[I] = 0.0; CONFIG.data.PID_YAW_c[D] = 0.0; CONFIG.data.PID_YAW_c[WG] = 25.0; CONFIG.data.PID_PITCH_c[P] = 4.0; CONFIG.data.PID_PITCH_c[I] = 0.0; CONFIG.data.PID_PITCH_c[D] = 0.0; CONFIG.data.PID_PITCH_c[WG] = 25.0; CONFIG.data.PID_ROLL_c[P] = 4.0; CONFIG.data.PID_ROLL_c[I] = 0.0; CONFIG.data.PID_ROLL_c[D] = 0.0; CONFIG.data.PID_ROLL_c[WG] = 25.0; // Rate CONFIG.data.PID_YAW_m[P] = 200.0; CONFIG.data.PID_YAW_m[I] = 5.0; CONFIG.data.PID_YAW_m[D] = 0.0; CONFIG.data.PID_YAW_m[WG] = 100.0; CONFIG.data.PID_PITCH_m[P] = 80.0; CONFIG.data.PID_PITCH_m[I] = 0.0; CONFIG.data.PID_PITCH_m[D] = -3.0; CONFIG.data.PID_PITCH_m[WG] = 1000.0; CONFIG.data.PID_ROLL_m[P] = 80.0; CONFIG.data.PID_ROLL_m[I] = 0.0; CONFIG.data.PID_ROLL_m[D] = -3.0; CONFIG.data.PID_ROLL_m[WG] = 1000.0; // Baro CONFIG.data.PID_BARO[P] = 25.0; CONFIG.data.PID_BARO[I] = 0.6; CONFIG.data.PID_BARO[D] = -1.0; CONFIG.data.PID_BARO[WG] = 25.0; // Sonar CONFIG.data.PID_SONAR[P] = 50.0; CONFIG.data.PID_SONAR[I] = 0.6; CONFIG.data.PID_SONAR[D] = -1.0; CONFIG.data.PID_SONAR[WG] = 25.0; // GPS CONFIG.data.PID_GPS[P] = 0.0; CONFIG.data.PID_GPS[I] = 0.0; CONFIG.data.PID_GPS[D] = 0.0; CONFIG.data.PID_GPS[WG] = 0.0; // This function will only initialize data variables // writeEEPROM() needs to be called manually to store this data in EEPROM } void writeEEPROM(void) { for (uint16_t i = 0; i < sizeof(struct CONFIG_struct); i++) { if (CONFIG.raw[i] != EEPROM.read(i)) { // Only re-write new data // blocks containing the same value will be left alone EEPROM.write(i, CONFIG.raw[i]); } } } void readEEPROM(void) { if (EEPROM.read(0) == 255) { // No EEPROM values detected, re-initialize initializeEEPROM(); } else { // There "is" data in the EEPROM, read it all for (uint16_t i = 0; i < sizeof(struct CONFIG_struct); i++) { CONFIG.raw[i] = EEPROM.read(i); } // Verify version if (CONFIG.data.version != EEPROM_VERSION) { // Version doesn't match, re-initialize initializeEEPROM(); } } }
/** * @file memory.c * @brief Keyboard management * @author Victor Borges * @date Mar 15, 2011 */ struct kb_stream { volatile char stream[256]; unsigned int size; }; extern struct kb_stream kb_cache; /** * Setup keyboard **/ result kb_setup();
/***************************************************************************** This file is part of QSS Solver. QSS Solver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QSS Solver is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with QSS Solver. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ #ifndef QSS_DT_H_ #define QSS_DT_H_ #ifdef __linux__ #include <pthread.h> #endif #include <common/data.h> #include <common/utils.h> #include <qss/qss_data.h> /** * @brief \f $ \delta t $ \f synchronization object. */ typedef struct QSS_dtSynch_ *QSS_dtSynch; /** * @brief \f $ \delta t $ \f synchronization data structure. */ struct QSS_dtSynch_ { int synch; //!< Synchronization flag for \f $ \delta t $ \f update. int activeLPS; //!< Number of active LPs in the simulation. double t; double elapsed; #ifdef __linux__ pthread_mutex_t activeMutex; //!< Active LPS mutex. pthread_barrier_t b; //!< \f $ \delta t $ \f synchronization barrier. #endif }; /** * @brief \f $ \delta t $ \f Synchronization constructor. * * @param lps Number of LPs defined in the simulation. * @return New \f $ \delta t $ \f synchronization object. */ QSS_dtSynch QSS_DtSynch(int lps); /** * @brief \f $ \delta t $ \f Synchronization destructor. * * @param dtSynch Object to destroy. */ void QSS_freeDtSynch(QSS_dtSynch dtSynch); /** * */ typedef struct QSS_dtOps_ *QSS_dtOps; /** * */ typedef struct QSS_dtState_ *QSS_dtState; /** * */ typedef struct QSS_dt_ *QSS_dt; /** * * @param * @param * @param * @param * @param */ typedef bool (*QSS_dtLogOutputFn)(QSS_dt, double, double, double, int); typedef bool (*QSS_dtLogStepFn)(QSS_dt, double, double, double); /** * */ struct QSS_dtOps_ { QSS_dtLogStepFn logStep; //!< QSS_dtLogOutputFn logOutput; //!< }; /** * */ struct QSS_dtState_ { double *dtOpt; //!< Optimum dt calculated for each LP output variable. double *gblDtMin; //!< Global vector with the values of the average step time of all lps defiend. double dtMin; //!< Local dt minimum. double dt; //!< \f $\delta t $ \f current global value. double alpha; double dtUpperBound; //!< Upper bound for asynchronous \f $ \delta t $ \f update strategy. double dtLowerBound; //!< Lower bound for asynchronous \f $ \delta t $ \f update strategy. int *synch; //!< Synchronization flag for the \f $ \delta t $ \f update. int id; //!< LP number used to set the bit vector. int lps; //!< Total number of LPs defined. int outputs; //!< Number of output variables in the LP. int dtMinIndex; //!< Index of the output variable that contains the local minimum for the LP. int dtGlobalLP; int simSteps; int dtChanges; double avgDt; double lastChange; double *t; //!< Current simulation time. double *elapsed; //!< Elapsed time. double simTime; //!< Total simulation time. SD_DtSynch strategy; QSS_idxMap dscMap; QSS_idxMap qMap; SD_simulationLog log; SD_Debug debug; QSS_time time; #ifdef __linux__ pthread_barrier_t *b; //!< Barrier used for synchronization. #endif }; /** * */ struct QSS_dt_ { QSS_dtOps ops; //!< QSS_dtState state; //!< }; /** * * @param synch * @param alpha * @param outputs * @param gblDtMin * @param id * @param dtSynch * @return */ QSS_dt QSS_Dt(double *gblDtMin, int id, QSS_dtSynch dtSynch, char *file, SD_Debug debug, QSS_data data, QSS_time time); /** * * @param dt */ void QSS_freeDt(QSS_dt dt); /** * * @return */ QSS_dtOps QSS_DtOps(); /** * * @param ops */ void QSS_freeDtOps(QSS_dtOps ops); /** * * @return */ QSS_dtState QSS_DtState(); /** * * @param state */ void QSS_freeDtState(QSS_dtState state); bool QSS_dtLogOutput(QSS_dt dt, double Dq, double Dx, double Dt, int variable); /** * @brief \f $ \delta t $ \f value wrapper. * * @param \f $ \delta t $ \f data structure. * @return \f $ \delta t $ \f value. */ double QSS_dtValue(QSS_dt dt); /** * * @param dt */ void QSS_dtFinish(QSS_dt dt); void QSS_dtUpdate(QSS_dt dt); /** * * @param dt * @return */ bool QSS_dtLogStep(QSS_dt dt, double Dq, double Dx, double Dt); void QSS_dtCheck(QSS_dt dt); #endif /* QSS_DT_H_ */
/* server.c --- SASL mechanism SECURID from RFC 2808, server side. * Copyright (C) 2002-2012 Simon Josefsson * * This file is part of GNU SASL Library. * * GNU SASL Library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * GNU SASL Library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with GNU SASL Library; if not, write to the Free * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* Get specification. */ #include "securid.h" /* Get malloc, free. */ #include <stdlib.h> /* Get memchr, strdup, strlen. */ #include <string.h> #define PASSCODE "passcode" #define PIN "pin" int _gsasl_securid_server_step (Gsasl_session * sctx, void *mech_data, const char *input, size_t input_len, char **output, size_t * output_len) { const char *authorization_id = NULL; const char *authentication_id = NULL; const char *passcode = NULL; const char *suggestedpin; char *pin = NULL; int res; size_t len; if (input_len == 0) { *output_len = 0; *output = NULL; return GSASL_NEEDS_MORE; } authorization_id = input; authentication_id = memchr (input, '\0', input_len - 1); if (authentication_id) { authentication_id++; passcode = memchr (authentication_id, '\0', input_len - strlen (authorization_id) - 1 - 1); if (passcode) { passcode++; pin = memchr (passcode, '\0', input_len - strlen (authorization_id) - 1 - strlen (authentication_id) - 1 - 1); if (pin) { pin++; if (pin && !*pin) pin = NULL; } } } if (passcode == NULL) return GSASL_MECHANISM_PARSE_ERROR; gsasl_property_set (sctx, GSASL_AUTHID, authentication_id); gsasl_property_set (sctx, GSASL_AUTHZID, authorization_id); gsasl_property_set (sctx, GSASL_PASSCODE, passcode); if (pin) gsasl_property_set (sctx, GSASL_PIN, pin); else gsasl_property_set (sctx, GSASL_PIN, NULL); res = gsasl_callback (NULL, sctx, GSASL_VALIDATE_SECURID); switch (res) { case GSASL_SECURID_SERVER_NEED_ADDITIONAL_PASSCODE: *output = strdup (PASSCODE); if (!*output) return GSASL_MALLOC_ERROR; *output_len = strlen (PASSCODE); res = GSASL_NEEDS_MORE; break; case GSASL_SECURID_SERVER_NEED_NEW_PIN: suggestedpin = gsasl_property_get (sctx, GSASL_SUGGESTED_PIN); if (suggestedpin) len = strlen (suggestedpin); else len = 0; *output_len = strlen (PIN) + len; *output = malloc (*output_len); if (!*output) return GSASL_MALLOC_ERROR; memcpy (*output, PIN, strlen (PIN)); if (suggestedpin) memcpy (*output + strlen (PIN), suggestedpin, len); res = GSASL_NEEDS_MORE; break; default: *output_len = 0; *output = NULL; break; } return res; }
/* Check UTF-32 string. Copyright (C) 2002, 2006, 2009-2014 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include "unistr.h" const uint32_t * u32_check (const uint32_t *s, size_t n) { const uint32_t *s_end = s + n; while (s < s_end) { uint32_t c = *s; if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) s++; else /* invalid Unicode character */ return s; } return NULL; }
/* Copyright (C) 2013 Thomas MAURICE 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. */ /** \file macros.h \brief Definition of some useful macros \author Thomas Maurice \version 0.3 */ #ifndef MACROS_HEADER #define MACROS_HEADER #if defined (linux) #define DllExport #elif defined (WIN32) #define DllExport __declspec(dllexport) #endif /** \def OBJ_TO_VOID(obj, out) Convert an object into a pointer to void */ #define OBJ_TO_VOID(obj, out) void *out = (void*)obj; /** \def VOID_TO_OBJ(vd, type, out) Convert a pointer to void to a pointer to an object */ #define VOID_TO_OBJ(vd, type, out) type *out = (type*)vd; /** \def CHECK_UDATA(Type,Func,Meta) Creates a function that checks that the lua type is correct and return the good userdata pointer */ #define CHECK_UDATA(Type,Func,Meta) \ Type * Func(lua_State * L, int i) \ {\ void *ud = luaL_checkudata(L, i, Meta);\ luaL_argcheck(L, ud != NULL, i, std::string(std::string(Meta)+ "expected").c_str());\ return (Type*)ud;\ } /** \def CHECK_UDATA_H(Type,Func) Creates a function declaration for the macro above */ #define CHECK_UDATA_H(Type,Func) \ Type * Func(lua_State * L, int i = 1); #endif
/** @file init.c * * Legato framework library constructor implementation. * * Copyright (C) Sierra Wireless Inc. */ #include "legato.h" #include "args.h" #include "atomFile.h" #include "eventLoop.h" #include "fs.h" #include "json.h" #include "killProc.h" #include "log.h" #include "mem.h" #include "messaging.h" #include "pathIter.h" #include "pipeline.h" #include "properties.h" #include "rand.h" #include "safeRef.h" #include "signals.h" #include "test.h" #include "thread.h" #include "timer.h" //-------------------------------------------------------------------------------------------------- /** * Initializes the Legato framework library. * * The linker/loader will automatically run this function when the library is loaded into a * process's address space at runtime. * * It initializes all the individual module in the framework in the correct order. * * @note * On failure, the process exits. */ //-------------------------------------------------------------------------------------------------- __attribute__((constructor)) void _legato_InitFramework ( void ) { // The order of initialization is important. Ideally, logging would be initialized first, // because before that, any logging calls will report the wrong component, and pretty much // everything uses logging. However, the logging uses memory pools, so memory pools must be // initialized before logging. Fortunately, most logging macros work even if log_Init() // hasn't been called yet. Keep it that way. Also, be careful when using logging inside // the memory pool module, because there is the risk of creating infinite recursion. rand_Init(); // Does not use any other resource. Initialize first so that randomness is // available for other modules' initialization. mem_Init(); // Many things rely on memory pools, so initialize them as soon as possible. log_Init(); // Uses memory pools. sig_Init(); // Uses memory pools. safeRef_Init(); // Uses memory pools and hash maps. pathIter_Init(); // Uses memory pools and safe references. mutex_Init(); // Uses memory pools. sem_Init(); // Uses memory pools. event_Init(); // Uses memory pools. timer_Init(); // Uses event loop. thread_Init(); // Uses event loop, memory pools and safe references. arg_Init(); // Uses memory pools. msg_Init(); // Uses event loop. kill_Init(); // Uses memory pools and timers. properties_Init(); // Uses memory pools and safe references. #if LE_CONFIG_ENABLE_LE_JSON_API json_Init(); // Uses memory pools. #endif pipeline_Init(); // Uses memory pools and FD Monitors. atomFile_Init(); // Uses memory pools. fs_Init(); // Uses memory pools and safe references. test_Init(); // Initialize test infrastructure last. // This must be called last, because it calls several subsystems to perform the // thread-specific initialization for the main thread. thread_InitThread(); } //-------------------------------------------------------------------------------------------------- /** * Initializes the Legato framework library. * * Applications should call this function explicitly when liblegato is linked statically. * * @note * The constructor initalizes the library. Application need to call this function only * to not get optimized out. */ //-------------------------------------------------------------------------------------------------- void InitFramework ( void ) { // Do nothing }
#include "sort.h" #include <stdlib.h> void rList_sort(struct rListDescriptor *desc,int (*cmpr)(void* a,void* b)){ rListIterator infolist=desc->first; if(desc->first == NULL) return; int FLAG_SORTED=0; while(!FLAG_SORTED){ FLAG_SORTED=1; struct rListNode* iterator=infolist->next,*previtem=infolist; while(iterator!=NULL){ if(cmpr(previtem->data,iterator->data)){ rList_swapElem(desc,iterator,previtem,1); infolist=desc->first; FLAG_SORTED=0; break; } iterator=iterator->next; previtem=previtem->next; } } }
/* ========================================================================= zprototest_msg - zprototest example protocol Codec header for zprototest_msg. ** WARNING ************************************************************* THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose your changes at the next build cycle. This is great for temporary printf statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places for commits are: * The XML model used for this code generation: zprototest_msg.xml * The code generation script that built this file: zproto_codec_c ************************************************************************ ========================================================================= */ #ifndef __ZPROTOTEST_MSG_H_INCLUDED__ #define __ZPROTOTEST_MSG_H_INCLUDED__ /* These are the zprototest_msg messages: TESTMESSAGE - Test message. msgid number 4 Message id message string Message data testint number 4 Test member */ #define ZPROTOTEST_MSG_TESTMESSAGE 1 #ifdef __cplusplus extern "C" { #endif // Opaque class structure typedef struct _zprototest_msg_t zprototest_msg_t; // @interface // Create a new zprototest_msg zprototest_msg_t * zprototest_msg_new (int id); // Destroy the zprototest_msg void zprototest_msg_destroy (zprototest_msg_t **self_p); // Parse a zprototest_msg from zmsg_t. Returns a new object, or NULL if // the message could not be parsed, or was NULL. Destroys msg and // nullifies the msg reference. zprototest_msg_t * zprototest_msg_decode (zmsg_t **msg_p); // Encode zprototest_msg into zmsg and destroy it. Returns a newly created // object or NULL if error. Use when not in control of sending the message. zmsg_t * zprototest_msg_encode (zprototest_msg_t **self_p); // Receive and parse a zprototest_msg from the socket. Returns new object, // or NULL if error. Will block if there's no message waiting. zprototest_msg_t * zprototest_msg_recv (void *input); // Receive and parse a zprototest_msg from the socket. Returns new object, // or NULL either if there was no input waiting, or the recv was interrupted. zprototest_msg_t * zprototest_msg_recv_nowait (void *input); // Send the zprototest_msg to the output, and destroy it int zprototest_msg_send (zprototest_msg_t **self_p, void *output); // Send the zprototest_msg to the output, and do not destroy it int zprototest_msg_send_again (zprototest_msg_t *self, void *output); // Encode the TESTMESSAGE zmsg_t * zprototest_msg_encode_testmessage ( uint32_t msgid, const char *message, uint32_t testint); // Send the TESTMESSAGE to the output in one step // WARNING, this call will fail if output is of type ZMQ_ROUTER. int zprototest_msg_send_testmessage (void *output, uint32_t msgid, const char *message, uint32_t testint); // Duplicate the zprototest_msg message zprototest_msg_t * zprototest_msg_dup (zprototest_msg_t *self); // Print contents of message to stdout void zprototest_msg_print (zprototest_msg_t *self); // Get/set the message routing id zframe_t * zprototest_msg_routing_id (zprototest_msg_t *self); void zprototest_msg_set_routing_id (zprototest_msg_t *self, zframe_t *routing_id); // Get the zprototest_msg id and printable command int zprototest_msg_id (zprototest_msg_t *self); void zprototest_msg_set_id (zprototest_msg_t *self, int id); const char * zprototest_msg_command (zprototest_msg_t *self); // Get/set the msgid field uint32_t zprototest_msg_msgid (zprototest_msg_t *self); void zprototest_msg_set_msgid (zprototest_msg_t *self, uint32_t msgid); // Get/set the message field const char * zprototest_msg_message (zprototest_msg_t *self); void zprototest_msg_set_message (zprototest_msg_t *self, const char *format, ...); // Get/set the testint field uint32_t zprototest_msg_testint (zprototest_msg_t *self); void zprototest_msg_set_testint (zprototest_msg_t *self, uint32_t testint); // Self test of this class int zprototest_msg_test (bool verbose); // @end // For backwards compatibility with old codecs #define zprototest_msg_dump zprototest_msg_print #ifdef __cplusplus } #endif #endif
/* atanhl.c * * Inverse hyperbolic tangent, long double precision * * * * SYNOPSIS: * * long double x, y, atanhl(); * * y = atanhl( x ); * * * * DESCRIPTION: * * Returns inverse hyperbolic tangent of argument in the range * MINLOGL to MAXLOGL. * * If |x| < 0.5, the rational form x + x**3 P(x)/Q(x) is * employed. Otherwise, * atanh(x) = 0.5 * log( (1+x)/(1-x) ). * * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE -1,1 30000 1.1e-19 3.3e-20 * */ /* Cephes Math Library Release 2.7: May, 1998 Copyright (C) 1987, 1991, 1998 by Stephen L. Moshier */ #include "mconf.h" #ifdef UNK static long double P[] = { 2.9647757819596835680719E-3L, -8.0026596513099094380633E-1L, 7.7920941408493040219831E0L, -2.4330686602187898836837E1L, 3.0204265014595622991082E1L, -1.2961142942114056581210E1L, }; static long double Q[] = { /* 1.0000000000000000000000E0L,*/ -1.3729634163247557081869E1L, 6.2320841104088512332185E1L, -1.2469344457045341444078E2L, 1.1394285233959210574352E2L, -3.8883428826342169425890E1L, }; #endif #ifdef IBMPC static short P[] = { 0x3aa2,0x036b,0xaf06,0xc24c,0x3ff6, XPD 0x528e,0x56e8,0x3af4,0xccde,0xbffe, XPD 0x9d89,0xc9a1,0xd5cf,0xf958,0x4001, XPD 0xa653,0x6cfa,0x3f04,0xc2a5,0xc003, XPD 0xc651,0x2b3d,0x55b2,0xf1a2,0x4003, XPD 0xd76d,0xf293,0xd76b,0xcf60,0xc002, XPD }; static short Q[] = { /*0x0000,0x0000,0x0000,0x8000,0x3fff,*/ 0xd1b9,0x5314,0x94df,0xdbac,0xc002, XPD 0x3caa,0x0517,0x8a92,0xf948,0x4004, XPD 0x535e,0xaf5f,0x0b2a,0xf963,0xc005, XPD 0xa6f9,0xb702,0xbd8a,0xe3e2,0x4005, XPD 0xe136,0xf5ee,0xa190,0x9b88,0xc004, XPD }; #endif #ifdef MIEEE static long P[] = { 0x3ff60000,0xc24caf06,0x036b3aa2, 0xbffe0000,0xccde3af4,0x56e8528e, 0x40010000,0xf958d5cf,0xc9a19d89, 0xc0030000,0xc2a53f04,0x6cfaa653, 0x40030000,0xf1a255b2,0x2b3dc651, 0xc0020000,0xcf60d76b,0xf293d76d, }; static long Q[] = { /*0x3fff0000,0x80000000,0x00000000,*/ 0xc0020000,0xdbac94df,0x5314d1b9, 0x40040000,0xf9488a92,0x05173caa, 0xc0050000,0xf9630b2a,0xaf5f535e, 0x40050000,0xe3e2bd8a,0xb702a6f9, 0xc0040000,0x9b88a190,0xf5eee136, }; #endif extern long double MAXNUML; #ifdef ANSIPROT extern long double fabsl ( long double ); extern long double logl ( long double ); extern long double polevll ( long double, void *, int ); extern long double p1evll ( long double, void *, int ); #else long double fabsl(), logl(), polevll(), p1evll(); #endif #ifdef INFINITIES extern long double INFINITYL; #endif #ifdef NANS extern long double NANL; #endif long double atanhl(x) long double x; { long double s, z; #ifdef MINUSZERO if( x == 0.0L ) return(x); #endif z = fabsl(x); if( z >= 1.0L ) { if( x == 1.0L ) { #ifdef INFINITIES return( INFINITYL ); #else return( MAXNUML ); #endif } if( x == -1.0L ) { #ifdef INFINITIES return( -INFINITYL ); #else return( -MAXNUML ); #endif } mtherr( "atanhl", DOMAIN ); #ifdef NANS return( NANL ); #else return( MAXNUML ); #endif } if( z < 1.0e-8L ) return(x); if( z < 0.5L ) { z = x * x; s = x + x * z * (polevll(z, P, 5) / p1evll(z, Q, 5)); return(s); } return( 0.5L * logl((1.0L+x)/(1.0L-x)) ); }
/* * This file is part of Espruino, a JavaScript interpreter for Microcontrollers * * Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> * * 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/. * * ---------------------------------------------------------------------------- * JavaScript OneWire Functions * ---------------------------------------------------------------------------- */ #include "jsvar.h" #include "jspin.h" JsVar *jswrap_onewire_constructor(Pin pin); bool jswrap_onewire_reset(JsVar *parent); void jswrap_onewire_select(JsVar *parent, JsVar *rom); void jswrap_onewire_skip(JsVar *parent); void jswrap_onewire_write(JsVar *parent, int data, bool leavePowerOn); JsVarInt jswrap_onewire_read(JsVar *parent); JsVar *jswrap_onewire_search(JsVar *parent, int command);
#include "legato.h" #include "interfaces.h" COMPONENT_INIT { int result = foo_f(); if (result == 1234) { printf("C1 result = %d\n", result); } else { fprintf(stderr, "Got incorrect result! Expected 1234, got %d.\n", result); } }
/********************************************************************** ** Copyright (C) 2014 vell001 ** Author: VellBibi ** Description: ** **********************************************************************/ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QStandardItemModel> #include <QDebug> #include <QHash> #include <QSystemTrayIcon> #include <QMenu> #include <QCloseEvent> #include <QMessageBox> #include <QTableWidget> #include "service/UserInfoService.h" #include "service/ChatService.h" #include "service/UserService.h" #include "model/User.h" #include "ChatForm.h" #include "model/ChatRecord.h" #include "service/ChatRecordService.h" #include "service/IconService.h" #include "MessageDialog.h" #include "model/FileReceiver.h" #include "model/FileSender.h" #include <QFile> #include <QMenu> #include "SetShareFilesDialog.h" #include "SettingDialog.h" #include "GamesDialog.h" #include "WeatherDialog.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); static MainWindow *getMainWindow(); QHash<QUuid, ChatForm *> *getChatForms(); public slots: void doubleClickedContents(QModelIndex); void doubleClickedRecentContents(QModelIndex); void userInfoReceived(QHostAddress senderIp, quint16 senderPort, ChatMessage message); void chatReceiveSuccess(QHostAddress senderIp, quint16 senderPort, ChatMessage message); void fMsgReceiveSuccess(QHostAddress senderIp, quint16 senderPort, ChatMessage message); protected: virtual void closeEvent ( QCloseEvent * event ); private slots: void activated ( QSystemTrayIcon::ActivationReason reason ); void chatFormClosed(QUuid); void openChatForm(const QUuid &receiverUuid); void on_searchEdit_textChanged(const QString &arg1); void doubleClickedSearchResult(QModelIndex); void on_contentsTreeWidget_customContextMenuRequested(const QPoint &pos); void on_setShareFilesButton_clicked(); void on_tabWidget_currentChanged(int index); void on_userImage_clicked(); void on_settingButton_clicked(); void on_cleanChatRecordButton_clicked(); void on_statusComboBox_currentIndexChanged(int index); void on_gamesButton_clicked(); void on_weatherButton_clicked(); void on_todoButton_clicked(); private: Ui::MainWindow *ui; UserInfoService *mUserInfoService; ChatService *mChatService; IconService *mIconService; UserService *mUserService; FileShareService *mFileShareService; User *myself; void updateContentsTreeWidget(); QHash<QUuid, User> *mFriends; QHash<QUuid, ChatForm *> *mChatForms; QList<ChatRecord> *mChatRecords; /* system tray */ void createActions(); void createTrayIcon(); QIcon logoIcon; QSystemTrayIcon *trayIcon; QMenu *trayIconMenu; QAction *minimizeAction; QAction *maximizeAction; QAction *restoreAction; QAction *quitAction; QListWidget *searchResultWidget; void updateRecentFriendsListWidget(); void updateMyselfInfoView(); // todo progress QProcess todoProgress; }; #endif // MAINWINDOW_H
/****************************************************************/ /* */ /* error.c */ /* */ /* Main Kernel Error Handler Functions */ /* */ /* Copyright (c) 1995 */ /* Pasquale J. Villani */ /* All Rights Reserved */ /* */ /* This file is part of DOS-C. */ /* */ /* DOS-C 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, or (at your option) any later version. */ /* */ /* DOS-C 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 DOS-C; see the file COPYING. If not, */ /* write to the Free Software Foundation, 675 Mass Ave, */ /* Cambridge, MA 02139, USA. */ /****************************************************************/ #include "portab.h" #ifdef VERSION_STRINGS static BYTE *errorRcsId = "$Id: error.c 709 2003-09-24 19:34:11Z bartoldeman $"; #endif #include "globals.h" #ifdef DEBUG /* error registers */ VOID dump(void) { printf("Register Dump [AH = %02x CS:IP = %04x:%04x FLAGS = %04x]\n", error_regs.AH, error_regs.CS, error_regs.IP, error_regs.FLAGS); printf("AX:%04x BX:%04x CX:%04x DX:%04x\n", error_regs.AX, error_regs.BX, error_regs.CX, error_regs.DX); printf("SI:%04x DI:%04x DS:%04x ES:%04x\n", error_regs.SI, error_regs.DI, error_regs.DS, error_regs.ES); } #endif /* issue a panic message for corrupted data structures */ VOID panic(BYTE * s) { put_string("\nPANIC: "); put_string(s); put_string("\nSystem halted"); for (;;) ; } #ifdef IPL /* issue an internal error message */ VOID fatal(BYTE * err_msg) { printf("\nInternal IPL error - %s\nSystem halted\n", err_msg); exit(-1); } #else /* issue an internal error message */ #if 0 VOID fatal(BYTE * err_msg) { printf("\nInternal kernel error - \n"); panic(err_msg); } #endif #endif /* Abort, retry or fail for character devices */ COUNT char_error(request * rq, struct dhdr FAR * lpDevice) { CritErrCode = (rq->r_status & S_MASK) + 0x13; return CriticalError(EFLG_CHAR | EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE, 0, rq->r_status & S_MASK, lpDevice); } /* Abort, retry or fail for block devices */ COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice, int mode) { CritErrCode = (rq->r_status & S_MASK) + 0x13; return CriticalError(EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE | (mode == DSKWRITE ? EFLG_WRITE : 0), nDrive, rq->r_status & S_MASK, lpDevice); }
/* Copyright (c) 2014-2019 AscEmu Team <http://www.ascemu.org> This file is released under the MIT license. See README-MIT for more information. */ #pragma once #include <cstdint> #include "ManagedPacket.h" #include "WorldPacket.h" namespace AscEmu::Packets { class CmsgRemoveGlyph : public ManagedPacket { #if VERSION_STRING > TBC public: uint16_t glyphNumber; CmsgRemoveGlyph() : CmsgRemoveGlyph(0) { } CmsgRemoveGlyph(uint16_t glyphNumber) : ManagedPacket(CMSG_REMOVE_GLYPH, 2), glyphNumber(glyphNumber) { } protected: bool internalSerialise(WorldPacket& /*packet*/) override { return false; } bool internalDeserialise(WorldPacket& packet) override { packet >> glyphNumber; return true; } #endif }; }
#pragma once #include <string> #include <Windows.h> #include <thread> #include <chrono> #include "Modules/ModuleManager.h" #include "Config.h" #include "Drawing.h" #include "Patch.h" using namespace std; struct cGuardModule { union { HMODULE hModule; DWORD dwBaseAddress; }; DWORD _1; char szPath[MAX_PATH]; }; namespace BH { extern string path; extern HINSTANCE instance; extern ModuleManager* moduleManager; extern Config* config; extern Drawing::UI* settingsUI; extern Drawing::StatsDisplay* statsDisplay; extern WNDPROC OldWNDPROC; extern map<string, Toggle>* MiscToggles; extern map<string, Toggle>* MiscToggles2; extern bool cGuardLoaded; extern bool initialized; extern Patch* oogDraw; extern bool Startup(HINSTANCE instance, VOID* reserved); extern "C" __declspec(dllexport) void Initialize(); extern bool Shutdown(); extern bool ReloadConfig(); };
#include <math.h> #include <stdlib.h> #include <stdio.h> #include "distortion.h" #include "util.h" /** * Allocates memory for a distortion matrix */ struct distortion_t *alloc_distortion_matrix(uint8_t symbols) { struct distortion_t *rtn = (struct distortion_t *) calloc(1, sizeof(struct distortion_t)); rtn->symbols = symbols; rtn->distortion = (double *) calloc(symbols*symbols, sizeof(double)); return rtn; } /** * Deallocates memory from a distortion matrix */ void free_distortion_matrix(struct distortion_t *d) { free(d->distortion); free(d); } /** * Public facing method for allocating distortion matrices */ struct distortion_t *generate_distortion_matrix(uint8_t symbols, int type) { switch (type) { case DISTORTION_MANHATTAN: return gen_manhattan_distortion(symbols); case DISTORTION_MSE: return gen_mse_distortion(symbols); case DISTORTION_LORENTZ: return gen_lorentzian_distortion(symbols); default: printf("Invalid distortion type %d specified.", type); exit(1); } } /** * Generate a distortion matrix according to the Manhattan distance (L1) metric */ struct distortion_t *gen_manhattan_distortion(uint8_t symbols) { struct distortion_t *rtn = alloc_distortion_matrix(symbols); uint8_t x, y; for (x = 0; x < symbols; ++x) { for (y = 0; y < symbols; ++y) { rtn->distortion[x + y*symbols] = abs(x - y); } } return rtn; } /** * Generates a distortion matrix according to the MSE (L2) metric */ struct distortion_t *gen_mse_distortion(uint8_t symbols) { struct distortion_t *rtn = alloc_distortion_matrix(symbols); uint8_t x, y; for (x = 0; x < symbols; ++x) { for (y = 0; y < symbols; ++y) { rtn->distortion[x + y*symbols] = (x - y)*(x - y); } } return rtn; } /** * Generates a distortion matrix according to the lorentzian (log-L1) metric */ struct distortion_t *gen_lorentzian_distortion(uint8_t symbols) { struct distortion_t *rtn = alloc_distortion_matrix(symbols); uint8_t x, y; for (x = 0; x < symbols; ++x) { for (y = 0; y < symbols; ++y) { rtn->distortion[x + y*symbols] = log2( 1.0 + (double)(abs(x - y)) ); } } return rtn; } double compute_distortion(uint32_t x, uint32_t y, uint8_t DIS){ switch (DIS) { case DISTORTION_LORENTZ: return log2( 1.0 + (double)(abs(x - y)) ); case DISTORTION_MANHATTAN: return abs(x - y); case DISTORTION_MSE: return (x - y)*(x - y); default: printf("DISTORTION NOT RECOGNIZED\n"); return 0xffffffff; } } /** * Retrieve the distortion for a pair (x, y). Generally x is the true value and * y is the reconstructed value. Handles the matrix->linear array indexing */ double get_distortion(struct distortion_t *dist, uint8_t x, uint8_t y) { return dist->distortion[x + dist->symbols*y]; }
/* * Copyright (c) 2006 University of Utah and the Flux Group. * * {{{EMULAB-LICENSE * * This file is part of the Emulab network testbed software. * * This file is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this file. If not, see <http://www.gnu.org/licenses/>. * * }}} */ #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <sys/socket.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <sys/select.h> /** * XXX: no udp support yet, not hard to do though. */ /** * this app has two modes: * first, simply accepts strings of the form on stdin * INTERVAL=%d BLOCKSIZE=%d DURATION=%d * where INTERVAL's value is in milliseconds, and BLOCKSIZE's value * is in bytes, and DURATION's value is in seconds (if DURATION is 0, keep * going until we see the next event on stdin); and adjusts its packet send * rates accordingly as soon as it receives the strings. * * second, if you specify a file, each line should contain repeated * strings like * INTERVAL=%d BLOCKSIZE=%d STARTTIME=%d DURATION=%d * where STARTTIME is a time offset from program start. When each line's * STARTTIME is reached, the previous event (if any) is terminated, and * we start sending packets at the new rate specified by INT and BS. * * in this second mode, you can also specify DURATION instead of STARTTIME; * DURATION's value is also in seconds; as soon as that DURATION has elapsed, * we start sending packets at the next INTERVAL and BLOCKSIZE specified in * the file, if any. If DURATION's value is * * also: if run in first modes, does NOT DO ANYTHING until it sees something * on std input... only connects to server. * */ /* basic args: -h srvhost -p srvport -f <scriptfile> */ void efatal(char *msg) { fprintf(stdout,"%s: %s\n",msg,strerror(errno)); exit(-1); } void fatal(char *msg) { fprintf(stdout,"%s\n",msg); exit(-2); } void ewarn(char *msg) { fprintf(stdout,"WARNING: %s: %s\n",msg,strerror(errno)); } void warn(char *msg) { fprintf(stdout,"WARNING: %s\n",msg); } #define MODE_STDIN 1 #define MODE_SCRIPT 2 #define MAX_LINE_LEN 128 int main(int argc, char **argv) { int mode = MODE_STDIN; char *srvhost; short srvport; int proto; char linebuf[MAX_LINE_LEN]; char *databuf = NULL; long duration; long interval; long /* grab some quick args, hostname, port, tcp, udp... */ while ((c = getopt(argc,argv,"h:p:tud")) != -1) { switch(c) { case 'h': srvhost = optarg; break; case 'p': srvport = (short)atoi(optarg); break; case 't': proto = SOCK_STREAM; break; case 'u': proto = SOCK_DGRAM; fatal("no udp support yet!"); break; case 'd': ++debug; break; default: break; } } while(1) { /* read stdin: * if read duration = 0, check for new cmd * each time we are about to write a packet. * if duration > 0, go for that long, then read next cmd. */ return 0; }
#pragma once /* Copyright (C) 2016 AGC. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #if !defined(__cplusplus) || __cplusplus < 201103L #error Only C++11 or later supported. #endif #include <stdint.h> #include <RakNetTypes.h> #include <utils.h> namespace x801 { namespace game { enum KeyInputValues { K_OFFSET_FORWARD = 0, K_OFFSET_BACK, K_OFFSET_LEFT, K_OFFSET_RIGHT, }; struct KeyInput { RakNet::Time time; uint32_t inputs; }; } }
/* * ArcEmu MMORPG Server * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/> * Copyright (C) 2008-2020 <http://www.ArcEmu.org/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef _MAILMESSAGE_H #define _MAILMESSAGE_H struct MailMessage { uint32 message_id; uint32 message_type; uint64 player_guid; uint64 sender_guid; string subject; string body; uint32 money; vector<uint32> items; uint32 cod; uint32 stationery; uint32 expire_time; uint32 delivery_time; uint32 checked_flag; bool deleted_flag; bool AddMessageDataToPacket(WorldPacket & data); }; #endif
#ifndef HELLO_WRAP_H #define HELLO_WRAP_H // Copyright Joel de Guzman 2002-2004. Distributed under the Boost // Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) // Hello World Example from the tutorial // [Joel de Guzman 10/9/2002] #include "hello.h" #include <boost/python.hpp> using namespace boost::python; struct BaseWrap : Base, wrapper<Base> { bool operator==(const Base& rhs) const; // For wrapping a pure virtual function. int pure(); // For wrapping a virtual function that has a default implementation. int notpure(); int default_notpure(); /*void tilda_Base(); void default_tilda_Base();*/ }; bool (X::*fx1)(int) = &X::f; #endif
/** * Copyright (c) 2016 DeepCortex GmbH <legal@eventql.io> * Authors: * - Paul Asmuth <paul@eventql.io> * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License ("the license") as * published by the Free Software Foundation, either version 3 of the License, * or any later version. * * In accordance with Section 7(e) of the license, the licensing of the Program * under the license does not imply a trademark license. Therefore any rights, * title and interest in our trademarks remain entirely with us. * * 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 license for more details. * * You can be released from the requirements of the license by purchasing a * commercial license. Buying such a license is mandatory as soon as you develop * commercial activities involving this program without disclosing the source * code of your own applications */ #ifndef _FNORDMETRIC_QUERY_ASTNODE_H #define _FNORDMETRIC_QUERY_ASTNODE_H #include <stdlib.h> #include <string> #include <vector> namespace csql { class Token; class ASTNode { friend class QueryTest; public: enum kASTNodeType { T_ROOT, T_LITERAL, T_METHOD_CALL, T_METHOD_CALL_WITHIN_RECORD, T_RESOLVED_CALL, T_COLUMN_NAME, T_COLUMN_ALIAS, T_COLUMN_INDEX, T_RESOLVED_COLUMN, T_TABLE_NAME, T_TABLE_ALIAS, T_DERIVED_COLUMN, T_PROPERTY, T_PROPERTY_VALUE, T_VOID, T_SELECT, T_SELECT_DEEP, T_SELECT_LIST, T_ALL, T_FROM, T_WHERE, T_GROUP_BY, T_ORDER_BY, T_SORT_SPEC, T_HAVING, T_LIMIT, T_OFFSET, T_JOIN_CONDITION, T_JOIN_COLUMNLIST, T_INNER_JOIN, T_LEFT_JOIN, T_RIGHT_JOIN, T_NATURAL_INNER_JOIN, T_NATURAL_LEFT_JOIN, T_NATURAL_RIGHT_JOIN, T_IF_EXPR, T_EQ_EXPR, T_NEQ_EXPR, T_LT_EXPR, T_LTE_EXPR, T_GT_EXPR, T_GTE_EXPR, T_AND_EXPR, T_OR_EXPR, T_NEGATE_EXPR, T_ADD_EXPR, T_SUB_EXPR, T_MUL_EXPR, T_DIV_EXPR, T_MOD_EXPR, T_POW_EXPR, T_REGEX_EXPR, T_LIKE_EXPR, T_SHOW_TABLES, T_DESCRIBE_TABLE, T_DESCRIBE_PARTITIONS, T_CLUSTER_SHOW_SERVERS, T_EXPLAIN_QUERY, T_CREATE_TABLE, T_COLUMN_LIST, T_PRIMARY_KEY, T_PARTITION_KEY, T_RECORD, T_REPEATED, T_NOT_NULL, T_COLUMN, T_COLUMN_TYPE, T_TABLE_PROPERTY_LIST, T_TABLE_PROPERTY, T_TABLE_PROPERTY_KEY, T_TABLE_PROPERTY_VALUE, T_DROP_TABLE, T_DATABASE_NAME, T_CREATE_DATABASE, T_USE_DATABASE, T_INSERT_INTO, T_VALUE_LIST, T_JSON_STRING, T_ALTER_TABLE, T_DRAW, T_IMPORT, T_AXIS, T_AXIS_POSITION, T_AXIS_LABELS, T_DOMAIN, T_DOMAIN_SCALE, T_GRID, T_LEGEND, T_GROUP_OVER_TIMEWINDOW }; ASTNode(kASTNodeType type); bool operator==(kASTNodeType type) const; bool operator==(const ASTNode& other) const; // compare asts recursively. returns true if both ast trees are equal bool compare(const ASTNode* other); ASTNode* appendChild(ASTNode::kASTNodeType type); void appendChild(ASTNode* node); void appendChild(ASTNode* node, size_t index); void removeChildByIndex(size_t index); void removeChildrenByType(kASTNodeType type); void removeChild(ASTNode* node); void clearChildren(); const std::vector<ASTNode*>& getChildren() const; void setToken(const Token* token); void clearToken(); const Token* getToken() const; kASTNodeType getType() const; void setType(kASTNodeType type); uint64_t getID() const; void setID(uint64_t id); ASTNode* deepCopy() const; void debugPrint(int indent = 2) const; protected: kASTNodeType type_; const Token* token_; int64_t id_; std::vector<ASTNode*> children_; }; } #endif
/** ****************************************************************************** * @file Elaborato1/1_1_Driver_C_NoInt/main.c * @authors Colella Gianni - Guida Ciro - Lombardi Daniele / Group IV - Sistemi Embedded 2016-2017 * @version V1.0 * @date 10-May-2017 * @brief Programma principale che contiene al suo interno l'implemetazione di un particolare driver che pilota la periferica ****************************************************************************** */ #include <stdio.h> #include "platform.h" #include "xil_printf.h" #include "gpio_header.h" #include <unistd.h> void init(); void supercar(); int main() { init_platform(); /*!<Primo passo*/ /*Si inizializza correttamente la periferica*/ init(); /*!<Secondo passo*/ /*Si richiama il relativo driver*/ supercar(); cleanup_platform(); return 0; } /** * @brief Questa funzione permette di inizializzare in maniera opportuna la * periferica * @note Si può notare come la periferica di GPIO è inizializzata in modo tale * da utilizzare 8 pin: in accordo all'header file gpio_header.h sui * primi 4 pin, a partire dai meno significativi vengono mappati degli switch, * sui secondi 4 dei led * @retval none */ void init(){ gpio_init(GPIO_ADDRESS); gpio_write_mask(PAD_EN, SET_LED, _F_, HIGH); gpio_write_mask(PAD_OUT,SET_LED,_F_,LOW); } /** * @brief Implementazione del driver per il pilotaggio della periferica * @note Il driver permette la simulazione del lampeggiamento dei led * posti sul muso anteriore di K.I.T.T., famosa auto del telefim * Anni '80 Supercar. * @retval none */ void supercar(){ int position=ZERO; short int dx=0; useconds_t usec = 500000; while(1){ usleep(usec); /*Il ramo then permette di scorrere l'illuminazione dei led da destra verso sinistra*/ if(!dx){ gpio_toggle_one(PAD_OUT, SET_LED, position); usleep(usec); gpio_toggle_one(PAD_OUT,SET_LED, position); /*Poiché il driver è specifico per la board Zybo Zynq-7000 * tale controllo prevede che all'illuminazione del quarto led da destra * viene posta la variabile dx a 1 in modo tale che alla successiva * iterazione lo scorrimento avvenga da sinistra a destra*/ if(position==THREE) dx=1; else position++; } /*Il ramo else permette di scorrere l'illuminazione dei led da sinistra verso destra*/ else{ position--; gpio_toggle_one(PAD_OUT, SET_LED, position); usleep(usec); gpio_toggle_one(PAD_OUT, SET_LED, position); /*Se lo scorrimento ha raggiunto il led più a destra, allora viene posta * la variabile dx a 0 in modo tale che alla successiva iterazione, * avvenga da destra verso sinistra*/ if(position==ZERO){ dx=0; position++; } } } }
#ifndef NETTCPCONNECTION_H #define NETTCPCONNECTION_H #include "ioConnection.h" #include <string> #ifdef __APPLE__ #define SEND_FLAGS 0 #define SOCKOPT_FLAGS SO_NOSIGPIPE #else #include <string.h> #define SEND_FLAGS MSG_NOSIGNAL #define SOCKOPT_FLAGS 0 #endif #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <vector> #include <cstdlib> #include <cstdio> class netTCPConnection: public ioConnection{ private: class targetSocket{ public: targetSocket(struct sockaddr_in * targetCopy); bool clientSocket; int socketID; struct sockaddr_in addrInfoIn; struct sockaddr * addrInfo; socklen_t addrInfoLen; }; int socketDescriptor; // Main acception socket std::vector<targetSocket*> socketList; std::vector<targetSocket*>::iterator listIterator; void clearList(); void clearEntry(std::vector<targetSocket*>::iterator targetEntry); public: netTCPConnection(); int sendt(std::string * buffer); int recvt(std::string * buffer); void createServerConnection(std::string * address, int port); void createClientConnection(std::string * address, int port); void serverIteration(); void closeConnection(); }; #endif
/* * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html */ /* * S/MIME detached data encrypt example: rarely done but should the need * arise this is an example.... */ #include <openssl/pem.h> #include <openssl/cms.h> #include <openssl/err.h> int main(int argc, char **argv) { BIO *in = NULL, *out = NULL, *tbio = NULL, *dout = NULL; X509 *rcert = NULL; STACK_OF(X509) *recips = NULL; CMS_ContentInfo *cms = NULL; int ret = 1; int flags = CMS_STREAM | CMS_DETACHED; OpenSSL_add_all_algorithms(); ERR_load_crypto_strings(); /* Read in recipient certificate */ tbio = BIO_new_file("signer.pem", "r"); if (!tbio) goto err; rcert = PEM_read_bio_X509(tbio, NULL, 0, NULL); if (!rcert) goto err; /* Create recipient STACK and add recipient cert to it */ recips = sk_X509_new_null(); if (!recips || !sk_X509_push(recips, rcert)) goto err; /* * sk_X509_pop_free will free up recipient STACK and its contents so set * rcert to NULL so it isn't freed up twice. */ rcert = NULL; /* Open content being encrypted */ in = BIO_new_file("encr.txt", "r"); dout = BIO_new_file("smencr.out", "wb"); if (!in) goto err; /* encrypt content */ cms = CMS_encrypt(recips, in, EVP_des_ede3_cbc(), flags); if (!cms) goto err; out = BIO_new_file("smencr.pem", "w"); if (!out) goto err; if (!CMS_final(cms, in, dout, flags)) goto err; /* Write out CMS structure without content */ if (!PEM_write_bio_CMS(out, cms)) goto err; ret = 0; err: if (ret) { fprintf(stderr, "Error Encrypting Data\n"); ERR_print_errors_fp(stderr); } CMS_ContentInfo_free(cms); X509_free(rcert); sk_X509_pop_free(recips, X509_free); BIO_free(in); BIO_free(out); BIO_free(dout); BIO_free(tbio); return ret; }
/* * Copyright (C) 2008, 2010-2011, Aldebaran Robotics * * This software is provided "as is" without warranty of any kind, * either expressed or implied, including but not limited to the * implied warranties of fitness for a particular purpose. * * See the LICENSE file for more information. */ #include <libport/config.h> // Do not define the variety of ufloats to use. #undef LIBPORT_URBI_UFLOAT_DOUBLE #undef LIBPORT_URBI_UFLOAT_FLOAT #undef LIBPORT_URBI_UFLOAT_FLOATING #undef LIBPORT_URBI_UFLOAT_LONG #undef LIBPORT_URBI_UFLOAT_LONG_LONG #undef LIBPORT_URBI_UFLOAT_TABULATED
/* Bacula® - The Network Backup Solution Copyright (C) 2003-2014 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. You may use this file and others of this release according to the license defined in the LICENSE file, which includes the Affero General Public License, v3.0 ("AGPLv3") and some additional permissions and terms pursuant to its AGPLv3 Section 7. Bacula® is a registered trademark of Kern Sibbald. */ /* * * Bacula Director -- admin.c -- responsible for doing admin jobs * * Kern Sibbald, May MMIII * * Basic tasks done here: * Display the job report. * */ #include "bacula.h" #include "dird.h" #include "ua.h" bool do_admin_init(JCR *jcr) { free_rstorage(jcr); if (!allow_duplicate_job(jcr)) { return false; } return true; } /* * Returns: false on failure * true on success */ bool do_admin(JCR *jcr) { jcr->jr.JobId = jcr->JobId; jcr->fname = (char *)get_pool_memory(PM_FNAME); /* Print Job Start message */ Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"), jcr->JobId, jcr->Job); jcr->setJobStatus(JS_Running); admin_cleanup(jcr, JS_Terminated); return true; } /* * Release resources allocated during backup. */ void admin_cleanup(JCR *jcr, int TermCode) { char sdt[50], edt[50], schedt[50]; char term_code[100]; const char *term_msg; int msg_type; MEDIA_DBR mr; Dmsg0(100, "Enter backup_cleanup()\n"); update_job_end(jcr, TermCode); if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"), db_strerror(jcr->db)); jcr->setJobStatus(JS_ErrorTerminated); } msg_type = M_INFO; /* by default INFO message */ switch (jcr->JobStatus) { case JS_Terminated: term_msg = _("Admin OK"); break; case JS_FatalError: case JS_ErrorTerminated: term_msg = _("*** Admin Error ***"); msg_type = M_ERROR; /* Generate error message */ break; case JS_Canceled: term_msg = _("Admin Canceled"); break; default: term_msg = term_code; sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus); break; } bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime); bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes(edt, sizeof(edt), jcr->jr.EndTime); Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n" " JobId: %d\n" " Job: %s\n" " Scheduled time: %s\n" " Start time: %s\n" " End time: %s\n" " Termination: %s\n\n"), edt, jcr->jr.JobId, jcr->jr.Job, schedt, sdt, edt, term_msg); Dmsg0(100, "Leave admin_cleanup()\n"); }
/**************************************************************** * * * Copyright 2001, 2014 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #ifndef __IS_FILE_IDENTICAL_H__ #define __IS_FILE_IDENTICAL_H__ bool is_file_identical(char *filename1, char *filename2); bool is_gdid_file_identical(gd_id_ptr_t fid, char *filename, int4 filelen); #ifdef VMS void set_gdid_from_file(gd_id_ptr_t fileid, char *filename, int4 filelen); bool is_gdid_gdid_identical(gd_id_ptr_t fid_1, gd_id_ptr_t fid_2); #elif defined(UNIX) #include "gtm_stat.h" bool is_gdid_identical(gd_id_ptr_t fid1, gd_id_ptr_t fid2); bool is_gdid_stat_identical(gd_id_ptr_t fid, struct stat *stat_buf); void set_gdid_from_stat(gd_id_ptr_t fid, struct stat *stat_buf); uint4 filename_to_id(gd_id_ptr_t fid, char *filename); #endif #endif
/* * trace_data_response.h * * */ #ifndef _OpenAPI_trace_data_response_H_ #define _OpenAPI_trace_data_response_H_ #include <string.h> #include "../external/cJSON.h" #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" #include "trace_data.h" #ifdef __cplusplus extern "C" { #endif typedef struct OpenAPI_trace_data_response_s OpenAPI_trace_data_response_t; typedef struct OpenAPI_trace_data_response_s { struct OpenAPI_trace_data_s *trace_data; char *shared_trace_data_id; } OpenAPI_trace_data_response_t; OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_create( OpenAPI_trace_data_t *trace_data, char *shared_trace_data_id ); void OpenAPI_trace_data_response_free(OpenAPI_trace_data_response_t *trace_data_response); OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_parseFromJSON(cJSON *trace_data_responseJSON); cJSON *OpenAPI_trace_data_response_convertToJSON(OpenAPI_trace_data_response_t *trace_data_response); OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_copy(OpenAPI_trace_data_response_t *dst, OpenAPI_trace_data_response_t *src); #ifdef __cplusplus } #endif #endif /* _OpenAPI_trace_data_response_H_ */