text
stringlengths
4
6.14k
#ifndef CLIB_H #define CLIB_H #include <array> using namespace std; string get_lambs_path(); vector<string> environment(); void set_lambs_path( std::string path); void scale ( int h0, int wpc, int lpc, int rpc, int tpc, int bpc, string& s ); void binary_to_text(vector<char>& bytes, stringstream& text); string utf32_to_utf8(uint32_t); void to_utf8(string& src, string& des, int code); uint64_t die(); class gray_8_rgb_c { public: gray_8_rgb_c(); array<uint32_t,256> table; }; class pixel_c { public: pixel_c (); pixel_c ( const pixel_c&); pixel_c ( int x, int y, uint32_t color ); int x; int y; uint32_t color; }; #endif
#ifndef BZS_DB_TRANSACTD_APPBUILDERIMPLE_H #define BZS_DB_TRANSACTD_APPBUILDERIMPLE_H /*================================================================= Copyright (C) 2012 2013 BizStation Corp All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 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. =================================================================*/ #include <bzs/netsvc/server/IAppModule.h> #define PROTOCOL_TYPE_BTRV 1 #define PROTOCOL_TYPE_HS 2 #define PROTOCOL_TYPE_ASYNCWRITE 4 #define PROTOCOL_TYPE_MEMBUFFER 8 /** IAppModule factry * Implements IAppModule and Implements IMyPluginModule::create too. */ class IMyPluginModule : public bzs::netsvc::server::IAppModule { public: static bzs::netsvc::server::IAppModule* create(const boost::asio::ip::tcp::endpoint& endpoint, bzs::netsvc::server::iconnection* connection, bool tpool, int type); }; class transctionalIF : public bzs::netsvc::server::IAppModuleBuilder { bzs::netsvc::server::IAppModule* createSessionModule(const boost::asio::ip::tcp::endpoint& endpoint, bzs::netsvc::server::iconnection* connection, bool tpool) { return IMyPluginModule::create(endpoint, connection, tpool, m_type); } int m_type; public: transctionalIF(int type) : m_type(type){}; }; #endif // BZS_DB_TRANSACTD_APPLICATIONIMPLE_H
// // HotPursueViewController.h // WeaponsMagazines // // Created by liyong on 15-6-19. // Copyright (c) 2015年 liyong. All rights reserved. // #import <UIKit/UIKit.h> #import "BaseViewController.h" @interface HotPursueViewController : BaseViewController @end
/* arch/arm/mach-msm/board-bravoc.h * * Copyright (C) 2009 HTC Corporation. * Author: Haley Teng <Haley_Teng@htc.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. */ #ifndef __ARCH_ARM_MACH_MSM_BOARD_BRAVOC_H #define __ARCH_ARM_MACH_MSM_BOARD_BRAVOC_H #include <mach/board.h> #define MSM_SMI_BASE 0x02B00000 #define MSM_SMI_SIZE 0x01500000 #define MSM_PMEM_VENC_BASE 0x02B00000 #define MSM_PMEM_VENC_SIZE 0x00800000 #define MSM_GPU_MEM_BASE 0x03300000 #define MSM_GPU_MEM_SIZE 0x00300000 #define MSM_RAM_CONSOLE_BASE 0x03A00000 #define MSM_RAM_CONSOLE_SIZE 0x00040000 #define MSM_FB_BASE 0x03B00000 #define MSM_FB_SIZE 0x00465000 #define MSM_EBI1_BANK0_BASE 0x20000000 #define MSM_EBI1_BANK0_SIZE 0x0E800000 #define MSM_EBI1_BANK1_BASE 0x30000000 #define MSM_EBI1_BANK1_SIZE 0x0B700000 #define MSM_PMEM_MDP_BASE 0x3B700000 #define MSM_PMEM_MDP_SIZE 0x02000000 #define MSM_PMEM_ADSP_BASE 0x3D700000 #define MSM_PMEM_ADSP_SIZE 0x02900000 #define BRAVOC_GPIO_PS_HOLD 25 #define BRAVOC_GPIO_UP_INT_N 35 #define BRAVOC_GPIO_UP_RESET_N 82 #define BRAVOC_GPIO_LS_EN 119 #define BRAVOC_GPIO_TP_INT_N 92 #define BRAVOC_GPIO_TP_LS_EN 93 #define BRAVOC_GPIO_TP_EN 160 #define BRAVOC_GPIO_POWER_KEY 94 #define BRAVOC_GPIO_RESET_BTN 27 #define BRAVOC_GPIO_WIFI_SHUTDOWN_N 127 #define BRAVOC_GPIO_WIFI_IRQ 152 #define BRAVOC_GPIO_JOGBALL_POWER 150 #define BRAVOC_GPIO_KP_MPIN0 42 #define BRAVOC_GPIO_KP_MPIN1 41 #define BRAVOC_GPIO_KP_MPIN2 40 #define BRAVOC_GPIO_KP_MKOUT0 33 #define BRAVOC_GPIO_KP_MKOUT1 32 #define BRAVOC_GPIO_KP_MKOUT2 31 /* Bluetooth */ #define BRAVOC_GPIO_BT_UART1_RTS 43 #define BRAVOC_GPIO_BT_UART1_CTS 44 #define BRAVOC_GPIO_BT_UART1_RX 45 #define BRAVOC_GPIO_BT_UART1_TX 46 #define BRAVOC_GPIO_BT_RESET_N 146 #define BRAVOC_GPIO_BT_SHUTDOWN_N 128 #define BRAVOC_GPIO_BT_HOST_WAKE 86 #define BRAVOC_GPIO_BT_CHIP_WAKE 28 #define BRAVOC_GPIO_UART3_RX 139 #define BRAVOC_GPIO_UART3_TX 140 #define BRAVOC_GPIO_COMPASS_RST_N 107 #define BRAVOC_GPIO_COMPASS_INT_N 153 #define BRAVOC_PROJECT_NAME "bravoc" #define BRAVOC_LAYOUTS { \ { {-1, 0, 0}, { 0, -1, 0}, {0, 0, 1} }, /*cspec_Hlayout*/ \ { { 0, -1, 0}, { 1, 0, 0}, {0, 0, -1} }, /*cspec_Alayout*/ \ { { 0, -1, 0}, { 1, 0, 0}, {0, 0, 1} }, /*m_Hlayout*/ \ { {-1, 0, 0}, { 0, 0, -1}, {0, 1, 0} } /*m_Alayout*/ \ } /* Proximity */ #define BRAVOC_GPIO_PROXIMITY_INT 90 #define BRAVOC_GPIO_PROXIMITY_EN 120 /* Battery */ #define BRAVOC_GPIO_MBAT_IN 39 #define BRAVOC_GPIO_MCHG_EN_N 22 #define BRAVOC_GPIO_DQ_PWRDN_N 87 /*Audio */ #define BRAVOC_AUD_JACKHP_EN 157 #define BRAVOC_AUD_2V5_EN 158 #define BRAVOC_AUD_SPK_EN 104 /* Bluetooth PCM */ #define BRAVOC_BT_PCM_OUT 68 #define BRAVOC_BT_PCM_IN 69 #define BRAVOC_BT_PCM_SYNC 70 #define BRAVOC_BT_PCM_CLK 71 #define BRAVOC_VIB_3V3_EN 89 /* flash light */ #define BRAVOC_GPIO_FLASHLIGHT_TORCH (26) #define BRAVOC_GPIO_FLASHLIGHT_FLASH (84) /* LCM */ #define BRAVOC_LCD_SPI_CLK (17) #define BRAVOC_LCD_SPI_CSz (20) #define BRAVOC_LCD_RSTz (29) #define BRAVOC_LCD_R0 (113) /* XB new added */ #define BRAVOC_LCD_R1 (114) #define BRAVOC_LCD_R2 (115) #define BRAVOC_LCD_R3 (116) #define BRAVOC_LCD_R4 (117) #define BRAVOC_LCD_R5 (118) #define BRAVOC_LCD_G0 (121) #define BRAVOC_LCD_G1 (122) #define BRAVOC_LCD_G2 (123) #define BRAVOC_LCD_G3 (124) #define BRAVOC_LCD_G4 (125) #define BRAVOC_LCD_G5 (126) #define BRAVOC_LCD_B0 (129) /* XB new added*/ #define BRAVOC_LCD_B1 (130) #define BRAVOC_LCD_B2 (131) #define BRAVOC_LCD_B3 (132) #define BRAVOC_LCD_B4 (133) #define BRAVOC_LCD_B5 (134) #define BRAVOC_LCD_PCLK (135) #define BRAVOC_LCD_VSYNC (136) #define BRAVOC_LCD_HSYNC (137) #define BRAVOC_LCD_DE (138) #define BRAVOC_LCD_ID0 (147) #define BRAVOC_GPIO_USB_ID_PIN (36) unsigned int bravoc_get_engineerid(void); #endif /* __ARCH_ARM_MACH_MSM_BOARD_BRAVOC_H */
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ #define ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ #include "base/basictypes.h" #include "base/files/file_path.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/webdata/common/web_data_service_consumer.h" #include "components/webdata/common/web_database_service.h" namespace base { class WaitableEvent; }; namespace android_webview { class AwFormDatabaseService : public WebDataServiceConsumer { public: AwFormDatabaseService(const base::FilePath path); virtual ~AwFormDatabaseService(); void Shutdown(); bool HasFormData(); void ClearFormData(); scoped_refptr<autofill::AutofillWebDataService> get_autofill_webdata_service(); virtual void OnWebDataServiceRequestDone( WebDataServiceBase::Handle h, const WDTypedResult* result) OVERRIDE; private: struct PendingQuery { bool* result; base::WaitableEvent* completion; }; typedef std::map<WebDataServiceBase::Handle, PendingQuery> QueryMap; void ClearFormDataImpl(); void HasFormDataImpl(base::WaitableEvent* completion, bool* result); QueryMap result_map_; scoped_refptr<autofill::AutofillWebDataService> autofill_data_; scoped_refptr<WebDatabaseService> web_database_; DISALLOW_COPY_AND_ASSIGN(AwFormDatabaseService); }; } #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2018 Intel Corp. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * 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. */ #ifndef _SOC_SMM_H_ #define _SOC_SMM_H_ #include <stdint.h> #include <cpu/x86/msr.h> #include <fsp/memmap.h> #include <soc/gpio.h> struct ied_header { char signature[10]; u32 size; u8 reserved[34]; } __packed; struct smm_relocation_params { u32 smram_base; u32 smram_size; u32 ied_base; u32 ied_size; msr_t smrr_base; msr_t smrr_mask; msr_t emrr_base; msr_t emrr_mask; msr_t uncore_emrr_base; msr_t uncore_emrr_mask; /* * The smm_save_state_in_msrs field indicates if SMM save state * locations live in MSRs. This indicates to the CPUs how to adjust * the SMMBASE and IEDBASE */ int smm_save_state_in_msrs; }; /* Mainboard handler for eSPI SMIs */ void mainboard_smi_espi_handler(void); #if IS_ENABLED(CONFIG_HAVE_SMI_HANDLER) void smm_relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase); void smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size); void smm_initialize(void); void smm_relocate(void); #else /* CONFIG_HAVE_SMI_HANDLER */ static inline void smm_relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase) {} static inline void smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size) {} static inline void smm_initialize(void) {} static inline void smm_relocate(void) {} #endif /* CONFIG_HAVE_SMI_HANDLER */ #endif
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:36 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/linux/mv643xx_i2c.h */ /* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #ifndef _MV64XXX_I2C_H_ #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif #define _MV64XXX_I2C_H_ #include <linux/types.h> #define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c" /* i2c Platform Device, Driver Data */ struct mv64xxx_i2c_pdata { u32 freq_m; u32 freq_n; u32 timeout; /* In milliseconds */ }; #endif /*_MV64XXX_I2C_H_*/
/* * linker.h - Linker script mapping information * * Machine generated for CPU 'cpu' in SOPC Builder design 'SistemaPrincipal' * SOPC Builder design path: ../../SistemaPrincipal.sopcinfo * * Generated: Thu Apr 18 16:21:13 WEST 2013 */ /* * DO NOT MODIFY THIS FILE * * Changing this file will have subtle consequences * which will almost certainly lead to a nonfunctioning * system. If you do modify this file, be aware that your * changes will be overwritten and lost when this file * is generated again. * * DO NOT MODIFY THIS FILE */ /* * License Agreement * * Copyright (c) 2008 * Altera Corporation, San Jose, California, USA. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * This agreement shall be governed in all respects by the laws of the State * of California and by the laws of the United States of America. */ #ifndef __LINKER_H_ #define __LINKER_H_ /* * BSP controls alt_load() behavior in crt0. * */ #define ALT_LOAD_EXPLICITLY_CONTROLLED /* * Base address and span (size in bytes) of each linker region * */ #define DDR_SDRAM_REGION_BASE 0x20 #define DDR_SDRAM_REGION_SPAN 33554400 #define RESET_REGION_BASE 0x0 #define RESET_REGION_SPAN 32 /* * Devices associated with code sections * */ #define ALT_EXCEPTIONS_DEVICE DDR_SDRAM #define ALT_RESET_DEVICE DDR_SDRAM #define ALT_RODATA_DEVICE DDR_SDRAM #define ALT_RWDATA_DEVICE DDR_SDRAM #define ALT_TEXT_DEVICE DDR_SDRAM /* * Initialization code at the reset address is allowed (e.g. no external bootloader). * */ #define ALT_ALLOW_CODE_AT_RESET /* * The alt_load() facility is called from crt0 to copy sections into RAM. * */ #define ALT_LOAD_COPY_RWDATA #endif /* __LINKER_H_ */
/* * Copyright (C) 2010, 2012-2014 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file mali_osk_mali.c * Implementation of the OS abstraction layer which is specific for the Mali kernel device driver */ #include <linux/kernel.h> #include <asm/uaccess.h> #include <linux/platform_device.h> #include <linux/mali/mali_utgard.h> #include "mali_osk_mali.h" #include "mali_kernel_common.h" /* MALI_xxx macros */ #include "mali_osk.h" /* kernel side OS functions */ #include "mali_kernel_linux.h" _mali_osk_errcode_t _mali_osk_resource_find(u32 addr, _mali_osk_resource_t *res) { int i; if (NULL == mali_platform_device) { /* Not connected to a device */ return _MALI_OSK_ERR_ITEM_NOT_FOUND; } for (i = 0; i < mali_platform_device->num_resources; i++) { if (IORESOURCE_MEM == resource_type(&(mali_platform_device->resource[i])) && mali_platform_device->resource[i].start == addr) { if (NULL != res) { res->base = addr; res->description = mali_platform_device->resource[i].name; /* Any (optional) IRQ resource belonging to this resource will follow */ if ((i + 1) < mali_platform_device->num_resources && IORESOURCE_IRQ == resource_type(&(mali_platform_device->resource[i+1]))) { res->irq = mali_platform_device->resource[i+1].start; } else { res->irq = -1; } } return _MALI_OSK_ERR_OK; } } return _MALI_OSK_ERR_ITEM_NOT_FOUND; } u32 _mali_osk_resource_base_address(void) { u32 lowest_addr = 0xFFFFFFFF; u32 ret = 0; if (NULL != mali_platform_device) { int i; for (i = 0; i < mali_platform_device->num_resources; i++) { if (mali_platform_device->resource[i].flags & IORESOURCE_MEM && mali_platform_device->resource[i].start < lowest_addr) { lowest_addr = mali_platform_device->resource[i].start; ret = lowest_addr; } } } return ret; } _mali_osk_errcode_t _mali_osk_device_data_get(struct _mali_osk_device_data *data) { MALI_DEBUG_ASSERT_POINTER(data); if (NULL != mali_platform_device) { struct mali_gpu_device_data* os_data = NULL; os_data = (struct mali_gpu_device_data*)mali_platform_device->dev.platform_data; if (NULL != os_data) { /* Copy data from OS dependant struct to Mali neutral struct (identical!) */ data->dedicated_mem_start = os_data->dedicated_mem_start; data->dedicated_mem_size = os_data->dedicated_mem_size; data->shared_mem_size = os_data->shared_mem_size; data->fb_start = os_data->fb_start; data->fb_size = os_data->fb_size; data->max_job_runtime = os_data->max_job_runtime; data->utilization_interval = os_data->utilization_interval; data->utilization_callback = os_data->utilization_callback; data->pmu_switch_delay = os_data->pmu_switch_delay; data->set_freq_callback = os_data->set_freq_callback; memcpy(data->pmu_domain_config, os_data->pmu_domain_config, sizeof(os_data->pmu_domain_config)); return _MALI_OSK_ERR_OK; } } return _MALI_OSK_ERR_ITEM_NOT_FOUND; } mali_bool _mali_osk_shared_interrupts(void) { u32 irqs[128]; u32 i, j, irq, num_irqs_found = 0; MALI_DEBUG_ASSERT_POINTER(mali_platform_device); MALI_DEBUG_ASSERT(128 >= mali_platform_device->num_resources); for (i = 0; i < mali_platform_device->num_resources; i++) { if (IORESOURCE_IRQ & mali_platform_device->resource[i].flags) { irq = mali_platform_device->resource[i].start; for (j = 0; j < num_irqs_found; ++j) { if (irq == irqs[j]) { return MALI_TRUE; } } irqs[num_irqs_found++] = irq; } } return MALI_FALSE; }
#ifndef _POLY_ #define _POLY_ #include "config.h" #include "base_learner.h" #include "svm.h" class PolyLearner: public BaseLearner { public: PolyLearner(States* gsets, int (*func)(int*) = target_program, int max_iteration = max_iter); ~PolyLearner(); virtual int learn(); int selectiveSampling(int randn, int exen, int type = 0, void* params = NULL); virtual std::string invariant(); protected: SVM* svm; int max_iteration; Classifier* cl; }; #endif
#ifndef COMPILER_ARG_H #define COMPILER_ARG_H // **************************************************************************** // args.h ELIOT project // **************************************************************************** // // File Description: // // Check if a tree matches the form on the left of a rewrite // // // // // // // // // **************************************************************************** // This document is released under the GNU General Public License, with the // following clarification and exception. // // Linking this library statically or dynamically with other modules is making // a combined work based on this library. Thus, the terms and conditions of the // GNU General Public License cover the whole combination. // // As a special exception, the copyright holders of this library give you // permission to link this library with independent modules to produce an // executable, regardless of the license terms of these independent modules, // and to copy and distribute the resulting executable under terms of your // choice, provided that you also meet, for each linked independent module, // the terms and conditions of the license of that module. An independent // module is a module which is not derived from or based on this library. // If you modify this library, you may extend this exception to your version // of the library, but you are not obliged to do so. If you do not wish to // do so, delete this exception statement from your version. // // See http://www.gnu.org/copyleft/gpl.html and Matthew 25:22 for details // (C) 1992-2010 Christophe de Dinechin <christophe@taodyne.com> // (C) 2010 Taodyne SAS // **************************************************************************** #include "compiler.h" #include "renderer.h" ELIOT_BEGIN struct Types; typedef GCPtr<Types> Types_p; struct RewriteBinding // ---------------------------------------------------------------------------- // Structure recording the binding of a given parameter to a value // ---------------------------------------------------------------------------- { RewriteBinding(Name *name, Tree *value) : name(name), value(value), closure(NULL) {} bool IsDeferred(); llvm_value Closure(CompiledUnit *unit); Name_p name; Tree_p value; llvm_value closure; }; typedef std::vector<RewriteBinding> RewriteBindings; struct RewriteCondition // ---------------------------------------------------------------------------- // Structure recording a condition for a given rewrite to be valid // ---------------------------------------------------------------------------- { RewriteCondition(Tree *value, Tree *test): value(value), test(test) {} Tree_p value; Tree_p test; }; typedef std::vector<RewriteCondition> RewriteConditions; struct RewriteKind // ---------------------------------------------------------------------------- // Structure recording a condition for a given rewrite to be valid // ---------------------------------------------------------------------------- { RewriteKind(Tree *value, kind test, llvm_type mtype) : value(value), test(test), machineType(mtype) {} Tree_p value; kind test; llvm_type machineType; }; typedef std::vector<RewriteKind> RewriteKinds; struct RewriteCandidate // ---------------------------------------------------------------------------- // A rewrite candidate for a particular tree form // ---------------------------------------------------------------------------- { RewriteCandidate(Infix *rewrite) : rewrite(rewrite), bindings(), type(NULL), types(NULL) {} void Condition(Tree *value, Tree *test) { conditions.push_back(RewriteCondition(value, test)); } void KindCondition(Tree *value, kind k, llvm_type mtype) { IFTRACE(calltypes) { std::cerr << "Check if " << value << " has type " << (int) k << "\n"; llvm::errs() << " machine type is " << *mtype << "\n"; } kinds.push_back(RewriteKind(value, k, mtype)); } bool Unconditional() { return kinds.size() == 0 && conditions.size() == 0; } Infix_p rewrite; RewriteBindings bindings; RewriteKinds kinds; RewriteConditions conditions; Tree_p type; Types_p types; }; typedef std::vector<RewriteCandidate> RewriteCandidates; struct RewriteCalls // ---------------------------------------------------------------------------- // Identify the way to invoke rewrites for a particular form // ---------------------------------------------------------------------------- { RewriteCalls(Types *ti): types(ti), candidates() {} enum BindingStrength { FAILED, POSSIBLE, PERFECT }; Tree * Check(Prefix *scope, Tree *value, Infix *candidate); BindingStrength Bind(Context *context, Tree *ref, Tree *what, RewriteCandidate &rc); BindingStrength BindBinary(Context *context, Tree *form1, Tree *value1, Tree *form2, Tree *value2, RewriteCandidate &rc); bool Unify(RewriteCandidate &rc, Tree *valueType, Tree *formType, Tree *value, Tree *form, bool declaration = false); public: Types * types; RewriteCandidates candidates; GARBAGE_COLLECT(RewriteCalls); }; typedef GCPtr<RewriteCalls> RewriteCalls_p; typedef std::map<Tree_p, RewriteCalls_p> rcall_map; ELIOT_END #endif // COMPILER_ARG_H
static __device__ real3 fvolume(const RbcParams_v *par, real3 r2, real3 r3, real v0, real v) { real f0; real3 f, n; cross(&r3, &r2, /**/ &n); f0 = par->kv * (v - v0) / (6 * v0); axpy(f0, &n, /**/ &f); return f; } static __device__ real3 farea(const RbcParams_v *par, real3 x21, real3 x31, real3 x32, real a0, real A0, real A) { real3 nn, nnx32, f; real a, f0, fa, fA; cross(&x21, &x31, /**/ &nn); /* normal */ cross(&nn, &x32, /**/ &nnx32); a = 0.5 * sqrt(dot<real>(&nn, &nn)); fA = - par->ka * (A - A0) / (4 * A0 * a); fa = - par->kd * (a - a0) / (4 * a0 * a); f0 = fA + fa; axpy(f0, &nnx32, /**/ &f); return f; } enum {SPRING_OK, SPRING_LONG}; static __device__ real sq(real x) { return x * x; } static __device__ real wlc0(real r) { return (4*sq(r)-9*r+6)/(4*sq(r-1)); } static __device__ real wlc(real lmax, real ks, real r) { return ks/lmax*wlc0(r/lmax); } static __device__ real3 fspring(const RbcParams_v *par, real3 x21, real l0, /**/ int *pstatus) { #define wlc_r(r) (wlc(lmax, ks, r)) real m, r, fwlc, fpow, lmax, ks, x0; real3 f; *pstatus = SPRING_OK; ks = par->ks; m = par->mpow; x0 = par->x0; r = sqrtf(dot<real>(&x21, &x21)); lmax = l0 / x0; if (r >= lmax) { *pstatus = SPRING_LONG; return make_real3(0, 0, 0); } fwlc = wlc_r(r); /* make fwlc + fpow = 0 for r = l0 */ fpow = - wlc_r(l0) * powf(l0, m + 1) / powf(r, m + 1); axpy(fwlc + fpow, &x21, /**/ &f); return f; #undef wlc_r } static __device__ void report_tri(real3 r1, real3 r2, real3 r3) { printf("bad triangle: [%g %g %g] [%g %g %g] [%g %g %g]\n", r1.x, r1.y, r1.z, r2.x, r2.y, r2.z, r3.x, r3.y, r3.z); assert(0); } static __device__ real3 ftri(const RbcParams_v *par, real3 r1, real3 r2, real3 r3, StressInfo si, real area, real volume) { int spring_status; real3 fv, fa, fs; real3 x21, x32, x31, f = make_real3(0, 0, 0); diff(&r2, &r1, /**/ &x21); diff(&r3, &r2, /**/ &x32); diff(&r3, &r1, /**/ &x31); fa = farea(par, x21, x31, x32, si.a0, par->totArea, area); add(&fa, /**/ &f); fv = fvolume(par, r2, r3, par->totVolume, volume); add(&fv, /**/ &f); fs = fspring(par, x21, si.l0, &spring_status); if (spring_status != SPRING_OK) report_tri(r1, r2, r3); add(&fs, /**/ &f); return f; } static __device__ real3 fvisc(const RbcParams_v *par, real3 r1, real3 r2, real3 u1, real3 u2) { const real gammaC = par->gammaC, gammaT = par->gammaT; real3 du, dr, f = make_real3(0, 0, 0); diff(&u2, &u1, /**/ &du); diff(&r1, &r2, /**/ &dr); real fac = dot<real>(&du, &dr) / dot<real>(&dr, &dr); axpy(gammaT , &du, /**/ &f); axpy(gammaC * fac, &dr, /**/ &f); return f; } static __device__ real3 frnd(real, const RbcParams_v*, real3, real3, Rnd0Info) { return make_real3(0, 0, 0); } static __device__ real frnd0(real dt, const RbcParams_v *par, real rnd) { real f, g, T; g = par->gammaC; T = par->kBT; f = sqrtf(2*g*T/dt)*rnd; return f; } static __device__ real3 frnd(real dt, const RbcParams_v *par, real3 r1, real3 r2, Rnd1Info rnd) { real3 dr, f; real r, f0; diff(&r1, &r2, /**/ &dr); r = sqrtf(dot<real>(&dr, &dr)); f0 = frnd0(dt, par, rnd.r); axpy(f0/r, &dr, /**/ &f); return f; } /* forces from one dihedral */ template <int update> __device__ real3 fdih(const RbcParams_v *par, real3 r1, real3 r2, real3 r3, real3 r4) { real overIksiI, overIdzeI, cosTheta, IsinThetaI2, sinTheta_1, beta, b11, b12, phi, sint0kb, cost0kb; real3 r12, r13, r34, r24, r41, ksi, dze, ksimdze; diff(&r1, &r2, /**/ &r12); diff(&r1, &r3, /**/ &r13); diff(&r3, &r4, /**/ &r34); diff(&r2, &r4, /**/ &r24); diff(&r4, &r1, /**/ &r41); cross(&r12, &r13, /**/ &ksi); cross(&r34, &r24, /**/ &dze); overIksiI = rsqrtf(dot<real>(&ksi, &ksi)); overIdzeI = rsqrtf(dot<real>(&dze, &dze)); cosTheta = dot<real>(&ksi, &dze) * overIksiI * overIdzeI; IsinThetaI2 = 1.0f - cosTheta * cosTheta; diff(&ksi, &dze, /**/ &ksimdze); sinTheta_1 = copysignf (rsqrtf(max(IsinThetaI2, 1.0e-6)), dot<real>(&ksimdze, &r41)); // ">" because the normals look inside phi = par->phi / 180.0 * M_PI; sint0kb = sin(phi) * par->kb; cost0kb = cos(phi) * par->kb; beta = cost0kb - cosTheta * sint0kb * sinTheta_1; b11 = -beta * cosTheta * overIksiI * overIksiI; b12 = beta * overIksiI * overIdzeI; if (update == 1) { real3 r32, f1, f; diff(&r3, &r2, /**/ &r32); cross(&ksi, &r32, /**/ &f); cross(&dze, &r32, /**/ &f1); scal(b11, /**/ &f); axpy(b12, &f1, /**/ &f); return f; } else if (update == 2) { real3 f, f1, f2, f3; real b22 = -beta * cosTheta * overIdzeI * overIdzeI; cross(&ksi, &r13, /**/ &f); cross(&ksi, &r34, /**/ &f1); cross(&dze, &r13, /**/ &f2); cross(&dze, &r34, /**/ &f3); scal(b11, /**/ &f); add(&f2, /**/ &f1); axpy(b12, &f1, /**/ &f); axpy(b22, &f3, /**/ &f); return f; } else return make_real3(0, 0, 0); }
/* * This file is part of bgpstream * * CAIDA, UC San Diego * bgpstream-info@caida.org * * Copyright (C) 2012 The Regents of the University of California. * Authors: Alistair King, Chiara Orsini * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __BGPCORSARO_PACIFIER_H #define __BGPCORSARO_PACIFIER_H #include "bgpcorsaro_plugin.h" /** @file * * @brief Header file which exports bgpcorsaro_pacifier plugin API * * @author Chiara Orsini * */ BGPCORSARO_PLUGIN_GENERATE_PROTOS(bgpcorsaro_pacifier) #endif /* __BGPCORSARO_PACIFIER_H */
// // main.c // 20150523-2 // // Created by 欣 陈 on 15/5/23. // Copyright (c) 2015年 欣 陈. All rights reserved. // //编写一个函数,实现两个字符串的比较。即自己写一个strcmp函数,函数原型为strcmp(char *p1,char *p2) #include <stdio.h> int main(){ int astrcmp(char *,char *); int m; char str1[20],str2[20]; char *p1,*p2; printf("input two strings:\n"); scanf("%s",str1); scanf("%s",str2); p1 = &str1[0]; p2 = &str2[0]; m = astrcmp(p1,p2); printf("result:%d\n",m); return 0; } int astrcmp(char *p1,char *p2){ int i; i = 0; while(*(p1 + i) == *(p2 + i)) if(*(p1 + i++) == '\0') return(0); return(*(p1 + i) - *(p2 + i)); }
// // AppDelegate.h // 通过代码创建Plist文件 // // Created by GnuHua on 14-7-31. // Copyright (c) 2014年 jiaxh. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" * found in "../support/s1ap-r16.1.0/36413-g10.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ #ifndef _S1AP_FiveGSTAI_H_ #define _S1AP_FiveGSTAI_H_ #include <asn_application.h> /* Including external dependencies */ #include "S1AP_PLMNidentity.h" #include "S1AP_FiveGSTAC.h" #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct S1AP_ProtocolExtensionContainer; /* S1AP_FiveGSTAI */ typedef struct S1AP_FiveGSTAI { S1AP_PLMNidentity_t pLMNidentity; S1AP_FiveGSTAC_t fiveGSTAC; struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } S1AP_FiveGSTAI_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_S1AP_FiveGSTAI; extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_FiveGSTAI_specs_1; extern asn_TYPE_member_t asn_MBR_S1AP_FiveGSTAI_1[3]; #ifdef __cplusplus } #endif #endif /* _S1AP_FiveGSTAI_H_ */ #include <asn_internal.h>
// Mantid Repository : https://github.com/mantidproject/mantid // // Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory UKRI, // NScD Oak Ridge National Laboratory, European Spallation Source // & Institut Laue - Langevin // SPDX - License - Identifier: GPL - 3.0 + #ifndef MANTID_GEOMETRY_GENERALFRAME_H_ #define MANTID_GEOMETRY_GENERALFRAME_H_ #include "MantidGeometry/DllConfig.h" #include "MantidGeometry/MDGeometry/MDFrame.h" #include "MantidKernel/MDUnit.h" #include "MantidKernel/System.h" #include "MantidKernel/UnitLabel.h" #include <memory> namespace Mantid { namespace Geometry { /** GeneralFrame : Any MDFrame that isn't related to momemtum transfer */ class MANTID_GEOMETRY_DLL GeneralFrame : public MDFrame { public: static const std::string GeneralFrameDistance; static const std::string GeneralFrameTOF; static const std::string GeneralFrameName; GeneralFrame(const std::string &frameName, const Kernel::UnitLabel &unit); GeneralFrame(const std::string &frameName, std::unique_ptr<Mantid::Kernel::MDUnit> unit); Kernel::UnitLabel getUnitLabel() const override; const Kernel::MDUnit &getMDUnit() const override; bool setMDUnit(const Mantid::Kernel::MDUnit &newUnit) override; bool canConvertTo(const Kernel::MDUnit &otherUnit) const override; bool isQ() const override; bool isSameType(const MDFrame &frame) const override; std::string name() const override; GeneralFrame *clone() const override; Mantid::Kernel::SpecialCoordinateSystem equivalientSpecialCoordinateSystem() const override; private: /// Label unit std::unique_ptr<Mantid::Kernel::MDUnit> m_unit; /// Frame name const std::string m_frameName; }; } // namespace Geometry } // namespace Mantid #endif /* MANTID_GEOMETRY_GENERALFRAME_H_ */
/* * geany_encoding=koi8-r * hardware.h * * Copyright 2018 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * */ #pragma once #ifndef __HARDWARE_H__ #define __HARDWARE_H__ #include "stm32f0.h" #define LED0_port GPIOB #define LED0_pin (1<<3) #ifndef USARTNUM #define USARTNUM 2 #endif #define CONCAT(a,b) a ## b #define STR_HELPER(s) #s #define STR(s) STR_HELPER(s) #define FORMUSART(X) CONCAT(USART, X) #define USARTX FORMUSART(USARTNUM) #ifndef I2CPINS #define I2CPINS A9A10 #endif #ifndef LED1_port #define LED1_port LED0_port #endif #ifndef LED1_pin #define LED1_pin LED0_pin #endif #define LED_blink(x) pin_toggle(x ## _port, x ## _pin) // oLED #define RST_PORT GPIOB #define RST_PIN (1<<4) #define DC_PORT GPIOB #define DC_PIN (1<<5) #define CS_PORT GPIOA #define CS_PIN (1<<4) #define RST_HI() do{pin_set(RST_PORT, RST_PIN);}while(0) #define RST_LO() do{pin_clear(RST_PORT, RST_PIN);}while(0) #define DC_HI() do{pin_set(DC_PORT, DC_PIN);}while(0) #define DC_LO() do{pin_clear(DC_PORT, DC_PIN);}while(0) #define CS_HI() do{pin_set(CS_PORT, CS_PIN);}while(0) #define CS_LO() do{pin_clear(CS_PORT, CS_PIN);}while(0) typedef enum{ LOW_SPEED, HIGH_SPEED } I2C_SPEED; void gpio_setup(void); void i2c_setup(I2C_SPEED speed); void spi_setup(); #endif // __HARDWARE_H__
/* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Tests of rmdir. Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>, 2009. */ #include <config.h> #include <unistd.h> #include "signature.h" SIGNATURE_CHECK (rmdir, int, (char const *)); #include <fcntl.h> #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include "ignore-value.h" #include "macros.h" #define BASE "test-rmdir.t" #include "test-rmdir.h" int main (void) { /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); return test_rmdir_func (rmdir, true); }
/*------------------------------------------------------------------------------ SCEngine - A 3D real time rendering engine written in the C language Copyright (C) 2006-2010 Antony Martin <martin(dot)antony(at)yahoo(dot)fr> 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/>. -----------------------------------------------------------------------------*/ /* created: 02/11/2008 updated: 21/06/2009 */ #include <SCE/utils/SCEUtils.h> #include "SCE/core/SCELevelOfDetail.h" static int SCE_Lod_DefaultGetLodFunc (float); void SCE_Lod_Init (SCE_SLevelOfDetail *lod) { lod->lod = 0; lod->box = NULL; lod->size = 0.0f; lod->dist = 0.0f; lod->getlod = SCE_Lod_DefaultGetLodFunc; } SCE_SLevelOfDetail* SCE_Lod_Create (void) { SCE_SLevelOfDetail *lod = NULL; lod = SCE_malloc (sizeof *lod); if (!lod) SCEE_LogSrc(); else SCE_Lod_Init (lod); return lod; } void SCE_Lod_Delete (SCE_SLevelOfDetail *lod) { SCE_free (lod); } void SCE_Lod_SetBoundingBox (SCE_SLevelOfDetail *lod, SCE_SBoundingBox *box) { lod->box = box; } void SCE_Lod_SetGetLODFunc (SCE_SLevelOfDetail *lod, SCE_FGetLODFunc f) { if (f) lod->getlod = f; else lod->getlod = SCE_Lod_DefaultGetLodFunc; } SCE_SBoundingBox* SCE_Lod_GetBoundingBox (SCE_SLevelOfDetail *lod) { return lod->box; } float SCE_Lod_ComputeBoundingBoxSurfaceFromDist (SCE_SBox *box, float dist, SCE_SCamera *cam) { SCE_TVector4 v[4]; float area; { /* see SCEBox.c for infos about the queried points */ float *points; points = SCE_Box_GetPoints (box); SCE_Vector3_Copy (v[0], &points[0]); SCE_Vector3_Copy (v[1], &points[2]); SCE_Vector3_Copy (v[2], &points[4]); SCE_Vector3_Copy (v[3], &points[6]); v[0][2] -= dist; v[1][2] -= dist; v[2][2] -= dist; v[3][2] -= dist; v[0][3] = v[1][3] = v[2][3] = v[3][3] = 1.0f; } { /* project points */ float *proj; proj = SCE_Camera_GetProj (cam); SCE_Matrix4_MulV4Copy (proj, v[0]); SCE_Matrix4_MulV4Copy (proj, v[1]); SCE_Matrix4_MulV4Copy (proj, v[2]); SCE_Matrix4_MulV4Copy (proj, v[3]); } { /* depth useless */ SCE_Vector2_Operator1 (v[0], /=, v[0][3]); SCE_Vector2_Operator1 (v[1], /=, v[1][3]); SCE_Vector2_Operator1 (v[2], /=, v[2][3]); SCE_Vector2_Operator1 (v[3], /=, v[3][3]); } { /* make the rectangle */ SCE_SFloatRect r; unsigned int i; r.p1[0] = r.p2[0] = v[0][0]; r.p1[1] = r.p2[1] = v[0][1]; for (i = 1; i < 4; i++) { if (v[i][0] < r.p1[0]) r.p1[0] = v[i][0]; if (v[i][0] > r.p2[0]) r.p2[0] = v[i][0]; if (v[i][1] < r.p1[1]) r.p1[1] = v[i][1]; if (v[i][1] > r.p2[1]) r.p2[1] = v[i][1]; } area = SCE_Rectangle_GetAreaf (&r); } return area; } float SCE_Lod_ComputeBoundingBoxSurface (SCE_SBox *box, SCE_SCamera *cam) { float area; float dist = 1.0f; SCE_TVector3 t; SCE_Box_GetCenterv (box, t); { SCE_TVector3 v1; SCE_Camera_GetPositionv (cam, v1); dist = SCE_Vector3_Distance (v1, t); } SCE_Box_SetCenter (box, 0.0f, 0.0f, 0.0f); area = SCE_Lod_ComputeBoundingBoxSurfaceFromDist (box, dist, cam); SCE_Box_SetCenterv (box, t); return area; } static int SCE_Lod_DefaultGetLodFunc (float size) { /* FIXME: WTF!? */ return (unsigned int)(0.4f/SCE_Math_Sqrt (size)); } int SCE_Lod_Compute (SCE_SLevelOfDetail *lod, SCE_TMatrix4 m, SCE_SCamera *cam) { SCE_TVector3 t; { SCE_TVector4 v; SCE_Camera_GetPositionv (cam, v); SCE_Matrix4_GetTranslation (m, t); lod->dist = SCE_Vector3_Distance (v, t); } m[3] = m[7] = m[11] = 0.0f; { SCE_SBox box, *bptr; bptr = SCE_BoundingBox_GetBox (lod->box); /* do projection! */ SCE_BoundingBox_Push (lod->box, m, &box); lod->size = SCE_Lod_ComputeBoundingBoxSurfaceFromDist (bptr, lod->dist, cam); SCE_BoundingBox_Pop (lod->box, &box); } /* restore initial translation */ m[3] = t[0]; m[7] = t[1]; m[11] = t[2]; lod->lod = lod->getlod (lod->size); return lod->lod; } int SCE_Lod_GetLOD (SCE_SLevelOfDetail *lod) { return lod->lod; } float SCE_Lod_GetSize (SCE_SLevelOfDetail *lod) { return lod->size; } float SCE_Lod_GetDistance (SCE_SLevelOfDetail *lod) { return lod->dist; }
/* $Id: strbalp.c,v 1.1.1.1 2006/09/14 01:59:06 root Exp $ */ /* * Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se) * * 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. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Opsycon AB. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include <string.h> /* * Parse string for closing "paren" type char and return pointer to it. * Call with * pointer to opening paren. If no opening, returns 0. */ char * strbalp(const char *p) { char b, e; char *ol = "({[<"; char *cl = ")}]>"; int i, n; b = *p; for (i = 0; ol[i] != 0; i++) { if (ol[i] == b) break; } if (ol[i] == 0) return (0); e = cl[i]; n = 0; for (; *p; p++) { if (*p == b) n++; else if (*p == e) { n--; if (n == 0) return ((char *)p); } } return (0); }
// Copyright 2014 eric schkufza // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CPPUTIL_INCLUDE_PATTERNS_SINGLETON_H #define CPPUTIL_INCLUDE_PATTERNS_SINGLETON_H namespace cpputil { template <typename T> class Singleton { public: typedef T& reference; Singleton() = delete; Singleton(const Singleton& s) = delete; Singleton& operator=(Singleton s) = delete; static reference get() { static T instance; return instance; } }; } // namespace cpputil #endif
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2015 - ROLI Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ #ifndef __GRAPHEDITORPANEL_JUCEHEADER__ #define __GRAPHEDITORPANEL_JUCEHEADER__ #include "FilterGraph.h" class FilterComponent; class ConnectorComponent; class PinComponent; //============================================================================== /** A panel that displays and edits a FilterGraph. */ class GraphEditorPanel : public Component, public ChangeListener { public: GraphEditorPanel (FilterGraph& graph); ~GraphEditorPanel(); void paint (Graphics& g); void mouseDown (const MouseEvent& e); void createNewPlugin (const PluginDescription* desc, int x, int y); FilterComponent* getComponentForFilter (uint32 filterID) const; ConnectorComponent* getComponentForConnection (const AudioProcessorGraph::Connection& conn) const; PinComponent* findPinAt (int x, int y) const; void resized(); void changeListenerCallback (ChangeBroadcaster*); void updateComponents(); //============================================================================== void beginConnectorDrag (uint32 sourceFilterID, int sourceFilterChannel, uint32 destFilterID, int destFilterChannel, const MouseEvent& e); void dragConnector (const MouseEvent& e); void endDraggingConnector (const MouseEvent& e); //============================================================================== private: FilterGraph& graph; ScopedPointer<ConnectorComponent> draggingConnector; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphEditorPanel) }; //============================================================================== /** A panel that embeds a GraphEditorPanel with a midi keyboard at the bottom. It also manages the graph itself, and plays it. */ class GraphDocumentComponent : public Component { public: //============================================================================== GraphDocumentComponent (AudioPluginFormatManager& formatManager, AudioDeviceManager* deviceManager); ~GraphDocumentComponent(); //============================================================================== void createNewPlugin (const PluginDescription* desc, int x, int y); inline void setDoublePrecision (bool doublePrecision) { graphPlayer.setDoublePrecisionProcessing (doublePrecision); } //============================================================================== ScopedPointer<FilterGraph> graph; //============================================================================== void resized(); //============================================================================== void unfocusKeyboardComponent(); //============================================================================== void releaseGraph(); private: //============================================================================== AudioDeviceManager* deviceManager; AudioProcessorPlayer graphPlayer; MidiKeyboardState keyState; public: GraphEditorPanel* graphPanel; private: Component* keyboardComp; Component* statusBar; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphDocumentComponent) }; //============================================================================== /** A desktop window containing a plugin's UI. */ class PluginWindow : public DocumentWindow { public: enum WindowFormatType { Normal = 0, Generic, Programs, Parameters, AudioIO, NumTypes }; PluginWindow (Component* pluginEditor, AudioProcessorGraph::Node*, WindowFormatType, AudioProcessorGraph&); ~PluginWindow(); static PluginWindow* getWindowFor (AudioProcessorGraph::Node*, WindowFormatType, AudioProcessorGraph&); static void closeCurrentlyOpenWindowsFor (const uint32 nodeId); static void closeAllCurrentlyOpenWindows(); void moved() override; void closeButtonPressed() override; private: AudioProcessorGraph& graph; AudioProcessorGraph::Node* owner; WindowFormatType type; float getDesktopScaleFactor() const override { return 1.0f; } JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginWindow) }; inline String toString (PluginWindow::WindowFormatType type) { switch (type) { case PluginWindow::Normal: return "Normal"; case PluginWindow::Generic: return "Generic"; case PluginWindow::Programs: return "Programs"; case PluginWindow::Parameters: return "Parameters"; default: return String(); } } inline String getLastXProp (PluginWindow::WindowFormatType type) { return "uiLastX_" + toString (type); } inline String getLastYProp (PluginWindow::WindowFormatType type) { return "uiLastY_" + toString (type); } inline String getOpenProp (PluginWindow::WindowFormatType type) { return "uiopen_" + toString (type); } #endif // __GRAPHEDITORPANEL_JUCEHEADER__
/*============================================================================= | Copyright 2012 Matthew D. Steele <mdsteele@alum.mit.edu> | | | | This file is part of Azimuth. | | | | Azimuth 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. | | | | Azimuth 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 Azimuth. If not, see <http://www.gnu.org/licenses/>. | =============================================================================*/ #pragma once #ifndef AZIMUTH_VIEW_WALL_H_ #define AZIMUTH_VIEW_WALL_H_ #include "azimuth/state/space.h" #include "azimuth/state/wall.h" #include "azimuth/util/clock.h" /*===========================================================================*/ // Call this at program startup to initialize drawing of walls. This must be // called _after_ both az_init_gui and az_init_wall_datas, and must be called // _before_ any calls to az_draw_wall or az_draw_walls. void az_init_wall_drawing(void); // Draw a single wall, without flare or additional transforms. The GL matrix // should be at the wall position. void az_draw_wall_data(const az_wall_data_t *data, az_clock_t clock); // Draw a single wall. The GL matrix should be at the camera position. void az_draw_wall(const az_wall_t *wall, az_clock_t clock); // Draw all walls. The GL matrix should be at the camera position. void az_draw_walls(const az_space_state_t *state); /*===========================================================================*/ #endif // AZIMUTH_VIEW_WALL_H_
// Copyright (C) Explorer++ Project // SPDX-License-Identifier: GPL-3.0-only // See LICENSE in the top level directory #pragma once #include <boost/signals2.hpp> enum class MousewheelSource { ListView, TreeView, Other }; enum class OpenFolderDisposition { CurrentTab, BackgroundTab, ForegroundTab, NewWindow }; enum class WindowFocusSource { AddressBar, TreeView, ListView }; using TabsInitializedSignal = boost::signals2::signal<void()>; using MainMenuPreShowSignal = boost::signals2::signal<void(HMENU mainMenu)>; using ToolbarContextMenuSignal = boost::signals2::signal<void(HMENU menu, HWND sourceWindow, const POINT &pt)>; using FocusChangedSignal = boost::signals2::signal<void(WindowFocusSource windowFocusSource)>; using ApplicationShuttingDownSignal = boost::signals2::signal<void()>; class CachedIcons; struct Config; class IconResourceLoader; __interface IDirectoryMonitor; class ShellBrowser; class StatusBar; class TabContainer; class TabRestorer; /* Basic interface between Explorerplusplus and some of the other components (such as the dialogs and toolbars). */ __interface IExplorerplusplus { const Config *GetConfig() const; HMODULE GetLanguageModule() const; HWND GetMainWindow() const; HWND GetActiveListView() const; ShellBrowser *GetActiveShellBrowser() const; TabContainer *GetTabContainer() const; TabRestorer *GetTabRestorer() const; IDirectoryMonitor *GetDirectoryMonitor() const; IconResourceLoader *GetIconResourceLoader() const; CachedIcons *GetCachedIcons(); HWND GetTreeView() const; void OpenItem(const TCHAR *itemPath, OpenFolderDisposition openFolderDisposition = OpenFolderDisposition::CurrentTab); void OpenItem(PCIDLIST_ABSOLUTE pidlItem, OpenFolderDisposition openFolderDisposition = OpenFolderDisposition::CurrentTab); StatusBar *GetStatusBar(); void OpenFileItem(PCIDLIST_ABSOLUTE pidlItem, const TCHAR *szParameters); wil::unique_hmenu BuildViewsMenu(); bool CanCreate() const; BOOL CanCut() const; BOOL CanCopy() const; BOOL CanRename() const; BOOL CanDelete() const; BOOL CanShowFileProperties() const; BOOL CanPaste() const; BOOL OnMouseWheel(MousewheelSource mousewheelSource, WPARAM wParam, LPARAM lParam); void ShowTabBar(); void HideTabBar(); void SetListViewInitialPosition(HWND hListView); void FocusChanged(WindowFocusSource windowFocusSource); // Used to support the options dialog. void SaveAllSettings(); BOOL GetSavePreferencesToXmlFile() const; void SetSavePreferencesToXmlFile(BOOL savePreferencesToXmlFile); int CloseApplication(); boost::signals2::connection AddTabsInitializedObserver( const TabsInitializedSignal::slot_type &observer); boost::signals2::connection AddMainMenuPreShowObserver( const MainMenuPreShowSignal::slot_type &observer); boost::signals2::connection AddToolbarContextMenuObserver( const ToolbarContextMenuSignal::slot_type &observer); boost::signals2::connection AddFocusChangeObserver( const FocusChangedSignal::slot_type &observer); boost::signals2::connection AddApplicationShuttingDownObserver( const ApplicationShuttingDownSignal::slot_type &observer); };
/* Horizon Microkernel - Hobby Operating System * Copyright (C) 2014 Wyatt Lindquist * * 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/>. */ /*! \file core/memory/virtual.h * \date July 2014 */ #pragma once #include <horizon/types.h> #include <stddef.h> #include <stdint.h> /*! All of the virtual memory management functions operate on the passed * process's address space, or the kernel PAS if NULL is passed. * Always pass NULL for kernel mappings. * Passed addresses and sizes are automatically page aligned. * If a page is mapped inside the region being operated on, it is ignored, * i.e., it will not be overwritten/cloned etc. */ void virtual_map(pid_t pid, uintptr_t virt, const void* phys, size_t size); void virtual_unmap(pid_t pid, uintptr_t virt, size_t size); int virtual_is_mapped(pid_t pid, uintptr_t virt, size_t size); void virtual_alloc(pid_t pid, uintptr_t virt, size_t size); void virtual_share(pid_t dest, pid_t src, uintptr_t to, uintptr_t from, size_t size, uint8_t mode);
/* Copyright 2011, 2012 Barrett Technology <support@barrett.com> This file is part of libbarrett. This version of libbarrett 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 version of libbarrett 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 version of libbarrett. If not, see <http://www.gnu.org/licenses/>. Further, non-binding information about licensing is available at: <http://wiki.barrett.com/libbarrett/wiki/LicenseNotes> */ /* * motor_puck-inl.h * * Created on: Feb 1, 2011 * Author: dc */ #include <barrett/os.h> namespace barrett { template<typename ResultType> int MotorPuck::MotorPositionParser<ResultType>::parse(int id, int propId, result_type* result, const unsigned char* data, size_t len) { if (len != 3 && len != 6) { logMessage("%s: expected message length of 3 or 6, got message length of %d") % __func__ % len; return 1; } *result = twentyTwoBit2<ResultType>(data[0], data[1], data[2]); return 0; } template<typename ResultType> int MotorPuck::SecondaryPositionParser<ResultType>::parse(int id, int propId, result_type* result, const unsigned char* data, size_t len) { if (len != 3) { logMessage("%s: expected message length of 3, got message length of %d") % __func__ % len; return 1; } *result = twentyTwoBit2<ResultType>(data[0], data[1], data[2]); return 0; } template<typename ResultType> int MotorPuck::CombinedPositionParser<ResultType>::parse(int id, int propId, result_type* result, const unsigned char* data, size_t len) { if (len == 6) { boost::get<0>(*result) = twentyTwoBit2<ResultType>(data[0], data[1], data[2]); boost::get<1>(*result) = twentyTwoBit2<ResultType>(data[3], data[4], data[5]); } else if (len == 3) { boost::get<0>(*result) = twentyTwoBit2<ResultType>(data[0], data[1], data[2]); boost::get<1>(*result) = std::numeric_limits<ResultType>::max(); } else { logMessage("%s: expected message length of 3 or 6, got message length of %d") % __func__ % len; return 1; } return 0; } template<typename ResultType> ResultType MotorPuck::twentyTwoBit2(unsigned char msb, unsigned char middle, unsigned char lsb) { int intResult = 0; intResult |= ((long) msb << 16) & 0x003F0000; intResult |= ((long) middle << 8) & 0x0000FF00; intResult |= ((long) lsb) & 0x000000FF; if (intResult & 0x00200000) { // If negative... intResult |= ~((int)0x3fffff); // sign-extend } return intResult; } }
/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ /** * Leapfrog Driver board pin assignments */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." #endif #define BOARD_NAME "Leapfrog" #define X_STEP_PIN 28 #define X_DIR_PIN 63 #define X_ENABLE_PIN 29 #define X_MIN_PIN 47 #define X_MAX_PIN 2 //Max endstops default to disabled "-1", set to commented value to enable. #define Y_STEP_PIN 14 // A6 #define Y_DIR_PIN 15 // A0 #define Y_ENABLE_PIN 39 #define Y_MIN_PIN 48 #define Y_MAX_PIN 15 #define Z_STEP_PIN 31 // A2 #define Z_DIR_PIN 32 // A6 #define Z_ENABLE_PIN 30 // A1 #define Z_MIN_PIN 49 #define Z_MAX_PIN -1 #define E0_STEP_PIN 34 //34 #define E0_DIR_PIN 35 //35 #define E0_ENABLE_PIN 33 //33 #define E1_STEP_PIN 37 //37 #define E1_DIR_PIN 40 //40 #define E1_ENABLE_PIN 36 //36 #define SDSS 11 #define LED_PIN 13 #define FAN_PIN 7 #define SOL1_PIN 16 #define SOL2_PIN 17 #define HEATER_0_PIN 9 #define HEATER_1_PIN 8 // 12 #define HEATER_2_PIN 11 //-1 // 13 #define TEMP_0_PIN 13 //D27 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! #define TEMP_1_PIN 15 // 1 #define HEATER_BED_PIN 10 // 14/15 #define TEMP_BED_PIN 14 // 1,2 or I2C /* Unused (1) (2) (3) 4 5 6 7 8 9 10 11 12 13 (14) (15) (16) 17 (18) (19) (20) (21) (22) (23) 24 (25) (26) (27) 28 (29) (30) (31) */
/* sp-process-model-item.h * * Copyright (C) 2016 Christian Hergert <christian@hergert.me> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SP_PROCESS_MODEL_ITEM_H #define SP_PROCESS_MODEL_ITEM_H #include <gio/gio.h> G_BEGIN_DECLS #define SP_TYPE_PROCESS_MODEL_ITEM (sp_process_model_item_get_type()) G_DECLARE_FINAL_TYPE (SpProcessModelItem, sp_process_model_item, SP, PROCESS_MODEL_ITEM, GObject) SpProcessModelItem *sp_process_model_item_new (GPid pid); guint sp_process_model_item_hash (SpProcessModelItem *self); gboolean sp_process_model_item_equal (SpProcessModelItem *self, SpProcessModelItem *other); GPid sp_process_model_item_get_pid (SpProcessModelItem *self); const gchar *sp_process_model_item_get_command_line (SpProcessModelItem *self); gboolean sp_process_model_item_is_kernel (SpProcessModelItem *self); const gchar * const *sp_process_model_item_get_argv (SpProcessModelItem *self); G_END_DECLS #endif /* SP_PROCESS_MODEL_ITEM_H */
/* SysRand.h -*- c++ -*- * Copyright (c) 2013 Ross Biro * * The system random number generator. */ /* * 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 of the * License. * * 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 TEXTUS_RANDOM_SYSRAND_H_ #define TEXTUS_RANDOM_SYSRAND_H_ #include "textus/base/ReferenceList.h" #include "textus/random/PRNG.h" #include "textus/file/TextusFile.h" namespace textus { namespace random { class SysRand: public PRNG { private: unsigned char buffer[4096]; size_t buff_ptr; textus::base::ReferenceList<textus::file::TextusFile *> file_handles; protected: virtual uint64_t randombits(int bits); virtual void reloadBuffer(); virtual void openFiles(); public: explicit SysRand(): buff_ptr(-1) {} virtual ~SysRand() {} }; class SysRandFactory: public PRNGFactory { public: explicit SysRandFactory() {} virtual ~SysRandFactory() {} virtual PRNG* create(const std::string &name) { return new SysRand(); } }; }} //namespace #endif //TEXTUS_RANDOM_SYSRAND_H_
#include "asma.h" #include "launcher.h" static gchar* mods_param() { GObject *mods_box; GList *mods_l; gchar *param; mods_box = gtk_builder_get_object(builder, "mods_list"); mods_l = gtk_container_get_children(GTK_CONTAINER (mods_box)); param = ""; while (mods_l) { GtkButton *b; b = GTK_BUTTON (gtk_bin_get_child(mods_l->data)); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b))) param = g_strconcat(param, gtk_button_get_label(b), "\\\\;", NULL); mods_l = mods_l->next; } if(!g_str_equal(param, "")) param = g_strconcat(A3_MOD, param, NULL); return param; } static gchar* get_command() { gchar *command; command = DEFAULT_LAUNCH; if (g_settings_get_boolean(gset_a3, "force-windowed")) command = g_strconcat(command, A3_WINDOW, NULL); if (!g_settings_get_boolean(gset_a3, "show-splash")) command = g_strconcat(command, A3_NOSPLASH, NULL); if (!g_settings_get_boolean(gset_a3, "show-world")) command = g_strconcat(command, A3_NOWORLD, NULL); if (g_settings_get_boolean(gset_a3, "show-script-errors")) command = g_strconcat(command, A3_DEBUG, NULL); if (g_settings_get_boolean(gset_a3, "file-patching")) command = g_strconcat(command, A3_FILE_PATCHING, NULL); command = g_strconcat(command, mods_param(), NULL); return command; } void play_game() { gchar *command; command = get_command(); g_spawn_command_line_async(command, NULL); }
/* Copyright 2010-2012 Mark Boots, David Chevrier, and Darren Hunter. Copyright 2013-2014 David Chevrier and Darren Hunter. This file is part of the Acquaman Data Acquisition and Management framework ("Acquaman"). Acquaman 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. Acquaman 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 Acquaman. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AMAPPBOTTOMPANEL_H #define AMAPPBOTTOMPANEL_H #include "ui/AMDatamanAppBottomPanel.h" #include "ui/actions3/AMActionRunnerBottomBarCurrentView3.h" #include "actions3/AMActionRunner3.h" /// This class implements the bottom panel used in the standard App for AM. It contains a mini-view of the workflow and adds it between the add experiment button and the status view. class AMAppBottomPanel : public AMDatamanAppBottomPanel { Q_OBJECT public: /// Constructor. Passes in the action runner to appropriately build the mini-workflow view. virtual ~AMAppBottomPanel(); AMAppBottomPanel(AMActionRunner3 *actionRunner, QWidget *parent = 0); /// Returns the bottom bar view that is encapuslated. AMActionRunnerBottomBarCurrentView3 *workFlowView() const { return workflowView_; } protected: /// The current workflow view. AMActionRunnerBottomBarCurrentView3 *workflowView_; }; #endif // AMAPPBOTTOMPANEL_H
/* Copyright 2014 Sky Leonard This file is part of libfluff. libfluff 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. libfluff 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 libfluff. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FLUFF_STRUCT_H_ #define FLUFF_STRUCT_H_ #include "data.h" /* * Format | Standard type | Native type | Size * x | none | none | 1 * c | char | char | 1 * b | int8_t | signed char | 1 * B | uint8_t | unsigned char | 1 * h | int16_t | short | 2 * H | uint16_t | unsigned short| 2 * i | int32_t | int | 4 * I | uint32_t | unsigned int | 4 * q | int64_t | long long | 8 * Q | uint64_t | unsigned ll | 8 * f | float | float | 4 * d | double | double | 8 * s | char * | char * | */ struct FluffStruct; struct FluffStruct * fluff_struct_new(char * fmt); size_t fluff_struct_size(struct FluffStruct *); void fluff_struct_setnextoffset(struct FluffStruct *, size_t offset); void fluff_struct_pack(struct FluffStruct *, void * buf, ...); void fluff_struct_pack_n(struct FluffStruct *, void * buf, ...); void fluff_struct_pack_v(struct FluffStruct *, void * buf, va_list args); void fluff_struct_pack_vn(struct FluffStruct *, void * buf, va_list args); void fluff_struct_pack_s(struct FluffStruct *, void * buf, void * struct_); void fluff_struct_pack_sn(struct FluffStruct *, void * buf, void * struct_); void fluff_struct_unpack(struct FluffStruct *, void * buf, ...); void fluff_struct_unpack_n(struct FluffStruct *, void * buf, ...); void fluff_struct_unpack_v(struct FluffStruct *, void * buf, va_list args); void fluff_struct_unpack_vn(struct FluffStruct *, void * buf, va_list args); void fluff_struct_unpack_s(struct FluffStruct *, void * buf, void * struct_); void fluff_struct_unpack_sn(struct FluffStruct *, void * buf, void * struct_); #endif /* FLUFF_STRUCT_H_ */
#ifndef COMPUTERPLAYER_HEADER #define COMPUTERPLAYER_HEADER #include "player.h" class Figure; class ComputerPlayer : public Player { Q_OBJECT protected: double moveCost(Figure* fig); double getFieldCost(Field* pos); unsigned getOtherCount(Field* pos, bool isAhead = false); int distFromHome(Field* pos, QColor color); public: ComputerPlayer(QString name, QColor color, QObject *parent = nullptr); void play(); public slots: virtual void setDice(unsigned dice) Q_DECL_OVERRIDE; }; #endif
/* * ARPProtocolHandler.h * * Created on: Jan 23, 2016 * Author: xshell */ #ifndef PROTOCOL_HANDLERS_ARPPROTOCOLHANDLER_H_ #define PROTOCOL_HANDLERS_ARPPROTOCOLHANDLER_H_ #include <map> #include <boost/asio.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread.hpp> #include <boost/format.hpp> #include <net/ethernet.h> #include <sockets/L3Socket.h> #include <protocol_handlers/ProtocolHandler.h> #include <protocol_handlers/IPProtocolHandler.h> #include <tables/ARPTable.h> #include <net/if_arp.h> #include <netinet/if_ether.h> class ARPTable; static std::string ARP_PROTO_HANDLER_NAME = "ARP"; class ARPProtocolHandler : public ProtocolHandler { public: static ARPProtocolHandler* getInstance(); virtual ~ARPProtocolHandler(); std::pair<boost::asio::streambuf*,size_t> handle_packet( boost::asio::streambuf*, L2Socket* input_sock, L2Socket** output_sock, uint8_t *dst_mac, uint16_t *response_mux_key); void decode_header(boost::asio::streambuf*,arphdr* arp_hdr); void decode_payload(boost::asio::streambuf*,ether_arp* arp_packet); boost::asio::streambuf* build_response( L2Socket* l2_socket, uint8_t* mac_dst, ether_arp *arp_packet); std::pair<boost::asio::streambuf*,size_t> create_request(L2Socket* l2_socket,in_addr_t from,in_addr_t query); private: static ARPProtocolHandler* instance ; ARPTable* arp_table; ARPProtocolHandler(); }; #endif /* PROTOCOL_HANDLERS_ARPPROTOCOLHANDLER_H_ */
#ifndef PRAD_DATA_HANDLER_H #define PRAD_DATA_HANDLER_H #include <deque> #include <thread> #include <unordered_map> #include "PRadEvioParser.h" #include "PRadDSTParser.h" #include "PRadEventStruct.h" #include "PRadException.h" // PMT 0 - 2 #define DEFAULT_REF_PMT 2 class PRadHyCalSystem; class PRadGEMSystem; class PRadEPICSystem; class PRadTaggerSystem; class TH2I; class PRadDataHandler { public: // constructor PRadDataHandler(); // copy/move constructors PRadDataHandler(const PRadDataHandler &that); PRadDataHandler(PRadDataHandler &&that); // destructor virtual ~PRadDataHandler(); // copy/move assignment operators PRadDataHandler &operator =(const PRadDataHandler &rhs); PRadDataHandler &operator =(PRadDataHandler &&rhs); // mode change void SetOnlineMode(const bool &mode); // set systems void SetHyCalSystem(PRadHyCalSystem *hycal) {hycal_sys = hycal;} void SetGEMSystem(PRadGEMSystem *gem) {gem_sys = gem;} void SetEPICSystem(PRadEPICSystem *epics) {epic_sys = epics;} void SetTaggerSystem(PRadTaggerSystem *tagger) {tagger_sys = tagger;} PRadHyCalSystem *GetHyCalSystem() const {return hycal_sys;} PRadGEMSystem *GetGEMSystem() const {return gem_sys;} PRadEPICSystem *GetEPICSystem() const {return epic_sys;} // file reading and writing void Decode(const void *buffer); void ReadFromDST(const std::string &path); int ReadFromEvio(const std::string &path, int evt = -1, bool verbose = false); int ReadFromSplitEvio(const std::string &path, int split = -1, bool verbose = true); void WriteToDST(const std::string &path); void Replay(const std::string &r_path, int split = -1, const std::string &w_path = ""); // data handler void Clear(); void StartofNewEvent(const unsigned char &tag); void EndofThisEvent(const unsigned int &ev); void EndProcess(EventData *data); void FillHistograms(const EventData &data); void UpdateTrgType(const unsigned char &trg); // feeding data void FeedData(const JLabTIData &tiData); void FeedData(const JLabDSCData &dscData); void FeedData(const ADC1881MData &adcData); void FeedData(const TDCV767Data &tdcData); void FeedData(const TDCV1190Data &tdcData); void FeedData(const GEMRawData &gemData); void FeedData(const std::vector<GEMZeroSupData> &gemData); void FeedData(const EPICSRawData &epicsData); // event storage unsigned int GetEventCount() const {return event_data.size();} const EventData &GetEvent(const unsigned int &index) const throw (PRadException); const std::deque<EventData> &GetEventData() const {return event_data;} // analysis tools void InitializeByData(const std::string &path = "", int ref = DEFAULT_REF_PMT); void RefillEnergyHist(); int FindEvent(int event_number) const; private: void waitEventProcess(); private: PRadEvioParser parser; PRadDSTParser dst_parser; PRadEPICSystem *epic_sys; PRadTaggerSystem *tagger_sys; PRadHyCalSystem *hycal_sys; PRadGEMSystem *gem_sys; bool onlineMode; bool replayMode; std::thread end_thread; // data related std::deque<EventData> event_data; EventData *new_event; EventData *proc_event; }; #endif
#ifndef TIMEEDITDELEGATE_H #define TIMEEDITDELEGATE_H #include <QStyledItemDelegate> class TimeEditDelegate : public QStyledItemDelegate { Q_OBJECT public: TimeEditDelegate(QObject* parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override; virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override; }; #endif // TIMEEDITDELEGATE_H
#include <stdio.h> int main() { printf("hello, world"); return 0; };
// Copyright (C) 2016-2019 Semtech (International) AG. All rights reserved. // Copyright (C) 2014-2016 IBM Corporation. All rights reserved. // // This file is subject to the terms and conditions defined in file 'LICENSE', // which is part of this source code package. #ifndef _debug_h_ #define _debug_h_ #ifndef CFG_DEBUG #define debug_snprintf(s,n,f,...) do { } while (0) #define debug_printf(f,...) do { } while (0) #define debug_str(s) do { } while (0) #define debug_led(val) do { } while (0) #define debug_verbose_printf(f,...) do { } while (0) #ifdef CFG_DEBUG_VERBOSE #error CFG_DEBUG_VERBOSE requires CFG_DEBUG #endif #else #if defined(__AVR__) || defined(ARDUINO_ARCH_STM32) || \ defined(ENERGIA_ARCH_CC13XX) || defined(ENERGIA_ARCH_CC13X2) #include <avr/pgmspace.h> #endif #if defined(ESP32) || defined(ESP8266) #include <pgmspace.h> #endif // write formatted string to buffer //int debug_snprintf (char *str, int size, const char *format, ...); // write formatted string to USART void debug_printf_pstr (char const *format, ...); #define debug_printf(format, ...) debug_printf_pstr(PSTR("%F: " format), (u4_t)os_getTime(), 0, ## __VA_ARGS__) // write nul-terminated string to USART //void debug_str (const char* str); // set LED state void debug_led (int val); #ifndef CFG_DEBUG_VERBOSE #define debug_verbose_printf(f,...) do { } while (0) #else #define debug_verbose_printf debug_printf #endif #endif #endif
#ifndef WATERBAG_H #define WATERBAG_H namespace distribution { template <size_t dimension> void waterbag(const std::vector<double>& vec, const std::vector<double> coefficient_l) { const size_t n = vec.size() / dimension; assert(n > 0); assert(d == coefficient_l.size()); double sum2 = 0; std::vector<double> mean(dimension); for (size_t d = 0; d < dimension; ++d) mean[d] = 0;; for (size_t i = 0; i < n; ++i) { do { for (size_t d = 0; d < dimension; ++d) vec[i + n * d] = (2.0 * rand() / RAND_MAX - 1.0) * coefficient_l[d]; sum2 = 0; for (size_t d = 0; d < dimension; ++d) sum2 += SQR(vec[i + n * d] / coefficient_l[d]) } while (sum2 >= 1.0); for (size_t d = 0; d < dimension; ++d) mean[d] += vec[i + n * d]; } for (size_t d = 0; d < dimension; ++d) mean[d] /= n; for (size_t i = 0; i < n; ++i) { for (size_t d = 0; d < dimension; ++d) vec[i + n * d] -= mean[d]; } return; } template <size_t dimension> void waterbag(const std::vector<double>& vec, double length) { std::vector<double> coefficient_l; for (size_t d = 0; d < dimension; ++d) coefficient_l.push_back(length); return waterbag(vec, coefficient_l); } } #endif
// // ObjectWithPrimitiveValues.h // objctest // // Created by Leonid Popescu on 06/02/2014. // Copyright (c) 2014 becauseTuesday. All rights reserved. // /* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #import <Foundation/Foundation.h> @interface ObjectWithPrimitiveValues : NSObject + (instancetype)obj; @end
// -*- C++ -*- #ifndef HERWIG_SSWWHHVertex_H #define HERWIG_SSWWHHVertex_H // // This is the declaration of the SSWWHHVertex class. // #include "ThePEG/Helicity/Vertex/Scalar/VVSSVertex.h" namespace Herwig { using namespace ThePEG; /** * Here is the documentation of the SSWWHHVertex class. * * @see \ref SSWWHHVertexInterfaces "The interfaces" * defined for SSWWHHVertex. */ class SSWWHHVertex: public Helicity::VVSSVertex { public: /** * The default constructor. */ SSWWHHVertex(); /** * Calculate the couplings. * @param q2 The scale \f$q^2\f$ for the coupling at the vertex. * @param part1 The ParticleData pointer for the first particle. * @param part2 The ParticleData pointer for the second particle. * @param part3 The ParticleData pointer for the third particle. * @param part4 The ParticleData pointer for the fourth particle. */ virtual void setCoupling(Energy2 q2,tcPDPtr part1,tcPDPtr part2, tcPDPtr part3, tcPDPtr part4); public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const; /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const; //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object after the setup phase before saving and * EventGenerator to disk. * @throws InitException if object could not be initialized properly. */ virtual void doinit(); //@} private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ SSWWHHVertex & operator=(const SSWWHHVertex &) = delete; private: /** * Storage of the couplings. */ //@{ /** * The last value of the electroweak coupling calculated. */ Complex couplast_; /** * The scale \f$q^2\f$ at which the coupling was last evaluated. */ Energy2 q2last_; //@} /** * Prefactors for the couplings */ vector<Complex> coup_; }; } #endif /* HERWIG_SSWWHHVertex_H */
/************************************************************************** * Copyright (C) 2010 Shreaders team at UC Merced * Copyright (C) 2010 Eva-marie team * * 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 INIT_H #define INIT_H /* This is the header file for init.c, the file that contains all the video-related stuff. */ #include "structs.h" void resetGame(); extern SDL_Surface *screen; extern SDL_Surface *DUN_TILE, *WAT_TILE, *GRA_TILE, *SNO_TILE, *RED_TILE; extern SDL_Surface *DUN_WAT_R_TILE, *DUN_WAT_L_TILE, *DUN_WAT_T_TILE, *DUN_WAT_B_TILE; extern SDL_Surface *DUN_WAT_TR_TILE, *DUN_WAT_TL_TILE, *DUN_WAT_BR_TILE, *DUN_WAT_BL_TILE; extern SDL_Surface *DUN_EMP_R_TILE, *DUN_EMP_L_TILE, *DUN_EMP_T_TILE, *DUN_EMP_B_TILE; extern SDL_Surface *DUN_EMP_TR_TILE, *DUN_EMP_TL_TILE, *DUN_EMP_BR_TILE, *DUN_EMP_BL_TILE; extern SDL_Surface *TRE_OPN_TILE, *TRE_CLD_TILE; extern SDL_Surface *battleDungeonImage, *backgroundImage; extern Animation playerAnimUp, playerAnimDown, playerAnimLeft, playerAnimRight; extern Animation slashOne, slashTwo; extern char *potOne, *potTwo, *potThree, *potFour; //Sound Stuff extern Mix_Music *music; // battle stats extern char *baseatk; extern char *curatk; extern char *basedef; extern char *curdef; extern char *basespd; extern char *curspd; extern char *maxhp; extern char *curhp; extern char *curexp; extern char *curlvl; extern char *gold; extern char *dmgdisp1; extern char *dmgdisp2; extern char *potOne, *potTwo, *potThree, *potFour; //for displaying inventory quantities extern char *potOneI, *potTwoI, *potThreeI, *potFourI; extern char *swordOneI, *swordTwoI, *swordThreeI, *swordFourI; extern char *armorOneI, *armorTwoI, *armorThreeI, *armorFourI; extern void freeAnimation(Animation *); extern void initializePlayerStats(); extern void initTreasureChestData(); #endif
/* -*- c++ -*- */ /* * Copyright 2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * * SPDX-License-Identifier: GPL-3.0-or-later * */ #ifndef FREQ_CONTROL_PANEL_H #define FREQ_CONTROL_PANEL_H #include <gnuradio/fft/window.h> #include <gnuradio/qtgui/displayform.h> #include <gnuradio/qtgui/freqdisplayform.h> #include <QtGui/QtGui> #include <QCheckBox> #include <QComboBox> #include <QHBoxLayout> #include <QLabel> #include <QPushButton> #include <QSlider> #include <vector> class FreqControlPanel : public QVBoxLayout { Q_OBJECT public: FreqControlPanel(FreqDisplayForm* form); ~FreqControlPanel(); public slots: void notifyAvgSlider(int val); void setFFTAverage(float val); void toggleGrid(bool en); void toggleAxisLabels(bool en); void toggleMaxHold(bool en); void toggleMinHold(bool en); void toggleFFTSize(int val); void toggleFFTWindow(const gr::fft::window::win_type win); void toggleTriggerMode(gr::qtgui::trigger_mode mode); void toggleStopButton(); signals: void signalAvgSlider(float val); void signalAvg(bool en); void signalToggleStopButton(); private: FreqDisplayForm* d_parent; QGroupBox* d_trace_box; QVBoxLayout* d_trace_layout; QCheckBox* d_maxhold_check; QCheckBox* d_minhold_check; QHBoxLayout* d_avg_layout; QLabel* d_avg_label; QSlider* d_avg_slider; QGroupBox* d_axes_box; QVBoxLayout* d_axes_layout; QCheckBox* d_grid_check; QCheckBox* d_axislabels_check; QHBoxLayout* d_yrange_layout; QLabel* d_yrange_label; QPushButton* d_yrange_plus; QPushButton* d_yrange_minus; QHBoxLayout* d_ymin_layout; QLabel* d_ymin_label; QPushButton* d_ymin_plus; QPushButton* d_ymin_minus; QPushButton* d_autoscale_button; QGroupBox* d_fft_box; QVBoxLayout* d_fft_layout; QComboBox* d_fft_size_combo; QComboBox* d_fft_win_combo; int d_slider_max, d_slider_min, d_slider_step; QGroupBox* d_trigger_box; QVBoxLayout* d_trigger_layout; QHBoxLayout* d_trigger_level_layout; QLabel* d_trigger_level_label; QComboBox* d_trigger_mode_combo; QPushButton *d_trigger_level_plus, *d_trigger_level_minus; QGroupBox* d_extras_box; QVBoxLayout* d_extras_layout; QPushButton* d_stop_button; }; #endif /* FREQ_CONTROL_PANEL_H */
/**************************************************************************** ** ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QWAYLANDTEXTINPUTMANAGER_H #define QWAYLANDTEXTINPUTMANAGER_H #include <QtWaylandCompositor/QWaylandCompositorExtension> #include <QtCore/QSize> QT_BEGIN_NAMESPACE class QWaylandTextInputManagerPrivate; class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTextInputManager : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManager> { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandTextInputManager) public: QWaylandTextInputManager(); QWaylandTextInputManager(QWaylandCompositor *compositor); void initialize() override; static const struct wl_interface *interface(); static QByteArray interfaceName(); }; QT_END_NAMESPACE #endif // QWAYLANDTEXTINPUTMANAGER_H
/* * Copyright (C) 2020 Cameron White * * 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 FORMATS_GP7_TO_PT2_H #define FORMATS_GP7_TO_PT2_H class Score; namespace Gp7 { struct Document; /// Converts the Guitar Pro document into the provided score. void convert(const Gp7::Document &doc, Score &score); } // namespace Gp7 #endif
/* * Copyright (c) 2004-2011 Hewlett-Packard Development Company, L.P. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* For 64-bit systems, we expect the double type to hold two int64's. */ #if ((defined(__x86_64__) && defined(AO_GCC_ATOMIC_TEST_AND_SET)) \ || defined(__aarch64__)) && !defined(__ILP32__) /* x86-64: __m128 is not applicable to atomic intrinsics. */ # if AO_GNUC_PREREQ(4, 7) || AO_CLANG_PREREQ(3, 6) # pragma GCC diagnostic push /* Suppress warning about __int128 type. */ # if defined(__clang__) || AO_GNUC_PREREQ(6, 4) # pragma GCC diagnostic ignored "-Wpedantic" # else /* GCC before ~4.8 does not accept "-Wpedantic" quietly. */ # pragma GCC diagnostic ignored "-pedantic" # endif typedef unsigned __int128 double_ptr_storage; # pragma GCC diagnostic pop # else /* pragma diagnostic is not supported */ typedef unsigned __int128 double_ptr_storage; # endif #elif ((defined(__x86_64__) && AO_GNUC_PREREQ(4, 0)) || defined(_WIN64)) \ && !defined(__ILP32__) /* x86-64 (except for x32): __m128 serves as a placeholder which also */ /* requires the compiler to align it on 16-byte boundary (as required */ /* by cmpxchg16b). */ /* Similar things could be done for PPC 64-bit using a VMX data type. */ # include <xmmintrin.h> typedef __m128 double_ptr_storage; #elif defined(_WIN32) && !defined(__GNUC__) typedef unsigned __int64 double_ptr_storage; #elif defined(__i386__) && defined(__GNUC__) typedef unsigned long long double_ptr_storage __attribute__((__aligned__(8))); #else typedef unsigned long long double_ptr_storage; #endif # define AO_HAVE_DOUBLE_PTR_STORAGE typedef union { struct { AO_t AO_v1; AO_t AO_v2; } AO_parts; /* Note that AO_v1 corresponds to the low or the high part of */ /* AO_whole depending on the machine endianness. */ double_ptr_storage AO_whole; /* AO_whole is now (starting from v7.3alpha3) the 2nd element */ /* of this union to make AO_DOUBLE_T_INITIALIZER portable */ /* (because __m128 definition could vary from a primitive type */ /* to a structure or array/vector). */ } AO_double_t; #define AO_HAVE_double_t /* Note: AO_double_t volatile variables are not intended to be local */ /* ones (at least those which are passed to AO double-wide primitives */ /* as the first argument), otherwise it is the client responsibility to */ /* ensure they have double-word alignment. */ /* Dummy declaration as a compile-time assertion for AO_double_t size. */ struct AO_double_t_size_static_assert { char dummy[sizeof(AO_double_t) == 2 * sizeof(AO_t) ? 1 : -1]; }; #define AO_DOUBLE_T_INITIALIZER { { (AO_t)0, (AO_t)0 } } #define AO_val1 AO_parts.AO_v1 #define AO_val2 AO_parts.AO_v2
#include "vga.h" uint16_t *video_ptr = (uint16_t *) 0xb8000; /* Beginning of the video memory */ size_t cursor_position = 0; /** * This function build a tuple with foreground and background color. */ static inline uint8_t vga_entry_color() { return 0x0 | 0xF << 4; } /** * This function build a tuple char + color to be printed on screen. */ static inline uint16_t vga_entry(unsigned char c, uint8_t color) { return (uint16_t) color << 8 | (uint16_t) c; } /** * Clear only the last line of the screen (used for scrolling purpose). */ static void clear_last_line() { size_t cpt; for (cpt = NB_BYTES_TOTAL - NB_CHAR_PER_LINE ; cpt < NB_BYTES_TOTAL ; cpt++) { *(video_ptr + cpt) = vga_entry(' ', vga_entry_color()); } cursor_position -= NB_CHAR_PER_LINE; } /** * This function clear the current screen by writing blank characters on it. */ void clear_screen() { unsigned int cpt; cursor_position = 0; for (cpt = 0 ; cpt < NB_BYTES_TOTAL ; cpt ++) { *(video_ptr + cpt) = vga_entry(' ', vga_entry_color()); } } /** * Write the given char at the current cursor position on the screen. */ void write_char(char c) { if (c == '\n') { cursor_position += NB_CHAR_PER_LINE - cursor_position % NB_CHAR_PER_LINE; } else { *(video_ptr + cursor_position) = vga_entry(c, vga_entry_color()); cursor_position ++; } /* Scrolling */ if (cursor_position >= NB_BYTES_TOTAL) { memmove(video_ptr, video_ptr + NB_CHAR_PER_LINE, 2 * (NB_BYTES_TOTAL - NB_CHAR_PER_LINE)); clear_last_line(); } } /** * This function print the 'text' string onto the screen. */ void write_string(char * text) { unsigned int cpt; char c; cpt = 0; /* We go through the text to print */ while ((c = *(text + cpt++)) != '\0') { write_char(c); } }
#include <iostream> #include <vector> // This is a data class for returning the results. using namespace std; class NewResult { private: double max_rain_amount; double ave_rain_amount; string month; public: double getMax() { return max_rain_amount; } double getAverage() { return ave_rain_amount; } string getMonth() { return month; } NewResult(double max, string m, double ave) { max_rain_amount = max; ave_rain_amount = ave; month = m; } }; // The new Library. This will be the Adaptee class NewLibrary { public: // Calculates Average and maximum. It accepts two vectors. One for months // The other for rainfall amounts. NewResult *calculate(vector<string> months, vector<double> rain) { double max = 0; string month = ""; double avg = 0.0; for (int i = 0; i < rain.size(); i++) { avg = avg + rain[i]; if (rain[i] > max) { max = rain[i]; month = months[i]; } } avg = avg / rain.size(); return new NewResult(max, month, avg); } }; // The following is just for demonstrating how to use the Library. You do not // need it in your solution int Main() { vector<string> months; vector<double> rain; months.push_back("March"); rain.push_back(110); months.push_back("April"); rain.push_back(115); months.push_back("May"); rain.push_back(111); NewLibrary lib; NewResult *res = lib.calculate(months, rain); cout << "Max rainfall occured on: " << res->getMonth() << endl; cout << "Average rainfall on this year (mm): " << res->getAverage() << endl; }
/* Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com This file is part of EigenD. EigenD 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. EigenD 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 EigenD. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __CMID_BUNDLE__ #define __CMID_BUNDLE__ #include <piw/piw_bundle.h> #include <plg_midi/midi_exports.h> namespace pi_midi { class PIMIDI_DECLSPEC_CLASS midi_input_port_t { public: class impl_t; public: midi_input_port_t(const piw::change_nb_t &sink); virtual ~midi_input_port_t(); bool setport(long); long getport(void); void set_destination(const std::string &name); virtual void source_added(long uid, const std::string &name) {} virtual void source_removed(long uid) {} void run(); void stop(); private: impl_t *impl_; }; class PIMIDI_DECLSPEC_CLASS midi_input_t { public: class impl_t; public: midi_input_t(const piw::cookie_t &keyboard_cookie,const piw::cookie_t &midi_cookie); virtual ~midi_input_t(); bool setport(long); long getport(void); void set_trim(unsigned,float,float,bool); void clear_trim(); unsigned current(unsigned); void set_destination(const std::string &name); virtual void source_added(long uid, const std::string &name) {} virtual void source_removed(long uid) {} void run(); void stop(); int gc_traverse(void *,void *) const; int gc_clear(); private: impl_t *root_; }; }; #endif
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef BROWSER_H #define BROWSER_H #include <QWidget> #include <QSqlTableModel> #include "ui_browserwidget.h" class ConnectionWidget; QT_FORWARD_DECLARE_CLASS(QTableView) QT_FORWARD_DECLARE_CLASS(QPushButton) QT_FORWARD_DECLARE_CLASS(QTextEdit) QT_FORWARD_DECLARE_CLASS(QSqlError) class Browser: public QWidget, private Ui::Browser { Q_OBJECT public: Browser(QWidget *parent = 0); virtual ~Browser(); QSqlError addConnection(const QString &driver, const QString &dbName, const QString &host, const QString &user, const QString &passwd, int port = -1); void insertRow(); void deleteRow(); void updateActions(); public slots: void exec(); void showTable(const QString &table); void showMetaData(const QString &table); void addConnection(); void currentChanged() { updateActions(); } void about(); void on_insertRowAction_triggered() { insertRow(); } void on_deleteRowAction_triggered() { deleteRow(); } void on_fieldStrategyAction_triggered(); void on_rowStrategyAction_triggered(); void on_manualStrategyAction_triggered(); void on_submitAction_triggered(); void on_revertAction_triggered(); void on_selectAction_triggered(); void on_connectionWidget_tableActivated(const QString &table) { showTable(table); } void on_connectionWidget_metaDataRequested(const QString &table) { showMetaData(table); } void on_submitButton_clicked() { exec(); sqlEdit->setFocus(); } void on_clearButton_clicked() { sqlEdit->clear(); sqlEdit->setFocus(); } signals: void statusMessage(const QString &message); }; class CustomModel: public QSqlTableModel { Q_OBJECT public: explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {} QVariant data(const QModelIndex &idx, int role) const override { if (role == Qt::BackgroundRole && isDirty(idx)) return QBrush(QColor(Qt::yellow)); return QSqlTableModel::data(idx, role); } }; #endif
/* * Beautiful Capi generates beautiful C API wrappers for your C++ classes * Copyright (C) 2015 Petr Petrovich Petrov * * This file is part of Beautiful Capi. * * Beautiful Capi 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. * * Beautiful Capi 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 Beautiful Capi. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef BEAUTIFUL_CAPI_RETURN_VALUE_PRINTER_H #define BEAUTIFUL_CAPI_RETURN_VALUE_PRINTER_H #include <iostream> #include <string> #include <vector> #include <stddef.h> #include "FirstNameImpl.h" #include "MiddleNameImpl.h" #include "LastNameImpl.h" namespace ReturnValue { class PrinterImpl { public: void ShowFirstName(ReturnValue::FirstNameImpl first_name) { std::cout << "Fist Name: " << first_name.GetFirstName() << std::endl; } void ShowMiddleName(ReturnValue::MiddleNameImpl middle_name) { std::cout << "Middle Name: " << middle_name.GetMiddleName() << std::endl; } void ShowLastName(ReturnValue::LastNameImpl last_name) { std::cout << "Last Name: " << last_name.GetLastName() << std::endl; } }; } #endif /* BEAUTIFUL_CAPI_RETURN_VALUE_PRINTER_H */
/* * Copyright (C) 2009, 2010 Free Software Foundation, Inc. * Author: Simon Josefsson * * This file is part of GnuTLS. * * GnuTLS 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. * * GnuTLS 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 GnuTLS; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <stdio.h> #include <gnutls/gnutls.h> #include <gnutls/x509.h> #include "utils.h" static char pem[] = "-----BEGIN CERTIFICATE-----\n" "MIIFpzCCBI+gAwIBAgIQSOyh48ZYvgTFR8HspnpkMzANBgkqhkiG9w0BAQUFADCB\n" "vjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL\n" "ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2Ug\n" "YXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYSAoYykwNjE4MDYGA1UEAxMv\n" "VmVyaVNpZ24gQ2xhc3MgMyBFeHRlbmRlZCBWYWxpZGF0aW9uIFNTTCBTR0MgQ0Ew\n" "HhcNMDgxMTEzMDAwMDAwWhcNMDkxMTEzMjM1OTU5WjCB6zETMBEGCysGAQQBgjc8\n" "AgEDEwJERTEZMBcGCysGAQQBgjc8AgEBFAhNdWVuY2hlbjEbMBkGA1UEDxMSVjEu\n" "MCwgQ2xhdXNlIDUuKGIpMRMwEQYDVQQFEwpIUkIgMTQ0MjYxMQswCQYDVQQGEwJE\n" "RTEOMAwGA1UEERQFODA4MDcxEDAOBgNVBAgTB0JhdmFyaWExETAPBgNVBAcUCE11\n" "ZW5jaGVuMR0wGwYDVQQJFBRGcmFua2Z1cnRlciBSaW5nIDEyOTERMA8GA1UEChQI\n" "R01YIEdtYkgxEzARBgNVBAMUCnd3dy5nbXguZGUwgZ8wDQYJKoZIhvcNAQEBBQAD\n" "gY0AMIGJAoGBAN/ZbLu17YtZo2OGnOfQDwhQlCvks2c+5nJDXjnCHI/ykSGlPH4G\n" "5qc7/TScNV1/g0bUTRCA11+aVkvf6haRZfgwbxpY1iySNv8eOlm52QAfh3diJQ9N\n" "5LxQblLHMRxXSFCJThl4BYAt70YdNMT9mVD21xx6ae+m3xEuco31aV7ZAgMBAAGj\n" "ggH0MIIB8DAJBgNVHRMEAjAAMB0GA1UdDgQWBBTW4UAZN3wEg5TRWaoM1angbgOX\n" "tjALBgNVHQ8EBAMCBaAwRAYDVR0gBD0wOzA5BgtghkgBhvhFAQcXBjAqMCgGCCsG\n" "AQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMD4GA1UdHwQ3MDUw\n" "M6AxoC+GLWh0dHA6Ly9FVkludGwtY3JsLnZlcmlzaWduLmNvbS9FVkludGwyMDA2\n" "LmNybDAoBgNVHSUEITAfBggrBgEFBQcDAQYIKwYBBQUHAwIGCWCGSAGG+EIEATAf\n" "BgNVHSMEGDAWgBROQ8gddu83U3pP8lhvlPM44tW93zB2BggrBgEFBQcBAQRqMGgw\n" "KwYIKwYBBQUHMAGGH2h0dHA6Ly9FVkludGwtb2NzcC52ZXJpc2lnbi5jb20wOQYI\n" "KwYBBQUHMAKGLWh0dHA6Ly9FVkludGwtYWlhLnZlcmlzaWduLmNvbS9FVkludGwy\n" "MDA2LmNlcjBuBggrBgEFBQcBDARiMGChXqBcMFowWDBWFglpbWFnZS9naWYwITAf\n" "MAcGBSsOAwIaBBRLa7kolgYMu9BSOJsprEsHiyEFGDAmFiRodHRwOi8vbG9nby52\n" "ZXJpc2lnbi5jb20vdnNsb2dvMS5naWYwDQYJKoZIhvcNAQEFBQADggEBAKpNJQYO\n" "JTp34I24kvRF01WpOWOmfBx4K1gqruda/7U0UZqgTgBJVvwraKf6WeTZpHRqDCTw\n" "iwySv7jil+gLMT0qIZxL1pII90z71tz08h8xYi1MOLeciG87O9C5pteL/iEtiMxB\n" "96B6WWBo9mzgwSM1d8LDhrarZ7uQhm+kBAMyEXhmDnCPWhvExvxJzjEmOlxjThyP\n" "2yvIgfLyDfplRe+jUbsY7YNe08eEyoLRq1jwPuRWTaEx2gA7C6pq45747/HkJrtF\n" "ya3ULM/AJv6Nj6pobxzQ5rEkUGEwKavu7GMjLrSMnHrbVCiQrn1v6c7B9nSPA31L\n" "/do1TDFI0vSl5+M=\n" "-----END CERTIFICATE-----\n"; static const char *info = "subject `jurisdictionOfIncorporationCountryName=DE,jurisdictionOfIncorporationLocalityName=Muenchen,businessCategory=V1.0\\, Clause 5.(b),serialNumber=HRB 144261,C=DE,postalCode=80807,ST=Bavaria,L=Muenchen,STREET=Frankfurter Ring 129,O=GMX GmbH,CN=www.gmx.de', issuer `C=US,O=VeriSign\\, Inc.,OU=VeriSign Trust Network,OU=Terms of use at https://www.verisign.com/rpa (c)06,CN=VeriSign Class 3 Extended Validation SSL SGC CA', RSA key 1024 bits, signed using RSA-SHA1, activated `2008-11-13 00:00:00 UTC', expires `2009-11-13 23:59:59 UTC', SHA-1 fingerprint `7ece297c45d5b17685224b4e929a30e91a9553cb'"; void doit (void) { gnutls_datum_t der = { pem, sizeof (pem) }; gnutls_x509_crt_t cert; gnutls_datum_t out; int ret; ret = gnutls_global_init (); if (ret < 0) fail ("init %d\n", ret); ret = gnutls_x509_crt_init (&cert); if (ret < 0) fail ("crt_init %d\n", ret); ret = gnutls_x509_crt_import (cert, &der, GNUTLS_X509_FMT_PEM); if (ret < 0) fail ("crt_import %d\n", ret); ret = gnutls_x509_crt_print (cert, GNUTLS_CRT_PRINT_ONELINE, &out); if (ret < 0) fail ("x509_crt_print %d\n", ret); if (out.size != strlen (info) || strcmp (out.data, info) != 0) fail ("comparison fail (%d/%d)\nexpect: %s\n got: %.*s\n", out.size, (int) strlen (info), info, out.size, out.data); gnutls_x509_crt_deinit (cert); gnutls_global_deinit (); gnutls_free (out.data); if (debug) success ("done\n"); }
// #include "float_fifo.h" instance_implementation("int_fifo.mc.h","fifo.G.c") end;
#ifndef _ZPSETTINGS_H_ #define _ZPSETTINGS_H_ #include <string> using namespace std; class ZPSettings { public: ZPSettings(); void LoadDefaults(); bool LoadSettings(string filename); bool SaveSettings(string filename); bool loaded_from_file; bool ignore_activation; bool require_login; bool use_database; bool use_mysql; bool start_map_paused; bool bots_start_ignored; bool allow_game_speed_change; string selectable_map_list; string mysql_root_password; string mysql_user_name; string mysql_user_password; string mysql_hostname; string mysql_dbname; }; #endif
/* Copyright (C) 2016 Thomas Mijieux This file is part of libtomtix. libtomtix 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. libtomtix is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. */ #include <glib.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include "tomtix/partition.h" #include "tomtix/stack.h" #include "tomtix/graph.h" typedef enum graph_colour_ { WHITE, // never seen GREY, // currently exploring successors BLACK, // finished exploring successors GREEN // another state for } graph_colour; static bool is_acyclic_aux(t_graph *G, int state[], int i) { unsigned s = t_graph_size(G); for (unsigned j = 0; j < s; j++) { if (t_graph_has_edge(G, i, j)) { if (state[j] == WHITE) { state[j] = GREY; if (!is_acyclic_aux(G, state, j)) return false; } if (state[j] == GREY) return true; } } state[i] = BLACK; return true; } bool t_graph_is_acyclic(t_graph *G) { unsigned s = t_graph_size(G); int *state = g_malloc(sizeof*state * s); for (unsigned i = 0; i < s; i ++) state[i] = WHITE; for (unsigned i = 0; i < s; i++) { if (state[i] == WHITE) { state[i] = GREY; if (!is_acyclic_aux(G, state, i)) { g_free(state); return false; } state[i] = BLACK; } } g_free(state); return true; } t_graph *t_transposed_graph(t_graph *G) { t_graph *H = t_graph_copy(G); t_graph_transpose(H); return H; } static void get_black_vertex_stack(size_t n, int colour[], t_stack *bvs) { for (unsigned i = 0; i < n; i++) { if (colour[i] == BLACK) { t_stack_push(bvs, (void*)(intptr_t)i); } } } static void partition_stack_union(t_partition *part, t_stack *st) { int i = (intptr_t) t_stack_pop(st); while (t_stack_size(st) > 0) { int j = (intptr_t) t_stack_pop(st); t_partition_union(part, i, j); } } static void switch_black_green(size_t n, int colour[]) { for (unsigned i = 0; i < n; i++) { if (colour[i] == BLACK) colour[i] = GREEN; } } static void set_tab_value(size_t n, void *tab_, char value) { char *tab = tab_; for (unsigned i = 0; i < n; i++) { tab[i] = value; } } static void dfs_aux(t_graph *G, int i, int colour[]) { if (colour[i] != WHITE) return; colour[i] = GREY; t_graph_iterator it; for ( t_graph_begin(G, &it, i); !t_graph_end(G, &it); t_graph_next(G, &it) ) { int j = t_graph_value(G, &it); dfs_aux(G, j, colour); } colour[i] = BLACK; } // Kosaraju (vu en cours) --> remplace date de coloration // en noire par empilage sur une pile t_partition *graph_compute_strongly_connected_component(t_graph *G) { size_t n = t_graph_size(G); t_stack *st = t_stack_new(); int *colour = malloc(sizeof(*colour) * n); set_tab_value(n, colour, WHITE); for (unsigned i = 0; i < n; i++) { if (colour[i] == WHITE) { dfs_aux(G, i, colour); t_stack_push(st, (void*)(intptr_t)i); } } t_graph_transpose(G); t_partition *part = t_partition_new(n); t_stack *bvs = t_stack_new(); set_tab_value(n, colour, WHITE); while (t_stack_size(st) > 0) { int i = (intptr_t)t_stack_pop(st); dfs_aux(G, i, colour); get_black_vertex_stack(n, colour, bvs); partition_stack_union(part, bvs); switch_black_green(n, colour); } t_graph_transpose(G); t_stack_delete(bvs); t_stack_delete(st); return part; } // Although Kosaraju's algorithm is conceptually simple, // Tarjan's and the path-based algorithm are favoured in practice // since they require only one depth-first search rather than two. // http://en.wikipedia.org/wiki/Strongly_connected_component
#include <stdint.h> #ifndef PROGMEM_DEF #define PROGMEM_DEF #define PROGMEM typedef uint8_t PROGMEM prog_uint8_t; #endif PROGMEM prog_uint8_t flameFrame_14[] = { 0x13,0x02,0x01, 0x27,0x04,0x03, 0x3a,0x06,0x05, 0x3b,0x06,0x05, 0x3b,0x06,0x05, 0x3c,0x07,0x05, 0x3d,0x07,0x05, 0x3e,0x08,0x06, 0x3e,0x08,0x06, 0x3d,0x08,0x06, 0x3d,0x08,0x06, 0x3d,0x08,0x05, 0x3d,0x08,0x05, 0x3d,0x08,0x05, 0x3f,0x08,0x05, 0x40,0x09,0x05, 0x41,0x09,0x05, 0x40,0x09,0x05, 0x3f,0x09,0x05, 0x3c,0x08,0x05, 0x3c,0x08,0x05, 0x42,0x0a,0x05, 0x4e,0x0d,0x06, 0x5f,0x12,0x08, 0x6f,0x17,0x09, 0x79,0x1a,0x0a, 0x7f,0x1d,0x0b, 0x8b,0x22,0x0d, 0xa3,0x2e,0x11, 0xbf,0x42,0x17, 0xd5,0x58,0x1f, 0xe1,0x6a,0x26, 0xe8,0x7a,0x2c, 0xec,0x86,0x31, 0xed,0x8e,0x34, 0xee,0x90,0x35, 0xee,0x90,0x35, 0xef,0x93,0x36, 0xf0,0x92,0x36, 0xef,0x8e,0x34, 0xee,0x8b,0x33, 0xef,0x93,0x36, 0xf3,0xa6,0x40, 0xf6,0xbc,0x4d, 0xf8,0xd0,0x5c, 0xf9,0xdf,0x69, 0xfa,0xe8,0x73, 0xfa,0xec,0x79, 0xfa,0xea,0x7a, 0xf9,0xe4,0x73 };
/* ss2ptt.c * * Copyright 2006-2012 David G. Barnes, Paul Bourke, Christopher Fluke * * This file is part of S2PLOT. * * S2PLOT 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. * * S2PLOT 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 S2PLOT. If not, see <http://www.gnu.org/licenses/>. * * We would appreciate it if research outcomes using S2PLOT would * provide the following acknowledgement: * * "Three-dimensional visualisation was conducted with the S2PLOT * progamming library" * * and a reference to * * D.G.Barnes, C.J.Fluke, P.D.Bourke & O.T.Parry, 2006, Publications * of the Astronomical Society of Australia, 23(2), 82-93. * */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include "s2plot.h" int main(int argc, char *argv[]) { int texid; /* ID for this texture */ unsigned char *tex; /* Array holding texture */ int width, height; /* Dimensions of texture */ int i, j; /* Loop variables */ int idx; /* Temporary index into array */ XYZ xyz = { 0.0, 0.0, 0.0 }; /* Location of sphere */ float r = 0.3; /* Radius of sphere */ COLOUR col = { 1.0, 1.0, 1.0 }; /* Colour of sphere */ srand48((long)time(NULL)); /* Seed random numbers */ s2opend("/?",argc, argv); /* Open the display */ s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */ s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */ width = 128; /* Width of new texture */ height = 16; /* Height of new texture */ texid = ss2ctt(width, height); /* Create transient texture */ tex = ss2gt(texid, &width, &height); /* Store texture */ for (j=0;j<height;j++) { for (i=0;i<width;i++) { idx = (j*width + i)*4; /* Stored as (r, g, b, alpha) */ tex[idx ] = 127*drand48()+128;/* Randomish Red */ tex[idx+1] = 0; /* Green */ tex[idx+2] = 0; /* Blue */ /* Do nothing to alpha */ } } ss2ptt(texid); /* Restore transient texture */ ns2vspherex(xyz, r, col, texid); /* Draw textured sphere */ s2show(1); /* Open the s2plot window */ return 1; }
#ifndef MANTID_ALGORITHMS_CLEARMASKFLAG_H_ #define MANTID_ALGORITHMS_CLEARMASKFLAG_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" namespace Mantid { namespace Algorithms { /** ClearMaskFlag : Delete the mask flag/bit on all spectra in a workspace Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Mantid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport ClearMaskFlag : public API::Algorithm { public: const std::string name() const override; int version() const override; const std::vector<std::string> seeAlso() const override { return {"MaskDetectors"}; } const std::string category() const override; /// Algorithm's summary const std::string summary() const override { return "Delete the mask flag/bit on all spectra in a workspace."; } private: void init() override; void exec() override; }; } // namespace Algorithms } // namespace Mantid #endif /* MANTID_ALGORITHMS_CLEARMASKFLAG_H_ */
/** * Copyright (c) 2013 - 2017, Nordic Semiconductor ASA * * 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, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, 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 Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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. * */ /**@file * * @defgroup nrf_dfu Device Firmware Update API. * @{ * * @brief Device Firmware Update module interface. */ #ifndef DFU_H__ #define DFU_H__ #include <dfu_types.h> #include <stdbool.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /**@brief DFU event callback for asynchronous calls. * * @param[in] result Operation result code. NRF_SUCCESS when a queued operation was successful. * @param[in] p_data Pointer to the data to which the operation is related. */ typedef void (*dfu_callback_t)(uint32_t result, uint8_t * p_data); /**@brief Function for initializing the Device Firmware Update module. * * @return NRF_SUCCESS on success, an error_code otherwise. */ uint32_t dfu_init(void); /**@brief Function for registering a callback listener for \ref dfu_data_pkt_handle callbacks. */ void dfu_register_callback(dfu_callback_t callback_handler); /**@brief Function for setting the DFU image size. * * @details Function sets the DFU image size. This function must be called when an update is started * in order to notify the DFU of the new image size. If multiple images are to be * transferred within the same update context then this function must be called with size * information for each image being transfered. * If an image type is not being transfered, e.g. SoftDevice but no Application , then the * image size for application must be zero. * * @param[in] p_packet Pointer to the DFU packet containing information on DFU update process to be started. * * @return NRF_SUCCESS on success, an error_code otherwise. */ uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet); /**@brief Function for handling DFU data packets. * * @param[in] p_packet Pointer to the DFU packet. * * @return NRF_SUCCESS on success, an error_code otherwise. */ uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet); /**@brief Function for handling DFU init packets. * * @return NRF_SUCCESS on success, an error_code otherwise. */ uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet); /**@brief Function for validating a transferred image after the transfer has completed. * * @return NRF_SUCCESS on success, an error_code otherwise. */ uint32_t dfu_image_validate(uint16_t crc_seed); /**@brief Function for activating the transfered image after validation has successfully completed. * * @return NRF_SUCCESS on success, an error_code otherwise. */ uint32_t dfu_image_activate(void); /**@brief Function for reseting the current update procedure and return to initial state. * * @details This function call will result in a system reset to ensure correct system behavior. * The reset will might be scheduled to execute at a later point in time to ensure pending * flash operations has completed. * */ void dfu_reset(void); uint32_t dfu_bl_image_validate(void); uint32_t dfu_sd_image_validate(void); uint32_t dfu_bl_image_swap(void); uint32_t dfu_sd_image_swap(void); uint32_t dfu_ap_image_swap(void); uint32_t dfu_storage_start_address_get(void); #ifdef __cplusplus } #endif #endif // DFU_H__ /** @} */
/* * Copyright (C) 2017 Matthias Klumpp <matthias@tenstral.net> * * Licensed under the GNU General Public License Version 3 * * 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 SETTINGSDIALOG_H #define SETTINGSDIALOG_H #include <QDialog> #include <QSerialPort> namespace Ui { class SettingsDialog; } class QIntValidator; class SettingsDialog : public QDialog { Q_OBJECT public: explicit SettingsDialog(QWidget *parent = nullptr); ~SettingsDialog(); QString portName(); private slots: void showPortInfo(int idx); void apply(); void checkCustomDevicePathPolicy(int idx); private: void fillPortsParameters(); void fillPortsInfo(); void updateSettings(); private: Ui::SettingsDialog *ui; }; #endif // SETTINGSDIALOG_H
/* Test program for crypto_box utilities */ /* John David Stone Department of Computer Science Grinnell College stone@cs.grinnell.edu created February 10, 2015 last revised February 24, 2015 */ #include <stdio.h> #include <assert.h> #include "crypto_box.h" #define INTERNAL_MESSAGE_LENGTH 45 #define MESSAGE_LENGTH (crypto_box_ZEROBYTES + INTERNAL_MESSAGE_LENGTH) #define NO_ERROR 0 /* Display the contents of an array of unsigned char values. */ void display_bytes(const unsigned char *byte_vector, long long int length) { long long int counter = 0; while (counter < length) { (void) printf("%02x", byte_vector[counter]); (void) putchar((++counter & 0xF) ? ' ' : '\n'); } if (counter & 0xF) putchar('\n'); putchar('\n'); } int main() { unsigned char sender_pk[crypto_box_PUBLICKEYBYTES]; unsigned char sender_sk[crypto_box_SECRETKEYBYTES]; unsigned char receiver_pk[crypto_box_PUBLICKEYBYTES]; unsigned char receiver_sk[crypto_box_SECRETKEYBYTES]; int result; long long int counter; char message[INTERNAL_MESSAGE_LENGTH] = "This is the forest primeval ...\n"; unsigned char plaintext[MESSAGE_LENGTH]; unsigned char ciphertext[MESSAGE_LENGTH]; unsigned char shared_nonce[crypto_box_NONCEBYTES]; unsigned char decrypted[MESSAGE_LENGTH]; /* Construct keypairs for sender and receiver. */ result = crypto_box_keypair(sender_pk, sender_sk); assert(result == 0); (void) printf("sender_pk:\n"); display_bytes(sender_pk, crypto_box_PUBLICKEYBYTES); (void) printf("sender_sk:\n"); display_bytes(sender_sk, crypto_box_SECRETKEYBYTES); result = crypto_box_keypair(receiver_pk, receiver_sk); assert(result == 0); (void) printf("receiver_pk:\n"); display_bytes(receiver_pk, crypto_box_PUBLICKEYBYTES); (void) printf("receiver_sk:\n"); display_bytes(receiver_sk, crypto_box_SECRETKEYBYTES); /* Prepare a message for encryption. */ for (counter = 0; counter < crypto_box_ZEROBYTES; counter++) plaintext[counter] = 0; for (counter = 0; counter < INTERNAL_MESSAGE_LENGTH; counter++) plaintext[crypto_box_ZEROBYTES + counter] = message[counter]; (void) printf("plaintext:\n"); display_bytes(plaintext, MESSAGE_LENGTH); /* Generate a shared nonce. */ /* randombytes(shared_nonce, crypto_box_NONCEBYTES); */ for (counter = 0; counter < crypto_box_NONCEBYTES; counter++) shared_nonce[counter] = 0; (void) printf("shared_nonce:\n"); display_bytes(shared_nonce, crypto_box_NONCEBYTES); /* Encrypt the message. */ result = crypto_box(ciphertext, plaintext, MESSAGE_LENGTH, shared_nonce, receiver_pk, sender_sk); assert(result == 0); (void) printf("ciphertext:\n"); display_bytes(ciphertext, MESSAGE_LENGTH); /* Decrypt the message at the receiving end. crypto_box returns a value that begins with crypto_box_BOXZEROBYTES zero bytes, and so satisfies the precondition for crypto_box_open. */ result = crypto_box_open(decrypted, ciphertext, MESSAGE_LENGTH, shared_nonce, sender_pk, receiver_sk); assert(result == 0); (void) printf("decrypted:\n"); display_bytes(decrypted, MESSAGE_LENGTH); return NO_ERROR; }
/* * Copyright (C) 2016 Stuart Howarth <showarth@marxoft.co.uk> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DAILYMOTIONDOWNLOADDIALOG_H #define DAILYMOTIONDOWNLOADDIALOG_H #include "dailymotionstreammodel.h" #include "dailymotionsubtitlemodel.h" #include <QDialog> class CategoryNameModel; class QCheckBox; class QComboBox; class QDialogButtonBox; class QFormLayout; class QLineEdit; class DailymotionDownloadDialog : public QDialog { Q_OBJECT Q_PROPERTY(QString videoId READ videoId) Q_PROPERTY(QString streamId READ streamId) Q_PROPERTY(QString subtitlesLanguage READ subtitlesLanguage) Q_PROPERTY(QString category READ category) Q_PROPERTY(QString customCommand READ customCommand) Q_PROPERTY(bool customCommandOverrideEnabled READ customCommandOverrideEnabled) public: explicit DailymotionDownloadDialog(QWidget *parent = 0); QString videoId() const; QString streamId() const; QString subtitlesLanguage() const; QString category() const; QString customCommand() const; bool customCommandOverrideEnabled() const; public Q_SLOTS: virtual void accept(); void list(const QString &videoId); private Q_SLOTS: void setSubtitlesEnabled(bool enabled); void onStreamModelStatusChanged(QDailymotion::StreamsRequest::Status status); void onSubtitleModelStatusChanged(QDailymotion::ResourcesRequest::Status status); private: DailymotionStreamModel *m_streamModel; DailymotionSubtitleModel *m_subtitleModel; CategoryNameModel *m_categoryModel; QComboBox *m_streamSelector; QComboBox *m_subtitleSelector; QComboBox *m_categorySelector; QCheckBox *m_subtitleCheckBox; QCheckBox *m_commandCheckBox; QLineEdit *m_commandEdit; QDialogButtonBox *m_buttonBox; QFormLayout *m_layout; QString m_videoId; }; #endif // DAILYMOTIONDOWNLOADDIALOG_H
/******************************************************************************* * This file is part of MegaDrivePad for Arduino. * * * * Copyright (C) 2015 by SukkoPera * * * * MegaDrivePad 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. * * * * MegaDrivePad 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 MegaDrivePad. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ #include <Arduino.h> // Default pin mappings #define DEFAULT_UP_PIN 2 #define DEFAULT_DOWN_PIN 3 #define DEFAULT_LEFT_PIN 4 #define DEFAULT_RIGHT_PIN 5 #define DEFAULT_A_B_PIN 6 #define DEFAULT_START_C_PIN 7 #define DEFAULT_SELECT_PIN 8 class MegaDrivePad { private: enum ButtonBits { BB_UP = 0, BB_DOWN, BB_LEFT, BB_RIGHT, BB_B, BB_C, BB_A, BB_START }; struct PinMapping { byte up; byte down; byte left; byte right; byte ab; byte startc; byte select; }; PinMapping pinMapping; public: enum PadButton { BTN_START = 1 << BB_START, BTN_A = 1 << BB_A, BTN_C = 1 << BB_C, BTN_B = 1 << BB_B, BTN_RIGHT = 1 << BB_RIGHT, BTN_LEFT = 1 << BB_LEFT, BTN_DOWN = 1 << BB_DOWN, BTN_UP = 1 << BB_UP }; // Button status register. Use PadButton values to test this. 1 means pressed. byte buttons; // Initializes the library using the default pin mapping bool begin (); // Initializes the library using a custom pin mapping bool begin (byte upPin, byte downPin, byte leftPin, byte rightPin, byte abPin, byte startcPin, byte selectPin); // Reads the current state of the joystick. void read (); };
#include <errno.h> #include <getopt.h> #include <ledger.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <user_settings.h> #define F "../data/ledgers/basic.txt" int main(){ Ledger *ledger = NULL; printf("1 RET = %d\n", filled_partitions(ledger, 0)); new_ledger(&ledger); printf("2 RET = %d\n", filled_partitions(ledger, 0)); free_ledger(&ledger); get_ledger(&ledger, F, NULL, NULL); printf("3 RET = %d\n", filled_partitions(ledger, which(ledger->banks, "cp", ledger->nbanks))); free_ledger(&ledger); get_ledger(&ledger, "../data/ledgers/empty.txt", NULL, NULL); printf("EMPTY RET = %d\n", filled_partitions(ledger, 0)); free_ledger(&ledger); get_ledger(&ledger, "../data/ledgers/small.txt", NULL, NULL); printf("SMALL RET = %d\n", filled_partitions(ledger, 0)); free_ledger(&ledger); get_ledger(&ledger, "../data/ledgers/small.txt", NULL, NULL); printf("SMALL2 RET = %d\n", filled_partitions(ledger, 0)); free_ledger(&ledger); return 0; }
/* Copyright (C) 2013 Harald Sitter <apachelogger@kubuntu.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 MODULE_H #define MODULE_H #include <KCModule> namespace Ui { class Module; } class ComUbuntuWhoopsiePreferencesInterface; class DataStore; struct DataStore { bool reportCrashes; bool reportMetrics; bool automaticallyReportCrashes; bool operator ==(const DataStore &other) { return !(bool)((reportCrashes ^ other.reportCrashes) ^ (reportMetrics ^ other.reportMetrics) ^ (automaticallyReportCrashes ^ other.automaticallyReportCrashes)); } }; class Module : public KCModule { Q_OBJECT public: /** * Constructor. * * @param parent Parent widget of the module * @param args Arguments for the module */ explicit Module(QWidget *parent, const QVariantList &args = QVariantList()); /** * Destructor. */ ~Module(); /** * Overloading the KCModule load() function. */ void load(); /** * Overloading the KCModule save() function. */ void save(); /** * Overloading the KCModule defaults() function. */ void defaults(); private slots: /// Updates currentData DataStore instance. void diff(); void openUrl(const QString &url); private: /// UI Ui::Module *ui; /// DBus Interface ComUbuntuWhoopsiePreferencesInterface *m_preferences; /// DataStore instance filled on load() to compare against later. Mutable. DataStore m_initialData; /// DataStore instance updated by diff(), representing the present state. DataStore m_currentData; }; #endif // MODULE_H
/* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ // // DIYDrones Custom Mediatek GPS driver for ArduPilot and ArduPilotMega. // Code by Michael Smith, Jordi Munoz and Jose Julio, Craig Elder, DIYDrones.com // // GPS configuration : Custom protocol per "Customize Function Specification, 3D Robotics, v1.6, v1.7, v1.8, v1.9" // /* ############################# Changed by Andy Little Apr 2016 ########################### */ #ifndef APM_GPS_MTK19_HPP_INCLUDED #define APM_GPS_MTK19_HPP_INCLUDED #include <apm/common.hpp> #include "AP_GPS_MTK_Common.h" #include <apm/gps.hpp> #include "GPS_Backend.h" #define MTK_GPS_REVISION_V16 16 #define MTK_GPS_REVISION_V19 19 namespace apm{ class AP_GPS_MTK19 : public AP_GPS_Backend { public: AP_GPS_MTK19(gps_t &_gps); bool read(void); static bool _detect(struct MTK19_detect_state &state, uint8_t data); private: struct PACKED diyd_mtk_msg { int32_t latitude; int32_t longitude; int32_t altitude; int32_t ground_speed; int32_t ground_course; uint8_t satellites; uint8_t fix_type; uint32_t utc_date; uint32_t utc_time; uint16_t hdop; } ; enum diyd_mtk_fix_type { FIX_NONE = 1, FIX_2D = 2, FIX_3D = 3, FIX_2D_SBAS = 6, FIX_3D_SBAS = 7 }; enum diyd_mtk_protocol_bytes { PREAMBLE1_V16 = 0xd0, PREAMBLE1_V19 = 0xd1, PREAMBLE2 = 0xdd, }; // Packet checksum accumulators uint8_t _ck_a; uint8_t _ck_b; // State machine state uint8_t _step; uint8_t _payload_counter; uint8_t _mtk_revision; uint8_t _fix_counter; // Receive buffer union { diyd_mtk_msg msg; uint8_t bytes[]; } _buffer; }; } // apm #endif // APM_GPS_MTK19_HPP_INCLUDED
/* This source file is part of Rigs of Rods Copyright 2005-2012 Pierre-Michel Ricordel Copyright 2007-2012 Thomas Fischer Copyright 2013-2014 Petr Ohlidal For more information, see http://www.rigsofrods.org/ Rigs of Rods is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. Rigs of Rods 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 Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ /// @file /// @author Petr Ohlidal /// @date 05/2014 /// @brief OGRE engine wrapper. #pragma once #include "RoRPrerequisites.h" #include <OgreMaterial.h> namespace RoR { class OgreSubsystem : public ZeroedMemoryAllocator { public: OgreSubsystem(); ~OgreSubsystem(); bool StartOgre(Ogre::String const & hwnd, Ogre::String const & mainhwnd); void WindowResized(Ogre::Vector2 const & size); Ogre::String GetMainHWND() { return m_main_hwnd; } Ogre::Root* GetOgreRoot() { return m_ogre_root; } Ogre::RenderWindow* GetRenderWindow() { return m_render_window; } Ogre::Viewport* GetViewport() { return m_viewport; } void SetViewport(Ogre::Viewport* viewport) { m_viewport = viewport; } static Ogre::MaterialPtr GetMaterialByName(std::string const & name); private: Ogre::String m_hwnd; Ogre::String m_main_hwnd; Ogre::Root* m_ogre_root; Ogre::RenderWindow* m_render_window; Ogre::Viewport* m_viewport; bool Configure(); bool LoadOgrePlugins(Ogre::String const & pluginsfile); }; } // namespace RoR
#ifndef PHYSICALACTIVITYDATA_H #define PHYSICALACTIVITYDATA_H #include "Data/data.h" class PhysicalActivityData : public Data { public: explicit PhysicalActivityData(); explicit PhysicalActivityData(Data data); virtual QString toString(); signals: public slots: }; // Serialization QDataStream &operator<<(QDataStream &out, const PhysicalActivityData &data); QDataStream &operator>>(QDataStream &in, PhysicalActivityData &data); #endif // PHYSICALACTIVITYDATA_H
/* * Red Bull Media Player * Copyright (C) 2011, Red Bull * * 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 PLAYERTIMECHANGEDEVENT_H #define PLAYERTIMECHANGEDEVENT_H #include <QEvent> #include "../Events_global.h" #include "../EventTypes.h" namespace RedBullPlayer { namespace Events { class EVENTSSHARED_EXPORT PlayerTimeChangedEvent : public QEvent { public: PlayerTimeChangedEvent( qint64 time ) : QEvent( PlayerTimeChanged ) { _time = time; } qint64 time() const { return _time; } private: qint64 _time; }; } } #endif // PLAYERTIMECHANGEDEVENT_H
/* * This file is part of EasyRPG Player. * * EasyRPG Player 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. * * EasyRPG Player 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 EasyRPG Player. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _WINDOW_NUMBERINPUT_H_ #define _WINDOW_NUMBERINPUT_H_ // Headers #include "window_base.h" #include "window_selectable.h" /** * Window Input Number Class. * The number input window. */ class Window_NumberInput : public Window_Selectable { public: /** * Constructor. * * @param ix window x position. * @param iy window y position. * @param iwidth window width. * @param iheight window height. */ Window_NumberInput(int ix, int iy, int iwidth = 320, int iheight = 80); /** * Updates the Window's contents. */ void Refresh(); /** * Returns the number value. * * @return the currently input number. */ int GetNumber(); /** * Sets a new number value. * * @param inumber the new number value. */ void SetNumber(unsigned inumber); /** * Returns the number of displayed digits. * * @return number of displayed digits. */ int GetMaxDigits(); /** * Sets the maximal displayed digits. * * @param idigits_max maximal displayed digits * must be a value from 1-6. */ void SetMaxDigits(int idigits_max); /** * Updates the position of the cursor rectangle. */ void UpdateCursorRect(); /** * Updates number value according to user input. */ void Update(); protected: unsigned int number; int digits_max; unsigned int cursor_width; unsigned int index; }; #endif
// // dataset.h // Mothur // // Created by Sarah Westcott on 3/24/16. // Copyright (c) 2016 Schloss Lab. All rights reserved. // #ifndef __Mothur__dataset__ #define __Mothur__dataset__ #include "sequence.hpp" #include "counttable.h" #include "groupmap.h" #include "sharedrabundvector.hpp" #include "fastqdataset.h" #include "utils.hpp" class TestDataSet { public: TestDataSet(); vector<Sequence> getSeqs() { fillSeqs(); return seqs; } map<string, string> getNameMap() { fillNames(); return nameMap; } GroupMap* getGroupMap() { fillGroup(); return gMap; } CountTable* getCountTable() { createCountTable(); return ct; } vector<SharedRAbundVector*> getLookup() { fillLookup(); return lookup; } vector<string> getSubsetFNGFiles(); //Fasta, name, group returned - containing 100 seqs string getSubsetFNGDistFile(); string getSubsetFNGPhylipDistFile(); vector<string> getOptiRefFiles(); //fasta, count, column, phylip, list, betweendist vector<string> getOligosFiles(); //single, paired, indexes, comboNamesTest string getSharedFile(); //shared string getRelabundFile(); //relabund string getCountTableFile(); //count private: MothurOut* m; Utils util; TestFastqDataSet fastqData; vector<Sequence> seqs; map<string, string> nameMap; CountTable* ct; GroupMap* gMap; vector<SharedRAbundVector*> lookup; string testDir; void fillNames(); void fillSeqs(); void fillGroup(); void createCountTable(); void fillLookup(); }; #endif /* defined(__Mothur__dataset__) */
/* * ===================================================================================== * * Filename: main.c * * Description: Feeder module to a Postgres DB for the RSSReader JSON function * * Version: 1.0 * Created: 06.08.2016 12:10:28 * Revision: none * Compiler: gcc * * Author: Stephan Avenwedde * Organization: * * ===================================================================================== */ #include <stdio.h> #include <string.h> #include <time.h> #include <stdint.h> #include "struct.h" #include "decode_json.h" #include "pgs_interface.h" #include "log_var.h" #define MAX_JS_LINE_LENGHT 300 extern log4c_category_t *log_tracer; extern log4c_category_t *log_debug; extern log4c_category_t *log_raw; extern char s_prgrm_name[50]; int main(int argc, const char *argv[]) { struct_data *sd_data; char *s_json; char s_buffer[MAX_JS_LINE_LENGHT]; strcpy(s_prgrm_name, argv[0]); if(log4c_init()){ printf("\nlog4c_init() failed\n"); exit(1); }else{ log_tracer = log4c_category_get("tracer"); log_debug = log4c_category_get("debug"); log_raw = log4c_category_get("raw_data"); log4c_category_log(log_tracer, LOG4C_PRIORITY_TRACE,"%s: %s() -> log4c initialized", argv[0], __func__); } s_json = calloc(1,1); fflush(stdin); /* getting the inpug */ while(fgets(s_buffer, MAX_JS_LINE_LENGHT, stdin)){ s_json = realloc( s_json, ((strlen(s_json) + strlen(s_buffer) * sizeof(char)) + 1)); if(!s_json){ log4c_category_log(log_debug, LOG4C_PRIORITY_ERROR,"%s: %s() -> realloc failed", argv[0], __func__); exit(1); } strcat(s_json, s_buffer); } log4c_category_log(log_tracer, LOG4C_PRIORITY_DEBUG, "%s: %s() -> lenght of string: %lu", argv[0], __func__, strlen(s_json)); log4c_category_log(log_raw, LOG4C_PRIORITY_TRACE, "%s: %s() -> stdin string: %s", argv[0], __func__, s_json); sd_data = s_data(s_json); run_db(sd_data); free(s_json); free_struct_data(sd_data); return 0; }
// // IMImageSavingViewController.h // Tree Crafter iPad App // // Created by SIMON WINDER on 4/4/13. // Copyright (c) 2013 Impressive Machines LLC. All rights reserved. // #import <UIKit/UIKit.h> #import <MessageUI/MessageUI.h> #import <MessageUI/MFMailComposeViewController.h> #import <Social/Social.h> #import "fractaltrees.h" #import "IMTreeModel.h" @protocol IMImageSavingViewControllerDelegate - (void)imageSaveDidSucceed:(BOOL)success; @end @interface IMImageSavingViewController : UIViewController <IMTreeModelDelegate, MFMailComposeViewControllerDelegate> @property (assign, nonatomic) id <IMImageSavingViewControllerDelegate> delegate; @property (assign, atomic) BOOL userCancel; @property (assign, atomic) float progress; @property (assign, nonatomic) int shareMode; @property (assign, nonatomic) float drawscale; @property (assign, nonatomic) CGPoint draworigin; @property (retain, nonatomic) NSString *headertext; @property (retain, nonatomic) NSString *footertext; @property (retain, nonatomic) UIImage *backgroundimage; @property (assign, nonatomic) CGSize drawsize; @property (retain, nonatomic) UIColor *textcolor; @property (assign, nonatomic) int quality; @property (retain, nonatomic) UIImage *image; @property (assign, nonatomic) BOOL addLogo; @end
#ifndef __PDF2LASER_CLI_H__ #define __PDF2LASER_CLI_H__ 1 #include <stdbool.h> // for bool #include <stdint.h> // for int32_t #include "type_print_job.h" // for print_job_t #include <stddef.h> // for size_t #include "config.h" #include "type_print_job.h" // for print_job_t #include "type_preset_file.h" // for preset_file_t #ifdef __cplusplus extern "C" { #endif #if 0 } #endif #define OPTARG_MAX_LENGTH 1024 bool pdf2laser_optparse(print_job_t *print_job, preset_file_t **preset_files, size_t preset_files_count, int32_t argc, char **argv); #ifdef __cplusplus }; #endif #endif
/* * Copyright (C) Cybernetica * * Research/Commercial License Usage * Licensees holding a valid Research License or Commercial License * for the Software may use this file according to the written * agreement between you and Cybernetica. * * GNU General Public License Usage * Alternatively, this file may be used under the terms of the GNU * General Public License version 3.0 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in the * packaging of this file. Please review the following information to * ensure the GNU General Public License version 3.0 requirements will be * met: http://www.gnu.org/copyleft/gpl-3.0.html. * * For further information, please contact us at sharemind@cyber.ee. */ #ifndef SHAREMIND_LIBRANDOM_AESRANDOMENGINE_H #define SHAREMIND_LIBRANDOM_AESRANDOMENGINE_H #include "RandomEngine.h" #include <cstddef> namespace sharemind { /** A random engine based on AES in CTR mode. */ class AesRandomEngine: public RandomEngine { public: /* Methods: */ AesRandomEngine(void const * seed); ~AesRandomEngine() noexcept override; void fillBytes(void * buffer, std::size_t size) noexcept override; static bool supported() noexcept; static std::size_t seedSize() noexcept; private: /* Fields: */ void * m_inner; }; } /* namespace sharemind { */ #endif /* SHAREMIND_LIBRANDOM_AESRANDOMENGINE_H */
/* * JFFS2 -- Journalling Flash File System, Version 2. * * Copyright (C) 2002 Red Hat, Inc. * * Created by Jonathan Larmour <jlarmour@redhat.com> * *=========================================================================== *####ECOSGPLCOPYRIGHTBEGIN#### * ------------------------------------------- * This file is part of eCos, the Embedded Configurable Operating System. * Copyright (C) 2003 Red Hat. * * eCos is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 or (at your option) any later version. * * eCos 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 eCos; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * As a special exception, if other files instantiate templates or use macros * or inline functions from this file, or you compile this file and link it * with other works to produce a work based on this file, this file does not * by itself cause the resulting work to be covered by the GNU General Public * License. However the source code for this file must still be made available * in accordance with section (3) of the GNU General Public License. * * This exception does not invalidate any other reasons why a work based on * this file might be covered by the GNU General Public License. * * Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. * at http://sources.redhat.com/ecos/ecos-license/ * ------------------------------------------- *####ECOSGPLCOPYRIGHTEND#### *=========================================================================== * */ #ifndef CYGONCE_FS_JFFS2_LIST_H #define CYGONCE_FS_JFFS2_LIST_H /* -----------------------------------------------------------------------*/ /* Doubly linked list implementation to replace the GPL'd one used in the Linux kernel. */ #include <stddef.h> #include <cyg/infra/cyg_type.h> /* TYPES */ struct list_head { struct list_head *next; struct list_head *prev; }; /* MACROS */ #define LIST_HEAD_INIT(name) { &(name), &(name) } #define LIST_HEAD(name) \ struct list_head name = LIST_HEAD_INIT(name) #define INIT_LIST_HEAD( _list_ ) \ CYG_MACRO_START \ (_list_)->next = (_list_)->prev = (_list_); \ CYG_MACRO_END /* FUNCTIONS */ /* Insert an entry _after_ the specified entry */ static __inline__ void list_add( struct list_head *newent, struct list_head *afterthisent ) { struct list_head *next = afterthisent->next; newent->next = next; newent->prev = afterthisent; afterthisent->next = newent; next->prev = newent; } /* list_add() */ /* Insert an entry _before_ the specified entry */ static __inline__ void list_add_tail( struct list_head *newent, struct list_head *beforethisent ) { struct list_head *prev = beforethisent->prev; newent->prev = prev; newent->next = beforethisent; beforethisent->prev = newent; prev->next = newent; } /* list_add_tail() */ /* Delete the specified entry */ static __inline__ void list_del( struct list_head *ent ) { ent->prev->next = ent->next; ent->next->prev = ent->prev; } /* list_del() */ /* Is this list empty? */ static __inline__ int list_empty( struct list_head *list ) { return ( list->next == list ); } /* list_empty() */ /* list_entry - Assuming you have a struct of type _type_ that contains a list which has the name _member_ in that struct type, then given the address of that list in the struct, _list_, this returns the address of the container structure */ #define list_entry( _list_, _type_, _member_ ) \ ((_type_ *)((char *)(_list_)-(char *)(offsetof(_type_,_member_)))) /* list_for_each - using _ent_, iterate through list _list_ */ #define list_for_each( _ent_, _list_ ) \ for ( (_ent_) = (_list_)->next; \ (_ent_) != (_list_); \ (_ent_) = (_ent_)->next ) /* * list_for_each_entry - this function can be use to iterate over all * items in a list* _list_ with it's head at _head_ and link _item_ */ #define list_for_each_entry(_list_, _head_, _item_) \ for ((_list_) = list_entry((_head_)->next, typeof(*_list_), _item_); \ &((_list_)->_item_) != (_head_); \ (_list_) = list_entry((_list_)->_item_.next, typeof(*_list_), _item_)) /* -----------------------------------------------------------------------*/ #endif /* #ifndef CYGONCE_FS_JFFS2_LIST_H */ /* EOF list.h */
/* * Copyright 2003-2013 Jeffrey K. Hollingsworth * * This file is part of Active Harmony. * * Active Harmony is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Active Harmony 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 Active Harmony. If not, see <http://www.gnu.org/licenses/>. */ #include "hval.h" #include "hutil.h" #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int hval_parse_string(const char *buf, const char **newbuf); const hval_t HVAL_INITIALIZER = {0}; int hval_parse(hval_t *val, const char *buf) { int ret, cnt; switch (val->type) { case HVAL_INT: ret = sscanf(buf, " %ld%n", &val->value.i, &cnt); break; case HVAL_REAL: ret = sscanf(buf, " %lf%n", &val->value.r, &cnt); break; case HVAL_STR: ret = cnt = hval_parse_string(buf, &val->value.s); break; default: return -1; } return (ret > 0) ? cnt : -1; } int hval_parse_string(const char *buf, const char **newbuf) { const char *head; const char *tail; int len, span, quoted = 0; /* Find the head. */ head = buf; while (head && isspace(*head)) ++head; if (!head) return -1; if (*head == '"') { ++head; quoted = 1; } /* Find tail, length, and span. */ len = 0; tail = head; while (tail && (quoted ? *tail == '"' : isspace(*tail))) { if (*tail == '\\') tail += 2; else tail += 1; ++len; } if (!tail) return -1; span = tail - buf + 1; /* Allocate memory and copy an unescaped version of the string. */ if (newbuf) { char *ptr = calloc(len + 1, sizeof(*ptr)); if (!ptr) return -1; *newbuf = ptr; while (head < tail) { if (*head == '\\') ++head; *(ptr++) = *(head++); } } return span; } int hval_serialize(char **buf, int *buflen, const hval_t *val) { int count, total; const char *type_str; switch (val->type) { case HVAL_INT: type_str = "INT"; break; case HVAL_REAL: type_str = "REL"; break; case HVAL_STR: type_str = "STR"; break; default: goto invalid; } count = snprintf_serial(buf, buflen, "hval:%s ", type_str); if (count < 0) goto error; total = count; switch (val->type) { case HVAL_INT: count = snprintf_serial(buf, buflen, "%ld ", val->value.i); if (count < 0) goto error; total += count; break; case HVAL_REAL: count = snprintf_serial(buf, buflen, "%la ", val->value.r); if (count < 0) goto error; total += count; break; case HVAL_STR: count = printstr_serial(buf, buflen, val->value.s); if (count < 0) goto error; total += count; break; default: goto invalid; } return total; invalid: errno = EINVAL; error: return -1; } int hval_deserialize(hval_t *val, char *buf) { int count, total; char type_str[4]; if (sscanf(buf, " hval:%3s%n", type_str, &count) < 1) goto invalid; total = count; if (strcmp(type_str, "INT") == 0) val->type = HVAL_INT; else if (strcmp(type_str, "REL") == 0) val->type = HVAL_REAL; else if (strcmp(type_str, "STR") == 0) val->type = HVAL_STR; else goto invalid; switch (val->type) { case HVAL_INT: if (sscanf(buf + total, " %ld%n", &val->value.i, &count) < 1) goto invalid; total += count; break; case HVAL_REAL: if (sscanf(buf + total, " %la%n", &val->value.r, &count) < 1) goto invalid; total += count; break; case HVAL_STR: count = scanstr_serial(&val->value.s, buf + total); if (count < 0) goto invalid; total += count; break; default: goto invalid; } return total; invalid: errno = EINVAL; return -1; }
/* * This file is part of the libopencm3 project. * * Copyright (C) 2010 Mark Butler <mbutler@physics.otago.ac.nz> * Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au> * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. * * This provides the code for the "next gen" EXTI block provided in F2/F4/L1 * devices. (differences only in the source selection) */ /**@{*/ #include <libopencm3/gd32/exti.h> #include <libopencm3/gd32/gpio.h> #if !defined(AFIO_BASE) # include <libopencm3/gd32/syscfg.h> #endif void exti_set_trigger(uint32_t extis, enum exti_trigger_type trig) { switch (trig) { case EXTI_TRIGGER_RISING: EXTI_RTSR |= extis; EXTI_FTSR &= ~extis; break; case EXTI_TRIGGER_FALLING: EXTI_RTSR &= ~extis; EXTI_FTSR |= extis; break; case EXTI_TRIGGER_BOTH: EXTI_RTSR |= extis; EXTI_FTSR |= extis; break; } } void exti_enable_request(uint32_t extis) { /* Enable interrupts. */ EXTI_IMR |= extis; /* Enable events. */ EXTI_EMR |= extis; } void exti_disable_request(uint32_t extis) { /* Disable interrupts. */ EXTI_IMR &= ~extis; /* Disable events. */ EXTI_EMR &= ~extis; } /* * Reset the interrupt request by writing a 1 to the corresponding * pending bit register. */ void exti_reset_request(uint32_t extis) { EXTI_PR = extis; } /* * Check the flag of a given EXTI interrupt. * */ uint32_t exti_get_flag_status(uint32_t exti) { return EXTI_PR & exti; } /* * Remap an external interrupt line to the corresponding pin on the * specified GPIO port. * * TODO: This could be rewritten in fewer lines of code. */ void exti_select_source(uint32_t exti, uint32_t gpioport) { uint32_t line; for (line = 0; line < 16; line++) { if (!(exti & (1 << line))) { continue; } uint32_t bits = 0, mask = 0x0F; switch (gpioport) { case GPIOA: bits = 0; break; case GPIOB: bits = 1; break; case GPIOC: bits = 2; break; case GPIOD: bits = 3; break; #if defined(GPIOE) && defined(GPIO_PORT_E_BASE) case GPIOE: bits = 4; break; #endif #if defined(GPIOF) && defined(GPIO_PORT_F_BASE) case GPIOF: bits = 5; break; #endif #if defined(GPIOG) && defined(GPIO_PORT_G_BASE) case GPIOG: bits = 6; break; #endif #if defined(GPIOH) && defined(GPIO_PORT_H_BASE) case GPIOH: bits = 7; break; #endif #if defined(GPIOI) && defined(GPIO_PORT_I_BASE) case GPIOI: bits = 8; break; #endif #if defined(GPIOJ) && defined(GPIO_PORT_J_BASE) case GPIOJ: bits = 9; break; #endif #if defined(GPIOK) && defined(GPIO_PORT_K_BASE) case GPIOK: bits = 10; break; #endif } uint8_t shift = (uint8_t)(4 * (line % 4)); uint32_t reg = line / 4; bits <<= shift; mask <<= shift; #if defined(AFIO_BASE) AFIO_EXTICR(reg) = (AFIO_EXTICR(reg) & ~mask) | bits; #else SYSCFG_EXTICR(reg) = (SYSCFG_EXTICR(reg) & ~mask) | bits; #endif }; } /**@}*/
// ASR - Digital Signal Processor // Copyright (C) 2002-2013 Paul Ciarlo // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #import <UIKit/UIKit.h> @interface RootViewController : UIViewController <UIPageViewControllerDelegate> @property (strong, nonatomic) UIPageViewController *pageViewController; @end
/***************************************************************************/ /* */ /* ttunpat.h */ /* */ /* Definitions for the unpatented TrueType hinting system */ /* */ /* Copyright 2003, 2006 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Written by Graham Asher <graham.asher@btinternet.com> */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef __TTUNPAT_H__ #define __TTUNPAT_H__ #include <FreeType/ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************** * * @constant: * FT_PARAM_TAG_UNPATENTED_HINTING * * @description: * A constant used as the tag of an @FT_Parameter structure to indicate * that unpatented methods only should be used by the TrueType bytecode * interpreter for a typeface opened by @FT_Open_Face. * */ #define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) /* */ FT_END_HEADER #endif /* __TTUNPAT_H__ */ /* END */
//# MSLofarFieldColumns.h: provides easy access to LOFAR's MSField columns //# Copyright (C) 2011 //# ASTRON (Netherlands Institute for Radio Astronomy) //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands //# //# This file is part of the LOFAR software suite. //# The LOFAR software suite is free software: you can redistribute it and/or //# modify it under the terms of the GNU General Public License as published //# by the Free Software Foundation, either version 3 of the License, or //# (at your option) any later version. //# //# The LOFAR software suite is distributed in the hope that it will be useful, //# but WITHOUT ANY WARRANTY; without even the implied warranty of //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //# GNU General Public License for more details. //# //# You should have received a copy of the GNU General Public License along //# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. //# //# $Id$ //# //# @author Ger van Diepen #ifndef MSLOFAR_MSLOFARFIELDCOLUMNS_H #define MSLOFAR_MSLOFARFIELDCOLUMNS_H #include <ms/MeasurementSets/MSFieldColumns.h> namespace LOFAR { //# Forward Declaration class MSLofarField; // This class provides read-only access to the columns in the MSLofarField // Table. It does the declaration of all the Scalar and ArrayColumns with the // correct types, so the application programmer doesn't have to worry about // getting those right. There is an access function for every predefined // column. Access to non-predefined columns will still have to be done with // explicit declarations. class ROMSLofarFieldColumns: public casa::ROMSFieldColumns { public: // Create a columns object that accesses the data in the specified Table. ROMSLofarFieldColumns(const MSLofarField& msLofarField); // The destructor does nothing special. ~ROMSLofarFieldColumns(); // Access to columns. // <group> const casa::ROArrayColumn<casa::Double>& tileBeamDir() const { return tileBeamDir_p; } const casa::ROScalarMeasColumn<casa::MDirection>& tileBeamDirMeasCol() const { return tileBeamDirMeas_p; } // </group> protected: //# Default constructor creates a object that is not usable. Use the attach //# function correct this. ROMSLofarFieldColumns(); //# Attach this object to the supplied table. void attach (const MSLofarField& msLofarField); private: //# Make the assignment operator and the copy constructor private to prevent //# any compiler generated one from being used. ROMSLofarFieldColumns(const ROMSLofarFieldColumns&); ROMSLofarFieldColumns& operator=(const ROMSLofarFieldColumns&); //# required columns casa::ROArrayColumn<casa::Double> tileBeamDir_p; //# Access to Measure columns casa::ROScalarMeasColumn<casa::MDirection> tileBeamDirMeas_p; }; // This class provides read/write access to the columns in the MSLofarField // Table. It does the declaration of all the Scalar and ArrayColumns with the // correct types, so the application programmer doesn't have to // worry about getting those right. There is an access function // for every predefined column. Access to non-predefined columns will still // have to be done with explicit declarations. class MSLofarFieldColumns: public casa::MSFieldColumns { public: // Create a columns object that accesses the data in the specified Table. MSLofarFieldColumns(MSLofarField& msLofarField); // The destructor does nothing special. ~MSLofarFieldColumns(); // Read-write access to required columns. // <group> const casa::ROArrayColumn<casa::Double>& tileBeamDir() const { return roTileBeamDir_p; } casa::ArrayColumn<casa::Double>& tileBeamDir() { return rwTileBeamDir_p; } const casa::ROScalarMeasColumn<casa::MDirection>& tileBeamDirMeasCol() const { return roTileBeamDirMeas_p; } casa::ScalarMeasColumn<casa::MDirection>& tileBeamDirMeasCol() { return rwTileBeamDirMeas_p; } // </group> // Set the direction reference type for all direction columns. // This can only be done when the table has no rows. // Trying to do so at other times will throw an exception. void setDirectionRef(casa::MDirection::Types ref); // Same as above, but the LOFAR_TILE_BEAM_DIR can have a different type. void setDirectionRef(casa::MDirection::Types ref, casa::MDirection::Types tileBeamDirRef); // Set the direction offset for all direction columns. // This can only be done when the table has no rows. // Trying to do so at other times will throw an exception. /// void setDirectionOffset(const MDirection& offset); // Same as above, but the LOFAR_TILE_BEAM_DIR can have a different offset. /// void setDirectionOffset(const MDirection& offset, /// const MDirection& tileBeamDirOffset); protected: //# Default constructor creates a object that is not usable. Use the attach //# function correct this. MSLofarFieldColumns(); //# Attach this object to the supplied table. void attach(MSLofarField& msLofarField); private: //# Make the assignment operator and the copy constructor private to prevent //# any compiler generated one from being used. MSLofarFieldColumns(const MSLofarFieldColumns&); MSLofarFieldColumns& operator=(const MSLofarFieldColumns&); //# required columns casa::ROArrayColumn<casa::Double> roTileBeamDir_p; casa::ArrayColumn<casa::Double> rwTileBeamDir_p; //# Access to Measure columns casa::ROScalarMeasColumn<casa::MDirection> roTileBeamDirMeas_p; casa::ScalarMeasColumn<casa::MDirection> rwTileBeamDirMeas_p; }; } //# end namespace #endif
/* $XFree86: xc/programs/Xserver/Xi/ungrdevb.h,v 3.1 1996/04/15 11:19:10 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey <dickey@clark.net> All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef UNGRDEVB_H #define UNGRDEVB_H 1 int SProcXUngrabDeviceButton( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); int ProcXUngrabDeviceButton( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); #endif /* UNGRDEVB_H */
/* Copyright 2017 Eric Aubanel * This file contains code implementing Algorithm 6.1 * using indexed min priority queue, i.e. Dijkstra's algorithm, in * Elements of Parallel Computing, by Eric Aubanel, 2016, CRC Press. * * 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/>. * * ------------------------------------------------------------------- * Sequential implementation of SSSP solver using Dijkstra's algorithm. * Assumes nonzero integer weights. * Requires index min priority queue module (indexedMinPQ.h), which can * be adapted from indexed max priority queue (as a binary heap) * in Sedgewick's Algorithms in C, 3rd edition. * Reads graph as a list of weighted edges preceeded by * two integers indicating the number of vertices and the number of edges. * Outputs list of distances to each vertex. */ #include <stdio.h> #include <stdlib.h> #include <limits.h> #include "indexedMinPQ.h" //read edge list from stdin and store CSR representation of graph //in arrays V, E, and W. void readGraph(int *V, int *E, int *W, int n, int m); int main(int argc, char **argv){ int n, m; //number of vertices and edges int *V, *E, *W; //Offset , edge, and weight arrays for CSR representation int s; //source vertex int *D; //distance array if(argc < 2){ fprintf(stderr,"usage: %s source_vertex\n", argv[0]); return 1; } s = strtol(argv[1], NULL, 10); scanf("%d %d",&n, &m); if(s >= n || s < 0){ printf("invalid source vertex\n"); return 1; } V = malloc((n+1)*sizeof(int)); E = malloc(m*sizeof(int)); W = malloc(m*sizeof(int)); D = malloc(n*sizeof(int)); if(!V || !E || !W || !D){ fprintf(stderr,"couldn't allocate memory\n"); return 1; } readGraph(V, E, W, n, m); for(int i=0; i <n; i++) D[i] = INT_MAX; //initialize heap based on distance array of length n //heap has max size n (third argument) minHeapInit(D, n, n); D[s] = 0; //insert source vertex in heap minHeapInsert(s); while(!minHeapEmpty()){ //extract min element from heap int i = heapExtractMin(); for(int k=V[i]; k<V[i+1]; k++){ int j = E[k]; if(D[j] > D[i]+W[k]){ D[j] = D[i] + W[k]; if(isInHeap(j)){ //update distance for vertex j and re-heapify minHeapChange(j); } else{ //insert vertex j in heap minHeapInsert(j); } } } } for(int i=0;i<n;i++) printf("%d ",D[i]); printf("\n"); } void readGraph(int *V, int *E, int *W, int n, int m){ for(int i=0; i<n+1; i++) V[i] = 0; //create CSV arrays from edge list sorted by first vertex int vold=-1; for(int k=0; k<m; k++){ int vi, vo, wt; if(scanf("%d %d %d", &vi, &vo, &wt)!= 3){ fprintf(stderr, "input invalid\n"); exit(1); } if(vi > n-1 || vo > n-1){ fprintf(stderr, "vertex index too large\n"); exit(1); } if(wt < 0){ fprintf(stderr, "nonzero weights only\n"); exit(1); } E[k] = vo; W[k] = wt; if(k == 0) V[vi] = 0; else if(vi != vold) V[vi] = k; vold = vi; } V[n] = m; //Find first out-edge int first = 0; for(int i = 1; i < n; i++) if(V[i] != 0){ first = i-1; break; } //vertices with no out-edges for(int i = n-1; i > first; i--) if(V[i] ==0) V[i] = V[i+1]; }
/*------------------------------------------------------------------------ * write values of dynamic field variables at the edges of the * local grid into buffer arrays and exchanged between * processes. * last update 21/09/02, T. Bohlen * * ----------------------------------------------------------------------*/ #include "fd.h" void exchange_s(float ** syy, float ** sxy, float ** bufferlef_to_rig, float ** bufferrig_to_lef, float ** buffertop_to_bot, float ** bufferbot_to_top, MPI_Request * req_send, MPI_Request * req_rec){ extern int NX, NY, POS[3], NPROCX, NPROCY, BOUNDARY, FDORDER; extern int INDEX[5]; extern const int TAG1,TAG2,TAG5,TAG6; MPI_Status status; int i, j, fdo, fdo3, n, l; fdo = FDORDER/2 + 1; fdo3 = 2*fdo; /* top - bottom */ if (POS[2]!=0) /* no boundary exchange at top of global grid */ for (i=1;i<=NX;i++){ /* storage of top of local volume into buffer */ n = 1; /*for (l=1;l<=fdo-1;l++) { buffertop_to_bot[i][n++] = sxy[l][i]; }*/ for (l=1;l<=fdo;l++) { buffertop_to_bot[i][n++] = syy[l][i]; } } if (POS[2]!=NPROCY-1) /* no boundary exchange at bottom of global grid */ for (i=1;i<=NX;i++){ /* storage of bottom of local volume into buffer */ n = 1; /*for (l=1;l<=fdo;l++) { bufferbot_to_top[i][n++] = sxy[NY-l+1][i]; }*/ for (l=1;l<=fdo-1;l++) { bufferbot_to_top[i][n++] = syy[NY-l+1][i]; } } /* send and receive values for points at inner boundaries */ /* MPI_Bsend(&buffertop_to_bot[1][1],NX*fdo3,MPI_FLOAT,INDEX[3],TAG5,MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); MPI_Recv(&buffertop_to_bot[1][1],NX*fdo3,MPI_FLOAT,INDEX[4],TAG5,MPI_COMM_WORLD,&status); MPI_Bsend(&bufferbot_to_top[1][1],NX*fdo3,MPI_FLOAT,INDEX[4],TAG6,MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); MPI_Recv(&bufferbot_to_top[1][1],NX*fdo3,MPI_FLOAT,INDEX[3],TAG6,MPI_COMM_WORLD,&status); */ /* Initiates a communication with a persistent request handle */ /*for (i=2;i<=3;i++){ MPI_Start(&req_send[i]); MPI_Wait(&req_send[i],&status); MPI_Start(&req_rec[i]); MPI_Wait(&req_rec[i],&status); }*/ /* alternative communication */ /* still blocking communication */ MPI_Sendrecv_replace(&buffertop_to_bot[1][1],NX*fdo3,MPI_FLOAT,INDEX[3],TAG5,INDEX[4],TAG5,MPI_COMM_WORLD,&status); MPI_Sendrecv_replace(&bufferbot_to_top[1][1],NX*fdo3,MPI_FLOAT,INDEX[4],TAG6,INDEX[3],TAG6,MPI_COMM_WORLD,&status); if (POS[2]!=NPROCY-1) /* no boundary exchange at bottom of global grid */ for (i=1;i<=NX;i++){ n = 1; /*for (l=1;l<=fdo-1;l++) { sxy[NY+l][i] = buffertop_to_bot[i][n++]; }*/ for (l=1;l<=fdo;l++) { syy[NY+l][i] = buffertop_to_bot[i][n++]; } } if (POS[2]!=0) /* no boundary exchange at top of global grid */ for (i=1;i<=NX;i++){ n = 1; /*for (l=1;l<=fdo;l++) { sxy[1-l][i] = bufferbot_to_top[i][n++]; }*/ for (l=1;l<=fdo-1;l++) { syy[1-l][i] = bufferbot_to_top[i][n++]; } } /* left - right */ if ((BOUNDARY) || (POS[1]!=0)) /* no boundary exchange at left edge of global grid */ for (j=1;j<=NY;j++){ /* storage of left edge of local volume into buffer */ n = 1; for (l=1;l<fdo-1;l++) { bufferlef_to_rig[j][n++] = sxy[j][l]; } } if ((BOUNDARY) || (POS[1]!=NPROCX-1)) /* no boundary exchange at right edge of global grid */ for (j=1;j<=NY;j++){ /* storage of right edge of local volume into buffer */ n = 1; for (l=1;l<fdo;l++) { bufferrig_to_lef[j][n++] = sxy[j][NX-l+1]; } } /* send and receive values for points at inner boundaries */ /* MPI_Bsend(&bufferlef_to_rig[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[1],TAG1,MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); MPI_Recv(&bufferlef_to_rig[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[2],TAG1,MPI_COMM_WORLD,&status); MPI_Bsend(&bufferrig_to_lef[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[2],TAG2,MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); MPI_Recv(&bufferrig_to_lef[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[1],TAG2,MPI_COMM_WORLD,&status); */ /* send and reveive values at edges of the local grid */ /*for (i=0;i<=1;i++){ MPI_Start(&req_send[i]); MPI_Wait(&req_send[i],&status); MPI_Start(&req_rec[i]); MPI_Wait(&req_rec[i],&status); }*/ /* alternative communication */ /* still blocking communication */ MPI_Sendrecv_replace(&bufferlef_to_rig[1][1],NY*fdo3,MPI_FLOAT,INDEX[1],TAG1,INDEX[2],TAG1,MPI_COMM_WORLD,&status); MPI_Sendrecv_replace(&bufferrig_to_lef[1][1],NY*fdo3,MPI_FLOAT,INDEX[2],TAG2,INDEX[1],TAG2,MPI_COMM_WORLD,&status); if ((BOUNDARY) || (POS[1]!=NPROCX-1)) /* no boundary exchange at right edge of global grid */ for (j=1;j<=NY;j++){ n = 1; for (l=1;l<fdo-1;l++) { sxy[j][NX+l] = bufferlef_to_rig[j][n++]; } } if ((BOUNDARY) || (POS[1]!=0)) /* no boundary exchange at left edge of global grid */ for (j=1;j<=NY;j++){ n = 1; for (l=1;l<fdo;l++) { sxy[j][1-l] = bufferrig_to_lef[j][n++]; } } }
/* gtd-task-list-eds.h * * Copyright (C) 2015-2020 Georges Basile Stavracas Neto <georges.stavracas@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 "gtd-eds.h" G_BEGIN_DECLS #define E_SOURCE_EXTENSION_GNOME_TODO "GNOME To Do" #define E_TYPE_SOURCE_GNOME_TODO (e_source_gnome_todo_get_type()) G_DECLARE_FINAL_TYPE (ESourceGnomeTodo, e_source_gnome_todo, E, SOURCE_GNOME_TODO, ESourceExtension) guint e_source_gnome_todo_get_api_version (ESourceGnomeTodo *self); void e_source_gnome_todo_set_api_version (ESourceGnomeTodo *self, guint api_version); G_END_DECLS
/****************************************************************************/ // Hardware: Grove - I2C Color Sensor // Arduino IDE: Arduino-1.6 // // Refactored version of the library by FrankieChu - www.seeedstudio.com // /******************************************************************************/ #ifndef GROVECOLORSENSOR #define GROVECOLORSENSOR #if defined(ARDUINO) && ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif #include <Registers.h> class GroveColorSensor { public: // Color Sensor LED Status int ledStatus; // Default constructor GroveColorSensor(); // Constructor with parameters GroveColorSensor( const int& triggerMode , const int& interruptSource , const int& interruptMode , const int& gainAndPrescaler , const int& sensorAddress); void readRGB(); void readRGB(int *red, int *green, int *blue); void calculateCoordinate(); void clearInterrupt(); private: // Set trigger mode. Including free mode, manually mode, single synchronization mode or so. void setTimingReg(); // Set interrupt source void setInterruptSourceReg(); // Set interrupt mode void setInterruptControlReg(); // Set gain value and pre-scaler value void setGain(); // Start ADC of the colour sensor void setEnableADC(); // Used for storing the colour data int readingdata_[8]; int green_; int red_; int blue_; int clear_; int triggerMode_; int interruptSource_; int interruptMode_; int gainAndPrescaler_; int sensorAddress_; }; #endif
/* gmmproc5 * * Copyright (C) 2010 Krzesimir Nowak * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef PROC_API_IDENTIFIABLE_H #define PROC_API_IDENTIFIABLE_H // standard #include <string> /** Main namespace of @b gmmproc5. */ namespace Proc { /** Namespace containing API definition stuff. */ namespace Api { /** Base class for object having any sort of id. */ class Identifiable { public: /** Destructor. * * Not much to say about it. */ virtual ~Identifiable (); /** Gets an id of an object. * * Base classes should reimplement get_id_vfunc(). * * @return An id. */ std::string get_id () const; /** Sets an id of an object. * * Base classes should reimplement set_id_vfunc(). * * @param id An id to set. */ void set_id (const std::string& id); private: /** Pure virtual method getting an id. * * This method is to be implemented in derived classes. * * @return An id. * * @see Identifiable::get_id() */ virtual std::string get_id_vfunc () const = 0; /** Pure virtual method setting an id. * * This method is to be implemented in derived classes. * * @param id An id to set. * * @see Identifiable::set_id() */ virtual void set_id_vfunc (const std::string& id) = 0; }; /** Checks if both @a lhs and @a rhs has equal ids. * * @param lhs First Identifiable to compare. * @param rhs Second Identifiable to compare. * * @return @c true if ids are equal, otherwise @c false. * * @relates Identifiable */ bool operator== (const Identifiable& lhs, const Identifiable& rhs); /** Checks if both @a lhs and @a rhs has different ids. * * @param lhs First Identifiable to compare. * @param rhs Second Identifiable to compare. * * @return @c true if ids are different, otherwise @c false. * * @relates Identifiable */ bool operator!= (const Identifiable& lhs, const Identifiable& rhs); /** Checks if @a lhs id is lexicographically lower than @a rhs id. * * @param lhs First Identifiable to compare. * @param rhs Second Identifiable to compare. * * @return @c true if is lower, otherwise @c false. * * @relates Identifiable */ bool operator< (const Identifiable& lhs, const Identifiable& rhs); /** Checks if @a lhs id is lexicographically lower or equal than @a rhs id. * * @param lhs First Identifiable to compare. * @param rhs Second Identifiable to compare. * * @return @c true if is lower or equal, otherwise @c false. * * @relates Identifiable */ bool operator<= (const Identifiable& lhs, const Identifiable& rhs); /** Checks if @a lhs id is lexicographically greater than @a rhs id. * * @param lhs First Identifiable to compare. * @param rhs Second Identifiable to compare. * * @return @c true if is greater, otherwise @c false. * * @relates Identifiable */ bool operator> (const Identifiable& lhs, const Identifiable& rhs); /** Checks if @a lhs id is lexicographically greater or equal than @a rhs id. * * @param lhs First Identifiable to compare. * @param rhs Second Identifiable to compare. * * @return @c true if is greater or equal, otherwise @c false. * * @relates Identifiable */ bool operator>= (const Identifiable& lhs, const Identifiable& rhs); } // namespace Api } // namespace Proc #endif // PROC_API_IDENTIFIABLE_H
// // Renderable.h // Sonja // // Created by Mikael Grön on 2014-12-07. // Copyright (c) 2014 Mikael Grön. All rights reserved. // #ifndef __Sonja__Renderable__ #define __Sonja__Renderable__ #include <SDL2/SDL.h> class Renderable { public: virtual ~Renderable() = 0; virtual void renderAt(SDL_Renderer *renderer, int x, int y, SDL_RendererFlip flip) = 0; }; #endif /* defined(__Sonja__Renderable__) */
// Copyright (C) 2015 Pierre-Olivier Latour <info@pol-online.net> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #import "GIAppKit.h" @class GIWindowController, GIViewController, GCLiveRepository, GCSnapshot; @interface GIView : NSView @property(nonatomic, readonly) GIViewController* viewController; @end @interface GIViewController : NSViewController <NSTextFieldDelegate, NSTextViewDelegate, NSTableViewDelegate> @property(nonatomic, readonly) GCLiveRepository* repository; @property(strong) GIView* view; @property(nonatomic, readonly, getter=isViewVisible) BOOL viewVisible; @property(nonatomic, readonly, getter=isLiveResizing) BOOL liveResizing; @property(nonatomic, readonly) GIWindowController* windowController; - (instancetype)initWithRepository:(GCLiveRepository*)repository; - (void)presentAlert:(NSAlert*)alert completionHandler:(void (^)(NSModalResponse returnCode))handler; @end @interface GIViewController (Extensions) - (void)presentAlertWithType:(GIAlertType)type title:(NSString*)title message:(NSString*)format, ... NS_FORMAT_FUNCTION(3, 4); - (void)confirmUserActionWithAlertType:(GIAlertType)type title:(NSString*)title message:(NSString*)message button:(NSString*)button suppressionUserDefaultKey:(NSString*)key // May be nil block:(dispatch_block_t)block; @end @interface GIViewController (Subclassing) @property(nonatomic, readonly) NSView* preferredFirstResponder; // Default implementation returns first subview that accepts first responder status - (void)viewWillShow; // Default implementation does nothing - (void)viewDidShow; // Default implementation does nothing - (void)viewWillHide; // Default implementation does nothing - (void)viewDidHide; // Default implementation does nothing - (void)viewDidResize; // Default implementation does nothing - (void)viewWillBeginLiveResize; // Default implementation does nothing - (void)viewDidFinishLiveResize; // Default implementation does nothing - (void)repositoryDidChange; // Default implementation does nothing - (void)repositoryWorkingDirectoryDidChange; // Default implementation does nothing - (void)repositoryStateDidUpdate; // Default implementation does nothing - (void)repositoryHistoryDidUpdate; // Default implementation does nothing - (void)repositoryStashesDidUpdate; // Default implementation does nothing - (void)repositoryStatusDidUpdate; // Default implementation does nothing - (void)repositorySnapshotsDidUpdate; // Default implementation does nothing @end
// // WaxFile.h // WaxHelper // // Created by wbitos on 16/8/30. // Copyright © 2016年 wbitos. All rights reserved. // #import <Foundation/Foundation.h> #import "WaxClass.h" @interface WaxFile : NSObject @property (nonatomic, strong, readonly) WaxClass *waxClass; @property (nonatomic, strong, readonly) NSArray *requires; @property (nonatomic, strong, readonly) NSArray *keywordCompletionItems; @property (nonatomic, strong, readonly) NSArray *methodCompletionItems; - (instancetype)initWithContent:(NSString *)content; @end
// // File: SkinManager.h // =================== // Skin management. // #ifndef IDENTI3D_SRC_RENDERER_SKINMANAGER_H #define IDENTI3D_SRC_RENDERER_SKINMANAGER_H #include <src/identi3d/General.h> #include <src/renderer/Basetypes.h> #include <src/utils/DebugFrame.h> #include "Skin.h" namespace Identi3D { class SkinManager : public DebugFrame { private: SkinDataList _skins; MaterialDataList _materials; static unsigned _skin_list_limit; static unsigned _material_list_limit; public: SkinManager(void); ~SkinManager(void); /* * Create and return a handle to material. */ Material *createMaterial(const Color &diffuse, const Color &ambient, const Color &specular, const Color &emissive, float specular_power, float alpha = 1.0f); /* * Create a skin from the material. */ Skin *createSkin(const Material &mat); /* * Create a skin from specified parameters. */ Skin *createSkin(const Color &diffuse, const Color &ambient, const Color &specular, const Color &emissive, float specular_power, float alpha = 1.0f); /* * Release material's actual memory. */ void releaseMaterial(Material &mat); /* * Release skin's actual memory. */ void releaseSkin(Skin &s); /* * Release useless resources. */ void compress(void); /* * Reset list limitation. */ void reset(void); }; } #endif // IDENTI3D_SRC_RENDERER_SKINMANAGER_H
#pragma once #include <cstdint> #include <functional> #include <memory> #include <vector> #include "storm/storage/dd/Bdd.h" #include "storm/storage/dd/DdType.h" #include "storm/abstraction/LocalExpressionInformation.h" #include "storm/solver/SmtSolver.h" namespace storm { namespace utility { namespace solver { class SmtSolverFactory; } } // namespace utility namespace abstraction { template<storm::dd::DdType DdType> class AbstractionInformation; template<storm::dd::DdType DdType> class ValidBlockAbstractor { public: ValidBlockAbstractor(AbstractionInformation<DdType>& abstractionInformation, std::shared_ptr<storm::utility::solver::SmtSolverFactory> const& smtSolverFactory); storm::dd::Bdd<DdType> const& getValidBlocks(); void refine(std::vector<uint64_t> const& predicates); void constrain(storm::expressions::Expression const& constraint); private: /*! * Checks which parts of the valid blocks need to be recomputed. */ void recomputeValidBlocks(); /*! * Recomputed the valid blocks for the given predicate block. */ void recomputeValidBlocksForPredicateBlock(uint64_t blockIndex); /*! * Retrieves the abstraction information object. */ AbstractionInformation<DdType> const& getAbstractionInformation() const; /*! * Translates the given model to a source state DD. * * @param model The model to translate. * @param blockIndex The index of the block. * @return The source state encoded as a DD. */ storm::dd::Bdd<DdType> getSourceStateBdd(storm::solver::SmtSolver::ModelReference const& model, uint64_t blockIndex) const; /// The object storing the information about the abstraction (like predicates etc.) std::reference_wrapper<AbstractionInformation<DdType> const> abstractionInformation; /// An object storing information about how predicates are related. LocalExpressionInformation<DdType> localExpressionInformation; /// The BDD storing all valid blocks; storm::dd::Bdd<DdType> validBlocks; /// A vector of SMT solvers that correspond to the predicate blocks in the local expression information. std::vector<std::unique_ptr<storm::solver::SmtSolver>> smtSolvers; /// A vector of relevant variables and predicates. Every inner vector corresponds to one block of the local /// expression information. std::vector<std::vector<std::pair<storm::expressions::Variable, uint64_t>>> relevantVariablesAndPredicates; /// The decision variables for each predicate block. std::vector<std::vector<storm::expressions::Variable>> decisionVariables; /// A vector of BDDs that store the valid blocks for the individual predicate blocks to be able to reuse them. std::vector<storm::dd::Bdd<DdType>> validBlocksForPredicateBlocks; /// A flag that stores whether we need to possibly recompute the valid blocks (or parts). bool checkForRecomputation; }; } // namespace abstraction } // namespace storm
/** RemoteControl is a client server solution for remote control a PC. Copyright (C) 2016 Torsten Hopf 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 <boost/thread.hpp> #include <boost/program_options.hpp> #define STDPORT 5070 #define SERVER_VERSION 1.0 namespace remote{ class MainApp { public: MainApp(); ~MainApp(); boost::program_options::options_description buildOptions(); }; }
// Project pisk // Copyright (C) 2016-2017 Dmitry Shatilov // // Original sources: // https://github.com/shatilov-diman/pisk/ // https://bitbucket.org/charivariltd/pisk/ // // Author contacts: // Dmitry Shatilov (e-mail: shatilov.diman@gmail.com; site: https://www.linkedin.com/in/shatilov) // // #pragma once #include <pisk/defines.h> #include "HttpTask.h" namespace pisk { namespace services { namespace http { class Worker { public: virtual ~Worker() {} virtual bool init_service() noexcept = 0; virtual void deinit_service() noexcept = 0; virtual bool can_push_task() const noexcept = 0; virtual void push_task(HttpTaskPtr&& task) noexcept = 0; virtual bool pop_completed_task(HttpTaskPtr& task) noexcept = 0; virtual bool perform() noexcept = 0; }; using WorkerPtr = std::unique_ptr<Worker>; } } }
#pragma once #ifdef _VECTORN_H #define // _VECTORN_H #include <math.h> #include <algorithm> template<int N> class VectorN { public: double m_data[N]; public: // Constructors VectorN(const double f = 0.0f) { for (int i = 0; i < N; ++i) { m_data[i] = f; } } VectorN(const VectorN<N> &v) { for (int i = 0; i < N; ++i) { m_data[i] = v.m_data[i]; } } // Operators VectorN<N> operator-() const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] -= m_data[i]; } return vector; } VectorN<N> operator+(const VectorN<N> &v) const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] = v.m_data[i] + m_data[i]; } return vector; } VectorN<N> operator-(const VectorN<N> &v) const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] = v.m_data[i] - m_data[i]; } return vector; } VectorN<N> operator*(const double f) const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] = m_data[i] * f; } return vector; } VectorN<N> operator/(const double f) const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] = m_data[i] / f; } return vector; } VectorN<N> operator*(const VectorN<N> &v) const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] = v.m_data[i] * m_data[i]; } return vector; } VectorN<N> operator/(const VectorN<N> &v) const { VectorN<N> vector; for (int i = 0; i < N; ++i) { vector[i] = v.m_data[i] / m_data[i]; } return vector; } const VectorN<N> &operator+=(const VectorN<N> &v) { for (int i = 0; i < N; ++i) { m_data[i] += v.m_data[i]; } return *this; } const VectorN<N> &operator-=(const VectorN<N> &v) { for (int i = 0; i < N; ++i) { m_data[i] -= v.m_data[i]; } return *this; } const VectorN<N> &operator*=(const VectorN<N> &v) { for (int i = 0; i < N; ++i) { m_data[i] *= v.m_data[i]; } return *this; } const VectorN<N> &operator/=(const VectorN<N> &v) { for (int i = 0; i < N; ++i) { m_data[i] /= v.m_data[i]; } return *this; } const VectorN<N> &operator*=(const double f) { for (int i = 0; i < N; ++i) { m_data[i] *= f; } return *this; } const VectorN<N> &operator/=(const double f) { for (int i = 0; i < N; ++i) { m_data[i] /= f; } return *this; } // Assignation const VectorN<N> &operator=(const VectorN<N> &v) { for (int i = 0; i < N; ++i) { m_data[i] = v.m_data[i]; } return *this; } const VectorN<N> &operator=(const double f) { for (int i = 0; i < N; ++i) { m_data[i] = f; } return *this; } // Usefull functions inline double total() const { double value = 0; for (int i; i < N; ++i) value += m_data[i]; return value; } inline double avg() const { return total / static_cast<double>(N); } inline boolean isZero() const { for (int i = 0; i < N; ++i) if m_data[i] != 0 return false; return true; } inline double lenght() const { return sqrtf(size()); } inline double size() const { double value = 0; for (int i = 0; i < N; ++i) { value += (m_data[i] * m_data[i]); } return value; } inline VectorN<N> normalize(void) { if (lenght() == 0) return VectorN<N>(0.); return ((*this) /= lenght()) } // dot product inline double dot(const VectorN<N> &v) const { double value = 0; for (int i = 0; i < N; ++i) { value += m_data[i] * m_data[i]; } return value; } inline double dot_clamped(const VectorN<N> &v) const { double value = dot(v); return (result > 0) ? result : 0.; } inline double dot_abs(const VectorN<N> &v) const { return fabs(dot(v)); } inline double cross(const VectorN<N> &v) const; // Functions that return the reflected direction, depending on normal VectorN<N> reflect(const VectorN<N> &normal) const { return ((*this) - 2.f*dot(normal) * ) } // Functions that return the refracted direction, depending on normal and reflective index VectorN<N> refract(const VectorN<N> &normal, double eta) const { double cos_i = dot(normal); double cos_o = sqrtf(std::max(0.f, 1.f - eta*eta*(cos_i*cos_i))); return ((eta*(*this) + (eta*fabs(cos_i) - cos_o)*(cos_i<0.f ? 1.f : -1.f)*normal)); } }; #endif _VECTORN_H
//================================================================================================= // Copyright (c) 2015, Alexander Stumpf, TU Darmstadt // 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 Simulation, Systems Optimization and Robotics // group, TU Darmstadt 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 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 VIGIR_FOOTSTEP_PLANNING_THREADING_QUEUE_H__ #define VIGIR_FOOTSTEP_PLANNING_THREADING_QUEUE_H__ #include <ros/ros.h> #include <queue> #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> namespace vigir_footstep_planning { namespace threading { template <class T> class Queue { public: Queue() : job_counter(0) { } virtual ~Queue() { } void clear() { boost::mutex::scoped_lock lock(queued_jobs_mutex); queued_jobs = typename std::queue<boost::shared_ptr<T> >(); job_counter = 0; jobs_finished_condition.notify_all(); } void queueJob(boost::shared_ptr<T>& job) { { // scope needed so mutex gets unlocked when other threads are notified boost::mutex::scoped_lock lock(queued_jobs_mutex); queued_jobs.push(job); } queued_jobs_condition.notify_one(); } void queueJobs(std::list<boost::shared_ptr<T> >& jobs) { { // scope needed so mutex gets unlocked when other threads are notified boost::mutex::scoped_lock lock(queued_jobs_mutex); for (typename std::list<boost::shared_ptr<T> >::iterator itr = jobs.begin(); itr != jobs.end(); itr++) queued_jobs.push(*itr); } queued_jobs_condition.notify_all(); } boost::shared_ptr<T>& waitAndDequeueJob() { boost::mutex::scoped_lock lock(queued_jobs_mutex); if (queued_jobs.empty()) { ROS_DEBUG("[Queue] Waiting for Job getting queued..."); queued_jobs_condition.wait(lock); } ROS_DEBUG("[Queue] Pop Job."); boost::shared_ptr<T>& front = queued_jobs.front(); queued_jobs.pop(); job_counter++; return front; } void waitAndDequeueJobs(std::vector<boost::shared_ptr<T> >& jobs, unsigned int n) { boost::mutex::scoped_lock lock(queued_jobs_mutex); if (queued_jobs.empty()) { ROS_DEBUG("[Queue] Waiting for Job getting queued..."); queued_jobs_condition.wait(lock); } ROS_DEBUG("[Queue] Pop %u Job(s).", n); n = std::min(n, static_cast<unsigned int>(queued_jobs.size())); jobs.resize(n); for (unsigned int i = 0; i < n; i++) { jobs[i] = queued_jobs.front(); queued_jobs.pop(); job_counter++; } } void justFinishedJobs(unsigned int n) { boost::mutex::scoped_lock lock(queued_jobs_mutex); if (job_counter > n) job_counter -= n; else job_counter = 0; if (queued_jobs.empty() && job_counter == 0) { ROS_DEBUG("[Queue] Notify for finished job."); jobs_finished_condition.notify_all(); } } bool hasOpenJobs() const { boost::mutex::scoped_lock lock(queued_jobs_mutex); return !queued_jobs.empty() || job_counter != 0; } void waitUntilJobsProcessed() const { boost::mutex::scoped_lock lock(queued_jobs_mutex); if (!queued_jobs.empty()) { ROS_DEBUG("[Queue] Waiting for Jobs getting finished..."); jobs_finished_condition.wait(lock); ROS_DEBUG("[Queue] Waiting for Jobs getting finished...Done!"); } } protected: std::queue<boost::shared_ptr<T> > queued_jobs; unsigned int job_counter; mutable boost::mutex queued_jobs_mutex; mutable boost::condition_variable queued_jobs_condition; mutable boost::condition_variable jobs_finished_condition; }; } } #endif
/* * Copyright (C) 2014 by Volodymyr Kachurovskyi <Volodymyr.Kachurovskyi@gmail.com> * * This file is part of Skwarka. * * Skwarka 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. * * Skwarka 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 Skwarka. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ASSERT_H #define ASSERT_H #include <crtdbg.h> #ifdef NDEBUG #define ASSERT(expr) ((void)0) #else #define ASSERT(expr) _ASSERTE(expr) #endif // NDEBUG #endif // ASSERT_H
/** * This header is generated by class-dump-z 0.1-11o. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. */ #import <Availability2.h> #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_3_2 #import "UIKit-Structs.h" #import <UIKit/UIView.h> __attribute__((visibility("hidden"))) @interface WhiteView : UIView { } // inherited: -(instancetype)init; -(void)setBackgroundColor:(id)color; @end #endif
#ifndef UTILS_H_ /* Include guard */ #define UTILS_H_ // #include <lapacke.h> #include <gsl/gsl_matrix.h> #include <gsl/gsl_vector.h> #include <gsl/gsl_blas.h> #include <gsl/gsl_rng.h> #include <gsl/gsl_statistics.h> #include <gsl/gsl_eigen.h> // operations // 2.05 sec void rr_eig(gsl_matrix *sym, gsl_vector *eval, gsl_matrix *evec, size_t NCOMP ); // 2.24 sec void dc_eig(gsl_matrix *sym, gsl_vector *eval, gsl_matrix *evec, size_t NCOMP ); // 3.4 sec void si_eig(gsl_matrix *sym, gsl_vector *eval, gsl_matrix *evec ,size_t NCOMP); // 2.06 sec void xx_eig(gsl_matrix *sym, gsl_vector *eval, gsl_matrix *evec, size_t NCOMP ); void matrix_cross_corr(gsl_matrix *C, gsl_matrix *A, gsl_matrix *B); void matrix_cross_corr_row(gsl_matrix *C, gsl_matrix *A, gsl_matrix *B); void matrix_inv(gsl_matrix *input, gsl_matrix *output); void random_vector(gsl_vector *vec, double parameter, double (* func)(const gsl_rng *, double )); void random_matrix(gsl_matrix *vec, double parameter,double (* func)(const gsl_rng *, double )); void matrix_mean(gsl_vector *mean, gsl_matrix *input); void matrix_demean(gsl_matrix *input); void matrix_cov( gsl_matrix *input, gsl_matrix *cov); double matrix_norm(gsl_matrix *input); double matrix_sum(gsl_matrix *input); void matrix_mmul(gsl_matrix *A, gsl_matrix *B, gsl_matrix *C); void matrix_apply_all(gsl_matrix *input, double (*fun)(double)); void ica_match_gt(gsl_matrix *true_a, gsl_matrix *true_s, gsl_matrix *esti_a, gsl_matrix *esti_s); double absolute(double value); // matrix print void print_matrix_corner(gsl_matrix *input); void print_vector_head(gsl_vector *input); // void matrix_pinv(gsl_matrix *input, gsl_matrix *output) #endif // FOO_H_