text
stringlengths
4
6.14k
#ifndef _LINUX_ELF_EM_H #define _LINUX_ELF_EM_H /* These constants define the various ELF target machines */ #define EM_NONE 0 #define EM_M32 1 #define EM_SPARC 2 #define EM_386 3 #define EM_68K 4 #define EM_88K 5 #define EM_486 6 /* Perhaps disused */ #define EM_860 7 #define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ /* Next two are historical and binaries and modules of these types will be rejected by Linux. */ #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ #define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ #define EM_PARISC 15 /* HPPA */ #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ #define EM_PPC 20 /* PowerPC */ #define EM_PPC64 21 /* PowerPC64 */ #define EM_SPU 23 /* Cell BE SPU */ #define EM_SH 42 /* SuperH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_IA_64 50 /* HP/Intel IA-64 */ #define EM_X86_64 62 /* AMD x86-64 */ #define EM_S390 22 /* IBM S/390 */ #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ #define EM_V850 87 /* NEC v850 */ #define EM_M32R 88 /* Renesas M32R */ #define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ #define EM_TI_C6000 140 /* TI C6X DSPs */ #define EM_FRV 0x5441 /* Fujitsu FR-V */ #define EM_AVR32 0x18ad /* Atmel AVR32 */ /* * This is an interim value that we will use until the committee comes * up with a final number. */ #define EM_ALPHA 0x9026 /* Bogus old v850 magic number, used by old tools. */ #define EM_CYGNUS_V850 0x9080 /* Bogus old m32r magic number, used by old tools. */ #define EM_CYGNUS_M32R 0x9041 /* This is the old interim value for S/390 architecture */ #define EM_S390_OLD 0xA390 /* Also Panasonic/MEI MN10300, AM33 */ #define EM_CYGNUS_MN10300 0xbeef #endif /* _LINUX_ELF_EM_H */
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LIBHDFS_MUTEXES_H #define LIBHDFS_MUTEXES_H /* * Defines abstraction over platform-specific mutexes. libhdfs has no formal * initialization function that users would call from a single-threaded context * to initialize the library. This creates a challenge for bootstrapping the * mutexes. To address this, all required mutexes are pre-defined here with * external storage. Platform-specific implementations must guarantee that the * mutexes are initialized via static initialization. */ #include "platform.h" /** Mutex protecting the class reference hash table. */ extern mutex hdfsHashMutex; /** Mutex protecting singleton JVM instance. */ extern mutex jvmMutex; /** * Locks a mutex. * * @param m mutex * @return 0 if successful, non-zero otherwise */ int mutexLock(mutex *m); /** * Unlocks a mutex. * * @param m mutex * @return 0 if successful, non-zero otherwise */ int mutexUnlock(mutex *m); #endif
/* * Support for Compaq iPAQ H3100 handheld computer * * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks) * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru> * * 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/kernel.h> #include <linux/gpio.h> #include <video/sa1100fb.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <linux/platform_data/irda-sa11x0.h> #include <mach/h3xxx.h> #include <mach/irqs.h> #include "generic.h" /* * helper for sa1100fb */ static struct gpio h3100_lcd_gpio[] = { { H3100_GPIO_LCD_3V_ON, GPIOF_OUT_INIT_LOW, "LCD 3V" }, { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD ON" }, }; static bool h3100_lcd_request(void) { static bool h3100_lcd_ok; int rc; if (h3100_lcd_ok) return true; rc = gpio_request_array(h3100_lcd_gpio, ARRAY_SIZE(h3100_lcd_gpio)); if (rc) pr_err("%s: can't request GPIOs\n", __func__); else h3100_lcd_ok = true; return h3100_lcd_ok; } static void h3100_lcd_power(int enable) { if (!h3100_lcd_request()) return; gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); gpio_set_value(H3XXX_EGPIO_LCD_ON, enable); } static struct sa1100fb_mach_info h3100_lcd_info = { .pixclock = 406977, .bpp = 4, .xres = 320, .yres = 240, .hsync_len = 26, .vsync_len = 41, .left_margin = 4, .upper_margin = 0, .right_margin = 4, .lower_margin = 0, .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, .cmap_greyscale = 1, .cmap_inverse = 1, .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), .lcd_power = h3100_lcd_power, }; static void __init h3100_map_io(void) { h3xxx_map_io(); /* Older bootldrs put GPIO2-9 in alternate mode on the assumption that they are used for video */ GAFR &= ~0x000001fb; } /* * This turns the IRDA power on or off on the Compaq H3100 */ static struct gpio h3100_irda_gpio[] = { { H3100_GPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" }, { H3100_GPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" }, }; static int h3100_irda_set_power(struct device *dev, unsigned int state) { gpio_set_value(H3100_GPIO_IR_ON, state); return 0; } static void h3100_irda_set_speed(struct device *dev, unsigned int speed) { gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000)); } static int h3100_irda_startup(struct device *dev) { return gpio_request_array(h3100_irda_gpio, sizeof(h3100_irda_gpio)); } static void h3100_irda_shutdown(struct device *dev) { return gpio_free_array(h3100_irda_gpio, sizeof(h3100_irda_gpio)); } static struct irda_platform_data h3100_irda_data = { .set_power = h3100_irda_set_power, .set_speed = h3100_irda_set_speed, .startup = h3100_irda_startup, .shutdown = h3100_irda_shutdown, }; static void __init h3100_mach_init(void) { h3xxx_mach_init(); sa11x0_register_lcd(&h3100_lcd_info); sa11x0_register_irda(&h3100_irda_data); } MACHINE_START(H3100, "Compaq iPAQ H3100") .atag_offset = 0x100, .map_io = h3100_map_io, .nr_irqs = SA1100_NR_IRQS, .init_irq = sa1100_init_irq, .init_time = sa1100_timer_init, .init_machine = h3100_mach_init, .init_late = sa11x0_init_late, .restart = sa11x0_restart, MACHINE_END
/* * fs/kernfs/symlink.c - kernfs symlink implementation * * Copyright (c) 2001-3 Patrick Mochel * Copyright (c) 2007 SUSE Linux Products GmbH * Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org> * * This file is released under the GPLv2. */ #include <linux/fs.h> #include <linux/gfp.h> #include <linux/namei.h> #include "kernfs-internal.h" /** * kernfs_create_link - create a symlink * @parent: directory to create the symlink in * @name: name of the symlink * @target: target node for the symlink to point to * * Returns the created node on success, ERR_PTR() value on error. */ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, const char *name, struct kernfs_node *target) { struct kernfs_node *kn; int error; kn = kernfs_new_node(parent, name, S_IFLNK|S_IRWXUGO, KERNFS_LINK); if (!kn) return ERR_PTR(-ENOMEM); if (kernfs_ns_enabled(parent)) kn->ns = target->ns; kn->symlink.target_kn = target; kernfs_get(target); /* ref owned by symlink */ error = kernfs_add_one(kn); if (!error) return kn; kernfs_put(kn); return ERR_PTR(error); } static int kernfs_get_target_path(struct kernfs_node *parent, struct kernfs_node *target, char *path) { struct kernfs_node *base, *kn; char *s = path; int len = 0; /* go up to the root, stop at the base */ base = parent; while (base->parent) { kn = target->parent; while (kn->parent && base != kn) kn = kn->parent; if (base == kn) break; strcpy(s, "../"); s += 3; base = base->parent; } /* determine end of target string for reverse fillup */ kn = target; while (kn->parent && kn != base) { len += strlen(kn->name) + 1; kn = kn->parent; } /* check limits */ if (len < 2) return -EINVAL; len--; if ((s - path) + len > PATH_MAX) return -ENAMETOOLONG; /* reverse fillup of target string from target to base */ kn = target; while (kn->parent && kn != base) { int slen = strlen(kn->name); len -= slen; strncpy(s + len, kn->name, slen); if (len) s[--len] = '/'; kn = kn->parent; } return 0; } static int kernfs_getlink(struct dentry *dentry, char *path) { struct kernfs_node *kn = dentry->d_fsdata; struct kernfs_node *parent = kn->parent; struct kernfs_node *target = kn->symlink.target_kn; int error; mutex_lock(&kernfs_mutex); error = kernfs_get_target_path(parent, target, path); mutex_unlock(&kernfs_mutex); return error; } static void *kernfs_iop_follow_link(struct dentry *dentry, struct nameidata *nd) { int error = -ENOMEM; unsigned long page = get_zeroed_page(GFP_KERNEL); if (page) { error = kernfs_getlink(dentry, (char *) page); if (error < 0) free_page((unsigned long)page); } nd_set_link(nd, error ? ERR_PTR(error) : (char *)page); return NULL; } static void kernfs_iop_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) { char *page = nd_get_link(nd); if (!IS_ERR(page)) free_page((unsigned long)page); } const struct inode_operations kernfs_symlink_iops = { .setxattr = kernfs_iop_setxattr, .removexattr = kernfs_iop_removexattr, .getxattr = kernfs_iop_getxattr, .listxattr = kernfs_iop_listxattr, .readlink = generic_readlink, .follow_link = kernfs_iop_follow_link, .put_link = kernfs_iop_put_link, .setattr = kernfs_iop_setattr, .getattr = kernfs_iop_getattr, .permission = kernfs_iop_permission, };
#include <linux/linkage.h> #include <linux/errno.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/timex.h> #include <linux/random.h> #include <linux/kprobes.h> #include <linux/init.h> #include <linux/kernel_stat.h> #include <linux/device.h> #include <linux/bitops.h> #include <linux/acpi.h> #include <linux/io.h> #include <linux/delay.h> #include <linux/atomic.h> #include <asm/timer.h> #include <asm/hw_irq.h> #include <asm/pgtable.h> #include <asm/desc.h> #include <asm/apic.h> #include <asm/setup.h> #include <asm/i8259.h> #include <asm/traps.h> #include <asm/prom.h> /* * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: * (these are usually mapped to vectors 0x30-0x3f) */ /* * The IO-APIC gives us many more interrupt sources. Most of these * are unused but an SMP system is supposed to have enough memory ... * sometimes (mostly wrt. hw bugs) we get corrupted vectors all * across the spectrum, so we really want to be prepared to get all * of these. Plus, more powerful systems might have more than 64 * IO-APIC registers. * * (these are usually mapped into the 0x30-0xff vector range) */ /* * IRQ2 is cascade interrupt to second interrupt controller */ static struct irqaction irq2 = { .handler = no_action, .name = "cascade", .flags = IRQF_NO_THREAD, }; DEFINE_PER_CPU(vector_irq_t, vector_irq) = { [0 ... NR_VECTORS - 1] = VECTOR_UNDEFINED, }; int vector_used_by_percpu_irq(unsigned int vector) { int cpu; for_each_online_cpu(cpu) { if (per_cpu(vector_irq, cpu)[vector] > VECTOR_UNDEFINED) return 1; } return 0; } void __init init_ISA_irqs(void) { struct irq_chip *chip = legacy_pic->chip; int i; #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) init_bsp_APIC(); #endif legacy_pic->init(0); for (i = 0; i < nr_legacy_irqs(); i++) irq_set_chip_and_handler(i, chip, handle_level_irq); } void __init init_IRQ(void) { int i; /* * On cpu 0, Assign ISA_IRQ_VECTOR(irq) to IRQ 0..15. * If these IRQ's are handled by legacy interrupt-controllers like PIC, * then this configuration will likely be static after the boot. If * these IRQ's are handled by more mordern controllers like IO-APIC, * then this vector space can be freed and re-used dynamically as the * irq's migrate etc. */ for (i = 0; i < nr_legacy_irqs(); i++) per_cpu(vector_irq, 0)[ISA_IRQ_VECTOR(i)] = i; x86_init.irqs.intr_init(); } static void __init smp_intr_init(void) { #ifdef CONFIG_SMP /* * The reschedule interrupt is a CPU-to-CPU reschedule-helper * IPI, driven by wakeup. */ alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); /* IPI for generic function call */ alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); /* IPI for generic single function call */ alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, call_function_single_interrupt); /* Low priority IPI to cleanup after moving an irq */ set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt); set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors); /* IPI used for rebooting/stopping */ alloc_intr_gate(REBOOT_VECTOR, reboot_interrupt); #endif /* CONFIG_SMP */ } static void __init apic_intr_init(void) { smp_intr_init(); #ifdef CONFIG_X86_THERMAL_VECTOR alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); #endif #ifdef CONFIG_X86_MCE_THRESHOLD alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt); #endif #ifdef CONFIG_X86_MCE_AMD alloc_intr_gate(DEFERRED_ERROR_VECTOR, deferred_error_interrupt); #endif #ifdef CONFIG_X86_LOCAL_APIC /* self generated IPI for local APIC timer */ alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); /* IPI for X86 platform specific use */ alloc_intr_gate(X86_PLATFORM_IPI_VECTOR, x86_platform_ipi); #ifdef CONFIG_HAVE_KVM /* IPI for KVM to deliver posted interrupt */ alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi); /* IPI for KVM to deliver interrupt to wake up tasks */ alloc_intr_gate(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi); #endif /* IPI vectors for APIC spurious and error interrupts */ alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt); /* IRQ work interrupts: */ # ifdef CONFIG_IRQ_WORK alloc_intr_gate(IRQ_WORK_VECTOR, irq_work_interrupt); # endif #endif } void __init native_init_IRQ(void) { int i; /* Execute any quirks before the call gates are initialised: */ x86_init.irqs.pre_vector_init(); apic_intr_init(); /* * Cover the whole vector space, no vector can escape * us. (some of these will be overridden and become * 'special' SMP interrupts) */ i = FIRST_EXTERNAL_VECTOR; #ifndef CONFIG_X86_LOCAL_APIC #define first_system_vector NR_VECTORS #endif for_each_clear_bit_from(i, used_vectors, first_system_vector) { /* IA32_SYSCALL_VECTOR could be used in trap_init already. */ set_intr_gate(i, irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR)); } #ifdef CONFIG_X86_LOCAL_APIC for_each_clear_bit_from(i, used_vectors, NR_VECTORS) set_intr_gate(i, spurious_interrupt); #endif if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) setup_irq(2, &irq2); #ifdef CONFIG_X86_32 irq_ctx_init(smp_processor_id()); #endif }
#ifndef _DMA_ATTR_H #define _DMA_ATTR_H #include <linux/bitmap.h> #include <linux/bitops.h> #include <linux/bug.h> /** * an enum dma_attr represents an attribute associated with a DMA * mapping. The semantics of each attribute should be defined in * Documentation/DMA-attributes.txt. */ enum dma_attr { DMA_ATTR_WRITE_BARRIER, DMA_ATTR_WEAK_ORDERING, DMA_ATTR_MAX, }; #define __DMA_ATTRS_LONGS BITS_TO_LONGS(DMA_ATTR_MAX) /** * struct dma_attrs - an opaque container for DMA attributes * @flags - bitmask representing a collection of enum dma_attr */ struct dma_attrs { unsigned long flags[__DMA_ATTRS_LONGS]; }; #define DEFINE_DMA_ATTRS(x) \ struct dma_attrs x = { \ .flags = { [0 ... __DMA_ATTRS_LONGS-1] = 0 }, \ } static inline void init_dma_attrs(struct dma_attrs *attrs) { bitmap_zero(attrs->flags, __DMA_ATTRS_LONGS); } #ifdef CONFIG_HAVE_DMA_ATTRS /** * dma_set_attr - set a specific attribute * @attr: attribute to set * @attrs: struct dma_attrs (may be NULL) */ static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs) { if (attrs == NULL) return; BUG_ON(attr >= DMA_ATTR_MAX); __set_bit(attr, attrs->flags); } /** * dma_get_attr - check for a specific attribute * @attr: attribute to set * @attrs: struct dma_attrs (may be NULL) */ static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs) { if (attrs == NULL) return 0; BUG_ON(attr >= DMA_ATTR_MAX); return test_bit(attr, attrs->flags); } #else /* !CONFIG_HAVE_DMA_ATTRS */ static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs) { } static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs) { return 0; } #endif /* CONFIG_HAVE_DMA_ATTRS */ #endif /* _DMA_ATTR_H */
/* -*- mode: c; c-basic-offset: 8; -*- * vim: noexpandtab sw=8 ts=8 sts=0: * * Copyright (C) 2002, 2004, 2005 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #ifndef OCFS2_AOPS_H #define OCFS2_AOPS_H #include <linux/aio.h> handle_t *ocfs2_start_walk_page_trans(struct inode *inode, struct page *page, unsigned from, unsigned to); int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno, struct inode *inode, unsigned int from, unsigned int to, int new); void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages); int walk_page_buffers( handle_t *handle, struct buffer_head *head, unsigned from, unsigned to, int *partial, int (*fn)( handle_t *handle, struct buffer_head *bh)); int ocfs2_write_end_nolock(struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata); int ocfs2_write_begin_nolock(struct file *filp, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata, struct buffer_head *di_bh, struct page *mmap_page); int ocfs2_read_inline_data(struct inode *inode, struct page *page, struct buffer_head *di_bh); int ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size); int ocfs2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); /* all ocfs2_dio_end_io()'s fault */ #define ocfs2_iocb_is_rw_locked(iocb) \ test_bit(0, (unsigned long *)&iocb->private) static inline void ocfs2_iocb_set_rw_locked(struct kiocb *iocb, int level) { set_bit(0, (unsigned long *)&iocb->private); if (level) set_bit(1, (unsigned long *)&iocb->private); else clear_bit(1, (unsigned long *)&iocb->private); } /* * Using a named enum representing lock types in terms of #N bit stored in * iocb->private, which is going to be used for communication between * ocfs2_dio_end_io() and ocfs2_file_aio_write/read(). */ enum ocfs2_iocb_lock_bits { OCFS2_IOCB_RW_LOCK = 0, OCFS2_IOCB_RW_LOCK_LEVEL, OCFS2_IOCB_SEM, OCFS2_IOCB_UNALIGNED_IO, OCFS2_IOCB_NUM_LOCKS }; #define ocfs2_iocb_clear_rw_locked(iocb) \ clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private) #define ocfs2_iocb_rw_locked_level(iocb) \ test_bit(OCFS2_IOCB_RW_LOCK_LEVEL, (unsigned long *)&iocb->private) #define ocfs2_iocb_set_sem_locked(iocb) \ set_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) #define ocfs2_iocb_clear_sem_locked(iocb) \ clear_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) #define ocfs2_iocb_is_sem_locked(iocb) \ test_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) #define ocfs2_iocb_set_unaligned_aio(iocb) \ set_bit(OCFS2_IOCB_UNALIGNED_IO, (unsigned long *)&iocb->private) #define ocfs2_iocb_clear_unaligned_aio(iocb) \ clear_bit(OCFS2_IOCB_UNALIGNED_IO, (unsigned long *)&iocb->private) #define ocfs2_iocb_is_unaligned_aio(iocb) \ test_bit(OCFS2_IOCB_UNALIGNED_IO, (unsigned long *)&iocb->private) #endif /* OCFS2_FILE_H */
/* * Copyright (C) 2009 Motorola, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define SEC_PROC_ID_SIZE 16 #define SEC_IOCTL_WRITE_FUSE _IOWR(0x99, 120, int*) #define SEC_IOCTL_READ_FUSE _IOWR(0x99, 121, int*) #define SEC_IOCTL_READ_PROC_ID _IOWR(0x99, 123, int*) #define SEC_IOCTL_GET_TZ_VERSION _IOWR(0x99, 124, int*) #define SEC_IOCTL_GET_TZ_CODES _IOWR(0x99, 125, int*) struct SEC_EFUSE_PARM_T { unsigned int which_bank; unsigned int efuse_value; }; enum SEC_KM_RESULT_T { SEC_KM_SUCCESS = 98, SEC_KM_FAIL = 99, };
/* i810_drv.c -- I810 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * 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 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * Jeff Hartmann <jhartmann@valinux.com> * Gareth Hughes <gareth@valinux.com> */ #include "i810_drv.h" #include <linux/module.h> #include <linux/pci.h> #include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_pciids.h> #include <drm/i810_drm.h> static struct pci_device_id pciidlist[] = { i810_PCI_IDS }; static const struct file_operations i810_driver_fops = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, .unlocked_ioctl = drm_ioctl, .mmap = drm_legacy_mmap, .poll = drm_poll, .compat_ioctl = drm_compat_ioctl, .llseek = noop_llseek, }; static struct drm_driver driver = { .driver_features = DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_LEGACY, .dev_priv_size = sizeof(drm_i810_buf_priv_t), .load = i810_driver_load, .lastclose = i810_driver_lastclose, .preclose = i810_driver_preclose, .dma_quiescent = i810_driver_dma_quiescent, .ioctls = i810_ioctls, .fops = &i810_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE, .major = DRIVER_MAJOR, .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, }; static struct pci_driver i810_pci_driver = { .name = DRIVER_NAME, .id_table = pciidlist, }; static int __init i810_init(void) { if (num_possible_cpus() > 1) { pr_err("drm/i810 does not support SMP\n"); return -EINVAL; } driver.num_ioctls = i810_max_ioctl; return drm_legacy_pci_init(&driver, &i810_pci_driver); } static void __exit i810_exit(void) { drm_legacy_pci_exit(&driver, &i810_pci_driver); } module_init(i810_init); module_exit(i810_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL and additional rights");
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* tuner-i2c.h - i2c interface for different tuners Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org) */ #ifndef __TUNER_I2C_H__ #define __TUNER_I2C_H__ #include <linux/i2c.h> #include <linux/slab.h> struct tuner_i2c_props { u8 addr; struct i2c_adapter *adap; /* used for tuner instance management */ int count; char *name; }; static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, unsigned char *buf, int len) { struct i2c_msg msg = { .addr = props->addr, .flags = 0, .buf = buf, .len = len }; int ret = i2c_transfer(props->adap, &msg, 1); return (ret == 1) ? len : ret; } static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, unsigned char *buf, int len) { struct i2c_msg msg = { .addr = props->addr, .flags = I2C_M_RD, .buf = buf, .len = len }; int ret = i2c_transfer(props->adap, &msg, 1); return (ret == 1) ? len : ret; } static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, unsigned char *obuf, int olen, unsigned char *ibuf, int ilen) { struct i2c_msg msg[2] = { { .addr = props->addr, .flags = 0, .buf = obuf, .len = olen }, { .addr = props->addr, .flags = I2C_M_RD, .buf = ibuf, .len = ilen } }; int ret = i2c_transfer(props->adap, msg, 2); return (ret == 2) ? ilen : ret; } /* Callers must declare as a global for the module: * * static LIST_HEAD(hybrid_tuner_instance_list); * * hybrid_tuner_instance_list should be the third argument * passed into hybrid_tuner_request_state(). * * state structure must contain the following: * * struct list_head hybrid_tuner_instance_list; * struct tuner_i2c_props i2c_props; * * hybrid_tuner_instance_list (both within state structure and globally) * is only required if the driver is using hybrid_tuner_request_state * and hybrid_tuner_release_state to manage state sharing between * multiple instances of hybrid tuners. */ #define tuner_printk(kernlvl, i2cprops, fmt, arg...) do { \ printk(kernlvl "%s %d-%04x: " fmt, i2cprops.name, \ i2cprops.adap ? \ i2c_adapter_id(i2cprops.adap) : -1, \ i2cprops.addr, ##arg); \ } while (0) /* TO DO: convert all callers of these macros to pass in * struct tuner_i2c_props, then remove the macro wrappers */ #define __tuner_warn(i2cprops, fmt, arg...) do { \ tuner_printk(KERN_WARNING, i2cprops, fmt, ##arg); \ } while (0) #define __tuner_info(i2cprops, fmt, arg...) do { \ tuner_printk(KERN_INFO, i2cprops, fmt, ##arg); \ } while (0) #define __tuner_err(i2cprops, fmt, arg...) do { \ tuner_printk(KERN_ERR, i2cprops, fmt, ##arg); \ } while (0) #define __tuner_dbg(i2cprops, fmt, arg...) do { \ if ((debug)) \ tuner_printk(KERN_DEBUG, i2cprops, fmt, ##arg); \ } while (0) #define tuner_warn(fmt, arg...) __tuner_warn(priv->i2c_props, fmt, ##arg) #define tuner_info(fmt, arg...) __tuner_info(priv->i2c_props, fmt, ##arg) #define tuner_err(fmt, arg...) __tuner_err(priv->i2c_props, fmt, ##arg) #define tuner_dbg(fmt, arg...) __tuner_dbg(priv->i2c_props, fmt, ##arg) /****************************************************************************/ /* The return value of hybrid_tuner_request_state indicates the number of * instances using this tuner object. * * 0 - no instances, indicates an error - kzalloc must have failed * * 1 - one instance, indicates that the tuner object was created successfully * * 2 (or more) instances, indicates that an existing tuner object was found */ #define hybrid_tuner_request_state(type, state, list, i2cadap, i2caddr, devname)\ ({ \ int __ret = 0; \ list_for_each_entry(state, &list, hybrid_tuner_instance_list) { \ if (((i2cadap) && (state->i2c_props.adap)) && \ ((i2c_adapter_id(state->i2c_props.adap) == \ i2c_adapter_id(i2cadap)) && \ (i2caddr == state->i2c_props.addr))) { \ __tuner_info(state->i2c_props, \ "attaching existing instance\n"); \ state->i2c_props.count++; \ __ret = state->i2c_props.count; \ break; \ } \ } \ if (0 == __ret) { \ state = kzalloc(sizeof(type), GFP_KERNEL); \ if (NULL == state) \ goto __fail; \ state->i2c_props.addr = i2caddr; \ state->i2c_props.adap = i2cadap; \ state->i2c_props.name = devname; \ __tuner_info(state->i2c_props, \ "creating new instance\n"); \ list_add_tail(&state->hybrid_tuner_instance_list, &list);\ state->i2c_props.count++; \ __ret = state->i2c_props.count; \ } \ __fail: \ __ret; \ }) #define hybrid_tuner_release_state(state) \ ({ \ int __ret; \ state->i2c_props.count--; \ __ret = state->i2c_props.count; \ if (!state->i2c_props.count) { \ __tuner_info(state->i2c_props, "destroying instance\n");\ list_del(&state->hybrid_tuner_instance_list); \ kfree(state); \ } \ __ret; \ }) #define hybrid_tuner_report_instance_count(state) \ ({ \ int __ret = 0; \ if (state) \ __ret = state->i2c_props.count; \ __ret; \ }) #endif /* __TUNER_I2C_H__ */
/* linux/arch/arm/mach-s3c64xx/mach-anw6410.c * * Copyright 2008 Openmoko, Inc. * Copyright 2008 Simtec Electronics * Ben Dooks <ben@simtec.co.uk> * http://armlinux.simtec.co.uk/ * Copyright 2009 Kwangwoo Lee * Kwangwoo Lee <kwangwoo.lee@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/kernel.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/list.h> #include <linux/timer.h> #include <linux/init.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/i2c.h> #include <linux/fb.h> #include <linux/gpio.h> #include <linux/delay.h> #include <linux/dm9000.h> #include <video/platform_lcd.h> #include <video/samsung_fimd.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/mach/irq.h> #include <mach/hardware.h> #include <mach/map.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <plat/regs-serial.h> #include <linux/platform_data/i2c-s3c2410.h> #include <plat/fb.h> #include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> #include <mach/regs-gpio.h> #include <mach/gpio-samsung.h> #include <plat/samsung-time.h> #include "common.h" #include "regs-modem.h" /* DM9000 */ #define ANW6410_PA_DM9000 (0x18000000) /* A hardware buffer to control external devices is mapped at 0x30000000. * It can not be read. So current status must be kept in anw6410_extdev_status. */ #define ANW6410_VA_EXTDEV S3C_ADDR(0x02000000) #define ANW6410_PA_EXTDEV (0x30000000) #define ANW6410_EN_DM9000 (1<<11) #define ANW6410_EN_LCD (1<<14) static __u32 anw6410_extdev_status; static struct s3c2410_uartcfg anw6410_uartcfgs[] __initdata = { [0] = { .hwport = 0, .flags = 0, .ucon = 0x3c5, .ulcon = 0x03, .ufcon = 0x51, }, [1] = { .hwport = 1, .flags = 0, .ucon = 0x3c5, .ulcon = 0x03, .ufcon = 0x51, }, }; /* framebuffer and LCD setup. */ static void __init anw6410_lcd_mode_set(void) { u32 tmp; /* set the LCD type */ tmp = __raw_readl(S3C64XX_SPCON); tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK; tmp |= S3C64XX_SPCON_LCD_SEL_RGB; __raw_writel(tmp, S3C64XX_SPCON); /* remove the LCD bypass */ tmp = __raw_readl(S3C64XX_MODEM_MIFPCON); tmp &= ~MIFPCON_LCD_BYPASS; __raw_writel(tmp, S3C64XX_MODEM_MIFPCON); } /* GPF1 = LCD panel power * GPF4 = LCD backlight control */ static void anw6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) { if (power) { anw6410_extdev_status |= (ANW6410_EN_LCD << 16); __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV); gpio_direction_output(S3C64XX_GPF(1), 1); gpio_direction_output(S3C64XX_GPF(4), 1); } else { anw6410_extdev_status &= ~(ANW6410_EN_LCD << 16); __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV); gpio_direction_output(S3C64XX_GPF(1), 0); gpio_direction_output(S3C64XX_GPF(4), 0); } } static struct plat_lcd_data anw6410_lcd_power_data = { .set_power = anw6410_lcd_power_set, }; static struct platform_device anw6410_lcd_powerdev = { .name = "platform-lcd", .dev.parent = &s3c_device_fb.dev, .dev.platform_data = &anw6410_lcd_power_data, }; static struct s3c_fb_pd_win anw6410_fb_win0 = { .max_bpp = 32, .default_bpp = 16, .xres = 800, .yres = 480, }; static struct fb_videomode anw6410_lcd_timing = { .left_margin = 8, .right_margin = 13, .upper_margin = 7, .lower_margin = 5, .hsync_len = 3, .vsync_len = 1, .xres = 800, .yres = 480, }; /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */ static struct s3c_fb_platdata anw6410_lcd_pdata __initdata = { .setup_gpio = s3c64xx_fb_gpio_setup_24bpp, .vtiming = &anw6410_lcd_timing, .win[0] = &anw6410_fb_win0, .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, }; /* DM9000AEP 10/100 ethernet controller */ static void __init anw6410_dm9000_enable(void) { anw6410_extdev_status |= (ANW6410_EN_DM9000 << 16); __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV); } static struct resource anw6410_dm9000_resource[] = { [0] = DEFINE_RES_MEM(ANW6410_PA_DM9000, 4), [1] = DEFINE_RES_MEM(ANW6410_PA_DM9000 + 4, 501), [2] = DEFINE_RES_NAMED(IRQ_EINT(15), 1, NULL, IORESOURCE_IRQ \ | IRQF_TRIGGER_HIGH), }; static struct dm9000_plat_data anw6410_dm9000_pdata = { .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), /* dev_addr can be set to provide hwaddr. */ }; static struct platform_device anw6410_device_eth = { .name = "dm9000", .id = -1, .num_resources = ARRAY_SIZE(anw6410_dm9000_resource), .resource = anw6410_dm9000_resource, .dev = { .platform_data = &anw6410_dm9000_pdata, }, }; static struct map_desc anw6410_iodesc[] __initdata = { { .virtual = (unsigned long)ANW6410_VA_EXTDEV, .pfn = __phys_to_pfn(ANW6410_PA_EXTDEV), .length = SZ_64K, .type = MT_DEVICE, }, }; static struct platform_device *anw6410_devices[] __initdata = { &s3c_device_fb, &anw6410_lcd_powerdev, &anw6410_device_eth, }; static void __init anw6410_map_io(void) { s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); s3c64xx_set_xtal_freq(12000000); s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); anw6410_lcd_mode_set(); } static void __init anw6410_machine_init(void) { s3c_fb_set_platdata(&anw6410_lcd_pdata); gpio_request(S3C64XX_GPF(1), "panel power"); gpio_request(S3C64XX_GPF(4), "LCD backlight"); anw6410_dm9000_enable(); platform_add_devices(anw6410_devices, ARRAY_SIZE(anw6410_devices)); } MACHINE_START(ANW6410, "A&W6410") /* Maintainer: Kwangwoo Lee <kwangwoo.lee@gmail.com> */ .atag_offset = 0x100, .init_irq = s3c6410_init_irq, .map_io = anw6410_map_io, .init_machine = anw6410_machine_init, .init_late = s3c64xx_init_late, .init_time = samsung_timer_init, .restart = s3c64xx_restart, MACHINE_END
/* * Copyright 2012 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include "nv50.h" #include <subdev/timer.h> #include <nvif/class.h> static const struct nvkm_bitfield nv50_gr_status[] = { { 0x00000001, "BUSY" }, /* set when any bit is set */ { 0x00000002, "DISPATCH" }, { 0x00000004, "UNK2" }, { 0x00000008, "UNK3" }, { 0x00000010, "UNK4" }, { 0x00000020, "UNK5" }, { 0x00000040, "M2MF" }, { 0x00000080, "UNK7" }, { 0x00000100, "CTXPROG" }, { 0x00000200, "VFETCH" }, { 0x00000400, "CCACHE_PREGEOM" }, { 0x00000800, "STRMOUT_VATTR_POSTGEOM" }, { 0x00001000, "VCLIP" }, { 0x00002000, "RATTR_APLANE" }, { 0x00004000, "TRAST" }, { 0x00008000, "CLIPID" }, { 0x00010000, "ZCULL" }, { 0x00020000, "ENG2D" }, { 0x00040000, "RMASK" }, { 0x00080000, "TPC_RAST" }, { 0x00100000, "TPC_PROP" }, { 0x00200000, "TPC_TEX" }, { 0x00400000, "TPC_GEOM" }, { 0x00800000, "TPC_MP" }, { 0x01000000, "ROP" }, {} }; static const struct nvkm_bitfield nv50_gr_vstatus_0[] = { { 0x01, "VFETCH" }, { 0x02, "CCACHE" }, { 0x04, "PREGEOM" }, { 0x08, "POSTGEOM" }, { 0x10, "VATTR" }, { 0x20, "STRMOUT" }, { 0x40, "VCLIP" }, {} }; static const struct nvkm_bitfield nv50_gr_vstatus_1[] = { { 0x01, "TPC_RAST" }, { 0x02, "TPC_PROP" }, { 0x04, "TPC_TEX" }, { 0x08, "TPC_GEOM" }, { 0x10, "TPC_MP" }, {} }; static const struct nvkm_bitfield nv50_gr_vstatus_2[] = { { 0x01, "RATTR" }, { 0x02, "APLANE" }, { 0x04, "TRAST" }, { 0x08, "CLIPID" }, { 0x10, "ZCULL" }, { 0x20, "ENG2D" }, { 0x40, "RMASK" }, { 0x80, "ROP" }, {} }; static void nvkm_gr_vstatus_print(struct nv50_gr *gr, int r, const struct nvkm_bitfield *units, u32 status) { struct nvkm_subdev *subdev = &gr->base.engine.subdev; u32 stat = status; u8 mask = 0x00; char msg[64]; int i; for (i = 0; units[i].name && status; i++) { if ((status & 7) == 1) mask |= (1 << i); status >>= 3; } nvkm_snprintbf(msg, sizeof(msg), units, mask); nvkm_error(subdev, "PGRAPH_VSTATUS%d: %08x [%s]\n", r, stat, msg); } int g84_gr_tlb_flush(struct nvkm_gr *base) { struct nv50_gr *gr = nv50_gr(base); struct nvkm_subdev *subdev = &gr->base.engine.subdev; struct nvkm_device *device = subdev->device; struct nvkm_timer *tmr = device->timer; bool idle, timeout = false; unsigned long flags; char status[128]; u64 start; u32 tmp; spin_lock_irqsave(&gr->lock, flags); nvkm_mask(device, 0x400500, 0x00000001, 0x00000000); start = nvkm_timer_read(tmr); do { idle = true; for (tmp = nvkm_rd32(device, 0x400380); tmp && idle; tmp >>= 3) { if ((tmp & 7) == 1) idle = false; } for (tmp = nvkm_rd32(device, 0x400384); tmp && idle; tmp >>= 3) { if ((tmp & 7) == 1) idle = false; } for (tmp = nvkm_rd32(device, 0x400388); tmp && idle; tmp >>= 3) { if ((tmp & 7) == 1) idle = false; } } while (!idle && !(timeout = nvkm_timer_read(tmr) - start > 2000000000)); if (timeout) { nvkm_error(subdev, "PGRAPH TLB flush idle timeout fail\n"); tmp = nvkm_rd32(device, 0x400700); nvkm_snprintbf(status, sizeof(status), nv50_gr_status, tmp); nvkm_error(subdev, "PGRAPH_STATUS %08x [%s]\n", tmp, status); nvkm_gr_vstatus_print(gr, 0, nv50_gr_vstatus_0, nvkm_rd32(device, 0x400380)); nvkm_gr_vstatus_print(gr, 1, nv50_gr_vstatus_1, nvkm_rd32(device, 0x400384)); nvkm_gr_vstatus_print(gr, 2, nv50_gr_vstatus_2, nvkm_rd32(device, 0x400388)); } nvkm_wr32(device, 0x100c80, 0x00000001); nvkm_msec(device, 2000, if (!(nvkm_rd32(device, 0x100c80) & 0x00000001)) break; ); nvkm_mask(device, 0x400500, 0x00000001, 0x00000001); spin_unlock_irqrestore(&gr->lock, flags); return timeout ? -EBUSY : 0; } static const struct nvkm_gr_func g84_gr = { .init = nv50_gr_init, .intr = nv50_gr_intr, .chan_new = nv50_gr_chan_new, .tlb_flush = g84_gr_tlb_flush, .units = nv50_gr_units, .sclass = { { -1, -1, NV_NULL_CLASS, &nv50_gr_object }, { -1, -1, NV50_TWOD, &nv50_gr_object }, { -1, -1, NV50_MEMORY_TO_MEMORY_FORMAT, &nv50_gr_object }, { -1, -1, NV50_COMPUTE, &nv50_gr_object }, { -1, -1, G82_TESLA, &nv50_gr_object }, {} } }; int g84_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr) { return nv50_gr_new_(&g84_gr, device, index, pgr); }
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_FTRACE_H #define _ASM_X86_FTRACE_H #ifdef CONFIG_FUNCTION_TRACER #ifndef CC_USING_FENTRY # error Compiler does not support fentry? #endif # define MCOUNT_ADDR ((unsigned long)(__fentry__)) #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ #ifdef CONFIG_DYNAMIC_FTRACE #define ARCH_SUPPORTS_FTRACE_OPS 1 #endif #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR #ifndef __ASSEMBLY__ extern atomic_t modifying_ftrace_code; extern void __fentry__(void); static inline unsigned long ftrace_call_adjust(unsigned long addr) { /* * addr is the address of the mcount call instruction. * recordmcount does the necessary offset calculation. */ return addr; } /* * When a ftrace registered caller is tracing a function that is * also set by a register_ftrace_direct() call, it needs to be * differentiated in the ftrace_caller trampoline. To do this, we * place the direct caller in the ORIG_AX part of pt_regs. This * tells the ftrace_caller that there's a direct caller. */ static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, unsigned long addr) { /* Emulate a call */ regs->orig_ax = addr; } #ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS struct ftrace_regs { struct pt_regs regs; }; static __always_inline struct pt_regs * arch_ftrace_get_regs(struct ftrace_regs *fregs) { /* Only when FL_SAVE_REGS is set, cs will be non zero */ if (!fregs->regs.cs) return NULL; return &fregs->regs; } #define ftrace_instruction_pointer_set(fregs, _ip) \ do { (fregs)->regs.ip = (_ip); } while (0) struct ftrace_ops; #define ftrace_graph_func ftrace_graph_func void ftrace_graph_func(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *op, struct ftrace_regs *fregs); #else #define FTRACE_GRAPH_TRAMP_ADDR FTRACE_GRAPH_ADDR #endif #ifdef CONFIG_DYNAMIC_FTRACE struct dyn_arch_ftrace { /* No extra data needed for x86 */ }; #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ #ifndef __ASSEMBLY__ #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE) extern void set_ftrace_ops_ro(void); #else static inline void set_ftrace_ops_ro(void) { } #endif #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) { /* * Compare the symbol name with the system call name. Skip the * "__x64_sys", "__ia32_sys", "__do_sys" or simple "sys" prefix. */ return !strcmp(sym + 3, name + 3) || (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) || (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)) || (!strncmp(sym, "__do_sys", 8) && !strcmp(sym + 8, name + 3)); } #ifndef COMPILE_OFFSETS #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION) #include <linux/compat.h> /* * Because ia32 syscalls do not map to x86_64 syscall numbers * this screws up the trace output when tracing a ia32 task. * Instead of reporting bogus syscalls, just do not trace them. * * If the user really wants these, then they should use the * raw syscall tracepoints with filtering. */ #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1 static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) { return in_32bit_syscall(); } #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ #endif /* !COMPILE_OFFSETS */ #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_FTRACE_H */
#ifndef _STDARG_H #define _STDARG_H #define va_list __builtin_va_list #define va_start(ap, last) __builtin_va_start(ap, last) #define va_end(ap) __builtin_va_end(ap) #define va_copy(to, from) __builtin_va_copy(to, from) #define va_arg(to, type) __builtin_va_arg(to, type) #endif
/* * Copyright © 2000-2002 Atheros Communications, Inc., All Rights Reserved. * * Defines exported routines from ar5212Phy.c * * $Id: //depot/sw/branches/AV_dev/src/hal/ar5212/ar5212Phy.h#1 $ */ #ifndef _AR5212_PHY_H #define _AR5212_PHY_H #ifdef _cplusplus extern "C" { #endif extern void ar5212AttachRateTables(WLAN_DEV_INFO *pDev); #ifdef _cplusplus } #endif #endif /* _AR5212_PHY_H */
#pragma once #include "initiation/negotiation/sdptypes.h" #include <QObject> #include <QMutex> #include <QList> #include <memory> #include <map> #ifndef _MSC_VER #ifdef _WIN32 #include <inaddr.h> #else #include <netinet/ip.h> #endif #else #include <WinSock2.h> #endif // Manages the Media delivery and Media Processing and the interaction between the two // especially during construction. class VideoviewFactory; class StatisticsInterface; class Delivery; class FilterGraph; class MediaSession; struct MediaInfo; typedef int16_t PeerID; class MediaManager : public QObject { Q_OBJECT public: MediaManager(); ~MediaManager(); // make sure viewfactory is iniated before this void init(std::shared_ptr<VideoviewFactory> viewfactory, StatisticsInterface *stats); void uninit(); // registers a contact for activity monitoring void registerContact(in_addr ip); void addParticipant(uint32_t sessionID, const std::shared_ptr<SDPMessageInfo> peerInfo, const std::shared_ptr<SDPMessageInfo> localInfo); void removeParticipant(uint32_t sessionID); // Functions that enable using Kvazzup as just a streming client for whatever reason. void streamToIP(in_addr ip, uint16_t port); void receiveFromIP(in_addr ip, uint16_t port); signals: void handleZRTPFailure(uint32_t sessionID); void handleNoEncryption(); // somebody is calling void incomingCall(unsigned int participantID); // our call was not accepted void callRejected(unsigned int participantID); // somebody muted their mic void mutedMic(unsigned int participantID); // somebody left the call we are in void participantDropped(unsigned int participantID); // Somebody came online or went offline void statusChanged(unsigned int participantID, bool online); // the host has quit the call and we have been chosen to become the new host (ability to kick people) void becameHost(); void updateVideoSettings(); void updateAudioSettings(); private: void createOutgoingMedia(uint32_t sessionID, const MediaInfo& localMedia, QString peerGlobalAddress, const MediaInfo& remoteMedia); void createIncomingMedia(uint32_t sessionID, const MediaInfo& localMedia, QString localGlobalAddress, const MediaInfo& remoteMedia, uint32_t videoID); QString rtpNumberToCodec(const MediaInfo& info); void transportAttributes(const QList<SDPAttributeType> &attributes, bool& send, bool& recv); void sdpToStats(uint32_t sessionID, std::shared_ptr<SDPMessageInfo> sdp, bool incoming); StatisticsInterface* stats_; std::unique_ptr<FilterGraph> fg_; std::unique_ptr<Delivery> streamer_; std::shared_ptr<VideoviewFactory> viewfactory_; };
/* $OpenBSD: pci_machdep.h,v 1.27 2015/07/17 22:42:09 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.7 1997/06/06 23:29:18 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1994 Charles Hannum. 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 acknowledgement: * This product includes software developed by Charles Hannum. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Machine-specific definitions for PCI autoconfiguration. */ /* * i386-specific PCI structure and type definitions. * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. * * Configuration tag; created from a {bus,device,function} triplet by * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write(). * We could instead always pass the {bus,device,function} triplet to * the read and write routines, but this would cause extra overhead. * * Mode 2 is historical and deprecated by the Revision 2.0 specification. */ union i386_pci_tag_u { u_int32_t mode1; struct { u_int16_t port; u_int8_t enable; u_int8_t forward; } mode2; }; extern struct bus_dma_tag pci_bus_dma_tag; /* * Types provided to machine-independent PCI code */ typedef void *pci_chipset_tag_t; typedef union i386_pci_tag_u pcitag_t; typedef struct { pcitag_t tag; int line, pin; void *link; } pci_intr_handle_t; /* * i386-specific PCI variables and functions. * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ extern int pci_mode; extern bus_addr_t pci_mcfg_addr; extern int pci_mcfg_min_bus, pci_mcfg_max_bus; int pci_mode_detect(void); extern struct extent *pciio_ex; extern struct extent *pcimem_ex; extern struct extent *pcibus_ex; void pci_init_extents(void); /* * Functions provided to machine-independent PCI code. */ void pci_attach_hook(struct device *, struct device *, struct pcibus_attach_args *); int pci_bus_maxdevs(pci_chipset_tag_t, int); pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); int pci_conf_size(pci_chipset_tag_t, pcitag_t); pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); struct pci_attach_args; int pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *); int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); #define pci_intr_line(c, ih) ((ih).line) const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int, int (*)(void *), void *, const char *); void pci_intr_disestablish(pci_chipset_tag_t, void *); void pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *); #define pci_probe_device_hook(c, a) (0) void pci_dev_postattach(struct device *, struct pci_attach_args *); pcireg_t pci_min_powerstate(pci_chipset_tag_t, pcitag_t); void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int); /* * Section 6.2.4, `Miscellaneous Functions' of the PIC Specification, * says that 255 means `unknown' or `no connection' to the interrupt * controller on a PC. */ #define I386_PCI_INTERRUPT_LINE_NO_CONNECTION 0xff /* * PCI address space is shared with ISA, so avoid legacy ISA I/O * registers. */ #define PCI_IO_START 0x400 #define PCI_IO_END 0xffff /* * Avoid the DOS Compatibility Memory area. */ #define PCI_MEM_START 0x100000
/* * Generated by class-dump 3.1.2. * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. */ #import "_ADBannerContentSizeIdentifierLandscape.h" @class GADSession; @interface GADApplication : _ADBannerContentSizeIdentifierLandscape { BOOL _appFinishedLaunching; GADSession *_currentSession; } + (id)sharedApplication; + (void)load; - (void)setAppFinishedLaunching:(BOOL)fp8; - (BOOL)appFinishedLaunching; - (void)setCurrentSession:(id)fp8; - (id)currentSession; - (id)iTunesMetadata; - (id)iTunesMetadataPath; - (BOOL)isAppActive; - (void)runEarlyActivities; - (void)dealloc; - (id)init; @end
/* * Copyright (c) 2014 Travis Geiselbrecht * * Use of this source code is governed by a MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT */ #include <dev/timer/arm_cortex_a9.h> #include <lk/debug.h> #include <sys/types.h> #include <lk/err.h> #include <stdio.h> #include <assert.h> #include <lk/trace.h> #include <lib/fixed_point.h> #include <kernel/thread.h> #include <kernel/spinlock.h> #include <platform.h> #include <platform/interrupts.h> #include <platform/timer.h> #include <lk/init.h> /* driver for cortex-a9's private timer */ #define LOCAL_TRACE 0 /* interrupts for cortex-a9 timer and watchdog */ #define CPU_GLOB_TIMER_INT 27 #define CPU_PRIV_TIMER_INT 29 #define CPU_WATCHDOG_INT 30 /* offsets into the per cpu private scu base */ #define GLOBAL_TIMER_OFFSET (0x0200) #define PRIV_TIMER_OFFSET (0x0600) #define TIMREG(reg) (*REG32(scu_control_base + PRIV_TIMER_OFFSET + (reg))) #define TIMER_LOAD (0x00) #define TIMER_COUNTER (0x04) #define TIMER_CONTROL (0x08) #define TIMER_ISR (0x0c) #define WDOG_LOAD (0x20) #define WDOG_COUNTER (0x24) #define WDOG_CONTROL (0x28) #define WDOG_ISR (0x2c) #define GTIMREG(reg) (*REG32(scu_control_base + GLOBAL_TIMER_OFFSET + (reg))) #define GTIMER_COUNT_LO (0x00) #define GTIMER_COUNT_HI (0x04) #define GTIMER_CONTROL (0x08) #define GTIMER_ISR (0x0c) #define GTIMER_COMPARE_LO (0x10) #define GTIMER_COMPARE_HI (0x14) #define GTIMER_INCREMENT (0x18) static platform_timer_callback t_callback; static addr_t scu_control_base; static spin_lock_t lock = SPIN_LOCK_INITIAL_VALUE; static lk_time_t periodic_interval; static lk_time_t oneshot_interval; static uint32_t timer_freq; static struct fp_32_64 timer_freq_msec_conversion; static struct fp_32_64 timer_freq_usec_conversion_inverse; static struct fp_32_64 timer_freq_msec_conversion_inverse; static void arm_cortex_a9_timer_init_percpu(uint level); uint64_t get_global_val(void) { uint32_t lo, hi; retry: hi = GTIMREG(GTIMER_COUNT_HI); lo = GTIMREG(GTIMER_COUNT_LO); if (GTIMREG(GTIMER_COUNT_HI) != hi) goto retry; return ((uint64_t)hi << 32 | lo); } lk_bigtime_t current_time_hires(void) { lk_bigtime_t time; time = u64_mul_u64_fp32_64(get_global_val(), timer_freq_usec_conversion_inverse); return time; } lk_time_t current_time(void) { lk_time_t time; time = u32_mul_u64_fp32_64(get_global_val(), timer_freq_msec_conversion_inverse); return time; } status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval) { LTRACEF("callback %p, arg %p, interval %u\n", callback, arg, interval); uint64_t ticks = u64_mul_u64_fp32_64(interval, timer_freq_msec_conversion); if (unlikely(ticks == 0)) ticks = 1; if (unlikely(ticks > 0xffffffff)) ticks = 0xffffffff; spin_lock_saved_state_t state; spin_lock_irqsave(&lock, state); t_callback = callback; periodic_interval = interval; // disable timer TIMREG(TIMER_CONTROL) = 0; TIMREG(TIMER_LOAD) = ticks; TIMREG(TIMER_CONTROL) = (1<<2) | (1<<1) | (1<<0); // irq enable, autoreload, enable spin_unlock_irqrestore(&lock, state); return NO_ERROR; } status_t platform_set_oneshot_timer (platform_timer_callback callback, void *arg, lk_time_t interval) { LTRACEF("callback %p, arg %p, timeout %u\n", callback, arg, interval); uint64_t ticks = u64_mul_u64_fp32_64(interval, timer_freq_msec_conversion); if (unlikely(ticks == 0)) ticks = 1; if (unlikely(ticks > 0xffffffff)) ticks = 0xffffffff; spin_lock_saved_state_t state; spin_lock_irqsave(&lock, state); t_callback = callback; oneshot_interval = interval; // disable timer TIMREG(TIMER_CONTROL) = 0; TIMREG(TIMER_LOAD) = ticks; TIMREG(TIMER_CONTROL) = (1<<2) | (1<<0) | (1<<0); // irq enable, oneshot, enable spin_unlock_irqrestore(&lock, state); return NO_ERROR; } void platform_stop_timer(void) { LTRACE; TIMREG(TIMER_CONTROL) = 0; } static enum handler_return platform_tick(void *arg) { LTRACE; TIMREG(TIMER_ISR) = 1; // ack the irq if (t_callback) { return t_callback(arg, current_time()); } else { return INT_NO_RESCHEDULE; } } void arm_cortex_a9_timer_init(addr_t _scu_control_base, uint32_t freq) { scu_control_base = _scu_control_base; arm_cortex_a9_timer_init_percpu(0); /* save the timer frequency for later calculations */ timer_freq = freq; /* precompute the conversion factor for global time to real time */ fp_32_64_div_32_32(&timer_freq_msec_conversion, timer_freq, 1000); fp_32_64_div_32_32(&timer_freq_usec_conversion_inverse, 1000000, timer_freq); fp_32_64_div_32_32(&timer_freq_msec_conversion_inverse, 1000, timer_freq); } static void arm_cortex_a9_timer_init_percpu(uint level) { /* disable timer */ TIMREG(TIMER_CONTROL) = 0; /* kill the watchdog */ TIMREG(WDOG_CONTROL) = 0; /* ack any irqs that may be pending */ TIMREG(TIMER_ISR) = 1; /* register the platform tick on each cpu */ register_int_handler(CPU_PRIV_TIMER_INT, &platform_tick, NULL); unmask_interrupt(CPU_PRIV_TIMER_INT); } /* secondary cpu initialize the timer just before the kernel starts with interrupts enabled */ LK_INIT_HOOK_FLAGS(arm_cortex_a9_timer_init_percpu, arm_cortex_a9_timer_init_percpu, LK_INIT_LEVEL_THREADING - 1, LK_INIT_FLAG_SECONDARY_CPUS);
#ifndef GAMESTRUCTS #define GAMESTRUCTS struct field { unsigned char color; bool marked; }; enum GameMode_t { modeNormal=1, modeContinious, modeShifter, modeMegaShifter, modeBricks }; struct settings_t { bool UseBitmaps; bool AlternativeColors; bool Sound; bool Shade; GameMode_t GameMode; bool QuickMode; bool Bubble; bool Animation; bool ShowStatus; // PDAMode // Animation }; struct score_t { BString Name; int Score; int LongestChain; BString Date; }; #endif
/* ---------------------------------------------------------------------------- * ATMEL Microcontroller Software Support - ROUSSET - * ---------------------------------------------------------------------------- * Copyright (c) 2006, Atmel Corporation * 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 disclaimer below. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the disclaimer below in the documentation and/or * other materials provided with the distribution. * * Atmel's name may not be used to endorse or promote products derived from * this software without specific prior written permission. * * DISCLAIMER: 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 * 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. * ---------------------------------------------------------------------------- */ /* Title: LED About: Purpose Small set of functions for simple and portable LED usage. About: Usage 1 - Configure one or more LEDs using <LED_Configure> and <LED_ConfigureAll>. 2 - Set, clear and toggle LEDs using <LED_Set>, <LED_Clear> and <LED_Toggle>. 3 - Get the current status of a LED using <LED_Get>. LEDs are numbered starting from 0; the number of LEDs depend on the board being used. All the functions defined here will compile properly regardless of whether the LED is defined or not; they will simply return 0 when a LED which does not exist is given as an argument. Also, these functions take into account how each LED is connected on to board; thus, <LED_Set> might change the level on the corresponding pin to 0 or 1, but it will always light the LED on; same thing for the other methods. */ #ifndef LED_H #define LED_H //------------------------------------------------------------------------------ // Exported functions //------------------------------------------------------------------------------ extern unsigned char LED_Configure(unsigned int led); extern unsigned char LED_Set(unsigned int led); extern unsigned char LED_Clear(unsigned int led); extern unsigned char LED_Toggle(unsigned int led); #endif //#ifndef LED_H
/**********************************************************/ // SCRambl Advanced SCR Compiler/Assembler // This program is distributed freely under the MIT license // (See the LICENSE file provided // or copy at http://opensource.org/licenses/MIT) /**********************************************************/ #pragma once #include <vector> #include <list> #include <map> class CCLP { std::vector<const char*> m_CommandLine; std::list<std::string> m_MainOpts; std::map<std::string, std::list<std::string>> m_Options; std::map<int, std::string> m_ShortOptions; public: void AddFlag(std::string cmd, int shortcmd) { m_ShortOptions[shortcmd] = cmd; } void Parse() { std::string cmd; for (auto arg : m_CommandLine) { if (*arg == '-' || *arg == '/') { if (*arg == '-') ++arg; switch (*arg) { case '/': ++arg; case '-': // --fullflag ++arg; cmd = arg; cmd.erase(cmd.find_first_of(":=")); arg += cmd.length(); ++arg; break; default: // A char flag -f if (m_ShortOptions.find(*arg) != m_ShortOptions.end()) { cmd = m_ShortOptions[*arg++]; m_Options[cmd]; } else { // No full equivalent? Just treat it as full... cmd = *arg; auto f = cmd.find_first_of(":="); if (f != cmd.npos) cmd.erase(f); arg += cmd.length(); m_Options[cmd]; } if (*arg == ':' || *arg == '=') ++arg; break; } } // Unless we're at the end of a flag-only arg... if (*arg) { if (cmd.empty()) { // Must be the main parameters m_MainOpts.push_back(arg); } else { // Additional parameters for the last flag m_Options[cmd].push_back(arg); } } } } bool IsFlagSet(std::string flag) const { return m_Options.find(flag) != m_Options.end(); } size_t GetNumOpts() const { return m_MainOpts.size(); } const std::list<std::string> & GetOpts() const { return m_MainOpts; } const std::list<std::string> & GetFlagOpts(std::string flag) const { static std::list<std::string> bad; auto it = m_Options.find(flag); if (it != m_Options.end()) return it->second; return bad; } CCLP(const std::vector<const char*> & args) { m_CommandLine = args; } };
#ifndef H_soloInputFeatureUMI #define H_soloInputFeatureUMI #include <fstream> #include <array> #include <vector> #include "IncludeDefine.h" #include "SoloCommon.h" bool soloInputFeatureUMI(fstream *strIn, int32 featureType, bool readInfoYes, array<vector<uint64>,2> &sjAll, uint64 &iread, int32 &cbmatch, uint32 &feature, uint64 &umi, vector<uint32> &featVecU32, SoloReadFlagClass &readFlagCounts); #endif
for (int i = 0; i < 640; i++) for (int j = 0; j < 480; j++) for (int k = 0; k < 4; k++) { ... if (condition) { ... goto fim; } } } } :fim //https://pt.stackoverflow.com/q/147011/101
#pragma once #include "OpenGLCommon.h" #include "Interface/InputLayout.h" #include "Interface/VertexBuffer.h" #include "OpenGLShader.h" #include <map> #include "OpenGLTextureStorage.h" #include "OpenGLConstantBufferStorage.h" namespace krono { class ShaderVariable { public: enum Type { None, Float, Double, Int, UInt, Bool, MatF, MatD, Texture1D, Texture2D, Texture3D, TextureCube, }; ShaderVariable(); ShaderVariable(const std::string& name, int size, Type type, int count, GLuint location); ShaderVariable(const std::string& name, short width, short height, Type type, int count, GLuint location); const std::string& GetName() const; short GetWidth() const; short GetHeight() const; Type GetType() const; int GetCount() const; int GetLocation() const; bool IsTexture() const; private: std::string mName; short mWidth; short mHeight; Type mType; int mCount; GLuint mLocation; }; class OpenGLVertexLayoutData { public: OpenGLVertexLayoutData(void); OpenGLVertexLayoutData(const Attribute& attribute, GLuint attributeIndex, GLsizei offset); ~OpenGLVertexLayoutData(void); bool GetIsActive() const; GLuint GetAttributeIndex() const; GLuint GetSize() const; GLenum GetType() const; GLsizei GetByteSize() const; GLsizei GetOffset() const; private: static GLenum gTypeMapping[]; bool mIsActive; GLuint mAttributeIndex; GLuint mSize; GLenum mType; GLsizei mByteSize; GLsizei mOffset; }; class OpenGLVertexLayout { public: OpenGLVertexLayout(); OpenGLVertexLayout(GLsizei stride); ~OpenGLVertexLayout(void); void AddVertexData(const OpenGLVertexLayoutData& value); void Use() const; private: std::vector<OpenGLVertexLayoutData> mLayoutData; GLsizei mStride; }; class OpenGLShaderProgram { public: OpenGLShaderProgram(const OpenGLVertexShader& vertexShader, const OpenGLPixelShader& fragmentShader); virtual ~OpenGLShaderProgram(); virtual void Use(); const std::vector<ShaderVariable>& GetUniforms() const; const std::vector<ShaderVariable>& GetOutputs() const; void BindVertexBuffer(VertexBuffer& buffer); void MapTextures(OpenGLTextureStorage& texureStorage) const; void MapConstantBuffers(OpenGLConstantBufferStorage& constantStorage) const; protected: private: OpenGLShaderProgram(const OpenGLShaderProgram& other); OpenGLShaderProgram& operator=(const OpenGLShaderProgram& other); GLint GetProgramResource(GLenum type, GLenum resource, int index); void PopulateVariables(std::vector<ShaderVariable>& target, GLenum type); void PopulateShaderReferencing(std::vector<size_t>& target, size_t count, GLenum type); void PopulateAttributes(); void PopulateUniforms(); void PopulateOutputs(); void PopulateTextureMapping(); void PopulateConstantBufferMapping(); static const size_t MIN_SAMPLER_SUFFIX_LENGTH = 2; static const char SAMPLER_SUFFIX_CHAR = 's'; static size_t GetSamplerIndex(const std::string& uniformName); const OpenGLVertexLayout& GetLayoutMapping(const InputLayout& inputLayout); static GLuint LinkProgram(const std::vector<GLuint>& shaders); static ShaderVariable VariableFromGLType(const std::string& name, GLenum glType, int count, GLuint index); static const size_t MaxAttributeNameLength = 256; GLuint mProgram; std::map<UInt32, OpenGLVertexLayout> mLayoutMapping; std::vector<ShaderVariable> mAttributes; std::vector<ShaderVariable> mUniforms; std::vector<ShaderVariable> mOutputs; OpenGLTextureMapping mTextureMapping; OpenGLConstantBufferMapping mConstantBufferMapping; }; }
/** \file Sphere.h * \brief Class definition for an sphere. * * Licensed under the MIT License (MIT) * Copyright (c) 2014 Eder de Almeida Perez * * @author: Eder A. Perez */ #ifndef SPHERE_H #define SPHERE_H namespace fen { class Sphere { }; } #endif // SPHERE_H
#include "org_flurbo_NativeSecp256k1.h" #include "include/secp256k1.h" JNIEXPORT jint JNICALL Java_org_flurbo_NativeSecp256k1_secp256k1_1ecdsa_1verify (JNIEnv* env, jclass classObject, jobject byteBufferObject) { unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); int sigLen = *((int*)(data + 32)); int pubLen = *((int*)(data + 32 + 4)); return secp256k1_ecdsa_verify(data, 32, data+32+8, sigLen, data+32+8+sigLen, pubLen); } static void __javasecp256k1_attach(void) __attribute__((constructor)); static void __javasecp256k1_detach(void) __attribute__((destructor)); static void __javasecp256k1_attach(void) { secp256k1_start(SECP256K1_START_VERIFY); } static void __javasecp256k1_detach(void) { secp256k1_stop(); }
#include <stdio.h> #include <string.h> char * strstrpp(const char *a, const char *b) { return strstr(a, b) + 1; } typedef char *(*p[2])(const char *,const char *); int main(int argc, char const *argv[]) { p some_func; some_func[0] = strstr; some_func[1] = strstrpp; char a[] = "Hello"; char b[] = "ll"; printf("%s\n", some_func[0](a, b)); printf("%s\n", some_func[1](a, b)); return 0; }
/*********************************************************** // MISSelectedImagePreviewController.h // Mao Kebing // Created by Edu on 13-7-25. // Copyright (c) 2013 Eduapp. All rights reserved. ***********************************************************/ #import <UIKit/UIKit.h> @interface MISSelectedImagePreviewController : UIViewController /** * 选中图片的数组-引用 */ @property (nonatomic, strong) NSMutableArray* selectedImages; /** * 当前显示的序号 */ @property (nonatomic) NSInteger currentIndex; /** * 图片删除操作时的回调 */ @property (nonatomic, copy) void (^imageDidChangeBlock)(void); @end
/***************************************************************************** * Copyright (c) 2019 FrontISTR Commons * This software is released under the MIT License, see LICENSE.txt *****************************************************************************/ #ifndef HECMW_VIS_RAY_TRACE_H_INCLUDED #define HECMW_VIS_RAY_TRACE_H_INCLUDED /* #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <memory.h> #include <ctype.h> #include "hecmw_vis_resampling.h" #include "hecmw_vis_bmp.h" #include "hecmw_vis_comm_util.h" */ #define MASTER_PE 0 /* #define CONVERSE_ORDER #include <sys/types.h> #include <sys/timeb.h> #include <time.h> #include "glos.h" #include <GL/gl.h> #include <GL/glu.h> #include <GL/glaux.h> */ #define EPSILON 0.00000001 #define PI 3.1415926 /*#define TABLE_SIZE 100 #define VERTEX_PACK 50 #define POLYGON_PACK 100 #define VERTEX_KIND 27 #define HEX_N_NODE 8 #define HEX_N_FACE 6 #define HEX_NODE_INDEX 255 #define HEX_FACE_INDEX 63 */ #define SQR(x) (x) * (x) #define HASH_TABLE_SIZE 10000 /*#define ResSize 1 #define PixelSize 1 */ #define DIGN_PE 2 #define BAR_WIDTH 10 #define NUM_CONTROL_PVR 51 #define MAX_N_NODE 20 typedef struct _vr_parameter_struct { int max_level; int xr; int yr; int projection_style; int num_of_lights; double *light_point; double view_point_d[3]; double screen_point[3]; double up[3]; double k_ads[3]; int surface_on; double surface_opacity; int color_mapping_style; int interval_mapping_num; double *interval_point; /* 2:mincolor, maxcolor 3: interval_mapping_num*2 (value, mark_value) */ int transfer_function_style; /* 1: constant input: value 2: first-order derivatives input: none 3: feature points input: num_of_featurepoints, point[num] 4: feature intervals input: num_of_intervals point[num*2] 5: distance inverse 6: distance proportional 7: look-up table input: name of the look-up table file */ double opa_value; int num_of_features; double *fea_point; char name_lookup[128]; int rotate_style; int color_mapping_bar_on; int scale_marking_on; int num_of_frames; char name_voxelfile[128]; double background_color[3]; double font_color[3]; int color_system_type; double font_size; int color_bar_style; int fixed_range_on; double range_value[2]; int num_of_scale; int mark_0_on; int histogram_on; int remove_0_display_on; int specified_level[3]; char color_comp_name[100]; int color_comp; char color_subcomp_name[5]; int color_subcomp; int nv_xyz[3]; double display_range[6]; int time_mark_on; int fixed_scale_mark; } Parameter_vr; typedef struct _pvr_link_struct { int num_of_pvr; Parameter_vr *vr; struct _pvr_link_struct *next_pvr; int stat_para[NUM_CONTROL_PVR]; int visual_start_step; int visual_end_step; int visual_interval_step; } PVR_link; typedef struct surface_info_struct { int num; double *surf_data; } Surface_info; typedef struct _data_structured_vr_struct { double dxyz[3]; int leveltot; int varnumtot; char **varname; int nxyz[3]; double xyz0[3]; int voxtotadd; int voxtotall; /* int *rlevel; int *parent; */ int r_nxyz[3]; double r_dxyz[3]; int *empty_flag; double *var; double *grad_var; Surface_info *surface; } VR_data; typedef struct _tree_pointer_struct { int cell_id[8]; int surf_id; int level; double bound_box[6]; int local_child_no; int local_face_in; int local_face_out; struct _tree_pointer_struct *child; struct _tree_pointer_struct *parent; } Tree_pointer; typedef Tree_pointer *Tree_pointer_ptr; /* typedef struct _ray_volume_struct { Elem_no elem_id; int face_id; double p[3]; struct _ray_volume_struct *next_elem; } Ray_volume; typedef struct _head_ray_volume_struct { int elem_num; Ray_volume *next_elem; } Head_ray_volume; */ int find_first_inter(double point_o[3], double view_point_d[3], int r_level[3], double orig_xyz[3], double dxyz[3], double r_dxyz[3], double ray_direction[3], double first_p[3], int ijk[3]); void ray_trace(int remove_0_display_on, int color_mapping_style, double *interval_point, int transfer_function_style, double opa_value, int num_of_features, double *fea_point, double view_point_d[3], int interval_mapping_num, int color_system_type, int num_of_lights, double *light_point, double k_ads[3], double orig_xyz[3], double dxyz[3], double r_dxyz[3], int r_level[3], int *empty_flag, double *var, double *grad_var, double first_p[3], int first_ijk[3], double ray_direction[3], double mincolor, double maxcolor, double accum_rgba[4], double grad_minmax[2], double feap_minmax[2], double feai_minmax[2], double dis_minmax[2], double *opa_table, double tav_length, int time_step, int test_i, int test_j); #endif /* HECMW_VIS_RAY_TRACE_H_INCLUDED */
/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2009 Sam Lantinga 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 St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #include "SDL_config.h" #ifdef SDL_TIMER_WINCE #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <mmsystem.h> #include "SDL_thread.h" #include "SDL_timer.h" #include "../SDL_timer_c.h" static Uint64 start_date; static Uint64 start_ticks; static Uint64 wce_ticks(void) { return((Uint64)GetTickCount()); } static Uint64 wce_date(void) { union { FILETIME ftime; Uint64 itime; } ftime; SYSTEMTIME stime; GetSystemTime(&stime); SystemTimeToFileTime(&stime,&ftime.ftime); ftime.itime/=10000; // Convert 100ns intervals to 1ms intervals // Remove ms portion, which can't be relied on ftime.itime -= (ftime.itime % 1000); return(ftime.itime); } static Sint32 wce_rel_ticks(void) { return((Sint32)(wce_ticks()-start_ticks)); } static Sint32 wce_rel_date(void) { return((Sint32)(wce_date()-start_date)); } /* Return time in ms relative to when SDL was started */ Uint32 SDL_GetTicks() { Sint32 offset=wce_rel_date()-wce_rel_ticks(); if((offset < -1000) || (offset > 1000)) { // fprintf(stderr,"Time desync(%+d), resyncing\n",offset/1000); start_ticks-=offset; } return((Uint32)wce_rel_ticks()); } /* Give up approx. givem milliseconds to the OS. */ void SDL_Delay(Uint32 ms) { Sleep(ms); } /* Recard start-time of application for reference */ void SDL_StartTicks(void) { start_date=wce_date(); start_ticks=wce_ticks(); } static UINT WIN_timer; #if ( _WIN32_WCE <= 420 ) static HANDLE timersThread = 0; static HANDLE timersQuitEvent = 0; DWORD TimersThreadProc(void *data) { while(WaitForSingleObject(timersQuitEvent, 10) == WAIT_TIMEOUT) { SDL_ThreadedTimerCheck(); } return 0; } int SDL_SYS_TimerInit(void) { // create a thread to process a threaded timers // SetTimer does not suit the needs because // TimerCallbackProc will be called only when WM_TIMER occured timersQuitEvent = CreateEvent(0, TRUE, FALSE, 0); if( !timersQuitEvent ) { SDL_SetError("Cannot create event for timers thread"); return -1; } timersThread = CreateThread(NULL, 0, TimersThreadProc, 0, 0, 0); if( !timersThread ) { SDL_SetError("Cannot create timers thread, check amount of RAM available"); return -1; } SetThreadPriority(timersThread, THREAD_PRIORITY_HIGHEST); return(SDL_SetTimerThreaded(1)); } void SDL_SYS_TimerQuit(void) { SetEvent(timersQuitEvent); if( WaitForSingleObject(timersThread, 2000) == WAIT_TIMEOUT ) TerminateThread(timersThread, 0); CloseHandle(timersThread); CloseHandle(timersQuitEvent); return; } #else #pragma comment(lib, "mmtimer.lib") /* Data to handle a single periodic alarm */ static UINT timerID = 0; static void CALLBACK HandleAlarm(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { SDL_ThreadedTimerCheck(); } int SDL_SYS_TimerInit(void) { MMRESULT result; /* Set timer resolution */ result = timeBeginPeriod(TIMER_RESOLUTION); if ( result != TIMERR_NOERROR ) { SDL_SetError("Warning: Can't set %d ms timer resolution", TIMER_RESOLUTION); } /* Allow 10 ms of drift so we don't chew on CPU */ timerID = timeSetEvent(TIMER_RESOLUTION,1,HandleAlarm,0,TIME_PERIODIC); if ( ! timerID ) { SDL_SetError("timeSetEvent() failed"); return(-1); } return(SDL_SetTimerThreaded(1)); } void SDL_SYS_TimerQuit(void) { if ( timerID ) { timeKillEvent(timerID); } timeEndPeriod(TIMER_RESOLUTION); } #endif int SDL_SYS_StartTimer(void) { SDL_SetError("Internal logic error: WinCE uses threaded timer"); return(-1); } void SDL_SYS_StopTimer(void) { return; } #endif /* SDL_TIMER_WINCE */
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double Pods_LeeGoTestsVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_LeeGoTestsVersionString[];
/** ****************************************************************************** * @file SysTick/main.h * @author MCD Application Team * @version V1.0.0 * @date 09/13/2010 * @brief Header for main.c module ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" #include "STM32vldiscovery.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void TimingDelay_Decrement(void); #endif /* __MAIN_H */ /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
/* Copyright (C) 2014 Krisztian Olah email: fasza2mobile@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 ARRIVALSMODEL_H #define ARRIVALSMODEL_H #include <QAbstractListModel> #include <QObject> #include <QString> class ArrivalsContainer; //model for vehicle arrivals/departures class ArrivalsModel : public QAbstractListModel { Q_OBJECT public: enum ArrivalsRoles { IdRole = Qt::UserRole + 1, LineRole, DestinationRole, EtaRole, TowardRole, TypeRole, PlatformRole }; explicit ArrivalsModel(ArrivalsContainer* = 0, QObject *parent = 0); private: ArrivalsContainer* container; public: void beginInsert(int rows); void beginRemove(); void beginReset(); virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; void endInsert(); void endRemove(); void endReset(); void replaceContainer(const ArrivalsContainer&); virtual QHash<int,QByteArray> roleNames() const; virtual int rowCount(const QModelIndex& parent = QModelIndex() ) const; public slots: void refresh(); }; #endif // ARRIVALSMODEL_H
// // UIView+Additions.h // SpyderMate // // Created by Stanimir Nikolov on 12/10/12. // // #import <UIKit/UIKit.h> #import "CustomLoadingView.h" @interface UIView (Additions) +(CustomLoadingView*)presentCustomLoadingViewWithTitle:(NSString*)title onView:(UIView*)parentView; +(UIView*)presentBasicViewWithTitle:(NSString*)title onView:(UIView*)parentView; @end
#pragma once // © STOUT GAMES 2016 #include "Afford\Affordance.h" namespace Stout { namespace TAlpha { namespace Afford { class AlphaMan : public Stout::Afford::Base::Affordance { public: struct CallArgBoot { }; ST_AF_DECLARE_AFFORDANCE(AlphaMan) ST_AF_DECLARE_AFFORDANCE_CALL(Boot, CallArgBoot) }; } } }
#ifndef LOBBY_H_INCLUDED #define LOBBY_H_INCLUDED #include <memory> #include <vector> using namespace std; class Lobby; using LobbyRef = shared_ptr<Lobby>; class Player; using PlayerRef = shared_ptr<Player>; class Team; using TeamRef = shared_ptr<Team>; class Mode; using ModeRef = shared_ptr<Mode>; class Lobby final : public enable_shared_from_this<Lobby> { public: static LobbyRef create(const ModeRef& pMode); void notify(); int getPlayerCount() const; const ModeRef& getMode() const; bool isFull() const; void addPlayer(const PlayerRef& pPlayer); void removePlayer(const PlayerRef& pPlayer); private: Lobby(); using Teams = vector<TeamRef>; using Players = vector<PlayerRef>; Teams m_teams; ModeRef m_pMode; Players m_players; }; #endif
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2014 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_COLLIDE2_COLLIDABLE_COLLIDABLE_FILTER_H #define HK_COLLIDE2_COLLIDABLE_COLLIDABLE_FILTER_H extern const class hkClass hkpCollidableCollidableFilterClass; class hkpCollidable; /// A filter of this type is called whenever two collidables are considered for collision testing. /// This happens when a new broadphase overlap is detected. class hkpCollidableCollidableFilter { //+hk.MemoryTracker(ignore=True) public: HK_DECLARE_REFLECTION(); virtual ~hkpCollidableCollidableFilter() { } /// Returns true if the specified objects can collide. virtual hkBool isCollisionEnabled( const hkpCollidable& a, const hkpCollidable& b ) const = 0; }; #endif // HK_COLLIDE2_COLLIDABLE_COLLIDABLE_FILTER_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907) * * Confidential Information of Havok. (C) Copyright 1999-2014 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
#ifndef INCLUDE_PSTATEAIMING_H #define INCLUDE_PSTATEAIMING_H #include "StatePlayer.h" /** * The state when the player is idle. * */ class PStateAiming : public StatePlayer { public: /** * The constructor. * @param player_ : Reference to the player. */ PStateAiming(Player* const player_); /** * The destructor. */ virtual ~PStateAiming(){} /** * @see StatePlayer::enter */ virtual void enter(); /** * @see StatePlayer::exit */ virtual void exit(); /** * @see StatePlayer::handleInput */ virtual void handleInput(const std::array<bool, GameKeys::MAX> keyStates_); private: /** */ int absoluteCrosshairPlayerDistance(); }; #endif // INCLUDE_PSTATEAIMINGs_H
// // BGViewController.h // BGUtilities // // Created by Ben Gordon on 12/11/13. // Copyright (c) 2013 Ben Gordon. All rights reserved. // #import <UIKit/UIKit.h> @interface BGViewController : UIViewController @end
#define BUTTON0 "B18" #define BUTTON1 "D18" #define BUTTON2 "E18" #define BUTTON3 "H13"
/** * Swaggy Jenkins * Jenkins API clients generated from Swagger / Open API specification * * OpenAPI spec version: 1.1.2-pre.0 * Contact: blah@cliffano.com * * NOTE: This class is auto generated by OpenAPI Generator * https://github.com/OpenAPITools/openapi-generator * Do not edit the class manually. */ #pragma once #include "OpenAPIBaseModel.h" #include "OpenAPIInputStepImpl.h" #include "OpenAPIPipelineStepImpllinks.h" namespace OpenAPI { /* * OpenAPIPipelineStepImpl * * */ class OPENAPI_API OpenAPIPipelineStepImpl : public Model { public: virtual ~OpenAPIPipelineStepImpl() {} bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final; void WriteJson(JsonWriter& Writer) const final; TOptional<FString> _Class; TOptional<OpenAPIPipelineStepImpllinks> Links; TOptional<FString> DisplayName; TOptional<int32> DurationInMillis; TOptional<FString> Id; TOptional<OpenAPIInputStepImpl> Input; TOptional<FString> Result; TOptional<FString> StartTime; TOptional<FString> State; }; }
/* * Copyright (c) 2020 Sekhar Bhattacharya * * SPDX-License-Identifier: MIT */ #include <kernel/proc/proc_thread.h> #include <kernel/proc/proc_scheduler.h> #include <kernel/kassert.h> #include <kernel/lock.h> void lock_acquire_exclusive(lock_t *lock) { kassert(lock != NULL); spinlock_acquire_irq(&lock->interlock); // Exclusive locks can only be owned if no one else has the lock while (lock->state != LOCK_STATE_FREE) { // If the lock is owned in shared state then it needs to be upgraded // Track the thread with the lowest virtual runtime requesting exclusive upgrade if (lock->state == LOCK_STATE_SHARED) { lock->thread = proc_thread_current(); lock->state = LOCK_STATE_EXCLUSIVE_UPGRADE; } else if (lock->state == LOCK_STATE_EXCLUSIVE_UPGRADE && proc_scheduler_deserve(proc_thread_current(), lock->thread)) { lock->thread = proc_thread_current(); } proc_thread_sleep(lock, &lock->interlock, false); spinlock_acquire_irq(&lock->interlock); } lock->thread = proc_thread_current(); lock->state = LOCK_STATE_EXCLUSIVE; spinlock_release_irq(&lock->interlock); } void lock_acquire_shared(lock_t *lock) { kassert(lock != NULL); spinlock_acquire_irq(&lock->interlock); // Shared locks can only be owned if the lock is free or already being shared. Special case for locks waiting to be // upgraded to exclusive; only threads with a lower virtual runtime then the thread requesting exclusive access may // acquire shared ownership of the lock while (lock->state == LOCK_STATE_EXCLUSIVE || (lock->state == LOCK_STATE_EXCLUSIVE_UPGRADE && proc_scheduler_deserve(lock->thread, proc_thread_current()))) { proc_thread_sleep(lock, &lock->interlock, false); spinlock_acquire_irq(&lock->interlock); } lock->shared_count++; if (lock->state != LOCK_STATE_EXCLUSIVE_UPGRADE) lock->state = LOCK_STATE_SHARED; spinlock_release_irq(&lock->interlock); } bool lock_try_acquire_exclusive(lock_t *lock) { kassert(lock != NULL); spinlock_acquire_irq(&lock->interlock); if (lock->state != LOCK_STATE_FREE) return false; lock->thread = proc_thread_current(); lock->state = LOCK_STATE_EXCLUSIVE; spinlock_release_irq(&lock->interlock); return true; } bool lock_try_acquire_shared(lock_t *lock) { kassert(lock != NULL); spinlock_acquire_irq(&lock->interlock); if (lock->state == LOCK_STATE_EXCLUSIVE || (lock->state == LOCK_STATE_EXCLUSIVE_UPGRADE && proc_scheduler_deserve(lock->thread, proc_thread_current()))) { return false; } lock->shared_count++; if (lock->state != LOCK_STATE_EXCLUSIVE_UPGRADE) lock->state = LOCK_STATE_SHARED; spinlock_release_irq(&lock->interlock); return true; } void lock_release_exclusive(lock_t *lock) { kassert(lock != NULL); spinlock_acquire_irq(&lock->interlock); kassert(lock->state == LOCK_STATE_EXCLUSIVE && lock->thread == proc_thread_current()); lock->thread = NULL; lock->state = LOCK_STATE_FREE; spinlock_release_irq(&lock->interlock); // Wakeup threads waiting for this lock proc_thread_wake(lock, -1); } void lock_release_shared(lock_t *lock) { kassert(lock != NULL); proc_thread_t *thread = NULL; bool do_wake = false; spinlock_acquire_irq(&lock->interlock); kassert(lock->shared_count > 0); // If the lock needs to be upgraded to exclusive from shared then capture the one thread to wake if (lock->state == LOCK_STATE_EXCLUSIVE_UPGRADE) thread = lock->thread; // Only set the lock state to free once all shared owners have released the lock lock->shared_count--; if (lock->shared_count == 0) { lock->state = LOCK_STATE_FREE; do_wake = true; } spinlock_release_irq(&lock->interlock); // Wakeup only the single thread waiting for the exclusive ownership of the (previously) shared lock // Otherwise wakeup all the threads waiting for this lock if (do_wake) { if (thread != NULL) { proc_thread_wake(thread, 1); } else { proc_thread_wake(lock, -1); } } }
// // DFSAnnotationView.h // Transit Mapping // // Created by daniel sweeney on 11/9/13. // Copyright (c) 2013 Daniel Sweeney. All rights reserved. // #import <MapKit/MapKit.h> @interface DFSTextAnnotationView : MKAnnotationView @end
/* See LICENSE for license details. */ /* Module: meat_trace.c Description: Stack backtrace functions. */ #include "meat_os.h" #include "meat_cfg.h" #if defined(MEAT_CFG_LEAK) #include "meat_trace.h" #if !defined(__CYGWIN__) /* For fprintf */ #include <stdio.h> /* For backtrace() */ #include <execinfo.h> /* For dladdr() */ #define __USE_GNU #include <dlfcn.h> /* For system() */ #include <stdlib.h> #endif /* #if !defined(__CYGWIN__) */ /* Function: meat_trace_init Description: */ void meat_trace_init( struct meat_ctxt * const p_ctxt, struct meat_trace * const p_trace) { (void)( p_ctxt); p_trace->b_init = 1; } /* meat_trace_init() */ /* Function: meat_trace_cleanup Description: */ void meat_trace_cleanup( struct meat_ctxt * const p_ctxt, struct meat_trace * const p_trace) { (void)( p_ctxt); p_trace->b_init = 0; } /* meat_trace_cleanup() */ /* Function: meat_trace_capture Description: */ void meat_trace_capture( struct meat_ctxt * const p_ctxt, struct meat_trace * const p_trace, void * * const a_stack, unsigned int const i_count) { (void)( p_ctxt); if ( p_trace->b_init) { #if !defined(__CYGWIN__) backtrace( a_stack, i_count); #else /* #if !defined(__CYGWIN__) */ (void)( a_stack); (void)( i_count); #endif /* #if !defined(__CYGWIN__) */ } } /* meat_trace_capture() */ /* Function: meat_trace_report Description: */ void meat_trace_report( struct meat_ctxt * const p_ctxt, struct meat_trace * const p_trace, void * * const a_stack, unsigned int const i_count) { (void)( p_ctxt); if ( p_trace->b_init) { #if !defined(__CYGWIN__) #if 0 /* fallback method */ backtrace_symbols_fd( a_stack, i_count, 1); #endif /* fallback method */ unsigned int i_index; i_index = 0u; while ( i_index < i_count) { void * p_stack_item; Dl_info o_info; int i_result; p_stack_item = a_stack[i_index]; fprintf( stdout, "[%d] %p -- ", i_index, p_stack_item); fflush( stdout); i_result = dladdr( p_stack_item, &( o_info)); if ( 0 != i_result) { char a_line[256u]; sprintf( a_line, "addr2line -e %s -f -s %p", o_info.dli_fname, p_stack_item); system(a_line); } else { fprintf( stdout, "\n"); fflush( stdout); } i_index ++; } #else /* #if !defined(__CYGWIN__) */ (void)( a_stack); (void)( i_count); #endif /* #if !defined(__CYGWIN__) */ } } /* meat_trace_report() */ #endif /* #if defined(MEAT_CFG_LEAK) */ /* end-of-file: meat_trace.c */
/*** Important: This is sample code demonstrating API, technology or techniques in development. Although this sample code has been reviewed for technical accuracy, it is not final. Apple is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein. This information is subject to change, and software implemented based on this sample code should be tested with final operating system software and final documentation. Newer versions of this sample code may be provided with future seeds of the API or technology. For information about updates to this and other developer documentation, view the New & Updated sidebars in subsequent documentation seeds. ***/ /* File: XMLDocument.h Abstract: Creates an XMLDocument from an NSString or NSURL. Version: 1.0 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (C) 2008 Apple Inc. All Rights Reserved. */ #import <Foundation/Foundation.h> #import <BMCommons/BMXMLElement.h> NS_ASSUME_NONNULL_BEGIN /** Class describing an XML document. */ @interface BMXMLDocument : NSObject /** * The root element for the document. */ @property (strong) BMXMLElement *rootElement; /** * String resulting from serialization of the receiver. */ @property (nullable, strong, readonly) NSString *XMLString; /** * Returns the XMLString, optionally formatting the output (ensuring indentation is correct). */ - (nullable NSString *)XMLStringWithFormatting:(BOOL)format; /** * Parses the specified data to an XML document. * * @param data The data to parse * @param error Error buffer in case error occurs. * @return The document or nil if unsuccessful */ + (nullable BMXMLDocument *)documentWithData:(NSData *)data error:(NSError * _Nullable * _Nonnull)error; /** * Parses the specified string to an XML document. * * @param string The string to parse * @param error Error buffer in case error occurs. * @return The document or nil if unsuccessful */ + (nullable BMXMLDocument *)documentWithXMLString:(NSString *)string error:(NSError * _Nullable * _Nonnull)error; /** * Parses data from the specified URL as an XML document. * * @param URL URL to the data to parse. * @param error Error buffer in case error occurs. * @return The document or nil if unsuccessful */ + (nullable BMXMLDocument *)documentWithContentsOfURL:(NSURL *)URL error:(NSError * _Nullable * _Nonnull)error; /** * Document from the specified root element. * * @param theRootElement The root element * @return The document */ + (BMXMLDocument *)documentWithRootElement:(BMXMLElement *)theRootElement; - (instancetype)initWithRootElement:(BMXMLElement *)theRootElement; @end NS_ASSUME_NONNULL_END
/////////////////////////////////////////////////////////////////////////////// // // File CoupledLcoalToGlobalC0ContMap.h // // For more information, please see: http://www.nektar.info // // The MIT License // // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA), // Department of Aeronautics, Imperial College London (UK), and Scientific // Computing and Imaging Institute, University of Utah (USA). // // License for the specific language governing rights and limitations under // 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. // // Description: Wrapper class around the library // LocalToGlobalC0ContMap class for use in the Couplied Linearised NS // solver. /////////////////////////////////////////////////////////////////////////////// #ifndef NEKTAR_SOLVERS_COUPLEDLOCALTOGLOBALC0CONTMAP_H #define NEKTAR_SOLVERS_COUPLEDLOCALTOGLOBALC0CONTMAP_H #include <MultiRegions/AssemblyMap/AssemblyMapCG2D.h> #include <SpatialDomains/MeshGraph.h> namespace Nektar { class CoupledLocalToGlobalC0ContMap: public MultiRegions::AssemblyMapCG2D { public: CoupledLocalToGlobalC0ContMap(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &graph, const SpatialDomains::BoundaryConditionsSharedPtr &boundaryConditions, const Array<OneD, MultiRegions::ExpListSharedPtr> &fields, const MultiRegions::ExpListSharedPtr &pressure, const int nz_loc, const bool CheeckForSingularSys=true); void FindEdgeIdToAddMeanPressure(Array<OneD, map<int,int> > &ReorderedGraphVertId, int &nel, const LocalRegions::ExpansionVector &locExpVector, int &edgeId, int &vertId, int &firstNonDirGraphVertId, map<int,int> &IsDirEdgeDof, MultiRegions::BottomUpSubStructuredGraphSharedPtr &bottomUpGraph, Array<OneD, int> &AddMeanPressureToEdgeId); }; typedef boost::shared_ptr<CoupledLocalToGlobalC0ContMap> CoupledLocalToGlobalC0ContMapSharedPtr; } #endif
#define r3print(X,F) fprintf(F, #X ": % 20.15lf % 20.15lf % 20.15lf\n", *(X), *((X)+1), *((X)+2)); static inline void r3set (double * u, double s){ u[0] = s; u[1] = s; u[2] = s; return; } static inline double r3dot (double * u, double * v){ return (u[0]*v[0] + u[1]*v[1] + u[2]*v[2]); } static inline double r3d2 (double * u, double * v){ return (u[0]-v[0])*(u[0]-v[0]) + (u[1]-v[1])*(u[1]-v[1]) + (u[2]-v[2])*(u[2]-v[2]); } static inline void r3x (double * w, double * u, double * v){ w[0] = u[1]*v[2]-u[2]*v[1]; w[1] = -u[0]*v[2]+u[2]*v[0]; w[2] = u[0]*v[1]-u[1]*v[0]; return; } static inline void r3mx (double * u, double * v, double * m){ u[0] = v[0]*m[0] + v[1]*m[1] + v[2]*m[2]; u[1] = v[0]*m[3] + v[1]*m[4] + v[2]*m[5]; u[2] = v[0]*m[6] + v[1]*m[7] + v[2]*m[8]; return; } static inline void r3scal (double * u, double c){ u[0] *= c; u[1] *= c; u[2] *= c; return; } static inline void r3adds (double * u, double * v, double c){ u[0] += c*v[0]; u[1] += c*v[1]; u[2] += c*v[2]; return; } static inline void r3add (double * u, double * v){ u[0] += v[0]; u[1] += v[1]; u[2] += v[2]; return; } static inline void r3min (double * u, double * v){ u[0] -= v[0]; u[1] -= v[1]; u[2] -= v[2]; return; } static inline void r3sum (double * w, double * u, double * v){ w[0] = u[0] + v[0]; w[1] = u[1] + v[1]; w[2] = u[2] + v[2]; return; } static inline void r3diff (double * w, double * u, double * v){ w[0] = u[0] - v[0]; w[1] = u[1] - v[1]; w[2] = u[2] - v[2]; return; } static inline void r3cp (double * u, double * v){ u[0] = v[0]; u[1] = v[1]; u[2] = v[2]; return; } static inline void r3sums (double * w, double * u, double s, double * v, double t){ w[0] = u[0]*s + v[0]*t; w[1] = u[1]*s + v[1]*t; w[2] = u[2]*s + v[2]*t; return; } static inline void r3cpsc (double * u, double * v, double c){ u[0] = v[0]*c; u[1] = v[1]*c; u[2] = v[2]*c; return; }
/* * The MIT License (MIT) * * Copyright © 2015-2016 Franklin "Snaipe" Mathieu <http://snai.pe/> * * 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 <assert.h> #include <stdint.h> #include "section.h" #include "internal.h" #ifdef _WIN32 void *get_win_section_start(const char *section) { PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER) GetModuleHandle(NULL); PIMAGE_NT_HEADERS ntHeader = ntHeader = (PIMAGE_NT_HEADERS) ((uintptr_t)(dosHeader) + (dosHeader->e_lfanew)); assert(dosHeader->e_magic == IMAGE_DOS_SIGNATURE); assert(ntHeader->Signature == IMAGE_NT_SIGNATURE); PIMAGE_SECTION_HEADER pSecHeader = IMAGE_FIRST_SECTION(ntHeader); for(int i = 0; i < ntHeader->FileHeader.NumberOfSections; i++, pSecHeader++) { if (!strncmp((char*) pSecHeader->Name, section, 8)) { return (char*) dosHeader + pSecHeader->VirtualAddress; } } return NULL; } void *get_win_section_end(const char *section) { PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER) GetModuleHandle(NULL); PIMAGE_NT_HEADERS ntHeader = ntHeader = (PIMAGE_NT_HEADERS) ((uintptr_t)(dosHeader) + (dosHeader->e_lfanew)); assert(dosHeader->e_magic == IMAGE_DOS_SIGNATURE); assert(ntHeader->Signature == IMAGE_NT_SIGNATURE); PIMAGE_SECTION_HEADER pSecHeader = IMAGE_FIRST_SECTION(ntHeader); for(int i = 0; i < ntHeader->FileHeader.NumberOfSections; i++, pSecHeader++) { if (!strncmp((char*) pSecHeader->Name, section, 8)) { return (char*) dosHeader + (size_t) pSecHeader->VirtualAddress + pSecHeader->SizeOfRawData; } } return NULL; } #endif #ifdef __APPLE__ # include <mach-o/getsect.h> # include <mach-o/dyld.h> # define BASE_IMAGE_INDEX 0 static inline void *get_real_address(void *addr) { if (!addr) return NULL; // We need to slide the section address to get a valid pointer // because ASLR will shift the image by a random offset return addr + _dyld_get_image_vmaddr_slide(BASE_IMAGE_INDEX); } void *get_osx_section_start(const char *section) { unsigned long secsize; return get_real_address(getsectdata("__DATA", section, &secsize)); } void *get_osx_section_end(const char *section) { unsigned long secsize; char *section_start = getsectdata("__DATA", section, &secsize); return get_real_address(section_start) + secsize; } #endif
// Copyright (c) 2017-2019 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_NODE_TRANSACTION_H #define BITCOIN_NODE_TRANSACTION_H #include <attributes.h> #include <feerate.h> #include <primitives/transaction.h> #include <util/error.h> class Config; struct NodeContext; struct TxId; /** * Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls. * Also used by the GUI when broadcasting a completed PSBT. * By default, a transaction with a fee rate higher than this will be rejected * by these RPCs and the GUI. This can be overridden with the maxfeerate * argument. */ static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE{COIN / 10}; /** * Submit a transaction to the mempool and (optionally) relay it to all P2P * peers. * * Mempool submission can be synchronous (will await mempool entry notification * over the CValidationInterface) or asynchronous (will submit and not wait for * notification), depending on the value of wait_callback. wait_callback MUST * NOT be set while cs_main, cs_mempool or cs_wallet are held to avoid * deadlock. * * @param[in] node reference to node context * @param[in] tx the transaction to broadcast * @param[out] err_string reference to std::string to fill with error string * if available * @param[in] max_tx_fee reject txs with fees higher than this (if 0, accept * any fee) * @param[in] relay flag if both mempool insertion and p2p relay are requested * @param[in] wait_callback wait until callbacks have been processed to avoid * stale result due to a sequentially RPC. * @return error */ [[nodiscard]] TransactionError BroadcastTransaction(NodeContext &node, const Config &config, CTransactionRef tx, std::string &err_string, Amount max_tx_fee, bool relay, bool wait_callback); #endif // BITCOIN_NODE_TRANSACTION_H
#pragma once #ifndef _PSMath_s_H_ #define _PSMath_s_H_ #include <emmintrin.h> #include <xmmintrin.h> #include "PSMath.h" #ifdef _MSC_VER #define ALIGN_16 __declspec(align(16)) #else #define ALIGN_16 __attribute__((aligned(16))) #endif namespace PSMath { template <unsigned i> float vectorGetByIndex(__m128 V) { V = _mm_shuffle_ps(V, V, _MM_SHUFFLE(i, i, i, i)); return _mm_cvtss_f32(V); } template <unsigned i> double vectorGetByIndex(__m128d V) { V = _mm_shuffle_pd(V, V, _MM_SHUFFLE(i, i, i, i)); return _mm_cvtsd_f64(V); } } #endif
#pragma once #include "task.h" #include <coffee/core/CMath> namespace Coffee { enum class LerpType { /* These functions are described for 1 -> 0 */ /* For 0 -> 1, some functions are simply 1-f(x) */ /* Reference function: * x * Surprise!*/ Linear = 1, /* Reference function: * 1-x^2 */ Exponential, /* Reference function: * max(cos(1.6x) * sin(17.2x + pi*0.5) * cos(x*0.9),0) * + max(cos(1.6x) * sin(17.0x + pi*1.5),0) */ BounceIn, /* Reference function: * 1-((x - 0.5)^3) * 4 - 0.5 */ Cubic, }; template< typename PodType = scalar, typename std::enable_if<std::is_floating_point<PodType>::value>::type* = nullptr> struct Lerp { STATICINLINE PodType Linear(PodType v, PodType target, PodType t) { return v + (target - v) * t; } STATICINLINE PodType Exponential(PodType v, PodType target, PodType t) { return v + (target - v) * CMath::pow(t, 2.f); } STATICINLINE PodType Cubed(PodType v, PodType target, PodType t) { return v + (target - v) * CMath::pow(t, 3.f); } STATICINLINE PodType Bounce(PodType v, PodType target, PodType t) { using namespace CMath; bigscalar t_ = C_CAST<bigscalar>(t); /* TODO: Remove double conversions here */ PodType scale = CMath::max( C_CAST<PodType>( CMath::cos(1.6 * t_) * CMath::cos(t_ * 0.9) * CMath::sin(17.2 * t_ + CMath::pi * 0.5)), 0.f) + CMath::max( C_CAST<scalar>( CMath::cos(1.6 * t_) * CMath::sin(17.0 * t_ + pi * 1.5)), 0.f); return v + (target - v) * (1.0f - scale); } STATICINLINE PodType Cubic(PodType v, PodType target, PodType t) { using namespace CMath; return v + (target - v) * (CMath::pow(t - 0.5f, 3.0f) * 4.f + 0.5f); } template< unsigned int Curvature = 3, typename std::enable_if< (Curvature >= 3) && (Curvature % 2 == 1)>::type* = nullptr> STATICINLINE PodType Ease(PodType v, PodType target, PodType t) { constexpr auto curv = PodType(Curvature); return v + (target - v) * (CMath::pow(t - 1.f, curv) + 1.0f); } }; template<typename PrimitiveType> /*! * \brief Storage for data related to interpolation, and also input */ struct LerpStore { Vector<PrimitiveType> source; /*!< Source values */ Vector<PrimitiveType*> values; /*!< Output location for values */ Vector<PrimitiveType> targets; /*!< Target values */ RuntimeTask::Timepoint start_time; RuntimeTask::Timepoint end_time; RuntimeTask::Duration delta; scalar timescale; scalar time; Function<void()> end_trigger; }; template< typename PrimitiveType, PrimitiveType (*Func)(PrimitiveType, PrimitiveType, scalar) > /*! * \brief Generate a RuntimeTask encapsulating interpolation state * \param values Batch of values to be interpolated * \param output Output location for values * \param targets Batch of target values * \param numValues Number of values in batch * \param timeStore Storage for the `t` variable used in interpolation * \param time How much time it should spend in total * \param timeStep How much time between each step, * could be tied against framerate * \param lock For multi-threading, allow exclusive access to values * \return */ FORCEDINLINE RuntimeTask GenLerpTask( ShPtr<LerpStore<PrimitiveType>> store, RuntimeTask::Duration const& time, RuntimeTask::Duration const& timeStep = Chrono::milliseconds(10), ShPtr<Mutex> lock = nullptr) { /* Why are we here? */ if(((store->source.size() != store->targets.size()) && (store->source.size() != store->values.size())) || store->source.size() == 0) return {}; /* Initialize state for interpolation */ store->start_time = RuntimeTask::clock::now(); store->end_time = RuntimeTask::clock::now() + time; store->delta = Chrono::milliseconds(0); store->time = 0.f; Chrono::duration<scalar> tscale = time; /* Used for scaling the delta value for duration */ store->timescale = 1.f / tscale.count(); return { [store, lock]() { if(lock) lock->lock(); auto now = RuntimeTask::clock::now(); auto then = store->start_time + store->delta; auto diff = now - then; /* Calculate a difference, we don't care much * about interruptions, as long as the deadline is met */ store->time += Chrono::duration<bigscalar>(diff).count() * store->timescale; store->delta = now - store->start_time; /* Make some temporaries, make for easier debugging */ auto& time = store->time; auto values = store->source.data(); auto targets = store->targets.data(); auto output = store->values.data(); for(szptr i = 0; i < store->source.size(); i++) (*output[i]) = Func(values[i], targets[i], time); if(RuntimeTask::clock::now() >= store->end_time) { for(szptr i = 0; i < store->source.size(); i++) (*output[i]) = targets[i]; runtime_queue_error ec; RuntimeQueue::CancelTask(RuntimeQueue::GetSelfId(ec), ec); C_ERROR_CHECK(ec); if(store->end_trigger) store->end_trigger(); } if(lock) lock->unlock(); }, {}, timeStep, RuntimeTask::Periodic, }; } } // namespace Coffee
#ifndef TURING_CALCULATOR_H_66BC65DB_AFF6_43C8_8654_D1A2801635E2 #define TURING_CALCULATOR_H_66BC65DB_AFF6_43C8_8654_D1A2801635E2 #include <deque> #include <string> #include "calculator.h" #include "cstr.h" #include "turing.h" // // turing_calculator(added flow control and label&str defines) // // [#....] comment // [@str = asdf ] define a str var named @str and value si ' asdf ' // [:label] define a lable var named @label for goto jump // // GOTO(:label) goto :label position directly // GOTO_IF(:label, cond) goto :label position if cond > 0 // YIELD() break execution // STOP() stop the machine // // EQ(x,y) return 1 if x==y, 0 otherwise // GT(x,y) return 1 if x>y, 0 otherwise // LT(x,y) return 1 if x<y, 0 otherwise // // NOT(x) return 1 if x<=0, 0 otherwise // AND(x, y) return x && y // OR(x, y) return x || y // class turing_calculator : public calculator { public: turing_calculator(); ~turing_calculator(); public: // load template<typename FwdIt> bool load_instructions(FwdIt begin, size_t sum) { return load_instructions(begin, sum, cstr_converter()); } template<typename FwdIt, typename CStrConverter> bool load_instructions(FwdIt begin, size_t sum, CStrConverter pred) { delete[] this->instructions_; this->instructions_ = new const char*[sum]; this->instructions_sum_ = sum; for(size_t i = 0; i < sum; ++i, ++begin) { this->instructions_[i] = pred(*begin); } return this->do_preprocess_instructions(); } // str defines. size_t set_str_variable(const std::string& key, const std::string& value); const char* get_str_variable(const std::string& key); const char* get_str_variable(size_t str_var_index); // label defines. int set_label_variable(const std::string& key, int value); bool fetch_label_variable(const std::string& key, int& value); public: // for machine binding bool execute_instruction(turing_machine*, int instruction_address); protected: virtual void do_reset(); virtual variable do_find_function(const char* buf, int& move); virtual bool do_preprocess_instructions(); turing_machine* get_matchine() { return machine_; } private: turing_machine* machine_; const char** instructions_; size_t instructions_sum_; bool yield_execution_; std::deque<std::string> str_variables_; }; #endif
#pragma once #include <d3d11.h> #include <SimpleMath.h> #include <fstream> #include "texture.h" #include "Shader.h" #include <vector> using namespace DirectX::SimpleMath; /* | */ class Script; namespace Engine { /* class Model { // make friends with the Graphics class friend class Graphics; private: // static vertex buffer struct StaticVertex { Vector3 position; Vector2 texture; Vector3 normal; StaticVertex() { position = Vector3(0,0,0); texture = Vector2(0,0); normal = Vector3(0,0,0); } }; // used for normal, tangent, binormal calculation struct TempVertex { float x,y,z; float tu,tv; float nx,ny,nz; }; struct Vertex { Vector3 position; Vector2 texture; Vector3 normal; Vector3 tangent; Vector3 binormal; }; struct ModelData { float x,y,z; float tu,tv; float nx,ny,nz; float tx,ty,tz; float bx,by,bz; }; struct Mesh { int Start; int Count; //std::vector<Vertex> Vertices; int IndexCount; ModelData* Model; ID3D11Buffer *VertexBuffer, *IndexBuffer; Texture* Textures; Mesh(); ~Mesh(); }; private: int m_vertexCount; std::vector<Mesh*> m_meshes; public: Model(); Model(const Model&); ~Model(); void Shutdown(); protected: bool Initialize(Graphics* graphics,std::wstring modelFilename, Texture* texture); void Render(Graphics* graphics, Shader* shader); private: bool InitializeBuffers(Graphics*); void ShutdownBuffers(); void RenderBuffers(Graphics*,Mesh* mesh); void CalculateModelVectors(); void CalculateTangentBinormal(TempVertex vertex1, TempVertex vertex2, TempVertex vertex3, Vector3& tangent,Vector3& binormal); void CalculateNormal(Vector3 tangent, Vector3 binormal, Vector3& normal); bool LoadModel(std::wstring filename); }; */ struct Material { Color Ambient; Color Diffuse; Color Specular; float SpecularPower; }; class Model { // make friends with the Graphics class friend class Graphics; private: // static vertex buffer struct StaticVertex { Vector3 position; Vector2 texture; Vector3 normal; StaticVertex() { position = Vector3(0,0,0); texture = Vector2(0,0); normal = Vector3(0,0,0); } }; // used for normal, tangent, binormal calculation struct TempVertex { float x,y,z; float tu,tv; float nx,ny,nz; }; struct Vertex { Vector3 position; Vector2 texture; Vector3 normal; Vector3 tangent; Vector3 binormal; }; struct ModelData { float x,y,z; float tu,tv; float nx,ny,nz; float tx,ty,tz; float bx,by,bz; }; struct Mesh { int Start; int Count; Texture* Textures; Material Material; Mesh(); ~Mesh(); }; private: int m_vertexCount; int m_indexCount; ModelData* m_model; ID3D11Buffer *m_vertexBuffer, *m_indexBuffer; std::vector<Mesh*> m_meshes; ShaderType m_shaderType; public: static void Bind(Script* script); static bool isInitialized; public: Model(); Model(const Model&); ~Model(); void Shutdown(); bool Initialize(Graphics* graphics,std::wstring modelFilename); void Render(Graphics* graphics); ShaderType GetShaderType() { return m_shaderType; } private: bool InitializeBuffers(Graphics*); void ShutdownBuffers(); void RenderBuffers(Graphics*); void CalculateModelVectors(); void CalculateTangentBinormal(TempVertex vertex1, TempVertex vertex2, TempVertex vertex3, Vector3& tangent,Vector3& binormal); void CalculateNormal(Vector3 tangent, Vector3 binormal, Vector3& normal); bool LoadModel(Graphics* graphics,std::wstring filename); }; ////////////// // INCLUDES // ////////////// //#include <SimpleMath.h> #include <stdlib.h> #include <time.h> /////////////////////////////////////////////////////////////////////////////// // Class name: ModelListClass /////////////////////////////////////////////////////////////////////////////// class ModelListClass { private: struct ModelInfoType { Color color; float positionX, positionY, positionZ; }; public: ModelListClass(); ModelListClass(const ModelListClass&); ~ModelListClass(); bool Initialize(int); void Shutdown(); int GetModelCount(); void GetData(int, float&, float&, float&, Color&); private: int m_modelCount; ModelInfoType* m_ModelInfoList; }; }
#include "stm32f1xx_hal.h" #include "BoardConfig/F103/BoardConfig_TimerTiming.h" /** * Function: void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim) * * Brief: * HAL tim base msp init. * * Author: * Dink * * Date: * 2017/9/10 * * Param: * htim - [in,out] If non-null, the htim. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim) { if (htim->Instance == TIM3) { /*使能TIM3时钟*/ __HAL_RCC_TIM3_CLK_ENABLE(); /*设置中断优先级,抢占优先级,子优先级*/ HAL_NVIC_SetPriority(TIM3_IRQn, BOARD_TIMER3_PRE_PRIORITY, BOARD_TIMER3_SUB_PRIORITY); /*开启ITM3中断 */ HAL_NVIC_EnableIRQ(TIM3_IRQn); } }
// // RegisterPasswordViewController.h // HuLaQuan // // Created by li xun on 16/8/2. // Copyright © 2016年 yuwubao. All rights reserved. // #import "BaseTableViewController.h" @interface RegisterPasswordViewController : BaseTableViewController @property(nonatomic,strong) NSString * mobileText; @property(nonatomic,strong) NSString * tokenVauleText; @end
// // IGRFastFilterViewCustomizer.h // IGRFastFilterView // // Created by Vitalii Parovishnyk on 1/3/17. // Copyright © 2017 IGR Software. All rights reserved. // @import Foundation; @import UIKit; @import CoreGraphics; @interface IGRFastFilterViewCustomizer : NSObject + (instancetype)defaultCustomizer; @property (nonatomic, assign) CGFloat filterBarHeight; @property (nonatomic, assign) CGSize filterBarCellSize; @property (nonatomic, strong) UIColor *filterBarCellTextColor; @property (nonatomic, strong) UIColor *filterBarCellHighlightTextColor; @property (nonatomic, assign) NSUInteger cacheSize; @end
/* * Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient> * * 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 UIBOXLAYOUT_H #define UIBOXLAYOUT_H #include "uilayout.h" // @bindclass class UIBoxLayout : public UILayout { public: UIBoxLayout(UIWidgetPtr parentWidget); void applyStyle(const OTMLNodePtr& styleNode); void addWidget(const UIWidgetPtr& widget) { update(); } void removeWidget(const UIWidgetPtr& widget) { update(); } void setSpacing(int spacing) { m_spacing = spacing; update(); } void setFitChildren(bool fitParent) { m_fitChildren = fitParent; update(); } bool isUIBoxLayout() { return true; } protected: stdext::boolean<false> m_fitChildren; int m_spacing; }; #endif
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2014 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HK_FLAG_CD_BODY_PAIR_COLLECTOR_H #define HK_FLAG_CD_BODY_PAIR_COLLECTOR_H #include <Physics2012/Collide/Agent/Query/hkpCdBodyPairCollector.h> /// hkpFlagCdBodyPairCollector collects only a boolean flag, indicating whether there is a hit or not. /// It is useful if you want to simply know whether two objects (where one or both are shape collections) /// are overlapping or not. class hkpFlagCdBodyPairCollector : public hkpCdBodyPairCollector { public: HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_AGENT, hkpFlagCdBodyPairCollector); /// Constructor calls reset(). inline hkpFlagCdBodyPairCollector(); inline virtual ~hkpFlagCdBodyPairCollector(); /// This function returns true if this class has collected a hit. inline hkBool hasHit( ) const; protected: virtual void addCdBodyPair( const hkpCdBody& bodyA, const hkpCdBody& bodyB ); }; #include <Physics2012/Collide/Query/Collector/BodyPairCollector/hkpFlagCdBodyPairCollector.inl> #endif //HK_FLAG_CD_BODY_PAIR_COLLECTOR_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907) * * Confidential Information of Havok. (C) Copyright 1999-2014 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2014 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ #ifndef HKFILTERSCENE_HKFILTERSCENEALTERMESHOPTIONS_HKCLASS_H #define HKFILTERSCENE_HKFILTERSCENEALTERMESHOPTIONS_HKCLASS_H extern const class hkClass hctAlterMeshOptionsPerMeshReorderClass; /// hctAlterMeshOptions meta information extern const class hkClass hctAlterMeshOptionsClass; /// Options describing what to do to any meshes found. class hctAlterMeshOptions { public: HK_DECLARE_REFLECTION(); /// Default constructor hctAlterMeshOptions() { } struct PerMeshReorder { HK_DECLARE_REFLECTION(); hkStringPtr m_nodeName; // mesh owner node name int m_sectionIndex; hkArray< hkStringPtr > m_triangleSelections; // an in order list of the names of the triangle selections to use to reorder with. }; // // Members // public: /// Remove indices from the meshes (unroll into the vertex buffer) hkBool m_removeIndices; //+default(false) hkArray< struct PerMeshReorder > m_triangleReorderSpec; }; #endif // HKFILTERSCENE_HKFILTERSCENEALTERMESHOPTIONS_HKCLASS_H /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907) * * Confidential Information of Havok. (C) Copyright 1999-2014 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
/* ----------------------------------------------------------------------------------- * * File CCTMXObjectGroup.h * Ported By Young-Hwan Mun * Contact xmsoft77@gmail.com * * ----------------------------------------------------------------------------------- * * Copyright (c) 2010-2013 XMSoft * Copyright (c) 2010-2013 cocos2d-x.org * Copyright (c) 2010 Neophit * Copyright (c) 2010 Ricardo Quesada * Copyright (c) 2011 Zynga Inc. * * http://www.cocos2d-x.org * * ----------------------------------------------------------------------------------- * * 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 __CCTMXObjectGroup_h__ #define __CCTMXObjectGroup_h__ #include "../cocoa/CCGeometry.h" #include "../cocoa/CCDictionary.h" NS_CC_BEGIN /** * @addtogroup tilemap_parallax_nodes * @{ */ /** * @brief CCTMXObjectGroup represents the TMX object group. * @since v0.99.0 */ class CCTMXObjectGroup : public CCObject { public : CCTMXObjectGroup ( KDvoid ); virtual ~CCTMXObjectGroup ( KDvoid ); public : inline const KDchar* getGroupName ( KDvoid ) { return m_sGroupName.c_str ( ); } inline KDvoid setGroupName ( const KDchar* szGroupName ) { m_sGroupName = szGroupName; } /** return the value for the specific property name */ CCString* propertyNamed ( const KDchar* szPropertyName ); /** * return the dictionary for the specific object name. * It will return the 1st object found on the array for the given name. */ CCDictionary* objectNamed ( const KDchar* szObjectName ); public : /** offset position of child objects */ CC_SYNTHESIZE_PASS_BY_REF ( CCPoint, m_tPositionOffset, PositionOffset ); /** list of properties stored in a dictionary */ CC_PROPERTY ( CCDictionary*, m_pProperties, Properties ); /** array of the objects */ CC_PROPERTY ( CCArray*, m_pObjects, Objects ); protected : /** name of the group */ std::string m_sGroupName; }; // end of tilemap_parallax_nodes group /// @} NS_CC_END #endif // __CCTMXObjectGroup_h__
#ifndef SERVICE_H #define SERVICE_H #include <vector> #include "models/computer.h" #include "models/csperson.h" #include "services/computerservice.h" #include "services/cspersonservice.h" #include "repositories/dbcon.h" #include <string> class Service { private: vector<CSPerson> _computerScientists; vector<Computer> _computerList; vector <string> _computerTypes; DbCon _dbCon; ComputerService _computerService; CSPersonService _cSPersonService; bool validNumber(string number); public: Service(); //Sets bool addNewPersonToList(const vector<int> computerConnectionID, const string name,const string gender, const string birthYear, const string deathYear,const string comment); bool addNewComputerToList(const vector<int> scientistConnectionID,const string name,const int designyear, const int buildyear, const string typeRealID, const bool created); bool addComputerType(const string typeName); bool removePersonFromList(const string id); bool removeComputerFromList(const string id); void updateAllLists(); void updateComputerList(); void updateComputerScientistList(); void updateComputerTypesList(); //Gets vector <string> getComputerTypesList(){return _computerTypes;} vector<CSPerson> getComputerScientistList(){return _computerScientists;} vector<Computer> getComputerList(){return _computerList;} vector<CSPerson> getScientistConntedToComputers(const int computerID); vector<Computer> getComputersConntedToCS(const int computerScientistID); vector<CSPerson> getComputerScientistTrash(); vector<Computer> getComputerTrash(); //Search vector<CSPerson> searchComputerScientist(const string searchString); vector<Computer> searchComputer(const string searchString); //Scientist Sorts void sortScientistListAlphabetically(); void sortScientistListAlphabeticallyDESC(); void sortScientistListByGender(); void sortScientistListByDeathYear(); void sortScientistListByBirthYear(); void sortScientistListByBirthYearASC(); void sortScientistListByAge(); //Computer Sorts void sortComputerListAlphabetically(); void sortComputerListAlphabeticallyDESC(); void sortComputertListByBuildYear(); void sortComputerListByDesignYear(); void sortComputerListByType(); void sortComputerListWasBuilt(); }; #endif // SERVICE_H
#include <errno.h> #include <fcntl.h> #include <sys/mman.h> #include <unistd.h> #include <mem.h> int filemap_ctor(struct map *map, char *fn) { off_t tmp; map->fd = open(fn, O_RDONLY); if (map->fd == -1) { return errno; } tmp = lseek(map->fd, 0, SEEK_END); if (tmp == -1) { close(map->fd); return errno; } map->length = tmp; map->map = mmap(0, map->length, PROT_READ, MAP_PRIVATE, map->fd, 0); if (map->map == MAP_FAILED) { close(map->fd); return errno; } return 0; }
#pragma once #ifndef EMBEDDEDUTILS_DEBUG_H #define EMBEDDEDUTILS_DEBUG_H #include <stdarg.h> #if defined(TEENSYDUINO) || defined(__AVR__) || defined(__MBED__) namespace Debug { void Assert(bool b, const char* file, int line, const char* func, const char* expr) { while (!b) { Serial.print("[ASSERT] "); Serial.print(file); Serial.print(":"); Serial.print(line); Serial.print(":"); Serial.print(func); Serial.print("() : "); Serial.println(expr); } } } #ifdef NDEBUG #define ASSERT(b) ((void)0) #define LOG_VERBOSE(s,...) ((void)0) #define LOG_NOTICE(s,...) ((void)0) #define LOG_WARNING(s,...) ((void)0) #define LOG_ERROR(s,...) ((void)0) #else // NDEBUG #define ASSERT(b) Debug::Assert((b), __FILE__, __LINE__, __func__, #b) #if 0 #define LOG_VERBOSE(s,...) Serial.printf("[Verbose] %s:%d:%s() : " s "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) #define LOG_NOTICE(s,...) Serial.printf("[Notice] %s:%d:%s() : " s "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) #define LOG_WARNING(s,...) Serial.printf("[Warning] %s:%d:%s() : " s "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) #define LOG_ERROR(s,...) Serial.printf("[Error] %s:%d:%s() : " s "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) #endif #endif // #ifdef NDEBUG #endif // #if defined(TEENSYDUINO) || defined(__AVR__) || defined(__MBED__) #endif // EMBEDDEDUTILS_DEBUG_H
// Copyright (c) 2012 The AriesCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VERSION_H #define BITCOIN_VERSION_H #include "clientversion.h" #include <string> // // client versioning // static const int CLIENT_VERSION = 1000000 * CLIENT_VERSION_MAJOR + 10000 * CLIENT_VERSION_MINOR + 100 * CLIENT_VERSION_REVISION + 1 * CLIENT_VERSION_BUILD; extern const std::string CLIENT_NAME; extern const std::string CLIENT_BUILD; extern const std::string CLIENT_DATE; // // network protocol versioning // static const int PROTOCOL_VERSION = 70001; // earlier versions not supported as of Feb 2012, and are disconnected static const int MIN_PROTO_VERSION = 209; // nTime field added to CAddress, starting with this version; // if possible, avoid requesting addresses nodes older than this static const int CADDR_TIME_VERSION = 31402; // only request blocks from nodes outside this range of versions static const int NOBLKS_VERSION_START = 32000; static const int NOBLKS_VERSION_END = 32400; // BIP 0031, pong message, is enabled for all versions AFTER this one static const int BIP0031_VERSION = 60000; // "mempool" command, enhanced "getdata" behavior starts with this version: static const int MEMPOOL_GD_VERSION = 60002; #endif
// // ImageSliderTiledView.h // ImageSlider // // Created by Ryuji Watanabe on 2013/08/07. // Copyright (c) 2013年 Excite Japan Co,. Ltd. All rights reserved. // #import <UIKit/UIKit.h> @interface ImageSliderTiledView : UIView @property (nonatomic, assign) CGSize tileSize; /** * タイルサイズを指定してViewを作成する */ - (id)initWithFrame:(CGRect)frame tileSize:(CGSize)tileSize; @end
// // GTFetchHeadEntry.h // ObjectiveGitFramework // // Created by Pablo Bendersky on 8/14/14. // Copyright (c) 2014 GitHub, Inc. All rights reserved. // #import <Foundation/Foundation.h> @class GTRepository; @class GTOID; @class GTReference; NS_ASSUME_NONNULL_BEGIN /// A class representing an entry on the FETCH_HEAD file, as returned by the callback of git_repository_fetchhead_foreach. @interface GTFetchHeadEntry : NSObject /// The reference of this fetch entry. @property (nonatomic, readonly, strong) GTReference *reference; /// The remote URL where this entry was originally fetched from. @property (nonatomic, readonly, copy) NSString *remoteURLString; /// The target OID of this fetch entry (what we need to merge with) @property (nonatomic, readonly, copy) GTOID *targetOID; /// Flag indicating if we need to merge this entry or not. @property (nonatomic, getter = isMerge, readonly) BOOL merge; /// Initializes a GTFetchHeadEntry. Designated initializer. /// /// reference - Reference on the repository. Cannot be nil. /// remoteURLString - URL String where this was originally fetched from. Cannot be nil. /// targetOID - Target OID. Cannot be nil. /// merge - Indicates if this is pending a merge. /// /// Returns an initialized fetch head entry, or nil if an error occurred. - (nullable instancetype)initWithReference:(GTReference *)reference remoteURLString:(NSString *)remoteURLString targetOID:(GTOID *)targetOID isMerge:(BOOL)merge NS_DESIGNATED_INITIALIZER; @end NS_ASSUME_NONNULL_END
/******************************************************************************* * The MIT License (MIT) * * Copyright (c) 2015 Matthew Williams and David Williams * * 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 __PolyVox_TestRegion_H__ #define __PolyVox_TestRegion_H__ #include <QObject> class TestRegion: public QObject { Q_OBJECT private slots: void testEquality(); }; #endif
#import "MOBProjection.h" @interface MOBProjectionEPSG2228 : MOBProjection @end
#import <UIKit/UIKit.h> FOUNDATION_EXPORT double LKMediaManagerVersionNumber; FOUNDATION_EXPORT const unsigned char LKMediaManagerVersionString[];
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <libc/traceme.h> #include <libc/waitpid.h> #include <alloca.h> static int exec_main(int argc, char** argv) { char** cmd_argv = argv; int cmd_argc = argc; char** exec_argv = alloca(sizeof(char*) * (cmd_argc + 1)); // +1 for the null at the end for (int i = 0; i < cmd_argc; i++) { exec_argv[i] = cmd_argv[i]; } exec_argv[cmd_argc] = NULL; pid_t newpid = execv(*exec_argv, exec_argv); if (-1 == newpid) { return -1; } printf("new pid: %d\n", newpid); int exit_code = waitpid(newpid); printf("exit code: %d\n", exit_code); return 0; } int main(int argc, char **argv) { puts("Running exec tests.."); char* ls_argv[] = { "/bin/ls" }; exec_main(1, ls_argv); exec_main(1, ls_argv); return 0; }
#include "llist.h" #include <stdlib.h> node_t *new_node(void *val, node_t *next) { node_t *n = malloc(sizeof(node_t)); n->val = val; n->next = next; return n; } size_t list_length(node_t *lst) { size_t len = 0; while(lst != NULL) { len++; lst = lst->next; } return len; } node_t *list_reverse(node_t *lst) { node_t *next; node_t *prev = NULL; while(lst != NULL) { next = lst->next; lst->next = prev; prev = lst; lst = next; } return prev; } void **list_to_array(node_t *lst, int *len) { *len = list_length(lst); void **arr = malloc(sizeof(void *) * *len); int i = 0; for(node_t *n = lst; n != NULL; n = n->next) { arr[i] = n->val; i++; } return arr; } node_t *array_to_list(void **arr, int len) { node_t *lst = NULL; for(int i = 0; i < len; ++i) { lst = new_node(arr[i], lst); } return lst; } node_t *list_sort(node_t *lst, compare_list_item_f compare) { int len; void **arr = list_to_array(lst, &len); free_list(lst, NULL); qsort(arr, len, sizeof(void *), compare); lst = list_reverse(array_to_list(arr, len)); free(arr); return lst; } void free_list(node_t *n, free_list_item_f free_fn) { node_t *next; while(n != NULL) { next = n->next; if(free_fn != NULL) free_fn(n->val); free(n); n = next; } }
/** * @file ResourceManager.h * @author Sebastian Maisch <sebastian.maisch@googlemail.com> * @date 2014.01.03 * * @brief Contains the base class for all resource managers. */ #pragma once #include <spdlog/spdlog.h> namespace vkfw_core::gfx { class LogicalDevice; } namespace vkfw_core { class ApplicationBase; /** * @brief Base class for all resource managers. * * @author Sebastian Maisch <sebastian.maisch@googlemail.com> * @date 2014.01.03 */ template<typename rType, bool reloadLoop = false>//, typename ResourceLoadingPolicy = DefaultResourceLoadingPolicy<rType>> class ResourceManager { protected: /** The resource managers resource type. */ using ResourceType = rType; /** The resource map type. */ using ResourceMap = std::unordered_map<std::string, std::weak_ptr<rType>>; /** The type of this base class. */ using ResourceManagerBase = ResourceManager<rType, reloadLoop>; public: /** Constructor for resource managers. */ explicit ResourceManager(const gfx::LogicalDevice* device) : m_device{ device } {} /** Copy constructor. */ ResourceManager(const ResourceManager& rhs) : m_device{rhs.m_device} { for (const auto& res : rhs.m_resources) { m_resources.emplace(res.first, std::weak_ptr<ResourceType>()); } } /** Copy assignment operator. */ // NOLINTNEXTLINE ResourceManager& operator=(const ResourceManager& rhs) { if (this == &rhs) { return *this; } m_resources = rhs.m_resources; m_device = rhs.m_device; return *this; } /** Move constructor. */ ResourceManager(ResourceManager&& rhs) noexcept : m_resources{std::move(rhs.m_resources)}, m_device{rhs.m_device} { } /** Move assignment operator. */ ResourceManager& operator=(ResourceManager&& rhs) noexcept { if (this != &rhs) { this->~ResourceManager(); m_resources = std::move(rhs.m_resources); m_device = rhs.m_device; } return *this; } /** Default destructor. */ virtual ~ResourceManager() = default; /** * Gets a resource from the manager. * @param resId the resources id * @return the resource as a shared pointer */ template<typename... Args> std::shared_ptr<ResourceType> GetResource(const std::string& resId, Args&&... args) { std::weak_ptr<ResourceType> wpResource; try { wpResource = m_resources.at(resId); } catch (std::out_of_range&) { spdlog::info("No resource with id \"{}\" found. Creating new one.", resId); } if (wpResource.expired()) { std::shared_ptr<ResourceType> spResource(nullptr); LoadResource(resId, spResource, std::forward<Args>(args)...); if constexpr (reloadLoop) { // NOLINT while (!spResource) { LoadResource(resId, spResource, std::forward<Args>(args)...); } } wpResource = spResource; m_resources.insert(std::move(std::make_pair(resId, wpResource))); return spResource; } return wpResource.lock(); } /** * Checks if the resource manager contains this resource. * @param resId the resources id * @return whether the manager contains the resource or not. */ [[nodiscard]] bool HasResource(const std::string& resId) const { auto rit = m_resources.find(resId); return (rit != m_resources.end()) && !rit->expired(); } protected: /** * Loads a new resource and handles errors. * @param resId the resource id to load. * @param spResource pointer to the resource to fill. */ template<typename... Args> void LoadResource(const std::string& resId, std::shared_ptr<ResourceType>& spResource, Args&&... args) { spResource = std::make_shared<rType>(resId, m_device, std::forward<Args>(args)...); /*catch (const resource_loading_error& loadingError) { auto resid = boost::get_error_info<resid_info>(loadingError); auto filename = boost::get_error_info<boost::errinfo_file_name>(loadingError); auto errDesc = boost::get_error_info<errdesc_info>(loadingError); LOG(INFO) << "Error while loading resource \"" << resId << "\"/\"" << resId.c_str() << "\"." << std::endl << "ResourceID: " << (resid == nullptr ? "-" : resid->c_str()) << std::endl << "Filename: " << (filename == nullptr ? "-" : filename->c_str()) << std::endl << "Description: " << (errDesc == nullptr ? "-" : errDesc->c_str()); if (!reloadLoop) throw; }*/ } /** * Sets the resource with a given name to a new value. * @param resourceName the name of the resource. * @param resource the new resource. * @return a pointer to the new resource. */ std::shared_ptr<ResourceType> SetResource(const std::string& resourceName, std::shared_ptr<ResourceType>&& resource) { m_resources[resourceName] = std::move(resource); return m_resources[resourceName].lock(); } private: /** Holds the resources managed. */ ResourceMap m_resources; /** Holds the device for this resource. */ const gfx::LogicalDevice* m_device; }; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <OfficeImport/PDAnimateBehavior.h> // Not exported @interface PDAnimateScaleBehavior : PDAnimateBehavior { struct CGPoint mTo; struct CGPoint mFrom; struct CGPoint mBy; } - (id).cxx_construct; - (void)setBy:(struct CGPoint)arg1; - (struct CGPoint)by; - (void)setFrom:(struct CGPoint)arg1; - (struct CGPoint)from; - (void)setTo:(struct CGPoint)arg1; - (struct CGPoint)to; - (id)init; @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 "NSObject.h" @class NSLock, SCROBrailleEvent; @interface SCROBrailleEventDispatcher : NSObject { NSLock *_queueLock; struct __CFRunLoop *_runLoop; struct __CFRunLoopSource *_queueSource; struct __CFArray *_queue; SCROBrailleEvent *_brailleQueue; id _target; _Bool _isValid; } - (void)_processQueue; - (void)enqueueEvent:(id)arg1; - (_Bool)isValid; - (void)invalidate; - (void)start; - (void)dealloc; - (id)initWithTarget:(id)arg1; @end
// // FileModelDbManager.h // downloadCeshi // // Created by 瞄财网 on 2017/3/16. // Copyright © 2017年 瞄财网. All rights reserved. // #import <Foundation/Foundation.h> @class FileModel; @interface NSObject(FileDBManager) //插入文件 +(BOOL)insertFile:(FileModel *)fileModel; //批量插入文件 +(BOOL)batchInsertFile:(NSArray *)fileList; //删除文件 +(BOOL)delFiles:(FileModel *)fileModel; //更新文件 +(BOOL)updateFile:(FileModel *)fileModel; //查询所有本地文件 + (NSArray *)getAllFileModel; //根据url查询文件 + (FileModel *)getFileModeWithFilUrl:(NSString *)fileUrl; //查询所有未下载完成的文件 +(NSArray *)getAllStopDownloadFile; +(NSArray *)getAllDownloadingFile; + (NSArray *)getAllNotCompletedFile; //查询所有已经下载完成的文件 + (NSArray *)getAllDownloadedFile; + (BOOL)updateUnFinishedFileState; @end
/*-------------- Telecommunications & Signal Processing Lab --------------- McGill University Routine: int AFwriteHead (FILE *fp, const void *Buf, int Size, int Nv, int Swapb) Purpose: Write (with optionally swap) audio file header values Description: This routine writes data to an audio file header. The information to be written is considered to be organized as Nv elements each of Size bytes. Optionally each of the Nv elements is byte swapped. The data (Nv * Size bytes) is then written to the file. If input buffer is buffer is a NULL pointer, this routine writes zero-valued bytes to the file. If an error occurs, this routine issues a longjmp to the AFW_JMPENV environment set up by the calling routine. Parameters: <- int AFwriteHead Number of bytes written -> FILE *fp File pointer associated with the file -> const void *Buf Pointer to a buffer of size Nelem * size or a NULL pointer -> int Size Size of each element in bytes -> int Nv Number of elements to be written -> int Swapb Byte swap flag. This parameter is not used for size = 1. If the bytes are to be swapped, size must be 2, 4 or 8 bytes. DS_EB - File data is in big-endian byte order. The data will be swapped if the current host uses little-endian byte order. DS_EL - File data is in little-endian byte order data. The data will be swapped if the current host uses big-endian byte order. DS_NATIVE - File data is in native byte order DS_SWAP - File data is byte-swapped Author / revision: P. Kabal Copyright (C) 2003 $Revision: 1.25 $ $Date: 2003/05/09 01:21:36 $ -------------------------------------------------------------------------*/ #include <libtsp.h> #include <libtsp/nucleus.h> #include <libtsp/AFheader.h> #include <libtsp/AFpar.h> #include <libtsp/AFmsg.h> #include <libtsp/UTtypes.h> #define BSIZE(x) ((int)(sizeof (x))) #define MINV(a, b) (((a) < (b)) ? (a) : (b)) #define FWRITE(buf,size,nv,fp) (int) fwrite ((const char *) buf, \ (size_t) size, (size_t) nv, fp) #define NBUF 256 /* Number of doubles */ #define NPAD 16 /* Number of bytes */ /* setjmp / longjmp environment */ jmp_buf AFW_JMPENV; /* Defining point */ int AFwriteHead (FILE * fp, const void *Buf, int Size, int Nv, int Swapb) { int n, Nreq, Nw; const char *p; double Lbuf[NBUF]; static const char Pad[NPAD] = ""; /* Initialized to zero */ n = 0; if (Buf == NULL) { /* Write zeros to the file */ Nv = Nv * Size; /* Change to units of bytes */ Size = 1; while (n < Nv) { Nreq = MINV (Nv - n, NPAD); Nw = FWRITE (Pad, 1, Nreq, fp); n += Nw; if (Nw < Nreq) break; } } else if (Size != 1 && UTswapCode (Swapb) == DS_SWAP) { /* Swapped data passes through a temporary buffer */ p = (const char *) Buf; while (n < Nv) { Nreq = MINV (Nv - n, BSIZE (Lbuf) / Size); VRswapBytes (p, Lbuf, Size, Nreq); Nw = FWRITE (Lbuf, Size, Nreq, fp); p += Nw * Size; n += Nw; if (Nw < Nreq) break; } } else /* Non-swapped data is written directly from the input buffer */ n += FWRITE (Buf, Size, Nv, fp); if (n < Nv) { UTsysMsg ("AFwriteHead - %s", AFM_WriteErr); longjmp (AFW_JMPENV, 1); } return (Size * n); }
/* * Copyright (c) 2016 Simon Schmidt * * 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 <stdio.h> #include <stdlib.h> #include <libgen.h> #define __noptarg__def #include <ngetopt.h> static int argi = 1; static const char* arg = ""; static char argbeg='-'; static char buf[2]={' ',0}; static const char* progname = ""; int ngetopt(int argc,argv_t argv,const char* desc){ noptarg = NULL; int C,D; while(!*arg){ if(argbeg!='-') { noptind = argi-1; return -1; } if(argi>=argc) return -1; arg = argv[argi++]; noptind = argi; argbeg = *arg; arg++; } if(argbeg!='-') { noptind = argi-1; return -1; } C = *arg++; while(D = *desc++){ if(C==D){ if(*desc==':'){ desc++; if(argi<argc){ noptarg = argv[argi++]; noptind = argi; } } return C; }else if(*desc==':') desc++; } if(!*progname) progname = basename((char*)*argv); if(!progname) progname = ""; *buf=C; fprintf(stderr,"%s: unknown option -- %s\n",progname,buf); return '?'; }
// // ItemTVC.h // Beck // // Created by Aimy on 10/12/14. // Copyright (c) 2014 Aimy. All rights reserved. // #import "BeckTVC.h" #import "ItemVO.h" @interface ItemTVC : BeckTVC @property (nonatomic) ItemType type; @property (nonatomic, strong) ItemVO *itemVO; + (instancetype)createWitleItemVO:(ItemVO *)aVO; - (NSString *)itemDespretion; @end
// // This content is released under the MIT License: http://www.opensource.org/licenses/mit-license.html // #import <Foundation/Foundation.h> @interface iGraphConfig : NSObject { NSArray *gridDash; UIFont *axisFont; UIFont *keyFont; UIColor *axisColor; UIColor *axisTextColor; UIColor *keyTextColor; CGFloat padding; CGFloat xAxisMargin; CGFloat yAxisMargin; CGFloat keyMargin; CGFloat rightMargin; CGFloat barMargin; CGFloat lineWidth; NSUInteger xAxisSkipTicks; NSUInteger yAxisSkipTicks; } @property (nonatomic, retain) NSArray *gridDash; @property (nonatomic, retain) UIFont *axisFont; @property (nonatomic, retain) UIFont *keyFont; @property (nonatomic, retain) UIColor *axisColor; @property (nonatomic, retain) UIColor *axisTextColor; @property (nonatomic, retain) UIColor *keyTextColor; @property (nonatomic, assign) CGFloat padding; @property (nonatomic, assign) CGFloat xAxisMargin; @property (nonatomic, assign) CGFloat yAxisMargin; @property (nonatomic, assign) CGFloat keyMargin; @property (nonatomic, assign) CGFloat rightMargin; @property (nonatomic, assign) CGFloat barMargin; @property (nonatomic, assign) CGFloat lineWidth; @property (nonatomic, assign) NSUInteger xAxisSkipTicks; @property (nonatomic, assign) NSUInteger yAxisSkipTicks; @end
#ifndef SYNCANO_ARDUINO_LIBRARY_SYNCANO_H #define SYNCANO_ARDUINO_LIBRARY_SYNCANO_H #include "syncano/SyncanoChannel.h" #include "syncano/SyncanoClass.h" #include "syncano/SyncanoClient.h" #include "syncano/SyncanoDataObject.h" #include "syncano/SyncanoEndpointScript.h" #include "syncano/SyncanoRequest.h" #include "syncano/SyncanoResponse.h" #include "syncano/SyncanoScript.h" #include "syncano/SyncanoSetup.h" #include "syncano/SyncanoUtils.h" #endif
#ifndef __APP__ #define __APP__ #include <Windows.h> #include <Kinect.h> #include <Kinect.Face.h> #include <opencv2/opencv.hpp> #include <vector> #include <array> #include <wrl/client.h> using namespace Microsoft::WRL; #include <array> class Kinect { private: // Sensor ComPtr<IKinectSensor> kinect; // Coordinate Mapper ComPtr<ICoordinateMapper> coordinateMapper; // Reader ComPtr<IColorFrameReader> colorFrameReader; ComPtr<IBodyFrameReader> bodyFrameReader; std::array<ComPtr<IFaceFrameReader>, BODY_COUNT> faceFrameReader; // Color Buffer std::vector<BYTE> colorBuffer; int colorWidth; int colorHeight; unsigned int colorBytesPerPixel; cv::Mat colorMat; // Body Buffer std::array<IBody*, BODY_COUNT> bodies = { nullptr }; // Face Buffer std::array<ComPtr<IFaceFrameResult>, BODY_COUNT> results; std::array<std::string, FaceProperty::FaceProperty_Count> labels; std::array<cv::Vec3b, BODY_COUNT> colors; public: // Constructor Kinect(); // Destructor ~Kinect(); // Processing void run(); private: // Initialize void initialize(); // Initialize Sensor inline void initializeSensor(); // Initialize Color inline void initializeColor(); // Initialize Body inline void initializeBody(); // Initialize Face inline void initializeFace(); // Finalize void finalize(); // Update Data void update(); // Update Color inline void updateColor(); // Update Body inline void updateBody(); // Update Face inline void updateFace(); // Draw Data void draw(); // Draw Color inline void drawColor(); // Draw Face inline void drawFace(); // Draw Face Points inline void drawFacePoints( cv::Mat& image, const std::array<PointF, FacePointType::FacePointType_Count>& points, const int radius, const cv::Vec3b& color, const int thickness = -1 ); // Draw Face Bounding Box inline void drawFaceBoundingBox( cv::Mat& image, const RectI& box, const cv::Vec3b& color, const int thickness = 1 ); // Draw Face Rotation inline void drawFaceRotation( cv::Mat& image, Vector4& quaternion, const RectI& box, const double fontScale, const cv::Vec3b& color, const int thickness = 2 ); // Convert Quaternion to Degree inline void quaternion2degree( const Vector4* quaternion, int* pitch, int* yaw, int* roll ); // Draw Face Properties inline void drawFaceProperties( cv::Mat& image, std::array<DetectionResult, FaceProperty::FaceProperty_Count>& detections, const RectI& box, const double fontScale, const cv::Vec3b& color, const int thickness = 2 ); // Convert Detection Result to String inline std::string Kinect::result2string( DetectionResult& result ); // Show Data void show(); // Show Face inline void showFace(); }; #endif // __APP__
/* * Copyright (c) 2014 Clark Cianfarini * * 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 _PLUGIN_LOADER_H_ #define _PLUGIN_LOADER_H_ #include <map> #include <vector> #include <string> #include "PluginRegistry.h" #include "PlatformDefs.h" namespace FlakedTuna { class PluginLoader { private: std::vector<PLUG_HANDLE> _libraries; registryVector _registries; void ClosePluginLibraries(); public: ~PluginLoader(); bool FindPluginsAtDirectory(std::string additionalDir, std::string extension); template <class BaseT> std::vector<std::shared_ptr<BaseT>> BuildAndResolvePlugin( int version = 0 ) { std::vector<std::shared_ptr<BaseT>> concretePlugins; for (auto registryIter : _registries) { if (registryIter.first < version) continue; // Earlier versions may not be forward compatible, so ignore std::shared_ptr<BaseT> concretePlugin = registryIter.second->ResolvePlugin<BaseT>(); if (concretePlugin.get() != nullptr) { // It has this base type registered concretePlugins.push_back(concretePlugin); } } return concretePlugins; } }; } #endif
#include "fruit.h" static void logic(Fruit *this) { GPoint pos = pge_sprite_get_position(this->sprite); // Update sprite pge_sprite_set_position(this->sprite, pos); } static void render(Fruit *this, GContext *ctx) { pge_sprite_draw(this->sprite, ctx); } Fruit* fruit_create(GPoint position) { Fruit *this = malloc(sizeof(Fruit)); this->sprite = pge_sprite_create(position, RESOURCE_ID_BANANA); this->fruit = banana; return this; } void fruit_destroy(Fruit *this) { pge_sprite_destroy(this->sprite); free(this); } void fruit_set_type(Fruit *this, fruit_type type) { this->fruit = type; // Set the sprite bitmap switch(this->fruit) { case banana: pge_sprite_set_anim_frame(this->sprite, RESOURCE_ID_BANANA); break; case pineapple: pge_sprite_set_anim_frame(this->sprite, RESOURCE_ID_PINEAPPLE); break; case strawberry: pge_sprite_set_anim_frame(this->sprite, RESOURCE_ID_STRAWBERRY); break; case watermellon: pge_sprite_set_anim_frame(this->sprite, RESOURCE_ID_WATERMELLON); break; case bomb: pge_sprite_set_anim_frame(this->sprite, RESOURCE_ID_BOMB); break; default: break; } } fruit_type fruit_get_type(Fruit *this) { return this->fruit; } void fruit_logic(Fruit *this) { logic(this); } void fruit_render(Fruit *this, GContext *ctx) { render(this, ctx); }
// // UIViewController+RYRouter.h // Ryuk // // Created by RongqingWang on 2017/5/8. // Copyright © 2017年 RyukieSama. All rights reserved. // #import <UIKit/UIKit.h> typedef void (^completeBlock)(id data); @interface UIViewController (RYRouter) @property (nonatomic, strong) id params; @property (nonatomic, copy) completeBlock completeBlock; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class NSString; @interface WebviewAuthorizationInfo : NSObject { NSString *_appId; NSString *_url; NSString *_api; NSString *_scope; NSString *_signature; NSString *_signatureMethod; NSString *_timeStamp; NSString *_nonce; } @property(retain, nonatomic) NSString *nonce; // @synthesize nonce=_nonce; @property(retain, nonatomic) NSString *timeStamp; // @synthesize timeStamp=_timeStamp; @property(retain, nonatomic) NSString *signatureMethod; // @synthesize signatureMethod=_signatureMethod; @property(retain, nonatomic) NSString *signature; // @synthesize signature=_signature; @property(retain, nonatomic) NSString *scope; // @synthesize scope=_scope; @property(retain, nonatomic) NSString *api; // @synthesize api=_api; @property(retain, nonatomic) NSString *url; // @synthesize url=_url; @property(retain, nonatomic) NSString *appId; // @synthesize appId=_appId; - (void).cxx_destruct; @end
#ifndef JSONNEWNODEDIALOG_H #define JSONNEWNODEDIALOG_H #include <QCheckBox> #include <QComboBox> #include <QDialog> #include <QGridLayout> #include <QLabel> #include <QLineEdit> #include <QPushButton> #include "json_spirit.h" class JsonNewNodeDialog : public QDialog { Q_OBJECT QGridLayout* mainLayout; QLineEdit* keyLineEdit; QLineEdit* valLineEdit; QComboBox* valueTypeComboBox; QCheckBox* boolValCheckbox; QPushButton* cancelButton; // if true, then the fields are committed to the vars below json_spirit::Value_type parentType = json_spirit::Value_type::null_type; // if insertion is in root, then it doesn't have to be object or array bool canBeAnyType = false; bool nodeCreated = false; std::string nodeKey; std::string nodeVal; json_spirit::Value_type nodeType; public: QPushButton* okButton; public: JsonNewNodeDialog(QDialog* parent = nullptr); void clearFields(); static const int JsonTypeCount = 7; static int JsonTypeToInt(json_spirit::Value_type t); static json_spirit::Value_type IntToJsonType(int i); static void TestSwitchingIntToJsonType(); bool isNodeCreated() const; std::string getNodeKey() const; std::string getNodeVal() const; json_spirit::Value_type getNodeType() const; void setParentType(bool CanBeAnyType, json_spirit::Value_type t = json_spirit::null_type); private slots: void implementFieldDisabledState(int index); void exportValuesFromControls(); }; #endif // JSONNEWNODEDIALOG_H
/* * error_handler.h * * Created on: 17 Oct 2009 * Author: David */ #ifndef ERROR_HANDLER_H_ #define ERROR_HANDLER_H_ #define MAX_ERR_LOG_SIZE 1024 #endif /* ERROR_HANDLER_H_ */
// // LDOViewController.h // LDOBadgeView // // Created by Sebastian Ludwig on 05/12/2016. // Copyright (c) 2016 Sebastian Ludwig. All rights reserved. // @import UIKit; @import LDOBadgeView; @interface LDOViewController : UIViewController @end
/** * @file rpc_server_test.h * @brief rpc服务端测试程序 * @author chxuan, 787280310@qq.com * @version 1.0.0 * @date 2017-12-02 */ #pragma once #include <thread> #include "../protoc/code/common.pb.h" #include "easyrpc/easyrpc.h" using namespace easyrpc; class rpc_server_test { public: rpc_server_test(); ~rpc_server_test(); void run(); void stop(); private: void deal_connection_notify(const connection_status& status); void echo(const std::shared_ptr<request>& req, const std::shared_ptr<response>& res); void publish_thread(); std::shared_ptr<google::protobuf::Message> make_auto_weather(); private: std::shared_ptr<rpc_server> server_; std::shared_ptr<std::thread> pub_thread_; std::atomic<bool> server_stoped_{ false }; std::string client_session_id_; };
/* * QuickThreads -- Threads-building toolkit. * Copyright (c) 1993 by David Keppel * * Permission to use, copy, modify and distribute this software and * its documentation for any purpose and without fee is hereby * granted, provided that the above copyright notice and this notice * appear in all copies. This software is provided as a * proof-of-concept and for demonstration purposes; there is no * representation about the suitability of this software for any * purpose. */ #include <stdarg.h> #include "qt.h" // This static is used to find the end of the stack for variable static void *qt_sp_bottom_save; /* We actually don't know how the compiler accomodates arguments in the * va_list. In some implementation (e.g. Linux PPC) we cannot scan the * list as an array. To avoid this problem, this version of "qt_varg", * retrieves arguments by means of the standard "va_arg" macro defined * in stdargs.h. * * Notice that we still suppose that the number of arguments is given * by nbytes/sizeof(qt_word_t) and we load the stack of "qt_vstart" * assuming that all parameters are alligned to the size of qt_word_t. * * Marco Bucci <marco.bucci@inwind.it> * December 2002 */ /* qt_t *qt_vargs (qt_t *sp, int nbytes, void *vargs, void *pt, qt_startup_t *startup, qt_vuserf_t *vuserf, qt_cleanup_t *cleanup) */ qt_t * qt_vargs_stdarg (qt_t *sp, int nbytes, va_list vargs, void *pt, qt_startup_t *startup, qt_vuserf_t *vuserf, qt_cleanup_t *cleanup) { int i; qt_word_t arg; sp = QUICKTHREADS_VARGS_MD0 (sp, nbytes); for ( i=0;i<(int)(nbytes/sizeof(qt_word_t)); i++) { arg = va_arg(vargs, qt_word_t); QUICKTHREADS_SPUT (QUICKTHREADS_VARGS_ADJUST(sp), i, arg); } QUICKTHREADS_VARGS_MD1 (QUICKTHREADS_VADJ(sp)); QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VARGT_INDEX, pt); QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VSTARTUP_INDEX, startup); QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VUSERF_INDEX, vuserf); QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VCLEANUP_INDEX, cleanup); return ((qt_t *)QUICKTHREADS_VADJ(sp)); }
#ifndef STREAMLOADER_H #define STREAMLOADER_H #include <qimage.h> #include <qobject.h> #include "tools/image.h" class StreamLoader : public QObject { public: Q_OBJECT protected: StreamLoader() {} QImage _frame; public: virtual void open(const char* path)=0; virtual void start_stream()=0; virtual void stop_stream()=0; virtual void restart_stream()=0; virtual void refresh_frame() { emit frame_ready(); } virtual void next_frame()=0; virtual void previous_frame()=0; const QImage& frame() const { return _frame; } MVision::Image convertFrameToMVImage() const; signals: void frame_ready(); }; #endif // STREAMLOADER_H
// // SDHomeStrageViewController.h // // // Created by shendong on 16/5/17. // // #import "SDRootViewController.h" @interface SDHomeStrageViewController : SDRootViewController @end
/* ##################################################################### # File : SBHttpProcess.h # Project : # Created : 2013-03-30 # DevTeam : Thomas Develop # Author : # Notes : ##################################################################### ### Change Logs ################################################### ##################################################################### */ #import "SBHttpProcess.h" #import "SBHttpDataLoader.h" /** 网络请求入口 **/ @interface SBHttpProcess : NSObject { } @end
#ifndef H_GAME_FLOW_H #define H_GAME_FLOW_H typedef enum _GameState { FRONT_END, MENU, SETTINGS, PLAYING, STOPPED, TOTAL_STATES } GameState; class GameFlow { public: static GameFlow* get_instance(); static void release_game_flow(); void set_state(GameState next); GameState state(); private: GameState m_current_state; GameFlow(); }; #endif
/* * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #import <Foundation/Foundation.h> #import "ResponseHandler.h" @interface GetTokenResponseHandler:ResponseHandler { NSString *key; } -(id)initWithKey:(NSString *)theKey; @end
#include <maya/MPxNode.h> #include <maya/MString.h> #include <maya/MTypeId.h> class brick :public MPxNode { public: brick(); virtual ~brick(); virtual MStatus compute( const MPlug&, MDataBlock& ); virtual void postConstructor(); static void * creator(); static MStatus initialize(); // Id tag for use with binary file format static MTypeId id; private: static MObject outColor; //---------------------------- automatically created attributes start ------------------------------------ static MObject scale; static MObject brickbevel; static MObject brickbond; static MObject mortarsize; static MObject brickwidth; static MObject bricktex; static MObject brickdepth; static MObject coordinates; static MObject brickmodtex; static MObject rotate; static MObject motartex; static MObject brickrun; static MObject translate; static MObject brickheight; static MObject luxOutFloat; static MObject luxOutColor; //---------------------------- automatically created attributes end ------------------------------------ };
#include "snippets.h" // 8b Integer to cstring uchar* SNP_ctoa(uchar number, uchar *buff){ uchar *ptr; ptr = buff+3; *ptr = '\0'; if (!number) *(--ptr) = '0'; for (;number;number/=10) *(--ptr) = (number % 10) + '0'; return ptr; } // 8b Integer to cstring, hexa, 2 digits uchar* SNP_ctoh(uchar number, uchar *buff){ uchar *ptr; uchar i; ptr = buff+2; *ptr = '\0'; if (!number){ *(--ptr) = '0'; *(--ptr) = '0'; } else{ for(i=2;i-->0;number /= 16){ if (number % 16 < 10) *(--ptr) = (number % 16) + '0'; else *(--ptr) = number % 16 - 10 + 'a'; } } return ptr+2; } // 8b Integer to cstring, d chars uchar* SNP_ctoaN(uchar number, uchar *buff, uchar d){ uchar *ptr; ptr = buff+d; *ptr = '\0'; for (;ptr != buff;number/=10) *(--ptr) = (number % 10) + '0'; return ptr; } // 16b Integer to cstring uchar* SNP_itoa(uint number, uchar *buff){ uchar *ptr; ptr = buff+5; *ptr = '\0'; if (!number) *(--ptr) = '0'; for (;number;number/=10) *(--ptr) = (number % 10) + '0'; return ptr; } // 16b Integer to cstring, hexa, 4 digits uchar* SNP_itoh(uint number, uchar *buff){ uchar *ptr; uchar i; ptr = buff+4; *ptr = '\0'; if (!number){ *(--ptr) = '0'; *(--ptr) = '0'; } else{ for(i=4;i-->0;number /= 16){ if (number % 16 < 10) *(--ptr) = (number % 16) + '0'; else *(--ptr) = number % 16 - 10 + 'a'; } } return ptr+4; } // 16b Integer to cstring, d decimals uchar* SNP_itoaD(uint number, uchar *buff, uchar d){ uchar *ptr; ptr = buff+6; *ptr = '\0'; if (!number) *(--ptr) = '0'; for (;number;number/=10){ *(--ptr) = (number % 10) + '0'; if (d) if(!--d) *(--ptr) = '.'; } return ptr; } // 16b Integer to cstring, d chars uchar* SNP_itoaN(uint number, uchar *buff, uchar d){ uchar *ptr; ptr = buff+d; *ptr = '\0'; for (;ptr != buff;number/=10) *(--ptr) = (number % 10) + '0'; return ptr; } // Copies one str to another, // returns a pointer to the last char of the 2nd str uchar* SNP_strCopy(uchar* ptr0,uchar* ptr1){ for(;*ptr0;ptr0++) *(ptr1++) = *ptr0; *ptr1 = '\0'; return ptr1; } // Returns the str len, excluding the null char uchar SNP_strLen(uchar* str){ uchar i = 0; for(;*(str+i) && ++i<255;){}; return i; } // Fills the string with the given char uchar* SNP_strFill(uchar* ptr,uchar* end, uchar ch){ for (;ptr < end;ptr++) *ptr = ch; *ptr = '\0'; return ptr; } // Calculates the log2 of a number uchar LOG2_l(unsigned long x){ return x ? (LOG2_i(x&0xFFFF) + LOG2_l(x>>16)) : 0; }
#ifndef _deathqueue_h_ #define _deathqueue_h_ #include "block.h" extern Block *death_queue_head, *death_queue_tail; extern void death_queue_enqueue (Block *b); extern void death_queue_dequeue (Block *b); #endif /* Not _deathqueue_h_ */
// // MMVIPTableController.h // MMTableViewDemo // // Created by Mac mini 2012 on 15-2-28. // Copyright (c) 2015年 Mac mini 2012. All rights reserved. // #import <UIKit/UIKit.h> #import "MSRefreshTableController.h" @class EMVIPModel; @interface MMVIPTableController : MSRefreshTableController { EMVIPModel *_model; } @end