text
stringlengths 4
6.14k
|
|---|
#ifndef __NETIF_ETHERNETIF_H__
#define __NETIF_ETHERNETIF_H__
//#include "lwip/netif.h"
#include <rtthread.h>
#define NIOCTL_GADDR 0x01
#define ETHERNET_MTU 1500
#if 0
struct pbuf
{
rt_uint16_t len;
};
struct eth_device
{
/* inherit from rt_device */
struct rt_device parent;
//struct eth_addr *ethaddr;
//struct netif *netif;
struct rt_semaphore tx_ack;
struct rt_semaphore tx_msg;
/* eth device interface */
struct pbuf* (*eth_rx)(rt_device_t dev);
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
};
#endif
rt_err_t eth_device_ready(struct eth_device* dev);
rt_err_t eth_device_init(struct eth_device* dev, const char* name);
rt_err_t eth_system_device_init(void);
#endif /* __NETIF_ETHERNETIF_H__ */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2015 Advanced Micro Devices, Inc.
* Copyright (C) 2015 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __PI_STONEYRIDGE_NORTHBRIDGE_H__
#define __PI_STONEYRIDGE_NORTHBRIDGE_H__
#include <arch/io.h>
#include <device/device.h>
/* D18F0 - HT Configuration Registers */
#define D18F0_NODE_ID 0x60
#define D18F0_CPU_CNT 0x62 /* BKDG defines as a field in DWORD 0x60 */
# define CPU_CNT_MASK 0x1f /* CpuCnt + 1 = no. CPUs */
/* D18F1 - Address Map Registers */
#define D18F1_MMIO_BASE0_LO 0x80
# define MMIO_WE (1 << 1)
# define MMIO_RE (1 << 0)
#define D18F1_MMIO_LIMIT0_LO 0x84
# define MMIO_NP (1 << 7)
#define D18F1_IO_BASE0 0xc0
# define IO_WE (1 << 1)
# define IO_RE (1 << 0)
#define D18F1_IO_LIMIT0 0xc4
#define D18F1_DRAM_HOLE 0xf0
# define DRAM_HOIST_VALID (1 << 1)
# define DRAM_HOLE_VALID (1 << 0)
#define D18F1_VGAEN 0xf4
# define VGA_ADDR_ENABLE (1 << 0)
enum {
/* SMM handler area. */
SMM_SUBREGION_HANDLER,
/* SMM cache region. */
SMM_SUBREGION_CACHE,
/* Chipset specific area. */
SMM_SUBREGION_CHIPSET,
/* Total sub regions supported. */
SMM_SUBREGION_NUM,
};
/*
* Fills in the arguments for the entire SMM region covered by chipset
* protections. e.g. TSEG.
*/
void smm_region_info(void **start, size_t *size);
/*
* Fills in the start and size for the requested SMM subregion. Returns
* 0 on susccess, < 0 on failure.
*/
int smm_subregion(int sub, void **start, size_t *size);
void domain_enable_resources(device_t dev);
void domain_read_resources(device_t dev);
void domain_set_resources(device_t dev);
void fam15_finalize(void *chip_info);
void setup_uma_memory(void);
#endif /* __PI_STONEYRIDGE_NORTHBRIDGE_H__ */
|
/*
* LCD panel driver for Sharp LQ043T1DG01
*
* Copyright (C) 2009 Texas Instruments Inc
* Author: Vaibhav Hiremath <hvaibhav@ti.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* 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/>.
*/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <plat/display.h>
static struct omap_video_timings sharp_lq043t1dg01_timings = {
.x_res = 480,
.y_res = 272,
.pixel_clock = 9000,
.hsw = 42,
.hfp = 3,
.hbp = 2,
.vsw = 11,
.vfp = 3,
.vbp = 2,
};
static int sharp_lq043t1dg01_panel_probe(struct omap_dss_device *dssdev)
{
printk("%s: Called\n", __FUNCTION__);
dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
OMAP_DSS_LCD_IHS; // | OMAP_DSS_LCD_IEO;
dssdev->panel.acb = 0x28;
dssdev->panel.timings = sharp_lq043t1dg01_timings;
return 0;
}
static void sharp_lq043t1dg01_panel_remove(struct omap_dss_device *dssdev)
{
}
static int sharp_lq043t1dg01_panel_pre_enable(struct omap_dss_device *dssdev)
{
int r = 0;
printk("%s: Called\n", __FUNCTION__);
if (dssdev->platform_pre_enable)
r = dssdev->platform_pre_enable(dssdev);
return r;
}
static int sharp_lq043t1dg01_panel_enable(struct omap_dss_device *dssdev)
{
int r = 0;
printk("%s: Called\n", __FUNCTION__);
/* wait couple of vsyncs until enabling the LCD */
msleep(50);
if (dssdev->platform_enable)
r = dssdev->platform_enable(dssdev);
return r;
}
static void sharp_lq043t1dg01_panel_disable(struct omap_dss_device *dssdev)
{
printk("%s: Called\n", __FUNCTION__);
if (dssdev->platform_disable)
dssdev->platform_disable(dssdev);
/* wait at least 5 vsyncs after disabling the LCD */
msleep(100);
}
static int sharp_lq043t1dg01_panel_suspend(struct omap_dss_device *dssdev)
{
sharp_lq043t1dg01_panel_disable(dssdev);
return 0;
}
static int sharp_lq043t1dg01_panel_pre_resume(struct omap_dss_device *dssdev)
{
return sharp_lq043t1dg01_panel_pre_enable(dssdev);
}
static int sharp_lq043t1dg01_panel_resume(struct omap_dss_device *dssdev)
{
return sharp_lq043t1dg01_panel_enable(dssdev);
}
static struct omap_dss_driver sharp_lq043t1dg01_driver = {
.probe = sharp_lq043t1dg01_panel_probe,
.remove = sharp_lq043t1dg01_panel_remove,
.pre_enable = sharp_lq043t1dg01_panel_pre_enable,
.enable = sharp_lq043t1dg01_panel_enable,
.disable = sharp_lq043t1dg01_panel_disable,
.suspend = sharp_lq043t1dg01_panel_suspend,
.pre_resume = sharp_lq043t1dg01_panel_pre_resume,
.resume = sharp_lq043t1dg01_panel_resume,
.driver = {
.name = "sharp_lq043t1dg01_panel",
.owner = THIS_MODULE,
},
};
static int __init sharp_lq043t1dg01_panel_drv_init(void)
{
printk("%s: Called\n", __FUNCTION__);
return omap_dss_register_driver(&sharp_lq043t1dg01_driver);
}
static void __exit sharp_lq043t1dg01_panel_drv_exit(void)
{
omap_dss_unregister_driver(&sharp_lq043t1dg01_driver);
}
module_init(sharp_lq043t1dg01_panel_drv_init);
module_exit(sharp_lq043t1dg01_panel_drv_exit);
MODULE_LICENSE("GPL");
|
/**
* @file
*/
/*
Copyright (C) 2002-2015 UFO: Alien Invasion.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
#include <gtk/gtk.h>
#include <string>
#include "sidebar.h"
namespace sidebar
{
class PrefabSelector : public ui::SidebarComponent
{
private:
GtkWidget* _widget;
GtkTreeStore* _store;
GtkTreeModel* _fileFiltered;
GtkTreeModel* _fileSorted;
GtkTreeView* _view;
GtkEntry* _filterEntry;
int _selectedSelectionStrategy;
private:
// Private constructor, creates GTK widgets
PrefabSelector ();
/* GTK CALLBACKS */
static gboolean callbackFilterFiles (GtkTreeModel *model, GtkTreeIter *iter, PrefabSelector *self);
static gboolean callbackRefilter (PrefabSelector *self);
static void callbackSelectionOptionToggleExtend (GtkWidget *widget, PrefabSelector *self);
static void callbackSelectionOptionToggleReplace (GtkWidget *widget, PrefabSelector *self);
static void callbackSelectionOptionToggleUnselect (GtkWidget *widget, PrefabSelector *self);
static gint callbackButtonPress (GtkWidget *widget, GdkEventButton *event, PrefabSelector *self);
/* GTK CALLBACK HELPER FUNCTIONS */
static gboolean FilterFileOrDirectory (GtkTreeModel *model, GtkTreeIter *entry, PrefabSelector *self);
static gboolean FilterDirectory (GtkTreeModel *model, GtkTreeIter *possibleDirectory, PrefabSelector *self);
public:
/** greebo: Contains the static instance of this dialog.
* Constructs the instance and calls toggle() when invoked.
*/
static PrefabSelector& Instance ();
static std::string GetFullPath (const std::string& file);
GtkWidget* getWidget () const;
const std::string getTitle() const;
};
}
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
#pragma once
#ifndef __COSMICOS__
#define __COSMICOS__
#include "emu.h"
#include "cpu/cosmac/cosmac.h"
#include "imagedev/cassette.h"
#include "machine/ram.h"
#include "imagedev/snapquik.h"
#include "machine/rescap.h"
#include "sound/cdp1864.h"
#include "sound/speaker.h"
#include "video/dm9368.h"
#define CDP1802_TAG "ic19"
#define CDP1864_TAG "ic3"
#define DM9368_TAG "ic10"
#define SCREEN_TAG "screen"
enum
{
LED_RUN = 0,
LED_LOAD,
LED_PAUSE,
LED_RESET,
LED_D7,
LED_D6,
LED_D5,
LED_D4,
LED_D3,
LED_D2,
LED_D1,
LED_D0,
LED_Q,
LED_CASSETTE
};
class cosmicos_state : public driver_device
{
public:
cosmicos_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, CDP1802_TAG),
m_cti(*this, CDP1864_TAG),
m_led(*this, DM9368_TAG),
m_cassette(*this, "cassette"),
m_speaker(*this, "speaker"),
m_ram(*this, RAM_TAG),
m_rom(*this, CDP1802_TAG),
m_key_row(*this, {"Y1", "Y2", "Y3", "Y4"}),
m_io_data(*this, "DATA"),
m_special(*this, "SPECIAL"),
m_buttons(*this, "BUTTONS")
{ }
required_device<cosmac_device> m_maincpu;
required_device<cdp1864_device> m_cti;
required_device<dm9368_device> m_led;
required_device<cassette_image_device> m_cassette;
required_device<speaker_sound_device> m_speaker;
required_device<ram_device> m_ram;
required_memory_region m_rom;
required_ioport_array<4> m_key_row;
required_ioport m_io_data;
required_ioport m_special;
required_ioport m_buttons;
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( video_off_r );
DECLARE_READ8_MEMBER( video_on_r );
DECLARE_WRITE8_MEMBER( audio_latch_w );
DECLARE_READ8_MEMBER( hex_keyboard_r );
DECLARE_WRITE8_MEMBER( hex_keylatch_w );
DECLARE_READ8_MEMBER( reset_counter_r );
DECLARE_WRITE8_MEMBER( segment_w );
DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( display_w );
DECLARE_WRITE_LINE_MEMBER( dmaout_w );
DECLARE_WRITE_LINE_MEMBER( efx_w );
DECLARE_READ_LINE_MEMBER( wait_r );
DECLARE_READ_LINE_MEMBER( clear_r );
DECLARE_READ_LINE_MEMBER( ef1_r );
DECLARE_READ_LINE_MEMBER( ef2_r );
DECLARE_READ_LINE_MEMBER( ef3_r );
DECLARE_READ_LINE_MEMBER( ef4_r );
DECLARE_WRITE_LINE_MEMBER( q_w );
DECLARE_READ8_MEMBER( dma_r );
DECLARE_WRITE8_MEMBER( sc_w );
DECLARE_INPUT_CHANGED_MEMBER( data );
DECLARE_INPUT_CHANGED_MEMBER( enter );
DECLARE_INPUT_CHANGED_MEMBER( single_step );
DECLARE_INPUT_CHANGED_MEMBER( run );
DECLARE_INPUT_CHANGED_MEMBER( load );
DECLARE_INPUT_CHANGED_MEMBER( cosmicos_pause );
DECLARE_INPUT_CHANGED_MEMBER( reset );
DECLARE_INPUT_CHANGED_MEMBER( clear_data );
DECLARE_INPUT_CHANGED_MEMBER( memory_protect );
DECLARE_INPUT_CHANGED_MEMBER( memory_disable );
DECLARE_QUICKLOAD_LOAD_MEMBER( cosmicos );
void set_cdp1802_mode(int mode);
void clear_input_data();
/* CPU state */
int m_wait;
int m_clear;
int m_sc1;
/* memory state */
UINT8 m_data;
int m_boot;
int m_ram_protect;
int m_ram_disable;
/* keyboard state */
UINT8 m_keylatch;
/* display state */
UINT8 m_segment;
int m_digit;
int m_counter;
int m_q;
int m_dmaout;
int m_efx;
int m_video_on;
DECLARE_DRIVER_INIT(cosmicos);
TIMER_DEVICE_CALLBACK_MEMBER(digit_tick);
TIMER_DEVICE_CALLBACK_MEMBER(int_tick);
};
#endif
|
#ifndef __GL_UTILITY_H__
#define __GL_UTILITY_H__
#include "./common.h"
class GL_Utility
{
public:
static void polarview(float distance, float twist, float elevation, float azimuth);
static void reshape(int width, int height);
};
#endif
|
#ifndef LIVELINESSDAO_H
#define LIVELINESSDAO_H
#include "AnalysisDao.h"
#include "Cluster.h"
#include "DBInfo.h"
using namespace spikestream;
namespace spikestream {
class LivelinessDao : public AnalysisDao {
public:
LivelinessDao(const DBInfo& dbInfo);
LivelinessDao();
virtual ~LivelinessDao();
virtual void addCluster(unsigned int analysisID, int timeStep, QList<unsigned int>& neuronIDList, double liveliness);
bool containsAnalysisData(unsigned int analysisID, unsigned int firstTimeStep, unsigned int lastTimeStep);
void deleteTimeSteps(unsigned int analysisID, unsigned int firstTimeStep, unsigned int lastTimeStep);
QList<Cluster> getClusters(unsigned int analysisID);
double getNeuronLiveliness(unsigned int analysisID, unsigned int timeStep, unsigned int neuronID);
double getMaxNeuronLiveliness(unsigned int analysisID);
void setNeuronLiveliness(unsigned int analysisID, int timeStep,unsigned int neuronID, double liveliness);
};
}
#endif//LIVELINESSDAO_H
|
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: ./src/external/zlib-1.2.3/adler32.c, 2011/09/08 dcid Exp $
*/
#define ZLIB_INTERNAL
#include "zlib.h"
#define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* use NO_DIVIDE if your processor does not do division in hardware */
#ifdef NO_DIVIDE
# define MOD(a) \
do { \
if (a >= (BASE << 16)) a -= (BASE << 16); \
if (a >= (BASE << 15)) a -= (BASE << 15); \
if (a >= (BASE << 14)) a -= (BASE << 14); \
if (a >= (BASE << 13)) a -= (BASE << 13); \
if (a >= (BASE << 12)) a -= (BASE << 12); \
if (a >= (BASE << 11)) a -= (BASE << 11); \
if (a >= (BASE << 10)) a -= (BASE << 10); \
if (a >= (BASE << 9)) a -= (BASE << 9); \
if (a >= (BASE << 8)) a -= (BASE << 8); \
if (a >= (BASE << 7)) a -= (BASE << 7); \
if (a >= (BASE << 6)) a -= (BASE << 6); \
if (a >= (BASE << 5)) a -= (BASE << 5); \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
if (a >= BASE) a -= BASE; \
} while (0)
# define MOD4(a) \
do { \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
# define MOD4(a) a %= BASE
#endif
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
unsigned long sum2;
unsigned n;
/* split Adler-32 into component sums */
sum2 = (adler >> 16) & 0xffff;
adler &= 0xffff;
/* in case user likes doing a byte at a time, keep it fast */
if (len == 1) {
adler += buf[0];
if (adler >= BASE)
adler -= BASE;
sum2 += adler;
if (sum2 >= BASE)
sum2 -= BASE;
return adler | (sum2 << 16);
}
/* initial Adler-32 value (deferred check for len == 1 speed) */
if (buf == Z_NULL)
return 1L;
/* in case short lengths are provided, keep it somewhat fast */
if (len < 16) {
while (len--) {
adler += *buf++;
sum2 += adler;
}
if (adler >= BASE)
adler -= BASE;
MOD4(sum2); /* only added so many BASE's */
return adler | (sum2 << 16);
}
/* do length NMAX blocks -- requires just one modulo operation */
while (len >= NMAX) {
len -= NMAX;
n = NMAX / 16; /* NMAX is divisible by 16 */
do {
DO16(buf); /* 16 sums unrolled */
buf += 16;
} while (--n);
MOD(adler);
MOD(sum2);
}
/* do remaining bytes (less than NMAX, still just one modulo) */
if (len) { /* avoid modulos if none remaining */
while (len >= 16) {
len -= 16;
DO16(buf);
buf += 16;
}
while (len--) {
adler += *buf++;
sum2 += adler;
}
MOD(adler);
MOD(sum2);
}
/* return recombined sums */
return adler | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* the derivation of this formula is left as an exercise for the reader */
rem = (unsigned)(len2 % BASE);
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
sum1 += (adler2 & 0xffff) + BASE - 1;
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if (sum1 > BASE) sum1 -= BASE;
if (sum1 > BASE) sum1 -= BASE;
if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
if (sum2 > BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}
|
#include <linux/module.h>
#include <linux/rbtree_augmented.h>
#include <linux/random.h>
#include <asm/timex.h>
#define NODES 100
#define PERF_LOOPS 100000
#define CHECK_LOOPS 100
struct test_node {
struct rb_node rb;
u32 key;
/* following fields used for testing augmented rbtree functionality */
u32 val;
u32 augmented;
};
static struct rb_root root = RB_ROOT;
static struct test_node nodes[NODES];
static struct rnd_state rnd;
static void insert(struct test_node *node, struct rb_root *root)
{
struct rb_node **new = &root->rb_node, *parent = NULL;
u32 key = node->key;
while (*new) {
parent = *new;
if (key < rb_entry(parent, struct test_node, rb)->key)
new = &parent->rb_left;
else
new = &parent->rb_right;
}
rb_link_node(&node->rb, parent, new);
rb_insert_color(&node->rb, root);
}
static inline void erase(struct test_node *node, struct rb_root *root)
{
rb_erase(&node->rb, root);
}
static inline u32 augment_recompute(struct test_node *node)
{
u32 max = node->val, child_augmented;
if (node->rb.rb_left) {
child_augmented = rb_entry(node->rb.rb_left, struct test_node,
rb)->augmented;
if (max < child_augmented)
max = child_augmented;
}
if (node->rb.rb_right) {
child_augmented = rb_entry(node->rb.rb_right, struct test_node,
rb)->augmented;
if (max < child_augmented)
max = child_augmented;
}
return max;
}
RB_DECLARE_CALLBACKS(static, augment_callbacks, struct test_node, rb,
u32, augmented, augment_recompute)
static void insert_augmented(struct test_node *node, struct rb_root *root)
{
struct rb_node **new = &root->rb_node, *rb_parent = NULL;
u32 key = node->key;
u32 val = node->val;
struct test_node *parent;
while (*new) {
rb_parent = *new;
parent = rb_entry(rb_parent, struct test_node, rb);
if (parent->augmented < val)
parent->augmented = val;
if (key < parent->key)
new = &parent->rb.rb_left;
else
new = &parent->rb.rb_right;
}
node->augmented = val;
rb_link_node(&node->rb, rb_parent, new);
rb_insert_augmented(&node->rb, root, &augment_callbacks);
}
static void erase_augmented(struct test_node *node, struct rb_root *root)
{
rb_erase_augmented(&node->rb, root, &augment_callbacks);
}
static void init(void)
{
int i;
for (i = 0; i < NODES; i++) {
nodes[i].key = prandom_u32_state(&rnd);
nodes[i].val = prandom_u32_state(&rnd);
}
}
static bool is_red(struct rb_node *rb)
{
return !(rb->__rb_parent_color & 1);
}
static int black_path_count(struct rb_node *rb)
{
int count;
for (count = 0; rb; rb = rb_parent(rb))
count += !is_red(rb);
return count;
}
static void check(int nr_nodes)
{
struct rb_node *rb;
int count = 0;
int blacks;
u32 prev_key = 0;
for (rb = rb_first(&root); rb; rb = rb_next(rb)) {
struct test_node *node = rb_entry(rb, struct test_node, rb);
WARN_ON_ONCE(node->key < prev_key);
WARN_ON_ONCE(is_red(rb) &&
(!rb_parent(rb) || is_red(rb_parent(rb))));
if (!count)
blacks = black_path_count(rb);
else
WARN_ON_ONCE((!rb->rb_left || !rb->rb_right) &&
blacks != black_path_count(rb));
prev_key = node->key;
count++;
}
WARN_ON_ONCE(count != nr_nodes);
}
static void check_augmented(int nr_nodes)
{
struct rb_node *rb;
check(nr_nodes);
for (rb = rb_first(&root); rb; rb = rb_next(rb)) {
struct test_node *node = rb_entry(rb, struct test_node, rb);
WARN_ON_ONCE(node->augmented != augment_recompute(node));
}
}
static int rbtree_test_init(void)
{
int i, j;
cycles_t time1, time2, time;
printk(KERN_ALERT "rbtree testing");
prandom_seed_state(&rnd, 3141592653589793238ULL);
init();
time1 = get_cycles();
for (i = 0; i < PERF_LOOPS; i++) {
for (j = 0; j < NODES; j++)
insert(nodes + j, &root);
for (j = 0; j < NODES; j++)
erase(nodes + j, &root);
}
time2 = get_cycles();
time = time2 - time1;
time = div_u64(time, PERF_LOOPS);
printk(" -> %llu cycles\n", (unsigned long long)time);
for (i = 0; i < CHECK_LOOPS; i++) {
init();
for (j = 0; j < NODES; j++) {
check(j);
insert(nodes + j, &root);
}
for (j = 0; j < NODES; j++) {
check(NODES - j);
erase(nodes + j, &root);
}
check(0);
}
printk(KERN_ALERT "augmented rbtree testing");
init();
time1 = get_cycles();
for (i = 0; i < PERF_LOOPS; i++) {
for (j = 0; j < NODES; j++)
insert_augmented(nodes + j, &root);
for (j = 0; j < NODES; j++)
erase_augmented(nodes + j, &root);
}
time2 = get_cycles();
time = time2 - time1;
time = div_u64(time, PERF_LOOPS);
printk(" -> %llu cycles\n", (unsigned long long)time);
for (i = 0; i < CHECK_LOOPS; i++) {
init();
for (j = 0; j < NODES; j++) {
check_augmented(j);
insert_augmented(nodes + j, &root);
}
for (j = 0; j < NODES; j++) {
check_augmented(NODES - j);
erase_augmented(nodes + j, &root);
}
check_augmented(0);
}
return -EAGAIN; /* Fail will directly unload the module */
}
static void rbtree_test_exit(void)
{
printk(KERN_ALERT "test exit\n");
}
module_init(rbtree_test_init)
module_exit(rbtree_test_exit)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Michel Lespinasse");
MODULE_DESCRIPTION("Red Black Tree test");
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2013 Lucas Stach <l.stach@pengutronix.de>
*
* Based on the Linux Tegra clock code
*/
#include <common.h>
#include <io.h>
#include <malloc.h>
#include <linux/clk.h>
#include <linux/err.h>
#include "clk.h"
#define pll_out_enb(p) (BIT(p->enb_bit_idx))
#define pll_out_rst(p) (BIT(p->rst_bit_idx))
#define to_clk_pll_out(_hw) container_of(_hw, struct tegra_clk_pll_out, hw)
static int clk_pll_out_is_enabled(struct clk *hw)
{
struct tegra_clk_pll_out *pll_out = to_clk_pll_out(hw);
u32 val = readl(pll_out->reg);
int state;
state = (val & pll_out_enb(pll_out)) ? 1 : 0;
if (!(val & (pll_out_rst(pll_out))))
state = 0;
return state;
}
static int clk_pll_out_enable(struct clk *hw)
{
struct tegra_clk_pll_out *pll_out = to_clk_pll_out(hw);
u32 val;
val = readl(pll_out->reg);
val |= (pll_out_enb(pll_out) | pll_out_rst(pll_out));
writel(val, pll_out->reg);
udelay(2);
return 0;
}
static void clk_pll_out_disable(struct clk *hw)
{
struct tegra_clk_pll_out *pll_out = to_clk_pll_out(hw);
u32 val;
val = readl(pll_out->reg);
val &= ~(pll_out_enb(pll_out) | pll_out_rst(pll_out));
writel(val, pll_out->reg);
udelay(2);
}
static unsigned long clk_pll_out_recalc_rate(struct clk *hw,
unsigned long parent_rate)
{
struct tegra_clk_pll_out *pll_out = to_clk_pll_out(hw);
return pll_out->div->ops->recalc_rate(pll_out->div, parent_rate);
}
static long clk_pll_out_round_rate(struct clk *hw, unsigned long rate,
unsigned long *prate)
{
struct tegra_clk_pll_out *pll_out = to_clk_pll_out(hw);
return pll_out->div->ops->round_rate(pll_out->div, rate, prate);
}
static int clk_pll_out_set_rate(struct clk *hw, unsigned long rate,
unsigned long parent_rate)
{
struct tegra_clk_pll_out *pll_out = to_clk_pll_out(hw);
return pll_out->div->ops->set_rate(pll_out->div, rate, parent_rate);
}
const struct clk_ops tegra_clk_pll_out_ops = {
.is_enabled = clk_pll_out_is_enabled,
.enable = clk_pll_out_enable,
.disable = clk_pll_out_disable,
.recalc_rate = clk_pll_out_recalc_rate,
.round_rate = clk_pll_out_round_rate,
.set_rate = clk_pll_out_set_rate,
};
struct clk *tegra_clk_register_pll_out(const char *name,
const char *parent_name, void __iomem *reg, u8 shift, u8 divider_flags)
{
struct tegra_clk_pll_out *pll_out;
int ret;
pll_out = kzalloc(sizeof(*pll_out), GFP_KERNEL);
if (!pll_out)
return NULL;
pll_out->div = tegra_clk_divider_alloc(NULL, NULL, reg, 0, divider_flags, shift + 8, 8, 1);
if (!pll_out->div) {
kfree(pll_out);
return NULL;
}
pll_out->parent = parent_name;
pll_out->hw.name = name;
pll_out->hw.ops = &tegra_clk_pll_out_ops;
pll_out->hw.parent_names = (pll_out->parent ? &pll_out->parent : NULL);
pll_out->hw.num_parents = (pll_out->parent ? 1 : 0);
pll_out->reg = reg;
pll_out->enb_bit_idx = shift + 1;
pll_out->rst_bit_idx = shift;
ret = clk_register(&pll_out->hw);
if (ret) {
tegra_clk_divider_free(pll_out->div);
kfree(pll_out);
return ERR_PTR(ret);
}
return &pll_out->hw;
}
|
#ifndef WRAPPER_H
#define WRAPPER_H
/* Usage */
void usage(const char *err);
void die(const char *err, ...);
int error(const char *err, ...);
void warning(const char *warn, ...);
void info(const char *info, ...);
/* X-series */
char *xstrdup(const char *str);
char *xstrndup(const char *str, size_t len);
void *xmalloc(size_t size);
void *xmemdup(const void *data, size_t size);
ssize_t xread(int fd, void *buf, size_t len);
ssize_t xwrite(int fd, const void *buf, size_t len);
#endif
|
/*
* Header file for db_berkeley MI functions
*
* Copyright (C) 2007 Cisco Systems
*
* This file is part of opensips, a free SIP server.
*
* opensips 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
*
* opensips 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 _BDB_MI_H_
#define _BDB_MI_H_
#include "../../mi/mi.h"
#define MI_BDB_RELOAD "bdb_reload"
struct mi_root* mi_bdb_reload(struct mi_root *cmd, void *param);
#endif
|
/*
* $Id$
*
* Copyright (c) 2008 Vyacheslav Frolov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* $Log$
* Revision 1.2 2008/10/30 07:54:37 vfrolov
* Improved BREAK emulation
*
* Revision 1.1 2008/06/26 13:37:10 vfrolov
* Implemented noise emulation
*
*/
#ifndef _C0C_NOISE_H_
#define _C0C_NOISE_H_
VOID BreakError(PC0C_IO_PORT pReadIoPort, PUCHAR pLsr);
UCHAR GarbageChar(PC0C_IO_PORT pWriteIoPort, PC0C_IO_PORT pReadIoPort, PUCHAR pLsr);
VOID BrokeChar(PC0C_IO_PORT pWriteIoPort, PC0C_IO_PORT pReadIoPort, PUCHAR pChar, PUCHAR pLsr);
SIZE_T GetBrokenChars(ULONG brokeCharsProbability, SIZE_T chars);
#endif /* _C0C_NOISE_H_ */
|
/*
smbus.c - SMBus level access helper functions
Copyright (C) 1995-1997 Simon G. Vogl
Copyright (C) 1998-1999 Frodo Looijaard <frodol@dds.nl>
Copyright (C) 2012-2013 Jean Delvare <jdelvare@suse.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA.
*/
/*#include <errno.h>*/
#include <stddef.h>
#include <i2c/smbus.h>
#include <sys/ioctl.h>
/*#include <linux/types.h>*/
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
/* Compatibility defines */
#ifndef I2C_SMBUS_I2C_BLOCK_BROKEN
#define I2C_SMBUS_I2C_BLOCK_BROKEN I2C_SMBUS_I2C_BLOCK_DATA
#endif
#ifndef I2C_FUNC_SMBUS_PEC
#define I2C_FUNC_SMBUS_PEC I2C_FUNC_SMBUS_HWPEC_CALC
#endif
__s32 i2c_smbus_access(int file, char read_write, __u8 command,
int size, union i2c_smbus_data *data)
{
struct i2c_smbus_ioctl_data args;
__s32 err;
args.read_write = read_write;
args.command = command;
args.size = size;
args.data = data;
err = ioctl(file, I2C_SMBUS, &args);
/*if (err == -1)*/
/*err = -errno;*/
return err;
}
__s32 i2c_smbus_write_quick(int file, __u8 value)
{
return i2c_smbus_access(file, value, 0, I2C_SMBUS_QUICK, NULL);
}
__s32 i2c_smbus_read_byte(int file)
{
union i2c_smbus_data data;
int err;
err = i2c_smbus_access(file, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data);
if (err < 0)
return err;
return 0x0FF & data.byte;
}
__s32 i2c_smbus_write_byte(int file, __u8 value)
{
return i2c_smbus_access(file, I2C_SMBUS_WRITE, value,
I2C_SMBUS_BYTE, NULL);
}
__s32 i2c_smbus_read_byte_data(int file, __u8 command)
{
union i2c_smbus_data data;
int err;
err = i2c_smbus_access(file, I2C_SMBUS_READ, command,
I2C_SMBUS_BYTE_DATA, &data);
if (err < 0)
return err;
return 0x0FF & data.byte;
}
__s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value)
{
union i2c_smbus_data data;
data.byte = value;
return i2c_smbus_access(file, I2C_SMBUS_WRITE, command,
I2C_SMBUS_BYTE_DATA, &data);
}
__s32 i2c_smbus_read_word_data(int file, __u8 command)
{
union i2c_smbus_data data;
int err;
err = i2c_smbus_access(file, I2C_SMBUS_READ, command,
I2C_SMBUS_WORD_DATA, &data);
if (err < 0)
return err;
return 0x0FFFF & data.word;
}
__s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value)
{
union i2c_smbus_data data;
data.word = value;
return i2c_smbus_access(file, I2C_SMBUS_WRITE, command,
I2C_SMBUS_WORD_DATA, &data);
}
__s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
{
union i2c_smbus_data data;
data.word = value;
if (i2c_smbus_access(file, I2C_SMBUS_WRITE, command,
I2C_SMBUS_PROC_CALL, &data))
return -1;
else
return 0x0FFFF & data.word;
}
/* Returns the number of read bytes */
__s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values)
{
union i2c_smbus_data data;
int i, err;
err = i2c_smbus_access(file, I2C_SMBUS_READ, command,
I2C_SMBUS_BLOCK_DATA, &data);
if (err < 0)
return err;
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
__s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
const __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > I2C_SMBUS_BLOCK_MAX)
length = I2C_SMBUS_BLOCK_MAX;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
return i2c_smbus_access(file, I2C_SMBUS_WRITE, command,
I2C_SMBUS_BLOCK_DATA, &data);
}
/* Returns the number of read bytes */
/* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you
ask for less than 32 bytes, your code will only work with kernels
2.6.23 and later. */
__s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 length,
__u8 *values)
{
union i2c_smbus_data data;
int i, err;
if (length > I2C_SMBUS_BLOCK_MAX)
length = I2C_SMBUS_BLOCK_MAX;
data.block[0] = length;
err = i2c_smbus_access(file, I2C_SMBUS_READ, command,
length == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN :
I2C_SMBUS_I2C_BLOCK_DATA, &data);
if (err < 0)
return err;
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
__s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length,
const __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > I2C_SMBUS_BLOCK_MAX)
length = I2C_SMBUS_BLOCK_MAX;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
return i2c_smbus_access(file, I2C_SMBUS_WRITE, command,
I2C_SMBUS_I2C_BLOCK_BROKEN, &data);
}
/* Returns the number of read bytes */
__s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length,
__u8 *values)
{
union i2c_smbus_data data;
int i, err;
if (length > I2C_SMBUS_BLOCK_MAX)
length = I2C_SMBUS_BLOCK_MAX;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
err = i2c_smbus_access(file, I2C_SMBUS_WRITE, command,
I2C_SMBUS_BLOCK_PROC_CALL, &data);
if (err < 0)
return err;
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
|
/*
* Copyrigtht 2014 Georgios Karagiannis
*
* This file is part of PISAA_Rastrigin.
*
* PISAA_Rastrigin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* PISAA_Rastrigin 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 PISAA_Rastrigin. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Georgios Karagiannis
* Postdoctoral research associate
* Department of Mathematics, Purdue University
* 150 N. University Street
* West Lafayette, IN 47907-2067, USA
*
* Telephone: +1 (765) 496-1007
*
* Email: gkaragia@purdue.edu
*
* Contact email: georgios.stats@gmail.com
*/
void self_adj_grid_points( double *, int , double , double ) ;
void self_adj_index_search(int *, double , double *, int ) ;
void self_adj_desired_freq(double *, int , double ) ;
void self_adj_theta_update(double *, int , double *, double *, int ,
double *, double , double *) ;
void self_adj_theta_norm(double *, double *, double *, int , double ) ;
|
#include "vdec_verify_mpv_prov.h"
#include <mach/mt_typedefs.h>
#ifdef SATA_HDD_FS_SUPPORT
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/kdev_t.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
#include <linux/sched.h>
#include <linux/file.h>
#include <linux/slab.h>
BOOL fgHDDFsMount(UINT32 u4InstID)
{
UINT32 dwDriveNo = 0;
UINT32 u4DrvFSTag = 0;
INT32 i4_ret;
/* /TODO: i4_ret = DrvFSMount(dwDriveNo, &u4DrvFSTag); */
if (i4_ret < 0) {
printk("Fs mount fail %d\n", i4_ret);
ASSERT(0);
return 0;
}
return TRUE;
}
BOOL fgHDDFsUnMount(UINT32 u4InstID)
{
/* /TODO: DrvFSUnMount(); */
return TRUE;
}
struct file *vdecopenFile(char *path, int flag, int mode)
{
struct file *fp;
fp = filp_open(path, flag, 0);
if (fp)
return fp;
else
return NULL;
}
int vdecreadFile(struct file *fp, char *buf, int readlen)
{
if (fp->f_op && fp->f_op->read)
return fp->f_op->read(fp, buf, readlen, &fp->f_pos);
else
return -1;
}
int vdeccloseFile(struct file *fp)
{
filp_close(fp, NULL);
return 0;
}
mm_segment_t vdecoldfs;
void vdecinitKernelEnv(void)
{
vdecoldfs = get_fs();
set_fs(KERNEL_DS);
}
BOOL fgHDDFsOpenFile(UINT32 u4InstID, CHAR *strFileName, INT32 *pi4FileId)
{
INT32 i4_ret;
struct file *fp;
fp = vdecopenFile((char *)strFileName, O_RDONLY, 0);
if (fp == 0xfffffffe) {
printk("Fs open file fail %d\n", fp);
return FALSE;
}
*pi4FileId = fp;
/* vdeccloseFile(fp); */
return TRUE;
}
BOOL fgHDDFsCloseFile(UINT32 i4FileId)
{
/* /TODO: DrvFSCloseFile(i4FileId); */
vdeccloseFile((struct file *)i4FileId);
return TRUE;
}
BOOL fgHDDFsWriteFile(CHAR *strFileName, void *pvAddr, UINT32 u4Length)
{
INT32 i4_ret;
struct file *fp;
UINT32 u4FileSize = 0;
fp = vdecopenFile((char *)strFileName, O_CREAT | O_WRONLY, 0);
if (fp == 0xfffffffe) {
printk("Fs open file fail %d\n", fp);
return FALSE;
}
u4FileSize = (UINT32) fp->f_op->llseek(fp, 0, SEEK_END);
if (u4FileSize < 0) {
vdeccloseFile(fp);
printk("Fs get file size fail %d\n", u4FileSize);
return FALSE;
}
if (fp->f_op->llseek(fp, u4FileSize, SEEK_SET) != u4FileSize) {
vdeccloseFile(fp);
printk(" seek fail: %s\n", strFileName);
return FALSE;
}
vdecinitKernelEnv();
i4_ret = fp->f_op->write(fp, pvAddr, u4Length, &fp->f_pos);
/* printk("u4Length(%d), write size(%d), filesize(%d)\n ", u4Length, i4_ret, u4FileSize); */
set_fs(vdecoldfs);
if (i4_ret < 0) {
vdeccloseFile(fp);
printk("write file Fail!\n");
return FALSE;
}
vdeccloseFile(fp);
return TRUE;
}
BOOL fgHDDFsReadFile(UINT32 u4InstID,
CHAR *strFileName,
void *pvAddr,
UINT32 u4Offset,
UINT32 u4Length,
UINT32 *pu4RealReadSize, UINT32 *pu4TotalFileLength, INT32 *pi4FileId)
{
INT32 i4_ret;
struct file *fp;
UINT32 u4FileSize = 0;
UINT32 u4ReadSize = 0;
/* printk("%s", strFileName); */
fp = vdecopenFile((char *)strFileName, O_RDONLY, 0);
if (fp == 0xfffffffe) {
printk("Fs open file fail %d\n", fp);
return FALSE;
}
*pi4FileId = fp;
/* printk(" fp(%x)\n", fp); */
u4FileSize = (UINT32) fp->f_op->llseek(fp, 0, SEEK_END);
/* printk("Fs get file size %d\n", u4FileSize); */
if (u4FileSize <= 0) {
printk("Fs get file size fail %d\n", u4FileSize);
return FALSE;
}
*pu4TotalFileLength = u4FileSize;
if (u4Offset >= u4FileSize) {
vdeccloseFile(fp);
printk(" read offset(%d) > filesize(%d)\n", u4Offset, u4FileSize);
return FALSE;
}
if (fp->f_op->llseek(fp, u4Offset, SEEK_SET) != u4Offset) {
vdeccloseFile(fp);
printk(" seek fail: %s\n", strFileName);
return FALSE;
}
/* printk("u4Length(%d), read offset(%d), filesize(%d)\n ", u4Length, u4Offset, u4FileSize); */
if (u4Length >= (u4FileSize - u4Offset))
u4ReadSize = u4FileSize - u4Offset;
else {
printk
("Warning =====>File size is larger than VFIFO size! 0x%x Byte will be read\n",
V_FIFO_SZ);
u4ReadSize = V_FIFO_SZ;
*pu4TotalFileLength = V_FIFO_SZ;
}
/* printk(" u4ReadSize(%d), filesize(%d), pvAddr(0x%x)\n", u4ReadSize, u4FileSize, pvAddr); */
/* memset(pvAddr ,0, u4Length); */
vdecinitKernelEnv();
i4_ret = vdecreadFile(fp, pvAddr, u4ReadSize);
/* i4_ret = kernel_read(fp, 0, pvAddr, u4ReadSize); */
set_fs(vdecoldfs);
if (i4_ret < 0) {
vdeccloseFile(fp);
printk("read file Fail!\n");
return FALSE;
}
*pu4RealReadSize = i4_ret;
vdeccloseFile(fp);
if (u4ReadSize != *pu4RealReadSize) {
printk("\n read fail: %s", strFileName);
return FALSE;
}
return TRUE;
}
UINT32 u4HDDFsGetFileSize(INT32 *pi4FileId)
{
struct file *fp = (struct file *)(*pi4FileId);
return ((UINT32) fp->f_op->llseek(fp, 0, SEEK_END));
}
#endif
|
#ifndef _KBD_KERN_H
#define _KBD_KERN_H
#include <linux/tty.h>
#include <linux/interrupt.h>
#include <linux/keyboard.h>
extern struct tasklet_struct keyboard_tasklet;
extern char *func_table[MAX_NR_FUNC];
extern char func_buf[];
extern char *funcbufptr;
extern int funcbufsize, funcbufleft;
/*
* kbd->xxx contains the VC-local things (flag settings etc..)
*
* Note: externally visible are LED_SCR, LED_NUM, LED_CAP defined in kd.h
* The code in KDGETLED / KDSETLED depends on the internal and
* external order being the same.
*
* Note: lockstate is used as index in the array key_map.
*/
struct kbd_struct {
unsigned char lockstate;
/* 8 modifiers - the names do not have any meaning at all;
they can be associated to arbitrarily chosen keys */
#define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */
#define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */
#define VC_CTRLLOCK KG_CTRL /* control lock mode */
#define VC_ALTLOCK KG_ALT /* alt lock mode */
#define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */
#define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */
#define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */
#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
unsigned char ledmode:2; /* one 2-bit value */
#define LED_SHOW_FLAGS 0 /* traditional state */
#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
unsigned char ledflagstate:4; /* flags, not lights */
unsigned char default_ledflagstate:4;
#define VC_SCROLLOCK 0 /* scroll-lock mode */
#define VC_NUMLOCK 1 /* numeric lock mode */
#define VC_CAPSLOCK 2 /* capslock mode */
#define VC_KANALOCK 3 /* kanalock mode */
unsigned char kbdmode:3; /* one 3-bit value */
#define VC_XLATE 0 /* translate keycodes using keymap */
#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
#define VC_RAW 2 /* raw (scancode) mode */
#define VC_UNICODE 3 /* Unicode mode */
#define VC_OFF 4 /* disabled mode */
unsigned char modeflags:5;
#define VC_APPLIC 0 /* application key mode */
#define VC_CKMODE 1 /* cursor key mode */
#define VC_REPEAT 2 /* keyboard repeat */
#define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */
#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
};
extern int kbd_init(void);
extern unsigned char getledstate(void);
extern void setledstate(struct kbd_struct *kbd, unsigned int led);
extern int do_poke_blanked_console;
extern void (*kbd_ledfunc)(unsigned int led);
extern int set_console(int nr);
extern void schedule_console_callback(void);
/* FIXME: review locking for vt.c callers */
static inline void set_leds(void)
{
tasklet_schedule(&keyboard_tasklet);
}
static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
return ((kbd->modeflags >> flag) & 1);
}
static inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
{
return ((kbd->ledflagstate >> flag) & 1);
}
static inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
kbd->modeflags |= 1 << flag;
}
static inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag)
{
kbd->ledflagstate |= 1 << flag;
}
static inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
kbd->modeflags &= ~(1 << flag);
}
static inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag)
{
kbd->ledflagstate &= ~(1 << flag);
}
static inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag)
{
kbd->lockstate ^= 1 << flag;
}
static inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag)
{
kbd->slockstate ^= 1 << flag;
}
static inline void chg_vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
kbd->modeflags ^= 1 << flag;
}
static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
{
kbd->ledflagstate ^= 1 << flag;
}
#define U(x) ((x) ^ 0xf000)
#define BRL_UC_ROW 0x2800
/* keyboard.c */
struct console;
void compute_shiftstate(void);
/* defkeymap.c */
extern unsigned int keymap_count;
/* console.c */
static inline void con_schedule_flip(struct tty_struct *t)
{
unsigned long flags;
spin_lock_irqsave(&t->buf.lock, flags);
if (t->buf.tail != NULL)
t->buf.tail->commit = t->buf.tail->used;
spin_unlock_irqrestore(&t->buf.lock, flags);
schedule_work(&t->buf.work);
}
#endif
|
/*
* vacm.h
*
* SNMPv3 View-based Access Control Model
*/
#ifndef VACM_H
#define VACM_H
#ifdef __cplusplus
extern "C" {
#endif
#define VACM_SUCCESS 0
#define VACM_NOSECNAME 1
#define VACM_NOGROUP 2
#define VACM_NOACCESS 3
#define VACM_NOVIEW 4
#define VACM_NOTINVIEW 5
#define VACM_NOSUCHCONTEXT 6
#define VACM_SUBTREE_UNKNOWN 7
#define SECURITYMODEL 1
#define SECURITYNAME 2
#define SECURITYGROUP 3
#define SECURITYSTORAGE 4
#define SECURITYSTATUS 5
#define ACCESSPREFIX 1
#define ACCESSMODEL 2
#define ACCESSLEVEL 3
#define ACCESSMATCH 4
#define ACCESSREAD 5
#define ACCESSWRITE 6
#define ACCESSNOTIFY 7
#define ACCESSSTORAGE 8
#define ACCESSSTATUS 9
#define VACMVIEWSPINLOCK 1
#define VIEWNAME 2
#define VIEWSUBTREE 3
#define VIEWMASK 4
#define VIEWTYPE 5
#define VIEWSTORAGE 6
#define VIEWSTATUS 7
#define VACM_MAX_STRING 32
#define VACMSTRINGLEN 34 /* VACM_MAX_STRING + 2 */
struct vacm_groupEntry {
int securityModel;
char securityName[VACMSTRINGLEN];
char groupName[VACMSTRINGLEN];
int storageType;
int status;
u_long bitMask;
struct vacm_groupEntry *reserved;
struct vacm_groupEntry *next;
};
#define CONTEXT_MATCH_EXACT 1
#define CONTEXT_MATCH_PREFIX 2
struct vacm_accessEntry {
char groupName[VACMSTRINGLEN];
char contextPrefix[VACMSTRINGLEN];
int securityModel;
int securityLevel;
int contextMatch;
char readView[VACMSTRINGLEN];
char writeView[VACMSTRINGLEN];
char notifyView[VACMSTRINGLEN];
int storageType;
int status;
u_long bitMask;
struct vacm_accessEntry *reserved;
struct vacm_accessEntry *next;
};
struct vacm_viewEntry {
char viewName[VACMSTRINGLEN];
oid viewSubtree[MAX_OID_LEN];
size_t viewSubtreeLen;
u_char viewMask[VACMSTRINGLEN];
size_t viewMaskLen;
int viewType;
int viewStorageType;
int viewStatus;
u_long bitMask;
struct vacm_viewEntry *reserved;
struct vacm_viewEntry *next;
};
void vacm_destroyViewEntry(const char *, oid *, size_t);
void vacm_destroyAllViewEntries(void);
#define VACM_MODE_FIND 0
#define VACM_MODE_IGNORE_MASK 1
#define VACM_MODE_CHECK_SUBTREE 2
struct vacm_viewEntry *vacm_getViewEntry(const char *, oid *, size_t,
int);
/*
* Returns a pointer to the viewEntry with the
* same viewName and viewSubtree
* Returns NULL if that entry does not exist.
*/
void
vacm_scanViewInit(void);
/*
* Initialized the scan routines so that they will begin at the
* beginning of the list of viewEntries.
*
*/
struct vacm_viewEntry *vacm_scanViewNext(void);
/*
* Returns a pointer to the next viewEntry.
* These entries are returned in no particular order,
* but if N entries exist, N calls to view_scanNext() will
* return all N entries once.
* Returns NULL if all entries have been returned.
* view_scanInit() starts the scan over.
*/
struct vacm_viewEntry *vacm_createViewEntry(const char *, oid *,
size_t);
/*
* Creates a viewEntry with the given index
* and returns a pointer to it.
* The status of this entry is created as invalid.
*/
void vacm_destroyGroupEntry(int, const char *);
void vacm_destroyAllGroupEntries(void);
struct vacm_groupEntry *vacm_createGroupEntry(int, const char *);
struct vacm_groupEntry *vacm_getGroupEntry(int, const char *);
void vacm_scanGroupInit(void);
struct vacm_groupEntry *vacm_scanGroupNext(void);
void vacm_destroyAccessEntry(const char *, const char *,
int, int);
void vacm_destroyAllAccessEntries(void);
struct vacm_accessEntry *vacm_createAccessEntry(const char *,
const char *, int,
int);
struct vacm_accessEntry *vacm_getAccessEntry(const char *,
const char *, int, int);
void vacm_scanAccessInit(void);
struct vacm_accessEntry *vacm_scanAccessNext(void);
void vacm_destroySecurityEntry(const char *);
struct vacm_securityEntry *vacm_createSecurityEntry(const char *);
struct vacm_securityEntry *vacm_getSecurityEntry(const char *);
void vacm_scanSecurityInit(void);
struct vacm_securityEntry *vacm_scanSecurityEntry(void);
int vacm_is_configured(void);
void vacm_save(const char *token, const char *type);
void vacm_save_view(struct vacm_viewEntry *view,
const char *token, const char *type);
void vacm_save_access(struct vacm_accessEntry *access_entry,
const char *token, const char *type);
void vacm_save_group(struct vacm_groupEntry *group_entry,
const char *token, const char *type);
void vacm_parse_config_view(const char *token, char *line);
void vacm_parse_config_group(const char *token, char *line);
void vacm_parse_config_access(const char *token,
char *line);
int store_vacm(int majorID, int minorID, void *serverarg,
void *clientarg);
#ifdef __cplusplus
}
#endif
#endif /* VACM_H */
|
/* Copyright (C) 1991,93,95,96,97,98,2001,02 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 <bits/libc-lock.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* Try to get a machine dependent instruction which will make the
program crash. This is used in case everything else fails. */
#include <abort-instr.h>
#ifndef ABORT_INSTRUCTION
/* No such instruction is available. */
# define ABORT_INSTRUCTION
#endif
#ifdef USE_IN_LIBIO
# include <libio/libioP.h>
# define fflush(s) _IO_flush_all_lockp (0)
#endif
/* We must avoid to run in circles. Therefore we remember how far we
already got. */
static int stage;
/* We should be prepared for multiple threads trying to run abort. */
__libc_lock_define_initialized_recursive (static, lock);
/* Cause an abnormal program termination with core-dump. */
void
abort (void)
{
struct sigaction act;
sigset_t sigs;
/* First acquire the lock. */
__libc_lock_lock_recursive (lock);
/* Now it's for sure we are alone. But recursive calls are possible. */
/* Unlock SIGABRT. */
if (stage == 0)
{
++stage;
if (__sigemptyset (&sigs) == 0 &&
__sigaddset (&sigs, SIGABRT) == 0)
__sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
}
/* Flush all streams. We cannot close them now because the user
might have registered a handler for SIGABRT. */
if (stage == 1)
{
++stage;
fflush (NULL);
}
/* Send signal which possibly calls a user handler. */
if (stage == 2)
{
/* This stage is special: we must allow repeated calls of
`abort' when a user defined handler for SIGABRT is installed.
This is risky since the `raise' implementation might also
fail but I don't see another possibility. */
int save_stage = stage;
stage = 0;
__libc_lock_unlock_recursive (lock);
raise (SIGABRT);
__libc_lock_lock_recursive (lock);
stage = save_stage + 1;
}
/* There was a handler installed. Now remove it. */
if (stage == 3)
{
++stage;
memset (&act, '\0', sizeof (struct sigaction));
act.sa_handler = SIG_DFL;
__sigfillset (&act.sa_mask);
act.sa_flags = 0;
__sigaction (SIGABRT, &act, NULL);
}
/* Now close the streams which also flushes the output the user
defined handler might has produced. */
if (stage == 4)
{
++stage;
__fcloseall ();
}
/* Try again. */
if (stage == 5)
{
++stage;
raise (SIGABRT);
}
/*Yaroslav Litvinov*/
/* /\* Now try to abort using the system specific command. *\/ */
/* if (stage == 6) */
/* { */
/* ++stage; */
/* ABORT_INSTRUCTION; */
/* } */
/* /\* If we can't signal ourselves and the abort instruction failed, exit. *\/ */
/* if (stage == 7) */
/* { */
/* ++stage; */
/* _exit (127); */
/* } */
/*ZRT try exit with error code instead abort instruction - segmenetation fault*/
/* If we can't signal ourselves and the abort instruction failed, exit. */
if (stage == 6)
{
++stage;
_exit (127);
}
/* Now try to abort using the system specific command. */
if (stage == 7)
{
++stage;
ABORT_INSTRUCTION;
}
/* If even this fails try to use the provided instruction to crash
or otherwise make sure we never return. */
while (1)
/* Try for ever and ever. */
ABORT_INSTRUCTION;
}
libc_hidden_def (abort)
|
// Emacs style mode select -*- C++ -*-
//---------------------------------------------------------------------------
//
// $Id: swutil.c,v 1.2 2003/06/04 16:02:55 fraggle Exp $
//
// Copyright(C) 1984-2000 David L. Clark
// Copyright(C) 2001-2003 Simon Howard
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version. This program is distributed in the hope that
// it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details. You should have
// received a copy of the GNU General Public License along with this
// program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place - Suite 330, Boston, MA 02111-1307, USA.
//
//---------------------------------------------------------------------------
//
// Converted ASM Routines
// Some of these arent used (dos specific empty functions)
// Some of them are modified from andrew jenners source functions
// as i cant read x86 asm :(
//
//-----------------------------------------------------------------------
#include "sw.h"
#include "swutil.h"
void movexy(OBJECTS * ob, int *x, int *y)
{
long pos;
//long vel;
// pos = (((long) (ob->ob_x)) << 16) + ob->ob_lx;
// vel = (((long) (ob->ob_dx)) << 16) + ob->ob_ldx;
pos = (ob->ob_x + ob->ob_dx) << 16;
ob->ob_x = (short) (pos >> 16);
ob->ob_lx = (short) pos;
*x = ob->ob_x;
// pos = (((long) (ob->ob_y)) << 16) + ob->ob_ly;
// vel = (((long) (ob->ob_dy)) << 16) + ob->ob_ldy;
pos = (ob->ob_y + ob->ob_dy) << 16;
ob->ob_y = (short) (pos >> 16);
ob->ob_ly = (short) pos;
*y = ob->ob_y;
}
void setdxdy(OBJECTS * obj, int dx, int dy)
{
obj->ob_dx = dx >> 8;
obj->ob_ldx = dx << 8;
obj->ob_dy = dy >> 8;
obj->ob_ldy = dy << 8;
}
void swsetblk()
{
// used by the splatted ox code to colour the screen. ?
}
void swgetjoy()
{
// joystick
}
void histend()
{
// demos?
}
//---------------------------------------------------------------------------
//
// $Log: swutil.c,v $
// Revision 1.2 2003/06/04 16:02:55 fraggle
// Remove broken printscreen function
//
// Revision 1.1.1.1 2003/02/14 19:03:22 fraggle
// Initial Sourceforge CVS import
//
//
// sdh 14/2/2003: change license header to GPL
// sdh 16/11/2001: trap14 removed
// sdh 21/10/2001: rearranged headers, added cvs tags
// sdh 18/10/2001: converted all functions to ANSI-style arguments
// sdh ??/10/2001: created this file to hold replacements for the ASM
// functions in swutil.asm
//
//---------------------------------------------------------------------------
|
/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
* Copyright (C) 1998-1999 Brian Bruns
*
* 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.
*/
#ifndef _tdssrv_h_
#define _tdssrv_h_
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#if 0
}
#endif
static const char rcsid_tdssrv_h[] = "$Id: tdssrv.h,v 1.11 2011-05-06 16:47:32 freddy77 Exp $";
static const void *const no_unused_tdssrv_h_warn[] = { rcsid_tdssrv_h, no_unused_tdssrv_h_warn };
/* login.c */
unsigned char *tds7_decrypt_pass(const unsigned char *crypt_pass, int len, unsigned char *clear_pass);
TDSSOCKET *tds_listen(TDSCONTEXT * ctx, int ip_port);
void tds_read_login(TDSSOCKET * tds, TDSLOGIN * login);
int tds7_read_login(TDSSOCKET * tds, TDSLOGIN * login);
TDSLOGIN *tds_alloc_read_login(TDSSOCKET * tds);
/* query.c */
char *tds_get_query(TDSSOCKET * tds);
char *tds_get_generic_query(TDSSOCKET * tds);
/* server.c */
void tds_env_change(TDSSOCKET * tds, int type, const char *oldvalue, const char *newvalue);
void tds_send_msg(TDSSOCKET * tds, int msgno, int msgstate, int severity, const char *msgtext, const char *srvname,
const char *procname, int line);
void tds_send_login_ack(TDSSOCKET * tds, const char *progname);
void tds_send_eed(TDSSOCKET * tds, int msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line);
void tds_send_err(TDSSOCKET * tds, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr);
void tds_send_capabilities_token(TDSSOCKET * tds);
/* TODO remove, use tds_send_done */
void tds_send_done_token(TDSSOCKET * tds, TDS_SMALLINT flags, TDS_INT numrows);
void tds_send_done(TDSSOCKET * tds, int token, TDS_SMALLINT flags, TDS_INT numrows);
void tds_send_control_token(TDSSOCKET * tds, TDS_SMALLINT numcols);
void tds_send_col_name(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
void tds_send_col_info(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
void tds_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
void tds7_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
void tds_send_table_header(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
void tds_send_row(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
void tds71_send_prelogin(TDSSOCKET * tds);
#if 0
{
#endif
#ifdef __cplusplus
}
#endif
|
/*-
* Copyright (c) Peter Wemm
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: release/8.2.0/sys/i386/include/privatespace.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef _MACHINE_PRIVATESPACE_H_
#define _MACHINE_PRIVATESPACE_H_
/*
* This is the upper (0xff800000) address space layout that is per-cpu.
* It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
* each AP. This is only applicable to the x86 SMP kernel.
*/
struct privatespace {
/* page 0 - data page */
struct pcpu pcpu;
char __filler0[PAGE_SIZE - sizeof(struct pcpu)];
/* page 1 - idle stack (KSTACK_PAGES pages) */
char idlekstack[KSTACK_PAGES * PAGE_SIZE];
/* page 1+KSTACK_PAGES... */
};
extern struct privatespace SMP_prvspace[];
#endif /* ! _MACHINE_PRIVATESPACE_H_ */
|
#include "eeprom.h"
#include "i2c.h"
#include <string.h>
int eeprom_write_page(int address, uint8_t *buf, size_t len)
{
uint8_t data[EEPROM_PAGESIZE+1];
int result;
if (!buf || len <= 0)
return 0;
data[0] = (uint8_t)(address & 0xff);
len = len > EEPROM_PAGESIZE ? EEPROM_PAGESIZE : len;
memcpy(data+1, buf, len);
result = I2CMasterWrite(EEPROM_ADDRESS, data, len+1);
if (result > 0)
result--;
return result;
}
int eeprom_read_page(int address, uint8_t *buf, size_t len)
{
uint8_t addr = (uint8_t)(address & 0xff);
int result = I2CMasterWrite(EEPROM_ADDRESS, &addr, 1);
if (result <= 0)
return result;
result = I2CMasterRead(EEPROM_ADDRESS, buf, len);
return result;
}
int eeprom_write(int address, uint8_t *buf, size_t len)
{
const int c_retry_times = 10;
int retry = 0;
size_t send = 0;
int result = 0;
if (!buf || len <= 0)
return 0;
while (len > 0)
{
size_t size = (EEPROM_PAGESIZE - address % EEPROM_PAGESIZE);
if (size > len)
size = len;
result = eeprom_write_page(address, buf+send, size);
if (result <= 0)
{
if (retry < c_retry_times)
continue;
else
goto exit;
}
else if (result != size)
{
result += send;
goto exit;
}
send += size;
len -= size;
address += size;
retry = 0;
}
result = send;
exit:
return result;
}
int eeprom_read(int address, uint8_t *buf, size_t len)
{
const int c_retry_times = 10;
int retry = 0;
size_t recv = 0;
int result = 0;
if (!buf || len <= 0)
return 0;
while (len > 0)
{
size_t size = (EEPROM_PAGESIZE - address % EEPROM_PAGESIZE);
if (size > len)
size = len;
result = eeprom_read_page(address, buf+recv, size);
if (result <= 0)
{
if (retry < c_retry_times)
continue;
else
goto exit;
}
else if (result != size)
{
result += recv;
goto exit;
}
recv += size;
len -= size;
address += size;
retry = 0;
}
result = recv;
exit:
return result;
}
|
/*
* ======== imports ========
*/
/*
* ======== forward declarations for intrinsics ========
*/
void test66_Test_08_pollen__reset__E();
void test66_Test_08_pollen__ready__E();
void test66_Test_08_pollen__shutdown__E(uint8 i);
/*
* ======== extern definition ========
*/
extern struct test54_PrintImpl_ test54_PrintImpl;
/*
* ======== struct module definition (unit PrintImpl) ========
*/
struct test54_PrintImpl_ {
};
typedef struct test54_PrintImpl_ test54_PrintImpl_;
/*
* ======== function members (unit PrintImpl) ========
*/
extern void test54_PrintImpl_printUint__E( uint32 u );
extern void test54_PrintImpl_printInt__E( int32 i );
extern void test54_PrintImpl_printReal__E( float f );
extern void test54_PrintImpl_printBool__E( bool b );
extern void test54_PrintImpl_targetInit__I();
extern void test54_PrintImpl_printStr__E( string s );
/*
* ======== data members (unit PrintImpl) ========
*/
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/CoreDAV.framework/CoreDAV
*/
#import <CoreDAV/CoreDAVTaskDelegate.h>
@protocol CoreDAVMkcolTaskDelegate <CoreDAVTaskDelegate>
@optional
- (void)mkcolTask:(id)task parsedPropStats:(id)stats error:(id)error;
@end
|
/***************************************************************************
* Copyright (C) 2013 OPENTIA Group http://opentia.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. *
* *
* 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 ACTIVITYSORTINGSTRATEGY_H
#define ACTIVITYSORTINGSTRATEGY_H
#include <abstractsortingstrategy.h>
#include <QtCore/QHash>
namespace TaskManager {
/**
* Sorts the tasks by activity.
* The activities with more tasks will be before than the ones with less tasks.
* If one task is in various activities, the one with more tasks will be taken into account.
*/
class ActivitySortingStrategy: public AbstractSortingStrategy
{
Q_OBJECT
public:
ActivitySortingStrategy(QObject *parent);
virtual ~ActivitySortingStrategy();
void sortItems(ItemList& items);
protected Q_SLOTS:
void handleItem(AbstractGroupableItem *item);
void checkChanges(::TaskManager::TaskChanges changes, ::TaskManager::AbstractGroupableItem *item = 0);
private:
/**
* Checks if the order of the activities stored in the instance is still valid and if not, it stores the
* correct order. */
bool checkActivitiesOrder(ItemList& items);
void addActivitiesToActivityCount(ItemList& items, QHash<QString, int>& activityCount);
static bool lessThanActivityData(QPair<QString, int> &d1, QPair<QString, int> &d2);
class Comparator;
QStringList m_activitiesOrder;
};
}
#endif
|
static void ini_ii(int maxp, int **ii, int **ii0, int **ii_hst) {
Dalloc(ii, maxp);
Dalloc(ii0, maxp);
EMALLOC(maxp, ii_hst);
}
void flu_ini(bool colors, bool ids, int3 L, int maxp, FluQuants *q) {
q->n = 0;
q->maxp = maxp;
Dalloc(&q->pp, maxp);
Dalloc(&q->pp0, maxp);
UC(clist_ini(L.x, L.y, L.z, /**/ &q->cells));
UC(clist_ini_map(maxp, 2, q->cells, /**/ &q->mcells));
EMALLOC(maxp, &q->pp_hst);
if (ids) ini_ii(maxp, &q->ii, &q->ii0, &q->ii_hst);
if (colors) ini_ii(maxp, &q->cc, &q->cc0, &q->cc_hst);
q->ids = ids;
q->colors = colors;
}
|
// 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 NET_HTTP_HTTP_STATUS_CODE_H_
#define NET_HTTP_HTTP_STATUS_CODE_H_
#include "net/base/net_export.h"
namespace net {
enum HttpStatusCode {
#define HTTP_STATUS(label, code, reason) HTTP_ ## label = code,
#include "net/http/http_status_code_list.h"
#undef HTTP_STATUS
};
NET_EXPORT const char* GetHttpReasonPhrase(HttpStatusCode code);
}
#endif
|
#if !defined (NETSHARE_98_H)
#define NETSHARE_98_H
//---------------------------
// (c) Reliable Software 2000
//---------------------------
#include "NetShareImpl.h"
#include <Sys/Dll.h>
#include <lmcons.h>
namespace Net
{
class Share98: public ShareImpl
{
typedef NET_API_STATUS (__stdcall *ShareAdd) (char const * servername,
short level,
char const * buf,
unsigned short bufLen);
typedef NET_API_STATUS (__stdcall *ShareDel) (char const * server,
char const * netname,
unsigned short reserved);
public:
Share98 ();
void Add (SharedObject const & object);
void Delete (std::string const & netname);
private:
Dll _dll;
ShareAdd _addFunc;
ShareDel _delFunc;
};
}
#endif
|
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/usb/input.h>
#include <linux/hid.h>
/* for apple IDs */
#ifdef CONFIG_USB_HID_MODULE
#include "../hid-ids.h"
#endif
#define DRIVER_VERSION "v1.6"
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
#define DRIVER_DESC "USB HID Boot Protocol mouse driver"
#define DRIVER_LICENSE "GPL"
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE(DRIVER_LICENSE);
struct usb_mouse {
char name[128];
char phys[64];
struct usb_device *usbdev;
struct input_dev *dev;
struct urb *irq;
signed char *data;
dma_addr_t data_dma;
};
static void usb_mouse_irq(struct urb *urb)
{
struct usb_mouse *mouse = urb->context;
signed char *data = mouse->data;
struct input_dev *dev = mouse->dev;
int status;
switch (urb->status) {
case 0: /* success */
break;
case -ECONNRESET: /* unlink */
case -ENOENT:
case -ESHUTDOWN:
return;
/* -EPIPE: should clear the halt */
default: /* error */
goto resubmit;
}
input_report_key(dev, BTN_LEFT, data[0] & 0x01);
input_report_key(dev, BTN_RIGHT, data[0] & 0x02);
input_report_key(dev, BTN_MIDDLE, data[0] & 0x04);
input_report_key(dev, BTN_SIDE, data[0] & 0x08);
input_report_key(dev, BTN_EXTRA, data[0] & 0x10);
input_report_rel(dev, REL_X, data[1]);
input_report_rel(dev, REL_Y, data[2]);
input_report_rel(dev, REL_WHEEL, data[3]);
input_sync(dev);
resubmit:
status = usb_submit_urb (urb, GFP_ATOMIC);
if (status)
err ("can't resubmit intr, %s-%s/input0, status %d",
mouse->usbdev->bus->bus_name,
mouse->usbdev->devpath, status);
}
static int usb_mouse_open(struct input_dev *dev)
{
struct usb_mouse *mouse = input_get_drvdata(dev);
mouse->irq->dev = mouse->usbdev;
if (usb_submit_urb(mouse->irq, GFP_KERNEL))
return -EIO;
return 0;
}
static void usb_mouse_close(struct input_dev *dev)
{
struct usb_mouse *mouse = input_get_drvdata(dev);
usb_kill_urb(mouse->irq);
}
static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev(intf);
struct usb_host_interface *interface;
struct usb_endpoint_descriptor *endpoint;
struct usb_mouse *mouse;
struct input_dev *input_dev;
int pipe, maxp;
int error = -ENOMEM;
interface = intf->cur_altsetting;
if (interface->desc.bNumEndpoints != 1)
return -ENODEV;
endpoint = &interface->endpoint[0].desc;
if (!usb_endpoint_is_int_in(endpoint))
return -ENODEV;
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
mouse = kzalloc(sizeof(struct usb_mouse), GFP_KERNEL);
input_dev = input_allocate_device();
if (!mouse || !input_dev)
goto fail1;
mouse->data = usb_alloc_coherent(dev, 8, GFP_ATOMIC, &mouse->data_dma);
if (!mouse->data)
goto fail1;
mouse->irq = usb_alloc_urb(0, GFP_KERNEL);
if (!mouse->irq)
goto fail2;
mouse->usbdev = dev;
mouse->dev = input_dev;
if (dev->manufacturer)
strlcpy(mouse->name, dev->manufacturer, sizeof(mouse->name));
if (dev->product) {
if (dev->manufacturer)
strlcat(mouse->name, " ", sizeof(mouse->name));
strlcat(mouse->name, dev->product, sizeof(mouse->name));
}
if (!strlen(mouse->name))
snprintf(mouse->name, sizeof(mouse->name),
"USB HIDBP Mouse %04x:%04x",
le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct));
usb_make_path(dev, mouse->phys, sizeof(mouse->phys));
strlcat(mouse->phys, "/input0", sizeof(mouse->phys));
input_dev->name = mouse->name;
input_dev->phys = mouse->phys;
usb_to_input_id(dev, &input_dev->id);
input_dev->dev.parent = &intf->dev;
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) |
BIT_MASK(BTN_EXTRA);
input_dev->relbit[0] |= BIT_MASK(REL_WHEEL);
input_set_drvdata(input_dev, mouse);
input_dev->open = usb_mouse_open;
input_dev->close = usb_mouse_close;
usb_fill_int_urb(mouse->irq, dev, pipe, mouse->data,
(maxp > 8 ? 8 : maxp),
usb_mouse_irq, mouse, endpoint->bInterval);
mouse->irq->transfer_dma = mouse->data_dma;
mouse->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
error = input_register_device(mouse->dev);
if (error)
goto fail3;
usb_set_intfdata(intf, mouse);
return 0;
fail3:
usb_free_urb(mouse->irq);
fail2:
usb_free_coherent(dev, 8, mouse->data, mouse->data_dma);
fail1:
input_free_device(input_dev);
kfree(mouse);
return error;
}
static void usb_mouse_disconnect(struct usb_interface *intf)
{
struct usb_mouse *mouse = usb_get_intfdata (intf);
usb_set_intfdata(intf, NULL);
if (mouse) {
usb_kill_urb(mouse->irq);
input_unregister_device(mouse->dev);
usb_free_urb(mouse->irq);
usb_free_coherent(interface_to_usbdev(intf), 8, mouse->data, mouse->data_dma);
kfree(mouse);
}
}
static struct usb_device_id usb_mouse_id_table [] = {
{ USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT,
USB_INTERFACE_PROTOCOL_MOUSE) },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, usb_mouse_id_table);
static struct usb_driver usb_mouse_driver = {
.name = "usbmouse",
.probe = usb_mouse_probe,
.disconnect = usb_mouse_disconnect,
.id_table = usb_mouse_id_table,
};
static int __init usb_mouse_init(void)
{
int retval = usb_register(&usb_mouse_driver);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit usb_mouse_exit(void)
{
usb_deregister(&usb_mouse_driver);
}
module_init(usb_mouse_init);
module_exit(usb_mouse_exit);
|
/***************************************************************
FronTier is a set of libraries that implements different types of
Front Traking algorithms. Front Tracking is a numerical method for
the solution of partial differential equations whose solutions have
discontinuities.
Copyright (C) 1999 by The University at Stony Brook.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************/
/*
* bi_array.c:
*
* Copyright 1999 by The University at Stony Brook, All rights reserved.
*
* Contains simple routines for the manipulation of matrices.
*
* rotate_matrix()
* rotate_vector()
*/
#include <cdecs.h>
#include <vmalloc.h>
/*
* rotate_vector():
* rotate_matrix():
*
* Multiply the given vector by the matrix M.
* Multiply two matricies. Both functions assume the
* dimension of these objects is at most 3. The function
* MatrixTimesMatix also assumes the matricies are square.
*/
EXPORT void rotate_vector(
double *rv,
double **M,
double *v,
int dim)
{
int i, j;
double vtemp[3];
double *v1;
if (v == rv)
{
for (i = 0; i < dim; i++) vtemp[i] = v[i];
v1 = vtemp;
}
else
v1 = v;
for (i = 0; i < dim; i++)
{
rv[i] = 0.0;
for (j = 0; j < dim; j++)
rv[i] += M[i][j]*v1[j];
}
} /*end rotate_vector*/
EXPORT void rotate_matrix(
double **M,
double **M1,
double **M2,
int dim)
{
int i, j, k;
double **m1, **m2;
static boolean first = YES;
static double **mtmp1 = NULL, **mtmp2 = NULL;
if (first)
{
first = NO;
bi_array(&mtmp1,3,3,FLOAT);
bi_array(&mtmp2,3,3,FLOAT);
}
if (M == M1)
{
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
mtmp1[i][j] = M1[i][j];
m1 = mtmp1;
}
else
m1 = M1;
if (M == M2)
{
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
mtmp2[i][j] = M2[i][j];
m2 = mtmp2;
}
else
m2 = M2;
for (i = 0; i < dim; i++)
{
for (j = 0; j < dim; j++)
{
M[i][j] = 0.0;
for (k = 0; k < dim; k++)
M[i][j] += m1[i][k]*m2[k][j];
}
}
} /*end rotate_matrix*/
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* Additional copyright for this file:
* Copyright (C) 1994-1998 Revolution Software Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SWORD2_ANIMATION_H
#define SWORD2_ANIMATION_H
#include "video/dxa_decoder.h"
#include "video/video_decoder.h"
#include "audio/mixer.h"
#include "sword2/screen.h"
namespace Sword2 {
enum DecoderType {
kVideoDecoderDXA = 0,
kVideoDecoderSMK = 1,
kVideoDecoderPSX = 2
};
struct MovieText {
uint16 _startFrame;
uint16 _endFrame;
uint32 _textNumber;
byte *_textMem;
SpriteInfo _textSprite;
uint16 _speechId;
bool _played;
void reset() {
_textMem = NULL;
_speechId = 0;
_played = false;
}
};
class DXADecoderWithSound : public Video::DXADecoder {
public:
DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle);
~DXADecoderWithSound() {}
uint32 getElapsedTime() const;
private:
Audio::Mixer *_mixer;
Audio::SoundHandle *_bgSoundHandle;
};
class MoviePlayer {
public:
MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType);
virtual ~MoviePlayer();
bool load(const char *name);
void play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadIn, uint32 leadOut);
protected:
Sword2Engine *_vm;
Audio::Mixer *_snd;
OSystem *_system;
MovieText *_movieTexts;
uint32 _numMovieTexts;
uint32 _currentMovieText;
byte *_textSurface;
int _textX, _textY;
byte _white, _black;
DecoderType _decoderType;
Video::VideoDecoder *_decoder;
Audio::SoundHandle *_bgSoundHandle;
Audio::AudioStream *_bgSoundStream;
uint32 _leadOut;
int _leadOutFrame;
void performPostProcessing(Graphics::Surface *screen, uint16 pitch);
bool playVideo();
void drawFramePSX(const Graphics::Surface *frame);
void openTextObject(uint32 index);
void closeTextObject(uint32 index, Graphics::Surface *screen, uint16 pitch);
void drawTextObject(uint32 index, Graphics::Surface *screen, uint16 pitch);
uint32 getBlackColor();
uint32 getWhiteColor();
};
MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, uint32 frameCount);
} // End of namespace Sword2
#endif
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
#include "dbus/exported_object.h"
namespace dbus {
class MethodCall;
class Response;
}
namespace chromeos {
class DisplayPowerServiceProvider
: public CrosDBusService::ServiceProviderInterface {
public:
DisplayPowerServiceProvider();
virtual ~DisplayPowerServiceProvider();
virtual void Start(
scoped_refptr<dbus::ExportedObject> exported_object) OVERRIDE;
private:
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success);
void SetDisplayPower(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
void SetDisplaySoftwareDimming(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
base::WeakPtrFactory<DisplayPowerServiceProvider> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DisplayPowerServiceProvider);
};
}
#endif
|
/* $Id: getfiles.h,v 1.7 2004/07/21 11:32:07 yooden Exp $ */
/*******************************************************************************
* *
* getfiles.h -- Nirvana Editor File Handling Header File *
* *
* Copyright 2003 The NEdit Developers *
* *
* This 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. In addition, you may distribute version of this program linked to *
* Motif or Open Motif. See README for details. *
* *
* This software 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 General Public License along with *
* software; if not, write to the Free Software Foundation, Inc., 59 Temple *
* Place, Suite 330, Boston, MA 02111-1307 USA *
* *
* Nirvana Text Editor *
* July 31, 2001 *
* *
*******************************************************************************/
#ifndef NEDIT_GETFILES_H_INCLUDED
#define NEDIT_GETFILES_H_INCLUDED
#include <X11/Intrinsic.h>
#define GFN_OK 1 /* Get Filename OK constant */
#define GFN_CANCEL 2 /* Get Filename Cancel constant */
int GetExistingFilename(Widget parent, char *promptString, char *filename);
int HandleCustomExistFileSB(Widget existFileSB, char *filename);
int HandleCustomNewFileSB(Widget newFileSB, char *filename, char *defaultName);
char *GetFileDialogDefaultDirectory(void);
char *GetFileDialogDefaultPattern(void);
void SetFileDialogDefaultDirectory(char *dir);
void SetFileDialogDefaultPattern(char *pattern);
void SetGetEFTextFieldRemoval(int state);
#endif /* NEDIT_GETFILES_H_INCLUDED */
|
#ifndef dvsdef_h
#define dvsdef_h
#define DVS$_DEVCLASS 1
#define DVS$_DEVTYPE 2
#endif
|
/*
* This file is part of roccat-tools.
*
* roccat-tools 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.
*
* roccat-tools 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 roccat-tools. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ryosconfig_key_illumination_selector.h"
#include "ryos_stored_lights.h"
#include "roccat_helper.h"
#include "i18n.h"
#define RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_TYPE, RyosconfigKeyIlluminationSelectorClass))
#define IS_RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_TYPE))
#define RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_TYPE, RyosconfigKeyIlluminationSelectorPrivate))
typedef struct _RyosconfigKeyIlluminationSelectorClass RyosconfigKeyIlluminationSelectorClass;
typedef struct _RyosconfigKeyIlluminationSelectorPrivate RyosconfigKeyIlluminationSelectorPrivate;
struct _RyosconfigKeyIlluminationSelector {
GtkHBox parent;
RyosconfigKeyIlluminationSelectorPrivate *priv;
};
struct _RyosconfigKeyIlluminationSelectorClass {
GtkHBoxClass parent_class;
};
struct _RyosconfigKeyIlluminationSelectorPrivate {
GtkToggleButton *on;
GtkToggleButton *blink;
gulong on_handler_id;
gulong blink_handler_id;
};
G_DEFINE_TYPE(RyosconfigKeyIlluminationSelector, ryosconfig_key_illumination_selector, GTK_TYPE_HBOX);
enum {
CHANGED,
LAST_SIGNAL,
};
static guint signals[LAST_SIGNAL] = { 0 };
GtkWidget *ryosconfig_key_illumination_selector_new(void) {
return GTK_WIDGET(g_object_new(RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_TYPE, NULL));
}
static void on_cb(GtkToggleButton *togglebutton, gpointer user_data) {
RyosconfigKeyIlluminationSelector *illumination_selector = RYOSCONFIG_KEY_ILLUMINATION_SELECTOR(user_data);
g_signal_emit((gpointer)illumination_selector, signals[CHANGED], 0);
}
static void blink_cb(GtkToggleButton *togglebutton, gpointer user_data) {
RyosconfigKeyIlluminationSelector *illumination_selector = RYOSCONFIG_KEY_ILLUMINATION_SELECTOR(user_data);
RyosconfigKeyIlluminationSelectorPrivate *priv = illumination_selector->priv;
if (gtk_toggle_button_get_active(togglebutton)) {
g_signal_handler_block(G_OBJECT(priv->on), priv->on_handler_id);
gtk_toggle_button_set_active(priv->on, TRUE);
g_signal_handler_unblock(G_OBJECT(priv->on), priv->on_handler_id);
}
g_signal_emit((gpointer)illumination_selector, signals[CHANGED], 0);
}
static void ryosconfig_key_illumination_selector_init(RyosconfigKeyIlluminationSelector *illumination_selector) {
RyosconfigKeyIlluminationSelectorPrivate *priv = RYOSCONFIG_KEY_ILLUMINATION_SELECTOR_GET_PRIVATE(illumination_selector);
illumination_selector->priv = priv;
priv->on = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label(_("On/Off")));
priv->blink = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label(_("Blinking")));
gtk_widget_set_tooltip_text(GTK_WIDGET(priv->blink), _("Blink only works when layer effect is off."));
priv->on_handler_id = g_signal_connect(G_OBJECT(priv->on), "toggled", G_CALLBACK(on_cb), illumination_selector);
priv->blink_handler_id = g_signal_connect(G_OBJECT(priv->blink), "toggled", G_CALLBACK(blink_cb), illumination_selector);
gtk_box_pack_start(GTK_BOX(illumination_selector), GTK_WIDGET(priv->on), TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(illumination_selector), gtk_vseparator_new(), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(illumination_selector), GTK_WIDGET(priv->blink), TRUE, FALSE, 0);
}
static void ryosconfig_key_illumination_selector_class_init(RyosconfigKeyIlluminationSelectorClass *klass) {
g_type_class_add_private(klass, sizeof(RyosconfigKeyIlluminationSelectorPrivate));
signals[CHANGED] = g_signal_new("changed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
void ryosconfig_key_illumination_selector_set_value_blocked(RyosconfigKeyIlluminationSelector *illumination_selector, guint8 value) {
RyosconfigKeyIlluminationSelectorPrivate *priv = illumination_selector->priv;
g_signal_handler_block(G_OBJECT(priv->on), priv->on_handler_id);
gtk_toggle_button_set_active(priv->on, roccat_get_bit8(value, RYOS_LIGHT_LAYER_KEY_BIT_ON));
g_signal_handler_unblock(G_OBJECT(priv->on), priv->on_handler_id);
g_signal_handler_block(G_OBJECT(priv->blink), priv->blink_handler_id);
gtk_toggle_button_set_active(priv->blink, roccat_get_bit8(value, RYOS_LIGHT_LAYER_KEY_BIT_BLINK));
g_signal_handler_unblock(G_OBJECT(priv->blink), priv->blink_handler_id);
}
guint8 ryosconfig_key_illumination_selector_get_value(RyosconfigKeyIlluminationSelector *illumination_selector) {
RyosconfigKeyIlluminationSelectorPrivate *priv = illumination_selector->priv;
guint8 result = 0;
roccat_set_bit8(&result, RYOS_LIGHT_LAYER_KEY_BIT_ON, gtk_toggle_button_get_active(priv->on));
roccat_set_bit8(&result, RYOS_LIGHT_LAYER_KEY_BIT_BLINK, gtk_toggle_button_get_active(priv->blink));
return result;
}
|
/* Copyright (C) 2003-2010 Jesper K. Pedersen <blackie@kde.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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef EXIFPAGE_H
#define EXIFPAGE_H
#include <QComboBox>
#include <QWidget>
namespace Exif { class TreeView; }
namespace Settings
{
class SettingsData;
class ExifPage :public QWidget
{
public:
explicit ExifPage( QWidget* parent );
void loadSettings( Settings::SettingsData* );
void saveSettings( Settings::SettingsData* );
private:
Exif::TreeView* _exifForViewer;
Exif::TreeView* _exifForDialog;
QComboBox* _iptcCharset;
};
}
#endif /* EXIFPAGE_H */
// vi:expandtab:tabstop=4 shiftwidth=4:
|
/*
* ClusterTypeFactory.h
*
* Created on: 29/lug/2014
* Author: Paolo Achdjian
*/
#ifndef CLUSTERTYPEFACTORY_H_
#define CLUSTERTYPEFACTORY_H_
#include <memory>
#include "zigbee/ZigbeeDevice.h"
#include "zcl/Cluster.h"
#include "ClustersEnum.h"
#include "zigbee/EndpointID.h"
namespace zigbee {
class ClusterTypeFactory {
public:
static std::unique_ptr<Cluster> createCluster(ClusterID clusterId, ZigbeeDevice * zigbeeDevice, const EndpointID endpoint, NwkAddr networkAddress);
virtual ~ClusterTypeFactory() = default;
virtual std::unique_ptr<Cluster> getCluster(ClusterID clusterId, ZigbeeDevice * zigbeeDevice, const EndpointID endpoint, NwkAddr networkAddress);
};
} /* namespace zigbee */
#endif /* CLUSTERTYPEFACTORY_H_ */
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "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 Nokia Corporation and its Subsidiary(-ies) 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."
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CONNECTIVITYHELPER_H
#define CONNECTIVITYHELPER_H
#include <QObject>
// QtMobility API headers
#include <QGeoCoordinate>
#include <QtNetwork/QNetworkSession>
class QWidget;
// Use the QtMobility namespace
//using namespace QtMobility;
class ConnectivityHelper : public QObject
{
Q_OBJECT
public:
ConnectivityHelper(QNetworkSession *session, QWidget *parent = 0);
signals:
void networkingCancelled();
private slots:
void error(QNetworkSession::SessionError error);
private:
QNetworkSession *m_session;
};
#endif // #ifndef CONNECTIVITYHELPER_H
|
/* common.c - Common functions */
/* Written 1995-1999 by Werner Almesberger, EPFL-LRC */
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include "atmd.h"
void *alloc(size_t size)
{
void *n;
n = malloc(size);
if (n) return n;
perror("malloc");
exit(1);
}
uint32_t read_netl(void *p)
{
unsigned char *_p = p;
return (_p[0] << 24) | (_p[1] << 16) | (_p[2] << 8) | _p[3];
}
|
#ifndef STDAFX_H
#define STDAFX_H
#ifdef _WIN32
#define DEFFILEMODE (0)
#endif
#ifndef __APPLE__
#include "config.h"
#endif /* __APPLE__ */
#include "afxgen.h"
#ifdef AMIGA
typedef UBYTE uint8_t;
typedef LONG SDWORD;
typedef ULONG UDWORD;
typedef ULONG uint32_t;
typedef unsigned long long UQUAD;
#else
typedef uint8_t UBYTE;
typedef uint16_t UWORD;
typedef int32_t SDWORD;
typedef uint32_t UDWORD;
typedef uint64_t UQUAD;
#endif /* AMIGA */
typedef void *PVOID;
typedef char *PCHAR;
typedef UBYTE *PUBYTE;
typedef UDWORD *PUDWORD;
typedef SDWORD *PSDWORD;
typedef struct CapsDateTimeExt *PCAPSDATETIMEEXT;
typedef struct CapsImageInfo *PCAPSIMAGEINFO;
typedef struct CapsTrackInfo *PCAPSTRACKINFO;
typedef struct CapsTrackInfoT1 *PCAPSTRACKINFOT1;
typedef struct CapsTrackInfoT2 *PCAPSTRACKINFOT2;
typedef struct CapsVersionInfo *PCAPSVERSIONINFO;
typedef struct CapsSectorInfo *PCAPSSECTORINFO;
typedef struct CapsDataInfo *PCAPSDATAINFO;
typedef struct CapsDrive *PCAPSDRIVE;
typedef struct CapsFdc *PCAPSFDC;
typedef struct CapsFormatBlock *PCAPSFORMATBLOCK;
typedef struct CapsFormatTrack *PCAPSFORMATTRACK;
#define DF_0 (1L<<0)
#define DF_1 (1L<<1)
#define DF_2 (1L<<2)
#define DF_3 (1L<<3)
#define DF_4 (1L<<4)
#define DF_5 (1L<<5)
#define DF_6 (1L<<6)
#define DF_7 (1L<<7)
#define DF_8 (1L<<8)
#define DF_9 (1L<<9)
#define DF_10 (1L<<10)
#define DF_11 (1L<<11)
#define DF_12 (1L<<12)
#define DF_13 (1L<<13)
#define DF_14 (1L<<14)
#define DF_15 (1L<<15)
#define DF_16 (1L<<16)
#define DF_17 (1L<<17)
#define DF_18 (1L<<18)
#define DF_19 (1L<<19)
#define DF_20 (1L<<20)
#define DF_21 (1L<<21)
#define DF_22 (1L<<22)
#define DF_23 (1L<<23)
#define DF_24 (1L<<24)
#define DF_25 (1L<<25)
#define DF_26 (1L<<26)
#define DF_27 (1L<<27)
#define DF_28 (1L<<28)
#define DF_29 (1L<<29)
#define DF_30 (1L<<30)
#define DF_31 (1L<<31)
#if !defined(WORDS_BIGENDIAN) && !defined(__BIG_ENDIAN__)
#define INTEL
#endif /* !defined(WORDS_BIGENDIAN) && !defined(__BIG_ENDIAN__) */
#ifdef _DEBUG
#define NODEFAULT assert(0)
#else
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define NODEFAULT __builtin_unreachable()
#else
#define NODEFAULT __builtin_trap()
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) */
#endif /* _DEBUG */
#include "crc.h"
#include "caps/capsimage.h"
#include "Capsdef.h"
#include "CapsFile.h"
#include "DiskEnc.h"
#include "DiskImg.h"
#include "CapsLdr.h"
#include "CapsImgS.h"
#include "caps/fdc.h"
#include "CapsEFDC.h"
#include "caps/form.h"
#include "CapsEMFM.h"
#include "CapsCore.h"
#endif /* STDAFX_H */
|
/*
* Copyright (C) 1996-2015 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
#ifndef _SQUID_SRC_COMM_OPENERSTATEDATA_H
#define _SQUID_SRC_COMM_OPENERSTATEDATA_H
#include "base/AsyncCall.h"
#include "base/AsyncJob.h"
#include "cbdata.h"
#include "comm/Flag.h"
#include "comm/forward.h"
#include "CommCalls.h"
namespace Comm
{
/**
* Async-opener of a Comm connection.
*/
class ConnOpener : public AsyncJob
{
CBDATA_CLASS(ConnOpener);
protected:
virtual void start();
virtual void swanSong();
public:
void noteAbort() { mustStop("externally aborted"); }
typedef CbcPointer<ConnOpener> Pointer;
virtual bool doneAll() const;
ConnOpener(Comm::ConnectionPointer &, AsyncCall::Pointer &handler, time_t connect_timeout);
~ConnOpener();
void setHost(const char *); ///< set the hostname note for this connection
const char * getHost() const; ///< get the hostname noted for this connection
private:
// Undefined because two openers cannot share a connection
ConnOpener(const ConnOpener &);
ConnOpener & operator =(const ConnOpener &c);
void earlyAbort(const CommCloseCbParams &);
void timeout(const CommTimeoutCbParams &);
void sendAnswer(Comm::Flag errFlag, int xerrno, const char *why);
static void InProgressConnectRetry(int fd, void *data);
static void DelayedConnectRetry(void *data);
void doConnect();
void connected();
void lookupLocalAddress();
void retrySleep();
void restart();
bool createFd();
void closeFd();
void keepFd();
void cleanFd();
void cancelSleep();
private:
char *host_; ///< domain name we are trying to connect to.
int temporaryFd_; ///< the FD being opened. Do NOT set conn_->fd until it is fully open.
Comm::ConnectionPointer conn_; ///< single connection currently to be opened.
AsyncCall::Pointer callback_; ///< handler to be called on connection completion.
int totalTries_; ///< total number of connection attempts over all destinations so far.
int failRetries_; ///< number of retries current destination has been tried.
/// if we are not done by then, we will call back with Comm::TIMEOUT
time_t deadline_;
/// handles to calls which we may need to cancel.
struct Calls {
AsyncCall::Pointer earlyAbort_;
AsyncCall::Pointer timeout_;
/// Whether we are idling before retrying to connect; not yet a call
/// [that we can cancel], but it will probably become one eventually.
bool sleep_;
} calls_;
};
}; // namespace Comm
#endif /* _SQUID_SRC_COMM_CONNOPENER_H */
|
/*
* FLV decoding.
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mpegvideo.h"
#include "h263.h"
#include "flv.h"
#include "libavutil/imgutils.h"
void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last)
{
int is11 = get_bits1(gb);
*last = get_bits1(gb);
*run = get_bits(gb, 6);
if (is11) {
*level = get_sbits(gb, 11);
} else {
*level = get_sbits(gb, 7);
}
}
int ff_flv_decode_picture_header(MpegEncContext *s)
{
int format, width, height;
/* picture header */
if (get_bits_long(&s->gb, 17) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
format = get_bits(&s->gb, 5);
if (format != 0 && format != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture format\n");
return -1;
}
s->h263_flv = format + 1;
s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
format = get_bits(&s->gb, 3);
switch (format) {
case 0:
width = get_bits(&s->gb, 8);
height = get_bits(&s->gb, 8);
break;
case 1:
width = get_bits(&s->gb, 16);
height = get_bits(&s->gb, 16);
break;
case 2:
width = 352;
height = 288;
break;
case 3:
width = 176;
height = 144;
break;
case 4:
width = 128;
height = 96;
break;
case 5:
width = 320;
height = 240;
break;
case 6:
width = 160;
height = 120;
break;
default:
width = height = 0;
break;
}
if (av_image_check_size(width, height, 0, s->avctx))
return -1;
s->width = width;
s->height = height;
s->pict_type = AV_PICTURE_TYPE_I + get_bits(&s->gb, 2);
s->droppable = s->pict_type > AV_PICTURE_TYPE_P;
if (s->droppable)
s->pict_type = AV_PICTURE_TYPE_P;
skip_bits1(&s->gb); /* deblocking flag */
s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
s->h263_plus = 0;
s->unrestricted_mv = 1;
s->h263_long_vectors = 0;
/* PEI */
while (get_bits1(&s->gb) != 0)
skip_bits(&s->gb, 8);
s->f_code = 1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
s->droppable ? 'D' : av_get_picture_type_char(s->pict_type),
s->h263_flv - 1, s->qscale, s->picture_number);
}
s->y_dc_scale_table = s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
return 0;
}
AVCodec ff_flv_decoder = {
.name = "flv",
.long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_FLV1,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_h263_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE
},
};
|
/*
* comm_hdr.h
*
* Created on: Oct 1, 2012
* Author: ch
*/
#ifndef COMM_HDR_H_
#define COMM_HDR_H_
#include "const.h"
#include "error_code.h"
#include "log.h"
#include "util.h"
#endif /* COMM_HDR_H_ */
|
#include "drmP.h"
#include "drm.h"
#include "nouveau_drv.h"
#include "nouveau_drm.h"
void
nv40_fb_set_tile_region(struct drm_device *dev, int i)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i];
switch (dev_priv->chipset) {
case 0x40:
nv_wr32(dev, NV10_PFB_TLIMIT(i), tile->limit);
nv_wr32(dev, NV10_PFB_TSIZE(i), tile->pitch);
nv_wr32(dev, NV10_PFB_TILE(i), tile->addr);
break;
default:
nv_wr32(dev, NV40_PFB_TLIMIT(i), tile->limit);
nv_wr32(dev, NV40_PFB_TSIZE(i), tile->pitch);
nv_wr32(dev, NV40_PFB_TILE(i), tile->addr);
break;
}
}
static void
nv40_fb_init_gart(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_gpuobj *gart = dev_priv->gart_info.sg_ctxdma;
if (dev_priv->gart_info.type != NOUVEAU_GART_HW) {
nv_wr32(dev, 0x100800, 0x00000001);
return;
}
nv_wr32(dev, 0x100800, gart->pinst | 0x00000002);
nv_mask(dev, 0x10008c, 0x00000100, 0x00000100);
nv_wr32(dev, 0x100820, 0x00000000);
}
static void
nv44_fb_init_gart(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_gpuobj *gart = dev_priv->gart_info.sg_ctxdma;
u32 vinst;
if (dev_priv->gart_info.type != NOUVEAU_GART_HW) {
nv_wr32(dev, 0x100850, 0x80000000);
nv_wr32(dev, 0x100800, 0x00000001);
return;
}
/* calculate vram address of this PRAMIN block, object
* must be allocated on 512KiB alignment, and not exceed
* a total size of 512KiB for this to work correctly
*/
vinst = nv_rd32(dev, 0x10020c);
vinst -= ((gart->pinst >> 19) + 1) << 19;
nv_wr32(dev, 0x100850, 0x80000000);
nv_wr32(dev, 0x100818, dev_priv->gart_info.dummy.addr);
nv_wr32(dev, 0x100804, dev_priv->gart_info.aper_size);
nv_wr32(dev, 0x100850, 0x00008000);
nv_mask(dev, 0x10008c, 0x00000200, 0x00000200);
nv_wr32(dev, 0x100820, 0x00000000);
nv_wr32(dev, 0x10082c, 0x00000001);
nv_wr32(dev, 0x100800, vinst | 0x00000010);
}
int
nv40_fb_init(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
uint32_t tmp;
int i;
if (dev_priv->chipset != 0x40 && dev_priv->chipset != 0x45) {
if (nv44_graph_class(dev))
nv44_fb_init_gart(dev);
else
nv40_fb_init_gart(dev);
}
switch (dev_priv->chipset) {
case 0x40:
case 0x45:
tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2);
nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15));
pfb->num_tiles = NV10_PFB_TILE__SIZE;
break;
case 0x46: /* G72 */
case 0x47: /* G70 */
case 0x49: /* G71 */
case 0x4b: /* G73 */
case 0x4c: /* C51 (G7X version) */
pfb->num_tiles = NV40_PFB_TILE__SIZE_1;
break;
default:
pfb->num_tiles = NV40_PFB_TILE__SIZE_0;
break;
}
/* Turn all the tiling regions off. */
for (i = 0; i < pfb->num_tiles; i++)
pfb->set_tile_region(dev, i);
return 0;
}
void
nv40_fb_takedown(struct drm_device *dev)
{
}
|
#ifndef SAIL_H
#define SAIL_H
#define SAIL_APPKEY "/SAIL"
#define SAIL_COMPANYKEY "Biluna"
#endif // SAIL_H
|
#pragma once
#include <Eigen/Sparse>
#include <vector>
using namespace Eigen;
using namespace std;
// Forward Grad x (forward-differenced grad)
SparseMatrix<double> fGradX (const int N, const int off = 0) {
vector<Triplet<double>> tripletList;
tripletList.reserve (2 * N);
int jb, jf;
jb = off; jf = 1 + off;
while (jb < 0 || jb >= N) (jb = (jb + N) % N);
while (jf < 0 || jf >= N) (jf = (jf + N) % N);
for (int i = 0; i < N; ++i) {
tripletList.push_back (Triplet<double> (i, jb++, -1.0));
tripletList.push_back (Triplet<double> (i, jf++, 1.0));
if (jb >= N) jb -= N; if (jf >= N) jf -= N;
}
SparseMatrix<double> fgradX (N, N);
fgradX.setFromTriplets (tripletList.begin (), tripletList.end ());
return fgradX;
}
// Centered Grad x (center-differenced grad)
SparseMatrix<double> cGradX (const int N, const int off = 0) {
vector<Triplet<double>> tripletList;
tripletList.reserve (2 * N);
int jb, jf;
jb = N - 1 + off; jf = 1 + off;
while (jb < 0 || jb >= N) (jb = (jb + N) % N);
while (jf < 0 || jf >= N) (jf = (jf + N) % N);
for (int i = 0; i < N; ++i) {
tripletList.push_back (Triplet<double> (i, jb++, -1.0));
tripletList.push_back (Triplet<double> (i, jf++, 1.0));
if (jb >= N) jb -= N; if (jf >= N) jf -= N;
}
SparseMatrix<double> cgradX (N, N);
cgradX.setFromTriplets (tripletList.begin (), tripletList.end ());
return cgradX;
}
// Backward Grad x (backward-differenced grad)
SparseMatrix<double> bGradX (const int N, const int off = 0) {
vector<Triplet<double>> tripletList;
tripletList.reserve (2 * N);
int jb, jf;
jb = N - 1 + off; jf = off;
while (jb < 0 || jb >= N) (jb = (jb + N) % N);
while (jf < 0 || jf >= N) (jf = (jf + N) % N);
for (int i = 0; i < N; ++i) {
tripletList.push_back (Triplet<double> (i, jb++, -1.0));
tripletList.push_back (Triplet<double> (i, jf++, 1.0));
if (jb >= N) jb -= N; if (jf >= N) jf -= N;
}
SparseMatrix<double> bgradX (N, N);
bgradX.setFromTriplets (tripletList.begin (), tripletList.end ());
return bgradX;
}
|
/* expert_comp_dlg.h
* expert_comp_dlg 2005 Greg Morris
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void expert_comp_dlg_cb(GtkWidget *w, gpointer d);
|
#ifndef __PPC_FSL_SOC_H
#define __PPC_FSL_SOC_H
#ifdef __KERNEL__
#include <asm/mmu.h>
#include <asm/prom.h>
extern phys_addr_t immrbase;
extern u32 brgfreq;
extern u32 fs_baudrate;
extern phys_addr_t get_immrbase(void);
extern u32 get_brgfreq(void);
extern u32 get_baudrate(void);
extern u32 fsl_get_sys_freq(void);
struct dsk {
char *dev;
char *prm;
u32 *result;
};
static inline int early_get_from_flat_dt(unsigned long node, const char *uname,
int depth, void *data)
{
struct dsk *p = data;
char *type = of_get_flat_dt_prop(node, "device_type", NULL);
u32 *param;
unsigned long len;
if (type == NULL || strcmp(type, p->dev) != 0)
return 0;
param = of_get_flat_dt_prop(node, p->prm, &len);
*(p->result) = *param;
return 1;
}
static inline void get_from_flat_dt(char *device, char *param, void *save_in)
{
struct dsk pack = { device, param, save_in };
of_scan_flat_dt(early_get_from_flat_dt, &pack);
}
struct spi_board_info;
extern int fsl_spi_init(struct spi_board_info *board_infos,
unsigned int num_board_infos,
void (*activate_cs)(u8 cs, u8 polarity),
void (*deactivate_cs)(u8 cs, u8 polarity));
extern void fsl_rstcr_restart(char *cmd);
#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
#include <linux/bootmem.h>
#include <asm/rheap.h>
struct platform_diu_data_ops {
rh_block_t diu_rh_block[16];
rh_info_t diu_rh_info;
unsigned long diu_size;
void *diu_mem;
unsigned int (*get_pixel_format) (unsigned int bits_per_pixel,
int monitor_port);
void (*set_gamma_table) (int monitor_port, char *gamma_table_base);
void (*set_monitor_port) (int monitor_port);
void (*set_pixel_clock) (unsigned int pixclock);
ssize_t (*show_monitor_port) (int monitor_port, char *buf);
int (*set_sysfs_monitor_port) (int val);
};
extern struct platform_diu_data_ops diu_ops;
int __init preallocate_diu_videomemory(void);
#endif
#endif
#endif
|
#ifndef _MONGOOSE_REQUEST_HANDLER_H
#define _MONGOOSE_REQUEST_HANDLER_H
#include "Request.h"
#include "Response.h"
#include <string>
namespace Mongoose
{
class RequestHandlerBase
{
public:
virtual Response *process(Request &request)=0;
};
template<typename T, typename R>
class RequestHandler : public RequestHandlerBase
{
public:
typedef void (T::*fPtr)(Request &request, R &response);
RequestHandler(T *controller_, fPtr function_)
: controller(controller_), function(function_)
{
}
Response *process(Request &request)
{
R *response = new R;
try {
(controller->*function)(request, *response);
} catch (std::string exception) {
return controller->serverInternalError(exception);
} catch (...) {
return controller->serverInternalError("Unknown error");
}
return response;
}
protected:
T *controller;
fPtr function;
};
}
#endif
|
/*
* AreaCodeView.h
*
* Copyright (C) 2017 SNRB Labs LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef AreaCodeView_h
#define AreaCodeView_h
#import <UIKit/UIKit.h>
#import "UICompositeView.h"
#import "PhoneMainView.h"
@interface AreaCodeView : TPMultiLayoutViewController <UITextFieldDelegate, UICompositeViewDelegate>
@property (strong, nonatomic) IBOutlet UITextField *areaCodeField;
@property (strong, nonatomic) IBOutlet UIButton *showButton;
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
@end
#endif /* AreaCodeView_h */
|
#ifndef ENGINE_H
#define ENGINE_H
#include "engine_global.h"
class ENGINESHARED_EXPORT TEngine {
public:
TEngine();
};
#endif // ENGINE_H
|
/*
* Copyright (C) 2022-2022 Colin Ian King.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <asm/cachectl.h>
int main(void)
{
static char buffer[4096];
return cacheflush(buffer, 64, 1);
}
|
// 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_UI_CONFIRM_BUBBLE_H_
#define CHROME_BROWSER_UI_CONFIRM_BUBBLE_H_
#include "ui/gfx/native_widget_types.h"
class ConfirmBubbleModel;
namespace gfx {
class Point;
}
namespace chrome {
void ShowConfirmBubble(gfx::NativeView view,
const gfx::Point& origin,
ConfirmBubbleModel* model);
}
#endif
|
#ifndef FNNLM_LOGBILINEAR_FNNLM_H_
#define FNNLM_LOGBILINEAR_FNNLM_H_
#include <cstdio>
#include <string>
#include <vector>
#include <boost/random/mersenne_twister.hpp>
#include "../neuralnet/full_circular_buffer.h"
#include "../neuralnet/neuralnet_types.h"
#include "../neuralnet/neuralnet_connection.h"
#include "../neuralnet/neuralnet_shared_connection.h"
#include "../neuralnet/neuralnet_sparse_layer.h"
#include "../neuralnet/neuralnet_identity_layer.h"
#include "../neuralnet/neuralnet_softmax_layer.h"
#include "../neuralnet/neuralnet_exp_layer.h"
#include "fnnlm_vocab.h"
#include "fnnlm_data_reader.h"
#include "fnnlm_base.h"
namespace fnnlm {
// Botha and Blunsom's log-bilinear LM++ (Botha and Blunsom 2014).
// LBL++: use_factor_input_ == true && use_factor_hidden_ == true
// LBL+c: use_factor_input_ == true && use_factor_hidden_ == false
// LBL+o: use_factor_input_ == false && use_factor_hidden_ == true
// LBL: use_factor_input_ == false && use_factor_hidden_ == false (recommend to
// use logbilinear_nnlm instead since it has less if-statement)
class LogBilinearFNeuralNetLM : public FNeuralNetLMBase {
public:
// Constructor.
LogBilinearFNeuralNetLM() : context_size_(0), num_hiddens_(0) {}
// Destructor.
~LogBilinearFNeuralNetLM() {}
// Sets the context size.
void set_context_size(std::size_t cs) { context_size_ = cs; }
// Sets number of hidden neurons / dimension of the word feature vector.
void set_nhiddens(std::size_t nh) { num_hiddens_ = nh; }
private:
// Implementation of ReadLM.
virtual void ReadLMImpl(std::ifstream &ifs) override;
// Implemenation of WriteLM.
virtual void WriteLMImpl(std::ofstream &ofs) override;
// Implementation of ExtractWordInputEmbedding.
virtual void ExtractWordInputEmbeddingImpl(std::ofstream &ofs) override;
// Implementation of ExtractWordOutputEmbedding.
virtual void ExtractWordOutputEmbeddingImpl(std::ofstream &ofs) override;
// Implementation of CheckParams.
virtual void CheckParamsImpl() override;
// Implementation of PrintParams.
virtual void PrintParamsImpl() override;
// Allocates the model.
virtual void AllocateModel() override;
// Initialize the neural network.
virtual void InitializeNeuralNet() override;
// Resets the neural network activations.
virtual void ResetActivations() override;
// Caches parameters in current iteration.
virtual void CacheCurrentParams() override;
// Restores parameters in last iteration.
virtual void RestoreLastParams() override;
// Forward propagates.
virtual void ForwardPropagate(std::size_t w, const std::vector<std::size_t> &fs) override;
// Back propagates.
virtual void BackPropagate(std::size_t w, const std::vector<std::size_t> &fs) override;
// Updates the connections for skipped rows (fast update trick).
virtual void FastUpdateWeightsMajor(float learning_rate) override;
// Updates the connections for skipped rows (fast update trick).
// Should be called before learning rate changes, WriteLM or EvalLM.
virtual void FastUpdateWeightsMinor() override;
// Gets the log-probaility (base e) of the word w.
virtual double GetLogProb(std::size_t w, bool nce_exact) override;
//===================================
// Log-bilinear neural network parameters
//===================================
// Size of the context window (= ngram_order - 1).
std::size_t context_size_;
// Number of hidden neurons.
// It is also the dimension of the word feature vectors.
std::size_t num_hiddens_;
neuralnet::FullCircularBuffer<neuralnet::NeuralNetSparseLayer> word_input_layers_;
neuralnet::FullCircularBuffer<neuralnet::NeuralNetSparseLayer> factor_input_layers_;
neuralnet::FullCircularBuffer<neuralnet::NeuralNetIdentityLayer> projection_layers_;
neuralnet::NeuralNetIdentityLayer hidden_layer_;
neuralnet::NeuralNetIdentityLayer factor_hidden_layer_;
neuralnet::NeuralNetSoftmaxLayer output_layer_;
neuralnet::NeuralNetExpLayer nce_output_layer_;
neuralnet::NeuralNetSoftmaxLayer factor_output_layer_;
neuralnet::NeuralNetExpLayer nce_factor_output_layer_;
neuralnet::NeuralNetConnection connection_wordinput_projection_, last_connection_wordinput_projection_;
neuralnet::NeuralNetConnection connection_factorinput_projection_, last_connection_factorinput_projection_;
std::vector<neuralnet::NeuralNetConnection> connections_projection_hidden_, last_connections_projection_hidden_;
neuralnet::NeuralNetConnection connection_hidden_output_, last_connection_hidden_output_;
neuralnet::NeuralNetConnection connection_hidden_factorhidden_, last_connection_hidden_factorhidden_;
neuralnet::NeuralNetConnection connection_hidden_factoroutput_, last_connection_hidden_factoroutput_;
neuralnet::NeuralNetSparseLayer bias_layer_;
neuralnet::NeuralNetSharedConnection connection_globalbias_output_, last_connection_globalbias_output_;
neuralnet::NeuralNetConnection connection_bias_output_, last_connection_bias_output_;
neuralnet::NeuralNetSharedConnection connection_globalbias_factorhidden_, last_connection_globalbias_factorhidden_;
neuralnet::NeuralNetConnection connection_bias_factorhidden_, last_connection_bias_factorhidden_;
neuralnet::NeuralNetSharedConnection connection_globalbias_factoroutput_, last_connection_globalbias_factoroutput_;
neuralnet::NeuralNetConnection connection_bias_factoroutput_, last_connection_bias_factoroutput_;
boost::mt19937 rng_engine_;
};
} // namespace fnnlm
#endif
|
/*IBM 5150 cassette nonsense
Calls F979 twice
Expects CX to be nonzero, BX >$410 and <$540
CX is loops between bit 4 of $62 changing
BX is timer difference between calls
*/
#include "ibm.h"
#include "pit.h"
#include "plat-keyboard.h"
#include "plat-mouse.h"
void ppi_reset()
{
ppi.pa=0x0;//0x1D;
ppi.pb=0x40;
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FILTERS_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
#define MEDIA_FILTERS_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
#include "base/basictypes.h"
#include "media/base/media_export.h"
namespace media {
class MEDIA_EXPORT H264ToAnnexBBitstreamConverter {
public:
H264ToAnnexBBitstreamConverter();
~H264ToAnnexBBitstreamConverter();
uint32 ParseConfigurationAndCalculateSize(const uint8* configuration_record,
uint32 configuration_record_size);
uint32 CalculateNeededOutputBufferSize(const uint8* input,
uint32 input_size) const;
// In case of failed conversion object H264BitstreamConverter may have written
// Pointer to buffer where the output should be written to.
// bytes written to output after successful call.
bool ConvertAVCDecoderConfigToByteStream(const uint8* input,
uint32 input_size,
uint8* output,
uint32* output_size);
// In case of failed conversion object H264BitstreamConverter may have written
// Pointer to buffer where the output should be written to.
// bytes written to output after successful call.
bool ConvertNalUnitStreamToByteStream(const uint8* input, uint32 input_size,
uint8* output, uint32* output_size);
private:
bool configuration_processed_;
bool first_nal_unit_in_access_unit_;
uint8 nal_unit_length_field_width_;
DISALLOW_COPY_AND_ASSIGN(H264ToAnnexBBitstreamConverter);
};
}
#endif
|
/*
* $Id: impa7.c,v 1.1 2003/01/09 22:17:04 ahennessy Exp $
*
* Handle mapping of the NOR flash on implementa A7 boards
*
* Copyright 2002 SYSGO Real-Time Solutions GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/config.h>
#ifdef CONFIG_MTD_PARTITIONS
#include <linux/mtd/partitions.h>
#endif
#define WINDOW_ADDR0 0x00000000 /* physical properties of flash */
#define WINDOW_SIZE0 0x00800000
#define WINDOW_ADDR1 0x10000000 /* physical properties of flash */
#define WINDOW_SIZE1 0x00800000
#define NUM_FLASHBANKS 2
#define BUSWIDTH 4
/* can be { "cfi_probe", "jedec_probe", "map_rom", 0 }; */
#define PROBETYPES { "jedec_probe", 0 }
#define MSG_PREFIX "impA7:" /* prefix for our printk()'s */
#define MTDID "impa7-%d" /* for mtdparts= partitioning */
static struct mtd_info *impa7_mtd[NUM_FLASHBANKS] = { 0 };
static struct map_info impa7_map[NUM_FLASHBANKS] = {
{
.name = "impA7 NOR Flash Bank #0",
.size = WINDOW_SIZE0,
.buswidth = BUSWIDTH,
},
{
.name = "impA7 NOR Flash Bank #1",
.size = WINDOW_SIZE1,
.buswidth = BUSWIDTH,
},
};
#ifdef CONFIG_MTD_PARTITIONS
/*
* MTD partitioning stuff
*/
static struct mtd_partition static_partitions[] =
{
{
.name = "FileSystem",
.size = 0x800000,
.offset = 0x00000000
},
};
static int mtd_parts_nb[NUM_FLASHBANKS];
static struct mtd_partition *mtd_parts[NUM_FLASHBANKS];
#endif
static const char *probes[] = { "cmdlinepart", NULL };
int __init init_impa7(void)
{
static const char *rom_probe_types[] = PROBETYPES;
const char **type;
const char *part_type = 0;
int i;
static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = {
{ WINDOW_ADDR0, WINDOW_SIZE0 },
{ WINDOW_ADDR1, WINDOW_SIZE1 },
};
int devicesfound = 0;
for(i=0; i<NUM_FLASHBANKS; i++)
{
printk(KERN_NOTICE MSG_PREFIX "probing 0x%08lx at 0x%08lx\n",
pt[i].size, pt[i].addr);
impa7_map[i].phys = pt[i].addr;
impa7_map[i].virt = (unsigned long)
ioremap(pt[i].addr, pt[i].size);
if (!impa7_map[i].virt) {
printk(MSG_PREFIX "failed to ioremap\n");
return -EIO;
}
simple_map_init(&impa7_map[i]);
impa7_mtd[i] = 0;
type = rom_probe_types;
for(; !impa7_mtd[i] && *type; type++) {
impa7_mtd[i] = do_map_probe(*type, &impa7_map[i]);
}
if (impa7_mtd[i]) {
impa7_mtd[i]->owner = THIS_MODULE;
devicesfound++;
#ifdef CONFIG_MTD_PARTITIONS
mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i],
probes,
&mtd_parts[i],
0);
if (mtd_parts_nb[i] > 0) {
part_type = "command line";
} else {
mtd_parts[i] = static_partitions;
mtd_parts_nb[i] = ARRAY_SIZE(static_partitions);
part_type = "static";
}
printk(KERN_NOTICE MSG_PREFIX
"using %s partition definition\n",
part_type);
add_mtd_partitions(impa7_mtd[i],
mtd_parts[i], mtd_parts_nb[i]);
#else
add_mtd_device(impa7_mtd[i]);
#endif
}
else
iounmap((void *)impa7_map[i].virt);
}
return devicesfound == 0 ? -ENXIO : 0;
}
static void __exit cleanup_impa7(void)
{
int i;
for (i=0; i<NUM_FLASHBANKS; i++) {
if (impa7_mtd[i]) {
#ifdef CONFIG_MTD_PARTITIONS
del_mtd_partitions(impa7_mtd[i]);
#else
del_mtd_device(impa7_mtd[i]);
#endif
map_destroy(impa7_mtd[i]);
iounmap((void *)impa7_map[i].virt);
impa7_map[i].virt = 0;
}
}
}
module_init(init_impa7);
module_exit(cleanup_impa7);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pavel Bartusek <pba@sysgo.de>");
MODULE_DESCRIPTION("MTD map driver for implementa impA7");
|
/* init.c --- Entry point for libgsasl.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
*
* This file is part of GNU SASL Library.
*
* GNU SASL 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.
*
* GNU SASL 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 License along with GNU SASL Library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "internal.h"
/* Get gc_init. */
#include <gc.h>
/* Get mechanism headers. */
#include "cram-md5/cram-md5.h"
#include "external/external.h"
#include "gssapi/x-gssapi.h"
#include "gs2/gs2.h"
#include "anonymous/anonymous.h"
#include "plain/plain.h"
#include "securid/securid.h"
#include "digest-md5/digest-md5.h"
#include "login/login.h"
#include "ntlm/x-ntlm.h"
#include "kerberos_v5/kerberos_v5.h"
/**
* GSASL_VALID_MECHANISM_CHARACTERS:
*
* A zero-terminated character array, or string, with all ASCII
* characters that may be used within a SASL mechanism name.
**/
const char *GSASL_VALID_MECHANISM_CHARACTERS =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
static int
register_builtin_mechs (Gsasl * ctx)
{
int rc = GSASL_OK;
#ifdef USE_ANONYMOUS
rc = gsasl_register (ctx, &gsasl_anonymous_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_ANONYMOUS */
#ifdef USE_EXTERNAL
rc = gsasl_register (ctx, &gsasl_external_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_EXTERNAL */
#ifdef USE_LOGIN
rc = gsasl_register (ctx, &gsasl_login_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_LOGIN */
#ifdef USE_PLAIN
rc = gsasl_register (ctx, &gsasl_plain_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_PLAIN */
#ifdef USE_SECURID
rc = gsasl_register (ctx, &gsasl_securid_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_SECURID */
#ifdef USE_NTLM
rc = gsasl_register (ctx, &gsasl_ntlm_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_NTLM */
#ifdef USE_DIGEST_MD5
rc = gsasl_register (ctx, &gsasl_digest_md5_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_DIGEST_MD5 */
#ifdef USE_CRAM_MD5
rc = gsasl_register (ctx, &gsasl_cram_md5_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_CRAM_MD5 */
#ifdef USE_GSSAPI
rc = gsasl_register (ctx, &gsasl_gssapi_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_GSSAPI */
#ifdef USE_GS2
rc = gsasl_register (ctx, &gsasl_gs2_krb5_mechanism);
if (rc != GSASL_OK)
return rc;
#endif /* USE_GSSAPI */
return GSASL_OK;
}
/**
* gsasl_init:
* @ctx: pointer to libgsasl handle.
*
* This functions initializes libgsasl. The handle pointed to by ctx
* is valid for use with other libgsasl functions iff this function is
* successful. It also register all builtin SASL mechanisms, using
* gsasl_register().
*
* Return value: GSASL_OK iff successful, otherwise
* %GSASL_MALLOC_ERROR.
**/
int
gsasl_init (Gsasl ** ctx)
{
int rc;
if (gc_init () != GC_OK)
return GSASL_CRYPTO_ERROR;
*ctx = (Gsasl *) calloc (1, sizeof (**ctx));
if (*ctx == NULL)
return GSASL_MALLOC_ERROR;
rc = register_builtin_mechs (*ctx);
if (rc != GSASL_OK)
{
gsasl_done (*ctx);
return rc;
}
return GSASL_OK;
}
|
#ifndef CLAIRE_RENDERING_PLATFORM_H
#define CLAIRE_RENDERING_PLATFORM_H
namespace Claire
{
#if CLAIRE_PLATFORM == CLAIRE_PLATFORM_WIN32
# if defined(CLAIRE_RENDERING_NONCLIENT_BUILD)
# define CLAIRE_RENDERING_EXPORT __declspec(dllexport)
# else
# define CLAIRE_RENDERING_EXPORT __declspec(dllimport)
# endif
#endif
}
#endif
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/mm.h>
#include <linux/writeback.h>
#include <linux/sysctl.h>
#include <linux/gfp.h>
void jext3_truncate(struct inode *inode)
{
{
printk("process %s pid=%d inode=%p\n",
current->comm,
current->pid,inode);
// dump_stack();
}
jprobe_return();
return;
}
static struct jprobe my_jprobe = {
.entry = jext3_truncate,
.kp = {
.symbol_name = "ext3_truncate",
},
};
int init_module(void)
{
int ret;
if ((ret = register_jprobe(&my_jprobe)) <0) {
printk("register_jprobe failed, returned %d\n", ret);
return -1;
}
printk("Registered a jprobe.\n");
return 0;
}
void cleanup_module(void)
{
unregister_jprobe(&my_jprobe);
printk("jprobe unregistered\n");
}
MODULE_LICENSE("GPL");
|
#include <linux/syscalls.h>
#include <linux/export.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/statfs.h>
#include <linux/security.h>
#include <linux/uaccess.h>
#include "internal.h"
static int flags_by_mnt(int mnt_flags)
{
int flags = 0;
if (mnt_flags & MNT_READONLY)
flags |= ST_RDONLY;
if (mnt_flags & MNT_NOSUID)
flags |= ST_NOSUID;
if (mnt_flags & MNT_NODEV)
flags |= ST_NODEV;
if (mnt_flags & MNT_NOEXEC)
flags |= ST_NOEXEC;
if (mnt_flags & MNT_NOATIME)
flags |= ST_NOATIME;
if (mnt_flags & MNT_NODIRATIME)
flags |= ST_NODIRATIME;
if (mnt_flags & MNT_RELATIME)
flags |= ST_RELATIME;
return flags;
}
static int flags_by_sb(int s_flags)
{
int flags = 0;
if (s_flags & MS_SYNCHRONOUS)
flags |= ST_SYNCHRONOUS;
if (s_flags & MS_MANDLOCK)
flags |= ST_MANDLOCK;
return flags;
}
static int calculate_f_flags(struct vfsmount *mnt)
{
return ST_VALID | flags_by_mnt(mnt->mnt_flags) |
flags_by_sb(mnt->mnt_sb->s_flags);
}
static int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf)
{
int retval;
if (!dentry->d_sb->s_op->statfs)
return -ENOSYS;
memset(buf, 0, sizeof(*buf));
retval = security_sb_statfs(dentry);
if (retval)
return retval;
retval = dentry->d_sb->s_op->statfs(dentry, buf);
if (retval == 0 && buf->f_frsize == 0)
buf->f_frsize = buf->f_bsize;
return retval;
}
int vfs_statfs(struct path *path, struct kstatfs *buf)
{
int error;
error = statfs_by_dentry(path->dentry, buf);
if (!error)
buf->f_flags = calculate_f_flags(path->mnt);
return error;
}
EXPORT_SYMBOL(vfs_statfs);
int user_statfs(const char __user *pathname, struct kstatfs *st)
{
struct path path;
int error;
unsigned int lookup_flags = LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT;
retry:
error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);
if (!error) {
error = vfs_statfs(&path, st);
path_put(&path);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
}
return error;
}
int fd_statfs(int fd, struct kstatfs *st)
{
struct fd f = fdgetr_raw(fd, CAP_FSTATFS);
int error;
if (!IS_ERR(f.file)) {
error = vfs_statfs(&f.file->f_path, st);
fdput(f);
} else {
error = PTR_ERR(f.file);
}
return error;
}
static int do_statfs_native(struct kstatfs *st, struct statfs __user *p)
{
struct statfs buf;
if (sizeof(buf) == sizeof(*st))
memcpy(&buf, st, sizeof(*st));
else {
if (sizeof buf.f_blocks == 4) {
if ((st->f_blocks | st->f_bfree | st->f_bavail |
st->f_bsize | st->f_frsize) &
0xffffffff00000000ULL)
return -EOVERFLOW;
/*
* f_files and f_ffree may be -1; it's okay to stuff
* that into 32 bits
*/
if (st->f_files != -1 &&
(st->f_files & 0xffffffff00000000ULL))
return -EOVERFLOW;
if (st->f_ffree != -1 &&
(st->f_ffree & 0xffffffff00000000ULL))
return -EOVERFLOW;
}
buf.f_type = st->f_type;
buf.f_bsize = st->f_bsize;
buf.f_blocks = st->f_blocks;
buf.f_bfree = st->f_bfree;
buf.f_bavail = st->f_bavail;
buf.f_files = st->f_files;
buf.f_ffree = st->f_ffree;
buf.f_fsid = st->f_fsid;
buf.f_namelen = st->f_namelen;
buf.f_frsize = st->f_frsize;
buf.f_flags = st->f_flags;
memset(buf.f_spare, 0, sizeof(buf.f_spare));
}
if (copy_to_user(p, &buf, sizeof(buf)))
return -EFAULT;
return 0;
}
static int do_statfs64(struct kstatfs *st, struct statfs64 __user *p)
{
struct statfs64 buf;
if (sizeof(buf) == sizeof(*st))
memcpy(&buf, st, sizeof(*st));
else {
buf.f_type = st->f_type;
buf.f_bsize = st->f_bsize;
buf.f_blocks = st->f_blocks;
buf.f_bfree = st->f_bfree;
buf.f_bavail = st->f_bavail;
buf.f_files = st->f_files;
buf.f_ffree = st->f_ffree;
buf.f_fsid = st->f_fsid;
buf.f_namelen = st->f_namelen;
buf.f_frsize = st->f_frsize;
buf.f_flags = st->f_flags;
memset(buf.f_spare, 0, sizeof(buf.f_spare));
}
if (copy_to_user(p, &buf, sizeof(buf)))
return -EFAULT;
return 0;
}
SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf)
{
struct kstatfs st;
int error = user_statfs(pathname, &st);
if (!error)
error = do_statfs_native(&st, buf);
return error;
}
SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf)
{
struct kstatfs st;
int error;
if (sz != sizeof(*buf))
return -EINVAL;
error = user_statfs(pathname, &st);
if (!error)
error = do_statfs64(&st, buf);
return error;
}
SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf)
{
struct kstatfs st;
int error = fd_statfs(fd, &st);
if (!error)
error = do_statfs_native(&st, buf);
return error;
}
SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf)
{
struct kstatfs st;
int error;
if (sz != sizeof(*buf))
return -EINVAL;
error = fd_statfs(fd, &st);
if (!error)
error = do_statfs64(&st, buf);
return error;
}
int vfs_ustat(dev_t dev, struct kstatfs *sbuf)
{
struct super_block *s = user_get_super(dev);
int err;
if (!s)
return -EINVAL;
err = statfs_by_dentry(s->s_root, sbuf);
drop_super(s);
return err;
}
SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
{
struct ustat tmp;
struct kstatfs sbuf;
int err = vfs_ustat(new_decode_dev(dev), &sbuf);
if (err)
return err;
memset(&tmp,0,sizeof(struct ustat));
tmp.f_tfree = sbuf.f_bfree;
tmp.f_tinode = sbuf.f_ffree;
return copy_to_user(ubuf, &tmp, sizeof(struct ustat)) ? -EFAULT : 0;
}
|
#include <stdio.h>
int main()
{
int n, count;
long unsigned int factorial;
factorial = 1;
n = 10;
for (count=1; count<=n; count++)
{
factorial*=count;
}
printf("Factorial of %d = %lu\n",n, factorial);
return 0;
}
|
#ifndef _SCSI_DISK_H
#define _SCSI_DISK_H
/*
* More than enough for everybody ;) The huge number of majors
* is a leftover from 16bit dev_t days, we don't really need that
* much numberspace.
*/
#define SD_MAJORS 16
/*
* This is limited by the naming scheme enforced in sd_probe,
* add another character to it if you really need more disks.
*/
#define SD_MAX_DISKS (((26 * 26) + 26 + 1) * 26)
/*
* Time out in seconds for disks and Magneto-opticals (which are slower).
*/
#define SD_TIMEOUT (30 * HZ)
#define SD_MOD_TIMEOUT (75 * HZ)
/*
* Number of allowed retries
*/
#define SD_MAX_RETRIES 5
#define SD_PASSTHROUGH_RETRIES 1
/*
* Size of the initial data buffer for mode and read capacity data
*/
#define SD_BUF_SIZE 512
/*
* Number of sectors at the end of the device to avoid multi-sector
* accesses to in the case of last_sector_bug
*/
#define SD_LAST_BUGGY_SECTORS 8
enum {
SD_EXT_CDB_SIZE = 32, /* Extended CDB size */
SD_MEMPOOL_SIZE = 2, /* CDB pool size */
};
struct scsi_disk {
struct scsi_driver *driver; /* always &sd_template */
struct scsi_device *device;
struct device dev;
struct gendisk *disk;
atomic_t openers;
sector_t capacity; /* size in 512-byte sectors */
u32 index;
unsigned short hw_sector_size;
u8 media_present;
u8 write_prot;
u8 protection_type;/* Data Integrity Field */
unsigned previous_state : 1;
/* RCD=0,WCE=1,ATO=0,DPOFUA=0 */
unsigned ATO : 1; /* state of disk ATO bit */ /* DIF application */
unsigned WCE : 1; /* state of disk WCE bit */ /* write cache enable */
unsigned RCD : 1; /* state of disk RCD bit, unused */ /* read cache enable */
unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ /* ÓëÊý¾ÝÍêÕûÐÔ±£»¤ÓÐ¹Ø */
unsigned first_scan : 1;
unsigned thin_provisioning : 1;
unsigned unmap : 1;
};
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
{
return container_of(disk->private_data, struct scsi_disk, driver);
}
#define sd_printk(prefix, sdsk, fmt, a...) \
(sdsk)->disk ? \
sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
(sdsk)->disk->disk_name, ##a) : \
sdev_printk(prefix, (sdsk)->device, fmt, ##a)
/*
* A DIF-capable target device can be formatted with different
* protection schemes. Currently 0 through 3 are defined:
*
* Type 0 is regular (unprotected) I/O
*
* Type 1 defines the contents of the guard and reference tags
*
* Type 2 defines the contents of the guard and reference tags and
* uses 32-byte commands to seed the latter
*
* Type 3 defines the contents of the guard tag only
*/
enum sd_dif_target_protection_types {
SD_DIF_TYPE0_PROTECTION = 0x0,
SD_DIF_TYPE1_PROTECTION = 0x1,
SD_DIF_TYPE2_PROTECTION = 0x2,
SD_DIF_TYPE3_PROTECTION = 0x3,
};
/*
* Data Integrity Field tuple.
*/
struct sd_dif_tuple {
__be16 guard_tag; /* Checksum */
__be16 app_tag; /* Opaque storage */
__be32 ref_tag; /* Target LBA or indirect LBA */
};
#ifdef CONFIG_BLK_DEV_INTEGRITY
extern void sd_dif_config_host(struct scsi_disk *);
extern int sd_dif_prepare(struct request *rq, sector_t, unsigned int);
extern void sd_dif_complete(struct scsi_cmnd *, unsigned int);
#else /* CONFIG_BLK_DEV_INTEGRITY */
static inline void sd_dif_config_host(struct scsi_disk *disk)
{
}
static inline int sd_dif_prepare(struct request *rq, sector_t s, unsigned int a)
{
return 0;
}
static inline void sd_dif_complete(struct scsi_cmnd *cmd, unsigned int a)
{
}
#endif /* CONFIG_BLK_DEV_INTEGRITY */
#endif /* _SCSI_DISK_H */
|
/*
* DBMS Implementation
* Copyright (C) 2013 George Piskas, George Economides
*
* 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.
*
* Contact: geopiskas@gmail.com
*/
/*
* ==========================================================================================
* Database Technology 2012-2013
* Header file dbtproj.h to be used by your code.
* It is not permitted to change this file. You can make changes to perform tests,
* but please rely on the values and typedefs shown below.
*
* ==========================================================================================
*
*/
#ifndef _DBTPROJ_H
#define _DBTPROJ_H
#define STR_LENGTH 120
#define MAX_RECORDS_PER_BLOCK 100
// This is the definition of a record. Contains three fields, recid, num and str
typedef struct {
unsigned int recid;
unsigned int num;
char str[STR_LENGTH];
bool valid; // if set, then this record is valid
} record_t;
// This is the definition of a block, which contains a number of fixed-sized records
typedef struct {
unsigned int blockid;
unsigned int nreserved; // how many reserved entries
record_t entries[MAX_RECORDS_PER_BLOCK]; // array of records
bool valid; // if set, then this block is valid
unsigned char misc;
unsigned int next_blockid;
unsigned int dummy;
} block_t;
// Functions that must be implemented in your code
/* ----------------------------------------------------------------------------------------------------------------------
infile: the name of the input file
field: which field will be used for sorting: 0 is for recid, 1 is for num, 2 is for str and 3 is for both num and str
buffer: pointer to memory buffer
nmem_blocks: number of blocks in memory
outfile: the name of the output file
nsorted_segs: number of sorted segments produced (this should be set by you)
npasses: number of passes required for sorting (this should be set by you)
nios: number of IOs performed (this should be set by you)
----------------------------------------------------------------------------------------------------------------------
*/
void MergeSort(char *infile, unsigned char field, block_t *buffer, unsigned int nmem_blocks, char *outfile, unsigned int *nsorted_segs, unsigned int *npasses, unsigned int *nios);
/* ----------------------------------------------------------------------------------------------------------------------
infile: the name of the input file
field: which field will be used for sorting: 0 is for recid, 1 is for num, 2 is for str and 3 is for both num and str
buffer: pointer to memory buffer
nmem_blocks: number of blocks in memory
outfile: the name of the output file
nunique: number of unique records in file (this should be set by you)
nios: number of IOs performed (this should be set by you)
----------------------------------------------------------------------------------------------------------------------
*/
void EliminateDuplicates(char *infile, unsigned char field, block_t *buffer, unsigned int nmem_blocks, char *outfile, unsigned int *nunique, unsigned int *nios);
/* ----------------------------------------------------------------------------------------------------------------------
infile1: the name of the first input file
infile2: the name of the second input file
field: which field will be used for the join: 0 is for recid, 1 is for num, 2 is for str and 3 is for both num and str
buffer: pointer to memory buffer
nmem_blocks: number of blocks in memory
outfile: the name of the output file
nres: number of pairs in output (this should be set by you)
nios: number of IOs performed (this should be set by you)
----------------------------------------------------------------------------------------------------------------------
*/
void MergeJoin(char *infile1, char *infile2, unsigned char field, block_t *buffer, unsigned int nmem_blocks, char *outfile, unsigned int *nres, unsigned int *nios);
/* ----------------------------------------------------------------------------------------------------------------------
infile1: the name of the first input file
infile2: the name of the second input file
field: which field will be used for the join: 0 is for recid, 1 is for num, 2 is for str and 3 is for both num and str
buffer: pointer to memory buffer
nmem_blocks: number of blocks in memory
outfile: the name of the output file
nres: number of pairs in output (this should be set by you)
nios: number of IOs performed (this should be set by you)
----------------------------------------------------------------------------------------------------------------------
*/
void HashJoin(char *infile1, char *infile2, unsigned char field, block_t *buffer, unsigned int nmem_blocks, char *outfile, unsigned int *nres, unsigned int *nios);
#endif
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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.
*
*/
namespace Sherlock {
static const SherlockGameDescription gameDescriptions[] = {
{
// Case of the Serrated Scalpel - English 3.5" Floppy
// The HitSquad CD version has the same MD5
{
"scalpel",
0,
AD_ENTRY1s("talk.lib", "ad0c4d6865edf15da4e9204c08815875", 238928),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE,
GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - German CD (from multilingual CD)
// Provided by m_kiewitz
{
"scalpel",
0, {
{"talk.lib", 0, "40a5f9f37c0e0d2ad48d8f44d8e393c9", 284278},
{"music.lib", 0, "68ae2f7684ecf903bd60a00bb6bae195", 366465},
AD_LISTEND},
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE,
GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - German
// Provided by mgerhardy
{
"scalpel",
0, {
{"talk.lib", 0, "44652e54172e13b1b075b1ef7d89de24", 284043},
{"music.lib", 0, "68ae2f7684ecf903bd60a00bb6bae195", 366465},
AD_LISTEND},
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE,
GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - German
// Provided by max565
{
"scalpel",
0, {
{"talk.lib", 0, "3d813fd8505b391a1f8b3a16b1aa7f2e", 284195},
{"music.lib", 0, "68ae2f7684ecf903bd60a00bb6bae195", 366465},
AD_LISTEND },
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE,
GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - Spanish CD (from multilingual CD)
// Provided by m_kiewitz
{
"scalpel",
0, {
{"talk.lib", 0, "27697804b637a7f3b77234bf16f15dce", 171419},
{"music.lib", 0, "68ae2f7684ecf903bd60a00bb6bae195", 366465},
AD_LISTEND},
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE,
GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - English 3DO
{
"scalpel",
0,
AD_ENTRY1s("talk.lib", "20f74a29f2db6475e85b029ac9fc03bc", 240610),
Common::EN_ANY,
Common::kPlatform3DO,
ADGF_UNSTABLE,
GUIO4(GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE,GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - Interactive English Demo
// Provided by Strangerke
{
"scalpel",
"Interactive Demo",
AD_ENTRY1s("talk.lib", "dbdc8a20c96900aa7e4d02f3fe8a274c", 121102),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_TESTING | ADGF_DEMO,
GUIO1(GUIO_NOSPEECH)
},
GType_SerratedScalpel,
},
{
// Case of the Serrated Scalpel - Non-Interactive English Demo
// Provided by Strangerke
{
"scalpel",
"Non Interactive Demo",
AD_ENTRY1s("music.lib", "ec19a09b7fef6fd90b1ab812ce6e9739", 38563),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_TESTING | ADGF_DEMO,
GUIO1(GUIO_NOSPEECH)
},
GType_SerratedScalpel,
},
{
// Case of the Rose Tattoo - French CD
// Provided by Strangerke
{
"rosetattoo",
"CD",
AD_ENTRY1s("talk.lib", "22e8e6406dd2fbbb238c9898928df42e", 770756),
Common::FR_FRA,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO3(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TRANSPARENT_WINDOWS)
},
GType_RoseTattoo
},
{
// Case of the Rose Tattoo - English CD
// Provided by dreammaster
{
"rosetattoo",
"CD",
AD_ENTRY1s("talk.lib", "9639a756b0993ebd71cb5f4d8b78b2dc", 765134),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO3(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TRANSPARENT_WINDOWS)
},
GType_RoseTattoo,
},
{
// Case of the Rose Tattoo - German CD
// Provided by m_kiewitz
{
"rosetattoo",
"CD",
AD_ENTRY1s("talk.lib", "5027aa72f0d263ed3b1c764a6c397911", 873864),
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO3(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TRANSPARENT_WINDOWS)
},
GType_RoseTattoo,
},
{
// Case of the Rose Tattoo - Spanish CD
// Provided by dianiu
{
"rosetattoo",
"CD",
AD_ENTRY1s("talk.lib", "4f3ccf50e1012445624569cd605d7449", 783713),
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_TESTING,
GUIO3(GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_HELP_STYLE, GAMEOPTION_TRANSPARENT_WINDOWS)
},
GType_RoseTattoo,
},
{ AD_TABLE_END_MARKER, (GameType)0 }
};
} // End of namespace Sherlock
|
#ifndef ASMARM_PCI_H
#define ASMARM_PCI_H
#ifdef __KERNEL__
#include <asm-generic/pci-dma-compat.h>
#include <asm/mach/pci.h> /* for pci_sys_data */
#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
#ifdef CONFIG_PCI_DOMAINS
static inline int pci_domain_nr(struct pci_bus *bus)
{
struct pci_sys_data *root = bus->sysdata;
return root->domain;
}
static inline int pci_proc_domain(struct pci_bus *bus)
{
return pci_domain_nr(bus);
}
#endif /* CONFIG_PCI_DOMAINS */
#ifdef CONFIG_PCI_HOST_ITE8152
/* ITE bridge requires setting latency timer to avoid early bus access
termination by PIC bus mater devices
*/
extern void pcibios_set_master(struct pci_dev *dev);
#else
static inline void pcibios_set_master(struct pci_dev *dev)
{
/* No special bus mastering setup handling */
}
#endif
static inline void pcibios_penalize_isa_irq(int irq, int active)
{
/* We don't do dynamic PCI IRQ allocation */
}
/*
* The PCI address space does equal the physical memory address space.
* The networking and block device layers use this boolean for bounce
* buffer decisions.
*/
#define PCI_DMA_BUS_IS_PHYS (1)
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
unsigned long *strategy_parameter)
{
*strat = PCI_DMA_BURST_INFINITY;
*strategy_parameter = ~0UL;
}
#endif
#define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine);
extern void
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res);
extern void
pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
struct pci_bus_region *region);
/*
* Dummy implementation; always return 0.
*/
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
{
return 0;
}
#endif /* __KERNEL__ */
#endif
|
#include "hooks-internal.h"
int _rename (const char *old, const char *new)
{
filesystem_hook_t *old_hook = get_filesystem_hook(old);
filesystem_hook_t *new_hook = get_filesystem_hook(new);
if (old_hook && new_hook) {
if (old_hook == new_hook) {
if (old_hook->rename) {
return old_hook->rename(old, new);
}
else {
errno = ENOSYS;
}
}
else {
errno = EXDEV;
}
}
else {
errno = EINVAL;
}
return -1;
}
|
#ifndef UTIL_PLAT_H
#define UTIL_PLAT_H
#if defined(_WIN32) || defined(WIN32)
# ifdef _MSC_VER
# if defined(_M_64) || defined(_WIN64)
# define MSVC64
# else
# define MSVC32
# endif
# else
# if defined(__MINGW64__)
# define MINGW64
# else
# if defined(__MINGW32__)
# define MINGW32
# endif
# endif
# endif
#endif
#ifdef __GNUC__
//# define FALLTHRU [[fallthrough]] // c++17
//# define FALLTHRU [[gnu:fallthrough]] // c++14
# define FALLTHRU __attribute__((fallthrough)); // C and C++03
#else
# define FALLTHRU
#endif
#endif
|
//Person.c
person* new_Person(const char* const pFirstName, const char* const pLastName)
{
Person* pObj = NULL;
//allocating memory
pObj = (Person*)malloc(sizeof(Person));
if (pObj == NULL)
{
return NULL;
}
pObj->pFirstName = malloc(sizeof(char)*(strlen(pFirstName)+1));
if (pObj->pFirstName == NULL)
{
return NULL;
}
strcpy(pObj->pFirstName, pFirstName);
pObj->pLastName = malloc(sizeof(char)*(strlen(pLastName)+1));
if (pObj->pLastName == NULL)
{
return NULL;
}
strcpy(pObj->pLastName, pLastName);
//Initializing interface for access to functions
pObj->Delete = delete_Person;
pObj->Display = Person_DisplayInfo;
pObj->WriteToFile = Person_WriteToFile;
return pObj;
}
|
/*
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.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 version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _ST_FILESYSTEM_COMMON_H_
#define _ST_FILESYSTEM_COMMON_H_
/*Generic header files */
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <fcntl.h>
/*Testcode related Header files*/
#include <st_defines.h>
#include <st_log.h>
/*Structure for holding the test options */
struct st_filesystem_testparams {
/* i/o direction read/write */
char iomode;
/* Name of the file to read from or write to */
char *filename;
/* Buffer size */
int buffer_size;
/* File size */
float file_size;
/* srcFile size */
float srcfile_size;
/* Test name */
char *test_name;
/* throughput enable flag */
int throughput_flag;
/* cpuload enable flag */
int cpuload_flag;
/* Path of the file to read for copy */
char *src;
/* Path of the file write to for copy*/
char *dst;
/* duration */
int duration;
};
void st_perror(const char *s);
Int32 st_read(IN Int32 fd, IN void *buf, IN Int32 count);
Int32 st_write(IN Int32 fd, IN const void *buf, IN Int32 count);
Int32 st_open(IN const Int8 * pathname, IN Int32 oflag);
Int32 st_close(IN Int32 fd);
void st_init_filesystem_test_params();
void st_display_filesystem_test_suite_help(void);
void st_print_filesystem_test_params(struct st_filesystem_testparams
*testoptions, char *test_id);
int st_filesystem_performance_read_test(struct st_filesystem_testparams *info,
char *test_id);
int st_filesystem_performance_write_test(struct st_filesystem_testparams *info,
char *test_id);
int st_filesystem_performance_copy_test(struct st_filesystem_testparams *info,
char *test_id);
#endif /*ST_FILESYSTEM_COMMON_H_ */
|
int main(void)
{
int i=0;
int count = 1000000000;
int a[1000] = {0};
for(i=0;i<count;i++)
{
a[i%1000] = i;
}
return 0;
}
|
/*******************************************************************************
* Copyright (c) 2012-2014, The Microsystems Design Labratory (MDL)
* Department of Computer Science and Engineering, The Pennsylvania State University
* All rights reserved.
*
* This source code is part of NVMain - A cycle accurate timing, bit accurate
* energy simulator for both volatile (e.g., DRAM) and non-volatile memory
* (e.g., PCRAM). The source code is free and you can redistribute and/or
* modify it by providing 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 HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author list:
* Matt Poremba ( Email: mrp5060 at psu dot edu
* Website: http://www.cse.psu.edu/~poremba/ )
*******************************************************************************/
#ifndef __FRFCFS_H__
#define __FRFCFS_H__
#include "src/MemoryController.h"
#include <deque>
namespace NVM {
class FRFCFS : public MemoryController
{
public:
FRFCFS( );
~FRFCFS( );
bool IssueCommand( NVMainRequest *req );
bool IsIssuable( NVMainRequest *request, FailReason *fail = NULL );
bool RequestComplete( NVMainRequest * request );
void SetConfig( Config *conf, bool createChildren = true );
void Cycle( ncycle_t steps );
void RegisterStats( );
void CalculateStats( );
private:
/*bool inline ShouldAssignCycle()
{
return ((tread_hit==-1)||( tread_miss==-1)||(twrite_hit==-1)||(twrite_miss==-1));
}
int inline GetInterval( NVMainRequest* req )
{
return (req->taccess_after - req->taccess_before);
}*/
NVMTransactionQueue *memQueue;
/* Cached Configuration Variables*/
uint64_t queueSize;
/* Stats */
uint64_t measuredLatencies, measuredQueueLatencies, measuredTotalLatencies;
double averageLatency, averageQueueLatency, averageTotalLatency;
uint64_t mem_reads, mem_writes;
uint64_t rb_hits;
uint64_t rb_miss;
double rb_hit_rate;
uint64_t starvation_precharges;
uint64_t cpu_insts;
uint64_t write_pauses;
uint64_t benefit;
};
};
#endif
|
/**
* Copyright (C) 2015 Andrew Kallmeyer <fsmv@sapium.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Lesser 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
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _PLUGINS_H_
#define _PLUGINS_H_
#include <map>
#include <string>
#include <regex>
#include <memory>
extern "C" {
#include "lua.h"
}
#include "json.hpp"
using json = nlohmann::json;
#include "config.h"
struct lua_State;
class Plugin {
public:
/**
* Loads a plugin from a lua source file
*
* @param name the name without extension of the lua source file in the
* plugins directory
* @throws invalid_argument if there is any error in loading the plugin
*/
Plugin(const std::string &name);
/**
* Conditionally call the plugin's lua run method if the message matches any
* of the plugin's commands or regular expressions
*
* @param update update to check
*/
void run(const json &update);
std::string getPath() const;
std::string getDescription() { return description; }
std::string getName() { return name; }
std::unique_ptr<Config> config;
private:
std::unique_ptr<lua_State, decltype(&lua_close)> luaState;
std::map<std::string, std::string> commands;
std::map<std::string, std::regex> matches;
std::string description;
std::string name;
bool commandOnly;
bool alwaysTrigger;
};
// State information for a single call of run
struct PluginRunState {
// The plugin being run
Plugin *plugin;
// the update message that trigger the run call
json update;
// if the run call was triggered with a regex match
bool regex;
// the string and regex that triggered the run if regex is true
std::pair<std::string, std::regex> match;
};
bool loadPlugins(std::vector<Plugin> *plugins);
void onUpdate(json message);
#endif
|
#include "sec_osal_light.h"
#include "sec_typedef.h"
#include "rsa_def.h"
#include "alg_sha1.h"
#include "bgn_export.h"
#include "sec_cust_struct.h"
#include "sec_auth.h"
#include "sec_error.h"
#include "sec_rom_info.h"
#include "sec_boot_lib.h"
#include "sec_sign_header.h"
#include "sec_key_util.h"
#include "sec_log.h"
/**************************************************************************
* MODULE NAME
**************************************************************************/
#define MOD "AUTHEN"
/**************************************************************************
* LOCAL VARIABLE
**************************************************************************/
uchar bRsaKeyInit = false;
uchar bRsaImgKeyInit = false;
/**************************************************************************
* RSA SML KEY INIT
**************************************************************************/
int lib_init_key(uchar *nKey, uint32 nKey_len, uchar *eKey, uint32 eKey_len)
{
int ret = SEC_OK;
/* ------------------------------ */
/* avoid re-init aes key
if re-init key again, key value will be decoded twice .. */
/* ------------------------------ */
if (true == bRsaKeyInit) {
return ret;
}
bRsaKeyInit = true;
if (0 != mcmp(rom_info.m_id, RI_NAME, RI_NAME_LEN)) {
SMSG(true, "[%s] error. key not found\n", MOD);
ret = ERR_RSA_KEY_NOT_FOUND;
goto _end;
}
/* ------------------------------ */
/* clean rsa variable */
/* ------------------------------ */
memset(&rsa, 0, sizeof(rsa_ctx));
/* ------------------------------ */
/* init RSA module / exponent key */
/* ------------------------------ */
rsa.len = RSA_KEY_SIZE;
/* ------------------------------ */
/* decode key */
/* ------------------------------ */
sec_decode_key(nKey, nKey_len,
rom_info.m_SEC_KEY.crypto_seed, sizeof(rom_info.m_SEC_KEY.crypto_seed));
/* ------------------------------ */
/* init mpi library */
/* ------------------------------ */
bgn_read_str(&rsa.N, 16, (char *)nKey, nKey_len);
bgn_read_str(&rsa.E, 16, (char *)eKey, eKey_len);
/* ------------------------------ */
/* debugging */
/* ------------------------------ */
dump_buf(nKey, 0x4);
_end:
return ret;
}
/**************************************************************************
* SIGNING
**************************************************************************/
int lib_sign(uchar *data_buf, uint32 data_len, uchar *sig_buf, uint32 sig_len)
{
#if 0
int i = 0;
if (RSA_KEY_LEN != sig_len) {
SMSG(true, "signature length is wrong (%d)\n", sig_len);
goto _err;
}
/* hash the plain text */
sha1(data_buf, data_len, sha1sum);
/*
2011.09.27. Add OpenSSL compatibility support
OpenSSL's command :
openssl rsautl -sign -in xxxxx -inkey xxx.pem -out signature
RSA padding type : SIG_RSA_SHA1
original implementation for W1126 and W1132 MP release
This padding rule can't be compatible with OpenSSL
The cipher results are not the same
RSA padding type : SIG_RSA_RAW
This padding rule can be compatible with OpenSSL
The cipher results are the same
*/
/* encrypt the hash value (sign) */
SMSG(true, "[%s] RSA padding : RAW\n", MOD);
if (rsa_sign(&rsa, HASH_LEN, sha1sum, sig_buf) != 0) {
SMSG(true, "failed\n");
goto _err;
}
SMSG(true, "[%s] sign image ... pass\n\n", MOD);
/* output signature */
SMSG(true, "[%s] output signature:\n", MOD);
SMSG(true, " ------------------------------------\n");
for (i = 0; i < RSA_KEY_LEN; i++) {
if (i == RSA_KEY_LEN - 1) {
if (sig_buf[i] < 0x10) {
SMSG(true, "0x0%x", sig_buf[i]);
} else {
SMSG(true, "0x%x", sig_buf[i]);
}
} else {
if (sig_buf[i] < 0x10) {
SMSG(true, "0x0%x,", sig_buf[i]);
} else {
SMSG(true, "0x%x,", sig_buf[i]);
}
}
}
SMSG(true, "\n");
/* self testing : verify this signature */
SMSG(true, "\n[%s] verify signature", MOD);
if (rsa_verify(&rsa, HASH_LEN, sha1sum, sig_buf) != 0) {
SMSG(true, "failed\n");
goto _err;
}
SMSG(true, "... pass\n");
#endif
return 0;
#if 0
_err:
return -1;
#endif
}
/**************************************************************************
* HASHING
**************************************************************************/
int lib_hash(uchar *data_buf, uint32 data_len, uchar *hash_buf, uint32 hash_len)
{
if (HASH_LEN != hash_len) {
SMSG(true, "hash length is wrong (%d)\n", hash_len);
goto _err;
}
/* hash the plain text */
sha1(data_buf, data_len, hash_buf);
return 0;
_err:
return -1;
}
/**************************************************************************
* VERIFY SIGNATURE
**************************************************************************/
int lib_verify(uchar *data_buf, uint32 data_len, uchar *sig_buf, uint32 sig_len)
{
if (RSA_KEY_LEN != sig_len) {
SMSG(true, "signature length is wrong (%d)\n", sig_len);
goto _err;
}
SMSG(true, "[%s] 0x%x,0x%x,0x%x,0x%x\n", MOD, data_buf[0], data_buf[1], data_buf[2],
data_buf[3]);
/* hash the plain text */
sha1(data_buf, data_len, sha1sum);
/* verify this signature */
SMSG(true, "[%s] verify signature", MOD);
if (rsa_verify(&rsa, HASH_LEN, sha1sum, sig_buf) != 0) {
SMSG(true, " ... failed\n");
goto _err;
}
SMSG(true, " ... pass\n");
return 0;
_err:
return -1;
}
|
#include <stdio.h>
#define MAX 100000000
main()
{
long i, sum;
sum = 0;
for (i = 0; i <= MAX; ++i)
{
sum = sum + i;
}
printf("%ld\n",sum);
}
|
/* -*- c-file-style: "java"; indent-tabs-mode: nil -*-
*
* distcc -- A simple distributed compiler system
*
* Copyright (C) 2002, 2003 by Martin Pool <mbp@samba.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-1307
* USA
*/
/* "More computing sins are committed in the name of
* efficiency (without necessarily achieving it) than
* for any other single reason - including blind
* stupidity." -- W.A. Wulf
*/
#include "config.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include "tempfile.h"
#include "exitcode.h"
#ifndef _PATH_TMP
#define _PATH_TMP "/tmp"
#endif
/**
* Create a file inside the temporary directory and register it for
* later cleanup, and return its name.
*
* The file will be reopened later, possibly in a child. But we know
* that it exists with appropriately tight permissions.
**/
int dcc_make_tmpnam(const char *prefix,
const char *suffix,
char **name_ret, int relative)
{
unsigned long random_bits;
unsigned long tries = 0;
int fd;
size_t tmpname_length;
char *tmpname;
tmpname_length = strlen(_PATH_TMP) + 1 + strlen(prefix) + 1 + 8 + strlen(suffix) + 1;
tmpname = malloc(tmpname_length);
if (!tmpname) {
return EXIT_OUT_OF_MEMORY;
}
random_bits = (unsigned long) getpid() << 16;
# if HAVE_GETTIMEOFDAY
{
struct timeval tv;
gettimeofday(&tv, NULL);
random_bits ^= tv.tv_usec << 16;
random_bits ^= tv.tv_sec;
}
# else
random_bits ^= time(NULL);
# endif
#if 0
random_bits = 0; /* FOR TESTING */
#endif
do {
if (snprintf(tmpname, tmpname_length, "%s/%s_%08lx%s",
( relative ? _PATH_TMP + 1 : _PATH_TMP ),
prefix,
random_bits & 0xffffffffUL,
suffix) == -1) {
free(tmpname);
return EXIT_OUT_OF_MEMORY;
}
/* Note that if the name already exists as a symlink, this
* open call will fail.
*
* The permissions are tight because nobody but this process
* and our children should do anything with it. */
fd = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (fd == -1) {
/* Don't try getting a file too often. Safety net against
endless loops. Probably just paranoia. */
if (++tries > 1000000) {
free(tmpname);
return EXIT_IO_ERROR;
}
/* Some errors won't change by changing the filename,
e.g. ENOENT means that the directory where we try to create
the file was removed from under us. Don't endlessly loop
in that case. */
switch (errno) {
case EACCES: case EEXIST: case EISDIR: case ELOOP:
/* try again */
random_bits += 7777; /* fairly prime */
continue;
}
free(tmpname);
return EXIT_IO_ERROR;
}
if (close(fd) == -1) { /* huh? */
free(tmpname);
return EXIT_IO_ERROR;
}
break;
} while (1);
*name_ret = tmpname;
return 0;
}
|
/*
* Copyright (C) 2001-2003 FhG Fokus
*
* This file is part of opensips, a free SIP server.
*
* opensips 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
*
* opensips 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
*
* History:
* --------
*
*/
#ifndef _PIKE_TIMER_H
#define _PIKE_TIMER_H
struct list_link {
struct list_link *next;
struct list_link *prev;
};
#define has_timer_set(_ll) \
((_ll)->prev || (_ll)->next)
#define is_list_empty(_head) \
((_head)->next == (_head))
#define update_in_timer( _head, _ll) \
do { \
remove_from_timer( _head, _ll);\
append_to_timer( _head, _ll); \
}while(0)
void append_to_timer(struct list_link *head, struct list_link *ll );
void remove_from_timer(struct list_link *head, struct list_link *ll);
void check_and_split_timer(struct list_link *head, unsigned int time,
struct list_link *split, unsigned char *mask);
#endif
|
/* wolfmath.c
*
* Copyright (C) 2006-2016 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL 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.
*
* wolfSSL 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-1335, USA
*/
/* common functions for either math library */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* in case user set USE_FAST_MATH there */
#include <wolfssl/wolfcrypt/settings.h>
#ifdef USE_FAST_MATH
#include <wolfssl/wolfcrypt/tfm.h>
#else
#include <wolfssl/wolfcrypt/integer.h>
#endif
#include <wolfssl/wolfcrypt/error-crypt.h>
#include <wolfssl/wolfcrypt/logging.h>
int get_digit_count(mp_int* a)
{
if (a == NULL)
return 0;
return a->used;
}
mp_digit get_digit(mp_int* a, int n)
{
if (a == NULL)
return 0;
return (n >= a->used || n < 0) ? 0 : a->dp[n];
}
int get_rand_digit(WC_RNG* rng, mp_digit* d)
{
return wc_RNG_GenerateBlock(rng, (byte*)d, sizeof(mp_digit));
}
int mp_rand(mp_int* a, int digits, WC_RNG* rng)
{
int ret;
mp_digit d;
if (rng == NULL)
return MISSING_RNG_E;
if (a == NULL)
return BAD_FUNC_ARG;
mp_zero(a);
if (digits <= 0) {
return MP_OKAY;
}
/* first place a random non-zero digit */
do {
ret = get_rand_digit(rng, &d);
if (ret != 0) {
return ret;
}
} while (d == 0);
if ((ret = mp_add_d(a, d, a)) != MP_OKAY) {
return ret;
}
while (--digits > 0) {
if ((ret = mp_lshd(a, 1)) != MP_OKAY) {
return ret;
}
if ((ret = get_rand_digit(rng, &d)) != 0) {
return ret;
}
if ((ret = mp_add_d(a, d, a)) != MP_OKAY) {
return ret;
}
}
return ret;
}
|
// Copyright (C) 2005 Dave Griffiths
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef N_STATE
#define N_STATE
#include "OpenGL.h"
#include <iostream>
#include "dada.h"
#include "GLSLShader.h"
#include "TexturePainter.h"
namespace Fluxus
{
#define HINT_NONE 0x00000000
#define HINT_SOLID 0x00000001
#define HINT_WIRE 0x00000002
#define HINT_NORMAL 0x00000004
#define HINT_POINTS 0x00000008
#define HINT_AALIAS 0x00000010
#define HINT_BOUND 0x00000020
#define HINT_UNLIT 0x00000040
#define HINT_VERTCOLS 0x00000080
#define HINT_ORIGIN 0x00000100
#define HINT_CAST_SHADOW 0x00000200
#define HINT_IGNORE_DEPTH 0x00000400
#define HINT_DEPTH_SORT 0x00000800
#define HINT_LAZY_PARENT 0x00001000
#define HINT_CULL_CCW 0x00002000
#define HINT_WIRE_STIPPLED 0x00004002 // this also turns on HINT_WIRE
#define HINT_SPHERE_MAP 0x00008000
#define HINT_FRUSTUM_CULL 0x00010000
#define HINT_NORMALISE 0x00020000
#define HINT_NOBLEND 0x00040000
#define HINT_NOZWRITE 0x00080000
#define MAX_TEXTURES 8
class PixelPrimitive;
///////////////////////////////////////
/// The fluxus graphics state
/// This is used to form the state stack
/// for immediate mode, and is contained
/// inside each primitive in retained mode.
class State
{
public:
State();
State(const State &other);
~State();
const State &operator=(const State &other);
void Apply();
void Unapply();
void Spew();
dColour Colour;
dColour Specular;
dColour Emissive;
dColour Ambient;
float Shinyness;
float Opacity;
unsigned int Textures[MAX_TEXTURES];
TextureState TextureStates[MAX_TEXTURES];
int Parent;
int Hints;
float LineWidth;
bool StippledLines;
int StippleFactor;
int StipplePattern;
float PointWidth;
int SourceBlend;
int DestinationBlend;
dColour WireColour;
dColour NormalColour;
float WireOpacity;
COLOUR_MODE ColourMode;
dMatrix Transform;
GLSLShader *Shader;
bool Cull;
PixelPrimitive *Target;
};
};
#endif
|
/* music player command (mpc)
* Copyright (C) 2003-2008 Warren Dukes <warren.dukes@gmail.com>,
Eric Wong <normalperson@yhbt.net>,
Daniel Brown <danb@cs.utexas.edu>
* Copyright (C) 2008-2009 Max Kellermann <max@duempel.org>
* Project homepage: http://musicpd.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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef STATUS_H
#define STATUS_H
#include "libmpdclient.h"
void print_status (mpd_Connection *conn);
#endif /* STATUS_H */
|
/*
* Copyright (C) 2015 BIO-DIKU.
*
* 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
*
* http://www.gnu.org/copyleft/gpl.html
*/
#ifndef SEQSCAN_PU_REFERENCE_UNIT_H_
#define SEQSCAN_PU_REFERENCE_UNIT_H_
#include "pattern_unit.h"
class ReferenceUnit : public PatternUnit{
public:
ReferenceUnit(
PatternUnit* pu,
const Modifiers &modifiers
);
void Initialize(
std::string::const_iterator pos,
std::string::const_iterator max_pos,
bool stay_at_pos = false
) override;
bool FindMatch() override;
const Match& GetMatch() const override;
std::ostream& Print(std::ostream &os) const override;
std::unique_ptr<PatternUnit> Clone() const override;
private:
std::string ref_match_;
std::string::const_iterator sequence_iterator_end_;
PatternUnit* referenced_unit_;
std::unique_ptr<PatternUnit> pattern_finder_;
};
#endif // SEQSCAN_PU_REFERENCE_UNIT_H_
|
typedef int SDL_dummy_uint8 [3] ;
|
/**
* $Id$
* @file decrypt.c
* @brief Authentication for yubikey OTP tokens using the yubikey library.
*
* @author Arran Cudbard-Bell <a.cudbardb@networkradius.com>
* @copyright 2013 The FreeRADIUS server project
* @copyright 2013 Network RADIUS <info@networkradius.com>
*/
#include "rlm_yubikey.h"
#ifdef HAVE_YUBIKEY
/** Decrypt a Yubikey OTP AES block
*
* @param inst Module configuration.
* @param request The current request.
* @param passcode string to decrypt.
* @return one of the RLM_RCODE_* constants.
*/
rlm_rcode_t rlm_yubikey_decrypt(rlm_yubikey_t *inst, REQUEST *request, char const *passcode)
{
uint32_t counter, timestamp;
yubikey_token_st token;
fr_dict_attr_t const *da;
char private_id[(YUBIKEY_UID_SIZE * 2) + 1];
VALUE_PAIR *key, *vp;
da = fr_dict_attr_by_name(NULL, "Yubikey-Key");
if (!da) {
REDEBUG("Dictionary missing entry for 'Yubikey-Key'");
return RLM_MODULE_FAIL;
}
key = fr_pair_find_by_da(request->control, da, TAG_ANY);
if (!key) {
REDEBUG("Yubikey-Key attribute not found in control list, can't decrypt OTP data");
return RLM_MODULE_INVALID;
}
if (key->vp_length != YUBIKEY_KEY_SIZE) {
REDEBUG("Yubikey-Key length incorrect, expected %u got %zu", YUBIKEY_KEY_SIZE, key->vp_length);
return RLM_MODULE_INVALID;
}
yubikey_parse((uint8_t const *) passcode + inst->id_len, key->vp_octets, &token);
/*
* Apparently this just uses byte offsets...
*/
if (!yubikey_crc_ok_p((uint8_t *) &token)) {
REDEBUG("Decrypting OTP token data failed, rejecting");
return RLM_MODULE_REJECT;
}
RDEBUG("Token data decrypted successfully");
counter = (yubikey_counter(token.ctr) << 8) | token.use;
timestamp = (token.tstph << 16) | token.tstpl;
if (RDEBUG_ENABLED2) {
(void) fr_bin2hex((char *) &private_id, (uint8_t*) &token.uid, YUBIKEY_UID_SIZE);
RDEBUG2("Private ID : 0x%s", private_id);
RDEBUG2("Session counter : %u", counter);
RDEBUG2("Token timestamp : %u", timestamp);
RDEBUG2("Random data : %u", token.rnd);
RDEBUG2("CRC data : 0x%x", token.crc);
}
/*
* Private ID used for validation purposes
*/
vp = fr_pair_make(request, &request->packet->vps, "Yubikey-Private-ID", NULL, T_OP_SET);
if (!vp) {
REDEBUG("Failed creating Yubikey-Private-ID");
return RLM_MODULE_FAIL;
}
fr_pair_value_memcpy(vp, token.uid, YUBIKEY_UID_SIZE);
/*
* Token timestamp
*/
vp = fr_pair_make(request, &request->packet->vps, "Yubikey-Timestamp", NULL, T_OP_SET);
if (!vp) {
REDEBUG("Failed creating Yubikey-Timestamp");
return RLM_MODULE_FAIL;
}
vp->vp_integer = timestamp;
vp->vp_length = 4;
/*
* Token random
*/
vp = fr_pair_make(request, &request->packet->vps, "Yubikey-Random", NULL, T_OP_SET);
if (!vp) {
REDEBUG("Failed creating Yubikey-Random");
return RLM_MODULE_FAIL;
}
vp->vp_integer = token.rnd;
vp->vp_length = 4;
/*
* Combine the two counter fields together so we can do
* replay attack checks.
*/
vp = fr_pair_make(request, &request->packet->vps, "Yubikey-Counter", NULL, T_OP_SET);
if (!vp) {
REDEBUG("Failed creating Yubikey-Counter");
return RLM_MODULE_FAIL;
}
vp->vp_integer = counter;
vp->vp_length = 4;
/*
* Now we check for replay attacks
*/
vp = fr_pair_find_by_da(request->control, da, TAG_ANY);
if (!vp) {
RWDEBUG("Yubikey-Counter not found in control list, skipping replay attack checks");
return RLM_MODULE_OK;
}
if (counter <= vp->vp_integer) {
REDEBUG("Replay attack detected! Counter value %u, is lt or eq to last known counter value %u",
counter, vp->vp_integer);
return RLM_MODULE_REJECT;
}
return RLM_MODULE_OK;
}
#endif
|
/*
* puresu3gaugesim.h - class for pure SU(3) gauge sim inherited from
* GenericSimClass - header
*
* Copyright © 2013 H.-P. Schadler <hanspeter.schadler@uni-graz.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef PURESU2GAUGESIM_H
#define PURESU2GAUGESIM_H
#include <iostream>
#include <fstream>
#include <vector>
#include "genericsimclass.h"
#include "globalsettings.h"
#include "storage.hpp"
#include "su2.h"
class PureSU2GaugeSim : public GenericSimClass {
public:
PureSU2GaugeSim(GlobalSettings &settings) : GenericSimClass(settings){
std::cout << "Pure SU(2) Simulation class version 0.0" << std::endl;
}
private:
void PrepareStorage();
void DeleteStorage();
void InitIndividual();
void CleanupIndividual();
void Update(const int nskip);
void StapleSum(Su2Matrix &S, int mu,int x);
void OverOffer(Su2Matrix &Unew, Su2Matrix &Uold, Su2Matrix &stot);
void MetroOffer(Su2Matrix &Unew, Su2Matrix &Uold);
void Measurement();
std::complex<double> CalcPoll();
std::complex<double> CalcPlaq();
int WriteConfig(const int &m);
void WriteMeas(const int &m);
void Mixed();
std::vector<std::vector<Su2Matrix*> > lattice_;
// Filehandler for measurement
std::string filemeasname_;
std::string fileconfnamebase_;
std::ofstream filemeas_;
};
#endif // PURESU2GAUGESIM_H
|
/* Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_letd2 (_Decimal128 x, _Decimal128 y) {
CMPtype res;
union decimal128 ux, uy;
ux.d = x;
uy.d = y;
res = __bid128_quiet_less_equal (ux.i, uy.i);
if (res != 0)
res = -1;
else
res = 1;
return (res);
}
|
#ifndef _ROS_geometry_msgs_PoseWithCovariance_h
#define _ROS_geometry_msgs_PoseWithCovariance_h
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "geometry_msgs/Pose.h"
namespace geometry_msgs
{
class PoseWithCovariance : public ros::Msg
{
public:
geometry_msgs::Pose pose;
float covariance[36];
virtual int serialize(unsigned char *outbuffer) const
{
int offset = 0;
offset += this->pose.serialize(outbuffer + offset);
for( uint8_t i = 0; i < 36; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->covariance[i]);
}
return offset;
}
virtual int deserialize(unsigned char *inbuffer)
{
int offset = 0;
offset += this->pose.deserialize(inbuffer + offset);
for( uint8_t i = 0; i < 36; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->covariance[i]));
}
return offset;
}
const char * getType(){ return "geometry_msgs/PoseWithCovariance"; };
const char * getMD5(){ return "c23e848cf1b7533a8d7c259073a97e6f"; };
};
}
#endif
|
/* ManPage_enums.h
*
* Copyright (C) 1996-2009,2015 Paul Boersma
*
* This code 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 code 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 work. If not, see <http://www.gnu.org/licenses/>.
*/
enums_begin (kManPage_type, 1)
enums_add (kManPage_type, 1, INTRO, U"intro")
enums_add (kManPage_type, 2, ENTRY, U"entry")
enums_add (kManPage_type, 3, NORMAL, U"normal")
enums_add (kManPage_type, 4, LIST_ITEM, U"list_item")
enums_add (kManPage_type, 5, TAG, U"tag")
enums_add (kManPage_type, 6, DEFINITION, U"definition")
enums_add (kManPage_type, 7, CODE, U"code")
enums_add (kManPage_type, 8, PROTOTYPE, U"prototype")
enums_add (kManPage_type, 9, FORMULA, U"formula")
enums_add (kManPage_type, 10, PICTURE, U"picture")
enums_add (kManPage_type, 11, SCRIPT, U"script")
enums_add (kManPage_type, 12, LIST_ITEM1, U"list_item1")
enums_add (kManPage_type, 13, LIST_ITEM2, U"list_item2")
enums_add (kManPage_type, 14, LIST_ITEM3, U"list_item3")
enums_add (kManPage_type, 15, TAG1, U"tag1")
enums_add (kManPage_type, 16, TAG2, U"tag2")
enums_add (kManPage_type, 17, TAG3, U"tag3")
enums_add (kManPage_type, 18, DEFINITION1, U"definition1")
enums_add (kManPage_type, 19, DEFINITION2, U"definition2")
enums_add (kManPage_type, 20, DEFINITION3, U"definition3")
enums_add (kManPage_type, 21, CODE1, U"code1")
enums_add (kManPage_type, 22, CODE2, U"code2")
enums_add (kManPage_type, 23, CODE3, U"code3")
enums_add (kManPage_type, 24, CODE4, U"code4")
enums_add (kManPage_type, 25, CODE5, U"code5")
enums_add (kManPage_type, 26, PAGE_TITLE, U"page_title")
enums_end (kManPage_type, 26, NORMAL)
/* End of file ManPage_enums.h */
|
/**
* D-LAN - A decentralized LAN file sharing software.
* Copyright (C) 2010-2012 Greg Burri <greg.burri@gmail.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 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/>.
*/
struct Log { static QSharedPointer<LM::ILogger> logger; };
#define L_USER(mess) LOG_USER(Log::logger, mess)
#define L_DEBU(mess) LOG_DEBU(Log::logger, mess)
#define L_WARN(mess) LOG_WARN(Log::logger, mess)
#define L_ERRO(mess) LOG_ERRO(Log::logger, mess)
#define L_FATA(mess) LOG_FATA(Log::logger, mess)
|
/*
* Copyright (c) 2013, Fraunhofer FKIE
*
* Authors: Bastian Gaspers
*
* 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 Fraunhofer FKIE nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* This file is part of the StructureColoring ROS package.
*
* The StructureColoring ROS package is free software:
* you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The StructureColoring ROS package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with The StructureColoring ROS package.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NODEGRIDCELL_H_
#define NODEGRIDCELL_H_
#include "GridCell.h"
class NodeGridCell : public GridCell{
public:
NodeGridCell() : GridCell(), mPopulated(false) {}
void populate(unsigned int index) { mIndices.push_back(index); mPopulated = true; }
void clearIndices() {mIndices.clear();}
void blindPopulate() { mPopulated = true; }
bool populated() const { return mPopulated; }
void unpopulate() { mPopulated = false; }
private:
bool mPopulated;
};
#endif /* NODEGRIDCELL_H_ */
|
// Copyright (c) 2016 - 2017 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots 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.
//
// Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "gameTypes/Direction.h"
#include "gameTypes/MapCoordinates.h"
#include "gameData/DescIdx.h"
class GameWorldGame;
struct TerrainDesc;
/// Creates an empty world, with meadow terrain and the given number of players
struct CreateEmptyWorld
{
explicit CreateEmptyWorld(const MapExtent& size);
bool operator()(GameWorldGame& world) const;
private:
MapExtent size_;
};
void setRightTerrain(GameWorldGame& world, const MapPoint& pt, Direction dir, DescIdx<TerrainDesc> t);
void setLeftTerrain(GameWorldGame& world, const MapPoint& pt, Direction dir, DescIdx<TerrainDesc> t);
|
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/Form.h>
#include <Xm/LabelG.h>
#include <Xm/PushBG.h>
#include <Xm/Scale.h>
#include <Xm/TextF.h>
#include <Xm/RowColumn.h>
#include <Xm/ToggleBG.h>
#include <Xm/ScrolledW.h>
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
//#include <malloc.h>
#include "gmvdata.h"
#include "formwidgets.h"
#include "xstuff.h"
static Widget ffieldlist;
static int curr_fform;
static short ffieldsensitive[MAXFIELDS];
void ffieldformpop(int iform, int ifld)
{
curr_fform = iform;
XmListSelectPos(ffieldlist,ifld+1,FALSE);
MyManageChild(ffieldform);
}
void closeffield(w,client_data,call_data)
Widget w;
XtPointer client_data, call_data;
{
XtUnmanageChild(ffieldform);
}
void ffield_select(w,client_data,call_data)
Widget w;
XtPointer client_data;
XmListCallbackStruct *call_data;
{
int ifld;
ifld = call_data->item_position - 1;
if (ffieldsensitive[ifld] == 0) return;
XtUnmanageChild(ffieldform);
/* Send selected field no. back to */
/* initiating widget for processing. */
switch(curr_fform)
{
case(FFLDVECTBLD): /* cell fvectbldform */
fvectbldgetffield(ifld);
break;
case(FFLDFLDLIM): /* cell fieldlimform */
ffieldlimgetffield(ifld);
break;
case(FFLDCFFIELD): /* cell form */
cellformgetffield(ifld);
break;
case(FFLDGAFFIELD): /* grid analysis form */
/* gridformgetffield(ifld); */
break;
#ifdef PHYSED
case(FFLDPEFIELD): /* PhysEd face field select */
/* PEgetffield(ifld); */
break;
case(FFLDPEFIELDCP): /* PhysEd face field copy */
/* PEgetffieldcp(ifld); */
break;
#endif
}
}
void makeffieldform(parent)
Widget parent;
{
Widget ffldclose;
int i;
Arg wargs[MAXFIELDS+20];
XmString string;
XmString ffielditem[MAXFIELDS];
string = XmStringCreate("Select Face Field",
XmSTRING_DEFAULT_CHARSET);
i=0; XtSetArg(wargs[i], XmNdialogTitle,string);
i++; XtSetArg(wargs[i], XmNx, 500);
i++; XtSetArg(wargs[i], XmNy, 10);
i++; XtSetArg(wargs[i], XmNautoUnmanage, FALSE);
i++;
ffieldform = XmCreateFormDialog(parent,"Ffieldform",wargs,i);
XmStringFree(string);
string = XmStringCreate("Close",XmSTRING_DEFAULT_CHARSET);
ffldclose = XtVaCreateManagedWidget("Ffldclose",
xmPushButtonGadgetClass,
ffieldform,
XmNtopAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNrightAttachment, XmATTACH_NONE,
XmNbottomAttachment, XmATTACH_NONE,
XmNlabelString, string,
NULL);
XmStringFree(string);
XtAddCallback(ffldclose,XmNactivateCallback,closeffield,
NULL);
for (i = 0; i < fnumvars; i++)
ffielditem[i] = XmStringLtoRCreate(ffieldname[i],
XmSTRING_DEFAULT_CHARSET);
i=0; XtSetArg(wargs[i],XmNtopAttachment, XmATTACH_WIDGET);
i++; XtSetArg(wargs[i],XmNtopWidget, ffldclose);
i++; XtSetArg(wargs[i],XmNtopOffset, 10);
i++; XtSetArg(wargs[i],XmNleftAttachment, XmATTACH_FORM);
i++; XtSetArg(wargs[i],XmNrightAttachment, XmATTACH_NONE);
i++; XtSetArg(wargs[i],XmNbottomAttachment, XmATTACH_NONE);
i++; XtSetArg(wargs[i],XmNheight, 245);
if (fnumvars > 0)
{
i++; XtSetArg(wargs[i],XmNitemCount, fnumvars);
i++; XtSetArg(wargs[i],XmNitems, ffielditem);
}
i++; XtSetArg(wargs[i],XmNselectionPolicy, XmSINGLE_SELECT);
i++;
ffieldlist = (Widget)XmCreateScrolledList(ffieldform,"Ffieldlist",wargs,i);
XtManageChild(ffieldlist);
XtAddCallback(ffieldlist,XmNsingleSelectionCallback,ffield_select,NULL);
for (i = 0; i < fnumvars; i++)
XmStringFree(ffielditem[i]);
XmListSelectPos(ffieldlist,1,FALSE);
for (i = 0; i < fnumvars; i++)
{
ffieldsensitive[i] = 1;
/*
if (i >= ffldcalcbeg)
ffieldsensitive[i] = 0;
*/
}
}
void setffieldname(int ifld, char fldname[33])
{
XmString string;
string = XmStringCreate(fldname,XmSTRING_DEFAULT_CHARSET);
XmListReplaceItemsPos(ffieldlist,&string,1,ifld+1);
XmStringFree(string);
}
void setffldsensitive(int ifld, int onoff)
{
ffieldsensitive[ifld] = onoff;
}
void addfacefield()
{
int i;
XmString string;
i = fnumvars;
string = XmStringCreate(ffieldname[i],
XmSTRING_DEFAULT_CHARSET);
XmListAddItemUnselected(ffieldlist,string,i+1);
XmStringFree(string);
ffieldsensitive[i] = 1;
}
|
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (C) 1990, NeXT, Inc.
*
* File: next/kern_machdep.c
* Author: John Seamons
*
* Machine-specific kernel routines.
*/
#include <sys/types.h>
#include <mach/machine.h>
#include <kern/cpu_number.h>
#include <machine/exec.h>
#include <machine/machine_routines.h>
/**********************************************************************
* Routine: grade_binary()
*
* Function: Keep the API the same between PPC and X86; always say
* any CPU subtype is OK with us, but only OK CPU types
* for which we are actually capable of executing the
* binary, either directly or via an imputed interpreter.
**********************************************************************/
int
grade_binary(cpu_type_t exectype, __unused cpu_subtype_t execsubtype)
{
switch(exectype) {
case CPU_TYPE_X86: /* native */
case CPU_TYPE_POWERPC: /* via translator */
return 1;
case CPU_TYPE_X86_64: /* native 64-bit */
return (ml_is64bit() ? 2 : 0);
default: /* all other binary types */
return 0;
}
}
extern void md_prepare_for_shutdown(int, int, char *);
void
md_prepare_for_shutdown(
__unused int paniced,
__unused int howto,
__unused char * command)
{
}
|
/*
* Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if OPAL_COMMON_VERBS_USNIC_HAPPY
#include "opal/mca/common/verbs_usnic/common_verbs_usnic.h"
#endif
/* This is crummy, but <infiniband/driver.h> doesn't work on all
platforms with all compilers. Specifically, trying to include it
on RHEL4U3 with the PGI 32 bit compiler will cause problems because
certain 64 bit types are not defined. Per advice from Roland D.,
just include the one prototype that we need in this case
(ibv_get_sysfs_path()). */
#include <infiniband/verbs.h>
#ifdef HAVE_INFINIBAND_DRIVER_H
#include <infiniband/driver.h>
#else
const char *ibv_get_sysfs_path(void);
#endif
#include "common_verbs.h"
#include "opal/runtime/opal_params.h"
#include "opal/util/show_help.h"
#include "opal/util/proc.h"
/***********************************************************************/
bool opal_common_verbs_check_basics(void)
{
#if defined(__linux__)
int rc;
char *file;
struct stat s;
/* Check to see if $sysfsdir/class/infiniband/ exists */
asprintf(&file, "%s/class/infiniband", ibv_get_sysfs_path());
if (NULL == file) {
return false;
}
rc = stat(file, &s);
free(file);
if (0 != rc || !S_ISDIR(s.st_mode)) {
return false;
}
#endif
/* It exists and is a directory -- good enough */
return true;
}
int opal_common_verbs_fork_test(void)
{
int ret = OPAL_SUCCESS;
/* Make sure that ibv_fork_init() is the first ibv_* function to
be invoked in this process. */
#ifdef HAVE_IBV_FORK_INIT
if (0 != opal_common_verbs_want_fork_support) {
/* Check if fork support is requested by the user */
if (0 != ibv_fork_init()) {
/* If the opal_common_verbs_want_fork_support MCA
* parameter is >0 but the call to ibv_fork_init() failed,
* then return an error code.
*/
if (opal_common_verbs_want_fork_support > 0) {
opal_show_help("help-opal-common-verbs.txt",
"ibv_fork_init fail", true,
opal_proc_local_get()->proc_hostname, errno,
strerror(errno));
ret = OPAL_ERROR;
}
}
}
#endif
#if OPAL_COMMON_VERBS_USNIC_HAPPY
/* Now register any necessary fake libibverbs drivers. We
piggyback loading these fake drivers on the fork test because
they must be loaded before ibv_get_device_list() is invoked.
Note that this routine is in a different common component (see
comments over there for an explanation why). */
opal_common_verbs_usnic_register_fake_drivers();
#endif
return ret;
}
|
//
// DJIMediaManager.h
// DJISDK
//
// Copyright © 2015, DJI. All rights reserved.
//
#import <DJISDK/DJISDKFoundation.h>
NS_ASSUME_NONNULL_BEGIN
@class DJIMedia;
@class DJIMediaManager;
@class DJIMediaVideoPlaybackState;
/**
* This protocol provides a delegate method to receive the updated video playback
* state of the media manager.
*/
@protocol DJIMediaManagerDelegate <NSObject>
@optional
/**
* Updates the video playback state of the media manager. This update method
* will only be called when the media manager is playing a video.
*
* @param manager The media manager updates the playback state.
* @param state The playback state.
*/
-(void)manager:(DJIMediaManager *)manager didUpdateVideoPlaybackState:(DJIMediaVideoPlaybackState *)state;
@end
/*********************************************************************************/
#pragma mark - DJIMediaManager
/*********************************************************************************/
/**
* The media manager is used to interact with the file system on the SD card.
* By using the media manager, the user can get the metadata for all the
* multimedia files, and has access to each individual multimedia file.
*/
@interface DJIMediaManager : NSObject
/**
* Delegate that receives media manager's status update.
*/
@property (nonatomic, nullable, weak) id<DJIMediaManagerDelegate> delegate;
/**
* Fetch the media list from the remote album. Set the camera's work mode to
* `DJICameraModeMediaDownload` before executing this method.
*
* @param block Remote execute result. Objects in mediaList are kind of class DJIMedia.
*/
- (void)fetchMediaListWithCompletion:(void (^_Nonnull)(NSArray<DJIMedia *> *_Nullable mediaList, NSError *_Nullable error))block;
/**
* Delete media files from remote album. Set the camera's work mode to
* `DJICameraModeMediaDownload` before executing this method. Deletion is not
* supported by the media file generated by a panorama mission.
*
* @param media Media files to be deleted.
* @param block The remote execution result. 'deleteFailures' will contain
* media that failed to delete.
*/
- (void)deleteMedia:(NSArray<DJIMedia *> *_Nonnull)media withCompletion:(void (^_Nullable)(NSArray<DJIMedia *> *_Nonnull deleteFailures, NSError *_Nullable error))block;
@end
/**
* Category of `DJIMediaManager` includes methods to control the video playback.
*/
@interface DJIMediaManager (VideoPlayback)
/**
* Checks if the media manager supports video playback or not.
* Video playback is supported only by Mavic Pro.
*
* @return `YES` if the media manager supports video playback.
*/
- (BOOL)isVideoPlaybackSupported;
/**
* Start video playback through `DJIMediaManager`.
* When the media manager is playing a video, video data can be received
* from `[camera:didReceiveVideoData:length:]` of `DJICameraDelegate` and
* playback state received from `[manager:didUpdateVideoPlaybackState:]` of
* `DJIMediaManagerDelegate`.
* Video playback through `DJIMediaManager` is fixed at 720p.
*
* @param videoMedia The video to play.
* @param block The completion block to receive the command execution
* result.
*/
- (void)playVideo:(DJIMedia *)videoMedia withCompletion:(DJICompletionBlock)block;
/**
* Video playback resumes the paused video.
*
* @param block The completion block to receive the command execution result.
*/
- (void)resumeWithCompletion:(DJICompletionBlock)block;
/**
* Pause video playback.
*
* @param block The completion block to receive the command execution result.
*/
- (void)pauseWithCompletion:(DJICompletionBlock)block;
/**
* The media manager stops the playing video.
*
* @param block The completion block to receive the command execution result.
*/
- (void)stopWithCompletion:(DJICompletionBlock)block;
/**
* Video playback is skipped to the new position in seconds from the start of
* the video.
*
* @param position New position to play in seconds from start of video. Input
with precision of greater than 3 decimal places, will be
* rounded to 3.
* @param block The completion block to receive the command execution result.
*/
- (void)moveToPosition:(float)position withCompletion:(DJICompletionBlock)block;
@end
NS_ASSUME_NONNULL_END
|
/*
This file is part of tinyfpp.
tinyfpp 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.
Foobar 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 Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __CAMERASYNC_H__
#define __CAMERASYNC_H__
#include "Camera.h"
class CameraSync
{
/*
* CameraSync is a class used for synchronizing the cameras between
* clients. The code is planned to be multiplatform.
*
*/
private:
Camera& camera;
int sock;
public:
CameraSync(Camera& camera);
void sendSync(Camera camera2);
};
#endif
|
#include <assert.h>
#include "base64.h"
static const char base64_alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
size_t base64_encode_step(const unsigned char *in, size_t len, char *out,
int *state, int *save)
{
char *outptr;
const unsigned char *inptr;
if(len == 0)
return 0;
inptr = in;
outptr = out;
if (len + ((char *) save) [0] > 2) {
const unsigned char *inend = in + len - 2;
int c1, c2, c3;
int already;
already = *state;
switch (((char *) save) [0]) {
case 1:
c1 = ((unsigned char *) save) [1];
goto skip1;
case 2:
c1 = ((unsigned char *) save) [1];
c2 = ((unsigned char *) save) [2];
goto skip2;
}
/*
* yes, we jump into the loop, no i'm not going to change it,
* it's beautiful!
*/
while (inptr < inend) {
c1 = *inptr++;
skip1:
c2 = *inptr++;
skip2:
c3 = *inptr++;
*outptr++ = base64_alphabet [ c1 >> 2 ];
*outptr++ = base64_alphabet [ c2 >> 4 |
((c1&0x3) << 4) ];
*outptr++ = base64_alphabet [ ((c2 &0x0f) << 2) |
(c3 >> 6) ];
*outptr++ = base64_alphabet [ c3 & 0x3f ];
/* this is a bit ugly ... */
if ((++already) >= 19) {
*outptr++ = '\n';
already = 0;
}
}
((char *)save)[0] = 0;
len = 2 - (inptr - inend);
*state = already;
}
if(len > 0) {
char *saveout;
/* points to the slot for the next char to save */
saveout = & (((char *)save)[1]) + ((char *)save)[0];
/* len can only be 0 1 or 2 */
switch(len) {
case 2:
*saveout++ = *inptr++;
case 1:
*saveout++ = *inptr++;
}
((char *)save)[0] += len;
}
return outptr - out;
}
size_t base64_encode_close(char *out, int *state, int *save)
{
int c1, c2;
char *outptr = out;
c1 = ((unsigned char *) save) [1];
c2 = ((unsigned char *) save) [2];
switch (((char *) save) [0]) {
case 2:
outptr [2] = base64_alphabet[ ( (c2 & 0x0f) << 2 ) ];
assert(outptr [2] != 0);
goto skip;
case 1:
outptr[2] = '=';
skip:
outptr [0] = base64_alphabet [c1 >> 2];
outptr [1] = base64_alphabet [c2 >> 4 | ((c1 & 0x3) << 4)];
outptr [3] = '=';
outptr += 4;
break;
}
*outptr++ = '\n';
*save = 0;
*state = 0;
return outptr - out;
}
|
/*
* init.c
* iyell
*
* Created by Michel DEPEIGE on 10/10/07.
* Copyright (c) 2007 Michel DEPEIGE.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING); if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
*/
#define _GNU_SOURCE
#define _BSD_SOURCE
#define __BSD_VISIBLE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include "posix+bsd.h"
#include <event.h>
#include "heap.h"
#include "hooks.h"
#include "main.h"
#include "misc.h"
#include "stats.h"
#include "conf.h"
/* prototypes */
void check_id(void);
int init(struct event_base **bot);
static void init_flags();
/* functions */
void check_id()
{
if (getuid() == 0 || getgid() == 0)
fprintf(stderr, "[i] warning: running as root !\n");
}
/*
* main init
*/
int init(struct event_base **bot)
{
char **tmp = NULL;
conf_init(&g_conf);
conf_read(&g_conf, g_file);
/* check for basic stuff */
check_id();
tmp = hash_get(g_conf.global, "nick");
if (tmp == NULL || tmp[0] == NULL) {
fprintf(stderr, "[i] no nickname set in configuration, exiting\n");
return ERROR;
}
/* check for UDP configuration */
tmp = hash_get(g_conf.global, "udp_port");
if (tmp == NULL || tmp[0] == NULL) {
fprintf(stderr, "[i] no UDP port set, exiting\n");
return ERROR;
}
/* check for UDP key (RC4) */
if (hash_text_get_first(g_conf.global, "udp_key") == NULL) {
fprintf(stderr, "[i] no UDP key set, exiting\n");
return ERROR;
}
/* check for SSL mode */
if (hash_text_is_true(g_conf.global, "ssl"))
g_mode |= USE_SSL;
/* init libevents */
*bot = event_init();
if (*bot == NULL) {
fprintf(stderr, "[i] cannot init libevent, exiting\n");
return ERROR;
}
if (g_mode & VERBOSE) {
printf("[i] using libevent %s, mechanism: %s\n",
event_get_version(), event_get_method());
}
/* set handlers */
sig_set_handlers();
/* misc init */
log_init();
hooks_init(&ghook);
stats_init();
init_flags();
timeout.tv_sec = 240;
timeout.tv_usec = 42;
g_mode |= STARTING;
log_msg("[i] iyell version %s started.\n", VERSION);
return NOERROR;
}
/* set global glags */
static void init_flags()
{
/* colors in IRC */
if (! hash_text_is_false(g_conf.global, "color"))
g_mode |= COLOR;
/* drop unknow PRI silently */
if (hash_text_is_true(g_conf.global, "syslog_silent_drop"))
g_mode |= SL3164_SILENT;
/* hooks activated flag */
if (hash_text_is_true(g_conf.global, "hooks"))
g_mode |= HOOKS;
/* syslog logging flag */
if (hash_text_is_true(g_conf.global, "syslog"))
g_mode |= SYSLOG;
/* IRC throttling flag */
if (hash_text_is_true(g_conf.global, "throttling")) {
g_mode |= THROTTLING;
if (g_mode & VERBOSE)
log_msg("[i] throttling irc output\n");
}
}
|
//
// CBUIView.h
// CBIntrospector
//
// Created by Christopher Bess on 5/2/12.
// Copyright (c) 2012 C. Bess. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CBIntrospectConstants.h"
@interface CBUIView : NSObject
@property (nonatomic, copy) NSString *syncFilePath;
@property (nonatomic, assign) BOOL isDirty;
@property (nonatomic, copy) NSString *className;
@property (nonatomic, copy) NSString *memoryAddress;
@property (nonatomic, copy) NSString *viewDescription;
@property (nonatomic, assign) BOOL hidden;
@property (nonatomic, assign) float alpha;
@property (nonatomic, assign) NSRect bounds;
@property (nonatomic, assign) NSPoint center;
@property (nonatomic, assign) NSRect frame;
- (id)initWithJSON:(NSDictionary *)jsonInfo;
- (BOOL)updateWithJSON:(NSDictionary *)jsonInfo;
- (BOOL)saveJSON;
- (BOOL)saveJSONToFile:(NSString *)path;
@end
|
/*
* Copyright (C) 2013 Ron Pedde <ron@pedde.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 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/>.
*/
#include "plugin.h"
#include "debug.h"
#define MODULE_NAME "dir"
static void handler(client_t *client, char *resource);
int init(void) {
INFO("Registering module %s", MODULE_NAME);
return register_module(MODULE_NAME, handler);
}
int deinit(void) {
INFO("Deregistering module %s", MODULE_NAME);
return TRUE;
}
static void handler(client_t *client, char *resource) {
DEBUG("Handling resource %s with module %s", resource, MODULE_NAME);
handle_error(client, TYPE_DIR, "Not implemented");
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.