text stringlengths 4 6.14k |
|---|
/* Change a file's permissions. NaCl version.
Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <nacl-interfaces.h>
/* Change the protections of FILE to MODE. */
int
__chmod (const char *file, mode_t mode)
{
return NACL_CALL (__nacl_irt_dev_filename.chmod (file, mode), 0);
}
weak_alias (__chmod, chmod)
|
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef MSM_ACTUATOR_H
#define MSM_ACTUATOR_H
#include <linux/i2c.h>
#include <mach/camera.h>
#include <mach/gpio.h>
#include <media/v4l2-subdev.h>
#include <media/msm_camera.h>
#include "msm_camera_i2c.h"
#ifdef LERROR
#undef LERROR
#endif
#ifdef LINFO
#undef LINFO
#endif
#define LERROR(fmt, args...) pr_err(fmt, ##args)
#define CONFIG_MSM_CAMERA_ACT_DBG 0
#if CONFIG_MSM_CAMERA_ACT_DBG
#define LINFO(fmt, args...) printk(fmt, ##args)
#else
#define LINFO(fmt, args...) CDBG(fmt, ##args)
#endif
struct msm_actuator_ctrl_t;
struct msm_actuator_func_tbl {
int32_t (*actuator_i2c_write_b_af)(struct msm_actuator_ctrl_t *,
uint8_t,
uint8_t);
int32_t (*actuator_init_step_table)(struct msm_actuator_ctrl_t *,
struct msm_actuator_set_info_t *);
int32_t (*actuator_init_focus)(struct msm_actuator_ctrl_t *,
uint16_t, enum msm_actuator_data_type, struct reg_settings_t *);
int32_t (*actuator_set_default_focus) (struct msm_actuator_ctrl_t *,
struct msm_actuator_move_params_t *);
int32_t (*actuator_move_focus) (struct msm_actuator_ctrl_t *,
struct msm_actuator_move_params_t *);
int32_t (*actuator_i2c_write)(struct msm_actuator_ctrl_t *,
int16_t, uint32_t);
int32_t (*actuator_write_focus)(struct msm_actuator_ctrl_t *,
uint16_t,
struct damping_params_t *,
int8_t,
int16_t);
};
struct msm_actuator {
enum actuator_type act_type;
struct msm_actuator_func_tbl func_tbl;
};
struct msm_actuator_ctrl_t {
struct i2c_driver *i2c_driver;
struct msm_camera_i2c_client i2c_client;
struct mutex *actuator_mutex;
struct msm_actuator_func_tbl *func_tbl;
enum msm_actuator_data_type i2c_data_type;
struct v4l2_subdev sdev;
struct v4l2_subdev_ops *act_v4l2_subdev_ops;
int16_t curr_step_pos;
uint16_t curr_region_index;
uint16_t *step_position_table;
struct region_params_t region_params[MAX_ACTUATOR_REGION];
uint16_t reg_tbl_size;
struct msm_actuator_reg_params_t reg_tbl[MAX_ACTUATOR_REG_TBL_SIZE];
uint16_t region_size;
void *user_data;
uint32_t vcm_pwd;
uint32_t vcm_enable;
uint32_t total_steps;
uint16_t pwd_step;
uint16_t initial_code;
/* LGE_CHANGE_S, AF offset enable, 2012-09-28, sungmin.woo@lge.com */
uint8_t AF_defocus_enable;
uint16_t AF_center_best_code;
uint16_t AF_balance_best_code;
uint16_t AF_defocus_offset;
uint16_t AF_LG_center_best_code;
uint16_t AF_LG_defocus_offset;
uint16_t af_status;
/* LGE_CHANGE_E, AF offset enable, 2012-09-28, sungmin.woo@lge.com */
};
struct msm_actuator_ctrl_t *get_actrl(struct v4l2_subdev *sd);
int32_t msm_actuator_i2c_write(struct msm_actuator_ctrl_t *a_ctrl,
int16_t next_lens_position, uint32_t hw_params);
int32_t msm_actuator_init_focus(struct msm_actuator_ctrl_t *a_ctrl,
uint16_t size, enum msm_actuator_data_type type,
struct reg_settings_t *settings);
int32_t msm_actuator_i2c_write_b_af(struct msm_actuator_ctrl_t *a_ctrl,
uint8_t msb,
uint8_t lsb);
int32_t msm_actuator_move_focus(struct msm_actuator_ctrl_t *a_ctrl,
struct msm_actuator_move_params_t *move_params);
int32_t msm_actuator_piezo_move_focus(
struct msm_actuator_ctrl_t *a_ctrl,
struct msm_actuator_move_params_t *move_params);
int32_t msm_actuator_init_step_table(struct msm_actuator_ctrl_t *a_ctrl,
struct msm_actuator_set_info_t *set_info);
// Start LGE_BSP_CAMERA::seongjo.kim@lge.com 2012-07-20 Apply AF calibration data
int32_t msm_actuator_init_step_table_use_eeprom(struct msm_actuator_ctrl_t *a_ctrl,
struct msm_actuator_set_info_t *set_info);
// End LGE_BSP_CAMERA::seongjo.kim@lge.com 2012-07-20 Apply AF calibration data
int32_t msm_actuator_set_default_focus(struct msm_actuator_ctrl_t *a_ctrl,
struct msm_actuator_move_params_t *move_params);
int32_t msm_actuator_piezo_set_default_focus(
struct msm_actuator_ctrl_t *a_ctrl,
struct msm_actuator_move_params_t *move_params);
int32_t msm_actuator_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id);
int32_t msm_actuator_write_focus(struct msm_actuator_ctrl_t *a_ctrl,
uint16_t curr_lens_pos, struct damping_params_t *damping_params,
int8_t sign_direction, int16_t code_boundary);
int32_t msm_actuator_write_focus2(struct msm_actuator_ctrl_t *a_ctrl,
uint16_t curr_lens_pos, struct damping_params_t *damping_params,
int8_t sign_direction, int16_t code_boundary);
long msm_actuator_subdev_ioctl(struct v4l2_subdev *sd,
unsigned int cmd, void *arg);
int32_t msm_actuator_power(struct v4l2_subdev *sd, int on);
#define VIDIOC_MSM_ACTUATOR_CFG \
_IOWR('V', BASE_VIDIOC_PRIVATE + 11, void __user *)
#endif
|
#ifndef _ASM_X86_ALTERNATIVE_H
#define _ASM_X86_ALTERNATIVE_H
#include <linux/types.h>
#include <linux/stddef.h>
#include <asm/asm.h>
/*
* Alternative inline assembly for SMP.
*
* The LOCK_PREFIX macro defined here replaces the LOCK and
* LOCK_PREFIX macros used everywhere in the source tree.
*
* SMP alternatives use the same data structures as the other
* alternatives and the X86_FEATURE_UP flag to indicate the case of a
* UP system running a SMP kernel. The existing apply_alternatives()
* works fine for patching a SMP kernel for UP.
*
* The SMP alternative tables can be kept after boot and contain both
* UP and SMP versions of the instructions to allow switching back to
* SMP at runtime, when hotplugging in a new CPU, which is especially
* useful in virtualized environments.
*
* The very common lock prefix is handled as special case in a
* separate table which is a pure address list without replacement ptr
* and size information. That keeps the table sizes small.
*/
#ifdef CONFIG_SMP
#define LOCK_PREFIX \
".section .smp_locks,\"a\"\n" \
_ASM_ALIGN "\n" \
_ASM_PTR "661f\n" /* address */ \
".previous\n" \
"661:\n\tlock; "
#else /* ! CONFIG_SMP */
#define LOCK_PREFIX ""
#endif
/* This must be included *after* the definition of LOCK_PREFIX */
#include <asm/cpufeature.h>
struct alt_instr {
u8 *instr; /* original instruction */
u8 *replacement;
u8 cpuid; /* cpuid bit set for replacement */
u8 instrlen; /* length of original instruction */
u8 replacementlen; /* length of new instruction, <= instrlen */
u8 pad1;
#ifdef CONFIG_X86_64
u32 pad2;
#endif
};
extern void alternative_instructions(void);
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
struct module;
#ifdef CONFIG_SMP
extern void alternatives_smp_module_add(struct module *mod, char *name,
void *locks, void *locks_end,
void *text, void *text_end);
extern void alternatives_smp_module_del(struct module *mod);
extern void alternatives_smp_switch(int smp);
#else
static inline void alternatives_smp_module_add(struct module *mod, char *name,
void *locks, void *locks_end,
void *text, void *text_end) {}
static inline void alternatives_smp_module_del(struct module *mod) {}
static inline void alternatives_smp_switch(int smp) {}
#endif /* CONFIG_SMP */
/*
* Alternative instructions for different CPU types or capabilities.
*
* This allows to use optimized instructions even on generic binary
* kernels.
*
* length of oldinstr must be longer or equal the length of newinstr
* It can be padded with nops as needed.
*
* For non barrier like inlines please define new variants
* without volatile and memory clobber.
*/
#define alternative(oldinstr, newinstr, feature) \
asm volatile ("661:\n\t" oldinstr "\n662:\n" \
".section .altinstructions,\"a\"\n" \
_ASM_ALIGN "\n" \
_ASM_PTR "661b\n" /* label */ \
_ASM_PTR "663f\n" /* new instruction */ \
" .byte %c0\n" /* feature bit */ \
" .byte 662b-661b\n" /* sourcelen */ \
" .byte 664f-663f\n" /* replacementlen */ \
".previous\n" \
".section .altinstr_replacement,\"ax\"\n" \
"663:\n\t" newinstr "\n664:\n" /* replacement */ \
".previous" :: "i" (feature) : "memory")
/*
* Alternative inline assembly with input.
*
* Pecularities:
* No memory clobber here.
* Argument numbers start with 1.
* Best is to use constraints that are fixed size (like (%1) ... "r")
* If you use variable sized constraints like "m" or "g" in the
* replacement make sure to pad to the worst case length.
*/
#define alternative_input(oldinstr, newinstr, feature, input...) \
asm volatile ("661:\n\t" oldinstr "\n662:\n" \
".section .altinstructions,\"a\"\n" \
_ASM_ALIGN "\n" \
_ASM_PTR "661b\n" /* label */ \
_ASM_PTR "663f\n" /* new instruction */ \
" .byte %c0\n" /* feature bit */ \
" .byte 662b-661b\n" /* sourcelen */ \
" .byte 664f-663f\n" /* replacementlen */ \
".previous\n" \
".section .altinstr_replacement,\"ax\"\n" \
"663:\n\t" newinstr "\n664:\n" /* replacement */ \
".previous" :: "i" (feature), ##input)
/* Like alternative_input, but with a single output argument */
#define alternative_io(oldinstr, newinstr, feature, output, input...) \
asm volatile ("661:\n\t" oldinstr "\n662:\n" \
".section .altinstructions,\"a\"\n" \
_ASM_ALIGN "\n" \
_ASM_PTR "661b\n" /* label */ \
_ASM_PTR "663f\n" /* new instruction */ \
" .byte %c[feat]\n" /* feature bit */ \
" .byte 662b-661b\n" /* sourcelen */ \
" .byte 664f-663f\n" /* replacementlen */ \
".previous\n" \
".section .altinstr_replacement,\"ax\"\n" \
"663:\n\t" newinstr "\n664:\n" /* replacement */ \
".previous" : output : [feat] "i" (feature), ##input)
/*
* use this macro(s) if you need more than one output parameter
* in alternative_io
*/
#define ASM_OUTPUT2(a, b) a, b
struct paravirt_patch_site;
#ifdef CONFIG_PARAVIRT
void apply_paravirt(struct paravirt_patch_site *start,
struct paravirt_patch_site *end);
#else
static inline void
apply_paravirt(struct paravirt_patch_site *start,
struct paravirt_patch_site *end)
{}
#define __parainstructions NULL
#define __parainstructions_end NULL
#endif
extern void text_poke(void *addr, unsigned char *opcode, int len);
#endif /* _ASM_X86_ALTERNATIVE_H */
|
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2011-01-13 weety first version
*/
/**
* @addtogroup at91sam9260
*/
/*@{*/
#include <rtthread.h>
#include <rtdevice.h>
#ifdef RT_USING_DFS
/* dfs init */
#include <dfs_init.h>
/* dfs filesystem:ELM FatFs filesystem init */
#include <dfs_elm.h>
/* dfs Filesystem APIs */
#include <dfs_fs.h>
#ifdef RT_USING_DFS_UFFS
/* dfs filesystem:UFFS filesystem init */
#include <dfs_uffs.h>
#endif
#endif
#if defined(RT_USING_DFS_DEVFS)
#include <devfs.h>
#endif
#ifdef RT_USING_SDIO
#include <drivers/mmcsd_core.h>
#include "at91_mci.h"
#endif
#ifdef RT_USING_LWIP
#include <netif/ethernetif.h>
//#include <arch/sys_arch_init.h>
#include "macb.h"
#endif
#ifdef RT_USING_LED
#include "led.h"
#endif
#define RT_INIT_THREAD_STACK_SIZE (2*1024)
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
void rt_init_thread_entry(void* parameter)
{
/* Filesystem Initialization */
#ifdef RT_USING_DFS
{
/* init the device filesystem */
dfs_init();
#if defined(RT_USING_DFS_ELMFAT)
/* init the elm chan FatFs filesystam*/
elm_init();
#endif
#if defined(RT_USING_DFS_ROMFS)
dfs_romfs_init();
if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0)
{
rt_kprintf("ROM File System initialized!\n");
}
else
rt_kprintf("ROM File System initialzation failed!\n");
#endif
#if defined(RT_USING_DFS_DEVFS)
devfs_init();
if (dfs_mount(RT_NULL, "/dev", "devfs", 0, 0) == 0)
rt_kprintf("Device File System initialized!\n");
else
rt_kprintf("Device File System initialzation failed!\n");
#ifdef RT_USING_NEWLIB
/* init libc */
libc_system_init("uart0");
#endif
#endif
#if defined(RT_USING_DFS_UFFS)
{
/* init the uffs filesystem */
dfs_uffs_init();
/* mount flash device as flash directory */
if(dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0)
rt_kprintf("UFFS File System initialized!\n");
else
rt_kprintf("UFFS File System initialzation failed!\n");
}
#endif
#ifdef RT_USING_SDIO
rt_mmcsd_core_init();
rt_mmcsd_blk_init();
at91_mci_init();
rt_thread_delay(RT_TICK_PER_SECOND*2);
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
{
rt_kprintf("File System initialized!\n");
}
else
rt_kprintf("File System initialzation failed!\n");
#endif
}
#endif
#ifdef RT_USING_LWIP
{
/* register ethernetif device */
eth_system_device_init();
rt_hw_macb_init();
/* re-init device driver */
rt_device_init_all();
/* init lwip system */
lwip_sys_init();
}
#endif
#ifdef RT_USING_I2C
{
rt_i2c_core_init();
at91_i2c_init();
}
#endif
}
#ifdef RT_USING_LED
void rt_led_thread_entry(void* parameter)
{
rt_uint8_t cnt = 0;
led_init();
while(1)
{
/* light on leds for one second */
rt_thread_delay(40);
cnt++;
if (cnt&0x01)
led_on(1);
else
led_off(1);
if (cnt&0x02)
led_on(2);
else
led_off(2);
if (cnt&0x04)
led_on(3);
else
led_off(3);
}
}
#endif
int rt_application_init()
{
rt_thread_t init_thread;
#ifdef RT_USING_LED
rt_thread_t led_thread;
#endif
#if (RT_THREAD_PRIORITY_MAX == 32)
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
RT_INIT_THREAD_STACK_SIZE, 8, 20);
#ifdef RT_USING_LED
led_thread = rt_thread_create("led",
rt_led_thread_entry, RT_NULL,
512, 20, 20);
#endif
#else
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
RT_INIT_THREAD_STACK_SIZE, 80, 20);
#ifdef RT_USING_LED
led_thread = rt_thread_create("led",
rt_led_thread_entry, RT_NULL,
512, 200, 20);
#endif
#endif
if (init_thread != RT_NULL)
rt_thread_startup(init_thread);
#ifdef RT_USING_LED
if(led_thread != RT_NULL)
rt_thread_startup(led_thread);
#endif
return 0;
}
/* NFSv3 Initialization */
#if defined(RT_USING_DFS) && defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS)
#include <dfs_nfs.h>
void nfs_start(void)
{
nfs_init();
if (dfs_mount(RT_NULL, "/nfs", "nfs", 0, RT_NFS_HOST_EXPORT) == 0)
{
rt_kprintf("NFSv3 File System initialized!\n");
}
else
rt_kprintf("NFSv3 File System initialzation failed!\n");
}
#include "finsh.h"
FINSH_FUNCTION_EXPORT(nfs_start, start net filesystem);
#endif
/*@}*/
|
/*
* cxd2880_dvbt.h
* Sony CXD2880 DVB-T2/T tuner + demodulator driver
* DVB-T related definitions
*
* Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
*
* THIS SOFTWARE IS PROVIDED ``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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CXD2880_DVBT_H
#define CXD2880_DVBT_H
#include "cxd2880_common.h"
enum cxd2880_dvbt_constellation {
CXD2880_DVBT_CONSTELLATION_QPSK,
CXD2880_DVBT_CONSTELLATION_16QAM,
CXD2880_DVBT_CONSTELLATION_64QAM,
CXD2880_DVBT_CONSTELLATION_RESERVED_3
};
enum cxd2880_dvbt_hierarchy {
CXD2880_DVBT_HIERARCHY_NON,
CXD2880_DVBT_HIERARCHY_1,
CXD2880_DVBT_HIERARCHY_2,
CXD2880_DVBT_HIERARCHY_4
};
enum cxd2880_dvbt_coderate {
CXD2880_DVBT_CODERATE_1_2,
CXD2880_DVBT_CODERATE_2_3,
CXD2880_DVBT_CODERATE_3_4,
CXD2880_DVBT_CODERATE_5_6,
CXD2880_DVBT_CODERATE_7_8,
CXD2880_DVBT_CODERATE_RESERVED_5,
CXD2880_DVBT_CODERATE_RESERVED_6,
CXD2880_DVBT_CODERATE_RESERVED_7
};
enum cxd2880_dvbt_guard {
CXD2880_DVBT_GUARD_1_32,
CXD2880_DVBT_GUARD_1_16,
CXD2880_DVBT_GUARD_1_8,
CXD2880_DVBT_GUARD_1_4
};
enum cxd2880_dvbt_mode {
CXD2880_DVBT_MODE_2K,
CXD2880_DVBT_MODE_8K,
CXD2880_DVBT_MODE_RESERVED_2,
CXD2880_DVBT_MODE_RESERVED_3
};
enum cxd2880_dvbt_profile {
CXD2880_DVBT_PROFILE_HP = 0,
CXD2880_DVBT_PROFILE_LP
};
struct cxd2880_dvbt_tpsinfo {
enum cxd2880_dvbt_constellation constellation;
enum cxd2880_dvbt_hierarchy hierarchy;
enum cxd2880_dvbt_coderate rate_hp;
enum cxd2880_dvbt_coderate rate_lp;
enum cxd2880_dvbt_guard guard;
enum cxd2880_dvbt_mode mode;
u8 fnum;
u8 length_indicator;
u16 cell_id;
u8 cell_id_ok;
u8 reserved_even;
u8 reserved_odd;
};
#endif
|
/*****************************************************************************
** $Source: /cygdrive/d/Private/_SVNROOT/bluemsx/blueMSX/Src/IoDevice/ScsiDefs.h,v $
**
** $Revision: 1.3 $
**
** $Date: 2008-03-30 18:38:40 $
**
** More info: http://www.bluemsx.com
**
** Copyright (C) 2003-2007 Daniel Vik, white cat
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**
******************************************************************************
*/
#ifndef SCSIDEFS_H
#define SCSIDEFS_H
#include "MsxTypes.h"
// Group 0: 6bytes cdb
#define SCSIOP_TEST_UNIT_READY 0x00
#define SCSIOP_REZERO_UNIT 0x01
#define SCSIOP_REQUEST_SENSE 0x03
#define SCSIOP_FORMAT_UNIT 0x04
#define SCSIOP_REASSIGN_BLOCKS 0x07
#define SCSIOP_READ6 0x08
#define SCSIOP_WRITE6 0x0A
#define SCSIOP_SEEK6 0x0B
#define SCSIOP_INQUIRY 0x12
#define SCSIOP_RESERVE_UNIT 0x16
#define SCSIOP_RELEASE_UNIT 0x17
#define SCSIOP_MODE_SENSE 0x1A
#define SCSIOP_START_STOP_UNIT 0x1B
#define SCSIOP_SEND_DIAGNOSTIC 0x1D
// Group 1: 10bytes cdb
#define SCSIOP_GROUP1 0x20
#define SCSIOP_BLUE_MSX 0x20 // special command (vendor option)
#define SCSIOP_READ_CAPACITY 0x25
#define SCSIOP_READ10 0x28
#define SCSIOP_WRITE10 0x2A
#define SCSIOP_SEEK10 0x2B
#define SCSIOP_GROUP2 0x40
#define SCSIOP_CHANGE_DEFINITION 0x40
#define SCSIOP_READ_SUB_CHANNEL 0x42
#define SCSIOP_READ_TOC 0x43
#define SCSIOP_READ_HEADER 0x44
#define SCSIOP_PLAY_AUDIO 0x45
#define SCSIOP_PLAY_AUDIO_MSF 0x47
#define SCSIOP_PLAY_TRACK_INDEX 0x48
#define SCSIOP_PLAY_TRACK_RELATIVE 0x49
#define SCSIOP_PAUSE_RESUME 0x4B
#define SCSIOP_PLAY_AUDIO12 0xA5
#define SCSIOP_READ12 0xA8
#define SCSIOP_PLAY_TRACK_RELATIVE12 0xA9
#define SCSIOP_READ_CD_MSF 0xB9
#define SCSIOP_READ_CD 0xBE
// Sense data KEY | ASC | ASCQ
#define SENSE_NO_SENSE 0x000000
#define SENSE_NOT_READY 0x020400
#define SENSE_MEDIUM_NOT_PRESENT 0x023a00
#define SENSE_UNRECOVERED_READ_ERROR 0x031100
#define SENSE_WRITE_FAULT 0x040300
#define SENSE_INVALID_COMMAND_CODE 0x052000
#define SENSE_ILLEGAL_BLOCK_ADDRESS 0x052100
#define SENSE_INVALID_LUN 0x052500
#define SENSE_POWER_ON 0x062900
#define SENSE_WRITE_PROTECT 0x072700
#define SENSE_MESSAGE_REJECT_ERROR 0x0b4300
#define SENSE_INITIATOR_DETECTED_ERR 0x0b4800
#define SENSE_ILLEGAL_MESSAGE 0x0b4900
// Message
#define MSG_COMMAND_COMPLETE 0x00
#define MSG_INITIATOR_DETECT_ERROR 0x05
#define MSG_ABORT 0x06
#define MSG_REJECT 0x07
#define MSG_NO_OPERATION 0x08
#define MSG_PARITY_ERROR 0x09
#define MSG_BUS_DEVICE_RESET 0x0c
// Status
#define SCSIST_GOOD 0
#define SCSIST_CHECK_CONDITION 2
#define SCSIST_BUSY 8
// SCSI device type
#define SDT_DirectAccess 0x00
#define SDT_SequencialAccess 0x01
#define SDT_Printer 0x02
#define SDT_Processor 0x03
#define SDT_WriteOnce 0x04
#define SDT_CDROM 0x05
#define SDT_Scanner 0x06
#define SDT_OpticalMemory 0x07
#define SDT_MediaChanger 0x08
#define SDT_Communications 0x09
#define SDT_Undefined 0x1f
#define cdbLength(cmd) (cmd < 0x20) ? 6 : (cmd < 0xa0) ? 10 : 12
#endif
|
/* Variable-sized buffer with on-stack default allocation.
Copyright (C) 2015-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <libc-config.h>
#endif
#include <scratch_buffer.h>
#include <errno.h>
#include <string.h>
bool
__libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer)
{
size_t new_length = 2 * buffer->length;
void *new_ptr;
if (buffer->data == buffer->__space.__c)
{
/* Move buffer to the heap. No overflow is possible because
buffer->length describes a small buffer on the stack. */
new_ptr = malloc (new_length);
if (new_ptr == NULL)
return false;
memcpy (new_ptr, buffer->__space.__c, buffer->length);
}
else
{
/* Buffer was already on the heap. Check for overflow. */
if (__glibc_likely (new_length >= buffer->length))
new_ptr = realloc (buffer->data, new_length);
else
{
__set_errno (ENOMEM);
new_ptr = NULL;
}
if (__glibc_unlikely (new_ptr == NULL))
{
/* Deallocate, but buffer must remain valid to free. */
free (buffer->data);
scratch_buffer_init (buffer);
return false;
}
}
/* Install new heap-based buffer. */
buffer->data = new_ptr;
buffer->length = new_length;
return true;
}
libc_hidden_def (__libc_scratch_buffer_grow_preserve)
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_operation();
void lv_clear_operation();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
/* Copyright (c) 2006 Adam Warrington
** $Id$
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
** copies of the Software, and to permit persons to whom the Software is
** furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
** SOFTWARE.
**
******************************************************************************
**
** This header file declares SSDP functions to send and receive SSDP requests
** to and from the router.
*/
#ifndef _SSDP_H_
#define _SSDP_H_
/* send an ssdp discover request, and receive a SsdpDiscResp back.
Caller is responsible for freeing the response with free() */
int LNat_Ssdp_Discover(const char * search_target, char ** response);
#endif
|
/*
* Generated by asn1c-0.9.22 (http://lionet.info/asn1c)
* From ASN.1 module "RRLP-Components"
* found in "../rrlp-components.asn"
*/
#ifndef _SeqOfOTD_MsrElementRest_H_
#define _SeqOfOTD_MsrElementRest_H_
#include <asn_application.h>
/* Including external dependencies */
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct OTD_MsrElementRest;
/* SeqOfOTD-MsrElementRest */
typedef struct SeqOfOTD_MsrElementRest {
A_SEQUENCE_OF(struct OTD_MsrElementRest) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} SeqOfOTD_MsrElementRest_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrElementRest;
#ifdef __cplusplus
}
#endif
/* Referred external types */
#include "OTD-MsrElementRest.h"
#endif /* _SeqOfOTD_MsrElementRest_H_ */
#include <asn_internal.h>
|
/***************************************************************************
* Copyright (C) 1998-2010 by authors (see AUTHORS.txt) *
* *
* This file is part of Sfera. *
* *
* Sfera is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* Sfera is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#ifndef _SFERA_MATRIX4X4_H
#define _SFERA_MATRIX4X4_H
#include <ostream>
class Matrix4x4 {
public:
// Matrix4x4 Public Methods
Matrix4x4() {
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 4; ++j)
if (i == j)
m[i][j] = 1.f;
else
m[i][j] = 0.f;
}
Matrix4x4(float mat[4][4]);
Matrix4x4(float t00, float t01, float t02, float t03,
float t10, float t11, float t12, float t13,
float t20, float t21, float t22, float t23,
float t30, float t31, float t32, float t33);
Matrix4x4 Transpose() const;
float Determinant() const;
void Print(std::ostream &os) const {
os << "Matrix4x4[ ";
for (int i = 0; i < 4; ++i) {
os << "[ ";
for (int j = 0; j < 4; ++j) {
os << m[i][j];
if (j != 3) os << ", ";
}
os << " ] ";
}
os << " ] ";
}
static Matrix4x4 Mul(const Matrix4x4 &m1, const Matrix4x4 &m2) {
float r[4][4];
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 4; ++j)
r[i][j] = m1.m[i][0] * m2.m[0][j] +
m1.m[i][1] * m2.m[1][j] +
m1.m[i][2] * m2.m[2][j] +
m1.m[i][3] * m2.m[3][j];
return Matrix4x4(r);
}
Matrix4x4 Inverse() const;
bool IsEqual(const Matrix4x4 &mt) const {
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
if (m[i][j] != mt.m[i][j])
return false;
}
}
return true;
}
friend std::ostream &operator<<(std::ostream &, const Matrix4x4 &);
float m[4][4];
};
inline std::ostream & operator<<(std::ostream &os, const Matrix4x4 &m) {
m.Print(os);
return os;
}
#endif /* _SFERA_MATRIX4X4_H */
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2007-2010 David Zeuthen <zeuthen@gmail.com>
* Copyright (C) 2013-2014 Red Hat, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __STORAGE_JOB_H__
#define __STORAGE_JOB_H__
#include "types.h"
#include "org.freedesktop.UDisks2.h"
G_BEGIN_DECLS
#define STORAGE_TYPE_JOB (storage_job_get_type ())
#define STORAGE_JOB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), STORAGE_TYPE_JOB, StorageJob))
#define STORAGE_JOB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), STORAGE_TYPE_JOB, StorageJobClass))
#define STORAGE_JOB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), STORAGE_TYPE_JOB, StorageJobClass))
#define STORAGE_IS_JOB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), STORAGE_TYPE_JOB))
#define STORAGE_IS_JOB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), STORAGE_TYPE_JOB))
typedef struct _StorageJobClass StorageJobClass;
typedef struct _StorageJobPrivate StorageJobPrivate;
/**
* StorageJob:
*
* The #StorageJob structure contains only private data and should
* only be accessed using the provided API.
*/
struct _StorageJob
{
/*< private >*/
UDisksJobSkeleton parent_instance;
StorageJobPrivate *priv;
};
/**
* StorageJobClass:
* @parent_class: Parent class.
*
* Class structure for #StorageJob.
*/
struct _StorageJobClass
{
UDisksJobSkeletonClass parent_class;
/*< private >*/
gpointer padding[8];
};
typedef gboolean (* StorageJobFunc) (GCancellable *cancellable,
gpointer user_data,
GError **error);
GType storage_job_get_type (void) G_GNUC_CONST;
GCancellable * storage_job_get_cancellable (StorageJob *self);
gboolean storage_job_get_auto_estimate (StorageJob *self);
void storage_job_set_auto_estimate (StorageJob *self,
gboolean value);
void storage_job_add_thing (StorageJob *self,
gpointer object_or_interface);
G_END_DECLS
#endif /* __STORAGE_JOB_H__ */
|
/////////////////////////////////////////////////////////////////////////////
// Name: sipXSrtpSettingsDlg.h
// Author: XX
// Created: XX/XX/XX
// Copyright: XX
/////////////////////////////////////////////////////////////////////////////
#ifndef __sipXSrtpSettingsDlg_H__
#define __sipXSrtpSettingsDlg_H__
#ifdef __GNUG__
#pragma interface "sipXSrtpSettingsDlg.cpp"
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <utl/UtlString.h>
#include "sipXezPhone_wdr.h"
#define ID_SRTP_OK_BUTTON 8200
#define ID_RTP_CIPHER_TYPE 8201
#define ID_RTP_AUTH_TYPE 8202
#define ID_RTP_ENABLE_AUTH 8203
#define ID_RTP_ENABLE_ENCR 8204
#define ID_RTP_KEY 8205
#define ID_RTP_ENABLE_SEC 8208
#define ID_RTP_KEYLEN 8209
#define ID_RTP_RANDOM 8210
#define ID_DB_LOCATION 8211
#define ID_CERTDB_PASSWORD 8213
#define ID_CERT_NICKNAME 8214
// WDR: class declarations
//----------------------------------------------------------------------------
// sipXezPhoneSettingsDlg
//----------------------------------------------------------------------------
class sipXSrtpSettingsDlg: public wxDialog
{
public:
// constructors and destructors
sipXSrtpSettingsDlg( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE );
void InitializeControls();
// public members
public:
UtlString mSrtpKey;
bool mbEncryption;
int mSecurityLevel;
UtlString mCertNickname;
UtlString mCertDbPassword;
private:
// WDR: member variable declarations for sipXVideoSettingsDlg
private:
// WDR: handler declarations for sipXVideoSettingsDlg
void OnOk( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event );
void OnSecurity(wxCommandEvent &event);
void OnKeyEntry(wxCommandEvent &event);
void OnRandom(wxCommandEvent &event);
void enable(bool bEnable);
private:
DECLARE_EVENT_TABLE()
};
#endif
|
#include "kpartx.h"
#include "byteorder.h"
#include <stdio.h>
#include <string.h>
#include "mac.h"
int
read_mac_pt(int fd, struct slice all, struct slice *sp, int ns) {
struct mac_driver_desc *md;
struct mac_partition *part;
unsigned secsize;
char *data;
int blk, blocks_in_map;
int n = 0;
md = (struct mac_driver_desc *) getblock(fd, 0);
if (md == NULL)
return -1;
if (be16_to_cpu(md->signature) != MAC_DRIVER_MAGIC)
return -1;
secsize = be16_to_cpu(md->block_size);
data = getblock(fd, secsize/512);
if (!data)
return -1;
part = (struct mac_partition *) (data + secsize%512);
if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC)
return -1;
blocks_in_map = be32_to_cpu(part->map_count);
for (blk = 1; blk <= blocks_in_map && blk <= ns; ++blk, ++n) {
int pos = blk * secsize;
data = getblock(fd, pos/512);
if (!data)
return -1;
part = (struct mac_partition *) (data + pos%512);
if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC)
break;
sp[n].start = be32_to_cpu(part->start_block) * (secsize/512);
sp[n].size = be32_to_cpu(part->block_count) * (secsize/512);
}
return n;
}
|
/*
clarinet.h:
Copyright (C) 1996, 1997 Perry Cook, John ffitch
This file is part of Csound.
The Csound 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.
Csound 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 Csound; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
/******************************************/
/* Clarinet model ala Smith */
/* after McIntyre, Schumacher, Woodhouse */
/* by Perry Cook, 1995-96 */
/* Recoded for Csound by John ffitch */
/* November 1997 */
/* */
/* This is a waveguide model, and thus */
/* relates to various Stanford Univ. */
/* and possibly Yamaha and other patents.*/
/* */
/******************************************/
#if !defined(__Clarinet_h)
#define __Clarinet_h
#include "physutil.h"
/**********************************************/
/* One break point linear reed table object */
/* by Perry R. Cook, 1995-96 */
/* Consult McIntyre, Schumacher, & Woodhouse */
/* Smith, Hirschman, Cook, Scavone, */
/* more for information. */
/**********************************************/
typedef struct ReedTabl {
MYFLT offSet;
MYFLT slope;
} ReedTabl;
/*******************************************/
/* One Zero Filter Class, */
/* by Perry R. Cook, 1995-96 */
/* The parameter gain is an additional */
/* gain parameter applied to the filter */
/* on top of the normalization that takes */
/* place automatically. So the net max */
/* gain through the system equals the */
/* value of gain. sgain is the combina- */
/* tion of gain and the normalization */
/* parameter, so if you set the poleCoeff */
/* to alpha, sgain is always set to */
/* gain / (1.0 - fabs(alpha)). */
/*******************************************/
typedef struct OneZero {
MYFLT gain; /* Filter subclass */
MYFLT inputs;
MYFLT zeroCoeff;
MYFLT sgain;
} OneZero;
void make_OneZero(OneZero*);
MYFLT OneZero_tick(OneZero*, MYFLT);
void OneZero_setGain(OneZero*, MYFLT);
void OneZero_setCoeff(OneZero*, MYFLT);
void OneZero_print(CSOUND*, OneZero*);
/* ********************************************************************** */
typedef struct CLARIN {
OPDS h;
MYFLT *ar; /* Output */
MYFLT *amp, *frequency;
MYFLT *reedStffns, *attack, *dettack, *noiseGain, *vibFreq;
MYFLT *vibAmt, *ifn, *lowestFreq;
FUNC *vibr; /* Table for vibrato */
MYFLT v_rate; /* Parameters for vibrato */
MYFLT v_time;
/* MYFLT v_phaseOffset; */
DLineL delayLine;
ReedTabl reedTable;
OneZero filter;
Envelope envelope;
Noise noise;
int32 length;
MYFLT outputGain;
int kloop;
} CLARIN;
/* int clarinetset(CLARINET *p); */
/* int clarinet(CLARINET *p) */
#endif
|
/*******************************************************************************
License:
This software and/or related materials was developed at the National Institute
of Standards and Technology (NIST) by employees of the Federal Government
in the course of their official duties. Pursuant to title 17 Section 105
of the United States Code, this software is not subject to copyright
protection and is in the public domain.
This software and/or related materials have been determined to be not subject
to the EAR (see Part 734.3 of the EAR for exact details) because it is
a publicly available technology and software, and is freely distributed
to any interested party with no licensing requirements. Therefore, it is
permissible to distribute this software as a free download from the internet.
Disclaimer:
This software and/or related materials was developed to promote biometric
standards and biometric technology testing for the Federal Government
in accordance with the USA PATRIOT Act and the Enhanced Border Security
and Visa Entry Reform Act. Specific hardware and software products identified
in this software were used in order to perform the software development.
In no case does such identification imply recommendation or endorsement
by the National Institute of Standards and Technology, nor does it imply that
the products and equipment identified are necessarily the best available
for the purpose.
This software and/or related materials are provided "AS-IS" without warranty
of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY,
NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY
or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the
licensed product, however used. In no event shall NIST be liable for any
damages and/or costs, including but not limited to incidental or consequential
damages of any kind, including economic damage or injury to property and lost
profits, regardless of whether NIST shall be advised, have reason to know,
or in fact shall know of the possibility.
By using this software, you agree to bear all risk relating to quality,
use and performance of the software and/or related materials. You agree
to hold the Government harmless from any claim arising from your use
of the software.
*******************************************************************************/
/***********************************************************************
LIBRARY: IMAGE - Image Manipulation and Processing Routines
FILE: IMAGEOPS.C
AUTHORS: Michael Garris
DATE: 03/07/1990
UPDATED: 03/15/2005 by MDG
Contains routines responsible for general image operations.
ROUTINES:
#cat: WordAlignImage - takes a binary image and pads out its scanlines to
#cat: an even word (16-bit) boundary.
***********************************************************************/
#include <stdio.h>
#include <defs.h>
#include <imgutil.h>
#include <memalloc.h>
#include <string.h>
/************************************************************/
/* Routine: WordAlignImage() */
/* Author: Michael D. Garris */
/* Date: 03/07/90 */
/************************************************************/
/* WordAlignImage() takes an input buffer and word aligns */
/* the scan lines returning the new scan line pixel width */
/* and the new byte length of the aligned image. */
/************************************************************/
int WordAlignImage(unsigned char **adata, int *awidth, int *alength,
unsigned char *data, int width, int height, int depth)
{
int i;
int bytes_in_line, aligned_bytes_in_line, aligned_filesize;
int aligned_pixels_in_line;
unsigned char *inlinep, *outline;
float pix_per_byte;
bytes_in_line = SizeFromDepth(width,1,depth);
aligned_pixels_in_line = WordAlignFromDepth(width,depth);
pix_per_byte = PixPerByte(depth);
aligned_bytes_in_line = (int)(aligned_pixels_in_line / pix_per_byte);
if(bytes_in_line == aligned_bytes_in_line)
return(FALSE);
aligned_filesize = aligned_bytes_in_line * height;
malloc_uchar(adata, aligned_filesize, "WordAlignImage : adata");
memset((*adata), 0, aligned_filesize);
inlinep = data;
outline = (*adata);
for(i = 0; i < height; i++){
memcpy(outline,inlinep,bytes_in_line);
outline += aligned_bytes_in_line;
inlinep += bytes_in_line;
}
*awidth = aligned_pixels_in_line;
*alength = aligned_filesize;
return(TRUE);
}
|
/*
* Copyright 2016 The Cartographer Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CARTOGRAPHER_MAPPING_INTERNAL_MOTION_FILTER_H_
#define CARTOGRAPHER_MAPPING_INTERNAL_MOTION_FILTER_H_
#include <limits>
#include "cartographer/common/lua_parameter_dictionary.h"
#include "cartographer/common/time.h"
#include "cartographer/mapping/proto/motion_filter_options.pb.h"
#include "cartographer/transform/rigid_transform.h"
namespace cartographer {
namespace mapping {
proto::MotionFilterOptions CreateMotionFilterOptions(
common::LuaParameterDictionary* parameter_dictionary);
// Takes poses as input and filters them to get fewer poses.
class MotionFilter {
public:
explicit MotionFilter(const proto::MotionFilterOptions& options);
// If the accumulated motion (linear, rotational, or time) is above the
// threshold, returns false. Otherwise the relative motion is accumulated and
// true is returned.
bool IsSimilar(common::Time time, const transform::Rigid3d& pose);
private:
const proto::MotionFilterOptions options_;
int num_total_ = 0;
int num_different_ = 0;
common::Time last_time_;
transform::Rigid3d last_pose_;
};
} // namespace mapping
} // namespace cartographer
#endif // CARTOGRAPHER_MAPPING_INTERNAL_MOTION_FILTER_H_
|
/// Copyright 2015 Google Inc. 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.
/// 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.
@import Cocoa;
@interface AppDelegate : NSObject <NSApplicationDelegate>
@end
|
// Copyright 2011 Google Inc. 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.
// 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 SYZYGY_CORE_RANDOM_NUMBER_GENERATOR_H_
#define SYZYGY_CORE_RANDOM_NUMBER_GENERATOR_H_
#include "base/basictypes.h"
namespace core {
// This is a linear congruent pseudo random generator.
// See: http://en.wikipedia.org/wiki/Linear_congruential_generator.
class RandomNumberGenerator {
public:
explicit RandomNumberGenerator(uint32 seed);
// Makes the random number generator callable (with the given modulus).
uint32 operator()(uint32 n);
private:
uint32 seed_;
};
} // namespace core
#endif // SYZYGY_CORE_RANDOM_NUMBER_GENERATOR_H_
|
#include <stdio.h>
int
main(int argc, char **argv)
{
#if (TEST_VALUE == 42)
printf("Hello World\n");
#endif
return 0;
}
|
#pragma once
#include <memory>
#include "common/common/assert.h"
#include "absl/base/call_once.h"
namespace Envoy {
/**
* ThreadSafeSingleton allows easy global cross-thread access to a non-const object.
*
* This singleton class should be used for singletons which must be globally
* accessible but can not be marked as const. All functions in the singleton class
* *must* be threadsafe.
*
* Note that there is heavy resistance in Envoy to adding this type of singleton
* if data will persist with state changes across tests, as it becomes difficult
* to write clean unit tests if a state change in one test will persist into
* another test. Be wary of using it. A example of acceptable usage is OsSyscallsImpl,
* where the functions are not strictly speaking const, but affect the OS rather than the
* class itself. An example of unacceptable usage upstream would be for
* globally accessible stat counters, it would have the aforementioned problem
* where state "leaks" across tests.
*
* */
template <class T> class TestThreadsafeSingletonInjector;
template <class T> class ThreadSafeSingleton {
public:
static T& get() {
absl::call_once(ThreadSafeSingleton<T>::create_once_, &ThreadSafeSingleton<T>::Create);
return *ThreadSafeSingleton<T>::instance_;
}
protected:
template <typename A> friend class TestThreadsafeSingletonInjector;
static void Create() { instance_ = new T(); }
static absl::once_flag create_once_;
static T* instance_;
};
template <class T> absl::once_flag ThreadSafeSingleton<T>::create_once_;
template <class T> T* ThreadSafeSingleton<T>::instance_ = nullptr;
// An instance of a singleton class which has the same thread safety properties
// as ThreadSafeSingleton, but must be created via initialize prior to access.
//
// As with ThreadSafeSingleton the use of this class is generally discouraged.
template <class T> class InjectableSingleton {
public:
static T& get() {
RELEASE_ASSERT(loader_ != nullptr, "InjectableSingleton used prior to initialization");
return *loader_;
}
static T* getExisting() { return loader_; }
static void initialize(T* value) {
RELEASE_ASSERT(value != nullptr, "InjectableSingleton initialized with non-null value.");
RELEASE_ASSERT(loader_ == nullptr, "InjectableSingleton initialized multiple times.");
loader_ = value;
}
static void clear() { loader_ = nullptr; }
protected:
static T* loader_;
};
template <class T> T* InjectableSingleton<T>::loader_ = nullptr;
template <class T> class ScopedInjectableLoader {
public:
ScopedInjectableLoader(std::unique_ptr<T>&& instance) {
instance_ = std::move(instance);
InjectableSingleton<T>::initialize(instance_.get());
}
~ScopedInjectableLoader() { InjectableSingleton<T>::clear(); }
private:
std::unique_ptr<T> instance_;
};
} // namespace Envoy
|
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*=============================================================================
VideoCore OS Abstraction Layer - platform-specific types and defines
=============================================================================*/
#ifndef VCOS_PLATFORM_TYPES_H
#define VCOS_PLATFORM_TYPES_H
#include "vcos_inttypes.h"
#ifdef __cplusplus
extern "C" {
#endif
#define VCOSPRE_ extern
#define VCOSPOST_
#if defined(__GNUC__) && (( __GNUC__ > 2 ) || (( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 3 )))
#define VCOS_FORMAT_ATTR_(ARCHETYPE, STRING_INDEX, FIRST_TO_CHECK) __attribute__ ((format (ARCHETYPE, STRING_INDEX, FIRST_TO_CHECK)))
#else
#define VCOS_FORMAT_ATTR_(ARCHETYPE, STRING_INDEX, FIRST_TO_CHECK)
#endif
#if defined(__linux__) && !defined(NDEBUG) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define VCOS_BKPT ({ __asm volatile ("int3":::"memory"); })
#endif
/*#define VCOS_BKPT vcos_abort() */
#define VCOS_ASSERT_LOGGING 1
#define VCOS_ASSERT_LOGGING_DISABLE 0
extern void
vcos_pthreads_logging_assert(const char *file, const char *func, unsigned int line, const char *fmt, ...);
#define VCOS_ASSERT_MSG(...) ((VCOS_ASSERT_LOGGING && !VCOS_ASSERT_LOGGING_DISABLE) ? vcos_pthreads_logging_assert(__FILE__, __func__, __LINE__, __VA_ARGS__) : (void)0)
#define VCOS_INLINE_BODIES
#define VCOS_INLINE_DECL extern __inline__
#define VCOS_INLINE_IMPL static __inline__
#ifdef __cplusplus
}
#endif
#endif
|
#ifndef DRAKEJOINTUTIL_H_
#define DRAKEJOINTUTIL_H_
#include "DrakeJoint.h"
#include <string>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <memory>
// FIXME: delete this interface. it's not needed anymore by the new parser
DLLEXPORT_DRAKEJOINT std::unique_ptr<DrakeJoint> createJoint(
const std::string& joint_name, const Eigen::Isometry3d& transform_to_parent_body, int floating, const Eigen::Vector3d& joint_axis, double pitch);
#endif /* DRAKEJOINTUTIL_H_ */
|
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file PPInstance.h
* @author atrestman
* @date 2009-09-14
*/
#pragma once
#include <string>
#include <vector>
#include <math.h>
#include <afxmt.h>
#include "p3d_plugin.h"
#include "PPDownloadCallback.h"
#include "PPLogger.h"
#include "fileSpec.h"
#include "load_plugin.h"
#define WM_PY_LAUNCHED (WM_USER + 1)
#define WM_PROGRESS (WM_USER + 2)
#define WM_PANDA_NOTIFICATION (WM_USER + 3)
class CP3DActiveXCtrl;
class PPInstance
{
public:
PPInstance( CP3DActiveXCtrl& parentCtrl );
virtual ~PPInstance( );
void read_tokens();
int DownloadP3DComponents( std::string& p3dDllFilename );
int LoadPlugin( const std::string& dllFilename );
int UnloadPlugin( void );
static void ref_plugin();
static void unref_plugin();
int Start( const std::string& p3dFileName );
int Stop( );
std::string GetHostUrl( );
std::string GetP3DFilename( );
static void HandleRequestLoop();
inline bool IsInit() { return m_isInit; }
HWND m_parentWnd;
CEvent m_eventStop;
CEvent m_eventDownloadStopped;
P3D_object* m_p3dObject;
// Set from fgcolor & bgcolor.
int _fgcolor_r, _fgcolor_b, _fgcolor_g;
int _bgcolor_r, _bgcolor_b, _bgcolor_g;
protected:
PPInstance( );
PPInstance( const PPInstance& );
int DownloadFile( const std::string& from, const std::string& to );
int CopyFile( const std::string& from, const std::string& to );
bool read_contents_file(const std::string &contents_filename, bool fresh_download);
void find_host(TiXmlElement *xcontents);
void read_xhost(TiXmlElement *xhost);
void add_mirror(std::string mirror_url);
void choose_random_mirrors(std::vector<std::string> &result, int num_mirrors);
bool HandleRequest( P3D_request *request );
static void HandleRequestGetUrl( void *data );
static int compare_seq(const std::string &seq_a, const std::string &seq_b);
static int compare_seq_int(const char *&num_a, const char *&num_b);
void set_failed();
std::string lookup_token(const std::string &keyword) const;
bool has_token(const std::string &keyword) const;
P3D_instance* m_p3dInstance;
CP3DActiveXCtrl& m_parentCtrl;
PPLogger m_logger;
bool m_isInit;
bool m_pluginLoaded;
CMutex _load_mutex;
std::string _download_url_prefix;
typedef std::vector<std::string> Mirrors;
Mirrors _mirrors;
std::string _coreapi_set_ver;
FileSpec _coreapi_dll;
time_t _contents_expiration;
bool _failed;
P3D_token *_tokens;
int _num_tokens;
std::string m_rootDir;
std::wstring m_rootDir_w;
class ThreadedRequestData {
public:
PPInstance *_self;
P3D_request *_request;
std::string _host_url;
};
};
|
int main() {
float f = (float)1.0;
long l = 1;
int si = 1;
unsigned int ui = 1;
char c = (char)1;
int sum = 0;
sum += f <= f;
sum += l <= l;
sum += si <= si;
sum += ui <= ui;
sum += c <= c;
sum += f <= l;
sum += f <= si;
sum += f <= ui;
sum += f <= c;
sum += l <= f;
sum += l <= si;
sum += l <= ui;
sum += l <= c;
sum += si <= f;
sum += si <= l;
sum += si <= si;
sum += si <= ui;
sum += si <= c;
sum += ui <= f;
sum += ui <= l;
sum += ui <= si;
sum += ui <= c;
sum += c <= f;
sum += c <= l;
sum += c <= si;
sum += c <= ui;
sum += c <= c;
c = 0;
l = 0;
si = 3;
sum += f <= f;
sum += l <= l;
sum += si <= si;
sum += ui <= ui;
sum += c <= c;
sum += f <= l;
sum += f <= si;
sum += f <= ui;
sum += f <= c;
sum += l <= f;
sum += l <= si;
sum += l <= ui;
sum += l <= c;
sum += si <= f;
sum += si <= l;
sum += si <= si;
sum += si <= ui;
sum += si <= c;
sum += ui <= f;
sum += ui <= l;
sum += ui <= si;
sum += ui <= c;
sum += c <= f;
sum += c <= l;
sum += c <= si;
sum += c <= ui;
sum += c <= c;
return sum;
}
|
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <stdio.h>
#include <stdarg.h>
#include <alloca.h>
int
vfprintf (iop, fmt, ap)
FILE *iop;
const char *fmt;
va_list ap;
{
int len;
if (iop->_flag & _IONBF) {
iop->_flag &= ~_IONBF;
iop->_ptr = iop->_base = alloca(BUFSIZ);
len = _doprnt(fmt, ap, iop);
(void) fflush(iop);
iop->_flag |= _IONBF;
iop->_base = NULL;
iop->_bufsiz = 0;
iop->_cnt = 0;
} else
len = _doprnt(fmt, ap, iop);
return (ferror(iop) ? EOF : len);
}
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_VIDEO_CAPTURE_PUBLIC_UMA_VIDEO_CAPTURE_SERVICE_EVENT_H_
#define SERVICES_VIDEO_CAPTURE_PUBLIC_UMA_VIDEO_CAPTURE_SERVICE_EVENT_H_
#include "base/time/time.h"
#include "build/build_config.h"
namespace video_capture {
namespace uma {
// Used for logging capture events.
// Elements in this enum should not be deleted or rearranged; the only
// permitted operation is to add new elements before
// NUM_VIDEO_CAPTURE_SERVICE_EVENT.
enum VideoCaptureServiceEvent {
BROWSER_USING_LEGACY_CAPTURE = 0,
BROWSER_CONNECTING_TO_SERVICE = 1,
SERVICE_STARTED = 2,
SERVICE_SHUTTING_DOWN_BECAUSE_NO_CLIENT = 3,
SERVICE_LOST_CONNECTION_TO_BROWSER = 4,
BROWSER_LOST_CONNECTION_TO_SERVICE = 5,
BROWSER_CLOSING_CONNECTION_TO_SERVICE = 6, // No longer in use
BROWSER_CLOSING_CONNECTION_TO_SERVICE_AFTER_ENUMERATION_ONLY = 7,
BROWSER_CLOSING_CONNECTION_TO_SERVICE_AFTER_CAPTURE = 8,
SERVICE_SHUTDOWN_TIMEOUT_CANCELED = 9,
NUM_VIDEO_CAPTURE_SERVICE_EVENT
};
#if BUILDFLAG(IS_MAC)
enum MacbookRetryGetDeviceInfosEvent {
PROVIDER_RECEIVED_ZERO_INFOS_STOPPING_SERVICE = 0,
PROVIDER_SERVICE_STOPPED_ISSUING_RETRY = 1,
PROVIDER_RECEIVED_ZERO_INFOS_FROM_RETRY_GIVING_UP = 2,
PROVIDER_RECEIVED_NONZERO_INFOS_FROM_RETRY = 3,
PROVIDER_NOT_ATTEMPTING_RETRY_BECAUSE_ALREADY_PENDING = 4,
AVF_RECEIVED_ZERO_INFOS_FIRST_TRY_FIRST_ATTEMPT = 5,
AVF_RECEIVED_NONZERO_INFOS_FIRST_TRY_FIRST_ATTEMPT = 6,
AVF_RECEIVED_ZERO_INFOS_FIRST_TRY_NONFIRST_ATTEMPT = 7,
AVF_RECEIVED_NONZERO_INFOS_FIRST_TRY_NONFIRST_ATTEMPT = 8,
AVF_RECEIVED_ZERO_INFOS_RETRY = 9,
AVF_RECEIVED_NONZERO_INFOS_RETRY = 10,
AVF_DEVICE_COUNT_CHANGED_FROM_ZERO_TO_POSITIVE = 11,
AVF_DEVICE_COUNT_CHANGED_FROM_POSITIVE_TO_ZERO = 12,
AVF_DROPPED_DESCRIPTORS_AT_FACTORY = 13,
SERVICE_DROPPED_DEVICE_INFOS_REQUEST_ON_FIRST_TRY = 14,
SERVICE_DROPPED_DEVICE_INFOS_REQUEST_ON_RETRY = 15,
NUM_RETRY_GET_DEVICE_INFOS_EVENT
};
#endif
void LogVideoCaptureServiceEvent(VideoCaptureServiceEvent event);
void LogDurationFromLastConnectToClosingConnectionAfterEnumerationOnly(
base::TimeDelta duration);
void LogDurationFromLastConnectToClosingConnectionAfterCapture(
base::TimeDelta duration);
void LogDurationFromLastConnectToConnectionLost(base::TimeDelta duration);
void LogDurationUntilReconnectAfterEnumerationOnly(base::TimeDelta duration);
void LogDurationUntilReconnectAfterCapture(base::TimeDelta duration);
#if BUILDFLAG(IS_MAC)
void LogMacbookRetryGetDeviceInfosEvent(MacbookRetryGetDeviceInfosEvent event);
#endif
} // namespace uma
} // namespace video_capture
#endif // SERVICES_VIDEO_CAPTURE_PUBLIC_UMA_VIDEO_CAPTURE_SERVICE_EVENT_H_
|
/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* Neither the name of the Ford Motor Company nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_APP_LIST_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_APP_LIST_REQUEST_H_
#include "application_manager/commands/hmi/request_to_hmi.h"
namespace application_manager {
namespace commands {
/**
* @brief UpdateAppListRequest command class
**/
class UpdateAppListRequest : public RequestToHMI {
public:
/**
* @brief UpdateAppListRequest class constructor
*
* @param message Incoming SmartObject message
**/
explicit UpdateAppListRequest(const MessageSharedPtr& message);
/**
* @brief UpdateAppListRequest class destructor
**/
virtual ~UpdateAppListRequest();
/**
* @brief Execute command
**/
virtual void Run();
private:
DISALLOW_COPY_AND_ASSIGN(UpdateAppListRequest);
};
} // namespace commands
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_APP_LIST_REQUEST_H_
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Peter van der Burg
*
* 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.
*
* Used by machine_pin.c. Holds Board/MCU specific Pin allocations.
*/
#include "modmachine.h"
#include "pins.h"
// Ensure Declaration in 'pins.h' reflects # of Pins defined here.
const machine_pin_obj_t machine_pin_obj[] = {
{{&machine_pin_type}, PIN_PA08}, // D0
{{&machine_pin_type}, PIN_PA02}, // D1
{{&machine_pin_type}, PIN_PA09}, // D2
{{&machine_pin_type}, PIN_PA07}, // D3/ RxD
{{&machine_pin_type}, PIN_PA06}, // D4/ TxD
};
const machine_led_obj_t machine_led_obj[] = {
{{&machine_led_type}, PIN_PA10}, // user LED
};
|
/* Generated automatically. DO NOT EDIT! */
#define SIMD_HEADER "simd-support/simd-altivec.h"
#include "../common/n2bv_4.c"
|
/*
* Copyright (C) Xiaozhe Wang (chaoslawful)
* Copyright (C) Yichun Zhang (agentzh)
*/
#ifndef _NGX_HTTP_LUA_CACHE_H_INCLUDED_
#define _NGX_HTTP_LUA_CACHE_H_INCLUDED_
#include "ngx_http_lua_common.h"
ngx_int_t ngx_http_lua_cache_loadbuffer(lua_State *L, const u_char *src,
size_t src_len, const u_char *cache_key, const char *name,
char **err, unsigned enabled);
ngx_int_t ngx_http_lua_cache_loadfile(lua_State *L, const u_char *script,
const u_char *cache_key, char **err, unsigned enabled);
#endif /* _NGX_HTTP_LUA_CACHE_H_INCLUDED_ */
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
/* vi: set sw=4 ts=4: */
/*
* query_module() for uClibc
*
* Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <sys/syscall.h>
int query_module(const char *name attribute_unused, int which attribute_unused,
void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused);
#ifdef __NR_query_module
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t *, ret)
#elif defined __UCLIBC_HAS_STUBS__
int query_module(const char *name attribute_unused, int which attribute_unused,
void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused)
{
__set_errno(ENOSYS);
return -1;
}
#endif
|
/* This file is part of the KDE project
Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KEXITITLELABEL_H
#define KEXITITLELABEL_H
#include <QLabel>
#include "kexiutils_export.h"
class KEXIUTILS_EXPORT KexiTitleLabel : public QLabel
{
Q_OBJECT
public:
explicit KexiTitleLabel(QWidget * parent = 0, Qt::WindowFlags f = 0);
explicit KexiTitleLabel(const QString & text, QWidget * parent = 0, Qt::WindowFlags f = 0);
~KexiTitleLabel();
protected:
void changeEvent(QEvent* event);
private:
void updateFont();
void init();
class Private;
Private * const d;
};
#endif
|
/***************************************************************************
Vector3D.h - description
-------------------
copyright : (C) 2004 by Marco Hugentobler
email : mhugent@geo.unizh.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef VECTOR3D_H
#define VECTOR3D_H
#include <cmath>
class ANALYSIS_EXPORT Vector3D
/**
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values. In fact, the class is the same as Point3D. The name 'vector' makes it easier to understand the programs.
*/
{
protected:
/** X-component of the vector*/
double mX;
/** Y-component of the vector*/
double mY;
/** Z-component of the vector*/
double mZ;
public:
/** Constructor taking the three components as arguments*/
Vector3D( double x, double y, double z );
/** Default constructor*/
Vector3D();
/** Copy constructor*/
Vector3D( const Vector3D& v );
/** Destructor*/
~Vector3D();
Vector3D& operator=( const Vector3D& v );
bool operator==( const Vector3D& v ) const;
bool operator!=( const Vector3D& v ) const;
/** Returns the x-component of the vector*/
double getX() const;
/** Returns the y-component of the vector*/
double getY() const;
/** Returns the z-component of the vector*/
double getZ() const;
/** Returns the length of the vector*/
double getLength() const;
/** Sets the x-component of the vector*/
void setX( double x );
/** Sets the y-component of the vector*/
void setY( double y );
/** Sets the z-component of the vector*/
void setZ( double z );
/** Standardises the vector*/
void standardise();
};
//------------------------------------------constructors------------------------------------
inline Vector3D::Vector3D( double x, double y, double z ) : mX( x ), mY( y ), mZ( z )
{
}
inline Vector3D::Vector3D() : mX( 0 ), mY( 0 ), mZ( 0 )//using a list
{
}
inline Vector3D::~Vector3D()
{
}
//-------------------------------------------setter and getters-------------------------------
inline double Vector3D::getX() const
{
return mX;
}
inline double Vector3D::getY() const
{
return mY;
}
inline double Vector3D::getZ() const
{
return mZ;
}
inline void Vector3D::setX( double x )
{
mX = x;
}
inline void Vector3D::setY( double y )
{
mY = y;
}
inline void Vector3D::setZ( double z )
{
mZ = z;
}
#endif
|
#pragma once
#include "MockedTargets.h"
namespace ai
{
class MockPlayerbotAIBase : public PlayerbotAI
{
public:
MockPlayerbotAIBase() : PlayerbotAI()
{
targetIsCastingNonMeleeSpell = false;
}
void SetContext(AiObjectContext* context) { this->aiObjectContext = context; }
virtual uint32 GetSpellId(string args) { return 1; }
virtual void InterruptSpell();
virtual void RemoveAura(string name);
virtual bool CanCastSpell(string name, Unit* target);
virtual bool CastSpell(string name, Unit* target);
virtual bool HasAura(string spellName, Unit* player);
virtual bool IsInterruptableSpellCasting(Unit* player, string spell);
virtual bool HasAuraToDispel(Unit* player, uint32 dispelType);
virtual bool IsSpellCastUseful(string name, Unit* target);
public:
void resetSpells() {spellCooldowns.clear(); }
public:
string buffer;
public:
list<string > spellCooldowns;
map<Unit*, list<string >> auras;
map<Unit*, uint32> dispels;
bool targetIsCastingNonMeleeSpell;
};
}
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2008-2009 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __PACKAGEKIT_PRIVATE_H__
#define __PACKAGEKIT_PRIVATE_H__
#define __PACKAGEKIT_H_INSIDE__
#include <packagekit-glib2/pk-task-sync.h>
#include <packagekit-glib2/pk-task-text.h>
#include <packagekit-glib2/pk-console-shared.h>
#include <packagekit-glib2/pk-progress-bar.h>
#undef __PACKAGEKIT_H_INSIDE__
#endif /* __PACKAGEKIT_PRIVATE_H__ */
|
/*
* SAUCE header parser
* Copyright (c) 2010 Peter Ross <pross@xvid.org>
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* SAUCE header parser
*/
#ifndef AVFORMAT_SAUCE_H
#define AVFORMAT_SAUCE_H
#include "avformat.h"
/**
* @param avctx AVFormatContext
* @param[out] fsize return length of file, less SAUCE header
* @param[out] got_width set to non-zero if SAUCE header reported height
* @param get_height Tell SAUCE header to parse height
*/
int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int get_height);
#endif /* AVFORMAT_SAUCE_H */
|
/*
* Copyright (c) 2013 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef TXRX_H
#define TXRX_H
#include "vos_api.h"
#include "adf_nbuf.h"
#include "csrApi.h"
#include "sapApi.h"
#include "adf_nbuf.h"
#include "ol_txrx_osif_api.h"
#include "wlan_qct_tl.h"
enum txrx_wmm_ac {
TXRX_WMM_AC_VO,
TXRX_WMM_AC_VI,
TXRX_WMM_AC_BK,
TXRX_WMM_AC_BE,
TXRX_NUM_WMM_AC
};
struct txrx_rx_metainfo {
u8 up;
u16 dest_staid;
};
enum bt_frame_type {
/* BT-AMP packet of type data */
TXRX_BT_AMP_TYPE_DATA = 0x0001,
/* BT-AMP packet of type activity report */
TXRX_BT_AMP_TYPE_AR = 0x0002,
/* BT-AMP packet of type security frame */
TXRX_BT_AMP_TYPE_SEC = 0x0003,
/* BT-AMP packet of type Link Supervision request frame */
TXRX_BT_AMP_TYPE_LS_REQ = 0x0004,
/* BT-AMP packet of type Link Supervision reply frame */
TXRX_BT_AMP_TYPE_LS_REP = 0x0005,
/* Invalid Frame */
TXRX_BAP_INVALID_FRAME
};
enum wlan_ts_direction {
/* uplink */
WLAN_TX_DIR = 0,
/* downlink */
WLAN_RX_DIR = 1,
/*bidirectional*/
WLAN_BI_DIR = 2,
};
enum wlan_sta_state {
/* Transition in this state made upon creation*/
WLAN_STA_INIT = 0,
/* Transition happens after Assoc success if second level authentication
is needed*/
WLAN_STA_CONNECTED,
/* Transition happens when second level auth is successful and keys are
properly installed */
WLAN_STA_AUTHENTICATED,
/* Transition happens when connectivity is lost*/
WLAN_STA_DISCONNECTED,
WLAN_STA_MAX_STATE
};
struct wlan_txrx_stats {
/* Define various txrx stats here*/
};
struct ol_txrx_vdev_t;
VOS_STATUS wlan_register_mgmt_client(void *pdev_txrx,
VOS_STATUS (*rx_mgmt)(void *g_vosctx,
void *buf));
typedef void (*ol_txrx_vdev_delete_cb)(void *context);
/**
* @typedef ol_txrx_tx_fp
* @brief top-level transmit function
*/
typedef adf_nbuf_t
(*ol_txrx_tx_fp)(struct ol_txrx_vdev_t *vdev, adf_nbuf_t msdu_list);
typedef void
(*ol_txrx_mgmt_tx_cb)(void *ctxt, adf_nbuf_t tx_mgmt_frm, int had_error);
/* If RSSI realm is changed, send notification to Clients, SME, HDD */
typedef VOS_STATUS (*wlan_txrx_rssi_cross_thresh) (void *adapter, u8 rssi,
void *usr_ctx, v_S7_t avg_rssi);
struct wlan_txrx_ind_req {
u16 msgType; // message type is same as the request type
u16 msgLen; // length of the entire request
u8 sessionId; //sme Session Id
u8 rssiNotification;
u8 avgRssi;
void *tlCallback;
void *pAdapter;
void *pUserCtxt;
};
struct wlan_txrx_config_param {
u8 ucAcWeights[TXRX_NUM_WMM_AC];
u32 uDelayedTriggerFrmInt;
u8 uMinFramesProcThres;
};
/* Rx callback registered with txrx */
typedef int (*wlan_txrx_cb_type)( void *g_vosctx, adf_nbuf_t buf, u8 sta_id,
struct txrx_rx_metainfo *rx_meta_info);
static inline int wlan_txrx_get_rssi(void *g_vosctx, u8 sta_id, v_S7_t *rssi)
{
return 0;
}
static inline int wlan_txrx_enable_uapsd_ac(void *g_vosctx, u8 sta_id,
enum txrx_wmm_ac ac, u8 tid, u8 up,
u32 srv_int, u32 suspend_int,
enum wlan_ts_direction ts_dir)
{
return 0;
}
static inline int wlan_txrx_disable_uapsd_ac(void *g_vosctx, u8 sta_id,
enum txrx_wmm_ac ac)
{
return 0;
}
static inline int wlan_change_sta_state(void *g_vosctx, u8 sta_id,
enum wlan_sta_state state)
{
return 0;
}
static inline int wlan_deregister_mgmt_client(void *g_vosctx)
{
return 0;
}
static inline void wlan_assoc_failed(u8 staid)
{
}
static inline int wlan_get_ap_stats(void *g_vosctx, tSap_SoftapStats *buf,
bool reset)
{
return 0;
}
static inline int wlan_get_txrx_stats(void *g_vosctx, struct wlan_txrx_stats *stats,
u8 sta_id)
{
return 0;
}
static inline int wlan_txrx_update_rssi_bmps(void *g_vosctx, u8 sta_id,
v_S7_t rssi)
{
return 0;
}
static inline int wlan_txrx_deregister_rssi_indcb(void *g_vosctx,
v_S7_t rssi_val,
u8 trigger_event,
wlan_txrx_rssi_cross_thresh cb,
int mod_id)
{
return 0;
}
static inline int wlan_txrx_register_rssi_indcb(void *g_vosctx,
v_S7_t rssi_val,
u8 trigger_event,
wlan_txrx_rssi_cross_thresh cb,
int mod_id, void *usr_ctx)
{
return 0;
}
/* FIXME: The following stubs will be removed eventually */
static inline int wlan_txrx_mc_process_msg(void *g_vosctx, vos_msg_t *msg)
{
return 0;
}
static inline int wlan_txrx_tx_process_msg(void *g_vosctx, vos_msg_t *msg)
{
return 0;
}
static inline void wlan_txrx_mc_free_msg(void *g_vosctx, vos_msg_t *msg)
{
}
static inline void wlan_txrx_tx_free_msg(void *g_vosctx, vos_msg_t *msg)
{
}
#endif
|
/* ----------------------------------------------------------------------
This is the
██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗████████╗███████╗
██║ ██║██╔════╝ ██╔════╝ ██╔════╝ ██║ ██║╚══██╔══╝██╔════╝
██║ ██║██║ ███╗██║ ███╗██║ ███╗███████║ ██║ ███████╗
██║ ██║██║ ██║██║ ██║██║ ██║██╔══██║ ██║ ╚════██║
███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║ ██║ ██║ ███████║
╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝®
DEM simulation engine, released by
DCS Computing Gmbh, Linz, Austria
http://www.dcs-computing.com, office@dcs-computing.com
LIGGGHTS® is part of CFDEM®project:
http://www.liggghts.com | http://www.cfdem.com
Core developer and main author:
Christoph Kloss, christoph.kloss@dcs-computing.com
LIGGGHTS® is open-source, distributed under the terms of the GNU Public
License, version 2 or later. It 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. You should have
received a copy of the GNU General Public License along with LIGGGHTS®.
If not, see http://www.gnu.org/licenses . See also top-level README
and LICENSE files.
LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
the producer of the LIGGGHTS® software and the CFDEM®coupling software
See http://www.cfdem.com/terms-trademark-policy for details.
-------------------------------------------------------------------------
Contributing author and copyright for this file:
This file is from LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
------------------------------------------------------------------------- */
#ifdef COMMAND_CLASS
CommandStyle(minimize,Minimize)
#else
#ifndef LMP_MINIMIZE_H
#define LMP_MINIMIZE_H
#include "pointers.h"
namespace LAMMPS_NS {
class Minimize : protected Pointers {
public:
Minimize(class LAMMPS *);
void command(int, char **);
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Minimize command before simulation box is defined
The minimize command cannot be used before a read_data, read_restart,
or create_box command.
E: Too many iterations
You must use a number of iterations that fit in a 32-bit integer
for minimization.
*/
|
/*
** rgssad.h
**
** This file is part of mkxp.
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp 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.
**
** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RGSSAD_H
#define RGSSAD_H
#include <physfs.h>
extern const PHYSFS_Archiver RGSS1_Archiver;
extern const PHYSFS_Archiver RGSS2_Archiver;
extern const PHYSFS_Archiver RGSS3_Archiver;
#endif // RGSSAD_H
|
#ifndef SESSION_H
#define SESSION_H
#include "kdf.h"
#include <stdbool.h>
struct public_key {
unsigned char *key;
size_t len;
};
struct private_key {
unsigned char *key;
size_t len;
};
struct session {
char *uid;
char *sessionid;
char *token;
struct private_key private_key;
};
struct session *session_new();
void session_free(struct session *session);
bool session_is_valid(struct session *session);
struct session *sesssion_load(unsigned const char key[KDF_HASH_LEN]);
void session_save(struct session *session, unsigned const char key[KDF_HASH_LEN]);
void session_set_private_key(struct session *session, unsigned const char key[KDF_HASH_LEN], const char *key_hex);
#endif
|
/*
* Copyright (c) 2013-2016 TRUSTONIC LIMITED
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _MC_USER_H_
#define _MC_USER_H_
#define MCDRVMODULEAPI_VERSION_MAJOR 3
#define MCDRVMODULEAPI_VERSION_MINOR 1
#include <linux/types.h>
#define MC_USER_DEVNODE "mobicore-user"
#define MC_PRODUCT_ID_LEN 64
#define MC_MAP_MAX 4
#define BUFFER_LENGTH_MAX 0x100000
#define MC_IO_MAP_INPUT 0x1
#define MC_IO_MAP_OUTPUT 0x2
#define MC_IO_MAP_INPUT_OUTPUT (MC_IO_MAP_INPUT | MC_IO_MAP_OUTPUT)
struct mc_uuid_t {
__u8 value[16];
};
enum mc_login_type {
LOGIN_PUBLIC = 0,
LOGIN_USER,
LOGIN_GROUP,
LOGIN_APPLICATION = 4,
LOGIN_USER_APPLICATION,
LOGIN_GROUP_APPLICATION,
};
struct mc_identity {
enum mc_login_type login_type;
union {
__u8 login_data[16];
gid_t gid;
struct {
uid_t euid;
uid_t ruid;
} uid;
};
pid_t pid;
};
struct mc_ioctl_open_session {
struct mc_uuid_t uuid;
__u32 is_gp_uuid;
__u32 sid;
__u64 tci;
__u32 tcilen;
struct mc_identity identity;
};
struct mc_ioctl_open_trustlet {
__u32 sid;
__u32 spid;
__u64 buffer;
__u32 tlen;
__u64 tci;
__u32 tcilen;
};
struct mc_ioctl_wait {
__u32 sid;
__s32 timeout;
__u32 partial;
};
struct mc_ioctl_alloc {
__u32 len;
__u32 handle;
};
struct mc_ioctl_buffer {
__u64 va;
__u32 len;
__u64 sva;
__u32 flags;
};
struct mc_ioctl_map {
__u32 sid;
struct mc_ioctl_buffer bufs[MC_MAP_MAX];
};
struct mc_ioctl_geterr {
__u32 sid;
__s32 value;
};
struct mc_version_info {
char product_id[MC_PRODUCT_ID_LEN];
__u32 version_mci;
__u32 version_so;
__u32 version_mclf;
__u32 version_container;
__u32 version_mc_config;
__u32 version_tl_api;
__u32 version_dr_api;
__u32 version_nwd;
};
struct mc_authenticator_check {
pid_t pid;
};
#define MC_IOC_MAGIC 'M'
#define MC_IO_OPEN_SESSION \
_IOWR(MC_IOC_MAGIC, 0, struct mc_ioctl_open_session)
#define MC_IO_OPEN_TRUSTLET \
_IOWR(MC_IOC_MAGIC, 1, struct mc_ioctl_open_trustlet)
#define MC_IO_CLOSE_SESSION \
_IO(MC_IOC_MAGIC, 2)
#define MC_IO_NOTIFY \
_IO(MC_IOC_MAGIC, 3)
#define MC_IO_WAIT \
_IOW(MC_IOC_MAGIC, 4, struct mc_ioctl_wait)
#define MC_IO_MAP \
_IOWR(MC_IOC_MAGIC, 5, struct mc_ioctl_map)
#define MC_IO_UNMAP \
_IOW(MC_IOC_MAGIC, 6, struct mc_ioctl_map)
#define MC_IO_ERR \
_IOWR(MC_IOC_MAGIC, 7, struct mc_ioctl_geterr)
#define MC_IO_HAS_SESSIONS \
_IO(MC_IOC_MAGIC, 8)
#define MC_IO_VERSION \
_IOR(MC_IOC_MAGIC, 9, struct mc_version_info)
#define MC_IO_AUTHENTICATOR_CHECK \
_IOW(MC_IOC_MAGIC, 10, struct mc_authenticator_check)
#endif
|
/* cnic_register.h: QLogic CNIC Registration Agent
*
* Copyright (c) 2010-2014 QLogic Corporation
*
* Portions Copyright (c) VMware, Inc. 2010-2014, 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 v.2 as published by
* the Free Software Foundation.
*
* Written by:
*/
#ifndef CNIC_REGISTER_H
#define CNIC_REGISTER_H
#define CNIC_REGISTER_MODULE_VERSION "1.78.75.v60.7"
#define CNIC_REGISTER_MODULE_RELDATE "May 21, 2014"
extern int cnic_register_adapter(const char * name, void *callback);
extern void *cnic_register_get_callback(const char * name);
extern void cnic_register_cancel(const char * name);
extern int cnic_register_get_table_size(void);
extern int cnic_register_get_callback_by_index(int index, char * name, void **callback);
extern void cnic_register_release_all_callbacks();
#endif /* CNIC_REGISTER_H */
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**
** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
**
** Authors:
** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve@vpac.org)
** Patrick D. Sunter, Software Engineer, VPAC. (pds@vpac.org)
** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins@vpac.org)
** Siew-Ching Tan, Software Engineer, VPAC. (siew@vpac.org)
** Alan H. Lo, Computational Engineer, VPAC. (alan@vpac.org)
** Raquibul Hassan, Computational Engineer, VPAC. (raq@vpac.org)
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.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
**
** $Id: petsccompat.h 3403 2006-01-13 08:33:58Z RobertTurnbull $
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef __STGMESSAGING_H__
#define __STGMESSAGING_H__
int Stg_MPI_Send( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm );
int Stg_MPI_Ssend( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm );
int Stg_MPI_Isend( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request );
int Stg_MPI_Recv( char* file, int line, void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status );
int Stg_MPI_Irecv( char* file, int line, void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request );
int Stg_MPI_Reduce ( char* file, int line, void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm );
int Stg_MPI_Allreduce ( char* file, int line, void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm );
int Stg_MPI_Gather ( char* file, int line, void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm );
int Stg_MPI_Allgather ( char* file, int line, void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm );
int Stg_MPI_Wait ( char* file, int line, MPI_Request *request, MPI_Status *status );
int Stg_MPI_Test ( char* file, int line, MPI_Request *request, int *flag, MPI_Status *status );
#endif
|
#include <linux/kernel.h>
#include <asm/cputype.h>
#include <asm/idmap.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/sections.h>
#include <asm/system_info.h>
pgd_t *idmap_pgd;
#ifdef CONFIG_ARM_LPAE
static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
unsigned long prot)
{
pmd_t *pmd;
unsigned long next;
if (pud_none_or_clear_bad(pud) || (pud_val(*pud) & L_PGD_SWAPPER)) {
pmd = pmd_alloc_one(&init_mm, addr);
if (!pmd) {
pr_warning("Failed to allocate identity pmd.\n");
return;
}
/*
* Copy the original PMD to ensure that the PMD entries for
* the kernel image are preserved.
*/
if (!pud_none(*pud))
memcpy(pmd, pmd_offset(pud, 0),
PTRS_PER_PMD * sizeof(pmd_t));
pud_populate(&init_mm, pud, pmd);
pmd += pmd_index(addr);
} else
pmd = pmd_offset(pud, addr);
do {
next = pmd_addr_end(addr, end);
*pmd = __pmd((addr & PMD_MASK) | prot);
flush_pmd_entry(pmd);
} while (pmd++, addr = next, addr != end);
}
#else /* !CONFIG_ARM_LPAE */
static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
unsigned long prot)
{
#ifdef TIMA_KERNEL_L1_MANAGE
unsigned long cmd_id = 0x3f809221;
unsigned long tima_wr_out;
#endif
pmd_t *pmd = pmd_offset(pud, addr);
addr = (addr & PMD_MASK) | prot;
#ifdef TIMA_KERNEL_L1_MANAGE
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
__asm__ __volatile__(".arch_extension sec");
#endif
clean_dcache_area(pmd, 8);
__asm__ __volatile__ (
"stmfd sp!,{r0, r8-r11}\n"
"mov r11, r0\n"
"mov r0, %1\n"
"mov r8, %2\n"
"mov r9, %3\n"
"mov r10, %4\n"
"mcr p15, 0, r8, c7, c14, 1\n"
"add r8, r8, #4\n"
"mcr p15, 0, r8, c7, c14, 1\n"
"dsb\n"
"smc #9\n"
"sub r8, r8, #4\n"
"mcr p15, 0, r8, c7, c6, 1\n"
"dsb\n"
"mov %0, r10\n"
"add r8, r8, #4\n"
"mcr p15, 0, r8, c7, c6, 1\n"
"dsb\n"
"mov r0, #0\n"
"mcr p15, 0, r0, c8, c3, 0\n"
"dsb\n"
"isb\n"
"pop {r0, r8-r11}\n"
:"=r"(tima_wr_out):"r"(cmd_id),"r"((unsigned long)pmd),"r"(addr),"r"(addr + SECTION_SIZE):"r0","r8","r9","r10","r11","cc");
if ((pmd[0]|0x4) != (addr|0x4)) {
printk(KERN_ERR"pmd[0] %lx != addr %lx - %lx %lx in func: %s tima_wr_out = %lx\n",
(unsigned long) pmd[0], addr, (unsigned long) pmd[1], addr + SECTION_SIZE, __func__, tima_wr_out);
tima_send_cmd(pmd[0], 0x3f810221);
}
if ((pmd[1]|0x4)!=((addr + SECTION_SIZE)|0x4)) {
printk(KERN_ERR"pmd[1] %lx != (addr + SECTION_SIZE) %lx in func: %s\n",
(unsigned long) pmd[1], (addr + SECTION_SIZE), __func__);
tima_send_cmd(pmd[1], 0x3f810221);
}
#else
pmd[0] = __pmd(addr);
addr += SECTION_SIZE;
pmd[1] = __pmd(addr);
#endif
flush_pmd_entry(pmd);
}
#endif /* CONFIG_ARM_LPAE */
static void idmap_add_pud(pgd_t *pgd, unsigned long addr, unsigned long end,
unsigned long prot)
{
pud_t *pud = pud_offset(pgd, addr);
unsigned long next;
do {
next = pud_addr_end(addr, end);
idmap_add_pmd(pud, addr, next, prot);
} while (pud++, addr = next, addr != end);
}
static void identity_mapping_add(pgd_t *pgd, unsigned long addr, unsigned long end)
{
unsigned long prot, next;
prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF;
if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale())
prot |= PMD_BIT4;
pgd += pgd_index(addr);
do {
next = pgd_addr_end(addr, end);
idmap_add_pud(pgd, addr, next, prot);
} while (pgd++, addr = next, addr != end);
}
extern char __idmap_text_start[], __idmap_text_end[];
static int __init init_static_idmap(void)
{
phys_addr_t idmap_start, idmap_end;
idmap_pgd = pgd_alloc(&init_mm);
if (!idmap_pgd)
return -ENOMEM;
/* Add an identity mapping for the physical address of the section. */
idmap_start = virt_to_phys((void *)__idmap_text_start);
idmap_end = virt_to_phys((void *)__idmap_text_end);
pr_info("Setting up static identity map for 0x%llx - 0x%llx\n",
(long long)idmap_start, (long long)idmap_end);
identity_mapping_add(idmap_pgd, idmap_start, idmap_end);
/* Flush L1 for the hardware to see this page table content */
flush_cache_louis();
return 0;
}
early_initcall(init_static_idmap);
/*
* In order to soft-boot, we need to switch to a 1:1 mapping for the
* cpu_reset functions. This will then ensure that we have predictable
* results when turning off the mmu.
*/
void setup_mm_for_reboot(void)
{
/* Switch to the identity mapping. */
cpu_switch_mm(idmap_pgd, &init_mm);
local_flush_bp_all();
#ifdef CONFIG_CPU_HAS_ASID
/*
* We don't have a clean ASID for the identity mapping, which
* may clash with virtual addresses of the previous page tables
* and therefore potentially in the TLB.
*/
local_flush_tlb_all();
#endif
}
|
/*
* Copyright (c) 2010 Sean C. Rhea (srhea@srhea.net)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _FitRideFile_h
#define _FitRideFile_h
#include "GoldenCheetah.h"
#include "RideFile.h"
struct FitFileReader : public RideFileReader {
virtual RideFile *openRideFile(QFile &file, QStringList &errors, QList<RideFile*> *rides = 0) const;
QByteArray toByteArray(Context *context, const RideFile *ride, bool withAlt, bool withWatts, bool withHr, bool withCad) const;
bool writeRideFile(Context *context, const RideFile *ride, QFile &file) const;
bool hasWrite() const { return true; }
};
#endif // _FitRideFile_h
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2.
*
* 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.
*
*
* Test that sched_get_priority_max() returns the maximum value on
* success for SCHED_OTHER policy.
*/
#include <stdio.h>
#include <sched.h>
#include <errno.h>
#include "posixtest.h"
int main(void)
{
int result = -1;
result = sched_get_priority_max(SCHED_OTHER);
if (result != -1 && errno == 0) {
printf("The maximum priority for policy SCHED_OTHER is %i.\n",
result);
printf("Test PASSED\n");
return PTS_PASS;
} else {
perror("An error occurs");
return PTS_FAIL;
}
printf("This code should not be executed.\n");
return PTS_UNRESOLVED;
}
|
/******************************************************************************
*
*
*
* Copyright (C) 1997-2014 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef FILENAME_H
#define FILENAME_H
#include <qdict.h>
#include <qlist.h>
#include "filedef.h"
/** Class representing all files with a certain base name */
class FileName : public FileList
{
public:
FileName(const char *fn,const char *name);
~FileName();
const char *fileName() const { return name; }
const char *fullName() const { return fName; }
void generateDiskNames();
private:
int compareValues(const FileDef *item1,const FileDef *item2) const;
QCString name;
QCString fName;
};
/** Iterator for FileDef objects in a FileName list. */
class FileNameIterator : public QListIterator<FileDef>
{
public:
FileNameIterator(const FileName &list);
};
/** Class representing a list of FileName objects. */
class FileNameList : public QList<FileName>
{
public:
FileNameList();
~FileNameList();
void generateDiskNames();
private:
int compareValues(const FileName *item1,const FileName *item2) const;
};
/** Iterator for FileName objects in a FileNameList. */
class FileNameListIterator : public QListIterator<FileName>
{
public:
FileNameListIterator( const FileNameList &list );
};
/** Unsorted dictionary of FileName objects. */
class FileNameDict : public QDict<FileName>
{
public:
FileNameDict(uint size);
~FileNameDict() {}
};
#endif
|
#if __has_feature(objc_arr)
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
#else
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
#endif
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
#define CF_CONSUMED __attribute__((cf_consumed))
#define NS_INLINE static __inline__ __attribute__((always_inline))
#define nil ((void*) 0)
typedef int BOOL;
typedef unsigned NSUInteger;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef int32_t UChar32;
typedef unsigned char UChar;
typedef struct _NSZone NSZone;
typedef const void * CFTypeRef;
CFTypeRef CFRetain(CFTypeRef cf);
id CFBridgingRelease(CFTypeRef CF_CONSUMED X);
NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
@protocol NSObject
- (BOOL)isEqual:(id)object;
- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
@end
@interface NSObject <NSObject> {}
- (id)init;
+ (id)new;
+ (id)alloc;
- (void)dealloc;
- (void)finalize;
- (id)copy;
- (id)mutableCopy;
@end
NS_AUTOMATED_REFCOUNT_UNAVAILABLE
@interface NSAutoreleasePool : NSObject {
@private
void *_token;
void *_reserved3;
void *_reserved2;
void *_reserved;
}
+ (void)addObject:(id)anObject;
- (void)addObject:(id)anObject;
- (void)drain;
@end
typedef const void* objc_objectptr_t;
extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer);
extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer);
extern objc_objectptr_t objc_unretainedPointer(id object);
|
#ifndef DIALOGSHORTCUTS_H
#define DIALOGSHORTCUTS_H
#include <QDialog>
namespace Ui {
class DialogShortcuts;
}
class DialogShortcuts : public QDialog
{
Q_OBJECT
public:
explicit DialogShortcuts(QWidget *parent = 0);
~DialogShortcuts();
private:
Ui::DialogShortcuts *ui;
};
#endif // DIALOGSHORTCUTS_H
|
/*-------------------------------------------------------------------------
*
* timer.c
* Microsoft Windows Win32 Timer Implementation
*
* Limitations of this implementation:
*
* - Does not support interval timer (value->it_interval)
* - Only supports ITIMER_REAL
*
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
*
* IDENTIFICATION
* src/backend/port/win32/timer.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
/* Communication area for inter-thread communication */
typedef struct timerCA
{
struct itimerval value;
HANDLE event;
CRITICAL_SECTION crit_sec;
} timerCA;
static timerCA timerCommArea;
static HANDLE timerThreadHandle = INVALID_HANDLE_VALUE;
/* Timer management thread */
static DWORD WINAPI
pg_timer_thread(LPVOID param)
{
DWORD waittime;
Assert(param == NULL);
waittime = INFINITE;
for (;;)
{
int r;
r = WaitForSingleObjectEx(timerCommArea.event, waittime, FALSE);
if (r == WAIT_OBJECT_0)
{
/* Event signalled from main thread, change the timer */
EnterCriticalSection(&timerCommArea.crit_sec);
if (timerCommArea.value.it_value.tv_sec == 0 &&
timerCommArea.value.it_value.tv_usec == 0)
waittime = INFINITE; /* Cancel the interrupt */
else
{
/* WaitForSingleObjectEx() uses milliseconds, round up */
waittime = (timerCommArea.value.it_value.tv_usec + 999) / 1000 +
timerCommArea.value.it_value.tv_sec * 1000;
}
ResetEvent(timerCommArea.event);
LeaveCriticalSection(&timerCommArea.crit_sec);
}
else if (r == WAIT_TIMEOUT)
{
/* Timeout expired, signal SIGALRM and turn it off */
pg_queue_signal(SIGALRM);
waittime = INFINITE;
}
else
{
/* Should never happen */
Assert(false);
}
}
return 0;
}
/*
* Win32 setitimer emulation by creating a persistent thread
* to handle the timer setting and notification upon timeout.
*/
int
setitimer(int which, const struct itimerval * value, struct itimerval * ovalue)
{
Assert(value != NULL);
Assert(value->it_interval.tv_sec == 0 && value->it_interval.tv_usec == 0);
Assert(which == ITIMER_REAL);
if (timerThreadHandle == INVALID_HANDLE_VALUE)
{
/* First call in this backend, create event and the timer thread */
timerCommArea.event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (timerCommArea.event == NULL)
ereport(FATAL,
(errmsg_internal("could not create timer event: error code %lu",
GetLastError())));
MemSet(&timerCommArea.value, 0, sizeof(struct itimerval));
InitializeCriticalSection(&timerCommArea.crit_sec);
timerThreadHandle = CreateThread(NULL, 0, pg_timer_thread, NULL, 0, NULL);
if (timerThreadHandle == INVALID_HANDLE_VALUE)
ereport(FATAL,
(errmsg_internal("could not create timer thread: error code %lu",
GetLastError())));
}
/* Request the timer thread to change settings */
EnterCriticalSection(&timerCommArea.crit_sec);
if (ovalue)
*ovalue = timerCommArea.value;
timerCommArea.value = *value;
LeaveCriticalSection(&timerCommArea.crit_sec);
SetEvent(timerCommArea.event);
return 0;
}
|
// Copyright 2006 Nemanja Trifunovic
/*
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include "external/utf8cpp/utf8/checked.h"
#include "external/utf8cpp/utf8/unchecked.h"
#endif // header guard
|
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimppatterns.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
#ifndef __GIMP_PATTERNS_H__
#define __GIMP_PATTERNS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_patterns_set_pattern (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GIMP_PATTERNS_H__ */
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef SDK_HUD_CHAT_H
#define SDK_HUD_CHAT_H
#ifdef _WIN32
#pragma once
#endif
#include <hud_basechat.h>
class CHudChatLine : public CBaseHudChatLine
{
DECLARE_CLASS_SIMPLE( CHudChatLine, CBaseHudChatLine );
public:
CHudChatLine( vgui::Panel *parent, const char *panelName ) : CBaseHudChatLine( parent, panelName ) {}
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
void PerformFadeout( void );
void MsgFunc_SayText(bf_read &msg);
private:
CHudChatLine( const CHudChatLine & ); // not defined, not accessible
};
//-----------------------------------------------------------------------------
// Purpose: The prompt and text entry area for chat messages
//-----------------------------------------------------------------------------
class CHudChatInputLine : public CBaseHudChatInputLine
{
DECLARE_CLASS_SIMPLE( CHudChatInputLine, CBaseHudChatInputLine );
public:
CHudChatInputLine( CBaseHudChat *parent, char const *panelName ) : CBaseHudChatInputLine( parent, panelName ) {}
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
};
class CHudChat : public CBaseHudChat
{
DECLARE_CLASS_SIMPLE( CHudChat, CBaseHudChat );
public:
CHudChat( const char *pElementName );
virtual void CreateChatInputLine( void );
virtual void CreateChatLines( void );
virtual void Init( void );
virtual void Reset( void );
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
void MsgFunc_SayText( bf_read &msg );
void MsgFunc_TextMsg( bf_read &msg );
void ChatPrintf( int iPlayerIndex, PRINTF_FORMAT_STRING const char *fmt, ... );
int GetChatInputOffset( void );
};
#endif //SDK_HUD_CHAT_H |
/*
* Copyright (c) Vicent Marti. All rights reserved.
*
* This file is part of clar, distributed under the ISC license.
* For full terms see the included COPYING file.
*/
#ifndef __CLAR_TEST_H__
#define __CLAR_TEST_H__
#include <stdlib.h>
enum cl_test_status {
CL_TEST_OK,
CL_TEST_FAILURE,
CL_TEST_SKIP
};
void clar_test_init(int argc, char *argv[]);
int clar_test_run(void);
void clar_test_shutdown(void);
int clar_test(int argc, char *argv[]);
const char *clar_sandbox_path(void);
void cl_set_cleanup(void (*cleanup)(void *), void *opaque);
void cl_fs_cleanup(void);
#ifdef CLAR_FIXTURE_PATH
const char *cl_fixture(const char *fixture_name);
void cl_fixture_sandbox(const char *fixture_name);
void cl_fixture_cleanup(const char *fixture_name);
#endif
/**
* Assertion macros with explicit error message
*/
#define cl_must_pass_(expr, desc) clar__assert((expr) >= 0, __FILE__, __LINE__, "Function call failed: " #expr, desc, 1)
#define cl_must_fail_(expr, desc) clar__assert((expr) < 0, __FILE__, __LINE__, "Expected function call to fail: " #expr, desc, 1)
#define cl_assert_(expr, desc) clar__assert((expr) != 0, __FILE__, __LINE__, "Expression is not true: " #expr, desc, 1)
/**
* Check macros with explicit error message
*/
#define cl_check_pass_(expr, desc) clar__assert((expr) >= 0, __FILE__, __LINE__, "Function call failed: " #expr, desc, 0)
#define cl_check_fail_(expr, desc) clar__assert((expr) < 0, __FILE__, __LINE__, "Expected function call to fail: " #expr, desc, 0)
#define cl_check_(expr, desc) clar__assert((expr) != 0, __FILE__, __LINE__, "Expression is not true: " #expr, desc, 0)
/**
* Assertion macros with no error message
*/
#define cl_must_pass(expr) cl_must_pass_(expr, NULL)
#define cl_must_fail(expr) cl_must_fail_(expr, NULL)
#define cl_assert(expr) cl_assert_(expr, NULL)
/**
* Check macros with no error message
*/
#define cl_check_pass(expr) cl_check_pass_(expr, NULL)
#define cl_check_fail(expr) cl_check_fail_(expr, NULL)
#define cl_check(expr) cl_check_(expr, NULL)
/**
* Forced failure/warning
*/
#define cl_fail(desc) clar__fail(__FILE__, __LINE__, "Test failed.", desc, 1)
#define cl_warning(desc) clar__fail(__FILE__, __LINE__, "Warning during test execution:", desc, 0)
#define cl_skip() clar__skip()
/**
* Typed assertion macros
*/
#define cl_assert_equal_s(s1,s2) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #s1 " != " #s2, 1, "%s", (s1), (s2))
#define cl_assert_equal_s_(s1,s2,note) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #s1 " != " #s2 " (" #note ")", 1, "%s", (s1), (s2))
#define cl_assert_equal_wcs(wcs1,wcs2) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #wcs1 " != " #wcs2, 1, "%ls", (wcs1), (wcs2))
#define cl_assert_equal_wcs_(wcs1,wcs2,note) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #wcs1 " != " #wcs2 " (" #note ")", 1, "%ls", (wcs1), (wcs2))
#define cl_assert_equal_strn(s1,s2,len) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #s1 " != " #s2, 1, "%.*s", (s1), (s2), (int)(len))
#define cl_assert_equal_strn_(s1,s2,len,note) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #s1 " != " #s2 " (" #note ")", 1, "%.*s", (s1), (s2), (int)(len))
#define cl_assert_equal_wcsn(wcs1,wcs2,len) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #wcs1 " != " #wcs2, 1, "%.*ls", (wcs1), (wcs2), (int)(len))
#define cl_assert_equal_wcsn_(wcs1,wcs2,len,note) clar__assert_equal(__FILE__,__LINE__,"String mismatch: " #wcs1 " != " #wcs2 " (" #note ")", 1, "%.*ls", (wcs1), (wcs2), (int)(len))
#define cl_assert_equal_i(i1,i2) clar__assert_equal(__FILE__,__LINE__,#i1 " != " #i2, 1, "%d", (int)(i1), (int)(i2))
#define cl_assert_equal_i_(i1,i2,note) clar__assert_equal(__FILE__,__LINE__,#i1 " != " #i2 " (" #note ")", 1, "%d", (i1), (i2))
#define cl_assert_equal_i_fmt(i1,i2,fmt) clar__assert_equal(__FILE__,__LINE__,#i1 " != " #i2, 1, (fmt), (int)(i1), (int)(i2))
#define cl_assert_equal_b(b1,b2) clar__assert_equal(__FILE__,__LINE__,#b1 " != " #b2, 1, "%d", (int)((b1) != 0),(int)((b2) != 0))
#define cl_assert_equal_p(p1,p2) clar__assert_equal(__FILE__,__LINE__,"Pointer mismatch: " #p1 " != " #p2, 1, "%p", (p1), (p2))
void clar__skip(void);
void clar__fail(
const char *file,
int line,
const char *error,
const char *description,
int should_abort);
void clar__assert(
int condition,
const char *file,
int line,
const char *error,
const char *description,
int should_abort);
void clar__assert_equal(
const char *file,
int line,
const char *err,
int should_abort,
const char *fmt,
...);
#endif
|
/*
* Copyright (c) 1997-2001 Silicon Graphics, Inc. All Rights Reserved.
*/
/*
* nameall - exercise pmNameAll
*/
#include <ctype.h>
#include <pcp/pmapi.h>
#include <pcp/impl.h>
#if PMAPI_VERSION == 2
static int pmns_style = 1;
#endif
static int vflag;
static char *host = "localhost";
static char *namespace = PM_NS_DEFAULT;
static int dupok = 1;
static void
dometric(const char *name)
{
pmID pmid;
int i;
int n;
char **nameset;
/* cast const away as pmLookUpName will not modify this string */
n = pmLookupName(1, (char **)&name, &pmid);
if (n < 0) {
printf("pmLookupName(%s): %s\n", name, pmErrStr(n));
return;
}
n = pmNameAll(pmid, &nameset);
if (n < 0) {
printf("pmNameAll(%s): %s\n", name, pmErrStr(n));
return;
}
for (i = 0; i < n; i++) {
if (strcmp(name, nameset[i]) != 0)
printf("%s alias %s and %s\n", pmIDStr(pmid), name, nameset[i]);
}
free(nameset);
}
void
parse_args(int argc, char **argv)
{
int errflag = 0;
int c;
int sts;
static char *usage = "[-h hostname] [-[N|n] namespace] [-v]";
char *endnum;
#ifdef PCP_DEBUG
static char *debug = "[-D N]";
#else
static char *debug = "";
#endif
#if PMAPI_VERSION == 2
static char *style_str = "[-s 1|2]";
#else
static char *style_str = "";
#endif
__pmSetProgname(argv[0]);
while ((c = getopt(argc, argv, "D:h:N:n:s:v")) != EOF) {
switch (c) {
#ifdef PCP_DEBUG
case 'D': /* debug flag */
sts = __pmParseDebug(optarg);
if (sts < 0) {
fprintf(stderr, "%s: unrecognized debug flag specification (%s)\n",
pmProgname, optarg);
errflag++;
}
else
pmDebug |= sts;
break;
#endif
case 'h': /* hostname for PMCD to contact */
host = optarg;
break;
case 'N':
dupok=0;
/*FALLTHROUGH*/
case 'n': /* alternative name space file */
namespace = optarg;
break;
case 'v': /* verbose */
vflag++;
break;
#if PMAPI_VERSION == 2
case 's': /* pmns style */
pmns_style = (int)strtol(optarg, &endnum, 10);
if (*endnum != '\0') {
printf("%s: -s requires numeric argument\n", pmProgname);
errflag++;
}
break;
#endif
case '?':
default:
errflag++;
break;
}
}
if (errflag) {
printf("Usage: %s %s%s%s\n", pmProgname, debug, style_str, usage);
exit(1);
}
}
void
load_namespace(char *namespace)
{
struct timeval now, then;
int sts;
gettimeofday(&then, (struct timezone *)0);
sts = pmLoadASCIINameSpace(namespace, dupok);
if (sts < 0) {
printf("%s: Cannot load namespace from \"%s\" (dupok=%d): %s\n", pmProgname, namespace, dupok, pmErrStr(sts));
exit(1);
}
gettimeofday(&now, (struct timezone *)0);
printf("Name space load: %.2f msec\n", __pmtimevalSub(&now, &then)*1000);
}
void
test_nameall(int argc, char *argv[])
{
int sts;
if ((sts = pmNewContext(PM_CONTEXT_HOST, host)) < 0) {
printf("%s: Cannot connect to PMCD on host \"%s\": %s\n", pmProgname, host, pmErrStr(sts));
exit(1);
}
if (vflag > 1)
__pmDumpNameSpace(stdout, 1);
for ( ; optind < argc; optind++)
pmTraversePMNS(argv[optind], dometric);
}
int
main(int argc, char **argv)
{
parse_args(argc, argv);
if (pmns_style == 2) {
/* test it the new way with distributed namespace */
/* i.e. no client loaded namespace */
test_nameall(argc, argv);
}
else {
/* test it the old way with namespace file */
load_namespace(namespace);
test_nameall(argc, argv);
}
exit(0);
}
|
/*
(c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __UNIQUE__UNIQUEWM_H__
#define __UNIQUE__UNIQUEWM_H__
#include <direct/types.h>
#include <unique/types.h>
#include <fusion/object.h>
bool unique_wm_running ( void );
DirectResult unique_wm_enum_contexts( FusionObjectCallback callback,
void *ctx );
DirectResult unique_wm_enum_windows ( FusionObjectCallback callback,
void *ctx );
#endif
|
/* **********************************************************
* Copyright (c) 2003-2010 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of VMware, Inc. nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#include "Windows.h"
#include "stdio.h"
/* make this pretty long, some regression runs are pretty slow and we just
* want to keep the suite from completely hanging */
#define TIMEOUT_MS 60000
#define SLEEP_INTERVAL_MS 500
int
main(int argc, char **argv)
{
HANDLE hw;
LRESULT res;
UINT wait_tot, wait_max;
if (argc != 3) {
fprintf(stderr, "usage: %s <window caption> <timeout (sec)>\n", argv[0]);
exit(1);
}
wait_tot = 0;
wait_max = atoi(argv[2]) * 1000;
while (wait_tot < wait_max) {
hw = FindWindow(NULL, argv[1]);
if (hw == NULL) {
wait_tot += SLEEP_INTERVAL_MS;
Sleep(SLEEP_INTERVAL_MS);
}
else {
res = SendMessageTimeout(hw, WM_CLOSE, 0, 0, SMTO_NORMAL,
TIMEOUT_MS, NULL);
printf("Close message sent.\n");
if (res == 0) {
/* error case */
res = GetLastError();
/* msdn lies! claims GetLastError returns 0 for timeout case, yet
* it in fact returns ERROR_TIMEOUT (no surprise) just check for
* both, not too suprising, I suppose, as I think they have some
* typos in the flag descriptions for the function also */
if (res == 0 || res == ERROR_TIMEOUT) {
printf("Window timed out without response\n");
} else {
printf("Error sending close message %d\n", res);
}
}
break;
}
}
}
|
/*******************************************************************************
* Copyright (c) 2015, UT-Battelle, LLC.
* 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. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*******************************************************************************/
#ifndef INETWORKINGTOOL_H_
#define INETWORKINGTOOL_H_
#include "MooseError.h"
/**
*
*/
class INetworkingTool
{
public:
virtual ~INetworkingTool()
{
}
/**
* Execute HTTP GET to return the contents located at url.
*
* @param url The URL of the GET request.
* @param username The username. It is ignored if it is empty. It may not be null.
* @param password The password. It is ignored if it is empty. It may not be null.
* @return The contents at the URL or an error message if one took place.
*/
virtual std::string get(std::string /*url*/,
std::string /*username*/,
std::string /*password*/)
{
mooseWarning("You are attempting to execute a GET but did not specify a valid ICE Updater INetworkingTool! No data will be received.");
return std::string("");
}
/**
* Execute HTTP POST to transmit value at url.
*
* @param url The url that is used to post the value.
* @param username The username. It is ignored if it is empty. It may not be null.
* @param password The password. It is ignored if it is empty. It may not be null.
* @param value The value that is posted to the url.
* @return A std::string containing the error if one took place. Else returns an empty std::string.
*/
virtual std::string post(std::string /*url*/,
std::string /*value*/,
std::string /*username*/,
std::string /*password*/)
{
mooseWarning("You are attempting to execute a POST but did not specify a valid ICE Updater INetworkingTool! No data will be posted.");
return std::string("");
}
/**
* Sets the ignoreSslPeerVerification flag. If ignoreSslPeerVerification flag is
* set to true then cURL will skip peer certificate verification for HTTPS urls.
* This flag should only be set to true for testing purposes.
*
* @param ignoreSslPeerVerification The value for the ignoreSslPeerVerification flag.
*/
virtual void setIgnoreSslPeerVerification(bool /*ignoreSslPeerVerification*/)
{
mooseWarning("You are attempting to execute setIgnoreSslPeerVerification "
"but did not specify a valid ICE Updater INetworkingTool!"
"Doing nothing.");
}
/**
* Sets the noProxyFlag's value to 'val'.
*
* @param val The new value for the noProxyFlag.
*/
virtual void setNoProxyFlag(bool /*val*/)
{
mooseWarning("You are attempting to execute setNoProxyFlag "
"but did not specify a valid ICE Updater INetworkingTool!"
"Doing nothing.");
}
};
#endif
|
// Copyright (c)2008-2011, Preferred Infrastructure Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of Preferred Infrastructure nor the names of other
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef JUBATUS_UTIL_MATH_RATIO_H_
#define JUBATUS_UTIL_MATH_RATIO_H_
#include <cstdlib>
#include <iostream>
namespace jubatus {
namespace util{
namespace math{
namespace ratio{
/**
template class for rational numbers.
*/
template<class T> class ratio{
public:
ratio():num_(0), den_(1){}
explicit ratio(const T &a):num_(a), den_(1){}
ratio(const T &num0, const T &den0): num_(num0), den_(den0){
if(den_<0){
den_*=-1; num_*=-1;
}
reduce();
}
const T& num()const{return num_;}
const T& den()const{return den_;}
private:
T num_, den_;
static T gcd(T a, T b){
a=std::abs(a); b=std::abs(b);
while(true){
a=a%b;
if(a==0) return b;
b=b%a;
if(b==0) return a;
}
}
static T lcm(const T &a, const T &b){
return (a/gcd(a,b))*b;
}
ratio<T>& reduce(){
/// reduce itself to its lowest terms and return *this
T g=gcd(num_,den_)*(den_>0?1:-1);
num_/=g; den_/=g;
return *this;
}
public:
template<class T2>
friend ratio<T2>& operator+=(ratio<T2> &a, const ratio<T2> &b);
template<class T2>
friend ratio<T2>& operator-=(ratio<T2> &a, const ratio<T2> &b);
template<class T2>
friend ratio<T2>& operator*=(ratio<T2> &a, const ratio<T2> &b);
template<class T2>
friend ratio<T2>& operator/=(ratio<T2> &a, const ratio<T2> &b);
};
template<class T>
inline ratio<T>& operator+=(ratio<T> &a, const ratio<T> &b){
T gcd=ratio<T>::gcd(a.den_, b.den_);
a.num_=a.num_*(b.den_/gcd)+b.num_*(a.den_/gcd);
a.den_*=(b.den_/gcd);
return a.reduce();
}
template<class T>
inline ratio<T>& operator-=(ratio<T> &a, const ratio<T> &b){
T gcd=ratio<T>::gcd(a.den_, b.den_);
a.num_=a.num_*(b.den_/gcd)-b.num_*(a.den_/gcd);
a.den_*=(b.den_/gcd);
return a.reduce();
}
template<class T>
inline ratio<T>& operator*=(ratio<T> &a, const ratio<T> &b){
T gcd1=ratio<T>::gcd(a.num_, b.den_);
T gcd2=ratio<T>::gcd(b.num_, a.den_);
a.num_=(a.num_/gcd1)*(b.num_/gcd2);
a.den_=(a.den_/gcd2)*(b.den_/gcd1);
return a;
}
template<class T>
inline ratio<T>& operator/=(ratio<T> &a, const ratio<T> &b){
T gcd1=ratio<T>::gcd(a.num_, b.num_);
T gcd2=ratio<T>::gcd(a.den_, b.den_);
a.num_=(a.num_/gcd1)*(b.den_/gcd2);
a.den_=(a.den_/gcd2)*(b.num_/gcd1);
if(a.den_<0){
a.num_*=-1; a.den_*=-1;
}
return a;
}
template<class T>
inline const ratio<T> operator+(ratio<T> a, const ratio<T> &b){
return a+=b;
}
template<class T>
inline const ratio<T> operator-(ratio<T> a, const ratio<T> &b){
return a-=b;
}
template<class T>
inline const ratio<T> operator*(ratio<T> a, const ratio<T> &b){
return a*=b;
}
template<class T>
inline const ratio<T> operator/(ratio<T> a, const ratio<T> &b){
return a/=b;
}
template<class T>
inline bool operator==(const ratio<T> &a, const ratio<T> &b){
return a.num()==b.num() && a.den()==b.den();
}
template <class T>
std::ostream& operator<<(std::ostream &out,
const ratio<T> &r){
out << r.num() << "/" << r.den();
return out;
}
}
}
}
}
#endif // #ifndef JUBATUS_UTIL_MATH_RATIO_H_
|
/* **********************************************************
* Copyright (c) 2003 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of VMware, Inc. nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Written by Solar Designer and placed in the public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void caller(void (*trampoline)(void))
{
fprintf(stderr, "Attempting to call a trampoline...\n");
trampoline();
}
void do_trampoline(void)
{
void nested(void) {
fprintf(stderr, "Succeeded.\n");
}
caller(nested);
}
void do_exploit(void)
{
fprintf(stderr, "Attempting to simulate a buffer overflow exploit...\n");
#ifdef __i386__
__asm__ __volatile__(
"movl $1f,%%eax\n\t"
".byte 0x68; popl %%ecx; jmp *%%eax; nop\n\t"
"pushl %%esp\n\t"
"ret\n\t"
"1:"
: : : "ax", "cx");
#else
#error Wrong architecture
#endif
fprintf(stderr, "Succeeded.\n");
}
#define USAGE \
"Usage: %s OPTION\n" \
"Non-executable user stack area tests\n\n" \
" -t\tcall a GCC trampoline\n" \
" -e\tsimulate a buffer overflow exploit\n" \
" -b\tsimulate an exploit after a trampoline call\n"
void usage(char *name)
{
printf(USAGE, name ? name : "stacktest");
exit(1);
}
int main(int argc, char **argv)
{
if (argc != 2) {
/* default behavior for unit test */
do_trampoline();
do_exploit();
return 0;
}
if (argv[1][0] != '-' || strlen(argv[1]) != 2) usage(argv[0]);
switch (argv[1][1]) {
case 't':
do_trampoline();
break;
case 'b':
do_trampoline();
case 'e':
do_exploit();
break;
default:
usage(argv[0]);
break;
}
return 0;
}
|
/*
* various filters for ACELP-based codecs
*
* Copyright (c) 2008 Vladimir Voroshilov
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <inttypes.h>
#include "avcodec.h"
#include "acelp_filters.h"
const int16_t ff_acelp_interp_filter[61] =
{ /* (0.15) */
29443, 28346, 25207, 20449, 14701, 8693,
3143, -1352, -4402, -5865, -5850, -4673,
-2783, -672, 1211, 2536, 3130, 2991,
2259, 1170, 0, -1001, -1652, -1868,
-1666, -1147, -464, 218, 756, 1060,
1099, 904, 550, 135, -245, -514,
-634, -602, -451, -231, 0, 191,
308, 340, 296, 198, 78, -36,
-120, -163, -165, -132, -79, -19,
34, 73, 91, 89, 70, 38,
0,
};
void ff_acelp_interpolate(
int16_t* out,
const int16_t* in,
const int16_t* filter_coeffs,
int precision,
int frac_pos,
int filter_length,
int length)
{
int n, i;
assert(pitch_delay_frac >= 0 && pitch_delay_frac < precision);
for(n=0; n<length; n++)
{
int idx = 0;
int v = 0x4000;
for(i=0; i<filter_length;)
{
/* The reference G.729 and AMR fixed point code performs clipping after
each of the two following accumulations.
Since clipping affects only the synthetic OVERFLOW test without
causing an int type overflow, it was moved outside the loop. */
/* R(x):=ac_v[-k+x]
v += R(n-i)*ff_acelp_interp_filter(t+6i)
v += R(n+i+1)*ff_acelp_interp_filter(6-t+6i) */
v += in[n + i] * filter_coeffs[idx + frac_pos];
idx += precision;
i++;
v += in[n - i] * filter_coeffs[idx - frac_pos];
}
if(av_clip_int16(v>>15) != (v>>15))
av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n");
out[n] = v >> 15;
}
}
void ff_acelp_high_pass_filter(
int16_t* out,
int hpf_f[2],
const int16_t* in,
int length)
{
int i;
int tmp;
for(i=0; i<length; i++)
{
tmp = (hpf_f[0]* 15836LL)>>13;
tmp += (hpf_f[1]* -7667LL)>>13;
tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]);
/* With "+0x800" rounding, clipping is needed
for ALGTHM and SPEECH tests. */
out[i] = av_clip_int16((tmp + 0x800) >> 12);
hpf_f[1] = hpf_f[0];
hpf_f[0] = tmp;
}
}
|
/*====================================================================*
- Copyright (C) 2001 Leptonica. 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.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/
/*
* pagesegtest1.c
*
* Use on, e.g.: feyn.tif, witten.tif,
* pageseg1.tif, pageseg2.tif, pageseg3.tif, pageseg4.tif
*/
#include "allheaders.h"
int main(int argc,
char **argv)
{
PIX *pixs, *pixhm, *pixtm, *pixtb, *pixd;
PIXA *pixadb;
char *filein;
static char mainName[] = "pagesegtest1";
if (argc != 2)
return ERROR_INT(" Syntax: pagesegtest1 filein", mainName, 1);
filein = argv[1];
if ((pixs = pixRead(filein)) == NULL)
return ERROR_INT("pixs not made", mainName, 1);
pixadb = pixaCreate(0);
pixGetRegionsBinary(pixs, &pixhm, &pixtm, &pixtb, pixadb);
pixDestroy(&pixhm);
pixDestroy(&pixtm);
pixDestroy(&pixtb);
pixDestroy(&pixs);
/* Display intermediate images in a single image */
lept_mkdir("lept/pagseg");
pixd = pixaDisplayTiledAndScaled(pixadb, 32, 400, 4, 0, 20, 3);
pixWrite("/tmp/lept/pageseg/debug.png", pixd, IFF_PNG);
pixaDestroy(&pixadb);
pixDestroy(&pixd);
return 0;
}
|
/* radare - LGPL - Copyright 2020 - curly */
#include <string.h>
#include <r_types.h>
#include <r_lib.h>
#include <r_asm.h>
#include <r_anal.h>
static bool set_reg_profile(RAnal *anal) {
const char *p =
"=PC pc\n"
"=SP a10\n"
"=A0 a0\n"
"gpr p0 .64 0 0\n"
"gpr a0 .32 0 0\n"
"gpr a1 .32 4 0\n"
"gpr p2 .64 8 0\n"
"gpr a2 .32 8 0\n"
"gpr a3 .32 12 0\n"
"gpr p4 .64 16 0\n"
"gpr a4 .32 16 0\n"
"gpr a5 .32 20 0\n"
"gpr p6 .64 24 0\n"
"gpr a6 .32 24 0\n"
"gpr a7 .32 28 0\n"
"gpr p8 .64 32 0\n"
"gpr a8 .32 32 0\n"
"gpr a9 .32 36 0\n"
"gpr p10 .64 40 0\n"
"gpr a10 .32 40 0\n"
"gpr a11 .32 44 0\n"
"gpr p12 .64 48 0\n"
"gpr a12 .32 48 0\n"
"gpr a13 .32 52 0\n"
"gpr p14 .64 56 0\n"
"gpr a14 .32 56 0\n"
"gpr a15 .32 60 0\n"
"gpr e0 .64 64 0\n"
"gpr d0 .32 64 0\n"
"gpr d1 .32 68 0\n"
"gpr e2 .64 72 0\n"
"gpr d2 .32 72 0\n"
"gpr d3 .32 76 0\n"
"gpr e4 .64 80 0\n"
"gpr d4 .32 80 0\n"
"gpr d5 .32 84 0\n"
"gpr e6 .64 88 0\n"
"gpr d6 .32 88 0\n"
"gpr d7 .32 92 0\n"
"gpr e8 .64 96 0\n"
"gpr d8 .32 96 0\n"
"gpr d9 .32 100 0\n"
"gpr e10 .64 104 0\n"
"gpr d10 .32 104 0\n"
"gpr d11 .32 108 0\n"
"gpr e12 .64 112 0\n"
"gpr d12 .32 112 0\n"
"gpr d13 .32 114 0\n"
"gpr e14 .64 118 0\n"
"gpr d14 .32 118 0\n"
"gpr d15 .32 120 0\n"
"gpr PSW .32 124 0\n"
"gpr PCXI .32 128 0\n"
"gpr FCX .32 132 0\n"
"gpr LCX .32 136 0\n"
"gpr ISP .32 140 0\n"
"gpr ICR .32 144 0\n"
"gpr PIPN .32 148 0\n"
"gpr BIV .32 152 0\n"
"gpr BTV .32 156 0\n"
"gpr pc .32 160 0\n";
return r_reg_set_profile_string (anal->reg, p);
}
RAnalPlugin r_anal_plugin_tricore = {
.name = "tricore",
.desc = "TRICORE analysis plugin",
.license = "LGPL3",
.arch = "tricore",
.bits = 32,
.set_reg_profile = set_reg_profile,
};
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {
.type = R_LIB_TYPE_ANAL,
.data = &r_anal_plugin_tricore,
.version = R2_VERSION
};
#endif
|
/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
/*
* Copyright (C) 2012-2013 Rob Clark <robclark@freedesktop.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 (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Authors:
* Rob Clark <robclark@freedesktop.org>
*/
#ifndef FD2_UTIL_H_
#define FD2_UTIL_H_
#include "freedreno_util.h"
#include "a2xx.xml.h"
enum a2xx_sq_surfaceformat fd2_pipe2surface(enum pipe_format format);
enum a2xx_colorformatx fd2_pipe2color(enum pipe_format format);
uint32_t fd2_tex_swiz(enum pipe_format format, unsigned swizzle_r,
unsigned swizzle_g, unsigned swizzle_b, unsigned swizzle_a);
/* convert x,y to dword */
static inline uint32_t xy2d(uint16_t x, uint16_t y)
{
return ((y & 0x3fff) << 16) | (x & 0x3fff);
}
#endif /* FD2_UTIL_H_ */
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef StorageClientImpl_h
#define StorageClientImpl_h
#include "modules/storage/StorageClient.h"
#include <memory>
namespace blink {
class WebViewImpl;
class StorageClientImpl : public StorageClient {
public:
explicit StorageClientImpl(WebViewImpl*);
std::unique_ptr<StorageNamespace> createSessionStorageNamespace() override;
bool canAccessStorage(LocalFrame*, StorageType) const override;
private:
WebViewImpl* m_webView;
};
} // namespace blink
#endif // StorageClientImpl_h
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_REMOTING_ICE_CONFIG_REQUEST_H_
#define REMOTING_PROTOCOL_REMOTING_ICE_CONFIG_REQUEST_H_
#include <memory>
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "remoting/base/protobuf_http_client.h"
#include "remoting/protocol/ice_config_request.h"
namespace network {
class SharedURLLoaderFactory;
} // namespace network
namespace remoting {
namespace apis {
namespace v1 {
class GetIceConfigResponse;
} // namespace v1
} // namespace apis
class ProtobufHttpStatus;
class OAuthTokenGetter;
namespace protocol {
// IceConfigRequest that fetches IceConfig from the remoting NetworkTraversal
// service.
class RemotingIceConfigRequest final : public IceConfigRequest {
public:
RemotingIceConfigRequest(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
OAuthTokenGetter* oauth_token_getter);
RemotingIceConfigRequest(const RemotingIceConfigRequest&) = delete;
RemotingIceConfigRequest& operator=(const RemotingIceConfigRequest&) = delete;
~RemotingIceConfigRequest() override;
// IceConfigRequest implementation.
void Send(OnIceConfigCallback callback) override;
private:
friend class RemotingIceConfigRequestTest;
void OnResponse(const ProtobufHttpStatus& status,
std::unique_ptr<apis::v1::GetIceConfigResponse> response);
bool make_authenticated_requests_ = false;
OnIceConfigCallback on_ice_config_callback_;
ProtobufHttpClient http_client_;
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_REMOTING_ICE_CONFIG_REQUEST_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_SSL_HMAC_CHANNEL_AUTHENTICATOR_H_
#define REMOTING_PROTOCOL_SSL_HMAC_CHANNEL_AUTHENTICATOR_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/sequence_checker.h"
#include "remoting/protocol/channel_authenticator.h"
namespace net {
class CertVerifier;
class CTPolicyEnforcer;
class DrainableIOBuffer;
class GrowableIOBuffer;
class SSLClientContext;
class SSLServerContext;
class SSLSocket;
class TransportSecurityState;
} // namespace net
namespace remoting {
class RsaKeyPair;
namespace protocol {
// SslHmacChannelAuthenticator implements ChannelAuthenticator that
// secures channels using SSL and authenticates them with a shared
// secret HMAC.
// Please update network traffic annotation in the .cc file if this class is
// used for any new purposes.
class SslHmacChannelAuthenticator : public ChannelAuthenticator {
public:
enum LegacyMode {
NONE,
SEND_ONLY,
RECEIVE_ONLY,
};
// CreateForClient() and CreateForHost() create an authenticator
// instances for client and host. |auth_key| specifies shared key
// known by both host and client. In case of V1Authenticator the
// |auth_key| is set to access code. For EKE-based authentication
// |auth_key| is the key established using EKE over the signaling
// channel.
static std::unique_ptr<SslHmacChannelAuthenticator> CreateForClient(
const std::string& remote_cert,
const std::string& auth_key);
static std::unique_ptr<SslHmacChannelAuthenticator> CreateForHost(
const std::string& local_cert,
scoped_refptr<RsaKeyPair> key_pair,
const std::string& auth_key);
SslHmacChannelAuthenticator(const SslHmacChannelAuthenticator&) = delete;
SslHmacChannelAuthenticator& operator=(const SslHmacChannelAuthenticator&) =
delete;
~SslHmacChannelAuthenticator() override;
// ChannelAuthenticator interface.
void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
DoneCallback done_callback) override;
private:
class P2PStreamSocketAdapter;
// P2PStreamSocketAdater outlives the SslHmacChannelAuthenticator, but SSL
// sockets must not outlive their context structures. SslSocketContext bundles
// them together for convenience.
struct SslSocketContext {
SslSocketContext();
SslSocketContext(SslSocketContext&&);
~SslSocketContext();
SslSocketContext& operator=(SslSocketContext&&);
// Used in the SERVER mode only.
std::unique_ptr<net::SSLServerContext> server_context;
// Used in the CLIENT mode only.
std::unique_ptr<net::TransportSecurityState> transport_security_state;
std::unique_ptr<net::CertVerifier> cert_verifier;
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer;
std::unique_ptr<net::SSLClientContext> client_context;
};
SslHmacChannelAuthenticator(const std::string& auth_key);
bool is_ssl_server();
void OnConnected(int result);
void WriteAuthenticationBytes(bool* callback_called);
void OnAuthBytesWritten(int result);
bool HandleAuthBytesWritten(int result, bool* callback_called);
void ReadAuthenticationBytes();
void OnAuthBytesRead(int result);
bool HandleAuthBytesRead(int result);
bool VerifyAuthBytes(const std::string& received_auth_bytes);
void CheckDone(bool* callback_called);
void NotifyError(int error);
// The mutual secret used for authentication.
std::string auth_key_;
// Used in the SERVER mode only.
std::string local_cert_;
scoped_refptr<RsaKeyPair> local_key_pair_;
// Used in the CLIENT mode only.
std::string remote_cert_;
SslSocketContext socket_context_;
std::unique_ptr<net::SSLSocket> socket_;
DoneCallback done_callback_;
scoped_refptr<net::DrainableIOBuffer> auth_write_buf_;
scoped_refptr<net::GrowableIOBuffer> auth_read_buf_;
SEQUENCE_CHECKER(sequence_checker_);
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_SSL_HMAC_CHANNEL_AUTHENTICATOR_H_
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DOCUMENT_SUBRESOURCE_FILTER_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DOCUMENT_SUBRESOURCE_FILTER_H_
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h"
namespace blink {
class WebURL;
class WebDocumentSubresourceFilter {
public:
// This builder class is created on the main thread and passed to a worker
// thread to create the subresource filter for the worker thread.
class Builder {
public:
virtual ~Builder() = default;
virtual std::unique_ptr<WebDocumentSubresourceFilter> Build() = 0;
};
enum LoadPolicy { kAllow, kDisallow, kWouldDisallow };
virtual ~WebDocumentSubresourceFilter() = default;
virtual LoadPolicy GetLoadPolicy(const WebURL& resource_url,
mojom::RequestContextType) = 0;
virtual LoadPolicy GetLoadPolicyForWebSocketConnect(const WebURL&) = 0;
virtual LoadPolicy GetLoadPolicyForWebTransportConnect(const WebURL&) = 0;
// Report that a resource loaded by the document (not a preload) was
// disallowed.
virtual void ReportDisallowedLoad() = 0;
// Returns true if disallowed resource loads should be logged to the devtools
// console.
virtual bool ShouldLogToConsole() = 0;
// Report that the resource request corresponding to |request_id| was tagged
// as an ad.
virtual void ReportAdRequestId(int request_id) {}
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DOCUMENT_SUBRESOURCE_FILTER_H_
|
//===-- DisassemblerLLVMC.h -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SOURCE_PLUGINS_DISASSEMBLER_LLVMC_DISASSEMBLERLLVMC_H
#define LLDB_SOURCE_PLUGINS_DISASSEMBLER_LLVMC_DISASSEMBLERLLVMC_H
#include <memory>
#include <mutex>
#include <string>
#include "lldb/Core/Address.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/PluginManager.h"
class InstructionLLVMC;
class DisassemblerLLVMC : public lldb_private::Disassembler {
public:
DisassemblerLLVMC(const lldb_private::ArchSpec &arch,
const char *flavor /* = NULL */);
~DisassemblerLLVMC() override;
// Static Functions
static void Initialize();
static void Terminate();
static lldb_private::ConstString GetPluginNameStatic();
static lldb_private::Disassembler *
CreateInstance(const lldb_private::ArchSpec &arch, const char *flavor);
size_t DecodeInstructions(const lldb_private::Address &base_addr,
const lldb_private::DataExtractor &data,
lldb::offset_t data_offset, size_t num_instructions,
bool append, bool data_from_file) override;
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;
protected:
friend class InstructionLLVMC;
bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch,
const char *flavor) override;
bool IsValid() const;
int OpInfo(uint64_t PC, uint64_t Offset, uint64_t Size, int TagType,
void *TagBug);
const char *SymbolLookup(uint64_t ReferenceValue, uint64_t *ReferenceType,
uint64_t ReferencePC, const char **ReferenceName);
static int OpInfoCallback(void *DisInfo, uint64_t PC, uint64_t Offset,
uint64_t Size, int TagType, void *TagBug);
static const char *SymbolLookupCallback(void *DisInfo,
uint64_t ReferenceValue,
uint64_t *ReferenceType,
uint64_t ReferencePC,
const char **ReferenceName);
const lldb_private::ExecutionContext *m_exe_ctx;
InstructionLLVMC *m_inst;
std::mutex m_mutex;
bool m_data_from_file;
// Since we need to make two actual MC Disassemblers for ARM (ARM & THUMB),
// and there's a bit of goo to set up and own in the MC disassembler world,
// this class was added to manage the actual disassemblers.
class MCDisasmInstance;
std::unique_ptr<MCDisasmInstance> m_disasm_up;
std::unique_ptr<MCDisasmInstance> m_alternate_disasm_up;
};
#endif // LLDB_SOURCE_PLUGINS_DISASSEMBLER_LLVMC_DISASSEMBLERLLVMC_H
|
//
// Definitions.h
// Chat
//
// Created by IgorKh on 9/12/12.
// Copyright (c) 2012 QuickBlox. All rights reserved.
//
#import <Quickblox/ChatEnums.h>
#import <Quickblox/ChatDelegates.h>
#import <Quickblox/ChatConsts.h>
|
/* fft/urand.c
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
double urand (void);
double urand (void) {
static unsigned long int x = 1;
x = (1103515245 * x + 12345) & 0x7fffffffUL ;
return x / 2147483648.0 ;
}
|
/*************************************************************************/
/* jni_utils.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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 JNI_UTILS_H
#define JNI_UTILS_H
#include "string_android.h"
#include <core/engine.h>
#include <core/variant.h>
#include <jni.h>
struct jvalret {
jobject obj;
jvalue val;
jvalret() { obj = nullptr; }
};
jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_arg, bool force_jobject = false);
String _get_class_name(JNIEnv *env, jclass cls, bool *array);
Variant _jobject_to_variant(JNIEnv *env, jobject obj);
Variant::Type get_jni_type(const String &p_type);
const char *get_jni_sig(const String &p_type);
#endif // JNI_UTILS_H
|
/* packet-oicq.c
* Routines for OICQ - IM software,popular in China - packet dissection
* (c) Copyright Secfire <secfire@gmail.com>
*
* OICQ is an IM software,which is popular in China. And,
* OICQ has more than 10 millions users at present.
* The Protocol showed in this file, is found by investigating OICQ's
* Packets as a black box.
*
* The OICQ client software is always changing,and the protocol of
* communication is also.
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
void proto_register_oicq(void);
void proto_reg_handoff_oicq(void);
/*
Protocol Flag: 8bit unsigned
Sender Flag: 16bit unsigned
Command Number: 16bit unsigned
Sequence Number: 16bit unsigned
OICQ Number: 32bit unsigned
Data: Variable Length data
*
*/
/* By default, but can be completely different */
#define UDP_PORT_OICQ 8000
static int proto_oicq = -1;
static int hf_oicq_flag = -1;
static int hf_oicq_version = -1;
static int hf_oicq_command = -1;
static int hf_oicq_seq = -1;
static int hf_oicq_qqid = -1;
static int hf_oicq_data = -1;
static gint ett_oicq = -1;
static const value_string oicq_flag_vals[] = {
{ 0x02, "Oicq packet" },
{ 0, NULL }
};
static const value_string oicq_command_vals[] = {
{ 0x0001, "Log out" },
{ 0x0002, "Heart Message" },
{ 0x0004, "Update User information" },
{ 0x0005, "Search user" },
{ 0x0006, "Get User informationBroadcast" },
{ 0x0009, "Add friend no auth" },
{ 0x000a, "Delete user" },
{ 0x000b, "Add friend by auth" },
{ 0x000d, "Set status" },
{ 0x0012, "Confirmation of receiving message from server" },
{ 0x0016, "Send message" },
{ 0x0017, "Receive message" },
{ 0x0018, "Retrieve information" },
{ 0x001a, "Reserved " },
{ 0x001c, "Delete Me" },
{ 0x001d, "Request KEY" },
{ 0x0021, "Cell Phone" },
{ 0x0022, "Log in" },
{ 0x0026, "Get friend list" },
{ 0x0027, "Get friend online" },
{ 0x0029, "Cell PHONE" },
{ 0x0030, "Operation on group" },
{ 0x0031, "Log in test" },
{ 0x003c, "Group name operation" },
{ 0x003d, "Upload group friend" },
{ 0x003e, "MEMO Operation" },
{ 0x0058, "Download group friend" },
{ 0x005c, "Get level" },
{ 0x0062, "Request login" },
{ 0x0065, "Request extra information" },
{ 0x0067, "Signature operation" },
{ 0x0080, "Receive system message" },
{ 0x0081, "Get status of friend" },
{ 0x00b5, "Get friend's status of group" },
{ 0, NULL }
};
/* dissect_oicq - dissects oicq packet data
* tvb - tvbuff for packet data (IN)
* pinfo - packet info
* proto_tree - resolved protocol tree
*/
static int
dissect_oicq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_tree *oicq_tree;
proto_item *ti;
int offset = 0;
/* Make sure this packet is for us. */
/* heuristic: OICQ iff (([0] == STX) && ([3/4] == <valid_command>) ) */
/* (Supposedly each OICQ message ends with an ETX so a test for */
/* same could also be part of the heuristic). */
if ( (try_val_to_str(tvb_get_guint8(tvb, 0), oicq_flag_vals) == NULL) ||
(try_val_to_str(tvb_get_ntohs(tvb, 3), oicq_command_vals) == NULL) )
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OICQ");
col_set_str(pinfo->cinfo, COL_INFO, "OICQ Protocol ");
if (tree) {
ti = proto_tree_add_item(tree, proto_oicq, tvb, 0, -1, ENC_NA);
oicq_tree = proto_item_add_subtree(ti, ett_oicq);
proto_tree_add_item(oicq_tree, hf_oicq_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(oicq_tree, hf_oicq_version, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(oicq_tree, hf_oicq_command, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(oicq_tree, hf_oicq_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(oicq_tree, hf_oicq_qqid, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(oicq_tree, hf_oicq_data, tvb, offset, -1, ENC_ASCII|ENC_NA);
}
return tvb_length(tvb);
}
void
proto_register_oicq(void)
{
static hf_register_info hf[] = {
{ &hf_oicq_flag, {
"Flag", "oicq.flag", FT_UINT8, BASE_HEX,
VALS(oicq_flag_vals), 0, "Protocol Flag", HFILL }},
{ &hf_oicq_version, {
"Version", "oicq.version", FT_UINT16, BASE_HEX,
NULL, 0, "Version-zz", HFILL }},
{ &hf_oicq_command, {
"Command", "oicq.command", FT_UINT16, BASE_DEC,
VALS(oicq_command_vals), 0, NULL, HFILL }},
{ &hf_oicq_seq, {
"Sequence", "oicq.seq", FT_UINT16, BASE_DEC,
NULL, 0, NULL, HFILL }},
{ &hf_oicq_qqid, {
"Data(OICQ Number,if sender is client)", "oicq.qqid", FT_UINT32, BASE_DEC,
NULL, 0, NULL, HFILL }},
{ &hf_oicq_data, {
"Data", "oicq.data", FT_STRING, BASE_NONE,
NULL, 0, NULL, HFILL }},
};
static gint *ett[] = {
&ett_oicq,
};
proto_oicq = proto_register_protocol("OICQ - IM software, popular in China", "OICQ",
"oicq");
proto_register_field_array(proto_oicq, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_oicq(void)
{
dissector_handle_t oicq_handle;
oicq_handle = new_create_dissector_handle(dissect_oicq, proto_oicq);
dissector_add_uint("udp.port", UDP_PORT_OICQ, oicq_handle);
}
|
/* Measure wcsrchr functions.
Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#define WIDE 1
#include "bench-strrchr.c"
|
/*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* S5P - IRQ EINT support
*
* 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/interrupt.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/device.h>
#include <linux/gpio.h>
#include <asm/hardware/vic.h>
#include <plat/regs-irqtype.h>
#include <mach/map.h>
#include <plat/cpu.h>
#include <plat/pm.h>
#include <plat/gpio-cfg.h>
#include <mach/regs-gpio.h>
static inline void s5p_irq_eint_mask(struct irq_data *data)
{
u32 mask;
mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
mask |= eint_irq_to_bit(data->irq);
__raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
}
static void s5p_irq_eint_unmask(struct irq_data *data)
{
u32 mask;
mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
mask &= ~(eint_irq_to_bit(data->irq));
__raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
}
static inline void s5p_irq_eint_ack(struct irq_data *data)
{
__raw_writel(eint_irq_to_bit(data->irq),
S5P_EINT_PEND(EINT_REG_NR(data->irq)));
}
static void s5p_irq_eint_maskack(struct irq_data *data)
{
/* compiler should in-line these */
s5p_irq_eint_mask(data);
s5p_irq_eint_ack(data);
}
static int s5p_irq_eint_set_type(struct irq_data *data, unsigned int type)
{
int offs = EINT_OFFSET(data->irq);
int shift;
u32 ctrl, mask;
u32 newvalue = 0;
struct irq_desc *desc = irq_to_desc(data->irq);
switch (type) {
case IRQ_TYPE_EDGE_RISING:
newvalue = S5P_IRQ_TYPE_EDGE_RISING;
break;
case IRQ_TYPE_EDGE_FALLING:
newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
break;
case IRQ_TYPE_EDGE_BOTH:
newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
break;
case IRQ_TYPE_LEVEL_LOW:
newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
break;
case IRQ_TYPE_LEVEL_HIGH:
newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
break;
default:
printk(KERN_ERR "No such irq type %d", type);
return -EINVAL;
}
shift = (offs & 0x7) * 4;
mask = 0x7 << shift;
ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq)));
ctrl &= ~mask;
ctrl |= newvalue << shift;
__raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq)));
if ((0 <= offs) && (offs < 8))
s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE);
else if ((8 <= offs) && (offs < 16))
s3c_gpio_cfgpin(EINT_GPIO_1(offs & 0x7), EINT_MODE);
else if ((16 <= offs) && (offs < 24))
s3c_gpio_cfgpin(EINT_GPIO_2(offs & 0x7), EINT_MODE);
else if ((24 <= offs) && (offs < 32))
s3c_gpio_cfgpin(EINT_GPIO_3(offs & 0x7), EINT_MODE);
else
printk(KERN_ERR "No such irq number %d", offs);
if (type & IRQ_TYPE_EDGE_BOTH)
desc->handle_irq = handle_edge_irq;
else
desc->handle_irq = handle_level_irq;
return 0;
}
static struct irq_chip s5p_irq_eint = {
.name = "s5p-eint",
.irq_mask = s5p_irq_eint_mask,
.irq_unmask = s5p_irq_eint_unmask,
.irq_mask_ack = s5p_irq_eint_maskack,
.irq_disable = s5p_irq_eint_maskack,
.irq_ack = s5p_irq_eint_ack,
.irq_set_type = s5p_irq_eint_set_type,
#ifdef CONFIG_PM
.irq_set_wake = s3c_irqext_wake,
#endif
};
/* s5p_irq_demux_eint
*
* This function demuxes the IRQ from the group0 external interrupts,
* from EINTs 16 to 31. It is designed to be inlined into the specific
* handler s5p_irq_demux_eintX_Y.
*
* Each EINT pend/mask registers handle eight of them.
*/
static inline u32 s5p_irq_demux_eint(unsigned int start)
{
u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start)));
u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start)));
unsigned int irq;
u32 action = 0;
status &= ~mask;
status &= 0xff;
while (status) {
irq = fls(status) - 1;
generic_handle_irq(irq + start);
status &= ~(1 << irq);
++action;
}
return action;
}
static void s5p_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
{
u32 a16_23, a24_31;
a16_23 = s5p_irq_demux_eint(IRQ_EINT(16));
a24_31 = s5p_irq_demux_eint(IRQ_EINT(24));
if (!a16_23 && !a24_31)
do_bad_IRQ(irq, desc);
}
static inline void s5p_irq_vic_eint_mask(struct irq_data *data)
{
void __iomem *base = irq_data_get_irq_chip_data(data);
s5p_irq_eint_mask(data);
writel(1 << EINT_OFFSET(data->irq), base + VIC_INT_ENABLE_CLEAR);
}
static void s5p_irq_vic_eint_unmask(struct irq_data *data)
{
void __iomem *base = irq_data_get_irq_chip_data(data);
s5p_irq_eint_unmask(data);
writel(1 << EINT_OFFSET(data->irq), base + VIC_INT_ENABLE);
}
static inline void s5p_irq_vic_eint_ack(struct irq_data *data)
{
__raw_writel(eint_irq_to_bit(data->irq),
S5P_EINT_PEND(EINT_REG_NR(data->irq)));
}
static void s5p_irq_vic_eint_maskack(struct irq_data *data)
{
s5p_irq_vic_eint_mask(data);
s5p_irq_vic_eint_ack(data);
}
static struct irq_chip s5p_irq_vic_eint = {
.name = "s5p_vic_eint",
.irq_mask = s5p_irq_vic_eint_mask,
.irq_unmask = s5p_irq_vic_eint_unmask,
.irq_mask_ack = s5p_irq_vic_eint_maskack,
.irq_ack = s5p_irq_vic_eint_ack,
.irq_set_type = s5p_irq_eint_set_type,
#ifdef CONFIG_PM
.irq_set_wake = s3c_irqext_wake,
#endif
};
int __init s5p_init_irq_eint(void)
{
int irq;
for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
irq_set_chip(irq, &s5p_irq_vic_eint);
for (irq = IRQ_EINT(16); irq <= IRQ_EINT(31); irq++) {
irq_set_chip_and_handler(irq, &s5p_irq_eint, handle_level_irq);
set_irq_flags(irq, IRQF_VALID);
}
irq_set_chained_handler(IRQ_EINT16_31, s5p_irq_demux_eint16_31);
return 0;
}
arch_initcall(s5p_init_irq_eint);
|
// RUN: %dragonegg -S -o /dev/null %s
void *buf[20];
sub2 (void)
{
__builtin_longjmp (buf, 1);
}
double
bar (int arg)
{
foo (arg);
__builtin_return (__builtin_apply ((void (*) ()) foo,
__builtin_apply_args (), 16));
}
|
/*
* Copyright (c) 2010-2011 Broadcom. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*=============================================================================
VideoCore OS Abstraction Layer - named semaphores
=============================================================================*/
#ifndef VCOS_GENERIC_NAMED_SEM_H
#define VCOS_GENERIC_NAMED_SEM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "interface/vcos/vcos_types.h"
/**
* \file
*
* Generic support for named semaphores, using regular ones. This is only
* suitable for emulating them on an embedded MMUless system, since there is
* no support for opening semaphores across process boundaries.
*
*/
#define VCOS_NAMED_SEMAPHORE_NAMELEN 64
/* In theory we could use the name facility provided within Nucleus. However, this
* is hard to do as semaphores are constantly being created and destroyed; we
* would need to stop everything while allocating the memory for the semaphore
* list and then walking it. So keep our own list.
*/
typedef struct VCOS_NAMED_SEMAPHORE_T
{
struct VCOS_NAMED_SEMAPHORE_IMPL_T *actual; /**< There are 'n' named semaphores per 1 actual semaphore */
VCOS_SEMAPHORE_T *sem; /**< Pointer to actual underlying semaphore */
} VCOS_NAMED_SEMAPHORE_T;
VCOSPRE_ VCOS_STATUS_T VCOSPOST_
vcos_generic_named_semaphore_create(VCOS_NAMED_SEMAPHORE_T *sem, const char *name, VCOS_UNSIGNED count);
VCOSPRE_ void VCOSPOST_ vcos_named_semaphore_delete(VCOS_NAMED_SEMAPHORE_T *sem);
VCOSPRE_ VCOS_STATUS_T VCOSPOST_ _vcos_named_semaphore_init(void);
VCOSPRE_ void VCOSPOST_ _vcos_named_semaphore_deinit(void);
#if defined(VCOS_INLINE_BODIES)
VCOS_INLINE_IMPL
VCOS_STATUS_T vcos_named_semaphore_create(VCOS_NAMED_SEMAPHORE_T *sem, const char *name, VCOS_UNSIGNED count) {
return vcos_generic_named_semaphore_create(sem, name, count);
}
VCOS_INLINE_IMPL
void vcos_named_semaphore_wait(VCOS_NAMED_SEMAPHORE_T *sem) {
vcos_semaphore_wait(sem->sem);
}
VCOS_INLINE_IMPL
VCOS_STATUS_T vcos_named_semaphore_trywait(VCOS_NAMED_SEMAPHORE_T *sem) {
return vcos_semaphore_trywait(sem->sem);
}
VCOS_INLINE_IMPL
void vcos_named_semaphore_post(VCOS_NAMED_SEMAPHORE_T *sem) {
vcos_semaphore_post(sem->sem);
}
#endif
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2015 The Qt Company Ltd.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSStringRefQt_h
#define JSStringRefQt_h
#include "JSBase.h"
#include "JSRetainPtr.h"
#include <QString>
/* QString convenience methods */
/*!
@function
@abstract Creates a QString from a JavaScript string.
@param string The JSString to copy into the new QString.
@result A QString containing string.
*/
JS_EXPORT QString JSStringCopyQString(JSStringRef string);
JS_EXPORT JSRetainPtr<JSStringRef> JSStringCreateWithQString(const QString&);
#endif /* JSStringRefQt_h */
|
/* This file is part of the KDE project
Copyright 2004 Ariya Hidayat <ariya@kde.org>
Copyright 2004 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef CALLIGRA_SHEETS_DEFINE_PRINT_RANGE_COMMAND
#define CALLIGRA_SHEETS_DEFINE_PRINT_RANGE_COMMAND
#include <QRect>
#include <QString>
#include "commands/AbstractRegionCommand.h"
namespace Calligra
{
namespace Sheets
{
class Sheet;
/**
* \ingroup Commands
* Defines a print range.
*/
class DefinePrintRangeCommand : public AbstractRegionCommand
{
public:
explicit DefinePrintRangeCommand();
virtual void redo();
virtual void undo();
private:
Region m_oldPrintRegion;
};
} // namespace Sheets
} // namespace Calligra
#endif // CALLIGRA_SHEETS_DEFINE_PRINT_RANGE_COMMAND
|
/*
* MLBAccInt.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Copyright (C) 2007 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _MLB_ACC_INT_H
#define _MLB_ACC_INT_H
/* Mappings of level 1 EASI function numbers to function names */
#define EASIL1_MLBMAILBOX_SYSCONFIGReadRegister32 (MLB_BASE_EASIL1 + 3)
#define EASIL1_MLBMAILBOX_SYSCONFIGWriteRegister32 (MLB_BASE_EASIL1 + 4)
#define EASIL1_MLBMAILBOX_SYSCONFIGSIdleModeRead32 (MLB_BASE_EASIL1 + 7)
#define EASIL1_MLBMAILBOX_SYSCONFIGSIdleModeWrite32 (MLB_BASE_EASIL1 + 17)
#define EASIL1_MLBMAILBOX_SYSCONFIGSoftResetWrite32 (MLB_BASE_EASIL1 + 29)
#define EASIL1_MLBMAILBOX_SYSCONFIGAutoIdleRead32 \
(MLB_BASE_EASIL1 + 33)
#define EASIL1_MLBMAILBOX_SYSCONFIGAutoIdleWrite32 (MLB_BASE_EASIL1 + 39)
#define EASIL1_MLBMAILBOX_SYSSTATUSResetDoneRead32 (MLB_BASE_EASIL1 + 44)
#define EASIL1_MLBMAILBOX_MESSAGE___0_15ReadRegister32 \
(MLB_BASE_EASIL1 + 50)
#define EASIL1_MLBMAILBOX_MESSAGE___0_15WriteRegister32 \
(MLB_BASE_EASIL1 + 51)
#define EASIL1_MLBMAILBOX_FIFOSTATUS___0_15ReadRegister32 \
(MLB_BASE_EASIL1 + 56)
#define EASIL1_MLBMAILBOX_FIFOSTATUS___0_15FifoFullMBmRead32 \
(MLB_BASE_EASIL1 + 57)
#define EASIL1_MLBMAILBOX_MSGSTATUS___0_15NbOfMsgMBmRead32 \
(MLB_BASE_EASIL1 + 60)
#define EASIL1_MLBMAILBOX_IRQSTATUS___0_3ReadRegister32 \
(MLB_BASE_EASIL1 + 62)
#define EASIL1_MLBMAILBOX_IRQSTATUS___0_3WriteRegister32 \
(MLB_BASE_EASIL1 + 63)
#define EASIL1_MLBMAILBOX_IRQENABLE___0_3ReadRegister32 \
(MLB_BASE_EASIL1 + 192)
#define EASIL1_MLBMAILBOX_IRQENABLE___0_3WriteRegister32 \
(MLB_BASE_EASIL1 + 193)
/* Register set MAILBOX_MESSAGE___REGSET_0_15 address offset, bank address
* increment and number of banks */
#define MLB_MAILBOX_MESSAGE___REGSET_0_15_OFFSET (u32)(0x0040)
#define MLB_MAILBOX_MESSAGE___REGSET_0_15_STEP (u32)(0x0004)
/* Register offset address definitions relative to register set
* MAILBOX_MESSAGE___REGSET_0_15 */
#define MLB_MAILBOX_MESSAGE___0_15_OFFSET (u32)(0x0)
/* Register set MAILBOX_FIFOSTATUS___REGSET_0_15 address offset, bank address
* increment and number of banks */
#define MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_OFFSET (u32)(0x0080)
#define MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_STEP (u32)(0x0004)
/* Register offset address definitions relative to register set
* MAILBOX_FIFOSTATUS___REGSET_0_15 */
#define MLB_MAILBOX_FIFOSTATUS___0_15_OFFSET (u32)(0x0)
/* Register set MAILBOX_MSGSTATUS___REGSET_0_15 address offset, bank address
* increment and number of banks */
#define MLB_MAILBOX_MSGSTATUS___REGSET_0_15_OFFSET (u32)(0x00c0)
#define MLB_MAILBOX_MSGSTATUS___REGSET_0_15_STEP (u32)(0x0004)
/* Register offset address definitions relative to register set
* MAILBOX_MSGSTATUS___REGSET_0_15 */
#define MLB_MAILBOX_MSGSTATUS___0_15_OFFSET (u32)(0x0)
/* Register set MAILBOX_IRQSTATUS___REGSET_0_3 address offset, bank address
* increment and number of banks */
#define MLB_MAILBOX_IRQSTATUS___REGSET_0_3_OFFSET (u32)(0x0100)
#define MLB_MAILBOX_IRQSTATUS___REGSET_0_3_STEP (u32)(0x0008)
/* Register offset address definitions relative to register set
* MAILBOX_IRQSTATUS___REGSET_0_3 */
#define MLB_MAILBOX_IRQSTATUS___0_3_OFFSET (u32)(0x0)
/* Register set MAILBOX_IRQENABLE___REGSET_0_3 address offset, bank address
* increment and number of banks */
#define MLB_MAILBOX_IRQENABLE___REGSET_0_3_OFFSET (u32)(0x0104)
#define MLB_MAILBOX_IRQENABLE___REGSET_0_3_STEP (u32)(0x0008)
/* Register offset address definitions relative to register set
* MAILBOX_IRQENABLE___REGSET_0_3 */
#define MLB_MAILBOX_IRQENABLE___0_3_OFFSET (u32)(0x0)
/* Register offset address definitions */
#define MLB_MAILBOX_SYSCONFIG_OFFSET (u32)(0x10)
#define MLB_MAILBOX_SYSSTATUS_OFFSET (u32)(0x14)
/* Bitfield mask and offset declarations */
#define MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK (u32)(0x18)
#define MLB_MAILBOX_SYSCONFIG_SIdleMode_OFFSET (u32)(3)
#define MLB_MAILBOX_SYSCONFIG_SoftReset_MASK (u32)(0x2)
#define MLB_MAILBOX_SYSCONFIG_SoftReset_OFFSET (u32)(1)
#define MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK (u32)(0x1)
#define MLB_MAILBOX_SYSCONFIG_AutoIdle_OFFSET (u32)(0)
#define MLB_MAILBOX_SYSSTATUS_ResetDone_MASK (u32)(0x1)
#define MLB_MAILBOX_SYSSTATUS_ResetDone_OFFSET (u32)(0)
#define MLB_MAILBOX_FIFOSTATUS___0_15_FifoFullMBm_MASK (u32)(0x1)
#define MLB_MAILBOX_FIFOSTATUS___0_15_FifoFullMBm_OFFSET (u32)(0)
#define MLB_MAILBOX_MSGSTATUS___0_15_NbOfMsgMBm_MASK (u32)(0x7f)
#define MLB_MAILBOX_MSGSTATUS___0_15_NbOfMsgMBm_OFFSET (u32)(0)
#endif /* _MLB_ACC_INT_H */
|
/*
* Copyright (C) 2010-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "interfaces/AnnouncementManager.h"
class CVariant;
class CAnnounceReceiver : public ANNOUNCEMENT::IAnnouncer
{
public:
static CAnnounceReceiver* GetInstance();
void Initialize();
void DeInitialize();
void Announce(ANNOUNCEMENT::AnnouncementFlag flag,
const char* sender,
const char* message,
const CVariant& data) override;
private:
CAnnounceReceiver() = default;
};
|
/*
* byteorder.h - Endian conversion for SPARC. SPARC is big endian only.
*
* COPYRIGHT (c) 2011
* Aeroflex Gaisler.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifndef _LIBCPU_BYTEORDER_H
#define _LIBCPU_BYTEORDER_H
#include <rtems/system.h>
#include <rtems/score/cpu.h>
#ifdef __cplusplus
extern "C" {
#endif
RTEMS_INLINE_ROUTINE uint16_t ld_le16(volatile uint16_t *addr)
{
return CPU_swap_u16(*addr);
}
RTEMS_INLINE_ROUTINE void st_le16(volatile uint16_t *addr, uint16_t val)
{
*addr = CPU_swap_u16(val);
}
RTEMS_INLINE_ROUTINE uint32_t ld_le32(volatile uint32_t *addr)
{
return CPU_swap_u32(*addr);
}
RTEMS_INLINE_ROUTINE void st_le32(volatile uint32_t *addr, uint32_t val)
{
*addr = CPU_swap_u32(val);
}
RTEMS_INLINE_ROUTINE uint16_t ld_be16(volatile uint16_t *addr)
{
return *addr;
}
RTEMS_INLINE_ROUTINE void st_be16(volatile uint16_t *addr, uint16_t val)
{
*addr = val;
}
RTEMS_INLINE_ROUTINE uint32_t ld_be32(volatile uint32_t *addr)
{
return *addr;
}
RTEMS_INLINE_ROUTINE void st_be32(volatile uint32_t *addr, uint32_t val)
{
*addr = val;
}
#ifdef __cplusplus
}
#endif
#endif
|
#ifndef __ASM_ARM_PLATFORM_H
#define __ASM_ARM_PLATFORM_H
#include <xen/init.h>
#include <xen/sched.h>
#include <xen/mm.h>
#include <xen/device_tree.h>
/* Describe specific operation for a board */
struct platform_desc {
/* Platform name */
const char *name;
/* Array of device tree 'compatible' strings */
const char *const *compatible;
/* Platform initialization */
int (*init)(void);
int (*init_time)(void);
#ifdef CONFIG_ARM_32
/* SMP */
int (*smp_init)(void);
int (*cpu_up)(int cpu);
#endif
/* Specific mapping for dom0 */
int (*specific_mapping)(struct domain *d);
/* Platform reset */
void (*reset)(void);
/* Platform power-off */
void (*poweroff)(void);
/*
* Platform quirks
* Defined has a function because a platform can support multiple
* board with different quirk on each
*/
uint32_t (*quirks)(void);
/*
* Platform blacklist devices
* List of devices which must not pass-through to a guest
*/
const struct dt_device_match *blacklist_dev;
};
/*
* Quirk for platforms where the 4K GIC register ranges are placed at
* 64K stride.
*/
#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 0)
void __init platform_init(void);
int __init platform_init_time(void);
int __init platform_specific_mapping(struct domain *d);
#ifdef CONFIG_ARM_32
int platform_smp_init(void);
int platform_cpu_up(int cpu);
#endif
void platform_reset(void);
void platform_poweroff(void);
bool_t platform_has_quirk(uint32_t quirk);
bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
unsigned int platform_dom0_evtchn_ppi(void);
#define PLATFORM_START(_name, _namestr) \
static const struct platform_desc __plat_desc_##_name __used \
__section(".arch.info") = { \
.name = _namestr,
#define PLATFORM_END \
};
#endif /* __ASM_ARM_PLATFORM_H */
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
|
/* linux/arch/arm/plat-s3c/include/plat/fb.h
*
* Copyright 2008 Openmoko, Inc.
* Copyright 2008 Simtec Electronics
* http://armlinux.simtec.co.uk/
* Ben Dooks <ben@simtec.co.uk>
*
* S3C - FB platform data definitions
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __PLAT_S3C_FB_H
#define __PLAT_S3C_FB_H __FILE__
#ifdef CONFIG_FB_S3C
#define FB_SWAP_WORD (1 << 24)
#define FB_SWAP_HWORD (1 << 16)
#define FB_SWAP_BYTE (1 << 8)
#define FB_SWAP_BIT (1 << 0)
struct platform_device;
struct s3c_platform_fb {
int hw_ver;
const char clk_name[16];
int nr_wins;
int nr_buffers[5];
int default_win;
int swap;
void (*cfg_gpio)(struct platform_device *dev);
int (*backlight_on)(struct platform_device *dev);
int (*reset_lcd)(struct platform_device *dev);
};
extern void s3cfb_set_platdata(struct s3c_platform_fb *fimd);
/* defined by architecture to configure gpio */
extern void s3cfb_cfg_gpio(struct platform_device *pdev);
extern int s3cfb_backlight_on(struct platform_device *pdev);
extern int s3cfb_reset_lcd(struct platform_device *pdev);
#else
/**
* struct s3c_fb_pd_win - per window setup data
* @win_mode: The display parameters to initialise (not for window 0)
* @virtual_x: The virtual X size.
* @virtual_y: The virtual Y size.
*/
struct s3c_fb_pd_win {
struct fb_videomode win_mode;
unsigned short default_bpp;
unsigned short max_bpp;
unsigned short virtual_x;
unsigned short virtual_y;
};
/**
* struct s3c_fb_platdata - S3C driver platform specific information
* @setup_gpio: Setup the external GPIO pins to the right state to transfer
* the data from the display system to the connected display
* device.
* @vidcon0: The base vidcon0 values to control the panel data format.
* @vidcon1: The base vidcon1 values to control the panel data output.
* @win: The setup data for each hardware window, or NULL for unused.
* @display_mode: The LCD output display mode.
*
* The platform data supplies the video driver with all the information
* it requires to work with the display(s) attached to the machine. It
* controls the initial mode, the number of display windows (0 is always
* the base framebuffer) that are initialised etc.
*
*/
struct s3c_fb_platdata {
void (*setup_gpio)(void);
struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
u32 vidcon0;
u32 vidcon1;
};
/**
* s3c_fb_set_platdata() - Setup the FB device with platform data.
* @pd: The platform data to set. The data is copied from the passed structure
* so the machine data can mark the data __initdata so that any unused
* machines will end up dumping their data at runtime.
*/
extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
/**
* s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
*
* Initialise the GPIO for an 24bpp LCD display on the RGB interface.
*/
extern void s3c64xx_fb_gpio_setup_24bpp(void);
#endif
#endif /* __PLAT_S3C_FB_H */
|
/*
* This is the source code of tgnet library v. 1.1
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2015-2018.
*/
#ifndef BYTESTREAM_H
#define BYTESTREAM_H
#include <vector>
#include <stdint.h>
class NativeByteBuffer;
class ByteStream {
public:
ByteStream();
~ByteStream();
void append(NativeByteBuffer *buffer);
bool hasData();
void get(NativeByteBuffer *dst);
void discard(uint32_t count);
void clean();
private:
std::vector<NativeByteBuffer *> buffersQueue;
};
#endif
|
/*
$Log: hp100.c,v $
Revision 1.1 2004/05/04 11:16:42 csoutheren
Initial version
Revision 1.1 2000/06/05 04:45:12 robertj
Added LPC-10 2400bps codec
* Revision 1.2 1996/08/20 20:28:05 jaf
* Removed all static local variables that were SAVE'd in the Fortran
* code, and put them in struct lpc10_encoder_state that is passed as an
* argument.
*
* Removed init function, since all initialization is now done in
* init_lpc10_encoder_state().
*
* Revision 1.1 1996/08/19 22:32:04 jaf
* Initial revision
*
*/
#ifdef P_R_O_T_O_T_Y_P_E_S
extern int hp100_(real *speech, integer *start, integer *end,
struct lpc10_encoder_state *st);
extern int inithp100_(void);
#endif
/* -- translated by f2c (version 19951025).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* ********************************************************************* */
/* HP100 Version 55 */
/* $Log: hp100.c,v $
/* Revision 1.1 2004/05/04 11:16:42 csoutheren
/* Initial version
/*
/* Revision 1.1 2000/06/05 04:45:12 robertj
/* Added LPC-10 2400bps codec
/*
* Revision 1.2 1996/08/20 20:28:05 jaf
* Removed all static local variables that were SAVE'd in the Fortran
* code, and put them in struct lpc10_encoder_state that is passed as an
* argument.
*
* Removed init function, since all initialization is now done in
* init_lpc10_encoder_state().
*
* Revision 1.1 1996/08/19 22:32:04 jaf
* Initial revision
* */
/* Revision 1.6 1996/03/15 16:45:25 jaf */
/* Rearranged a few comments. */
/* Revision 1.5 1996/03/14 23:20:54 jaf */
/* Added comments about when INITHP100 should be used. */
/* Revision 1.4 1996/03/14 23:08:08 jaf */
/* Added an entry named INITHP100 that initializes the local state of */
/* subroutine HP100. */
/* Revision 1.3 1996/03/14 22:09:20 jaf */
/* Comments added explaining which of the local variables of this */
/* subroutine need to be saved from one invocation to the next, and which */
/* do not. */
/* Revision 1.2 1996/02/12 15:05:54 jaf */
/* Added lots of comments explaining why I changed one line, which was a */
/* declaration with initializations. */
/* Revision 1.1 1996/02/07 14:47:12 jaf */
/* Initial revision */
/* ********************************************************************* */
/* 100 Hz High Pass Filter */
/* Jan 92 - corrected typo (1.937148 to 1.935715), */
/* rounded coefficients to 7 places, */
/* corrected and merged gain (.97466**4), */
/* merged numerator into first two sections. */
/* Input: */
/* start, end - Range of samples to filter */
/* Input/Output: */
/* speech(end) - Speech data. */
/* Indices start through end are read and modified. */
/* This subroutine maintains local state from one call to the next. If */
/* you want to switch to using a new audio stream for this filter, or */
/* reinitialize its state for any other reason, call the ENTRY */
/* INITHP100. */
/* Subroutine */ int hp100_(real *speech, integer *start, integer *end,
struct lpc10_encoder_state *st)
{
/* Temporary local copies of variables in lpc10_encoder_state.
I've only created these because it might cause the loop below
to execute a bit faster to access local variables, rather than
variables in the lpc10_encoder_state structure. It is just a
guess that it will be faster. */
real z11;
real z21;
real z12;
real z22;
/* System generated locals */
integer i__1;
/* Local variables */
integer i__;
real si, err;
/* Arguments */
/* Local variables that need not be saved */
/* Local state */
/* Parameter adjustments */
if (speech) {
--speech;
}
/* Function Body */
z11 = st->z11;
z21 = st->z21;
z12 = st->z12;
z22 = st->z22;
i__1 = *end;
for (i__ = *start; i__ <= i__1; ++i__) {
si = speech[i__];
err = si + z11 * 1.859076f - z21 * .8648249f;
si = err - z11 * 2.f + z21;
z21 = z11;
z11 = err;
err = si + z12 * 1.935715f - z22 * .9417004f;
si = err - z12 * 2.f + z22;
z22 = z12;
z12 = err;
speech[i__] = si * .902428f;
}
st->z11 = z11;
st->z21 = z21;
st->z12 = z12;
st->z22 = z22;
return 0;
} /* hp100_ */
|
#ifndef _ASM_STAT_H
#define _ASM_STAT_H
#include <linux/types.h>
struct __old_kernel_stat {
unsigned int st_dev;
unsigned int st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned int st_rdev;
long st_size;
unsigned int st_atime, st_res1;
unsigned int st_mtime, st_res2;
unsigned int st_ctime, st_res3;
unsigned int st_blksize;
int st_blocks;
unsigned int st_unused0[2];
};
struct stat {
dev_t st_dev;
long st_pad1[3]; /* Reserved for network id */
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
long st_pad2[2];
off_t st_size;
long st_pad3;
/*
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
* but we don't have it under Linux.
*/
time_t st_atime;
long reserved0;
time_t st_mtime;
long reserved1;
time_t st_ctime;
long reserved2;
long st_blksize;
long st_blocks;
long st_pad4[14];
};
/*
* This matches struct stat64 in glibc2.1, hence the absolutely insane
* amounts of padding around dev_t's. The memory layout is the same as of
* struct stat of the 64-bit kernel.
*/
struct stat64 {
unsigned long st_dev;
unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
unsigned long long st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
unsigned long st_rdev;
unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
long long st_size;
/*
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
* but we don't have it under Linux.
*/
time_t st_atime;
unsigned long reserved0; /* Reserved for st_atime expansion */
time_t st_mtime;
unsigned long reserved1; /* Reserved for st_mtime expansion */
time_t st_ctime;
unsigned long reserved2; /* Reserved for st_ctime expansion */
unsigned long st_blksize;
unsigned long st_pad2;
long long st_blocks;
};
#endif /* _ASM_STAT_H */
|
//
// AsyncDisplayKit+Debug.h
// AsyncDisplayKit
//
// Created by Hannah Troisi on 3/7/16.
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#import "ASControlNode.h"
#import "ASImageNode.h"
@interface ASImageNode (Debugging)
/**
* Enables an ASImageNode debug label that shows the ratio of pixels in the source image to those in
* the displayed bounds (including cropRect). This helps detect excessive image fetching / downscaling,
* as well as upscaling (such as providing a URL not suitable for a Retina device). For dev purposes only.
* @param enabled Specify YES to show the label on all ASImageNodes with non-1.0x source-to-bounds pixel ratio.
*/
+ (void)setShouldShowImageScalingOverlay:(BOOL)show;
+ (BOOL)shouldShowImageScalingOverlay;
@end
@interface ASControlNode (Debugging)
/**
Class method to enable a visualization overlay of the tappable area on the ASControlNode. For app debugging purposes only.
NOTE: GESTURE RECOGNIZERS, (including tap gesture recognizers on a control node) WILL NOT BE VISUALIZED!!!
Overlay = translucent GREEN color,
edges that are clipped by the tappable area of any parent (their bounds + hitTestSlop) in the hierarchy = DARK GREEN BORDERED EDGE,
edges that are clipped by clipToBounds = YES of any parent in the hierarchy = ORANGE BORDERED EDGE (may still receive touches beyond
overlay rect, but can't be visualized).
@param enable Specify YES to make this debug feature enabled when messaging the ASControlNode class.
*/
+ (void)setEnableHitTestDebug:(BOOL)enable;
+ (BOOL)enableHitTestDebug;
@end
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_CRC32_H
#define PHP_HASH_CRC32_H
#include "ext/standard/basic_functions.h"
typedef struct {
php_hash_uint32 state;
} PHP_CRC32_CTX;
PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context);
PHP_HASH_API void PHP_CRC32Update(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_CRC32BUpdate(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_CRC32Final(unsigned char digest[4], PHP_CRC32_CTX *context);
PHP_HASH_API int PHP_CRC32Copy(const php_hash_ops *ops, PHP_CRC32_CTX *orig_context, PHP_CRC32_CTX *copy_context);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
|
/*
* Debug/trace/assert driver definitions for Dongle Host Driver.
*
* Copyright (C) 1999-2016, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_dbg.h 599270 2015-11-13 05:22:03Z $
*/
#ifndef _dhd_dbg_
#define _dhd_dbg_
#define USE_NET_RATELIMIT 1
#if defined(DHD_DEBUG)
#define DHD_ERROR(args) do {if ((dhd_msg_level & DHD_ERROR_VAL) && USE_NET_RATELIMIT) \
printf args;} while (0)
#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) printf args;} while (0)
#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) printf args;} while (0)
#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) printf args;} while (0)
#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) printf args;} while (0)
#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) printf args;} while (0)
#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) printf args;} while (0)
#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) printf args;} while (0)
#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) printf args;} while (0)
#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) printf args;} while (0)
#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) printf args;} while (0)
#define DHD_BTA(args) do {if (dhd_msg_level & DHD_BTA_VAL) printf args;} while (0)
#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) printf args;} while (0)
#define DHD_ARPOE(args) do {if (dhd_msg_level & DHD_ARPOE_VAL) printf args;} while (0)
#define DHD_REORDER(args) do {if (dhd_msg_level & DHD_REORDER_VAL) printf args;} while (0)
#define DHD_PNO(args) do {if (dhd_msg_level & DHD_PNO_VAL) printf args;} while (0)
#define DHD_MSGTRACE_LOG(args) do {if (dhd_msg_level & DHD_MSGTRACE_VAL) printf args;} while (0)
#define DHD_FWLOG(args) do {if (dhd_msg_level & DHD_FWLOG_VAL) printf args;} while (0)
#define DHD_RTT(args) do {if (dhd_msg_level & DHD_RTT_VAL) printf args;} while (0)
#ifdef HTC_DEBUG_FLAG
#define DHD_ERROR_HW_ONE DHD_ERROR
#else
#define DHD_ERROR_HW_ONE DHD_INFO
#endif /* HTC_DEBUG_FLAG */
#define DHD_TRACE_HW4 DHD_TRACE
#define DHD_INFO_HW4 DHD_INFO
#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL)
#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL)
#define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL)
#define DHD_DATA_ON() (dhd_msg_level & DHD_DATA_VAL)
#define DHD_CTL_ON() (dhd_msg_level & DHD_CTL_VAL)
#define DHD_TIMER_ON() (dhd_msg_level & DHD_TIMER_VAL)
#define DHD_HDRS_ON() (dhd_msg_level & DHD_HDRS_VAL)
#define DHD_BYTES_ON() (dhd_msg_level & DHD_BYTES_VAL)
#define DHD_INTR_ON() (dhd_msg_level & DHD_INTR_VAL)
#define DHD_GLOM_ON() (dhd_msg_level & DHD_GLOM_VAL)
#define DHD_EVENT_ON() (dhd_msg_level & DHD_EVENT_VAL)
#define DHD_BTA_ON() (dhd_msg_level & DHD_BTA_VAL)
#define DHD_ISCAN_ON() (dhd_msg_level & DHD_ISCAN_VAL)
#define DHD_ARPOE_ON() (dhd_msg_level & DHD_ARPOE_VAL)
#define DHD_REORDER_ON() (dhd_msg_level & DHD_REORDER_VAL)
#define DHD_NOCHECKDIED_ON() (dhd_msg_level & DHD_NOCHECKDIED_VAL)
#define DHD_PNO_ON() (dhd_msg_level & DHD_PNO_VAL)
#define DHD_FWLOG_ON() (dhd_msg_level & DHD_FWLOG_VAL)
#define DHD_RTT_ON() (dhd_msg_level & DHD_RTT_VAL)
#else /* defined(BCMDBG) || defined(DHD_DEBUG) */
#define DHD_ERROR(args) do {if (USE_NET_RATELIMIT) printf args;} while (0)
#define DHD_TRACE(args)
#define DHD_INFO(args)
#define DHD_DATA(args)
#define DHD_CTL(args)
#define DHD_TIMER(args)
#define DHD_HDRS(args)
#define DHD_BYTES(args)
#define DHD_INTR(args)
#define DHD_GLOM(args)
#define DHD_EVENT(args)
#define DHD_BTA(args)
#define DHD_ISCAN(args)
#define DHD_ARPOE(args)
#define DHD_REORDER(args)
#define DHD_PNO(args)
#define DHD_MSGTRACE_LOG(args)
#define DHD_FWLOG(args)
#ifdef HTC_DEBUG_FLAG
#define DHD_ERROR_HW_ONE DHD_ERROR
#else
#define DHD_ERROR_HW_ONE DHD_INFO
#endif /* HTC_DEBUG_FLAG */
#define DHD_TRACE_HW4 DHD_TRACE
#define DHD_INFO_HW4 DHD_INFO
#define DHD_ERROR_ON() 0
#define DHD_TRACE_ON() 0
#define DHD_INFO_ON() 0
#define DHD_DATA_ON() 0
#define DHD_CTL_ON() 0
#define DHD_TIMER_ON() 0
#define DHD_HDRS_ON() 0
#define DHD_BYTES_ON() 0
#define DHD_INTR_ON() 0
#define DHD_GLOM_ON() 0
#define DHD_EVENT_ON() 0
#define DHD_BTA_ON() 0
#define DHD_ISCAN_ON() 0
#define DHD_ARPOE_ON() 0
#define DHD_REORDER_ON() 0
#define DHD_NOCHECKDIED_ON() 0
#define DHD_PNO_ON() 0
#define DHD_FWLOG_ON() 0
#define DHD_RTT_ON() 0
#endif
#define DHD_LOG(args)
#define DHD_BLOG(cp, size)
#define DHD_NONE(args)
extern int dhd_msg_level;
/* Defines msg bits */
#include <dhdioctl.h>
#endif /* _dhd_dbg_ */
|
/*
* Copyright 2010-2015 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENXCOM_LISTGAMESSTATE_H
#define OPENXCOM_LISTGAMESSTATE_H
#include "../Engine/State.h"
#include "OptionsBaseState.h"
#include <vector>
#include <string>
#include "../Savegame/SavedGame.h"
#include "../Engine/Options.h"
namespace OpenXcom
{
class TextButton;
class Window;
class Text;
class TextList;
class ArrowButton;
/**
* Base class for saved game screens which
* provides the common layout and listing.
*/
class ListGamesState : public State
{
protected:
TextButton *_btnCancel;
Window *_window;
Text *_txtTitle, *_txtName, *_txtDate, *_txtDelete, *_txtDetails;
TextList *_lstSaves;
ArrowButton *_sortName, *_sortDate;
OptionsOrigin _origin;
std::vector<SaveInfo> _saves;
unsigned int _firstValidRow;
bool _autoquick, _sortable;
void updateArrows();
public:
/// Creates the Saved Game state.
ListGamesState(OptionsOrigin origin, int firstValidRow, bool autoquick);
/// Cleans up the Saved Game state.
virtual ~ListGamesState();
/// Sets up the saves list.
void init();
/// Sorts the savegame list.
void sortList(SaveSort sort);
/// Updates the savegame list.
virtual void updateList();
/// Handler for clicking the Cancel button.
void btnCancelClick(Action *action);
/// Handler for moving the mouse over a list item.
void lstSavesMouseOver(Action *action);
/// Handler for moving the mouse outside the list borders.
void lstSavesMouseOut(Action *action);
/// Handler for clicking the Saves list.
virtual void lstSavesPress(Action *action);
/// Handler for clicking the Name arrow.
void sortNameClick(Action *action);
/// Handler for clicking the Date arrow.
void sortDateClick(Action *action);
/// disables the sort buttons.
void disableSort();
};
}
#endif
|
/* -*- C++ -*- */
/*************************************************************************
* Copyright(c) 1995~2005 Masaharu Goto (root-cint@cern.ch)
*
* For the licensing terms see the file COPYING
*
************************************************************************/
// lib/dll_stl/clim.h
#include <cstddef>
#include <climits>
#include <limits>
#ifndef __hpux
using namespace std;
#endif
#ifdef __MAKECINT__
#ifndef G__CLIMITS_DLL
#define G__CLIMITS_DLL
#endif
#pragma link C++ global G__CLIMITS_DLL;
#pragma link C++ class numeric_limits<bool> ;
#pragma link C++ class numeric_limits<char> ;
#pragma link C++ class numeric_limits<signed char> ;
#pragma link C++ class numeric_limits<unsigned char> ;
#pragma link C++ class numeric_limits<wchar_t> ;
#pragma link C++ class numeric_limits<short> ;
#pragma link C++ class numeric_limits<int> ;
#pragma link C++ class numeric_limits<long> ;
#pragma link C++ class numeric_limits<unsigned short> ;
#pragma link C++ class numeric_limits<unsigned int> ;
#pragma link C++ class numeric_limits<unsigned long> ;
#pragma link C++ class numeric_limits<float> ;
#pragma link C++ class numeric_limits<double> ;
#pragma link C++ class numeric_limits<long double> ;
#endif
|
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
// MOOSE includes
#include "StochasticToolsTransfer.h"
// Forward declarations
class SamplerReceiver;
/**
* Copy each row from each DenseMatrix to the sub-applications SamplerReceiver object.
*/
class SamplerParameterTransfer : public StochasticToolsTransfer
{
public:
static InputParameters validParams();
SamplerParameterTransfer(const InputParameters & parameters);
/**
* Traditional Transfer callback
*/
virtual void execute() override;
///@{
/**
* Methods used when running in batch mode (see SamplerFullSolveMultiApp)
*/
virtual void initializeToMultiapp() override;
virtual void executeToMultiapp() override;
virtual void finalizeToMultiapp() override;
///@}
protected:
/**
* Return the SamplerReceiver object and perform error checking.
* @param app_index The global sup-app index
*/
SamplerReceiver * getReceiver(unsigned int app_index);
/// Storage for the list of parameters to control
const std::vector<std::string> & _parameter_names;
/// The name of the SamplerReceiver Control object on the sub-application
const std::string & _receiver_name;
/// Current global index for batch execution
dof_id_type _global_index;
};
|
/* Copyright (C) 1992-1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/*
* $Id: scandir.c,v 1.1 2002-12-05 01:50:22 rtv Exp $
*
* taken from glibc, modified slightly for standalone compilation, and used as
* a fallback implementation when scandir() is not available. - BPG
*/
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int
scandir(dir, namelist, select, cmp)
const char *dir;
struct dirent ***namelist;
int (*select) (const struct dirent *);
int (*cmp) (const void *, const void *);
{
DIR *dp = opendir (dir);
struct dirent **v = NULL;
size_t vsize = 0, i;
struct dirent *d;
int save;
if (dp == NULL)
return -1;
save = errno;
errno = 0;
i = 0;
while ((d = readdir (dp)) != NULL)
if (select == NULL || (*select) (d))
{
struct dirent *vnew;
size_t dsize;
/* Ignore errors from select or readdir */
errno = 0;
if (i == vsize)
{
struct dirent **new;
if (vsize == 0)
vsize = 10;
else
vsize *= 2;
new = (struct dirent **) realloc (v, vsize * sizeof (*v));
if (new == NULL)
break;
v = new;
}
dsize = &d->d_name[strlen(d->d_name)+1] - (char *) d;
vnew = (struct dirent *) malloc (dsize);
if (vnew == NULL)
break;
v[i++] = (struct dirent *) memcpy (vnew, d, dsize);
}
if (errno != 0)
{
save = errno;
(void) closedir (dp);
while (i > 0)
free (v[--i]);
free (v);
errno = save;
return -1;
}
(void) closedir (dp);
errno = save;
/* Sort the list if we have a comparison function to sort with. */
if (cmp != NULL)
qsort (v, i, sizeof (*v), cmp);
*namelist = v;
return i;
}
|
/*
* This file is a part of Pocket Heroes Game project
* http://www.pocketheroes.net
* https://code.google.com/p/pocketheroes/
*
* Copyright 2004-2010 by Robert Tarasov and Anton Stuk (iO UPG)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _HMM_GAME_HERO_VIEW_ARTIFACTS_PAGE_H_
#define _HMM_GAME_HERO_VIEW_ARTIFACTS_PAGE_H_
const sint32 doX = 65;
const sint32 doY = 5;
const sint32 acW = 30;
const sint32 acH = 28;
#include "ArtifactList.h"
//////////////////////////////////////////////////////////////////////////
const sint32 HERO_DOLL_CELLS[AC_COUNT][2] = {
{74, -2}, {74,29}, {74,60}, {-6,23}, {109,91}, {-6,54}, {142,91}, {109,122}, {76,125}, {76,162}, {27,65}, {27,96}, {27,127}, {27,158}
};
//////////////////////////////////////////////////////////////////////////
class iArtifactsTab : public iHeroViewChild, public IViewCmdHandler
{
public:
iArtifactsTab(iViewMgr* pViewMgr) : iHeroViewChild(pViewMgr)
{
iRect rc = GetScrRect();
AddChild(m_pArtBackPackCtrl = new iArtBackPackCtrl(m_Competitors, pViewMgr, this, iPoint(10,10), iSize(acW,acH), 5, 0/*iArtBackPackCtrl::Horizontal*/, 101));
for (uint32 xx=0; xx<AC_COUNT; ++xx) {
AddChild(m_pDollItems[xx] = new iArtItemCtrl(m_Competitors, pViewMgr, this, iPoint(HERO_DOLL_CELLS[xx][0]+doX,HERO_DOLL_CELLS[xx][1]+doY), iSize(acW,acH), 110+xx));
}
}
void OnHeroChanged()
{
m_pArtBackPackCtrl->SetBackPack(&m_pHero->Artifacts().BackPack(), m_pHero);
for (uint32 xx=0; xx<AC_COUNT; ++xx) {
m_pDollItems[xx]->SetOwner(m_pHero);
m_pDollItems[xx]->SetArtCell(&m_pHero->Artifacts().DressedItem((HERO_ART_CELL)xx));
}
Invalidate();
}
void ComposeArtCell(const iRect& rc, uint16 artId)
{
gApp.Surface().FillRect(rc,RGB16(255,192,64),64);
ButtonFrame(gApp.Surface(),rc, 0);
if (artId != 0xFFFF) BlitIcon(gApp.Surface(),gGame.ItemMgr().m_artMgr[artId].Sprite(),rc);
}
void OnCompose()
{
iHeroViewChild::OnCompose();
iRect rc = GetScrRect();
// Draw Hero doll
iPoint hdPos(rc.x+doX,rc.y+doY);
gGfxMgr.Blit(PDGG_HDOLL_WIRE,gApp.Surface(),hdPos);
gGfxMgr.BlitEffect(PDGG_HDOLL_BODY,gApp.Surface(),hdPos,iGfxManager::EfxTransparent);
gGfxMgr.BlitEffect(PDGG_HDOLL_CAPE,gApp.Surface(),hdPos,iGfxManager::EfxTransparent);
gGfxMgr.BlitEffect(PDGG_HDOLL_CAPE,gApp.Surface(),hdPos,iGfxManager::EfxTransparent);
/*
iRect bpRect(rc.x+3,rc.y+3,acW,17);
bpRect.y += 17; bpRect.h=acH;
for (uint32 xx=0; xx<5; ++xx){
ComposeArtCell(bpRect, 0xFFFF);
bpRect.y += acH+1;
}
bpRect.h=17;
// Compose doll's cells
for (uint32 xx=0; xx<m_dollCells.GetSize(); ++xx) {
ComposeArtCell(m_dollCells[xx],m_pHero->Artifacts().DressedItem((HERO_ART_CELL)xx).artId);
}
*/
}
void iCMDH_ControlCommand(iView* pView, CTRL_CMD_ID cmd, sint32 param)
{
uint32 uid = pView->GetUID();
}
private:
sint32 CellByPos(const iPoint& pos)
{
sint32 result = -1;
// find in doll's cells
for (uint32 xx=0; xx<m_dollCells.GetSize(); ++xx) {
if (m_dollCells[xx].PtInRect(pos)) return xx;
}
return result;
}
void OnMouseDown(const iPoint& pos)
{
}
void OnMouseUp(const iPoint& pos)
{
}
protected:
iSimpleArray<iArtDragDropItem*> m_Competitors;
iArtItemCtrl* m_pDollItems[AC_COUNT];
iArtBackPackCtrl* m_pArtBackPackCtrl;
iSimpleArray<iRect> m_dollCells;
};
#endif //_HMM_GAME_HERO_VIEW_ARTIFACTS_PAGE_H_
|
/*
* Copyright 2010-2012 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 "EC2PurchaseReservedInstancesOfferingResponse.h"
#import "EC2ResponseUnmarshaller.h"
#import "../AmazonValueUnmarshaller.h"
#import "../AmazonBoolValueUnmarshaller.h"
/**
* Purchase Reserved Instances Offering Response Unmarshaller
*/
@interface EC2PurchaseReservedInstancesOfferingResponseUnmarshaller:EC2ResponseUnmarshaller {
EC2PurchaseReservedInstancesOfferingResponse *response;
}
@property (nonatomic, readonly) EC2PurchaseReservedInstancesOfferingResponse *response;
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict;
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
@end
|
/**
* @file
* @brief Periodical Interval Timer interface
*
* @date 26.09.10
* @author Anton Kozlov
*/
#ifndef AT91SAM7_PIT_H_
#define AT91SAM7_PIT_H_
#include <drivers/at91sam7s256.h>
typedef struct _AT91S_PITC {
at91_reg_t PITC_PIMR; // Period Interval Mode Register
at91_reg_t PITC_PISR; // Period Interval Status Register
at91_reg_t PITC_PIVR; // Period Interval Value Register
at91_reg_t PITC_PIIR; // Period Interval Image Register
} AT91S_PITC, *AT91PS_PITC;
// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register --------
#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value
#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled
#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable
// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register --------
#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status
// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register --------
#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value
#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter
// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register --------
// ========== Register definition for PITC peripheral ==========
#define AT91C_PITC_PIVR ((at91_reg_t *) 0xFFFFFD38) // (PITC) Period Interval Value Register
#define AT91C_PITC_PISR ((at91_reg_t *) 0xFFFFFD34) // (PITC) Period Interval Status Register
#define AT91C_PITC_PIIR ((at91_reg_t *) 0xFFFFFD3C) // (PITC) Period Interval Image Register
#define AT91C_PITC_PIMR ((at91_reg_t *) 0xFFFFFD30) // (PITC) Period Interval Mode Register
#endif /* AT91SAM7_PIT_H_ */
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_
#define CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_
#pragma once
#include <string>
#include "build/build_config.h"
#if defined(OS_WIN)
#include <windows.h>
#endif
namespace sandbox {
struct SandboxInterfaceInfo;
}
namespace content {
class ContentMainDelegate;
// This class is responsible for content initialization, running and shutdown.
class ContentMainRunner {
public:
virtual ~ContentMainRunner() {}
// Create a new ContentMainRunner object.
static ContentMainRunner* Create();
// Initialize all necessary content state.
#if defined(OS_WIN)
// The |sandbox_info| and |delegate| objects must outlive this class.
// |sandbox_info| should be initialized using InitializeSandboxInfo from
// content_main_win.h.
virtual int Initialize(HINSTANCE instance,
sandbox::SandboxInterfaceInfo* sandbox_info,
ContentMainDelegate* delegate) = 0;
#else
// The |delegate| object must outlive this class.
virtual int Initialize(int argc,
const char** argv,
ContentMainDelegate* delegate) = 0;
#endif
// Perform the default run logic.
virtual int Run() = 0;
// Shut down the content state.
virtual void Shutdown() = 0;
};
} // namespace content
#endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_
|
#include <tommath.h>
#ifdef BN_MP_ADD_D_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
*/
/* single digit addition */
int
mp_add_d (mp_int * a, mp_digit b, mp_int * c)
{
int res, ix, oldused;
mp_digit *tmpa, *tmpc, mu;
/* grow c as required */
if (c->alloc < a->used + 1) {
if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) {
return res;
}
}
/* if a is negative and |a| >= b, call c = |a| - b */
if (a->sign == MP_NEG && (a->used > 1 || a->dp[0] >= b)) {
/* temporarily fix sign of a */
a->sign = MP_ZPOS;
/* c = |a| - b */
res = mp_sub_d(a, b, c);
/* fix signs */
a->sign = MP_NEG;
c->sign = (c->used) ? MP_NEG : MP_ZPOS;
/* clamp */
mp_clamp(c);
return res;
}
/* old number of used digits in c */
oldused = c->used;
/* sign always positive */
c->sign = MP_ZPOS;
/* source alias */
tmpa = a->dp;
/* destination alias */
tmpc = c->dp;
/* if a is positive */
if (a->sign == MP_ZPOS) {
/* add digit, after this we're propagating
* the carry.
*/
*tmpc = *tmpa++ + b;
mu = *tmpc >> DIGIT_BIT;
*tmpc++ &= MP_MASK;
/* now handle rest of the digits */
for (ix = 1; ix < a->used; ix++) {
*tmpc = *tmpa++ + mu;
mu = *tmpc >> DIGIT_BIT;
*tmpc++ &= MP_MASK;
}
/* set final carry */
ix++;
*tmpc++ = mu;
/* setup size */
c->used = a->used + 1;
} else {
/* a was negative and |a| < b */
c->used = 1;
/* the result is a single digit */
if (a->used == 1) {
*tmpc++ = b - a->dp[0];
} else {
*tmpc++ = b;
}
/* setup count so the clearing of oldused
* can fall through correctly
*/
ix = 1;
}
/* now zero to oldused */
while (ix++ < oldused) {
*tmpc++ = 0;
}
mp_clamp(c);
return MP_OKAY;
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.