text
stringlengths
4
6.14k
/** ****************************************************************************** * @file stm8s_it.h * @author MCD Application Team * @version V2.1.0 * @date 18-November-2011 * @brief This file contains the headers of the interrupt handlers ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2> ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM8S_IT_H #define __STM8S_IT_H /* Includes ------------------------------------------------------------------*/ #include "stm8s.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ #ifdef _COSMIC_ void _stext(void); /* RESET startup routine */ INTERRUPT void NonHandledInterrupt(void); #endif /* _COSMIC_ */ #ifndef _RAISONANCE_ INTERRUPT void TRAP_IRQHandler(void); /* TRAP */ INTERRUPT void TLI_IRQHandler(void); /* TLI */ INTERRUPT void AWU_IRQHandler(void); /* AWU */ INTERRUPT void CLK_IRQHandler(void); /* CLOCK */ INTERRUPT void EXTI_PORTA_IRQHandler(void); /* EXTI PORTA */ INTERRUPT void EXTI_PORTB_IRQHandler(void); /* EXTI PORTB */ INTERRUPT void EXTI_PORTC_IRQHandler(void); /* EXTI PORTC */ INTERRUPT void EXTI_PORTD_IRQHandler(void); /* EXTI PORTD */ INTERRUPT void EXTI_PORTE_IRQHandler(void); /* EXTI PORTE */ #ifdef STM8S903 INTERRUPT void EXTI_PORTF_IRQHandler(void); /* EXTI PORTF */ #endif /*STM8S903*/ #if defined (STM8S208) || defined (STM8AF52Ax) INTERRUPT void CAN_RX_IRQHandler(void); /* CAN RX */ INTERRUPT void CAN_TX_IRQHandler(void); /* CAN TX/ER/SC */ #endif /* STM8S208 || STM8AF52Ax */ INTERRUPT void SPI_IRQHandler(void); /* SPI */ INTERRUPT void TIM1_CAP_COM_IRQHandler(void); /* TIM1 CAP/COM */ INTERRUPT void TIM1_UPD_OVF_TRG_BRK_IRQHandler(void); /* TIM1 UPD/OVF/TRG/BRK */ #ifdef STM8S903 INTERRUPT void TIM5_UPD_OVF_BRK_TRG_IRQHandler(void); /* TIM5 UPD/OVF/BRK/TRG */ INTERRUPT void TIM5_CAP_COM_IRQHandler(void); /* TIM5 CAP/COM */ #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8A626x*/ INTERRUPT void TIM2_UPD_OVF_BRK_IRQHandler(void); /* TIM2 UPD/OVF/BRK */ INTERRUPT void TIM2_CAP_COM_IRQHandler(void); /* TIM2 CAP/COM */ #endif /*STM8S903*/ #if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \ defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) INTERRUPT void TIM3_UPD_OVF_BRK_IRQHandler(void); /* TIM3 UPD/OVF/BRK */ INTERRUPT void TIM3_CAP_COM_IRQHandler(void); /* TIM3 CAP/COM */ #endif /*STM8S208, STM8S207 or STM8S105 or STM8AF52Ax or STM8AF62Ax or STM8A626x */ #if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \ defined(STM8S003) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8S903) INTERRUPT void UART1_TX_IRQHandler(void); /* UART1 TX */ INTERRUPT void UART1_RX_IRQHandler(void); /* UART1 RX */ #endif /*STM8S208, STM8S207, STM8S903 or STM8S103 or STM8AF52Ax or STM8AF62Ax */ INTERRUPT void I2C_IRQHandler(void); /* I2C */ #if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) INTERRUPT void UART2_RX_IRQHandler(void); /* UART2 RX */ INTERRUPT void UART2_TX_IRQHandler(void); /* UART2 TX */ #endif /* STM8S105 or STM8AF626x */ #if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) INTERRUPT void UART3_RX_IRQHandler(void); /* UART3 RX */ INTERRUPT void UART3_TX_IRQHandler(void); /* UART3 TX */ #endif /*STM8S207, STM8S208, STM8AF62Ax or STM8AF52Ax */ #if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) INTERRUPT void ADC2_IRQHandler(void); /* ADC2 */ #else /*STM8S105, STM8S103 or STM8S903*/ INTERRUPT void ADC1_IRQHandler(void); /* ADC1 */ #endif /*STM8S207, STM8S208, STM8AF62Ax or STM8AF52Ax */ #ifdef STM8S903 INTERRUPT void TIM6_UPD_OVF_TRG_IRQHandler(void); /* TIM6 UPD/OVF/TRG */ #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */ INTERRUPT void TIM4_UPD_OVF_IRQHandler(void); /* TIM4 UPD/OVF */ #endif /*STM8S903*/ INTERRUPT void EEPROM_EEC_IRQHandler(void); /* EEPROM ECC CORRECTION */ #endif /* _RAISONANCE_ */ #endif /* __STM8S_IT_H */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
#include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); __visible struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = KBUILD_MODNAME, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, #endif .arch = MODULE_ARCH_INIT, }; MODULE_INFO(intree, "Y"); static const struct modversion_info ____versions[] __used __attribute__((section("__versions"))) = { { 0xb95b937f, __VMLINUX_SYMBOL_STR(module_layout) }, { 0x61b4d0e4, __VMLINUX_SYMBOL_STR(platform_driver_unregister) }, { 0x9085f0ac, __VMLINUX_SYMBOL_STR(__platform_driver_register) }, { 0x27e1a049, __VMLINUX_SYMBOL_STR(printk) }, { 0xbc477a2, __VMLINUX_SYMBOL_STR(irq_set_irq_type) }, { 0x2c8249b5, __VMLINUX_SYMBOL_STR(w1_add_master_device) }, { 0x70d53e1d, __VMLINUX_SYMBOL_STR(devm_request_threaded_irq) }, { 0xa253194d, __VMLINUX_SYMBOL_STR(devm_ioremap) }, { 0x2120eb8f, __VMLINUX_SYMBOL_STR(platform_get_resource) }, { 0xd509d1d5, __VMLINUX_SYMBOL_STR(devm_kmalloc) }, { 0xf1fceac2, __VMLINUX_SYMBOL_STR(w1_remove_master_device) }, { 0x96cc1a34, __VMLINUX_SYMBOL_STR(_mutex_unlock) }, { 0x553c36a1, __VMLINUX_SYMBOL_STR(_mutex_lock) }, { 0xf9a482f9, __VMLINUX_SYMBOL_STR(msleep) }, { 0x18be9363, __VMLINUX_SYMBOL_STR(dev_err) }, { 0x7792392e, __VMLINUX_SYMBOL_STR(wait_for_completion_timeout) }, { 0x2e5810c6, __VMLINUX_SYMBOL_STR(__aeabi_unwind_cpp_pr1) }, { 0x4c06a631, __VMLINUX_SYMBOL_STR(complete) }, { 0xb1ad28e0, __VMLINUX_SYMBOL_STR(__gnu_mcount_nc) }, }; static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends=wire"; MODULE_INFO(srcversion, "A596FBA04D2BE1F2C20B571");
#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ #define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ #include <asm/types.h> static inline unsigned int __arch_hweight32(unsigned int w) { return __sw_hweight32(w); } static inline unsigned int __arch_hweight16(unsigned int w) { return __sw_hweight16(w); } static inline unsigned int __arch_hweight8(unsigned int w) { return __sw_hweight8(w); } static inline unsigned long __arch_hweight64(__u64 w) { return __sw_hweight64(w); } #endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
/* * exynos-rng.c - Random Number Generator driver for the exynos * * Copyright (C) 2012 Samsung Electronics * Jonghwa Lee <jonghwa3.lee@smasung.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; * * 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 <linux/hw_random.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/io.h> #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/pm_runtime.h> #include <linux/err.h> #define EXYNOS_PRNG_STATUS_OFFSET 0x10 #define EXYNOS_PRNG_SEED_OFFSET 0x140 #define EXYNOS_PRNG_OUT1_OFFSET 0x160 #define SEED_SETTING_DONE BIT(1) #define PRNG_START 0x18 #define PRNG_DONE BIT(5) #define EXYNOS_AUTOSUSPEND_DELAY 100 struct exynos_rng { struct device *dev; struct hwrng rng; void __iomem *mem; struct clk *clk; }; static u32 exynos_rng_readl(struct exynos_rng *rng, u32 offset) { return __raw_readl(rng->mem + offset); } static void exynos_rng_writel(struct exynos_rng *rng, u32 val, u32 offset) { __raw_writel(val, rng->mem + offset); } static int exynos_init(struct hwrng *rng) { struct exynos_rng *exynos_rng = container_of(rng, struct exynos_rng, rng); int i; int ret = 0; pm_runtime_get_sync(exynos_rng->dev); for (i = 0 ; i < 5 ; i++) exynos_rng_writel(exynos_rng, jiffies, EXYNOS_PRNG_SEED_OFFSET + 4*i); if (!(exynos_rng_readl(exynos_rng, EXYNOS_PRNG_STATUS_OFFSET) & SEED_SETTING_DONE)) ret = -EIO; pm_runtime_put_noidle(exynos_rng->dev); return ret; } static int exynos_read(struct hwrng *rng, void *buf, size_t max, bool wait) { struct exynos_rng *exynos_rng = container_of(rng, struct exynos_rng, rng); u32 *data = buf; pm_runtime_get_sync(exynos_rng->dev); exynos_rng_writel(exynos_rng, PRNG_START, 0); while (!(exynos_rng_readl(exynos_rng, EXYNOS_PRNG_STATUS_OFFSET) & PRNG_DONE)) cpu_relax(); exynos_rng_writel(exynos_rng, PRNG_DONE, EXYNOS_PRNG_STATUS_OFFSET); *data = exynos_rng_readl(exynos_rng, EXYNOS_PRNG_OUT1_OFFSET); pm_runtime_mark_last_busy(exynos_rng->dev); pm_runtime_autosuspend(exynos_rng->dev); return 4; } static int exynos_rng_probe(struct platform_device *pdev) { struct exynos_rng *exynos_rng; struct resource *res; exynos_rng = devm_kzalloc(&pdev->dev, sizeof(struct exynos_rng), GFP_KERNEL); if (!exynos_rng) return -ENOMEM; exynos_rng->dev = &pdev->dev; exynos_rng->rng.name = "exynos"; exynos_rng->rng.init = exynos_init; exynos_rng->rng.read = exynos_read; exynos_rng->clk = devm_clk_get(&pdev->dev, "secss"); if (IS_ERR(exynos_rng->clk)) { dev_err(&pdev->dev, "Couldn't get clock.\n"); return -ENOENT; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); exynos_rng->mem = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(exynos_rng->mem)) return PTR_ERR(exynos_rng->mem); platform_set_drvdata(pdev, exynos_rng); pm_runtime_set_autosuspend_delay(&pdev->dev, EXYNOS_AUTOSUSPEND_DELAY); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_enable(&pdev->dev); return hwrng_register(&exynos_rng->rng); } static int exynos_rng_remove(struct platform_device *pdev) { struct exynos_rng *exynos_rng = platform_get_drvdata(pdev); hwrng_unregister(&exynos_rng->rng); return 0; } #ifdef CONFIG_PM static int exynos_rng_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct exynos_rng *exynos_rng = platform_get_drvdata(pdev); clk_disable_unprepare(exynos_rng->clk); return 0; } static int exynos_rng_runtime_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct exynos_rng *exynos_rng = platform_get_drvdata(pdev); return clk_prepare_enable(exynos_rng->clk); } #endif static UNIVERSAL_DEV_PM_OPS(exynos_rng_pm_ops, exynos_rng_runtime_suspend, exynos_rng_runtime_resume, NULL); static struct platform_driver exynos_rng_driver = { .driver = { .name = "exynos-rng", .owner = THIS_MODULE, .pm = &exynos_rng_pm_ops, }, .probe = exynos_rng_probe, .remove = exynos_rng_remove, }; module_platform_driver(exynos_rng_driver); MODULE_DESCRIPTION("EXYNOS 4 H/W Random Number Generator driver"); MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>"); MODULE_LICENSE("GPL");
/* Routines for UMTS FP disassembly * * $Id$ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * 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. */ #ifndef PACKET_UMTS_MAC_H #define PACKET_UMTS_MAC_H /* Target Channel Type Field (TCTF) values */ #define TCTF_CCCH_RACH_FDD 0x0 #define TCTF_DCCH_DTCH_RACH_FDD 0x1 #define TCTF_BCCH_FACH_FDD 0x0 #define TCTF_DCCH_DTCH_FACH_FDD 0x3 #define TCTF_MTCH_FACH_FDD 0x6 #define TCTF_CCCH_FACH_FDD 0x40 #define TCTF_MCCH_FACH_FDD 0x50 #define TCTF_MSCH_FACH_FDD 0x5f #define TCTF_CTCH_FACH_FDD 0x80 /* UeID Type values */ #define MAC_UEID_TYPE_URNTI 0x0 #define MAC_UEID_TYPE_CRNTI 0x1 enum mac_content_type { MAC_CONTENT_UNKNOWN, MAC_CONTENT_DCCH, MAC_CONTENT_PS_DTCH, MAC_CONTENT_CS_DTCH, MAC_CONTENT_CCCH }; /* Used for mapping id to string names*/ #define MAC_PCCH 0 #define MAC_CCCH 1 #define MAC_CTCH 2 #define MAC_DCCH 3 #define MAC_DTCH 4 #define MAC_BCCH 5 #define MAC_MCCH 6 #define MAC_MSCH 7 #define MAC_MTCH 8 #define MAC_N_A 9 #define MAX_MAC_FRAMES 64 typedef struct umts_mac_info { gboolean ctmux[MAX_MAC_FRAMES]; guint8 content[MAX_MAC_FRAMES]; guint8 lchid[MAX_MAC_FRAMES]; /*Makes displaying logical channel alot easier*/ guint8 macdflow_id[MAX_MAC_FRAMES]; /*Makes displaying logical channel alot easier*/ gboolean fake_chid[MAX_MAC_FRAMES]; /*Indicate if the child ID is faked or not*/ guint pdu_len; /*Length of MAC PDU, same for all PDUs in one FP frame*/ guint8 trchid[MAX_MAC_FRAMES]; /*Makes displaying logical channel alot easier*/ } umts_mac_info; typedef struct { guint number_of_mac_is_sdus; guint8 lchid[MAX_MAC_FRAMES]; gint sdulength[MAX_MAC_FRAMES]; } umts_mac_is_info; enum enum_mac_tsn_size { MAC_TSN_6BITS, MAC_TSN_14BITS }; gint get_mac_tsn_size(); #endif
#ifndef __LanguageServerPlugin__ #define __LanguageServerPlugin__ #include "CompileCommandsGenerator.h" #include "LSPDetector.hpp" #include "LanguageServerCluster.h" #include "LanguageServerLogView.h" #include "clTabTogglerHelper.h" #include "cl_command_event.h" #include "plugin.h" class LanguageServerPlugin : public IPlugin { LanguageServerCluster::Ptr_t m_servers; IProcess* m_process = nullptr; clTabTogglerHelper::Ptr_t m_tabToggler; LanguageServerLogView* m_logView = nullptr; protected: void OnSettings(wxCommandEvent& e); void OnRestartLSP(wxCommandEvent& e); void OnInitDone(wxCommandEvent& event); void OnEditorContextMenu(clContextMenuEvent& event); void OnMenuFindSymbol(wxCommandEvent& event); void OnMenuRenameSymbol(wxCommandEvent& event); void OnMenuFindReferences(wxCommandEvent& event); void ConfigureLSPs(const std::vector<LSPDetector::Ptr_t>& lsps); void OnLSPStopAll(clLanguageServerEvent& event); void OnLSPStartAll(clLanguageServerEvent& event); void OnLSPRestartAll(clLanguageServerEvent& event); void OnLSPStopOne(clLanguageServerEvent& event); void OnLSPStartOne(clLanguageServerEvent& event); void OnLSPRestartOne(clLanguageServerEvent& event); void OnLSPConfigure(clLanguageServerEvent& event); void OnLSPDelete(clLanguageServerEvent& event); void OnLSPShowSettingsDlg(clLanguageServerEvent& event); void OnLSPEnableServer(clLanguageServerEvent& event); void OnLSPDisableServer(clLanguageServerEvent& event); wxString GetEditorFilePath(IEditor* editor) const; void OnWorkspaceClosed(clWorkspaceEvent& event); public: LanguageServerPlugin(IManager* manager); virtual ~LanguageServerPlugin(); //-------------------------------------------- // Abstract methods //-------------------------------------------- virtual void CreateToolBar(clToolBar* toolbar); /** * @brief Add plugin menu to the "Plugins" menu item in the menu bar */ virtual void CreatePluginMenu(wxMenu* pluginsMenu); /** * @brief Unplug the plugin. Perform here any cleanup needed (e.g. unbind events, destroy allocated windows) */ virtual void UnPlug(); /** * @brief log message to the output tab */ void LogMessage(const wxString& server_name, const wxString& message, int log_leve); }; #endif // LanguageServerPlugin
#pragma once #include "stdafx.h" #include "VKHelpers.h" #include "../GCM.h" #include "../Common/surface_store.h" #include "VKFormats.h" namespace rsx { struct vk_render_target_traits { using surface_storage_type = std::unique_ptr<vk::image>; using surface_type = vk::image*; using command_list_type = vk::command_buffer*; using download_buffer_object = void*; static std::unique_ptr<vk::image> create_new_surface(u32 address, surface_color_format format, size_t width, size_t height, vk::render_device &device, vk::command_buffer *cmd, const vk::gpu_formats_support &support, const vk::memory_type_mapping &mem_mapping) { auto fmt = vk::get_compatible_surface_format(format); VkFormat requested_format = fmt.first; std::unique_ptr<vk::image> rtt; rtt.reset(new vk::image(device, mem_mapping.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, VK_IMAGE_TYPE_2D, requested_format, static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1, 1, 1, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT, 0)); change_image_layout(*cmd, rtt->value, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL, vk::get_image_subresource_range(0, 0, 1, 1, VK_IMAGE_ASPECT_COLOR_BIT)); //Clear new surface VkClearColorValue clear_color; VkImageSubresourceRange range = vk::get_image_subresource_range(0,0, 1, 1, VK_IMAGE_ASPECT_COLOR_BIT); clear_color.float32[0] = 0.f; clear_color.float32[1] = 0.f; clear_color.float32[2] = 0.f; clear_color.float32[3] = 0.f; vkCmdClearColorImage(*cmd, rtt->value, VK_IMAGE_LAYOUT_GENERAL, &clear_color, 1, &range); change_image_layout(*cmd, rtt->value, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, vk::get_image_subresource_range(0, 0, 1, 1, VK_IMAGE_ASPECT_COLOR_BIT)); rtt->native_layout = fmt.second; return rtt; } static std::unique_ptr<vk::image> create_new_surface(u32 address, surface_depth_format format, size_t width, size_t height, vk::render_device &device, vk::command_buffer *cmd, const vk::gpu_formats_support &support, const vk::memory_type_mapping &mem_mapping) { VkFormat requested_format = vk::get_compatible_depth_surface_format(support, format); VkImageSubresourceRange range = vk::get_image_subresource_range(0, 0, 1, 1, VK_IMAGE_ASPECT_DEPTH_BIT); if (requested_format != VK_FORMAT_D16_UNORM) range.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; std::unique_ptr<vk::image> ds; ds.reset(new vk::image(device, mem_mapping.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, VK_IMAGE_TYPE_2D, requested_format, static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1, 1, 1, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT|VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT, 0)); change_image_layout(*cmd, ds->value, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL, range); //Clear new surface.. VkClearDepthStencilValue clear_depth = {}; clear_depth.depth = 1.f; clear_depth.stencil = 0; vkCmdClearDepthStencilImage(*cmd, ds->value, VK_IMAGE_LAYOUT_GENERAL, &clear_depth, 1, &range); change_image_layout(*cmd, ds->value, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, range); return ds; } static void prepare_rtt_for_drawing(vk::command_buffer* pcmd, vk::image *surface) { // surface->change_layout(*pcmd, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); } static void prepare_rtt_for_sampling(vk::command_buffer* pcmd, vk::image *surface) { // surface->change_layout(*pcmd, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); } static void prepare_ds_for_drawing(vk::command_buffer* pcmd, vk::image *surface) { // surface->change_layout(*pcmd, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); } static void prepare_ds_for_sampling(vk::command_buffer* pcmd, vk::image *surface) { // surface->change_layout(*pcmd, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); } static bool rtt_has_format_width_height(const std::unique_ptr<vk::image> &rtt, surface_color_format format, size_t width, size_t height) { VkFormat fmt = vk::get_compatible_surface_format(format).first; if (rtt->info.format == fmt && rtt->info.extent.width == width && rtt->info.extent.height == height) return true; return false; } static bool ds_has_format_width_height(const std::unique_ptr<vk::image> &ds, surface_depth_format format, size_t width, size_t height) { // TODO: check format //VkFormat fmt = vk::get_compatible_depth_surface_format(format); if (//tex.get_format() == fmt && ds->info.extent.width == width && ds->info.extent.height == height) return true; return false; } static download_buffer_object issue_download_command(surface_type, surface_color_format color_format, size_t width, size_t height, ...) { return nullptr; } static download_buffer_object issue_depth_download_command(surface_type, surface_depth_format depth_format, size_t width, size_t height, ...) { return nullptr; } static download_buffer_object issue_stencil_download_command(surface_type, surface_depth_format depth_format, size_t width, size_t height, ...) { return nullptr; } gsl::span<const gsl::byte> map_downloaded_buffer(download_buffer_object, ...) { return{ (gsl::byte*)nullptr, 0 }; } static void unmap_downloaded_buffer(download_buffer_object, ...) { } static vk::image *get(const std::unique_ptr<vk::image> &tex) { return tex.get(); } }; struct vk_render_targets : public rsx::surface_store<vk_render_target_traits> { void destroy() { m_render_targets_storage.clear(); m_depth_stencil_storage.clear(); } }; }
/* * Carsten Langgaard, carstenl@mips.com * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. * * ######################################################################## * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope 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. * * ######################################################################## * * Routines for generic manipulation of the interrupts found on the MIPS * Atlas board. * */ #include <linux/compiler.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/mips-boards/atlas.h> #include <asm/mips-boards/atlasint.h> #include <asm/gdb-stub.h> static struct atlas_ictrl_regs *atlas_hw0_icregs; extern asmlinkage void mipsIRQ(void); #if 0 #define DEBUG_INT(x...) printk(x) #else #define DEBUG_INT(x...) #endif void disable_atlas_irq(unsigned int irq_nr) { atlas_hw0_icregs->intrsten = (1 << (irq_nr-ATLASINT_BASE)); iob(); } void enable_atlas_irq(unsigned int irq_nr) { atlas_hw0_icregs->intseten = (1 << (irq_nr-ATLASINT_BASE)); iob(); } static unsigned int startup_atlas_irq(unsigned int irq) { enable_atlas_irq(irq); return 0; /* never anything pending */ } #define shutdown_atlas_irq disable_atlas_irq #define mask_and_ack_atlas_irq disable_atlas_irq static void end_atlas_irq(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) enable_atlas_irq(irq); } static struct hw_interrupt_type atlas_irq_type = { .typename = "Atlas", .startup = startup_atlas_irq, .shutdown = shutdown_atlas_irq, .enable = enable_atlas_irq, .disable = disable_atlas_irq, .ack = mask_and_ack_atlas_irq, .end = end_atlas_irq, }; static inline int ls1bit32(unsigned int x) { int b = 31, s; s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s; s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s; s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s; s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s; s = 1; if (x << 1 == 0) s = 0; b -= s; return b; } void atlas_hw0_irqdispatch(struct pt_regs *regs) { unsigned long int_status; int irq; int_status = atlas_hw0_icregs->intstatus; /* if int_status == 0, then the interrupt has already been cleared */ if (unlikely(int_status == 0)) return; irq = ATLASINT_BASE + ls1bit32(int_status); DEBUG_INT("atlas_hw0_irqdispatch: irq=%d\n", irq); do_IRQ(irq, regs); } void __init arch_init_irq(void) { int i; atlas_hw0_icregs = (struct atlas_ictrl_regs *)ioremap (ATLAS_ICTRL_REGS_BASE, sizeof(struct atlas_ictrl_regs *)); /* * Mask out all interrupt by writing "1" to all bit position in * the interrupt reset reg. */ atlas_hw0_icregs->intrsten = 0xffffffff; /* Now safe to set the exception vector. */ set_except_vector(0, mipsIRQ); for (i = ATLASINT_BASE; i <= ATLASINT_END; i++) { irq_desc[i].status = IRQ_DISABLED; irq_desc[i].action = 0; irq_desc[i].depth = 1; irq_desc[i].handler = &atlas_irq_type; spin_lock_init(&irq_desc[i].lock); } }
/* * Author: MontaVista Software, Inc. <source@mvista.com> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #include <linux/init.h> #include <linux/mvl_patch.h> static __init int regpatch(void) { return mvl_register_patch(556); } module_init(regpatch);
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein * is confidential and proprietary to MediaTek Inc. and/or its licensors. * Without the prior written permission of MediaTek inc. and/or its licensors, * any reproduction, modification, use or disclosure of MediaTek Software, * and information contained herein, in whole or in part, shall be strictly prohibited. * * MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek Software") * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ /* * Copyright 2008 Extreme Engineering Solutions, Inc. * * mmap/munmap implementation derived from: * Clamav Native Windows Port : mmap win32 compatibility layer * Copyright (c) 2005-2006 Gianluigi Tiesi <sherpya@netfarm.it> * Parts by Kees Zeelenberg <kzlg@users.sourceforge.net> (LibGW32C) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this software; if not, write to the * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mingw_support.h" #include <stdio.h> #include <stdint.h> #include <string.h> #include <errno.h> #include <assert.h> #include <io.h> int fsync(int fd) { return _commit(fd); } void *mmap(void *addr, size_t len, int prot, int flags, int fd, int offset) { void *map = NULL; HANDLE handle = INVALID_HANDLE_VALUE; DWORD cfm_flags = 0, mvf_flags = 0; switch (prot) { case PROT_READ | PROT_WRITE: cfm_flags = PAGE_READWRITE; mvf_flags = FILE_MAP_ALL_ACCESS; break; case PROT_WRITE: cfm_flags = PAGE_READWRITE; mvf_flags = FILE_MAP_WRITE; break; case PROT_READ: cfm_flags = PAGE_READONLY; mvf_flags = FILE_MAP_READ; break; default: return MAP_FAILED; } handle = CreateFileMappingA((HANDLE) _get_osfhandle(fd), NULL, cfm_flags, HIDWORD(len), LODWORD(len), NULL); if (!handle) return MAP_FAILED; map = MapViewOfFile(handle, mvf_flags, HIDWORD(offset), LODWORD(offset), len); CloseHandle(handle); if (!map) return MAP_FAILED; return map; } int munmap(void *addr, size_t len) { if (!UnmapViewOfFile(addr)) return -1; return 0; } /* Reentrant string tokenizer. Generic version. Copyright (C) 1991,1996-1999,2001,2004,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. 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, 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. */ /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: char s[] = "-abc-=-def"; char *sp; x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" */ char *strtok_r(char *s, const char *delim, char **save_ptr) { char *token; if (s == NULL) s = *save_ptr; /* Scan leading delimiters. */ s += strspn(s, delim); if (*s == '\0') { *save_ptr = s; return NULL; } /* Find the end of the token. */ token = s; s = strpbrk (token, delim); if (s == NULL) { /* This token finishes the string. */ *save_ptr = memchr(token, '\0', strlen(token)); } else { /* Terminate the token and make *SAVE_PTR point past it. */ *s = '\0'; *save_ptr = s + 1; } return token; } #include "getline.c"
/* * linux/fs/sysv/balloc.c * * minix/bitmap.c * Copyright (C) 1991, 1992 Linus Torvalds * * ext/freelists.c * Copyright (C) 1992 Remy Card (card@masi.ibp.fr) * * xenix/alloc.c * Copyright (C) 1992 Doug Evans * * coh/alloc.c * Copyright (C) 1993 Pascal Haible, Bruno Haible * * sysv/balloc.c * Copyright (C) 1993 Bruno Haible * * This file contains code for allocating/freeing blocks. */ #include <linux/fs.h> #include <linux/sysv_fs.h> #include <linux/locks.h> /* We don't trust the value of sb->sv_sbd2->s_tfree = *sb->sv_free_blocks but we nevertheless keep it up to date. */ static inline u32 *get_chunk(struct super_block *sb, struct buffer_head *bh) { char *bh_data = bh->b_data; if (sb->sv_type == FSTYPE_SYSV4) return (u32*)(bh_data+4); else return (u32*)(bh_data+2); } /* NOTE NOTE NOTE: nr is a block number _as_ _stored_ _on_ _disk_ */ void sysv_free_block(struct super_block * sb, u32 nr) { struct buffer_head * bh; u32 *blocks = sb->sv_bcache; unsigned count; unsigned block = fs32_to_cpu(sb, nr); /* * This code does not work at all for AFS (it has a bitmap * free list). As AFS is supposed to be read-only no one * should call this for an AFS filesystem anyway... */ if (sb->sv_type == FSTYPE_AFS) return; if (block < sb->sv_firstdatazone || block >= sb->sv_nzones) { printk("sysv_free_block: trying to free block not in datazone\n"); return; } lock_super(sb); count = fs16_to_cpu(sb, *sb->sv_bcache_count); if (count > sb->sv_flc_size) { printk("sysv_free_block: flc_count > flc_size\n"); unlock_super(sb); return; } /* If the free list head in super-block is full, it is copied * into this block being freed, ditto if it's completely empty * (applies only on Coherent). */ if (count == sb->sv_flc_size || count == 0) { block += sb->sv_block_base; bh = getblk(sb->s_dev, block, sb->s_blocksize); if (!bh) { printk("sysv_free_block: getblk() failed\n"); unlock_super(sb); return; } memset(bh->b_data, 0, sb->s_blocksize); *(u16*)bh->b_data = cpu_to_fs16(sb, count); memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t)); mark_buffer_dirty(bh); mark_buffer_uptodate(bh, 1); brelse(bh); count = 0; } sb->sv_bcache[count++] = nr; *sb->sv_bcache_count = cpu_to_fs16(sb, count); fs32_add(sb, sb->sv_free_blocks, 1); dirty_sb(sb); unlock_super(sb); } u32 sysv_new_block(struct super_block * sb) { unsigned int block; u32 nr; struct buffer_head * bh; unsigned count; lock_super(sb); count = fs16_to_cpu(sb, *sb->sv_bcache_count); if (count == 0) /* Applies only to Coherent FS */ goto Enospc; nr = sb->sv_bcache[--count]; if (nr == 0) /* Applies only to Xenix FS, SystemV FS */ goto Enospc; block = fs32_to_cpu(sb, nr); *sb->sv_bcache_count = cpu_to_fs16(sb, count); if (block < sb->sv_firstdatazone || block >= sb->sv_nzones) { printk("sysv_new_block: new block %d is not in data zone\n", block); goto Enospc; } if (count == 0) { /* the last block continues the free list */ unsigned count; block += sb->sv_block_base; if (!(bh = bread(sb->s_dev, block, sb->s_blocksize))) { printk("sysv_new_block: cannot read free-list block\n"); /* retry this same block next time */ *sb->sv_bcache_count = cpu_to_fs16(sb, 1); goto Enospc; } count = fs16_to_cpu(sb, *(u16*)bh->b_data); if (count > sb->sv_flc_size) { printk("sysv_new_block: free-list block with >flc_size entries\n"); brelse(bh); goto Enospc; } *sb->sv_bcache_count = cpu_to_fs16(sb, count); memcpy(sb->sv_bcache, get_chunk(sb, bh), count * sizeof(sysv_zone_t)); brelse(bh); } /* Now the free list head in the superblock is valid again. */ fs32_add(sb, sb->sv_free_blocks, -1); dirty_sb(sb); unlock_super(sb); return nr; Enospc: unlock_super(sb); return 0; } unsigned long sysv_count_free_blocks(struct super_block * sb) { int sb_count; int count; struct buffer_head * bh = NULL; u32 *blocks; unsigned block; int n; /* * This code does not work at all for AFS (it has a bitmap * free list). As AFS is supposed to be read-only we just * lie and say it has no free block at all. */ if (sb->sv_type == FSTYPE_AFS) return 0; lock_super(sb); sb_count = fs32_to_cpu(sb, *sb->sv_free_blocks); if (0) goto trust_sb; /* this causes a lot of disk traffic ... */ count = 0; n = fs16_to_cpu(sb, *sb->sv_bcache_count); blocks = sb->sv_bcache; while (1) { if (n > sb->sv_flc_size) goto E2big; block = 0; while (n && (block = blocks[--n]) != 0) count++; if (block == 0) break; block = fs32_to_cpu(sb, block); if (bh) brelse(bh); if (block < sb->sv_firstdatazone || block >= sb->sv_nzones) goto Einval; block += sb->sv_block_base; bh = bread(sb->s_dev, block, sb->s_blocksize); if (!bh) goto Eio; n = fs16_to_cpu(sb, *(u16*)bh->b_data); blocks = get_chunk(sb, bh); } if (bh) brelse(bh); if (count != sb_count) goto Ecount; done: unlock_super(sb); return count; Einval: printk("sysv_count_free_blocks: new block %d is not in data zone\n", block); goto trust_sb; Eio: printk("sysv_count_free_blocks: cannot read free-list block\n"); goto trust_sb; E2big: printk("sysv_count_free_blocks: >flc_size entries in free-list block\n"); if (bh) brelse(bh); trust_sb: count = sb_count; goto done; Ecount: printk("sysv_count_free_blocks: free block count was %d, " "correcting to %d\n", sb_count, count); if (!(sb->s_flags & MS_RDONLY)) { *sb->sv_free_blocks = cpu_to_fs32(sb, count); dirty_sb(sb); } goto done; }
/******************************************************************************* * This file is part of OpenWSN, the Open Wireless Sensor Network Platform. * * Copyright (C) 2005-2010 zhangwei(TongJi University) * * OpenWSN is a 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. * * OpenWSN 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. * * For non-opensource or commercial applications, please choose commercial license. * Refer to OpenWSN site http://code.google.com/p/openwsn/ for more detail. * * For other questions, you can contact the author through email openwsn#gmail.com * or the mailing address: Dr. Wei Zhang, Dept. of Control, Dianxin Hall, TongJi * University, 4800 Caoan Road, Shanghai, China. Zip: 201804 * ******************************************************************************/ #ifndef _RTL_STDC_H_4546_ #define _RTL_STDC_H_4546_ #include "rtl_configall.h" void stdc_memset( void * mem, char ch, int len ); #endif
#ifndef VIDEOFILTER #define VIDEOFILTER #include <QAbstractVideoFilter> class VideoFilter : public QAbstractVideoFilter { Q_OBJECT Q_PROPERTY(int gaussianBlurSize READ gaussianBlurSize WRITE setGaussianBlurSize NOTIFY gaussianBlurSizeChanged) Q_PROPERTY(double gaussianBlurCoef READ gaussianBlurCoef WRITE setGaussianBlurCoef NOTIFY gaussianBlurCoefChanged) Q_PROPERTY(int cannyKernelSize READ cannyKernelSize WRITE setCannyKernelSize NOTIFY cannyKernelSizeChanged) Q_PROPERTY(double cannyThreshold READ cannyThreshold WRITE setCannyThreshold NOTIFY cannyThresholdChanged) public: QVideoFilterRunnable *createFilterRunnable() Q_DECL_OVERRIDE; int gaussianBlurSize() const; void setGaussianBlurSize(int gaussianBlurSize); double gaussianBlurCoef() const; void setGaussianBlurCoef(double gaussianBlurCoef); double cannyThreshold() const; void setCannyThreshold(double cannyThreshold); int cannyKernelSize() const; void setCannyKernelSize(int cannyKernelSize); private: int m_gaussianBlurSize; double m_gaussianBlurCoef; int m_cannyKernelSize; double m_cannyThreshold; signals: void gaussianBlurSizeChanged(); void gaussianBlurCoefChanged(); void cannyKernelSizeChanged(); void cannyThresholdChanged(); }; class FilterRunnable : public QVideoFilterRunnable { public: FilterRunnable(VideoFilter *filter); ~FilterRunnable(); QVideoFrame run(QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags) Q_DECL_OVERRIDE; private: VideoFilter *m_filter; void deleteColorComponentFromYUV(QVideoFrame *input); }; #endif // VIDEOFILTER
/* * ntfstime.h - NTFS time related functions. Originated from the Linux-NTFS project. * * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy * Copyright (c) 2010 Jean-Pierre Andre * * This program/include file 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/include file is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (in the main directory of the NTFS-3G * distribution in the file COPYING); if not, write to the Free Software * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _NTFS_NTFSTIME_H #define _NTFS_NTFSTIME_H #ifdef HAVE_TIME_H #include <time.h> #endif #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif #ifdef HAVE_GETTIMEOFDAY #include <sys/time.h> #endif #include "types.h" /* * assume "struct timespec" is not defined if st_mtime is not defined */ #if !defined(st_mtime) & !defined(__timespec_defined) /*struct timespec { time_t tv_sec; long tv_nsec; } */; #endif /* * There are four times more conversions of internal representation * to ntfs representation than any other conversion, so the most * efficient internal representation is ntfs representation * (with low endianness) */ typedef sle64 ntfs_time; #define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) /** * ntfs2timespec - Convert an NTFS time to Unix time * @ntfs_time: An NTFS time in 100ns units since 1601 * * NTFS stores times as the number of 100ns intervals since January 1st 1601 at * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. * * Return: A Unix time (number of seconds since 1970, and nanoseconds) */ static __inline__ struct timespec ntfs2timespec(ntfs_time ntfstime) { struct timespec spec; s64 cputime; cputime = sle64_to_cpu(ntfstime); spec.tv_sec = (cputime - (NTFS_TIME_OFFSET)) / 10000000; spec.tv_nsec = (cputime - (NTFS_TIME_OFFSET) - (s64)spec.tv_sec*10000000)*100; /* force zero nsec for overflowing dates */ if ((spec.tv_nsec < 0) || (spec.tv_nsec > 999999999)) spec.tv_nsec = 0; return (spec); } /** * timespec2ntfs - Convert Linux time to NTFS time * @utc_time: Linux time to convert to NTFS * * Convert the Linux time @utc_time to its corresponding NTFS time. * * Linux stores time in a long at present and measures it as the number of * 1-second intervals since 1st January 1970, 00:00:00 UTC * with a separated non-negative nanosecond value * * NTFS uses Microsoft's standard time format which is stored in a sle64 and is * measured as the number of 100 nano-second intervals since 1st January 1601, * 00:00:00 UTC. * * Return: An NTFS time (100ns units since Jan 1601) */ static __inline__ ntfs_time timespec2ntfs(struct timespec spec) { s64 units; units = (s64)spec.tv_sec * 10000000 + NTFS_TIME_OFFSET + spec.tv_nsec/100; return (cpu_to_le64(units)); } /* * Return the current time in ntfs format */ static __inline__ ntfs_time ntfs_current_time(void) { struct timespec now; #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_SYS_CLOCK_GETTIME) clock_gettime(CLOCK_REALTIME, &now); #elif defined(HAVE_GETTIMEOFDAY) struct timeval microseconds; gettimeofday(&microseconds, (struct timezone*)NULL); now.tv_sec = microseconds.tv_sec; now.tv_nsec = microseconds.tv_usec*1000; #else now.tv_sec = time((time_t*)NULL); now.tv_nsec = 0; #endif return (timespec2ntfs(now)); } #endif /* _NTFS_NTFSTIME_H */
/* * ==================================================================== * * Filename: solveTridiag.c * * Description: Solve a general tridiagonal system * * Version: 1.0 * Created: 09/29/2012 11:07:06 AM * Revision: none * Compiler: gcc * * Author: Organization: Iowa State University * * ==================================================================== */ #include "mex.h" #include <limits.h> #include <stdio.h> #include <stddef.h> #include <string.h> #define DEBUG 0 void solveMatrix(int n, double *a, double *b, double *c, double *vv, double *x){ /** * n - number of equations * a - sub-diagonal (means it is the diagonal below the main diagonal) -- indexed from 1..n-1 * b - the main diagonal * c - sup-diagonal (means it is the diagonal above the main diagonal) -- indexed from 0..n-2 * v - right part * x - the answer */ int i; double *v=vv; #if 0 v=calloc(n,sizeof(double)); memcpy(v,vv,n*sizeof(double)); #endif for (i = 1; i < n; i++){ double m = a[i]/b[i-1]; b[i] = b[i] - m * c[i - 1]; v[i] = v[i] - m*v[i-1]; } x[n-1] = v[n-1]/b[n-1]; for (i = n - 2; i >= 0; --i) x[i] = (v[i] - c[i] * x[i+1]) / b[i]; #if 0 free(v); #endif } int forward(int n, double *a, double *b, double *c, double *v, double *x){ int i; v[0]=b[0]*x[0]+c[0]*x[1]; for(i=1; i<n-1; i++) v[i]=a[i]*x[i-1]+b[i]*x[i]+c[i]*x[i+1]; v[n-1]=a[n-1]*x[n-2]+b[n-1]*x[n-1]; } /* The gateway function */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double *a, *b, *c, *v, *outpr; /* check for proper number of arguments */ if(nrhs!=5) { mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nrhs","Two inputs required."); } if(nlhs!=1) { mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nlhs","One output required."); } a=mxGetPr(prhs[0]); b=mxGetPr(prhs[1]); size_t N=mxGetNumberOfElements(prhs[1]); c=mxGetPr(prhs[2]); v=mxGetPr(prhs[3]); if(N!=mxGetNumberOfElements(prhs[3])) mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nlhs","The demension doesn't match"); char *cmd=mxArrayToString(prhs[4]); plhs[0] = mxCreateDoubleMatrix(N,1,mxREAL); outpr = mxGetPr(plhs[0]); if(!strcmp(cmd,"inv")){ #if DEBUG printf("solve the inverse problem\n"); #endif solveMatrix(N,a,b,c,v,outpr); }else forward(N,a,b,c,outpr,v); return; }
/* * Copyright (c) 1998, 1999 The University of Utah and * the Computer Systems Laboratory at the University of Utah (CSL). * * This file is part of Flick, the Flexible IDL Compiler Kit. * * Flick 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. * * Flick 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 Flick; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place #330, Boston, MA 02111, USA. */ #include <mom/compiler.h> #include <mom/c/libcast.h> void cast_w_template_param(cast_template_param *tp) { unsigned int i; switch(tp->u.kind) { case CAST_TEMP_PARAM_TYPE: cast_w_type(cast_new_scoped_name(tp->name, NULL), tp->u.cast_template_param_u_u.type_param, 0); break; case CAST_TEMP_PARAM_CLASS: w_printf("class %s", tp->name); break; case CAST_TEMP_PARAM_TYPENAME: w_printf("typename %s", tp->name); break; case CAST_TEMP_PARAM_TEMPLATE: w_printf("template <"); for (i = 0; i < tp->u.cast_template_param_u_u.params.params_len; i++) { if (i > 0) w_printf(", "); cast_w_template_param(tp->u.cast_template_param_u_u. params.params_val[i]); } w_printf("> class %s", tp->name); break; } if (tp->default_value) { w_printf(" = "); cast_w_template_arg(tp->default_value, 0); } } /* End of file. */
/* Child, Internet Relay Chat Services Copyright (C) 2005-2020 David Lebrun (target0@geeknode.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "string_utils.h" #include "child.h" #include <ctype.h> #include <regex.h> #include <stdlib.h> #include <string.h> int IsCharInString(char chr, char *string) { for (; *string; string++) { if (chr == *string) return 1; } return 0; } char *SeperateWord(char *sentence) { if (sentence == NULL) return NULL; while (*sentence != ' ' && *sentence != '\0' && *sentence != '\n') sentence++; if (*sentence == '\0' || *sentence == '\n') { *sentence = '\0'; return (NULL); } if (*sentence == ' ') { *sentence = '\0'; sentence++; } return (StripBlanks(sentence)); } char *StripBlanks(char *paddedstring) { if (paddedstring == NULL) return NULL; while (*paddedstring == ' ' || *paddedstring == '\t') paddedstring++; return paddedstring; } int Strcmp(const char *s1, const char *s2) { if (s1 && s2 && *s1 != '\0' && *s2 != '\0') return strcasecmp(s1,s2); else return 1; } char *strtosql (char *dst, char *src, int len) { int i,j; for (i=0,j=0;i<len;i++,j++) { if (src[i] == '\\' || src[i] == '\'' || src[i] == '"') dst[j++] = '\\'; dst[j] = src[i]; if (dst[j] == '\0') break; } return dst; } int __match_regex (const char *reg, const char *str, int param) { int status; regex_t re; if (regcomp(&re,reg,param) != 0) return 0; status = regexec(&re,str,0,NULL,0); regfree(&re); if (status != 0) return 0; return 1; } char *parse_range (char *dst, char *range) { unsigned int i; int j=0,k; for (i=0;i<strlen(range);i++) { if (i == 0) { if (range[i] == '-') dst[j++] = '-'; else if (range[i+1] != '-') dst[j++] = range[i]; } if (i > 0) { if (range[i] != '-' && (range[i-1] != '-' || i-1 == 0) && range[i+1] != '-') dst[j++] = range[i]; if (range[i] != '-' && range[i-1] == '-' && range[i+1] == '-' && i-1 != 0) return NULL; if (range[i] != '-' && range[i-1] == '-' && i-1 != 0) continue; } if (range[i] != '-' && range[i+1] == '-') { if (range[i+2] == '-') return NULL; if (range[i+2] < range[i]) return NULL; for (k = range[i]; k <= range[i+2]; k++) dst[j++] = k; } } dst[j] = '\0'; return dst; } char *gen_rand_string (char *dst, char *range, int size) { char text[256]; int i; bzero(text,256); parse_range(text,range); for (i=0;i<size;i++) dst[i] = text[random() % (strlen(text))]; dst[i] = '\0'; return dst; } void ToLower (char *dst, const char *buf, unsigned int size) { unsigned int i; if (!dst || !buf) return; for (i=0;i<strlen(buf) && i < size;i++) dst[i] = tolower(buf[i]); }
/////////////////////////////////////////////////////////////////////////////// // // wxFormBuilder - A Visual Dialog Editor for wxWidgets. // Copyright (C) 2005 José Antonio Hurtado // // 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. // // Written by // José Antonio Hurtado - joseantonio.hurtado@gmail.com // Juan Antonio Ortega - jortegalalmolda@gmail.com // /////////////////////////////////////////////////////////////////////////////// #ifndef __OBJECT_TREE__ #define __OBJECT_TREE__ #include "../../utils/wxfbdefs.h" #include "../customkeys.h" #include <wx/treectrl.h> class wxFBEvent; class wxFBPropertyEvent; class wxFBObjectEvent; class ObjectTree : public wxPanel { private: typedef std::map< PObjectBase, wxTreeItemId> ObjectItemMap; typedef std::map<wxString, int> IconIndexMap; ObjectItemMap m_map; wxImageList *m_iconList; IconIndexMap m_iconIdx; wxTreeCtrl* m_tcObjects; wxTreeItemId m_draggedItem; bool m_altKeyIsDown; /** * Crea el arbol completamente. */ void RebuildTree(); void AddChildren(PObjectBase child, wxTreeItemId &parent, bool is_root = false); int GetImageIndex (wxString type); void UpdateItem(wxTreeItemId id, PObjectBase obj); void RestoreItemStatus(PObjectBase obj); void AddItem(PObjectBase item, PObjectBase parent); void RemoveItem(PObjectBase item); void ClearMap(PObjectBase obj); PObjectBase GetObjectFromTreeItem( wxTreeItemId item ); DECLARE_EVENT_TABLE() public: ObjectTree(wxWindow *parent, int id); ~ObjectTree() override; void Create(); void OnSelChanged(wxTreeEvent &event); void OnRightClick(wxTreeEvent &event); void OnBeginDrag(wxTreeEvent &event); void OnEndDrag(wxTreeEvent &event); void OnExpansionChange(wxTreeEvent &event); void OnProjectLoaded ( wxFBEvent &event ); void OnProjectSaved ( wxFBEvent &event ); void OnObjectExpanded( wxFBObjectEvent& event ); void OnObjectSelected( wxFBObjectEvent &event ); void OnObjectCreated ( wxFBObjectEvent &event ); void OnObjectRemoved ( wxFBObjectEvent &event ); void OnPropertyModified ( wxFBPropertyEvent &event ); void OnProjectRefresh ( wxFBEvent &event); void OnKeyDown ( wxTreeEvent &event); void AddCustomKeysHandler(CustomKeysEvtHandler *h) { m_tcObjects->PushEventHandler(h); }; }; /** * Gracias a que podemos asociar un objeto a cada item, esta clase nos va * a facilitar obtener el objeto (ObjectBase) asociado a un item para * seleccionarlo pinchando en el item. */ class ObjectTreeItemData : public wxTreeItemData { private: PObjectBase m_object; public: ObjectTreeItemData(PObjectBase obj); PObjectBase GetObject() { return m_object; } }; /** * Menu popup asociado a cada item del arbol. * * Este objeto ejecuta los comandos incluidos en el menu referentes al objeto * seleccionado. */ class ItemPopupMenu : public wxMenu { private: PObjectBase m_object; DECLARE_EVENT_TABLE() public: void OnUpdateEvent(wxUpdateUIEvent& e); ItemPopupMenu(PObjectBase obj); void OnMenuEvent (wxCommandEvent & event); }; #endif //__OBJECT_TREE__
#include"pluto.h" /* *********************************************************************** */ void HLL_Speed (double **vL, double **vR, double *a2L, double *a2R, double *hL, double *hR, double *SL, double *SR, int beg, int end) /* * * * NAME * * HLL_SPEED * * * PURPOSE * * Compute leftmost (SL) and rightmost (SR) speed for the Riemann fan * * * ARGUMENTS * * vL (IN) 1-D array of left-edge primitive values at i+1/2 * vR (IN) 1-D array of right-edge primitive values at i+1/2 * SL (OUT) Array of left speeds * SR (OUT) Array of left speeds * beg(IN) initial grid index * end(IN) final grid index * * * LAST_MODIFIED * * June 25, 2012 by Andrea Mignone (mignone@ph.unito.it) * * ************************************************************************** */ { int i, err; static real *sl_min, *sl_max; static real *sr_min, *sr_max; if (sl_min == NULL){ sl_min = ARRAY_1D(NMAX_POINT, double); sl_max = ARRAY_1D(NMAX_POINT, double); sr_min = ARRAY_1D(NMAX_POINT, double); sr_max = ARRAY_1D(NMAX_POINT, double); } /* ---------------------------------------------- DAVIS Estimate ---------------------------------------------- */ MaxSignalSpeed (vL, a2L, hL, sl_min, sl_max, beg, end); MaxSignalSpeed (vR, a2R, hR, sr_min, sr_max, beg, end); /* err = MAX_CH_SPEED (vL, sl_min, sl_max, beg, end); if (err != 0) return err; err = MAX_CH_SPEED (vR, sr_min, sr_max, beg, end); if (err != 0) return err; */ for (i = beg; i <= end; i++) { SL[i] = MIN(sl_min[i], sr_min[i]); SR[i] = MAX(sl_max[i], sr_max[i]); } /* return 0; */ }
/* * Generic push-switch framework * * Copyright (C) 2006 Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #include <linux/init.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <asm/push-switch.h> #define DRV_NAME "push-switch" #define DRV_VERSION "0.1.1" static ssize_t switch_show(struct device *dev, struct device_attribute *attr, char *buf) { struct push_switch_platform_info *psw_info = dev->platform_data; return sprintf(buf, "%s\n", psw_info->name); } static DEVICE_ATTR(switch, S_IRUGO, switch_show, NULL); static void switch_timer(unsigned long data) { struct push_switch *psw = (struct push_switch *)data; schedule_work(&psw->work); } static void switch_work_handler(struct work_struct *work) { struct push_switch *psw = container_of(work, struct push_switch, work); struct platform_device *pdev = psw->pdev; psw->state = 0; kobject_uevent(&pdev->dev.kobj, KOBJ_CHANGE); } static int switch_drv_probe(struct platform_device *pdev) { struct push_switch_platform_info *psw_info; struct push_switch *psw; int ret, irq; psw = kzalloc(sizeof(struct push_switch), GFP_KERNEL); if (unlikely(!psw)) return -ENOMEM; irq = platform_get_irq(pdev, 0); if (unlikely(irq < 0)) { ret = -ENODEV; goto err; } psw_info = pdev->dev.platform_data; BUG_ON(!psw_info); ret = request_irq(irq, psw_info->irq_handler, psw_info->irq_flags, psw_info->name ? psw_info->name : DRV_NAME, pdev); if (unlikely(ret < 0)) goto err; if (psw_info->name) { ret = device_create_file(&pdev->dev, &dev_attr_switch); if (unlikely(ret)) { dev_err(&pdev->dev, "Failed creating device attrs\n"); ret = -EINVAL; goto err_irq; } } INIT_WORK(&psw->work, switch_work_handler); init_timer(&psw->debounce); psw->debounce.function = switch_timer; psw->debounce.data = (unsigned long)psw; /* Workqueue API brain-damage */ psw->pdev = pdev; platform_set_drvdata(pdev, psw); return 0; err_irq: free_irq(irq, pdev); err: kfree(psw); return ret; } static int switch_drv_remove(struct platform_device *pdev) { struct push_switch *psw = platform_get_drvdata(pdev); struct push_switch_platform_info *psw_info = pdev->dev.platform_data; int irq = platform_get_irq(pdev, 0); if (psw_info->name) device_remove_file(&pdev->dev, &dev_attr_switch); platform_set_drvdata(pdev, NULL); flush_work_sync(&psw->work); del_timer_sync(&psw->debounce); free_irq(irq, pdev); kfree(psw); return 0; } static struct platform_driver switch_driver = { .probe = switch_drv_probe, .remove = switch_drv_remove, .driver = { .name = DRV_NAME, }, }; static int __init switch_init(void) { printk(KERN_NOTICE DRV_NAME ": version %s loaded\n", DRV_VERSION); return platform_driver_register(&switch_driver); } static void __exit switch_exit(void) { platform_driver_unregister(&switch_driver); } module_init(switch_init); module_exit(switch_exit); MODULE_VERSION(DRV_VERSION); MODULE_AUTHOR("Paul Mundt"); MODULE_LICENSE("GPL v2");
#ifndef TEXTURE_DESCRIPTOR_H_INCLUDED #define TEXTURE_DESCRIPTOR_H_INCLUDED #include "image.h" #include "util.h" struct TextureDescriptor { Image image; float minU, maxU, minV, maxV; TextureDescriptor(Image image = Image()) : image(image), minU(0), maxU(1), minV(0), maxV(1) { } TextureDescriptor(Image image, float minU, float maxU, float minV, float maxV) : image(image), minU(minU), maxU(maxU), minV(minV), maxV(maxV) { } operator bool() const { return (bool)image; } bool operator !() const { return !image; } TextureDescriptor subTexture(const float minU, const float maxU, const float minV, const float maxV) const { return TextureDescriptor(image, interpolate(minU, this->minU, this->maxU), interpolate(maxU, this->minU, this->maxU), interpolate(minV, this->minV, this->maxV), interpolate(maxV, this->minV, this->maxV)); } }; #endif // TEXTURE_DESCRIPTOR_H_INCLUDED
/***************************************************************************** * old.c : Old playlist format import/export ***************************************************************************** * Copyright (C) 2004 the VideoLAN team * $Id$ * * Authors: Clément Stenac <zorglub@videolan.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <vlc_common.h> #include <vlc_interface.h> #include <vlc_playlist.h> #include <vlc_input.h> #include <vlc_charset.h> #include <errno.h> /* ENOMEM */ #define PLAYLIST_FILE_HEADER "# vlc playlist file version 0.5" /***************************************************************************** * Local prototypes *****************************************************************************/ int Export_Old ( vlc_object_t * ); /***************************************************************************** * Export_Old : main export function *****************************************************************************/ int Export_Old( vlc_object_t *p_this ) { playlist_t *p_playlist = (playlist_t*)p_this; playlist_export_t *p_export = (playlist_export_t *)p_playlist->p_private; int i; msg_Dbg(p_playlist, "saving using old format"); /* Write header */ fprintf( p_export->p_file , PLAYLIST_FILE_HEADER "\n" ); for ( i = 0 ; i < p_export->p_root->i_children ; i++ ) utf8_fprintf( p_export->p_file , "%s\n" , p_export->p_root->pp_children[i]->p_input->psz_name ); return VLC_SUCCESS; }
/* $Id: ProgressProxyImpl.h $ */ /** @file * IProgress implementation for Machine::openRemoteSession in VBoxSVC. */ /* * Copyright (C) 2006-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ #ifndef ____H_PROGRESSPROXYIMPL #define ____H_PROGRESSPROXYIMPL #include "ProgressImpl.h" #include "AutoCaller.h" /** * The ProgressProxy class allows proxying the important Progress calls and * attributes to a different IProgress object for a period of time. */ class ATL_NO_VTABLE ProgressProxy : public Progress { public: VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ProgressProxy, IProgress) DECLARE_NOT_AGGREGATABLE(ProgressProxy) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(ProgressProxy) VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress) END_COM_MAP() HRESULT FinalConstruct(); void FinalRelease(); HRESULT init( #if !defined (VBOX_COM_INPROC) VirtualBox *pParent, #endif IUnknown *pInitiator, CBSTR bstrDescription, BOOL fCancelable); HRESULT init( #if !defined (VBOX_COM_INPROC) VirtualBox *pParent, #endif IUnknown *pInitiator, CBSTR bstrDescription, BOOL fCancelable, ULONG uTotalOperationsWeight, CBSTR bstrFirstOperationDescription, ULONG uFirstOperationWeight, ULONG cOtherProgressObjectOperations); void uninit(); // IProgress properties STDMETHOD(COMGETTER(Cancelable))(BOOL *aCancelable); STDMETHOD(COMGETTER(Percent))(ULONG *aPercent); STDMETHOD(COMGETTER(TimeRemaining))(LONG *aTimeRemaining); STDMETHOD(COMGETTER(Completed))(BOOL *aCompleted); STDMETHOD(COMGETTER(Canceled))(BOOL *aCanceled); STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode); STDMETHOD(COMGETTER(ErrorInfo))(IVirtualBoxErrorInfo **aErrorInfo); //STDMETHOD(COMGETTER(OperationCount))(ULONG *aOperationCount); - not necessary STDMETHOD(COMGETTER(Operation))(ULONG *aOperation); STDMETHOD(COMGETTER(OperationDescription))(BSTR *aOperationDescription); STDMETHOD(COMGETTER(OperationPercent))(ULONG *aOperationPercent); STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout); STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout); // IProgress methods STDMETHOD(WaitForCompletion)(LONG aTimeout); STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout); STDMETHOD(Cancel)(); STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent); STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight); // public methods only for internal purposes HRESULT notifyComplete(HRESULT aResultCode); HRESULT notifyComplete(HRESULT aResultCode, const GUID &aIID, const char *pcszComponent, const char *aText, ...); bool setOtherProgressObject(IProgress *pOtherProgress); protected: void clearOtherProgressObjectInternal(bool fEarly); void copyProgressInfo(IProgress *pOtherProgress, bool fEarly); private: /** The other progress object. This can be NULL. */ ComPtr<IProgress> mptrOtherProgress; /** Set if the other progress object has multiple operations. */ bool mfMultiOperation; /** The weight the other progress object started at. */ ULONG muOtherProgressStartWeight; /** The weight of other progress object. */ ULONG muOtherProgressWeight; /** The operation number the other progress object started at. */ ULONG muOtherProgressStartOperation; }; #endif /* !____H_PROGRESSPROXYIMPL */
/* * tslib/plugins/dejitter.c * * Copyright (C) 2001 Russell King. * * This file is placed under the LGPL. Please see the file * COPYING for more details. * * $Id: dejitter.c,v 1.10 2005/02/26 01:47:23 kergoth Exp $ * * Problem: some touchscreens read the X/Y values from ADC with a * great level of noise in their lowest bits. This produces "jitter" * in touchscreen output, e.g. even if we hold the stylus still, * we get a great deal of X/Y coordinate pairs that are close enough * but not equal. Also if we try to draw a straight line in a painter * program, we'll get a line full of spikes. * * Solution: we apply a smoothing filter on the last several values * thus excluding spikes from output. If we detect a substantial change * in coordinates, we reset the backlog of pen positions, thus avoiding * smoothing coordinates that are not supposed to be smoothed. This * supposes all noise has been filtered by the lower-level filter, * e.g. by the "variance" module. */ #include <errno.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <stdio.h> #include "tslib.h" #include "tslib-filter.h" /** * This filter works as follows: we keep track of latest N samples, * and average them with certain weights. The oldest samples have the * least weight and the most recent samples have the most weight. * This helps remove the jitter and at the same time doesn't influence * responsivity because for each input sample we generate one output * sample; pen movement becomes just somehow more smooth. */ #define NR_SAMPHISTLEN 4 /* To keep things simple (avoiding division) we ensure that * SUM(weight) = power-of-two. Also we must know how to approximate * measurements when we have less than NR_SAMPHISTLEN samples. */ static const unsigned char weight [NR_SAMPHISTLEN - 1][NR_SAMPHISTLEN + 1] = { /* The last element is pow2(SUM(0..3)) */ { 5, 3, 0, 0, 3 }, /* When we have 2 samples ... */ { 8, 5, 3, 0, 4 }, /* When we have 3 samples ... */ { 6, 4, 3, 3, 4 }, /* When we have 4 samples ... */ }; struct ts_hist { int x; int y; unsigned int p; }; struct tslib_dejitter { struct tslib_module_info module; int delta; int x; int y; int down; int nr; int head; struct ts_hist hist[NR_SAMPHISTLEN]; }; static int sqr (int x) { return x * x; } static void average (struct tslib_dejitter *djt, struct ts_sample *samp) { const unsigned char *w; int sn = djt->head; int i, x = 0, y = 0; unsigned int p = 0; w = weight [djt->nr - 2]; for (i = 0; i < djt->nr; i++) { x += djt->hist [sn].x * w [i]; y += djt->hist [sn].y * w [i]; p += djt->hist [sn].p * w [i]; sn = (sn - 1) & (NR_SAMPHISTLEN - 1); } samp->x = x >> w [NR_SAMPHISTLEN]; samp->y = y >> w [NR_SAMPHISTLEN]; samp->pressure = p >> w [NR_SAMPHISTLEN]; #ifdef DEBUG fprintf(stderr,"DEJITTER----------------> %d %d %d\n", samp->x, samp->y, samp->pressure); #endif } static int dejitter_read(struct tslib_module_info *info, struct ts_sample *samp, int nr) { struct tslib_dejitter *djt = (struct tslib_dejitter *)info; struct ts_sample *s; int count = 0, ret; ret = info->next->ops->read(info->next, samp, nr); for (s = samp; ret > 0; s++, ret--) { if (s->pressure == 0) { /* * Pen was released. Reset the state and * forget all history events. */ djt->nr = 0; samp [count++] = *s; continue; } /* If the pen moves too fast, reset the backlog. */ if (djt->nr) { int prev = (djt->head - 1) & (NR_SAMPHISTLEN - 1); if (sqr (s->x - djt->hist [prev].x) + sqr (s->y - djt->hist [prev].y) > djt->delta) { #ifdef DEBUG fprintf (stderr, "DEJITTER: pen movement exceeds threshold\n"); #endif djt->nr = 0; } } djt->hist[djt->head].x = s->x; djt->hist[djt->head].y = s->y; djt->hist[djt->head].p = s->pressure; if (djt->nr < NR_SAMPHISTLEN) djt->nr++; /* We'll pass through the very first sample since * we can't average it (no history yet). */ if (djt->nr == 1) samp [count] = *s; else { average (djt, samp + count); samp [count].tv = s->tv; } count++; djt->head = (djt->head + 1) & (NR_SAMPHISTLEN - 1); } return count; } static int dejitter_fini(struct tslib_module_info *info) { free(info); return 0; } static const struct tslib_ops dejitter_ops = { .read = dejitter_read, .fini = dejitter_fini, }; static int dejitter_limit(struct tslib_module_info *inf, char *str, void *data) { struct tslib_dejitter *djt = (struct tslib_dejitter *)inf; unsigned long v; int err = errno; v = strtoul(str, NULL, 0); if (v == ULONG_MAX && errno == ERANGE) return -1; errno = err; switch ((int)data) { case 1: djt->delta = v; break; default: return -1; } return 0; } static const struct tslib_vars dejitter_vars[] = { { "delta", (void *)1, dejitter_limit }, }; #define NR_VARS (sizeof(dejitter_vars) / sizeof(dejitter_vars[0])) TSAPI struct tslib_module_info *dejitter_mod_init(struct tsdev *dev, const char *params) { struct tslib_dejitter *djt; djt = malloc(sizeof(struct tslib_dejitter)); if (djt == NULL) return NULL; memset(djt, 0, sizeof(struct tslib_dejitter)); djt->module.ops = &dejitter_ops; djt->delta = 100; djt->head = 0; if (tslib_parse_vars(&djt->module, dejitter_vars, NR_VARS, params)) { free(djt); return NULL; } djt->delta = sqr (djt->delta); return &djt->module; }
/** ****************************************************************************** * @file BSP/Inc/stm32f4xx_it.h * @author MCD Application Team * @version V1.1.1 * @date 09-October-2015 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void EXTI0_IRQHandler(void); void EXTI2_IRQHandler(void); void EXTI15_10_IRQHandler(void); void DMA2_Stream0_IRQHandler(void); void DMA2_Stream6_IRQHandler(void); void DMA2_Stream1_IRQHandler(void); void DCMI_IRQHandler(void); void QUADSPI_IRQHandler(void); #ifdef __cplusplus } #endif #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2008 The Regents of the University of California // // This file is part of Qbox // // Qbox is distributed 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. // See the file COPYING in the root directory of this distribution // or <http://www.gnu.org/licenses/>. // //////////////////////////////////////////////////////////////////////////////// // // FourierTransform.h // //////////////////////////////////////////////////////////////////////////////// #ifndef FOURIERTRANSFORM_H #define FOURIERTRANSFORM_H #include <complex> #include <vector> #if !( defined(USE_FFTW2) || defined(USE_FFTW3) || defined(USE_ESSL_FFT) || defined(FFT_NOLIB) ) #error "Must define USE_FFTW2, USE_FFTW3, USE_ESSL_FFT or FFT_NOLIB" #endif #if defined(USE_FFTW2) && defined(USE_FFTW3) #error "Cannot define USE_FFTW2 and USE_FFTW3" #endif #if USE_FFTW2 #if USE_DFFTW #include "dfftw.h" #else #include "fftw.h" #endif #endif #if USE_FFTW3 #include "fftw3.h" #if USE_FFTW3MKL #include "fftw3_mkl.h" #endif #endif #if USE_MPI #include <mpi.h> #endif #include "Timer.h" class Basis; class FourierTransform { private: MPI_Comm comm_; const Basis& basis_; int nprocs_, myproc_; int np0_,np1_,np2_; int ntrans0_,ntrans1_,ntrans2_; int nvec_; std::vector<int> np2_loc_; // np2_loc_[iproc], iproc=0, nprocs_-1 std::vector<int> np2_first_; // np2_first_[iproc], iproc=0, nprocs_-1 std::vector<std::complex<double> > zvec_; std::vector<int> scounts, sdispl, rcounts, rdispl; std::vector<std::complex<double> > sbuf, rbuf; std::vector<int> ifftp_, ifftm_; std::vector<int> ipack_, iunpack_; void init_lib(void); #if USE_ESSL_FFT #if USE_ESSL_2DFFT std::vector<double> aux1xyf,aux1zf; std::vector<double> aux1xyb,aux1zb; std::vector<double> aux2; int naux1xy,naux1z,naux2; #else std::vector<double> aux1xf, aux1yf, aux1zf; std::vector<double> aux1xb, aux1yb, aux1zb; std::vector<double> aux2; int naux1x,naux1y,naux1z,naux2; #endif #elif USE_FFTW2 fftw_plan fwplan0,fwplan1,fwplan2,bwplan0,bwplan1,bwplan2; #elif USE_FFTW3 //plans for np2_ fftw_plan fwplan, bwplan; #if defined(USE_FFTW3_2D) || defined(USE_FFTW3_THREADS) fftw_plan fwplan2d, bwplan2d; #else fftw_plan fwplanx, fwplany, bwplanx, bwplany; #endif #elif defined(FFT_NOLIB) // no library #else #error "Must define USE_FFTW2, USE_FFTW3, USE_ESSL_FFT or FFT_NOLIB" #endif void vector_to_zvec(const std::complex<double>* c); void zvec_to_vector(std::complex<double>* c); void doublevector_to_zvec(const std::complex<double>* c1, const std::complex<double> *c2); void zvec_to_doublevector(std::complex<double>* c1, std::complex<double>* c2); void fwd(std::complex<double>* val); void bwd(std::complex<double>* val); public: FourierTransform (const Basis &basis, int np0, int np1, int np2); ~FourierTransform (); MPI_Comm comm(void) const { return comm_; } // backward: Fourier synthesis, compute real-space function // forward: Fourier analysis, compute Fourier coefficients // forward transform includes scaling by 1/np012 // single transforms: c -> f, f -> c void backward (const std::complex<double>* c, std::complex<double>* f); // Note: forward transforms overwrite the array f void forward(std::complex<double>* f, std::complex<double>* c); // double transforms: c1 + i*c2 -> f, f -> c1 + i*c2 void backward (const std::complex<double>* c1, const std::complex<double>* c2, std::complex<double>* f); // Note: forward transforms overwrite the array f void forward(std::complex<double>* f, std::complex<double>* c1, std::complex<double>* c2); int np0() const { return np0_; } int np1() const { return np1_; } int np2() const { return np2_; } int np2_loc() const { return np2_loc_[myproc_]; } int np2_loc(int iproc) const { return np2_loc_[iproc]; } int np2_first() const { return np2_first_[myproc_]; } int np2_first(int iproc) const { return np2_first_[iproc]; } long int np012() const { return ((long int)np0_) * np1_ * np2_; } int np012loc(int iproc) const { return np0_ * np1_ * np2_loc_[iproc]; } int np012loc() const { return np0_ * np1_ * np2_loc_[myproc_]; } int index(int i, int j, int k) const { return i + np0_ * ( j + np1_ * k ); } int i(int ind) const { return ind % np0_; } int j(int ind) const { return (ind / np0_) % np1_; } int k(int ind) const { return (ind / np0_) / np1_ + np2_first(); } void reset_timers(void); Timer tm_f_map, tm_f_fft, tm_f_pack, tm_f_mpi, tm_f_zero, tm_f_unpack, tm_b_map, tm_b_fft, tm_b_pack, tm_b_mpi, tm_b_zero, tm_b_unpack, tm_f_xy, tm_f_z, tm_f_x, tm_f_y, tm_b_xy, tm_b_z, tm_b_x, tm_b_y, tm_init, tm_b_com, tm_f_com; }; #endif
#ifndef EVENTFILTER_H #define EVENTFILTER_H #include <QDialog> #include <QLabel> #include <QImage> #include <QEvent> class EventFilter : public QDialog { Q_OBJECT public: EventFilter(QWidget *parent = 0,Qt::WindowFlags f=0); ~EventFilter(); public slots: bool eventFilter(QObject *, QEvent *); private: QLabel *label1; QLabel *label2; QLabel *label3; QLabel *stateLabel; QImage Image1; QImage Image2; QImage Image3; }; #endif // EVENTFILTER_H
// Animation names #define BODY_ANIM_DEFAULT 0 #define BODY_ANIM_POSE 1 #define BODY_ANIM_IDLE 2 #define BODY_ANIM_IDLECOMPUTER 3 #define BODY_ANIM_FIRE 4 #define BODY_ANIM_TORECHARGING 5 #define BODY_ANIM_RECHARGING 6 #define BODY_ANIM_FROMRECHARGING 7 // Color names // Patch names // Names of collision boxes #define BODY_COLLISION_BOX_PART_NAME 0 // Attaching position names #define BODY_ATTACHMENT_ARM_RIGHT 0 #define BODY_ATTACHMENT_ARM_LEFT 1 #define BODY_ATTACHMENT_EXOTECHLARVA 2 #define BODY_ATTACHMENT_BACKARMS 3 // Sound names
/* ** Copyright 1998 - 1999 Double Precision, Inc. ** See COPYING for distribution information. */ #define MD5_INTERNAL #include "md5.h" #include "../libhmac/hmac.h" static void alloc_context( void (*func)(void *, void *), void *arg) { struct MD5_CONTEXT c; (*func)((void *)&c, arg); } static void alloc_hash( void (*func)(unsigned char *, void *), void *arg) { unsigned char c[MD5_DIGEST_SIZE]; (*func)(c, arg); } struct hmac_hashinfo hmac_md5 = { "md5", MD5_BLOCK_SIZE, MD5_DIGEST_SIZE, sizeof(struct MD5_CONTEXT), (void (*)(void *))md5_context_init, (void (*)(void *, const void *, unsigned))md5_context_hashstream, (void (*)(void *, unsigned long))md5_context_endstream, (void (*)(void *, unsigned char *))md5_context_digest, (void (*)(void *, const unsigned char *))md5_context_restore, alloc_context, alloc_hash};
/** ssheap_md5.h @copyright Copyright (c) 2002-2004 SFNT Finland Oy - all Rights Reserved. */ #ifndef SSH_EAP_MD5_H #define SSH_EAP_MD5_H 1 typedef struct SshEapMd5StateRec { /** The challenge sent */ SshUInt8* challenge_buffer; unsigned long challenge_length; /** The response received */ SshUInt8* response_buffer; unsigned long response_length; SshUInt8 response_id; } *SshEapMd5State, SshEapMd5StateStruct; typedef struct SshEapMd5ParamsRec { /** Length of challenge to create */ unsigned long challenge_length; /** Name of this instance to use in CHAP authentication */ SshUInt8* name_buffer; unsigned long name_length; } *SshEapMd5Params, SshEapMd5ParamsStruct; void* ssh_eap_md5_create(SshEapProtocol, SshEap eap, SshUInt8); void ssh_eap_md5_destroy(SshEapProtocol, SshUInt8,void*); SshEapOpStatus ssh_eap_md5_signal(SshEapProtocolSignalEnum, SshEap, SshEapProtocol, SshBuffer); #endif
#pragma once #include<Windows.h> #include<iostream> #include<string> #include<vector> #include<sstream> #include<hash_map> #include<hash_set> #include<set> #include<algorithm> #include<qimage.h> #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/contrib/contrib.hpp" using namespace std; using namespace cv; const Mat MOUSEICON = imread("../icons/1.png"); const Mat MOUSEMASK = imread("../icons/1_msk.png", 0); void trim(string& str); vector<string> split(string& str, string delim); string join(vector<string> sarray,string sep); extern void convolveDFT(Mat& A, Mat& B, Mat& C, int flag=1); extern int myMatchAlphaTemplate(Size imgSize, Size tplSize, Mat& rst, Mat& F_a2, Mat& F_a2T, double aT, Mat& F_I, Mat& F_I2, int method=0); extern int myMatchAlphaTemplate(Mat& img, Mat& tpl, Mat& msk, Mat& rst, Mat& F_a2, Mat& F_a2T, double aT, Mat& F_I, Mat& F_I2, int method=0); extern int myMatchAlphaTemplate(Mat& img, Mat& tpl, Mat& msk, Mat& rst, Mat& F_a2, Mat& F_a2T, double aT, int method=0); extern int myMatchAlphaTemplate(Mat& img, Mat& tpl, Mat& msk, Mat& rst, int method=0, int dftWidth=0, int dftHeight=0); Rect_<float> getOverlap( Rect_<float> rc1, Rect_<float> rc2 ); Rect getOverlap( Rect rc1, Rect rc2 ); void getJetColors( vector<Scalar>& colors, int sz); cv::Rect fromWindowRECT(RECT w_r); cv::Mat addImageOnFront(cv::Point pt, cv::Mat bg, cv::Mat fg, cv::Mat mask); template<typename T> T stringToNumber(const string& numberAsString) { T val; std::stringstream stream(numberAsString); stream >> val; if (stream.fail()) { std::runtime_error e(numberAsString); throw e; } return val; } template<typename T> vector<T> subvector(vector<T> v, int first, int last) { vector<T>::const_iterator first_it = v.begin() + first; vector<T>::const_iterator last_it = v.begin() + last; vector<T> newV(first_it,last_it); return newV; } void replaceAll(string& str, string from,string to); SYSTEMTIME toSystemTime(string timestamp); SYSTEMTIME covertStringToSystime(string timestamp); //for excel log time format double GetTimeDifference( SYSTEMTIME &st1, SYSTEMTIME &st2 ); template<typename T> double calcMedianOfVector(vector<T> v) { T median; size_t size = v.size(); sort(v.begin(), v.end()); if (size % 2 == 0) { median = (v[size / 2 - 1] + v[size / 2]) / 2; } else { median = v[size / 2]; } return median; } inline extern bool im2float(Mat& img_u, Mat& img_f) { if(img_u.depth()!=CV_8U){ return false; } int type_f = CV_32FC3; //int type_u = img_u.type(); //if( type_u!=CV_8UC1 && type_u!=CV_8UC3){ // return false; //} if(img_u.channels() == 1) type_f = CV_32FC1; img_u.convertTo(img_f, type_f); img_f *= 1.0/255; return true; } inline extern bool im2double(Mat& img_u, Mat& img_lf) { if(img_u.depth()!=CV_8U){ return false; } int type_lf = CV_64FC3; if(img_u.channels() == 1) type_lf = CV_64FC1; img_u.convertTo(img_lf, type_lf); img_lf *= 1.0/255; return true; } template< class T > int vecMskErase(vector<T>& obj, vector<int> msk) { if( msk.size() > obj.size()) { return -1; } unsigned int i; int cnt=0; vector<int> msk_id(msk.size()+1); msk_id[0] = 0; for( i=0; i<msk.size(); i++ ) { msk_id[i+1] = msk[i] + msk_id[i]; if(msk[i]==0) { cnt++; obj.erase( obj.begin() + msk_id[i] ); } } return cnt; } inline QImage Mat2QImage(cv::Mat const& src) { cv::Mat temp; // make the same cv::Mat cvtColor(src, temp,CV_BGR2RGB); // cvtColor Makes a copt, that what i need QImage dest((const uchar *) temp.data, temp.cols, temp.rows, temp.step, QImage::Format_RGB888); dest.bits(); // enforce deep copy, see documentation // of QImage::QImage ( const uchar * data, int width, int height, Format format ) return dest; } inline cv::Mat QImage2Mat(QImage const& src) { cv::Mat tmp(src.height(),src.width(),CV_8UC3,(uchar*)src.bits(),src.bytesPerLine()); cv::Mat result; // deep copy just in case (my lack of knowledge with open cv) cvtColor(tmp, result,CV_BGR2RGB); return result; } inline std::wstring from_string(const std::string& s) { //std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; //std::wstring wide = converter.from_bytes(str); int len; int slength = (int)s.length() + 1; len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0); wchar_t* buf = new wchar_t[len]; MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len); std::wstring r(buf); delete[] buf; return r; //return wide; } inline std::string readAllFromStream(std::istream & stream) { std::string s; int p = stream.tellg(); // remember where we are stream.seekg(0, std::ios_base::end); // go to the end int sz = stream.tellg(); // work out the size stream.seekg(0, stream.beg); // restore the position s.resize(sz); // resize the string stream.read(&s[0], sz); // and finally, read in the data. return s; }
/* * IniFileProcessor class header file * Author: Sun Junwen * Version: 1.0.2 */ #ifndef _INI_FILE_PROCESSOR_H_ #define _INI_FILE_PROCESSOR_H_ #include "IniProcessor.h" #include "strhelper.h" class IniFileProcessor: public IniProcessor { public: /* * Constructor * Specific the ini file name */ explicit IniFileProcessor(const sunjwbase::tstring& fileName) { m_tstrFileName = fileName; } virtual void Save(); inline IniMap GetInfo(bool bSection) { return GetInfo(bSection, true); } IniProcessor::IniMap GetInfo(bool bProcSection, bool bRefresh); private: sunjwbase::tstring m_tstrFileName; }; #endif
/* { dg-require-effective-target sigsetjmp } */ #include "test-setjmp.h" #include <stddef.h> #include <stdlib.h> extern int foo (int) __attribute__ ((__pure__)); static jmp_buf env; static void inner (void) { void *ptr = malloc (1024); /* { dg-message "allocated here" } */ siglongjmp (env, 1); /* { dg-warning "leak of 'ptr'" "warning" } */ /* { dg-message "rewinding from 'siglongjmp' in 'inner'" " event: rewind from" { target *-*-* } .-1 } */ free (ptr); } void outer (void) { int i; foo (0); i = sigsetjmp(env, 0); /* { dg-message "'sigsetjmp' called here" "event: sigsetjmp call" } */ /* { dg-message "to 'sigsetjmp' in 'outer'" "event: rewind to" { target *-*-* } .-1 } */ if (i == 0) { foo (1); inner (); } foo (3); }
/* * Implementation of Utility functions for all SCSI device types. * * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs. * Copyright (c) 1997, 1998 Kenneth D. Merry. * 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, * without modification, immediately at the beginning of the file. * 2. 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 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 AUTHOR 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. * * $FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.38 2002/09/23 04:56:35 mjacob Exp $ * $Id: aiclib.c 2 2007-04-05 08:51:12Z tt $ */ #include "aiclib.h"
// Snap Websites Server -- handle various locale information such as timezone and date output, number formatting for display, etc. // Copyright (c) 2011-2019 Made to Order Software 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #pragma once // other plugins // #include "../editor/editor.h" /** \file * \brief Header of the locale plugin. * * This header file is named "snap_locale.h" and not "locale.h" because * there is a system file "locale.h" and having the same name prevents * the system file from being included properly. * * The file defines the various locale plugin classes. */ namespace snap { namespace locale_settings { enum class name_t { SNAP_NAME_LOCALE_SETTINGS_LOCALE, SNAP_NAME_LOCALE_SETTINGS_TIMEZONE, SNAP_NAME_LOCALE_SETTINGS_PATH }; char const * get_name(name_t name) __attribute__ ((const)); //class locale_settings_exception : public snap_exception //{ //public: // explicit locale_settings_exception(char const * what_msg) : snap_exception("locale_settings", what_msg) {} // explicit locale_settings_exception(std::string const & what_msg) : snap_exception("locale_settings", what_msg) {} // explicit locale_settings_exception(QString const & what_msg) : snap_exception("locale_settings", what_msg) {} //}; class locale_settings : public plugins::plugin { public: locale_settings(); locale_settings(locale_settings const & rhs) = delete; virtual ~locale_settings() override; locale_settings & operator = (locale_settings const & rhs) = delete; static locale_settings * instance(); // plugins::plugin implementation virtual QString settings_path() const override; virtual QString icon() const override; virtual QString description() const override; virtual QString help_uri() const override; virtual QString dependencies() const override; virtual int64_t do_update(int64_t last_updated) override; virtual void bootstrap(snap_child * snap) override; // filter signals void on_replace_token(content::path_info_t & ipath, QDomDocument & xml, filter::filter::token_info_t & token); void on_token_help(filter::filter::token_help_t & help); private: void content_update(int64_t variables_timestamp); snap_child * f_snap = nullptr; }; } // namespace locale_settings } // namespace snap // vim: ts=4 sw=4 et
#if !defined(_MSC_VER) #include <config.h> #else #include <config_msvc.h> #endif #if !defined(_MSC_VER) #include <config.h> #else #include <config_msvc.h> #endif #include <assert.h> #include <models/model.h> /// Models extern const AsynchModel model_252; extern const AsynchModel model_190; AsynchModel const * GetModel(unsigned short model_uid) { AsynchModel const *res = NULL; //// An array of available model definitions //AsynchModel const * models[] = { // &model_190, // &model_252 //}; ///// Number of model registered //unsigned int num_models = 0; //// Search for model //for (unsigned int i = 0; i < num_models; i++) //{ // if (models[i]->uid == model_uid) // { // res = models[i]; // break; // } //} return res; }
/* * Copyright (C) 2005-2013 Team XBMC * http://kodi.tv * * 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, 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 XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #ifndef WIN_SYSTEM_WIN32_DX_H #define WIN_SYSTEM_WIN32_DX_H #pragma once #include "easyhook/easyhook.h" #include "rendering/dx/RenderSystemDX.h" #include "windowing/windows/WinSystemWin32.h" struct D3D10DDIARG_CREATERESOURCE; class CWinSystemWin32DX : public CWinSystemWin32, public CRenderSystemDX { friend interface DX::IDeviceNotify; public: CWinSystemWin32DX(); ~CWinSystemWin32DX(); bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override; bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override; bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override; void PresentRenderImpl(bool rendered) override; bool DPIChanged(WORD dpi, RECT windowRect) const override; void SetWindow(HWND hWnd) const; bool DestroyRenderSystem() override; void UninitHooks(); void InitHooks(IDXGIOutput* pOutput); void OnMove(int x, int y) override; void OnResize(int width, int height); /*! \brief Register as a dependent of the DirectX Render System Resources should call this on construction if they're dependent on the Render System for survival. Any resources that registers will get callbacks on loss and reset of device. In addition, callbacks for destruction and creation of the device are also called, where any resources dependent on the DirectX device should be destroyed and recreated. \sa Unregister, ID3DResource */ void Register(ID3DResource *resource) const { m_deviceResources->Register(resource); }; /*! \brief Unregister as a dependent of the DirectX Render System Resources should call this on destruction if they're a dependent on the Render System \sa Register, ID3DResource */ void Unregister(ID3DResource *resource) const { m_deviceResources->Unregister(resource); }; void Register(IDispResource *resource) override { CWinSystemWin32::Register(resource); }; void Unregister(IDispResource *resource) override { CWinSystemWin32::Unregister(resource); }; void FixRefreshRateIfNecessary(const D3D10DDIARG_CREATERESOURCE* pResource) const; protected: void UpdateMonitor() const; void SetDeviceFullScreen(bool fullScreen, RESOLUTION_INFO& res) override; void ReleaseBackBuffer() override; void CreateBackBuffer() override; void ResizeDeviceBuffers() override; bool IsStereoEnabled() override; void OnScreenChange(int screen) override; bool ChangeResolution(const RESOLUTION_INFO& res, bool forceChange = false) override; HMODULE m_hDriverModule; TRACED_HOOK_HANDLE m_hHook; }; #endif // WIN_SYSTEM_WIN32_DX_H
#pragma once #include "rpCore/Player/PlayerTypes.h" #include <string> namespace rpCore { namespace Tools { using Range = std::pair<Player::TrackIndex, Player::TrackIndex>; using VectorOfRanges = std::vector<Range>; /** * Converts track index list to contain ranges of indexes. * It means that it will replace indexes which go one after another * with difference one with pair of first and last index. * Standalone indexes will be replaced with pair of itself and next index. * Last index in range is excluded. * E.g. input is { 0, 1, 2, 3, 6, 8, 9, 10, 11, 12, 13, 14, 15 }. * The output will be {{0, 4}, {6, 7}, {8, 16}}. * @param indexes the collection of indexes to compress. * @return compressed collection of ranges. */ VectorOfRanges convertIndexesToRanges(const Player::TrackIndexList &indexes); /** * Converts text to unsigned integer. * @param text the text to convert. * @return converted number or 0 as default value in case of failures. */ std::size_t convertTextToInteger(const std::string &text); /** * Converts URI string to name of file. * @param uri the string which represents URI. * @return file name of referenced URI. */ std::string convertUriToNameOfFile(const std::string &uri); } }
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * File-Roller * * Copyright (C) 2011 The 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 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <string.h> #include "file-utils.h" #include "fr-command.h" #include "gio-utils.h" #include "rar-utils.h" typedef enum { FIRST_VOLUME_IS_000, FIRST_VOLUME_IS_001, FIRST_VOLUME_IS_RAR } FirstVolumeExtension; static char * get_first_volume_name (const char *name, const char *pattern, FirstVolumeExtension extension_type) { char *volume_name = NULL; GRegex *re; re = g_regex_new (pattern, G_REGEX_CASELESS, 0, NULL); if (g_regex_match (re, name, 0, NULL)) { char **parts; int l, i; parts = g_regex_split (re, name, 0); l = strlen (parts[2]); switch (extension_type) { case FIRST_VOLUME_IS_000: for (i = 0; i < l; i++) parts[2][i] = '0'; break; case FIRST_VOLUME_IS_001: for (i = 0; i < l; i++) parts[2][i] = (i < l - 1) ? '0' : '1'; break; case FIRST_VOLUME_IS_RAR: if (g_str_has_suffix (parts[1], "r")) { parts[2][0] = 'a'; parts[2][1] = 'r'; } else { parts[2][0] = 'A'; parts[2][1] = 'R'; } break; } volume_name = g_strjoinv ("", parts); g_strfreev (parts); } g_regex_unref (re); if (volume_name != NULL) { char *tmp; tmp = volume_name; volume_name = g_filename_from_utf8 (tmp, -1, NULL, NULL, NULL); g_free (tmp); } return volume_name; } void rar_check_multi_volume (FrCommand *comm) { GFile *file; char buffer[11]; file = g_file_new_for_path (comm->filename); if (! g_load_file_in_buffer (file, buffer, 11, NULL)) { g_object_unref (file); return; } if (memcmp (buffer, "Rar!", 4) != 0) return; if ((buffer[10] & 0x01) == 0x01) { char *volume_name = NULL; char *name; name = g_filename_to_utf8 (file_name_from_path (comm->filename), -1, NULL, NULL, NULL); volume_name = get_first_volume_name (name, "^(.*\\.part)([0-9]+)(\\.rar)$", FIRST_VOLUME_IS_001); if (volume_name == NULL) volume_name = get_first_volume_name (name, "^(.*\\.r)([0-9]+)$", FIRST_VOLUME_IS_RAR); if (volume_name == NULL) volume_name = get_first_volume_name (name, "^(.*\\.)([0-9]+)$", FIRST_VOLUME_IS_001); if (volume_name != NULL) { GFile *parent; GFile *volume_file; parent = g_file_get_parent (file); volume_file = g_file_get_child (parent, volume_name); fr_command_set_multi_volume (comm, volume_file); g_object_unref (volume_file); g_object_unref (parent); } g_free (name); } g_object_unref (file); }
#define DB_FILE "/home/kolesnik/.note.db"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ** ** Monash Cluster Computing, Australia ** (C) 2003-2004 All Rights Reserved ** ** Primary Authors: ** Robert Turnbull, MCC ** **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifndef __Underworld_Utils_StressField_h__ #define __Underworld_Utils_StressField_h__ /** Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */ extern const Type StressField_Type; /** StressField class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */ #define __StressField \ /* Macro defining parent goes here - This means you can cast this class as its parent */ \ __ParticleFeVariable \ \ /* Virtual functions go here */ \ \ /* Passed in parameters */ \ Variable_Register* variable_Register; \ FeVariable* strainRateField; \ ConstitutiveMatrix* constitutiveMatrix; \ Variable* dataVariableList[6]; \ Variable* stressVariable; struct StressField { __StressField }; /* --- Contstructors / Destructors --- */ #ifndef ZERO #define ZERO 0 #endif #define STRESSFIELD_DEFARGS \ PARTICLEFEVARIABLE_DEFARGS #define STRESSFIELD_PASSARGS \ PARTICLEFEVARIABLE_PASSARGS StressField* _StressField_New( STRESSFIELD_DEFARGS ); /** Print the contents of an StressField construct */ void* _StressField_DefaultNew( Name name ); void _StressField_Delete( void* variable ); void _StressField_Print( void* variable, Stream* stream ); void* _StressField_Copy( const void* feVariable, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ); void _StressField_AssignFromXML( void* variable, Stg_ComponentFactory* cf, void* data ); void _StressField_Init( StressField* self, FeVariable* strainRateField, ConstitutiveMatrix* constitutiveMatrix, Variable* stressVariable, Variable_Register* variable_Register, SystemLinearEquations* sle); void StressField_NonLinearUpdate( void* _sle, void* _ctx ); void _StressField_Build( void* variable, void* data ); void _StressField_Initialise( void* variable, void* data ); void _StressField_Execute( void* variable, void* data ); void _StressField_Destroy( void* variable, void* data ); void _StressField_ValueAtParticle_Recalculate( void* stressField, IntegrationPointsSwarm* swarm, Element_LocalIndex lElement_I, void* particle, double* stress ); void _StressField_ValueAtParticle_FromVariable( void* stressField, IntegrationPointsSwarm* swarm, Element_LocalIndex lElement_I, void* particle, double* stress ); #endif
// utility.c #include "utility.h" int padZero(FILE * fptr, unsigned char * whichbit, unsigned char * curbyte) { int rtv; while ((* whichbit) != 0) { rtv = writeBit(fptr, 0, whichbit, curbyte); if (rtv == -1) { return -1; } } return rtv; } // write one bit to a file // // whichbit indicates which bit this is written to // (0 means leftmost, 7 means rightmost) // // curbyte is the current byte // // if whichbit is zero, curbyte is reset and bit is put // to the leftmost bit // // when whichbit reaches 7, this byte is written to the // file and whichbit is reset // // the function returns 1 if a byte is written to the file // returns 0 if no byte is written // -1 if it tries to write and fails int writeBit(FILE * fptr, unsigned char bit, unsigned char * whichbit, unsigned char * curbyte) { if ((* whichbit) == 0) { // reset * curbyte = 0; } // shift the bit to the correct location unsigned char temp = bit << (7 - (* whichbit)); * curbyte |= temp; // store the data int value = 0; if ((* whichbit) == 7) { int ret; ret = fwrite(curbyte, sizeof(unsigned char), 1, fptr); // printByte(* curbyte); // for debugging if (ret == 1) { value = 1; } else { value = -1; } } * whichbit = ((* whichbit) + 1) % 8; return value; } int readBit(FILE * fptr, unsigned char * bit, unsigned char * whichbit, unsigned char * curbyte) { int ret = 1; if ((* whichbit) == 0) { // read a byte from the file ret = fread(curbyte, sizeof(unsigned char), 1, fptr); } if (ret != 1) { // read fail return -1; } // shift the bit to the correct location unsigned char temp = (* curbyte) >> (7 - (* whichbit)); temp = temp & 0X01; // get only 1 bit, ignore the others // increase by 1 * whichbit = ((* whichbit) + 1) % 8; * bit = temp; return 1; }
/* | author: Christian Balles | email: code@ballessay.de | date: 2009/11/28 | version: 0.1 | copyright 2009 Christian Balles | | This file is part of qspeedreader. | qspeedreader 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. | qspeedreader 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 | qspeedreader. If not, see http://www.gnu.org/licenses/. */ #ifndef COLORDIALOG_H #define COLORDIALOG_H #include <QDialog> namespace Ui { class CColorDialog; } class CColorDialog : public QDialog { Q_OBJECT public: CColorDialog( const QColor& _foreground, const QColor& _background, QWidget* _pParent = 0); ~CColorDialog(); QColor foreground() const { return m_foreground;} QColor background() const { return m_background;} signals: void backgroundChanged(const QColor& _color); void foregroundChanged(const QColor& _color); protected slots: void on_pForegroundButton_clicked(); void on_pBackgroundButton_clicked(); protected: void changeEvent(QEvent* _pEvent); private: Ui::CColorDialog* m_pUi; QColor m_foreground; QColor m_background; }; #endif // COLORDIALOG_H
#ifndef ITEM_H #define ITEM_H #include <SDL2/SDL.h> /* *Defines an item structure and corresponding functions */ typedef struct{ char* name; int value; SDL_Surface *texture; }Item; #endif
#include <linux/init.h> #include <linux/usb.h> #include <sound/core.h> #include <sound/info.h> #include <sound/pcm.h> #include "usbaudio.h" #include "helper.h" #include "card.h" #include "proc.h" /* convert our full speed USB rate into sampling rate in Hz */ static inline unsigned get_full_speed_hz(unsigned int usb_rate) { return (usb_rate * 125 + (1 << 12)) >> 13; } /* convert our high speed USB rate into sampling rate in Hz */ static inline unsigned get_high_speed_hz(unsigned int usb_rate) { return (usb_rate * 125 + (1 << 9)) >> 10; } static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct snd_usb_audio *chip = entry->private_data; if (!chip->shutdown) snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum); } static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct snd_usb_audio *chip = entry->private_data; if (!chip->shutdown) snd_iprintf(buffer, "%04x:%04x\n", USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id)); } void snd_usb_audio_create_proc(struct snd_usb_audio *chip) { struct snd_info_entry *entry; if (!snd_card_proc_new(chip->card, "usbbus", &entry)) snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); if (!snd_card_proc_new(chip->card, "usbid", &entry)) snd_info_set_text_ops(entry, chip, proc_audio_usbid_read); } static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer) { struct list_head *p; static char *sync_types[4] = { "NONE", "ASYNC", "ADAPTIVE", "SYNC" }; list_for_each(p, &subs->fmt_list) { struct audioformat *fp; snd_pcm_format_t fmt; fp = list_entry(p, struct audioformat, list); snd_iprintf(buffer, " Interface %d\n", fp->iface); snd_iprintf(buffer, " Altset %d\n", fp->altsetting); snd_iprintf(buffer, " Format:"); for (fmt = 0; fmt <= SNDRV_PCM_FORMAT_LAST; ++fmt) if (fp->formats & (1uLL << fmt)) snd_iprintf(buffer, " %s", snd_pcm_format_name(fmt)); snd_iprintf(buffer, "\n"); snd_iprintf(buffer, " Channels: %d\n", fp->channels); snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", fp->endpoint & USB_ENDPOINT_NUMBER_MASK, fp->endpoint & USB_DIR_IN ? "IN" : "OUT", sync_types[(fp->ep_attr & USB_ENDPOINT_SYNCTYPE) >> 2]); if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) { snd_iprintf(buffer, " Rates: %d - %d (continuous)\n", fp->rate_min, fp->rate_max); } else { unsigned int i; snd_iprintf(buffer, " Rates: "); for (i = 0; i < fp->nr_rates; i++) { if (i > 0) snd_iprintf(buffer, ", "); snd_iprintf(buffer, "%d", fp->rate_table[i]); } snd_iprintf(buffer, "\n"); } if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) snd_iprintf(buffer, " Data packet interval: %d us\n", 125 * (1 << fp->datainterval)); // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); } } static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer) { if (subs->running) { unsigned int i; snd_iprintf(buffer, " Status: Running\n"); snd_iprintf(buffer, " Interface = %d\n", subs->interface); snd_iprintf(buffer, " Altset = %d\n", subs->altset_idx); snd_iprintf(buffer, " URBs = %d [ ", subs->nurbs); for (i = 0; i < subs->nurbs; i++) snd_iprintf(buffer, "%d ", subs->dataurb[i].packets); snd_iprintf(buffer, "]\n"); snd_iprintf(buffer, " Packet Size = %d\n", subs->curpacksize); snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n", snd_usb_get_speed(subs->dev) == USB_SPEED_FULL ? get_full_speed_hz(subs->freqm) : get_high_speed_hz(subs->freqm), subs->freqm >> 16, subs->freqm & 0xffff); } else { snd_iprintf(buffer, " Status: Stop\n"); } } static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct snd_usb_stream *stream = entry->private_data; snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name); if (stream->substream[SNDRV_PCM_STREAM_PLAYBACK].num_formats) { snd_iprintf(buffer, "\nPlayback:\n"); proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer); proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer); } if (stream->substream[SNDRV_PCM_STREAM_CAPTURE].num_formats) { snd_iprintf(buffer, "\nCapture:\n"); proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer); proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer); } } void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream) { struct snd_info_entry *entry; char name[32]; struct snd_card *card = stream->chip->card; sprintf(name, "stream%d", stream->pcm_index); if (!snd_card_proc_new(card, name, &entry)) snd_info_set_text_ops(entry, stream, proc_pcm_format_read); }
/* grd5.h structure holding a parsed grd5 (Photoshop gradient) Copyright (c) J.J. Green 2014 $Id$ */ #include <stdlib.h> #include "grd5.h" extern void grd5_grad_custom_destroy(grd5_grad_custom_t *gradc) { int n = gradc->colour.n; if (n > 0) { int i; grd5_colour_stop_t *stops = gradc->colour.stops; for (i=0 ; i<n ; i++) { if (stops[i].type == GRD5_MODEL_BOOK) { grd5_book_t *book = &(stops[i].u.book); grd5_string_destroy(book->Bk); grd5_string_destroy(book->Nm); grd5_string_destroy(book->bookKey); } } free(gradc->colour.stops); } if (gradc->transp.n > 0) free(gradc->transp.stops); } extern void grd5_grad_noise_destroy(grd5_grad_noise_t *gradn) { if (gradn->min.n > 0) free(gradn->min.vals); if (gradn->max.n > 0) free(gradn->max.vals); } extern void grd5_grad_destroy(grd5_grad_t *grad) { grd5_string_destroy(grad->title); switch (grad->type) { case GRD5_GRAD_CUSTOM: grd5_grad_custom_destroy(&(grad->u.custom)); break; case GRD5_GRAD_NOISE: grd5_grad_noise_destroy(&(grad->u.noise)); break; } } extern void grd5_destroy(grd5_t *grd5) { if (grd5->n > 0) { int i; for (i=0 ; i < grd5->n ; i++) grd5_grad_destroy(grd5->gradients+i); free(grd5->gradients); } free(grd5); } extern int grd5_model(grd5_string_t *str) { if (str->len < 1) return GRD5_MODEL_UNKNOWN; int model = GRD5_MODEL_UNKNOWN; switch (str->content[0]) { case 'R': if (grd5_string_matches(str, "RGBC")) model = GRD5_MODEL_RGB; break; case 'H': /* Oddly, HSBl seems only to be used in noise gradients; not sure if it should be interpreted as HSB */ if (grd5_string_matches(str, "HSBC") || grd5_string_matches(str, "HSBl")) model = GRD5_MODEL_HSB; break; case 'L': if (grd5_string_matches(str, "LbCl")) model = GRD5_MODEL_LAB; break; case 'C': if (grd5_string_matches(str, "CMYC")) model = GRD5_MODEL_CMYC; break; case 'G': if (grd5_string_matches(str, "Grsc")) model = GRD5_MODEL_GRSC; break; case 'F': if (grd5_string_matches(str, "FrgC")) model = GRD5_MODEL_FRGC; break; case 'B': if (grd5_string_matches(str, "BckC")) model = GRD5_MODEL_BCKC; else if (grd5_string_matches(str, "BkCl")) model = GRD5_MODEL_BOOK; break; case 'U': if (grd5_string_matches(str, "UnsC")) model = GRD5_MODEL_UNSC; break; } return model; }
/* * arch/arm/include/asm/atomic.h * * Copyright (C) 1996 Russell King. * Copyright (C) 2002 Deep Blue Solutions Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __ASM_ARM_ATOMIC_H #define __ASM_ARM_ATOMIC_H #include <linux/compiler.h> #include <linux/types.h> #include <asm/system.h> #define ATOMIC_INIT(i) { (i) } #ifdef __KERNEL__ #define atomic_read(v) ((v)->counter) #if __LINUX_ARM_ARCH__ >= 6 /* * ARMv6 UP and SMP safe atomic ops. We use load exclusive and * store exclusive to ensure that these are atomic. We may loop * to ensure that the update happens. Writing to 'v->counter' * without using the following operations WILL break the atomic * nature of these ops. */ static inline void atomic_set(atomic_t *v, int i) { unsigned long tmp; __asm__ __volatile__("@ atomic_set\n" "1: ldrex %0, [%1]\n" " strex %0, %2, [%1]\n" " teq %0, #0\n" " bne 1b" : "=&r" (tmp) : "r" (&v->counter), "r" (i) : "cc"); } static inline int atomic_add_return(int i, atomic_t *v) { unsigned long tmp; int result; __asm__ __volatile__("@ atomic_add_return\n" "1: ldrex %0, [%2]\n" " add %0, %0, %3\n" " strex %1, %0, [%2]\n" " teq %1, #0\n" " bne 1b" : "=&r" (result), "=&r" (tmp) : "r" (&v->counter), "Ir" (i) : "cc"); return result; } static inline int atomic_sub_return(int i, atomic_t *v) { unsigned long tmp; int result; __asm__ __volatile__("@ atomic_sub_return\n" "1: ldrex %0, [%2]\n" " sub %0, %0, %3\n" " strex %1, %0, [%2]\n" " teq %1, #0\n" " bne 1b" : "=&r" (result), "=&r" (tmp) : "r" (&v->counter), "Ir" (i) : "cc"); return result; } static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) { unsigned long oldval, res; do { __asm__ __volatile__("@ atomic_cmpxchg\n" "ldrex %1, [%2]\n" "mov %0, #0\n" "teq %1, %3\n" "strexeq %0, %4, [%2]\n" : "=&r" (res), "=&r" (oldval) : "r" (&ptr->counter), "Ir" (old), "r" (new) : "cc"); } while (res); return oldval; } static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) { unsigned long tmp, tmp2; __asm__ __volatile__("@ atomic_clear_mask\n" "1: ldrex %0, [%2]\n" " bic %0, %0, %3\n" " strex %1, %0, [%2]\n" " teq %1, #0\n" " bne 1b" : "=&r" (tmp), "=&r" (tmp2) : "r" (addr), "Ir" (mask) : "cc"); } #else /* ARM_ARCH_6 */ #ifdef CONFIG_SMP #error SMP not supported on pre-ARMv6 CPUs #endif #define atomic_set(v,i) (((v)->counter) = (i)) static inline int atomic_add_return(int i, atomic_t *v) { unsigned long flags; int val; raw_local_irq_save(flags); val = v->counter; v->counter = val += i; raw_local_irq_restore(flags); return val; } static inline int atomic_sub_return(int i, atomic_t *v) { unsigned long flags; int val; raw_local_irq_save(flags); val = v->counter; v->counter = val -= i; raw_local_irq_restore(flags); return val; } static inline int atomic_cmpxchg(atomic_t *v, int old, int new) { int ret; unsigned long flags; raw_local_irq_save(flags); ret = v->counter; if (likely(ret == old)) v->counter = new; raw_local_irq_restore(flags); return ret; } static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) { unsigned long flags; raw_local_irq_save(flags); *addr &= ~mask; raw_local_irq_restore(flags); } #endif /* __LINUX_ARM_ARCH__ */ #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) static inline int atomic_add_unless(atomic_t *v, int a, int u) { int c, old; c = atomic_read(v); while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c) c = old; return c != u; } #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) #define atomic_add(i, v) (void) atomic_add_return(i, v) #define atomic_inc(v) (void) atomic_add_return(1, v) #define atomic_sub(i, v) (void) atomic_sub_return(i, v) #define atomic_dec(v) (void) atomic_sub_return(1, v) #define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) #define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) #define atomic_inc_return(v) (atomic_add_return(1, v)) #define atomic_dec_return(v) (atomic_sub_return(1, v)) #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) #define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) /* Atomic operations are already serializing on ARM */ #define smp_mb__before_atomic_dec() barrier() #define smp_mb__after_atomic_dec() barrier() #define smp_mb__before_atomic_inc() barrier() #define smp_mb__after_atomic_inc() barrier() #include <asm-generic/atomic-long.h> #endif #endif
/* * File : gpio.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2015, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2015-03-24 Bright the first version */ #include <rthw.h> #include <rtdevice.h> #include <board.h> #include <drv_hwbutton.h> #include <drivers/hwbutton.h> #ifdef RT_USING_HWBUTTON static rt_err_t drv_button_init(rt_device_t dev, rt_uint8_t status) { rt_device_button_t *button = (rt_device_button_t *)dev; /* check parameters */ RT_ASSERT(button != RT_NULL); GPIO_InitTypeDef GPIO_InitStruct; if (status == 1) { /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOC_CLK_ENABLE(); /*Configure GPIO pins : PC0 PC1 PC2 PC3 PC4 PC5 */ GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3; /*PC0~PC3*/ GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;/*PC4 PC5*/ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); } else { HAL_GPIO_DeInit(GPIOC, GPIO_InitStruct.Pin); } return RT_EOK; } static rt_uint8_t drv_button_process(void) { rt_uint8_t rcv = 0,val = 0; HAL_GPIO_WritePin(GPIOC,GPIO_PIN_4,GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOC,GPIO_PIN_5,GPIO_PIN_SET); //rt_thread_delay(RT_TICK_PER_SECOND/100); rcv = (uint8_t)((~GPIOC->IDR)&0x0f); if(rcv != 0) { switch(rcv) { case 0x01: { val = 0x11;//S1 RL } break; case 0x02: { val = 0x12;//S2 DY/DS } break; case 0x04: { val = 0x14;//S3 ZL+ } break; case 0x08: { val = 0x18;//S4 ZL2+ } break; default: break; } } else { HAL_GPIO_WritePin(GPIOC,GPIO_PIN_4,GPIO_PIN_RESET); rcv = (uint8_t)((~GPIOC->IDR)&0x0f); if(rcv!= 0) { switch(rcv) { case 0x01: { val = 0x21;// } break; case 0x02: { val = 0x22;//S9 JG } break; case 0x04: { val = 0x24;//S10 SD } break; case 0x08: { val = 0x28;//S11 LZLF } break; default: break; } } else { HAL_GPIO_WritePin(GPIOC,GPIO_PIN_5,GPIO_PIN_RESET); rcv = (uint8_t)((~GPIOC->IDR)&0x0f); if(rcv != 0) { switch(rcv) { case 0x01: { val = 0x31;//S5 JY } break; case 0x02: { val = 0x32;//S6 GN } break; case 0x04: { val = 0x34;//S7 ZL- } break; case 0x08: { val = 0x38;//S8 ZL2- } break; default: break; } } } } return val; } static rt_size_t drv_button_read(rt_device_t dev) { rt_device_button_t *button = (rt_device_button_t *)dev; rt_uint8_t rcv = 0; /* check parameters */ RT_ASSERT(button != RT_NULL); if( (rcv = drv_button_process()) != 0)/* button pressed */ { rt_thread_delay(RT_TICK_PER_SECOND/100); if( drv_button_process() != rcv)/*if the button is not same twice*/ { rcv = 0; } else /* the button is same twice,and wait the button release */ { while(drv_button_process() != 0) { rt_thread_delay(RT_TICK_PER_SECOND/100); } } } return rcv; } const static rt_button_ops_t _drv_button_ops = { drv_button_init, drv_button_read, }; int stm32_hw_button_init(void) { int result; result = rt_device_button_register("button", &_drv_button_ops, RT_NULL); return result; } INIT_BOARD_EXPORT(stm32_hw_button_init); #endif /* RT_USING_HWBUTTON */
/* * ffi_symbol.c - ktapvm kernel module ffi symbol submodule * * Copyright (C) 2012-2016, Huawei Technologies. * * ktap is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * ktap is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA. */ #include "../../include/ktap_types.h" #include "../../include/ktap_ffi.h" #include "../ktap.h" #include "../kp_vm.h" #include "../kp_obj.h" #include "../kp_str.h" #include "../kp_tab.h" static inline csymbol *get_csym_arr(ktap_state_t *ks) { return G(ks)->ffis.csym_arr; } static inline int get_csym_nr(ktap_state_t *ks) { return G(ks)->ffis.csym_nr; } static inline void set_csym_arr(ktap_state_t *ks, csymbol *csym) { G(ks)->ffis.csym_arr = csym; } static inline void set_csym_nr(ktap_state_t *ks, int nr) { G(ks)->ffis.csym_nr = nr; } static inline ktap_tab_t *get_ffi_ctable(ktap_state_t *ks) { return G(ks)->ffis.ctable; } static int setup_ffi_ctable(ktap_state_t *ks) { ktap_val_t ffi_name, ffi_lib_name, ffi_mt; const ktap_val_t *gt, *ffit; ktap_tab_t *registry; gt = kp_tab_getint(hvalue(&G(ks)->registry), KTAP_RIDX_GLOBALS); G(ks)->ffis.ctable = kp_tab_new(ks, 0, 512); if (!G(ks)->ffis.ctable) return -1; /* get global["ffi"] */ set_string(&ffi_name, kp_str_new(ks, "ffi")); registry = hvalue(gt); ffit = kp_tab_get(ks, registry, &ffi_name); /* insert ffi C table to ffi table */ set_table(&ffi_mt, get_ffi_ctable(ks)); set_string(&ffi_lib_name, kp_str_new(ks, "C")); registry = hvalue(ffit); kp_tab_setvalue(ks, registry, &ffi_lib_name, &ffi_mt); return 0; } inline csymbol *ffi_get_csym_by_id(ktap_state_t *ks, int id) { return &(get_csym_arr(ks)[id]); } csymbol_id ffi_get_csym_id(ktap_state_t *ks, char *name) { int i; for (i = 0; i < get_csym_nr(ks); i++) { if (!strcmp(name, csym_name(ffi_get_csym_by_id(ks, i)))) { return i; } } kp_error(ks, "Cannot find csymbol with name %s\n", name); return 0; } static void add_ffi_func_to_ctable(ktap_state_t *ks, csymbol_id id) { ktap_val_t func_name, fv; ktap_cdata_t *cd; csymbol *cs; /* push cdata to ctable */ set_cdata(&fv, kp_obj_newobject(ks, KTAP_TYPE_CDATA, sizeof(ktap_cdata_t), NULL)); cd = cdvalue(&fv); cd_set_csym_id(cd, id); cs = id_to_csym(ks, id); set_string(&func_name, kp_str_new(ks, csym_name(cs))); kp_tab_setvalue(ks, get_ffi_ctable(ks), &func_name, &fv); } static int setup_ffi_symbol_table(ktap_state_t *ks) { int i; csymbol *cs; if (setup_ffi_ctable(ks)) return -1; /* push all functions to ctable */ for (i = 0; i < get_csym_nr(ks); i++) { cs = &get_csym_arr(ks)[i]; switch (cs->type) { case FFI_FUNC: kp_verbose_printf(ks, "[%d] loading C function %s\n", i, csym_name(cs)); add_ffi_func_to_ctable(ks, i); kp_verbose_printf(ks, "%s loaded\n", csym_name(cs)); break; case FFI_STRUCT: case FFI_UNION: break; default: break; } } return 0; } void ffi_free_symbols(ktap_state_t *ks) { int i; csymbol_id *arg_ids; csymbol *cs; if (!get_csym_arr(ks)) return; for (i = 0; i < get_csym_nr(ks); i++) { cs = &get_csym_arr(ks)[i]; switch (csym_type(cs)) { case FFI_FUNC: arg_ids = csym_func_arg_ids(cs); if (arg_ids) kp_free(ks, arg_ids); break; case FFI_STRUCT: case FFI_UNION: /*@TODO finish this 20.11 2013 (houqp)*/ break; default: break; } } kp_free(ks, get_csym_arr(ks)); } int ffi_set_csym_arr(ktap_state_t *ks, int cs_nr, csymbol *new_arr) { set_csym_nr(ks, cs_nr); set_csym_arr(ks, new_arr); return setup_ffi_symbol_table(ks); }
/**************************************************************************** ** ** This file is part of the Qtopia Opensource Edition Package. ** ** Copyright (C) 2008 Trolltech ASA. ** ** Contact: Qt Extended Information (info@qtextended.org) ** ** This file may be used under the terms of the GNU General Public License ** versions 2.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 GNU General Public ** Licensing requirements will be met: ** http://www.fsf.org/licensing/licenses/info/GPLv2.html. ** ** ****************************************************************************/ #ifndef LANIMPL_H #define LANIMPL_H #include <qtopianetworkinterface.h> #include <qtopianetwork.h> #include <qvaluespace.h> #include <scriptthread.h> #include <custom.h> #ifndef NO_WIRELESS_LAN class RoamingMonitor; class WlanRegistrationProvider; #endif class LanImpl : public QtopiaNetworkInterface { Q_OBJECT public: LanImpl( const QString& confFile ); virtual ~LanImpl(); virtual Status status(); virtual void initialize(); virtual void cleanup(); virtual bool start( const QVariant options ); virtual bool stop(); virtual QString device() const; virtual bool setDefaultGateway(); virtual QtopiaNetwork::Type type() const; virtual QtopiaNetworkConfiguration * configuration(); virtual void setProperties( const QtopiaNetworkProperties& properties); protected: bool isAvailable() const; bool isPCMCIADevice( const QString& dev) const; bool isActive() const; private slots: void reconnectWLAN(); void updateState(); private: void installDNS(bool); bool isAvailableDevice( const QString& ) const; void updateTrigger( QtopiaNetworkInterface::Error code = QtopiaNetworkInterface::NoError, const QString& desc = QString() ); QtopiaNetworkConfiguration *configIface; Status ifaceStatus; mutable QString deviceName; #ifndef NO_WIRELESS_LAN RoamingMonitor* roaming; WlanRegistrationProvider* wlanRegProvider; #endif QValueSpaceObject *netSpace; ScriptThread thread; bool delayedGatewayInstall; int trigger; }; #endif
/* Copyright (C) 2008-2011 Vana Development 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; 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. 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 #include "Types.h" #include <string> #include <vector> using std::string; using std::vector; class Player; class WorldServerConnection; namespace SyncPacket { void playerChangeChannel(WorldServerConnection *player, Player *info, uint16_t channel); void playerChangeServer(WorldServerConnection *player, Player *info, bool cashShop); void playerBuffsTransferred(WorldServerConnection *player, int32_t playerid, bool fromCashOrMts); void registerPlayer(WorldServerConnection *player, uint32_t ip, int32_t playerid, const string &name, int32_t map, int16_t job, uint8_t level, int32_t guildid, uint8_t guildrank, int32_t allianceid, uint8_t alliancerank); void removePlayer(WorldServerConnection *player, int32_t playerid); void partyOperation(WorldServerConnection *player, int8_t type, int32_t playerid, int32_t target = 0); void partyInvite(WorldServerConnection *player, int32_t playerid, const string &invitee); void updateLevel(WorldServerConnection *player, int32_t playerid, uint8_t level); void updateJob(WorldServerConnection *player, int32_t playerid, int16_t job); void updateMap(WorldServerConnection *player, int32_t playerid, int32_t map); void buddyInvite(WorldServerConnection *player, int32_t playerid, int32_t inviteeid); void buddyOnline(WorldServerConnection *player, int32_t playerid, vector<int32_t> players, bool online); }
/* * Copyright (C) * * This file is part of paparazzi. * * paparazzi 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. * * paparazzi 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 paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * @file modules/digital_cam/video_cam_ctrl.c */ #include "video_cam_ctrl.h" #include "generated/airframe.h" // Include Standard Camera Control Interface #include "modules/digital_cam/dc.h" void digital_cam_video_init(void) { // Call common DC init dc_init(); } void digital_cam_video_periodic(void) { // Common DC Periodic task dc_periodic(); } #ifndef SITL #include "viewvideo.h" #endif /* Command The Camera */ void dc_send_command(uint8_t cmd) { switch (cmd) { case DC_SHOOT: #ifndef SITL viewvideo_take_shot(TRUE); #endif dc_send_shot_position(); break; case DC_TALLER: break; case DC_WIDER: break; case DC_ON: break; case DC_OFF: break; default: break; } }
/* * Copyright (c) 2000 Matthias Hölzer-Klüpfel <hoelzer@kde.org> 2000 Carsten Pfeiffer <pfeiffer@kde.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software */ #ifndef __swallow_h__ #define __swallow_h__ #include <tqevent.h> #include <tqptrlist.h> #include <qxembed.h> #include <kpanelapplet.h> class TQBoxLayout; class TDEConfig; class TDEProcess; class KWinModule; class SwallowApp; typedef struct _SwallowCommand { TQString cmdline; TQString title; } SwallowCommand; typedef TQPtrList<SwallowCommand> SwallowCommandList; typedef TQPtrListIterator<SwallowCommand> SwallowCommandListIterator; typedef TQPtrList<SwallowApp> SwallowAppList; class SwallowApplet : public KPanelApplet { Q_OBJECT public: SwallowApplet( const TQString& configFile, TQWidget *parent, const char *name = 0L ); ~SwallowApplet(); // returns 0L if we don't have a SwallowApplet object yet, // but who cares static KWinModule * winModule() { return wModule; } static void removeApplet( SwallowApp * ); public: // for KPanelApplet int widthForHeight( int w ); int heightForWidth( int h ); void windowAdded(WId win); void processExited(TDEProcess *proc); public slots: virtual void preferences(); private slots: void embedded( SwallowApp * ); private: void layoutApps(); SwallowCommandList* readConfig(); void createApps( SwallowCommandList * ); static SwallowApplet *self; static SwallowAppList *appList; static SwallowAppList *embeddedList; static KWinModule *wModule; SwallowCommandList * m_swcList; TQBoxLayout *m_layout; }; class SwallowApp : public QXEmbed { Q_OBJECT public: SwallowApp( const SwallowCommand * swc, TQWidget* parent = 0, const char* name = 0); ~SwallowApp(); float sizeRatio() const { return wh_ratio; } signals: void embedded( SwallowApp * ); protected slots: void windowAdded(WId win); void processExited(TDEProcess *proc); private: TDEProcess *process; TQString winTitle; float wh_ratio; }; #endif // __swallow_h__
// Cyphesis Online RPG Server and AI Engine // Copyright (C) 2011 Alistair Riddoch // // 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 #ifndef SERVER_TASK_RULE_HANDLER_H #define SERVER_TASK_RULE_HANDLER_H #include "RuleHandler.h" class EntityBuilder; class TaskKit; /// \brief Handle processing and updating of task ruless class TaskRuleHandler : public RuleHandler { protected: EntityBuilder * const m_builder; int populateTaskFactory(const std::string & class_name, TaskKit * factory, const Atlas::Objects::Root & class_desc, std::string & dependent, std::string & reason); int installTaskClass(const std::string & class_name, const std::string & parent, const Atlas::Objects::Root & class_desc, std::string & dependent, std::string & reason); int modifyTaskClass(const std::string & class_name, const Atlas::Objects::Root & class_desc); public: TaskRuleHandler(EntityBuilder * eb) : m_builder(eb) { } virtual int check(const Atlas::Objects::Root & desc); virtual int install(const std::string &, const std::string &, const Atlas::Objects::Root & desc, std::string &, std::string &); virtual int update(const std::string &, const Atlas::Objects::Root & desc); }; #endif // SERVER_TASK_RULE_HANDLER_H
#include <stdio.h> #include <stdlib.h> #include "arch.h" #include "log.h" // for BUG #include "random.h" #include "sanitise.h" #include "trinity.h" // page_size static unsigned int plus_minus_two(unsigned int num) { /* Now munge it for off-by-ones. */ switch (rand() % 5) { case 0: num -= 2; break; case 1: num -= 1; break; case 2: return num; case 3: num += 1; break; case 4: num += 2; break; } return num; } unsigned int get_interesting_32bit_value(void) { unsigned int num = 0; switch (rand() % 10) { case 0: num = 0x00000000; break; case 1: num = rand() % 256; // 00-0xff break; case 2: num = 1 << (rand() % 32); // set a single bit. break; case 3: num = 0x8fffffff; break; case 4: num = 0xff; num = num << (rand() % 31); break; case 5: num = 0xffff0000; break; case 6: num = 0xffffe000; break; case 7: num = 0xffffff00 | (rand() % 256); break; case 8: num = 0xffffffff - page_size; break; case 9: num = 0xffffffff; break; } num = plus_minus_two(num); return num; } #if __WORDSIZE != 32 static unsigned long per_arch_interesting_addr(unsigned long low) { int i = 0; #if defined(__x86_64__) i = rand() % 4; switch (i) { case 0: return 0x00007fffffffffffUL; // x86-64 canonical addr end. case 1: return 0x0000800000000000UL; // First x86-64 non-canonical addr case 2: return 0xffff800000000000UL | (low << 4); // x86-64 canonical addr range 2 begin case 3: return VDSO_ADDR | (low & 0x0fffff); } #endif // FIXME: Add more arch specific addresses here. return i | low; } #endif /* __WORDSIZE */ unsigned long get_interesting_value(void) { #if __WORDSIZE == 32 return get_interesting_32bit_value(); #else unsigned long low = 0; if (rand_bool()) low = get_interesting_32bit_value(); switch (rand() % 13) { case 0: return 0; case 1: return low; case 2: return 0x0000000100000000UL | low; case 3: return 0x7fffffff00000000UL | low; case 4: return 0x8000000000000000UL | low; case 5: return 0xffffffff00000000UL | low; case 6: return 0xffffffffffffff00UL | (rand() % 256); case 7: return 0xffffffffffffffffUL - page_size; case 8: return PAGE_OFFSET | (low << 4); case 9: return KERNEL_ADDR | (low & 0xffffff); case 10: return MODULE_ADDR | (low & 0xffffff); case 11: return per_arch_interesting_addr(low); case 12: return (low << 32); } return low; // unreachable, but gcc is dumb. #endif /* __WORDSIZE */ }
/* * Generated by asn1c-0.9.22.1409 (http://lionet.info/asn1c) * From ASN.1 module "MCS-PROTOCOL-3" * found in "mcs.asn1" * `asn1c -fnative-types -fskeletons-copy -fcompound-names -gen-PER` */ #ifndef _ExtendedParameterPropose_H_ #define _ExtendedParameterPropose_H_ #include <asn_application.h> /* Including external dependencies */ #include "ExtendedParameters.h" #include <asn_SEQUENCE_OF.h> #include <constr_SEQUENCE_OF.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct NonStandardParameter; /* ExtendedParameterPropose */ typedef struct ExtendedParameterPropose { ExtendedParameters_t targetExtendedParameters; ExtendedParameters_t minimumExtendedParameters; ExtendedParameters_t maximumExtendedParameters; struct ExtendedParameterPropose__nonStandard { A_SEQUENCE_OF(struct NonStandardParameter) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *nonStandard; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ExtendedParameterPropose_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_ExtendedParameterPropose; #ifdef __cplusplus } #endif /* Referred external types */ #include "NonStandardParameter.h" #endif /* _ExtendedParameterPropose_H_ */
/* * linux/drivers/ide/cenatek.c Version 0.05 June 9, 2000 * * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 2002 Arjan van de Ven <arjanv@redhat.com> * May be copied or modified under the terms of the GNU General Public License * */ #include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/timer.h> #include <linux/mm.h> #include <linux/ioport.h> #include <linux/blkdev.h> #include <linux/hdreg.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/ide.h> #include <asm/io.h> #include <asm/irq.h> #include "ide_modes.h" #define DISPLAY_VIPER_TIMINGS #if defined(DISPLAY_VIPER_TIMINGS) && defined(CONFIG_PROC_FS) #include <linux/stat.h> #include <linux/proc_fs.h> static int cenatek_get_info(char *, char **, off_t, int); extern int (*cenatek_display_info)(char *, char **, off_t, int); /* ide-proc.c */ extern char *ide_media_verbose(ide_drive_t *); static struct pci_dev *bmide_dev; #endif /* defined(DISPLAY_VIPER_TIMINGS) && defined(CONFIG_PROC_FS) */ byte cenatek_proc = 0; extern char *ide_xfer_verbose (byte xfer_rate); /* * Here is where all the hard work goes to program the chipset. * */ static int cenatek_tune_chipset (ide_drive_t *drive, byte speed) { ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; int err = 0; byte unit = (drive->select.b.unit & 0x01); #ifdef CONFIG_BLK_DEV_IDEDMA unsigned long dma_base = hwif->dma_base; #endif /* CONFIG_BLK_DEV_IDEDMA */ if (!drive->init_speed) drive->init_speed = speed; err = ide_config_drive_speed(drive, speed); drive->current_speed = speed; return (err); } static void config_chipset_for_pio (ide_drive_t *drive) { byte speed; speed = XFER_PIO_4; (void) cenatek_tune_chipset(drive, speed); drive->current_speed = speed; } static void cenatek_tune_drive (ide_drive_t *drive, byte pio) { byte speed; switch(pio) { case 4: speed = XFER_PIO_4;break; case 3: speed = XFER_PIO_3;break; case 2: speed = XFER_PIO_2;break; case 1: speed = XFER_PIO_1;break; default: speed = XFER_PIO_0;break; } (void) cenatek_tune_chipset(drive, speed); } #ifdef CONFIG_BLK_DEV_IDEDMA /* * This allows the configuration of ide_pci chipset registers * for cards that learn about the drive's UDMA, DMA, PIO capabilities * after the drive is reported by the OS. */ static int config_chipset_for_dma (ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; struct hd_driveid *id = drive->id; byte udma_66 = 1; byte udma_100 = 1; byte speed = 0x00; int rval; if (udma_100) udma_66 = eighty_ninty_three(drive); if ((id->dma_ultra & 0x0020) && (udma_66) && (udma_100)) { speed = XFER_UDMA_5; } else if ((id->dma_ultra & 0x0010) && (udma_66)) { speed = XFER_UDMA_4; } else if ((id->dma_ultra & 0x0008) && (udma_66)) { speed = XFER_UDMA_3; } else if (id->dma_ultra & 0x0004) { speed = XFER_UDMA_2; } else if (id->dma_ultra & 0x0002) { speed = XFER_UDMA_1; } else if (id->dma_ultra & 0x0001) { speed = XFER_UDMA_0; } else if (id->dma_mword & 0x0004) { speed = XFER_MW_DMA_2; } else if (id->dma_mword & 0x0002) { speed = XFER_MW_DMA_1; } else if (id->dma_mword & 0x0001) { speed = XFER_MW_DMA_0; } else { return ((int) ide_dma_off_quietly); } (void) cenatek_tune_chipset(drive, speed); rval = (int)( ((id->dma_ultra >> 11) & 7) ? ide_dma_on : ((id->dma_ultra >> 8) & 7) ? ide_dma_on : ((id->dma_mword >> 8) & 7) ? ide_dma_on : ide_dma_off_quietly); return rval; } static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; ide_dma_action_t dma_func = ide_dma_on; if (id && (id->capability & 1) && HWIF(drive)->autodma) { /* Force if Capable UltraDMA */ dma_func = config_chipset_for_dma(drive); config_chipset_for_pio(drive); } return HWIF(drive)->dmaproc(dma_func, drive); } /* * cenatek_dmaproc() initiates/aborts (U)DMA read/write operations on a drive. */ int cenatek_dmaproc (ide_dma_action_t func, ide_drive_t *drive) { switch (func) { case ide_dma_check: return config_drive_xfer_rate(drive); default: break; } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } #endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_cenatek (struct pci_dev *dev, const char *name) { unsigned long fixdma_base = pci_resource_start(dev, 4); #if defined(DISPLAY_VIPER_TIMINGS) && defined(CONFIG_PROC_FS) if (!cenatek_proc) { cenatek_proc = 1; bmide_dev = dev; } #endif /* DISPLAY_VIPER_TIMINGS && CONFIG_PROC_FS */ return 0; } unsigned int __init ata66_cenatek (ide_hwif_t *hwif) { return(1); } void __init ide_init_cenatek (ide_hwif_t *hwif) { hwif->tuneproc = &cenatek_tune_drive; hwif->speedproc = &cenatek_tune_chipset; #ifndef CONFIG_BLK_DEV_IDEDMA hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; hwif->autodma = 0; return; #else if (hwif->dma_base) { hwif->dmaproc = &cenatek_dmaproc; if (!noautodma) { hwif->autodma = 1; hwif->highmem = 1; } } else { hwif->autodma = 0; hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; } #endif /* CONFIG_BLK_DEV_IDEDMA */ } void __init ide_dmacapable_cenatek (ide_hwif_t *hwif, unsigned long dmabase) { ide_setup_dma(hwif, dmabase, 8); }
/* tap-afpstat.c * Based on * smbstat 2003 Ronnie Sahlberg * * $Id: tap-afpstat.c 50159 2013-06-26 00:18:44Z morriss $ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <stdio.h> #include <string.h> #include <epan/packet_info.h> #include <epan/tap.h> #include <epan/stat_cmd_args.h> #include <epan/value_string.h> #include <epan/dissectors/packet-afp.h> #include "epan/timestats.h" /* used to keep track of the statistics for an entire program interface */ typedef struct _afpstat_t { char *filter; timestat_t proc[256]; } afpstat_t; static int afpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv) { afpstat_t *ss=(afpstat_t *)pss; const afp_request_val *request_val=(const afp_request_val *)prv; nstime_t t, deltat; timestat_t *sp=NULL; /* if we havnt seen the request, just ignore it */ if(!request_val){ return 0; } sp=&(ss->proc[request_val->command]); /* calculate time delta between request and reply */ t=pinfo->fd->abs_ts; nstime_delta(&deltat, &t, &request_val->req_time); if(sp){ time_stat_update(sp,&deltat, pinfo); } return 1; } static void afpstat_draw(void *pss) { afpstat_t *ss=(afpstat_t *)pss; guint32 i; guint64 td; printf("\n"); printf("===================================================================\n"); printf("AFP SRT Statistics:\n"); printf("Filter: %s\n",ss->filter?ss->filter:""); printf("Commands Calls Min SRT Max SRT Avg SRT\n"); for(i=0;i<256;i++){ /* nothing seen, nothing to do */ if(ss->proc[i].num==0){ continue; } /* scale it to units of 10us.*/ td=ss->proc[i].tot.secs; td=td*100000+(int)ss->proc[i].tot.nsecs/10000; if(ss->proc[i].num){ td/=ss->proc[i].num; } else { td=0; } printf("%-25s %6d %3d.%05d %3d.%05d %3" G_GINT64_MODIFIER "u.%05" G_GINT64_MODIFIER "u\n", val_to_str_ext(i, &CommandCode_vals_ext, "Unknown (%u)"), ss->proc[i].num, (int)ss->proc[i].min.secs,ss->proc[i].min.nsecs/10000, (int)ss->proc[i].max.secs,ss->proc[i].max.nsecs/10000, td/100000, td%100000 ); } printf("===================================================================\n"); } static void afpstat_init(const char *optarg, void* userdata _U_) { afpstat_t *ss; guint32 i; const char *filter=NULL; GString *error_string; if(!strncmp(optarg,"afp,srt,",8)){ filter=optarg+8; } else { filter=NULL; } ss=g_new(afpstat_t,1); if(filter){ ss->filter=g_strdup(filter); } else { ss->filter=NULL; } for(i=0;i<256;i++){ ss->proc[i].num=0; ss->proc[i].min_num=0; ss->proc[i].max_num=0; ss->proc[i].min.secs=0; ss->proc[i].min.nsecs=0; ss->proc[i].max.secs=0; ss->proc[i].max.nsecs=0; ss->proc[i].tot.secs=0; ss->proc[i].tot.nsecs=0; } error_string=register_tap_listener("afp", ss, filter, 0, NULL, afpstat_packet, afpstat_draw); if(error_string){ /* error, we failed to attach to the tap. clean up */ g_free(ss->filter); g_free(ss); fprintf(stderr, "tshark: Couldn't register afp,srt tap: %s\n", error_string->str); g_string_free(error_string, TRUE); exit(1); } } void register_tap_listener_afpstat(void) { register_stat_cmd_arg("afp,srt", afpstat_init,NULL); }
#ifndef ABSTRACTPARAMETERSEDITDIALOG_H #define ABSTRACTPARAMETERSEDITDIALOG_H //SpikeStream includes #include "ParameterInfo.h" //Qt includes #include <QCheckBox> #include <QComboBox> #include <QDialog> #include <QHash> #include <QLayout> #include <QLineEdit> namespace spikestream { /*! Abstract class containing functions common to all dialogs for the editing of parameters */ class AbstractParametersEditDialog : public QDialog { Q_OBJECT public: AbstractParametersEditDialog(const QList<ParameterInfo>& paramInfoList, QWidget* parent = 0); virtual ~AbstractParametersEditDialog(); protected slots: /*! Loads up the default parameters */ virtual void defaultButtonClicked() = 0; /*! Accepts the dialog and extracts the parameters */ virtual void okButtonClicked() = 0; protected: //=================== VARIABLES ==================== /*! Information about the parameters that are being edited */ QList<ParameterInfo> parameterInfoList; //==================== METHODS ===================== void addButtons(QVBoxLayout* mainVLayout); void addParameters(QVBoxLayout* mainVLayout); QHash<QString, double> getParameterValues(); void setParameterValues(const QHash<QString, double>& paramMap); private: //=================== VARIABLES ==================== /*! Map of the line edits for double, int and unsigned int parameters. Key is the name of the parameter; value is a pointer to the line edit */ QHash<QString, QLineEdit*> lineEditMap; /*! Map of the check boxes for boolean parameters. Key is the name of the parameter; value is a pointer to the check box */ QHash<QString, QCheckBox*> checkBoxMap; /*! Map of the combo boxes for option parameters */ QHash<QString, QComboBox*> comboMap; }; } #endif//ABSTRACTPARAMETERSEDITDIALOG_H
// Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ #define CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ #pragma once #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "content/common/notification_registrar.h" class ThemeService; class Extension; class SkBitmap; class TabContents; class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, public NotificationObserver { public: ThemeInstalledInfoBarDelegate(TabContents* tab_contents, const Extension* new_theme, const std::string& previous_theme_id); bool MatchesTheme(const Extension* theme) const; protected: virtual ~ThemeInstalledInfoBarDelegate(); ThemeService* theme_service() { return theme_service_; } virtual bool Cancel(); private: virtual void InfoBarClosed(); virtual SkBitmap* GetIcon() const; virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); virtual string16 GetMessageText() const; virtual int GetButtons() const; virtual string16 GetButtonLabel(InfoBarButton button) const; virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); Profile* profile_; ThemeService* theme_service_; std::string name_; std::string theme_id_; std::string previous_theme_id_; TabContents* tab_contents_; NotificationRegistrar registrar_; }; #endif
/* Set flags signalling availability of kernel features based on given kernel version number. Copyright (C) 1999-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C 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 the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ #include <sgidefs.h> /* Support for the accept4 syscall was added in 2.6.31. */ #define __ASSUME_ACCEPT4_SYSCALL 1 /* Support for the recvmmsg syscall was added in 2.6.33. */ #define __ASSUME_RECVMMSG_SYSCALL 1 /* Support for the sendmmsg syscall was added in 3.1. */ #define __ASSUME_SENDMMSG_SYSCALL 1 #include_next <kernel-features.h> /* The MIPS kernel does not support futex_atomic_cmpxchg_inatomic if emulating LL/SC. */ #if __mips == 1 || defined _MIPS_ARCH_R5900 # undef __ASSUME_FUTEX_LOCK_PI # undef __ASSUME_REQUEUE_PI # undef __ASSUME_SET_ROBUST_LIST #endif
/* This file is part of the KDE project Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org> Copyright (C) 2009 Jarosław Staniek <staniek@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KOODFEXPORTER_H #define KOODFEXPORTER_H #include "msooxml_export.h" #include <KoFilter.h> class KXmlWriter; class KOdfStore; class KOdfGenericStyles; /** * @brief Convenience structure encapsulating XML writers used when writing ODF document. */ struct MSOOXML_EXPORT KoOdfWriters { /** * Creates structure encapsulating XML writers. All members are set initially to 0. */ KoOdfWriters(); KXmlWriter *content; KXmlWriter *body; KXmlWriter *meta; KXmlWriter *manifest; KOdfGenericStyles *mainStyles; }; /** * @brief The base class for filters exporting to ODF. * * @todo Move to libs, e.g. komain * * @author Jarosław Staniek <staniek@kde.org> */ class MSOOXML_EXPORT KoOdfExporter : public KoFilter { Q_OBJECT public: virtual ~KoOdfExporter(); virtual KoFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to); protected: /** * This is the constructor your filter has to call, obviously. * @param bodyContentElement element name for the content: * "text" for ODT format, "presentation" for ODP, * "spreadsheet" for ODS, "drawing" for ODG. * office:text element will be created within office:body, etc. * @param parent parent object. */ KoOdfExporter(const QString& bodyContentElement, QObject* parent = 0); /** * @return true if @a mime is accepted source mime type. * Implement it for your filter. */ virtual bool acceptsSourceMimeType(const QByteArray& mime) const = 0; /** * @return true if @a mime is accepted destination mime type. * Implement it for your filter. */ virtual bool acceptsDestinationMimeType(const QByteArray& mime) const = 0; /** * This method is called in convert() after creating @a outputStore, @a writers and @a mainStyles. * Implement it for your filter with code that fills the ODF structures with converted data. */ virtual KoFilter::ConversionStatus createDocument(KOdfStore *outputStore, KoOdfWriters *writers) = 0; private: class Private; Private* d; }; #endif /* KOODFEXPORTER_H */
/* * board IDME driver header file * * Copyright (C) 2011 Amazon Inc., 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 version 2 as * published by the Free Software Foundation. */ #ifndef _BOWSER_IDME_INIT_H_ #define _BOWSER_IDME_INIT_H_ #define BOARD_TYPE_BOWSER 0 #define BOARD_TYPE_JEM 1 #define BOARD_TYPE_TATE 2 /*From Jem EVT2 */ #define BOARD_TYPE_JEM_WIFI 801 #define BOARD_TYPE_JEM_WAN 802 /*From Tate EVT2.1*/ #define BOARD_TYPE_TATE_EVT2_1 803 #define BOARD_TYPE_TATE_EVT3 803 #define BOARD_TYPE_RADLEY 804 enum idme_board_type{ IDME_BOARD_TYPE_BOWER1=0, IDME_BOARD_TYPE_BOWER2, IDME_BOARD_TYPE_BOWER3, IDME_BOARD_TYPE_BOWER4, IDME_BOARD_TYPE_BOWER5, IDME_BOARD_TYPE_BOWER6, IDME_BOARD_TYPE_BOWER7, IDME_BOARD_TYPE_BOWER8, IDME_BOARD_TYPE_BOWER9, IDME_BOARD_TYPE_JEM_PROTO, IDME_BOARD_TYPE_JEM_EVT1, IDME_BOARD_TYPE_JEM_EVT1_2_WIFI, IDME_BOARD_TYPE_JEM_EVT1_2_WAN, IDME_BOARD_TYPE_JEM_EVT2_WIFI, IDME_BOARD_TYPE_JEM_EVT2_WAN, IDME_BOARD_TYPE_JEM_EVT3_WIFI, IDME_BOARD_TYPE_JEM_EVT3_WAN, IDME_BOARD_TYPE_TATE_PROTO, IDME_BOARD_TYPE_TATE_EVT_PRE, IDME_BOARD_TYPE_TATE_EVT1, IDME_BOARD_TYPE_TATE_EVT1_0A, IDME_BOARD_TYPE_TATE_EVT1_1, IDME_BOARD_TYPE_TATE_EVT2, IDME_BOARD_TYPE_TATE_EVT2_1, IDME_BOARD_TYPE_TATE_EVT3, IDME_BOARD_TYPE_RADLEY_EVT1, IDME_BOARD_TYPE_RADLEY_EVT2, }; void bowser_init_idme(void); int is_bowser_rev4(void); int idme_query_board_type(const enum idme_board_type bt); int is_radley_device(void); int __initdata board_has_usb_host(void); #endif
// Copyright 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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_H_ #include <string> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_actor.h" #include "chrome/browser/chromeos/login/screens/wizard_screen.h" namespace chromeos { class KioskEnableScreen : public WizardScreen, public KioskEnableScreenActor::Delegate { public: KioskEnableScreen(ScreenObserver* observer, KioskEnableScreenActor* actor); virtual ~KioskEnableScreen(); virtual void PrepareToShow() OVERRIDE {} virtual void Show() OVERRIDE; virtual void Hide() OVERRIDE {} virtual std::string GetName() const OVERRIDE; virtual void OnExit() OVERRIDE; virtual void OnActorDestroyed(KioskEnableScreenActor* actor) OVERRIDE; private: KioskEnableScreenActor* actor_; DISALLOW_COPY_AND_ASSIGN(KioskEnableScreen); }; } #endif
/* LIBGIMP - The GIMP Library * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis * * GimpColorManaged interface * Copyright (C) 2007 Sven Neumann <sven@gimp.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include <glib-object.h> #include "gimpcolortypes.h" #include "gimpcolormanaged.h" enum { PROFILE_CHANGED, LAST_SIGNAL }; static void gimp_color_managed_base_init (GimpColorManagedInterface *iface); static guint gimp_color_managed_signals[LAST_SIGNAL] = { 0 }; GType gimp_color_managed_interface_get_type (void) { static GType iface_type = 0; if (! iface_type) { const GTypeInfo iface_info = { sizeof (GimpColorManagedInterface), (GBaseInitFunc) gimp_color_managed_base_init, (GBaseFinalizeFunc) NULL, }; iface_type = g_type_register_static (G_TYPE_INTERFACE, "GimpColorManagedInterface", &iface_info, 0); g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT); } return iface_type; } static void gimp_color_managed_base_init (GimpColorManagedInterface *iface) { static gboolean initialized = FALSE; if (! initialized) { gimp_color_managed_signals[PROFILE_CHANGED] = g_signal_new ("profile-changed", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GimpColorManagedInterface, profile_changed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); iface->get_icc_profile = NULL; iface->profile_changed = NULL; initialized = TRUE; } } /** * gimp_color_managed_get_icc_profile: * @managed: an object the implements the #GimpColorManaged interface * @len: return location for the number of bytes in the profile data * * Return value: A pointer to a blob of data that represents an ICC * color profile. * * Since: GIMP 2.4 **/ const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed, gsize *len) { GimpColorManagedInterface *iface; g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL); g_return_val_if_fail (len != NULL, NULL); *len = 0; iface = GIMP_COLOR_MANAGED_GET_INTERFACE (managed); if (iface->get_icc_profile) return iface->get_icc_profile (managed, len); return NULL; } /** * gimp_color_managed_profile_changed: * @managed: an object the implements the #GimpColorManaged interface * * Emits the "profile-changed" signal. * * Since: GIMP 2.4 **/ void gimp_color_managed_profile_changed (GimpColorManaged *managed) { g_return_if_fail (GIMP_IS_COLOR_MANAGED (managed)); g_signal_emit (managed, gimp_color_managed_signals[PROFILE_CHANGED], 0); }
#ifndef _PCAP_H_ #define _PCAP_H_ #include "qemu-common.h" /* * Used http://wiki.wireshark.org/Development/LibpcapFileFormat to get the pcap file format */ #define PCAP_MAGIC 0xa1b2c3d4 #define PCAP_VMAJOR 2 #define PCAP_VMINOR 4 typedef struct pcap_hdr_s { uint32_t magic_number; /* magic number */ uint16_t version_major; /* major version number */ uint16_t version_minor; /* minor version number */ int32_t thiszone; /* GMT to local correction */ uint32_t sigfigs; /* accuracy of timestamps */ uint32_t snaplen; /* max length of captured packets, in octets */ uint32_t network; /* data link type */ } pcap_hdr_t; typedef struct pcaprec_hdr_s { uint32_t ts_sec; /* timestamp seconds */ uint32_t ts_usec; /* timestamp microseconds */ uint32_t incl_len; /* number of octets of packet saved in file */ uint32_t orig_len; /* actual length of packet */ } pcaprec_hdr_t; void pcap_dump_init(const char *fname); void pcap_dump(const uint8_t *pkt, int len); #endif //_PCAP_H_
#include <linux/platform_device.h> #include <linux/gpio.h> #include <linux/bcm4330-rfkill.h> #include "urboard.h" #define GPIO_BT_RST_N GPIO_PF(8) #define GPIO_BT_REG_ON GPIO_PF(4) #define GPIO_BT_WAKE GPIO_PF(5) #define GPIO_BT_INT GPIO_PF(6) static struct bcm4330_rfkill_platform_data gpio_data = { .gpio = { .bt_rst_n = GPIO_BT_RST_N , .bt_reg_on = GPIO_BT_REG_ON , .bt_wake = GPIO_BT_WAKE , .bt_int = GPIO_BT_INT , }, }; struct platform_device bcm4330_bt_power_device = { .name = "bcm4330_bt_power" , .id = -1 , .dev = { .platform_data = &gpio_data, }, };
/* ============================================================================== This file is part of the ambix Ambisonic plug-in suite. Copyright (c) 2013/2014 - Matthias Kronlachner www.matthiaskronlachner.com Permission is granted to use this software under the terms of: the GPL v2 (or any later version) Details of these licenses can be found at: www.gnu.org/licenses ambix 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 __JUCER_HEADER_AMBIXENCODERAUDIOPROCESSOREDITOR_PLUGINEDITOR_EF118A61__ #define __JUCER_HEADER_AMBIXENCODERAUDIOPROCESSOREDITOR_PLUGINEDITOR_EF118A61__ //[Headers] -- You can add your own extra header files here -- #include "JuceHeader.h" #include "PluginProcessor.h" #include "SphereOpenGL.h" #include "Settings.h" //[/Headers] //============================================================================== /** //[Comments] An auto-generated component, created by the Jucer. Describe your class and how it works here! //[/Comments] */ class Ambix_encoderAudioProcessorEditor : public AudioProcessorEditor, public SliderListener, public ChangeListener, public ButtonListener, public Timer, public TextEditorListener { public: //============================================================================== Ambix_encoderAudioProcessorEditor (Ambix_encoderAudioProcessor* ownerFilter); ~Ambix_encoderAudioProcessorEditor(); //============================================================================== //[UserMethods] -- You can add your own custom methods in this section. //[/UserMethods] void paint (Graphics& g); void resized(); void sliderValueChanged (Slider* sliderThatWasMoved); void buttonClicked (Button* buttonThatWasClicked); void textEditorFocusLost (TextEditor& ed); void textEditorReturnKeyPressed (TextEditor& ed); void changeListenerCallback (ChangeBroadcaster *source); void modifierKeysChanged (const ModifierKeys &modifiers ); void timerCallback(); void updateID(); // Binary resources: static const char* settings_png; static const int settings_pngSize; static const char* settings_white_png; static const int settings_white_pngSize; private: //[UserVariables] -- You can add your own custom variables in this section. //[/UserVariables] //============================================================================== ScopedPointer<Slider> sld_el; ScopedPointer<Slider> sld_az; ScopedPointer<Slider> sld_size; #if INPUT_CHANNELS > 1 ScopedPointer<Slider> sld_width; #endif ScopedPointer<Slider> sld_speed; ScopedPointer<Slider> sld_el_move; ScopedPointer<Slider> sld_az_move; ScopedPointer<TextEditor> txt_az_move; ScopedPointer<TextEditor> txt_el_move; ScopedPointer<Label> lbl_id; ScopedPointer<ImageButton> btn_settings; ScopedPointer<TextEditor> txt_id; ScopedPointer<SphereOpenGL> sphere_opengl; bool changed_; // this is true if parameters have changed CriticalSection lock_; // lock critical section juce::Component::SafePointer<juce::DialogWindow> _settingsDialogWindow; Ambix_encoderAudioProcessor* getProcessor() const { return static_cast <Ambix_encoderAudioProcessor*> (getAudioProcessor()); } TooltipWindow tooltipWindow; //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Ambix_encoderAudioProcessorEditor) }; //[EndFile] You can add extra defines here... //[/EndFile] #endif // __JUCER_HEADER_AMBIXENCODERAUDIOPROCESSOREDITOR_PLUGINEDITOR_EF118A61__
/* Copyright (c) 2018 ZCaliptium. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef SE_INCL_DISCORD_H #define SE_INCL_DISCORD_H #ifdef PRAGMA_ONCE #pragma once #endif void Discord_InitPlugin(); void Discord_EndPlugin(); void Discord_UpdateInfo(BOOL bGameActive); #endif /* include-once check. */
/* This file is part of libmspack. * (C) 2003-2004 Stuart Caie. * * The deflate method was created by Phil Katz. MSZIP is equivalent to the * deflate method. * * libmspack is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License (LGPL) version 2.1 * * For further details, see the file COPYING.LIB distributed with libmspack */ #ifndef MSPACK_MSZIP_H #define MSPACK_MSZIP_H 1 /* MSZIP (deflate) compression / (inflate) decompression definitions */ #define MSZIP_FRAME_SIZE (32768) /* size of LZ history window */ #define MSZIP_MAX_HUFFBITS (16) /* maximum huffman code length */ #define MSZIP_LITERAL_MAXSYMBOLS (288) /* literal/length huffman tree */ #define MSZIP_LITERAL_TABLEBITS (9) #define MSZIP_DISTANCE_MAXSYMBOLS (32) /* distance huffman tree */ #define MSZIP_DISTANCE_TABLEBITS (6) /* if there are less direct lookup entries than symbols, the longer * code pointers will be <= maxsymbols. This must not happen, or we * will decode entries badly */ #if (1 << MSZIP_LITERAL_TABLEBITS) < (MSZIP_LITERAL_MAXSYMBOLS * 2) # define MSZIP_LITERAL_TABLESIZE (MSZIP_LITERAL_MAXSYMBOLS * 4) #else # define MSZIP_LITERAL_TABLESIZE ((1 << MSZIP_LITERAL_TABLEBITS) + \ (MSZIP_LITERAL_MAXSYMBOLS * 2)) #endif #if (1 << MSZIP_DISTANCE_TABLEBITS) < (MSZIP_DISTANCE_MAXSYMBOLS * 2) # define MSZIP_DISTANCE_TABLESIZE (MSZIP_DISTANCE_MAXSYMBOLS * 4) #else # define MSZIP_DISTANCE_TABLESIZE ((1 << MSZIP_DISTANCE_TABLEBITS) + \ (MSZIP_DISTANCE_MAXSYMBOLS * 2)) #endif struct mszipd_stream { struct mspack_system *sys; /* I/O routines */ struct mspack_file *input; /* input file handle */ struct mspack_file *output; /* output file handle */ unsigned int window_posn; /* offset within window */ /* inflate() will call this whenever the window should be emptied. */ int (*flush_window)(struct mszipd_stream *, unsigned int); int error, repair_mode, bytes_output, input_end; /* I/O buffering */ unsigned char *inbuf, *i_ptr, *i_end, *o_ptr, *o_end; unsigned int bit_buffer, bits_left, inbuf_size; /* huffman code lengths */ unsigned char LITERAL_len[MSZIP_LITERAL_MAXSYMBOLS]; unsigned char DISTANCE_len[MSZIP_DISTANCE_MAXSYMBOLS]; /* huffman decoding tables */ unsigned short LITERAL_table [MSZIP_LITERAL_TABLESIZE]; unsigned short DISTANCE_table[MSZIP_DISTANCE_TABLESIZE]; /* 32kb history window */ unsigned char window[MSZIP_FRAME_SIZE]; }; /* allocates MS-ZIP decompression stream for decoding the given stream. * * - uses system->alloc() to allocate memory * * - returns NULL if not enough memory * * - input_buffer_size is how many bytes to use as an input bitstream buffer * * - if repair_mode is non-zero, errors in decompression will be skipped * and 'holes' left will be filled with zero bytes. This allows at least * a partial recovery of erroneous data. */ extern struct mszipd_stream *mszipd_init(struct mspack_system *system, struct mspack_file *input, struct mspack_file *output, int input_buffer_size, int repair_mode); /* decompresses, or decompresses more of, an MS-ZIP stream. * * - out_bytes of data will be decompressed and the function will return * with an MSPACK_ERR_OK return code. * * - decompressing will stop as soon as out_bytes is reached. if the true * amount of bytes decoded spills over that amount, they will be kept for * a later invocation of mszipd_decompress(). * * - the output bytes will be passed to the system->write() function given in * mszipd_init(), using the output file handle given in mszipd_init(). More * than one call may be made to system->write() * * - MS-ZIP will read input bytes as necessary using the system->read() * function given in mszipd_init(), using the input file handle given in * mszipd_init(). This will continue until system->read() returns 0 bytes, * or an error. */ extern int mszipd_decompress(struct mszipd_stream *zip, off_t out_bytes); /* frees all stream associated with an MS-ZIP data stream * * - calls system->free() using the system pointer given in mszipd_init() */ void mszipd_free(struct mszipd_stream *zip); #endif
/* Copyright (c) 2010 Fizians SAS. <http://www.fizians.com> This file is part of Rozofs. Rozofs 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. Rozofs 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 EXPORT_INTERNAL_CHANNEL_H #define EXPORT_INTERNAL_CHANNEL_H #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <fcntl.h> #include <errno.h> #include <stdarg.h> #include <unistd.h> #include <time.h> #include "config.h" #include <rozofs/rozofs.h> #include <rozofs/common/log.h> #include <rozofs/common/types.h> #include <rozofs/core/ruc_common.h> #include <rozofs/core/ruc_sockCtl_api.h> #include <rozofs/rpc/gwproto.h> typedef struct expgwc_internal_channel_conf_t { int internalSocket[2]; /* -1 if N.S */ void * intSockconnectionId[2]; /* -1: connection id returned by the sock Ctrl */ } expgwc_internal_channel_conf_t; #define EXPORTDNB_INTERNAL_CHAN_SEND_SZ_MAX (1024*32) /**< xmit buffer size for the internal channel*/ #define EXPORTDNB_INTERNAL_CHAN_RECV_SZ_MAX (1024*32) /**< receive buffer size for the internal channel*/ typedef enum { EXPGWC_NULL = 0, EXPGWC_LOAD_CONF = 1, /**< opcode for adding the export gateway configuration */ EXPORT_LOAD_CONF = 2 /**< opcode for exportd configuration reload */ } expgwc_internal_channel_opcode_e; /** * message structue echanged between the thread that monitor the port configuration of * a load balancing group and the non blocking entity * The goal of the exchange is to trigger the configuration of the ports once the * the storage provides its listening ports */ typedef struct _expgwc_int_chan_msg_t { uint32_t opcode; uint32_t length; /**< length of the payload */ } expgwc_int_chan_msg_t; typedef struct _export_reload_conf_status_t { int done; /**< assert to 1 when the configuration has been processed */ int status; /**< reload configuration status */ } export_reload_conf_status_t; extern export_reload_conf_status_t export_reload_conf_status; extern gw_configuration_t expgw_conf_local; extern int expgw_configuration_available; /* *_______________________________________________________________________ */ /** * API to return the max payload length for internal channel xmit @param none @retval effective payload length of the buffer */ static inline uint32_t expgwc_get_internal_channel_buf_send_size() { return (EXPORTDNB_INTERNAL_CHAN_SEND_SZ_MAX - sizeof(expgwc_int_chan_msg_t)); } /* *_______________________________________________________________________ */ /** * send a message on the internal channel The message to send is copied in a pre-allocated buffer The message must not exceed the size of the pre-allocated buffer otherwise the message is rejected If the message has been allocated by a malloc() it is up to the calling function to release it. @param opcode : opcode of the message to send @param length : length of the message @param message : pointer to the message to send @retval 0 : success @retval <0 : error (see errno) */ int expgwc_internal_channel_send(uint32_t opcode,uint32_t length, void *message ); /* *_______________________________________________________________________ */ /** * reload of the configuration initiated from the non-blocking thread @param none @retval 0 on success @retval -1 on error */ int export_reload_nb(); /* *_______________________________________________________________________ */ expgwc_internal_channel_conf_t *expgwc_sup_getObjRef(); uint32_t expgwc_sup_getIntSockIdxFromSocketId(expgwc_internal_channel_conf_t *p,int socketId); uint32_t expgwc_sup_rcvReadyInternalSock(void * not_significant,int socketId); uint32_t expgwc_internal_channel_recv_cbk(void * not_significant,int socketId); uint32_t expgwc_sup_xmitReadyInternalSock(void * not_significant,int socketId); uint32_t expgwc_sup_xmitEvtInternalSock(void * not_significant,int socketId); uint32_t expgwc_sup_createInternalSocket(expgwc_internal_channel_conf_t *p); uint32_t expgwc_sup_deleteInternalSocket(expgwc_internal_channel_conf_t *p); uint32_t expgwc_int_chan_moduleInit(); int gw_configuration_1_nblocking(gw_configuration_t *argp, int lbg_id,void *ctx_p); int gw_poll_1_nblocking(gw_header_t *argp, int lbg_id,void *ctx_p); #endif
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ // Copyright (c) 2010 The Trustees of Princeton University (Trustees) // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and/or hardware specification (the “Work”) to deal // in the Work without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Work, and to permit persons to whom the Work 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 Work. // THE WORK 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 WORK OR THE USE OR OTHER // DEALINGS IN THE WORK. #include <libserval/serval.h> #include <netinet/serval.h> #include <sys/socket.h> #include <errno.h> #include <stdlib.h> #include <ctype.h> #include <unistd.h> #include <signal.h> #include <sys/time.h> static unsigned short ECHO_SERVICE_ID = 16383; static unsigned short CLIENT_SERVICE_ID = 4583; static unsigned short BACKCHANNEL_PORT = 9899; static int sock; static int sock_backchannel; void signal_handler(int sig) { printf("signal caught! closing socket...\n"); //close(sock); } int set_reuse_ok(int soc) { int option = 1; if (setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)) < 0) { fprintf(stderr, "proxy setsockopt error"); return -1; } return 0; } int client(char *ip) { struct sockaddr_sv srvaddr; struct sockaddr_sv cliaddr; struct sockaddr_in myaddr; struct sockaddr_in dummyaddr; int dummysize; int ret = 0; unsigned N = 2000; char sbuf[N]; char rbuf[N+1]; sock_backchannel = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock_backchannel == -1) { fprintf(stderr, "socket: %s\n", strerror_sv(errno)); return -1; } set_reuse_ok(sock_backchannel); memset((char *)&myaddr, 0, sizeof(myaddr)); myaddr.sin_family = AF_INET; inet_aton(ip, &myaddr.sin_addr); myaddr.sin_port = htons(BACKCHANNEL_PORT); bind(sock_backchannel, (struct sockaddr *)&myaddr, sizeof(myaddr)); bzero(&srvaddr, sizeof(srvaddr)); srvaddr.sv_family = AF_SERVAL; srvaddr.sv_srvid.s_sid32[0] = htonl(ECHO_SERVICE_ID); sock = socket_sv(AF_SERVAL, SOCK_DGRAM, SERVAL_PROTO_UDP); if (sock == -1) { fprintf(stderr, "socket: %s\n", strerror_sv(errno)); return -1; } set_reuse_ok(sock); bzero(&cliaddr, sizeof(cliaddr)); cliaddr.sv_family = AF_SERVAL; cliaddr.sv_srvid.s_sid32[0] = htonl(CLIENT_SERVICE_ID); ret = bind_sv(sock, (struct sockaddr *) &cliaddr, sizeof(cliaddr)); if (ret < 0) { fprintf(stderr, "bind: %s\n", strerror_sv(errno)); return -1; } ret = connect_sv(sock, (struct sockaddr *)&srvaddr, sizeof(srvaddr)); if (ret < 0) { fprintf(stderr, "connect: %s\n", strerror_sv(errno)); return -1; } printf("connected\n"); while (1) { sprintf(sbuf, "ping %s %d", ip, BACKCHANNEL_PORT); printf("client: sending \"%s\" to service ID %s\n", sbuf, service_id_to_str(&srvaddr.sv_srvid)); ret = sendto_sv(sock, sbuf, strlen(sbuf), 0, (struct sockaddr *)&srvaddr, sizeof(srvaddr)); if (ret < 0) { fprintf(stderr, "send failed (%s)\n", strerror_sv(errno)); break; } ret = recvfrom(sock_backchannel, rbuf, N, 0, (struct sockaddr *)&dummyaddr, &dummysize); rbuf[ret] = 0; if (ret == 0) { printf("server closed\n"); break; } else { printf("Response from server: %s\n", rbuf); if (strcmp(sbuf, "quit") == 0) break; } sleep(1); } if (close_sv(sock) < 0) fprintf(stderr, "close: %s\n", strerror_sv(errno)); return ret; } int main(int argc, char **argv) { struct sigaction action; int ret; memset(&action, 0, sizeof(struct sigaction)); action.sa_handler = signal_handler; /* The server should shut down on these signals. */ //sigaction(SIGTERM, &action, 0); //sigaction(SIGHUP, &action, 0); //sigaction(SIGINT, &action, 0); ret = client(argv[1]); printf("client done..\n"); return ret; }
#ifndef MOVABLE_H_ #define MOVABLE_H_ #include "Declarations.h" /* * Abstract base class to give objects movement functionality. * Should not have anything on its own that lets it be seen or clicked. */ class Movable { public: Movable() { velocity = std::move(VectorFloat(0, 0)); } virtual void move() = 0; //Get/setters VectorFloat getVelocity() const { return velocity; } void setVelocity(const VectorFloat newvel) { velocity = newvel; } protected: //Acceleration due to gravity will be constant, as it is in real life. VectorFloat getAcceleration(const Direction dir) const { return acceleration[int(dir)]; } private: //Position, held by the sprite, is translated by this during movement. VectorFloat velocity; //Remember, enum Direction order is SOUTH, EAST, NORTH, WEST. //Acceleration is not meant to change. Should be accessed by enum. static const VectorFloat acceleration[4]; }; #endif // MOVABLE_H_
/* arch/arm/mach-msm/io.c * * MSM7K, QSD io support * * Copyright (C) 2007 Google, Inc. * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. * Author: Brian Swetland <swetland@google.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. * */ #include <linux/kernel.h> #include <linux/export.h> #include <linux/init.h> #include <linux/io.h> #include <mach/hardware.h> #include <asm/page.h> #include <mach/msm_iomap.h> #include <asm/mach/map.h> #include <mach/board.h> #define MSM_CHIP_DEVICE(name, chip) { \ .virtual = (unsigned long) MSM_##name##_BASE, \ .pfn = __phys_to_pfn(chip##_##name##_PHYS), \ .length = chip##_##name##_SIZE, \ .type = MT_DEVICE_NONSHARED, \ } #define MSM_DEVICE(name) MSM_CHIP_DEVICE(name, MSM) #if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_MSM7X27) \ || defined(CONFIG_ARCH_MSM7X25) static struct map_desc msm_io_desc[] __initdata = { MSM_DEVICE(VIC), MSM_DEVICE(GPT), MSM_DEVICE(DMOV), MSM_DEVICE(GPIO1), MSM_DEVICE(GPIO2), MSM_DEVICE(GPIOCFG1), MSM_DEVICE(GPIOCFG2), // MSM_DEVICE(CSR), MSM_DEVICE(CLK_CTL), MSM_DEVICE(MDP), MSM_DEVICE(MDC), MSM_DEVICE(IMEM), MSM_DEVICE(SSBI), MSM_DEVICE(TSSC), MSM_DEVICE(AXI), MSM_DEVICE(AXIGS), #ifdef CONFIG_MSM_DEBUG_UART MSM_DEVICE(DEBUG_UART), #endif #ifdef CONFIG_ARCH_MSM7X30 MSM_DEVICE(GCC), #endif MSM_DEVICE(AD5), { .virtual = (unsigned long) MSM_SHARED_RAM_BASE, .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), .length = MSM_SHARED_RAM_SIZE, .type = MT_DEVICE, }, { .virtual = (unsigned long) MSM_SPL_BASE, .pfn = __phys_to_pfn(MSM_SPL_PHYS), .length = MSM_SPL_SIZE, .type = MT_DEVICE, }, }; void __init msm_map_common_io(void) { /* Make sure the peripheral register window is closed, since * we will use PTE flags (TEX[1]=1,B=0,C=1) to determine which * pages are peripheral interface or not. */ asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0)); iotable_init(msm_io_desc, ARRAY_SIZE(msm_io_desc)); } #endif #ifdef CONFIG_ARCH_QSD8X50 static struct map_desc qsd8x50_io_desc[] __initdata = { MSM_DEVICE(VIC), MSM_CHIP_DEVICE(CSR, QSD8X50), MSM_DEVICE(DMOV), MSM_DEVICE(GPIO1), MSM_DEVICE(GPIO2), MSM_DEVICE(CLK_CTL), MSM_DEVICE(SIRC), MSM_DEVICE(SCPLL), MSM_DEVICE(AD5), MSM_DEVICE(MDC), #ifdef CONFIG_MSM_DEBUG_UART MSM_DEVICE(DEBUG_UART), #endif { .virtual = (unsigned long) MSM_SHARED_RAM_BASE, .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), .length = MSM_SHARED_RAM_SIZE, .type = MT_DEVICE, }, }; void __init msm_map_qsd8x50_io(void) { iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc)); } #endif /* CONFIG_ARCH_QSD8X50 */ #ifdef CONFIG_ARCH_MSM8X60 static struct map_desc msm8x60_io_desc[] __initdata = { MSM_CHIP_DEVICE(QGIC_DIST, MSM8X60), MSM_CHIP_DEVICE(QGIC_CPU, MSM8X60), MSM_CHIP_DEVICE(TMR, MSM8X60), MSM_CHIP_DEVICE(TMR0, MSM8X60), MSM_DEVICE(ACC), MSM_DEVICE(GCC), }; void __init msm_map_msm8x60_io(void) { iotable_init(msm8x60_io_desc, ARRAY_SIZE(msm8x60_io_desc)); } #endif /* CONFIG_ARCH_MSM8X60 */ #ifdef CONFIG_ARCH_MSM8960 static struct map_desc msm8960_io_desc[] __initdata = { MSM_CHIP_DEVICE(QGIC_DIST, MSM8960), MSM_CHIP_DEVICE(QGIC_CPU, MSM8960), MSM_CHIP_DEVICE(TMR, MSM8960), MSM_CHIP_DEVICE(TMR0, MSM8960), }; void __init msm_map_msm8960_io(void) { iotable_init(msm8960_io_desc, ARRAY_SIZE(msm8960_io_desc)); } #endif /* CONFIG_ARCH_MSM8960 */ #ifdef CONFIG_ARCH_MSM7X30 static struct map_desc msm7x30_io_desc[] __initdata = { MSM_DEVICE(VIC), MSM_CHIP_DEVICE(CSR, MSM7X30), MSM_DEVICE(DMOV), MSM_DEVICE(GPIO1), MSM_DEVICE(GPIO2), MSM_DEVICE(CLK_CTL), MSM_DEVICE(CLK_CTL_SH2), MSM_DEVICE(AD5), MSM_DEVICE(MDC), MSM_DEVICE(ACC), MSM_DEVICE(SAW), MSM_DEVICE(GCC), MSM_DEVICE(TCSR), #ifdef CONFIG_MSM_DEBUG_UART MSM_DEVICE(DEBUG_UART), #endif { .virtual = (unsigned long) MSM_SHARED_RAM_BASE, .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), .length = MSM_SHARED_RAM_SIZE, .type = MT_DEVICE, }, }; void __init msm_map_msm7x30_io(void) { iotable_init(msm7x30_io_desc, ARRAY_SIZE(msm7x30_io_desc)); } #endif /* CONFIG_ARCH_MSM7X30 */ void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size, unsigned int mtype, void *caller) { if (mtype == MT_DEVICE) { /* The peripherals in the 88000000 - D0000000 range * are only accessible by type MT_DEVICE_NONSHARED. * Adjust mtype as necessary to make this "just work." */ if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000)) mtype = MT_DEVICE_NONSHARED; } return __arm_ioremap_caller(phys_addr, size, mtype, caller); }
#ifndef Texture_H #define Texture_H #include <memory> #include <jni.h> #include "src/AndEngineScriptingExtension.h" #include "src/Wrapper.h" #include "src/org/andengine/opengl/texture/ITexture.h" #include "src/org/andengine/opengl/texture/TextureManager.h" #include "src/org/andengine/opengl/texture/PixelFormat.h" #include "src/org/andengine/opengl/texture/TextureOptions.h" #include "src/org/andengine/opengl/texture/ITextureStateListener.h" extern "C" { JNIEXPORT void JNICALL Java_org_andengine_extension_scripting_opengl_texture_TextureProxy_nativeInitClass(JNIEnv*, jclass); } class Texture : public Wrapper, public ITexture { public: Texture(jobject); virtual jobject unwrap(); Texture(TextureManager*, PixelFormat*, TextureOptions*, ITextureStateListener*); Texture(); protected: private: }; #endif
#ifndef _PACKET_QUEUE_H_ #define _PACKET_QUEUE_H_ #include <packos/packet.h> typedef struct PackosPacketQueue { PackosPacket** packets; uint16_t capacity,start,count; }* PackosPacketQueue; PackosPacketQueue PackosPacketQueueNew(int capacity, PackosError* error); int PackosPacketQueueDelete(PackosPacketQueue queue, PackosError* error); int PackosPacketQueueEnqueue(PackosPacketQueue queue, PackosPacket* packet, PackosError* error); PackosPacket* PackosPacketQueueDequeue(PackosPacketQueue queue, byte protocolExpected, PackosError* error); bool PackosPacketQueueNonEmpty(PackosPacketQueue queue, PackosError* error); #endif /*_PACKET_QUEUE_H_*/
#ifndef CGIT_H #define CGIT_H #include <git-compat-util.h> #include <cache.h> #include <grep.h> #include <object.h> #include <tree.h> #include <commit.h> #include <tag.h> #include <diff.h> #include <diffcore.h> #include <refs.h> #include <revision.h> #include <log-tree.h> #include <archive.h> #include <xdiff/xdiff.h> #include <utf8.h> /* * Dateformats used on misc. pages */ #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" #define FMT_SHORTDATE "%Y-%m-%d" #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" /* * Limits used for relative dates */ #define TM_MIN 60 #define TM_HOUR (TM_MIN * 60) #define TM_DAY (TM_HOUR * 24) #define TM_WEEK (TM_DAY * 7) #define TM_YEAR (TM_DAY * 365) #define TM_MONTH (TM_YEAR / 12.0) /* * Default encoding */ #define PAGE_ENCODING "UTF-8" typedef void (*configfn)(const char *name, const char *value); typedef void (*filepair_fn)(struct diff_filepair *pair); typedef void (*linediff_fn)(char *line, int len); struct cgit_repo { char *url; char *name; char *path; char *desc; char *owner; char *defbranch; char *group; char *module_link; char *readme; char *clone_url; int snapshots; int enable_log_filecount; int enable_log_linecount; time_t mtime; }; struct cgit_repolist { int length; int count; struct cgit_repo *repos; }; struct commitinfo { struct commit *commit; char *author; char *author_email; unsigned long author_date; char *committer; char *committer_email; unsigned long committer_date; char *subject; char *msg; char *msg_encoding; }; struct taginfo { char *tagger; char *tagger_email; unsigned long tagger_date; char *msg; }; struct refinfo { const char *refname; struct object *object; union { struct taginfo *tag; struct commitinfo *commit; }; }; struct reflist { struct refinfo **refs; int alloc; int count; }; struct cgit_query { int has_symref; int has_sha1; char *raw; char *repo; char *page; char *search; char *grep; char *head; char *sha1; char *sha2; char *path; char *name; char *mimetype; char *url; int ofs; int nohead; char *sort; int showmsg; }; struct cgit_config { char *agefile; char *cache_root; char *clone_prefix; char *css; char *favicon; char *footer; char *index_header; char *index_info; char *logo; char *logo_link; char *module_link; char *repo_group; char *robots; char *root_title; char *root_desc; char *root_readme; char *script_name; char *virtual_root; int cache_size; int cache_dynamic_ttl; int cache_max_create_time; int cache_repo_ttl; int cache_root_ttl; int cache_static_ttl; int enable_index_links; int enable_log_filecount; int enable_log_linecount; int local_time; int max_repo_count; int max_commit_count; int max_lock_attempts; int max_msg_len; int max_repodesc_len; int nocache; int renamelimit; int snapshots; int summary_branches; int summary_log; int summary_tags; }; struct cgit_page { time_t modified; time_t expires; size_t size; char *mimetype; char *charset; char *filename; char *title; }; struct cgit_context { struct cgit_query qry; struct cgit_config cfg; struct cgit_repo *repo; struct cgit_page page; }; struct cgit_snapshot_format { const char *suffix; const char *mimetype; write_archive_fn_t write_func; int bit; }; extern const char *cgit_version; extern struct cgit_repolist cgit_repolist; extern struct cgit_context ctx; extern const struct cgit_snapshot_format cgit_snapshot_formats[]; extern struct cgit_repo *cgit_add_repo(const char *url); extern struct cgit_repo *cgit_get_repoinfo(const char *url); extern void cgit_repo_config_cb(const char *name, const char *value); extern int chk_zero(int result, char *msg); extern int chk_positive(int result, char *msg); extern int chk_non_negative(int result, char *msg); extern char *trim_end(const char *str, char c); extern char *strlpart(char *txt, int maxlen); extern char *strrpart(char *txt, int maxlen); extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, int flags, void *cb_data); extern void *cgit_free_commitinfo(struct commitinfo *info); extern int cgit_diff_files(const unsigned char *old_sha1, const unsigned char *new_sha1, linediff_fn fn); extern void cgit_diff_tree(const unsigned char *old_sha1, const unsigned char *new_sha1, filepair_fn fn, const char *prefix); extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); extern char *fmt(const char *format,...); extern struct commitinfo *cgit_parse_commit(struct commit *commit); extern struct taginfo *cgit_parse_tag(struct tag *tag); extern void cgit_parse_url(const char *url); extern const char *cgit_repobasename(const char *reponame); extern int cgit_parse_snapshots_mask(const char *str); #endif /* CGIT_H */
#include "blaswrap.h" #include "f2c.h" /* Subroutine */ int cgeru_(integer *m, integer *n, complex *alpha, complex * x, integer *incx, complex *y, integer *incy, complex *a, integer *lda) { /* System generated locals */ integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5; complex q__1, q__2; /* Local variables */ static integer info; static complex temp; static integer i__, j, ix, jy, kx; extern /* Subroutine */ int xerbla_(char *, integer *); #define a_subscr(a_1,a_2) (a_2)*a_dim1 + a_1 #define a_ref(a_1,a_2) a[a_subscr(a_1,a_2)] /* Purpose ======= CGERU performs the rank 1 operation A := alpha*x*y' + A, where alpha is a scalar, x is an m element vector, y is an n element vector and A is an m by n matrix. Parameters ========== M - INTEGER. On entry, M specifies the number of rows of the matrix A. M must be at least zero. Unchanged on exit. N - INTEGER. On entry, N specifies the number of columns of the matrix A. N must be at least zero. Unchanged on exit. ALPHA - COMPLEX . On entry, ALPHA specifies the scalar alpha. Unchanged on exit. X - COMPLEX array of dimension at least ( 1 + ( m - 1 )*abs( INCX ) ). Before entry, the incremented array X must contain the m element vector x. Unchanged on exit. INCX - INTEGER. On entry, INCX specifies the increment for the elements of X. INCX must not be zero. Unchanged on exit. Y - COMPLEX array of dimension at least ( 1 + ( n - 1 )*abs( INCY ) ). Before entry, the incremented array Y must contain the n element vector y. Unchanged on exit. INCY - INTEGER. On entry, INCY specifies the increment for the elements of Y. INCY must not be zero. Unchanged on exit. A - COMPLEX array of DIMENSION ( LDA, n ). Before entry, the leading m by n part of the array A must contain the matrix of coefficients. On exit, A is overwritten by the updated matrix. LDA - INTEGER. On entry, LDA specifies the first dimension of A as declared in the calling (sub) program. LDA must be at least max( 1, m ). Unchanged on exit. Level 2 Blas routine. -- Written on 22-October-1986. Jack Dongarra, Argonne National Lab. Jeremy Du Croz, Nag Central Office. Sven Hammarling, Nag Central Office. Richard Hanson, Sandia National Labs. Test the input parameters. Parameter adjustments */ --x; --y; a_dim1 = *lda; a_offset = 1 + a_dim1 * 1; a -= a_offset; /* Function Body */ info = 0; if (*m < 0) { info = 1; } else if (*n < 0) { info = 2; } else if (*incx == 0) { info = 5; } else if (*incy == 0) { info = 7; } else if (*lda < max(1,*m)) { info = 9; } if (info != 0) { xerbla_("CGERU ", &info); return 0; } /* Quick return if possible. */ if (*m == 0 || *n == 0 || alpha->r == 0.f && alpha->i == 0.f) { return 0; } /* Start the operations. In this version the elements of A are accessed sequentially with one pass through A. */ if (*incy > 0) { jy = 1; } else { jy = 1 - (*n - 1) * *incy; } if (*incx == 1) { i__1 = *n; for (j = 1; j <= i__1; ++j) { i__2 = jy; if (y[i__2].r != 0.f || y[i__2].i != 0.f) { i__2 = jy; q__1.r = alpha->r * y[i__2].r - alpha->i * y[i__2].i, q__1.i = alpha->r * y[i__2].i + alpha->i * y[i__2].r; temp.r = q__1.r, temp.i = q__1.i; i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = a_subscr(i__, j); i__4 = a_subscr(i__, j); i__5 = i__; q__2.r = x[i__5].r * temp.r - x[i__5].i * temp.i, q__2.i = x[i__5].r * temp.i + x[i__5].i * temp.r; q__1.r = a[i__4].r + q__2.r, q__1.i = a[i__4].i + q__2.i; a[i__3].r = q__1.r, a[i__3].i = q__1.i; /* L10: */ } } jy += *incy; /* L20: */ } } else { if (*incx > 0) { kx = 1; } else { kx = 1 - (*m - 1) * *incx; } i__1 = *n; for (j = 1; j <= i__1; ++j) { i__2 = jy; if (y[i__2].r != 0.f || y[i__2].i != 0.f) { i__2 = jy; q__1.r = alpha->r * y[i__2].r - alpha->i * y[i__2].i, q__1.i = alpha->r * y[i__2].i + alpha->i * y[i__2].r; temp.r = q__1.r, temp.i = q__1.i; ix = kx; i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = a_subscr(i__, j); i__4 = a_subscr(i__, j); i__5 = ix; q__2.r = x[i__5].r * temp.r - x[i__5].i * temp.i, q__2.i = x[i__5].r * temp.i + x[i__5].i * temp.r; q__1.r = a[i__4].r + q__2.r, q__1.i = a[i__4].i + q__2.i; a[i__3].r = q__1.r, a[i__3].i = q__1.i; ix += *incx; /* L30: */ } } jy += *incy; /* L40: */ } } return 0; /* End of CGERU . */ } /* cgeru_ */ #undef a_ref #undef a_subscr
/******************************************************************************\ * Copyright (c) 2016 Albrecht Lohofener <albrechtloh@gmx.de> * * Author(s): * Albrecht Lohofener * * Description: * The classes provides a list to store the station and channel information * * ****************************************************************************** * * 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 MOTIMAGEPROVIDER_H #define MOTIMAGEPROVIDER_H #include <memory> #include <list> #include <QObject> #include <QQuickImageProvider> class motPicture; class CMOTImageProvider : public QQuickImageProvider { public: CMOTImageProvider(); QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); void setPixmap(QPixmap Pixmap, QString pictureName); void clear(); void saveAll(); private: std::list<std::shared_ptr<motPicture>> pictureList; }; class motPicture { public: motPicture(QPixmap data, QString name); void setData(QPixmap data); void save(); QPixmap data; QString name; }; #endif // MOTIMAGEPROVIDER_H
/* * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_VFS_H #define LINUX_NFSD_VFS_H #include "nfsfh.h" #include "nfsd.h" /* * Flags for nfsd_permission */ #define NFSD_MAY_NOP 0 #define NFSD_MAY_EXEC 0x001 /* == MAY_EXEC */ #define NFSD_MAY_WRITE 0x002 /* == MAY_WRITE */ #define NFSD_MAY_READ 0x004 /* == MAY_READ */ #define NFSD_MAY_SATTR 0x008 #define NFSD_MAY_TRUNC 0x010 #define NFSD_MAY_LOCK 0x020 #define NFSD_MAY_MASK 0x03f /* extra hints to permission and open routines: */ #define NFSD_MAY_OWNER_OVERRIDE 0x040 #define NFSD_MAY_LOCAL_ACCESS 0x080 /* for device special files */ #define NFSD_MAY_BYPASS_GSS_ON_ROOT 0x100 #define NFSD_MAY_NOT_BREAK_LEASE 0x200 #define NFSD_MAY_BYPASS_GSS 0x400 #define NFSD_MAY_READ_IF_EXEC 0x800 #define NFSD_MAY_64BIT_COOKIE 0x1000 /* 64 bit readdir cookies for >= NFSv3 */ #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) /* * Callback function for readdir */ typedef int (*nfsd_filldir_t)(void *, const char *, int, loff_t, u64, unsigned); /* nfsd/vfs.c */ int nfsd_racache_init(int); void nfsd_racache_shutdown(void); int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, struct svc_export **expp); __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, const char *, unsigned int, struct svc_fh *); __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, const char *, unsigned int, struct svc_export **, struct dentry **); __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, struct iattr *, int, time_t); int nfsd_mountpoint(struct dentry *, struct svc_export *); #ifdef CONFIG_NFSD_V4 __be32 nfsd4_set_nfs4_label(struct svc_rqst *, struct svc_fh *, struct xdr_netobj *); __be32 nfsd4_vfs_fallocate(struct svc_rqst *, struct svc_fh *, struct file *, loff_t, loff_t, int); __be32 nfsd4_clone_file_range(struct file *, u64, struct file *, u64, u64); #endif /* CONFIG_NFSD_V4 */ __be32 nfsd_create_locked(struct svc_rqst *, struct svc_fh *, char *name, int len, struct iattr *attrs, int type, dev_t rdev, struct svc_fh *res); __be32 nfsd_create(struct svc_rqst *, struct svc_fh *, char *name, int len, struct iattr *attrs, int type, dev_t rdev, struct svc_fh *res); #ifdef CONFIG_NFSD_V3 __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); __be32 do_nfsd_create(struct svc_rqst *, struct svc_fh *, char *name, int len, struct iattr *attrs, struct svc_fh *res, int createmode, u32 *verifier, bool *truncp, bool *created); __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, loff_t, unsigned long); #endif /* CONFIG_NFSD_V3 */ __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t, int, struct file **); struct raparms; __be32 nfsd_splice_read(struct svc_rqst *, struct file *, loff_t, unsigned long *); __be32 nfsd_readv(struct file *, loff_t, struct kvec *, int, unsigned long *); __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, loff_t, struct kvec *, int, unsigned long *); __be32 nfsd_write(struct svc_rqst *, struct svc_fh *, loff_t, struct kvec *, int, unsigned long *, int); __be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, int stable); __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, char *, int *); __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, char *name, int len, char *path, struct svc_fh *res); __be32 nfsd_link(struct svc_rqst *, struct svc_fh *, char *, int, struct svc_fh *); ssize_t nfsd_copy_file_range(struct file *, u64, struct file *, u64, u64); __be32 nfsd_rename(struct svc_rqst *, struct svc_fh *, char *, int, struct svc_fh *, char *, int); __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, char *name, int len); __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, loff_t *, struct readdir_cd *, nfsd_filldir_t); __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, struct kstatfs *, int access); __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, struct dentry *, int); struct raparms *nfsd_init_raparms(struct file *file); void nfsd_put_raparams(struct file *file, struct raparms *ra); static inline int fh_want_write(struct svc_fh *fh) { int ret = mnt_want_write(fh->fh_export->ex_path.mnt); if (!ret) fh->fh_want_write = true; return ret; } static inline void fh_drop_write(struct svc_fh *fh) { if (fh->fh_want_write) { fh->fh_want_write = false; mnt_drop_write(fh->fh_export->ex_path.mnt); } } static inline __be32 fh_getattr(struct svc_fh *fh, struct kstat *stat) { struct path p = {.mnt = fh->fh_export->ex_path.mnt, .dentry = fh->fh_dentry}; return nfserrno(vfs_getattr(&p, stat)); } static inline int nfsd_create_is_exclusive(int createmode) { return createmode == NFS3_CREATE_EXCLUSIVE || createmode == NFS4_CREATE_EXCLUSIVE4_1; } static inline bool nfsd_eof_on_read(long requested, long read, loff_t offset, loff_t size) { /* We assume a short read means eof: */ if (requested > read) return true; /* * A non-short read might also reach end of file. The spec * still requires us to set eof in that case. * * Further operations may have modified the file size since * the read, so the following check is not atomic with the read. * We've only seen that cause a problem for a client in the case * where the read returned a count of 0 without setting eof. * That case was fixed by the addition of the above check. */ return (offset + read >= size); } #endif /* LINUX_NFSD_VFS_H */
/* ///////////////////////////////////////////////////////////////////////// */ /* This file is a part of the BSTools package */ /* written by Przemyslaw Kiciak */ /* ///////////////////////////////////////////////////////////////////////// */ /* (C) Copyright by Przemyslaw Kiciak, 2009, 2014 */ /* this package is distributed under the terms of the */ /* Lesser GNU Public License, see the file COPYING.LIB */ /* ///////////////////////////////////////////////////////////////////////// */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <malloc.h> #include <string.h> #include <ctype.h> #include "pkvaria.h" #include "pknum.h" #include "pkgeom.h" #include "camerad.h" #include "multibs.h" #include "bsfile.h" #include "bsfprivate.h" boolean bsf_WriteBSplinePatchd ( int spdimen, int cpdimen, boolean rational, int udeg, int lastknotu, const double *knotsu, int vdeg, int lastknotv, const double *knotsv, boolean closed_u, boolean closed_v, int pitch, const double *cpoints, const char *name, int ident, bsf_WriteAttr_fptr WriteAttr, void *userData ) { int sci; sci = bsf_current_indentation; BSFwci bsf_current_length += fprintf ( bsf_output, "%s", "%B-spline patch" ); BSFeol BSFwci bsf_current_length += fprintf ( bsf_output, "%s {", bsf_keyword[BSF_SYMB_BSPATCH-BSF_FIRST_KEYWORD] ); BSFeol bsf_current_indentation += 2; if ( name && *name ) { BSFwci bsf_current_length += fprintf ( bsf_output, "%s \"%s\"", bsf_keyword[BSF_SYMB_NAME-BSF_FIRST_KEYWORD], name ); BSFeol } bsf_WriteIdent ( ident ); bsf_WriteSpaceDim ( spdimen, rational ); bsf_WritePatchDegree ( udeg, vdeg ); BSFwci bsf_current_length += fprintf ( bsf_output, "%s", bsf_keyword[BSF_SYMB_KNOTS_U-BSF_FIRST_KEYWORD] ); bsf_WriteKnotSequenced ( lastknotu, knotsu, closed_u ); BSFwci bsf_current_length += fprintf ( bsf_output, "%s", bsf_keyword[BSF_SYMB_KNOTS_V-BSF_FIRST_KEYWORD] ); bsf_WriteKnotSequenced ( lastknotv, knotsv, closed_v ); BSFwci bsf_current_length += fprintf ( bsf_output, "%s ", bsf_keyword[BSF_SYMB_CPOINTS-BSF_FIRST_KEYWORD] ); bsf_current_indentation += 2; bsf_WritePointsd ( cpdimen, lastknotu-udeg, lastknotv-vdeg, pitch, cpoints ); bsf_current_indentation -= 2; if ( WriteAttr ) WriteAttr ( userData ); bsf_current_length += fprintf ( bsf_output, "}" ); BSFeol bsf_current_indentation = sci; return true; } /*bsf_WriteBSplinePatchd*/
/* For debugging general purposes */ #ifndef __PERF_DEBUG_H #define __PERF_DEBUG_H #include <stdbool.h> #include "event.h" #include "../ui/helpline.h" #include "../ui/progress.h" #include "../ui/util.h" extern int verbose; extern bool quiet, dump_trace; int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); void trace_event(union perf_event *event); int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); int ui__error_paranoid(void); #endif /* __PERF_DEBUG_H */
/* * (C) Copyright 2000 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it * * See file CREDITS for list of people who contributed to this * project. * * 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. * */ #ifndef _CONSOLE_H_ #define _CONSOLE_H_ #include <param.h> #include <linux/list.h> #include <driver.h> #define CONSOLE_STDIN (1 << 0) #define CONSOLE_STDOUT (1 << 1) #define CONSOLE_STDERR (1 << 2) enum console_mode { CONSOLE_MODE_NORMAL, CONSOLE_MODE_RS485, }; struct console_device { struct device_d *dev; struct device_d class_dev; int (*tstc)(struct console_device *cdev); void (*putc)(struct console_device *cdev, char c); int (*puts)(struct console_device *cdev, const char *s); int (*getc)(struct console_device *cdev); int (*setbrg)(struct console_device *cdev, int baudrate); void (*flush)(struct console_device *cdev); int (*set_mode)(struct console_device *cdev, enum console_mode mode); int (*set_active)(struct console_device *cdev, unsigned active); char *devname; int devid; struct list_head list; unsigned char f_active; char active[4]; unsigned int baudrate; unsigned int baudrate_param; const char *linux_console_name; }; int console_register(struct console_device *cdev); int console_unregister(struct console_device *cdev); struct console_device *console_get_by_dev(struct device_d *dev); struct console_device *console_get_by_name(const char *name); extern struct list_head console_list; #define for_each_console(console) list_for_each_entry(console, &console_list, list) #define CFG_PBSIZE (CONFIG_CBSIZE+sizeof(CONFIG_PROMPT)+16) bool console_is_input_allow(void); void console_allow_input(bool val); extern int barebox_loglevel; struct console_device *console_get_first_active(void); int console_set_active(struct console_device *cdev, unsigned active); unsigned console_get_active(struct console_device *cdev); int console_set_baudrate(struct console_device *cdev, unsigned baudrate); unsigned console_get_baudrate(struct console_device *cdev); #endif
fun(int foo, int bar) { return 0; } int main(void) { return 0; }
/* pmacct (Promiscuous mode IP Accounting package) pmacct is Copyright (C) 2003-2014 by Paolo Lucente */ /* Originally based on Quagga BGP routing table which is: Copyright (C) 1998, 2001 Kunihiro Ishiguro GNU Zebra 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. GNU Zebra is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Zebra; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _BGP_TABLE_H_ #define _BGP_TABLE_H_ #define DEFAULT_BGP_INFO_HASH 13 #define DEFAULT_BGP_INFO_AS_PATHS_HASH 1 /* AFI and SAFI type. */ typedef u_int16_t afi_t; typedef u_int8_t safi_t; typedef enum { BGP_TABLE_MAIN, BGP_TABLE_RSCLIENT, } bgp_table_t; struct bgp_table { bgp_table_t type; /* afi/safi of this table */ afi_t afi; safi_t safi; /* The owner of this 'bgp_table' structure. */ void *owner; struct bgp_node *top; unsigned long count; }; struct bgp_node { struct prefix p; struct bgp_table *table; struct bgp_node *parent; struct bgp_node *link[2]; #define l_left link[0] #define l_right link[1] void **info; unsigned int lock; /* struct bgp_adj_out *adj_out; struct bgp_adj_in *adj_in; struct bgp_node *prn; unsigned int lock; u_char flags; #define BGP_NODE_PROCESS_SCHEDULED (1 << 0) */ }; struct bgp_info_extra { rd_t rd; u_char label[3]; path_id_t path_id; }; struct bgp_info { struct bgp_info *next; struct bgp_info *prev; struct bgp_peer *peer; struct bgp_attr *attr; struct bgp_info_extra *extra; }; /* Prototypes */ #if (!defined __BGP_TABLE_C) #define EXT extern #else #define EXT #endif EXT struct bgp_table *bgp_table_init (afi_t, safi_t); EXT void bgp_table_finish (struct bgp_table **); EXT void bgp_unlock_node (struct bgp_node *node); EXT struct bgp_node *bgp_table_top (const struct bgp_table *const); EXT struct bgp_node *bgp_route_next (struct bgp_node *); EXT struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *); EXT struct bgp_node *bgp_node_get (struct bgp_table *const, struct prefix *); EXT struct bgp_node *bgp_lock_node (struct bgp_node *node); EXT struct bgp_node *bgp_node_match (const struct bgp_table *, struct prefix *, struct bgp_peer *); EXT struct bgp_node *bgp_node_match_ipv4 (const struct bgp_table *, struct in_addr *, struct bgp_peer *); #ifdef ENABLE_IPV6 EXT struct bgp_node *bgp_node_match_ipv6 (const struct bgp_table *, struct in6_addr *, struct bgp_peer *); #endif /* ENABLE_IPV6 */ EXT unsigned long bgp_table_count (const struct bgp_table *const); #undef EXT #endif
/* * 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. * * Copyright (C) 2012 Sergey Lisitsyn */ #ifndef SPINVCOV_H_ #define SPINVCOV_H_ #include <shogun/base/SGObject.h> #include <shogun/lib/SGMatrix.h> namespace shogun { /** @brief used to estimate inverse covariance matrix using graphical lasso * * implementation is based on SLEP library's code */ class CSparseInverseCovariance : public CSGObject { public: /** constructor */ CSparseInverseCovariance(); /** destructor */ virtual ~CSparseInverseCovariance(); /** estimate inverse covariance matrix * * @param S empirical covariance matrix * @param lambda_C regularization constant */ SGMatrix<float64_t> estimate(SGMatrix<float64_t> S, float64_t lambda_c); /** get name */ const char* get_name() const { return "SparseInverseCovariance"; }; /** get lasso max iter * @return lasso max iter */ int32_t get_lasso_max_iter() const { return m_lasso_max_iter; } /** get max iter * @return max iter */ int32_t get_max_iter() const { return m_max_iter; } /** get lasso max iter * @return lasso max iter */ float64_t get_f_gap() const { return m_f_gap; } /** get lasso max iter * @return lasso max iter */ float64_t get_x_gap() const { return m_x_gap; } /** get lasso max iter * @return lasso max iter */ float64_t get_xtol() const { return m_xtol; } /** set lasso max iter * @param lasso_max_iter lasso max iter */ void set_lasso_max_iter(int32_t lasso_max_iter) { m_lasso_max_iter = lasso_max_iter; } /** set max iter * @param max_iter max iter */ void set_max_iter(int32_t max_iter) { m_max_iter = max_iter; } /** set f gap * @param f_gap f gap */ void set_f_gap(int32_t f_gap) { m_f_gap = f_gap; } /** set x gap * @param x_gap x gap */ void set_x_gap(int32_t x_gap) { m_x_gap = x_gap; } /** set xtol * @param xtol xtol */ void set_xtol(int32_t xtol) { m_xtol = xtol; } private: /** register parameters */ void register_parameters(); protected: /** LASSO max iter */ int32_t m_lasso_max_iter; /** max iter */ int32_t m_max_iter; /** fGap */ float64_t m_f_gap; /** xGap */ float64_t m_x_gap; /** xtol */ float64_t m_xtol; }; } #endif
#ifndef ORG_ESB_WEBSERVICE_EXPORTS #define ORG_ESB_WEBSERVICE_EXPORTS #if defined(_WIN32) #if defined(encodingtask_EXPORTS) #define ENCTASK_EXPORT __declspec( dllexport ) #else #define ENCTASK_EXPORT __declspec( dllimport ) #endif #else #define ENCTASK_EXPORT #endif #endif
/* Definitions for VAX running Linux-based GNU systems with ELF format. Copyright (C) 2007-2014 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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 GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS() /* We use GAS, G-float double and want new DI patterns. */ #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_QMATH | MASK_G_FLOAT) /* Use standard names for udiv and umod libgcc calls. */ #undef TARGET_BSD_DIVMOD #define TARGET_BSD_DIVMOD 0 #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" #undef ASM_SPEC #define ASM_SPEC "%{fpic|fPIC:-k}" #undef LINK_SPEC #define LINK_SPEC \ "%(endian_spec) \ %{shared:-shared} \ %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ -dynamic-linker /data/toolchain/lib/ld.so.1} \ %{static:-static}}" #undef WCHAR_TYPE #define WCHAR_TYPE "long int" #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD #undef STANDARD_STARTFILE_PREFIX_1 #undef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_1 "/data/toolchain/lib/" #define STANDARD_STARTFILE_PREFIX_2 ""
/* hello_world.c - The simplest kernel module. * * Copyright (C) 2001 by Peter Jay Salzman * * 08/02/2006 - Updated by Rodrigo Rubira Branco <rodrigo@kernelhacking.com> * 07/03/2014 - Updated by Jadjay <jadjay@rachetjay.fr> */ /* Kernel Programming */ #define MODULE #define LINUX #define __KERNEL__ #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_ALERT */ int init_module(void) { printk("<1>Hello_world\n"); printk("<1> _ _ _ _ _ _ _ \n"); printk("<1>| | | | ___| | | ___ __ _____ _ __| | __| | | |\n"); printk("<1>| |_| |/ _ \\ | |/ _ \\ \\ \\ /\\ / / _ \\| '__| |/ _` | | |\n"); printk("<1>| _ | __/ | | (_) | \\ V V / (_) | | | | (_| | |_|\n"); printk("<1>|_| |_|\\___|_|_|\\___/ \\_/\\_/ \\___/|_| |_|\\__,_| (_)\n"); printk("<1> \n"); return 0; } void cleanup_module(void) { printk(KERN_ALERT "Goodbye world\n"); printk(KERN_ALERT " ____ _ _ _ _ _ \n"); printk(KERN_ALERT " / ___| ___ ___ __| | |__ _ _ ___ __ _____ _ __| | __| | | |\n"); printk(KERN_ALERT "| | _ / _ \\ / _ \\ / _` | '_ \\| | | |/ _ \\ \\ \\ /\\ / / _ \\| '__| |/ _` | | |\n"); printk(KERN_ALERT "| |_| | (_) | (_) | (_| | |_) | |_| | __/ \\ V V / (_) | | | | (_| | |_|\n"); printk(KERN_ALERT " \\____|\\___/ \\___/ \\__,_|_.__/ \\__, |\\___| \\_/\\_/ \\___/|_| |_|\\__,_| (_)\n"); printk(KERN_ALERT " |___/ \n"); } MODULE_LICENSE("GPL");
#include <stdio.h> #include <stdlib.h> #include "liste.c" int main(void) { int x = 0; int i = 1; struct Tlist list, list2, list3; /* // Ajouts manuel printf("Saisissez 5 valeurs\n"); for (i; i <= 5; i++) { printf("\nv%d : ", i); scanf("%d", &x); list_add(list, x); } */ // Ajouts automatique list_add(&list, 2, 1); list_add(&list, 4, 0); list_add(&list, 6, 0); list_add(&list, 8, 0); list_add(&list, 10, 0); // Affichage printf("Liste initiale : "); list_print(&list); // Longueur printf("Longueur de la liste : %d\n", list_lenght(&list)); // Membre printf("6 membre de la liste : %d\n", list_member(&list, 6)); printf("13 membre de la liste : %d\n", list_member(&list, 13)); // Retire le dernier élément printf("Après suppression du dernier élément : "); list_remove_last(&list); list_print(&list); // Concaténation avec une seconde liste list_add(&list2, 3, 1); list_add(&list2, 5, 0); list_add(&list2, 7, 0); printf("Liste 2 : "); list_print(&list2); list3 = list_append(&list, &list2); printf("Concaténation des listes : "); list_print(&list3); // Libération mémoire printf("Libération mémoire\n"); list_free(&list); list_free(&list2); list_free(&list3); }
// // tesla-demo, an OpenGL|ES 1.1 port of Sunflower's original Tesla demo. // // Original Tesla code, Copyright (C) 2000 Sunflower // Linux EGL/X11 port by Ilyes Gouta, ilyes.gouta@gmail.com // // Port released under GNU General Public License with permission from // Konrad Zagorowicz, original developer from Sunflower. // // 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/>. // // programming by Yoghurt/Pulse v4.0 // date 16.01.1998 // copyright (C) by Konrad Zagorowicz // ********************************** #ifndef _LOAD3DS_H_INCLUDED_ #define _LOAD3DS_H_INCLUDED_ #ifdef _MSC_VER #ifdef _DEBUG #pragma comment(lib,"load3dsD.lib") #else #pragma comment(lib,"load3ds.lib") #endif #endif #ifdef __cplusplus extern "C" { #endif #define DEFAULT_FPS 60 #define DEFAULT_START_FRAME 0 extern scene_t *Load3ds(char *name); //extern void Save3d(char *name,scene_t *scene); #ifdef __cplusplus }; #endif #endif
#include <kernel/mm.h> #include <kernel/paging.h> #include <kernel/terminal.h> unsigned long round_next_page(unsigned long address) { unsigned long next_addr = 0; next_addr = (address + PAGE_SIZE) & 0xFFFFF000; return next_addr; } unsigned long round_previous_page(unsigned long address) { unsigned long next_addr = 0; next_addr = (address - PAGE_SIZE) & 0xFFFFF000; return next_addr; } unsigned long get_module_end(kernel_boot_info_t* info) { if(info->mbi->mods_count <= 0) return 0; multiboot_module_t* mods = ADDR_TO_KERNEL_BASE(info->mbi->mods_addr); return mods[info->mbi->mods_count - 1].mod_end; } void install_mm(kernel_boot_info_t* info) { // Convert it to Real Physical Address, We are in Higher Half Kernel unsigned long kernel_end = info->kernel_end - KERNEL_VIRTUAL_BASE; unsigned long module_end = get_module_end(info); if(module_end > 0) { kernel_end = module_end; } phys_alloc_start = round_next_page(kernel_end); printk("Allocation Starts at %x\n", phys_alloc_start); unsigned long mem_size = info->mbi->mem_upper * 1024; printk("Available Physical Memory : %dmb\n", mem_size >> 20); unsigned long last_page = round_previous_page(mem_size); printk("Last Block : %x\n", last_page); num_blocks = (last_page - (unsigned long)phys_alloc_start)/PAGE_SIZE; // Allocate memory for Mem Map and Make it Virtual mem_map = (unsigned long)phys_alloc_start + KERNEL_VIRTUAL_BASE; mem_map_size = num_blocks/(BITS_PER_BYTE*4); // set new allocation start Point phys_alloc_start += mem_map_size; printk("Memory Map Allocation Ends at %x\n", phys_alloc_start); // Make sure it starts on a new Block phys_alloc_start = round_next_page(phys_alloc_start); printk("Real Allocation Starts at %x\n", phys_alloc_start); num_blocks = (last_page - (unsigned long)phys_alloc_start)/PAGE_SIZE; printk("Number of Blocks: %d\n", num_blocks); printk("Mem Map: %x\n", mem_map); memset(mem_map, 0, mem_map_size * sizeof(unsigned long)); } void* new_block() { for(int i = 0; i < mem_map_size; i++) { unsigned long current = mem_map[i]; for(int j = 0; j < 4 * BITS_PER_BYTE; j++) { // Is the Block Empty if(!BIT_CHECK(current, j)) { BIT_SET(current, j); mem_map[i] = current; unsigned int frame = (i * 4 * BITS_PER_BYTE + j); unsigned long* address = ((unsigned long)phys_alloc_start) + (frame * PAGE_SIZE); //printk("Found Empty Block At frame=%d Address:%x\n",frame, address); return address; } } } return 0; } void delete_block(void* ptr) { unsigned long frame = (((unsigned long)ptr - (unsigned long)phys_alloc_start) & 0xFFFFF000 ) / PAGE_SIZE; unsigned long mem_map_offset = frame / (BITS_PER_BYTE * 4); unsigned short bit_offset = frame % (BITS_PER_BYTE * 4); BIT_CLEAR(mem_map[mem_map_offset], bit_offset); //printk("Removed Block At frame=%d Address:%x\n",frame, ptr); } void* get_blocks(unsigned long blocks) { if(blocks <= 1) return new_block(); int start_frame=-1; unsigned long free_blocks=0; unsigned short block_found = 0; for(int i = 0; i < mem_map_size; i++) { unsigned long current = mem_map[i]; for(int j = 0; j < 4 * BITS_PER_BYTE; j++) { // Is the Block Empty if(!BIT_CHECK(current, j)) { if(start_frame == -1) { start_frame = (i * 4 * BITS_PER_BYTE + j); } free_blocks++; if(free_blocks == blocks) break; } else { free_blocks=0; start_frame=-1; } } if(free_blocks == blocks) break; } if(free_blocks == blocks) { for(int i=0; i<blocks; i++) { int frame = start_frame + i; unsigned long mem_map_offset = frame / (BITS_PER_BYTE * 4); unsigned short bit_offset = frame % (BITS_PER_BYTE * 4); BIT_SET(mem_map[mem_map_offset], bit_offset); } unsigned long* address = ((unsigned long)phys_alloc_start) + (start_frame * PAGE_SIZE); //printk("Found Empty Blocks At frame=%d Address:%x | Blocks: %d\n",start_frame, address, blocks); return address; } return 0; } void free_blocks(void* ptr, unsigned long blocks) { unsigned long start_frame = (((unsigned long)ptr - (unsigned long)phys_alloc_start) & 0xFFFFF000 ) / PAGE_SIZE; for(int i=0; i<blocks; i++) { unsigned long frame = start_frame + i; unsigned long mem_map_offset = frame / (BITS_PER_BYTE * 4); unsigned short bit_offset = frame % (BITS_PER_BYTE * 4); BIT_CLEAR(mem_map[mem_map_offset], bit_offset); } //printk("Removed Blocks At frame=%d Address:%x | Blocks: %d\n",start_frame, ptr, blocks); }
#include <node.h> #include <nan.h> NAN_METHOD(newFileInstance); NAN_METHOD(newFileInstanceWin32); NAN_METHOD(newFileInstanceFromCopy); NAN_METHOD(newFileInstanceFromCopyWin32); NAN_METHOD(newMemoryInstance); NAN_METHOD(clearInstance); NAN_METHOD(setVerbose); NAN_METHOD(showWoT); NAN_METHOD(dumpWoT); NAN_METHOD(showGraph); NAN_METHOD(resetWoT); NAN_METHOD(getWoTSize); NAN_METHOD(addNode); NAN_METHOD(removeNode); NAN_METHOD(setMaxCert); NAN_METHOD(getMaxCert); NAN_METHOD(isEnabled); NAN_METHOD(setEnabled); NAN_METHOD(existsLink); NAN_METHOD(addLink); NAN_METHOD(removeLink); NAN_METHOD(isOutdistanced); NAN_METHOD(detailedDistance); // Data extraction NAN_METHOD(getSentries); NAN_METHOD(getNonSentries); NAN_METHOD(getDisabled); NAN_METHOD(getPaths);
#pragma once #include "colors.h" #include "convex_hull_image_mask.h" #include "framedata.h" #include "glLUTwidget.h" #include "gvector.h" #include "image.h" #include "lutwidget.h" #include "maskwidget.h" #include "visionplugin.h" #include <algorithm> #include <vector> class PluginMask : public VisionPlugin { protected: MaskWidget *_widget; VarList *_settings; ConvexHullImageMask &_mask; virtual void _mouseEvent(QMouseEvent *event, pixelloc loc); virtual void _addPoint(int x, int y); virtual void _removePoint(int x, int y); public: PluginMask(FrameBuffer *buffer, ConvexHullImageMask &mask); ~PluginMask() override; ProcessResult process(FrameData *data, RenderOptions *options) override; VarList *getSettings() override; std::string getName() override; QWidget *getControlWidget() override; void mousePressEvent(QMouseEvent *event, pixelloc loc) override; };
//============================================================================= /** @file parapet_callbacks.h * * @brief * Declaration of signatures for parapet Master/Slave callback functions * * @author Dave Billin */ //============================================================================= #ifndef PARAPET_CALLBACKS_H_ #define PARAPET_CALLBACKS_H_ #include <stdint.h> #ifdef __cplusplus namespace parapet { #endif //----------------------------------------------------------------------------- /** @enum parapet_event_id_t * @brief * Event ID's that may be reported by a parapet device node */ typedef enum { EVENT_HEADER_CHECKSUM_FAILURE = -1, /**< A header failed checksum validation */ EVENT_INVALID_PAYLOAD_COUNT = -1, /**< A header with an invalid Byte Count was detected */ } parapet_event_id_t; //----------------------------------------------------------------------------- /** @typedef parapet_rx_callback_fn * * @brief * Signature of a callback function called when a parapet packet is received * * @param Receiver * Pointer to the parapet_master_t or parapet_slave_t that received the packet * * @param Packet * Pointer to received packet data */ typedef void (*parapet_rx_callback_fn)( void* Receiver, parapet_packet_t* Packet ); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /** @typedef ParapetEventCallback * * @brief * Signature of a callback function called when an error or event occurs * while receiving parapet packet data * * @param Receiver * Pointer to the parapet_master_t or parapet_slave_t posting the event * * @param EventID * ID of the event */ typedef void (*parapet_event_callback_fn)( void* Receiver, parapet_event_id_t EventID ); //----------------------------------------------------------------------------- #ifdef __cplusplus } // END namespace parapet #endif #endif /* PARAPET_CALLBACKS_H_ */
/* * 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 DAILYMOTIONPLAYLISTDIALOG_H #define DAILYMOTIONPLAYLISTDIALOG_H #include "dialog.h" #include "dailymotionplaylistmodel.h" class DailymotionVideo; class ImageCache; class ListView; class QTabBar; class QStackedWidget; class QLineEdit; class QTextEdit; class QLabel; class QDialogButtonBox; class QGridLayout; class QModelIndex; class DailymotionPlaylistDialog : public Dialog { Q_OBJECT public: explicit DailymotionPlaylistDialog(DailymotionVideo *video, QWidget *parent); ~DailymotionPlaylistDialog(); private: void getPlaylists(); void showNewPlaylist(); void showPlaylists(); private Q_SLOTS: void addToPlaylist(const QModelIndex &index); void createNewPlaylist(); void onImageReady(); void onModelStatusChanged(QDailymotion::ResourcesRequest::Status status); void onPlaylistStatusChanged(QDailymotion::ResourcesRequest::Status status); void onTabIndexChanged(int index); void onTitleChanged(const QString &text); private: QPointer<DailymotionVideo> m_video; DailymotionPlaylist *m_playlist; DailymotionPlaylistModel *m_model; ImageCache *m_cache; ListView *m_view; QTabBar *m_tabBar; QStackedWidget *m_stack; QWidget *m_widget; QLineEdit *m_titleEdit; QTextEdit *m_descriptionEdit; QLabel *m_label; QDialogButtonBox *m_buttonBox; QGridLayout *m_layout; }; #endif // DAILYMOTIONPLAYLISTDIALOG_H
/* * Copyright (C) 2003-2021 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * * WeeChat is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * WeeChat is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WeeChat. If not, see <https://www.gnu.org/licenses/>. */ #ifndef WEECHAT_HOOK_CONFIG_H #define WEECHAT_HOOK_CONFIG_H struct t_weechat_plugin; struct t_infolist_item; #define HOOK_CONFIG(hook, var) (((struct t_hook_config *)hook->hook_data)->var) typedef int (t_hook_callback_config)(const void *pointer, void *data, const char *option, const char *value); struct t_hook_config { t_hook_callback_config *callback; /* config callback */ char *option; /* config option for hook */ /* (NULL = hook for all options) */ }; extern struct t_hook *hook_config (struct t_weechat_plugin *plugin, const char *option, t_hook_callback_config *callback, const void *callback_pointer, void *callback_data); extern void hook_config_exec (const char *option, const char *value); extern void hook_config_free_data (struct t_hook *hook); extern int hook_config_add_to_infolist (struct t_infolist_item *item, struct t_hook *hook); extern void hook_config_print_log (struct t_hook *hook); #endif /* WEECHAT_HOOK_CONFIG_H */
#ifndef Abstract_Scene_h #define Abstract_Scene_h class AbstractScene { public: AbstractScene(){} virtual ~AbstractScene(){} // Rendering, Resize, recycling virtual void Init(){}; virtual void Render()=0; virtual void Resize(int width, int height)=0; virtual void Destroy(){}; // CG standard functions, for update and display the windows for debugging virtual void Keyboard ( unsigned char key, int x, int y, bool &redisplay) {} virtual void Speckey(int key, int x, int y, bool &redisplay) {} virtual void LButtonDown(int x, int y, bool &redisplay){} virtual void LButtonUp(int x, int y, bool &redisplay){} virtual void MButtonDown(int x, int y, bool &redisplay){} virtual void MButtonUp(int x, int y, bool &redisplay){} virtual void MButtonDown(int x, int y){} virtual void MButtonUp(int x, int y){} virtual void RButtonDown(int x, int y, bool &redisplay){} virtual void RButtonUp(int x, int y, bool &redisplay){} virtual void Wheel(int value, bool &redisplay){} virtual void MouseMove(int x, int y, bool &redisplay){} }; #endif
#ifndef SQUARE_H #define SQUARE_H #include "main.h" #include "sensor.h" #include "radio.h" /* Modulating data via square waves at specific frequencies Keep the frequency as low as reasonably possible to cut down on bandwidth */ extern void square_init(); extern void square_send(std::vector<sensor_datum_t> data); #endif
/* * Copyright (C) 2014 BullSoft * Copyright (C) 2014 Shang Yuanchun <idealities@gmail.com> * * * You may 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. * * FlyingCat 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 FlyingCat. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ #ifndef FC_POOL_H #define FC_POOL_H #include "fc_core.h" #define FC_DEFAULT_POOL_SIZE (16 * 1024) #define FC_POOL_ALIGNMENT 16 struct fc_pool_data_s { u_char *last; u_char *end; fc_uint_t fails; struct fc_pool_s *next; }; struct fc_pool_s { struct fc_pool_data_s d; size_t max; struct fc_pool_s *current; struct fc_large_data_s *large; fc_log_t *log; }; struct fc_large_data_s { void *data; struct fc_large_data_s *next; }; typedef struct fc_pool_s fc_pool_t; fc_pool_t *fc_pool_create(size_t size, fc_log_t *log); void *fc_palloc(fc_pool_t *pool, size_t size); void *fc_pcalloc(fc_pool_t *pool, size_t size); void *fc_pmemalign(fc_pool_t *pool, size_t size, size_t alignment); void fc_pfree(fc_pool_t *pool, void *ptr); void fc_pool_close(fc_pool_t *pool); #endif