text
stringlengths
4
6.14k
// This class handles input from, and output to, files. #ifndef FILESTORE_H #define FILESTORE_H #include "Core.h" #include "Libraries/Fatfs/ff.h" #include "CRC32.h" class Platform; class FileWriteBuffer; enum class OpenMode : uint8_t { read, // open an existing file for reading write, // write a file, replacing any existing file of the same name writeWithCrc, // as write but calculate the CRC as we go append // append to an existing file, or create a new file if it is not found }; enum class FileUseMode : uint8_t { free, // file object is free readOnly, // file object is in use for reading only readWrite, // file object is in use for reading and writing invalidated // file object is in use but file system has been invalidated }; class FileStore { public: FileStore(); bool Open(const char* filePath, OpenMode mode, uint32_t preAllocSize); bool Read(char& b); // Read 1 byte bool Read(uint8_t& b) { return Read((char&)b); } // Read 1 byte int Read(char* buf, size_t nBytes); // Read a block of nBytes length int Read(uint8_t* buf, size_t nBytes) { return Read((char*)buf, nBytes); } // Read a block of nBytes length int ReadLine(char* buf, size_t nBytes); // As Read but stop after '\n' or '\r\n' and null-terminate FileWriteBuffer *GetWriteBuffer() const; // Return a pointer to the remaining space for writing bool Write(char b); // Write 1 byte bool Write(const char *s, size_t len); // Write a block of len bytes bool Write(const uint8_t *s, size_t len); // Write a block of len bytes bool Write(const char* s); // Write a string bool Close(); // Shut the file and tidy up bool ForceClose(); bool Seek(FilePosition pos); // Jump to pos in the file FilePosition Position() const; // Return the current position in the file, assuming we are reading the file uint32_t ClusterSize() const; // Cluster size in bytes FilePosition Length() const; // File size in bytes #if 0 // not currently used bool GoToEnd(); // Position the file at the end (so you can write on the end). #endif void Duplicate(); // Create a second reference to this file bool Flush(); // Write remaining buffer data bool Truncate(); // Truncate file at current file pointer bool Invalidate(const FATFS *fs, bool doClose); // Invalidate the file if it uses the specified FATFS object bool IsOpenOn(const FATFS *fs) const; // Return true if the file is open on the specified file system uint32_t GetCRC32() const; #if 0 // not currently used bool SetClusterMap(uint32_t[]); // Provide a cluster map for fast seeking #endif static float GetAndClearLongestWriteTime(); // Return the longest time it took to write a block to a file, in milliseconds static unsigned int GetAndClearMaxRetryCount(); // Return the highest SD card retry count that resulted in a successful transfer friend class MassStorage; private: void Init(); FRESULT Store(const char *s, size_t len, size_t *bytesWritten); // Write data to the non-volatile storage FIL file; FileWriteBuffer *writeBuffer; volatile unsigned int openCount; volatile bool closeRequested; bool calcCrc; FileUseMode usageMode; CRC32 crc; static uint32_t longestWriteTime; }; inline FileWriteBuffer *FileStore::GetWriteBuffer() const { return writeBuffer; } inline bool FileStore::Write(const uint8_t *s, size_t len) { return Write(reinterpret_cast<const char *>(s), len); } inline uint32_t FileStore::GetCRC32() const { return crc.Get(); } #endif
/** * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef KERNEL_SYSTEM_H #define KERNEL_SYSTEM_H /* * This module is responsible for providing CPU * capabilities that is not provided bt the C * programming language. */ #include "arch/system.h" #endif
/** Q-score metric by lane * * * The InterOp files parsed by this class include: * - InterOp/QMetricsByLane.bin * - InterOp/QMetricsByLaneOut.bin * * @file * @date 5/17/2015 * @version 1.0 * @copyright GNU Public License. */ #pragma once #include "interop/model/metrics/q_metric.h" #include "interop/io/format/metric_format_factory.h" namespace illumina { namespace interop { namespace model { namespace metrics { /** Total histogram by lane */ class q_by_lane_metric : public q_metric { public: enum { /** Unique type code for metric */ TYPE = constants::QByLane, /** Latest version of the InterOp format */ LATEST_VERSION = 6 }; /** Define the base type */ typedef constants::base_lane_t base_t; public: /** Constructor */ q_by_lane_metric() {} /** Constructor * * @param header header of q-metric set */ q_by_lane_metric(const header_type& header) : q_metric(header) { } /** Constructor * * @param lane lane number * @param tile tile number * @param cycle cycle number * @param qscore_hist q-score histogram */ q_by_lane_metric(const uint_t lane, const uint_t tile, const uint_t cycle, const uint32_vector& qscore_hist) : q_metric(lane, tile, cycle, qscore_hist){} /** @defgroup q_metric_by_lane Quality Metrics By Lane * * Per lane per cycle quality metrics * * @ref illumina::interop::model::metrics::q_by_lane_metric "See full class description" * * @note All metrics in this class are supported by all versions * @ingroup run_metrics * @see illumina::interop::model::metrics::q_metric */ public: /** Accummulate another q_metric from the same lane/cycle * * @param metric q_metric from same lane/cycle */ void accumulate_by_lane(const q_metric& metric) { typedef uint32_vector::const_iterator const_iterator; typedef uint32_vector::iterator iterator; iterator it = m_qscore_hist.begin(); for (const_iterator beg = metric.qscore_hist().begin(), end = metric.qscore_hist().end(); beg != end; ++beg, ++it) *it += *beg; } public: /** Get the suffix of the InterOp filename * * @return suffix */ static const char* suffix(){return "ByLane";} }; }}}}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- * * gtksourceengine.h - Abstract base class for highlighting engines * * Copyright (C) 2003 - Gustavo Giráldez * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library 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 Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __GTK_SOURCE_ENGINE_H__ #define __GTK_SOURCE_ENGINE_H__ #include <gtk/gtktextbuffer.h> #include <gtksourceview/gtksourcestylescheme.h> G_BEGIN_DECLS #define GTK_TYPE_SOURCE_ENGINE (_gtk_source_engine_get_type ()) #define GTK_SOURCE_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SOURCE_ENGINE, GtkSourceEngine)) #define GTK_SOURCE_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SOURCE_ENGINE, GtkSourceEngineClass)) #define GTK_IS_SOURCE_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SOURCE_ENGINE)) #define GTK_IS_SOURCE_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SOURCE_ENGINE)) #define GTK_SOURCE_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SOURCE_ENGINE, GtkSourceEngineClass)) typedef struct _GtkSourceEngine GtkSourceEngine; typedef struct _GtkSourceEngineClass GtkSourceEngineClass; struct _GtkSourceEngine { GObject parent_instance; }; struct _GtkSourceEngineClass { GObjectClass parent_class; void (* attach_buffer) (GtkSourceEngine *engine, GtkTextBuffer *buffer); void (* text_inserted) (GtkSourceEngine *engine, gint start_offset, gint end_offset); void (* text_deleted) (GtkSourceEngine *engine, gint offset, gint length); void (* update_highlight) (GtkSourceEngine *engine, const GtkTextIter *start, const GtkTextIter *end, gboolean synchronous); void (* set_style_scheme) (GtkSourceEngine *engine, GtkSourceStyleScheme *scheme); GtkTextTag *(* get_context_class_tag) (GtkSourceEngine *engine, const gchar *context_class); }; GType _gtk_source_engine_get_type (void) G_GNUC_CONST; void _gtk_source_engine_attach_buffer (GtkSourceEngine *engine, GtkTextBuffer *buffer); void _gtk_source_engine_text_inserted (GtkSourceEngine *engine, gint start_offset, gint end_offset); void _gtk_source_engine_text_deleted (GtkSourceEngine *engine, gint offset, gint length); void _gtk_source_engine_update_highlight (GtkSourceEngine *engine, const GtkTextIter *start, const GtkTextIter *end, gboolean synchronous); void _gtk_source_engine_set_style_scheme (GtkSourceEngine *engine, GtkSourceStyleScheme *scheme); GtkTextTag *_gtk_source_engine_get_context_class_tag (GtkSourceEngine *engine, const gchar *context_class); G_END_DECLS #endif /* __GTK_SOURCE_ENGINE_H__ */
#ifndef FLASH_TYPES_H #define FLASH_TYPES_H #include <stdint.h> /* flash partitions */ #define FLASH_PT_FACTORY 0 #define FLASH_PT_RESERVED 1 #define FLASH_PT_USER 2 #define FLASH_PT_GAME 3 #define FLASH_PT_UNKNOWN 4 #define FLASH_PT_NUM 5 /* flash logical blocks */ #define FLASH_USER_SYSCFG 0x05 /* system region settings */ #define FLASH_REGION_JAPAN 0 #define FLASH_REGION_AMERICA 1 #define FLASH_REGION_EUROPE 2 /* system language settings */ #define FLASH_LANG_JAPANESE 0 #define FLASH_LANG_ENGLISH 1 #define FLASH_LANG_GERMAN 2 #define FLASH_LANG_FRENCH 3 #define FLASH_LANG_SPANISH 4 #define FLASH_LANG_ITALIAN 5 /* system broadcast settings */ #define FLASH_BCAST_NTSC 0 #define FLASH_BCAST_PAL 1 #define FLASH_BCAST_PAL_M 2 #define FLASH_BCAST_PAL_N 3 /* magic cookie every block-allocated partition begins with */ #define FLASH_MAGIC_COOKIE "KATANA_FLASH____" /* header block in block-allocated partition */ struct flash_header_block { char magic[16]; uint8_t part_id; uint8_t version; uint8_t reserved[46]; }; /* user block in block-allocated partition */ struct flash_user_block { uint16_t block_id; uint8_t data[60]; uint16_t crc; }; struct flash_syscfg_block { uint16_t block_id; /* last set time (seconds since 1/1/1950 00:00) */ uint16_t time_lo; uint16_t time_hi; uint8_t unknown1; uint8_t lang; uint8_t mono; uint8_t autostart; uint8_t unknown2[4]; uint8_t reserved[50]; }; #endif
//---------------------------------------------------------------------------- // // Copyright (C) 2004-2017 by EMGU Corporation. All rights reserved. // //---------------------------------------------------------------------------- #pragma once #ifndef EMGU_TESSERACT_C_H #define EMGU_TESSERACT_C_H #if (_MSC_VER >= 1200) typedef __int64 INT64; typedef unsigned __int64 UINT64; #endif #include "opencv2/core/core.hpp" #include "opencv2/core/core_c.h" #include "stdio.h" #include "baseapi.h" #include "allheaders.h" #include "renderer.h" class EmguTesseract: public tesseract::TessBaseAPI { public: int GetTextLength(int* blob_count) { return TextLength(blob_count); } int GetImageHeight() { int left, top, width, height, imageWidth, imageHeight; thresholder_->GetImageSizes(&left, &top, &width, &height, &imageWidth, &imageHeight); return imageHeight; } int TesseractExtractResult(char** text, int** lengths, float** costs, int** x0, int** y0, int** x1, int** y1) { return tesseract::TessBaseAPI::TesseractExtractResult(text, lengths, costs, x0, y0, x1, y1, page_res_); } }; struct TesseractResult { int length; float cost; CvRect region; }; namespace cv { namespace traits { template<> struct Depth < TesseractResult > { enum { value = Depth<uchar>::value }; }; template<> struct Type< TesseractResult > { enum { value = CV_MAKETYPE(Depth<uchar>::value, sizeof(TesseractResult)) }; }; } } CVAPI(const char*) TesseractGetVersion(); CVAPI(EmguTesseract*) TessBaseAPICreate(); CVAPI(int) TessBaseAPIInit(EmguTesseract* ocr, cv::String* dataPath, cv::String* language, int mode); CVAPI(void) TessBaseAPIRelease(EmguTesseract** ocr); CVAPI(int) TessBaseAPIRecognize(EmguTesseract* ocr); CVAPI(void) TessBaseAPISetImage(EmguTesseract* ocr, cv::_InputArray* mat); CVAPI(void) TessBaseAPISetImagePix(EmguTesseract* ocr, Pix* pix); CVAPI(void) TessBaseAPIGetUTF8Text(EmguTesseract* ocr, std::vector<unsigned char>* vectorOfByte); CVAPI(void) TessBaseAPIGetHOCRText(EmguTesseract* ocr, int pageNumber, std::vector<unsigned char>* vectorOfByte); CVAPI(void) TessBaseAPIGetTSVText(EmguTesseract* ocr, int pageNumber, std::vector<unsigned char>* vectorOfByte); CVAPI(void) TessBaseAPIGetBoxText(EmguTesseract* ocr, int pageNumber, std::vector<unsigned char>* vectorOfByte); CVAPI(void) TessBaseAPIGetUNLVText(EmguTesseract* ocr, std::vector<unsigned char>* vectorOfByte); CVAPI(void) TessBaseAPIGetOsdText(EmguTesseract* ocr, int pageNumber, std::vector<unsigned char>* vectorOfByte); CVAPI(void) TessBaseAPIExtractResult(EmguTesseract* ocr, std::vector<unsigned char>* charSeq, std::vector<TesseractResult>* resultSeq); CVAPI(bool) TessBaseAPIProcessPage( EmguTesseract* ocr, Pix* pix, int pageIndex, cv::String* filename, cv::String* retryConfig, int timeoutMillisec, tesseract::TessResultRenderer* renderer); CVAPI(bool) TessBaseAPISetVariable(EmguTesseract* ocr, const char* varName, const char* value); CVAPI(void) TessBaseAPISetPageSegMode(EmguTesseract* ocr, tesseract::PageSegMode mode); CVAPI(tesseract::PageSegMode) TessBaseAPIGetPageSegMode(EmguTesseract* ocr); CVAPI(int) TessBaseAPIGetOpenCLDevice(EmguTesseract* ocr, void **device); CVAPI(tesseract::PageIterator*) TessBaseAPIAnalyseLayout(EmguTesseract* ocr, bool mergeSimilarWords); CVAPI(void) TessPageIteratorGetOrientation(tesseract::PageIterator* iterator, tesseract::Orientation* orientation, tesseract::WritingDirection* writingDirection, tesseract::TextlineOrder* order, float* deskewAngle); CVAPI(void) TessPageIteratorRelease(tesseract::PageIterator** iterator); CVAPI(bool) TessPageIteratorGetBaseLine( tesseract::PageIterator* iterator, tesseract::PageIteratorLevel level, int* x1, int* y1, int* x2, int* y2); CVAPI(int) TessBaseAPIIsValidWord(EmguTesseract* ocr, char* word); CVAPI(int) TessBaseAPIGetOem(EmguTesseract* ocr); CVAPI(tesseract::TessPDFRenderer*) TessPDFRendererCreate(cv::String* outputbase, cv::String* datadir, bool textonly, tesseract::TessResultRenderer** resultRenderer); CVAPI(void) TessPDFRendererRelease(tesseract::TessPDFRenderer** renderer); CVAPI(Pix*) leptCreatePixFromMat(cv::Mat* m); CVAPI(void) leptPixDestroy(Pix** pix); #endif
/* * Copyright (C) 2008-2009 Daniel Prevost <dprevost@photonsoftware.org> * * This file is part of Photon (photonsoftware.org). * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 2 or version 3 as published by the * Free Software Foundation and appearing in the file COPYING.GPL2 and * COPYING.GPL3 included in the packaging of this software. * * Licensees holding a valid Photon Commercial license can use this file * in accordance with the terms of their license. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */ #include "Common/Common.h" #include <photon/photon.h> #include "Tests/PrintError.h" #include "API/FastMap.h" const bool expectedToPass = false; /* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */ int main( int argc, char * argv[] ) { PSO_HANDLE objHandle, sessionHandle; int errcode; psoObjectDefinition mapDef = { PSO_FAST_MAP, 0, 0, 0 }; psoKeyFieldDefinition keyDef = { "MyKey", PSO_KEY_VARCHAR, 10 }; psoFieldDefinition fields[1] = { { "Field_1", PSO_VARCHAR, {10} } }; PSO_HANDLE keyDefHandle, dataDefHandle; if ( argc > 1 ) { errcode = psoInit( argv[1], argv[0] ); } else { errcode = psoInit( "10701", argv[0] ); } if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } errcode = psoInitSession( &sessionHandle ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } errcode = psoCreateFolder( sessionHandle, "/api_fast_map_open_nosession", strlen("/api_fast_map_open_nosession") ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } errcode = psoKeyDefCreate( sessionHandle, "api_fastmap_open_nosession", strlen("api_fastmap_open_nosession"), PSO_DEF_PHOTON_ODBC_SIMPLE, (unsigned char *)&keyDef, sizeof(psoKeyFieldDefinition), &keyDefHandle ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } errcode = psoDataDefCreate( sessionHandle, "api_fastmap_open_nosession", strlen("api_fastmap_open_nosession"), PSO_DEF_PHOTON_ODBC_SIMPLE, (unsigned char *)fields, sizeof(psoFieldDefinition), &dataDefHandle ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } errcode = psoCreateMap( sessionHandle, "/api_fast_map_open_nosession/test", strlen("/api_fast_map_open_nosession/test"), &mapDef, dataDefHandle, keyDefHandle ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } /* Close the session and try to act on the object */ errcode = psoCommit( sessionHandle ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } errcode = psoExitSession( sessionHandle ); if ( errcode != PSO_OK ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } /* * sessionHandle is a pointer to deallocated memory. We either get the * error or we crash! */ errcode = psoFastMapOpen( sessionHandle, "/api_fast_map_open_nosession/test", strlen("/api_fast_map_open_nosession/test"), &objHandle ); if ( errcode != PSO_WRONG_TYPE_HANDLE ) { fprintf( stderr, "err: %d\n", errcode ); ERROR_EXIT( expectedToPass, NULL, ; ); } psoExit(); #if defined(WIN32) exit(3); #else abort(); #endif } /* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
/* https://cirosantilli.com/linux-kernel-module-cheat#ring0 */ #ifndef LKMC_RING0_H #define LKMC_RING0_H #if defined(__x86_64__) || defined(__i386__) #ifdef THIS_MODULE #include <linux/kernel.h> #if defined(__x86_64__) typedef u64 LkmcRing0RegsType; #elif defined(__i386__) typedef u32 LkmcRing0RegsType; #endif #else #include <stdint.h> #if defined(__x86_64__) typedef uint64_t LkmcRing0RegsType; #elif defined(__i386__) typedef uint32_t LkmcRing0RegsType; #endif #endif typedef struct { LkmcRing0RegsType cr0; LkmcRing0RegsType cr2; LkmcRing0RegsType cr3; } LkmcRing0Regs; void lkmc_ring0_get_control_regs(LkmcRing0Regs *ring0_regs) { #if defined(__x86_64__) __asm__ __volatile__ ( "mov %%cr0, %%rax;" "mov %%eax, %[cr0];" : [cr0] "=m" (ring0_regs->cr0) : : "rax" ); __asm__ __volatile__ ( "mov %%cr2, %%rax;" "mov %%eax, %[cr2];" : [cr2] "=m" (ring0_regs->cr2) : : "rax" ); __asm__ __volatile__ ( "mov %%cr3, %%rax;" "mov %%eax, %[cr3];" : [cr3] "=m" (ring0_regs->cr3) : : "rax" ); #elif defined(__i386__) __asm__ __volatile__ ( "mov %%cr0, %%eax;" "mov %%eax, %[cr0];" : [cr0] "=m" (ring0_regs->cr0) : : "eax" ); __asm__ __volatile__ ( "mov %%cr2, %%eax;" "mov %%eax, %[cr2];" : [cr2] "=m" (ring0_regs->cr2) : : "eax" ); __asm__ __volatile__ ( "mov %%cr3, %%eax;" "mov %%eax, %[cr3];" : [cr3] "=m" (ring0_regs->cr3) : : "eax" ); #endif } #endif #endif
/********************************************************************************************************************** (c) Copyright 2011, Bret Ambrose (mailto:bretambrose@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/>. **********************************************************************************************************************/ #pragma once #include "ConcurrentQueueInterface.h" #include "tbb/include/tbb/concurrent_queue.h" namespace IP { namespace Concurrency { // A concurrent queue that wraps TBB's concurrent queue template< typename T > class CTBBConcurrentQueue : public IConcurrentQueue< T > { public: // Construction/Destruction CTBBConcurrentQueue( void ) : Queue() { } virtual ~CTBBConcurrentQueue() = default; CTBBConcurrentQueue( CTBBConcurrentQueue< T > &&rhs ) = delete; CTBBConcurrentQueue< T > & operator =( CTBBConcurrentQueue< T > &&rhs ) = delete; CTBBConcurrentQueue( const CTBBConcurrentQueue< T > &rhs ) = delete; CTBBConcurrentQueue< T > & operator =( const CTBBConcurrentQueue< T > &rhs ) = delete; // Base class public pure virtual interface implementations virtual void Move_Item( T &&item ) override { Queue.push(std::move(item)); } virtual void Remove_Items( std::vector< T > &items ) override { items.clear(); T item; while ( Queue.try_pop( item ) ) { items.push_back( std::move( item ) ); } } private: // Private Data tbb::strict_ppl::concurrent_queue< T > Queue; }; } // namespace Concurrency } // namespace IP
/* * This file is part of the libemb project. * * Copyright (C) 2011 Stefan Wendler <sw@kaltpost.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __I2CSLAVE_H_ #define __I2CSLAVE_H_ #define I2C_MAX_ARGS 5 #define I2C_MAX_RES 25 typedef struct { /** * Callback when data is received */ void (*receive)(unsigned char data); /** * Callback when data is requested */ void (*transmit)(unsigned char volatile *data); /** * Callback for I2C start condition */ void (*start)(void); } i2c_cb; /** * All arguments from a single command */ typedef struct { /** * Number of arguments */ unsigned char count; /** * The arguments */ unsigned char args[I2C_MAX_ARGS]; } i2c_cmd_args; /** * Definition of a single command */ typedef struct { /** * Command id */ unsigned char cmd; /** * Number of arguments expecetd by this command */ unsigned char args; /** * Function called when executing the commmand */ void (*func)(i2c_cmd_args *args); } i2c_cmd; /** * All commands knwon */ typedef struct { /** * Number of commands */ unsigned char count; /** * The commands */ i2c_cmd cmds[]; } i2c_cmds; /** * Response */ typedef struct { /** * Number of data */ unsigned char count; /** * Number of data already transmitted */ unsigned char xmit_count; /** * Response */ unsigned char data[I2C_MAX_RES]; } i2c_cmd_res; /** * */ void i2cslave_init(unsigned int addr, i2c_cb *callbacks); /** * */ void i2cslave_cmdproc_init(unsigned int add, i2c_cmds *cmds); /** * */ void i2cslave_cmdproc_clrres(); /** * */ int i2cslave_cmdproc_addres(unsigned char data); #endif
#ifndef LOGEDITOR_H #define LOGEDITOR_H #include <QTextEdit> #include <QColor> #include "infomanager.h" class QTextEdit; class QColor; class LogEditor { public: explicit LogEditor(); explicit LogEditor(QTextEdit* logWindow); void setLogWindow(QTextEdit *log); // logging part void newCompiling(); void addVertexLog(QString log); void addFragmentLog(QString log); void addLinkLog(QString log); void addFileError(QString log); void addUniformError(QString log); void addBufferError(QString log); void addToLog(QString str); void addToCompiling(QString str); private: unsigned int maxLines; QTextEdit* window; QString oldLog; signals: public slots: }; #endif // LOGEDITOR_H
#pragma once #ifndef _NRF8001_METEO_STATION_H_ #define _NRF8001_METEO_STATION_H_ /** * Copyright 2015 University of Applied Sciences Western Switzerland / Fribourg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Project: HEIA-FR / Internet of Things Laboratory * * Abstract: Project - Connected Weather Station * * Purpose: Derived class of nRF8001Device. This class offers the possibilities to send * temperature & humidity and to retrieve ACI events * * Author: Samuel Mertenat - T2f * Date: 25.05.2015 */ #include "nRF8001Device.h" #include "services.h" #include "Measurements.h" extern measurements g_measurement; // Temperature measurement Flags // Documentation: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml // Flags: 0: Celsius, 0: Time Stamp not present, 0:Temperature Type not present, 3-7: reserved #define TEMPERATURE_MEASUREMENT_FLAGS 0b00000000 // Temperature measurement structure (5 bytes) typedef struct temperature_measure { uint8_t flags; uint8_t measurement[4]; }temperature_measure; // Humidity measurement structure (2 bytes) // Documentation: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.humidity.xml typedef struct humidity_measure { uint8_t measurement[2]; }humidity_measure; // Pressure measurement structure (4 bytes) // Documentation: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.pressure.xml typedef struct pressure_measure { uint8_t measurement[4]; }pressure_measure; // Enumeration for the two settings of the thermostat enum thermostat { THERMO_TEMP_MIN, THERMO_TEMP_MAX, NB_OF_TEMP }; // Derived class of nRF8001Device // This class specifies the needed functions & attributes used for our Weather Station class nRF8001MeteoStation:public nRF8001Device { public: // Constructor nRF8001MeteoStation(void); /** Function to send a temperature measurement * @param p_temperature Measured temperature to send * @return bool Returns TRUE if the temperature has been sent correctly */ bool send_temperature(float p_temperature); /** Function to send a humidity measurement * @param p_humidity Measured humidity to send * @return bool Returns TRUE if the humidity has been sent correctly */ bool send_humidity(float p_humidity); /** Function to send a pressure measurement * @param p_pressure Measured pressure to send * @return bool Returns TRUE if the pressure has been sent correctly */ bool send_pressure(uint32_t p_pressure); /** Function is called on defined ACI events (cf. nRF8001Device.cpp) * @param aci_evt_t* Pointer to the aci_data event structure */ virtual void onACIEvent(aci_evt_t* p_event); /** Function is called on a single click (cf. IoT.ino) and * toggles the buzzer state (enable / disabled) */ void toggle_notification_buzzer_state(void); /** Function is called on a double-click (cf. IoT.ino) and * toggles between the min & the max temperature (thermostat) */ void toggle_thermostat_temperature(void); /** Function is called by the timer (cf. IoT.ino) every 5 minutes * and pushes a notification to the user (about the temperature; thermostat) */ void push_notification(float p_temperature); private: // variables used to store the last temperature, humidity & pressure measurements float m_last_temp; float m_last_hum; //uint32_t m_last_pres; // structures used to send temperature, humidity & pressure measurements temperature_measure m_temp_measure; humidity_measure m_hum_measure; //pressure_measure m_pres_measure; // variables used to store if an ACK is pending for temperature / humidity / pressure bool m_ack_temperature_measure_pending; bool m_ack_humidity_measure_pending; //bool m_ack_pressure_measure_pending; // variable used to store the received bytes (2) uint8_t m_uart_buffer[2/*PIPE_METEO_STATION_THERMOSTAT_TEMPERATUR_RX_MAX_SIZE*/]; // variables used for the thermostat (min, max, setting state) uint8_t m_thermo_temp_min; uint8_t m_thermo_temp_max; uint8_t m_thermo_temp; //measurements m_measurements; }; #endif
/* * file:get_time.c */ #include <time.h> #include <stdio.h> #include <string.h> #include "get_time.h" /* get the time on server, return: the ascii string of time , NULL on error argument: time_buf the buffer to store time_string */ char *get_time_str(char *time_buf) { time_t now_sec; struct tm *time_now; if( time(&now_sec) == -1) { perror("time() in get_time.c"); return NULL; } if((time_now = gmtime(&now_sec)) == NULL) { perror("localtime in get_time.c"); return NULL; } char *str_ptr = NULL; if((str_ptr = asctime(time_now)) == NULL) { perror("asctime in get_time.c"); return NULL; } strcat(time_buf, str_ptr); return time_buf; }
/* * Copyright 2012 Red Hat Inc. * * 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) OR AUTHOR(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. * * Authors: Ben Skeggs */ #include "nv50.h" #include <subdev/timer.h> static const struct nvkm_bitfield nv50_gr_status[] = { { 0x00000001, "BUSY" }, /* set when any bit is set */ { 0x00000002, "DISPATCH" }, { 0x00000004, "UNK2" }, { 0x00000008, "UNK3" }, { 0x00000010, "UNK4" }, { 0x00000020, "UNK5" }, { 0x00000040, "M2MF" }, { 0x00000080, "UNK7" }, { 0x00000100, "CTXPROG" }, { 0x00000200, "VFETCH" }, { 0x00000400, "CCACHE_PREGEOM" }, { 0x00000800, "STRMOUT_VATTR_POSTGEOM" }, { 0x00001000, "VCLIP" }, { 0x00002000, "RATTR_APLANE" }, { 0x00004000, "TRAST" }, { 0x00008000, "CLIPID" }, { 0x00010000, "ZCULL" }, { 0x00020000, "ENG2D" }, { 0x00040000, "RMASK" }, { 0x00080000, "TPC_RAST" }, { 0x00100000, "TPC_PROP" }, { 0x00200000, "TPC_TEX" }, { 0x00400000, "TPC_GEOM" }, { 0x00800000, "TPC_MP" }, { 0x01000000, "ROP" }, {} }; static const struct nvkm_bitfield nv50_gr_vstatus_0[] = { { 0x01, "VFETCH" }, { 0x02, "CCACHE" }, { 0x04, "PREGEOM" }, { 0x08, "POSTGEOM" }, { 0x10, "VATTR" }, { 0x20, "STRMOUT" }, { 0x40, "VCLIP" }, {} }; static const struct nvkm_bitfield nv50_gr_vstatus_1[] = { { 0x01, "TPC_RAST" }, { 0x02, "TPC_PROP" }, { 0x04, "TPC_TEX" }, { 0x08, "TPC_GEOM" }, { 0x10, "TPC_MP" }, {} }; static const struct nvkm_bitfield nv50_gr_vstatus_2[] = { { 0x01, "RATTR" }, { 0x02, "APLANE" }, { 0x04, "TRAST" }, { 0x08, "CLIPID" }, { 0x10, "ZCULL" }, { 0x20, "ENG2D" }, { 0x40, "RMASK" }, { 0x80, "ROP" }, {} }; static void nvkm_gr_vstatus_print(struct nv50_gr *gr, int r, const struct nvkm_bitfield *units, u32 status) { struct nvkm_subdev *subdev = &gr->base.engine.subdev; u32 stat = status; u8 mask = 0x00; char msg[64]; int i; for (i = 0; units[i].name && status; i++) { if ((status & 7) == 1) { mask |= (1 << i); } status >>= 3; } nvkm_snprintbf(msg, sizeof(msg), units, mask); nvkm_error(subdev, "PGRAPH_VSTATUS%d: %08x [%s]\n", r, stat, msg); } int g84_gr_tlb_flush(struct nvkm_gr *base) { struct nv50_gr *gr = nv50_gr(base); struct nvkm_subdev *subdev = &gr->base.engine.subdev; struct nvkm_device *device = subdev->device; struct nvkm_timer *tmr = device->timer; bool idle, timeout = false; unsigned long flags; char status[128]; u64 start; u32 tmp; spin_lock_irqsave(&gr->lock, flags); nvkm_mask(device, 0x400500, 0x00000001, 0x00000000); start = nvkm_timer_read(tmr); do { idle = true; for (tmp = nvkm_rd32(device, 0x400380); tmp && idle; tmp >>= 3) { if ((tmp & 7) == 1) { idle = false; } } for (tmp = nvkm_rd32(device, 0x400384); tmp && idle; tmp >>= 3) { if ((tmp & 7) == 1) { idle = false; } } for (tmp = nvkm_rd32(device, 0x400388); tmp && idle; tmp >>= 3) { if ((tmp & 7) == 1) { idle = false; } } } while (!idle && !(timeout = nvkm_timer_read(tmr) - start > 2000000000)); if (timeout) { nvkm_error(subdev, "PGRAPH TLB flush idle timeout fail\n"); tmp = nvkm_rd32(device, 0x400700); nvkm_snprintbf(status, sizeof(status), nv50_gr_status, tmp); nvkm_error(subdev, "PGRAPH_STATUS %08x [%s]\n", tmp, status); nvkm_gr_vstatus_print(gr, 0, nv50_gr_vstatus_0, nvkm_rd32(device, 0x400380)); nvkm_gr_vstatus_print(gr, 1, nv50_gr_vstatus_1, nvkm_rd32(device, 0x400384)); nvkm_gr_vstatus_print(gr, 2, nv50_gr_vstatus_2, nvkm_rd32(device, 0x400388)); } nvkm_wr32(device, 0x100c80, 0x00000001); nvkm_msec(device, 2000, if (!(nvkm_rd32(device, 0x100c80) & 0x00000001)) break; ); nvkm_mask(device, 0x400500, 0x00000001, 0x00000001); spin_unlock_irqrestore(&gr->lock, flags); return timeout ? -EBUSY : 0; } static const struct nvkm_gr_func g84_gr = { .init = nv50_gr_init, .intr = nv50_gr_intr, .chan_new = nv50_gr_chan_new, .tlb_flush = g84_gr_tlb_flush, .units = nv50_gr_units, .sclass = { { -1, -1, 0x0030, &nv50_gr_object }, { -1, -1, 0x502d, &nv50_gr_object }, { -1, -1, 0x5039, &nv50_gr_object }, { -1, -1, 0x50c0, &nv50_gr_object }, { -1, -1, 0x8297, &nv50_gr_object }, {} } }; int g84_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr) { return nv50_gr_new_(&g84_gr, device, index, pgr); }
/* Copyright (C) CFEngine AS This file is part of CFEngine 3 - written and maintained by CFEngine AS. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 3. 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 To the extent this program is licensed as part of the Enterprise versions of CFEngine, the applicable Commerical Open Source License (COSL) may apply to this file if you as a licensee so wish it. See included file COSL.txt. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <string.h> #if !HAVE_DECL_STRSTR char *strstr(const char *haystack, const char *needle); #endif char *strstr(const char *haystack, const char *needle) { size_t needlelen = strlen(needle); for (const char *sp = haystack; *sp; sp++) { if (strncmp(sp, needle, needlelen) == 0) { return (char *) sp; } } return NULL; }
//============================================================================ // Name : utils.cpp // Author : Ivan // Version : // Copyright : GPL // Description : //============================================================================ #include <iostream> #include <cstdlib> #include <string> //============================================================================ // Name : // Description : //============================================================================ class cfile { private: std::string name; std::string path; public: cfile(); cfile(std::string n) { name = n; }; cfile( const cfile &); //~cfile(); const cfile &operator=(const cfile &); void set_name(std::string n) { name = n; }; void set_name(char & n) { name = n; }; std::string get_name() const {return name;}; std::string get_path() const {return path;}; bool exist() const; size_t get_size(); };
/* Copyright © 2014-2015 by The qTox Project Contributors This file is part of qTox, a Qt-based graphical interface for Tox. qTox is libre 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. qTox 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 qTox. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GROUP_H #define GROUP_H #include <QMap> #include <QObject> #include <QStringList> #define RETRY_PEER_INFO_INTERVAL 500 class Friend; class GroupWidget; class GroupChatForm; class ToxPk; class Group : public QObject { Q_OBJECT public: Group(int GroupId, QString Name, bool IsAvGroupchat); virtual ~Group(); bool isAvGroupchat() const; int getGroupId() const; int getPeersCount() const; void regeneratePeerList(); QStringList getPeerList() const; bool isSelfPeerNumber(int peernumber) const; GroupChatForm* getChatForm(); GroupWidget* getGroupWidget(); void setEventFlag(int f); int getEventFlag() const; void setMentionedFlag(int f); int getMentionedFlag() const; void updatePeer(int peerId, QString newName); void setName(const QString& name); QString getName() const; QString resolveToxId(const ToxPk& id) const; signals: void titleChanged(GroupWidget* widget); void userListChanged(GroupWidget* widget); private: GroupWidget* widget; GroupChatForm* chatForm; QStringList peers; QMap<QByteArray, QString> toxids; int hasNewMessages, userWasMentioned; int groupId; int nPeers; int selfPeerNum = -1; bool avGroupchat; }; #endif // GROUP_H
/* * Copyright or © or Copr. 2008, Simon Duquennoy * * Author e-mail: simon.duquennoy@lifl.fr * * This software is a computer program whose purpose is to design an * efficient Web server for very-constrained embedded system. * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL * license as circulated by CEA, CNRS and INRIA at the following URL * "http://www.cecill.info". * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited * liability. * * In this respect, the user's attention is drawn to the risks associated * with loading, using, modifying and/or developing or reproducing the * software by the user in light of its specific status of free software, * that may mean that it is complicated to manipulate, and that also * therefore means that it is reserved for developers and experienced * professionals having in-depth computer knowledge. Users are therefore * encouraged to load and test the software's suitability as regards their * requirements in conditions enabling the security of their systems and/or * data to be ensured and, more generally, to use and operate it in the * same conditions as regards security. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL license and that you accept its terms. */ #ifndef __ARCH_H__ #define __ARCH_H__ /* Architecture dependent macro for arm architecture */ #ifdef __arm__ /* save the process stack pointer in sp[0] and frame pointer in sp[1] */ /* By convention, r11 is used as frame pointer in arm mode */ #define BACKUP_CTX(sp) do {asm ("mov %0, sp" : "=r"((sp)[0])); asm("mov %0, r11" : "=r"((sp)[1])); }while(0) /* restore the process stack pointer from sp[0] */ #define RESTORE_CTX(sp) do {asm ("mov sp, %0" :: "r"((sp)[0])); asm("mov r11, %0" :: "r"((sp)[1])); }while(0) /* push all registers that must not be modified by any function call */ #define PUSHREGS do { asm("push {r4-r11, lr}"); } while(0) /* pop all registers that must not be modified by any function call */ #define POPREGS do { asm("pop {r4-r11, lr}"); } while (0) #else #error "This file is for arm architecture" #endif #endif /* __ARCH_H__ */
#ifndef TEXTURE_H #define TEXTURE_H #include <SDL.h> #include "renderer.h" #include "surface.h" #include <exception> class Texture { private: SDL_Texture* texture; public: Texture(Renderer& sdlRenderer, Surface& sdlSurface) { texture = SDL_CreateTextureFromSurface(sdlRenderer.getRenderer(), sdlSurface.getSurface()); if (texture == nullptr) { throw std::exception(); } } ~Texture() { SDL_DestroyTexture(texture); } SDL_Texture* getTexture() { return texture; } }; #endif
#ifndef ___ASM_SPARC_TLB_H #define ___ASM_SPARC_TLB_H #if defined(__sparc__) && defined(__arch64__) #include <asm/tlb_64.h> #else #include <asm/tlb_32.h> #endif #endif
/**************************************************************************** * Copyright (c) 2011 Anthony Vital <anthony.vital@gmail.com> * * * * This file is part of Wicd Client KDE. * * * * Wicd Client KDE 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. * * * * Wicd Client KDE 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 Wicd Client KDE. If not, see <http://www.gnu.org/licenses/>.* ****************************************************************************/ #ifndef WICDENGINE_H #define WICDENGINE_H #include "dbushandler.h" #include <Plasma/DataEngine> class WicdEngine : public Plasma::DataEngine { Q_OBJECT public: WicdEngine(QObject* parent, const QVariantList& args); Plasma::Service *serviceForSource(const QString &source); void init(); QStringList sources() const; protected: bool sourceRequestEvent(const QString &source); bool updateSourceEvent(const QString& source); private slots: void updateStatus(Status status); void forceUpdateStatus(); void profileNeeded(); void profileNotNeeded(); void scanStarted(); void scanEnded(); void resultReceived(const QString& result); void daemonStarted(); void daemonClosed(); private: Status m_status; QString m_message; QString m_interface; bool m_profileNeeded; bool m_scanning; bool m_daemonRunning; QString m_error; //for translations QHash<QString, QString> m_messageTable; }; K_EXPORT_PLASMA_DATAENGINE(wicd, WicdEngine) #endif // WICDENGINE_H
/* =========================================================================== Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. =========================================================================== */ #ifndef __IMAGEOPTS_H__ #define __IMAGEOPTS_H__ enum textureType_t { TT_DISABLED, TT_2D, TT_CUBIC }; /* ================================================ The internal *Texture Format Types*, ::textureFormat_t, are: ================================================ */ enum textureFormat_t { FMT_NONE, //------------------------ // Standard color image formats //------------------------ FMT_RGBA8, // 32 bpp FMT_XRGB8, // 32 bpp //------------------------ // Alpha channel only //------------------------ // Alpha ends up being the same as L8A8 in our current implementation, because straight // alpha gives 0 for color, but we want 1. FMT_ALPHA, //------------------------ // Luminance replicates the value across RGB with a constant A of 255 // Intensity replicates the value across RGBA //------------------------ FMT_L8A8, // 16 bpp FMT_LUM8, // 8 bpp FMT_INT8, // 8 bpp //------------------------ // Compressed texture formats //------------------------ FMT_DXT1, // 4 bpp FMT_DXT5, // 8 bpp //------------------------ // Depth buffer formats //------------------------ FMT_DEPTH, // 24 bpp //------------------------ // //------------------------ FMT_X16, // 16 bpp FMT_Y16_X16, // 32 bpp FMT_RGB565, // 16 bpp }; int BitsForFormat( textureFormat_t format ); /* ================================================ DXT5 color formats ================================================ */ enum textureColor_t { CFM_DEFAULT, // RGBA CFM_NORMAL_DXT5, // XY format and use the fast DXT5 compressor CFM_YCOCG_DXT5, // convert RGBA to CoCg_Y format CFM_GREEN_ALPHA // Copy the alpha channel to green }; /* ================================================ idImageOpts hold parameters for texture operations. ================================================ */ class idImageOpts { public: idImageOpts(); bool operator==( const idImageOpts& opts ); //--------------------------------------------------- // these determine the physical memory size and layout //--------------------------------------------------- textureType_t textureType; textureFormat_t format; textureColor_t colorFormat; int width; int height; // not needed for cube maps int numLevels; // if 0, will be 1 for NEAREST / LINEAR filters, otherwise based on size bool gammaMips; // if true, mips will be generated with gamma correction bool readback; // 360 specific - cpu reads back from this texture, so allocate with cached memory }; /* ======================== idImageOpts::idImageOpts ======================== */ ID_INLINE idImageOpts::idImageOpts() { format = FMT_NONE; colorFormat = CFM_DEFAULT; width = 0; height = 0; numLevels = 0; textureType = TT_2D; gammaMips = false; readback = false; }; /* ======================== idImageOpts::operator== ======================== */ ID_INLINE bool idImageOpts::operator==( const idImageOpts& opts ) { return ( memcmp( this, &opts, sizeof( *this ) ) == 0 ); } #endif
#include<stdio.h> #include<stdlib.h> #include "tree.h" int main() { int choice, number, minimumNo; tree *t; t = init(t); while(1) { printf("Choose option\n1. Insert\n2. Delete\n3. Inorder\n4. Exit\n"); scanf("%d", &choice); switch(choice) { case 1: printf("Enter the number\n"); scanf("%d", &number); insert(&t, number); break; case 2: printf("Enter the number\n"); scanf("%d", &number); t = delete_node(t, number); break; case 3: inorder(t); printf("\n"); break; case 4: exit(0); } } }
///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions 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 "cvfVector3.h" #include <vector> namespace cvf { class GeometryBuilder; } //================================================================================================== // // Generates 2D patches based on predefined coordinates along u and v axis // Inspired by cvf::PatchGenerator // //================================================================================================== class RivPatchGenerator { public: RivPatchGenerator(); void setOrigin( const cvf::Vec3d& origin ); void setAxes( const cvf::Vec3d& axisU, const cvf::Vec3d& axisV ); void setSubdivisions( const std::vector<double>& uValues, const std::vector<double>& vValues ); void generate( cvf::GeometryBuilder* builder ); private: cvf::Vec3d m_origin; // Origin. Default (0, 0, 0) cvf::Vec3d m_axisU; // First axis of patch. Default is global X-axis cvf::Vec3d m_axisV; // Second axis of patch. Default is global Y-axis std::vector<double> m_uValues; std::vector<double> m_vValues; bool m_useQuads; // If true, quads will be generated, otherwise triangles. Default is quads bool m_windingCCW; // Winding of the generated quads. Controls which side of the patch will be front facing. };
#ifndef EVENTMIXER_TOYMCEVENT_H__ #define EVENTMIXER_TOYMCEVENT_H__ #include "../config/MixerSettings.h" #include "TTree.h" #include "TLorentzVector.h" #include <memory> /** * Toy MC input event. * Provides only the two 4-vectors of the single muons. */ class ToyMCEvent{ public: ToyMCEvent() = default; ToyMCEvent(const ToyMCEvent& other); void Init(std::unique_ptr<TTree>& tree) { Init(tree.get()); } void Init(TTree* tree); void Print() { m_muNeg->Print(); m_muPos->Print(); } const TLorentzVector& muPos() const { return *m_muPos; } const TLorentzVector& muNeg() const { return *m_muNeg; } private: TLorentzVector* m_muPos{new TLorentzVector()}; TLorentzVector* m_muNeg{new TLorentzVector()}; }; void ToyMCEvent::Init(TTree* tree) { tree->SetBranchAddress(config::InputTree.muNegName.c_str(), &m_muNeg); tree->SetBranchAddress(config::InputTree.muPosName.c_str(), &m_muPos); } ToyMCEvent::ToyMCEvent(const ToyMCEvent& other) : m_muPos(clone(other.m_muPos)), m_muNeg(clone(other.m_muNeg)) { // Nothing to do here } #endif
/* * Phytec pcm030 driver for the PSC of the Freescale MPC52xx * configured as AC97 interface * * Copyright 2008 Jon Smirl, Digispeaker * Author: Jon Smirl <jonsmirl@gmail.com> * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. */ #include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/of_device.h> #include <linux/of_platform.h> #include <sound/soc.h> #include "mpc5200_dma.h" #define DRV_NAME "pcm030-audio-fabric" struct pcm030_audio_data { struct snd_soc_card *card; struct platform_device *codec_device; }; static struct snd_soc_dai_link pcm030_fabric_dai[] = { { .name = "AC97.0", .stream_name = "AC97 Analog", .codec_dai_name = "wm9712-hifi", .cpu_dai_name = "mpc5200-psc-ac97.0", .codec_name = "wm9712-codec", }, { .name = "AC97.1", .stream_name = "AC97 IEC958", .codec_dai_name = "wm9712-aux", .cpu_dai_name = "mpc5200-psc-ac97.1", .codec_name = "wm9712-codec", }, }; static struct snd_soc_card pcm030_card = { .name = "pcm030", .owner = THIS_MODULE, .dai_link = pcm030_fabric_dai, .num_links = ARRAY_SIZE(pcm030_fabric_dai), }; static int pcm030_fabric_probe(struct platform_device *op) { struct device_node *np = op->dev.of_node; struct device_node *platform_np; struct snd_soc_card *card = &pcm030_card; struct pcm030_audio_data *pdata; int ret; int i; if (!of_machine_is_compatible("phytec,pcm030")) { return -ENODEV; } pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data), GFP_KERNEL); if (!pdata) { return -ENOMEM; } card->dev = &op->dev; pdata->card = card; platform_np = of_parse_phandle(np, "asoc-platform", 0); if (!platform_np) { dev_err(&op->dev, "ac97 not registered\n"); return -ENODEV; } for (i = 0; i < card->num_links; i++) { card->dai_link[i].platform_of_node = platform_np; } ret = request_module("snd-soc-wm9712"); if (ret) { dev_err(&op->dev, "request_module returned: %d\n", ret); } pdata->codec_device = platform_device_alloc("wm9712-codec", -1); if (!pdata->codec_device) { dev_err(&op->dev, "platform_device_alloc() failed\n"); } ret = platform_device_add(pdata->codec_device); if (ret) { dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); } ret = snd_soc_register_card(card); if (ret) { dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); } platform_set_drvdata(op, pdata); return ret; } static int pcm030_fabric_remove(struct platform_device *op) { struct pcm030_audio_data *pdata = platform_get_drvdata(op); int ret; ret = snd_soc_unregister_card(pdata->card); platform_device_unregister(pdata->codec_device); return ret; } static const struct of_device_id pcm030_audio_match[] = { { .compatible = "phytec,pcm030-audio-fabric", }, {} }; MODULE_DEVICE_TABLE(of, pcm030_audio_match); static struct platform_driver pcm030_fabric_driver = { .probe = pcm030_fabric_probe, .remove = pcm030_fabric_remove, .driver = { .name = DRV_NAME, .of_match_table = pcm030_audio_match, }, }; module_platform_driver(pcm030_fabric_driver); MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver"); MODULE_LICENSE("GPL");
/* * Copyright (C) 2006-2008 Nokia Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; see the file COPYING. If not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Test random reads, writes and erases on MTD device. * * Author: Adrian Hunter <ext-adrian.hunter@nokia.com> */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/err.h> #include <linux/mtd/mtd.h> #include <linux/slab.h> #include <linux/sched.h> #include <linux/vmalloc.h> #include <linux/random.h> #include "mtd_test.h" static int dev = -EINVAL; module_param(dev, int, S_IRUGO); MODULE_PARM_DESC(dev, "MTD device number to use"); static int count = 10000; module_param(count, int, S_IRUGO); MODULE_PARM_DESC(count, "Number of operations to do (default is 10000)"); static struct mtd_info *mtd; static unsigned char *writebuf; static unsigned char *readbuf; static unsigned char *bbt; static int *offsets; static int pgsize; static int bufsize; static int ebcnt; static int pgcnt; static int rand_eb(void) { unsigned int eb; again: eb = prandom_u32(); /* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */ eb %= (ebcnt - 1); if (bbt[eb]) { goto again; } return eb; } static int rand_offs(void) { unsigned int offs; offs = prandom_u32(); offs %= bufsize; return offs; } static int rand_len(int offs) { unsigned int len; len = prandom_u32(); len %= (bufsize - offs); return len; } static int do_read(void) { int eb = rand_eb(); int offs = rand_offs(); int len = rand_len(offs); loff_t addr; if (bbt[eb + 1]) { if (offs >= mtd->erasesize) { offs -= mtd->erasesize; } if (offs + len > mtd->erasesize) { len = mtd->erasesize - offs; } } addr = (loff_t)eb * mtd->erasesize + offs; return mtdtest_read(mtd, addr, len, readbuf); } static int do_write(void) { int eb = rand_eb(), offs, err, len; loff_t addr; offs = offsets[eb]; if (offs >= mtd->erasesize) { err = mtdtest_erase_eraseblock(mtd, eb); if (err) { return err; } offs = offsets[eb] = 0; } len = rand_len(offs); len = ((len + pgsize - 1) / pgsize) * pgsize; if (offs + len > mtd->erasesize) { if (bbt[eb + 1]) { len = mtd->erasesize - offs; } else { err = mtdtest_erase_eraseblock(mtd, eb + 1); if (err) { return err; } offsets[eb + 1] = 0; } } addr = (loff_t)eb * mtd->erasesize + offs; err = mtdtest_write(mtd, addr, len, writebuf); if (unlikely(err)) { return err; } offs += len; while (offs > mtd->erasesize) { offsets[eb++] = mtd->erasesize; offs -= mtd->erasesize; } offsets[eb] = offs; return 0; } static int do_operation(void) { if (prandom_u32() & 1) { return do_read(); } else { return do_write(); } } static int __init mtd_stresstest_init(void) { int err; int i, op; uint64_t tmp; printk(KERN_INFO "\n"); printk(KERN_INFO "=================================================\n"); if (dev < 0) { pr_info("Please specify a valid mtd-device via module parameter\n"); pr_crit("CAREFUL: This test wipes all data on the specified MTD device!\n"); return -EINVAL; } pr_info("MTD device: %d\n", dev); mtd = get_mtd_device(NULL, dev); if (IS_ERR(mtd)) { err = PTR_ERR(mtd); pr_err("error: cannot get MTD device\n"); return err; } if (mtd->writesize == 1) { pr_info("not NAND flash, assume page size is 512 " "bytes.\n"); pgsize = 512; } else { pgsize = mtd->writesize; } tmp = mtd->size; do_div(tmp, mtd->erasesize); ebcnt = tmp; pgcnt = mtd->erasesize / pgsize; pr_info("MTD device size %llu, eraseblock size %u, " "page size %u, count of eraseblocks %u, pages per " "eraseblock %u, OOB size %u\n", (unsigned long long)mtd->size, mtd->erasesize, pgsize, ebcnt, pgcnt, mtd->oobsize); if (ebcnt < 2) { pr_err("error: need at least 2 eraseblocks\n"); err = -ENOSPC; goto out_put_mtd; } /* Read or write up 2 eraseblocks at a time */ bufsize = mtd->erasesize * 2; err = -ENOMEM; readbuf = vmalloc(bufsize); writebuf = vmalloc(bufsize); offsets = kmalloc(ebcnt * sizeof(int), GFP_KERNEL); if (!readbuf || !writebuf || !offsets) { goto out; } for (i = 0; i < ebcnt; i++) { offsets[i] = mtd->erasesize; } prandom_bytes(writebuf, bufsize); bbt = kzalloc(ebcnt, GFP_KERNEL); if (!bbt) { goto out; } err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); if (err) { goto out; } /* Do operations */ pr_info("doing operations\n"); for (op = 0; op < count; op++) { if ((op & 1023) == 0) { pr_info("%d operations done\n", op); } err = do_operation(); if (err) { goto out; } err = mtdtest_relax(); if (err) { goto out; } } pr_info("finished, %d operations done\n", op); out: kfree(offsets); kfree(bbt); vfree(writebuf); vfree(readbuf); out_put_mtd: put_mtd_device(mtd); if (err) { pr_info("error %d occurred\n", err); } printk(KERN_INFO "=================================================\n"); return err; } module_init(mtd_stresstest_init); static void __exit mtd_stresstest_exit(void) { return; } module_exit(mtd_stresstest_exit); MODULE_DESCRIPTION("Stress test module"); MODULE_AUTHOR("Adrian Hunter"); MODULE_LICENSE("GPL");
/*========================================================================= Program: ParaView Module: vtkWeightedRedistributePolyData.h Copyright (c) Kitware, Inc. All rights reserved. See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /*---------------------------------------------------------------------------- Copyright (c) Los Alamos National Laboratory See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. ----------------------------------------------------------------------------*/ // .NAME vtkWeightedRedistributePolyData - do weighted balance of cells on processors #ifndef vtkWeightedRedistributePolyData_h #define vtkWeightedRedistributePolyData_h #include "vtkRedistributePolyData.h" #include "vtkPVVTKExtensionsRenderingModule.h" // needed for export macro class vtkMultiProcessController; //******************************************************************* class VTKPVVTKEXTENSIONSRENDERING_EXPORT vtkWeightedRedistributePolyData : public vtkRedistributePolyData { public: vtkTypeMacro(vtkWeightedRedistributePolyData, vtkRedistributePolyData); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Construct object. static vtkWeightedRedistributePolyData *New(); void SetWeights (int, int, float ); protected: vtkWeightedRedistributePolyData(); ~vtkWeightedRedistributePolyData(); //BTX enum { NUM_LOC_CELLS_TAG = 70, SCHED_LEN_1_TAG = 300, SCHED_LEN_2_TAG = 301, SCHED_1_TAG = 310, SCHED_2_TAG = 311 }; //ETX virtual void MakeSchedule (vtkPolyData* input, vtkCommSched*); float* Weights; private: vtkWeightedRedistributePolyData(const vtkWeightedRedistributePolyData&); // Not implemented void operator=(const vtkWeightedRedistributePolyData&); // Not implemented }; //**************************************************************** #endif
#include <pthread.h> int thread_flag; pthread_mutex_t thread_flag_mutex; void initialize_flag(void) { pthread_mutex_init(&thread_flag_mutex, NULL) thread_flag = 0; } void do_work() { } void* thread_function(void* arg) { while(1) { int flag_is_set; pthread_mutex_lock(&thread_flag_mutex); flag_is_set = thread_flag; pthread_mutex_unlock(&thread_flag_mutex); if(flag_is_set) { do_work(); } } return NULL; } void set_thread_flag(int flag_value) { pthread_mutex_lock(&thread_flag_mutex); thread_flag = flag_value; pthread_mutex_unlock(&thread_flag_mutex); } int main() { pthread_t thread_id; // create a new thread pthread_create(&thread_id, NULL, &thread_function, NULL); pthread_join(thread_id, NULL); return 0; }
// (c) Michael Buro 1992-2002, licensed under the GNU Public License, version 2 // fastest first search at the bottom of the tree / 7.99 // doesn't work #include "main.h" #include "ffend.h" #include "end.h" #if !LAZY_UPDATE #error "LAZY_UPDATE false" #endif #define FF_SORT_MAX 58 inline bool move_ok(Square *p, int Pos, PARTEI to_move, PARTEI opp, int d) { if (p[Pos+d] != opp) return false; register Square *r_p=&p[Pos+d+d];\ FOREVER { if (*r_p != opp) break; r_p += d; if (*r_p != opp) break; r_p += d; if (*r_p != opp) break; r_p += d; if (*r_p != opp) break; r_p += d; if (*r_p != opp) break; r_p += d; break; } return *r_p == to_move; } inline int mobility(BRETT *pbr, PARTEI Partei, SFPOS *free_list) { int m = 0; Square *p=pbr->p; int mv; while ((mv = *free_list++)) { if (p[mv] == LEER) { if (move_ok(p, mv, Partei, GEGNER(Partei), +1) || move_ok(p, mv, Partei, GEGNER(Partei), -1) || move_ok(p, mv, Partei, GEGNER(Partei), +10) || move_ok(p, mv, Partei, GEGNER(Partei), -10) || move_ok(p, mv, Partei, GEGNER(Partei), +11) || move_ok(p, mv, Partei, GEGNER(Partei), -11) || move_ok(p, mv, Partei, GEGNER(Partei), +9) || move_ok(p, mv, Partei, GEGNER(Partei), -9)) m++; } } return m; } int FFEndAlphaBeta( ZUGIO *pzio, // pointer to global variables PARTEI Partei, // player to move int al, // alpha-beta window int be, int last_move, SFPOS *free_list ) { int i, ZugAnz, KZug; SFPOS BestZug, AktZug, HashZug; BRETT *pbr; DELTA Delta; int value, lo_value, hi_value, max; KILLTAB *Kill; SFPOS *pl, f_list[65]; UMGEB *pu; pzio->cio.BewAnz++; pbr = &pzio->Brett; if (--zaehler < 0) { pzio->Check(&pzio->cio, pzio, false, false); zaehler = CHECK_COUNT; } if (pbr->SteinAnz >= 63) { // 63 -> board almost full if (pbr->SteinAnz == 64) ANTI_RET(BEWDIFF); else { // one square free -> immediate move pzio->cio.BewAnz++; AktZug = 3168 - pbr->SteinSumme; if (pbr->StDiffBW != (value=EndSetzDiff(pbr, Partei, AktZug))) { ANTI_RET(Partei == BLACK ? value : -value); } else if (pbr->StDiffBW != (value=EndSetzDiff(pbr, GEGNER(Partei), AktZug))) { ANTI_RET(Partei == BLACK ? value : -value); } BEWTEST ANTI_RET(BEWDIFF1); } } if (!free_list) { // init free square list if not provided Square *p=pzio->Brett.p; SFPOS *pk=pzio->killer.DefaultKill, *pf = f_list; for (i=pzio->killer.FreiAnz; i > 0; i--) { int move = *pk++; if (p[move] == LEER) *pf++ = move; } *pf = 0; free_list = f_list; } if (pbr->SteinAnz <= FF_SORT_MAX) { // sort according to minimum opponent mob. ZUGDAT zd[65]; int k = 0; int mv; SFPOS *p = free_list; while ((mv=*p++)) { if (pbr->p[mv] == LEER) { zd[k].Zug = mv; if (EndSetzen(pbr, Partei, mv, &Delta)) { zd[k].Wert = - -mobility(pbr, GEGNER(Partei), free_list); EndZurueck(pbr, Partei, mv, &Delta); } else { zd[k].Wert = -1000; } k++; } } qsort((char*)zd, (size_t) k, sizeof(ZUGDAT), compZUGDAT); #if 0 { SPFELD sf; BrettSf(pbr, &sf); //SfAus(&sf, 0, 0); //printf("%d \n", Partei); //FOR (i, k) { KoorAus(zd[i].Zug); printf(" %d\n", zd[i].Wert); } //puts(""); if (64-SfAnz(&sf) != k) printf("!!!!!!!!!!!!!!!\n"); } #endif FOR (i, k) f_list[i] = zd[i].Zug; f_list[k] = 0; free_list = f_list; } ZugAnz = 0; lo_value = WERTMIN; max = al; for (pu=free_list; (AktZug=*pu); pu++) { if (pbr->p[AktZug] == LEER && EndSetzen(pbr, Partei, AktZug, &Delta)) { ZugAnz++; value = - FFEndAlphaBeta(pzio, GEGNER(Partei), -be, -max, AktZug, free_list); #if 0 if (pbr->SteinAnz >= 60) { int val2 = - EndAlphaBeta1(pzio, GEGNER(Partei), -be, -max, AktZug); if (value != val2) { SPFELD sf; BrettSf(pbr, &sf); SfAus(&sf, 0, 0); printf("p=%d al=%d be=%d val=%d val2=%d\n\n", GEGNER(Partei), max, be, value, val2); } } #endif EndZurueck(pbr, Partei, AktZug, &Delta); if (value > lo_value) { lo_value = value; // update if better if (lo_value >= be) return lo_value; // beta cut if (lo_value > max) max = lo_value; } } } if (ZugAnz == 0) { // no move if (last_move == ZUG_PASSEN) { // neither player has a move BEWTEST ANTI_RET(BEWDIFF1); } else { // pass return -FFEndAlphaBeta(pzio, GEGNER(Partei), -be, -al, ZUG_PASSEN, free_list); } } return lo_value; }
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * LICENSE: See LICENSE in the top level directory * FILE: sdk/game/CSettings.h * PURPOSE: Game settings interface * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ #ifndef __CGAME_SETTINGS #define __CGAME_SETTINGS #if (!defined(RWFORCEENUMSIZEINT)) #define RWFORCEENUMSIZEINT ((int)((~((unsigned int)0))>>1)) #endif /* (!defined(RWFORCEENUMSIZEINT)) */ enum VideoModeFlag // RwVideoModeFlag { rwVIDEOMODEEXCLUSIVE = 0x0001, /**<Exclusive (i.e. full-screen) */ rwVIDEOMODEINTERLACE = 0x0002, /**<Interlaced */ rwVIDEOMODEFFINTERLACE = 0x0004, /**<Flicker Free Interlaced */ /* Platform specific video mode flags. */ rwVIDEOMODE_PS2_FSAASHRINKBLIT = 0x0100, /**< \if sky2 * Full-screen antialiasing mode 0 * \endif */ rwVIDEOMODE_PS2_FSAAREADCIRCUIT = 0x0200, /**< \if sky2 * Full-screen antialiasing mode 1 * \endif */ rwVIDEOMODE_XBOX_WIDESCREEN = 0x0100, /**< \if xbox * Wide screen. * \endif */ rwVIDEOMODE_XBOX_PROGRESSIVE = 0x0200, /**< \if xbox * Progressive. * \endif */ rwVIDEOMODE_XBOX_FIELD = 0x0400, /**< \if xbox * Field rendering. * \endif */ rwVIDEOMODE_XBOX_10X11PIXELASPECT = 0x0800, /**< \if xbox * The frame buffer is centered on the display. * On a TV that is 704 pixels across, this would leave 32 pixels of black * border on the left and 32 pixels of black border on the right. * \endif */ rwVIDEOMODEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; struct VideoMode //RwVideoMode { int width; /**< Width */ int height; /**< Height */ int depth; /**< Depth */ VideoModeFlag flags; /**< Flags */ int refRate; /**< Approximate refresh rate */ int format; /**< Raster format * \see RwRasterFormat */ }; enum eAspectRatio { ASPECT_RATIO_AUTO, ASPECT_RATIO_4_3, ASPECT_RATIO_16_10, ASPECT_RATIO_16_9, }; class CGameSettings { public: virtual bool IsWideScreenEnabled ( void ) = 0; virtual void SetWideScreenEnabled ( bool bEnabled ) = 0; virtual unsigned int GetNumVideoModes ( void ) = 0; virtual VideoMode * GetVideoModeInfo ( VideoMode * modeInfo, unsigned int modeIndex ) = 0; virtual unsigned int GetCurrentVideoMode ( void ) = 0; virtual void SetCurrentVideoMode ( unsigned int modeIndex, bool bOnRestart ) = 0; virtual unsigned char GetRadioVolume ( void ) = 0; virtual void SetRadioVolume ( unsigned char ucVolume ) = 0; virtual unsigned char GetSFXVolume ( void ) = 0; virtual void SetSFXVolume ( unsigned char ucVolume ) = 0; virtual unsigned int GetUsertrackMode ( void ) = 0; virtual void SetUsertrackMode ( unsigned int uiMode ) = 0; virtual bool IsUsertrackAutoScan ( void ) = 0; virtual void SetUsertrackAutoScan ( bool bEnable ) = 0; virtual bool IsRadioEqualizerEnabled ( void ) = 0; virtual void SetRadioEqualizerEnabled( bool bEnable ) = 0; virtual bool IsRadioAutotuneEnabled ( void ) = 0; virtual void SetRadioAutotuneEnabled ( bool bEnable ) = 0; virtual float GetDrawDistance ( void ) = 0; virtual void SetDrawDistance ( float fDrawDistance ) = 0; virtual unsigned int GetBrightness ( void ) = 0; virtual void SetBrightness ( unsigned int uiBrightness ) = 0; virtual unsigned int GetFXQuality ( void ) = 0; virtual void SetFXQuality ( unsigned int fxQualityId ) = 0; virtual float GetMouseSensitivity ( void ) = 0; virtual void SetMouseSensitivity ( float fSensitivity ) = 0; virtual unsigned int GetAntiAliasing ( void ) = 0; virtual void SetAntiAliasing ( unsigned int uiAntiAliasing, bool bOnRestart ) = 0; virtual bool IsMipMappingEnabled ( void ) = 0; virtual void SetMipMappingEnabled ( bool bEnable ) = 0; virtual bool IsVolumetricShadowsEnabled ( void ) = 0; virtual void SetVolumetricShadowsEnabled ( bool bEnable ) = 0; virtual eAspectRatio GetAspectRatio ( void ) = 0; virtual void SetAspectRatio ( eAspectRatio aspectRatio ) = 0; virtual bool IsGrassEnabled ( void ) = 0; virtual void SetGrassEnabled ( bool bEnable ) = 0; virtual void Save ( void ) = 0; }; #endif
/* * Licensed to Green Energy Corp (www.greenenergycorp.com) under one or * more contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright ownership. * Green Energy Corp licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This project was forked on 01/01/2013 by Automatak, LLC and modifications * may have been made to this file. Automatak, LLC licenses these modifications * to you under the terms of the License. */ #ifndef OPENDNP3_REQUESTHISTORY_H #define OPENDNP3_REQUESTHISTORY_H #include <cstdint> #include "opendnp3/app/APDUHeader.h" #include <openpal/container/RSlice.h> namespace opendnp3 { /// Tracks the state of the last request ASDU class RequestHistory { public: RequestHistory(); bool HasLastRequest() const { return hasLast; } void Reset(); void RecordLastProcessedRequest(const APDUHeader& header, const openpal::RSlice& objects); APDUHeader GetLastHeader() const; bool EqualsLastObjects(const openpal::RSlice& objects) const; bool FullyEqualsLastRequest(const APDUHeader& header, const openpal::RSlice& objects) const; private: bool hasLast; APDUHeader lastHeader; uint16_t lastDigest; uint32_t lastObjectsLength; }; } #endif
/* * 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 void initIbusTelemetry(telemetryConfig_t *); void handleIbusTelemetry(void); void checkIbusTelemetryState(void); void configureIbusTelemetryPort(void); void freeIbusTelemetryPort(void);
/* Auxiliary program to test mbrtowc(3) behaviour. Copyright 2016-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see <https://www.gnu.org/licenses/>. */ /* Test the operating-system's native mbrtowc(3) function, by feeding it multibyte seqeunces one byte at a time, and reporting the result. The program prints the following values after each mbrtowc invocation, separated by commas: -2 the octet is contributes to a valid yet incomplete multibyte sequence in the current locale. -1 the octet causes an encoding error. 0 the octet represents a NUL byte 1 the octet is a valid single-byte character, OR completes a valid multibyte sequence. Because the program invokes mbrtowc(3) byte-by-byte, the reported result should never be larger than 1. Example of typical output with UTF-8 encoding --------------------------------------------- The unicode character 'N-ARY SUMMATION' (U+2211), encoded in UTF-8 as: hex: 0xE2 0x88 0x91 oct: 342 210 211 Decoding the valid sequence byte-by-byte gives: $ printf '\342\210\221' | LC_ALL=en_US.UTF-8 test-mbrtowc -2,-2,1 '\210' is not a valid leading byte in UTF-8, thus the first byte gives -1, and the 'X' is treated as a valid single-byte character: $ printf '\210X' | LC_ALL=en_US.UTF-8 test-mbrtowc -1,1 '\342' is a valid yet incomplete multibyte sequence. Passing it to mbrtowc results in value '-2'. The following value 'X' gives an encoding error '-1' (as 'X' is not a valid trailing byte in a multibyte UTF-8 sequence): $ printf '\342X' | LC_ALL=en_US.UTF-8 test-mbrtowc -2,-1 Detecting implementation bugs in mbrtowc ---------------------------------------- UTF-8 implementation is correct on most operating systems. Other multibyte locales might present more difficulties. An example is the Japanese SHIFT-JIS locale under Mac OS X. NOTE: The locale is 'ja_JP.SJIS' under Mac OS X, 'ja_JP.shiftjis' under Ubuntu. 'ja_JP.sjis' was also found on some systems. Using unicode character 'KATAKANA LETTER ZE' (U+30BC) UTF-8: hex: 0xE3 0x82 0xBC Shift-jis hex: 0x83 0x5B oct: 203 133 The following is a valid multibyte sequence in SHIFT-JIS, the first byte should result in '-2' (valid yet incomplete), and the second byte should result in '1' (a valid multibyte sequence completed): $ printf '\203\133' | LC_ALL=ja_JP.SJIS test-mbrtowc -2,1 The follwing is an INVALID multibyte sequence in SHIFT-JIS (The byte ':' is not valid as a second octet). Buggy implementations will accept this as a valid multibyte sequence: # NOTE: this result indicates a buggy mbrtowc $ printf '\203:' | LC_ALL=ja_JP.SJIS test-mbrtowc -2,1 A correct implementations should report '-1' for the second byte (i.e. an encoding error): $ printf '\203:' | LC_ALL=ja_JP.SJIS test-mbrtowc -2,-1 Expected results with correct implementations --------------------------------------------- In GNU Sed some tests purposely use invalid multibyte sequences to test sed's behaviour. A buggy implemetation of mbrtowc would result in false-alarm failures. The following are expected results in correct implementations: (locale names are from Mac OS X): $ printf '\203\133' | LC_ALL=ja_JP.SJIS test-mbrtowc -2,1 $ printf '\203:' | LC_ALL=ja_JP.SJIS test-mbrtowc -2,-1 $ printf '\262C' | LC_ALL=ja_JP.eucJP test-mbrtowc -2,-1 */ #include <config.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <wchar.h> #include "closeout.h" #include "error.h" #include "progname.h" /* stub replacement for non-standard err(3) */ static int die (const char *msg) { error (0, 0, "%s: error: %s\n", program_name, msg); exit (EXIT_FAILURE); } int main (int argc, char **argv) { int c; int first = 1; set_program_name (argv[0]); if (!setlocale (LC_ALL, "")) die ("failed to set locale"); while ((c = getchar ()) != EOF) { wchar_t wc; char ch = (unsigned char) c; int i = (int) mbrtowc (&wc, &ch, 1, NULL); if (!first) putchar (','); first = 0; printf ("%d", i); } if (first) die ("empty input"); putchar ('\n'); if (ferror (stdin)) die ("read error"); close_stdout (); exit (EXIT_SUCCESS); }
/* * Copyright (C) 2003-2017 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 <http://www.gnu.org/licenses/>. */ #ifndef WEECHAT_SCRIPT_ACTION_H #define WEECHAT_SCRIPT_ACTION_H 1 extern char *script_actions; extern int script_action_run (); extern void script_action_schedule (const char *action, int need_repository, int quiet); #endif /* WEECHAT_SCRIPT_ACTION_H */
/** * \file IMP/deprecation.h * \brief Control display of deprecation information. * * Copyright 2007-2017 IMP Inventors. All rights reserved. * */ #ifndef IMPKERNEL_DEPRECATION_H #define IMPKERNEL_DEPRECATION_H #include <IMP/kernel_config.h> IMPKERNEL_BEGIN_NAMESPACE //! Toggle printing of warnings on using deprecated classes /** If set to true (the default) a warning is printed every time a class marked as deprecated is used. */ IMPKERNELEXPORT void set_deprecation_warnings(bool tf); //! Toggle whether an exception is thrown when a deprecated method is used. IMPKERNELEXPORT void set_deprecation_exceptions(bool tf); //! Get whether an exception is thrown when a deprecated method is used. IMPKERNELEXPORT bool get_deprecation_exceptions(); /** Break in this method in gdb to find deprecated uses at runtime. */ IMPKERNELEXPORT void handle_use_deprecated(std::string message); IMPKERNEL_END_NAMESPACE #endif /* IMPKERNEL_DEPRECATION_H */
// /* for i:=0; i < li; i++ { //place value in state state[local_frame]=in[i] //calculate output out[i] = complex64(C.convolute((*C.float_t)(&coeffs[0]),(*C.complexfloat)(&state[0]),(*C.uint32_t)(&lc),(*C.uint32_t)(&local_frame))) //shift fir_frame local_frame = (local_frame + 1) % lc } */ #include <stdint.h> #include <math.h> #include <complex.h> float complex convolute(const float_t * coeffs, float complex * state, uint32_t * lc, uint32_t * local_frame) { int32_t j; float complex retval; retval = 0.0; for(j=0;j<*lc;j++) { retval = retval + (coeffs[j] * state[((j+*local_frame)%*lc)]); } return retval; } //calculates the convolution of a whole input buffer in place float complex * filter(float_t * coeffs, float complex * state, const uint32_t lc, float complex * input, const uint32_t li, uint32_t * local_frame) { int32_t i; int32_t j; for(i=0; i < li; i++) { //for each sample in input //place the sample in state state[*local_frame]=input[i]; //calculate the output input[i] = 0.0; for(j=0;j< lc;j++) { input[i] = input[i] + (coeffs[j] * state[((j+*local_frame)%lc)]); } //shift the local_frame (move one ahead in the state circular buffer) *local_frame = (*local_frame + 1) % lc; } return input; }
#pragma once #include "Node.h" #include "math.h" #include <cstring> /** Handles binary operations * @author Jim Ahlstrand * @todo add test for number of children, binop can have max 2 */ class Binop : public Node { public: //! Defines types of Binops enum Type { Undefined, Equal, Addition, Subtraction, Division, Multiplication, Power, Modulo }; // Constructors // --------------------------------------- //! Default constructor Binop(); /** Constructor with type * @param type Binop type of enum Type */ Binop(Type type); // Methods // --------------------------------------- /** Executes the Node * @param env current Environment * @return bool true if node did execute */ bool execute(Environment& env); /** Evaluate integer of the Binop * @param env current Environment * @return integer value of the node */ int evalInt(Environment& env); /** Evaluate string of the Binop * @param env current Environment * @return string value of the node */ std::string evalStr(Environment& env); /** Converts type of node to string * @return string type of the node */ std::string getType(); protected: // Properties // --------------------------------------- //! Binop type Type type; };
#ifndef _screen_screens_h #define _screen_screens_h enum screens { START_SCREEN, GAME_SCREEN }; /* Getters and setters */ int getScreenWidth(); int getScreenHeight(); enum screens getScreen(); void setScreenWidth(int newScreenWidth); void setScreenHeight(int newScreenHeight); void setScreen(enum screens newScreen); int initScreen(); void cleanupScreen(); #endif
/* This file is part of Genesys. Genesys 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. Genesys 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 Genesys. If not, see <http://www.gnu.org/licenses/>. Copyright (C) 2016 Clemens Kirchgatterer <clemens@1541.org>. */ #ifndef _UPDATE_H_ #define _UPDATE_H_ /* <?PHP header('Content-type: text/plain; charset=utf8', true); function check_header($name, $value = false) { if(!isset($_SERVER[$name])) { return false; } if($value && $_SERVER[$name] != $value) { return false; } return true; } function sendFile($path) { header($_SERVER["SERVER_PROTOCOL"].' 200 OK', true, 200); header('Content-Type: application/octet-stream', true); header('Content-Disposition: attachment; filename='.basename($path)); header('Content-Length: '.filesize($path), true); header('x-MD5: '.md5_file($path), true); readfile($path); } if(!check_header('HTTP_USER_AGENT', 'ESP8266-http-Update')) { header($_SERVER["SERVER_PROTOCOL"].' 403 Forbidden', true, 403); echo "only for ESP8266 updater!\n"; exit(); } if( !check_header('HTTP_X_ESP8266_STA_MAC') || !check_header('HTTP_X_ESP8266_AP_MAC') || !check_header('HTTP_X_ESP8266_FREE_SPACE') || !check_header('HTTP_X_ESP8266_SKETCH_SIZE') || !check_header('HTTP_X_ESP8266_CHIP_SIZE') || !check_header('HTTP_X_ESP8266_SDK_VERSION') || !check_header('HTTP_X_ESP8266_VERSION') ) { header($_SERVER["SERVER_PROTOCOL"].' 403 Forbidden', true, 403); echo "only for ESP8266 updater! (header)\n"; exit(); } $db = array( "18:FE:AA:AA:AA:AA" => "DOOR-7-g14f53a19", "18:FE:AA:AA:AA:BB" => "TEMP-1.0.0" ); if(isset($db[$_SERVER['HTTP_X_ESP8266_STA_MAC']])) { if($db[$_SERVER['HTTP_X_ESP8266_STA_MAC']] != $_SERVER['HTTP_X_ESP8266_VERSION']) { sendFile("./bin/".$db[$_SERVER['HTTP_X_ESP8266_STA_MAC']]."bin"); } else { header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified', true, 304); } exit(); } header($_SERVER["SERVER_PROTOCOL"].' 500 no version for ESP MAC', true, 500); */ int update_state(void); bool update_init(void); bool update_fini(void); void update_poll(void); #endif // _UPDATE_H_
/************************************************************************** This file is part of JahshakaVR, VR Authoring Toolkit http://www.jahshaka.com Copyright (c) 2016 GPLv3 Jahshaka LLC <coders@jahshaka.com> This is free software: you may copy, redistribute and/or modify it under the terms of the GPLv3 License For more information see the LICENSE file *************************************************************************/ #ifndef PHYSICSPROPERTYWIDGET_H #define PHYSICSPROPERTYWIDGET_H #include <QWidget> #include <QSharedPointer> #include "irisgl/src/irisglfwd.h" #include "../accordianbladewidget.h" class SceneViewWidget; class btRigidBody; class PhysicsPropertyWidget : public AccordianBladeWidget { Q_OBJECT public: PhysicsPropertyWidget(); ~PhysicsPropertyWidget(); void setSceneNode(iris::SceneNodePtr sceneNode); void setSceneView(SceneViewWidget *sceneView); protected slots: void onPhysicsTypeChanged(int); void onPhysicsShapeChanged(int); void onVisibilityChanged(bool); void onMassChanged(float); void onMarginChanged(float); void onFrictionChanged(float); void onBouncinessChanged(float); private: btRigidBody *currentBody; iris::SceneNodePtr sceneNode; SceneViewWidget *sceneView; CheckBoxWidget* isVisible; HFloatSliderWidget *massValue; HFloatSliderWidget *frictionValue; HFloatSliderWidget *bouncinessValue; HFloatSliderWidget *marginValue; ComboBoxWidget *physicsTypeSelector; ComboBoxWidget *physicsShapeSelector; QMap<int, QString> physicsTypes; QMap<int, QString> physicsShapes; }; #endif // PHYSICSPROPERTYWIDGET_HPP
#include <stdio.h> int s[100005], f[100005]; inline int min(int a,int b) { return a < b ? a : b; } int main() { int i,n,m,a,b,t; scanf("%d",&n); for (i = 1;i <= n;++i) { scanf("%d",&s[i]); f[i + 1] = f[i] + s[i]; } scanf("%d",&m); for (i = 1;i <= m;++i) { scanf("%d%d",&a,&b); if (a > b) { t = a;a = b;b = t; } printf("%d\n",min(f[b] - f[a],f[n + 1] - f[b] + f[a])); } return 0; }
#ifndef __TELNETP_H__ #define __TELNETP_H__ #include "utils.h" #include "ansi_p_codes.h" enum { TO_COMPRESS, TO_COMPRESS2, TO_SUPRESS_GO_AHEAD, TO_ECHO, TO_NUM_OPTIONS }; enum echo_types { ET_SERVER_WILL_ECHO, ET_SERVER_DO_ECHO }; struct ascii_callback { unsigned char c; }; struct ansi_callback_1arg { int arg; }; struct ansi_callback_2arg { int arg1, arg2; }; /* ANSI SGR OPTIONS */ #define ASGR_RESET 0 #define ASGR_BRIGHT 1 #define ASGR_FAINT 2 #define ASGR_ITALIC_ON 3 #define ASGR_UNDERLINE_SING 4 #define ASGR_BLINK_SLOW 5 #define ASGR_BLINK_RAPID 6 #define ASGR_IMAGE_NEGATIVE 7 #define ASGR_CONCEAL 8 #define ASGR_CROSSED_OUT 9 #define ASGR_DEFAULT_FONT 10 #define ASGR_ALT_FONT1 11 #define ASGR_ALT_FONT2 12 #define ASGR_ALT_FONT3 13 #define ASGR_ALT_FONT4 14 #define ASGR_ALT_FONT5 15 #define ASGR_ALT_FONT6 16 #define ASGR_ALT_FONT7 17 #define ASGR_ALT_FONT8 18 #define ASGR_ALT_FONT9 19 #define ASGR_FRAKTUR 20 #define ASGR_UNDERLINE_DOUB 21 #define ASGR_NORMAL_COLOR 22 #define ASGR_NOT_ITALIC 23 #define ASGR_UNDERLINE_NONE 24 #define ASGR_BLINK_OFF 25 #define ASGR_IMAGE_POSITIVE 27 #define ASGR_REVEAL 28 #define ASGR_NOT_CROSSED_OUT 29 #define ASGR_TEXT_COLOR_1 30 #define ASGR_TEXT_COLOR_2 31 #define ASGR_TEXT_COLOR_3 32 #define ASGR_TEXT_COLOR_4 33 #define ASGR_TEXT_COLOR_5 34 #define ASGR_TEXT_COLOR_6 35 #define ASGR_TEXT_COLOR_7 36 #define ASGR_TEXT_COLOR_8 37 #define ASGR_DEF_TEXT_COLOR 39 #define ASGR_BG_COLOR_1 40 #define ASGR_BG_COLOR_2 41 #define ASGR_BG_COLOR_3 42 #define ASGR_BG_COLOR_4 43 #define ASGR_BG_COLOR_5 44 #define ASGR_BG_COLOR_6 45 #define ASGR_BG_COLOR_7 46 #define ASGR_BG_COLOR_8 47 #define ASGR_DEF_BG_COLOR 49 #define ASGR_FRAMED 51 #define ASGR_ENCIRCLED 52 #define ASGR_OVERLINED 53 #define ASGR_NOT_FRAME_ENCIR 54 #define ASGR_NOT_OVERLINED 55 #define ASGR_ID_UNDERLINE 60 #define ASGR_ID_DBL_UNDERLINE 61 #define ASGR_ID_OVERLINE 62 #define ASGR_ID_DBL_OVERLINE 63 #define ASGR_ID_STRESS_MARK 64 #define ASGR_FG_COLOR_HIGH1 90 #define ASGR_FG_COLOR_HIGH2 91 #define ASGR_FG_COLOR_HIGH3 92 #define ASGR_FG_COLOR_HIGH4 93 #define ASGR_FG_COLOR_HIGH5 94 #define ASGR_FG_COLOR_HIGH6 95 #define ASGR_FG_COLOR_HIGH7 96 #define ASGR_FG_COLOR_HIGH8 97 #define ASGR_FG_COLOR_HIGH9 98 #define ASGR_FG_COLOR_HIGH10 99 #define ASGR_BG_COLOR_HIGH1 100 #define ASGR_BG_COLOR_HIGH2 101 #define ASGR_BG_COLOR_HIGH3 102 #define ASGR_BG_COLOR_HIGH4 103 #define ASGR_BG_COLOR_HIGH5 104 #define ASGR_BG_COLOR_HIGH6 105 #define ASGR_BG_COLOR_HIGH7 106 #define ASGR_BG_COLOR_HIGH8 107 #define ASGR_BG_COLOR_HIGH9 108 #define ASGR_BG_COLOR_HIGH10 109 #define ASGR_COLOR1_NORMAL "#000000" #define ASGR_COLOR2_NORMAL "#CD0000" #define ASGR_COLOR3_NORMAL "#00CD00" #define ASGR_COLOR4_NORMAL "#CDCD00" #define ASGR_COLOR5_NORMAL "#0000EE" #define ASGR_COLOR6_NORMAL "#CD00CD" #define ASGR_COLOR7_NORMAL "#00CDCD" #define ASGR_COLOR8_NORMAL "#E5E5E5" #define ASGR_COLOR1_BRIGHT "#7F7F7F" #define ASGR_COLOR2_BRIGHT "#FF0000" #define ASGR_COLOR3_BRIGHT "#00FF00" #define ASGR_COLOR4_BRIGHT "#FFFF00" #define ASGR_COLOR5_BRIGHT "#5C5CFF" #define ASGR_COLOR6_BRIGHT "#FF00FF" #define ASGR_COLOR7_BRIGHT "#00FFFF" #define ASGR_COLOR8_BRIGHT "#00FFFF" enum telnet_callback_types { /* printer callbacks */ TC_ASCII, TC_NULL, TC_LINE_FEED, TC_CARRIAGE_RETURN, TC_BELL, TC_BACKSPACE, TC_HORIZONTAL_TAB, TC_VERTICAL_TAB, TC_FORM_FEED, /* other telnet specific callbacks */ TC_ERASE_LINE, TC_ERASE_CHAR, TC_ARE_YOU_THERE, TC_DATA_MARK, TC_ABORT_OUTPUT, TC_GO_AHEAD, TC_INTERRUPT_PROCESS, TC_BREAK, /* ANSI escape codes */ TC_ANSI_CURSOR_UP, TC_ANSI_CURSOR_DOWN, TC_ANSI_CURSOR_FORWARD, TC_ANSI_CURSOR_BACK, TC_ANSI_CURSOR_NEXT_LINE, TC_ANSI_CURSOR_PREV_LINE, TC_ANSI_CURSOR_HORZ_ABS, TC_ANSI_CURSOR_POS, TC_ANSI_ERASE_DATA, TC_ANSI_ERASE_IN_LINE, TC_ANSI_SCROLL_UP, TC_ANSI_SCROLL_DOWN, TC_ANSI_HOR_AND_VER_POS, TC_ANSI_SAVE_CUR_POS, TC_ANSI_REST_CUR_POS, TC_ANSI_DEV_STAT_REP, TC_ANSI_HIDE_CURS, TC_ANSI_SHOW_CURS, TC_ANSI_SGR, }; struct telnetp; struct telnetp *telnetp_connect(char *hostname, unsigned short port, void (*callback_func)(int, void *)); void telnetp_close(struct telnetp *t); void telnetp_enable_option(struct telnetp *t, unsigned int type, char enabled, void *data); void telnetp_process_incoming(struct telnetp *t); int telnetp_send_data(struct telnetp *t, char *data, unsigned int len); int telnetp_send_line(struct telnetp *t, char *data, unsigned int len); #endif /* __TELNETP_H__ */
// // RegistView.h // Opt_master // // Created by 瑞宁科技02 on 16/7/8. // Copyright © 2016年 reining. All rights reserved. // #import <UIKit/UIKit.h> #import "Image+textField.h" #import "ImageTextField.h" @interface RegistView : UIView /** * LogoImage */ @property (nonatomic ,strong)UIImageView *logoImage; //@property (nonatomic ,strong) Image_textField *name; //@property (nonatomic ,strong) Image_textField *password; //@property (nonatomic ,strong) Image_textField *phone; //@property (nonatomic ,strong) Image_textField *vertifyCode; //@property (nonatomic ,strong) UIButton *registBtn; @property (nonatomic ,strong) ImageTextField *name; @property (nonatomic ,strong) ImageTextField *password; @property (nonatomic ,strong) ImageTextField *phone; @property (nonatomic ,strong) ImageTextField *vertifyCode; @property (nonatomic ,strong) UIButton *registBtn; @end
/*************************************************************************** udp.h - A small class for udp socket communication Copyright (C) 2003 Ingmar Stieger (Papillon) email: papillon@blackdagger.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 ***************************************************************************/ #if !defined(udp_h) #define udp_h #include <winsock.h> class CUDP { public: CUDP(char *szAddress, int iPort); ~CUDP(); void sendMessage(char* message); int getMessage(char* message, int len); void setPort(int port); void setAddress(char *szAddress); protected: WSADATA wsda; // Structure to store info returned from WSAStartup struct hostent *host; // Used to store information retreived about the server SOCKET s; // UDP socket handle SOCKADDR_IN addr; // The host's address }; #endif
/* This file is part of Desperion. Copyright 2010, 2011 LittleScaraby, Nekkro Desperion 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. Desperion 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 Desperion. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OBJECT_GROUND_REMOVE_MULTIPLE__ #define __OBJECT_GROUND_REMOVE_MULTIPLE__ class ObjectGroundRemovedMultipleMessage : public DofusMessage { public: std::vector<int16> cells; virtual uint16 GetOpcode() const { return SMSG_OBJECT_GROUND_REMOVED_MULTIPLE; } ObjectGroundRemovedMultipleMessage(std::vector<int16>& cells) : cells(cells) { } void Serialize(ByteBuffer& data) const { uint16 size = cells.size(); data<<size; for(uint16 a = 0; a < size; ++a) data<<cells[a]; } void Deserialize(ByteBuffer& data) { cells.clear(); uint16 size; data>>size; for(uint16 a = 0; a < size; ++a) { int16 cell; data>>cell; cells.push_back(cell); } } }; #endif
#ifndef TITLEPAGE_H #define TITLEPAGE_H #include "titlepageelement.h" class TitlePage { public: TitlePage(); ~TitlePage(); void clear(); void addElement(TitlePageElement *element); QString toFoutain(); QString toHtml(); private: QList<TitlePageElement *> m_content; }; #endif // TITLEPAGE_H
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * This file is part of the libone project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_LIBONE_GUID_H #define INCLUDED_LIBONE_GUID_H #include <string> #include <cstdint> #include <array> #include <librevenge-stream/librevenge-stream.h> #include "libone_utils.h" namespace libone { /** @brief globally unique identifier class specified by [RFC4122] or [C706] */ class GUID { public: /** Default construtor. Initializes to {00000000-0000-0000-0000-000000000000}. */ GUID(); /** Constructor to initialize specific GUID */ GUID(const uint32_t data1, const uint16_t data2, const uint16_t data3, const std::array<uint16_t,4> data4); /** Constructor to initialize specific GUID */ GUID(const uint32_t data1, const uint16_t data2, const uint16_t data3, const uint16_t data4_1, const uint16_t data4_2, const uint16_t data4_3, const uint16_t data4_4); /** Construtor to initialize with GUID in std::string format. * @param str - should have the format "{00000000-0000-0000-0000-000000000000}" */ GUID(const std::string str); /** Parse GUID's content from RVNGInputStream byte stream. */ void parse(const libone::RVNGInputStreamPtr_t &input); /** Converts GUID object to a string in this format: "{00000000-0000-0000-0000-000000000000}" */ std::string to_string() const; /** Checks if GUIDs are identical */ bool is_equal(const GUID other) const; /** resets GUID to {00000000-0000-0000-0000-000000000000} */ void zero(); friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, GUID &obj); friend bool operator==(const GUID &lhs, const GUID &rhs) noexcept; friend bool operator!=(const GUID &lhs, const GUID &rhs) noexcept; /** Getter. * @return first data sequence GUID */ uint32_t data1() const; /** Getter. * @return second data sequence of GUID */ uint16_t data2() const; /** Getter. * @return third data sequence of GUID */ uint16_t data3() const; /** Getter. * @return forth data sequence of GUID */ std::array<uint16_t,4> data4() const; private: uint32_t Data1 = 0; uint16_t Data2 = 0; uint16_t Data3 = 0; std::array<uint16_t, 4> Data4 {{ 0, 0, 0, 0 }}; }; } #endif
/* Copyright (c) 2013-2015 Jeffrey Pfau * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GBA_SAVEDATA_H #define GBA_SAVEDATA_H #include "util/common.h" #include "core/log.h" mLOG_DECLARE_CATEGORY(GBA_SAVE); struct VFile; enum SavedataType { SAVEDATA_AUTODETECT = -1, SAVEDATA_FORCE_NONE = 0, SAVEDATA_SRAM = 1, SAVEDATA_FLASH512 = 2, SAVEDATA_FLASH1M = 3, SAVEDATA_EEPROM = 4 }; enum SavedataCommand { EEPROM_COMMAND_NULL = 0, EEPROM_COMMAND_PENDING = 1, EEPROM_COMMAND_WRITE = 2, EEPROM_COMMAND_READ_PENDING = 3, EEPROM_COMMAND_READ = 4, FLASH_COMMAND_START = 0xAA, FLASH_COMMAND_CONTINUE = 0x55, FLASH_COMMAND_ERASE_CHIP = 0x10, FLASH_COMMAND_ERASE_SECTOR = 0x30, FLASH_COMMAND_NONE = 0, FLASH_COMMAND_ERASE = 0x80, FLASH_COMMAND_ID = 0x90, FLASH_COMMAND_PROGRAM = 0xA0, FLASH_COMMAND_SWITCH_BANK = 0xB0, FLASH_COMMAND_TERMINATE = 0xF0 }; enum FlashStateMachine { FLASH_STATE_RAW = 0, FLASH_STATE_START = 1, FLASH_STATE_CONTINUE = 2, }; enum FlashManufacturer { FLASH_MFG_PANASONIC = 0x1B32, FLASH_MFG_SANYO = 0x1362 }; enum SavedataDirty { SAVEDATA_DIRT_NEW = 1, SAVEDATA_DIRT_SEEN = 2 }; enum { SAVEDATA_FLASH_BASE = 0x0E005555, FLASH_BASE_HI = 0x5555, FLASH_BASE_LO = 0x2AAA }; struct GBASavedata { enum SavedataType type; uint8_t* data; enum SavedataCommand command; struct VFile* vf; int mapMode; struct VFile* realVf; int32_t readBitsRemaining; uint32_t readAddress; uint32_t writeAddress; uint8_t* currentBank; bool realisticTiming; unsigned settling; int dust; enum SavedataDirty dirty; uint32_t dirtAge; enum FlashStateMachine flashState; }; void GBASavedataInit(struct GBASavedata* savedata, struct VFile* vf); void GBASavedataDeinit(struct GBASavedata* savedata); void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf); void GBASavedataUnmask(struct GBASavedata* savedata); size_t GBASavedataSize(struct GBASavedata* savedata); bool GBASavedataClone(struct GBASavedata* savedata, struct VFile* out); bool GBASavedataLoad(struct GBASavedata* savedata, struct VFile* in); void GBASavedataForceType(struct GBASavedata* savedata, enum SavedataType type, bool realisticTiming); void GBASavedataInitFlash(struct GBASavedata* savedata, bool realisticTiming); void GBASavedataInitEEPROM(struct GBASavedata* savedata, bool realisticTiming); void GBASavedataInitSRAM(struct GBASavedata* savedata); uint8_t GBASavedataReadFlash(struct GBASavedata* savedata, uint16_t address); void GBASavedataWriteFlash(struct GBASavedata* savedata, uint16_t address, uint8_t value); uint16_t GBASavedataReadEEPROM(struct GBASavedata* savedata); void GBASavedataWriteEEPROM(struct GBASavedata* savedata, uint16_t value, uint32_t writeSize); void GBASavedataClean(struct GBASavedata* savedata, uint32_t frameCount); struct GBASerializedState; void GBASavedataSerialize(const struct GBASavedata* savedata, struct GBASerializedState* state); void GBASavedataDeserialize(struct GBASavedata* savedata, const struct GBASerializedState* state); #endif
/** * @file: node_group.h * Group of nodes * * Layout library, 2d graph placement of graphs in ShowGraph tool. * Copyright (c) 2009, Boris Shurygin * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder 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. * @defgroup HLayout Horizontal placement * @ingroup Layout */ #ifndef NODE_GROUP_H #define NODE_GROUP_H /** * Group of nodes * * Abstraction that aids multiple nodes manipulation inside a level. * * @ingroup HLayout */ class NodeGroup { /** Number of edges in adjacent layer */ unsigned int edge_num; /** Barycenter */ qreal barycenter; /** List of group's nodes */ QList< AuxNode *> node_list; /** Horizontal coordinate of left border */ qreal border_left; /** Horizontal coordinate of right border */ qreal border_right; /** The heuristic weight of the group */ float group_weight; public: /** Initialize attributes of the group */ inline void init() { border_left = 0; border_right = 0; group_weight = 0; } /** Get adjacent number of adjacent edges */ inline unsigned int adjEdgesNum() const { return edge_num; } /** Get barycenter of adjacent edges */ inline qreal bc() const { return barycenter; } /** Get weight */ inline float weight() const { return group_weight; } /** Get left border coordinate */ inline qreal left() const { return border_left; } /** Get right border coordinate */ inline qreal right() const { return border_right; } /** Set left border coordinate */ inline void setLeft( qreal pos) { border_left = pos; } /** Set right border coordinate */ inline void setRight( qreal pos) { border_right = pos; } /** Get node list */ QList<AuxNode *> nodes() const { return node_list; } /** Add node to list */ inline void addNode( AuxNode *node) { node_list.push_back( node); group_weight += 1; } /** Default constructor */ NodeGroup() : node_list() { init(); } /** Constructor of group from a node */ NodeGroup( AuxNode *n, GraphDir dir, bool first_pass); /** Check if this groups interleaves with the given one */ inline bool interleaves( NodeGroup *grp) const { return !( left() > grp->right() || right() < grp->left()); } /** Merge two groups correcting borders and nodes list of resulting group */ void merge( NodeGroup *grp); /** Place nodes inside group */ void placeNodes(); /** Place nodes and adjust the view */ void placeNodesFinal( GraphDir dir); }; #endif
#ifndef tetrahedron_h #define tetrahedron_h #include "globals.h" class Tetrahedron { public: Matrix3d DeformedShapeMatrix, ReferenceShapeMatrix, InvRefShapeMatrix; VectorXi verticesIndex; double undeformedVol, energyDensity, currentVol; double mu, lambda; Tetrahedron(VectorXi k, double mu, double lambda); MatrixXd computeElasticForces(MatrixXd& TV, int e); void precomputeForces(MatrixXd& TV); MatrixXd computeForceDifferentials(MatrixXd& TV, Vector12d& dx); Matrix3d computeDeltaDs(const Vector12d& dx); Matrix3d computeDs(const Vector12d& x); }; #endif
//-------------------------------------------------------------------------------------------------- /** * Copyright (C) Sierra Wireless Inc. */ //-------------------------------------------------------------------------------------------------- #ifndef LEGATO_MKTOOLS_CLI_GENERATEDEFTEMPLATE_H_INCLUDE_GUARD #define LEGATO_MKTOOLS_CLI_GENERATEDEFTEMPLATE_H_INCLUDE_GUARD namespace defs { void GenerateSystemTemplate(ArgHandler_t& handler); void GenerateApplicationTemplate(ArgHandler_t& handler); void GenerateComponentTemplate(ArgHandler_t& handler); void GenerateModuleTemplate(ArgHandler_t& handler); } #endif
/* * This file contains/describes functions that parse command line options. */ #ifndef __options_h__ #define __options_h__ #include <limits.h> struct sStringList; extern int OPT_VERSION, OPT_HELP, OPT_INFO, OPT_IGNORE_CASE, OPT_ORDER, OPT_LIST, OPT_REVERSE, OPT_NATURAL_SORT, OPT_RECURSIVE, OPT_RANDOM, OPT_MORE_INFO, OPT_MODIFICATION, OPT_ASCII; extern struct sStringList *OPT_INCL_DIRS, *OPT_EXCL_DIRS, *OPT_INCL_DIRS_REC, *OPT_EXCL_DIRS_REC, *OPT_IGNORE_PREFIXES_LIST; // parses command line options int parse_options(int argc, char *argv[]); // evaluate whether str matches the include an exclude dir path lists or not int matchesDirPathLists(struct sStringList *includes, struct sStringList *includes_recursion, struct sStringList *excludes, struct sStringList *excludes_recursion, const char (*str)[PATH_MAX + 1]); // free options void freeOptions(); #endif // __options_h__
#pragma once #include <vector> #include <functional> #include <Eigen/Dense> namespace SystemSolver { using oneVarFunc = std::function<double(double)>; using multVarFunc = std::function<double(const Eigen::VectorXd &)>; }
#include <stdio.h> #include <strings.h> #include <errno.h> main( argc, argv ) int argc; char *argv[]; { while (--argc) striplf( *++argv ); } striplf( arq ) char *arq; { FILE *in, *out; char linha[2048], *p; char tmpname[200]; strcpy( tmpname, "@@##XXXXXX" ); mktemp( tmpname ); in = fopen( arq, "r" ); out = fopen( tmpname, "w" ); if ( in && out ) { fprintf(stderr, "Tratando : %s ", arq); while ((fgets( linha, 2047, in )) != NULL) { p = strchr( linha, 0x1a); if (p) *p = '\0'; p = strchr( linha, '\r' ); if (p != NULL) { p[0] = '\n'; p[1] = '\0'; } fputs( linha, out ); } fclose( in ); fclose( out ); unlink( arq ); link( tmpname, arq ); unlink( tmpname ); fprintf(stderr, " OK.\n"); } else fprintf( stderr, "Problema[%d] com arquivo %s \n", errno, arq ); }
/** ****************************************************************************** * @file USB_Device/DualCore_Standalone/Src/stm32f4xx_it.c * @author MCD Application Team * @version V1.2.3 * @date 29-January-2016 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics </center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_it.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ extern PCD_HandleTypeDef hpcd_FS; extern PCD_HandleTypeDef hpcd_HS; extern PCD_HandleTypeDef hpcd; extern USBD_HandleTypeDef USBD_Device_FS; extern UART_HandleTypeDef UartHandle; extern TIM_HandleTypeDef TimHandle; extern __IO uint8_t HID_SendReport; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M4 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { static __IO uint32_t counter=0; HAL_IncTick(); /* check Joystick state every polling interval (10ms) */ if (counter++ == USBD_HID_GetPollingInterval(&USBD_Device_FS)) { HID_SendReport = 1; counter =0; } } /******************************************************************************/ /* STM32F4xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f4xx.s). */ /******************************************************************************/ /** * @brief This function handles USB-On-The-Go HS global interrupt request. * @param None * @retval None */ void OTG_HS_IRQHandler(void) { HAL_PCD_IRQHandler(&hpcd_HS); } /** * @brief This function handles USB-On-The-Go FS global interrupt request. * @param None * @retval None */ void OTG_FS_IRQHandler(void) { HAL_PCD_IRQHandler(&hpcd_FS); } /** * @brief This function handles DMA interrupt request. * @param None * @retval None */ void USARTx_DMA_TX_IRQHandler(void) { HAL_DMA_IRQHandler(UartHandle.hdmatx); } /** * @brief This function handles UART interrupt request. * @param None * @retval None */ void USARTx_IRQHandler(void) { HAL_UART_IRQHandler(&UartHandle); } /** * @brief This function handles TIM interrupt request. * @param None * @retval None */ void TIMx_IRQHandler(void) { HAL_TIM_IRQHandler(&TimHandle); } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/** * @brief Server wrapper script - client * * @file atmiclt54.c */ /* ----------------------------------------------------------------------------- * Enduro/X Middleware Platform for Distributed Transaction Processing * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. * Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved. * This software is released under one of the following licenses: * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. * See LICENSE file for full text. * ----------------------------------------------------------------------------- * AGPL license: * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License, version 3 as published * by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 * for more details. * * You should have received a copy of the GNU Affero 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 * * ----------------------------------------------------------------------------- * A commercial use license is available from Mavimax, Ltd * contact@mavimax.com * ----------------------------------------------------------------------------- */ #include <string.h> #include <stdio.h> #include <stdlib.h> #include <memory.h> #include <math.h> #include <atmi.h> #include <ubf.h> #include <ndebug.h> #include <test.fd.h> #include <ndrstandard.h> #include <nstopwatch.h> #include <fcntl.h> #include <unistd.h> #include <nstdutil.h> #include "test54.h" /*---------------------------Externs------------------------------------*/ /*---------------------------Macros-------------------------------------*/ /*---------------------------Enums--------------------------------------*/ /*---------------------------Typedefs-----------------------------------*/ /*---------------------------Globals------------------------------------*/ /*---------------------------Statics------------------------------------*/ /*---------------------------Prototypes---------------------------------*/ /** * Do the test call to the server */ int main(int argc, char** argv) { long rsplen; int i; int ret=EXSUCCEED; for (i=0; i<200; i++) { UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 56000); if (EXFAIL==CBchg(p_ub, T_STRING_FLD, 0, VALUE_EXPECTED, 0, BFLD_STRING)) { NDRX_LOG(log_debug, "Failed to set T_STRING_FLD[0]: %s", Bstrerror(Berror)); ret=EXFAIL; goto out; } if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0)) { NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno)); ret=EXFAIL; goto out; } tpfree((char *)p_ub); sleep(1); } out: tpterm(); fprintf(stderr, "Exit with %d\n", ret); return ret; } /* vim: set ts=4 sw=4 et smartindent: */
//Copyright © 2014 SDXFramework //[License]GNU Affero General Public License, version 3 //[Contact]http://sourceforge.jp/projects/dxframework/ #pragma once //#include <Multimedia/Color.h> #include <chrono> namespace SDX { /** 時間と日付を取得する関数群.*/ /** わりと標準ライブラリで良い感じはある.*/ /** \include Time.h*/ class Time { private: MONO_STATE(Time) double fps; std::chrono::system_clock::time_point reset; std::chrono::system_clock::time_point fpsCounter; std::chrono::system_clock::time_point watch; static Time& Single() { static Time single; return single; } public: /** 時間の初期化.*/ static void ResetCount() { Single().reset = std::chrono::system_clock::now(); } /** リセット後の経過時間のミリ秒で取得(小数点以下).*/ static double GetNowCount() { auto diff = std::chrono::system_clock::now() - Single().reset; return (double)std::chrono::duration_cast<std::chrono::microseconds>(diff).count() / 1000; } /** 日付を取得.*/ static void GetDate(tm *現在時刻) { time_t timer; time(&timer); localtime_s(現在時刻, &timer); } /** 現在の日付、時刻を文字列にして返す.*/ static std::string GetDateString() { tm time; GetDate( &time ); VariadicStream str = { time.tm_year+1900, "_" , time.tm_mon , "_" , time.tm_mday , "_" , time.tm_hour , "_" , time.tm_min , "_" , time.tm_sec}; return str.StringS[0]; } /** FPSを取得.*/ static double GetFPS() { return Single().fps; } /** FPSの計測開始.*/ static void ResetFPS() { Single().fpsCounter = std::chrono::system_clock::now(); } /** FPS計測を更新.*/ static void CheckFPS() { auto diff = std::chrono::system_clock::now() - Single().fpsCounter; Single().fps = 1000000.0 / (double)std::chrono::duration_cast<std::chrono::microseconds>(diff).count(); Single().fpsCounter = std::chrono::system_clock::now(); } /** 処理時間計測開始.*/ static void StartWatch() { Single().watch = std::chrono::system_clock::now(); } /** 処理時間計測終了.*/ /** StartWatchからの経過時間をミリ秒単位で描画\n*/ /** 続けてDrawWatchする事も可能*/ static void DrawWatch(const Point &座標, const char* 描画文字列) { std::string buf = 描画文字列; buf += " = "; auto diff = std::chrono::system_clock::now() - Single().watch; double count = (double)std::chrono::duration_cast<std::chrono::milliseconds>(diff).count(); Drawing::String(座標, Color(255, 255, 255), { buf, count }); Single().watch = std::chrono::system_clock::now(); } }; }
/* Copyright (c) 2014-2022 AscEmu Team <http://www.ascemu.org> This file is released under the MIT license. See README-MIT for more information. */ #pragma once #include <cstdint> #include "ManagedPacket.h" #include "WorldPacket.h" namespace AscEmu::Packets { class CmsgSummonResponse : public ManagedPacket { public: uint64_t summonGuid; uint8_t isClickOn; CmsgSummonResponse() : CmsgSummonResponse(0, 0) { } CmsgSummonResponse(uint64_t summonGuid, uint8_t isClickOn) : ManagedPacket(CMSG_SUMMON_RESPONSE, 8 + 1), summonGuid(summonGuid), isClickOn(isClickOn) { } protected: bool internalSerialise(WorldPacket& /*packet*/) override { return false; } bool internalDeserialise(WorldPacket& packet) override { packet >> summonGuid >> isClickOn; return true; } }; }
/* * Arc MMORPG Server * Copyright (C) 2005-2010 Arc Team <http://www.arcemulator.net/> * * This software is under the terms of the EULA License * All title, including but not limited to copyrights, in and to the ArcNG Software * and any copies there of are owned by ZEDCLANS INC. or its suppliers. All title * and intellectual property rights in and to the content which may be accessed through * use of the ArcNG is the property of the respective content owner and may be protected * by applicable copyright or other intellectual property laws and treaties. This EULA grants * you no rights to use such content. All rights not expressly granted are reserved by ZEDCLANS INC. * */ #ifndef __DBC_H #define __DBC_H #include "../Common.h" enum DBCFmat { F_STRING = 0, F_INT = 1, F_FLOAT = 2, F_NADA = 3 }; class DBC { int rows, cols, dblength,weird2; // Weird2 = most probably line length unsigned int* tbl; char* db,name[MAX_PATH]; bool loaded; DBCFmat *format; public: DBC(); void Load(const char *filename); void CSV(char *filename, bool info = false); void GuessFormat(); DBCFmat GuessFormat(int row, int col); void FormatCSV(const char *filename, bool info = false); void Lookup(char* out, int row, int col,char isstr=0,bool onlystr=false); void LookupFormat(char* out, int row, int col); void RowToStruct(void* out, int row); bool IsLoaded() { return loaded; } void* __fastcall GetRow(unsigned const int index) { return (void *)&tbl[index*cols]; } char* __fastcall LookupString(unsigned const int offset) { return db+offset; } int GetRows() { return rows; } int GetCols() { return cols; } int GetDBSize() { return dblength; } ~DBC(); }; #endif
/* Copyright © 2001-2014, Canal TP and/or its affiliates. All rights reserved. This file is part of Navitia, the software to build cool stuff with public transport. Hope you'll enjoy and contribute to this project, powered by Canal TP (www.canaltp.fr). Help us simplify mobility and open public transport: a non ending quest to the responsive locomotion way of traveling! LICENCE: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Stay tuned using twitter @navitia IRC #navitia on freenode https://groups.google.com/d/forum/navitia www.navitia.io */ #pragma once #include "type/pb_converter.h" namespace pbnavitia { class Response; } namespace navitia { namespace ptref { /// execute the pt ref query and return the protobuf response void query_pb(navitia::PbCreator& pb_creator, const type::Type_e requested_type, const std::string& request, const std::vector<std::string>& forbidden_uris, const type::OdtLevel_e odt_level, const int depth, const int startPage, const int count, const boost::optional<boost::posix_time::ptime>& since, const boost::optional<boost::posix_time::ptime>& until, const type::Data& data); std::vector<const type::Route*> get_matching_routes(const type::Data*, const type::Line*, const type::StopPoint* start, const std::pair<std::string, std::string>& destination_code); void fill_matching_routes(navitia::PbCreator& pb_creator, const type::Data*, const type::Line*, const type::StopPoint* start, const std::pair<std::string, std::string>& destination_code); } // namespace ptref } // namespace navitia
/* * This file is part of DGD, https://github.com/dworkin/dgd * Copyright (C) 1993-2010 Dworkin B.V. * Copyright (C) 2010-2017 DGD Authors (see the commit log for details) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ void pc_restore (int);
#ifndef QGC_CONFIGURATION_H #define QGC_CONFIGURATION_H #include "globalobject.h" #include <QString> #include <QDateTime> #include <QDir> #include <QCoreApplication> /** @brief Polling interval in ms */ #define SERIAL_POLL_INTERVAL 100 /** @brief Heartbeat emission rate, in Hertz (times per second) */ #define MAVLINK_HEARTBEAT_DEFAULT_RATE 1 #define WITH_TEXT_TO_SPEECH 1 #define QGC_APPLICATION_NAME "APM Planner" #define QGC_APPLICATION_VERSION "v2.0.11" #define APP_DATA_DIRECTORY "/apmplanner2" #define LOG_DIRECTORY "/dataflashLogs" #define PARAMETER_DIRECTORY "/parameters" #define MAVLINK_LOG_DIRECTORY "/tlogs" #define MAVLINK_LOGFILE_EXT ".tlog" #ifndef APP_TYPE #define APP_TYPE stable // or "daily" for master branch builds #endif #ifndef APP_PLATFORM #ifdef Q_OS_MACX #define APP_PLATFORM osx #elif defined(Q_LINUX_64) && defined(Q_UBUNTU) #define APP_PLATFORM ubuntu64 #elif defined(Q_LINUX_64) #define APP_PLATFORM debian64 #elif defined(Q_OS_LINUX) && defined(Q_UBUNTU) #define APP_PLATFORM ubuntu32 #elif defined(Q_OS_LINUX) #define APP_PLATFORM debian32 #else #define APP_PLATFORM win #endif #endif namespace QGC { const QString APPNAME = "APMPLANNER2"; const QString COMPANYNAME = "DIYDRONES"; const int APPLICATIONVERSION = 2010; // 2.0.11 [TODO] we should deprecate this version definition inline void close(){ GlobalObject* global = GlobalObject::sharedInstance(); delete global; global = NULL; } inline void loadSettings(){ GlobalObject::sharedInstance()->loadSettings(); } inline void saveSettings(){ GlobalObject::sharedInstance()->saveSettings(); } inline QString fileNameAsTime(){ return GlobalObject::sharedInstance()->fileNameAsTime(); } inline bool makeDirectory(const QString& dir){ return GlobalObject::sharedInstance()->makeDirectory(dir); } inline QString appDataDirectory(){ return GlobalObject::sharedInstance()->appDataDirectory(); } inline void setAppDataDirectory(const QString& dir){ GlobalObject::sharedInstance()->setAppDataDirectory(dir); } inline QString MAVLinkLogDirectory(){ return GlobalObject::sharedInstance()->MAVLinkLogDirectory(); } inline void setMAVLinkLogDirectory(const QString& dir){ GlobalObject::sharedInstance()->setMAVLinkLogDirectory(dir); } inline QString logDirectory(){ return GlobalObject::sharedInstance()->logDirectory(); } inline void setLogDirectory(const QString& dir){ GlobalObject::sharedInstance()->setLogDirectory(dir); } inline QString parameterDirectory(){ return GlobalObject::sharedInstance()->parameterDirectory(); } inline void setParameterDirectory(const QString& dir){ GlobalObject::sharedInstance()->setParameterDirectory(dir); } //Returns the absolute parth to the files, data, qml support directories //It could be in 1 of 2 places under Linux inline QString shareDirectory(){ return GlobalObject::sharedInstance()->shareDirectory(); } } #endif // QGC_CONFIGURATION_H
/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Name of package */ #define PACKAGE "gst-dynamic-pipeline" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "gst-dynamic-pipeline" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "gst-dynamic-pipeline 1.0.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "gst-dynamic-pipeline" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "1.0.0" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "1.0.0"
/* * (c) Copyright Ascensio System SIA 2010-2019 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha * street, Riga, Latvia, EU, LV-1050. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ #pragma once #ifndef PPTX_LOGIC_UNIPATH2D_INCLUDE_H_ #define PPTX_LOGIC_UNIPATH2D_INCLUDE_H_ #include "./../WrapperWritingElement.h" #include "Path2D/PathBase.h" #include "Path2D/MoveTo.h" #include "Path2D/LineTo.h" #include "Path2D/Close.h" #include "Path2D/CubicBezTo.h" #include "Path2D/ArcTo.h" #include "Path2D/QuadBezTo.h" namespace PPTX { namespace Logic { class UniPath2D : public WrapperWritingElement { public: WritingElement_AdditionConstructors(UniPath2D) PPTX_LOGIC_BASE2(UniPath2D) virtual OOX::EElementType getType() const { if (Path2D.IsInit()) return Path2D->getType(); return OOX::et_Unknown; } virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) { std::wstring name = XmlUtils::GetNameNoNS(oReader.GetName()); if (name == _T("moveTo")) Path2D.reset(new Logic::MoveTo(oReader)); else if (name == _T("lnTo")) Path2D.reset(new Logic::LineTo(oReader)); else if (name == _T("cubicBezTo")) Path2D.reset(new Logic::CubicBezTo(oReader)); else if (name == _T("close")) Path2D.reset(new Logic::Close(oReader)); else if (name == _T("arcTo")) Path2D.reset(new Logic::ArcTo(oReader)); else if (name == _T("quadBezTo")) Path2D.reset(new Logic::QuadBezTo(oReader)); else Path2D.reset(); } virtual void fromXML(XmlUtils::CXmlNode& node) { std::wstring name = XmlUtils::GetNameNoNS(node.GetName()); if (name == _T("moveTo")) Path2D.reset(new Logic::MoveTo(node)); else if (name == _T("lnTo")) Path2D.reset(new Logic::LineTo(node)); else if (name == _T("cubicBezTo")) Path2D.reset(new Logic::CubicBezTo(node)); else if (name == _T("close")) Path2D.reset(new Logic::Close(node)); else if (name == _T("arcTo")) Path2D.reset(new Logic::ArcTo(node)); else if (name == _T("quadBezTo")) Path2D.reset(new Logic::QuadBezTo(node)); else Path2D.reset(); } virtual void GetPath2DFrom(XmlUtils::CXmlNode& element) { XmlUtils::CXmlNode oNode; if(element.GetNode(_T("a:moveTo"), oNode)) Path2D.reset(new Logic::MoveTo(oNode)); else if(element.GetNode(_T("a:lnTo"), oNode)) Path2D.reset(new Logic::LineTo(oNode)); else if(element.GetNode(_T("a:cubicBezTo"), oNode)) Path2D.reset(new Logic::CubicBezTo(oNode)); else if(element.GetNode(_T("a:close"), oNode)) Path2D.reset(new Logic::Close(oNode)); else if(element.GetNode(_T("a:arcTo"), oNode)) Path2D.reset(new Logic::ArcTo(oNode)); else if(element.GetNode(_T("a:quadBezTo"), oNode)) Path2D.reset(new Logic::QuadBezTo(oNode)); else Path2D.reset(); } virtual std::wstring toXML() const { if (Path2D.IsInit()) return Path2D->toXML(); return _T(""); } virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const { if (Path2D.is_init()) Path2D->toPPTY(pWriter); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { if (Path2D.is_init()) Path2D->toXmlWriter(pWriter); } virtual bool is_init()const{return (Path2D.IsInit());}; template<class T> const bool is() const { return (!Path2D.IsInit())?false:(typeid(*Path2D) == typeid(T));} template<class T> T& as() {return static_cast<T&>(*Path2D);} template<class T> const T& as() const {return static_cast<const T&>(*Path2D);} smart_ptr<PathBase> Path2D; protected: virtual void FillParentPointersForChilds(){}; public: virtual void SetParentPointer(const WrapperWritingElement* pParent) { if(is_init()) Path2D->SetParentPointer(pParent); }; std::wstring GetODString()const { return Path2D->GetODString(); } }; } // namespace Logic } // namespace PPTX #endif // PPTX_LOGIC_UNIPATH2D_INCLUDE_H
/** Released as open source by NCC Group Plc - http://www.nccgroup.com/ Developed by Gabriel Caudrelier, gabriel dot caudrelier at nccgroup dot com https://github.com/nccgroup/pip3line Released under AGPL see LICENSE for more information **/ #ifndef TRANSFORMWIDGET_H #define TRANSFORMWIDGET_H #include <QWidget> #include <QByteArray> #include <QBitArray> #include <QTableWidgetItem> #include <QMenu> #include <QColor> #include <transformmgmt.h> #include <transformabstract.h> #include <QNetworkAccessManager> #include "infodialog.h" #include <QMutex> #include <QTime> #include <QUrl> #include <QLineEdit> #include "sources/bytesourceabstract.h" #include "downloadmanager.h" #include "guihelper.h" #include "loggerwidget.h" #include "views/byteitemmodel.h" #include "shared/guiconst.h" class HexView; class TextView; class OffsetGotoWidget; class SearchWidget; class ClearAllMarkingsButton; class ByteTableView; class TransformRequest; class MessagePanelWidget; namespace Ui { class TransformWidget; } class TransformWidget : public QWidget { Q_OBJECT public: explicit TransformWidget(GuiHelper *guiHelper ,QWidget *parent = 0); ~TransformWidget(); QByteArray output(); TransformAbstract *getTransform(); void forceUpdating(); bool setTransform(TransformAbstract *transf); ByteSourceAbstract * getSource(); ByteTableView *getHexTableView(); void copyTextToClipboard(); BaseStateAbstract *getStateMngtObj(); QString getDescription(); bool isFolded() const; void setFolded(bool value); signals: void updated(); void transfoRequest(TransformWidget *); void transformChanged(); void confErrors(QString,QString); void error(QString, QString); void warning(const QString, const QString); void status(const QString, const QString); void deletionRequest(TransformWidget *); void tryNewName(QString name); void sendRequest(TransformRequest *); void foldRequest(); public slots: void input(QByteArray inputdata); void updatingFrom(); void logWarning(const QString message, const QString source = QString()); void logError(const QString message, const QString source = QString()); void logStatus(const QString message, const QString source = QString()); void reset(); void fromLocalFile(QString fileName); void deleteMe(); void setAutoCopyTextToClipboard(bool val); void onFoldRequest(); private slots: void refreshOutput(); void onFileLoadRequest(); void processingFinished(QByteArray output, Messages messages); void buildSelectionArea(); void updateView(quintptr source); void onInvalidText(); void onTransformSelected(QString name); void updatingFromTransform(); void onHistoryBackward(); void onHistoryForward(); void on_encodeRadioButton_toggled(bool checked); void on_decodeRadioButton_toggled(bool checked); void on_infoPushButton_clicked(); void on_clearDataPushButton_clicked(); void onSearch(QByteArray item, QBitArray mask, bool couldBeText); void onGotoOffset(quint64 offset, bool absolute, bool negative, bool select); private: Q_DISABLE_COPY(TransformWidget) static const int MAX_DIRECTION_TEXT; static const QString NEW_BYTE_ACTION; void integrateTransform(); void configureViewArea(); void clearCurrentTransform(); void configureDirectionBox(); bool eventFilter(QObject *obj, QEvent *event); void dragEnterEvent ( QDragEnterEvent * event ); void dropEvent(QDropEvent *event); bool firstView; QNetworkAccessManager *manager; Ui::TransformWidget *ui; TransformAbstract * currentTransform; TransformMgmt *transformFactory; InfoDialog * infoDialog; GuiHelper * guiHelper; LoggerWidget *logger; QByteArray outputData; ByteSourceAbstract *byteSource; HexView *hexView; TextView *textView; QWidget *settingsTab; OffsetGotoWidget *gotoWidget; SearchWidget *searchWidget; ClearAllMarkingsButton * clearAllMarkingsButton; MessagePanelWidget* messagePanel; bool folded; friend class TransformWidgetStateObj; }; class TransformWidgetStateObj : public BaseStateAbstract { Q_OBJECT public: explicit TransformWidgetStateObj(TransformWidget *tw); ~TransformWidgetStateObj(); void run(); private: TransformWidget *tw; }; class TransformWidgetFoldingObj : public BaseStateAbstract { Q_OBJECT public: explicit TransformWidgetFoldingObj(TransformWidget *tw); ~TransformWidgetFoldingObj(); void run(); private: TransformWidget *tw; }; #endif // TRANSFORMWIDGET_H
/** @file * @brief functions to convert classes to strings and back */ /* Copyright (C) 2006,2007,2008,2009,2012,2014 Olly Betts * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XAPIAN_INCLUDED_SERIALISE_ERROR_H #define XAPIAN_INCLUDED_SERIALISE_ERROR_H //#include <string> // Forward class declarations: namespace Xapian { class Error; } /** Serialise a Xapian::Error object to a string. * * @param e The Xapian::Error object to serialise. * * @return Serialisation of @a e. */ std::string serialise_error(const Xapian::Error &e); /** Unserialise a Xapian::Error object and throw it. * * Note: does not return! * * @param error_string The string to unserialise. * @param prefix Optional prefix to prepend to the unserialised * Error's @a msg field. * @param new_context Optional context to replace the context in * the error. If this is specified, any existing * context will be noted in the Error's @a msg * field. */ [[noreturn]] void unserialise_error(const std::string &error_string, const std::string &prefix, const std::string &new_context); #endif
#include <string> #include "libreactor/future.h" namespace UnixSocket { void listen(Reactor& reactor, std::string path, std::function<void(FDPtr)> callback); StreamPtr connect(Reactor& reactor, std::string path); FDPtr bind(Reactor& reactor, std::string path); void listen(Reactor& reactor, FDPtr socket, std::function<void(FDPtr)> accept_cb); Future<unit> send_fd(Reactor& reactor, FDPtr socket, int fd); Future<int> recv_fd(Reactor& reactor, FDPtr socket); }
#ifndef HEADER_CURL_LDAP_H #define HEADER_CURL_LDAP_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #ifndef CURL_DISABLE_LDAP extern const struct Curl_handler Curl_handler_ldap; #if !defined(CURL_DISABLE_LDAPS) && \ ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \ (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))) extern const struct Curl_handler Curl_handler_ldaps; #endif #endif #endif /* HEADER_CURL_LDAP_H */
/** * \file * * \brief SAM DA1 Xplained Pro test configuration. * * Copyright (c) 2015 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \asf_license_stop * */ /* * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> */ #ifndef CONF_TEST_H_INCLUDED #define CONF_TEST_H_INCLUDED #define CONF_STDIO_USART EDBG_CDC_MODULE #define CONF_STDIO_MUX_SETTING EDBG_CDC_SERCOM_MUX_SETTING #define CONF_STDIO_PINMUX_PAD0 EDBG_CDC_SERCOM_PINMUX_PAD0 #define CONF_STDIO_PINMUX_PAD1 EDBG_CDC_SERCOM_PINMUX_PAD1 #define CONF_STDIO_PINMUX_PAD2 EDBG_CDC_SERCOM_PINMUX_PAD2 #define CONF_STDIO_PINMUX_PAD3 EDBG_CDC_SERCOM_PINMUX_PAD3 #define CONF_STDIO_BAUDRATE 38400 /* master sercom pinmux setting */ #define CONF_I2C_MASTER_MODULE SERCOM5 #define CONF_MASTER_SDA_PINMUX PINMUX_PB02D_SERCOM5_PAD0 #define CONF_MASTER_SCK_PINMUX PINMUX_PB03D_SERCOM5_PAD1 /* slave sercom pinmux setting */ #define CONF_I2C_SLAVE_MODULE SERCOM2 #endif /* CONF_TEST_H_INCLUDED */
/**********************************************************************\ * Copyright (C) Michael Kerrisk, 2010. * * * * This program is free software. You may use, modify, and redistribute * * it under the terms of the GNU Affero General Public License as * * published by the Free Software Foundation, either version 3 or (at * * your option) any later version. This program is distributed without * * any warranty. See the file COPYING for details. * \**********************************************************************/ /* vis_f2.c */ int vis_f2(int k) { int vis_comm(int j); return vis_comm(k) * vis_comm(k); }
/* * Disnix - A Nix-based distributed service deployment tool * Copyright (C) 2008-2022 Sander van der Burg * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __DISNIX_SNAPSHOT_H #define __DISNIX_SNAPSHOT_H #include <glib.h> #include <procreact_types.h> #include <manifest.h> #include "datamigrationflags.h" /** * Takes and retrieves snapshots of the state of all the stateful services in * the manifest that are not in the previous configuration. * * @param manifest Manifest containing all deployment information * @param old_snapshots_array Array of stateful components belonging to the previous configurations or NULL to force all services to be snapshotted * @param max_concurrent_transfers Specifies the maximum amount of concurrent transfers * @param flags Data migration option flags * @param keep Indicates how many snapshot generations should be kept remotely while executing the depth first operation * @param TRUE if the snapshot completed successfully, else FALSE */ ProcReact_bool snapshot(const Manifest *manifest, const Manifest *previous_manifest, const unsigned int max_concurrent_transfers, const unsigned int flags, const int keep); #endif
/* * BRLTTY - A background process providing access to the console screen (when in * text mode) for a blind person using a refreshable braille display. * * Copyright (C) 1995-2022 by The BRLTTY Developers. * * BRLTTY comes with ABSOLUTELY NO WARRANTY. * * This is free software, placed under the terms of the * GNU Lesser General Public License, as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any * later version. Please see the file LICENSE-LGPL for details. * * Web Page: http://brltty.app/ * * This software is maintained by Dave Mielke <dave@mielke.cc>. */ #include "prologue.h" #include <stdio.h> #include <string.h> #include <errno.h> #include "log.h" #include "parameters.h" #include "device.h" #include "get_select.h" #include "async_alarm.h" #include "scr.h" #include "scr_gpm.h" #ifdef HAVE_LIBGPM #include <gpm.h> extern int gpm_tried; typedef enum { GCS_CLOSED, GCS_FAILED, GCS_OPENED } GpmConnectionState; static int gpmConnectionState = GCS_CLOSED; ASYNC_ALARM_CALLBACK(gpmResetConnection) { gpmConnectionState = GCS_CLOSED; } static int gpmOpenConnection (void) { switch (gpmConnectionState) { case GCS_CLOSED: { Gpm_Connect options = { .eventMask = GPM_MOVE, .defaultMask = ~0, .minMod = 0, .maxMod = ~0 }; gpm_tried = 0; gpm_zerobased = 1; if (Gpm_Open(&options, -1) == -1) { logMessage(LOG_DEBUG, "GPM open error: %s", strerror(errno)); asyncNewRelativeAlarm(NULL, GPM_CONNECTION_RESET_DELAY, gpmResetConnection, NULL); gpmConnectionState = GCS_FAILED; return 0; } logMessage(LOG_DEBUG, "GPM opened: fd=%d con=%d", gpm_fd, gpm_consolefd); gpmConnectionState = GCS_OPENED; } case GCS_OPENED: return 1; } return 0; } static void gpmCloseConnection (int alreadyClosed) { if (gpmConnectionState == GCS_OPENED) { if (!alreadyClosed) Gpm_Close(); logMessage(LOG_DEBUG, "GPM closed"); } gpmConnectionState = GCS_CLOSED; } #endif /* HAVE_LIBGPM */ static int gpmScreenHandler_highlightRegion (int left, int right, int top, int bottom) { #ifdef HAVE_LIBGPM FILE *console = getConsole(); if (console) { if (gpmOpenConnection() && (gpm_fd >= 0)) { if (Gpm_DrawPointer(left, top, fileno(console)) != -1) return 1; if (errno != EINVAL) { logMessage(LOG_DEBUG, "Gpm_DrawPointer error: %s", strerror(errno)); gpmCloseConnection(0); return 0; } } } #endif /* HAVE_LIBGPM */ return 0; } static int gpmScreenHandler_getPointer (int *column, int *row) { int ok = 0; #ifdef HAVE_LIBGPM if (gpmOpenConnection()) { if (gpm_fd >= 0) { int error = 0; while (1) { fd_set mask; struct timeval timeout; Gpm_Event event; int result; FD_ZERO(&mask); FD_SET(gpm_fd, &mask); memset(&timeout, 0, sizeof(timeout)); if ((result = select(gpm_fd+1, &mask, NULL, NULL, &timeout)) == 0) break; error = 1; if (result == -1) { if (errno == EINTR) continue; logSystemError("select"); break; } if (!FD_ISSET(gpm_fd, &mask)) { logMessage(LOG_DEBUG, "GPM file descriptor not set: %d", gpm_fd); break; } if ((result = Gpm_GetEvent(&event)) == -1) { if (errno == EINTR) continue; logSystemError("Gpm_GetEvent"); break; } error = 0; if (result == 0) { gpmCloseConnection(1); break; } *column = event.x; *row = event.y; ok = 1; } if (error) gpmCloseConnection(0); } } #endif /* HAVE_LIBGPM */ return ok; } void gpmIncludeScreenHandlers (MainScreen *main) { main->base.highlightRegion = gpmScreenHandler_highlightRegion; main->base.getPointer = gpmScreenHandler_getPointer; }
/* * Tiny Vector Matrix Library * Dense Vector Matrix Libary of Tiny size using Expression Templates * * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: Timer.h,v 1.9 2007-06-23 15:58:59 opetzold Exp $ */ #ifndef TVMET_UTIL_TIMER_H #define TVMET_UTIL_TIMER_H #if defined(TVMET_HAVE_SYS_TIME_H) && defined(TVMET_HAVE_UNISTD_H) # include <sys/time.h> # include <sys/resource.h> # include <unistd.h> #else # include <ctime> #endif namespace tvmet { namespace util { /** \class Timer Timer.h "tvmet/util/Timer.h" \brief A quick& dirty portable timer, measures elapsed time. It is recommended that implementations measure wall clock rather than CPU time since the intended use is performance measurement on systems where total elapsed time is more important than just process or CPU time. The accuracy of timings depends on the accuracy of timing information provided by the underlying platform, and this varies from platform to platform. */ class Timer { Timer(const Timer&); Timer& operator=(const Timer&); public: // types typedef double time_t; public: /** starts the timer immediatly. */ Timer() { m_start_time = getTime(); } /** restarts the timer */ void restart() { m_start_time = getTime(); } /** return elapsed time in seconds */ time_t elapsed() const { return (getTime() - m_start_time); } private: time_t getTime() const { #if defined(TVMET_HAVE_SYS_TIME_H) && defined(TVMET_HAVE_UNISTD_H) getrusage(RUSAGE_SELF, &m_rusage); time_t sec = m_rusage.ru_utime.tv_sec; // user, no system time time_t usec = m_rusage.ru_utime.tv_usec; // user, no system time return sec + usec/1e6; #else return static_cast<time_t>(std::clock()) / static_cast<time_t>(CLOCKS_PER_SEC); #endif } private: #if defined(TVMET_HAVE_SYS_TIME_H) && defined(TVMET_HAVE_UNISTD_H) mutable struct rusage m_rusage; #endif time_t m_start_time; }; } // namespace util } // namespace tvmet #endif // TVMET_UTIL_TIMER_H // Local Variables: // mode:C++ // tab-width:8 // End:
#ifndef _ROS_SERVICE_DetectWall_h #define _ROS_SERVICE_DetectWall_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" #include "geometry_msgs/PointStamped.h" #include "geometry_msgs/Vector3Stamped.h" namespace stereo_wall_detection { static const char DETECTWALL[] = "stereo_wall_detection/DetectWall"; class DetectWallRequest : public ros::Msg { public: virtual int serialize(unsigned char *outbuffer) const { int offset = 0; return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; return offset; } const char * getType(){ return DETECTWALL; }; const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; }; class DetectWallResponse : public ros::Msg { public: geometry_msgs::PointStamped wall_point; geometry_msgs::Vector3Stamped wall_norm; virtual int serialize(unsigned char *outbuffer) const { int offset = 0; offset += this->wall_point.serialize(outbuffer + offset); offset += this->wall_norm.serialize(outbuffer + offset); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; offset += this->wall_point.deserialize(inbuffer + offset); offset += this->wall_norm.deserialize(inbuffer + offset); return offset; } const char * getType(){ return DETECTWALL; }; const char * getMD5(){ return "a6870b3c0e483b78cb98aac96d566717"; }; }; class DetectWall { public: typedef DetectWallRequest Request; typedef DetectWallResponse Response; }; } #endif
/* * Copyright (C) 2009-2013, 2015 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ #pragma once #include <netinet/in.h> #include <sys/socket.h> #ifdef HAVE_SYS_UN_H # include <sys/un.h> #endif #include "internal.h" /* On architectures which lack these limits, define them (ie. Cygwin). * Note that the libvirt code should be robust enough to handle the * case where actual value is longer than these limits (eg. by setting * length correctly in second argument to gethostname and by always * using strncpy instead of strcpy). */ #ifndef INET_ADDRSTRLEN # define INET_ADDRSTRLEN 16 #endif #define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" typedef struct { union { struct sockaddr sa; struct sockaddr_storage stor; struct sockaddr_in inet4; struct sockaddr_in6 inet6; #ifdef HAVE_SYS_UN_H struct sockaddr_un un; #endif } data; socklen_t len; } virSocketAddr; #define VIR_SOCKET_ADDR_VALID(s) \ ((s)->data.sa.sa_family != AF_UNSPEC) #define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \ ((s)->data.sa.sa_family == f) #define VIR_SOCKET_ADDR_FAMILY(s) \ ((s)->data.sa.sa_family) #define VIR_SOCKET_ADDR_IPV4_ALL "0.0.0.0" #define VIR_SOCKET_ADDR_IPV6_ALL "::" #define VIR_SOCKET_ADDR_IPV4_ARPA "in-addr.arpa" #define VIR_SOCKET_ADDR_IPV6_ARPA "ip6.arpa" typedef virSocketAddr *virSocketAddrPtr; typedef struct _virSocketAddrRange virSocketAddrRange; typedef virSocketAddrRange *virSocketAddrRangePtr; struct _virSocketAddrRange { virSocketAddr start; virSocketAddr end; }; typedef struct _virPortRange virPortRange; typedef virPortRange *virPortRangePtr; struct _virPortRange { unsigned int start; unsigned int end; }; int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family); int virSocketAddrParseAny(virSocketAddrPtr addr, const char *val, int family, bool reportError); int virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val); int virSocketAddrParseIPv6(virSocketAddrPtr addr, const char *val); int virSocketAddrResolveService(const char *service); void virSocketAddrSetIPv4AddrNetOrder(virSocketAddrPtr s, uint32_t addr); void virSocketAddrSetIPv4Addr(virSocketAddrPtr s, uint32_t addr); void virSocketAddrSetIPv6AddrNetOrder(virSocketAddrPtr s, uint32_t addr[4]); void virSocketAddrSetIPv6Addr(virSocketAddrPtr s, uint32_t addr[4]); char *virSocketAddrFormat(const virSocketAddr *addr); char *virSocketAddrFormatFull(const virSocketAddr *addr, bool withService, const char *separator); char *virSocketAddrGetPath(virSocketAddrPtr addr); int virSocketAddrSetPort(virSocketAddrPtr addr, int port); int virSocketAddrGetPort(virSocketAddrPtr addr); int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end, virSocketAddrPtr network, int prefix); int virSocketAddrIsNetmask(virSocketAddrPtr netmask); int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2, virSocketAddrPtr netmask); int virSocketAddrMask(const virSocketAddr *addr, const virSocketAddr *netmask, virSocketAddrPtr network); int virSocketAddrMaskByPrefix(const virSocketAddr *addr, unsigned int prefix, virSocketAddrPtr network); int virSocketAddrBroadcast(const virSocketAddr *addr, const virSocketAddr *netmask, virSocketAddrPtr broadcast); int virSocketAddrBroadcastByPrefix(const virSocketAddr *addr, unsigned int prefix, virSocketAddrPtr broadcast); int virSocketAddrGetNumNetmaskBits(const virSocketAddr *netmask); int virSocketAddrPrefixToNetmask(unsigned int prefix, virSocketAddrPtr netmask, int family); int virSocketAddrGetIPPrefix(const virSocketAddr *address, const virSocketAddr *netmask, int prefix); bool virSocketAddrEqual(const virSocketAddr *s1, const virSocketAddr *s2); bool virSocketAddrIsPrivate(const virSocketAddr *addr); bool virSocketAddrIsWildcard(const virSocketAddr *addr); int virSocketAddrNumericFamily(const char *address); bool virSocketAddrIsNumericLocalhost(const char *addr); int virSocketAddrPTRDomain(const virSocketAddr *addr, unsigned int prefix, char **ptr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); void virSocketAddrFree(virSocketAddrPtr addr); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSocketAddr, virSocketAddrFree);
///////////////////////////////////////////////////////////////////////// // // © University of Southampton IT Innovation Centre, 2013 // // Copyright in this software belongs to University of Southampton // IT Innovation Centre of Gamma House, Enterprise Road, // Chilworth Science Park, Southampton, SO16 7NS, UK. // // This software may not be used, sold, licensed, transferred, copied // or reproduced in whole or in part in any manner or form or in or // on any media by any person other than in accordance with the terms // of the Licence Agreement supplied with the software, or otherwise // without the prior written consent of the copyright owners. // // This software is distributed WITHOUT ANY WARRANTY, without even the // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE, except where stated in the Licence Agreement supplied with // the software. // // Created By : Simon Crowle // Created Date : 21-June-2013 // Created for Project : EXPERIMEDIA // ///////////////////////////////////////////////////////////////////////// #pragma once namespace ecc_commonDataModel { enum EMInterfaceType { eEMUnknownInface, eEMSetup, eEMLiveMonitor, eEMPostReport, eEMTearDown, eEMTestInterface }; } // namespace
/*************************************************************************** * Copyright (C) 2006-2007 Laurentiu-Gheorghe Crisan * Copyright (C) 2006-2007 Marc Boris Duerner * Copyright (C) 2009 Tommi Maekitalo * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * As a special exception, you may use this file as part of a free * software library without restriction. Specifically, if other files * instantiate templates or use macros or inline functions from this * file, or you compile this file and link it with other files to * produce an executable, this file does not by itself cause the * resulting executable to be covered by the GNU General Public * License. This exception does not however invalidate any other * reasons why the executable file might be covered by the GNU Library * General Public License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef Cxxtools_posix_PipeImpl_h #define Cxxtools_posix_PipeImpl_h #include "iodeviceimpl.h" #include <cxxtools/iodevice.h> #include <unistd.h> namespace cxxtools { class PipeIODevice : public IODevice { friend class PipeImpl; public: PipeIODevice(); ~PipeIODevice(); int fd() const { return _impl.fd(); } void redirect(int fd, bool close, bool inherit); protected: void open(int fd, bool isAsync); void onClose() { cancel(); _impl.close(); } IODeviceImpl& ioimpl() { return _impl; } SelectableImpl& simpl() { return _impl; } private: IODeviceImpl _impl; }; class PipeImpl { public: PipeImpl(bool isAsync); PipeIODevice& in(); const PipeIODevice& in() const; PipeIODevice& out(); const PipeIODevice& out() const; void redirect(int fd, bool close, bool inherit); int getReadFd() const { return out().fd(); } int getWriteFd() const { return in().fd(); } /// Redirect write-end to stdout. /// When the close argument is set, closes the original filedescriptor void redirectStdout(bool close, bool inherit); /// Redirect read-end to stdin. /// When the close argument is set, closes the original filedescriptor void redirectStdin(bool close, bool inherit); /// Redirect write-end to stdout. /// When the close argument is set, closes the original filedescriptor void redirectStderr(bool close, bool inherit); private: PipeIODevice _out; PipeIODevice _in; }; } // namespace cxxtools #endif
/* Ruby bindings for the Clutter 'interactive canvas' library. * Copyright (C) 2008 Neil Roberts * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ #include <rbgobject.h> #include <cogl/cogl.h> #include "rbclutter.h" #include "rbcoglshader.h" static VALUE rb_c_cogl_shader; static void rb_cogl_shader_free (void *ptr) { if (ptr) cogl_shader_unref (ptr); } static VALUE rb_cogl_shader_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, rb_cogl_shader_free, NULL); } static VALUE rb_cogl_shader_initialize (VALUE self, VALUE shader_type) { CoglHandle shader; shader = cogl_create_shader (NUM2UINT (shader_type)); DATA_PTR (self) = shader; return Qnil; } CoglHandle rb_cogl_shader_get_handle (VALUE obj) { void *ptr; if (!RTEST (rb_obj_is_kind_of (obj, rb_c_cogl_shader))) rb_raise (rb_eTypeError, "not a Cogl shader"); Data_Get_Struct (obj, void, ptr); return (CoglHandle) ptr; } static VALUE rb_cogl_shader_source (VALUE self, VALUE source) { cogl_shader_source (rb_cogl_shader_get_handle (self), StringValuePtr (source)); return self; } static VALUE rb_cogl_shader_compile (VALUE self) { cogl_shader_compile (rb_cogl_shader_get_handle (self)); return self; } static VALUE rb_cogl_shader_get_info_log (VALUE self) { CoglHandle shader = rb_cogl_shader_get_handle (self); char buf[512]; buf[0] = '\0'; buf[sizeof (buf) - 1] = '\0'; cogl_shader_get_info_log (shader, sizeof (buf) - 1, buf); return rb_str_new2 (buf); } static VALUE rb_cogl_shader_get_parameter (VALUE self, VALUE pname) { CoglHandle shader = rb_cogl_shader_get_handle (self); COGLint value; cogl_shader_get_parameteriv (shader, NUM2UINT (pname), &value); return INT2NUM (value); } void rb_cogl_shader_init () { VALUE klass = rb_define_class_under (rbclt_c_cogl, "Shader", rb_cObject); rb_c_cogl_shader = klass; rb_define_alloc_func (klass, rb_cogl_shader_allocate); rb_define_method (klass, "initialize", rb_cogl_shader_initialize, 1); rb_define_method (klass, "source", rb_cogl_shader_source, 1); rb_define_method (klass, "compile", rb_cogl_shader_compile, 0); rb_define_method (klass, "info_log", rb_cogl_shader_get_info_log, 0); rb_define_method (klass, "get_parameter", rb_cogl_shader_get_parameter, 1); }
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** * Qwt Widget Library * Copyright (C) 1997 Josef Wilgen * Copyright (C) 2002 Uwe Rathmann * * This library is free software; you can redistribute it and/or * modify it under the terms of the Qwt License, Version 1.0 *****************************************************************************/ #ifndef QWT_SCALE_MAP_H #define QWT_SCALE_MAP_H #include "qwt_global.h" #include "qwt_math.h" #ifndef QT_NO_DEBUG_STREAM #include <qdebug.h> #endif class QRectF; /*! \brief Operations for linear or logarithmic (base 10) transformations */ class QWT_EXPORT QwtScaleTransformation { public: /*! - Linear\n Transformation between 2 linear scales - Log10 Transformation between a linear and a logarithmic ( base 10 ) scale - Other Any other type of transformation */ enum Type { Linear, Log10, Other }; QwtScaleTransformation( Type type ); virtual ~QwtScaleTransformation(); virtual double xForm( double x, double s1, double s2, double p1, double p2 ) const; virtual double invXForm( double x, double s1, double s2, double p1, double p2 ) const; Type type() const; virtual QwtScaleTransformation *copy() const; private: QwtScaleTransformation(); QwtScaleTransformation &operator=( const QwtScaleTransformation ); const Type d_type; }; //! \return Transformation type inline QwtScaleTransformation::Type QwtScaleTransformation::type() const { return d_type; } /*! \brief A scale map QwtScaleMap offers transformations from a scale into a paint interval and vice versa. */ class QWT_EXPORT QwtScaleMap { public: QwtScaleMap(); QwtScaleMap( const QwtScaleMap& ); ~QwtScaleMap(); QwtScaleMap &operator=( const QwtScaleMap & ); void setTransformation( QwtScaleTransformation * ); const QwtScaleTransformation *transformation() const; void setPaintInterval( double p1, double p2 ); void setScaleInterval( double s1, double s2 ); double transform( double s ) const; double invTransform( double p ) const; double p1() const; double p2() const; double s1() const; double s2() const; double pDist() const; double sDist() const; QT_STATIC_CONST double LogMin; QT_STATIC_CONST double LogMax; static QRectF transform( const QwtScaleMap &, const QwtScaleMap &, const QRectF & ); static QRectF invTransform( const QwtScaleMap &, const QwtScaleMap &, const QRectF & ); bool isInverting() const; private: void newFactor(); double d_s1, d_s2; // scale interval boundaries double d_p1, d_p2; // paint device interval boundaries double d_cnv; // conversion factor QwtScaleTransformation *d_transformation; }; /*! \return First border of the scale interval */ inline double QwtScaleMap::s1() const { return d_s1; } /*! \return Second border of the scale interval */ inline double QwtScaleMap::s2() const { return d_s2; } /*! \return First border of the paint interval */ inline double QwtScaleMap::p1() const { return d_p1; } /*! \return Second border of the paint interval */ inline double QwtScaleMap::p2() const { return d_p2; } /*! \return qwtAbs(p2() - p1()) */ inline double QwtScaleMap::pDist() const { return qAbs( d_p2 - d_p1 ); } /*! \return qwtAbs(s2() - s1()) */ inline double QwtScaleMap::sDist() const { return qAbs( d_s2 - d_s1 ); } /*! Transform a point related to the scale interval into an point related to the interval of the paint device \param s Value relative to the coordinates of the scale */ inline double QwtScaleMap::transform( double s ) const { // try to inline code from QwtScaleTransformation if ( d_transformation->type() == QwtScaleTransformation::Linear ) return d_p1 + ( s - d_s1 ) * d_cnv; if ( d_transformation->type() == QwtScaleTransformation::Log10 ) return d_p1 + log( s / d_s1 ) * d_cnv; return d_transformation->xForm( s, d_s1, d_s2, d_p1, d_p2 ); } /*! Transform an paint device value into a value in the interval of the scale. \param p Value relative to the coordinates of the paint device \sa transform() */ inline double QwtScaleMap::invTransform( double p ) const { return d_transformation->invXForm( p, d_p1, d_p2, d_s1, d_s2 ); } //! \return True, when ( p1() < p2() ) != ( s1() < s2() ) inline bool QwtScaleMap::isInverting() const { return ( ( d_p1 < d_p2 ) != ( d_s1 < d_s2 ) ); } #ifndef QT_NO_DEBUG_STREAM QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & ); #endif #endif
/* FluidSynth - A Software Synthesizer * * Copyright (C) 2003 Peter Hanappe and others. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA */ #ifndef _FLUIDSYNTH_AUDIO_H #define _FLUIDSYNTH_AUDIO_H #ifdef __cplusplus extern "C" { #endif /** * @defgroup audio_output Audio Output * * Functions for managing audio drivers and file renderers. * * The file renderer is used for fast rendering of MIDI files to * audio files. The audio drivers are a high-level interface to * connect the synthesizer with external audio sinks or to render * real-time audio to files. */ /** * @defgroup audio_driver Audio Driver * @ingroup audio_output * * Functions for managing audio drivers. * * Defines functions for creating audio driver output. Use * new_fluid_audio_driver() to create a new audio driver for a given synth * and configuration settings. * * The function new_fluid_audio_driver2() can be * used if custom audio processing is desired before the audio is sent to the * audio driver (although it is not as efficient). * * @sa @ref CreatingAudioDriver * * @{ */ /** * Callback function type used with new_fluid_audio_driver2() to allow for * custom user audio processing before the audio is sent to the driver. * * @param data The user data parameter as passed to new_fluid_audio_driver2(). * @param len Count of audio frames to synthesize. * @param nfx Count of arrays in \c fx. * @param fx Array of buffers to store effects audio to. Buffers may alias with buffers of \c out. * @param nout Count of arrays in \c out. * @param out Array of buffers to store (dry) audio to. Buffers may alias with buffers of \c fx. * @return Should return #FLUID_OK on success, #FLUID_FAILED if an error occurred. * * This function is responsible for rendering audio to the buffers. * The buffers passed to this function are allocated and owned by the respective * audio driver and are only valid during that specific call (do not cache them). * The buffers have already been zeroed-out. * For further details please refer to fluid_synth_process(). * * @parblock * @note Whereas fluid_synth_process() allows aliasing buffers, there is the guarantee that @p out * and @p fx buffers provided by fluidsynth's audio drivers never alias. This prevents downstream * applications from e.g. applying a custom effect accidentally to the same buffer multiple times. * @endparblock * * @parblock * @note Also note that the Jack driver is currently the only driver that has dedicated @p fx buffers * (but only if \setting{audio_jack_multi} is true). All other drivers do not provide @p fx buffers. * In this case, users are encouraged to mix the effects into the provided dry buffers when calling * fluid_synth_process(). * @code{.cpp} int myCallback(void *, int len, int nfx, float *fx[], int nout, float *out[]) { int ret; if(nfx == 0) { float *fxb[4] = {out[0], out[1], out[0], out[1]}; ret = fluid_synth_process(synth, len, sizeof(fxb) / sizeof(fxb[0]), fxb, nout, out); } else { ret = fluid_synth_process(synth, len, nfx, fx, nout, out); } // ... client-code ... return ret; } * @endcode * For other possible use-cases refer to \ref fluidsynth_process.c . * @endparblock */ typedef int (*fluid_audio_func_t)(void *data, int len, int nfx, float *fx[], int nout, float *out[]); /** @startlifecycle{Audio Driver} */ FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth); FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func, void *data); FLUIDSYNTH_API void delete_fluid_audio_driver(fluid_audio_driver_t *driver); /** @endlifecycle */ FLUIDSYNTH_API int fluid_audio_driver_register(const char **adrivers); /* @} */ /** * @defgroup file_renderer File Renderer * @ingroup audio_output * * Functions for managing file renderers and triggering the rendering. * * The file renderer is only used to render a MIDI file to audio as fast * as possible. Please see \ref FileRenderer for a full example. * * If you are looking for a way to write audio generated * from real-time events (for example from an external sequencer or a MIDI controller) to a file, * please have a look at the \c file \ref audio_driver instead. * * * @{ */ /** @startlifecycle{File Renderer} */ FLUIDSYNTH_API fluid_file_renderer_t *new_fluid_file_renderer(fluid_synth_t *synth); FLUIDSYNTH_API void delete_fluid_file_renderer(fluid_file_renderer_t *dev); /** @endlifecycle */ FLUIDSYNTH_API int fluid_file_renderer_process_block(fluid_file_renderer_t *dev); FLUIDSYNTH_API int fluid_file_set_encoding_quality(fluid_file_renderer_t *dev, double q); /* @} */ #ifdef __cplusplus } #endif #endif /* _FLUIDSYNTH_AUDIO_H */
/* * WebKit2 EFL * * Copyright (c) 2012 Samsung Electronics Co., Ltd. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the * Free Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */ #define TESTED_FUN_NAME ewk_settings_loads_images_automatically_get #define POSITIVE_TEST_FUN_NUM 2 #define NEGATIVE_TEST_FUN_NUM 1 #include "utc_webkit2_ewk.h" /* Startup and cleanup functions */ static void startup(void) { utc_webkit2_ewk_test_init(); } static void cleanup(void) { utc_webkit2_ewk_test_end(); } /** * @brief Tests if returns TRUE when initiated with a correct webview and set to TRUE. */ POS_TEST_FUN(1) { Ewk_Settings* settings = ewk_view_settings_get(test_view.webview); Eina_Bool result = ewk_settings_loads_images_automatically_set(settings, EINA_TRUE); if (!result) utc_fail(); result = ewk_settings_loads_images_automatically_get(settings); utc_check_eq(result, EINA_TRUE); } /** * @brief Tests if returns FALSE when initiated with a correct webview and set to FALSE. */ POS_TEST_FUN(2) { Ewk_Settings* settings = ewk_view_settings_get(test_view.webview); Eina_Bool result = ewk_settings_loads_images_automatically_set(settings, EINA_FALSE); if (!result) utc_fail(); result = ewk_settings_loads_images_automatically_get(settings); utc_check_eq(result, EINA_FALSE); } /** * @brief Tests if returns FALSE when initiated with NULL webview. */ NEG_TEST_FUN(1) { Eina_Bool result = ewk_settings_loads_images_automatically_get(NULL); utc_check_eq(result, EINA_FALSE); }
/* GtkGlk - Glk Implementation using Gtk+ Copyright (C) 2003-2004 Evin Robertson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The author can be reached at evin@users.sf.net */ #ifndef GUI_H #define GUI_H #include "gglk.h" #include <gconf/gconf-client.h> extern GHashTable *gglk_bindings PRIVATE; extern GConfChangeSet *gglk_style_changeset PRIVATE; void gglk_update_bindings(void) PRIVATE; void gglk_object_tree_update(void) PRIVATE; void gglk_make_popup_menu(void) PRIVATE; void gglk_do_glk_objects(GtkMenuItem *unused_menuitem, gpointer unused_data) PRIVATE; void gglk_do_styles(GtkMenuItem *unused_menuitem, gpointer unused_data) PRIVATE; void gglk_do_gestalt(GtkMenuItem *unused_menuitem, gpointer unused_data) PRIVATE; void gglk_do_about(GtkMenuItem *unused_menuitem, gpointer unused_data) PRIVATE; void gglk_do_preferences(GtkMenuItem *unused_menuitem, gpointer unused_data) PRIVATE; /* gui_window.c */ void gglk_tree_store_populate_win(winid_t win, GtkTreeStore *store, GtkTreeIter *parent) PRIVATE; /* gui_stream.c */ void gglk_tree_store_populate_str(strid_t str, GtkTreeStore *store, GtkTreeIter *parent) PRIVATE; /* gui_fileref.c */ void gglk_tree_store_populate_fref(frefid_t fref, GtkTreeStore *store, GtkTreeIter *parent) PRIVATE; /* gui_style.c */ void gglk_style_toggle(GtkWidget *widget, gpointer unused_data) PRIVATE; void gglk_style_gui(GtkWidget *widget, glui32 style) PRIVATE; #endif
/* linbox/algorithms/blackbox-container-symmetrize.h * Copyright (C) 1999, 2001 Jean-Guillaume Dumas * * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas@imag.fr>, * * ------------------------------------ * Bradford Hovinen <hovinen@cis.udel.edu> * * Ported to linbox-new framework; replaced use of DOTPROD, etc. with * VectorDomain * ------------------------------------ * * * ========LICENCE======== * This file is part of the library LinBox. * * LinBox is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ========LICENCE======== *. */ /*! @internal * @file algorithms/blackbox-containter-symetrize.h * @ingroup algorithms * @brief Symmetrizing iterator for rank computations */ #ifndef __LINBOX_blackbox_container_symmetrize_H #define __LINBOX_blackbox_container_symmetrize_H #include "linbox/algorithms/blackbox-container-base.h" namespace LinBox { /** \brief Symmetrizing iterator (for rank computations). * @ingroup algorithms * * Symmetrizing iterator (for rank computations) * Same left and right vector * A is supposed to have tranpose-vector product * the sequence is * \code this->u^t this->u (A this->u)^t (A this->u) = this->u^t (A^t A) this->u (A^t (A this->u))^t (A^t (A this->u)) = this->u^t (A^t A)^2 this->u etc. \endcode */ template<class Field, class _Blackbox, class RandIter = typename Field::RandIter> class BlackboxContainerSymmetrize : public BlackboxContainerBase<Field, _Blackbox> { public: typedef _Blackbox Blackbox; BlackboxContainerSymmetrize () {} template<class Vector> BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, const Vector &u0) : BlackboxContainerBase<Field, Blackbox> (D, F) { init (u0); } //BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, RandIter &g = typename Field::RandIter(_field) ) BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, RandIter &g = typename Field::RandIter() ) : BlackboxContainerBase<Field, Blackbox> (D, F) { init (g); } private: void _launch () { if (this->casenumber) { this->casenumber = 0; this->_BB->apply (this->v, this->u); this->_VD.dot (this->_value, this->v, this->v); } else { this->casenumber = 1; this->_BB->applyTranspose (this->u, this->v); this->_VD.dot (this->_value, this->u, this->u); } } void _wait () {} }; } #endif // __LINBOX_blackbox_container_symmetrize_H // Local Variables: // mode: C++ // tab-width: 4 // indent-tabs-mode: nil // c-basic-offset: 4 // End: // vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** 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, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QPEN_H #define QPEN_H #include <QtGui/qcolor.h> #include <QtGui/qbrush.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QVariant; class QPenPrivate; class QBrush; class QPen; #ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); #endif class Q_GUI_EXPORT QPen { public: QPen(); QPen(Qt::PenStyle); QPen(const QColor &color); QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine, Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin); QPen(const QPen &pen); ~QPen(); QPen &operator=(const QPen &pen); Qt::PenStyle style() const; void setStyle(Qt::PenStyle); QVector<qreal> dashPattern() const; void setDashPattern(const QVector<qreal> &pattern); qreal dashOffset() const; void setDashOffset(qreal doffset); qreal miterLimit() const; void setMiterLimit(qreal limit); qreal widthF() const; void setWidthF(qreal width); int width() const; void setWidth(int width); QColor color() const; void setColor(const QColor &color); QBrush brush() const; void setBrush(const QBrush &brush); bool isSolid() const; Qt::PenCapStyle capStyle() const; void setCapStyle(Qt::PenCapStyle pcs); Qt::PenJoinStyle joinStyle() const; void setJoinStyle(Qt::PenJoinStyle pcs); bool isCosmetic() const; void setCosmetic(bool cosmetic); bool operator==(const QPen &p) const; inline bool operator!=(const QPen &p) const { return !(operator==(p)); } operator QVariant() const; bool isDetached(); private: friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); void detach(); class QPenPrivate *d; public: typedef QPenPrivate * DataPtr; inline DataPtr &data_ptr() { return d; } }; Q_DECLARE_TYPEINFO(QPen, Q_MOVABLE_TYPE); Q_DECLARE_SHARED(QPen) #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &); #endif QT_END_NAMESPACE QT_END_HEADER #endif // QPEN_H
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** 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, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef STYLEWINDOW_H #define STYLEWINDOW_H #include <QWidget> class StyleWindow : public QWidget { Q_OBJECT public: StyleWindow(); }; #endif
/* * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <openssl/crypto.h> #include <openssl/core_numbers.h> #include <openssl/core_names.h> #include <openssl/dh.h> #include <openssl/params.h> #include "internal/provider_algs.h" static OSSL_OP_keyexch_newctx_fn dh_newctx; static OSSL_OP_keyexch_init_fn dh_init; static OSSL_OP_keyexch_set_peer_fn dh_set_peer; static OSSL_OP_keyexch_derive_fn dh_derive; static OSSL_OP_keyexch_freectx_fn dh_freectx; static OSSL_OP_keyexch_dupctx_fn dh_dupctx; /* * What's passed as an actual key is defined by the KEYMGMT interface. * We happen to know that our KEYMGMT simply passes DH structures, so * we use that here too. */ typedef struct { DH *dh; DH *dhpeer; unsigned int pad : 1; } PROV_DH_CTX; static void *dh_newctx(void *provctx) { return OPENSSL_zalloc(sizeof(PROV_DH_CTX)); } static int dh_init(void *vpdhctx, void *vdh) { PROV_DH_CTX *pdhctx = (PROV_DH_CTX *)vpdhctx; if (pdhctx == NULL || vdh == NULL || !DH_up_ref(vdh)) return 0; DH_free(pdhctx->dh); pdhctx->dh = vdh; return 1; } static int dh_set_peer(void *vpdhctx, void *vdh) { PROV_DH_CTX *pdhctx = (PROV_DH_CTX *)vpdhctx; if (pdhctx == NULL || vdh == NULL || !DH_up_ref(vdh)) return 0; DH_free(pdhctx->dhpeer); pdhctx->dhpeer = vdh; return 1; } static int dh_derive(void *vpdhctx, unsigned char *secret, size_t *secretlen, size_t outlen) { PROV_DH_CTX *pdhctx = (PROV_DH_CTX *)vpdhctx; int ret; size_t dhsize; const BIGNUM *pub_key = NULL; /* TODO(3.0): Add errors to stack */ if (pdhctx->dh == NULL || pdhctx->dhpeer == NULL) return 0; dhsize = (size_t)DH_size(pdhctx->dh); if (secret == NULL) { *secretlen = dhsize; return 1; } if (outlen < dhsize) return 0; DH_get0_key(pdhctx->dhpeer, &pub_key, NULL); ret = (pdhctx->pad) ? DH_compute_key_padded(secret, pub_key, pdhctx->dh) : DH_compute_key(secret, pub_key, pdhctx->dh); if (ret <= 0) return 0; *secretlen = ret; return 1; } static void dh_freectx(void *vpdhctx) { PROV_DH_CTX *pdhctx = (PROV_DH_CTX *)vpdhctx; DH_free(pdhctx->dh); DH_free(pdhctx->dhpeer); OPENSSL_free(pdhctx); } static void *dh_dupctx(void *vpdhctx) { PROV_DH_CTX *srcctx = (PROV_DH_CTX *)vpdhctx; PROV_DH_CTX *dstctx; dstctx = OPENSSL_zalloc(sizeof(*srcctx)); if (dstctx == NULL) return NULL; *dstctx = *srcctx; if (dstctx->dh != NULL && !DH_up_ref(dstctx->dh)) { OPENSSL_free(dstctx); return NULL; } if (dstctx->dhpeer != NULL && !DH_up_ref(dstctx->dhpeer)) { DH_free(dstctx->dh); OPENSSL_free(dstctx); return NULL; } return dstctx; } static int dh_set_params(void *vpdhctx, const OSSL_PARAM params[]) { PROV_DH_CTX *pdhctx = (PROV_DH_CTX *)vpdhctx; const OSSL_PARAM *p; unsigned int pad; if (pdhctx == NULL || params == NULL) return 0; p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_PAD); if (p == NULL || !OSSL_PARAM_get_uint(p, &pad)) return 0; pdhctx->pad = pad ? 1 : 0; return 1; } const OSSL_DISPATCH dh_keyexch_functions[] = { { OSSL_FUNC_KEYEXCH_NEWCTX, (void (*)(void))dh_newctx }, { OSSL_FUNC_KEYEXCH_INIT, (void (*)(void))dh_init }, { OSSL_FUNC_KEYEXCH_DERIVE, (void (*)(void))dh_derive }, { OSSL_FUNC_KEYEXCH_SET_PEER, (void (*)(void))dh_set_peer }, { OSSL_FUNC_KEYEXCH_FREECTX, (void (*)(void))dh_freectx }, { OSSL_FUNC_KEYEXCH_DUPCTX, (void (*)(void))dh_dupctx }, { OSSL_FUNC_KEYEXCH_SET_PARAMS, (void (*)(void))dh_set_params }, { 0, NULL } };
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** 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, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of other Qt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #ifndef QAUDIODEVICEINFOWIN_H #define QAUDIODEVICEINFOWIN_H #include <QtCore/qbytearray.h> #include <QtCore/qstringlist.h> #include <QtCore/qlist.h> #include <QtCore/qdebug.h> #include <qaudiodeviceinfo.h> #include <qaudiosystem.h> QT_BEGIN_NAMESPACE const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { Q_OBJECT public: QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); ~QAudioDeviceInfoInternal(); bool open(); void close(); bool testSettings(const QAudioFormat& format) const; void updateLists(); QAudioFormat preferredFormat() const; bool isFormatSupported(const QAudioFormat& format) const; QString deviceName() const; QStringList supportedCodecs(); QList<int> supportedSampleRates(); QList<int> supportedChannelCounts(); QList<int> supportedSampleSizes(); QList<QAudioFormat::Endian> supportedByteOrders(); QList<QAudioFormat::SampleType> supportedSampleTypes(); static QByteArray defaultInputDevice(); static QByteArray defaultOutputDevice(); static QList<QByteArray> availableDevices(QAudio::Mode); private: QAudio::Mode mode; QString device; quint32 devId; QAudioFormat nearest; QList<int> freqz; QList<int> channelz; QList<int> sizez; QList<QAudioFormat::Endian> byteOrderz; QStringList codecz; QList<QAudioFormat::SampleType> typez; }; QT_END_NAMESPACE #endif
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the qt3to4 porting application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** 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, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTSIMPLEXML_H #define QTSIMPLEXML_H #include <QString> #include <QMultiMap> #include <QMap> QT_BEGIN_NAMESPACE class QDomDocument; class QDomElement; class QDomNode; class QIODevice; class QtSimpleXml { public: QtSimpleXml(const QString &name = QString()); QString name() const; QString text() const; int numChildren() const; bool isValid() const; const QtSimpleXml &operator [](int index) const; QtSimpleXml &operator [](int index); QtSimpleXml &operator [](const QString &key); QtSimpleXml &operator =(const QString &text); void setAttribute(const QString &key, const QString &value); QString attribute(const QString &key); bool setContent(const QString &content); bool setContent(QIODevice *device); QString errorString() const; QDomDocument toDomDocument() const; QDomElement toDomElement(QDomDocument *doc) const; private: void parse(QDomNode node); QtSimpleXml *parent; QMultiMap<QString, QtSimpleXml *> children; QMap<QString, QString> attr; QString s; QString n; bool valid; QString errorStr; }; QT_END_NAMESPACE #endif
// // Copyright (c) 2013, Ford Motor Company // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following // disclaimer in the documentation and/or other materials provided with the // distribution. // // Neither the name of the Ford Motor Company 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. // #ifndef NSSMARTDEVICELINKRPC_TBTSTATEMARSHALLER_INCLUDE #define NSSMARTDEVICELINKRPC_TBTSTATEMARSHALLER_INCLUDE #include <string> #include <json/json.h> #include "PerfectHashTable.h" #include "../include/JSONHandler/SDLRPCObjects/V1/TBTState.h" /* interface Ford Sync RAPI version 1.2 date 2011-05-17 generated at Thu Jan 24 06:36:21 2013 source stamp Thu Jan 24 06:35:34 2013 author RC */ namespace NsSmartDeviceLinkRPC { //! marshalling class for TBTState class TBTStateMarshaller { public: static std::string toName(const TBTState& e) { return getName(e.mInternal) ?: ""; } static bool fromName(TBTState& e,const std::string& s) { return (e.mInternal=getIndex(s.c_str()))!=TBTState::INVALID_ENUM; } static bool checkIntegrity(TBTState& e) { return e.mInternal!=TBTState::INVALID_ENUM; } static bool checkIntegrityConst(const TBTState& e) { return e.mInternal!=TBTState::INVALID_ENUM; } static bool fromString(const std::string& s,TBTState& e); static const std::string toString(const TBTState& e); static bool fromJSON(const Json::Value& s,TBTState& e); static Json::Value toJSON(const TBTState& e); static const char* getName(TBTState::TBTStateInternal e) { return (e>=0 && e<4) ? mHashTable[e].name : NULL; } static const TBTState::TBTStateInternal getIndex(const char* s); static const PerfectHashTable mHashTable[4]; }; } #endif
// SPDX-License-Identifier: GPL-2.1-or-later /* * Copyright (C) 2009-2014 Cyril Hrubis <metan@ucw.cz> */ #include <string.h> #include <errno.h> #include <sys/stat.h> #include <core/gp_pixmap.h> #include <core/gp_get_put_pixel.h> #include <loaders/gp_loaders.h> #include "tst_test.h" #define LOAD gp_load_ppm #define SAVE gp_save_ppm #define READ gp_read_ppm #include "loader.h" #include "ppm.h" static struct testcase PPM_black_1x1 = { .w = 1, .h = 1, .pix = 0, .path = "black_1x1.ppm", }; static struct testcase_save_load PPM_save_load = { .w = 100, .h = 100, .pixel_type = GP_PIXEL_RGB888, }; const struct tst_suite tst_suite = { .suite_name = "PPM", .tests = { {.name = "PPM Load 1x1 (black)", .tst_fn = test_load, .res_path = "data/ppm/valid/black_1x1.ppm", .data = &PPM_black_1x1, .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = "PPM Read 1x1 4bpp (black)", .tst_fn = test_read, .data = &PPM_ascii_1x1_4bpp_black, .flags = TST_CHECK_MALLOC}, {.name = "PPM Read 1x1 8bpp (black)", .tst_fn = test_read, .data = &PPM_ascii_1x1_8bpp_black, .flags = TST_CHECK_MALLOC}, {.name = "PPM Read 1x1 8bpp (white)", .tst_fn = test_read, .data = &PPM_ascii_1x1_8bpp_white, .flags = TST_CHECK_MALLOC}, {.name = "PPM Read 1x1 8bpp (white) Raw", .tst_fn = test_read, .data = &PPM_bin_1x1_8bpp_white, .flags = TST_CHECK_MALLOC}, {.name = "PPM Save Load", .tst_fn = test_save_load, .data = &PPM_save_load, .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = "PPM Load wrong header", .tst_fn = test_load_fail, .res_path = "data/ppm/corrupt/wrong_header.ppm", .data = "wrong_header.ppm", .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = "PPM Load incomplete", .tst_fn = test_load_fail, .res_path = "data/ppm/corrupt/incomplete.ppm", .data = "incomplete.ppm", .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = NULL}, } };
/* (c) Code Red Technologies. dTR */ #if !defined(__CR2_C___4_6_2_BITS_FUNCTEXCEPT_H__) # define __CR2_C___4_6_2_BITS_FUNCTEXCEPT_H__ # if defined(__REDLIB__) # include_next <c++/4.6.2/bits/functexcept.h> # else # include <newlib_inc/c++/4.6.2/bits/functexcept.h> # if !defined (__NEWLIB__) && !defined(__LIBRARY_WARNING_MESSAGE__) # warning "Either __NEWLIB__ or __REDLIB__ should be defined when using the C library. Defaulting to __NEWLIB__" # define __LIBRARY_WARNING_MESSAGE__ # endif # endif #endif
// // libavg - Media Playback Engine. // Copyright (C) 2003-2011 Ulrich von Zadow // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Current versions can be found at www.libavg.de // #ifndef _WGLContext_H_ #define _WGLContext_H_ #include "../api.h" #include "GLContext.h" #include <boost/shared_ptr.hpp> struct SDL_SysWMinfo; namespace avg { class AVG_API WGLContext: public GLContext { public: WGLContext(const GLConfig& glConfig, const IntPoint& windowSize=IntPoint(0,0), const SDL_SysWMinfo* pSDLWMInfo=0); virtual ~WGLContext(); void activate(); bool initVBlank(int rate); private: void checkWinError(BOOL bOK, const std::string& sWhere); HWND m_hwnd; HDC m_hDC; HGLRC m_Context; }; } #endif
/**************************************************************************** ** ** Copyright (C) 2014 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 CPPPOINTERDECLARATIONFORMATTER_H #define CPPPOINTERDECLARATIONFORMATTER_H #include "cpptools_global.h" #include "cpprefactoringchanges.h" #include <cplusplus/Overview.h> namespace CppTools { using namespace CPlusPlus; using namespace CppTools; /*! \class CppTools::PointerDeclarationFormatter \brief The PointerDeclarationFormatter class rewrites pointer or reference declarations to an Overview. The following constructs are supported: \list \li Simple declarations \li Parameters and return types of function declarations and definitions \li Control flow statements like if, while, for, foreach \endlist */ class CPPTOOLS_EXPORT PointerDeclarationFormatter: protected ASTVisitor { public: /*! \enum PointerDeclarationFormatter::CursorHandling This enum type simplifies the QuickFix implementation. \value RespectCursor Consider the cursor position or selection of the CppRefactoringFile for rejecting edit operation candidates for the resulting ChangeSet. If there is a selection, the range of the edit operation candidate should be inside the selection. If there is no selection, the cursor position should be within the range of the edit operation candidate. \value IgnoreCursor Cursor position or selection of the CppRefactoringFile will _not_ be considered for aborting. */ enum CursorHandling { RespectCursor, IgnoreCursor }; explicit PointerDeclarationFormatter(const CppRefactoringFilePtr &refactoringFile, Overview &overview, CursorHandling cursorHandling = IgnoreCursor); /*! Returns a ChangeSet for applying the formatting changes. The ChangeSet is empty if it was not possible to rewrite anything. */ Utils::ChangeSet format(AST *ast) { if (ast) accept(ast); return m_changeSet; } protected: bool visit(SimpleDeclarationAST *ast); bool visit(FunctionDefinitionAST *ast); bool visit(ParameterDeclarationAST *ast); bool visit(IfStatementAST *ast); bool visit(WhileStatementAST *ast); bool visit(ForStatementAST *ast); bool visit(ForeachStatementAST *ast); private: class TokenRange { public: TokenRange() : start(0), end(0) {} TokenRange(unsigned start, unsigned end) : start(start), end(end) {} unsigned start; unsigned end; }; void processIfWhileForStatement(ExpressionAST *expression, Symbol *symbol); void checkAndRewrite(DeclaratorAST *declarator, Symbol *symbol, TokenRange range, unsigned charactersToRemove = 0); void printCandidate(AST *ast); const CppRefactoringFilePtr m_cppRefactoringFile; Overview &m_overview; const CursorHandling m_cursorHandling; Utils::ChangeSet m_changeSet; }; } // namespace CppTools #endif // CPPPOINTERDECLARATIONFORMATTER_H
/*************** <auto-copyright.pl BEGIN do not edit this line> ************** * * VR Juggler is (C) Copyright 1998-2007 by Iowa State University * * Original Authors: * Allen Bierbaum, Christopher Just, * Patrick Hartling, Kevin Meinert, * Carolina Cruz-Neira, Albert Baker * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library 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. * *************** <auto-copyright.pl END do not edit this line> ***************/ #include <vpr/IO/SerializableObject.h> namespace vrjTest { struct MyType { int something; float otherStuff; char stupid; bool drawBool; }; } namespace vpr { /** * Serializes an object of type vrjTest::MyType into the given object writer. * * @param writer The object writer used for serializing the vrjTest::MyType * object. * * @throw vpr::IOException is thrown if object serialization fails. */ template<> inline void vpr::SerializableObjectMixin<vrjTest::MyType>::writeObject(vpr::ObjectWriter* writer) { writer->writeUint16(something); writer->writeBool(drawBool); } /** * De-serializes an object of type vrjTest::MyType using the data in the * given object reader. * * @param reader The object reader used for de-serializing the vrjTest::MyType * object. * * @throw vpr::IOException is thrown if object de-serialization fails. */ template<> inline void vpr::SerializableObjectMixin<vrjTest::MyType>::readObject(vpr::ObjectReader* reader) { something = reader->readUint16(); drawBool = reader->readBool(); } }
/**************************************************************************** * Copyright (C) 2013-2014 by Savoir-Faire Linux * * Author : Alexandre Lision <alexandre.lision@savoirfairelinux.com> * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ #ifndef VCARDUTILS_H #define VCARDUTILS_H #include "typedefs.h" #include <QStringList> #include "person.h" class VCardUtils { public: struct Delimiter { constexpr static const char* SEPARATOR_TOKEN = ";"; constexpr static const char* END_LINE_TOKEN = "\n"; constexpr static const char* BEGIN_TOKEN = "BEGIN:VCARD"; constexpr static const char* END_TOKEN = "END:VCARD"; }; struct Property { constexpr static const char* UID = "UID"; constexpr static const char* VERSION = "VERSION"; constexpr static const char* ADDRESS = "ADR"; constexpr static const char* AGENT = "AGENT"; constexpr static const char* BIRTHDAY = "BDAY"; constexpr static const char* CATEGORIES = "CATEGORIES"; constexpr static const char* CLASS = "CLASS"; constexpr static const char* DELIVERY_LABEL = "LABEL"; constexpr static const char* EMAIL = "EMAIL"; constexpr static const char* FORMATTED_NAME = "FN"; constexpr static const char* GEOGRAPHIC_POSITION = "GEO"; constexpr static const char* KEY = "KEY"; constexpr static const char* LOGO = "LOGO"; constexpr static const char* MAILER = "MAILER"; constexpr static const char* NAME = "N"; constexpr static const char* NICKNAME = "NICKNAME"; constexpr static const char* NOTE = "NOTE"; constexpr static const char* ORGANIZATION = "ORG"; constexpr static const char* PHOTO = "PHOTO"; constexpr static const char* PRODUCT_IDENTIFIER = "PRODID"; constexpr static const char* REVISION = "REV"; constexpr static const char* ROLE = "ROLE"; constexpr static const char* SORT_STRING = "SORT-STRING"; constexpr static const char* SOUND = "SOUND"; constexpr static const char* TELEPHONE = "TEL"; constexpr static const char* TIME_ZONE = "TZ"; constexpr static const char* TITLE = "TITLE"; constexpr static const char* URL = "URL"; constexpr static const char* X_RINGACCOUNT = "X-RINGACCOUNTID"; }; VCardUtils(); void startVCard(const QString& version); void addProperty(const char* prop, const QString& value); void addProperty(const QString& prop, const QString& value); void addEmail(const QString& type, const QString& num); void addAddress(const Person::Address* addr); void addContactMethod(const QString& type, const QString& num); void addPhoto(const QByteArray img); const QByteArray endVCard(); //Loading static QList<Person*> loadDir(const QUrl& path, bool& ok, QHash<const Person*, QString>& paths); //Mapping static bool mapToPerson(Person* p, const QUrl& url, Account** a = nullptr); static bool mapToPerson(Person* p, const QByteArray& content, Account** a = nullptr); private: //Attributes QStringList m_vCard; }; #endif // VCARDUTILS_H
/* * driver-state.h: entry points for state drivers * * Copyright (C) 2006-2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ #pragma once #ifndef __VIR_DRIVER_H_INCLUDES___ # error "Don't include this file directly, only use driver.h" #endif typedef enum { VIR_DRV_STATE_INIT_ERROR = -1, VIR_DRV_STATE_INIT_SKIPPED, VIR_DRV_STATE_INIT_COMPLETE, } virDrvStateInitResult; typedef virDrvStateInitResult (*virDrvStateInitialize)(bool privileged, const char *root, virStateInhibitCallback callback, void *opaque); typedef int (*virDrvStateCleanup)(void); typedef int (*virDrvStateReload)(void); typedef int (*virDrvStateStop)(void); typedef struct _virStateDriver virStateDriver; typedef virStateDriver *virStateDriverPtr; struct _virStateDriver { const char *name; bool initialized; virDrvStateInitialize stateInitialize; virDrvStateCleanup stateCleanup; virDrvStateReload stateReload; virDrvStateStop stateStop; };
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef EELARTIFICIALVISC_H #define EELARTIFICIALVISC_H #include "Kernel.h" // Forward Declarations class EelArtificialVisc; template<> InputParameters validParams<EelArtificialVisc>(); class EelArtificialVisc : public Kernel { public: EelArtificialVisc(const std::string & name, InputParameters parameters); protected: virtual Real computeQpResidual(); virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int _jvar); private: // Equations types enum EquationType { CONTINUITY = 0, XMOMENTUM = 1, YMOMENTUM = 2, ZMOMENTUM = 3, ENERGY = 4 }; // Diffusion types enum DiffusionType { ENTROPY = 0, PARABLOIC = 1, NONE = 2 }; // Diffusion name std::string _equ_name; std::string _diff_name; // Diffusion type MooseEnum _equ_type; MooseEnum _diff_type; // Coupled aux variables: VariableValue & _rho; VariableGradient & _grad_rho; VariableValue & _vel_x; VariableValue & _vel_y; VariableValue & _vel_z; VariableGradient & _grad_vel_x; VariableGradient & _grad_vel_y; VariableGradient & _grad_vel_z; VariableGradient & _grad_rhoe; VariableValue & _area; VariableValue & _norm_vel; VariableGradient & _grad_norm_vel; // Material property: viscosity coefficient. MaterialProperty<Real> & _mu; MaterialProperty<Real> & _kappa; }; #endif // EELARTIFICIALVISC_H
/* Title: polyexports.h Copyright (c) 2006, 2011, 2015 David C.J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This header contains the structures used in saved state created by "export". */ #ifndef _STANDALONE_H #define _STANDALONE_H 1 // Get time_t #ifdef HAVE_TIME_H #include <time.h> #endif // Get uintptr_t #if HAVE_STDINT_H # include <stdint.h> #endif #if HAVE_INTTYPES_H # ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS # endif # include <inttypes.h> #endif #ifdef HAVE_STDDEF_H # include <stddef.h> #endif #if defined(HAVE_WINDOWS_H) # include <windows.h> #endif // There are several entries typedef struct _memTableEntry { void *mtAddr; // The address of the area of memory uintptr_t mtLength; // The length in bytes of the area uintptr_t mtFlags; // Flags describing the area. uintptr_t mtIndex; // An index to identify permanent spaces. } memoryTableEntry; #define MTF_WRITEABLE 0x00000001 // The area is writeable by ML code #define MTF_EXECUTABLE 0x00000002 // The area contains executable code #define MTF_NO_OVERWRITE 0x00000004 // With MTF_WRITEABLE: Don't load over the top #define MTF_BYTES 0x00000008 // Contains only byte data and no addresses typedef struct _exportDescription { unsigned structLength; // The length of this structure unsigned memTableSize; // The size of each entry in the memory table unsigned memTableEntries; // The number of entries in the memory table unsigned ioIndex; // The index in the memory table for the io interface area memoryTableEntry *memTable; // Pointer to the memory table. void *rootFunction; // Points to the start-up function time_t timeStamp; // Creation time stamp unsigned architecture; // Machine architecture unsigned rtsVersion; // Run-time system version unsigned ioSpacing; // Size of each entry in the io interface area. } exportDescription; extern exportDescription poly_exports; #ifdef __cplusplus extern "C" { #endif #if (defined(_WIN32) && ! defined(__CYGWIN__)) #include <Windows.h> # ifdef LIBPOLYML_BUILD # ifdef DLL_EXPORT # define POLYLIB_API __declspec (dllexport) # endif # elif defined _MSC_VER // Visual C - POLYLIB_EXPORTS is defined in the library project settings # ifdef POLYLIB_EXPORTS # define POLYLIB_API __declspec (dllexport) # else # define POLYLIB_API __declspec (dllimport) # endif # elif defined DLL_EXPORT # define POLYLIB_API __declspec (dllimport) # else # define POLYLIB_API # endif extern POLYLIB_API int PolyWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow, exportDescription *exports); #else int polymain(int argc, char *argv[], exportDescription *exports); #endif #ifdef __cplusplus }; #endif #endif
/* * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2009 Nokia. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library 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. */ #include <glib.h> #include "event-source.h" typedef struct _DisplaySource { GSource source; Display *display; GPollFD event_poll_fd; } DisplaySource; /*---------------------------------------------------------------------------*/ static void (*_spi_default_filter) (XEvent*, void*) = NULL; static void* _spi_default_filter_data = NULL; /*---------------------------------------------------------------------------*/ static gboolean event_prepare (GSource *source, gint *timeout) { Display *display = ((DisplaySource *)source)->display; gboolean retval; *timeout = -1; retval = XPending (display); return retval; } static gboolean event_check (GSource *source) { DisplaySource *display_source = (DisplaySource*)source; gboolean retval; if (display_source->event_poll_fd.revents & G_IO_IN) retval = XPending (display_source->display); else retval = FALSE; return retval; } static gboolean event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { Display *display = ((DisplaySource*)source)->display; XEvent xevent; /* TODO - Should this be "if (XPending (display))"? * The effect of this might be to run other main loop functions * before dispatching the next XEvent. */ while (XPending (display)) { XNextEvent (display, &xevent); switch (xevent.type) { case KeyPress: case KeyRelease: break; default: if (XFilterEvent (&xevent, None)) continue; } if (_spi_default_filter) { _spi_default_filter (&xevent, _spi_default_filter_data); } } return TRUE; } /*---------------------------------------------------------------------------*/ static GSourceFuncs event_funcs = { event_prepare, event_check, event_dispatch, NULL }; static GSource * display_source_new (Display *display) { GSource *source = g_source_new (&event_funcs, sizeof (DisplaySource)); DisplaySource *display_source = (DisplaySource *) source; display_source->display = display; return source; } /*---------------------------------------------------------------------------*/ static DisplaySource *spi_display_source = NULL; void spi_events_init (Display *display) { GSource *source; int connection_number = ConnectionNumber (display); source = display_source_new (display); spi_display_source = (DisplaySource*) source; g_source_set_priority (source, G_PRIORITY_DEFAULT); spi_display_source->event_poll_fd.fd = connection_number; spi_display_source->event_poll_fd.events = G_IO_IN; g_source_add_poll (source, &spi_display_source->event_poll_fd); g_source_set_can_recurse (source, TRUE); g_source_attach (source, NULL); } void spi_events_uninit () { if (spi_display_source) { g_source_destroy ((GSource *) spi_display_source); g_source_unref ((GSource *) spi_display_source); spi_display_source = NULL; } } void spi_set_events (long event_mask) { long xevent_mask = StructureNotifyMask | PropertyChangeMask; xevent_mask |= event_mask; XSelectInput (spi_display_source->display, DefaultRootWindow (spi_display_source->display), xevent_mask); } void spi_set_filter (void (*filter) (XEvent*, void*), void* data) { _spi_default_filter = filter; _spi_default_filter_data = data; } /*END------------------------------------------------------------------------*/