text
stringlengths
4
6.14k
/* Copyright (C) 2018-2021, Kevin Andre <hyperquantum@gmail.com> This file is part of PMP (Party Music Player). PMP 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. PMP 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 PMP. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PMP_SERVERHEALTHSTATUS_H #define PMP_SERVERHEALTHSTATUS_H #include <QMetaType> namespace PMP { class ServerHealthStatus { public: ServerHealthStatus() : _databaseUnavailable(false) { // } ServerHealthStatus(bool databaseUnavailable) : _databaseUnavailable(databaseUnavailable) { // } bool anyProblems() const { return _databaseUnavailable; } bool databaseUnavailable() const { return _databaseUnavailable; } private: bool _databaseUnavailable; }; inline bool operator==(const ServerHealthStatus& me, const ServerHealthStatus& other) { return me.databaseUnavailable() == other.databaseUnavailable(); } inline bool operator!=(const ServerHealthStatus& me, const ServerHealthStatus& other) { return !(me == other); } } Q_DECLARE_METATYPE(PMP::ServerHealthStatus) #endif
// -*- mode: C++; c-file-style: "cc-mode" -*- //************************************************************************* // DESCRIPTION: Verilator: Clocking POS/NEGEDGE insertion // // Code available from: http://www.veripool.org/verilator // //************************************************************************* // // Copyright 2003-2014 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // // Verilator 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. // //************************************************************************* #ifndef _V3CLOCK_H_ #define _V3CLOCK_H_ 1 #include "config_build.h" #include "verilatedos.h" #include "V3Error.h" #include "V3Ast.h" //============================================================================ class V3Clock { public: static void clockAll(AstNetlist* nodep); }; #endif // Guard
/* * Copyright 2011,2012,2013 Evgeniy Khilkevitch * * This file is part of scigraphics. * * Scigraphics 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. * * Scigraphics 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 scigraphics. If not, see <http://www.gnu.org/licenses/>. */ #pragma once // ================================================================ #include <QWidget> class QLineEdit; class QLabel; class QHBoxLayout; class QValidator; // ================================================================ namespace scigraphics { // ================================================================ class qt4labeledLineEdit : public QWidget { Q_OBJECT private: QLineEdit *Edit; QLabel *Label; QHBoxLayout *Layout; public: qt4labeledLineEdit( const QString &Label, const QString &Text, QWidget *Parent = NULL ); void setValidator( QValidator *Validator ); void setStretchFactors( int LabelStretch, int EditStretch ); void setText( const QString &Text ); QString text() const; signals: void editingFinished(); void returnPressed(); }; // ================================================================ }
/******************************************************************************/ * Moose3D is a game development framework. * * Copyright 2006-2013 Anssi Gröhn / entity at iki dot fi. * * This file is part of Moose3D. * * Moose3D 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. * * Moose3D 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 Moose3D. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ #ifndef __MooseSpotLight_h__ #define __MooseSpotLight_h__ ///////////////////////////////////////////////////////////////// #include "MooseCore.h" #include "MoosePositional.h" #include "MooseOneDirectional.h" #include "MooseLight.h" #include "MooseAPI.h" #include "MooseRenderable.h" ///////////////////////////////////////////////////////////////// namespace Moose { namespace Graphics { //////////////////// /// Class for spotlights. class MOOSE_API CSpotLight : public Moose::Graphics::CLight { public: //////////////////// /// Initialize default params, positioned at origo, points towards negative z axis, spot angle and exponent are zero. CSpotLight(); //////////////////// /// Renders this object using renderer. /// \param renderer Renderer to be used in rendering. void Render( COglRenderer & renderer ); }; }; // namespace Graphics }; // namespace Moose ///////////////////////////////////////////////////////////////// #endif /////////////////////////////////////////////////////////////////
#ifndef MENUITEM_H #define MENUITEM_H #include <string> #include <vector> #include "composite.h" class MenuVisitor; /*! * \brief The MenuItem class is main component, from which derive composites and leaves * and also class for menu item - leave of our hierarchy. */ class MenuItem : public Composite { public: MenuItem(const std::string &pTitle, double pPrice = 0.0, std::string pDescription = std::string()); std::string description() const; double price() const; void accept(MenuVisitor *visitor); private: std::string mDescription; double mPrice; }; #endif // MENUITEM_H
#pragma once #include "Object.h" class Triangle : public Object { vec3 v1; vec3 v2; vec3 v3; public: Triangle(vec3 _v1, vec3 _v2, vec3 _v3, Material _material) : v1(_v1), v2(_v2), v3(_v3), Object(_material) {} bool checkIntersection(Ray &incidentRay, float clipValue, float &tValue) { float EPSILON = 0.000001; vec3 e1 = v2 - v1; vec3 e2 = v3 - v1; vec3 p = incidentRay.d.cross(e2); float d = e1 * p; if(d > -EPSILON && d < EPSILON) return false; vec3 tvec = incidentRay.o - v1; float invD = 1.0f / d; float u = tvec * p * invD; if (u < 0.0f || u > 1.0f) return false; vec3 q = tvec.cross(e1); float v = incidentRay.d * q * invD; if (v < 0 || (u + v) > 1.0f) return false; float t = e2 * q * invD; if(t > clipValue){ tValue = t; return true; } return false; } };
/* SSCP_def.h * * Copyright (C) 1993-2018 David Weenink * * This 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 2 of the License, or (at * your option) any later version. * * This 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 this work. If not, see <http://www.gnu.org/licenses/>. */ #define ooSTRUCT SSCP oo_DEFINE_CLASS (SSCP, TableOfReal) oo_DOUBLE (numberOfObservations) oo_VEC (centroid, numberOfColumns) /* The following definitions are only needed when we want to use many big diagonal or almost diagonal matrices like for example in a GaussianMixture, or for efficiently calculating many times a distance like a'S^(-1)a */ #if oo_DECLARING || oo_DESTROYING oo_INTEGER (expansionNumberOfRows) oo_INT (dataChanged) oo_MAT (expansion, expansionNumberOfRows, numberOfColumns) oo_DOUBLE (lnd) oo_MAT (lowerCholeskyInverse, numberOfColumns, numberOfColumns) oo_OBJECT (PCA, 0, pca) #endif #if oo_DECLARING void v_info () override; #endif oo_END_CLASS (SSCP) #undef ooSTRUCT /* End of file SSCP_def.h */
/* 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. */ /******************************************************** * Copyright (C) Roger George Doss. All Rights Reserved. ******************************************************** * * mkdir.c * mkdir system call * ********************************************************/ #include <unistd.h> #include <platform/call.h> #include <platform/syscall.h> /* int mkdir(const char *path, mode_t mode); */ _syscall_2(int,mkdir,const char *,path,mode_t,mode);
#ifndef VPRESPONSE_H #define VPRESPONSE_H #include <QObject> #include <QList> #include <QJsonDocument> #include <QJsonArray> #include <QVariant> #include <QVariantList> #include "vpdate.h" class VPResponse : public QObject { Q_OBJECT Q_PROPERTY(QVariantList dates READ dates NOTIFY datesChanged) public: explicit VPResponse(QObject *parent = nullptr); void loadJson(const QByteArray& json); QByteArray json() const { return _json; } QVariantList dates() const { return _dates; } signals: void datesChanged(const QVariantList& dates); private: QVariantList _dates; QByteArray _json; }; #endif // VPRESPONSE_H
/** * @file trafgen.c * @brief Routines used by the Flowgrind Daemon for advanced traffic generation */ /* * Copyright (C) 2010-2013 Christian Samsel <christian.samsel@rwth-aachen.de> * * This file is part of Flowgrind. * * Flowgrind 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. * * Flowgrind 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 Flowgrind. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <float.h> #include <errno.h> #include <string.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <syslog.h> #include "daemon.h" #include "debug.h" #include "fg_math.h" #include "trafgen.h" #define MAX_RUNS_PER_DISTRIBUTION 10 inline static double calculate(struct flow *flow, enum distribution_t type, double param_one, double param_two) { double val = 0; switch (type) { case NORMAL: val = dist_normal (flow, param_one, param_two ); DEBUG_MSG(LOG_DEBUG, "calculated normal distribution " "value %f for parameters %f,%f", val, param_one, param_two); break; case UNIFORM: val = dist_uniform (flow, param_one, param_two ); DEBUG_MSG(LOG_DEBUG, "calculated uniform distribution " "value %f", val); break; case WEIBULL: val = dist_weibull (flow, param_one, param_two ); DEBUG_MSG(LOG_DEBUG, "calculated weibull distribution " "value %f for parameters %f,%f", val, param_one, param_two); break; case EXPONENTIAL: val = dist_exponential (flow, param_one); DEBUG_MSG(LOG_DEBUG, "calculated exponential " "distribution value %f for parameters %f", val, param_one); break; case PARETO: val = dist_pareto (flow, param_one, param_two); DEBUG_MSG(LOG_DEBUG, "calculated pareto distribution " "value %f for parameters %f,%f", val, param_one, param_two); break; case LOGNORMAL: val = dist_normal (flow, param_one, param_two ); DEBUG_MSG(LOG_DEBUG, "calculated lognormal " "distribution value %f for parameters %f,%f", val, param_one, param_two); break; case CONSTANT: /* constant is default */ default: val = param_one; DEBUG_MSG(LOG_DEBUG, "constant value %f", val); } return val; } int next_request_block_size(struct flow *flow) { int bs = 0; int i = 0; /* recalculate values to match prequisits, but at most 10 times */ while (( bs < MIN_BLOCK_SIZE || bs > flow->settings.maximum_block_size) && i < MAX_RUNS_PER_DISTRIBUTION) { bs = round(calculate( flow, flow->settings.request_trafgen_options.distribution, flow->settings.request_trafgen_options.param_one, flow->settings.request_trafgen_options.param_two )); i++; } /* sanity checks */ if (i >= MAX_RUNS_PER_DISTRIBUTION && bs < MIN_BLOCK_SIZE) { bs = MIN_BLOCK_SIZE; DEBUG_MSG(LOG_WARNING, "applied minimal request size limit %d " "for flow %d", bs, flow->id); } if (i >= MAX_RUNS_PER_DISTRIBUTION && bs > flow->settings.maximum_block_size) { bs = flow->settings.maximum_block_size; DEBUG_MSG(LOG_WARNING, "applied maximal request size limit %d " "for flow %d", bs, flow->id); } DEBUG_MSG(LOG_NOTICE, "calculated request size %d for flow %d after %d " "runs", bs, flow->id, i); return bs; } int next_response_block_size(struct flow *flow) { int bs = round(calculate( flow, flow->settings.response_trafgen_options.distribution, flow->settings.response_trafgen_options.param_one, flow->settings.response_trafgen_options.param_two )); /* sanity checks */ if (bs && bs < MIN_BLOCK_SIZE) { bs = MIN_BLOCK_SIZE; DEBUG_MSG(LOG_WARNING, "applied minimal response size limit " "%d for flow %d", bs, flow->id); } if (bs > flow->settings.maximum_block_size) { bs = flow->settings.maximum_block_size; DEBUG_MSG(LOG_WARNING, "applied maximal response size limit " "%d for flow %d", bs, flow->id); } if (bs) DEBUG_MSG(LOG_NOTICE, "calculated response size %d for flow " "%d", bs, flow->id); return bs; } double next_interpacket_gap(struct flow *flow) { double gap = 0.0; if (flow->settings.write_rate) gap = ((double)flow->settings.maximum_block_size)/flow->settings.write_rate; else gap = calculate(flow, flow->settings.interpacket_gap_trafgen_options.distribution, flow->settings.interpacket_gap_trafgen_options.param_one, flow->settings.interpacket_gap_trafgen_options.param_two ); if (gap) DEBUG_MSG(LOG_NOTICE, "calculated next interpacket gap %.6fs " "for flow %d", gap, flow->id); return gap; }
/* Copyright (c) 2014 Yaroslav Pronin This file is part of Matrix. Matrix 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. Matrix 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 Matrix. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MATRIX_H #define MATRIX_H #include <QObject> #include <QtWidgets> namespace UI { class GUI; } #define FIRST_ARRAY 1 #define SECOND_ARRAY 2 //Класс операций над матрицами. class Matrix { private: int **arr1; int **arr2; //Размер строк и столбцов. int row; int column; //Используется при удалении 2-го массива. bool multiply_to_scalar; public: Matrix(); //Результирующий массив. int **array; //Копирование из таблицы в массив. void toArray(const QTableWidget *table, const int *l, const int *c, const int num); //Инициализация результирующего массива. void initializeArray(const int *r, const int *c); //Сложение. void add(const int *l, const int *c); //Вычитание. void subtract(const int *l, const int *c); //Умножение. void multiply(const int *l1, const int *c1, const int *l2, const int *c2); //Умножение на скалярное число. void multiplyToScalar(const int *l, const int *c, const int scalar); //Копирование из результирующего массива в таблицу. void toTable(QTableWidget *table, const int *row, const int *column); //Сохранение результата. bool toFile(UI::GUI *form); ~Matrix(); }; #endif
/* Copyright 2015 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_CORE_PLATFORM_WINDOWS_WINDOWS_FILE_SYSTEM_H_ #define TENSORFLOW_CORE_PLATFORM_WINDOWS_WINDOWS_FILE_SYSTEM_H_ #include "tensorflow/core/platform/file_system.h" #ifdef PLATFORM_WINDOWS #undef DeleteFile #endif namespace tensorflow { class WindowsFileSystem : public FileSystem { public: WindowsFileSystem() {} ~WindowsFileSystem() {} Status NewRandomAccessFile( const string& fname, std::unique_ptr<RandomAccessFile>* result) override; Status NewWritableFile(const string& fname, std::unique_ptr<WritableFile>* result) override; Status NewAppendableFile(const string& fname, std::unique_ptr<WritableFile>* result) override; Status NewReadOnlyMemoryRegionFromFile( const string& fname, std::unique_ptr<ReadOnlyMemoryRegion>* result) override; bool FileExists(const string& fname) override; Status GetChildren(const string& dir, std::vector<string>* result) override; Status Stat(const string& fname, FileStatistics* stat) override; Status DeleteFile(const string& fname) override; Status CreateDir(const string& name) override; Status DeleteDir(const string& name) override; Status GetFileSize(const string& fname, uint64* size) override; Status RenameFile(const string& src, const string& target) override; string TranslateName(const string& name) const override { return name; } }; class LocalWinFileSystem : public WindowsFileSystem { public: string TranslateName(const string& name) const override { StringPiece scheme, host, path; ParseURI(name, &scheme, &host, &path); return path.ToString(); } }; } // namespace tensorflow #endif // TENSORFLOW_CORE_PLATFORM_WINDOWS_WINDOWS_FILE_SYSTEM_H_
/** * ProgramCounter.h * * Copyright (C) 2015 Takayuki MATSUMURA * * 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. * * See LICENSE file on the base directory for more information. * */ /**********************************************************************/ #pragma once #include <cassert> #include "BinaryData.h" #include "SystemConfigure.h" #include "../loader/SimLoader.h" namespace Yaps { class ProgramCounter : public BinaryData { public: ProgramCounter (uint width = 32) : BinaryData(width) { auto entryPoint = SimLoader::instance()->entryPoint(); set(entryPoint); delayPc_ = 0; }; /// Destructor virtual ~ProgramCounter () {}; ProgramCounter& operator= (const BinaryData& obj) { static_cast<BinaryData>(*this) = obj; return *this; } virtual void increment () { if(delayPc_ == 0) { set(this->value() + 4); return; } set(delayPc_); delayPc_ = 0; } virtual void incrementWithNoDelay () { delayPc_ = 0; set(this->value() + 8); } virtual void set (ulong next) override { assert((next % 4) == 0); BinaryData::set(next); } void setDelayPc (ulong nextPc) { this->increment(); delayPc_ = nextPc; } private: BinaryData delayPc_ = BinaryData(32); }; } // Yaps
/* * Copyright (C) 2016 Patrick Steinhardt * * 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 <string.h> #include "capone/buf.h" #include "test.h" static struct cpn_buf buf; static int setup() { struct cpn_buf tmp = CPN_BUF_INIT; memcpy(&buf, &tmp, sizeof(struct cpn_buf)); return 0; } static int teardown() { cpn_buf_clear(&buf); return 0; } static void setting_buf_to_string_succeeds() { assert_success(cpn_buf_set(&buf, "test")); assert_string_equal(buf.data, "test"); } static void setting_buf_overwrites_content() { assert_success(cpn_buf_set(&buf, "test")); assert_success(cpn_buf_set(&buf, "other")); assert_string_equal(buf.data, "other"); } static void setting_buf_updates_length() { assert_success(cpn_buf_set(&buf, "test")); assert_int_equal(buf.length, strlen("test")); assert_success(cpn_buf_set(&buf, "longerstring")); assert_int_equal(buf.length, strlen("longerstring")); assert_success(cpn_buf_set(&buf, "s")); assert_int_equal(buf.length, strlen("s")); } static void appending_empty_buf_succeeds() { assert_success(cpn_buf_append(&buf, "test")); assert_string_equal(buf.data, "test"); } static void appending_twice_concatenates() { assert_success(cpn_buf_append(&buf, "test")); assert_success(cpn_buf_append(&buf, "test")); assert_string_equal(buf.data, "testtest"); } static void appending_empty_does_nothing() { assert_success(cpn_buf_append(&buf, "test")); assert_success(cpn_buf_append(&buf, "")); assert_string_equal(buf.data, "test"); } static void appending_hex_succeeds() { unsigned char bytes[] = { 0x01, 0x02, 0x03, 0x04 }; assert_success(cpn_buf_append_hex(&buf, bytes, 4)); assert_string_equal(buf.data, "01020304"); assert_int_equal(buf.length, 8); } static void printf_succeeds_on_empty_buf() { assert_success(cpn_buf_printf(&buf, "%s", "test")); assert_string_equal(buf.data, "test"); } static void printf_succeeds_on_nonempty_buf() { assert_success(cpn_buf_set(&buf, "test")); assert_success(cpn_buf_printf(&buf, "%s", "concatenated")); assert_string_equal(buf.data, "testconcatenated"); } int buf_test_run_suite(void) { const struct CMUnitTest tests[] = { test(setting_buf_to_string_succeeds), test(setting_buf_overwrites_content), test(setting_buf_updates_length), test(appending_empty_buf_succeeds), test(appending_twice_concatenates), test(appending_empty_does_nothing), test(appending_hex_succeeds), test(printf_succeeds_on_empty_buf), test(printf_succeeds_on_nonempty_buf) }; return execute_test_suite("buf", tests, NULL, NULL); }
/* * Cuda Graph Layout Tool * * Copyright (C) 2013 Roman Klapaukh * * 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 DEBUG_H_ #define DEBUG_H_ void debug(const char*, ...); #endif /* DEBUG_H_ */
/* This file is part of GNUnet. Copyright (C) 2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNUnet 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 GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file dv/gnunet-dv.c * @brief DV monitoring command line tool * @author Christian Grothoff */ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_dv_service.h" /** * Handle to DV service. */ static struct GNUNET_DV_ServiceHandle *sh; /** * Was verbose specified? */ static int verbose; /** * Function called if DV starts to be able to talk to a peer. * * @param cls closure * @param peer newly connected peer * @param distance distance to the peer * @param network the network the next hop is located in */ static void connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t distance, enum GNUNET_ATS_Network_Type network) { fprintf (stderr, "Connect: %s at %u\n", GNUNET_i2s (peer), (unsigned int) distance); } /** * Function called if DV distance to a peer is changed. * * @param cls closure * @param peer connected peer * @param distance new distance to the peer * @param network network used on first hop to peer */ static void change_cb (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t distance, enum GNUNET_ATS_Network_Type network) { fprintf (stderr, "Change: %s at %u\n", GNUNET_i2s (peer), (unsigned int) distance); } /** * Function called if DV is no longer able to talk to a peer. * * @param cls closure * @param peer peer that disconnected */ static void disconnect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) { fprintf (stderr, "Disconnect: %s\n", GNUNET_i2s (peer)); } /** * Function called if DV receives a message for this peer. * * @param cls closure * @param sender sender of the message * @param distance how far did the message travel * @param msg actual message payload */ static void message_cb (void *cls, const struct GNUNET_PeerIdentity *sender, uint32_t distance, const struct GNUNET_MessageHeader *msg) { if (verbose) fprintf (stderr, "Message: %s at %u sends %u bytes of type %u\n", GNUNET_i2s (sender), (unsigned int) distance, (unsigned int) ntohs (msg->size), (unsigned int) ntohs (msg->type)); } /** * Task run on shutdown. * * @param cls NULL * @param tc unused */ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_DV_service_disconnect (sh); sh = NULL; } /** * Main function that will be run by the scheduler. * * @param cls closure * @param args remaining command-line arguments * @param cfgfile name of the configuration file used (for saving, can be NULL!) * @param cfg configuration */ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { sh = GNUNET_DV_service_connect (cfg, NULL, &connect_cb, &change_cb, &disconnect_cb, &message_cb); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); } /** * The main function. * * @param argc number of arguments from the command line * @param argv command line arguments * @return 0 ok, 1 on error */ int main (int argc, char *const *argv) { int res; static const struct GNUNET_GETOPT_CommandLineOption options[] = { {'V', "verbose", NULL, gettext_noop ("verbose output"), 0, &GNUNET_GETOPT_set_one, &verbose}, GNUNET_GETOPT_OPTION_END }; if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv", gettext_noop ("Print information about DV state"), options, &run, NULL); GNUNET_free ((void *) argv); if (GNUNET_OK != res) return 1; return 0; } /* end of gnunet-dv.c */
// This file is distributed under GNU GPLv3 license. For full license text, see <project-git-repository-root-folder>/LICENSE.md. #ifndef SETTINGSGENERAL_H #define SETTINGSGENERAL_H #include "saurus/gui/settings/settingspanel.h" #include "ui_settingsgeneral.h" class SettingsGeneral : public SettingsPanel { Q_OBJECT public: explicit SettingsGeneral(Settings* settings, QWidget* parent = nullptr); virtual ~SettingsGeneral() = default; virtual QString title() const override; virtual void loadSettings() override; virtual void saveSettings() override; private: Ui::SettingsGeneral m_ui = {}; }; inline QString SettingsGeneral::title() const { return tr("General"); } #endif // SETTINGSGENERAL_H
#ifndef WEBSERVER_H #define WEBSERVER_H #include <inttypes.h> #include "OutputMemory.h" // List of protocols that can execute G-Codes enum class WebSource { HTTP, Telnet }; class Webserver { public: Webserver(Platform* p, Network *n) { }; void Init() const { }; void Spin() const { }; void Exit() const { }; void Diagnostics(MessageType mtype) const { }; bool GCodeAvailable(const WebSource source) const { return false; } char ReadGCode(const WebSource source) const { return '\0'; } uint32_t GetReplySeq() const { return (uint32_t)0; } uint16_t GetGCodeBufferSpace(const WebSource source) const { return 0; } void HandleGCodeReply(const WebSource source, OutputBuffer *reply) const; void HandleGCodeReply(const WebSource source, const char *reply) const { }; }; inline void Webserver::HandleGCodeReply(const WebSource source, OutputBuffer *reply) const { if (reply != (OutputBuffer *)0) OutputBuffer::ReleaseAll(reply); } #endif
/* NewSoftSerial.h - Multi-instance software serial library Copyright (c) 2006 David A. Mellis. All rights reserved. -- Interrupt-driven receive and other improvements by ladyada -- Tuning, circular buffer, derivation from class Print, multi-instance support, porting to 8MHz processors, various optimizations, PROGMEM delay tables, inverse logic and direct port writing by Mikal Hart This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA The latest version of this library can always be found at http://arduiniana.org. */ #ifndef NewSoftSerial_h #define NewSoftSerial_h #include <inttypes.h> #include "Print.h" /****************************************************************************** * Definitions ******************************************************************************/ #define _NewSS_MAX_RX_BUFF 64 // RX buffer size #define _NewSS_VERSION 10 // software version of this library #ifndef GCC_VERSION #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif class NewSoftSerial: public Print { private: // per object data uint8_t _receivePin; uint8_t _receiveBitMask; volatile uint8_t *_receivePortRegister; uint8_t _transmitBitMask; volatile uint8_t *_transmitPortRegister; uint16_t _rx_delay_centering; uint16_t _rx_delay_intrabit; uint16_t _rx_delay_stopbit; uint16_t _tx_delay; uint16_t _buffer_overflow :1; uint16_t _inverse_logic :1; // static data static char _receive_buffer[_NewSS_MAX_RX_BUFF]; static volatile uint8_t _receive_buffer_tail; static volatile uint8_t _receive_buffer_head; static NewSoftSerial *active_object; // private methods void recv(); bool activate(); virtual void write(uint8_t byte); uint8_t rx_pin_read(); void tx_pin_write(uint8_t pin_state); void setTX(uint8_t transmitPin); void setRX(uint8_t receivePin); // private static method for timing static inline void tunedDelay(uint16_t delay); public: // public methods NewSoftSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false); ~NewSoftSerial(); void begin(long speed); void end(); int read(); uint8_t available(void); bool active() { return this == active_object; } bool overflow() { bool ret = _buffer_overflow; _buffer_overflow = false; return ret; } static int library_version() { return _NewSS_VERSION; } static void enable_timer0(bool enable); void flush(); // public only for easy access by interrupt handlers static inline void handle_interrupt(); }; // Arduino 0012 workaround #undef int #undef char #undef long #undef byte #undef float #undef abs #undef round #endif
/*****************************************************************************\ Copyright (C) 2009, Aru <oneforaru at gmail dot com> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. \*****************************************************************************/ #pragma once #include "../Service.h" class DllExport IKeyboardHookHandler { public: struct KeyEventArgs { u32 VirtualKey; u16 RepeatCount; u8 ScanCode; b8 IsExtendedKey; b8 IsAltPressed; b8 WasKeyDownBefore; b8 IsKeyUpNow; }; virtual void OnKeyboardHookEvent( const KeyEventArgs &args ) = 0; }; class DllExport IKeyboardHookService : public IService { public: virtual void AddHandler( IKeyboardHookHandler *handler ) = 0; virtual void RemoveHandler( IKeyboardHookHandler *handler ) = 0; virtual b8 IsInExclusiveMode() = 0; virtual b8 RequestExclusiveAccess( IKeyboardHookHandler *handler ) = 0; virtual void ReleaseExclusiveAccess() = 0; };
/************************************************************************** * Otter Browser: Web browser controlled by the user, not vice-versa. * Copyright (C) 2017 - 2021 Michal Dutkiewicz aka Emdek <michal@emdek.pl> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * **************************************************************************/ #ifndef OTTER_COOKIEPROPERTIESDIALOG_H #define OTTER_COOKIEPROPERTIESDIALOG_H #include "Dialog.h" #include <QtNetwork/QNetworkCookie> namespace Otter { namespace Ui { class CookiePropertiesDialog; } class CookiePropertiesDialog final : public Dialog { Q_OBJECT public: explicit CookiePropertiesDialog(const QNetworkCookie &cookie, QWidget *parent = nullptr); ~CookiePropertiesDialog(); QNetworkCookie getOriginalCookie() const; QNetworkCookie getModifiedCookie() const; bool isModified() const; protected: void changeEvent(QEvent *event) override; void updateDateTimeFromat(); private: QNetworkCookie m_cookie; Ui::CookiePropertiesDialog *m_ui; }; } #endif
// // MTBAddMessageViewController.h // MTB_hOurworld_iOS // // Created by Keith Kyungsik Han on 6/15/13. // Copyright (c) 2013 HCI PSU. All rights reserved. // #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import <MapKit/MKAnnotation.h> #import "LocationAnnotation.h" #import "GAITrackedViewController.h" #import "ActionSheetStringPicker.h" @interface MTBAddMessageViewController : GAITrackedViewController <MKMapViewDelegate, CLLocationManagerDelegate, UITextViewDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UIAlertViewDelegate> { IBOutlet UITextView *messageTxt; IBOutlet UIBarButtonItem *submitBtn; IBOutlet UIButton *xDaysBtn; IBOutlet MKMapView *mapView; LocationAnnotation *annotation; CLLocationManager *locationManager; double latitude; double longitude; UIActionSheet *actionSheet; UIPickerView *pickerView; UIToolbar *toolbar; NSArray *data; int xDays; NSString *message; NSString *datetime; } @property (nonatomic, retain) IBOutlet UITextView *messageTxt; @property (nonatomic, retain) IBOutlet UIBarButtonItem *submitBtn; @property (nonatomic ,retain) IBOutlet UIButton *xDaysBtn; @property (nonatomic, retain) IBOutlet MKMapView *mapView; @property (nonatomic, retain) LocationAnnotation *annotation; @property (nonatomic, retain) CLLocationManager *locationManager; @property (nonatomic, retain) UIActionSheet *actionSheet; @property (nonatomic, retain) UIPickerView *pickerView; @property (nonatomic, retain) UIToolbar *toolbar; @property (nonatomic, retain) NSString *message; @property (nonatomic, retain) NSString *datetime; -(IBAction)pressSubmitBtn:(id)sender; -(IBAction)pressxDaysBtn:(id)sender; - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer; - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; @end
/* * This file is part of the continuous space language and translation model toolkit * for statistical machine translation and large vocabulary speech recognition. * * Copyright 2015, Holger Schwenk, LIUM, University of Le Mans, France * * The CSLM toolkit 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 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 * * * * virtual class to support various combinations of multiple machines * * IMPORTANT: * MultMach will call the destructor of the individual machines ! * Therefore the individual machines should be created by "new Mach()" and not * as the address of a machine allocated as (local) variable which would be freed */ #ifndef _MachMulti_h #define _MachMulti_h using namespace std; #include <vector> #include "Mach.h" class MachMulti : public Mach { protected: vector<Mach*> machs; vector<bool> activ_forw; // possibility to activate individual machines for the forward or backward pass vector<bool> activ_backw; // it's the responsibility of the user to verify that the output/gradient are still meaningful virtual void ReadParams(istream&, bool =true); virtual void ReadData(istream&, size_t, int=0); // read binary data virtual void WriteParams(ostream&); // write all params virtual void WriteData(ostream&); // write binary data virtual void CloneSubmachs(const MachMulti &); // copy all submachines MachMulti(const MachMulti &); // create a copy of the machine (without submachines) public: MachMulti(); // create initial sequence with no machine virtual ~MachMulti(); virtual MachMulti* Clone(); // create a copy of the machine and all submachines virtual int GetMType() {return file_header_mtype_multi;}; // get type of machine virtual ulong GetNbParams(); // return the nbr of allocated parameters virtual void SetBsize(int bs); virtual void SetNbEx(ulong nf, ulong nb); // access to machines virtual int MachGetNb() {return machs.size(); }; // get number of machines virtual Mach* MachGet(size_t); // get pointer to a machine // add and remove machines virtual void Delete(); // call destructor for all the machines virtual void MachAdd(Mach*); // add new machine after the existing ones virtual Mach *MachDel(); // delete the last machine // standard functions virtual void Info(bool=false, char *txt=(char*)""); // display (detailed) information on machine virtual bool CopyParams(Mach*); // copy parameters from another machine virtual void Forw(int=0, bool=false); // calculate outputs for current inputs virtual void Backw(const float lrate, const float wdecay, int=0); // calculate gradients at input for current gradients at output // additional functions virtual void Activate(int, bool, bool); // selectively activate a machine for forw or backw, numbering starts at zero }; #endif
/* Access Dallas 1-Wire Devices with ATMEL AVRs Author of the initial code: Peter Dannegger (danni(at)specs.de) modified by Martin Thomas (mthomas(at)rhrk.uni-kl.de) ported to esp8266 by Thomas Zimmermann (bugs(at)vdm-design.de) 9/2004 - use of delay.h, optional bus configuration at runtime 10/2009 - additional delay in ow_bit_io for recovery 5/2010 - timing modifcations, additonal config-values and comments, use of atomic.h macros, internal_t pull-up support 7/2010 - added method to skip recovery time after last bit transfered via ow_command_skip_last_recovery 7/2015 - ported to ESP8266 */ #include "ets_sys.h" #include "espmissingincludes.h" #include "c_types.h" #include "osapi.h" #include "os_type.h" #include "user_interface.h" #include "onewire.h" #include "gpio.h" #define OW_GET_IN() ( GPIO_INPUT_GET(OW_PIN) ) #define OW_OUT_LOW() ( GPIO_OUTPUT_SET(OW_PIN,0) ) #define OW_OUT_HIGH() ( GPIO_OUTPUT_SET(OW_PIN,1) ) #define OW_DIR_IN() ( GPIO_DIS_OUTPUT(OW_PIN) ) uint8_t ICACHE_FLASH_ATTR ow_input_pin_state() { return OW_GET_IN(); } void ICACHE_FLASH_ATTR ow_parasite_enable(void) { OW_OUT_HIGH(); } void ICACHE_FLASH_ATTR ow_parasite_disable(void) { OW_DIR_IN(); } uint8_t ICACHE_FLASH_ATTR ow_reset(void) { uint8_t err; OW_OUT_LOW(); // pull OW-Pin low for 480us os_delay_us(480); // set Pin as input - wait for clients to pull low OW_DIR_IN(); // input os_delay_us(64); // was 66 err = OW_GET_IN(); // no presence detect // if err!=0: nobody pulled to low, still high // after a delay the clients should release the line // and input-pin gets back to high by pull-up-resistor os_delay_us(480 - 64); // was 480-66 if( OW_GET_IN() == 0 ) { err = 1; // short circuit, expected low but got high } return err; } /* Timing issue when using runtime-bus-selection (!OW_ONE_BUS): The master should sample at the end of the 15-slot after initiating the read-time-slot. The variable bus-settings need more cycles than the constant ones so the delays had to be shortened to achive a 15uS overall delay Setting/clearing a bit in I/O Register needs 1 cyle in OW_ONE_BUS but around 14 cyles in configureable bus (us-Delay is 4 cyles per uS) */ static uint8_t ICACHE_FLASH_ATTR ow_bit_io_intern_t( uint8_t b, uint8_t with_parasite_enable ) { OW_OUT_LOW(); os_delay_us(2); // T_INT > 1usec accoding to timing-diagramm if ( b ) { OW_DIR_IN(); // to write "1" release bus, resistor pulls high } // "Output data from the DS18B20 is valid for 15usec after the falling // edge that initiated the read time slot. Therefore, the master must // release the bus and then sample the bus state within 15ussec from // the start of the slot." os_delay_us(15-2); if( OW_GET_IN() == 0 ) { b = 0; // sample at end of read-timeslot } os_delay_us(60-15-2); OW_DIR_IN(); if ( with_parasite_enable ) { ow_parasite_enable(); } os_delay_us(OW_RECOVERY_TIME); // may be increased for longer wires return b; } uint8_t ICACHE_FLASH_ATTR ow_bit_io( uint8_t b ) { return ow_bit_io_intern_t( b & 1, 0 ); } uint8_t ICACHE_FLASH_ATTR ow_byte_wr( uint8_t b ) { uint8_t i = 8, j; do { j = ow_bit_io( b & 1 ); b >>= 1; if( j ) { b |= 0x80; } } while( --i ); return b; } uint8_t ICACHE_FLASH_ATTR ow_byte_wr_with_parasite_enable( uint8_t b ) { uint8_t i = 8, j; do { if ( i != 1 ) { j = ow_bit_io_intern_t( b & 1, 0 ); } else { j = ow_bit_io_intern_t( b & 1, 1 ); } b >>= 1; if( j ) { b |= 0x80; } } while( --i ); return b; } uint8_t ICACHE_FLASH_ATTR ow_byte_rd( void ) { // read by sending only "1"s, so bus gets released // after the init low-pulse in every slot return ow_byte_wr( 0xFF ); } uint8_t ICACHE_FLASH_ATTR ow_rom_search( uint8_t diff, uint8_t *id ) { uint8_t i, j, next_diff; uint8_t b; if( ow_reset() ) { return OW_PRESENCE_ERR; // error, no device found <--- early exit! } ow_byte_wr( OW_SEARCH_ROM ); // ROM search command next_diff = OW_LAST_DEVICE; // unchanged on last device i = OW_ROMCODE_SIZE * 8; // 8 bytes do { j = 8; // 8 bits do { b = ow_bit_io( 1 ); // read bit if( ow_bit_io( 1 ) ) { // read complement bit if( b ) { // 0b11 return OW_DATA_ERR; // data error <--- early exit! } } else { if( !b ) { // 0b00 = 2 devices if( diff > i || ((*id & 1) && diff != i) ) { b = 1; // now 1 next_diff = i; // next pass 0 } } } ow_bit_io( b ); // write bit *id >>= 1; if( b ) { *id |= 0x80; // store bit } i--; } while( --j ); id++; // next byte } while( i ); return next_diff; // to continue search } static void ICACHE_FLASH_ATTR ow_command_intern_t( uint8_t command, uint8_t *id, uint8_t with_parasite_enable ) { uint8_t i; ow_reset(); if( id ) { ow_byte_wr( OW_MATCH_ROM ); // to a single device i = OW_ROMCODE_SIZE; do { ow_byte_wr( *id ); id++; } while( --i ); } else { ow_byte_wr( OW_SKIP_ROM ); // to all devices } if ( with_parasite_enable ) { ow_byte_wr_with_parasite_enable( command ); } else { ow_byte_wr( command ); } } void ICACHE_FLASH_ATTR ow_command( uint8_t command, uint8_t *id ) { ow_command_intern_t( command, id, 0); } void ICACHE_FLASH_ATTR ow_command_with_parasite_enable( uint8_t command, uint8_t *id ) { ow_command_intern_t( command, id, 1 ); }
// // ATVFSettingsController.h // ATVFiles // // Created by Eric Steil III on 9/4/07. // Copyright (C) 2007-2008 Eric Steil III // // 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/>. // #import <Cocoa/Cocoa.h> #import <BackRow/BackRow.h> #import "ATVFPreferences.h" #import <SapphireCompatClasses/SapphireCenteredMenuController.h> @interface ATVFSettingsController : SapphireCenteredMenuController { NSMutableArray *_items; } -(void)_buildMenu; @end
/* * Copyright (C) * Copyright (C) * * 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 SUNWELLCORE_COMMON_H #define SUNWELLCORE_COMMON_H // config.h needs to be included 1st /// @todo this thingy looks like hack, but its not, need to // make separate header however, because It makes mess here. #ifdef HAVE_CONFIG_H // Remove Some things that we will define // This is in case including another config.h // before trinity config.h #ifdef PACKAGE #undef PACKAGE #endif //PACKAGE #ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif //PACKAGE_BUGREPORT #ifdef PACKAGE_NAME #undef PACKAGE_NAME #endif //PACKAGE_NAME #ifdef PACKAGE_STRING #undef PACKAGE_STRING #endif //PACKAGE_STRING #ifdef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif //PACKAGE_TARNAME #ifdef PACKAGE_VERSION #undef PACKAGE_VERSION #endif //PACKAGE_VERSION #ifdef VERSION #undef VERSION #endif //VERSION # include "Config.h" #undef PACKAGE #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef VERSION #endif //HAVE_CONFIG_H #include "Define.h" #include "Dynamic/UnorderedMap.h" #include "Dynamic/UnorderedSet.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <math.h> #include <errno.h> #include <signal.h> #include <assert.h> #if PLATFORM == PLATFORM_WINDOWS #define STRCASECMP stricmp #else #define STRCASECMP strcasecmp #endif #include <set> #include <list> #include <string> #include <map> #include <queue> #include <sstream> #include <algorithm> #include <vector> #include "Threading/LockedQueue.h" #include "Threading/Threading.h" #include <ace/Basic_Types.h> #include <ace/Guard_T.h> #include <ace/RW_Thread_Mutex.h> #include <ace/Thread_Mutex.h> #include <ace/OS_NS_time.h> #include <ace/Stack_Trace.h> #if PLATFORM == PLATFORM_WINDOWS # include <ace/config-all.h> // XP winver - needed to compile with standard leak check in MemoryLeaks.h // uncomment later if needed //#define _WIN32_WINNT 0x0501 # include <ws2tcpip.h> //#undef WIN32_WINNT #else # include <sys/types.h> # include <sys/ioctl.h> # include <sys/socket.h> # include <netinet/in.h> # include <unistd.h> # include <netdb.h> #endif #if COMPILER == COMPILER_MICROSOFT #include <float.h> #define I32FMT "%08I32X" #define I64FMT "%016I64X" #define snprintf _snprintf #define atoll _atoi64 #define vsnprintf _vsnprintf #define finite(X) _finite(X) #define llabs _abs64 #else #define stricmp strcasecmp #define strnicmp strncasecmp #define I32FMT "%08X" #define I64FMT "%016llX" #endif inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; } #if COMPILER == COMPILER_MICROSOFT inline bool myisfinite(float f) { return _finite(f) && !_isnan(f); } #else inline bool myisfinite(float f) { return finite(f) && !isnan(f); } #endif #define atol(a) strtoul( a, NULL, 10) #define STRINGIZE(a) #a enum TimeConstants { MINUTE = 60, HOUR = MINUTE*60, DAY = HOUR*24, WEEK = DAY*7, MONTH = DAY*30, YEAR = MONTH*12, IN_MILLISECONDS = 1000 }; enum AccountTypes { SEC_PLAYER = 0, SEC_MODERATOR = 1, SEC_GAMEMASTER = 2, SEC_ADMINISTRATOR = 3, SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also }; enum LocaleConstant { LOCALE_enUS = 0, LOCALE_koKR = 1, LOCALE_frFR = 2, LOCALE_deDE = 3, LOCALE_zhCN = 4, LOCALE_zhTW = 5, LOCALE_esES = 6, LOCALE_esMX = 7, LOCALE_ruRU = 8 }; const uint8 TOTAL_LOCALES = 9; #define DEFAULT_LOCALE LOCALE_enUS #define MAX_LOCALES 8 #define MAX_ACCOUNT_TUTORIAL_VALUES 8 extern char const* localeNames[TOTAL_LOCALES]; LocaleConstant GetLocaleByName(const std::string& name); void CleanStringForMysqlQuery(std::string& str); typedef std::vector<std::string> StringVector; // we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some other platforms) #ifdef max #undef max #endif #ifdef min #undef min #endif #ifndef M_PI #define M_PI 3.14159265358979323846f #endif #define MAX_QUERY_LEN 32*1024 #define TRINITY_GUARD(MUTEX, LOCK) \ ACE_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); //! For proper implementation of multiple-read, single-write pattern, use //! ACE_RW_Mutex as underlying @MUTEX # define TRINITY_WRITE_GUARD(MUTEX, LOCK) \ ACE_Write_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); //! For proper implementation of multiple-read, single-write pattern, use //! ACE_RW_Mutex as underlying @MUTEX # define TRINITY_READ_GUARD(MUTEX, LOCK) \ ACE_Read_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); #endif
#ifndef FOREIGNKEYCOLUMN_H #define FOREIGNKEYCOLUMN_H #include <QDebug> #include <QString> class ForeignKeyColumn { public: ForeignKeyColumn(); QString getName() const; void setName(const QString &value); QString getReferenced() const; void setReferenced(const QString &value); private: QString name; QString referenced; }; QDebug operator<<(QDebug debug, const ForeignKeyColumn &fkc); #endif // FOREIGNKEYCOLUMN_H
// Intel 8250 serial port (UART). #include <core/types.h> #include <core/defs.h> #include <core/param.h> #include <core/traps.h> #include <sched/spinlock.h> #include <fs/fs.h> #include <fs/file.h> #include <mem/mmu.h> #include <sched/proc.h> #include <core/arch/x86.h> #define COM1 0x3f8 static int uart; // is there a uart? void uartinit(void) { char *p; // Turn off the FIFO outb(COM1 + 2, 0); // 9600 baud, 8 data bits, 1 stop bit, parity off. outb(COM1 + 3, 0x80); // Unlock divisor outb(COM1 + 0, 115200 / 9600); outb(COM1 + 1, 0); outb(COM1 + 3, 0x03); // Lock divisor, 8 data bits. outb(COM1 + 4, 0); outb(COM1 + 1, 0x01); // Enable receive interrupts. // If status is 0xFF, no serial port. if(inb(COM1 + 5) == 0xFF) { return; } uart = 1; // Acknowledge pre-existing interrupt conditions; // enable interrupts. inb(COM1 + 2); inb(COM1 + 0); picenable(IRQ_COM1); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p = "xv6...\n"; *p; p++) { uartputc(*p); } } void uartputc(int c) { int i; if(!uart) { return; } for(i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) { microdelay(10); } outb(COM1 + 0, c); } static int uartgetc(void) { if(!uart) { return -1; } if(!(inb(COM1 + 5) & 0x01)) { return -1; } return inb(COM1 + 0); } void uartintr(void) { consoleintr(uartgetc); }
// // AppDelegate.h // Guozijian // // Created by 李然 on 2017/1/3. // Copyright © 2017年 李然. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#ifndef MAGO_H #define MAGO_H #include "Ator.h" namespace atores { enum AveAnim { AVE_VOAR, AVE_ATACAR, AVE_DERROTADO }; enum AveEstado { AVE_ESTADO_VOANDO, AVE_ESTADO_PARADO }; class Ave : public Ator { private: u8 _Estado; u16 _HP; void Atacar(u8 tipo_bala); void Animar(); public: jogo::Vetor2 Sentido; Ave(); void Atualizar(); void LevarDano(u16 dano); }; } #endif
/* * 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. * * --- * * drop.c: Air-drop commodities * * Known contributors to this file: * Dave Pare, 1986 * Markus Armbruster, 2004-2012 */ #include <config.h> #include "commands.h" #include "item.h" #include "path.h" #include "plane.h" int drop(void) { coord tx, ty; coord ax, ay; int ap_to_target; struct ichrstr *ip; char flightpath[MAX_PATH_LEN]; struct nstr_item ni_bomb; struct nstr_item ni_esc; struct sctstr target; struct emp_qelem bomb_list; struct emp_qelem esc_list; int wantflags; struct sctstr ap_sect; char buf[1024]; if (get_planes(&ni_bomb, &ni_esc, player->argp[1], player->argp[2]) < 0) return RET_SYN; if (!get_assembly_point(player->argp[3], &ap_sect, buf)) return RET_SYN; ax = ap_sect.sct_x; ay = ap_sect.sct_y; if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY)) return RET_SYN; tx = ax; ty = ay; (void)pathtoxy(flightpath, &tx, &ty, fcost); pr("target is %s\n", xyas(tx, ty, player->cnum)); if (!(ip = whatitem(player->argp[5], "Drop off what? "))) return RET_SYN; getsect(tx, ty, &target); if (relations_with(target.sct_own, player->cnum) == ALLIED) { /* own or allied sector: cargo drop */ if (ip->i_uid == I_CIVIL) { if (target.sct_own != player->cnum) { pr("Your civilians refuse to board a flight abroad!\n"); return RET_FAIL; } if (target.sct_own != target.sct_oldown) { pr("Can't drop civilians into occupied sectors.\n"); return RET_FAIL; } } wantflags = P_C; } else { /* into the unknown... */ if (ip->i_uid != I_SHELL) { pr("You don't own %s!\n", xyas(tx, ty, player->cnum)); return RET_FAIL; } /* mine drop */ wantflags = P_MINE; } ap_to_target = strlen(flightpath); pr("range to target is %d\n", ap_to_target); /* * select planes within range */ pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, 2, wantflags, P_M | P_O); pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 2, P_ESC | P_F, P_M | P_O); /* * now arm and equip the bombers, transports, whatever. */ pln_arm(&bomb_list, 2 * ap_to_target, wantflags & P_MINE ? 'm' : 'd', ip); if (QEMPTY(&bomb_list)) { pr("No planes could be equipped for the mission.\n"); return RET_FAIL; } pln_arm(&esc_list, 2 * ap_to_target, 'e', NULL); ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0); if (QEMPTY(&bomb_list)) { pr("No planes got through fighter defenses\n"); } else { if (wantflags & P_MINE) pln_mine(&bomb_list, tx, ty); else pln_dropoff(&bomb_list, ip, tx, ty, -1); } pln_put(&bomb_list); pln_put(&esc_list); return RET_OK; }
#pragma once #include <vector> #include <algorithm> #include <cmath> namespace Testing { template<class T> static double getMean(std::vector<T> &_v){ auto size = _v.size(); double sum = 0.0; for(const auto val : _v){ sum += val; } return sum/size; } template<class T> static double getVariance(std::vector<T> &_v){ auto size = _v.size(); double mean = getMean(_v); double tmp = 0; for(const auto val : _v){ tmp += (mean - val) * (mean - val); } return tmp / size; } template<class T> static double getStdDev(std::vector<T> &_v){ return std::sqrt(getVariance(_v)); } template<class T> static T getMedian(std::vector<T> _v){ auto size = _v.size(); std::sort(_v.begin(), _v.end()); if (size % 2 == 0) { return (_v[(size / 2) - 1] + _v[size / 2]) / 2.0; } else { return _v[size / 2]; } } template<class T> static T getMin(std::vector<T> _v){ std::sort(_v.begin(), _v.end()); return _v.front(); } template<class T> static T getMax(std::vector<T> _v){ std::sort(_v.begin(), _v.end()); return _v.back(); } }
#ifndef DEVICE_H_ #define DEVICE_H_ #include <string> #include <vector> #include "ns3/Log.h" #include "ns3/Tick.h" #include "ns3/MyStats.h" #include "ns3/uinteger.h" #include "ns3/Adaption.h" #include "ns3/AdaptionFlex.h" #include "ns3/AdaptionOnOff.h" #include "ns3/MyConfig.h" #include "jsoncpp/json/value.h" #define DEV_ON 1 #define DEV_OFF 0 #define DEV_AWAY -1 #define DEV_COME_BACK -10 #define DEV_MODE_SINGLE_RUN 0 #define DEV_MODE_CONTINUOUS 1 namespace ns3 { class Device { protected: std::string id; int state; int mode; std::vector<double>* consumption; uint consumptionStep; Tick* t; int lastTick; int lastState; MyStats* stats; int consumptionStatId; int stateStatId; int activationCounterId; double adaptedConsumption; AdaptionFlex adaptionFlex; AdaptionOnOff adaptionOnOff; std::string category; std::string configName; int interval; MyConfig* config; double standbyConsumption; bool adaptionEnabled; int lastAdaption; public: Device(std::string id, int mode, std::vector<double>* consumption, double standbyConsumption = 0); virtual ~Device() {} virtual void init(Json::Value config) {} virtual void tick(); virtual double getConsumption(); virtual void setState(int state, int data = 0); std::string getId() { return id; } int getState() { return state; } std::vector<double>* getConsumptionList() { return consumption; } virtual bool isAdaptable() { return false; } virtual std::pair<AdaptionFlex*, AdaptionOnOff*> getAdaption() { return std::pair<AdaptionFlex*, AdaptionOnOff*>(&adaptionFlex, &adaptionOnOff); } virtual void setAdaptedConsumption(double consumption) { adaptedConsumption = consumption; tick(); } void setCategory(std::string category) { this->category = category; } std::string getCategory() { return category; } std::string getConfigName() { return configName; } }; } #endif
#ifndef MSG_H #define MSG_H /**** generic, internal msg stuff ****/ //enum msgproto : used to dispatch to/from correct txworkers // WARNING - adding protos heedlessly will break things (at least pmsg code and txblocks !) enum msgproto { MP_ISO=0, //9141 or 14230 MP_CAN=1, //CAN or iso15765 MP_SCI=2, //SCI J2610 (not impl) MP_J1850=3, //VPW or PWM (not impl) MP_INVALID=3 }; #endif
/****************************************************************************** ** Copyright (c) 2006-2017, Calaos. All Rights Reserved. ** ** This file is part of Calaos. ** ** Calaos is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 3 of the License, or ** (at your option) any later version. ** ** Calaos is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Foobar; if not, write to the Free Software ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ** ******************************************************************************/ #ifndef S_MySensorsOutputDimmer_H #define S_MySensorsOutputDimmer_H #include "OutputLightDimmer.h" namespace Calaos { class MySensorsOutputDimmer : public OutputLightDimmer { private: virtual bool set_value_real(int val); public: MySensorsOutputDimmer(Params &p); ~MySensorsOutputDimmer(); }; } #endif
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2012 Sandia National Laboratories. All rights reserved. * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #ifndef OSC_PT2PT_FRAG_H #define OSC_PT2PT_FRAG_H #include "ompi/communicator/communicator.h" #include "osc_pt2pt_header.h" #include "osc_pt2pt_request.h" #include "opal/align.h" /** Communication buffer for packing messages */ struct ompi_osc_pt2pt_frag_t { opal_free_list_item_t super; /* target rank of buffer */ int target; unsigned char *buffer; /* space remaining in buffer */ size_t remain_len; /* start of unused space */ char *top; /* Number of operations which have started writing into the frag, but not yet completed doing so */ volatile int32_t pending; int32_t pending_long_sends; ompi_osc_pt2pt_frag_header_t *header; ompi_osc_pt2pt_module_t *module; }; typedef struct ompi_osc_pt2pt_frag_t ompi_osc_pt2pt_frag_t; OBJ_CLASS_DECLARATION(ompi_osc_pt2pt_frag_t); int ompi_osc_pt2pt_frag_start(ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_frag_t *buffer); int ompi_osc_pt2pt_frag_flush_target(ompi_osc_pt2pt_module_t *module, int target); int ompi_osc_pt2pt_frag_flush_all(ompi_osc_pt2pt_module_t *module); static inline int ompi_osc_pt2pt_frag_finish (ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_frag_t* buffer) { opal_atomic_wmb (); if (0 == OPAL_THREAD_ADD32(&buffer->pending, -1)) { opal_atomic_mb (); return ompi_osc_pt2pt_frag_start(module, buffer); } return OMPI_SUCCESS; } static inline ompi_osc_pt2pt_frag_t *ompi_osc_pt2pt_frag_alloc_non_buffered (ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_peer_t *peer, size_t request_len) { ompi_osc_pt2pt_frag_t *curr; /* to ensure ordering flush the buffer on the peer */ curr = peer->active_frag; if (NULL != curr && opal_atomic_cmpset (&peer->active_frag, curr, NULL)) { /* If there's something pending, the pending finish will start the buffer. Otherwise, we need to start it now. */ int ret = ompi_osc_pt2pt_frag_finish (module, curr); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { return NULL; } } curr = (ompi_osc_pt2pt_frag_t *) opal_free_list_get (&mca_osc_pt2pt_component.frags); if (OPAL_UNLIKELY(NULL == curr)) { return NULL; } curr->target = peer->rank; curr->header = (ompi_osc_pt2pt_frag_header_t*) curr->buffer; curr->top = (char*) (curr->header + 1); curr->remain_len = mca_osc_pt2pt_component.buffer_size; curr->module = module; curr->pending = 1; curr->header->base.type = OMPI_OSC_PT2PT_HDR_TYPE_FRAG; curr->header->base.flags = OMPI_OSC_PT2PT_HDR_FLAG_VALID; if (module->passive_target_access_epoch) { curr->header->base.flags |= OMPI_OSC_PT2PT_HDR_FLAG_PASSIVE_TARGET; } curr->header->source = ompi_comm_rank(module->comm); curr->header->num_ops = 1; return curr; } /* * Note: this function takes the module lock * * buffered sends will cache the fragment on the peer object associated with the * target. unbuffered-sends will cause the target fragment to be flushed and * will not be cached on the peer. this causes the fragment to be flushed as * soon as it is sent. this allows request-based rma fragments to be completed * so MPI_Test/MPI_Wait/etc will work as expected. */ static inline int ompi_osc_pt2pt_frag_alloc (ompi_osc_pt2pt_module_t *module, int target, size_t request_len, ompi_osc_pt2pt_frag_t **buffer, char **ptr, bool long_send, bool buffered) { ompi_osc_pt2pt_peer_t *peer = ompi_osc_pt2pt_peer_lookup (module, target); ompi_osc_pt2pt_frag_t *curr; /* osc pt2pt headers can have 64-bit values. these will need to be aligned * on an 8-byte boundary on some architectures so we up align the allocation * size here. */ request_len = OPAL_ALIGN(request_len, 8, size_t); if (request_len > mca_osc_pt2pt_component.buffer_size) { return OMPI_ERR_OUT_OF_RESOURCE; } OPAL_OUTPUT_VERBOSE((MCA_BASE_VERBOSE_TRACE, ompi_osc_base_framework.framework_output, "attempting to allocate buffer for %lu bytes to target %d. long send: %d, " "buffered: %d", (unsigned long) request_len, target, long_send, buffered)); OPAL_THREAD_LOCK(&module->lock); if (buffered) { curr = peer->active_frag; if (NULL == curr || curr->remain_len < request_len || (long_send && curr->pending_long_sends == 32)) { curr = ompi_osc_pt2pt_frag_alloc_non_buffered (module, peer, request_len); if (OPAL_UNLIKELY(NULL == curr)) { OPAL_THREAD_UNLOCK(&module->lock); return OMPI_ERR_OUT_OF_RESOURCE; } curr->pending_long_sends = long_send; peer->active_frag = curr; } else { OPAL_THREAD_ADD32(&curr->header->num_ops, 1); curr->pending_long_sends += long_send; } OPAL_THREAD_ADD32(&curr->pending, 1); } else { curr = ompi_osc_pt2pt_frag_alloc_non_buffered (module, peer, request_len); if (OPAL_UNLIKELY(NULL == curr)) { OPAL_THREAD_UNLOCK(&module->lock); return OMPI_ERR_OUT_OF_RESOURCE; } } *ptr = curr->top; *buffer = curr; curr->top += request_len; curr->remain_len -= request_len; OPAL_THREAD_UNLOCK(&module->lock); return OMPI_SUCCESS; } #endif
/* sp-kallsyms.c * * Copyright © 2018 Christian Hergert <chergert@redhat.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/>. */ #define G_LOG_DOMAIN "sp-kallsyms" #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include <errno.h> #include <string.h> #include <stdio.h> #include "sp-kallsyms.h" struct _SpKallsyms { gchar *buf; gsize buflen; gchar *endptr; gchar *iter; }; void sp_kallsyms_free (SpKallsyms *self) { if (self != NULL) { g_clear_pointer (&self->buf, g_free); g_slice_free (SpKallsyms, self); } } SpKallsyms * sp_kallsyms_new (const gchar *path) { g_autoptr(SpKallsyms) self = NULL; if (path == NULL) path = "/proc/kallsyms"; self = g_slice_new0 (SpKallsyms); if (!g_file_get_contents (path, &self->buf, &self->buflen, NULL)) return NULL; self->iter = self->buf; self->endptr = self->buf + self->buflen; return g_steal_pointer (&self); } gboolean sp_kallsyms_next (SpKallsyms *self, const gchar **name, guint64 *address, guint8 *type) { guint64 addr; char *tok; char *pptr; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (self->buf != NULL, FALSE); g_return_val_if_fail (self->buflen > 0, FALSE); g_return_val_if_fail (self->iter != NULL, FALSE); g_return_val_if_fail (self->endptr != NULL, FALSE); try_next: if (self->iter >= self->endptr) return FALSE; tok = strtok_r (self->iter, " \t\n", &self->iter); if (!tok || *tok == 0) return FALSE; if (*tok == '[') { tok = strtok_r (self->iter, " \t\n", &self->iter); if (!tok || *tok == 0) return FALSE; } /* We'll keep going if we fail to parse, (null) usually, so that we * just skip to the next line. */ addr = g_ascii_strtoull (tok, &pptr, 16); if ((pptr == tok) || (addr == G_MAXUINT64 && errno == ERANGE) || (addr == 0 && errno == EINVAL)) addr = 0; *address = addr; if (self->iter >= self->endptr) return FALSE; tok = strtok_r (self->iter, " \t\n", &self->iter); if (!tok || *tok == 0) return FALSE; switch (*tok) { case 'A': case 'B': case 'D': case 'R': case 'T': case 'V': case 'W': case 'a': case 'b': case 'd': case 'r': case 't': case 'w': *type = *tok; break; default: return FALSE; } if (self->iter >= self->endptr) return FALSE; tok = strtok_r (self->iter, " \t\n", &self->iter); if (!tok || *tok == 0) return FALSE; if (self->iter >= self->endptr) return FALSE; if (addr == 0) goto try_next; *name = tok; return TRUE; }
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ #include <linux/fs.h> #include <linux/mm.h> #include <linux/stat.h> #define DEBUG_SUBSYSTEM S_LLITE #include "llite_internal.h" static int ll_readlink_internal(struct inode *inode, struct ptlrpc_request **request, char **symname) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); int rc, symlen = i_size_read(inode) + 1; struct mdt_body *body; struct md_op_data *op_data; *request = NULL; if (lli->lli_symlink_name) { int print_limit = min_t(int, PAGE_SIZE - 128, symlen); *symname = lli->lli_symlink_name; /* If the total CDEBUG() size is larger than a page, it * will print a warning to the console, avoid this by * printing just the last part of the symlink. */ CDEBUG(D_INODE, "using cached symlink %s%.*s, len = %d\n", print_limit < symlen ? "..." : "", print_limit, (*symname) + symlen - print_limit, symlen); return 0; } op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, symlen, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) { return PTR_ERR(op_data); } op_data->op_valid = OBD_MD_LINKNAME; rc = md_getattr(sbi->ll_md_exp, op_data, request); ll_finish_md_op_data(op_data); if (rc) { if (rc != -ENOENT) CERROR("%s: inode "DFID": rc = %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(ll_inode2fid(inode)), rc); goto failed; } body = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_BODY); if ((body->mbo_valid & OBD_MD_LINKNAME) == 0) { CERROR("OBD_MD_LINKNAME not set on reply\n"); rc = -EPROTO; goto failed; } LASSERT(symlen != 0); if (body->mbo_eadatasize != symlen) { CERROR("%s: inode "DFID": symlink length %d not expected %d\n", ll_get_fsname(inode->i_sb, NULL, 0), PFID(ll_inode2fid(inode)), body->mbo_eadatasize - 1, symlen - 1); rc = -EPROTO; goto failed; } *symname = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_MD); if (!*symname || strnlen(*symname, symlen) != symlen - 1) { /* not full/NULL terminated */ CERROR("inode %lu: symlink not NULL terminated string of length %d\n", inode->i_ino, symlen - 1); rc = -EPROTO; goto failed; } lli->lli_symlink_name = kzalloc(symlen, GFP_NOFS); /* do not return an error if we cannot cache the symlink locally */ if (lli->lli_symlink_name) { memcpy(lli->lli_symlink_name, *symname, symlen); *symname = lli->lli_symlink_name; } return 0; failed: return rc; } static void ll_put_link(void *p) { ptlrpc_req_finished(p); } static const char *ll_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) { struct ptlrpc_request *request = NULL; int rc; char *symname = NULL; if (!dentry) { return ERR_PTR(-ECHILD); } CDEBUG(D_VFSTRACE, "VFS Op\n"); ll_inode_size_lock(inode); rc = ll_readlink_internal(inode, &request, &symname); ll_inode_size_unlock(inode); if (rc) { ptlrpc_req_finished(request); return ERR_PTR(rc); } /* symname may contain a pointer to the request message buffer, * we delay request releasing then. */ set_delayed_call(done, ll_put_link, request); return symname; } const struct inode_operations ll_fast_symlink_inode_operations = { .readlink = generic_readlink, .setattr = ll_setattr, .get_link = ll_get_link, .getattr = ll_getattr, .permission = ll_inode_permission, .listxattr = ll_listxattr, };
// // BPPAppDelegate.h // PhotoPad // // Created by Albert Martin on 11/20/13. // Copyright (c) 2013 Albert Martin. All rights reserved. // #import <UIKit/UIKit.h> #import "MTStatusBarOverlay.h" @class HTTPServer; @interface BPPAppDelegate : UIResponder <UIApplicationDelegate, MTStatusBarOverlayDelegate> @property (strong, nonatomic) HTTPServer *httpServer; @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) MTStatusBarOverlay *overlay; @end
// // GBBuildingAnnotation.h // GT-Buses // // Created by Alex Perez on 11/20/14. // Copyright (c) 2014 Alex Perez. All rights reserved. // @import MapKit; @import CoreLocation; @class GBBuilding; @interface GBBuildingAnnotation : MKPointAnnotation @property (nonatomic, strong) GBBuilding *building; - (instancetype)initWithBuilding:(GBBuilding *)building; @end
// // arduino-serial-lib -- simple library for reading/writing serial ports // // 2006-2013, Tod E. Kurt, http://todbot.com/blog/ // #define _BSD_SOURCE #include <stdio.h> // Standard input/output definitions #include <unistd.h> // UNIX standard function definitions #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> // File control definitions #include <errno.h> // Error number definitions #include <termios.h> // POSIX terminal control definitions #include <string.h> // String function definitions #include <sys/ioctl.h> #include "arduino-serial-lib.h" // uncomment this to debug reads //#define SERIALPORTDEBUG // takes the string name of the serial port (e.g. "/dev/tty.usbserial","COM1") // and a baud rate (bps) and connects to that port at that speed and 8N1. // opens the port in fully raw mode so you can send binary data. // returns valid fd, or -1 on error int serialport_init(const char* serialport, int baud) { struct termios toptions; int fd; //fd = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY); fd = open(serialport, O_RDWR | O_NONBLOCK ); if (fd == -1) { perror("serialport_init: Unable to open port "); return -1; } //int iflags = TIOCM_DTR; //ioctl(fd, TIOCMBIS, &iflags); // turn on DTR //ioctl(fd, TIOCMBIC, &iflags); // turn off DTR if (tcgetattr(fd, &toptions) < 0) { perror("serialport_init: Couldn't get term attributes"); return -1; } speed_t brate = baud; // let you override switch below if needed switch(baud) { case 4800: brate=B4800; break; case 9600: brate=B9600; break; #ifdef B14400 case 14400: brate=B14400; break; #endif case 19200: brate=B19200; break; #ifdef B28800 case 28800: brate=B28800; break; #endif case 38400: brate=B38400; break; case 57600: brate=B57600; break; case 115200: brate=B115200; break; } cfsetispeed(&toptions, brate); cfsetospeed(&toptions, brate); // 8N1 toptions.c_cflag &= ~PARENB; toptions.c_cflag &= ~CSTOPB; toptions.c_cflag &= ~CSIZE; toptions.c_cflag |= CS8; // no flow control toptions.c_cflag &= ~CRTSCTS; //toptions.c_cflag &= ~HUPCL; // disable hang-up-on-close to avoid reset toptions.c_cflag |= CREAD | CLOCAL; // turn on READ & ignore ctrl lines toptions.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl toptions.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw toptions.c_oflag &= ~OPOST; // make raw // see: http://unixwiz.net/techtips/termios-vmin-vtime.html toptions.c_cc[VMIN] = 0; toptions.c_cc[VTIME] = 0; //toptions.c_cc[VTIME] = 20; tcsetattr(fd, TCSANOW, &toptions); if( tcsetattr(fd, TCSAFLUSH, &toptions) < 0) { perror("init_serialport: Couldn't set term attributes"); return -1; } return fd; } // int serialport_close( int fd ) { return close( fd ); } // int serialport_writebyte( int fd, uint8_t b) { int n = write(fd,&b,1); if( n!=1) return -1; return 0; } // int serialport_write(int fd, const char* str) { int len = strlen(str); int n = write(fd, str, len); if( n!=len ) { perror("serialport_write: couldn't write whole string\n"); return -1; } return 0; } // int serialport_read_until(int fd, char* buf, char until, int buf_max, int timeout) { char b[1]; // read expects an array, so we give it a 1-byte array int i=0; do { int n = read(fd, b, 1); // read a char at a time if( n==-1) return -1; // couldn't read if( n==0 ) { usleep( 1 * 1000 ); // wait 1 msec try again timeout--; continue; } #ifdef SERIALPORTDEBUG printf("serialport_read_until: i=%d, n=%d b='%c'\n",i,n,b[0]); // debug #endif buf[i] = b[0]; i++; } while( b[0] != until && i < buf_max && timeout>0 ); buf[i] = 0; // null terminate the string return 0; } // int serialport_flush(int fd) { sleep(2); //required to make flush work, for some reason return tcflush(fd, TCIOFLUSH); }
/* * ruleRtcCfg.c * * Created on: 2017年3月4日 * Author: chunhuifu */ /* Includes -All--------------------------------------------*/ #include "../inc/gpioIrqForDoorCfg.h" /** * @brief Configure PA1 as the IRQ for Door Operation * PA3 as the status checked PIN * PA0 as the PWM wave generator * @param None * @retval None */ //void gpioIrqForDoorCfg(void) //{ // EXTI_InitTypeDef EXTI_InitStructure; // GPIO_InitTypeDef GPIO_InitStructure; // NVIC_InitTypeDef NVIC_InitStructure; // // /* Enable GPIOA clock */ // RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); // // /* Configure PA0 pin as Output*/ // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; // GPIO_Init(GPIOA, &GPIO_InitStructure); // GPIO_ResetBits(GPIOA, GPIO_Pin_0); // // /* Configure PA1 pin as input floating*/ // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; // GPIO_Init(GPIOA, &GPIO_InitStructure); // // /* Configure PA3 pin as input floating*/ // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; // GPIO_Init(GPIOA, &GPIO_InitStructure); // // /* Enable SYSCFG clock */ // RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // /* Connect EXTI3 Line to PA3 pin */ // SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource3); // // /* Configure EXTI3 line */ // EXTI_InitStructure.EXTI_Line = EXTI_Line3; // EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; // EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; // EXTI_InitStructure.EXTI_LineCmd = ENABLE; // EXTI_Init(&EXTI_InitStructure); // // /* Enable and set EXTI1 Interrupt */ // NVIC_InitStructure.NVIC_IRQChannel = EXTI2_3_IRQn; // NVIC_InitStructure.NVIC_IRQChannelPriority = 0x00; // NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; // NVIC_Init(&NVIC_InitStructure); // //}
#ifndef MCOBROSERVICIOCLIENTESERVICIO_H #define MCOBROSERVICIOCLIENTESERVICIO_H #include <QObject> class MCobroServicioClientePeriodo : public QObject { Q_OBJECT public: explicit MCobroServicioClientePeriodo(QObject *parent = 0); static bool agregarCobro( const int id_cobro_servicio, const int id_servicio, const int id_cliente, const int id_factura ); static bool setearIDCtaCte( const int id_cobro_servicio, const int id_servicio, const int id_cliente, const int id_op_ctacte ); static double buscarNoPagados( const int id_cliente, const int id_servicio, const int id_cobro_servicio ); static bool verificarIdFactura( const int id_factura ); static bool colocarComoPagado( const int id_factura, const int id_recibo ); static bool esDeudor( const int id_cliente, const int id_servicio ); static int buscarIdPeriodoServicio( const int id_recibo ); static bool tieneDatosRelacionados( const int id_servicio, const int id_cliente ); }; #endif // MCOBROSERVICIOCLIENTESERVICIO_H
/******************************************************************************* * File Name: SD_DAT2.h * Version 2.10 * * Description: * This file containts Control Register function prototypes and register defines * * Note: * ******************************************************************************** * Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. *******************************************************************************/ #if !defined(CY_PINS_SD_DAT2_H) /* Pins SD_DAT2_H */ #define CY_PINS_SD_DAT2_H #include "cytypes.h" #include "cyfitter.h" #include "cypins.h" #include "SD_DAT2_aliases.h" /* Check to see if required defines such as CY_PSOC5A are available */ /* They are defined starting with cy_boot v3.0 */ #if !defined (CY_PSOC5A) #error Component cy_pins_v2_10 requires cy_boot v3.0 or later #endif /* (CY_PSOC5A) */ /* APIs are not generated for P15[7:6] */ #if !(CY_PSOC5A &&\ SD_DAT2__PORT == 15 && ((SD_DAT2__MASK & 0xC0) != 0)) /*************************************** * Function Prototypes ***************************************/ void SD_DAT2_Write(uint8 value) ; void SD_DAT2_SetDriveMode(uint8 mode) ; uint8 SD_DAT2_ReadDataReg(void) ; uint8 SD_DAT2_Read(void) ; uint8 SD_DAT2_ClearInterrupt(void) ; /*************************************** * API Constants ***************************************/ /* Drive Modes */ #define SD_DAT2_DM_ALG_HIZ PIN_DM_ALG_HIZ #define SD_DAT2_DM_DIG_HIZ PIN_DM_DIG_HIZ #define SD_DAT2_DM_RES_UP PIN_DM_RES_UP #define SD_DAT2_DM_RES_DWN PIN_DM_RES_DWN #define SD_DAT2_DM_OD_LO PIN_DM_OD_LO #define SD_DAT2_DM_OD_HI PIN_DM_OD_HI #define SD_DAT2_DM_STRONG PIN_DM_STRONG #define SD_DAT2_DM_RES_UPDWN PIN_DM_RES_UPDWN /* Digital Port Constants */ #define SD_DAT2_MASK SD_DAT2__MASK #define SD_DAT2_SHIFT SD_DAT2__SHIFT #define SD_DAT2_WIDTH 1u /*************************************** * Registers ***************************************/ /* Main Port Registers */ /* Pin State */ #define SD_DAT2_PS (* (reg8 *) SD_DAT2__PS) /* Data Register */ #define SD_DAT2_DR (* (reg8 *) SD_DAT2__DR) /* Port Number */ #define SD_DAT2_PRT_NUM (* (reg8 *) SD_DAT2__PRT) /* Connect to Analog Globals */ #define SD_DAT2_AG (* (reg8 *) SD_DAT2__AG) /* Analog MUX bux enable */ #define SD_DAT2_AMUX (* (reg8 *) SD_DAT2__AMUX) /* Bidirectional Enable */ #define SD_DAT2_BIE (* (reg8 *) SD_DAT2__BIE) /* Bit-mask for Aliased Register Access */ #define SD_DAT2_BIT_MASK (* (reg8 *) SD_DAT2__BIT_MASK) /* Bypass Enable */ #define SD_DAT2_BYP (* (reg8 *) SD_DAT2__BYP) /* Port wide control signals */ #define SD_DAT2_CTL (* (reg8 *) SD_DAT2__CTL) /* Drive Modes */ #define SD_DAT2_DM0 (* (reg8 *) SD_DAT2__DM0) #define SD_DAT2_DM1 (* (reg8 *) SD_DAT2__DM1) #define SD_DAT2_DM2 (* (reg8 *) SD_DAT2__DM2) /* Input Buffer Disable Override */ #define SD_DAT2_INP_DIS (* (reg8 *) SD_DAT2__INP_DIS) /* LCD Common or Segment Drive */ #define SD_DAT2_LCD_COM_SEG (* (reg8 *) SD_DAT2__LCD_COM_SEG) /* Enable Segment LCD */ #define SD_DAT2_LCD_EN (* (reg8 *) SD_DAT2__LCD_EN) /* Slew Rate Control */ #define SD_DAT2_SLW (* (reg8 *) SD_DAT2__SLW) /* DSI Port Registers */ /* Global DSI Select Register */ #define SD_DAT2_PRTDSI__CAPS_SEL (* (reg8 *) SD_DAT2__PRTDSI__CAPS_SEL) /* Double Sync Enable */ #define SD_DAT2_PRTDSI__DBL_SYNC_IN (* (reg8 *) SD_DAT2__PRTDSI__DBL_SYNC_IN) /* Output Enable Select Drive Strength */ #define SD_DAT2_PRTDSI__OE_SEL0 (* (reg8 *) SD_DAT2__PRTDSI__OE_SEL0) #define SD_DAT2_PRTDSI__OE_SEL1 (* (reg8 *) SD_DAT2__PRTDSI__OE_SEL1) /* Port Pin Output Select Registers */ #define SD_DAT2_PRTDSI__OUT_SEL0 (* (reg8 *) SD_DAT2__PRTDSI__OUT_SEL0) #define SD_DAT2_PRTDSI__OUT_SEL1 (* (reg8 *) SD_DAT2__PRTDSI__OUT_SEL1) /* Sync Output Enable Registers */ #define SD_DAT2_PRTDSI__SYNC_OUT (* (reg8 *) SD_DAT2__PRTDSI__SYNC_OUT) #if defined(SD_DAT2__INTSTAT) /* Interrupt Registers */ #define SD_DAT2_INTSTAT (* (reg8 *) SD_DAT2__INTSTAT) #define SD_DAT2_SNAP (* (reg8 *) SD_DAT2__SNAP) #endif /* Interrupt Registers */ #endif /* CY_PSOC5A... */ #endif /* CY_PINS_SD_DAT2_H */ /* [] END OF FILE */
/*! \file csv.h \brief a convenience wrapper around libcsv (written by Robert Gamble) \author Hellyna Ng (hellyna@hellyna.com) */ #ifndef CSV_H_5120D992_9901_495F_8826_9098CD9DA3C8 #define CSV_H_5120D992_9901_495F_8826_9098CD9DA3C8 #include "libcsv.h" typedef struct csv_parser csv_parser; /*! The csv_data_t \b struct */ struct csv_data_t { /*! The number of lines in the csv file. */ size_t line_count; /*! The number of entries in each line in a csv file. */ size_t* entry_counts; /*! The csv data, implemented in a two-dimensional array holding data strings. */ char*** data; }; typedef struct csv_data_t csv_data_t; /*! Constructs and recursively allocates memory for a new csv_data_t \param path the path to the associated csv file. \return a new csv_data_t instance. */ csv_data_t* construct_csv_data (const char* path); /*! Destructs and recursively free memory for the associated csv_data_t \param csvd the csv_data_t instance to free and destruct. */ void destruct_csv_data (csv_data_t* csvd); /*! Prints data in the associated csv_data_t instance. Used for debugging purposes. \param csvd the csv_data_t instance to print. */ void print_csv_data (const csv_data_t* csvd); #endif
/* * ===================================================================================== * * Filename: 02.c * * Description: * * Version: 1.0 * Created: 03/01/18 08:15:44 * Revision: none * Compiler: gcc * * Author: Krzysztof Stasiowski (ks), krzys.stasiowski@gmail.com * Company: N/A * * ===================================================================================== */ #include<stdio.h> #include<stdlib.h> int main(int argc,char const **argv){ int sum =0; char *c; for (int i=1;i<argc;i++) { int j =strtol(argv[i],&c,10); if(j ==0 && argv[i]==c) { printf("BŁĄD - nieporawny numer: %s %s\n",argv[i],c); return -1; } sum+=j; } printf("suma: %d\n",sum); }
/* * Generated by class-dump 3.1.2. * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. */ #import "_ABCreateStringWithAddressDictionary.h" #import "UICollectionViewDataSource-Protocol.h" @class NSFetchedResultsController; @interface TNDRNewMatchesViewModel : _ABCreateStringWithAddressDictionary <UICollectionViewDataSource> { id <NSFetchedResultsControllerDelegate> _fetchedResultsControllerDelegate; NSFetchedResultsController *_fetchedResultsController; } - (void)setFetchedResultsController:(id)fp8; - (id)fetchedResultsController; - (void)setFetchedResultsControllerDelegate:(id)fp8; - (id)fetchedResultsControllerDelegate; - (void).cxx_destruct; - (void)configureCell:(id)fp8 atIndexPath:(id)fp12; - (id)collectionView:(id)fp8 cellForItemAtIndexPath:(id)fp12; - (int)collectionView:(id)fp8 numberOfItemsInSection:(int)fp12; - (int)numberOfSectionsInCollectionView:(id)fp8; - (id)sortDescriptors; - (BOOL)filterMatchesForSearchText:(id)fp8; - (void)handleWillClearUserInformationNotification:(id)fp8; - (void)unregisterNotifications; - (void)registerNotifications; - (int)unviewedMatchCount; - (id)matchForIndexPath:(id)fp8; - (id)allMatches; - (int)matchCount; - (id)newMatchesWithNonNilUserPredicate; - (id)basePredicateString; - (void)setupMatchesDataWithDelegate:(id)fp8; - (void)dealloc; - (void)setupWithDelegate:(id)fp8; - (id)initWithDelegate:(id)fp8; @end
/**************** Copyright (c) 2005-2012 Antonio Pertusa Ibáñez <pertusa@dlsi.ua.es> Copyright (c) 2012 Universidad de Alicante This multiple fundamental frequency estimation method 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 multiple fundamental frequency estimation method 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 code. If not, see <http://www.gnu.org/licenses/>. Comments are welcomed **************/ #ifndef PEAKSATT #define PEAKSATT #include "defines.h" #include <iostream> class peaksatt { public: peaksatt(); peaksatt(int t_ini, int t_end, const mapa2& spectrum_peaks); peaksatt(const peaksatt& patt); mapa2 specpeaks; // maybe should be a pointer for efficiency int tini; int tend; }; ostream &operator<<(ostream &output, const peaksatt& patt); #endif
//////////////////////////////////////////////////////////////////////////////// // // (C) Andy Thomason 2012-2014 // // Modular Framework for OpenGLES2 rendering on multiple platforms. // namespace octet { namespace resources { /// Zip file reader, uses zip_decoder to inflate compressed files. /// Zip files are smaller and faster than regular files. /// They make updates easier and work will over the internet. class zip_file { int ref_cnt; FILE *the_file; struct dir_entry { uint32_t offset; uint32_t csize; uint32_t usize; uint32_t compression; }; dictionary<dir_entry> directory; zip_decoder decoder; // read little endian bytes on any machine static unsigned u4(const uint8_t *src) { return src[0] + src[1] * 256 + src[2] * 65536 + src[3] * 0x1000000; } static int s4(const uint8_t *src) { return (int32_t)(src[0] + src[1] * 256 + src[2] * 65536 + src[3] * 0x1000000); } static unsigned u2(const uint8_t *src) { return src[0] + src[1] * 256; } static int s2(const uint8_t *src) { return (int16_t)(src[0] + src[1] * 256); } public: /// Open a zip file for reading zip_file(const char *filename) { ref_cnt = 0; the_file = fopen(filename, "rb"); if (!the_file) { printf("file %s not found\n", filename); } else { uint8_t tmp[256]; unsigned tmp_size = (unsigned)sizeof(tmp); fseek(the_file, 0, SEEK_END); long file_size = ftell(the_file); long search_offset = file_size - (long)tmp_size; search_offset = search_offset < 0 ? 0 : search_offset; fseek(the_file, search_offset, SEEK_SET); fread(&tmp, 1, tmp_size, the_file); for( unsigned i = 0; i != tmp_size; ++i) { if (u4(tmp + i) == 0x06054b50) { dynarray<uint8_t> dir; dir.resize(u4(tmp + i + 12)); fseek(the_file, (long)u4(tmp + i + 16), SEEK_SET); fread(&dir[0], 1, dir.size(), the_file); for (unsigned i = 0; i + 4 < dir.size();) { uint8_t *p = &dir[i]; if (u4(p) != 0x02014b50) break; struct dir_entry d; d.compression = u2(p + 10); d.csize = u4(p + 20); d.usize = u4(p + 24); unsigned file_name_len = u2(p + 28); unsigned extra_len = u2(p + 30); string file; file.set((const char*)(p + 46), file_name_len); i += 46 + file_name_len + extra_len; d.offset = u4(p + 42);// + (46 + file_name_len + extra_len); for (unsigned i = 0; file[i]; ++i) { if (file[i] == '\\') file[i] = '/'; } //printf("%s\n", file.c_str()); directory[file] = d; } break; } } } } /// close the zip file ~zip_file() { if (the_file) fclose(the_file); } /// allow ref<zip_file> void add_ref() { ref_cnt++; } /// allow ref<zip_file> void release() { if (--ref_cnt) { delete this; } } /// get a file from a zip file, this is called from get_url with a zip:// prefix. void get_file(dynarray<uint8_t> &buffer, const char *file) { int index = directory.get_index(file); if (index < 0) return; if (!the_file) return; const dir_entry &d = directory.get_value(index); buffer.resize(d.usize); fseek(the_file, d.offset, SEEK_SET); /*local file header signature 4 bytes (0x04034b50) 0 version needed to extract 2 bytes 4 general purpose bit flag 2 bytes 6 compression method 2 bytes 8 last mod file time 2 bytes 10 last mod file date 2 bytes 12 crc-32 4 bytes 14 compressed size 4 bytes 18 uncompressed size 4 bytes 22 file name length 2 bytes 26 extra field length 2 bytes 28 / 30*/ uint8_t tmp[30]; fread(tmp, 1, sizeof(tmp), the_file); if (u4(tmp) != 0x04034b50) return; unsigned extra = u2(tmp + 26) + u2(tmp + 28); fseek(the_file, d.offset + 30 + extra, SEEK_SET); if (d.compression == 0) { fread(buffer.data(), 1, d.usize, the_file); } else if (d.compression == 8) { dynarray<uint8_t> uncomp(d.csize + 4); // note: + 4 bytes prevents decode() overflowing fread(uncomp.data(), 1, d.csize, the_file); decoder.decode(buffer.data(), buffer.data() + d.usize, uncomp.data(), uncomp.data() + d.csize); } } }; } }
/* * Copyright 2011-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_VOLK_RUNTIME #define INCLUDED_VOLK_RUNTIME #include <volk_fft/volk_fft_typedefs.h> #include <volk_fft/volk_fft_config_fixed.h> #include <volk_fft/volk_fft_common.h> #include <volk_fft/volk_fft_complex.h> #include <volk_fft/volk_fft_malloc.h> #include <stdlib.h> #include <stdbool.h> __VOLK_DECL_BEGIN typedef struct volk_fft_func_desc { const char **impl_names; const int *impl_deps; const bool *impl_alignment; const size_t n_impls; } volk_fft_func_desc_t; //! Prints a list of machines available VOLK_API void volk_fft_list_machines(void); //! Returns the name of the machine this instance will use VOLK_API const char* volk_fft_get_machine(void); //! Get the machine alignment in bytes VOLK_API size_t volk_fft_get_alignment(void); /*! * The VOLK_OR_PTR macro is a convenience macro * for checking the alignment of a set of pointers. * Example usage: * volk_fft_is_aligned(VOLK_OR_PTR((VOLK_OR_PTR(p0, p1), p2))) */ #define VOLK_OR_PTR(ptr0, ptr1) \ (const void *)(((intptr_t)(ptr0)) | ((intptr_t)(ptr1))) /*! * Is the pointer on a machine alignment boundary? * * Note: for performance reasons, this function * is not usable until another volk_fft API call is made * which will perform certain initialization tasks. * * \param ptr the pointer to some memory buffer * \return 1 for alignment boundary, else 0 */ VOLK_API bool volk_fft_is_aligned(const void *ptr); #for $kern in $kernels //! A function pointer to the dispatcher implementation extern VOLK_API $kern.pname $kern.name; //! A function pointer to the fastest aligned implementation extern VOLK_API $kern.pname $(kern.name)_a; //! A function pointer to the fastest unaligned implementation extern VOLK_API $kern.pname $(kern.name)_u; //! Call into a specific implementation given by name extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name); //! Get description paramaters for this kernel extern VOLK_API volk_fft_func_desc_t $(kern.name)_get_func_desc(void); #end for __VOLK_DECL_END #endif /*INCLUDED_VOLK_RUNTIME*/
#ifndef __VGITEXTUREIOREQUESTDISPATCHER_H__ #define __VGITEXTUREIOREQUESTDISPATCHER_H__ #include <vgImage/vgiDefinition.h> #include <vgKernel/vgkForward.h> #include <vgKernel/vgkSingleton.h> #include <vgKernel/vgkTrace.h> #include <vgImage/vgiTexture.h> #include <vgKernel/vgkRenderCommandManager.h> namespace vgImage { class IoRequest; class IoRequestTextureLod; /** @date 2008/06/20 15:39 @author leven @brief Ï൱ÓÚIoRequestµÄ¹ÜÀíÀà. 1.¸ºÔðtextureµÄÔØÈë,´¦ÀíÖØ¸´µÄÇëÇó. 2.¸ºÔðvgmµÄÔØÈë. @see */ class VGI_EXPORT TextureIoRequestDispatcher : public vgKernel::Singleton<TextureIoRequestDispatcher> { typedef std::set<Texture*> TexturePipe; typedef std::pair<TexturePipe::iterator, bool> TexPipeInsertResult; friend class vgKernel::Singleton<TextureIoRequestDispatcher>; private: TextureIoRequestDispatcher(); ~TextureIoRequestDispatcher(); protected: virtual bool initialise(); virtual bool shutdown(); public: virtual void reset(){};//need to write bool initialize() { return true; } bool addTextureUpdate( Texture* texture ); // set_asyn_mode == true Ò첽ģʽ void setAsynMode( const bool& set_asyn_mode ); void dealWithUpdateInfoEveryFrame(); private: void dealWithAllTextures(); void dealWithTexture( Texture* curtex ); bool loadTextureAndSendIoRequest( Texture* texture , const bool& asyn_mode); void unloadTexture( Texture* texture ); private: // true --> Ò첽ģʽ bool _asynMode; TexturePipe _texPipe; vgKernel::RenderCommand *pTexIoCommand; }; }// end of namespace vgImage #endif // end of __VGITEXTUREIOREQUESTDISPATCHER_H__
/***************************************************************************** * * displayWindow.h -- class declaration * * Copyright 2013,2014,2016 James Fidell (james@openastroproject.org) * * License: * * This file is part of the Open Astro Project. * * The Open Astro Project is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The Open Astro Project 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 the Open Astro Project. If not, see * <http://www.gnu.org/licenses/>. * *****************************************************************************/ #pragma once #include <oa_common.h> #ifdef HAVE_QT5 #include <QtWidgets> #endif #include <QtCore> #include <QtGui> #include "configuration.h" #include "cameraWidget.h" #include "imageWidget.h" #include "controlWidget.h" #include "previewWidget.h" #include "zoomWidget.h" class DisplayWindow : public QWidget { Q_OBJECT public: DisplayWindow ( QWidget* parent = 0 ); ~DisplayWindow(); void configure ( void ); public slots: void changePreviewState ( int ); public: QWidget* video; private: CameraWidget* cameraWidget; ImageWidget* imageWidget; ControlWidget* controlWidget; PreviewWidget* previewWidget; QScrollArea* previewScroller; QVBoxLayout* outerBox; QHBoxLayout* topBox; QHBoxLayout* bottomBox; QVBoxLayout* topLeftBox; ZoomWidget* zoomWidget; };
/* * QuarkPlayer, a Phonon media player * Copyright (C) 2008-2009 Tanguy Krotoff <tkrotoff@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ICONFIGWIDGET_H #define ICONFIGWIDGET_H #include <quarkplayer-plugins/ConfigWindow/ConfigWindowExport.h> #include <QtGui/QWidget> class QString; /** * Interface for settings panel from the configuration window. * * @author Tanguy Krotoff */ class CONFIGWINDOW_API IConfigWidget : public QWidget { Q_OBJECT public: virtual ~IConfigWidget() { } virtual QString name() const = 0; virtual QString iconName() const = 0; virtual void readConfig() = 0; virtual void saveConfig() = 0; virtual void retranslate() = 0; }; #endif //ICONFIGWIDGET_H
/* * Multi2Sim * Copyright (C) 2012 Rafael Ubal (ubal@ece.neu.edu) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MEM_SYSTEM_MOD_STACK_H #define MEM_SYSTEM_MOD_STACK_H #include "module.h" /* Current identifier for stack */ extern long long mod_stack_id; /* Read/write request direction */ enum mod_request_dir_t { mod_request_invalid = 0, mod_request_up_down, mod_request_down_up }; /* ACK types */ enum mod_reply_type_t { reply_none = 0, reply_ack , reply_ack_data, reply_ack_data_sent_to_peer, reply_ack_error }; /* Message types */ enum mod_message_type_t { message_none = 0, message_clear_owner }; /* Stack */ struct mod_stack_t { int diffWords; long long id; enum mod_access_kind_t access_kind; int *witness_ptr; struct linked_list_t *event_queue; void *event_queue_item; struct mod_client_info_t *client_info; struct mod_t *mod; struct mod_t *target_mod; struct mod_t *except_mod; struct mod_t *peer; struct mod_port_t *port; unsigned int addr; unsigned int vtl_addr; int tag; int set; int way; int state; int prev_state; // used to collect statistics int src_set; int src_way; int src_tag; enum mod_request_dir_t request_dir; enum mod_message_type_t message; enum mod_reply_type_t reply; int reply_size; int retain_owner; int pending; /* Linked list of accesses in 'mod' */ struct mod_stack_t *access_list_prev; struct mod_stack_t *access_list_next; /* Linked list of write accesses in 'mod' */ struct mod_stack_t *write_access_list_prev; struct mod_stack_t *write_access_list_next; /* Bucket list of accesses in hash table in 'mod' */ struct mod_stack_t *bucket_list_prev; struct mod_stack_t *bucket_list_next; /* Flags */ int hit : 1; int err : 1; int shared : 1; int read : 1; int write : 1; int nc_write : 1; int prefetch : 1; int blocking : 1; int writeback : 1; int eviction : 1; int retry : 1; int coalesced : 1; int port_locked : 1; /* Message sent through interconnect */ struct net_msg_t *msg; /* Linked list for waiting events */ int waiting_list_event; /* Event to schedule when stack is waken up */ struct mod_stack_t *waiting_list_prev; struct mod_stack_t *waiting_list_next; /* Waiting list for locking a port. */ int port_waiting_list_event; struct mod_stack_t *port_waiting_list_prev; struct mod_stack_t *port_waiting_list_next; /* Waiting list. Contains other stacks waiting for this one to finish. * Waiting stacks corresponds to slave coalesced accesses waiting for * the current one to finish. */ struct mod_stack_t *waiting_list_head; struct mod_stack_t *waiting_list_tail; int waiting_list_count; int waiting_list_max; /* Master stack that the current access has been coalesced with. * This field has a value other than NULL only if 'coalesced' is TRUE. */ struct mod_stack_t *master_stack; /* Events waiting in directory lock */ int dir_lock_event; struct mod_stack_t *dir_lock_next; /* Return stack */ struct mod_stack_t *ret_stack; int ret_event; }; struct mod_stack_t *mod_stack_create(long long id, struct mod_t *mod, unsigned int addr, int ret_event, struct mod_stack_t *ret_stack); struct mod_stack_t *mod_stack_create_vishesh(long long id, struct mod_t *mod, unsigned int addr, unsigned int vtl_addr, int ret_event, struct mod_stack_t *ret_stack); void mod_stack_return(struct mod_stack_t *stack); void mod_stack_wait_in_mod(struct mod_stack_t *stack, struct mod_t *mod, int event); void mod_stack_wakeup_mod(struct mod_t *mod); void mod_stack_wait_in_port(struct mod_stack_t *stack, struct mod_port_t *port, int event); void mod_stack_wakeup_port(struct mod_port_t *port); void mod_stack_wait_in_stack(struct mod_stack_t *stack, struct mod_stack_t *master_stack, int event); void mod_stack_wakeup_stack(struct mod_stack_t *master_stack); #endif
/* * (C) Copyright 2005 * Greg Ungerer <greg.ungerer@opengear.com>. * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H /* * High Level Configuration Options * (easy to change) */ #define CONFIG_KS8695 1 /* it is a KS8695 CPU */ #define CONFIG_CM41xx 1 /* it is an OpenGear CM41xx boad */ #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS 1 #define CONFIG_INITRD_TAG 1 #define CONFIG_DRIVER_KS8695ETH /* use KS8695 ethernet driver */ /* * Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) /* * Hardware drivers */ /* * select serial console configuration */ #define CONFIG_ENV_IS_NOWHERE #define CONFIG_KS8695_SERIAL #define CONFIG_SERIAL1 #define CONFIG_CONS_INDEX 1 #define CONFIG_BAUDRATE 115200 /* * BOOTP options */ #define CONFIG_BOOTP_BOOTFILESIZE #define CONFIG_BOOTP_BOOTPATH #define CONFIG_BOOTP_GATEWAY #define CONFIG_BOOTP_HOSTNAME /* * Command line configuration. */ #include <config_cmd_default.h> #undef CONFIG_CMD_SAVEENV #define CONFIG_BOOTDELAY 0 #define CONFIG_BOOTARGS "mem=32M console=ttyAM0,115200" #define CONFIG_BOOTCOMMAND "gofsk 0x02200000" /* * Miscellaneous configurable options */ #define CONFIG_SYS_LONGHELP /* undef to save memory */ #define CONFIG_SYS_PROMPT "boot > " /* Monitor Command Prompt */ #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ #define CONFIG_SYS_MEMTEST_START 0x00800000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x01000000 /* 16 MB in DRAM */ #define CONFIG_SYS_LOAD_ADDR 0x00008000 /* default load address */ #define CONFIG_SYS_HZ (1000) /* 1ms resolution ticks */ /*----------------------------------------------------------------------- * Physical Memory Map */ #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ #define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ #define PHYS_SDRAM_1_SIZE 0x02000000 /* 32 MB */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 #define CONFIG_SYS_INIT_SP_ADDR 0x00020000 /* lowest 128k of RAM */ #define PHYS_FLASH_1 0x02000000 /* Flash Bank #1 */ #define PHYS_FLASH_SECT_SIZE 0x00020000 /* 128 KB sectors (x1) */ #define CONFIG_SYS_FLASH_BASE PHYS_FLASH_1 /*----------------------------------------------------------------------- * FLASH and environment organization */ #define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max number of flash banks */ #define CONFIG_SYS_MAX_FLASH_SECT (128) /* max number of sectors on one chip */ /* timeout values are in ticks */ #define CONFIG_SYS_FLASH_ERASE_TOUT (20*CONFIG_SYS_HZ) /* Timeout for Flash Erase */ #define CONFIG_SYS_FLASH_WRITE_TOUT (20*CONFIG_SYS_HZ) /* Timeout for Flash Write */ #define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment */ #endif /* __CONFIG_H */
#ifndef _GRID #define _GRID #pragma once #include "ofxAssimpModelLoader.h" #include "Model.h" #include <vector> #include <time.h> typedef std::vector<int> GridMap; #define BLOCK_SEPARATION 500; class Grid { public: Grid(int rows, int cols, Model* m, ofVec3f p, string color); ~Grid(){ delete _model; } virtual void draw() =0; virtual void update() =0; void setPosition(ofVec3f p); //sets the position of the hole body ofVec3f getPosition(); void drawGrid(); void resetGridMap(); GridMap checkCollisions(GridMap& gM); GridMap checkCorrectBlocks(GridMap& gM); void setStartPoint(ofVec3f p); GridMap getMap() { return _gMap;} void loadMap(GridMap& g); int notUsedBlocks(){return _notUsedBlocks;} int collisionNumber(){return _collisionNumber;} int correctBlocks(){return _correctBlocks;} void generateRandomGrid(); float amountOfMovement(){return _amountOfMovement;} void restoreGrid(); void enableRainbowMode(){_rainbowMode=true;} void disableRainbowMode(){_rainbowMode=false;} bool rainbowMode(){return _rainbowMode;} void generateRandomColor(); void pauseResume(){ _isPaused=!_isPaused; if(_isPaused){ _pausedT = clock(); } else{ if(_pausedT != 0) //if has been paused at least one time _timePaused += ((double)clock() - _pausedT)/CLOCKS_PER_SEC; } } bool isPaused(){return _isPaused;} protected: int _rows, _cols;//mida parets GridMap _gMap; GridMap _resetMap; GridMap _restore; GridMap _previousMap; Model* _model; ofVec3f _position; //posicio absoluta del punt del primer block ofVec3f _startPoint; ofColor _cubeColor; int _notUsedBlocks; int _collisionNumber; int _correctBlocks; bool _isGridSet; float _amountOfMovement; bool _isAWall; bool _rainbowMode; bool _isPaused; double _timePaused; clock_t _pausedT; }; #endif
/* DreamChess ** ** DreamChess is the legal property of its developers, whose names are too ** numerous to list here. Please refer to the AUTHORS.txt file distributed ** with this source distribution. ** ** 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 "dialogs.h" static gg_dialog_style_t style_ingame, style_menu; gg_dialog_style_t *get_ingame_style(void) { return &style_ingame; } gg_dialog_style_t *get_menu_style(void) { return &style_menu; }
/* INTERRUPT CONTROLLER */ #define FIQ_SOURCE_BIT 0x00000001 #define SWI_BIT 0x00000002 #define RTOS_TIMER_BIT 0x00000004 #define GP_TIMER_BIT 0x00000008 #define WAKEUP_TIMER_BIT 0x00000010 #define WATCHDOG_TIMER_BIT 0x00000020 #define FLASHCON_BIT 0x00000040 #define ADC_BIT 0x00000080 #define PLL_LOCK_BIT 0x00000100 #define SM_SLAVE_BIT 0x00000200 #define SM_MASTER0_BIT 0x00000400 #define SM_MASTER1_BIT 0x00000800 #define SPI_SLAVE_BIT 0x00001000 #define SPI_MASTER_BIT 0x00002000 #define UART_BIT 0x00004000 #define XIRQ0_BIT 0x00008000 #define MONITOR_BIT 0x00010000 #define PSM_BIT 0x00020000 #define XIRQ1_BIT 0x00040000 #define PLA_IRQ0_BIT 0x00080000 #define PLA_IRQ1_BIT 0x00100000 #define SPM4_IO_PIN 0x00200000 #define SPM5_IO_PIN 0x00400000 #define PWM_BIT 0x00800000 #define IRQBASE (*(volatile unsigned long *) 0XFFFF0000) #define IRQSTA (*(volatile unsigned long *) 0XFFFF0000) #define IRQSIG (*(volatile unsigned long *) 0XFFFF0004) #define IRQEN (*(volatile unsigned long *) 0XFFFF0008) #define IRQCLR (*(volatile unsigned long *) 0XFFFF000C) #define SWICFG (*(volatile unsigned long *) 0XFFFF0010) #define FIQSTA (*(volatile unsigned long *) 0XFFFF0100) #define FIQSIG (*(volatile unsigned long *) 0XFFFF0104) #define FIQEN (*(volatile unsigned long *) 0XFFFF0108) #define FIQCLR (*(volatile unsigned long *) 0XFFFF010C)
#ifndef _STRMATCH_H #define _STRMATCH_H 1 #include <config.h> #include "stdc.h" /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in <unistd.h>. */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to `strmatch'. */ /* standard flags are like fnmatch(3). */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ /* extended flags not available in most libc fnmatch versions, but we undef them to avoid any possible warnings. */ #undef FNM_LEADING_DIR #undef FNM_CASEFOLD #undef FNM_EXTMATCH #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ #define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ #define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */ /* Value returned by `strmatch' if STRING does not match PATTERN. */ #undef FNM_NOMATCH #define FNM_NOMATCH 1 /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int strmatch(char *, char *, int); #if HANDLE_MULTIBYTE extern int wcsmatch(wchar_t *, wchar_t *, int); #endif #endif /* _STRMATCH_H */
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <signal.h> #include <stdint.h> #include <stdlib.h> #include <ucontext.h> void sigtrap_sa(int nr, siginfo_t *si, void *__ctx) { int i; long val; int fd = open("/proc/dr/dr6", O_RDONLY); read(fd, &val, sizeof val); close(fd); if (val & 0x1) printf("Breakpoint 0\n"); if (val & 0x2) printf("Breakpoint 1\n"); if (val & 0x4) printf("Breakpoint 2\n"); if (val & 0x8) printf("Breakpoint 3\n"); } int main(int argc, char *argv[]) { int dr; long val; int fd, n; char line[64]; char buffer[32]; char cmd; char *tok1, *tok2, *tok3; char *tok; struct sigaction sa; sa.sa_sigaction = sigtrap_sa; sa.sa_flags = SA_SIGINFO; sigaction(SIGTRAP, &sa, NULL); printf("&cmd: %p\n", &cmd); printf("&dr : %p\n", &dr); printf("&val: %p\n", &val); while (1) { fd = -1, dr = -1; printf("> "); fgets(line, sizeof line - 1, stdin); line[strlen(line)-1] = '\0'; tok = strtok(line, " "); if (tok != NULL) { cmd = *tok; tok = strtok(NULL, " "); if (tok) { dr = atoi(tok); snprintf(buffer, sizeof buffer, "/proc/dr/dr%d", dr); fd = open(buffer, O_RDWR); } else { printf("Missing register number\n"); continue; } } else { printf("No command.\n"); continue; } switch (cmd) { case 'w': tok = strtok(NULL, " "); if (tok) { val = strtoll(tok, NULL, 0); printf("Writing %ld (%lx) to dr%d\n", val, val, dr); if (fd < 0) { printf("Oops.\n"); continue; } write(fd, &val, sizeof val); } else { printf("Missing value\n"); continue; } /* Fall through */ case 'r': n = read(fd, &val, sizeof val); printf("Got %d bytes: %ld (%lx)\n", n, val, val); break; default: printf("Bad cmd '%c'\n", cmd); break; } if (dr >= 0 && fd >= 0) close(fd); } return 0; }
#ifndef AND_H #define AND_H class And : public Connector { // Inherited from Connector: // Shell* leftChild, Shell* rightChild, bool execute, bool anySuccess public: // Constructors And() : Connector() {} And(Shell* left) : Connector(left) {} And(Shell* left, Shell* right) : Connector(left, right) {} And(Shell* left, Shell* right, bool execute) : Connector(left, right, execute) {} // Destructor ~And() { cout << "Deleting AND object" << endl; delete [] leftChild; delete [] rightChild; } void evaluate() { // check if left child succeeded (using leftChild->success()) // if succeeded, rightChild->execute = 1, evaluate // if not, rightChild->execute = 0, evaluate leftChild->setExecute(execute); leftChild->evaluate(); // check if leftChild->evaluate() succeeded or not if (leftChild->succeeded()) { // if leftChild succeeded, set right->execute to 1, then evaluate rightChild->setExecute(1); rightChild->evaluate(); } else { // if leftChild failed, set right->execute to 0 rightChild->setExecute(0); rightChild->evaluate(); } if (leftChild->getAnySuccess() || rightChild->getAnySuccess()) { setAnySuccess(1); } return; } void setLeftChild(Shell* newChild) { leftChild = newChild; } void setRightChild(Shell* newChild) { rightChild = newChild; } void setExecute(bool newExecute) { execute = newExecute; } Shell* getLeftChild() { return leftChild; } Shell* getRightChild() { return rightChild; } bool getExecute() { return execute; } }; #endif
/** * Copyright 2007-2011 Jarbas Jácome * * This file is part of ViMus. * * ViMus 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. * * ViMus 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 ViMus. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOCAPTUREOPENCV_H #define VIDEOCAPTUREOPENCV_H #include "Configuration.h" #include "cv.h" #include "highgui.h" #include <boost/thread.hpp> #include <boost/thread/xtime.hpp> #include <iostream> /** * This class encapsulates all OpenCV video capture code. * * @author Jarbas Jácome */ class VideoCaptureOpenCV { public: /** * VideoCaptureOpenCV default constructor. */ VideoCaptureOpenCV(); /** * VideoCaptureOpenCV destructor. */ ~VideoCaptureOpenCV(); /** * Initializes VideoCaptureOpenCV */ void init(); /** * Get pointer to currentFrame buffer pointer. * This is necessary for GUI to have a direct access to * machine frame buffer. */ unsigned char* getCurrentFrame(int dev); /** * Start next avaiable Capture device and get its number. */ int getNextCaptureDevice(); /** * Stop a capture device. */ void stopCaptureDevice(int dev); private: // used to make possible to call non-static member functions // to use in threads static VideoCaptureOpenCV* vidCapOpenCvPtr; const static int NUM_MAX_DEVICES = 10; cv::VideoCapture* videoCapDevices[NUM_MAX_DEVICES]; cv::Mat frame[NUM_MAX_DEVICES]; cv::Mat frameDst[NUM_MAX_DEVICES]; cv::Mat frameDstSwap[NUM_MAX_DEVICES]; bool swapBufferOn; unsigned char* capturedFrame[NUM_MAX_DEVICES]; unsigned char* redFrame; void grabCapturedFrame(int dev); bool flagGrabing; void grabThreadFunc(); inline static void grabThreadFuncStatic() { vidCapOpenCvPtr->grabThreadFunc(); }; boost::thread* grabThread; boost::xtime sleepGrab; boost::xtime lastTimeSys; double elapsedTime; }; #endif // VIDEOCAPTUREOPENCV_H
/* * Copyright (C) 2007-2009 Daniel Prevost <dprevost@photonsoftware.org> * * This file is part of Photon (photonsoftware.org). * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 2 or version 3 as published by the * Free Software Foundation and appearing in the file COPYING.GPL2 and * COPYING.GPL3 included in the packaging of this software. * * Licensees holding a valid Photon Commercial license can use this file * in accordance with the terms of their license. * * This software 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. */ /* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */ #include "folderTest.h" const bool expectedToPass = false; /* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */ int main() { #if defined(USE_DBC) psonFolder* pFolder; psonSessionContext context; bool ok; psonTxStatus status; psonFolderItem folderItem; psoObjectDefinition def = { PSO_FOLDER, 0, 0, 0 }; pFolder = initFolderTest( expectedToPass, &context ); psonTxStatusInit( &status, SET_OFFSET( context.pTransaction ) ); ok = psonFolderInit( pFolder, 0, 1, 0, &status, 5, "Test1", 1234, &context ); if ( ok != true ) { ERROR_EXIT( expectedToPass, &context.errorHandler, ; ); } ok = psonFolderInsertObject( pFolder, "test2", "Test2", 5, &def, NULL, NULL, 1, 0, &context ); if ( ok != true ) { ERROR_EXIT( expectedToPass, &context.errorHandler, ; ); } ok = psonFolderGetObject( NULL, "test2", 5, PSO_FOLDER, &folderItem, &context ); ERROR_EXIT( expectedToPass, NULL, ; ); #else return 1; #endif } /* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
/* Copyright (c) <2012> <B.Hoessen> This file is part of saturnin. saturnin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. saturnin 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 saturnin. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SATURNIN_CLAUSEALLOCATOR_H #define SATURNIN_CLAUSEALLOCATOR_H #include "PoolList.h" #include "Saturnin.h" namespace saturnin{ /** * This class represent a ClauseAllocator: the only object that is allowed * to create a clause */ class SATURNIN_EXPORT ClauseAllocator final { public: /** * Create a new Clause allocator * It will allocate memory to hold @a maxSize times @a maxLength clauses * @param maxSize the initial maximum size of the clauses * @param maxLenght the initial maximum number of clauses of a given * size */ ClauseAllocator(unsigned int maxSize, unsigned int maxLenght); /** * Destructor. * Every clause that was generated with this clause allocator won't be * usable anymore */ ~ClauseAllocator(); /** * Create a new clause * @param lits the array containing the literals * @param sz the number of literals in the array @a list * @param lbd the literal block distance of the clause * @return the clause of size @a sz containing the literals in @a lits * and having the literal block distance set to @a lbd */ Clause* createClause(const Lit* const lits, unsigned int sz, unsigned int lbd = 0); /** * Create a new clause * @param lits the array containing the literals * @param lbd the literal block distance of the clause * @return the clause containing the literals in @a lits * and having the literal block distance set to @a lbd */ Clause* createClause(const Array<Lit>& lits, unsigned int lbd = 0); /** * Release a clause that was generated by this clause allocator * @param c the clause to release */ void releaseClause(Clause*& c); /** * Retrieve a pointer to a clause to export to some other clause allocator * @param lits the array of literals * @param sz the size of the array @a lits * @param lbd the lbd value of the clause represented by @a lits * @return the clause containing the literals in @a lits and having the lbd set to @a lbd */ Clause* retrieveClause(const Lit * const lits, unsigned int sz, unsigned int lbd); /** * Provide a clause that may or may not have been generated by this clause allocator */ void provideClause(Clause*& c); /** * Remove the last empty pools */ void clearup(); /** * Retrieve the memory footprint of this Array * @return the memory allocated in bytes for this array */ inline size_t getMemoryFootprint() const{ size_t mem = pools.getMemoryFootprint(); for(const auto *poolPtr : pools){ mem += poolPtr->getMemoryFootprint(); } #ifdef PROFILE mem += clauseRepartition.getMemoryFootprint(); #endif /* PROFILE */ return mem; } /** * Retrieve the number of pools used * @return the number of pools */ inline unsigned int getNbPools() const{ return pools.getSize(); } /** * Retrieve a given pool * @param idx the index of the pool wanted * @return the pool containing clauses with sizes i*2 and i*2 + 1 */ inline const PoolList& getPool(unsigned int idx) const{ return *(pools.get(idx)); } #ifdef PROFILE /** Retrieve the array containing the number of clause made by this allocator for a given size*/ const Array<unsigned int>& getClauseRepartition() const { return clauseRepartition; } #endif /* PROFILE */ private: /** * The array containing every PoolList that will effectively contain * the clauses. The clauses of size n and n+1 (where n+1 % 2 ==0) * will be stored in the same pool */ Array<PoolList*> pools; /** The initial size of the pools */ unsigned int initialPoolSize; #ifdef PROFILE Array<unsigned int> clauseRepartition; #endif /* PROFILE */ //! @cond Doxygen_Suppress //private and non implemented /** MAY NOT BE USED (private and not implemented) */ ClauseAllocator(const ClauseAllocator& ); /** MAY NOT BE USED (private and not implemented) */ ClauseAllocator& operator=(const ClauseAllocator& ); //! @endcond }; } #endif /* SATURNIN_CLAUSEALLOCATOR_H */
/* * << c-maze, a simple generated maze crawler written in C >> * Copyright (C) 2013 Nick Lewchenko * * 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 SEEN_MAPPER_H #define SEEN_MAPPER_H #include "internals.h" struct maze* read_map ( char *map_file_name ); void write_map ( struct maze *maze, char *map_file_name ); #endif
/* * Copyright 2013, Roman Mohr <roman@fenkhuber.at> * * This file is part of burg. * * Burg 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. * * Burg 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 burg. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INCLUDE_BURG_DB_H_ #define INCLUDE_BURG_DB_H_ #include <boost/shared_ptr.hpp> #include <string> #include <vector> namespace burg { /** * @brief Interface for in memory databases * * every kind of user/password database which is loaded once at startup and * is located in the server memory should inherit from this interface. As * it provides a reload() method to allow the reload of the database, the * database inherited from this interface should be threadsave. * FileUserDB provides a reference implementation. */ struct UserDB { virtual ~UserDB() {} /** * @brief extension point for reload in a specific database * implementation * * the intention of the method is to allow the reload of the database * when for example SIGHUP occures. As an application might be * multithreaded, the whole derived class must be threadsave. */ virtual void reload() = 0; /** * @brief checks if the user/password pair exists in the database * * if the password is plain or encrypted at this point depends on the * used protocol and the SimpleUserStore which uses this database. * * @param user the unique identifier of the user * @param passwd the password of the user * * @return true if user/password matches, false otherwise */ virtual bool lookup(const std::string& user, const std::string& passwd) = 0; }; typedef std::vector<std::string> roles_t_vec; typedef boost::shared_ptr<roles_t_vec> roles_vec_t; /** * @brief Interface for in memory databases * * every kind of user/roles database which is loaded once at startup and * is located in the server memory should inherit from this interface. As * it provides a reload() method to allow the reload of the database, the * database inherited from this interface should be threadsave. * FileRolesDB provides a reference implementation. */ struct RolesDB { virtual ~RolesDB() {} /** * @brief extension point for reload in a specific database * implementation * * the intention of the method is to allow the reload of the database * when for example SIGHUP occures. As an application might be * multithreaded, the whole derived class must be threadsave. */ virtual void reload() = 0; /** * @brief looks up the roles of provided users and returns them * * @param user the user of whom the roles are to search for * * @return the associated roles of the user */ virtual roles_vec_t lookup(const std::string& user) = 0; }; /** * @brief Interface which stands between a SimpleAuthenticator and a concrete * authentication information retriving system. * * if you want to implement new ways of retriving authentication * information (e.g. LDAP, MySQL, ...) aside from FileUserDB this is the * right interface to implement. * */ struct UserStore { /** * @brief authenticat a user via a unique identifier and a password * * @param user the unique identifier of the user * @param passwd the password of the user * * @return true if user/password matches, false otherwise */ virtual bool authenticate(const std::string& user, const std::string& passwd) = 0; }; /** * @brief Interface which stands between a SimpleAuthorizer and a concrete * authorization information retriving system. * * if you want to implement new ways of retriving authorization * information (e.g. LDAP, MySQL, ...) aside from FileRolesDB this is the * right interface to implement. */ struct RolesStore { /** * @brief retrieve the roles associatet with a user * * @param user the unique identifier of the user * * @return a vector of roles associated with the user */ virtual roles_vec_t get_roles(const std::string& user) = 0; }; typedef boost::shared_ptr<UserStore> user_store_t; typedef boost::shared_ptr<RolesStore> roles_store_t; typedef boost::shared_ptr<UserDB> user_db_t; typedef boost::shared_ptr<RolesDB> roles_db_t; } // namespace burg #endif // INCLUDE_BURG_DB_H_
/* * tbconfig.h * (C) 2015 basil, all rights reserved, * Modifications Copyright 2016-2017 Jon Dart * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef TBCONFIG_H #define TBCONFIG_H /****************************************************************************/ /* BUILD CONFIG: */ /****************************************************************************/ /* * Define TB_CUSTOM_POP_COUNT to override the internal popcount * implementation. To do this supply a macro or function definition * here: */ #include "../defs.h" #include "../bitboard.h" #include "../magicmoves.h" #define TB_CUSTOM_POP_COUNT(x) popcnt(x) /* * Define TB_CUSTOM_LSB to override the internal lsb * implementation. To do this supply a macro or function definition * here: */ #define TB_CUSTOM_LSB(x) bitscan(x) /* * Define TB_CUSTOM_BSWAP32 to override the internal bswap32 * implementation. To do this supply a macro or function definition * here: */ /* #define TB_CUSTOM_BSWAP32(x) <DEFINITION> */ /* * Define TB_CUSTOM_BSWAP64 to override the internal bswap64 * implementation. To do this supply a macro or function definition * here: */ /* #define TB_CUSTOM_BSWAP64(x) <DEFINITION> */ /* * Define TB_NO_STDINT if you do not want to use <stdint.h> or it is not * available. */ /* #define TB_NO_STDINT */ /* * Define TB_NO_STDBOOL if you do not want to use <stdbool.h> or it is not * available or unnecessary (e.g. C++). */ #define TB_NO_STDBOOL /* * Define TB_NO_THREADS if your program is not multi-threaded. */ //#define TB_NO_THREADS /* * Define TB_NO_HELPER_API if you do not need the helper API. */ /* #define TB_NO_HELPER_API */ /* * Define TB_NO_HW_POP_COUNT if there is no hardware popcount instruction. */ /* #define TB_NO_HW_POP_COUNT */ /** * Define TB_USE_ATOMIC to use C++ 11 (or higher) <atomic> feature * (recommended if using C++ and compiler supports it). */ /* #define TB_USE_ATOMIC */ /***************************************************************************/ /* ENGINE INTEGRATION CONFIG */ /***************************************************************************/ /* * If you are integrating tbprobe into an engine, you can replace some of * tbprobe's built-in functionality with that already provided by the engine. * This is OPTIONAL. If no definition are provided then tbprobe will use its * own internal defaults. That said, for engines it is generally a good idea * to avoid redundancy. */ /* * Define TB_KING_ATTACKS(square) to return the king attacks bitboard for a * king at `square'. */ #define TB_KING_ATTACKS(square) k_atks_bb[square] /* * Define TB_KNIGHT_ATTACKS(square) to return the knight attacks bitboard for * a knight at `square'. */ #define TB_KNIGHT_ATTACKS(square) n_atks_bb[square] /* * Define TB_ROOK_ATTACKS(square, occ) to return the rook attacks bitboard * for a rook at `square' assuming the given `occ' occupancy bitboard. */ #define TB_ROOK_ATTACKS(square, occ) Rmagic(square, occ) /* * Define TB_BISHOP_ATTACKS(square, occ) to return the bishop attacks bitboard * for a bishop at `square' assuming the given `occ' occupancy bitboard. */ #define TB_BISHOP_ATTACKS(square, occ) Bmagic(square, occ) /* * Define TB_QUEEN_ATTACKS(square, occ) to return the queen attacks bitboard * for a queen at `square' assuming the given `occ' occupancy bitboard. * NOTE: If no definition is provided then tbprobe will use: * TB_ROOK_ATTACKS(square, occ) | TB_BISHOP_ATTACKS(square, occ) */ #define TB_QUEEN_ATTACKS(square, occ) Qmagic(square, occ) /* * Define TB_PAWN_ATTACKS(square, color) to return the pawn attacks bitboard * for a `color' pawn at `square'. * NOTE: This definition must work for pawns on ranks 1 and 8. For example, * a white pawn on e1 attacks d2 and f2. A black pawn on e1 attacks * nothing. Etc. * NOTE: This definition must not include en passant captures. */ /* #define TB_PAWN_ATTACKS(square, color) p_atks_bb[color][square] */ #endif
/* * * This file is a part of my arduino development. * If you make any modifications or improvements to the code, I would * appreciate that you share the code with me so that I might include * it in the next release. I can be contacted through paul.torruella@gmail.com * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU GENERAL PUBLIC LICENSE 3.0 license. * Please see the included documents for further information. * Commercial use of this file and/or every others file from this library requires * you to buy a license that will allow commercial use. This includes using the code, * modified or not, as a tool to sell products. * The license applies to this file and its documentation. * * Created on: 23 févr. 2016 * Author: Paul TORRUELLA */ #ifndef utils_h #define utils_h #include "Arduino.h" extern char *__brkval; extern char __bss_end; namespace Utils{ int FreeRam(); class Semaphore{ volatile bool isAvailable; public: Semaphore():isAvailable(true){} bool take(){ if(isAvailable) return !(isAvailable = false); return false; } void release(){ isAvailable = true; } }; } #endif
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * LICENSE: See LICENSE in the top level directory * FILE: mods/deathmatch/logic/CPerfStatManager.h * PURPOSE: Performance stats manager class * DEVELOPERS: Mr OCD * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ #include "CPerfStatModule.h" // // CPerfStatManager // class CPerfStatManager { public: virtual ~CPerfStatManager ( void ) {} virtual void DoPulse ( void ) = 0; virtual void GetStats ( CPerfStatResult* pOutResult, const SString& strCategory, const SString& strOptions, const SString& strFilter ) = 0; // Utility static SString GetScaledByteString ( long long Amount ); static SString GetScaledBitString ( long long Amount ); static long long GetPerSecond ( long long llValue, long long llDeltaTickCount ); static void ToPerSecond ( long long& llValue, long long llDeltaTickCount ); static SString GetPerSecondString ( long long llValue, double dDeltaTickCount ); static CPerfStatManager* GetSingleton ( void ); };
/* * ================================ * eli960@qq.com * https://blog.csdn.net/eli960 * 2017-07-23 * ================================ */ #include "zc.h" int main(int argc, char **argv) { zmain_argument_run(argc, argv, 0); if (zvar_main_redundant_argc == 0) { printf("USAGE: %s http_cookie_string\n", argv[0]); exit(1); } zdict_t *cookies = zhttp_cookie_parse(zvar_main_redundant_argv[0], 0); printf("############################### cookie parse result:\n"); zdict_debug_show(cookies); zdict_free(cookies); return 0; }
USHORT Unpack_HEAVY(UCHAR *, UCHAR *, UCHAR, USHORT); extern USHORT heavy_text_loc;
/* * CG023.h * * 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. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef PROTO_CG023_H_ #define PROTO_CG023_H_ // compatible with EAchine 3D X4, CG023, Attop YD-829, YD-829C #define CG023_PAYLOAD_SIZE 15 #define CG023_PACKET_PERIOD 8200 // interval of time between start of 2 Ppackets, in us #define CG023_RF_BIND_CHANNEL 0x2D #define YD829_PACKET_PERIOD 4100 class protCG023 : public protAPI { public: t_protocols version; protCG023(t_protocols _version) { version = _version; }; ~protCG023() {} void init(void); void bind(void); uint32_t loop(void); private: uint16_t cg_packet_period; void CG023_WritePacket(uint8_t init); }; #endif /* PROTO_CG023_H_ */
//#ifndef FAKECHORD_H //#define FAKECHORD_H #include <denemo/denemo.h> void separate_fakechord_elements (gchar * fakechord, DenemoObject * curObj); void fakechord_insert (GtkAction * action, DenemoScriptParam * param); void delete_fakechords (GtkAction * action, DenemoScriptParam * param); //#endif
/* This program asks you for the password, and then tells * you if you typed it right. You need to set the bluetooth * terminal to send \r\n, at the end of a send. The app * I used on my Android phone is from: * https://github.com/Sash0k/bluetooth-spp-terminal * * Originally from the textbook, modified for the MSP430F5529 * by Rob Frohne 7/21/2015. * * The HC-06 bluetoooth module I used to test this is connected * to the +5V and GND on the launchpad. The RXD of the HC-06 is * connected to P3.3 and TXD of the HC-06 is connected to P3.4. * * Note the changes to the interrupt as compared to the G2 Launchpad. */ #include <msp430.h> #define RedLed BIT0 #define GreenLed BIT7 const char password[] = "12345"; //The Password const char enter[] = "Enter Your Password\r\n"; const char correct[] = "Your password is correct\r\n"; const char incorrect[] = "Your password is incorrect\r\n"; const char reenter[] = "Please re-enter your password\r\n"; char input[100]; unsigned int RXByteCtr = 0; int cnt = 0; int inputlength, passwordlength; int difference; void transmit(const char *str); int compare(const char *strin, const char *strpass); int arraylength(const char *str); int abs(int a); /* * main.c */ void main(void) { WDTCTL = WDTPW | WDTHOLD; /* BCSCTL1 = CALBC1_1MHZ;//Adjust the clock DCOCTL = CALDCO_1MHZ;*/ P1DIR = RedLed; //Make P1.0 an output so we can use the red LED P4DIR = GreenLed; //Make P4.7 an output so we can use the red LED P1OUT &= ~RedLed; //Clear the red LED P4OUT &= ~GreenLed; //Clear the green LED P3SEL = BIT3 + BIT4; // P3.3,4 = USCI_A0 TXD/RXD UCA0CTL1 |= UCSWRST; // **Put state machine in reset** UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 6; // 1MHz 9600 (see User's Guide) UCA0BR1 = 0; // 1MHz 9600 UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0, // over sampling UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** transmit(enter); UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt _enable_interrupts(); while (1) { if (cnt == 1) { //Check if cnt is 1 inputlength = arraylength(input); //Get your input length passwordlength = arraylength(password); //Get your password length { difference = compare(input, password); } //Compare the received password with your password if (difference == 0) { //Check if they match { transmit(correct); } //If they match, transmit correct string P1OUT &= ~RedLed; P4OUT |= GreenLed; //Turn on the green LED __delay_cycles(5000000); //Wait for 5 seconds P4OUT &= ~GreenLed; //WDTCTL = WDT_MRST_0_064; // Turns off the LED too. transmit(enter); //Reset the system } else { //If they do not match { transmit(incorrect); } //Transmit incorrect string P1OUT = RedLed; //Turn on the red LED __delay_cycles(2000000); //Wait for 2 seconds P4OUT &= ~RedLed; //Turn off the red LED { transmit(reenter); } } //Transmit reenter string cnt = 0; //Reset cnt RXByteCtr = 0; } } //Reset Receive Byte counter } //USCI A receiver interrupt // The stuff immediately below is to make it compatible with GCC, TI or IAR #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void) #else #error Compiler not supported! #endif { //Check if the UCA0RXBUF is different from 0x0A //(Enter key from keyboard) if(UCA0RXBUF != 0x0A) input[RXByteCtr++] = UCA0RXBUF; //If it is, load received character //to current input string element else {cnt = 1; //If it is not, set cnt input[RXByteCtr-1] = 0; } //Add null character at the end of input string (on the /r) } void transmit(const char *str) { while (*str != 0) { //Do this during current element is not //equal to null character while (!(UCTXIFG & UCA0IFG)) ; //Ensure that transmit interrupt flag is set UCA0TXBUF = *str++; //Load UCA0TXBUF with current string element } //then go to the next element } int max(int a, int b) { if (a > b) return a; else return b; } // Find the max between two numbers. int compare(const char *strin, const char *strpass) { int i = 0; int result = 0; //Clear result int len = max((passwordlength), inputlength); for (i = len; i > 0; i--) { result = result + abs((*strin++) - (*strpass++)); } // abs used to make sure differences don't cancel return result; } //Return result value int arraylength(const char *str) { int length = 0; //Clear length while (*str != 0) { //Until null character is reached str++; //Increase array address length++; } //Increase length value return length; } //Return length value int abs(int a) { if (a < 0) a = -a; return a; }
// Copyright 2004, 2005,2006,2007,2008 Koblo http://koblo.com // // This file is part of the Koblo SDK. // // the Koblo SDK is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // the Koblo SDK 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 the Koblo Stools. If not, see <http://www.gnu.org/licenses/>. /*! \class CSetContext * \brief Helper class to support ISetContext and CInContext functionality */ class CSetContext : public virtual ISetContext, public virtual CInContext { public: //! Constructor CSetContext(); //! Destructor virtual ~CSetContext(); //! SetContext /*! \param pContext [in]: Context which object belongs to */ virtual void SetContext(IContext* pContext); };
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-IEs" * found in "../support/ngap-r16.1.0/38413-g10.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ #ifndef _NGAP_PDUSessionResourceReleasedItemNot_H_ #define _NGAP_PDUSessionResourceReleasedItemNot_H_ #include <asn_application.h> /* Including external dependencies */ #include "NGAP_PDUSessionID.h" #include <OCTET_STRING.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct NGAP_ProtocolExtensionContainer; /* NGAP_PDUSessionResourceReleasedItemNot */ typedef struct NGAP_PDUSessionResourceReleasedItemNot { NGAP_PDUSessionID_t pDUSessionID; OCTET_STRING_t pDUSessionResourceNotifyReleasedTransfer; struct NGAP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } NGAP_PDUSessionResourceReleasedItemNot_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_NGAP_PDUSessionResourceReleasedItemNot; extern asn_SEQUENCE_specifics_t asn_SPC_NGAP_PDUSessionResourceReleasedItemNot_specs_1; extern asn_TYPE_member_t asn_MBR_NGAP_PDUSessionResourceReleasedItemNot_1[3]; #ifdef __cplusplus } #endif #endif /* _NGAP_PDUSessionResourceReleasedItemNot_H_ */ #include <asn_internal.h>
// // UCPresentationManager.h // AlmappUC // // Created by Patricio López on 06-02-15. // Copyright (c) 2015 almapp. All rights reserved. // #import <Foundation/Foundation.h> @interface UCPresentationManager : NSObject @end
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2015 - ROLI Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ class ToggleButtonHandler : public ButtonHandler { public: ToggleButtonHandler() : ButtonHandler ("Toggle Button", "ToggleButton", typeid (ToggleButton), 150, 24) { registerColour (ToggleButton::textColourId, "text colour", "txtcol"); } Component* createNewComponent (JucerDocument*) { return new ToggleButton ("new toggle button"); } void getEditableProperties (Component* component, JucerDocument& document, Array<PropertyComponent*>& props) { ButtonHandler::getEditableProperties (component, document, props); props.add (new ToggleButtonStateProperty ((ToggleButton*) component, document)); addColourProperties (component, document, props); } XmlElement* createXmlFor (Component* comp, const ComponentLayout* layout) { ToggleButton* tb = (ToggleButton*) comp; XmlElement* e = ButtonHandler::createXmlFor (comp, layout); e->setAttribute ("state", tb->getToggleState()); return e; } bool restoreFromXml (const XmlElement& xml, Component* comp, const ComponentLayout* layout) { ToggleButton* const tb = (ToggleButton*) comp; if (! ButtonHandler::restoreFromXml (xml, comp, layout)) return false; tb->setToggleState (xml.getBoolAttribute ("state", false), dontSendNotification); return true; } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) { ButtonHandler::fillInCreationCode (code, component, memberVariableName); ToggleButton* const tb = dynamic_cast <ToggleButton*> (component); String s; if (tb->getToggleState()) s << memberVariableName << "->setToggleState (true, dontSendNotification);\n"; s << getColourIntialisationCode (component, memberVariableName) << '\n'; code.constructorCode += s; } private: class ToggleButtonStateProperty : public ComponentBooleanProperty <ToggleButton> { public: ToggleButtonStateProperty (ToggleButton* button_, JucerDocument& doc) : ComponentBooleanProperty <ToggleButton> ("initial state", "on", "off", button_, doc) { } void setState (bool newState) { document.perform (new ToggleStateChangeAction (component, *document.getComponentLayout(), newState), "Change ToggleButton state"); } bool getState() const { return component->getToggleState(); } private: class ToggleStateChangeAction : public ComponentUndoableAction <ToggleButton> { public: ToggleStateChangeAction (ToggleButton* const comp, ComponentLayout& l, const bool newState_) : ComponentUndoableAction <ToggleButton> (comp, l), newState (newState_) { oldState = comp->getToggleState(); } bool perform() { showCorrectTab(); getComponent()->setToggleState (newState, dontSendNotification); changed(); return true; } bool undo() { showCorrectTab(); getComponent()->setToggleState (oldState, dontSendNotification); changed(); return true; } bool newState, oldState; }; }; };
/** * Copyright (c) 2006-2012 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. **/ #ifndef LOVE_PHYSICS_BOX2D_EDGE_SHAPE_H #define LOVE_PHYSICS_BOX2D_EDGE_SHAPE_H // Module #include "Shape.h" namespace love { namespace physics { namespace box2d { /** * An Edge is just a line segment. Edges are designed to * be connected and/or chained together. **/ class EdgeShape : public Shape { public: /** * Create a new EdgeShape from a Box2D edge shape. * @param e The edge shape. **/ EdgeShape(b2EdgeShape *e, bool own = true); virtual ~EdgeShape(); /** * Returns the transformed points of the edge shape. * This function is useful for debug drawing and such. * * The result can be directly passed into love.graphics.line(). **/ int getPoints(lua_State *L); }; } // box2d } // physics } // love #endif // LOVE_PHYSICS_BOX2D_EDGE_SHAPE_H
// (c) Michael Buro 1992-2002, licensed under the GNU Public License, version 2 typedef sint1 signed char typedef sint2 signed short typedef sint4 signed long typedef sint8 signed long long typedef uint1 unsigned char typedef uint2 unsigned short typedef uint4 unsigned long typedef uint8 unsigned long long
#pragma once /* Positions of the values in a BCD encoded time. */ #define BCD_HOUR 0 #define BCD_MINUTE 1 #define BCD_SECOND 2 #define BCD_DAY 3 #define BCD_MONTH 4 #define BCD_YEAR 5 /* Converts a two digit BCD char into an integer. */ #define bcd_int(c) (((c) & 15) + (((c) >> 4) & 15) * 10) /* Converts an integer into a two digit BCD char. */ #define int_bcd(i) ((((i) / 10) << 4) | ((i) % 10)) /* Checks, if a char is a valid two digit BCD char. */ #define is_bcd(c) (((c) & 15) < 10 && (((c) >> 4) & 15) < 10) /* Parses a zero terminated string into a BCD encoded time. * Supports the following formats: * dd mm yy hh mm ss * dd.mm.yy hh:mm:ss * yy-mm-dd hh:mm:ss */ extern int bcd_parse(const char *input, char *bcd); /* Checks if the BCD encoded time is a valid time. Returns 1 if the supplied * time is valid, 0 otherwise. */ extern int bcd_valid(const char *bcd); /* Returns the number of seconds from t1 to t2. t1 and t2 are BCD encoded times. */ extern long long bcd_diff(const char *t1, const char *t2); /* Returns the day of the week for the given BCD encoded time. * Sunday is 1, Monday is 2, ... Saturday is 7. */ extern int bcd_weekday(const char *bcd); /* Returns the days since 1.1.2000. */ extern long bcd_mjd(const char *bcd);
#ifndef MESH_OPTIMIZER_H_ #define MESH_OPTIMIZER_H_ #include <iostream> #include <fstream> #include <stdio.h> #include <deal.II/grid/tria.h> #include <deal.II/grid/tria_accessor.h> #include <deal.II/grid/tria_iterator.h> #include <deal.II/grid/grid_tools.h> #include <deal.II/grid/manifold_lib.h> #include <deal.II/grid/grid_in.h> #include <deal.II/grid/grid_out.h> #include <Mesh/GMSH/GModel.h> #include <UI/ModelDefinition/ModelDefinition.h> #include <wx/stdpaths.h> #include <wx/string.h> using namespace dealii; class meshOptimizer { private: Triangulation<2> p_problemMesh; public: meshOptimizer() { } void setupTriangulation(modelDefinition *problemModel) { GridIn<2> gridIn; GridOut outputGrid; wxStandardPaths paths = wxStandardPaths::Get(); std::string filePath = paths.GetDocumentsDir().ToStdString() + "/" + "mesh.msh"; //problemModel->getMeshModel()->writeVTK(filePath); problemModel->getMeshModel()->writeMSH(filePath, 2.0, false, false, false, 1.0, 0, 0, false); gridIn.attach_triangulation(p_problemMesh); std::ifstream inputMeshFile(filePath); gridIn.read_msh(inputMeshFile); remove(filePath.c_str()); // May need to add a manifold object here? p_problemMesh.set_all_manifold_ids(0); } /** * @brief Returns the Deal.ii mesh */ Triangulation<2> *getTriangulation() { return &p_problemMesh; } }; #endif
#pragma once namespace kaiu { enum class StreamAction { Continue, Discard, Stop }; }
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo * This benchmark is part of SWSC */ #include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[2]; atomic_int atom_1_r1_2; atomic_int atom_1_r4_0; void *t0(void *arg){ label_1:; atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); int v2_r3 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v3_r4 = v2_r3 ^ v2_r3; atomic_store_explicit(&vars[1+v3_r4], 1, memory_order_seq_cst); atomic_store_explicit(&vars[1], 2, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; int v5_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v6_r3 = v5_r1 ^ v5_r1; int v9_r4 = atomic_load_explicit(&vars[0+v6_r3], memory_order_seq_cst); int v13 = (v5_r1 == 2); atomic_store_explicit(&atom_1_r1_2, v13, memory_order_seq_cst); int v14 = (v9_r4 == 0); atomic_store_explicit(&atom_1_r4_0, v14, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; atomic_init(&vars[0], 0); atomic_init(&vars[1], 0); atomic_init(&atom_1_r1_2, 0); atomic_init(&atom_1_r4_0, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v10 = atomic_load_explicit(&atom_1_r1_2, memory_order_seq_cst); int v11 = atomic_load_explicit(&atom_1_r4_0, memory_order_seq_cst); int v12_conj = v10 & v11; if (v12_conj == 1) assert(0); return 0; }
#ifndef FUNCTIONS_H_INCLUDED #define FUNCTIONS_H_INCLUDED #include <vector> #include <string> using namespace std; void con_pause(void); bool file_exists(std::string filename); int file_delete(std::string f); bool directory_exists(std::string dirname); void setTitle(std::string titleMsg); std::string GetFileExtension(std::string Fpath); std::string GetFileName(std::string Fpath); std::string GetPath(std::string Fpath); std::string ChangeFileExtention(std::string str,std::string RPL); std::string StringUpper(std::string s); std::string StringLower(std::string s); char* StringToChar(std::string s); std::string CharToString(char c); std::string CharToString(char* c); std::string IntToString(int n); std::string FloatToString(float n); int StringToInt(std::string str); float StringToFloat(std::string str); double StringToDouble(const std::string& s); double IntToDouble(int a); void ChangeConsoleColour(std::string col); void DirectoryCreate(std::string dir); int directory_remove(std::string d); void con_clear(); void wait(int ms); void execute_program(char* programPath, bool finish_wait); bool directory_delete_recursive(std::string dir); std::string replaceAll(std::string subject, const std::string& search, const std::string& replace); bool hasEnding (std::string const &fullString, std::string const &ending); string atPlace(string &inputString, int place); bool isAnyOf(string input, vector<string> &check); bool isNumber(string in); string removeLeadingWhitespace(string Iline); string removeTrailingWhitespace(string Iline); #ifdef WIN32 bool WinIs64(); bool IsWow64(); #endif int GetCount(string s, string of); string getInput(); void StringExplode(string str, string separator, vector<string>* results); string StringImplode(vector<string> input, string seperator); void system_call(string __command); #ifdef WIN32 char const directory_separator = '\\'; #else char const directory_separator = '/'; #endif // WIN32 #endif // FUNCTIONS_H_INCLUDED
/**************************************************************/ /* */ /*Procedure de test pour savoir si l'on doit scinder un groupe*/ /*par test d'ajustement de la distribution des similarites */ /*renvoie OUI si on doit separer et NON sinon */ /* */ /**************************************************************/ int test_GRAPHPC(int nb_individus,int nb_dimensions,groupe_t *groupe_pere,groupe_t *groupe1, groupe_t *groupe2); /**************************************************************************************/ /* */ /*Procedure calculant la probabilite que moins d'un certain pourcentage de transitions*/ /*s'effectuent depuis un groupe de sommets vers un autre groupe de sommets */ /* */ /**************************************************************************************/ double calcul_probabilite_pourcentage_transitions(int nb_individus,double pb,double pourcentage);
#ifndef MANTID_ISISREFLECTOMETRY_INSTRUMENTOPTIONDEFAULTS_H #define MANTID_ISISREFLECTOMETRY_INSTRUMENTOPTIONDEFAULTS_H #include <string> #include "MantidGeometry/Instrument.h" #include <boost/optional.hpp> #include <boost/variant.hpp> #include <ostream> #include "DllConfig.h" namespace MantidQt { namespace CustomInterfaces { struct MANTIDQT_ISISREFLECTOMETRY_DLL InstrumentOptionDefaults { bool NormalizeByIntegratedMonitors; double MonitorIntegralMin; double MonitorIntegralMax; double MonitorBackgroundMin; double MonitorBackgroundMax; double LambdaMin; double LambdaMax; boost::variant<int, double> I0MonitorIndex; bool CorrectDetectors; std::string DetectorCorrectionType; }; MANTIDQT_ISISREFLECTOMETRY_DLL bool operator==(InstrumentOptionDefaults const &lhs, InstrumentOptionDefaults const &rhs); MANTIDQT_ISISREFLECTOMETRY_DLL std::ostream & operator<<(std::ostream &os, InstrumentOptionDefaults const &defaults); } } #endif // MANTID_ISISREFLECTOMETRY_INSTRUMENTOPTIONDEFAULTS_H
//////////////////////////////////////////////////////////////////////////// // Atol file manager project <http://atol.sf.net> // // This code is licensed under BSD license.See "license.txt" for more details. // // File: Dialog to handle copy failure (inside file operation) //////////////////////////////////////////////////////////////////////////// #ifndef COPYERRDLG_H__ #define COPYERRDLG_H__ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Dialog.h" #include "core/String.h" class CopyErrDlg : public Dialog { public: CopyErrDlg(); virtual ~CopyErrDlg(); void SetInfo(const char *szTxt); String m_strInfo; protected: virtual void Create(); GtkWidget* create_dialog (); }; #endif // COPYERRDLG_H__
/* XMRig * Copyright 2010 Jeff Garzik <jgarzik@pobox.com> * Copyright 2012-2014 pooler <pooler@litecoinpool.org> * Copyright 2014 Lucas Jones <https://github.com/lucasjones> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016-2017 XMRig <support@xmrig.com> * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __FAILOVERSTRATEGY_H__ #define __FAILOVERSTRATEGY_H__ #include <vector> #include "interfaces/IClientListener.h" #include "interfaces/IStrategy.h" class Client; class IStrategyListener; class Url; class FailoverStrategy : public IStrategy, public IClientListener { public: FailoverStrategy(const std::vector<Url*> &urls, const char *agent, IStrategyListener *listener); public: inline bool isActive() const override { return m_active >= 0; } int64_t submit(const JobResult &result) override; void connect() override; void resume() override; void stop() override; protected: void onClose(Client *client, int failures) override; void onJobReceived(Client *client, const Job &job) override; void onLoginSuccess(Client *client) override; void onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error) override; private: void add(const Url *url, const char *agent); int m_active; int m_index; IStrategyListener *m_listener; std::vector<Client*> m_pools; }; #endif /* __FAILOVERSTRATEGY_H__ */
#include <stdio.h> int int_shifts_are_arithmetic() { int all_bit_1 = ~0; return all_bit_1 >> 1 == all_bit_1; } int main(void) { printf("this machine use arithmetic right shift: %d\n", int_shifts_are_arithmetic()); return 0; }
#ifdef __cplusplus extern "C" { #endif typedef void (*pfnGisManager_reset)(); extern VGG_EXPORT void GisManager_reset(); typedef void (*pfnGisManager_uninitBeforeOpenGLDestroy)(); extern VGG_EXPORT void GisManager_uninitBeforeOpenGLDestroy(); typedef void (*pfnGisManager_renderGisElements)(); extern VGG_EXPORT void GisManager_renderGisElements(); typedef void (*pfnGisManager_setGisAnalysis)( vgGIS3D::EGisState eType); extern VGG_EXPORT void GisManager_setGisAnalysis( vgGIS3D::EGisState eType); typedef vgGIS3D::EGisState (*pfnGisManager_getAnalysisType)(); extern VGG_EXPORT vgGIS3D::EGisState GisManager_getAnalysisType(); typedef void* GisAnalysisH; typedef GisAnalysisH (*pfnGisManager_getGisAnalysis)(); extern VGG_EXPORT GisAnalysisH GisManager_getGisAnalysis(); typedef void* RendererH; typedef bool (*pfnGisDataManager_setSelectMode)( RendererH selected_layer , const bool& enable ); extern VGG_EXPORT bool GisDataManager_setSelectMode( RendererH selected_layer , const bool& enable ); typedef void* DataSourceH; typedef DataSourceH (*pfnGisDataManager_openShapeFile)( const String& filepath ); extern VGG_EXPORT DataSourceH GisDataManager_openShapeFile( const String& filepath ); typedef DataSourceH (*pfnGisDataManager_openShapeFileSpecially)( const String& filepath ); extern VGG_EXPORT DataSourceH GisDataManager_openShapeFileSpecially( const String& filepath ); typedef void* LayerH; typedef LayerH (*pfnGisDataManager_getLayerByShortName)( const String& filepath ); extern VGG_EXPORT LayerH GisDataManager_getLayerByShortName( const String& filepath ); typedef void* DataSourcePtrMapH; typedef DataSourcePtrMapH (*pfnGisDataManager_getDataSources)( ); extern VGG_EXPORT DataSourcePtrMapH GisDataManager_getDataSources( ); typedef void (*pfnGisDataManager_initAfterOpenGLSetup)( ); extern VGG_EXPORT void GisDataManager_initAfterOpenGLSetup( ); typedef void (*pfnGisDataManager_uninitBeforeOpenGLDestroy)( ); extern VGG_EXPORT void GisDataManager_uninitBeforeOpenGLDestroy( ); typedef void (*pfnGisDataManager_saveProject)(const String& filepath); extern VGG_EXPORT void GisDataManager_saveProject(const String& filepath); typedef void* (*pfnGisDataManager_readProject)(const String& filepath); extern VGG_EXPORT void* GisDataManager_readProject(const String& filepath); typedef void (*pfnGisDataManager_readProjectExtra)(const String& filepath); extern VGG_EXPORT void GisDataManager_readProjectExtra(const String& filepath); typedef bool (*pfnGisDataManager_getSelectFlag)( ); extern VGG_EXPORT bool GisDataManager_getSelectFlag( ); typedef void (*pfntranslateAllShape)(const double& offsetX, const double& offsetY, const double& offsetZ); extern VGG_EXPORT void translateAllShape(const double& offsetX, const double& offsetY, const double& offsetZ); typedef void* GeometryPointerVecH; typedef GeometryPointerVecH (*pfnGisDataManager_getSelectGeometriesFromLayer)(LayerH layer); extern VGG_EXPORT GeometryPointerVecH GisDataManager_getSelectGeometriesFromLayer(LayerH layer); typedef void* LayerPtrVectorH; typedef LayerPtrVectorH (*pfnGisDataManager_getLayersFromDataSource)(DataSourceH src); extern VGG_EXPORT LayerPtrVectorH GisDataManager_getLayersFromDataSource(DataSourceH src); typedef void* ShapeDataSourceEntryH; typedef ShapeDataSourceEntryH (*pfncreateEntryFromRenderer)(); extern VGG_EXPORT ShapeDataSourceEntryH createEntryFromRenderer(); #ifdef __cplusplus } #endif
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef MYOBJECT_H #define MYOBJECT_H #include <QObject> class MyObject : public QObject { Q_OBJECT public: MyObject(); public slots: int calculate(int value) const; }; #endif
/** ****************************************************************************** * * @file rawhid.h * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ * @addtogroup RawHIDPlugin Raw HID Plugin * @{ * @brief Impliments a HID USB connection to the flight hardware as a QIODevice *****************************************************************************/ /* * 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 */ #ifndef RAWHIDPLUGIN_H #define RAWHIDPLUGIN_H #include "rawhid_global.h" #include "rawhid.h" #include "usbmonitor.h" #include "usbsignalfilter.h" #include "extensionsystem/pluginmanager.h" #include "coreplugin/iconnection.h" #include "coreplugin/iboardtype.h" #include "coreplugin/boardmanager.h" #include <extensionsystem/iplugin.h> #include <QtCore/QMutex> #include <QtCore/QThread> class IConnection; class RawHIDConnection; /** * Define a connection via the IConnection interface * Plugin will add a instance of this class to the pool, * so the connection manager can use it. */ class RAWHID_EXPORT RawHIDConnection : public Core::IConnection { Q_OBJECT public: RawHIDConnection(); virtual ~RawHIDConnection(); virtual QList < Core::IDevice*> availableDevices(); virtual QIODevice *openDevice(Core::IDevice *deviceName); virtual void closeDevice(const QString &deviceName); virtual QString connectionName(); virtual QString shortName(); virtual void suspendPolling(); virtual void resumePolling(); bool deviceOpened() { return (RawHidHandle != NULL); } // Pip protected slots: void onDeviceConnected(); void onDeviceDisconnected(); private: RawHID *RawHidHandle; bool enablePolling; USBMonitor *m_usbMonitor; USBSignalFilter *m_signalFilter; }; class RAWHID_EXPORT RawHIDPlugin : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.dronin.plugins.RawHID") public: RawHIDPlugin(); ~RawHIDPlugin(); virtual bool initialize(const QStringList &arguments, QString *error_message); virtual void extensionsInitialized(); private: RawHIDConnection *hidConnection; USBMonitor *m_usbMonitor; }; #endif // RAWHIDPLUGIN_H
/** ****************************************************************************** * @file SPI/SPI_FullDuplex_AdvComIT/Master/Src/stm32f4xx_hal_msp.c * @author MCD Application Team * @version V1.1.0 * @date 17-February-2017 * @brief HAL MSP module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /** @addtogroup STM32F4xx_HAL_Examples * @{ */ /** @defgroup SPI_FullDuplex_AdvComIT * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup HAL_MSP_Private_Functions * @{ */ /** * @brief SPI MSP Initialization * This function configures the hardware resources used in this example: * - Peripheral's clock enable * - Peripheral's GPIO Configuration * - NVIC configuration for SPI interrupt request enable * @param hspi: SPI handle pointer * @retval None */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) { GPIO_InitTypeDef GPIO_InitStruct; if (hspi->Instance == SPIx) { /*##-1- Enable peripherals and GPIO Clocks #################################*/ /* Enable GPIO TX/RX clock */ SPIx_SCK_GPIO_CLK_ENABLE(); SPIx_MISO_GPIO_CLK_ENABLE(); SPIx_MOSI_GPIO_CLK_ENABLE(); /* Enable SPI clock */ SPIx_CLK_ENABLE(); /*##-2- Configure peripheral GPIO ##########################################*/ /* SPI SCK GPIO pin configuration */ GPIO_InitStruct.Pin = SPIx_SCK_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Alternate = SPIx_SCK_AF; HAL_GPIO_Init(SPIx_SCK_GPIO_PORT, &GPIO_InitStruct); /* SPI MISO GPIO pin configuration */ GPIO_InitStruct.Pin = SPIx_MISO_PIN; GPIO_InitStruct.Alternate = SPIx_MISO_AF; HAL_GPIO_Init(SPIx_MISO_GPIO_PORT, &GPIO_InitStruct); /* SPI MOSI GPIO pin configuration */ GPIO_InitStruct.Pin = SPIx_MOSI_PIN; GPIO_InitStruct.Alternate = SPIx_MOSI_AF; HAL_GPIO_Init(SPIx_MOSI_GPIO_PORT, &GPIO_InitStruct); /*##-3- Configure the NVIC for SPI #########################################*/ /* NVIC for SPI */ HAL_NVIC_SetPriority(SPIx_IRQn, 1, 0); HAL_NVIC_EnableIRQ(SPIx_IRQn); } } /** * @brief SPI MSP De-Initialization * This function frees the hardware resources used in this example: * - Disable the Peripheral's clock * - Revert GPIO and NVIC configuration to their default state * @param hspi: SPI handle pointer * @retval None */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) { if(hspi->Instance == SPIx) { /*##-1- Reset peripherals ##################################################*/ SPIx_FORCE_RESET(); SPIx_RELEASE_RESET(); /*##-2- Disable peripherals and GPIO Clocks ################################*/ /* Deconfigure SPI SCK */ HAL_GPIO_DeInit(SPIx_SCK_GPIO_PORT, SPIx_SCK_PIN); /* Deconfigure SPI MISO */ HAL_GPIO_DeInit(SPIx_MISO_GPIO_PORT, SPIx_MISO_PIN); /* Deconfigure SPI MOSI */ HAL_GPIO_DeInit(SPIx_MOSI_GPIO_PORT, SPIx_MOSI_PIN); /*##-3- Disable the NVIC for SPI ###########################################*/ HAL_NVIC_DisableIRQ(SPIx_IRQn); } } /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/******************************************************************************* * nemesis. an experimental finite element code. * * Copyright (C) 2004-2011 F.E.Karaoulanis [http://www.nemesis-project.org] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License version 3, as * * published by the Free Software Foundation. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see < http://www.gnu.org/licenses/>. * *******************************************************************************/ // ***************************************************************************** // $LastChangedDate$ // $LastChangedRevision$ // $LastChangedBy$ // $HeadURL$ // Author(s): F.E. Karaoulanis (fkar@nemesis-project.org) // ***************************************************************************** #ifndef SRC_CONTROL_TRANSIENT_CONTROL_H_ #define SRC_CONTROL_TRANSIENT_CONTROL_H_ #include "control/control.h" #include "numeric/vector.h" class ModelElement; class ModelNode; class TransientControl :public Control { public: // Constructors and destructor TransientControl(); virtual ~TransientControl(); // Form tangent and residuals virtual void FormElementalTangent(ModelElement* pModelElement); virtual void FormElementalResidual(ModelElement* pModelElement, double time = 0.); virtual void FormNodalResidual(ModelNode* pModelNode); virtual void FormResidual(double factor); virtual void Init(); virtual void Commit(); virtual void Rollback(); protected: Vector u, v, a, ut, vt, at; double c[3]; }; #endif // SRC_CONTROL_TRANSIENT_CONTROL_H_
/* rtfm-widget.h * * Copyright (C) 2016 Christian Hergert <chergert@redhat.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RTFM_WIDGET_H #define RTFM_WIDGET_H #include <gtk/gtk.h> G_BEGIN_DECLS void rtfm_g_object_unref_in_main (gpointer instance); void rtfm_gtk_widget_class_set_css_from_resource (GtkWidgetClass *widget_class, const gchar *theme_name, const gchar *resource_path); G_END_DECLS #endif /* RTFM_WIDGET_H */
#include <libf/master.h> #include <stdio.h> int main() { char *buff1 = "!test.l"; char *buff2 = bchar(buff1,'.'); if (cmpstr(buff2,"l")) { printf("Test 1 succeeded for target: bchar\n"); } else { printf("Test 1 failed for target: bchar\n"); } }
#pragma once #include "GL.h" #ifdef RENDERER_OPENGL namespace sh { namespace gl { enum class BufferUsage : GLenum { Static = GL_STATIC_DRAW, Dynamic = GL_DYNAMIC_DRAW }; } } #endif
/* * Licensed to Green Energy Corp (www.greenenergycorp.com) under one or * more contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright ownership. * Green Energy Corp licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This project was forked on 01/01/2013 by Automatak, LLC and modifications * may have been made to this file. Automatak, LLC licenses these modifications * to you under the terms of the License. */ #ifndef OPENDNP3_APDUPARSER_H #define OPENDNP3_APDUPARSER_H #include <openpal/util/Uncopyable.h> #include <openpal/container/RSlice.h> #include "opendnp3/app/parsing/IAPDUHandler.h" #include "opendnp3/app/parsing/ParseResult.h" #include "opendnp3/app/parsing/ParserSettings.h" #include "opendnp3/app/parsing/NumParser.h" namespace opendnp3 { class APDUParser : private openpal::StaticOnly { public: static ParseResult Parse(const openpal::RSlice& buffer, IAPDUHandler& handler, openpal::Logger& logger, ParserSettings settings = ParserSettings::Default()); static ParseResult Parse(const openpal::RSlice& buffer, IAPDUHandler& handler, openpal::Logger* pLogger, ParserSettings settings = ParserSettings::Default()); static ParseResult ParseAndLogAll(const openpal::RSlice& buffer, openpal::Logger* pLogger, ParserSettings settings = ParserSettings::Default()); static ParseResult ParseSinglePass(const openpal::RSlice& buffer, openpal::Logger* pLogger, IAPDUHandler* pHandler, IWhiteList* pWhiteList, const ParserSettings& settings); private: static bool AllowAll(uint32_t headerCount, GroupVariation gv, QualifierCode qc) { return true; } static ParseResult ParseHeaders(const openpal::RSlice& buffer, openpal::Logger* pLogger, const ParserSettings& settings, IAPDUHandler* pHandler); static ParseResult ParseHeader(openpal::RSlice& buffer, openpal::Logger* pLogger, uint32_t count, const ParserSettings& settings, IAPDUHandler* pHandler, IWhiteList* pWhiteList); static ParseResult ParseQualifier(openpal::RSlice& buffer, openpal::Logger* pLogger, const HeaderRecord& record, const ParserSettings& settings, IAPDUHandler* pHandler); static ParseResult HandleAllObjectsHeader(openpal::Logger* pLogger, const HeaderRecord& record, const ParserSettings& settings, IAPDUHandler* pHandler); }; } #endif
/* $Id$ */ /* User-defined datatypes */ #include "nullmpi.h" int MPI_Type_size(MPI_Datatype datatype, int *size) { NULLMPI_STATS; return nullmpi_unsupported(); }