text
stringlengths
4
6.14k
/* * Avinash N * 27/01/2017 */ /* * Question 3 */ #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <string.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> #define STR_LEN 32 #define MEM(ptr) ptr = (char *) malloc (sizeof(char) * STR_LEN) #define VAL(ptr) if (!ptr) {\ printf("Failed!\n");\ exit(1);\ } int g_num = 100; // Global data void *thread_function (void *str) { g_num = g_num + 43; int tl_num = 21; // Local data printf("I am in thread function\n"); printf("TGID --> %d\n", getpid()); printf("PID --> %ld\n", syscall(SYS_gettid)); printf("Value of global variable --> %d\n", g_num); // printf("Value of pointer --> %s\n", (char *)str); // printf("Value of local variable --> %d\n", *((int *)str)); // printf("Address of local variable --> %p\n", (int *)str); printf("Value of local variable --> %d\n", tl_num); printf("Address of local variable --> %p\n", &tl_num); getchar(); return NULL; } int main (void) { int status; pthread_t th_id; char *ptr = NULL; // Heap data MEM(ptr); VAL(ptr); strcpy(ptr, "Global_Edge"); int l_num = 21; // Local data status = pthread_create (&th_id, NULL, thread_function, &l_num);//&l_num if (status != 0) { printf("Thread creation failed: %s", strerror(status)); } //getchar(); printf("I am in main function\n"); printf("PID --> %d\n", getpid()); printf("PID --> %ld\n", syscall(SYS_gettid)); printf("Value of global variable --> %d\n", g_num); printf("Value of pointer --> %s\n", ptr); printf("Value of local variable --> %d\n", l_num); printf("Address of local variable --> %p\n", &l_num); getchar(); pthread_exit (NULL); return 0; } /* * a. Global data is shared between TGL and thread. * b. Heap data is shared between TGL and thread. * c. Stach segment is not shared between TGL and thread. */
/* * This file is part of Cleanflight. * * Cleanflight is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Cleanflight is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #define SOFTSERIAL_BUFFER_SIZE 256 typedef enum { SOFTSERIAL1 = 0, SOFTSERIAL2 } softSerialPortIndex_e; typedef struct softSerial_s { serialPort_t port; const timerHardware_t *rxTimerHardware; volatile uint8_t rxBuffer[SOFTSERIAL_BUFFER_SIZE]; const timerHardware_t *txTimerHardware; volatile uint8_t txBuffer[SOFTSERIAL_BUFFER_SIZE]; uint8_t isSearchingForStartBit; uint8_t rxBitIndex; uint8_t rxLastLeadingEdgeAtBitIndex; uint8_t rxEdge; uint8_t isTransmittingData; int8_t bitsLeftToTransmit; uint16_t internalTxBuffer; // includes start and stop bits uint16_t internalRxBuffer; // includes start and stop bits uint16_t transmissionErrors; uint16_t receiveErrors; uint8_t softSerialPortIndex; } softSerial_t; extern timerHardware_t* serialTimerHardware; extern softSerial_t softSerialPorts[]; extern const struct serialPortVTable softSerialVTable[]; serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallbackPtr callback, uint32_t baud, serialInversion_e inversion); // serialPort API void softSerialWriteByte(serialPort_t *instance, uint8_t ch); uint8_t softSerialTotalBytesWaiting(serialPort_t *instance); uint8_t softSerialReadByte(serialPort_t *instance); void softSerialSetBaudRate(serialPort_t *s, uint32_t baudRate); bool isSoftSerialTransmitBufferEmpty(serialPort_t *s);
* colors.h * some pretty printing * this file is part of FeynHiggs * last modified 2 Aug 18 th character*(*) dpre parameter (dpre = "FH> ") #if VT100 character*(*) vtoff, vtbold, vtred, vtgreen, vtbrown character*(*) vtblue, vtpurple, vtcyan, vtwhite parameter (vtoff = char(27)//"[0m") parameter (vtbold = char(27)//"[1m") parameter (vtred = char(27)//"[31m") parameter (vtgreen = char(27)//"[32m") parameter (vtbrown = char(27)//"[33m") parameter (vtblue = char(27)//"[34m") parameter (vtpurple = char(27)//"[35m") parameter (vtcyan = char(27)//"[36m") parameter (vtwhite = char(27)//"[37m") character*(*) dflags, dpara, dslha, dself, dhiggs, deft character*(*) dcoup, dhead, dprod, dconst, dloop parameter (dflags = vtblue//dpre) parameter (dpara = vtred//dpre) parameter (dslha = vtpurple//dpre) parameter (dself = vtgreen//dpre) parameter (dhiggs = vtpurple//dpre) parameter (deft = vtred//dpre) parameter (dcoup = vtcyan//dpre) parameter (dhead = vtblue//dpre) parameter (dprod = vtpurple//dpre) parameter (dconst = vtgreen//dpre) parameter (dloop = vtblue//dpre) #define DCOLOR(d) write(debugunit,*) d, #define ERROR vtbold//vtred, #define WARNING vtbold//vtblue, #define ENDL ,vtoff #else #define DCOLOR(d) write(debugunit,*) dpre, #define ERROR #define WARNING #define ENDL #endif
#ifndef _TIMER_H_ #define _TIMER_H_ /* Macros */ #define usleep(t) Timer_Sleep(t) #define msleep(t) Timer_Sleep(t*1000) /* Prototypes */ void Timer_Init(void); void Timer_Sleep(u32 time); #endif
/* This file is part of HSPlasma. * * HSPlasma 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. * * HSPlasma 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 HSPlasma. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _PLICICLE_H #define _PLICICLE_H #include "plGBufferGroup.h" #include "plVertexSpan.h" class PLASMA_DLL plIcicle : public plVertexSpan { protected: unsigned int fIBufferIdx, fIStartIdx, fILength; plGBufferTriangle* fSortData; public: virtual const char* ClassName() const { return "plIcicle"; } plIcicle() : fIBufferIdx(0), fIStartIdx(0), fILength(0), fSortData(NULL) { } plIcicle(const plIcicle& init); virtual ~plIcicle(); virtual void read(hsStream* S); virtual void write(hsStream* S); protected: virtual void IPrcWrite(pfPrcHelper* prc); virtual void IPrcParse(const pfPrcTag* tag); public: unsigned int getIBufferIdx() const { return fIBufferIdx; } unsigned int getIStartIdx() const { return fIStartIdx; } unsigned int getILength() const { return fILength; } const plGBufferTriangle* getSortData() const { return fSortData; } void setIBufferIdx(unsigned int idx) { fIBufferIdx = idx; } void setIStartIdx(unsigned int idx) { fIStartIdx = idx; } void setILength(unsigned int len) { fILength = len; } void setSortData(const plGBufferTriangle* data); }; class PLASMA_DLL plParticleSpan : public plIcicle { public: virtual const char* ClassName() const { return "plParticleSpan"; } virtual void read(hsStream*) { } virtual void write(hsStream*) { } protected: virtual void IPrcWrite(pfPrcHelper*) { } virtual void IPrcParse(const pfPrcTag* tag); }; #endif
/* ide-hover-context-private.h * * Copyright 2018-2019 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/>. * * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once #include <gtk/gtk.h> #include <libide-code.h> #include "ide-hover-context.h" #include "ide-hover-provider.h" G_BEGIN_DECLS typedef void (*IdeHoverContextForeach) (const gchar *title, IdeMarkedContent *content, GtkWidget *widget, gpointer user_data); void _ide_hover_context_add_provider (IdeHoverContext *context, IdeHoverProvider *provider); void _ide_hover_context_query_async (IdeHoverContext *self, const GtkTextIter *iter, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gboolean _ide_hover_context_query_finish (IdeHoverContext *self, GAsyncResult *result, GError **error); void _ide_hover_context_foreach (IdeHoverContext *self, IdeHoverContextForeach foreach, gpointer foreach_data); G_END_DECLS
/* * Copyright 2015-2016 Gary R. Van Sickle (grvs@users.sourceforge.net). * * This file is part of UniversalCodeGrep. * * UniversalCodeGrep is free software: you can redistribute it and/or modify it under the * terms of version 3 of the GNU General Public License as published by the Free * Software Foundation. * * UniversalCodeGrep 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 * UniversalCodeGrep. If not, see <http://www.gnu.org/licenses/>. */ /** @file */ #ifndef FILESCANNERCPP11_H_ #define FILESCANNERCPP11_H_ #include "FileScanner.h" #include <regex> /* * */ class FileScannerCpp11: public FileScanner { public: FileScannerCpp11(sync_queue<std::string> &in_queue, sync_queue<MatchList> &output_queue, std::string regex, bool ignore_case, bool word_regexp, bool pattern_is_literal); virtual ~FileScannerCpp11(); private: /** * Scan @a file_data for matches of m_pcre_regex using the C++11 library's <regex> support. Add hits to @a ml. * * @param file_data * @param file_size * @param ml */ void ScanFile(const char * __restrict__ file_data, size_t file_size, MatchList &ml) override final; }; #endif /* FILESCANNERCPP11_H_ */
/* xoreos - A reimplementation of BioWare's Aurora engine * * xoreos is the legal property of its developers, whose names * can be found in the AUTHORS file distributed with this source * distribution. * * xoreos 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. * * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>. */ /** @file * Displaying the progress in loading a game. */ #ifndef ENGINES_AURORA_LOADPROGRESS_H #define ENGINES_AURORA_LOADPROGRESS_H #include "src/common/ustring.h" namespace Graphics { namespace Aurora { class Text; } } namespace Engines { class LoadProgress { public: /** Create a load progress display. * * steps specifies the number of steps that are gone through in * the process of loading the game. The very first step is the 0% * mark, the very last the 100% mark. Obviously, there needs to be * at least two steps. * * An example with five steps: * - Step 0: 0% * - Step 1: 25% * - Step 2: 50% * - Step 3: 75% * - Step 4: 100% */ LoadProgress(uint steps); ~LoadProgress(); /** Take a step in advancing the progress. */ void step(const Common::UString &description); private: /** The length of the progress bar in characters. */ static const int kBarLength = 50; uint _steps; ///< The number of total steps. uint _currentStep; ///< The current step we're on. double _stepAmount; ///< The amount to step each time. double _currentAmount; ///< The accumulated amount. /** The text containing the description of the current step. */ Graphics::Aurora::Text *_description; // The progress bar, in three parts Graphics::Aurora::Text *_barUpper; ///< The upper border of the progress bar. Graphics::Aurora::Text *_barLower; ///< The lower border of the progress bar. Graphics::Aurora::Text *_progressbar; ///< The actual progress bar. /** The text containing the current percentage of done-ness. */ Graphics::Aurora::Text *_percent; static Common::UString createProgressbar(uint length, double filled); static Common::UString createProgressbarUpper(uint length); static Common::UString createProgressbarLower(uint length); }; } // End of namespace Engines #endif // ENGINES_AURORA_LOADPROGRESS_H
#ifndef EVAL_H_ #define EVAL_H_ #include "../Data/CharString.h" #include "../Data/Stack.hpp" namespace Math { // Pre-initialization Enumerators, enables labels and such within the source. enum MOperator {none=1,Less=2,Greater=3,equals=4,greaterequals=5,lessequals=6, addition=7,subtraction=8,multiplication=9,division=10,Modulus=11,exponent=12 }; enum nxx {PrimNULL = -99999}; // Evaluates a mathematical expression. CharString Eval(CharString Line); } #endif /*EVAL_H_*/
/*========================================================================= Program: ParaView Module: pqTreeLayoutStrategyInterface.h Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. All rights reserved. ParaView is a free software; you can redistribute it and/or modify it under the terms of the ParaView license version 1.2. See License_v1.2.txt for the full ParaView license. A copy of this license can be obtained by contacting Kitware Inc. 28 Corporate Drive Clifton Park, NY 12065 USA 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 AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =========================================================================*/ #ifndef _pqTreeLayoutStrategyInterface_h #define _pqTreeLayoutStrategyInterface_h #include <QtPlugin> #include <QStringList> #include "pqCoreModule.h" class vtkAreaLayoutStrategy; /// interface class for plugins that create view modules class PQCORE_EXPORT pqTreeLayoutStrategyInterface { public: /// destructor pqTreeLayoutStrategyInterface(); virtual ~pqTreeLayoutStrategyInterface(); /// Return a list of layout strategies supported by this interface virtual QStringList treeLayoutStrategies() const = 0; virtual vtkAreaLayoutStrategy* getTreeLayoutStrategy(const QString& layoutStrategy) = 0; }; Q_DECLARE_INTERFACE(pqTreeLayoutStrategyInterface, "com.kitware/paraview/treeLayoutStrategy") #endif
/*--------------------------------------------------------------------*/ /*--- Herbgrind: a valgrind tool for Herbie runtime-util ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Herbgrind, a valgrind tool for diagnosing floating point accuracy problems in binary programs and extracting problematic expressions. Copyright (C) 2016-2017 Alex Sanchez-Stern 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. The GNU General Public License is contained in the file COPYING. */ #include "runtime-util.h" #include "pub_tool_stacktrace.h" #include "pub_tool_threadstate.h" #include "pub_tool_debuginfo.h" #include "pub_tool_libcbase.h" #include "pub_tool_libcprint.h" #include <math.h> Bool isPrefix(const char* prefix, const char* str){ while(*prefix != '\0'){ if (*str != *prefix){ return False; } str++; prefix++; } return True; } #define NCALLFRAMES 5 Addr getCallAddr(void){ Addr trace[NCALLFRAMES]; UInt nframes = VG_(get_StackTrace)(VG_(get_running_tid)(), trace, NCALLFRAMES, // Is this right? NULL, NULL, 0); for(int i = 0; i < nframes; ++i){ Addr addr = trace[i]; // Basically, this whole block discards addresses which are part // of the redirection process or internal to the replacement // function, and are "below" the location of the call in the calls // stack. Currently it looks like we really only have to look at // the second frame up, but screw it, this probably isn't the // performance bottleneck, and it might be nice to have the // robustness somewhere down the line. const HChar* filename; if (VG_(get_filename)(VG_(current_DiEpoch)(), addr, &filename)){ if (VG_(strcmp)(filename, "mathwrap.c") == 0) continue; if (VG_(strcmp)(filename, "printf-wrap.c") == 0) continue; } return addr; } return 0; } void printBBufFloat(BBuf* buf, double val){ int i = 0; if (val != val){ printBBuf(buf, "+nan.0"); } else if (val == INFINITY){ printBBuf(buf, "+inf.0"); } else if (val == -INFINITY){ printBBuf(buf, "-inf.0"); } else if (val > 0 && val < 1){ while (val < 1) { val *= 10; i++; } printBBuf(buf, "%fe-%d", val, i); } else if (val < 0 && val > -1){ while (val > -1) { val *= 10; i++; } printBBuf(buf, "%fe-%d", val, i); // Floating-point error can make this value 10 - eps when it's // supposed to be 10, and valgrind will round it to 6 digits when // printing, producing 10. } else if (val >= 9.9999999){ while (val >= 9.9999999){ val /= 10; i++; } printBBuf(buf, "%fe%d", val, i); } else if (val <= -9.9999999){ while (val <= -9.9999999){ val /= 10; i++; } printBBuf(buf, "%fe%d", val, i); } else { printBBuf(buf, "%f", val); } } VG_REGPARM(1) void ppFloat_wrapper(UWord value){ ppFloat(*(double*)(void*)&value); } void ppFloat(double val){ int i = 0; if (val != val){ VG_(printf)("+nan.0"); } else if (val == INFINITY){ VG_(printf)("+inf.0"); } else if (val == -INFINITY){ VG_(printf)("-inf.0"); } else if (val > 0 && val < 1){ while (val < 1) { val *= 10; i++; } VG_(printf)("%fe-%d", val, i); } else if (val < 0 && val > -1){ while (val > -1) { val *= 10; i++; } VG_(printf)("%fe-%d", val, i); } else if (val >= 9.9999999){ while (val >= 9.9999999){ val /= 10; i++; } VG_(printf)("%fe%d", val, i); } else if (val <= -9.9999999){ while (val <= -9.9999999){ val /= 10; i++; } VG_(printf)("%fe%d", val, i); } else { VG_(printf)("%f", val); } }
/**************************************** * * theShell - Desktop Environment * Copyright (C) 2019 Victor Tran * * 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 BLUETOOTHMANAGEMENT_H #define BLUETOOTHMANAGEMENT_H #include <debuginformationcollector.h> #include <QStackedWidget> #include <BluezQt/Adapter> #include <BluezQt/PendingCall> #include <BluezQt/Services> #include <BluezQt/ObexObjectPush> #include <BluezQt/ObexSession> #include <ttoast.h> #include <QLabel> #include <QCheckBox> #include <QInputDialog> #include <QMessageBox> #include <statuscenterpaneobject.h> #include <QCommandLinkButton> #include <QFileDialog> #include <QProgressBar> #include "btagent.h" #include "btobexagent.h" #include "deviceslistmodel.h" #include "transferslistmodel.h" #include "chunkwidget.h" namespace Ui { class BluetoothManagement; } class BluetoothManagement : public QStackedWidget, public StatusCenterPaneObject { Q_OBJECT public: explicit BluetoothManagement(QWidget *parent = 0); ~BluetoothManagement(); QWidget* mainWidget(); QString name(); StatusPaneTypes type(); int position(); void message(QString name, QVariantList args); private slots: void updateAdapters(); void on_visibilityCheck_toggled(bool checked); void on_enableCheck_toggled(bool checked); void on_changeNameButton_clicked(); void selectedDeviceChanged(QModelIndex current, QModelIndex previous); void on_mainMenuButton_clicked(); void on_backButton_clicked(); void on_pairButton_clicked(); void on_unpairDeviceButton_clicked(); void on_pairDeviceList_activated(const QModelIndex &index); void on_cancelPairingButton_clicked(); void pairRequest(QString pin, BluezQt::Request<> req, QString explanation, bool showContinueButton); void pairReturnRequest(BluezQt::Request<QString> req, QString explanation); void pairCancel(); void on_acceptCodeInputButton_clicked(); void on_acceptCodeButton_clicked(); void on_deviceNameEdit_textChanged(const QString &arg1); void loadCurrentDevice(); void on_connectButton_clicked(); void on_connectPANButton_clicked(); void on_backButton_2_clicked(); void on_activeFileTransfersButton_clicked(); void on_sendFilesButton_clicked(); void selectedTransferChanged(QModelIndex current, QModelIndex previous); void loadCurrentTransfer(); void on_cancelTransferButton_clicked(); private: Ui::BluetoothManagement *ui; BTAgent* agent; BTObexAgent* obexAgent; BluezQt::Manager* mgr; BluezQt::AdapterPtr currentAdapter; BluezQt::DevicePtr currentDevice, pairingDevice; BluezQt::Request<> currentRequest; BluezQt::Request<QString> currentReturnRequest; QMap<uint, BluezQt::AdapterPtr> adapterSwitches; BluezQt::ObexManager* obexMgr; BluezQt::ObexTransferPtr currentTransfer; TransfersListModel* obexTransferModel; QMetaObject::Connection transferTransferredSignal, transferStateChangedSignal; ChunkWidget* chunk; void changeEvent(QEvent* event); void connectAllProfiles(int profileIndex, BluezQt::DevicePtr device); }; #endif // BLUETOOTHMANAGEMENT_H
#ifndef TG4_REGIONS_MESSENGER_H #define TG4_REGIONS_MESSENGER_H //------------------------------------------------ // The Geant4 Virtual Monte Carlo package // Copyright (C) 2007 - 2014 Ivana Hrivnacova // All rights reserved. // // For the licensing terms see geant4_vmc/LICENSE. // Contact: root-vmc@cern.ch //------------------------------------------------- /// \file TG4RegionsMessenger.h /// \brief Definition of the TG4RegionsMessenger class /// /// \author I. Hrivnacova; IPN Orsay #include <G4UImessenger.hh> #include <globals.hh> class TG4RegionsManager; class G4UIdirectory; class G4UIcmdWithAString; class G4UIcmdWithAnInteger; class G4UIcmdWithABool; /// \ingroup run /// \brief Messenger class that defines commands for TG4RegionsManager /// /// Implements commands: /// - /mcRegions/dump [lvName] /// - /mcRegions/setRangePrecision value /// - /mcRegions/applyForGamma true|false /// - /mcRegions/applyForElectron true|false /// - /mcRegions/applyForPositron true|false /// - /mcRegions/applyForProton true|false /// - /mcRegions/check [true|false] /// - /mcRegions/print [true|false] /// /// \author I. Hrivnacova; IPN, Orsay class TG4RegionsMessenger : public G4UImessenger { public: TG4RegionsMessenger(TG4RegionsManager* runManager); virtual ~TG4RegionsMessenger(); // methods virtual void SetNewValue(G4UIcommand* command, G4String string); private: /// Not implemented TG4RegionsMessenger(); /// Not implemented TG4RegionsMessenger(const TG4RegionsMessenger& right); /// Not implemented TG4RegionsMessenger& operator=(const TG4RegionsMessenger& right); // data members TG4RegionsManager* fRegionsManager; ///< associated class G4UIdirectory* fDirectory; ///< command directory /// command: /mcRegions/dump [lvName] G4UIcmdWithAString* fDumpRegionCmd; /// command: /mcRegions/applyForGamma true|false G4UIcmdWithAnInteger* fSetRangePrecisionCmd; /// command: /mcRegions/applyForGamma true|false G4UIcmdWithABool* fApplyForGammaCmd; /// command: /mcRegions/applyForElectron true|false G4UIcmdWithABool* fApplyForElectronCmd; /// command: /mcRegions/applyForPositron true|false G4UIcmdWithABool* fApplyForPositronCmd; /// command: /mcRegions/applyForProton true|false G4UIcmdWithABool* fApplyForProtonCmd; /// command: /mcRegions/check [true|false] G4UIcmdWithABool* fSetCheckCmd; /// command: /mcRegions/print [true|false] G4UIcmdWithABool* fSetPrintCmd; }; #endif // TG4_RUN_MESSENGER_H
/* File: jagbytopvalueconvert.h Project: jaguar-bytecode Author: Douwe Vos Date: Nov 3, 2012 Web: http://www.natpad.net/ e-mail: dmvos2000(at)yahoo.com Copyright (C) 2012 Douwe Vos. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef JAGBYTOPVALUECONVERT_H_ #define JAGBYTOPVALUECONVERT_H_ #include "../jagbytabstractmnemonic.h" #include "../jagbyttype.h" #include <caterpillar.h> G_BEGIN_DECLS #define JAG_BYT_TYPE_OP_VALUE_CONVERT (jag_byt_op_value_convert_get_type()) #define JAG_BYT_OP_VALUE_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), jag_byt_op_value_convert_get_type(), JagBytOpValueConvert)) #define JAG_BYT_OP_VALUE_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAG_BYT_TYPE_OP_VALUE_CONVERT, JagBytOpValueConvertClass)) #define JAG_BYT_IS_OP_VALUE_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAG_BYT_TYPE_OP_VALUE_CONVERT)) #define JAG_BYT_IS_OP_VALUE_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAG_BYT_TYPE_OP_VALUE_CONVERT)) #define JAG_BYT_OP_VALUE_CONVERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAG_BYT_TYPE_OP_VALUE_CONVERT, JagBytOpValueConvertClass)) typedef struct _JagBytOpValueConvert JagBytOpValueConvert; typedef struct _JagBytOpValueConvertPrivate JagBytOpValueConvertPrivate; typedef struct _JagBytOpValueConvertClass JagBytOpValueConvertClass; struct _JagBytOpValueConvert { JagBytAbstractMnemonic parent; }; struct _JagBytOpValueConvertClass { JagBytAbstractMnemonicClass parent_class; }; GType jag_byt_op_value_convert_get_type(); JagBytOpValueConvert *jag_byt_op_value_convert_new(JagBytOperation operation, int offset, JagBytType source_type, JagBytType destination_type); G_END_DECLS #endif /* JAGBYTOPVALUECONVERT_H_ */
/* * This file is part of Cleanflight. * * Cleanflight is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Cleanflight is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #define TARGET_BOARD_IDENTIFIER "OLI1" // Olimexino //#define OLIMEXINO_UNCUT_LED1_E_JUMPER //#define OLIMEXINO_UNCUT_LED2_E_JUMPER #ifdef OLIMEXINO_UNCUT_LED1_E_JUMPER #define LED0_GPIO GPIOA #define LED0_PIN Pin_5 // D13, PA5/SPI1_SCK/ADC5 - "LED1" on silkscreen, Green #define LED0_PERIPHERAL RCC_APB2Periph_GPIOA #define LED0 #endif #ifdef OLIMEXINO_UNCUT_LED2_E_JUMPER // "LED2" is using one of the PWM pins (CH2/PWM2), so we must not use PWM2 unless the jumper is cut. @See pwmInit() #define LED1_GPIO GPIOA #define LED1_PIN Pin_1 // D3, PA1/USART2_RTS/ADC1/TIM2_CH3 - "LED2" on silkscreen, Yellow #define LED1_PERIPHERAL RCC_APB2Periph_GPIOA #define LED1 #endif #define GYRO #define USE_FAKE_GYRO //#define USE_GYRO_L3G4200D //#define USE_GYRO_L3GD20 //#define USE_GYRO_MPU3050 #define USE_GYRO_MPU6050 //#define USE_GYRO_SPI_MPU6000 //#define USE_GYRO_SPI_MPU6500 #define ACC #define USE_FAKE_ACC //#define USE_ACC_ADXL345 //#define USE_ACC_BMA280 //#define USE_ACC_MMA8452 //#define USE_ACC_LSM303DLHC #define USE_ACC_MPU6050 //#define USE_ACC_SPI_MPU6000 //#define USE_ACC_SPI_MPU6500 #define BARO //#define USE_BARO_MS5611 #define USE_BARO_BMP085 #define USE_BARO_BMP280 #define MAG #define USE_MAG_HMC5883 #define SONAR #define USE_USART1 #define USE_USART2 #define USE_SOFTSERIAL1 #define USE_SOFTSERIAL2 #define SERIAL_PORT_COUNT 4 #define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6 #define SOFTSERIAL_2_TIMER TIM3 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8 #define USE_I2C #define I2C_DEVICE (I2CDEV_2) // #define SOFT_I2C // enable to test software i2c // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011) // #define SOFT_I2C_PB67 #define USE_ADC #define CURRENT_METER_ADC_GPIO GPIOB #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_9 #define VBAT_ADC_GPIO GPIOA #define VBAT_ADC_GPIO_PIN GPIO_Pin_4 #define VBAT_ADC_CHANNEL ADC_Channel_4 #define RSSI_ADC_GPIO GPIOA #define RSSI_ADC_GPIO_PIN GPIO_Pin_1 #define RSSI_ADC_CHANNEL ADC_Channel_1 #define EXTERNAL1_ADC_GPIO GPIOA #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_5 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_5 #define GPS #define LED_STRIP #define LED_STRIP_TIMER TIM3 #define TELEMETRY #define SERIAL_RX #define AUTOTUNE #define BLACKBOX #define USE_SERVOS #define USE_CLI
/* Unix SMB/CIFS implementation. Copyright (C) Andrew Tridgell 2005 Copyright (C) Jelmer Vernooij 2005 ** NOTE! The following LGPL license applies to the tevent ** library. This does NOT imply that all of Samba is released ** under the LGPL 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 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "replace.h" #include "tevent.h" #include "tevent_internal.h" /******************************************************************** * Debug wrapper functions, modeled (with lot's of code copied as is) * after the ev debug wrapper functions ********************************************************************/ /* this allows the user to choose their own debug function */ int tevent_set_debug(struct tevent_context *ev, void (*debug)(void *context, enum tevent_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0), void *context) { if (ev->wrapper.glue != NULL) { ev = tevent_wrapper_main_ev(ev); tevent_abort(ev, "tevent_set_debug() on wrapper"); errno = EINVAL; return -1; } ev->debug_ops.debug = debug; ev->debug_ops.context = context; return 0; } /* debug function for ev_set_debug_stderr */ static void tevent_debug_stderr(void *private_data, enum tevent_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0); static void tevent_debug_stderr(void *private_data, enum tevent_debug_level level, const char *fmt, va_list ap) { if (level <= TEVENT_DEBUG_WARNING) { vfprintf(stderr, fmt, ap); } } /* convenience function to setup debug messages on stderr messages of level TEVENT_DEBUG_WARNING and higher are printed */ int tevent_set_debug_stderr(struct tevent_context *ev) { return tevent_set_debug(ev, tevent_debug_stderr, ev); } /* * log a message * * The default debug action is to ignore debugging messages. * This is the most appropriate action for a library. * Applications using the library must decide where to * redirect debugging messages */ void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level, const char *fmt, ...) { va_list ap; if (!ev) { return; } if (ev->wrapper.glue != NULL) { ev = tevent_wrapper_main_ev(ev); } if (ev->debug_ops.debug == NULL) { return; } va_start(ap, fmt); ev->debug_ops.debug(ev->debug_ops.context, level, fmt, ap); va_end(ap); } void tevent_set_trace_callback(struct tevent_context *ev, tevent_trace_callback_t cb, void *private_data) { if (ev->wrapper.glue != NULL) { ev = tevent_wrapper_main_ev(ev); tevent_abort(ev, "tevent_set_trace_callback() on wrapper"); return; } ev->tracing.callback = cb; ev->tracing.private_data = private_data; } void tevent_get_trace_callback(struct tevent_context *ev, tevent_trace_callback_t *cb, void *private_data) { *cb = ev->tracing.callback; *(void**)private_data = ev->tracing.private_data; } void tevent_trace_point_callback(struct tevent_context *ev, enum tevent_trace_point tp) { if (ev->tracing.callback != NULL) { ev->tracing.callback(tp, ev->tracing.private_data); } }
/* * File name: ranges.c * * A solution to K&R The C Programming Language: * * Page 36 * Exercise 2-1. Write a program to determine the ranges of char, short, int, * and long variables, both signed and unsigned, by printing appropriate values * from standard headers and by direct computation. Harder if you compute them: * determine the ranges of the various floating-point types. * */ #include <stdio.h> #include <stdint.h> #include <limits.h> #include <float.h> #define MAX_UNSIGNED(x) ((x)~MIN_UNSIGNED(x)) #define MIN_UNSIGNED(x) ((x)0) #define MAX_SIGNED(x) ((unsigned x)~0 >> 1) #define MIN_SIGNED(x) (MAX_SIGNED(x) + 1) #define MAX_NORMALIZED_FLT(exp, frac) (\ (UINT64_C(0) << ((exp) + (frac))) | /* positive sign*/ \ ((((UINT64_C(1) << (exp)) - 1) & ~UINT64_C(1)) << (frac)) |/* max exp */ \ ((UINT64_C(1) << (frac)) - 1) /* max frac */ \ ) #define MIN_NORMALIZED_FLT(exp, frac) (\ (UINT64_C(0) << ((exp) + (frac))) | /* positive sign */ \ (UINT64_C(1) << (frac)) | /* min exp */ \ UINT64_C(0) /* min frac */ \ ) int main() { float min_flt, max_flt; double min_dp, max_dp; printf("signed char: %hhd~%hhd\n", MIN_SIGNED(char), MAX_SIGNED(char)); printf("unsigned char: %hhu~%hhu\n", MIN_UNSIGNED(unsigned char), MAX_UNSIGNED(unsigned char)); printf("signed short: %hd~%hd\n", MIN_SIGNED(short), MAX_SIGNED(short)); printf("unsigned short: %hu~%hu\n", MIN_UNSIGNED(unsigned short), MAX_UNSIGNED(unsigned short)); printf("signed int: %d~%d\n", MIN_SIGNED(int), MAX_SIGNED(int)); printf("unsigned int: %u~%u\n", MIN_UNSIGNED(unsigned int), MAX_UNSIGNED(unsigned int)); printf("signed long: %ld~%ld\n", MIN_SIGNED(long), MAX_SIGNED(long)); printf("unsigned long: %lu~%lu\n", MIN_UNSIGNED(unsigned long), MAX_UNSIGNED(unsigned long)); /* min normalized float */ *(uint32_t *)(&min_flt) = MIN_NORMALIZED_FLT(8, 23); /* max normalized float */ *(uint32_t *)(&max_flt) = MAX_NORMALIZED_FLT(8, 23); /* min normalized double */ *(uint64_t *)(&min_dp) = MIN_NORMALIZED_FLT(11, 52); /* max normalized double */ *(uint64_t *)(&max_dp) = MAX_NORMALIZED_FLT(11, 52); printf("float: %g~%g\n", min_flt, max_flt); printf("double: %g~%g\n", min_dp, max_dp); /* from header */ printf("--------------------from header--------------------\n"); printf("signed char: %hhd~%hhd\n", SCHAR_MIN, SCHAR_MAX); printf("unsigned char: %hhu~%hhu\n", 0, UCHAR_MAX); printf("signed short: %hd~%hd\n", SHRT_MIN, SHRT_MAX); printf("unsigned short: %hu~%hu\n", 0, USHRT_MAX); printf("signed int: %d~%d\n", INT_MIN, INT_MAX); printf("unsigned int: %u~%u\n", 0, UINT_MAX); printf("signed long: %ld~%ld\n", LONG_MIN, LONG_MAX); printf("unsigned long: %lu~%lu\n", 0, ULONG_MAX); printf("float: %g~%g\n", FLT_MIN, FLT_MAX); printf("double: %g~%g\n", DBL_MIN, DBL_MAX); return 0; }
// // GHInputSourceManager.h // GhostSKB // // Created by dmx on 2018/5/14. // Copyright © 2018 丁明信. All rights reserved. // #import <Foundation/Foundation.h> @interface GHInputSourceManager : NSObject + (GHInputSourceManager *)getInstance; - (BOOL)selectInputSource:(NSString *)inputSourceId; - (BOOL)selectNonCJKVInputSource; - (BOOL)hasInputSourceEnabled:(NSString *)inputSourceId; + (NSMutableArray *) getAlivibleInputMethods; @property (strong) NSString *switchModifierStr; @end
#ifndef BATLABPACKET_H #define BATLABPACKET_H #include <QObject> #include "batlablib.h" class BatlabPacket { public: explicit BatlabPacket(); explicit BatlabPacket(int batlabNamespace, int batlabRegister); // Read packet explicit BatlabPacket(int batlabNamespace, int batlabRegister, uint16_t payload); // Write packet explicit BatlabPacket(int batlabNamespace, int batlabRegister, uchar payloadLowByte, uchar payloadHighByte); // Write packet quint16 getValue(); BatlabPacket setValue(quint16 value); uchar getStartByte(); BatlabPacket setStartByte(uchar startByte); uchar getNamespace(); BatlabPacket setNamespace(uchar ns); uchar getAddress(); BatlabPacket setAddress(uchar address); uchar getPayloadLowByte(); BatlabPacket setPayloadLowByte(uchar lowByte); uchar getPayloadHighByte(); BatlabPacket setPayloadHighByte(uchar highByte); int getWriteTimeout_ms(); BatlabPacket setWriteTimeout_ms(int writeTimeout_ms); int getReadTimeout_ms(); int getSleepAfterTransaction_ms(); BatlabPacket setSleepAfterTransaction_ms(int ms); bool getReadVerify(); int getRetries(); float asVoltage(); float asVcc(); float asFreq(); float asIOff(); float asSetPoint(); float asMagdiv(); QString asMode(); QString asErr(); float asTemperatureF(int Rdiv, int B); float asTemperatureF(QVector<int> RList, QVector<int> BList); float asTemperatureC(int Rdiv, int B); float asTemperatureC(QVector<int> RList, QVector<int> BList); float asCurrent(); void debug(); signals: public slots: private: uchar m_startByte; uchar m_nameSpace; uchar m_address; uchar m_payloadLowByte; uchar m_payloadHighByte; int m_writeTimeout_ms; int m_readTimeout_ms; int m_sleepAfterTransaction_ms; bool m_readVerify; int m_retries; }; struct batlabPacketBundle { QVector<BatlabPacket> packets; QString callback; int channel; // -1 if not for specific channel }; #endif // BATLABPACKET_H
/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Stig Sæther Bakken <ssb@php.net> | | Thies C. Arntzen <thies@thieso.net> | | Sterling Hughes <sterling@php.net> | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef PHP_XML_H #define PHP_XML_H #ifdef HAVE_XML extern zend_module_entry xml_module_entry; #define xml_module_ptr &xml_module_entry #else #define xml_module_ptr NULL #endif #ifdef HAVE_XML #include "ext/xml/expat_compat.h" #ifdef XML_UNICODE #error "UTF-16 Unicode support not implemented!" #endif ZEND_BEGIN_MODULE_GLOBALS(xml) XML_Char *default_encoding; ZEND_END_MODULE_GLOBALS(xml) typedef struct { int index; int case_folding; XML_Parser parser; XML_Char *target_encoding; zval *startElementHandler; zval *endElementHandler; zval *characterDataHandler; zval *processingInstructionHandler; zval *defaultHandler; zval *unparsedEntityDeclHandler; zval *notationDeclHandler; zval *externalEntityRefHandler; zval *unknownEncodingHandler; zval *startNamespaceDeclHandler; zval *endNamespaceDeclHandler; zend_function *startElementPtr; zend_function *endElementPtr; zend_function *characterDataPtr; zend_function *processingInstructionPtr; zend_function *defaultPtr; zend_function *unparsedEntityDeclPtr; zend_function *notationDeclPtr; zend_function *externalEntityRefPtr; zend_function *unknownEncodingPtr; zend_function *startNamespaceDeclPtr; zend_function *endNamespaceDeclPtr; zval *object; zval *data; zval *info; int level; int toffset; int curtag; zval **ctag; char **ltags; int lastwasopen; int skipwhite; int isparsing; XML_Char *baseURI; } xml_parser; typedef struct { XML_Char *name; char (*decoding_function)(unsigned short); unsigned short (*encoding_function)(unsigned char); } xml_encoding; enum php_xml_option { PHP_XML_OPTION_CASE_FOLDING = 1, PHP_XML_OPTION_TARGET_ENCODING, PHP_XML_OPTION_SKIP_TAGSTART, PHP_XML_OPTION_SKIP_WHITE }; /* for xml_parse_into_struct */ #define XML_MAXLEVEL 255 /* XXX this should be dynamic */ PHP_FUNCTION(xml_parser_create); PHP_FUNCTION(xml_parser_create_ns); PHP_FUNCTION(xml_set_object); PHP_FUNCTION(xml_set_element_handler); PHP_FUNCTION(xml_set_character_data_handler); PHP_FUNCTION(xml_set_processing_instruction_handler); PHP_FUNCTION(xml_set_default_handler); PHP_FUNCTION(xml_set_unparsed_entity_decl_handler); PHP_FUNCTION(xml_set_notation_decl_handler); PHP_FUNCTION(xml_set_external_entity_ref_handler); PHP_FUNCTION(xml_set_start_namespace_decl_handler); PHP_FUNCTION(xml_set_end_namespace_decl_handler); PHP_FUNCTION(xml_parse); PHP_FUNCTION(xml_get_error_code); PHP_FUNCTION(xml_error_string); PHP_FUNCTION(xml_get_current_line_number); PHP_FUNCTION(xml_get_current_column_number); PHP_FUNCTION(xml_get_current_byte_index); PHP_FUNCTION(xml_parser_free); PHP_FUNCTION(xml_parser_set_option); PHP_FUNCTION(xml_parser_getOption); PHP_FUNCTION(utf8_encode); PHP_FUNCTION(utf8_decode); PHP_FUNCTION(xml_parse_into_struct); PHPAPI char *_xml_zval_strdup(zval *val); PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *); PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding); #endif /* HAVE_LIBEXPAT */ #define phpext_xml_ptr xml_module_ptr #ifdef ZTS #define XML(v) TSRMG(xml_globals_id, zend_xml_globals *, v) #else #define XML(v) (xml_globals.v) #endif #endif /* PHP_XML_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: */
/* REWRITTEN BY XINEF */ #ifndef DEF_SHADOW_LABYRINTH_H #define DEF_SHADOW_LABYRINTH_H enum slData { TYPE_OVERSEER = 0, TYPE_HELLMAW = 1, DATA_BLACKHEARTTHEINCITEREVENT = 2, DATA_GRANDMASTERVORPILEVENT = 3, DATA_MURMUREVENT = 4, MAX_ENCOUNTER = 5 }; enum slNPCandGO { NPC_FEL_OVERSEER = 18796, NPC_HELLMAW = 18731, REFECTORY_DOOR = 183296, //door opened when blackheart the inciter dies SCREAMING_HALL_DOOR = 183295 //door opened when grandmaster vorpil dies }; #endif
// define the simulation constants #define eps 1 // an energy parameter #define lat_const 3.61 // lattice constant of copper, in angstrom #define cn 39.432 // density of state constant #define nint 9 // potential function steepness #define mint 6 // potential function range // define macros for index mapping of cells in 3 dimensions #define index(ic,nc) ((ic)[0] + (nc)[0]*((ic)[1] + (nc)[1]*(ic)[2]))
#ifndef DISCRETEDISTRIBUTION_H #define DISCRETEDISTRIBUTION_H /** * \file discretedistribution.h */ #include "probabilitydistribution.h" #include <vector> class GslRandomNumberGenerator; /** Helper class to generate random numbers based on some kind of * discrete distribution. * You'll need to specify the sizes of the bins and the values * of the bins, which are a measure of the integrated probability * density inside bin. */ class DiscreteDistribution : public ProbabilityDistribution { public: /** Constructor of the class. * \param binStarts The values of the start of each bin. These * must be in ascending order. * \param histValues Measures of the integrated probability in * each bin * \param floor If set to true, only the bin start values will be * returned, otherwise a constant probability is assumed * within a bin. * \param pRndGen The random number generator to use for randomness when * picking numbers according to this distribution. * * The value at the start of the last bin should be zero. */ DiscreteDistribution(const std::vector<double> &binStarts, const std::vector<double> &histValues, bool floor, GslRandomNumberGenerator *pRndGen); ~DiscreteDistribution(); double pickNumber() const; private: std::vector<double> m_histSums; std::vector<double> m_binStarts; double m_totalSum; bool m_floor; }; #endif // DISCRETEDISTRIBUTION_H
#include<stdio.h> #include<stdlib.h> #include"matr_functions_1d.h" void usage(char * prog_name); matrix_1d mult_matrices(matrix_1d mat1, matrix_1d mat2); int main(int argc, char *argv[]) { matrix_1d mat1, mat2, result; if(argc!=4) usage(argv[0]); mat1 = read_matrix_1d(argv[1]); //write_matrix_1d(mat1, "stdout"); // Debug code. //printf("\n"); mat2 = read_matrix_1d(argv[2]); //write_matrix_1d(mat2, "stdout"); // Debug code. //printf("\n"); //printf("Calculating result:\n"); // Debug code. result = mult_matrices(mat1, mat2); if(result.columns == -1) // "Catches" the error in the multiplication. fprintf(stderr, "There was an error during matrix multiplication!\n"); else write_matrix_1d(result, argv[3]); free(mat1.values); free(mat2.values); // 14th Amendment. free(result.values); return 0; } /* * Simple usage function if we give the program an illegal number of arguments. * It also details how, and what arguments can be given to the program. */ void usage(char * prog_name) { fprintf(stderr, "Illegal number of arguments!\nUsage: %s <first input file name> <second input file name> <output file name>\n", prog_name); fprintf(stderr, "You can also specify the output to be the standard output, by writing \"stdout\" instead of a file name.\n"); exit(1); } /* * Matrix multiplier. Pretty basic, but checks for incompatible matrices too. */ matrix_1d mult_matrices(matrix_1d mat1, matrix_1d mat2) { matrix_1d result; int i, j, k; double temp = 0; double t1, t2; if(mat1.columns != mat2.rows) // Checks if the two matrices are compatible. { fprintf(stderr, "The two matrices are not compatible! They cannot be multiplied.\n"); result.columns = -1; // Value for error handling. return result; } result.rows = mat1.rows; result.columns = mat2.columns; // Need to initialize these values, because we use them. result.values = (double *)calloc(mat1.rows*mat2.columns, sizeof(double)); //printf("Loop boundaries:\nOuter: %d\tMiddle: %d\tInner: %d\n", mat1.rows, mat2.columns, mat1.columns); Debug code for(i=0;i<mat1.rows;i++) { //result.values[i] = (double *)calloc(mat2.columns, sizeof(double)); for(j=0;j<mat2.columns;j++) { //result.values[i][j] = 0; for(k=0;k<mat1.columns;k++) { //result.values[i][j] += mat1.values[i][k] * mat2.values[k][j]; t1 = get_value(i, k, mat1); t2 = get_value(k, j, mat2); //printf("Multiplying %g (Row: %d Column: %d) with\n", t1, i, k); //printf("with %g (Row: %d Column: %d)\n", t2, k, j); Debug code //getchar(); temp += t1*t2; } //printf("The value of element at row %d column %d: %g", i, j, temp); Debug code //getchar(); set_value(i, j, result, temp); temp = 0; } } //printf("Out of the loop!\n"); Debug code return result; }
/* * Copyright 2007-2009 Analog Devices Inc. * Philippe Gerum <rpm@xenomai.org> * * Licensed under the GPL-2 or later. */ #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/delay.h> #include <asm/smp.h> #include <asm/dma.h> #include <asm/time.h> static DEFINE_SPINLOCK(boot_lock); /* * platform_init_cpus() - Tell the world about how many cores we * have. This is called while setting up the architecture support * (setup_arch()), so don't be too demanding here with respect to * available kernel services. */ void __init platform_init_cpus(void) { struct cpumask mask; cpumask_set_cpu(0, &mask); /* CoreA */ cpumask_set_cpu(1, &mask); /* CoreB */ init_cpu_possible(&mask); } void __init platform_prepare_cpus(unsigned int max_cpus) { struct cpumask mask; bfin_relocate_coreb_l1_mem(); /* Both cores ought to be present on a bf561! */ cpumask_set_cpu(0, &mask); /* CoreA */ cpumask_set_cpu(1, &mask); /* CoreB */ init_cpu_present(&mask); } int __init setup_profiling_timer(unsigned int multiplier) /* not supported */ { return -EINVAL; } void platform_secondary_init(unsigned int cpu) { /* Clone setup for peripheral interrupt sources from CoreA. */ bfin_write_SICB_IMASK0(bfin_read_SIC_IMASK0()); bfin_write_SICB_IMASK1(bfin_read_SIC_IMASK1()); SSYNC(); /* Clone setup for IARs from CoreA. */ bfin_write_SICB_IAR0(bfin_read_SIC_IAR0()); bfin_write_SICB_IAR1(bfin_read_SIC_IAR1()); bfin_write_SICB_IAR2(bfin_read_SIC_IAR2()); bfin_write_SICB_IAR3(bfin_read_SIC_IAR3()); bfin_write_SICB_IAR4(bfin_read_SIC_IAR4()); bfin_write_SICB_IAR5(bfin_read_SIC_IAR5()); bfin_write_SICB_IAR6(bfin_read_SIC_IAR6()); bfin_write_SICB_IAR7(bfin_read_SIC_IAR7()); bfin_write_SICB_IWR0(IWR_DISABLE_ALL); bfin_write_SICB_IWR1(IWR_DISABLE_ALL); SSYNC(); /* We are done with local CPU inits, unblock the boot CPU. */ spin_lock(&boot_lock); spin_unlock(&boot_lock); } int platform_boot_secondary(unsigned int cpu, struct task_struct *idle) { unsigned long timeout; printk(KERN_INFO "Booting Core B.\n"); spin_lock(&boot_lock); if ((bfin_read_SYSCR() & COREB_SRAM_INIT) == 0) { /* CoreB already running, sending ipi to wakeup it */ smp_send_reschedule(cpu); } else { /* Kick CoreB, which should start execution from CORE_SRAM_BASE. */ bfin_write_SYSCR(bfin_read_SYSCR() & ~COREB_SRAM_INIT); SSYNC(); } timeout = jiffies + HZ; /* release the lock and let coreb run */ spin_unlock(&boot_lock); while (time_before(jiffies, timeout)) { if (cpu_online(cpu)) { break; } udelay(100); barrier(); } if (cpu_online(cpu)) { return 0; } else { panic("CPU%u: processor failed to boot\n", cpu); } } static const char supple0[] = "IRQ_SUPPLE_0"; static const char supple1[] = "IRQ_SUPPLE_1"; void __init platform_request_ipi(int irq, void *handler) { int ret; const char *name = (irq == IRQ_SUPPLE_0) ? supple0 : supple1; ret = request_irq(irq, handler, IRQF_PERCPU | IRQF_NO_SUSPEND | IRQF_FORCE_RESUME, name, handler); if (ret) { panic("Cannot request %s for IPI service", name); } } void platform_send_ipi(cpumask_t callmap, int irq) { unsigned int cpu; int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8; for_each_cpu(cpu, &callmap) { BUG_ON(cpu >= 2); SSYNC(); bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu))); SSYNC(); } } void platform_send_ipi_cpu(unsigned int cpu, int irq) { int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8; BUG_ON(cpu >= 2); SSYNC(); bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu))); SSYNC(); } void platform_clear_ipi(unsigned int cpu, int irq) { int offset = (irq == IRQ_SUPPLE_0) ? 10 : 12; BUG_ON(cpu >= 2); SSYNC(); bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu))); SSYNC(); } /* * Setup core B's local core timer. * In SMP, core timer is used for clock event device. */ void bfin_local_timer_setup(void) { #if defined(CONFIG_TICKSOURCE_CORETMR) struct irq_data *data = irq_get_irq_data(IRQ_CORETMR); struct irq_chip *chip = irq_data_get_irq_chip(data); bfin_coretmr_init(); bfin_coretmr_clockevent_init(); chip->irq_unmask(data); #else /* Power down the core timer, just to play safe. */ bfin_write_TCNTL(0); #endif }
/** * @file divsi3.c * @brief long int division function needed by gcc * * from: http://opensource.apple.com/source/clang/clang-137/src/projects/compiler-rt/lib/divsi3.c */ #include "fpga-log/long_int.h" #define DIV_SIZE (sizeof(long int)*9-1) long int __attribute__((optimize("Os"))) __divsi3(long int a, long int b) { long s_a = (a >> DIV_SIZE); /* s_a = a < 0 ? -1 : 0 */ long s_b = (b >> DIV_SIZE); /* s_b = b < 0 ? -1 : 0 */ a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ s_a ^= s_b; /* sign of quotient */ return (__udivsi3(a, b) ^ s_a) - s_a; /* negate if s_a == -1 */ }
/* Copyright (c) 2007-2011 Gluster, Inc. <http://www.gluster.com> This file is part of GlusterFS. GlusterFS 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. GlusterFS 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 __IOC_MT_H__ #define __IOC_MT_H__ #include "mem-types.h" enum gf_ioc_mem_types_ { gf_ioc_mt_iovec = gf_common_mt_end + 1, gf_ioc_mt_ioc_table_t, gf_ioc_mt_char, gf_ioc_mt_ioc_local_t, gf_ioc_mt_ioc_waitq_t, gf_ioc_mt_ioc_priority, gf_ioc_mt_list_head, gf_ioc_mt_call_pool_t, gf_ioc_mt_ioc_inode_t, gf_ioc_mt_ioc_fill_t, gf_ioc_mt_ioc_newpage_t, gf_ioc_mt_end }; #endif
/* * Copyright (C) 2003-2022 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * * WeeChat is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * WeeChat is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WeeChat. If not, see <https://www.gnu.org/licenses/>. */ #ifndef WEECHAT_GUI_CURSES_H #define WEECHAT_GUI_CURSES_H #include <time.h> #ifdef WEECHAT_HEADLESS #include "ncurses-fake.h" #else #define NCURSES_WIDECHAR 1 #ifdef HAVE_NCURSESW_CURSES_H #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> #else #include <curses.h> #endif /* HAVE_NCURSESW_CURSES_H */ #endif /* WEECHAT_HEADLESS */ struct t_gui_buffer; struct t_gui_line; struct t_gui_window; struct t_gui_bar_window; #define GUI_CURSES_NUM_WEECHAT_COLORS 17 #ifndef A_ITALIC /* A_ITALIC is defined in ncurses >= 5.9 patch 20130831 */ #define A_ITALIC 0 #endif /* A_ITALIC */ #define A_ALL_ATTR A_BOLD | A_UNDERLINE | A_REVERSE | A_ITALIC #define GUI_WINDOW_OBJECTS(window) \ ((struct t_gui_window_curses_objects *)(window->gui_objects)) #define GUI_BAR_WINDOW_OBJECTS(bar_window) \ ((struct t_gui_bar_window_curses_objects *)(bar_window->gui_objects)) struct t_gui_window_saved_style { int style_fg; int style_bg; int color_attr; int emphasis; attr_t attrs; short pair; }; struct t_gui_window_curses_objects { WINDOW *win_chat; /* chat window (example: channel) */ WINDOW *win_separator_horiz; /* horizontal separator (optional) */ WINDOW *win_separator_vertic; /* vertical separator (optional) */ }; struct t_gui_bar_window_curses_objects { WINDOW *win_bar; /* bar Curses window */ WINDOW *win_separator; /* separator (optional) */ }; extern int gui_term_cols, gui_term_lines; extern struct t_gui_color *gui_weechat_colors; extern int gui_color_term_colors; extern int gui_color_num_pairs; extern int gui_color_pairs_auto_reset; extern int gui_color_pairs_auto_reset_pending; extern time_t gui_color_pairs_auto_reset_last; extern int gui_color_buffer_refresh_needed; extern int gui_window_current_emphasis; /* main functions */ extern void gui_main_init (); extern void gui_main_loop (); /* color functions */ extern int gui_color_get_gui_attrs (int color); extern int gui_color_get_extended_flags (int attrs); extern int gui_color_get_pair (int fg, int bg); extern int gui_color_weechat_get_pair (int weechat_color); extern void gui_color_alloc (); /* chat functions */ extern void gui_chat_calculate_line_diff (struct t_gui_window *window, struct t_gui_line **line, int *line_pos, int difference); /* key functions */ extern void gui_key_default_bindings (int context); extern int gui_key_read_cb (const void *pointer, void *data, int fd); /* window functions */ extern void gui_window_read_terminal_size (); extern void gui_window_clear (WINDOW *window, int fg, int bg); extern void gui_window_clrtoeol (WINDOW *window); extern void gui_window_save_style (WINDOW *window); extern void gui_window_restore_style (WINDOW *window); extern void gui_window_reset_style (WINDOW *window, int num_color); extern void gui_window_reset_color (WINDOW *window, int num_color); extern void gui_window_set_color_style (WINDOW *window, int style); extern void gui_window_remove_color_style (WINDOW *window, int style); extern void gui_window_set_color (WINDOW *window, int fg, int bg); extern void gui_window_set_weechat_color (WINDOW *window, int num_color); extern void gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg, int reset_attributes); extern void gui_window_set_custom_color_pair (WINDOW *window, int pair); extern void gui_window_set_custom_color_fg (WINDOW *window, int fg); extern void gui_window_set_custom_color_bg (WINDOW *window, int bg); extern void gui_window_toggle_emphasis (); extern void gui_window_emphasize (WINDOW *window, int x, int y, int count); extern void gui_window_string_apply_color_fg (unsigned char **str, WINDOW *window); extern void gui_window_string_apply_color_bg (unsigned char **str, WINDOW *window); extern void gui_window_string_apply_color_fg_bg (unsigned char **str, WINDOW *window); extern void gui_window_string_apply_color_pair (unsigned char **str, WINDOW *window); extern void gui_window_string_apply_color_weechat (unsigned char **str, WINDOW *window); extern void gui_window_string_apply_color_set_attr (unsigned char **str, WINDOW *window); extern void gui_window_string_apply_color_remove_attr (unsigned char **str, WINDOW *window); extern void gui_window_hline (WINDOW *window, int x, int y, int width, const char *string); extern void gui_window_vline (WINDOW *window, int x, int y, int height, const char *string); extern void gui_window_set_title (const char *title); #endif /* WEECHAT_GUI_CURSES_H */
#pragma once #include "types.h" #include "debug.h" #include <stdarg.h> #define DEBUG(...) printdbg(TSTR __VA_ARGS__) _no_tstr_printf_format(1, 2) static inline void printdbg_dummy(char const *format, ...){} _no_tstr_printf_format(1, 0) static inline void vprintdbg_dummy(char const *format, ...){} _no_tstr_printf_format(1, 2) int printdbg(tchar const *format, ...); _no_tstr_printf_format(1, 0) int vprintdbg(tchar const *format, va_list ap); void debug_out(char const *s, ptrdiff_t len); void debug_out(char16_t const *s, ptrdiff_t len); static inline void debug_out(wchar_t const *s, ptrdiff_t len) { return debug_out((char16_t*)s, len); }
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === * * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org> * * Tomahawk 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. * * Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GENERATOR_FACTORY_H #define GENERATOR_FACTORY_H #include <QHash> #include <QString> #include "playlist/dynamic/GeneratorInterface.h" #include "Typedefs.h" #include "DllMacro.h" namespace Tomahawk { /** * Generators should subclass this and have it create the custom Generator */ class DLLEXPORT GeneratorFactoryInterface { public: GeneratorFactoryInterface() {} virtual ~GeneratorFactoryInterface() {} virtual GeneratorInterface* create() = 0; /** * Create a control for this generator, not tied to this generator itself. Used when loading dynamic * playlists from a dbcmd. */ virtual dyncontrol_ptr createControl( const QString& controlType = QString() ) = 0; virtual QStringList typeSelectors() const = 0; }; /** * Simple factory that generates Generators from string type descriptors */ class DLLEXPORT GeneratorFactory { public: static geninterface_ptr create( const QString& type ); // only used when loading from dbcmd static dyncontrol_ptr createControl( const QString& generatorType, const QString& controlType = QString() ); static void registerFactory( const QString& type, GeneratorFactoryInterface* iface ); static QStringList types(); static QStringList typeSelectors( const QString& type ); private: static QHash<QString, GeneratorFactoryInterface*> s_factories; }; }; #endif
//////////////////////////////////////////////////////////////// // // Copyright (C) 2005 Affymetrix, Inc. // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License // (version 2.1) as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License // for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this library; if not, write to the Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //////////////////////////////////////////////////////////////// #ifndef _GenericDataHeaderUpdater_HEADER_ #define _GenericDataHeaderUpdater_HEADER_ /*! \file GenericDataHeaderUpdater.h This file defines a class that updates the GenericDataHdr of an existing file. */ #include "calvin_files/data/src/FileHeader.h" // #include <fstream> // #ifdef _MSC_VER #pragma warning(disable: 4290) // don't show warnings about throw keyword on function declarations. #endif namespace affymetrix_calvin_io { /*! This class updates the GenericDataHeader of an existing file with new information. */ class GenericDataHeaderUpdater { public: static const int32_t FIELD_LEN_SIZE = sizeof(int32_t); /*! Constructor */ GenericDataHeaderUpdater(); /*! Destructor */ ~GenericDataHeaderUpdater(); /*! Update the file with the new GenericDataHeader information. * The current implementation just updates the FileId. * @param fileStream An output stream open with std::ios::out|std::ios::binary|std::ios::in. * @param updateHeader A GenericDataHeader with information to update the file. * @param currentHdr The GenericDataHeader object with the information currently in the file. * @return Returns true if the FileId could be udpated. */ bool Update(std::ofstream& fileStream, GenericDataHeader& updateHeader, GenericDataHeader& currentHdr); /*! Update the FileId. Only update the FileId if update and current fileIDs are the same size. * @return Returns true if successful. */ bool UpdateFileId(); /*! Update the parameter list. * Can only update types that have the same name and type and value size in the source and target */ void UpdateParameters(); private: /*! Get the size of the FileHeader in bytes. * @return The size of the FileHeader. */ int32_t GetFileHeaderSize(); /*! Get the size of the GenericDataHeader up to the start of the parameter list. * @return The size of the GenericDataHeader up to the start of the parameter list. */ int32_t GetBytesFromGenericDataHdrStartToParameterList(); private: /*! Open output filestream */ std::ofstream* os; /*! A GenericDataHeader with information to use to update the target*/ GenericDataHeader* updateHdr; /*! The GenericDataHeader with current information */ GenericDataHeader* currentHdr; }; } #endif // _GenericDataHeaderUpdater_HEADER_
/* * Copyright (C) 2007 - 2009 Stephen F. Booth <me@sbooth.org> * All Rights Reserved */ #pragma once #include <CoreAudio/CoreAudioTypes.h> #include <IOKit/storage/IOCDTypes.h> // ======================================== // Useful macros // ======================================== #define AUDIO_FRAMES_PER_CDDA_SECTOR 588 #define CDDA_SECTORS_PER_SECOND 75 #define CDDA_SAMPLE_RATE 44100 #define CDDA_CHANNELS_PER_FRAME 2 #define CDDA_BITS_PER_CHANNEL 16 // ======================================== // Create an AudioStreamBasicDescription that describes CDDA audio // ======================================== AudioStreamBasicDescription getStreamDescriptionForCDDA(void); // ======================================== // Verify an AudioStreamBasicDescription describes CDDA audio // ======================================== BOOL streamDescriptionIsCDDA(const AudioStreamBasicDescription *asbd); // ======================================== // Utility function for adding/subtracting CDMSF structures // addCDMSF returns a + b // subtractCDMSF returns a - b // ======================================== CDMSF addCDMSF(CDMSF a, CDMSF b); CDMSF subtractCDMSF(CDMSF a, CDMSF b);
/** ****************************************************************************** * @file BSP/Inc/main.h * @author MCD Application Team * @version V1.1.0 * @date 17-February-2017 * @brief Header for main.c 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H /* Includes ------------------------------------------------------------------*/ #include "stdio.h" #include "stm32412g_discovery.h" #include "stm32412g_discovery_lcd.h" #include "stm32412g_discovery_sd.h" #include "stm32412g_discovery_eeprom.h" #include "stm32412g_discovery_audio.h" #include "stm32412g_discovery_qspi.h" #include "stm32412g_discovery_ts.h" /* Macros --------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ typedef struct { void (*DemoFunc)(void); uint8_t DemoName[50]; uint32_t DemoIndex; }BSP_DemoTypedef; typedef enum { AUDIO_ERROR_NONE = 0, AUDIO_ERROR_NOTREADY, AUDIO_ERROR_IO, AUDIO_ERROR_EOF, }AUDIO_ErrorTypeDef; extern const unsigned char stlogo[]; /* Exported global variables ---------------------------------------------------*/ #ifndef USE_FULL_ASSERT extern uint16_t ErrorCounter; #endif extern uint32_t SdmmcTest; /* Exported constants --------------------------------------------------------*/ /* Memories addresses */ #define FLASH_CODE_ADDRESS 0x08000000 #define FLASH_DATA_ADDRESS 0x08040000 #define SRAM_WRITE_READ_ADDR 0x2000b000 #define AUDIO_REC_START_ADDR 0x20030000 /* Exported macro ------------------------------------------------------------*/ #define COUNT_OF_EXAMPLE(x) (sizeof(x)/sizeof(BSP_DemoTypedef)) #ifdef USE_FULL_ASSERT /* Assert activated */ #define ASSERT(__condition__) do { if(__condition__) \ { assert_failed(__FILE__, __LINE__); \ while(1); \ } \ }while(0) #else /* Assert not activated : macro has no effect */ #define ASSERT(__condition__) do { if(__condition__) \ { ErrorCounter++; \ } \ }while(0) #endif /* USE_FULL_ASSERT */ /* Exported functions ------------------------------------------------------- */ void Joystick_demo (void); void Joystick_SetCursorPosition(void); void AudioPlay_demo (void); void AudioRecAnalog_demo(void); void LCD_demo (void); void TS_demo(void); void SD_demo (void); void SD_DMA_demo (void); void SD_exti_demo(void); void Log_demo(void); void EEPROM_demo(void); uint8_t AUDIO_Process(void); void QSPI_demo(void); uint8_t CheckForUserInput(void); void Toggle_Leds(void); void AudioRecDfsdm_demo(void); #endif /* __MAIN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/** ****************************************************************************** * @file USB_Device/MSC_Standalone/Inc/stm32f4xx_it.h * @author MCD Application Team * @version V1.1.0 * @date 17-February-2017 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void OTG_FS_IRQHandler(void); void SDMMC1_IRQHandler(void); void BSP_SD_DMA_Rx_IRQHandler(void); void BSP_SD_DMA_Tx_IRQHandler(void); #ifdef __cplusplus } #endif #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#pragma once #include <stdlib.h> typedef struct amHash amHash; typedef int (*cache_f)(void* key); typedef void (*free_f)(void* p); typedef enum { AM_HASH_KEXISTS, AM_HASH_KNOTEXISTS, } amHashResult; amHash* am_hash_new(cache_f cache, size_t key_size, size_t data_size); void am_hash_set_key_ int am_hash_add(amHash* h, void* key, void* data); void* am_hash_get(amHash* h, void* key); amHashResult am_hash_remove(amHash* h, void* key); void am_hash_free(amHash* hash);
#ifndef _ROS_std_msgs_Int32MultiArray_h #define _ROS_std_msgs_Int32MultiArray_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" #include "ArduinoIncludes.h" #include "std_msgs/MultiArrayLayout.h" namespace std_msgs { class Int32MultiArray : public ros::Msg { public: typedef std_msgs::MultiArrayLayout _layout_type; _layout_type layout; uint32_t data_length; typedef int32_t _data_type; _data_type st_data; _data_type * data; Int32MultiArray(): layout(), data_length(0), data(NULL) { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; offset += this->layout.serialize(outbuffer + offset); *(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF; offset += sizeof(this->data_length); for( uint32_t i = 0; i < data_length; i++){ union { int32_t real; uint32_t base; } u_datai; u_datai.real = this->data[i]; *(outbuffer + offset + 0) = (u_datai.base >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (u_datai.base >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (u_datai.base >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (u_datai.base >> (8 * 3)) & 0xFF; offset += sizeof(this->data[i]); } return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; offset += this->layout.deserialize(inbuffer + offset); uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset))); data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->data_length); if(data_lengthT > data_length) this->data = (int32_t*)realloc(this->data, data_lengthT * sizeof(int32_t)); data_length = data_lengthT; for( uint32_t i = 0; i < data_length; i++){ union { int32_t real; uint32_t base; } u_st_data; u_st_data.base = 0; u_st_data.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); u_st_data.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); u_st_data.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); u_st_data.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); this->st_data = u_st_data.real; offset += sizeof(this->st_data); memcpy( &(this->data[i]), &(this->st_data), sizeof(int32_t)); } return offset; } const char * getType(){ return PSTR( "std_msgs/Int32MultiArray" ); }; const char * getMD5(){ return PSTR( "1d99f79f8b325b44fee908053e9c945b" ); }; }; } #endif
// Copyright 2020 ETH Zurich. All Rights Reserved. #pragma once namespace mirheo { class ObjectVector; class LocalObjectVector; /** \brief compute center of mass and bounding box of objects \param [in,out] ov The parent of lov \param [in,out] lov The LocalObjectVector that contains the objects. Will contain the ComAndExtents data per object on return. \param [in] stream The execution stream. */ void computeComExtents(ObjectVector *ov, LocalObjectVector *lov, cudaStream_t stream); } // namespace mirheo
/* Copyright (©) 2003-2022 Teus Benschop. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <config/libraries.h> void test_archive ();
/* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ #line 1 /* read-file.c -- read file contents into a string Copyright (C) 2006 Free Software Foundation, Inc. Written by Simon Josefsson and Bruno Haible. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> #include "read-file.h" /* Get realloc, free. */ #include <stdlib.h> /* Get errno. */ #include <errno.h> /* Read a STREAM and return a newly allocated string with the content, and set *LENGTH to the length of the string. The string is zero-terminated, but the terminating zero byte is not counted in *LENGTH. On errors, *LENGTH is undefined, errno preserves the values set by system functions (if any), and NULL is returned. */ char * fread_file (FILE * stream, size_t * length) { char *buf = NULL; size_t alloc = 0; size_t size = 0; int save_errno; for (;;) { size_t count; size_t requested; if (size + BUFSIZ + 1 > alloc) { char *new_buf; alloc += alloc / 2; if (alloc < size + BUFSIZ + 1) alloc = size + BUFSIZ + 1; new_buf = realloc (buf, alloc); if (!new_buf) { save_errno = errno; break; } buf = new_buf; } requested = alloc - size - 1; count = fread (buf + size, 1, requested, stream); size += count; if (count != requested) { save_errno = errno; if (ferror (stream)) break; buf[size] = '\0'; *length = size; return buf; } } free (buf); errno = save_errno; return NULL; } static char * internal_read_file (const char *filename, size_t * length, const char *mode) { FILE *stream = fopen (filename, mode); char *out; int save_errno; if (!stream) return NULL; out = fread_file (stream, length); save_errno = errno; if (fclose (stream) != 0) { if (out) { save_errno = errno; free (out); } errno = save_errno; return NULL; } return out; } /* Open and read the contents of FILENAME, and return a newly allocated string with the content, and set *LENGTH to the length of the string. The string is zero-terminated, but the terminating zero byte is not counted in *LENGTH. On errors, *LENGTH is undefined, errno preserves the values set by system functions (if any), and NULL is returned. */ char * read_file (const char *filename, size_t * length) { return internal_read_file (filename, length, "r"); } /* Open (on non-POSIX systems, in binary mode) and read the contents of FILENAME, and return a newly allocated string with the content, and set LENGTH to the length of the string. The string is zero-terminated, but the terminating zero byte is not counted in the LENGTH variable. On errors, *LENGTH is undefined, errno preserves the values set by system functions (if any), and NULL is returned. */ char * read_binary_file (const char *filename, size_t * length) { return internal_read_file (filename, length, "rb"); }
#ifndef __READERWRITERGML_H__ #define __READERWRITERGML_H__ #include <osgDB/ReaderWriter> class ReaderWriterGML: public osgDB::ReaderWriter { public: virtual const char* className() const; virtual bool acceptsExtension( const std::string& extension ) const; virtual osgDB::ReaderWriter::WriteResult writeNode( const osg::Node& node, const std::string& filename, const osgDB::Options* options = NULL ) const; }; #endif
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_TEST_FAKE_NETWORK_PIPE_H_ #define WEBRTC_TEST_FAKE_NETWORK_PIPE_H_ #include <queue> #include "webrtc/system_wrappers/interface/constructor_magic.h" #include "webrtc/system_wrappers/interface/event_wrapper.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/typedefs.h" namespace webrtc { class CriticalSectionWrapper; class NetworkPacket; class PacketReceiver; // Class faking a network link. This is a simple and naive solution just faking // capacity and adding an extra transport delay in addition to the capacity // introduced delay. // TODO(mflodman) Add random and bursty packet loss. class FakeNetworkPipe { public: struct Config { Config() : queue_length(0), queue_delay_ms(0), delay_standard_deviation_ms(0), link_capacity_kbps(0), loss_percent(0) { } // Queue length in number of packets. size_t queue_length; // Delay in addition to capacity induced delay. int queue_delay_ms; // Standard deviation of the extra delay. int delay_standard_deviation_ms; // Link capacity in kbps. int link_capacity_kbps; // Random packet loss. Not implemented. int loss_percent; }; explicit FakeNetworkPipe(const FakeNetworkPipe::Config& config); ~FakeNetworkPipe(); // Must not be called in parallel with SendPacket or Process. void SetReceiver(PacketReceiver* receiver); // Sends a new packet to the link. void SendPacket(const uint8_t* packet, size_t packet_length); // Processes the network queues and trigger PacketReceiver::IncomingPacket for // packets ready to be delivered. void Process(); int TimeUntilNextProcess() const; // Get statistics. float PercentageLoss(); int AverageDelay(); size_t dropped_packets() { return dropped_packets_; } size_t sent_packets() { return sent_packets_; } private: scoped_ptr<CriticalSectionWrapper> lock_; PacketReceiver* packet_receiver_; std::queue<NetworkPacket*> capacity_link_; std::queue<NetworkPacket*> delay_link_; // Link configuration. Config config_; // Statistics. size_t dropped_packets_; size_t sent_packets_; int total_packet_delay_; int64_t next_process_time_; DISALLOW_COPY_AND_ASSIGN(FakeNetworkPipe); }; } // namespace webrtc #endif // WEBRTC_TEST_FAKE_NETWORK_PIPE_H_
/* libpstat: a library for getting information about running processes Copyright (C) 2014 Jude Nelson This program is dual-licensed: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 or later as published by the Free Software Foundation. For the terms of this license, see LICENSE.LGPLv3+ or <http://www.gnu.org/licenses/>. You are free to use this program under the terms of the GNU Lesser General Public License, 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. Alternatively, you are free to use this program under the terms of the Internet Software Consortium License, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For the terms of this license, see LICENSE.ISC or <http://www.isc.org/downloads/software-support-policy/isc-license/>. */ #include "linux.h" // Linux-specific implementation #ifdef _LINUX uint64_t pstat_os_supported_features() { return LIBPSTAT_RUNNING | LIBPSTAT_BINARY | LIBPSTAT_STARTTIME; } static ssize_t read_uninterrupted( int fd, char* buf, size_t len ) { ssize_t num_read = 0; while( (unsigned)num_read < len ) { ssize_t nr = read( fd, buf + num_read, len - num_read ); if( nr < 0 ) { int errsv = -errno; if( errsv == -EINTR ) { continue; } return errsv; } if( nr == 0 ) { break; } num_read += nr; } return num_read; } // stat a running process on linux // return 0 on success, which is qualified to mean "We could fill in at least one field, besides the PID" // return -errno on error (due to open(), readlink(), or fstat()) // return -EIO in particular if we could not parse /proc/[PID]/stat int pstat_os( pid_t pid, struct pstat* ps, int flags ) { int rc = 0; char path[PATH_MAX+1]; char bin_path[PATH_MAX+1]; char stat_buf[ 8192 ]; int fd = 0; ssize_t nr = 0; size_t deleted_len = strlen( " (deleted)" ); // fields in /proc/[PID]/stat. We want the starttime (which is the 22nd field) char* stat_ptr = NULL; int num_paren = 0; bool paren_found = false; int field_count = 0; uint64_t starttime = 0; memset( path, 0, PATH_MAX+1 ); memset( bin_path, 0, PATH_MAX+1 ); memset( stat_buf, 0, 8192 ); memset( ps, 0, sizeof(struct pstat) ); ps->pid = pid; sprintf( path, "/proc/%d/exe", pid ); // open the process binary, if we can fd = open( path, O_RDONLY ); if( fd < 0 ) { rc = -errno; // not running? if( rc == -ENOENT ) { ps->running = false; return 0; } // something else return rc; } // the fact that this path exists means that it's running ps->running = true; // verify that it isn't deleted nr = readlink( path, bin_path, PATH_MAX ); if( nr < 0 ) { rc = -errno; close( fd ); return rc; } // on Linux, if the bin_path ends in " (deleted)", we're guaranteed that this binary no longer exists. if( strlen( bin_path ) > strlen( " (deleted)") && strcmp( bin_path + strlen(bin_path) - deleted_len, " (deleted)" ) == 0 ) { ps->deleted = true; close( fd ); return 0; } rc = fstat( fd, &ps->bin_stat ); close( fd ); if( rc < 0 ) { rc = -errno; return rc; } ps->deleted = false; strncpy( ps->path, bin_path, PATH_MAX ); // on Linux, we can see when the process started. Fill this in from /proc/[PID]/stat sprintf( path, "/proc/%d/stat", pid ); fd = open( path, O_RDONLY ); if( fd < 0 ) { rc = -errno; // not running? if( rc == -ENOENT ) { ps->running = false; return 0; } return rc; } rc = read_uninterrupted( fd, stat_buf, 8191 ); if( rc < 0 ) { return rc; } close( fd ); rc = 0; // read ahead on stat_buf to the end of the second field (the binary path, in parentheses) stat_ptr = stat_buf; while( *stat_ptr != '\0' ) { if( *stat_ptr == '(' ) { num_paren++; paren_found = true; } else if( *stat_ptr == ')' ) { num_paren--; } if( num_paren == 0 && paren_found ) { // end of the second field stat_ptr++; break; } stat_ptr++; } // read ahead to the 22nd field field_count = 3; while( field_count < 22 ) { while( *stat_ptr == ' ' ) { stat_ptr++; } if( *stat_ptr == '\0' ) { // not found rc = -EIO; break; } field_count++; while( *stat_ptr != ' ' ) { stat_ptr++; } if( *stat_ptr == '\0' ) { // not found rc = -EIO; break; } } while( *stat_ptr == ' ' ) { stat_ptr++; } starttime = (uint64_t)strtoull( stat_ptr, NULL, 10 ); if( starttime == 0 ) { // failed to parse rc = -EIO; return rc; } ps->starttime = starttime; return rc; } #endif // #define _LINUX
#include <common.h> #include <command.h> #include <asm/arch/s3c24x0_cpu.h> int do_wd (cmd_tbl_t *cmdtp, int flag, int argc,char* const argv[]) { unsigned long reset = 0; unsigned long wtcnt= 0; unsigned long wtdat= 0; unsigned long enable = 0; struct s3c24x0_interrupt * intregs = s3c24x0_get_base_interrupt(); struct s3c24x0_watchdog * dogregs = s3c24x0_get_base_watchdog(); if(argc>1) enable = simple_strtoul(argv[1], NULL, 16); if(argc>2) reset = simple_strtoul(argv[2], NULL, 16); if(argc>3) wtdat = simple_strtoul(argv[3], NULL, 16); if(argc>4) wtcnt = simple_strtoul(argv[4], NULL, 16); printf("watchdog cmd: enable = %ld, reset=%ld, wtdat=0x%lx, wtcnt=0x%lx\r\n", enable, reset ,wtdat, wtcnt); if(enable) { intregs->srcpnd |= ISR_BIT(ISR_WDT_OFT); intregs->intpnd |= ISR_BIT(ISR_WDT_OFT); intregs->subsrcpnd |= (1<<13); //subsrcpnd for wdt intregs->intmsk&=~(ISR_BIT(ISR_WDT_OFT) /*BIT_WDT*/); intregs->intsubmsk&= ~(1<<13); dogregs->wtdat = wtdat; dogregs->wtcnt = wtcnt; if(reset) dogregs->wtcon |=(1<<0); dogregs->wtcon |= 0xff00; dogregs->wtcon |=(1<<5)|(1<<2); } else { dogregs->wtcon &=~(1<<5); intregs->srcpnd |= ISR_BIT(ISR_WDT_OFT); intregs->intpnd |= ISR_BIT(ISR_WDT_OFT); intregs->subsrcpnd |= (1<<13); //subsrcpnd for wdt intregs->intmsk|=ISR_BIT(ISR_WDT_OFT); /*BIT_WDT*/ intregs->intsubmsk|= (1<<13); } return 0; } U_BOOT_CMD( wd, 5, 1, do_wd, "This wd cmd is to set wd", "wd [want reset?] [wd time] , all in hex mode\n" );
/* AUTHOR: Destan Sarpkaya - 2013 destan@dorukdestan.com http://cevirgec.sarpkaya.net LICENSE: This file is part of Çevirgeç. Çevirgeç 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. Çevirgeç 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 Çevirgeç. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ONLINESEARCHPAGE_H #define ONLINESEARCHPAGE_H #include <QWidget> #include "IPage.h" #include "model/OnlineLookupTableModel.h" namespace Ui { class OnlineSearchPage; } class OnlineSearchPage : public QWidget, private IPage { Q_OBJECT public: explicit OnlineSearchPage(QWidget *parent = 0); ~OnlineSearchPage(); private slots: void initiateGui(); void on_lineEditProxyHost_textChanged(const QString &host); void on_spinBoxProxyPort_valueChanged(QString arg1); void on_checkBoxProxy_toggled(bool checked); void updateOnlineLookupListSlot(); void on_pushButtonAddLookup_clicked(); void on_tableViewOnlineLookups_doubleClicked(const QModelIndex &index); void on_pushButtonRemoveLookup_clicked(); void storeClickedOnlineLookupIndexSlot(QModelIndex index); private: Ui::OnlineSearchPage *ui; OnlineLookupTableModel *pOnlineLookupTableModel; int onlineLookupTableIndex; }; #endif // ONLINESEARCHPAGE_H
#pragma once void init_states(); void notify_settings_changed();
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GITSUBMITEDITOR_H #define GITSUBMITEDITOR_H #include <vcsbase/vcsbasesubmiteditor.h> #include <QStringList> namespace VcsBase { class SubmitFileModel; } namespace Git { namespace Internal { class GitSubmitEditorWidget; class CommitData; struct GitSubmitEditorPanelData; class GitSubmitEditor : public VcsBase::VcsBaseSubmitEditor { Q_OBJECT public: explicit GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent); void setCommitData(const CommitData &); GitSubmitEditorPanelData panelData() const; signals: void diff(const QStringList &unstagedFiles, const QStringList &stagedFiles); protected: QByteArray fileContents() const; private slots: void slotDiffSelected(const QStringList &); private: inline GitSubmitEditorWidget *submitEditorWidget(); VcsBase::SubmitFileModel *m_model; QString m_commitEncoding; }; } // namespace Internal } // namespace Git #endif // GITSUBMITEDITOR_H
// Copyright 2011 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ #define V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ #include "src/handles.h" #include "src/parsing/scanner.h" #include "src/vector.h" namespace v8 { namespace internal { // Forward declarations. class ExternalTwoByteString; class ExternalOneByteString; // A buffered character stream based on a random access character // source (ReadBlock can be called with pos_ pointing to any position, // even positions before the current). class BufferedUtf16CharacterStream: public Utf16CharacterStream { public: BufferedUtf16CharacterStream(); ~BufferedUtf16CharacterStream() override; void PushBack(uc32 character) override; protected: static const size_t kBufferSize = 512; static const size_t kPushBackStepSize = 16; size_t SlowSeekForward(size_t delta) override; bool ReadBlock() override; virtual void SlowPushBack(uc16 character); virtual size_t BufferSeekForward(size_t delta) = 0; virtual size_t FillBuffer(size_t position) = 0; const uc16* pushback_limit_; uc16 buffer_[kBufferSize]; }; // Generic string stream. class GenericStringUtf16CharacterStream: public BufferedUtf16CharacterStream { public: GenericStringUtf16CharacterStream(Handle<String> data, size_t start_position, size_t end_position); ~GenericStringUtf16CharacterStream() override; bool SetBookmark() override; void ResetToBookmark() override; protected: static const size_t kNoBookmark = -1; size_t BufferSeekForward(size_t delta) override; size_t FillBuffer(size_t position) override; Handle<String> string_; size_t length_; size_t bookmark_; }; // ExternalStreamingStream is a wrapper around an ExternalSourceStream (see // include/v8.h) subclass implemented by the embedder. class ExternalStreamingStream : public BufferedUtf16CharacterStream { public: ExternalStreamingStream(ScriptCompiler::ExternalSourceStream* source_stream, v8::ScriptCompiler::StreamedSource::Encoding encoding) : source_stream_(source_stream), encoding_(encoding), current_data_(NULL), current_data_offset_(0), current_data_length_(0), utf8_split_char_buffer_length_(0), bookmark_(0), bookmark_data_is_from_current_data_(false), bookmark_data_offset_(0), bookmark_utf8_split_char_buffer_length_(0) {} ~ExternalStreamingStream() override { delete[] current_data_; bookmark_buffer_.Dispose(); bookmark_data_.Dispose(); } size_t BufferSeekForward(size_t delta) override { // We never need to seek forward when streaming scripts. We only seek // forward when we want to parse a function whose location we already know, // and when streaming, we don't know the locations of anything we haven't // seen yet. UNREACHABLE(); return 0; } size_t FillBuffer(size_t position) override; bool SetBookmark() override; void ResetToBookmark() override; private: void HandleUtf8SplitCharacters(size_t* data_in_buffer); void FlushCurrent(); ScriptCompiler::ExternalSourceStream* source_stream_; v8::ScriptCompiler::StreamedSource::Encoding encoding_; const uint8_t* current_data_; size_t current_data_offset_; size_t current_data_length_; // For converting UTF-8 characters which are split across two data chunks. uint8_t utf8_split_char_buffer_[4]; size_t utf8_split_char_buffer_length_; // Bookmark support. See comments in ExternalStreamingStream::SetBookmark // for additional details. size_t bookmark_; Vector<uint16_t> bookmark_buffer_; Vector<uint8_t> bookmark_data_; bool bookmark_data_is_from_current_data_; size_t bookmark_data_offset_; uint8_t bookmark_utf8_split_char_buffer_[4]; size_t bookmark_utf8_split_char_buffer_length_; }; // UTF16 buffer to read characters from an external string. class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { public: ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, int start_position, int end_position); ~ExternalTwoByteStringUtf16CharacterStream() override; void PushBack(uc32 character) override { DCHECK(buffer_cursor_ > raw_data_); pos_--; if (character != kEndOfInput) { buffer_cursor_--; } } bool SetBookmark() override; void ResetToBookmark() override; private: size_t SlowSeekForward(size_t delta) override { // Fast case always handles seeking. return 0; } bool ReadBlock() override { // Entire string is read at start. return false; } const uc16* raw_data_; // Pointer to the actual array of characters. static const size_t kNoBookmark = -1; size_t bookmark_; }; // UTF16 buffer to read characters from an external latin1 string. class ExternalOneByteStringUtf16CharacterStream : public BufferedUtf16CharacterStream { public: ExternalOneByteStringUtf16CharacterStream(Handle<ExternalOneByteString> data, int start_position, int end_position); ~ExternalOneByteStringUtf16CharacterStream() override; // For testing: explicit ExternalOneByteStringUtf16CharacterStream(const char* data); ExternalOneByteStringUtf16CharacterStream(const char* data, size_t length); bool SetBookmark() override; void ResetToBookmark() override; private: static const size_t kNoBookmark = -1; size_t BufferSeekForward(size_t delta) override; size_t FillBuffer(size_t position) override; const uint8_t* raw_data_; // Pointer to the actual array of characters. size_t length_; size_t bookmark_; }; } // namespace internal } // namespace v8 #endif // V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
#ifndef PRODUCT_H #define PRODUCT_H #include <QString> #include "lazywarehouse-data_global.h" class LAZYWAREHOUSEDATASHARED_EXPORT Product { public: explicit Product(const QString& name = ""); int id() const; void setId(int id); QString productCode() const; void setProductCode(const QString& productCode); QString name() const; void setName(const QString& name); double buyPrice() const; void setBuyPrice(double buyPrice); double sellPrice() const; void setSellPrice(double sellPrice); private: int mId; QString mProductCode; QString mName; double mBuyPrice; double mSellPrice; }; #endif // PRODUCT_H
#include <touch.h> #include <assert.h> #include <libopencm3/stm32/i2c.h> #include <i2c.h> #include <lcd.h> #define FT6206_ADDRESS 0x70 #define FT6206_THRESHOLD 128 #define FT6206_VENDOR_ID 17 #define FT6206_CIPHER 6 #define FT6206_REG_P1_XH 0x03 #define FT6206_REG_P1_XL 0x04 #define FT6206_REG_P1_YH 0x05 #define FT6206_REG_P1_YL 0x06 #define FT6206_REG_P2_XH 0x09 #define FT6206_REG_P2_XL 0x0A #define FT6206_REG_P2_YH 0x0B #define FT6206_REG_P2_YL 0x0C #define FT6206_REG_TD_STATUS 0x02 #define FT6206_REG_TH_GROUP 0x80 #define FT6206_REG_CIPHER 0xA3 #define FT6206_REG_FOCALTECH_ID 0xA8 static const i2c_channel ft6206_channel = { .i_base_address = I2C1, .i_is_master = true, .i_stop = true, .i_address = FT6206_ADDRESS, }; static uint8_t ft6206_read_register(uint8_t reg) { const uint8_t out[1] = { reg }; uint8_t in[1] = { 0xFF }; i2c_transmit(&ft6206_channel, out, 1); i2c_receive(&ft6206_channel, in, 1); return in[0]; } static void ft6206_write_register(uint8_t reg, uint8_t value) { const uint8_t out[2] = { reg, value }; i2c_transmit(&ft6206_channel, out, 2); } void touch_init(void) { static const i2c_config config = { .i_base_address = I2C1, .i_own_address = 32, .i_pins = { { // SCL: pin PB6, AF4 .gp_port = GPIOB, .gp_pin = GPIO6, .gp_mode = GPIO_MODE_AF, .gp_pupd = GPIO_PUPD_NONE, .gp_af = GPIO_AF4, .gp_ospeed = GPIO_OSPEED_50MHZ, .gp_otype = GPIO_OTYPE_OD, .gp_level = 1, }, { // SDA: pin PB7, AF4 .gp_port = GPIOB, .gp_pin = GPIO7, .gp_mode = GPIO_MODE_AF, .gp_pupd = GPIO_PUPD_NONE, .gp_af = GPIO_AF4, .gp_ospeed = GPIO_OSPEED_50MHZ, .gp_otype = GPIO_OTYPE_OD, .gp_level = 1, }, }, }; init_i2c(&config); uint8_t vendor_id = ft6206_read_register(FT6206_REG_FOCALTECH_ID); assert(vendor_id == FT6206_VENDOR_ID); uint8_t cipher = ft6206_read_register(FT6206_REG_CIPHER); assert(cipher == FT6206_CIPHER); ft6206_write_register(FT6206_REG_TH_GROUP, FT6206_THRESHOLD); } size_t touch_count(void) { // XXX Until we've touched it once, this returns 0xFF. uint8_t n = ft6206_read_register(FT6206_REG_TD_STATUS) & 0x0F; if (n > 2) n = 0; return n; } gfx_ipoint touch_point(size_t index) { uint8_t first_reg; switch (index) { case 0: first_reg = FT6206_REG_P1_XH; break; case 1: first_reg = FT6206_REG_P2_XH; break; default: assert(false); } const uint8_t out[2] = { first_reg, 4 }; uint8_t in[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; i2c_transmit(&ft6206_channel, out, 2); i2c_receive(&ft6206_channel, in, 4); int raw_x = (in[0] << 8 & 0x0F00) | in[1]; int raw_y = (in[2] << 8 & 0x0F00) | in[3]; return (gfx_ipoint) { .x = LCD_WIDTH - raw_x - 1, .y = LCD_HEIGHT - raw_y - 1, }; }
/* * repack : (re)pack floats/symbols/pointers to fixed-length packages * * (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem) * * 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/>. */ #include "zexy.h" #include <string.h> /* -------------------- repack ------------------------------ */ /* (re)pack a sequence of (packages of) atoms into a package of given length "bang" gives out the current package immediately the second inlet lets you change the default package size */ static t_class *repack_class; typedef struct _repack { t_object x_obj; t_atom *buffer; int bufsize; int outputsize; int current; } t_repack; static void repack_set(t_repack *x, t_float f) { /* set the new default size */ int n = f; if (n > 0) { /* flush all the newsized packages that are in the buffer */ t_atom *dumbuf = x->buffer; int dumcur = x->current; while (n <= dumcur) { outlet_list(x->x_obj.ob_outlet, gensym("list"), n, dumbuf); dumcur -= n; dumbuf += n; } if (dumcur < 0) error("this should never happen :: dumcur = %d < 0", dumcur); else { memcpy(x->buffer, dumbuf, dumcur * sizeof(t_atom)); x->current = dumcur; } if (n > x->bufsize) { dumbuf = (t_atom *)getbytes(n * sizeof(t_atom)); memcpy(dumbuf, x->buffer, x->current * sizeof(t_atom)); freebytes(x->buffer, x->bufsize * sizeof(t_atom)); x->buffer = dumbuf; x->bufsize = n; } x->outputsize = n; } } static void repack_bang(t_repack *x) { /* output the list as far as we are now */ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->current, x->buffer); x->current = 0; } static void repack_float(t_repack *x, t_float f) { /* add a float-atom to the list */ SETFLOAT(&x->buffer[x->current], f); x->current++; if (x->current >= x->outputsize) repack_bang(x); } static void repack_symbol(t_repack *x, t_symbol *s) { /* add a sym-atom to the list */ SETSYMBOL(&x->buffer[x->current], s); x->current++; if (x->current >= x->outputsize) repack_bang(x); } static void repack_pointer(t_repack *x, t_gpointer *p) { /* add a pointer-atom to the list */ SETPOINTER(&x->buffer[x->current], p); x->current++; if (x->current >= x->outputsize) repack_bang(x); } static void repack_list(t_repack *x, t_symbol *s, int argc, t_atom *argv) { int remain = x->outputsize - x->current; t_atom *ap = argv; ZEXY_USEVAR(s); if (argc >= remain) { memcpy(x->buffer+x->current, ap, remain * sizeof(t_atom)); ap += remain; argc -= remain; outlet_list(x->x_obj.ob_outlet, gensym("list"), x->outputsize, x->buffer); x->current = 0; } while (argc >= x->outputsize) { outlet_list(x->x_obj.ob_outlet, gensym("list"), x->outputsize, ap); ap += x->outputsize; argc -= x->outputsize; } memcpy(x->buffer + x->current, ap, argc * sizeof(t_atom)); x->current += argc; } static void repack_anything(t_repack *x, t_symbol *s, int argc, t_atom *argv) { SETSYMBOL(&x->buffer[x->current], s); x->current++; if (x->current >= x->outputsize) { repack_bang(x); } repack_list(x, gensym("list"), argc, argv); } static void *repack_new(t_floatarg f) { t_repack *x = (t_repack *)pd_new(repack_class); x->outputsize = x->bufsize = (f>0.f)?f:2 ; x->current = 0; x->buffer = (t_atom *)getbytes(x->bufsize * sizeof(t_atom)); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("")); outlet_new(&x->x_obj, 0); return (x); } void repack_setup(void) { repack_class = class_new(gensym("repack"), (t_newmethod)repack_new, 0, sizeof(t_repack), 0, A_DEFFLOAT, 0); class_addbang (repack_class, repack_bang); class_addfloat (repack_class, repack_float); class_addsymbol (repack_class, repack_symbol); class_addpointer (repack_class, repack_pointer); class_addlist (repack_class, repack_list); class_addanything(repack_class, repack_anything); class_addmethod (repack_class, (t_method)repack_set, gensym(""), A_DEFFLOAT, 0); zexy_register("repack"); }
#pragma once #include <map> #include <string> #include <vector> using namespace std; class CAntigenicity { public: CAntigenicity(const string& seq, size_t windowsize); ~CAntigenicity(); bool CalculateAntigenicity(vector<float>& array); protected: string sequence; int start; int end; size_t m_nWindowsize; short m_nPercent = 0; void Initialise(); int GetIndex(char residue); float GetAntigenicityValue(int index); float CalculateAntigenicityAtWindow(int windowstart); };
#ifndef SCORE_BOARD_H #define SCORE_BOARD_H #include <QObject> #include <iostream> #define LOVE 0 #define FIFT 15 #define THIR 30 #define FORT 40 class Match: public QObject { Q_OBJECT public: Match(); Match(short lenght, bool ad_play); Match(const Match & passin); Match & operator=(const Match & passin); ~Match(); Q_INVOKABLE void clear_Score_Board(); //point win or loss Q_INVOKABLE void p1_won(); Q_INVOKABLE void p1_loss(); //check win Q_INVOKABLE bool end_of_match(); //check duece Q_INVOKABLE bool check_duece(); //getter for match size Q_INVOKABLE short get_match_size(); //getter for AD Q_INVOKABLE bool get_play_ad(); //getters for ad flags Q_INVOKABLE bool get_p1_ad(); Q_INVOKABLE bool get_p2_ad(); //getters for all the score elements Q_INVOKABLE QString get_p1_points(); Q_INVOKABLE QString get_p2_points(); Q_INVOKABLE short get_p1_games(); Q_INVOKABLE short get_p2_games(); Q_INVOKABLE short get_p1_set(); Q_INVOKABLE short get_p2_set(); Q_INVOKABLE void set_play_ad(bool play); Q_INVOKABLE void set_length(short length); Q_INVOKABLE QString get_game_score(); Q_INVOKABLE QString get_set_score(); private: // point flags bool duece; bool p1AD; bool p2AD; //player point scores short P1PS; short P2PS; //player game scores short P1GS; short P2GS; //player set scores short P1SS; short P2SS; //match size short match_size; //AD flag bool play_AD; }; #endif // SCORE_BOARD_H
/* MyFlightbook for iOS - provides native access to MyFlightbook pilot's logbook Copyright (C) 2011-2018 MyFlightbook, LLC 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/>. */ // // VisitedAirports.h // MFBSample // // Created by Eric Berman on 8/2/11. // Copyright 2011-2017 MyFlightbook LLC. All rights reserved. // #import <UIKit/UIKit.h> #import "MFBAppDelegate.h" #import "VADetails.h" #import "PullRefreshTableViewController.h" @interface VisitedAirports : PullRefreshTableViewController <MFBSoapCallDelegate, UISearchBarDelegate> { } @property (nonatomic, strong) IBOutlet UISearchBar * searchBar; - (IBAction) updateVisitedAirports; @end
/* utils.h --- Functions and macros to use across of the project (Header) */ /* Copyright (C) 2011 David Vázquez Púa */ /* This file is part of Connection. * * Connection 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. * * Connection 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 Connection. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UTILS_H #define UTILS_H #include <stdlib.h> #include <stdarg.h> #include <locale.h> #include <libintl.h> #ifndef TRUE # define TRUE 1 #endif #ifndef FALSE # define FALSE 0 #endif typedef int boolean; /* I18N */ #define _(str) gettext(str) #define N_(str) ngettext(str) /* The following macros are given by command-line at compile-time. You can use autoconf & automake to customize the values. */ /* #undef LOCALEDIR */ /* #undef PKGDATADIR */ #endif /* UTILS_H */ /* utils.h ends here */
/* Copyright 2015-2020 Clément Gallet <clement.gallet@ens-lyon.org> This file is part of libTAS. libTAS 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. libTAS 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 libTAS. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LIBTAS_XKEYBOARD_H_INCL #define LIBTAS_XKEYBOARD_H_INCL #include "../global.h" #include <X11/X.h> #include <X11/Xlib.h> namespace libtas { OVERRIDE int XQueryKeymap( Display*, char [32]); OVERRIDE int XGrabKey( Display* /* display */, int /* keycode */, unsigned int /* modifiers */, Window /* grab_window */, Bool /* owner_events */, int /* pointer_mode */, int /* keyboard_mode */ ); OVERRIDE int XGrabKeyboard( Display* /* display */, Window /* grab_window */, Bool /* owner_events */, int /* pointer_mode */, int /* keyboard_mode */, Time /* time */ ); OVERRIDE int XUngrabKey( Display* /* display */, int /* keycode */, unsigned int /* modifiers */, Window /* grab_window */ ); OVERRIDE int XUngrabKeyboard( Display* /* display */, Time /* time */ ); OVERRIDE int XGetInputFocus( Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */ ); OVERRIDE int XSetInputFocus( Display* /* display */, Window /* focus */, int /* revert_to */, Time /* time */ ); } #endif
#ifndef PNTSH #define PNTSH 1 #ifdef __cplusplus extern "C" { #endif typedef double Coord; typedef Coord* point; extern int pdim; /* point dimension */ #ifdef __cplusplus } #endif #endif
/* @(#) $Id: ZDateTime.h,v 1.11 2006/04/10 20:44:19 agreen Exp $ */ /* ------------------------------------------------------------ Copyright (c) 2000 Andrew Green and Learning in Motion, Inc. http://www.zoolib.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) 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 __ZDateTime__ #define __ZDateTime__ 1 #include "zconfig.h" #include "ZTime.h" #include <ctime> #include <string> #include "ZCompat_operator_bool.h" // ================================================================================================= #pragma mark - #pragma mark * ZDateTimeDelta class ZDateTime; class ZDateTimeDelta { public: ZDateTimeDelta(); ZDateTimeDelta(const ZDateTimeDelta& other); ZDateTimeDelta(int theDelta); ZDateTimeDelta& operator=(const ZDateTimeDelta& other); bool operator==(const ZDateTimeDelta& other) const { return fDelta == other.fDelta; } bool operator<(const ZDateTimeDelta& other) const { return fDelta < other.fDelta; } bool operator<=(const ZDateTimeDelta& other) const { return !(other < *this); } bool operator>(const ZDateTimeDelta& other) const { return other < *this; } bool operator>=(const ZDateTimeDelta& other) const { return !(*this < other); } bool operator!=(const ZDateTimeDelta& other) const { return ! (*this == other); } ZDateTimeDelta operator*(int inScalar) const; ZDateTimeDelta& operator*=(int inScalar); ZDateTimeDelta operator/(int inScalar) const; ZDateTimeDelta& operator/=(int inScalar); ZDateTimeDelta operator+(const ZDateTimeDelta& other) const; ZDateTimeDelta& operator+=(const ZDateTimeDelta& other); ZDateTimeDelta operator-(const ZDateTimeDelta& other) const; ZDateTimeDelta& operator-=(const ZDateTimeDelta& other); ZDateTimeDelta Absolute() const; std::string AsString() const; int AsSeconds() const { return fDelta; } private: int fDelta; friend class ZDateTime; }; // ================================================================================================= #pragma mark - #pragma mark * ZDateTime class ZStreamR; class ZStreamW; class ZDateTime { ZOOLIB_DEFINE_OPERATOR_BOOL_TYPES(ZDateTime, operator_bool_generator_type, operator_bool_type); public: ZDateTime(); ZDateTime(const ZDateTime& other); ZDateTime(time_t iTime_t); ZDateTime(const ZTime& iTime); ZDateTime& operator=(const ZDateTime& other); long AsLong() const { return fTime_t; } ZTime AsTime() const; std::string AsStringUTC(const std::string& inFormat) const; std::string AsStringLocal(const std::string& inFormat) const; void FromStream(const ZStreamR& inStream); void ToStream(const ZStreamW& inStream) const; operator operator_bool_type() const { return operator_bool_generator_type::translate(fTime_t); } bool operator<(const ZDateTime& other) const { return fTime_t < other.fTime_t; } bool operator==(const ZDateTime& other) const { return fTime_t == other.fTime_t; } bool operator<=(const ZDateTime& other) const { return !(other < *this); } bool operator>(const ZDateTime& other) const { return other < *this; } bool operator>=(const ZDateTime& other) const { return !(*this < other); } bool operator!=(const ZDateTime& other) const { return ! (*this == other); } ZDateTime operator+(const ZDateTimeDelta& inDateTimeDelta) const; ZDateTime& operator+=(const ZDateTimeDelta& inDateTimeDelta); ZDateTimeDelta operator-(const ZDateTime& other) const; ZDateTime operator-(const ZDateTimeDelta& inDateTimeDelta) const; ZDateTime& operator-=(const ZDateTimeDelta& inDateTimeDelta); ZDateTime AsUTC() const; ZDateTime AsLocal() const; int GetYear() const; int GetMonth() const; int GetDayOfMonth() const; void SetYear(int inYear); void SetMonth(int inMonth); void SetDayOfMonth(int inDayOfMonth); int GetHours() const; int GetMinutes() const; int GetSeconds() const; void SetHours(int inHours); void SetMinutes(int inMinutes); void SetSeconds(int inSeconds); int GetDayOfYear() const; void SetDayOfYear(int inDayOfYear); int GetDayOfWeek() const; static ZDateTime sNowUTC(); static ZDateTimeDelta sUTCToLocalDelta(); static ZDateTime sZero; protected: time_t fTime_t; friend class ZDateTimeDelta; }; #endif // __ZDateTime__
/* 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[3]; atomic_int atom_0_r3_0; atomic_int atom_1_r3_1; atomic_int atom_1_r7_0; void *t0(void *arg){ label_1:; atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); int v2_r3 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v17 = (v2_r3 == 0); atomic_store_explicit(&atom_0_r3_0, v17, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; atomic_store_explicit(&vars[1], 1, memory_order_seq_cst); int v4_r3 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v5_r4 = v4_r3 ^ v4_r3; int v8_r5 = atomic_load_explicit(&vars[2+v5_r4], memory_order_seq_cst); int v9_cmpeq = (v8_r5 == v8_r5); if (v9_cmpeq) goto lbl_LC00; else goto lbl_LC00; lbl_LC00:; int v11_r7 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v18 = (v4_r3 == 1); atomic_store_explicit(&atom_1_r3_1, v18, memory_order_seq_cst); int v19 = (v11_r7 == 0); atomic_store_explicit(&atom_1_r7_0, v19, 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[2], 0); atomic_init(&vars[1], 0); atomic_init(&atom_0_r3_0, 0); atomic_init(&atom_1_r3_1, 0); atomic_init(&atom_1_r7_0, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v12 = atomic_load_explicit(&atom_0_r3_0, memory_order_seq_cst); int v13 = atomic_load_explicit(&atom_1_r3_1, memory_order_seq_cst); int v14 = atomic_load_explicit(&atom_1_r7_0, memory_order_seq_cst); int v15_conj = v13 & v14; int v16_conj = v12 & v15_conj; if (v16_conj == 1) assert(0); return 0; }
#ifndef DSWF_H #define DSWF_H #include <eigen/Eigen> #include <Eigen/Dense> #include <math.h> #include <iostream> #include <QDebug> const double PI = 3.1415926; using namespace Eigen; using namespace std; class DSWF { public: DSWF(double elevationAngle, VectorXd azimuthAngle, int losNum,int heightNum, MatrixXd losVelocity); double *getHVelocity(); double *getHAngle(); double *getVVelocity(); private: MatrixXd vectorVelocity; int heightNum; double *HVelocity = NULL; double *HAngle = NULL; double *VVelocity = NULL; }; #endif // DSWF_H
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a, b; a = atoi(argv[1]); b = atoi(argv[2]); printf("%d\n", a + b); return 0; }
/************************************************************************** * Meerkat Browser: Web browser controlled by the user, not vice-versa. * Copyright (C) 2013 - 2016 Michal Dutkiewicz aka Emdek <michal@emdek.pl> * Copyright (C) 2014 Jan Bajer aka bajasoft <jbajer@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * **************************************************************************/ #ifndef MEERKAT_SEARCHWIDGET_H #define MEERKAT_SEARCHWIDGET_H #include "../../../core/WindowsManager.h" #include "../../../ui/ComboBoxWidget.h" #include <QtCore/QTime> #include <QtWidgets/QCompleter> #include <QtWidgets/QItemDelegate> namespace Meerkat { class LineEditWidget; class SearchSuggester; class Window; class SearchDelegate : public QItemDelegate { public: explicit SearchDelegate(QObject *parent = nullptr); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; }; class SearchWidget : public ComboBoxWidget { Q_OBJECT public: explicit SearchWidget(Window *window, QWidget *parent = nullptr); void hidePopup(); QString getCurrentSearchEngine() const; QVariantMap getOptions() const; public slots: void activate(Qt::FocusReason reason); void setWindow(Window *window = nullptr); void setSearchEngine(const QString &searchEngine = QString()); void setOptions(const QVariantMap &options); protected: void changeEvent(QEvent *event); void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *event); void focusInEvent(QFocusEvent *event); void keyPressEvent(QKeyEvent *event); void contextMenuEvent(QContextMenuEvent *event); void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void wheelEvent(QWheelEvent *event); void updateGeometries(); protected slots: void optionChanged(int identifier, const QVariant &value); void currentIndexChanged(int index); void queryChanged(const QString &query); void sendRequest(const QString &query = QString()); void pasteAndGo(); void storeCurrentSearchEngine(); void restoreCurrentSearchEngine(); private: QPointer<Window> m_window; LineEditWidget *m_lineEdit; QCompleter *m_completer; SearchSuggester *m_suggester; QString m_query; QString m_storedSearchEngine; QTime m_popupHideTime; QRect m_iconRectangle; QRect m_dropdownArrowRectangle; QRect m_lineEditRectangle; QRect m_searchButtonRectangle; QVariantMap m_options; int m_lastValidIndex; bool m_isIgnoringActivation; bool m_isPopupUpdated; bool m_isSearchEngineLocked; bool m_wasPopupVisible; signals: void searchEngineChanged(const QString &searchEngine); void requestedOpenUrl(const QUrl &url, WindowsManager::OpenHints hints); void requestedSearch(const QString &query, const QString &searchEngine, WindowsManager::OpenHints hints); }; } #endif
#ifndef MUSICMESSAGEABOUTDIALOG_H #define MUSICMESSAGEABOUTDIALOG_H /*************************************************************************** * This file is part of the TTK Music Player project * Copyright (C) 2015 - 2022 Greedysky Studio * 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 "musicabstractmovedialog.h" class MusicDownloadCounterPVRequest; namespace Ui { class MusicMessageAboutDialog; } /*! @brief The class of the about application info dialog. * @author Greedysky <greedysky@163.com> */ class TTK_MODULE_EXPORT MusicMessageAboutDialog : public MusicAbstractMoveDialog { Q_OBJECT TTK_DECLARE_MODULE(MusicMessageAboutDialog) public: /*! * Object contsructor. */ explicit MusicMessageAboutDialog(QWidget *parent = nullptr); ~MusicMessageAboutDialog(); public Q_SLOTS: /*! * Get counter pv finished. */ void musicGetCounterFinished(const QString &bytes); /*! * Override exec function. */ virtual int exec(); protected: Ui::MusicMessageAboutDialog *m_ui; MusicDownloadCounterPVRequest *m_downloadRequest; }; #endif // MUSICMESSAGEABOUTDIALOG_H
#ifndef STALLFEEDING_H #define STALLFEEDING_H #include <QWidget> #include "moduleclasses.h" #include <qsqlquery.h> #include <QSqlError> #include "flickcharm.h" namespace Ui { class stallfeeding; } class stallfeeding : public QWidget { Q_OBJECT public: explicit stallfeeding(QWidget *parent = 0, QSqlDatabase db = QSqlDatabase(), QString systemID = "NONE"); ~stallfeeding(); void constructCustomDelegator(); private: Ui::stallfeeding *ui; fieldInColModel *m_feedGroupsModel; feedingTableModel *m_feedingModel; QList <TmoduleFieldDef> m_keys; QSqlDatabase database; QString currentSystem; void setParentStatus(bool status); int numseasons; QAction *showYieldAct; QString yieldTable; int yieldPeriod; QList<TmoduleFieldDef> subModuleKeyFields; FlickCharm charmUnits; FlickCharm charmProds; void loadAndroidEffects(); private slots: void loadOtherProducts(); void productsDataChanged(); void loadChildData(QModelIndex index); void setChildStatus(bool status); void applyProducts(); void cancelProducts(); void requestPopUpMenu(QPoint pos,QModelIndex index); void loadYield(); void on_cmddetails_clicked(); }; #endif // STALLFEEDING_H
#ifndef _USCHEDULE_H__ #define _USCHEDULE_H__ #include <unistd.h> #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> #include <assert.h> #include <deque> class uruntime; class utimermgr; class utcpsocket; class utimer; class uudpsocket; enum { en_socket_refused = -1, en_socket_timeout = -300, en_socket_normal_closed = -301, }; enum { en_epoll_timeout = 0, en_epoll_error = -1, en_epoll_close = -2, }; class utask { public: virtual ~utask(void) {} virtual void run() = 0; static void thread(void * args); }; class ulock { public: virtual ~ulock() {} virtual void lock() = 0; virtual void unlock() = 0; }; class uschedule { private: class utunnel : public utask { public: utunnel(uschedule & schedule); virtual ~utunnel(); virtual void run(); void emit(); void shutdown(); private: uschedule & schedule_; int tunnel_[2]; bool running_; }; class default_lock : public ulock { public: virtual ~default_lock() {} virtual void lock() {} virtual void unlock() {} }; public: uschedule(size_t stacksize, int maxtask, bool protect_stack = true, ulock * lock = NULL); ~uschedule(); void add_task(utask * task); bool run(); void stop(); void wake(); void sleep(int ms); public: int poll(utcpsocket * socket, int events, int timeo); int accept(utcpsocket* socket, struct sockaddr* addr, socklen_t* addrlen, int timeo); int connect(utcpsocket* socket, struct sockaddr* addr, socklen_t addrlen); ssize_t read(utcpsocket * socket, void * buf, size_t len, int flags); ssize_t recv(utcpsocket * socket, void * buf, size_t len, int flags); ssize_t send(utcpsocket * socket, const void * buf, size_t len, int flags); int poll(uudpsocket * socket, int events, int timeo); #ifdef UUDP_STREAM ssize_t read(uudpsocket * socket, void * buf, size_t len, int flags); ssize_t recv(uudpsocket * socket, void * buf, size_t len, int flags); #endif void wait(utimer * timer, int waitms); private: void consume_task(); void dealwith_timeout(); void resume_all(int reason); private: uruntime * runtime_; utimermgr * timermgr_; utunnel * tunnel_; ulock * lock_; utimer * sleeper_; int epoll_fd_; int max_task_; bool running_; bool stop_; default_lock def_lock_; std::deque<utask *> task_queue_; }; #endif
/* this code is Public Domain Peter Semiletov */ #ifndef UTILS_H #define UTILS_H #include <QObject> #include <QHash> #include <QFileInfo> #include <QStringList> #include <math.h> class CFilesList: public QObject { public: QStringList list; void get (const QString &path); void iterate (QFileInfo &fi); }; class CFTypeChecker: public QObject { public: QStringList lexts; QStringList lnames; CFTypeChecker (const QString &fnames, const QString &exts); bool check (const QString &fname); }; QString hash_keyval_to_string (const QHash<QString, QString> &h); QString hash_get_val (QHash<QString, QString> &h, const QString &key, const QString &def_val); QString file_get_ext (const QString &file_name); bool file_exists (const QString &fileName); void qstring_list_print (const QStringList &l); bool qstring_save (const QString &fileName, const QString &data, const char *enc = "UTF-8"); QString qstring_load (const QString &fileName, const char *enc = "UTF-8"); QStringList read_dir_entries (const QString &path); QHash<QString, QString> hash_load (const QString &fname); QHash<QString, QString> hash_load_keyval (const QString &fname); QHash<QString, QString> stringlist_to_hash (const QStringList &l); QString hash_keyval_to_string (QHash<QString, QString> *h); bool is_image (const QString &filename); QString string_between (const QString &source, const QString &sep1, const QString &sep2); QByteArray file_load (const QString &fileName); QString change_file_ext (const QString &s, const QString &ext); //QString get_insert_image (const QString &file_name, const QString &full_path, const QString &markup_mode); inline int get_value (int total, int perc) { return static_cast <int> (total * perc / 100); } inline float get_fvalue (float total, float perc) { return (total * perc / 100); } inline double get_percent (double total, double value) { return (value / total) * 100; } inline float get_percent (float total, float value) { return (value / total) * 100; } inline bool is_dir (const QString &path) { return QFileInfo(path).isDir(); } inline QString get_file_path (const QString &fileName) { return QFileInfo (fileName).absolutePath(); } inline float float2db (float v) { if (v == 0) return 0; if (v > 0) return (float) 20 * log10 (v / 1.0); return (float) 20 * log10 (v / -1.0); } /* from * db.h * * Copyright (C) 2003,2005 Steve Harris, Nicholas Humfrey * */ static inline float db2lin( float db ) { if (db <= -90.0f) return 0.0f; else { return powf(10.0f, db * 0.05f); } } static inline float lin2db( float lin ) { if (lin == 0.0f) return -90.0f; else return (20.0f * log10f(lin)); } double input_double_value (const QString &caption, const QString &lbl, double minval, double maxval, double defval, double step); size_t round_to (size_t value, size_t to, bool inc); #endif
#ifndef PTP #define PTP #include "mainwindow.h" #include "ui_mainwindow.h" #include <QMainWindow> #include <iostream> #include <string> #include <cstring> #include <sstream> #ifndef WINDOWS #include <arpa/inet.h> //inet_addr #include <unistd.h> #include <sys/socket.h> #include <netdb.h> #endif #include <stdio.h> #include <stdlib.h> #include <errno.h> #include "RSA.h" #include "AES.h" namespace { class PeerToPeer { public: /*Functions*/ //Server Functions int StartServer(const int MAX_CLIENTS = 1, bool SendPublic = true, string SavePublic = ""); void ReceiveFile(std::string& Msg); void DropLine(std::string pBuffer); //Client Functions void SendMessage(void); void ParseInput(void); void TryConnect(bool SendPublic = true); void SendFilePt1(void); void SendFilePt2(void); int Update(); /*Vars*/ //Server Vars int Serv; //Socket holding incoming/server stuff int newSocket; //Newly accept()ed socket descriptor int addr_size; //Address size int nbytes; //Total bytes recieved bool ConnectedSrvr; std::string FileLoc; //string for saving file unsigned int FileLength; //length of the file unsigned int BytesRead; //bytes that we have received for the file uint8_t PeerIV[16]; //the initialization vector for the current message uint8_t FileIV[16]; //the IV for the current file part bool HasEphemeralPub; //Have received the public key (RSA or ECDH) bool HasStaticPub; //Have the constant public key (RSA or ECDH) private: unsigned int MaxClients; public: string SavePub; //Client Vars int Client; //Socket for sending data std::string ClntAddr; //string holding IP to connect to std::string ProxyAddr; //string holding proxy IP if enabled uint16_t ProxyPort; //Port of proxy if enabled bool ProxyRequest; //Did we send a proxy request (without response) bool ConnectedClnt; //have we connected to them yet? std::string CipherMsg; //string holding encrypted message to send uint8_t Sending; //What stage are we in sending? 0 = none, first bit set = typing file location, second bit set = sent request waiting for response //third bit set = sending file, final bit set = receiving file std::string FileToSend; //String showing the file we are sending unsigned int FilePos; //Position in the file we are sending bool SendPub; //Both Ui::MainWindow *ui; QWidget* parent; unsigned int PeerPort; unsigned int BindPort; unsigned int SentStuff; //an int to check which stage of the connection we are on bool GConnected; bool ContinueLoop; bool UseRSA; sockaddr_in socketInfo; //Encryption RSA MyRSA; AES MyAES; uint8_t SymKey[32]; uint8_t SharedKey[32]; gmp_randclass* RNG; FortunaPRNG* fprng; //Ephemeral mpz_class EphMyMod; mpz_class EphMyE; mpz_class EphMyD; mpz_class EphClientMod; mpz_class EphClientE; uint8_t EphCurveK[32], EphCurveP[32], EphCurvePPeer[32]; //Static (Signing) mpz_class StcMyMod; mpz_class StcMyE; mpz_class StcMyD; mpz_class StcClientMod; mpz_class StcClientE; uint8_t StcCurveK[32], StcCurveP[32], StcCurvePPeer[32]; //FD SET fd_set master; //Master file descriptor list fd_set read_fds; //Temp file descriptor list for select() int fdmax; //Highest socket descriptor number int* MySocks; timeval zero; int GetMaxClients() { return MaxClients; } ~PeerToPeer() { if(Serv) closesocket(Serv); if(Client) closesocket(Client); } }; } //-1 3 5 7 9 -1 1 3 5 7 -1 3 7 11 15 static bool IsIP(string& IP) // 127.0.0.1 1.2.3.4 123.456.789.012 { if(IP.length() >= 7 && IP.length() <= 15) { unsigned char Periods = 0; char PerPos[5] = {0}; //PerPos[0] is -1, three periods, then PerPos[4] points one past the string PerPos[0] = -1; for(unsigned char i = 0; i < IP.length(); i++) { if(IP[i] == '.') { Periods++; if(Periods <= 3 && i != 0 && i != IP.length()-1) PerPos[Periods] = i; else return false; } else if(IP[i] < 48 || IP[i] > 57) return false; } PerPos[4] = IP.length(); int iTemp = 0; for(int i = 0; i < 4; i++) { if((PerPos[i+1]-1) != PerPos[i]) //Check for two side by side periods { iTemp = atoi(IP.substr(PerPos[i]+1, PerPos[i+1] - (PerPos[i] + 1)).c_str()); if(iTemp > 255 || iTemp < 0) return false; } else return false; } } else return false; return true; } inline bool IsDotOnion(string& addr) { if(addr.size() > 6) return (addr.substr(addr.size() - 6, 6) == ".onion"); else return false; } static u_long Resolve(string& addr) { u_long IP; memset(&IP, 0, sizeof(u_long)); //Resolve IPv4 address from hostname struct addrinfo hints; struct addrinfo *info, *p; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; int Info; if((Info = getaddrinfo(addr.c_str(), NULL, &hints, &info)) != 0) { return IP; } p = info; while(p->ai_family != AF_INET) //Make sure address is IPv4 { p = p->ai_next; } IP = (((sockaddr_in*)p->ai_addr)->sin_addr).s_addr; freeaddrinfo(info); return IP; } #endif
/****************************************************************************** * * (C) Copyright 2007 * Panda Xiong, yaxi1984@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * History: * 2007.03.27 Panda Xiong Create * ******************************************************************************/ #ifndef __UTL_TRAN_H #define __UTL_TRAN_H #ifdef __cplusplus extern "C" { #endif #include <h/basetype.h> /****************************************************************************** Function: UTL_TRAN_I32ToAscii Description: This function converts the digits of the given value argument to a null-terminated character string and sotre the result(up to 10 bytes) in string. The radix argument specifies the base of value; it must be 10 or 16. if radix equal and value is negative, the first character of the stored string is the minus sign(-). Input: val = decimal value radix = radix 16 or 10 Output: obuf = return string Return: the length of out string Note: ******************************************************************************/ GT_UI32 UTL_TRAN_I32ToAscii( IN GT_I32 val, IN GT_UI32 radix, OUT GT_UI8 *obuf); /****************************************************************************** Function: UTL_TRAN_UI32ToAscii Description: Translate unsigned long Data type into ASCII Characters Input: val = decimal value radix = radix 16 or 10. Output: str = return string. Return: Note: ******************************************************************************/ GT_UI32 UTL_TRAN_UI32ToAscii( IN GT_UI32 val, IN int radix, OUT GT_UI8 *str); /****************************************************************************** Function: UTL_TRAN_AsciiToI32 Description: Translate ASCII Character data type into Integer; radix is 10 or 16 Input: str = Input String. radix = 16 or 10. other treat like 10 Output: Return: The Integer value Note: ******************************************************************************/ GT_I32 UTL_TRAN_AsciiToI32(IN const GT_I8 *str, IN const GT_UI32 radix); #ifdef __cplusplus } #endif #endif /* __UTL_TRAN_H */
#pragma once #include <memory> #include <vector> #include "Modules\Module.h" namespace sfall { // Singleton for managing all of Sfall modules. class ModuleManager { public: ModuleManager(); ~ModuleManager(); void initAll(); template<typename T> void add() { _modules.emplace_back(new T()); } static ModuleManager& getInstance(); private: // disallow copy constructor and copy assignment because we're dealing with unique_ptr's here ModuleManager(const ModuleManager&); void operator = (const ModuleManager&) {} std::vector<std::unique_ptr<Module>> _modules; static ModuleManager _instance; }; }
/* types.h: common multi-platform data types * * Copyright (c) 2012..2015 Sebastian Parschauer <s.parschauer@gmx.de> * * This file may be used subject to the terms and conditions of the * GNU General Public License Version 3, or any later version * at your option, 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. */ #pragma once #include <config.h> #include <limits.h> #include <stddef.h> /* size_t */ #if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H #include <unistd.h> /* pid_t, ssize_t */ #endif #ifndef __cplusplus #include <stdbool.h> /* bool */ #endif /* Common types */ typedef char i8; typedef unsigned char u8; typedef short i16; typedef unsigned short u16; typedef int i32; typedef unsigned int u32; typedef long long i64; typedef unsigned long long u64; typedef unsigned long ulong; /* uintptr_t is optional */ #if !defined(HAVE_UINTPTR_T) || !HAVE_UINTPTR_T #undef uintptr_t #if defined(_WIN64) || defined (__WIN64__) /* 64-bit Windows systems require unsigned long long */ #define uintptr_t u64 #elif ULONG_MAX == 4294967295UL #define uintptr_t u32 #else #define uintptr_t ulong #endif #else #include <stdint.h> #include <inttypes.h> #endif /* These formats are not available with default C++ on MeeGo 1.2 Harmattan. */ #if !defined(SCNxPTR) || !defined(PRIxPTR) || !defined(UINTPTR_MAX) #undef SCNxPTR #undef PRIxPTR #undef UINTPTR_MAX #if defined(_WIN64) || defined (__WIN64__) #define SCNxPTR "llx" #define PRIxPTR "llx" #define UINTPTR_MAX ULLONG_MAX #elif ULONG_MAX == 4294967295UL #define SCNxPTR "x" #define PRIxPTR "x" #define UINTPTR_MAX ULONG_MAX #else #define SCNxPTR "lx" #define PRIxPTR "lx" #define UINTPTR_MAX ULONG_MAX #endif #endif #define SCN_PTR "0x%" SCNxPTR #define PRI_PTR "0x%" PRIxPTR typedef uintptr_t ptr_t; #if defined(_WIN64) || defined (__WIN64__) #define strtoptr strtoull #else #define strtoptr strtoul #endif /* for Windows as not in limits.h */ #ifndef PIPE_BUF #define PIPE_BUF 4096 #endif #define BUF_SIZE PIPE_BUF #define UGT_PFX "[ugt] "
#ifndef UI_UI_H #include <ncurses.h> //---------------------------------------------------------------- namespace ui { class text_ui { public: text_ui(); ~text_ui(); void refresh(); }; }; //---------------------------------------------------------------- #endif
/** * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium * Copyright (C) 2017-2018 Osimis S.A., Belgium * * 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. * * In addition, as a special exception, the copyright holders of this * program give permission to link the code of its release with the * OpenSSL project's "OpenSSL" library (or with modified versions of it * that use the same license as the "OpenSSL" library), and distribute * the linked executables. You must obey the GNU General Public License * in all respects for all of the code used other than "OpenSSL". If you * modify file(s) with this exception, you may extend this exception to * your version of the file(s), but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source files * in the program, then also delete it here. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. **/ #pragma once #include "ImageAccessor.h" #include <vector> #include <stdint.h> #include <boost/noncopyable.hpp> namespace Orthanc { class ImageBuffer : public boost::noncopyable { private: bool changed_; bool forceMinimalPitch_; // Currently unused PixelFormat format_; unsigned int width_; unsigned int height_; unsigned int pitch_; void *buffer_; void Initialize(); void Allocate(); void Deallocate(); public: ImageBuffer(PixelFormat format, unsigned int width, unsigned int height, bool forceMinimalPitch); ImageBuffer() { Initialize(); } ~ImageBuffer() { Deallocate(); } PixelFormat GetFormat() const { return format_; } void SetFormat(PixelFormat format); unsigned int GetWidth() const { return width_; } void SetWidth(unsigned int width); unsigned int GetHeight() const { return height_; } void SetHeight(unsigned int height); unsigned int GetBytesPerPixel() const { return ::Orthanc::GetBytesPerPixel(format_); } ImageAccessor GetAccessor(); ImageAccessor GetConstAccessor(); bool IsMinimalPitchForced() const { return forceMinimalPitch_; } void AcquireOwnership(ImageBuffer& other); }; }
/* xoreos - A reimplementation of BioWare's Aurora engine * * xoreos is the legal property of its developers, whose names * can be found in the AUTHORS file distributed with this source * distribution. * * xoreos 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. * * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>. */ /** @file * Reading GR2 files. */ #ifndef AURORA_GR2FILE_H #define AURORA_GR2FILE_H #include <vector> #include <boost/optional.hpp> #include "external/glm/glm.hpp" #include "external/glm/detail/type_quat.hpp" #include "src/common/ustring.h" namespace Aurora { /** Class for loading GR2 files which contain skeleton and animation data. */ class GR2File { public: struct Skeleton { struct Bone { Common::UString name; int32_t parent; glm::vec3 position; glm::quat rotation; }; Common::UString name; std::vector<Bone> bones; }; GR2File(const Common::UString &resref); private: struct Relocation { uint32_t offset; uint32_t targetSection; uint32_t targetOffset; }; struct Section { std::unique_ptr<Common::SeekableReadStream> stream; std::vector<Relocation> relocations; std::stack<size_t> lastPositions; void pushPosition() { lastPositions.push(stream->pos()); } void popPosition() { stream->seek(lastPositions.top()); lastPositions.pop(); } }; void load(Common::SeekableReadStream &gr2); void loadArtToolInfo(Section &section); void loadExporterInfo(Section &section); void loadModel(Section &section); void loadSkeleton(Section &section); boost::optional<Relocation> readRelocation(Section &section); Section &getRelocatedStream(Relocation &relocation); std::vector<Section> _sections; std::vector<Skeleton> _skeletons; struct { Common::UString name; uint32_t majorVersion, minorVersion; float unitsPerMeter; glm::vec3 origin, right, up, back; } _artToolInfo; struct { Common::UString name; uint32_t majorVersion, minorVersion, customization, buildNumber; } _exporterInfo; Common::UString _filename; }; } // End of namespace Aurora #endif // AURORA_GR2FILE_H
#pragma once /* * Copyright 2010-2016 OpenXcom Developers. * * This file is part of OpenXcom. * * OpenXcom is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenXcom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>. */ #include "../Engine/State.h" #include "../Menu/OptionsBaseState.h" #include <vector> #include <string> namespace OpenXcom { class TextButton; class Window; class Text; class TextList; class Timer; class Base; /** * ManageAlienContainment screen that lets the player manage * alien numbers in a particular base. */ class ManageAlienContainmentState : public State { private: Base *_base; int _prisonType; OptionsOrigin _origin; TextButton *_btnOk, *_btnCancel, *_btnTransfer; Window *_window; Text *_txtTitle, *_txtUsed, *_txtAvailable, *_txtValueOfSales, *_txtItem, *_txtLiveAliens, *_txtDeadAliens, *_txtInterrogatedAliens; TextList *_lstAliens; Timer *_timerInc, *_timerDec; std::vector<int> _qtys; std::vector<std::string> _aliens; size_t _sel; int _aliensSold, _total; bool _reset; /// Gets selected quantity. int getQuantity(); public: /// Creates the ManageAlienContainment state. ManageAlienContainmentState(Base *base, int prisonType, OptionsOrigin origin); /// Cleans up the ManageAlienContainment state. ~ManageAlienContainmentState(); /// Resets state. void init(); /// Runs the timers. void think(); /// Handler for clicking the OK button. void btnOkClick(Action *action); /// Handler for clicking the Cancel button. void btnCancelClick(Action *action); /// Handler for clicking the Transfer button. void btnTransferClick(Action *action); /// Handler for pressing an Increase arrow in the list. void lstItemsLeftArrowPress(Action *action); /// Handler for releasing an Increase arrow in the list. void lstItemsLeftArrowRelease(Action *action); /// Handler for clicking an Increase arrow in the list. void lstItemsLeftArrowClick(Action *action); /// Handler for pressing a Decrease arrow in the list. void lstItemsRightArrowPress(Action *action); /// Handler for releasing a Decrease arrow in the list. void lstItemsRightArrowRelease(Action *action); /// Handler for clicking a Decrease arrow in the list. void lstItemsRightArrowClick(Action *action); /// Handler for pressing-down a mouse-button in the list. void lstItemsMousePress(Action *action); /// Increases the quantity of an alien by one. void increase(); /// Increases the quantity of an alien by the given value. void increaseByValue(int change); /// Decreases the quantity of an alien by one. void decrease(); /// Decreases the quantity of an alien by the given value. void decreaseByValue(int change); /// Updates the quantity-strings of the selected alien. void updateStrings(); }; }
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * (Shared logic for modifications) * LICENSE: See LICENSE in the top level directory * FILE: mods/shared_logic/CClientTexture.h * PURPOSE: * DEVELOPERS: idiot * *****************************************************************************/ class CClientTexture : public CClientMaterial { DECLARE_CLASS( CClientTexture, CClientMaterial ) public: CClientTexture ( CClientManager* pManager, ElementID ID, CTextureItem* pTextureItem ); eClientEntityType GetType ( void ) const { return CCLIENTTEXTURE; } // CClientTexture methods CTextureItem* GetTextureItem ( void ) { return (CTextureItem*)m_pRenderItem; } }; class CClientRenderTarget : public CClientTexture { DECLARE_CLASS( CClientRenderTarget, CClientTexture ) public: CClientRenderTarget ( CClientManager* pManager, ElementID ID, CRenderTargetItem* pRenderTargetItem ) : ClassInit ( this ), CClientTexture ( pManager, ID, pRenderTargetItem ) {} // CClientRenderTarget methods CRenderTargetItem* GetRenderTargetItem ( void ) { return (CRenderTargetItem*)m_pRenderItem; } }; class CClientScreenSource : public CClientTexture { DECLARE_CLASS( CClientScreenSource, CClientTexture ) public: CClientScreenSource ( CClientManager* pManager, ElementID ID, CScreenSourceItem* pScreenSourceItem ) : ClassInit ( this ), CClientTexture ( pManager, ID, pScreenSourceItem ) {} // CClientScreenSource methods CScreenSourceItem* GetScreenSourceItem ( void ) { return (CScreenSourceItem*)m_pRenderItem; } };
/* * Spotify.h */ #import <AppKit/AppKit.h> #import <ScriptingBridge/ScriptingBridge.h> @class SpotifyApplication, SpotifyTrack, SpotifyApplication; enum SpotifyEPlS { SpotifyEPlSStopped = 'kPSS', SpotifyEPlSPlaying = 'kPSP', SpotifyEPlSPaused = 'kPSp' }; typedef enum SpotifyEPlS SpotifyEPlS; /* * Spotify Suite */ // The Spotify application. @interface SpotifyApplication : SBApplication @property (copy, readonly) SpotifyTrack *currentTrack; // The current playing track. @property NSInteger soundVolume; // The sound output volume (0 = minimum, 100 = maximum) @property (readonly) SpotifyEPlS playerState; // Is Spotify stopped, paused, or playing? @property double playerPosition; // The player’s position within the currently playing track in seconds. @property (readonly) BOOL repeatingEnabled; // Is repeating enabled in the current playback context? @property BOOL repeating; // Is repeating on or off? @property (readonly) BOOL shufflingEnabled; // Is shuffling enabled in the current playback context? @property BOOL shuffling; // Is shuffling on or off? - (void) nextTrack; // Skip to the next track. - (void) previousTrack; // Skip to the previous track. - (void) playpause; // Toggle play/pause. - (void) pause; // Pause playback. - (void) play; // Resume playback. - (void) playTrack:(NSString *)x inContext:(NSString *)inContext; // Start playback of a track in the given context. @end // A Spotify track. @interface SpotifyTrack : SBObject @property (copy, readonly) NSString *artist; // The artist of the track. @property (copy, readonly) NSString *album; // The album of the track. @property (readonly) NSInteger discNumber; // The disc number of the track. @property (readonly) NSInteger duration; // The length of the track in seconds. @property (readonly) NSInteger playedCount; // The number of times this track has been played. @property (readonly) NSInteger trackNumber; // The index of the track in its album. @property (readonly) BOOL starred; // Is the track starred? @property (readonly) NSInteger popularity; // How popular is this track? 0-100 - (NSString *) id; // The ID of the item. @property (copy, readonly) NSString *name; // The name of the track. @property (copy, readonly) NSString *artworkUrl; // The URL of the track%apos;s album cover. @property (copy, readonly) NSImage *artwork; // The property is deprecated and will never be set. Use the 'artwork url' instead. @property (copy, readonly) NSString *albumArtist; // That album artist of the track. @property (copy) NSString *spotifyUrl; // The URL of the track. @end /* * Standard Suite */ // The application's top level scripting object. @interface SpotifyApplication (StandardSuite) @property (copy, readonly) NSString *name; // The name of the application. @property (readonly) BOOL frontmost; // Is this the frontmost (active) application? @property (copy, readonly) NSString *version; // The version of the application. @end
#ifndef IMAGEPROCESSING_H #define IMAGEPROCESSING_H #include <opencv/cv.h> using namespace cv; class ImageProcessing { public: static void salt(Mat &image, int n); static void colorReduce(Mat &image, int div = 64); static void showHIstogramm(Mat &image); static void threshold(Mat &image, Mat &result, int value); static void adaptiveThreshold(Mat &image, Mat &result, int maxValue, int oddBlockSize, int method=ADAPTIVE_THRESH_GAUSSIAN_C); static void dilate(Mat &image, Mat &result, int dilationSize); static void erode(Mat &image, Mat &result, int erosionSize); }; #endif // IMAGEPROCESSING_H
/* Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 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 BT_GEOMETRY_UTIL_H #define BT_GEOMETRY_UTIL_H #include "btVector3.h" #include "btAlignedObjectArray.h" class btGeometryUtil { public: static void getPlaneEquationsFromVertices(btAlignedObjectArray<btVector3>& vertices, btAlignedObjectArray<btVector3>& planeEquationsOut ); static void getVerticesFromPlaneEquations(const btAlignedObjectArray<btVector3>& planeEquations , btAlignedObjectArray<btVector3>& verticesOut ); static bool isInside(const btAlignedObjectArray<btVector3>& vertices, const btVector3& planeNormal, btScalar margin); static bool isPointInsidePlanes(const btAlignedObjectArray<btVector3>& planeEquations, const btVector3& point, btScalar margin); static bool areVerticesBehindPlane(const btVector3& planeNormal, const btAlignedObjectArray<btVector3>& vertices, btScalar margin); }; #endif //BT_GEOMETRY_UTIL_H
#include "cdops.h" extern void gdGdcInitSystem(); extern void gdGdcReset(); extern int gdGdcReqCmd(int command, unsigned int *parameterblock); extern int gdGdcGetCmdStat(int reqid, unsigned int *status); extern int gdGdcGetDrvStat(unsigned int *status); extern void gdGdcExecServer(); extern int gdGdcChangeDataType(unsigned int *format); extern void usleep(unsigned int usec); #define GDROM(o) (*(volatile unsigned char *)(0xa05f7000 + (o))) #define DATA (*(volatile short *) & GDROM(0x80)) #define FEATURES GDROM(0x84) #define SEC_NR GDROM(0x8c) #define CYL_LO GDROM(0x90) #define CYL_HI GDROM(0x94) #define COMMAND GDROM(0x9c) #define STATUS GDROM(0x9c) #define ALTSTATUS GDROM(0x18) void cdops_init() { register unsigned long p, x; *((volatile unsigned long *)0xa05f74e4) = 0x1fffff; for(p=0; p<0x200000/4; p++) x = ((volatile unsigned long *)0xa0000000)[p]; gdGdcInitSystem(); gdGdcReset(); } unsigned char cdops_disc_status() { return SEC_NR; } static int cdops_send_cmd(int cmd, void *param) { return gdGdcReqCmd(cmd, param); } static int cdops_check_cmd(int f) { int blah[4]; int n; gdGdcExecServer(); if((n = gdGdcGetCmdStat(f, blah))==1) return 0; if(n == 2) return 1; else return -1; } static int cdops_wait_cmd(int f) { int n; while(!(n = cdops_check_cmd(f))); return (n>0? 0 : n); } static int cdops_exec_cmd(int cmd, void *param) { int f = cdops_send_cmd(cmd, param); return cdops_wait_cmd(f); } int cdops_init_drive() { int i, r=0; unsigned int param[4]; int cdxa; for(i=0; i<8; i++) if(!(r = cdops_exec_cmd(24, 0))) break; if(r) return r; gdGdcGetDrvStat(param); cdxa = (param[1] == 32); param[0] = 0; /* set data type */ param[1] = 8192; param[2] = (cdxa? 2048 : 1024); /* mode 1/2 */ param[3] = 2048; /* sector size */ return gdGdcChangeDataType(param); } int cdops_set_audio_read_mode() { unsigned int param[4]; param[0] = 0; /* set data type */ param[1] = 4096; param[2] = 512; param[3] = 2352; return gdGdcChangeDataType(param); } int cdops_read_toc(struct TOC *toc, int session) { struct { int session; void *buffer; } param; param.session = session; param.buffer = toc; return cdops_exec_cmd(19, &param); } int cdops_read_sectors_pio(char *buf, int sec, int num) { struct { int sec, num; void *buffer; int dunno; } param; param.sec = sec; param.num = num; param.buffer = buf; param.dunno = 0; return cdops_exec_cmd(16, &param); } int cdops_read_sectors_dma(char *buf, int sec, int num) { struct { int sec, num; void *buffer; int dunno; } param; param.sec = sec; param.num = num; param.buffer = buf; param.dunno = 0; return cdops_exec_cmd(17, &param); } int cdops_play_cdda_sectors(int start, int stop, int reps) { struct { int start, stop, reps, dunno; } param; param.start = start; param.stop = stop; param.reps = reps; param.dunno = 0; return cdops_exec_cmd(21, &param); } int cdops_stop_cdda() { return cdops_exec_cmd(22, 0); } int cdops_packet(const unsigned short *packet, unsigned short size, void *buf) { register unsigned int sr = 0; int i; unsigned short tot = 0; size &= ~1; while(ALTSTATUS & 0x88) ; __asm__("stc sr,%0" : "=r" (sr)); __asm__("ldc %0,sr" : : "r" (sr|(1<<28))); CYL_LO = size & 0xff; CYL_HI = size >> 8; FEATURES = 0; COMMAND = 0xa0; while((ALTSTATUS & 0x88) != 8) ; for (i=0; i<6; i++) DATA = packet[i]; usleep(10); for(;;) { unsigned char status = STATUS; if (status & 0x80) continue; if (status & 8) { unsigned short cnt = (CYL_HI << 8) | CYL_LO; if (cnt & 1) cnt++; tot += cnt; unsigned short xfer = (cnt > size? size : cnt); for (i=0; i<xfer; i+=2) { *(unsigned short *)buf = DATA; buf = ((unsigned short *)buf) + 1; cnt -= 2; size -= 2; } while (cnt > 0) { unsigned short discard = DATA; cnt -= 2; } usleep(10); continue; } if (status & 1) { __asm__("ldc %0,sr" : : "r" (sr)); return -1; } break; } __asm__("ldc %0,sr" : : "r" (sr)); return tot; }
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" * found in "../support/s1ap-r16.1.0/36413-g10.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ #include "S1AP_ECGIListForRestart.h" #include "S1AP_EUTRAN-CGI.h" static asn_oer_constraints_t asn_OER_type_S1AP_ECGIListForRestart_constr_1 CC_NOTUSED = { { 0, 0 }, -1 /* (SIZE(1..256)) */}; static asn_per_constraints_t asn_PER_type_S1AP_ECGIListForRestart_constr_1 CC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */, 0, 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_S1AP_ECGIListForRestart_1[] = { { ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, &asn_DEF_S1AP_EUTRAN_CGI, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "" }, }; static const ber_tlv_tag_t asn_DEF_S1AP_ECGIListForRestart_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_S1AP_ECGIListForRestart_specs_1 = { sizeof(struct S1AP_ECGIListForRestart), offsetof(struct S1AP_ECGIListForRestart, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_S1AP_ECGIListForRestart = { "ECGIListForRestart", "ECGIListForRestart", &asn_OP_SEQUENCE_OF, asn_DEF_S1AP_ECGIListForRestart_tags_1, sizeof(asn_DEF_S1AP_ECGIListForRestart_tags_1) /sizeof(asn_DEF_S1AP_ECGIListForRestart_tags_1[0]), /* 1 */ asn_DEF_S1AP_ECGIListForRestart_tags_1, /* Same as above */ sizeof(asn_DEF_S1AP_ECGIListForRestart_tags_1) /sizeof(asn_DEF_S1AP_ECGIListForRestart_tags_1[0]), /* 1 */ { &asn_OER_type_S1AP_ECGIListForRestart_constr_1, &asn_PER_type_S1AP_ECGIListForRestart_constr_1, SEQUENCE_OF_constraint }, asn_MBR_S1AP_ECGIListForRestart_1, 1, /* Single element */ &asn_SPC_S1AP_ECGIListForRestart_specs_1 /* Additional specs */ };
#include "generic.h" void precheck() { /* check if a character is 8 bits wide important for socket-communication */ if (CHAR_BIT != 8) { error(__FUNCTION__ , "Your platform is not supported."); } } int error(const char *caller, const char *errormessage) { /* make sure to use the | (pipe) as the escape character */ time_t now; time(&now); /* get current time */ char timestamp[23]; char completemessage[76]; /* fixed size to fit in one line */ strftime(timestamp, sizeof timestamp, "%F %T.00", localtime(&now)); /* decisecond precision not implemented */ snprintf(completemessage, sizeof(completemessage), "%s %s: %s", timestamp, caller, errormessage); /* errormessages with too many chars will be silently truncated, which is safe here */ fprintf(stderr, "%s\n", completemessage); /*try to send the errormessage to the client via the socket */ snprintf(completemessage, sizeof(completemessage), "ER%s %s: %s", timestamp, caller, errormessage); socket_SendErrorToClient(completemessage, sizeof(completemessage)); socket_close(); exit(EXIT_FAILURE); }
/// /// nsgl_base.h /// ----------- /// Nikolai Shkurkin /// NSGL Library /// /// Synopsis: /// Represents my own version of "GLSL"/"GLSLHelper" with my own methods for /// interfacing with and getting data back from OpenGL. It also includes some /// utilitiy methods for logging. /// /// Programmers that wish to further extend operations on top of OpenGL should /// consider placing functions and objects under the namespace "nsgl". /// /// Note: "nsgl" is a sort of pun meaning "NextStep GL" and "Nikolai Shkurkin GL" /// simultaneously (a lot of ObjC classes are prefixed by NS, which happen to /// be my initials). /// #include <string> #include <sstream> #include <iostream> #include <cmath> #include <src/nsgl/gl_interface/gl.h> #include <src/util/util_base.h> #include <src/util/util_types.h> #include <src/util/data/Image.h> #ifndef __nsgl__base__ #define __nsgl__base__ /// Namespace helper methods namespace nsgl { typedef util::RGBAImage RGBAImage; /// Parses the string given by `which`. May be empty. std::string getString(GLenum which); /// Takes the enum value given by `glGetError` and turns it into a parsed /// string based on the descriptions for each error available here: /// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetError.xml std::string parseErrorEnum(GLenum errors); /// Returns a string detailing any errors that may have occured due to bad /// open gl calls. std::string getStateErrors(); } namespace nsgl { /// Returns a string detailing the Renderer, the GL Version, and any Extensions. std::string getGLInfo(); /// Represents the particular OpenGl version a computer may be running. struct GLVersionInfo { int major_version, minor_version; std::string description() { std::ostringstream strFormatter; strFormatter << major_version << "." << minor_version; return strFormatter.str(); } GLVersionInfo(int major, int minor) { major_version = major; minor_version = minor; } }; /// Returns the current OpenGL version being run in the current context. nsgl::GLVersionInfo getGLVersionInfo(); /// Fails if the current opengl version is not at least major.minor. void assertMinimumGLVersion(int major, int minor); /// Fails (crashes the program) if the current opengl version (of the form /// major.minor) is not at least `version`. void assertMinimumGLVersion(float version); /// Logs `toLog` IFF `toLog` != "". void logNonEmpty(std::string toLog, const std::string file = __FILE__, int line = __LINE__); /// Logs `toLog` with `file` and `line` to specify the caller. void log(std::string toLog, const std::string file = __FILE__, int line = __LINE__); /// Prints the result of `getStateErrors` to stdout, if any exist. void printStateErrors(const std::string file = __FILE__, int line = __LINE__); /// Fails (crashes the program) if opengl has reported any errors. void assertNoStateErrors(std::string file = __FILE__, int line = __LINE__); const int UNSET_TEX = 12345; RGBAImage screencap(int width, int height); } /// Use this to log messages with the added bonus of the "+" operator. #define NSGL_LOG(statement) nsgl::log(std::string("") + statement, __FILE__, __LINE__) /// Use this to quickly tell if/where opengl errors approximately occur. This /// will crash the program is an OpenGL error occurs. #define NSGL_ERRORS() nsgl::assertNoStateErrors(__FILE__, __LINE__) /// Use this to quickly tell yourself where you are in the code. #define NSGL_HERE() nsgl::log("here", __FILE__, __LINE__) #endif // __nsgl__base__
#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> int main() { char *fn = (char *)"temp.fifo"; char out[20] = "FIFO's are fun!"; int wfd; unlink(fn); if (mkfifo(fn, 0666) != 0) perror("mkfifo() error"); else { { if ((wfd = open(fn, O_WRONLY)) < 0) perror("open() error for write end"); else { if (write(wfd, out, strlen(out) + 1) == -1) perror("write() error"); close(wfd); } } unlink(fn); } }
/* main-grain-test.c */ /* This file is part of the ARM-Crypto-Lib. Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * grain test-suit * */ #include "main-test-common.h" #include "grain.h" #include "scal_grain.h" #include "scal-basic.h" #include "scal-nessie.h" #include "performance_test.h" char* algo_name = "Grain"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ void grain_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ uint8_t iv[8]={0}; grain_init(key, &iv, ctx); } uint8_t grain_getbyte_dummy(grain_ctx_t* ctx){ uint8_t i,ret=0; for(i=0; i<8; ++i){ ret<<=1; ret |= grain_enc(ctx); } return ret; } uint8_t grain_getbyte_dummy_rev(grain_ctx_t* ctx){ uint8_t i,ret=0; for(i=0; i<8; ++i){ ret >>= 1; ret |= grain_enc(ctx)?0x80:0x00; } return ret; } void testrun_nessie_grain(void){ scal_nessie_set_estream(1); scal_nessie_run(&grain_desc); } void testrun_std_grain(void){ grain_ctx_t ctx; uint8_t i, key[10], iv[8], out[10]; /* 1 */ memset(key, 0, 10); memset(iv, 0, 8); cli_putstr("\r\n=== std test ==="); cli_putstr("\r\n key: "); cli_hexdump(key, 10); cli_putstr("\r\n iv: "); cli_hexdump(key, 8); grain_init(key, iv, &ctx); for(i=0; i<10; ++i){ out[i] = grain_getbyte_dummy(&ctx); } cli_putstr("\r\n out: "); cli_hexdump(out, 10); /* 2 */ for(i=0; i<8; ++i){ key[i] = i*0x22+1; } key[8]=0x12; key[9]=0x34; for(i=0; i<8; ++i){ iv[i] = i*0x22+1; } cli_putstr("\r\n\r\n key: "); cli_hexdump(key, 10); cli_putstr("\r\n iv: "); cli_hexdump(key, 8); grain_init(key, iv, &ctx); for(i=0; i<10; ++i){ out[i] = grain_getbyte_dummy(&ctx); } cli_putstr("\r\n out: "); cli_hexdump(out, 10); cli_putstr("\r\n\r\n"); } void testrun_performance_grain(void){ uint64_t t; char str[16]; uint8_t key[10], iv[8]; grain_ctx_t ctx; calibrateTimer(); print_overhead(); memset(key, 0, 10); memset(iv, 0, 8); startTimer(1); grain_init(key, iv, &ctx); t = stopTimer(); cli_putstr("\r\n\tctx-gen time: "); ultoa((unsigned long)t, str, 10); cli_putstr(str); startTimer(1); grain_enc(&ctx); t = stopTimer(); cli_putstr("\r\n\tencrypt time: "); ultoa((unsigned long)t, str, 10); cli_putstr(str); cli_putstr("\r\n"); } /***************************************************************************** * main * *****************************************************************************/ const char nessie_str[] = "nessie"; const char test_str[] = "test"; const char performance_str[] = "performance"; const char echo_str[] = "echo"; cmdlist_entry_t cmdlist[] = { { nessie_str, NULL, testrun_nessie_grain }, { test_str, NULL, testrun_std_grain}, { performance_str, NULL, testrun_performance_grain}, { echo_str, (void*)1, (void_fpt)echo_ctrl}, { NULL, NULL, NULL} }; int main (void){ main_setup(); for(;;){ welcome_msg(algo_name); cmd_interface(cmdlist); } }
/********** Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: Alan Gillespie **********/ /* */ #include "ngspice.h" #include "const.h" #include "ifsim.h" #include "mos9defs.h" #include "sperror.h" #include "suffix.h" /* ARGSUSED */ int MOS9param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) { MOS9instance *here = (MOS9instance *)inst; switch(param) { case MOS9_M: here->MOS9m = value->rValue; here->MOS9mGiven = TRUE; break; case MOS9_W: here->MOS9w = value->rValue; here->MOS9wGiven = TRUE; break; case MOS9_L: here->MOS9l = value->rValue; here->MOS9lGiven = TRUE; break; case MOS9_AS: here->MOS9sourceArea = value->rValue; here->MOS9sourceAreaGiven = TRUE; break; case MOS9_AD: here->MOS9drainArea = value->rValue; here->MOS9drainAreaGiven = TRUE; break; case MOS9_PS: here->MOS9sourcePerimiter = value->rValue; here->MOS9sourcePerimiterGiven = TRUE; break; case MOS9_PD: here->MOS9drainPerimiter = value->rValue; here->MOS9drainPerimiterGiven = TRUE; break; case MOS9_NRS: here->MOS9sourceSquares = value->rValue; here->MOS9sourceSquaresGiven = TRUE; break; case MOS9_NRD: here->MOS9drainSquares = value->rValue; here->MOS9drainSquaresGiven = TRUE; break; case MOS9_OFF: here->MOS9off = value->iValue; break; case MOS9_IC_VBS: here->MOS9icVBS = value->rValue; here->MOS9icVBSGiven = TRUE; break; case MOS9_IC_VDS: here->MOS9icVDS = value->rValue; here->MOS9icVDSGiven = TRUE; break; case MOS9_IC_VGS: here->MOS9icVGS = value->rValue; here->MOS9icVGSGiven = TRUE; break; case MOS9_TEMP: here->MOS9temp = value->rValue+CONSTCtoK; here->MOS9tempGiven = TRUE; break; case MOS9_DTEMP: here->MOS9dtemp = value->rValue; here->MOS9dtempGiven = TRUE; break; case MOS9_IC: switch(value->v.numValue){ case 3: here->MOS9icVBS = *(value->v.vec.rVec+2); here->MOS9icVBSGiven = TRUE; case 2: here->MOS9icVGS = *(value->v.vec.rVec+1); here->MOS9icVGSGiven = TRUE; case 1: here->MOS9icVDS = *(value->v.vec.rVec); here->MOS9icVDSGiven = TRUE; break; default: return(E_BADPARM); } break; case MOS9_L_SENS: if(value->iValue) { here->MOS9senParmNo = 1; here->MOS9sens_l = 1; } break; case MOS9_W_SENS: if(value->iValue) { here->MOS9senParmNo = 1; here->MOS9sens_w = 1; } break; default: return(E_BADPARM); } return(OK); }
/* * Copyright 2017 The Aiethan Authors Hongjun Wang. * * You may reference to * * http://www.aiethan.com/ * * Good luck. */ #ifndef AIETHAN_PLANE_TEXTURE2D_H_ #define AIETHAN_PLANE_TEXTURE2D_H_ #include "aiethan/plain/quad_util.h" namespace aiethan { namespace plain { constexpr uint8 kD = 8; constexpr uint8 kDS = 4; class Texture2d { public: explicit Texture2d(); explicit Texture2d(uint8 grid); ~Texture2d(); Texture2d(const Texture2d&) = delete; Texture2d& operator=(const Texture2d&) = delete; std::array<double, kD> getField(void); std::array<double, kD> getEigen(void); void init(void); void reset(void); void addField(uint8 index, double value); void addPotential(double potential); void setEigen(uint8 index, double value); void setSpectrum(uint8 index, double value); double getConformal(void); uint8 getGrid(void); uint8 getFlag(void); void setFlag(uint8 flag); double getPotential(void); private: std::array<double, kD> field_; std::array<double, kD> eigen_; std::array<double, kDS> spectrum_; uint8 grid_; uint8 flag_; double potential_; }; } // namespace plain } // namespace aiethan #endif // AIETHAN_PLANE_TEXTURE2D_H_
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples 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 CIRCLEWIDGET_H #define CIRCLEWIDGET_H #include <QWidget> //! [0] class CircleWidget : public QWidget { Q_OBJECT public: CircleWidget(QWidget *parent = 0); void setFloatBased(bool floatBased); void setAntialiased(bool antialiased); QSize minimumSizeHint() const override; QSize sizeHint() const override; public slots: void nextAnimationFrame(); protected: void paintEvent(QPaintEvent *event) override; private: bool floatBased; bool antialiased; int frameNo; }; //! [0] #endif // CIRCLEWIDGET_H
#include "tests/lib.h" /* This program will create a huge file and copy theraven.txt multiple times * to the destination system. */ #define FROMFILESYSTEM "arkimedes" #define TOFILESYSTEM "halibut" const char* srcfile="["FROMFILESYSTEM"]theraven.txt"; const char* destfile="["TOFILESYSTEM"]tofile"; #define BUFFERSIZE 2000 #define BIGFILESIZE 270000 char buffer[BUFFERSIZE]; int copyfile(const char* to, const char* from, int offset) { printf("tofd %p\n", to); int tofd = syscall_open(to); printf("fromfd %p\n", from); int fromfd = syscall_open(from); int rd, wrt; int totalread = 0, totalwritten = 0; printf("Got file descriptors %d and %d:\n", tofd, fromfd); syscall_seek(tofd, offset); while ((rd = syscall_read(fromfd, buffer, BUFFERSIZE))) { totalread += rd; printf("read %d bytes", totalread); wrt = syscall_write(tofd, buffer, rd); totalwritten += wrt; printf("copied %d bytes\n", totalwritten); } printf("\n"); syscall_close(fromfd); syscall_close(tofd); return totalwritten; } int main() { // printf("Creating: %d\n", syscall_create(destfile, 0)); printf("Creating: %d\n", syscall_create(destfile, BIGFILESIZE)); int offset = 0; while (offset < BIGFILESIZE) offset += copyfile(destfile, srcfile, offset); int a = 0; int fd = syscall_open(destfile); while (a < BIGFILESIZE) { a += syscall_read(fd, buffer, BUFFERSIZE); printf("%c %c %c\n", buffer[0], buffer[100], buffer[1000]); } syscall_close(fd); printf("Test done.\n"); return 0; }
/** * \author Petrica Taras * \author Fernando Alvarez * * \brief Every setting can be found here and variables defined here are visible to the rest of the program * * Keeps the following: * - all sorts of pins (relays, sensors) * - IP addresses (if applicable) * - decision criteria (based on temperature * and power with the mention that temperature * ones have priority to avoid damaging the * equipment) * - number of sensors for each quantity * - defines the status variables for each device */ const byte noOfTemperatureSensors = 5; const byte noOfPowerSensors = 3; const byte noOfRelays = 4; //!< 4 here and 2 on the motor controller one /* * local */ String name = "Main Controller"; //!< controller label for identification byte ip[] = { 172, 16, 18, 131 }; //!< ip in lan (of this device) byte gateway[] = { 172, 16, 18, 130 }; //!< ground station byte subnet[] = { 255, 255, 255, 0 }; //subnet mask static uint8_t MAC[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; String temperatureSensorsLabels[] = {"Motor Azimuth", "Box", "PC", "Camera", "Outside"}; //!< everything we measure String powerSensorsLabels[] = {"Battery 1", "Battery 2", "PC", "Camera"}; //!< current/voltage sensors - if you want more then 4 then buy TCA9548A (I2C multiplexer) String relayLabels[] = {"PC", "Camera", "Raspberry Pi", "Motor Controller"}; String logFile = "log.txt"; int relayPins[] = {22, 23, 24, 25}; int microSDPins[] = {50, 51, 52, 53}; //!< for EtherMega/Arduino Mega only - change controller, change these pins! int temperatureSensorPin = 2; //!< because the thermocouples we use can be put on the same dataline double temperaturesThresholds[] = {65, 70, 55}; //!< Motor, PC, Raspberry Pi temperature thresholds double powerThresholds[] = {40, 60, 60, 10, 2, 2}; //!< Motors, PC, Camera, Raspberry Pi, telescope, sensors and motors (combined) power thresholds long kickIn = 60L*1*1000; //!< time to reach the proper altitude and hence start the rest of experiment (until now only the main controller is online) long kickOut = 100L*1*1000; //! time to safely shutdown the experiment just before battery cutoff (descent phase) long temperatureSamplingTime = 10000L; //!< sample the temperature every 10 seconds long powerSamplingTime = 10000L; //!< sample the current/voltage every 10 seconds /** * Management related functionality. Various flags and enumerations to be used in decision flow structures */ typedef enum {PC, ANDOR_CAMERA, R_PI, MAIN_CONTROLLER, MOTOR_CONTROLLER, MOTOR_AZIMUTH, MOTOR_ELEVATION} device; typedef enum {OFFLINE, ONLINE} status; typedef enum {ON, OFF} is; status thermalSensorsStatus[] = {OFFLINE, OFFLINE, OFFLINE, OFFLINE, OFFLINE}; //!< correlate with temperatureSensorsLabels[] status powerSensorsStatus[] = {OFFLINE, OFFLINE, OFFLINE, OFFLINE, OFFLINE, OFFLINE}; //!< correlate with powerSensorsLabels[] /** * The status of available devices and boards. Should be correlated with the device enumeration type above or the deviceLabels string. * The main controller (index 3/position 4) is always ONLINE because running this code assumes it implicitly. */ status devices[] = {OFFLINE, OFFLINE, OFFLINE, ONLINE, OFFLINE, OFFLINE, OFFLINE}; String deviceLabels[] = {"PC", "Andor Camera", "Raspberry Pi", "Main Controller", "Motor Controller", "Motor Azimuth", "Motor Elevation"}; int noOfDevices = 7; /** * Ethernet port settings (or placeholders for later use) */ #define I2C_ADDRESS 0x50 int serverPort = 9999; String ethernetNetworkLabels[] = {"Main Controller", "Ground Station", "PC", "Raspberry Pi", "Motor Controller"}; status ethernetNetworkDevices[] = {OFFLINE, OFFLINE, OFFLINE, OFFLINE, OFFLINE, OFFLINE}; byte ethernetNetworkIPs[][4] = {{ 172,16,18,131 }, { 172,16,18,130 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 169, 254, 131, 162 }};
/** * @file dm_core_connector_control_sink.c * @brief pseudo-module: this module is used to pass control messages from one SpartanMC system to another, sink side * * This module is transparent to the user, usually instantiated automatically by the config-tool. * * @author Carsten Bruns (carst.bruns@gmx.de) */ #include <fpga-log/dm/dm_core_connector_control_sink.h> /** * @brief new control message function of the core_connector_control_sink * * @param _core_connector_control_sink pointer to the core_connector_control_sink * @param count amount of passed parameter structs * @param parameters pointer to paramter structures, see @ref control_parameter_t */ static void dm_core_connector_control_sink_new_control_message( void* const _core_connector_control_sink, unsigned int count, const control_parameter_t* parameters); void dm_core_connector_control_sink_init( dm_core_connector_control_sink_t* const core_connector_control_sink, master_core_connector_regs_t* const core_connector) { core_connector_control_sink->control_in = control_port_dummy; core_connector_control_sink->control_in.parent = (void*) core_connector_control_sink; core_connector_control_sink->control_in.new_control_message = dm_core_connector_control_sink_new_control_message; core_connector_control_sink->core_connector = core_connector; } control_port_t* dm_core_connector_control_sink_get_control_in( dm_core_connector_control_sink_t* const core_connector_control_sink) { return &core_connector_control_sink->control_in; } static void dm_core_connector_control_sink_new_control_message( void* const _core_connector_control_sink, unsigned int count, const control_parameter_t* parameters) { master_core_connector_regs_t* core_connector = ((dm_core_connector_control_sink_t*) _core_connector_control_sink)->core_connector; core_connector->msg_size = count * sizeof(control_parameter_t) + 1; //we have count parameter plus one integer message size if (core_connector->status != MASTER_FIFO_FULL) { //check if we have enough space in the fifo core_connector->data_out = count; while (count--) { //write all parameters into fifo core_connector->data_out = parameters->type; core_connector->data_out = parameters->value; parameters++; } } else { //TODO some error handling code here! FiFo overflow! } }
#ifndef ENDOFLEVEL_H_IS_INCLUDED #define ENDOFLEVEL_H_IS_INCLUDED #include <stdio.h> #include <stdlib.h> #include <math.h> #include <vector> #include <string> #include <array> #include "fssimplewindow.h" const double YsPi=3.1415927; enum material_type { MATERIAL_0, MATERIAL_1, MATERIAL_2, MATERIAL_3, MATERIAL_4, MATERIAL_5, MATERIAL_6, MATERIAL_7, DEFAULT }; class position_3d { public: position_3d() : v{0.0, 0.0, 0.0} { } std::array<double,3> v; }; class tri_facet { public: std::array<unsigned, 3> vertex_id; material_type material; }; class OBJData { private: std::vector<position_3d> m_vertices; std::vector<tri_facet> m_facets; position_3d move; float a[3]; public: OBJData(); void ReadObj(const char fn[]); void Move(double x1,double y1,double z1); void Rotate(double a1,double x1,double y1,double z1); void Draw(int i) const; // 0 = human winner , 1 = AI winner }; class CameraObject { public: double x,y,z; double h,p,b; double fov,nearZ,farZ; CameraObject(); void Initialize(void); void SetUpCameraProjection(void); void SetUpCameraTransformation(void); void GetForwardVector(double &vx,double &vy,double &vz); }; class OrbitViewer : public CameraObject { public: double cx,cy,cz; double dist; OrbitViewer(); void UpdateCameraPosition(void); }; class Confetti //Set up the Confetti Class { public: int x1,x2,y1,y2,r,g,b; void Initialize(void); void Throw(); void DrawConfetti(void); }; #endif
///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2011-2012 Statoil ASA, Ceetron AS // // ResInsight 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. // // ResInsight 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 at <http://www.gnu.org/licenses/gpl.html> // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cafPdmPointer.h" #include "cvfAssert.h" #include "cvfObject.h" #include <cvfVector3.h> namespace cvf { class BoundingBox; class Part; class ModelBasicList; class Transform; class Font; } // namespace cvf namespace caf { class DisplayCoordTransform; } class Rim3dView; class RimAnnotationInViewCollection; class RimTextAnnotation; class RimTextAnnotationInView; class RivTextAnnotationPartMgr : public cvf::Object { using Vec3d = cvf::Vec3d; public: RivTextAnnotationPartMgr( Rim3dView* view, RimTextAnnotation* annotationLocal ); RivTextAnnotationPartMgr( Rim3dView* view, RimTextAnnotationInView* annotationInView ); ~RivTextAnnotationPartMgr() override; void appendDynamicGeometryPartsToModel( cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayXf, const cvf::BoundingBox& boundingBox ); private: void buildParts( const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset ); Vec3d getAnchorPointInDomain( bool snapToPlaneZ, double planeZ ); Vec3d getLabelPointInDomain( bool snapToPlaneZ, double planeZ ); bool isTextInBoundingBox( const cvf::BoundingBox& boundingBox ); void clearAllGeometry(); bool validateAnnotation( const RimTextAnnotation* annotation ) const; RimAnnotationInViewCollection* annotationCollection() const; RimTextAnnotation* rimAnnotation() const; bool isAnnotationVisible() const; caf::PdmPointer<Rim3dView> m_rimView; caf::PdmPointer<RimTextAnnotation> m_rimAnnotationLocal; caf::PdmPointer<RimTextAnnotationInView> m_rimAnnotationInView; cvf::ref<cvf::Part> m_linePart; cvf::ref<cvf::Part> m_labelPart; };
/** ****************************************************************************** * @file Demonstrations/Inc/stm32f0xx_it.h * @author MCD Application Team * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics International N.V. * All rights reserved.</center></h2> * * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution 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 other * contributors to this software may be used to endorse or promote products * derived from this software without specific 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F0xx_IT_H #define __STM32F0xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void SVC_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); #ifdef __cplusplus } #endif #endif /* __STM32F0xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* This file is part of VERTIGO. * * (C) Copyright 2013, Siege Technologies <http://www.siegetechnologies.com> * (C) Copyright 2013, Kirk Swidowski <http://www.swidowski.com> * * VERTIGO 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. * * VERTIGO 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 VERTIGO. If not, see <http://www.gnu.org/licenses/>. * * Written by Kirk Swidowski <kirk@swidowski.com> */ #include <defines.h> #include <types.h> #include <gicmod/gic.h> result_t gic_init(gic_block_t *block, size_t options) { UNUSED_VARIABLE(block); UNUSED_VARIABLE(options); // TODO: something nice to set the developers mind // at ease. return SUCCESS; } result_t gic_fini(gic_block_t *block) { UNUSED_VARIABLE(block); // TODO: something that makes the developer think // that everything will be back to the way it was before // the library was used. return SUCCESS; }
#include "guest/rom/boot.h" #include "core/filesystem.h" #include "core/md5.h" #include "core/option.h" #include "guest/dreamcast.h" struct boot { struct device; uint8_t rom[0x00200000]; }; static const char *boot_bin_path() { static char filename[PATH_MAX]; if (!filename[0]) { const char *appdir = fs_appdir(); snprintf(filename, sizeof(filename), "%s" PATH_SEPARATOR "boot.bin", appdir); } return filename; } static int boot_validate(struct boot *boot) { static const char *valid_bios_md5[] = { "a5c6a00818f97c5e3e91569ee22416dc", /* chinese bios */ "37c921eb47532cae8fb70e5d987ce91c", /* japanese bios */ "f2cd29d09f3e29984bcea22ab2e006fe", /* revised bios w/o MIL-CD */ "e10c53c2f8b90bab96ead2d368858623" /* original US/EU bios */ }; /* compare the rom's md5 against known good bios roms */ MD5_CTX md5_ctx; MD5_Init(&md5_ctx); MD5_Update(&md5_ctx, boot->rom, sizeof(boot->rom)); char result[33]; MD5_Final(result, &md5_ctx); for (int i = 0; i < array_size(valid_bios_md5); ++i) { if (strcmp(result, valid_bios_md5[i]) == 0) { return 1; } } return 0; } static int boot_load_rom(struct boot *boot) { const char *filename = boot_bin_path(); FILE *fp = fopen(filename, "rb"); if (!fp) { LOG_WARNING("failed to load '%s'", filename); return 0; } fseek(fp, 0, SEEK_END); int size = ftell(fp); fseek(fp, 0, SEEK_SET); if (size != (int)sizeof(boot->rom)) { LOG_WARNING("boot rom size mismatch, is %d, expected %d", size, sizeof(boot->rom)); fclose(fp); return 0; } int n = (int)fread(boot->rom, sizeof(uint8_t), size, fp); CHECK_EQ(n, size); fclose(fp); if (!boot_validate(boot)) { LOG_WARNING("failed to validate boot rom"); return 0; } LOG_INFO("boot_load_rom loaded '%s'", filename); return 1; } static uint32_t boot_rom_read(struct boot *boot, uint32_t addr, uint32_t data_mask) { return READ_DATA(&boot->rom[addr]); } static int boot_init(struct device *dev) { struct boot *boot = (struct boot *)dev; /* attempt to load the boot rom, if this fails, the bios code will hle it */ boot_load_rom(boot); return 1; } void boot_write(struct boot *boot, int offset, const void *data, int n) { CHECK(offset >= 0 && (offset + n) <= (int)sizeof(boot->rom)); memcpy(&boot->rom[offset], data, n); } void boot_read(struct boot *boot, int offset, void *data, int n) { CHECK(offset >= 0 && (offset + n) <= (int)sizeof(boot->rom)); memcpy(data, &boot->rom[offset], n); } void boot_destroy(struct boot *boot) { dc_destroy_device((struct device *)boot); } struct boot *boot_create(struct dreamcast *dc) { struct boot *boot = dc_create_device(dc, sizeof(struct boot), "boot", &boot_init); return boot; } /* clang-format off */ AM_BEGIN(struct boot, boot_rom_map); AM_RANGE(0x00000000, 0x001fffff) AM_HANDLE("boot rom", (mmio_read_cb)&boot_rom_read, NULL, NULL, NULL) AM_END(); /* clang-format on */
#include "SMSlib.h" #include "palette.h" #include "tiles.h" #include "tilemap.h" void main(void){ SMS_displayOn(); SMS_loadBGPalette(palDat); SMS_loadSpritePalette(palDat+16); SMS_loadTiles(tileDat,0,sizeof(tileDat)); SMS_loadTileMap(0,0,mapDat,sizeof(mapDat)); for(;;); }
/* by Luigi Auriemma */ static unsigned char undk2_dump[] = "\x8b\x54\x24\x08\x83\xec\x0c\x33\xc0\x53\x55\x56\x8b\x74\x24\x1c" "\x85\xd2\x57\x0f\x84\xc6\x01\x00\x00\x8a\x02\x8d\x4a\x01\x33\xd2" "\x8a\x11\xc1\xe0\x08\x03\xc2\x41\xf6\xc4\x01\x74\x03\x83\xc1\x03" "\x33\xc0\x33\xd2\x8a\x01\x8a\x51\x01\x41\xc1\xe0\x08\x03\xc2\x41" "\x33\xd2\x8a\x11\xc1\xe0\x08\x03\xc2\x41\x8a\x19\x41\xf6\xc3\x80" "\x88\x5c\x24\x10\x75\x58\x8a\x11\x41\x88\x54\x24\x20\x8b\x54\x24" "\x10\x81\xe2\xff\x00\x00\x00\x8b\xfa\x83\xe7\x03\x8b\xdf\x4f\x85" "\xdb\x74\x0a\x47\x8a\x19\x88\x1e\x46\x41\x4f\x75\xf7\x8b\xda\x8b" "\xfe\x83\xe3\x60\xc1\xe3\x03\x2b\xfb\x8b\x5c\x24\x20\x81\xe3\xff" "\x00\x00\x00\xc1\xea\x02\x2b\xfb\x83\xe2\x07\x4f\x83\xc2\x02\x8a" "\x1f\x88\x1e\x46\x47\x8b\xda\x4a\x85\xdb\x75\xf3\xeb\x9c\xf6\xc3" "\x40\x75\x61\x8a\x11\x41\x88\x54\x24\x20\x8b\x7c\x24\x20\x8a\x11" "\x81\xe7\xff\x00\x00\x00\x88\x54\x24\x24\x8b\xd7\x41\xc1\xea\x06" "\x8b\xea\x4a\x85\xed\x74\x0c\x8d\x6a\x01\x8a\x11\x88\x16\x46\x41" "\x4d\x75\xf7\x83\xe7\x3f\x8b\xd6\xc1\xe7\x08\x2b\xd7\x8b\x7c\x24" "\x24\x81\xe7\xff\x00\x00\x00\x83\xe3\x3f\x2b\xd7\x4a\x83\xc3\x03" "\x8b\xfb\x8a\x1a\x88\x1e\x46\x42\x8b\xdf\x4f\x85\xdb\x75\xf3\xe9" "\x36\xff\xff\xff\xf6\xc3\x20\x0f\x85\x81\x00\x00\x00\x8a\x19\x8a" "\x51\x01\x8b\x7c\x24\x10\x41\x41\x88\x54\x24\x24\x81\xe7\xff\x00" "\x00\x00\x8a\x11\x41\x88\x54\x24\x18\x8b\xd7\x83\xe2\x03\x8b\xea" "\x4a\x85\xed\x74\x0c\x8d\x6a\x01\x8a\x11\x88\x16\x46\x41\x4d\x75" "\xf7\x33\xd2\x8a\xf3\x89\x54\x24\x14\x8b\xd6\x8b\x5c\x24\x14\x2b" "\xd3\x8b\xdf\x83\xe3\x10\x83\xe7\x0c\xc1\xe3\x0c\x2b\xd3\x8b\x5c" "\x24\x24\x81\xe3\xff\x00\x00\x00\x2b\xd3\x8b\x5c\x24\x18\x4a\xc1" "\xe7\x06\x81\xe3\xff\x00\x00\x00\x8d\x7c\x1f\x04\x8a\x1a\x88\x1e" "\x46\x42\x8b\xdf\x4f\x85\xdb\x75\xf3\xe9\xac\xfe\xff\xff\x8a\xd3" "\x83\xe2\x1f\x8d\x14\x95\x04\x00\x00\x00\x83\xfa\x70\x77\x1a\x8b" "\xfa\x4a\x85\xff\x0f\x84\x90\xfe\xff\xff\x42\x8a\x19\x88\x1e\x46" "\x41\x4a\x75\xf7\xe9\x81\xfe\xff\xff\x83\xe3\x03\x8b\xd3\x4b\x85" "\xd2\x74\x0c\x8d\x53\x01\x8a\x19\x88\x1e\x46\x41\x4a\x75\xf7\x5f" "\x5e\x5d\x5b\x83\xc4\x0c\xc2\x0c\x00"; int (* __stdcall undk2)(unsigned char *out, unsigned char *in, int unused) = NULL; // anti DEP limitation! if you apply VirtualAlloc on a static char // it will cover also the rest of the page included other variables! void *undk2_alloc(u8 *dump, int dumpsz) { int pagesz; void *ret; pagesz = (dumpsz + 4095) & (~4095); // useful for pages? mah #ifdef WIN32 ret = VirtualAlloc( NULL, pagesz, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); // write for memcpy #else ret = malloc(pagesz); mprotect( ret, pagesz, PROT_EXEC | PROT_WRITE); // write for memcpy #endif memcpy(ret, dump, dumpsz); return(ret); } void undk2_init(void) { if(undk2) return; undk2 = undk2_alloc(undk2_dump, sizeof(undk2_dump)); }
#ifndef __LOGGER_H #define __LOGGER_H class Logger { public: static bool newLineAdded; static std::array<ltb::vec3f, 4> logColors; static std::array<std::string, 4> logType; static boost::circular_buffer<std::pair<LogMessageType,std::string>> logData; public: inline static void printf(LogMessageType type, const std::string &text) { newLineAdded = true; logData.push_back({ type, text }); } }; // http://www.boost.org/doc/libs/1_63_0/libs/log/doc/html/log/extension.html#log.extension.sinks // http://www.boost.org/doc/libs/1_63_0/libs/log/doc/html/index.html /* #include <boost/log/sinks/text_ostream_backend.hpp> void configure() { logging::add_file_log ( keywords::file_name = "sample_%N.log", keywords::rotation_size = 10 * 1024 * 1024, keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), keywords::format = "[%TimeStamp%]: %Message%" ); logging::core::get()->set_filter ( logging::trivial::severity >= logging::trivial::info ); } // =========================================================================== void init() { boost::shared_ptr<logging::core> core = logging::core::get(); boost::shared_ptr<sinks::text_ostream_backend> backend = boost::make_shared<sinks::text_ostream_backend>(); backend->add_stream(boost::shared_ptr<std::ostream>( [my custome sink] )); backend->auto_flush(true); // Enable auto-flushing after each log record written typedef sinks::synchronous_sink<sinks::text_ostream_backend> sink_t; boost::shared_ptr<sink_t> sink(new sink_t(backend)); core->add_sink(sink); } // =========================================================================== // Windows debugger output backend #include <boost/log/sinks/debug_output_backend.hpp> // Complete sink type typedef sinks::synchronous_sink< sinks::debug_output_backend > sink_t; void init_logging() { boost::shared_ptr< logging::core > core = logging::core::get(); // Create the sink. The backend requires synchronization in the frontend. boost::shared_ptr< sink_t > sink(new sink_t()); // Set the special filter to the frontend // in order to skip the sink when no debugger is available sink->set_filter(expr::is_debugger_present()); core->add_sink(sink); } */ #endif
#ifndef TREEWIDGETMENU_H #define TREEWIDGETMENU_H #include <QTreeWidget> #include <QTreeWidgetItem> #include <QWidget> #include <QAction> #include <QContextMenuEvent> class TreeWidgetMenu : public QTreeWidget { Q_OBJECT private: QAction *delete_item_act; QAction *edit_item_act; private slots: void delete_item(); void edit_item(); protected: void contextMenuEvent(QContextMenuEvent *event); public: TreeWidgetMenu(QWidget *parent=0); ~TreeWidgetMenu(); }; #endif //TREEWIDGETMENU_H
#ifndef LAMP_H #define LAMP_H #include "object_renderer.h" #include <glm/glm.hpp> class Lamp { public: Lamp(glm::vec3 pos, glm::vec3 siz = glm::vec3(1.0f), glm::vec4 col = glm::vec4(1.0f)); Lamp() {}; void draw(ObjectRenderer *renderer); glm::vec3 position; glm::vec3 size; glm::vec4 color; }; #endif // !LAMP_J
/* tree_test.c - test the voxel tree implementation. */ #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include "tree.h" /* Return a random tree branch. */ int random_tree_branch () { return (random () % (BRANCH_U + 1)); } /* Returns the first available branch. if all branches are NULL, return NULL. */ struct voxel_tree* first_legal_voxel_path (struct voxel_tree* tree) { int direction; for (direction = BRANCH_D; direction <= BRANCH_U; ++direction) { if (NULL != tree->branches[direction]) return(tree->branches[direction]); } return(NULL); } /* Return a random single-digit number. */ int rsd () { return(random () % 10); } int main (int argc, char *argv[]) { set_current_voxel_pool(new_voxel_pool ()); voxel_tree* tree = new_voxel_tree_from_pool (rsd (), rsd ()); int n; voxel_tree* node = NULL; for (n = 0; n < 2; ++n) { node = grow_voxel_tree_from_pool (rsd (), rsd (), random_tree_branch (), node); } printf ("\n\n"); struct voxel_tree* t; for (t = tree; NULL != t;) { printf("%d %d ", t->geometry, t->material); t = first_legal_voxel_path (t); } printf ("\n\n"); node->branches[BRANCH_U] = tree; free_voxel_pool (get_current_voxel_pool ()); printf("Creating a 15x15x15 cubic tree.\n"); tree = create_cubic_voxel_area (15, 15, 15, 1, 1); printf("Freeing cubic tree.\n"); free_voxel_tree (tree); return (0); }