text stringlengths 4 6.14k |
|---|
/*
* This file is part of the UCB release of Plan 9. It is subject to the license
* terms in the LICENSE file found in the top-level directory of this
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
* part of the UCB release of Plan 9, including this file, may be copied,
* modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/
#include <u.h>
#include <libc.h>
int
sprint(char *buf, char *fmt, ...)
{
int n;
va_list args;
va_start(args, fmt);
n = vsnprint(buf, 65536, fmt, args); /* big number, but sprint is deprecated anyway */
va_end(args);
return n;
}
|
/*
Stockfish, a chess program for iOS.
Copyright (C) 2004-2014 Tord Romstad, Marco Costalba, Joona Kiiski.
Stockfish 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.
Stockfish 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/>.
*/
#if !defined(SQUARE_H_INCLUDED)
#define SQUARE_H_INCLUDED
////
//// Includes
////
#include <cstdlib>
#include <string>
#include "color.h"
#include "misc.h"
namespace Chess {
////
//// Types
////
enum Square {
SQ_A1, SQ_B1, SQ_C1, SQ_D1, SQ_E1, SQ_F1, SQ_G1, SQ_H1,
SQ_A2, SQ_B2, SQ_C2, SQ_D2, SQ_E2, SQ_F2, SQ_G2, SQ_H2,
SQ_A3, SQ_B3, SQ_C3, SQ_D3, SQ_E3, SQ_F3, SQ_G3, SQ_H3,
SQ_A4, SQ_B4, SQ_C4, SQ_D4, SQ_E4, SQ_F4, SQ_G4, SQ_H4,
SQ_A5, SQ_B5, SQ_C5, SQ_D5, SQ_E5, SQ_F5, SQ_G5, SQ_H5,
SQ_A6, SQ_B6, SQ_C6, SQ_D6, SQ_E6, SQ_F6, SQ_G6, SQ_H6,
SQ_A7, SQ_B7, SQ_C7, SQ_D7, SQ_E7, SQ_F7, SQ_G7, SQ_H7,
SQ_A8, SQ_B8, SQ_C8, SQ_D8, SQ_E8, SQ_F8, SQ_G8, SQ_H8,
SQ_NONE
};
enum File {
FILE_A, FILE_B, FILE_C, FILE_D, FILE_E, FILE_F, FILE_G, FILE_H, FILE_NONE
};
enum Rank {
RANK_1, RANK_2, RANK_3, RANK_4, RANK_5, RANK_6, RANK_7, RANK_8, RANK_NONE
};
enum SquareDelta {
DELTA_SSW = -021, DELTA_SS = -020, DELTA_SSE = -017, DELTA_SWW = -012,
DELTA_SW = -011, DELTA_S = -010, DELTA_SE = -07, DELTA_SEE = -06,
DELTA_W = -01, DELTA_ZERO = 0, DELTA_E = 01, DELTA_NWW = 06, DELTA_NW = 07,
DELTA_N = 010, DELTA_NE = 011, DELTA_NEE = 012, DELTA_NNW = 017,
DELTA_NN = 020, DELTA_NNE = 021
};
////
//// Constants
////
const int FlipMask = 070;
const int FlopMask = 07;
////
//// Inline functions
////
inline File operator+ (File x, int i) { return File(int(x) + i); }
inline File operator+ (File x, File y) { return x + int(y); }
inline void operator++ (File &x, int) { x = File(int(x) + 1); }
inline void operator+= (File &x, int i) { x = File(int(x) + i); }
inline File operator- (File x, int i) { return File(int(x) - i); }
inline void operator-- (File &x, int) { x = File(int(x) - 1); }
inline void operator-= (File &x, int i) { x = File(int(x) - i); }
inline Rank operator+ (Rank x, int i) { return Rank(int(x) + i); }
inline Rank operator+ (Rank x, Rank y) { return x + int(y); }
inline void operator++ (Rank &x, int) { x = Rank(int(x) + 1); }
inline void operator+= (Rank &x, int i) { x = Rank(int(x) + i); }
inline Rank operator- (Rank x, int i) { return Rank(int(x) - i); }
inline void operator-- (Rank &x, int) { x = Rank(int(x) - 1); }
inline void operator-= (Rank &x, int i) { x = Rank(int(x) - i); }
inline Square operator+ (Square x, int i) { return Square(int(x) + i); }
inline void operator++ (Square &x, int) { x = Square(int(x) + 1); }
inline void operator+= (Square &x, int i) { x = Square(int(x) + i); }
inline Square operator- (Square x, int i) { return Square(int(x) - i); }
inline void operator-- (Square &x, int) { x = Square(int(x) - 1); }
inline void operator-= (Square &x, int i) { x = Square(int(x) - i); }
inline Square operator+ (Square x, SquareDelta i) { return Square(int(x) + i); }
inline void operator+= (Square &x, SquareDelta i) { x = Square(int(x) + i); }
inline Square operator- (Square x, SquareDelta i) { return Square(int(x) - i); }
inline void operator-= (Square &x, SquareDelta i) { x = Square(int(x) - i); }
inline SquareDelta operator- (Square x, Square y) {
return SquareDelta(int(x) - int(y));
}
inline Square make_square(File f, Rank r) {
return Square(int(f) | (int(r) << 3));
}
inline File square_file(Square s) {
return File(int(s) & 7);
}
inline Rank square_rank(Square s) {
return Rank(int(s) >> 3);
}
inline Square flip_square(Square s) {
return Square(int(s) ^ FlipMask);
}
inline Square flop_square(Square s) {
return Square(int(s) ^ FlopMask);
}
inline Square relative_square(Color c, Square s) {
return Square(int(s) ^ (int(c) * FlipMask));
}
inline Rank pawn_rank(Color c, Square s) {
return square_rank(relative_square(c, s));
}
inline Color square_color(Square s) {
return Color((int(square_file(s)) + int(square_rank(s))) & 1);
}
inline int file_distance(File f1, File f2) {
return abs(int(f1) - int(f2));
}
inline int file_distance(Square s1, Square s2) {
return file_distance(square_file(s1), square_file(s2));
}
inline int rank_distance(Rank r1, Rank r2) {
return abs(int(r1) - int(r2));
}
inline int rank_distance(Square s1, Square s2) {
return rank_distance(square_rank(s1), square_rank(s2));
}
#define Max(x, y) (((x) < (y))? (y) : (x))
inline int square_distance(Square s1, Square s2) {
return Max(file_distance(s1, s2), rank_distance(s1, s2));
}
////
//// Prototypes
////
extern File file_from_char(char c);
extern char file_to_char(File f);
extern Rank rank_from_char(char c);
extern char rank_to_char(Rank r);
extern Square square_from_string(const std::string &str);
extern const std::string square_to_string(Square s);
extern bool file_is_ok(File f);
extern bool rank_is_ok(Rank r);
extern bool square_is_ok(Square s);
}
#endif // !defined(SQUARE_H_INCLUDED)
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <device/pci_ops.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <soc/pch.h>
#include <soc/pci_devs.h>
#include <soc/rcba.h>
#include <soc/serialio.h>
#include <soc/spi.h>
#include <southbridge/intel/lynxpoint/iobp.h>
u8 pch_revision(void)
{
return pci_read_config8(PCH_DEV_LPC, PCI_REVISION_ID);
}
u16 pch_type(void)
{
return pci_read_config16(PCH_DEV_LPC, PCI_DEVICE_ID);
}
/* Return 1 if PCH type is WildcatPoint */
int pch_is_wpt(void)
{
return ((pch_type() & 0xfff0) == 0x9cc0) ? 1 : 0;
}
/* Return 1 if PCH type is WildcatPoint ULX */
int pch_is_wpt_ulx(void)
{
u16 lpcid = pch_type();
switch (lpcid) {
case PCH_WPT_BDW_Y_SAMPLE:
case PCH_WPT_BDW_Y_PREMIUM:
case PCH_WPT_BDW_Y_BASE:
return 1;
}
return 0;
}
u32 pch_read_soft_strap(int id)
{
u32 fdoc;
fdoc = SPIBAR32(SPIBAR_FDOC);
fdoc &= ~0x00007ffc;
SPIBAR32(SPIBAR_FDOC) = fdoc;
fdoc |= 0x00004000;
fdoc |= id * 4;
SPIBAR32(SPIBAR_FDOC) = fdoc;
return SPIBAR32(SPIBAR_FDOD);
}
#ifndef __SIMPLE_DEVICE__
/* Put device in D3Hot Power State */
static void pch_enable_d3hot(struct device *dev)
{
pci_or_config32(dev, PCH_PCS, PCH_PCS_PS_D3HOT);
}
/* RCBA function disable and posting read to flush the transaction */
static void rcba_function_disable(u32 reg, u32 bit)
{
RCBA32_OR(reg, bit);
RCBA32(reg);
}
/* Set bit in Function Disable register to hide this device */
void pch_disable_devfn(struct device *dev)
{
switch (dev->path.pci.devfn) {
case PCH_DEVFN_ADSP: /* Audio DSP */
rcba_function_disable(FD, PCH_DISABLE_ADSPD);
break;
case PCH_DEVFN_XHCI: /* XHCI */
rcba_function_disable(FD, PCH_DISABLE_XHCI);
break;
case PCH_DEVFN_SDMA: /* DMA */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS0, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_I2C0: /* I2C0 */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS1, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_I2C1: /* I2C1 */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS2, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_SPI0: /* SPI0 */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS3, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_SPI1: /* SPI1 */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS4, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_UART0: /* UART0 */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS5, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_UART1: /* UART1 */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS6, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_ME: /* MEI #1 */
rcba_function_disable(FD2, PCH_DISABLE_MEI1);
break;
case PCH_DEVFN_ME_2: /* MEI #2 */
rcba_function_disable(FD2, PCH_DISABLE_MEI2);
break;
case PCH_DEVFN_ME_IDER: /* IDE-R */
rcba_function_disable(FD2, PCH_DISABLE_IDER);
break;
case PCH_DEVFN_ME_KT: /* KT */
rcba_function_disable(FD2, PCH_DISABLE_KT);
break;
case PCH_DEVFN_SDIO: /* SDIO */
pch_enable_d3hot(dev);
pch_iobp_update(SIO_IOBP_FUNCDIS7, ~0UL, SIO_IOBP_FUNCDIS_DIS);
break;
case PCH_DEVFN_GBE: /* Gigabit Ethernet */
rcba_function_disable(BUC, PCH_DISABLE_GBE);
break;
case PCH_DEVFN_HDA: /* HD Audio Controller */
rcba_function_disable(FD, PCH_DISABLE_HD_AUDIO);
break;
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 0): /* PCI Express Root Port 1 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 1): /* PCI Express Root Port 2 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 2): /* PCI Express Root Port 3 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 3): /* PCI Express Root Port 4 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 4): /* PCI Express Root Port 5 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 5): /* PCI Express Root Port 6 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 6): /* PCI Express Root Port 7 */
case PCI_DEVFN(PCH_DEV_SLOT_PCIE, 7): /* PCI Express Root Port 8 */
rcba_function_disable(FD,
PCH_DISABLE_PCIE(PCI_FUNC(dev->path.pci.devfn)));
break;
case PCH_DEVFN_EHCI: /* EHCI #1 */
rcba_function_disable(FD, PCH_DISABLE_EHCI1);
break;
case PCH_DEVFN_LPC: /* LPC */
rcba_function_disable(FD, PCH_DISABLE_LPC);
break;
case PCH_DEVFN_SATA: /* SATA #1 */
rcba_function_disable(FD, PCH_DISABLE_SATA1);
break;
case PCH_DEVFN_SMBUS: /* SMBUS */
rcba_function_disable(FD, PCH_DISABLE_SMBUS);
break;
case PCH_DEVFN_SATA2: /* SATA #2 */
rcba_function_disable(FD, PCH_DISABLE_SATA2);
break;
case PCH_DEVFN_THERMAL: /* Thermal Subsystem */
rcba_function_disable(FD, PCH_DISABLE_THERMAL);
break;
}
}
static void broadwell_pch_enable_dev(struct device *dev)
{
if (dev->path.type != DEVICE_PATH_PCI)
return;
if (dev->ops && dev->ops->enable)
return;
/* These devices need special enable/disable handling */
switch (PCI_SLOT(dev->path.pci.devfn)) {
case PCH_DEV_SLOT_PCIE:
case PCH_DEV_SLOT_EHCI:
case PCH_DEV_SLOT_HDA:
return;
}
if (!dev->enabled) {
printk(BIOS_DEBUG, "%s: Disabling device\n", dev_path(dev));
/* Ensure memory, io, and bus master are all disabled */
pci_and_config16(dev, PCI_COMMAND,
~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO));
/* Disable this device if possible */
pch_disable_devfn(dev);
} else {
/* Enable SERR */
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_SERR);
}
}
struct chip_operations soc_intel_broadwell_pch_ops = {
CHIP_NAME("Intel Broadwell PCH")
.enable_dev = &broadwell_pch_enable_dev,
};
#endif
|
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef MAINBOARD_EC_H
#define MAINBOARD_EC_H
#include <ec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#define EC_SCI_GPI 36 /* GPIO36 is EC_SCI# */
#define EC_SMI_GPI 34 /* GPIO34 is EC_SMI# */
#define MAINBOARD_EC_SCI_EVENTS \
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER))
#define MAINBOARD_EC_SMI_EVENTS \
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED))
/* EC can wake from S5 with lid or power button */
#define MAINBOARD_EC_S5_WAKE_EVENTS \
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
/* EC can wake from S3 with lid or power button or key press */
#define MAINBOARD_EC_S3_WAKE_EVENTS \
(MAINBOARD_EC_S5_WAKE_EVENTS |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED))
/* Log EC wake events plus EC shutdown events */
#define MAINBOARD_EC_LOG_EVENTS \
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_SHUTDOWN))
#endif
|
/*
** Copyright (C) 2000 Albert L. Faber
**
** 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.
*/
#ifndef LAYER3_H_INCLUDED
#define LAYER3_H_INCLUDED
void init_layer3(int);
int do_layer3_sideinfo(struct frame *fr);
int do_layer3( PMPSTR mp,unsigned char *pcm_sample,int *pcm_point);
#endif
|
/* Copyright (C) 1991, 1993, 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, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <stdio.h>
/* Push the character C back onto the input stream of STREAM. */
int
ungetc (c, stream)
int c;
FILE *stream;
{
if (!__validfp (stream) || !stream->__mode.__read)
{
__set_errno (EINVAL);
return EOF;
}
if (c == EOF)
return EOF;
if (stream->__pushed_back)
/* There is already a char pushed back. */
return EOF;
if ((stream->__linebuf_active || stream->__put_limit > stream->__buffer) &&
/* This is a read-write stream with something in its buffer.
Flush the stream. */
__flshfp (stream, EOF) == EOF)
return EOF;
stream->__pushback = (unsigned char) c;
/* Tell __fillbf we've pushed back a char. */
stream->__pushed_back = 1;
stream->__pushback_bufp = stream->__bufp;
/* Make the next getc call __fillbf. It will return C. */
stream->__bufp = stream->__get_limit;
/* We just gave it another character to read, so it's not at EOF. */
stream->__eof = 0;
return stream->__pushback;
}
|
/* Software floating-point emulation.
Return 0 iff a == b, 1 otherwise
Copyright (C) 1997,1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
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, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "single.h"
int __eqsf2(float a, float b)
{
FP_DECL_EX;
FP_DECL_S(A); FP_DECL_S(B);
int r;
FP_UNPACK_RAW_S(A, a);
FP_UNPACK_RAW_S(B, b);
FP_CMP_EQ_S(r, A, B);
if (r && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
FP_SET_EXCEPTION(FP_EX_INVALID);
FP_HANDLE_EXCEPTIONS;
return r;
}
strong_alias(__eqsf2, __nesf2);
|
/*
* Copyright 1998 Marcus Meissner
*
* Modified for use with MPlayer, detailed changelog at
* http://svn.mplayerhq.hu/mplayer/trunk/
* $Id: vfl.c 18883 2006-07-02 03:59:36Z reynaldo $
*
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "win32.h"
#include "loader.h"
#include "wine/winbase.h"
#include "wine/windef.h"
#include "wine/winuser.h"
#include "wine/vfw.h"
#include "wine/winestring.h"
#include "wine/driver.h"
#include "wine/avifmt.h"
#include "driver.h"
#define OpenDriverA DrvOpen
#define CloseDriver DrvClose
/***********************************************************************
* VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
* Returns the version in major.minor form.
* In Windows95 this returns 0x040003b6 (4.950)
*/
long VFWAPI VideoForWindowsVersion(void) {
return 0x040003B6; /* 4.950 */
}
/* system.ini: [drivers] */
/***********************************************************************
* ICInfo [MSVFW.33]
* Get information about an installable compressor. Return TRUE if there
* is one.
*/
int VFWAPI
ICInfo(
long fccType, /* [in] type of compressor ('vidc') */
long fccHandler, /* [in] <n>th compressor */
ICINFO *lpicinfo /* [out] information about compressor */
) {
/* does OpenDriver/CloseDriver */
lpicinfo->dwSize = sizeof(ICINFO);
lpicinfo->fccType = fccType;
lpicinfo->dwFlags = 0;
return TRUE;
}
/***********************************************************************
* ICOpen [MSVFW.37]
* Opens an installable compressor. Return special handle.
*/
HIC VFWAPI
//ICOpen(long fccType,long fccHandler,unsigned int wMode) {
ICOpen(long filename,long fccHandler,unsigned int wMode) {
ICOPEN icopen;
HDRVR hdrv;
WINE_HIC *whic;
/* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
* same layout as ICOPEN
*/
icopen.fccType = 0x63646976; // "vidc" //fccType;
icopen.fccHandler = fccHandler;
icopen.dwSize = sizeof(ICOPEN);
icopen.dwFlags = wMode;
icopen.pV1Reserved = (void*)filename;
/* FIXME: do we need to fill out the rest too? */
hdrv=OpenDriverA((long)&icopen);
if (!hdrv) return 0;
whic = malloc(sizeof(WINE_HIC));
whic->hdrv = hdrv;
whic->driverproc= ((DRVR*)hdrv)->DriverProc;
// whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
whic->driverid = ((DRVR*)hdrv)->dwDriverID;
return (HIC)whic;
}
/***********************************************************************
* ICGetInfo [MSVFW.30]
*/
LRESULT VFWAPI
ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
LRESULT ret;
ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
return ret;
}
/***********************************************************************
* ICCompress [MSVFW.23]
*/
long VFWAPIV
ICCompress(
HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
) {
ICCOMPRESS iccmp;
iccmp.dwFlags = dwFlags;
iccmp.lpbiOutput = lpbiOutput;
iccmp.lpOutput = lpData;
iccmp.lpbiInput = lpbiInput;
iccmp.lpInput = lpBits;
iccmp.lpckid = lpckid;
iccmp.lpdwFlags = lpdwFlags;
iccmp.lFrameNum = lFrameNum;
iccmp.dwFrameSize = dwFrameSize;
iccmp.dwQuality = dwQuality;
iccmp.lpbiPrev = lpbiPrev;
iccmp.lpPrev = lpPrev;
return ICSendMessage(hic,ICM_COMPRESS,(long)&iccmp,sizeof(iccmp));
}
/***********************************************************************
* ICDecompress [MSVFW.26]
*/
long VFWAPIV
ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
ICDECOMPRESS icd;
int result;
icd.dwFlags = dwFlags;
icd.lpbiInput = lpbiFormat;
icd.lpInput = lpData;
icd.lpbiOutput = lpbi;
icd.lpOutput = lpBits;
icd.ckid = 0;
result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
return result;
}
/***********************************************************************
* ICDecompressEx [MSVFW.26]
*/
long VFWAPIV
ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
ICDECOMPRESSEX icd;
int result;
icd.dwFlags = dwFlags;
icd.lpbiSrc = lpbiFormat;
icd.lpSrc = lpData;
icd.lpbiDst = lpbi;
icd.lpDst = lpBits;
icd.xSrc=icd.ySrc=0;
icd.dxSrc=lpbiFormat->biWidth;
icd.dySrc=abs(lpbiFormat->biHeight);
icd.xDst=icd.yDst=0;
icd.dxDst=lpbi->biWidth;
icd.dyDst=abs(lpbi->biHeight);
//icd.ckid = 0;
result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
return result;
}
long VFWAPIV
ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
ICDECOMPRESSEX icd;
int result;
icd.dwFlags = 0;
icd.lpbiSrc = lpbiFormat;
icd.lpSrc = 0;
icd.lpbiDst = lpbi;
icd.lpDst = 0;
icd.xSrc=icd.ySrc=0;
icd.dxSrc=lpbiFormat->biWidth;
icd.dySrc=abs(lpbiFormat->biHeight);
icd.xDst=icd.yDst=0;
icd.dxDst=lpbi->biWidth;
icd.dyDst=abs(lpbi->biHeight);
//icd.ckid = 0;
result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
return result;
}
/***********************************************************************
* ICSendMessage [MSVFW.40]
*/
LRESULT VFWAPI
ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
WINE_HIC *whic = (WINE_HIC*)hic;
return SendDriverMessage(whic->hdrv, msg, lParam1,lParam2);
}
/***********************************************************************
* ICClose [MSVFW.22]
*/
LRESULT VFWAPI ICClose(HIC hic) {
WINE_HIC *whic = (WINE_HIC*)hic;
/* FIXME: correct? */
// CloseDriver(whic->hdrv,0,0);
DrvClose(whic->hdrv);
//#warning FIXME: DrvClose
free(whic);
return 0;
}
int VFWAPI ICDoSomething()
{
return 0;
}
|
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015-2016 Symless Ltd.
*
* 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 LICENSE 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/>.
*/
#pragma once
#include "ipc/IpcServer.h"
#include "ipc/IpcMessage.h"
#include "arch/Arch.h"
#include "test/global/gmock.h"
using ::testing::_;
using ::testing::Invoke;
class IEventQueue;
class MockIpcServer : public IpcServer
{
public:
MockIpcServer() :
m_sendCond(ARCH->newCondVar()),
m_sendMutex(ARCH->newMutex()) { }
~MockIpcServer() {
if (m_sendCond != NULL) {
ARCH->closeCondVar(m_sendCond);
}
if (m_sendMutex != NULL) {
ARCH->closeMutex(m_sendMutex);
}
}
MOCK_METHOD0(listen, void());
MOCK_METHOD2(send, void(const IpcMessage&, EIpcClientType));
MOCK_CONST_METHOD1(hasClients, bool(EIpcClientType));
void delegateToFake() {
ON_CALL(*this, send(_, _)).WillByDefault(Invoke(this, &MockIpcServer::mockSend));
}
void waitForSend() {
ARCH->waitCondVar(m_sendCond, m_sendMutex, 5);
}
private:
void mockSend(const IpcMessage&, EIpcClientType) {
ArchMutexLock lock(m_sendMutex);
ARCH->broadcastCondVar(m_sendCond);
}
ArchCond m_sendCond;
ArchMutex m_sendMutex;
};
|
/**
* CityDrain3 is an open source software for modelling and simulating integrated
* urban drainage systems.
*
* Copyright (C) 2012 Gregor Burger
*
* 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
* Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef SIMULATION_H
#define SIMULATION_H
#include <boost/signals2.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/date_time.hpp>
using namespace boost;
using namespace boost::posix_time;
#include <cd3globals.h>
class IModel;
class Controller;
class Node;
struct NodeConnection;
class IController;
struct CD3_PUBLIC SimulationParameters {
SimulationParameters(){}
SimulationParameters(std::string start,
std::string stop,
std::string dt) {
this->start = time_from_string(start);
this->stop = time_from_string(stop);
this->dt = lexical_cast<int>(dt);
}
SimulationParameters(ptime start,
ptime stop,
int dt) : start(start), stop(stop), dt(dt) {
}
ptime start;
ptime stop;
int dt;
};
#define CD3_DECLARE_SIMULATION_NAME(simulation) \
const char *simulation::name = #simulation; \
const char *simulation::getClassName() const { return simulation::name; }
#define CD3_DECLARE_SIMULATION(simulation) \
class CD3_PUBLIC simulation : public ISimulation { \
public: \
static const char *name; \
const char *getClassName() const; \
private:
class CD3_PUBLIC ISimulation {
public:
ISimulation();
virtual ~ISimulation();
virtual const char *getClassName() const = 0;
virtual void setSimulationParameters(const SimulationParameters ¶ms);
virtual SimulationParameters getSimulationParameters() const;
virtual void setModel(IModel *model);
virtual IModel *getModel() const;
virtual void start(ptime time);
virtual void stop();
virtual void serialize(const std::string &dir) const;
virtual void deserialize(const std::string &dir, ptime time) const;
virtual int run(ptime time, int dt) = 0;
virtual NodeConnection *createConnection(Node *source,
const std::string &soport,
Node *sink,
const std::string &siport) const;
boost::signals2::signal<void (ISimulation *, ptime)> timestep_after;
boost::signals2::signal<void (ISimulation *, ptime)> timestep_before;
virtual void addController(IController *controller);
protected:
SimulationParameters sim_param;
IModel *model;
ptime current_time;
bool running;
std::vector<IController *> controllers;
};
#endif // SIMULATION_H
|
/*
* panel-reset.h
*
* Copyright (C) 2010 Perberos <perberos@gmail.com>
*
* 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; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __PANEL_RESET_H__
#define __PANEL_RESET_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void panel_reset(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !__PANEL_RESET_H__ */
|
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -g %s | FileCheck %s
// PR3023
void convert(void) {
struct { typeof(0) f0; } v0;
}
// PR2784
struct OPAQUE; // CHECK: DW_TAG_structure_type
typedef struct OPAQUE *PTR;
PTR p;
// PR2950
struct s0;
struct s0 { struct s0 *p; } g0;
struct s0 *f0(struct s0 *a0) {
return a0->p;
}
// PR3134
char xpto[];
// PR3427
struct foo {
int a;
void *ptrs[];
};
struct foo bar;
// PR4143
struct foo2 {
enum bar *bar;
};
struct foo2 foo2;
// Radar 7325611
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "barfoo"
typedef int barfoo;
barfoo foo() {
}
// CHECK: __uint128_t
__uint128_t foo128 ()
{
__uint128_t int128 = 44;
return int128;
}
// CHECK: uint64x2_t
typedef unsigned long long uint64_t;
typedef uint64_t uint64x2_t __attribute__((ext_vector_type(2)));
uint64x2_t extvectbar[4];
|
//____________________________________________________________________________
/*!
\class genie::IBDKinematicsGenerator
\brief Generates values for the kinematic variables describing IBD neutrino
interaction events.
Is a concrete implementation of the EventRecordVisitorI interface.
\author Corey Reed <cjreed \at nikhef.nl> - October 29, 2009
using code from the QELKinematicGenerator written by
Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
STFC, Rutherford Appleton Laboratory
\created October 29, 2009
\cpright Copyright (c) 2003-2013, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
*/
//____________________________________________________________________________
#ifndef _IBD_KINEMATICS_GENERATOR_H_
#define _IBD_KINEMATICS_GENERATOR_H_
#include "EVGModules/KineGeneratorWithCache.h"
#include "Utils/Range1.h"
namespace genie {
class IBDKinematicsGenerator : public KineGeneratorWithCache {
public :
IBDKinematicsGenerator();
IBDKinematicsGenerator(string config);
virtual ~IBDKinematicsGenerator();
// implement the EventRecordVisitorI interface
void ProcessEventRecord(GHepRecord * event_rec) const;
// overload the Algorithm::Configure() methods to load private data
// members from configuration options
void Configure(const Registry & config);
void Configure(string config);
private:
void LoadConfig (void);
double ComputeMaxXSec (const Interaction * in) const;
};
} // genie namespace
#endif // _IBD_KINEMATICS_GENERATOR_H_
|
/* xoreos - A reimplementation of BioWare's Aurora engine
*
* xoreos is the legal property of its developers, whose names
* can be found in the AUTHORS file distributed with this source
* distribution.
*
* xoreos 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.
*
* xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file
* The context handling the gameplay in Dragon Age: Origins.
*/
#ifndef ENGINES_DRAGONAGE_GAME_H
#define ENGINES_DRAGONAGE_GAME_H
#include <vector>
#include "src/common/scopedptr.h"
#include "src/aurora/language.h"
#include "src/sound/types.h"
#include "src/engines/aurora/resources.h"
#include "src/engines/dragonage/types.h"
namespace Engines {
class Console;
namespace DragonAge {
class DragonAgeEngine;
class Functions;
class Campaigns;
class Game {
public:
Game(DragonAgeEngine &engine, ::Engines::Console &console);
~Game();
/** Return the campaigns context. */
Campaigns &getCampaigns();
void run();
/** Load all talk tables in the current language found in this directory. */
void loadTalkTables(const Common::UString &dir, uint32 priority, ChangeList &res);
/** Load all game resource archives found in this directory. */
static void loadResources (const Common::UString &dir, uint32 priority, ChangeList &res);
/** Load all texture packs found in this directory. */
/** Load all talk tables in this language found in this directory. */
static void loadTalkTables (const Common::UString &dir, uint32 priority, ChangeList &res,
Aurora::Language language);
static void loadTexturePack(const Common::UString &dir, uint32 priority, ChangeList &res,
TextureQuality quality);
/** Unload this set of talk tables. */
static void unloadTalkTables(ChangeList &changes);
private:
DragonAgeEngine *_engine;
Common::ScopedPtr<Campaigns> _campaigns;
Common::ScopedPtr<Functions> _functions;
::Engines::Console *_console;
void runCampaigns();
static void loadResourceDir(const Common::UString &dir, uint32 priority, ChangeList &changes);
static void loadTalkTable (const Common::UString &tlk, Aurora::Language language,
uint32 priority, ChangeList &changes);
};
} // End of namespace DragonAge
} // End of namespace Engines
#endif // ENGINES_DRAGONAGE_GAME_H
|
/*! @file NAOWebotsIO.h
@brief Declaration of naoio class.
@class NAOWebotsIO
@brief NAOWebotsIO class for input and output to streams, files and networks on the NAO in Webots platform
@author Jason Kulk
Copyright (c) 2010 Jason Kulk
This file 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 file 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 NUbot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NAOWebotsIO_H
#define NAOWebotsIO_H
#include "NUPlatform/NUIO.h"
class NUbot;
class NAOWebotsPlatform;
class NAOWebotsNetworkThread;
class NAOWebotsIO: public NUIO
{
// Functions:
public:
NAOWebotsIO(NUbot* nubot, NAOWebotsPlatform* platform);
~NAOWebotsIO();
protected:
private:
// Members:
public:
protected:
private:
NAOWebotsNetworkThread* m_network; //!< the simulated network
};
#endif
|
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software. You can redistribute
* this software and/or modify this software 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.
*
* Cleanflight 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 software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "pg/pg.h"
#include "common/filter.h"
#include "common/time.h"
#include "sensors/current.h"
#include "sensors/voltage.h"
//TODO: Make the 'cell full' voltage user adjustble
#define CELL_VOLTAGE_FULL_CV 420
#define VBAT_CELL_VOTAGE_RANGE_MIN 100
#define VBAT_CELL_VOTAGE_RANGE_MAX 500
#define MAX_AUTO_DETECT_CELL_COUNT 8
#define GET_BATTERY_LPF_FREQUENCY(period) (1 / (period / 10.0f))
enum {
AUTO_PROFILE_CELL_COUNT_STAY = 0, // Stay on this profile irrespective of the detected cell count. Use this profile if no other profile matches (default, i.e. auto profile switching is off)
AUTO_PROFILE_CELL_COUNT_CHANGE = -1, // Always switch to a profile with matching cell count if there is one
};
typedef struct batteryConfig_s {
// voltage
uint16_t vbatmaxcellvoltage; // maximum voltage per cell, used for auto-detecting battery voltage in 0.01V units, default is 430 (4.30V)
uint16_t vbatmincellvoltage; // minimum voltage per cell, this triggers battery critical alarm, in 0.01V units, default is 330 (3.30V)
uint16_t vbatwarningcellvoltage; // warning voltage per cell, this triggers battery warning alarm, in 0.01V units, default is 350 (3.50V)
uint16_t vbatnotpresentcellvoltage; // Between vbatmaxcellvoltage and 2*this is considered to be USB powered. Below this it is notpresent
uint8_t lvcPercentage; // Percentage of throttle when lvc is triggered
voltageMeterSource_e voltageMeterSource; // source of battery voltage meter used, either ADC or ESC
// current
currentMeterSource_e currentMeterSource; // source of battery current meter used, either ADC, Virtual or ESC
uint16_t batteryCapacity; // mAh
// warnings / alerts
bool useVBatAlerts; // Issue alerts based on VBat readings
bool useConsumptionAlerts; // Issue alerts based on total power consumption
uint8_t consumptionWarningPercentage; // Percentage of remaining capacity that should trigger a battery warning
uint8_t vbathysteresis; // hysteresis for alarm, default 1 = 0.1V
uint16_t vbatfullcellvoltage; // Cell voltage at which the battery is deemed to be "full" 0.01V units, default is 410 (4.1V)
uint8_t forceBatteryCellCount; // Number of cells in battery, used for overwriting auto-detected cell count if someone has issues with it.
uint8_t vbatDisplayLpfPeriod; // Period of the cutoff frequency for the Vbat filter for display and startup (in 0.1 s)
uint8_t ibatLpfPeriod; // Period of the cutoff frequency for the Ibat filter (in 0.1 s)
uint8_t vbatDurationForWarning; // Period voltage has to sustain before the battery state is set to BATTERY_WARNING (in 0.1 s)
uint8_t vbatDurationForCritical; // Period voltage has to sustain before the battery state is set to BATTERY_CRIT (in 0.1 s)
uint8_t vbatSagLpfPeriod; // Period of the cutoff frequency for the Vbat sag and PID compensation filter (in 0.1 s)
} batteryConfig_t;
PG_DECLARE(batteryConfig_t, batteryConfig);
typedef struct lowVoltageCutoff_s {
bool enabled;
uint8_t percentage;
timeUs_t startTime;
} lowVoltageCutoff_t;
typedef enum {
BATTERY_OK = 0,
BATTERY_WARNING,
BATTERY_CRITICAL,
BATTERY_NOT_PRESENT,
BATTERY_INIT
} batteryState_e;
void batteryInit(void);
void batteryUpdateVoltage(timeUs_t currentTimeUs);
void batteryUpdatePresence(void);
batteryState_e getBatteryState(void);
batteryState_e getVoltageState(void);
batteryState_e getConsumptionState(void);
const char * getBatteryStateString(void);
void batteryUpdateStates(timeUs_t currentTimeUs);
void batteryUpdateAlarms(void);
struct rxConfig_s;
float calculateVbatPidCompensation(void);
uint8_t calculateBatteryPercentageRemaining(void);
bool isBatteryVoltageConfigured(void);
uint16_t getBatteryVoltage(void);
uint16_t getLegacyBatteryVoltage(void);
uint16_t getBatteryVoltageLatest(void);
uint8_t getBatteryCellCount(void);
uint16_t getBatteryAverageCellVoltage(void);
uint16_t getBatterySagCellVoltage(void);
bool isAmperageConfigured(void);
int32_t getAmperage(void);
int32_t getAmperageLatest(void);
int32_t getMAhDrawn(void);
void batteryUpdateCurrentMeter(timeUs_t currentTimeUs);
const lowVoltageCutoff_t *getLowVoltageCutoff(void);
|
/*
-Header_File SpiceUsr.h ( CSPICE user interface definitions )
-Abstract
Perform CSPICE user interface declarations, including type
definitions and function prototype declarations.
-Disclaimer
THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
-Required_Reading
None.
-Particulars
This file is an umbrella header that includes all header files
required to support the CSPICE application programming interface
(API). Users' application code that calls CSPICE need include only
this single header file. This file includes function prototypes for
the entire set of CSPICE routines. Typedef statements used to create
SPICE data types are also included.
About SPICE data types
======================
To assist with long-term maintainability of CSPICE, NAIF has elected
to use typedefs to represent data types occurring in argument lists
and as return values of CSPICE functions. These are:
SpiceBoolean
SpiceChar
SpiceDouble
SpiceInt
ConstSpiceBoolean
ConstSpiceChar
ConstSpiceDouble
ConstSpiceInt
The SPICE typedefs map in an arguably natural way to ANSI C types:
SpiceBoolean -> enum { SPICEFALSE = 0, SPICETRUE = 1 }
SpiceChar -> char
SpiceDouble -> double
SpiceInt -> int or long
ConstX -> const X (X = any of the above types)
The type SpiceInt is a special case: the corresponding type is picked
so as to be half the size of a double. On all currently supported
platforms, type double occupies 8 bytes and type int occupies 4
bytes. Other platforms may require a SpiceInt to map to type long.
While other data types may be used internally in CSPICE, no other
types appear in the API.
About CSPICE function prototypes
================================
Because CSPICE function prototypes enable substantial
compile-time error checking, we recommend that user
applications always reference them. Including the header
file SpiceUsr.h in any module that calls CSPICE will
automatically make the prototypes available.
About CSPICE C style
====================
CSPICE is written in ANSI C. No attempt has been made to support K&R
conventions or restrictions.
About C++ compatibility
=======================
The preprocessor directive -D__cplusplus should be used when
compiling C++ source code that includes this header file. This
directive will suppress mangling of CSPICE names, permitting linkage
to a CSPICE object library built from object modules produced by
an ANSI C compiler.
-Literature_References
None.
-Author_and_Institution
N.J. Bachman (JPL)
E.D. Wright (JPL)
-Restrictions
The #include statements contained in this file are not part of
the CSPICE API. The set of files included may change without notice.
Users should not include these files directly in their own
application code.
-Version
-CSPICE Version 3.0.0, 19-AUG-2002 (NJB)
Updated to include header files
SpiceCel.h
SpiceCK.h
SpiceSPK.h
-CSPICE Version 3.0.0, 17-FEB-1999 (NJB)
Updated to support suppression of name mangling when included in
C++ source code. Also now interface macros to intercept function
calls and perform automatic type casting.
Now includes platform macro definition header file.
References to types SpiceVoid and ConstSpiceVoid were removed.
-CSPICE Version 2.0.0, 06-MAY-1998 (NJB) (EDW)
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_SPICE_USER
#define HAVE_SPICE_USER
/*
Include CSPICE platform macro definitions.
*/
#include "SpiceZpl.h"
/*
Include CSPICE data type definitions.
*/
#include "SpiceZdf.h"
/*
Include the CSPICE EK interface definitions.
*/
#include "SpiceEK.h"
/*
Include the CSPICE Cell interface definitions.
*/
#include "SpiceCel.h"
/*
Include the CSPICE CK interface definitions.
*/
#include "SpiceCK.h"
/*
Include the CSPICE SPK interface definitions.
*/
#include "SpiceSPK.h"
/*
Include CSPICE prototypes.
*/
#include "SpiceZpr.h"
/*
Define the CSPICE function interface macros.
*/
#include "SpiceZim.h"
#endif
#ifdef __cplusplus
}
#endif
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "InformationElements"
* found in "../asn/InformationElements.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#ifndef _PrimaryCCPCH_Info_LCR_r4_H_
#define _PrimaryCCPCH_Info_LCR_r4_H_
#include <asn_application.h>
/* Including external dependencies */
#include <BOOLEAN.h>
#include "CellParametersID.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* PrimaryCCPCH-Info-LCR-r4 */
typedef struct PrimaryCCPCH_Info_LCR_r4 {
BOOLEAN_t tstd_Indicator;
CellParametersID_t *cellParametersID /* OPTIONAL */;
BOOLEAN_t sctd_Indicator;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} PrimaryCCPCH_Info_LCR_r4_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_PrimaryCCPCH_Info_LCR_r4;
#ifdef __cplusplus
}
#endif
#endif /* _PrimaryCCPCH_Info_LCR_r4_H_ */
#include <asn_internal.h>
|
// ----------------------------------------------------------------------------
// strutil.h
//
// Copyright (C) 2009
// Stelios Bounanos, M0GLD
//
// This file is part of fldigi.
//
// Fldigi 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.
//
// Fldigi 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 fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef STRUTIL_H_
#define STRUTIL_H_
#include <ostream>
#include <iterator>
#include <sstream>
#include <algorithm>
#include <string>
namespace join_ {
template <typename T> struct empty {
bool operator()(const T& v) const { return false; };
};
template <> struct empty<const char*> {
bool operator()(const char* v) const { return !v || *v == '\0'; };
};
template <> struct empty<char*> {
bool operator()(char* v) const { return !v || *v == '\0'; };
};
template <> struct empty<const wchar_t*> {
bool operator()(const wchar_t* v) const { return !v || *v == L'\0'; };
};
template <> struct empty<wchar_t*> {
bool operator()(wchar_t* v) const { return !v || *v == L'\0'; };
};
template <typename C> struct empty<std::basic_string<C> > {
bool operator()(const std::basic_string<C>& v) const { return v.empty(); };
};
template <typename T, typename CharT = char, typename TraitsT = std::char_traits<CharT> >
class ostream_iterator
: public std::iterator<std::output_iterator_tag, void, void, void, void>
{
public:
typedef std::basic_ostream<CharT, TraitsT> ostream_type;
ostream_iterator(ostream_type& s, const CharT* sep = 0, bool ie = false)
: stream(&s), join_string(sep), print_sep(false), ignore_empty(ie) { }
ostream_iterator& operator=(const T& value)
{
if (!ignore_empty || !is_empty(value)) {
if (print_sep)
*stream << join_string;
*stream << value;
print_sep = true;
}
return *this;
}
ostream_iterator& operator*(void) { return *this; }
ostream_iterator& operator++(void) { return *this; }
ostream_iterator& operator++(int) { return *this; }
private:
ostream_type* stream;
const CharT* join_string;
bool print_sep, ignore_empty;
empty<T> is_empty;
};
};
template <typename T, typename CharT, typename TraitsT>
std::basic_ostream<CharT, TraitsT>&
join(std::basic_ostream<CharT, TraitsT>& stream,
const T* begin, const T* end, const char* sep, bool ignore_empty = false)
{
std::copy(begin, end, join_::ostream_iterator<T, CharT, TraitsT>(stream, sep, ignore_empty));
return stream;
}
template <typename T, typename CharT, typename TraitsT>
std::basic_ostream<CharT, TraitsT>&
join(std::basic_ostream<CharT, TraitsT>& stream,
const T* ptr, size_t len, const char* sep, bool ignore_empty = false)
{
join<T, CharT, TraitsT>(stream, ptr, ptr + len, sep, ignore_empty);
return stream;
}
template <typename T>
std::string join(const T* begin, const T* end, const char* sep, bool ignore_empty = false)
{
std::ostringstream stream;
join<T>(stream, begin, end, sep, ignore_empty);
return stream.str();
}
template <typename T>
std::string join(const T* ptr, size_t len, const char* sep, bool ignore_empty = false)
{
return join<T>(ptr, ptr + len, sep, ignore_empty);
}
template <typename CharT>
std::basic_string<CharT> join(const std::basic_string<CharT>* begin, const std::basic_string<CharT>* end,
const char* sep, bool ignore_empty = false)
{
std::basic_ostringstream<CharT, std::char_traits<CharT> > stream;
join<std::basic_string<CharT> >(stream, begin, end, sep, ignore_empty);
return stream.str();
}
template <typename CharT>
std::basic_string<CharT> join(const std::basic_string<CharT>* begin, size_t len,
const char* sep, bool ignore_empty = false)
{
return join<CharT>(begin, begin + len, sep, ignore_empty);
}
#include <vector>
#include <climits>
std::vector<std::string> split(const char* re_str, const char* str, unsigned max_split = UINT_MAX);
std::string strformat( const char * fmt, ... );
#endif // STRUTIL_H_
// Local Variables:
// mode: c++
// c-file-style: "linux"
// End:
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Almanah
* Copyright (C) Philip Withnall 2008 <philip@tecnocode.co.uk>
*
* Almanah 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.
*
* Almanah 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 Almanah. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALMANAH_CALENDAR_TASK_EVENT_H
#define ALMANAH_CALENDAR_TASK_EVENT_H
#include <glib.h>
#include <glib-object.h>
#include "event.h"
G_BEGIN_DECLS
#define ALMANAH_TYPE_CALENDAR_TASK_EVENT (almanah_calendar_task_event_get_type ())
#define ALMANAH_CALENDAR_TASK_EVENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ALMANAH_TYPE_CALENDAR_TASK_EVENT, AlmanahCalendarTaskEvent))
#define ALMANAH_CALENDAR_TASK_EVENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ALMANAH_TYPE_CALENDAR_TASK_EVENT, AlmanahCalendarTaskEventClass))
#define ALMANAH_IS_CALENDAR_TASK_EVENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ALMANAH_TYPE_CALENDAR_TASK_EVENT))
#define ALMANAH_IS_CALENDAR_TASK_EVENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ALMANAH_TYPE_CALENDAR_TASK_EVENT))
#define ALMANAH_CALENDAR_TASK_EVENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ALMANAH_TYPE_CALENDAR_TASK_EVENT, AlmanahCalendarTaskEventClass))
typedef struct _AlmanahCalendarTaskEventPrivate AlmanahCalendarTaskEventPrivate;
typedef struct {
AlmanahEvent parent;
AlmanahCalendarTaskEventPrivate *priv;
} AlmanahCalendarTaskEvent;
typedef struct {
AlmanahEventClass parent;
} AlmanahCalendarTaskEventClass;
GType almanah_calendar_task_event_get_type (void);
AlmanahCalendarTaskEvent *almanah_calendar_task_event_new (const gchar *uid, const gchar *summary, GTime start_time);
G_END_DECLS
#endif /* !ALMANAH_CALENDAR_TASK_EVENT_H */
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "PDU-definitions"
* found in "../asn/PDU-definitions.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#ifndef _RRCConnectionSetup_r4_IEs_H_
#define _RRCConnectionSetup_r4_IEs_H_
#include <asn_application.h>
/* Including external dependencies */
#include "ActivationTime.h"
#include "U-RNTI.h"
#include "C-RNTI.h"
#include "RRC-StateIndicator.h"
#include "UTRAN-DRX-CycleLengthCoefficient.h"
#include "SRB-InformationSetupList2.h"
#include "MaxAllowedUL-TX-Power.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct CapabilityUpdateRequirement_r4;
struct UL_CommonTransChInfo_r4;
struct UL_AddReconfTransChInfoList;
struct DL_CommonTransChInfo_r4;
struct DL_AddReconfTransChInfoList_r4;
struct FrequencyInfo;
struct UL_ChannelRequirement_r4;
struct DL_CommonInformation_r4;
struct DL_InformationPerRL_List_r4;
/* RRCConnectionSetup-r4-IEs */
typedef struct RRCConnectionSetup_r4_IEs {
ActivationTime_t *activationTime /* OPTIONAL */;
U_RNTI_t new_U_RNTI;
C_RNTI_t *new_c_RNTI /* OPTIONAL */;
RRC_StateIndicator_t rrc_StateIndicator;
UTRAN_DRX_CycleLengthCoefficient_t utran_DRX_CycleLengthCoeff;
struct CapabilityUpdateRequirement_r4 *capabilityUpdateRequirement /* OPTIONAL */;
SRB_InformationSetupList2_t srb_InformationSetupList;
struct UL_CommonTransChInfo_r4 *ul_CommonTransChInfo /* OPTIONAL */;
struct UL_AddReconfTransChInfoList *ul_AddReconfTransChInfoList /* OPTIONAL */;
struct DL_CommonTransChInfo_r4 *dl_CommonTransChInfo /* OPTIONAL */;
struct DL_AddReconfTransChInfoList_r4 *dl_AddReconfTransChInfoList /* OPTIONAL */;
struct FrequencyInfo *frequencyInfo /* OPTIONAL */;
MaxAllowedUL_TX_Power_t *maxAllowedUL_TX_Power /* OPTIONAL */;
struct UL_ChannelRequirement_r4 *ul_ChannelRequirement /* OPTIONAL */;
struct DL_CommonInformation_r4 *dl_CommonInformation /* OPTIONAL */;
struct DL_InformationPerRL_List_r4 *dl_InformationPerRL_List /* OPTIONAL */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} RRCConnectionSetup_r4_IEs_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_RRCConnectionSetup_r4_IEs;
#ifdef __cplusplus
}
#endif
/* Referred external types */
#include "CapabilityUpdateRequirement-r4.h"
#include "UL-CommonTransChInfo-r4.h"
#include "UL-AddReconfTransChInfoList.h"
#include "DL-CommonTransChInfo-r4.h"
#include "DL-AddReconfTransChInfoList-r4.h"
#include "FrequencyInfo.h"
#include "UL-ChannelRequirement-r4.h"
#include "DL-CommonInformation-r4.h"
#include "DL-InformationPerRL-List-r4.h"
#endif /* _RRCConnectionSetup_r4_IEs_H_ */
#include <asn_internal.h>
|
/****************************************************************************
*
* Copyright (C) 2012 PX4 Development Team. 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 PX4 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.
*
****************************************************************************/
/**
* @file drv_sensor.h
*
* Common sensor API and ioctl definitions.
*/
#ifndef _DRV_SENSOR_H
#define _DRV_SENSOR_H
#include <stdint.h>
#include <sys/ioctl.h>
/*
* ioctl() definitions
*
* Note that a driver may not implement all of these operations, but
* if the operation is implemented it should conform to this API.
*/
#define _SENSORIOCBASE (0x2000)
#define _SENSORIOC(_n) (_IOC(_SENSORIOCBASE, _n))
/**
* Set the driver polling rate to (arg) Hz, or one of the SENSOR_POLLRATE
* constants
*/
#define SENSORIOCSPOLLRATE _SENSORIOC(0)
/**
* Return the driver's approximate polling rate in Hz, or one of the
* SENSOR_POLLRATE values.
*/
#define SENSORIOCGPOLLRATE _SENSORIOC(1)
#define SENSOR_POLLRATE_MANUAL 1000000 /**< poll when read */
#define SENSOR_POLLRATE_EXTERNAL 1000001 /**< poll when device signals ready */
#define SENSOR_POLLRATE_MAX 1000002 /**< poll at device maximum rate */
#define SENSOR_POLLRATE_DEFAULT 1000003 /**< poll at driver normal rate */
/**
* Set the internal queue depth to (arg) entries, must be at least 1
*
* This sets the upper bound on the number of readings that can be
* read from the driver.
*/
#define SENSORIOCSQUEUEDEPTH _SENSORIOC(2)
/** return the internal queue depth */
#define SENSORIOCGQUEUEDEPTH _SENSORIOC(3)
/**
* Reset the sensor to its default configuration.
*/
#define SENSORIOCRESET _SENSORIOC(4)
#endif /* _DRV_SENSOR_H */ |
#ifndef rdmDataTypes_h
#define rdmDataTypes_h
#define byte uint8_t
enum rdm_tod_state {
RDM_TOD_NOT_READY,
RDM_TOD_READY,
RDM_TOD_ERROR
};
union rdm_data_ {
struct {
uint16_t StartCode; // Start Code 0xCC01 for RDM
byte Length; // packet length
uint16_t DestMan;
uint32_t DestDev;
uint16_t SourceMan;
uint32_t SourceDev;
byte TransNo; // transaction number, not checked
byte ResponseType; // ResponseType
byte MsgCount; // Message count
uint16_t SubDev; // sub device number (root = 0)
byte CmdClass; // command class
uint16_t PID; // parameter ID
byte DataLength; // parameter data length in bytes
byte Data[231]; // data byte field
} __attribute__((packed)) packet;
struct {
byte headerFE;
byte headerAA;
byte maskedDevID[12];
byte maskedChecksum[4];
} __attribute__((packed)) discovery;
byte buffer[255];
void endianFlip(void) {
// 16 bit flips
packet.StartCode = (packet.StartCode << 8) | (packet.StartCode >> 8);
packet.DestMan = (packet.DestMan << 8) | (packet.DestMan >> 8);
packet.SourceMan = (packet.SourceMan << 8) | (packet.SourceMan >> 8);
packet.SubDev = (packet.SubDev << 8) | (packet.SubDev >> 8);
packet.PID = (packet.PID << 8) | (packet.PID >> 8);
// 32 bit flips
packet.DestDev = __builtin_bswap32 (packet.DestDev);
packet.SourceDev = __builtin_bswap32 (packet.SourceDev);
}
void clear(void) {
memset(&buffer, 0, 255);
//for (uint8_t x = 0; x < 255; x++)
// buffer[x] = 0;
}
};
typedef union rdm_data_ rdm_data;
#endif
|
#include <test.h>
#include <cf3.defs.h>
#include <dbm_api.h>
#include <lastseen.h>
#include <misc_lib.h> /* xsnprintf */
char CFWORKDIR[CF_BUFSIZE];
static void tests_setup(void)
{
xsnprintf(CFWORKDIR, CF_BUFSIZE, "/tmp/persistent_lock_test.XXXXXX");
mkdtemp(CFWORKDIR);
}
static void tests_teardown(void)
{
char cmd[CF_BUFSIZE];
xsnprintf(cmd, CF_BUFSIZE, "rm -rf '%s'", CFWORKDIR);
system(cmd);
}
static const Event dummy_event = {
.t = 1,
.Q = { 2.0, 3.0, 4.0, 5.0 }
};
/*
* Provides empty lastseen DB
*/
static DBHandle *setup(bool clean)
{
char cmd[CF_BUFSIZE];
xsnprintf(cmd, CF_BUFSIZE, "rm -rf '%s'/*", CFWORKDIR);
system(cmd);
DBHandle *db;
OpenDB(&db, dbid_bundles);
if (clean)
{
/* There is no way to disable hook in OpenDB yet, so just undo
* everything */
DBCursor *cursor;
if (!NewDBCursor(db, &cursor))
{
return NULL;
}
char *key;
void *value;
int ksize, vsize;
while (NextDB(cursor, &key, &ksize, &value, &vsize))
{
DBCursorDeleteEntry(cursor);
}
if (!DeleteDBCursor(cursor))
{
return NULL;
}
}
return db;
}
static void test_no_migration(void)
{
DBHandle *db = setup(true);
CloseDB(db);
/* Migration on empty DB should produce single "version" key */
assert_int_equal(OpenDB(&db, dbid_lastseen), true);
DBCursor *cursor;
assert_int_equal(NewDBCursor(db, &cursor), true);
char *key;
void *value;
int ksize, vsize;
while (NextDB(cursor, &key, &ksize, &value, &vsize))
{
assert_int_equal(ksize, strlen("version") + 1);
assert_string_equal(key, "version");
assert_int_equal(vsize, 2);
assert_string_equal(value, "1");
}
assert_int_equal(DeleteDBCursor(cursor), true);
CloseDB(db);
}
static void test_up_to_date(void)
{
/* Test that upgrade is not performed if there is already a version
* marker */
DBHandle *db = setup(false);
assert_int_equal(WriteDB(db, "foo", &dummy_event, sizeof(dummy_event)), true);
CloseDB(db);
/* Test that manually inserted key still has unqalified name the next
time the DB is opened, which is an indicator of the DB not being
upgraded */
assert_int_equal(OpenDB(&db, dbid_bundles), true);
Event read_value;
assert_int_equal(ReadDB(db, "foo", &read_value, sizeof(read_value)), true);
assert_int_equal(read_value.t, 1);
CloseDB(db);
}
void test_migrate_unqualified_names(void)
{
DBHandle *db = setup(true);
assert_int_equal(WriteDB(db, "foo", &dummy_event, sizeof(dummy_event)), true);
assert_int_equal(WriteDB(db, "q.bar", &dummy_event, sizeof(dummy_event)), true);
CloseDB(db);
assert_int_equal(OpenDB(&db, dbid_bundles), true);
/* Old entry migrated */
assert_int_equal(HasKeyDB(db, "foo", strlen("foo") + 1), false);
assert_int_equal(HasKeyDB(db, "default.foo", strlen("default.foo") + 1), true);
Event read_value = { 0 };
ReadDB(db, "default.foo", &read_value, sizeof(read_value));
assert_memory_equal(&read_value, &dummy_event, sizeof(dummy_event));
/* New entry preserved */
assert_int_equal(HasKeyDB(db, "q.bar", strlen("q.bar") + 1), true);
memset(&read_value, 0, sizeof(read_value));
ReadDB(db, "q.bar", &read_value, sizeof(read_value));
assert_memory_equal(&read_value, &dummy_event, sizeof(dummy_event));
/* Version marker */
assert_int_equal(HasKeyDB(db, "version", strlen("version") + 1), true);
CloseDB(db);
}
int main()
{
#ifdef LMDB
return 0;
#else
tests_setup();
const UnitTest tests[] =
{
unit_test(test_no_migration),
unit_test(test_up_to_date),
unit_test(test_migrate_unqualified_names),
};
PRINT_TEST_BANNER();
int ret = run_tests(tests);
tests_teardown();
return ret;
#endif
}
/* STUBS */
void FatalError(ARG_UNUSED char *s, ...)
{
fail();
exit(42);
}
|
//
// WAKWindow+Hooks.h
// Cydia
//
// Created on 8/31/16.
//
#import "iPhonePrivate.h"
@interface WAKWindow (Hooks)
+ (void)setUpHooks;
@end
|
/*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "fake.h"
void
InitCard(char *name)
{
KdCardInfoAdd(&fakeFuncs, 0);
}
void
InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
KdInitOutput(pScreenInfo, argc, argv);
}
void
InitInput(int argc, char **argv)
{
KdPointerInfo *pi;
KdKeyboardInfo *ki;
pi = KdNewPointer();
if (!pi)
return;
pi->driver = &FakePointerDriver;
KdAddPointer(pi);
ki = KdNewKeyboard();
if (!ki)
return;
ki->driver = &FakeKeyboardDriver;
KdAddKeyboard(ki);
KdInitInput();
}
void
CloseInput(void)
{
KdCloseInput();
}
#ifdef DDXBEFORERESET
void
ddxBeforeReset(void)
{
}
#endif
void
ddxUseMsg(void)
{
KdUseMsg();
}
int
ddxProcessArgument(int argc, char **argv, int i)
{
return KdProcessArgument(argc, argv, i);
}
void
OsVendorInit(void)
{
KdOsInit(&FakeOsFuncs);
}
KdCardFuncs fakeFuncs = {
fakeCardInit, /* cardinit */
fakeScreenInit, /* scrinit */
fakeInitScreen, /* initScreen */
fakeFinishInitScreen, /* finishInitScreen */
fakeCreateResources, /* createRes */
fakePreserve, /* preserve */
fakeEnable, /* enable */
fakeDPMS, /* dpms */
fakeDisable, /* disable */
fakeRestore, /* restore */
fakeScreenFini, /* scrfini */
fakeCardFini, /* cardfini */
0, /* initCursor */
0, /* enableCursor */
0, /* disableCursor */
0, /* finiCursor */
0, /* recolorCursor */
0, /* initAccel */
0, /* enableAccel */
0, /* disableAccel */
0, /* finiAccel */
fakeGetColors, /* getColors */
fakePutColors, /* putColors */
};
|
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2001, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
*
* File CDTRGTST.H
*
* Modification History:
* Name Description
* Madhu Katragadda Converted to C
*********************************************************************************
*/
/* REGRESSION TEST FOR DATE FORMAT */
#ifndef _CDTFRRGSTST
#define _CDTFRRGSTST
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "cintltst.h"
/**
* DateFormat Regresstion tests
**/
void Test4029195(void);
void Test4056591(void);
void Test4059917(void);
void Test4060212(void);
void Test4061287(void);
void Test4073003(void);
void Test4162071(void);
void Test714(void);
/**
* test subroutine
**/
void aux917(UDateFormat *fmt, UChar* str );
/**
* test subroutine used by the testing functions
**/
UChar* myFormatit(UDateFormat* datdef, UDate d1);
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
|
/*
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
BSD types compatibility layer for the SD host controller driver.
Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
# This code is licensed to you under the terms of the GNU GPL, version 2;
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
#ifndef __BSDTYPES_H__
#define __BSDTYPES_H__
#include "global.h"
#include "errno.h"
typedef u32 u_int;
//typedef u32 u_int32_t;
typedef u16 u_int16_t;
typedef u8 u_int8_t;
typedef u8 u_char;
typedef u32 bus_space_tag_t;
typedef u32 bus_space_handle_t;
struct device {
char dv_xname[255];
void *dummy;
};
#define MIN(a, b) (((a)>(b))?(b):(a))
#define wakeup(...)
#define bzero(mem, size) memset8(mem, 0, size)
#define ISSET(var, mask) (((var) & (mask)) ? 1 : 0)
#define SET(var, mask) ((var) |= (mask))
#endif
|
/* Float object interface */
/*
PyFloatObject represents a (double precision) floating point number.
*/
#ifndef Py_FLOATOBJECT_H
#define Py_FLOATOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
double ob_fval;
} PyFloatObject;
#endif
PyAPI_DATA(PyTypeObject) PyFloat_Type;
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
#ifdef Py_NAN
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
#endif
#define Py_RETURN_INF(sign) do \
if (copysign(1., sign) == 1.) { \
return PyFloat_FromDouble(Py_HUGE_VAL); \
} else { \
return PyFloat_FromDouble(-Py_HUGE_VAL); \
} while(0)
PyAPI_FUNC(double) PyFloat_GetMax(void);
PyAPI_FUNC(double) PyFloat_GetMin(void);
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
/* Return Python float from string PyObject. */
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);
/* Return Python float from C double. */
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
/* Extract C double from Python float. The macro version trades safety for
speed. */
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
#ifndef Py_LIMITED_API
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
#endif
#ifndef Py_LIMITED_API
/* _PyFloat_{Pack,Unpack}{4,8}
*
* The struct and pickle (at least) modules need an efficient platform-
* independent way to store floating-point values as byte strings.
* The Pack routines produce a string from a C double, and the Unpack
* routines produce a C double from such a string. The suffix (4 or 8)
* specifies the number of bytes in the string.
*
* On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
* these functions work by copying bits. On other platforms, the formats the
* 4- byte format is identical to the IEEE-754 single precision format, and
* the 8-byte format to the IEEE-754 double precision format, although the
* packing of INFs and NaNs (if such things exist on the platform) isn't
* handled correctly, and attempting to unpack a string containing an IEEE
* INF or NaN will raise an exception.
*
* On non-IEEE platforms with more precision, or larger dynamic range, than
* 754 supports, not all values can be packed; on non-IEEE platforms with less
* precision, or smaller dynamic range, not all values can be unpacked. What
* happens in such cases is partly accidental (alas).
*/
/* The pack routines write 2, 4 or 8 bytes, starting at p. le is a bool
* argument, true if you want the string in little-endian format (exponent
* last, at p+1, p+3 or p+7), false if you want big-endian format (exponent
* first, at p).
* Return value: 0 if all is OK, -1 if error (and an exception is
* set, most likely OverflowError).
* There are two problems on non-IEEE platforms:
* 1): What this does is undefined if x is a NaN or infinity.
* 2): -0.0 and +0.0 produce the same string.
*/
PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char *p, int le);
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
/* Needed for the old way for marshal to store a floating point number.
Returns the string length copied into p, -1 on error.
*/
PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len);
/* Used to get the important decimal digits of a double */
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
/* The unpack routines read 2, 4 or 8 bytes, starting at p. le is a bool
* argument, true if the string is in little-endian format (exponent
* last, at p+1, p+3 or p+7), false if big-endian (exponent first, at p).
* Return value: The unpacked double. On error, this is -1.0 and
* PyErr_Occurred() is true (and an exception is set, most likely
* OverflowError). Note that on a non-IEEE platform this will refuse
* to unpack a string that represents a NaN or infinity.
*/
PyAPI_FUNC(double) _PyFloat_Unpack2(const unsigned char *p, int le);
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
/* free list api */
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
_PyUnicodeWriter *writer,
PyObject *obj,
PyObject *format_spec,
Py_ssize_t start,
Py_ssize_t end);
#endif /* Py_LIMITED_API */
#ifdef __cplusplus
}
#endif
#endif /* !Py_FLOATOBJECT_H */
|
/*
* glyphs.h -- declaration of the GlueSimilarGlyphs feature.
*
* Copyright (c) 2007-2010, Dmitry Prokoptsev <dprokoptsev@gmail.com>,
* Alexander Gololobov <agololobov@gmail.com>
*
* This file is part of Pire, the Perl Incompatible
* Regular Expressions library.
*
* Pire is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pire 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 Public License for more details.
* You should have received a copy of the GNU Lesser Public License
* along with Pire. If not, see <http://www.gnu.org/licenses>.
*/
#ifndef PIRE_EXTRA_GLYPHS_H
#define PIRE_EXTRA_GLYPHS_H
namespace Pire {
class Feature;
namespace Features {
/**
* A feature which tells Pire not to distinguish latin
* and cyrillic letters having identical shapes
* (e.g. latin A and cyrillic A).
*/
Feature* GlueSimilarGlyphs();
}
}
#endif
|
// ZenLib::OS_Utils - Cross platform OS utils
// Copyright (C) 2002-2011 MediaArea.net SARL, Info@MediaArea.net
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef ZenOS_UtilsH
#define ZenOS_UtilsH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "ZenLib/Conf.h"
#include "ZenLib/Ztring.h"
//---------------------------------------------------------------------------
namespace ZenLib
{
//***************************************************************************
// OS Information
//***************************************************************************
//---------------------------------------------------------------------------
bool IsWin9X ();
//***************************************************************************
// Execute
//***************************************************************************
void Shell_Execute(const Ztring &ToExecute);
//***************************************************************************
// Directorues
//***************************************************************************
Ztring OpenFolder_Show(void* Handle, const Ztring &Title, const Ztring &Caption);
} //namespace ZenLib
#endif
|
/*
* ArcEmu MMORPG Server
* Copyright (C) 2008 <http://www.ArcEmu.org/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __NETWORK_H
#define __NETWORK_H
typedef int(*network_io_callback)(void*, int);
typedef struct
{
network_io_callback event_handler;
network_io_callback write_handler;
int fd;
void* miscdata;
// not used with udp
char * outbuffer;
int outlen;
int outbuffer_size;
} network_socket;
enum io_event
{
IOEVENT_READ = 0,
IOEVENT_WRITE = 1, // not used with udp
IOEVENT_ERROR = 2,
};
int network_init();
int network_io_poll();
int network_write_data(network_socket * s, void* data, int len, struct sockaddr * write_addr);
int network_read_data(network_socket * s, char* buffer, int buffer_len, struct sockaddr * read_addr); // read_addr not used in tcp
int network_close(network_socket * s);
int network_add_socket(network_socket * s);
int network_remove_socket(network_socket * s);
int default_tcp_write_handler(network_socket* s, int act);
void network_shutdown();
void network_init_socket(network_socket *s, int fd, int buffersize); // bufsize = 0 with udp sockets
void network_get_bandwidth_statistics(float* bwin, float* bwout);
#endif
|
//
// Cluster analyzer class
//
// Copyright(C) 2010 Mizuki Fujisawa <fujisawa@bayon.cc>
//
// 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
//
#ifndef BAYON_ANALYZER_H_
#define BAYON_ANALYZER_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <vector>
#include "byvector.h"
#include "cluster.h"
#include "document.h"
namespace bayon {
/**
* Analyzer class
*/
class Analyzer {
public:
/**
* clustering methods
*/
enum Method {
RB, ///< repeated bisection
KMEANS ///< kmeans
};
private:
/** maximum count of cluster refinement loop */
static const unsigned int NUM_REFINE_LOOP = 30;
std::vector<Document *> documents_; ///< documents
std::vector<Cluster *> clusters_; ///< clustering results
size_t cluster_index_; ///< the index of clusters
size_t limit_nclusters_; ///< maximum number of clusters
double limit_eval_; ///< limit of sectioned points
unsigned int seed_; ///< a seed of a random number generator
/**
* Do repeated bisection clustering.
* @return the number of clusters
*/
size_t repeated_bisection();
/**
* Do k-means clustering.
* @return the number of clusters
*/
size_t kmeans();
/**
* Refine clustering results.
* @param clusters clusters to be refined
* @return the value of refiend clusters
*/
double refine_clusters(std::vector<Cluster *> &clusters);
inline double refined_vector_value(const Vector &composite,
const Vector &vec, int sign);
/**
* Count document frequency(DF) of the features in documents.
* @param df document frequency
*/
void count_df(HashMap<VecKey, size_t>::type &df) const;
public:
/**
* Constructor.
*/
Analyzer() : cluster_index_(0), limit_nclusters_(0), limit_eval_(-1.0),
seed_(DEFAULT_SEED) { }
/**
* Constructor.
* @param seed seed for random number generator
*/
explicit Analyzer(unsigned int seed)
: cluster_index_(0), limit_nclusters_(0), limit_eval_(-1.0), seed_(seed) { }
/**
* Destructor.
*/
~Analyzer() {
for (size_t i = 0; i < documents_.size(); i++) {
delete documents_[i];
}
for (size_t i = 0; i < clusters_.size(); i++) {
for (size_t j = 0; j < clusters_[i]->sectioned_clusters().size(); j++) {
delete clusters_[i]->sectioned_clusters()[j];
}
delete clusters_[i];
}
}
/**
* Set a seed value for a random number generator.
* @param seed a seed value
*/
void set_seed(unsigned int seed) {
seed_ = seed;
}
/**
* Add a document.
* @param doc a document object
*/
void add_document(Document &doc) {
Document *ptr = new Document(doc.id(), doc.feature());
doc.set_features(NULL);
documents_.push_back(ptr);
}
/**
* Get documents.
* @return documents
*/
std::vector<Document *> &documents() {
return documents_;
}
/**
* Resize the feature vectors of documents.
* @param siz resized sizes of feature vectors
*/
void resize_document_features(size_t siz) {
for (size_t i = 0; i < documents_.size(); i++) {
documents_[i]->feature()->resize(siz);
}
}
/**
* Get clusters.
* @return clusters
*/
std::vector<Cluster *> &clusters() {
return clusters_;
}
/**
* Calculate inverse document frequency(IDF)
* and apply it to document vectors.
*/
void idf();
/**
* Calculate standard socre and apply it to document vectors.
*/
void standard_score();
/**
* Do clustering.
* @param method clustering method
* @return the number of clusters
*/
size_t do_clustering(Method method);
/**
* Get the next clustering result.
* @param cluster output cluster
* @return return true if next result exists
*/
bool get_next_result(Cluster &cluster) {
if (cluster_index_ < clusters_.size()) {
cluster = *clusters_[cluster_index_++];
return true;
}
return false;
}
/**
* Set the maximum number of clusters.
* @param nclusters the maximum number of clusters
*/
void set_cluster_size_limit(size_t nclusters) {
limit_nclusters_ = nclusters;
}
/**
* Set the minumum value of sectioned gain.
* @param limit the minimum value of sectioned gain
*/
void set_eval_limit(double limit) {
limit_eval_ = limit;
}
};
} /* namespace bayon */
#endif // BAYON_ANALYZER_H_
|
/*
* Copyright (C) 2018 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_lobaro_lorabox
* @brief Support for Lobaro LoraBox
* @{
*
* @file
* @brief Common pin definitions and board configuration options
*
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
*/
#ifndef BOARD_H
#define BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name xtimer configuration
* @{
*/
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (50)
#define XTIMER_ISR_BACKOFF (40)
/** @} */
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PORT GPIOA
#define LED0_PIN GPIO_PIN(PORT_A, 1)
#define LED0_MASK (1 << 1)
#define LED0_ON (LED0_PORT->BSRR = (LED0_MASK << 16))
#define LED0_OFF (LED0_PORT->BSRR = LED0_MASK)
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
#define EN3V3_PORT GPIOA
#define EN3V3_PIN GPIO_PIN(PORT_A, 11)
#define EN3V3_MASK (1 << 11)
#define EN3V3_ON (EN3V3_PORT->BSRR = EN3V3_MASK)
#define EN3V3_OFF (EN3V3_PORT->BSRR = (EN3V3_MASK << 16))
#define EN3V3_TOGGLE (EN3V3_PORT->ODR ^= EN3V3_MASK)
/** @} */
/**
* @name SX127X
*
* SX127X configuration.
* @{
*/
#define SX127X_PARAM_SPI_NSS GPIO_PIN(PORT_B, 0)
#define SX127X_PARAM_RESET GPIO_PIN(PORT_A, 4)
#define SX127X_PARAM_DIO0 GPIO_PIN(PORT_B, 1)
#define SX127X_PARAM_DIO1 GPIO_PIN(PORT_B, 10)
#define SX127X_PARAM_DIO2 GPIO_PIN(PORT_B, 11)
#define SX127X_PARAM_DIO3 GPIO_PIN(PORT_B, 7)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */
|
#include "plmtest.h"
void saPlmEntityGroupDelete_01(void)
{
SaPlmCallbacksT plms_cbks;
plms_cbks.saPlmReadinessTrackCallback = &TrackCallbackT;
safassert(saPlmInitialize(&plmHandle, &plms_cbks , &PlmVersion), SA_AIS_OK);
safassert(saPlmEntityGroupCreate(plmHandle,&entityGroupHandle), SA_AIS_OK);
safassert(saPlmEntityGroupAdd(entityGroupHandle , &f120_slot_1_dn , entityNamesNumber,SA_PLM_GROUP_SINGLE_ENTITY), SA_AIS_OK);
safassert(saPlmEntityGroupRemove(entityGroupHandle, &f120_slot_1_dn , entityNamesNumber),SA_AIS_OK);
rc=saPlmEntityGroupDelete(entityGroupHandle);
test_validate(rc, SA_AIS_OK);
safassert(saPlmFinalize(plmHandle), SA_AIS_OK);
}
void saPlmEntityGroupDelete_02(void)
{
SaPlmCallbacksT plms_cbks;
plms_cbks.saPlmReadinessTrackCallback = &TrackCallbackT;
safassert(saPlmInitialize(&plmHandle, &plms_cbks, &PlmVersion), SA_AIS_OK);
rc=saPlmEntityGroupDelete(entityGroupHandle);
test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
safassert(saPlmFinalize(plmHandle), SA_AIS_OK);
}
void saPlmEntityGroupDelete_03(void)
{
SaPlmCallbacksT plms_cbks;
plms_cbks.saPlmReadinessTrackCallback = &TrackCallbackT;
safassert(saPlmInitialize(&plmHandle, &plms_cbks , &PlmVersion), SA_AIS_OK);
safassert(saPlmEntityGroupCreate(plmHandle,&entityGroupHandle), SA_AIS_OK);
safassert(saPlmEntityGroupAdd(entityGroupHandle , &f120_slot_1_dn , entityNamesNumber,SA_PLM_GROUP_SINGLE_ENTITY), SA_AIS_OK);
safassert(saPlmEntityGroupRemove(entityGroupHandle, &f120_slot_1_dn , entityNamesNumber),SA_AIS_OK);
safassert(saPlmFinalize(plmHandle), SA_AIS_OK);
rc=saPlmEntityGroupDelete(entityGroupHandle);
test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
}
|
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2008 Patrick Spendrin <ps_ml@gmx.de>
//
#ifndef FILEVIEW_FLOAT_ITEM_H
#define FILEVIEW_FLOAT_ITEM_H
#include <QtCore/QObject>
// forward declarations
class QListView;
class QPersistentModelIndex;
#include "AbstractFloatItem.h"
namespace Marble
{
class MarbleWidget;
/**
* @short Provides a float item with a list of opened files
*
*/
class FileViewFloatItem: public AbstractFloatItem
{
Q_OBJECT
Q_INTERFACES( Marble::RenderPluginInterface )
MARBLE_PLUGIN(FileViewFloatItem)
public:
explicit FileViewFloatItem( const QPointF &point = QPointF( -1, 10 ),
const QSizeF &size = QSizeF( 110.0, 250.0 ) );
~FileViewFloatItem();
QStringList backendTypes() const;
QString name() const;
QString guiString() const;
QString nameId() const;
QString description() const;
QIcon icon () const;
void initialize ();
bool isInitialized () const;
void changeViewport( ViewportParams *viewport );
virtual QPainterPath backgroundShape() const;
void paintContent( GeoPainter *painter, ViewportParams *viewport,
const QString& renderPos, GeoSceneLayer *layer = 0 );
protected:
bool eventFilter( QObject *object, QEvent *e );
private Q_SLOTS:
/** Map theme was changed, adjust controls */
void selectTheme( QString theme );
/** Enable/disable zoom in/out buttons */
void updateFileView();
void contextMenu(const QPoint& pos);
void addFile();
void removeFile();
private:
/** MarbleWidget this float item is installed as event filter for */
MarbleWidget *m_marbleWidget;
/** FileView controls */
QListView *m_fileView;
/** FileView embedding widget */
QWidget *m_fileViewParent;
/** current position */
QPoint m_itemPosition;
/** Radius of the viewport last time */
int m_oldViewportRadius;
/** Repaint needed */
bool m_repaintScheduled;
/** the last clicked ModelIndex */
QPersistentModelIndex* m_persIndex;
};
}
#endif // FILEVIEW_FLOAT_ITEM_H
|
/*--------------------------------------------------------------------
(C) Copyright 2006-2012 Barcelona Supercomputing Center
Centro Nacional de Supercomputacion
This file is part of Mercurium C/C++ source-to-source compiler.
See AUTHORS file in the top level directory for information
regarding developers and contributors.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
Mercurium C/C++ source-to-source compiler 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 Mercurium C/C++ source-to-source compiler; if
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.
--------------------------------------------------------------------*/
/*
<testinfo>
test_generator=config/mercurium
</testinfo>
*/
_Complex int i_a = 3i;
_Complex int i_c = 3j;
_Complex unsigned int ui_a = 3iu;
_Complex unsigned int ui_c = 3ju;
_Complex long l_a = 3il;
_Complex long l_c = 3jl;
_Complex double d_a = 3.0i;
_Complex double d_c = 3.0j;
_Complex float f_a = 3.0fi;
_Complex float f_c = 3.0fj;
void f(void)
{
i_a + i_c;
i_a = i_c;
i_a += i_c;
f_a + f_c;
f_a = f_c;
f_a += f_c;
f_a = d_a;
d_a = f_a;
f_a = i_a;
}
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2014. *
* *
* This program is free software. You may use, modify, and redistribute it *
* under the terms of the GNU Affero General Public License as published *
* by the Free Software Foundation, either version 3 or (at your option) *
* any later version. This program is distributed without any warranty. *
* See the file COPYING.agpl-v3 for details. *
\*************************************************************************/
/* Listing 59-4 */
/* i6d_ucase_cl.c
Client for i6d_ucase_sv.c: send each command-line argument as a datagram to
the server, and then display the contents of the server's response datagram.
*/
#include "i6d_ucase.h"
int
main(int argc, char *argv[])
{
struct sockaddr_in6 svaddr;
int sfd, j;
size_t msgLen;
ssize_t numBytes;
char resp[BUF_SIZE];
if (argc < 3 || strcmp(argv[1], "--help") == 0)
usageErr("%s host-address msg...\n", argv[0]);
/* Create a datagram socket; send to an address in the IPv6 domain */
sfd = socket(AF_INET6, SOCK_DGRAM, 0); /* Create client socket */
if (sfd == -1)
errExit("socket");
memset(&svaddr, 0, sizeof(struct sockaddr_in6));
svaddr.sin6_family = AF_INET6;
svaddr.sin6_port = htons(PORT_NUM);
if (inet_pton(AF_INET6, argv[1], &svaddr.sin6_addr) <= 0)
fatal("inet_pton failed for address '%s'", argv[1]);
/* Send messages to server; echo responses on stdout */
for (j = 2; j < argc; j++) {
msgLen = strlen(argv[j]);
if (sendto(sfd, argv[j], msgLen, 0, (struct sockaddr *) &svaddr,
sizeof(struct sockaddr_in6)) != msgLen)
fatal("sendto");
numBytes = recvfrom(sfd, resp, BUF_SIZE, 0, NULL, NULL);
if (numBytes == -1)
errExit("recvfrom");
printf("Response %d: %.*s\n", j - 1, (int) numBytes, resp);
}
exit(EXIT_SUCCESS);
}
|
int m[8],b[8];
int main(){
int i;
for(;1;){
m[0] = rand();
if(m[0] == 0){
for(i=0;i<8;i++){
m[i] = b[i];
}
break;
}
}
}
|
/* ************************************
*¡¶¾«Í¨Windows API¡·
* ʾÀý´úÂë
* wr.c
* 4.3.2 ´´½¨¡¢´ò¿ª¡¢¶ÁдÎļþ£¬»ñÈ¡Îļþ´óС
**************************************/
/* Í·Îļþ¡¡*/
#include <windows.h>
#include <stdio.h>
/* ************************************
* DWORD ReadFileContent(LPSTR szFilePath)
* ¹¦ÄÜ »ñÈ¡Îļþ´óС
* ¶ÁÈ¡ÎļþÄÚÈÝ£¬²¢ÒÔ16½øÖƵÄÐÎʽ´òÓ¡³öÀ´
* ²ÎÊý LPSTR szFilePath
* Îļþ·¾¶
**************************************/
DWORD ReadFileContent(LPSTR szFilePath)
{
//Îļþ´óС
HANDLE hFileRead;
//±£´æÎļþ´óС
LARGE_INTEGER liFileSize;
//³É¹¦¶ÁÈ¡µÄÎļþÊý¾Ý´óС
DWORD dwReadedSize;
//ÀÛ¼Ó¼ÆËãÒѾ¶ÁÈ¡Êý¾ÝµÄ´óС
LONGLONG liTotalRead = 0;
//ÎļþÊý¾Ý»º´æ
BYTE lpFileDataBuffer[32];
//´ò¿ªÒѾ´æÔÚµÄÎļþ£¬¶ÁÈ¡ÄÚÈÝ¡£
hFileRead = CreateFile(szFilePath,// Òª´ò¿ªµÄÎļþÃû
GENERIC_READ, // ÒÔ¶Á·½Ê½´ò¿ª
FILE_SHARE_READ, // ¿É¹²Ïí¶Á
NULL, // ĬÈϰ²È«ÉèÖÃ
OPEN_EXISTING, // Ö»´ò¿ªÒѾ´æÔÚµÄÎļþ
FILE_ATTRIBUTE_NORMAL, // ³£¹æÎļþÊôÐÔ
NULL); // ÎÞÄ£°å
//´ò¿ªÎļþÊÇ·ñ³É¹¦¡£
if(hFileRead==INVALID_HANDLE_VALUE)
{
printf("´ò¿ªÎļþʧ°Ü£º%d",GetLastError());
}
if(!GetFileSizeEx(hFileRead,&liFileSize))
{
printf("»ñÈ¡Îļþ´óСʧ°Ü£º%d",GetLastError());
}
else
{
printf("Îļþ´óСΪ£º%d\n",liFileSize.QuadPart);
}
//Ñ»·¶ÁÈ¡²¢´òÓ¡ÎļþÄÚÈÝ
while(TRUE)
{
DWORD i;
if(!ReadFile(hFileRead, //¶ÁÎļþµÄ¾ä±ú
lpFileDataBuffer, //´æ´¢¶ÁÈ¡µÄÎļþÄÚÈÝ
32, //¶ÁµÄ´óС£¨×Ö½Ú£©
&dwReadedSize, //ʵ¼Ê¶ÁÈ¡µÄ´óС
NULL)) //²»Ê¹ÓÃOverlapped
{
printf("¶ÁÎļþ´íÎó£º%d\n",GetLastError());
break;
}
printf("¶ÁÈ¡ÁË%d×Ö½Ú£¬ÎļþÄÚÈÝÊÇ£º",dwReadedSize);
for(i=0; i<dwReadedSize; i++)
{
printf("0x%x ",lpFileDataBuffer[i]);
}
printf("\n");
liTotalRead += dwReadedSize;
if(liTotalRead == liFileSize.QuadPart)
{
printf("¶ÁÎļþ½áÊø\n");
break;
}
}
CloseHandle(hFileRead);
return 0;
}
/* ************************************
* SaveDataToFile
* ¹¦ÄÜ ½«Êý¾Ý´æ´¢µ½Îļþĩβ
* ²ÎÊý LPSTR szFilePath Îļþ·¾¶
* LPVOID lpData Ðè´æ´¢µÄÊý¾Ý
* DWORD dwDataSize Êý¾Ý´óС£¨×Ö½Ú£©
**************************************/
DWORD SaveDataToFile(
LPSTR szFilePath,
LPVOID lpData,
DWORD dwDataSize)
{
//Îļþ¾ä±ú
HANDLE hFileWrite;
//³É¹¦Ð´ÈëµÄÊý¾Ý´óС
DWORD dwWritedDateSize;
//´ò¿ªÒѾ´æÔÚµÄÎļþ£¬¶ÁÈ¡ÄÚÈÝ¡£
hFileWrite = CreateFile(szFilePath, // Òª´ò¿ªµÄÎļþÃû
GENERIC_WRITE, // ÒÔд·½Ê½´ò¿ª
0, // ¿É¹²Ïí¶Á
NULL, // ĬÈϰ²È«ÉèÖÃ
OPEN_ALWAYS, // ´ò¿ªÒѾ´æÔÚµÄÎļþ£¬Ã»ÓÃÔò´´½¨
FILE_ATTRIBUTE_NORMAL, // ³£¹æÎļþÊôÐÔ
NULL); // ÎÞÄ£°å
//ÅжÏÊÇ·ñ´ò¿ª³É¹¦
if(hFileWrite==INVALID_HANDLE_VALUE)
{
printf("´ò¿ªÎļþʧ°Ü£º%d\n",GetLastError());
}
//ÉèÖÃÎļþÖ¸Õëµ½Îļþβ
SetFilePointer(hFileWrite,0,0,FILE_END);
//½«Êý¾ÝдÈëÎļþ
if(!WriteFile(hFileWrite,lpData,dwDataSize,&dwWritedDateSize,NULL))
{
printf("дÎļþʧ°Ü£º%d\n",GetLastError());
}
else
{
printf("дÎļþ³É¹¦£¬Ð´Èë%d×Ö½Ú¡£\n",dwWritedDateSize);
}
CloseHandle(hFileWrite);
return 0;
}
/* ************************************
* int main(void)
* ¹¦ÄÜ ÑÝʾʹÓÃSaveDataToFileºÍReadFileContentº¯Êý
**************************************/
int main(void)
{
LPSTR szFileData = "ÕâÊÇÒ»¸öÀý×Ó";
SaveDataToFile("C:\\show.txt",szFileData,lstrlen(szFileData));
ReadFileContent("C:\\show.txt");
return 0;
} |
/* This is free and unencumbered software released into the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h> /* for stdout */
#include "sysio_file.h"
/**
* @date 2014-11-19
* @author Arto Bendiken
* @see http://libc11.org/stdio/stdout.html
*/
static FILE __sysio_stdout = {
.fd = 1,
.error = 0,
};
FILE* const stdout = &__sysio_stdout;
|
/*
* Copyright 2014 Facebook, 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.
*/
#ifndef CPP2_WORKER_H_
#define CPP2_WORKER_H_ 1
#include <thrift/lib/cpp/async/TAsyncServerSocket.h>
#include <thrift/lib/cpp/async/TAsyncSSLSocket.h>
#include <thrift/lib/cpp/async/HHWheelTimer.h>
#include <thrift/lib/cpp2/server/ThriftServer.h>
#include <thrift/lib/cpp/async/TEventBase.h>
#include <thrift/lib/cpp/async/TEventHandler.h>
#include <thrift/lib/cpp/server/TServer.h>
#include <unordered_set>
#include <folly/wangle/acceptor/ConnectionManager.h>
#include <folly/wangle/acceptor/Acceptor.h>
namespace apache { namespace thrift {
// Forward declaration of classes
class Cpp2Connection;
class ThriftServer;
/**
* Cpp2Worker drives the actual I/O for ThriftServer connections.
*
* The ThriftServer itself accepts incoming connections, then hands off each
* connection to a Cpp2Worker running in another thread. There should
* typically be around one Cpp2Worker thread per core.
*/
class Cpp2Worker
: public folly::Acceptor {
public:
/**
* Cpp2Worker is the actual server object for existing connections.
* One or more of these should be created by ThriftServer (one per
* CPU core is recommended).
*
* @param server the ThriftServer which created us.
* @param serverChannel existing server channel to use, only for duplex server
*/
explicit Cpp2Worker(ThriftServer* server,
const std::shared_ptr<HeaderServerChannel>&
serverChannel = nullptr,
folly::EventBase* eventBase = nullptr) :
Acceptor(server->getServerSocketConfig()),
server_(server),
eventBase_(eventBase),
activeRequests_(0),
pendingCount_(0),
pendingTime_(std::chrono::steady_clock::now()) {
auto observer =
std::dynamic_pointer_cast<apache::thrift::async::EventBaseObserver>(
server_->getObserver());
if (serverChannel) {
// duplex
useExistingChannel(serverChannel);
} else if (!eventBase_) {
eventBase_ = folly::EventBaseManager::get()->getEventBase();
}
if (observer) {
eventBase_->setObserver(observer);
}
Acceptor::init(nullptr, eventBase_);
}
/**
* Get underlying server.
*
* @returns pointer to ThriftServer
*/
ThriftServer* getServer() const {
return server_;
}
/**
* Count the number of pending fds. Used for overload detection.
* Not thread-safe.
*/
int pendingCount();
/**
* Cached pending count. Thread-safe.
*/
int getPendingCount() const;
private:
/// The mother ship.
ThriftServer* server_;
/// An instance's TEventBase for I/O.
apache::thrift::async::TEventBase* eventBase_;
void onNewConnection(folly::AsyncSocket::UniquePtr,
const apache::thrift::transport::TSocketAddress*,
const std::string&,
const folly::TransportInfo&) override;
folly::AsyncSocket::UniquePtr makeNewAsyncSocket(folly::EventBase* base,
int fd) override {
return folly::AsyncSocket::UniquePtr(new apache::thrift::async::TAsyncSocket(base, fd));
}
folly::AsyncSSLSocket::UniquePtr makeNewAsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx,
folly::EventBase* base,
int fd) override {
return folly::AsyncSSLSocket::UniquePtr(
new apache::thrift::async::TAsyncSSLSocket(ctx, base, fd));
}
/**
* For a duplex Thrift server, use an existing channel
*/
void useExistingChannel(
const std::shared_ptr<HeaderServerChannel>& serverChannel);
uint32_t activeRequests_;
int pendingCount_;
std::chrono::steady_clock::time_point pendingTime_;
friend class Cpp2Connection;
friend class ThriftServer;
};
}} // apache::thrift
#endif // #ifndef CPP2_WORKER_H_
|
/*******************************************************************************
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* https://www.eclipse.org/legal/epl-2.0/
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs - MQTT 3.1.1 updates
*******************************************************************************/
#if !defined(MQTTPROTOCOL_H)
#define MQTTPROTOCOL_H
#include "LinkedList.h"
#include "MQTTPacket.h"
#include "Clients.h"
#define MAX_MSG_ID 65535
#define MAX_CLIENTID_LEN 65535
typedef struct
{
int socket;
Publications* p;
} pending_write;
typedef struct
{
List publications;
unsigned int msgs_received;
unsigned int msgs_sent;
List pending_writes; /* for qos 0 writes not complete */
} MQTTProtocol;
#include "MQTTProtocolOut.h"
#endif
|
/*****************************************************************************
* *
* PrimeSense PSCommon Library *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of PSCommon. *
* *
* 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 _XN_POOL_H_
#define _XN_POOL_H_
#include "XnList.h"
#include "XnHash.h"
namespace xnl
{
template <class T>
class Pool
{
public:
Pool(bool protect = false) : m_criticalSection(NULL)
{
if (protect)
{
XnStatus rc = xnOSCreateCriticalSection(&m_criticalSection);
if (rc != XN_STATUS_OK)
{
m_criticalSection = NULL;
}
}
}
virtual ~Pool()
{
Clear();
// Remove the used buffers (when pool is destroyed, there is no way to to
// reclaim the memory, so they have to be destroyed).
Lock();
while (m_used.Begin() != m_used.End())
{
T* data = (*m_used.Begin()).Key();
m_used.Remove(data);
Destroy(data);
}
Unlock();
}
virtual bool Initialize(int count)
{
Clear();
Lock();
for (int i = 0; i < count; ++i)
{
m_available.AddLast(Create());
}
Unlock();
return true;
}
T* Acquire()
{
Lock();
if (m_available.Size() == 0)
{
Unlock();
return NULL;
}
T* data = *m_available.Begin();
m_available.Remove(data);
m_used[data] = 1;
Unlock();
return data;
}
virtual XnStatus Release(T* data)
{
return DecRef(data);
}
void AddRef(T* data)
{
Lock();
if (m_used.Find(data) != m_used.End())
m_used[data]++;
Unlock();
}
XnStatus DecRef(T* data)
{
Lock();
if (m_used.Find(data) == m_used.End())
{
// Check if already released.
if (m_available.Find(data) != m_available.End())
{
Unlock();
return XN_STATUS_OK;
}
Unlock();
return XN_STATUS_NO_MATCH;
}
m_used[data]--;
if (m_used[data] == 0)
{
m_used.Remove(data);
if (Valid(data))
{
m_available.AddLast(data);
}
else
{
Destroy(data);
}
Unlock();
return XN_STATUS_OK;
}
Unlock();
return XN_STAUTS_NOT_LAST_REFERENCE;
}
virtual void Clear()
{
Lock();
while (m_available.Begin() != m_available.End())
{
T* data = *m_available.Begin();
m_available.Remove(data);
Destroy(data);
}
Unlock();
}
int Count()
{
Lock();
int count = m_available.Size() + m_used.Size();
Unlock();
return count;
}
void Lock()
{
if (m_criticalSection != NULL)
{
xnOSEnterCriticalSection(&m_criticalSection);
}
}
void Unlock()
{
if (m_criticalSection != NULL)
{
xnOSLeaveCriticalSection(&m_criticalSection);
}
}
protected:
virtual T* Create() {return XN_NEW(T);}
virtual void Destroy(T* data) {XN_DELETE(data);}
virtual bool Valid(T* /*data*/) {return true;}
xnl::Hash<T*, int> m_used;
xnl::List<T*> m_available;
XN_CRITICAL_SECTION_HANDLE m_criticalSection;
};
} // xnl
#endif |
/*
* Copyright 2010-2017 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.
*/
#pragma once
#ifdef _MSC_VER
//disable windows complaining about max template size.
#pragma warning (disable : 4503)
#endif // _MSC_VER
#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif // _MSC_VER
#ifdef USE_IMPORT_EXPORT
#ifdef AWS_IAM_EXPORTS
#define AWS_IAM_API __declspec(dllexport)
#else
#define AWS_IAM_API __declspec(dllimport)
#endif /* AWS_IAM_EXPORTS */
#else
#define AWS_IAM_API
#endif // USE_IMPORT_EXPORT
#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
#define AWS_IAM_API
#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2009-2010. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* %CopyrightEnd%
*/
/* Include file for writers of Native Implemented Functions.
*/
#ifndef __ERL_NIF_H__
#define __ERL_NIF_H__
#include "erl_drv_nif.h"
/* Version history:
** 0.1: R13B03
** 1.0: R13B04
** 2.0: R14A
*/
#define ERL_NIF_MAJOR_VERSION 2
#define ERL_NIF_MINOR_VERSION 0
#include <stdlib.h>
#ifdef SIZEOF_CHAR
# define SIZEOF_CHAR_SAVED__ SIZEOF_CHAR
# undef SIZEOF_CHAR
#endif
#ifdef SIZEOF_SHORT
# define SIZEOF_SHORT_SAVED__ SIZEOF_SHORT
# undef SIZEOF_SHORT
#endif
#ifdef SIZEOF_INT
# define SIZEOF_INT_SAVED__ SIZEOF_INT
# undef SIZEOF_INT
#endif
#ifdef SIZEOF_LONG
# define SIZEOF_LONG_SAVED__ SIZEOF_LONG
# undef SIZEOF_LONG
#endif
#ifdef SIZEOF_LONG_LONG
# define SIZEOF_LONG_LONG_SAVED__ SIZEOF_LONG_LONG
# undef SIZEOF_LONG_LONG
#endif
#ifdef HALFWORD_HEAP_EMULATOR
# define HALFWORD_HEAP_EMULATOR_SAVED__ HALFWORD_HEAP_EMULATOR
# undef HALFWORD_HEAP_EMULATOR
#endif
#include "erl_int_sizes_config.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HALFWORD_HEAP_EMULATOR
typedef unsigned int ERL_NIF_TERM;
#else
typedef unsigned long ERL_NIF_TERM;
#endif
struct enif_environment_t;
typedef struct enif_environment_t ErlNifEnv;
typedef struct
{
const char* name;
unsigned arity;
ERL_NIF_TERM (*fptr)(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
}ErlNifFunc;
typedef struct enif_entry_t
{
int major;
int minor;
const char* name;
int num_of_funcs;
ErlNifFunc* funcs;
int (*load) (ErlNifEnv*, void** priv_data, ERL_NIF_TERM load_info);
int (*reload) (ErlNifEnv*, void** priv_data, ERL_NIF_TERM load_info);
int (*upgrade)(ErlNifEnv*, void** priv_data, void** old_priv_data, ERL_NIF_TERM load_info);
void (*unload) (ErlNifEnv*, void* priv_data);
}ErlNifEntry;
typedef struct
{
size_t size;
unsigned char* data;
/* Internals (avert your eyes) */
ERL_NIF_TERM bin_term;
void* ref_bin;
}ErlNifBinary;
typedef struct enif_resource_type_t ErlNifResourceType;
typedef void ErlNifResourceDtor(ErlNifEnv*, void*);
typedef enum
{
ERL_NIF_RT_CREATE = 1,
ERL_NIF_RT_TAKEOVER = 2
}ErlNifResourceFlags;
typedef enum
{
ERL_NIF_LATIN1 = 1
}ErlNifCharEncoding;
typedef struct
{
ERL_NIF_TERM pid; /* internal, may change */
}ErlNifPid;
typedef ErlDrvSysInfo ErlNifSysInfo;
typedef struct ErlDrvTid_ *ErlNifTid;
typedef struct ErlDrvMutex_ ErlNifMutex;
typedef struct ErlDrvCond_ ErlNifCond;
typedef struct ErlDrvRWLock_ ErlNifRWLock;
typedef int ErlNifTSDKey;
typedef ErlDrvThreadOpts ErlNifThreadOpts;
#if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_))
# define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) RET_TYPE (*NAME) ARGS
typedef struct {
# include "erl_nif_api_funcs.h"
} TWinDynNifCallbacks;
extern TWinDynNifCallbacks WinDynNifCallbacks;
# undef ERL_NIF_API_FUNC_DECL
#endif
#if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)) && !defined(STATIC_ERLANG_DRIVER)
# define ERL_NIF_API_FUNC_MACRO(NAME) (WinDynNifCallbacks.NAME)
# include "erl_nif_api_funcs.h"
/* note that we have to keep ERL_NIF_API_FUNC_MACRO defined */
#else /* non windows or included from emulator itself */
# define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) extern RET_TYPE NAME ARGS
# include "erl_nif_api_funcs.h"
# undef ERL_NIF_API_FUNC_DECL
#endif
#if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_))
# define ERL_NIF_INIT_GLOB TWinDynNifCallbacks WinDynNifCallbacks;
# define ERL_NIF_INIT_DECL(MODNAME) __declspec(dllexport) ErlNifEntry* nif_init(TWinDynNifCallbacks* callbacks)
# define ERL_NIF_INIT_BODY memcpy(&WinDynNifCallbacks,callbacks,sizeof(TWinDynNifCallbacks))
#else
# define ERL_NIF_INIT_GLOB
# define ERL_NIF_INIT_BODY
# if defined(VXWORKS)
# define ERL_NIF_INIT_DECL(MODNAME) ErlNifEntry* MODNAME ## _init(void)
# else
# define ERL_NIF_INIT_DECL(MODNAME) ErlNifEntry* nif_init(void)
# endif
#endif
#ifdef __cplusplus
}
# define ERL_NIF_INIT_PROLOGUE extern "C" {
# define ERL_NIF_INIT_EPILOGUE }
#else
# define ERL_NIF_INIT_PROLOGUE
# define ERL_NIF_INIT_EPILOGUE
#endif
#define ERL_NIF_INIT(NAME, FUNCS, LOAD, RELOAD, UPGRADE, UNLOAD) \
ERL_NIF_INIT_PROLOGUE \
ERL_NIF_INIT_GLOB \
ERL_NIF_INIT_DECL(NAME) \
{ \
static ErlNifEntry entry = \
{ \
ERL_NIF_MAJOR_VERSION, \
ERL_NIF_MINOR_VERSION, \
#NAME, \
sizeof(FUNCS) / sizeof(*FUNCS), \
FUNCS, \
LOAD, RELOAD, UPGRADE, UNLOAD \
}; \
ERL_NIF_INIT_BODY; \
return &entry; \
} \
ERL_NIF_INIT_EPILOGUE
#endif /* __ERL_NIF_H__ */
|
/*=========================================================================
*
* 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 itkMultipleValuedNonLinearVnlOptimizer_h
#define itkMultipleValuedNonLinearVnlOptimizer_h
#include "itkMultipleValuedNonLinearOptimizer.h"
#include "itkMultipleValuedVnlCostFunctionAdaptor.h"
#include "itkCommand.h"
namespace itk
{
/** \class MultipleValuedNonLinearVnlOptimizer
* \brief This class is a base for the Optimization methods that
* optimize a multi-valued function.
*
* It is an Adaptor class for optimizers provided by the vnl library
*
* \ingroup Numerics Optimizers
* \ingroup ITKOptimizers
*/
class MultipleValuedNonLinearVnlOptimizer:
public MultipleValuedNonLinearOptimizer
{
public:
/** Standard class typedefs. */
typedef MultipleValuedNonLinearVnlOptimizer Self;
typedef MultipleValuedNonLinearOptimizer Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro(MultipleValuedNonLinearVnlOptimizer,
MultipleValueNonLinearOptimizer);
/** ParametersType typedef.
* It defines a position in the optimization search space. */
typedef Superclass::ParametersType ParametersType;
/** Set the cost Function. This method has to be overloaded
* by derived classes because the CostFunctionAdaptor requires
* to know the number of parameters at construction time. This
* number of parameters is obtained at run-time from the itkCostFunction.
* As a consequence each derived optimizer should construct its own
* CostFunctionAdaptor when overloading this method */
virtual void SetCostFunction(MultipleValuedCostFunction *costFunction) ITK_OVERRIDE = 0;
/** Define if the Cost function should provide a customized
Gradient computation or the gradient can be computed internally
using a default approach */
void SetUseCostFunctionGradient(bool);
void UseCostFunctionGradientOn()
{
this->SetUseCostFunctionGradient(true);
}
void UseCostFunctionGradientOff()
{
this->SetUseCostFunctionGradient(false);
}
bool GetUseCostFunctionGradient() const;
/** Return Cached Values. These method have the advantage of not triggering a
* recomputation of the metric value, but it has the disadvantage of
* returning a value that may not be the one corresponding to the
* current parameters. For GUI update purposes, this method is a
* good option, for mathematical validation you should rather call
* GetValue(). */
itkGetConstReferenceMacro(CachedValue, MeasureType);
itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
protected:
MultipleValuedNonLinearVnlOptimizer();
virtual ~MultipleValuedNonLinearVnlOptimizer();
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
typedef MultipleValuedVnlCostFunctionAdaptor CostFunctionAdaptorType;
void SetCostFunctionAdaptor(CostFunctionAdaptorType *adaptor);
const CostFunctionAdaptorType * GetCostFunctionAdaptor() const;
CostFunctionAdaptorType * GetCostFunctionAdaptor();
/** The purpose of this method is to get around the lack of const
* correctness in vnl cost_functions and optimizers */
CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor() const;
/** Command observer that will interact with the ITKVNL cost-function
* adaptor in order to generate iteration events. This will allow to overcome
* the limitation of VNL optimizers not offering callbacks for every
* iteration */
typedef ReceptorMemberCommand< Self > CommandType;
private:
MultipleValuedNonLinearVnlOptimizer(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
/** Callback function for the Command Observer */
void IterationReport(const EventObject & event);
CostFunctionAdaptorType *m_CostFunctionAdaptor;
bool m_UseGradient;
CommandType::Pointer m_Command;
mutable ParametersType m_CachedCurrentPosition;
mutable MeasureType m_CachedValue;
mutable DerivativeType m_CachedDerivative;
};
} // end namespace itk
#endif
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/greengrassv2/GreengrassV2_EXPORTS.h>
#include <aws/greengrassv2/GreengrassV2Request.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Http
{
class URI;
} //namespace Http
namespace GreengrassV2
{
namespace Model
{
/**
*/
class AWS_GREENGRASSV2_API ListComponentVersionsRequest : public GreengrassV2Request
{
public:
ListComponentVersionsRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "ListComponentVersions"; }
Aws::String SerializePayload() const override;
void AddQueryStringParameters(Aws::Http::URI& uri) const override;
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline const Aws::String& GetArn() const{ return m_arn; }
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; }
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; }
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); }
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); }
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline ListComponentVersionsRequest& WithArn(const Aws::String& value) { SetArn(value); return *this;}
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline ListComponentVersionsRequest& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;}
/**
* <p>The <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>
* of the component version.</p>
*/
inline ListComponentVersionsRequest& WithArn(const char* value) { SetArn(value); return *this;}
/**
* <p>The maximum number of results to be returned per paginated request.</p>
*/
inline int GetMaxResults() const{ return m_maxResults; }
/**
* <p>The maximum number of results to be returned per paginated request.</p>
*/
inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }
/**
* <p>The maximum number of results to be returned per paginated request.</p>
*/
inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }
/**
* <p>The maximum number of results to be returned per paginated request.</p>
*/
inline ListComponentVersionsRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline ListComponentVersionsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline ListComponentVersionsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* <p>The token to be used for the next set of paginated results.</p>
*/
inline ListComponentVersionsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}
private:
Aws::String m_arn;
bool m_arnHasBeenSet;
int m_maxResults;
bool m_maxResultsHasBeenSet;
Aws::String m_nextToken;
bool m_nextTokenHasBeenSet;
};
} // namespace Model
} // namespace GreengrassV2
} // namespace Aws
|
// 7 april 2015
/*
This file assumes that you have included <gtk/gtk.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls on Unix systems that use GTK+ to provide their UI (currently all except Mac OS X).
*/
#ifndef __LIBUI_UI_UNIX_H__
#define __LIBUI_UI_UNIX_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct uiUnixControl uiUnixControl;
struct uiUnixControl {
uiControl c;
uiControl *parent;
gboolean addedBefore;
gboolean explicitlyHidden;
void (*SetContainer)(uiUnixControl *, GtkContainer *, gboolean);
};
#define uiUnixControl(this) ((uiUnixControl *) (this))
// TODO document
_UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gboolean);
#define uiUnixControlDefaultDestroy(type) \
static void type ## Destroy(uiControl *c) \
{ \
/* TODO is this safe on floating refs? */ \
g_object_unref(type(c)->widget); \
uiFreeControl(c); \
}
#define uiUnixControlDefaultHandle(type) \
static uintptr_t type ## Handle(uiControl *c) \
{ \
return (uintptr_t) (type(c)->widget); \
}
#define uiUnixControlDefaultParent(type) \
static uiControl *type ## Parent(uiControl *c) \
{ \
return uiUnixControl(c)->parent; \
}
#define uiUnixControlDefaultSetParent(type) \
static void type ## SetParent(uiControl *c, uiControl *parent) \
{ \
uiControlVerifySetParent(c, parent); \
uiUnixControl(c)->parent = parent; \
}
#define uiUnixControlDefaultToplevel(type) \
static int type ## Toplevel(uiControl *c) \
{ \
return 0; \
}
#define uiUnixControlDefaultVisible(type) \
static int type ## Visible(uiControl *c) \
{ \
return gtk_widget_get_visible(type(c)->widget); \
}
#define uiUnixControlDefaultShow(type) \
static void type ## Show(uiControl *c) \
{ \
/*TODO part of massive hack about hidden before*/uiUnixControl(c)->explicitlyHidden=FALSE; \
gtk_widget_show(type(c)->widget); \
}
#define uiUnixControlDefaultHide(type) \
static void type ## Hide(uiControl *c) \
{ \
/*TODO part of massive hack about hidden before*/uiUnixControl(c)->explicitlyHidden=TRUE; \
gtk_widget_hide(type(c)->widget); \
}
#define uiUnixControlDefaultEnabled(type) \
static int type ## Enabled(uiControl *c) \
{ \
return gtk_widget_get_sensitive(type(c)->widget); \
}
#define uiUnixControlDefaultEnable(type) \
static void type ## Enable(uiControl *c) \
{ \
gtk_widget_set_sensitive(type(c)->widget, TRUE); \
}
#define uiUnixControlDefaultDisable(type) \
static void type ## Disable(uiControl *c) \
{ \
gtk_widget_set_sensitive(type(c)->widget, FALSE); \
}
// TODO this whole addedBefore stuff is a MASSIVE HACK.
#define uiUnixControlDefaultSetContainer(type) \
static void type ## SetContainer(uiUnixControl *c, GtkContainer *container, gboolean remove) \
{ \
if (!uiUnixControl(c)->addedBefore) { \
g_object_ref_sink(type(c)->widget); /* our own reference, which we release in Destroy() */ \
/* massive hack notes: without any of this, nothing gets shown when we show a window; without the if, all things get shown even if some were explicitly hidden (TODO why don't we just show everything except windows on create? */ \
/*TODO*/if(!uiUnixControl(c)->explicitlyHidden) gtk_widget_show(type(c)->widget); \
uiUnixControl(c)->addedBefore = TRUE; \
} \
if (remove) \
gtk_container_remove(container, type(c)->widget); \
else \
gtk_container_add(container, type(c)->widget); \
}
#define uiUnixControlAllDefaultsExceptDestroy(type) \
uiUnixControlDefaultHandle(type) \
uiUnixControlDefaultParent(type) \
uiUnixControlDefaultSetParent(type) \
uiUnixControlDefaultToplevel(type) \
uiUnixControlDefaultVisible(type) \
uiUnixControlDefaultShow(type) \
uiUnixControlDefaultHide(type) \
uiUnixControlDefaultEnabled(type) \
uiUnixControlDefaultEnable(type) \
uiUnixControlDefaultDisable(type) \
uiUnixControlDefaultSetContainer(type)
#define uiUnixControlAllDefaults(type) \
uiUnixControlDefaultDestroy(type) \
uiUnixControlAllDefaultsExceptDestroy(type)
// TODO document
#define uiUnixNewControl(type, var) \
var = type(uiUnixAllocControl(sizeof (type), type ## Signature, #type)); \
uiControl(var)->Destroy = type ## Destroy; \
uiControl(var)->Handle = type ## Handle; \
uiControl(var)->Parent = type ## Parent; \
uiControl(var)->SetParent = type ## SetParent; \
uiControl(var)->Toplevel = type ## Toplevel; \
uiControl(var)->Visible = type ## Visible; \
uiControl(var)->Show = type ## Show; \
uiControl(var)->Hide = type ## Hide; \
uiControl(var)->Enabled = type ## Enabled; \
uiControl(var)->Enable = type ## Enable; \
uiControl(var)->Disable = type ## Disable; \
uiUnixControl(var)->SetContainer = type ## SetContainer;
// TODO document
_UI_EXTERN uiUnixControl *uiUnixAllocControl(size_t n, uint32_t typesig, const char *typenamestr);
// uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText().
_UI_EXTERN char *uiUnixStrdupText(const char *);
#ifdef __cplusplus
}
#endif
#endif
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/s3control/S3Control_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace S3Control
{
namespace Model
{
class AWS_S3CONTROL_API UpdateJobPriorityResult
{
public:
UpdateJobPriorityResult();
UpdateJobPriorityResult(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
UpdateJobPriorityResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline const Aws::String& GetJobId() const{ return m_jobId; }
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline void SetJobId(const Aws::String& value) { m_jobId = value; }
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline void SetJobId(Aws::String&& value) { m_jobId = std::move(value); }
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline void SetJobId(const char* value) { m_jobId.assign(value); }
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline UpdateJobPriorityResult& WithJobId(const Aws::String& value) { SetJobId(value); return *this;}
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline UpdateJobPriorityResult& WithJobId(Aws::String&& value) { SetJobId(std::move(value)); return *this;}
/**
* <p>The ID for the job whose priority Amazon S3 updated.</p>
*/
inline UpdateJobPriorityResult& WithJobId(const char* value) { SetJobId(value); return *this;}
/**
* <p>The new priority assigned to the specified job.</p>
*/
inline int GetPriority() const{ return m_priority; }
/**
* <p>The new priority assigned to the specified job.</p>
*/
inline void SetPriority(int value) { m_priority = value; }
/**
* <p>The new priority assigned to the specified job.</p>
*/
inline UpdateJobPriorityResult& WithPriority(int value) { SetPriority(value); return *this;}
private:
Aws::String m_jobId;
int m_priority;
};
} // namespace Model
} // namespace S3Control
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/devops-guru/DevOpsGuru_EXPORTS.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace DevOpsGuru
{
namespace Model
{
class AWS_DEVOPSGURU_API PutFeedbackResult
{
public:
PutFeedbackResult();
PutFeedbackResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
PutFeedbackResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
};
} // namespace Model
} // namespace DevOpsGuru
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/dax/DAX_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace DAX
{
namespace Model
{
/**
* <p>Represents the subnet associated with a DAX cluster. This parameter refers to
* subnets defined in Amazon Virtual Private Cloud (Amazon VPC) and used with
* DAX.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/dax-2017-04-19/Subnet">AWS API
* Reference</a></p>
*/
class AWS_DAX_API Subnet
{
public:
Subnet();
Subnet(Aws::Utils::Json::JsonView jsonValue);
Subnet& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline const Aws::String& GetSubnetIdentifier() const{ return m_subnetIdentifier; }
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline bool SubnetIdentifierHasBeenSet() const { return m_subnetIdentifierHasBeenSet; }
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline void SetSubnetIdentifier(const Aws::String& value) { m_subnetIdentifierHasBeenSet = true; m_subnetIdentifier = value; }
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline void SetSubnetIdentifier(Aws::String&& value) { m_subnetIdentifierHasBeenSet = true; m_subnetIdentifier = std::move(value); }
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline void SetSubnetIdentifier(const char* value) { m_subnetIdentifierHasBeenSet = true; m_subnetIdentifier.assign(value); }
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline Subnet& WithSubnetIdentifier(const Aws::String& value) { SetSubnetIdentifier(value); return *this;}
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline Subnet& WithSubnetIdentifier(Aws::String&& value) { SetSubnetIdentifier(std::move(value)); return *this;}
/**
* <p>The system-assigned identifier for the subnet.</p>
*/
inline Subnet& WithSubnetIdentifier(const char* value) { SetSubnetIdentifier(value); return *this;}
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline const Aws::String& GetSubnetAvailabilityZone() const{ return m_subnetAvailabilityZone; }
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline bool SubnetAvailabilityZoneHasBeenSet() const { return m_subnetAvailabilityZoneHasBeenSet; }
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline void SetSubnetAvailabilityZone(const Aws::String& value) { m_subnetAvailabilityZoneHasBeenSet = true; m_subnetAvailabilityZone = value; }
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline void SetSubnetAvailabilityZone(Aws::String&& value) { m_subnetAvailabilityZoneHasBeenSet = true; m_subnetAvailabilityZone = std::move(value); }
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline void SetSubnetAvailabilityZone(const char* value) { m_subnetAvailabilityZoneHasBeenSet = true; m_subnetAvailabilityZone.assign(value); }
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline Subnet& WithSubnetAvailabilityZone(const Aws::String& value) { SetSubnetAvailabilityZone(value); return *this;}
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline Subnet& WithSubnetAvailabilityZone(Aws::String&& value) { SetSubnetAvailabilityZone(std::move(value)); return *this;}
/**
* <p>The Availability Zone (AZ) for the subnet.</p>
*/
inline Subnet& WithSubnetAvailabilityZone(const char* value) { SetSubnetAvailabilityZone(value); return *this;}
private:
Aws::String m_subnetIdentifier;
bool m_subnetIdentifierHasBeenSet;
Aws::String m_subnetAvailabilityZone;
bool m_subnetAvailabilityZoneHasBeenSet;
};
} // namespace Model
} // namespace DAX
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/iotsitewise/IoTSiteWise_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/iotsitewise/model/AssetRelationshipSummary.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace IoTSiteWise
{
namespace Model
{
class AWS_IOTSITEWISE_API ListAssetRelationshipsResult
{
public:
ListAssetRelationshipsResult();
ListAssetRelationshipsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
ListAssetRelationshipsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline const Aws::Vector<AssetRelationshipSummary>& GetAssetRelationshipSummaries() const{ return m_assetRelationshipSummaries; }
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline void SetAssetRelationshipSummaries(const Aws::Vector<AssetRelationshipSummary>& value) { m_assetRelationshipSummaries = value; }
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline void SetAssetRelationshipSummaries(Aws::Vector<AssetRelationshipSummary>&& value) { m_assetRelationshipSummaries = std::move(value); }
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline ListAssetRelationshipsResult& WithAssetRelationshipSummaries(const Aws::Vector<AssetRelationshipSummary>& value) { SetAssetRelationshipSummaries(value); return *this;}
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline ListAssetRelationshipsResult& WithAssetRelationshipSummaries(Aws::Vector<AssetRelationshipSummary>&& value) { SetAssetRelationshipSummaries(std::move(value)); return *this;}
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline ListAssetRelationshipsResult& AddAssetRelationshipSummaries(const AssetRelationshipSummary& value) { m_assetRelationshipSummaries.push_back(value); return *this; }
/**
* <p>A list that summarizes each asset relationship.</p>
*/
inline ListAssetRelationshipsResult& AddAssetRelationshipSummaries(AssetRelationshipSummary&& value) { m_assetRelationshipSummaries.push_back(std::move(value)); return *this; }
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline void SetNextToken(const char* value) { m_nextToken.assign(value); }
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline ListAssetRelationshipsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline ListAssetRelationshipsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* <p>The token for the next set of results, or null if there are no additional
* results.</p>
*/
inline ListAssetRelationshipsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}
private:
Aws::Vector<AssetRelationshipSummary> m_assetRelationshipSummaries;
Aws::String m_nextToken;
};
} // namespace Model
} // namespace IoTSiteWise
} // 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 itkMetaGaussianConverter_h
#define itkMetaGaussianConverter_h
#include "itkMetaConverterBase.h"
#include "itkGaussianSpatialObject.h"
#include "metaGaussian.h"
namespace itk
{
/** \class MetaGaussianConverter
* \brief Converts between MetaObject<->SpatialObject.
*
* \sa MetaConverterBase
* \ingroup ITKSpatialObjects
*/
template< unsigned int NDimensions = 3 >
class ITK_TEMPLATE_EXPORT MetaGaussianConverter :
public MetaConverterBase< NDimensions >
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(MetaGaussianConverter);
/** Standard class type aliases */
using Self = MetaGaussianConverter;
using Superclass = MetaConverterBase< NDimensions >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(MetaGaussianConverter, MetaConverterBase);
using SpatialObjectType = typename Superclass::SpatialObjectType;
using SpatialObjectPointer = typename SpatialObjectType::Pointer;
using MetaObjectType = typename Superclass::MetaObjectType;
/** Specific class types for conversion */
using GaussianSpatialObjectType = GaussianSpatialObject<NDimensions>;
using GaussianSpatialObjectPointer = typename GaussianSpatialObjectType::Pointer;
using GaussianSpatialObjectConstPointer = typename GaussianSpatialObjectType::ConstPointer;
using GaussianMetaObjectType = MetaGaussian;
/** Convert the MetaObject to Spatial Object */
SpatialObjectPointer MetaObjectToSpatialObject(const MetaObjectType *mo) override;
/** Convert the SpatialObject to MetaObject */
MetaObjectType *SpatialObjectToMetaObject(const SpatialObjectType *spatialObject) override;
protected:
/** Create the specific MetaObject for this class */
MetaObjectType *CreateMetaObject() override;
MetaGaussianConverter();
~MetaGaussianConverter() override = default;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMetaGaussianConverter.hxx"
#endif
#endif
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/medialive/MediaLive_EXPORTS.h>
#include <aws/medialive/model/FollowPoint.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace MediaLive
{
namespace Model
{
/**
* Settings to specify if an action follows another.<p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/FollowModeScheduleActionStartSettings">AWS
* API Reference</a></p>
*/
class AWS_MEDIALIVE_API FollowModeScheduleActionStartSettings
{
public:
FollowModeScheduleActionStartSettings();
FollowModeScheduleActionStartSettings(Aws::Utils::Json::JsonView jsonValue);
FollowModeScheduleActionStartSettings& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* Identifies whether this action starts relative to the start or relative to the
* end of the reference action.
*/
inline const FollowPoint& GetFollowPoint() const{ return m_followPoint; }
/**
* Identifies whether this action starts relative to the start or relative to the
* end of the reference action.
*/
inline bool FollowPointHasBeenSet() const { return m_followPointHasBeenSet; }
/**
* Identifies whether this action starts relative to the start or relative to the
* end of the reference action.
*/
inline void SetFollowPoint(const FollowPoint& value) { m_followPointHasBeenSet = true; m_followPoint = value; }
/**
* Identifies whether this action starts relative to the start or relative to the
* end of the reference action.
*/
inline void SetFollowPoint(FollowPoint&& value) { m_followPointHasBeenSet = true; m_followPoint = std::move(value); }
/**
* Identifies whether this action starts relative to the start or relative to the
* end of the reference action.
*/
inline FollowModeScheduleActionStartSettings& WithFollowPoint(const FollowPoint& value) { SetFollowPoint(value); return *this;}
/**
* Identifies whether this action starts relative to the start or relative to the
* end of the reference action.
*/
inline FollowModeScheduleActionStartSettings& WithFollowPoint(FollowPoint&& value) { SetFollowPoint(std::move(value)); return *this;}
/**
* The action name of another action that this one refers to.
*/
inline const Aws::String& GetReferenceActionName() const{ return m_referenceActionName; }
/**
* The action name of another action that this one refers to.
*/
inline bool ReferenceActionNameHasBeenSet() const { return m_referenceActionNameHasBeenSet; }
/**
* The action name of another action that this one refers to.
*/
inline void SetReferenceActionName(const Aws::String& value) { m_referenceActionNameHasBeenSet = true; m_referenceActionName = value; }
/**
* The action name of another action that this one refers to.
*/
inline void SetReferenceActionName(Aws::String&& value) { m_referenceActionNameHasBeenSet = true; m_referenceActionName = std::move(value); }
/**
* The action name of another action that this one refers to.
*/
inline void SetReferenceActionName(const char* value) { m_referenceActionNameHasBeenSet = true; m_referenceActionName.assign(value); }
/**
* The action name of another action that this one refers to.
*/
inline FollowModeScheduleActionStartSettings& WithReferenceActionName(const Aws::String& value) { SetReferenceActionName(value); return *this;}
/**
* The action name of another action that this one refers to.
*/
inline FollowModeScheduleActionStartSettings& WithReferenceActionName(Aws::String&& value) { SetReferenceActionName(std::move(value)); return *this;}
/**
* The action name of another action that this one refers to.
*/
inline FollowModeScheduleActionStartSettings& WithReferenceActionName(const char* value) { SetReferenceActionName(value); return *this;}
private:
FollowPoint m_followPoint;
bool m_followPointHasBeenSet;
Aws::String m_referenceActionName;
bool m_referenceActionNameHasBeenSet;
};
} // namespace Model
} // namespace MediaLive
} // namespace Aws
|
/* main.c - Application main entry point */
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <zephyr/types.h>
#include <stddef.h>
#include <string.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <tc_util.h>
#include <net/buf.h>
#include "icmpv6.h"
static int handler_called;
static int handler_status;
#define TEST_MSG "foobar devnull"
NET_PKT_TX_SLAB_DEFINE(pkts_slab, 2);
NET_BUF_POOL_DEFINE(data_pool, 2, 128, 0, NULL);
static enum net_verdict handle_test_msg(struct net_pkt *pkt)
{
struct net_buf *last = net_buf_frag_last(pkt->frags);
if (last->len != (strlen(TEST_MSG) + 1)) {
handler_status = -EINVAL;
} else {
handler_status = 0;
}
handler_called++;
return 0;
}
static struct net_icmpv6_handler test_handler1 = {
.type = NET_ICMPV6_ECHO_REPLY,
.code = 0,
.handler = handle_test_msg,
};
static struct net_icmpv6_handler test_handler2 = {
.type = NET_ICMPV6_ECHO_REQUEST,
.code = 0,
.handler = handle_test_msg,
};
static bool run_tests(void)
{
struct net_pkt *pkt;
struct net_buf *frag;
int ret;
net_icmpv6_register_handler(&test_handler1);
net_icmpv6_register_handler(&test_handler2);
pkt = net_pkt_get_reserve(&pkts_slab, 0, K_FOREVER);
frag = net_buf_alloc(&data_pool, K_FOREVER);
net_pkt_frag_add(pkt, frag);
memcpy(net_buf_add(frag, sizeof(TEST_MSG)),
TEST_MSG, sizeof(TEST_MSG));
ret = net_icmpv6_input(pkt, 0, 0);
if (!ret) {
printk("%d: Callback not called properly\n", __LINE__);
return false;
}
handler_status = -1;
ret = net_icmpv6_input(pkt, NET_ICMPV6_ECHO_REPLY, 0);
if (ret < 0 || handler_status != 0) {
printk("%d: Callback not called properly\n", __LINE__);
return false;
}
ret = net_icmpv6_input(pkt, 1, 0);
if (!ret) {
printk("%d: Callback not called properly\n", __LINE__);
return false;
}
handler_status = -1;
ret = net_icmpv6_input(pkt, NET_ICMPV6_ECHO_REQUEST, 0);
if (ret < 0 || handler_status != 0) {
printk("%d: Callback not called properly\n", __LINE__);
return false;
}
if (handler_called != 2) {
printk("%d: Callbacks not called properly\n", __LINE__);
return false;
}
printk("ICMPv6 tests passed\n");
return true;
}
void main(void)
{
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
if (run_tests()) {
TC_END_REPORT(TC_PASS);
} else {
TC_END_REPORT(TC_FAIL);
}
}
|
//
// Copyright 2013 (C). Alex Robenko. All rights reserved.
//
// This library 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/>.
/// @file embxx/util/assert/CxxTestAssert.h
/// Contains definition of CxxTestAssert.
#pragma once
#include <sstream>
#include "embxx/util/Assert.h"
#include "cxxtest/TestSuite.h"
namespace embxx
{
namespace util
{
namespace assert
{
/// @addtogroup util
///
/// @{
/// @brief Custom assert class to be used with CxxTest unittesting framework.
/// @details The main purpose of this class is to override the default
/// assertion failure behaviour with call to TS_FAIL provided by
/// CxxTest framework. Please don't use this class directly, use
/// util::assert::CxxTestAssert typedef.
/// @tparam T Dummy template parameter. It's main purpose to ensure that
/// the code of this class is not generated if not used.
/// @headerfile embxx/util/assert/CxxTestAssert.h
template <class T>
class BasicCxxTestAssert : public util::Assert
{
public:
virtual ~BasicCxxTestAssert() {}
/// @brief Implementation of the fail functionality.
/// @details Calls TS_FAIL() with assert message similar to one produced
/// by standard assert().
virtual void fail(
const char* expr,
const char* file,
unsigned int line,
const char* function) override;
};
/// Definition of CxxTestAssert class.
/// @related BasicCxxTestAssert
typedef BasicCxxTestAssert<void> CxxTestAssert;
/// @}
// Implementation
template <class T>
void BasicCxxTestAssert<T>::fail(
const char* expr,
const char* file,
unsigned int line,
const char* function)
{
std::stringstream stream;
stream << file << ":" << line <<
" " << function << ": " <<
"Assertion \'" << expr << "\' " <<
"failed.";
TS_FAIL(stream.str().c_str());
}
} // namespace assert
} // namespace util
} // namespace embxx
|
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved
#pragma once
#include "WorldPins.h"
#include "IWorldPinIconMappingFactory.h"
#include "Types.h"
#include "Helpers.h"
#include <string>
namespace ExampleApp
{
namespace WorldPins
{
namespace SdkModel
{
class WorldPinIconMappingFactory : public IWorldPinIconMappingFactory, private Eegeo::NonCopyable
{
public:
WorldPinIconMappingFactory(Eegeo::Helpers::IFileIO& fileIO,
const std::string& sheetManifestFile,
Eegeo::Helpers::ITextureFileLoader& textureFileLoader);
virtual ~WorldPinIconMappingFactory() { }
virtual IWorldPinIconMapping* Create() const;
private:
Eegeo::Helpers::IFileIO& m_fileIO;
const std::string m_sheetManifestFile;
Eegeo::Helpers::ITextureFileLoader& m_textureFileLoader;
};
}
}
} |
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_AOM_DSP_BITREADER_H_
#define AOM_AOM_DSP_BITREADER_H_
#include <assert.h>
#include <limits.h>
#include "config/aom_config.h"
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
#include "aom_dsp/daalaboolreader.h"
#include "aom_dsp/prob.h"
#include "av1/common/odintrin.h"
#if CONFIG_ACCOUNTING
#include "av1/decoder/accounting.h"
#define ACCT_STR_NAME acct_str
#define ACCT_STR_PARAM , const char *ACCT_STR_NAME
#define ACCT_STR_ARG(s) , s
#else
#define ACCT_STR_PARAM
#define ACCT_STR_ARG(s)
#endif
#define aom_read(r, prob, ACCT_STR_NAME) \
aom_read_(r, prob ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_bit(r, ACCT_STR_NAME) \
aom_read_bit_(r ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_tree(r, tree, probs, ACCT_STR_NAME) \
aom_read_tree_(r, tree, probs ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_literal(r, bits, ACCT_STR_NAME) \
aom_read_literal_(r, bits ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_cdf_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_symbol(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#ifdef __cplusplus
extern "C" {
#endif
typedef struct daala_reader aom_reader;
static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer,
size_t size) {
return aom_daala_reader_init(r, buffer, (int)size);
}
static INLINE const uint8_t *aom_reader_find_begin(aom_reader *r) {
return aom_daala_reader_find_begin(r);
}
static INLINE const uint8_t *aom_reader_find_end(aom_reader *r) {
return aom_daala_reader_find_end(r);
}
// Returns true if the bit reader has tried to decode more data from the buffer
// than was actually provided.
static INLINE int aom_reader_has_overflowed(const aom_reader *r) {
return aom_daala_reader_has_overflowed(r);
}
// Returns the position in the bit reader in bits.
static INLINE uint32_t aom_reader_tell(const aom_reader *r) {
return aom_daala_reader_tell(r);
}
// Returns the position in the bit reader in 1/8th bits.
static INLINE uint32_t aom_reader_tell_frac(const aom_reader *r) {
return aom_daala_reader_tell_frac(r);
}
#if CONFIG_ACCOUNTING
static INLINE void aom_process_accounting(const aom_reader *r ACCT_STR_PARAM) {
if (r->accounting != NULL) {
uint32_t tell_frac;
tell_frac = aom_reader_tell_frac(r);
aom_accounting_record(r->accounting, ACCT_STR_NAME,
tell_frac - r->accounting->last_tell_frac);
r->accounting->last_tell_frac = tell_frac;
}
}
static INLINE void aom_update_symb_counts(const aom_reader *r, int is_binary) {
if (r->accounting != NULL) {
r->accounting->syms.num_multi_syms += !is_binary;
r->accounting->syms.num_binary_syms += !!is_binary;
}
}
#endif
static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
int ret;
ret = aom_daala_read(r, prob);
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
aom_update_symb_counts(r, 1);
#endif
return ret;
}
static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) {
int ret;
ret = aom_read(r, 128, NULL); // aom_prob_half
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
#endif
return ret;
}
static INLINE int aom_read_literal_(aom_reader *r, int bits ACCT_STR_PARAM) {
int literal = 0, bit;
for (bit = bits - 1; bit >= 0; bit--) literal |= aom_read_bit(r, NULL) << bit;
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
#endif
return literal;
}
static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
ret = daala_read_symbol(r, cdf, nsymbs);
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
aom_update_symb_counts(r, (nsymbs == 2));
#endif
return ret;
}
static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
ret = aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME);
if (r->allow_update_cdf) update_cdf(cdf, ret, nsymbs);
return ret;
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_AOM_DSP_BITREADER_H_
|
/*
*
* Copyright (c) 2007-2012,
* Lingxiao Jiang <lxjiang@ucdavis.edu>
* Ghassan Misherghi <ghassanm@ucdavis.edu>
* Zhendong Su <su@ucdavis.edu>
* Stephane Glondu <steph@glondu.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the University of California nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
"exprstmt", "expr", "decl", "datadef", "datadecl",
NULL
|
// Copyright (c) 2012 Christopher Lux <christopherlux@gmail.com>
// Distributed under the Modified BSD License, see license.txt.
#ifndef SCM_GL_CORE_PRIMITIVES_H_INCLUDED
#define SCM_GL_CORE_PRIMITIVES_H_INCLUDED
#include <scm/gl_core/primitives/primitives_fwd.h>
#include <scm/gl_core/primitives/box.h>
#include <scm/gl_core/primitives/frustum.h>
#include <scm/gl_core/primitives/plane.h>
#include <scm/gl_core/primitives/ray.h>
#include <scm/gl_core/primitives/rect.h>
namespace scm {
namespace gl {
} // namespace gl
} // namespace scm
#endif // SCM_GL_CORE_PRIMITIVES_H_INCLUDED
|
/*
* Copyright (c) 2008, Kohsuke Ohtani
* 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 author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 _FIFO_H
#define _FIFO_H
#include <sys/prex.h>
#include <sys/types.h>
#include <assert.h>
/* #define DEBUG_FIFO 1 */
#ifdef DEBUG_FIFO
#define DPRINTF(a) dprintf a
#define ASSERT(e) dassert(e)
#else
#define DPRINTF(a) do {} while (0)
#define ASSERT(e)
#endif
#if CONFIG_FS_THREADS > 1
#define malloc(s) malloc_r(s)
#define free(p) free_r(p)
#else
#define mutex_init(m) do {} while (0)
#define mutex_destroy(m) do {} while (0)
#define mutex_lock(m) do {} while (0)
#define mutex_unlock(m) do {} while (0)
#define mutex_trylock(m) do {} while (0)
#endif
#endif /* !_FIFO_H */
|
/*
* Copyright (C) 2013 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:
* 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 GOOGLE 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 GOOGLE 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 WebSourceInfo_h
#define WebSourceInfo_h
#include "WebCommon.h"
#include "WebNonCopyable.h"
#include "WebPrivatePtr.h"
#include "WebString.h"
namespace WebKit {
class WebSourceInfoPrivate;
class WebSourceInfo {
public:
enum SourceKind {
SourceKindNone,
SourceKindAudio,
SourceKindVideo
};
enum VideoFacingMode {
VideoFacingModeNone,
VideoFacingModeUser,
VideoFacingModeEnvironment
};
WebSourceInfo() { }
WebSourceInfo(const WebSourceInfo& other) { assign(other); }
~WebSourceInfo() { reset(); }
WebSourceInfo& operator=(const WebSourceInfo& other)
{
assign(other);
return *this;
}
WEBKIT_EXPORT void assign(const WebSourceInfo&);
WEBKIT_EXPORT void initialize(const WebString& id, SourceKind, const WebString& label, VideoFacingMode);
WEBKIT_EXPORT void reset();
bool isNull() const { return m_private.isNull(); }
WEBKIT_EXPORT WebString id() const;
WEBKIT_EXPORT SourceKind kind() const;
WEBKIT_EXPORT WebString label() const;
WEBKIT_EXPORT VideoFacingMode facing() const;
private:
WebPrivatePtr<WebSourceInfoPrivate> m_private;
};
} // namespace WebKit
#endif // WebSourceInfo_h
|
// Copyright (c) 2011 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 VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_
#define VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_
#pragma once
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/table_model.h"
#include "views/controls/button/button.h"
#include "views/controls/table/table_view_observer.h"
#include "views/examples/example_base.h"
namespace views {
class Checkbox;
class Event;
class TableView2;
}
namespace examples {
class Table2Example : public ExampleBase,
public ui::TableModel,
public views::ButtonListener,
public views::TableViewObserver {
public:
explicit Table2Example(ExamplesMain* main);
virtual ~Table2Example();
// Overridden from ExampleBase:
virtual std::wstring GetExampleTitle() OVERRIDE;
virtual void CreateExampleView(views::View* container) OVERRIDE;
// Overridden from TableModel:
virtual int RowCount() OVERRIDE;
virtual string16 GetText(int row, int column_id) OVERRIDE;
virtual SkBitmap GetIcon(int row) OVERRIDE;
virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE;
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const views::Event& event) OVERRIDE;
// Overridden from views::TableViewObserver:
virtual void OnSelectionChanged() OVERRIDE;
virtual void OnDoubleClick() OVERRIDE;
virtual void OnMiddleClick() OVERRIDE;
virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE;
virtual void OnTableViewDelete(views::TableView* table_view) OVERRIDE;
virtual void OnTableView2Delete(views::TableView2* table_view) OVERRIDE;
private:
// The table to be tested.
views::TableView2* table_;
views::Checkbox* column1_visible_checkbox_;
views::Checkbox* column2_visible_checkbox_;
views::Checkbox* column3_visible_checkbox_;
views::Checkbox* column4_visible_checkbox_;
SkBitmap icon1_;
SkBitmap icon2_;
DISALLOW_COPY_AND_ASSIGN(Table2Example);
};
} // namespace examples
#endif // VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_
|
// Copyright 2013 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 ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_
#define ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_
#include "ash/ash_export.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
#include "ui/aura/window_observer.h"
#include "ui/events/event_handler.h"
#include "ui/views/pointer_watcher.h"
namespace views {
class BubbleDialogDelegateView;
class View;
}
namespace ash {
class ShelfLayoutManager;
class ShelfView;
namespace test {
class ShelfTooltipManagerTest;
class ShelfViewTest;
}
// ShelfTooltipManager manages the tooltip bubble that appears for shelf items.
class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler,
public aura::WindowObserver,
public views::PointerWatcher,
public ShelfLayoutManagerObserver {
public:
explicit ShelfTooltipManager(ShelfView* shelf_view);
~ShelfTooltipManager() override;
// Initializes the tooltip manager once the shelf is shown.
void Init();
// Closes the tooltip.
void Close();
// Returns true if the tooltip is currently visible.
bool IsVisible() const;
// Returns the view to which the tooltip bubble is anchored. May be null.
views::View* GetCurrentAnchorView() const;
// Show the tooltip bubble for the specified view.
void ShowTooltip(views::View* view);
void ShowTooltipWithDelay(views::View* view);
// Set the timer delay in ms for testing.
void set_timer_delay_for_test(int timer_delay) { timer_delay_ = timer_delay; }
protected:
// ui::EventHandler overrides:
void OnEvent(ui::Event* event) override;
// aura::WindowObserver overrides:
void OnWindowDestroying(aura::Window* window) override;
// views::PointerWatcher overrides:
void OnMousePressed(const ui::MouseEvent& event,
const gfx::Point& location_in_screen,
views::Widget* target) override;
void OnTouchPressed(const ui::TouchEvent& event,
const gfx::Point& location_in_screen,
views::Widget* target) override;
// ShelfLayoutManagerObserver overrides:
void WillDeleteShelf() override;
void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
private:
class ShelfTooltipBubble;
friend class test::ShelfViewTest;
friend class test::ShelfTooltipManagerTest;
int timer_delay_;
base::OneShotTimer timer_;
ShelfView* shelf_view_;
aura::Window* root_window_;
ShelfLayoutManager* shelf_layout_manager_;
views::BubbleDialogDelegateView* bubble_;
base::WeakPtrFactory<ShelfTooltipManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager);
};
} // namespace ash
#endif // ASH_SHELF_SHELF_TOOLTIP_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 Extensions3DUtil_h
#define Extensions3DUtil_h
#include "platform/PlatformExport.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "wtf/Allocator.h"
#include "wtf/HashSet.h"
#include "wtf/Noncopyable.h"
#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
namespace gpu {
namespace gles2 {
class GLES2Interface;
}
}
namespace blink {
class PLATFORM_EXPORT Extensions3DUtil final {
USING_FAST_MALLOC(Extensions3DUtil);
WTF_MAKE_NONCOPYABLE(Extensions3DUtil);
public:
// Creates a new Extensions3DUtil. If the passed GLES2Interface has been spontaneously lost, returns null.
static PassOwnPtr<Extensions3DUtil> create(gpu::gles2::GLES2Interface*);
~Extensions3DUtil();
bool isValid() { return m_isValid; }
bool supportsExtension(const String& name);
bool ensureExtensionEnabled(const String& name);
bool isExtensionEnabled(const String& name);
static bool canUseCopyTextureCHROMIUM(GLenum destTarget, GLenum destFormat, GLenum destType, GLint level);
private:
Extensions3DUtil(gpu::gles2::GLES2Interface*);
void initializeExtensions();
gpu::gles2::GLES2Interface* m_gl;
HashSet<String> m_enabledExtensions;
HashSet<String> m_requestableExtensions;
bool m_isValid;
};
} // namespace blink
#endif // Extensions3DUtil_h
|
/*****************************************************************************
Copyright (c) 2011, Lab of Parallel Software and Computational Science,ICSAS
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 ISCAS 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 "common_utest.h"
#include <complex.h>
void test_zdotu_n_1(void)
{
int N=1,incX=1,incY=1;
double x1[]={1.0,1.0};
double y1[]={1.0,2.0};
double x2[]={1.0,1.0};
double y2[]={1.0,2.0};
double _Complex result1=0.0;
double _Complex result2=0.0;
//OpenBLAS
result1=BLASFUNC(zdotu)(&N,x1,&incX,y1,&incY);
//reference
result2=BLASFUNC_REF(zdotu)(&N,x2,&incX,y2,&incY);
CU_ASSERT_DOUBLE_EQUAL(creal(result1), creal(result2), CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(cimag(result1), cimag(result2), CHECK_EPS);
// printf("\%lf,%lf\n",creal(result1),cimag(result1));
}
void test_zdotu_offset_1(void)
{
int N=1,incX=1,incY=1;
double x1[]={1.0,2.0,3.0,4.0};
double y1[]={5.0,6.0,7.0,8.0};
double x2[]={1.0,2.0,3.0,4.0};
double y2[]={5.0,6.0,7.0,8.0};
double _Complex result1=0.0;
double _Complex result2=0.0;
//OpenBLAS
result1=BLASFUNC(zdotu)(&N,x1+1,&incX,y1+1,&incY);
//reference
result2=BLASFUNC_REF(zdotu)(&N,x2+1,&incX,y2+1,&incY);
CU_ASSERT_DOUBLE_EQUAL(creal(result1), creal(result2), CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(cimag(result1), cimag(result2), CHECK_EPS);
// printf("\%lf,%lf\n",creal(result1),cimag(result1));
}
|
//===-- LSPClient.h - Helper for ClangdLSPServer tests ----------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <condition_variable>
#include <deque>
#include <llvm/ADT/Optional.h>
#include <llvm/Support/Error.h>
#include <llvm/Support/JSON.h>
#include <mutex>
namespace clang {
namespace clangd {
class Transport;
// A client library for talking to ClangdLSPServer in tests.
// Manages serialization of messages, pairing requests/repsonses, and implements
// the Transport abstraction.
class LSPClient {
class TransportImpl;
std::unique_ptr<TransportImpl> T;
public:
// Represents the result of an LSP call: a promise for a result or error.
class CallResult {
public:
~CallResult();
// Blocks up to 10 seconds for the result to be ready.
// Records a test failure if there was no reply.
llvm::Expected<llvm::json::Value> take();
// Like take(), but records a test failure if the result was an error.
llvm::json::Value takeValue();
private:
// Should be called once to provide the value.
void set(llvm::Expected<llvm::json::Value> V);
llvm::Optional<llvm::Expected<llvm::json::Value>> Value;
std::mutex Mu;
std::condition_variable CV;
friend TransportImpl; // Calls set().
};
LSPClient();
~LSPClient();
LSPClient(LSPClient &&) = delete;
LSPClient &operator=(LSPClient &&) = delete;
// Enqueue an LSP method call, returns a promise for the reply. Threadsafe.
CallResult &call(llvm::StringRef Method, llvm::json::Value Params);
// Enqueue an LSP notification. Threadsafe.
void notify(llvm::StringRef Method, llvm::json::Value Params);
// Returns matching notifications since the last call to takeNotifications.
std::vector<llvm::json::Value> takeNotifications(llvm::StringRef Method);
// The transport is shut down after all pending messages are sent.
void stop();
// Shorthand for common LSP methods. Relative paths are passed to testPath().
static llvm::json::Value uri(llvm::StringRef Path);
static llvm::json::Value documentID(llvm::StringRef Path);
void didOpen(llvm::StringRef Path, llvm::StringRef Content);
void didChange(llvm::StringRef Path, llvm::StringRef Content);
void didClose(llvm::StringRef Path);
// Blocks until the server is idle (using the 'sync' protocol extension).
void sync();
// sync()s to ensure pending diagnostics arrive, and returns the newest set.
llvm::Optional<std::vector<llvm::json::Value>>
diagnostics(llvm::StringRef Path);
// Get the transport used to connect this client to a ClangdLSPServer.
Transport &transport();
private:
};
} // namespace clangd
} // namespace clang
|
/*
* Copyright 2020 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSLSampleUsage_DEFINED
#define SkSLSampleUsage_DEFINED
#include "include/core/SkTypes.h"
#include <string>
namespace SkSL {
/**
* Represents all of the ways that a fragment processor is sampled by its parent.
*/
class SampleUsage {
public:
enum class Kind {
// Child is never sampled
kNone,
// Child is only sampled at the same coordinates as the parent
kPassThrough,
// Child is sampled with a matrix whose value is uniform
kUniformMatrix,
// Child is sampled with sk_FragCoord.xy
kFragCoord,
// Child is sampled using explicit coordinates
kExplicit,
};
// Make a SampleUsage that corresponds to no sampling of the child at all
SampleUsage() = default;
SampleUsage(Kind kind, bool hasPerspective) : fKind(kind), fHasPerspective(hasPerspective) {
if (kind != Kind::kUniformMatrix) {
SkASSERT(!fHasPerspective);
}
}
// Child is sampled with a matrix whose value is uniform. The name is fixed.
static SampleUsage UniformMatrix(bool hasPerspective) {
return SampleUsage(Kind::kUniformMatrix, hasPerspective);
}
static SampleUsage Explicit() {
return SampleUsage(Kind::kExplicit, false);
}
static SampleUsage PassThrough() {
return SampleUsage(Kind::kPassThrough, false);
}
static SampleUsage FragCoord() { return SampleUsage(Kind::kFragCoord, false); }
bool operator==(const SampleUsage& that) const {
return fKind == that.fKind && fHasPerspective == that.fHasPerspective;
}
bool operator!=(const SampleUsage& that) const { return !(*this == that); }
// Arbitrary name used by all uniform sampling matrices
static const char* MatrixUniformName() { return "matrix"; }
SampleUsage merge(const SampleUsage& other);
Kind kind() const { return fKind; }
bool hasPerspective() const { return fHasPerspective; }
bool isSampled() const { return fKind != Kind::kNone; }
bool isPassThrough() const { return fKind == Kind::kPassThrough; }
bool isExplicit() const { return fKind == Kind::kExplicit; }
bool isUniformMatrix() const { return fKind == Kind::kUniformMatrix; }
bool isFragCoord() const { return fKind == Kind::kFragCoord; }
std::string constructor() const;
private:
Kind fKind = Kind::kNone;
bool fHasPerspective = false; // Only valid if fKind is kUniformMatrix
};
} // namespace SkSL
#endif
|
// Copyright 2021 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 CHROMEOS_NETWORK_HERMES_METRICS_UTIL_H_
#define CHROMEOS_NETWORK_HERMES_METRICS_UTIL_H_
#include "base/component_export.h"
#include "chromeos/dbus/hermes/hermes_response_status.h"
namespace chromeos {
namespace hermes_metrics {
void COMPONENT_EXPORT(CHROMEOS_NETWORK)
LogInstallViaQrCodeResult(HermesResponseStatus status);
void COMPONENT_EXPORT(CHROMEOS_NETWORK)
LogInstallPendingProfileResult(HermesResponseStatus status);
void COMPONENT_EXPORT(CHROMEOS_NETWORK)
LogEnableProfileResult(HermesResponseStatus status);
void COMPONENT_EXPORT(CHROMEOS_NETWORK)
LogDisableProfileResult(HermesResponseStatus status);
void COMPONENT_EXPORT(CHROMEOS_NETWORK)
LogUninstallProfileResult(HermesResponseStatus status);
void COMPONENT_EXPORT(CHROMEOS_NETWORK)
LogRequestPendingProfilesResult(HermesResponseStatus status);
} // namespace hermes_metrics
} // namespace chromeos
#endif // CHROMEOS_NETWORK_HERMES_METRICS_UTIL_H_
|
/*
-------------------------------------------------------------------------
This source file is a part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE
-------------------------------------------------------------------------
*/
#ifndef _MATERIALEDITORFRAME_H_
#define _MATERIALEDITORFRAME_H_
#include <wx/wx.h>
#include "OgreRenderSystem.h"
#include "OgreRoot.h"
class wxAuiManager;
class wxAuiNotebook;
class wxNotebook;
class wxPropertyGridManager;
class wxTreeCtrl;
namespace
{
class RenderSystem;
class Root;
}
class DocPanel;
class EventArgs;
class LogPanel;
class PropertiesPanel;
class ResourcePanel;
class WorkspacePanel;
class wxOgre;
class MaterialEditorFrame : public wxFrame
{
public:
MaterialEditorFrame(wxWindow* parent = NULL);
~MaterialEditorFrame();
protected:
void createAuiManager(void);
void createAuiNotebookPane(void);
void createManagementPane(void);
void createInformationPane(void);
void createPropertiesPane();
void createOgrePane(void);
void createMenuBar(void);
void createFileMenu(void);
void createEditMenu(void);
void createViewMenu(void);
void createToolsMenu(void);
void createWindowMenu(void);
void createHelpMenu(void);
void OnActivate(wxActivateEvent& event);
void OnActiveEditorChanged(EventArgs& args);
void OnNewProject(wxCommandEvent& event);
void OnNewMaterial(wxCommandEvent& event);
void OnFileOpen(wxCommandEvent& event);
void OnFileSave(wxCommandEvent& event);
void OnFileSaveAs(wxCommandEvent& event);
void OnFileClose(wxCommandEvent& event);
void OnFileExit(wxCommandEvent& event);
void OnEditUndo(wxCommandEvent& event);
void OnEditRedo(wxCommandEvent& event);
void OnEditCut(wxCommandEvent& event);
void OnEditCopy(wxCommandEvent& event);
void OnEditPaste(wxCommandEvent& event);
void OnViewOpenGL(wxCommandEvent& event);
void OnViewDirectX(wxCommandEvent& event);
private:
wxMenuBar* mMenuBar;
wxMenu* mFileMenu;
wxMenu* mEditMenu;
wxMenu* mViewMenu;
wxMenu* mToolsMenu;
wxMenu* mWindowMenu;
wxMenu* mHelpMenu;
wxAuiManager* mAuiManager;
wxAuiNotebook* mAuiNotebook;
wxAuiNotebook* mManagementNotebook;
wxAuiNotebook* mInformationNotebook;
WorkspacePanel* mWorkspacePanel;
ResourcePanel* mResourcePanel;
PropertiesPanel* mPropertiesPanel;
Ogre::Root* mRoot;
Ogre::Entity* mEntity;
LogPanel* mLogPanel;
DocPanel* mDocPanel;
wxOgre* mOgreControl;
Ogre::RenderSystem* mDirectXRenderSystem;
Ogre::RenderSystem* mOpenGLRenderSystem;
DECLARE_EVENT_TABLE();
};
#endif // _MATERIALEDITORFRAME_H_ |
//
// NSObject+abstractProtocolConformer.h
// TypeExtensions
//
// Created by Ethan Reesor on 8/20/13.
// Copyright (c) 2013 Lens Flare. Some rights reserved, see license.
//
#import <Foundation/Foundation.h>
@interface NSObject (abstractProtocolConformer)
@end
|
/**
* \file
*
* \brief AT30TSE75X driver.
*
* Copyright (c) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef AT30TSE75X_H_INCLUDED
#define AT30TSE75X_H_INCLUDED
#define AT30TSE752 1
#define AT30TSE754 2
#define AT30TSE758 3
#define AT30TS75 4
#define AT30TSE_TEMPERATURE_REG 0x00
#define AT30TSE_TEMPERATURE_REG_SIZE 2
#define AT30TSE_NON_VOLATILE_REG 0x00
#define AT30TSE_VOLATILE_REG 0x10
#define AT30TSE_CONFIG_REG 0x01
#define AT30TSE_CONFIG_REG_SIZE 2
#define AT30TSE_TLOW_REG 0x02
#define AT30TSE_TLOW_REG_SIZE 2
#define AT30TSE_THIGH_REG 0x03
#define AT30TSE_THIGH_REG_SIZE 2
#define AT30TSE_CONFIG_RES_Pos 13
#define AT30TSE_CONFIG_RES_Msk (0x03 << AT30TSE_CONFIG_RES_Pos)
#define AT30TSE_CONFIG_RES(value) ((AT30TSE_CONFIG_RES_Msk & \
((value) << AT30TSE_CONFIG_RES_Pos)))
#define AT30TSE_CONFIG_RES_9_bit 0
#define AT30TSE_CONFIG_RES_10_bit 1
#define AT30TSE_CONFIG_RES_11_bit 2
#define AT30TSE_CONFIG_RES_12_bit 3
#define AT30TSE_CONFIG_FTQ_Pos 13
#define AT30TSE_CONFIG_FTQ_Msk (0x03 << AT30TSE_CONFIG_FTQ_Pos)
#define AT30TSE_CONFIG_FTQ(value) ((AT30TSE_CONFIG_FTQ_Msk & \
((value) << AT30TSE_CONFIG_FTQ_Pos)))
#define AT30TSE_CONFIG_FTQ_1_fault 0
#define AT30TSE_CONFIG_RES_2_fault 1
#define AT30TSE_CONFIG_RES_4_fault 2
#define AT30TSE_CONFIG_RES_6_fault 3
/* R/W bits. */
#define AT30TSE_CONFIG_OS (1 << 15)
#define AT30TSE_CONFIG_R1 (1 << 14)
#define AT30TSE_CONFIG_R0 (1 << 13)
#define AT30TSE_CONFIG_FT1 (1 << 12)
#define AT30TSE_CONFIG_FT0 (1 << 11)
#define AT30TSE_CONFIG_POL (1 << 10)
#define AT30TSE_CONFIG_CMP_INT (1 << 9)
#define AT30TSE_CONFIG_SD (1 << 8)
/* Read only bits */
#define AT30TSE_CONFIG_NVRBSY (1 << 0)
void at30tse_init(void);
#if BOARD_USING_AT30TSE != AT30TS75
uint8_t at30tse_eeprom_write(uint8_t *data, uint8_t length,
uint8_t word_addr, uint8_t page);
uint8_t at30tse_eeprom_read(uint8_t *data, uint8_t length,
uint8_t word_addr, uint8_t page);
#endif
uint8_t at30tse_read_temperature(double* temperature);
uint8_t at30tse_write_config_register(uint16_t value);
uint8_t at30tse_read_register(uint8_t reg, uint8_t reg_type,
uint8_t reg_size, uint8_t* buffer);
uint8_t at30tse_write_register(uint8_t reg, uint8_t reg_type,
uint8_t reg_size, uint16_t reg_value);
#endif /* AT30TSE75X_H_INCLUDED */
|
#import <Foundation/Foundation.h>
#import "KSNullabilityCompat.h"
#import "KSGenericsCompat.h"
@class KSPromise KS_GENERIC(ObjectType);
NS_ASSUME_NONNULL_BEGIN
@interface KSNetworkResponse : NSObject
@property (strong, nonatomic, readonly) NSURLResponse *response;
@property (strong, nonatomic, readonly) NSData *data;
+ (KSNetworkResponse *)networkResponseWithURLResponse:(NSURLResponse *)response data:(NSData *)data;
@end
@protocol KSNetworkClient <NSObject>
- (KSPromise KS_GENERIC(KSNetworkResponse *) *)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue *)queue;
@end
// Add a concrete implementation with the old name for backwards compatibility
@interface KSNetworkClient : NSObject <KSNetworkClient>
@end
NS_ASSUME_NONNULL_END
|
#ifndef MESSAGE_PART_H
#define MESSAGE_PART_H
#include "message-size.h"
/* Note that these flags are used directly by message-parser-serialize, so
existing flags can't be changed without breaking backwards compatibility */
enum message_part_flags {
MESSAGE_PART_FLAG_MULTIPART = 0x01,
MESSAGE_PART_FLAG_MULTIPART_DIGEST = 0x02,
MESSAGE_PART_FLAG_MESSAGE_RFC822 = 0x04,
/* content-type: text/... */
MESSAGE_PART_FLAG_TEXT = 0x08,
MESSAGE_PART_FLAG_UNUSED = 0x10,
/* message part header or body contains NULs */
MESSAGE_PART_FLAG_HAS_NULS = 0x20,
/* Mime-Version header exists. */
MESSAGE_PART_FLAG_IS_MIME = 0x40
};
struct message_part {
struct message_part *parent;
struct message_part *next;
struct message_part *children;
uoff_t physical_pos; /* absolute position from beginning of message */
struct message_size header_size;
struct message_size body_size;
/* total number of message_parts under children */
unsigned int children_count;
enum message_part_flags flags;
void *context;
};
/* Return index number for the message part. The indexes are in the same order
as they exist in the flat RFC822 message. The root part is 0, its first
child is 1 and so on. */
unsigned int message_part_to_idx(const struct message_part *part);
/* Find message part by its index number, or return NULL if the index
doesn't exist. */
struct message_part *
message_part_by_idx(struct message_part *parts, unsigned int idx);
#endif
|
//
// UITableView+iOS7Style.h
// JKCategories (https://github.com/shaojiankui/JKCategories)
//
// Created by Jakey on 15/6/1.
// Copyright (c) 2015年 www.skyfox.org. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITableView (JKiOS7Style)
/**
* @brief iOS 7 设置页面的 UITableViewCell 样式
*
* @param cell cell
* @param indexPath indexPath
*/
-(void)jk_applyiOS7SettingsStyleGrouping:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
@end
|
/*
* sys-spinor.c
*
* Copyright(c) 2007-2022 Jianjun Jiang <8192542@qq.com>
* Official site: http://xboot.org
* Mobile phone: +86-18665388956
* QQ: 8192542
*
* 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 <xboot.h>
enum {
SPI_GCR = 0x04,
SPI_TCR = 0x08,
SPI_IER = 0x10,
SPI_ISR = 0x14,
SPI_FCR = 0x18,
SPI_FSR = 0x1c,
SPI_WCR = 0x20,
SPI_CCR = 0x24,
SPI_MBC = 0x30,
SPI_MTC = 0x34,
SPI_BCC = 0x38,
SPI_TXD = 0x200,
SPI_RXD = 0x300,
};
void sys_spinor_init(void)
{
virtual_addr_t addr;
u32_t val;
/* Config GPIOC0, GPIOC1, GPIOC2 and GPIOC3 */
addr = 0x01c20848 + 0x00;
val = read32(addr);
val &= ~(0xf << ((0 & 0x7) << 2));
val |= ((0x2 & 0x7) << ((0 & 0x7) << 2));
write32(addr, val);
val = read32(addr);
val &= ~(0xf << ((1 & 0x7) << 2));
val |= ((0x2 & 0x7) << ((1 & 0x7) << 2));
write32(addr, val);
val = read32(addr);
val &= ~(0xf << ((2 & 0x7) << 2));
val |= ((0x2 & 0x7) << ((2 & 0x7) << 2));
write32(addr, val);
val = read32(addr);
val &= ~(0xf << ((3 & 0x7) << 2));
val |= ((0x2 & 0x7) << ((3 & 0x7) << 2));
write32(addr, val);
/* Deassert spi0 reset */
addr = 0x01c202c0;
val = read32(addr);
val |= (1 << 20);
write32(addr, val);
/* Open the spi0 bus gate */
addr = 0x01c20000 + 0x60;
val = read32(addr);
val |= (1 << 20);
write32(addr, val);
/* Set spi clock rate control register, divided by 4 */
addr = 0x01c05000;
write32(addr + SPI_CCR, 0x00001001);
/* Enable spi0 and do a soft reset */
addr = 0x01c05000;
val = read32(addr + SPI_GCR);
val |= (1 << 31) | (1 << 7) | (1 << 1) | (1 << 0);
write32(addr + SPI_GCR, val);
while(read32(addr + SPI_GCR) & (1 << 31));
val = read32(addr + SPI_TCR);
val &= ~(0x3 << 0);
val |= (1 << 6) | (1 << 2);
write32(addr + SPI_TCR, val);
val = read32(addr + SPI_FCR);
val |= (1 << 31) | (1 << 15);
write32(addr + SPI_FCR, val);
}
void sys_spinor_exit(void)
{
virtual_addr_t addr = 0x01c05000;
u32_t val;
/* Disable the spi0 controller */
val = read32(addr + SPI_GCR);
val &= ~((1 << 1) | (1 << 0));
write32(addr + SPI_GCR, val);
}
static void sys_spi_select(void)
{
virtual_addr_t addr = 0x01c05000;
u32_t val;
val = read32(addr + SPI_TCR);
val &= ~((0x3 << 4) | (0x1 << 7));
val |= ((0 & 0x3) << 4) | (0x0 << 7);
write32(addr + SPI_TCR, val);
}
static void sys_spi_deselect(void)
{
virtual_addr_t addr = 0x01c05000;
u32_t val;
val = read32(addr + SPI_TCR);
val &= ~((0x3 << 4) | (0x1 << 7));
val |= ((0 & 0x3) << 4) | (0x1 << 7);
write32(addr + SPI_TCR, val);
}
static void sys_spi_write_txbuf(u8_t * buf, int len)
{
virtual_addr_t addr = 0x01c05000;
int i;
write32(addr + SPI_MTC, len & 0xffffff);
write32(addr + SPI_BCC, len & 0xffffff);
if(buf)
{
for(i = 0; i < len; i++)
write8(addr + SPI_TXD, *buf++);
}
else
{
for(i = 0; i < len; i++)
write8(addr + SPI_TXD, 0xff);
}
}
static int sys_spi_transfer(void * txbuf, void * rxbuf, int len)
{
virtual_addr_t addr = 0x01c05000;
int count = len;
u8_t * tx = txbuf;
u8_t * rx = rxbuf;
u8_t val;
int n, i;
while(count > 0)
{
n = (count <= 64) ? count : 64;
write32(addr + SPI_MBC, n);
sys_spi_write_txbuf(tx, n);
write32(addr + SPI_TCR, read32(addr + SPI_TCR) | (1 << 31));
while((read32(addr + SPI_FSR) & 0xff) < n);
for(i = 0; i < n; i++)
{
val = read8(addr + SPI_RXD);
if(rx)
*rx++ = val;
}
if(tx)
tx += n;
count -= n;
}
return len;
}
static int sys_spi_write_then_read(void * txbuf, int txlen, void * rxbuf, int rxlen)
{
if(sys_spi_transfer(txbuf, NULL, txlen) != txlen)
return -1;
if(sys_spi_transfer(NULL, rxbuf, rxlen) != rxlen)
return -1;
return 0;
}
void sys_spinor_read(int addr, void * buf, int count)
{
u8_t tx[4];
tx[0] = 0x03;
tx[1] = (u8_t)(addr >> 16);
tx[2] = (u8_t)(addr >> 8);
tx[3] = (u8_t)(addr >> 0);
sys_spi_select();
sys_spi_write_then_read(tx, 4, buf, count);
sys_spi_deselect();
}
|
//
// Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://aws.amazon.com/apache2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
#import <Foundation/Foundation.h>
#import <AWSCore/AWSNetworking.h>
#import <AWSCore/AWSModel.h>
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString *const AWSMobileAnalyticsERSErrorDomain;
typedef NS_ENUM(NSInteger, AWSMobileAnalyticsERSErrorType) {
AWSMobileAnalyticsERSErrorUnknown,
AWSMobileAnalyticsERSErrorBadRequest,
};
@class AWSMobileAnalyticsERSEvent;
@class AWSMobileAnalyticsERSPutEventsInput;
@class AWSMobileAnalyticsERSSession;
/**
Represents a single event that happened on a client device. Attributes and metrics are optional.
Required parameters: [eventType, timestamp, session]
*/
@interface AWSMobileAnalyticsERSEvent : AWSModel
/**
*/
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> * _Nullable attributes;
/**
*/
@property (nonatomic, strong) NSString * _Nullable eventType;
/**
*/
@property (nonatomic, strong) NSDictionary<NSString *, NSNumber *> * _Nullable metrics;
/**
*/
@property (nonatomic, strong) AWSMobileAnalyticsERSSession * _Nullable session;
/**
*/
@property (nonatomic, strong) NSString * _Nullable timestamp;
/**
*/
@property (nonatomic, strong) NSString * _Nullable version;
@end
/**
Describes a set of events
Required parameters: [events, clientContext]
*/
@interface AWSMobileAnalyticsERSPutEventsInput : AWSRequest
/**
*/
@property (nonatomic, strong) NSString * _Nullable clientContext;
/**
*/
@property (nonatomic, strong) NSArray<AWSMobileAnalyticsERSEvent *> * _Nullable events;
@end
/**
*/
@interface AWSMobileAnalyticsERSSession : AWSModel
/**
*/
@property (nonatomic, strong) NSNumber * _Nullable duration;
/**
*/
@property (nonatomic, strong) NSString * _Nullable identifier;
/**
*/
@property (nonatomic, strong) NSString * _Nullable startTimestamp;
/**
*/
@property (nonatomic, strong) NSString * _Nullable stopTimestamp;
@end
NS_ASSUME_NONNULL_END
|
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (c) 2009 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute it and/or modify it under the
* terms of the version 2.1 (or later) of the GNU Lesser General Public License
* as published by the Free Software Foundation; or version 2.0 of the Apache
* License as published by the Apache Software Foundation. See the LICENSE files
* for more details.
*
* RELIC 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 LICENSE files for more details.
*
* You should have received a copy of the GNU Lesser General Public or the
* Apache License along with RELIC. If not, see <https://www.gnu.org/licenses/>
* or <https://www.apache.org/licenses/>.
*/
/**
* @file
*
* Implementation of the basic functions to manipulate binary field elements.
*
* @ingroup fb
*/
#include "relic_core.h"
#include "relic_fb.h"
#include "relic_fb_low.h"
#include "relic_rand.h"
#include "relic_util.h"
/*============================================================================*/
/* Private definitions */
/*============================================================================*/
/**
* Checks if a radix is a power of two.
*
* @param[in] radix - the radix to check.
* @return if radix is a valid radix.
*/
static int valid_radix(int radix) {
while (radix > 0) {
if (radix != 1 && radix % 2 == 1)
return 0;
radix = radix / 2;
}
return 1;
}
/**
* Computes the logarithm of a valid radix in basis two.
*
* @param[in] radix - the valid radix.
* @return the logarithm of the radix in basis two.
*/
static int log_radix(int radix) {
int l = 0;
while (radix > 0) {
radix = radix / 2;
l++;
}
return --l;
}
/*============================================================================*/
/* Public definitions */
/*============================================================================*/
void fb_copy(fb_t c, const fb_t a) {
dv_copy(c, a, RLC_FB_DIGS);
}
void fb_zero(fb_t a) {
dv_zero(a, RLC_FB_DIGS);
}
int fb_is_zero(const fb_t a) {
int i;
dig_t t = 0;
for (i = 0; i < RLC_FB_DIGS; i++) {
t |= a[i];
}
return !t;
}
int fb_get_bit(const fb_t a, int bit) {
int d;
RLC_RIP(bit, d, bit);
return (a[d] >> bit) & 1;
}
void fb_set_bit(fb_t a, int bit, int value) {
int d;
dig_t mask;
RLC_RIP(bit, d, bit);
mask = (dig_t)1 << bit;
if (value == 1) {
a[d] |= mask;
} else {
a[d] &= ~mask;
}
}
int fb_bits(const fb_t a) {
int i = RLC_FB_DIGS - 1;
while (i >= 0 && a[i] == 0) {
i--;
}
if (i > 0) {
return (i << RLC_DIG_LOG) + util_bits_dig(a[i]);
} else {
return util_bits_dig(a[0]);
}
}
void fb_set_dig(fb_t c, dig_t a) {
fb_zero(c);
c[0] = a;
}
void fb_rand(fb_t a) {
int bits, digits;
rand_bytes((uint8_t *)a, RLC_FB_DIGS * sizeof(dig_t));
RLC_RIP(bits, digits, RLC_FB_BITS);
if (bits > 0) {
dig_t mask = RLC_MASK(bits);
a[RLC_FB_DIGS - 1] &= mask;
}
}
void fb_print(const fb_t a) {
int i;
/* Suppress possible unused parameter warning. */
(void)a;
for (i = RLC_FB_DIGS - 1; i > 0; i--) {
util_print_dig(a[i], 1);
util_print(" ");
}
util_print_dig(a[0], 1);
util_print("\n");
}
int fb_size_str(const fb_t a, int radix) {
bn_t t;
int digits = 0;
bn_null(t);
if (!valid_radix(radix)) {
RLC_THROW(ERR_NO_VALID);
return 0;
}
RLC_TRY {
bn_new(t);
bn_read_raw(t, a, RLC_FB_DIGS);
digits = bn_size_str(t, radix);
}
RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
bn_free(t);
}
return digits;
}
void fb_read_str(fb_t a, const char *str, int len, int radix) {
int i, j, l;
char c;
dig_t carry;
fb_zero(a);
l = log_radix(radix);
if (!valid_radix(radix)) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (RLC_CEIL(l * (len - 1), RLC_DIG) > RLC_FB_DIGS) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
j = 0;
while (j < len) {
if (str[j] == 0) {
break;
}
c = (char)((radix < 36) ? RLC_UPP(str[j]) : str[j]);
for (i = 0; i < 64; i++) {
if (c == util_conv_char(i)) {
break;
}
}
if (i < radix) {
carry = fb_lshb_low(a, a, l);
if (carry != 0) {
RLC_THROW(ERR_NO_BUFFER);
break;
}
fb_add_dig(a, a, (dig_t)i);
} else {
break;
}
j++;
}
}
void fb_write_str(char *str, int len, const fb_t a, int radix) {
fb_t t;
int d, l, i, j;
char c;
fb_null(t);
l = fb_size_str(a, radix);
if (len < l) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
len = l;
l = log_radix(radix);
if (!valid_radix(radix)) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (fb_is_zero(a) == 1) {
*str++ = '0';
*str = '\0';
return;
}
RLC_TRY {
fb_new(t);
fb_copy(t, a);
j = 0;
while (!fb_is_zero(t)) {
d = t[0] % radix;
fb_rshb_low(t, t, l);
str[j] = util_conv_char(d);
j++;
}
/* Reverse the digits of the string. */
i = 0;
j = len - 2;
while (i < j) {
c = str[i];
str[i] = str[j];
str[j] = c;
++i;
--j;
}
str[len - 1] = '\0';
}
RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
fb_free(t);
}
}
void fb_read_bin(fb_t a, const uint8_t *bin, int len) {
bn_t t;
bn_null(t);
if (len != RLC_FB_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
RLC_TRY {
bn_new(t);
bn_read_bin(t, bin, len);
fb_copy(a, t->dp);
}
RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
bn_free(t);
}
}
void fb_write_bin(uint8_t *bin, int len, const fb_t a) {
bn_t t;
bn_null(t);
if (len != RLC_FB_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
RLC_TRY {
bn_new(t);
bn_read_raw(t, a, RLC_FB_DIGS);
bn_write_bin(bin, len, t);
} RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
bn_free(t);
}
}
|
/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
ast_smt2_pp.cpp
Abstract:
Pretty printer of AST formulas using SMT2 format.
This printer is more expensive than the one in ast_smt_pp.h,
but is supposed to generated a "prettier" and SMT2 compliant output.
Author:
Leonardo de Moura (leonardo)
Revision History:
--*/
#ifndef _AST_SMT2_PP_H_
#define _AST_SMT2_PP_H_
#include"format.h"
#include"params.h"
#include"arith_decl_plugin.h"
#include"bv_decl_plugin.h"
#include"array_decl_plugin.h"
#include"float_decl_plugin.h"
#include"dl_decl_plugin.h"
#include"smt2_util.h"
class smt2_pp_environment {
protected:
format_ns::format * mk_neg(format_ns::format * f) const;
format_ns::format * mk_float(rational const & val) const;
bool is_indexed_fdecl(func_decl * f) const;
format_ns::format * pp_fdecl_params(format_ns::format * fname, func_decl * f);
bool is_sort_param(func_decl * f) const;
format_ns::format * pp_as(format_ns::format * fname, sort * s);
format_ns::format * pp_signature(format_ns::format * f_name, func_decl * f);
public:
virtual ~smt2_pp_environment() {}
virtual ast_manager & get_manager() const = 0;
virtual arith_util & get_autil() = 0;
virtual bv_util & get_bvutil() = 0;
virtual array_util & get_arutil() = 0;
virtual float_util & get_futil() = 0;
virtual datalog::dl_decl_util& get_dlutil() = 0;
virtual bool uses(symbol const & s) const = 0;
virtual format_ns::format * pp_fdecl(func_decl * f, unsigned & len);
virtual format_ns::format * pp_bv_literal(app * t, bool use_bv_lits, bool bv_neg);
virtual format_ns::format * pp_arith_literal(app * t, bool decimal, unsigned prec);
virtual format_ns::format * pp_float_literal(app * t);
virtual format_ns::format * pp_datalog_literal(app * t);
virtual format_ns::format * pp_sort(sort * s);
virtual format_ns::format * pp_fdecl_ref(func_decl * f);
format_ns::format * pp_fdecl_name(symbol const & fname, unsigned & len) const;
format_ns::format * pp_fdecl_name(func_decl * f, unsigned & len) const;
};
/**
\brief Simple environment that ignores name clashes.
Useful for debugging code.
*/
class smt2_pp_environment_dbg : public smt2_pp_environment {
ast_manager & m_manager;
arith_util m_autil;
bv_util m_bvutil;
array_util m_arutil;
float_util m_futil;
datalog::dl_decl_util m_dlutil;
public:
smt2_pp_environment_dbg(ast_manager & m):m_manager(m), m_autil(m), m_bvutil(m), m_arutil(m), m_futil(m), m_dlutil(m) {}
virtual ast_manager & get_manager() const { return m_manager; }
virtual arith_util & get_autil() { return m_autil; }
virtual bv_util & get_bvutil() { return m_bvutil; }
virtual array_util & get_arutil() { return m_arutil; }
virtual float_util & get_futil() { return m_futil; }
virtual datalog::dl_decl_util& get_dlutil() { return m_dlutil; }
virtual bool uses(symbol const & s) const { return false; }
};
void mk_smt2_format(expr * n, smt2_pp_environment & env, params_ref const & p,
unsigned num_vars, char const * var_prefix,
format_ns::format_ref & r, sbuffer<symbol> & var_names);
void mk_smt2_format(sort * s, smt2_pp_environment & env, params_ref const & p, format_ns::format_ref & r);
void mk_smt2_format(func_decl * f, smt2_pp_environment & env, params_ref const & p, format_ns::format_ref & r);
std::ostream & ast_smt2_pp(std::ostream & out, expr * n, smt2_pp_environment & env, params_ref const & p = params_ref(), unsigned indent = 0,
unsigned num_vars = 0, char const * var_prefix = 0);
std::ostream & ast_smt2_pp(std::ostream & out, sort * s, smt2_pp_environment & env, params_ref const & p = params_ref(), unsigned indent = 0);
std::ostream & ast_smt2_pp(std::ostream & out, func_decl * f, smt2_pp_environment & env, params_ref const & p = params_ref(), unsigned indent = 0);
/**
\brief Internal wrapper (for debugging purposes only)
*/
struct mk_ismt2_pp {
ast * m_ast;
ast_manager & m_manager;
params_ref m_empty;
params_ref const & m_params;
unsigned m_indent;
unsigned m_num_vars;
char const * m_var_prefix;
mk_ismt2_pp(ast * t, ast_manager & m, params_ref const & p, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0);
mk_ismt2_pp(ast * t, ast_manager & m, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0);
};
std::ostream& operator<<(std::ostream& out, mk_ismt2_pp const & p);
#endif
|
/**
* \file
*
* \brief ILI9341 display controller component driver default config header
*
* Copyright (c) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_ILI9341_H_INCLUDED
#define CONF_ILI9341_H_INCLUDED
#include <compiler.h>
/**
* \brief Select a SPI clock speed
*
* This selects the clock speed for the SPI clock used to communicate with the
* display controller. Higher clock speeds allow for higher frame rates.
* \note That the clock speed may be limited by the speed of the
* microcontroller a normal limitation would be CPUclk/2. For more details
* please refer to the device datasheet.
*/
#define CONF_ILI9341_CLOCK_SPEED 8000000UL
/**
* \name XMEGA typical configurations
* @{
*/
/**
* \brief Select the correct hardware interface
*
* Currently supported interfaces are the SPI interface and the USART Master
* SPI interface.
*/
#define CONF_ILI9341_SPI &SPIC
/* #define CONF_ILI9341_USART_SPI &USARTC0 */
/** \brief Define what MCU pin the ILI9341 chip select pin is connected to */
#define CONF_ILI9341_CS_PIN IOPORT_CREATE_PIN(PORTC, 5)
/** \brief Define what MCU pin the ILI9341 DC pin is connected to */
#define CONF_ILI9341_DC_PIN IOPORT_CREATE_PIN(PORTC, 4)
/** \brief Define what MCU pin the ILI9341 back light pin is connected to */
#define CONF_ILI9341_BACKLIGHT_PIN IOPORT_CREATE_PIN(PORTA, 5)
/** \brief Define what MCU pin the ILI9341 reset is connected to */
#define CONF_ILI9341_RESET_PIN IOPORT_CREATE_PIN(PORTA, 7)
/** @} */
#endif /* CONF_ILI9341_H_INCLUDED */
|
//---------------------------------------------------------------------------
// a_shstr.h
//
// Shared strings for alib. Shared strings are used when you need many
// copies of the same few strings.
//
// Copyright (C) 2008 Neil Butterworth
//---------------------------------------------------------------------------
#ifndef INC_A_SHSTR_H
#define INC_A_SHSTR_H
#include "a_base.h"
namespace ALib {
//---------------------------------------------------------------------------
class SharedString {
CANNOT_COPY( SharedString );
public:
class Store;
SharedString( const std::string & s );
~SharedString();
std::string Str() const;
private:
unsigned int mId;
};
//---------------------------------------------------------------------------
} // namespace
#endif
|
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2009 Jason Booth
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCRENDER_TEXTURE_H__
#define __CCRENDER_TEXTURE_H__
#include "CCData.h"
#include "CCNode.h"
#include "CCSprite.h"
namespace cocos2d {
typedef enum eImageFormat
{
kCCImageFormatJPG = 0,
kCCImageFormatPNG = 1,
kCCImageFormatRawData = 2
} tImageFormat;
/**
@brief CCRenderTexture is a generic rendering target. To render things into it,
simply construct a render target, call begin on it, call visit on any cocos
scenes or objects to render them, and call end. For convienience, render texture
adds a sprite as it's display child with the results, so you can simply add
the render texture to your scene and treat it like any other CocosNode.
There are also functions for saving the render texture to disk in PNG or JPG format.
@since v0.8.1
*/
class CC_DLL CCRenderTexture : public CCNode
{
/** The CCSprite being used.
The sprite, by default, will use the following blending function: GL_ONE, GL_ONE_MINUS_SRC_ALPHA.
The blending function can be changed in runtime by calling:
- [[renderTexture sprite] setBlendFunc:(ccBlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
*/
CC_PROPERTY(CCSprite*, m_pSprite, Sprite)
public:
CCRenderTexture();
virtual ~CCRenderTexture();
/** creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h);
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
bool initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
/** starts grabbing */
void begin();
/** starts rendering to the texture while clearing the texture first.
This is more efficient then calling -clear first and then -begin */
void beginWithClear(float r, float g, float b, float a);
/** end is key word of lua, use other name to export to lua. */
inline void endToLua(){ end();};
#if CC_ENABLE_CACHE_TEXTTURE_DATA
/** ends grabbing for android */
void end(bool bIsTOCasheTexture = true);
#else
/** ends grabbing */
void end();
#endif
/** clears the texture with a color */
void clear(float r, float g, float b, float a);
/** saves the texture into a file */
// para szFilePath the absolute path to save
// para x,y the lower left corner coordinates of the buffer to save
// pare nWidth,nHeight the size of the buffer to save
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
bool saveBuffer(const char *szFilePath, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
/** saves the texture into a file. put format at the first argument, or ti will be overloaded with
* saveBuffer(const char *szFilePath, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0) */
// para name the file name to save
// para format the image format to save, here it supports kCCImageFormatPNG and kCCImageFormatJPG */
// para x,y the lower left corner coordinates of the buffer to save
// pare nWidth,nHeight the size of the buffer to save
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
bool saveBuffer(int format, const char *name, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
/* get buffer as UIImage, can only save a render buffer which has a RGBA8888 pixel format */
CCData *getUIImageAsDataFromBuffer(int format);
/** save the buffer data to a CCImage */
// para pImage the CCImage to save
// para x,y the lower left corner coordinates of the buffer to save
// pare nWidth,nHeight the size of the buffer to save
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
bool getUIImageFromBuffer(CCImage *pImage, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
protected:
GLuint m_uFBO;
GLint m_nOldFBO;
CCTexture2D *m_pTexture;
GLubyte *m_pTextureDataBuffer;
GLenum m_ePixelFormat;
};
} // namespace cocos2d
#endif //__CCRENDER_TEXTURE_H__ |
// Copyright (c) 2011-2016 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_
#define STORAGE_LEVELDB_DB_LOG_WRITER_H_
#include <stdint.h>
#include "db/log_format.h"
#include "leveldb/slice.h"
#include "leveldb/status.h"
namespace leveldb {
class WritableFile;
namespace log {
class Writer {
public:
// Create a writer that will append data to "*dest".
// "*dest" must be initially empty.
// "*dest" must remain live while this Writer is in use.
explicit Writer(WritableFile* dest);
~Writer();
Status AddRecord(const Slice& slice);
private:
WritableFile* dest_;
int block_offset_; // Current offset in block
// crc32c values for all supported record types. These are
// pre-computed to reduce the overhead of computing the crc of the
// record type stored in the header.
uint32_t type_crc_[kMaxRecordType + 1];
Status EmitPhysicalRecord(RecordType type, const char* ptr, size_t length);
// No copying allowed
Writer(const Writer&);
void operator=(const Writer&);
};
} // namespace log
} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_
|
#pragma once
#include <Global.h>
#include <CppUnitTests/CppUnitTests.h>
#include "Win32Exception.h"
|
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
/**
* Utility function for sorting by function pointer.
* Used in Element::msgDigest
*/
class FuncOrder
{
public:
FuncOrder()
: func_( 0 ), index_( 0 )
{;}
const OpFunc* func() const {
return func_;
}
unsigned int index() const {
return index_;
}
void set( const OpFunc* func, unsigned int index ) {
func_ = func;
index_ = index;
}
bool operator<( const FuncOrder& other ) const
{
return func_ < other.func_;
}
private:
const OpFunc* func_;
unsigned int index_;
};
|
/*
* This file is part of the OregonCore Project. See AUTHORS file for Copyright information
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MOVE_MAP_SHARED_DEFINES_H
#define _MOVE_MAP_SHARED_DEFINES_H
#include "Platform/Define.h"
#include "DetourNavMesh.h"
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
#define MMAP_VERSION 3
struct MmapTileHeader
{
uint32 mmapMagic;
uint32 dtVersion;
uint32 mmapVersion;
uint32 size;
bool usesLiquids : 1;
MmapTileHeader() : mmapMagic(MMAP_MAGIC), dtVersion(DT_NAVMESH_VERSION),
mmapVersion(MMAP_VERSION), size(0), usesLiquids(true) {}
};
enum NavTerrain
{
NAV_EMPTY = 0x00,
NAV_GROUND = 0x01,
NAV_MAGMA = 0x02,
NAV_SLIME = 0x04,
NAV_WATER = 0x08,
NAV_UNUSED1 = 0x10,
NAV_UNUSED2 = 0x20,
NAV_UNUSED3 = 0x40,
NAV_UNUSED4 = 0x80
// we only have 8 bits
};
#endif // _MOVE_MAP_SHARED_DEFINES_H
|
//
// MarControlDiagramDisplay.h
// allAddonsExample
//
// Created by Andre Perrotta on 5/17/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#ifndef MarControlDiagramDisplay_h
#define MarControlDiagramDisplay_h
#include "ofMain.h"
#include "Widget.h"
#include "maximizeButton.h"
#include "MarControl.h"
#include "MarSystemWidget.h"
namespace Marsyas
{
class GraphicalEnvironment;
class MarControlDiagramNode;
class MarControlDiagramDisplay : public Widget {
public:
MarControlDiagramDisplay(MarSystemWidget* msysw, GraphicalEnvironment* env);
~MarControlDiagramDisplay();
void setup(MarSystemWidget* msysw, GraphicalEnvironment* env);
void update();
void draw();
//mouse
bool mouseOver();
bool mousePressed();
bool mouseDragged();
bool mouseReleased();
//MarControl stuff
void loadMarControl(MarControlPtr ctrl);
bool isLoaded_;
//draw stuff
void organizeDiagram();
void debugger();
protected:
MarSystemWidget* msysw_;
MaximizeButton* mBtn_;
bool isVisible_;
MarControlPtr ctrl_;
std::vector<std::pair<MarControlPtr, MarControlPtr> > linkedControls_;
std::vector<MarControlDiagramNode*> nodes;
MarControlDiagramNode* nodeExists(MarControlDiagramNode* node, MarControlWidget* cw);
};
}
#endif
|
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
* (C) 2002-2003 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2002, 2006, 2008, 2012 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 CSSImportRule_h
#define CSSImportRule_h
#include "CSSRule.h"
namespace WebCore {
class CachedCSSStyleSheet;
class MediaList;
class MediaQuerySet;
class StyleRuleImport;
class CSSImportRule : public CSSRule {
public:
static PassRefPtr<CSSImportRule> create(StyleRuleImport* rule, CSSStyleSheet* sheet) { return adoptRef(new CSSImportRule(rule, sheet)); }
virtual ~CSSImportRule();
virtual CSSRule::Type type() const override { return IMPORT_RULE; }
virtual String cssText() const override;
virtual void reattach(StyleRuleBase*) override;
String href() const;
MediaList* media() const;
CSSStyleSheet* styleSheet() const;
private:
CSSImportRule(StyleRuleImport*, CSSStyleSheet*);
RefPtr<StyleRuleImport> m_importRule;
mutable RefPtr<MediaList> m_mediaCSSOMWrapper;
mutable RefPtr<CSSStyleSheet> m_styleSheetCSSOMWrapper;
};
} // namespace WebCore
#endif // CSSImportRule_h
|
/*
*
* Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin
*
* This file is part of paparazzi.
*
* paparazzi 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.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include <inttypes.h>
#include "generated/radio.h"
#include "rc_settings.h"
#include "autopilot.h"
#include "firmwares/fixedwing/nav.h"
#include "subsystems/sensors/infrared.h"
#include "inter_mcu.h"
#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
uint8_t rc_settings_mode = 0;
float slider_1_val, slider_2_val;
#define ParamValInt16(param_init_val, param_travel, cur_pulse, init_pulse) \
(param_init_val + (int16_t)(((float)(cur_pulse - init_pulse)) * param_travel / (float)MAX_PPRZ))
#define ParamValFloat(param_init_val, param_travel, cur_pulse, init_pulse) \
(param_init_val + ((float)(cur_pulse - init_pulse)) * param_travel / (float)MAX_PPRZ)
#define RcChannel(x) (fbw_state->channels[x])
/** Includes generated code from tuning_rc.xml */
#include "generated/settings.h"
void rc_settings(bool_t mode_changed __attribute__ ((unused))) {
RCSettings(mode_changed);
}
|
/*
* linux/arch/arm/mach-omap2/prcm.c
*
* OMAP 24xx Power Reset and Clock Management (PRCM) functions
*
* Copyright (C) 2005 Nokia Corporation
*
* Written by Tony Lindgren <tony.lindgren@nokia.com>
*
* Copyright (C) 2007 Texas Instruments, Inc.
* Rajendra Nayak <rnayak@ti.com>
*
* Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
* Upgraded with OMAP4 support by Abhijit Pagare <abhijitpagare@ti.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <mach/system.h>
#include <plat/common.h>
#include <plat/prcm.h>
#include <plat/irqs.h>
#include "clock.h"
#include "clock2xxx.h"
#include "cm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
#include "prm44xx.h"
#include "prm33xx.h"
#include "prminst44xx.h"
#include "prm-regbits-24xx.h"
#include "prm-regbits-44xx.h"
#include "control.h"
void __iomem *prm_base;
void __iomem *cm_base;
void __iomem *cm2_base;
#define MAX_MODULE_ENABLE_WAIT 100000
u32 omap_prcm_get_reset_sources(void)
{
/* XXX This presumably needs modification for 34XX */
if (cpu_is_omap24xx() || cpu_is_omap34xx())
return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
if (cpu_is_omap44xx())
return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
return 0;
}
EXPORT_SYMBOL(omap_prcm_get_reset_sources);
/* Resets clock rates and reboots the system. Only called from system.h */
static void omap_prcm_arch_reset(char mode, const char *cmd)
{
s16 prcm_offs = 0;
if (cpu_is_omap24xx()) {
omap2xxx_clk_prepare_for_reboot();
prcm_offs = WKUP_MOD;
} else if (cpu_is_am33xx()) {
prcm_offs = AM33XX_PRM_DEVICE_MOD;
omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
prcm_offs, AM33XX_PRM_RSTCTRL_OFFSET);
} else if (cpu_is_omap34xx()) {
prcm_offs = OMAP3430_GR_MOD;
omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
} else if (cpu_is_omap44xx()) {
omap4_prminst_global_warm_sw_reset(); /* never returns */
} else {
WARN_ON(1);
}
/*
* As per Errata i520, in some cases, user will not be able to
* access DDR memory after warm-reset.
* This situation occurs while the warm-reset happens during a read
* access to DDR memory. In that particular condition, DDR memory
* does not respond to a corrupted read command due to the warm
* reset occurrence but SDRC is waiting for read completion.
* SDRC is not sensitive to the warm reset, but the interconnect is
* reset on the fly, thus causing a misalignment between SDRC logic,
* interconnect logic and DDR memory state.
* WORKAROUND:
* Steps to perform before a Warm reset is trigged:
* 1. enable self-refresh on idle request
* 2. put SDRC in idle
* 3. wait until SDRC goes to idle
* 4. generate SW reset (Global SW reset)
*
* Steps to be performed after warm reset occurs (in bootloader):
* if HW warm reset is the source, apply below steps before any
* accesses to SDRAM:
* 1. Reset SMS and SDRC and wait till reset is complete
* 2. Re-initialize SMS, SDRC and memory
*
* NOTE: Above work around is required only if arch reset is implemented
* using Global SW reset(GLOBAL_SW_RST). DPLL3 reset does not need
* the WA since it resets SDRC as well as part of cold reset.
*/
/* XXX should be moved to some OMAP2/3 specific code */
omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
OMAP2_RM_RSTCTRL);
omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
}
void (*arch_reset)(char, const char *) = omap_prcm_arch_reset;
/**
* omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
* @reg: physical address of module IDLEST register
* @mask: value to mask against to determine if the module is active
* @idlest: idle state indicator (0 or 1) for the clock
* @name: name of the clock (for printk)
*
* Returns 1 if the module indicated readiness in time, or 0 if it
* failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
*
* XXX This function is deprecated. It should be removed once the
* hwmod conversion is complete.
*/
int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
const char *name)
{
int i = 0;
int ena = 0;
if (idlest)
ena = 0;
else
ena = mask;
/* Wait for lock */
omap_test_timeout(((__raw_readl(reg) & mask) == ena),
MAX_MODULE_ENABLE_WAIT, i);
if (i < MAX_MODULE_ENABLE_WAIT)
pr_debug("cm: Module associated with clock %s ready after %d "
"loops\n", name, i);
else
pr_err("cm: Module associated with clock %s didn't enable in "
"%d tries\n", name, MAX_MODULE_ENABLE_WAIT);
return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
};
void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
{
if (omap2_globals->prm)
prm_base = omap2_globals->prm;
if (omap2_globals->cm)
cm_base = omap2_globals->cm;
if (omap2_globals->cm2)
cm2_base = omap2_globals->cm2;
}
|
/*
* QEMU Crypto hmac algorithms
*
* Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
*
* This work is licensed under the terms of the GNU GPL, version 2 or
* (at your option) any later version. See the COPYING file in the
* top-level directory.
*
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "crypto/hmac.h"
static const char hex[] = "0123456789abcdef";
int qcrypto_hmac_bytes(QCryptoHmac *hmac,
const char *buf,
size_t len,
uint8_t **result,
size_t *resultlen,
Error **errp)
{
struct iovec iov = {
.iov_base = (char *)buf,
.iov_len = len
};
return qcrypto_hmac_bytesv(hmac, &iov, 1, result, resultlen, errp);
}
int qcrypto_hmac_digestv(QCryptoHmac *hmac,
const struct iovec *iov,
size_t niov,
char **digest,
Error **errp)
{
uint8_t *result = NULL;
size_t resultlen = 0;
size_t i;
if (qcrypto_hmac_bytesv(hmac, iov, niov, &result, &resultlen, errp) < 0) {
return -1;
}
*digest = g_new0(char, (resultlen * 2) + 1);
for (i = 0 ; i < resultlen ; i++) {
(*digest)[(i * 2)] = hex[(result[i] >> 4) & 0xf];
(*digest)[(i * 2) + 1] = hex[result[i] & 0xf];
}
(*digest)[resultlen * 2] = '\0';
g_free(result);
return 0;
}
int qcrypto_hmac_digest(QCryptoHmac *hmac,
const char *buf,
size_t len,
char **digest,
Error **errp)
{
struct iovec iov = {
.iov_base = (char *)buf,
.iov_len = len
};
return qcrypto_hmac_digestv(hmac, &iov, 1, digest, errp);
}
|
// TR1 stdint.h -*- C++ -*-
// Copyright (C) 2006-2021 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, 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 General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/stdint.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_STDINT_H
#define _TR1_STDINT_H 1
#include <tr1/cstdint>
#endif
|
/* Complex sine hyperbole function for double.
Copyright (C) 1997-2015 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 <complex.h>
#include <fenv.h>
#include <math.h>
#include <math_private.h>
#include <float.h>
__complex__ double
__csinh (__complex__ double x)
{
__complex__ double retval;
int negate = signbit (__real__ x);
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
__real__ x = fabs (__real__ x);
if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
double sinix, cosix;
if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
{
__sincos (__imag__ x, &sinix, &cosix);
}
else
{
sinix = __imag__ x;
cosix = 1.0;
}
if (negate)
cosix = -cosix;
if (fabs (__real__ x) > t)
{
double exp_t = __ieee754_exp (t);
double rx = fabs (__real__ x);
if (signbit (__real__ x))
cosix = -cosix;
rx -= t;
sinix *= exp_t / 2.0;
cosix *= exp_t / 2.0;
if (rx > t)
{
rx -= t;
sinix *= exp_t;
cosix *= exp_t;
}
if (rx > t)
{
/* Overflow (original real part of x > 3t). */
__real__ retval = DBL_MAX * cosix;
__imag__ retval = DBL_MAX * sinix;
}
else
{
double exp_val = __ieee754_exp (rx);
__real__ retval = exp_val * cosix;
__imag__ retval = exp_val * sinix;
}
}
else
{
__real__ retval = __ieee754_sinh (__real__ x) * cosix;
__imag__ retval = __ieee754_cosh (__real__ x) * sinix;
}
math_check_force_underflow_complex (retval);
}
else
{
if (rcls == FP_ZERO)
{
/* Real part is 0.0. */
__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
__imag__ retval = __nan ("") + __nan ("");
if (icls == FP_INFINITE)
feraiseexcept (FE_INVALID);
}
else
{
__real__ retval = __nan ("");
__imag__ retval = __nan ("");
feraiseexcept (FE_INVALID);
}
}
}
else if (rcls == FP_INFINITE)
{
/* Real part is infinite. */
if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
double sinix, cosix;
if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
{
__sincos (__imag__ x, &sinix, &cosix);
}
else
{
sinix = __imag__ x;
cosix = 1.0;
}
__real__ retval = __copysign (HUGE_VAL, cosix);
__imag__ retval = __copysign (HUGE_VAL, sinix);
if (negate)
__real__ retval = -__real__ retval;
}
else if (icls == FP_ZERO)
{
/* Imaginary part is 0.0. */
__real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
__imag__ retval = __imag__ x;
}
else
{
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VAL;
__imag__ retval = __nan ("") + __nan ("");
if (icls == FP_INFINITE)
feraiseexcept (FE_INVALID);
}
}
else
{
__real__ retval = __nan ("");
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
}
return retval;
}
weak_alias (__csinh, csinh)
#ifdef NO_LONG_DOUBLE
strong_alias (__csinh, __csinhl)
weak_alias (__csinh, csinhl)
#endif
|
#if !defined(UPNP_H)
#define UPNP_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <natupnp.h>
#include <comutil.h>
class UPnP
{
public:
UPnP();
~UPnP();
void Set_UPnP(char * , char *, char *, const short );
HRESULT OpenPorts(bool log);
HRESULT ClosePorts(bool log);
_bstr_t GetExternalIP();
private:
bool PortsAreOpen;
int PortNumber; // The Port number required to be opened
BSTR bstrInternalClient; // Local IP Address
BSTR bstrDescription; // name shown in UPnP interface details
BSTR bstrProtocol; // protocol (TCP or UDP)
BSTR bstrExternalIP; // external IP address
IUPnPNAT* pUN; // pointer to the UPnPNAT interface
IStaticPortMappingCollection* pSPMC; // pointer to the collection
IStaticPortMapping * pSPM; // pointer to the port map
};
#endif // UPNP_H
|
#ifndef DX11_VIDEO_BACKEND_H_
#define DX11_VIDEO_BACKEND_H_
#include "VideoBackendBase.h"
namespace DX11
{
class VideoBackend : public VideoBackendHardware
{
bool Initialize(void *&);
void Shutdown();
std::string GetName();
std::string GetDisplayName();
void Video_Prepare();
void Video_Cleanup();
void ShowConfig(void* parent);
void UpdateFPSDisplay(const char*);
unsigned int PeekMessages();
};
}
#endif
|
/* gcompris - py-gcompris-profile.h
*
* Copyright (C) 2003, 2008 Olivier Samyn <osamyn@ulb.ac.be>
*
* 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 _PY_GCOMPRIS_PROFILE_H_
#define _PY_GCOMPRIS_PROFILE_H_
#include <Python.h>
#include "gcompris/gcompris.h"
PyObject* gcompris_new_pyGcomprisProfileObject(GcomprisProfile* profile);
typedef struct{
PyObject_HEAD
GcomprisProfile* cdata;
} pyGcomprisProfileObject;
PyObject* gcompris_new_pyGcomprisClassObject(GcomprisClass* class);
typedef struct{
PyObject_HEAD
GcomprisClass* cdata;
} pyGcomprisClassObject;
PyObject* gcompris_new_pyGcomprisGroupObject(GcomprisGroup* group);
typedef struct{
PyObject_HEAD
GcomprisGroup* cdata;
} pyGcomprisGroupObject;
PyObject* gcompris_new_pyGcomprisUserObject(GcomprisUser* user);
typedef struct{
PyObject_HEAD
GcomprisUser* cdata;
} pyGcomprisUserObject;
#endif
|
#pragma once
#include <cstdint>
#include <utility>
namespace nn::ipc
{
using CommandId = int32_t;
using ServiceId = int32_t;
template<typename Service, int Id>
struct Command
{
template<typename... ParameterTypes>
struct Parameters
{
static constexpr ServiceId service = Service::id;
static constexpr CommandId command = Id;
using parameters = std::tuple<ParameterTypes...>;
using response = std::tuple<>;
// ::Response is optional
template<typename... ResponseTypes>
struct Response
{
static constexpr ServiceId service = Service::id;
static constexpr CommandId command = Id;
using parameters = std::tuple<ParameterTypes...>;
using response = std::tuple<ResponseTypes...>;
};
};
};
} // namespace nn::ipc
|
/*
* linux/mm/swap.c
*
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
*/
/*
* This file contains the default values for the opereation of the
* Linux VM subsystem. Fine-tuning documentation can be found in
* linux/Documentation/sysctl/vm.txt.
* Started 18.12.91
* Swap aging added 23.2.95, Stephen Tweedie.
* Buffermem limits added 12.3.98, Rik van Riel.
*/
#include <linux/mm.h>
#include <linux/kernel_stat.h>
#include <linux/swap.h>
#include <linux/swapctl.h>
#include <linux/pagemap.h>
#include <linux/init.h>
#include <asm/dma.h>
#include <asm/uaccess.h> /* for copy_to/from_user */
#include <asm/pgtable.h>
/*
* We identify three levels of free memory. We never let free mem
* fall below the freepages.min except for atomic allocations. We
* start background swapping if we fall below freepages.high free
* pages, and we begin intensive swapping below freepages.low.
*
* These values are there to keep GCC from complaining. Actual
* initialization is done in mm/page_alloc.c or arch/sparc(64)/mm/init.c.
*/
freepages_t freepages = {
48, /* freepages.min */
96, /* freepages.low */
144 /* freepages.high */
};
/* How many pages do we try to swap or page in/out together? */
int page_cluster = 4; /* Default value modified in swap_setup() */
/* We track the number of pages currently being asynchronously swapped
out, so that we don't try to swap TOO many pages out at once */
atomic_t nr_async_pages = ATOMIC_INIT(0);
buffer_mem_t buffer_mem = {
2, /* minimum percent buffer */
10, /* borrow percent buffer */
60 /* maximum percent buffer */
};
buffer_mem_t page_cache = {
2, /* minimum percent page cache */
15, /* borrow percent page cache */
75 /* maximum */
};
pager_daemon_t pager_daemon = {
512, /* base number for calculating the number of tries */
SWAP_CLUSTER_MAX, /* minimum number of tries */
SWAP_CLUSTER_MAX, /* do swap I/O in clusters of this size */
};
/*
* Perform any setup for the swap system
*/
void __init swap_setup(void)
{
/* Use a smaller cluster for memory <16MB or <32MB */
if (num_physpages < ((16 * 1024 * 1024) >> PAGE_SHIFT))
page_cluster = 2;
else if (num_physpages < ((32 * 1024 * 1024) >> PAGE_SHIFT))
page_cluster = 3;
else
page_cluster = 4;
}
|
/* Do not modify this file. Changes will be overwritten. */
/* Generated automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-q932.h */
/* asn2wrs.py -b -p q932 -c ./q932.cnf -s ./packet-q932-template -D . -O ../.. Addressing-Data-Elements.asn Network-Facility-Extension.asn Network-Protocol-Profile-component.asn Interpretation-component.asn */
/* Input file: packet-q932-template.h */
#line 1 "./asn1/q932/packet-q932-template.h"
/* packet-q932.h
* Routines for Q.932 packet dissection
* 2007 Tomas Kukosa
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef PACKET_Q932_H
#define PACKET_Q932_H
/*--- Included file: packet-q932-exp.h ---*/
#line 1 "./asn1/q932/packet-q932-exp.h"
WS_DLL_PUBLIC const value_string q932_PresentedAddressScreened_vals[];
WS_DLL_PUBLIC const value_string q932_PresentedAddressUnscreened_vals[];
WS_DLL_PUBLIC const value_string q932_PresentedNumberScreened_vals[];
WS_DLL_PUBLIC const value_string q932_PresentedNumberUnscreened_vals[];
WS_DLL_PUBLIC const value_string q932_PartyNumber_vals[];
WS_DLL_PUBLIC const value_string q932_PartySubaddress_vals[];
WS_DLL_PUBLIC const value_string q932_ScreeningIndicator_vals[];
WS_DLL_PUBLIC int dissect_q932_PresentedAddressScreened(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_PresentedAddressUnscreened(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_PresentedNumberScreened(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_PresentedNumberUnscreened(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_Address(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_PartyNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_PartySubaddress(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_ScreeningIndicator(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
WS_DLL_PUBLIC int dissect_q932_PresentationAllowedIndicator(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
/*--- End of included file: packet-q932-exp.h ---*/
#line 16 "./asn1/q932/packet-q932-template.h"
#endif /* PACKET_Q932_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.