text
stringlengths
4
6.14k
/* * Platform data for the chipidea USB dual role controller */ #ifndef __LINUX_USB_CHIPIDEA_H #define __LINUX_USB_CHIPIDEA_H #include <linux/usb/otg.h> struct ci_hdrc; struct ci_hdrc_platform_data { const char *name; /* offset of the capability registers */ uintptr_t capoffset; unsigned power_budget; struct usb_phy *phy; enum usb_phy_interface phy_mode; unsigned long flags; #define CI_HDRC_REGS_SHARED BIT(0) #define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1) #define CI_HDRC_DISABLE_STREAMING BIT(3) /* * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1, * but otg is not supported (no register otgsc). */ #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) #define CI_HDRC_IMX28_WRITE_FIX BIT(5) #define CI_HDRC_FORCE_FULLSPEED BIT(6) enum usb_dr_mode dr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 void (*notify_event) (struct ci_hdrc *ci, unsigned event); struct regulator *reg_vbus; }; /* Default offset of capability registers */ #define DEF_CAPOFFSET 0x100 /* Add ci hdrc device */ struct platform_device *ci_hdrc_add_device(struct device *dev, struct resource *res, int nres, struct ci_hdrc_platform_data *platdata); /* Remove ci hdrc device */ void ci_hdrc_remove_device(struct platform_device *pdev); #endif
/* * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel * * Copyright (C) 1999-2012, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with independent modules, and to copy and * distribute the resulting executable under terms of your choice, provided that * you also meet, for each linked independent module, the terms and conditions of * the license of that module. An independent module is a module which is not * derived from this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * * $Id: bcmsdh_sdmmc.h 366811 2012-11-05 13:49:17Z $ */ #ifndef __BCMSDH_SDMMC_H__ #define __BCMSDH_SDMMC_H__ #define sd_err(x) #define sd_trace(x) #define sd_info(x) #define sd_debug(x) #define sd_data(x) #define sd_ctrl(x) #ifdef CUSTOMER_HW4 #undef sd_err #define sd_err(x) do {printf x;} while (0) #define sd_trace_hw4 sd_err #else #define sd_trace_hw4 sd_trace #endif #define sd_sync_dma(sd, read, nbytes) #define sd_init_dma(sd) #define sd_ack_intr(sd) #define sd_wakeup(sd); /* Allocate/init/free per-OS private data */ extern int sdioh_sdmmc_osinit(sdioh_info_t *sd); extern void sdioh_sdmmc_osfree(sdioh_info_t *sd); #define sd_log(x) #define SDIOH_ASSERT(exp) \ do { if (!(exp)) \ printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \ } while (0) #define BLOCK_SIZE_4318 64 #define BLOCK_SIZE_4328 512 /* internal return code */ #define SUCCESS 0 #define ERROR 1 /* private bus modes */ #define SDIOH_MODE_SD4 2 #define CLIENT_INTR 0x100 /* Get rid of this! */ struct sdioh_info { osl_t *osh; /* osh handler */ bool client_intr_enabled; /* interrupt connnected flag */ bool intr_handler_valid; /* client driver interrupt handler valid */ sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ void *intr_handler_arg; /* argument to call interrupt handler */ uint16 intmask; /* Current active interrupts */ void *sdos_info; /* Pointer to per-OS private data */ uint irq; /* Client irq */ int intrcount; /* Client interrupts */ bool sd_use_dma; /* DMA on CMD53 */ bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ /* Must be on for sd_multiblock to be effective */ bool use_client_ints; /* If this is false, make sure to restore */ int sd_mode; /* SD1/SD4/SPI */ int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ uint8 num_funcs; /* Supported funcs on client */ uint32 com_cis_ptr; uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; #define SDIOH_SDMMC_MAX_SG_ENTRIES 32 struct scatterlist sg_list[SDIOH_SDMMC_MAX_SG_ENTRIES]; bool use_rxchain; }; /************************************************************ * Internal interfaces: per-port references into bcmsdh_sdmmc.c */ /* Global message bits */ extern uint sd_msglevel; /* OS-independent interrupt handler */ extern bool check_client_intr(sdioh_info_t *sd); /* Core interrupt enable/disable of device interrupts */ extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); /************************************************************** * Internal interfaces: bcmsdh_sdmmc.c references to per-port code */ /* Register mapping routines */ extern uint32 *sdioh_sdmmc_reg_map(osl_t *osh, int32 addr, int size); extern void sdioh_sdmmc_reg_unmap(osl_t *osh, int32 addr, int size); /* Interrupt (de)registration routines */ extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq); extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd); typedef struct _BCMSDH_SDMMC_INSTANCE { sdioh_info_t *sd; struct sdio_func *func[SDIOD_MAX_IOFUNCS]; } BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE; #endif /* __BCMSDH_SDMMC_H__ */
/* * Copyright (C) 2003 Jana Saout <jana@saout.de> * * This file is released under the GPL. */ #include <linux/device-mapper.h> #include <linux/module.h> #include <linux/init.h> #include <linux/bio.h> #define DM_MSG_PREFIX "zero" /* * Construct a dummy mapping that only returns zeros */ static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv) { if (argc != 0) { ti->error = "No arguments required"; return -EINVAL; } /* * Silently drop discards, avoiding -EOPNOTSUPP. */ ti->num_discard_bios = 1; return 0; } /* * Return zeros only on reads */ static int zero_map(struct dm_target *ti, struct bio *bio) { switch(bio_rw(bio)) { case READ: zero_fill_bio(bio); break; case READA: /* readahead of null bytes only wastes buffer cache */ return -EIO; case WRITE: /* writes get silently dropped */ break; } bio_endio(bio); /* accepted bio, don't make new request */ return DM_MAPIO_SUBMITTED; } static struct target_type zero_target = { .name = "zero", .version = {1, 1, 0}, .module = THIS_MODULE, .ctr = zero_ctr, .map = zero_map, }; static int __init dm_zero_init(void) { int r = dm_register_target(&zero_target); if (r < 0) DMERR("register failed %d", r); return r; } static void __exit dm_zero_exit(void) { dm_unregister_target(&zero_target); } module_init(dm_zero_init) module_exit(dm_zero_exit) MODULE_AUTHOR("Jana Saout <jana@saout.de>"); MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros"); MODULE_LICENSE("GPL");
/***************************************************************************/ /* */ /* cffpic.c */ /* */ /* The FreeType position independent code services for cff module. */ /* */ /* Copyright 2009 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #include <ft2build.h> #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #include "cffpic.h" #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from cffdrivr.c */ FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**); void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*); void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*); void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*); void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*); void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*); void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*); /* forward declaration of PIC init functions from cffparse.c */ FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**); void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*); /* forward declaration of PIC init functions from cffcmap.c */ void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*); void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*); void cff_driver_class_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; FT_Memory memory = library->memory; if ( pic_container->cff ) { CffModulePIC* container = (CffModulePIC*)pic_container->cff; if(container->cff_services) FT_Destroy_Class_cff_services(library, container->cff_services); container->cff_services = NULL; if(container->cff_field_handlers) FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers); container->cff_field_handlers = NULL; FT_FREE( container ); pic_container->cff = NULL; } } FT_Error cff_driver_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = FT_Err_Ok; CffModulePIC* container; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof(*container) ); pic_container->cff = container; /* initialize pointer table - this is how the module usually expects this data */ error = FT_Create_Class_cff_services(library, &container->cff_services); if(error) goto Exit; error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers); if(error) goto Exit; FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info); FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict); FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name); FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info); FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info); FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec); FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec); Exit: if(error) cff_driver_class_pic_free(library); return error; } #endif /* FT_CONFIG_OPTION_PIC */ /* END */
/* SPDX-License-Identifier: GPL-2.0-only */ /* * Defines for Mobile Industry Processor Interface (MIPI(R)) * Display Working Group standards: DSI, DCS, DBI, DPI * * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de> * Copyright (C) 2006 Nokia Corporation * Author: Imre Deak <imre.deak@nokia.com> */ #ifndef MIPI_DISPLAY_H #define MIPI_DISPLAY_H /* MIPI DSI Processor-to-Peripheral transaction types */ enum { MIPI_DSI_V_SYNC_START = 0x01, MIPI_DSI_V_SYNC_END = 0x11, MIPI_DSI_H_SYNC_START = 0x21, MIPI_DSI_H_SYNC_END = 0x31, MIPI_DSI_COMPRESSION_MODE = 0x07, MIPI_DSI_END_OF_TRANSMISSION = 0x08, MIPI_DSI_COLOR_MODE_OFF = 0x02, MIPI_DSI_COLOR_MODE_ON = 0x12, MIPI_DSI_SHUTDOWN_PERIPHERAL = 0x22, MIPI_DSI_TURN_ON_PERIPHERAL = 0x32, MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM = 0x03, MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM = 0x13, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM = 0x23, MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM = 0x04, MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM = 0x14, MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM = 0x24, MIPI_DSI_DCS_SHORT_WRITE = 0x05, MIPI_DSI_DCS_SHORT_WRITE_PARAM = 0x15, MIPI_DSI_DCS_READ = 0x06, MIPI_DSI_EXECUTE_QUEUE = 0x16, MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE = 0x37, MIPI_DSI_NULL_PACKET = 0x09, MIPI_DSI_BLANKING_PACKET = 0x19, MIPI_DSI_GENERIC_LONG_WRITE = 0x29, MIPI_DSI_DCS_LONG_WRITE = 0x39, MIPI_DSI_PICTURE_PARAMETER_SET = 0x0a, MIPI_DSI_COMPRESSED_PIXEL_STREAM = 0x0b, MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20 = 0x0c, MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24 = 0x1c, MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16 = 0x2c, MIPI_DSI_PACKED_PIXEL_STREAM_30 = 0x0d, MIPI_DSI_PACKED_PIXEL_STREAM_36 = 0x1d, MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12 = 0x3d, MIPI_DSI_PACKED_PIXEL_STREAM_16 = 0x0e, MIPI_DSI_PACKED_PIXEL_STREAM_18 = 0x1e, MIPI_DSI_PIXEL_STREAM_3BYTE_18 = 0x2e, MIPI_DSI_PACKED_PIXEL_STREAM_24 = 0x3e, }; /* MIPI DSI Peripheral-to-Processor transaction types */ enum { MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT = 0x02, MIPI_DSI_RX_END_OF_TRANSMISSION = 0x08, MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE = 0x11, MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE = 0x12, MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE = 0x1a, MIPI_DSI_RX_DCS_LONG_READ_RESPONSE = 0x1c, MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE = 0x21, MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE = 0x22, }; /* MIPI DCS commands */ enum { MIPI_DCS_NOP = 0x00, MIPI_DCS_SOFT_RESET = 0x01, MIPI_DCS_GET_COMPRESSION_MODE = 0x03, MIPI_DCS_GET_DISPLAY_ID = 0x04, MIPI_DCS_GET_ERROR_COUNT_ON_DSI = 0x05, MIPI_DCS_GET_RED_CHANNEL = 0x06, MIPI_DCS_GET_GREEN_CHANNEL = 0x07, MIPI_DCS_GET_BLUE_CHANNEL = 0x08, MIPI_DCS_GET_DISPLAY_STATUS = 0x09, MIPI_DCS_GET_POWER_MODE = 0x0A, MIPI_DCS_GET_ADDRESS_MODE = 0x0B, MIPI_DCS_GET_PIXEL_FORMAT = 0x0C, MIPI_DCS_GET_DISPLAY_MODE = 0x0D, MIPI_DCS_GET_SIGNAL_MODE = 0x0E, MIPI_DCS_GET_DIAGNOSTIC_RESULT = 0x0F, MIPI_DCS_ENTER_SLEEP_MODE = 0x10, MIPI_DCS_EXIT_SLEEP_MODE = 0x11, MIPI_DCS_ENTER_PARTIAL_MODE = 0x12, MIPI_DCS_ENTER_NORMAL_MODE = 0x13, MIPI_DCS_GET_IMAGE_CHECKSUM_RGB = 0x14, MIPI_DCS_GET_IMAGE_CHECKSUM_CT = 0x15, MIPI_DCS_EXIT_INVERT_MODE = 0x20, MIPI_DCS_ENTER_INVERT_MODE = 0x21, MIPI_DCS_SET_GAMMA_CURVE = 0x26, MIPI_DCS_SET_DISPLAY_OFF = 0x28, MIPI_DCS_SET_DISPLAY_ON = 0x29, MIPI_DCS_SET_COLUMN_ADDRESS = 0x2A, MIPI_DCS_SET_PAGE_ADDRESS = 0x2B, MIPI_DCS_WRITE_MEMORY_START = 0x2C, MIPI_DCS_WRITE_LUT = 0x2D, MIPI_DCS_READ_MEMORY_START = 0x2E, MIPI_DCS_SET_PARTIAL_ROWS = 0x30, /* MIPI DCS 1.02 - MIPI_DCS_SET_PARTIAL_AREA before that */ MIPI_DCS_SET_PARTIAL_COLUMNS = 0x31, MIPI_DCS_SET_SCROLL_AREA = 0x33, MIPI_DCS_SET_TEAR_OFF = 0x34, MIPI_DCS_SET_TEAR_ON = 0x35, MIPI_DCS_SET_ADDRESS_MODE = 0x36, MIPI_DCS_SET_SCROLL_START = 0x37, MIPI_DCS_EXIT_IDLE_MODE = 0x38, MIPI_DCS_ENTER_IDLE_MODE = 0x39, MIPI_DCS_SET_PIXEL_FORMAT = 0x3A, MIPI_DCS_WRITE_MEMORY_CONTINUE = 0x3C, MIPI_DCS_SET_3D_CONTROL = 0x3D, MIPI_DCS_READ_MEMORY_CONTINUE = 0x3E, MIPI_DCS_GET_3D_CONTROL = 0x3F, MIPI_DCS_SET_VSYNC_TIMING = 0x40, MIPI_DCS_SET_TEAR_SCANLINE = 0x44, MIPI_DCS_GET_SCANLINE = 0x45, MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 0x51, /* MIPI DCS 1.3 */ MIPI_DCS_GET_DISPLAY_BRIGHTNESS = 0x52, /* MIPI DCS 1.3 */ MIPI_DCS_WRITE_CONTROL_DISPLAY = 0x53, /* MIPI DCS 1.3 */ MIPI_DCS_GET_CONTROL_DISPLAY = 0x54, /* MIPI DCS 1.3 */ MIPI_DCS_WRITE_POWER_SAVE = 0x55, /* MIPI DCS 1.3 */ MIPI_DCS_GET_POWER_SAVE = 0x56, /* MIPI DCS 1.3 */ MIPI_DCS_SET_CABC_MIN_BRIGHTNESS = 0x5E, /* MIPI DCS 1.3 */ MIPI_DCS_GET_CABC_MIN_BRIGHTNESS = 0x5F, /* MIPI DCS 1.3 */ MIPI_DCS_READ_DDB_START = 0xA1, MIPI_DCS_READ_PPS_START = 0xA2, MIPI_DCS_READ_DDB_CONTINUE = 0xA8, MIPI_DCS_READ_PPS_CONTINUE = 0xA9, }; /* MIPI DCS pixel formats */ #define MIPI_DCS_PIXEL_FMT_24BIT 7 #define MIPI_DCS_PIXEL_FMT_18BIT 6 #define MIPI_DCS_PIXEL_FMT_16BIT 5 #define MIPI_DCS_PIXEL_FMT_12BIT 3 #define MIPI_DCS_PIXEL_FMT_8BIT 2 #define MIPI_DCS_PIXEL_FMT_3BIT 1 #endif
//////////////////////////////////////////////////////////////////////////////// // // TYPHOON FRAMEWORK // Copyright 2013, Typhoon Framework Contributors // All Rights Reserved. // // NOTICE: The authors permit you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// #import <UIKit/UIKit.h> @protocol PFCityDao; @class PFRootViewController; @class INJContainer; @class PFAppContext; @interface PFAppDelegate : UIResponder <UIApplicationDelegate> @property (nonatomic, strong) INJContainer *container; @property (nonatomic, strong) PFAppContext *appContext; @property(nonatomic, strong) UIWindow *window; @property(nonatomic, strong) id <PFCityDao> cityDao; @property(nonatomic, strong) PFRootViewController *rootViewController; @end
/* $OpenBSD: ieee.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ /* public domain */ #include <mips64/ieee.h>
/* Copyright 2017-2019 Igor Petrovic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __CORE_GENERAL_IO #define __CORE_GENERAL_IO #ifdef __AVR__ #include "../arch/avr/IO.h" #elif defined __STM32__ #include "../arch/stm32/IO.h" #else #include "../arch/stub/IO.h" #endif #endif
// // AppDelegate.h // DPDataStorageDemo // // Created by Alex Bakhtin on 10/6/15. // Copyright © 2015 dmitriy.petrusevich. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // Play Sound.h // Play Sound // // Created by James Badger on 27/10/05. // Copyright 2005 James Badger. All rights reserved. // #import <Cocoa/Cocoa.h> #import <Automator/AMBundleAction.h> @interface Play_Sound : AMBundleAction { bool exitNow; NSSound *file; } - (bool)runWithInput:(id)input fromAction:(AMAction *)anAction error:(NSDictionary **)errorInfo; - (void)stop; @end
#ifndef _ACTION_FIND_TARGET_H #define _ACTION_FIND_TARGET_H #include "action.h" #include "character.h" class ActionFindTarget: public Action { public: ActionFindTarget(Character * character); virtual void Start(); virtual void Run(); virtual void End(); private: Character * m_target; }; #endif//!_ACTION_FIND_TARGET_H
/** * Copyright (C) 2013 Tobias P. Becker * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * More information at: https://dslib.assembla.com/ * */ #pragma once #include <core/reflection/Attribute.h> #include <core/Object.h> namespace nspace { /** * \brief Information about a member. * @TODO remove attributes like description/displayname etc. */ class MemberInfo : public virtual AttributeTarget { TYPED_OBJECT(MemberInfo); SIMPLE_PROPERTY(std::string, Name){ if(getDisplayName()!="") return; setDisplayName(newvalue); } REFERENCE_PROPERTY(std::string, Name); SIMPLE_PROPERTY(bool, IsVisible){} SIMPLE_PROPERTY(const Type *, OwningType ){}; /** * \brief Description of the member. * */ SIMPLE_PROPERTY(std::string, Description){} /** * \brief Display name of the member */ SIMPLE_PROPERTY(std::string, DisplayName){} /** * \brief Group name of the member * */ SIMPLE_PROPERTY(std::string, GroupName){} public: /** * \brief Default constructor. */ MemberInfo() : _IsVisible(true), _OwningType(0) {} }; }
/* * testRandomNumber.h * * Created on: Apr 20, 2012 * Author: jchen */ #ifndef TESTRANDOMNUMBER_H_ #define TESTRANDOMNUMBER_H_ #include <cxxtest/TestSuite.h> #include <vector> #include "patNBParameters.h" #include "patDisplay.h" #include "patError.h" #include "patRandomNumber.h" #include <boost/random.hpp> class MyTestRandomNumberGenrator: public CxxTest::TestSuite{ public: void testRNG(void){ patError* err(NULL); patNBParameters::the()->readFile("/Users/jchen/Documents/Project/newbioroute/src/params/config.xml", err); patNBParameters::the()->init(err); TS_ASSERT_EQUALS(err,(void*)0); int count= 100000; double sum=0.0; patRandomNumber rng(patNBParameters::the()->randomSeed); for (int i=0;i<count;i++){ //DEBUG_MESSAGE(rng.nextDouble()); sum+=rng.nextDouble(); } double avg = sum/count; TS_ASSERT_DELTA(avg, 0.5, 1e-2); int bigest_int=4; unsigned long plain_int_sum=0; for (int i=0;i<count;i++){ //DEBUG_MESSAGE(rng.nextInt(bigest_int-1)); plain_int_sum+=rng.nextInt(bigest_int); } TS_ASSERT_DELTA(((double) plain_int_sum/count), ((double) (bigest_int-1)/2.0), 1e-2); bigest_int=9; plain_int_sum=0; for (int i=0;i<count;i++){ //DEBUG_MESSAGE(rng.nextInt(bigest_int-1)); plain_int_sum+=rng.nextInt(bigest_int); } TS_ASSERT_DELTA(((double) plain_int_sum/count), ((double) (bigest_int-1)/2.0), 1e-2); map<int,double> probas; int count_probas = 5; for(int i=0;i<count_probas;++i){ probas[i]=0.1; } unsigned long sum_int_proba=0; for (int i=0;i<count;++i){ //DEBUG_MESSAGE(rng.sampleWithProba(probas)) sum_int_proba+=rng.sampleWithProba(probas); } TS_ASSERT_DELTA(((double) sum_int_proba/count), ((double) (count_probas-1)/2), 1e-2); } }; #endif /* TESTRANDOMNUMBER_H_ */
#pragma once #include <SDL.h> #include <string.h> #include "../Core/C_Vec2.h" ///Forward declaration of StateManager for the pointer to the StateManager. class S_StateManager; /** @brief Contains State functions and data to be inherited by all other states. @author Jamie Slowgrove */ class S_State { public: /** @brief Constructs the State object. @param stateManager A pointer to the StateManager. @param renderer A pointer to the renderer. @param dimensions The screen dimensions. */ S_State(S_StateManager* stateManager, SDL_Renderer* renderer, C_Vec2 dimensions); /** @brief A virtual destructor for the State object. */ virtual ~S_State(); /** @brief A pure virtual function to handle the user input for use with the State. @returns If false then quit State. */ virtual bool input() = 0; /** @brief A pure virtual function to update the State to allow the State to run. @param dt The delta time. */ virtual void update(float deltaTime) = 0; /** @brief A pure virtual function to draw to the screen using the renderer. */ virtual void draw() = 0; protected: ///A pointer to the state manager. S_StateManager* stateManager; ///A pointer to the renderer. SDL_Renderer* renderer; ///The screen dimensions. C_Vec2 dimensions; };
// // RestaurantCells.h // Restaurants // // Created by Philip Tolton on 2013-10-08. // Copyright (c) 2013 Philip Tolton. All rights reserved. // #import <UIKit/UIKit.h> #import "RestoScrollView.h" @interface RestaurantCells : UITableViewCell @property (strong, nonatomic) IBOutlet UILabel *opened_closed; @property (strong, nonatomic) IBOutlet UILabel *distanceLabel; @property (nonatomic, strong) IBOutlet UILabel* restaurantLabel; @property (nonatomic,strong) IBOutlet RestoScrollView* scrollView; @property IBOutlet *tap; @property Restaurant *restaurant; @end
// // LMMessageAdapter.h // Connect // // Created by MoHuilin on 2017/5/16. // Copyright © 2017年 Connect. All rights reserved. // #import <Foundation/Foundation.h> #import "Protofile.pbobjc.h" #import "MMMessage.h" @interface LMMessageAdapter : NSObject /** * Encapsulates the data body of the im message * @param message * @param talkType * @param ecdhKey * @return */ + (GPBMessage *)sendAdapterIMPostWithMessage:(MMMessage *)message talkType:(GJGCChatFriendTalkType)talkType ecdhKey:(NSString *)ecdhKey; /** * Encapsulates the data body of the message read ack message * @param message * @return */ + (MessagePost *)sendAdapterIMReadAckPostWithMessage:(MMMessage *)message; @end
//////////////////////////////////////////////////////////////////////////////// // // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // http://www.opensource.org/licenses/mit-license.php // //////////////////////////////////////////////////////////////////////////////// #ifndef INCLUDED_CMDUNIQUE #define INCLUDED_CMDUNIQUE #include <string> #include <Command.h> class CmdUnique : public Command { public: CmdUnique (); int execute (std::string&); }; #endif ////////////////////////////////////////////////////////////////////////////////
#if LOW_PASS { float RC = 1.0/(CUTOFF*2*3.14); float dt = 1.0/SAMPLE_RATE; float alpha = dt/(RC+dt); float output[numSamples]; output[0] = input[0]; for(i=1; i<numSamples; i++){ output[i] = output[i-1] + (alpha*(input[i] - output[i-1])); } } #endif #if HIGH_PASS { float RC = 1.0/(CUTOFF*2*3.14); float dt = 1.0/SAMPLE_RATE; float alpha = RC/(RC + dt); float output[numSamples]; output[0] = input[0]; for (i = 1; i<numSamples; i++){ output[i] = alpha * (output[i-1] + input[i] - input[i-1]); } } #endif
/****************************************************************************//** \file memAt25dd041a.c \brief Some commands for at25df041a implementation. \author Atmel Corporation: http://www.atmel.com \n Support email: avr@atmel.com Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. Licensed under Atmel's Limited License Agreement (BitCloudTM). \internal History: 05/10/11 N. Fomin - Created *******************************************************************************/ /****************************************************************************** Includes section ******************************************************************************/ #include <types.h> #include <extMemReader.h> #include <spiMemInterface.h> #if EXTERNAL_MEMORY == AT25DF041A /****************************************************************************** Constants section ******************************************************************************/ const uint32_t imageStartAddress[POSITION_MAX] = {IMAGE1_START_ADDRESS, IMAGE2_START_ADDRESS}; /****************************************************************************** Implementations section ******************************************************************************/ /**************************************************************************//** \brief Check availability of the external flash. Reads vendor and chip ID from the external flash. \return true - correct memory, \n false - other ******************************************************************************/ bool memCheckMem(void) { uint64_t manufacId = RDID; GPIO_EXT_MEM_CS_clr(); spiMemTransac(SPI_TRANSACTION_TYPE_READ, (uint8_t *)&manufacId, sizeof(uint64_t)-3); GPIO_EXT_MEM_CS_set(); if (MANUFACTURER_ID == (uint8_t)(manufacId >> 8)) if ((DEVICE_ID_1 == (uint8_t)(manufacId >> 16)) && (DEVICE_ID_2 == (uint8_t)(manufacId >> 24)) && (EXT_STRING_LENGTH == (uint8_t)(manufacId >> 32))) return true; return false; } /**************************************************************************//** \brief Reads data from memory. \param[in] offset - internal flash address; \param[in] buffer - pointer to the data buffer; \param[in] length - number bytes for reading; ******************************************************************************/ void memReadData(uint32_t offset, uint8_t *data, uint16_t size) { uint8_t instruction = READ; offset = LITTLE_TO_BIG_ENDIAN(offset<<8); GPIO_EXT_MEM_CS_clr(); spiMemTransac(SPI_TRANSACTION_TYPE_WRITE , &instruction, sizeof(uint8_t)); spiMemTransac(SPI_TRANSACTION_TYPE_WRITE , (uint8_t *)&offset, sizeof(uint32_t)-1); spiMemTransac(SPI_TRANSACTION_TYPE_READ, data, size); GPIO_EXT_MEM_CS_set(); // release spi cs } #endif // EXTERNAL_MEMORY == AT25DF041A // eof memAt25df041a.c
/****************************************************************************/ /* imaxdiv v15.12.3 */ /* */ /* Copyright (c) 2003-2016 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /****************************************************************************/ #include <inttypes.h> imaxdiv_t imaxdiv(intmax_t num, intmax_t den) { imaxdiv_t rv; rv.quot = num / den; rv.rem = num - (rv.quot * den); return rv; }
// // UIControl+YYAdd.h // YYCategories <https://github.com/ibireme/YYCategories> // // Created by ibireme on 13/4/5. // Copyright (c) 2015 ibireme. // // This source code is licensed under the MIT-style license found in the // LICENSE file in the root directory of this source tree. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN /** Provides extensions for `UIControl`. UIControl的扩展 */ @interface UIControl (YYAdd) /** Removes all targets and actions for a particular event (or events) from an internal dispatch table. 移除所有的对象和action */ - (void)removeAllTargets; /** Adds or replaces a target and action for a particular event (or events) to an internal dispatch table. 设置或者替换 @param target The target object—that is, the object to which the action message is sent. If this is nil, the responder chain is searched for an object willing to respond to the action message. @param action A selector identifying an action message. It cannot be NULL. @param controlEvents A bitmask specifying the control events for which the action message is sent. */ - (void)setTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; /** Adds a block for a particular event (or events) to an internal dispatch table. It will cause a strong reference to @a block. block 方式添加事件回调,强引用 @param block The block which is invoked then the action message is sent (cannot be nil). The block is retained. @param controlEvents A bitmask specifying the control events for which the action message is sent. */ - (void)addBlockForControlEvents:(UIControlEvents)controlEvents block:(void (^)(id sender))block; /** Adds or replaces a block for a particular event (or events) to an internal dispatch table. It will cause a strong reference to @a block. 增加或者替换 @param block The block which is invoked then the action message is sent (cannot be nil). The block is retained. @param controlEvents A bitmask specifying the control events for which the action message is sent. */ - (void)setBlockForControlEvents:(UIControlEvents)controlEvents block:(void (^)(id sender))block; /** Removes all blocks for a particular event (or events) from an internal dispatch table. 移除所有的block方式的回调 @param controlEvents A bitmask specifying the control events for which the action message is sent. */ - (void)removeAllBlocksForControlEvents:(UIControlEvents)controlEvents; @end NS_ASSUME_NONNULL_END
#pragma once #include <string> #include <functional> #include <net/asio/http/uri.h> namespace net { namespace http { /** * Represents an endpoint with distinct connection * characteristics. * * Details may include: * * Hostname, IP or vhost * * Port * * SSL certificate */ class details { public: details( const net::http::uri &u ):host_{ u.host() }, port_{ u.port() }, tls_{ u.scheme() == "https" } { // std::cout << " hd => " << string() << "\n"; } details() = delete; virtual ~details() { // std::cout << "~hd\n"; } /** Our hashing function is currently based on the stringified value */ class hash { public: std::size_t operator()(details const &hd) const { return std::hash<std::string>()(hd.string()); } }; /** Equality operator is, again, based on stringified value */ class equal { public: bool operator()(details const &src, details const &dst) const { return src.string() == dst.string(); } }; /** * Stringified value for this endpoint. * Currently takes the form host:port */ std::string string() const { return (tls_ ? "https://" : "http://") + host_ + std::string { ":" } + std::to_string(port_); } const std::string &host() const { return host_; } uint16_t port() const { return port_; } bool tls() const { return tls_; } private: std::string host_; uint16_t port_; bool tls_; }; }; };
/* * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "GEMM.h" #include "arm_compute/core/Types.h" namespace arm_compute { namespace test { namespace validation { namespace reference { template <typename T> SimpleTensor<T> gemm_interleave_4x4(const SimpleTensor<T> &in, SimpleTensor<T> &out) { const T *mtx_in = reinterpret_cast<const T *>(in.data()); T *mtx_ref = reinterpret_cast<T *>(out.data()); const int32_t in_rows = in.shape().y(); const int32_t in_cols = in.shape().x(); const int32_t out_stride = out.shape().x(); int32_t y = 0; for(; y <= (in_rows - 4); y += 4) { const T *in_ptr = &mtx_in[y * in_cols]; for(int32_t x = 0; x < in_cols; x++) { const T tmp[4] = { in_ptr[x + 0 * in_cols], in_ptr[x + 1 * in_cols], in_ptr[x + 2 * in_cols], in_ptr[x + 3 * in_cols] }; T *dst = &mtx_ref[static_cast<size_t>(x * 4.f) + static_cast<size_t>(std::ceil(y / 4.f)) * out_stride]; memcpy(dst, tmp, sizeof(T) * 4); } } // Leftover along the Y direction const int32_t leftover_y = in_rows - y; if(leftover_y != 0) { const T *in_ptr = &mtx_in[y * in_cols]; for(int32_t x = 0; x < in_cols; x++) { T tmp[4] = { 0, 0, 0, 0 }; for(int32_t k = 0; k < leftover_y; k++) { tmp[k] = in_ptr[k * in_cols + x]; } T *dst = &mtx_ref[static_cast<size_t>(x * 4.f) + static_cast<size_t>(std::ceil(y / 4.f)) * out_stride]; memcpy(dst, tmp, sizeof(T) * 4); } } return out; } } // namespace reference } // namespace validation } // namespace test } // namespace arm_compute
/** * This is a generated file. Do not edit or your changes will be lost */ @interface ComPlainprogramsStreamingmetadataModuleAssets : NSObject { } - (NSData*) moduleAsset; @end
/* This file is part of cpp-ethereum. cpp-ethereum 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. cpp-ethereum 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 cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. */ /** @file JSConsole.h * @author Marek Kotewicz <marek@ethdev.com> * @date 2015 * Ethereum client. */ #pragma once #include <libdevcore/Log.h> #if ETH_READLINE #include <readline/readline.h> #include <readline/history.h> #endif namespace dev { namespace eth { template<typename Engine, typename Printer> class JSConsole { public: JSConsole(): m_engine(Engine()), m_printer(Printer(m_engine)) {} ~JSConsole() {} void readAndEval() const { std::string cmd = ""; g_logPost = [](std::string const& a, char const*) { std::cout << "\r \r" << a << std::endl << std::flush; #if ETH_READLINE rl_forced_update_display(); #endif }; bool isEmpty = true; int openBrackets = 0; do { std::string rl; #if ETH_READLINE char* buff = readline(promptForIndentionLevel(openBrackets).c_str()); if (buff) { rl = std::string(buff); free(buff); } #else std::cout << promptForIndentionLevel(openBrackets) << std::flush; std::getline(std::cin, rl); #endif isEmpty = rl.empty(); //@todo this should eventually check the structure of the input, since unmatched // brackets in strings will fail to execute the input now. if (!isEmpty) { cmd += rl; int open = 0; for (char c: {'{', '[', '('}) open += std::count(cmd.begin(), cmd.end(), c); int closed = 0; for (char c: {'}', ']', ')'}) closed += std::count(cmd.begin(), cmd.end(), c); openBrackets = open - closed; } } while (openBrackets > 0 && std::cin); if (!isEmpty) { #if ETH_READLINE add_history(cmd.c_str()); #endif auto value = m_engine.eval(cmd.c_str()); std::string result = m_printer.prettyPrint(value).cstr(); std::cout << result << std::endl; } } void eval(std::string const& _expression) { m_engine.eval(_expression.c_str()); } protected: Engine m_engine; Printer m_printer; virtual std::string promptForIndentionLevel(int _i) const { if (_i == 0) return "> "; return std::string((_i + 1) * 2, ' '); } }; } }
// To check if a library is compiled with CocoaPods you // can use the `COCOAPODS` macro definition which is // defined in the xcconfigs so it is available in // headers also when they are imported in the client // project. // LTHPasscodeViewController #define COCOAPODS_POD_AVAILABLE_LTHPasscodeViewController #define COCOAPODS_VERSION_MAJOR_LTHPasscodeViewController 3 #define COCOAPODS_VERSION_MINOR_LTHPasscodeViewController 1 #define COCOAPODS_VERSION_PATCH_LTHPasscodeViewController 4
/** * Copyright (c) 2019 Kylart <kylart.dev@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. */ #ifndef BINDINGS_NAME_PARSER_SRC_PARSE_H_ #define BINDINGS_NAME_PARSER_SRC_PARSE_H_ #include <napi.h> #include <anitomy/anitomy.h> #include <locale> #include <codecvt> #include <string> #include "wrapper.h" namespace Parser { Napi::Value parse(const Napi::CallbackInfo& info); } // namespace Parser #endif // BINDINGS_NAME_PARSER_SRC_PARSE_H_
// Copyright (c) 2012-2018 The DigiByte Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef DIGIBYTE_BLOOM_H #define DIGIBYTE_BLOOM_H #include <serialize.h> #include <vector> class COutPoint; class CTransaction; class uint256; //! 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001% static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes static const unsigned int MAX_HASH_FUNCS = 50; /** * First two bits of nFlags control how much IsRelevantAndUpdate actually updates * The remaining bits are reserved */ enum bloomflags { BLOOM_UPDATE_NONE = 0, BLOOM_UPDATE_ALL = 1, // Only adds outpoints to the filter if the output is a pay-to-pubkey/pay-to-multisig script BLOOM_UPDATE_P2PUBKEY_ONLY = 2, BLOOM_UPDATE_MASK = 3, }; /** * BloomFilter is a probabilistic filter which SPV clients provide * so that we can filter the transactions we send them. * * This allows for significantly more efficient transaction and block downloads. * * Because bloom filters are probabilistic, a SPV node can increase the false- * positive rate, making us send it transactions which aren't actually its, * allowing clients to trade more bandwidth for more privacy by obfuscating which * keys are controlled by them. */ class CBloomFilter { private: std::vector<unsigned char> vData; bool isFull; bool isEmpty; unsigned int nHashFuncs; unsigned int nTweak; unsigned char nFlags; unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const; // Private constructor for CRollingBloomFilter, no restrictions on size CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweak); friend class CRollingBloomFilter; public: /** * Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements * Note that if the given parameters will result in a filter outside the bounds of the protocol limits, * the filter created will be as close to the given parameters as possible within the protocol limits. * This will apply if nFPRate is very low or nElements is unreasonably high. * nTweak is a constant which is added to the seed value passed to the hash function * It should generally always be a random value (and is largely only exposed for unit testing) * nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK) */ CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweak, unsigned char nFlagsIn); CBloomFilter() : isFull(true), isEmpty(false), nHashFuncs(0), nTweak(0), nFlags(0) {} ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(vData); READWRITE(nHashFuncs); READWRITE(nTweak); READWRITE(nFlags); } void insert(const std::vector<unsigned char>& vKey); void insert(const COutPoint& outpoint); void insert(const uint256& hash); bool contains(const std::vector<unsigned char>& vKey) const; bool contains(const COutPoint& outpoint) const; bool contains(const uint256& hash) const; void clear(); void reset(const unsigned int nNewTweak); //! True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS //! (catch a filter which was just deserialized which was too big) bool IsWithinSizeConstraints() const; //! Also adds any outputs which match the filter to the filter (to match their spending txes) bool IsRelevantAndUpdate(const CTransaction& tx); //! Checks for empty and full filters to avoid wasting cpu void UpdateEmptyFull(); }; /** * RollingBloomFilter is a probabilistic "keep track of most recently inserted" set. * Construct it with the number of items to keep track of, and a false-positive * rate. Unlike CBloomFilter, by default nTweak is set to a cryptographically * secure random value for you. Similarly rather than clear() the method * reset() is provided, which also changes nTweak to decrease the impact of * false-positives. * * contains(item) will always return true if item was one of the last N to 1.5*N * insert()'ed ... but may also return true for items that were not inserted. * * It needs around 1.8 bytes per element per factor 0.1 of false positive rate. * (More accurately: 3/(log(256)*log(2)) * log(1/fpRate) * nElements bytes) */ class CRollingBloomFilter { public: // A random bloom filter calls GetRand() at creation time. // Don't create global CRollingBloomFilter objects, as they may be // constructed before the randomizer is properly initialized. CRollingBloomFilter(const unsigned int nElements, const double nFPRate); void insert(const std::vector<unsigned char>& vKey); void insert(const uint256& hash); bool contains(const std::vector<unsigned char>& vKey) const; bool contains(const uint256& hash) const; void reset(); private: int nEntriesPerGeneration; int nEntriesThisGeneration; int nGeneration; std::vector<uint64_t> data; unsigned int nTweak; int nHashFuncs; }; #endif // DIGIBYTE_BLOOM_H
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "UIView.h" @class MPImageCache, MPImageCacheRequest, MPTimeMarker, UIImage; @interface MPVideoChapterCellContentView : UIView { unsigned int _current:1; unsigned long long _index; unsigned int _selected:1; unsigned int _showThumbnailColumn:1; double _timeColumnWidth; MPTimeMarker *_timeMarker; UIImage *_artwork; MPImageCache *_artworkImageCache; MPImageCacheRequest *_artworkImageRequest; } @property(retain, nonatomic) MPImageCache *artworkImageCache; // @synthesize artworkImageCache=_artworkImageCache; @property(retain, nonatomic) UIImage *artwork; // @synthesize artwork=_artwork; @property(retain, nonatomic) MPTimeMarker *timeMarker; // @synthesize timeMarker=_timeMarker; @property(nonatomic) double timeColumnWidth; // @synthesize timeColumnWidth=_timeColumnWidth; @property(nonatomic) unsigned long long index; // @synthesize index=_index; - (void).cxx_destruct; - (void)setArtworkImageRequest:(id)arg1 artworkLoadCompletionHandler:(id)arg2; @property(nonatomic) _Bool showThumbnailColumn; @property(nonatomic, getter=isSelected) _Bool selected; @property(nonatomic, getter=isCurrent) _Bool current; - (void)drawRect:(struct CGRect)arg1; - (void)dealloc; @end
#include "hash.h" #include "list.h" extern void *hash_init(hash_table *h, size_t elem_size, hash_fn_t hash_fn, comp_fn_t comp, unsigned long table_size) { array *a; if ((a = malloc(sizeof(array))) == NULL) return NULL; h->a = a; h->table_size = table_size; h->tsize = elem_size; h->hash_fn = hash_fn; h->comp = comp; array_init(a, sizeof(list*), NULL); /* Initialize the hash table with NULL pointers */ list *init_val = NULL; array_expand_fill(a, table_size, &init_val); return NULL; } void *hash_search(hash_table *h, void *elem_addr) { array *a = h->a; size_t size = a->size; hash_fn_t hash_fn = h->hash_fn; unsigned long hash_res = hash_fn(elem_addr); unsigned long index = hash_res % h->table_size; list *l; if (index >= size) return NULL; /* Not found. */ /* The array_value returns a pointer to my stored data, and what I'm storing is a pointer (to a list). This is the reason for casting. */ l = *(list**)array_value(a, index); return list_search(l, elem_addr); } void *hash_insert(hash_table *h, void *elem_addr) { array *a = h->a; hash_fn_t hash_fn = h->hash_fn; unsigned long hash_res = hash_fn(elem_addr); unsigned long index = hash_res % h->table_size; list *l; /* Resolve collision if needed, create new list otherwise. */ l = *(list**)array_value(a, index); if (l == NULL) { /* No collision - create new slot. */ if ((l = malloc(sizeof(list))) == NULL) return NULL; list_init(l, h->tsize, h->comp); /* The array stores a pointer to my data, and what I'm storing is a pointer (to a list). This is the reason for passing the list pointer address and not the list pointer itself. */ array_add_at_index(a, &l, index); } list_add(l, elem_addr); return elem_addr; } void hash_destroy(hash_table *h) { array *a = h->a; unsigned long table_size = h->table_size; list *l; for (int i = 0; i < table_size; i++) { l = *(list**)array_value(a, i); if (l != NULL) { list_destroy(l); free (l); } } free(a); }
/* * Header: semaphore.h * * Provides wrapper functions around POSIX system calls semget, * semctl and semop allowing the creation, initialization, opening * and removal of a single semaphore at a time and implementing * operations down (also known as P or wait) and up (also known as V * or signal) on it. * * * Copyright 2014 Razmig Kéchichian, INSA de Lyon, TC department * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * */ #ifndef __SEMAPHORE_H_SEMAPHORE__ #define __SEMAPHORE_H_SEMAPHORE__ #include <stdio.h> #include <stdlib.h> #include <sys/sem.h> int create_semaphore(int key) { return semget(key, 1, 0660 | IPC_CREAT) ; } int open_semaphore(int key) { return semget(key, 1, 0660) ; } int remove_semaphore(int id) { return semctl(id, 0, IPC_RMID) ; } int init_semaphore(int id, int val) { return semctl(id, 0, SETVAL, val) ; } int up(int id) { struct sembuf op ; op.sem_num = 0 ; op.sem_op = 1 ; op.sem_flg = 0 ; return semop(id, &op, 1) ; } int down(int id) { struct sembuf op ; op.sem_num = 0 ; op.sem_op = -1 ; op.sem_flg = 0 ; return semop(id, &op, 1) ; } #endif
#import "MOBProjection.h" @interface MOBProjectionEPSG5786 : MOBProjection @end
// // OWClient.h // OzoneWeather // // Created by Suzanne Kiihne on 09/05/2014. // Copyright (c) 2014 Suzanne Kiihne. All rights reserved. // #import <Foundation/Foundation.h> @import CoreLocation; #import <ReactiveCocoa/ReactiveCocoa/ReactiveCocoa.h> @interface OWClient : NSObject - (RACSignal *)fetchCurrentConditionsForLocation:(CLLocationCoordinate2D)coordinate; - (RACSignal *)fetchHourlyForecastForLocation:(CLLocationCoordinate2D)coordinate; - (RACSignal *)fetchDailyForecastForLocation:(CLLocationCoordinate2D)coordinate; - (RACSignal *)fetchOzoneForecastForLocation:(CLLocation*)location; @end
/* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. ChibiOS/RT 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. ChibiOS/RT 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/>. --- A special exception to the GPL can be applied should you wish to distribute a combined work that includes ChibiOS/RT, without being obliged to provide the source code for any proprietary components. See the file exception.txt for full details of how and when the exception can be applied. */ #ifndef _WFI_H_ #define _WFI_H_ #include "../../../../../boards/V8/board.h" #ifndef port_wait_for_interrupt #if ENABLE_WFI_IDLE != 0 #define port_wait_for_interrupt() { \ AT91C_BASE_SYS->PMC_SCDR = AT91C_PMC_PCK; \ } #else #define port_wait_for_interrupt() #endif #endif #endif /* _WFI_H_ */
// // TWPhotoImageItem.h // Pods // // Created by Madao on 12/8/15. // // #import <UIKit/UIKit.h> @interface TWPhotoImageItem : UIView @property (nonatomic, strong) UIImageView *image; @property (nonatomic, strong) UIView *iconContent; @property (nonatomic, strong) UIImageView *icon; @end
#ifndef BIOSENSOR_MODELING_PARAMETERS_UTILS_H #define BIOSENSOR_MODELING_PARAMETERS_UTILS_H #include <cmath> #include <string> struct parameters { // Width of bio-sensor parts widths double d_e; double d_m; // Width and time mesh parameters unsigned N_b; unsigned T; unsigned M; // Model parameters double Dse; double Dsm; double Dpe; double Dpm; double C1; double C2; double Vmax; double Km; double S0; unsigned L; unsigned ne; parameters() {} parameters( double _d_e, double _d_m, int _N_b, int _T, int _M, double _Dse, double _Dsm, double _Dpe, double _Dpm, double _C1, double _C2, double _Vmax, double _Km, double _S0, unsigned _L, unsigned _ne ) { d_e = _d_e * pow(10, -6); d_m = _d_m * pow(10, -6); N_b = _N_b; T = _T; M = _M; Dse = _Dse * pow(10, -12); Dsm = _Dsm * pow(10, -12); Dpe = _Dpe * pow(10, -12); Dpm = _Dpm * pow(10, -12); C1 = _C1; C2 = _C2; Vmax = _Vmax; Km = _Km; S0 = _S0; L = _L; ne = _ne; } std::string toString() { std::string str = "Parameters: "; str += "d_e=" + std::to_string(d_e) + ", " + "d_m=" + std::to_string(d_m) + ", " + "N_b=" + std::to_string(N_b) + ", " + "T=" + std::to_string(T) + ", " + "M=" + std::to_string(M) + ", " + "Dse=" + std::to_string(Dse) + ", " + "Dsm=" + std::to_string(Dsm) + ", " + "Dpe=" + std::to_string(Dpe) + ", " + "Dpm=" + std::to_string(Dpm) + ", " + "C1=" + std::to_string(C1) + ", " + "C2=" + std::to_string(C2) + ", " + "Vmax=" + std::to_string(Vmax) + ", " + "Km=" + std::to_string(Km) + ", " + "S0=" + std::to_string(S0) + ", " + "L=" + std::to_string(L) + ", " + "ne=" + std::to_string(ne); return str; } }; parameters readParameters(std::string); std::vector<double> get_alpha(int de_length, int dm_length); std::vector<double> get_D(std::vector<double> alpha, double D_e, double D_m); #endif //BIOSENSOR_MODELING_PARAMETERS_UTILS_H
#pragma once #include "VoreealActor.h" #include "VoreealPagedVolumeComponent.h" #include "VoreealPagedVolumeActor.generated.h" UCLASS(ComponentWrapperClass) class VOREEAL_API APagedVolumeActor : public AVoreealActor { GENERATED_BODY() public: UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Voreeal", meta = (ExposeFunctionCategories = "Voreeal,Rendering,Physics", AllowPrivateAccess = "true")) UPagedVolumeComponent* PagedVolumeComponent; public: APagedVolumeActor(const class FObjectInitializer& ObjectInitializer); // Begin AActor Interface #if WITH_EDITOR virtual void CheckForErrors() override; virtual bool GetReferencedContentObjects(TArray<UObject*>& Objects) const override; #endif // End AActor Interface protected: // Begin UObject Interface virtual FString GetDetailedInfoInternal() const override; // End UObject Interface public: UPagedVolumeComponent* GetPagedVolumeComponent() const; };
// // XiuXiuViewController.h // AiyoyouCocoapods // // Created by aiyoyou on 2017/6/30. // Copyright © 2017年 zoenet. All rights reserved. // #import "BaseViewController.h" @interface XiuXiuViewController : BaseViewController @end
#pragma once #include <zlib.h> #include "istream.h" namespace nano { /// /// \brief zlib-based streaming of gzip-compressed binary data. /// struct NANO_PUBLIC zlib_istream_t final : public istream_t { explicit zlib_istream_t(istream_t& istream, const std::streamsize max_num_bytes = max_streamsize()); ~zlib_istream_t() override; io_status advance(const std::streamsize num_bytes, buffer_t& buffer) override; private: // attributes istream_t& m_istream; ///< input stream std::streamsize m_max_num_bytes; ///< maximum number of bytes to read from the input stream z_stream m_zstream; ///< zlib stream }; }
// // ______ _____ _____ // | ____/ ____/ ____| // | |__ | | | | __ // | __|| | | | |_ | // | |___| |___| |__| | // |______\_____\_____| // // // NSObject+Swizzling.h // SnapEcgDoctor // // Created by tan on 2017/2/14. // Copyright © 2017年 baotiao ni. All rights reserved. // #import <Foundation/Foundation.h> @interface NSObject (Swizzling) + (void)swizzleSelector:(SEL)originalSelector withSwizzledSelector:(SEL)swizzledSelector; @end
#pragma once /* Copyright (c) 2013, Phil Vachon <phil@cowpig.ca> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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. */ #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ #include <tsl/errors.h> #include <stddef.h> /* Forward declare opaque structures */ struct cpu_mask; struct config; /** * Create a new, empty CPU mask * \param mask reference to receive a pointer to the new mask * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_new(struct cpu_mask **mask); /** * Clear a single node in the CPU mask * \param mask mask to update * \param cpu_id the CPU to clear * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_clear(struct cpu_mask *mask, size_t cpu_id); /** * Set a single node in the CPU mask * \param mask mask to update * \param cpu_id the CPU to clear * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_set(struct cpu_mask *mask, size_t cpu_id); /** * Clear entire CPU mask * \param mask mask to update * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_clear_all(struct cpu_mask *mask); /** * Set entire CPU mask * \param mask mask to update * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_set_all(struct cpu_mask *mask); /** * Test if a CPU is in the set * \param mask Mask to check * \param cpu_id The ID number of the CPU in question * \param value Reference to an integer to return the result in * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_test(struct cpu_mask *mask, size_t cpu_id, int *value); /** * Clone a CPU mask * \param _new Reference to a new CPU mask * \param orig Original mask to clone * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_clone(struct cpu_mask **_new, const struct cpu_mask *orig); /** * Free a CPU mask * \param mask Reference to a pointer to existing CPU mask * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_delete(struct cpu_mask **mask); /** * Apply a CPU mask * \param mask Applies the CPU mask to the current thread. * \param mask The CPU mask to be applied. * \return A_OK on success, an error code otherwise */ aresult_t cpu_mask_apply(struct cpu_mask *mask); #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */
#import <Foundation/Foundation.h> #import "JSONAPIRequest.h" @class ShuttleStop; @class ShuttleRoute; @class ShuttleRouteCache; @class ShuttleStopLocation; @protocol ShuttleDataManagerDelegate<NSObject> // everything is optional. @optional // message sent when routes were received. If request failed, this is called with a nil routes array -(void) routesReceived:(NSArray*) routes; // message sent when stops were received. If request failed, this is called with a nil stops array -(void) stopsReceived:(NSArray*) routes; // message sent when a shuttle stop is received. If request fails, this is called with nil -(void) stopInfoReceived:(NSArray*)shuttleStopSchedules forStopID:(NSString*)stopID; // message sent when a shuttle route is received. If request fails, this is called with nil -(void) routeInfoReceived:(ShuttleRoute*)shuttleRoute forRouteID:(NSString*)routeID; @end @interface ShuttleDataManager : NSObject <JSONAPIDelegate> { // cached shuttle routes. NSMutableArray* _shuttleRoutes; // cached shuttle routes sorted by route ID NSMutableDictionary* _shuttleRoutesByID; // cached shuttle stops locations. NSMutableArray* _stopLocations; NSMutableDictionary *_stopLocationsByID; // registered delegates NSMutableSet* _registeredDelegates; } @property (readonly) NSArray* shuttleRoutes; @property (readonly) NSDictionary* shuttleRoutesByID; @property (readonly) NSArray* stopLocations; @property (readonly) NSDictionary *stopLocationsByID; // get the signleton data manager +(ShuttleDataManager*) sharedDataManager; // return a list of all shuttle stops. // this method is only here for backwards compatibility with CampusMapViewController // which includes a function to display all shuttle stops on the map // though that function is not used as we decided to get rid of the shuttle button from the UI // so this can go away if that goes away - (NSArray *)shuttleStops; + (ShuttleRoute *)shuttleRouteWithID:(NSString *)routeID; + (ShuttleRouteCache *)routeCacheWithID:(NSString *)routeID; + (ShuttleStop *)stopWithRoute:(NSString *)routeID stopID:(NSString *)stopID error:(NSError **)error; + (ShuttleStopLocation *)stopLocationWithID:(NSString *)stopID; // delegate registration and unregistration -(void) registerDelegate:(id<ShuttleDataManagerDelegate>)delegate; -(void) unregisterDelegate:(id<ShuttleDataManagerDelegate>)delegate; // request the routes from the server. -(void) requestRoutes; // request the stops -(void) requestStops; // request full information about a particular stop -(void) requestStop:(NSString*)stopID; // request full information about a particular route - (void)requestFullRoute:(NSString*)routeID; - (void)requestRoute:(NSString*)routeID; @end
// Created by Yang Meyer on 03.02.12. // Copyright (c) 2012 compeople. All rights reserved. #import <UIKit/UIKit.h> @interface UIResponder (MotionRecognizers) /** Registers the receiver for future motion events. The `action` message will be sent to the receiver when a motion event occurs and is not intercepted in the responder chain. The `action` selector must take exactly one parameter of type NSNotification. You must not add a motion recognizer more than once. */ - (void) addMotionRecognizerWithAction:(SEL)action; /** You must call this before deallocating the receiver. */ - (void) removeMotionRecognizer; @end
// // EGTiledLayerViewController.h // Widgets // // Created by EG on 2017/9/4. // Copyright © 2017年 EGMade. All rights reserved. // #import "EGBasicViewController.h" @interface EGTiledLayerViewController : EGBasicViewController @end
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ #import "TiProxy.h" @interface Com0x82SocialRequestProxy : TiProxy { } @end
#import <UIKit/UIKit.h> @class ViewController; @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) ViewController *viewController; @end
// // AppDelegate.h // practice // // Created by na on 14-3-3. // Copyright (c) 2014年 na. All rights reserved. // #import <UIKit/UIKit.h> #import "LockViewController.h" @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // NSData+QGOCCAES256.h // QGOCCategory // // Created by 张如泉 on 15/10/4. // Copyright © 2015年 QuanGe. All rights reserved. // #import <Foundation/Foundation.h> @interface NSData (QGOCCAES256) /** * 对NSData进行AES256加密 * @param key:加密钥匙 * return 加密后的NSData */ - (NSData *)qgocc_aes256_encrypt:(NSString *)key; /** * 对NSData进行AES256解密 * @param key:加密钥匙 * return 解密后的NSData */ - (NSData *)qgocc_aes256_decrypt:(NSString *)key; @end
// // MUTextKitContext.h // MUKit_Example // // Created by Jekity on 2018/9/6. // Copyright © 2018年 Jeykit. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface MUTextKitContext : NSObject /** Initializes a context and its associated TextKit components. Initialization of TextKit components is a globally locking operation so be careful of bottlenecks with this class. */ - (instancetype)initWithAttributedString:(NSAttributedString *)attributedString lineBreakMode:(NSLineBreakMode)lineBreakMode maximumNumberOfLines:(NSUInteger)maximumNumberOfLines exclusionPaths:(NSArray *)exclusionPaths constrainedSize:(CGSize)constrainedSize; /** All operations on TextKit values MUST occur within this locked context. Simultaneous access (even non-mutative) to TextKit components may cause crashes. The block provided MUST not call out to client code from within its scope or it is possible for this to cause deadlocks in your application. Use with EXTREME care. Callers MUST NOT keep a ref to these internal objects and use them later. This WILL cause crashes in your application. __attribute__((noescape)) 标记一个block */ - (void)performBlockWithLockedTextKitComponents:( void (^)(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer))block; @property (nonatomic, strong ,readonly) NSLayoutManager *layoutManager; @property (nonatomic, strong ,readonly) NSTextStorage *textStorage; @property (nonatomic, strong ,readonly) NSTextContainer *textContainer; @end
/* * CompletionCheck.h * * Created on: 27/05/2011 * Author: vgil */ #ifndef COMPLETIONCHECK_H_ #define COMPLETIONCHECK_H_ #include "../RRTNode.h" #include "RRTBaseAlgorithm.h" #include "RRTMetric.h" class CompletionCheck : public RRTBaseAlgorithm { public: CompletionCheck (RRTMetric* m = NULL); virtual ~CompletionCheck (); void increaseSteps (); void increaseSucessfulSteps (); void resetSteps (); bool checkCompletion (RRTNode* node); RRTNode* getGoal () const; RRTMetric * getMetric () const; unsigned int getMaxSteps () const; unsigned int getMaxSuccessfulSteps () const; unsigned int getCurrentSteps () const; unsigned int getCurrentSuccessfulSteps () const; void setGoal (RRTNode *goal); void setMetric (RRTMetric *metric); void setMaxSteps (unsigned int steps); void setMaxSuccessfulSteps (unsigned int successful_steps); protected: virtual bool do_check_completion (RRTNode* node)=0; RRTMetric* metric; unsigned int steps; unsigned int successful_steps; RRTNode* goal; // Values for the current step unsigned int current_steps; unsigned int current_successful_steps; }; #endif /* COMPLETIONCHECK_H_ */
/* * Copyright (c) 1995 The University of Utah and * the Computer Systems Laboratory at the University of Utah (CSL). * All rights reserved. * * Permission to use, copy, modify and distribute this software is hereby * granted provided that (1) source code retains these copyright, permission, * and disclaimer notices, and (2) redistributions including binaries * reproduce the notices in supporting documentation, and (3) all advertising * materials mentioning features or use of this software display the following * acknowledgement: ``This product includes software developed by the * Computer Systems Laboratory at the University of Utah.'' * * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * CSL requests users of this software to return to csl-dist@cs.utah.edu any * improvements that they make and grant CSL redistribution rights. */ /* 15-410 mods by de0u 2008-09-02 */ #include <stdio.h> #include <console.h> int putchar(int c) { return ((unsigned char)putbyte(c)); }
// // AMSlideMenuLeftMenuSegue.h // AMSlideMenu // // The MIT License (MIT) // // Created by : arturdev // Copyright (c) 2014 SocialObjects Software. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE #import <UIKit/UIKit.h> @interface AMSlideMenuLeftMenuSegue : UIStoryboardSegue @end
// // PlayingCard.h // Matchismo // // Created by Horia Jurcut on 02/07/16. // Copyright © 2016 Horia Jurcut. All rights reserved. // #import <Foundation/Foundation.h> #import "Card.h" @interface PlayingCard : Card @property (strong, nonatomic) NSString *suit; @property (nonatomic) NSUInteger rank; + (NSArray *)validSuits; + (NSUInteger)maxRank; @end
/****************************************************************************** * FILE: mpi_latency.c * DESCRIPTION: * MPI Latency Timing Program - C Version * In this example code, a MPI communication timing test is performed. * MPI task 0 will send "reps" number of 1 byte messages to MPI task 1, * waiting for a reply between each rep. Before and after timings are made * for each rep and an average calculated when completed. * AUTHOR: Blaise Barney * LAST REVISED: 04/13/05 ******************************************************************************/ #include "mpi.h" #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <time.h> #define NUMBER_REPS 1000 int main (int argc, char *argv[]) { int reps, /* number of samples per test */ tag, /* MPI message tag parameter */ numtasks, /* number of MPI tasks */ rank, /* my MPI task number */ dest, source, /* send/receive task designators */ avgT, /* average time per rep in microseconds */ rc, /* return code */ n; double T1, T2, /* start/end times per rep */ sumT, /* sum of all reps times */ deltaT; /* time for one rep */ char msg; /* buffer containing 1 byte message */ MPI_Status status; /* MPI receive routine parameter */ MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&numtasks); MPI_Comm_rank(MPI_COMM_WORLD,&rank); if (rank == 0 && numtasks != 2) { printf("Number of tasks = %d\n",numtasks); printf("Only need 2 tasks - extra will be ignored...\n"); } // MPI_Barrier(MPI_COMM_WORLD); sumT = 0; msg = 'x'; tag = 1; reps = NUMBER_REPS; if (rank == 0) { /* round-trip latency timing test */ printf("task %d has started...\n", rank); printf("Beginning latency timing test. Number of reps = %d.\n", reps); printf("***************************************************\n"); printf("Rep# T1 T2 deltaT\n"); dest = 1; source = 1; for (n = 1; n <= reps; n++) { T1 = MPI_Wtime(); /* start time */ /* send message to worker - message tag set to 1. */ /* If return code indicates error quit */ rc = MPI_Send(&msg, 1, MPI_BYTE, dest, tag, MPI_COMM_WORLD); if (rc != MPI_SUCCESS) { printf("Send error in task 0!\n"); MPI_Abort(MPI_COMM_WORLD, rc); exit(1); } /* Now wait to receive the echo reply from the worker */ /* If return code indicates error quit */ rc = MPI_Recv(&msg, 1, MPI_BYTE, source, tag, MPI_COMM_WORLD, &status); if (rc != MPI_SUCCESS) { printf("Receive error in task 0!\n"); MPI_Abort(MPI_COMM_WORLD, rc); exit(1); } T2 = MPI_Wtime(); /* end time */ /* calculate round trip time and print */ deltaT = T2 - T1; printf("%4d %8.8f %8.8f %2.8f\n", n, T1, T2, deltaT); sumT += deltaT; } avgT = (sumT*1000000)/reps; printf("***************************************************\n"); printf("\n*** Avg round trip time = %d microseconds\n", avgT); printf("*** Avg one way latency = %d microseconds\n", avgT/2); } else if (rank == 1) { printf("task %d has started...\n", rank); dest = 0; source = 0; for (n = 1; n <= reps; n++) { rc = MPI_Recv(&msg, 1, MPI_BYTE, source, tag, MPI_COMM_WORLD, &status); if (rc != MPI_SUCCESS) { printf("Receive error in task 1!\n"); MPI_Abort(MPI_COMM_WORLD, rc); exit(1); } rc = MPI_Send(&msg, 1, MPI_BYTE, dest, tag, MPI_COMM_WORLD); if (rc != MPI_SUCCESS) { printf("Send error in task 1!\n"); MPI_Abort(MPI_COMM_WORLD, rc); exit(1); } } } MPI_Finalize(); exit(0); }
/* * defs.h * * Created on: Jul 4, 2016 * Author: kosmaz */ #ifndef DEFS_H_ #define DEFS_H_ #include <stdlib.h> #include <string.h> #include <stdint.h> #include "lcd.h" //#define TEST #define F_CPU 12000000UL //External clock frequency 12 MHz #define HIGH 0x01 //8 bit value for 1 #define LOW 0x00 //8 bit value for 0 #define TRUE HIGH //define our own true variable since C doesn't come with one by default #define FALSE LOW //define our own false variable since C doesn't come with one by default #define BATTERY_LEVEL PA2 //Analog read pin for detecting voltage battery level #define BUZZER_ON PORTA |= (1 << PA3) //Turn ON buzzer #define BUZZER_OFF PORTA &= ~(1 << PA3) //Turn OFF buzzer #define EXTERNAL_POWER_AVAILABLE PINC & (1 << PC4) //input pin used to check the availability of external power supply #define BATTERY_CHARGE_ON PORTA |= (1 << PA1) //Enable battery charging from external power supply #define BATTERY_CHARGE_OFF PORTA &= ~(1 << PA1) //Disable battery charging from external power supply #define LOAD_SUPPLY_ON PORTA |= (1 << PA0) //Enable power supply to a connected load #define LOAD_SUPPLY_OFF PORTA &= ~(1 << PA0) //Disable power supply to a connected load #define ENABLE_LED(a) PORTC |= (1 << a) //enable or turn ON a LED bulb connected to pin a #define DISABLE_LED(a) PORTC &= ~(1 << a) //disable or turn OFF a LED bulb connected to pin a /*************** MATRIX KEYPAD MAPPING START **********************/ //this enables a PIN by sending a HIGH signal to it #define MATRIX_KEYPAD_OUTPUT_ENABLE(a) PORTB |= (1 << a) //this disables a PIN by sending a LOW signal to it #define MATRIX_KEYPAD_OUTPUT_DISABLE(b) PORTB &= ~(1 << b) //this is used to scan a PIN register to indicate when a the pin has been set HIGH from user interaction #define MATRIX_KEYPAD_INPUT_ENABLED(c) PINB & (1 << c) /************** MATRIX KEYPAD MAPPING ENG *************************/ #define DEFAULT_SOC_VALUE 50 //default SOC value to be used by the module (unit = %) #define BATTERY_MAX_VOLTAGE 12.0 //defines the maximum voltage of the battery in use (unit = V) #define LCDInit() {\ lcd_init();\ lcd_on();\ lcd_disable_blinking();\ lcd_disable_cursor();\ lcd_disable_autoscroll();\ } #define LCDClear() lcd_clear() #define LCDData(b) lcd_write(b) #define LCDWriteStringXY(x, y, msg) {\ lcd_set_cursor(x, y);\ lcd_puts(msg);\ } #define LCDWriteIntXY(x, y, val, fl) {\ lcd_set_cursor(x, y);\ LCDWriteInt(val,fl);\ } void LCDWriteInt(int val,unsigned int field_length) { /*************************************************************** This function writes a integer type value to LCD module Arguments: 1)int val : Value to print 2)unsigned int field_length :total length of field in which the value is printed must be between 1-5 if it is -1 the field length is no of digits in the val ****************************************************************/ char str[5] = {0, 0, 0, 0, 0}; int i = 4, j = 0; while(val) { str[i] = val % 10; val = val / 10; i--; } if(field_length == -1) while(str[j] == 0) j++; else j = 5 - field_length; if(val < 0) LCDData('-'); for(i = j; i < 5; i++) { LCDData(48 + str[i]); } } #endif /* DEFS_H_ */
//****************************************************************************************************** // ZeroMQClient.h - Gbtc // // Copyright © 2015, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 09/09/2015 - Ritchie // Generated original version of source code. // //****************************************************************************************************** #ifndef _ZEROMQCLIENT_H #define _ZEROMQCLIENT_H #include "MiddlewareEngine.h" #include <czmq.h> #include <string> #include "../Thread.h" using namespace std; // Represents a fully asynchronous ZeroMQ client style middleware engine implementation class ZeroMQClient : public MiddlewareEngine { public: // Constructors explicit ZeroMQClient(BufferReceivedCallback callback, bool securityEnabled, int inactiveClientTimeout, bool verboseOutput, const UUID& connectionID, zcert_t* localCertificate); ~ZeroMQClient(); // Methods void Initialize(const string endPoint, const string instanceName, const string instanceID) override; void Shutdown() override; bool SendBuffer(const Buffer& buffer) override; bool SendBuffer(const UUID& /*connectionID*/, const Buffer& buffer) override; private: void Dispose(); zsock_t* GetConnectedSocket(char mode); static void ReceiveDataHandler(void* arg); // Fields string m_endPoint; zsock_t* m_sendSocket; // TCP dealer client-like socket - send only zsock_t* m_receiveSocket; // TCP dealer client-like socket - receive only zactor_t* m_monitor; // Socket event monitor zcert_t* m_localCertificate; // Complete local certificate used for curve security zcert_t* m_serverCertificate; // Public server certificate used for curve security Thread* m_receiveDataThread; volatile bool m_enabled; bool m_disposed; }; #endif
/* * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #import <Foundation/Foundation.h> #import "../AWSMobileAnalyticsContext.h" @protocol AWSMobileAnalyticsUniqueIdService <NSObject> @required -(NSString*)getUniqueIdWithContext:(id<AWSMobileAnalyticsContext>)insightsContext; @end
/* * monitor.c - Routines for monitors within the runtime. * * Copyright (C) 2003 Southern Storm Software, Pty Ltd. * * Authors: Thong Nguyen (tum@veridicus.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "engine.h" #include "lib_defs.h" #include "../support/interlocked.h" #ifdef __cplusplus extern "C" { #endif /* * See engine/lib_monitor.c for notes on the monitor algorithm. */ #ifdef IL_CONFIG_USE_THIN_LOCKS #define DEFAULT_HASHTABLE_SIZE (523) /* * An entry in the monitor Hashtable. */ typedef struct _tagILMonitorEntry ILMonitorEntry; struct _tagILMonitorEntry { volatile ILObject *obj; volatile ILLockWord lockWord; volatile ILMonitorEntry *next; }; #endif /* IL_CONFIG_USE_THIN_LOCKS */ /* * Intialize the monitor system for this process. */ int _ILExecMonitorProcessCreate(ILExecProcess *process) { #ifdef IL_CONFIG_USE_THIN_LOCKS ILMonitorEntry **table; /* Initialize the monitor system lock */ process->monitorSystemLock = ILMutexCreate(); if(!(process->monitorSystemLock)) { return 0; } table = (ILMonitorEntry **)ILGCAlloc(sizeof(ILMonitorEntry *) * DEFAULT_HASHTABLE_SIZE); if (table == 0) { ILMutexDestroy(process->monitorSystemLock); return 0; } process->monitorTable = table; return 1; #else return 1; #endif } /* * Clean up the monitor system for this process. */ int _ILExecMonitorProcessDestroy(ILExecProcess *process) { #ifdef IL_CONFIG_USE_THIN_LOCKS if (process->monitorSystemLock) { ILMutexDestroy(process->monitorSystemLock); } return 1; #else return 1; #endif } /* * Finalizer for monitors. */ static void ILExecMonitorFinalizer(void *block, void *data) { ILExecMonitor *monitor = (ILExecMonitor *)block; ILWaitHandleClose(monitor->waitMutex); } /* * Create a new monitor. */ ILExecMonitor *_ILExecMonitorCreate(void) { ILExecMonitor *monitor; /* Allocate memory for the ILExecMonitor */ if((monitor = (ILExecMonitor *)ILGCAlloc(sizeof(ILExecMonitor))) == 0) { return 0; } /* Allocate memory for the wait monitor */ if((monitor->waitMutex = ILWaitMonitorCreate()) == 0) { ILFree(monitor); return 0; } monitor->waiters = 0; monitor->next = 0; ILGCRegisterFinalizer(monitor, ILExecMonitorFinalizer, 0); return monitor; } #ifdef IL_CONFIG_USE_THIN_LOCKS /* * Gets a pointer to the WaitHandle object used by the object. */ static IL_INLINE ILLockWord *GetObjectLockWordPtr(ILExecThread *thread, ILObject *obj) { ILNativeInt x; volatile ILMonitorEntry **table, *entry, *preventry, *ghost, *ghostparent; ILMutexLock(thread->process->monitorSystemLock); table = thread->process->monitorTable; /* Get the hashtable index */ x = (ILNativeInt)obj; x = x ^ (x / sizeof(int)); x %= DEFAULT_HASHTABLE_SIZE; entry = table[x]; ghost = 0; ghostparent = 0; preventry = 0; for (;;) { if (entry == 0) { if (ghost == 0) { /* No ghost found. Create a whole new entry. */ if ((entry = (ILMonitorEntry *)ILGCAlloc(sizeof(ILMonitorEntry))) == 0) { ILMutexUnlock(thread->process->monitorSystemLock); ILExecThreadThrowOutOfMemory(thread); return 0; } } else { /* Use the entry that no longer points to a live object */ entry = ghost; /* Remove ghost from list */ if (ghostparent == 0) { table[x] = ghost->next; } else { ghostparent->next = ghost->next; } ILGCUnregisterWeak((void *)&entry->obj); } /* Setup the new entry */ entry->obj = obj; entry->next = table[x]; entry->lockWord = 0; table[x] = entry; /* Tells the GC to zero entry->obj if obj is GC-ed */ ILGCRegisterGeneralWeak((void *)&entry->obj, obj); ILMutexUnlock(thread->process->monitorSystemLock); return (ILLockWord *)&entry->lockWord; } else if (entry->obj == obj) { /* Entry was found. Return it */ ILMutexUnlock(thread->process->monitorSystemLock); return (ILLockWord *)&entry->lockWord; } else if (entry->obj == 0) { /* Found an entry pointing to a dead object */ if (ghost == 0) { ghost = entry; /* Save the parent so we can remove the ghost from the list if it is used */ ghostparent = preventry; } } preventry = entry; entry = entry->next; } ILMutexUnlock(thread->process->monitorSystemLock); return 0; } /* * Implementation of GetObjectLockWord using hashtables. */ ILLockWord GetObjectLockWord(ILExecThread *thread, ILObject *obj) { return *GetObjectLockWordPtr(thread, obj); } /* * Implementation of SetObjectLockWord using hashtables. */ void SetObjectLockWord(ILExecThread *thread, ILObject *obj, ILLockWord value) { *GetObjectLockWordPtr(thread, obj) = value; } /* * Implementation of CompareAndExchangeObjectLockWord using hashtables. */ ILLockWord CompareAndExchangeObjectLockWord(ILExecThread *thread, ILObject *obj, ILLockWord value, ILLockWord comparand) { ILLockWord oldValue; ILLockWord *lockWordPtr; /* Lockdown the monitor hashtable */ ILMutexLock(thread->process->monitorSystemLock); lockWordPtr = GetObjectLockWordPtr(thread, obj); /* Do the compare & exchange */ if ((oldValue = *lockWordPtr ) == comparand) { *lockWordPtr = value; } /* Unlock the monitor hashtable */ ILMutexUnlock(thread->process->monitorSystemLock); return oldValue; } #endif /* IL_CONFIG_USE_THIN_LOCKS */ #ifdef __cplusplus }; #endif
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef js_Id_h #define js_Id_h // A jsid is an identifier for a property or method of an object which is // either a 31-bit signed integer, interned string or object. // // Also, there is an additional jsid value, JSID_VOID, which does not occur in // JS scripts but may be used to indicate the absence of a valid jsid. A void // jsid is not a valid id and only arises as an exceptional API return value, // such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI // entry points expecting a jsid and do not need to handle JSID_VOID in hooks // receiving a jsid except when explicitly noted in the API contract. // // A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or // JS_IdToValue must be used instead. #include "mozilla/NullPtr.h" #include "jstypes.h" #include "js/HeapAPI.h" #include "js/RootingAPI.h" #include "js/TypeDecls.h" #include "js/Utility.h" struct jsid { size_t asBits; bool operator==(jsid rhs) const { return asBits == rhs.asBits; } bool operator!=(jsid rhs) const { return asBits != rhs.asBits; } }; #define JSID_BITS(id) (id.asBits) #define JSID_TYPE_STRING 0x0 #define JSID_TYPE_INT 0x1 #define JSID_TYPE_VOID 0x2 #define JSID_TYPE_SYMBOL 0x4 #define JSID_TYPE_MASK 0x7 // Avoid using canonical 'id' for jsid parameters since this is a magic word in // Objective-C++ which, apparently, wants to be able to #include jsapi.h. #define id iden static MOZ_ALWAYS_INLINE bool JSID_IS_STRING(jsid id) { return (JSID_BITS(id) & JSID_TYPE_MASK) == 0; } static MOZ_ALWAYS_INLINE JSString * JSID_TO_STRING(jsid id) { MOZ_ASSERT(JSID_IS_STRING(id)); return (JSString *)JSID_BITS(id); } /* * Only JSStrings that have been interned via the JSAPI can be turned into * jsids by API clients. * * N.B. if a jsid is backed by a string which has not been interned, that * string must be appropriately rooted to avoid being collected by the GC. */ JS_PUBLIC_API(jsid) INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str); static MOZ_ALWAYS_INLINE bool JSID_IS_ZERO(jsid id) { return JSID_BITS(id) == 0; } static MOZ_ALWAYS_INLINE bool JSID_IS_INT(jsid id) { return !!(JSID_BITS(id) & JSID_TYPE_INT); } static MOZ_ALWAYS_INLINE int32_t JSID_TO_INT(jsid id) { MOZ_ASSERT(JSID_IS_INT(id)); return ((uint32_t)JSID_BITS(id)) >> 1; } #define JSID_INT_MIN 0 #define JSID_INT_MAX INT32_MAX static MOZ_ALWAYS_INLINE bool INT_FITS_IN_JSID(int32_t i) { return i >= 0; } static MOZ_ALWAYS_INLINE jsid INT_TO_JSID(int32_t i) { jsid id; MOZ_ASSERT(INT_FITS_IN_JSID(i)); JSID_BITS(id) = ((i << 1) | JSID_TYPE_INT); return id; } static MOZ_ALWAYS_INLINE bool JSID_IS_SYMBOL(jsid id) { return (JSID_BITS(id) & JSID_TYPE_MASK) == JSID_TYPE_SYMBOL && JSID_BITS(id) != JSID_TYPE_SYMBOL; } static MOZ_ALWAYS_INLINE JS::Symbol * JSID_TO_SYMBOL(jsid id) { MOZ_ASSERT(JSID_IS_SYMBOL(id)); return (JS::Symbol *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); } static MOZ_ALWAYS_INLINE jsid SYMBOL_TO_JSID(JS::Symbol *sym) { jsid id; MOZ_ASSERT(sym != nullptr); MOZ_ASSERT((size_t(sym) & JSID_TYPE_MASK) == 0); JS_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(sym))); JS_ASSERT(!JS::IsPoisonedPtr(sym)); JSID_BITS(id) = (size_t(sym) | JSID_TYPE_SYMBOL); return id; } static MOZ_ALWAYS_INLINE bool JSID_IS_GCTHING(jsid id) { return JSID_IS_STRING(id) || JSID_IS_SYMBOL(id); } static MOZ_ALWAYS_INLINE void * JSID_TO_GCTHING(jsid id) { return (void *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); } static MOZ_ALWAYS_INLINE bool JSID_IS_VOID(const jsid id) { MOZ_ASSERT_IF(((size_t)JSID_BITS(id) & JSID_TYPE_MASK) == JSID_TYPE_VOID, JSID_BITS(id) == JSID_TYPE_VOID); return (size_t)JSID_BITS(id) == JSID_TYPE_VOID; } static MOZ_ALWAYS_INLINE bool JSID_IS_EMPTY(const jsid id) { return (size_t)JSID_BITS(id) == JSID_TYPE_SYMBOL; } extern JS_PUBLIC_DATA(const jsid) JSID_VOID; extern JS_PUBLIC_DATA(const jsid) JSID_EMPTY; extern JS_PUBLIC_DATA(const JS::HandleId) JSID_VOIDHANDLE; extern JS_PUBLIC_DATA(const JS::HandleId) JSID_EMPTYHANDLE; namespace js { inline bool IsPoisonedId(jsid id) { if (JSID_IS_STRING(id)) return JS::IsPoisonedPtr(JSID_TO_STRING(id)); if (JSID_IS_SYMBOL(id)) return JS::IsPoisonedPtr(JSID_TO_SYMBOL(id)); return false; } template <> struct GCMethods<jsid> { static jsid initial() { return JSID_VOID; } static bool poisoned(jsid id) { return IsPoisonedId(id); } static bool needsPostBarrier(jsid id) { return false; } #ifdef JSGC_GENERATIONAL static void postBarrier(jsid *idp) {} static void relocate(jsid *idp) {} #endif }; #undef id } #endif /* js_Id_h */
#include "cmd-run.h" char** cmd_run_mkcl(int argc,char** argv,struct sub_command* cmd) { char* home=configdir(); char* arch=uname_m(); char* os=uname_s(); char* impl=(char*)cmd->name; char* version=(char*)cmd->short_name; /*[binpath for mkcl] -norc -q -eval init.lisp [terminating NULL] that total 6 are default. */ int i; char* impl_path=impldir(arch,os,impl,version); char* help=get_opt("help",0); char* script=get_opt("script",0); char* image=get_opt("image",0); char* program=get_opt("program",0); char* lisp_temp_stack_limit=get_opt("lisp-temp-stack-limit",0); char* frame_stack_limit=get_opt("frame-stack-limit",0); char* binding_stack_limit=get_opt("binding-stack-limit",0); char* heap_size_limit=get_opt("heap-size-limit",0); LVal ret=0; ret=conss((strcmp("system",version)==0)?truename(which("mkcl")):cat(home,impl_path,DIRSEP,"bin",DIRSEP,"mkcl",EXE_EXTENTION,NULL),ret); s(arch),s(os),s(impl_path); if(get_opt("version",0)) ret=conss(q("--version"),ret); /* runtime options from here */ ret=conss(q("-norc"),ret); if(lisp_temp_stack_limit) ret=conss(q(lisp_temp_stack_limit),conss(q("--lisp-temp-stack-limit"),ret)); if(frame_stack_limit) ret=conss(q(frame_stack_limit),conss(q("--frame-stack-limit"),ret)); if(binding_stack_limit) ret=conss(q(binding_stack_limit),conss(q("--binding-stack-limit"),ret)); if(heap_size_limit) ret=conss(q(heap_size_limit),conss(q("--heap-size-limit"),ret)); ret=conss(q("-q"),ret); if(get_opt("version",0)) ret=conss(q("--version"),ret); ret=conss(q("-eval"),ret); ret=conss(s_cat(q("(progn(setq *load-verbose*()*compile-verbose*())#-ros.init(cl:load \""), s_escape_string(lispdir()),q("init.lisp"),q("\"))"),NULL),ret); ret=conss(q("-eval"),ret); ret=conss(s_cat(q("(ros:run '("),q(program?program:""), script?cat("(:script ",script,")(:quit ())",NULL):q(""), q("))"),NULL),ret); for(i=1;i<argc;++i) ret=conss(q(argv[i]),ret); cond_printf(1,"\nhelp=%s script=%s\n",help?"t":"nil",script?script:"nil"); return stringlist_array(nreverse(ret)); }
// // heligun: 3D flight sim shooter // Copyright (c) 2016 Joseph Kuziel // // This software is MIT licensed. // #include "sdlext.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <SDL2/SDL_rwops.h> #include <SDL2/SDL_error.h> void sdlextPrintError() { printf("[SDL] %s\n", SDL_GetError()); SDL_ClearError(); } char* sdlextReadTextFile( const char* filename ) { if(filename == NULL) { return NULL; } SDL_RWops* file = SDL_RWFromFile(filename, "r"); if(file == NULL) { sdlextPrintError(); return NULL; } Sint64 file_size = SDL_RWsize(file); if(file_size < 0) { sdlextPrintError(); return 0; } char* file_buffer = (char*)malloc(file_size + 1); size_t bytes_read = 0; size_t total_bytes_read = 0; char* bufferptr = file_buffer; do { bytes_read = SDL_RWread( file , bufferptr , 1 , (file_size - total_bytes_read) ); total_bytes_read += bytes_read; bufferptr += bytes_read; } while(bytes_read > 0); SDL_RWclose(file); if(total_bytes_read != file_size) { free(file_buffer); return NULL; } file_buffer[total_bytes_read] = '\0'; return file_buffer; }
#include <stdio.h> void push(int key,int a[],int *top){ (*top)++; a[*top] = key; } int pop(int a[],int *top){ int t = a[*top]; (*top)--; return t; } int main(void) { int a[20]; int top = -1; int num = 123; int rev=0; int i = 1; while(num!=0){ push(num%10,a,&top); num = num/10; } while(top != -1){ rev = rev + pop(a,&top)*i; i=i*10; } printf("%d\n",rev); return 0; }
#ifndef tresholdFunctions_h #define tresholdFunctions_h namespace Treshold{ // ==== polynom order 0 inline double p0i( double x ){ if ( x < 0 ){ return 0; } else { return x; } }; inline double p0( double x ){ if ( x < 0 ){ return 0; } else { return 1; } }; // ==== polynom order 1 inline double p1i( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1 ){ return x-0.5d; } else { return 0.5d*x*x; } }; inline double p1( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1 ){ return 1; } else { return x; } }; inline double p1d( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1 ){ return 0; } else { return 1; } }; // ==== polynom order 2 // two parabolas inline double p2i( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return x-0.5d; } else if ( x < 0.5 ){ return 0.66666666666*x*x*x; } else { return ((-0.66666666666*x + 2)*x - 1 )*x + 0.16666666666; } //else { return -0.66666666666*x*x*x + 2*x*x - x + 0.16666666666; } }; inline double p2( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 1; } else if ( x < 0.5 ){ return 2*x*x; } else { return (4-2*x)*x-1; } //else { double x_ = x-1; return 1-2*x_*x_; } //else { return 1-2*x*x+4*x-2; } }; inline double p2d( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 0; } else if ( x < 0.5 ){ return 4*x; } else { return 4*(1-x); } }; // ==== polynom order 3 // cubic see https://en.wikipedia.org/wiki/Smoothstep inline double p3i( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return x - 0.5d; } else { return x*x*x*( 1 - 0.5d * x ); } }; inline double p3( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 1; } else { return x*x*(3-2*x); } }; inline double p3d( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 0; } else { return 6*x*(1-x); } }; // ==== polynom order 4 // NOT GOOD /* inline double p4i( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return x-0.5d; } else if ( x < 0.5 ){ return 0.66666666666*x*x*x; } else { return ((-0.66666666666*x + 2)*x - 1 )*x + 0.16666666666; } //else { return -0.66666666666*x*x*x + 2*x*x - x + 0.16666666666; } }; inline double p4( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 1; } else if ( x < 0.5 ){ double x2 =x*x; return 8*x2*x2; } else { double x_ = x-1; double x2 = x_*x_; return 1 - 8*x2*x2; } //else { double x_ = x-1; return 1-2*x_*x_; } //else { return 1-2*x*x+4*x-2; } }; inline double p4d( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 0; } else if ( x < 0.5 ){ return 32*x*x*x; } else { return -32*x*x*x; } }; */ // ==== polynom order 5 // Perlin see https://en.wikipedia.org/wiki/Smoothstep inline double p5i( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return x-0.5d; } else { return x*x*x*x*( 10.0d/4 - x*( 3 - x ) ); } }; inline double p5( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 1; } else { return x*x*x*(10 - x*( 15 - 6*x ) ); } //else { double x2=x*x; return x*x2*( x2*6 - 15*x +10 ); } }; inline double p5d( double x ){ if ( x < 0 ){ return 0; } else if ( x > 1.0 ){ return 0; } else { return x*x*( 30 - x * ( 60 - 30*x ) ); } }; // ==== 1/x inline double r1i( double x ){ if ( x < 0 ){ return - x - log(1-x); } else { return x - log(1+x); } }; inline double r1( double x ){ if ( x < 0 ){ return x/(1-x); } else { return x/(1+x); } }; inline double r1d( double x ){ if ( x < 0 ){ double x_ = 1-x; return 1/(x_*x_); } else { double x_ = 1+x; return 1/(x_*x_); } }; // ==== 1/x2 inline double r2i( double x ){ if ( x < 0 ){ double x_ = 1-x; return -x + 0.5d/(x_*x_) - 0.5d; } else { double x_ = 1+x; return x + 0.5d/(x_*x_) - 0.5d; } }; inline double r2( double x ){ if ( x < 0 ){ double x_ = 1-x; return -1 + 1/(x_*x_*x_); } else { double x_ = 1+x; return 1 - 1/(x_*x_*x_); } }; inline double r2d( double x ){ if ( x < 0 ){ double x_ = 1-x; double x2 = x_*x_; return 3/(x2*x2); } else { double x_ = 1+x; double x2 = x_*x_; return 3/(x2*x2); } }; // ==== 1/sqrt(1+x2) inline double root2i( double x ){ return sqrt( 1 + x*x ); }; inline double root2( double x ){ return x/sqrt( 1 + x*x ); }; inline double root2d( double x ){ double a = sqrt(1 + x*x); return 1/(a*a*a); }; } #endif
// // AppDelegate.h // ios-WK-UI-Webview // // Created by Emiliano Barbosa on 9/15/15. // Copyright © 2015 Bocamuchas. All rights reserved. // #import <UIKit/UIKit.h> #import <CoreData/CoreData.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; - (void)saveContext; - (NSURL *)applicationDocumentsDirectory; @end
#ifndef _EZ_DRAW_PROTOTYPES_ #define _EZ_DRAW_PROTOTYPES_ #include "EzDraw.h" #ifdef __cplusplus extern "C" { #endif typedef struct tag_ezdFunctions { HINSTANCE hInst; EZDBOOL (EZDCDECL* ezdInitialize)(void); void (EZDCDECL* ezdCleanUp)(void); EZDHANDLE (EZDCDECL* ezdDrawLine)(EZDFLOAT fX1, EZDFLOAT fY1, EZDFLOAT fX2, EZDFLOAT fY2); EZDHANDLE (EZDCDECL* ezdDrawRectangle)(EZDFLOAT fX1, EZDFLOAT fY1, EZDFLOAT fX2, EZDFLOAT fY2); EZDHANDLE (EZDCDECL* ezdDrawCircle)(EZDFLOAT fX, EZDFLOAT fY, EZDFLOAT fR); EZDHANDLE (EZDCDECL* ezdDrawPoint)(EZDFLOAT fX, EZDFLOAT fY); EZDHANDLE (EZDCDECL* ezdDrawPolygon)(EZDULONG lCount, EZDLPFLOAT pfXarray, EZDLPFLOAT pfYarray); EZDHANDLE (EZDCDECL* ezdDrawText)(EZDLPCHAR szText, EZDFLOAT fX, EZDFLOAT fY); EZDBOOL (EZDCDECL* ezdDeleteShape)(EZDHANDLE hShape); EZDCOLORVAL (EZDCDECL* ezdSetColor)(EZDCOLORVAL color); EZDCHAR (EZDCDECL* ezdWaitForKeyPress)(); } EZDFUNCS, *LPEZDFUNCS; EZDFUNCS EZDEXTDATA ezdFuncs; #define EZDFUNC_ORDNAL ((LPCTSTR)(9)) #ifdef __cplusplus } #endif #endif
/*********************************************************************** Copyright (c) 2008, 2009, Memo Akten, www.memo.tv, Douglas Edric Stanley, www.abstractmachine.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of MSA Visuals 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. * * ***********************************************************************/ #pragma once #include <Availability.h> #ifdef __IPHONE_3_0 #include "ofMain.h" #include <MapKit/MapKit.h> #include "ofxiPhoneMapKitListener.h" #include <list> // these are the types you can set for the map enum ofxiPhoneMapKitType { OFXIPHONE_MAPKIT_MAP = MKMapTypeStandard, OFXIPHONE_MAPKIT_SATELLITE = MKMapTypeSatellite, OFXIPHONE_MAPKIT_HYRBID = MKMapTypeHybrid }; // this is a type, similar to ofPoint, but with better precision for storing latitude and longitude typedef CLLocationCoordinate2D ofxMapKitLocation; class ofxiPhoneMapKit : public ofxiPhoneMapKitListener { public: ofxiPhoneMapKit(); ~ofxiPhoneMapKit(); // open the mapview void open(); // hide the mapview void close(); // latitude is south/north (-90...90) // longitude is east/west (-180...180) // set center (latitude,longitude) of map void setCenter(double latitude, double longitude, bool animated = true); // set span of map (in degrees) void setSpan(double latitudeDelta, double longitudeDelta, bool animated = true); // set span of map (in meters) void setSpanWithMeters(double metersLatitude, double metersLongitude, bool animated = true); // set center (latidude, longitude) and span (in degrees) void setRegion(double latitude, double longitude, double latitudeDelta, double longitudeDelta, bool animated = true); // set center (latidude, longitude) and span (in meters) void setRegionWithMeters(double latitude, double longitude, double metersLatitude, double metersLongitude, bool animated = true); // set the map type (see ofxiPhoneMapKitType above) void setType(ofxiPhoneMapKitType type = OFXIPHONE_MAPKIT_MAP); // set whether user location is visible on the map (as a blue dot) void setShowUserLocation(bool b); // enable/disable user interaction // if user interaction is not allowed, setAllowZoom / setAllowScroll are ignored // if user interaction is allowed, testApp::touchXXXX events will not be called void setAllowUserInteraction(bool b); // set whether user is allowed to zoom in or not void setAllowZoom(bool b); // set whether user is allowed to scroll the view or not void setAllowScroll(bool b); // returns whether the user location is visible in the current map region bool isUserOnScreen(); // return current center of map (latitude, longitude) ofxMapKitLocation getCenterLocation(); // convert location (latitude, longitude) to screen coordinates (i.e. pixels) ofPoint getScreenCoordinatesForLocation(double latitude, double longitude); // convert screen coordinates (i.e. pixels) to location (latitude, longitude) ofxMapKitLocation getLocationForScreenCoordinates(float x, float y); // convert location (latitude, longitude) and span (in degrees) to screen coordinates (i.e. pixels) ofRectangle getScreenRectForRegion(double latitude, double latitudeDelta, double longitudeDelta); // convert location (latitude, longitude) and span (in meters) to screen coordinates (i.e. pixels) ofRectangle getScreenRectForRegionWithMeters(double latitude, double longitude, double metersLatitude, double metersLongitude); // returns whether the map is open or not bool isOpen(); void addListener(ofxiPhoneMapKitListener* l); void removeListener(ofxiPhoneMapKitListener* l); void regionWillChange(bool animated); void regionDidChange(bool animated); void willStartLoadingMap(); void didFinishLoadingMap(); void errorLoadingMap(string errorDescription); // return instance to MKMapView MKMapView *getMKMapView(); protected: MKMapView *mapView; std::list<ofxiPhoneMapKitListener*> listeners; CLLocationCoordinate2D makeCLLocation(double latitude, double longitude); MKCoordinateSpan makeMKCoordinateSpan(double latitudeDelta, double longitudeDelta); void _setRegion(CLLocationCoordinate2D center, MKCoordinateSpan span, bool animated); }; #endif
// Copyright (c) 2017-2018 The DigiByte Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef DIGIBYTE_INDEX_TXINDEX_H #define DIGIBYTE_INDEX_TXINDEX_H #include <chain.h> #include <index/base.h> #include <txdb.h> /** * TxIndex is used to look up transactions included in the blockchain by hash. * The index is written to a LevelDB database and records the filesystem * location of each transaction by transaction hash. */ class TxIndex final : public BaseIndex { protected: class DB; private: const std::unique_ptr<DB> m_db; protected: /// Override base class init to migrate from old database. bool Init() override; bool WriteBlock(const CBlock& block, const CBlockIndex* pindex) override; BaseIndex::DB& GetDB() const override; const char* GetName() const override { return "txindex"; } public: /// Constructs the index, which becomes available to be queried. explicit TxIndex(size_t n_cache_size, bool f_memory = false, bool f_wipe = false); // Destructor is declared because this class contains a unique_ptr to an incomplete type. virtual ~TxIndex() override; /// Look up a transaction by hash. /// /// @param[in] tx_hash The hash of the transaction to be returned. /// @param[out] block_hash The hash of the block the transaction is found in. /// @param[out] tx The transaction itself. /// @return true if transaction is found, false otherwise bool FindTx(const uint256& tx_hash, uint256& block_hash, CTransactionRef& tx) const; }; /// The global transaction index, used in GetTransaction. May be null. extern std::unique_ptr<TxIndex> g_txindex; #endif // DIGIBYTE_INDEX_TXINDEX_H
#ifndef _EASYEDITOR_SHAPES_CONTAINER_H_ #define _EASYEDITOR_SHAPES_CONTAINER_H_ #include "DataContainer.h" #include "ObjectVector.h" #include "Shape.h" namespace ee { class ShapesContainer : public DataContainer<ee::Shape> { public: virtual ~ShapesContainer(); // // DataContainer interface // virtual void Traverse(RefVisitor<ee::Shape>& visitor, bool order = true) const override; virtual void Traverse(RefVisitor<ee::Shape>& visitor, DataTraverseType type = DT_ALL, bool order = true) const override; virtual bool Remove(const ee::ShapePtr& shape) override; virtual bool Insert(const ee::ShapePtr& shape) override; virtual bool Insert(const ee::ShapePtr& shape, int idx) override; virtual bool Clear() override; virtual bool ResetOrder(const ee::ShapeConstPtr& shape, bool up) override; virtual bool ResetOrderMost(const ee::ShapeConstPtr& shape, bool up) override; private: ObjectVector<Shape> m_shapes; }; // ShapesContainer } #endif // _EASYEDITOR_SHAPES_CONTAINER_H_
// Copyright Sigurdur Gunnarsson. All Rights Reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // Example cylinder mesh #pragma once #include "CoreMinimal.h" #include "RuntimeMeshActor.h" #include "SimpleCylinderActor.generated.h" UCLASS() class PROCEDURALMESHES_API ASimpleCylinderActor : public ARuntimeMeshActor { GENERATED_BODY() public: ASimpleCylinderActor(); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") float Radius = 10; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") float Height = 100; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") int32 RadialSegmentCount = 10; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") bool bCapEnds = true; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") bool bDoubleSided = false; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") bool bSmoothNormals = true; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Procedural Parameters") UMaterialInterface* Material; virtual void OnConstruction(const FTransform& Transform) override; virtual void PostLoad() override; protected: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Transient) URuntimeMeshProviderStatic* StaticProvider; private: void GenerateMesh(); static void GenerateCylinder(TArray<FVector>& InVertices, TArray<int32>& InTriangles, TArray<FVector>& InNormals, TArray<FRuntimeMeshTangent>& InTangents, TArray<FVector2D>& InTexCoords, const float InHeight, const float InWidth, const int32 InCrossSectionCount, const bool bInCapEnds = false, const bool bInDoubleSided = false, const bool bInSmoothNormals = true); // Mesh buffers void SetupMeshBuffers(); UPROPERTY(Transient) TArray<FVector> Positions; UPROPERTY(Transient) TArray<int32> Triangles; UPROPERTY(Transient) TArray<FVector> Normals; UPROPERTY(Transient) TArray<FRuntimeMeshTangent> Tangents; UPROPERTY(Transient) TArray<FVector2D> TexCoords; };
#include <stdlib.h> #ifndef NEWSTATE #error "NEWSTATE not specified" #endif #ifndef WRITESTRING #error "WRITESTRING not specified" #endif extern void * NEWSTATE(void (*f)(void), void * ud); void *lua_newstate( void (*f)(void), void * ud) { return NEWSTATE(f,ud); } extern size_t WRITESTRING(char *s, size_t l); size_t galua_writestring( char * s, size_t l ) { return WRITESTRING(s, l); }
#ifndef DW_RAYTRACER_RAY_H #define DW_RAYTRACER_RAY_H #include "Vector3.h" namespace raytracer { class Ray { public: inline Ray() { } inline Ray(const Vector3& rOrigin, const Vector3& rDirection) { setOrigin(rOrigin); setDirection(rDirection); } inline Vector3 pointAtParameter(float t) const { return rOrigin + (t * rDirection); } inline const Vector3& origin() const { return rOrigin; } inline const Vector3& direction() const { return rDirection; } inline const Vector3& inverseDirection() const { return rInverseDirection; } inline void setOrigin(const Vector3& newOrigin) { rOrigin = newOrigin; } inline void setDirection(const Vector3& newDirection) { rDirection = newDirection; // Compute inverse of ray direction rInverseDirection = Vector3(1.0f / rDirection.x, 1.0f / rDirection.y, 1.0f / rDirection.z); // Update ray direction sings directionSigns[0] = (rDirection.x > 0 ? 0 : 1); directionSigns[1] = (rDirection.y > 0 ? 0 : 1); directionSigns[2] = (rDirection.z > 0 ? 0 : 1); } // Sign of (X, Y, Z) components of directions. // These values are pre-computed so efficient bounding box // intersections can be performed. This strategy was taken // from the book Realistic Raytracing (Shirley, Morley) int directionSigns[3]; private: Vector3 rOrigin; Vector3 rDirection; // The ray's INVERSE direction is also pre-computed for efficiency Vector3 rInverseDirection; }; } #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkCellTypes.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkCellTypes - object provides direct access to cells in vtkCellArray and type information // .SECTION Description // This class is a supplemental object to vtkCellArray to allow random access // into cells as well as representing cell type information. The "location" // field is the location in the vtkCellArray list in terms of an integer // offset. An integer offset was used instead of a pointer for easy storage // and inter-process communication. The type information is defined in the // file vtkCellType.h. // // .SECTION Caveats // Sometimes this class is used to pass type information independent of the // random access (i.e., location) information. For example, see // vtkDataSet::GetCellTypes(). If you use the class in this way, you can use // a location value of -1. // // .SECTION See Also // vtkCellArray vtkCellLinks #ifndef vtkCellTypes_h #define vtkCellTypes_h #include "vtkCommonDataModelModule.h" // For export macro #include "vtkObject.h" #include "vtkIntArray.h" // Needed for inline methods #include "vtkUnsignedCharArray.h" // Needed for inline methods #include "vtkCellType.h" // Needed for VTK_EMPTY_CELL class VTKCOMMONDATAMODEL_EXPORT vtkCellTypes : public vtkObject { public: static vtkCellTypes *New(); vtkTypeMacro(vtkCellTypes,vtkObject); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Allocate memory for this array. Delete old storage only if necessary. int Allocate(int sz=512, int ext=1000); // Description: // Add a cell at specified id. void InsertCell(int id, unsigned char type, int loc); // Description: // Add a cell to the object in the next available slot. vtkIdType InsertNextCell(unsigned char type, int loc); // Description: // Specify a group of cell types. void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations); // Description: // Return the location of the cell in the associated vtkCellArray. vtkIdType GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);}; // Description: // Delete cell by setting to NULL cell type. void DeleteCell(vtkIdType cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);}; // Description: // Return the number of types in the list. vtkIdType GetNumberOfTypes() { return (this->MaxId + 1);}; // Description: // Return 1 if type specified is contained in list; 0 otherwise. int IsType(unsigned char type); // Description: // Add the type specified to the end of the list. Range checking is performed. vtkIdType InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);}; // Description: // Return the type of cell. unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);}; // Description: // Reclaim any extra memory. void Squeeze(); // Description: // Initialize object without releasing memory. void Reset(); // Description: // Return the memory in kilobytes consumed by this cell type array. // Used to support streaming and reading/writing data. The value // returned is guaranteed to be greater than or equal to the memory // required to actually represent the data represented by this object. // The information returned is valid only after the pipeline has // been updated. unsigned long GetActualMemorySize(); // Description: // Standard DeepCopy method. Since this object contains no reference // to other objects, there is no ShallowCopy. void DeepCopy(vtkCellTypes *src); // Description: // Given an int (as defined in vtkCellType.h) identifier for a class // return it's classname. static const char* GetClassNameFromTypeId(int typeId); // Description: // Given a data object classname, return it's int identified (as // defined in vtkCellType.h) static int GetTypeIdFromClassName(const char* classname); // Description: // This convenience method is a fast check to determine if a cell type // represents a linear or nonlinear cell. This is generally much more // efficient than getting the appropriate vtkCell and checking its IsLinear // method. static int IsLinear(unsigned char type); protected: vtkCellTypes(); ~vtkCellTypes(); vtkUnsignedCharArray *TypeArray; // pointer to types array vtkIntArray *LocationArray; // pointer to array of offsets vtkIdType Size; // allocated size of data vtkIdType MaxId; // maximum index inserted thus far vtkIdType Extend; // grow array by this point private: vtkCellTypes(const vtkCellTypes&); // Not implemented. void operator=(const vtkCellTypes&); // Not implemented. }; //---------------------------------------------------------------------------- inline int vtkCellTypes::IsType(unsigned char type) { int numTypes=this->GetNumberOfTypes(); for (int i=0; i<numTypes; i++) { if ( type == this->GetCellType(i)) { return 1; } } return 0; } //----------------------------------------------------------------------------- inline int vtkCellTypes::IsLinear(unsigned char type) { return ( (type <= 20) || (type == VTK_CONVEX_POINT_SET) || (type == VTK_POLYHEDRON) ); } #endif
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "UIWindow.h" @interface UIWindow (MPAdditions) - (id)copyIOSurfaceSnapshotView:(long long)arg1; @end
#ifndef IntCell_H #define IntCell_H /** * A class for siulating an integer memory cell. */ class IntCell { public: explicit IntCell(int initialValue = 0); int read() const; void write(int x); private: int *storedValue; }; #endif
// // Gateway+Foreground.h // Vihome // // Created by Air on 15-1-27. // Copyright © 2017年 orvibo. All rights reserved. // #import "Gateway.h" @interface Gateway (Foreground) - (void)searchMdnsResult:(NSNotification *)notif; -(void)readTable:(NSString *)tableName uid:(NSString *)uid completion:(commonBlock)completion; @end
#pragma once /** * @file PluginHelper.h * @brief Contains helper functions to make writing plugin classes easier. * * @author Michael Albers */ #include <cstdint> #include <functional> #include <stdexcept> #include <string> #include "PluginEntity.h" namespace QS { /** * Contains helpful functions for writing plugin classes. */ class PluginHelper { public: /** * Returns the property with the given name. * * @param theProperties * properties from which to retrieve the specified property * @param thePropertyName * property name * @param theRequired * true if the property is required * @param theConversionFunction * function to convert the string to the type T * @param theDefault * default value if the property isn't given or the conversion * fails on an invalid optional property * @return property value of defined type * @throws std::invalid_argument if theRequired is true and the property * doesn't exist. * @throws &lt;unknown&gt; whatever the converter function might throw */ template<class T> static T getProperty( const PluginEntity::Properties &theProperties, const std::string &thePropertyName, bool theRequired, std::function<T(const std::string&)> theConversionFunction, T theDefault = T()) { T value = theDefault; auto propertyIter = theProperties.find(thePropertyName); if (theProperties.end() == propertyIter) { if (theRequired) { throw std::invalid_argument( "Missing '" + thePropertyName + "' property."); } } else { value = theConversionFunction(propertyIter->second); } return value; } /** * Converter function for use in getProperty. Converts the given value * to a float. * * @throws std::invalid_argument * if value cannot be converted to a float */ static const std::function<float(const std::string&)> toFloat; /** * Converter function for use in getProperty. Converts the given value * to an unsigned int. * * @throws std::invalid_argument * if value cannot be converted to an unsigned int */ static const std::function<uint64_t(const std::string&)> toUint; protected: private: }; }
// // CLCAppDelegate.h // CLCBannerNotifications // // Created by CocoaPods on 06/02/2015. // Copyright (c) 2014 Calvin Cestari. All rights reserved. // @import UIKit; @interface CLCAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // AppDelegate.h // JRTLeftSliderController // // Created by Juan Garcia on 1/7/16. // Copyright © 2016 jerti. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/** * Copyright (C) 2013-2015 * * @author coding.tom@gmail.com * @date 2013-7-9 * * @file tiny_malloc.h * * @remark * set tabstop=4 * set shiftwidth=4 * set expandtab * */ #ifndef __TINY_MALLOC_H__ #define __TINY_MALLOC_H__ #if defined(__ANDROID__) #include "linux/tiny_malloc.h" #elif defined(ESP32) #include "esp32/tiny_malloc.h" #elif defined(ESP8266) #include "esp8266/tiny_malloc.h" #elif defined(__OPENWRT_MT7688__) #include "openwrt_mt7688/tiny_malloc.h" #elif defined(__LINUX__) #include "linux/tiny_malloc.h" #elif defined(__WIN32__) #include "windows/tiny_malloc.h" #elif defined(__MACOS__) #include "macos/tiny_malloc.h" #else error "tiny_malloc not implemented!!!" #endif #endif /* __TINY_MALLOC_H__ */
// Demonstrate using qpilotsync for carrier recovery. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include <getopt.h> #include <assert.h> #include "liquid.h" void usage() { printf("%s [options]\n", __FILE__); printf(" h : print usage\n"); printf(" n : payload length [symbols], default: 400\n"); printf(" p : pilot spacing [symbols], default: 20\n"); printf(" s : SNR [dB], default: 20\n"); printf(" m : modulation scheme, default: qam16\n"); liquid_print_modulation_schemes(); } int main(int argc, char *argv[]) { //srand( time(NULL) ); // options int ms = LIQUID_MODEM_QAM16; // mod. scheme unsigned int payload_len = 400; // payload length unsigned int pilot_spacing = 20; // pilot spacing float SNRdB = 20.0f; // signal-to-noise ratio [dB] const char filename[] = "qpilotsync_example.m"; // output filename float dphi = -0.0075f; // carrier frequency offset float phi = 2.1800f; // carrier phase offset float gain = 0.5f; // channel gain // get options int dopt; while((dopt = getopt(argc,argv,"hn:p:s:m:")) != EOF){ switch (dopt) { case 'h': usage(); return 0; case 'n': payload_len = atoi(optarg); break; case 'p': pilot_spacing = atoi(optarg); break; case 's': SNRdB = atof(optarg); break; case 'm': ms = liquid_getopt_str2mod(optarg); break; default: exit(-1); } } unsigned int i; // derived values float nstd = powf(10.0f, -SNRdB/20.0f); // create pilot generator and synchronizer objects qpilotgen pg = qpilotgen_create( payload_len, pilot_spacing); qpilotsync ps = qpilotsync_create(payload_len, pilot_spacing); qpilotgen_print(pg); // get frame length unsigned int frame_len = qpilotgen_get_frame_len(pg); // allocate arrays unsigned char payload_sym_tx[payload_len]; // transmitted payload symbols float complex payload_tx [payload_len]; // transmitted payload samples float complex frame_tx [frame_len]; // transmitted frame samples float complex frame_rx [frame_len]; // received frame samples float complex payload_rx [payload_len]; // received payload samples unsigned char payload_sym_rx[payload_len]; // received payload symbols // create modem objects for payload modemcf mod = modemcf_create(ms); modemcf dem = modemcf_create(ms); // assemble payload symbols for (i=0; i<payload_len; i++) { // generate random symbol payload_sym_tx[i] = modemcf_gen_rand_sym(mod); // modulate modemcf_modulate(mod, payload_sym_tx[i], &payload_tx[i]); } // assemble frame qpilotgen_execute(pg, payload_tx, frame_tx); // add channel impairments for (i=0; i<frame_len; i++) { frame_rx[i] = frame_tx[i] * cexpf(_Complex_I*dphi*i + _Complex_I*phi); frame_rx[i] += nstd*(randnf() + _Complex_I*randnf())*M_SQRT1_2; frame_rx[i] *= gain; } // recieve frame qpilotsync_execute(ps, frame_rx, payload_rx); // demodulate for (i=0; i<payload_len; i++) { unsigned int sym_demod; modemcf_demodulate(dem, payload_rx[i], &sym_demod); payload_sym_rx[i] = (unsigned char)sym_demod; } // count errors unsigned int bit_errors = 0; for (i=0; i<payload_len; i++) bit_errors += count_bit_errors(payload_sym_rx[i], payload_sym_tx[i]); printf("received bit errors : %u / %u\n", bit_errors, payload_len * modemcf_get_bps(mod)); // destroy allocated objects qpilotgen_destroy(pg); qpilotsync_destroy(ps); modemcf_destroy(mod); modemcf_destroy(dem); // write symbols to output file for plotting FILE * fid = fopen(filename,"w"); if (!fid) { fprintf(stderr,"error: could not open '%s' for writing\n", filename); return -1; } fprintf(fid,"%% %s : auto-generated file\n", filename); fprintf(fid,"clear all;\n"); fprintf(fid,"close all;\n"); fprintf(fid,"payload_len = %u;\n", payload_len); fprintf(fid,"frame_len = %u;\n", frame_len); fprintf(fid,"frame_tx = zeros(1,frame_len);\n"); fprintf(fid,"payload_rx = zeros(1,payload_len);\n"); for (i=0; i<frame_len; i++) fprintf(fid,"frame_rx(%6u) = %12.4e + 1i*%12.4e;\n", i+1, crealf(frame_rx[i]), cimagf(frame_rx[i])); for (i=0; i<payload_len; i++) fprintf(fid,"payload_rx(%6u) = %12.4e + 1i*%12.4e;\n", i+1, crealf(payload_rx[i]), cimagf(payload_rx[i])); fprintf(fid,"figure('Color','white','position',[100 100 950 400]);\n"); fprintf(fid,"subplot(1,2,1);\n"); fprintf(fid," plot(real(frame_rx), imag(frame_rx), 'x','MarkerSize',3);\n"); fprintf(fid," axis([-1 1 -1 1]*1.5);\n"); fprintf(fid," axis square;\n"); fprintf(fid," grid on;\n"); fprintf(fid," xlabel('real');\n"); fprintf(fid," ylabel('imag');\n"); fprintf(fid," title('received');\n"); fprintf(fid,"subplot(1,2,2);\n"); fprintf(fid," plot(real(payload_rx),imag(payload_rx),'x','MarkerSize',3);\n"); fprintf(fid," axis([-1 1 -1 1]*1.5);\n"); fprintf(fid," axis square;\n"); fprintf(fid," grid on;\n"); fprintf(fid," xlabel('real');\n"); fprintf(fid," ylabel('imag');\n"); fprintf(fid," title('recovered');\n"); fclose(fid); printf("results written to '%s'\n", filename); printf("done.\n"); return 0; }
/*! \file update.h \brief Update definition \author Ivan Shynkarenka \date 09.08.2017 \copyright MIT License */ #ifndef CPPTRADER_MATCHING_UPDATE_H #define CPPTRADER_MATCHING_UPDATE_H #include "utility/iostream.h" #include <cstdint> namespace CppTrader { namespace Matching { //! Update type enum class UpdateType : uint8_t { NONE, ADD, UPDATE, DELETE }; template <class TOutputStream> TOutputStream& operator<<(TOutputStream& stream, UpdateType type); } // namespace Matching } // namespace CppTrader #include "update.inl" #endif // CPPTRADER_MATCHING_UPDATE_H
/* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IOCFPLUGIN_H_ #define _IOKIT_IOCFPLUGIN_H_ /* IOCFPlugIn.h */ #include <sys/cdefs.h> __BEGIN_DECLS #include <CoreFoundation/CFPlugIn.h> #if COREFOUNDATION_CFPLUGINCOM_SEPARATE #include <CoreFoundation/CFPlugInCOM.h> #endif #include <IOKit/IOKitLib.h> /* C244E858-109C-11D4-91D4-0050E4C6426F */ #define kIOCFPlugInInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \ 0xC2, 0x44, 0xE8, 0x58, 0x10, 0x9C, 0x11, 0xD4, \ 0x91, 0xD4, 0x00, 0x50, 0xE4, 0xC6, 0x42, 0x6F) #define IOCFPLUGINBASE \ UInt16 version; \ UInt16 revision; \ IOReturn (*Probe)(void *thisPointer, CFDictionaryRef propertyTable, \ io_service_t service, SInt32 * order); \ IOReturn (*Start)(void *thisPointer, CFDictionaryRef propertyTable, \ io_service_t service); \ IOReturn (*Stop)(void *thisPointer) typedef struct IOCFPlugInInterfaceStruct { IUNKNOWN_C_GUTS; IOCFPLUGINBASE; } IOCFPlugInInterface; kern_return_t IOCreatePlugInInterfaceForService(io_service_t service, CFUUIDRef pluginType, CFUUIDRef interfaceType, IOCFPlugInInterface *** theInterface, SInt32 * theScore); kern_return_t IODestroyPlugInInterface(IOCFPlugInInterface ** interface); __END_DECLS #endif /* !_IOKIT_IOCFPLUGIN_H_ */
#include <stdlib.h> #include <stdio.h> #define CHUNK_SIZE 3000 int main(void) { int i; char * chunk; while (1) { chunk = malloc(CHUNK_SIZE * sizeof(*chunk)); if (chunk == NULL) { return 1; } for (i = 0; i < CHUNK_SIZE; i++) { chunk[i] = i; } } return 0; }
/* Copyright (c) Ludo Visser * * This file is part of the mbed-lib project, and is distributed under the * terms of the MIT License. The full license agreement text can be found * in the LICENSE file. */ #include "mbed.h" /* LED initialization function */ void initLED(void) { PINSEL_CFG_Type pinConfig; /* Check for initialization. */ if (mbedStatus & MBED_LED_INIT) { return; } /* Configure pins */ pinConfig.OpenDrain = PINSEL_PINMODE_NORMAL; pinConfig.Pinmode = PINSEL_PINMODE_PULLUP; pinConfig.Funcnum = PINSEL_FUNC_0; pinConfig.Portnum = PINSEL_PORT_1; pinConfig.Pinnum = 18; // LED 0 PINSEL_ConfigPin(&pinConfig); pinConfig.Pinnum = 20; // LED 1 PINSEL_ConfigPin(&pinConfig); pinConfig.Pinnum = 21; // LED 2 PINSEL_ConfigPin(&pinConfig); pinConfig.Pinnum = 23; // LED 3 PINSEL_ConfigPin(&pinConfig); /* Enable bits corresponding to LEDs as outputs. */ GPIO_SetDir(1, MBED_LED0 | MBED_LED1 | MBED_LED2 | MBED_LED3, 1); /* Turn off all MBED_MBED_LEDs. */ GPIO_ClearValue(1, MBED_LED0 | MBED_LED1 | MBED_LED2 | MBED_LED3); /* Update status flags. */ mbedStatus |= MBED_LED_INIT; } /* Turn LED on */ void LEDOn(uint32_t led) { GPIO_SetValue(1, led); } /* Turn LED off */ void LEDOff(uint32_t led) { GPIO_ClearValue(1, led); } /* Toggle LED */ void LEDToggle(uint32_t led) { uint32_t ledStatus; ledStatus = GPIO_ReadValue(1); if (ledStatus & led) { GPIO_ClearValue(1, led); } else { GPIO_SetValue(1, led); } }
// // 2019-10-26, jjuiddong // visual programming editor // - ui definition // // 2021-07-27 // - rename vprog -> vpl // #pragma once #include "pin.h" #include "node.h" #include "link.h" #include "nodefile.h" #include "editmanager.h" namespace vpl { ImColor GetIconColor(ePinType::Enum type); void DrawPinIcon(const sPin& pin, bool connected, int alpha); bool CanCreateLink(sPin* a, sPin* b); }
/* //%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// */ #ifndef _Executor_Random_h #define _Executor_Random_h #include <stdlib.h> #include "Defines.h" EXECUTOR_LINKAGE void FillRandomBytes(unsigned char* data, size_t size); EXECUTOR_LINKAGE void RandBytesToHexASCII(const unsigned char* data, size_t size, char* ascii); #endif /* _Executor_Random_h */
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "vm.h" ProcessorState * ProcessorState_new() { // State box for this processor ProcessorState *new_procstate = (ProcessorState *) malloc(sizeof(ProcessorState)); // Setup the processor Processor *new_proc = (Processor *) malloc(sizeof(Processor)); memset(new_proc, 0, sizeof(Processor)); new_proc->ra = malloc(LONG_SIZE); new_proc->rb = malloc(LONG_SIZE); new_proc->rr = malloc(LONG_SIZE); new_procstate->processor = new_proc; return new_procstate; } // Iteration functions byte next_byte(const Program *program, Processor *proc) { return program->data[proc->pc++]; } int machine_start(const byte *code, const size_t program_size) { const Program program = { code, program_size }; ProcessorState *cpu_state = ProcessorState_new(); Processor *tcpu = cpu_state->processor; int retval = 0; // Timing struct timespec last_checkin, now; int perf_counter = 0; clock_gettime(CLOCK_REALTIME, &last_checkin); while (tcpu->pc < program_size) { const byte next_op = next_byte(&program, tcpu); #ifdef PC_TRACE printf("PC[%d] -> OPCODE %d\n", cpu_state->processor->pc - 1, next_op); #endif switch (next_op) { case OPCODE_START: break; case OPCODE_STOP: goto EXIT; case OPCODE_LOAD_BYTE: register_load_long(program, tcpu, byte); break; case OPCODE_LOAD_SHORT: register_load_long(program, tcpu, short); break; case OPCODE_LOAD_INT: register_load_long(program, tcpu, int); break; case OPCODE_LOAD_LONG: register_load_long(program, tcpu, long); break; case OPCODE_LOAD_DOUBLE: register_load_double(program, tcpu, double); break; case OPCODE_JUMP: memcpy(&tcpu->pc, &program.data[tcpu->pc], REGISTER_SIZE); break; case OPCODE_JUMP_IF_ZERO: if (coerce(tcpu->rr, long) == 0) { memcpy(&tcpu->pc, &program.data[tcpu->pc], REGISTER_SIZE); } else { pc_advance(tcpu, INT_SIZE); } break; case OPCODE_ADD: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, long) += coerce(tcpu->rb, long); break; case OPCODE_SUBTRACT: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, long) -= coerce(tcpu->rb, long); break; case OPCODE_PRODUCT: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, long) *= coerce(tcpu->rb, long); break; case OPCODE_QUOTIENT: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, long) /= coerce(tcpu->rb, long); break; case OPCODE_DOUBLE_ADD: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, double) += coerce(tcpu->rb, double); break; case OPCODE_DOUBLE_SUBTRACT: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, double) -= coerce(tcpu->rb, double); break; case OPCODE_DOUBLE_PRODUCT: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, double) *= coerce(tcpu->rb, double); break; case OPCODE_DOUBLE_QUOTIENT: memcpy(tcpu->rr, tcpu->ra, REGISTER_SIZE); coerce(tcpu->rr, double) /= coerce(tcpu->rb, double); break; } #ifdef PC_TRACE printf("PC[%d]\n", cpu_state->processor->pc); #endif // Timing if (++perf_counter == PERF_ITERATIONS) { perf_counter = 0; clock_gettime(CLOCK_REALTIME, &now); long difference_in_seconds = now.tv_sec - last_checkin.tv_sec; long difference_in_nanos = now.tv_nsec - last_checkin.tv_nsec; if (difference_in_nanos < 0) { difference_in_seconds--; difference_in_nanos += SEC_IN_NANOS; } printf("Average VM loop runtime %f\n", ((double) difference_in_nanos / (double) PERF_ITERATIONS)); // Copy into the last checkin last_checkin = now; } } EXIT: return retval; }
#ifdef DEBUG #if(DEBUG) #define DBGPRINTF(...) fprintf(stderr,__VA_ARGS__); #else #define DBGPRINTF(...) 0 #endif #endif
// // This source file is part of appleseed. // Visit http://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2016 Francois Beaune, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef APPLESEED_FOUNDATION_UTILITY_COMMANDLINEPARSER_FLAGOPTIONHANDLER_H #define APPLESEED_FOUNDATION_UTILITY_COMMANDLINEPARSER_FLAGOPTIONHANDLER_H // appleseed.foundation headers. #include "foundation/platform/compiler.h" #include "foundation/utility/commandlineparser/messagelist.h" #include "foundation/utility/commandlineparser/optionhandler.h" #include "foundation/utility/commandlineparser/parseresults.h" #include "foundation/utility/log.h" // Standard headers. #include <cassert> #include <cstddef> #include <string> namespace foundation { // // Flag option handler. // class FlagOptionHandler : public OptionHandler { private: // Return the maximum number of values this option can handle. virtual size_t get_max_value_count() const APPLESEED_OVERRIDE; // Parse a vector of values. virtual void parse( const std::string& name, const StringVector& values, ParseResults& results) APPLESEED_OVERRIDE; // Print this option to a string. virtual void print(std::string& s) const APPLESEED_OVERRIDE; }; // // FlagOptionHandler class implementation. // inline size_t FlagOptionHandler::get_max_value_count() const { return 0; } inline void FlagOptionHandler::parse( const std::string& name, const StringVector& values, ParseResults& results) { assert(values.empty()); if ((m_flags & OptionHandler::Repeatable) == 0 && m_occurrence_count == 1) { // Error: option already specified. results.m_messages.add( LogMessage::Error, "flag '%s' already specified, ignoring all extra occurrences.", name.c_str()); ++results.m_errors; ++m_occurrence_count; return; } // The option was successfully parsed. ++m_occurrence_count; } inline void FlagOptionHandler::print(std::string& s) const { // Print the first name of the option. s += m_names.front(); } } // namespace foundation #endif // !APPLESEED_FOUNDATION_UTILITY_COMMANDLINEPARSER_FLAGOPTIONHANDLER_H
// // SBAppDelegate.h // SBLibrary // // Created by NguyenTran on 08/24/2017. // Copyright (c) 2017 NguyenTran. All rights reserved. // @import UIKit; @interface SBAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12). // // Copyright (C) 1997-2019 Steve Nygard. // #import <IDEKit/IDENavigableItemDomainProvider.h> @interface IDENavigableItemSourceControlDomainProvider : IDENavigableItemDomainProvider { } + (id)domainObjectForWorkspace:(id)arg1; @end
// Operational amplifier extern struct { // OPAMP1 control register struct { unsigned int OPAMP1_EN: 1; // OPAMP1 enable unsigned int FORCE_VP: 1; // FORCE_VP unsigned int VP_SEL: 2; // OPAMP1 Non inverting input selection unsigned int : 1; // Reserved unsigned int VM_SEL: 2; // OPAMP1 inverting input selection unsigned int TCM_EN: 1; // Timer controlled Mux mode enable unsigned int VMS_SEL: 1; // OPAMP1 inverting input secondary selection unsigned int VPS_SEL: 2; // OPAMP1 Non inverting input secondary selection unsigned int CALON: 1; // Calibration mode enable unsigned int CALSEL: 2; // Calibration selection unsigned int PGA_GAIN: 4; // Gain in PGA mode unsigned int USER_TRIM: 1; // User trimming enable unsigned int TRIMOFFSETP: 5; // Offset trimming value (PMOS) unsigned int TRIMOFFSETN: 5; // Offset trimming value (NMOS) unsigned int TSTREF: 1; // TSTREF unsigned int OUTCAL: 1; // OPAMP 1 ouput status flag unsigned int LOCK: 1; // OPAMP 1 lock } OPAMP1_CR; // OPAMP2 control register struct { unsigned int OPAMP2EN: 1; // OPAMP2 enable unsigned int FORCE_VP: 1; // FORCE_VP unsigned int VP_SEL: 2; // OPAMP2 Non inverting input selection unsigned int : 1; // Reserved unsigned int VM_SEL: 2; // OPAMP2 inverting input selection unsigned int TCM_EN: 1; // Timer controlled Mux mode enable unsigned int VMS_SEL: 1; // OPAMP2 inverting input secondary selection unsigned int VPS_SEL: 2; // OPAMP2 Non inverting input secondary selection unsigned int CALON: 1; // Calibration mode enable unsigned int CAL_SEL: 2; // Calibration selection unsigned int PGA_GAIN: 4; // Gain in PGA mode unsigned int USER_TRIM: 1; // User trimming enable unsigned int TRIMOFFSETP: 5; // Offset trimming value (PMOS) unsigned int TRIMOFFSETN: 5; // Offset trimming value (NMOS) unsigned int TSTREF: 1; // TSTREF unsigned int OUTCAL: 1; // OPAMP 2 ouput status flag unsigned int LOCK: 1; // OPAMP 2 lock } OPAMP2_CR; // OPAMP3 control register struct { unsigned int OPAMP3EN: 1; // OPAMP3 enable unsigned int FORCE_VP: 1; // FORCE_VP unsigned int VP_SEL: 2; // OPAMP3 Non inverting input selection unsigned int : 1; // Reserved unsigned int VM_SEL: 2; // OPAMP3 inverting input selection unsigned int TCM_EN: 1; // Timer controlled Mux mode enable unsigned int VMS_SEL: 1; // OPAMP3 inverting input secondary selection unsigned int VPS_SEL: 2; // OPAMP3 Non inverting input secondary selection unsigned int CALON: 1; // Calibration mode enable unsigned int CALSEL: 2; // Calibration selection unsigned int PGA_GAIN: 4; // Gain in PGA mode unsigned int USER_TRIM: 1; // User trimming enable unsigned int TRIMOFFSETP: 5; // Offset trimming value (PMOS) unsigned int TRIMOFFSETN: 5; // Offset trimming value (NMOS) unsigned int TSTREF: 1; // TSTREF unsigned int OUTCAL: 1; // OPAMP 3 ouput status flag unsigned int LOCK: 1; // OPAMP 3 lock } OPAMP3_CR; // OPAMP4 control register struct { unsigned int OPAMP4EN: 1; // OPAMP4 enable unsigned int FORCE_VP: 1; // FORCE_VP unsigned int VP_SEL: 2; // OPAMP4 Non inverting input selection unsigned int : 1; // Reserved unsigned int VM_SEL: 2; // OPAMP4 inverting input selection unsigned int TCM_EN: 1; // Timer controlled Mux mode enable unsigned int VMS_SEL: 1; // OPAMP4 inverting input secondary selection unsigned int VPS_SEL: 2; // OPAMP4 Non inverting input secondary selection unsigned int CALON: 1; // Calibration mode enable unsigned int CALSEL: 2; // Calibration selection unsigned int PGA_GAIN: 4; // Gain in PGA mode unsigned int USER_TRIM: 1; // User trimming enable unsigned int TRIMOFFSETP: 5; // Offset trimming value (PMOS) unsigned int TRIMOFFSETN: 5; // Offset trimming value (NMOS) unsigned int TSTREF: 1; // TSTREF unsigned int OUTCAL: 1; // OPAMP 4 ouput status flag unsigned int LOCK: 1; // OPAMP 4 lock } OPAMP4_CR; } SVD_OPAMP; asm(".equ SVD_OPAMP, 0x40010038");
// Copyright (c) 2013 Richard Long & HexBeerium // // Released under the MIT license ( http://opensource.org/licenses/MIT ) // #import <Foundation/Foundation.h> #import "CABaseException.h" #import "CAJob.h" @protocol CAJobListener <NSObject> -(void)jobCompleted:(id<CAJob>)job; -(void)jobFailed:(id<CAJob>)job withException:(CABaseException*)exception; @end
// // UIButton+SKClickInterval.h // SKExtension // // Created by CFsyk on 2017/10/23. // Copyright © 2017年 CFsyk. All rights reserved. // #import <UIKit/UIKit.h> //设置按钮的点击间隔为"kDefaultClickInterval" @interface UIButton (SKClickInterval) @end
#ifndef MARKER_OBJECT_H #define MARKER_OBJECT_H class StateGraphicsObject; class MarkerObject { public: MarkerObject(int id, int color, StateGraphicsObject* parent = nullptr); public: void connectToState(StateGraphicsObject* state); void disconnectFromState(); int getId(); int getColor(); private: int m_id; int m_color; StateGraphicsObject* m_parentState; }; #endif // MARKER_OBJECT_H
#ifndef _LIBP_VPX_H_ #define _LIBP_VPX_H_ #ifdef __cplusplus extern "C" { #endif void* vpx_init(const char* filename); const unsigned char* vpx_read(void *input, unsigned int *length); void vpx_destroy(void *input); #ifdef __cplusplus } #endif #endif
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "WXPBGeneratedMessage.h" @interface IMBehaviorMsgOP : WXPBGeneratedMessage { } + (void)initialize; // Remaining properties @property(nonatomic) int appMsgInnerType; // @dynamic appMsgInnerType; @property(nonatomic) int count; // @dynamic count; @property(nonatomic) int msgOpType; // @dynamic msgOpType; @property(nonatomic) int msgType; // @dynamic msgType; @end
#ifndef LIC_NUMBER_TYPE #define LIC_NUMBER_TYPE #include "RuntimeType.h" namespace lic { // TODO: Make generic and inherit actual types class NumberType : public RuntimeType { public: virtual std::string Name() const; virtual std::string ToString(gsl::byte* data) const; virtual void PerformUnaryOp(Opcode op, gsl::byte* data) const; virtual void PerformBinaryOp(Opcode op, gsl::byte* leftData, RuntimeType* rightType, gsl::byte* rightData) const; static void StoreConstant(int32_t val, gsl::byte* data); static NumberType& Instance(); private: NumberType(); }; } #endif // !LIC_NUMBER_TYPE
#include <stdio.h> #include <math.h> #define MAX_POS 9 int main(){ unsigned long int x, y; int dx, dy, pos, carry, ncrry; while (scanf("%lu %lu", &x, &y) && !(x == 0 && y == 0)){ carry = ncrry = 0; for (pos = 0; pos < MAX_POS; pos++){ dx = x % 10; dy = y % 10; x /= 10; y /= 10; if (dx + dy + carry >= 10){ carry = 1; ncrry++; } else carry = 0; } if (ncrry == 0) printf("No carry operation.\n"); else printf("%d carry operation%s.\n", ncrry, ncrry == 1 ? "" : "s"); } return 0; }
// // The MIT License (MIT) // // // Copyright (c) 2014 Broad Institute // // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // // Created by turner on 2/27/13. // // To change the template use AppCode | Preferences | File Templates. // #import <Foundation/Foundation.h> @class IGVAppDelegate; @class RootContentController; @interface UIApplication (IGVApplication) + (IGVAppDelegate *)sharedIGVAppDelegate; + (UINavigationController *)sharedRootNavigationController; + (RootContentController *)sharedRootContentController; @end