text
stringlengths
4
6.14k
/* * arch/arm/mm/highmem.c -- ARM highmem support * * Author: Nicolas Pitre * Created: september 8, 2008 * Copyright: Marvell Semiconductors Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/cpu.h> #include <linux/module.h> #include <linux/highmem.h> #include <linux/interrupt.h> #include <asm/fixmap.h> #include <asm/cacheflush.h> #include <asm/tlbflush.h> #include "mm.h" void *kmap(struct page *page) { might_sleep(); if (!PageHighMem(page)) return page_address(page); return kmap_high(page); } EXPORT_SYMBOL(kmap); void kunmap(struct page *page) { BUG_ON(in_interrupt()); if (!PageHighMem(page)) return; kunmap_high(page); } EXPORT_SYMBOL(kunmap); void *kmap_atomic(struct page *page) { unsigned int idx; unsigned long vaddr; void *kmap; int type; pagefault_disable(); if (!PageHighMem(page)) return page_address(page); #ifdef CONFIG_DEBUG_HIGHMEM /* * There is no cache coherency issue when non VIVT, so force the * dedicated kmap usage for better debugging purposes in that case. */ if (!cache_is_vivt()) kmap = NULL; else #endif kmap = kmap_high_get(page); if (kmap) return kmap; type = kmap_atomic_idx_push(); idx = type + KM_TYPE_NR * smp_processor_id(); vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); #ifdef CONFIG_DEBUG_HIGHMEM /* * With debugging enabled, kunmap_atomic forces that entry to 0. * Make sure it was indeed properly unmapped. */ BUG_ON(!pte_none(get_top_pte(vaddr))); #endif /* * When debugging is off, kunmap_atomic leaves the previous mapping * in place, so the contained TLB flush ensures the TLB is updated * with the new mapping. */ set_top_pte(vaddr, mk_pte(page, kmap_prot)); return (void *)vaddr; } EXPORT_SYMBOL(kmap_atomic); void __kunmap_atomic(void *kvaddr) { unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; int idx, type; if (kvaddr >= (void *)FIXADDR_START) { type = kmap_atomic_idx(); idx = type + KM_TYPE_NR * smp_processor_id(); if (cache_is_vivt()) __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); #ifdef CONFIG_DEBUG_HIGHMEM BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); set_top_pte(vaddr, __pte(0)); #else (void) idx; /* to kill a warning */ #endif kmap_atomic_idx_pop(); } else if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) { /* this address was obtained through kmap_high_get() */ kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)])); } pagefault_enable(); } EXPORT_SYMBOL(__kunmap_atomic); void *kmap_atomic_pfn(unsigned long pfn) { unsigned long vaddr; int idx, type; pagefault_disable(); type = kmap_atomic_idx_push(); idx = type + KM_TYPE_NR * smp_processor_id(); vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); #ifdef CONFIG_DEBUG_HIGHMEM BUG_ON(!pte_none(get_top_pte(vaddr))); #endif set_top_pte(vaddr, pfn_pte(pfn, kmap_prot)); return (void *)vaddr; } struct page *kmap_atomic_to_page(const void *ptr) { unsigned long vaddr = (unsigned long)ptr; if (vaddr < FIXADDR_START) return virt_to_page(ptr); return pte_page(get_top_pte(vaddr)); } #ifdef CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH static void kmap_remove_unused_cpu(int cpu) { int start_idx, idx, type; pagefault_disable(); type = kmap_atomic_idx(); start_idx = type + 1 + KM_TYPE_NR * cpu; for (idx = start_idx; idx < KM_TYPE_NR + KM_TYPE_NR * cpu; idx++) { unsigned long vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); pte_t ptep; ptep = get_top_pte(vaddr); if (ptep) set_top_pte(vaddr, __pte(0)); } pagefault_enable(); } static void kmap_remove_unused(void *unused) { kmap_remove_unused_cpu(smp_processor_id()); } void kmap_atomic_flush_unused(void) { on_each_cpu(kmap_remove_unused, NULL, 1); } static int hotplug_kmap_atomic_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { switch (action & (~CPU_TASKS_FROZEN)) { case CPU_DYING: kmap_remove_unused_cpu((int)hcpu); break; default: break; } return NOTIFY_OK; } static struct notifier_block hotplug_kmap_atomic_notifier = { .notifier_call = hotplug_kmap_atomic_callback, }; static int __init init_kmap_atomic(void) { return register_hotcpu_notifier(&hotplug_kmap_atomic_notifier); } early_initcall(init_kmap_atomic); #endif #ifdef CONFIG_TIMA_RKP static int __init tima_init_kmap_atomic(void) { tima_send_cmd(__fix_to_virt(FIX_KMAP_BEGIN), 0x10); return 1; } early_initcall(tima_init_kmap_atomic); #endif
/* PR tree-optimization/61725 */ int main () { int x; for (x = -128; x <= 128; x++) { int a = __builtin_ffs (x); if (x == 0 && a != 0) __builtin_abort (); } return 0; }
/* * Belkin F5D825 V1 board support * * Copyright (C) 2011 Cezary Jackiewicz <cezary.jackiewicz@gmail.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include <linux/init.h> #include <linux/platform_device.h> #include <asm/mach-ralink/machine.h> #include <asm/mach-ralink/dev-gpio-buttons.h> #include <asm/mach-ralink/dev-gpio-leds.h> #include <asm/mach-ralink/rt288x.h> #include <asm/mach-ralink/rt288x_regs.h> #include "devices.h" #include <linux/rtl8366.h> #include <linux/ethtool.h> #include <asm/mach-ralink/ramips_eth_platform.h> #define F5D8235_GPIO_RTL8366_SCK 2 #define F5D8235_GPIO_RTL8366_SDA 1 #define F5D8235_GPIO_LED_USB_BLUE 7 #define F5D8235_GPIO_LED_USB_ORANGE 8 #define F5D8235_GPIO_BUTTON_WPS 0 #define F5D8235_GPIO_BUTTON_RESET 9 #define F5D8235_KEYS_POLL_INTERVAL 20 #define F5D8235_KEYS_DEBOUNCE_INTERVAL (3 * F5D8235_KEYS_POLL_INTERVAL) static struct rtl8366_platform_data f5d8235_rtl8366s_data = { .gpio_sda = F5D8235_GPIO_RTL8366_SDA, .gpio_sck = F5D8235_GPIO_RTL8366_SCK, }; static struct platform_device f5d8235_rtl8366s_device = { .name = RTL8366S_DRIVER_NAME, .id = -1, .dev = { .platform_data = &f5d8235_rtl8366s_data, } }; static struct gpio_led f5d8235_leds_gpio[] __initdata = { { .name = "f5d8235-v1:blue:storage", .gpio = F5D8235_GPIO_LED_USB_BLUE, .active_low = 1, },{ .name = "f5d8235-v1:orange:storage", .gpio = F5D8235_GPIO_LED_USB_ORANGE, .active_low = 1, } }; static struct gpio_keys_button f5d8235_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, .debounce_interval = F5D8235_KEYS_DEBOUNCE_INTERVAL, .gpio = F5D8235_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, .debounce_interval = F5D8235_KEYS_DEBOUNCE_INTERVAL, .gpio = F5D8235_GPIO_BUTTON_WPS, .active_low = 1, } }; static void __init f5d8235_init(void) { rt288x_gpio_init(RT2880_GPIO_MODE_UART0 | RT2880_GPIO_MODE_I2C); rt288x_register_flash(0); rt288x_register_wifi(); rt288x_register_wdt(); ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235_leds_gpio), f5d8235_leds_gpio); ramips_register_gpio_buttons(-1, F5D8235_KEYS_POLL_INTERVAL, ARRAY_SIZE(f5d8235_gpio_buttons), f5d8235_gpio_buttons); platform_device_register(&f5d8235_rtl8366s_device); rt288x_eth_data.speed = SPEED_1000; rt288x_eth_data.duplex = DUPLEX_FULL; rt288x_eth_data.tx_fc = 1; rt288x_eth_data.rx_fc = 1; rt288x_register_ethernet(); } MIPS_MACHINE(RAMIPS_MACH_F5D8235_V1, "F5D8235_V1", "Belkin F5D8235 v1", f5d8235_init);
/* e_atalla_err.c */ /* ==================================================================== * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED 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 OpenSSL PROJECT OR * ITS 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. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* * NOTE: this file was auto generated by the mkerr.pl script: any changes * made to it will be overwritten when the script next updates this file, * only reason strings will be preserved. */ #include <stdio.h> #include <openssl/err.h> #include "e_atalla_err.h" /* BEGIN ERROR CODES */ #ifndef OPENSSL_NO_ERR # define ERR_FUNC(func) ERR_PACK(0,func,0) # define ERR_REASON(reason) ERR_PACK(0,0,reason) static ERR_STRING_DATA ATALLA_str_functs[] = { {ERR_FUNC(ATALLA_F_ATALLA_CTRL), "ATALLA_CTRL"}, {ERR_FUNC(ATALLA_F_ATALLA_FINISH), "ATALLA_FINISH"}, {ERR_FUNC(ATALLA_F_ATALLA_INIT), "ATALLA_INIT"}, {ERR_FUNC(ATALLA_F_ATALLA_MOD_EXP), "ATALLA_MOD_EXP"}, {ERR_FUNC(ATALLA_F_ATALLA_RSA_MOD_EXP), "ATALLA_RSA_MOD_EXP"}, {0, NULL} }; static ERR_STRING_DATA ATALLA_str_reasons[] = { {ERR_REASON(ATALLA_R_ALREADY_LOADED), "already loaded"}, {ERR_REASON(ATALLA_R_BN_CTX_FULL), "bn ctx full"}, {ERR_REASON(ATALLA_R_BN_EXPAND_FAIL), "bn expand fail"}, {ERR_REASON(ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED), "ctrl command not implemented"}, {ERR_REASON(ATALLA_R_MISSING_KEY_COMPONENTS), "missing key components"}, {ERR_REASON(ATALLA_R_NOT_LOADED), "not loaded"}, {ERR_REASON(ATALLA_R_REQUEST_FAILED), "request failed"}, {ERR_REASON(ATALLA_R_UNIT_FAILURE), "unit failure"}, {0, NULL} }; #endif #ifdef ATALLA_LIB_NAME static ERR_STRING_DATA ATALLA_lib_name[] = { {0, ATALLA_LIB_NAME}, {0, NULL} }; #endif static int ATALLA_lib_error_code = 0; static int ATALLA_error_init = 1; static void ERR_load_ATALLA_strings(void) { if (ATALLA_lib_error_code == 0) ATALLA_lib_error_code = ERR_get_next_error_library(); if (ATALLA_error_init) { ATALLA_error_init = 0; #ifndef OPENSSL_NO_ERR ERR_load_strings(ATALLA_lib_error_code, ATALLA_str_functs); ERR_load_strings(ATALLA_lib_error_code, ATALLA_str_reasons); #endif #ifdef ATALLA_LIB_NAME ATALLA_lib_name->error = ERR_PACK(ATALLA_lib_error_code, 0, 0); ERR_load_strings(0, ATALLA_lib_name); #endif } } static void ERR_unload_ATALLA_strings(void) { if (ATALLA_error_init == 0) { #ifndef OPENSSL_NO_ERR ERR_unload_strings(ATALLA_lib_error_code, ATALLA_str_functs); ERR_unload_strings(ATALLA_lib_error_code, ATALLA_str_reasons); #endif #ifdef ATALLA_LIB_NAME ERR_unload_strings(0, ATALLA_lib_name); #endif ATALLA_error_init = 1; } } static void ERR_ATALLA_error(int function, int reason, char *file, int line) { if (ATALLA_lib_error_code == 0) ATALLA_lib_error_code = ERR_get_next_error_library(); ERR_PUT_error(ATALLA_lib_error_code, function, reason, file, line); }
/* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * 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 <config.h> #include <common.h> #include <command.h> #include <asm/io.h> #include <linux/mtd/doc2000.h> #include <watchdog.h> #include <pci.h> #include <netdev.h> #include "hardware.h" #include "pcippc2.h" #include "sconsole.h" #include "fpga_serial.h" DECLARE_GLOBAL_DATA_PTR; #if defined(CONFIG_WATCHDOG) static int pcippc2_wdt_init_done = 0; void pcippc2_wdt_init (void); #endif /* Check board identity */ int checkboard (void) { #ifdef CONFIG_PCIPPC2 puts ("Board: Gespac PCIPPC-2\n"); #else puts ("Board: Gespac PCIPPC-6\n"); #endif return 0; } /* RAM size is stored in CPC0_RGBAN1 */ u32 pcippc2_sdram_size (void) { return in32 (REG (CPC0, RGBAN1)); } phys_size_t initdram (int board_type) { return cpc710_ram_init (); } int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { out32 (REG (CPC0, SPOR), 0); iobarrier_rw (); while (1); /* notreached */ return (-1); } int board_early_init_f (void) { out32 (REG (CPC0, RSTR), 0xC0000000); iobarrier_rw (); out32 (REG (CPC0, RSTR), 0xF0000000); iobarrier_rw (); out32 (REG (CPC0, UCTL), 0x00F80000); out32 (REG (CPC0, SIOC0), 0x30000000); out32 (REG (CPC0, ABCNTL), 0x00000000); out32 (REG (CPC0, SESR), 0x00000000); out32 (REG (CPC0, SEAR), 0x00000000); /* Detect IBM Avignon CPC710 Revision */ if ((in32 (REG (CPC0, UCTL)) & 0x000000F0) == CPC710_TYPE_100P) out32 (REG (CPC0, PGCHP), 0xA0000040); else out32 (REG (CPC0, PGCHP), 0x80800040); out32 (REG (CPC0, ATAS), 0x709C2508); iobarrier_rw (); return 0; } void after_reloc (ulong dest_addr) { /* Jump to the main U-Boot board init code */ board_init_r ((gd_t *)gd, dest_addr); } int misc_init_r (void) { pcippc2_fpga_init (); pcippc2_cpci3264_init (); #if defined(CONFIG_WATCHDOG) pcippc2_wdt_init (); #endif fpga_serial_init (sconsole_get_baudrate ()); sconsole_putc = fpga_serial_putc; sconsole_puts = fpga_serial_puts; sconsole_getc = fpga_serial_getc; sconsole_tstc = fpga_serial_tstc; sconsole_setbrg = fpga_serial_setbrg; sconsole_flush (); return (0); } void pci_init_board (void) { cpc710_pci_init (); /* FPGA requires no retry timeouts to be enabled */ cpc710_pci_enable_timeout (); } #ifdef CONFIG_CMD_DOC void doc_init (void) { doc_probe (pcippc2_fpga1_phys + HW_FPGA1_DOC); } #endif void pcippc2_cpci3264_init (void) { pci_dev_t bdf = pci_find_device(FPGA_VENDOR_ID, FPGA_DEVICE_ID, 0); if (bdf == -1) { puts("Unable to find FPGA !\n"); hang(); } if((in32(pcippc2_fpga0_phys + HW_FPGA0_BOARD) & 0x01000000) == 0x01000000) /* 32-bits Compact PCI bus - LSB bit */ { iobarrier_rw(); out32(BRIDGE(CPCI, PCIDG), 0x40000000); /* 32-bits bridge, Pipeline */ iobarrier_rw(); } } #if defined(CONFIG_WATCHDOG) void pcippc2_wdt_init (void) { out16r (FPGA (WDT, PROG), 0xffff); out8 (FPGA (WDT, CTRL), 0x1); pcippc2_wdt_init_done = 1; } void pcippc2_wdt_done (void) { out8 (FPGA (WDT, CTRL), 0x0); pcippc2_wdt_init_done = 0; } void pcippc2_wdt_reset (void) { if (pcippc2_wdt_init_done == 1) out8 (FPGA (WDT, REFRESH), 0x56); } void watchdog_reset (void) { int re_enable = disable_interrupts (); pcippc2_wdt_reset (); if (re_enable) enable_interrupts (); } #if defined(CONFIG_CMD_BSP) int do_wd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 1: printf ("Watchdog timer status is %s\n", pcippc2_wdt_init_done == 1 ? "on" : "off"); return 0; case 2: if (!strcmp(argv[1],"on")) { pcippc2_wdt_init(); printf("Watchdog timer now is on\n"); return 0; } else if (!strcmp(argv[1],"off")) { pcippc2_wdt_done(); printf("Watchdog timer now is off\n"); return 0; } else break; default: break; } return cmd_usage(cmdtp); } U_BOOT_CMD( wd, 2, 1, do_wd, "check and set watchdog", "on - switch watchDog on\n" "wd off - switch watchdog off\n" "wd - print current status" ); #endif #endif /* CONFIG_WATCHDOG */ int board_eth_init(bd_t *bis) { return pci_eth_init(bis); }
/****************************************************************************** * * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ /*----------------------------------------------------------------------------- For type defines and data structure defines ------------------------------------------------------------------------------*/ #ifndef __DRV_TYPES_H__ #define __DRV_TYPES_H__ #define DRV_NAME "r8188eu" #include <osdep_service.h> #include <wlan_bssdef.h> #include <rtw_ht.h> #include <rtw_cmd.h> #include <rtw_xmit.h> #include <rtw_recv.h> #include <hal_intf.h> #include <hal_com.h> #include <rtw_qos.h> #include <rtw_security.h> #include <rtw_pwrctrl.h> #include <rtw_eeprom.h> #include <sta_info.h> #include <rtw_mlme.h> #include <rtw_debug.h> #include <rtw_rf.h> #include <rtw_event.h> #include <rtw_led.h> #include <rtw_mlme_ext.h> #include <rtw_ap.h> #define SPEC_DEV_ID_NONE BIT(0) #define SPEC_DEV_ID_DISABLE_HT BIT(1) #define SPEC_DEV_ID_ENABLE_PS BIT(2) #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3) #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4) #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5) struct registry_priv { u8 chip_version; u8 rfintfs; u8 lbkmode; u8 hci; struct ndis_802_11_ssid ssid; u8 network_mode; /* infra, ad-hoc, auto */ u8 channel;/* ad-hoc support requirement */ u8 wireless_mode;/* A, B, G, auto */ u8 scan_mode;/* active, passive */ u8 radio_enable; u8 preamble;/* long, short, auto */ u8 vrtl_carrier_sense;/* Enable, Disable, Auto */ u8 vcs_type;/* RTS/CTS, CTS-to-self */ u16 rts_thresh; u16 frag_thresh; u8 adhoc_tx_pwr; u8 soft_ap; u8 power_mgnt; u8 ips_mode; u8 smart_ps; u8 long_retry_lmt; u8 short_retry_lmt; u16 busy_thresh; u8 ack_policy; u8 mp_mode; u8 software_encrypt; u8 software_decrypt; u8 acm_method; /* UAPSD */ u8 wmm_enable; u8 uapsd_enable; u8 uapsd_max_sp; u8 uapsd_acbk_en; u8 uapsd_acbe_en; u8 uapsd_acvi_en; u8 uapsd_acvo_en; struct wlan_bssid_ex dev_network; u8 ht_enable; u8 cbw40_enable; u8 ampdu_enable;/* for tx */ u8 rx_stbc; u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */ u8 lowrate_two_xmit; u8 rf_config; u8 low_power; u8 wifi_spec;/* !turbo_mode */ u8 channel_plan; bool bAcceptAddbaReq; u8 antdiv_cfg; u8 antdiv_type; u8 usbss_enable;/* 0:disable,1:enable */ u8 hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */ u8 hwpwrp_detect;/* 0:disable,1:enable */ u8 hw_wps_pbc;/* 0:disable,1:enable */ u8 max_roaming_times; /* the max number driver will try */ u8 fw_iol; /* enable iol without other concern */ u8 enable80211d; u8 ifname[16]; u8 if2name[16]; u8 notch_filter; }; /* For registry parameters */ #define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field)) #define RGTRY_SZ(field) sizeof(((struct registry_priv *)0)->field) #define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field)) #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *)0)->field) #define MAX_CONTINUAL_URB_ERR 4 struct dvobj_priv { struct adapter *if1; /* For 92D, DMDP have 2 interface. */ u8 InterfaceNumber; u8 NumInterfaces; /* In /Out Pipe information */ int RtInPipe[2]; int RtOutPipe[3]; u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */ /*-------- below is for USB INTERFACE --------*/ u8 nr_endpoint; u8 ishighspeed; u8 RtNumInPipes; u8 RtNumOutPipes; int ep_num[5]; /* endpoint number */ struct mutex usb_vendor_req_mutex; u8 *usb_vendor_req_buf; struct usb_interface *pusbintf; struct usb_device *pusbdev; }; static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) { /* todo: get interface type from dvobj and the return * the dev accordingly */ return &dvobj->pusbintf->dev; }; struct adapter { u16 chip_type; struct dvobj_priv *dvobj; struct mlme_priv mlmepriv; struct mlme_ext_priv mlmeextpriv; struct cmd_priv cmdpriv; struct xmit_priv xmitpriv; struct recv_priv recvpriv; struct sta_priv stapriv; struct security_priv securitypriv; struct registry_priv registrypriv; struct pwrctrl_priv pwrctrlpriv; struct eeprom_priv eeprompriv; struct led_priv ledpriv; #ifdef CONFIG_88EU_AP_MODE struct hostapd_priv *phostapdpriv; #endif struct wifidirect_info wdinfo; void *HalData; struct hal_ops HalFunc; s32 bDriverStopped; s32 bSurpriseRemoved; u8 hw_init_completed; void *cmdThread; void *evtThread; void (*intf_start)(struct adapter *adapter); void (*intf_stop)(struct adapter *adapter); struct net_device *pnetdev; /* used by rtw_rereg_nd_name related function */ struct rereg_nd_name_data { struct net_device *old_pnetdev; char old_ifname[IFNAMSIZ]; u8 old_ips_mode; u8 old_bRegUseLed; } rereg_nd_name_priv; int bup; struct net_device_stats stats; struct iw_statistics iwstats; struct proc_dir_entry *dir_dev;/* for proc directory */ int net_closed; u8 bFWReady; u8 bReadPortCancel; u8 bWritePortCancel; u8 bRxRSSIDisplay; /* The driver will show up the desired channel number * when this flag is 1. */ u8 bNotifyChannelChange; struct mutex hw_init_mutex; spinlock_t br_ext_lock; u8 fix_rate; unsigned char in_cta_test; }; #define adapter_to_dvobj(adapter) (adapter->dvobj) int rtw_handle_dualmac(struct adapter *adapter, bool init); static inline u8 *myid(struct eeprom_priv *peepriv) { return peepriv->mac_addr; } #endif /* __DRV_TYPES_H__ */
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #include <ngx_config.h> #include <ngx_core.h> #include <ngx_event.h> extern int ngx_kqueue; ssize_t ngx_aio_read(ngx_connection_t *c, u_char *buf, size_t size) { int n; ngx_event_t *rev; rev = c->read; if (!rev->ready) { ngx_log_error(NGX_LOG_ALERT, c->log, 0, "second aio post"); return NGX_AGAIN; } ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "rev->complete: %d", rev->complete); ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "aio size: %d", size); if (!rev->complete) { ngx_memzero(&rev->aiocb, sizeof(struct aiocb)); rev->aiocb.aio_fildes = c->fd; rev->aiocb.aio_buf = buf; rev->aiocb.aio_nbytes = size; #if (NGX_HAVE_KQUEUE) rev->aiocb.aio_sigevent.sigev_notify_kqueue = ngx_kqueue; rev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT; rev->aiocb.aio_sigevent.sigev_value.sigval_ptr = rev; #endif if (aio_read(&rev->aiocb) == -1) { ngx_log_error(NGX_LOG_CRIT, rev->log, ngx_errno, "aio_read() failed"); rev->error = 1; return NGX_ERROR; } ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "aio_read: #%d OK", c->fd); rev->active = 1; rev->ready = 0; } rev->complete = 0; n = aio_error(&rev->aiocb); if (n == -1) { ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, "aio_error() failed"); rev->error = 1; return NGX_ERROR; } if (n != 0) { if (n == NGX_EINPROGRESS) { if (rev->ready) { ngx_log_error(NGX_LOG_ALERT, c->log, n, "aio_read() still in progress"); rev->ready = 0; } return NGX_AGAIN; } ngx_log_error(NGX_LOG_CRIT, c->log, n, "aio_read() failed"); rev->error = 1; rev->ready = 0; return NGX_ERROR; } n = aio_return(&rev->aiocb); if (n == -1) { ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, "aio_return() failed"); rev->error = 1; rev->ready = 0; return NGX_ERROR; } ngx_log_debug2(NGX_LOG_DEBUG_EVENT, rev->log, 0, "aio_read: #%d %d", c->fd, n); if (n == 0) { rev->eof = 1; rev->ready = 0; } else { rev->ready = 1; } rev->active = 0; return n; }
/* * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. * Copyright (c) 2014- QLogic Corporation. * All rights reserved * www.qlogic.com * * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License (GPL) Version 2 as * published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef __BFA_PORT_H__ #define __BFA_PORT_H__ #include "bfa_defs_svc.h" #include "bfa_ioc.h" #include "bfa_cs.h" typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status); typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status); struct bfa_port_s { void *dev; struct bfa_ioc_s *ioc; struct bfa_trc_mod_s *trcmod; u32 msgtag; bfa_boolean_t stats_busy; struct bfa_mbox_cmd_s stats_mb; bfa_port_stats_cbfn_t stats_cbfn; void *stats_cbarg; bfa_status_t stats_status; time64_t stats_reset_time; union bfa_port_stats_u *stats; struct bfa_dma_s stats_dma; bfa_boolean_t endis_pending; struct bfa_mbox_cmd_s endis_mb; bfa_port_endis_cbfn_t endis_cbfn; void *endis_cbarg; bfa_status_t endis_status; struct bfa_ioc_notify_s ioc_notify; bfa_boolean_t pbc_disabled; bfa_boolean_t dport_enabled; struct bfa_mem_dma_s port_dma; }; #define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma)) void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, void *dev, struct bfa_trc_mod_s *trcmod); void bfa_port_notify(void *arg, enum bfa_ioc_event_e event); bfa_status_t bfa_port_get_stats(struct bfa_port_s *port, union bfa_port_stats_u *stats, bfa_port_stats_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port, bfa_port_stats_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_port_enable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_port_disable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn, void *cbarg); u32 bfa_port_meminfo(void); void bfa_port_mem_claim(struct bfa_port_s *port, u8 *dma_kva, u64 dma_pa); void bfa_port_set_dportenabled(struct bfa_port_s *port, bfa_boolean_t enabled); /* * CEE declaration */ typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status); typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status); typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status); struct bfa_cee_cbfn_s { bfa_cee_get_attr_cbfn_t get_attr_cbfn; void *get_attr_cbarg; bfa_cee_get_stats_cbfn_t get_stats_cbfn; void *get_stats_cbarg; bfa_cee_reset_stats_cbfn_t reset_stats_cbfn; void *reset_stats_cbarg; }; struct bfa_cee_s { void *dev; bfa_boolean_t get_attr_pending; bfa_boolean_t get_stats_pending; bfa_boolean_t reset_stats_pending; bfa_status_t get_attr_status; bfa_status_t get_stats_status; bfa_status_t reset_stats_status; struct bfa_cee_cbfn_s cbfn; struct bfa_ioc_notify_s ioc_notify; struct bfa_trc_mod_s *trcmod; struct bfa_cee_attr_s *attr; struct bfa_cee_stats_s *stats; struct bfa_dma_s attr_dma; struct bfa_dma_s stats_dma; struct bfa_ioc_s *ioc; struct bfa_mbox_cmd_s get_cfg_mb; struct bfa_mbox_cmd_s get_stats_mb; struct bfa_mbox_cmd_s reset_stats_mb; struct bfa_mem_dma_s cee_dma; }; #define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma)) u32 bfa_cee_meminfo(void); void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa); void bfa_cee_attach(struct bfa_cee_s *cee, struct bfa_ioc_s *ioc, void *dev); bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee, struct bfa_cee_attr_s *attr, bfa_cee_get_attr_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee, struct bfa_cee_stats_s *stats, bfa_cee_get_stats_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee, bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg); #endif /* __BFA_PORT_H__ */
/* * AppArmor security module * * This file contains AppArmor ipc mediation * * Copyright (C) 1998-2008 Novell/SUSE * Copyright 2009-2010 Canonical Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2 of the * License. */ #include <linux/gfp.h> #include <linux/ptrace.h> #include "include/audit.h" #include "include/capability.h" #include "include/context.h" #include "include/policy.h" #include "include/ipc.h" /* call back to audit ptrace fields */ static void audit_cb(struct audit_buffer *ab, void *va) { struct common_audit_data *sa = va; audit_log_format(ab, " target="); audit_log_untrustedstring(ab, sa->aad->target); } /** * aa_audit_ptrace - do auditing for ptrace * @profile: profile being enforced (NOT NULL) * @target: profile being traced (NOT NULL) * @error: error condition * * Returns: %0 or error code */ static int aa_audit_ptrace(struct aa_profile *profile, struct aa_profile *target, int error) { struct common_audit_data sa; struct apparmor_audit_data aad = {0,}; COMMON_AUDIT_DATA_INIT(&sa, NONE); sa.aad = &aad; aad.op = OP_PTRACE; aad.target = target; aad.error = error; return aa_audit(AUDIT_APPARMOR_AUTO, profile, GFP_ATOMIC, &sa, audit_cb); } /** * aa_may_ptrace - test if tracer task can trace the tracee * @tracer_task: task who will do the tracing (NOT NULL) * @tracer: profile of the task doing the tracing (NOT NULL) * @tracee: task to be traced * @mode: whether PTRACE_MODE_READ || PTRACE_MODE_ATTACH * * Returns: %0 else error code if permission denied or error */ int aa_may_ptrace(struct task_struct *tracer_task, struct aa_profile *tracer, struct aa_profile *tracee, unsigned int mode) { /* TODO: currently only based on capability, not extended ptrace * rules, * Test mode for PTRACE_MODE_READ || PTRACE_MODE_ATTACH */ if (unconfined(tracer) || tracer == tracee) return 0; /* log this capability request */ return aa_capable(tracer_task, tracer, CAP_SYS_PTRACE, 1); } /** * aa_ptrace - do ptrace permission check and auditing * @tracer: task doing the tracing (NOT NULL) * @tracee: task being traced (NOT NULL) * @mode: ptrace mode either PTRACE_MODE_READ || PTRACE_MODE_ATTACH * * Returns: %0 else error code if permission denied or error */ int aa_ptrace(struct task_struct *tracer, struct task_struct *tracee, unsigned int mode) { /* * tracer can ptrace tracee when * - tracer is unconfined || * - tracer is in complain mode * - tracer has rules allowing it to trace tracee currently this is: * - confined by the same profile || * - tracer profile has CAP_SYS_PTRACE */ struct aa_profile *tracer_p; /* cred released below */ const struct cred *cred = get_task_cred(tracer); int error = 0; tracer_p = aa_cred_profile(cred); if (!unconfined(tracer_p)) { /* lcred released below */ const struct cred *lcred = get_task_cred(tracee); struct aa_profile *tracee_p = aa_cred_profile(lcred); error = aa_may_ptrace(tracer, tracer_p, tracee_p, mode); error = aa_audit_ptrace(tracer_p, tracee_p, error); put_cred(lcred); } put_cred(cred); return error; }
/* * mm.c * * Created on: Jul 21, 2014 * Author: olic */ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/kthread.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/mutex.h> #include "ecryptfs_kernel.h" extern spinlock_t inode_sb_list_lock; static int ecryptfs_mm_debug = 0; DEFINE_MUTEX(ecryptfs_mm_mutex); static void ecryptfs_mm_drop_pagecache(struct super_block *sb, void *arg) { struct inode *inode, *toput_inode = NULL; int ecryptfs_mm_userid = (int)arg; //printk("%s() sb:%s, userid:%d\n", __func__, sb->s_type->name, ecryptfs_mm_userid); if(!strcmp("ecryptfs", sb->s_type->name)) { struct ecryptfs_mount_crypt_stat *mount_crypt_stat = &(ecryptfs_superblock_to_private(sb)->mount_crypt_stat); if(mount_crypt_stat->userid == ecryptfs_mm_userid) { struct ecryptfs_crypt_stat *crypt_stat; printk("%s() sb found userid:%d\n", __func__, ecryptfs_mm_userid); spin_lock(&inode_sb_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { int retries = 3; unsigned long ret; spin_lock(&inode->i_lock); crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; if(ecryptfs_mm_debug) printk("%s() inode found. [ino:%lu, state:%lu ref_count:%d efs_flag:0x%8x]\n", __func__, inode->i_ino, inode->i_state, atomic_read(&inode->i_count), crypt_stat->flags); if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || (inode->i_mapping->nrpages == 0)) { spin_unlock(&inode->i_lock); continue; } __iget(inode); spin_unlock(&inode->i_lock); spin_unlock(&inode_sb_list_lock); if(crypt_stat->flags & ECRYPTFS_DEK_IS_SENSITIVE) { printk("freeing sensitive inode[mapped pagenum = %lu]\n", inode->i_mapping->nrpages); retry: ret = invalidate_mapping_pages(inode->i_mapping, 0, -1); if(ecryptfs_mm_debug) printk("invalidate_mapping_pages ret = %lu, [%lu] remained\n", ret, inode->i_mapping->nrpages); if(inode->i_mapping->nrpages != 0) { if(retries > 0) { printk("[%lu] mapped pages remained in sensitive inode, retry..\n", inode->i_mapping->nrpages); retries--; msleep(100); goto retry; } else { printk("[%lu] mapped pages remained in sensitive inode, Give up..\n", inode->i_mapping->nrpages); } } }else{ printk("skipping protected inode\n"); } iput(toput_inode); toput_inode = inode; spin_lock(&inode_sb_list_lock); } spin_unlock(&inode_sb_list_lock); iput(toput_inode); } } } static int ecryptfs_mm_task(void *arg) { mutex_lock(&ecryptfs_mm_mutex); iterate_supers(ecryptfs_mm_drop_pagecache, arg); mutex_unlock(&ecryptfs_mm_mutex); return 0; } void ecryptfs_mm_drop_cache(int userid) { #if 1 struct task_struct *task; printk("running cache cleanup thread - sdp-id : %d\n", userid); task = kthread_run(ecryptfs_mm_task, (void *)userid, "sdp_cached"); if (IS_ERR(task)) { printk(KERN_ERR "SDP : unable to create kernel thread: %ld\n", PTR_ERR(task)); } #else ecryptfs_mm_task(&userid); #endif } #include <linux/pagevec.h> #include <linux/pagemap.h> #include <linux/memcontrol.h> #include <linux/atomic.h> static void __page_dump(unsigned char *buf, int len, const char* str) { unsigned int i; char s[512]; s[0] = 0; for(i=0;i<len && i<16;++i) { char tmp[8]; sprintf(tmp, " %02x", buf[i]); strcat(s, tmp); } if (len > 16) { char tmp[8]; sprintf(tmp, " ..."); strcat(s, tmp); } DEK_LOGD("%s [%s len=%d]\n", s, str, len); } #ifdef DEK_DEBUG /* * This dump will appear in ramdump */ void page_dump (struct page *p) { void *d; d = kmap_atomic(p); if(d) { __page_dump((unsigned char *)d, PAGE_SIZE, "freeing"); kunmap_atomic(d); } } #else void page_dump (struct page *p) { // Do nothing } #endif /** * set_sensitive_mapping_pages - Set sensitive all the unlocked pages of one inode * @mapping: the address_space which holds the pages to invalidate * @start: the offset 'from' which to invalidate * @end: the offset 'to' which to invalidate (inclusive) * * This function only Sets sensitive the unlocked pages. * * Return value * 0 : all pages in the mapping set as sensitive * n > 0 : number of normal pages * n < 0 : error */ unsigned long set_sensitive_mapping_pages(struct address_space *mapping, pgoff_t start, pgoff_t end) { struct pagevec pvec; pgoff_t index = start; unsigned long count = 0; int i; /* * Note: this function may get called on a shmem/tmpfs mapping: * pagevec_lookup() might then return 0 prematurely (because it * got a gangful of swap entries); but it's hardly worth worrying * about - it can rarely have anything to free from such a mapping * (most pages are dirty), and already skips over any difficulties. */ pagevec_init(&pvec, 0); while (index <= end && pagevec_lookup(&pvec, mapping, index, min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) { mem_cgroup_uncharge_start(); for (i = 0; i < pagevec_count(&pvec); i++) { struct page *page = pvec.pages[i]; DEK_LOGD("%s : page [flag:0x%ld] freed\n", __func__, page->flags); DEK_LOGD("mapping->nrpages:%lu(now index:%lu) page count:%d, _mapcount:%d\n", mapping->nrpages, index, atomic_read(&page->_count), atomic_read(&(page)->_mapcount)); //page_dump(page); /* We rely upon deletion not changing page->index */ index = page->index; if (index > end) break; if (!trylock_page(page)) continue; WARN_ON(page->index != index); SetPageSensitive(page); unlock_page(page); count++; } pagevec_release(&pvec); mem_cgroup_uncharge_end(); cond_resched(); index++; } return mapping->nrpages - count; }
/* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: power.h * * Purpose: Handles 802.11 power management functions * * Author: Lyndon Chen * * Date: July 17, 2002 * */ #ifndef __POWER_H__ #define __POWER_H__ #define C_PWBT 1000 // micro sec. power up before TBTT #define PS_FAST_INTERVAL 1 // Fast power saving listen interval #define PS_MAX_INTERVAL 4 // MAX power saving listen interval bool PSbConsiderPowerDown( void *hDeviceContext, bool bCheckRxDMA, bool bCheckCountToWakeUp ); void PSvDisablePowerSaving( void *hDeviceContext ); void PSvEnablePowerSaving( void *hDeviceContext, unsigned short wListenInterval ); void PSvSendPSPOLL( void *hDeviceContext ); bool PSbSendNullPacket( void *hDeviceContext ); bool PSbIsNextTBTTWakeUp( void *hDeviceContext ); #endif //__POWER_H__
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #ifndef INCLUDE_git_strarray_h__ #define INCLUDE_git_strarray_h__ #include "common.h" /** * @file git2/strarray.h * @brief Git string array routines * @defgroup git_strarray Git string array routines * @ingroup Git * @{ */ GIT_BEGIN_DECL /** Array of strings */ typedef struct git_strarray { char **strings; size_t count; } git_strarray; /** * Close a string array object * * This method should be called on `git_strarray` objects where the strings * array is allocated and contains allocated strings, such as what you * would get from `git_strarray_copy()`. Not doing so, will result in a * memory leak. * * This does not free the `git_strarray` itself, since the library will * never allocate that object directly itself (it is more commonly embedded * inside another struct or created on the stack). * * @param array git_strarray from which to free string data */ GIT_EXTERN(void) git_strarray_free(git_strarray *array); /** * Copy a string array object from source to target. * * Note: target is overwritten and hence should be empty, otherwise its * contents are leaked. Call git_strarray_free() if necessary. * * @param tgt target * @param src source * @return 0 on success, < 0 on allocation failure */ GIT_EXTERN(int) git_strarray_copy(git_strarray *tgt, const git_strarray *src); /** @} */ GIT_END_DECL #endif
/* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #pragma once #include "AddonClass.h" #include "CallbackFunction.h" #include "CallbackHandler.h" #include "LanguageHook.h" namespace XBMCAddon { /** * This class is the superclass for all API classes that are expected * to be able to handle cross-language polymorphism. */ class AddonCallback : public AddonClass { protected: AddonClass::Ref<CallbackHandler> handler; bool hasHandler() { return handler.isNotNull(); } inline AddonCallback() : handler(NULL) { // if there is a LanguageHook, it should be set already. if (languageHook != NULL) setHandler(languageHook->GetCallbackHandler()); } public: virtual ~AddonCallback(); inline void setHandler(CallbackHandler* _handler) { handler = _handler; } void invokeCallback(Callback* callback); }; }
/* rwsem.h: R/W semaphores, public interface * * Written by David Howells (dhowells@redhat.com). * Derived from asm-i386/semaphore.h */ #ifndef _LINUX_RWSEM_H #define _LINUX_RWSEM_H #include <linux/linkage.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/spinlock.h> #include <linux/atomic.h> struct rw_semaphore; #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK #include <linux/rwsem-spinlock.h> /* use a generic implementation */ #else /* All arch specific implementations share the same struct */ struct rw_semaphore { long count; raw_spinlock_t wait_lock; struct list_head wait_list; #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map; #endif }; extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); /* Include the arch specific part */ #include <asm/rwsem.h> /* In all implementations count != 0 means locked */ static inline int rwsem_is_locked(struct rw_semaphore *sem) { return sem->count != 0; } #endif /* Common initializer macros and functions */ #ifdef CONFIG_DEBUG_LOCK_ALLOC # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } #else # define __RWSEM_DEP_MAP_INIT(lockname) #endif #define __RWSEM_INITIALIZER(name) \ { RWSEM_UNLOCKED_VALUE, \ __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ LIST_HEAD_INIT((name).wait_list) \ __RWSEM_DEP_MAP_INIT(name) } #define DECLARE_RWSEM(name) \ struct rw_semaphore name = __RWSEM_INITIALIZER(name) extern void __init_rwsem(struct rw_semaphore *sem, const char *name, struct lock_class_key *key); #define init_rwsem(sem) \ do { \ static struct lock_class_key __key; \ \ __init_rwsem((sem), #sem, &__key); \ } while (0) /* * lock for reading */ extern void down_read(struct rw_semaphore *sem); /* * trylock for reading -- returns 1 if successful, 0 if contention */ extern int down_read_trylock(struct rw_semaphore *sem); /* * lock for writing */ extern void down_write(struct rw_semaphore *sem); /* * trylock for writing -- returns 1 if successful, 0 if contention */ extern int down_write_trylock(struct rw_semaphore *sem); /* * release a read lock */ extern void up_read(struct rw_semaphore *sem); /* * release a write lock */ extern void up_write(struct rw_semaphore *sem); /* * downgrade write lock to read lock */ extern void downgrade_write(struct rw_semaphore *sem); #ifdef CONFIG_DEBUG_LOCK_ALLOC /* * nested locking. NOTE: rwsems are not allowed to recurse * (which occurs if the same task tries to acquire the same * lock instance multiple times), but multiple locks of the * same lock class might be taken, if the order of the locks * is always the same. This ordering rule can be expressed * to lockdep via the _nested() APIs, but enumerating the * subclasses that are used. (If the nesting relationship is * static then another method for expressing nested locking is * the explicit definition of lock class keys and the use of * lockdep_set_class() at lock initialization time. * See Documentation/lockdep-design.txt for more details.) */ extern void down_read_nested(struct rw_semaphore *sem, int subclass); extern void down_write_nested(struct rw_semaphore *sem, int subclass); #else # define down_read_nested(sem, subclass) down_read(sem) # define down_write_nested(sem, subclass) down_write(sem) #endif #endif /* _LINUX_RWSEM_H */
/* { dg-require-effective-target int32plus } */ /* { dg-require-effective-target size32plus } */ char *buf; int buflen; inline int sub (int length) { if (length <= buflen) buf[length] = '\0'; return 0; } int sub2 (void) { return sub (0x7fffffff); }
/* * definition for store system information stsi * * Copyright IBM Corp. 2001,2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2 only) * as published by the Free Software Foundation. * * Author(s): Ulrich Weigand <weigand@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com> */ #ifndef __ASM_S390_SYSINFO_H #define __ASM_S390_SYSINFO_H #include <asm/bitsperlong.h> struct sysinfo_1_1_1 { unsigned short :16; unsigned char ccr; unsigned char cai; char reserved_0[28]; char manufacturer[16]; char type[4]; char reserved_1[12]; char model_capacity[16]; char sequence[16]; char plant[4]; char model[16]; char model_perm_cap[16]; char model_temp_cap[16]; char model_cap_rating[4]; char model_perm_cap_rating[4]; char model_temp_cap_rating[4]; }; struct sysinfo_1_2_1 { char reserved_0[80]; char sequence[16]; char plant[4]; char reserved_1[2]; unsigned short cpu_address; }; struct sysinfo_1_2_2 { char format; char reserved_0[1]; unsigned short acc_offset; char reserved_1[24]; unsigned int secondary_capability; unsigned int capability; unsigned short cpus_total; unsigned short cpus_configured; unsigned short cpus_standby; unsigned short cpus_reserved; unsigned short adjustment[0]; }; struct sysinfo_1_2_2_extension { unsigned int alt_capability; unsigned short alt_adjustment[0]; }; struct sysinfo_2_2_1 { char reserved_0[80]; char sequence[16]; char plant[4]; unsigned short cpu_id; unsigned short cpu_address; }; struct sysinfo_2_2_2 { char reserved_0[32]; unsigned short lpar_number; char reserved_1; unsigned char characteristics; unsigned short cpus_total; unsigned short cpus_configured; unsigned short cpus_standby; unsigned short cpus_reserved; char name[8]; unsigned int caf; char reserved_2[16]; unsigned short cpus_dedicated; unsigned short cpus_shared; }; #define LPAR_CHAR_DEDICATED (1 << 7) #define LPAR_CHAR_SHARED (1 << 6) #define LPAR_CHAR_LIMITED (1 << 5) struct sysinfo_3_2_2 { char reserved_0[31]; unsigned char :4; unsigned char count:4; struct { char reserved_0[4]; unsigned short cpus_total; unsigned short cpus_configured; unsigned short cpus_standby; unsigned short cpus_reserved; char name[8]; unsigned int caf; char cpi[16]; char reserved_1[24]; } vm[8]; char reserved_544[3552]; }; #define TOPOLOGY_CPU_BITS 64 #define TOPOLOGY_NR_MAG 6 struct topology_cpu { unsigned char reserved0[4]; unsigned char :6; unsigned char pp:2; unsigned char reserved1; unsigned short origin; unsigned long mask[TOPOLOGY_CPU_BITS / BITS_PER_LONG]; }; struct topology_container { unsigned char reserved[7]; unsigned char id; }; union topology_entry { unsigned char nl; struct topology_cpu cpu; struct topology_container container; }; struct sysinfo_15_1_x { unsigned char reserved0[2]; unsigned short length; unsigned char mag[TOPOLOGY_NR_MAG]; unsigned char reserved1; unsigned char mnest; unsigned char reserved2[4]; union topology_entry tle[0]; }; static inline int stsi(void *sysinfo, int fc, int sel1, int sel2) { register int r0 asm("0") = (fc << 28) | sel1; register int r1 asm("1") = sel2; asm volatile( " stsi 0(%2)\n" "0: jz 2f\n" "1: lhi %0,%3\n" "2:\n" EX_TABLE(0b, 1b) : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS) : "cc", "memory"); return r0; } /* * Service level reporting interface. */ struct service_level { struct list_head list; void (*seq_print)(struct seq_file *, struct service_level *); }; int register_service_level(struct service_level *); int unregister_service_level(struct service_level *); #endif /* __ASM_S390_SYSINFO_H */
#ifndef _ASM_GENERIC_CPUTIME_JIFFIES_H #define _ASM_GENERIC_CPUTIME_JIFFIES_H typedef unsigned long __nocast cputime_t; #define cputime_one_jiffy jiffies_to_cputime(1) #define cputime_to_jiffies(__ct) (__force unsigned long)(__ct) #define cputime_to_scaled(__ct) (__ct) #define jiffies_to_cputime(__hz) (__force cputime_t)(__hz) typedef u64 __nocast cputime64_t; #define cputime64_to_jiffies64(__ct) (__force u64)(__ct) #define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif) /* * Convert nanoseconds <-> cputime */ #define cputime_to_nsecs(__ct) \ jiffies_to_nsecs(cputime_to_jiffies(__ct)) #define nsecs_to_cputime64(__nsec) \ jiffies64_to_cputime64(nsecs_to_jiffies64(__nsec)) #define nsecs_to_cputime(__nsec) \ jiffies_to_cputime(nsecs_to_jiffies(__nsec)) /* * Convert cputime to microseconds and back. */ #define cputime_to_usecs(__ct) \ jiffies_to_usecs(cputime_to_jiffies(__ct)) #define usecs_to_cputime(__usec) \ jiffies_to_cputime(usecs_to_jiffies(__usec)) #define usecs_to_cputime64(__usec) \ jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000)) /* * Convert cputime to seconds and back. */ #define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ) #define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ) /* * Convert cputime to timespec and back. */ #define timespec_to_cputime(__val) \ jiffies_to_cputime(timespec_to_jiffies(__val)) #define cputime_to_timespec(__ct,__val) \ jiffies_to_timespec(cputime_to_jiffies(__ct),__val) /* * Convert cputime to timeval and back. */ #define timeval_to_cputime(__val) \ jiffies_to_cputime(timeval_to_jiffies(__val)) #define cputime_to_timeval(__ct,__val) \ jiffies_to_timeval(cputime_to_jiffies(__ct),__val) /* * Convert cputime to clock and back. */ #define cputime_to_clock_t(__ct) \ jiffies_to_clock_t(cputime_to_jiffies(__ct)) #define clock_t_to_cputime(__x) \ jiffies_to_cputime(clock_t_to_jiffies(__x)) /* * Convert cputime64 to clock. */ #define cputime64_to_clock_t(__ct) \ jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct)) #endif
/* linux/drivers/video/backlight/tc358764_mipi_lcd.c * * * Copyright (c) 2011 Samsung Electronics * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/mutex.h> #include <linux/wait.h> #include <linux/ctype.h> #include <linux/io.h> #include <linux/delay.h> #include <linux/irq.h> #include <linux/interrupt.h> #include <linux/gpio.h> #include <linux/workqueue.h> #include <linux/backlight.h> #include <linux/lcd.h> #include <video/mipi_display.h> #include <plat/gpio-cfg.h> #include <plat/regs-mipidsim.h> #include <plat/dsim.h> #include <plat/mipi_dsi.h> static int init_lcd(struct mipi_dsim_device *dsim) { unsigned char initcode_013c[6] = {0x3c, 0x01, 0x03, 0x00, 0x02, 0x00}; unsigned char initcode_0114[6] = {0x14, 0x01, 0x02, 0x00, 0x00, 0x00}; unsigned char initcode_0164[6] = {0x64, 0x01, 0x05, 0x00, 0x00, 0x00}; unsigned char initcode_0168[6] = {0x68, 0x01, 0x05, 0x00, 0x00, 0x00}; unsigned char initcode_016c[6] = {0x6c, 0x01, 0x05, 0x00, 0x00, 0x00}; unsigned char initcode_0170[6] = {0x70, 0x01, 0x05, 0x00, 0x00, 0x00}; unsigned char initcode_0134[6] = {0x34, 0x01, 0x1f, 0x00, 0x00, 0x00}; unsigned char initcode_0210[6] = {0x10, 0x02, 0x1f, 0x00, 0x00, 0x00}; unsigned char initcode_0104[6] = {0x04, 0x01, 0x01, 0x00, 0x00, 0x00}; unsigned char initcode_0204[6] = {0x04, 0x02, 0x01, 0x00, 0x00, 0x00}; unsigned char initcode_0450[6] = {0x50, 0x04, 0x20, 0x01, 0xfa, 0x00}; unsigned char initcode_0454[6] = {0x54, 0x04, 0x20, 0x00, 0x50, 0x00}; unsigned char initcode_0458[6] = {0x58, 0x04, 0x00, 0x05, 0x30, 0x00}; unsigned char initcode_045c[6] = {0x5c, 0x04, 0x05, 0x00, 0x0a, 0x00}; unsigned char initcode_0460[6] = {0x60, 0x04, 0x20, 0x03, 0x0a, 0x00}; unsigned char initcode_0464[6] = {0x64, 0x04, 0x01, 0x00, 0x00, 0x00}; unsigned char initcode_04a0_1[6] = {0xa0, 0x04, 0x06, 0x80, 0x44, 0x00}; unsigned char initcode_04a0_2[6] = {0xa0, 0x04, 0x06, 0x80, 0x04, 0x00}; unsigned char initcode_0504[6] = {0x04, 0x05, 0x04, 0x00, 0x00, 0x00}; unsigned char initcode_049c[6] = {0x9c, 0x04, 0x0d, 0x00, 0x00, 0x00}; if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_013c, sizeof(initcode_013c)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0114, sizeof(initcode_0114)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0164, sizeof(initcode_0164)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0168, sizeof(initcode_0168)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_016c, sizeof(initcode_016c)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0170, sizeof(initcode_0170)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0134, sizeof(initcode_0134)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0210, sizeof(initcode_0210)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0104, sizeof(initcode_0104)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0204, sizeof(initcode_0204)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0450, sizeof(initcode_0450)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0454, sizeof(initcode_0454)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0458, sizeof(initcode_0458)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_045c, sizeof(initcode_045c)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0460, sizeof(initcode_0460)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0464, sizeof(initcode_0464)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_04a0_1, sizeof(initcode_04a0_1)) == -1) return 0; mdelay(12); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_04a0_2, sizeof(initcode_04a0_2)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_0504, sizeof(initcode_0504)) == -1) return 0; mdelay(6); if (s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_GENERIC_LONG_WRITE, (unsigned int) initcode_049c, sizeof(initcode_049c)) == -1) return 0; mdelay(800); return 1; } void tc358764_mipi_lcd_off(struct mipi_dsim_device *dsim) { mdelay(1); } static int tc358764_mipi_lcd_suspend(struct mipi_dsim_device *dsim) { tc358764_mipi_lcd_off(dsim); return 0; } static int tc358764_mipi_lcd_displayon(struct mipi_dsim_device *dsim) { return init_lcd(dsim); } static int tc358764_mipi_lcd_resume(struct mipi_dsim_device *dsim) { return init_lcd(dsim); } struct mipi_dsim_lcd_driver tc358764_mipi_lcd_driver = { .suspend = tc358764_mipi_lcd_suspend, .displayon = tc358764_mipi_lcd_displayon, .resume = tc358764_mipi_lcd_resume, };
/* * Performance counter support for e500 family processors. * * Copyright 2008-2009 Paul Mackerras, IBM Corporation. * Copyright 2010 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <linux/string.h> #include <linux/perf_event.h> #include <asm/reg.h> #include <asm/cputable.h> /* * Map of generic hardware event types to hardware events * Zero if unsupported */ static int e500_generic_events[] = { [PERF_COUNT_HW_CPU_CYCLES] = 1, [PERF_COUNT_HW_INSTRUCTIONS] = 2, [PERF_COUNT_HW_CACHE_MISSES] = 41, /* Data L1 cache reloads */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12, [PERF_COUNT_HW_BRANCH_MISSES] = 15, [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 18, [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 19, }; #define C(x) PERF_COUNT_HW_CACHE_##x /* * Table of generalized cache-related events. * 0 means not supported, -1 means nonsensical, other values * are event codes. */ static int e500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { /* * D-cache misses are not split into read/write/prefetch; * use raw event 41. */ [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */ [C(OP_READ)] = { 27, 0 }, [C(OP_WRITE)] = { 28, 0 }, [C(OP_PREFETCH)] = { 29, 0 }, }, [C(L1I)] = { /* RESULT_ACCESS RESULT_MISS */ [C(OP_READ)] = { 2, 60 }, [C(OP_WRITE)] = { -1, -1 }, [C(OP_PREFETCH)] = { 0, 0 }, }, /* * Assuming LL means L2, it's not a good match for this model. * It allocates only on L1 castout or explicit prefetch, and * does not have separate read/write events (but it does have * separate instruction/data events). */ [C(LL)] = { /* RESULT_ACCESS RESULT_MISS */ [C(OP_READ)] = { 0, 0 }, [C(OP_WRITE)] = { 0, 0 }, [C(OP_PREFETCH)] = { 0, 0 }, }, /* * There are data/instruction MMU misses, but that's a miss on * the chip's internal level-one TLB which is probably not * what the user wants. Instead, unified level-two TLB misses * are reported here. */ [C(DTLB)] = { /* RESULT_ACCESS RESULT_MISS */ [C(OP_READ)] = { 26, 66 }, [C(OP_WRITE)] = { -1, -1 }, [C(OP_PREFETCH)] = { -1, -1 }, }, [C(BPU)] = { /* RESULT_ACCESS RESULT_MISS */ [C(OP_READ)] = { 12, 15 }, [C(OP_WRITE)] = { -1, -1 }, [C(OP_PREFETCH)] = { -1, -1 }, }, [C(NODE)] = { /* RESULT_ACCESS RESULT_MISS */ [C(OP_READ)] = { -1, -1 }, [C(OP_WRITE)] = { -1, -1 }, [C(OP_PREFETCH)] = { -1, -1 }, }, }; static int num_events = 128; /* Upper half of event id is PMLCb, for threshold events */ static u64 e500_xlate_event(u64 event_id) { u32 event_low = (u32)event_id; u64 ret; if (event_low >= num_events) return 0; ret = FSL_EMB_EVENT_VALID; if (event_low >= 76 && event_low <= 81) { ret |= FSL_EMB_EVENT_RESTRICTED; ret |= event_id & (FSL_EMB_EVENT_THRESHMUL | FSL_EMB_EVENT_THRESH); } else if (event_id & (FSL_EMB_EVENT_THRESHMUL | FSL_EMB_EVENT_THRESH)) { /* Threshold requested on non-threshold event */ return 0; } return ret; } static struct fsl_emb_pmu e500_pmu = { .name = "e500 family", .n_counter = 4, .n_restricted = 2, .xlate_event = e500_xlate_event, .n_generic = ARRAY_SIZE(e500_generic_events), .generic_events = e500_generic_events, .cache_events = &e500_cache_events, }; static int init_e500_pmu(void) { if (!cur_cpu_spec->oprofile_cpu_type) return -ENODEV; if (!strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc/e500mc")) num_events = 256; else if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc/e500")) return -ENODEV; return register_fsl_emb_pmu(&e500_pmu); } early_initcall(init_e500_pmu);
/* * dir.c * * Copyright (c) 1999 Al Smith */ #include <linux/buffer_head.h> #include <linux/smp_lock.h> #include "efs.h" static int efs_readdir(struct file *, void *, filldir_t); const struct file_operations efs_dir_operations = { .read = generic_read_dir, .readdir = efs_readdir, }; const struct inode_operations efs_dir_inode_operations = { .lookup = efs_lookup, }; static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { struct inode *inode = filp->f_path.dentry->d_inode; struct buffer_head *bh; struct efs_dir *dirblock; struct efs_dentry *dirslot; efs_ino_t inodenum; efs_block_t block; int slot, namelen; char *nameptr; if (inode->i_size & (EFS_DIRBSIZE-1)) printk(KERN_WARNING "EFS: WARNING: readdir(): directory size not a multiple of EFS_DIRBSIZE\n"); lock_kernel(); /* work out where this entry can be found */ block = filp->f_pos >> EFS_DIRBSIZE_BITS; /* each block contains at most 256 slots */ slot = filp->f_pos & 0xff; /* look at all blocks */ while (block < inode->i_blocks) { /* read the dir block */ bh = sb_bread(inode->i_sb, efs_bmap(inode, block)); if (!bh) { printk(KERN_ERR "EFS: readdir(): failed to read dir block %d\n", block); break; } dirblock = (struct efs_dir *) bh->b_data; if (be16_to_cpu(dirblock->magic) != EFS_DIRBLK_MAGIC) { printk(KERN_ERR "EFS: readdir(): invalid directory block\n"); brelse(bh); break; } while (slot < dirblock->slots) { if (dirblock->space[slot] == 0) { slot++; continue; } dirslot = (struct efs_dentry *) (((char *) bh->b_data) + EFS_SLOTAT(dirblock, slot)); inodenum = be32_to_cpu(dirslot->inode); namelen = dirslot->namelen; nameptr = dirslot->name; #ifdef DEBUG printk(KERN_DEBUG "EFS: readdir(): block %d slot %d/%d: inode %u, name \"%s\", namelen %u\n", block, slot, dirblock->slots-1, inodenum, nameptr, namelen); #endif if (namelen > 0) { /* found the next entry */ filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot; /* copy filename and data in dirslot */ filldir(dirent, nameptr, namelen, filp->f_pos, inodenum, DT_UNKNOWN); /* sanity check */ if (nameptr - (char *) dirblock + namelen > EFS_DIRBSIZE) { printk(KERN_WARNING "EFS: directory entry %d exceeds directory block\n", slot); slot++; continue; } /* store position of next slot */ if (++slot == dirblock->slots) { slot = 0; block++; } brelse(bh); filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot; goto out; } slot++; } brelse(bh); slot = 0; block++; } filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot; out: unlock_kernel(); return 0; }
/* * Copyright (C) 2013 Samsung Electronics. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef _MPU6500_PLATFORMDATA_H_ #define _MPU6500_PLATFORMDATA_H_ #define MPU6500_TOP_LEFT_UPPER 0 #define MPU6500_TOP_RIGHT_UPPER 1 #define MPU6500_TOP_RIGHT_LOWER 2 #define MPU6500_TOP_LEFT_LOWER 3 #define MPU6500_BOTTOM_LEFT_UPPER 4 #define MPU6500_BOTTOM_RIGHT_UPPER 5 #define MPU6500_BOTTOM_RIGHT_LOWER 6 #define MPU6500_BOTTOM_LEFT_LOWER 7 struct mpu6500_platform_data { void (*get_pos)(int *); bool i2c_pull_up; int gpio_int; u32 irq_gpio_flags; int gpio_sda; u32 sda_gpio_flags; int gpio_scl; u32 scl_gpio_flags; const u8 *str_l6; const u8 *str_lvs1; const char *acc_cal_path; const char *gyro_cal_path; }; #endif
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ___ASM_SPARC_IOMMU_H #define ___ASM_SPARC_IOMMU_H #if defined(__sparc__) && defined(__arch64__) #include <asm/iommu_64.h> #else #include <asm/iommu_32.h> #endif #endif
/* DVB USB compliant linux driver for mobile DVB-T USB devices based on * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-C/P) * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) * * based on GPL code from DiBcom, which has * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 2. * * see Documentation/dvb/README.dvb-usb for more information */ #include "dibusb.h" DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); /* USB Driver stuff */ static struct dvb_usb_device_properties dibusb_mc_properties; static int dibusb_mc_probe(struct usb_interface *intf, const struct usb_device_id *id) { return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE, NULL, adapter_nr); } /* do not change the order of the ID table */ static struct usb_device_id dibusb_dib3000mc_table [] = { /* 00 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, /* 01 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, /* 02 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, /* 03 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_WARM) }, // ( ? ) /* 04 */ { USB_DEVICE(USB_VID_LITEON, USB_PID_LITEON_DVB_T_COLD) }, /* 05 */ { USB_DEVICE(USB_VID_LITEON, USB_PID_LITEON_DVB_T_WARM) }, /* 06 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_COLD) }, /* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_WARM) }, /* 08 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_COLD) }, /* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_WARM) }, /* 10 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14_COLD) }, /* 11 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14_WARM) }, /* 12 */ { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_COLD) }, /* 13 */ { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_WARM) }, /* 14 */ { USB_DEVICE(USB_VID_HUMAX_COEX, USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD) }, /* 15 */ { USB_DEVICE(USB_VID_HUMAX_COEX, USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table); static struct dvb_usb_device_properties dibusb_mc_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-dibusb-6.0.0.8.fw", .num_adapters = 1, .adapter = { { .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, .pid_filter_count = 32, .streaming_ctrl = dibusb2_0_streaming_ctrl, .pid_filter = dibusb_pid_filter, .pid_filter_ctrl = dibusb_pid_filter_ctrl, .frontend_attach = dibusb_dib3000mc_frontend_attach, .tuner_attach = dibusb_dib3000mc_tuner_attach, /* parameter for the MPEG2-data transfer */ .stream = { .type = USB_BULK, .count = 8, .endpoint = 0x06, .u = { .bulk = { .buffersize = 4096, } } }, .size_of_priv = sizeof(struct dibusb_state), } }, .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* FIXME */ .rc_query = dibusb_rc_query, .i2c_algo = &dibusb_i2c_algo, .generic_bulk_ctrl_endpoint = 0x01, .num_device_descs = 8, .devices = { { "DiBcom USB2.0 DVB-T reference design (MOD3000P)", { &dibusb_dib3000mc_table[0], NULL }, { &dibusb_dib3000mc_table[1], NULL }, }, { "Artec T1 USB2.0 TVBOX (please check the warm ID)", { &dibusb_dib3000mc_table[2], NULL }, { &dibusb_dib3000mc_table[3], NULL }, }, { "LITE-ON USB2.0 DVB-T Tuner", /* Also rebranded as Intuix S800, Toshiba */ { &dibusb_dib3000mc_table[4], NULL }, { &dibusb_dib3000mc_table[5], NULL }, }, { "MSI Digivox Mini SL", { &dibusb_dib3000mc_table[6], NULL }, { &dibusb_dib3000mc_table[7], NULL }, }, { "GRAND - USB2.0 DVB-T adapter", { &dibusb_dib3000mc_table[8], NULL }, { &dibusb_dib3000mc_table[9], NULL }, }, { "Artec T14 - USB2.0 DVB-T", { &dibusb_dib3000mc_table[10], NULL }, { &dibusb_dib3000mc_table[11], NULL }, }, { "Leadtek - USB2.0 Winfast DTV dongle", { &dibusb_dib3000mc_table[12], NULL }, { &dibusb_dib3000mc_table[13], NULL }, }, { "Humax/Coex DVB-T USB Stick 2.0 High Speed", { &dibusb_dib3000mc_table[14], NULL }, { &dibusb_dib3000mc_table[15], NULL }, }, { NULL }, } }; static struct usb_driver dibusb_mc_driver = { .name = "dvb_usb_dibusb_mc", .probe = dibusb_mc_probe, .disconnect = dvb_usb_device_exit, .id_table = dibusb_dib3000mc_table, }; /* module stuff */ static int __init dibusb_mc_module_init(void) { int result; if ((result = usb_register(&dibusb_mc_driver))) { err("usb_register failed. Error number %d",result); return result; } return 0; } static void __exit dibusb_mc_module_exit(void) { /* deregister this driver from the USB subsystem */ usb_deregister(&dibusb_mc_driver); } module_init (dibusb_mc_module_init); module_exit (dibusb_mc_module_exit); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices"); MODULE_VERSION("1.0"); MODULE_LICENSE("GPL");
#ifndef LMZ_CERTINFO_H_DEFINED #define LMZ_CERTINFO_H_DEFINED #include "cryptlib.h" #define LMZ_ATTR_TYPE_UNKNOWN 0 #define LMZ_ATTR_TYPE_NUMERIC 1 #define LMZ_ATTR_TYPE_PRINTABLE 2 #define LMZ_ATTR_TYPE_BINARY 3 #define LMZ_ATTR_TYPE_GROUP 4 #define LMZ_ATTR_TYPE_EXISTENCE 5 #define LMZ_ATTR_TYPE_GENERALNAME 6 #define LMZ_ATTR_TYPE_TIME 7 #define LMZ_ATTR_TYPE_BOOLEAN 8 int lmz_certinfo_get_description(CRYPT_ATTRIBUTE_TYPE attr, const char **pName, int *pType); void lmz_certinfo_enum_simple_cert_attributes( CRYPT_CERTIFICATE cert, void (*callback)(int /* attr */, int /* attr_type */, void* /* data */, int /* data_len */, void* /* user_data */), void *user_data ); #endif
#ifndef _WCSDUP_H_ #define _WCSDUP_H_ #ifdef HAS_NO_WCSDUP #include <wchar.h> wchar_t *wcsdup(const wchar_t *); #endif #endif /* _WCSDUP_H_ */
/** * Copyright (c) 2014 William Light <wrl@illest.net> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <jack/jack.h> #include "jogma/jogma.h" #include "jogma_private/util.h" extern const size_t JOGMA_BUFFER_FRAMES; static int process(jack_nframes_t nframes, void *ctx) { struct jogma_state *state = ctx; struct jogma_jack_port *p; unsigned i, channels; size_t written; float *buf; if (state->status != JOGMA_STATUS_RUNNING) return 0; channels = state->jack.channels; for (i = 0; i < channels; i++) { p = &state->jack.ports[i]; buf = jack_port_get_buffer(p->port, nframes); written = jack_ringbuffer_write(p->buffer, (void *) buf, nframes * sizeof(*buf)); if (written < nframes) printf( " :: JACK buffer overflow on channel %d:" "tried to write %d frames, only wrote %zu\n", i, nframes, written); } return 0; } int jogma_jack_init(struct jogma_state *state, unsigned channels) { struct jogma_jack_port *p; char port_name_buf[32]; jack_status_t status; jack_client_t *c; unsigned i; if (!channels) return -1; c = jack_client_open("jogma", JackNoStartServer, &status); if (!c) return -1; state->jack.client = c; for (i = 0; i < channels && i < ARRAY_LENGTH(state->jack.ports); i++) { p = &state->jack.ports[i]; snprintf(port_name_buf, sizeof(port_name_buf), "input_%d", i); p->port = jack_port_register(c, port_name_buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); p->buffer = jack_ringbuffer_create(sizeof(float) * JOGMA_BUFFER_FRAMES); } state->jack.channels = i; jack_set_process_callback(c, process, state); jack_activate(c); return 0; } void jogma_jack_fini(struct jogma_state *state) { struct jogma_jack_port *p; jack_client_t *c = state->jack.client; unsigned i, channels; jack_deactivate(c); channels = state->jack.channels; for (i = 0; i < channels; i++) { p = &state->jack.ports[i]; jack_port_unregister(c, p->port); jack_ringbuffer_free(p->buffer); p->port = NULL; p->buffer = NULL; } jack_client_close(c); state->jack.client = NULL; }
/* * Copyright (c) 2014, Julien Bernard * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef MM_MIDPOINT_DISPLACEMENT_H #define MM_MIDPOINT_DISPLACEMENT_H #include <mm/random.h> #include <mm/heightmap.h> namespace mm { class midpoint_displacement { public: typedef typename position::size_type size_type; midpoint_displacement(double val = 0.0) : m_ne(val), m_nw(val), m_sw(val), m_se(val) { } midpoint_displacement(double ne, double nw, double sw, double se) : m_ne(ne), m_nw(nw), m_sw(sw), m_se(se) { } heightmap operator()(random_engine& r, size_type width, size_type height) const; private: double m_ne; double m_nw; double m_sw; double m_se; }; } #endif // MM_MIDPOINT_DISPLACEMENT_H
/*-------------- Telecommunications & Signal Processing Lab --------------- McGill University Routine: double *MScoefMC (double x1, double x2, double y1, double y2, double d1, double d2) Purpose: Find the coefficients of a cubic given values and slopes Description: This routine calculates the coefficients of a polynomial, given the values and slopes at two reference points. The output is the vector of coefficients c[i], where 0 <= i <= 3, p(x) = c[3] x^3 + c[2] x^2 + c[1] x + c[0]. The polynomial is specified on input in terms of values and derivatives at two reference points, d p(x1) d p(x2) y1 = p(x1), y2 = p(x2), d1 = -------, d2 = ------- . dx dx Parameters: <- double *MScoefMC Pointer to the array of polynomial coefficients -> double x1 Abscissa value at the first reference point -> double x2 Abscissa value at the second reference point -> double y1 Value at the first reference point -> double y2 Value at the second reference point -> double d1 Derivative at the first reference point -> double d2 Derivative at the second reference point Author / revision: P. Kabal Copyright (C) 2003 $Revision: 1.11 $ $Date: 2003/05/09 02:31:19 $ -------------------------------------------------------------------------*/ #include <assert.h> #include <libtsp.h> #include <libtsp/nucleus.h> double * MScoefMC (double x1, double x2, double y1, double y2, double d1, double d2) { double ap, bp, cp, dp, dX, S, dd1, dd2; static double c[4]; /* Express the cubic as R(u) = A u^3 + B u^2 + C u + D , where u=(x-x1)/(x2-x1) varies between 0 and 1 as x varies between x1 and x2. The coefficients of R(u) can be determined by solving the simultaneous equations: R(0) = y1 | 1 0 0 0 | | D | | y1 | R(1) = y2 or | 1 1 1 1 | | C | = | y2 | R'(0) = du1 | 0 1 0 0 | | B | | du1| du1 = d1 (x2-x1) R'(1) = du2 | 0 1 2 3 | | A | | du2| du2 = d2 (x2-x1) The polynomial coefficients for R(u) are: D = y1 = y1 C = du1 = d1 dX B = 3 (y2-y1) - 2 du1 - du2 = (3S - 2d1 - d2) dX A = -2 (y2-y1) + du1 + du2 = (-2S + d1 + d2) dX where S=(y2-y1)/(x2-x1) and dX=(x2-x1). Define a new polynomial in v, where v = x-x1 = u dX, Q(v)=a' v^3 + b' v^2 + c' v + d' , The coefficients of Q(v) can be related to those of R(u), d' = D = y1 c' = C/dX = d1 b' = B/dX^2 = (3S - 2 d1 - d2)/dX a' = A/dX^3 = (-2S + d1 + d2)/dX^2 Finally, consider the transformation x = v+x1, giving P(x) = a x^3 + b x^2 + c x + d . Substituting v=x-x1 in Q(v) and expanding out the terms, we get d = -a' x1^3 + b' x1^2 - c' x1 + d' c = 3 a' x1^2 - 2 b' x1 + c' b = -3 a' x1 + b' a = a' */ if (x1 != x2) { dX = x2 - x1; S = (y2 - y1) / dX; dd1 = (d1 - S) / dX; dd2 = (d2 - S) / dX; dp = y1; cp = d1; bp = -(dd1 + dd2 + dd1); ap = (dd1 + dd2) / dX; c[0] = dp - x1 * (cp - x1 * (bp - x1 * ap)); c[1] = cp - x1 * (2.0 * bp - x1 * (3.0 * ap)); c[2] = bp - x1 * (3.0 * ap); c[3] = ap; } else { /* Zero size interval */ assert (y1 == y2 && d1 == d2); c[0] = y1 - d1 * x1; c[1] = d1; c[2] = 0.0; c[3] = 0.0; } return c; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <iWorkImport/TSCHChartCommand.h> // Not exported @interface TSCHCommandMoveGridRows : TSCHChartCommand { struct _NSRange mRowRange; long long mAfterRow; } - (id).cxx_construct; - (void)saveToArchiver:(id)arg1; - (id)initFromUnarchiver:(id)arg1; - (const struct ChartCommandArchive *)chartCommandArchiveFromUnarchiver:(id)arg1; - (void)redoPrimitive; - (void)undoPrimitive; - (void)commitPrimitive; - (id)initWithChartInfo:(id)arg1 rows:(struct _NSRange)arg2 afterRow:(long long)arg3; @end
// // AKPickerView.h // AKPickerViewSample // // Created by Akio Yasui on 3/29/14. // Copyright (c) 2014 Akio Yasui. All rights reserved. // #import <UIKit/UIScrollView.h> #import <UIKit/UILabel.h> typedef NS_ENUM(NSInteger, IQAKPickerViewStyle) { IQAKPickerViewStyle3D = 1, IQAKPickerViewStyleFlat }; @class IQAKPickerView; @protocol IQAKPickerViewDataSource <NSObject> @required - (NSUInteger)numberOfItemsInPickerView:(IQAKPickerView *)pickerView; @optional - (NSString *)pickerView:(IQAKPickerView *)pickerView titleForItem:(NSInteger)item; @end @protocol IQAKPickerViewDelegate <UIScrollViewDelegate> @optional - (void)pickerView:(IQAKPickerView *)pickerView didSelectItem:(NSInteger)item; - (CGSize)pickerView:(IQAKPickerView *)pickerView marginForItem:(NSInteger)item; - (void)pickerView:(IQAKPickerView *)pickerView configureLabel:(UILabel * const)label forItem:(NSInteger)item; @end @interface IQAKPickerView : UIView @property (nonatomic, weak) id <IQAKPickerViewDataSource> dataSource; @property (nonatomic, weak) id <IQAKPickerViewDelegate> delegate; @property (nonatomic, strong) UIFont *font; @property (nonatomic, strong) UIFont *highlightedFont; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, strong) UIColor *highlightedTextColor; @property (nonatomic, assign) CGFloat interitemSpacing; @property (nonatomic, assign) CGFloat fisheyeFactor; // 0...1; slight value recommended such as 0.0001 @property (nonatomic, assign, getter=isMaskDisabled) BOOL maskDisabled; @property (nonatomic, assign) IQAKPickerViewStyle pickerViewStyle; @property (nonatomic, assign, readonly) NSUInteger selectedItem; @property (nonatomic, assign, readonly) CGPoint contentOffset; - (void)reloadData; - (void)scrollToItem:(NSUInteger)item animated:(BOOL)animated; - (void)selectItem:(NSUInteger)item animated:(BOOL)animated; - (void)selectItem:(NSUInteger)item animated:(BOOL)animated notifySelection:(BOOL)notifySelection; @end
// SignIn.h: interface for the CSignIn class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_SIGNIN_H__931F8913_3E55_11D9_A17B_96836E6F0742__INCLUDED_) #define AFX_SIGNIN_H__931F8913_3E55_11D9_A17B_96836E6F0742__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __ATLMISC_H__ #error signin.h requires atlmisc.h #endif //__ATLMISC_H__ namespace NO5YAHOO { struct CYahooCookies { CString sY; // cookie Y CString sT; // cookie T // retorna a string Y=v=...; T=z=... CString MakeCookieString(void); CString MakeDhtmlString(void); }; struct IYahooChatSignInEvents { virtual void OnSignIn(CYahooCookies &cookies) = 0; virtual void OnSignInFailure(BOOL BadPw,BOOL BadId) = 0; // IHttpClientEvents virtual void OnDataRead(char *buf,int len){} // IEventSocket virtual void OnSockConnecting(void){} virtual void OnSockConnect(int error){} virtual void OnSockClose(int error){} virtual void OnSockError(int error){} virtual void OnSockConnectTimeout(void){} virtual void OnSockResolvingAddress(void){} virtual void OnSockAddressResolved(int error){} }; struct IYahooChatSignIn { // host = login.yahoo.com ( por exemplo ) virtual BOOL SignIn(SOCKADDR_IN &addr,LPCSTR host,LPCSTR name, LPCSTR pw) = 0; virtual BOOL SignIn(LPCSTR server,int port,LPCSTR host,LPCSTR name,LPCSTR pw) = 0; virtual BOOL IsBadID(void) const = 0; virtual BOOL IsBadPW(void) const = 0; }; BOOL SignInCreate(IYahooChatSignIn **ppSignIn,IYahooChatSignInEvents *pSink); void SignInDestroy(IYahooChatSignIn **ppSignIn); } // NO5YAHOO #endif // !defined(AFX_SIGNIN_H__931F8913_3E55_11D9_A17B_96836E6F0742__INCLUDED_)
// // RMFoundation.c // // Copyright (c) 2008-2009, Route-Me Contributors // 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 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. #import "RMFoundation.h" RMProjectedPoint RMScaleProjectedPointAboutPoint(RMProjectedPoint point, float factor, RMProjectedPoint pivot) { point.easting = (point.easting - pivot.easting) * factor + pivot.easting; point.northing = (point.northing - pivot.northing) * factor + pivot.northing; return point; } RMProjectedRect RMScaleProjectedRectAboutPoint (RMProjectedRect rect, float factor, RMProjectedPoint pivot) { rect.origin = RMScaleProjectedPointAboutPoint(rect.origin, factor, pivot); rect.size.width *= factor; rect.size.height *= factor; return rect; } RMProjectedPoint RMTranslateProjectedPointBy(RMProjectedPoint point, RMProjectedSize delta) { point.easting += delta.width; point.northing += delta.height; return point; } RMProjectedRect RMTranslateProjectedRectBy(RMProjectedRect rect, RMProjectedSize delta) { rect.origin = RMTranslateProjectedPointBy(rect.origin, delta); return rect; } RMProjectedPoint RMMakeProjectedPoint (double easting, double northing) { RMProjectedPoint point = { easting, northing }; return point; } RMProjectedRect RMMakeProjectedRect (double easting, double northing, double width, double height) { RMProjectedRect rect = { {easting, northing}, {width, height} }; return rect; }
/******************************************************************************* * Copyright (c) 2012, 2013 IBM Corp. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Ian Craggs - initial contribution * Ian Craggs - change delimiter option from char to string * Al Stockdill-Mander - Version using the embedded C client *******************************************************************************/ /* stdout subscriber compulsory parameters: topic to subscribe to defaulted parameters: --host localhost --port 1883 --qos 2 --delimiter \n --clientid stdout_subscriber --userid none --password none for example: stdoutsub topic/of/interest --host iot.eclipse.org */ #include <stdio.h> #include "MQTTClient.h" #include <stdio.h> #include <signal.h> #include <memory.h> #include <sys/time.h> volatile int toStop = 0; void usage() { printf("MQTT stdout subscriber\n"); printf("Usage: stdoutsub topicname <options>, where options are:\n"); printf(" --host <hostname> (default is localhost)\n"); printf(" --port <port> (default is 1883)\n"); printf(" --qos <qos> (default is 2)\n"); printf(" --delimiter <delim> (default is \\n)\n"); printf(" --clientid <clientid> (default is hostname+timestamp)\n"); printf(" --username none\n"); printf(" --password none\n"); printf(" --showtopics <on or off> (default is on if the topic has a wildcard, else off)\n"); exit(-1); } void cfinish(int sig) { signal(SIGINT, NULL); toStop = 1; } struct opts_struct { char* clientid; int nodelimiter; char* delimiter; enum QoS qos; char* username; char* password; char* host; int port; int showtopics; } opts = { (char*)"stdout-subscriber", 0, (char*)"\n", QOS2, NULL, NULL, (char*)"localhost", 1883, 0 }; void getopts(int argc, char** argv) { int count = 2; while (count < argc) { if (strcmp(argv[count], "--qos") == 0) { if (++count < argc) { if (strcmp(argv[count], "0") == 0) opts.qos = QOS0; else if (strcmp(argv[count], "1") == 0) opts.qos = QOS1; else if (strcmp(argv[count], "2") == 0) opts.qos = QOS2; else usage(); } else usage(); } else if (strcmp(argv[count], "--host") == 0) { if (++count < argc) opts.host = argv[count]; else usage(); } else if (strcmp(argv[count], "--port") == 0) { if (++count < argc) opts.port = atoi(argv[count]); else usage(); } else if (strcmp(argv[count], "--clientid") == 0) { if (++count < argc) opts.clientid = argv[count]; else usage(); } else if (strcmp(argv[count], "--username") == 0) { if (++count < argc) opts.username = argv[count]; else usage(); } else if (strcmp(argv[count], "--password") == 0) { if (++count < argc) opts.password = argv[count]; else usage(); } else if (strcmp(argv[count], "--delimiter") == 0) { if (++count < argc) opts.delimiter = argv[count]; else opts.nodelimiter = 1; } else if (strcmp(argv[count], "--showtopics") == 0) { if (++count < argc) { if (strcmp(argv[count], "on") == 0) opts.showtopics = 1; else if (strcmp(argv[count], "off") == 0) opts.showtopics = 0; else usage(); } else usage(); } count++; } } void messageArrived(MessageData* md) { MQTTMessage* message = md->message; if (opts.showtopics) printf("%.*s\t", md->topicName->lenstring.len, md->topicName->lenstring.data); if (opts.nodelimiter) printf("%.*s", (int)message->payloadlen, (char*)message->payload); else printf("%.*s%s", (int)message->payloadlen, (char*)message->payload, opts.delimiter); //fflush(stdout); } int main(int argc, char** argv) { int rc = 0; unsigned char buf[100]; unsigned char readbuf[100]; if (argc < 2) usage(); char* topic = argv[1]; if (strchr(topic, '#') || strchr(topic, '+')) opts.showtopics = 1; if (opts.showtopics) printf("topic is %s\n", topic); getopts(argc, argv); Network n; Client c; signal(SIGINT, cfinish); signal(SIGTERM, cfinish); NewNetwork(&n); ConnectNetwork(&n, opts.host, opts.port); MQTTClient(&c, &n, 1000, buf, 100, readbuf, 100); MQTTPacket_connectData data = MQTTPacket_connectData_initializer; data.willFlag = 0; data.MQTTVersion = 3; data.clientID.cstring = opts.clientid; data.username.cstring = opts.username; data.password.cstring = opts.password; data.keepAliveInterval = 10; data.cleansession = 1; printf("Connecting to %s %d\n", opts.host, opts.port); rc = MQTTConnect(&c, &data); printf("Connected %d\n", rc); printf("Subscribing to %s\n", topic); rc = MQTTSubscribe(&c, topic, opts.qos, messageArrived); printf("Subscribed %d\n", rc); while (!toStop) { MQTTYield(&c, 1000); } printf("Stopping\n"); MQTTDisconnect(&c); n.disconnect(&n); return 0; }
// -*- c++ -*- // Generated by gmmproc 2.44.0 -- DO NOT MODIFY! #ifndef _GTKMM_INVISIBLE_H #define _GTKMM_INVISIBLE_H #include <glibmm/ustring.h> #include <sigc++/sigc++.h> /* * Copyright (C) 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <gtkmm/widget.h> #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GtkInvisible GtkInvisible; typedef struct _GtkInvisibleClass GtkInvisibleClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class Invisible_Class; } // namespace Gtk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { /** This widget is used internally in GTK+, and is probably not useful for application developers. * It is used for reliable pointer grabs and selection handling in the code for drag-and-drop. * @ingroup Widgets */ class Invisible : public Widget { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef Invisible CppObjectType; typedef Invisible_Class CppClassType; typedef GtkInvisible BaseObjectType; typedef GtkInvisibleClass BaseClassType; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ virtual ~Invisible(); #ifndef DOXYGEN_SHOULD_SKIP_THIS private: friend class Invisible_Class; static CppClassType invisible_class_; // noncopyable Invisible(const Invisible&); Invisible& operator=(const Invisible&); protected: explicit Invisible(const Glib::ConstructParams& construct_params); explicit Invisible(GtkInvisible* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: /** Get the GType for this class, for use with the underlying GObject type system. */ static GType get_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_base_type() G_GNUC_CONST; #endif ///Provides access to the underlying C GtkObject. GtkInvisible* gobj() { return reinterpret_cast<GtkInvisible*>(gobject_); } ///Provides access to the underlying C GtkObject. const GtkInvisible* gobj() const { return reinterpret_cast<GtkInvisible*>(gobject_); } public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: private: public: Invisible(); explicit Invisible(const Glib::RefPtr<Gdk::Screen>& screen); /** Returns the Gdk::Screen object associated with @a invisible * * @newin{2,2} * * @return The associated Gdk::Screen. */ Glib::RefPtr<Gdk::Screen> get_screen(); /** Returns the Gdk::Screen object associated with @a invisible * * @newin{2,2} * * @return The associated Gdk::Screen. */ Glib::RefPtr<const Gdk::Screen> get_screen() const; /** Sets the Gdk::Screen where the Gtk::Invisible object will be displayed. * * @newin{2,2} * * @param screen A Gdk::Screen. */ void set_screen(const Glib::RefPtr<Gdk::Screen>& screen); /** The screen where this window will be displayed. * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::RefPtr<Gdk::Screen> > property_screen() ; /** The screen where this window will be displayed. * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Screen> > property_screen() const; }; } //namespace Gtk namespace Glib { /** A Glib::wrap() method for this object. * * @param object The C instance. * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. * @result A C++ instance that wraps this C instance. * * @relates Gtk::Invisible */ Gtk::Invisible* wrap(GtkInvisible* object, bool take_copy = false); } //namespace Glib #endif /* _GTKMM_INVISIBLE_H */
#import <UIKit/UIKit.h> FOUNDATION_EXPORT double Pods_JMapSDKiOSPod_TestsVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_JMapSDKiOSPod_TestsVersionString[];
// // RACAppDelegate.h // RACProgressSubject // // Created by Hai Feng Kao on 10/26/2016. // Copyright (c) 2016 Hai Feng Kao. All rights reserved. // @import UIKit; @interface RACAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#ifndef WatBackend_RouteFinder_h #define WatBackend_RouteFinder_h #import "Map.h" #import "Route.h" @interface RouteFinder : NSObject @property Map* map; - (RouteFinder*) initWithMap: (Map*) map; - (Route*) findRouteFrom: (Building*) build1 To:(Building*) build2; - (Route*) findRouteFromLoc: (Location*) loc1 To:(Location*) loc2; - (Route*) dijkstraFrom: (Location*) loc1 To:(Location*) loc2; - (NSArray*) getAdjacentLocations: (Location*) loc; @end #endif
// // PNTTestTimeResult.h // Pods // // Created by Jordan Zucker on 5/17/16. // // #import "PNTTestResult.h" @interface PNTTestTimeResult : PNTTestResult @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "CDStructures.h" @interface DVTCheapReusableSubstring : NSString { NSString *_realString; unsigned long long _realStringLength; struct _NSRange _subrange; unsigned long long _hashValue; BOOL _hashValueValid; } - (struct _NSRange)rangeOfCharacterFromSet:(id)arg1 options:(unsigned long long)arg2 range:(struct _NSRange)arg3; - (BOOL)isEqualToString:(id)arg1; - (void)getCharacters:(unsigned short *)arg1 range:(struct _NSRange)arg2; - (unsigned short)characterAtIndex:(unsigned long long)arg1; - (unsigned long long)length; - (unsigned long long)hash; - (void)setRealString:(id)arg1 subrange:(struct _NSRange)arg2; - (id)initWithRealString:(id)arg1 subrange:(struct _NSRange)arg2; @end
// // GIZUserInfoModel.h // Gizwits-HeatingApparatu // // Created by ChaoSo on 15/7/22. // Copyright (c) 2015年 ChaoSo. All rights reserved. // #import <Foundation/Foundation.h> @interface SURUserInfoModel : NSObject //登录后的token @property (strong,nonatomic ) NSString *token; //登录后的uid @property (strong,nonatomic ) NSString *uid; //登录的密码 @property (strong,nonatomic ) NSString *password; //登录的用户名 @property (strong,nonatomic ) NSString *username; -(instancetype)init:(NSString *)token WithUid:(NSString *)uid WithUserName:(NSString *)username WithPassword:(NSString *)password; @end
// Copyright (c) 2011-2015 The Stardust Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef STARDUST_QT_OPTIONSDIALOG_H #define STARDUST_QT_OPTIONSDIALOG_H #include <QDialog> #include <QValidator> class OptionsModel; class QValidatedLineEdit; QT_BEGIN_NAMESPACE class QDataWidgetMapper; QT_END_NAMESPACE namespace Ui { class OptionsDialog; } /** Proxy address widget validator, checks for a valid proxy address. */ class ProxyAddressValidator : public QValidator { Q_OBJECT public: explicit ProxyAddressValidator(QObject *parent); State validate(QString &input, int &pos) const; }; /** Preferences dialog. */ class OptionsDialog : public QDialog { Q_OBJECT public: explicit OptionsDialog(QWidget *parent, bool enableWallet); ~OptionsDialog(); void setModel(OptionsModel *model); void setMapper(); private Q_SLOTS: /* set OK button state (enabled / disabled) */ void setOkButtonState(bool fState); void on_resetButton_clicked(); void on_okButton_clicked(); void on_cancelButton_clicked(); void on_hideTrayIcon_stateChanged(int fState); void showRestartWarning(bool fPersistent = false); void clearStatusLabel(); void updateProxyValidationState(); /* query the networks, for which the default proxy is used */ void updateDefaultProxyNets(); Q_SIGNALS: void proxyIpChecks(QValidatedLineEdit *pUiProxyIp, int nProxyPort); private: Ui::OptionsDialog *ui; OptionsModel *model; QDataWidgetMapper *mapper; }; #endif // STARDUST_QT_OPTIONSDIALOG_H
// *** Hardwarespecific functions *** void UTFT::_hw_special_init() { } void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode) { switch (mode) { case 1: if (display_serial_mode==SERIAL_4PIN) { if (VH==1) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); } else { if (VH==1) sbi(P_RS, B_RS); else cbi(P_RS, B_RS); } if (VL & 0x80) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x40) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x20) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x10) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x08) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x04) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x02) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); if (VL & 0x01) sbi(P_SDA, B_SDA); else cbi(P_SDA, B_SDA); pulse_low(P_SCL, B_SCL); break; case 8: #if defined(CTE_DUE_SHIELD) || defined(EHOUSE_DUE_SHIELD) REG_PIOC_CODR=0xFF000; REG_PIOC_SODR=(VH<<12) & 0xFF000; pulse_low(P_WR, B_WR); REG_PIOC_CODR=0xFF000; REG_PIOC_SODR=(VL<<12) & 0xFF000; pulse_low(P_WR, B_WR); #else REG_PIOA_CODR=0x0000C000; REG_PIOD_CODR=0x0000064F; REG_PIOA_SODR=(VH & 0x06)<<13; (VH & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; REG_PIOD_SODR=((VH & 0x78)>>3) | ((VH & 0x80)>>1); pulse_low(P_WR, B_WR); REG_PIOA_CODR=0x0000C000; REG_PIOD_CODR=0x0000064F; REG_PIOA_SODR=(VL & 0x06)<<13; (VL & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; REG_PIOD_SODR=((VL & 0x78)>>3) | ((VL & 0x80)>>1); pulse_low(P_WR, B_WR); #endif break; case 16: #if defined(CTE_DUE_SHIELD) REG_PIOC_CODR=0xFF1FE; REG_PIOC_SODR=(VL<<1) & 0x1FE; REG_PIOC_SODR=(VH<<12) & 0xFF000; #elif defined(EHOUSE_DUE_SHIELD) REG_PIOC_CODR=0xFF3FC; REG_PIOC_SODR=(VL<<2) | (VH<<12); #else REG_PIOA_CODR=0x0000C080; REG_PIOC_CODR=0x0000003E; REG_PIOD_CODR=0x0000064F; REG_PIOA_SODR=((VH & 0x06)<<13) | ((VL & 0x40)<<1); (VH & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; REG_PIOC_SODR=((VL & 0x01)<<5) | ((VL & 0x02)<<3) | ((VL & 0x04)<<1) | ((VL & 0x08)>>1) | ((VL & 0x10)>>3); REG_PIOD_SODR=((VH & 0x78)>>3) | ((VH & 0x80)>>1) | ((VL & 0x20)<<5) | ((VL & 0x80)<<2); #endif pulse_low(P_WR, B_WR); break; case LATCHED_16: asm("nop"); // Mode is unsupported break; } } void UTFT::_set_direction_registers(byte mode) { if (mode!=LATCHED_16) { #if defined(CTE_DUE_SHIELD) if (mode==16) { REG_PIOC_OER=0x000FF1FE; } else REG_PIOC_OER=0x000FF000; #elif defined(EHOUSE_DUE_SHIELD) if (mode==16) { REG_PIOC_OER=0x000FF3FC; } else REG_PIOC_OER=0x000FF000; #else REG_PIOA_OER=0x0000c000; //PA14,PA15 enable REG_PIOB_OER=0x04000000; //PB26 enable REG_PIOD_OER=0x0000064f; //PD0-3,PD6,PD9-10 enable if (mode==16) { REG_PIOA_OER=0x00000080; //PA7 enable REG_PIOC_OER=0x0000003e; //PC1 - PC5 enable } #endif } else { asm("nop"); // Mode is unsupported } } void UTFT::_fast_fill_16(int ch, int cl, long pix) { long blocks; #if defined(CTE_DUE_SHIELD) REG_PIOC_CODR=0xFF1FE; REG_PIOC_SODR=(cl<<1) & 0x1FE; REG_PIOC_SODR=(ch<<12) & 0xFF000; #elif defined(EHOUSE_DUE_SHIELD) REG_PIOC_CODR=0xFF3FC; REG_PIOC_SODR=(cl<<2) | (ch<<12); #else REG_PIOA_CODR=0x0000C080; REG_PIOC_CODR=0x0000003E; REG_PIOD_CODR=0x0000064F; REG_PIOA_SODR=((ch & 0x06)<<13) | ((cl & 0x40)<<1); (ch & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; REG_PIOC_SODR=((cl & 0x01)<<5) | ((cl & 0x02)<<3) | ((cl & 0x04)<<1) | ((cl & 0x08)>>1) | ((cl & 0x10)>>3); REG_PIOD_SODR=((ch & 0x78)>>3) | ((ch & 0x80)>>1) | ((cl & 0x20)<<5) | ((cl & 0x80)<<2); #endif blocks = pix/16; for (int i=0; i<blocks; i++) { pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR); } if ((pix % 16) != 0) for (int i=0; i<(pix % 16)+1; i++) { pulse_low(P_WR, B_WR); } } void UTFT::_fast_fill_8(int ch, long pix) { long blocks; #if defined(CTE_DUE_SHIELD) || defined(EHOUSE_DUE_SHIELD) REG_PIOC_CODR=0xFF000; REG_PIOC_SODR=(ch<<12) & 0xFF000; #else REG_PIOA_CODR=0x0000C000; REG_PIOD_CODR=0x0000064F; REG_PIOA_SODR=(ch & 0x06)<<13; (ch & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; REG_PIOD_SODR=((ch & 0x78)>>3) | ((ch & 0x80)>>1); #endif blocks = pix/16; for (int i=0; i<blocks; i++) { pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); } if ((pix % 16) != 0) for (int i=0; i<(pix % 16)+1; i++) { pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR); } }
// // MoreViewController.h // WeiboProgressTwo // // Created by xiacheng on 16/8/3. // Copyright © 2016年 wuxianhulian. All rights reserved. // #import <UIKit/UIKit.h> @interface MoreViewController : UITableViewController @end
// Copyright mogemimi. Distributed under the MIT license. #pragma once namespace pomdog::AssetBuilders { template <typename T> class Builder; } // namespace pomdog::AssetBuilders
// Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT 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. #import <Foundation/Foundation.h> @interface ADAadAuthorityCacheRecord : NSObject @property BOOL validated; @property ADAuthenticationError *error; @property NSString *networkHost; @property NSString *cacheHost; @property NSArray<NSString *> *aliases; @end @interface ADAadAuthorityCache : NSObject { NSMutableDictionary<NSString *, ADAadAuthorityCacheRecord *> *_recordMap; pthread_rwlock_t _rwLock; } - (BOOL)processMetadata:(NSArray<NSDictionary *> *)metadata authority:(NSURL *)authority context:(id<ADRequestContext>)context error:(ADAuthenticationError * __autoreleasing *)error; - (void)addInvalidRecord:(NSURL *)authority oauthError:(ADAuthenticationError *)oauthError context:(id<ADRequestContext>)context; - (NSURL *)networkUrlForAuthority:(NSURL *)authority; - (NSURL *)cacheUrlForAuthority:(NSURL *)authority; /*! Returns an array of authority URLs for the provided URL, in the order that cache lookups should be attempted. @param authority The authority URL the developer provided for the authority context */ - (NSArray<NSURL *> *)cacheAliasesForAuthority:(NSURL *)authority; - (ADAadAuthorityCacheRecord *)tryCheckCache:(NSURL *)authority; - (ADAadAuthorityCacheRecord *)checkCache:(NSURL *)authority; @end
#pragma once #include <string> #include <vector> #include <torch/extension.h> using std::string; using std::vector; using torch::Tensor; vector<float> bounding_sphere(Tensor data_in, string method); Tensor normalize_points(Tensor data_in, float radius, vector<float> center); Tensor transform_points(Tensor data_in, vector<float> angle, vector<float> scale, vector<float> jitter, float offset, string normal_axis); vector<Tensor> clip_points(Tensor data_in, vector<float> bbmin, vector<float> bbmax); Tensor octree_batch(vector<Tensor> tensors_in); vector<Tensor> octree_samples(vector<string> names); Tensor octree_property(Tensor octree_in, string property, int depth); Tensor octree_set_property(Tensor octree_in, Tensor data_in, int depth); Tensor points2octree(Tensor points, int depth, int full_depth, bool node_dis, bool node_feature, bool split_label, bool adaptive, int adp_depth, float th_normal, float th_distance, bool extrapolate, bool save_pts, bool key2xyz); Tensor octree2col(Tensor data_in, Tensor octree, int depth, vector<int> kernel_size, int stride, bool nempty); Tensor col2octree(Tensor grad_in, Tensor octree, int depth, vector<int> kernel_size, int stride, bool nempty); Tensor octree_conv(Tensor data_in, Tensor weights, Tensor octree, int depth, int num_output, vector<int> kernel_size, int stride, bool nempty); Tensor octree_deconv(Tensor data_in, Tensor weights, Tensor octree, int depth, int num_output, vector<int> kernel_size, int stride, bool nempty); vector<Tensor> octree_conv_grad(Tensor data_in, Tensor weights, Tensor octree, Tensor grad_in, int depth, int num_output, vector<int> kernel_size, int stride, bool nempty); vector<Tensor> octree_deconv_grad(Tensor data_in, Tensor weights, Tensor octree, Tensor grad_in, int depth, int num_output, vector<int> kernel_size, int stride, bool nempty); Tensor octree_pad(Tensor data_in, Tensor octree, int depth, float val = 0.0f); Tensor octree_depad(Tensor data_in, Tensor octree, int depth); vector<Tensor> octree_max_pool(Tensor data_in, Tensor octree, int depth); Tensor octree_max_unpool(Tensor data_in, Tensor mask, Tensor octree, int depth); Tensor octree_mask_pool(Tensor data_in, Tensor mask, Tensor octree, int depth); Tensor octree_encode_key(Tensor xyz); Tensor octree_decode_key(Tensor key); Tensor octree_key2xyz(Tensor key, int depth); Tensor octree_xyz2key(Tensor xyz, int depth); Tensor octree_search_key(Tensor key, Tensor octree, int depth, bool key_is_xyz, bool nempty); Tensor octree_scan(Tensor octree, vector<float> axis, float scale); Tensor octree_grow(Tensor octree_in, int target_depth, bool full_octree); Tensor octree_update(Tensor octree_in, Tensor label_in, int depth, int split); Tensor octree_new(int batch_size, int channel, bool node_dis, int adaptive_layer); vector<Tensor> octree_align(Tensor src_data, Tensor src_octree, Tensor des_octree, int depth); Tensor octree_align_grad(Tensor des_grad, Tensor idx_tensor); Tensor points_new(Tensor pts, Tensor normals, Tensor features, Tensor labels); Tensor points_property(Tensor points, string property); Tensor points_batch_property(vector<Tensor> tensors_in, string property); Tensor points_set_property(Tensor points, Tensor data, string property);
#include "q_incs.h" #include "_mm_mul_simple_F4_F4_F4.h" static void print_2d( float **X, int nR, int nC ) { for ( int i = 0; i < nR; i++ ) { for ( int j = 0; j < nC; j++ ) { printf("%f \t", X[j][i]); } printf("\n"); } printf("\n"); } int main( ) { int status = 0; int M = 3; int K = 2; int N = 4; float **X = NULL; float **Y = NULL; float **Z = NULL; //---------------------------- X = malloc(K * sizeof(float *)); for ( int k = 0; k < K; k++ ) { X[k] = malloc(M * sizeof(float)); } for ( int k = 0; k < K; k++ ) { for ( int m = 0; m < M; m++ ) { X[k][m] = (k+1)*(m+1); } } //---------------------------- Y = malloc(N * sizeof(float *)); for ( int n = 0; n < N; n++ ) { Y[n] = malloc(K * sizeof(float)); } for ( int n = 0; n < N; n++ ) { for ( int k = 0; k < K; k++ ) { Y[n][k] = (n+1)*(k+1); } } //---------------------------- Z = malloc(N * sizeof(float *)); for ( int n = 0; n < N; n++ ) { Z[n] = malloc(M * sizeof(float)); } status = mm_mul_simple_F4_F4_F4(X, Y, Z, M, K, N); cBYE(status); print_2d(X, M, K); print_2d(Y, K, N); print_2d(Z, M, N); BYE: return status; }
// // TLDBMessageStore.h // TLChat // // Created by 李伯坤 on 16/3/13. // Copyright © 2016年 李伯坤. All rights reserved. // #import "TLDBBaseStore.h" #import "TLMessage.h" @interface TLDBMessageStore : TLDBBaseStore #pragma mark - 添加 /** * 添加消息记录 */ - (BOOL)addMessage:(TLMessage *)message; #pragma mark - 查询 /** * 获取与某个好友的聊天记录 */ - (void)messagesByUserID:(NSString *)userID partnerID:(NSString *)partnerID fromDate:(NSDate *)date count:(NSUInteger)count complete:(void (^)(NSArray *data, BOOL hasMore))complete; /** * 获取与某个好友/讨论组的聊天文件 */ - (NSArray *)chatFilesByUserID:(NSString *)userID partnerID:(NSString *)partnerID; /** * 最后一条聊天记录(消息页用) */ - (TLMessage *)lastMessageByUserID:(NSString *)userID partnerID:(NSString *)partnerID; #pragma mark - 删除 /** * 删除单条消息 */ - (BOOL)deleteMessageByMessageID:(NSString *)messageID; /** * 删除与某个好友/讨论组的所有聊天记录 */ - (BOOL)deleteMessagesByUserID:(NSString *)userID partnerID:(NSString *)partnerID; /** * 删除用户的所有聊天记录 */ - (BOOL)deleteMessagesByUserID:(NSString *)userID; @end
#ifndef RDMUTILS_H #define RDMUTILS_H #include "StdAfx.h" class RDMEnumDef; class RDMUtils { public: // convert RespStatus components to string static string streamStateToString(const rfa::common::RespStatus::StreamState& streamState); static string statusCodeToString(const rfa::common::UInt8 statusCode); static string dataStateToString(const rfa::common::RespStatus::DataState& dataState); // converts databuffer contents to a string static string dataBufferToString(const rfa::data::DataBuffer& dataBuffer, const RDMEnumDef* enumDef=0); // converts databuffer contents to a string with no RMTES conversion (e.g. for TS1 data) static string dataBufferToStringNoCoversion(const rfa::data::DataBuffer& dataBuffer); // converts databuffer contents to a double static double dataBufferToDouble(const rfa::data::DataBuffer& dataBuffer); // converts databuffer contents to a int static int dataBufferToInt(const rfa::data::DataBuffer& dataBuffer); // converts databuffer contents to a long static long dataBufferToLong(const rfa::data::DataBuffer& dataBuffer); // convert message model type to string static string msgModelTypeToString(rfa::common::UInt16 msgType); // converts response type to string static string msgRespTypeToString(rfa::common::UInt32 respType); private: RDMUtils(void); RDMUtils(RDMUtils&); }; #endif
// // NCDBInvGroup.h // Neocom // // Created by Artem Shimanski on 16.02.16. // Copyright © 2016 Shimanski Artem. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @class NCDBCertCertificate, NCDBEveIcon, NCDBInvCategory, NCDBInvType, NCDBNpcGroup; NS_ASSUME_NONNULL_BEGIN @interface NCDBInvGroup : NSManagedObject // Insert code here to declare functionality of your managed object subclass @end NS_ASSUME_NONNULL_END #import "NCDBInvGroup+CoreDataProperties.h"
// Copyright (c) 2014-2015 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef INFINITUM_COMPAT_ENDIAN_H #define INFINITUM_COMPAT_ENDIAN_H #if defined(HAVE_CONFIG_H) #include "config/infinitum-config.h" #endif #include <stdint.h> #include "compat/byteswap.h" #if defined(HAVE_ENDIAN_H) #include <endian.h> #elif defined(HAVE_SYS_ENDIAN_H) #include <sys/endian.h> #endif #if defined(WORDS_BIGENDIAN) #if HAVE_DECL_HTOBE16 == 0 inline uint16_t htobe16(uint16_t host_16bits) { return host_16bits; } #endif // HAVE_DECL_HTOBE16 #if HAVE_DECL_HTOLE16 == 0 inline uint16_t htole16(uint16_t host_16bits) { return bswap_16(host_16bits); } #endif // HAVE_DECL_HTOLE16 #if HAVE_DECL_BE16TOH == 0 inline uint16_t be16toh(uint16_t big_endian_16bits) { return big_endian_16bits; } #endif // HAVE_DECL_BE16TOH #if HAVE_DECL_LE16TOH == 0 inline uint16_t le16toh(uint16_t little_endian_16bits) { return bswap_16(little_endian_16bits); } #endif // HAVE_DECL_LE16TOH #if HAVE_DECL_HTOBE32 == 0 inline uint32_t htobe32(uint32_t host_32bits) { return host_32bits; } #endif // HAVE_DECL_HTOBE32 #if HAVE_DECL_HTOLE32 == 0 inline uint32_t htole32(uint32_t host_32bits) { return bswap_32(host_32bits); } #endif // HAVE_DECL_HTOLE32 #if HAVE_DECL_BE32TOH == 0 inline uint32_t be32toh(uint32_t big_endian_32bits) { return big_endian_32bits; } #endif // HAVE_DECL_BE32TOH #if HAVE_DECL_LE32TOH == 0 inline uint32_t le32toh(uint32_t little_endian_32bits) { return bswap_32(little_endian_32bits); } #endif // HAVE_DECL_LE32TOH #if HAVE_DECL_HTOBE64 == 0 inline uint64_t htobe64(uint64_t host_64bits) { return host_64bits; } #endif // HAVE_DECL_HTOBE64 #if HAVE_DECL_HTOLE64 == 0 inline uint64_t htole64(uint64_t host_64bits) { return bswap_64(host_64bits); } #endif // HAVE_DECL_HTOLE64 #if HAVE_DECL_BE64TOH == 0 inline uint64_t be64toh(uint64_t big_endian_64bits) { return big_endian_64bits; } #endif // HAVE_DECL_BE64TOH #if HAVE_DECL_LE64TOH == 0 inline uint64_t le64toh(uint64_t little_endian_64bits) { return bswap_64(little_endian_64bits); } #endif // HAVE_DECL_LE64TOH #else // WORDS_BIGENDIAN #if HAVE_DECL_HTOBE16 == 0 inline uint16_t htobe16(uint16_t host_16bits) { return bswap_16(host_16bits); } #endif // HAVE_DECL_HTOBE16 #if HAVE_DECL_HTOLE16 == 0 inline uint16_t htole16(uint16_t host_16bits) { return host_16bits; } #endif // HAVE_DECL_HTOLE16 #if HAVE_DECL_BE16TOH == 0 inline uint16_t be16toh(uint16_t big_endian_16bits) { return bswap_16(big_endian_16bits); } #endif // HAVE_DECL_BE16TOH #if HAVE_DECL_LE16TOH == 0 inline uint16_t le16toh(uint16_t little_endian_16bits) { return little_endian_16bits; } #endif // HAVE_DECL_LE16TOH #if HAVE_DECL_HTOBE32 == 0 inline uint32_t htobe32(uint32_t host_32bits) { return bswap_32(host_32bits); } #endif // HAVE_DECL_HTOBE32 #if HAVE_DECL_HTOLE32 == 0 inline uint32_t htole32(uint32_t host_32bits) { return host_32bits; } #endif // HAVE_DECL_HTOLE32 #if HAVE_DECL_BE32TOH == 0 inline uint32_t be32toh(uint32_t big_endian_32bits) { return bswap_32(big_endian_32bits); } #endif // HAVE_DECL_BE32TOH #if HAVE_DECL_LE32TOH == 0 inline uint32_t le32toh(uint32_t little_endian_32bits) { return little_endian_32bits; } #endif // HAVE_DECL_LE32TOH #if HAVE_DECL_HTOBE64 == 0 inline uint64_t htobe64(uint64_t host_64bits) { return bswap_64(host_64bits); } #endif // HAVE_DECL_HTOBE64 #if HAVE_DECL_HTOLE64 == 0 inline uint64_t htole64(uint64_t host_64bits) { return host_64bits; } #endif // HAVE_DECL_HTOLE64 #if HAVE_DECL_BE64TOH == 0 inline uint64_t be64toh(uint64_t big_endian_64bits) { return bswap_64(big_endian_64bits); } #endif // HAVE_DECL_BE64TOH #if HAVE_DECL_LE64TOH == 0 inline uint64_t le64toh(uint64_t little_endian_64bits) { return little_endian_64bits; } #endif // HAVE_DECL_LE64TOH #endif // WORDS_BIGENDIAN #endif // INFINITUM_COMPAT_ENDIAN_H
// // BPDemoViewController.h // Demo // // Created by Brian Partridge on 4/9/13. // Copyright (c) 2013 Brian Partridge. All rights reserved. // #import <UIKit/UIKit.h> @interface BPDemoViewController : UIViewController - (IBAction)messageTapped:(id)sender; - (IBAction)indetermianteTapped:(id)sender; - (IBAction)dismissTapped:(id)sender; - (IBAction)successTapped:(id)sender; - (IBAction)errorTapped:(id)sender; @end
// // TestsSTWorkflowTests.h // TestsSTWorkflowTests // // Created by Thomas Dupont on 02/08/13. // Copyright (c) 2013 iSofTom. All rights reserved. // #import <SenTestingKit/SenTestingKit.h> @interface TestsSTWorkflowTests : SenTestCase @end
#import <UIKit/UIKit.h> FOUNDATION_EXPORT double Pods_SamplePodTest_ExampleVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_SamplePodTest_ExampleVersionString[];
/** * @author Goclis Yao * @email goclisyyh@gmail.com */ #pragma once #include <string> #include <iostream> #include "MccPublicType.h" class MccIdentifier; using std::string; using std::cout; using std::endl; /** * @brief Base class for declaration. */ class MccDeclaration { public: MccDeclaration( TYPE_SPEC type_spec, MccIdentifier *identifier); virtual ~MccDeclaration(void); /** * @brief Generate code for this declaration. * * @return If the declaration push elements into stack when generates code, * return the stack space it used, otherwise return 0. */ virtual int generate_code(); virtual void semantic_detect(); string get_decl_name() const; TYPE_SPEC get_type_spec() const; void set_lineno(int lineno); int get_lineno() const; protected: MccIdentifier *m_identifier; TYPE_SPEC m_type_spec; int m_lineno; };
/* Copyright (c) 2010 David Petrie david@davidpetrie.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef PERFORMANCE_CONTROLLER_H #define PERFORMANCE_CONTROLLER_H #include <OpenGLES/ES1/gl.h> #include <OpenGLES/ES1/glext.h> #include "FTGL/ftgles.h" /** * Goal: full screen of 10pt characters at 30+ fps */ class PerformanceController { public: PerformanceController(const char* path, float width, float height, float scale); ~PerformanceController(); void SetFPS(const unsigned int fps); void Draw(); void DrawNonLayoutText(const float shade, const float yLoc); void DrawLayoutText(FTSimpleLayout *layout, const float shade, const float yLoc); }; #endif
import stream from "../deps/stream/stream.module.c"; import item from "./item.module.c"; import buffer from "./buffer.module.c"; export { #include <stdlib.h> #include <stdbool.h> } #include <string.h> #include <stdarg.h> #include <stdio.h> export struct lexer_s; export typedef void * (*state_fn)(struct lexer_s * lex); export typedef struct lexer_s{ stream.t * in; char * input; char * filename; size_t length; size_t start; size_t pos; size_t width; size_t line; size_t line_pos; buffer.t * items; state_fn state; } lexer_t as t; static char * substring(const char * input, size_t start, size_t end); static void count_newlines(lexer_t * lex); export lexer_t * new(state_fn start, stream.t * in, const char * filename) { lexer_t * lex = calloc(1, sizeof(lexer_t)); lex->in = in; lex->filename = strdup(filename); lex->input = NULL; lex->length = 0; lex->items = buffer.new(2); lex->state = start; lex->line = 0; return lex; } export state_fn errorf(lexer_t * lex, const char * fmt, ...) { va_list args; va_start(args, fmt); char * message = NULL; vasprintf(&message, fmt, args); item.t error = item.new(message, item_error, lex->line, lex->line_pos, lex->pos); lex->items = buffer.push(lex->items, error); va_end(args); return NULL; } export char next(lexer_t * lex) { if (lex->pos + 1 > lex->length) { if (lex->in->error.code != 0) { errorf(lex, "Error reading input: %s", lex->in->error.message); return 0; } size_t next_length = lex->length + 4096 + 1; lex->input = realloc(lex->input, next_length); ssize_t len = stream.read(lex->in, lex->input + lex->length, 4096); if (len < 0) { errorf(lex, "Error reading input: %s", lex->in->error.message); return 0; } if (len == 0) return 0; lex->length += len; lex->input[lex->length] = 0; } lex->width = 1; return lex->input[lex->pos++]; } export void backup(lexer_t * lex) { lex->pos -= lex->width; } export char peek(lexer_t * lex) { char c = next(lex); backup(lex); return c; } export bool accept(lexer_t * lex, const char * matching) { char t = next(lex); const char * c = matching; while (*c != '\0') { if (t == *c) return true; c++; } return false; } export void accept_run(lexer_t * lex, const char * matching) { while (accept(lex, matching)); backup(lex); } export void ignore(lexer_t * lex) { lex->start = lex->pos; } export void emit(lexer_t * lex, enum item.type it) { count_newlines(lex); item.t i = item.new ( substring(lex->input, lex->start, lex->pos), it, lex->line, lex->line_pos, lex->start ); lex->items = buffer.push(lex->items, i); lex->start = lex->pos; } export item.t next_item(lexer_t * lex) { while(lex->items->length == 0 && lex->state != NULL) { lex->state = (state_fn) lex->state(lex); } return buffer.next(lex->items); } export void free(lexer_t * lex) { stream.close(lex->in); buffer.free(lex->items); global.free(lex->filename); global.free(lex->input); global.free(lex); } static char * substring(const char * input, size_t start, size_t end) { return strndup(input + start, end - start); } static void count_newlines(lexer_t * lex) { size_t i; for (i = lex->start; i < lex->pos; i++) { if (lex->input[i] == '\n') { lex->line++; lex->line_pos = i+1; } } }
// // SplashScreenViewController.h // Start-App // // Created by Jörg Polakowski on 24/03/13. // Copyright (c) 2013 mCRUMBS GmbH. All rights reserved. // #import <UIKit/UIKit.h> typedef void(^SplashScreenCustomBlockType)(void); @interface SplashScreenViewController : UIViewController @property(weak) IBOutlet UIImageView *imageView; @property(weak) IBOutlet UIImageView *animatedImageView; @property(strong) SplashScreenCustomBlockType callbackBlock; - (id)initWithCallbackBlock:(void (^)())block; @end
// // BXAppDelegate.h // BXUIKit // // Created by baxiang on 06/12/2017. // Copyright (c) 2017 baxiang. All rights reserved. // @import UIKit; @interface BXAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // PXAboutPanel.h // Pixen-XCode // Copyright (c) 2003,2004,2005 Open Sword Group // 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 Andy Matuschak on Sun Aug 01 2004. // Copyright (c) 2004 Open Sword Group. All rights reserved. // #import <AppKit/NSPanel.h> @interface PXAboutPanel : NSPanel { } @end
// Copyright (c) 2015 The Drivercoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_ZMQ_ZMQCONFIG_H #define BITCOIN_ZMQ_ZMQCONFIG_H #if defined(HAVE_CONFIG_H) #include "config/drivercoin-config.h" #endif #include <stdarg.h> #include <string> #if ENABLE_ZMQ #include <zmq.h> #endif #include "primitives/block.h" #include "primitives/transaction.h" void zmqError(const char *str); #endif // BITCOIN_ZMQ_ZMQCONFIG_H
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/ /* NetHack 3.7 cursmesg.h */ /* Copyright (c) Karl Garrison, 2010. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef CURSMESG_H # define CURSMESG_H /* Global declarations */ void curses_message_win_puts(const char *message, boolean recursed); void curses_got_input(void); int curses_block(boolean require_tab); int curses_more(void); void curses_clear_unhighlight_message_window(void); void curses_message_win_getline(const char *prompt, char *answer, int buffer); void curses_last_messages(void); void curses_init_mesg_history(void); void curses_prev_mesg(void); void curses_count_window(const char *count_text); char *curses_getmsghistory(boolean); void curses_putmsghistory(const char *, boolean); #endif /* CURSMESG_H */
#pragma once #include "GamePiece.h" class Player { private: GamePiece piece[40]; int displayColor; public: Player(); Player(const Player &); ~Player(); void init(int); Player & operator = (const Player &); GamePiece * getGamePiece(int); void setGamePiece(int, GamePiece *); int getColor(); void setColor(int); };
// // ViewController.h // CocoapodsLibrary // // Created by zac on 2017/12/11. // Copyright © 2017年 love_iphone@qq.com. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
/* Copyright (c) 2014 North American Bancard, LLC - All Rights Reserved. * * This software and documentation is subject to and made * available only pursuant to the terms of an executed license * agreement, and may be used only in accordance with the terms * of said agreement. This software may not, in whole or in part, * be copied, photocopied, reproduced, translated, or reduced to * any electronic medium or machine-readable form without * prior consent, in writing, from North American Bancard * * Use, duplication or disclosure by the U.S. Government is subject * to restrictions set forth in an executed license agreement * and in subparagraph (c)(1) of the Commercial Computer * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph * (c)(1)(ii) of the Rights in Technical Data and Computer Software * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial * Computer Software--Licensing clause at NASA FAR supplement * 16-52.227-86; or their equivalent. * * Information in this software is subject to change without notice * and does not represent a commitment on the part of North American Bancard, LLC. * * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of * the software company to properly integrate into their solution code that best meets their production needs. */ // Created by Zebulon Bowles on 7/9/14. // // CWSDifferenceData.h // #import <Foundation/Foundation.h> @interface CWSDifferenceData : NSObject { } @property (nonatomic, strong) NSString *transactionID; @property (nonatomic, strong) NSNumber *amount; @property (nonatomic, strong) NSNumber *tipAmount; @property (nonatomic, strong) NSDate *shipDate; @property (nonatomic, strong) NSString *chargeType; @property (nonatomic, strong) NSArray *creds; @end
#ifdef _MSC_VER #pragma once #else _Pragma("once") #endif #include "inc.h" NS_BEGIN(elloop) NS_BEGIN(trailing_return_type) // review following sum definition in decltype namespace. // its drawback is that you must call this function with a third param which // should be exactly the same type of (t1 + t2). template<typename T1, typename T2> void sum(const T1 & t1, const T2 & t2, decltype(t1 + t2) & sum) { return (t1 + t2); } // this won't work, because t1 and t2 (int decltype(t1+t2)) // are unknown symbols before parse params list. // // template<typename T1, typename T2> // decltype(t1 + t2) sum2(const T1& t1, const T2 & t2) { // error: use of undeclared identifier 't1', 't2' // return t1 + t2; // } template <typename T1, typename T2> auto sum(const T1 & t1, const T2 & t2) -> decltype(t1 + t2) { return (t1 + t2); } // this feature can also used with : // 1. normal function(pointer), function template, function reference definition/declaration. // 2. member function of struct or class, class template member function and so on. //---------------------- examples ---------------------- // 1. normal function auto foo() -> int { return 1; } auto foo2() -> void {} // function pointer //a complex function definition. // pf() defines a function, whose // return type A is a function ptr pA( pA = B (*pA)() ), // pA points to a type B, which is still a function ptr ( B = int (*)() ). int(*(*pf())())() { return nullptr; } // same with: auto pf1() -> auto (*)() -> int(*)() { return nullptr; } // pf and pf1 are function type, // compare with following codes, // which define a function pointer type ptr_ptr_func_t. // ptr_ptr_func_t type is the same type with &pf or &pf1. typedef int(*(*ptr_ptr_func_t)())(); // tricks: // ´Ó±äÁ¿x¿ªÊ¼¿´£¬ÏÈÍùÓÒ¿´ÓÐûÓУ¨À¨ºÅ£¬ÓУ¬ÄÇôxÊÇÒ»¸öº¯Êý¶¨Ò壻 // ·ñÔò£¬ÓÒ±ßÊÇ£©À¨ºÅ£¬Íù×ó¿´¿´µ½*£¬ÄÇôËüÊÇÒ»¸öº¯ÊýÖ¸Õ붨Ò壻 // 2. member function. class A { public: auto foo() -> int { return data_; } private: int data_{ 10 }; }; template<typename T> class IntWrapper { public: IntWrapper(int * ptr); IntWrapper(const IntWrapper & other) = delete; IntWrapper& operator= (const IntWrapper & other) = delete; auto data() -> T { assert(ptr_ != nullptr); return *ptr_; } ~IntWrapper(); auto ptr()->const T*; private: T* ptr_; }; template<typename T> IntWrapper<T>::IntWrapper(int * ptr) : ptr_(ptr) { } template<typename T> IntWrapper<T>::~IntWrapper() { if (ptr_) { delete ptr_; ptr_ = nullptr; } } template<typename T> auto IntWrapper<T>::ptr() -> const T*{ return ptr_; } NS_END(trailing_return_type) NS_END(elloop)
// // XCFRecipeCreateController.h // XCFApp // // Created by callmejoejoe on 16/4/17. // Copyright © 2016年 Joey. All rights reserved. // #import <UIKit/UIKit.h> @interface XCFRecipeCreateController : UIViewController @end
#include<stdio.h> #define tamanho 10 void main(){ int A[tamanho], B[tamanho]; for(int i=0; i<tamanho; i++){ printf("Informe o valor da posicao %d: ",i+1); scanf("%d", &A[i]); if(A[i] > 0){ B[i] = A[i]; }else{ B[i] = 0; } } printf("Vetor A\t\tVetor B\n"); for(int i=0; i<tamanho; i++){ printf("%d\t\t%d\n", A[i], B[i]); } }
// // FSViewController.h // FlipSnapLibrary // // Created by Rob Newport on 7/25/17. // Copyright © 2017 Whisteo. All rights reserved. // #import <UIKit/UIKit.h> @interface FSCamViewController : UIViewController // User Interface Objects //@property(nonatomic, strong) IBOutlet UISlider *toleranceSlider; @property(nonatomic, strong) IBOutlet UIView *swatch; // User Interface Actions //-(IBAction)sliderTolerance:(id)sender; -(IBAction)resetColors:(id)sender; // Status and Descriptions @property(assign) BOOL recording; @property(nonatomic, readonly, getter=framerate) float framerate; // Algorithm Management -(void)loadAlgorithm:(NSString *)algorithmString; -(NSString *)algorithmDescription; -(NSString *)algorithmName; -(NSString *)algorithmExpiration; -(void)setBlendmode:(float)mode; -(void)setSaturation:(float)amount; // Video Management -(void)extractVideoURL:(NSURL *)url withCompletion:(void(^)(void))doneImporting; -(void)extractVideoURL:(NSURL *)url forSize:(CGSize)size withCompletion:(void(^)(void))doneImporting; -(void)extractPictureURL:(NSURL *)url; -(void)clearTempDirectory; -(void)recordingStoppedForMovieAtURL:(NSURL *)url; -(void)invertBackground:(bool)invert; -(void)startRecording; -(void)stopRecording; -(void)frontCameraWithCompletion:(void(^)(void))doneSwitching; -(void)backCameraWithCompletion:(void(^)(void))doneSwitching; -(void)frontDepthCameraWithCompletion:(void(^)(void))doneSwitching; -(void)backDepthCameraWithCompletion:(void(^)(void))doneSwitching; -(void)rotateBackgroundWithCompletion:(void(^)(void))doneRotating; -(void)startPictureWithCompletion:(void(^)(UIImage *))imageTaken; -(void)depthOn:(BOOL)isOn; -(void)depthFiltered:(BOOL)isFiltered; -(void)toleranceSettingForHue:(float)hue saturation:(float)saturation vibrance:(float)vibrance; @property(nonatomic, retain) NSString *videoSessionPreset; @property(assign) int maximumFramesImported; @end
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <TextInput/TIKeyEventMapChinese.h> @interface TIKeyEventMapWubi : TIKeyEventMapChinese { } + (_Bool)supportsSecureCoding; - (id)remapKeyWithString:(id)arg1 stringWithoutModifiers:(id)arg2 modifierFlags:(unsigned long long)arg3 keyboardState:(id)arg4; - (_Bool)isNumericWubi:(id)arg1; - (id)wubiFromASCII:(id)arg1; @end
#pragma once #include "ofMain.h" #include "ofxBleSensorTag.h" #define HISTORY_MAX 10000 struct timedDouble{ uint64_t elapsedTime; double value; }; class dataHistory{ public: double current, max, min; bool started; uint64_t currentTimeMicros; // deque<double> value_history; // deque<uint64_t> time_history; deque<timedDouble> value_history; dataHistory(){ value_history.resize(0); current = max = min = 0.0; started = false; } void setCurrent(double value){ started = true; current = value; if(max < value){ max = value; } if(min > value){ min = value; } timedDouble tb; tb.elapsedTime = ofGetElapsedTimeMicros(); currentTimeMicros = tb.elapsedTime; tb.value = value; value_history.push_front(tb); while( value_history.size() > HISTORY_MAX ){ value_history.pop_back(); } } }; class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); void exit() { ble.disconnect(); } private: ofxBleSensorTag ble; bool bStartScan; vector<string> uuids; map<string,dataHistory> history; int nTag; double lux[16]; double max_lux[16]; float timeLastBeated; float timeLastScanned; };
/* MIT License Copyright (c) 2014-2017 Błażej Szczygieł 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 "Wrapper.h" #ifdef WIN32 #include <windows.h> #include <mmsystem.h> #else typedef void TIMECAPS; #endif REALIGN STDCALL uint32_t timeBeginPeriod_wrap(uint32_t period) { #ifdef WIN32 return timeBeginPeriod(period); #else return 0; #endif } REALIGN STDCALL uint32_t timeEndPeriod_wrap(uint32_t period) { #ifdef WIN32 return timeEndPeriod(period); #else return 0; #endif } REALIGN STDCALL uint32_t timeGetDevCaps_wrap(TIMECAPS *tc, uint32_t cbtc) { #ifdef WIN32 return timeGetDevCaps(tc, cbtc); #else return 0; #endif }
// // CardGameViewController.h // Matchismo // // Created by Toni on 14/07/15. // Copyright (c) 2015 Toni@Ironhack. All rights reserved. // #import <UIKit/UIKit.h> #import "Deck.h" @interface CardGameViewController : UIViewController - (Deck *)createDeck; // abstract - (NSAttributedString *)descriptionForCard:(Card *)card; // abstract - (NSAttributedString *)titleForCard:(Card *)card; // abstract - (UIImage *)backgroundImageForCard:(Card *)card; // abstract @end
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import "NSObject.h" @protocol NSInspectorBarItemController <NSObject> - (id)viewForInspectorBarItem:(id)arg1; @end
/* * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * Israel Lot <me@israellot.com> and Jeroen Domburg <jeroen@spritesmods.com> * wrote this file. As long as you retain this notice you can do whatever you * want with this stuff. If we meet some day, and you think this stuff is * worth it, you can buy us a beer in return. * ---------------------------------------------------------------------------- */ #ifndef __HTTP_WS_SERVER_H #define __HTTP_WS_SERVER_H typedef struct { //Listening connection data struct espconn server_conn; esp_tcp server_tcp; const char * host_domain; int port; } http_ws_config; void ICACHE_FLASH_ATTR http_ws_push_bin(http_connection *c,char *msg,size_t msgLen); void ICACHE_FLASH_ATTR http_ws_push_text(http_connection *c,char *msg,size_t msgLen); void ICACHE_FLASH_ATTR http_ws_server_init(); void ICACHE_FLASH_ATTR http_ws_server_start(); #endif
// // MouseMemoryAppDelegate.h // MouseMemory // // Created by Adam Tomeček on 7/3/11. // Copyright 2011 OwnSoft. All rights reserved. // #import <Cocoa/Cocoa.h> @interface MouseMemoryAppDelegate : NSObject <NSApplicationDelegate> { NSWindow *window; NSWindow *about; IBOutlet NSMenu *statusMenu; NSStatusItem *statusItem; IBOutlet NSSlider *slider; IBOutlet NSTextField *text; IBOutlet NSMenu *menuProfiles; IBOutlet NSMenu *menuProfilesDelete; NSMutableDictionary *profiles; io_connect_t HIDSystem; } @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet NSWindow *about; @property (nonatomic, retain) IBOutlet NSSlider *slider; @property (nonatomic, retain) IBOutlet NSTextField *text; @property (nonatomic, retain) IBOutlet NSMenu *menuProfiles; @property (nonatomic, retain) IBOutlet NSMenu *menuProfilesDelete; - (IBAction)createProfile:(id)sender; - (IBAction)quit:(id)sender; - (IBAction)openWindow:(id)sender; - (IBAction)openAbout:(id)sender; - (IBAction)testMouseSpeed:(id)sender; - (void)mouseSpeed:(float)value; @end
/* * File: Utils.h * Author: tiepologian <tiepolo.gian@gmail.com> * * Created on 17 maggio 2014, 18.54 */ #ifndef UTILS_H #define UTILS_H #include <iostream> #include <string> #include <sys/types.h> #include <unistd.h> #include <fstream> #include <ostream> #include <algorithm> #include <functional> #include <cctype> #include <locale> #include <vector> #include <iomanip> #include <iterator> #include <sstream> #include <exception> #include <unordered_set> #include <regex> #include <boost/lexical_cast.hpp> #include <boost/algorithm/string.hpp> #define TRISDB_VERSION "1.1.0" #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) #if defined __clang__ #define COMPILER "CLANG " __clang_version__ #elif defined __GNUC__ #define COMPILER "GCC " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) #else #define COMPILER "UNKNOWN COMPILER" #endif #ifndef DEBUG #define TRISDB_VERSION_STR "TrisDB " TRISDB_VERSION " (" COMPILER ")" #else #define TRISDB_VERSION_STR "TrisDB " TRISDB_VERSION " (DEBUG)" " (" COMPILER ")" #endif namespace Utils { typedef std::tuple<std::string, std::string, std::string> record; typedef std::vector<record> ResultVector; static const std::string kQueryWildcard = "***"; static const int kQueryLimitWildcard = 0; static const std::unordered_set<std::string> ValidCommands{"CREATE", "GET", "GETS", "GETP", "GETO", "DELETE", "CLEAR", "COUNT", "STATUS", "QUIT", "SAVE"}; template<typename T> std::string toString(T t) { return boost::lexical_cast<std::string>(t); } static inline std::string &rtrim(std::string &s) { s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end()); return s; } static void split(const std::string& str, std::vector<std::string>& v) { std::stringstream ss(str); ss >> std::noskipws; std::string field; char ws_delim; while (1) { if (ss >> field) v.push_back(field); else if (ss.eof()) break; else v.push_back(std::string()); ss.clear(); ss >> ws_delim; } } inline void printAsciiLogo() { std::cout << " _____ _ ____ ____ " << std::endl; std::cout << "|_ _| __(_)___ | _ \\| __ ) " << std::endl; std::cout << " | || '__| / __| | | | | _ \\ " << " " << TRISDB_VERSION_STR << std::endl; std::cout << " | || | | \\__ \\ | |_| | |_) |" << " PID: " << getpid() << std::endl; std::cout << " |_||_| |_|___/ |____/|____/ " << std::endl; std::cout << std::endl; } inline void process_mem_usage(double& vm_usage, double& resident_set) { using std::ios_base; using std::ifstream; using std::string; vm_usage = 0.0; resident_set = 0.0; // 'file' stat seems to give the most reliable results // ifstream stat_stream("/proc/self/stat", ios_base::in); // dummy vars for leading entries in stat that we don't care about // string pid, comm, state, ppid, pgrp, session, tty_nr; string tpgid, flags, minflt, cminflt, majflt, cmajflt; string utime, stime, cutime, cstime, priority, nice; string O, itrealvalue, starttime; // the two fields we want // unsigned long vsize; long rss; stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt >> utime >> stime >> cutime >> cstime >> priority >> nice >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest stat_stream.close(); long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages vm_usage = vsize / 1024.0; resident_set = rss * page_size_kb; } class CustomException : std::exception { public: virtual const char* what() const throw () { return "Syntax Error in command!"; } }; } #endif /* UTILS_H */
// // AppDelegate.h // alfred // // Created by Sebastian Axelsen on 04/12/15. // Copyright © 2015 TeamYAY. 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
// // BEAlertPresenter.h // AlertViewExamples // // Created by chanhyuk on 2016. 5. 2.. // Copyright © 2016년 Mangofever. All rights reserved. // #import <Foundation/Foundation.h> @class BEAlertViewBuilder; @interface BEAlertPresenter : NSObject @property (nonatomic, weak) BEAlertViewBuilder *builder; - (void)show; @end
%% %% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5 %% %% Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com> %% $project=Qt5xHb $module=QtWidgets $header $includes $beginSlotsClass $signal=|changed( const QList<QRectF> & region ) $signal=|sceneRectChanged( const QRectF & rect ) $signal=|selectionChanged() $endSlotsClass
// // SocializeSubscription.h // SocializeSDK // // Created by Nathaniel Griswold on 12/14/11. // Copyright (c) 2011 Socialize, Inc. All rights reserved. // #import "SocializeObject.h" #import "SocializeEntity.h" #import "SocializeUser.h" /** Protocol for socialize entity representation. */ @protocol SocializeSubscription <SocializeObject> @required /**@name Entity*/ /** Get <SocializeEntity>. */ -(id<SocializeEntity>)entity; /** Set entity object. @param entity <SocializeEntity> for activity. */ -(void)setEntity:(id<SocializeEntity>)entity; /**@name Subscribed*/ /** Get subscribed (YES or NO). */ -(BOOL)subscribed; /** Set subscribed state @param subscribed whether or not the subscription is active */ -(void)setSubscribed:(BOOL)subscribed; /**@name User*/ /** Get <SocializeUser>. */ -(id<SocializeUser>)user; /** Set <SocializeUser>. @param user Socialize user object. */ -(void)setUser:(id<SocializeUser>)user; /** Get date of subscription */ -(NSDate *)date; /** Set date for subscription. @param date Date of subscription. */ -(void)setDate:(NSDate *)date; /** Get type of subscription */ -(NSString *)type; /** Set type for subscription. @param type Type of subscription. */ -(void)setType:(NSString *)type; @end /**Private implementation of <SocializeSubscription> protocol*/ @interface SocializeSubscription : SocializeObject <SocializeSubscription> /** Set\get <SocializeEntity> object.*/ @property (nonatomic, retain) id<SocializeEntity> entity; /** Set\get <SocializeUser> object.*/ @property (nonatomic, retain) id<SocializeUser> user; @property (nonatomic, retain) NSDate* date; @property (nonatomic, assign) BOOL subscribed; @property (nonatomic, copy) NSString * type; @end
#include "loop.h" duk_ret_t duv_run(duk_context *ctx) { int ret = uv_run(duv_loop(ctx), UV_RUN_DEFAULT); if (ret < 0) { duv_error(ctx, ret); } return 0; } static void duv_walk_cb(uv_handle_t *handle, duk_context *ctx) { duv_handle_t* data = handle->data; duk_dup(ctx, 0); duv_push_ref(ctx, data->context); duv_push_ref(ctx, data->ref); duk_call_method(ctx, 1); } duk_ret_t duv_walk(duk_context *ctx) { dschema_check(ctx, (const duv_schema_entry[]) { {"callback", duk_is_callable}, {NULL} }); uv_walk(duv_loop(ctx), duv_walk_cb, ctx); return 0; }
// // HMTimingGroupModel.h // HomeMate // // Created by Air on 16/7/8. // Copyright © 2017年 Air. All rights reserved. // #import "HMBaseModel+Extension.h" @class HMTiming; @class HMDevice; @interface HMTimingGroupModel : HMBaseModel @property (nonatomic, retain) NSString *timingGroupId; @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *deviceId; /* 0暂停,1生效 **/ @property (nonatomic, assign) int isPause; // 非协议字段 @property (nonatomic, assign) int week; @property (nonatomic, assign ,readonly) BOOL isChanged; @property (nonatomic, assign ,readonly) BOOL isNameChanged; @property (nonatomic, assign ,readonly) BOOL isTimingChanged; @property (nonatomic, assign ,readonly) BOOL isBeginTimeChanged; @property (nonatomic, assign ,readonly) BOOL isEndTimeChanged; //@property (nonatomic, assign ,readonly) BOOL isConflict; @property (nonatomic, strong, readonly) HMTiming *beginTimer; @property (nonatomic, strong, readonly) HMTiming *endTimer; @property (nonatomic,strong) NSString *beginTime; @property (nonatomic,strong) NSString *endTime; - (void)active:(int)active; + (NSMutableArray *)allModels:(HMDevice *)device; + (instancetype)activeModel:(HMDevice *)device; -(HMTiming *)timingWithShowIndex:(int)showIndex; @end
// // Copyright (c) SRG. All rights reserved. // // License information is available from the LICENSE file. // #import <UIKit/UIKit.h> /** * Templates for various player icons */ @interface RTSMediaPlayerIconTemplate : NSObject /** * Play image * * @param size The desired image size * @param color The desired tint color */ + (UIImage *) playImageWithSize:(CGSize)size color:(UIColor *)color; /** * Pause image * * @param size The desired image size * @param color The desired tint color */ + (UIImage *) pauseImageWithSize:(CGSize)size color:(UIColor *)color; @end
//----------------------------------------------------------------------------- // Copyright (c) 2017 Dan Volpe. All rights reserved. // // This file is part of DRVEngine which is released under the MIT license. // See LICENSE file for full license details. //----------------------------------------------------------------------------- #pragma once namespace DRVEngine { namespace Math { extern const float EPSILON; extern const float MAX; extern const float PI; extern const float TWO_PI; extern const float HALF_PI; extern const float INV_PI; extern const float INV_TWO_PI; extern const float DEG_TO_RAD; extern const float RAD_TO_DEG; float ACos( float value ); float ASin( float value ); float ATan( float value ); float ATan2( float y, float x ); float Ceil( float value ); float Cos( float value ); float Exp( float value ); float FAbs( float value ); float Floor( float value ); float FMod( float x, float y ); float InvSqrt( float value ); float Log( float value ); float Pow( float base, float exponent ); float Sin( float value ); void SinCos( float value, float* outSin, float* outCos ); float Sqr( float value ); float Sqrt( float value ); float Tan( float value ); float Sign( float value ); float Clamp( float value, float minValue, float maxValue ); int Clamp( int value, int minValue, int maxValue ); float Min( float value1, float value2 ); int Min( int value1, int value2 ); size_t Min( size_t value1, size_t value2 ); float Max( float value1, float value2 ); int Max( int value1, int value2 ); size_t Max( size_t value1, size_t value2 ); float Lerp( float start, float end, float t ); float NormalizeRange( float outMin, float outMax, float inMin, float inMax, float value ); float UnitRandom( int seed = 0 ); float SymmetricRandom( int seed = 0 ); float IntervalRandom( float min, float max, int seed = 0 ); }}
/** * \file * * \brief Board- and chip-specific example configuration * * Copyright (c) 2014 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \asf_license_stop * */ /** * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> */ #ifndef CONF_EXAMPLE_H #define CONF_EXAMPLE_H #include <compiler.h> #include <dac.h> // Refer to example documentation for details. #define SPEAKER_DAC DACA #define SPEAKER_DAC_CHANNEL DAC_CH0 #endif /* CONF_EXAMPLE_H */
static unsigned long __seed = 0x22DD9F15693587B8; int rand(void) { __seed ^= (__seed << 21); __seed ^= (__seed >> 35); __seed ^= (__seed << 4); return (int)__seed; } // Both in the same TU because they're very frequently used together, and srand // is very small anyway. void srand(unsigned int seed) { __seed = seed; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <CoreData/NSPropertyDescription.h> @class NSFetchRequest, NSString; @interface NSFetchedPropertyDescription : NSPropertyDescription { void *_reserved5; void *_reserved6; NSFetchRequest *_fetchRequest; NSString *_lazyFetchRequestEntityName; } - (void)_createCachesAndOptimizeState; - (unsigned long long)_propertyType; - (_Bool)isReadOnly; - (_Bool)isTransient; - (void)setFetchRequest:(id)arg1; - (id)fetchRequest; - (id)description; - (_Bool)isEqual:(id)arg1; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (void)dealloc; @end
#include "Palindromes.h" void print_array(char *str[], size_t size) { int i; for (i = 0; i < size; i++) { printf("%s", str[i]); if (i < size - 1) { printf(", "); } } } void bubble_sort(char *str[], int length) { int hasSwaped = 1, compare = 0; while (hasSwaped) { hasSwaped = 0; int i; for (i = 0; i < length - 1; i++) { char *temp; compare = strcasecmp(str[i], str[i + 1]); if (compare >= 0) { temp = str[i + 1]; str[i + 1] = str[i]; str[i] = temp; hasSwaped = 1; } } } } int word_count(const char *str, int *palindromWords) { int wordCounter = 0; char *strCopy = calloc(strlen(str) + 1, sizeof (char)); strCopy = strcpy(strCopy, str); char *token = strtok(strCopy, " ,.?!"); while (token) { if (is_palindrom(token)) { *palindromWords += 1; } wordCounter++; token = strtok(NULL, " ,.?!"); } free(strCopy); return wordCounter; } void free_array(char *str[], size_t size) { int i; for (i = 0; i < size; i++) { free(str[i]); } free(str); } char **extract_palindrom(char *line, int palindromWords) { int palindromIndex = 0, palindromLengh = 0; char **str = malloc(palindromWords * sizeof (char *)); if (!str) { fprintf(stderr, "%s", strerror(errno)); exit(EXIT_FAILURE); } char *lineCopy = calloc(strlen(line) + 1, sizeof (char)); lineCopy = strcpy(lineCopy, line); char *token = strtok(lineCopy, " ,.?!"); while (token) { if (is_palindrom(token)) { palindromLengh = strlen(token); str[palindromIndex] = calloc((palindromLengh + 1), sizeof (char)); if (!str) { fprintf(stderr, "%s", strerror(errno)); exit(EXIT_FAILURE); } str[palindromIndex] = strcpy(str[palindromIndex], token); palindromIndex++; } token = strtok(NULL, " ,.?!"); } free(lineCopy); return str; } int is_palindrom(char* str) { int len = strlen(str); int i, j; for (i = 0, j = len - 1; i < j; ++i, --j) { if (str[i] != str[j]) { return 0; } } return 1; } char *line_reading(size_t lenght) { char *lineRead = malloc(8 * sizeof (char)); char *linePtr = lineRead; size_t lenMax = 8, len = lenMax - 1; int c = 0; if (!lineRead) { return NULL; } while (c != EOF) { c = fgetc(stdin); if (c == '\n') { break; } else if (len > lenght) { break; } if (--len == 0) { len = lenMax; char* reallocated_line = (char*) realloc(lineRead, lenMax *= 2); if (!reallocated_line) { free(lineRead); return NULL; } linePtr = reallocated_line + (linePtr - lineRead); lineRead = reallocated_line; } *linePtr++ = c; } *linePtr = '\0'; return lineRead; }
/**********************************************************\ | | | xxtea.c | | | | XXTEA encryption algorithm library for Lua. | | | | Encryption Algorithm Authors: | | David J. Wheeler | | Roger M. Needham | | | | Code Authors: Chen fei <cf850118@163.com> | | Ma Bingyao <mabingyao@gmail.com> | | LastModified: Jun 15, 2020 | | | \**********************************************************/ #include <lua.h> #include <lauxlib.h> #include "xxtea.h" static int encrypt(lua_State *L) { unsigned char *result; const char *data, *key; size_t data_len, key_len, out_len; data = luaL_checklstring(L, 1, &data_len); key = luaL_checklstring(L, 2, &key_len); result = xxtea_encrypt(data, data_len, key, &out_len); if(result == NULL){ lua_pushlstring(L, "", 0); }else{ lua_pushlstring(L, (const char *)result, out_len); free(result); } return 1; } static int decrypt(lua_State *L) { unsigned char *result; const char *data, *key; size_t data_len, key_len, out_len; data = luaL_checklstring(L, 1, &data_len); key = luaL_checklstring(L, 2, &key_len); result = xxtea_decrypt(data, data_len, key, &out_len); if(result == NULL){ lua_pushlstring(L, "", 0); }else{ lua_pushlstring(L, (const char *)result, out_len); free(result); } return 1; } static const luaL_Reg xxtea[] = { {"encrypt", encrypt}, {"decrypt", decrypt}, {0, 0} }; LUALIB_API int luaopen_xxtea(lua_State * L) { #if LUA_VERSION_NUM >= 502 // LUA 5.2 or above lua_newtable(L); luaL_setfuncs(L, xxtea, 0); #else luaL_register(L, "xxtea", xxtea); #endif return 1; }
#ifndef LANDMARKS_LANDMARK_COUNT_HEURISTIC_H #define LANDMARKS_LANDMARK_COUNT_HEURISTIC_H #include "../state.h" #include "../heuristic.h" #include "landmarks_graph.h" #include "exploration.h" #include "landmark_status_manager.h" #include "landmark_cost_assignment.h" extern LandmarksGraph *g_lgraph; // Make global so graph does not need to be built more than once // even when iterating search (TODO: clean up use of g_lgraph vs. // lgraph in this class). class LandmarkCountHeuristic : public Heuristic { friend class LamaFFSynergy; LandmarksGraph &lgraph; Exploration *exploration; bool use_preferred_operators; int lookahead; bool ff_search_disjunctive_lms; LandmarkStatusManager lm_status_manager; LandmarkCostAssignment *lm_cost_assignment; bool use_cost_sharing; int get_heuristic_value(const State &state); void collect_lm_leaves(bool disjunctive_lms, LandmarkSet &result, vector< pair<int, int> > &leaves); int ff_search_lm_leaves(bool disjunctive_lms, const State &state, LandmarkSet &result); bool check_node_orders_disobeyed(LandmarkNode &node, const LandmarkSet &reached) const; void add_node_children(LandmarkNode &node, const LandmarkSet &reached) const; bool landmark_is_interesting(const State &s, const LandmarkSet &reached, LandmarkNode &lm) const; bool generate_helpful_actions(const State &state, const LandmarkSet &reached); void set_exploration_goals(const State &state); //int get_needed_landmarks(const State& state, LandmarkSet& needed) const; Exploration *get_exploration() {return exploration; } void convert_lms(LandmarkSet &lms_set, const vector<bool> &lms_vec); protected: virtual int compute_heuristic(const State &state); public: LandmarkCountHeuristic(const HeuristicOptions &options, LandmarksGraph &lm_graph, bool use_preferred_operators, bool admissible, bool optimal, bool use_action_landmarks); ~LandmarkCountHeuristic() { } virtual bool reach_state(const State &parent_state, const Operator &op, const State &state); virtual bool dead_ends_are_reliable() const { return true; } static ScalarEvaluator *create(const std::vector<string> &config, int start, int &end, bool dry_run); virtual void reset(); }; #endif
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2016 Torus Knot Software Ltd 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 __D3D11Plugin_H__ #define __D3D11Plugin_H__ #include "OgrePlugin.h" #include "OgreD3D11RenderSystem.h" namespace Ogre { /** Plugin instance for D3D11 Manager */ class _OgreD3D11Export D3D11Plugin : public Plugin { public: D3D11Plugin(); /// @copydoc Plugin::getName const String& getName() const; /// @copydoc Plugin::install void install(); /// @copydoc Plugin::initialise void initialise(); /// @copydoc Plugin::shutdown void shutdown(); /// @copydoc Plugin::uninstall void uninstall(); protected: D3D11RenderSystem* mRenderSystem; }; } #endif
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPAT_H #define BITCOIN_COMPAT_H #if defined(HAVE_CONFIG_H) #include "config/TDC-config.h" #endif #ifdef WIN32 #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0501 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #ifndef NOMINMAX #define NOMINMAX #endif #ifdef FD_SETSIZE #undef FD_SETSIZE // prevent redefinition compiler warning #endif #define FD_SETSIZE 1024 // max number of fds in fd_set #include <winsock2.h> // Must be included before mswsock.h and windows.h #include <mswsock.h> #include <windows.h> #include <ws2tcpip.h> #else #include <sys/fcntl.h> #include <sys/mman.h> #include <sys/socket.h> #include <sys/types.h> #include <net/if.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <ifaddrs.h> #include <limits.h> #include <netdb.h> #include <unistd.h> #endif #ifdef WIN32 #define MSG_DONTWAIT 0 #else typedef u_int SOCKET; #include "errno.h" #define WSAGetLastError() errno #define WSAEINVAL EINVAL #define WSAEALREADY EALREADY #define WSAEWOULDBLOCK EWOULDBLOCK #define WSAEMSGSIZE EMSGSIZE #define WSAEINTR EINTR #define WSAEINPROGRESS EINPROGRESS #define WSAEADDRINUSE EADDRINUSE #define WSAENOTSOCK EBADF #define INVALID_SOCKET (SOCKET)(~0) #define SOCKET_ERROR -1 #endif #ifdef WIN32 #ifndef S_IRUSR #define S_IRUSR 0400 #define S_IWUSR 0200 #endif #else #define MAX_PATH 1024 #endif // As Solaris does not have the MSG_NOSIGNAL flag for send(2) syscall, it is defined as 0 #if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL) #define MSG_NOSIGNAL 0 #endif #ifndef WIN32 // PRIO_MAX is not defined on Solaris #ifndef PRIO_MAX #define PRIO_MAX 20 #endif #define THREAD_PRIORITY_LOWEST PRIO_MAX #define THREAD_PRIORITY_BELOW_NORMAL 2 #define THREAD_PRIORITY_NORMAL 0 #define THREAD_PRIORITY_ABOVE_NORMAL (-2) #endif #if HAVE_DECL_STRNLEN == 0 size_t strnlen( const char *start, size_t max_len); #endif // HAVE_DECL_STRNLEN bool static inline IsSelectableSocket(SOCKET s) { #ifdef WIN32 return true; #else return (s < FD_SETSIZE); #endif } #endif // BITCOIN_COMPAT_H
#include<string.h> #include<stdio.h> int main (){ int i,a[26]={0},e=0; char m[1000]; fgets (m,1000,stdin); for(i=0;m[i]!='\0';i++)if(m[i]>='a'&&m[i]<='z'){e=m[i] - 'a';a[e]++;} else if(m[i]>='A'&&m[i<='Z']){e=m[i]-'A';a[e]++;} for(i=0;i<26;i++)if(a[i]!=0){ printf("%c - ",'a'+i);printf("%d\n",a[i]);} }
/* Test STstrDots $Id: tSTstrDots.c 1.2 1999/06/04 libtsp-v6r3 $ */ #include <libtsp/nucleus.h> int main (int argc, const char *argv[]) { int M; char *p; sscanf (argv[2], "%d", &M); p = STstrDots (argv[1], M); printf ("STstrDots: \"%s\"\n", p); return 0; }
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- vim:set ts=4 sw=4 sts=4 noet: */ #ifndef FLINT_ISDF_ISDF_H_ #define FLINT_ISDF_ISDF_H_ #include <cstdint> #include <cstring> #include <ctime> namespace flint { namespace isdf { /* * insilicoSim binary Data output Format * * TODO: Matrix or more complex data value handling * TODO: More sophisticated header, containing simulation setup information etc. * TODO: support for dynamicaly adding or deleting objects */ #pragma pack(1) typedef struct ISDFHeaderStruct{ char magic[4]; // must be 'I' 'S' 'D' 'F' char version; // currently, 1 char little_endian; // 1 if little endian file char padding[2]; // should be 0 char timestamp[20]; std::uint32_t num_objs; // number of objects recorded in each step std::uint32_t num_bytes_comment; // number of bytes for comment std::uint32_t num_bytes_descs; // number of bytes for descriptions std::uint32_t num_bytes_units; // number of bytes for units ISDFHeaderStruct() { magic[0] = 'I'; magic[1] = 'S'; magic[2] = 'D'; magic[3] = 'F'; version = 1; #if defined(__LITTLE_ENDIAN__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ little_endian = 1; #elif defined(__BIG_ENDIAN__) || __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ little_endian = 0; #else { int i = 1; little_endian = *(char*)&i; } #endif padding[0] = padding[1] = 0; time_t t = std::time(nullptr); struct tm *utc = std::gmtime(&t); // Note that on Windows strftime() comes from MSVCRT.LIB, // so some of the formatting codes are unavailable. if (std::strftime(timestamp, 20, "%Y-%m-%dT%H:%M:%S", utc) == 0) { // put the epoch as a last resort std::strcpy(timestamp, "1970-01-01T00:00:00"); } timestamp[19] = 'Z'; } } ISDFHeader; #pragma pack() } } #endif // ISDF_HEADER_
#pragma once //------------------------------------------------------------------------------ /** @file Gfx/Resource/resourceBase.h @brief Gfx module resource classes */ #include "Resource/ResourceBase.h" #include "Gfx/GfxTypes.h" namespace Oryol { namespace _priv { //------------------------------------------------------------------------------ /** @class Oryol::_priv::shaderBase @ingroup _priv @brief shader resource base class */ class shaderBase : public ResourceBase { public: /// the original setup object ShaderSetup Setup; /// clear the object void Clear(); }; //------------------------------------------------------------------------------ /** @class Oryol::_priv::textureBase @ingroup _priv @brief base class for platform-specific texture implementation */ class textureBase : public ResourceBase { public: /// the original setup object TextureSetup Setup; /// texture attributes TextureAttrs textureAttrs; /// was created from native texture handles bool nativeHandles = false; /// clear the object void Clear(); }; //------------------------------------------------------------------------------ /** @class Oryol::_priv::meshBase @ingroup _priv @brief base class for platform-specific mesh implementations */ class meshBase : public ResourceBase { public: /// the original setup object MeshSetup Setup; /// vertex buffer attributes VertexBufferAttrs vertexBufferAttrs; /// index buffer attributes IndexBufferAttrs indexBufferAttrs; /// number of primitive groups int numPrimGroups = 0; /// primitive groups StaticArray<PrimitiveGroup, GfxConfig::MaxNumPrimGroups> primGroups; /// clear the object void Clear(); }; //------------------------------------------------------------------------------ /** @class Oryol::_priv::pipelineBase @ingroup _priv @brief base class for pipeline implementations */ class shader; class pipelineBase : public ResourceBase { public: /// the original setup object PipelineSetup Setup; /// shader pointer shader* shd = nullptr; /// clear the object void Clear(); }; //------------------------------------------------------------------------------ /** @class Oryol::_priv::renderPassBase @ingroup _priv @brief base class for render-pass implementations */ class texture; class renderPassBase : public ResourceBase { public: /// constructor renderPassBase() { colorTextures.Fill(nullptr); } /// the original setup object PassSetup Setup; /// color texture pointers StaticArray<texture*, GfxConfig::MaxNumColorAttachments> colorTextures; /// depth-stencil texture pointer texture* depthStencilTexture = nullptr; /// clear the object void Clear(); }; } // namespace _priv } // namespace Oryol
#ifndef __KERNEL_MEM_ALLOC_H__ #define __KERNEL_MEM_ALLOC_H__ #include <types.h> #include <rb_tree.h> struct allocator; struct page_dir; typedef struct allocator { struct rb_tree mem_tree; uintptr_t start_address; uintptr_t end_address; size_t min_size; size_t max_size; struct page_dir *page_dir; uint8_t supervisor; uint8_t readonly; size_t mem_used; } allocator_t; allocator_t *create_mem_allocator(uintptr_t start, uintptr_t end, size_t min, size_t max, uint8_t supervisor, uint8_t readonly, struct page_dir *dir); void *alloc(const size_t size, size_t alignment, allocator_t *allocator); void free(void *p, allocator_t *allocator); size_t mem_used(allocator_t *allocator); size_t mem_free(allocator_t *allocator); #endif
/* * Copyright (C) 2011 Marcelina Kościelnicka <mwk@0x04.net> * 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 (including the next * paragraph) 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 "nva.h" #include <stdio.h> #include <unistd.h> void xt_wr32(int cnum, uint32_t addr, uint32_t val) { nva_wr32(cnum, 0x700004, addr); nva_wr32(cnum, 0x700008, val); nva_wr32(cnum, 0x70000, 1); while (nva_rd32(cnum, 0x70000)); nva_wr32(cnum, 0x700000, 2); while (nva_rd32(cnum, 0x700000)); } int main(int argc, char **argv) { if (nva_init()) { fprintf (stderr, "PCI init failure!\n"); return 1; } int c; int cnum =0; while ((c = getopt (argc, argv, "c:")) != -1) switch (c) { case 'c': sscanf(optarg, "%d", &cnum); break; } if (cnum >= nva_cardsnum) { if (nva_cardsnum) fprintf (stderr, "No such card.\n"); else fprintf (stderr, "No cards found.\n"); return 1; } int32_t a, b = 4; if (optind >= argc) { fprintf (stderr, "No address specified.\n"); return 1; } if (optind + 1 >= argc) { fprintf (stderr, "No value specified.\n"); return 1; } sscanf (argv[optind], "%x", &a); sscanf (argv[optind + 1], "%x", &b); nva_wr32(cnum, 0x1700, 0x30); xt_wr32(cnum, a, b); return 0; }
// // HBoxWidget.h // EOSClient2 // // Created by Chang Sam on 10/19/11. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import <CAPKit/CAPKit.h> @interface CAPHBoxWidget : CAPViewWidget @end