text
stringlengths 4
6.14k
|
|---|
#ifndef org_apache_lucene_util_packed_AbstractPagedMutable_H
#define org_apache_lucene_util_packed_AbstractPagedMutable_H
#include "org/apache/lucene/util/LongValues.h"
namespace java {
namespace lang {
class String;
class Class;
}
}
template<class T> class JArray;
namespace org {
namespace apache {
namespace lucene {
namespace util {
namespace packed {
class AbstractPagedMutable : public ::org::apache::lucene::util::LongValues {
public:
enum {
mid_get_0ee6df33,
mid_grow_3bfef47c,
mid_grow_5f2a2a5f,
mid_ramBytesUsed_54c6a17a,
mid_resize_5f2a2a5f,
mid_set_a7e12ca4,
mid_size_54c6a17a,
mid_toString_14c7b5c5,
mid_fillPages_54c6a166,
mid_newMutable_48ebd249,
mid_newUnfilledCopy_5f2a2a5f,
mid_baseRamBytesUsed_54c6a17a,
max_mid
};
static ::java::lang::Class *class$;
static jmethodID *mids$;
static bool live$;
static jclass initializeClass(bool);
explicit AbstractPagedMutable(jobject obj) : ::org::apache::lucene::util::LongValues(obj) {
if (obj != NULL)
env->getClass(initializeClass);
}
AbstractPagedMutable(const AbstractPagedMutable& obj) : ::org::apache::lucene::util::LongValues(obj) {}
jlong get(jlong) const;
AbstractPagedMutable grow() const;
AbstractPagedMutable grow(jlong) const;
jlong ramBytesUsed() const;
AbstractPagedMutable resize(jlong) const;
void set(jlong, jlong) const;
jlong size() const;
::java::lang::String toString() const;
};
}
}
}
}
}
#include <Python.h>
namespace org {
namespace apache {
namespace lucene {
namespace util {
namespace packed {
extern PyTypeObject PY_TYPE(AbstractPagedMutable);
class t_AbstractPagedMutable {
public:
PyObject_HEAD
AbstractPagedMutable object;
PyTypeObject *parameters[1];
static PyTypeObject **parameters_(t_AbstractPagedMutable *self)
{
return (PyTypeObject **) &(self->parameters);
}
static PyObject *wrap_Object(const AbstractPagedMutable&);
static PyObject *wrap_jobject(const jobject&);
static PyObject *wrap_Object(const AbstractPagedMutable&, PyTypeObject *);
static PyObject *wrap_jobject(const jobject&, PyTypeObject *);
static void install(PyObject *module);
static void initialize(PyObject *module);
};
}
}
}
}
}
#endif
|
//
// This source file is part of appleseed.
// Visit https://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014-2018 Francois Beaune, The appleseedhq Organization
//
// 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.
//
#pragma once
// appleseed.renderer headers.
#include "renderer/modeling/surfaceshader/isurfaceshaderfactory.h"
// appleseed.foundation headers.
#include "foundation/memory/autoreleaseptr.h"
// appleseed.main headers.
#include "main/dllsymbol.h"
// Forward declarations.
namespace foundation { class Dictionary; }
namespace foundation { class DictionaryArray; }
namespace renderer { class ParamArray; }
namespace renderer { class SurfaceShader; }
namespace renderer
{
//
// Physical surface shader factory.
//
class APPLESEED_DLLSYMBOL PhysicalSurfaceShaderFactory
: public ISurfaceShaderFactory
{
public:
// Delete this instance.
void release() override;
// Return a string identifying this surface shader model.
const char* get_model() const override;
// Return metadata for this surface shader model.
foundation::Dictionary get_model_metadata() const override;
// Return metadata for the inputs of this surface shader model.
foundation::DictionaryArray get_input_metadata() const override;
// Create a new surface shader instance.
foundation::auto_release_ptr<SurfaceShader> create(
const char* name,
const ParamArray& params) const override;
};
} // namespace renderer
|
/*
* (C) Copyright 2016 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __ASM_ARCH_CRU_RK3328_H_
#define __ASM_ARCH_CRU_RK3328_H_
#include <common.h>
struct rk3328_clk_priv {
struct rk3328_cru *cru;
ulong rate;
};
struct rk3328_cru {
u32 apll_con[5];
u32 reserved1[3];
u32 dpll_con[5];
u32 reserved2[3];
u32 cpll_con[5];
u32 reserved3[3];
u32 gpll_con[5];
u32 reserved4[3];
u32 mode_con;
u32 misc;
u32 reserved5[2];
u32 glb_cnt_th;
u32 glb_rst_st;
u32 glb_srst_snd_value;
u32 glb_srst_fst_value;
u32 npll_con[5];
u32 reserved6[(0x100 - 0xb4) / 4];
u32 clksel_con[53];
u32 reserved7[(0x200 - 0x1d4) / 4];
u32 clkgate_con[29];
u32 reserved8[3];
u32 ssgtbl[32];
u32 softrst_con[12];
u32 reserved9[(0x380 - 0x330) / 4];
u32 sdmmc_con[2];
u32 sdio_con[2];
u32 emmc_con[2];
u32 sdmmc_ext_con[2];
};
check_member(rk3328_cru, sdmmc_ext_con[1], 0x39c);
#define MHz 1000000
#define KHz 1000
#define OSC_HZ (24 * MHz)
#define APLL_HZ (600 * MHz)
#define GPLL_HZ (576 * MHz)
#define CPLL_HZ (594 * MHz)
#define CLK_CORE_HZ (600 * MHz)
#define ACLKM_CORE_HZ (300 * MHz)
#define PCLK_DBG_HZ (300 * MHz)
#define PERIHP_ACLK_HZ (144000 * KHz)
#define PERIHP_HCLK_HZ (72000 * KHz)
#define PERIHP_PCLK_HZ (72000 * KHz)
#define PWM_CLOCK_HZ (74 * MHz)
enum apll_frequencies {
APLL_816_MHZ,
APLL_600_MHZ,
};
#endif /* __ASM_ARCH_CRU_RK3328_H_ */
|
#import <UIKit/UIKit.h>
#import "KVNProgress.h"
#import "KVNProgressConfiguration.h"
#import "UIColor+KVNContrast.h"
#import "UIImage+KVNEmpty.h"
#import "UIImage+KVNImageEffects.h"
FOUNDATION_EXPORT double KVNProgressVersionNumber;
FOUNDATION_EXPORT const unsigned char KVNProgressVersionString[];
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_SNEFRU_H
#define PHP_HASH_SNEFRU_H
/* SNEFRU-2.5a with 8 passes and 256 bit hash output
* AKA "Xerox Secure Hash Function"
*/
#include "ext/standard/basic_functions.h"
/* SNEFRU context */
typedef struct {
php_hash_uint32 state[16];
php_hash_uint32 count[2];
unsigned char length;
unsigned char buffer[32];
} PHP_SNEFRU_CTX;
PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *);
PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SNEFRUFinal(unsigned char[32], PHP_SNEFRU_CTX *);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
|
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <onlp_snmp/onlp_snmp_config.h>
#include "onlp_snmp_log.h"
/*
* onlp_snmp log struct.
*/
AIM_LOG_STRUCT_DEFINE(
ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT,
ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT,
NULL, /* Custom log map */
ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT
);
|
/*
* rt_names.c rtnetlink names DB.
*
* 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.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
#include <string.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <asm/types.h>
#include <linux/rtnetlink.h>
#include "rt_names.h"
static char * rtnl_rttable_tab[256] =
{
"unspec",
};
static int rtnl_rttable_init;
static void rtnl_rttable_initialize(void)
{
rtnl_rttable_init = 1;
rtnl_rttable_tab[255] = "local";
rtnl_rttable_tab[254] = "main";
rtnl_rttable_tab[253] = "default";
/* Add the table name here, simple is the best, RTFSC!*/
rtnl_rttable_tab[201] = "PPP1";
}
char * rtnl_rttable_n2a(int id, char *buf, int len)
{
if (id<0 || id>=256)
{
snprintf(buf, len, "%d", id);
return buf;
}
if (!rtnl_rttable_tab[id])
{
if (!rtnl_rttable_init)
rtnl_rttable_initialize();
}
if (rtnl_rttable_tab[id])
return rtnl_rttable_tab[id];
snprintf(buf, len, "%d", id);
return buf;
}
int rtnl_rttable_a2n(unsigned int * id, char * arg)
{
static char * cache = NULL;
static unsigned long res;
char * end;
int i;
if (cache && strcmp(cache, arg) == 0)
{
*id = res;
return 0;
}
if (!rtnl_rttable_init)
rtnl_rttable_initialize();
for (i=0; i<256; i++)
{
if (rtnl_rttable_tab[i] && strcmp(rtnl_rttable_tab[i], arg) == 0)
{
cache = rtnl_rttable_tab[i];
res = i;
*id = res;
return 0;
}
}
i = strtoul(arg, &end, 0);
if (!end || end == arg || *end || i > 255)
return -1;
*id = i;
return 0;
}
|
/*----------------------------------------------------------------------------
* RL-ARM - RTX
*----------------------------------------------------------------------------
* Name: RT_ROBIN.H
* Purpose: Round Robin Task switching definitions
* Rev.: V4.60
*----------------------------------------------------------------------------
* This code is part of the RealView Run-Time Library.
* Copyright (c) 2004-2012 KEIL - An ARM Company. All rights reserved.
*---------------------------------------------------------------------------*/
/* Variables */
extern struct OS_ROBIN os_robin;
/* Functions */
extern void rt_init_robin (void);
extern void rt_chk_robin (void);
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
|
// Aseprite Document Library
// Copyright (c) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef DOC_DOCUMENT_OBSERVER_H_INCLUDED
#define DOC_DOCUMENT_OBSERVER_H_INCLUDED
#pragma once
namespace doc {
class Document;
class DocumentEvent;
class DocumentObserver {
public:
virtual ~DocumentObserver() { }
virtual void onFileNameChanged(Document* doc) { }
// General update. If an observer receives this event, it's because
// anything in the document could be changed.
virtual void onGeneralUpdate(DocumentEvent& ev) { }
virtual void onPixelFormatChanged(DocumentEvent& ev) { }
virtual void onAddLayer(DocumentEvent& ev) { }
virtual void onAddFrame(DocumentEvent& ev) { }
virtual void onAddCel(DocumentEvent& ev) { }
virtual void onBeforeRemoveLayer(DocumentEvent& ev) { }
virtual void onAfterRemoveLayer(DocumentEvent& ev) { }
// Called when a frame is removed. It's called after the frame was
// removed, and the sprite's total number of frames is modified.
virtual void onRemoveFrame(DocumentEvent& ev) { }
virtual void onRemoveCel(DocumentEvent& ev) { }
virtual void onSpriteSizeChanged(DocumentEvent& ev) { }
virtual void onSpriteTransparentColorChanged(DocumentEvent& ev) { }
virtual void onLayerNameChange(DocumentEvent& ev) { }
virtual void onLayerOpacityChange(DocumentEvent& ev) { }
virtual void onLayerBlendModeChange(DocumentEvent& ev) { }
virtual void onLayerRestacked(DocumentEvent& ev) { }
virtual void onLayerMergedDown(DocumentEvent& ev) { }
virtual void onCelMoved(DocumentEvent& ev) { }
virtual void onCelCopied(DocumentEvent& ev) { }
virtual void onCelFrameChanged(DocumentEvent& ev) { }
virtual void onCelPositionChanged(DocumentEvent& ev) { }
virtual void onCelOpacityChange(DocumentEvent& ev) { }
virtual void onFrameDurationChanged(DocumentEvent& ev) { }
virtual void onImagePixelsModified(DocumentEvent& ev) { }
virtual void onSpritePixelsModified(DocumentEvent& ev) { }
virtual void onExposeSpritePixels(DocumentEvent& ev) { }
// When the number of total frames available is modified.
virtual void onTotalFramesChanged(DocumentEvent& ev) { }
// The selection has changed.
virtual void onSelectionChanged(DocumentEvent& ev) { }
// Called to destroy the observable. (Here you could call "delete this".)
virtual void dispose() { }
};
} // namespace doc
#endif
|
#ifndef __MICROP_DATA_DEF_H
#define __MICROP_DATA_DEF_H
struct microP_platform_data{
int intr_gpio;
};
enum MICROP_CMD_ID {
MICROP_HW_ID=0, // 0x00
MICROP_LDROM_ID_CODE, // 0x03
MICROP_ISN, // 0x04
MICROP_IND_PHONE_READY, // 0x05
MICROP_POWER_ON_REASON, // 0x07
MICROP_DISABLE_CHARGING_FOR_FACTORY, // 0x08
MICROP_CALIBRATION_DATA, // 0x0A
MICROP_ALWAYS_IGNORE_PHONE_READY, // 0x0B
MICROP_OEM_SSN, // 0x0D
MICROP_OEM_IMEI, // 0x0E
MICROP_OEM_FW_VERSION, // 0x0F
MICROP_GPIO_INPUT_LEVEL, // 0x20
MICROP_GPIO_OUTPUT_LEVEL, // 0x21
MICROP_GPIO_OUTPUT_BIT_SET, // 0x22
MICROP_GPIO_OUTPUT_BIT_CLR, // 0x23
MICROP_PAD_HWID, // 0x26
MICROP_PROXIM_KDATA, //0x27
MICROP_CHARGING_STATUS, // 0x30
MICROP_GAUGE_ID, // 0x31
MICROP_USB_DET, // 0x34
MICROP_USB_TYPE, // 0x37
MICROP_BATTERY_INFO, // 0x38
MICROP_BATTERY_SOC, // 0x39
MICROP_BATTERY_CONFIG, // 0x3A
MICROP_PWM, // 0x40
MICROP_INTR_STATUS, // 0x41
MICROP_INTR_EN, // 0x42
MICROP_INTR_EN_BIT_SET, // 0x43
MICROP_INTR_EN_BIT_CLR, // 0x44
MICROP_BOOT_SELECTION, // 0x50
MICROP_SET_BOOT_LDROM, // 0x51
MICROP_SET_BOOT_APROM, // 0x52
MICROP_APROM_CHECKSUM, // 0x54
MICROP_SOFTWARE_OFF, // 0x55
MICROP_IND_PHONE_SLEEP, // 0x56
MICROP_IND_PHONE_RESUME, // 0x57
MICROP_OPERATING_STATE, // 0x58
MICROP_POWER_ON, //0x5C
MICROP_MISC_CMD_WOS, // 0x5E
MICROP_OTG_POWER, // 0x5F
};
enum MICROP_OP_STATE{
st_MICROP_Off=0,
st_MICROP_Active=1,
st_MICROP_Sleep=2,
st_MICROP_Unknown=3,
};
enum MICROP_POWERON_REASON{
E_NONE=0,
E_ON_HS_IN=1,
E_ON_AC_USB=2,
E_ON_PWR_KEY_LONGPRESS=3,
};
#define MICROP_RESET_SW_GAUGE BIT(0)
#define MICROP_RESET_RSOC BIT(1)
#define MICROP_CLEAR_POWER_REASON BIT(2)
// define ioctl code
#define ASUS_MICROP_IOC_TYPE 0xa1
#define ASUS_MICROP_FW_UPDATE _IOWR(ASUS_MICROP_IOC_TYPE, 1, int)
#define ASUS_MICROP_CHECK_CONNECTED _IOWR(ASUS_MICROP_IOC_TYPE, 2, int)
#define ASUS_MICROP_GET_FW_VERSION _IOWR(ASUS_MICROP_IOC_TYPE, 3, int)
#define ASUS_MICROP_ON_OFF_GPS_ON_PAD _IOWR(ASUS_MICROP_IOC_TYPE, 4, int)
#define ASUS_MICROP_GET_LDROM_VERSION _IOWR(ASUS_MICROP_IOC_TYPE, 5, int)
#define ASUS_MICROP_GET_PADPHONE_HW_ID _IOWR(ASUS_MICROP_IOC_TYPE, 6, int)
#define ASUS_MICROP_POWER_ON_LED_O _IOWR(ASUS_MICROP_IOC_TYPE, 7, int)
#define ASUS_MICROP_POWER_OFF_LED_O _IOWR(ASUS_MICROP_IOC_TYPE, 8, int)
#define ASUS_MICROP_POWER_ON_LED_G _IOWR(ASUS_MICROP_IOC_TYPE, 9, int)
#define ASUS_MICROP_POWER_OFF_LED_G _IOWR(ASUS_MICROP_IOC_TYPE, 10, int)
#define ASUS_MICROP_SEND_VREMOVE_UEVENT _IOWR(ASUS_MICROP_IOC_TYPE, 11, int)
#define ASUS_MICROP_PAD_TEST_PLUG_IN_OUT _IOWR(ASUS_MICROP_IOC_TYPE, 12, int)
#define ASUS_MICROP_SEND_CFG_INFO _IOWR(ASUS_MICROP_IOC_TYPE, 13, int)
#define ASUS_MICROP_GET_BATTERY_ID _IOWR(ASUS_MICROP_IOC_TYPE, 14, int)
#define ASUS_MICROP_GET_CONFIG_ID _IOWR(ASUS_MICROP_IOC_TYPE, 15, int)
#define ASUS_MICROP_GET_TS_ID _IOWR(ASUS_MICROP_IOC_TYPE, 16, int)
#define ASUS_MICROP_GET_HW_ID _IOWR(ASUS_MICROP_IOC_TYPE, 17, uint8_t)
#define ASUS_MICROP_MAX_NR 17
#endif
|
/**
* PIC_RW - Qt PIC Support
* Copyright (C) 2007 Ruben Lopez <r.lopez@bren.es>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* ----------------------------------------------------------------------------
*/
/* This code is based on the GIMP-PIC plugin by Halfdan Ingvarsson,
* and relicensed from GPL to LGPL to accomodate the KDE licensing policy
* with his permission.
* These is the original copyright:
* Copyright (C) 1998 Halfdan Ingvarsson
*/
#ifndef __PIC_RW_H__
#define __PIC_RW_H__
#define PIC_MAGIC_NUMBER 0x5380f634
#include <QtCore/QFile>
#include <QtGui/QImageIOPlugin>
#include <QtGui/QColor>
/**
* How fields are distributed over the image
*/
typedef enum {
NONE = 0, /* No picture */
ODD = 1, /* Odd scanlines */
EVEN = 2, /* Even scanlines */
BOTH = 3 /* Every scanline */
} PICFields;
/**
* Type of a channel
*/
typedef enum {
UNCOMPRESSED = 0, /* Image is uncompressed */
RLE = 2 /* Run length compression */
} PICChannelType;
/**
* Channel codes
*/
typedef enum {
RED = 0x80, /* Red channel */
GREEN = 0x40, /* Green channel */
BLUE = 0x20, /* Blue channel */
ALPHA = 0x10 /* Alpha channel */
} PICChannelCode;
/**
* PIC format header
*/
typedef struct {
qint32 magic; /* PIC_MAGIC_NUMBER */
float version; /* Version of format */
char comment[80]; /* Prototype description */
char id[4]; /* "PICT" */
qint16 width; /* Image width, in pixels */
qint16 height; /* Image height, in pixels */
float ratio; /* Pixel aspect ratio */
qint16 fields; /* Picture field type */
qint16 pad; /* Unused */
} PICHeader;
/**
* PIC channel header
*/
typedef struct {
char chained; /* 1 if another packet follows, else 0 */
char size; /* Bits per pixel by channel */
char type; /* RLE or uncompressed */
char channel; /* Channel code (which planes are affected by this channel) */
} PICChannel;
#define HEADER_SIZE sizeof(PICHeader)
#define CHANNEL_SIZE sizeof(PICChannel)
/**
* Reads the PIC header and checks that it is OK
* @param dev The QT device to read from
* @param hdr A pointer to the PIC header
* @param peek Keep bytes in the device
* @return true on success
*/
bool picReadHeader(QIODevice *dev, PICHeader *hdr, bool peek = false);
/// Pic read handler for Qt / KDE
void pic_read(QIODevice *dev, QImage *img);
/// Pic write handler for Qt / KDE
void pic_write(QIODevice *dev, const QImage *img);
#endif//__PIC_RW_H__
|
/*
* driver/base/topology.c - Populate sysfs with cpu topology information
*
* Written by: Zhang Yanmin, Intel Corporation
*
* Copyright (C) 2006, Intel Corp.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <linux/mm.h>
#include <linux/cpu.h>
#include <linux/module.h>
#include <linux/hardirq.h>
#include <linux/topology.h>
#define define_one_ro_named(_name, _func) \
static DEVICE_ATTR(_name, 0444, _func, NULL)
#define define_one_ro(_name) \
static DEVICE_ATTR(_name, 0444, show_##_name, NULL)
#define define_id_show_func(name) \
static ssize_t show_##name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
unsigned int cpu = dev->id; \
return sprintf(buf, "%d\n", topology_##name(cpu)); \
}
#if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \
defined(topology_book_cpumask)
static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf)
{
ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf;
int n = 0;
if (len > 1) {
n = type?
cpulist_scnprintf(buf, len-2, mask) :
cpumask_scnprintf(buf, len-2, mask);
buf[n++] = '\n';
buf[n] = '\0';
}
return n;
}
#endif
#define define_siblings_show_map(name) \
static ssize_t show_##name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return show_cpumap(0, topology_##name(dev->id), buf); \
}
#define define_siblings_show_list(name) \
static ssize_t show_##name##_list(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
return show_cpumap(1, topology_##name(dev->id), buf); \
}
#define define_siblings_show_func(name) \
define_siblings_show_map(name); define_siblings_show_list(name)
define_id_show_func(physical_package_id);
define_one_ro(physical_package_id);
define_id_show_func(core_id);
define_one_ro(core_id);
define_siblings_show_func(thread_cpumask);
define_one_ro_named(thread_siblings, show_thread_cpumask);
define_one_ro_named(thread_siblings_list, show_thread_cpumask_list);
define_siblings_show_func(core_cpumask);
define_one_ro_named(core_siblings, show_core_cpumask);
define_one_ro_named(core_siblings_list, show_core_cpumask_list);
#ifdef CONFIG_SCHED_BOOK
define_id_show_func(book_id);
define_one_ro(book_id);
define_siblings_show_func(book_cpumask);
define_one_ro_named(book_siblings, show_book_cpumask);
define_one_ro_named(book_siblings_list, show_book_cpumask_list);
#endif
static struct attribute *default_attrs[] = {
&dev_attr_physical_package_id.attr,
&dev_attr_core_id.attr,
&dev_attr_thread_siblings.attr,
&dev_attr_thread_siblings_list.attr,
&dev_attr_core_siblings.attr,
&dev_attr_core_siblings_list.attr,
#ifdef CONFIG_SCHED_BOOK
&dev_attr_book_id.attr,
&dev_attr_book_siblings.attr,
&dev_attr_book_siblings_list.attr,
#endif
NULL
};
static struct attribute_group topology_attr_group = {
.attrs = default_attrs,
.name = "topology"
};
/* Add/Remove cpu_topology interface for CPU device */
static int topology_add_dev(unsigned int cpu)
{
struct device *dev = get_cpu_device(cpu);
return sysfs_create_group(&dev->kobj, &topology_attr_group);
}
static void topology_remove_dev(unsigned int cpu)
{
struct device *dev = get_cpu_device(cpu);
sysfs_remove_group(&dev->kobj, &topology_attr_group);
}
static int topology_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
int rc = 0;
switch (action) {
case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN:
rc = topology_add_dev(cpu);
break;
case CPU_UP_CANCELED:
case CPU_UP_CANCELED_FROZEN:
case CPU_DEAD:
case CPU_DEAD_FROZEN:
topology_remove_dev(cpu);
break;
}
return notifier_from_errno(rc);
}
static int topology_sysfs_init(void)
{
int cpu;
int rc;
for_each_online_cpu(cpu) {
rc = topology_add_dev(cpu);
if (rc)
return rc;
}
hotcpu_notifier(topology_cpu_callback, 0);
return 0;
}
device_initcall(topology_sysfs_init);
|
/**********************************************************************
Copyright(c) 2011-2013 Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the 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 Intel Corporation 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 <stdio.h>
#include <stdlib.h>
#include <string.h> // for memset
#include "erasure_code.h"
#include "test.h"
//#define CACHED_TEST
#ifdef CACHED_TEST
// Cached test, loop many times over small dataset
# define TEST_LEN 8*1024
# define TEST_LOOPS 4000000
# define TEST_TYPE_STR "_warm"
#else
# ifndef TEST_CUSTOM
// Uncached test. Pull from large mem base.
# define TEST_SOURCES 16
# define GT_L3_CACHE 32*1024*1024 /* some number > last level cache */
# define TEST_LEN GT_L3_CACHE / 2
# define TEST_LOOPS 1000
# define TEST_TYPE_STR "_cold"
# else
# define TEST_TYPE_STR "_cus"
# ifndef TEST_LOOPS
# define TEST_LOOPS 1000
# endif
# endif
#endif
#define TEST_MEM (2 * TEST_LEN)
typedef unsigned char u8;
// Global GF(256) tables
u8 gff[256];
u8 gflog[256];
void mk_gf_field()
{
int i;
u8 s = 1;
gflog[0] = 0;
for(i=0; i<256; i++){
gff[i] = s;
gflog[s] = i;
s = (s << 1) ^ ( (s & 0x80) ? 0x1d : 0); // mult by GF{2}
}
}
int main(int argc, char *argv[])
{
int i;
u8 *buff1, *buff2, gf_const_tbl[64], a = 2;
struct perf start, stop;
printf("gf_vect_mul_sse_perf:\n");
mk_gf_field();
gf_vect_mul_init(a, gf_const_tbl);
// Allocate large mem region
buff1 = (u8*) malloc(TEST_LEN);
buff2 = (u8*) malloc(TEST_LEN);
if (NULL == buff1 || NULL == buff2){
printf("Failed to allocate %dB\n", TEST_LEN);
return 1;
}
memset(buff1, 0, TEST_LEN);
memset(buff2, 0, TEST_LEN);
printf("Start timed tests\n");
fflush(0);
gf_vect_mul_sse(TEST_LEN, gf_const_tbl, buff1, buff2);
perf_start(&start);
for(i=0; i<TEST_LOOPS; i++){
gf_vect_mul_init(a, gf_const_tbl); // in a re-build would only calc once
gf_vect_mul_sse(TEST_LEN, gf_const_tbl, buff1, buff2);
}
perf_stop(&stop);
printf("gf_vect_mul_sse" TEST_TYPE_STR ": ");
perf_print(stop,start,(long long)TEST_LEN*i);
return 0;
}
|
/* Test the dispatcher.
Copyright (C) 2002-2006, 2008 Bruno Haible <bruno@clisp.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _MSC_VER
# include <config.h>
#endif
#include "sigsegv.h"
#include <stdio.h>
#if HAVE_SIGSEGV_RECOVERY
#include "mmaputil.h"
#include <stdlib.h>
static sigsegv_dispatcher dispatcher;
static volatile unsigned int logcount = 0;
static volatile unsigned long logdata[10];
static int
area_handler (void *fault_address, void *user_arg)
{
unsigned long area = *(unsigned long *)user_arg;
logdata[logcount++] = area;
if (logcount >= sizeof (logdata) / sizeof (logdata[0]))
abort ();
if (!((unsigned long)fault_address >= area
&& (unsigned long)fault_address - area < 0x4000))
abort ();
if (mprotect ((void *) area, 0x4000, PROT_READ_WRITE) == 0)
return 1;
return 0;
}
static int
handler (void *fault_address, int serious)
{
return sigsegv_dispatch (&dispatcher, fault_address);
}
static void
barrier ()
{
}
int
main ()
{
void *p;
unsigned long area1;
unsigned long area2;
unsigned long area3;
/* Preparations. */
#if !HAVE_MMAP_ANON && !HAVE_MMAP_ANONYMOUS && HAVE_MMAP_DEVZERO
zero_fd = open ("/dev/zero", O_RDONLY, 0644);
#endif
sigsegv_init (&dispatcher);
sigsegv_install_handler (&handler);
/* Setup some mmaped memory. */
p = mmap_zeromap ((void *) 0x12340000, 0x4000);
if (p == (void *)(-1))
{
fprintf (stderr, "mmap_zeromap failed.\n");
exit (2);
}
area1 = (unsigned long) p;
sigsegv_register (&dispatcher, (void *) area1, 0x4000, &area_handler, &area1);
if (mprotect ((void *) area1, 0x4000, PROT_NONE) < 0)
{
fprintf (stderr, "mprotect failed.\n");
exit (2);
}
p = mmap_zeromap ((void *) 0x0BEE0000, 0x4000);
if (p == (void *)(-1))
{
fprintf (stderr, "mmap_zeromap failed.\n");
exit (2);
}
area2 = (unsigned long) p;
sigsegv_register (&dispatcher, (void *) area2, 0x4000, &area_handler, &area2);
if (mprotect ((void *) area2, 0x4000, PROT_READ) < 0)
{
fprintf (stderr, "mprotect failed.\n");
exit (2);
}
if (mprotect ((void *) area2, 0x4000, PROT_READ_WRITE) < 0
|| mprotect ((void *) area2, 0x4000, PROT_READ) < 0)
{
fprintf (stderr, "mprotect failed.\n");
exit (2);
}
p = mmap_zeromap ((void *) 0x06990000, 0x4000);
if (p == (void *)(-1))
{
fprintf (stderr, "mmap_zeromap failed.\n");
exit (2);
}
area3 = (unsigned long) p;
sigsegv_register (&dispatcher, (void *) area3, 0x4000, &area_handler, &area3);
mprotect ((void *) area3, 0x4000, PROT_READ);
/* This access should call the handler. */
((volatile int *)area2)[230] = 22;
/* This access should call the handler. */
((volatile int *)area3)[412] = 33;
/* This access should not give a signal. */
((volatile int *)area2)[135] = 22;
/* This access should call the handler. */
((volatile int *)area1)[612] = 11;
barrier();
/* Check that the handler was called three times. */
if (logcount != 3)
exit (1);
if (!(logdata[0] == area2 && logdata[1] == area3 && logdata[2] == area1))
exit (1);
printf ("Test passed.\n");
return 0;
}
#else
int
main ()
{
return 77;
}
#endif
|
/* Copyright (C) 1992, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU 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 <stddef.h>
#include <sysv_termio.h>
#include <termios.h>
#include <sys/ioctl.h>
/* Put the state of FD into *TERMIOS_P. */
int
__tcgetattr (fd, termios_p)
int fd;
struct termios *termios_p;
{
struct __sysv_termio buf;
if (termios_p == NULL)
{
__set_errno (EINVAL);
return -1;
}
if (__ioctl (fd, _TCGETA, &buf) < 0)
return -1;
termios_p->c_cflag &= ~0x000f0000;
termios_p->c_cflag |= (termios_p->c_cflag & 0xf) << 16;
termios_p->c_iflag = 0;
if (buf.c_iflag & _SYSV_IGNBRK)
termios_p->c_iflag |= IGNBRK;
if (buf.c_iflag & _SYSV_BRKINT)
termios_p->c_iflag |= BRKINT;
if (buf.c_iflag & _SYSV_IGNPAR)
termios_p->c_iflag |= IGNPAR;
if (buf.c_iflag & _SYSV_PARMRK)
termios_p->c_iflag |= PARMRK;
if (buf.c_iflag & _SYSV_INPCK)
termios_p->c_iflag |= INPCK;
if (buf.c_iflag & _SYSV_ISTRIP)
termios_p->c_iflag |= ISTRIP;
if (buf.c_iflag & _SYSV_INLCR)
termios_p->c_iflag |= INLCR;
if (buf.c_iflag & _SYSV_IGNCR)
termios_p->c_iflag |= IGNCR;
if (buf.c_iflag & _SYSV_ICRNL)
termios_p->c_iflag |= ICRNL;
if (buf.c_iflag & _SYSV_IXON)
termios_p->c_iflag |= IXON;
if (buf.c_iflag & _SYSV_IXOFF)
termios_p->c_iflag |= IXOFF;
if (buf.c_iflag & _SYSV_IXANY)
termios_p->c_iflag |= IXANY;
if (buf.c_iflag & _SYSV_IMAXBEL)
termios_p->c_iflag |= IMAXBEL;
termios_p->c_oflag = 0;
if (buf.c_oflag & OPOST)
termios_p->c_oflag |= OPOST;
if (buf.c_oflag & ONLCR)
termios_p->c_oflag |= ONLCR;
termios_p->c_cflag = 0;
switch (buf.c_cflag & _SYSV_CSIZE)
{
case _SYSV_CS5:
termios_p->c_cflag |= CS5;
break;
case _SYSV_CS6:
termios_p->c_cflag |= CS6;
break;
case _SYSV_CS7:
termios_p->c_cflag |= CS7;
break;
case _SYSV_CS8:
termios_p->c_cflag |= CS8;
break;
}
if (buf.c_cflag & _SYSV_CSTOPB)
termios_p->c_cflag |= CSTOPB;
if (buf.c_cflag & _SYSV_CREAD)
termios_p->c_cflag |= CREAD;
if (buf.c_cflag & _SYSV_PARENB)
termios_p->c_cflag |= PARENB;
if (buf.c_cflag & _SYSV_PARODD)
termios_p->c_cflag |= PARODD;
if (buf.c_cflag & _SYSV_HUPCL)
termios_p->c_cflag |= HUPCL;
if (buf.c_cflag & _SYSV_CLOCAL)
termios_p->c_cflag |= CLOCAL;
termios_p->c_lflag = 0;
if (buf.c_lflag & _SYSV_ISIG)
termios_p->c_lflag |= ISIG;
if (buf.c_lflag & _SYSV_ICANON)
termios_p->c_lflag |= ICANON;
if (buf.c_lflag & _SYSV_ECHO)
termios_p->c_lflag |= ECHO;
if (buf.c_lflag & _SYSV_ECHOE)
termios_p->c_lflag |= ECHOE;
if (buf.c_lflag & _SYSV_ECHOK)
termios_p->c_lflag |= ECHOK;
if (buf.c_lflag & _SYSV_ECHONL)
termios_p->c_lflag |= ECHONL;
if (buf.c_lflag & _SYSV_NOFLSH)
termios_p->c_lflag |= NOFLSH;
if (buf.c_lflag & _SYSV_TOSTOP)
termios_p->c_lflag |= TOSTOP;
if (buf.c_lflag & _SYSV_ECHOKE)
termios_p->c_lflag |= ECHOKE;
if (buf.c_lflag & _SYSV_ECHOPRT)
termios_p->c_lflag |= ECHOPRT;
if (buf.c_lflag & _SYSV_ECHOCTL)
termios_p->c_lflag |= ECHOCTL;
if (buf.c_lflag & _SYSV_FLUSHO)
termios_p->c_lflag |= FLUSHO;
if (buf.c_lflag & _SYSV_PENDIN)
termios_p->c_lflag |= PENDIN;
if (buf.c_lflag & _SYSV_IEXTEN)
termios_p->c_lflag |= IEXTEN;
termios_p->c_cc[VEOF] = buf.c_cc[_SYSV_VEOF];
termios_p->c_cc[VEOL] = buf.c_cc[_SYSV_VEOL];
termios_p->c_cc[VEOL2] = buf.c_cc[_SYSV_VEOL2];
termios_p->c_cc[VERASE] = buf.c_cc[_SYSV_VERASE];
termios_p->c_cc[VKILL] = buf.c_cc[_SYSV_VKILL];
termios_p->c_cc[VINTR] = buf.c_cc[_SYSV_VINTR];
termios_p->c_cc[VQUIT] = buf.c_cc[_SYSV_VQUIT];
termios_p->c_cc[VSTART] = '\021'; /* XON (^Q). */
termios_p->c_cc[VSTOP] = '\023'; /* XOFF (^S). */
termios_p->c_cc[VSUSP] = '\0'; /* System V release 3 lacks job control. */
termios_p->c_cc[VMIN] = buf.c_cc[_SYSV_VMIN];
termios_p->c_cc[VTIME] = buf.c_cc[_SYSV_VTIME];
return 0;
}
weak_alias (__tcgetattr, tcgetattr)
|
/*
* Copyright 2001-2007 Adrian Thurston <thurston@complang.org>
*/
/* This file is part of Ragel.
*
* Ragel 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.
*
* Ragel 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 Ragel; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _RAGEL_H
#define _RAGEL_H
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "vector.h"
#include "config.h"
#include "common.h"
#define PROGNAME "ragel"
/* Target output style. */
enum CodeStyle
{
GenTables,
GenFTables,
GenFlat,
GenFFlat,
GenGoto,
GenFGoto,
GenIpGoto,
GenSplit
};
/* To what degree are machine minimized. */
enum MinimizeLevel {
MinimizeApprox,
MinimizeStable,
MinimizePartition1,
MinimizePartition2
};
enum MinimizeOpt {
MinimizeNone,
MinimizeEnd,
MinimizeMostOps,
MinimizeEveryOp
};
/* Target implementation */
enum RubyImplEnum
{
MRI,
Rubinius
};
/* Options. */
extern MinimizeLevel minimizeLevel;
extern MinimizeOpt minimizeOpt;
extern const char *machineSpec, *machineName;
extern bool printStatistics;
extern bool wantDupsRemoved;
extern RubyImplEnum rubyImpl;
extern bool generateXML;
extern bool generateDot;
/* Error reporting format. */
enum ErrorFormat {
ErrorFormatGNU,
ErrorFormatMSVC,
};
extern ErrorFormat errorFormat;
extern int gblErrorCount;
extern char mainMachine[];
InputLoc makeInputLoc( const char *fileName, int line = 0, int col = 0 );
std::ostream &operator<<( std::ostream &out, const InputLoc &loc );
/* Error reporting. */
std::ostream &error();
std::ostream &error( const InputLoc &loc );
std::ostream &warning( const InputLoc &loc );
struct XmlParser;
void xmlEscapeHost( std::ostream &out, char *data, long len );
extern CodeStyle codeStyle;
/* IO filenames and stream. */
extern bool displayPrintables;
extern int gblErrorCount;
/* Options. */
extern int numSplitPartitions;
extern bool noLineDirectives;
extern long maxTransitions;
std::ostream &error();
/* Target language and output style. */
extern CodeStyle codeStyle;
extern int numSplitPartitions;
extern bool noLineDirectives;
#endif
|
#ifndef GDFONTMB_H
#define GDFONTMB_H 1
/* gdfontmb.h: brings in the middle of the provided fonts.
Also link with gdfonth.c. */
#include "gd.h"
/* 7x13B font derived from a public domain font in the X
distribution. Contains the 127 standard ascii characters. */
extern gdFontPtr gdFontMediumBold;
#endif
|
/*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2010 Sourcefire, Inc.
* Authors: aCaB <acab@clamav.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#ifndef __INTERFACE_H
#define __INTERFACE_H
BOOL interface_setup(void);
void msg_callback(enum cl_msg severity, const char *fullmsg, const char *msg, void *ctx);
#endif
|
/*****************************************************************************
* mc.h: h264 encoder library
*****************************************************************************
* Copyright (C) 2003 Laurent Aimar
* $Id: pixel.h,v 1.1 2004/06/03 19:27:07 fenrir Exp $
*
* Authors: Eric Petit <titer@m0k.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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, USA.
*****************************************************************************/
#ifndef _PPC_PIXEL_H
#define _PPC_PIXEL_H 1
void x264_pixel_altivec_init( x264_pixel_function_t *pixf );
#endif
|
/* "$Id: $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2003 by O'ksi'D.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
/*
* Unicode to UTF-8 conversion functions.
*/
#if !defined(WIN32) && !defined(__APPLE__)
#include "../../FL/Xutf8.h"
/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/
/*
* Converts the first char of the UTF-8 string to an Unicode value
* Returns the byte length of the converted UTF-8 char
* Returns -1 if the UTF-8 string is not valid
*/
int
XConvertUtf8ToUcs(const unsigned char *buf,
int len,
unsigned int *ucs) {
if (buf[0] & 0x80) {
if (buf[0] & 0x40) {
if (buf[0] & 0x20) {
if (buf[0] & 0x10) {
if (buf[0] & 0x08) {
if (buf[0] & 0x04) {
if (buf[0] & 0x02) {
/* bad UTF-8 string */
} else {
/* 0x04000000 - 0x7FFFFFFF */
}
} else if (len > 4
&& (buf[1] & 0xC0) == 0x80
&& (buf[2] & 0xC0) == 0x80
&& (buf[3] & 0xC0) == 0x80
&& (buf[4] & 0xC0) == 0x80) {
/* 0x00200000 - 0x03FFFFFF */
*ucs = ((buf[0] & ~0xF8) << 24) +
((buf[1] & ~0x80) << 18) +
((buf[2] & ~0x80) << 12) +
((buf[3] & ~0x80) << 6) +
(buf[4] & ~0x80);
if (*ucs > 0x001FFFFF && *ucs < 0x01000000) return 5;
}
} else if (len > 3
&& (buf[1] & 0xC0) == 0x80
&& (buf[2] & 0xC0) == 0x80
&& (buf[3] & 0xC0) == 0x80) {
/* 0x00010000 - 0x001FFFFF */
*ucs = ((buf[0] & ~0xF0) << 18) +
((buf[1] & ~0x80) << 12) +
((buf[2] & ~0x80) << 6) +
(buf[3] & ~0x80);
if (*ucs > 0x0000FFFF) return 4;
}
} else if (len > 2
&& (buf[1] & 0xC0) == 0x80
&& (buf[2] & 0xC0) == 0x80) {
/* 0x00000800 - 0x0000FFFF */
*ucs = ((buf[0] & ~0xE0) << 12) +
((buf[1] & ~0x80) << 6) +
(buf[2] & ~0x80);
if (*ucs > 0x000007FF) return 3;
}
} else if (len > 1 && (buf[1] & 0xC0) == 0x80) {
/* 0x00000080 - 0x000007FF */
*ucs = ((buf[0] & ~0xC0) << 6) +
(buf[1] & ~0x80);
if (*ucs > 0x0000007F) return 2;
}
}
} else if (len > 0) {
/* 0x00000000 - 0x0000007F */
*ucs = buf[0];
return 1;
}
*ucs = (unsigned int) '?'; /* bad utf-8 string */
return -1;
}
/*
* Converts an Unicode value to an UTF-8 string
* NOTE : the buffer (buf) must be at least 5 bytes long !!!
*/
int
XConvertUcsToUtf8(unsigned int ucs,
char *buf) {
if (ucs < 0x000080) {
buf[0] = ucs;
return 1;
} else if (ucs < 0x000800) {
buf[0] = 0xC0 | (ucs >> 6);
buf[1] = 0x80 | (ucs & 0x3F);
return 2;
} else if (ucs < 0x010000) {
buf[0] = 0xE0 | (ucs >> 12);
buf[1] = 0x80 | ((ucs >> 6) & 0x3F);
buf[2] = 0x80 | (ucs & 0x3F);
return 3;
} else if (ucs < 0x00200000) {
buf[0] = 0xF0 | (ucs >> 18);
buf[1] = 0x80 | ((ucs >> 12) & 0x3F);
buf[2] = 0x80 | ((ucs >> 6) & 0x3F);
buf[3] = 0x80 | (ucs & 0x3F);
return 4;
} else if (ucs < 0x01000000) {
buf[0] = 0xF8 | (ucs >> 24);
buf[1] = 0x80 | ((ucs >> 18) & 0x3F);
buf[2] = 0x80 | ((ucs >> 12) & 0x3F);
buf[3] = 0x80 | ((ucs >> 6) & 0x3F);
buf[4] = 0x80 | (ucs & 0x3F);
return 5;
}
buf[0] = '?';
return -1;
}
/*
* returns the byte length of the first UTF-8 char
* (returns -1 if not valid)
*/
int
XUtf8CharByteLen(const unsigned char *buf,
int len) {
unsigned int ucs;
return XConvertUtf8ToUcs(buf, len, &ucs);
}
/*
* returns the quantity of Unicode chars in the UTF-8 string
*/
int
XCountUtf8Char(const unsigned char *buf,
int len) {
int i = 0;
int nbc = 0;
while (i < len) {
int cl = XUtf8CharByteLen(buf + i, len - i);
if (cl < 1) cl = 1;
nbc++;
i += cl;
}
return nbc;
}
/*
* Same as XConvertUtf8ToUcs but no sanity check is done.
*/
int
XFastConvertUtf8ToUcs(const unsigned char *buf,
int len,
unsigned int *ucs) {
if (buf[0] & 0x80) {
if (buf[0] & 0x40) {
if (buf[0] & 0x20) {
if (buf[0] & 0x10) {
if (buf[0] & 0x08) {
if (buf[0] & 0x04) {
if (buf[0] & 0x02) {
/* bad UTF-8 string */
} else {
/* 0x04000000 - 0x7FFFFFFF */
}
} else if (len > 4) {
/* 0x00200000 - 0x03FFFFFF */
*ucs = ((buf[0] & ~0xF8) << 24) +
((buf[1] & ~0x80) << 18) +
((buf[2] & ~0x80) << 12) +
((buf[3] & ~0x80) << 6) +
(buf[4] & ~0x80);
return 5;
}
} else if (len > 3) {
/* 0x00010000 - 0x001FFFFF */
*ucs = ((buf[0] & ~0xF0) << 18) +
((buf[1] & ~0x80) << 12) +
((buf[2] & ~0x80) << 6) +
(buf[3] & ~0x80);
return 4;
}
} else if (len > 2) {
/* 0x00000800 - 0x0000FFFF */
*ucs = ((buf[0] & ~0xE0) << 12) +
((buf[1] & ~0x80) << 6) +
(buf[2] & ~0x80);
return 3;
}
} else if (len > 1) {
/* 0x00000080 - 0x000007FF */
*ucs = ((buf[0] & ~0xC0) << 6) +
(buf[1] & ~0x80);
return 2;
}
}
} else if (len > 0) {
/* 0x00000000 - 0x0000007F */
*ucs = buf[0];
return 1;
}
*ucs = (unsigned int) '?'; /* bad utf-8 string */
return -1;
}
#endif /* X11 only */
/*
* End of "$Id: $".
*/
|
/*
** Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved.
** Copyright (C) 2003-2013 Sourcefire, Inc.
**
** Brian Caswell <bmc@snort.org>
**
** 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. You may not use, modify or
** distribute this program under any other version of the GNU General
** Public 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.
*/
/* $Id$ */
#ifndef __SP_ISDATAAT_H__
#define __SP_ISDATAAT_H__
#define ISDATAAT_RELATIVE_FLAG 0x01
#define ISDATAAT_RAWBYTES_FLAG 0x02
#define ISDATAAT_NOT_FLAG 0x04
typedef struct _IsDataAtData
{
uint32_t offset; /* byte location into the packet */
uint8_t flags; /* relative to the doe_ptr? */
/* rawbytes buffer? */
int8_t offset_var; /* index of byte_extract variable for offset */
} IsDataAtData;
void SetupIsDataAt(void);
uint32_t IsDataAtHash(void *d);
int IsDataAtCompare(void *l, void *r);
#endif /* __SP_ISDATAAT_H__ */
|
/*
* Description:
* Helper functions to support the tegra USB controller
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/fsl_devices.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <mach/usb_phy.h>
static struct tegra_usb_phy *phy;
static struct clk *udc_clk;
static struct clk *emc_clk;
static struct clk *sclk_clk;
static void *udc_base;
int fsl_udc_clk_init(struct platform_device *pdev)
{
struct resource *res;
int err;
int instance;
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
udc_clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(udc_clk)) {
dev_err(&pdev->dev, "Can't get udc clock\n");
return PTR_ERR(udc_clk);
}
clk_enable(udc_clk);
sclk_clk = clk_get(&pdev->dev, "sclk");
if (IS_ERR(sclk_clk)) {
dev_err(&pdev->dev, "Can't get sclk clock\n");
err = PTR_ERR(sclk_clk);
goto err_sclk;
}
clk_set_rate(sclk_clk, 80000000);
clk_enable(sclk_clk);
emc_clk = clk_get(&pdev->dev, "emc");
if (IS_ERR(emc_clk)) {
dev_err(&pdev->dev, "Can't get emc clock\n");
err = PTR_ERR(emc_clk);
goto err_emc;
}
clk_enable(emc_clk);
clk_set_rate(emc_clk, 400000000);
/* we have to remap the registers ourselves as fsl_udc does not
* export them for us.
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
err = -ENXIO;
goto err0;
}
udc_base = ioremap(res->start, resource_size(res));
if (!udc_base) {
err = -ENOMEM;
goto err0;
}
instance = pdev->id;
if (instance == -1)
instance = 0;
phy = tegra_usb_phy_open(instance, udc_base, pdata->phy_config,
TEGRA_USB_PHY_MODE_DEVICE);
if (IS_ERR(phy)) {
dev_err(&pdev->dev, "Can't open phy\n");
err = PTR_ERR(phy);
goto err1;
}
tegra_usb_phy_power_on(phy);
return 0;
err1:
iounmap(udc_base);
err0:
clk_disable(emc_clk);
clk_put(emc_clk);
err_emc:
clk_disable(sclk_clk);
clk_put(sclk_clk);
err_sclk:
clk_disable(udc_clk);
clk_put(udc_clk);
return err;
}
void fsl_udc_clk_finalize(struct platform_device *pdev)
{
}
void fsl_udc_clk_release(void)
{
tegra_usb_phy_close(phy);
iounmap(udc_base);
clk_disable(udc_clk);
clk_put(udc_clk);
clk_disable(sclk_clk);
clk_put(sclk_clk);
clk_disable(emc_clk);
clk_put(emc_clk);
}
void fsl_udc_clk_suspend(void)
{
tegra_usb_phy_power_off(phy);
clk_disable(udc_clk);
clk_disable(sclk_clk);
clk_disable(emc_clk);
}
void fsl_udc_clk_resume(void)
{
clk_enable(emc_clk);
clk_enable(sclk_clk);
clk_enable(udc_clk);
tegra_usb_phy_power_on(phy);
}
|
/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <sys/types.h>
/* Seek to OFFSET on FD, starting from WHENCE. */
off_t
__libc_lseek (int fd, off_t offset, int whence)
{
return __libc_lseek64 (fd, (off64_t) offset, whence);
}
weak_alias (__libc_lseek, __lseek)
libc_hidden_def (__lseek)
weak_alias (__libc_lseek, lseek)
|
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/display-sys.h>
#include <linux/interrupt.h>
#include "rk_hdmi.h"
static int hdmi_get_enable(struct rk_display_device *device)
{
struct hdmi *hdmi = device->priv_data;
int enable;
enable = hdmi->enable;
return enable;
}
static int hdmi_set_enable(struct rk_display_device *device, int enable)
{
struct hdmi *hdmi = device->priv_data;
if(enable == 0) {
hdmi_submit_work(hdmi, HDMI_DISABLE_CTL, 0, NULL);
}
else {
hdmi_submit_work(hdmi, HDMI_ENABLE_CTL, 0, NULL);
}
return 0;
}
static int hdmi_get_status(struct rk_display_device *device)
{
struct hdmi *hdmi = device->priv_data;
if(hdmi->hotplug == HDMI_HPD_ACTIVED)
return 1;
else
return 0;
}
static int hdmi_get_modelist(struct rk_display_device *device, struct list_head **modelist)
{
struct hdmi *hdmi = device->priv_data;
mutex_lock(&hdmi->lock);
*modelist = &hdmi->edid.modelist;
mutex_unlock(&hdmi->lock);
return 0;
}
static int hdmi_set_mode(struct rk_display_device *device, struct fb_videomode *mode)
{
struct hdmi *hdmi = device->priv_data;
int vic = hdmi_videomode_to_vic(mode);
hdmi->autoset = 0;
if(vic && hdmi->vic != vic)
{
hdmi->vic = vic;
if(hdmi->hotplug == HDMI_HPD_ACTIVED)
hdmi_submit_work(hdmi, HDMI_SET_VIDEO, 0, NULL);
}
return 0;
}
static int hdmi_get_mode(struct rk_display_device *device, struct fb_videomode *mode)
{
struct hdmi *hdmi = device->priv_data;
struct fb_videomode *vmode;
vmode = (struct fb_videomode*) hdmi_vic_to_videomode(hdmi->vic);
if(unlikely(vmode == NULL))
return -1;
*mode = *vmode;
return 0;
}
static int hdmi_set_scale(struct rk_display_device *device, int direction, int value)
{
struct hdmi *hdmi = device->priv_data;
if(!hdmi || value < 0 || value > 100)
return -1;
if(direction == DISPLAY_SCALE_X)
hdmi->xscale = value;
else if(direction == DISPLAY_SCALE_Y)
hdmi->yscale = value;
else
return -1;
// rk_fb_disp_scale(hdmi->xscale, hdmi->yscale, HDMI_SOURCE_DEFAULT);
return 0;
}
static int hdmi_get_scale(struct rk_display_device *device, int direction)
{
struct hdmi *hdmi = device->priv_data;
if(!hdmi)
return -1;
if(direction == DISPLAY_SCALE_X)
return hdmi->xscale;
else if(direction == DISPLAY_SCALE_Y)
return hdmi->yscale;
else
return -1;
}
static int hdmi_set_3dmode(struct rk_display_device *device, int mode)
{
struct hdmi *hdmi = device->priv_data;
struct list_head *modelist, *pos;
struct display_modelist *display_modelist = NULL;
if(!hdmi)
return -1;
modelist = &hdmi->edid.modelist;
list_for_each(pos, modelist) {
display_modelist = list_entry(pos, struct display_modelist, list);
if(hdmi->vic == display_modelist->vic)
break;
else
display_modelist = NULL;
}
if(!display_modelist)
return -1;
if( (mode != HDMI_3D_NONE) && ((display_modelist->format_3d & ( 1 << mode)) == 0 ))
return -1;
if(hdmi->mode_3d != mode)
{
hdmi->mode_3d = mode;
if(hdmi->hotplug == HDMI_HPD_ACTIVED) {
hdmi_submit_work(hdmi, HDMI_SET_3D, 0, NULL);
}
}
return 0;
}
static int hdmi_get_3dmode(struct rk_display_device *device)
{
struct hdmi *hdmi = device->priv_data;
if(!hdmi)
return -1;
else
return hdmi->mode_3d;
}
//CEA 861-E: Audio Coding Type
//sync width enum hdmi_audio_type
static const char* const sAudioFormatStr[] = {
"",
"LPCM", //HDMI_AUDIO_LPCM = 1,
"AC3", //HDMI_AUDIO_AC3,
"MPEG1", //HDMI_AUDIO_MPEG1,
"MP3", //HDMI_AUDIO_MP3,
"MPEG2", //HDMI_AUDIO_MPEG2,
"AAC-LC", //HDMI_AUDIO_AAC_LC, //AAC
"DTS", //HDMI_AUDIO_DTS,
"ATARC", //HDMI_AUDIO_ATARC,
"DSD", //HDMI_AUDIO_DSD, //One bit Audio
"E-AC3", //HDMI_AUDIO_E_AC3,
"DTS-HD", //HDMI_AUDIO_DTS_HD,
"MLP", //HDMI_AUDIO_MLP,
"DST", //HDMI_AUDIO_DST,
"WMA-PRO", //HDMI_AUDIO_WMA_PRO
};
static int hdmi_get_edidaudioinfo(struct rk_display_device *device, char *audioinfo, int len)
{
struct hdmi *hdmi = device->priv_data;
int i=0;
int size=0;
struct hdmi_audio *audio;
if(!hdmi)
return -1;
memset(audioinfo, 0x00, len);
mutex_lock(&hdmi->lock);
//printk("hdmi:edid: audio_num: %d\n", hdmi->edid.audio_num);
for(i = 0; i < hdmi->edid.audio_num; i++)
{
audio = &(hdmi->edid.audio[i]);
if(audio->type<1 || audio->type>HDMI_AUDIO_WMA_PRO){
printk("audio type: unsupported.");
continue;
}
size = strlen(sAudioFormatStr[audio->type]);
//printk("size: %d, type: %s\n", size, sAudioFormatStr[audio->type]);
memcpy(audioinfo, sAudioFormatStr[audio->type], size);
audioinfo[size]=',';
audioinfo += (size+1);
}
mutex_unlock(&hdmi->lock);
return 0;
}
static struct rk_display_ops hdmi_display_ops = {
.setenable = hdmi_set_enable,
.getenable = hdmi_get_enable,
.getstatus = hdmi_get_status,
.getmodelist = hdmi_get_modelist,
.setmode = hdmi_set_mode,
.getmode = hdmi_get_mode,
.setscale = hdmi_set_scale,
.getscale = hdmi_get_scale,
.set3dmode = hdmi_set_3dmode,
.get3dmode = hdmi_get_3dmode,
.getedidaudioinfo = hdmi_get_edidaudioinfo,
};
static int hdmi_display_probe(struct rk_display_device *device, void *devdata)
{
struct hdmi *hdmi = devdata;
device->owner = THIS_MODULE;
strcpy(device->type, "HDMI");
device->priority = DISPLAY_PRIORITY_HDMI;
device->name = hdmi->property->name;
device->property = hdmi->property->display;
device->priv_data = devdata;
device->ops = &hdmi_display_ops;
return 1;
}
static struct rk_display_driver display_hdmi = {
.probe = hdmi_display_probe,
};
struct rk_display_device* hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent)
{
return rk_display_device_register(&display_hdmi, parent, hdmi);
}
void hdmi_unregister_display_sysfs(struct hdmi *hdmi)
{
if(hdmi->ddev)
rk_display_device_unregister(hdmi->ddev);
}
|
/********************************************************************\
* 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, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
/* $Id: commandline.h 901 2006-01-17 18:58:13Z mina $ */
/** @file commandline.h
@brief Command line argument handling
@author Copyright (C) 2004 Philippe April <papril777@yahoo.com>
*/
#ifndef _COMMANDLINE_H_
#define _COMMANDLINE_H_
/** @brief Parses the command line and set the config accordingly */
void parse_commandline(int, char**);
#endif /* _COMMANDLINE_H_ */
|
#pragma once
#include <array>
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include "common/common_types.h"
#include "common/file_util.h"
namespace FileSys {
/**
* Interface for reading RomFS data.
*/
class RomFSReader {
public:
virtual ~RomFSReader() = default;
virtual std::size_t GetSize() const = 0;
virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {}
friend class boost::serialization::access;
};
/**
* A RomFS reader that directly reads the RomFS file.
*/
class DirectRomFSReader : public RomFSReader {
public:
DirectRomFSReader(FileUtil::IOFile&& file, std::size_t file_offset, std::size_t data_size)
: is_encrypted(false), file(std::move(file)), file_offset(file_offset),
data_size(data_size) {}
DirectRomFSReader(FileUtil::IOFile&& file, std::size_t file_offset, std::size_t data_size,
const std::array<u8, 16>& key, const std::array<u8, 16>& ctr,
std::size_t crypto_offset)
: is_encrypted(true), file(std::move(file)), key(key), ctr(ctr), file_offset(file_offset),
crypto_offset(crypto_offset), data_size(data_size) {}
~DirectRomFSReader() override = default;
std::size_t GetSize() const override {
return data_size;
}
std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) override;
private:
bool is_encrypted;
FileUtil::IOFile file;
std::array<u8, 16> key;
std::array<u8, 16> ctr;
u64 file_offset;
u64 crypto_offset;
u64 data_size;
DirectRomFSReader() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<RomFSReader>(*this);
ar& is_encrypted;
ar& file;
ar& key;
ar& ctr;
ar& file_offset;
ar& crypto_offset;
ar& data_size;
}
friend class boost::serialization::access;
};
} // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::DirectRomFSReader)
|
/*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would 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 the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void frag_init(void);
|
#ifndef __ASM_ARM_EXEC_H
#define __ASM_ARM_EXEC_H
/* exception vector addresses */
#define EXC_OFF_RESET 0x00 /* reset */
#define EXC_OFF_UNDEF 0x04 /* undefined instruction */
#define EXC_OFF_SWI 0x08 /* software interrupt */
#define EXC_OFF_PREFETCH 0x0c /* prefetch abort */
#define EXC_OFF_DATA 0x10 /* data abort */
#define EXC_OFF_IRQ 0x18 /* interrupt */
#define EXC_OFF_FIQ 0x1C /* fast interrupt */
#define arch_align_stack(x) (x)
#endif /* __ASM_ARM_EXEC_H */
|
/*
* tgafile.h - this file contains defines and structures for tgafile.c
*
* $Id: tgafile.h,v 1.9 2003/08/22 05:05:12 johns Exp $
*/
/* declare other functions */
int createtgafile(char *, unsigned short, unsigned short);
void * opentgafile(char *);
void writetgaregion(void *, int, int, int, int, unsigned char *);
void closetgafile(void *);
int readtga(char * name, int * xres, int * yres, unsigned char **imgdata);
int writetga(char * name, int xres, int yres, unsigned char *imgdata);
|
/* Do not edit: automatically built by gen_msg.awk. */
#ifndef __repmgr_AUTOMSG_H
#define __repmgr_AUTOMSG_H
/*
* Message sizes are simply the sum of field sizes (not
* counting variable size parts, when DBTs are present),
* and may be different from struct sizes due to padding.
*/
#define __REPMGR_HANDSHAKE_SIZE 12
typedef struct ___repmgr_handshake_args {
u_int16_t port;
u_int16_t alignment;
u_int32_t ack_policy;
u_int32_t flags;
} __repmgr_handshake_args;
#define __REPMGR_V3HANDSHAKE_SIZE 10
typedef struct ___repmgr_v3handshake_args {
u_int16_t port;
u_int32_t priority;
u_int32_t flags;
} __repmgr_v3handshake_args;
#define __REPMGR_V2HANDSHAKE_SIZE 6
typedef struct ___repmgr_v2handshake_args {
u_int16_t port;
u_int32_t priority;
} __repmgr_v2handshake_args;
#define __REPMGR_PARM_REFRESH_SIZE 8
typedef struct ___repmgr_parm_refresh_args {
u_int32_t ack_policy;
u_int32_t flags;
} __repmgr_parm_refresh_args;
#define __REPMGR_PERMLSN_SIZE 12
typedef struct ___repmgr_permlsn_args {
u_int32_t generation;
DB_LSN lsn;
} __repmgr_permlsn_args;
#define __REPMGR_VERSION_PROPOSAL_SIZE 8
typedef struct ___repmgr_version_proposal_args {
u_int32_t min;
u_int32_t max;
} __repmgr_version_proposal_args;
#define __REPMGR_VERSION_CONFIRMATION_SIZE 4
typedef struct ___repmgr_version_confirmation_args {
u_int32_t version;
} __repmgr_version_confirmation_args;
#define __REPMGR_MSG_HDR_SIZE 9
typedef struct ___repmgr_msg_hdr_args {
u_int8_t type;
u_int32_t word1;
u_int32_t word2;
} __repmgr_msg_hdr_args;
#define __REPMGR_MSG_METADATA_SIZE 12
typedef struct ___repmgr_msg_metadata_args {
u_int32_t tag;
u_int32_t limit;
u_int32_t flags;
} __repmgr_msg_metadata_args;
#define __REPMGR_MEMBERSHIP_KEY_SIZE 6
typedef struct ___repmgr_membership_key_args {
DBT host;
u_int16_t port;
} __repmgr_membership_key_args;
#define __REPMGR_MEMBERSHIP_DATA_SIZE 8
typedef struct ___repmgr_membership_data_args {
u_int32_t status;
u_int32_t flags;
} __repmgr_membership_data_args;
#define __REPMGR_V4MEMBERSHIP_DATA_SIZE 4
typedef struct ___repmgr_v4membership_data_args {
u_int32_t flags;
} __repmgr_v4membership_data_args;
#define __REPMGR_MEMBER_METADATA_SIZE 8
typedef struct ___repmgr_member_metadata_args {
u_int32_t format;
u_int32_t version;
} __repmgr_member_metadata_args;
#define __REPMGR_GM_FWD_SIZE 10
typedef struct ___repmgr_gm_fwd_args {
DBT host;
u_int16_t port;
u_int32_t gen;
} __repmgr_gm_fwd_args;
#define __REPMGR_MEMBR_VERS_SIZE 8
typedef struct ___repmgr_membr_vers_args {
u_int32_t version;
u_int32_t gen;
} __repmgr_membr_vers_args;
#define __REPMGR_SITE_INFO_SIZE 14
typedef struct ___repmgr_site_info_args {
DBT host;
u_int16_t port;
u_int32_t status;
u_int32_t flags;
} __repmgr_site_info_args;
#define __REPMGR_V4SITE_INFO_SIZE 10
typedef struct ___repmgr_v4site_info_args {
DBT host;
u_int16_t port;
u_int32_t flags;
} __repmgr_v4site_info_args;
#define __REPMGR_CONNECT_REJECT_SIZE 12
typedef struct ___repmgr_connect_reject_args {
u_int32_t version;
u_int32_t gen;
u_int32_t status;
} __repmgr_connect_reject_args;
#define __REPMGR_V4CONNECT_REJECT_SIZE 8
typedef struct ___repmgr_v4connect_reject_args {
u_int32_t version;
u_int32_t gen;
} __repmgr_v4connect_reject_args;
#define __REPMGR_LSNHIST_MATCH_SIZE 24
typedef struct ___repmgr_lsnhist_match_args {
DB_LSN lsn;
u_int32_t hist_sec;
u_int32_t hist_nsec;
DB_LSN next_gen_lsn;
} __repmgr_lsnhist_match_args;
#define __REPMGR_MAXMSG_SIZE 24
#endif
|
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// @file CompressedRawReader.h
/// @author Sean Murray
/// @brief compressed raw reader, this is the part that parses the raw data
// after it is compressed on the flp in the compressor, effectively a decompressor.
// Data format is simply an event based vector of tracklet64, and the event header is
// a custom 64 bit "tracklet" with even info and an offset to the next header (blocksize)
#ifndef O2_TRD_COMPRESSEDRAWREADER
#define O2_TRD_COMPRESSEDRAWREADER
#include <fstream>
#include <string>
#include <cstdint>
#include <array>
#include <bitset>
#include "Headers/RAWDataHeader.h"
#include "Headers/RDHAny.h"
#include "DetectorsRaw/RDHUtils.h"
#include "DataFormatsTRD/CompressedDigit.h"
#include "DataFormatsTRD/RawData.h"
#include "DataFormatsTRD/Tracklet64.h"
#include "DataFormatsTRD/TriggerRecord.h"
#include "DataFormatsTRD/Digit.h"
#include "DataFormatsTRD/RawDataStats.h"
namespace o2
{
namespace trd
{
class CompressedRawReader
{
static constexpr bool debugparsing = true;
enum CRUSate { CompressedStateHeader,
CompressedStateTracklets,
CompressedStatePadding };
public:
CompressedRawReader() = default;
~CompressedRawReader() = default;
inline bool run()
{
rewind();
uint32_t dowhilecount = 0;
do {
int datareadfromhbf = processHBFs();
} while (mDataReadIn < mDataBufferSize);
return false;
};
void checkSummary();
void resetCounters();
void setDataBuffer(const char* val) { mDataBuffer = val; };
void setDataBufferSize(long val) { mDataBufferSize = val; };
inline uint32_t getDecoderByteCounter() const { return reinterpret_cast<const char*>(mDataPointer) - mDataBuffer; };
void setVerbose(bool v) { mVerbose = v; };
void setDataVerbose(bool v) { mDataVerbose = v; };
void setHeaderVerbose(bool v) { mHeaderVerbose = v; };
void configure(std::bitset<16> options)
{
mByteSwap = options[TRDByteSwapBit];
mVerbose = options[TRDVerboseBit];
mHeaderVerbose = options[TRDHeaderVerboseBit];
mDataVerbose = options[TRDDataVerboseBit];
}
std::vector<Tracklet64>& getTracklets() { return mEventTracklets; };
std::vector<Digit>& getDigits() { return mEventDigits; };
std::vector<CompressedDigit>& getCompressedDigits() { return mCompressedEventDigits; };
std::vector<o2::trd::TriggerRecord> getIR() { return mEventTriggers; }
protected:
uint32_t processHBFs();
bool buildCRUPayLoad();
bool processBlock();
/** decoder private functions and data members **/
inline void rewind()
{
LOG(debug) << "!!!rewinding";
mDataPointer = reinterpret_cast<const uint32_t*>(mDataBuffer);
};
int mJumpRDH = 0;
std::ifstream mDecoderFile;
const char* mDataBuffer = nullptr;
long mDataBufferSize;
uint64_t mDataReadIn = 0;
const uint32_t* mDataPointer = nullptr;
const uint32_t* mDataPointerMax = nullptr;
const uint32_t* mDataEndPointer = nullptr;
const uint32_t* mDataPointerNext = nullptr;
uint8_t mDataNextWord = 1;
uint8_t mDataNextWordStep = 2;
const o2::header::RDHAny* mDataRDH;
// no need to waste time doing the copy std::array<uint32_t,8> mCurrentCRUWord; // data for a cru comes in words of 256 bits.
uint32_t mCurrentLinkDataPosition; // count of data read for current link in units of 256 bits
uint32_t mCompressedState; // the state of what we are expecting to read currently from the data stream, *not* what we have just read.
bool mError = false;
bool mFatal = false;
uint16_t mCurrentLink; // current link within the halfcru we are parsing 0-14
uint16_t mCRUEndpoint; // the upper or lower half of the currently parsed cru 0-14 or 15-29
uint16_t mCRUID;
uint16_t mHCID;
uint16_t mFEEID; // current Fee ID working on
//pointers to the data as we read them in, again no point in copying.
/** checker private functions and data members **/
bool checkerCheck();
void checkerCheckRDH();
bool mVerbose{false};
bool mHeaderVerbose{false};
bool mDataVerbose{false};
bool mByteSwap{true};
int mState; // basic state machine for where we are in the parsing.
// we parse rdh to rdh but data is cru to cru.
uint32_t mEventCounter;
uint32_t mFatalCounter;
uint32_t mErrorCounter;
std::vector<Tracklet64> mEventTracklets; // when this runs properly it will only 6 for the flp its runnung on.
std::vector<o2::trd::TriggerRecord> mEventTriggers;
std::vector<Digit> mEventDigits;
std::vector<CompressedDigit> mCompressedEventDigits;
o2::InteractionRecord mIR;
struct TRDDataCounters_t {
std::array<uint32_t, 1080> LinkWordCounts; //units of 256bits "cru word"
std::array<uint32_t, 1080> LinkPadWordCounts; // units of 32 bits the data word size.
std::array<uint32_t, 1080> LinkFreq; //units of 256bits "cru word"
} TRDStatCounters;
/** summary data **/
};
} // namespace trd
} // namespace o2
#endif
|
/*
* File: zufallsgenerator.h
* Created on 16. Mai 2011, 17:47
*/
#ifndef ZUFALLSGENERATOR_H
#define ZUFALLSGENERATOR_H
// include(s) oder
#include <cstdio>
#include <ctime>
#include <cstdlib>
// weitere Angaben
using namespace std;
class Zufallsgenerator
{
// Attribute
// Konstruktoren
private:
Zufallsgenerator(); // von außen keine Instanzen erzeugbar
Zufallsgenerator(const Zufallsgenerator&) {} // nicht kopierbar
//Zufallsgenerator& operator=(const Zufallsgenerator&) {} // nicht zuweisbar
virtual ~Zufallsgenerator() {}
public:
static Zufallsgenerator& liefere_zufallsgenerator();
// Methoden
int liefere_ganze_zufallszahl(int min, int max) const;
double liefere_gleitkomma_zufallszahl(double min, double max) const;
};
// eventuell Deklaration
// weiterer Funktionen
#endif /* ZUFALLSGENERATOR_H */
|
/* euidaccess -- check if effective user id can access file
Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2017 Free
Software Foundation, Inc.
This file is part of the GNU C Library.
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/>. */
/* Written by David MacKenzie and Torbjorn Granlund.
Adapted for GNU C library by Roland McGrath. */
#ifndef _LIBC
# include <config.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "root-uid.h"
#if HAVE_LIBGEN_H
# include <libgen.h>
#endif
#include <errno.h>
#ifndef __set_errno
# define __set_errno(val) errno = (val)
#endif
#if defined EACCES && !defined EACCESS
# define EACCESS EACCES
#endif
#ifndef F_OK
# define F_OK 0
# define X_OK 1
# define W_OK 2
# define R_OK 4
#endif
#ifdef _LIBC
# define access __access
# define getuid __getuid
# define getgid __getgid
# define geteuid __geteuid
# define getegid __getegid
# define group_member __group_member
# define euidaccess __euidaccess
# undef stat
# define stat stat64
#endif
/* Return 0 if the user has permission of type MODE on FILE;
otherwise, return -1 and set 'errno'.
Like access, except that it uses the effective user and group
id's instead of the real ones, and it does not always check for read-only
file system, text busy, etc. */
int
euidaccess (const char *file, int mode)
{
#if HAVE_FACCESSAT /* glibc, AIX 7, Solaris 11, Cygwin 1.7 */
return faccessat (AT_FDCWD, file, mode, AT_EACCESS);
#elif defined EFF_ONLY_OK /* IRIX, OSF/1, Interix */
return access (file, mode | EFF_ONLY_OK);
#elif defined ACC_SELF /* AIX */
return accessx (file, mode, ACC_SELF);
#elif HAVE_EACCESS /* FreeBSD */
return eaccess (file, mode);
#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */
uid_t uid = getuid ();
gid_t gid = getgid ();
uid_t euid = geteuid ();
gid_t egid = getegid ();
struct stat stats;
# if HAVE_DECL_SETREGID && PREFER_NONREENTRANT_EUIDACCESS
/* Define PREFER_NONREENTRANT_EUIDACCESS if you prefer euidaccess to
return the correct result even if this would make it
nonreentrant. Define this only if your entire application is
safe even if the uid or gid might temporarily change. If your
application uses signal handlers or threads it is probably not
safe. */
if (mode == F_OK)
return stat (file, &stats);
else
{
int result;
int saved_errno;
if (uid != euid)
setreuid (euid, uid);
if (gid != egid)
setregid (egid, gid);
result = access (file, mode);
saved_errno = errno;
/* Restore them. */
if (uid != euid)
setreuid (uid, euid);
if (gid != egid)
setregid (gid, egid);
errno = saved_errno;
return result;
}
# else
/* The following code assumes the traditional Unix model, and is not
correct on systems that have ACLs or the like. However, it's
better than nothing, and it is reentrant. */
unsigned int granted;
if (uid == euid && gid == egid)
/* If we are not set-uid or set-gid, access does the same. */
return access (file, mode);
if (stat (file, &stats) != 0)
return -1;
/* The super-user can read and write any file, and execute any file
that anyone can execute. */
if (euid == ROOT_UID
&& ((mode & X_OK) == 0
|| (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
return 0;
/* Convert the mode to traditional form, clearing any bogus bits. */
if (R_OK == 4 && W_OK == 2 && X_OK == 1 && F_OK == 0)
mode &= 7;
else
mode = ((mode & R_OK ? 4 : 0)
+ (mode & W_OK ? 2 : 0)
+ (mode & X_OK ? 1 : 0));
if (mode == 0)
return 0; /* The file exists. */
/* Convert the file's permission bits to traditional form. */
if (S_IRUSR == (4 << 6) && S_IWUSR == (2 << 6) && S_IXUSR == (1 << 6)
&& S_IRGRP == (4 << 3) && S_IWGRP == (2 << 3) && S_IXGRP == (1 << 3)
&& S_IROTH == (4 << 0) && S_IWOTH == (2 << 0) && S_IXOTH == (1 << 0))
granted = stats.st_mode;
else
granted = ((stats.st_mode & S_IRUSR ? 4 << 6 : 0)
+ (stats.st_mode & S_IWUSR ? 2 << 6 : 0)
+ (stats.st_mode & S_IXUSR ? 1 << 6 : 0)
+ (stats.st_mode & S_IRGRP ? 4 << 3 : 0)
+ (stats.st_mode & S_IWGRP ? 2 << 3 : 0)
+ (stats.st_mode & S_IXGRP ? 1 << 3 : 0)
+ (stats.st_mode & S_IROTH ? 4 << 0 : 0)
+ (stats.st_mode & S_IWOTH ? 2 << 0 : 0)
+ (stats.st_mode & S_IXOTH ? 1 << 0 : 0));
if (euid == stats.st_uid)
granted >>= 6;
else if (egid == stats.st_gid || group_member (stats.st_gid))
granted >>= 3;
if ((mode & ~granted) == 0)
return 0;
__set_errno (EACCESS);
return -1;
# endif
#endif
}
#undef euidaccess
#ifdef weak_alias
weak_alias (__euidaccess, euidaccess)
#endif
#ifdef TEST
# include <error.h>
# include <stdio.h>
# include <stdlib.h>
int
main (int argc, char **argv)
{
char *file;
int mode;
int err;
if (argc < 3)
abort ();
file = argv[1];
mode = atoi (argv[2]);
err = euidaccess (file, mode);
printf ("%d\n", err);
if (err != 0)
error (0, errno, "%s", file);
exit (0);
}
#endif
|
// -*- C++ -*-
// Module: Log4CPLUS
// File: nteventlogappender.h
// Created: 4/2003
// Author: Michael CATANZARITI
//
// Copyright 2003-2009 Michael CATANZARITI
//
// 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.
/** @file */
#ifndef _LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_
#define _LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_
#include <log4cplus/config.hxx>
#include <log4cplus/appender.h>
#if defined(_WIN32)
# if ! defined (LOG4CPLUS_HAVE_NT_EVENT_LOG)
# error "Your platform does not support NT event log."
# else
namespace log4cplus {
/**
* Appends log events to NT EventLog.
*/
class LOG4CPLUS_EXPORT NTEventLogAppender : public Appender {
public:
// ctors
NTEventLogAppender(const log4cplus::tstring& server,
const log4cplus::tstring& log,
const log4cplus::tstring& source);
NTEventLogAppender(const log4cplus::helpers::Properties properties);
// dtor
virtual ~NTEventLogAppender();
// public Methods
virtual void close();
protected:
virtual void append(const spi::InternalLoggingEvent& event);
virtual WORD getEventType(const spi::InternalLoggingEvent& event);
virtual WORD getEventCategory(const spi::InternalLoggingEvent& event);
void init();
/*
* Add this source with appropriate configuration keys to the registry.
*/
void addRegistryInfo();
// Data
log4cplus::tstring server;
log4cplus::tstring log;
log4cplus::tstring source;
HANDLE hEventLog;
SID* pCurrentUserSID;
private:
// Disallow copying of instances of this class
NTEventLogAppender(const NTEventLogAppender&);
NTEventLogAppender& operator=(const NTEventLogAppender&);
};
} // end namespace log4cplus
#endif // LOG4CPLUS_HAVE_NT_EVENT_LOG
#endif // _WIN32
#endif //_LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_
|
/* *****************************************************************************
** Author(s) Identity **
********************************************************************************
** **
** Initials Name **
** ---------------------------------------------------------------------------**
** MAAN --------------- **
** **
** **
***************************************************************************** */
/* *****************************************************************************
** Revision Control History **
***************************************************************************** */
/*
* V0.0: 07.04.2015,MAAN: Initial Version
*/
#ifndef KALMAN_H_
#define KALMAN_H_
/* *****************************************************************************
** Includes **
***************************************************************************** */
/* *****************************************************************************
** Private Constant Definitions to be changed **
***************************************************************************** */
/* *****************************************************************************
** Private Macro Definitions **
***************************************************************************** */
/* *****************************************************************************
** Global Type Definitions **
***************************************************************************** */
/**
* @brief Enum to describe the possible status values, returned
* by UART APIs.
*/
typedef struct KALMAN
{
/* Kalman filter variables */
float Q_angle; /**< Process noise variance for the accelerometer */
float Q_bias; /**< Process noise variance for the gyro bias */
float R_measure; /**< Measurement noise variance - this is actually the variance of the measurement noise */
float angle; /**< The angle calculated by the Kalman filter - part of the 2x1 state vector */
float bias; /**< The gyro bias calculated by the Kalman filter - part of the 2x1 state vector */
float rate; /**< Unbiased rate calculated from the rate and the calculated bias - you have to call getAngle to update the rate */
float P[2][2]; /**< Error covariance matrix - This is a 2x2 matrix */
} KALMAN_t;
/* *****************************************************************************
** Private Type Definitions **
***************************************************************************** */
/* *****************************************************************************
** Global Function Declarations **
***************************************************************************** */
/* *****************************************************************************
** Private Function Declarations **
***************************************************************************** */
/* *****************************************************************************
** Global Constant Definitions **
***************************************************************************** */
/* *****************************************************************************
** Private Constant Definitions **
***************************************************************************** */
/* *****************************************************************************
** Global Variable Definitions **
***************************************************************************** */
/* *****************************************************************************
** Private Variable Definitions **
***************************************************************************** */
/* *****************************************************************************
** Global Function Definitions **
***************************************************************************** */
float KALMAN_getAngle(KALMAN_t *handle, float newAngle, float newRate, float dt);
void KALMAN_Init(KALMAN_t *handle, float Q_angle, float Q_bias, float R_measure);
void KALMAN_setAngle(KALMAN_t *handle, float newAngle);
float KALMAN_getRate(KALMAN_t *handle);
void KALMAN_setQangle(KALMAN_t *handle, float newQ_angle);
void KALMAN_setQbias(KALMAN_t *handle, float newQ_bias);
void KALMAN_setRmeasure(KALMAN_t *handle, float newR_measure);
float KALMAN_getQangle(KALMAN_t *handle);
float KALMAN_getQbias(KALMAN_t *handle);
float KALMAN_getRmeasure(KALMAN_t *handle);
/* *****************************************************************************
** Private Function Definitions **
***************************************************************************** */
#endif /* KALMAN_H_ */
|
/*
Morse.h - Library for Livolo wireless switches.
First version created by Sergey Chernov, October 25, 2013 for Arduino.
Ported, adapted and simplified by M. Westenberg (Dec 2013).
Released into the public domain.
*/
#ifndef Livolo_h
#define Livolo_h
#include <wiringPi.h>
class Livolo
{
public:
Livolo(unsigned char pin);
void sendButton(unsigned int remoteID, unsigned char keycode);
private:
unsigned char txPin;
int i; // just a counter
unsigned char pulse; // counter for command repeat
bool high; // pulse "sign"
void selectPulse(unsigned char inBit);
void sendPulse(unsigned char txPulse);
};
#endif
|
/* Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
do_test (void)
{
/* Count the number of entries in the password database, and fetch
data from the first and last entries. */
size_t count = 0;
struct passwd * pw;
char *first_name = NULL;
uid_t first_uid = 0;
char *last_name = NULL;
uid_t last_uid = 0;
setpwent ();
while ((pw = getpwent ()) != NULL)
{
if (first_name == NULL)
{
first_name = strdup (pw->pw_name);
if (first_name == NULL)
{
printf ("strdup: %m\n");
return 1;
}
first_uid = pw->pw_uid;
}
free (last_name);
last_name = strdup (pw->pw_name);
if (last_name == NULL)
{
printf ("strdup: %m\n");
return 1;
}
last_uid = pw->pw_uid;
++count;
}
endpwent ();
if (count == 0)
{
printf ("No entries in the password database.\n");
return 0;
}
/* Try again, this time interleaving with name-based and UID-based
lookup operations. The counts do not match if the interleaved
lookups affected the enumeration. */
size_t new_count = 0;
setpwent ();
while ((pw = getpwent ()) != NULL)
{
if (new_count == count)
{
printf ("Additional entry in the password database.\n");
return 1;
}
++new_count;
struct passwd *pw2 = getpwnam (first_name);
if (pw2 == NULL)
{
printf ("getpwnam (%s) failed: %m\n", first_name);
return 1;
}
pw2 = getpwnam (last_name);
if (pw2 == NULL)
{
printf ("getpwnam (%s) failed: %m\n", last_name);
return 1;
}
pw2 = getpwuid (first_uid);
if (pw2 == NULL)
{
printf ("getpwuid (%llu) failed: %m\n",
(unsigned long long) first_uid);
return 1;
}
pw2 = getpwuid (last_uid);
if (pw2 == NULL)
{
printf ("getpwuid (%llu) failed: %m\n",
(unsigned long long) last_uid);
return 1;
}
}
endpwent ();
if (new_count < count)
{
printf ("Missing entry in the password database.\n");
return 1;
}
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
|
/*
* gretl -- Gnu Regression, Econometrics and Time-series Library
* Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
*
* 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 DLGUTILS_H
#define DLGUTILS_H
enum {
GRETL_DLG_MODAL = 1 << 0,
GRETL_DLG_BLOCK = 1 << 1,
GRETL_DLG_RESIZE = 1 << 2,
GRETL_DLG_QUASI_MODAL = 1 << 3,
};
typedef enum {
VARCLICK_NONE,
VARCLICK_INSERT_ID,
VARCLICK_INSERT_NAME,
VARCLICK_INSERT_TEXT
} Varclick;
enum {
OPT_TYPE_RADIO,
OPT_TYPE_COMBO
};
struct combo_opts_ {
gretlopt *optp;
gretlopt *vals;
const char **strs;
};
/* convenience abbreviations */
#define button_is_active(b) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b))
#define widget_get_int(w,s) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), s))
#define widget_set_int(w,s,i) g_object_set_data(G_OBJECT(w), s, GINT_TO_POINTER(i))
#define spinner_get_int(b) gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(b))
/* variant functions for incompatible GTK versions */
GtkWidget *combo_box_text_new_with_entry (void);
gchar *combo_box_get_active_text (gpointer p);
void combo_box_append_text (gpointer p, const gchar *s);
void combo_box_prepend_text (gpointer p, const gchar *s);
void combo_box_remove (gpointer p, int pos);
#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 24
#define gtk_combo_box_text_new gtk_combo_box_new_text
#endif
GtkWidget *get_active_edit_id (void);
GtkWidget *get_active_edit_name (void);
GtkWidget *get_active_edit_text (void);
void set_active_edit_name (GtkWidget *w);
void raise_and_focus_dialog (GtkEditable *entry,
GtkWidget *parent);
gboolean esc_kills_window (GtkWidget *w, GdkEventKey *key,
gpointer p);
typedef struct combo_opts_ combo_opts;
GtkWidget *gretl_dialog_new (const char *title, GtkWidget *parent,
unsigned char flags);
gint gretl_dialog_set_destruction (GtkWidget *w, gpointer p);
int maybe_raise_dialog (void);
void vbox_add_hsep (GtkWidget *vbox);
void pack_in_hbox (GtkWidget *w, GtkWidget *vbox, int vspace);
GtkWidget *cancel_delete_button (GtkWidget *hbox, GtkWidget *targ);
GtkWidget *cancel_button (GtkWidget *hbox);
GtkWidget *close_button (GtkWidget *hbox);
GtkWidget *ok_button (GtkWidget *hbox);
GtkWidget *ok_validate_button (GtkWidget *hbox, int *retptr,
int *valptr);
GtkWidget *apply_button (GtkWidget *hbox);
GtkWidget *next_button (GtkWidget *hbox);
GtkWidget *back_button (GtkWidget *hbox);
void sensitize_conditional_on (GtkWidget *w, GtkWidget *b);
void desensitize_conditional_on (GtkWidget *w, GtkWidget *b);
void set_double_from_spinner (GtkSpinButton *b, double *x);
void set_int_from_spinner (GtkSpinButton *b, int *k);
GtkWidget *gretl_option_check_button (const char *label,
gretlopt *popt,
gretlopt val);
GtkWidget *gretl_option_check_button_switched (const char *label,
gretlopt *popt,
gretlopt val);
void blocking_edit_dialog (int ci, const char *title,
const char *info, const char *deflt,
void (*okfunc)(), void *okptr,
Varclick click, GtkWidget *parent,
int *canceled);
void edit_dialog (int ci, const char *title,
const char *info, const char *deflt,
void (*okfunc)(), void *okptr,
Varclick click, GtkWidget *parent);
void edit_dialog_reset (dialog_t *dlg);
const gchar *edit_dialog_get_text (dialog_t *dlg);
gchar *edit_dialog_special_get_text (dialog_t *dlg);
int edit_dialog_get_action (const dialog_t *dlg);
gretlopt edit_dialog_get_opt (const dialog_t *dlg);
gpointer edit_dialog_get_data (dialog_t *dlg);
void edit_dialog_close (dialog_t *dlg);
gchar *entry_box_get_trimmed_text (GtkWidget *w);
GtkWidget *gretl_opts_combo (combo_opts *opts, int deflt);
GtkWidget *gretl_opts_combo_masked (combo_opts *opts, int deflt,
const int *masked);
GtkWidget *gretl_opts_combo_full (combo_opts *opts, int deflt,
const int *masked,
GCallback callback,
gpointer calldata);
dialog_opts *dialog_opts_new (int n, int type,
gretlopt *optp,
const gretlopt *vals,
const char **strs);
void dialog_opts_free (dialog_opts *opts);
void set_combo_box_strings_from_list (GtkWidget *box, GList *list);
void set_combo_box_default_text (GtkComboBox *box, const char *s);
void depopulate_combo_box (GtkComboBox *box);
gboolean widget_get_pointer_info (GtkWidget *w, gint *x, gint *y,
GdkModifierType *mask);
void gretl_emulated_dialog_add_structure (GtkWidget *dlg,
GtkWidget **pvbox,
GtkWidget **pbbox);
#endif /* DLGUTILS_H */
|
// POD character, std::char_traits specialization -*- C++ -*-
// Copyright (C) 2002, 2003, 2004, 2005 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 2, 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.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/** @file ext/pod_char_traits.h
* This file is a GNU extension to the Standard C++ Library.
*/
// Gabriel Dos Reis <gdr@integrable-solutions.net>
// Benjamin Kosnik <bkoz@redhat.com>
#ifndef _POD_CHAR_TRAITS_H
#define _POD_CHAR_TRAITS_H 1
#include <string>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// POD character abstraction.
// NB: The char_type parameter is a subset of int_type, as to allow
// int_type to properly hold the full range of char_type values as
// well as EOF.
/// @brief A POD class that serves as a character abstraction class.
template<typename V, typename I, typename S = mbstate_t>
struct character
{
typedef V value_type;
typedef I int_type;
typedef S state_type;
typedef character<V, I, S> char_type;
value_type value;
template<typename V2>
static char_type
from(const V2& v)
{
char_type ret = { static_cast<value_type>(v) };
return ret;
}
template<typename V2>
static V2
to(const char_type& c)
{
V2 ret = { static_cast<V2>(c.value) };
return ret;
}
};
template<typename V, typename I, typename S>
inline bool
operator==(const character<V, I, S>& lhs, const character<V, I, S>& rhs)
{ return lhs.value == rhs.value; }
template<typename V, typename I, typename S>
inline bool
operator<(const character<V, I, S>& lhs, const character<V, I, S>& rhs)
{ return lhs.value < rhs.value; }
_GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(std)
/// char_traits<__gnu_cxx::character> specialization.
template<typename V, typename I, typename S>
struct char_traits<__gnu_cxx::character<V, I, S> >
{
typedef __gnu_cxx::character<V, I, S> char_type;
typedef typename char_type::int_type int_type;
typedef typename char_type::state_type state_type;
typedef fpos<state_type> pos_type;
typedef streamoff off_type;
static void
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
for (size_t __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i], __s2[__i]))
return lt(__s1[__i], __s2[__i]) ? -1 : 1;
return 0;
}
static size_t
length(const char_type* __s)
{
const char_type* __p = __s;
while (__p->value)
++__p;
return (__p - __s);
}
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{
for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
if (*__p == __a)
return __p;
return 0;
}
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{
return static_cast<char_type*>(std::memmove(__s1, __s2,
__n * sizeof(char_type)));
}
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{
std::copy(__s2, __s2 + __n, __s1);
return __s1;
}
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{
std::fill_n(__s, __n, __a);
return __s;
}
static char_type
to_char_type(const int_type& __i)
{ return char_type::template from(__i); }
static int_type
to_int_type(const char_type& __c)
{ return char_type::template to<int_type>(__c); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static int_type
eof()
{
int_type __r = { -1 };
return __r;
}
static int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? int_type() : __c; }
};
_GLIBCXX_END_NAMESPACE
#endif
|
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
#ifndef SWITCHINGFUNCTIONCONSTRAINTETA_H
#define SWITCHINGFUNCTIONCONSTRAINTETA_H
#include "Kernel.h"
#include "DerivativeMaterialInterface.h"
// Forward Declarations
class SwitchingFunctionConstraintEta;
template <>
InputParameters validParams<SwitchingFunctionConstraintEta>();
/**
* SwitchingFunctionConstraintEta is a constraint kernel that acts on the
* lambda lagrange multiplier non-linear variables to
* enforce \f$ \sum_n h_i(\eta_i) \equiv 1 \f$.
*/
class SwitchingFunctionConstraintEta : public DerivativeMaterialInterface<Kernel>
{
public:
SwitchingFunctionConstraintEta(const InputParameters & parameters);
protected:
virtual Real computeQpResidual();
virtual Real computeQpJacobian();
virtual Real computeQpOffDiagJacobian(unsigned int);
/// Switching function name
VariableName _eta_name;
/// Switching function drivatives
const MaterialProperty<Real> & _dh;
const MaterialProperty<Real> & _d2h;
/// Lagrange multiplier
const VariableValue & _lambda;
unsigned int _lambda_var;
};
#endif // SWITCHINGFUNCTIONCONSTRAINTETA_H
|
/* $NetBSD: xcall.h,v 1.5 2013/02/19 09:04:53 martin Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Doran.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_XCALL_H_
#define _SYS_XCALL_H_
#ifdef _KERNEL
#define XC_HIGHPRI 0x01 /* high priority */
typedef void (*xcfunc_t)(void *, void *);
struct cpu_info;
void xc_init_cpu(struct cpu_info *);
void xc_send_ipi(struct cpu_info *);
void xc_ipi_handler(void);
void xc__highpri_intr(void *);
uint64_t xc_broadcast(u_int, xcfunc_t, void *, void *);
uint64_t xc_unicast(u_int, xcfunc_t, void *, void *, struct cpu_info *);
void xc_wait(uint64_t);
#endif /* _KERNEL */
#endif /* _SYS_XCALL_H_ */
|
/** @file
The assistant function declaration for IpSecConfig application.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _HELPER_H_
#define _HELPER_H_
#define FORMAT_NUMBER 0x1
#define FORMAT_STRING 0x2
/**
Helper function called to change input parameter in string format to number.
@param[in] FlagStr The pointer to the flag string.
@param[in] Maximum most value number.
@param[in, out] ValuePtr The pointer to the input parameter in string format.
@param[in] ByteCount The valid byte count
@param[in] Map The pointer to the STR2INT table.
@param[in] ParamPackage The pointer to the ParamPackage list.
@param[in] FormatMask The bit mask.
BIT 0 set indicates the value of flag might be number.
BIT 1 set indicates the value of flag might be a string that needs to be looked up.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_NOT_FOUND The input parameter can't be found.
@retval EFI_INVALID_PARAMETER The input parameter is an invalid input.
**/
EFI_STATUS
GetNumber (
IN CHAR16 *FlagStr,
IN UINT64 Maximum,
IN OUT VOID *ValuePtr,
IN UINTN ByteCount,
IN STR2INT *Map,
IN LIST_ENTRY *ParamPackage,
IN UINT32 FormatMask
);
/**
Helper function called to convert a string containing an (Ipv4) Internet Protocol dotted address
into a proper address for the EFI_IP_ADDRESS structure.
@param[in] Ptr The pointer to the string containing an (Ipv4) Internet Protocol dotted address.
@param[out] Ip The pointer to the Ip address structure to contain the result.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EfiInetAddr2 (
IN CHAR16 *Ptr,
OUT EFI_IP_ADDRESS *Ip
);
/**
Helper function called to calculate the prefix length associated with the string
containing an Ipv4 or Ipv6 Internet Protocol address.
@param[in] Ptr The pointer to the string containing an Ipv4 or Ipv6 Internet Protocol address.
@param[out] Addr The pointer to the EFI_IP_ADDRESS_INFO structure to contain the result.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval Others Other mistake case.
**/
EFI_STATUS
EfiInetAddrRange (
IN CHAR16 *Ptr,
OUT EFI_IP_ADDRESS_INFO *Addr
);
/**
Helper function called to calculate the port range associated with the string.
@param[in] Ptr The pointer to the string containing a port and range.
@param[out] Port The pointer to the Port to contain the result.
@param[out] PortRange The pointer to the PortRange to contain the result.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval Others Other mistake case.
**/
EFI_STATUS
EfiInetPortRange (
IN CHAR16 *Ptr,
OUT UINT16 *Port,
OUT UINT16 *PortRange
);
/**
Helper function called to transfer a string to an unsigned integer.
@param[in] Str The pointer to the string.
@param[out] Status The operation status.
@return The integer value of a converted str.
**/
UINT64
StrToUInteger (
IN CONST CHAR16 *Str,
OUT EFI_STATUS *Status
);
/**
Helper function called to transfer a string to an unsigned integer according to the map table.
@param[in] Str The pointer to the string.
@param[in] Map The pointer to the map table.
@return The integer value of converted str. If not found, then return -1.
**/
UINT32
MapStringToInteger (
IN CONST CHAR16 *Str,
IN STR2INT *Map
);
/**
Helper function called to transfer an unsigned integer to a string according to the map table.
@param[in] Integer The pointer to the string.
@param[in] Map The pointer to the map table.
@return The converted str. If not found, then return NULL.
**/
CHAR16 *
MapIntegerToString (
IN UINT32 Integer,
IN STR2INT *Map
);
#endif
|
/*
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#import "../AmazonServiceRequest.h"
#import "DynamoDBRequest.h"
#import "DynamoDBBatchWriteItemRequest.h"
/**
* Batch Write Item Request Marshaller
*/
@interface DynamoDBBatchWriteItemRequestMarshaller:NSObject {
}
+(AmazonServiceRequest *)createRequest:(DynamoDBBatchWriteItemRequest *)batchWriteItemRequest;
@end
|
/*
* Copyright 2007 Baylor University
*
* 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 _PROPHET_PARAMS_H_
#define _PROPHET_PARAMS_H_
#include <sys/types.h>
#include "Node.h"
#include "FwdStrategy.h"
#include "QueuePolicy.h"
namespace prophet
{
/**
* Tunable parameter struct for setting global default values
* for various Prophet algorithms
*/
class ProphetParams : public NodeParams
{
public:
/**
* Time between HELLO beacons (in 100ms units)
*/
static const u_int8_t HELLO_INTERVAL = 20; ///< 2 sec (arbitrary)
/**
* Max units of HELLO_INTERVAL before peer is considered unreachable
*/
static const u_int HELLO_DEAD = 20; ///< 40 sec (arbitrary)
/**
* Max times to forward a bundle for GTMX
*/
static const u_int DEFAULT_NUM_F_MAX = 5; ///< arbitrary
/**
* Min times to forward a bundle for LEPR
*/
static const u_int DEFAULT_NUM_F_MIN = 3; ///< arbitrary
/**
* Seconds between aging of nodes and Prophet ACKs
*/
static const u_int AGE_PERIOD = 180; ///< 3 min (arbitrary)
/**
* Current version of the protocol
*/
static const u_int8_t PROPHET_VERSION = 0x01;
/**
* Maximum number of routes to retain (not specified by I-D)
*/
static const u_int MAX_TABLE_SIZE = 1024;
/**
* Constructor. Default values are defined in Prophet.h
*/
ProphetParams()
: NodeParams(),
fs_(FwdStrategy::GRTR),
qp_(QueuePolicy::FIFO),
hello_interval_(HELLO_INTERVAL),
hello_dead_(HELLO_DEAD),
max_forward_(DEFAULT_NUM_F_MAX),
min_forward_(DEFAULT_NUM_F_MIN),
age_period_(AGE_PERIOD),
max_table_size_(MAX_TABLE_SIZE),
epsilon_(0.0039), // min value using 1/255
relay_node_(true),
internet_gw_(false) // not implemented
{}
///@{ Accessors
FwdStrategy::fwd_strategy_t fs() const { return fs_; }
QueuePolicy::q_policy_t qp() const { return qp_; }
u_int8_t hello_interval() const { return hello_interval_; }
u_int hello_dead() const { return hello_dead_; }
u_int max_forward() const { return max_forward_; }
u_int min_forward() const { return min_forward_; }
u_int age_period() const { return age_period_; }
double epsilon() const { return epsilon_; }
bool relay_node() const { return relay_node_; }
bool internet_gw() const { return internet_gw_; }
///@}
FwdStrategy::fwd_strategy_t fs_; ///< bundle forwarding strategy
QueuePolicy::q_policy_t qp_; ///< bundle queuing policy
u_int8_t hello_interval_; ///< delay between HELLO beacons (100ms units)
u_int hello_dead_; ///< hello_interval's before giving up on peer
u_int max_forward_; ///< max times to forward bundle using GTMX
u_int min_forward_; ///< min times to forward bundle before LEPR drops
u_int age_period_; ///< seconds between applying age algorithm
u_int max_table_size_; ///< max number of routes to retain
double epsilon_; ///< minimum predictability before dropping route
bool relay_node_; ///< whether this node accepts bundles to relay to peers
bool internet_gw_; ///< not implemented; whether node bridges to Internet
};
}; // namespace prophet
#endif // _PROPHET_PARAMS_H_
|
// RUN: %clang_builtins %s %librt -o %t && %run %t
// REQUIRES: librt_has_lshrdi3
//===-- lshrdi3_test.c - Test __lshrdi3 -----------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file tests __lshrdi3 for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include "int_lib.h"
#include <stdio.h>
// Returns: logical a >> b
// Precondition: 0 <= b < bits_in_dword
COMPILER_RT_ABI di_int __lshrdi3(di_int a, si_int b);
int test__lshrdi3(di_int a, si_int b, di_int expected)
{
di_int x = __lshrdi3(a, b);
if (x != expected)
printf("error in __lshrdi3: %llX >> %d = %llX, expected %llX\n",
a, b, __lshrdi3(a, b), expected);
return x != expected;
}
char assumption_1[sizeof(di_int) == 2*sizeof(si_int)] = {0};
int main()
{
if (test__lshrdi3(0x0123456789ABCDEFLL, 0, 0x123456789ABCDEFLL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 1, 0x91A2B3C4D5E6F7LL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 2, 0x48D159E26AF37BLL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 3, 0x2468ACF13579BDLL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 4, 0x123456789ABCDELL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 28, 0x12345678LL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 29, 0x91A2B3CLL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 30, 0x48D159ELL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 31, 0x2468ACFLL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 32, 0x1234567LL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 33, 0x91A2B3LL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 34, 0x48D159LL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 35, 0x2468ACLL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 36, 0x123456LL))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 60, 0))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 61, 0))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 62, 0))
return 1;
if (test__lshrdi3(0x0123456789ABCDEFLL, 63, 0))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 0, 0xFEDCBA9876543210LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 1, 0x7F6E5D4C3B2A1908LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 2, 0x3FB72EA61D950C84LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 3, 0x1FDB97530ECA8642LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 4, 0xFEDCBA987654321LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 28, 0xFEDCBA987LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 29, 0x7F6E5D4C3LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 30, 0x3FB72EA61LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 31, 0x1FDB97530LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 32, 0xFEDCBA98LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 33, 0x7F6E5D4CLL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 34, 0x3FB72EA6LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 35, 0x1FDB9753LL))
return 1;
if (test__lshrdi3(0xFEDCBA9876543210LL, 36, 0xFEDCBA9LL))
return 1;
if (test__lshrdi3(0xAEDCBA9876543210LL, 60, 0xALL))
return 1;
if (test__lshrdi3(0xAEDCBA9876543210LL, 61, 0x5LL))
return 1;
if (test__lshrdi3(0xAEDCBA9876543210LL, 62, 0x2LL))
return 1;
if (test__lshrdi3(0xAEDCBA9876543210LL, 63, 0x1LL))
return 1;
return 0;
}
|
/*
* private.c
*
* Description:
* This translation unit implements routines which are private to
* the implementation and may be used throughout it.
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "pthread.h"
#include "implement.h"
#include "ptw32_MCS_lock.c"
#include "ptw32_is_attr.c"
#include "ptw32_processInitialize.c"
#include "ptw32_processTerminate.c"
#include "ptw32_threadStart.c"
#include "ptw32_threadDestroy.c"
#include "ptw32_tkAssocCreate.c"
#include "ptw32_tkAssocDestroy.c"
#include "ptw32_callUserDestroyRoutines.c"
#include "ptw32_semwait.c"
#include "ptw32_timespec.c"
#include "ptw32_relmillisecs.c"
#include "ptw32_throw.c"
#include "ptw32_getprocessors.c"
#include "ptw32_new.c"
#include "ptw32_calloc.c"
#include "ptw32_reuse.c"
#include "ptw32_cond_check_need_init.c"
#include "ptw32_mutex_check_need_init.c"
#include "ptw32_rwlock_check_need_init.c"
#include "ptw32_rwlock_cancelwrwait.c"
#include "ptw32_spinlock_check_need_init.c"
|
/*
Copyright 2009-2015 Urban Airship 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 THE URBAN AIRSHIP 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 URBAN AIRSHIP 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.
*/
#import <Foundation/Foundation.h>
#import "InboxSampleUserInterface.h"
/**
* A sample user interface that displays the inbox as a modal view controller.
*/
@interface InboxSampleModalUserInterface : NSObject<InboxSampleUserInterface>
/**
* InboxSampleModalUserInterface initializer.
*
* @param controller An instance of UAInboxMessageListController.
*/
- (instancetype)initWithMessageListController:(UAInboxMessageListController *)controller;
- (BOOL)isVisible;
- (void)showInbox;
- (void)hideInbox;
@property(nonatomic, weak) UIViewController *parentController;
@property(nonatomic, strong) UAInboxMessageListController *messageListController;
@end
|
//===========================================
// Lumina-DE source code
// Copyright (c) 2015-2017, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
// This class is the container which provides the screensaver animations
// and should be subclassed for each of the various animation types
//===========================================
#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_BASE_ANIMATION_GROUP_H
#define _LUMINA_DESKTOP_SCREEN_SAVER_BASE_ANIMATION_GROUP_H
#include "global-includes.h"
class BaseAnimGroup : public QParallelAnimationGroup{
Q_OBJECT
public:
QWidget *canvas;
QString animPlugin;
virtual void LoadAnimations(){} //This is the main function which needs to be subclassed
BaseAnimGroup(QWidget *parent){
canvas = parent;
canvas->setCursor( QCursor(Qt::BlankCursor) );
}
~BaseAnimGroup(){}
QVariant readSetting(QString variable, QVariant defaultvalue = QVariant());
//==============================
// PLUGIN LOADING/LISTING (Change in the .cpp file)
//==============================
static BaseAnimGroup* NewAnimation(QString type, QWidget *parent);
static QStringList KnownAnimations();
};
#endif
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKTCROSSWIDGET_H_INCLUDED
#define QMITKTCROSSWIDGET_H_INCLUDED
#include <QLabel>
#include "MitkQtWidgetsExtExports.h"
#include <mitkCommon.h>
class MITKQTWIDGETSEXT_EXPORT QmitkCrossWidget : public QLabel
{
Q_OBJECT
public:
QmitkCrossWidget( QWidget * parent=nullptr, Qt::WindowFlags f = nullptr );
void mousePressEvent( QMouseEvent* mouseEvent ) override;
void mouseMoveEvent( QMouseEvent* mouseEvent ) override;
void mouseReleaseEvent( QMouseEvent* mouseEvent ) override;
signals:
void SignalDeltaMove( int,int );
protected:
// fix for bug 3378 - setPos() causes an app crash on MAC OS X
#ifdef __APPLE__
void ResetMousePosition(int, int) {};
#else
void ResetMousePosition(int xpos, int ypos)
{
QCursor::setPos(xpos, ypos);
};
#endif
int lastX,lastY;
};
#endif
|
#ifndef THC_GENERIC_FILE
#error "You must define THC_GENERIC_FILE before including THGenerateFloatType.h"
#endif
#define real float
/* FIXME: fp64 has bad performance on some platforms; avoid using it unless
we opt into it? */
#define accreal float
#define Real Float
#define CReal Cuda
#define THC_REAL_IS_FLOAT
#line 1 THC_GENERIC_FILE
#include THC_GENERIC_FILE
#undef real
#undef accreal
#undef Real
#undef CReal
#undef THC_REAL_IS_FLOAT
#ifndef THCGenerateAllTypes
#ifndef THCGenerateFloatTypes
#undef THC_GENERIC_FILE
#endif
#endif
|
/*****************************************************************************
Copyright (c) 2014, Intel Corp.
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 Intel Corporation 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.
*****************************************************************************
* Contents: Native high-level C interface to LAPACK function cheevx
* Author: Intel Corporation
* Generated November 2015
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_cheevx( int matrix_layout, char jobz, char range, char uplo,
lapack_int n, lapack_complex_float* a,
lapack_int lda, float vl, float vu, lapack_int il,
lapack_int iu, float abstol, lapack_int* m, float* w,
lapack_complex_float* z, lapack_int ldz,
lapack_int* ifail )
{
lapack_int info = 0;
lapack_int lwork = -1;
lapack_int* iwork = NULL;
float* rwork = NULL;
lapack_complex_float* work = NULL;
lapack_complex_float work_query;
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_cheevx", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_che_nancheck( matrix_layout, uplo, n, a, lda ) ) {
return -6;
}
if( LAPACKE_s_nancheck( 1, &abstol, 1 ) ) {
return -12;
}
if( LAPACKE_lsame( range, 'v' ) ) {
if( LAPACKE_s_nancheck( 1, &vl, 1 ) ) {
return -8;
}
}
if( LAPACKE_lsame( range, 'v' ) ) {
if( LAPACKE_s_nancheck( 1, &vu, 1 ) ) {
return -9;
}
}
#endif
/* Allocate memory for working array(s) */
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,5*n) );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,7*n) );
if( rwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Query optimal working array(s) size */
info = LAPACKE_cheevx_work( matrix_layout, jobz, range, uplo, n, a, lda, vl,
vu, il, iu, abstol, m, w, z, ldz, &work_query,
lwork, rwork, iwork, ifail );
if( info != 0 ) {
goto exit_level_2;
}
lwork = LAPACK_C2INT( work_query );
/* Allocate memory for work arrays */
work = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_2;
}
/* Call middle-level interface */
info = LAPACKE_cheevx_work( matrix_layout, jobz, range, uplo, n, a, lda, vl,
vu, il, iu, abstol, m, w, z, ldz, work, lwork,
rwork, iwork, ifail );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_2:
LAPACKE_free( rwork );
exit_level_1:
LAPACKE_free( iwork );
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_cheevx", info );
}
return info;
}
|
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef LIBRARIES_NACL_MOUNTS_PATH_H_
#define LIBRARIES_NACL_MOUNTS_PATH_H_
#include <string>
#include <vector>
#include "utils/macros.h"
typedef std::vector<std::string> StringArray_t;
class Path {
public:
Path();
Path(const Path& path);
// This constructor splits path by '/' as a starting point for this Path.
// If the path begins with the character '/', the path is considered
// to be absolute.
explicit Path(const std::string& path);
~Path();
// Return true of the first path item is '/'.
bool IsAbsolute() const;
// Return a part of the path
const std::string& Part(size_t index) const;
// Return the number of path parts/
size_t Size() const;
// Update the path.
Path& Append(const std::string& path);
Path& Prepend(const std::string& path);
Path& Set(const std::string& path);
// Return the parent path.
Path Parent() const;
std::string Basename() const;
std::string Join() const;
std::string Range(size_t start, size_t end) const;
StringArray_t Split() const;
// Collapse the string list removing extraneous '.', '..' path components
static StringArray_t Normalize(const StringArray_t& paths);
static std::string Join(const StringArray_t& paths);
static std::string Range(const StringArray_t& paths, size_t start,
size_t end);
static StringArray_t Split(const std::string& paths);
// Operator versions
Path& operator=(const Path& p);
Path& operator=(const std::string& str);
private:
// Internal representation of the path stored an array of string representing
// the directory traversal. The first string is a "/" if this is an abolute
// path.
StringArray_t paths_;
};
#endif // PACKAGES_LIBRARIES_NACL_MOUNTS_PATH_H_
|
/*
* Copyright 2019 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrContext_Base_DEFINED
#define GrContext_Base_DEFINED
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrTypes.h"
class GrBaseContextPriv;
class GrCaps;
class GrContext;
class GrImageContext;
class GrRecordingContext;
class GrSkSLFPFactoryCache;
class GrContext_Base : public SkRefCnt {
public:
virtual ~GrContext_Base();
/*
* The 3D API backing this context
*/
SK_API GrBackendApi backend() const { return fBackend; }
/*
* Retrieve the default GrBackendFormat for a given SkColorType and renderability.
* It is guaranteed that this backend format will be the one used by the GrContext
* SkColorType and SkSurfaceCharacterization-based createBackendTexture methods.
*
* The caller should check that the returned format is valid.
*/
SK_API GrBackendFormat defaultBackendFormat(SkColorType, GrRenderable) const;
// Provides access to functions that aren't part of the public API.
GrBaseContextPriv priv();
const GrBaseContextPriv priv() const;
protected:
friend class GrBaseContextPriv; // for hidden functions
GrContext_Base(GrBackendApi backend, const GrContextOptions& options, uint32_t contextID);
virtual bool init(sk_sp<const GrCaps>, sk_sp<GrSkSLFPFactoryCache>);
/**
* An identifier for this context. The id is used by all compatible contexts. For example,
* if SkImages are created on one thread using an image creation context, then fed into a
* DDL Recorder on second thread (which has a recording context) and finally replayed on
* a third thread with a direct context, then all three contexts will report the same id.
* It is an error for an image to be used with contexts that report different ids.
*/
uint32_t contextID() const { return fContextID; }
bool matches(GrContext_Base* candidate) const {
return candidate->contextID() == this->contextID();
}
/*
* The options in effect for this context
*/
const GrContextOptions& options() const { return fOptions; }
const GrCaps* caps() const;
sk_sp<const GrCaps> refCaps() const;
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache();
virtual GrImageContext* asImageContext() { return nullptr; }
virtual GrRecordingContext* asRecordingContext() { return nullptr; }
virtual GrContext* asDirectContext() { return nullptr; }
private:
const GrBackendApi fBackend;
const GrContextOptions fOptions;
const uint32_t fContextID;
sk_sp<const GrCaps> fCaps;
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
typedef SkRefCnt INHERITED;
};
#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 ASH_SERVICES_MULTIDEVICE_SETUP_WIFI_SYNC_NOTIFICATION_CONTROLLER_H_
#define ASH_SERVICES_MULTIDEVICE_SETUP_WIFI_SYNC_NOTIFICATION_CONTROLLER_H_
#include <memory>
#include "ash/services/device_sync/public/cpp/device_sync_client.h"
#include "base/memory/weak_ptr.h"
#include "base/power_monitor/power_observer.h"
#include "components/session_manager/core/session_manager_observer.h"
class PrefRegistrySimple;
class PrefService;
namespace chromeos {
namespace multidevice_setup {
// Pref to track whether the announcement notification can be shown the next
// time the device is unlocked with a verified host and wi-fi sync supported but
// disabled.
extern const char kCanShowWifiSyncAnnouncementPrefName[];
class AccountStatusChangeDelegateNotifier;
class GlobalStateFeatureManager;
class HostStatusProvider;
// Controls the setup notification for Wifi Sync.
class WifiSyncNotificationController
: public base::PowerSuspendObserver,
public session_manager::SessionManagerObserver {
public:
class Factory {
public:
static std::unique_ptr<WifiSyncNotificationController> Create(
GlobalStateFeatureManager* wifi_sync_feature_manager,
HostStatusProvider* host_status_provider,
PrefService* pref_service,
device_sync::DeviceSyncClient* device_sync_client,
AccountStatusChangeDelegateNotifier* delegate_notifier);
static void SetFactoryForTesting(Factory* test_factory);
protected:
virtual ~Factory();
virtual std::unique_ptr<WifiSyncNotificationController> CreateInstance(
GlobalStateFeatureManager* wifi_sync_feature_manager,
HostStatusProvider* host_status_provider,
PrefService* pref_service,
device_sync::DeviceSyncClient* device_sync_client,
AccountStatusChangeDelegateNotifier* delegate_notifier) = 0;
private:
static Factory* test_factory_;
};
static void RegisterPrefs(PrefRegistrySimple* registry);
~WifiSyncNotificationController() override;
WifiSyncNotificationController(const WifiSyncNotificationController&) =
delete;
WifiSyncNotificationController& operator=(
const WifiSyncNotificationController&) = delete;
private:
WifiSyncNotificationController(
GlobalStateFeatureManager* wifi_sync_feature_manager,
HostStatusProvider* host_status_provider,
PrefService* pref_service,
device_sync::DeviceSyncClient* device_sync_client,
AccountStatusChangeDelegateNotifier* delegate_notifier);
// SessionManagerObserver:
void OnSessionStateChanged() override;
// PowerSuspendObserver:
void OnResume() override;
void ShowAnnouncementNotificationIfEligible();
bool IsWifiSyncSupported();
GlobalStateFeatureManager* wifi_sync_feature_manager_;
HostStatusProvider* host_status_provider_;
PrefService* pref_service_;
device_sync::DeviceSyncClient* device_sync_client_;
AccountStatusChangeDelegateNotifier* delegate_notifier_;
bool did_register_session_observers_ = false;
base::WeakPtrFactory<WifiSyncNotificationController> weak_ptr_factory_{this};
};
} // namespace multidevice_setup
} // namespace chromeos
#endif // ASH_SERVICES_MULTIDEVICE_SETUP_WIFI_SYNC_NOTIFICATION_CONTROLLER_H_
|
// Copyright 2020 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 UI_COLOR_COLOR_PROVIDER_MANAGER_H_
#define UI_COLOR_COLOR_PROVIDER_MANAGER_H_
#include <memory>
#include <tuple>
#include "base/callback.h"
#include "base/callback_list.h"
#include "base/component_export.h"
#include "base/containers/flat_map.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_utils.h"
namespace ui {
class ColorProvider;
// Manages and provides color providers.
//
// In most cases, use ColorProviderManager::Get() to obtain an instance to the
// manager and then call GetColorProviderFor() to get a ColorProvider. It is not
// necessary to construct a ColorProviderManager manually.
class COMPONENT_EXPORT(COLOR) ColorProviderManager {
public:
struct Key;
enum class ColorMode {
kLight,
kDark,
};
enum class ContrastMode {
kNormal,
kHigh,
};
enum class ElevationMode {
kLow,
kHigh,
};
enum class SystemTheme {
kDefault,
kCustom,
};
// Threadsafe not because ColorProviderManager requires it but because a
// concrete subclass does.
class InitializerSupplier
: public base::RefCountedThreadSafe<InitializerSupplier> {
public:
// Adds any mixers necessary to represent this supplier.
virtual void AddColorMixers(ColorProvider* provider,
const Key& key) const = 0;
// The mixers may need access to the raw colors from the theme.
virtual bool GetColor(int id, SkColor* color) const = 0;
// The mixers will also need access to the tints provided by the theme.
virtual bool GetTint(int id, color_utils::HSL* hsl) const = 0;
// The mixers may need to adjust colors depending on whether there is an
// image supplied for the theme element.
virtual bool HasCustomImage(int id) const = 0;
protected:
virtual ~InitializerSupplier() = default;
private:
friend class base::RefCountedThreadSafe<InitializerSupplier>;
};
struct COMPONENT_EXPORT(COLOR) Key {
Key(); // For test convenience.
Key(ColorMode color_mode,
ContrastMode contrast_mode,
SystemTheme system_theme,
scoped_refptr<InitializerSupplier> custom_theme);
Key(const Key&);
Key& operator=(const Key&);
~Key();
ColorMode color_mode;
ContrastMode contrast_mode;
ElevationMode elevation_mode;
SystemTheme system_theme;
scoped_refptr<InitializerSupplier> custom_theme;
bool operator<(const Key& other) const {
return std::make_tuple(color_mode, contrast_mode, elevation_mode,
system_theme, custom_theme) <
std::make_tuple(other.color_mode, other.contrast_mode,
other.elevation_mode, other.system_theme,
other.custom_theme);
}
};
using ColorProviderInitializerList =
base::RepeatingCallbackList<void(ColorProvider*, const Key&)>;
ColorProviderManager(const ColorProviderManager&) = delete;
ColorProviderManager& operator=(const ColorProviderManager&) = delete;
static ColorProviderManager& Get();
static ColorProviderManager& GetForTesting();
static void ResetForTesting();
// Resets the current `initializer_list_`.
void ResetColorProviderInitializerList();
// Clears the ColorProviders stored in `color_providers_`.
void ResetColorProviderCache();
// Appends `initializer` to the end of the current `initializer_list_`.
void AppendColorProviderInitializer(
ColorProviderInitializerList::CallbackType Initializer);
// Returns a color provider for |key|, creating one if necessary.
ColorProvider* GetColorProviderFor(Key key);
protected:
ColorProviderManager();
virtual ~ColorProviderManager();
private:
// Holds the chain of ColorProvider initializer callbacks.
std::unique_ptr<ColorProviderInitializerList> initializer_list_;
// Holds the subscriptions for initializers in the `initializer_list_`.
std::vector<base::CallbackListSubscription> initializer_subscriptions_;
base::flat_map<Key, std::unique_ptr<ColorProvider>> color_providers_;
};
} // namespace ui
#endif // UI_COLOR_COLOR_PROVIDER_MANAGER_H_
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_PREF_SERVICE_FACTORY_H_
#define COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_PREF_SERVICE_FACTORY_H_
#include <memory>
#include "components/prefs/pref_service.h"
namespace mojo {
class Connector;
}
class PrefRegistry;
namespace filesystem {
// This factory method creates a PrefService for the local process based on the
// preference registry passed in. This PrefService will synchronize with a JSON
// file in the mojo:filesystem.
std::unique_ptr<PrefService> CreatePrefService(shell::Connector* connector,
PrefRegistry* registry);
} // namespace filesystem
#endif // COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_PREF_SERVICE_FACTORY_H_
|
/*
* arch/sh/boards/landisk/irq.c
*
* I-O DATA Device, Inc. LANDISK Support
*
* Copyright (C) 2005-2007 kogiidena
*
* Copyright (C) 2001 Ian da Silva, Jeremy Siegel
* Based largely on io_se.c.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <mach-landisk/mach/iodata_landisk.h>
static void disable_landisk_irq(unsigned int irq)
{
unsigned char mask = 0xff ^ (0x01 << (irq - 5));
ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
}
static void enable_landisk_irq(unsigned int irq)
{
unsigned char value = (0x01 << (irq - 5));
ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
}
static struct irq_chip landisk_irq_chip __read_mostly = {
.name = "LANDISK",
.mask = disable_landisk_irq,
.unmask = enable_landisk_irq,
.mask_ack = disable_landisk_irq,
};
/*
* Initialize IRQ setting
*/
void __init init_landisk_IRQ(void)
{
int i;
for (i = 5; i < 14; i++) {
disable_irq_nosync(i);
set_irq_chip_and_handler_name(i, &landisk_irq_chip,
handle_level_irq, "level");
enable_landisk_irq(i);
}
ctrl_outb(0x00, PA_PWRINT_CLR);
}
|
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// 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 _TEXTURE_DICTIONARY_H_
#define _TEXTURE_DICTIONARY_H_
#ifndef _TEXTURE_OBJECT_H_
#include "graphics/TextureObject.h"
#endif
//-----------------------------------------------------------------------------
class TextureDictionary
{
public:
static TextureObject **smTable;
static TextureObject *TextureObjectChain;
static U32 smHashTableSize;
static void create();
static void destroy();
static void insert(TextureObject *object);
static TextureObject* find( StringTableEntry textureKey );
static TextureObject* find( StringTableEntry textureKey, TextureHandle::TextureHandleType type, bool clamp );
static void remove( TextureObject *object );
};
#endif // _TEXTURE_DICTIONARY_H_
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_COLLECTION_EXT_H
#define PX_COLLECTION_EXT_H
/** \addtogroup extensions
@{
*/
#include "PxPhysXConfig.h"
#include "common/PxCollection.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxCollectionExt
{
public:
/**
\brief Removes and releases all object from a collection.
The Collection itself is not released.
If the releaseExclusiveShapes flag is not set to true, release() will not be called on exclusive shapes.
It is assumed that the application holds a reference to each of the objects in the collection, with the exception of objects that are not releasable
(PxBase::isReleasable()). In general, objects that violate this assumption need to be removed from the collection prior to calling releaseObjects.
\note when a shape is created with PxRigidActor::createShape() or PxRigidActorExt::createExclusiveShape(), the only counted reference is held by the actor.
If such a shape and its actor are present in the collection, the reference count will be decremented once when the actor is released, and once when the
shape is released, resulting in undefined behavior. Shape reference counts can be incremented with PxShape::acquireReference().
\param[in] collection to remove and release all object from.
\param[in] releaseExclusiveShapes if this parameter is set to false, release() will not be called on exclusive shapes.
*/
static void releaseObjects(PxCollection& collection, bool releaseExclusiveShapes = true);
/**
\brief Removes objects of a given type from a collection, potentially adding them to another collection.
\param[in,out] collection Collection from which objects are removed
\param[in] concreteType PxConcreteType of sdk objects that should be removed
\param[in,out] to Optional collection to which the removed objects are added
@see PxCollection, PxConcreteType
*/
static void remove(PxCollection& collection, PxType concreteType, PxCollection* to = NULL);
/**
\brief Collects all objects in PxPhysics that are shareable across multiple scenes.
This function creates a new collection from all objects that are shareable across multiple
scenes. Instances of the following types are included: PxConvexMesh, PxTriangleMesh,
PxHeightField, PxShape, PxMaterial and PxClothFabric.
This is a helper function to ease the creation of collections for serialization.
\param[in] physics The physics SDK instance from which objects are collected. See #PxPhysics
\return Collection to which objects are added. See #PxCollection
@see PxCollection, PxPhysics
*/
static PxCollection* createCollection(PxPhysics& physics);
/**
\brief Collects all objects from a PxScene.
This function creates a new collection from all objects that where added to the specified
PxScene. Instances of the following types are included: PxActor, PxAggregate,
PxArticulation and PxJoint (other PxConstraint types are not included).
This is a helper function to ease the creation of collections for serialization.
The function PxSerialization.complete() can be used to complete the collection with required objects prior to
serialization.
\param[in] scene The PxScene instance from which objects are collected. See #PxScene
\return Collection to which objects are added. See #PxCollection
@see PxCollection, PxScene, PxSerialization.complete()
*/
static PxCollection* createCollection(PxScene& scene);
};
#if !PX_DOXYGEN
} // namespace physx
#endif
/** @} */
#endif
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <stdlib.h>
#include <pthread.h>
#include "azure_c_shared_utility/lock.h"
#include "azure_c_shared_utility/xlogging.h"
DEFINE_ENUM_STRINGS(LOCK_RESULT, LOCK_RESULT_VALUES);
/*SRS_LOCK_99_002:[ This API on success will return a valid lock handle which should be a non NULL value]*/
LOCK_HANDLE Lock_Init(void)
{
pthread_mutex_t* lock_mtx = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t));
if (NULL != lock_mtx)
{
if (pthread_mutex_init(lock_mtx, NULL) != 0)
{
/*SRS_LOCK_99_003:[ On Error Should return NULL]*/
free(lock_mtx);
lock_mtx = NULL;
LogError("Failed to initialize mutex");
}
}
return (LOCK_HANDLE)lock_mtx;
}
LOCK_RESULT Lock(LOCK_HANDLE handle)
{
LOCK_RESULT result;
if (handle == NULL)
{
/*SRS_LOCK_99_007:[ This API on NULL handle passed returns LOCK_ERROR]*/
result = LOCK_ERROR;
LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
}
else
{
if ( pthread_mutex_lock((pthread_mutex_t*)handle) == 0)
{
/*SRS_LOCK_99_005:[ This API on success should return LOCK_OK]*/
result = LOCK_OK;
}
else
{
/*SRS_LOCK_99_006:[ This API on error should return LOCK_ERROR]*/
result = LOCK_ERROR;
LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
}
}
return result;
}
LOCK_RESULT Unlock(LOCK_HANDLE handle)
{
LOCK_RESULT result;
if (handle == NULL)
{
/*SRS_LOCK_99_011:[ This API on NULL handle passed returns LOCK_ERROR]*/
result = LOCK_ERROR;
LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
}
else
{
if (pthread_mutex_unlock((pthread_mutex_t*)handle) == 0)
{
/*SRS_LOCK_99_009:[ This API on success should return LOCK_OK]*/
result = LOCK_OK;
}
else
{
/*SRS_LOCK_99_010:[ This API on error should return LOCK_ERROR]*/
result = LOCK_ERROR;
LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
}
}
return result;
}
LOCK_RESULT Lock_Deinit(LOCK_HANDLE handle)
{
LOCK_RESULT result=LOCK_OK ;
if (NULL == handle)
{
/*SRS_LOCK_99_013:[ This API on NULL handle passed returns LOCK_ERROR]*/
result = LOCK_ERROR;
LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
}
else
{
/*SRS_LOCK_99_012:[ This API frees the memory pointed by handle]*/
if(pthread_mutex_destroy((pthread_mutex_t*)handle)==0)
{
free(handle);
handle = NULL;
}
else
{
result = LOCK_ERROR;
LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
}
}
return result;
}
|
/**
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#ifndef ZSTD_V03_H_298734209782
#define ZSTD_V03_H_298734209782
#if defined (__cplusplus)
extern "C" {
#endif
/* *************************************
* Includes
***************************************/
#include <stddef.h> /* size_t */
/* *************************************
* Simple one-step function
***************************************/
/**
ZSTDv03_decompress() : decompress ZSTD frames compliant with v0.3.x format
compressedSize : is the exact source size
maxOriginalSize : is the size of the 'dst' buffer, which must be already allocated.
It must be equal or larger than originalSize, otherwise decompression will fail.
return : the number of bytes decompressed into destination buffer (originalSize)
or an errorCode if it fails (which can be tested using ZSTDv01_isError())
*/
size_t ZSTDv03_decompress( void* dst, size_t maxOriginalSize,
const void* src, size_t compressedSize);
/**
ZSTDv03_isError() : tells if the result of ZSTDv03_decompress() is an error
*/
unsigned ZSTDv03_isError(size_t code);
/* *************************************
* Advanced functions
***************************************/
typedef struct ZSTDv03_Dctx_s ZSTDv03_Dctx;
ZSTDv03_Dctx* ZSTDv03_createDCtx(void);
size_t ZSTDv03_freeDCtx(ZSTDv03_Dctx* dctx);
size_t ZSTDv03_decompressDCtx(void* ctx,
void* dst, size_t maxOriginalSize,
const void* src, size_t compressedSize);
/* *************************************
* Streaming functions
***************************************/
size_t ZSTDv03_resetDCtx(ZSTDv03_Dctx* dctx);
size_t ZSTDv03_nextSrcSizeToDecompress(ZSTDv03_Dctx* dctx);
size_t ZSTDv03_decompressContinue(ZSTDv03_Dctx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
/**
Use above functions alternatively.
ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue().
ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block.
Result is the number of bytes regenerated within 'dst'.
It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header.
*/
/* *************************************
* Prefix - version detection
***************************************/
#define ZSTDv03_magicNumber 0xFD2FB523 /* v0.3 */
#if defined (__cplusplus)
}
#endif
#endif /* ZSTD_V03_H_298734209782 */
|
#pragma once
#include "cUserInterface.h"
class cButton : public cUserInterface
{
protected:
bool m_bActivated = false;
bool m_bClicked = false;
bool m_bCursorOn = false;
LPDIRECT3DTEXTURE9 m_pTextureNormal;
LPDIRECT3DTEXTURE9 m_pTextureOn;
LPDIRECT3DTEXTURE9 m_pTextureClick;
public:
cButton();
virtual ~cButton();
virtual void Setup(std::string sFolder, std::string sFile, std::string sExtension);
virtual void Update(float delta);
};
|
//
// UIView+FLEXBOX.h
// FlexboxKit
//
// Created by Alex Usbergo on 09/05/15.
// Copyright (c) 2015 Alex Usbergo. All rights reserved.
//
@import UIKit;
#import "FLEXBOXNode.h"
@interface UIView (FLEXBOX)
// Properties
/// YES if this view contains subviews that you wish to layout using the flexbox engine
/// @note You don't need to set this if your view is a FLEXBOXContainerView
@property (nonatomic, assign) BOOL flexContainer;
/// Set this if you wish to have a fixed size for this element
@property (nonatomic, assign) CGSize flexFixedSize;
/// The minumum size for this element
@property (nonatomic, assign) CGSize flexMinimumSize;
/// The maximum size for this element
@property (nonatomic, assign) CGSize flexMaximumSize;
/// It establishes the main-axis, thus defining the direction flex items are placed in the flex container.
/// - row: same as text direction (@see FLEXBOXFlexDirectionColumn)
/// - column (default): same as row but top to bottom (@see FLEXBOXFlexDirectionRow)
/// - row-reverse: (@see FLEXBOXFlexDirectionRowReverse)
/// - column-reverse: (@see FLEXBOXFlexDirectionColumnReverse)
@property (nonatomic, assign) FLEXBOXFlexDirection flexDirection;
/// The margins for this flex item (default is 0)
@property (nonatomic, assign) UIEdgeInsets flexMargin;
/// The padding for this flex item (default is 0)
@property (nonatomic, assign) UIEdgeInsets flexPadding;
/// Make the flexible items wrap if necesarry:
/// - wrap YES
/// - nowrap (default) NO
@property (nonatomic, assign) BOOL flexWrap;
/// It defines the alignment along the main axis. It helps distribute extra free
/// space leftover when either all the flex items on a line are inflexible, or are
/// flexible but have reached their maximum size. It also exerts some control over
/// the alignment of items when they overflow the line.
/// - flex-start (default): items are packed toward the start line (@see FLEXBOXJustificationFlexStart)
/// - flex-end: items are packed toward to end line (@see FLEXBOXJustificationFlexEnd)
/// - center: items are centered along the line (@see FLEXBOXJustificationCenter)
/// - space-between: items are evenly distributed in the line; first item is on the start line, last item on the end line (@see FLEXBOXJustificationSpaceBetween)
/// - space-around: items are evenly distributed in the line with equal space around them (@see FLEXBOXJustificationSpaceAround)
@property (nonatomic, assign) FLEXBOXJustification flexJustifyContent;
/// Center the alignments for one of the items inside a flexible element
/// - auto (default): The element inherits its parent container's align-items property, or "stretch" if it has no parent container (@see FLEXBOXAlignmentAuto)
/// - stretch: The element is positioned to fit the conatiner (@see FLEXBOXAlignmentStretch)
/// - center: The element is positioned at the center of the container (@see FLEXBOXAlignmentCenter)
/// - flex-start: The element is are positioned at the beginning of the container (@see FLEXBOXAlignmentFlexStart)
/// - flex-end: The element is positioned at the end of the container (@see FLEXBOXAlignmentFlexEnd)
@property (nonatomic, assign) FLEXBOXAlignment flexAlignSelf;
/// Center the alignments for all the items of the flexible element:
/// - stretch (default): The element is positioned to fit the conatiner (@see FLEXBOXAlignmentStretch)
/// - center: The element is positioned at the center of the container (@see FLEXBOXAlignmentCenter)
/// - flex-start: The element is are positioned at the beginning of the container (@see FLEXBOXAlignmentFlexStart)
/// - flex-end: The element is positioned at the end of the container (@see FLEXBOXAlignmentFlexEnd)
@property (nonatomic, assign) FLEXBOXAlignment flexAlignItems;
/// The flex property specifies the initial length of a flexible item.
/// A value between 0 and 1 (a ratio e.g. 1/2, 2/3)
@property (nonatomic, assign) CGFloat flex;
/// The node content directon (default is inherit)
@property (nonatomic, assign) FLEXBOXContentDirection flexContentDirection;
// Methods
/// Entry point for defining the size for this flex item
/// @note By default it calls -[UIView sizeThatFits:]
- (CGSize)flexComputeSize:(CGSize)bounds;
/// Call this method in -[UIView layoutSubviews] if you want the flexbox
/// engine to compute the layout
- (void)flexLayoutSubviews;
/// Define this block if you want to specify some custom logic instead of
/// calling -[UIView sizeThatFits:] in -[UIView flexComputeSize:]
@property (nonatomic, copy) CGSize (^flexSizeThatFitsBlock)(CGSize size);
@end
|
/// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-
/// hyperhttp - http://www.cppkit.org
/// Copyright (c) 2013, Tony Di Croce
/// All rights reserved.
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted
/// provided that the following conditions are met:
///
/// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
/// and the following disclaimer in the documentation and/or other materials provided with the
/// distribution.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
/// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
/// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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.
///
/// The views and conclusions contained in the software and documentation are those of the authors and
/// should not be interpreted as representing official policies, either expressed or implied, of the cppkit
/// Project.
/// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-
#ifndef hyperhttp_client_response_h
#define hyperhttp_client_response_h
#include <list>
#include <vector>
#include <map>
#include <functional>
#include "cppkit/ck_stream_io.h"
#include "cppkit/ck_string.h"
#include "cppkit/ck_memory.h"
namespace hyperhttp
{
class client_response;
typedef std::function<bool(std::shared_ptr<cppkit::ck_memory>, const client_response&)> chunk_callback;
typedef std::function<bool(std::shared_ptr<cppkit::ck_memory>, const std::map<std::string, cppkit::ck_string>&, const client_response&)> part_callback;
class client_response
{
public:
CK_API client_response();
CK_API client_response(const client_response& obj);
CK_API virtual ~client_response() throw();
CK_API client_response& operator = (const client_response& obj);
CK_API void read_response(std::shared_ptr<cppkit::ck_stream_io> socket);
CK_API cppkit::ck_string get_message();
CK_API void debug_print_request();
CK_API const void* get_body() const;
CK_API size_t get_body_size() const;
CK_API cppkit::ck_string get_body_as_string() const;
CK_API std::shared_ptr<const cppkit::ck_memory> get_body_buffer() const { return _bodyContents; }
CK_API cppkit::ck_string get_header(const cppkit::ck_string& header) const;
CK_API std::vector<cppkit::ck_string> get_all_matching_headers(const cppkit::ck_string& header) const;
CK_API bool is_success() const;
CK_API bool is_failure() const;
CK_API int get_status() const { return _statusCode; }
CK_API void register_chunk_callback( chunk_callback cb, bool streaming = false );
CK_API void register_part_callback( part_callback pb );
private:
void _read_chunked_body(std::shared_ptr<cppkit::ck_stream_io> socket);
void _read_multi_part(std::shared_ptr<cppkit::ck_stream_io> socket);
std::map<std::string, cppkit::ck_string> _read_multi_header_lines(std::shared_ptr<cppkit::ck_stream_io> socket, char* lineBuf);
void _read_end_of_line(std::shared_ptr<cppkit::ck_stream_io> socket);
bool _is_legal_chunk_size_char(char ch) { return isxdigit(ch) ? true : false; } // VS warning: forcing int to bool.
bool _embed_null(char* lineBuf);
void _consume_footer(std::shared_ptr<cppkit::ck_stream_io> socket);
void _add_header(const cppkit::ck_string& name, const cppkit::ck_string& value);
bool _receive_data(std::shared_ptr<cppkit::ck_stream_io> socket, void* data, size_t dataLen);
void _clean_socket(std::shared_ptr<cppkit::ck_stream_io> socket, char** writer);
void _read_header_line(std::shared_ptr<cppkit::ck_stream_io> socket, char* writer, bool firstLine);
bool _add_line(std::list<cppkit::ck_string>& lines, const cppkit::ck_string& line);
void _process_request_lines(const std::list<cppkit::ck_string>& requestLines);
void _process_body(std::shared_ptr<cppkit::ck_stream_io> socket);
bool _is_end_of_line(char* buffer)
{
return (buffer[0] == '\r' && buffer[1] == '\n') || buffer[0] == '\n';
}
cppkit::ck_string _initialLine;
std::map<std::string, std::list<cppkit::ck_string> > _headerParts;
std::shared_ptr<cppkit::ck_memory> _bodyContents;
bool _success;
int _statusCode;
chunk_callback _chunkCallback;
part_callback _partCallback;
std::shared_ptr<cppkit::ck_memory> _chunk;
bool _streaming;
};
}
#endif
|
/* isinff4 - for each element of vector x, return a mask of ones if x' is INF, zero otherwise
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Sony Computer Entertainment Inc nor the names
of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <simdmath/isinff4.h>
vector unsigned int
isinff4 (vector float x)
{
return _isinff4(x);
}
|
/*
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* All rights reserved.
*/
/*
* This program is licensed under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(OSSL_ENGINE_H)
#define OSSL_ENGINE_H
extern VALUE cEngine;
extern VALUE eEngineError;
void Init_ossl_engine(void);
#endif /* OSSL_ENGINE_H */
|
#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED
#define LIST_H_VERSION "$Id: list.h,v 1.19 2013/11/24 14:23:28 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.h,v $
*
* Purpose : Declares functions to handle lists.
* Functions declared include:
* `destroy_list', `enlist' and `list_to_text'
*
* Copyright : Written by and Copyright (C) 2001-2007 the SourceForge
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
* 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.
*
* The GNU General Public License should be included with
* this file. If not, you can view it at
* http://www.gnu.org/copyleft/gpl.html
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*********************************************************************/
#include "project.h"
/*
* struct list
*
* A linked list class.
*/
extern void init_list (struct list *the_list);
extern void destroy_list (struct list *the_list);
extern jb_err enlist (struct list *the_list, const char *str);
extern jb_err enlist_unique (struct list *the_list, const char *str, size_t num_significant_chars);
extern jb_err enlist_unique_header (struct list *the_list, const char *name, const char *value);
extern jb_err enlist_first (struct list *the_list, const char *str);
extern jb_err list_append_list_unique(struct list *dest, const struct list *src);
extern jb_err list_duplicate (struct list *dest, const struct list *src);
extern int list_remove_item(struct list *the_list, const char *str);
extern int list_remove_list(struct list *dest, const struct list *src);
extern void list_remove_all (struct list *the_list);
extern int list_is_empty(const struct list *the_list);
extern char * list_to_text(const struct list *the_list);
extern int list_contains_item(const struct list *the_list, const char *str);
/*
* struct map
*
* A class which maps names to values.
*
* Note: You must allocate this through new_map() and free it
* through free_map().
*/
extern struct map * new_map (void);
extern void free_map (struct map * the_map);
extern jb_err map (struct map * the_map,
const char * name, int name_needs_copying,
const char * value, int value_needs_copying);
extern jb_err unmap (struct map *the_map,
const char *name);
extern const char * lookup (const struct map * the_map, const char * name);
/* Revision control strings from this header and associated .c file */
extern const char list_rcs[];
extern const char list_h_rcs[];
#endif /* ndef LIST_H_INCLUDED */
/*
Local Variables:
tab-width: 3
end:
*/
|
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may in
* the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#include <rtems.h>
/* functions */
rtems_task Init(
rtems_task_argument argument
);
rtems_task test_task(
rtems_task_argument my_number
);
void
destory_all_tasks(
const char *who
);
bool status_code_bad(
rtems_status_code status_code
);
extern void test1(void);
extern void test2(void);
extern void test3(void);
/* configuration information */
#include <bsp.h> /* for device driver prototypes */
/* NOTICE: the clock driver is explicitly disabled */
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_UNIFIED_WORK_AREAS
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define TASK_ALLOCATION_SIZE (5)
#define CONFIGURE_UNLIMITED_OBJECTS
#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE TASK_ALLOCATION_SIZE
#define CONFIGURE_INIT_TASK_STACK_SIZE (8 * 1024)
#include <rtems/confdefs.h>
/*
* Keep track of the task id's created, use a large array.
*/
#define MAX_TASKS (1000)
#define TASK_INDEX_OFFSET (1)
extern rtems_id task_id[MAX_TASKS];
/*
* Increment the task name.
*/
#define NEXT_TASK_NAME(c1, c2, c3, c4) \
if (c4 == '9') { \
if (c3 == '9') { \
if (c2 == 'z') { \
if (c1 == 'z') { \
printf("not enough task letters for names !!!\n"); \
exit( 1 ); \
} else \
c1++; \
c2 = 'a'; \
} else \
c2++; \
c3 = '0'; \
} else \
c3++; \
c4 = '0'; \
} \
else \
c4++ \
/* end of include file */
|
/* Default version of diskfs_validate_group_change
Copyright (C) 1996 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
The GNU Hurd 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.
The GNU Hurd 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, USA. */
#include "priv.h"
error_t __attribute__ ((weak))
diskfs_validate_group_change (struct node *np, gid_t group)
{
return 0;
}
|
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <string>
#include <vector>
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/frame.h>
#include "Common/FifoQueue.h"
#include "Core/NetPlayClient.h"
#include "Core/NetPlayProto.h"
class CGameListCtrl;
class wxButton;
class wxCheckBox;
class wxChoice;
class wxListBox;
class wxString;
class wxTextCtrl;
class wxWindow;
enum
{
NP_GUI_EVT_CHANGE_GAME = 45,
NP_GUI_EVT_START_GAME,
NP_GUI_EVT_STOP_GAME,
};
class NetPlaySetupDiag : public wxFrame
{
public:
NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list);
~NetPlaySetupDiag();
private:
void OnJoin(wxCommandEvent& event);
void OnHost(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void MakeNetPlayDiag(int port, const std::string &game, bool is_hosting);
wxTextCtrl* m_nickname_text;
wxTextCtrl* m_host_port_text;
wxTextCtrl* m_connect_port_text;
wxTextCtrl* m_connect_ip_text;
wxListBox* m_game_lbox;
#ifdef USE_UPNP
wxCheckBox* m_upnp_chk;
#endif
const CGameListCtrl* const m_game_list;
};
class NetPlayDiag : public wxFrame, public NetPlayUI
{
public:
NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list
, const std::string& game, const bool is_hosting = false);
~NetPlayDiag();
Common::FifoQueue<std::string> chat_msgs;
void OnStart(wxCommandEvent& event);
// implementation of NetPlayUI methods
void BootGame(const std::string& filename) override;
void StopGame() override;
void Update() override;
void AppendChat(const std::string& msg) override;
void OnMsgChangeGame(const std::string& filename) override;
void OnMsgStartGame() override;
void OnMsgStopGame() override;
static NetPlayDiag *&GetInstance() { return npd; };
bool IsRecording() override;
private:
DECLARE_EVENT_TABLE()
void OnChat(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void OnThread(wxCommandEvent& event);
void OnChangeGame(wxCommandEvent& event);
void OnAdjustBuffer(wxCommandEvent& event);
void OnConfigPads(wxCommandEvent& event);
void OnKick(wxCommandEvent& event);
void OnPlayerSelect(wxCommandEvent& event);
void GetNetSettings(NetSettings &settings);
std::string FindGame();
wxListBox* m_player_lbox;
wxTextCtrl* m_chat_text;
wxTextCtrl* m_chat_msg_text;
wxCheckBox* m_memcard_write;
wxCheckBox* m_record_chkbox;
std::string m_selected_game;
wxButton* m_game_btn;
wxButton* m_start_btn;
wxButton* m_kick_btn;
std::vector<int> m_playerids;
const CGameListCtrl* const m_game_list;
static NetPlayDiag* npd;
};
class ChangeGameDiag : public wxDialog
{
public:
ChangeGameDiag(wxWindow* const parent, const CGameListCtrl* const game_list, wxString& game_name);
private:
void OnPick(wxCommandEvent& event);
wxListBox* m_game_lbox;
wxString& m_game_name;
};
class PadMapDiag : public wxDialog
{
public:
PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiimotemap[], std::vector<const Player *>& player_list);
private:
void OnAdjust(wxCommandEvent& event);
wxChoice* m_map_cbox[8];
PadMapping* const m_mapping;
PadMapping* const m_wiimapping;
std::vector<const Player *>& m_player_list;
};
namespace NetPlay
{
void StopGame();
}
|
/*
* linux/drivers/video/kyro/STG4000VTG.c
*
* Copyright (C) 2002 STMicroelectronics
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
#include <linux/types.h>
#include <video/kyro.h>
#include "STG4000Reg.h"
#include "STG4000Interface.h"
void DisableVGA(volatile STG4000REG * pSTGReg)
{
u32 tmp;
volatile u32 count, i;
/* Reset the VGA registers */
tmp = STG_READ_REG(SoftwareReset);
CLEAR_BIT(8);
STG_WRITE_REG(SoftwareReset, tmp);
/* Just for Delay */
for (i = 0; i < 1000; i++) {
count++;
}
/* Pull-out the VGA registers from reset */
tmp = STG_READ_REG(SoftwareReset);
tmp |= SET_BIT(8);
STG_WRITE_REG(SoftwareReset, tmp);
}
void StopVTG(volatile STG4000REG * pSTGReg)
{
u32 tmp = 0;
/* Stop Ver and Hor Sync Generator */
tmp = (STG_READ_REG(DACSyncCtrl)) | SET_BIT(0) | SET_BIT(2);
CLEAR_BIT(31);
STG_WRITE_REG(DACSyncCtrl, tmp);
}
void StartVTG(volatile STG4000REG * pSTGReg)
{
u32 tmp = 0;
/* Start Ver and Hor Sync Generator */
tmp = ((STG_READ_REG(DACSyncCtrl)) | SET_BIT(31));
CLEAR_BIT(0);
CLEAR_BIT(2);
STG_WRITE_REG(DACSyncCtrl, tmp);
}
void SetupVTG(volatile STG4000REG * pSTGReg,
const struct kyrofb_info * pTiming)
{
u32 tmp = 0;
u32 margins = 0;
u32 ulBorder;
u32 xRes = pTiming->XRES;
u32 yRes = pTiming->YRES;
/* Horizontal */
u32 HAddrTime, HRightBorder, HLeftBorder;
u32 HBackPorcStrt, HFrontPorchStrt, HTotal,
HLeftBorderStrt, HRightBorderStrt, HDisplayStrt;
/* Vertical */
u32 VDisplayStrt, VBottomBorder, VTopBorder;
u32 VBackPorchStrt, VTotal, VTopBorderStrt,
VFrontPorchStrt, VBottomBorderStrt, VAddrTime;
/* Need to calculate the right border */
if ((xRes == 640) && (yRes == 480)) {
if ((pTiming->VFREQ == 60) || (pTiming->VFREQ == 72)) {
margins = 8;
}
}
/* Work out the Border */
ulBorder =
(pTiming->HTot -
(pTiming->HST + (pTiming->HBP - margins) + xRes +
(pTiming->HFP - margins))) >> 1;
/* Border the same for Vertical and Horizontal */
VBottomBorder = HLeftBorder = VTopBorder = HRightBorder = ulBorder;
/************ Get Timing values for Horizontal ******************/
HAddrTime = xRes;
HBackPorcStrt = pTiming->HST;
HTotal = pTiming->HTot;
HDisplayStrt =
pTiming->HST + (pTiming->HBP - margins) + HLeftBorder;
HLeftBorderStrt = HDisplayStrt - HLeftBorder;
HFrontPorchStrt =
pTiming->HST + (pTiming->HBP - margins) + HLeftBorder +
HAddrTime + HRightBorder;
HRightBorderStrt = HFrontPorchStrt - HRightBorder;
/************ Get Timing values for Vertical ******************/
VAddrTime = yRes;
VBackPorchStrt = pTiming->VST;
VTotal = pTiming->VTot;
VDisplayStrt =
pTiming->VST + (pTiming->VBP - margins) + VTopBorder;
VTopBorderStrt = VDisplayStrt - VTopBorder;
VFrontPorchStrt =
pTiming->VST + (pTiming->VBP - margins) + VTopBorder +
VAddrTime + VBottomBorder;
VBottomBorderStrt = VFrontPorchStrt - VBottomBorder;
/* Set Hor Timing 1, 2, 3 */
tmp = STG_READ_REG(DACHorTim1);
CLEAR_BITS_FRM_TO(0, 11);
CLEAR_BITS_FRM_TO(16, 27);
tmp |= (HTotal) | (HBackPorcStrt << 16);
STG_WRITE_REG(DACHorTim1, tmp);
tmp = STG_READ_REG(DACHorTim2);
CLEAR_BITS_FRM_TO(0, 11);
CLEAR_BITS_FRM_TO(16, 27);
tmp |= (HDisplayStrt << 16) | HLeftBorderStrt;
STG_WRITE_REG(DACHorTim2, tmp);
tmp = STG_READ_REG(DACHorTim3);
CLEAR_BITS_FRM_TO(0, 11);
CLEAR_BITS_FRM_TO(16, 27);
tmp |= (HFrontPorchStrt << 16) | HRightBorderStrt;
STG_WRITE_REG(DACHorTim3, tmp);
/* Set Ver Timing 1, 2, 3 */
tmp = STG_READ_REG(DACVerTim1);
CLEAR_BITS_FRM_TO(0, 11);
CLEAR_BITS_FRM_TO(16, 27);
tmp |= (VBackPorchStrt << 16) | (VTotal);
STG_WRITE_REG(DACVerTim1, tmp);
tmp = STG_READ_REG(DACVerTim2);
CLEAR_BITS_FRM_TO(0, 11);
CLEAR_BITS_FRM_TO(16, 27);
tmp |= (VDisplayStrt << 16) | VTopBorderStrt;
STG_WRITE_REG(DACVerTim2, tmp);
tmp = STG_READ_REG(DACVerTim3);
CLEAR_BITS_FRM_TO(0, 11);
CLEAR_BITS_FRM_TO(16, 27);
tmp |= (VFrontPorchStrt << 16) | VBottomBorderStrt;
STG_WRITE_REG(DACVerTim3, tmp);
/* Set Verical and Horizontal Polarity */
tmp = STG_READ_REG(DACSyncCtrl) | SET_BIT(3) | SET_BIT(1);
if ((pTiming->HSP > 0) && (pTiming->VSP < 0)) { /* +hsync -vsync */
tmp &= ~0x8;
} else if ((pTiming->HSP < 0) && (pTiming->VSP > 0)) { /* -hsync +vsync */
tmp &= ~0x2;
} else if ((pTiming->HSP < 0) && (pTiming->VSP < 0)) { /* -hsync -vsync */
tmp &= ~0xA;
} else if ((pTiming->HSP > 0) && (pTiming->VSP > 0)) { /* +hsync -vsync */
tmp &= ~0x0;
}
STG_WRITE_REG(DACSyncCtrl, tmp);
}
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "cores/AudioEngine/Utils/AEAudioFormat.h"
#include "DllAvCodec.h"
#include "DllAvFormat.h"
#include "DllAvUtil.h"
#include "DllSwResample.h"
#include "DVDStreamInfo.h"
#include "linux/PlatformDefs.h"
class COMXAudioCodecOMX
{
public:
COMXAudioCodecOMX();
virtual ~COMXAudioCodecOMX();
bool Open(CDVDStreamInfo &hints);
void Dispose();
int Decode(BYTE* pData, int iSize);
int GetData(BYTE** dst);
void Reset();
int GetChannels();
uint64_t GetChannelMap();
int GetSampleRate();
int GetBitsPerSample();
static const char* GetName() { return "FFmpeg"; }
int GetBitRate();
protected:
AVCodecContext* m_pCodecContext;
SwrContext* m_pConvert;
enum AVSampleFormat m_iSampleFormat;
enum AVSampleFormat m_desiredSampleFormat;
AVFrame* m_pFrame1;
BYTE *m_pBufferOutput;
int m_iBufferOutputAlloced;
bool m_bOpenedCodec;
int m_channels;
bool m_bFirstFrame;
bool m_bGotFrame;
DllAvCodec m_dllAvCodec;
DllAvUtil m_dllAvUtil;
DllSwResample m_dllSwResample;
};
|
/*
* Backlight Lowlevel Control Abstraction
*
* Copyright (C) 2003,2004 Hewlett-Packard Company
*
*/
#ifndef _LINUX_BACKLIGHT_H
#define _LINUX_BACKLIGHT_H
#include <linux/device.h>
#include <linux/fb.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
/* Notes on locking:
*
* backlight_device->ops_lock is an internal backlight lock protecting the
* ops pointer and no code outside the core should need to touch it.
*
* Access to update_status() is serialised by the update_lock mutex since
* most drivers seem to need this and historically get it wrong.
*
* Most drivers don't need locking on their get_brightness() method.
* If yours does, you need to implement it in the driver. You can use the
* update_lock mutex if appropriate.
*
* Any other use of the locks below is probably wrong.
*/
enum backlight_update_reason {
BACKLIGHT_UPDATE_HOTKEY,
BACKLIGHT_UPDATE_SYSFS,
};
enum backlight_type {
BACKLIGHT_RAW = 1,
BACKLIGHT_PLATFORM,
BACKLIGHT_FIRMWARE,
BACKLIGHT_TYPE_MAX,
};
struct backlight_device;
struct fb_info;
struct backlight_ops {
unsigned int options;
#define BL_CORE_SUSPENDRESUME (1 << 0)
/* Notify the backlight driver some property has changed */
int (*update_status)(struct backlight_device *);
/* Return the current backlight brightness (accounting for power,
fb_blank etc.) */
int (*get_brightness)(struct backlight_device *);
/* Check if given framebuffer device is the one bound to this backlight;
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
int (*check_fb)(struct backlight_device *, struct fb_info *);
};
/* This structure defines all the properties of a backlight */
struct backlight_properties {
/* Current User requested brightness (0 - max_brightness) */
int brightness;
/* Maximal value for brightness (read-only) */
int max_brightness;
/* Current FB Power mode (0: full on, 1..3: power saving
modes; 4: full off), see FB_BLANK_XXX */
int power;
/* FB Blanking active? (values as for power) */
/* Due to be removed, please use (state & BL_CORE_FBBLANK) */
int fb_blank;
/* Backlight type */
enum backlight_type type;
/* Flags used to signal drivers of state changes */
/* Upper 4 bits are reserved for driver internal use */
unsigned int state;
#define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */
#define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */
#define BL_CORE_DRIVER4 (1 << 28) /* reserved for driver specific use */
#define BL_CORE_DRIVER3 (1 << 29) /* reserved for driver specific use */
#define BL_CORE_DRIVER2 (1 << 30) /* reserved for driver specific use */
#define BL_CORE_DRIVER1 (1 << 31) /* reserved for driver specific use */
};
struct backlight_device {
/* Backlight properties */
struct backlight_properties props;
/* Serialise access to update_status method */
struct mutex update_lock;
/* This protects the 'ops' field. If 'ops' is NULL, the driver that
registered this device has been unloaded, and if class_get_devdata()
points to something in the body of that driver, it is also invalid. */
struct mutex ops_lock;
const struct backlight_ops *ops;
/* The framebuffer notifier block */
struct notifier_block fb_notif;
struct device dev;
struct fb_event *fb_event;
};
static inline void backlight_update_status(struct backlight_device *bd)
{
mutex_lock(&bd->update_lock);
if (bd->ops && bd->ops->update_status)
bd->ops->update_status(bd);
mutex_unlock(&bd->update_lock);
}
extern struct backlight_device *backlight_device_register(const char *name,
struct device *dev, void *devdata, const struct backlight_ops *ops,
const struct backlight_properties *props);
extern void backlight_device_unregister(struct backlight_device *bd);
extern void backlight_force_update(struct backlight_device *bd,
enum backlight_update_reason reason);
#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
static inline void * bl_get_data(struct backlight_device *bl_dev)
{
return dev_get_drvdata(&bl_dev->dev);
}
struct generic_bl_info {
const char *name;
int max_intensity;
int default_intensity;
int limit_mask;
void (*set_bl_intensity)(int intensity);
void (*kick_battery)(void);
};
#endif
|
/* The common simulator framework for GDB, the GNU Debugger.
Copyright 2002, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Andrew Cagney and Red Hat.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SIM_IO_H
#define SIM_IO_H
/* See the file include/callbacks.h for a description */
int sim_io_init (SIM_DESC sd);
int sim_io_shutdown (SIM_DESC sd);
int sim_io_unlink (SIM_DESC sd, const char *);
long sim_io_time (SIM_DESC sd, long *);
int sim_io_system (SIM_DESC sd, const char *);
int sim_io_rename (SIM_DESC sd, const char *, const char *);
int sim_io_write_stdout (SIM_DESC sd, const char *, int);
void sim_io_flush_stdout (SIM_DESC sd);
int sim_io_write_stderr (SIM_DESC sd, const char *, int);
void sim_io_flush_stderr (SIM_DESC sd);
int sim_io_write (SIM_DESC sd, int, const char *, int);
int sim_io_read_stdin (SIM_DESC sd, char *, int);
int sim_io_read (SIM_DESC sd, int, char *, int);
int sim_io_open (SIM_DESC sd, const char *, int);
int sim_io_lseek (SIM_DESC sd, int, long, int);
int sim_io_isatty (SIM_DESC sd, int);
int sim_io_get_errno (SIM_DESC sd);
int sim_io_close (SIM_DESC sd, int);
void sim_io_printf (SIM_DESC sd,
const char *fmt,
...) __attribute__ ((format (printf, 2, 3)));
void sim_io_vprintf (SIM_DESC sd, const char *fmt, va_list ap);
void sim_io_eprintf (SIM_DESC sd,
const char *fmt,
...) __attribute__ ((format (printf, 2, 3)));
void sim_io_evprintf (SIM_DESC sd, const char *fmt, va_list ap);
void sim_io_error (SIM_DESC sd,
const char *fmt,
...)
__attribute__ ((format (printf, 2, 3)))
__attribute__ ((__noreturn__));
void sim_io_poll_quit (SIM_DESC sd);
/* Returns -1 and sets (host) EAGAIN if not ready. */
int sim_io_poll_read (SIM_DESC sd, int, char *, int);
#include <sys/types.h>
#include <sys/stat.h>
int sim_io_stat (SIM_DESC sd, const char *path, struct stat *buf);
int sim_io_fstat (SIM_DESC sd, int fd, struct stat *buf);
#endif
|
#pragma once
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* $Id$
* @file lib/eap/chbind.h
* @brief Channel binding
*
* @copyright 2014 Network RADIUS SARL
* @copyright 2014 The FreeRADIUS server project
*/
RCSIDH(lib_eap_chbind_h, "$Id$")
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <ctype.h>
#include <freeradius-devel/eap/base.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/radius/radius.h>
#include <freeradius-devel/radius/defs.h>
/* Structure to represent eap channel binding packet format */
typedef struct {
uint8_t code;
uint8_t data[1];
} chbind_packet_t;
/* Structure to hold channel bindings req/resp information */
typedef struct {
fr_pair_t *username; /* the username */
chbind_packet_t *request; /* channel binding request buffer */
chbind_packet_t *response; /* channel binding response buffer */
} CHBIND_REQ;
/* Protocol constants */
#define CHBIND_NSID_RADIUS 1
#define CHBIND_CODE_REQUEST 1
#define CHBIND_CODE_SUCCESS 2
#define CHBIND_CODE_FAILURE 3
/* Channel binding function prototypes */
fr_radius_packet_code_t chbind_process(request_t *request, CHBIND_REQ *chbind_req);
fr_pair_t *eap_chbind_packet2vp(TALLOC_CTX *ctx, chbind_packet_t *chbind);
chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_list_t *vps);
|
#ifdef STUB_ERROR_LIB
#include "stub_dserr.h"
void err_msg( const char *blah, ... )
{
return;
}
dsErrCode dsErrAdd( dsErrList *blah, ... )
{
return(0);
}
#endif
|
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file GPUTPCClusterRejection.h
/// \author David Rohr
#ifndef GPUTPCCLUSTERREJECTION_H
#define GPUTPCCLUSTERREJECTION_H
#include "GPUTPCGMMergerTypes.h"
namespace GPUCA_NAMESPACE
{
namespace gpu
{
struct GPUTPCClusterRejection {
template <bool C, class T = void, class S = void>
static constexpr inline bool GetProtectionStatus(int attach, bool& physics, bool& protect, T* counts = nullptr, S* mev200 = nullptr)
{
(void)counts; // Avoid incorrect -Wunused-but-set-parameter warning
(void)mev200;
if (attach == 0) {
return false;
} else if ((attach & gputpcgmmergertypes::attachGoodLeg) == 0) {
if constexpr (C) {
counts->nLoopers++;
}
return true;
} else if (attach & gputpcgmmergertypes::attachHighIncl) {
if constexpr (C) {
counts->nHighIncl++;
}
return true;
} else if (attach & gputpcgmmergertypes::attachTube) {
protect = true;
if constexpr (C) {
if (*mev200) {
counts->nTube200++;
} else {
counts->nTube++;
}
}
return false;
} else if ((attach & gputpcgmmergertypes::attachGood) == 0) {
protect = true;
if constexpr (C) {
counts->nRejected++;
}
return false;
} else {
physics = true;
return false;
}
}
static constexpr inline bool GetIsRejected(int attach)
{
bool physics = false, protect = false;
return GetProtectionStatus<false>(attach, physics, protect);
}
};
} // namespace gpu
} // namespace GPUCA_NAMESPACE
#endif
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTHREADPOOL_H
#define QTHREADPOOL_H
#include <QtCore/qglobal.h>
#include <QtCore/qthread.h>
#include <QtCore/qrunnable.h>
#ifndef QT_NO_THREAD
QT_BEGIN_NAMESPACE
class QThreadPoolPrivate;
class Q_CORE_EXPORT QThreadPool : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QThreadPool)
Q_PROPERTY(int expiryTimeout READ expiryTimeout WRITE setExpiryTimeout)
Q_PROPERTY(int maxThreadCount READ maxThreadCount WRITE setMaxThreadCount)
Q_PROPERTY(int activeThreadCount READ activeThreadCount)
friend class QFutureInterfaceBase;
public:
QThreadPool(QObject *parent = Q_NULLPTR);
~QThreadPool();
static QThreadPool *globalInstance();
void start(QRunnable *runnable, int priority = 0);
bool tryStart(QRunnable *runnable);
int expiryTimeout() const;
void setExpiryTimeout(int expiryTimeout);
int maxThreadCount() const;
void setMaxThreadCount(int maxThreadCount);
int activeThreadCount() const;
void reserveThread();
void releaseThread();
bool waitForDone(int msecs = -1);
void clear();
void cancel(QRunnable *runnable);
};
QT_END_NAMESPACE
#endif // QT_NO_THREAD
#endif
|
/**
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
*
* 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.
*
* In addition, as a special exception, the copyright holders of this
* program give permission to link the code of its release with the
* OpenSSL project's "OpenSSL" library (or with modified versions of it
* that use the same license as the "OpenSSL" library), and distribute
* the linked executables. You must obey the GNU General Public License
* in all respects for all of the code used other than "OpenSSL". If you
* modify file(s) with this exception, you may extend this exception to
* your version of the file(s), but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source files
* in the program, then also delete it here.
*
* 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/>.
**/
#pragma once
#include "ServerJob.h"
#include "../../Core/MultiThreading/Semaphore.h"
namespace Orthanc
{
class ServerScheduler : public ServerCommandInstance::IListener
{
private:
struct JobInfo
{
bool watched_;
bool cancel_;
size_t size_;
size_t success_;
size_t failures_;
std::string description_;
};
enum JobStatus
{
JobStatus_Running = 1,
JobStatus_Success = 2,
JobStatus_Failure = 3
};
typedef IServerCommand::ListOfStrings ListOfStrings;
typedef std::map<std::string, JobInfo> Jobs;
boost::mutex mutex_;
boost::condition_variable watchedJobFinished_;
Jobs jobs_;
SharedMessageQueue queue_;
bool finish_;
boost::thread worker_;
std::map<std::string, JobStatus> watchedJobStatus_;
Semaphore availableJob_;
JobInfo& GetJobInfo(const std::string& jobId);
virtual void SignalSuccess(const std::string& jobId);
virtual void SignalFailure(const std::string& jobId);
static void Worker(ServerScheduler* that);
void SubmitInternal(ServerJob& job,
bool watched);
public:
ServerScheduler(unsigned int maxjobs);
~ServerScheduler();
void Submit(ServerJob& job);
bool SubmitAndWait(ListOfStrings& outputs,
ServerJob& job);
bool SubmitAndWait(ServerJob& job);
bool IsRunning(const std::string& jobId);
void Cancel(const std::string& jobId);
// Returns a number between 0 and 1
float GetProgress(const std::string& jobId);
bool IsRunning(const ServerJob& job)
{
return IsRunning(job.GetId());
}
void Cancel(const ServerJob& job)
{
Cancel(job.GetId());
}
float GetProgress(const ServerJob& job)
{
return GetProgress(job.GetId());
}
void GetListOfJobs(ListOfStrings& jobs);
};
}
|
#include <unistd.h>
#include <stdbool.h>
#include <signal.h>
#include <stddef.h>
#include <sys/prctl.h>
#include <sys/ptrace.h>
#include <linux/limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#ifdef __NR_seccomp
#include <linux/seccomp.h>
#include <linux/filter.h>
#endif
#include "zdtmtst.h"
const char *test_doc = "Check that SECCOMP_MODE_FILTER is restored";
const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#ifdef __NR_seccomp
int get_seccomp_mode(pid_t pid)
{
FILE *f;
char buf[PATH_MAX];
sprintf(buf, "/proc/%d/status", pid);
f = fopen(buf, "r+");
if (!f) {
pr_perror("fopen failed");
return -1;
}
while (NULL != fgets(buf, sizeof(buf), f)) {
int mode;
if (sscanf(buf, "Seccomp:\t%d", &mode) != 1)
continue;
fclose(f);
return mode;
}
fclose(f);
return -1;
}
int filter_syscall(int syscall_nr)
{
struct sock_filter filter[] = {
BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),
BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, syscall_nr, 0, 1),
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW),
};
struct sock_fprog bpf_prog = {
.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
.filter = filter,
};
if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &bpf_prog) < 0) {
pr_perror("prctl failed");
return -1;
}
return 0;
}
int main(int argc, char ** argv)
{
pid_t pid;
int mode, status;
int sk_pair[2], sk, ret;
char c = 'K';
test_init(argc, argv);
if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) {
pr_perror("socketpair");
return -1;
}
pid = fork();
if (pid < 0) {
pr_perror("fork");
return -1;
}
if (pid == 0) {
sk = sk_pair[1];
close(sk_pair[0]);
/*
* Let's install a few filters separately to make sure the
* chaining actually works.
*/
if (filter_syscall(__NR_ptrace) < 0)
_exit(1);
/*
* The idea is to have a syscall that is used in restore_creds,
* so we can make sure seccomp is actually suspended when that
* is called.
*/
if (filter_syscall(__NR_setresuid) < 0)
_exit(1);
setuid(1000);
zdtm_seccomp = 1;
test_msg("SECCOMP_MODE_FILTER is enabled\n");
if (write(sk, &c, 1) != 1) {
pr_perror("write");
_exit(1);
}
if (read(sk, &c, 1) != 1) {
pr_perror("read");
_exit(1);
}
prctl(PR_SET_DUMPABLE, 1);
if (write(sk, &c, 1) != 1) {
pr_perror("write");
_exit(1);
}
if (read(sk, &c, 1) != 1) {
pr_perror("read");
_exit(1);
}
/* We expect to be killed by our policy above. */
ptrace(PTRACE_TRACEME);
syscall(__NR_exit, 0);
}
sk = sk_pair[0];
close(sk_pair[1]);
if ((ret = read(sk, &c, 1)) != 1) {
pr_perror("read %d", ret);
goto err;
}
test_daemon();
test_waitsig();
if (write(sk, &c, 1) != 1) {
pr_perror("write");
goto err;
}
if ((ret = read(sk, &c, 1)) != 1) {
pr_perror("read %d", ret);
goto err;
}
mode = get_seccomp_mode(pid);
if (write(sk, &c, 1) != 1) {
pr_perror("write");
goto err;
}
if (waitpid(pid, &status, 0) != pid) {
pr_perror("waitpid");
exit(1);
}
if (WTERMSIG(status) != SIGSYS) {
pr_perror("expected SIGSYS, got %d\n", WTERMSIG(status));
exit(1);
}
if (mode != SECCOMP_MODE_FILTER) {
fail("seccomp mode mismatch %d\n", mode);
return 1;
}
pass();
return 0;
err:
kill(pid, SIGKILL);
return 1;
}
#else /* __NR_seccomp */
#include "skip-me.c"
#endif /* __NR_seccomp */
|
/*************** <auto-copyright.pl BEGIN do not edit this line> **************
*
* VR Juggler is (C) Copyright 1998-2011 by Iowa State University
*
* Original Authors:
* Allen Bierbaum, Christopher Just,
* Patrick Hartling, Kevin Meinert,
* Carolina Cruz-Neira, Albert Baker
*
* 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 Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*************** <auto-copyright.pl END do not edit this line> ***************/
#ifndef _PERFORMER_JUGGLER_SOUND_NODE
#define _PERFORMER_JUGGLER_SOUND_NODE
#include <vrj/vrjConfig.h>
#include <Performer/pr/pfLinMath.h>
#include <vrj/Util/Debug.h>
#include <vrj/Draw/Pf/Util.h>
#include <Performer/pf/pfDCS.h>
#include <Performer/pf/pfTraverser.h>
#include <snx/sonix.h>
/**
* Performer-Juggler sound node.
* This node automatically updates the Sound's position information.
* You should keep a pointer to the Sound, so that you can trigger
* and change other properties of it.
*
* @note This pfSoundNode does not trigger the Sound object, you must do that.
*/
class pfSoundNode : public pfDCS
{
public:
/**
* @todo the constructor takes a Sound, which does not
* mean that it was aquired with a getHandle function... fixme..
* who manages this memory? should be sound manager... but...
* what if it wasn't created by the manager?
*/
pfSoundNode(const std::string& soundHandle, bool isPositional = true);
virtual ~pfSoundNode()
{
}
pfSoundNode& operator=(const pfSoundNode& rhs)
{
pfDCS::operator=(rhs);
mX = rhs.mX;
mY = rhs.mY;
mZ = rhs.mZ;
mSound = rhs.mSound;
mIsPositional = rhs.mIsPositional;
return *this;
}
/** Sets the listener. */
void setObs(const float x, const float y, const float z)
{
mX = x;
mY = y;
mZ = z;
}
const std::string& sound() const
{
return mSound;
}
void setSound(const std::string& sound)
{
mSound = sound;
}
void setPositional(const bool isPositional)
{
mIsPositional = isPositional;
}
public: // APP traversal
virtual int app(pfTraverser*);
virtual int needsApp()
{
return TRUE;
}
protected:
float mX, mY, mZ;
std::string mSound;
bool mIsPositional;
public: // Required for Performer class
static void init();
static pfType* getClassType()
{
return classType;
}
private:
static pfType* classType;
};
#endif
|
/*************** <auto-copyright.pl BEGIN do not edit this line> **************
*
* VR Juggler is (C) Copyright 1998-2011 by Iowa State University
*
* Original Authors:
* Allen Bierbaum, Christopher Just,
* Patrick Hartling, Kevin Meinert,
* Carolina Cruz-Neira, Albert Baker
*
* 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 Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*************** <auto-copyright.pl END do not edit this line> ***************/
#ifndef _TWEEK_H_INCLUDED_
#define _TWEEK_H_INCLUDED_
#include <tweek/tweekConfig.h>
#include <tweek/CORBA/CorbaManager.h>
#include <tweek/CORBA/SubjectManagerImpl.h>
#endif /* _TWEEK_H_INCLUDED_ */
|
/***************************************************************************
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* 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., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef _DrawViewSpreadsheet_h_
#define _DrawViewSpreadsheet_h_
#include <App/DocumentObject.h>
#include <App/PropertyLinks.h>
#include <App/PropertyStandard.h>
#include <App/PropertyGeo.h>
#include <App/FeaturePython.h>
#include "DrawViewSymbol.h"
namespace TechDraw
{
class TechDrawExport DrawViewSpreadsheet : public TechDraw::DrawViewSymbol
{
PROPERTY_HEADER(TechDraw::DrawViewSpreadsheet);
public:
DrawViewSpreadsheet(void);
virtual ~DrawViewSpreadsheet();
App::PropertyLink Source;
App::PropertyString CellStart;
App::PropertyString CellEnd;
App::PropertyString Font;
App::PropertyColor TextColor;
App::PropertyFloat LineWidth;
App::PropertyFloat TextSize;
virtual App::DocumentObjectExecReturn *execute(void);
std::string getSheetImage(void);
virtual const char* getViewProviderName(void) const {
return "TechDrawGui::ViewProviderSpreadsheet";
}
protected:
virtual void onChanged(const App::Property* prop);
std::vector<std::string> getAvailColumns(void);
std::string getSVGHead(void);
std::string getSVGTail(void);
private:
};
typedef App::FeaturePythonT<DrawViewSpreadsheet> DrawViewSpreadsheetPython;
} //namespace TechDraw
#endif
|
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
typedef NS_ENUM(NSUInteger, ESSBeaconType) {
kESSBeaconTypeEddystone = 1,
kESSBeaconTypeEddystoneEID = 2,
};
typedef NS_ENUM(NSUInteger, ESSFrameType) {
kESSEddystoneUnknownFrameType = 0,
kESSEddystoneUIDFrameType,
kESSEddystoneURLFrameType,
kESSEddystoneEIDFrameType,
kESSEddystoneTelemetryFrameType,
};
/**
*=-----------------------------------------------------------------------------------------------=
* ESSBeaconID
*=-----------------------------------------------------------------------------------------------=
*/
@interface ESSBeaconID : NSObject <NSCopying>
/**
* The type of the beacon. Currently only a couple of types are supported.
*/
@property(nonatomic, assign, readonly) ESSBeaconType beaconType;
/**
* The raw beaconID data.
*/
@property(nonatomic, copy, readonly) NSData *beaconID;
@end
/**
*=-----------------------------------------------------------------------------------------------=
* ESSBeaconInfo
*=-----------------------------------------------------------------------------------------------=
*/
@interface ESSBeaconInfo : NSObject
/**
* The most recent RSSI we got for this sighting. Sometimes the OS cannot compute one reliably, so
* this value can be null.
*/
@property(nonatomic, strong, readonly) NSNumber *RSSI;
/**
* The beaconID for this Eddystone. All beacons have an ID.
*/
@property(nonatomic, strong, readonly) ESSBeaconID *beaconID;
/**
* The telemetry that may or may not have been seen for this beacon. If it's set, the contents of
* it aren't terribly relevant to us, in general. See the Eddystone spec for more information
* if you're really interested in the exact details.
*/
@property(nonatomic, copy, readonly) NSData *telemetry;
/**
* Transmission power reported by beacon. This is in dB.
*/
@property(nonatomic, strong, readonly) NSNumber *txPower;
/**
* The scanner has seen a frame for an Eddystone. We'll need to know what type of Eddystone frame
* it is, as there are a few types.
*/
+ (ESSFrameType)frameTypeForFrame:(NSData *)frameData;
/**
* Given the service data for a frame we know to be a UID frame, an RSSI sighting,
* and -- optionally -- telemetry data (if we've seen it), create a new ESSBeaconInfo object to
* represent this Eddystone
*/
+ (instancetype)beaconInfoForUIDFrameData:(NSData *)UIDFrameData
telemetry:(NSData *)telemetry
RSSI:(NSNumber *)initialRSSI;
/**
* Given the service data for a frame we know to be a UID frame, an RSSI sighting,
* and -- optionally -- telemetry data (if we've seen it), create a new ESSBeaconInfo object to
* represent this Eddystone
*/
+ (instancetype)beaconInfoForEIDFrameData:(NSData *)EIDFrameData
telemetry:(NSData *)telemetry
RSSI:(NSNumber *)initialRSSI;
/**
* If we're given a URL frame, extract the URL from it.
*/
+ (NSURL *)parseURLFromFrameData:(NSData *)URLFrameData;
/**
* Convenience method to save everybody from creating these things all the time.
*/
+ (CBUUID *)eddystoneServiceID;
+ (ESSBeaconInfo *)testBeaconFromBeaconIDString:(NSString *)beaconID;
@end
|
/*
* Copyright 2015 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.
*/
#pragma once
#include <atomic>
#include <folly/Executor.h>
namespace folly {
class EventBase;
}
namespace folly { namespace wangle {
// An IOExecutor is an executor that operates on at least one EventBase. One of
// these EventBases should be accessible via getEventBase(). The event base
// returned by a call to getEventBase() is implementation dependent.
//
// Note that IOExecutors don't necessarily loop on the base themselves - for
// instance, EventBase itself is an IOExecutor but doesn't drive itself.
//
// Implementations of IOExecutor are eligible to become the global IO executor,
// returned on every call to getIOExecutor(), via setIOExecutor().
// These functions are declared in GlobalExecutor.h
//
// If getIOExecutor is called and none has been set, a default global
// IOThreadPoolExecutor will be created and returned.
class IOExecutor : public virtual Executor {
public:
virtual ~IOExecutor() {}
virtual EventBase* getEventBase() = 0;
};
}}
|
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
* Copyright (C) 2012 Intel Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PerformanceResourceTiming_h
#define PerformanceResourceTiming_h
#include "core/timing/PerformanceEntry.h"
#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
namespace blink {
class ResourceLoadTiming;
class ResourceTimingInfo;
class PerformanceResourceTiming final : public PerformanceEntry {
DEFINE_WRAPPERTYPEINFO();
public:
static PerformanceResourceTiming* create(const ResourceTimingInfo& info, double timeOrigin, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails)
{
return new PerformanceResourceTiming(info, timeOrigin, startTime, lastRedirectEndTime, m_allowTimingDetails, m_allowRedirectDetails);
}
static PerformanceResourceTiming* create(const ResourceTimingInfo& info, double timeOrigin, double startTime, bool m_allowTimingDetails)
{
return new PerformanceResourceTiming(info, timeOrigin, startTime, 0.0, m_allowTimingDetails, false);
}
AtomicString initiatorType() const;
double workerStart() const;
double redirectStart() const;
double redirectEnd() const;
double fetchStart() const;
double domainLookupStart() const;
double domainLookupEnd() const;
double connectStart() const;
double connectEnd() const;
double secureConnectionStart() const;
double requestStart() const;
double responseStart() const;
double responseEnd() const;
virtual bool isResource() override { return true; }
private:
PerformanceResourceTiming(const ResourceTimingInfo&, double timeOrigin, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails);
virtual ~PerformanceResourceTiming();
double workerReady() const;
AtomicString m_initiatorType;
double m_timeOrigin;
RefPtr<ResourceLoadTiming> m_timing;
double m_lastRedirectEndTime;
double m_finishTime;
bool m_didReuseConnection;
bool m_allowTimingDetails;
bool m_allowRedirectDetails;
};
} // namespace blink
#endif // PerformanceResourceTiming_h
|
/*
* Copyright 2015 Twitter, 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 SRC_CPP_SVCS_STMGR_SRC_MANAGER_STMGR_CLIENT_H_
#define SRC_CPP_SVCS_STMGR_SRC_MANAGER_STMGR_CLIENT_H_
#include "network/network_error.h"
#include "proto/messages.h"
#include "network/network.h"
#include "basics/basics.h"
namespace heron {
namespace common {
class MetricsMgrSt;
class MultiCountMetric;
}
}
namespace heron {
namespace stmgr {
class StMgrClientMgr;
class StMgrClient : public Client {
public:
StMgrClient(EventLoop* eventLoop, const NetworkOptions& _options, const sp_string& _topology_name,
const sp_string& _topology_id, const sp_string& _our_id, const sp_string& _other_id,
StMgrClientMgr* _client_manager,
heron::common::MetricsMgrSt* _metrics_manager_client);
virtual ~StMgrClient();
void Quit();
void SendTupleStreamMessage(proto::stmgr::TupleStreamMessage2& _msg);
void SendStartBackPressureMessage();
void SendStopBackPressureMessage();
protected:
virtual void HandleConnect(NetworkErrorCode status);
virtual void HandleClose(NetworkErrorCode status);
private:
void HandleHelloResponse(void*, proto::stmgr::StrMgrHelloResponse* _response, NetworkErrorCode);
void HandleTupleStreamMessage(proto::stmgr::TupleStreamMessage2* _message);
void OnReConnectTimer();
void SendHelloRequest();
// Do back pressure
virtual void StartBackPressureConnectionCb(Connection* _connection);
// Relieve back pressure
virtual void StopBackPressureConnectionCb(Connection* _connection);
sp_string topology_name_;
sp_string topology_id_;
sp_string our_stmgr_id_;
sp_string other_stmgr_id_;
bool quit_;
StMgrClientMgr* client_manager_;
// Metrics
heron::common::MetricsMgrSt* metrics_manager_client_;
heron::common::MultiCountMetric* stmgr_client_metrics_;
// Configs to be read
sp_int32 reconnect_other_streammgrs_interval_sec_;
// Counters
sp_int64 ndropped_messages_;
};
} // namespace stmgr
} // namespace heron
#endif // SRC_CPP_SVCS_STMGR_SRC_MANAGER_STMGR_CLIENT_H_
|
//
// LDKItemStatementViewController.h
// LDCore
//
// Created by Bryan Nagle on 3/11/15.
// Copyright (c) 2015 Liquid Analytics. All rights reserved.
//
#import <UIKit/UIKit.h>
@class LDMSearchResults, LDKMultiLineSelectConfig;
@protocol LDKItemStatementViewControllerDelegate;
@interface LDKMultiLineSelectViewController : UIViewController
@property (nonatomic, strong, nullable) LDMSearchResults *results;
@property (nonatomic, weak, nullable) id<LDKItemStatementViewControllerDelegate> delegate;
@property (nonatomic, copy) NSInteger (^__nullable numberOfLinesForItem)(LDMItem * __nullable item);
@property (nonatomic, copy, nullable) LDKMultiLineSelectConfig *__nullable (^configForItem)(LDMItem * __nullable item);
@property (nonatomic, copy, nullable) BOOL (^shouldDeleteItem)(LDMItem * __nullable item);
@property (nonatomic, copy, nullable) void (^didSelectItem)(LDMItem * __nullable item);
+ (LDKMultiLineSelectViewController * __nonnull )multiLineViewController;
+ (LDKMultiLineSelectViewController * __nonnull )multiLineViewControllerWithItems:(NSArray * __nullable )items;
@end
@interface LDKMultiLineSelectConfig : NSObject
@property (nonatomic, strong, nullable) NSArray *lines;
@property (nonatomic, strong, nullable) UIImage *image;
@property (nonatomic, assign) BOOL disableDelete;
+ (LDKMultiLineSelectConfig * __nullable )config;
+ (LDKMultiLineSelectConfig * __nullable )configWithLines:(NSArray *__nonnull)lines image:(UIImage *__nullable)image disableDelete:(BOOL)disableDelete;
@end
@protocol LDKItemStatementViewControllerDelegate <NSObject>
- (NSInteger)multiLineViewController:(LDKMultiLineSelectViewController * __nullable )viewController numberOfLinesForItem:(LDMItem * __nullable )item;
- (LDKMultiLineSelectConfig * __nullable )multiLineViewController:(LDKMultiLineSelectViewController * __nullable )viewController configForItem:(LDMItem * __nullable )item;
- (BOOL)multiLineViewController:(LDKMultiLineSelectViewController * __nullable )viewController shouldDeleteItem:(LDMItem * __nullable )item;
- (void)multiLineViewController:(LDKMultiLineSelectViewController * __nullable )viewController didSelectItem:(LDMItem * __nullable )item;
@end
|
//===--- DurationFactoryFloatCheck.h - clang-tidy ---------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H
#include "../ClangTidy.h"
namespace clang {
namespace tidy {
namespace abseil {
/// This check finds cases where `Duration` factories are being called with
/// floating point arguments, but could be called using integer arguments.
/// It handles explicit casts and floating point literals with no fractional
/// component.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/abseil-duration-factory-float.html
class DurationFactoryFloatCheck : public ClangTidyCheck {
public:
DurationFactoryFloatCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace abseil
} // namespace tidy
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_
#define CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_
#include <vector>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h"
#include "base/strings/string16.h"
#include "base/time.h"
#include "build/build_config.h"
#include "chrome/browser/history/history_types.h"
#include "googleurl/src/gurl.h"
struct ImportedBookmarkEntry;
struct ImportedFaviconUsage;
class Profile;
class TemplateURL;
namespace content {
struct PasswordForm;
}
#if defined(OS_WIN)
struct IE7PasswordInfo;
#endif
// ProfileWriter encapsulates profile for writing entries into it.
// This object must be invoked on UI thread.
class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> {
public:
explicit ProfileWriter(Profile* profile);
// These functions return true if the corresponding model has been loaded.
// If the models haven't been loaded, the importer waits to run until they've
// completed.
virtual bool BookmarkModelIsLoaded() const;
virtual bool TemplateURLServiceIsLoaded() const;
// Helper methods for adding data to local stores.
virtual void AddPasswordForm(const content::PasswordForm& form);
#if defined(OS_WIN)
virtual void AddIE7PasswordInfo(const IE7PasswordInfo& info);
#endif
virtual void AddHistoryPage(const history::URLRows& page,
history::VisitSource visit_source);
virtual void AddHomepage(const GURL& homepage);
// Adds the |bookmarks| to the bookmark model.
//
// (a) If the bookmarks bar is empty:
// (i) If |bookmarks| includes at least one bookmark that was originally
// located in a toolbar, all such bookmarks are imported directly to
// the toolbar; any other bookmarks are imported to a subfolder in
// the toolbar.
// (i) If |bookmarks| includes no bookmarks that were originally located
// in a toolbar, all bookmarks are imported directly to the toolbar.
// (b) If the bookmarks bar is not empty, all bookmarks are imported to a
// subfolder in the toolbar.
//
// In either case, if a subfolder is created, the name will be the value of
// |top_level_folder_name|, unless a folder with this name already exists.
// If a folder with this name already exists, then the name is uniquified.
// For example, if |first_folder_name| is 'Imported from IE' and a folder with
// the name 'Imported from IE' already exists in the bookmarks toolbar, then
// we will instead create a subfolder named 'Imported from IE (1)'.
virtual void AddBookmarks(
const std::vector<ImportedBookmarkEntry>& bookmarks,
const string16& top_level_folder_name);
virtual void AddFavicons(
const std::vector<ImportedFaviconUsage>& favicons);
// Adds the TemplateURLs in |template_urls| to the local store. The local
// store becomes the owner of the TemplateURLs. Some TemplateURLs in
// |template_urls| may conflict (same keyword or same host name in the URL)
// with existing TemplateURLs in the local store, in which case the existing
// ones take precedence and the duplicates in |template_urls| are deleted.
// If |unique_on_host_and_path| is true, a TemplateURL is only added if there
// is not an existing TemplateURL that has a replaceable search url with the
// same host+path combination.
virtual void AddKeywords(ScopedVector<TemplateURL> template_urls,
bool unique_on_host_and_path);
protected:
friend class base::RefCountedThreadSafe<ProfileWriter>;
virtual ~ProfileWriter();
private:
Profile* const profile_;
DISALLOW_COPY_AND_ASSIGN(ProfileWriter);
};
#endif // CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_
|
// Copyright 2018 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 DEVICE_BLUETOOTH_TEST_FAKE_GATT_WRITE_RESULT_WINRT_H_
#define DEVICE_BLUETOOTH_TEST_FAKE_GATT_WRITE_RESULT_WINRT_H_
#include <windows.devices.bluetooth.genericattributeprofile.h>
#include <wrl/implements.h>
#include <stdint.h>
#include "device/bluetooth/bluetooth_gatt_service.h"
namespace device {
class FakeGattWriteResultWinrt
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<
Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>,
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattWriteResult> {
public:
FakeGattWriteResultWinrt();
explicit FakeGattWriteResultWinrt(
BluetoothGattService::GattErrorCode error_code);
FakeGattWriteResultWinrt(const FakeGattWriteResultWinrt&) = delete;
FakeGattWriteResultWinrt& operator=(const FakeGattWriteResultWinrt&) = delete;
~FakeGattWriteResultWinrt() override;
// IGattWriteResult:
IFACEMETHODIMP get_Status(
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus* value) override;
IFACEMETHODIMP get_ProtocolError(
ABI::Windows::Foundation::IReference<uint8_t>** value) override;
private:
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus status_ = ABI::Windows::Devices::Bluetooth::
GenericAttributeProfile::GattCommunicationStatus_Success;
uint8_t protocol_error_ = 0;
};
} // namespace device
#endif // DEVICE_BLUETOOTH_TEST_FAKE_GATT_WRITE_RESULT_WINRT_H_
|
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once
#include <wangle/channel/Handler.h>
namespace wangle {
/**
* An OutboundHandler which encodes message in a stream-like fashion from one
* message to IOBuf. Inverse of ByteToMessageDecoder.
*/
template <typename M>
class MessageToByteEncoder : public OutboundHandler<M, std::unique_ptr<folly::IOBuf>> {
public:
typedef typename OutboundHandler<M, std::unique_ptr<folly::IOBuf>>::Context Context;
virtual std::unique_ptr<folly::IOBuf> encode(M& msg) = 0;
folly::Future<folly::Unit> write(Context* ctx, M msg) override {
auto buf = encode(msg);
return buf ? ctx->fireWrite(std::move(buf)) : folly::makeFuture();
}
};
} // namespace wangle
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BROWSER_CAST_EXTENSION_URL_LOADER_FACTORY_H_
#define CHROMECAST_BROWSER_CAST_EXTENSION_URL_LOADER_FACTORY_H_
#include "base/no_destructor.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/cpp/self_deleting_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {
class BrowserContext;
}
namespace extensions {
class ExtensionRegistry;
}
namespace chromecast {
namespace shell {
// URLLoaderFactory that creates URLLoader instances for URLs with the
// extension scheme. Cast uses its own factory that resues the extensions
// URLLoader implementation because Cast sometimes loads extension resources
// from the web.
class CastExtensionURLLoaderFactory
: public network::SelfDeletingURLLoaderFactory {
public:
// Returns mojo::PendingRemote to a newly constructed
// CastExtensionURLLoaderFactory. The factory is self-owned - it will delete
// itself once there are no more receivers (including the receiver associated
// with the returned mojo::PendingRemote and the receivers bound by the Clone
// method).
//
// |extension_factory| is the default extension factory that will be used if
// the request isn't fetched from the web.
static mojo::PendingRemote<network::mojom::URLLoaderFactory> Create(
content::BrowserContext* browser_context,
mojo::PendingRemote<network::mojom::URLLoaderFactory> extension_factory);
CastExtensionURLLoaderFactory(const CastExtensionURLLoaderFactory&) = delete;
CastExtensionURLLoaderFactory& operator=(
const CastExtensionURLLoaderFactory&) = delete;
static void EnsureShutdownNotifierFactoryBuilt();
private:
~CastExtensionURLLoaderFactory() override;
// |extension_factory| is the default extension factory that will be used if
// the request isn't fetched from the web.
CastExtensionURLLoaderFactory(
content::BrowserContext* browser_context,
mojo::PendingRemote<network::mojom::URLLoaderFactory> extension_factory,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver);
// network::mojom::URLLoaderFactory:
void CreateLoaderAndStart(
mojo::PendingReceiver<network::mojom::URLLoader> loader_receiver,
int32_t request_id,
uint32_t options,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation)
override;
void OnBrowserContextDestroyed();
class BrowserContextShutdownNotifierFactory
: public BrowserContextKeyedServiceShutdownNotifierFactory {
public:
static BrowserContextShutdownNotifierFactory* GetInstance();
// No copying.
BrowserContextShutdownNotifierFactory(
const BrowserContextShutdownNotifierFactory&) = delete;
BrowserContextShutdownNotifierFactory& operator=(
const BrowserContextShutdownNotifierFactory&) = delete;
private:
friend class base::NoDestructor<BrowserContextShutdownNotifierFactory>;
BrowserContextShutdownNotifierFactory();
};
extensions::ExtensionRegistry* extension_registry_;
mojo::Remote<network::mojom::URLLoaderFactory> extension_factory_;
scoped_refptr<network::SharedURLLoaderFactory> network_factory_;
base::CallbackListSubscription browser_context_shutdown_subscription_;
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_CAST_EXTENSION_URL_LOADER_FACTORY_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// See net/disk_cache/disk_cache.h for the public interface of the cache.
#ifndef NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_
#define NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_
#include <stddef.h>
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "net/base/net_export.h"
#include "net/disk_cache/blockfile/file.h"
#include "net/disk_cache/blockfile/file_block.h"
#include "net/net_buildflags.h"
namespace base {
class FilePath;
}
namespace disk_cache {
// This class implements a memory mapped file used to access block-files. The
// idea is that the header and bitmap will be memory mapped all the time, and
// the actual data for the blocks will be access asynchronously (most of the
// time).
class NET_EXPORT_PRIVATE MappedFile : public File {
public:
MappedFile() : File(true), init_(false) {}
MappedFile(const MappedFile&) = delete;
MappedFile& operator=(const MappedFile&) = delete;
// Performs object initialization. name is the file to use, and size is the
// amount of data to memory map from the file. If size is 0, the whole file
// will be mapped in memory.
void* Init(const base::FilePath& name, size_t size);
void* buffer() const {
return buffer_;
}
// Loads or stores a given block from the backing file (synchronously).
bool Load(const FileBlock* block);
bool Store(const FileBlock* block);
// Flush the memory-mapped section to disk (synchronously).
void Flush();
// Heats up the file system cache and make sure the file is fully
// readable (synchronously).
bool Preload();
private:
~MappedFile() override;
bool init_;
#if BUILDFLAG(IS_WIN)
HANDLE section_;
#endif
void* buffer_; // Address of the memory mapped buffer.
size_t view_size_; // Size of the memory pointed by buffer_.
#if BUILDFLAG(POSIX_AVOID_MMAP)
raw_ptr<void>
snapshot_; // Copy of the buffer taken when it was last flushed.
#endif
};
// Helper class for calling Flush() on exit from the current scope.
class ScopedFlush {
public:
explicit ScopedFlush(MappedFile* file) : file_(file) {}
~ScopedFlush() {
file_->Flush();
}
private:
raw_ptr<MappedFile> file_;
};
} // namespace disk_cache
#endif // NET_DISK_CACHE_BLOCKFILE_MAPPED_FILE_H_
|
/**
* \brief this file contains definitions for parsing the USB descriptors
*/
/*
* Copyright (c) 2007-2013 ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef USB_PARSE_H_
#define USB_PARSE_H_
struct usb_iface_parse_state {
struct usb_descriptor *desc;
uint8_t iface_index; /* current interface index */
uint8_t iface_no_last;
uint8_t iface_index_alt; /* current alternate setting */
};
struct usb_descriptor *usb_parse_next_descriptor(
struct usb_config_descriptor *cd, struct usb_descriptor *_desc);
struct usb_interface_descriptor *usb_parse_next_iface(
struct usb_config_descriptor *cd, struct usb_iface_parse_state *ps);
struct usb_endpoint_descriptor *usb_parse_next_edesc(
struct usb_config_descriptor *cd, struct usb_endpoint_descriptor *ped);
#endif /* USB_PARSE_H_ */
|
/* fft/hc_unpack.c
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
int
FUNCTION(gsl_fft_halfcomplex,unpack) (const BASE halfcomplex_coefficient[],
BASE complex_coefficient[],
const size_t stride, const size_t n)
{
size_t i;
if (n == 0)
{
GSL_ERROR ("length n must be positive integer", GSL_EDOM);
}
REAL(complex_coefficient,stride,0) = halfcomplex_coefficient[0];
IMAG(complex_coefficient,stride,0) = 0.0;
for (i = 1; i < n - i; i++)
{
const ATOMIC hc_real = halfcomplex_coefficient[(2 * i - 1) * stride];
const ATOMIC hc_imag = halfcomplex_coefficient[2 * i * stride];
REAL(complex_coefficient,stride,i) = hc_real;
IMAG(complex_coefficient,stride,i) = hc_imag;
REAL(complex_coefficient,stride,n - i) = hc_real;
IMAG(complex_coefficient,stride,n - i) = -hc_imag;
}
if (i == n - i)
{
REAL(complex_coefficient,stride,i) = halfcomplex_coefficient[(n - 1) * stride];
IMAG(complex_coefficient,stride,i) = 0.0;
}
return 0;
}
int
FUNCTION(gsl_fft_halfcomplex,radix2_unpack) (const BASE halfcomplex_coefficient[],
BASE complex_coefficient[],
const size_t stride, const size_t n)
{
size_t i;
if (n == 0)
{
GSL_ERROR ("length n must be positive integer", GSL_EDOM);
}
REAL(complex_coefficient,stride,0) = halfcomplex_coefficient[0];
IMAG(complex_coefficient,stride,0) = 0.0;
for (i = 1; i < n - i; i++)
{
const ATOMIC hc_real = halfcomplex_coefficient[i * stride];
const ATOMIC hc_imag = halfcomplex_coefficient[(n - i) * stride];
REAL(complex_coefficient,stride,i) = hc_real;
IMAG(complex_coefficient,stride,i) = hc_imag;
REAL(complex_coefficient,stride,n - i) = hc_real;
IMAG(complex_coefficient,stride,n - i) = -hc_imag;
}
if (i == n - i)
{
REAL(complex_coefficient,stride,i) = halfcomplex_coefficient[i * stride];
IMAG(complex_coefficient,stride,i) = 0.0;
}
return 0;
}
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#warning "You should include <sys/socket.h>. This time I will do it for you."
#endif
#include <sys/socket.h>
|
#pragma once
/**
Pin definitions for Arduino (Pro Mini with ATmega328P)
*/
#include "pins.h"
#define D0 D,0
#define D1 D,1
#define D2 D,2
#define D3 D,3
#define D4 D,4
#define D5 D,5
#define D6 D,6
#define D7 D,7
#define D8 B,0
#define D9 B,1
#define D10 B,2
// MOSI MISO SCK - not good for input
#define D11 B,3
#define D12 B,4
#define D13 B,5
#define D14 C,0
#define D15 C,1
#define D16 C,2
#define D17 C,3
#define D18 C,4
#define D19 C,5
#define D20 C,6
#define D21 C,7
#define A0 C,0
#define A1 C,1
#define A2 C,2
#define A3 C,3
#define A4 C,4
#define A5 C,5
#define A6 C,6
#define A7 C,7
|
/* vector/file_source.c
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
int
FUNCTION (gsl_vector, fread) (FILE * stream, TYPE (gsl_vector) * v)
{
int status = FUNCTION (gsl_block, raw_fread) (stream,
v->data,
v->size,
v->stride);
return status;
}
int
FUNCTION (gsl_vector, fwrite) (FILE * stream, const TYPE (gsl_vector) * v)
{
int status = FUNCTION (gsl_block, raw_fwrite) (stream,
v->data,
v->size,
v->stride);
return status;
}
#if !(USES_LONGDOUBLE && !HAVE_PRINTF_LONGDOUBLE)
int
FUNCTION (gsl_vector, fprintf) (FILE * stream, const TYPE (gsl_vector) * v,
const char *format)
{
int status = FUNCTION (gsl_block, raw_fprintf) (stream,
v->data,
v->size,
v->stride,
format);
return status;
}
int
FUNCTION (gsl_vector, fscanf) (FILE * stream, TYPE (gsl_vector) * v)
{
int status = FUNCTION (gsl_block, raw_fscanf) (stream,
v->data,
v->size,
v->stride);
return status;
}
#endif
|
// Created by Monte Hurd on 8/5/15.
// Copyright (c) 2015 Wikimedia Foundation. Provided under MIT-style license; please copy and modify!
@protocol WMFSectionHeaderEditDelegate <NSObject>
- (void)editSection:(NSNumber*)sectionId;
- (BOOL)isArticleEditable;
@end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.