text stringlengths 4 6.14k |
|---|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68a.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml
Template File: sources-sink-68a.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: cpy
* BadSink : Copy string to data using strcpy
* Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
char * CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_badData;
char * CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_goodG2BData;
#ifndef OMITBAD
/* bad function declaration */
void CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68b_badSink();
void CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_bad()
{
char * data;
char dataBadBuffer[50];
char dataGoodBuffer[100];
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = '\0'; /* null terminate */
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_badData = data;
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68b_badSink();
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declarations */
void CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68b_goodG2BSink();
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char dataBadBuffer[50];
char dataGoodBuffer[100];
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = '\0'; /* null terminate */
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_goodG2BData = data;
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68b_goodG2BSink();
}
void CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_68_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_H_
#define UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_H_
#include <memory>
#include <vector>
#include "base/containers/lru_cache.h"
#include "base/threading/thread_checker.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/public/overlay_candidates_ozone.h"
#include "ui/ozone/public/overlay_manager_ozone.h"
namespace ui {
class OverlaySurfaceCandidate;
// Ozone DRM extension of the OverlayManagerOzone interface. It queries the
// DrmDevice to see if an overlay configuration will work and keeps an MRU cache
// of recent configurations.
class DrmOverlayManager : public OverlayManagerOzone {
public:
explicit DrmOverlayManager(
bool allow_sync_and_real_buffer_page_flip_testing = true);
DrmOverlayManager(const DrmOverlayManager&) = delete;
DrmOverlayManager& operator=(const DrmOverlayManager&) = delete;
~DrmOverlayManager() override;
// OverlayManagerOzone:
std::unique_ptr<OverlayCandidatesOzone> CreateOverlayCandidates(
gfx::AcceleratedWidget w) override;
// Resets the cache of OverlaySurfaceCandidates and if they can be displayed
// as an overlay. For use when display configuration changes.
void ResetCache();
// Checks if overlay candidates can be displayed as overlays. Modifies
// |candidates| to indicate if they can.
void CheckOverlaySupport(std::vector<OverlaySurfaceCandidate>* candidates,
gfx::AcceleratedWidget widget);
protected:
// Sends a request to see if overlay configuration will work. Implementations
// should call UpdateCacheForOverlayCandidates() with the response.
virtual void SendOverlayValidationRequest(
const std::vector<OverlaySurfaceCandidate>& candidates,
gfx::AcceleratedWidget widget) = 0;
// Similar to SendOverlayValidationRequest() but instead of calling
// UpdateCacheForOverlayCandidates(), returns the result synchronously.
virtual std::vector<OverlayStatus> SendOverlayValidationRequestSync(
const std::vector<OverlaySurfaceCandidate>& candidates,
gfx::AcceleratedWidget widget) = 0;
// Perform basic validation to see if |candidate| is a valid request.
bool CanHandleCandidate(const OverlaySurfaceCandidate& candidate,
gfx::AcceleratedWidget widget) const;
// Updates the MRU cache for overlay configuration |candidates| with |status|.
void UpdateCacheForOverlayCandidates(
const std::vector<OverlaySurfaceCandidate>& candidates,
const gfx::AcceleratedWidget widget,
const std::vector<OverlayStatus>& status);
private:
// Value for the request cache, that keeps track of how many times a
// specific validation has been requested, if there is a GPU validation
// in flight, and at last the result of the validation.
struct OverlayValidationCacheValue {
OverlayValidationCacheValue();
OverlayValidationCacheValue(OverlayValidationCacheValue&& other);
~OverlayValidationCacheValue();
OverlayValidationCacheValue& operator=(OverlayValidationCacheValue&& other);
int request_num = 0;
std::vector<OverlayStatus> status;
};
using OverlayCandidatesListCache =
base::LRUCache<std::vector<OverlaySurfaceCandidate>,
OverlayValidationCacheValue>;
// Map of each widget to the cache of list of all OverlaySurfaceCandidate
// instances which have been requested for validation and/or validated.
std::map<gfx::AcceleratedWidget, OverlayCandidatesListCache>
widget_cache_map_;
THREAD_CHECKER(thread_checker_);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_H_
|
/*
* Copyright 2020 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
#include <common/tbbr/tbbr_img_def.h>
#include <lib/utils_def.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
#define PLATFORM_LINKER_ARCH aarch64
#define PLATFORM_STACK_SIZE 0xB00
#define CACHE_WRITEBACK_GRANULE 64
#define PLAT_PRIMARY_CPU U(0x0)
#define PLATFORM_MAX_CPU_PER_CLUSTER U(4)
#define PLATFORM_CLUSTER_COUNT U(1)
#define PLATFORM_CLUSTER0_CORE_COUNT U(4)
#define PLATFORM_CLUSTER1_CORE_COUNT U(0)
#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT)
#define IMX_PWR_LVL0 MPIDR_AFFLVL0
#define IMX_PWR_LVL1 MPIDR_AFFLVL1
#define IMX_PWR_LVL2 MPIDR_AFFLVL2
#define PWR_DOMAIN_AT_MAX_LVL U(1)
#define PLAT_MAX_PWR_LVL U(2)
#define PLAT_MAX_OFF_STATE U(4)
#define PLAT_MAX_RET_STATE U(2)
#define PLAT_WAIT_RET_STATE U(1)
#define PLAT_STOP_OFF_STATE U(3)
#if defined(NEED_BL2)
#define BL2_BASE U(0x960000)
#define BL2_LIMIT U(0x980000)
#define BL31_BASE U(0x940000)
#define BL31_LIMIT U(0x960000)
#define IMX_FIP_BASE U(0x40310000)
#define IMX_FIP_SIZE U(0x000300000)
#define IMX_FIP_LIMIT U(FIP_BASE + FIP_SIZE)
/* Define FIP image location on eMMC */
#define IMX_FIP_MMC_BASE U(0x100000)
#define PLAT_IMX8MP_BOOT_MMC_BASE U(0x30B50000) /* SD */
#else
#define BL31_BASE U(0x960000)
#define BL31_LIMIT U(0x980000)
#endif
#define PLAT_PRI_BITS U(3)
#define PLAT_SDEI_CRITICAL_PRI 0x10
#define PLAT_SDEI_NORMAL_PRI 0x20
#define PLAT_SDEI_SGI_PRIVATE U(9)
/* non-secure uboot base */
#define PLAT_NS_IMAGE_OFFSET U(0x40200000)
#define PLAT_NS_IMAGE_SIZE U(0x00200000)
/* GICv3 base address */
#define PLAT_GICD_BASE U(0x38800000)
#define PLAT_GICR_BASE U(0x38880000)
#define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 32)
#define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 32)
#define MAX_XLAT_TABLES 8
#define MAX_MMAP_REGIONS 16
#define HAB_RVT_BASE U(0x00000900) /* HAB_RVT for i.MX8MM */
#define IMX_BOOT_UART_CLK_IN_HZ 24000000 /* Select 24MHz oscillator */
#define PLAT_CRASH_UART_BASE IMX_BOOT_UART_BASE
#define PLAT_CRASH_UART_CLK_IN_HZ 24000000
#define IMX_CONSOLE_BAUDRATE 115200
#define IMX_AIPSTZ1 U(0x301f0000)
#define IMX_AIPSTZ2 U(0x305f0000)
#define IMX_AIPSTZ3 U(0x309f0000)
#define IMX_AIPSTZ4 U(0x32df0000)
#define IMX_AIPSTZ5 U(0x30df0000)
#define IMX_AIPS_BASE U(0x30000000)
#define IMX_AIPS_SIZE U(0x3000000)
#define IMX_GPV_BASE U(0x32000000)
#define IMX_GPV_SIZE U(0x800000)
#define IMX_AIPS1_BASE U(0x30200000)
#define IMX_AIPS4_BASE U(0x32c00000)
#define IMX_ANAMIX_BASE U(0x30360000)
#define IMX_CCM_BASE U(0x30380000)
#define IMX_SRC_BASE U(0x30390000)
#define IMX_GPC_BASE U(0x303a0000)
#define IMX_RDC_BASE U(0x303d0000)
#define IMX_CSU_BASE U(0x303e0000)
#define IMX_WDOG_BASE U(0x30280000)
#define IMX_SNVS_BASE U(0x30370000)
#define IMX_NOC_BASE U(0x32700000)
#define IMX_NOC_SIZE U(0x100000)
#define IMX_TZASC_BASE U(0x32F80000)
#define IMX_IOMUX_GPR_BASE U(0x30340000)
#define IMX_CAAM_BASE U(0x30900000)
#define IMX_DDRC_BASE U(0x3d400000)
#define IMX_DDRPHY_BASE U(0x3c000000)
#define IMX_DDR_IPS_BASE U(0x3d000000)
#define IMX_DDR_IPS_SIZE U(0x1800000)
#define IMX_ROM_BASE U(0x0)
#define IMX_GIC_BASE PLAT_GICD_BASE
#define IMX_GIC_SIZE U(0x200000)
#define IMX_HSIOMIX_CTL_BASE U(0x32f10000)
#define IMX_HDMI_CTL_BASE U(0x32fc0000)
#define RTX_RESET_CTL0 U(0x20)
#define RTX_CLK_CTL0 U(0x40)
#define RTX_CLK_CTL1 U(0x50)
#define TX_CONTROL0 U(0x200)
#define TX_CONTROL1 U(0x220)
#define IMX_MEDIAMIX_CTL_BASE U(0x32ec0000)
#define RSTn_CSR U(0x0)
#define CLK_EN_CSR U(0x4)
#define RST_DIV U(0x8)
#define LCDIF_ARCACHE_CTRL U(0x4c)
#define ISI_CACHE_CTRL U(0x50)
#define WDOG_WSR U(0x2)
#define WDOG_WCR_WDZST BIT(0)
#define WDOG_WCR_WDBG BIT(1)
#define WDOG_WCR_WDE BIT(2)
#define WDOG_WCR_WDT BIT(3)
#define WDOG_WCR_SRS BIT(4)
#define WDOG_WCR_WDA BIT(5)
#define WDOG_WCR_SRE BIT(6)
#define WDOG_WCR_WDW BIT(7)
#define SRC_A53RCR0 U(0x4)
#define SRC_A53RCR1 U(0x8)
#define SRC_OTG1PHY_SCR U(0x20)
#define SRC_OTG2PHY_SCR U(0x24)
#define SRC_GPR1_OFFSET U(0x74)
#define SNVS_LPCR U(0x38)
#define SNVS_LPCR_SRTC_ENV BIT(0)
#define SNVS_LPCR_DP_EN BIT(5)
#define SNVS_LPCR_TOP BIT(6)
#define IOMUXC_GPR10 U(0x28)
#define GPR_TZASC_EN BIT(0)
#define GPR_TZASC_EN_LOCK BIT(16)
#define ANAMIX_MISC_CTL U(0x124)
#define DRAM_PLL_CTRL (IMX_ANAMIX_BASE + 0x50)
#define MAX_CSU_NUM U(64)
#define OCRAM_S_BASE U(0x00180000)
#define OCRAM_S_SIZE U(0x8000)
#define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE)
#define SAVED_DRAM_TIMING_BASE OCRAM_S_BASE
#define COUNTER_FREQUENCY 8000000 /* 8MHz */
#define IMX_WDOG_B_RESET
#define MAX_IO_HANDLES 3U
#define MAX_IO_DEVICES 2U
#define MAX_IO_BLOCK_DEVICES 1U
#define GIC_MAP MAP_REGION_FLAT(IMX_GIC_BASE, IMX_GIC_SIZE, MT_DEVICE | MT_RW)
#define AIPS_MAP MAP_REGION_FLAT(IMX_AIPS_BASE, IMX_AIPS_SIZE, MT_DEVICE | MT_RW) /* AIPS map */
#define OCRAM_S_MAP MAP_REGION_FLAT(OCRAM_S_BASE, OCRAM_S_SIZE, MT_MEMORY | MT_RW) /* OCRAM_S */
#define DDRC_MAP MAP_REGION_FLAT(IMX_DDRPHY_BASE, IMX_DDR_IPS_SIZE, MT_DEVICE | MT_RW) /* DDRMIX */
#define NOC_MAP MAP_REGION_FLAT(IMX_NOC_BASE, IMX_NOC_SIZE, MT_DEVICE | MT_RW) /* NOC QoS */
#endif /* platform_def.h */
|
//
// MCOUtils.h
// mailcore2
//
// Created by DINH Viêt Hoà on 3/22/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#ifndef __MAILCORE_MCOUTILS_H_
#define __MAILCORE_MCOUTILS_H_
#import <MailCore/MCOObjectWrapper.h>
#import <MailCore/NSData+MCO.h>
#import <MailCore/NSString+MCO.h>
#import <MailCore/NSDictionary+MCO.h>
#import <MailCore/NSArray+MCO.h>
#import <MailCore/NSObject+MCO.h>
#import <MailCore/MCOObjectWrapper.h>
#import <MailCore/NSError+MCO.h>
#import <MailCore/NSValue+MCO.h>
#import <MailCore/MCOOperation.h>
#import <MailCore/MCOConstants.h>
#import <MailCore/MCOIndexSet.h>
#import <MailCore/MCORange.h>
#endif
|
/******************************************************************************
Copyright 2014 Scientific Computation Research Center,
Rensselaer Polytechnic Institute. All rights reserved.
This work is open source software, licensed under the terms of the
BSD license as described in the LICENSE file in the top-level directory.
*******************************************************************************/
#include "gmi.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
struct creator {
gmi_creator f;
char* ext;
};
struct creators {
int n;
struct creator c[1];
};
static struct creators* ctors = NULL;
struct gmi_set* gmi_make_set(int n)
{
int extra;
struct gmi_set* s;
extra = n - 1;
/* undefined behavior sanitizer complains if we cut
below the size in the struct definition */
if (extra < 1)
extra = 1;
s = malloc(sizeof(*s) + extra * sizeof(struct gmi_ent*));
s->n = n;
return s;
}
void gmi_free_set(struct gmi_set* s)
{
free(s);
}
struct gmi_iter* gmi_begin(struct gmi_model* m, int dim)
{
return m->ops->begin(m, dim);
}
struct gmi_ent* gmi_next(struct gmi_model* m, struct gmi_iter* i)
{
return m->ops->next(m, i);
}
void gmi_end(struct gmi_model* m, struct gmi_iter* i)
{
m->ops->end(m, i);
}
int gmi_dim(struct gmi_model* m, struct gmi_ent* e)
{
return m->ops->dim(m, e);
}
int gmi_tag(struct gmi_model* m, struct gmi_ent* e)
{
return m->ops->tag(m, e);
}
struct gmi_ent* gmi_find(struct gmi_model* m, int dim, int tag)
{
return m->ops->find(m, dim, tag);
}
struct gmi_set* gmi_adjacent(struct gmi_model* m, struct gmi_ent* e, int dim)
{
if (m->ops->adjacent)
return m->ops->adjacent(m, e, dim);
return gmi_make_set(0);
}
int gmi_can_eval(struct gmi_model* m)
{
return m->ops->eval != NULL;
}
void gmi_eval(struct gmi_model* m, struct gmi_ent* e,
double const p[2], double x[3])
{
m->ops->eval(m, e, p, x);
}
void gmi_reparam(struct gmi_model* m, struct gmi_ent* from,
double const from_p[2], struct gmi_ent* to, double to_p[2])
{
m->ops->reparam(m, from, from_p, to, to_p);
}
int gmi_periodic(struct gmi_model* m, struct gmi_ent* e, int dim)
{
return m->ops->periodic(m, e, dim);
}
void gmi_range(struct gmi_model* m, struct gmi_ent* e, int dim,
double r[2])
{
m->ops->range(m, e, dim, r);
}
void gmi_closest_point(struct gmi_model* m, struct gmi_ent* e,
double const from[3], double to[3], double to_p[2])
{
m->ops->closest_point(m, e, from, to, to_p);
}
void gmi_normal(struct gmi_model* m, struct gmi_ent* e,
double const p[2], double n[3])
{
m->ops->normal(m, e, p, n);
}
void gmi_first_derivative(struct gmi_model* m, struct gmi_ent* e,
double const p[2], double t0[3], double t1[3])
{
m->ops->first_derivative(m, e, p, t0, t1);
}
void gmi_destroy(struct gmi_model* m)
{
m->ops->destroy(m);
}
static void free_ctors(void)
{
int i;
for (i = 0; i < ctors->n; ++i)
free(ctors->c[i].ext);
free(ctors);
}
static char* copy_string(const char* a)
{
char* b;
b = malloc(strlen(a) + 1);
strcpy(b, a);
return b;
}
void gmi_register(gmi_creator f, const char* ext)
{
if (!ctors) {
ctors = malloc(sizeof(struct creators));
ctors->n = 1;
ctors->c[0].f = f;
ctors->c[0].ext = copy_string(ext);
atexit(free_ctors);
} else {
++ctors->n;
ctors = realloc(ctors, sizeof(struct creators) +
(ctors->n - 1) * sizeof(struct creator));
ctors->c[ctors->n - 1].f = f;
ctors->c[ctors->n - 1].ext = copy_string(ext);
}
}
int gmi_has_ext(const char* filename, const char* ext)
{
const char* c = strrchr(filename, '.');
if (!c)
gmi_fail("model file name with no extension");
++c; /* exclude the dot itself */
if (!strcmp(c, ext))
return 1;
return 0;
}
struct gmi_model* gmi_load(const char* filename)
{
int i;
if (!ctors)
gmi_fail("no models registered before gmi_load");
for (i = 0; i < ctors->n; ++i)
if (gmi_has_ext(filename, ctors->c[i].ext))
return ctors->c[i].f(filename);
gmi_fail("model file extension not registered");
return NULL;
}
void gmi_fail(const char* why)
{
fprintf(stderr,"gmi failed: %s\n",why);
abort();
}
void gmi_write_dmg(struct gmi_model* m, const char* filename)
{
struct gmi_iter* it;
struct gmi_ent* e;
struct gmi_set* s;
FILE* f = fopen(filename, "w");
int i;
/* entity counts */
fprintf(f, "%d %d %d %d\n", m->n[3], m->n[2], m->n[1], m->n[0]);
/* bounding box */
fprintf(f, "0 0 0\n");
fprintf(f, "0 0 0\n");
/* vertices */
it = gmi_begin(m, 0);
while ((e = gmi_next(m, it))) {
fprintf(f, "%d 0 0 0\n", gmi_tag(m, e));
}
gmi_end(m, it);
/* edges */
it = gmi_begin(m, 1);
while ((e = gmi_next(m, it))) {
s = gmi_adjacent(m, e, 0);
fprintf(f, "%d ", gmi_tag(m, e));
if (s->n == 0)
fprintf(f,"-42 -42\n");
else if (s->n == 1)
fprintf(f,"%d -42\n", gmi_tag(m, s->e[0]));
else
fprintf(f, "%d %d\n",
gmi_tag(m, s->e[0]), gmi_tag(m, s->e[1]));
gmi_free_set(s);
}
gmi_end(m, it);
/* faces */
it = gmi_begin(m, 2);
while ((e = gmi_next(m, it))) {
/* we're going to cheat a bit here and
treat all edges as one giant loop */
fprintf(f, "%d 1\n", gmi_tag(m, e));
s = gmi_adjacent(m, e, 1);
fprintf(f, "%d\n", s->n);
for (i = 0; i < s->n; ++i)
fprintf(f, " %d 0\n", gmi_tag(m, s->e[i]));
gmi_free_set(s);
}
gmi_end(m, it);
/* regions */
it = gmi_begin(m, 3);
while ((e = gmi_next(m, it))) {
/* same sort of cheat, all faces are one shell */
fprintf(f, "%d 1\n", gmi_tag(m, e));
s = gmi_adjacent(m, e, 2);
fprintf(f, "%d\n", s->n);
for (i = 0; i < s->n; ++i)
fprintf(f, " %d 0\n", gmi_tag(m, s->e[i]));
gmi_free_set(s);
}
gmi_end(m, it);
fclose(f);
}
|
/*
* AST demuxer
* Copyright (c) 2012 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
#include "ast.h"
static int ast_probe(const AVProbeData *p)
{
if (AV_RL32(p->buf) != MKTAG('S','T','R','M'))
return 0;
if (!AV_RB16(p->buf + 10) ||
!AV_RB16(p->buf + 12) || AV_RB16(p->buf + 12) > 256 ||
!AV_RB32(p->buf + 16) || AV_RB32(p->buf + 16) > 8*48000)
return AVPROBE_SCORE_MAX / 8;
return AVPROBE_SCORE_MAX / 3 * 2;
}
static int ast_read_header(AVFormatContext *s)
{
int depth;
AVStream *st;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avio_skip(s->pb, 8);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = ff_codec_get_id(ff_codec_ast_tags, avio_rb16(s->pb));
depth = avio_rb16(s->pb);
if (depth != 16) {
avpriv_request_sample(s, "depth %d", depth);
return AVERROR_INVALIDDATA;
}
st->codecpar->channels = avio_rb16(s->pb);
if (!st->codecpar->channels)
return AVERROR_INVALIDDATA;
if (st->codecpar->channels == 2)
st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
else if (st->codecpar->channels == 4)
st->codecpar->channel_layout = AV_CH_LAYOUT_4POINT0;
avio_skip(s->pb, 2);
st->codecpar->sample_rate = avio_rb32(s->pb);
if (st->codecpar->sample_rate <= 0)
return AVERROR_INVALIDDATA;
st->start_time = 0;
st->duration = avio_rb32(s->pb);
avio_skip(s->pb, 40);
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
return 0;
}
static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)
{
uint32_t type, size;
int64_t pos;
int ret;
if (avio_feof(s->pb))
return AVERROR_EOF;
pos = avio_tell(s->pb);
type = avio_rl32(s->pb);
size = avio_rb32(s->pb);
if (!s->streams[0]->codecpar->channels || size > INT_MAX / s->streams[0]->codecpar->channels)
return AVERROR_INVALIDDATA;
size *= s->streams[0]->codecpar->channels;
if ((ret = avio_skip(s->pb, 24)) < 0) // padding
return ret;
if (type == MKTAG('B','L','C','K')) {
ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = 0;
pkt->pos = pos;
} else {
av_log(s, AV_LOG_ERROR, "unknown chunk %"PRIx32"\n", type);
avio_skip(s->pb, size);
ret = AVERROR_INVALIDDATA;
}
return ret;
}
AVInputFormat ff_ast_demuxer = {
.name = "ast",
.long_name = NULL_IF_CONFIG_SMALL("AST (Audio Stream)"),
.read_probe = ast_probe,
.read_header = ast_read_header,
.read_packet = ast_read_packet,
.extensions = "ast",
.flags = AVFMT_GENERIC_INDEX,
.codec_tag = (const AVCodecTag* const []){ff_codec_ast_tags, 0},
};
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE590_Free_Memory_Not_on_Heap__delete_long_static_81.h
Label Definition File: CWE590_Free_Memory_Not_on_Heap__delete.nonpointer.label.xml
Template File: sources-sink-81.tmpl.h
*/
/*
* @description
* CWE: 590 Free Memory Not on Heap
* BadSource: static Data buffer is declared static on the stack
* GoodSource: Allocate memory on the heap
* Sinks:
* BadSink : Print then free data
* Flow Variant: 81 Data flow: data passed in a parameter to a virtual method called via a reference
*
* */
#include "std_testcase.h"
#include <wchar.h>
namespace CWE590_Free_Memory_Not_on_Heap__delete_long_static_81
{
class CWE590_Free_Memory_Not_on_Heap__delete_long_static_81_base
{
public:
/* pure virtual function */
virtual void action(long * data) const = 0;
};
#ifndef OMITBAD
class CWE590_Free_Memory_Not_on_Heap__delete_long_static_81_bad : public CWE590_Free_Memory_Not_on_Heap__delete_long_static_81_base
{
public:
void action(long * data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE590_Free_Memory_Not_on_Heap__delete_long_static_81_goodG2B : public CWE590_Free_Memory_Not_on_Heap__delete_long_static_81_base
{
public:
void action(long * data) const;
};
#endif /* OMITGOOD */
}
|
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Meowth Fingerprint MCU configuration */
#include "common.h"
#include "hooks.h"
#include "registers.h"
#include "spi.h"
#include "system.h"
#include "task.h"
#ifndef SECTION_IS_RO
#error "This file should only be built for RO."
#endif
/**
* Disable restricted commands when the system is locked.
*
* @see console.h system.c
*/
int console_is_restricted(void)
{
return system_is_locked();
}
#include "gpio_list.h"
static void ap_deferred(void)
{
/*
* Behavior:
* AP Active (ex. Intel S0): SLP_L is 1
* AP Suspend (ex. Intel S0ix): SLP_L is 0
* The alternative SLP_ALT_L should be pulled high at all the times.
*
* Legacy Intel behavior:
* in S3: SLP_ALT_L is 0 and SLP_L is X.
* in S0ix: SLP_ALT_L is X and SLP_L is 0.
* in S0: SLP_ALT_L is 1 and SLP_L is 1.
* in S5/G3, the FP MCU should not be running.
*/
int running = gpio_get_level(GPIO_SLP_ALT_L) &&
gpio_get_level(GPIO_SLP_L);
if (running) { /* AP is S0 */
disable_sleep(SLEEP_MASK_AP_RUN);
hook_notify(HOOK_CHIPSET_RESUME);
} else { /* AP is suspend/S0ix/S3 */
hook_notify(HOOK_CHIPSET_SUSPEND);
enable_sleep(SLEEP_MASK_AP_RUN);
}
}
DECLARE_DEFERRED(ap_deferred);
/* PCH power state changes */
void slp_event(enum gpio_signal signal)
{
hook_call_deferred(&ap_deferred_data, 0);
}
void board_init(void)
{
/* Enable interrupt on PCH power signals */
gpio_enable_interrupt(GPIO_SLP_ALT_L);
gpio_enable_interrupt(GPIO_SLP_L);
/*
* Enable the SPI slave interface if the PCH is up.
* Do not use hook_call_deferred(), because ap_deferred() will be
* called after tasks with priority higher than HOOK task (very late).
*/
ap_deferred();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_
#define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_
#include <map>
#include <set>
#include <string>
#include <vector>
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_http_handler_delegate.h"
#include "net/server/http_server.h"
#include "net/url_request/url_request.h"
namespace net {
class StreamListenSocketFactory;
class URLRequestContextGetter;
}
namespace content {
class DevToolsClientHost;
class RenderViewHost;
class DevToolsHttpHandlerImpl
: public DevToolsHttpHandler,
public base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>,
public net::HttpServer::Delegate,
public net::URLRequest::Delegate {
private:
struct PageInfo;
typedef std::vector<PageInfo> PageList;
friend class base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>;
friend class DevToolsHttpHandler;
static bool SortPageListByTime(const PageInfo& info1, const PageInfo& info2);
// Takes ownership over |socket_factory|.
DevToolsHttpHandlerImpl(const net::StreamListenSocketFactory* socket_factory,
const std::string& frontend_url,
net::URLRequestContextGetter* request_context_getter,
DevToolsHttpHandlerDelegate* delegate);
virtual ~DevToolsHttpHandlerImpl();
void Start();
// DevToolsHttpHandler implementation.
virtual void Stop() OVERRIDE;
virtual void SetRenderViewHostBinding(
RenderViewHostBinding* binding) OVERRIDE;
// net::HttpServer::Delegate implementation.
virtual void OnHttpRequest(int connection_id,
const net::HttpServerRequestInfo& info) OVERRIDE;
virtual void OnWebSocketRequest(
int connection_id,
const net::HttpServerRequestInfo& info) OVERRIDE;
virtual void OnWebSocketMessage(int connection_id,
const std::string& data) OVERRIDE;
virtual void OnClose(int connection_id) OVERRIDE;
PageList GeneratePageList();
virtual void OnJsonRequestUI(int connection_id,
const net::HttpServerRequestInfo& info);
virtual void OnWebSocketRequestUI(int connection_id,
const net::HttpServerRequestInfo& info);
virtual void OnWebSocketMessageUI(int connection_id,
const std::string& data);
virtual void OnCloseUI(int connection_id);
// net::URLRequest::Delegate implementation.
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
virtual void OnReadCompleted(net::URLRequest* request,
int bytes_read) OVERRIDE;
void Init();
void TeardownAndRelease();
void Bind(net::URLRequest* request, int connection_id);
void RequestCompleted(net::URLRequest* request);
void Send200(int connection_id,
const std::string& data,
const std::string& mime_type = "text/html");
void Send404(int connection_id);
void Send500(int connection_id,
const std::string& message);
void AcceptWebSocket(int connection_id,
const net::HttpServerRequestInfo& request);
std::string overridden_frontend_url_;
scoped_ptr<const net::StreamListenSocketFactory> socket_factory_;
scoped_refptr<net::HttpServer> server_;
typedef std::map<net::URLRequest*, int>
RequestToSocketMap;
RequestToSocketMap request_to_connection_io_;
typedef std::map<int, std::set<net::URLRequest*> >
ConnectionToRequestsMap;
ConnectionToRequestsMap connection_to_requests_io_;
typedef std::map<net::URLRequest*, scoped_refptr<net::IOBuffer> >
BuffersMap;
BuffersMap request_to_buffer_io_;
typedef std::map<int, content::DevToolsClientHost*>
ConnectionToClientHostMap;
ConnectionToClientHostMap connection_to_client_host_ui_;
net::URLRequestContextGetter* request_context_getter_;
scoped_ptr<DevToolsHttpHandlerDelegate> delegate_;
RenderViewHostBinding* binding_;
scoped_ptr<RenderViewHostBinding> default_binding_;
DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl);
};
} // namespace content
#endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_
|
// This file declares the IClientSecurity Interface and Gateway for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Interface Declaration
class PyIClientSecurity : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIClientSecurity);
static IClientSecurity *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *QueryBlanket(PyObject *self, PyObject *args);
static PyObject *SetBlanket(PyObject *self, PyObject *args);
static PyObject *CopyProxy(PyObject *self, PyObject *args);
protected:
PyIClientSecurity(IUnknown *pdisp);
~PyIClientSecurity();
};
// ---------------------------------------------------
//
// Gateway Declaration
class PyGClientSecurity : public PyGatewayBase, public IClientSecurity
{
protected:
PyGClientSecurity(PyObject *instance) : PyGatewayBase(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGClientSecurity, IClientSecurity, IID_IClientSecurity, PyGatewayBase)
// IClientSecurity
STDMETHOD(QueryBlanket)(
IUnknown * pProxy,
DWORD * pAuthnSvc,
DWORD * pAuthzSvc,
OLECHAR ** pServerPrincName,
DWORD * pAuthnLevel,
DWORD * pImpLevel,
void ** pAuthInfo,
DWORD * pCapabilites);
STDMETHOD(SetBlanket)(
IUnknown * pProxy,
DWORD dwAuthnSvc,
DWORD dwAuthzSvc,
OLECHAR * pServerPrincName,
DWORD dwAuthnLevel,
DWORD dwImpLevel,
void * pAuthInfo,
DWORD dwCapabilities);
STDMETHOD(CopyProxy)(
IUnknown * pProxy,
IUnknown ** ppCopy);
};
|
/*
* This file is part of LibCSS
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2012 Michael Drake <tlsa@netsurf-browser.org>
*/
#include "bytecode/bytecode.h"
#include "bytecode/opcodes.h"
#include "select/propset.h"
#include "select/propget.h"
#include "utils/utils.h"
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
css_error css__cascade_column_fill(uint32_t opv, css_style *style,
css_select_state *state)
{
UNUSED(style);
if (isInherit(opv) == false) {
switch (getValue(opv)) {
case COLUMN_FILL_BALANCE:
case COLUMN_FILL_AUTO:
/** \todo convert to public values */
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
/** \todo set computed elevation */
}
return CSS_OK;
}
css_error css__set_column_fill_from_hint(const css_hint *hint,
css_computed_style *style)
{
UNUSED(hint);
UNUSED(style);
return CSS_OK;
}
css_error css__initial_column_fill(css_select_state *state)
{
UNUSED(state);
return CSS_OK;
}
css_error css__compose_column_fill(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
UNUSED(parent);
UNUSED(child);
UNUSED(result);
return CSS_OK;
}
|
//
// PDRuntimeDomain.h
// PonyDebuggerDerivedSources
//
// Generated on 8/23/12
//
// Licensed to Square, Inc. under one or more contributor license agreements.
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. licenses this file to you.
//
#import <PonyDebugger/PDObject.h>
#import <PonyDebugger/PDDebugger.h>
#import <PonyDebugger/PDDynamicDebuggerDomain.h>
@class PDRuntimeRemoteObject;
@class PDRuntimeExecutionContextDescription;
@protocol PDRuntimeCommandDelegate;
// Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.
@interface PDRuntimeDomain : PDDynamicDebuggerDomain
@property (nonatomic, assign) id <PDRuntimeCommandDelegate, PDCommandDelegate> delegate;
// Events
// Issued when new isolated context is created.
// Param context: A newly created isolated contex.
- (void)isolatedContextCreatedWithContext:(PDRuntimeExecutionContextDescription *)context;
@end
@protocol PDRuntimeCommandDelegate <PDCommandDelegate>
@optional
// Evaluates expression on global object.
// Param expression: Expression to evaluate.
// Param objectGroup: Symbolic group name that can be used to release multiple objects.
// Param includeCommandLineAPI: Determines whether Command Line API should be available during the evaluation.
// Param doNotPauseOnExceptionsAndMuteConsole: Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.
// Param contextId: Specifies in which isolated context to perform evaluation. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page.
// Param returnByValue: Whether the result is expected to be a JSON object that should be sent by value.
// Callback Param result: Evaluation result.
// Callback Param wasThrown: True if the result was thrown during the evaluation.
- (void)domain:(PDRuntimeDomain *)domain evaluateWithExpression:(NSString *)expression objectGroup:(NSString *)objectGroup includeCommandLineAPI:(NSNumber *)includeCommandLineAPI doNotPauseOnExceptionsAndMuteConsole:(NSNumber *)doNotPauseOnExceptionsAndMuteConsole contextId:(NSNumber *)contextId returnByValue:(NSNumber *)returnByValue callback:(void (^)(PDRuntimeRemoteObject *result, NSNumber *wasThrown, id error))callback;
// Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
// Param objectId: Identifier of the object to call function on.
// Param functionDeclaration: Declaration of the function to call.
// Param arguments: Call arguments. All call arguments must belong to the same JavaScript world as the target object.
// Param doNotPauseOnExceptionsAndMuteConsole: Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state.
// Param returnByValue: Whether the result is expected to be a JSON object which should be sent by value.
// Callback Param result: Call result.
// Callback Param wasThrown: True if the result was thrown during the evaluation.
- (void)domain:(PDRuntimeDomain *)domain callFunctionOnWithObjectId:(NSString *)objectId functionDeclaration:(NSString *)functionDeclaration arguments:(NSArray *)arguments doNotPauseOnExceptionsAndMuteConsole:(NSNumber *)doNotPauseOnExceptionsAndMuteConsole returnByValue:(NSNumber *)returnByValue callback:(void (^)(PDRuntimeRemoteObject *result, NSNumber *wasThrown, id error))callback;
// Returns properties of a given object. Object group of the result is inherited from the target object.
// Param objectId: Identifier of the object to return properties for.
// Param ownProperties: If true, returns properties belonging only to the element itself, not to its prototype chain.
// Callback Param result: Object properties.
- (void)domain:(PDRuntimeDomain *)domain getPropertiesWithObjectId:(NSString *)objectId ownProperties:(NSNumber *)ownProperties callback:(void (^)(NSArray *result, id error))callback;
// Releases remote object with given id.
// Param objectId: Identifier of the object to release.
- (void)domain:(PDRuntimeDomain *)domain releaseObjectWithObjectId:(NSString *)objectId callback:(void (^)(id error))callback;
// Releases all remote objects that belong to a given group.
// Param objectGroup: Symbolic object group name.
- (void)domain:(PDRuntimeDomain *)domain releaseObjectGroupWithObjectGroup:(NSString *)objectGroup callback:(void (^)(id error))callback;
// Tells inspected instance(worker or page) that it can run in case it was started paused.
- (void)domain:(PDRuntimeDomain *)domain runWithCallback:(void (^)(id error))callback;
// Enables reporting about creation of isolated contexts by means of <code>isolatedContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing isolated context.
// Param enabled: Reporting enabled state.
- (void)domain:(PDRuntimeDomain *)domain setReportExecutionContextCreationWithEnabled:(NSNumber *)enabled callback:(void (^)(id error))callback;
@end
@interface PDDebugger (PDRuntimeDomain)
@property (nonatomic, readonly, strong) PDRuntimeDomain *runtimeDomain;
@end
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
#define CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
#include <string>
#include <map>
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/content_browser_client.h"
namespace printing {
class PrintJobManager;
}
namespace content {
class ShellBrowserContext;
class ShellBrowserMainParts;
class ShellResourceDispatcherHostDelegate;
class RenderProcessHost;
class ShellContentBrowserClient : public ContentBrowserClient {
public:
ShellContentBrowserClient();
virtual ~ShellContentBrowserClient();
// ContentBrowserClient overrides.
virtual BrowserMainParts* CreateBrowserMainParts(
const MainFunctionParams& parameters) OVERRIDE;
virtual void OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view,
const WebContents::CreateParams& params) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) OVERRIDE;
virtual void ResourceDispatcherHostCreated() OVERRIDE;
virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
virtual void OverrideWebkitPrefs(
RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) OVERRIDE;
virtual std::string GetDefaultDownloadName() OVERRIDE;
virtual MediaObserver* GetMediaObserver() OVERRIDE;
virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) OVERRIDE;
virtual bool IsHandledURL(const GURL& url) OVERRIDE;
virtual bool ShouldTryToUseExistingProcessHost(
BrowserContext* browser_context, const GURL& url) OVERRIDE;
virtual bool IsSuitableHost(RenderProcessHost* process_host,
const GURL& site_url) OVERRIDE;
ShellBrowserContext* browser_context();
ShellBrowserContext* off_the_record_browser_context();
ShellResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() {
return resource_dispatcher_host_delegate_.get();
}
ShellBrowserMainParts* shell_browser_main_parts() {
return shell_browser_main_parts_;
}
virtual printing::PrintJobManager* print_job_manager();
virtual void RenderProcessWillLaunch(RenderProcessHost* host) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContext(
BrowserContext* browser_context,
ProtocolHandlerMap* protocol_handlers, URLRequestInterceptorScopedVector request_interceptors) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
BrowserContext* browser_context,
const base::FilePath& partition_path,
bool in_memory,
ProtocolHandlerMap* protocol_handlers,
URLRequestInterceptorScopedVector request_interceptors) OVERRIDE;
virtual void AllowCertificateError(int render_process_id,
int render_frame_id,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
ResourceType resource_type,
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
CertificateRequestResultType* result) OVERRIDE;
virtual void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) OVERRIDE;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
virtual void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
std::vector<content::FileDescriptorInfo>* mappings) OVERRIDE;
#endif
virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE;
//Notification
virtual void ShowDesktopNotification(
const ShowDesktopNotificationHostMsgParams& params,
RenderFrameHost* render_frame_host,
scoped_ptr<DesktopNotificationDelegate> delegate,
base::Closure* cancel_callback) OVERRIDE;
virtual void RequestMidiSysExPermission(
WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) OVERRIDE;
virtual void RequestProtectedMediaIdentifierPermission(
WebContents* web_contents,
const GURL& origin,
base::Callback<void(bool)> result_callback,
base::Closure* cancel_callback) OVERRIDE;
private:
ShellBrowserContext* ShellBrowserContextForBrowserContext(
BrowserContext* content_browser_context);
bool GetUserAgentManifest(std::string* agent);
scoped_ptr<ShellResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
ShellBrowserMainParts* shell_browser_main_parts_;
content::RenderProcessHost* master_rph_;
};
} // namespace content
#endif // CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
|
/**************************************************************************
*
* Copyright 2013-2014 RAD Game Tools and Valve Software
* 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, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
**************************************************************************/
// File: vogl_display_list_state.h
#ifndef VOGL_DISPLAY_LIST_STATE_H
#define VOGL_DISPLAY_LIST_STATE_H
#include "vogl_core.h"
#include "vogl_context_info.h"
#include "vogl_general_context_state.h"
#include "vogl_blob_manager.h"
#include "vogl_trace_file_reader.h"
//----------------------------------------------------------------------------------------------------------------------
// class vogl_display_list
//----------------------------------------------------------------------------------------------------------------------
class vogl_display_list
{
public:
vogl_display_list();
void clear();
GLuint get_handle() const
{
return m_handle;
}
void set_handle(GLuint handle)
{
m_handle = handle;
}
bool is_valid() const
{
return m_valid;
}
bool is_generating() const
{
return m_generating;
}
const dynamic_string &get_xfont_name() const
{
return m_xfont_name;
}
int get_xfont_glyph() const
{
return m_xfont_glyph;
}
bool is_xfont() const
{
return m_xfont;
}
const vogl_trace_packet_array &get_packets() const
{
return m_packets;
}
vogl_trace_packet_array &get_packets()
{
return m_packets;
}
void init_xfont(const char *pName, int glyph);
void begin_gen();
void end_gen();
bool serialize(json_node &node, vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes) const;
bool deserialize(const json_node &node, const vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes);
private:
GLuint m_handle;
vogl_trace_packet_array m_packets;
dynamic_string m_xfont_name;
int m_xfont_glyph;
bool m_xfont;
bool m_generating;
bool m_valid;
};
typedef vogl::map<GLuint, vogl_display_list> vogl_display_list_map;
//----------------------------------------------------------------------------------------------------------------------
// class vogl_display_list_state
//----------------------------------------------------------------------------------------------------------------------
class vogl_display_list_state
{
public:
vogl_display_list_state();
vogl_display_list_state(const vogl_display_list_state &other);
~vogl_display_list_state();
vogl_display_list_state &operator=(const vogl_display_list_state &rhs);
void clear();
uint32_t size() const
{
return m_display_lists.size();
}
vogl_display_list *find_list(GLuint list)
{
return m_display_lists.find_value(list);
}
const vogl_display_list_map &get_display_list_map() const
{
return m_display_lists;
}
vogl_display_list_map &get_display_list_map()
{
return m_display_lists;
}
bool remap_handles(vogl_handle_remapper &remapper);
bool serialize(json_node &node, vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes) const;
bool deserialize(const json_node &node, const vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes);
bool define_list(GLuint trace_handle, GLuint replay_handle, const vogl_display_list &list);
bool gen_lists(GLuint first, GLsizei n, GLuint *pObject_handles = NULL);
bool del_lists(GLuint first, GLsizei n);
bool glx_font(const char *pFont, int first, int count, int listBase);
static bool is_call_listable(gl_entrypoint_id_t func, const vogl_trace_packet &packet);
void new_list(GLuint trace_handle, GLuint replay_handle);
bool add_packet_to_list(GLuint handle, gl_entrypoint_id_t func, const vogl_trace_packet &packet);
bool end_list(GLuint trace_handle);
typedef void (*pBind_callback_func_ptr)(vogl_namespace_t handle_namespace, GLenum target, GLuint handle, void *pOpaque);
bool parse_list_and_update_shadows(GLuint handle, pBind_callback_func_ptr pBind_callback, void *pBind_callback_opaque);
bool parse_lists_and_update_shadows(GLsizei n, GLenum type, const GLvoid *lists, pBind_callback_func_ptr pBind_callback, void *pBind_callback_opaque);
private:
vogl_display_list_map m_display_lists;
};
#endif // VOGL_DISPLAY_LIST_STATE_H
|
/*
* Copyright 2010 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "FBDialog.h"
@protocol FBLoginDialogDelegate;
/**
* Do not use this interface directly, instead, use authorize in Facebook.h
*
* Facebook Login Dialog interface for start the facebook webView login dialog.
* It start pop-ups prompting for credentials and permissions.
*/
@interface FBLoginDialog : FBDialog {
id<FBLoginDialogDelegate> _loginDelegate;
}
-(id) initWithURL:(NSString *) loginURL
loginParams:(NSMutableDictionary *) params
delegate:(id <FBLoginDialogDelegate>) delegate;
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
@protocol FBLoginDialogDelegate <NSObject>
- (void)fbDialogLogin:(NSString*)token expirationDate:(NSDate*)expirationDate;
- (void)fbDialogNotLogin:(BOOL)cancelled;
- (void) fbRequestingCredentials;
@end
|
// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _CEF_MAC_H
#define _CEF_MAC_H
#if defined(OS_MACOSX)
#include <pthread.h>
#include "cef_types_mac.h"
#include "cef_types_wrappers.h"
// Atomic increment and decrement.
inline long CefAtomicIncrement(long volatile *pDest)
{
return __sync_add_and_fetch(pDest, 1);
}
inline long CefAtomicDecrement(long volatile *pDest)
{
return __sync_sub_and_fetch(pDest, 1);
}
// Handle types.
#define CefWindowHandle cef_window_handle_t
#define CefCursorHandle cef_cursor_handle_t
// Critical section wrapper.
class CefCriticalSection
{
public:
CefCriticalSection()
{
pthread_mutexattr_init(&attr_);
pthread_mutexattr_settype(&attr_, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&lock_, &attr_);
}
virtual ~CefCriticalSection()
{
pthread_mutex_destroy(&lock_);
pthread_mutexattr_destroy(&attr_);
}
void Lock()
{
pthread_mutex_lock(&lock_);
}
void Unlock()
{
pthread_mutex_unlock(&lock_);
}
pthread_mutex_t lock_;
pthread_mutexattr_t attr_;
};
struct CefWindowInfoTraits {
typedef cef_window_info_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s)
{
cef_string_clear(&s->m_windowName);
}
static inline void set(const struct_type* src, struct_type* target, bool copy)
{
target->m_View = src->m_View;
target->m_ParentView = src->m_ParentView;
cef_string_set(src->m_windowName.str, src->m_windowName.length,
&target->m_windowName, copy);
target->m_x = src->m_x;
target->m_y = src->m_y;
target->m_nWidth = src->m_nWidth;
target->m_nHeight = src->m_nHeight;
target->m_bHidden = src->m_bHidden;
}
};
// Class representing window information.
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits>
{
public:
typedef CefStructBase<CefWindowInfoTraits> parent;
CefWindowInfo() : parent() {}
CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
void SetAsChild(CefWindowHandle ParentView, int x, int y, int width,
int height)
{
m_ParentView = ParentView;
m_x = x;
m_y = y;
m_nWidth = width;
m_nHeight = height;
m_bHidden = false;
}
};
struct CefPrintInfoTraits {
typedef cef_print_info_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target, bool copy)
{
target->m_Scale = src->m_Scale;
}
};
// Class representing print context information.
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
#endif // OS_MACOSX
#endif // _CEF_MAC_H
|
//******************************************************************************
//
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once
#include <string>
#include <map>
#include <set>
#include <vector>
#include "ConditionalValue.h"
namespace pugi {
class xml_node;
};
class VCProject;
class VCProjectConfiguration;
class VCProjectItem;
class VSTemplateProject;
enum VCProjectSubType {
VCShared,
VCNone,
};
typedef std::set<const VCProject*> VCProjectSet;
typedef std::set<std::string> StringSet;
typedef std::vector<std::string> StringVec;
typedef std::map<std::string, std::string> StringMap;
class VCProject {
public:
virtual ~VCProject();
VCProject(VSTemplateProject* projTemplate, const std::string& id = "");
bool isDeployable() const;
const std::string getName() const;
const std::string& getPath() const;
const std::string& getId() const;
std::string getTypeId() const;
VCProjectSubType getSubType() const;
const VCProjectSet& getSharedProjects() const;
const VCProjectSet& getProjectReferences() const;
const ConditionalValueListMap& getGlobalProperties() const;
const ConditionalValueListMap& getUserMacros() const;
const void getPlatforms(StringSet& ret) const;
bool write() const;
virtual void addGlobalProperty(const std::string& name, const std::string& value, const std::string& condition = "");
virtual void addUserMacro(const std::string& name, const std::string& value, const std::string& condition = "");
virtual void addProjectReference(const VCProject* refProj);
virtual void addSharedProject(const VCProject* sharedProj);
virtual VCProjectConfiguration* addConfiguration(const std::string& name);
virtual VCProjectItem* addItem(const std::string& itemName, const std::string& itemPath, const std::string& filterPath = "");
virtual void addBuildExtension(const std::string& extension);
protected:
typedef std::map<std::string, VCProjectConfiguration*> ConfigurationMap;
typedef std::vector<VCProjectItem*> ItemList;
typedef void (VCProject::*LabelHandlerFn)(pugi::xml_node& node) const;
typedef std::map<std::string, LabelHandlerFn> LabelHandlerFnMap;
bool writeTemplate(const std::string& filePath, const LabelHandlerFnMap& handlers) const;
virtual bool writeFilters() const;
virtual bool writeProject() const;
void writeProjectConfigSummary(pugi::xml_node& node) const;
void writeGlobalProperties(pugi::xml_node& node) const;
void writeConfigurationProperties(pugi::xml_node& node) const;
void writeBuildExtensionProperties(pugi::xml_node& node) const;
void writeBuildExtensionTargets(pugi::xml_node& node) const;
void writeSharedProjects(pugi::xml_node& node) const;
void writeConfigurationPropertySheets(pugi::xml_node& node) const;
void writeUserMacros(pugi::xml_node& node) const;
void writeConfigurationItemDefinitions(pugi::xml_node& node) const;
void writeProjectItems(pugi::xml_node& node) const;
void writeProjectReferences(pugi::xml_node& node) const;
void writeFilterItemDescriptions(pugi::xml_node& node) const;
void writeFilterDescriptions(pugi::xml_node& node) const;
VSTemplateProject* m_template;
VCProjectSubType m_subType;
std::string m_id;
VCProjectSet m_projectRefs;
VCProjectSet m_sharedProjects;
ConditionalValueListMap m_globalProps;
ConditionalValueListMap m_userMacros;
StringVec m_buildExtensions;
ConfigurationMap m_configurations;
ItemList m_items;
}; |
// Copyright (c) 2012-2013 The PPCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef PPCOIN_KERNEL_H
#define PPCOIN_KERNEL_H
#include "main.h"
#include "wallet.h"
// MODIFIER_INTERVAL_RATIO:
// ratio of group interval length between the last group and the first group
static const int MODIFIER_INTERVAL_RATIO = 3;
unsigned int GetModiferInterval();
// Compute the hash modifier for proof-of-stake
bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64_t& nStakeModifier, bool& fGeneratedStakeModifier);
// The stake modifier used to hash for a stake kernel is chosen as the stake
// modifier about a selection interval later than the coin generating the kernel
bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier);
// Check whether stake kernel meets hash target
// Sets hashProofOfStake on success return
bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned int nTxPrevOffset, const CTransaction& txPrev, const COutPoint& prevout, unsigned int nTimeTx, uint256& hashProofOfStake, uint256& targetProofOfStake, bool fPrintProofOfStake=false);
// Coins scanning options
typedef struct KernelSearchSettings {
unsigned int nBits; // Packed difficulty
unsigned int nTime; // Basic time
unsigned int nOffset; // Offset inside CoinsSet (isn't used yet)
unsigned int nLimit; // Coins to scan (isn't used yet)
unsigned int nSearchInterval; // Number of seconds allowed to go into the past
} KernelSearchSettings;
typedef std::set<std::pair<const CWalletTx*,unsigned int> > CoinsSet;
// Preloaded coins metadata
// (txid, vout.n) => ((txindex, (tx, vout.n)), (block, modifier))
typedef std::map<std::pair<uint256, unsigned int>, std::pair<std::pair<CTxIndex, std::pair<const CWalletTx*,unsigned int> >, std::pair<CBlock, uint64_t> > > MetaMap;
// Scan given coins set for kernel solution
bool ScanForStakeKernelHash(MetaMap &mapMeta, KernelSearchSettings &settings, CoinsSet::value_type &kernelcoin, unsigned int &nTimeTx, unsigned int &nBlockTime, CWallet* pwallet);
// Check kernel hash target and coinstake signature
// Sets hashProofOfStake on success return
bool CheckProofOfStake(const CTransaction& tx, unsigned int nBits, uint256& hashProofOfStake, uint256& targetProofOfStake);
// Check whether the coinstake timestamp meets protocol
bool CheckCoinStakeTimestamp(int64_t nTimeBlock, int64_t nTimeTx);
// Get stake modifier checksum
unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex, bool fLoad=false);
// Check stake modifier hard checkpoints
bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum);
// Get time weight using supplied timestamps
int64_t GetWeight(int64_t nIntervalBeginning, int64_t nIntervalEnd);
#endif // PPCOIN_KERNEL_H
|
//
// XIFileHelper.h
// 微信
//
// Created by tom on 11/6/13.
// Copyright (c) 2013 Reese. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface XIFileHelper : NSObject
+(NSURL *) getSpeechDirectory;
+(NSURL *) getImageDirectory;
+(NSURL *) getDocumentDirectory;
+(NSURL *) getSpeechDirectoryTmpFile;
+(NSURL *) getSpeechDirectoryFile:(NSString*)fileName;
+(void) renameSpeechDirectoryFile:(NSString*) sourceFileName to:(NSString*) destFileName;
@end
|
#include <burger.h>
extern Byte BombFlag;
/********************************
A Non-FATAL error has occured, save message, but if the
BombFlag is set, then die anyways.
********************************/
void NonFatal(char *Message)
{
if (Message) { /* No message, no error! */
ErrorMsg = Message; /* Save the message */
if (BombFlag) { /* Bomb on ANY Error? */
Fatal(Message); /* Force a fatal error */
}
}
}
|
#include <tommath.h>
#ifdef BN_MP_TORADIX_N_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
*/
/* stores a bignum as a ASCII string in a given radix (2..64)
*
* Stores upto maxlen-1 chars and always a NULL byte
*/
int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen)
{
int res, digs;
mp_int t;
mp_digit d;
char *_s = str;
/* check range of the maxlen, radix */
if (maxlen < 2 || radix < 2 || radix > 64) {
return MP_VAL;
}
/* quick out if its zero */
if (mp_iszero(a) == MP_YES) {
*str++ = '0';
*str = '\0';
return MP_OKAY;
}
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
/* if it is negative output a - */
if (t.sign == MP_NEG) {
/* we have to reverse our digits later... but not the - sign!! */
++_s;
/* store the flag and mark the number as positive */
*str++ = '-';
t.sign = MP_ZPOS;
/* subtract a char */
--maxlen;
}
digs = 0;
while (mp_iszero (&t) == 0) {
if (--maxlen < 1) {
/* no more room */
break;
}
if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {
mp_clear (&t);
return res;
}
*str++ = mp_s_rmap[d];
++digs;
}
/* reverse the digits of the string. In this case _s points
* to the first digit [exluding the sign] of the number
*/
bn_reverse ((unsigned char *)_s, digs);
/* append a NULL so the string is properly terminated */
*str = '\0';
mp_clear (&t);
return MP_OKAY;
}
#endif
/* $Source: /cvsroot/tcl/libtommath/bn_mp_toradix_n.c,v $ */
/* $Revision: 1.1.1.4 $ */
/* $Date: 2006/12/01 00:08:11 $ */
|
//
// FLStructFlagsProperty.h
// FishLampFrameworks
//
// Created by Mike Fullerton on 9/2/12.
// Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton..
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
//
#import "FLCoreRequired.h"
#define FLSynthesizeStructGetterProperty(GET_NAME, __TYPE__, STRUCT) \
- (__TYPE__) GET_NAME { return (__TYPE__) STRUCT.GET_NAME; }
#define FLSynthesizeStructProperty(GET_NAME, SET_NAME, __TYPE__, STRUCT) \
- (__TYPE__) GET_NAME { return (__TYPE__) STRUCT.GET_NAME; } \
- (void) SET_NAME:(__TYPE__) inValue { STRUCT.GET_NAME = (__TYPE__) inValue; }
|
//
// PMCalendarView.h
// PMCalendar
//
// Created by Pavel Mazurin on 7/13/12.
// Copyright (c) 2012 Pavel Mazurin. All rights reserved.
//
#import <UIKit/UIKit.h>
@class PMPeriod;
@protocol PMCalendarViewDelegate;
/**
* PMCalendarView is an internal class.
*
* PMCalendarView is a view which manages user's interactions - tap, pan and long press.
* It also renders text (month, weekdays titles, days).
*/
@interface PMCalendarView : UIView <UIGestureRecognizerDelegate>
/**
* Selected period. See PMCalendarController for more information.
*/
@property (nonatomic, strong) PMPeriod *period;
/**
* Period allowed for selection. See PMCalendarController for more information.
*/
@property (nonatomic, strong) PMPeriod *allowedPeriod;
/**
*Set to only display current month's days
*/
@property(nonatomic, assign) BOOL showOnlyCurrentMonth;
/**
* Is monday a first day of week. See PMCalendarController for more information.
*/
@property (nonatomic, assign) BOOL mondayFirstDayOfWeek;
/**
* Is period selection allowed. See PMCalendarController for more information.
*/
@property (nonatomic, assign) BOOL allowsPeriodSelection;
/**
* Is long press allowed. See PMCalendarController for more information.
*/
@property (nonatomic, assign) BOOL allowsLongPressMonthChange;
@property (nonatomic, assign) id<PMCalendarViewDelegate> delegate;
@property (nonatomic, strong) NSDate *currentDate;
- (void)setDisplayCurrentMonthOnly;
@end
@protocol PMCalendarViewDelegate <NSObject>
/**
* Called on the delegate when user changes showed month.
*/
- (void) currentDateChanged: (NSDate *)currentDate;
/**
* Called on the delegate when user changes selected period.
*/
- (void) periodChanged: (PMPeriod *)newPeriod;
@end
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* 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
*/
/*
* NAME
* shmat03.c
*
* DESCRIPTION
* shmat03 - test for EACCES error
*
* ALGORITHM
* create a shared memory segment with root only read & write permissions
* fork a child process
* if child
* set the ID of the child process to that of "nobody"
* loop if that option was specified
* call shmat() using the TEST() macro
* check the errno value
* issue a PASS message if we get EACCES
* otherwise, the tests fails
* issue a FAIL message
* call cleanup
* if parent
* wait for child to exit
* remove the shared memory segment
*
* USAGE: <for command-line>
* shmat03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -e : Turn on errno logging.
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
* HISTORY
* 03/2001 - Written by Wayne Boyer
*
* RESTRICTIONS
* test must be run at root
*/
#include "ipcshm.h"
char *TCID = "shmat03";
int TST_TOTAL = 1;
extern int Tst_count;
int exp_enos[] = {EACCES, 0}; /* 0 terminated list of expected errnos */
int shm_id_1 = -1;
void *addr; /* for result of shmat-call */
uid_t ltp_uid;
char *ltp_user = "nobody";
int main(int ac, char **av)
{
char *msg; /* message returned from parse_opts */
int pid;
void do_child(void);
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
}
setup(); /* global setup */
if ((pid = FORK_OR_VFORK()) == -1) {
tst_brkm(TBROK, cleanup, "could not fork");
}
if (pid == 0) { /* child */
/* set the user ID of the child to the non root user */
if (setuid(ltp_uid) == -1) {
tst_resm(TBROK, "setuid() failed");
exit(1);
}
do_child();
} else { /* parent */
/* wait for the child to return */
if (waitpid(pid, NULL, 0) == -1) {
tst_brkm(TBROK, cleanup, "waitpid failed");
}
/* if it exists, remove the shared memory resource */
rm_shm(shm_id_1);
/* Remove the temporary directory */
tst_rmdir();
}
cleanup();
return(0);
}
/*
* do_child - make the TEST call as the child process
*/
void
do_child(void)
{
int lc;
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
/*
* use TEST macro to make the call
*/
errno = 0;
addr = shmat(shm_id_1, (const void *)0, 0);
TEST_ERRNO = errno;
if (addr != (char *)-1) {
tst_resm(TFAIL, "call succeeded when error expected");
continue;
}
TEST_ERROR_LOG(TEST_ERRNO);
switch(TEST_ERRNO) {
case EACCES:
tst_resm(TPASS, "expected failure - errno = "
"%d : %s", TEST_ERRNO,
strerror(TEST_ERRNO));
break;
default:
tst_resm(TFAIL, "call failed with an "
"unexpected error - %d : %s",
TEST_ERRNO, strerror(TEST_ERRNO));
break;
}
}
}
/*
* setup() - performs all the ONE TIME setup for this test.
*/
void
setup(void)
{
/* check for root as process owner */
check_root();
/* capture signals */
tst_sig(FORK, DEF_HANDLER, cleanup);
/* Set up the expected error numbers for -e option */
TEST_EXP_ENOS(exp_enos);
/* Pause if that option was specified */
TEST_PAUSE;
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
* See ../lib/libipc.c for more information.
*/
tst_tmpdir();
/* get an IPC resource key */
shmkey = getipckey();
/* create a shared memory segment with read and write permissions */
if ((shm_id_1 = shmget(shmkey, SHM_SIZE,
SHM_RW | IPC_CREAT | IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "Failed to create shared memory "
"segment in setup");
}
/* get the userid for a non root user */
ltp_uid = getuserid(ltp_user);
}
/*
* cleanup() - performs all the ONE TIME cleanup for this test at completion
* or premature exit.
*/
void
cleanup(void)
{
/*
* print timing stats if that option was specified.
* print errno log if that option was specified.
*/
TEST_CLEANUP;
/* exit with return code appropriate for results */
tst_exit();
}
|
#import <Foundation/Foundation.h>
@interface NSCharacterSet (WMFLinkParsing)
+ (NSCharacterSet *)wmf_URLArticleTitlePathComponentAllowedCharacterSet;
@end
|
/* $OpenBSD: buffer.h,v 1.14 2014/10/16 03:19:02 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_BUFFER_H
#define HEADER_BUFFER_H
#if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__OpenBSD__)
#define __bounded__(x, y, z)
#endif
#include <ARDroneSDK_Unix/include/openssl/ossl_typ.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <sys/types.h>
/* Already declared in ossl_typ.h */
/* typedef struct buf_mem_st BUF_MEM; */
struct buf_mem_st {
size_t length; /* current number of bytes */
char *data;
size_t max; /* size of buffer */
};
BUF_MEM *BUF_MEM_new(void);
void BUF_MEM_free(BUF_MEM *a);
int BUF_MEM_grow(BUF_MEM *str, size_t len);
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
#ifndef LIBRESSL_INTERNAL
char * BUF_strdup(const char *str);
char * BUF_strndup(const char *str, size_t siz);
void * BUF_memdup(const void *data, size_t siz);
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
/* safe string functions */
size_t BUF_strlcpy(char *dst, const char *src, size_t siz)
__attribute__ ((__bounded__(__string__,1,3)));
size_t BUF_strlcat(char *dst, const char *src, size_t siz)
__attribute__ ((__bounded__(__string__,1,3)));
#endif
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
void ERR_load_BUF_strings(void);
/* Error codes for the BUF functions. */
/* Function codes. */
#define BUF_F_BUF_MEMDUP 103
#define BUF_F_BUF_MEM_GROW 100
#define BUF_F_BUF_MEM_GROW_CLEAN 105
#define BUF_F_BUF_MEM_NEW 101
#define BUF_F_BUF_STRDUP 102
#define BUF_F_BUF_STRNDUP 104
/* Reason codes. */
#ifdef __cplusplus
}
#endif
#endif
|
/****************************************************************************
*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2017 by Inria. All rights reserved.
*
* This software 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.
* See the file LICENSE.txt at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using ViSP with software that can not be combined with the GNU
* GPL, please contact Inria about acquiring a ViSP Professional
* Edition License.
*
* See http://visp.inria.fr for more information.
*
* This software was developed at:
* Inria Rennes - Bretagne Atlantique
* Campus Universitaire de Beaulieu
* 35042 Rennes Cedex
* France
*
* If you have questions regarding the use of this file, please contact
* Inria at visp@inria.fr
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Description:
* Save data during the task execution.
*
* Authors:
* Eric Marchand
*
*****************************************************************************/
#ifndef vpServoData_H
#define vpServoData_H
/*!
\file vpServoData.h
\brief save data during the task execution
*/
// Servo
#include <visp3/vs/vpServo.h>
#include <iostream>
/*!
\class vpServoData
\ingroup group_task
\brief Save data during the task execution.
*/
class VISP_EXPORT vpServoData
{
private:
char baseDirectory[FILENAME_MAX];
std::ofstream velocityFile;
std::ofstream errorFile;
std::ofstream errorNormFile;
std::ofstream sFile;
std::ofstream sStarFile;
std::ofstream vNormFile;
//! flag to known if velocity should be output in cm and degrees (true)
//! or in m/rad
bool cmDeg;
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
vpServoData(const vpServoData &sd)
: velocityFile(), errorFile(), errorNormFile(), sFile(), sStarFile(), vNormFile(), cmDeg(false)
{
*this = sd;
}
vpServoData &operator=(const vpServoData &)
{
throw vpException(vpException::functionNotImplementedError, "Not implemented!");
}
#endif
vpServoData() : velocityFile(), errorFile(), errorNormFile(), sFile(), sStarFile(), vNormFile(), cmDeg(false) { ; }
virtual ~vpServoData() { ; }
//! velocity output in cm and deg
void setCmDeg();
//! velocity output in meter and deg (default)
void setMeterRad();
void save(const vpServo &task);
void open(const char *baseDirectory);
void close();
void empty();
void push();
void display(vpImage<unsigned char> &I);
};
#endif
/*
* Local variables:
* c-basic-offset: 2
* End:
*/
|
/* Mednafen - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* 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 _DRIVERS_MAIN_H
#define _DRIVERS_MAIN_H
#include "../driver.h"
#include "../mednafen.h"
#include "../settings.h"
#include "../endian.h"
#include "../memory.h"
#include "config.h"
#include "args.h"
#include <SDL.h>
#include <SDL_thread.h>
#include "../gettext.h"
#ifndef _
#define _(String) gettext(String)
#endif
#define CEVT_TOGGLEGUI 1
#define CEVT_TOGGLEFS 2
#define CEVT_PRINTERROR 3
#define CEVT_PRINTMESSAGE 4
#define CEVT_VIDEOSYNC 5
#define CEVT_SHOWCURSOR 0x0c
#define CEVT_CHEATTOGGLEVIEW 0x10
#define CEVT_DISP_MESSAGE 0x11
#define CEVT_SET_GRAB_INPUT 0x20
#define CEVT_SET_STATE_STATUS 0x40
#define CEVT_SET_MOVIE_STATUS 0x41
#define CEVT_WANT_EXIT 0x80 // Emulator exit or GUI exit or bust!
#define CEVT_NP_TEXT_TO_SERVER 0x100
#define CEVT_NP_DISPLAY_TEXT 0x101
#define CEVT_NP_TOGGLE_VIEWABLE 0x102
#define CEVT_NP_TOGGLE_TT 0x103
#define CEVT_NP_CONNECT 0x104
#define CEVT_NP_SETNICK 0x105
#define CEVT_NP_AUTHOR 0x106
bool GetInFrameAdvance(void);
static bool InFrameAdvance = 0;
static bool NeedFrameAdvance = 0;
static bool NeedFPSFrameAdvance;
bool GetNeedFPSFrameAdvance(void);
int GetFrameAdvanceActive(void);
void SetNeedFrameAdvance(int setting);
void SetFPSNeedFrameAdvance(bool setting);
void SendCEvent(unsigned int code, void *data1, void *data2);
void PauseGameLoop(bool p);
bool GetNeedFrameAdvance(void);
void DoPause(void);
void SDL_MDFN_ShowCursor(int toggle);
extern int NoWaiting;
extern MDFNGI *CurGame;
int CloseGame(void);
void RefreshThrottleFPS(int);
void PumpWrap(void);
void SetJoyReadMode(int mode);
void MainSetEventHook(int (*eh)(const SDL_Event *event));
int LoadGame(const char *path);
void MainRequestExit(void);
extern bool pending_save_state, pending_snapshot, pending_save_movie;
void DoRunNormal(void);
void DoFrameAdvance(void);
int SetFrameAdvanceActive(int value);
void LockGameMutex(bool lock);
void DebuggerFudge(void);
extern volatile int GameThreadRun;
extern int sdlhaveogl;
bool MT_FromRemote_VideoSync(void);
bool MT_FromRemote_SoundSync(void);
#endif
|
/*
* Copyright (C) 2015-2017 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this Program; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "input/keyboard/IKeyboardHandler.h"
struct KodiToAddonFuncTable_Game;
namespace GAME
{
class CGameClient;
/*!
* \ingroup games
* \brief Handles keyboard events for games.
*
* Listens to keyboard events and forwards them to the games (as game_input_event).
*/
class CGameClientKeyboard : public KODI::KEYBOARD::IKeyboardHandler
{
public:
/*!
* \brief Constructor registers for keyboard events at CInputManager.
* \param gameClient The game client implementation.
* \param dllStruct The emulator or game to which the events are sent.
*/
CGameClientKeyboard(const CGameClient* gameClient, const KodiToAddonFuncTable_Game* dllStruct);
/*!
* \brief Destructor unregisters from keyboard events from CInputManager.
*/
~CGameClientKeyboard();
// implementation of IKeyboardHandler
virtual bool OnKeyPress(const CKey& key) override;
virtual void OnKeyRelease(const CKey& key) override;
private:
// Construction parameters
const CGameClient* const m_gameClient;
const KodiToAddonFuncTable_Game* const m_dllStruct;
};
}
|
/*
* Copyright (C) 2011 by Nelson Elhage
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "x86_common.h"
#define ARCH_HAVE_MULTIPLE_PERSONALITIES
static struct ptrace_personality arch_personality[2] = {
{
offsetof(struct user, regs.rax),
offsetof(struct user, regs.rdi),
offsetof(struct user, regs.rsi),
offsetof(struct user, regs.rdx),
offsetof(struct user, regs.r10),
offsetof(struct user, regs.r8),
offsetof(struct user, regs.r9),
offsetof(struct user, regs.rip),
},
{
offsetof(struct user, regs.rax),
offsetof(struct user, regs.rbx),
offsetof(struct user, regs.rcx),
offsetof(struct user, regs.rdx),
offsetof(struct user, regs.rsi),
offsetof(struct user, regs.rdi),
offsetof(struct user, regs.rbp),
offsetof(struct user, regs.rip),
},
};
struct x86_personality x86_personality[2] = {
{
offsetof(struct user, regs.orig_rax),
offsetof(struct user, regs.rax),
},
{
offsetof(struct user, regs.orig_rax),
offsetof(struct user, regs.rax),
},
};
struct syscall_numbers arch_syscall_numbers[2] = {
#include "default-syscalls.h"
{
/*
* These don't seem to be available in any convenient header. We could
* include unistd_32.h, but those definitions would conflict with the
* standard ones. So, let's just hardcode the values for now. Probably
* we should generate this from unistd_32.h during the build process or
* soemthing.
*/
.nr_mmap = 90,
.nr_mmap2 = 192,
.nr_munmap = 91,
.nr_getsid = 147,
.nr_setsid = 66,
.nr_setpgid = 57,
.nr_fork = 2,
.nr_wait4 = 114,
.nr_signal = 48,
.nr_rt_sigaction = 173,
.nr_open = 5,
.nr_close = 6,
.nr_ioctl = 54,
.nr_dup2 = 63,
.nr_dup = 41
}
};
int arch_get_personality(struct ptrace_child *child) {
unsigned long cs;
cs = ptrace_command(child, PTRACE_PEEKUSER,
offsetof(struct user, regs.cs));
if (child->error)
return -1;
if (cs == 0x23)
child->personality = 1;
return 0;
}
|
/**
* Copyright (c) 2013 Anup Patel.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* @file virtio_console.h
* @author Anup Patel (anup@brainfault.org)
* @brief Header file for Virtio Console serial port driver.
*/
#ifndef __VIRTIO_CONSOLE_H_
#define __VIRTIO_CONSOLE_H_
#include <arm_types.h>
/* VirtIO MMIO */
#define VIRTIO_MMIO_DEVICE_ID 0x008
#define VIRTIO_MMIO_HOST_FEATURES 0x010
#define VIRTIO_MMIO_CONFIG 0x100
/* VirtIO Console */
#define VIRTIO_ID_CONSOLE 3
/* VirtIO Console Feature bits */
#define VIRTIO_CONSOLE_F_SIZE 0
#define VIRTIO_CONSOLE_F_MULTIPORT 1
#define VIRTIO_CONSOLE_F_EMERG_WRITE 2
struct virtio_console_config {
/* colums of the screens */
u16 cols;
/* rows of the screens */
u16 rows;
/* max. number of ports this device can hold */
u32 max_nr_ports;
/* emergency write register */
u32 emerg_wr;
} __attribute__((packed));
void virtio_console_printch(physical_addr_t base, char ch);
char virtio_console_getch(physical_addr_t base);
int virtio_console_init(physical_addr_t base);
#endif /* __VIRTIO_CONSOLE_H_ */
|
/*
TUIO C++ Library - part of the reacTIVision project
http://reactivision.sourceforge.net/
Copyright (c) 2005-2009 Martin Kaltenbrunner <martin@tuio.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef INCLUDED_UDPRECEIVER_H
#define INCLUDED_UDPRECEIVER_H
#include "OscReceiver.h"
#include "ip/UdpSocket.h"
namespace TUIO {
/**
* The UdpReceiver provides the OscReceiver finctionality for the UDP transport method
*
* @author Martin Kaltenbrunner
* @version 1.5
*/
class LIBDECL UdpReceiver: public OscReceiver {
public:
/**
* The UDP socket is only public to be accessible from the thread function
*/
UdpListeningReceiveSocket *socket;
/**
* This constructor creates a UdpReceiver instance listening to the provided UDP port
*
* @param port the number of the UDP port to listen to, defaults to 3333
*/
UdpReceiver (int port=3333);
/**
* The destructor is doing nothing in particular.
*/
virtual ~UdpReceiver();
/**
* The UdpReceiver connects and starts receiving TUIO messages via UDP
*
* @param lock running in the background if set to false (default)
*/
void connect(bool lock=false);
/**
* The UdpReceiver disconnects and stops receiving TUIO messages via UDP
*/
void disconnect();
private:
#ifndef WIN32
pthread_t thread;
#else
HANDLE thread;
#endif
bool locked;
};
};
#endif /* INCLUDED_UDPRECEIVER_H */
|
/*
*
* This file is part of the FFTlib library. This library is free
* software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software
* Foundation; version 2 of the License.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation; 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
*
* $Id: gifft_greater_32_real.c,v 1.1 1999/05/06 14:09:56 decoster Exp $
*
*/
# include <math.h>
# include <gfft.h>
void
gifft_greater_32_real(complex *in, real *out, int size,int log2n)
{
int i;
register int half_size;
int quater_size;
register real even_real, even_imag;
register real odd_real, odd_imag;
register real angle_incr,angle;
register real cosinus, sinus;
register real next_cosinus,next_sinus;
register real cosinus_incr,sinus_incr;
register real scale;
register real tmp;
register complex *c_out = (complex *)out;
angle_incr = angle = 2 * M_PI / size;
cosinus_incr = cos(angle);
sinus_incr = sin(angle);
cosinus = cosinus_incr;
sinus = sinus_incr;
half_size = size >> 1;
quater_size = size >> 2;
scale = 1.0 / (real)size;
for(i = 1; i <= quater_size ; i++)
{
even_real = in[i].real + in[half_size - i].real;
even_imag = in[i].imag - in[half_size - i].imag;
odd_real = in[i].real - in[half_size - i].real;
odd_imag = in[i].imag + in[half_size - i].imag;
tmp = odd_imag * sinus - odd_real * cosinus;
odd_real = odd_real * sinus + odd_imag * cosinus;
odd_imag = tmp;
c_out[i].real = scale * (even_real - odd_real);
c_out[i].imag = scale * (even_imag - odd_imag);
c_out[half_size - i].real = scale * (even_real + odd_real);
c_out[half_size - i].imag = scale * (-odd_imag - even_imag);
next_cosinus = cosinus * cosinus_incr - sinus * sinus_incr;
next_sinus = sinus * cosinus_incr + cosinus * sinus_incr;
cosinus = next_cosinus;
sinus = next_sinus;
}
even_real = scale * (in[0].real + in[0].imag);
c_out[0].imag = scale *(in[0].real - in[0].imag);
c_out[0].real = even_real;
gifft_greater_16_cplx_for_real(c_out,half_size,log2n-1);
gfft_shuffle(c_out,half_size,log2n-1);
}
|
#pragma once
#include "RoutingLump.h"
#include <string>
#include "iarchive.h"
namespace routing
{
class RoutingLumpLoader
{
private:
// the loaded routing data
routing::RoutingLump _routingLump;
void loadRoutingLump (ArchiveFile& file);
public:
RoutingLumpLoader ();
// loads the routing lump for the given bsp file
void loadRouting(const std::string& bspFileName);
virtual ~RoutingLumpLoader ();
// returns the loaded routing lump
routing::RoutingLump& getRoutingLump ();
};
}
|
/***************************************************************************
* Copyright (C) 2003 by Sébastien Laoût *
* slaout@linux62.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef NEWBASKETDIALOG_H
#define NEWBASKETDIALOG_H
#include <KDE/KDialog>
#include <QtCore/QMap>
#include <QtGui/QListWidget>
class KIconButton;
class KLineEdit;
class QMimeData;
class KComboBox;
class QTreeWidgetItem;
class BasketScene;
class KColorCombo2;
/** The class QListWidget allow to drag items. We don't want to, so we disable it.
* This class also unselect the selected item when the user right click an empty space. We don't want to, so we reselect it if that happens.
* @author Sébastien Laoût
*/
class SingleSelectionKIconView : public QListWidget
{
Q_OBJECT
public:
SingleSelectionKIconView(QWidget *parent = 0);
QMimeData* dragObject();
QListWidgetItem* selectedItem() {
return m_lastSelected;
}
private slots:
void slotSelectionChanged(QListWidgetItem *cur);
private:
QListWidgetItem *m_lastSelected;
};
/** Struct to store default properties of a new basket.
* When the dialog shows up, the @p icon is used, as well as the @p backgroundColor.
* A template is chozen depending on @p freeLayout and @p columnLayout.
* If @p columnLayout is too high, the template with the more columns will be chosen instead.
* If the user change the background color in the dialog, then @p backgroundImage and @p textColor will not be used!
* @author Sébastien Laoût
*/
struct NewBasketDefaultProperties {
QString icon;
QString backgroundImage;
QColor backgroundColor;
QColor textColor;
bool freeLayout;
int columnCount;
NewBasketDefaultProperties();
};
/** The dialog to create a new basket from a template.
* @author Sébastien Laoût
*/
class NewBasketDialog : public KDialog
{
Q_OBJECT
public:
NewBasketDialog(BasketScene *parentBasket, const NewBasketDefaultProperties &defaultProperties, QWidget *parent = 0);
~NewBasketDialog();
void ensurePolished();
protected slots:
void slotOk();
void returnPressed();
void manageTemplates();
void nameChanged(const QString &newName);
private:
int populateBasketsList(QTreeWidgetItem *item, int indent, int index);
NewBasketDefaultProperties m_defaultProperties;
KIconButton *m_icon;
KLineEdit *m_name;
KColorCombo2 *m_backgroundColor;
QListWidget *m_templates;
KComboBox *m_createIn;
QMap<int, BasketScene*> m_basketsMap;
};
#endif // NEWBASKETDIALOG_H
|
/* linux/arch/arm/mach-msm/board-marvel.h
* Copyright (C) 2009 HTC Corporation.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __ARCH_ARM_MACH_MSM_BOARD_MARVEL_H
#define __ARCH_ARM_MACH_MSM_BOARD_MARVEL_H
#include <mach/board.h>
#define MSM_MEM_BASE 0x10000000
#define MSM_MEM_SIZE 0x20000000
#define MSM_LINUX_BASE_OFFSET 0x02C00000
#define MSM_MM_HEAP_SIZE 0x02800000
#define MSM_LINUX_BASE (MSM_MEM_BASE + MSM_LINUX_BASE_OFFSET) /* 2MB alignment */
#define MSM_LINUX_SIZE (MSM_MEM_SIZE - MSM_LINUX_BASE_OFFSET - MSM_MM_HEAP_SIZE)
#define MSM_FB_BASE (MSM_MEM_BASE + 0x02A00000)
#define MSM_FB_SIZE 0x00200000
#define MSM_GPU_MEM_BASE (MSM_MEM_BASE + MSM_MEM_SIZE - MSM_MM_HEAP_SIZE)
#define MSM_GPU_MEM_SIZE 0x00500000
#define MSM_PMEM_MDP_BASE MSM_GPU_MEM_BASE + MSM_GPU_MEM_SIZE
#define MSM_PMEM_MDP_SIZE 0x01000000
#define MSM_PMEM_ADSP_BASE MSM_PMEM_MDP_BASE + MSM_PMEM_MDP_SIZE
#define MSM_PMEM_ADSP_SIZE 0x0121B000
/* TODO: To save space, we can move RAM_CONSOLE to 0x00000000 */
#define MSM_RAM_CONSOLE_BASE MSM_PMEM_ADSP_BASE + MSM_PMEM_ADSP_SIZE
#define MSM_RAM_CONSOLE_SIZE 128 * SZ_1K
#define MARVEL_GPIO_TO_INT(x) (x+64) /* from gpio_to_irq */
#define MARVEL_GPIO_USB_ID_PIN (19)
#define MARVEL_POWER_KEY (20)
#define MARVEL_GPIO_MSM_PS_HOLD (25)
#define MARVEL_GPIO_WIFI_IRQ (29)
#define MARVEL_GPIO_RESET_BTN_N (36)
#define MARVEL_GPIO_SDMC_CD_N (38)
#define MARVEL_GPIO_UP_INT_N (39)
#define MARVEL_GPIO_CHG_INT (40)
#define MARVEL_GPIO_VOL_DOWN (49)
/* WLAN SD data */
#define MARVEL_GPIO_SD_D3 (51)
#define MARVEL_GPIO_SD_D2 (52)
#define MARVEL_GPIO_SD_D1 (53)
#define MARVEL_GPIO_SD_D0 (54)
#define MARVEL_GPIO_SD_CMD (55)
#define MARVEL_GPIO_SD_CLK_0 (56)
/* I2C */
#define MARVEL_GPIO_I2C_SCL (60)
#define MARVEL_GPIO_I2C_SDA (61)
/* MicroSD */
#define MARVEL_GPIO_SDMC_CLK_1 (62)
#define MARVEL_GPIO_SDMC_CMD (63)
#define MARVEL_GPIO_SDMC_D3 (64)
#define MARVEL_GPIO_SDMC_D2 (65)
#define MARVEL_GPIO_SDMC_D1 (66)
#define MARVEL_GPIO_SDMC_D0 (67)
/* BT PCM */
#define MARVEL_GPIO_AUD_PCM_DO (68)
#define MARVEL_GPIO_AUD_PCM_DI (69)
#define MARVEL_GPIO_AUD_PCM_SYNC (70)
#define MARVEL_GPIO_AUD_PCM_CLK (71)
#define MARVEL_GPIO_UP_RESET_N (76)
#define MARVEL_GPIO_FLASHLIGHT (85)
#define MARVEL_GPIO_UART3_RX (86)
#define MARVEL_GPIO_UART3_TX (87)
#define MARVEL_GPIO_VOL_UP (92)
#define MARVEL_GPIO_LS_EN (93)
#define MARVEL_GPIO_WIFI_EN (108)
#define MARVEL_GPIO_V_USBPHY_3V3_EN (109)
#define MARVEL_GPIO_VIBRATOR_ON (116)
/* Compass */
#define MARVEL_GPIO_COMPASS_RDY (37)
#define MARVEL_LAYOUTS { \
{ { 0, -1, 0}, { -1, 0, 0}, {0, 0, -1} }, \
{ { 0, -1, 0}, { -1, 0, 0}, {0, 0, 1} }, \
{ { -1, 0, 0}, { 0, 1, 0}, {0, 0, -1} }, \
{ { 1, 0, 0}, { 0, 0, 1}, {0, 1, 0} } \
}
/* Proximity */
#define MARVEL_GPIO_PROXIMITY_INT (21)
#define MARVEL_GPIO_PROXIMITY_EN (119)
/* BT */
#define MARVEL_GPIO_BT_UART1_RTS (43)
#define MARVEL_GPIO_BT_UART1_CTS (44)
#define MARVEL_GPIO_BT_UART1_RX (45)
#define MARVEL_GPIO_BT_UART1_TX (46)
#define MARVEL_GPIO_BT_RESET_N (90)
#define MARVEL_GPIO_BT_HOST_WAKE (112)
#define MARVEL_GPIO_BT_CHIP_WAKE (122)
#define MARVEL_GPIO_BT_SD_N (123)
/* Touch Panel */
#define MARVEL_GPIO_TP_ATT_N (18)
#define MARVEL_V_TP_3V3_EN (31)
#define MARVEL_LCD_RSTz (118)
#define MARVEL_GPIO_TP_RST_N (120)
/* 35mm headset */
#define MARVEL_GPIO_35MM_HEADSET_DET (83)
/*Camera AF VCM POWER*/
#define MARVEL_GPIO_VCM_PD (126)
#define MARVEL_GPIO_CAM_RST_N (125)
/*Display*/
#define MARVEL_GPIO_LCD_ID0 (34)
#define MARVEL_GPIO_LCD_ID1 (35)
#define MARVEL_GPIO_MDDI_TE (97)
#define MARVEL_GPIO_LCD_RST_N (118)
int __init marvel_init_keypad(void);
int marvel_init_mmc(unsigned int sys_rev);
int __init marvel_init_panel(void);
int __init marvel_wifi_init(void);
#endif /* GUARD */
|
/*
An API for the logicdevice
Copyright (C) 2006 Benedikt Sauter <sauter@ixbat.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <usb.h>
#define MODE_NONE 0x00
#define MODE_COUNTER 0x01
#define MODE_LOGIC 0x02
#define MODE_1CHANNELAD 0x03
#define MODE_LOGICINTERN 0x04
#define TRIGGER_OFF 0x01
#define TRIGGER_EDGE 0x02
#define TRIGGER_PATTERN 0x03
#define STATE_DONOTHING 0x01
#define STATE_RUNNING 0x02
#define STATE_TRIGGER 0x03
#define SAMPLERATE_5US 0x01
#define SAMPLERATE_10US 0x02
#define SAMPLERATE_50US 0x03
#define SAMPLERATE_100US 0x04
#define SAMPLERATE_1MS 0x05
#define SAMPLERATE_10MS 0x06
#define SAMPLERATE_100MS 0x07
#define CMD_SETMODE 0x01
#define CMD_STARTSCOPE 0x02
#define CMD_STOPSCOPE 0x03
#define CMD_GETSCOPEMODE 0x04
#define CMD_GETSCOPESTATE 0x05
#define CMD_GETFIFOLOAD 0x06
#define CMD_SETSAMPLERATE 0x07
#define CMD_GETDATA 0x08
#define CMD_SETEDGETRIG 0x09
#define CMD_SETPATTRIG 0x0A
#define CMD_DEACTIVTRIG 0x0B
#define CMD_GETSNAPSHOT 0x0C
#define HIGH 1
#define LOW 0
typedef struct logic Logic;
struct logic {
struct usb_dev_handle *logic_handle;
// struct usb_device *logic_device;
};
Logic* openLogic();
void closeLogic(Logic* self);
int sendLogicCommand(Logic* self,char *command);
int readLogicData(Logic* self, char* data,int length,int samplerate);
int readLogicResults(Logic* self,char *data);
void SetLogicMode(Logic* self,char state);
void SetLogicSampleRate(Logic* self,char samplemode);
void StartLogic(Logic* self);
void StopLogic(Logic* self);
int GetLogicState(Logic* self);
int GetLogicMode(Logic* self);
int GetLogicFIFOLoad(Logic* self);
//************* user functions are here
void Recording(Logic* self,char samplerate,int numbers,char* data);
char TakeSnapshot(Logic* self);
void RecordingInternal(Logic* self,char samplerate);
void GetRecordInternal(Logic* self,char*data,int length,int samplerate);
void ActivateEdgeTrigger(Logic* self,int channel,int value);
void ActivatePatternTrigger(Logic* self,char pattern,char ignore);
void DeActivateTrigger(Logic* self);
|
/*
* Copyright (C) 2014 Johannes Schauer <j.schauer@email.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef _STRING_V_H_
#define _STRING_V_H_
#include <stdbool.h>
typedef struct stringv stringv;
stringv *stringv_alloc(void);
void stringv_free(stringv * sv);
bool stringv_mem(stringv * sv, const char *e);
int stringv_add(stringv * sv, const char *e);
int stringv_del(stringv * sv, const char *e);
#endif
|
#ifndef __MULTI_DETECTOR_H__
#define __MULTI_DETECTOR_H__
/*
* Copyright 2011 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "DetectorImpl.h"
#include "DetectorResult.h"
#include "DecodeHints.h"
namespace zxing {
namespace multi {
class MultiDetector : public zxing::qrcode::Detector {
public:
MultiDetector(Ref<BitMatrix> image);
virtual ~MultiDetector();
virtual std::vector<Ref<DetectorResult> > detectMulti(DecodeHints hints);
};
} // End zxing::multi namespace
} // End zxing namespace
#endif // __MULTI_DETECTOR_H__
|
/* $Id: VBoxNetLwf-win.h $ */
/** @file
* VBoxNetLwf-win.h - Bridged Networking Driver, Windows-specific code.
*/
/*
* Copyright (C) 2014-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VBoxNetLwf_win_h___
#define ___VBoxNetLwf_win_h___
#define VBOXNETLWF_VERSION_NDIS_MAJOR 6
#define VBOXNETLWF_VERSION_NDIS_MINOR 0
#define VBOXNETLWF_NAME_FRIENDLY L"VirtualBox NDIS Light-Weight Filter"
#define VBOXNETLWF_NAME_UNIQUE L"{7af6b074-048d-4444-bfce-1ecc8bc5cb76}"
#define VBOXNETLWF_NAME_SERVICE L"VBoxNetLwf"
#define VBOXNETLWF_NAME_LINK L"\\DosDevices\\Global\\VBoxNetLwf"
#define VBOXNETLWF_NAME_DEVICE L"\\Device\\VBoxNetLwf"
#define VBOXNETLWF_MEM_TAG 'FLBV'
#define VBOXNETLWF_REQ_ID 'fLBV'
#endif /* #ifndef ___VBoxNetLwf_win_h___ */
|
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
/*!
\file GUIFont.h
\brief
*/
#ifndef CGUILIB_GUIFONTTTF_DX_H
#define CGUILIB_GUIFONTTTF_DX_H
#pragma once
#include "GUIFontTTF.h"
#include "D3DResource.h"
/*!
\ingroup textures
\brief
*/
class CGUIFontTTFDX : public CGUIFontTTFBase
{
public:
CGUIFontTTFDX(const std::string& strFileName);
virtual ~CGUIFontTTFDX(void);
virtual void Begin();
virtual void End();
protected:
virtual CBaseTexture* ReallocTexture(unsigned int& newHeight);
virtual bool CopyCharToTexture(FT_BitmapGlyph bitGlyph, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
virtual void DeleteHardwareTexture();
CD3DTexture *m_speedupTexture; // extra texture to speed up reallocations when the main texture is in d3dpool_default.
// that's the typical situation of Windows Vista and above.
uint16_t* m_index;
unsigned m_index_size;
};
#endif
|
/* IRC extension for IP connection tracking.
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* based on RR's ip_conntrack_ftp.h
*
* ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp
*
* 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.
*
*
*/
#ifndef _IP_CONNTRACK_IRC_H
#define _IP_CONNTRACK_IRC_H
/* We record seq number and length of irc ip/port text here: all in
host order. */
/* This structure is per expected connection */
struct ip_ct_irc_expect
{
/* length of IP address */
u_int32_t len;
/* Port that was to be used */
u_int16_t port;
};
/* This structure exists only once per master */
struct ip_ct_irc_master {
};
#ifdef __KERNEL__
#include <linux/netfilter_ipv4/lockhelp.h>
#define IRC_PORT 6667
/* Protects irc part of conntracks */
DECLARE_LOCK_EXTERN(ip_irc_lock);
#endif /* __KERNEL__ */
#endif /* _IP_CONNTRACK_IRC_H */
|
/*
Copyright (C) 2007 Paul Davis
Author: Dave Robillard
Author: Hans Baier
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk_ardour_note_h__
#define __gtk_ardour_note_h__
#include <iostream>
#include "note_base.h"
#include "midi_util.h"
namespace ArdourCanvas {
class Container;
}
class Note : public NoteBase
{
public:
typedef Evoral::Note<Evoral::Beats> NoteType;
Note (MidiRegionView& region,
ArdourCanvas::Item* parent,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
bool with_events = true);
~Note ();
ArdourCanvas::Coord x0 () const;
ArdourCanvas::Coord y0 () const;
ArdourCanvas::Coord x1 () const;
ArdourCanvas::Coord y1 () const;
void set (ArdourCanvas::Rect);
void set_x0 (ArdourCanvas::Coord);
void set_y0 (ArdourCanvas::Coord);
void set_x1 (ArdourCanvas::Coord);
void set_y1 (ArdourCanvas::Coord);
void set_outline_what (ArdourCanvas::Rectangle::What);
void set_outline_all ();
void set_outline_color (uint32_t);
void set_fill_color (uint32_t);
void show ();
void hide ();
void set_ignore_events (bool);
void move_event (double dx, double dy);
private:
ArdourCanvas::Rectangle* _rectangle;
};
#endif /* __gtk_ardour_note_h__ */
|
/*
* Program that makes random system calls with random arguments.
*/
/*
* Copyright (C) 2003-2006 IBM
*
* 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.
*/
#include <signal.h>
#include <limits.h>
#include <strings.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <stdint.h>
#include <stdlib.h>
unsigned long callnum, args[6];
int seed_random(void)
{
int fp;
long seed;
fp = open("/dev/urandom", O_RDONLY);
if (fp < 0) {
perror("/dev/urandom");
return 0;
}
if (read(fp, &seed, sizeof(seed)) != sizeof(seed)) {
perror("read random seed");
return 0;
}
close(fp);
srand(seed);
return 1;
}
void get_big_randnum(void *buf, unsigned int size)
{
uint32_t *x = buf;
int i;
for (i = 0; i < size; i += 4, x++) {
*x = (unsigned long)((float)UINT_MAX *
(rand() / (RAND_MAX + 1.0)));
}
}
unsigned long get_randnum(unsigned long min, unsigned long max)
{
return min + (unsigned long)((float)max * (rand() / (RAND_MAX + 1.0)));
}
int find_syscall(void)
{
int x;
badcall:
x = get_randnum(0, 384);
/* poorly implemented blacklist */
switch (x) {
/* don't screw with signal handling */
#ifdef SYS_signal
case SYS_signal:
#endif
#ifdef SYS_sigaction
case SYS_sigaction:
#endif
#ifdef SYS_sigsuspend
case SYS_sigsuspend:
#endif
#ifdef SYS_sigpending
case SYS_sigpending:
#endif
#ifdef SYS_sigreturn
case SYS_sigreturn:
#endif
#ifdef SYS_sigprocmask
case SYS_sigprocmask:
#endif
#ifdef SYS_rt_sigreturn
case SYS_rt_sigreturn:
#endif
#ifdef SYS_rt_sigaction
case SYS_rt_sigaction:
#endif
#ifdef SYS_rt_sigprocmask
case SYS_rt_sigprocmask:
#endif
#ifdef SYS_rt_sigpending
case SYS_rt_sigpending:
#endif
#ifdef SYS_rt_sigtimedwait
case SYS_rt_sigtimedwait:
#endif
#ifdef SYS_rt_sigqueueinfo
case SYS_rt_sigqueueinfo:
#endif
#ifdef SYS_rt_sigsuspend
case SYS_rt_sigsuspend:
#endif
#ifdef SYS_sigaltstack
case SYS_sigaltstack:
#endif
#ifdef SYS_settimeofday
case SYS_settimeofday:
#endif
/* don't exit the program :P */
#ifdef SYS_exit
case SYS_exit:
#endif
#ifdef SYS_exit_group
case SYS_exit_group:
#endif
/* don't put it to sleep either */
#ifdef SYS_pause
case SYS_pause:
#endif
#ifdef SYS_select
case SYS_select:
#endif
#ifdef SYS_read
case SYS_read:
#endif
#ifdef SYS_write
case SYS_write:
#endif
/* these can fill the process table */
#ifdef SYS_fork
case SYS_fork:
#endif
#ifdef SYS_vfork
case SYS_vfork:
#endif
#ifdef SYS_clone
case SYS_clone:
#endif
/* This causes OOM conditions */
#if 1
#ifdef SYS_brk
case SYS_brk:
#endif
#endif
/* these get our program killed */
#ifdef SYS_vm86
case SYS_vm86:
#endif
#ifdef SYS_vm86old
case SYS_vm86old:
#endif
goto badcall;
}
return x;
}
void bogus_signal_handler(int signum)
{
fprintf(stderr,
" Signal %d on syscall(%lu, 0x%lX, 0x%lX, 0x%lX, 0x%lX, 0x%lX, 0x%lX).\n",
signum, callnum, args[0], args[1], args[2], args[3], args[4],
args[5]);
}
void real_signal_handler(int signum)
{
exit(0);
}
void install_signal_handlers(void)
{
int x;
struct sigaction zig;
memset(&zig, 0x00, sizeof(zig));
zig.sa_handler = bogus_signal_handler;
for (x = 0; x < 64; x++) {
sigaction(x, &zig, NULL);
}
zig.sa_handler = real_signal_handler;
sigaction(SIGINT, &zig, NULL);
sigaction(SIGTERM, &zig, NULL);
}
int main(int argc, char *argv[])
{
int i;
int debug = 0, zero_mode = 0;
if (!seed_random()) {
return 1;
}
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d"))
debug = 1;
else if (!strcmp(argv[i], "-z"))
zero_mode = 1;
}
memset(args, 0, sizeof(unsigned long) * 6);
install_signal_handlers();
while (1) {
callnum = find_syscall();
if (!zero_mode)
get_big_randnum(&args[0], sizeof(unsigned long) * 6);
if (debug) {
printf("syscall(%lu, 0x%lX, 0x%lX, 0x%lX, 0x%lX, "
"0x%lX, 0x%lX); \n",
callnum, args[0], args[1], args[2], args[3],
args[4], args[5]);
fflush(stdout);
}
syscall(callnum, args[0], args[1], args[2],
args[3], args[4], args[5]);
}
return 0;
}
|
#ifndef RSP_H
#define RSP_H
#include "Types.h"
typedef struct
{
u32 PC[18], PCi, busy, halt, close, DList, uc_start, uc_dstart, cmd, nextCmd;
s32 count;
bool bLLE;
char romname[21];
wchar_t pluginpath[PLUGIN_PATH_SIZE];
} RSPInfo;
extern RSPInfo RSP;
extern u32 DepthClearColor;
#define RSP_SegmentToPhysical( segaddr ) ((gSP.segment[(segaddr >> 24) & 0x0F] + (segaddr & RDRAMSize)) & RDRAMSize)
void RSP_Init();
void RSP_ProcessDList();
void RSP_LoadMatrix( f32 mtx[4][4], u32 address );
void RSP_CheckDLCounter();
#endif
|
/* close replacement.
Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#include <errno.h>
#include "fd-hook.h"
#include "msvc-inval.h"
#undef close
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static int
close_nothrow (int fd)
{
int result;
TRY_MSVC_INVAL
{
result = close (fd);
}
CATCH_MSVC_INVAL
{
result = -1;
errno = EBADF;
}
DONE_MSVC_INVAL;
return result;
}
#else
# define close_nothrow close
#endif
/* Override close() to call into other gnulib modules. */
int
rpl_close (int fd)
{
#if WINDOWS_SOCKETS
int retval = execute_all_close_hooks (close_nothrow, fd);
#else
int retval = close_nothrow (fd);
#endif
#if REPLACE_FCHDIR
if (retval >= 0)
_gl_unregister_fd (fd);
#endif
return retval;
}
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* mips.h
* Copyright (C) HjjHjj <hjjhjj@gmail.com>
*
* mips.h 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.
*
* mips.h 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 HJJHJJ_MIPS_H
#define HJJHJJ_MIPS_H
#include "base.h"
/*
inline uint64_t MAKE_LONG_LONG(uint32_t LowLong, uint32_t HighLong)
{
return (uint64_t) LowLong | ((uint64_t) HighLong << 32);
}
*/
static __inline__ int Bsf(uint32_t Operand)
{
/* Use gcc __buildin function instead of asm */
if (Operand==0)
return 0;
return __builtin_ctzl(Operand);
/*
int eax;
asm __volatile__ (
"bsfl %0, %0" "\n\t"
: "=a" (eax)
: "0" (Operand)
);
return eax;
*/
}
static __inline__ int Bsr(uint32_t Operand)
{
/* Use gcc __buildin function instead of asm */
if (Operand==0)
return 0;
return 31 - __builtin_clzl(Operand);
/*
int eax;
asm __volatile__ (
"bsrl %0, %0" "\n\t"
: "=a" (eax)
: "0" (Operand)
);
return eax;
*/
}
//#ifdef linux
//#include <sys/time.h>
//#include <sys/types.h>
//#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
//#endif
static __inline__ uint64_t TimeStampCounter(void)
{
int fd = -1;
fd = open("/dev/urandom", O_RDONLY);
if (fd == -1)
{
return 0x12345678;
}
uint64_t random;
read(fd, &random, sizeof(random));
close(fd);
return random;
/*
uint32_t eax, edx;
asm __volatile__ (
"rdtsc" "\n\t"
: "=a" (eax), "=d" (edx)
:
);
return MAKE_LONG_LONG(eax, edx);
*/
}
#endif
|
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MediaTimeAVFoundation_h
#define MediaTimeAVFoundation_h
#if USE(AVFOUNDATION)
#include <CoreMedia/CMTime.h>
#include <wtf/MediaTime.h>
namespace WebCore {
CMTime toCMTime(const MediaTime&);
MediaTime toMediaTime(const CMTime&);
}
#endif
#endif
|
/* Overhauled routines for dealing with different mmap regions of flash */
/* $Id: map.h,v 1.34 2003/05/28 12:42:22 dwmw2 Exp $ */
#ifndef __LINUX_MTD_MAP_H__
#define __LINUX_MTD_MAP_H__
#include <linux/config.h>
#include <linux/types.h>
#include <linux/list.h>
#include <asm/system.h>
#include <asm/io.h>
/* The map stuff is very simple. You fill in your struct map_info with
a handful of routines for accessing the device, making sure they handle
paging etc. correctly if your device needs it. Then you pass it off
to a chip driver which deals with a mapped device - generally either
do_cfi_probe() or do_ram_probe(), either of which will return a
struct mtd_info if they liked what they saw. At which point, you
fill in the mtd->module with your own module address, and register
it.
The mtd->priv field will point to the struct map_info, and any further
private data required by the chip driver is linked from the
mtd->priv->fldrv_priv field. This allows the map driver to get at
the destructor function map->fldrv_destroy() when it's tired
of living.
*/
struct map_info {
char *name;
unsigned long size;
unsigned long phys;
#define NO_XIP (-1UL)
unsigned long virt;
void *cached;
int buswidth; /* in octets */
#ifdef CONFIG_MTD_COMPLEX_MAPPINGS
u8 (*read8)(struct map_info *, unsigned long);
u16 (*read16)(struct map_info *, unsigned long);
u32 (*read32)(struct map_info *, unsigned long);
u64 (*read64)(struct map_info *, unsigned long);
/* If it returned a 'long' I'd call it readl.
* It doesn't.
* I won't.
* dwmw2 */
void (*copy_from)(struct map_info *, void *, unsigned long, ssize_t);
void (*write8)(struct map_info *, u8, unsigned long);
void (*write16)(struct map_info *, u16, unsigned long);
void (*write32)(struct map_info *, u32, unsigned long);
void (*write64)(struct map_info *, u64, unsigned long);
void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t);
/* We can perhaps put in 'point' and 'unpoint' methods, if we really
want to enable XIP for non-linear mappings. Not yet though. */
#endif
/* set_vpp() must handle being reentered -- enable, enable, disable
must leave it enabled. */
void (*set_vpp)(struct map_info *, int);
unsigned long map_priv_1;
unsigned long map_priv_2;
void *fldrv_priv;
struct mtd_chip_driver *fldrv;
};
struct mtd_chip_driver {
struct mtd_info *(*probe)(struct map_info *map);
void (*destroy)(struct mtd_info *);
struct module *module;
char *name;
struct list_head list;
};
void register_mtd_chip_driver(struct mtd_chip_driver *);
void unregister_mtd_chip_driver(struct mtd_chip_driver *);
struct mtd_info *do_map_probe(const char *name, struct map_info *map);
void map_destroy(struct mtd_info *mtd);
#define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0)
#define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0)
#ifdef CONFIG_MTD_COMPLEX_MAPPINGS
#define map_read8(map, ofs) (map)->read8(map, ofs)
#define map_read16(map, ofs) (map)->read16(map, ofs)
#define map_read32(map, ofs) (map)->read32(map, ofs)
#define map_read64(map, ofs) (map)->read64(map, ofs)
#define map_copy_from(map, to, from, len) (map)->copy_from(map, to, from, len)
#define map_write8(map, datum, ofs) (map)->write8(map, datum, ofs)
#define map_write16(map, datum, ofs) (map)->write16(map, datum, ofs)
#define map_write32(map, datum, ofs) (map)->write32(map, datum, ofs)
#define map_write64(map, datum, ofs) (map)->write64(map, datum, ofs)
#define map_copy_to(map, to, from, len) (map)->copy_to(map, to, from, len)
extern void simple_map_init(struct map_info *);
#define map_is_linear(map) (map->phys != NO_XIP)
#else
static inline u8 map_read8(struct map_info *map, unsigned long ofs)
{
return __raw_readb(map->virt + ofs);
}
static inline u16 map_read16(struct map_info *map, unsigned long ofs)
{
return __raw_readw(map->virt + ofs);
}
static inline u32 map_read32(struct map_info *map, unsigned long ofs)
{
return __raw_readl(map->virt + ofs);
}
static inline u64 map_read64(struct map_info *map, unsigned long ofs)
{
#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
BUG();
return 0;
#else
return __raw_readll(map->virt + ofs);
#endif
}
static inline void map_write8(struct map_info *map, u8 datum, unsigned long ofs)
{
__raw_writeb(datum, map->virt + ofs);
mb();
}
static inline void map_write16(struct map_info *map, u16 datum, unsigned long ofs)
{
__raw_writew(datum, map->virt + ofs);
mb();
}
static inline void map_write32(struct map_info *map, u32 datum, unsigned long ofs)
{
__raw_writel(datum, map->virt + ofs);
mb();
}
static inline void map_write64(struct map_info *map, u64 datum, unsigned long ofs)
{
#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
BUG();
#else
__raw_writell(datum, map->virt + ofs);
mb();
#endif /* CFI_B8 */
}
static inline void map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
memcpy_fromio(to, map->virt + from, len);
}
static inline void map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
memcpy_toio(map->virt + to, from, len);
}
#define simple_map_init(map) do { } while (0)
#define map_is_linear(map) (1)
#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */
#endif /* __LINUX_MTD_MAP_H__ */
|
/*****************************************************************************
* hdmv.h : HDMV specific headers
*****************************************************************************
* Copyright (C) 2010 Kieran Kunhya
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef LIBMPEGTS_HDMV_H
#define LIBMPEGTS_HDMV_H
/* Blu-Ray specific stream types */
#define AUDIO_LPCM 0x80
#define AUDIO_DTS 0x82
#define AUDIO_DOLBY_LOSSLESS 0x83
#define AUDIO_DTS_HD 0x85
#define AUDIO_DTS_HD_XLL 0x86
#define AUDIO_EAC3_SECONDARY 0xa1
#define AUDIO_DTS_HD_SECONDARY 0xa2
#define SUB_PRESENTATION_GRAPHICS 0x90
#define SUB_INTERACTIVE_GRAPHICS 0x91
#define SUB_TEXT 0x92
/* Descriptor Tags */
#define HDMV_PARTIAL_TS_DESCRIPTOR_TAG 0x63
#define HDMV_AC3_DESCRIPTOR_TAG 0x81
#define HDMV_CAPTION_DESCRIPTOR_TAG 0x86
#define HDMV_COPY_CTRL_DESCRIPTOR_TAG 0x88
void write_hdmv_copy_control_descriptor( ts_writer_t *w, bs_t *s );
void write_hdmv_video_registration_descriptor( bs_t *s, ts_int_stream_t *stream );
void write_hdmv_lpcm_descriptor( bs_t *s, ts_int_stream_t *stream );
void write_partial_ts_descriptor( ts_writer_t *w, bs_t *s );
#endif
|
#ifndef varint_h
#define varint_h
int GetVarint64(const uint8_t *z, int n, uint64_t *pResult);
int PutVarint64(uint8_t *z, uint64_t x);
int GetVarint32(const uint8_t *z, uint32_t *pResult);
int PutVarint32(uint8_t *p, uint32_t v);
int VarintLen(uint64_t v);
#endif
|
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 2012 the R Core Team
*
* 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, a copy is available at
* http://www.r-project.org/Licenses/
*/
#include <config.h>
#include <Defn.h>
#include <Internal.h>
#include "grDevices.h"
#ifndef _WIN32
SEXP do_X11(SEXP call, SEXP op, SEXP args, SEXP env);
SEXP do_saveplot(SEXP call, SEXP op, SEXP args, SEXP env);
SEXP X11(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_X11(call, op, CDR(args), env);
}
SEXP savePlot(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_saveplot(call, op, CDR(args), env);
}
#endif
SEXP contourLines(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_contourLines(call, op, CDR(args), env);
}
SEXP getSnapshot(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_getSnapshot(call, op, CDR(args), env);
}
SEXP playSnapshot(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_playSnapshot(call, op, CDR(args), env);
}
SEXP getGraphicsEvent(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_getGraphicsEvent(call, op, CDR(args), env);
}
SEXP getGraphicsEventEnv(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_getGraphicsEventEnv(call, op, CDR(args), env);
}
SEXP setGraphicsEventEnv(SEXP call, SEXP op, SEXP args, SEXP env)
{
return do_setGraphicsEventEnv(call, op, CDR(args), env);
}
#ifdef _WIN32
SEXP bringtotop(SEXP sdev, SEXP sstay);
SEXP msgwindow(SEXP sdev, SEXP stype);
SEXP bringToTop(SEXP sdev, SEXP sstay)
{
return bringtotop(sdev, sstay);
}
SEXP msgWindow(SEXP sdev, SEXP stype)
{
return msgwindow(sdev, stype);
}
#endif
#include <R_ext/GraphicsEngine.h>
SEXP devAskNewPage(SEXP call, SEXP op, SEXP args, SEXP env)
{
int ask;
pGEDevDesc gdd = GEcurrentDevice();
Rboolean oldask = gdd->ask;
args = CDR(args);
if (!isNull(CAR(args))) {
ask = asLogical(CAR(args));
if (ask == NA_LOGICAL) error(_("invalid '%s' argument"), "ask");
gdd->ask = ask;
R_Visible = FALSE;
} else R_Visible = TRUE;
return ScalarLogical(oldask);
}
|
/* arch/arm/mach-msm/include/mach/memory.h
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
#include <linux/types.h>
/* physical offset of RAM */
#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
#define MAX_PHYSMEM_BITS 32
#define SECTION_SIZE_BITS 28
/* Maximum number of Memory Regions
* The largest system can have 4 memory banks, each divided into 8 regions
*/
#define MAX_NR_REGIONS 32
/* The number of regions each memory bank is divided into */
#define NR_REGIONS_PER_BANK 8
/* Certain configurations of MSM7x30 have multiple memory banks.
* One or more of these banks can contain holes in the memory map as well.
* These macros define appropriate conversion routines between the physical
* and virtual address domains for supporting these configurations using
* SPARSEMEM and a 3G/1G VM split.
*/
#if defined(CONFIG_ARCH_MSM7X30)
#define EBI0_PHYS_OFFSET PHYS_OFFSET
#define EBI0_PAGE_OFFSET PAGE_OFFSET
#define EBI0_SIZE 0x10000000
#ifndef __ASSEMBLY__
extern unsigned long ebi1_phys_offset;
#define EBI1_PHYS_OFFSET (ebi1_phys_offset)
#define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE)
#if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G))
#define __phys_to_virt(phys) \
((phys) >= EBI1_PHYS_OFFSET ? \
(phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \
(phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET)
#define __virt_to_phys(virt) \
((virt) >= EBI1_PAGE_OFFSET ? \
(virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \
(virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET)
#endif
#endif
#endif
#ifndef __ASSEMBLY__
void *alloc_bootmem_aligned(unsigned long size, unsigned long alignment);
void *allocate_contiguous_ebi(unsigned long, unsigned long, int);
unsigned long allocate_contiguous_ebi_nomap(unsigned long, unsigned long);
void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long);
void clean_caches(unsigned long, unsigned long, unsigned long);
void invalidate_caches(unsigned long, unsigned long, unsigned long);
int platform_physical_remove_pages(u64, u64);
int platform_physical_active_pages(u64, u64);
int platform_physical_low_power_pages(u64, u64);
extern int (*change_memory_power)(u64, u64, int);
#if defined(CONFIG_ARCH_MSM_ARM11) || defined(CONFIG_ARCH_MSM_CORTEX_A5)
void write_to_strongly_ordered_memory(void);
void map_page_strongly_ordered(void);
#endif
#ifdef CONFIG_CACHE_L2X0
extern void l2x0_cache_sync(void);
#define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0)
#endif
#if defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960)
extern void store_ttbr0(void);
#define finish_arch_switch(prev) do { store_ttbr0(); } while (0)
#endif
#ifdef CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0
extern unsigned long membank0_size;
extern unsigned long membank1_start;
void find_membank0_hole(void);
#define MEMBANK0_PHYS_OFFSET PHYS_OFFSET
#define MEMBANK0_PAGE_OFFSET PAGE_OFFSET
#define MEMBANK1_PHYS_OFFSET (membank1_start)
#define MEMBANK1_PAGE_OFFSET (MEMBANK0_PAGE_OFFSET + (membank0_size))
#define __phys_to_virt(phys) \
((MEMBANK1_PHYS_OFFSET && ((phys) >= MEMBANK1_PHYS_OFFSET)) ? \
(phys) - MEMBANK1_PHYS_OFFSET + MEMBANK1_PAGE_OFFSET : \
(phys) - MEMBANK0_PHYS_OFFSET + MEMBANK0_PAGE_OFFSET)
#define __virt_to_phys(virt) \
((MEMBANK1_PHYS_OFFSET && ((virt) >= MEMBANK1_PAGE_OFFSET)) ? \
(virt) - MEMBANK1_PAGE_OFFSET + MEMBANK1_PHYS_OFFSET : \
(virt) - MEMBANK0_PAGE_OFFSET + MEMBANK0_PHYS_OFFSET)
#endif
#endif
#if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_KRAIT
#define arch_has_speculative_dfetch() 1
#endif
#endif
/* these correspond to values known by the modem */
#define MEMORY_DEEP_POWERDOWN 0
#define MEMORY_SELF_REFRESH 1
#define MEMORY_ACTIVE 2
#define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd"
#define CONSISTENT_DMA_SIZE (SZ_1M * 10)
|
/* capture.h
* Definitions for packet capture windows
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* This file should only be included if libpcap is present */
#ifndef __CAPTURE_H__
#define __CAPTURE_H__
/** @file
* Capture related things.
*/
#include "capture_opts.h"
#include "capture_session.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef enum {
capture_cb_capture_prepared,
capture_cb_capture_update_started,
capture_cb_capture_update_continue,
capture_cb_capture_update_finished,
capture_cb_capture_fixed_started,
capture_cb_capture_fixed_continue,
capture_cb_capture_fixed_finished,
capture_cb_capture_stopping,
capture_cb_capture_failed
} capture_cbs;
typedef void (*capture_callback_t) (gint event, capture_session *cap_session,
gpointer user_data);
extern void
capture_callback_add(capture_callback_t func, gpointer user_data);
extern void
capture_callback_remove(capture_callback_t func);
/**
* Start a capture session.
*
* @param capture_opts the numerous capture options
* @return TRUE if the capture starts successfully, FALSE otherwise.
*/
extern gboolean
capture_start(capture_options *capture_opts, capture_session *cap_session);
/** Stop a capture session (usually from a menu item). */
extern void
capture_stop(capture_session *cap_session);
/** Restart the current captured packets and start again. */
extern void
capture_restart(capture_session *cap_session);
/** Terminate the capture child cleanly when exiting. */
extern void
capture_kill_child(capture_session *cap_session);
struct if_stat_cache_s;
typedef struct if_stat_cache_s if_stat_cache_t;
/**
* Start gathering capture statistics for the interfaces specified.
* @param capture_opts A structure containing options for the capture.
* @return A pointer to the statistics state data.
*/
extern if_stat_cache_t * capture_stat_start(capture_options *capture_opts);
/**
* Fetch capture statistics, similar to pcap_stats().
*/
struct pcap_stat; /* Stub in case we don't or haven't yet included pcap.h */
extern gboolean capture_stats(if_stat_cache_t *sc, char *ifname, struct pcap_stat *ps);
/**
* Stop gathering capture statistics.
*/
void capture_stat_stop(if_stat_cache_t *sc);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* capture.h */
|
/*
* psithememanager.h - manages all themes in psi
* Copyright (C) 2010 Sergey Ilinykh
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifndef PSITHEMEMANAGER_H
#define PSITHEMEMANAGER_H
#include "psithemeprovider.h"
#include <QObject>
// class ChatViewTheme;
class PsiThemeManager : public QObject {
Q_OBJECT
public:
PsiThemeManager(QObject *parent);
~PsiThemeManager();
void registerProvider(PsiThemeProvider *provider, bool required = false);
PsiThemeProvider * unregisterProvider(const QString &type);
PsiThemeProvider * provider(const QString &type);
QList<PsiThemeProvider *> registeredProviders() const;
bool loadAll();
class Private;
Private *d;
};
#endif // PSITHEMEMANAGER_H
|
/*
Copyright (C) 2014-2015 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*! \file asset_general.h
\brief Header file for all not low level functions for asset
\author Alena Chernikava <AlenaChernikava@eaton.com>
*/
#ifndef SRC_DB_ASSETS_GENERAL_H
#define SRC_DB_ASSETS_GENERAL_H
#include <tntdb/connect.h>
#include "db/assetdef.h"
#include "dbhelpers.h"
#include "asset_types.h"
namespace persist {
int
update_dc_room_row_rack_group
(tntdb::Connection &conn,
a_elmnt_id_t element_id,
const char *element_name,
a_elmnt_tp_id_t element_type_id,
a_elmnt_id_t parent_id,
zhash_t *extattributes,
const char *status,
a_elmnt_pr_t priority,
std::set <a_elmnt_id_t> const &groups,
const std::string &asset_tag,
std::string &errmsg);
int
update_device
(tntdb::Connection &conn,
a_elmnt_id_t element_id,
const char *element_name,
a_elmnt_tp_id_t element_type_id,
a_elmnt_id_t parent_id,
zhash_t *extattributes,
const char *status,
a_elmnt_pr_t priority,
std::set <a_elmnt_id_t> const &groups,
std::vector <link_t> &links,
const std::string &asset_tag,
std::string &errmsg);
db_reply_t
insert_dc_room_row_rack_group
(tntdb::Connection &conn,
const char *element_name,
a_elmnt_tp_id_t element_type_id,
a_elmnt_id_t parent_id,
zhash_t *extattributes,
const char *status,
a_elmnt_pr_t priority,
std::set <a_elmnt_id_t> const &groups,
const std::string &asset_tag);
db_reply_t
insert_device
(tntdb::Connection &conn,
std::vector <link_t> &links,
std::set <a_elmnt_id_t> const &groups,
const char *element_name,
a_elmnt_id_t parent_id,
zhash_t *extattributes,
a_dvc_tp_id_t asset_device_type_id,
const char *asset_device_type_name,
const char *status,
a_elmnt_pr_t priority,
const std::string &asset_tag);
db_reply_t
delete_dc_room_row_rack
(tntdb::Connection &conn,
a_elmnt_id_t element_id);
db_reply_t
delete_group
(tntdb::Connection &conn,
a_elmnt_id_t element_id);
db_reply_t
delete_device
(tntdb::Connection &conn,
a_elmnt_id_t element_id);
} // end namespace
#endif // SRC_DB_ASSETS_GENERAL_H
|
/*
* File: fs/ext4/synoacl_int.h
* Copyright (c) 2000-2010 Synology Inc.
*/
#ifndef __LINUX_SYNOACL_EXT4_INT_H
#define __LINUX_SYNOACL_EXT4_INT_H
struct synoacl_operations {
int (*xattr_get_syno_acl) (struct inode *inode, void *buffer, size_t size);
int (*xattr_set_syno_acl) (struct inode *inode, const void *value, size_t size);
size_t (*xattr_list_syno_acl) (struct inode *inode, char *list, size_t list_len, const char *name, size_t name_len);
int (*get_syno_acl_inherit) (struct dentry *d, int cmd, void *value, size_t size);
int (*syno_permission) (struct dentry *d, int mask);
int (*syno_exec_permission) (struct dentry *d);
int (*get_syno_permission) (struct dentry *, unsigned int *, unsigned int *);
int (*syno_acl_chmod) (struct inode *inode);
int (*init_syno_acl) (struct inode *inode, struct dentry *d);
int (*rename_syno_acl) (struct inode *inode, struct inode *new_inode);
int (*syno_inode_change_ok) (struct dentry *d, struct iattr *attr);
void (*syno_archive_safe_clean) (struct inode *inode, unsigned int want);
void (*synoacl_to_mode) (struct dentry *, struct inode *, struct kstat *);
int (*dir_getattr) (struct vfsmount *, struct dentry *, struct kstat *);
int (*syno_access) (struct dentry *, int);
};
//synoacl EXT4 API
int ext4_mod_syno_access(struct dentry *, int);
int ext4_mod_get_syno_acl_inherit(struct dentry *, int, void *, size_t);
int ext4_mod_syno_permission(struct dentry *, int);
int ext4_mod_syno_exec_permission(struct dentry *);
int ext4_mod_get_syno_permission(struct dentry *, unsigned int *, unsigned int *);
int ext4_mod_syno_acl_chmod(struct inode *);
int ext4_mod_init_syno_acl(struct inode *, struct dentry *);
int ext4_mod_rename_syno_acl(struct inode *, struct inode *);
int ext4_mod_syno_inode_change_ok(struct dentry *, struct iattr *);
int ext4_mod_syno_archive_safe_clean(struct inode *, unsigned int);
int ext4_mod_dir_getattr(struct vfsmount *, struct dentry *, struct kstat *);
void ext4_mod_synoacl_to_mode(struct dentry *, struct inode *, struct kstat *);
#endif /* __LINUX_SYNOACL_EXT4_INT_H */
|
/***
* banned.h - list of Microsoft Security Development Lifecycle banned APIs
*
* Purpose:
* This include file contains a list of banned API which should not be used in new code and
* removed from legacy code over time
* History
* 01-Jan-2006 - mikehow - Initial Version
* 22-Apr-2008 - mikehow - Updated to SDL 4.1, commented out recommendations and added memcpy
*
***/
#ifndef _INC_BANNED
# define _INC_BANNED
#endif
#ifdef _MSC_VER
// Some of these functions are Windows specific
# pragma once
# pragma deprecated (strcpy, strcpyA, strcpyW, wcscpy, _tcscpy, _mbscpy, StrCpy, StrCpyA, StrCpyW, lstrcpy, lstrcpyA, lstrcpyW, _tccpy, _mbccpy)
# pragma deprecated (strcat, strcatA, strcatW, wcscat, _tcscat, _mbscat, StrCat, StrCatA, StrCatW, lstrcat, lstrcatA, lstrcatW, StrCatBuff, StrCatBuffA, StrCatBuffW, StrCatChainW, _tccat, _mbccat)
# pragma deprecated (wnsprintf, wnsprintfA, wnsprintfW, sprintfW, sprintfA, wsprintf, wsprintfW, wsprintfA, sprintf, swprintf, _stprintf, _snwprintf, _snprintf, _sntprintf)
# pragma deprecated (wvsprintf, wvsprintfA, wvsprintfW, vsprintf, _vstprintf, vswprintf)
# pragma deprecated (_vsnprintf, _vsnwprintf, _vsntprintf, wvnsprintf, wvnsprintfA, wvnsprintfW)
# pragma deprecated (strncpy, wcsncpy, _tcsncpy, _mbsncpy, _mbsnbcpy, StrCpyN, StrCpyNA, StrCpyNW, StrNCpy, strcpynA, StrNCpyA, StrNCpyW, lstrcpyn, lstrcpynA, lstrcpynW)
# pragma deprecated (strncat, wcsncat, _tcsncat, _mbsncat, _mbsnbcat, StrCatN, StrCatNA, StrCatNW, StrNCat, StrNCatA, StrNCatW, lstrncat, lstrcatnA, lstrcatnW, lstrcatn)
# pragma deprecated (strtok, _tcstok, wcstok, _mbstok)
# pragma deprecated (makepath, _tmakepath, _makepath, _wmakepath)
# pragma deprecated (_splitpath, _tsplitpath, _wsplitpath)
# pragma deprecated (scanf, wscanf, _tscanf, sscanf, swscanf, _stscanf, snscanf, snwscanf, _sntscanf)
//# pragma deprecated (_itoa, _itow, _i64toa, _i64tow, _ui64toa, _ui64tot, _ui64tow, _ultoa, _ultot, _ultow)
# pragma deprecated (gets, _getts, _gettws)
# pragma deprecated (IsBadWritePtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadHugeReadPtr, IsBadCodePtr, IsBadStringPtr)
# pragma deprecated (CharToOem, CharToOemA, CharToOemW, OemToChar, OemToCharA, OemToCharW, CharToOemBuffA, CharToOemBuffW)
//# pragma deprecated (alloca, _alloca)
# pragma deprecated (strlen, wcslen, _mbslen, _mbstrlen, StrLen, lstrlen)
# pragma deprecated (memcpy, RtlCopyMemory, CopyMemory)
#else
#ifdef __GNUC__
// Some of these functions are Windows specific, so you may want to add *nix specific banned function calls
# pragma GCC poison strcpy strcpyA strcpyW wcscpy _tcscpy _mbscpy StrCpy StrCpyA StrCpyW lstrcpy lstrcpyA lstrcpyW _tccpy _mbccpy
# pragma GCC poison strcat strcatA strcatW wcscat _tcscat _mbscat StrCat StrCatA StrCatW lstrcat lstrcatA lstrcatW StrCatBuff StrCatBuffA StrCatBuffW StrCatChainW _tccat _mbccat
# pragma GCC poison wnsprintf wnsprintfA wnsprintfW sprintfW sprintfA wsprintf wsprintfW wsprintfA sprintf swprintf _stprintf _snwprintf _snprintf _sntprintf
# pragma GCC poison wvsprintf wvsprintfA wvsprintfW vsprintf _vstprintf vswprintf
# pragma GCC poison _vsnprintf _vsnwprintf _vsntprintf wvnsprintf wvnsprintfA wvnsprintfW
# pragma GCC poison strncpy wcsncpy _tcsncpy _mbsncpy _mbsnbcpy StrCpyN StrCpyNA StrCpyNW StrNCpy strcpynA StrNCpyA StrNCpyW lstrcpyn lstrcpynA lstrcpynW
# pragma GCC poison strncat wcsncat _tcsncat _mbsncat _mbsnbcat StrCatN StrCatNA StrCatNW StrNCat StrNCatA StrNCatW lstrncat lstrcatnA lstrcatnW lstrcatn
# pragma GCC poison strtok _tcstok wcstok _mbstok
# pragma GCC poison makepath _tmakepath _makepath _wmakepath
# pragma GCC poison _splitpath _tsplitpath _wsplitpath
# pragma GCC poison scanf wscanf _tscanf sscanf swscanf _stscanf snscanf snwscanf _sntscanf
//# pragma GCC poison _itoa _itow _i64toa _i64tow _ui64toa _ui64tot _ui64tow _ultoa _ultot _ultow
# pragma GCC poison gets _getts _gettws
# pragma GCC poison IsBadWritePtr IsBadHugeWritePtr IsBadReadPtr IsBadHugeReadPtr IsBadCodePtr IsBadStringPtr
# pragma GCC poison CharToOem CharToOemA CharToOemW OemToChar OemToCharA OemToCharW CharToOemBuffA CharToOemBuffW
//# pragma GCC poison alloca _alloca
# pragma GCC poison strlen wcslen _mbslen _mbstrlen StrLen lstrlen
# pragma GCC poison memcpy RtlCopyMemory CopyMemory
#endif
#endif /* _INC_BANNED */
|
/* * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.* */
/*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* The MSM peripherals are spread all over across 768MB of physical
* space, which makes just having a simple IO_ADDRESS macro to slide
* them into the right virtual location rough. Instead, we will
* provide a master phys->virt mapping for peripherals here.
*
*/
#ifndef __ASM_ARCH_MSM_IOMAP_IPQ806X_H
#define __ASM_ARCH_MSM_IOMAP_IPQ806X_H
/* Physical base address and size of peripherals.
* Ordered by the virtual base addresses they will be mapped at.
*
* If you add or remove entries here, you'll want to edit the
* msm_io_desc array in arch/arm/mach-msm/io.c to reflect your
* changes.
*
*/
#define IPQ806X_TMR_PHYS 0x0200A000
#define IPQ806X_TMR_SIZE SZ_4K
#define IPQ806X_TMR0_PHYS 0x0208A000
#define IPQ806X_TMR0_SIZE SZ_4K
#define IPQ806X_QGIC_DIST_PHYS 0x02000000
#define IPQ806X_QGIC_DIST_SIZE SZ_4K
#define IPQ806X_QGIC_CPU_PHYS 0x02002000
#define IPQ806X_QGIC_CPU_SIZE SZ_4K
#define IPQ806X_TLMM_PHYS 0x00800000
#define IPQ806X_TLMM_SIZE SZ_16K
#define IPQ806X_ACC0_PHYS 0x02088000
#define IPQ806X_ACC0_SIZE SZ_4K
#define IPQ806X_ACC1_PHYS 0x02098000
#define IPQ806X_ACC1_SIZE SZ_4K
#define IPQ806X_APCS_GCC_PHYS 0x02011000
#define IPQ806X_APCS_GCC_SIZE SZ_4K
#define IPQ806X_CLK_CTL_PHYS 0x00900000
#define IPQ806X_CLK_CTL_SIZE SZ_16K
#define IPQ806X_MMSS_CLK_CTL_PHYS 0x04000000
#define IPQ806X_MMSS_CLK_CTL_SIZE SZ_4K
#define IPQ806X_LPASS_CLK_CTL_PHYS 0x28000000
#define IPQ806X_LPASS_CLK_CTL_SIZE SZ_4K
#define IPQ806X_HFPLL_PHYS 0x00903000
#define IPQ806X_HFPLL_SIZE SZ_4K
/*
* IMEM starts at 0x2A000000. We skip the initial
* 252K for the TrustZone image
*/
#define IPQ806X_IMEM_PHYS 0x2A03F000
#define IPQ806X_IMEM_SIZE SZ_4K
#define IPQ806X_RPM_PHYS 0x00108000
#define IPQ806X_RPM_SIZE SZ_4K
#define IPQ806X_RPM_MPM_PHYS 0x00200000
#define IPQ806X_RPM_MPM_SIZE SZ_4K
#define IPQ806X_SAW0_PHYS 0x02089000
#define IPQ806X_SAW0_SIZE SZ_4K
#define IPQ806X_SAW1_PHYS 0x02099000
#define IPQ806X_SAW1_SIZE SZ_4K
#define IPQ806X_SAW_L2_PHYS 0x02012000
#define IPQ806X_SAW_L2_SIZE SZ_4K
#define IPQ806X_RPM_TIMERS_PHYS 0x00062000
#define IPQ806X_RPM_TIMERS_SIZE SZ_4K
#define IPQ806X_QFPROM_PHYS 0x00700000
#define IPQ806X_QFPROM_SIZE SZ_4K
#define IPQ806X_SIC_NON_SECURE_PHYS 0x12100000
#define IPQ806X_SIC_NON_SECURE_SIZE SZ_64K
#ifdef CONFIG_DEBUG_IPQ806X_UART
#define MSM_DEBUG_UART_BASE IOMEM(0xFA740000)
#define MSM_DEBUG_UART_PHYS 0x16640000
#endif
#define IPQ806X_NSS_TCM_PHYS 0x39000000
#define IPQ806X_NSS_TCM_SIZE SZ_128K
#define IPQ806X_NSS_FPB_PHYS 0x03000000
#define IPQ806X_NSS_FPB_SIZE SZ_4K
#define IPQ806X_UBI32_0_CSM_PHYS 0x36000000
#define IPQ806X_UBI32_0_CSM_SIZE SZ_4K
#define IPQ806X_UBI32_1_CSM_PHYS 0x36400000
#define IPQ806X_UBI32_1_CSM_SIZE SZ_4K
#define IPQ806X_SFAB_PHYS 0x01300000
#define IPQ806X_SFAB_SIZE SZ_16K
#define IPQ806X_AFAB_PHYS 0x01400000
#define IPQ806X_AFAB_SIZE SZ_16K
#define IPQ806X_NSSFAB_0_PHYS 0x00D00000
#define IPQ806X_NSSFAB_0_SIZE SZ_16K
#define IPQ806X_NSSFAB_1_PHYS 0x01900000
#define IPQ806X_NSSFAB_1_SIZE SZ_16K
#define IPQ806X_DAY_CFG_PHYS 0x01500000
#define IPQ806X_DAY_CFG_SIZE SZ_16K
/* Virtrual address for GSBI6 port selection */
#define IPQ806X_GSBI6_PORT_SEL_BASE (MSM_TLMM_BASE + 0x2088)
#endif /* __ASM_ARCH_MSM_IOMAP_IPQ806X_H */
|
/*
* \brief Driver base for the PrimeCell UART PL011 Revision r1p3
* \author Martin stein
* \date 2011-10-17
*/
/*
* Copyright (C) 2011-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__DRIVERS__UART__PL011_BASE_H_
#define _INCLUDE__DRIVERS__UART__PL011_BASE_H_
/* Genode includes */
#include <util/mmio.h>
namespace Genode { class Pl011_base; }
/**
* Driver base for the PrimeCell UART PL011 Revision r1p3
*/
class Genode::Pl011_base : Mmio
{
protected:
enum { MAX_BAUD_RATE = 0xfffffff };
/**
* Data register
*/
struct Uartdr : public Register<0x00, 16>
{
struct Data : Bitfield<0,8> { };
struct Fe : Bitfield<8,1> { };
struct Pe : Bitfield<9,1> { };
struct Be : Bitfield<10,1> { };
struct Oe : Bitfield<11,1> { };
};
/**
* Flag register
*/
struct Uartfr : public Register<0x18, 16>
{
struct Cts : Bitfield<0,1> { };
struct Dsr : Bitfield<1,1> { };
struct Dcd : Bitfield<2,1> { };
struct Busy : Bitfield<3,1> { };
struct Rxfe : Bitfield<4,1> { };
struct Txff : Bitfield<5,1> { };
struct Rxff : Bitfield<6,1> { };
struct Txfe : Bitfield<7,1> { };
struct Ri : Bitfield<8,1> { };
};
/**
* Integer baud rate register
*/
struct Uartibrd : public Register<0x24, 16>
{
struct Ibrd : Bitfield<0,15> { };
};
/**
* Fractional Baud Rate Register
*/
struct Uartfbrd : public Register<0x28, 8>
{
struct Fbrd : Bitfield<0,6> { };
};
/**
* Line Control Register
*/
struct Uartlcrh : public Register<0x2c, 16>
{
struct Wlen : Bitfield<5,2> {
enum {
WORD_LENGTH_8BITS = 3,
WORD_LENGTH_7BITS = 2,
WORD_LENGTH_6BITS = 1,
WORD_LENGTH_5BITS = 0,
};
};
};
/**
* Control Register
*/
struct Uartcr : public Register<0x30, 16>
{
struct Uarten : Bitfield<0,1> { };
struct Txe : Bitfield<8,1> { };
struct Rxe : Bitfield<9,1> { };
};
/**
* Interrupt Mask Set/Clear
*/
struct Uartimsc : public Register<0x38, 16>
{
struct Imsc : Bitfield<0,11> { };
};
/**
* Idle until the device is ready for action
*/
void _wait_until_ready() { while (read<Uartfr::Busy>()) ; }
public:
/**
* Constructor
* \param base device MMIO base
* \param clock device reference clock frequency
* \param baud_rate targeted UART baud rate
*/
inline Pl011_base(addr_t const base, uint32_t const clock,
uint32_t const baud_rate);
/**
* Send ASCII char 'c' over the UART interface
*/
inline void put_char(char const c);
};
Genode::Pl011_base::Pl011_base(addr_t const base, uint32_t const clock,
uint32_t const baud_rate) : Mmio(base)
{
write<Uartcr>(Uartcr::Uarten::bits(1) |
Uartcr::Txe::bits(1) |
Uartcr::Rxe::bits(1));
/*
* We can't print an error or throw C++ exceptions because we must expect
* both to be uninitialized yet, so its better to hold the program counter
* in here for debugging.
*/
if (baud_rate > MAX_BAUD_RATE) while(1) ;
/*
* Calculate fractional and integer part of baud rate divisor to initialize
* IBRD and FBRD.
*/
uint32_t const adjusted_br = baud_rate << 4;
double const divisor = (double)clock / adjusted_br;
Uartibrd::access_t const ibrd = (Uartibrd::access_t)divisor;
Uartfbrd::access_t const fbrd = (Uartfbrd::access_t)(((divisor - ibrd)
* 64) + 0.5);
write<Uartfbrd::Fbrd>(fbrd);
write<Uartibrd::Ibrd>(ibrd);
write<Uartlcrh::Wlen>(Uartlcrh::Wlen::WORD_LENGTH_8BITS);
/* unmask all interrupts */
write<Uartimsc::Imsc>(0);
_wait_until_ready();
}
void Genode::Pl011_base::put_char(char const c)
{
/* wait as long as the transmission buffer is full */
while (read<Uartfr::Txff>()) ;
/* transmit character */
write<Uartdr::Data>(c);
_wait_until_ready();
}
#endif /* _INCLUDE__DRIVERS__UART__PL011_BASE_H_ */
|
#define LOG_OPTION_SIZE 10
#define LOG_REGISTERS 1
#define LOG_PROCESSOR_STATUS 2
#define LOG_NEW_INSTRUCTIONS 4
#define LOG_NEW_DATA 8
#define LOG_TO_THE_LEFT 16
#define LOG_FRAMES_COUNT 32
#define LOG_MESSAGES 64
#define LOG_BREAKPOINTS 128
#define LOG_SYMBOLIC 256
#define LOG_CODE_TABBING 512
#define LOG_CYCLES_COUNT 1024
#define LOG_INSTRUCTIONS_COUNT 2048
#define LOG_LINE_MAX_LEN 160
// Frames count - 1+6+1 symbols
// Cycles count - 1+11+1 symbols
// Instructions count - 1+11+1 symbols
// AXYS state - 20
// Processor status - 11
// Tabs - 31
// Address - 6
// Data - 10
// Disassembly - 45
// EOL (/0) - 1
// ------------------------
// 148 symbols total
#define LOG_AXYSTATE_MAX_LEN 21
#define LOG_PROCSTATUS_MAX_LEN 12
#define LOG_TABS_MASK 31
#define LOG_ADDRESS_MAX_LEN 7
#define LOG_DATA_MAX_LEN 11
#define LOG_DISASSEMBLY_MAX_LEN 46
extern HWND hTracer;
extern int log_update_window;
extern volatile int logtofile, logging;
extern int logging_options;
extern bool log_old_emu_paused;
void EnableTracerMenuItems(void);
void LogInstruction(void);
void DoTracer();
void UpdateLogWindow(void);
void OutputLogLine(const char *str, std::vector<uint16>* addressesLog = 0, bool add_newline = true);
|
/*
* This file is part of Office 2007 Filters for KOffice
*
* Copyright (C) 2010 Sebastian Sauer <sebsauer@kdab.com>
* Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2010 Marijn Kruisselbrink <m.kruisselbrink@student.tue.nl>
*
* Contact: Suresh Chande suresh.chande@nokia.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef TEST_FORMULAPARSER_H
#define TEST_FORMULAPARSER_H
#include <QtTest/QtTest>
class TestFormulaParser : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testConvertFormula_data();
void testConvertFormula();
void testSharedFormulaReferences();
};
#endif // TEST_FORMULAPARSER_H
|
#include <linux/slab.h>
#include "axc_chargerfactory.h"
#include "axc_Smb346Charger.h"
#include "axc_PM8226Charger.h"
#include <linux/asus_bat.h>
#include "axc_DummyCharger.h"
#include "../axi_powerglobal.h"
//#include "../asus_bat_dbg.h"
void AXC_ChargerFactory_GetCharger(AXE_CHARGER_TYPE aeChargerType , AXI_Charger **appCharger)
{
if (NULL != *appCharger) {
printk(DBGMSK_BAT_ERR "[BAT][ChagerFactory]Memory leak...\n");
}
*appCharger = NULL;
switch(aeChargerType) {
#ifdef CONFIG_SMB_346_CHARGER
case E_SMB346_CHARGER_TYPE:
{
static AXC_SMB346Charger *lpCharger = NULL;
if(NULL == lpCharger)
{
lpCharger = kzalloc(sizeof(AXC_SMB346Charger), GFP_KERNEL);
BUG_ON(NULL == lpCharger);
}
*appCharger = &lpCharger->msParentCharger ;
AXC_SMB346Charger_Binding(*appCharger, aeChargerType);
break;
}
#endif
//case E_PM8921_CHARGER_TYPE:
//{
//static AXC_PM8921Charger *lpCharger = NULL;
//if(NULL == lpCharger)
//{
//lpCharger = kzalloc(sizeof(AXC_PM8921Charger), GFP_KERNEL);
//// BUG_ON(NULL == lpCharger);
//}
//*appCharger = &lpCharger->msParentCharger ;
//AXC_PM8921Charger_Binding(*appCharger, aeChargerType);
//break;
//}
#ifdef CONFIG_PM_8226_CHARGER
case E_PM8226_CHARGER_TYPE:
{
static AXC_PM8226Charger *lpCharger = NULL;
if(NULL == lpCharger){
lpCharger = kzalloc(sizeof(AXC_PM8226Charger), GFP_KERNEL);
}
*appCharger = &lpCharger->msParentCharger ;
AXC_PM8226Charger_Binding(*appCharger, aeChargerType);
break;
}
#endif
#ifdef CONFIG_DUMMY_CHARGER
case E_DUMMY_CHARGER_TYPE:
{
static AXC_DummyCharger *lpCharger = NULL;
if(NULL == lpCharger)
{
lpCharger = kzalloc(sizeof(AXC_DummyCharger), GFP_KERNEL);
assert(NULL != lpCharger);
}
*appCharger = &lpCharger->msParentCharger ;
AXC_DummyCharger_Binding(*appCharger, aeChargerType);
break;
}
#endif
default:
printk(DBGMSK_BAT_ERR "[BAT][ChagerFactory]Not defined type...\n");
break;
}
return;
}
void AXC_ChargerFactory_FreeCharger(AXI_Charger *apCharger)
{
if (NULL == apCharger)
return;
switch(apCharger->GetType(apCharger)) {
#ifdef CONFIG_SMB_346_CHARGER
case E_SMB346_CHARGER_TYPE:
{
AXC_SMB346Charger *lpCharger = container_of(apCharger, AXC_SMB346Charger, msParentCharger);
kfree(lpCharger);
break;
}
#endif
//case E_PM8921_CHARGER_TYPE:
//{
//AXC_PM8921Charger *lpCharger = container_of(apCharger, AXC_PM8921Charger, msParentCharger);
//kfree(lpCharger);
//break;
//}
#ifdef CONFIG_PM_8226_CHARGER
case E_PM8226_CHARGER_TYPE:
{
AXC_PM8226Charger *lpCharger = container_of(apCharger, AXC_PM8226Charger, msParentCharger);
kfree(lpCharger);
break;
}
#endif
#ifdef CONFIG_DUMMY_CHARGER
case E_DUMMY_CHARGER_TYPE:
{
AXC_DummyCharger *lpCharger = container_of(apCharger, AXC_DummyCharger, msParentCharger);
kfree(lpCharger);
break;
}
#endif
default:
printk(DBGMSK_BAT_ERR "[BAT][FreeChager]Not defined type...\n");
break;
}
}
|
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* create raw socket for icmp (IPv6 version) protocol test permission
* and drop root privileges if running setuid
*
*/
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include "libbb.h"
#ifdef CONFIG_FEATURE_IPV6
int create_icmp6_socket(void)
{
struct protoent *proto;
int sock;
proto = getprotobyname("ipv6-icmp");
/* if getprotobyname failed, just silently force
* proto->p_proto to have the correct value for "ipv6-icmp" */
sock = socket(AF_INET6, SOCK_RAW,
(proto ? proto->p_proto : IPPROTO_ICMPV6));
if (sock < 0) {
if (errno == EPERM)
bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
}
/* drop root privs if running setuid */
xsetuid(getuid());
return sock;
}
#endif
|
/**********************************************************************
Freeciv - Copyright (C) 2006 - The Freeciv Project
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, 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.
***********************************************************************/
#ifndef FC__WIDGET_ICON_H
#define FC__WIDGET_ICON_H
/* ICON */
void set_new_icon_theme(struct widget *pIcon_Widget,
SDL_Surface *pNew_Theme);
SDL_Surface *create_icon_theme_surf(SDL_Surface *pIcon);
struct widget *create_themeicon(SDL_Surface *pIcon_theme,
struct gui_layer *pDest, Uint32 flags);
SDL_Surface *create_icon_from_theme(SDL_Surface *pIcon_theme,
Uint8 state);
int draw_icon_from_theme(SDL_Surface *pIcon_theme, Uint8 state,
struct gui_layer *pDest, Sint16 start_x,
Sint16 start_y);
int draw_icon(struct widget *pIcon, Sint16 start_x, Sint16 start_y);
/* ICON2 */
void set_new_icon2_theme(struct widget *pIcon_Widget, SDL_Surface *pNew_Theme,
bool free_old_theme);
struct widget *create_icon2(SDL_Surface *pIcon, struct gui_layer *pDest, Uint32 flags);
#endif /* FC__WIDGET_ICON_H */
|
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <xtables.h>
#include <linux/netfilter/xt_connlabel.h>
enum {
O_LABEL = 0,
O_SET = 1,
};
#define CONNLABEL_CFG "/etc/xtables/connlabel.conf"
static void connlabel_mt_help(void)
{
puts(
"connlabel match options:\n"
"[!] --label name Match if label has been set on connection\n"
" --set Set label on connection");
}
static const struct xt_option_entry connlabel_mt_opts[] = {
{.name = "label", .id = O_LABEL, .type = XTTYPE_STRING,
.min = 1, .flags = XTOPT_MAND|XTOPT_INVERT},
{.name = "set", .id = O_SET, .type = XTTYPE_NONE},
XTOPT_TABLEEND,
};
static int
xtables_parse_connlabel_numerical(const char *s, char **end)
{
uintmax_t value;
if (!xtables_strtoul(s, end, &value, 0, XT_CONNLABEL_MAXBIT))
return -1;
return value;
}
static bool is_space_posix(int c)
{
return c == ' ' || c == '\f' || c == '\r' || c == '\t' || c == '\v';
}
static char * trim_label(char *label)
{
char *end;
while (is_space_posix(*label))
label++;
end = strchr(label, '\n');
if (end)
*end = 0;
else
end = strchr(label, '\0');
end--;
while (is_space_posix(*end) && end > label) {
*end = 0;
end--;
}
return *label ? label : NULL;
}
static void
xtables_get_connlabel(uint16_t bit, char *buf, size_t len)
{
FILE *fp = fopen(CONNLABEL_CFG, "r");
char label[1024];
char *end;
if (!fp)
goto error;
while (fgets(label, sizeof(label), fp)) {
int tmp;
if (label[0] == '#')
continue;
tmp = xtables_parse_connlabel_numerical(label, &end);
if (tmp < 0 || tmp < (int) bit)
continue;
if (tmp > (int) bit)
break;
end = trim_label(end);
if (!end)
continue;
snprintf(buf, len, "%s", end);
fclose(fp);
return;
}
fclose(fp);
error:
snprintf(buf, len, "%u", (unsigned int) bit);
}
static uint16_t xtables_parse_connlabel(const char *s)
{
FILE *fp = fopen(CONNLABEL_CFG, "r");
char label[1024];
char *end;
int bit;
if (!fp)
xtables_error(PARAMETER_PROBLEM, "label '%s': could not open '%s': %s",
s, CONNLABEL_CFG, strerror(errno));
while (fgets(label, sizeof(label), fp)) {
if (label[0] == '#' || !strstr(label, s))
continue;
bit = xtables_parse_connlabel_numerical(label, &end);
if (bit < 0)
continue;
end = trim_label(end);
if (!end)
continue;
if (strcmp(end, s) == 0) {
fclose(fp);
return bit;
}
}
fclose(fp);
xtables_error(PARAMETER_PROBLEM, "label '%s' not found in config file %s",
s, CONNLABEL_CFG);
}
static void connlabel_mt_parse(struct xt_option_call *cb)
{
struct xt_connlabel_mtinfo *info = cb->data;
int tmp;
xtables_option_parse(cb);
switch (cb->entry->id) {
case O_LABEL:
tmp = xtables_parse_connlabel_numerical(cb->arg, NULL);
info->bit = tmp < 0 ? xtables_parse_connlabel(cb->arg) : tmp;
if (cb->invert)
info->options |= XT_CONNLABEL_OP_INVERT;
break;
case O_SET:
info->options |= XT_CONNLABEL_OP_SET;
break;
}
}
static void
connlabel_mt_print_op(const struct xt_connlabel_mtinfo *info, const char *prefix)
{
if (info->options & XT_CONNLABEL_OP_SET)
printf(" %sset", prefix);
}
static void
connlabel_mt_print(const void *ip, const struct xt_entry_match *match, int numeric)
{
const struct xt_connlabel_mtinfo *info = (const void *)match->data;
char buf[1024];
printf(" connlabel");
if (info->options & XT_CONNLABEL_OP_INVERT)
printf(" !");
if (numeric) {
printf(" %u", info->bit);
} else {
xtables_get_connlabel(info->bit, buf, sizeof(buf));
printf(" '%s'", buf);
}
connlabel_mt_print_op(info, "");
}
static void
connlabel_mt_save(const void *ip, const struct xt_entry_match *match)
{
const struct xt_connlabel_mtinfo *info = (const void *)match->data;
char buf[1024];
if (info->options & XT_CONNLABEL_OP_INVERT)
printf(" !");
xtables_get_connlabel(info->bit, buf, sizeof(buf));
printf(" --label \"%s\"", buf);
connlabel_mt_print_op(info, "--");
}
static struct xtables_match connlabel_mt_reg = {
.family = NFPROTO_UNSPEC,
.name = "connlabel",
.version = XTABLES_VERSION,
.size = XT_ALIGN(sizeof(struct xt_connlabel_mtinfo)),
.userspacesize = offsetof(struct xt_connlabel_mtinfo, bit),
.help = connlabel_mt_help,
.print = connlabel_mt_print,
.save = connlabel_mt_save,
.x6_parse = connlabel_mt_parse,
.x6_options = connlabel_mt_opts,
};
void _init(void)
{
xtables_register_match(&connlabel_mt_reg);
}
|
/**********************************************************************
** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the Qt Assistant.
**
** This file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the files LICENSE.GPL2
** and LICENSE.GPL3 included in the packaging of this file.
** Alternatively you may (at your option) use any later version
** of the GNU General Public License if such license has been
** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free Qt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with
** the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/
#ifndef CONFIG_H
#define CONFIG_H
#include "profile.h"
#include <qstring.h>
#include <qstringlist.h>
#include <qpixmap.h>
#include <qmap.h>
class Profile;
class Config
{
public:
Config();
void load();
void save();
Profile *profile() const { return profil; }
QString profileName() const { return profil->props["name"]; }
bool validProfileName() const;
void hideSideBar( bool b );
bool sideBarHidden() const;
QStringList mimePaths();
// From profile, read only
QStringList docFiles() const;
QStringList docTitles() const;
QString indexPage( const QString &title ) const;
QString docImageDir( const QString &title ) const;
QPixmap docIcon( const QString &title ) const;
QStringList profiles() const;
QString title() const;
QString aboutApplicationMenuText() const;
QString aboutURL() const;
QPixmap applicationIcon() const;
// From QSettings, read / write
QString webBrowser() const { return webBrows; }
void setWebBrowser( const QString &cmd ) { webBrows = cmd; }
QString homePage() const;
void setHomePage( const QString &hom ) { home = hom; }
QString pdfReader() const { return pdfApp; }
void setPdfReader( const QString &cmd ) { pdfApp = cmd; }
int fontSize() const { return fontSiz; }
void setFontSize( int size ) { fontSiz = size; }
QString fontFamily() const { return fontFam; }
void setFontFamily( const QString &fam ) { fontFam = fam; }
QString fontFixedFamily() const { return fontFix; }
void setFontFixedFamily( const QString &fn ) { fontFix = fn; }
QString linkColor() const { return linkCol; }
void setLinkColor( const QString &col ) { linkCol = col; }
QStringList source() const;
void setSource( const QStringList &s ) { src = s; }
int sideBarPage() const { return sideBar; }
void setSideBarPage( int sbp ) { sideBar = sbp; }
QRect geometry() const { return geom; }
void setGeometry( const QRect &geo ) { geom = geo; }
bool isMaximized() const { return maximized; }
void setMaximized( bool max ) { maximized = max; }
bool isLinkUnderline() const { return linkUnder; }
void setLinkUnderline( bool ul ) { linkUnder = ul; }
QString mainWindowLayout() const { return mainWinLayout; }
void setMainWindowLayout( const QString &layout ) { mainWinLayout = layout; }
QString assistantDocPath() const;
bool docRebuild() const { return rebuildDocs; }
void setDocRebuild( bool rb ) { rebuildDocs = rb; }
void saveProfile( Profile *profile );
void loadDefaultProfile();
static Config *configuration();
static Config *loadConfig(const QString &profileFileName);
private:
Config( const Config &c );
Config& operator=( const Config &c );
void saveSettings();
private:
Profile *profil;
QStringList profileNames;
QString webBrows;
QString home;
QString pdfApp;
QString fontFam;
QString fontFix;
QString linkCol;
QStringList src;
QString mainWinLayout;
QRect geom;
int sideBar;
int fontSiz;
bool maximized;
bool linkUnder;
bool hideSidebar;
bool rebuildDocs;
};
#endif
|
/* Test of <errno.h> substitute.
Copyright (C) 2008-2019 Free Software Foundation, 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 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 <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2008. */
#include <config.h>
#include <errno.h>
/* Verify that the POSIX mandated errno values exist and can be used as
initializers outside of a function.
The variable names happen to match the Linux/x86 error numbers. */
int e1 = EPERM;
int e2 = ENOENT;
int e3 = ESRCH;
int e4 = EINTR;
int e5 = EIO;
int e6 = ENXIO;
int e7 = E2BIG;
int e8 = ENOEXEC;
int e9 = EBADF;
int e10 = ECHILD;
int e11 = EAGAIN;
int e11a = EWOULDBLOCK;
int e12 = ENOMEM;
int e13 = EACCES;
int e14 = EFAULT;
int e16 = EBUSY;
int e17 = EEXIST;
int e18 = EXDEV;
int e19 = ENODEV;
int e20 = ENOTDIR;
int e21 = EISDIR;
int e22 = EINVAL;
int e23 = ENFILE;
int e24 = EMFILE;
int e25 = ENOTTY;
int e26 = ETXTBSY;
int e27 = EFBIG;
int e28 = ENOSPC;
int e29 = ESPIPE;
int e30 = EROFS;
int e31 = EMLINK;
int e32 = EPIPE;
int e33 = EDOM;
int e34 = ERANGE;
int e35 = EDEADLK;
int e36 = ENAMETOOLONG;
int e37 = ENOLCK;
int e38 = ENOSYS;
int e39 = ENOTEMPTY;
int e40 = ELOOP;
int e42 = ENOMSG;
int e43 = EIDRM;
int e67 = ENOLINK;
int e71 = EPROTO;
int e72 = EMULTIHOP;
int e74 = EBADMSG;
int e75 = EOVERFLOW;
int e84 = EILSEQ;
int e88 = ENOTSOCK;
int e89 = EDESTADDRREQ;
int e90 = EMSGSIZE;
int e91 = EPROTOTYPE;
int e92 = ENOPROTOOPT;
int e93 = EPROTONOSUPPORT;
int e95 = EOPNOTSUPP;
int e95a = ENOTSUP;
int e97 = EAFNOSUPPORT;
int e98 = EADDRINUSE;
int e99 = EADDRNOTAVAIL;
int e100 = ENETDOWN;
int e101 = ENETUNREACH;
int e102 = ENETRESET;
int e103 = ECONNABORTED;
int e104 = ECONNRESET;
int e105 = ENOBUFS;
int e106 = EISCONN;
int e107 = ENOTCONN;
int e110 = ETIMEDOUT;
int e111 = ECONNREFUSED;
int e113 = EHOSTUNREACH;
int e114 = EALREADY;
int e115 = EINPROGRESS;
int e116 = ESTALE;
int e122 = EDQUOT;
int e125 = ECANCELED;
int e130 = EOWNERDEAD;
int e131 = ENOTRECOVERABLE;
/* Don't verify that these errno values are all different, except for possibly
EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has
ENOTSUP == EOPNOTSUPP. */
int
main ()
{
/* Verify that errno can be assigned. */
errno = EOVERFLOW;
/* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */
if (errno == EINVAL)
return 1;
return 0;
}
|
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, 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 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/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plMultistageBehMod_h_inc
#define plMultistageBehMod_h_inc
#include "pnModifier/plSingleModifier.h"
class plAnimStageVec;
class plMultistageBehMod : public plSingleModifier
{
protected:
plAnimStageVec* fStages;
bool fFreezePhys;
bool fSmartSeek;
bool fReverseFBControlsOnRelease;
bool fNetProp;
bool fNetForce;
std::vector<plKey> fReceivers;
void IDeleteStageVec();
virtual bool IEval(double secs, float del, uint32_t dirty) { return true; }
public:
plMultistageBehMod();
plMultistageBehMod(plAnimStageVec* stages, bool freezePhys, bool smartSeek, bool reverseFBControlsOnRelease, std::vector<plKey>* receivers);
virtual ~plMultistageBehMod();
CLASSNAME_REGISTER( plMultistageBehMod );
GETINTERFACE_ANY( plMultistageBehMod, plSingleModifier );
bool NetProp() { return fNetProp; }
bool NetForce() { return fNetForce; }
void SetNetProp(bool netProp) { fNetProp = netProp; }
void SetNetForce(bool netForce) { fNetForce = netForce; }
bool MsgReceive(plMessage* msg);
virtual void Init(plAnimStageVec *stages, bool freezePhys, bool smartSeek, bool reverseFBControlsOnRelease, std::vector<plKey>* receivers);
virtual void Read(hsStream *stream, hsResMgr *mgr);
virtual void Write(hsStream *stream, hsResMgr *mgr);
};
#endif // plMultistageBehMod_h_inc
|
//____________________________________________________________________________
/*!
\class genie::exceptions::INukeException
\brief An exception thrown by SimulateHadronState for kinematics problems.
TwoBodyCollision/Kinematics used a lot, has various failure modes.
When failure occurs in HAIntranuke, rechoose the fate.
\author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
STFC, Rutherford Appleton Laboratory
Steve Dytman <dytman \at pitt.edu>
Univ. of Pittsburgh
\created October 10, 2011
\cpright Copyright (c) 2003-2013, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
*/
//____________________________________________________________________________
#ifndef _INUKE_EXCEPTION_H_
#define _INUKE_EXCEPTION_H_
#include <string>
#include <ostream>
#include <TMath.h>
using std::string;
using std::ostream;
namespace genie {
namespace exceptions {
class INukeException {
public :
INukeException();
INukeException(const INukeException & exception);
~INukeException();
void SetReason(string reason) { fReason = reason; }
string ShowReason(void) const { return fReason; }
void Init (void);
void Copy (const INukeException & exception);
void Print (ostream & stream) const;
friend ostream & operator << (
ostream & stream, const INukeException & exception);
private:
string fReason;
};
} // exceptions namespace
} // genie namespace
#endif // _INUKE_EXCEPTION_H_
|
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_raw.c 201107 2009-12-28 03:25:33Z kientzle $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "archive.h"
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_private.h"
struct raw_info {
int64_t offset; /* Current position in the file. */
int64_t unconsumed;
int end_of_file;
};
static int archive_read_format_raw_bid(struct archive_read *, int);
static int archive_read_format_raw_cleanup(struct archive_read *);
static int archive_read_format_raw_read_data(struct archive_read *,
const void **, size_t *, int64_t *);
static int archive_read_format_raw_read_data_skip(struct archive_read *);
static int archive_read_format_raw_read_header(struct archive_read *,
struct archive_entry *);
int
archive_read_support_format_raw(struct archive *_a)
{
struct raw_info *info;
struct archive_read *a = (struct archive_read *)_a;
int r;
archive_check_magic(_a, ARCHIVE_READ_MAGIC,
ARCHIVE_STATE_NEW, "archive_read_support_format_raw");
info = (struct raw_info *)calloc(1, sizeof(*info));
if (info == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate raw_info data");
return (ARCHIVE_FATAL);
}
r = __archive_read_register_format(a,
info,
"raw",
archive_read_format_raw_bid,
NULL,
archive_read_format_raw_read_header,
archive_read_format_raw_read_data,
archive_read_format_raw_read_data_skip,
archive_read_format_raw_cleanup);
if (r != ARCHIVE_OK)
free(info);
return (r);
}
/*
* Bid 1 if this is a non-empty file. Anyone who can really support
* this should outbid us, so it should generally be safe to use "raw"
* in conjunction with other formats. But, this could really confuse
* folks if there are bid errors or minor file damage, so we don't
* include "raw" as part of support_format_all().
*/
static int
archive_read_format_raw_bid(struct archive_read *a, int best_bid)
{
if (best_bid < 1 && __archive_read_ahead(a, 1, NULL) != NULL)
return (1);
return (-1);
}
/*
* Mock up a fake header.
*/
static int
archive_read_format_raw_read_header(struct archive_read *a,
struct archive_entry *entry)
{
struct raw_info *info;
info = (struct raw_info *)(a->format->data);
if (info->end_of_file)
return (ARCHIVE_EOF);
a->archive.archive_format = ARCHIVE_FORMAT_RAW;
a->archive.archive_format_name = "raw";
archive_entry_set_pathname(entry, "data");
archive_entry_set_filetype(entry, AE_IFREG);
archive_entry_set_perm(entry, 0644);
/* I'm deliberately leaving most fields unset here. */
return (ARCHIVE_OK);
}
static int
archive_read_format_raw_read_data(struct archive_read *a,
const void **buff, size_t *size, int64_t *offset)
{
struct raw_info *info;
ssize_t avail;
info = (struct raw_info *)(a->format->data);
/* Consume the bytes we read last time. */
if (info->unconsumed) {
__archive_read_consume(a, info->unconsumed);
info->unconsumed = 0;
}
if (info->end_of_file)
return (ARCHIVE_EOF);
/* Get whatever bytes are immediately available. */
*buff = __archive_read_ahead(a, 1, &avail);
if (avail > 0) {
/* Return the bytes we just read */
*size = avail;
*offset = info->offset;
info->offset += *size;
info->unconsumed = avail;
return (ARCHIVE_OK);
} else if (0 == avail) {
/* Record and return end-of-file. */
info->end_of_file = 1;
*size = 0;
*offset = info->offset;
return (ARCHIVE_EOF);
} else {
/* Record and return an error. */
*size = 0;
*offset = info->offset;
return (avail);
}
}
static int
archive_read_format_raw_read_data_skip(struct archive_read *a)
{
struct raw_info *info = (struct raw_info *)(a->format->data);
/* Consume the bytes we read last time. */
if (info->unconsumed) {
__archive_read_consume(a, info->unconsumed);
info->unconsumed = 0;
}
info->end_of_file = 1;
return (ARCHIVE_OK);
}
static int
archive_read_format_raw_cleanup(struct archive_read *a)
{
struct raw_info *info;
info = (struct raw_info *)(a->format->data);
free(info);
a->format->data = NULL;
return (ARCHIVE_OK);
}
|
/*
* This file is part of Cleanflight.
*
* Cleanflight 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.
*
* Cleanflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <platform.h>
#include "drivers/io.h"
#include "drivers/timer.h"
#include "drivers/timer_def.h"
#include "drivers/dma.h"
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
DEF_TIM(TIM2, CH2, PA1, TIM_USE_PPM | TIM_USE_TRANSPONDER, TIMER_INPUT_ENABLED), // PPM IN
DEF_TIM(TIM3, CH3, PB0, TIM_USE_PWM, TIMER_OUTPUT_ENABLED), // SS1Rx
DEF_TIM(TIM3, CH2, PB5, TIM_USE_PWM, TIMER_OUTPUT_ENABLED), // SS1Tx
DEF_TIM(TIM8, CH3, PB9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // S1
DEF_TIM(TIM4, CH3, PB8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // S2
DEF_TIM(TIM4, CH2, PB7, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // S3
DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // S4
DEF_TIM(TIM15, CH1, PA2, TIM_USE_LED, 1), // GPIO TIMER - LED_STRIP
};
|
#ifndef CRYSTALFIELDMAGNETISATIONTEST_H_
#define CRYSTALFIELDMAGNETISATIONTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidAPI/FunctionDomain1D.h"
#include "MantidAPI/FunctionValues.h"
#include "MantidAPI/FunctionFactory.h"
#include "MantidAPI/ParameterTie.h"
#include "MantidCurveFitting/Functions/CrystalFieldMagnetisation.h"
using namespace Mantid;
using namespace Mantid::API;
using namespace Mantid::CurveFitting;
using namespace Mantid::CurveFitting::Functions;
class CrystalFieldMagnetisationTest : public CxxTest::TestSuite {
public:
void test_evaluate() {
CrystalFieldMagnetisation fun;
fun.setParameter("B20", 0.37737);
fun.setParameter("B22", 3.9770);
fun.setParameter("B40", -0.031787);
fun.setParameter("B42", -0.11611);
fun.setParameter("B44", -0.12544);
fun.setAttributeValue("Ion", "Ce");
fun.setAttributeValue("Unit", "bohr");
fun.setAttributeValue("Hdir", std::vector<double>{1., 1., 1.});
fun.setAttributeValue("Temperature", 10.);
FunctionDomain1DVector x(0.0, 30.0, 100);
FunctionValues y(x);
fun.function(x, y);
// Test values obtained from McPhase, interpolated by a polynomial
auto testFun1 = FunctionFactory::Instance().createInitialized(
"name=UserFunction,Formula=a*x*x*x+b*x*x+c*x+d,"
"a=4.75436e-5,b=-4.10695e-3,c=0.12358,d=-2.2236e-2");
FunctionValues t(x);
testFun1->function(x, t);
for (size_t i = 0; i < x.size(); ++i) {
TS_ASSERT_DELTA(y[i], t[i], 0.05);
}
}
void test_factory() {
std::string funDef =
"name=CrystalFieldMagnetisation,Ion=Nd,Symmetry=C2v,"
"Unit=bohr,Hdir=(1,-1,2),Temperature=11.5,powder=1,"
"B20=0.37,B22=3.9, B40=-0.03,B42=-0.1,B44=-0.12, "
"ties=(BmolX=0,BmolY=0,BmolZ=0,BextX=0,BextY=0,BextZ=0)";
auto fun = FunctionFactory::Instance().createInitialized(funDef);
TS_ASSERT(fun);
TS_ASSERT_EQUALS(fun->name(), "CrystalFieldMagnetisation");
TS_ASSERT_EQUALS(fun->getAttribute("Ion").asString(), "Nd");
TS_ASSERT_EQUALS(fun->getAttribute("Symmetry").asString(), "C2v");
TS_ASSERT_EQUALS(fun->getAttribute("Temperature").asDouble(), 11.5);
TS_ASSERT_EQUALS(fun->getAttribute("Unit").asString(), "bohr");
auto Hdir = fun->getAttribute("Hdir").asVector();
TS_ASSERT_EQUALS(Hdir[0], 1);
TS_ASSERT_EQUALS(Hdir[1], -1);
TS_ASSERT_EQUALS(Hdir[2], 2);
TS_ASSERT_EQUALS(fun->getAttribute("powder").asBool(), true);
TS_ASSERT_EQUALS(fun->getParameter("B20"), 0.37);
size_t nTies = 0;
for (size_t i = 0; i < fun->nParams(); ++i) {
auto tie = fun->getTie(i);
if (tie) {
++nTies;
}
}
TS_ASSERT_EQUALS(nTies, 0);
}
};
#endif /*CRYSTALFIELDMAGNETISATIONTEST_H_*/
|
/*
This file is part of TinyGarble. It is modified version of JustGarble
under GNU license.
TinyGarble 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.
TinyGarble 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 TinyGarble. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UTIL_UTIL_H_
#define UTIL_UTIL_H_
#include "garbled_circuit/garbled_circuit_util.h"
#include "crypto/block.h"
#include <openssl/bn.h>
#include <vector>
#include <ostream>
#include <string>
using std::string;
using std::vector;
block RandomBlock();
void SrandSSE(unsigned int seed);
unsigned short Type2V(int gateType);
bool GateOperator(int gateType, bool input0, bool input1 = false);
int Str2Block(const string &s, block* v);
string to_string_hex(uint64_t v, int pad = 0);
int OutputBN2StrHighMem(const GarbledCircuit& garbled_circuit, BIGNUM* outputs,
uint64_t clock_cycles, OutputMode output_mode,
string *output_str);
int OutputBN2StrLowMem(const GarbledCircuit& garbled_circuit, BIGNUM* outputs,
uint64_t clock_cycles, OutputMode output_mode,
string* output_str);
string formatGCInputString(vector<uint64_t>, vector<uint16_t>);
void parseGCOutputString(vector<int64_t> &, string, vector<uint16_t>, uint16_t);
string towsComplement(string);
string dec2bin(int64_t, uint16_t);
int64_t bin2dec(string, bool);
string hex2bin(string);
string bin2hex(string);
string formatGCOutputMask(uint16_t , uint16_t , bool );
string ReadFileOrPassHex(string file_hex_str);
bool icompare(std::string const& a, std::string const& b);
#endif /* UTIL_UTIL_H_ */
|
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING); if not, see
* http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h> /* dev_t, ino_t, off_t, ... */
#include <sys/stat.h> /* struct stat */
#include <fcntl.h> /* O_WRONLY for logfile_reopen */
#include <stdint.h>
#include <stdbool.h>
#include "config.h"
#include "screen.h"
#include "logfile.h"
#include "misc.h"
static void changed_logfile(struct logfile *);
static struct logfile *lookup_logfile(char *);
static int stolen_logfile(struct logfile *);
static struct logfile *logroot = NULL;
static void changed_logfile(struct logfile *l)
{
struct stat o, *s = l->st;
if (fstat(fileno(l->fp), &o) < 0) /* get trouble later */
return;
if (o.st_size > s->st_size) { /* aha, appended text */
s->st_size = o.st_size; /* this should have changed */
s->st_mtime = o.st_mtime; /* only size and mtime */
}
}
/*
* Requires fd to be open and need_fd to be closed.
* If possible, need_fd will be open afterwards and refer to
* the object originally reffered by fd. fd will be closed then.
* Works just like ``fcntl(fd, DUPFD, need_fd); close(fd);''
*
* need_fd is returned on success, else -1 is returned.
*/
int lf_move_fd(int fd, int need_fd)
{
int r = -1;
if (fd == need_fd)
return fd;
if (fd >= 0 && fd < need_fd)
r = lf_move_fd(dup(fd), need_fd);
close(fd);
return r;
}
static int logfile_reopen(char *name, int wantfd, struct logfile *l)
{
int got_fd;
close(wantfd);
if (((got_fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0) || lf_move_fd(got_fd, wantfd) < 0) {
logfclose(l);
return -1;
}
changed_logfile(l);
l->st->st_ino = l->st->st_dev = 0;
return 0;
}
/*
* If the logfile has been removed, truncated, unlinked or the like,
* return nonzero.
* The l->st structure initialised by logfopen is updated
* on every call.
*/
static int stolen_logfile(struct logfile *l)
{
struct stat o, *s = l->st;
o = *s;
if (fstat(fileno(l->fp), s) < 0) /* remember that stat failed */
s->st_ino = s->st_dev = 0;
if (!o.st_dev && !o.st_ino) /* nothing to compare with */
return 0;
if ((!s->st_dev && !s->st_ino) || /* stat failed, that's new! */
!s->st_nlink || /* red alert: file unlinked */
(s->st_size < o.st_size) || /* file truncated */
(s->st_mtime != o.st_mtime) || /* file modified */
((s->st_ctime != o.st_ctime) && /* file changed (moved) */
!(s->st_mtime == s->st_ctime && /* and it was not a change */
o.st_ctime < s->st_ctime))) { /* due to delayed nfs write */
return -1;
}
return 0;
}
static struct logfile *lookup_logfile(char *name)
{
struct logfile *l;
for (l = logroot; l; l = l->next)
if (!strcmp(name, l->name))
return l;
return NULL;
}
struct logfile *logfopen(char *name, FILE * fp)
{
struct logfile *l;
if (!fp) {
if (!(l = lookup_logfile(name)))
return NULL;
l->opencount++;
return l;
}
if (!(l = malloc(sizeof(struct logfile))))
return NULL;
if (!(l->st = malloc(sizeof(struct stat)))) {
free((char *)l);
return NULL;
}
if (!(l->name = SaveStr(name))) {
free((char *)l->st);
free((char *)l);
return NULL;
}
l->fp = fp;
l->opencount = 1;
l->writecount = 0;
l->flushcount = 0;
changed_logfile(l);
l->next = logroot;
logroot = l;
return l;
}
int islogfile(char *name)
{
if (!name)
return logroot ? 1 : 0;
return lookup_logfile(name) ? 1 : 0;
}
int logfclose(struct logfile *l)
{
struct logfile **lp;
for (lp = &logroot; *lp; lp = &(*lp)->next)
if (*lp == l)
break;
if (!*lp)
return -1;
if ((--l->opencount) > 0)
return 0;
if (l->opencount < 0)
abort();
*lp = l->next;
fclose(l->fp);
free(l->name);
free((char *)l);
return 0;
}
/*
* XXX
* write and flush both *should* check the file's stat, if it disappeared
* or changed, re-open it.
*/
int logfwrite(struct logfile *l, char *buf, int n)
{
int r;
if (stolen_logfile(l) && logfile_reopen(l->name, fileno(l->fp), l))
return -1;
r = fwrite(buf, n, 1, l->fp);
l->writecount += l->flushcount + 1;
l->flushcount = 0;
changed_logfile(l);
return r;
}
int logfflush(struct logfile *l)
{
int r = 0;
if (!l)
for (l = logroot; l; l = l->next) {
if (stolen_logfile(l) && logfile_reopen(l->name, fileno(l->fp), l))
return -1;
r |= fflush(l->fp);
l->flushcount++;
changed_logfile(l);
} else {
if (stolen_logfile(l) && logfile_reopen(l->name, fileno(l->fp), l))
return -1;
r = fflush(l->fp);
l->flushcount++;
changed_logfile(l);
}
return r;
}
|
/*
GDB RSP and ARM Simulator
Copyright (C) 2015 Wong Yan Yin, <jet_wong@hotmail.com>,
Jackson Teh Ka Sing, <jackson_dmc69@hotmail.com>
This file is part of GDB RSP and ARM Simulator.
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 VNEG_H
#define VNEG_H
#include <stdint.h>
#include "ConditionalExecution.h"
#include "ITandHints.h"
#include "StatusRegisters.h"
#include "ARMRegisters.h"
#include "getAndSetBits.h"
#include "getMask.h"
#include <assert.h>
#include <stdio.h>
void VNEG(uint32_t instruction);
#endif // VNEG_H
|
#ifndef _vtkMDHWSource_h
#define _vtkMDHWSource_h
#include "MantidKernel/make_unique.h"
#include "MantidVatesAPI/Normalization.h"
#include "vtkStructuredGridAlgorithm.h"
#include <string>
namespace Mantid {
namespace VATES {
class MDLoadingPresenter;
}
}
/* Source for fetching Multidimensional Workspace out of the Mantid Analysis
Data Service
and converting them into vtkDataSets as part of the pipeline source.
@date 01/12/2011
Copyright © 2007-9 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid 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.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
// cppcheck-suppress class_X_Y
class VTK_EXPORT vtkMDHWSource : public vtkStructuredGridAlgorithm {
public:
vtkMDHWSource(const vtkMDHWSource &) = delete;
void operator=(const vtkMDHWSource &) = delete;
static vtkMDHWSource *New();
vtkTypeMacro(vtkMDHWSource, vtkStructuredGridAlgorithm) void PrintSelf(
ostream &os, vtkIndent indent) override;
void SetWsName(const std::string &wsName);
//------- MDLoadingView methods ----------------
virtual double getTime() const;
virtual size_t getRecursionDepth() const;
virtual bool getLoadInMemory() const;
//----------------------------------------------
/// Update the algorithm progress.
void updateAlgorithmProgress(double progress, const std::string &message);
/// Getter for the input geometry xml
std::string GetInputGeometryXML();
/// Getter for the special coodinate value
int GetSpecialCoordinates();
/// Getter for the workspace name
const std::string &GetWorkspaceName();
/// Getter for the workspace type
std::string GetWorkspaceTypeName();
/// Getter for the maximum value of the workspace data
std::string GetInstrument();
/// Setter for the normalization
void SetNormalization(int option);
protected:
vtkMDHWSource();
~vtkMDHWSource() override;
int RequestInformation(vtkInformation *, vtkInformationVector **,
vtkInformationVector *) override;
int RequestData(vtkInformation *, vtkInformationVector **,
vtkInformationVector *) override;
private:
/// Name of the workspace.
std::string m_wsName;
/// Time.
double m_time;
/// MVP presenter.
std::unique_ptr<Mantid::VATES::MDLoadingPresenter> m_presenter;
/// Normalization Option
Mantid::VATES::VisualNormalization m_normalizationOption;
void setTimeRange(vtkInformationVector *outputVector);
};
#endif
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "InformationElements"
* found in "../asn/InformationElements.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#ifndef _CBS_DRX_Level1Information_extension_r6_H_
#define _CBS_DRX_Level1Information_extension_r6_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum CBS_DRX_Level1Information_extension_r6 {
CBS_DRX_Level1Information_extension_r6_p8 = 0,
CBS_DRX_Level1Information_extension_r6_p16 = 1,
CBS_DRX_Level1Information_extension_r6_p32 = 2,
CBS_DRX_Level1Information_extension_r6_p64 = 3,
CBS_DRX_Level1Information_extension_r6_p128 = 4,
CBS_DRX_Level1Information_extension_r6_p256 = 5
} e_CBS_DRX_Level1Information_extension_r6;
/* CBS-DRX-Level1Information-extension-r6 */
typedef long CBS_DRX_Level1Information_extension_r6_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_CBS_DRX_Level1Information_extension_r6;
asn_struct_free_f CBS_DRX_Level1Information_extension_r6_free;
asn_struct_print_f CBS_DRX_Level1Information_extension_r6_print;
asn_constr_check_f CBS_DRX_Level1Information_extension_r6_constraint;
ber_type_decoder_f CBS_DRX_Level1Information_extension_r6_decode_ber;
der_type_encoder_f CBS_DRX_Level1Information_extension_r6_encode_der;
xer_type_decoder_f CBS_DRX_Level1Information_extension_r6_decode_xer;
xer_type_encoder_f CBS_DRX_Level1Information_extension_r6_encode_xer;
per_type_decoder_f CBS_DRX_Level1Information_extension_r6_decode_uper;
per_type_encoder_f CBS_DRX_Level1Information_extension_r6_encode_uper;
#ifdef __cplusplus
}
#endif
#endif /* _CBS_DRX_Level1Information_extension_r6_H_ */
#include <asn_internal.h>
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTEXTEDIT_P_H
#define QTEXTEDIT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "private/qabstractscrollarea_p.h"
#include "QtGui/qtextdocumentfragment.h"
#include "QtWidgets/qscrollbar.h"
#include "QtGui/qtextcursor.h"
#include "QtGui/qtextformat.h"
#include "QtWidgets/qmenu.h"
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "QtCore/qurl.h"
#include "private/qwidgettextcontrol_p.h"
#include "qtextedit.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTEDIT
class QMimeData;
class QTextEditPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QTextEdit)
public:
QTextEditPrivate();
void init(const QString &html = QString());
void paint(QPainter *p, QPaintEvent *e);
void _q_repaintContents(const QRectF &contentsRect);
inline QPoint mapToContents(const QPoint &point) const
{ return QPoint(point.x() + horizontalOffset(), point.y() + verticalOffset()); }
void _q_adjustScrollbars();
void _q_ensureVisible(const QRectF &rect);
void relayoutDocument();
void createAutoBulletList();
void pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode);
inline int horizontalOffset() const
{ return q_func()->isRightToLeft() ? (hbar->maximum() - hbar->value()) : hbar->value(); }
inline int verticalOffset() const
{ return vbar->value(); }
inline void sendControlEvent(QEvent *e)
{ control->processEvent(e, QPointF(horizontalOffset(), verticalOffset()), viewport); }
void _q_currentCharFormatChanged(const QTextCharFormat &format);
void _q_cursorPositionChanged();
void updateDefaultTextOption();
// re-implemented by QTextBrowser, called by QTextDocument::loadResource
virtual QUrl resolveUrl(const QUrl &url) const
{ return url; }
QWidgetTextControl *control;
QTextEdit::AutoFormatting autoFormatting;
bool tabChangesFocus;
QBasicTimer autoScrollTimer;
QPoint autoScrollDragPos;
QTextEdit::LineWrapMode lineWrap;
int lineWrapColumnOrWidth;
QTextOption::WrapMode wordWrap;
uint ignoreAutomaticScrollbarAdjustment : 1;
uint preferRichText : 1;
uint showCursorOnInitialShow : 1;
uint inDrag : 1;
uint clickCausedFocus : 1;
// Qt3 COMPAT only, for setText
Qt::TextFormat textFormat;
QString anchorToScrollToWhenVisible;
QString placeholderText;
#ifdef QT_KEYPAD_NAVIGATION
QBasicTimer deleteAllTimer;
#endif
};
#endif // QT_NO_TEXTEDIT
QT_END_NAMESPACE
#endif // QTEXTEDIT_P_H
|
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#pragma ident "@(#) libfi/mpp_scan/scanmax_js_1.c 92.1 07/13/99 10:21:33"
#include <stdlib.h>
#include <liberrno.h>
#include <fmath.h>
#include <cray/dopevec.h>
#include "f90_macros.h"
#define RANK 1
/*
* Compiler generated call: CALL _SCANMAX_JS1(RES, SRC, STOP, DIM, MASK)
*
* Purpose: Determine the maximum value of the elements of SRC
* along dimension DIM corresponding to the true elements
* of MASK. This particular routine handles source arrays
* of rank 1 with a data type of 64-bit integer.
*
* Arguments:
* RES - Dope vector for temporary result array
* SRC - Dope vector for user source array
* STOP - Dope vector for stop array
* DIM - Dimension to operate along
* MASK - Dope vector for logical mask array
*
* Description:
* This is the MPP single PE version of SCANMAX. This
* routine checks the scope of the source and mask
* arrays and if they are private, calls the current
* Y-MP single processor version of the routine. If they
* are shared, then it allocates a result array before
* calling a Fortran routine which declares the source
* and mask arguments to be UNKNOWN SHARED.
*
* Include file segmented_scan_s.h contains the rank independent
* source code for this routine.
*/
_SCANMAX_JS1 ( DopeVectorType *result,
DopeVectorType *source,
DopeVectorType *stop,
long *dim,
DopeVectorType *mask)
{
#include "segmented_scan_s.h"
if (stop_flag == 1) {
if (mask_flag == 1) {
SCANMAX_MASK_JS1@ (result_base_ptr, source_sdd_ptr,
stop_sdd_ptr, &dim_val, mask_sdd_ptr, src_extents);
} else {
SCANMAX_NOMASK_JS1@ (result_base_ptr, source_sdd_ptr,
stop_sdd_ptr, &dim_val, src_extents);
}
}
}
|
/*
Copyright (c) 2005-2016 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef MESSAGESESSIONHANDLER_H__
#define MESSAGESESSIONHANDLER_H__
#include "stanza.h"
#include "messagesession.h"
namespace gloox
{
/**
* @brief A virtual interface which can be reimplemented to receive incoming message sessions.
*
* Derived classes can be registered as MessageSessionHandlers with the Client.
* If you have registered as a MessageSessionHandler by calling ClientBase::registerMessageSessionHandler(),
* handleMessageSession() will be called if a message stanza arrives for which there is no
* MessageSession yet.
*
* @author Jakob Schröter <js@camaya.net>
* @since 0.8
*/
class GLOOX_API MessageSessionHandler
{
public:
/**
* Virtual Destructor.
*/
virtual ~MessageSessionHandler() {}
/**
* Reimplement this function if you want to be notified about
* incoming messages by means of automatically created MessageSessions.
* You receive ownership of the supplied session (@b not the stanza) and
* are responsible for deleting it at the end of its life.
*
* @note Make sure to read the note in ClientBase::registerMessageSessionHandler()
* regarding the feeding of decorators.
*
* @note You should never delete the MessageSession manually. Instead call
* ClientBase::disposeMessageSession() when you no longer need the session.
*
* @note If you don't need the MessageSession, you should not dispose it here. You will
* get an endless loop if you do.
*
* @note You should register your MessageHandler here, or else the first message
* (that caused the MessageSession to be created) may get lost.
*
* @param session The new MessageSession.
*/
virtual void handleMessageSession( MessageSession* session ) = 0;
};
}
#endif // MESSAGESESSIONHANDLER_H__
|
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston MA 02111-1307, USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef long ADDR;
#define C_FIDENT 8
#define COUNTSMAG0 'p'
#define COUNTSMAG1 'M'
#define COUNTSMAG2 'o'
#define COUNTSMAG3 '0'
#define COUNTSMAG4 '~'
#define COUNTSMAG5 '?'
#define COUNTSMAG6 '>'
#define COUNTSMAG7 '&'
#define C_VERSION 1
typedef struct {
unsigned char c_ident[C_FIDENT];
int c_entry;
short c_version;
short c_dummy1;
} Counts_hdr;
typedef struct {
ADDR caller;
ADDR callee;
int caller_name_idx;
int callee_name_idx;
int count;
} counts_entry;
struct counts_desc {
ADDR caller;
ADDR callee;
struct counts_desc *next;
int count;
};
typedef enum {
ER_FATAL,
ER_WARNING,
ER_INFO,
ER_ERROR,
ER_VERBOSE,
ER_MSG,
} error_number;
typedef enum {
CMP_LESS,
CMP_SAME,
CMP_MORE,
} cmp_status;
extern void ir_prof_error(int, char *, char *);
|
#ifndef INC_GRIDACTION_H
#define INC_GRIDACTION_H
#include "AtomMask.h"
#include "Vec3.h"
#include "Frame.h"
#include "DataSet_GridFlt.h"
#include "DataSetList.h"
class Topology;
class ArgList;
class CoordinateInfo;
/// Class for setting up a grid within an action.
class GridAction {
public:
/// Indicate whether to apply an offset to coords before gridding.
enum OffsetType { NO_OFFSET = 0, BOX_CENTER, MASK_CENTER };
/// Indicate where grid should be located
enum MoveType { NO_MOVE = 0, TO_BOX_CTR, TO_MASK_CTR, RMS_FIT };
/// CONSTRUCTOR
GridAction();
/// \return List of keywords recognized by GridInit.
static const char* HelpText;
/// \return Set-up grid (added to given DataSetList) after processing keywords.
DataSet_GridFlt* GridInit(const char*, ArgList&, DataSetList&);
# ifdef MPI
/// Perform any parallel initialization
int ParallelGridInit(Parallel::Comm const&, DataSet_GridFlt*);
# endif
/// Print information on given grid to STDOUT
void GridInfo(DataSet_GridFlt const&);
/// Perform any setup necessary for given Topology/CoordinateInfo
int GridSetup(Topology const&, CoordinateInfo const&);
/// Place atoms selected by given mask in given Frame on the given grid.
inline void GridFrame(Frame const&, AtomMask const&, DataSet_GridFlt&) const;
/// Move grid if necessary
inline void MoveGrid(Frame const&, DataSet_GridFlt&);
/// Anything needed to finalize the grid
void FinishGrid(DataSet_GridFlt&) const;
/// \return Type of offset to apply to coords before gridding.
OffsetType GridOffsetType() const { return gridOffsetType_; }
/// \return Mask to use for centering grid
AtomMask const& CenterMask() const { return centerMask_; }
/// \return Amount voxels should be incremented by
float Increment() const { return increment_; }
private:
/// Set first frame selected coords (tgt_) and original grid unit cell vectors (tgtUcell_).
int SetTgt(Frame const&, Matrix_3x3 const&);
OffsetType gridOffsetType_;
MoveType gridMoveType_;
AtomMask centerMask_;
float increment_; ///< Set to -1 if negative, 1 if not.
Frame tgt_; ///< For MoveType RMS_FIT, first frames selected coordinates
Matrix_3x3 tgtUcell_; ///< For MoveType RMS_FIT, original grid unit cell vectors
Frame ref_; ///< For MoveType RMS_FIT, current frames selected coordinates
bool firstFrame_; ///< For MoveType RMS_FIT, true if this is the first frame (no fit needed)
bool x_align_; ///< For MoveType RMS_FIT, if true ensure grid is X-aligned in FinishGrid().
# ifdef MPI
Parallel::Comm trajComm_;
# endif
};
// ----- INLINE FUNCTIONS ------------------------------------------------------
void GridAction::GridFrame(Frame const& currentFrame, AtomMask const& mask,
DataSet_GridFlt& grid)
const
{
if (gridOffsetType_ == BOX_CENTER) {
Vec3 offset = currentFrame.BoxCrd().Center();
for (AtomMask::const_iterator atom = mask.begin(); atom != mask.end(); ++atom)
grid.Increment( Vec3(currentFrame.XYZ(*atom)) - offset, increment_ );
} else if (gridOffsetType_ == MASK_CENTER) {
Vec3 offset = currentFrame.VGeometricCenter( centerMask_ );
for (AtomMask::const_iterator atom = mask.begin(); atom != mask.end(); ++atom)
grid.Increment( Vec3(currentFrame.XYZ(*atom)) - offset, increment_ );
} else {// mode_==NO_OFFSET
for (AtomMask::const_iterator atom = mask.begin(); atom != mask.end(); ++atom)
grid.Increment( currentFrame.XYZ(*atom), increment_ );
}
}
/** Move/reorient grid if necessary. */
void GridAction::MoveGrid(Frame const& currentFrame, DataSet_GridFlt& grid)
{
if (gridMoveType_ == TO_BOX_CTR)
grid.SetGridCenter( currentFrame.BoxCrd().Center() );
else if (gridMoveType_ == TO_MASK_CTR)
grid.SetGridCenter( currentFrame.VGeometricCenter( centerMask_ ) );
else if (gridMoveType_ == RMS_FIT) {
grid.SetGridCenter( currentFrame.VGeometricCenter( centerMask_ ) );
# ifdef MPI
// Ranks > 0 still need to do the rotation on the first frame.
bool doRotate = true;
if (firstFrame_) {
SetTgt(currentFrame, grid.Bin().Ucell());
if (trajComm_.Rank() == 0)
doRotate = false;
firstFrame_ = false;
}
if (doRotate) {
// Want to rotate to coordinates in current frame. Make them the ref.
ref_.SetFrame( currentFrame, centerMask_ );
// Reset to original grid.
grid.Assign_Grid_UnitCell( tgtUcell_ );
// Do not want to modify original coords. Make a copy.
Frame tmpTgt( tgt_ );
// Rot will contain rotation from original grid to current frame.
Matrix_3x3 Rot;
Vec3 T1, T2;
tmpTgt.RMSD( ref_, Rot, T1, T2, false );
grid.Rotate_3D_Grid( Rot );
}
# else
if (firstFrame_) {
SetTgt(currentFrame, grid.Bin().Ucell());
//grid.SetGridCenter( tgt_.VGeometricCenter( 0, tgt_.Natom() ) );
firstFrame_ = false;
} else {
//grid.SetGridCenter( currentFrame.VGeometricCenter( centerMask_ ) );
// Want to rotate to coordinates in current frame. Make them the ref.
ref_.SetFrame( currentFrame, centerMask_ );
// Reset to original grid.
grid.Assign_Grid_UnitCell( tgtUcell_ );
// Do not want to modify original coords. Make a copy.
Frame tmpTgt( tgt_ );
// Rot will contain rotation from original grid to current frame.
Matrix_3x3 Rot;
Vec3 T1, T2;
tmpTgt.RMSD( ref_, Rot, T1, T2, false );
grid.Rotate_3D_Grid( Rot );
//tgt_.SetFrame( currentFrame, centerMask_ );
}
# endif
}
}
#endif
|
#ifndef REDREAM_STRING_H
#define REDREAM_STRING_H
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
#include "core/config.h"
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifndef HAVE_STRCASECMP
#define strcasecmp _stricmp
#endif
#ifndef HAVE_STRNLEN
size_t strnlen(const char *s, size_t max_len);
#endif
#ifndef HAVE_STRNSTR
char *strnstr(const char *s1, const char *s2, size_t n);
#endif
void strncpy_pad_spaces(char *dst, const char *str, int size);
void strncpy_trim_space(char *dst, const char *str, int size);
int strnrep(char *dst, size_t dst_size, const char *token, size_t token_len,
const char *value, size_t value_len);
int xtoi(char c);
#endif
|
// File_Rm - Info for Real Media files
// Copyright (C) 2002-2011 MediaArea.net SARL, Info@MediaArea.net
//
// This library is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Information about Real Media files
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef MediaInfo_File_RmH
#define MediaInfo_File_RmH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/File__Analyze.h"
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Classe File_Rm
//***************************************************************************
class File_Rm : public File__Analyze
{
public :
//In
stream_t FromMKV_StreamType;
public :
File_Rm();
private :
//Buffer
void Header_Parse();
void Data_Parse();
//Elements
void RMF();
void CONT();
void DATA();
void INDX();
void MDPR();
void MDPR_realvideo();
void MDPR_realaudio();
void MDPR_fileinfo();
void PROP();
void RJMD();
void RJMD_property(std::string Name);
void RMJE();
void RMMD();
void TAG ();
//Temp
bool MDPR_IsStream;
};
} //NameSpace
#endif
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RYZOM_SPECIAL_POWER_BALANCE_H
#define RYZOM_SPECIAL_POWER_BALANCE_H
#include "special_power.h"
/**
* Specialized class for balance powers
* \author David Fleury
* \author Nevrax France
* \date 2003
*/
class CSpecialPowerBalance : public CSpecialPower
{
public:
/// Constructor
CSpecialPowerBalance(TDataSetRow actorRowId, CSpecialPowerPhrase *phrase, float disableTimeInSeconds, float lossFactor, float range, POWERS::TPowerType powerType)
:CSpecialPower()
{
_AffectedScore = SCORES::hit_points;
_Phrase = phrase;
_LossFactor = lossFactor;
_Range = range;
_DisablePowerTime = NLMISC::TGameCycle(disableTimeInSeconds / CTickEventHandler::getGameTimeStep());
_PowerType = powerType;
if(TheDataset.isAccessible(actorRowId))
_ActorRowId = actorRowId;
else
{
nlwarning("<CSpecialPowerBalance> invalid data set row passed as actor");
}
}
/// validate the power utilisation
virtual bool validate(std::string &errorCode);
/// set affected score
inline void setAffectedScore( SCORES::TScores score ) { _AffectedScore = score; }
/// apply effects
virtual void apply();
protected:
/// loss factor on total value (1 = 100%, 0.5 = 50%, 0.3 = 30%)
float _LossFactor;
/// max Range in meters
float _Range;
/// affected score (Hp, sap, sta)
SCORES::TScores _AffectedScore;
};
#endif // RYZOM_SPECIAL_POWER_BALANCE_H
/* End of special_power_balance.h */
|
#ifndef MUPDF_FITZ_OUTLINE_H
#define MUPDF_FITZ_OUTLINE_H
#include "mupdf/fitz/system.h"
#include "mupdf/fitz/context.h"
#include "mupdf/fitz/link.h"
#include "mupdf/fitz/output.h"
/* Outline */
/*
fz_outline is a tree of the outline of a document (also known
as table of contents).
title: Title of outline item using UTF-8 encoding. May be NULL
if the outline item has no text string.
uri: Destination in the document to be displayed when this
outline item is activated. May be an internal or external
link, or NULL if the outline item does not have a destination.
page: The page number of an internal link, or -1 for external
links or links with no destination.
next: The next outline item at the same level as this outline
item. May be NULL if no more outline items exist at this level.
down: The outline items immediate children in the hierarchy.
May be NULL if no children exist.
*/
typedef struct fz_outline_s fz_outline;
struct fz_outline_s
{
int refs;
char *title;
char *uri;
int page;
fz_outline *next;
fz_outline *down;
int is_open;
};
/*
fz_print_outline_xml: Print an outline to 'out' as XML.
*/
void fz_print_outline_xml(fz_context *ctx, fz_output *out, fz_outline *outline);
/*
fz_print_outline: Print an outline to 'out' as plain text.
*/
void fz_print_outline(fz_context *ctx, fz_output *out, fz_outline *outline);
fz_outline *fz_new_outline(fz_context *ctx);
fz_outline *fz_keep_outline(fz_context *ctx, fz_outline *outline);
void fz_drop_outline(fz_context *ctx, fz_outline *outline);
#endif
|
/*
* ovasCDriverBrainProductsActiCHamp.h
*
* Copyright (c) 2012, Mensia Technologies SA. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#ifndef __OpenViBE_AcquisitionServer_CDriverBrainProductsActiCHamp_H__
#define __OpenViBE_AcquisitionServer_CDriverBrainProductsActiCHamp_H__
#if defined TARGET_HAS_ThirdPartyActiCHampAPI
#include "ovasIDriver.h"
#include "../ovasCHeader.h"
#include <deque>
namespace OpenViBEAcquisitionServer
{
class CDriverBrainProductsActiCHamp : public OpenViBEAcquisitionServer::IDriver
{
public:
CDriverBrainProductsActiCHamp(OpenViBEAcquisitionServer::IDriverContext& rDriverContext);
virtual void release(void);
virtual const char* getName(void);
virtual OpenViBE::boolean initialize(
const OpenViBE::uint32 ui32SampleCountPerSentBlock,
OpenViBEAcquisitionServer::IDriverCallback& rCallback);
virtual OpenViBE::boolean uninitialize(void);
virtual OpenViBE::boolean start(void);
virtual OpenViBE::boolean stop(void);
virtual OpenViBE::boolean loop(void);
virtual OpenViBE::boolean isConfigurable(void);
virtual OpenViBE::boolean configure(void);
virtual const OpenViBEAcquisitionServer::IHeader* getHeader(void) { return &m_oHeader; }
OpenViBE::CString getError(int* pCode=NULL);
protected:
void* m_pHandle;
OpenViBEAcquisitionServer::IDriverCallback* m_pCallback;
OpenViBEAcquisitionServer::CHeader m_oHeader;
std::vector < unsigned int > m_vImpedance;
std::vector < OpenViBE::float32 > m_vSample;
std::vector < OpenViBE::float32 > m_vResolution;
//std::vector < std::vector < OpenViBE::float32 > > m_vSampleCache;
std::deque < std::vector < OpenViBE::float32 > > m_vSampleCache;
OpenViBE::uint32 m_ui32SampleCacheIndex;
std::vector < OpenViBE::float64 > m_vFilter;
OpenViBE::CStimulationSet m_oStimulationSet;
OpenViBE::uint32 m_ui32DeviceId;
OpenViBE::uint32 m_ui32Mode;
OpenViBE::uint32 m_ui32PhysicalSampleRate;
OpenViBE::uint32 m_ui32ADCDataFilter;
OpenViBE::uint32 m_ui32ADCDataDecimation;
OpenViBE::uint32 m_ui32ActiveShieldGain;
OpenViBE::uint32 m_ui32ModuleEnabled;
OpenViBE::boolean m_bUseAuxChannels;
OpenViBE::uint32 m_ui32PhysicalSampleRateHz;
OpenViBE::uint32 m_ui32ChannelCount;
OpenViBE::uint32 m_ui32CountEEG;
OpenViBE::uint32 m_ui32CountAux;
OpenViBE::uint32 m_ui32CountTriggersIn;
OpenViBE::uint64 m_ui64Counter;
OpenViBE::uint64 m_ui64CounterStep;
OpenViBE::uint64 m_ui64SampleCount;
OpenViBE::int64 m_i64DriftOffsetSampleCount;
OpenViBE::uint32 m_ui32GoodImpedanceLimit;
OpenViBE::uint32 m_ui32BadImpedanceLimit;
signed int* m_pAux;
signed int* m_pEEG;
unsigned int* m_pTriggers;
unsigned int m_uiSize;
unsigned int m_uiLastTriggers;
OpenViBE::uint64 m_ui64LastSampleDate;
OpenViBE::boolean m_bMyButtonstate;
};
};
#endif // TARGET_HAS_ThirdPartyActiCHampAPI
#endif // __OpenViBE_AcquisitionServer_CDriverBrainProductsActiCHamp_H__
|
/***************************************************************************
constraintactivitiespreferredtimeslots.h - description
-------------------
begin : 15 May 2004
copyright : (C) 2004 by Lalescu Liviu
email : Please see http://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address)
***************************************************************************/
/***************************************************************************
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
#ifndef CONSTRAINTACTIVITIESPREFERREDTIMESLOTSFORM_H
#define CONSTRAINTACTIVITIESPREFERREDTIMESLOTSFORM_H
#include "ui_constraintactivitiespreferredtimeslotsform_template.h"
#include "timetable_defs.h"
#include "timetable.h"
#include "fet.h"
class ConstraintActivitiesPreferredTimeSlotsForm : public QDialog, Ui::ConstraintActivitiesPreferredTimeSlotsForm_template {
Q_OBJECT
public:
TimeConstraintsList visibleConstraintsList;
ConstraintActivitiesPreferredTimeSlotsForm(QWidget* parent);
~ConstraintActivitiesPreferredTimeSlotsForm();
void refreshConstraintsListWidget();
bool filterOk(TimeConstraint* ctr);
public slots:
void constraintChanged(int index);
void addConstraint();
void modifyConstraint();
void removeConstraint();
};
#endif
|
//===-- llvm-vtabledump.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_VTABLEDUMP_H
#define LLVM_TOOLS_VTABLEDUMP_H
#include "llvm/Support/CommandLine.h"
#include <string>
namespace opts {
extern llvm::cl::list<std::string> InputFilenames;
} // namespace opts
#define LLVM_VTABLEDUMP_ENUM_ENT(ns, enum) \
{ #enum, ns::enum }
#endif
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 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, Digia gives you certain additional
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QFINITESTACK_P_H
#define QFINITESTACK_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
template<typename T>
struct QFiniteStack {
inline QFiniteStack();
inline ~QFiniteStack();
inline void deallocate();
inline void allocate(int size);
inline bool isEmpty() const;
inline const T &top() const;
inline T &top();
inline void push(const T &o);
inline T pop();
inline int count() const;
inline const T &at(int index) const;
inline T &operator[](int index);
private:
T *_array;
int _alloc;
int _size;
};
template<typename T>
QFiniteStack<T>::QFiniteStack()
: _array(0), _alloc(0), _size(0)
{
}
template<typename T>
QFiniteStack<T>::~QFiniteStack()
{
deallocate();
}
template<typename T>
bool QFiniteStack<T>::isEmpty() const
{
return _size == 0;
}
template<typename T>
const T &QFiniteStack<T>::top() const
{
return _array[_size - 1];
}
template<typename T>
T &QFiniteStack<T>::top()
{
return _array[_size - 1];
}
template<typename T>
void QFiniteStack<T>::push(const T &o)
{
if (QTypeInfo<T>::isComplex) {
new (_array + _size++) T(o);
} else {
_array[_size++] = o;
}
}
template<typename T>
T QFiniteStack<T>::pop()
{
--_size;
if (QTypeInfo<T>::isComplex) {
T rv = _array[_size];
(_array + _size)->~T();
return rv;
} else {
return _array[_size];
}
}
template<typename T>
int QFiniteStack<T>::count() const
{
return _size;
}
template<typename T>
const T &QFiniteStack<T>::at(int index) const
{
return _array[index];
}
template<typename T>
T &QFiniteStack<T>::operator[](int index)
{
return _array[index];
}
template<typename T>
void QFiniteStack<T>::allocate(int size)
{
Q_ASSERT(_array == 0);
Q_ASSERT(_alloc == 0);
Q_ASSERT(_size == 0);
if (!size) return;
_array = (T *)malloc(size * sizeof(T));
_alloc = size;
}
template<typename T>
void QFiniteStack<T>::deallocate()
{
if (QTypeInfo<T>::isComplex) {
T *i = _array + _size;
while (i != _array)
(--i)->~T();
}
free(_array);
_array = 0;
_alloc = 0;
_size = 0;
}
QT_END_NAMESPACE
#endif // QFINITESTACK_P_H
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdlib.h>
#include <libecal/libecal.h>
#include "ecal-test-utils.h"
#include "e-test-server-utils.h"
static ETestServerClosure cal_closure =
{ E_TEST_SERVER_DEPRECATED_CALENDAR, NULL, E_CAL_SOURCE_TYPE_EVENT };
static void
test_get_alarm_email_address (ETestServerFixture *fixture,
gconstpointer user_data)
{
ECal *cal;
gchar *address;
cal = E_TEST_SERVER_UTILS_SERVICE (fixture, ECal);
address = ecal_test_utils_cal_get_alarm_email_address (cal);
test_print ("alarm email address: '%s'\n", address);
g_free (address);
}
gint
main (gint argc,
gchar **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/");
g_test_add (
"/ECal/GetAlarmEmailAddress",
ETestServerFixture,
&cal_closure,
e_test_server_utils_setup,
test_get_alarm_email_address,
e_test_server_utils_teardown);
return e_test_server_utils_run ();
}
|
#include <stdlib.h>
#include <clutter/clutter.h>
#include "cb-border-effect.h"
#include "cb-background-effect.h"
static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff };
static ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff };
static gboolean
toggle_highlight (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterActorMeta *meta = CLUTTER_ACTOR_META (user_data);
gboolean effect_enabled = clutter_actor_meta_get_enabled (meta);
clutter_actor_meta_set_enabled (meta, !effect_enabled);
clutter_actor_queue_redraw (actor);
return TRUE;
}
int
main (int argc,
char *argv[])
{
ClutterActor *stage;
ClutterActor *box;
ClutterLayoutManager *layout_manager;
ClutterActor *texture;
ClutterEffect *background_effect;
ClutterEffect *border_effect;
ClutterConstraint *width_constraint;
gchar *filename;
guint i;
GError *error = NULL;
if (argc < 2)
{
g_print ("Usage: %s <image files>\n", argv[0]);
return EXIT_FAILURE;
}
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return EXIT_FAILURE;
stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
clutter_actor_set_size (stage, 600, 400);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
layout_manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
clutter_flow_layout_set_column_spacing (CLUTTER_FLOW_LAYOUT (layout_manager),
10);
clutter_flow_layout_set_row_spacing (CLUTTER_FLOW_LAYOUT (layout_manager),
10);
box = clutter_box_new (layout_manager);
width_constraint = clutter_bind_constraint_new (stage,
CLUTTER_BIND_WIDTH,
0.0);
clutter_actor_add_constraint (box, width_constraint);
/* loop through the files specified on the command line, adding
* each one into the box
*/
for (i = 1; i < argc; i++)
{
filename = argv[i];
texture = clutter_texture_new ();
clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE);
clutter_actor_set_width (texture, 150);
clutter_actor_set_reactive (texture, TRUE);
clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
filename,
&error);
if (error != NULL)
g_warning ("Error loading file %s:\n%s",
filename,
error->message);
/* create a grey background effect */
background_effect = cb_background_effect_new ();
/* apply the effect to the actor */
clutter_actor_add_effect (texture, background_effect);
/* create a 5 pixel red border effect */
border_effect = cb_border_effect_new (5.0, &red_color);
/* apply the effect to the actor, but disabled */
clutter_actor_add_effect (texture, border_effect);
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (border_effect),
FALSE);
/* on mouse click, toggle the "enabled" property of the border effect */
g_signal_connect (texture,
"button-press-event",
G_CALLBACK (toggle_highlight),
border_effect);
clutter_container_add_actor (CLUTTER_CONTAINER (box), texture);
}
clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
clutter_actor_show (stage);
clutter_main ();
return EXIT_SUCCESS;
}
|
/* This file is part of the KDE project
Copyright (C) 2010 Thomas Fjellstrom <thomas@fjellstrom.ca>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KATE_FILETREE_H
#define KATE_FILETREE_H
#include <QUrl>
#include <QIcon>
#include <QTreeView>
namespace KTextEditor
{
class Document;
}
class QActionGroup;
class KateFileTree: public QTreeView
{
Q_OBJECT
public:
KateFileTree(QWidget *parent);
virtual ~KateFileTree();
virtual void setModel(QAbstractItemModel *model);
public Q_SLOTS:
void slotDocumentClose();
void slotDocumentCloseOther();
void slotDocumentReload();
void slotCopyFilename();
void slotCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous);
void slotDocumentFirst();
void slotDocumentLast();
void slotDocumentNext();
void slotDocumentPrev();
void slotPrintDocument();
void slotPrintDocumentPreview();
void slotResetHistory();
void slotDocumentDelete();
protected:
virtual void contextMenuEvent(QContextMenuEvent *event);
Q_SIGNALS:
void closeDocument(KTextEditor::Document *);
void activateDocument(KTextEditor::Document *);
void openDocument(QUrl);
void viewModeChanged(bool treeMode);
void sortRoleChanged(int);
private Q_SLOTS:
void mouseClicked(const QModelIndex &index);
void slotTreeMode();
void slotListMode();
void slotSortName();
void slotSortPath();
void slotSortOpeningOrder();
void slotFixOpenWithMenu();
void slotOpenWithMenuAction(QAction *a);
void slotRenameFile();
private:
QAction *setupOption(QActionGroup *group, const QIcon &, const QString &, const QString &, const char *slot, bool checked = false);
private:
QAction *m_filelistCloseDocument;
QAction *m_filelistCloseOtherDocument;
QAction *m_filelistReloadDocument;
QAction *m_filelistCopyFilename;
QAction *m_filelistRenameFile;
QAction *m_filelistPrintDocument;
QAction *m_filelistPrintDocumentPreview;
QAction *m_filelistDeleteDocument;
QAction *m_treeModeAction;
QAction *m_listModeAction;
QAction *m_sortByFile;
QAction *m_sortByPath;
QAction *m_sortByOpeningOrder;
QAction *m_resetHistory;
QPersistentModelIndex m_previouslySelected;
QPersistentModelIndex m_indexContextMenu;
};
#endif // KATE_FILETREE_H
|
/* Copyright (C) 2008-2011 Xavier Pujol.
This file is part of fplll. fplll is free software: you
can redistribute it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software Foundation,
either version 2.1 of the License, or (at your option) any later version.
fplll 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 fplll. If not, see <http://www.gnu.org/licenses/>. */
/** \file svpcvp.h
Shortest vector problem. */
#ifndef FPLLL_SVPCVP_H
#define FPLLL_SVPCVP_H
#include "util.h"
FPLLL_BEGIN_NAMESPACE
/**
* Computes a shortest vector of a lattice.
* The vectors must be linearly independant and the basis must be LLL-reduced
* with delta=LLL_DEF_DELTA and eta=LLL_DEF_ETA.
* The result is guaranteed if method = SVPM_PROVED.
*/
int shortest_vector(IntMatrix &b, IntVect &sol_coord, SVPMethod method = SVPM_PROVED,
int flags = SVP_DEFAULT);
int shortest_vector_pruning(IntMatrix &b, IntVect &sol_coord, const vector<double> &pruning,
int flags = SVP_DEFAULT);
int shortest_vector_pruning(IntMatrix &b, IntVect &sol_coord, vector<IntVect> &subsol_coord,
vector<double> &subsol_dist, const vector<double> &pruning,
int flags = SVP_DEFAULT);
int shortest_vector_pruning(IntMatrix &b, IntVect &sol_coord, vector<IntVect> &auxsol_coord,
vector<double> &auxsol_dist, const int max_aux_sols,
const vector<double> &pruning, int flags = SVP_DEFAULT);
/**
* Computes a closest vector of a lattice to a target.
* The vectors must be linearly independant and the basis must be LLL-reduced
* with delta=LLL_DEF_DELTA and eta=LLL_DEF_ETA.
* The result is guaranteed if method = CVPM_PROVED.
*/
int closest_vector(IntMatrix &b, const IntVect &int_target, vector<Integer> &sol_coord,
int method = CVPM_FAST, int flags = CVP_DEFAULT);
FPLLL_END_NAMESPACE
#endif
|
/**
* @defgroup Spinner Spinner
* @ingroup Elementary
*
* @image html spinner_inheritance_tree.png
* @image latex spinner_inheritance_tree.eps
*
* @image html img/widget/spinner/preview-00.png
* @image latex img/widget/spinner/preview-00.eps
*
* A spinner is a widget which allows the user to increase or decrease
* numeric values using arrow buttons, or edit values directly, clicking
* over it and typing the new value.
*
* By default the spinner will not wrap and has a label
* of "%.0f" (just showing the integer value of the double).
*
* A spinner has a label that is formatted with floating
* point values and thus accepts a printf-style format string, like
* “%1.2f units”.
*
* It also allows specific values to be replaced by pre-defined labels.
*
* This widget inherits from the @ref Layout one, so that all the
* functions acting on it also work for spinner objects.
*
* This widget emits the following signals, besides the ones sent from
* @ref Layout:
* - @c "changed" - Whenever the spinner value is changed.
* - @c "delay,changed" - A short time after the value is changed by
* the user. This will be called only when the user stops dragging
* for a very short period or when they release their finger/mouse,
* so it avoids possibly expensive reactions to the value change.
* - @c "language,changed" - the program's language changed
* - @c "focused" - When the spinner has received focus. (since 1.8)
* - @c "unfocused" - When the spinner has lost focus. (since 1.8)
* - @c "spinner,drag,start" - When dragging has started. (since 1.8)
* - @c "spinner,drag,stop" - When dragging has stopped. (since 1.8)
*
* Available styles for it:
* - @c "default";
* - @c "vertical": up/down buttons at the right side and text left aligned.
*
* Supported elm_object common APIs.
* @li @ref elm_object_signal_emit
* @li @ref elm_object_signal_callback_add
* @li @ref elm_object_signal_callback_del
* @li @ref elm_object_disabled_set
* @li @ref elm_object_disabled_get
*
* Here is an example on its usage:
* @ref spinner_example
*/
/**
* @addtogroup Spinner
* @{
*/
#ifdef EFL_EO_API_SUPPORT
#include "elm_spinner_eo.h"
#endif
#ifndef EFL_NOLEGACY_API_SUPPORT
#include "elm_spinner_legacy.h"
#endif
/**
* @}
*/
|
/*
* Copyright (C) 2019 Inria
* 2019 Freie Universität Berlin
* 2019 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_pyboard
* @{
*
* @file
* @brief Board specific definitions for the pyboard board
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_B, 4)
#define LED0_MASK (1 << 4)
#define LED0_ON (GPIOB->BSRR = LED0_MASK)
#define LED0_OFF (GPIOB->BSRR = (LED0_MASK << 16))
#define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
/** @} */
/**
* @name User button pin configuration
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_B, 3) /**< User button pin */
#define BTN0_MODE GPIO_IN_PU /**< User button pin mode */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/os2/dcclient.h
// Purpose: wxClientDC class
// Author: David Webster
// Modified by:
// Created: 09/12/99
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCCLIENT_H_
#define _WX_DCCLIENT_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/dc.h"
#include "wx/os2/dc.h"
#include "wx/dcclient.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// array types
// ----------------------------------------------------------------------------
// this one if used by wxPaintDC only
struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo;
WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
// ----------------------------------------------------------------------------
// DC classes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxPMDCImpl
{
public:
// default ctor
wxWindowDCImpl( wxDC *owner );
// Create a DC corresponding to the whole window
wxWindowDCImpl( wxDC *owner, wxWindow *pWin );
virtual void DoGetSize(int *pWidth, int *pHeight) const;
protected:
// initialize the newly created DC
void InitDC(void);
private:
SIZEL m_PageSize;
DECLARE_CLASS(wxWindowDCImpl)
wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
}; // end of CLASS wxWindowDC
class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{
public:
// default ctor
wxClientDCImpl( wxDC *owner );
// Create a DC corresponding to the client area of the window
wxClientDCImpl( wxDC *owner, wxWindow *pWin );
virtual ~wxClientDCImpl();
virtual void DoGetSize(int *pWidth, int *pHeight) const;
protected:
void InitDC(void);
private:
DECLARE_CLASS(wxClientDCImpl)
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
}; // end of CLASS wxClientDC
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
{
public:
wxPaintDCImpl( wxDC *owner );
// Create a DC corresponding for painting the window in OnPaint()
wxPaintDCImpl( wxDC *owner, wxWindow *pWin );
virtual ~wxPaintDCImpl();
// find the entry for this DC in the cache (keyed by the window)
static WXHDC FindDCInCache(wxWindow* pWin);
protected:
static wxArrayDCInfo ms_cache;
// find the entry for this DC in the cache (keyed by the window)
wxPaintDCInfo* FindInCache(size_t* pIndex = NULL) const;
private:
DECLARE_CLASS(wxPaintDCImpl)
wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
}; // end of wxPaintDC
#endif
// _WX_DCCLIENT_H_
|
/* Test file for internal debugging-out functions:
mpfr_dump, mpfr_print_binary, mpfr_print_rnd_mode.
Copyright 2004-2016 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
The GNU MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MPFR Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <stdlib.h>
#include "mpfr-test.h"
/* We output stdout to a file to check if it is correct
Is it a good idea?
We can't use tmpname since it is insecure */
#define FILE_NAME "dummy.tmp"
static const char Buffer[] =
"@NaN@\n"
"-@Inf@\n"
"-0\n"
"0.10101010101011111001000110001100010000100000000000000E32\n";
int
main (void)
{
mpfr_t x;
FILE *f;
int i;
tests_start_mpfr ();
/* Check RND_MODE */
if (strcmp (mpfr_print_rnd_mode(MPFR_RNDN), "MPFR_RNDN"))
{
printf ("Error for printing MPFR_RNDN\n");
exit (1);
}
if (strcmp (mpfr_print_rnd_mode(MPFR_RNDU), "MPFR_RNDU"))
{
printf ("Error for printing MPFR_RNDU\n");
exit (1);
}
if (strcmp (mpfr_print_rnd_mode(MPFR_RNDD), "MPFR_RNDD"))
{
printf ("Error for printing MPFR_RNDD\n");
exit (1);
}
if (strcmp (mpfr_print_rnd_mode(MPFR_RNDZ), "MPFR_RNDZ"))
{
printf ("Error for printing MPFR_RNDZ\n");
exit (1);
}
if (mpfr_print_rnd_mode ((mpfr_rnd_t) -1) != NULL ||
mpfr_print_rnd_mode (MPFR_RND_MAX) != NULL)
{
printf ("Error for illegal rounding mode values.\n");
exit (1);
}
/* Reopen stdout to a file. All errors will be put to stderr
Can't use tmpname since it is unsecure */
if (freopen (FILE_NAME, "w", stdout) == NULL)
{
printf ("Error can't redirect stdout\n");
exit (1);
}
mpfr_init (x);
mpfr_set_nan (x);
mpfr_dump (x);
mpfr_set_inf (x, -1);
mpfr_dump (x);
MPFR_SET_ZERO (x); MPFR_SET_NEG (x);
mpfr_dump (x);
mpfr_set_str_binary (x, "0.101010101010111110010001100011000100001E32");
mpfr_dump (x);
mpfr_print_mant_binary ("x=",MPFR_MANT(x), MPFR_PREC(x));
mpfr_clear (x);
fclose (stdout);
/* Open it and check for it */
f = fopen (FILE_NAME, "r");
if (f == NULL)
{
fprintf (stderr, "Can't reopen file!\n");
exit (1);
}
for(i = 0 ; i < sizeof(Buffer)-1 ; i++)
{
if (feof (f))
{
fprintf (stderr, "Error EOF\n");
exit (1);
}
if (Buffer[i] != fgetc (f))
{
fprintf (stderr, "Character mismatch for i=%d / %lu\n",
i, (unsigned long) sizeof(Buffer));
exit (1);
}
}
fclose (f);
remove (FILE_NAME);
tests_end_mpfr ();
return 0;
}
|
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */
/*
* ccm-debug.h
* Copyright (C) Nicolas Bruguier 2007-2011 <gandalfn@club-internet.fr>
*
* cairo-compmgr 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.
*
* cairo-compmgr is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CCM_DEBUG_H_
#define _CCM_DEBUG_H_
#include "ccm.h"
//#define CCM_DEBUG_ENABLE
void ccm_log_start_audit();
void ccm_log_audit (const char *format, ...);
void ccm_log (const char *format, ...);
void ccm_log_window (CCMWindow * window, const char *format, ...);
void ccm_log_atom (CCMDisplay * display, Atom atom, const char *format, ...);
void ccm_log_region (CCMDrawable * drawable, const char *format, ...);
void ccm_log_print_backtrace ();
#ifdef CCM_DEBUG_ENABLE
#define ccm_debug(...) ccm_log(__VA_ARGS__)
#define ccm_debug_window(window, format...) ccm_log_window(window, format)
#define ccm_debug_atom(display, atom, format...) ccm_log_atom(display, atom, format)
#define ccm_debug_region(drawable, format...) ccm_log_region(drawable, format)
#define ccm_debug_backtrace() ccm_log_print_backtrace()
#else
#define ccm_debug(...)
#define ccm_debug_window(window, format...)
#define ccm_debug_atom(display, atom, format...)
#define ccm_debug_region(drawable, format...)
#define ccm_debug_backtrace()
#endif
#endif /* _CCM_DEBUG_H_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.