text stringlengths 4 6.14k |
|---|
/*
* Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM 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; 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
*
* $Id$
*/
#include <config.h>
#include <lpar.h>
#include <hype.h>
#include <mmu.h>
#include <pmm.h>
#include <h_proto.h>
sval
h_logical_cache_load(struct cpu_thread *thread, uval size, uval addr)
{
uval val;
/* is this in onr of our chunks? */
addr = logical_to_physical_address(thread->cpu->os, addr, size);
/*
* RPA states:
* The Hypervisor checks that the address is within the
* range of addresses valid for the partition and mapped as
* cacheable.
*
* All "Chunks" are chacheable so there is nothing to do
*/
switch (size) {
default:
return H_Parameter;
case 1: /* 8-bit */
val = *((uval8 *)addr);
break;
case 2: /* 16-bit */
if ((addr & 0x1) != 0) {
return H_Parameter;
}
val = *((uval16 *)addr);
break;
case 4: /* 32-bit */
if ((addr & 0x3) != 0) {
return H_Parameter;
}
val = *((uval32 *)addr);
break;
case 8: /* 64-bit */
/* on 32 bit systems we treat this as pointer size */
if ((addr & (sizeof (uval) - 1)) != 0) {
return H_Parameter;
}
val = *((uval *)addr);
break;
}
return_arg(thread, 1, val);
return H_Success;
}
|
/*********************************************************************
* Portions COPYRIGHT 2016 STMicroelectronics *
* Portions SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.32 - Graphical user interface for embedded applications **
All Intellectual Property rights in the Software belongs to SEGGER.
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with the following terms:
The software has been licensed to STMicroelectronics International
N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
troller products commercialized by Licensee only, sublicensed and dis_
tributed under the terms and conditions of the End User License Agree_
ment supplied by STMicroelectronics International N.V.
Full source code is available at: www.segger.com
We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : GLOBAL.h
Purpose : Global types etc.
---------------------------END-OF-HEADER------------------------------
*/
/**
******************************************************************************
* @attention
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* 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 GLOBAL_H // Guard against multiple inclusion
#define GLOBAL_H
/*********************************************************************
*
* Macros
*
**********************************************************************
*/
#ifndef U8
#define U8 unsigned char
#endif
#ifndef U16
#define U16 unsigned short
#endif
#ifndef U32
#define U32 unsigned long
#endif
#ifndef I8
#define I8 signed char
#endif
#ifndef I16
#define I16 signed short
#endif
#ifndef I32
#define I32 signed long
#endif
#endif // Avoid multiple inclusion
/*************************** End of file ****************************/
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2012 Sughosh Ganu <urwithsughosh@gmail.com>
*/
#include <common.h>
#include <malloc.h>
#include <asm/io.h>
#include <clk.h>
#include <dm.h>
#include <dm/device_compat.h>
#include <dm/devres.h>
#include <dm/ofnode.h>
#include <generic-phy.h>
#include <reset.h>
#include "ohci.h"
#include <asm/arch/da8xx-usb.h>
struct da8xx_ohci {
ohci_t ohci;
struct clk *clocks; /* clock list */
struct phy phy;
int clock_count; /* number of clock in clock list */
};
static int usb_phy_on(void)
{
unsigned long timeout;
clrsetbits_le32(&davinci_syscfg_regs->cfgchip2,
(CFGCHIP2_RESET | CFGCHIP2_PHYPWRDN |
CFGCHIP2_OTGPWRDN | CFGCHIP2_OTGMODE |
CFGCHIP2_REFFREQ | CFGCHIP2_USB1PHYCLKMUX),
(CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN |
CFGCHIP2_PHY_PLLON | CFGCHIP2_REFFREQ_24MHZ |
CFGCHIP2_USB2PHYCLKMUX | CFGCHIP2_USB1SUSPENDM));
/* wait until the usb phy pll locks */
timeout = get_timer(0);
while (get_timer(timeout) < 10) {
if (readl(&davinci_syscfg_regs->cfgchip2) & CFGCHIP2_PHYCLKGD)
return 1;
}
/* USB phy was not turned on */
return 0;
}
static void usb_phy_off(void)
{
/* Power down the on-chip PHY. */
clrsetbits_le32(&davinci_syscfg_regs->cfgchip2,
CFGCHIP2_PHY_PLLON | CFGCHIP2_USB1SUSPENDM,
CFGCHIP2_PHYPWRDN | CFGCHIP2_OTGPWRDN |
CFGCHIP2_RESET);
}
int usb_cpu_init(void)
{
/* enable psc for usb2.0 */
lpsc_on(DAVINCI_LPSC_USB20);
/* enable psc for usb1.0 */
lpsc_on(DAVINCI_LPSC_USB11);
/* start the on-chip usb phy and its pll */
if (usb_phy_on())
return 0;
return 1;
}
int usb_cpu_stop(void)
{
usb_phy_off();
/* turn off the usb clock and assert the module reset */
lpsc_disable(DAVINCI_LPSC_USB11);
lpsc_disable(DAVINCI_LPSC_USB20);
return 0;
}
int usb_cpu_init_fail(void)
{
return usb_cpu_stop();
}
#if CONFIG_IS_ENABLED(DM_USB)
static int ohci_da8xx_probe(struct udevice *dev)
{
struct ohci_regs *regs = dev_read_addr_ptr(dev);
struct da8xx_ohci *priv = dev_get_priv(dev);
int i, err, ret, clock_nb;
err = 0;
priv->clock_count = 0;
clock_nb = dev_count_phandle_with_args(dev, "clocks", "#clock-cells",
0);
if (clock_nb < 0)
return clock_nb;
if (clock_nb > 0) {
priv->clocks = devm_kcalloc(dev, clock_nb, sizeof(struct clk),
GFP_KERNEL);
if (!priv->clocks)
return -ENOMEM;
for (i = 0; i < clock_nb; i++) {
err = clk_get_by_index(dev, i, &priv->clocks[i]);
if (err < 0)
break;
err = clk_enable(&priv->clocks[i]);
if (err) {
dev_err(dev, "failed to enable clock %d\n", i);
clk_free(&priv->clocks[i]);
goto clk_err;
}
priv->clock_count++;
}
}
err = usb_cpu_init();
if (err)
goto clk_err;
err = ohci_register(dev, regs);
if (err)
goto phy_err;
return 0;
phy_err:
ret = usb_cpu_stop();
if (ret)
dev_err(dev, "failed to shutdown usb phy\n");
clk_err:
ret = clk_release_all(priv->clocks, priv->clock_count);
if (ret)
dev_err(dev, "failed to disable all clocks\n");
return err;
}
static int ohci_da8xx_remove(struct udevice *dev)
{
struct da8xx_ohci *priv = dev_get_priv(dev);
int ret;
ret = ohci_deregister(dev);
if (ret)
return ret;
ret = usb_cpu_stop();
if (ret)
return ret;
return clk_release_all(priv->clocks, priv->clock_count);
}
static const struct udevice_id da8xx_ohci_ids[] = {
{ .compatible = "ti,da830-ohci" },
{ }
};
U_BOOT_DRIVER(ohci_generic) = {
.name = "ohci-da8xx",
.id = UCLASS_USB,
.of_match = da8xx_ohci_ids,
.probe = ohci_da8xx_probe,
.remove = ohci_da8xx_remove,
.ops = &ohci_usb_ops,
.priv_auto_alloc_size = sizeof(struct da8xx_ohci),
.flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE,
};
#endif
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 Advanced Micro Devices, Inc.
* Copyright (C) 2007-2009 coresystems GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* SPDs for DDR2 SDRAM */
#define SPD_MEM_TYPE 2
#define SPD_MEM_TYPE_SDRAM_DDR 0x07
#define SPD_MEM_TYPE_SDRAM_DDR2 0x08
#define SPD_DIMM_TYPE 20 /* x bit0 or bit4 =1 mean registered*/
#define SPD_DIMM_TYPE_RDIMM 0x01
#define SPD_DIMM_TYPE_UDIMM 0x02
#define SPD_DIMM_TYPE_SODIMM 0x04
#define SPD_72B_SO_CDIMM 0x06
#define SPD_72B_SO_RDIMM 0x07
#define SPD_DIMM_TYPE_uDIMM 0x08
#define SPD_DIMM_TYPE_mRDIMM 0x10
#define SPD_DIMM_TYPE_mUDIMM 0x20
#define SPD_MOD_ATTRIB 21
#define SPD_MOD_ATTRIB_DIFCK 0x20
#define SPD_MOD_ATTRIB_REGADC 0x11 /* x */
#define SPD_MOD_ATTRIB_PROBE 0x40
#define SPD_DEV_ATTRIB 22 /* Device attributes --- general */
#define SPD_DIMM_CONF_TYPE 11
#define SPD_DIMM_CONF_TYPE_ECC 0x02
#define SPD_DIMM_CONF_TYPE_ADDR_PARITY 0x04 /* ? */
#define SPD_CAS_LAT_MIN_X_1 23
#define SPD_CAS_LAT_MAX_X_1 24
#define SPD_CAS_LAT_MIN_X_2 25
#define SPD_CAS_LAT_MAX_X_2 26
#define SPD_BURST_LENGTHS 16
#define SPD_BURST_LENGTHS_4 (1<<2)
#define SPD_BURST_LENGTHS_8 (1<<3)
#define SPD_ROW_NUM 3 /* Number of Row addresses */
#define SPD_COL_NUM 4 /* Number of Column addresses */
#define SPD_BANK_NUM 17 /* SDRAM Device attributes - Number of Banks on
SDRAM device, it could be 0x4, 0x8, so address
lines for that would be 2, and 3 */
/* Number of Ranks bit [2:0], Package (bit4, 1 = stack, 0 = planr), Height bit[7:5] */
#define SPD_MOD_ATTRIB_RANK 5
#define SPD_MOD_ATTRIB_RANK_NUM_SHIFT 0
#define SPD_MOD_ATTRIB_RANK_NUM_MASK 0x07
#define SPD_MOD_ATTRIB_RANK_NUM_BASE 1
#define SPD_MOD_ATTRIB_RANK_NUM_MIN 1
#define SPD_MOD_ATTRIB_RANK_NUM_MAX 8
#define SPD_RANK_SIZE 31 /* Only one bit is set */
#define SPD_RANK_SIZE_1GB (1<<0)
#define SPD_RANK_SIZE_2GB (1<<1)
#define SPD_RANK_SIZE_4GB (1<<2)
#define SPD_RANK_SIZE_8GB (1<<3)
#define SPD_RANK_SIZE_16GB (1<<4)
#define SPD_RANK_SIZE_128MB (1<<5)
#define SPD_RANK_SIZE_256MB (1<<6)
#define SPD_RANK_SIZE_512MB (1<<7)
#define SPD_DATA_WIDTH 6 /* valid value 0, 32, 33, 36, 64, 72, 80, 128, 144, 254, 255 */
#define SPD_PRI_WIDTH 13 /* Primary SDRAM Width, it could be 0x08 or 0x10 */
#define SPD_ERR_WIDTH 14 /* Error Checking SDRAM Width, it could be 0x08 or 0x10 */
#define SPD_CAS_LAT 18 /* SDRAM Device Attributes -- CAS Latency */
#define SPD_CAS_LAT_2 (1<<2)
#define SPD_CAS_LAT_3 (1<<3)
#define SPD_CAS_LAT_4 (1<<4)
#define SPD_CAS_LAT_5 (1<<5)
#define SPD_CAS_LAT_6 (1<<6)
#define SPD_CAS_LAT_7 (1<<7)
#define SPD_TRP 27 /* bit [7:2] = 1-63 ns, bit [1:0] 0.25ns+, final value ((val>>2) + (val & 3) * 0.25)ns */
#define SPD_TRRD 28
#define SPD_TRCD 29
#define SPD_TRAS 30
#define SPD_TWR 36 /* x */
#define SPD_TWTR 37 /* x */
#define SPD_TRTP 38 /* x */
#define SPD_EX_TRC_TRFC 40
#define SPD_TRC 41 /* add byte 0x40 bit [3:1] , so final val41+ table[((val40>>1) & 0x7)] ... table[]={0, 0.25, 0.33, 0.5, 0.75, 0, 0}*/
#define SPD_TRFC 42 /* add byte 0x40 bit [6:4] , so final val42+ table[((val40>>4) & 0x7)] + (val40 & 1)*256*/
#define SPD_TREF 12
|
/*============================================================================================
*
* (C) 2010, Phyton
*
* Демонстрационный проект для 1986BE91 testboard
*
* Данное ПО предоставляется "КАК ЕСТЬ", т.е. исключительно как пример, призванный облегчить
* пользователям разработку их приложений для процессоров Milandr 1986BE91T1. Компания Phyton
* не несет никакой ответственности за возможные последствия использования данного, или
* разработанного пользователем на его основе, ПО.
*
*--------------------------------------------------------------------------------------------
*
* Файл leds.c: Работа со светодиодами
*
*============================================================================================*/
#include <runtime/lib.h>
#include "leds.h"
#include "lcd.h"
#include "text.h"
#include "joystick.h"
#include "menu.h"
/* Маска включенных светодиодов */
unsigned CurrentLights;
/* Сервисные утилиты */
void InitPortLED(void) {
ARM_GPIOD->FUNC &= ~((0x3FF << (LED0_OFS << 1))); /* Port */
ARM_GPIOD->ANALOG |= LEDS_MASK; /* Digital */
ARM_GPIOD->PWR |= (0x155 << (LED0_OFS << 1)); /* Slow */
ARM_GPIOD->DATA &= ~LEDS_MASK;
ARM_GPIOD->OE |= LEDS_MASK;
}
void ShiftLights(void) {
unsigned ovf;
ARM_GPIOD->DATA = (ARM_GPIOD->DATA & ~LEDS_MASK) | (CurrentLights & LEDS_MASK);
ovf = (CurrentLights & (1UL << 31)) != 0;
CurrentLights <<= 1;
CurrentLights |= ovf;
}
/*============================================================================================
* Конец файла leds.c
*============================================================================================*/
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
namespace MCRuntimeLib
{
class ContextOpaque;
/**
* This class sets up a few instances and services. Currently it only
* provides a logger to the CThread functionality. If it never does
* more than this it can be removed.
*/
class Context
{
ContextOpaque* impl;
public:
Context();
virtual ~Context();
};
}
|
#include <kernel.h>
#include <input.h>
#include <devinput.h>
#include <ps2mouse.h>
#include <printf.h>
extern uint8_t ps2busy;
static uint8_t open;
static uint8_t fivebutton;
/* PS/2 mouse - rather simpler than the keyboardc */
#define SEND 0x100
#define FAIL 0x200
#define STOP 0xFFFF
static uint16_t mouse_init[] = {
SEND|0xFF,
FAIL|0xFA,
FAIL|0xAA,
FAIL|0x00,
SEND|0xF3,
STOP
};
static uint16_t mouse_scrolltest[] = {
SEND|0xF3, /* Set sample rate */
FAIL|0xFA, /* Magic handshake is to 200,100,80 */
SEND|0xC8,
FAIL|0xFA,
SEND|0xF3,
FAIL|0xFA,
SEND|0x64,
FAIL|0xFA,
SEND|0xF3,
FAIL|0xFA,
SEND|0x50,
FAIL|0xFA,
SEND|0xF2, /* Should now reply to get ID */
FAIL|0xFA,
FAIL|0x03, /* 0x03 is intellimouse protocol */
STOP
};
static uint16_t mouse_fivetest[] = {
SEND|0xF3, /* Set sample rate */
FAIL|0xFA, /* Magic handshake is to 200,200,80 */
SEND|0xC8,
FAIL|0xFA,
SEND|0xF3,
FAIL|0xFA,
SEND|0x64,
FAIL|0xFA,
SEND|0xF3,
FAIL|0xFA,
SEND|0x64,
FAIL|0xFA,
SEND|0xF2, /* Should now reply to get ID */
FAIL|0xFA,
FAIL|0x04, /* 0x04 is five button intellimouse protocol */
STOP
};
static uint16_t mouse_setup[] = {
FAIL|0xFA,
SEND|0xE6, /* Scaling 1:1 */
FAIL|0xFA,
SEND|0xF3, /* 10 samples a second */
FAIL|0xFA,
SEND|0x0A,
FAIL|0xFA,
STOP
};
static uint16_t mouse_open[] = {
SEND|0xF4,
FAIL|0xFA,
STOP
};
static uint16_t mouse_close[] = {
SEND|0xF5,
FAIL|0xFA,
STOP
};
/* One day we might want to handle FE/FC rules */
static int mouse_op(uint16_t *op)
{
uint8_t r;
ps2busy = 1;
while(*op != STOP) {
if (*op & SEND)
if (ps2mouse_put(*op)) {
ps2busy = 0;
return 0;
}
else {
r = ps2mouse_get();
if ((*op & FAIL) && r != (*op & 0xFF)) {
ps2busy = 0;
return 0;
}
}
op++;
}
ps2busy = 0;
return 1;
}
static uint8_t packet[4];
static uint8_t packc;
static uint8_t packsize = 4;
/* We received a 3 or 4 byte packet. Now process it
Fudge the movement slightly as the PS/2 mouse is 9bit */
static void ps2mouse_event(void)
{
static uint8_t event[4];
/* Event code and button bits */
event[0] = MOUSE_REL;
event[1] = packet[0] & 7;
event[1] = packet[1] >> 1; /* Scale down and add sign */
if (packet[0] & 0x10)
event[1] |= 0x80;
/* On a classic this byte is always 0 in our buffer so we do the
right thing */
event[2] = packet[2] >> 1;
if (packet[0] & 0x20)
event[2] |= 0x80;
event[3] = packet[3] << 5; /* Only 3 bits are used so scale up */
/* These bits may have other stuff in them on a non 5 button protocol
mouse so we check the type */
if (fivebutton)
event[1] |= (packet[3] & 0x18);
/* The rest is up to the platform */
platform_ps2mouse_event(event);
}
void ps2mouse_poll(void)
{
uint16_t r;
if (!open || ps2busy)
return;
r = ps2mouse_get();
if (r > 0xFF)
return;
packet[packc++] = r;
if (packc == packsize) {
ps2mouse_event();
packc = 0;
return;
}
}
uint8_t ps2mouse_open(void)
{
open = mouse_op(mouse_open);
packc = 0;
return open;
}
void ps2mouse_close(void)
{
open = 0;
mouse_op(mouse_close);
}
int ps2mouse_init(void)
{
uint8_t r;
uint8_t i;
uint8_t buttons = 5;
ps2busy = 1;
/* We may have FF or FF AA or FF AA 00 or other info queued before
our reset, if so empty it out */
for (i = 0; i < 4; i++) {
ps2mouse_get();
}
r = mouse_op(mouse_init);
if (r == 0)
return 0;
/* Intellimouse 4/5 button protocol */
fivebutton = mouse_op(mouse_fivetest);
/* Intellimouse protocol (scroll wheel) */
if (!fivebutton) {
buttons = 3;
if (!mouse_op(mouse_scrolltest))
/* PS/2 clasic */
packsize = 3;
}
/* Set up but don't enable reporting yet */
mouse_op(mouse_setup);
return 1;
}
|
/*
* Soft: Keepalived is a failover program for the LVS project
* <www.linuxvirtualserver.org>. It monitor & manipulate
* a loadbalanced server pool using multi-layer checks.
*
* Part: Timer manipulations.
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
* 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.
*
* 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.
*
* Copyright (C) 2001-2012 Alexandre Cassen, <acassen@linux-vs.org>
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "timer.h"
/* time_now holds current time */
timeval_t time_now = { tv_sec: 0, tv_usec: 0 };
/* set a timer to a specific value */
timeval_t
timer_dup(timeval_t b)
{
timeval_t a;
timer_reset(a);
a.tv_sec = b.tv_sec;
a.tv_usec = b.tv_usec;
return a;
}
/* timer compare */
int
timer_cmp(timeval_t a, timeval_t b)
{
if (a.tv_sec > b.tv_sec)
return 1;
if (a.tv_sec < b.tv_sec)
return -1;
if (a.tv_usec > b.tv_usec)
return 1;
if (a.tv_usec < b.tv_usec)
return -1;
return 0;
}
/* timer sub */
timeval_t
timer_sub(timeval_t a, timeval_t b)
{
timeval_t ret;
timer_reset(ret);
ret.tv_usec = a.tv_usec - b.tv_usec;
ret.tv_sec = a.tv_sec - b.tv_sec;
if (ret.tv_usec < 0) {
ret.tv_usec += TIMER_HZ;
ret.tv_sec--;
}
return ret;
}
/* timer add */
timeval_t
timer_add_long(timeval_t a, long b)
{
timeval_t ret;
timer_reset(ret);
ret.tv_usec = a.tv_usec + b % TIMER_HZ;
ret.tv_sec = a.tv_sec + b / TIMER_HZ;
if (ret.tv_usec >= TIMER_HZ) {
ret.tv_sec++;
ret.tv_usec -= TIMER_HZ;
}
return ret;
}
/* This function is a wrapper for gettimeofday(). It uses local storage to
* guarantee that the returned time will always be monotonic. If the time goes
* backwards, it returns the same as previous one and readjust its internal
* drift. If the time goes forward further than TIME_MAX_FORWARD_US
* microseconds since last call, it will bound it to that value. It is designed
* to be used as a drop-in replacement of gettimeofday(&now, NULL). It will
* normally return 0, unless <now> is NULL, in which case it will return -1 and
* set errno to EFAULT.
*/
int monotonic_gettimeofday(timeval_t *now)
{
static timeval_t mono_date;
static timeval_t drift; /* warning: signed seconds! */
timeval_t sys_date, adjusted, deadline;
if (!now) {
errno = EFAULT;
return -1;
}
gettimeofday(&sys_date, NULL);
/* on first call, we set mono_date to system date */
if (mono_date.tv_sec == 0) {
mono_date = sys_date;
drift.tv_sec = drift.tv_usec = 0;
*now = mono_date;
return 0;
}
/* compute new adjusted time by adding the drift offset */
adjusted.tv_sec = sys_date.tv_sec + drift.tv_sec;
adjusted.tv_usec = sys_date.tv_usec + drift.tv_usec;
if (adjusted.tv_usec >= TIMER_HZ) {
adjusted.tv_usec -= TIMER_HZ;
adjusted.tv_sec++;
}
/* check for jumps in the past, and bound to last date */
if (adjusted.tv_sec < mono_date.tv_sec ||
(adjusted.tv_sec == mono_date.tv_sec &&
adjusted.tv_usec < mono_date.tv_usec))
goto fixup;
/* check for jumps too far in the future, and bound them to
* TIME_MAX_FORWARD_US microseconds.
*/
deadline.tv_sec = mono_date.tv_sec + TIME_MAX_FORWARD_US / TIMER_HZ;
deadline.tv_usec = mono_date.tv_usec + TIME_MAX_FORWARD_US % TIMER_HZ;
if (deadline.tv_usec >= TIMER_HZ) {
deadline.tv_usec -= TIMER_HZ;
deadline.tv_sec++;
}
if (adjusted.tv_sec > deadline.tv_sec ||
(adjusted.tv_sec == deadline.tv_sec &&
adjusted.tv_usec >= deadline.tv_usec)) {
mono_date = deadline;
goto fixup;
}
/* adjusted date is correct */
mono_date = adjusted;
*now = mono_date;
return 0;
fixup:
/* Now we have to recompute the drift between sys_date and
* mono_date. Since it can be negative and we don't want to
* play with negative carries in all computations, we take
* care of always having the microseconds positive.
*/
drift.tv_sec = mono_date.tv_sec - sys_date.tv_sec;
drift.tv_usec = mono_date.tv_usec - sys_date.tv_usec;
if (drift.tv_usec < 0) {
drift.tv_usec += TIMER_HZ;
drift.tv_sec--;
}
*now = mono_date;
return 0;
}
/* current time */
timeval_t
timer_now(void)
{
timeval_t curr_time;
int old_errno = errno;
/* init timer */
timer_reset(curr_time);
monotonic_gettimeofday(&curr_time);
errno = old_errno;
return curr_time;
}
/* sets and returns current time from system time */
timeval_t
set_time_now(void)
{
int old_errno = errno;
/* init timer */
timer_reset(time_now);
monotonic_gettimeofday(&time_now);
errno = old_errno;
return time_now;
}
/* timer sub from current time */
timeval_t
timer_sub_now(timeval_t a)
{
return timer_sub(time_now, a);
}
/* print timer value */
void
timer_dump(timeval_t a)
{
unsigned long timer;
timer = a.tv_sec * TIMER_HZ + a.tv_usec;
printf("=> %lu (usecs)\n", timer);
}
unsigned long
timer_tol(timeval_t a)
{
unsigned long timer;
timer = a.tv_sec * TIMER_HZ + a.tv_usec;
return timer;
}
|
/*
# PostgreSQL Database Modeler (pgModeler)
#
# Copyright 2006-2015 - Raphael Araújo e Silva <raphael@pgmodeler.com.br>
#
# 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 3.
#
# 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.
#
# The complete text of GPLv3 is at LICENSE file on source code root directory.
# Also, you can get the complete GNU General Public License at <http://www.gnu.org/licenses/>
*/
/**
\ingroup libpgmodeler_ui
\class TextboxWidget
\brief Implements the operations to create/edit textboxes via form.
*/
#ifndef TEXTBOX_WIDGET_H
#define TEXTBOX_WIDGET_H
#include "ui_textboxwidget.h"
#include "baseobjectwidget.h"
class TextboxWidget: public BaseObjectWidget, public Ui::TextboxWidget {
private:
Q_OBJECT
void hideEvent(QHideEvent *event);
public:
TextboxWidget(QWidget * parent = 0);
void setAttributes(DatabaseModel *model, OperationList *op_list, Textbox *txtbox=nullptr, double obj_px=NAN, double obj_py=NAN);
private slots:
void selectTextColor(void);
public slots:
void applyConfiguration(void);
};
#endif
|
#ifndef HEADER_LIBPROBE_H
#define HEADER_LIBPROBE_H
#include <stdint.h>
#include "libdevs.h"
int probe_device_max_blocks(struct device *dev);
int probe_device(struct device *dev, uint64_t *preal_size_byte,
uint64_t *pannounced_size_byte, int *pwrap, int *block_order);
#endif /* HEADER_LIBPROBE_H */
|
#pragma once
#include "AnimHand.h"
#include "AnimBody.generated.h"
//NB: this is a limited class used only for leap anim, full class will have full body
UCLASS(ClassGroup = "Animation Skeleton", meta = (BlueprintSpawnableComponent))
class UAnimBody : public UActorComponent
{
GENERATED_UCLASS_BODY()
UPROPERTY(BlueprintReadWrite, Category = "Anim Body")
float Alpha;
//Hands
UPROPERTY(BlueprintReadOnly, Category = "Anim Body")
UAnimHand* Left;
UPROPERTY(BlueprintReadOnly, Category = "Anim Body")
UAnimHand* Right;
//Head
UPROPERTY(BlueprintReadOnly, Category = "Anim Body")
UAnimBone* Head;
UFUNCTION(BlueprintCallable, Category = "Anim Body")
bool Enabled();
UFUNCTION(BlueprintCallable, Category = "Anim Body")
void SetEnabled(bool enable = true);
UFUNCTION(BlueprintCallable, Category = "Anim Body")
void TranslateBody(FVector shift);
UFUNCTION(BlueprintCallable, Category = "Anim Body")
void ChangeBasis(FRotator PreBase, FRotator PostBase, bool adjustVectors = true);
}; |
#pragma once
#include "nn_act_enum.h"
#include "nn_act_types.h"
#include "nn/ipc/nn_ipc_command.h"
#include "nn/ipc/nn_ipc_service.h"
#include "nn/ipc/nn_ipc_managedbuffer.h"
#include <array>
#include <cstdint>
namespace nn::act::services
{
struct ClientStandardService : ipc::Service<0>
{
using GetCommonInfo =
ipc::Command<ClientStandardService, 1>
::Parameters<ipc::OutBuffer<void>, InfoType>;
using GetAccountInfo =
ipc::Command<ClientStandardService, 2>
::Parameters<SlotNo, ipc::OutBuffer<void>, InfoType>;
using GetTransferableId =
ipc::Command<ClientStandardService, 4>
::Parameters<SlotNo, uint32_t>
::Response<TransferrableId>;
using GetMiiImage =
ipc::Command<ClientStandardService, 6>
::Parameters<SlotNo, ipc::OutBuffer<void>, MiiImageType>
::Response<uint32_t>;
using GetUuid =
ipc::Command<ClientStandardService, 22>
::Parameters<SlotNo, ipc::OutBuffer<Uuid>, int32_t>;
using FindSlotNoByUuid =
ipc::Command<ClientStandardService, 23>
::Parameters<Uuid, int32_t>
::Response<uint8_t>;
};
} // namespace nn::act::services
|
/*
* PosixIPC.h
*
* Created on: 02-Jun-2009
* Author: William Davy
*/
#ifndef POSIXIPC_H_
#define POSIXIPC_H_
/* This file abstracts the Posix Messaging Queue to allow for Inter-Process Communication.
* The interface is designed to be event driven, ie when a message is received a process
* signal is fired which collects the data and passes it to a registered call back function.
*
* Type 'man mq_overview' on the command line to get more details.
*
* The limits on my system are (/proc/sys/fs/mqueue/):
* msg_max: 10 At most ten messages waiting in a queue.
* msgsize_max 8192 At most 8192 bytes per message.
* queues_max 256 At most 256 message queues.
*/
/**
* This is an example of Message object that is used for IPC.
*/
typedef struct MESSAGE_OBJECT
{
portCHAR cMesssageBytes[ 512 ];
} xMessageObject;
/**
* Opens a Posix Message Queue used for Inter-Process Communication.
* @param pcPipeName Pipe to open/create. Keep this string common between processes.
* @param vMessageInterruptHandler A call back function used when a message is received.
* @param pvContext A caller specifed context value that is passed to the callback function.
* @return A handle to the opened Posix Message Queue.
*/
mqd_t xPosixIPCOpen( const portCHAR *pcPipeName, void (*vMessageInterruptHandler)(xMessageObject,void*), void *pvContext );
/**
* Closes the specified Message Queue.
* @param hPipeHandle A handle to the pipe so it can be closed.
* @param pcPipeName The name of the pipe so that it can be unlinked and messages dumped.
*/
void vPosixIPCClose( mqd_t hPipeHandle, const portCHAR *pcPipeName );
/**
* Sends a messages to the specified pipe.
* @param hPipeHandle The handle to the pipe to send the message to.
* @param xMessage The message to write to the pipe.
* @return TRUE iff the message was successfully written to the queue. There is a limit
* on the maximum number of messages on the queue even if the total memory for the
* queue hasn't been exceeded. (See 'man mq_overview').
*/
portLONG lPosixIPCSendMessage( mqd_t hPipeHandle, xMessageObject xMessage );
/**
* Non-blocking call to receive a message from a message queue. This function can be
* used for polling the message queue. If a call back function was registered when the
* message queue was opened then this function doesn't need to be called.
* @param hPipeHandle A handle to the message queue to receive from.
* @param pxMessage A pointer to a message object that is set to the received message.
* @return TRUE iff a message of the correct number of bytes was received.
*/
portLONG lPosixIPCReceiveMessage( mqd_t hPipeHandle, xMessageObject *pxMessage );
/**
* Remove all of the messages already sent to a queue. Useful if there are outstanding
* messages since the last run of the application.
* @param hPipeHandle The handle to the pipe that needs to be emptied.
*/
void vPosixIPCEmpty( mqd_t hPipeHandle );
#endif /* POSIXIPC_H_ */
|
/*
* This program 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file GraphParameters.h
* \brief Interface file for CGraphParameters class
* \author Raja N
* \copyright Copyright (c) 2011, Robert Bosch Engineering and Business Solutions. All rights reserved.
*
* Interface file for CGraphParameters class
*/
#pragma once
typedef enum eDISPLAY_TYPE
{
eDISPLAY_NORMAL,
eDISPLAY_STEPMODE_XY,
eDISPLAY_STEPMODE_YX
};
class CGraphParameters
{
public:
// To serialize class members
void vInitialize(void);
UINT unGetConfigSize(BYTE byVersion);
int nSerialize(CArchive& omArchive);
BYTE* pbySetConfigData(BYTE* pbyTrgtData, BYTE byVersion);
BYTE* pbyGetConfigData(BYTE* pbyTrgtData, BYTE byVersion);
// PTV XML
void pbySetConfigData(xmlNodePtr& pNodePtr, xmlDocPtr pDocPtr);
void pbyGetConfigData(xmlNodePtr pNodePt, BYTE byVersion);
// PTV XML
// Default constructor and destructor.
CGraphParameters();
virtual ~CGraphParameters();
// Display perf conf.
// Buffer size
int m_nBufferSize;
// Display refresh rate
int m_nRefreshRate;
// View Style Configuration
// Frame Color
int m_nFrameColor;
// Frame Style
int m_nFrameStyle;
// Plot Area Color
int m_nPlotAreaColor;
// Grid Color
int m_nGridColor;
// Axis Color
int m_nAxisColor;
// X Grid Lines
int m_nXGridLines;
// Y Grid Lines
int m_nYGridLines;
// User Selected Active Axis
int m_nActiveAxis;
// User Selected Action
int m_nAction;
// Grid Setting
BOOL m_bShowGrid;
//Graph Line Display
eDISPLAY_TYPE m_eDisplayType;
};
|
/*
Cuckoo Sandbox - Automated Malware Analysis.
Copyright (C) 2015-2017 Cuckoo Foundation.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// This program demonstrates the case where malware closes all open handles
// therefore also closing our log pipe handle. We handle this by reopening
// the pipe handle. The logs for this analysis should show both MessageBoxA()
// calls or otherwise something is going wrong.
/// OBJECTS=
#include <stdio.h>
#include <stdint.h>
#include <windows.h>
int main()
{
MessageBox(NULL, "Hello World", "Before", 0);
// Just kill off all open handles in this process. Chances are this will
// break other stuff as well, but at the very least the pipe log handle
// will be closed as well.
for (uintptr_t idx = 0; idx < 10000; idx += 4) {
CloseHandle((HANDLE) idx);
}
MessageBox(NULL, "Hello World", "After", 0);
return 0;
}
|
// AdjMatrix.h
#pragma once
class AdjMatrix
{
public:
AdjMatrix();
~AdjMatrix();
void Init(int maze[10][10]);
int MinSteps();
private:
bool ai[100][100];
bool af[100][100];
void Link(int r, int c, int r2, int c2);
void Step();
};
|
/*
* @brief Definition of functions exported by ROM based USB device stack
*
* @note
* Copyright(C) NXP Semiconductors, 2012
* All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* LPC products. This software is supplied "AS IS" without any warranties of
* any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights under any
* patent, copyright, mask work right, or any other intellectual property rights in
* or to any products. NXP Semiconductors reserves the right to make changes
* in the software without notification. NXP Semiconductors also makes no
* representation or warranty that such application will be suitable for the
* specified use without further testing or modification.
*
* @par
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
*/
#ifndef __MW_USBD_ROM_API_H
#define __MW_USBD_ROM_API_H
#include "error.h"
#include "usbd.h"
#include "usbd_hw.h"
#include "usbd_core.h"
#include "usbd_mscuser.h"
#include "usbd_dfuuser.h"
#include "usbd_hiduser.h"
#include "usbd_cdcuser.h"
/** @brief Main USBD API functions structure.
* @ingroup Group_USBD
*
* This structure contains pointer to various USB Device stack's sub-module
* function tables. This structure is used as main entry point to access
* various methods (grouped in sub-modules) exposed by ROM based USB device
* stack.
*
*/
typedef struct USBD_API
{
const USBD_HW_API_T* hw; /**< Pointer to function table which exposes functions
which interact directly with USB device stack's core
layer.*/
const USBD_CORE_API_T* core; /**< Pointer to function table which exposes functions
which interact directly with USB device controller
hardware.*/
const USBD_MSC_API_T* msc; /**< Pointer to function table which exposes functions
provided by MSC function driver module.
*/
const USBD_DFU_API_T* dfu; /**< Pointer to function table which exposes functions
provided by DFU function driver module.
*/
const USBD_HID_API_T* hid; /**< Pointer to function table which exposes functions
provided by HID function driver module.
*/
const USBD_CDC_API_T* cdc; /**< Pointer to function table which exposes functions
provided by CDC-ACM function driver module.
*/
const uint32_t* reserved6; /**< Reserved for future function driver module.
*/
const uint32_t version; /**< Version identifier of USB ROM stack. The version is
defined as 0x0CHDMhCC where each nibble represnts version
number of the corresponding component.
CC - 7:0 - 8bit core version number
h - 11:8 - 4bit hardware interface version number
M - 15:12 - 4bit MSC class module version number
D - 19:16 - 4bit DFU class module version number
H - 23:20 - 4bit HID class module version number
C - 27:24 - 4bit CDC class module version number
H - 31:28 - 4bit reserved
*/
} USBD_API_T;
#define USBD_API (((USBD_API_T*)(ROM_USBD_PTR)))
extern USBD_HANDLE_T UsbHandle;
/* USBD core functions */
void UsbdRom_Init(uint8_t corenum);
void UsbdRom_IrqHandler(void);
/* USBD MSC functions */
void UsbdMsc_Init(void);
/* USBD HID functions */
void UsbdHid_Init(void);
/* USBD CDC functions */
void UsbdCdc_Init(void);
#endif /*__MW_USBD_ROM_API_H*/
|
#ifndef MEANSHIFT_H
#define MEANSHIFT_H
#include "meanshift_config.h"
#include "mfams.h"
#include "progress_observer.h"
#include <multi_img.h>
#ifdef WITH_SEG_FELZENSZWALB
#include <felzenszwalb.h>
#endif
#include <boost/make_shared.hpp>
namespace seg_meanshift {
class MeanShift {
public:
/** Result of MeanShift calculation.
*
* If the MeanShift calculation failed or was aborted, modes is empty.
*/
struct Result {
Result()
: labels(new cv::Mat1s()),
modes(new std::vector<multi_img::Pixel>())
{}
Result(const std::vector<multi_img::Pixel>& m,
const cv::Mat1s& l)
{ setModes(m); setLabels(l); }
// default copy and assignment OK
void setModes(const std::vector<multi_img::Pixel>& in) {
modes = boost::make_shared<std::vector<multi_img::Pixel> >(in);
}
void setLabels(const cv::Mat1s& in) {
labels = boost::make_shared<cv::Mat1s>(in);
}
void printModes() const {
if (modes->size() < 2) {
std::cout << "No modes found!" << std::endl;
return;
}
std::cout << modes->size() << " distinct modes found:" << std::endl;
for (size_t i = 0; i < modes->size(); ++i) {
multi_img::Pixel mode = modes->at(i);
for (size_t d = 0; d < mode.size(); ++d)
std::cout << mode[d] << "\t";
std::cout << std::endl;
}
}
boost::shared_ptr<cv::Mat1s> labels;
boost::shared_ptr<std::vector<multi_img::Pixel> > modes;
};
MeanShift(const MeanShiftConfig& config) : config(config) {}
KLResult findKL(const multi_img& input, ProgressObserver *po = 0);
Result execute(const multi_img& input, ProgressObserver *po = 0,
vector<double> *bandwidths = 0,
const multi_img& spinput = multi_img());
#ifdef WITH_SEG_FELZENSZWALB
static std::vector<FAMS::Point> prepare_sp_points(const FAMS &fams,
const seg_felzenszwalb::segmap &map);
static void cleanup_sp_points(std::vector<FAMS::Point> &points);
static cv::Mat1s segmentImageSP(const FAMS &fams, const cv::Mat1i &lookup);
#endif
// terrible hack superpixel sizes
std::vector<int> spsizes;
private:
const MeanShiftConfig &config;
};
}
#endif
|
/*
Copyright 2009 Marc Suñe Clos, Isaac Gelado
This file is part of the NetGPU framework.
The NetGPU framework 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.
The NetGPU framework 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 General_h
#define General_h
#include "../../../../Util.h"
//Macros used to create CONCATENATED names
#define _COMPOUND_NAME(PREFIX,NAME)\
PREFIX##_##NAME
#define COMPOUND_NAME(PREFIX,NAME)\
_COMPOUND_NAME(PREFIX,NAME)
/* GENERAL MACROS */
#define BUFFER_BLOCKS (MAX_BUFFER_PACKETS/ANALYSIS_TPB)
#define ARRAY_SIZE(type) \
(sizeof(type)*MAX_BUFFER_PACKETS)
#if HAS_WINDOW == 1
//Window special case
#define POS threadIdx.x + (state.blockIterator*blockDim.x)
#define RELATIVE_MINING_POS (threadIdx.x + ((state.blockIterator-state.windowState.blocksPreviouslyMined)*blockDim.x))
#else
#define POS threadIdx.x + (blockIdx.x*blockDim.x) //Absolute thread number
#endif
/* Packet inside buffer */
#if HAS_WINDOW == 1
#define PACKET (&GPU_buffer[RELATIVE_MINING_POS])
#else
#define PACKET (&GPU_buffer[POS])
#endif
/*GPU_data element */
#define DATA_ELEMENT GPU_data[POS]
/*GPU_results element */
#define RESULT_ELEMENT GPU_results[POS]
/* GETS HEADERS POINTER at level*/
#define GET_HEADER_POINTER(level) \
(((uint8_t*)&(PACKET->packet))+PACKET->headers.offset[level])
/*#define GET_HEADER_POINTER(level) \
(((PACKET->packet))+PACKET->headers.offset[level])*/
#define GET_HEADER_POINTERCHAR ((const u_char*) /*(uint8_t* )*/ &(PACKET->packet))
//#define GET_HEADER_POINTERCHAR ((const u_char*) /*(uint8_t* )*/ (PACKET->packet))
#define GET_HEADER_TCP_POINTER(level)\
PACKET->headers.offset[level]
//Gets field safely, to get disaligned fields
#define GET_FIELD(field) cudaNetworkToHost(cudaSafeGet(&(field))) //TODO: ENDIANISME ELIMINAR EL CUDANETWORKTOHOST
#define GET_FIELDNETWORK(field) cudaSafeGet(&(field)) //TODO: ENDIANISME ELIMINAR EL CUDANETWORKTOHOST
//* BARRIERS */
//Block barrier
#define SYNCTHREADS() __syncthreads()
//Predefined Analysis Barrier (syncblocks)
#ifndef DONT_EXPAND_SYNCBLOCKS
#define SYNCBLOCKS_PRECODED() } \
template<typename T,typename R>\
__global__ void COMPOUND_NAME(COMPOUND_NAME(ANALYSIS_NAME,PredefinedKernel),_PRECODED_COUNTER)(packet_t* GPU_buffer,T* GPU_data,R* GPU_results, analysisState_t state){\
do{}while(0)
#endif
//User Grid barrier
#ifndef DONT_EXPAND_SYNCBLOCKS
#define SYNCBLOCKS() } \
template<typename T,typename R>\
__device__ __inline__ void COMPOUND_NAME(COMPOUND_NAME(ANALYSIS_NAME,AnalysisExtraRoutine),__COUNTER__)(packet_t* GPU_buffer, T* GPU_data,R* GPU_results, analysisState_t state){\
do{}while(0)
#endif
/* HAS_REACHED_WINDOW_LIMIT MACRO */
#define IF_HAS_REACHED_WINDOW_LIMIT()\
if(state.windowState.hasReachedWindowLimit)
#endif //General_h
|
/* Copyright (c) 2012 Martin Ridgers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <Windows.h>
#include <stdio.h>
#include <wchar.h>
#include <sys/stat.h>
#include "hooks.h"
#define sizeof_array(x) (sizeof(x) / sizeof(x[0]))
//------------------------------------------------------------------------------
void (*g_alt_fwrite_hook)(wchar_t*) = NULL;
//------------------------------------------------------------------------------
int hooked_fwrite(const void* data, int size, int count, void* unused)
{
wchar_t buf[2048];
size_t characters;
DWORD written;
size *= count;
characters = MultiByteToWideChar(
CP_UTF8, 0,
(const char*)data, size,
buf, sizeof_array(buf)
);
characters = characters ? characters : sizeof_array(buf) - 1;
buf[characters] = L'\0';
if (g_alt_fwrite_hook)
{
g_alt_fwrite_hook(buf);
}
else
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsoleW(handle, buf, (DWORD)wcslen(buf), &written, NULL);
}
return size;
}
//------------------------------------------------------------------------------
void hooked_fprintf(const void* unused, const char* format, ...)
{
char buffer[2048];
va_list v;
va_start(v, format);
vsnprintf(buffer, sizeof_array(buffer), format, v);
va_end(v);
buffer[sizeof_array(buffer) - 1] = '\0';
hooked_fwrite(buffer, (int)strlen(buffer), 1, NULL);
}
//------------------------------------------------------------------------------
int hooked_putc(int c, void* unused)
{
char buf[2] = { (char)c, '\0' };
hooked_fwrite(buf, 1, 1, NULL);
return 1;
}
//------------------------------------------------------------------------------
size_t hooked_mbrtowc(wchar_t* out, const char* in, size_t size, mbstate_t* state)
{
wchar_t buffer[8];
if (size <= 0)
{
return 0;
}
MultiByteToWideChar(CP_UTF8, 0, in, 5, buffer, sizeof_array(buffer));
*out = buffer[0];
return (*out > 0) + (*out > 0x7f) + (*out > 0x7ff);
}
//------------------------------------------------------------------------------
size_t hooked_mbrlen(const char* in, size_t size, mbstate_t* state)
{
wchar_t t;
return hooked_mbrtowc(&t, in, size, NULL);
}
//------------------------------------------------------------------------------
int hooked_stat(const char* path, struct hooked_stat* out)
{
int ret = -1;
WIN32_FILE_ATTRIBUTE_DATA fad;
wchar_t buf[2048];
size_t characters;
// Utf8 to wchars.
characters = MultiByteToWideChar(
CP_UTF8, 0,
path, -1,
buf, sizeof_array(buf)
);
characters = characters ? characters : sizeof_array(buf) - 1;
buf[characters] = L'\0';
// Get properties.
out->st_size = 0;
out->st_mode = 0;
if (GetFileAttributesExW(buf, GetFileExInfoStandard, &fad) != 0)
{
unsigned dir_bit;
dir_bit = (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : 0;
out->st_size = fad.nFileSizeLow;
out->st_mode |= dir_bit;
ret = 0;
}
else
{
// Set errno...
}
return ret;
}
//------------------------------------------------------------------------------
int hooked_fstat(int fid, struct hooked_stat* out)
{
int ret;
struct stat s;
ret = fstat(fid, &s);
out->st_size = s.st_size;
out->st_mode = s.st_mode;
return ret;
}
//------------------------------------------------------------------------------
int hooked_wcwidth(wchar_t wc)
{
int width;
width = WideCharToMultiByte(
CP_ACP, 0,
&wc, 1,
NULL, 0,
NULL, NULL
);
return width;
}
|
/**
* This file is part of the "FnordMetric" project
* Copyright (c) 2014 Paul Asmuth, Google Inc.
*
* FnordMetric is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License v3.0. 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 _FNORDMETRIC_FFS_OBJECT_H
#define _FNORDMETRIC_FFS_OBJECT_H
namespace fnordmetric {
namespace ffs {
class Object {
friend class Volume;
public:
void incrRefcount();
void decrRefcount();
};
}
}
#endif
|
/**********************************************************************
* $Id: cpl_multiproc.h 20088 2010-07-17 20:41:29Z rouault $
*
* Project: CPL - Common Portability Library
* Purpose: CPL Multi-Threading, and process handling portability functions.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
**********************************************************************
* Copyright (c) 2002, Frank Warmerdam
*
* 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 _CPL_MULTIPROC_H_INCLUDED_
#define _CPL_MULTIPROC_H_INCLUDED_
#include "cpl_port.h"
/*
** There are three primary implementations of the multi-process support
** controlled by one of CPL_MULTIPROC_WIN32, CPL_MULTIPROC_PTHREAD or
** CPL_MULTIPROC_STUB being defined. If none are defined, the stub
** implementation will be used.
*/
#if defined(WIN32) && !defined(CPL_MULTIPROC_STUB)
# define CPL_MULTIPROC_WIN32
#endif
#if !defined(CPL_MULTIPROC_WIN32) && !defined(CPL_MULTIPROC_PTHREAD) \
&& !defined(CPL_MULTIPROC_STUB) && !defined(CPL_MULTIPROC_NONE)
# define CPL_MULTIPROC_STUB
#endif
CPL_C_START
typedef void (*CPLThreadFunc)(void *);
void CPL_DLL *CPLLockFile( const char *pszPath, double dfWaitInSeconds );
void CPL_DLL CPLUnlockFile( void *hLock );
void CPL_DLL *CPLCreateMutex();
int CPL_DLL CPLCreateOrAcquireMutex( void **, double dfWaitInSeconds );
int CPL_DLL CPLAcquireMutex( void *hMutex, double dfWaitInSeconds );
void CPL_DLL CPLReleaseMutex( void *hMutex );
void CPL_DLL CPLDestroyMutex( void *hMutex );
GIntBig CPL_DLL CPLGetPID();
int CPL_DLL CPLCreateThread( CPLThreadFunc pfnMain, void *pArg );
void CPL_DLL CPLSleep( double dfWaitInSeconds );
const char CPL_DLL *CPLGetThreadingModel();
CPL_C_END
#ifdef __cplusplus
#define CPLMutexHolderD(x) CPLMutexHolder oHolder(x,1000.0,__FILE__,__LINE__);
class CPL_DLL CPLMutexHolder
{
private:
void *hMutex;
const char *pszFile;
int nLine;
public:
CPLMutexHolder( void **phMutex, double dfWaitInSeconds = 1000.0,
const char *pszFile = __FILE__,
int nLine = __LINE__ );
~CPLMutexHolder();
};
#endif /* def __cplusplus */
/* -------------------------------------------------------------------- */
/* Thread local storage. */
/* -------------------------------------------------------------------- */
#define CTLS_RLBUFFERINFO 1 /* cpl_conv.cpp */
#define CTLS_DECDMSBUFFER 2 /* cpl_conv.cpp */
#define CTLS_CSVTABLEPTR 3 /* cpl_csv.cpp */
#define CTLS_CSVDEFAULTFILENAME 4 /* cpl_csv.cpp */
#define CTLS_ERRORCONTEXT 5 /* cpl_error.cpp */
#define CTLS_UNUSED1 6
#define CTLS_PATHBUF 7 /* cpl_path.cpp */
#define CTLS_SPRINTFBUF 8 /* cpl_string.cpp */
#define CTLS_SWQ_ERRBUF 9 /* swq.c */
#define CTLS_CPLSPRINTF 10 /* cpl_string.h */
#define CTLS_RESPONSIBLEPID 11 /* gdaldataset.cpp */
#define CTLS_VERSIONINFO 12 /* gdal_misc.cpp */
#define CTLS_VERSIONINFO_LICENCE 13 /* gdal_misc.cpp */
#define CTLS_CONFIGOPTIONS 14 /* cpl_conv.cpp */
#define CTLS_FINDFILE 15 /* cpl_findfile.cpp */
#define CTLS_MAX 32
CPL_C_START
void CPL_DLL * CPLGetTLS( int nIndex );
void CPL_DLL CPLSetTLS( int nIndex, void *pData, int bFreeOnExit );
/* Warning : the CPLTLSFreeFunc must not in any case directly or indirectly */
/* use or fetch any TLS data, or a terminating thread will hang ! */
typedef void (*CPLTLSFreeFunc)( void* pData );
void CPL_DLL CPLSetTLSWithFreeFunc( int nIndex, void *pData, CPLTLSFreeFunc pfnFree );
void CPL_DLL CPLCleanupTLS();
CPL_C_END
#endif /* _CPL_MULTIPROC_H_INCLUDED_ */
|
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_UNPROJECT_H
#define IGL_UNPROJECT_H
#include "igl_inline.h"
#include <Eigen/Core>
namespace igl
{
// Eigen reimplementation of gluUnproject
//
// Inputs:
// win #P by 3 or 3-vector (#P=1) of screen space x, y, and z coordinates
// model 4x4 model-view matrix
// proj 4x4 projection matrix
// viewport 4-long viewport vector
// Outputs:
// scene #P by 3 or 3-vector (#P=1) the unprojected x, y, and z coordinates
template <
typename Derivedwin,
typename Derivedmodel,
typename Derivedproj,
typename Derivedviewport,
typename Derivedscene>
IGL_INLINE void unproject(
const Eigen::MatrixBase<Derivedwin>& win,
const Eigen::MatrixBase<Derivedmodel>& model,
const Eigen::MatrixBase<Derivedproj>& proj,
const Eigen::MatrixBase<Derivedviewport>& viewport,
Eigen::PlainObjectBase<Derivedscene> & scene);
template <typename Scalar>
IGL_INLINE Eigen::Matrix<Scalar,3,1> unproject(
const Eigen::Matrix<Scalar,3,1>& win,
const Eigen::Matrix<Scalar,4,4>& model,
const Eigen::Matrix<Scalar,4,4>& proj,
const Eigen::Matrix<Scalar,4,1>& viewport);
}
#ifndef IGL_STATIC_LIBRARY
# include "unproject.cpp"
#endif
#endif
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* mx-item-view.h: MxGrid powered by a model
*
* Copyright 2009 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser 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.
* Boston, MA 02111-1307, USA.
*
* Written by: Thomas Wood <thomas.wood@intel.com>
*
*/
#if !defined(MX_H_INSIDE) && !defined(MX_COMPILATION)
#error "Only <mx/mx.h> can be included directly.h"
#endif
#ifndef _MX_ITEM_VIEW_H
#define _MX_ITEM_VIEW_H
#include <glib-object.h>
#include "mx-grid.h"
#include "mx-item-factory.h"
G_BEGIN_DECLS
#define MX_TYPE_ITEM_VIEW mx_item_view_get_type()
#define MX_ITEM_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MX_TYPE_ITEM_VIEW, MxItemView))
#define MX_ITEM_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
MX_TYPE_ITEM_VIEW, MxItemViewClass))
#define MX_IS_ITEM_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
MX_TYPE_ITEM_VIEW))
#define MX_IS_ITEM_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
MX_TYPE_ITEM_VIEW))
#define MX_ITEM_VIEW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
MX_TYPE_ITEM_VIEW, MxItemViewClass))
typedef struct _MxItemViewPrivate MxItemViewPrivate;
/**
* MxItemView:
*
* The contents of the this structure are private and should only be accessed
* through the public API.
*/
typedef struct {
/*< private >*/
MxGrid parent;
MxItemViewPrivate *priv;
} MxItemView;
typedef struct {
MxGridClass parent_class;
/* padding for future expansion */
void (*_padding_0) (void);
void (*_padding_1) (void);
void (*_padding_2) (void);
void (*_padding_3) (void);
void (*_padding_4) (void);
} MxItemViewClass;
GType mx_item_view_get_type (void);
ClutterActor *mx_item_view_new (void);
void mx_item_view_set_model (MxItemView *item_view,
ClutterModel *model);
ClutterModel* mx_item_view_get_model (MxItemView *item_view);
void mx_item_view_set_item_type (MxItemView *item_view,
GType item_type);
GType mx_item_view_get_item_type (MxItemView *item_view);
void mx_item_view_add_attribute (MxItemView *item_view,
const gchar *attribute,
gint column);
void mx_item_view_freeze (MxItemView *item_view);
void mx_item_view_thaw (MxItemView *item_view);
void mx_item_view_set_factory (MxItemView *item_view,
MxItemFactory *factory);
MxItemFactory* mx_item_view_get_factory (MxItemView *item_view);
G_END_DECLS
#endif /* _MX_ITEM_VIEW_H */
|
/*
* Copyright (c) 2008-2010, 2012, 2013 Wind River Systems; see
* guts/COPYRIGHT for information.
*
* static int
* wrap_link(const char *oldname, const char *newname) {
* int rc = -1;
*/
/* since 2.6.18 or so, linkat supports AT_SYMLINK_FOLLOW, which
* provides the behavior link() has on most non-Linux systems,
* but the default is not to follow symlinks. Better yet, it
* does NOT support AT_SYMLINK_NOFOLLOW! So define this in
* your port's portdefs.h or hope the default works for you.
*/
rc = wrap_linkat(AT_FDCWD, oldname, AT_FDCWD, newname,
PSEUDO_LINK_SYMLINK_BEHAVIOR);
/* return rc;
* }
*/
|
#include "common_basic2extended.h"
int test_defaultmatrix(const char*name, uint32_t rows, uint32_t cols, ambix_matrixtype_t mtyp,
uint32_t xtrachannels, uint32_t chunksize, float32_t eps) {
int result=0;
ambix_matrix_t*mtx=0;
STARTTEST("%s\n", name);
mtx=ambix_matrix_init(rows,cols,mtx);
if(!mtx)return 1;
ambix_matrix_fill(mtx, mtyp);
result=check_create_b2e(FILENAME_FILE, AMBIX_SAMPLEFORMAT_PCM16,
mtx,xtrachannels,
chunksize, FLOAT32, eps);
ambix_matrix_destroy(mtx);
return result;
}
int main(int argc, char**argv) {
int err=0;
err+=test_defaultmatrix("SID" , 4, 4, AMBIX_MATRIX_SID , 0, 1024, 4e-5);
return pass();
}
|
#include "../../../../../src/designer/src/lib/shared/shared_settings_p.h"
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/colourdata.h
// Author: Julian Smart
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLOURDATA_H_
#define _WX_COLOURDATA_H_
#include "wx/colour.h"
class WXDLLIMPEXP_CORE wxColourData : public wxObject
{
public:
// number of custom colours we store
enum
{
NUM_CUSTOM = 16
};
wxColourData();
wxColourData(const wxColourData& data);
wxColourData& operator=(const wxColourData& data);
virtual ~wxColourData();
void SetChooseFull(bool flag) { m_chooseFull = flag; }
bool GetChooseFull() const { return m_chooseFull; }
void SetColour(const wxColour& colour) { m_dataColour = colour; }
const wxColour& GetColour() const { return m_dataColour; }
wxColour& GetColour() { return m_dataColour; }
// SetCustomColour() modifies colours in an internal array of NUM_CUSTOM
// custom colours;
void SetCustomColour(int i, const wxColour& colour);
wxColour GetCustomColour(int i) const;
// Serialize the object to a string and restore it from it
wxString ToString() const;
bool FromString(const wxString& str);
// public for backwards compatibility only: don't use directly
wxColour m_dataColour;
wxColour m_custColours[NUM_CUSTOM];
bool m_chooseFull;
DECLARE_DYNAMIC_CLASS(wxColourData)
};
#endif // _WX_COLOURDATA_H_
|
/* =========================================================================
* This file is part of NITRO
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* NITRO 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, If not,
* see <http://www.gnu.org/licenses/>.
*
*/
#if !defined(WIN32)
#include "nrt/DLL.h"
NRTAPI(nrt_DLL *) nrt_DLL_construct(nrt_Error * error)
{
nrt_DLL *dll = (nrt_DLL *) NRT_MALLOC(sizeof(nrt_DLL));
if (!dll)
{
nrt_Error_init(error, NRT_STRERROR(NRT_ERRNO), NRT_CTXT,
NRT_ERR_MEMORY);
}
dll->libname = NULL;
dll->lib = NULL;
return dll;
}
NRTAPI(void) nrt_DLL_destruct(nrt_DLL ** dll)
{
nrt_Error error;
if (*dll)
{
/* destroy the lib */
nrt_DLL_unload((*dll), &error);
if ((*dll)->libname)
{
NRT_FREE((*dll)->libname);
(*dll)->libname = NULL;
}
NRT_FREE(*dll);
*dll = NULL;
}
}
NRTAPI(NRT_BOOL) nrt_DLL_isValid(nrt_DLL * dll)
{
return (dll->lib != (NRT_NATIVE_DLL) NULL);
}
NRTAPI(NRT_BOOL) nrt_DLL_load(nrt_DLL * dll, const char *libname,
nrt_Error * error)
{
dll->libname = (char *) NRT_MALLOC(strlen(libname) + 1);
if (!dll->libname)
{
nrt_Error_init(error, NRT_STRERROR(NRT_ERRNO), NRT_CTXT,
NRT_ERR_MEMORY);
return NRT_FAILURE;
}
strcpy(dll->libname, libname);
dll->lib = dlopen(libname, RTLD_LAZY);
if (!dll->lib)
{
nrt_Error_init(error, dlerror(), NRT_CTXT, NRT_ERR_LOADING_DLL);
NRT_FREE(dll->libname);
dll->libname = NULL;
return NRT_FAILURE;
}
return NRT_SUCCESS;
}
NRTAPI(NRT_BOOL) nrt_DLL_unload(nrt_DLL * dll, nrt_Error * error)
{
if (dll->lib)
{
assert(dll->libname);
NRT_FREE(dll->libname);
dll->libname = NULL;
if (dlclose(dll->lib) != 0)
{
nrt_Error_init(error, dlerror(), NRT_CTXT, NRT_ERR_UNLOADING_DLL);
return NRT_FAILURE;
}
dll->lib = NULL;
}
return NRT_SUCCESS;
}
NRTAPI(NRT_DLL_FUNCTION_PTR) nrt_DLL_retrieve(nrt_DLL * dll,
const char *function,
nrt_Error * error)
{
if (dll->lib)
{
NRT_DLL_FUNCTION_PTR ptr = dlsym(dll->lib, function);
if (ptr == (NRT_DLL_FUNCTION_PTR) NULL)
{
/* Problem if you couldnt produce the function */
nrt_Error_init(error, dlerror(), NRT_CTXT,
NRT_ERR_RETRIEVING_DLL_HOOK);
}
return ptr;
}
/* You shouldnt be calling it if it didnt load */
nrt_Error_init(error, dlerror(), NRT_CTXT, NRT_ERR_UNINITIALIZED_DLL_READ);
return (NRT_DLL_FUNCTION_PTR) NULL;
}
#endif
|
#ifndef INCLUDED_openfl_display_FrameLabel
#define INCLUDED_openfl_display_FrameLabel
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
#include <openfl/_v2/events/EventDispatcher.h>
HX_DECLARE_CLASS3(openfl,_v2,events,EventDispatcher)
HX_DECLARE_CLASS3(openfl,_v2,events,IEventDispatcher)
HX_DECLARE_CLASS2(openfl,display,FrameLabel)
namespace openfl{
namespace display{
class HXCPP_CLASS_ATTRIBUTES FrameLabel_obj : public ::openfl::_v2::events::EventDispatcher_obj{
public:
typedef ::openfl::_v2::events::EventDispatcher_obj super;
typedef FrameLabel_obj OBJ_;
FrameLabel_obj();
Void __construct(::String name,int frame);
public:
inline void *operator new( size_t inSize, bool inContainer=true)
{ return hx::Object::operator new(inSize,inContainer); }
static hx::ObjectPtr< FrameLabel_obj > __new(::String name,int frame);
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~FrameLabel_obj();
HX_DO_RTTI;
static void __boot();
static void __register();
void __Mark(HX_MARK_PARAMS);
void __Visit(HX_VISIT_PARAMS);
::String __ToString() const { return HX_CSTRING("FrameLabel"); }
int frame;
::String name;
int __frame;
::String __name;
virtual int get_frame( );
Dynamic get_frame_dyn();
virtual ::String get_name( );
Dynamic get_name_dyn();
};
} // end namespace openfl
} // end namespace display
#endif /* INCLUDED_openfl_display_FrameLabel */
|
//
// LGAutoPkgIntegrationView.h
// AutoPkgr
//
// Created by Eldon Ahrold on 6/8/15.
// Copyright 2015 The Linde Group, Inc.
//
// 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 "LGBaseIntegrationViewController.h"
@interface LGAutoPkgIntegrationView : LGBaseIntegrationViewController
@end
|
/******************************************************************************
* Copyright 2020 The Apollo Authors. 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.
*****************************************************************************/
#pragma once
#include <algorithm>
#include <cmath>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "Eigen/Eigen"
// Eigen 3.3.7: #define ALIVE (0)
// fastrtps: enum ChangeKind_t { ALIVE, ... };
#if defined(ALIVE)
#undef ALIVE
#endif
#include "ATen/ATen.h"
#include "torch/torch.h"
#include "cyber/cyber.h"
#include "modules/common/proto/geometry.pb.h"
namespace apollo {
namespace audio {
using apollo::common::Point3D;
class DirectionDetection {
public:
DirectionDetection();
~DirectionDetection();
// Estimates the position of the source of the sound
std::pair<Point3D, double> EstimateSoundSource(
std::vector<std::vector<double>>&& channels_vec,
const std::string& respeaker_extrinsic_file,
const int sample_rate, const double mic_distance);
private:
const double kSoundSpeed = 343.2;
const int kDistance = 50;
std::unique_ptr<Eigen::Matrix4d> respeaker2imu_ptr_;
// Estimates the direction of the source of the sound
double EstimateDirection(std::vector<std::vector<double>>&& channels_vec,
const int sample_rate, const double mic_distance);
bool LoadExtrinsics(const std::string& yaml_file,
Eigen::Matrix4d* respeaker_extrinsic);
// Computes the offset between the signal sig and the reference signal refsig
// using the Generalized Cross Correlation - Phase Transform (GCC-PHAT)method.
double GccPhat(const torch::Tensor& sig, const torch::Tensor& refsig, int fs,
double max_tau, int interp);
// Libtorch does not support Complex type currently.
void ConjugateTensor(torch::Tensor* tensor);
torch::Tensor ComplexMultiply(const torch::Tensor& a, const torch::Tensor& b);
torch::Tensor ComplexAbsolute(const torch::Tensor& tensor);
};
} // namespace audio
} // namespace apollo
|
/******************************************************************************
* $Id: aigrid.h 33901 2016-04-06 16:31:31Z goatbar $
*
* Project: Arc/Info Binary Grid Translator
* Purpose: Grid file access include file.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* 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 AIGRID_H_INCLUDED
#define AIGRID_H_INCLUDED
#include "cpl_conv.h"
CPL_C_START
#define ESRI_GRID_NO_DATA -2147483647
/*#define ESRI_GRID_FLOAT_NO_DATA -340282306073709652508363335590014353408.0 */
#define ESRI_GRID_FLOAT_NO_DATA -340282346638528859811704183484516925440.0
/* ==================================================================== */
/* Grid Instance */
/* ==================================================================== */
typedef struct {
int nBlocks;
GUInt32 *panBlockOffset;
int *panBlockSize;
VSILFILE *fpGrid; // The w001001.adf file.
int bTriedToLoad;
} AIGTileInfo;
typedef struct {
/* Private information */
AIGTileInfo *pasTileInfo;
int bHasWarned;
/* public information */
char *pszCoverName; // Path of coverage directory.
GInt32 nCellType;
GInt32 bCompressed;
#define AIG_CELLTYPE_INT 1
#define AIG_CELLTYPE_FLOAT 2
GInt32 nBlockXSize;
GInt32 nBlockYSize;
GInt32 nBlocksPerRow;
GInt32 nBlocksPerColumn;
int nTileXSize;
int nTileYSize;
int nTilesPerRow;
int nTilesPerColumn;
double dfLLX;
double dfLLY;
double dfURX;
double dfURY;
double dfCellSizeX;
double dfCellSizeY;
int nPixels;
int nLines;
double dfMin;
double dfMax;
double dfMean;
double dfStdDev;
} AIGInfo_t;
/* ==================================================================== */
/* Private APIs */
/* ==================================================================== */
CPLErr AIGAccessTile( AIGInfo_t *psInfo, int iTileX, int iTileY );
CPLErr AIGReadBlock( VSILFILE * fp, GUInt32 nBlockOffset, int nBlockSize,
int nBlockXSize, int nBlockYSize, GInt32 * panData,
int nCellType, int bCompressed );
CPLErr AIGReadHeader( const char *, AIGInfo_t * );
CPLErr AIGReadBlockIndex( AIGInfo_t *, AIGTileInfo *,
const char *pszBasename );
CPLErr AIGReadBounds( const char *, AIGInfo_t * );
CPLErr AIGReadStatistics( const char *, AIGInfo_t * );
CPLErr DecompressCCITTRLETile( unsigned char *pabySrcData, int nSrcBytes,
unsigned char *pabyDstData, int nDstBytes,
int nBlockXSize, int nBlockYSize );
/* ==================================================================== */
/* Public APIs */
/* ==================================================================== */
AIGInfo_t *AIGOpen( const char *, const char * );
CPLErr AIGReadTile( AIGInfo_t *, int, int, GInt32 * );
CPLErr AIGReadFloatTile( AIGInfo_t *, int, int, float * );
void AIGClose( AIGInfo_t * );
VSILFILE *AIGLLOpen( const char *, const char * );
CPL_C_END
#endif /* ndef AIGRID_H_INCLUDED */
|
/*
* Copyright (c) 2016 Cisco and/or its affiliates.
* 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.
*/
#include <vnet/vnet.h>
#include <vnet/mfib/mfib_signal.h>
#include <vppinfra/dlist.h>
/**
* @brief Pool of signals
*/
static mfib_signal_t *mfib_signal_pool;
/**
* @brief pool of dlist elements
*/
static dlist_elt_t *mfib_signal_dlist_pool;
/**
* the list/set of interfaces with signals pending
*/
typedef struct mfib_signal_q_t_
{
/**
* the dlist indext that is the head of the list
*/
u32 mip_head;
/**
* Spin lock to protect the list
*/
int mip_lock;
} mfib_signal_q_t;
/**
* @brief The pending queue of signals to deliver to the control plane
*/
static mfib_signal_q_t mfib_signal_pending ;
static void
mfib_signal_list_init (void)
{
dlist_elt_t *head;
u32 hi;
pool_get(mfib_signal_dlist_pool, head);
hi = head - mfib_signal_dlist_pool;
mfib_signal_pending.mip_head = hi;
clib_dlist_init(mfib_signal_dlist_pool, hi);
}
void
mfib_signal_module_init (void)
{
mfib_signal_list_init();
}
static inline void
mfib_signal_lock_aquire (void)
{
while (clib_atomic_test_and_set (&mfib_signal_pending.mip_lock))
;
}
static inline void
mfib_signal_lock_release (void)
{
clib_atomic_release(&mfib_signal_pending.mip_lock);
}
#define MFIB_SIGNAL_CRITICAL_SECTION(_body) \
{ \
mfib_signal_lock_aquire(); \
do { \
_body; \
} while (0); \
mfib_signal_lock_release(); \
}
int
mfib_signal_send_one (struct vl_api_registration_ *reg,
u32 context)
{
u32 li, si;
/*
* with the lock held, pop a signal from the q.
*/
MFIB_SIGNAL_CRITICAL_SECTION(
({
li = clib_dlist_remove_head(mfib_signal_dlist_pool,
mfib_signal_pending.mip_head);
}));
if (~0 != li)
{
mfib_signal_t *mfs;
mfib_itf_t *mfi;
dlist_elt_t *elt;
elt = pool_elt_at_index(mfib_signal_dlist_pool, li);
si = elt->value;
mfs = pool_elt_at_index(mfib_signal_pool, si);
mfi = mfib_itf_get(mfs->mfs_itf);
mfi->mfi_si = INDEX_INVALID;
clib_atomic_fetch_and(&mfi->mfi_flags,
~MFIB_ITF_FLAG_SIGNAL_PRESENT);
vl_mfib_signal_send_one(reg, context, mfs);
/*
* with the lock held, return the resoruces of the signals posted
*/
MFIB_SIGNAL_CRITICAL_SECTION(
({
pool_put_index(mfib_signal_pool, si);
pool_put_index(mfib_signal_dlist_pool, li);
}));
return (1);
}
return (0);
}
void
mfib_signal_push (const mfib_entry_t *mfe,
mfib_itf_t *mfi,
vlib_buffer_t *b0)
{
mfib_signal_t *mfs;
dlist_elt_t *elt;
u32 si, li;
MFIB_SIGNAL_CRITICAL_SECTION(
({
pool_get(mfib_signal_pool, mfs);
pool_get(mfib_signal_dlist_pool, elt);
si = mfs - mfib_signal_pool;
li = elt - mfib_signal_dlist_pool;
elt->value = si;
mfi->mfi_si = li;
clib_dlist_addhead(mfib_signal_dlist_pool,
mfib_signal_pending.mip_head,
li);
}));
mfs->mfs_entry = mfib_entry_get_index(mfe);
mfs->mfs_itf = mfib_itf_get_index(mfi);
if (NULL != b0)
{
mfs->mfs_buffer_len = b0->current_length;
memcpy(mfs->mfs_buffer,
vlib_buffer_get_current(b0),
(mfs->mfs_buffer_len > MFIB_SIGNAL_BUFFER_SIZE ?
MFIB_SIGNAL_BUFFER_SIZE :
mfs->mfs_buffer_len));
}
else
{
mfs->mfs_buffer_len = 0;
}
}
void
mfib_signal_remove_itf (const mfib_itf_t *mfi)
{
u32 li;
/*
* lock the queue to prevent further additions while we fiddle.
*/
li = mfi->mfi_si;
if (INDEX_INVALID != li)
{
/*
* it's in the pending q
*/
MFIB_SIGNAL_CRITICAL_SECTION(
({
dlist_elt_t *elt;
/*
* with the lock held;
* - remove the signal from the pending list
* - free up the signal and list entry obejcts
*/
clib_dlist_remove(mfib_signal_dlist_pool, li);
elt = pool_elt_at_index(mfib_signal_dlist_pool, li);
pool_put_index(mfib_signal_pool, elt->value);
pool_put(mfib_signal_dlist_pool, elt);
}));
}
}
|
/******************************************************************************
*
* Project: KML Translator
* Purpose: Implements OGRLIBKMLDriver
* Author: Brian Case, rush at winkey dot org
*
******************************************************************************
* Copyright (c) 2010, Brian Case
* Copyright (c) 2014, Even Rouault <even dot rouault at mines-paris dot org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
using kmldom::SimpleFieldPtr;
using kmldom::SchemaPtr;
using kmldom::KmlFactory;
using kmldom::FeaturePtr;
using kmldom::PlacemarkPtr;
/******************************************************************************
function to output ogr fields in kml
args:
poOgrFeat pointer to the feature the field is in
poOgrLayer pointer to the layer the feature is in
poKmlFactory pointer to the libkml dom factory
poKmlPlacemark pointer to the placemark to add to
returns:
nothing
env vars:
LIBKML_TIMESTAMP_FIELD default: OFTDate or OFTDateTime named timestamp
LIBKML_TIMESPAN_BEGIN_FIELD default: OFTDate or OFTDateTime named begin
LIBKML_TIMESPAN_END_FIELD default: OFTDate or OFTDateTime named end
LIBKML_DESCRIPTION_FIELD default: none
LIBKML_NAME_FIELD default: OFTString field named name
******************************************************************************/
void field2kml (
OGRFeature * poOgrFeat,
OGRLIBKMLLayer * poOgrLayer,
KmlFactory * poKmlFactory,
FeaturePtr poKmlPlacemark,
int bUseSimpleField );
/******************************************************************************
function to read kml into ogr fields
******************************************************************************/
void kml2field (
OGRFeature * poOgrFeat,
FeaturePtr poKmlFeature );
/******************************************************************************
function create a simplefield from a FieldDefn
******************************************************************************/
SimpleFieldPtr FieldDef2kml (
OGRFieldDefn *poOgrFieldDef,
KmlFactory * poKmlFactory );
/******************************************************************************
function to add the simpleFields in a schema to a featuredefn
******************************************************************************/
void kml2FeatureDef (
SchemaPtr poKmlSchema,
OGRFeatureDefn *poOgrFeatureDefn);
/*******************************************************************************
* function to fetch the field config options
*
*******************************************************************************/
struct fieldconfig {
const char *namefield;
const char *descfield;
const char *tsfield;
const char *beginfield;
const char *endfield;
const char *altitudeModefield;
const char *tessellatefield;
const char *extrudefield;
const char *visibilityfield;
const char *drawOrderfield;
const char *iconfield;
const char *headingfield;
const char *tiltfield;
const char *rollfield;
const char *snippetfield;
const char *modelfield;
const char *scalexfield;
const char *scaleyfield;
const char *scalezfield;
const char *networklinkfield;
const char *networklink_refreshvisibility_field;
const char *networklink_flytoview_field;
const char *networklink_refreshMode_field;
const char *networklink_refreshInterval_field;
const char *networklink_viewRefreshMode_field;
const char *networklink_viewRefreshTime_field;
const char *networklink_viewBoundScale_field;
const char *networklink_viewFormat_field;
const char *networklink_httpQuery_field;
const char *camera_longitude_field;
const char *camera_latitude_field;
const char *camera_altitude_field;
const char *camera_altitudemode_field;
const char *photooverlayfield;
const char *leftfovfield;
const char *rightfovfield;
const char *bottomfovfield;
const char *topfovfield;
const char *nearfield;
const char *photooverlay_shape_field;
const char *imagepyramid_tilesize_field;
const char *imagepyramid_maxwidth_field;
const char *imagepyramid_maxheight_field;
const char *imagepyramid_gridorigin_field;
};
void get_fieldconfig( struct fieldconfig *oFC );
int kmlAltitudeModeFromString(const char* pszAltitudeMode,
int& isGX);
|
/** @file
A brief file description
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/****************************************************************************
Async Disk IO operations.
****************************************************************************/
#pragma once
#include "P_EventSystem.h"
#include "I_AIO.h"
// for debugging
// #define AIO_STATS 1
static constexpr ts::ModuleVersion AIO_MODULE_INTERNAL_VERSION{AIO_MODULE_PUBLIC_VERSION, ts::ModuleVersion::PRIVATE};
TS_INLINE int
AIOCallback::ok()
{
return (off_t)aiocb.aio_nbytes == (off_t)aio_result;
}
extern Continuation *aio_err_callbck;
#if AIO_MODE == AIO_MODE_NATIVE
struct AIOCallbackInternal : public AIOCallback {
int io_complete(int event, void *data);
AIOCallbackInternal()
{
memset((void *)&(this->aiocb), 0, sizeof(this->aiocb));
SET_HANDLER(&AIOCallbackInternal::io_complete);
}
};
TS_INLINE int
AIOVec::mainEvent(int /* event */, Event *)
{
++completed;
if (completed < size)
return EVENT_CONT;
else if (completed == size) {
SCOPED_MUTEX_LOCK(lock, action.mutex, this_ethread());
if (!action.cancelled)
action.continuation->handleEvent(AIO_EVENT_DONE, first);
delete this;
return EVENT_DONE;
}
ink_assert(!"AIOVec mainEvent err");
return EVENT_ERROR;
}
#else /* AIO_MODE != AIO_MODE_NATIVE */
struct AIO_Reqs;
struct AIOCallbackInternal : public AIOCallback {
AIO_Reqs *aio_req = nullptr;
ink_hrtime sleep_time = 0;
SLINK(AIOCallbackInternal, alink); /* for AIO_Reqs::aio_temp_list */
int io_complete(int event, void *data);
AIOCallbackInternal() { SET_HANDLER(&AIOCallbackInternal::io_complete); }
};
struct AIO_Reqs {
Que(AIOCallback, link) aio_todo; /* queue for AIO operations */
/* Atomic list to temporarily hold the request if the
lock for a particular queue cannot be acquired */
ASLL(AIOCallbackInternal, alink) aio_temp_list;
ink_mutex aio_mutex;
ink_cond aio_cond;
int index = 0; /* position of this struct in the aio_reqs array */
int pending = 0; /* number of outstanding requests on the disk */
int queued = 0; /* total number of aio_todo requests */
int filedes = 0; /* the file descriptor for the requests */
int requests_queued = 0;
};
#endif // AIO_MODE == AIO_MODE_NATIVE
TS_INLINE int
AIOCallbackInternal::io_complete(int event, void *data)
{
(void)event;
(void)data;
if (aio_err_callbck && !ok()) {
AIOCallback *err_op = new AIOCallbackInternal();
err_op->aiocb.aio_fildes = this->aiocb.aio_fildes;
err_op->aiocb.aio_lio_opcode = this->aiocb.aio_lio_opcode;
err_op->mutex = aio_err_callbck->mutex;
err_op->action = aio_err_callbck;
eventProcessor.schedule_imm(err_op);
}
if (!action.cancelled) {
action.continuation->handleEvent(AIO_EVENT_DONE, this);
}
return EVENT_DONE;
}
#ifdef AIO_STATS
class AIOTestData : public Continuation
{
public:
int num_req;
int num_temp;
int num_queue;
ink_hrtime start;
int ink_aio_stats(int event, void *data);
AIOTestData() : Continuation(new_ProxyMutex()), num_req(0), num_temp(0), num_queue(0)
{
start = ink_get_hrtime();
SET_HANDLER(&AIOTestData::ink_aio_stats);
}
};
#endif
enum aio_stat_enum {
AIO_STAT_READ_PER_SEC,
AIO_STAT_KB_READ_PER_SEC,
AIO_STAT_WRITE_PER_SEC,
AIO_STAT_KB_WRITE_PER_SEC,
AIO_STAT_COUNT
};
extern RecRawStatBlock *aio_rsb;
|
/*
* Copyright (c) 2011 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
* Copyright (c) 2012, LiteStack, Inc.
*
* 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.
*/
/*
* DO NOT INCLUDE EXCEPT FROM sel_ldr.h
* THERE CANNOT BE ANY MULTIPLE INCLUSION GUARDS IN ORDER FOR
* sel_ldr-inl.c TO WORK.
*/
/*
* Routines to translate addresses between user and "system" or
* service runtime addresses. the *Addr* versions will return
* kNaClBadAddress if the user address is outside of the user address
* space, e.g., if the input addresses for *UserToSys* is outside of
* (1<<nap->addr_bits), and correspondingly for *SysToUser* if the
* input system address does not correspond to a user address.
* Generally, the *Addr* versions are used when the addresses come
* from untrusted usre code, and kNaClBadAddress would translate to an
* EINVAL return from a syscall. The *Range code ensures that the
* entire address range is in the user address space.
*
* Note that just because an address is within the address space, it
* doesn't mean that it is safe to acceess the memory: the page may be
* protected against access.
*
* The non-*Addr* versions abort the program rather than return an
* error indication.
*
* 0 is not a good error indicator, since 0 is a valid user address
*/
#include "src/main/zlog.h"
/* d'b: no checks, just does the work */
static INLINE uintptr_t NaClUserToSysAddrNullOkay
(struct NaClApp *nap, uintptr_t uaddr)
{
return uaddr + nap->mem_start;
}
static INLINE uintptr_t NaClUserToSys(struct NaClApp *nap, uintptr_t uaddr)
{
ZLOGFAIL(0 == uaddr || ((uintptr_t) 1U << nap->addr_bits) <= uaddr, EFAULT,
"uaddr 0x%08lx, addr space %d bits", uaddr, nap->addr_bits);
return uaddr + nap->mem_start;
}
static INLINE uintptr_t NaClSysToUser(struct NaClApp *nap, uintptr_t sysaddr)
{
ZLOGFAIL(sysaddr < nap->mem_start || nap->mem_start
+ ((uintptr_t) 1U << nap->addr_bits) <= sysaddr, EFAULT,
"sysaddr 0x%08lx, mem_start 0x%08lx, addr space %d bits",
sysaddr, nap->mem_start, nap->addr_bits);
return sysaddr - nap->mem_start;
}
static INLINE uintptr_t NaClEndOfStaticText(struct NaClApp *nap)
{
return nap->static_text_end;
}
static INLINE uintptr_t NaClSandboxCodeAddr(struct NaClApp *nap, uintptr_t addr)
{
return (((addr & ~(((uintptr_t)NACL_INSTR_BLOCK_SIZE) - 1))
& ((((uintptr_t) 1) << 32) - 1)) + nap->mem_start);
}
|
#include "pch.h"
class ScreenUtils
{
public:
static void CalculateSquareCenter(
float screenWidth,
float screenHeight,
int column,
int row,
float * x,
float * y);
static void ConvertGlobalToGridLocation(
float2 globalPt,
float * x,
float * y);
}; |
/*
* Copyright (C) 2013 Apple 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:
* 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 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 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.
*/
#pragma once
#include "DFGCommon.h"
#include <wtf/HashMap.h>
#include <wtf/PrintStream.h>
namespace JSC { namespace DFG {
class Graph;
class MinifiedNode;
class ValueSource;
struct Node;
class MinifiedID {
public:
MinifiedID() : m_id(invalidID()) { }
MinifiedID(WTF::HashTableDeletedValueType) : m_id(otherInvalidID()) { }
explicit MinifiedID(Node* node) : m_id(bitwise_cast<uintptr_t>(node)) { }
bool operator!() const { return m_id == invalidID(); }
// This takes Graph& to remind you, that you should only be calling this method
// when you're in the main compilation pass (i.e. you have a graph) and not later,
// like during OSR exit compilation.
Node* node(const Graph&) const { return bitwise_cast<Node*>(m_id); }
bool operator==(const MinifiedID& other) const { return m_id == other.m_id; }
bool operator!=(const MinifiedID& other) const { return m_id != other.m_id; }
bool operator<(const MinifiedID& other) const { return m_id < other.m_id; }
bool operator>(const MinifiedID& other) const { return m_id > other.m_id; }
bool operator<=(const MinifiedID& other) const { return m_id <= other.m_id; }
bool operator>=(const MinifiedID& other) const { return m_id >= other.m_id; }
unsigned hash() const { return WTF::IntHash<uintptr_t>::hash(m_id); }
void dump(PrintStream& out) const { out.print(RawPointer(reinterpret_cast<void*>(m_id))); }
bool isHashTableDeletedValue() const { return m_id == otherInvalidID(); }
static MinifiedID fromBits(uintptr_t value)
{
MinifiedID result;
result.m_id = value;
return result;
}
uintptr_t bits() const { return m_id; }
private:
friend class MinifiedNode;
static uintptr_t invalidID() { return static_cast<uintptr_t>(static_cast<intptr_t>(-1)); }
static uintptr_t otherInvalidID() { return static_cast<uintptr_t>(static_cast<intptr_t>(-2)); }
uintptr_t m_id;
};
struct MinifiedIDHash {
static unsigned hash(const MinifiedID& key) { return key.hash(); }
static bool equal(const MinifiedID& a, const MinifiedID& b) { return a == b; }
static const bool safeToCompareToEmptyOrDeleted = true;
};
} } // namespace JSC::DFG
namespace WTF {
template<typename T> struct DefaultHash;
template<> struct DefaultHash<JSC::DFG::MinifiedID> {
typedef JSC::DFG::MinifiedIDHash Hash;
};
template<typename T> struct HashTraits;
template<> struct HashTraits<JSC::DFG::MinifiedID> : SimpleClassHashTraits<JSC::DFG::MinifiedID> {
static const bool emptyValueIsZero = false;
};
} // namespace WTF
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/workdocs/WorkDocs_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace WorkDocs
{
namespace Model
{
enum class FolderContentType
{
NOT_SET,
ALL,
DOCUMENT,
FOLDER
};
namespace FolderContentTypeMapper
{
AWS_WORKDOCS_API FolderContentType GetFolderContentTypeForName(const Aws::String& name);
AWS_WORKDOCS_API Aws::String GetNameForFolderContentType(FolderContentType value);
} // namespace FolderContentTypeMapper
} // namespace Model
} // namespace WorkDocs
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/redshift/Redshift_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace Redshift
{
namespace Model
{
enum class UsageLimitBreachAction
{
NOT_SET,
log,
emit_metric,
disable
};
namespace UsageLimitBreachActionMapper
{
AWS_REDSHIFT_API UsageLimitBreachAction GetUsageLimitBreachActionForName(const Aws::String& name);
AWS_REDSHIFT_API Aws::String GetNameForUsageLimitBreachAction(UsageLimitBreachAction value);
} // namespace UsageLimitBreachActionMapper
} // namespace Model
} // namespace Redshift
} // namespace Aws
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 __itkPolygonGroupSpatialObjectXMLFile_h
#define __itkPolygonGroupSpatialObjectXMLFile_h
#include "itkPolygonGroupSpatialObject.h"
#include "itkXMLFile.h"
namespace itk
{
/* 3D Polygon Groups only ones that make sense for this data type */
typedef PolygonGroupSpatialObject< 3 > PGroupSpatialObjectType;
/** \class PolygonGroupSpatialObjectXMLFileReader
*
* Reads an XML-format file containing a list of polygons, and
* creates a corresponding PolygonGroupSpatialObject
* \ingroup ITKIOSpatialObjects
*/
class ITK_EXPORT PolygonGroupSpatialObjectXMLFileReader:
public XMLReader< PGroupSpatialObjectType >
{
public:
/** Standard typedefs */
typedef PolygonGroupSpatialObjectXMLFileReader Self;
typedef XMLReader< PGroupSpatialObjectType > Superclass;
typedef SmartPointer< Self > Pointer;
typedef PGroupSpatialObjectType PolygonGroupType;
typedef PolygonSpatialObject< 3 > PolygonSpatialObjectType;
typedef SpatialObjectPoint< 3 > PointType;
typedef std::vector< PointType > PointListType;
/** Run-time type information (and related methods). */
itkTypeMacro(PolygonGroupSpatialObjectXMLFileReader, XMLReader);
/** Method for creation through the object factory. */
itkNewMacro(Self);
public:
/** Determine if a file can be read */
virtual int CanReadFile(const char *name);
protected:
PolygonGroupSpatialObjectXMLFileReader() {}
virtual ~PolygonGroupSpatialObjectXMLFileReader() {}
virtual void StartElement(const char *name, const char **atts);
virtual void EndElement(const char *name);
virtual void CharacterDataHandler(const char *inData, int inLength);
private:
PolygonGroupSpatialObjectXMLFileReader(const Self &); //purposely not
// implemented
void operator=(const Self &); //purposely not
// implemented
PGroupSpatialObjectType::Pointer m_PGroup;
PolygonSpatialObjectType::Pointer m_CurPoly;
PointListType m_CurPointList;
std::string m_CurCharacterData;
};
/** \class PolygonGroupSpatialObjectXMLFileWriter
*
* Writes an XML-format file containing a list of polygons,
* based on a PolygonGroupSpatialObject.
* \ingroup ITKIOSpatialObjects
*/
class ITK_EXPORT PolygonGroupSpatialObjectXMLFileWriter:
public XMLWriterBase< PGroupSpatialObjectType >
{
public:
/** standard typedefs */
typedef XMLWriterBase< PGroupSpatialObjectType > Superclass;
typedef PolygonGroupSpatialObjectXMLFileWriter Self;
typedef SmartPointer< Self > Pointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(PolygonGroupSpatialObjectXMLFileWriter,
XMLWriterBase< PGroupSpatialObjectType > );
typedef PGroupSpatialObjectType PolygonGroupType;
typedef PolygonSpatialObject< 3 > PolygonSpatialObjectType;
/** Test whether a file is writable. */
virtual int CanWriteFile(const char *name);
/** Actually write out the file in question */
virtual int WriteFile();
protected:
PolygonGroupSpatialObjectXMLFileWriter() {}
virtual ~PolygonGroupSpatialObjectXMLFileWriter() {}
private:
PolygonGroupSpatialObjectXMLFileWriter(const Self &); //purposely not
// implemented
void operator=(const Self &); //purposely not
// implemented
};
}
#endif
|
#import <UIKit/UIKit.h>
#import "UIImageView+ProgressView.h"
FOUNDATION_EXPORT double SDWebImage_ProgressViewVersionNumber;
FOUNDATION_EXPORT const unsigned char SDWebImage_ProgressViewVersionString[];
|
#pragma once
namespace ps {
/**
* @brief Setups environment
*/
class Env {
public:
Env() { }
~Env() { }
void Init(char* argv0);
private:
void InitGlog(char* argv0);
void InitDMLC();
void AssembleMyNode();
};
} // namespace ps
|
/*
* Copyright 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.
*/
#include <sys/param.h>
#include <stdint.h>
#include "tls/s2n_tls_parameters.h"
#include "tls/extensions/s2n_client_psk.h"
#include "tls/extensions/s2n_psk_key_exchange_modes.h"
#include "utils/s2n_safety.h"
static bool s2n_psk_key_exchange_modes_should_send(struct s2n_connection *conn);
static int s2n_psk_key_exchange_modes_send(struct s2n_connection *conn, struct s2n_stuffer *out);
static int s2n_psk_key_exchange_modes_recv(struct s2n_connection *conn, struct s2n_stuffer *extension);
const s2n_extension_type s2n_psk_key_exchange_modes_extension = {
.iana_value = TLS_EXTENSION_PSK_KEY_EXCHANGE_MODES,
.minimum_version = S2N_TLS13,
.is_response = false,
.send = s2n_psk_key_exchange_modes_send,
.recv = s2n_psk_key_exchange_modes_recv,
.should_send = s2n_psk_key_exchange_modes_should_send,
.if_missing = s2n_extension_noop_if_missing,
};
static bool s2n_psk_key_exchange_modes_should_send(struct s2n_connection *conn)
{
/* Only send a psk_key_exchange_modes extension if a psk extension is also being sent */
return s2n_client_psk_should_send(conn);
}
static int s2n_psk_key_exchange_modes_send(struct s2n_connection *conn, struct s2n_stuffer *out)
{
POSIX_ENSURE_REF(conn);
POSIX_GUARD(s2n_stuffer_write_uint8(out, PSK_KEY_EXCHANGE_MODE_SIZE));
/* s2n currently only supports pre-shared keys with (EC)DHE key establishment */
POSIX_GUARD(s2n_stuffer_write_uint8(out, TLS_PSK_DHE_KE_MODE));
return S2N_SUCCESS;
}
static int s2n_psk_key_exchange_modes_recv(struct s2n_connection *conn, struct s2n_stuffer *extension)
{
POSIX_ENSURE_REF(conn);
uint8_t psk_ke_mode_list_len;
POSIX_GUARD(s2n_stuffer_read_uint8(extension, &psk_ke_mode_list_len));
if (psk_ke_mode_list_len > s2n_stuffer_data_available(extension)) {
/* Malformed length, ignore the extension */
return S2N_SUCCESS;
}
for (size_t i = 0; i < psk_ke_mode_list_len; i++) {
uint8_t wire_psk_ke_mode;
POSIX_GUARD(s2n_stuffer_read_uint8(extension, &wire_psk_ke_mode));
/* s2n currently only supports pre-shared keys with (EC)DHE key establishment */
if (wire_psk_ke_mode == TLS_PSK_DHE_KE_MODE) {
conn->psk_params.psk_ke_mode = S2N_PSK_DHE_KE;
return S2N_SUCCESS;
}
}
return S2N_SUCCESS;
}
|
/* Copyright 2020 The TensorFlow Authors. 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 TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WINOGRAD_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WINOGRAD_H_
#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
#include "tensorflow/lite/delegates/gpu/cl/precision.h"
#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
#include "tensorflow/lite/delegates/gpu/common/data_type.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
namespace tflite {
namespace gpu {
namespace cl {
// You can read https://arxiv.org/pdf/1509.09308.pdf for understanding of basic
// principles. In this kernels used different matrices for transformations than
// in original work.
class Winograd4x4To36 : public GPUOperation {
public:
Winograd4x4To36() = default;
Winograd4x4To36(const OperationDef& definition, const Padding2D& padding,
const DeviceInfo& device_info);
absl::Status BindArguments() override;
int3 GetGridSize() const override;
void GetPossibleKernelWorkGroups(
TuningType tuning_type, const DeviceInfo& device_info,
const KernelInfo& kernel_info,
std::vector<int3>* work_groups) const override;
// Move only
Winograd4x4To36(Winograd4x4To36&& operation);
Winograd4x4To36& operator=(Winograd4x4To36&& operation);
Winograd4x4To36(const Winograd4x4To36&) = delete;
Winograd4x4To36& operator=(const Winograd4x4To36&) = delete;
private:
friend Winograd4x4To36 CreateWinograd4x4To36(const DeviceInfo& device_info,
const OperationDef& definition,
const Padding2D& padding);
void UploadBt();
std::string GetWinograd4x4To36Code(const OperationDef& op_def);
// Must be called after kernel compilation
int3 SelectBestWorkGroup(const KernelInfo& kernel_info) const;
Padding2D padding_;
};
Winograd4x4To36 CreateWinograd4x4To36(const DeviceInfo& device_info,
const OperationDef& definition,
const Padding2D& padding);
class Winograd36To4x4 : public GPUOperation {
public:
Winograd36To4x4() = default;
Winograd36To4x4(const OperationDef& definition,
const DeviceInfo& device_info);
absl::Status BindArguments() override;
int3 GetGridSize() const override;
void GetPossibleKernelWorkGroups(
TuningType tuning_type, const DeviceInfo& device_info,
const KernelInfo& kernel_info,
std::vector<int3>* work_groups) const override;
// Move only
Winograd36To4x4(Winograd36To4x4&& operation);
Winograd36To4x4& operator=(Winograd36To4x4&& operation);
Winograd36To4x4(const Winograd36To4x4&) = delete;
Winograd36To4x4& operator=(const Winograd36To4x4&) = delete;
private:
friend Winograd36To4x4 CreateWinograd36To4x4(
const DeviceInfo& device_info, const OperationDef& definition,
const tflite::gpu::Tensor<Linear, DataType::FLOAT32>& biases);
void UploadAt();
std::string GetWinograd36To4x4Code(const OperationDef& op_def);
// Must be called after kernel compilation
int3 SelectBestWorkGroup(const KernelInfo& kernel_info) const;
};
Winograd36To4x4 CreateWinograd36To4x4(
const DeviceInfo& device_info, const OperationDef& definition,
const tflite::gpu::Tensor<Linear, DataType::FLOAT32>& biases);
} // namespace cl
} // namespace gpu
} // namespace tflite
#endif // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WINOGRAD_H_
|
/*
* Copyright 2018 Google
*
* 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 FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_ERRORS_H_
#define FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_ERRORS_H_
namespace firebase {
namespace firestore {
/**
* Error codes used by Cloud Firestore.
*
* The codes are in sync across Firestore SDKs on various platforms.
*/
enum Error {
/** The operation completed successfully. */
// Note: NSError objects will never have a code with this value.
kErrorOk = 0,
kErrorNone = 0,
/** The operation was cancelled (typically by the caller). */
kErrorCancelled = 1,
/** Unknown error or an error from a different error domain. */
kErrorUnknown = 2,
/**
* Client specified an invalid argument. Note that this differs from
* FailedPrecondition. InvalidArgument indicates arguments that are
* problematic regardless of the state of the system (e.g., an invalid field
* name).
*/
kErrorInvalidArgument = 3,
/**
* Deadline expired before operation could complete. For operations that
* change the state of the system, this error may be returned even if the
* operation has completed successfully. For example, a successful response
* from a server could have been delayed long enough for the deadline to
* expire.
*/
kErrorDeadlineExceeded = 4,
/** Some requested document was not found. */
kErrorNotFound = 5,
/** Some document that we attempted to create already exists. */
kErrorAlreadyExists = 6,
/** The caller does not have permission to execute the specified operation. */
kErrorPermissionDenied = 7,
/**
* Some resource has been exhausted, perhaps a per-user quota, or perhaps the
* entire file system is out of space.
*/
kErrorResourceExhausted = 8,
/**
* Operation was rejected because the system is not in a state required for
* the operation's execution.
*/
kErrorFailedPrecondition = 9,
/**
* The operation was aborted, typically due to a concurrency issue like
* transaction aborts, etc.
*/
kErrorAborted = 10,
/** Operation was attempted past the valid range. */
kErrorOutOfRange = 11,
/** Operation is not implemented or not supported/enabled. */
kErrorUnimplemented = 12,
/**
* Internal errors. Means some invariants expected by underlying system has
* been broken. If you see one of these errors, something is very broken.
*/
kErrorInternal = 13,
/**
* The service is currently unavailable. This is a most likely a transient
* condition and may be corrected by retrying with a backoff.
*/
kErrorUnavailable = 14,
/** Unrecoverable data loss or corruption. */
kErrorDataLoss = 15,
/**
* The request does not have valid authentication credentials for the
* operation.
*/
kErrorUnauthenticated = 16
};
} // namespace firestore
} // namespace firebase
#endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_ERRORS_H_
|
/******************************************************************************
* Copyright 2017 The Apollo Authors. 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.
*****************************************************************************/
#pragma once
#include "modules/common/status/status.h"
#include "modules/planning/proto/auto_tuning_model_input.pb.h"
#include "modules/planning/proto/auto_tuning_raw_feature.pb.h"
namespace apollo {
namespace planning {
/**
* @brief: build model related input feature from raw feature generator
*/
class AutotuningFeatureBuilder {
public:
/**
* @brief: constructor
*/
AutotuningFeatureBuilder() = default;
virtual ~AutotuningFeatureBuilder() = default;
/**
* @param: raw feature function input
* @param: generated model input feature from raw feature, function output
*/
virtual common::Status BuildFeature(
const autotuning::TrajectoryRawFeature& raw_feature,
autotuning::TrajectoryFeature* const input_feature) const = 0;
/**
* @param: pointwise raw feature, function input
* @param: generated model input feature, function output
*/
virtual common::Status BuildPointFeature(
const autotuning::TrajectoryPointRawFeature& raw_point_feature,
autotuning::TrajectoryPointwiseFeature* const point_feature) const = 0;
};
} // namespace planning
} // namespace apollo
|
/***************************************************************************\
TerrTex.h
Scott Randolph
October 2, 1995
Hold information on all the terrain texture tiles.
\***************************************************************************/
#ifndef _TERRTEX_H_
#define _TERRTEX_H_
#include "grtypes.h"
#include "Context.h"
#include "Image.h"
// JPO - increased to 32 bits
typedef DWORD TextureID;
// Terrain and feature types defined in the the visual basic tile tool
const int COVERAGE_NODATA = 0;
const int COVERAGE_WATER = 1;
const int COVERAGE_RIVER = 2;
const int COVERAGE_SWAMP = 3;
const int COVERAGE_PLAINS = 4;
const int COVERAGE_BRUSH = 5;
const int COVERAGE_THINFOREST = 6;
const int COVERAGE_THICKFOREST = 7;
const int COVERAGE_ROCKY = 8;
const int COVERAGE_URBAN = 9;
const int COVERAGE_ROAD = 10;
const int COVERAGE_RAIL = 11;
const int COVERAGE_BRIDGE = 12;
const int COVERAGE_RUNWAY = 13;
const int COVERAGE_STATION = 14;
const int COVERAGE_OBJECT = 15; // JB carrier
extern class TextureDB TheTerrTextures;
enum { H = 0, M, L, TEX_LEVELS };
typedef struct TexArea
{
int type;
float radius;
float x;
float y;
} TexArea;
typedef struct TexPath
{
int type;
float width;
float x1, y1;
float x2, y2;
} TexPath;
typedef struct TileEntry
{
char filename[20]; // Source filename of the bitmap (extension, but no path)
int nAreas;
TexArea *Areas; // List of special areas (NULL if none)
int nPaths;
TexPath *Paths; // List of paths (NULL if none)
int width[TEX_LEVELS]; // texture width in pixels
int height[TEX_LEVELS]; // texture height in pixels
BYTE *bits[TEX_LEVELS]; // Pixel data (NULL if not loaded)
UInt handle[TEX_LEVELS]; // Texture handle (NULL if not available)
int widthN[TEX_LEVELS]; // sfr: night texture width in pixels
int heightN[TEX_LEVELS]; // sfr: night texture height in pixels
BYTE *bitsN[TEX_LEVELS]; // Pixel data for Night tiles (NULL if not loaded)
UInt handleN[TEX_LEVELS]; // Texture handle for Night tiles (NULL if not available)
int refCount[TEX_LEVELS]; // Reference count
} TileEntry;
typedef struct SetEntry
{
int refCount; // Reference count
DWORD *palette; // 32 bit palette entries (NULL if not loaded)
UInt palHandle; // Rasterization engine palette handle (NULL if not available)
BYTE terrainType; // Terrain coverage type represented by this texture set
int numTiles; // How many tiles in this set?
TileEntry *tiles; // Array of tiles in this set
} SetEntry;
// fwd declaration of csection pointer
struct F4CSECTIONHANDLE;
class TextureDB
{
public:
TextureDB();// : cs_textureList(F4CreateCriticalSection("texturedb mutex")), TextureSets(NULL){}
~TextureDB();//{ F4DestroyCriticalSection(cs_textureList); };
BOOL Setup(DXContext *hrc, const char* texturePath);
BOOL IsReady(void)
{
return (TextureSets not_eq NULL);
};
void Cleanup(void);
// Function to force a single texture to override all others (for ACMI wireframe)
void SetOverrideTexture(UInt texHandle)
{
overrideHandle = texHandle;
};
// Functions to load and use textures at model load time and render time
void Request(TextureID texID);
void Release(TextureID texID);
void Select(ContextMPR *localContext, TextureID texID);
// Misc functions
void RestoreAll();
bool SyncDDSTextures(bool bForce = false);
void FlushHandles();
// Functions to interact with the texture database entries
const char *GetTexturePath(void)
{
return texturePath;
};
TexPath* GetPath(TextureID id, int type, int offset);
TexArea* GetArea(TextureID id, int type, int offset);
BYTE GetTerrainType(TextureID id);
protected:
char texturePath[MAX_PATH];
char texturePathD[MAX_PATH];
int totalTiles;
int numSets;
SetEntry *TextureSets; // Array of texture set records
UInt overrideHandle; // If nonNull, use this handle for ALL texture selects
Tcolor lightColor; // Current light color
DXContext *private_rc;
//CRITICAL_SECTION cs_textureList; // sfr: initializing this in constructor and destroying in destructor
F4CSECTIONHANDLE *cs_textureList;
protected:
// These functions actually load and release the texture bitmap memory
void Load(SetEntry* pSet, TileEntry* pTile, int res, bool forceNoDDS = false);
void Activate(SetEntry* pSet, TileEntry* pTile, int res);
void Deactivate(SetEntry* pSet, TileEntry* pTile, int res);
void Free(SetEntry* pSet, TileEntry* pTile, int res);
// Extract set, tile, and resolution from a texID
int ExtractSet(TextureID texID)
{
return (texID >> 4) bitand 0xFF;
};
int ExtractTile(TextureID texID)
{
return texID bitand 0xF;
};
int ExtractRes(TextureID texID)
{
return (texID >> 12) bitand 0xF;
};
// Handle time of day and lighting notifications
static void TimeUpdateCallback(void *self);
void SetLightLevel(void);
// This function handles lighting and storing the MPR version of a specific palette
void StoreMPRPalette(SetEntry *pSet);
bool DumpImageToFile(TileEntry* pTile, DWORD *palette, int res, bool bForce = false);
void ReadImageDDS(TileEntry* pTile, int res);
bool SaveDDS_DXTn(const char *szFileName, BYTE* pDst, int dimensions);
//THW Some helpers for season adjustement
void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v);
void RGBtoHSV(float r, float g, float b, float *h, float *s, float *v);
public:
// Current light level (0.0 to 1.0)
float lightLevel;
#ifdef _DEBUG
public:
int LoadedSetCount;
int LoadedTextureCount;
int ActiveTextureCount;
#endif
};
#endif // _TERRTEX_H_
|
/*
* Copyright (C) 2013 Apple 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:
* 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 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 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 FTLLoweredNodeValue_h
#define FTLLoweredNodeValue_h
#include <wtf/Platform.h>
#if ENABLE(FTL_JIT)
#include "DFGBasicBlock.h"
#include "FTLAbbreviatedTypes.h"
namespace JSC { namespace FTL {
// Represents the act of having lowered a DFG::Node to an LValue, and records the
// DFG::BasicBlock that did the lowering. The LValue is what we use most often, but
// we need to verify that we're in a block that is dominated by the one that did
// the lowering. We're guaranteed that for each DFG::Node, there will be one
// LoweredNodeValue that always dominates all uses of the DFG::Node; but there may
// be others that don't dominate and we're effectively doing opportunistic GVN on
// the lowering code.
class LoweredNodeValue {
public:
LoweredNodeValue()
: m_value(0)
, m_block(0)
{
}
LoweredNodeValue(LValue value, DFG::BasicBlock* block)
: m_value(value)
, m_block(block)
{
ASSERT(m_value);
ASSERT(m_block);
}
bool isSet() const { return !!m_value; }
bool operator!() const { return !isSet(); }
LValue value() const { return m_value; }
DFG::BasicBlock* block() const { return m_block; }
private:
LValue m_value;
DFG::BasicBlock* m_block;
};
} } // namespace JSC::FTL
#endif // ENABLE(FTL_JIT)
#endif // FTLLoweredNodeValue_h
|
/*
*
* Copyright 2015, Google 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 Google 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 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 GRPC_CORE_DEBUG_TRACE_H
#define GRPC_CORE_DEBUG_TRACE_H
#include <grpc/support/port_platform.h>
/* set to zero to remove all debug trace code */
#ifndef GRPC_ENABLE_TRACING
# define GRPC_ENABLE_TRACING 1
#endif
typedef enum {
GRPC_TRACE_SURFACE = 1 << 0,
GRPC_TRACE_CHANNEL = 1 << 1,
GRPC_TRACE_TCP = 1 << 2,
GRPC_TRACE_SECURE_ENDPOINT = 1 << 3,
GRPC_TRACE_HTTP = 1 << 4
} grpc_trace_bit_value;
#if GRPC_ENABLE_TRACING
extern gpr_uint32 grpc_trace_bits;
#else
# define grpc_trace_bits 0
#endif
void grpc_init_trace_bits();
#endif
|
/* ---------------------------------------------------------------------------
*
* (c) The GHC Team, 1998-2006
*
* Asynchronous exceptions
*
* --------------------------------------------------------------------------*/
#ifndef RAISEASYNC_H
#define RAISEASYNC_H
#define THROWTO_SUCCESS 0
#define THROWTO_BLOCKED 1
#ifndef CMINUSMINUS
#include "BeginPrivate.h"
void throwToSingleThreaded (Capability *cap,
StgTSO *tso,
StgClosure *exception);
void throwToSingleThreaded_ (Capability *cap,
StgTSO *tso,
StgClosure *exception,
rtsBool stop_at_atomically);
void suspendComputation (Capability *cap,
StgTSO *tso,
StgUpdateFrame *stop_here);
MessageThrowTo *throwTo (Capability *cap, // the Capability we hold
StgTSO *source,
StgTSO *target,
StgClosure *exception); // the exception closure
nat throwToMsg (Capability *cap,
MessageThrowTo *msg);
int maybePerformBlockedException (Capability *cap, StgTSO *tso);
void awakenBlockedExceptionQueue (Capability *cap, StgTSO *tso);
/* Determine whether a thread is interruptible (ie. blocked
* indefinitely). Interruptible threads can be sent an exception with
* killThread# even if they have async exceptions blocked.
*/
INLINE_HEADER int
interruptible(StgTSO *t)
{
switch (t->why_blocked) {
case BlockedOnMVar:
case BlockedOnMsgThrowTo:
case BlockedOnRead:
case BlockedOnWrite:
#if defined(mingw32_HOST_OS)
case BlockedOnDoProc:
#endif
case BlockedOnDelay:
return 1;
// NB. Threaded blocked on foreign calls (BlockedOnCCall) are
// *not* interruptible. We can't send these threads an exception.
default:
return 0;
}
}
#include "EndPrivate.h"
#endif /* CMINUSMINUS */
#endif /* RAISEASYNC_H */
|
/*
** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
**
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of version 2 of the GNU Library General
** Public License as published by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Library General Public License for more details. To obtain a
** copy of the GNU Library General Public License, write to the Free
** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Any permitted reproduction of these routines, in whole or in part,
** must bear this legend.
**
**
** map231.c
**
** mapper 231 interface
** $Id: map231.c,v 1.2 2001/04/27 14:37:11 neil Exp $
*/
#include "nes_mmc.h"
/* mapper 231: NINA-07, used in Wally Bear and the NO! Gang */
static void map231_init(void)
{
mmc_bankrom(32, 0x8000, MMC_LASTBANK);
}
static void map231_write(uint32 address, uint8 value)
{
int bank, vbank;
UNUSED(address);
bank = ((value & 0x80) >> 5) | (value & 0x03);
vbank = (value >> 4) & 0x07;
mmc_bankrom(32, 0x8000, bank);
mmc_bankvrom(8, 0x0000, vbank);
}
static map_memwrite map231_memwrite[] =
{
{ 0x8000, 0xFFFF, map231_write },
{ -1, -1, NULL }
};
mapintf_t map231_intf =
{
231, /* mapper number */
"NINA-07", /* mapper name */
map231_init, /* init routine */
NULL, /* vblank callback */
NULL, /* hblank callback */
NULL, /* get state (snss) */
NULL, /* set state (snss) */
NULL, /* memory read structure */
map231_memwrite, /* memory write structure */
NULL /* external sound device */
};
/*
** $Log: map231.c,v $
** Revision 1.2 2001/04/27 14:37:11 neil
** wheeee
**
** Revision 1.1 2001/04/27 12:54:40 neil
** blah
**
** Revision 1.1.1.1 2001/04/27 07:03:54 neil
** initial
**
** Revision 1.1 2000/10/24 12:19:33 matt
** changed directory structure
**
** Revision 1.4 2000/10/22 19:17:46 matt
** mapper cleanups galore
**
** Revision 1.3 2000/10/21 19:33:38 matt
** many more cleanups
**
** Revision 1.2 2000/08/16 02:50:11 matt
** random mapper cleanups
**
** Revision 1.1 2000/07/11 03:14:18 melanson
** Initial commit for mappers 16, 34, and 231
**
**
*/
|
// Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR).
// Distributed under the terms of the BSD license (see the LICENSE
// file for the exact terms).
// Email: hermes1d@googlegroups.com, home page: http://hpfem.org/
#ifndef _LINEARIZER_H_
#define _LINEARIZER_H_
#include "common.h"
#include "legendre.h"
#include "lobatto.h"
class Linearizer {
public:
Linearizer(Mesh *mesh) {
this->mesh = mesh;
}
// evaluate approximate solution at element 'm' at reference
// point 'x_ref'. Here 'y' is the global vector of coefficients
void eval_approx(int sln, Element *e, double x_ref, double *x_phys,
double *val);
void eval_approx(Element *e, double x_ref, double *x_phys, // default for sln=0
double *val);
void plot_solution(const char *out_filename,
int plotting_elem_subdivision=50);
void plot_ref_elem_pairs(ElemPtr2 *elem_ref_pairs,
const char *out_filename,
int plotting_elem_subdivision=50);
// plotting trajectory where solution[comp_x] is used as
// x-coordinate and solution[comp_y] as y-coordinate
// FIXME: code needs to be fixed to allow
// plotting_elem_subdivision to be 100 and more
void plot_trajectory(FILE *f, int comp_x, int comp_y,
int plotting_elem_subdivision=50);
void get_xy_mesh(int comp, int plotting_elem_subdivision,
double **x, double **y, int *n);
void get_xy_ref_array(int comp, ElemPtr2* elem_ref_pairs,
int plotting_elem_subdivision,
double **x, double **y, int *n);
private:
Mesh *mesh;
};
#endif
|
/*
* Copyright (C) 2012 Google 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 Google 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 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 PagePopupController_h
#define PagePopupController_h
#include "bindings/v8/ScriptWrappable.h"
#include "wtf/Forward.h"
#include "wtf/RefCounted.h"
namespace WebCore {
class PagePopupClient;
class PagePopupController : public RefCounted<PagePopupController>, public ScriptWrappable {
public:
static PassRefPtr<PagePopupController> create(PagePopupClient*);
void setValueAndClosePopup(int numValue, const String& stringValue);
void setValue(const String&);
void closePopup();
String localizeNumberString(const String&);
#if ENABLE(CALENDAR_PICKER)
String formatMonth(int year, int zeroBaseMonth);
String formatShortMonth(int year, int zeroBaseMonth);
#endif
void clearPagePopupClient();
void histogramEnumeration(const String& name, int sample, int boundaryValue);
private:
explicit PagePopupController(PagePopupClient*);
PagePopupClient* m_popupClient;
};
}
#endif
|
/*
* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2012 Samsung Electronics. All rights reserved.
*
* 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 SKY_ENGINE_CORE_PAGE_CHROMECLIENT_H_
#define SKY_ENGINE_CORE_PAGE_CHROMECLIENT_H_
#include "sky/engine/core/frame/ConsoleTypes.h"
#include "sky/engine/core/inspector/ConsoleAPITypes.h"
#include "sky/engine/core/page/FocusType.h"
#include "sky/engine/public/platform/WebScreenInfo.h"
#include "sky/engine/wtf/Forward.h"
namespace blink {
class Element;
class FloatRect;
class IntRect;
class LocalFrame;
class Node;
struct DateTimeChooserParameters;
struct GraphicsDeviceAdapter;
class ChromeClient {
public:
virtual void setWindowRect(const FloatRect&) = 0;
virtual FloatRect windowRect() = 0;
virtual void focus() = 0;
virtual bool canTakeFocus(FocusType) = 0;
virtual void takeFocus(FocusType) = 0;
virtual void focusedNodeChanged(Node*) = 0;
virtual void focusedFrameChanged(LocalFrame*) = 0;
virtual bool shouldReportDetailedMessageForSource(const String& source) = 0;
virtual void addMessageToConsole(LocalFrame*, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID, const String& stackTrace) = 0;
virtual void* webView() const = 0;
// Methods used by HostWindow.
virtual IntRect rootViewToScreen(const IntRect&) const = 0;
virtual blink::WebScreenInfo screenInfo() const = 0;
virtual void scheduleVisualUpdate() = 0;
// End methods used by HostWindow.
virtual String acceptLanguages() = 0;
protected:
virtual ~ChromeClient() { }
};
}
#endif // SKY_ENGINE_CORE_PAGE_CHROMECLIENT_H_
|
/*
* Copyright (c) 2012, Klaus Pototzky
*
* 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 FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CXXBLAS_LEVEL3EXTENSION_GBMM_H
#define CXXBLAS_LEVEL3EXTENSION_GBMM_H 1
#include <cxxblas/drivers/drivers.h>
#include <cxxblas/typedefs.h>
#define HAVE_CXXBLAS_GBMM 1
namespace cxxblas {
template <typename IndexType, typename ALPHA, typename MA, typename MB,
typename BETA, typename VC>
void
gbmm(StorageOrder order, Side side,
Transpose transA, Transpose transB,
IndexType m, IndexType n,
IndexType kl, IndexType ku,
IndexType l,
const ALPHA &alpha,
const MA *A, IndexType ldA,
const MB *B, IndexType ldB,
const BETA &beta,
VC *C, IndexType ldC);
} // namespace cxxblas
#endif // CXXBLAS_LEVEL3EXTENSION_GBMM_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 MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
#define MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
#include "base/basictypes.h"
#include "base/time/time.h"
#include "media/base/android/demuxer_stream_player_params.h"
#include "media/base/media_export.h"
namespace media {
class MediaPlayerAndroid;
class MediaResourceGetter;
class MediaUrlInterceptor;
// This class is responsible for managing active MediaPlayerAndroid objects.
class MEDIA_EXPORT MediaPlayerManager {
public:
virtual ~MediaPlayerManager() {}
// Returns a pointer to the MediaResourceGetter object.
virtual MediaResourceGetter* GetMediaResourceGetter() = 0;
// Returns a pointer to the MediaUrlInterceptor object or null.
virtual MediaUrlInterceptor* GetMediaUrlInterceptor() = 0;
// Called when time update messages need to be sent. Args: player ID,
// current timestamp, current time ticks.
virtual void OnTimeUpdate(int player_id,
base::TimeDelta current_timestamp,
base::TimeTicks current_time_ticks) = 0;
// Called when media metadata changed. Args: player ID, duration of the
// media, width, height, whether the metadata is successfully extracted.
virtual void OnMediaMetadataChanged(
int player_id,
base::TimeDelta duration,
int width,
int height,
bool success) = 0;
// Called when playback completed. Args: player ID.
virtual void OnPlaybackComplete(int player_id) = 0;
// Called when media download was interrupted. Args: player ID.
virtual void OnMediaInterrupted(int player_id) = 0;
// Called when buffering has changed. Args: player ID, percentage
// of the media.
virtual void OnBufferingUpdate(int player_id, int percentage) = 0;
// Called when seek completed. Args: player ID, current time.
virtual void OnSeekComplete(
int player_id,
const base::TimeDelta& current_time) = 0;
// Called when error happens. Args: player ID, error type.
virtual void OnError(int player_id, int error) = 0;
// Called when video size has changed. Args: player ID, width, height.
virtual void OnVideoSizeChanged(int player_id, int width, int height) = 0;
// Called when the player pauses as a new key is required to decrypt
// encrypted content.
virtual void OnWaitingForDecryptionKey(int player_id) = 0;
// Returns the player that's in the fullscreen mode currently.
virtual MediaPlayerAndroid* GetFullscreenPlayer() = 0;
// Returns the player with the specified id.
virtual MediaPlayerAndroid* GetPlayer(int player_id) = 0;
// Called by the player to request to play. The manager should use this
// opportunity to check if the current context is appropriate for a media to
// play.
// Returns whether the request was granted.
virtual bool RequestPlay(int player_id) = 0;
};
} // namespace media
#endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
|
//
// Copyright (c) 2015, Upnext Technologies Sp. z o.o.
// All rights reserved.
//
// This source code is licensed under the BSD 3-Clause License found in the
// LICENSE.txt file in the root directory of this source tree.
//
#import <CoreLocation/CoreLocation.h>
@interface CLBeacon (BeaconCtrl)
- (NSString *) bcl_identifier;
@end
|
/*
Copyright (c) 1999-2008, Phillip Stanley-Marbell (author)
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 author nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
enum
{
INSTR_0 = 0,
INSTR_N,
INSTR_M,
INSTR_MBANK,
INSTR_NBANK,
INSTR_NM,
INSTR_MD,
INSTR_NMD,
INSTR_D8,
INSTR_D12,
INSTR_ND4,
INSTR_ND8,
INSTR_I,
INSTR_NI,
};
|
// Copyright 2015 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 MASH_WM_WINDOW_MANAGER_APPLICATION_H_
#define MASH_WM_WINDOW_MANAGER_APPLICATION_H_
#include <stdint.h>
#include <memory>
#include <set>
#include "base/macros.h"
#include "base/observer_list.h"
#include "components/mus/common/types.h"
#include "components/mus/public/interfaces/accelerator_registrar.mojom.h"
#include "components/mus/public/interfaces/window_manager.mojom.h"
#include "components/mus/public/interfaces/window_manager_factory.mojom.h"
#include "components/mus/public/interfaces/window_tree_host.mojom.h"
#include "mash/session/public/interfaces/session.mojom.h"
#include "mash/wm/public/interfaces/shelf_layout.mojom.h"
#include "mash/wm/public/interfaces/user_window_controller.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "services/shell/public/cpp/shell_client.h"
#include "services/tracing/public/cpp/tracing_impl.h"
namespace display {
class Screen;
}
namespace views {
class AuraInit;
}
namespace ui {
class Event;
}
namespace mash {
namespace wm {
class AcceleratorRegistrarImpl;
class RootWindowController;
class RootWindowsObserver;
class ShelfLayoutImpl;
class UserWindowControllerImpl;
class WmGlobalsMus;
class WmLookupMus;
class WmScreen;
class WindowManagerApplication
: public shell::ShellClient,
public mus::mojom::WindowManagerFactory,
public shell::InterfaceFactory<mojom::ShelfLayout>,
public shell::InterfaceFactory<mojom::UserWindowController>,
public shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar> {
public:
WindowManagerApplication();
~WindowManagerApplication() override;
shell::Connector* connector() { return connector_; }
// Returns the RootWindowControllers that have valid roots.
//
// NOTE: this does not return |controllers_| as most clients want a
// RootWindowController that has a valid root window.
std::set<RootWindowController*> GetRootControllers();
WmGlobalsMus* globals() { return globals_.get(); }
// Called when the root window of |root_controller| is obtained.
void OnRootWindowControllerGotRoot(RootWindowController* root_controller);
// Called after RootWindowController creates the necessary resources.
void OnRootWindowControllerDoneInit(RootWindowController* root_controller);
// Called when the root mus::Window of RootWindowController is destroyed.
// |root_controller| is destroyed after this call.
void OnRootWindowDestroyed(RootWindowController* root_controller);
// TODO(sky): figure out right place for this code.
void OnAccelerator(uint32_t id, const ui::Event& event);
void AddRootWindowsObserver(RootWindowsObserver* observer);
void RemoveRootWindowsObserver(RootWindowsObserver* observer);
session::mojom::Session* session() {
return session_.get();
}
private:
friend class WmTestBase;
friend class WmTestHelper;
void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar);
// Adds |root_window_controller| to the set of known roots.
void AddRootWindowController(RootWindowController* root_window_controller);
// shell::ShellClient:
void Initialize(shell::Connector* connector,
const shell::Identity& identity,
uint32_t id) override;
bool AcceptConnection(shell::Connection* connection) override;
// shell::InterfaceFactory<mojom::ShelfLayout>:
void Create(shell::Connection* connection,
mojo::InterfaceRequest<mojom::ShelfLayout> request) override;
// shell::InterfaceFactory<mojom::UserWindowController>:
void Create(
shell::Connection* connection,
mojo::InterfaceRequest<mojom::UserWindowController> request) override;
// shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>:
void Create(shell::Connection* connection,
mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request)
override;
// mus::mojom::WindowManagerFactory:
void CreateWindowManager(mus::mojom::DisplayPtr display,
mojo::InterfaceRequest<mus::mojom::WindowTreeClient>
client_request) override;
shell::Connector* connector_;
mojo::TracingImpl tracing_;
std::unique_ptr<display::Screen> screen_;
std::unique_ptr<views::AuraInit> aura_init_;
std::unique_ptr<WmGlobalsMus> globals_;
std::unique_ptr<WmLookupMus> lookup_;
// The |shelf_layout_| object is created once OnEmbed() is called. Until that
// time |shelf_layout_requests_| stores pending interface requests.
std::unique_ptr<ShelfLayoutImpl> shelf_layout_;
mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_;
std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ShelfLayout>>>
shelf_layout_requests_;
// |user_window_controller_| is created once OnEmbed() is called. Until that
// time |user_window_controller_requests_| stores pending interface requests.
std::unique_ptr<UserWindowControllerImpl> user_window_controller_;
mojo::BindingSet<mojom::UserWindowController>
user_window_controller_bindings_;
std::vector<
std::unique_ptr<mojo::InterfaceRequest<mojom::UserWindowController>>>
user_window_controller_requests_;
std::set<AcceleratorRegistrarImpl*> accelerator_registrars_;
std::set<RootWindowController*> root_controllers_;
mojo::Binding<mus::mojom::WindowManagerFactory>
window_manager_factory_binding_;
mash::session::mojom::SessionPtr session_;
base::ObserverList<RootWindowsObserver> root_windows_observers_;
DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication);
};
} // namespace wm
} // namespace mash
#endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_
|
//
// MCOIMAPFolderStatusOperation.h
// mailcore2
//
// Created by Sebastian on 6/5/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#ifndef __MAILCORE_MCOIMAPFOLDERSTATUSOPERATION_H_
#define __MAILCORE_MCOIMAPFOLDERSTATUSOPERATION_H_
#import <MailCore/MCOIMAPBaseOperation.h>
/**
The class is used to get folder metadata (like UIDVALIDITY, UIDNEXT, etc).
@see MCOIMAPFolderStatus
*/
@class MCOIMAPFolderStatus;
@interface MCOIMAPFolderStatusOperation : MCOIMAPBaseOperation
/**
Starts the asynchronous operation.
@param completionBlock Called when the operation is finished.
- On success `error` will be nil and `status` will contain the status metadata
- On failure, `error` will be set with `MCOErrorDomain` as domain and an
error code available in `MCOConstants.h`, `info` will be nil
*/
- (void) start:(void (^)(NSError * error, MCOIMAPFolderStatus * status))completionBlock;
@end
#endif
|
// 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.
//
// Class for finding and caching Windows explorer icons. The IconManager
// lives on the UI thread but performs icon extraction work on the file thread
// to avoid blocking the UI thread with potentially expensive COM and disk
// operations.
//
// Terminology
//
// Windows files have icons associated with them that can be of two types:
// 1. "Per class": the icon used for this file is used for all files with the
// same file extension or class. Examples are PDF or MP3 files, which use
// the same icon for all files of that type.
// 2. "Per instance": the icon used for this file is embedded in the file
// itself and is unique. Executable files are typically "per instance".
//
// Files that end in the following extensions are considered "per instance":
// .exe
// .dll
// .ico
// The IconManager will do explicit icon loads on the full path of these files
// and cache the results per file. All other file types will be looked up by
// file extension and the results will be cached per extension. That way, all
// .mp3 files will share one icon, but all .exe files will have their own icon.
//
// POSIX files don't have associated icons. We query the OS by the file's
// mime type.
//
// The IconManager can be queried in two ways:
// 1. A quick, synchronous check of its caches which does not touch the disk:
// IconManager::LookupIcon()
// 2. An asynchronous icon load from a file on the file thread:
// IconManager::LoadIcon()
//
// When using the second (asychronous) method, callers must supply a callback
// which will be run once the icon has been extracted. The icon manager will
// cache the results of the icon extraction so that subsequent lookups will be
// fast.
//
// Icon bitmaps returned should be treated as const since they may be referenced
// by other clients. Make a copy of the icon if you need to modify it.
#ifndef CHROME_BROWSER_ICON_MANAGER_H_
#define CHROME_BROWSER_ICON_MANAGER_H_
#include <map>
#include "chrome/browser/icon_loader.h"
#include "chrome/common/cancelable_task_tracker.h"
#include "ui/gfx/image/image.h"
namespace base {
class FilePath;
}
class IconManager : public IconLoader::Delegate {
public:
IconManager();
virtual ~IconManager();
// Synchronous call to examine the internal caches for the icon. Returns the
// icon if we have already loaded it, NULL if we don't have it and must load
// it via 'LoadIcon'. The returned bitmap is owned by the IconManager and must
// not be free'd by the caller. If the caller needs to modify the icon, it
// must make a copy and modify the copy.
gfx::Image* LookupIcon(const base::FilePath& file_name, IconLoader::IconSize size);
typedef base::Callback<void(gfx::Image*)> IconRequestCallback;
// Asynchronous call to lookup and return the icon associated with file. The
// work is done on the file thread, with the callbacks running on the thread
// this function is called.
//
// Note:
// 1. This does *not* check the cache.
// 2. The returned bitmap pointer is *not* owned by callback. So callback
// should never keep it or delete it.
// 3. The gfx::Image pointer passed to the callback may be NULL if decoding
// failed.
CancelableTaskTracker::TaskId LoadIcon(const base::FilePath& file_name,
IconLoader::IconSize size,
const IconRequestCallback& callback,
CancelableTaskTracker* tracker);
// IconLoader::Delegate interface.
virtual bool OnImageLoaded(IconLoader* loader, gfx::Image* result) OVERRIDE;
// Get the identifying string for the given file. The implementation
// is in icon_manager_[platform].cc.
static IconGroupID GetGroupIDFromFilepath(const base::FilePath& path);
private:
struct CacheKey {
CacheKey(const IconGroupID& group, IconLoader::IconSize size);
// Used as a key in the map below, so we need this comparator.
bool operator<(const CacheKey &other) const;
IconGroupID group;
IconLoader::IconSize size;
};
typedef std::map<CacheKey, gfx::Image*> IconMap;
IconMap icon_cache_;
// Asynchronous requests that have not yet been completed.
struct ClientRequest;
typedef std::map<IconLoader*, ClientRequest> ClientRequests;
ClientRequests requests_;
DISALLOW_COPY_AND_ASSIGN(IconManager);
};
#endif // CHROME_BROWSER_ICON_MANAGER_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 CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_SCREEN_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_SCREEN_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/browser/chromeos/camera_presence_notifier.h"
#include "chrome/browser/chromeos/login/screens/base_screen.h"
#include "chrome/browser/chromeos/login/supervised/supervised_user_creation_controller.h"
#include "chrome/browser/image_decoder.h"
#include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h"
#include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "ui/gfx/image/image_skia.h"
class Profile;
namespace chromeos {
class ErrorScreensHistogramHelper;
class NetworkState;
class ScreenManager;
// Class that controls screen showing ui for supervised user creation.
class SupervisedUserCreationScreen
: public BaseScreen,
public SupervisedUserCreationScreenHandler::Delegate,
public SupervisedUserCreationController::StatusConsumer,
public SupervisedUserSyncServiceObserver,
public ImageDecoder::Delegate,
public NetworkPortalDetector::Observer,
public CameraPresenceNotifier::Observer {
public:
SupervisedUserCreationScreen(BaseScreenDelegate* base_screen_delegate,
SupervisedUserCreationScreenHandler* actor);
~SupervisedUserCreationScreen() override;
static SupervisedUserCreationScreen* Get(ScreenManager* manager);
// Makes screen to show message about inconsistency in manager login flow
// (e.g. password change detected, invalid OAuth token, etc).
// Called when manager user is successfully authenticated, so ui elements
// should result in forced logout.
void ShowManagerInconsistentStateErrorScreen();
// Called when authentication fails for manager with provided password.
// Displays wrong password message on manager selection screen.
void OnManagerLoginFailure();
// Called when manager is successfully authenticated and account is in
// consistent state.
void OnManagerFullyAuthenticated(Profile* manager_profile);
// Called when manager is successfully authenticated against cryptohome, but
// OAUTH token validation hasn't completed yet.
// Results in spinner indicating that creation is in process.
void OnManagerCryptohomeAuthenticated();
// Shows initial screen where managed user name/password are defined and
// manager is selected.
void ShowInitialScreen();
// CameraPresenceNotifier::Observer implementation:
void OnCameraPresenceCheckDone(bool is_camera_present) override;
// SupervisedUserSyncServiceObserver implementation
void OnSupervisedUserAcknowledged(
const std::string& supervised_user_id) override {}
void OnSupervisedUsersSyncingStopped() override {}
void OnSupervisedUsersChanged() override;
// BaseScreen implementation:
void PrepareToShow() override;
void Show() override;
void Hide() override;
std::string GetName() const override;
// SupervisedUserCreationScreenHandler::Delegate implementation:
void OnActorDestroyed(SupervisedUserCreationScreenHandler* actor) override;
void CreateSupervisedUser(
const base::string16& display_name,
const std::string& supervised_user_password) override;
void ImportSupervisedUser(const std::string& user_id) override;
void ImportSupervisedUserWithPassword(const std::string& user_id,
const std::string& password) override;
void AuthenticateManager(const std::string& manager_id,
const std::string& manager_password) override;
void AbortFlow() override;
void FinishFlow() override;
bool FindUserByDisplayName(const base::string16& display_name,
std::string* out_id) const override;
void OnPageSelected(const std::string& page) override;
// SupervisedUserController::StatusConsumer overrides.
void OnCreationError(
SupervisedUserCreationController::ErrorCode code) override;
void OnCreationTimeout() override;
void OnCreationSuccess() override;
void OnLongCreationWarning() override;
// NetworkPortalDetector::Observer implementation:
void OnPortalDetectionCompleted(
const NetworkState* network,
const NetworkPortalDetector::CaptivePortalState& state) override;
// TODO(antrim) : this is an explicit code duplications with UserImageScreen.
// It should be removed by issue 251179.
// SupervisedUserCreationScreenHandler::Delegate (image) implementation:
void OnPhotoTaken(const std::string& raw_data) override;
void OnImageSelected(const std::string& image_url,
const std::string& image_type) override;
void OnImageAccepted() override;
// ImageDecoder::Delegate overrides:
void OnImageDecoded(const ImageDecoder* decoder,
const SkBitmap& decoded_image) override;
void OnDecodeImageFailed(const ImageDecoder* decoder) override;
private:
void ApplyPicture();
void OnGetSupervisedUsers(const base::DictionaryValue* users);
SupervisedUserCreationScreenHandler* actor_;
scoped_ptr<SupervisedUserCreationController> controller_;
scoped_ptr<base::DictionaryValue> existing_users_;
bool on_error_screen_;
bool manager_signin_in_progress_;
std::string last_page_;
SupervisedUserSyncService* sync_service_;
gfx::ImageSkia user_photo_;
scoped_refptr<ImageDecoder> image_decoder_;
bool apply_photo_after_decoding_;
int selected_image_;
scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_;
base::WeakPtrFactory<SupervisedUserCreationScreen> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationScreen);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_SCREEN_H_
|
/*-
* Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
* Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* a) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* b) 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.
*
* c) Neither the name of Cisco Systems, 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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#ifndef _NETINET_SCTP_DTRACE_DECLARE_H_
#define _NETINET_SCTP_DTRACE_DECLARE_H_
#include "opt_kdtrace.h"
#include <sys/kernel.h>
#include <sys/sdt.h>
/* Declare the SCTP provider */
SDT_PROVIDER_DECLARE(sctp);
/* The probes we have so far: */
/* One to track a net's cwnd */
/* initial */
SDT_PROBE_DECLARE(sctp, cwnd, net, init);
/* update at a ack -- increase */
SDT_PROBE_DECLARE(sctp, cwnd, net, ack);
/* update at a fast retransmit -- decrease */
SDT_PROBE_DECLARE(sctp, cwnd, net, fr);
/* update at a time-out -- decrease */
SDT_PROBE_DECLARE(sctp, cwnd, net, to);
/* update at a burst-limit -- decrease */
SDT_PROBE_DECLARE(sctp, cwnd, net, bl);
/* update at a ECN -- decrease */
SDT_PROBE_DECLARE(sctp, cwnd, net, ecn);
/* update at a Packet-Drop -- decrease */
SDT_PROBE_DECLARE(sctp, cwnd, net, pd);
/* Rttvar probe declaration */
SDT_PROBE_DECLARE(sctp, cwnd, net, rttvar);
SDT_PROBE_DECLARE(sctp, cwnd, net, rttstep);
/* One to track an associations rwnd */
SDT_PROBE_DECLARE(sctp, rwnd, assoc, val);
/* One to track a net's flight size */
SDT_PROBE_DECLARE(sctp, flightsize, net, val);
/* One to track an associations flight size */
SDT_PROBE_DECLARE(sctp, flightsize, assoc, val);
#endif
|
// Copyright 2015 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.
//
// Implementation of the SafeBrowsingDatabaseManager that sends URLs
// via IPC to a database that chromium doesn't manage locally.
#ifndef COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_
#define COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "components/safe_browsing_db/database_manager.h"
#include "url/gurl.h"
namespace net {
class URLRequestContextGetter;
}
namespace safe_browsing {
struct V4ProtocolConfig;
// An implementation that proxies requests to a service outside of Chromium.
// Does not manage a local database.
class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
public:
// Construct RemoteSafeBrowsingDatabaseManager.
// Must be initialized by calling StartOnIOThread() before using.
RemoteSafeBrowsingDatabaseManager();
//
// SafeBrowsingDatabaseManager implementation
//
bool IsSupported() const override;
safe_browsing::ThreatSource GetThreatSource() const override;
bool ChecksAreAlwaysAsync() const override;
bool CanCheckResourceType(content::ResourceType resource_type) const override;
bool CanCheckUrl(const GURL& url) const override;
bool download_protection_enabled() const override;
bool CheckBrowseUrl(const GURL& url, Client* client) override;
void CancelCheck(Client* client) override;
void StartOnIOThread(
net::URLRequestContextGetter* request_context_getter,
const V4ProtocolConfig& config) override;
void StopOnIOThread(bool shutdown) override;
// These will fail with DCHECK() since their functionality isn't implemented.
// We may later add support for a subset of them.
bool CheckDownloadUrl(const std::vector<GURL>& url_chain,
Client* client) override;
bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
Client* client) override;
bool MatchCsdWhitelistUrl(const GURL& url) override;
bool MatchMalwareIP(const std::string& ip_address) override;
bool MatchDownloadWhitelistUrl(const GURL& url) override;
bool MatchDownloadWhitelistString(const std::string& str) override;
bool MatchInclusionWhitelistUrl(const GURL& url) override;
bool MatchModuleWhitelistString(const std::string& str) override;
bool CheckResourceUrl(const GURL& url, Client* client) override;
bool IsMalwareKillSwitchOn() override;
bool IsCsdWhitelistKillSwitchOn() override;
//
// RemoteSafeBrowsingDatabaseManager implementation
//
private:
~RemoteSafeBrowsingDatabaseManager() override;
class ClientRequest; // Per-request tracker.
// Requests currently outstanding. This owns the ptrs.
std::vector<ClientRequest*> current_requests_;
bool enabled_;
std::set<content::ResourceType> resource_types_to_check_;
friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>;
DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager);
}; // class RemoteSafeBrowsingDatabaseManager
} // namespace safe_browsing
#endif // COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_
|
/* Copyright (C) 2015, Fredrik Nordin <freedick@ludd.ltu.se>
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 Mumble Developers 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 FOUNDATION 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 MUMBLE_MUMBLE_USERVOLUME_H_
#define MUMBLE_MUMBLE_USERVOLUME_H_
#include "ui_UserLocalVolumeDialog.h"
#include "ClientUser.h"
class UserLocalVolumeDialog : public QDialog, private Ui::UserLocalVolumeDialog {
Q_OBJECT
Q_DISABLE_COPY(UserLocalVolumeDialog);
/// The session ID for the user that the dialog is changing the volume for.
unsigned int m_clientSession;
/// The user's original adjustment (in dB) when entering the dialog.
int m_originalVolumeAdjustmentDecibel;
public slots:
void on_qsUserLocalVolume_valueChanged(int value);
void on_qsbUserLocalVolume_valueChanged(int value);
void on_qbbUserLocalVolume_clicked(QAbstractButton *b);
public:
UserLocalVolumeDialog(unsigned int sessionId = 0);
};
#endif
|
// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef XWALK_EXTENSIONS_EXTENSION_PROCESS_XWALK_EXTENSION_PROCESS_H_
#define XWALK_EXTENSIONS_EXTENSION_PROCESS_XWALK_EXTENSION_PROCESS_H_
#include "base/values.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_listener.h"
#include "xwalk/extensions/common/xwalk_extension_server.h"
namespace base {
class FilePath;
}
namespace IPC {
class SyncChannel;
}
namespace xwalk {
namespace extensions {
class XWalkExtension;
class XWalkExtensionRunner;
// This class represents the Extension Process itself.
// It not only represents the extension side of the browser <->
// extension process communication channel, but also the extension side
// of the extension <-> render process channel.
// It will be responsible for handling the native side (instances) of
// External extensions through its XWalkExtensionServer.
class XWalkExtensionProcess : public IPC::Listener {
public:
XWalkExtensionProcess();
virtual ~XWalkExtensionProcess();
private:
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// Handlers for IPC messages from XWalkExtensionProcessHost.
void OnRegisterExtensions(const base::FilePath& extension_path);
void CreateBrowserProcessChannel();
void CreateRenderProcessChannel();
base::WaitableEvent shutdown_event_;
base::Thread io_thread_;
scoped_ptr<IPC::SyncChannel> browser_process_channel_;
XWalkExtensionServer extensions_server_;
scoped_ptr<IPC::SyncChannel> render_process_channel_;
IPC::ChannelHandle rp_channel_handle_;
DISALLOW_COPY_AND_ASSIGN(XWalkExtensionProcess);
};
} // namespace extensions
} // namespace xwalk
#endif // XWALK_EXTENSIONS_EXTENSION_PROCESS_XWALK_EXTENSION_PROCESS_H_
|
// This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once
#include <cstdint>
#include <string>
#include "galaxy.h"
namespace swganh {
namespace service {
class ServiceDescription {
public:
ServiceDescription();
/*! This overloaded constructor is used when describing a service to register.
*
* @param type The type of the service.
* @param version The version of the service.
* @param address The address to communicate with the service.
* @param tcp_port The tcp port to connect to the service on, default to 0 if not used.
* @param udp_port The udp port to connect to the service on, default to 0 if not used.
* @param status The current status of the service.
* @param last_pulse The last time the service synced with the data store.
*/
ServiceDescription(const std::string& name,
const std::string& type,
const std::string& version,
const std::string& address,
uint16_t tcp_port,
uint16_t udp_port,
uint16_t ping_port);
/*! This overloaded constructor is used when creating an instance from
* the data store.
*
* @param id The id of the service in the data store.
* @param galaxy_id The id of the galaxy this service belongs to.
* @param type The type of the service.
* @param version The version of the service.
* @param address The address to communicate with the service.
* @param tcp_port The tcp port to connect to the service on, default to 0 if not used.
* @param udp_port The udp port to connect to the service on, default to 0 if not used.
* @param status The current status of the service.
* @param last_pulse The last time the service synced with the data store.
*/
ServiceDescription(uint32_t id,
uint32_t galaxy_id,
const std::string& name,
const std::string& type,
const std::string& version,
const std::string& address,
uint16_t tcp_port,
uint16_t udp_port,
uint16_t ping_port);
/// Destructor
~ServiceDescription();
/// Copy constructor.
ServiceDescription(const ServiceDescription& other);
/// Move constructor.
ServiceDescription(ServiceDescription&& other);
/// Swap the contents of two HashStrings.
void swap(ServiceDescription& other);
/// Universal assignment operator.
ServiceDescription& operator=(ServiceDescription other);
/// Equals Operator.
bool operator==(ServiceDescription other)
{
return this->id_ == other.id_;
}
/// Not Equals Operator.
bool operator!=(ServiceDescription other)
{
return this->id_ != other.id_;
}
/*! Returns the id of the service in the data store.
*
* @return Returns the id of the service in the data store.
*/
uint32_t id() const;
void id(uint32_t id);
/*! Returns The id of the galaxy this service belongs to.
*
* @return Returns The id of the galaxy this service belongs to.
*/
uint32_t galaxy_id() const;
/*! Returns The name of the service.
*
* @return Returns The name of the service.
*/
const std::string& name() const;
/*! Returns The type of the service.
*
* @return Returns The type of the service.
*/
const std::string& type() const;
/*! Returns the version of the service.
*
* @return Returns the version of the service.
*/
const std::string& version() const;
/*! Returns the address to communicate with the service.
*
* @return Returns the address to communicate with the service.
*/
const std::string& address() const;
/*! Returns the tcp port to connect to the service on, default to 0 if not used.
*
* @return Returns the tcp port to connect to the service on, default to 0 if not used.
*/
uint16_t tcp_port() const;
/*! Returns the udp port to connect to the service on, default to 0 if not used.
*
* @return Returns the udp port to connect to the service on, default to 0 if not used.
*/
uint16_t udp_port() const;
/*! Returns the ping port, default to 0 if not used.
*
* @return Returns the udp port, default to 0 if not used.
*/
uint16_t ping_port() const;
/*! Returns the current status of the service.
*
* @return Returns -1 if the service is not operational otherwise it returns
* the number of connected clients.
*/
int32_t status() const;
void status(int32_t new_status);
/*! Returns the last time the service synced with the data store.
*
* @return Returns the last time the service synced with the data store.
*/
const std::string& last_pulse() const;
void last_pulse(std::string last_pulse);
private:
friend class ServiceDirectory;
uint32_t id_;
uint32_t galaxy_id_;
std::string name_;
std::string type_;
std::string version_;
std::string address_;
uint16_t tcp_port_;
uint16_t udp_port_;
uint16_t ping_port_;
int32_t status_;
std::string last_pulse_;
};
} // namespace service
} // namespace swganh
|
#include <iostream>
using namespace std;
#include <assert.h>
#include <vector>
#include <string>
#include <map>
// data structure
// every frame has 31 joints
typedef struct
{
double data[31][3];
} mocapframe;
// load data
vector<mocapframe> loadcmudata()
{
// joints index
map<string, int> joints;
joints["root"] = 0;
joints["lhipjoint"] = 1;
joints["lfemur"] = 2;
joints["ltibia"] = 3;
joints["lfoot"] = 4;
joints["ltoes"] = 5;
joints["rhipjoint"] = 6;
joints["rfemur"] = 7;
joints["rtibia"] = 8;
joints["rfoot"] = 9;
joints["rtoes"] = 10;
joints["lowerback"] = 11;
joints["upperback"] = 12;
joints["thorax"] = 13;
joints["lowerneck"] = 14;
joints["upperneck"] = 15;
joints["head"] = 16;
joints["lclavicle"] = 17;
joints["lhumerus"] = 18;
joints["lradius"] = 19;
joints["lwrist"] = 20;
joints["lhand"] = 21;
joints["lfingers"] = 22;
joints["lthumb"] = 23;
joints["rclavicle"] = 24;
joints["rhumerus"] = 25;
joints["rradius"] = 26;
joints["rwrist"] = 27;
joints["rhand"] = 28;
joints["rfingers"] = 29;
joints["rthumb"] = 30;
// joints["RightHand_dum2"] = 31;
// joints["RightHandThumb"] = 32;
// result
vector<mocapframe> data;
int framenum, nowframe;
int jointnum, nowjoint;
// load file
FILE *fp = fopen("result.txt", "r");
while (!feof(fp))
{
fscanf(fp, "%d\t%d\n", &framenum, &jointnum);
assert(jointnum == 31);
for (int i = 0; i < framenum; i++)
{
fscanf(fp, "%d\n", &nowframe);
assert(nowframe == i);
// frame
mocapframe tmp;
char buf[50];
float x, y, z;
for (int j = 0; j < jointnum; j++)
{
fscanf(fp, "%s\t%f\t%f\t%f\n", buf, &x, &y, &z);
nowjoint = joints[buf];
tmp.data[nowjoint][0] = x;
tmp.data[nowjoint][1] = y;
tmp.data[nowjoint][2] = z;
}
data.push_back(tmp);
}
}
fclose(fp);
return data;
}
|
/*
*
* Copyright (C) 1997-2011, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmjpeg
*
* Author: Marco Eichelberg
*
* Purpose: Codec class for encoding JPEG Spectral Selection (lossy, 8/12-bit)
*
*/
#ifndef DJENCSPS_H
#define DJENCSPS_H
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmjpeg/djcodece.h" /* for class DJCodecEncoder */
/** Encoder class for JPEG Spectral Selection (lossy, 8/12-bit)
*/
class DCMTK_DCMJPEG_EXPORT DJEncoderSpectralSelection : public DJCodecEncoder
{
public:
/// default constructor
DJEncoderSpectralSelection();
/// destructor
virtual ~DJEncoderSpectralSelection();
/** returns the transfer syntax that this particular codec
* is able to encode and decode.
* @return supported transfer syntax
*/
virtual E_TransferSyntax supportedTransferSyntax() const;
private:
/** returns true if the transfer syntax supported by this
* codec is lossless.
* @return lossless flag
*/
virtual OFBool isLosslessProcess() const;
/** creates 'derivation description' string after encoding.
* @param toRepParam representation parameter passed to encode()
* @param cp codec parameter passed to encode()
* @param bitsPerSample bits per sample of the original image data prior to compression
* @param ratio image compression ratio. This is not the "quality factor"
* but the real effective ratio between compressed and uncompressed image,
* i. e. 30 means a 30:1 lossy compression.
* @param imageComments image comments returned in this
* parameter which is initially empty
*/
virtual void createDerivationDescription(
const DcmRepresentationParameter * toRepParam,
const DJCodecParameter *cp,
Uint8 bitsPerSample,
double ratio,
OFString& derivationDescription) const;
/** creates an instance of the compression library to be used
* for encoding/decoding.
* @param toRepParam representation parameter passed to encode()
* @param cp codec parameter passed to encode()
* @param bitsPerSample bits per sample for the image data
* @return pointer to newly allocated codec object
*/
virtual DJEncoder *createEncoderInstance(
const DcmRepresentationParameter * toRepParam,
const DJCodecParameter *cp,
Uint8 bitsPerSample) const;
};
#endif
|
/* Copyright (c) 2007 Christopher J. W. Lloyd
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 _NSDECIMAL_H_
#define _NSDECIMAL_H_
#include <limits.h>
#import <Foundation/NSObjCRuntime.h>
#define NSDecimalMaxSize (8)
#define NSDecimalNoScale SHRT_MAX
enum { NSRoundPlain, NSRoundDown, NSRoundUp, NSRoundBankers };
typedef uint32_t NSRoundingMode;
enum { NSCalculationNoError = 0, NSCalculationLossOfPrecision, NSCalculationUnderflow, NSCalculationOverflow, NSCalculationDivideByZero };
typedef uint32_t NSCalculationError;
typedef struct {
union {
signed int _exponent : 8;
unsigned int _length : 4;
unsigned int _isNegative : 1;
unsigned int _isCompact : 1;
unsigned int _reserved : 18;
unsigned short _mantissa[NSDecimalMaxSize];
};
double val;
} NSDecimal;
FOUNDATION_EXPORT BOOL NSDecimalIsNotANumber(const NSDecimal* dcm) STUB_METHOD;
FOUNDATION_EXPORT NSString* NSDecimalString(const NSDecimal* dcm, id locale) STUB_METHOD;
FOUNDATION_EXPORT NSComparisonResult NSDecimalCompare(const NSDecimal* leftOperand, const NSDecimal* rightOperand);
FOUNDATION_EXPORT NSCalculationError NSDecimalAdd(NSDecimal* result,
const NSDecimal* leftOperand,
const NSDecimal* rightOperand,
NSRoundingMode roundingMode) STUB_METHOD;
FOUNDATION_EXPORT NSCalculationError NSDecimalSubtract(NSDecimal* result,
const NSDecimal* leftOperand,
const NSDecimal* rightOperand,
NSRoundingMode roundingMode) STUB_METHOD;
FOUNDATION_EXPORT NSCalculationError NSDecimalMultiply(NSDecimal* result,
const NSDecimal* leftOperand,
const NSDecimal* rightOperand,
NSRoundingMode roundingMode) STUB_METHOD;
FOUNDATION_EXPORT NSCalculationError NSDecimalDivide(NSDecimal* result,
const NSDecimal* leftOperand,
const NSDecimal* rightOperand,
NSRoundingMode roundingMode) STUB_METHOD;
FOUNDATION_EXPORT void NSDecimalRound(NSDecimal* result, const NSDecimal* number, NSInteger scale, NSRoundingMode roundingMode) STUB_METHOD;
#endif /* _NSDECIMAL_H_ */ |
/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
#ifndef __dom141Accessor_h__
#define __dom141Accessor_h__
#include <dae/daeDocument.h>
#include <1.4/dom/domTypes.h>
#include <1.4/dom/domElements.h>
#include <1.4/dom/domParam.h>
class DAE;
namespace ColladaDOM141 {
/**
* The accessor element declares an access pattern to one of the array elements:
* float_array, int_array, Name_array, bool_array, and IDREF_array. The accessor
* element describes access to arrays that are organized in either an interleaved
* or non-interleaved manner, depending on the offset and stride attributes.
*/
class domAccessor : public daeElement
{
public:
virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::ACCESSOR; }
static daeInt ID() { return 609; }
virtual daeInt typeID() const { return ID(); }
protected: // Attributes
/**
* The count attribute indicates the number of times the array is accessed.
* Required attribute.
*/
domUint attrCount;
/**
* The offset attribute indicates the index of the first value to be read
* from the array. The default value is 0. Optional attribute.
*/
domUint attrOffset;
/**
* The source attribute indicates the location of the array to access using
* a URL expression. Required attribute.
*/
xsAnyURI attrSource;
/**
* The stride attribute indicates number of values to be considered a unit
* during each access to the array. The default value is 1, indicating that
* a single value is accessed. Optional attribute.
*/
domUint attrStride;
protected: // Element
/**
* The accessor element may have any number of param elements. @see domParam
*/
domParam_Array elemParam_array;
public: //Accessors and Mutators
/**
* Gets the count attribute.
* @return Returns a domUint of the count attribute.
*/
domUint getCount() const { return attrCount; }
/**
* Sets the count attribute.
* @param atCount The new value for the count attribute.
*/
void setCount( domUint atCount ) { attrCount = atCount; _validAttributeArray[0] = true; }
/**
* Gets the offset attribute.
* @return Returns a domUint of the offset attribute.
*/
domUint getOffset() const { return attrOffset; }
/**
* Sets the offset attribute.
* @param atOffset The new value for the offset attribute.
*/
void setOffset( domUint atOffset ) { attrOffset = atOffset; _validAttributeArray[1] = true; }
/**
* Gets the source attribute.
* @return Returns a xsAnyURI reference of the source attribute.
*/
xsAnyURI &getSource() { return attrSource; }
/**
* Gets the source attribute.
* @return Returns a constant xsAnyURI reference of the source attribute.
*/
const xsAnyURI &getSource() const { return attrSource; }
/**
* Sets the source attribute.
* @param atSource The new value for the source attribute.
*/
void setSource( const xsAnyURI &atSource ) { attrSource = atSource; _validAttributeArray[2] = true; }
/**
* Sets the source attribute.
* @param atSource The new value for the source attribute.
*/
void setSource( xsString atSource ) { attrSource = atSource; _validAttributeArray[2] = true; }
/**
* Gets the stride attribute.
* @return Returns a domUint of the stride attribute.
*/
domUint getStride() const { return attrStride; }
/**
* Sets the stride attribute.
* @param atStride The new value for the stride attribute.
*/
void setStride( domUint atStride ) { attrStride = atStride; _validAttributeArray[3] = true; }
/**
* Gets the param element array.
* @return Returns a reference to the array of param elements.
*/
domParam_Array &getParam_array() { return elemParam_array; }
/**
* Gets the param element array.
* @return Returns a constant reference to the array of param elements.
*/
const domParam_Array &getParam_array() const { return elemParam_array; }
protected:
/**
* Constructor
*/
domAccessor(DAE& dae) : daeElement(dae), attrCount(), attrOffset(), attrSource(dae, *this), attrStride(), elemParam_array() {}
/**
* Destructor
*/
virtual ~domAccessor() {}
/**
* Overloaded assignment operator
*/
virtual domAccessor &operator=( const domAccessor &cpy ) { (void)cpy; return *this; }
public: // STATIC METHODS
/**
* Creates an instance of this class and returns a daeElementRef referencing it.
* @return a daeElementRef referencing an instance of this object.
*/
static DLLSPEC daeElementRef create(DAE& dae);
/**
* Creates a daeMetaElement object that describes this element in the meta object reflection framework.
* If a daeMetaElement already exists it will return that instead of creating a new one.
* @return A daeMetaElement describing this COLLADA element.
*/
static DLLSPEC daeMetaElement* registerElement(DAE& dae);
};
} // ColladaDOM141
#endif
|
/* Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
This file is part of Ghostscript.
Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.
Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
given to you along with Ghostscript so you can know your rights and
responsibilities. It should be in a file named COPYING. Among other
things, the copyright notice and this notice must be preserved on all
copies. */
/* zpath2.c */
/* Non-constructor path operators for GhostScript */
#include "ghost.h"
#include "oper.h"
#include "errors.h"
#include "alloc.h"
#include "estack.h" /* for pathforall */
#include "gspath.h"
#include "state.h"
#include "store.h"
/* flattenpath */
int
zflattenpath(register ref *op)
{ return gs_flattenpath(igs);
}
/* reversepath */
int
zreversepath(register ref *op)
{ return gs_reversepath(igs);
}
/* strokepath */
int
zstrokepath(register ref *op)
{ return gs_strokepath(igs);
}
/* clippath */
int
zclippath(register ref *op)
{ return gs_clippath(igs);
}
/* pathbbox */
int
zpathbbox(register ref *op)
{ gs_rect box;
int code = gs_pathbbox(igs, &box);
if ( code < 0 ) return code;
push(4);
make_real(op - 3, box.p.x);
make_real(op - 2, box.p.y);
make_real(op - 1, box.q.x);
make_real(op, box.q.y);
return 0;
}
/* pathforall */
private int path_continue(P1(ref *));
int
zpathforall(register ref *op)
{ gs_path_enum *penum;
check_op(4);
check_estack(8);
if ( (penum = (gs_path_enum *)alloc(1, gs_path_enum_sizeof, "pathforall")) == 0 )
return e_VMerror;
gs_path_enum_init(penum, igs);
/* Push a mark, the four procedures, and a pseudo-integer */
/* in which value.bytes points to the path enumerator, */
/* and then call the continuation procedure. */
mark_estack(es_for); /* iterator */
*++esp = op[-3]; /* moveto proc */
*++esp = op[-2]; /* lineto proc */
*++esp = op[-1]; /* curveto proc */
*++esp = *op; /* closepath proc */
++esp;
make_tv(esp, t_integer, bytes, (byte *)penum);
pop(4); op -= 4;
return path_continue(op);
}
/* Continuation procedure for pathforall */
private int pf_push(P3(gs_point *, int, ref *));
private int
path_continue(register ref *op)
{ gs_path_enum *penum = (gs_path_enum *)esp->value.bytes;
gs_point ppts[3];
int code;
code = gs_path_enum_next(penum, ppts);
switch ( code )
{
case 0: /* all done */
{ alloc_free((char *)penum, 1, gs_path_enum_sizeof, "pathforall");
esp -= 6;
return o_check_estack;
}
default: /* error */
return code;
case gs_pe_moveto:
esp[2] = esp[-4]; /* moveto proc */
code = pf_push(ppts, 1, op);
break;
case gs_pe_lineto:
esp[2] = esp[-3]; /* lineto proc */
code = pf_push(ppts, 1, op);
break;
case gs_pe_curveto:
esp[2] = esp[-2]; /* curveto proc */
code = pf_push(ppts, 3, op);
break;
case gs_pe_closepath:
esp[2] = esp[-1]; /* closepath proc */
code = 0;
break;
}
if ( code < 0 ) return code; /* ostack overflow in pf_push */
push_op_estack(path_continue);
++esp; /* include pushed procedure */
return o_check_estack;
}
/* Internal procedure to push one or more points */
private int
pf_push(gs_point *ppts, int n, ref *op)
{ while ( n-- )
{ push(2);
make_real(op - 1, ppts->x);
make_real(op, ppts->y);
ppts++;
}
return 0;
}
/* initclip */
int
zinitclip(register ref *op)
{ return gs_initclip(igs);
}
/* clip */
int
zclip(register ref *op)
{ return gs_clip(igs);
}
/* eoclip */
int
zeoclip(register ref *op)
{ return gs_eoclip(igs);
}
/* ------ Initialization procedure ------ */
void
zpath2_op_init()
{ static op_def my_defs[] = {
{"0clip", zclip},
{"0clippath", zclippath},
{"0eoclip", zeoclip},
{"0flattenpath", zflattenpath},
{"0initclip", zinitclip},
{"0pathbbox", zpathbbox},
{"4pathforall", zpathforall},
{"0reversepath", zreversepath},
{"0strokepath", zstrokepath},
op_def_end
};
z_op_init(my_defs);
}
|
/*
* BMKLocationViewDisplayParam.h
* BMapKit
*
* Copyright 2013 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
/**
LocationView在mapview上显示的层级
- LOCATION_VIEW_HIERARCHY_TOP: locationView在最上层
- LOCATION_VIEW_HIERARCHY_BOTTOM: locationView在最下层
*/
typedef NS_ENUM(NSUInteger, LocationViewHierarchy) {
LOCATION_VIEW_HIERARCHY_TOP,
LOCATION_VIEW_HIERARCHY_BOTTOM,
};
///此类表示定位图层自定义样式参数
@interface BMKLocationViewDisplayParam : NSObject
///定位图标X轴偏移量(屏幕坐标)
@property (nonatomic, assign) CGFloat locationViewOffsetX;
///定位图标Y轴偏移量(屏幕坐标)
@property (nonatomic, assign) CGFloat locationViewOffsetY;
///精度圈是否显示,默认YES
@property (nonatomic, assign) BOOL isAccuracyCircleShow;
///精度圈 填充颜色
@property (nonatomic, strong) UIColor *accuracyCircleFillColor;
///精度圈 边框颜色
@property (nonatomic, strong) UIColor *accuracyCircleStrokeColor;
///跟随态旋转角度是否生效,默认YES
@property (nonatomic, assign) BOOL isRotateAngleValid;
///定位图标名称,需要将该图片放到 mapapi.bundle/images 目录下
@property (nonatomic, strong) NSString* locationViewImgName;
///是否显示气泡,默认YES
@property (nonatomic, assign) BOOL canShowCallOut;
///locationView在mapview上的层级 默认值为LOCATION_VIEW_HIERARCHY_BOTTOM
@property (nonatomic, assign) LocationViewHierarchy locationViewHierarchy;
@end
|
#pragma once
namespace pangolin {
const std::string default_model_shader = R"Shader(
/////////////////////////////////////////
@start vertex
#version 120
#expect SHOW_COLOR
#expect SHOW_NORMAL
#expect SHOW_TEXTURE
#expect SHOW_MATCAP
#expect SHOW_UV
uniform mat4 T_cam_norm;
uniform mat4 KT_cw;
attribute vec3 vertex;
#if SHOW_COLOR
attribute vec4 color;
varying vec4 vColor;
void main() {
vColor = color;
#elif SHOW_NORMAL
attribute vec3 normal;
varying vec3 vNormal;
void main() {
vNormal = mat3(T_cam_norm) * normal;
#elif SHOW_TEXTURE
attribute vec2 uv;
varying vec2 vUV;
void main() {
vUV = uv;
#elif SHOW_MATCAP
attribute vec3 normal;
varying vec3 vNormalCam;
void main() {
vNormalCam = mat3(T_cam_norm) * normal;
#elif SHOW_UV
attribute vec2 uv;
varying vec2 vUV;
void main() {
vUV = uv;
#else
varying vec3 vP;
void main() {
vP = vertex;
#endif
gl_Position = KT_cw * vec4(vertex, 1.0);
}
/////////////////////////////////////////
@start fragment
#version 120
#expect SHOW_COLOR
#expect SHOW_NORMAL
#expect SHOW_TEXTURE
#expect SHOW_MATCAP
#expect SHOW_UV
#if SHOW_COLOR
varying vec4 vColor;
#elif SHOW_NORMAL
varying vec3 vNormal;
#elif SHOW_TEXTURE
varying vec2 vUV;
uniform sampler2D texture_0;
#elif SHOW_MATCAP
varying vec3 vNormalCam;
uniform sampler2D matcap;
#elif SHOW_UV
varying vec2 vUV;
#else
varying vec3 vP;
#endif
void main() {
#if SHOW_COLOR
gl_FragColor = vColor;
#elif SHOW_NORMAL
gl_FragColor = vec4((vNormal + vec3(1.0,1.0,1.0)) / 2.0, 1.0);
#elif SHOW_TEXTURE
gl_FragColor = texture2D(texture_0, vUV);
#elif SHOW_MATCAP
vec2 uv = 0.5 * vNormalCam.xy + vec2(0.5, 0.5);
gl_FragColor = texture2D(matcap, uv);
#elif SHOW_UV
gl_FragColor = vec4(vUV,1.0-vUV.x,1.0);
#else
gl_FragColor = vec4(vP / 100.0,1.0);
#endif
}
)Shader";
const std::string equi_env_shader = R"Shader(
/////////////////////////////////////////
@start vertex
#version 120
attribute vec2 vertex;
attribute vec2 xy;
varying vec2 vXY;
void main() {
vXY = xy;
gl_Position = vec4(vertex,0.0,1.0);
}
@start fragment
#version 120
#define M_PI 3.1415926538
uniform sampler2D texture_0;
uniform mat3 R_env_camKinv;
varying vec2 vXY;
vec2 RayToEquirect(vec3 ray)
{
float n = 1.0;
float m = 1.0;
float lamda = acos(ray.y/sqrt(1.0-ray.z*ray.z));
if(ray.x < 0) lamda = -lamda;
float phi = asin(ray.z);
float u = n*lamda/(2.0*M_PI)+n/2.0;
float v = m/2.0 + m*phi/M_PI;
return vec2(u,v);
}
void main() {
vec3 ray_env = normalize(R_env_camKinv * vec3(vXY, 1.0));
gl_FragColor = texture2D(texture_0, RayToEquirect(ray_env));
}
)Shader";
}
|
/*
* Copyright (c) 2003-2014 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation, Steven Munroe - initial API and implementation
*/
#ifndef __SAS_STORE_NAME_H
#define __SAS_STORE_NAME_H
#include "sassim.h"
#ifdef __cplusplus
#define __C__ "C"
#else
#define __C__
#endif
extern __C__ char *sasStorePath;
extern __C__ char *SASSegNameIndexed(char *name, sasseg_t segnum);
extern __C__ int SASSegNameExists(char *name);
extern __C__ int SASSegIndexExists (sasseg_t segnum);
extern __C__ int SASSegStoreCreateByName (char *name);
extern __C__ int SASSegStoreCreate (sasseg_t segnum);
extern __C__ int SASSegStoreRemoveByName (char *name);
extern __C__ int SASSegStoreRemove (sasseg_t segnum);
#endif /* _SAS_STORE_NAME_H */
|
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Copyright (C) 2008 Sun Microsystems, Inc.
* Copyright (C) 2010 Monty Taylor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include <signal.h>
#include <cstdlib>
#include <cassert>
static bool volatile signal_thread_in_use= false;
extern "C" void drizzled_print_signal_warning(int sig);
extern "C" void drizzled_handle_segfault(int sig);
extern "C" void drizzled_end_thread_signal(int sig);
extern "C" void drizzled_sigint_handler(int sig);
/*
posix sigaction() based signal handler implementation
On some systems, such as Mac OS X, sigset() results in flags
such as SA_RESTART being set, and we want to make sure that no such
flags are set.
*/
static inline void ignore_signal(int sig)
{
/* Wow. There is a function sigaction which takes a pointer to a
struct sigaction. */
struct sigaction l_s;
sigset_t l_set;
sigemptyset(&l_set);
assert(sig != 0);
l_s.sa_handler= SIG_IGN;
l_s.sa_mask= l_set;
l_s.sa_flags= 0;
int l_rc= sigaction(sig, &l_s, NULL);
assert(l_rc == 0);
}
|
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPLATFORMFONTDATABASE_QPA_H
#define QPLATFORMFONTDATABASE_QPA_H
#include <QtCore/qconfig.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>
#include <QtGui/QFontDatabase>
#include <QtGui/private/qfont_p.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QWritingSystemsPrivate;
class Q_GUI_EXPORT QSupportedWritingSystems
{
public:
QSupportedWritingSystems();
QSupportedWritingSystems(const QSupportedWritingSystems &other);
QSupportedWritingSystems &operator=(const QSupportedWritingSystems &other);
~QSupportedWritingSystems();
void setSupported(QFontDatabase::WritingSystem, bool supported = true);
bool supported(QFontDatabase::WritingSystem) const;
private:
void detach();
QWritingSystemsPrivate *d;
friend Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
friend Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
};
Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
class QFontRequestPrivate;
class Q_GUI_EXPORT QPlatformFontDatabase
{
public:
virtual void populateFontDatabase();
virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const;
virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
virtual void releaseHandle(void *handle);
virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
virtual QString fontDir() const;
//callback
static void registerQPF2Font(const QByteArray &dataArray, void *handle);
static void registerFont(const QString &familyname, const QString &foundryname, QFont::Weight weight,
QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize,
const QSupportedWritingSystems &writingSystems, void *handle);
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QPLATFORMFONTDATABASE_QPA_H
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class beecrypt_provider_MD4 */
#ifndef _Included_beecrypt_provider_MD4
#define _Included_beecrypt_provider_MD4
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: beecrypt_provider_MD4
* Method: allocParam
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_beecrypt_provider_MD4_allocParam
(JNIEnv *, jclass);
/*
* Class: beecrypt_provider_MD4
* Method: cloneParam
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_beecrypt_provider_MD4_cloneParam
(JNIEnv *, jclass, jlong);
/*
* Class: beecrypt_provider_MD4
* Method: freeParam
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_freeParam
(JNIEnv *, jclass, jlong);
/*
* Class: beecrypt_provider_MD4
* Method: digest
* Signature: (J)[B
*/
JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_MD4_digest__J
(JNIEnv *, jclass, jlong);
/*
* Class: beecrypt_provider_MD4
* Method: digest
* Signature: (J[BII)I
*/
JNIEXPORT jint JNICALL Java_beecrypt_provider_MD4_digest__J_3BII
(JNIEnv *, jclass, jlong, jbyteArray, jint, jint);
/*
* Class: beecrypt_provider_MD4
* Method: reset
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_reset
(JNIEnv *, jclass, jlong);
/*
* Class: beecrypt_provider_MD4
* Method: update
* Signature: (JB)V
*/
JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_update__JB
(JNIEnv *, jclass, jlong, jbyte);
/*
* Class: beecrypt_provider_MD4
* Method: update
* Signature: (J[BII)V
*/
JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_update__J_3BII
(JNIEnv *, jclass, jlong, jbyteArray, jint, jint);
#ifdef __cplusplus
}
#endif
#endif
|
/* Copyright (C) 1991, 1995, 1996, 1997 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 <errno.h>
#include <signal.h>
int
__sigsetmask (mask)
int mask;
{
__set_errno (ENOSYS);
return -1;
}
stub_warning (sigsetmask)
weak_alias (__sigsetmask, sigsetmask)
|
/*
* Memory barrier definitions. This is based on information published
* in the Processor Abstraction Layer and the System Abstraction Layer
* manual.
*
* Copyright (C) 1998-2003 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com>
* Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
* Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
*/
#ifndef _ASM_IA64_BARRIER_H
#define _ASM_IA64_BARRIER_H
#include <linux/compiler.h>
/*
* Macros to force memory ordering. In these descriptions, "previous"
* and "subsequent" refer to program order; "visible" means that all
* architecturally visible effects of a memory access have occurred
* (at a minimum, this means the memory has been read or written).
*
* wmb(): Guarantees that all preceding stores to memory-
* like regions are visible before any subsequent
* stores and that all following stores will be
* visible only after all previous stores.
* rmb(): Like wmb(), but for reads.
* mb(): wmb()/rmb() combo, i.e., all previous memory
* accesses are visible before all subsequent
* accesses and vice versa. This is also known as
* a "fence."
*
* Note: "mb()" and its variants cannot be used as a fence to order
* accesses to memory mapped I/O registers. For that, mf.a needs to
* be used. However, we don't want to always use mf.a because (a)
* it's (presumably) much slower than mf and (b) mf.a is supported for
* sequential memory pages only.
*/
#define mb() ia64_mf()
#define rmb() mb()
#define wmb() mb()
#define read_barrier_depends() do { } while(0)
#ifdef CONFIG_SMP
# define smp_mb() mb()
# define smp_rmb() rmb()
# define smp_wmb() wmb()
# define smp_read_barrier_depends() read_barrier_depends()
#else
# define smp_mb() barrier()
# define smp_rmb() barrier()
# define smp_wmb() barrier()
# define smp_read_barrier_depends() do { } while(0)
#endif
/*
* IA64 GCC turns volatile stores into st.rel and volatile loads into ld.acq no
* need for asm trickery!
*/
#define smp_store_release(p, v) \
do { \
compiletime_assert_atomic_type(*p); \
barrier(); \
ACCESS_ONCE_RW(*p) = (v); \
} while (0)
#define smp_load_acquire(p) \
({ \
typeof(*p) ___p1 = ACCESS_ONCE(*p); \
compiletime_assert_atomic_type(*p); \
barrier(); \
___p1; \
})
/*
* XXX check on this ---I suspect what Linus really wants here is
* acquire vs release semantics but we can't discuss this stuff with
* Linus just yet. Grrr...
*/
#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
/*
* The group barrier in front of the rsm & ssm are necessary to ensure
* that none of the previous instructions in the same group are
* affected by the rsm/ssm.
*/
#endif /* _ASM_IA64_BARRIER_H */
|
/*
* Copyright (C) 2017 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this Program; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "cores/IPlayer.h"
class CGameSettings
{
public:
CGameSettings() { Reset(); }
// Restore game settings to default
void Reset();
ESCALINGMETHOD ScalingMethod() const { return m_scalingMethod; }
void SetScalingMethod(ESCALINGMETHOD scalingMethod) { m_scalingMethod = scalingMethod; }
int ViewMode() const { return m_viewMode; }
void SetViewMode(int viewMode) { m_viewMode = viewMode; }
private:
// Video settings
ESCALINGMETHOD m_scalingMethod;
int m_viewMode;
};
|
/*****************************************************************************/
/*!
* \file mrv_smia_mipi.h \n
* \version 1.0 \n
* \author Zupp \n
* \brief Header file for Marvin SMIA low level driver functionality. \n
* This file contains all module relevant function prototypes
* and definitions. \n
*
* \revision $Revision: 432 $ \n
* $Author: neugebaa $ \n
* $Date: 2009-06-30 11:48:59 +0200 (Di, 30 Jun 2009) $ \n
* $Id: mrv_smia_mipi.h 432 2009-06-30 09:48:59Z neugebaa $ \n
*/
/* This is an unpublished work, the copyright in which vests in Silicon Image
* GmbH. The information contained herein is the property of Silicon Image GmbH
* and is supplied without liability for errors or omissions. No part may be
* reproduced or used expect as authorized by contract or other written
* permission. Copyright(c) Silicon Image GmbH, 2009, all rights reserved.
*/
/*****************************************************************************/
#ifndef _MRV_SMIA_MIPI_H
#define _MRV_SMIA_MIPI_H
/******************************************************************************
* Defines
******************************************************************************/
#if (MARVIN_FEATURE_SMIA == MARVIN_FEATURE_SMIA_MIPI_EMP)
#define SMIA_INTRPT_FIFO_FILL_LEVEL 0x00000020 // mask for SMIA fifo fill level interrupt
#define SMIA_INTRPT_EMB_DATA_OVFLW 0x00000002 // mask for SMIA embedded data overflow interrupt
#define SMIA_INTRPT_FRAME_END 0x00000001 // mask for SMIA frame end interrupt
#define SMIA_INTRPT_ALL 0x00000023 // mask for all SMIA interrupts
#endif //#if( MARVIN_FEATURE_SMIA == MARVIN_FEATURE_SMIA_MIPI_EMP )
#if (MARVIN_FEATURE_SMIA == MARVIN_FEATURE_SMIA_MIPI_EMP)
#define SMIA_PIC_FORMAT_RAW_12 0x0000000C // mask for SMIA
#define SMIA_PIC_FORMAT_RAW_8_TO_10_DECOMP 0x0000000D // mask for SMIA
#define SMIA_PIC_FORMAT_RAW_10 0x0000000B // mask for SMIA
#define SMIA_PIC_FORMAT_RAW_8 0x0000000A // mask for SMIA
#define SMIA_PIC_FORMAT_YUV_422 0x00000000 // mask for SMIA
#endif //#if( MARVIN_FEATURE_SMIA == MARVIN_FEATURE_SMIA_MIPI_EMP )
/******************************************************************************
* Public SMIA/MIPI Interface
******************************************************************************/
#if (MARVIN_FEATURE_SMIA == MARVIN_FEATURE_SMIA_MIPI_EMP)
RESULT MrvSmiaMipiInitializeModule( void );
RESULT MrvSmiaMipiGetControlRegisterStatus( UINT32 *puSmiaControlRegisterStatus );
RESULT MrvSmiaMipiSetControlRegisterStatus( const UINT32 uSmiaControlRegisterStatus );
RESULT MrvSmiaMipiActivateModule( const BOOL bModuleActive );
RESULT MrvSmiaMipiActivateCfgUpdateSignal( const BOOL bCfgUpdateSignalActive );
RESULT MrvSmiaMipiResetInterrups( void );
RESULT MrvSmiaMipiFreeEmbDataFifo( void );
RESULT MrvSmiaMipiEmbDataAvailabe( BOOL *pbEmbDataAvail );
RESULT MrvSmiaMipiActivateInterrupts( const UINT32 uActivatedInterrupt );
RESULT MrvSmiaMipiGetImscRegister( UINT32 *puActivatedInterrupt );
RESULT MrvSmiaMipiGetGeneralInterruptState( UINT32 *puGeneralInterruptStatus );
RESULT MrvSmiaMipiGetActivatedInterruptState( UINT32 *puActivatedInterruptStatus );
RESULT MrvSmiaMipiSetInterruptRegister( const UINT32 uInterruptRegisterMask, const UINT32 uNewInterruptRegisterValue );
RESULT MrvSmiaMipiSetPictureFormat( const UINT32 uPictureFormat );
RESULT MrvSmiaMipiGetPictureFormat( UINT32 *puPictureFormat );
RESULT MrvSmiaMipiSetFrameLines( const UINT32 uNumOfEmbDataLines, const UINT32 uNumOfPicDataLines );
RESULT MrvSmiaMipiGetFrameLines( UINT32 *puNumOfEmbDataLines, UINT32 *puNumOfPicDataLines );
RESULT MrvSmiaMipiSetEmbDataStorage( const tsMrvWindow *ptsEmbDataWindow1, const tsMrvWindow *ptsEmbDataWindow2 );
RESULT MrvSmiaMipiGetEmbDataStorage( tsMrvWindow *ptsEmbDataWindow1, tsMrvWindow *ptsEmbDataWindow2 );
RESULT MrvSmiaMipiGetEmbData(UINT8 *puDestEmbDataBuffer, const UINT32 ulDestEmbDataBufSize, UINT32 *puNumOfEmbDataBytes);
RESULT MrvSmiaMipiSetEmbDataFillLevel( const UINT32 ulFillLevel );
RESULT MrvSmiaMipiGetEmbDataFillLevel( UINT32 *pulFillLevel );
#endif //#if (MARVIN_FEATURE_SMIA == MARVIN_FEATURE_SMIA_MIPI_EMP)
#endif //#ifndef _MRV_SMIA_MIPI_H
|
#ifndef __CUST_KEY_H__
#define __CUST_KEY_H__
#include<cust_kpd.h>
#define MT65XX_META_KEY 42 /* KEY_2 */
//#define MT65XX_PMIC_RST_KEY 23
#define MT_CAMERA_KEY 10
#define MT65XX_BOOT_MENU_KEY 0 /* KEY_VOLUMEUP */
#define MT65XX_MENU_SELECT_KEY MT65XX_BOOT_MENU_KEY
#define MT65XX_MENU_OK_KEY 9 /* KEY_VOLUMEDOWN */
#endif /* __CUST_KEY_H__ */
|
/****************************************************************************
**
** Copyright (C) 2000-2008 TROLLTECH ASA. All rights reserved.
**
** This file is part of the Opensource Edition of the Qtopia Toolkit.
**
** This software is licensed under the terms of the GNU General Public
** License (GPL) version 2.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef C3200HARDWARE_H
#define C3200HARDWARE_H
#ifdef QT_QWS_C3200
#include <QObject>
#include <QProcess>
#include <QAudioStateConfiguration>
#include <QAudioStateInfo>
#include <qaudionamespace.h>
#include <QtopiaIpcEnvelope>
#include <qvaluespace.h>
class QSocketNotifier;
class QtopiaIpcAdaptor;
class QPowerSourceProvider;
class QAudioStateConfiguration;
class C3200Hardware : public QObject
{
Q_OBJECT
public:
C3200Hardware();
~C3200Hardware();
private:
QValueSpaceObject vsoPortableHandsfree;
QSocketNotifier *m_notifyDetect;
int detectFd;
QPowerSourceProvider *batterySource;
QPowerSourceProvider *wallSource;
QtopiaIpcAdaptor *mgr;
QAudioStateConfiguration *audioConf;
private slots:
void readDetectData();
void shutdownRequested();
void chargingChanged(bool charging);
void chargeChanged(int charge);
void availabilityChanged();
void currentStateChanged(const QAudioStateInfo &state, QAudio::AudioCapability capability);
};
#endif // QT_QWS_C3200
#endif // C3200HARDWARE_H
|
/*
* STMicroelectronics lsm6ds3 i2c driver
*
* Copyright 2014 STMicroelectronics Inc.
*
* Giuseppe Barba <giuseppe.barba@st.com>
* v 1.1.0
* Licensed under the GPL-2.
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <linux/hrtimer.h>
#include <linux/input.h>
#include <linux/types.h>
#include <linux/platform_data/lsm6ds3.h>
#include "lsm6ds3_core.h"
#define SENSORS_SPI_READ 0x80
static int lsm6ds3_spi_read(struct lsm6ds3_data *cdata, u8 reg_addr, int len,
u8 *data, bool b_lock)
{
int err;
struct spi_transfer xfers[] = {
{
.tx_buf = cdata->tb.tx_buf,
.bits_per_word = 8,
.len = 1,
},
{
.rx_buf = cdata->tb.rx_buf,
.bits_per_word = 8,
.len = len,
}
};
if (b_lock)
mutex_lock(&cdata->bank_registers_lock);
mutex_lock(&cdata->tb.buf_lock);
cdata->tb.tx_buf[0] = reg_addr | SENSORS_SPI_READ;
err = spi_sync_transfer(to_spi_device(cdata->dev),
xfers, ARRAY_SIZE(xfers));
if (err)
goto acc_spi_read_error;
memcpy(data, cdata->tb.rx_buf, len*sizeof(u8));
mutex_unlock(&cdata->tb.buf_lock);
if (b_lock)
mutex_unlock(&cdata->bank_registers_lock);
return len;
acc_spi_read_error:
mutex_unlock(&cdata->tb.buf_lock);
if (b_lock)
mutex_unlock(&cdata->bank_registers_lock);
return err;
}
static int lsm6ds3_spi_write(struct lsm6ds3_data *cdata, u8 reg_addr, int len,
u8 *data, bool b_lock)
{
int err;
struct spi_transfer xfers = {
.tx_buf = cdata->tb.tx_buf,
.bits_per_word = 8,
.len = len + 1,
};
if (len >= LSM6DS3_RX_MAX_LENGTH)
return -ENOMEM;
if (b_lock)
mutex_lock(&cdata->bank_registers_lock);
mutex_lock(&cdata->tb.buf_lock);
cdata->tb.tx_buf[0] = reg_addr;
memcpy(&cdata->tb.tx_buf[1], data, len);
err = spi_sync_transfer(to_spi_device(cdata->dev), &xfers, 1);
mutex_unlock(&cdata->tb.buf_lock);
if (b_lock)
mutex_unlock(&cdata->bank_registers_lock);
return err;
}
static const struct lsm6ds3_transfer_function lsm6ds3_tf_spi = {
.write = lsm6ds3_spi_write,
.read = lsm6ds3_spi_read,
};
static int lsm6ds3_spi_probe(struct spi_device *spi)
{
int err;
struct lsm6ds3_data *cdata;
cdata = kmalloc(sizeof(*cdata), GFP_KERNEL);
if (!cdata)
return -ENOMEM;
cdata->dev = &spi->dev;
cdata->name = spi->modalias;
cdata->tf = &lsm6ds3_tf_spi;
spi_set_drvdata(spi, cdata);
err = lsm6ds3_common_probe(cdata, spi->irq, BUS_SPI);
if (err < 0)
goto free_data;
return 0;
free_data:
kfree(cdata);
return err;
}
static int lsm6ds3_spi_remove(struct spi_device *spi)
{
/* TODO: check the function */
struct lsm6ds3_data *cdata = spi_get_drvdata(spi);
lsm6ds3_common_remove(cdata, spi->irq);
dev_info(cdata->dev, "%s: removed\n", LSM6DS3_ACC_GYR_DEV_NAME);
kfree(cdata);
return 0;
}
#ifdef CONFIG_PM
static int lsm6ds3_suspend(struct device *dev)
{
struct lsm6ds3_data *cdata = spi_get_drvdata(to_spi_device(dev));
return lsm6ds3_common_suspend(cdata);
}
static int lsm6ds3_resume(struct device *dev)
{
struct lsm6ds3_data *cdata = spi_get_drvdata(to_spi_device(dev));
return lsm6ds3_common_resume(cdata);
}
static const struct dev_pm_ops lsm6ds3_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(lsm6ds3_suspend, lsm6ds3_resume)
};
#define LSM6DS3_PM_OPS (&lsm6ds3_pm_ops)
#else /* CONFIG_PM */
#define LSM6DS3_PM_OPS NULL
#endif /* CONFIG_PM */
#ifdef CONFIG_OF
static const struct spi_device_id lsm6ds3_ids[] = {
{"lsm6ds3", 0},
{ }
};
MODULE_DEVICE_TABLE(spi, lsm6ds3_ids);
static const struct of_device_id lsm6ds3_id_table[] = {
{.compatible = "st,lsm6ds3", },
{ },
};
MODULE_DEVICE_TABLE(of, lsm6ds3_id_table);
#endif
static struct spi_driver lsm6ds3_spi_driver = {
.driver = {
.owner = THIS_MODULE,
.name = LSM6DS3_ACC_GYR_DEV_NAME,
.pm = LSM6DS3_PM_OPS,
#ifdef CONFIG_OF
.of_match_table = lsm6ds3_id_table,
#endif
},
.probe = lsm6ds3_spi_probe,
.remove = lsm6ds3_spi_remove,
.id_table = lsm6ds3_ids,
};
module_spi_driver(lsm6ds3_spi_driver);
MODULE_DESCRIPTION("STMicroelectronics lsm6ds3 spi driver");
MODULE_AUTHOR("Giuseppe Barba");
MODULE_LICENSE("GPL v2");
|
/* Round argument to nearest integral value according to current rounding
direction.
Copyright (C) 1997-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
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 <fenv.h>
#include <limits.h>
#include <math.h>
#include <math_private.h>
#include <fix-fp-int-convert-overflow.h>
static const double two52[2] =
{
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
};
long long int
__llrint (double x)
{
int32_t j0;
u_int32_t i1, i0;
long long int result;
double w;
double t;
int sx;
EXTRACT_WORDS (i0, i1, x);
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
sx = i0 >> 31;
i0 &= 0xfffff;
i0 |= 0x100000;
if (j0 < 20)
{
w = math_narrow_eval (two52[sx] + x);
t = w - two52[sx];
EXTRACT_WORDS (i0, i1, t);
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
i0 &= 0xfffff;
i0 |= 0x100000;
result = (j0 < 0 ? 0 : i0 >> (20 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
{
if (j0 >= 52)
result = (((long long int) i0 << 32) | i1) << (j0 - 52);
else
{
w = math_narrow_eval (two52[sx] + x);
t = w - two52[sx];
EXTRACT_WORDS (i0, i1, t);
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
i0 &= 0xfffff;
i0 |= 0x100000;
if (j0 == 20)
result = (long long int) i0;
else
result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
}
}
else
{
#ifdef FE_INVALID
/* The number is too large. Unless it rounds to LLONG_MIN,
FE_INVALID must be raised and the return value is
unspecified. */
if (FIX_DBL_LLONG_CONVERT_OVERFLOW && x != (double) LLONG_MIN)
{
feraiseexcept (FE_INVALID);
return sx == 0 ? LLONG_MAX : LLONG_MIN;
}
#endif
return (long long int) x;
}
return sx ? -result : result;
}
weak_alias (__llrint, llrint)
#ifdef NO_LONG_DOUBLE
strong_alias (__llrint, __llrintl)
weak_alias (__llrint, llrintl)
#endif
|
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package 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 IARCHSTRING_H
#define IARCHSTRING_H
#include "IInterface.h"
#include "BasicTypes.h"
#include <stdarg.h>
//! Interface for architecture dependent string operations
/*!
This interface defines the string operations required by
synergy. Each architecture must implement this interface.
*/
class IArchString : public IInterface {
public:
virtual ~IArchString();
//! Wide character encodings
/*!
The known wide character encodings
*/
enum EWideCharEncoding {
kUCS2, //!< The UCS-2 encoding
kUCS4, //!< The UCS-4 encoding
kUTF16, //!< The UTF-16 encoding
kUTF32 //!< The UTF-32 encoding
};
//! @name manipulators
//@{
//! printf() to limited size buffer with va_list
/*!
This method is equivalent to vsprintf() except it will not write
more than \c n bytes to the buffer, returning -1 if the output
was truncated and the number of bytes written not including the
trailing NUL otherwise.
*/
virtual int vsnprintf(char* str,
int size, const char* fmt, va_list ap);
//! Convert multibyte string to wide character string
virtual int convStringMBToWC(wchar_t*,
const char*, UInt32 n, bool* errors);
//! Convert wide character string to multibyte string
virtual int convStringWCToMB(char*,
const wchar_t*, UInt32 n, bool* errors);
//! Return the architecture's native wide character encoding
virtual EWideCharEncoding
getWideCharEncoding() = 0;
//@}
};
#endif
|
/*
* sunxi csi bsp header file
* Author:raymonxiu
*/
#ifndef __BSP__CSI__H__
#define __BSP__CSI__H__
#include "csi/csi_reg.h"
#include "bsp_common.h"
#define MAX_CH_NUM 4
#define CSI_ALIGN_4K(x) (((x) + (4095)) & ~(4095))
#define CSI_ALIGN_32B(x) (((x) + (31)) & ~(31))
#define CSI_ALIGN_16B(x) (((x) + (15)) & ~(15))
#define CSI_ALIGN_8B(x) (((x) + (7)) & ~(7))
enum bus_if
{
PARALLEL = 0,
BT656,
CSI2,
};
enum ref_pol
{
ACTIVE_LOW, /* active low */
ACTIVE_HIGH, /* active high */
};
enum edge_pol
{
FALLING, /* active falling */
RISING, /* active rising */
};
/*
* the same define as enum csi_input_seq
*/
enum bus_fmt_seq
{
/* only when input is yuv422 */
YUYV=0,
YVYU,
UYVY,
VYUY,
/* only when input is byer */
RGRG=0, /* first line sequence is RGRG... */
GRGR, /* first line sequence is GRGR... */
BGBG, /* first line sequence is BGBG... */
GBGB, /* first line sequence is GBGB... */
};
//enum bus_fmt
//{
// RAW=0, /* raw stream */
// YUV444, /* yuv444 */
// YUV422, /* yuv422 */
// YUV420, /* yuv420 */
// RGB565, /* RGB565 */
// RGB888, /* RGB888 */
//};
struct bus_timing
{
enum ref_pol href_pol;
enum ref_pol vref_pol;
enum edge_pol pclk_sample;
enum ref_pol field_even_pol; //field 0/1 0:odd 1:even
};
struct bus_info
{
enum bus_if bus_if;
struct bus_timing bus_tmg;
// enum bit_width bus_width;
// enum bit_width bus_precision;
enum bus_pixelcode bus_ch_fmt[MAX_CH_NUM]; /* define the same as V4L2 */
unsigned int ch_total_num;
};
struct frame_size
{
unsigned int width; /* in pixel unit */
unsigned int height; /* in pixel unit */
};
struct frame_offset
{
unsigned int hoff; /* in pixel unit */
unsigned int voff; /* in pixel unit */
};
/*
* frame arrangement
* Indicate that how the channel images are put together into one buffer
*/
struct frame_arrange
{
unsigned char column;
unsigned char row;
};
struct frame_info
{
struct frame_arrange arrange;
struct frame_size ch_size[MAX_CH_NUM];
struct frame_offset ch_offset[MAX_CH_NUM];
enum pixel_fmt pix_ch_fmt[MAX_CH_NUM];
enum field ch_field[MAX_CH_NUM]; /* define the same as V4L2 */
unsigned int frm_byte_size;
};
extern int bsp_csi_set_base_addr(unsigned int sel, unsigned int addr);
extern void bsp_csi_enable(unsigned int sel);
extern void bsp_csi_disable(unsigned int sel);
extern void bsp_csi_reset(unsigned int sel);
extern int bsp_csi_set_fmt(unsigned int sel, struct bus_info *bus_info, struct frame_info *frame_info);
extern int bsp_csi_set_size(unsigned int sel, struct bus_info *bus_info, struct frame_info *frame_info);
extern void bsp_csi_set_addr(unsigned int sel, unsigned int buf_base_addr);
extern void bsp_csi_cap_start(unsigned int sel, unsigned int ch_total_num, enum csi_cap_mode csi_cap_mode);
extern void bsp_csi_cap_stop(unsigned int sel, unsigned int ch_total_num, enum csi_cap_mode csi_cap_mode);
extern void bsp_csi_int_enable(unsigned int sel, unsigned int ch, enum csi_int_sel interrupt);
extern void bsp_csi_int_disable(unsigned int sel, unsigned int ch, enum csi_int_sel interrupt);
extern void bsp_csi_int_get_status(unsigned int sel, unsigned int ch,struct csi_int_status *status);
extern void bsp_csi_int_clear_status(unsigned int sel, unsigned int ch, enum csi_int_sel interrupt);
#endif /* __BSP__CSI__H__ */
|
/*
Copyright (C) 2011-2013 Paul Davis
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 __ardour_canvas_tracking_text_h__
#define __ardour_canvas_tracking_text_h__
#include <string>
#include "canvas/text.h"
namespace ArdourCanvas {
class LIBCANVAS_API TrackingText : public Text
{
public:
TrackingText (Canvas*);
TrackingText (Item*);
void show_and_track (bool track_x, bool track_y);
void set_offset (Duple const &);
void set_x_offset (double);
void set_y_offset (double);
private:
bool track_x;
bool track_y;
Duple offset;
void pointer_motion (Duple const&);
void init ();
};
}
#endif /* __ardour_canvas_tracking_text_h__ */
|
/* GemRB - Infinity Engine Emulator
* Copyright (C) 2003 The GemRB Project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
*/
#ifndef SCRIPTENGINE_H
#define SCRIPTENGINE_H
#include "Plugin.h"
namespace GemRB {
class Point;
class GEM_EXPORT ScriptEngine : public Plugin {
public:
ScriptEngine(void);
virtual ~ScriptEngine(void);
/** Initialization Routine */
virtual bool Init(void) = 0;
/** Load Script */
virtual bool LoadScript(const char* filename) = 0;
/** Run Function */
virtual bool RunFunction(const char *ModuleName, const char* FunctionName, bool report_error=true, int intparam=-1) = 0;
virtual bool RunFunction(const char* Modulename, const char* FunctionName, bool report_error, Point) = 0;
/** Exec a single String */
virtual void ExecString(const char* string, bool feedback) = 0;
};
}
#endif
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2004, 2010 Apple Inc. All rights reserved.
*
* 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 HTMLMapElement_h
#define HTMLMapElement_h
#include "HTMLElement.h"
namespace WebCore {
class HitTestResult;
class HTMLImageElement;
class HTMLMapElement final : public HTMLElement {
public:
static PassRefPtr<HTMLMapElement> create(Document&);
static PassRefPtr<HTMLMapElement> create(const QualifiedName&, Document&);
virtual ~HTMLMapElement();
const AtomicString& getName() const { return m_name; }
bool mapMouseEvent(LayoutPoint location, const LayoutSize&, HitTestResult&);
HTMLImageElement* imageElement();
PassRefPtr<HTMLCollection> areas();
private:
HTMLMapElement(const QualifiedName&, Document&);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
virtual InsertionNotificationRequest insertedInto(ContainerNode&) override;
virtual void removedFrom(ContainerNode&) override;
AtomicString m_name;
};
NODE_TYPE_CASTS(HTMLMapElement)
} // namespaces
#endif
|
/* Code for native debugging support for GNU/Linux (LWP layer).
Copyright (C) 2000-2020 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef NAT_LINUX_NAT_H
#define NAT_LINUX_NAT_H
#include "gdbsupport/function-view.h"
#include "target/waitstatus.h"
struct lwp_info;
struct arch_lwp_info;
/* This is the kernel's hard limit. Not to be confused with SIGRTMIN. */
#ifndef __SIGRTMIN
#define __SIGRTMIN 32
#endif
/* Unlike other extended result codes, WSTOPSIG (status) on
PTRACE_O_TRACESYSGOOD syscall events doesn't return SIGTRAP, but
instead SIGTRAP with bit 7 set. */
#define SYSCALL_SIGTRAP (SIGTRAP | 0x80)
/* Return the ptid of the current lightweight process. With NPTL
threads and LWPs map 1:1, so this is equivalent to returning the
ptid of the current thread. This function must be provided by
the client. */
extern ptid_t current_lwp_ptid (void);
/* Function type for the CALLBACK argument of iterate_over_lwps. */
typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp);
/* Iterate over all LWPs. Calls CALLBACK with its second argument set
to DATA for every LWP in the list. If CALLBACK returns nonzero for
a particular LWP, return a pointer to the structure describing that
LWP immediately. Otherwise return NULL. This function must be
provided by the client. */
extern struct lwp_info *iterate_over_lwps
(ptid_t filter,
gdb::function_view<iterate_over_lwps_ftype> callback);
/* Return the ptid of LWP. */
extern ptid_t ptid_of_lwp (struct lwp_info *lwp);
/* Set the architecture-specific data of LWP. This function must be
provided by the client. */
extern void lwp_set_arch_private_info (struct lwp_info *lwp,
struct arch_lwp_info *info);
/* Return the architecture-specific data of LWP. This function must
be provided by the client. */
extern struct arch_lwp_info *lwp_arch_private_info (struct lwp_info *lwp);
/* Return nonzero if LWP is stopped, zero otherwise. This function
must be provided by the client. */
extern int lwp_is_stopped (struct lwp_info *lwp);
/* Return the reason the LWP last stopped. This function must be
provided by the client. */
extern enum target_stop_reason lwp_stop_reason (struct lwp_info *lwp);
/* Cause LWP to stop. This function must be provided by the
client. */
extern void linux_stop_lwp (struct lwp_info *lwp);
/* Return nonzero if we are single-stepping this LWP at the ptrace
level. */
extern int lwp_is_stepping (struct lwp_info *lwp);
#endif /* NAT_LINUX_NAT_H */
|
/*
* A simple kernel FIFO implementation.
*
* Copyright (C) 2004 Stelian Pop <stelian@popies.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.
*/
#include <common.h>
#include <malloc.h>
#include <kfifo.h>
#include <errno.h>
/**
* kfifo_init - allocates a new FIFO using a preallocated buffer
* @buffer: the preallocated buffer to be used.
* @size: the size of the internal buffer, this have to be a power of 2.
* @gfp_mask: get_free_pages mask, passed to kmalloc()
* @lock: the lock to be used to protect the fifo buffer
*
* Do NOT pass the kfifo to kfifo_free() after use! Simply free the
* &struct kfifo with free().
*/
void kfifo_init(struct kfifo *fifo, unsigned char *buffer, unsigned int size)
{
fifo->buffer = buffer;
fifo->size = size;
fifo->in = fifo->out = 0;
}
/**
* kfifo_alloc - allocates a new FIFO and its internal buffer
* @size: the size of the internal buffer to be allocated.
* @gfp_mask: get_free_pages mask, passed to kmalloc()
* @lock: the lock to be used to protect the fifo buffer
*
* The size will be rounded-up to a power of 2.
*/
struct kfifo *kfifo_alloc(unsigned int size)
{
unsigned char *buffer;
struct kfifo *fifo;
buffer = malloc(size);
if (!buffer)
return NULL;
fifo = malloc(sizeof(struct kfifo));
if (!fifo) {
free(buffer);
return NULL;
}
kfifo_init(fifo, buffer, size);
return fifo;
}
/**
* kfifo_free - frees the FIFO
* @fifo: the fifo to be freed.
*/
void kfifo_free(struct kfifo *fifo)
{
free(fifo->buffer);
free(fifo);
}
/**
* kfifo_put - puts some data into the FIFO, no locking version
* @fifo: the fifo to be used.
* @buffer: the data to be added.
* @len: the length of the data to be added.
*
* This function copies at most @len bytes from the @buffer into
* the FIFO depending on the free space, and returns the number of
* bytes copied.
*
*/
unsigned int kfifo_put(struct kfifo *fifo,
const unsigned char *buffer, unsigned int len)
{
unsigned int l;
len = min(len, fifo->size - fifo->in + fifo->out);
/* first put the data starting from fifo->in to buffer end */
l = min(len, fifo->size - (fifo->in & (fifo->size - 1)));
memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l);
/* then put the rest (if any) at the beginning of the buffer */
memcpy(fifo->buffer, buffer + l, len - l);
fifo->in += len;
return len;
}
/**
* kfifo_get - gets some data from the FIFO, no locking version
* @fifo: the fifo to be used.
* @buffer: where the data must be copied.
* @len: the size of the destination buffer.
*
* This function copies at most @len bytes from the FIFO into the
* @buffer and returns the number of copied bytes.
*
* Note that with only one concurrent reader and one concurrent
* writer, you don't need extra locking to use these functions.
*/
unsigned int kfifo_get(struct kfifo *fifo,
unsigned char *buffer, unsigned int len)
{
unsigned int l;
len = min(len, fifo->in - fifo->out);
/* first get the data from fifo->out until the end of the buffer */
l = min(len, fifo->size - (fifo->out & (fifo->size - 1)));
memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l);
/* then get the rest (if any) from the beginning of the buffer */
memcpy(buffer + l, fifo->buffer, len - l);
fifo->out += len;
return len;
}
void kfifo_putc(struct kfifo *fifo, unsigned char c)
{
*(fifo->buffer + (fifo->in & (fifo->size - 1))) = c;
fifo->in++;
if (fifo->in - fifo->out > fifo->size)
fifo->out++;
}
unsigned int kfifo_getc(struct kfifo *fifo, unsigned char *c)
{
if (fifo->in == fifo->out)
return -1;
*c = *(fifo->buffer + (fifo->out & (fifo->size - 1)));
fifo->out++;
return 0;
}
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, 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.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
// clang-format off
PairStyle(thole,PairThole);
// clang-format on
#else
#ifndef LMP_PAIR_THOLE_H
#define LMP_PAIR_THOLE_H
#include "pair.h"
namespace LAMMPS_NS {
class PairThole : public Pair {
public:
PairThole(class LAMMPS *);
~PairThole() override;
void compute(int, int) override;
void settings(int, char **) override;
void coeff(int, char **) override;
void init_style() override;
double init_one(int, int) override;
void write_restart(FILE *) override;
void read_restart(FILE *) override;
void write_restart_settings(FILE *) override;
void read_restart_settings(FILE *) override;
double single(int, int, int, int, double, double, double, double &) override;
void *extract(const char *, int &) override;
protected:
double thole_global;
double cut_global;
double **cut, **scale;
double **polar, **thole, **ascreen;
class FixDrude *fix_drude;
virtual void allocate();
};
} // namespace LAMMPS_NS
#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: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file.
E: Pair style thole requires atom attribute q
The atom style defined does not have these attributes.
*/
|
/* linux/arch/arm/mach-msm/board-saga.h
*
* Copyright (C) 2010-2011 HTC Corporation.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __ARCH_ARM_MACH_MSM_BOARD_SAGA_H
#define __ARCH_ARM_MACH_MSM_BOARD_SAGA_H
#include <mach/board.h>
/* Macros assume PMIC GPIOs start at 0 */
#define PM8058_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + NR_GPIO_IRQS)
#define PM8058_GPIO_SYS_TO_PM(sys_gpio) (sys_gpio - NR_GPIO_IRQS)
#define MSM_LINUX_BASE1 0x04400000
#define MSM_LINUX_SIZE1 0x1C000000
#define MSM_LINUX_BASE2 0x20000000
#define MSM_LINUX_SIZE2 0x0C300000
#define MSM_RAM_CONSOLE_BASE 0x00500000
#define MSM_RAM_CONSOLE_SIZE 0x00100000
#define MSM_PMEM_ADSP_BASE 0x2C300000
#define MSM_PMEM_ADSP_SIZE 0x01E00000
#define MSM_PMEM_SF_BASE 0x2E100000
#define MSM_PMEM_SF_SIZE 0x01F00000
#define PMEM_KERNEL_EBI0_SIZE 0x00500000
#define MSM_FB_SIZE roundup((800 * ALIGN(480, 32) * 4 * 3), 4096) /* 4 bpp x 3 pages, Note: must be multiple of 4096 */
#ifdef CONFIG_ION_MSM
#define MSM_ION_CAMERA_SIZE MSM_PMEM_ADSP_SIZE
#define MSM_ION_SF_BASE MSM_PMEM_SF_BASE
#define MSM_ION_SF_SIZE MSM_PMEM_SF_SIZE
#define MSM_ION_HEAP_NUM 3
#endif
/* GPIO definition */
#define SAGA_GPIO_WIFI_IRQ (147)
#define SAGA_GPIO_WIFI_SHUTDOWN_N (39)
#define SAGA_GPIO_UART2_RX (51)
#define SAGA_GPIO_UART2_TX (52)
#define SAGA_GPIO_KEYPAD_POWER_KEY (46)
/* Proximity */
#define SAGA_GPIO_PROXIMITY_INT_N (18)
#define SAGA_GPIO_COMPASS_INT (42)
#define SAGA_GPIO_GSENSOR_INT_N (180)
#define SAGA_LAYOUTS_XA_XB { \
{ { 0, 1, 0}, { 1, 0, 0}, {0, 0, -1} }, \
{ { 0, -1, 0}, { 1, 0, 0}, {0, 0, -1} }, \
{ { 1, 0, 0}, { 0, -1, 0}, {0, 0, -1} }, \
{ {-1, 0, 0}, { 0, 0, -1}, {0, 1, 0} } \
}
#define SAGA_LAYOUTS_XC { \
{ { 0, 1, 0}, {-1, 0, 0}, {0, 0, 1} }, \
{ { 0, -1, 0}, { 1, 0, 0}, {0, 0, -1} }, \
{ {-1, 0, 0}, { 0, -1, 0}, {0, 0, 1} }, \
{ {-1, 0, 0}, { 0, 0, -1}, {0, 1, 0} } \
}
#define SAGA_PMIC_GPIO_INT (27)
#define SAGA_GPIO_UP_INT_N (142)
#define SAGA_GPIO_PS_HOLD (29)
#define SAGA_MDDI_RSTz (162)
#define SAGA_LCD_ID0 (124)
#define SAGA_LCD_RSTz_ID1 (126)
#define SAGA_LCD_PCLK_1 (90)
#define SAGA_LCD_DE (91)
#define SAGA_LCD_VSYNC (92)
#define SAGA_LCD_HSYNC (93)
#define SAGA_LCD_G0 (94)
#define SAGA_LCD_G1 (95)
#define SAGA_LCD_G2 (96)
#define SAGA_LCD_G3 (97)
#define SAGA_LCD_G4 (98)
#define SAGA_LCD_G5 (99)
#define SAGA_LCD_B0 (22)
#define SAGA_LCD_B1 (100)
#define SAGA_LCD_B2 (101)
#define SAGA_LCD_B3 (102)
#define SAGA_LCD_B4 (103)
#define SAGA_LCD_B5 (104)
#define SAGA_LCD_R0 (25)
#define SAGA_LCD_R1 (105)
#define SAGA_LCD_R2 (106)
#define SAGA_LCD_R3 (107)
#define SAGA_LCD_R4 (108)
#define SAGA_LCD_R5 (109)
#define SAGA_LCD_SPI_CSz (87)
/* Audio */
#define SAGA_AUD_SPI_CSz (89)
#define SAGA_AUD_MICPATH_SEL_XA (121)
/* Flashlight */
#define SAGA_GPIO_FLASHLIGHT_FLASH (128)
#define SAGA_GPIO_FLASHLIGHT_TORCH (129)
/* BT */
#define SAGA_GPIO_BT_UART1_RTS (134)
#define SAGA_GPIO_BT_UART1_CTS (135)
#define SAGA_GPIO_BT_UART1_RX (136)
#define SAGA_GPIO_BT_UART1_TX (137)
#define SAGA_GPIO_BT_PCM_OUT (138)
#define SAGA_GPIO_BT_PCM_IN (139)
#define SAGA_GPIO_BT_PCM_SYNC (140)
#define SAGA_GPIO_BT_PCM_CLK (141)
#define SAGA_GPIO_BT_RESET_N (41)
#define SAGA_GPIO_BT_HOST_WAKE (26)
#define SAGA_GPIO_BT_CHIP_WAKE (50)
#define SAGA_GPIO_BT_SHUTDOWN_N (38)
#define SAGA_GPIO_USB_ID_PIN (145)
#define SAGA_VCM_PD (34)
#define SAGA_CAM1_PD (31)
#define SAGA_CLK_SEL (23) /* camera select pin */
#define SAGA_CAM2_PD (24)
#define SAGA_CAM2_RSTz (21)
#define SAGA_CODEC_3V_EN (36)
#define SAGA_GPIO_TP_ATT_N (20)
/* PMIC 8058 GPIO */
#define PMGPIO(x) (x-1)
#define SAGA_AUD_MICPATH_SEL_XB PMGPIO(10)
#define SAGA_AUD_EP_EN PMGPIO(13)
#define SAGA_VOL_UP PMGPIO(14)
#define SAGA_VOL_DN PMGPIO(15)
#define SAGA_GPIO_CHG_INT PMGPIO(16)
#define SAGA_AUD_HP_DETz PMGPIO(17)
#define SAGA_AUD_SPK_EN PMGPIO(18)
#define SAGA_AUD_HP_EN PMGPIO(19)
#define SAGA_PS_SHDN PMGPIO(20)
#define SAGA_TP_RSTz PMGPIO(21)
#define SAGA_LED_3V3_EN PMGPIO(22)
#define SAGA_SDMC_CD_N PMGPIO(23)
#define SAGA_GREEN_LED PMGPIO(24)
#define SAGA_AMBER_LED PMGPIO(25)
#define SAGA_AUD_A3254_RSTz PMGPIO(36)
#define SAGA_WIFI_SLOW_CLK PMGPIO(38)
#define SAGA_SLEEP_CLK2 PMGPIO(39)
extern struct platform_device msm_device_mdp;
extern struct platform_device msm_device_mddi0;
extern int panel_type;
unsigned int saga_get_engineerid(void);
int saga_panel_sleep_in(void);
#ifdef CONFIG_MICROP_COMMON
void __init saga_microp_init(void);
#endif
int saga_init_mmc(unsigned int sys_rev);
void __init saga_audio_init(void);
int __init saga_init_keypad(void);
int __init saga_wifi_init(void);
int __init saga_init_panel(void);
#endif /* __ARCH_ARM_MACH_MSM_BOARD_SAGA_H */
|
/* sim_tmxr.h: terminal multiplexor definitions
Copyright (c) 2001-2008, Robert M Supnik
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
ROBERT M SUPNIK 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.
Except as contained in this notice, the name of Robert M Supnik shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik.
Based on the original DZ11 simulator by Thord Nilson, as updated by
Arthur Krewat.
20-Nov-08 RMS Added three new standardized SHOW routines
27-May-08 JDB Added lnorder to TMXR structure,
added tmxr_set_lnorder and tmxr_set_lnorder
14-May-08 JDB Added dptr to TMXR structure
04-Jan-04 RMS Changed TMXR ldsc to be pointer to linedesc array
Added tmxr_linemsg, logging (from Mark Pizzolato)
29-Dec-03 RMS Added output stall support, increased buffer size
22-Dec-02 RMS Added break support (from Mark Pizzolato)
20-Aug-02 RMS Added tmxr_open_master, tmxr_close_master, tmxr.port
30-Dec-01 RMS Renamed tmxr_fstatus, added tmxr_fstats
20-Oct-01 RMS Removed tmxr_getchar, formalized buffer guard,
added tmxr_rqln, tmxr_tqln
*/
#ifndef _SIM_TMXR_H_
#define _SIM_TMXR_H_ 0
#define TMXR_V_VALID 15
#define TMXR_VALID (1 << TMXR_V_VALID)
#define TMXR_MAXBUF 256 /* buffer size */
#define TMXR_GUARD 12 /* buffer guard */
struct tmln {
SOCKET conn; /* line conn */
uint32 ipad; /* IP address */
uint32 cnms; /* conn time */
int32 tsta; /* Telnet state */
int32 rcve; /* rcv enable */
int32 xmte; /* xmt enable */
int32 dstb; /* disable Tlnt bin */
int32 rxbpr; /* rcv buf remove */
int32 rxbpi; /* rcv buf insert */
int32 rxcnt; /* rcv count */
int32 txbpr; /* xmt buf remove */
int32 txbpi; /* xmt buf insert */
int32 txcnt; /* xmt count */
FILE *txlog; /* xmt log file */
char *txlogname; /* xmt log file name */
char rxb[TMXR_MAXBUF]; /* rcv buffer */
char rbr[TMXR_MAXBUF]; /* rcv break */
char txb[TMXR_MAXBUF]; /* xmt buffer */
};
typedef struct tmln TMLN;
struct tmxr {
int32 lines; /* # lines */
int32 port; /* listening port */
SOCKET master; /* master socket */
TMLN *ldsc; /* line descriptors */
int32 *lnorder; /* line connection order */
DEVICE *dptr; /* multiplexer device */
};
typedef struct tmxr TMXR;
int32 tmxr_poll_conn (TMXR *mp);
void tmxr_reset_ln (TMLN *lp);
int32 tmxr_getc_ln (TMLN *lp);
void tmxr_poll_rx (TMXR *mp);
t_stat tmxr_putc_ln (TMLN *lp, int32 chr);
void tmxr_poll_tx (TMXR *mp);
t_stat tmxr_open_master (TMXR *mp, char *cptr);
t_stat tmxr_close_master (TMXR *mp);
t_stat tmxr_attach (TMXR *mp, UNIT *uptr, char *cptr);
t_stat tmxr_detach (TMXR *mp, UNIT *uptr);
t_stat tmxr_ex (t_value *vptr, t_addr addr, UNIT *uptr, int32 sw);
t_stat tmxr_dep (t_value val, t_addr addr, UNIT *uptr, int32 sw);
void tmxr_msg (SOCKET sock, char *msg);
void tmxr_linemsg (TMLN *lp, char *msg);
void tmxr_fconns (FILE *st, TMLN *lp, int32 ln);
void tmxr_fstats (FILE *st, TMLN *lp, int32 ln);
t_stat tmxr_set_log (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat tmxr_set_nolog (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat tmxr_show_log (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat tmxr_dscln (UNIT *uptr, int32 val, char *cptr, void *desc);
int32 tmxr_rqln (TMLN *lp);
int32 tmxr_tqln (TMLN *lp);
t_stat tmxr_set_lnorder (UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat tmxr_show_lnorder (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat tmxr_show_summ (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat tmxr_show_cstat (FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat tmxr_show_lines (FILE *st, UNIT *uptr, int32 val, void *desc);
#endif
|
/* Copyright (C) 2008-2012 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 <errno.h>
#include <sys/socket.h>
/* Await a connection on socket FD.
When a connection arrives, open a new socket to communicate with it,
set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
peer and *ADDR_LEN to the address's actual length, and return the
new socket's descriptor, or -1 for errors. The operation can be influenced
by the FLAGS parameter. */
int
__libc_accept4 (fd, addr, addr_len, flags)
int fd;
__SOCKADDR_ARG addr;
socklen_t *addr_len;
int flags;
{
__set_errno (ENOSYS);
return -1;
}
weak_alias (__libc_accept4, accept4)
stub_warning (accept4)
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2020 NXP
*/
#include <command.h>
#include <common.h>
#include <env.h>
#include <errno.h>
#include <image.h>
#include <malloc.h>
#include <mmc.h>
#include <tee.h>
#include <tee/optee_ta_avb.h>
static struct udevice *tee;
static u32 session;
static int avb_ta_open_session(void)
{
const struct tee_optee_ta_uuid uuid = TA_AVB_UUID;
struct tee_open_session_arg arg;
int rc;
tee = tee_find_device(tee, NULL, NULL, NULL);
if (!tee)
return -ENODEV;
memset(&arg, 0, sizeof(arg));
tee_optee_ta_uuid_to_octets(arg.uuid, &uuid);
rc = tee_open_session(tee, &arg, 0, NULL);
if (!rc)
session = arg.session;
return 0;
}
static int invoke_func(u32 func, ulong num_param, struct tee_param *param)
{
struct tee_invoke_arg arg;
if (!tee)
if (avb_ta_open_session())
return -ENODEV;
memset(&arg, 0, sizeof(arg));
arg.func = func;
arg.session = session;
if (tee_invoke_func(tee, &arg, num_param, param))
return -EFAULT;
switch (arg.ret) {
case TEE_SUCCESS:
return 0;
case TEE_ERROR_OUT_OF_MEMORY:
case TEE_ERROR_STORAGE_NO_SPACE:
return -ENOSPC;
case TEE_ERROR_ITEM_NOT_FOUND:
return -EIO;
case TEE_ERROR_TARGET_DEAD:
/*
* The TA has paniced, close the session to reload the TA
* for the next request.
*/
tee_close_session(tee, session);
tee = NULL;
return -EIO;
default:
return -EIO;
}
}
static int read_persistent_value(const char *name,
size_t buffer_size,
u8 *out_buffer,
size_t *out_num_bytes_read)
{
int rc = 0;
struct tee_shm *shm_name;
struct tee_shm *shm_buf;
struct tee_param param[2];
size_t name_size = strlen(name) + 1;
if (!tee)
if (avb_ta_open_session())
return -ENODEV;
rc = tee_shm_alloc(tee, name_size,
TEE_SHM_ALLOC, &shm_name);
if (rc)
return -ENOMEM;
rc = tee_shm_alloc(tee, buffer_size,
TEE_SHM_ALLOC, &shm_buf);
if (rc) {
rc = -ENOMEM;
goto free_name;
}
memcpy(shm_name->addr, name, name_size);
memset(param, 0, sizeof(param));
param[0].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT;
param[0].u.memref.shm = shm_name;
param[0].u.memref.size = name_size;
param[1].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INOUT;
param[1].u.memref.shm = shm_buf;
param[1].u.memref.size = buffer_size;
rc = invoke_func(TA_AVB_CMD_READ_PERSIST_VALUE,
2, param);
if (rc)
goto out;
if (param[1].u.memref.size > buffer_size) {
rc = -EINVAL;
goto out;
}
*out_num_bytes_read = param[1].u.memref.size;
memcpy(out_buffer, shm_buf->addr, *out_num_bytes_read);
out:
tee_shm_free(shm_buf);
free_name:
tee_shm_free(shm_name);
return rc;
}
static int write_persistent_value(const char *name,
size_t value_size,
const u8 *value)
{
int rc = 0;
struct tee_shm *shm_name;
struct tee_shm *shm_buf;
struct tee_param param[2];
size_t name_size = strlen(name) + 1;
if (!tee) {
if (avb_ta_open_session())
return -ENODEV;
}
if (!value_size)
return -EINVAL;
rc = tee_shm_alloc(tee, name_size,
TEE_SHM_ALLOC, &shm_name);
if (rc)
return -ENOMEM;
rc = tee_shm_alloc(tee, value_size,
TEE_SHM_ALLOC, &shm_buf);
if (rc) {
rc = -ENOMEM;
goto free_name;
}
memcpy(shm_name->addr, name, name_size);
memcpy(shm_buf->addr, value, value_size);
memset(param, 0, sizeof(param));
param[0].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT;
param[0].u.memref.shm = shm_name;
param[0].u.memref.size = name_size;
param[1].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT;
param[1].u.memref.shm = shm_buf;
param[1].u.memref.size = value_size;
rc = invoke_func(TA_AVB_CMD_WRITE_PERSIST_VALUE,
2, param);
if (rc)
goto out;
out:
tee_shm_free(shm_buf);
free_name:
tee_shm_free(shm_name);
return rc;
}
int do_optee_rpmb_read(struct cmd_tbl *cmdtp, int flag, int argc,
char * const argv[])
{
const char *name;
size_t bytes;
size_t bytes_read;
void *buffer;
char *endp;
if (argc != 3)
return CMD_RET_USAGE;
name = argv[1];
bytes = simple_strtoul(argv[2], &endp, 10);
if (*endp && *endp != '\n')
return CMD_RET_USAGE;
buffer = malloc(bytes);
if (!buffer)
return CMD_RET_FAILURE;
if (read_persistent_value(name, bytes, buffer, &bytes_read) == 0) {
printf("Read %zu bytes, value = %s\n", bytes_read,
(char *)buffer);
free(buffer);
return CMD_RET_SUCCESS;
}
printf("Failed to read persistent value\n");
free(buffer);
return CMD_RET_FAILURE;
}
int do_optee_rpmb_write(struct cmd_tbl *cmdtp, int flag, int argc,
char * const argv[])
{
const char *name;
const char *value;
if (argc != 3)
return CMD_RET_USAGE;
name = argv[1];
value = argv[2];
if (write_persistent_value(name, strlen(value) + 1,
(const uint8_t *)value) == 0) {
printf("Wrote %zu bytes\n", strlen(value) + 1);
return CMD_RET_SUCCESS;
}
printf("Failed to write persistent value\n");
return CMD_RET_FAILURE;
}
static struct cmd_tbl cmd_optee_rpmb[] = {
U_BOOT_CMD_MKENT(read_pvalue, 3, 0, do_optee_rpmb_read, "", ""),
U_BOOT_CMD_MKENT(write_pvalue, 3, 0, do_optee_rpmb_write, "", ""),
};
static int do_optee_rpmb(struct cmd_tbl *cmdtp, int flag, int argc,
char * const argv[])
{
struct cmd_tbl *cp;
cp = find_cmd_tbl(argv[1], cmd_optee_rpmb, ARRAY_SIZE(cmd_optee_rpmb));
argc--;
argv++;
if (!cp || argc > cp->maxargs)
return CMD_RET_USAGE;
if (flag == CMD_FLAG_REPEAT)
return CMD_RET_FAILURE;
return cp->cmd(cmdtp, flag, argc, argv);
}
U_BOOT_CMD (
optee_rpmb, 29, 0, do_optee_rpmb,
"Provides commands for testing secure storage on RPMB on OPTEE",
"read_pvalue <name> <bytes> - read a persistent value <name>\n"
"optee_rpmb write_pvalue <name> <value> - write a persistent value <name>\n"
);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.