text
stringlengths 4
6.14k
|
|---|
#ifndef __WINBOND_WB35_TX_S_H
#define __WINBOND_WB35_TX_S_H
#include "mds_s.h"
//====================================
// IS89C35 Tx related definition
//====================================
#define TX_INTERFACE 0 // Interface 1
#define TX_PIPE 3 // endpoint 4
#define TX_INTERRUPT 1 // endpoint 2
#define MAX_INTERRUPT_LENGTH 64 // It must be 64 for EP2 hardware
//====================================
// Internal variable for module
//====================================
typedef struct _WB35TX
{
// For Tx buffer
u8 TxBuffer[ MAX_USB_TX_BUFFER_NUMBER ][ MAX_USB_TX_BUFFER ];
// For Interrupt pipe
u8 EP2_buf[MAX_INTERRUPT_LENGTH];
atomic_t TxResultCount;// For thread control of EP2 931130.4.m
atomic_t TxFireCounter;// For thread control of EP4 931130.4.n
u32 ByteTransfer;
u32 TxSendIndex;// The next index of Mds array to be sent
u32 EP2vm_state; // for EP2vm state
u32 EP4vm_state; // for EP4vm state
u32 tx_halt; // Stopping VM
struct urb * Tx4Urb;
struct urb * Tx2Urb;
int EP2VM_status;
int EP4VM_status;
u32 TxFillCount; // 20060928
u32 TxTimer; // 20060928 Add if sending packet not great than 13
} WB35TX, *PWB35TX;
#endif
|
/*
* Copyright (C) 2015 Synopsys, Inc. (www.synopsys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/bootmem.h>
#include <linux/export.h>
#include <linux/highmem.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
/*
* HIGHMEM API:
*
* kmap() API provides sleep semantics hence refered to as "permanent maps"
* It allows mapping LAST_PKMAP pages, using @last_pkmap_nr as the cursor
* for book-keeping
*
* kmap_atomic() can't sleep (calls pagefault_disable()), thus it provides
* shortlived ala "temporary mappings" which historically were implemented as
* fixmaps (compile time addr etc). Their book-keeping is done per cpu.
*
* Both these facts combined (preemption disabled and per-cpu allocation)
* means the total number of concurrent fixmaps will be limited to max
* such allocations in a single control path. Thus KM_TYPE_NR (another
* historic relic) is a small'ish number which caps max percpu fixmaps
*
* ARC HIGHMEM Details
*
* - the kernel vaddr space from 0x7z to 0x8z (currently used by vmalloc/module)
* is now shared between vmalloc and kmap (non overlapping though)
*
* - Both fixmap/pkmap use a dedicated page table each, hooked up to swapper PGD
* This means each only has 1 PGDIR_SIZE worth of kvaddr mappings, which means
* 2M of kvaddr space for typical config (8K page and 11:8:13 traversal split)
*
* - fixmap anyhow needs a limited number of mappings. So 2M kvaddr == 256 PTE
* slots across NR_CPUS would be more than sufficient (generic code defines
* KM_TYPE_NR as 20).
*
* - pkmap being preemptible, in theory could do with more than 256 concurrent
* mappings. However, generic pkmap code: map_new_virtual(), doesn't traverse
* the PGD and only works with a single page table @pkmap_page_table, hence
* sets the limit
*/
extern pte_t * pkmap_page_table;
static pte_t * fixmap_page_table;
void *kmap(struct page *page)
{
BUG_ON(in_interrupt());
if (!PageHighMem(page))
return page_address(page);
return kmap_high(page);
}
void *kmap_atomic(struct page *page)
{
int idx, cpu_idx;
unsigned long vaddr;
preempt_disable();
pagefault_disable();
if (!PageHighMem(page))
return page_address(page);
cpu_idx = kmap_atomic_idx_push();
idx = cpu_idx + KM_TYPE_NR * smp_processor_id();
vaddr = FIXMAP_ADDR(idx);
set_pte_at(&init_mm, vaddr, fixmap_page_table + idx,
mk_pte(page, kmap_prot));
return (void *)vaddr;
}
EXPORT_SYMBOL(kmap_atomic);
void __kunmap_atomic(void *kv)
{
unsigned long kvaddr = (unsigned long)kv;
if (kvaddr >= FIXMAP_BASE && kvaddr < (FIXMAP_BASE + FIXMAP_SIZE)) {
/*
* Because preemption is disabled, this vaddr can be associated
* with the current allocated index.
* But in case of multiple live kmap_atomic(), it still relies on
* callers to unmap in right order.
*/
int cpu_idx = kmap_atomic_idx();
int idx = cpu_idx + KM_TYPE_NR * smp_processor_id();
WARN_ON(kvaddr != FIXMAP_ADDR(idx));
pte_clear(&init_mm, kvaddr, fixmap_page_table + idx);
local_flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
kmap_atomic_idx_pop();
}
pagefault_enable();
preempt_enable();
}
EXPORT_SYMBOL(__kunmap_atomic);
static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr)
{
pgd_t *pgd_k;
pud_t *pud_k;
pmd_t *pmd_k;
pte_t *pte_k;
pgd_k = pgd_offset_k(kvaddr);
pud_k = pud_offset(pgd_k, kvaddr);
pmd_k = pmd_offset(pud_k, kvaddr);
pte_k = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
pmd_populate_kernel(&init_mm, pmd_k, pte_k);
return pte_k;
}
void __init kmap_init(void)
{
/* Due to recursive include hell, we can't do this in processor.h */
BUILD_BUG_ON(PAGE_OFFSET < (VMALLOC_END + FIXMAP_SIZE + PKMAP_SIZE));
BUILD_BUG_ON(KM_TYPE_NR > PTRS_PER_PTE);
pkmap_page_table = alloc_kmap_pgtable(PKMAP_BASE);
BUILD_BUG_ON(LAST_PKMAP > PTRS_PER_PTE);
fixmap_page_table = alloc_kmap_pgtable(FIXMAP_BASE);
}
|
#ifndef _MODEL_H_
#define _MODEL_H_
#include "texturer.h"
#include "teges_object.h"
#include <vector>
/**
* The model can be rendered and can have logic. It is also texturable and can be put on the engine models list.
*/
class Model : public Texturable, public virtual TegesObject {
//static const char className[];
public:
Model(Teges* _engine);
virtual void render() { };
virtual void logic() { };
//virtual const char* getClass() { return className; }
};
typedef std::vector<Model*> ModelList;
#endif // MODEL_H
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __javax_swing_JFrame$AccessibleJFrame__
#define __javax_swing_JFrame$AccessibleJFrame__
#pragma interface
#include <java/awt/Frame$AccessibleAWTFrame.h>
extern "Java"
{
namespace javax
{
namespace swing
{
class JFrame;
class JFrame$AccessibleJFrame;
}
}
}
class javax::swing::JFrame$AccessibleJFrame : public ::java::awt::Frame$AccessibleAWTFrame
{
public: // actually protected
JFrame$AccessibleJFrame(::javax::swing::JFrame *);
public: // actually package-private
::javax::swing::JFrame * __attribute__((aligned(__alignof__( ::java::awt::Frame$AccessibleAWTFrame)))) this$0;
public:
static ::java::lang::Class class$;
};
#endif // __javax_swing_JFrame$AccessibleJFrame__
|
//*****************************************************************************
//
// hw_sysexc.h - Macros used when accessing the system exception module.
//
// Copyright (c) 2011 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 8264 of the Stellaris Firmware Development Package.
//
//*****************************************************************************
#ifndef __HW_SYSEXC_H__
#define __HW_SYSEXC_H__
//*****************************************************************************
//
// The following are defines for the System Exception Module register
// addresses.
//
//*****************************************************************************
#define SYSEXC_RIS 0x400F9000 // System Exception Raw Interrupt
// Status
#define SYSEXC_IM 0x400F9004 // System Exception Interrupt Mask
#define SYSEXC_MIS 0x400F9008 // System Exception Raw Interrupt
// Status
#define SYSEXC_IC 0x400F900C // System Exception Interrupt Clear
//*****************************************************************************
//
// The following are defines for the bit fields in the SYSEXC_RIS register.
//
//*****************************************************************************
#define SYSEXC_RIS_IXCRIS 0x00000020 // Inexact Exception Flag
#define SYSEXC_RIS_OFCRIS 0x00000010 // Overflow Exception Flag
#define SYSEXC_RIS_UFCRIS 0x00000008 // Underflow Exception Flag
#define SYSEXC_RIS_IOCRIS 0x00000004 // Invalid Operation Flag
#define SYSEXC_RIS_DZCRIS 0x00000002 // Divide By 0 Exception Flag
#define SYSEXC_RIS_IDCRIS 0x00000001 // Input Denormal Exception Flag
//*****************************************************************************
//
// The following are defines for the bit fields in the SYSEXC_IM register.
//
//*****************************************************************************
#define SYSEXC_IM_IXCIM 0x00000020 // Inexact Exception Flag
#define SYSEXC_IM_OFCIM 0x00000010 // Overflow Exception Flag
#define SYSEXC_IM_UFCIM 0x00000008 // Underflow Exception Flag
#define SYSEXC_IM_IOCIM 0x00000004 // Invalid Operation Flag
#define SYSEXC_IM_DZCIM 0x00000002 // Divide By 0 Exception Flag
#define SYSEXC_IM_IDCIM 0x00000001 // Input Denormal Exception Flag
//*****************************************************************************
//
// The following are defines for the bit fields in the SYSEXC_MIS register.
//
//*****************************************************************************
#define SYSEXC_MIS_IXCMIS 0x00000020 // Inexact Exception Flag
#define SYSEXC_MIS_OFCMIS 0x00000010 // Overflow Exception Flag
#define SYSEXC_MIS_UFCMIS 0x00000008 // Underflow Exception Flag
#define SYSEXC_MIS_IOCMIS 0x00000004 // Invalid Operation Flag
#define SYSEXC_MIS_DZCMIS 0x00000002 // Divide By 0 Exception Flag
#define SYSEXC_MIS_IDCMIS 0x00000001 // Input Denormal Exception Flag
//*****************************************************************************
//
// The following are defines for the bit fields in the SYSEXC_IC register.
//
//*****************************************************************************
#define SYSEXC_IC_IXCIC 0x00000020 // Inexact Exception Flag
#define SYSEXC_IC_OFCIC 0x00000010 // Overflow Exception Flag
#define SYSEXC_IC_UFCIC 0x00000008 // Underflow Exception Flag
#define SYSEXC_IC_IOCIC 0x00000004 // Invalid Operation Flag
#define SYSEXC_IC_DZCIC 0x00000002 // Divide By 0 Exception Flag
#define SYSEXC_IC_IDCIC 0x00000001 // Input Denormal Exception Flag
#endif // __HW_SYSEXC_H__
|
/*
* Copyright (c) 2013 Qualcomm Atheros, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef SPECTRAL_COMMON_H
#define SPECTRAL_COMMON_H
#define SPECTRAL_HT20_NUM_BINS 56
#define SPECTRAL_HT20_40_NUM_BINS 128
/* TODO: could possibly be 512, but no samples this large
* could be acquired so far.
*/
#define SPECTRAL_ATH10K_MAX_NUM_BINS 256
#define SPECTRAL_ATH11K_MAX_NUM_BINS 512
/* FFT sample format given to userspace via debugfs.
*
* Please keep the type/length at the front position and change
* other fields after adding another sample type
*
* TODO: this might need rework when switching to nl80211-based
* interface.
*/
enum ath_fft_sample_type {
ATH_FFT_SAMPLE_HT20 = 1,
ATH_FFT_SAMPLE_HT20_40,
ATH_FFT_SAMPLE_ATH10K,
ATH_FFT_SAMPLE_ATH11K
};
struct fft_sample_tlv {
u8 type; /* see ath_fft_sample */
__be16 length;
/* type dependent data follows */
} __packed;
struct fft_sample_ht20 {
struct fft_sample_tlv tlv;
u8 max_exp;
__be16 freq;
s8 rssi;
s8 noise;
__be16 max_magnitude;
u8 max_index;
u8 bitmap_weight;
__be64 tsf;
u8 data[SPECTRAL_HT20_NUM_BINS];
} __packed;
struct fft_sample_ht20_40 {
struct fft_sample_tlv tlv;
u8 channel_type;
__be16 freq;
s8 lower_rssi;
s8 upper_rssi;
__be64 tsf;
s8 lower_noise;
s8 upper_noise;
__be16 lower_max_magnitude;
__be16 upper_max_magnitude;
u8 lower_max_index;
u8 upper_max_index;
u8 lower_bitmap_weight;
u8 upper_bitmap_weight;
u8 max_exp;
u8 data[SPECTRAL_HT20_40_NUM_BINS];
} __packed;
struct fft_sample_ath10k {
struct fft_sample_tlv tlv;
u8 chan_width_mhz;
__be16 freq1;
__be16 freq2;
__be16 noise;
__be16 max_magnitude;
__be16 total_gain_db;
__be16 base_pwr_db;
__be64 tsf;
s8 max_index;
u8 rssi;
u8 relpwr_db;
u8 avgpwr_db;
u8 max_exp;
u8 data[0];
} __packed;
struct fft_sample_ath11k {
struct fft_sample_tlv tlv;
u8 chan_width_mhz;
s8 max_index;
u8 max_exp;
__be16 freq1;
__be16 freq2;
__be16 max_magnitude;
__be16 rssi;
__be32 tsf;
__be32 noise;
u8 data[0];
} __packed;
#endif /* SPECTRAL_COMMON_H */
|
/*
* Copyright 2012 Red Hat Inc.
*
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "nv50.h"
#include "outpdp.h"
#include <subdev/timer.h>
static inline u32
gm200_sor_soff(struct nvkm_output_dp *outp)
{
return (ffs(outp->base.info.or) - 1) * 0x800;
}
static inline u32
gm200_sor_loff(struct nvkm_output_dp *outp)
{
return gm200_sor_soff(outp) + !(outp->base.info.sorconf.link & 1) * 0x80;
}
void
gm200_sor_magic(struct nvkm_output *outp)
{
struct nvkm_device *device = outp->disp->engine.subdev.device;
const u32 soff = outp->or * 0x100;
const u32 data = outp->or + 1;
if (outp->info.sorconf.link & 1)
nvkm_mask(device, 0x612308 + soff, 0x0000001f, 0x00000000 | data);
if (outp->info.sorconf.link & 2)
nvkm_mask(device, 0x612388 + soff, 0x0000001f, 0x00000010 | data);
}
static inline u32
gm200_sor_dp_lane_map(struct nvkm_device *device, u8 lane)
{
return lane * 0x08;
}
static int
gm200_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr)
{
struct nvkm_device *device = outp->base.disp->engine.subdev.device;
const u32 soff = gm200_sor_soff(outp);
const u32 loff = gm200_sor_loff(outp);
u32 mask = 0, i;
for (i = 0; i < nr; i++)
mask |= 1 << (gm200_sor_dp_lane_map(device, i) >> 3);
nvkm_mask(device, 0x61c130 + loff, 0x0000000f, mask);
nvkm_mask(device, 0x61c034 + soff, 0x80000000, 0x80000000);
nvkm_msec(device, 2000,
if (!(nvkm_rd32(device, 0x61c034 + soff) & 0x80000000))
break;
);
return 0;
}
static int
gm200_sor_dp_drv_ctl(struct nvkm_output_dp *outp,
int ln, int vs, int pe, int pc)
{
struct nvkm_device *device = outp->base.disp->engine.subdev.device;
struct nvkm_bios *bios = device->bios;
const u32 shift = gm200_sor_dp_lane_map(device, ln);
const u32 loff = gm200_sor_loff(outp);
u32 addr, data[4];
u8 ver, hdr, cnt, len;
struct nvbios_dpout info;
struct nvbios_dpcfg ocfg;
addr = nvbios_dpout_match(bios, outp->base.info.hasht,
outp->base.info.hashm,
&ver, &hdr, &cnt, &len, &info);
if (!addr)
return -ENODEV;
addr = nvbios_dpcfg_match(bios, addr, pc, vs, pe,
&ver, &hdr, &cnt, &len, &ocfg);
if (!addr)
return -EINVAL;
ocfg.tx_pu &= 0x0f;
data[0] = nvkm_rd32(device, 0x61c118 + loff) & ~(0x000000ff << shift);
data[1] = nvkm_rd32(device, 0x61c120 + loff) & ~(0x000000ff << shift);
data[2] = nvkm_rd32(device, 0x61c130 + loff);
if ((data[2] & 0x00000f00) < (ocfg.tx_pu << 8) || ln == 0)
data[2] = (data[2] & ~0x00000f00) | (ocfg.tx_pu << 8);
nvkm_wr32(device, 0x61c118 + loff, data[0] | (ocfg.dc << shift));
nvkm_wr32(device, 0x61c120 + loff, data[1] | (ocfg.pe << shift));
nvkm_wr32(device, 0x61c130 + loff, data[2]);
data[3] = nvkm_rd32(device, 0x61c13c + loff) & ~(0x000000ff << shift);
nvkm_wr32(device, 0x61c13c + loff, data[3] | (ocfg.pc << shift));
return 0;
}
static const struct nvkm_output_dp_func
gm200_sor_dp_func = {
.pattern = gm107_sor_dp_pattern,
.lnk_pwr = gm200_sor_dp_lnk_pwr,
.lnk_ctl = gf119_sor_dp_lnk_ctl,
.drv_ctl = gm200_sor_dp_drv_ctl,
};
int
gm200_sor_dp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
struct nvkm_output **poutp)
{
return nvkm_output_dp_new_(&gm200_sor_dp_func, disp, index, dcbE, poutp);
}
|
/*
* QEMU Empty Slot
*
* The empty_slot device emulates known to a bus but not connected devices.
*
* Copyright (c) 2010 Artyom Tarasenko
*
* This code is licensed under the GNU GPL v2 or (at your option) any later
* version.
*/
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/empty_slot.h"
//#define DEBUG_EMPTY_SLOT
#ifdef DEBUG_EMPTY_SLOT
#define DPRINTF(fmt, ...) \
do { printf("empty_slot: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, ...) do {} while (0)
#endif
#define TYPE_EMPTY_SLOT "empty_slot"
#define EMPTY_SLOT(obj) OBJECT_CHECK(EmptySlot, (obj), TYPE_EMPTY_SLOT)
typedef struct EmptySlot {
SysBusDevice parent_obj;
MemoryRegion iomem;
uint64_t size;
} EmptySlot;
static uint64_t empty_slot_read(void *opaque, hwaddr addr,
unsigned size)
{
DPRINTF("read from " TARGET_FMT_plx "\n", addr);
return 0;
}
static void empty_slot_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
DPRINTF("write 0x%x to " TARGET_FMT_plx "\n", (unsigned)val, addr);
}
static const MemoryRegionOps empty_slot_ops = {
.read = empty_slot_read,
.write = empty_slot_write,
.endianness = DEVICE_NATIVE_ENDIAN,
};
void empty_slot_init(hwaddr addr, uint64_t slot_size)
{
if (slot_size > 0) {
/* Only empty slots larger than 0 byte need handling. */
DeviceState *dev;
SysBusDevice *s;
EmptySlot *e;
dev = qdev_create(NULL, TYPE_EMPTY_SLOT);
s = SYS_BUS_DEVICE(dev);
e = EMPTY_SLOT(dev);
e->size = slot_size;
qdev_init_nofail(dev);
sysbus_mmio_map(s, 0, addr);
}
}
static int empty_slot_init1(SysBusDevice *dev)
{
EmptySlot *s = EMPTY_SLOT(dev);
memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
"empty-slot", s->size);
sysbus_init_mmio(dev, &s->iomem);
return 0;
}
static void empty_slot_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = empty_slot_init1;
}
static const TypeInfo empty_slot_info = {
.name = TYPE_EMPTY_SLOT,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(EmptySlot),
.class_init = empty_slot_class_init,
};
static void empty_slot_register_types(void)
{
type_register_static(&empty_slot_info);
}
type_init(empty_slot_register_types)
|
#ifndef FARRAY_H
#define FARRAY_H
#include <stdexcept>
#include <string>
class Farray
{
public:
// Size constructor
Farray(int nrows, int ncols);
// Copy constructor
Farray(const Farray & source);
// Destructor
~Farray();
// Assignment operator
Farray & operator=(const Farray & source);
// Equals operator
bool operator==(const Farray & other) const;
// Length accessors
int nrows() const;
int ncols() const;
// Set item accessor
long & operator()(int i, int j);
// Get item accessor
const long & operator()(int i, int j) const;
// String output
std::string asString() const;
// Get view
void view(int* nrows, int* ncols, long** data) const;
private:
// Members
int _nrows;
int _ncols;
long * _buffer;
// Default constructor: not implemented
Farray();
// Methods
void allocateMemory();
int offset(int i, int j) const;
};
#endif
|
/* { dg-do run } */
/* { dg-options "-march=x86-64 -msse4 -mfma4" } */
extern void abort (void);
int
main ()
{
#if !defined __SSE__
abort ();
#endif
#if !defined __SSE2__
abort ();
#endif
#if !defined __SSE3__
abort ();
#endif
#if !defined __SSSE3__
abort ();
#endif
#if !defined __SSE4_1__
abort ();
#endif
#if !defined __SSE4_2__
abort ();
#endif
#if !defined __SSE4A__
abort ();
#endif
#if !defined __AVX__
abort ();
#endif
#if !defined __FMA4__
abort ();
#endif
return 0;
}
|
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <net/fou.h>
#include <net/ip.h>
#include <net/ip6_tunnel.h>
#include <net/ip6_checksum.h>
#include <net/protocol.h>
#include <net/udp.h>
#include <net/udp_tunnel.h>
#if IS_ENABLED(CONFIG_IPV6_FOU_TUNNEL)
static void fou6_build_udp(struct sk_buff *skb, struct ip_tunnel_encap *e,
struct flowi6 *fl6, u8 *protocol, __be16 sport)
{
struct udphdr *uh;
skb_push(skb, sizeof(struct udphdr));
skb_reset_transport_header(skb);
uh = udp_hdr(skb);
uh->dest = e->dport;
uh->source = sport;
uh->len = htons(skb->len);
udp6_set_csum(!(e->flags & TUNNEL_ENCAP_FLAG_CSUM6), skb,
&fl6->saddr, &fl6->daddr, skb->len);
*protocol = IPPROTO_UDP;
}
static int fou6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
u8 *protocol, struct flowi6 *fl6)
{
__be16 sport;
int err;
int type = e->flags & TUNNEL_ENCAP_FLAG_CSUM6 ?
SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
err = __fou_build_header(skb, e, protocol, &sport, type);
if (err)
return err;
fou6_build_udp(skb, e, fl6, protocol, sport);
return 0;
}
static int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
u8 *protocol, struct flowi6 *fl6)
{
__be16 sport;
int err;
int type = e->flags & TUNNEL_ENCAP_FLAG_CSUM6 ?
SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
err = __gue_build_header(skb, e, protocol, &sport, type);
if (err)
return err;
fou6_build_udp(skb, e, fl6, protocol, sport);
return 0;
}
static const struct ip6_tnl_encap_ops fou_ip6tun_ops = {
.encap_hlen = fou_encap_hlen,
.build_header = fou6_build_header,
};
static const struct ip6_tnl_encap_ops gue_ip6tun_ops = {
.encap_hlen = gue_encap_hlen,
.build_header = gue6_build_header,
};
static int ip6_tnl_encap_add_fou_ops(void)
{
int ret;
ret = ip6_tnl_encap_add_ops(&fou_ip6tun_ops, TUNNEL_ENCAP_FOU);
if (ret < 0) {
pr_err("can't add fou6 ops\n");
return ret;
}
ret = ip6_tnl_encap_add_ops(&gue_ip6tun_ops, TUNNEL_ENCAP_GUE);
if (ret < 0) {
pr_err("can't add gue6 ops\n");
ip6_tnl_encap_del_ops(&fou_ip6tun_ops, TUNNEL_ENCAP_FOU);
return ret;
}
return 0;
}
static void ip6_tnl_encap_del_fou_ops(void)
{
ip6_tnl_encap_del_ops(&fou_ip6tun_ops, TUNNEL_ENCAP_FOU);
ip6_tnl_encap_del_ops(&gue_ip6tun_ops, TUNNEL_ENCAP_GUE);
}
#else
static int ip6_tnl_encap_add_fou_ops(void)
{
return 0;
}
static void ip6_tnl_encap_del_fou_ops(void)
{
}
#endif
static int __init fou6_init(void)
{
int ret;
ret = ip6_tnl_encap_add_fou_ops();
return ret;
}
static void __exit fou6_fini(void)
{
ip6_tnl_encap_del_fou_ops();
}
module_init(fou6_init);
module_exit(fou6_fini);
MODULE_AUTHOR("Tom Herbert <therbert@google.com>");
MODULE_LICENSE("GPL");
|
/*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASM_DMA_MAPPING_H
#define __ASM_DMA_MAPPING_H
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/vmalloc.h>
#include <asm-generic/dma-coherent.h>
#include <xen/xen.h>
#include <asm/xen/hypervisor.h>
#define DMA_ERROR_CODE (~(dma_addr_t)0)
extern const struct dma_map_ops *dma_ops;
extern const struct dma_map_ops coherent_swiotlb_dma_ops;
extern const struct dma_map_ops noncoherent_swiotlb_dma_ops;
static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
{
if (unlikely(!dev) || !dev->archdata.dma_ops)
return dma_ops;
else
return dev->archdata.dma_ops;
}
static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
{
dev->archdata.dma_ops = ops;
}
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
{
if (xen_initial_domain())
return xen_dma_ops;
else
return __generic_dma_ops(dev);
}
#include <asm-generic/dma-mapping-common.h>
static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
{
return (dma_addr_t)paddr;
}
static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
{
return (phys_addr_t)dev_addr;
}
static inline int dma_mapping_error(struct device *dev, dma_addr_t dev_addr)
{
const struct dma_map_ops *ops = get_dma_ops(dev);
debug_dma_mapping_error(dev, dev_addr);
return ops->mapping_error(dev, dev_addr);
}
static inline int dma_supported(struct device *dev, u64 mask)
{
const struct dma_map_ops *ops = get_dma_ops(dev);
return ops->dma_supported(dev, mask);
}
static inline int dma_set_mask(struct device *dev, u64 mask)
{
if (!dev->dma_mask || !dma_supported(dev, mask))
return -EIO;
*dev->dma_mask = mask;
return 0;
}
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
{
if (!dev->dma_mask)
return 0;
return addr + size - 1 <= *dev->dma_mask;
}
static inline void dma_mark_clean(void *addr, size_t size)
{
}
#define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL)
#define dma_free_coherent(d, s, h, f) dma_free_attrs(d, s, h, f, NULL)
static inline void *dma_alloc_attrs(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flags,
struct dma_attrs *attrs)
{
const struct dma_map_ops *ops = get_dma_ops(dev);
void *vaddr;
if (dma_alloc_from_coherent(dev, size, dma_handle, &vaddr))
return vaddr;
vaddr = ops->alloc(dev, size, dma_handle, flags, attrs);
debug_dma_alloc_coherent(dev, size, *dma_handle, vaddr);
return vaddr;
}
static inline void dma_free_attrs(struct device *dev, size_t size,
void *vaddr, dma_addr_t dev_addr,
struct dma_attrs *attrs)
{
const struct dma_map_ops *ops = get_dma_ops(dev);
if (dma_release_from_coherent(dev, get_order(size), vaddr))
return;
debug_dma_free_coherent(dev, size, vaddr, dev_addr);
ops->free(dev, size, vaddr, dev_addr, attrs);
}
static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
}
static inline void dma_free_writecombine(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t dma_handle)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
}
static inline void *dma_alloc_nonconsistent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs);
return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
}
static inline void dma_free_nonconsistent(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t dma_handle)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs);
return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
}
static inline int dma_mmap_nonconsistent(struct device *dev,
struct vm_area_struct *vma, void *cpu_addr,
dma_addr_t dma_addr, size_t size)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs);
return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
}
/*
* There is no dma_cache_sync() implementation, so just return NULL here.
*/
static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t flags)
{
return NULL;
}
static inline void dma_free_noncoherent(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t handle)
{
}
#endif /* __KERNEL__ */
#endif /* __ASM_DMA_MAPPING_H */
|
#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
#define MADV_DODUMP 17
#define MADV_DOFORK 11
#define MADV_DONTDUMP 16
#define MADV_DONTFORK 10
#define MADV_DONTNEED 4
#define MADV_FREE 8
#define MADV_HUGEPAGE 14
#define MADV_MERGEABLE 12
#define MADV_NOHUGEPAGE 15
#define MADV_NORMAL 0
#define MADV_RANDOM 1
#define MADV_REMOVE 9
#define MADV_SEQUENTIAL 2
#define MADV_UNMERGEABLE 13
#define MADV_WILLNEED 3
#define MAP_ANONYMOUS 0x0800
#define MAP_DENYWRITE 0x2000
#define MAP_EXECUTABLE 0x4000
#define MAP_FILE 0
#define MAP_FIXED 0x010
#define MAP_GROWSDOWN 0x1000
#define MAP_HUGETLB 0x80000
#define MAP_LOCKED 0x8000
#define MAP_NONBLOCK 0x20000
#define MAP_NORESERVE 0x0400
#define MAP_POPULATE 0x10000
#define MAP_PRIVATE 0x002
#define MAP_SHARED 0x001
#define MAP_STACK 0x40000
#define PROT_EXEC 0x4
#define PROT_GROWSDOWN 0x01000000
#define PROT_GROWSUP 0x02000000
#define PROT_NONE 0x0
#define PROT_READ 0x1
#define PROT_SEM 0x10
#define PROT_WRITE 0x2
/* MADV_HWPOISON is undefined on xtensa, fix it for perf */
#define MADV_HWPOISON 100
/* MADV_SOFT_OFFLINE is undefined on xtensa, fix it for perf */
#define MADV_SOFT_OFFLINE 101
/* MAP_32BIT is undefined on xtensa, fix it for perf */
#define MAP_32BIT 0
/* MAP_UNINITIALIZED is undefined on xtensa, fix it for perf */
#define MAP_UNINITIALIZED 0
#endif
|
/*
* linux/arch/unicore32/include/asm/cache.h
*
* Code specific to PKUnity SoC and UniCore ISA
*
* Copyright (C) 2001-2010 GUAN Xue-tao
*
* 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.
*/
#ifndef __UNICORE_CACHE_H__
#define __UNICORE_CACHE_H__
#define L1_CACHE_SHIFT (5)
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/*
* Memory returned by kmalloc() may be used for DMA, so we must make
* sure that all such allocations are cache aligned. Otherwise,
* unrelated code may cause parts of the buffer to be read into the
* cache before the transfer is done, causing old data to be seen by
* the CPU.
*/
#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
#endif
|
/*******************************************************************************
This is the driver for the MAC 10/100 on-chip Ethernet controller
currently tested on all the ST boards based on STb7109 and stx7200 SoCs.
DWC Ether MAC 10/100 Universal version 4.0 has been used for developing
this code.
This only implements the mac core functions for this chip.
Copyright (C) 2007-2009 STMicroelectronics Ltd
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
#include <linux/crc32.h>
#include <asm/io.h>
#include "dwmac100.h"
static void dwmac100_core_init(void __iomem *ioaddr)
{
u32 value = readl(ioaddr + MAC_CONTROL);
writel((value | MAC_CORE_INIT), ioaddr + MAC_CONTROL);
#ifdef STMMAC_VLAN_TAG_USED
writel(ETH_P_8021Q, ioaddr + MAC_VLAN1);
#endif
}
static void dwmac100_dump_mac_regs(void __iomem *ioaddr)
{
pr_info("\t----------------------------------------------\n"
"\t DWMAC 100 CSR (base addr = 0x%p)\n"
"\t----------------------------------------------\n", ioaddr);
pr_info("\tcontrol reg (offset 0x%x): 0x%08x\n", MAC_CONTROL,
readl(ioaddr + MAC_CONTROL));
pr_info("\taddr HI (offset 0x%x): 0x%08x\n ", MAC_ADDR_HIGH,
readl(ioaddr + MAC_ADDR_HIGH));
pr_info("\taddr LO (offset 0x%x): 0x%08x\n", MAC_ADDR_LOW,
readl(ioaddr + MAC_ADDR_LOW));
pr_info("\tmulticast hash HI (offset 0x%x): 0x%08x\n",
MAC_HASH_HIGH, readl(ioaddr + MAC_HASH_HIGH));
pr_info("\tmulticast hash LO (offset 0x%x): 0x%08x\n",
MAC_HASH_LOW, readl(ioaddr + MAC_HASH_LOW));
pr_info("\tflow control (offset 0x%x): 0x%08x\n",
MAC_FLOW_CTRL, readl(ioaddr + MAC_FLOW_CTRL));
pr_info("\tVLAN1 tag (offset 0x%x): 0x%08x\n", MAC_VLAN1,
readl(ioaddr + MAC_VLAN1));
pr_info("\tVLAN2 tag (offset 0x%x): 0x%08x\n", MAC_VLAN2,
readl(ioaddr + MAC_VLAN2));
}
static int dwmac100_rx_ipc_enable(void __iomem *ioaddr)
{
return 0;
}
static int dwmac100_irq_status(void __iomem *ioaddr,
struct stmmac_extra_stats *x)
{
return 0;
}
static void dwmac100_set_umac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n)
{
stmmac_set_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW);
}
static void dwmac100_get_umac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n)
{
stmmac_get_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW);
}
static void dwmac100_set_filter(struct net_device *dev, int id)
{
void __iomem *ioaddr = (void __iomem *)dev->base_addr;
u32 value = readl(ioaddr + MAC_CONTROL);
if (dev->flags & IFF_PROMISC) {
value |= MAC_CONTROL_PR;
value &= ~(MAC_CONTROL_PM | MAC_CONTROL_IF | MAC_CONTROL_HO |
MAC_CONTROL_HP);
} else if ((netdev_mc_count(dev) > HASH_TABLE_SIZE)
|| (dev->flags & IFF_ALLMULTI)) {
value |= MAC_CONTROL_PM;
value &= ~(MAC_CONTROL_PR | MAC_CONTROL_IF | MAC_CONTROL_HO);
writel(0xffffffff, ioaddr + MAC_HASH_HIGH);
writel(0xffffffff, ioaddr + MAC_HASH_LOW);
} else if (netdev_mc_empty(dev)) { /* no multicast */
value &= ~(MAC_CONTROL_PM | MAC_CONTROL_PR | MAC_CONTROL_IF |
MAC_CONTROL_HO | MAC_CONTROL_HP);
} else {
u32 mc_filter[2];
struct netdev_hw_addr *ha;
/* Perfect filter mode for physical address and Hash
* filter for multicast
*/
value |= MAC_CONTROL_HP;
value &= ~(MAC_CONTROL_PM | MAC_CONTROL_PR |
MAC_CONTROL_IF | MAC_CONTROL_HO);
memset(mc_filter, 0, sizeof(mc_filter));
netdev_for_each_mc_addr(ha, dev) {
/* The upper 6 bits of the calculated CRC are used to
* index the contens of the hash table
*/
int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
/* The most significant bit determines the register to
* use (H/L) while the other 5 bits determine the bit
* within the register.
*/
mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
}
writel(mc_filter[0], ioaddr + MAC_HASH_LOW);
writel(mc_filter[1], ioaddr + MAC_HASH_HIGH);
}
writel(value, ioaddr + MAC_CONTROL);
}
static void dwmac100_flow_ctrl(void __iomem *ioaddr, unsigned int duplex,
unsigned int fc, unsigned int pause_time)
{
unsigned int flow = MAC_FLOW_CTRL_ENABLE;
if (duplex)
flow |= (pause_time << MAC_FLOW_CTRL_PT_SHIFT);
writel(flow, ioaddr + MAC_FLOW_CTRL);
}
/* No PMT module supported on ST boards with this Eth chip. */
static void dwmac100_pmt(void __iomem *ioaddr, unsigned long mode)
{
return;
}
static const struct stmmac_ops dwmac100_ops = {
.core_init = dwmac100_core_init,
.rx_ipc = dwmac100_rx_ipc_enable,
.dump_regs = dwmac100_dump_mac_regs,
.host_irq_status = dwmac100_irq_status,
.set_filter = dwmac100_set_filter,
.flow_ctrl = dwmac100_flow_ctrl,
.pmt = dwmac100_pmt,
.set_umac_addr = dwmac100_set_umac_addr,
.get_umac_addr = dwmac100_get_umac_addr,
};
struct mac_device_info *dwmac100_setup(void __iomem *ioaddr)
{
struct mac_device_info *mac;
mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL);
if (!mac)
return NULL;
pr_info("\tDWMAC100\n");
mac->mac = &dwmac100_ops;
mac->dma = &dwmac100_dma_ops;
mac->link.port = MAC_CONTROL_PS;
mac->link.duplex = MAC_CONTROL_F;
mac->link.speed = 0;
mac->mii.addr = MAC_MII_ADDR;
mac->mii.data = MAC_MII_DATA;
mac->synopsys_uid = 0;
return mac;
}
|
#ifndef _LINUX_ATOMIC_H
#define _LINUX_ATOMIC_H
#include <asm/atomic.h>
/**
* atomic_inc_not_zero_hint - increment if not null
* @v: pointer of type atomic_t
* @hint: probable value of the atomic before the increment
*
* This version of atomic_inc_not_zero() gives a hint of probable
* value of the atomic. This helps processor to not read the memory
* before doing the atomic read/modify/write cycle, lowering
* number of bus transactions on some arches.
*
* Returns: 0 if increment was not done, 1 otherwise.
*/
#ifndef atomic_inc_not_zero_hint
static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint)
{
int val, c = hint;
/* sanity test, should be removed by compiler if hint is a constant */
if (!hint)
return atomic_inc_not_zero(v);
do {
val = atomic_cmpxchg(v, c, c + 1);
if (val == c)
return 1;
c = val;
} while (c);
return 0;
}
#endif
#ifndef CONFIG_ARCH_HAS_ATOMIC_OR
static inline void atomic_or(int i, atomic_t *v)
{
int old;
int new;
do {
old = atomic_read(v);
new = old | i;
} while (atomic_cmpxchg(v, old, new) != old);
}
#endif /* #ifndef CONFIG_ARCH_HAS_ATOMIC_OR */
#endif /* _LINUX_ATOMIC_H */
|
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stddef.h>
#include <stdint.h>
#include <inttypes.h>
#include <libgen.h>
#include <signal.h>
#include <time.h>
#include <limits.h>
#include <sys/sysinfo.h>
#include <utmpx.h>
#include <time.h>
#include <sys/time.h>
#include <alloca.h>
#include <sys/wait.h>
#include <sys/utsname.h>
#include <sys/vfs.h>
#include <grp.h>
#include <pwd.h>
#include <ctype.h>
#include <sched.h>
#include <dirent.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <wctype.h>
#include <wchar.h>
#include <locale.h>
#include <sys/sendfile.h>
#include <ftw.h>
#include <regex.h>
#include "flags.h"
#include "math.h"
//#include "memspn.h"
#include "parsenumb.h"
//#include "parsemode.h"
#include "random.h"
#include "unescape.h"
#include "uptime.h"
//#include "readaline.h"
#include "copyfd.h"
#include "hashtable.h"
#include "sequential.h"
#include "itoa.h"
#include "casestr.h"
#define arrsize(a) (sizeof(a)/sizeof(*a))
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
struct str {
char *str;
size_t len;
};
void *memdup(const void *mem, size_t len);
mode_t getumask();
// "gross" -- people in ##c
#define casebin '0': case '1'
#define caseoct casebin : case '2': case '3': case '4': case '5': case '6': case '7'
#define casedec caseoct : case '8': case '9'
#define caselhex casedec : case 'a': case 'b': case 'c': case 'd': case 'e': case 'f'
#define caseuhex casedec : case 'A': case 'B': case 'C': case 'D': case 'E': case 'F'
#define casehex caselhex: case 'A': case 'B': case 'C': case 'D': case 'E': case 'F'
#define caselower 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': \
case 'h': case 'i': case 'j': case 'l': case 'm': case 'n': \
case 'o': case 'p': case 'q': case 'r': case 's': case 't': \
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z'
#define caseupper 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': \
case 'H': case 'I': case 'J': case 'L': case 'M': case 'N': \
case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': \
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z'
#define casealpha caselower: case caseupper
#define casealnum casealpha: case casedec
#define casepunct '\\': case '[': case ']': case '!': case '"': case '#': case '$': \
case '%': case '&': case '(': case ')': case '*': case '+': \
case ',': case '.': case '/': case ':': case ';': case '<': \
case '=': case '>': case '?': case '@': case '^': case '_': \
case '`': case '{': case '|': case '}': case '~': case '-': case '\''
#define caseblank ' ': case '\t':
#define casespace caseblank: case '\v': case '\f': case '\r': case '\n'
// for _FORTIFY_SOURCE
#if __GNUC__ && ! __clang__
#define UNUSED(x) do { __auto_type __unused __attribute__((unused)) = (x); } while (0)
#else
#define UNUSED(x) (void) (x)
#endif
#define scalenum(x) ((x) > (1<<30) ? (x) / (1.0 * (1<<30)) : \
(x) > (1<<20) ? (x) / (1.0 * (1<<20)) : \
(x) > (1<<10) ? (x) / (1.0 * (1<<10)) : (x))
#define unit(x) ((x) > (1<<30) ? 'G' : \
(x) > (1<<20) ? 'M' : \
(x) > (1<<10) ? 'K' : 'B')
#define scale(x) scalenum(x), unit(x)
#define Case break; case
#define Default break; default
#define IBUFSIZ (128*1024)
#define attrpure __attribute__((pure))
#define attrconst __attribute__((const))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#include "alloc.h"
// iterate over a compile time list
// iterate(string, "foo", "bar", "baz") {
// puts(*string);
// }
#define iterate(var, firstelem, ...) \
for (int __i = 0; __i < 1; ) \
for (__auto_type __first = firstelem; __i < 1; __i++) \
for (__typeof(*&__first) __tmp[] = { firstelem, __VA_ARGS__ }, \
*var = __tmp; \
var < __tmp + sizeof __tmp/sizeof *__tmp; \
var++)
// int *ptr = new(int[10]);
#define new(x) malloc(sizeof(x))
#undef getc
#define getc getc_unlocked
#undef getchar
#define getchar getchar_unlocked
#undef putc
#define putc putc_unlocked
#undef putchar
#define putchar putchar_unlocked
#undef clearerr
#define clearerr clearerr_unlocked
#undef feof
#define feof feof_unlocked
#undef ferror
#define ferror ferror_unlocked
#undef fileno
#define fileno fileno_unlocked
#undef fflush
#define fflush fflush_unlocked
#undef fgetc
#define fgetc fgetc_unlocked
#undef fputc
#define fputc fputc_unlocked
#undef fread
#define fread fread_unlocked
#undef fwrite
#define fwrite fwrite_unlocked
#undef fgets
#define fgets fgets_unlocked
#undef fputs
#define fputs fputs_unlocked
|
#pragma once
#define attr __attribute__
#include <stdbool.h>
#include <netdb.h>
typedef struct sockaddr SockAddr;
typedef struct addrinfo AddrInfo;
#define AutoAddrInfo attr((cleanup(ai_free))) AddrInfo
void ai_free(AddrInfo **const ai)
attr((nonnull));
void ai_print(const char *const prefix,
const int family,
SockAddr *const addr,
const char *const port,
const bool handle_errno)
attr((nonnull));
int xgetai(const char *const host,
const char *const port,
const int family,
const int socktype,
const int flags,
AddrInfo **result)
attr((warn_unused_result, nonnull(2, 6)));
|
/* ISC license. */
#include <skalibs/stralloc.h>
#include <s6-networking/sbearssl.h>
int sbearssl_rsa_pkey_from (sbearssl_rsa_pkey *l, br_rsa_public_key const *k, stralloc *sa)
{
if (!stralloc_readyplus(sa, k->nlen + k->elen)) return 0 ;
l->n = sa->len ;
stralloc_catb(sa, (char const *)k->n, k->nlen) ;
l->nlen = k->nlen ;
l->e = sa->len ;
stralloc_catb(sa, (char const *)k->e, k->elen) ;
l->elen = k->elen ;
return 1 ;
}
|
#ifndef LIBCHIKEN_STDDEF_H
#define LIBCHIKEN_STDDEF_H
#ifndef NULL
#define NULL ((void*)0)
#endif
#ifndef __SIZE_T_DEFINED
#define __SIZE_T_DEFINED
typedef unsigned long size_t;
#endif
#endif
|
#ifndef __VDS_WEB_SERVER_LIB_WEBSOCKET_API_H_
#define __VDS_WEB_SERVER_LIB_WEBSOCKET_API_H_
/*
Copyright (c) 2017, Vadim Malyshev, lboss75@gmail.com
All rights reserved
*/
#include "http_request.h"
#include "http_response.h"
namespace vds {
class websocket_output;
class websocket_api : public std::enable_shared_from_this<websocket_api> {
public:
websocket_api();
static vds::async_task<vds::expected<std::shared_ptr<stream_output_async<uint8_t>>>> open_connection(
const vds::service_provider * sp,
std::shared_ptr<http_async_serializer> output_stream,
const http_message & /*message*/);
private:
class subscribe_handler : public std::enable_shared_from_this<subscribe_handler>
{
public:
subscribe_handler(
std::string cb,
const_data_buffer channel_id);
async_task<expected<void>> process(
const vds::service_provider * sp,
std::weak_ptr<websocket_output> output_stream);
private:
std::string cb_;
const_data_buffer channel_id_;
int last_id_;
};
timer subscribe_timer_;
std::list<std::shared_ptr<subscribe_handler>> subscribe_handlers_;
async_task<expected<std::shared_ptr<json_value>>> process_message(
const vds::service_provider * sp,
std::shared_ptr<websocket_output> output_stream,
const std::shared_ptr<json_value> & message,
std::list<lambda_holder_t<async_task<expected<void>>>> & post_tasks);
static async_task<expected<void>> process_api_message(
const vds::service_provider* sp,
std::shared_ptr<websocket_output> output_stream,
std::shared_ptr<websocket_api> api,
const_data_buffer data);
async_task<expected<std::shared_ptr<json_value>>> process_message(
const vds::service_provider * sp,
std::shared_ptr<websocket_output> output_stream,
int id,
const std::shared_ptr<json_object> & request,
std::list<lambda_holder_t<async_task<expected<void>>>> & post_tasks);
async_task<expected<void>> login(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
std::string login);
async_task<expected<void>> log_head(
const vds::service_provider* sp,
std::shared_ptr<json_object> result);
async_task<expected<void>> upload(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
const_data_buffer body);
std::shared_ptr<subscribe_handler> subscribe_channel(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
std::string cb,
const_data_buffer channel_id);
expected<void> start_timer(
const vds::service_provider * sp,
std::shared_ptr<websocket_output> output_stream);
async_task<expected<void>> devices(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
const_data_buffer owner_id);
async_task<expected<void>> get_channel_messages(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
const_data_buffer channel_id,
int64_t last_id,
uint32_t limit);
async_task<expected<void>> allocate_storage(
const vds::service_provider* sp,
std::shared_ptr<json_object> result,
asymmetric_public_key user_public_key,
foldername folder);
async_task<expected<void>> looking_block(
const vds::service_provider* sp,
std::shared_ptr<json_object> result,
const_data_buffer data_hash);
async_task<expected<void>> prepare_download(
const vds::service_provider* sp,
std::shared_ptr<json_object> result,
std::vector<const_data_buffer> object_ids);
async_task<expected<void>> download(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
std::vector<const_data_buffer> object_ids);
async_task<expected<void>> broadcast(
const vds::service_provider * sp,
std::shared_ptr<json_object> result,
const_data_buffer body);
async_task<expected<void>> get_balance(
const vds::service_provider* sp,
std::shared_ptr<json_object> result,
const_data_buffer wallet_id);
async_task<expected<void>> statistics(
const vds::service_provider* sp,
std::shared_ptr<json_object> result);
async_task<expected<void>> get_distribution_map(
const vds::service_provider* sp,
std::shared_ptr<json_object> result,
std::list<const_data_buffer> replicas);
};
}//vds
#endif //__VDS_WEB_SERVER_LIB_WEBSOCKET_API_H_
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2013 The Ocoin developer
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef OCOIN_INIT_H
#define OCOIN_INIT_H
#include "wallet.h"
extern CWallet* pwalletMain;
void StartShutdown();
void Shutdown(void* parg);
bool AppInit2();
std::string HelpMessage();
#endif
|
// For License please refer to LICENSE file in the root of Ophiuchus project
#import <UIKit/UIKit.h>
@interface YALInterfaceManager : NSObject
+ (UIColor *)yal_orange;
+ (UIColor *)yal_black;
@end
|
#ifndef UNABLETOREGISTERRAWINPUTDEVICEEXCEPTION_H
#define UNABLETOREGISTERRAWINPUTDEVICEEXCEPTION_H
#include "GraphicsException.h"
namespace thewizardplusplus {
namespace anna {
namespace graphics {
namespace exceptions {
class UnableToRegisterRawInputDeviceException : public GraphicsException {
public:
UnableToRegisterRawInputDeviceException(void);
};
}
}
}
}
#endif
|
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "KiwiConfiguration.h"
#import "KWBlockNode.h"
#import "KWExampleNode.h"
#if KW_BLOCKS_ENABLED
@interface KWBeforeAllNode : KWBlockNode<KWExampleNode>
#pragma mark -
#pragma mark Initializing
+ (id)beforeAllNodeWithCallSite:(KWCallSite *)aCallSite block:(KWVoidBlock)aBlock;
@end
#endif // #if KW_BLOCKS_ENABLED
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_environment_execl_18.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-18.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: environment Read input from an environment variable
* GoodSource: Fixed string
* Sink: execl
* BadSink : execute command with execl
* Flow Variant: 18 Control flow: goto statements
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "ls"
#define COMMAND_ARG2 "-la"
#define COMMAND_ARG3 data
#endif
#define ENV_VARIABLE "ADD"
#ifdef _WIN32
#define GETENV getenv
#else
#define GETENV getenv
#endif
#ifdef _WIN32
#include <process.h>
#define EXECL _execl
#else /* NOT _WIN32 */
#define EXECL execl
#endif
#ifndef OMITBAD
void CWE78_OS_Command_Injection__char_environment_execl_18_bad()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
goto source;
source:
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
/* execl - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() - use goodsource and badsink by reversing the blocks on the goto statement */
static void goodG2B()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
goto source;
source:
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
/* execl - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
void CWE78_OS_Command_Injection__char_environment_execl_18_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()...");
CWE78_OS_Command_Injection__char_environment_execl_18_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__char_environment_execl_18_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// HQDoorwayTransition.h
// CoreAnimation
//
// Created by apple on 16/4/6.
// Copyright © 2016年 HQ. All rights reserved.
//
#import <Foundation/Foundation.h>
CGFloat degreeToRadian(CGFloat degree);
@interface HQDoorwayTransition : NSObject
@property (nonatomic, assign) UIView *view;
@property (nonatomic, assign) UIView *originalView;
@property (nonatomic, assign) UIView *nextView;
+ (CGImageRef)clipImageFromLayer:(CALayer *)layer size:(CGSize)size offsetX:(CGFloat)offsetX;
- (id)initWithBaseView:(UIView *)baseView firstView:(UIView *)firstView lastView:(UIView *)lastView;
- (void)buildAnimation;
@end
|
#include "test-codecs.h"
void
check_codec (SquashCodec* codec) {
uint8_t uncompressed = (uint8_t) g_test_rand_int_range (0x00, 0xff);
size_t compressed_length = squash_codec_get_max_compressed_size (codec, 1);
uint8_t* compressed = (uint8_t*) malloc (compressed_length);
uint8_t decompressed;
size_t decompressed_length = 1;
SquashStatus res;
res = squash_codec_compress_with_options (codec, &compressed_length, compressed, 1, &uncompressed, NULL);
SQUASH_ASSERT_OK(res);
res = squash_codec_decompress_with_options (codec, &decompressed_length, &decompressed, compressed_length, compressed, NULL);
SQUASH_ASSERT_OK(res);
g_assert (decompressed_length == 1);
g_assert (uncompressed == decompressed);
free (compressed);
}
|
void sum(int a, int b) {
return 'a';
}
void* sub(int a, int *b) {
return (void *) b;
}
void nothing();
void nothing() {
return 0;
}
void nothing();
int main() {
sum(1, 2);
int a = sum(1, 2);
int *b = &a;
void *c = sub(1, b);
return 0.0;
}
|
/*
* CC3PODMeshNode.h
*
* cocos3d 0.6.4
* Author: Bill Hollings
* Copyright (c) 2010-2011 The Brenwill Workshop Ltd. All rights reserved.
* http://www.brenwill.com
*
* 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.
*
* http://en.wikipedia.org/wiki/MIT_License
*/
/** @file */ // Doxygen marker
#import "CC3MeshNode.h"
#import "CC3NodePODExtensions.h"
#pragma mark -
#pragma mark CC3MeshNode extensions for PVR POD data
/** Extensions to CC3MeshNode to support PVR POD data. */
@interface CC3MeshNode (PVRPOD)
/** The index of the material in the POD file used by this node. */
@property(nonatomic, assign) int podMaterialIndex;
@end
#pragma mark -
#pragma mark CC3PODMeshNode
/**
* A CC3MeshNode whose content originates from POD resource data.
*
* This is a concrete implementation of the CC3Node category PVRPOD.
*/
@interface CC3PODMeshNode : CC3MeshNode {
int podIndex;
int podContentIndex;
int podParentIndex;
int podMaterialIndex;
}
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@class NSData, NSString;
// Not exported
@interface SLTwitterRequestMultiPart : NSObject
{
NSData *_payload;
NSString *_name;
NSString *_type;
}
+ (id)multipartBoundary;
+ (id)multiPartWithName:(id)arg1 payload:(id)arg2 type:(id)arg3;
@property(copy, nonatomic) NSString *name; // @synthesize name=_name;
@property(copy, nonatomic) NSString *type; // @synthesize type=_type;
@property(retain, nonatomic) NSData *payload; // @synthesize payload=_payload;
- (void).cxx_destruct;
- (id)partData;
- (id)formPartData;
- (id)imagePartData;
@end
|
//
// AppDelegate.h
// GNApiSdk
//
// Created by Thomaz Feitoza on 5/5/15.
// Copyright (c) 2015 Gerencianet. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef SRC_FORCE_FIELD_POTENTIAL_EXTERNAL_H_
#define SRC_FORCE_FIELD_POTENTIAL_EXTERNAL_H_
#include <vector>
#include <map>
#include <iostream>
#include <iomanip>
#include <numeric>
#include "../molecules/bead.h"
#include "../molecules/molecule.h"
using namespace std;
/** "External potential" is only used for z-direction confined systems and it
includes uniform wall potentials, such as uniform Lennard-Jones wall,
charged wall or hard wall. */
class PotentialExternal{
private:
string name;
map<int, double> current_energy_map;
map<int, double> trial_energy_map;
double E_tot;
double dE;
public:
/////////////////////
// Initialization. //
/////////////////////
PotentialExternal(string);
virtual void ReadParameters() = 0;
void EnergyInitialization(vector < Molecule >& mols, double[], int);
///////////////////////////////
// Compute energy and force. //
///////////////////////////////
virtual double BeadEnergy(Bead&, double[]) = 0;
virtual double BeadForceOnWall(Bead&, double[]) = 0;
/////////////////////////////////
// Reading and storing energy. //
/////////////////////////////////
void SetE(int, int, double);
double GetE(int, int);
void SetEBothMaps(int, double);
double GetTotalEnergy();
double CalcTrialTotalEnergy(vector < Molecule >& mols, double[], int);
///////////////////
// MC utilities. //
///////////////////
void EnergyInitForLastMol(vector < Molecule >& mols, int, double, double[], int);
void AdjustEnergyUponMolDeletion(vector < Molecule >& mols, int);
double EnergyDifference(vector < Molecule >& mols, int, double[], int);
void FinalizeEnergyBothMaps(vector < Molecule >& mols, int, bool);
////////////
// Other. //
////////////
string PotentialName();
};
#endif
|
//
// UIAlertView+Extension.h
// ios-helpers
//
// Created by huang eleven on 1/10/14.
// Copyright (c) 2014 yijun huang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIAlertView (Extension)
- (void)disableButtonWithTitle: (NSString *)title;
- (void)enableButtonWithTitle: (NSString *)title;
@end
|
//
// ServeCustomer.h
//
// Authors:
// Sören Jentzsch <soren.jentzsch@gmail.com>
//
// Copyright (c) 2014 Sören Jentzsch
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef SERVECUSTOMER_H_
#define SERVECUSTOMER_H_
#include "StateMachine.h"
// States
struct serveInit;
struct serveRotatingToCustomer;
struct serveDrivingToCustomer;
struct serveWaitForPickup;
struct serveFinished;
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
// ServeCustomer
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
struct ServeCustomer : sc::state<ServeCustomer, StateMachine1, serveInit>
{
ServeCustomer(my_context ctx) : my_base(ctx) {
context<StateMachine1>().logAndDisplayStateName("ServeCustomer");
stateBehavCtrl = context<StateMachine1>().getStateBehavController();
curr_customer_id = stateBehavCtrl->getTaskManager()->getCurrCustomerOrder().customer_id;
vector< MsgCustomerPos > vecMsgCustomerPoses = DataProvider::getInstance()->getMsgCustomerPoses();
for(unsigned int i=0; i<vecMsgCustomerPoses.size(); i++)
{
if(curr_customer_id == vecMsgCustomerPoses.at(i).customer_id)
{
msgCustomerPos = new MsgCustomerPos(vecMsgCustomerPoses.at(i));
break;
}
}
} // entry
virtual ~ServeCustomer() {
} // exit
void rotateToCustomer() {
stateBehavCtrl->getMotorCtrl()->rotateToAbsAngle(RADTODEG(atan2(msgCustomerPos->y*1000 - stateBehavCtrl->getSensorControl()->getRobotY(), msgCustomerPos->x*1000 - stateBehavCtrl->getSensorControl()->getRobotX())));
}
void driveToCustomer() {
stateBehavCtrl->getMotorCtrl()->moveToAbsPosOnlyCF(msgCustomerPos->x*1000, msgCustomerPos->y*1000);
}
void serveDrink() {
stateBehavCtrl->getTaskManager()->serveDrink();
}
//Reactions
typedef mpl::list<
sc::transition<EvSuccess, Dispatcher, StateMachine1, &StateMachine1::nextTask>
> reactions;
private:
StateBehaviorController* stateBehavCtrl;
unsigned long curr_customer_id;
MsgCustomerPos* msgCustomerPos;
};
struct serveInit : sc::state<serveInit, ServeCustomer>
{
serveInit(my_context ctx) : my_base(ctx) {
context<StateMachine1>().logAndDisplayStateName("serveInit");
post_event(EvInit());
} // entry
virtual ~serveInit() {
} // exit
sc::result react(const EvInit&)
{
context<ServeCustomer>().rotateToCustomer();
return transit<serveRotatingToCustomer>();
}
//Reactions
typedef mpl::list<
sc::custom_reaction<EvInit>
> reactions;
};
struct serveRotatingToCustomer : sc::state<serveRotatingToCustomer, ServeCustomer>
{
serveRotatingToCustomer(my_context ctx) : my_base(ctx) {
context<StateMachine1>().logAndDisplayStateName("serveRotatingToCustomer");
} // entry
virtual ~serveRotatingToCustomer() {
} // exit
sc::result react(const EvMotorCtrlReady&)
{
context<ServeCustomer>().driveToCustomer();
return transit<serveDrivingToCustomer>();
}
//Reactions
typedef mpl::list<
sc::custom_reaction<EvMotorCtrlReady>
> reactions;
};
struct serveDrivingToCustomer : sc::state<serveDrivingToCustomer, ServeCustomer>
{
serveDrivingToCustomer(my_context ctx) : my_base(ctx) {
context<StateMachine1>().logAndDisplayStateName("serveDrivingToCustomer");
} // entry
virtual ~serveDrivingToCustomer() {
} // exit
sc::result react(const EvMotorCtrlReady&)
{
return transit<serveWaitForPickup>();
}
//Reactions
typedef mpl::list<
sc::custom_reaction<EvMotorCtrlReady>
> reactions;
};
struct serveWaitForPickup : sc::state<serveWaitForPickup, ServeCustomer>
{
serveWaitForPickup(my_context ctx) : my_base(ctx) {
context<StateMachine1>().logAndDisplayStateName("serveWaitForPickup");
} // entry
virtual ~serveWaitForPickup() {
} // exit
sc::result react(const EvSensorDrinkTaken &ev)
{
context<ServeCustomer>().serveDrink();
return transit<serveFinished>();
}
//Reactions
typedef mpl::list<
sc::custom_reaction<EvSensorDrinkTaken>
> reactions;
};
struct serveFinished : sc::state<serveFinished, ServeCustomer>
{
serveFinished(my_context ctx) : my_base(ctx) {
context<StateMachine1>().logAndDisplayStateName("serveFinished");
// wait for 2 seconds for a more natural behavior, not driving away immediately ...
//boost::this_thread::sleep(boost::posix_time::milliseconds(2000));
post_event(EvSuccess());
} // entry
virtual ~serveFinished() {
} // exit
};
#endif /* SERVECUSTOMER_H_ */
|
//
// YKNoteMainViewControllerProtocolImpl.h
// YKNote
//
// Created by wanyakun on 2016/11/15.
// Copyright © 2016年 com.ucaiyuan. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface YKNoteMainViewControllerProtocolImpl : NSObject<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, weak) UIViewController *controller;
@end
|
/******************************************************************************
The MIT License (MIT)
Copyright (c) 2014 Jason.lee
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*******************************************************************************/
#ifndef __MATRIX3X3_H__
#define __MATRIX3X3_H__
struct Matrix3x3
{
union
{
float m[9];
struct {
float m11; float m12; float m13;
float m21; float m22; float m23;
float m31; float m32; float m33;
};
struct {
Vector3 m11m12m13;
Vector3 m21m22m23;
Vector3 m31m32m33;
};
};
public:
static const Matrix3x3 Identity;
static const Matrix3x3 Zero;
public:
inline Matrix3x3( float m11, float m22, float m33 );
inline explicit Matrix3x3( Rotater ea );
inline Matrix3x3( const Vector3& axis, float angle );
inline explicit Matrix3x3( float m );
inline explicit Matrix3x3( const Quaternion& q );
inline Matrix3x3( const Matrix3x3& m );
inline Matrix3x3( void );
public:
inline bool operator==( const Matrix3x3& m ) const;
inline bool operator!=( const Matrix3x3& m ) const;
inline float& operator[]( size_t i ) const;
inline Matrix3x3& operator=( float m );
inline Matrix3x3& operator=( const Matrix3x3& m );
public:
inline Matrix3x3 operator+( float a ) const;
inline Matrix3x3 operator+( const Matrix3x3& m ) const;
inline Matrix3x3 operator-( float a ) const;
inline Matrix3x3 operator-( const Matrix3x3& m ) const;
inline Matrix3x3 operator*( float a ) const;
inline Matrix3x3 operator*( const Matrix3x3& m ) const;
public:
inline Matrix3x3& operator+=( float a );
inline Matrix3x3& operator+=( const Matrix3x3& m );
inline Matrix3x3& operator-=( float a );
inline Matrix3x3& operator-=( const Matrix3x3& m );
inline Matrix3x3& operator*=( float a );
inline Matrix3x3& operator*=( const Matrix3x3& m );
public:
static inline void add( Matrix3x3& out, const Matrix3x3& m1, const Matrix3x3& m2 );
static inline void sub( Matrix3x3& out, const Matrix3x3& m1, const Matrix3x3& m2 );
static void mul( Matrix3x3& out, const Matrix3x3& m1, const Matrix3x3& m2 );
static inline void addScalar( Matrix3x3& out, const Matrix3x3& m, float a );
static inline void subScalar( Matrix3x3& out, const Matrix3x3& m, float a );
static inline void mulScalar( Matrix3x3& out, const Matrix3x3& m, float a );
public:
static inline Matrix3x3 add( const Matrix3x3& m1, const Matrix3x3& m2 );
static inline Matrix3x3 sub( const Matrix3x3& m1, const Matrix3x3& m2 );
static inline Matrix3x3 mul( const Matrix3x3& m1, const Matrix3x3& m2 );
static inline Matrix3x3 addScalar( const Matrix3x3& m, float a );
static inline Matrix3x3 subScalar( const Matrix3x3& m, float a );
static inline Matrix3x3 mulScalar( const Matrix3x3& m, float a );
public:
inline void add( const Matrix3x3& m );
inline void sub( const Matrix3x3& m );
inline void mul( const Matrix3x3& m );
inline void addScalar( float a );
inline void subScalar( float a );
inline void mulScalar( float a );
public:
bool equals( const Matrix3x3& m ) const;
bool isZero( void ) const;
bool isIdentity( void ) const;
inline void setZero( void );
inline void setIdentity( void );
inline void set( const Matrix3x3& m );
inline void set( float m );
public:
static inline Matrix3x3 createLookAt( const Vector3& eye, const Vector3& target, const Vector3& up );
static inline Matrix3x3 createRotation( const Vector3& axis, float angle );
static inline Matrix3x3 createRotation( const Rotater& ea );
static inline Matrix3x3 createRotation( const Quaternion& q );
static inline Matrix3x3 createRotationX( float a );
static inline Matrix3x3 createRotationY( float a );
static inline Matrix3x3 createRotationZ( float a );
public:
void setLookAt( const Vector3& eye, const Vector3& target, const Vector3& up );
void setRotation( const Vector3& axis, float angle );
void setRotation( const Rotater& ea );
void setRotation( const Quaternion& q );
void setRotationX( float a );
void setRotationY( float a );
void setRotationZ( float a );
public:
static void inverse( Matrix3x3& out, const Matrix3x3& m );
static void transpose( Matrix3x3& out, const Matrix3x3& m );
static void negate( Matrix3x3& out, const Matrix3x3& m );
static inline Matrix3x3 inverse( const Matrix3x3& m );
static inline Matrix3x3 transpose( const Matrix3x3& m );
static inline Matrix3x3 negate( const Matrix3x3& m );
inline void inverse( void );
inline void transpose( void );
inline void negate( void );
};
#endif //__MATRIX3X3_H__
|
//
// UIImage+AlphaChange.h
// JK3DFlapView
//
// Created by Jayesh Kawli Backup on 8/30/15.
// Copyright (c) 2015 Jayesh Kawli Backup. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (AlphaChange)
- (UIImage*)imageByApplyingAlpha:(CGFloat)alpha;
@end
|
//
// News.h
// FeedNewyworks
//
// Created by Туров Роман on 07.11.15.
// Copyright © 2015 Turov Roman. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "API.h"
#import "Items.h"
#import "Groups.h"
#import "Users.h"
@interface News : NSObject <NSCopying>
NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy) NSArray * items;
@property (nonatomic,copy) NSArray * groups;
@property (nonatomic,copy) NSArray * users;
-(NSArray*)addObjectToArrayNewswithUsers:(Users*) user arrayForUsers: (NSMutableArray*) array;
-(NSArray*)addObjectToArrayNewswithItems:(Items*) item arrayForItems: (NSMutableArray*) array;
-(NSArray*)addObjectToArrayNewswithGroups:(Groups*) group arrayForGroups: (NSMutableArray*) array;
NS_ASSUME_NONNULL_END
@end
|
/** ======================================================================+
+ Copyright @2021-2022 Arjun Ray
+ Released under MIT License. See https://mit-license.org
+========================================================================*/
#pragma once
#ifndef UTILITY_CHECKLIST_H
#define UTILITY_CHECKLIST_H
#include <vector>
#include <algorithm>
namespace Utility
{
template<typename Client>
struct CheckListMethods
{
static void activate( Client& client, std::size_t counter )
{
client( counter ); // assumes function object
}
};
/**
* @class CheckList
* @brief Activates function when all prerequisites are "marked".
* Prerequisites are proxied by indexes in a bit set.
* All marks are automatically cleared after activation.
*/
template<typename Action, typename Methods = CheckListMethods<Action> >
class CheckList
{
using BitSet = std::vector<bool>;
public:
~CheckList() noexcept = default;
CheckList(std::size_t size, Action const& action)
: size_(size)
, bset_(size_, false)
, action_(action)
{}
// returns whether action was triggered
bool mark( std::size_t index )
{
if ( index < size_ ) { bset_[index] = true; }
return check_();
}
bool unmark( std::size_t index )
{ // should be rare occurence
if ( index < size_ )
{
bool _was(bset_[index]);
bset_[index] = false;
return _was;
}
return false;
}
CheckList& set_counter( std::size_t start )
{
counter_ = start;
return *this;
}
int marked() const
{
return std::count( bset_.begin(), bset_.end(), true );
}
int unmarked() const
{
return std::count( bset_.begin(), bset_.end(), false );
}
private:
std::size_t size_;
BitSet bset_;
Action action_;
std::size_t counter_{0};
bool all_set_()
{
return bset_.end() == std::find( bset_.begin(), bset_.end(), false );
}
bool check_()
{
if ( all_set_() )
{
Methods::activate( action_, counter_ );
reset_();
return true;
}
return false;
}
void reset_()
{
bset_ = BitSet(size_, false);
counter_++;
}
CheckList(CheckList const&) = delete;
CheckList& operator=( CheckList const& ) = delete;
};
} // namespace Utility
#endif // UTILITY_CHECKLIST_H
|
/*******************************************************************************
The content of this file includes portions of the AUDIOKINETIC Wwise Technology
released in source code form as part of the SDK installer package.
Commercial License Usage
Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
may use this file in accordance with the end user license agreement provided
with the software or, alternatively, in accordance with the terms contained in a
written agreement between you and Audiokinetic Inc.
Apache License Usage
Alternatively, this file may be used under the Apache License, Version 2.0 (the
"Apache License"); you may not use this file except in compliance with the
Apache License. You may obtain a copy of the Apache License at
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed
under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
the specific language governing permissions and limitations under the License.
Version: v2016.2.0 Build: 5972
Copyright (c) 2006-2016 Audiokinetic Inc.
*******************************************************************************/
// AkSyncLoader.h
/// \file
/// Class for synchronous calls of asynchronous models
#ifndef _AK_SYNC_CALLER_H_
#define _AK_SYNC_CALLER_H_
#include <AK/Tools/Common/AkPlatformFuncs.h>
namespace AK
{
namespace SoundEngine
{
/// AkSyncLoader: Init to create a sync event, call the asynchronous method, passing
/// it the address of this object as the cookie, then call Wait.
class AkSyncCaller
{
public:
/// Initialize.
AKRESULT Init()
{
if ( AKPLATFORM::AkCreateEvent( m_hEvent ) != AK_Success )
{
AKASSERT( !"Could not create synchronization event" );
return AK_Fail;
}
return AK_Success;
}
/// Wait until the async function calls its callback.
AKRESULT Wait( AKRESULT in_eResult )
{
if ( in_eResult != AK_Success )
{
AKPLATFORM::AkDestroyEvent( m_hEvent );
return in_eResult;
}
// Task queueing successful. Block until completion.
AKPLATFORM::AkWaitForEvent( m_hEvent );
AKPLATFORM::AkDestroyEvent( m_hEvent );
return m_eResult;
}
/// Call this from callback to release blocked thread.
inline void Done() { AKPLATFORM::AkSignalEvent( m_hEvent ); }
AKRESULT m_eResult; ///< Operation result
private:
AkEvent m_hEvent; ///< Sync event
};
}
}
#endif // _AK_SYNC_CALLER_H_
|
//
// ICLocationLabelView.h
// InstaCab
//
// Created by Pavel Tisunov on 26/04/14.
// Copyright (c) 2014 Bright Stripe. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ICLocationSingleLabel.h"
@interface ICLocationLabelView : UIView
-(void)updatePickupLocation:(ICLocation *)pickupLocation dropoffLocation:(ICLocation *)dropoffLocation;
@end
|
/*
* Copyright 2012 StackMob
*
* 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.
*/
/**
Category on `NSDictionary` for atomic counter functionality.
*/
@interface NSDictionary (AtomicCounter)
/**
Returns a new dictionary with a new entry representing an atomic counter update for a field.
Updating an atomic counter means incrementing or decrementing a value atomically such that you don't need to worry about concurrency issues. This might power a thumbs-up button counter or the score in a game. The dictionary you get from this method can then be passed into <SMDataStore> methods.
@param field The field to increment.
@param value The amount to increment by. Can be positive or negative.
*/
- (NSDictionary *)dictionaryByAppendingCounterUpdateForField:(NSString *)field by:(int)value;
@end
/**
Category on `NSMutableDictionary` for atomic counter functionality.
*/
@interface NSMutableDictionary (AtomicCounter)
/**
Set a new entry in the dictionary representing an atomic counter update for a field.
Updating an atomic counter means incrementing or decrementing a value atomically such that you don't need to worry about concurrency issues. This might power a thumbs-up button counter or the score in a game. After you call this method, the dictionary can be passed into <SMDataStore> methods.
@param field The field to increment.
@param value The amount to increment by. Can be positive or negative.
*/
- (void)updateCounterForField:(NSString *)field by:(int)value;
@end
|
#ifndef EWC_DISPLAY_H
#define EWC_DISPLAY_H
#define M_WIDTH 22
#define M_HEIGHT 10
#include <time.h>
#include <NeoPixelBus.h>
#include <NeoPixelAnimator.h>
#include "EWCConfig.h"
#if FEATURE_WEATHER()
#include "EWCWeather.h"
#endif
class EWCDisplay
{
public:
EWCDisplay();
~EWCDisplay();
bool begin();
void handle();
void setAutoBrightness(boolean enabled);
boolean getAutoBrightness();
void setBrightness(uint8_t value);
void changeBrightness(int8_t amount);
static void off();
static void showHeart();
static void testAll();
static void fastTest();
static void makeParty();
static void fire();
static void clockLogic();
typedef void (*FunctPtr)();
void setDisplay(FunctPtr fp);
void setColor(unsigned char r, unsigned char g, unsigned char b);
private:
static int _ledStrip[NUM_LEDS];
static int _stackptr;
static uint8_t _testHours;
static uint8_t _testMinutes;
#if FEATURE_WEATHER()
static int8_t _testTemperature;
static uint8_t _testWeather;
#endif
static uint8_t _testLED;
static uint8_t _languageMode;
static boolean _autoBrightness;
//static NeoPixelBus _ledBus;
//static NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> _ledBus;
static RgbColor _leds[NUM_LEDS];
static RgbColor _red;
static RgbColor _green;
static RgbColor _blue;
static RgbColor _white;
static RgbColor _black;
static RgbColor _defaultColor;
static FunctPtr _currentDisplay;
uint8_t _oldBrightness = 100;
uint32_t _displayInterval = 1000;
uint32_t _lastRun = 0;
static uint8_t _valueMask[M_HEIGHT][M_WIDTH];
static uint8_t _hueMask[M_HEIGHT][M_WIDTH];
static uint8_t _matrix[M_WIDTH][M_HEIGHT];
static uint8_t _line[M_WIDTH];
static uint8_t _mapping[M_WIDTH][M_HEIGHT];
static int _pcnt;
static void _setPixel(unsigned char x, unsigned char y, RgbColor rgb);
static void _generateLine();
static void _shiftUp();
static void _drawFrame(int pcnt);
static void _resetAndBlack();
static void _resetStrip();
static void _showStrip();
static void _displayStrip();
static void _displayStrip(RgbColor colorCode);
static void _displayStripRandomColor() ;
static void _pushToStrip(int ledId);
static void _pushToStrip(int leds[], uint8_t size);
static void _timeToStrip(uint8_t hours, uint8_t minutes);
#if FEATURE_WEATHER()
static void _weatherToStrip(int8_t temperature, int8_t weather);
#endif
};
extern EWCDisplay Display;
#endif
|
#include <stdlib.h>
#include <string.h>
#include <check.h>
#include <ike/hashmap.h>
#include <stdio.h>
START_TEST(test_hashmapSimple)
{
ikeHashmap hashmap;
ikeHashmapInit(&hashmap);
int *itest = calloc(1, sizeof(int)); *itest = 7;
ck_assert_msg(ikeHashmapPut(&hashmap, "int", itest) == IKE_HASHMAP_OK, "could not store int");
float *ftest = calloc(1, sizeof(float)); *ftest = 3.4f;
ck_assert_msg(ikeHashmapPut(&hashmap, "float", ftest) == IKE_HASHMAP_OK, "could not store float");
double *dtest = calloc(1, sizeof(double)); *dtest = 3.4;
ck_assert_msg(ikeHashmapPut(&hashmap, "double", dtest) == IKE_HASHMAP_OK, "could not store double");
char *stest = calloc(12, sizeof(char)); strcpy(stest, "hello world");
ck_assert_msg(ikeHashmapPut(&hashmap, "string", stest) == IKE_HASHMAP_OK, "could not store string");
int *itestr;
ck_assert_msg(ikeHashmapGet(&hashmap, "int", (ikeAny *) &itestr) == IKE_HASHMAP_OK, "could not read int");
ck_assert_msg(*itest == *itestr, "stored integer is not equal than expected");
float *ftestr;
ck_assert_msg(ikeHashmapGet(&hashmap, "float", (ikeAny *) &ftestr) == IKE_HASHMAP_OK, "could not read float");
ck_assert_msg(*ftest == *ftestr, "stored float is not equal than expected");
double *dtestr;
ck_assert_msg(ikeHashmapGet(&hashmap, "double", (ikeAny *) &dtestr) == IKE_HASHMAP_OK, "could not read double");
ck_assert_msg(*dtest == *dtestr, "stored double is not equal than expected");
char *stestr;
ck_assert_msg(ikeHashmapGet(&hashmap, "string", (ikeAny *) &stestr) == IKE_HASHMAP_OK, "could not read string");
ck_assert_msg(strcmp(stest, stestr) == 0, "stored string is not equal than expected");
free(itest);
free(ftest);
free(dtest);
free(stest);
ikeHashmapDestroy(&hashmap);
}
END_TEST
static int test_hashmapIterateCount = 0;
static int test_hashmapIterateHelper(ikeAny udata, ikeAny item) {
test_hashmapIterateCount ++;
return IKE_HASHMAP_OK;
}
START_TEST(test_hashmapIterate)
{
ikeHashmap hashmap;
ikeHashmapInit(&hashmap);
char *stest1 = calloc(12, sizeof(char)); strcpy(stest1, "hello world");
char *stest2 = calloc(12, sizeof(char)); strcpy(stest2, "dlrow olleh");
ck_assert_msg(ikeHashmapPut(&hashmap, "regular", stest1) == IKE_HASHMAP_OK, "could not store string (regular)");
ck_assert_msg(ikeHashmapPut(&hashmap, "reverse", stest2) == IKE_HASHMAP_OK, "could not store string (reverse)");
ck_assert_msg(ikeHashmapIterate(&hashmap, test_hashmapIterateHelper, NULL) == IKE_HASHMAP_OK, "could not iterate map");
ck_assert_msg(test_hashmapIterateCount == 2, "unexpected iteration keys count");
free(stest1);
free(stest2);
}
END_TEST
Suite *mat4Suite(void)
{
Suite *s;
TCase *tc_core;
s = suite_create("ike/hashmap");
tc_core = tcase_create("core");
tcase_add_test(tc_core, test_hashmapSimple);
tcase_add_test(tc_core, test_hashmapIterate);
suite_add_tcase(s, tc_core);
return s;
}
int main(void)
{
int numfailed;
Suite *s;
SRunner *sr;
s = mat4Suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
numfailed = srunner_ntests_failed(sr);
srunner_free(sr);
return (numfailed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
|
#ifndef GAME_ENGINE_ARC_BALL_CAMERA_CONTROLLER_H
#define GAME_ENGINE_ARC_BALL_CAMERA_CONTROLLER_H
#include "Actor.h"
#include "InputDispatcher.h"
#include "CoreLib/LibUI/LibUI.h"
namespace GameEngine
{
class CameraActor;
enum class MouseState
{
None, Translate, Rotate
};
class ArcBallParams
{
public:
VectorMath::Vec3 center;
float radius = 800.0f;
float alpha = CoreLib::Math::Pi * 0.5f, beta = 0.0f;
ArcBallParams()
{
center.SetZero();
}
void GetCoordinates(VectorMath::Vec3 & camPos, VectorMath::Vec3 & up, VectorMath::Vec3 & right, VectorMath::Vec3 & dir);
};
class ArcBallCameraControllerActor : public Actor
{
private:
ArcBallParams lastArcBall;
ArcBallParams GetCurrentArcBall();
int lastX = 0, lastY = 0;
MouseState state = MouseState::None;
CameraActor * targetCamera = nullptr;
void FindTargetCamera();
void UpdateCamera();
void MouseMove(GraphicsUI::UI_Base * sender, GraphicsUI::UIMouseEventArgs & e);
void MouseDown(GraphicsUI::UI_Base * sender, GraphicsUI::UIMouseEventArgs & e);
void MouseUp(GraphicsUI::UI_Base * sender, GraphicsUI::UIMouseEventArgs & e);
void MouseWheel(GraphicsUI::UI_Base * sender, GraphicsUI::UIMouseEventArgs & e);
public:
PROPERTY_DEF(VectorMath::Vec3, Center, VectorMath::Vec3::Create(0.0f));
PROPERTY_DEF(float, Radius, 800.0f);
PROPERTY_DEF(float, Alpha, CoreLib::Math::Pi * 0.5f);
PROPERTY_DEF(float, Beta, 0.0f);
PROPERTY_DEF(float, TurnPrecision, CoreLib::Math::Pi / 1000.0f);
PROPERTY_DEF(float, TranslatePrecision, 0.001f);
PROPERTY_DEF(float, ZoomScale, 1.1f);
PROPERTY_DEF(float, MinDist, 10.0f);
PROPERTY_DEF(float, MaxDist, 10000.0f);
PROPERTY_DEF(bool, NeedAlt, true);
PROPERTY(CoreLib::String, TargetCameraName);
public:
virtual void OnLoad() override;
virtual void OnUnload() override;
virtual EngineActorType GetEngineType() override;
virtual CoreLib::String GetTypeName() override
{
return "ArcBallCameraController";
}
public:
void SetCenter(VectorMath::Vec3 center);
bool DumpCamera(const CoreLib::String & axisName, ActionInput scale);
};
}
#endif
|
//
// AppDelegate.h
// UIStepIndicator
//
// Created by Adam Hunter on 11/13/14.
// Copyright (c) 2014 Adam Hunter. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// ViewController.h
// Auto Destroy View
//
// Created by Ravi Vooda on 2/23/15.
// Copyright (c) 2015 Ravi Vooda. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef SDK_PLAYERANIMSTATE_H
#define SDK_PLAYERANIMSTATE_H
#ifdef _WIN32
#pragma once
#endif
#include "convar.h"
#include "iplayeranimstate.h"
#include "base_playeranimstate.h"
#ifdef CLIENT_DLL
class C_BaseAnimatingOverlay;
class C_WeaponSDKBase;
#define CBaseAnimatingOverlay C_BaseAnimatingOverlay
#define CWeaponSDKBase C_WeaponSDKBase
#define CSDKPlayer C_SDKPlayer
#else
class CBaseAnimatingOverlay;
class CWeaponSDKBase;
class CSDKPlayer;
#endif
// When moving this fast, he plays run anim.
#define ARBITRARY_RUN_SPEED 175.0f
enum PlayerAnimEvent_t
{
PLAYERANIMEVENT_FIRE_GUN_PRIMARY=0,
PLAYERANIMEVENT_FIRE_GUN_SECONDARY,
PLAYERANIMEVENT_THROW_GRENADE,
PLAYERANIMEVENT_JUMP,
PLAYERANIMEVENT_RELOAD,
PLAYERANIMEVENT_COUNT
};
class ISDKPlayerAnimState : virtual public IPlayerAnimState
{
public:
// This is called by both the client and the server in the same way to trigger events for
// players firing, jumping, throwing grenades, etc.
virtual void DoAnimationEvent( PlayerAnimEvent_t event, int nData = 0 ) = 0;
// Returns true if we're playing the grenade prime or throw animation.
virtual bool IsThrowingGrenade() = 0;
};
// This abstracts the differences between SDK players and hostages.
class ISDKPlayerAnimStateHelpers
{
public:
virtual CWeaponSDKBase* SDKAnim_GetActiveWeapon() = 0;
virtual bool SDKAnim_CanMove() = 0;
};
ISDKPlayerAnimState* CreatePlayerAnimState( CBaseAnimatingOverlay *pEntity, ISDKPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences );
// If this is set, then the game code needs to make sure to send player animation events
// to the local player if he's the one being watched.
extern ConVar cl_showanimstate;
#endif // SDK_PLAYERANIMSTATE_H
|
/*!
\copyright (c) RDO-Team, 2011
\file memory.h
\author Урусов Андрей (rdo@rk9.bmstu.ru)
\date 16.10.2010
\brief
\indent 4T
*/
#ifndef _CONEXT_MEMORY_H_
#define _CONEXT_MEMORY_H_
// ----------------------------------------------------------------------- INCLUDES
// ----------------------------------------------------------------------- SYNOPSIS
#include "simulator/compiler/parser/src/function/local_variable/local_variable.h"
#include "simulator/compiler/parser/context/context.h"
#include "simulator/compiler/parser/context/context_find_i.h"
// --------------------------------------------------------------------------------
OPEN_RDO_PARSER_NAMESPACE
// --------------------------------------------------------------------------------
// -------------------- IContextMemory
// --------------------------------------------------------------------------------
struct IContextMemory
{
virtual LPLocalVariableListStack getLocalMemory() = 0;
};
#define DECLARE_IContextMemory \
public: \
LPLocalVariableListStack getLocalMemory();
// --------------------------------------------------------------------------------
// -------------------- ContextMemory
// --------------------------------------------------------------------------------
class ContextMemory
: public Context
, public IContextMemory
, public IContextFind
{
DECLARE_FACTORY(ContextMemory);
public:
static void push();
static void pop ();
protected:
ContextMemory();
private:
LPLocalVariableListStack m_pLocalVariableListStack;
DECLARE_IContextMemory;
virtual Context::FindResult onFindContext(const std::string& method, const Context::Params& params, const RDOParserSrcInfo& srcInfo) const;
};
DECLARE_POINTER(ContextMemory);
CLOSE_RDO_PARSER_NAMESPACE
#endif // _CONEXT_MEMORY_H_
|
#pragma once
#include <bond/core/bond_version.h>
#if BOND_VERSION < 0x0422
#error This file was generated by a newer version of Bond compiler
#error and is incompatible with your version Bond library.
#endif
#if BOND_MIN_CODEGEN_VERSION > 0x0500
#error This file was generated by an older version of Bond compiler
#error and is incompatible with your version Bond library.
#endif
#include <bond/core/config.h>
#include <bond/core/containers.h>
namespace test
{
struct foo
{
std::map<std::basic_string<char, std::char_traits<char>, typename arena::rebind<char>::other>, int32_t, std::less<std::basic_string<char, std::char_traits<char>, typename arena::rebind<char>::other> >, typename arena::rebind<std::pair<const std::basic_string<char, std::char_traits<char>, typename arena::rebind<char>::other>, int32_t> >::other> m;
std::set<int32_t, std::less<int32_t>, typename arena::rebind<int32_t>::other> s;
foo()
{
}
#ifndef BOND_NO_CXX11_DEFAULTED_FUNCTIONS
// Compiler generated copy ctor OK
foo(const foo& other) = default;
#endif
#if !defined(BOND_NO_CXX11_DEFAULTED_MOVE_CTOR)
foo(foo&& other) = default;
#elif !defined(BOND_NO_CXX11_RVALUE_REFERENCES)
foo(foo&& other)
: m(std::move(other.m)),
s(std::move(other.s))
{
}
#endif
explicit
foo(const arena& allocator)
: m(std::less<std::basic_string<char, std::char_traits<char>, typename arena::rebind<char>::other>>(), allocator),
s(std::less<int32_t>(), allocator)
{
}
#ifndef BOND_NO_CXX11_DEFAULTED_FUNCTIONS
// Compiler generated operator= OK
foo& operator=(const foo& other) = default;
#endif
bool operator==(const foo& other) const
{
return true
&& (m == other.m)
&& (s == other.s);
}
bool operator!=(const foo& other) const
{
return !(*this == other);
}
void swap(foo& other)
{
using std::swap;
swap(m, other.m);
swap(s, other.s);
}
struct Schema;
protected:
void InitMetadata(const char*, const char*)
{
}
};
inline void swap(::test::foo& left, ::test::foo& right)
{
left.swap(right);
}
} // namespace test
#if !defined(BOND_NO_CXX11_ALLOCATOR)
namespace std
{
template <typename _Alloc>
struct uses_allocator< ::test::foo, _Alloc>
: is_convertible<_Alloc, arena>
{};
}
#endif
|
#include "copyright.h"
#include "qt.h"
// static void *qt_sp_bottom_save;
#ifdef QT_VARGS_DEFAULT
/* If the stack grows down, `vargs' is a pointer to the lowest
address in the block of arguments. If the stack grows up, it is a
pointer to the highest address in the block. */
qt_t *
qt_vargs (qt_t *sp, int nbytes, void *vargs,
void *pt, qt_startup_t *startup,
qt_vuserf_t *vuserf, qt_cleanup_t *cleanup)
{
int i;
sp = QT_VARGS_MD0 (sp, nbytes);
#ifdef QT_GROW_UP
for (i=nbytes/sizeof(qt_word_t); i>0; --i) {
QT_SPUT (QT_VARGS_ADJUST(sp), i, ((qt_word_t *)vargs)[-i]);
}
#else
for (i=nbytes/sizeof(qt_word_t); i>0; --i) {
QT_SPUT (QT_VARGS_ADJUST(sp), i-1, ((qt_word_t *)vargs)[i-1]);
}
#endif
QT_VARGS_MD1 (QT_VADJ(sp));
QT_SPUT (QT_VADJ(sp), QT_VARGT_INDEX, pt);
QT_SPUT (QT_VADJ(sp), QT_VSTARTUP_INDEX, startup);
QT_SPUT (QT_VADJ(sp), QT_VUSERF_INDEX, vuserf);
QT_SPUT (QT_VADJ(sp), QT_VCLEANUP_INDEX, cleanup);
return ((qt_t *)QT_VADJ(sp));
}
#endif /* def QT_VARGS_DEFAULT */
#ifdef __cplusplus
extern "C"
#endif
void
qt_null (void)
{
}
#ifdef __cplusplus
extern "C"
#endif
void
qt_error (void)
{
extern void abort(void);
abort();
}
|
//
// FriendSelectionViewController.h
// GiftLister
//
//
//
#import <UIKit/UIKit.h>
#import "AddFriendViewController.h"
@interface FriendSelectionViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, AddFriendViewControllerDelegate>
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@end
|
//
// CEKDebug.h
// CocoaExtendedKit
//
// Created by Michael Reneer on 9/5/12.
// Copyright © 2016 Michael Reneer. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern void CEKDebugLog(NSString *format, ...);
NS_ASSUME_NONNULL_END
|
//
// ViewController.h
// Prototype
//
// Created by HKY on 16/2/22.
// Copyright © 2016年 HKY. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
//
// BaseView.h
// alaxiaoyou
//
// Created by Andy on 2016/11/1.
// Copyright © 2016年 Andy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BaseView : UIView
- (void)setupSubviews;
@end
|
//
// AppDelegate.h
// GliderSample
//
// Created by Guillermo Delgado on 03/04/2017.
// Copyright © 2017. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// WHAppDelegate.h
// WebHere
//
// Created by Rui Lopes on 06/10/2014.
//
// Copyright (c) 2013 Rui D Lopes
//
// 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.
//
@import UIKit;
@interface WHAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// UAEC2InstanceNetworkInterfaceSpecification.h
// AWS iOS SDK
//
// Copyright © Unsigned Apps 2014. See License file.
// Created by Rob Amos.
//
//
#import "UAEC2Model.h"
@class UAEC2PrivateIPAddressSpecifiction;
@interface UAEC2InstanceNetworkInterfaceSpecification : UAEC2Model
@property (nonatomic, copy) NSString *networkInterfaceID;
@property (nonatomic, strong) NSNumber *deviceIndex;
@property (nonatomic, copy) NSString *subnetID;
@property (nonatomic, copy) NSString *descriptionValue;
@property (nonatomic, copy) NSString *privateIPAddress;
@property (nonatomic, strong) NSMutableArray *groups;
@property (nonatomic) BOOL deleteOnTermination;
@property (nonatomic, strong) NSMutableArray *privateIPAddresses;
@property (nonatomic, strong) NSNumber *secondaryPrivateIPAddressCount;
@property (nonatomic) BOOL associatePublicIPAddress;
/**
* Retrieves the NSString at the specified index.
**/
- (NSString *)groupAtIndex:(NSUInteger)index;
/**
* Retrieves the UAEC2PrivateIPAddressSpecifiction at the specified index.
**/
- (UAEC2PrivateIPAddressSpecifiction *)privateIPAddressAtIndex:(NSUInteger)index;
/**
* Adds a Group to the groups property.
*
* This will initialise groups with an empty mutable array if necessary.
**/
- (void)addGroup:(NSString *)group;
/**
* Adds a PrivateIPAddress to the privateIPAddresses property.
*
* This will initialise privateIPAddresses with an empty mutable array if necessary.
**/
- (void)addPrivateIPAddress:(UAEC2PrivateIPAddressSpecifiction *)privateIPAddress;
@end
|
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void readstat_copy(char *buf, size_t buf_len, const char *str_start, size_t str_len) {
size_t this_len = str_len;
if (this_len >= buf_len) {
this_len = buf_len - 1;
}
memcpy(buf, str_start, this_len);
buf[this_len] = '\0';
}
void readstat_copy_lower(char *buf, size_t buf_len, const char *str_start, size_t str_len) {
int i;
readstat_copy(buf, buf_len, str_start, str_len);
for (i=0; i<buf_len && buf[i]; i++)
buf[i] = tolower(buf[i]);
}
void readstat_copy_quoted(char *buf, size_t buf_len, const char *str_start, size_t str_len) {
size_t this_len = str_len;
if (this_len >= buf_len) {
this_len = buf_len - 1;
}
size_t i=0;
size_t j=0;
int slash = 0;
for (i=0; i<this_len; i++) {
if (slash) {
if (str_start[i] == 't') {
buf[j++] = '\t';
} else {
buf[j++] = str_start[i];
}
slash = 0;
} else {
if (str_start[i] == '\\') {
slash = 1;
} else {
buf[j++] = str_start[i];
}
}
}
buf[j] = '\0';
}
|
#include <ostream>
#include <iostream>
#ifndef CONNECT_4_MINIMAX_COLUMN_OUT_OF_RANGE_EXCEPTION_H
#define CONNECT_4_MINIMAX_COLUMN_OUT_OF_RANGE_EXCEPTION_H
/**
* Thrown if the index of the column is out
* of the playfield width
*/
class column_out_of_range_exception
{
public:
column_out_of_range_exception(int index) : _index(index)
{ }
~column_out_of_range_exception()
{ };
void mesg();
private:
int _index;
};
#endif //CONNECT_4_MINIMAX_COLUMN_OUT_OF_RANGE_EXCEPTION_H
inline void column_out_of_range_exception::mesg()
{
std::cerr << "Index of column must lie between 1 and 7 but was " << _index << std::endl;
}
|
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "DKHelper.h"
|
//
// UIColor+hexColor.h
// RecordDemo
//
// Created by reylen on 16/8/10.
// Copyright © 2016年 reylen. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (hexColor)
+ (UIColor*) r_colorWithHex:(NSInteger) hexValue;
+ (UIColor*) r_colorWithHex:(NSInteger)hexValue alpha:(CGFloat)alphaValue;
@end
|
//
// LMNavigationViewController.h
// LMLive
//
// Created by iOSDev on 17/5/10.
// Copyright © 2017年 linhongmin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LMNavigationViewController : UINavigationController
@end
|
/**
* This header is generated by class-dump-z 0.2a.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*
* Source: (null)
*/
#import "AWSRequest.h"
@class NSString;
@interface AWSEC2CancelExportTaskRequest : AWSRequest {
NSString* _exportTaskId;
}
@property(retain, nonatomic) NSString* exportTaskId;
+ (id)JSONKeyPathsByPropertyKey;
- (void).cxx_destruct;
@end
|
/* crypto/md4/md4.h */
/* 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_MD4_H
#define HEADER_MD4_H
#include <e_os2.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef OPENSSL_NO_MD4
#error MD4 is disabled.
#endif
/*
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* ! MD4_LONG has to be at least 32 bits wide. If it's wider, then !
* ! MD4_LONG_LOG2 has to be defined along. !
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
#if defined(__LP32__)
#define MD4_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define MD4_LONG unsigned long
#define MD4_LONG_LOG2 3
/*
* _CRAY note. I could declare short, but I have no idea what impact
* does it have on performance on none-T3E machines. I could declare
* int, but at least on C90 sizeof(int) can be chosen at compile time.
* So I've chosen long...
* <appro@fy.chalmers.se>
*/
#else
#define MD4_LONG unsigned int
#endif
#define MD4_CBLOCK 64
#define MD4_LBLOCK (MD4_CBLOCK/4)
#define MD4_DIGEST_LENGTH 16
typedef struct MD4state_st
{
MD4_LONG A,B,C,D;
MD4_LONG Nl,Nh;
MD4_LONG data[MD4_LBLOCK];
unsigned int num;
} MD4_CTX;
#ifdef OPENSSL_FIPS
int private_MD4_Init(MD4_CTX *c);
#endif
int MD4_Init(MD4_CTX *c);
int MD4_Update(MD4_CTX *c, const void *data, size_t len);
int MD4_Final(unsigned char *md, MD4_CTX *c);
unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);
void MD4_Transform(MD4_CTX *c, const unsigned char *b);
#ifdef __cplusplus
}
#endif
#endif
|
//
// ViewItineraryViewController.h
// wormhole
//
// Created by Daniel Barden on 03/03/15.
// Copyright (c) 2015 azapp. All rights reserved.
//
@import UIKit;
@interface ViewItineraryViewController : UITableViewController
@property (nonatomic, strong) NSArray *places;
@end
|
#import <UIKit/UIKit.h>
@interface UIView (Extension)
@property(nonatomic)CGFloat cornerRad;
@property(nonatomic)CGFloat Cy;
@property(nonatomic)CGFloat Cx;
@property(nonatomic,assign)CGFloat X;
@property(nonatomic,assign)CGFloat Y;
@property(nonatomic,assign)CGFloat Sh;
@property (nonatomic,assign)CGSize size;
@property(nonatomic,assign)CGFloat Sw;
-(void)setBlurStyle:(UIBlurEffectStyle)style;
-(void)removeBlur;
#pragma mark - Create Table for button
+(UIView *)CreateTableWithFrame:(CGRect )frame Number:(int)Number spacing:(CGFloat)spacing;
#pragma mark - TapAction LongPressAction
- (void)setTapActionWithBlock:(void (^)(void))block;
- (void)setLongPressActionWithBlock:(void (^)(void))block;
/**
* 添加圆角边框
*/
-(void)addBorderWithcornerRad:(CGFloat)cornerRad lineCollor:(UIColor *)collor lineWidth:(CGFloat)lineWidth;
/**
* 加载
*/
-(void)startLoading;
-(void)stopLoding;
/**
* 切某一方向的圆角
*/
-(void)viewCutRoundedOfRectCorner:(UIRectCorner)rectCorner cornerRadii:(CGFloat)cornerRadii;
/**
* 获取view的所在控制器
*/
-(UIViewController*)MyViewController;
@end
|
#ifndef _MY_BOOK_MANAGER_H_
#define _MY_BOOK_MANAGER_H_
#include <pthread.h>
#include "book.h"
#include "autosave.h"
/*---------------------------------------------------------------------------*/
/* Structure declarations */
/*---------------------------------------------------------------------------*/
/**Struct**********************************************************************
Synopsis program information.
******************************************************************************/
struct prog_info
{
struct book_node *first;
int cmd_count;
pthread_t *autosave_thread;
pthread_mutex_t book_mutex;
struct save_thread_args autosave_args;
};
/*---------------------------------------------------------------------------*/
/* function prototypes */
/*---------------------------------------------------------------------------*/
void show_menu(struct prog_info *info);
void insert(struct prog_info *info);
void search_and_update(struct book_node *);
void change(struct book *ptr, struct book_node *);
void change_id(struct book *ptr, struct book_node *head);
void change_title(struct book *ptr);
void change_year(struct book *ptr);
void change_pages(struct book *ptr);
void change_quality(struct book *ptr);
void change_author_id(struct book *ptr, struct book_node *);
void change_author_name(struct book *ptr, struct book_node *);
void change_author_surname(struct book *ptr, struct book_node *);
void prompt_remove_book(struct prog_info *info);
#endif /* ifndef _MY_BOOK_MANAGER_H_ */
|
#pragma once
#include "Shader.h"
#include "Transform.h"
#include "Camera.h"
#include "Model.h"
class Game
{
public:
Game();
~Game();
void init();
void input (float delta);
void update(float delta);
void render();
private:
Camera * cam;
Transform transform;
Model * model;
Texture* texture;
Shader * shader;
};
|
/*
* barectf linux-fs platform
*
* Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
* Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
*
* 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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <barectf.h>
#include <time.h>
#include "barectf-platform-linux-fs.h"
#ifdef __cplusplus
# define TO_VOID_PTR(_value) static_cast<void *>(_value)
# define FROM_VOID_PTR(_type, _value) static_cast<_type *>(_value)
#else
# define TO_VOID_PTR(_value) ((void *) (_value))
# define FROM_VOID_PTR(_type, _value) ((_type *) (_value))
#endif
struct barectf_platform_linux_fs_ctx {
struct barectf_default_ctx ctx;
FILE *fh;
int simulate_full_backend;
unsigned int full_backend_rand_lt;
unsigned int full_backend_rand_max;
};
static uint64_t get_clock(void* data)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
}
static void write_packet(struct barectf_platform_linux_fs_ctx *ctx)
{
size_t nmemb = fwrite(barectf_packet_buf(&ctx->ctx),
barectf_packet_buf_size(&ctx->ctx), 1, ctx->fh);
assert(nmemb == 1);
}
static int is_backend_full(void *data)
{
struct barectf_platform_linux_fs_ctx *ctx =
FROM_VOID_PTR(struct barectf_platform_linux_fs_ctx, data);
if (ctx->simulate_full_backend) {
if (rand() % ctx->full_backend_rand_max <
ctx->full_backend_rand_lt) {
return 1;
}
}
return 0;
}
static void open_packet(void *data)
{
struct barectf_platform_linux_fs_ctx *ctx =
FROM_VOID_PTR(struct barectf_platform_linux_fs_ctx, data);
barectf_default_open_packet(&ctx->ctx);
}
static void close_packet(void *data)
{
struct barectf_platform_linux_fs_ctx *ctx =
FROM_VOID_PTR(struct barectf_platform_linux_fs_ctx, data);
/* close packet now */
barectf_default_close_packet(&ctx->ctx);
/* write packet to file */
write_packet(ctx);
}
struct barectf_platform_linux_fs_ctx *barectf_platform_linux_fs_init(
unsigned int buf_size, const char *trace_dir, int simulate_full_backend,
unsigned int full_backend_rand_lt, unsigned int full_backend_rand_max)
{
char stream_path[256];
uint8_t *buf;
struct barectf_platform_linux_fs_ctx *ctx;
struct barectf_platform_callbacks cbs;
cbs.default_clock_get_value = get_clock;
cbs.is_backend_full = is_backend_full;
cbs.open_packet = open_packet;
cbs.close_packet = close_packet;
ctx = FROM_VOID_PTR(struct barectf_platform_linux_fs_ctx, malloc(sizeof(*ctx)));
if (!ctx) {
return NULL;
}
buf = FROM_VOID_PTR(uint8_t, malloc(buf_size));
if (!buf) {
free(ctx);
return NULL;
}
memset(buf, 0, buf_size);
sprintf(stream_path, "%s/stream", trace_dir);
ctx->fh = fopen(stream_path, "wb");
if (!ctx->fh) {
free(ctx);
free(buf);
return NULL;
}
ctx->simulate_full_backend = simulate_full_backend;
ctx->full_backend_rand_lt = full_backend_rand_lt;
ctx->full_backend_rand_max = full_backend_rand_max;
barectf_init(&ctx->ctx, buf, buf_size, cbs, ctx);
open_packet(ctx);
return ctx;
}
void barectf_platform_linux_fs_fini(struct barectf_platform_linux_fs_ctx *ctx)
{
if (barectf_packet_is_open(&ctx->ctx) &&
!barectf_packet_is_empty(&ctx->ctx)) {
close_packet(ctx);
}
fclose(ctx->fh);
free(barectf_packet_buf(&ctx->ctx));
free(ctx);
}
struct barectf_default_ctx *barectf_platform_linux_fs_get_barectf_ctx(
struct barectf_platform_linux_fs_ctx *ctx)
{
return &ctx->ctx;
}
|
//
// ZCTableViewModel.h
// Show_me_the_code
//
// Created by Jason on 4/17/16.
// Copyright © 2016 Jason. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ZCTableViewModel;
@protocol ZCTableViewModelDelegate <NSObject>
@required
/**
* Fetches a table view cell at a given index path with a given object.
*
* The implementation of this method will generally use object to customize the cell.
*/
- (UITableViewCell *)tableViewModel: (ZCTableViewModel *)tableViewModel
cellForTableView: (UITableView *)tableView
atIndexPath: (NSIndexPath *)indexPath
withObject: (id)object;
@end
@interface ZCTableViewModel : NSObject<UITableViewDataSource, UITableViewDelegate>
- (instancetype)initWithListArray:(NSArray *) array delegate:(id<ZCTableViewModelDelegate>) createDelegate;
@property (nonatomic, strong) NSArray *data;
@property (nonatomic, weak) id<ZCTableViewModelDelegate> delegate;
- (id)forwardingTo:(id)forwordingDelegate;
@end
|
//
// EWLSearchArtistSongLyricWithLyricsResponse.h
// EasyWayLyrics
//
// Created by Paulo Almeida on 4/4/14.
// Copyright (c) 2014 Loducca Publicidade. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "EWLBaseLyricFindResponse.h"
@interface EWLSearchArtistSongLyricWithLyricsResponse : EWLBaseLyricFindResponse
@property (strong,nonatomic) NSArray* lrc; //Of EWLSearchArtistSongLyricWithLyricsItem
@end
|
// This file is the part of the Indexer++ project.
// Copyright (C) 2016 Anna Krykora <krykoraanna@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
#pragma once
#include <functional>
#include "LetterCaseMatching.h"
#include "SortingProperty.h"
namespace indexer_common { class FileInfo; }
namespace indexer {
typedef std::function<bool(const indexer_common::FileInfo* first, const indexer_common::FileInfo* second)> PropertyComparatorFunc;
typedef const std::pair<int, const indexer_common::FileInfo*> sort_pair;
typedef std::function<bool(sort_pair first, sort_pair second)> PairComparatorFunc;
class FileInfoComparatorFactory {
public:
static PropertyComparatorFunc CreatePropertyComparator(SortingProperty sort_prop, int direction, bool match_case);
static PairComparatorFunc CreatePairsFirstDefaultComparator(int direction);
};
} // namespace indexer
|
//
// RSBorderlessButtonCell.h
// WabbitStudio
//
// Created by William Towe on 7/20/11.
// Copyright 2011 Revolution Software.
//
// 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.
#import <AppKit/NSButtonCell.h>
@interface RSBorderlessButtonCell : NSButtonCell
@end
|
#ifndef __KALMANFILTER_H
#define __KALMANFILTER_H
#include "stm32f10x_lib.h"
typedef struct
{
double X[2]; //Â˲¨½á¹ûÏòÁ¿
double X_pre[2];
double A[2][2];
double B[2];
double H[2];
double Q[2][2];
double R;
double P[2][2];
double P_pre[2][2];
double K[2];
}
KFParam;
#define KFPARAM_DEFAULT \
{\
{0},\
{0},\
{{1,-T_sample},{0,1}},\
{T_sample,0},\
{1,0},\
{{0.003,0},{0,0.003}},\
0.056,\
{{0.0082,-0.0155},{-0.0155,0.2207}},\
{{0.0082,-0.0155},{-0.0155,0.2207}},\
{0}\
}
double KalmanFilter(KFParam *param,double U,double Z);
#endif
|
#pragma once
// CMake uses config.cmake.h to generate config.h within the build folder.
#ifndef ALLPIX_CONFIG_H
#define ALLPIX_CONFIG_H
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
#define PACKAGE_VERSION "@ALLPIX_LIB_VERSION@"
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
#endif
|
/*
* processingqueue.h
*
* Author:
* Antonius Riha <antoniusriha@gmail.com>
*
* Copyright (c) 2013 Antonius Riha
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PROCESSINGQUEUE_H
#define PROCESSINGQUEUE_H
#include <QQueue>
#include <QObject>
class ProcessingUnit : public QObject
{
Q_OBJECT
public:
virtual void process() = 0;
signals:
void finished(ProcessingUnit *unit);
protected:
explicit ProcessingUnit(QObject *parent = 0);
};
class ProcessingQueue : public QObject
{
Q_OBJECT
public:
explicit ProcessingQueue(QObject *parent = 0);
void add(ProcessingUnit *unit);
void process();
private slots:
void _processingFinished(ProcessingUnit *unit);
private:
bool _processing;
QQueue<ProcessingUnit *> _queue;
};
#endif // PROCESSINGQUEUE_H
|
//
// TStatusFeedItem.h
// NTJsonModelSample
//
// Created by Ethan Nagel on 11/10/14.
// Copyright (c) 2014 NagelTech. All rights reserved.
//
#import "TFeedItem.h"
@interface TStatusFeedItem : TFeedItem
@property (nonatomic,readonly) NSString *status;
@end
@protocol MutableTStatusFeedItem <NTJsonMutableModel>
@property (nonatomic) NSString *status;
@end
typedef TStatusFeedItem<MutableTStatusFeedItem,MutableTFeedItem> MutableTStatusFeedItem;
|
//
// LGFLabelHTMLViewController.h
// demos
//
// Created by qddios2 on 16/5/25.
// Copyright © 2016年 lvguifeng. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LGFLabelHTMLViewController : UIViewController<CodeDemosProtocol>
@end
|
//
// BtnView.h
// SelectedBtn
//
// Created by 唐彬彬 on 2017/3/28.
// Copyright © 2017年 唐彬彬. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^addSubViewBlock)(NSInteger tag);
@interface BtnView : UIView
@property (nonatomic ,copy) addSubViewBlock myBlock;
-(instancetype)initWithFrame:(CGRect)frame titleArray:(NSArray *)titleArray selectedColor:(UIColor *)selectedColor normalColor:(UIColor *)normalColor titleSize:(CGSize *)size;
-(void)addSubviewWithBlock:(addSubViewBlock)block;
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <iWorkImport/TSCHChartLayoutItem.h>
@class TSCHChartAxisID, TSCHChartAxisLineLayoutItem, TSCHChartAxisPaddingLayoutItem, TSCHChartAxisTickMarksLayoutItem, TSCHChartAxisTitleLayoutItem;
// Not exported
@interface TSCHChartAxisLayoutItem : TSCHChartLayoutItem
{
TSCHChartAxisID *mAxisID;
int mAxisPosition;
TSCHChartAxisTitleLayoutItem *mAxisTitle;
TSCHChartAxisPaddingLayoutItem *mAxisPadding;
TSCHChartAxisTickMarksLayoutItem *mTickMarks;
TSCHChartAxisLineLayoutItem *mAxisLine;
struct CGSize mChartBodySize;
}
+ (id)selectionPathType;
@property(nonatomic) struct CGSize chartBodySize; // @synthesize chartBodySize=mChartBodySize;
@property(readonly, nonatomic) TSCHChartAxisPaddingLayoutItem *axisPaddingLayoutItem; // @synthesize axisPaddingLayoutItem=mAxisPadding;
@property(readonly, nonatomic) TSCHChartAxisLineLayoutItem *axisLineLayoutItem; // @synthesize axisLineLayoutItem=mAxisLine;
@property(readonly, nonatomic) TSCHChartAxisTickMarksLayoutItem *axisTickMarksLayoutItem; // @synthesize axisTickMarksLayoutItem=mTickMarks;
@property(readonly, nonatomic) TSCHChartAxisTitleLayoutItem *axisTitleLayoutItem; // @synthesize axisTitleLayoutItem=mAxisTitle;
@property(readonly, nonatomic) int axisPosition; // @synthesize axisPosition=mAxisPosition;
@property(retain, nonatomic) TSCHChartAxisID *axisID; // @synthesize axisID=mAxisID;
- (id)subselectionHaloPositionsForSelections:(id)arg1;
- (id)p_subselectionHaloPositionsForLabelsSelections:(id)arg1;
- (id)subselectionKnobPositionsForSelection:(id)arg1;
- (id)p_subselectionKnobPositionsForLabelsSelection:(id)arg1;
- (struct CGRect)protected_layoutSpaceRectForAllLabels;
- (void)p_layoutLabelsNow;
- (void)p_layoutOutward;
- (void)p_layoutInward;
- (id)p_description;
- (id)renderersWithRep:(id)arg1;
- (struct CGRect)calcOverhangRect;
- (struct CGSize)calcMinSize;
- (void)dealloc;
- (id)initWithParent:(id)arg1 axisPosition:(int)arg2;
@end
|
extern "C" void wrmsr(uint32_t n, uint64_t a);
extern "C" uint64_t rdmsr(uint32_t n);
#define IA32_STAR 0xc0000081
#define IA32_LSTAR 0xc0000082
#define IA32_FMASK 0xc0000084
#define IA32_EFER 0xc0000080
|
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
#ifndef Pegasus_TestStorageSystemProvider_h
#define Pegasus_TestStorageSystemProvider_h
#include <Pegasus/Provider/CIMInstanceProvider.h>
#include <Pegasus/Provider/CIMAssociationProvider.h>
PEGASUS_USING_PEGASUS;
class TestServerProfileProvider :
public CIMInstanceProvider,
public CIMAssociationProvider
{
public:
TestServerProfileProvider(const String&);
virtual ~TestServerProfileProvider();
virtual void initialize(CIMOMHandle& cimom);
virtual void terminate();
// Instance Provider interface
virtual void getInstance(
const OperationContext& context,
const CIMObjectPath& ref,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
InstanceResponseHandler& handler);
virtual void enumerateInstances(
const OperationContext& context,
const CIMObjectPath& ref,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
InstanceResponseHandler& handler);
virtual void enumerateInstanceNames(
const OperationContext& context,
const CIMObjectPath& ref,
ObjectPathResponseHandler& handler);
virtual void modifyInstance(
const OperationContext& context,
const CIMObjectPath& ref,
const CIMInstance& obj,
const Boolean includeQualifiers,
const CIMPropertyList& propertyList,
ResponseHandler& handler);
virtual void createInstance(
const OperationContext& context,
const CIMObjectPath& ref,
const CIMInstance& obj,
ObjectPathResponseHandler& handler);
virtual void deleteInstance(
const OperationContext& context,
const CIMObjectPath& ref,
ResponseHandler& handler);
//
// Association Provider Interface
//
virtual void associators(
const OperationContext& context,
const CIMObjectPath& objectName,
const CIMName& associationClass,
const CIMName& resultClass,
const String& role,
const String& resultRole,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
ObjectResponseHandler& handler);
virtual void associatorNames(
const OperationContext& context,
const CIMObjectPath& objectName,
const CIMName& associationClass,
const CIMName& resultClass,
const String& role,
const String& resultRole,
ObjectPathResponseHandler& handler);
virtual void references(
const OperationContext& context,
const CIMObjectPath& objectName,
const CIMName& resultClass,
const String& role,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
ObjectResponseHandler& handler);
virtual void referenceNames(
const OperationContext& context,
const CIMObjectPath& objectName,
const CIMName& resultClass,
const String& role,
ObjectPathResponseHandler& handler);
private:
Array<CIMInstance> localEnumerateInstances(
const CIMName& className,
Boolean includeQualifiers,
Boolean includeClassOrigin,
const CIMPropertyList& propList);
CIMOMHandle cimomHandle;
CIMName testClassName;
CIMClass testClass;
Array<String> names;
};
#endif
|
//
// JKSQueue.h
// JKSToolkit
//
// Created by Johan Sørensen on 5/4/12.
// Copyright (c) 2012 Johan Sørensen. All rights reserved.
//
#import <Foundation/Foundation.h>
/** A simple implementation of a queue
*/
@interface JKSQueue : NSObject
/** Initializes a new empty JKSQueue object
*/
- (instancetype)init;
/** Initializes a new JKSQueue object with the contents of the array
* The order of the supplied array is maintained in the returned JKSQueue
*
* @param array The array whose contents should be added to the queue
*/
- (instancetype)initWithContentsOfArray:(NSArray *)array;
/** @section Enqueing and dequeing */
/** Enqueues a new object on the receivers queue
*
* @param object The object to add to the queue. Cannot be nil.
*/
- (void)enqueue:(id)object;
/** Dequeues an object from the queue
* The first object in the queue is removed from the queue and returned to the caller
*
* @returns The object that was dequeued
*/
- (id)dequeue;
/** Removes all enqueued objects from the queue
*/
- (void)removeAllEnquedObjects;
/** @section Inspecting the queue */
/** Returns the number of objects enqueued on the receiver */
- (NSUInteger)count;
/** "Peeks" at the top object in the queue, returning it without removing it
*
* @returns The top object in the queue
*/
- (id)peek;
/** Checks whether an object is enqueued or not
*
* @returns YES of the object is enqueued on the receiver, NO otherwise
*/
- (BOOL)containsObject:(id)object;
@end
|
/////////////////////////// 8INF854 - ARCHITECTURES PARRALLELES - DEVOIR #2 ///////////////////////////////////
///////////////////////////// SP1.c - Corentin RAOULT - Adrien Cambillau /////////////////////////////////////
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
////////////////////// déclaration des fonctions /////////////////////////
int digit_to_int(char d);
void remplirTABrand(int* TAB, int n);
void afficherTAB(int* TAB, int n);
void SP1(int* T, int n);
///////////////////// MAIN ////////////////////////////////////////////////
int main(int argc, char* argv[])
{
int n;
n = 1024;
int* T = malloc(n*sizeof(int));
remplirTABrand(T,n);
afficherTAB(T,n);
double fin;
double debut = omp_get_wtime();//--> encore un pb, mesure le temps sur un thread
SP1(T,n);
fin = omp_get_wtime();
afficherTAB(T,n);
printf("durée = %lf\n", fin -debut);
return EXIT_SUCCESS;
}
/////////////////// développement des fonctions /////////////////////////////////
void remplirTABrand(int* TAB, int n)
{
int i;
srand(time(NULL));
for(i=0;i<n;i++)
TAB[i] = rand()%10000; //limité par unsigned long long int
}
void afficherTAB(int* TAB, int n)
{
int j;
printf("TAB : { ");
for(j = 0; j < n; j++)
{
printf(" [%d] ",TAB[j]);
}
printf(" }\n");
}
void SP1(int* T, int n)
{
int i;
int* S = malloc((n/2)*sizeof(int));
if (n==1) return;
#pragma omp parallel for
for(i=0; i<= n/2 -1; i++)
{
S[i]=T[2*i] + T[2*i+1];
}
SP1(S, n/2);
#pragma omp parallel for
for(i=0; i<= n/2 -1; i++)
{
T[2*i+1]=S[i];
T[2*i+2]=S[i]+T[2*i+2];
}
}
|
/**
* Tag.c
* (c) 2004 - 2006 SkyeTek, Inc. All Rights Reserved.
*
* Implementation of Tag.
*/
#include "../SkyeTekAPI.h"
#include <stdlib.h>
#include "Tag.h"
unsigned char TagBlockToByte(SKYETEK_TAGTYPE type)
{
unsigned ix;
for(ix = 0; ix < NUM_TAGTYPEDESCS; ix++)
if(TagTypeDescriptions[ix].type == type)
return TagTypeDescriptions[ix].bytesToBlock;
return 1;
}
unsigned int GetTagTypeDescriptionCount(void)
{
return NUM_TAGTYPEDESCS;
}
LPTAGTYPEDESC GetTagTypeDescription(unsigned int index)
{
if(index < 0 || index >= NUM_TAGTYPEDESCS)
return NULL;
return &TagTypeDescriptions[index];
}
SKYETEK_API unsigned int SkyeTek_GetTagTypeCount(void)
{
return NUM_TAGTYPEDESCS;
}
SKYETEK_API TCHAR *SkyeTek_GetTagTypeName(unsigned int index)
{
if(index < 0 || index >= NUM_TAGTYPEDESCS)
return NULL;
return TagTypeDescriptions[index].name;
}
SKYETEK_API SKYETEK_TAGTYPE SkyeTek_GetTagType(unsigned int index)
{
if(index < 0 || index >= NUM_TAGTYPEDESCS)
return (SKYETEK_TAGTYPE)NULL;
return TagTypeDescriptions[index].type;
}
SKYETEK_API SKYETEK_TAGTYPE SkyeTek_GetTagTypeFromName(TCHAR *name)
{
unsigned ix;
if( name == NULL )
return AUTO_DETECT;
for(ix = 0; ix < NUM_TAGTYPEDESCS; ix++)
{
if(_tcscmp(TagTypeDescriptions[ix].name,name) == 0)
return TagTypeDescriptions[ix].type;
}
return AUTO_DETECT;
}
TCHAR gTT[32];
SKYETEK_API TCHAR *SkyeTek_GetTagTypeNameFromType(SKYETEK_TAGTYPE type)
{
unsigned ix;
for(ix = 0; ix < NUM_TAGTYPEDESCS; ix++)
{
if(TagTypeDescriptions[ix].type == type)
return TagTypeDescriptions[ix].name;
}
memset(gTT,0,32*sizeof(TCHAR));
_stprintf(gTT,_T("0x%04X"),type);
return gTT;
}
|
#include <stdio.h>
#include <stdlib.h>
#include "queue.h"
#include "pingpong.h"
// --------------------------PINGPONG.C------------------------------
// Autor: Edgar Teixeira
// Trabalho desenvolvido para a disciplina de Sistemas Operacionais
// ------------------------------------------------------------------
// -------------Definição de estruturas de dados úteis---------------
typedef struct taskqueue_t {
struct taskqueue_t *prev;
struct taskqueue_t *next;
task_t* task;
} taskqueue_t;
typedef enum ExitCode {
TO_DISPATCHER = 0,
TO_MAIN = 1
} ExitCode;
// ------------------------------------------------------------------
// --------------------Variáveis globais e macros--------------------
#define STACKSIZE 32768 /* tamanho de pilha das threads */
#define _XOPEN_SOURCE 600 /* para compilar no MacOS */
#define TO_DISPATCHER 0 /* código de retorno para dispatcher */
#define TO_MAIN 1 /* código de retorno para main */
#ifndef NULL
#define NULL ((void*) 0)
#endif
// Ponteiro para a tarefa que está em execução
task_t *currentTask;
// Tarefa main
task_t mainTask;
// Tarefa dispatcher
task_t dispatcher;
// Fila de tarefas prontas para serem executadas
taskqueue_t *ready;
// Tarefa que está atualmente em execução
taskqueue_t *exec;
// ------------------------------------------------------------------
// -----------------------Tarefa Dispatcher--------------------------
task_t* scheduler() {
// Retorna o primeiro elemento da fila
exec = (taskqueue_t*) queue_remove((queue_t**) &ready, (queue_t*) ready);
return exec->task;
}
void dispatcher_body(void* arg) {
// Enquanto houverem tarefas prontas para serem executadas
while(queue_size((queue_t*) ready) > 0) {
task_t* next = scheduler();
if(next)
task_switch(next);
}
// Retorna o controle para a tarefa main
task_exit(TO_MAIN);
}
// ------------------------------------------------------------------
void pingpong_init() {
#ifdef DEBUG
puts("Ping Pong OS inicializado!\n");
#endif
/* desativa o buffer de saída padrão (stdout), usado pela função printf */
setvbuf(stdout, 0, _IONBF, 0);
// Cria a tarefa main
task_create(&mainTask, NULL, NULL);
// Ajusta a tarefa atual como a tarefa main
currentTask = &mainTask;
// Retira a tarefa main da fila de prontas
exec = (taskqueue_t*) queue_remove((queue_t**) &ready, (queue_t*) ready);
free(exec);
// Cria a tarefa dispatcher
task_create(&dispatcher, dispatcher_body, NULL);
// Retira a tarefa dispathcer da fila de prontas
exec = (taskqueue_t*) queue_remove((queue_t**) &ready, (queue_t*) ready);
free(exec);
}
int task_create(task_t *task, void (*start_routine)(void*), void *arg) {
// Variável estática para garantir unicidade do id
static int id = 0;
// Ajusta os parâmetros da tarefa
task->tid = id;
// Aloca memória para a pilha que será utilizada pelo contexto da tarefa
char* stack = (char*) malloc(STACKSIZE);
if(!stack)
return -1;
// Configura o contexto
getcontext(&task->context);
task->context.uc_stack.ss_size = STACKSIZE;
task->context.uc_link = 0;
task->context.uc_stack.ss_sp = stack;
task->context.uc_stack.ss_flags = 0;
// Ajusta a função que será executada pelo contexto
makecontext(&task->context, start_routine, 1, arg);
// Adiciona a tarefa na fila 'pronta'
taskqueue_t* item = (taskqueue_t*) malloc(sizeof(taskqueue_t));
item->prev = NULL;
item->next = NULL;
item->task = task;
queue_append((queue_t**) &ready, (queue_t*) item);
// Incrementa o id para que cada tarefa tenha um tid diferente
++id;
#ifdef DEBUG
printf("task_create: Tarefa %d criada com sucesso.\n", task->tid);
#endif
return task->tid;
}
int task_switch(task_t* task) {
#ifdef DEBUG
printf("task_switch: Trocando contexto da tarefa %d pela tarefa %d.\n", currentTask->tid, task->tid);
#endif
// Salva o contexto da tarefa em execução em uma variável temporária
ucontext_t* aux = ¤tTask->context;
// Atualiza a tarefa em execução para 'task'
currentTask = task;
// Faz a troca de contexto entre as tarefas 'currentTask' e 'task'
swapcontext(aux, &task->context);
return 0;
}
void task_exit(int exit_code) {
#ifdef DEBUG
printf("task_exit: Encerrando a tarefa %d.\n", currentTask->tid);
#endif
// Libera a memória usada pela tarefa atual
if(exec && exec->task == currentTask)
free(exec);
if(exit_code == TO_DISPATCHER)
task_switch(&dispatcher);
else
task_switch(&mainTask);
}
int task_id() {
return currentTask->tid;
}
void task_yield() {
// Adiciona a tarefa em execução na fila de prontas
queue_append((queue_t**) &ready, (queue_t*) exec);
// Retorna o controle para a tarefa dispatcher
task_switch(&dispatcher);
}
|
//
// AppDelegate.h
// KRDelta
//
// Created by Kalvar Lin on 2015/11/4.
// Copyright © 2015年 Kalvar Lin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// FlyingIndexedCollectionView.h
// FlyingEnglish
//
// Created by vincent sung on 22/4/2016.
// Copyright © 2016 BirdEngish. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FlyingIndexedCollectionView : UICollectionView
/**
* The `UITableViewCell` indexPath.row in which the collection view is nested in.
*/
@property (nonatomic, assign) BOOL supportTouch;
@end
|
//----------------------------------------------------------------------------
//
// License: See top level LICENSE.txt file.
//
// Author: David Hicks
//
// Description: Height reference class.
//----------------------------------------------------------------------------
#ifndef ossimHgtRef_HEADER
#define ossimHgtRef_HEADER 1
#include <ossim/base/ossimGpt.h>
#include <ossim/base/ossimColumnVector3d.h>
#include <ossim/matrix/newmat.h>
#include <ossim/matrix/newmatap.h>
#include <ossim/matrix/newmatio.h>
enum HeightRefType_t
{
AT_HGT = 0,
AT_DEM = 1
};
class OSSIM_DLL ossimHgtRef
{
public:
/**
* @brief constructor.
*/
ossimHgtRef(HeightRefType_t cRefType);
ossimHgtRef(HeightRefType_t cRefType, const ossim_float64& atHgt);
/**
* @brief virtual destructor.
*/
virtual ~ossimHgtRef();
/**
* @brief Method to get height reference type (ellipsoid or DEM).
*/
HeightRefType_t getHeightRefType() const {return theCurrentHeightRefType;}
/**
* @brief Method to get height reference.
*
* @param pg Reference point.
*
* @return Height at reference point.
*/
virtual ossim_float64 getRefHeight(const ossimGpt& pg) const;
/**
* @brief Method to get surface information string.
*
* @param pg Reference point.
* @param info ossimElevationAccuracyInfo string.
*
* @return true on success, false on error.
*/
// virtual bool getSurfaceInfo
// (const ossimGpt& pg, ossimElevationAccuracyInfo& info) const;
/**
* @brief Method to get surface covariance matrix.
*
* @param pg Reference point.
* @param cov 3X3 ENU covariance matrix.
*
* @return true on success, false on error.
*/
virtual bool getSurfaceCovMatrix
(const ossimGpt& pg, NEWMAT::Matrix& cov) const;
/**
* @brief Method to get surface covariance matrix.
*
* @param refCE Reference surface 90% CE [m]
* @param refLE Reference surface 90% LE [m]
* @param cov 3X3 ENU covariance matrix.
*
* @return true on success, false on error.
*/
virtual bool getSurfaceCovMatrix
(const ossim_float64 refCE,
const ossim_float64 refLE,
NEWMAT::Matrix& cov) const;
/**
* @brief Method to get surface normal covariance matrix.
*
* @param pg Reference point.
* @param surfCov 3X3 ENU surface covariance matrix.
* @param normCov 3X3 ECF normal covariance matrix.
*
* @return true on success, false on error.
*/
bool getSurfaceNormalCovMatrix
(const ossimGpt& pg,
const NEWMAT::Matrix& surfCov,
NEWMAT::Matrix& normCov) const;
/**
* @brief Method to get local terrain normal unit vector (slope).
*
* @param pg Reference point.
*
* @return ossimColumnVector3D.
*/
virtual ossimColumnVector3d getLocalTerrainNormal(const ossimGpt& pg) const;
protected:
private:
HeightRefType_t theCurrentHeightRefType;
ossim_float64 theCurrentRefHeight;
};
#endif /* #ifndef ossimHgtRef_HEADER */
|
#include "clar_libgit2.h"
#include "tag.h"
static const char *tag1_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
static const char *tag2_id = "7b4384978d2493e851f9cca7858815fac9b10980";
static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
static const char *bad_tag_id = "eda9f45a2a98d4c17a09d681d88569fa4ea91755";
static const char *badly_tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
static const char *short_tag_id = "5da7760512a953e3c7c4e47e4392c7a4338fb729";
static const char *short_tagged_commit = "4a5ed60bafcf4638b7c8356bd4ce1916bfede93c";
static git_repository *g_repo;
// Fixture setup and teardown
void test_object_tag_read__initialize(void)
{
g_repo = cl_git_sandbox_init("testrepo");
}
void test_object_tag_read__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_object_tag_read__parse(void)
{
// read and parse a tag from the repository
git_tag *tag1, *tag2;
git_commit *commit;
git_oid id1, id2, id_commit;
git_oid_fromstr(&id1, tag1_id);
git_oid_fromstr(&id2, tag2_id);
git_oid_fromstr(&id_commit, tagged_commit);
cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1));
cl_assert_equal_s(git_tag_name(tag1), "test");
cl_assert(git_tag_type(tag1) == GIT_OBJ_TAG);
cl_git_pass(git_tag_target((git_object **)&tag2, tag1));
cl_assert(tag2 != NULL);
cl_assert(git_oid_cmp(&id2, git_tag_id(tag2)) == 0);
cl_git_pass(git_tag_target((git_object **)&commit, tag2));
cl_assert(commit != NULL);
cl_assert(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
git_tag_free(tag1);
git_tag_free(tag2);
git_commit_free(commit);
}
void test_object_tag_read__parse_without_tagger(void)
{
// read and parse a tag without a tagger field
git_repository *bad_tag_repo;
git_tag *bad_tag;
git_commit *commit;
git_oid id, id_commit;
// TODO: This is a little messy
cl_git_pass(git_repository_open(&bad_tag_repo, cl_fixture("bad_tag.git")));
git_oid_fromstr(&id, bad_tag_id);
git_oid_fromstr(&id_commit, badly_tagged_commit);
cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id));
cl_assert(bad_tag != NULL);
cl_assert_equal_s(git_tag_name(bad_tag), "e90810b");
cl_assert(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0);
cl_assert(bad_tag->tagger == NULL);
cl_git_pass(git_tag_target((git_object **)&commit, bad_tag));
cl_assert(commit != NULL);
cl_assert(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
git_tag_free(bad_tag);
git_commit_free(commit);
git_repository_free(bad_tag_repo);
}
void test_object_tag_read__parse_without_message(void)
{
// read and parse a tag without a message field
git_repository *short_tag_repo;
git_tag *short_tag;
git_commit *commit;
git_oid id, id_commit;
// TODO: This is a little messy
cl_git_pass(git_repository_open(&short_tag_repo, cl_fixture("short_tag.git")));
git_oid_fromstr(&id, short_tag_id);
git_oid_fromstr(&id_commit, short_tagged_commit);
cl_git_pass(git_tag_lookup(&short_tag, short_tag_repo, &id));
cl_assert(short_tag != NULL);
cl_assert_equal_s(git_tag_name(short_tag), "no_description");
cl_assert(git_oid_cmp(&id, git_tag_id(short_tag)) == 0);
cl_assert(short_tag->message == NULL);
cl_git_pass(git_tag_target((git_object **)&commit, short_tag));
cl_assert(commit != NULL);
cl_assert(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
git_tag_free(short_tag);
git_commit_free(commit);
git_repository_free(short_tag_repo);
}
|
/*
* Copyright (c) 2013 Pavlo Lavrenenko
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef ENGINECONFIG_H
#define ENGINECONFIG_H
#include <GrapheneApi.h>
#include <NonCopyable.h>
#include <string>
#define GetEngineConfig() EngineConfig::getInstance()
#define FormatOption(width, name, value) std::setw((width)) << std::left << (name) << " : " << (value)
namespace Graphene {
class EngineConfig: public NonCopyable {
public:
GRAPHENE_API static EngineConfig& getInstance();
GRAPHENE_API std::string toString() const;
GRAPHENE_API float getFov() const;
GRAPHENE_API void setFov(float fov);
GRAPHENE_API int getHeight() const;
GRAPHENE_API void setHeight(int height);
GRAPHENE_API int getWidth() const;
GRAPHENE_API void setWidth(int width);
GRAPHENE_API int getSamples() const;
GRAPHENE_API void setSamples(int samples);
GRAPHENE_API int getAnisotropy() const;
GRAPHENE_API void setAnisotropy(int anisotropy);
GRAPHENE_API float getMaxFps() const;
GRAPHENE_API void setMaxFps(float maxFps);
GRAPHENE_API bool isVsync() const;
GRAPHENE_API void setVsync(bool vsync);
GRAPHENE_API bool isFullscreen() const;
GRAPHENE_API void setFullscreen(bool fullscreen);
GRAPHENE_API bool isDebug() const;
GRAPHENE_API void setDebug(bool debug);
GRAPHENE_API const std::string& getDataDirectory() const;
GRAPHENE_API void setDataDirectory(const std::string& directory);
private:
EngineConfig() = default;
float fov = 75.0f;
int height = 600;
int width = 800;
int samples = 0; // TODO
int anisotropy = 16;
float maxFps = 0.0f;
bool vsync = false;
bool fullscreen = false;
bool debug = true;
std::string dataDirectory;
};
} // namespace Graphene
#endif // ENGINECONFIG_H
|
//
// RethinkDBCursors-Private.h
// RethinkDbClient
//
// Created by Daniel Parnell on on 16/05/2015.
// Copyright (c) 2015 Daniel Parnell
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef RethinkDbClient_RethinkDBCursors_Private_h
#define RethinkDbClient_RethinkDBCursors_Private_h
#include "RethinkDbClient.h"
#import <ProtocolBuffers/ProtocolBuffers.h>
#import "Ql2.pb.h"
@interface RethinkDBCursor (Private)
- (instancetype)initWithClient:(RethinkDbClient*)aClient andToken:(int64_t)aToken;
- (BOOL) fetchNextBatch;
- (void) handleBatch;
@property (strong) Response *response;
@property (strong) NSArray *rows;
@end
#endif
|
/*
* Exercise 2-4
*
* Write an alternate version of squeeze(s1,s2) that deletes each character in
* s1 that matches any character in the string s2.
*/
#include <stdio.h>
void squeeze(char s1[],char s2[]);
int main()
{
char s1[6] = {'t','e','s','t','i','\0'};
char s2[4] = {'t','e','\0'};
squeeze(s1,s2);
printf("%s\n",s1);
return 0;
}
void squeeze(char s1[], char s2[])
{
int i,j,k;
for (i = 0; s2[i] != '\0'; i++) {
for (k = j = 0; s1[k] != '\0'; k++) {
if (s1[k] != s2[i]) {
s1[j++] = s1[k];
}
}
s1[j] = '\0';
}
}
|
//
// MaskView.h
// PSWeChat
//
// Created by 思 彭 on 2017/4/18.
// Copyright © 2017年 思 彭. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MaskView : UIView
@end
|
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#pragma once
#include <vector>
#include <map>
#include <sstream>
#include <string>
#include "ifcpp/model/GlobalDefines.h"
#include "ifcpp/model/BasicTypes.h"
#include "ifcpp/model/BuildingObject.h"
#include "IfcReinforcingElementType.h"
class IFCQUERY_EXPORT IfcTendonAnchorTypeEnum;
//ENTITY
class IFCQUERY_EXPORT IfcTendonAnchorType : public IfcReinforcingElementType
{
public:
IfcTendonAnchorType() = default;
IfcTendonAnchorType( int id );
virtual shared_ptr<BuildingObject> getDeepCopy( BuildingCopyOptions& options );
virtual void getStepLine( std::stringstream& stream ) const;
virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const;
virtual void readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map );
virtual void setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self );
virtual size_t getNumAttributes() { return 10; }
virtual void getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const;
virtual void getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const;
virtual void unlinkFromInverseCounterparts();
virtual const char* className() const { return "IfcTendonAnchorType"; }
virtual const std::wstring toString() const;
// IfcRoot -----------------------------------------------------------
// attributes:
// shared_ptr<IfcGloballyUniqueId> m_GlobalId;
// shared_ptr<IfcOwnerHistory> m_OwnerHistory; //optional
// shared_ptr<IfcLabel> m_Name; //optional
// shared_ptr<IfcText> m_Description; //optional
// IfcObjectDefinition -----------------------------------------------------------
// inverse attributes:
// std::vector<weak_ptr<IfcRelAssigns> > m_HasAssignments_inverse;
// std::vector<weak_ptr<IfcRelNests> > m_Nests_inverse;
// std::vector<weak_ptr<IfcRelNests> > m_IsNestedBy_inverse;
// std::vector<weak_ptr<IfcRelDeclares> > m_HasContext_inverse;
// std::vector<weak_ptr<IfcRelAggregates> > m_IsDecomposedBy_inverse;
// std::vector<weak_ptr<IfcRelAggregates> > m_Decomposes_inverse;
// std::vector<weak_ptr<IfcRelAssociates> > m_HasAssociations_inverse;
// IfcTypeObject -----------------------------------------------------------
// attributes:
// shared_ptr<IfcIdentifier> m_ApplicableOccurrence; //optional
// std::vector<shared_ptr<IfcPropertySetDefinition> > m_HasPropertySets; //optional
// inverse attributes:
// std::vector<weak_ptr<IfcRelDefinesByType> > m_Types_inverse;
// IfcTypeProduct -----------------------------------------------------------
// attributes:
// std::vector<shared_ptr<IfcRepresentationMap> > m_RepresentationMaps; //optional
// shared_ptr<IfcLabel> m_Tag; //optional
// inverse attributes:
// std::vector<weak_ptr<IfcRelAssignsToProduct> > m_ReferencedBy_inverse;
// IfcElementType -----------------------------------------------------------
// attributes:
// shared_ptr<IfcLabel> m_ElementType; //optional
// IfcElementComponentType -----------------------------------------------------------
// IfcReinforcingElementType -----------------------------------------------------------
// IfcTendonAnchorType -----------------------------------------------------------
// attributes:
shared_ptr<IfcTendonAnchorTypeEnum> m_PredefinedType;
};
|
#ifndef SSL_SERVER_PLUGIN_H_
#define SSL_SERVER_PLUGIN_H_
#include "plugin.h"
#include "server\server.hpp"
namespace serpents{
class SSL_Server_Plugin : public IPlugin {
public:
SSL_Server_Plugin();
~SSL_Server_Plugin();
const std::string& getName() const;
void install();
void initialise();
void shutdown();
void uninstall();
protected:
ssl::server* server;
};
}
#endif // SSL_SERVER_PLUGIN_H_
|
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef APPLESEED_RENDERER_MODELING_MATERIAL_GENERICMATERIAL_H
#define APPLESEED_RENDERER_MODELING_MATERIAL_GENERICMATERIAL_H
// appleseed.renderer headers.
#include "renderer/modeling/material/imaterialfactory.h"
// appleseed.foundation headers.
#include "foundation/platform/compiler.h"
#include "foundation/utility/autoreleaseptr.h"
// appleseed.main headers.
#include "main/dllsymbol.h"
// Forward declarations.
namespace foundation { class Dictionary; }
namespace foundation { class DictionaryArray; }
namespace renderer { class Material; }
namespace renderer { class ParamArray; }
namespace renderer
{
//
// Generic material factory.
//
class APPLESEED_DLLSYMBOL GenericMaterialFactory
: public IMaterialFactory
{
public:
// Return a string identifying this material model.
virtual const char* get_model() const APPLESEED_OVERRIDE;
// Return metadata for this material model.
virtual foundation::Dictionary get_model_metadata() const APPLESEED_OVERRIDE;
// Return metadata for the inputs of this material model.
virtual foundation::DictionaryArray get_input_metadata() const APPLESEED_OVERRIDE;
// Create a new material instance.
virtual foundation::auto_release_ptr<Material> create(
const char* name,
const ParamArray& params) const APPLESEED_OVERRIDE;
// Static variant of the create() method above.
static foundation::auto_release_ptr<Material> static_create(
const char* name,
const ParamArray& params);
};
} // namespace renderer
#endif // !APPLESEED_RENDERER_MODELING_MATERIAL_GENERICMATERIAL_H
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef SYSCOIN_CHAINPARAMS_H
#define SYSCOIN_CHAINPARAMS_H
#include <chainparamsbase.h>
#include <consensus/params.h>
#include <primitives/block.h>
#include <protocol.h>
#include <memory>
#include <vector>
struct SeedSpec6 {
uint8_t addr[16];
uint16_t port;
};
typedef std::map<int, uint256> MapCheckpoints;
struct CCheckpointData {
MapCheckpoints mapCheckpoints;
};
/**
* Holds various statistics on transactions within a chain. Used to estimate
* verification progress during chain sync.
*
* See also: CChainParams::TxData, GuessVerificationProgress.
*/
struct ChainTxData {
int64_t nTime; //!< UNIX timestamp of last known number of transactions
int64_t nTxCount; //!< total number of transactions between genesis and that timestamp
double dTxRate; //!< estimated number of transactions per second after that timestamp
};
/**
* CChainParams defines various tweakable parameters of a given instance of the
* Syscoin system. There are three: the main network on which people trade goods
* and services, the public test network which gets reset from time to time and
* a regression test mode which is intended for private networks only. It has
* minimal difficulty to ensure that blocks can be found instantly.
*/
class CChainParams
{
public:
enum Base58Type {
PUBKEY_ADDRESS,
SCRIPT_ADDRESS,
SECRET_KEY,
EXT_PUBLIC_KEY,
EXT_SECRET_KEY,
MAX_BASE58_TYPES
};
const Consensus::Params& GetConsensus() const { return consensus; }
const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
int GetDefaultPort() const { return nDefaultPort; }
const CBlock& GenesisBlock() const { return genesis; }
/** Default value for -checkmempool and -checkblockindex argument */
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
/** Policy: Filter transactions that do not match well-defined patterns */
bool RequireStandard() const { return fRequireStandard; }
/** If this chain is exclusively used for testing */
bool IsTestChain() const { return m_is_test_chain; }
/** If this chain allows time to be mocked */
bool IsMockableChain() const { return m_is_mockable_chain; }
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
/** Minimum free space (in GB) needed for data directory */
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
/** Whether it is possible to mine blocks on demand (no retargeting) */
bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; }
/** Return the network string */
std::string NetworkIDString() const { return strNetworkID; }
/** Return the list of hostnames to look up for DNS seeds */
const std::vector<std::string>& DNSSeeds() const { return vSeeds; }
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
const std::string& Bech32HRP() const { return bech32_hrp; }
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
const ChainTxData& TxData() const { return chainTxData; }
void TurnOffSegwitForUnitTests();
// SYSCOIN
void SetSYSXAssetForUnitTests(uint32_t asset);
int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; }
const std::string& SporkAddress() const { return strSporkAddress; }
protected:
CChainParams() {}
Consensus::Params consensus;
CMessageHeader::MessageStartChars pchMessageStart;
int nDefaultPort;
uint64_t nPruneAfterHeight;
uint64_t m_assumed_blockchain_size;
uint64_t m_assumed_chain_state_size;
std::vector<std::string> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
std::string bech32_hrp;
std::string strNetworkID;
CBlock genesis;
std::vector<SeedSpec6> vFixedSeeds;
bool fDefaultConsistencyChecks;
bool fRequireStandard;
bool m_is_test_chain;
bool m_is_mockable_chain;
CCheckpointData checkpointData;
ChainTxData chainTxData;
// SYSCOIN
int nFulfilledRequestExpireTime;
std::string strSporkAddress;
};
/**
* Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
* @returns a CChainParams* of the chosen chain.
* @throws a std::runtime_error if the chain is not supported.
*/
std::unique_ptr<const CChainParams> CreateChainParams(const std::string& chain);
/**
* Return the currently selected parameters. This won't change after app
* startup, except for unit tests.
*/
const CChainParams &Params();
/**
* Sets the params returned by Params() to those for the given chain name.
* @throws std::runtime_error when the chain is not supported.
*/
void SelectParams(const std::string& chain);
/**
* Allows turning off segwit for unit tests.
*/
void TurnOffSegwitForUnitTests();
// SYSCOIN
void SetSYSXAssetForUnitTests(uint32_t asset);
#endif // SYSCOIN_CHAINPARAMS_H
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.