text stringlengths 4 6.14k |
|---|
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ParsedContentType_h
#define ParsedContentType_h
#include <wtf/HashMap.h>
#include <wtf/text/StringHash.h>
namespace WebCore {
// <index, length>
typedef std::pair<unsigned, unsigned> SubstringRange;
bool isValidContentType(const String&);
// FIXME: add support for comments.
class ParsedContentType {
public:
explicit ParsedContentType(const String&);
String mimeType() const { return m_mimeType; }
String charset() const;
// Note that in the case of multiple values for the same name, the last value is returned.
String parameterValueForName(const String&) const;
size_t parameterCount() const;
private:
template<class ReceiverType>
friend bool parseContentType(const String&, ReceiverType&);
void setContentType(const SubstringRange&);
void setContentTypeParameter(const SubstringRange&, const SubstringRange&);
typedef HashMap<String, String> KeyValuePairs;
String m_contentType;
KeyValuePairs m_parameters;
String m_mimeType;
};
}
#endif
|
// SPDX-License-Identifier: GPL-2.0-only
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <link.h>
#include <stdio.h>
#include <stdlib.h>
struct Statistics {
unsigned long long load_address;
unsigned long long alignment;
};
int ExtractStatistics(struct dl_phdr_info *info, size_t size, void *data)
{
struct Statistics *stats = (struct Statistics *) data;
int i;
if (info->dlpi_name != NULL && info->dlpi_name[0] != '\0') {
// Ignore headers from other than the executable.
return 2;
}
stats->load_address = (unsigned long long) info->dlpi_addr;
stats->alignment = 0;
for (i = 0; i < info->dlpi_phnum; i++) {
if (info->dlpi_phdr[i].p_type != PT_LOAD)
continue;
if (info->dlpi_phdr[i].p_align > stats->alignment)
stats->alignment = info->dlpi_phdr[i].p_align;
}
return 1; // Terminate dl_iterate_phdr.
}
int main(int argc, char **argv)
{
struct Statistics extracted;
unsigned long long misalign;
int ret;
ret = dl_iterate_phdr(ExtractStatistics, &extracted);
if (ret != 1) {
fprintf(stderr, "FAILED\n");
return 1;
}
if (extracted.alignment == 0) {
fprintf(stderr, "No alignment found\n");
return 1;
} else if (extracted.alignment & (extracted.alignment - 1)) {
fprintf(stderr, "Alignment is not a power of 2\n");
return 1;
}
misalign = extracted.load_address & (extracted.alignment - 1);
if (misalign) {
printf("alignment = %llu, load_address = %llu\n",
extracted.alignment, extracted.load_address);
fprintf(stderr, "FAILED\n");
return 1;
}
fprintf(stderr, "PASS\n");
return 0;
}
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* arch/arm/include/asm/tlb.h
*
* Copyright (C) 2002 Russell King
*
* Experimentation shows that on a StrongARM, it appears to be faster
* to use the "invalidate whole tlb" rather than "invalidate single
* tlb" for this.
*
* This appears true for both the process fork+exit case, as well as
* the munmap-large-area case.
*/
#ifndef __ASMARM_TLB_H
#define __ASMARM_TLB_H
#include <asm/cacheflush.h>
#ifndef CONFIG_MMU
#include <linux/pagemap.h>
#define tlb_flush(tlb) ((void) tlb)
#include <asm-generic/tlb.h>
#else /* !CONFIG_MMU */
#include <linux/swap.h>
#include <asm/tlbflush.h>
static inline void __tlb_remove_table(void *_table)
{
free_page_and_swap_cache((struct page *)_table);
}
#include <asm-generic/tlb.h>
static inline void
__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
{
pgtable_pte_page_dtor(pte);
#ifndef CONFIG_ARM_LPAE
/*
* With the classic ARM MMU, a pte page has two corresponding pmd
* entries, each covering 1MB.
*/
addr = (addr & PMD_MASK) + SZ_1M;
__tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE);
#endif
tlb_remove_table(tlb, pte);
}
static inline void
__pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
{
#ifdef CONFIG_ARM_LPAE
struct page *page = virt_to_page(pmdp);
pgtable_pmd_page_dtor(page);
tlb_remove_table(tlb, page);
#endif
}
#endif /* CONFIG_MMU */
#endif
|
/* Copyright (C) 2005 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include "m_string.h"
#include "m_ctype.h"
#define NEQ(A, B) ((A) != (B))
#define EQU(A, B) ((A) == (B))
/**
Macro for the body of the string scanning.
@param CS The character set of the string
@param STR Pointer to beginning of string
@param END Pointer to one-after-end of string
@param ACC Pointer to beginning of accept (or reject) string
@param LEN Length of accept (or reject) string
@param CMP is a function-like for doing the comparison of two characters.
*/
#define SCAN_STRING(CS, STR, END, ACC, LEN, CMP) \
do { \
uint mbl; \
const char *ptr_str, *ptr_acc; \
const char *acc_end= (ACC) + (LEN); \
for (ptr_str= (STR) ; ptr_str < (END) ; ptr_str+= mbl) \
{ \
mbl= my_mbcharlen((CS), *(uchar*)ptr_str); \
if (mbl < 2) \
{ \
DBUG_ASSERT(mbl == 1); \
for (ptr_acc= (ACC) ; ptr_acc < acc_end ; ++ptr_acc) \
if (CMP(*ptr_acc, *ptr_str)) \
goto end; \
} \
} \
end: \
return (size_t) (ptr_str - (STR)); \
} while (0)
/*
my_strchr(cs, str, end, c) returns a pointer to the first place in
str where c (1-byte character) occurs, or NULL if c does not occur
in str. This function is multi-byte safe.
TODO: should be moved to CHARSET_INFO if it's going to be called
frequently.
*/
char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
pchar c)
{
uint mbl;
while (str < end)
{
mbl= my_mbcharlen(cs, *(uchar *)str);
if (mbl < 2)
{
if (*str == c)
return((char *)str);
str++;
}
else
str+= mbl;
}
return(0);
}
/**
Calculate the length of the initial segment of 'str' which consists
entirely of characters not in 'reject'.
@note The reject string points to single-byte characters so it is
only possible to find the first occurrence of a single-byte
character. Multi-byte characters in 'str' are treated as not
matching any character in the reject string.
@todo should be moved to CHARSET_INFO if it's going to be called
frequently.
@internal The implementation builds on the assumption that 'str' is long,
while 'reject' is short. So it compares each character in string
with the characters in 'reject' in a tight loop over the characters
in 'reject'.
*/
size_t my_strcspn(CHARSET_INFO *cs, const char *str, const char *str_end,
const char *reject)
{
SCAN_STRING(cs, str, str_end, reject, strlen(reject), EQU);
}
|
/*
* Copyright (c) 2007-2014 Nicira, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/if.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/if_tunnel.h>
#include <linux/if_vlan.h>
#include <linux/in.h>
#include <linux/in_route.h>
#include <linux/inetdevice.h>
#include <linux/jhash.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/workqueue.h>
#include <linux/rculist.h>
#include <net/route.h>
#include <net/xfrm.h>
#include <net/icmp.h>
#include <net/ip.h>
#include <net/ip_tunnels.h>
#include <net/gre.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/protocol.h>
#include "datapath.h"
#include "vport.h"
#include "vport-netdev.h"
static struct vport_ops ovs_gre_vport_ops;
static struct vport *gre_tnl_create(const struct vport_parms *parms)
{
struct net *net = ovs_dp_get_net(parms->dp);
struct net_device *dev;
struct vport *vport;
int err;
vport = ovs_vport_alloc(0, &ovs_gre_vport_ops, parms);
if (IS_ERR(vport))
return vport;
rtnl_lock();
dev = gretap_fb_dev_create(net, parms->name, NET_NAME_USER);
if (IS_ERR(dev)) {
rtnl_unlock();
ovs_vport_free(vport);
return ERR_CAST(dev);
}
err = dev_change_flags(dev, dev->flags | IFF_UP);
if (err < 0) {
rtnl_delete_link(dev);
rtnl_unlock();
ovs_vport_free(vport);
return ERR_PTR(err);
}
rtnl_unlock();
return vport;
}
static struct vport *gre_create(const struct vport_parms *parms)
{
struct vport *vport;
vport = gre_tnl_create(parms);
if (IS_ERR(vport))
return vport;
return ovs_netdev_link(vport, parms->name);
}
static struct vport_ops ovs_gre_vport_ops = {
.type = OVS_VPORT_TYPE_GRE,
.create = gre_create,
.send = dev_queue_xmit,
.destroy = ovs_netdev_tunnel_destroy,
};
static int __init ovs_gre_tnl_init(void)
{
return ovs_vport_ops_register(&ovs_gre_vport_ops);
}
static void __exit ovs_gre_tnl_exit(void)
{
ovs_vport_ops_unregister(&ovs_gre_vport_ops);
}
module_init(ovs_gre_tnl_init);
module_exit(ovs_gre_tnl_exit);
MODULE_DESCRIPTION("OVS: GRE switching port");
MODULE_LICENSE("GPL");
MODULE_ALIAS("vport-type-3");
|
/*
Copyright 2017 Danny Nguyen <danny@keeb.io>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "config_common.h"
/* Use I2C or Serial, not both */
#define USE_SERIAL
// #define USE_I2C
/* Select hand configuration */
#define MASTER_LEFT
// #define MASTER_RIGHT
// #define EE_HANDS
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 12
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#endif
|
/* lrintf adapted to be llrintf for Newlib, 2009 by Craig Howland. */
/* @(#)sf_lrint.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
* llrintf(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using floating addition.
* Exception:
* Inexact flag raised if x not equal to llrintf(x).
*/
#include "fdlibm.h"
#ifdef __STDC__
static const float
#else
static float
#endif
/* Adding a float, x, to 2^23 will cause the result to be rounded based on
the fractional part of x, according to the implementation's current rounding
mode. 2^23 is the smallest float that can be represented using all 23 significant
digits. */
TWO23[2]={
8.3886080000e+06, /* 0x4b000000 */
-8.3886080000e+06, /* 0xcb000000 */
};
#ifdef __STDC__
long long int llrintf(float x)
#else
long long int llrintf(x)
float x;
#endif
{
__int32_t j0,sx;
__uint32_t i0;
float t;
volatile float w;
long long int result;
GET_FLOAT_WORD(i0,x);
/* Extract sign bit. */
sx = (i0 >> 31);
/* Extract exponent field. */
j0 = ((i0 & 0x7f800000) >> 23) - 127;
if (j0 < (int)(sizeof (long long int) * 8) - 1)
{
if (j0 < -1)
return 0;
else if (j0 >= 23)
result = (long long int) ((i0 & 0x7fffff) | 0x800000) << (j0 - 23);
else
{
w = TWO23[sx] + x;
t = w - TWO23[sx];
GET_FLOAT_WORD (i0, t);
/* Detect the all-zeros representation of plus and
minus zero, which fails the calculation below. */
if ((i0 & ~((__uint32_t)1 << 31)) == 0)
return 0;
j0 = ((i0 >> 23) & 0xff) - 0x7f;
i0 &= 0x7fffff;
i0 |= 0x800000;
result = i0 >> (23 - j0);
}
}
else
{
return (long long int) x;
}
return sx ? -result : result;
}
#ifdef _DOUBLE_IS_32BITS
#ifdef __STDC__
long long int llrint(double x)
#else
long long int llrint(x)
double x;
#endif
{
return llrintf((float) x);
}
#endif /* defined(_DOUBLE_IS_32BITS) */
|
/******************************************************************************
* Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
*****************************************************************************/
#include "rtl_core.h"
#include "r8192E_hw.h"
#include "r8190P_rtl8256.h"
#include "rtl_pm.h"
int rtl92e_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev);
u32 ulRegRead;
netdev_info(dev, "============> r8192E suspend call.\n");
del_timer_sync(&priv->gpio_polling_timer);
cancel_delayed_work_sync(&priv->gpio_change_rf_wq);
priv->polling_timer_on = 0;
if (!netif_running(dev)) {
netdev_info(dev,
"RTL819XE:UI is open out of suspend function\n");
goto out_pci_suspend;
}
if (dev->netdev_ops->ndo_stop)
dev->netdev_ops->ndo_stop(dev);
netif_device_detach(dev);
if (!priv->rtllib->bSupportRemoteWakeUp) {
rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT);
ulRegRead = rtl92e_readl(dev, CPU_GEN);
ulRegRead |= CPU_GEN_SYSTEM_RESET;
rtl92e_writel(dev, CPU_GEN, ulRegRead);
} else {
rtl92e_writel(dev, WFCRC0, 0xffffffff);
rtl92e_writel(dev, WFCRC1, 0xffffffff);
rtl92e_writel(dev, WFCRC2, 0xffffffff);
rtl92e_writeb(dev, PMR, 0x5);
rtl92e_writeb(dev, MacBlkCtrl, 0xa);
}
out_pci_suspend:
netdev_info(dev, "WOL is %s\n", priv->rtllib->bSupportRemoteWakeUp ?
"Supported" : "Not supported");
pci_save_state(pdev);
pci_disable_device(pdev);
pci_enable_wake(pdev, pci_choose_state(pdev, state),
priv->rtllib->bSupportRemoteWakeUp ? 1 : 0);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
mdelay(20);
return 0;
}
int rtl92e_resume(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev);
int err;
u32 val;
netdev_info(dev, "================>r8192E resume call.\n");
pci_set_power_state(pdev, PCI_D0);
err = pci_enable_device(pdev);
if (err) {
netdev_err(dev, "pci_enable_device failed on resume\n");
return err;
}
pci_restore_state(pdev);
pci_read_config_dword(pdev, 0x40, &val);
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
pci_enable_wake(pdev, PCI_D0, 0);
if (priv->polling_timer_on == 0)
rtl92e_check_rfctrl_gpio_timer(&priv->gpio_polling_timer);
if (!netif_running(dev)) {
netdev_info(dev,
"RTL819XE:UI is open out of resume function\n");
goto out;
}
netif_device_attach(dev);
if (dev->netdev_ops->ndo_open)
dev->netdev_ops->ndo_open(dev);
if (!priv->rtllib->bSupportRemoteWakeUp)
rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_INIT);
out:
RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
return 0;
}
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __gnu_CORBA_GIOP_v1_0_CancelHeader__
#define __gnu_CORBA_GIOP_v1_0_CancelHeader__
#pragma interface
#include <gnu/CORBA/GIOP/CancelHeader.h>
extern "Java"
{
namespace gnu
{
namespace CORBA
{
namespace GIOP
{
namespace v1_0
{
class CancelHeader;
}
}
}
}
namespace org
{
namespace omg
{
namespace CORBA
{
namespace portable
{
class InputStream;
class OutputStream;
}
}
}
}
}
class gnu::CORBA::GIOP::v1_0::CancelHeader : public ::gnu::CORBA::GIOP::CancelHeader
{
public:
CancelHeader();
virtual void read(::org::omg::CORBA::portable::InputStream *);
virtual void write(::org::omg::CORBA::portable::OutputStream *);
static ::java::lang::Class class$;
};
#endif // __gnu_CORBA_GIOP_v1_0_CancelHeader__
|
#ifndef __PROCFS_FD_H__
#define __PROCFS_FD_H__
#include <linux/fs.h>
extern const struct file_operations proc_fd_operations;
extern const struct inode_operations proc_fd_inode_operations;
extern const struct file_operations proc_fdinfo_operations;
extern const struct inode_operations proc_fdinfo_inode_operations;
extern int proc_fd_permission(struct inode *inode, int mask);
static inline int proc_fd(struct inode *inode)
{
return PROC_I(inode)->fd;
}
#endif /* __PROCFS_FD_H__ */
|
#include <linux/ieee80211.h>
#include <linux/export.h>
#include <net/cfg80211.h>
#include "nl80211.h"
#include "core.h"
#include "rdev-ops.h"
int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
struct net_device *dev, bool notify)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err;
ASSERT_WDEV_LOCK(wdev);
if (!rdev->ops->stop_ap)
return -EOPNOTSUPP;
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
return -EOPNOTSUPP;
if (!wdev->beacon_interval)
return -ENOENT;
err = rdev_stop_ap(rdev, dev);
if (!err) {
wdev->beacon_interval = 0;
memset(&wdev->chandef, 0, sizeof(wdev->chandef));
wdev->ssid_len = 0;
rdev_set_qos_map(rdev, dev, NULL);
if (notify)
nl80211_send_ap_stopped(wdev);
}
return err;
}
int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
struct net_device *dev, bool notify)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err;
wdev_lock(wdev);
err = __cfg80211_stop_ap(rdev, dev, notify);
wdev_unlock(wdev);
return err;
}
|
/*
* Samsung Exynos5 SoC series FIMC-IS driver
*
*
* Copyright (c) 2011 Samsung Electronics Co., 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.
*/
#ifndef FIMC_IS_DEVICE_FLITE_H
#define FIMC_IS_DEVICE_FLITE_H
#include <linux/interrupt.h>
#include "fimc-is-type.h"
#define EXPECT_FRAME_START 0
#define EXPECT_FRAME_END 1
#define FLITE_NOTIFY_FSTART 0
#define FLITE_NOTIFY_FEND 1
#define FLITE_ENABLE_FLAG 1
#define FLITE_ENABLE_MASK 0xFFFF
#define FLITE_ENABLE_SHIFT 0
#define FLITE_NOWAIT_FLAG 1
#define FLITE_NOWAIT_MASK 0xFFFF0000
#define FLITE_NOWAIT_SHIFT 16
#define FLITE_OVERFLOW_COUNT 10
#define FLITE_VVALID_TIME_BASE 32 /* ms */
struct fimc_is_device_sensor;
enum fimc_is_flite_state {
/* buffer state*/
FLITE_A_SLOT_VALID = 0,
FLITE_B_SLOT_VALID,
/* finish state */
FLITE_LAST_CAPTURE,
/* flite join ischain */
FLITE_JOIN_ISCHAIN,
/* one the fly output */
FLITE_OTF_WITH_3AA,
};
enum fimc_is_flite_buf_done_mode {
FLITE_BUF_DONE_NORMAL = 0, /* when end-irq */
FLITE_BUF_DONE_EARLY = 1, /* when delayed work queue since start-irq */
};
/*
* 10p means 10% early than end irq. We supposed that VVALID time is variable
* ex. 32 * 0.1 = 3ms, early interval is (33 - 3) = 29ms
* 32 * 0.2 = 6ms, (33 - 6) = 26ms
* 32 * 0.3 = 9ms, (33 - 9) = 23ms
* 32 * 0.4 = 12ms, (33 - 12) = 20ms
*/
enum fimc_is_flite_early_buf_done_mode {
FLITE_BUF_EARLY_NOTHING = 0,
FLITE_BUF_EARLY_10P = 1, /* 10%(29ms) 3ms */
FLITE_BUF_EARLY_20P = 2, /* 20%(26ms) 6ms */
FLITE_BUF_EARLY_30P = 3, /* 30%(23ms) 9ms */
FLITE_BUF_EARLY_40P = 4, /* 40%(20ms) 12ms */
};
struct fimc_is_device_flite {
u32 instance;
u32 __iomem *base_reg;
unsigned long state;
wait_queue_head_t wait_queue;
struct fimc_is_image image;
struct fimc_is_framemgr *framemgr;
u32 overflow_cnt;
u32 csi; /* which csi channel is connceted */
u32 group; /* which 3aa gorup is connected when otf is enable */
u32 sw_checker;
u32 sw_trigger;
atomic_t bcount;
atomic_t fcount;
u32 tasklet_param_str;
struct tasklet_struct tasklet_flite_str;
u32 tasklet_param_end;
struct tasklet_struct tasklet_flite_end;
/* for early buffer done */
u32 buf_done_mode;
u32 early_buf_done_mode;
u32 buf_done_wait_time;
bool early_work_skip;
bool early_work_called;
struct tasklet_struct tasklet_flite_early_end;
struct workqueue_struct *early_workqueue;
struct delayed_work early_work_wq;
void (*chk_early_buf_done)(struct fimc_is_device_flite *flite, u32 framerate, u32 position);
/* pointer address from device sensor */
struct v4l2_subdev **subdev;
};
int fimc_is_flite_probe(struct fimc_is_device_sensor *device,
u32 instance);
int fimc_is_flite_open(struct v4l2_subdev *subdev,
struct fimc_is_framemgr *framemgr);
int fimc_is_flite_close(struct v4l2_subdev *subdev);
extern u32 __iomem *notify_fcount_sen0;
extern u32 __iomem *notify_fcount_sen1;
extern u32 __iomem *notify_fcount_sen2;
extern u32 __iomem *last_fcount0;
extern u32 __iomem *last_fcount1;
#endif
|
#ifndef _M68K_IRQ_H_
#define _M68K_IRQ_H_
/*
* This should be the same as the max(NUM_X_SOURCES) for all the
* different m68k hosts compiled into the kernel.
* Currently the Atari has 72 and the Amiga 24, but if both are
* supported in the kernel it is better to make room for 72.
* With EtherNAT add-on card on Atari, the highest interrupt
* number is 140 so NR_IRQS needs to be 141.
*/
#if defined(CONFIG_COLDFIRE)
#define NR_IRQS 256
#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
#define NR_IRQS 200
#elif defined(CONFIG_ATARI)
#define NR_IRQS 141
#elif defined(CONFIG_MAC)
#define NR_IRQS 72
#elif defined(CONFIG_Q40)
#define NR_IRQS 43
#elif defined(CONFIG_AMIGA) || !defined(CONFIG_MMU)
#define NR_IRQS 32
#elif defined(CONFIG_APOLLO)
#define NR_IRQS 24
#elif defined(CONFIG_HP300)
#define NR_IRQS 8
#else
#define NR_IRQS 0
#endif
#if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
defined(CONFIG_M68040) || defined(CONFIG_M68060)
/*
* Interrupt source definitions
* General interrupt sources are the level 1-7.
* Adding an interrupt service routine for one of these sources
* results in the addition of that routine to a chain of routines.
* Each one is called in succession. Each individual interrupt
* service routine should determine if the device associated with
* that routine requires service.
*/
#define IRQ_SPURIOUS 0
#define IRQ_AUTO_1 1 /* level 1 interrupt */
#define IRQ_AUTO_2 2 /* level 2 interrupt */
#define IRQ_AUTO_3 3 /* level 3 interrupt */
#define IRQ_AUTO_4 4 /* level 4 interrupt */
#define IRQ_AUTO_5 5 /* level 5 interrupt */
#define IRQ_AUTO_6 6 /* level 6 interrupt */
#define IRQ_AUTO_7 7 /* level 7 interrupt (non-maskable) */
#define IRQ_USER 8
struct irq_data;
struct irq_chip;
struct irq_desc;
extern unsigned int m68k_irq_startup(struct irq_data *data);
extern unsigned int m68k_irq_startup_irq(unsigned int irq);
extern void m68k_irq_shutdown(struct irq_data *data);
extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int,
struct pt_regs *));
extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt);
extern void m68k_setup_irq_controller(struct irq_chip *,
void (*handle)(struct irq_desc *desc),
unsigned int irq, unsigned int cnt);
extern unsigned int irq_canonicalize(unsigned int irq);
#else
#define irq_canonicalize(irq) (irq)
#endif /* !(CONFIG_M68020 || CONFIG_M68030 || CONFIG_M68040 || CONFIG_M68060) */
asmlinkage void do_IRQ(int irq, struct pt_regs *regs);
extern atomic_t irq_err_count;
#endif /* _M68K_IRQ_H_ */
|
/*
* Header for code common to all DaVinci machines.
*
* Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
*
* 2007 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#ifndef __ARCH_ARM_MACH_DAVINCI_COMMON_H
#define __ARCH_ARM_MACH_DAVINCI_COMMON_H
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/reboot.h>
extern void davinci_timer_init(void);
extern void davinci_irq_init(void);
extern void __iomem *davinci_intc_base;
extern int davinci_intc_type;
struct davinci_timer_instance {
u32 base;
u32 bottom_irq;
u32 top_irq;
unsigned long cmp_off;
unsigned int cmp_irq;
};
struct davinci_timer_info {
struct davinci_timer_instance *timers;
unsigned int clockevent_id;
unsigned int clocksource_id;
};
struct davinci_gpio_controller;
/*
* SoC info passed into common davinci modules.
*
* Base addresses in this structure should be physical and not virtual.
* Modules that take such base addresses, should internally ioremap() them to
* use.
*/
struct davinci_soc_info {
struct map_desc *io_desc;
unsigned long io_desc_num;
u32 cpu_id;
u32 jtag_id;
u32 jtag_id_reg;
struct davinci_id *ids;
unsigned long ids_num;
struct clk_lookup *cpu_clks;
u32 *psc_bases;
unsigned long psc_bases_num;
u32 pinmux_base;
const struct mux_config *pinmux_pins;
unsigned long pinmux_pins_num;
u32 intc_base;
int intc_type;
u8 *intc_irq_prios;
unsigned long intc_irq_num;
u32 *intc_host_map;
struct davinci_timer_info *timer_info;
int gpio_type;
u32 gpio_base;
unsigned gpio_num;
unsigned gpio_irq;
unsigned gpio_unbanked;
struct davinci_gpio_controller *gpio_ctlrs;
int gpio_ctlrs_num;
struct platform_device *serial_dev;
struct emac_platform_data *emac_pdata;
dma_addr_t sram_dma;
unsigned sram_len;
};
extern struct davinci_soc_info davinci_soc_info;
extern void davinci_common_init(struct davinci_soc_info *soc_info);
extern void davinci_init_ide(void);
void davinci_restart(enum reboot_mode mode, const char *cmd);
void davinci_init_late(void);
#ifdef CONFIG_DAVINCI_RESET_CLOCKS
int davinci_clk_disable_unused(void);
#else
static inline int davinci_clk_disable_unused(void) { return 0; }
#endif
#ifdef CONFIG_CPU_FREQ
int davinci_cpufreq_init(void);
#else
static inline int davinci_cpufreq_init(void) { return 0; }
#endif
#ifdef CONFIG_SUSPEND
int davinci_pm_init(void);
#else
static inline int davinci_pm_init(void) { return 0; }
#endif
#define SRAM_SIZE SZ_128K
#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
|
/*
* CompactPCI Hot Plug Core Functions
*
* Copyright (C) 2002 SOMA Networks, Inc.
* Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (C) 2001 IBM Corp.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Send feedback to <scottm@somanetworks.com>
*/
#ifndef _CPCI_HOTPLUG_H
#define _CPCI_HOTPLUG_H
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/pci_hotplug.h>
/* PICMG 2.1 R2.0 HS CSR bits: */
#define HS_CSR_INS 0x0080
#define HS_CSR_EXT 0x0040
#define HS_CSR_PI 0x0030
#define HS_CSR_LOO 0x0008
#define HS_CSR_PIE 0x0004
#define HS_CSR_EIM 0x0002
#define HS_CSR_DHA 0x0001
struct slot {
u8 number;
unsigned int devfn;
struct pci_bus *bus;
struct pci_dev *dev;
unsigned int extracting;
struct hotplug_slot *hotplug_slot;
struct list_head slot_list;
};
struct cpci_hp_controller_ops {
int (*query_enum)(void);
int (*enable_irq)(void);
int (*disable_irq)(void);
int (*check_irq)(void *dev_id);
int (*hardware_test)(struct slot *slot, u32 value);
u8 (*get_power)(struct slot *slot);
int (*set_power)(struct slot *slot, int value);
};
struct cpci_hp_controller {
unsigned int irq;
unsigned long irq_flags;
char *devname;
void *dev_id;
char *name;
struct cpci_hp_controller_ops *ops;
};
static inline const char *slot_name(struct slot *slot)
{
return hotplug_slot_name(slot->hotplug_slot);
}
int cpci_hp_register_controller(struct cpci_hp_controller *controller);
int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
int cpci_hp_unregister_bus(struct pci_bus *bus);
int cpci_hp_start(void);
int cpci_hp_stop(void);
/*
* Internal function prototypes, these functions should not be used by
* board/chassis drivers.
*/
u8 cpci_get_attention_status(struct slot *slot);
u8 cpci_get_latch_status(struct slot *slot);
u8 cpci_get_adapter_status(struct slot *slot);
u16 cpci_get_hs_csr(struct slot *slot);
int cpci_set_attention_status(struct slot *slot, int status);
int cpci_check_and_clear_ins(struct slot *slot);
int cpci_check_ext(struct slot *slot);
int cpci_clear_ext(struct slot *slot);
int cpci_led_on(struct slot *slot);
int cpci_led_off(struct slot *slot);
int cpci_configure_slot(struct slot *slot);
int cpci_unconfigure_slot(struct slot *slot);
#ifdef CONFIG_HOTPLUG_PCI_CPCI
int cpci_hotplug_init(int debug);
void cpci_hotplug_exit(void);
#else
static inline int cpci_hotplug_init(int debug) { return 0; }
static inline void cpci_hotplug_exit(void) { }
#endif
#endif /* _CPCI_HOTPLUG_H */
|
#ifndef _DYNAMIC_DEBUG_H
#define _DYNAMIC_DEBUG_H
/*
* An instance of this structure is created in a special
* ELF section at every dynamic debug callsite. At runtime,
* the special section is treated as an array of these.
*/
struct _ddebug {
/*
* These fields are used to drive the user interface
* for selecting and displaying debug callsites.
*/
const char *modname;
const char *function;
const char *filename;
const char *format;
unsigned int lineno:18;
/*
* The flags field controls the behaviour at the callsite.
* The bits here are changed dynamically when the user
* writes commands to <debugfs>/dynamic_debug/control
*/
#define _DPRINTK_FLAGS_NONE 0
#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4)
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
#define _DPRINTK_FLAGS_DEFAULT 0
#endif
unsigned int flags:8;
} __attribute__((aligned(8)));
int ddebug_add_module(struct _ddebug *tab, unsigned int n,
const char *modname);
#if defined(CONFIG_DYNAMIC_DEBUG)
extern int ddebug_remove_module(const char *mod_name);
extern __printf(2, 3)
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
const char *modname);
struct device;
extern __printf(3, 4)
void __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
const char *fmt, ...);
struct net_device;
extern __printf(3, 4)
void __dynamic_netdev_dbg(struct _ddebug *descriptor,
const struct net_device *dev,
const char *fmt, ...);
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
static struct _ddebug __aligned(8) \
__attribute__((section("__verbose"))) name = { \
.modname = KBUILD_MODNAME, \
.function = __func__, \
.filename = __FILE__, \
.format = (fmt), \
.lineno = __LINE__, \
.flags = _DPRINTK_FLAGS_DEFAULT, \
}
#define dynamic_pr_debug(fmt, ...) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
##__VA_ARGS__); \
} while (0)
#define dynamic_dev_dbg(dev, fmt, ...) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
__dynamic_dev_dbg(&descriptor, dev, fmt, \
##__VA_ARGS__); \
} while (0)
#define dynamic_netdev_dbg(dev, fmt, ...) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
__dynamic_netdev_dbg(&descriptor, dev, fmt, \
##__VA_ARGS__); \
} while (0)
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
__builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
print_hex_dump(KERN_DEBUG, prefix_str, \
prefix_type, rowsize, groupsize, \
buf, len, ascii); \
} while (0)
#else
#include <linux/string.h>
#include <linux/errno.h>
static inline int ddebug_remove_module(const char *mod)
{
return 0;
}
static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
const char *modname)
{
if (strstr(param, "dyndbg")) {
/* avoid pr_warn(), which wants pr_fmt() fully defined */
printk(KERN_WARNING "dyndbg param is supported only in "
"CONFIG_DYNAMIC_DEBUG builds\n");
return 0; /* allow and ignore */
}
return -EINVAL;
}
#define dynamic_pr_debug(fmt, ...) \
do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
#define dynamic_dev_dbg(dev, fmt, ...) \
do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
#endif
#endif
|
/* PR middle-end/49897 */
/* { dg-do run } */
extern void abort (void);
int
main ()
{
int i, j, x = 0, y, sum = 0;
#pragma omp parallel for reduction(+:sum) firstprivate(x) lastprivate(x, y)
for (i = 0; i < 10; i++)
{
x = i;
y = 0;
#pragma omp parallel for reduction(+:sum) firstprivate(y) lastprivate(y)
for (j = 0; j < 10; j++)
{
y = j;
sum += y;
}
}
if (x != 9 || y != 9 || sum != 450)
abort ();
return 0;
}
|
#ifndef _LINUX_ALARMTIMER_H
#define _LINUX_ALARMTIMER_H
#include <linux/time.h>
#include <linux/hrtimer.h>
#include <linux/timerqueue.h>
#include <linux/rtc.h>
enum alarmtimer_type {
ALARM_REALTIME,
ALARM_BOOTTIME,
ALARM_NUMTYPE,
};
enum alarmtimer_restart {
ALARMTIMER_NORESTART,
ALARMTIMER_RESTART,
};
#define ALARMTIMER_STATE_INACTIVE 0x00
#define ALARMTIMER_STATE_ENQUEUED 0x01
#define ALARMTIMER_STATE_CALLBACK 0x02
/**
* struct alarm - Alarm timer structure
* @node: timerqueue node for adding to the event list this value
* also includes the expiration time.
* @period: Period for recuring alarms
* @function: Function pointer to be executed when the timer fires.
* @type: Alarm type (BOOTTIME/REALTIME)
* @enabled: Flag that represents if the alarm is set to fire or not
* @data: Internal data value.
*/
struct alarm {
struct timerqueue_node node;
struct hrtimer timer;
enum alarmtimer_restart (*function)(struct alarm *, ktime_t now);
enum alarmtimer_type type;
int state;
void *data;
};
void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
int alarm_start(struct alarm *alarm, ktime_t start);
int alarm_start_relative(struct alarm *alarm, ktime_t start);
void alarm_restart(struct alarm *alarm);
int alarm_try_to_cancel(struct alarm *alarm);
int alarm_cancel(struct alarm *alarm);
u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
u64 alarm_forward_now(struct alarm *alarm, ktime_t interval);
ktime_t alarm_expires_remaining(const struct alarm *alarm);
/*
* A alarmtimer is active, when it is enqueued into timerqueue or the
* callback function is running.
*/
static inline int alarmtimer_active(const struct alarm *timer)
{
return timer->state != ALARMTIMER_STATE_INACTIVE;
}
/*
* Helper function to check, whether the timer is on one of the queues
*/
static inline int alarmtimer_is_queued(struct alarm *timer)
{
return timer->state & ALARMTIMER_STATE_ENQUEUED;
}
/*
* Helper function to check, whether the timer is running the callback
* function
*/
static inline int alarmtimer_callback_running(struct alarm *timer)
{
return timer->state & ALARMTIMER_STATE_CALLBACK;
}
/* Provide way to access the rtc device being used by alarmtimers */
struct rtc_device *alarmtimer_get_rtcdev(void);
#endif
|
/*
* i2c-pca-isa.c driver for PCA9564 on ISA boards
* Copyright (C) 2004 Arcom Control Systems
* Copyright (C) 2008 Pengutronix
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/wait.h>
#include <linux/isa.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-pca.h>
#include <linux/io.h>
#include <asm/irq.h>
#define DRIVER "i2c-pca-isa"
#define IO_SIZE 4
static unsigned long base;
static int irq = -1;
/* Data sheet recommends 59kHz for 100kHz operation due to variation
* in the actual clock rate */
static int clock = 59000;
static struct i2c_adapter pca_isa_ops;
static wait_queue_head_t pca_wait;
static void pca_isa_writebyte(void *pd, int reg, int val)
{
#ifdef DEBUG_IO
static char *names[] = { "T/O", "DAT", "ADR", "CON" };
printk(KERN_DEBUG "*** write %s at %#lx <= %#04x\n", names[reg],
base+reg, val);
#endif
outb(val, base+reg);
}
static int pca_isa_readbyte(void *pd, int reg)
{
int res = inb(base+reg);
#ifdef DEBUG_IO
{
static char *names[] = { "STA", "DAT", "ADR", "CON" };
printk(KERN_DEBUG "*** read %s => %#04x\n", names[reg], res);
}
#endif
return res;
}
static int pca_isa_waitforcompletion(void *pd)
{
unsigned long timeout;
long ret;
if (irq > -1) {
ret = wait_event_timeout(pca_wait,
pca_isa_readbyte(pd, I2C_PCA_CON)
& I2C_PCA_CON_SI, pca_isa_ops.timeout);
} else {
/* Do polling */
timeout = jiffies + pca_isa_ops.timeout;
do {
ret = time_before(jiffies, timeout);
if (pca_isa_readbyte(pd, I2C_PCA_CON)
& I2C_PCA_CON_SI)
break;
udelay(100);
} while (ret);
}
return ret > 0;
}
static void pca_isa_resetchip(void *pd)
{
/* apparently only an external reset will do it. not a lot can be done */
printk(KERN_WARNING DRIVER ": Haven't figured out how to do a reset yet\n");
}
static irqreturn_t pca_handler(int this_irq, void *dev_id) {
wake_up(&pca_wait);
return IRQ_HANDLED;
}
static struct i2c_algo_pca_data pca_isa_data = {
/* .data intentionally left NULL, not needed with ISA */
.write_byte = pca_isa_writebyte,
.read_byte = pca_isa_readbyte,
.wait_for_completion = pca_isa_waitforcompletion,
.reset_chip = pca_isa_resetchip,
};
static struct i2c_adapter pca_isa_ops = {
.owner = THIS_MODULE,
.algo_data = &pca_isa_data,
.name = "PCA9564/PCA9665 ISA Adapter",
.timeout = HZ,
};
static int pca_isa_match(struct device *dev, unsigned int id)
{
int match = base != 0;
if (match) {
if (irq <= -1)
dev_warn(dev, "Using polling mode (specify irq)\n");
} else
dev_err(dev, "Please specify I/O base\n");
return match;
}
static int pca_isa_probe(struct device *dev, unsigned int id)
{
init_waitqueue_head(&pca_wait);
dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq);
#ifdef CONFIG_PPC
if (check_legacy_ioport(base)) {
dev_err(dev, "I/O address %#08lx is not available\n", base);
goto out;
}
#endif
if (!request_region(base, IO_SIZE, "i2c-pca-isa")) {
dev_err(dev, "I/O address %#08lx is in use\n", base);
goto out;
}
if (irq > -1) {
if (request_irq(irq, pca_handler, 0, "i2c-pca-isa", &pca_isa_ops) < 0) {
dev_err(dev, "Request irq%d failed\n", irq);
goto out_region;
}
}
pca_isa_data.i2c_clock = clock;
if (i2c_pca_add_bus(&pca_isa_ops) < 0) {
dev_err(dev, "Failed to add i2c bus\n");
goto out_irq;
}
return 0;
out_irq:
if (irq > -1)
free_irq(irq, &pca_isa_ops);
out_region:
release_region(base, IO_SIZE);
out:
return -ENODEV;
}
static int pca_isa_remove(struct device *dev, unsigned int id)
{
i2c_del_adapter(&pca_isa_ops);
if (irq > -1) {
disable_irq(irq);
free_irq(irq, &pca_isa_ops);
}
release_region(base, IO_SIZE);
return 0;
}
static struct isa_driver pca_isa_driver = {
.match = pca_isa_match,
.probe = pca_isa_probe,
.remove = pca_isa_remove,
.driver = {
.owner = THIS_MODULE,
.name = DRIVER,
}
};
MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>");
MODULE_DESCRIPTION("ISA base PCA9564/PCA9665 driver");
MODULE_LICENSE("GPL");
module_param(base, ulong, 0);
MODULE_PARM_DESC(base, "I/O base address");
module_param(irq, int, 0);
MODULE_PARM_DESC(irq, "IRQ");
module_param(clock, int, 0);
MODULE_PARM_DESC(clock, "Clock rate in hertz.\n\t\t"
"For PCA9564: 330000,288000,217000,146000,"
"88000,59000,44000,36000\n"
"\t\tFor PCA9665:\tStandard: 60300 - 100099\n"
"\t\t\t\tFast: 100100 - 400099\n"
"\t\t\t\tFast+: 400100 - 10000099\n"
"\t\t\t\tTurbo: Up to 1265800");
module_isa_driver(pca_isa_driver, 1);
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2015, Intel Corporation.
*
* 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.
*/
#ifndef __IA_CSS_OB_TYPES_H
#define __IA_CSS_OB_TYPES_H
/* @file
* CSS-API header file for Optical Black level parameters.
*/
#include "ia_css_frac.h"
/* Optical black mode.
*/
enum ia_css_ob_mode {
IA_CSS_OB_MODE_NONE, /** OB has no effect. */
IA_CSS_OB_MODE_FIXED, /** Fixed OB */
IA_CSS_OB_MODE_RASTER /** Raster OB */
};
/* Optical Black level configuration.
*
* ISP block: OB1
* ISP1: OB1 is used.
* ISP2: OB1 is used.
*/
struct ia_css_ob_config {
enum ia_css_ob_mode mode; /** Mode (None / Fixed / Raster).
enum, [0,2],
default 1, ineffective 0 */
ia_css_u0_16 level_gr; /** Black level for GR pixels
(used for Fixed Mode only).
u0.16, [0,65535],
default/ineffective 0 */
ia_css_u0_16 level_r; /** Black level for R pixels
(used for Fixed Mode only).
u0.16, [0,65535],
default/ineffective 0 */
ia_css_u0_16 level_b; /** Black level for B pixels
(used for Fixed Mode only).
u0.16, [0,65535],
default/ineffective 0 */
ia_css_u0_16 level_gb; /** Black level for GB pixels
(used for Fixed Mode only).
u0.16, [0,65535],
default/ineffective 0 */
u16 start_position; /** Start position of OB area
(used for Raster Mode only).
u16.0, [0,63],
default/ineffective 0 */
u16 end_position; /** End position of OB area
(used for Raster Mode only).
u16.0, [0,63],
default/ineffective 0 */
};
#endif /* __IA_CSS_OB_TYPES_H */
|
/* This would cause PRE load motion to generate invalid code and ICE */
void foo (char *name)
{
if (*name)
name ++;
while (name[0]);
asm ("" : "=r" (name));
}
|
short
func(void)
{
unsigned char x, y;
return y | x << 8;
}
|
#import "EXPExpect.h"
#import "EXPBlockDefinedMatcher.h"
#ifdef __cplusplus
extern "C" {
#endif
id _EXPObjectify(const char *type, ...);
EXPExpect *_EXP_expect(id testCase, int lineNumber, const char *fileName, EXPIdBlock actualBlock);
void EXPFail(id testCase, int lineNumber, const char *fileName, NSString *message);
NSString *EXPDescribeObject(id obj);
void EXP_prerequisite(EXPBoolBlock block);
void EXP_match(EXPBoolBlock block);
void EXP_failureMessageForTo(EXPStringBlock block);
void EXP_failureMessageForNotTo(EXPStringBlock block);
#if __has_feature(objc_arc)
#define _EXP_release(x)
#define _EXP_autorelease(x) (x)
#else
#define _EXP_release(x) [x release]
#define _EXP_autorelease(x) [x autorelease]
#endif
// workaround for the categories bug: http://developer.apple.com/library/mac/#qa/qa1490/_index.html
#define EXPFixCategoriesBug(name) \
__attribute__((constructor)) static void EXPFixCategoriesBug##name() {}
#define _EXPMatcherInterface(matcherName, matcherArguments) \
@interface EXPExpect (matcherName##Matcher) \
@property (nonatomic, readonly) void(^ matcherName) matcherArguments; \
@end
#define _EXPMatcherImplementationBegin(matcherName, matcherArguments) \
EXPFixCategoriesBug(EXPMatcher##matcherName##Matcher); \
@implementation EXPExpect (matcherName##Matcher) \
@dynamic matcherName;\
- (void(^) matcherArguments) matcherName { \
EXPBlockDefinedMatcher *matcher = [[EXPBlockDefinedMatcher alloc] init]; \
[[[NSThread currentThread] threadDictionary] setObject:matcher forKey:@"EXP_currentMatcher"]; \
__block id actual = self.actual; \
__block void (^prerequisite)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_prerequisite(block); }; \
__block void (^match)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_match(block); }; \
__block void (^failureMessageForTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForTo(block); }; \
__block void (^failureMessageForNotTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForNotTo(block); }; \
prerequisite(nil); match(nil); failureMessageForTo(nil); failureMessageForNotTo(nil); \
void (^matcherBlock) matcherArguments = [^ matcherArguments { \
{
#define _EXPMatcherImplementationEnd \
} \
[self applyMatcher:matcher to:&actual]; \
} copy]; \
_EXP_release(matcher); \
return _EXP_autorelease(matcherBlock); \
} \
@end
#define _EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) \
EXPFixCategoriesBug(EXPMatcher##newMatcherName##Matcher); \
@implementation EXPExpect (newMatcherName##Matcher) \
@dynamic newMatcherName;\
- (void(^) matcherArguments) newMatcherName { \
return [self oldMatcherName]; \
}\
@end
#ifdef __cplusplus
}
#endif
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* ALSA driver for Echoaudio soundcards.
* Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it>
*/
#define ECHOGALS_FAMILY
#define ECHOCARD_DARLA24
#define ECHOCARD_NAME "Darla24"
#define ECHOCARD_HAS_MONITOR
#define ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
#define ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
#define ECHOCARD_HAS_EXTERNAL_CLOCK
#define ECHOCARD_HAS_SUPER_INTERLEAVE
/* Pipe indexes */
#define PX_ANALOG_OUT 0 /* 8 */
#define PX_DIGITAL_OUT 8 /* 0 */
#define PX_ANALOG_IN 8 /* 2 */
#define PX_DIGITAL_IN 10 /* 0 */
#define PX_NUM 10
/* Bus indexes */
#define BX_ANALOG_OUT 0 /* 8 */
#define BX_DIGITAL_OUT 8 /* 0 */
#define BX_ANALOG_IN 8 /* 2 */
#define BX_DIGITAL_IN 10 /* 0 */
#define BX_NUM 10
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/firmware.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/tlv.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/asoundef.h>
#include <sound/initval.h>
#include <linux/atomic.h>
#include "echoaudio.h"
MODULE_FIRMWARE("ea/darla24_dsp.fw");
#define FW_DARLA24_DSP 0
static const struct firmware card_fw[] = {
{0, "darla24_dsp.fw"}
};
static const struct pci_device_id snd_echo_ids[] = {
{0x1057, 0x1801, 0xECC0, 0x0040, 0, 0, 0}, /* DSP 56301 Darla24 rev.0 */
{0x1057, 0x1801, 0xECC0, 0x0041, 0, 0, 0}, /* DSP 56301 Darla24 rev.1 */
{0,}
};
static const struct snd_pcm_hardware pcm_hardware_skel = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_SYNC_START,
.formats = SNDRV_PCM_FMTBIT_U8 |
SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S32_BE,
.rates = SNDRV_PCM_RATE_8000_48000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000,
.rate_min = 8000,
.rate_max = 96000,
.channels_min = 1,
.channels_max = 8,
.buffer_bytes_max = 262144,
.period_bytes_min = 32,
.period_bytes_max = 131072,
.periods_min = 2,
.periods_max = 220,
/* One page (4k) contains 512 instructions. I don't know if the hw
supports lists longer than this. In this case periods_max=220 is a
safe limit to make sure the list never exceeds 512 instructions. */
};
#include "darla24_dsp.c"
#include "echoaudio_dsp.c"
#include "echoaudio.c"
|
/*
* Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by 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.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#ifndef __SYS_GLOBAL_H__
#define __SYS_GLOBAL_H__
typedef struct sAniSirSys
{
tANI_U32 abort; /* system is aborting and will be unloaded, only MMH thread is running */
tANI_U32 gSysFrameCount[4][16];
tANI_U32 gSysBbtReceived;
tANI_U32 gSysBbtPostedToLim;
tANI_U32 gSysBbtPostedToSch;
tANI_U32 gSysBbtPostedToPmm;
tANI_U32 gSysBbtPostedToHal;
tANI_U32 gSysBbtDropped;
tANI_U32 gSysBbtNonLearnFrameInv;
tANI_U32 gSysBbtLearnFrameInv;
tANI_U32 gSysBbtCrcFail;
tANI_U32 gSysBbtDuplicates;
tANI_U32 gSysReleaseCount;
tANI_U32 probeError, probeBadSsid, probeIgnore, probeRespond;
tANI_U32 gSysEnableLearnMode;
tANI_U32 gSysEnableScanMode;
tANI_U32 gSysEnableLinkMonitorMode;
} tAniSirSys, *tpAniSirSys;
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef LINUX_DECOMPRESS_INFLATE_H
#define LINUX_DECOMPRESS_INFLATE_H
int gunzip(unsigned char *inbuf, long len,
long (*fill)(void*, unsigned long),
long (*flush)(void*, unsigned long),
unsigned char *output,
long *pos,
void(*error_fn)(char *x));
#endif
|
#ifndef _ASM_X86_PAGE_32_DEFS_H
#define _ASM_X86_PAGE_32_DEFS_H
#include <linux/const.h>
/*
* This handles the memory map.
*
* A __PAGE_OFFSET of 0xC0000000 means that the kernel has
* a virtual address space of one gigabyte, which limits the
* amount of physical memory you can use to about 950MB.
*
* If you want more physical memory than this then see the CONFIG_HIGHMEM4G
* and CONFIG_HIGHMEM64G options in the kernel configuration.
*/
#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
#define __START_KERNEL_map __PAGE_OFFSET
#define THREAD_SIZE_ORDER 1
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
#define STACKFAULT_STACK 0
#define DOUBLEFAULT_STACK 1
#define NMI_STACK 0
#define DEBUG_STACK 0
#define MCE_STACK 0
#define N_EXCEPTION_STACKS 1
#ifdef CONFIG_X86_PAE
/* 44=32+12, the limit we can fit into an unsigned long pfn */
#define __PHYSICAL_MASK_SHIFT 44
#define __VIRTUAL_MASK_SHIFT 32
#else /* !CONFIG_X86_PAE */
#define __PHYSICAL_MASK_SHIFT 32
#define __VIRTUAL_MASK_SHIFT 32
#endif /* CONFIG_X86_PAE */
/*
* Kernel image size is limited to 512 MB (see in arch/x86/kernel/head_32.S)
*/
#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)
#ifndef __ASSEMBLY__
/*
* This much address space is reserved for vmalloc() and iomap()
* as well as fixmap mappings.
*/
extern unsigned int __VMALLOC_RESERVE;
extern int sysctl_legacy_va_layout;
extern void find_low_pfn_range(void);
extern void setup_bootmem_allocator(void);
#endif /* !__ASSEMBLY__ */
#endif /* _ASM_X86_PAGE_32_DEFS_H */
|
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018 Facebook
#include <string.h>
#include <linux/stddef.h>
#include <linux/bpf.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <sys/socket.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_endian.h>
#define SRC_REWRITE_IP6_0 0
#define SRC_REWRITE_IP6_1 0
#define SRC_REWRITE_IP6_2 0
#define SRC_REWRITE_IP6_3 6
#define DST_REWRITE_IP6_0 0
#define DST_REWRITE_IP6_1 0
#define DST_REWRITE_IP6_2 0
#define DST_REWRITE_IP6_3 1
#define DST_REWRITE_PORT6 6666
SEC("cgroup/connect6")
int connect_v6_prog(struct bpf_sock_addr *ctx)
{
struct bpf_sock_tuple tuple = {};
struct sockaddr_in6 sa;
struct bpf_sock *sk;
/* Verify that new destination is available. */
memset(&tuple.ipv6.saddr, 0, sizeof(tuple.ipv6.saddr));
memset(&tuple.ipv6.sport, 0, sizeof(tuple.ipv6.sport));
tuple.ipv6.daddr[0] = bpf_htonl(DST_REWRITE_IP6_0);
tuple.ipv6.daddr[1] = bpf_htonl(DST_REWRITE_IP6_1);
tuple.ipv6.daddr[2] = bpf_htonl(DST_REWRITE_IP6_2);
tuple.ipv6.daddr[3] = bpf_htonl(DST_REWRITE_IP6_3);
tuple.ipv6.dport = bpf_htons(DST_REWRITE_PORT6);
if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM)
return 0;
else if (ctx->type == SOCK_STREAM)
sk = bpf_sk_lookup_tcp(ctx, &tuple, sizeof(tuple.ipv6),
BPF_F_CURRENT_NETNS, 0);
else
sk = bpf_sk_lookup_udp(ctx, &tuple, sizeof(tuple.ipv6),
BPF_F_CURRENT_NETNS, 0);
if (!sk)
return 0;
if (sk->src_ip6[0] != tuple.ipv6.daddr[0] ||
sk->src_ip6[1] != tuple.ipv6.daddr[1] ||
sk->src_ip6[2] != tuple.ipv6.daddr[2] ||
sk->src_ip6[3] != tuple.ipv6.daddr[3] ||
sk->src_port != DST_REWRITE_PORT6) {
bpf_sk_release(sk);
return 0;
}
bpf_sk_release(sk);
/* Rewrite destination. */
ctx->user_ip6[0] = bpf_htonl(DST_REWRITE_IP6_0);
ctx->user_ip6[1] = bpf_htonl(DST_REWRITE_IP6_1);
ctx->user_ip6[2] = bpf_htonl(DST_REWRITE_IP6_2);
ctx->user_ip6[3] = bpf_htonl(DST_REWRITE_IP6_3);
ctx->user_port = bpf_htons(DST_REWRITE_PORT6);
/* Rewrite source. */
memset(&sa, 0, sizeof(sa));
sa.sin6_family = AF_INET6;
sa.sin6_port = bpf_htons(0);
sa.sin6_addr.s6_addr32[0] = bpf_htonl(SRC_REWRITE_IP6_0);
sa.sin6_addr.s6_addr32[1] = bpf_htonl(SRC_REWRITE_IP6_1);
sa.sin6_addr.s6_addr32[2] = bpf_htonl(SRC_REWRITE_IP6_2);
sa.sin6_addr.s6_addr32[3] = bpf_htonl(SRC_REWRITE_IP6_3);
if (bpf_bind(ctx, (struct sockaddr *)&sa, sizeof(sa)) != 0)
return 0;
return 1;
}
char _license[] SEC("license") = "GPL";
|
/**********************************************************************
* Copyright (c) 2015 Andrew Poelstra *
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_
#define _SECP256K1_SCALAR_REPR_IMPL_H_
#include "scalar.h"
#include <string.h>
SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) {
return !(*a & 1);
}
SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { *r = 0; }
SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { *r = v; }
SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
if (offset < 32)
return ((*a >> offset) & ((((uint32_t)1) << count) - 1));
else
return 0;
}
SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
return secp256k1_scalar_get_bits(a, offset, count);
}
SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { return *a >= EXHAUSTIVE_TEST_ORDER; }
static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
*r = (*a + *b) % EXHAUSTIVE_TEST_ORDER;
return *r < *b;
}
static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) {
if (flag && bit < 32)
*r += (1 << bit);
#ifdef VERIFY
VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0);
#endif
}
static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) {
const int base = 0x100 % EXHAUSTIVE_TEST_ORDER;
int i;
*r = 0;
for (i = 0; i < 32; i++) {
*r = ((*r * base) + b32[i]) % EXHAUSTIVE_TEST_ORDER;
}
/* just deny overflow, it basically always happens */
if (overflow) *overflow = 0;
}
static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) {
memset(bin, 0, 32);
bin[28] = *a >> 24; bin[29] = *a >> 16; bin[30] = *a >> 8; bin[31] = *a;
}
SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) {
return *a == 0;
}
static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) {
if (*a == 0) {
*r = 0;
} else {
*r = EXHAUSTIVE_TEST_ORDER - *a;
}
}
SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) {
return *a == 1;
}
static int secp256k1_scalar_is_high(const secp256k1_scalar *a) {
return *a > EXHAUSTIVE_TEST_ORDER / 2;
}
static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) {
if (flag) secp256k1_scalar_negate(r, r);
return flag ? -1 : 1;
}
static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
*r = (*a * *b) % EXHAUSTIVE_TEST_ORDER;
}
static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) {
int ret;
VERIFY_CHECK(n > 0);
VERIFY_CHECK(n < 16);
ret = *r & ((1 << n) - 1);
*r >>= n;
return ret;
}
static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) {
*r = (*a * *a) % EXHAUSTIVE_TEST_ORDER;
}
static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) {
*r1 = *a;
*r2 = 0;
}
SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) {
return *a == *b;
}
#endif
|
//------------------------------------------------------------------------------
// <copyright file="a_drv.h" company="Atheros">
// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
//
//
// 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.
//
//
//------------------------------------------------------------------------------
//==============================================================================
// This file contains the definitions of the basic atheros data types.
// It is used to map the data types in atheros files to a platform specific
// type.
//
// Author(s): ="Atheros"
//==============================================================================
#ifndef _A_DRV_H_
#define _A_DRV_H_
#include "../os/linux/include/athdrv_linux.h"
#endif /* _ADRV_H_ */
|
/* $OpenBSD: sys_machdep.c,v 1.4 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: sys_machdep.c,v 1.1 1996/09/30 16:34:56 ws Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
* Copyright (C) 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
int
sys_sysarch(struct proc *p, void *v, register_t *retval)
{
/*
* Currently no special system calls
*/
return EINVAL;
}
|
//
// A<GearMenuController.h
//
// Created by Mark Lilback on 2/8/11.
// Copyright 2011 Agile Monks, LLC. All rights reserved.
//
/* menuObjects can be:
1) a string. in that case, menuObjectTitleKey should be nil.
2) a custom object. in that case, the menu will use menuObjectTitleKey on the object
to get a string value to display.
3) an instance of AMGearMenuItem. In that case, the data in that object will be used.
In this case, a delegate is not required and the delegate method will NOT be called
even if a delegate is set. The argument to the action will be the menu item.
*/
@class AMGearMenuController;
@protocol AMGearMenuDelegate <NSObject>
@optional
-(void)gearMenuSelected:(id)selectedObject;
-(void)gearMenu:(AMGearMenuController*)gearController customizeCell:(UITableViewCell*)cell;
@end
@interface AMGearMenuItem : NSObject
+(AMGearMenuItem*)gearMenuItem:(NSString*)inTitle target:(id)inTarget action:(SEL)inAction
userInfo:(id)userInfo;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) id target;
@property (nonatomic, assign) SEL action;
@property (nonatomic, retain) id userInfo;
@end
@interface AMGearMenuController : UITableViewController
@property (nonatomic, retain) NSArray *menuObjects;
@property (nonatomic, copy) NSString *menuObjectTitleKey;
@property (nonatomic, assign) id<AMGearMenuDelegate> delegate;
@property (nonatomic, retain) id selectedMenuObject;
@end
|
#include <stdlib.h>
#undef llabs
long long
llabs(long long n)
{
return (n < 0) ? -n : n;
}
|
/* Copyright (c) 2011, Nate Stedman <natesm@gmail.com>
*
* 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. */
@interface NSString (FunSize)
/** Returns a URL encoded version of the string. */
-(NSString*)stringByURLEncoding;
#if MAC_ONLY
/** Measures the size of the string with size constraints and attributes.
*
* @param size The size that the string should fit into when drawn.
* @param attributes The attributes that the string should be measured with. */
-(NSSize)sizeWithSize:(NSSize)size attributes:(NSDictionary*)attributes;
#endif
@end
|
#ifndef __ITERATE_H_
# define __ITERATE_H_
# include "rdfl_types.h"
int _iterate_chunk(t_rdfl *, int (*)(void *, size_t, void *), void *, e_bacc_options opt);
int _iterate_extract(t_rdfl *, void **, ssize_t, e_bacc_options);
#endif /* !__ITERATE_H_ */
|
//
// Poco.h
//
// $Id: //poco/1.4/Foundation/include/Poco/Poco.h#1 $
//
// Library: Foundation
// Package: Core
// Module: Foundation
//
// Basic definitions for the POCO libraries.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Foundation_Poco_INCLUDED
#define Foundation_Poco_INCLUDED
#include "Foundation.h"
#endif // Foundation_Poco_INCLUDED
|
/**
*
* \file
*
* \brief This module contains debug APIs declarations.
*
* Copyright (c) 2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
#ifndef _NM_DEBUG_H_
#define _NM_DEBUG_H_
#include "bsp/include/nm_bsp.h"
#include "bsp/include/nm_bsp_internal.h"
/**@defgroup DebugDefines DebugDefines
* @ingroup WlanDefines
*/
/**@{*/
#define M2M_LOG_NONE 0
#define M2M_LOG_ERROR 1
#define M2M_LOG_INFO 2
#define M2M_LOG_REQ 3
#define M2M_LOG_DBG 4
#if (defined __APP_APS3_CORTUS__)
#define M2M_LOG_LEVEL M2M_LOG_ERROR
#else
#define M2M_LOG_LEVEL M2M_LOG_REQ
#endif
/**/
#if !((defined __MSP430FR5739)||(defined __MCF964548__))
#define M2M_ERR(...)
#define M2M_INFO(...)
#define M2M_REQ(...)
#define M2M_DBG(...)
#if (CONF_WINC_DEBUG == 1)
#define M2M_PRINT(...) do{CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
#if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
#undef M2M_ERR
#define M2M_ERR(...) do{CONF_WINC_PRINTF("(APP)(ERR)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
#if (M2M_LOG_LEVEL >= M2M_LOG_INFO)
#undef M2M_INFO
#define M2M_INFO(...) do{CONF_WINC_PRINTF("(APP)(INFO)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
#if (M2M_LOG_LEVEL >= M2M_LOG_REQ)
#undef M2M_REQ
#define M2M_REQ(...) do{CONF_WINC_PRINTF("(APP)(R)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
#if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
#undef M2M_DBG
#define M2M_DBG(...) do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
#endif
#endif
#endif
#endif
#else
#define M2M_ERR(...)
#define M2M_DBG(...)
#define M2M_REQ(...)
#define M2M_INFO(...)
#define M2M_PRINT(...)
#endif
#else
#if (!defined __MCF964548__)||(!defined __SAMD21J18A__)
static void M2M_ERR(const char *_format, ...) //__attribute__ ((__format__ (M2M_ERR, 1, 2)))
{
}
static void M2M_DBG(const char *_format, ...) //__attribute__ ((__format__ (M2M_DBG, 1, 2)))
{
}
static void M2M_REQ(const char *_format, ...) //__attribute__ ((__format__ (M2M_DBG, 1, 2)))
{
}
static void M2M_INFO(const char *_format, ...) // __attribute__ ((__format__ (M2M_INFO, 1, 2)))
{
}
static void M2M_PRINT(const char *_format, ...) // __attribute__ ((__format__ (M2M_INFO, 1, 2)))
{
}
static void CONF_WINC_PRINTF(const char *_format, ...)
{
}
#endif
#endif
/**@}*/
#endif /* _NM_DEBUG_H_ */ |
// Copyright (c) 2015 fjz13. 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 "MedusaCorePreDeclares.h"
#ifdef MEDUSA_SQL
#include "SqlCommand.h"
#include "Core/Database/SqlDefines.h"
MEDUSA_BEGIN;
class SqlPrepareCommand :public SqlCommand
{
public:
SqlPrepareCommand(SqlConnection* connection = nullptr, const StringRef& name = StringRef::Empty, const StringRef& statement = StringRef::Empty, bool checkStatementChanged = false);
~SqlPrepareCommand(void);
virtual bool OnExecute()override;
std::future<Share<SqlPreparedStatement>> Future() { return mResult.get_future(); }
protected:
HeapString mName;
HeapString mStatement;
bool mCheckStatementChanged = false;
std::promise<Share<SqlPreparedStatement>> mResult;
};
MEDUSA_END;
#endif |
#ifndef RAND_H
#define RAND_H
#include "range.h"
#include <random>
class Rand
{
Rand();
public:
static bool boolean();
static bool trueWithChance(double chance);
// [min; max], inclusive
static int intNumber(range<int> r);
static int intNumber(int min, int max);
static double doubleNumber(double min = 0, double max = 1);
static double normalNumber(double mean, double stddev);
private:
static std::random_device::result_type getSeed();
static std::mt19937 randomNumberGenerator;
};
#endif // RAND_H
|
//
// KVOUITableViewCell.h
// Reply
//
// Created by Andrew Podkovyrin on 24/07/2017.
// Copyright © 2017 MachineLearningWorks. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SuperKVOProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface KVOUITableViewCell : UITableViewCell <SuperKVO>
@end
NS_ASSUME_NONNULL_END
|
#ifndef ALPHA_TIMER_H
#define ALPHA_TIMER_H
#include <types.h>
#include <rtc.h>
#include <ports.h>
#include <isr.h>
#include <util.h>
#include <statusbar.h>
#define INPUT_TIMER_HZ 1193180
#define timer_base (0x100000)
#define TICK_TIME 1000 //hz
struct TimerBuffer {
int timer_ticks;
};
extern struct time_t hw_time;
typedef unsigned long milis_t;
#define RTC_TO_SEC(t) \
((t) & 0xFF)
#define RTC_TO_MIN(t) \
((t) >> 8)
#define RTC_TO_HOUR(t) \
((t) >> 16)
void init_timer();
void timer_phase(int hz);
static void timer_callback(registers_t regs);
void timer_wait(int ticks);
void add_time(struct time_t *t1, struct time_t *t2);
inline static struct time_t *update_clock_hw(struct time_t *t);
#endif
|
#ifndef CML_VECTOR_H
#define CML_VECTOR_H
#define _CML_COMMON_H_
#include <cml/_common/default.h>
#include <cml/_common/inline.h>
#include <cml/_common/machine.h>
#undef _CML_COMMON_H_
#include <cml/vector/minmax.h>
#endif
|
#import <UIKit/UIKit.h>
@interface UIFont (AveriaGruesaLibre)
+ (instancetype)averiaGruesaLibreRegularFontOfSize:(CGFloat)size;
@end
|
//
// ofxiSocial.h
//
// Created by ISHII 2bit on 2013/12/02.
//
//
#ifndef __ofxiSocial__
#define __ofxiSocial__
#import <Social/Social.h>
#include "ofMain.h"
#import "ofxiOS.h"
#import "ofxiOSExtras.h"
#import "ofxObjective-C++Utility.h"
typedef enum {
ofxiSocialServiceTypeTwitter,
ofxiSocialServiceTypeFacebook
} ofxiSocialServiceType;
class ofxiSocial {
public:
static void share(ofxiSocialServiceType type, string text, ofImage &image) {
ofxiSocial::share(type, text, "", image);
}
static void share(ofxiSocialServiceType type, string text, string url, ofImage &image) {
ofxiSocial::share(type, text, url, [UIImage imageWithCGImage:convert(image)]);
}
static void share(ofxiSocialServiceType type, string text, string url = "") {
ofxiSocial::share(type, text, url, nil);
}
private:
static void share(ofxiSocialServiceType type, string text, string url, UIImage *image) {
NSString *serviceType = nil;
switch(type) {
case ofxiSocialServiceTypeTwitter:
serviceType = SLServiceTypeTwitter;
break;
case ofxiSocialServiceTypeFacebook:
serviceType = SLServiceTypeFacebook;
break;
default:
break;
}
if(serviceType == nil) {
ofLogError() << "Service Type is invalid.";
return;
}
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:serviceType];
[controller setInitialText:convert(text)];
if(url != "") [controller addURL:[NSURL URLWithString:convert(url)]];
if(image) [controller addImage:image];
[controller setCompletionHandler:^(SLComposeViewControllerResult result) {
}];
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:controller
animated:YES
completion:nil];
}
};
#endif /* defined(__ofxiSocial__) */
|
//
// YYTAdDefine.h
// YYTFramework
//
// Created by yyt on 2020/4/30.
// Copyright © 2020 yyt. All rights reserved.
//
#ifndef YYTAdDefine_h
#define YYTAdDefine_h
typedef enum{
YYTAdTypeGoogle = 0,
YYTAdTypeBaidu, //1
YYTAdTypeTencent, //2
YYTAdTypeByteDance //3
} YYTAdType;
#ifdef DEBUG
#define YYTFormat(format) [NSString stringWithFormat:@"YYTAD: %@", format]
#define YYTLog(format, ...) NSLog(YYTFormat(format), ##__VA_ARGS__)
#else
#define YYTLog(format, ...)
#endif
#define isIphoneX_ ({\
int tmp = 0;\
if (@available(iOS 11.0, *)) {\
if ([UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom>1) {\
tmp = 1;\
}else{\
tmp = 0;\
}\
}else{\
tmp = 0;\
}\
tmp;\
})
//Notification
#define kADBannerHeightChangedNotification @"kADBannerHeightChangedNotification"
#define kLoadingPageAdWillFinishNotification @"kLoadingPageAdWillFinishNotification"
#define kLoadingPageAdDidFinishNotification @"kLoadingPageAdDidFinishNotification"
#endif /* YYTAdDefine_h */
|
#ifndef ALL_GRADES_H_
#define ALL_GRADES_H_
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <cstdlib>
#include <sstream>
#include <utility>
#include "Grade.h"
using namespace std;
class AllGrades {
private:
string _data_dir;
vector<Grade> _grades;
vector<pair<int, string> > GetCourseName(int cid);
pair<int, string> GetName(int sid, string fname);
pair<int, string> GetTeacherName(int pid);
public:
AllGrades(string data_dir);
virtual ~AllGrades();
void DisplayGrades(int student_id);
void SetGrade(int student_id, int teacher_id, int course_id, int grade);
void SaveGrades();
};
#endif /* GRADE_H_ */
|
#ifndef SERVERCONSOLE_H
#define SERVERCONSOLE_H
#include <QDebug>
#include <QCommandLineParser>
#include <QObject>
#include <QtNetwork>
#include "servermanager.h"
#include "clientconnection.h"
class ArmaTcpServer : public QTcpServer
{
Q_OBJECT
public:
explicit ArmaTcpServer(ServerManager *servermanager, QObject *parent) : QTcpServer(parent), mServerManager(servermanager)
{}
QList<ClientConnection*> mConnections;
public slots:
void deleteConnection(ClientConnection *c) {mConnections.removeOne(c); delete c;}
protected:
void incomingConnection(qintptr handle) override {ClientConnection *c = new ClientConnection(handle, mServerManager, true);
mConnections.append(c);
connect(c, SIGNAL(done(ClientConnection*)), this, SLOT(deleteConnection(ClientConnection*)), Qt::QueuedConnection);
}
ServerManager *mServerManager;
};
class ServerConsole : public QObject
{
friend class UTest;
Q_OBJECT
public:
explicit ServerConsole(QCommandLineParser *arguments, QObject *parent = 0);
signals:
public slots:
protected slots:
void init();
private:
ServerManager *mServerManager;
ArmaTcpServer *mTcpServer;
int mPort;
QCommandLineParser *mArguments;
};
#endif // SERVERCONSOLE_H
|
#include <stdio.h>
#include <stdlib.h>
#include "hashtable.h"
#define BUCKET_NB 20
int main() {
LinkedList* buckets[BUCKET_NB];
for(int i = 0 ; i< BUCKET_NB ; i++)
buckets[i] = NULL;
HTable htable = {
.TABLE_SIZE = BUCKET_NB,
.table = buckets,
};
char * fname[20] = {
"bertrand"
};
char * name[20] = {
"chazot"
};
for(int i = 0 ; i < 1 ; i++) {
ht_insert(&htable, name[i], fname[i]);
ht_insert(&htable, fname[i], name[i]);
}
ht_print(&htable);
/* for(int i = 0 ; i < 8 ; i++) { */
/* printf("\n %s %s \n",name[i], (const char*)ht_find(&htable, name[i])); */
/* printf("\n %s %s \n",fname[i], (const char*)ht_find(&htable, fname[i])); */
/* } */
printf("\ndone\n");
return 0;
}
|
#ifndef GAME_H
#define GAME_H
#include <ctime>
#include "Fighter.h"
#include <iostream>
using namespace std;
class Game {
public:
void init();
void loop();
private:
Fighter mPlayer;
Fighter mComputer;
bool playerTurn, countersOn;
void printMove(char highMidLow, bool isPlayer, bool isAttack);
char highMidOrLow();
bool randBool();
char getPlayerMove(bool attack);
void outcome(char pMove, char cMove, bool isPlayerMove, bool attemptCounter = false);
char makeCharSmall(char character);
};
#endif
|
//
// ListViewController.h
// 108tian
//
// Created by SUN on 15-7-12.
// Copyright (c) 2015年 www.sun.com. All rights reserved.
//
#import "RootViewController.h"
@interface ListViewController : RootViewController<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
@end
|
/* debug.h -- debug utilities
*
* Copyright (C) 2011--2012 Olaf Bergmann <bergmann@tzi.org>
*
* 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 _DTLS_DEBUG_H_
#define _DTLS_DEBUG_H_
#include <stdlib.h>
#include "dtls_config.h"
#include "global.h"
#include "session.h"
#ifdef WITH_CONTIKI
# ifndef DEBUG
# define DEBUG DEBUG_PRINT
# endif /* DEBUG */
#include "net/ip/uip-debug.h"
#ifdef CONTIKI_TARGET_MBXXX
extern char __Stack_Init, _estack;
static inline void check_stack() {
const char *p = &__Stack_Init;
while (p < &_estack && *p == 0x38) {
p++;
}
PRINTF("Stack: %d bytes used (%d free)\n", &_estack - p, p - &__Stack_Init);
}
#else /* CONTIKI_TARGET_MBXXX */
static inline void check_stack() {
}
#endif /* CONTIKI_TARGET_MBXXX */
#else /* WITH_CONTKI */
#define PRINTF(...)
static inline void check_stack() {
}
#endif
struct __session_t;
/** Pre-defined log levels akin to what is used in \b syslog. */
typedef enum { DTLS_LOG_EMERG=0, DTLS_LOG_ALERT, DTLS_LOG_CRIT, DTLS_LOG_WARN,
DTLS_LOG_NOTICE, DTLS_LOG_INFO, DTLS_LOG_DEBUG
} log_t;
/** Returns a zero-terminated string with the name of this library. */
const char *dtls_package_name();
/** Returns a zero-terminated string with the library version. */
const char *dtls_package_version();
#ifndef NDEBUG
/** Returns the current log level. */
log_t dtls_get_log_level();
/** Sets the log level to the specified value. */
void dtls_set_log_level(log_t level);
/**
* Writes the given text to \c stdout. The text is output only when \p
* level is below or equal to the log level that set by
* set_log_level(). */
#ifdef HAVE_VPRINTF
void dsrv_log(log_t level, char *format, ...);
#else
#define dsrv_log(level, format, ...) PRINTF(format, ##__VA_ARGS__)
#endif
/** dumps packets in usual hexdump format */
void hexdump(const unsigned char *packet, int length);
/** dump as narrow string of hex digits */
void dump(unsigned char *buf, size_t len);
void dtls_dsrv_hexdump_log(log_t level, const char *name, const unsigned char *buf, size_t length, int extend);
void dtls_dsrv_log_addr(log_t level, const char *name, const session_t *addr);
#else /* NDEBUG */
static inline log_t dtls_get_log_level()
{
return DTLS_LOG_EMERG;
}
static inline void dtls_set_log_level(log_t level)
{}
static inline void dsrv_log(log_t level, char *format, ...)
{}
static inline void hexdump(const unsigned char *packet, int length)
{}
static inline void dump(unsigned char *buf, size_t len)
{}
static inline void
dtls_dsrv_hexdump_log(log_t level, const char *name, const unsigned char *buf, size_t length, int extend)
{}
static inline void
dtls_dsrv_log_addr(log_t level, const char *name, const session_t *addr)
{}
#endif /* NDEBUG */
/* A set of convenience macros for common log levels. */
#define dtls_emerg(...) dsrv_log(DTLS_LOG_EMERG, __VA_ARGS__)
#define dtls_alert(...) dsrv_log(DTLS_LOG_ALERT, __VA_ARGS__)
#define dtls_crit(...) dsrv_log(DTLS_LOG_CRIT, __VA_ARGS__)
#define dtls_warn(...) dsrv_log(DTLS_LOG_WARN, __VA_ARGS__)
#define dtls_notice(...) dsrv_log(DTLS_LOG_NOTICE, __VA_ARGS__)
#define dtls_info(...) dsrv_log(DTLS_LOG_INFO, __VA_ARGS__)
#define dtls_debug(...) dsrv_log(DTLS_LOG_DEBUG, __VA_ARGS__)
#define dtls_debug_hexdump(name, buf, length) dtls_dsrv_hexdump_log(DTLS_LOG_DEBUG, name, buf, length, 1)
#define dtls_debug_dump(name, buf, length) dtls_dsrv_hexdump_log(DTLS_LOG_DEBUG, name, buf, length, 0)
#endif /* _DTLS_DEBUG_H_ */
|
#pragma once
#include "host_array.h"
#include "gpu.h"
namespace fastgm {
/**
* Represents an array stored on the device. Memory has to manually deallocated
* by calling the release() function.
*/
template <class T>
class device_array {
public:
/**
* Construct an empty array stored in device memory
*/
__host__ device_array() : size_(0), v_(NULL) { }
/**
* Create a device array with a specific capacity
*
* @param size Capacity
*/
__host__ explicit device_array(int size, bool zeroed = false) : size_(size) {
v_ = device_malloc<T>(size);
if (zeroed) reset();
}
/**
* Create a device array with a specific capacity
* and an initial value
*
* @param size Capacity
* @param val The initial value to fill the array with
*/
__host__ device_array(int size, T val) : size_(size) {
// First allocate the array on the host and initialize all its
// elements to val
T *host = static_cast<T>(malloc(size * sizeof(T)));
for (int i = 0; i < size; i++) host[i] = val;
// Copy it over to device memory
v_ = device_malloc<T>(size);
device_memcpy(v_, host, size);
free(host);
}
/**
* Create a device array from a host array, transfering all the
* contents in the host array to device memory.
*
* @param other The host array to copy from
*/
__host__ device_array(const host_array<T> &other) : size_(other.size()) {
v_ = device_malloc<T>(other.size());
device_memcpy(v_, other.raw(), other.size());
}
/**
* Create a device array from another device array by pointing to
* the same memory. No new device memory is allocated.
*
* @param other The device array to copy from
*/
__host_device__ device_array(const device_array<T> &other) : v_(other.ptr()), size_(other.size()) { }
/**
* Create a device array from a raw device pointer and a specific length.
* No new device memory is allocated.
*
* @param ptr A pointer to the start of the array
* @param size The length of the array
*/
__host_device__ device_array(const device_ptr<T> &ptr, int size) : v_(ptr), size_(size) { }
/**
* Create a device array from a section of another device array.
* No new device memory is allocated.
*
* @param other The device array to copy from
* @param offset The start index of the subarray
* @param length The length of the subarray
*/
__host_device__ device_array(const device_array<T> &other, int offset, int length) :
v_(other.ptr().get() + offset), size_(length) { }
/**
* Reset all the elements of the array to 0
*/
__host__ void reset() {
if (v_.get())
CUDA_SAFE_CALL(cudaMemset(v_.get(), 0, size_ * sizeof(T)));
}
/**
* Transfer all the elements in the array back into host memory.
*
* @param dest The host array to store the data in
*/
__host__ host_array<T> to_host() const {
host_array<T> dest(size_);
device_memcpy(dest.raw(), v_, size_);
return dest;
}
/**
* Release the memory used by this array. This invalidates any other
* device arrays that point to the same memory.
*/
__host__ void release() {
device_free(v_);
}
/**
* Get a specific element from the array
* @param i The index of the element to get
*/
__device__ T &operator[] (const int i) { return v_.get()[i]; }
__device__ T &operator[] (const int i) const { return v_.get()[i]; }
/**
* Get the size of the array
*/
__host_device__ int size() const { return size_; }
/**
* Return the device pointer pointing to the start of the array
*/
__host_device__ device_ptr<T> ptr() const { return v_; }
private:
device_ptr<T> v_; // Device pointer to array
int size_;
};
}
|
/***********************************************************************************************//**
* \file graphics.h
* \brief Displays text on the LCD
***************************************************************************************************
* <b> (C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
***************************************************************************************************
* This file is licensed under the Silabs License Agreement. See the file
* "Silabs_License_Agreement.txt" for details. Before using this software for
* any purpose, you must agree to the terms of that agreement.
**************************************************************************************************/
#ifndef GRAPHICS_H
#define GRAPHICS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "joystick.h"
/***************************************************************************************************
Public Function Declarations
***************************************************************************************************/
/***********************************************************************************************//**
* \brief Initializes the graphics stack
* \param[in] header Header Text on display
**************************************************************************************************/
void graphInit(void);
void graphSetJoystickDirection(JoystickDirection direction);
void graphSetButtonState(uint8_t buttonNum, bool on);
#ifdef __cplusplus
}
#endif
#endif /* GRAHPHICS_H */
|
//
// ShareViewController.h
// Share Extension
//
// Created by Nealon Young on 12/22/14.
// Copyright (c) 2014 Nealon Young. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Social/Social.h>
@interface ShareViewController : UIViewController
@end
|
// Copyright (c) 2011-2016 The Cryptonote developers
// Copyright (c) 2014-2017 XDN-project developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include <cstddef>
#include <cstdint>
#include <cstddef>
namespace CryptoNote {
class ICryptoNoteProtocolObserver {
public:
virtual void peerCountUpdated(size_t count) {}
virtual void lastKnownBlockHeightUpdated(uint32_t height) {}
virtual void blockchainSynchronized(uint32_t topHeight) {}
};
} //namespace CryptoNote
|
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// OCHamcrest
#define COCOAPODS_POD_AVAILABLE_OCHamcrest
#define COCOAPODS_VERSION_MAJOR_OCHamcrest 3
#define COCOAPODS_VERSION_MINOR_OCHamcrest 0
#define COCOAPODS_VERSION_PATCH_OCHamcrest 0
// OCMockito
#define COCOAPODS_POD_AVAILABLE_OCMockito
#define COCOAPODS_VERSION_MAJOR_OCMockito 1
#define COCOAPODS_VERSION_MINOR_OCMockito 0
#define COCOAPODS_VERSION_PATCH_OCMockito 0
|
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#define MAX_COLOR 255
void error(lua_State *L, const char *msg){
printf("Error running in stack: %s\n",
lua_tostring(L, -1));
}
int get_field(lua_State *L, const char *key){
int result;
lua_pushstring(L, key);
lua_gettable(L, -2); // retrieve table[key]
if(!lua_isnumber(L, -1))
error(L, "invalid component in background color.");
result = (int)lua_tonumber(L, -1) * MAX_COLOR;
lua_pop(L, 1);
return result;
}
void set_field(lua_State *L, const char *index, int value){
lua_pushnumber(L, (double)value/MAX_COLOR);
lua_setfield(L, -2, index); // set value into table[key]
}
struct ColorTable{
char *name;
unsigned char red, green, blue;
} colortable[] = {
{ "WHITE", MAX_COLOR, MAX_COLOR, MAX_COLOR },
{ "BLACK", 0, 0, 0 },
{ "RED", MAX_COLOR, 0, 0 },
{ "GREEN", 0, MAX_COLOR, 0 },
{ "BLUE", 0, 0, MAX_COLOR },
{NULL, 0, 0, 0}
};
void set_color(lua_State *L, struct ColorTable *ct){
lua_newtable(L);
set_field(L, "r", ct->red);
set_field(L, "g", ct->green);
set_field(L, "b", ct->blue);
lua_setglobal(L, ct->name);
}
int main(int argc, const char* argv[]){
printf("loading lua.\n");
int x = 10, y = 22, result = 0;
lua_State *L = luaL_newstate();
luaL_openlibs(L); // 加载Lua库
if(luaL_loadfile(L, "../../../../LuaEmbeding/func.lua") != 0) // load lua file
return 0;
lua_pcall(L, 0, LUA_MULTRET, 0); //执行匿名函数,以编译源代码成二进制码
// 第一种方式
// lua_getglobal(L, "Func");
// lua_pushstring(L, "add");
// lua_gettable(L, -2); //定位到函数
//第二种方式
lua_getglobal(L, "Func");
lua_getfield(L, -1, "add"); //定位到函数
lua_pushnumber(L, x);
lua_pushnumber(L, y);
if(lua_pcall(L, 2, 1, 0) != 0) { // execute funciton
error(L, lua_tostring(L, -1));
return 0;
}
result = lua_tonumber(L, -1);
lua_pop(L, 1);
printf("Result: %d\n", result);
lua_getfield(L, -1, "x");
result = (int)lua_tonumber(L, -1);
printf("x is: %d\n", result);
lua_pop(L, 1);
lua_getfield(L, -1, "position");
if(lua_pcall(L, 0, 2, 0) != 0){
error(L, lua_tostring(L, -1));
return 0;
}
printf("position results: %d %d\n",
(int)lua_tonumber(L, -1), (int)lua_tonumber(L, -2));
lua_pop(L, 2);
set_color(L, &colortable[3]); // GREEN --> lua global
lua_getfield(L, -1, "printcolor");
if(lua_pcall(L, 0, 0, 0) != 0){
error(L, lua_tostring(L, -1));
return 0;
}
printf("now stack top is: %d\n", lua_gettop(L));
}
|
#ifndef MENUICON_H
#define MENUICON_H
#include "../../../Headers/headerscpp.h"
#include "../../../Headers/headersogl.h"
#include "../displayimage.h"
#include "../screenwriter.h"
#include "../tools.hpp"
#include "../input_struct.h"
#include "../../Loaders/properties.h"
//*****************************************//
// Icon Struct //
//*****************************************//
/*
Icons struct is used by the MenuIcons class
to hold data and functions pertaining to a
single icon. While the class itself holds
data and functions pertaining to the full
list of icons which are defined within the
class.
*/
struct Icon
{
bool state; // Icon State, true=active false=inactive
float x,y; // Icon Position
std::string iconimage;
float scale;
float lw,lh;
// The class assumes these images are the same size
ImageDisplay image[2];
// Constuctors
Icon () {}; // Default
Icon (float x,float y,std::string iconimage,float scale,float swidth,float sheight) // Overloaded constructor
{
this->x=x;
this->y=y;
this->state=false;
std::stringstream fn1,fn2; //File names for images
fn1 << iconimage << "_inact.png";
fn2 << iconimage << "_act.png";
// Setup icon images on GPU
float is=scale*0.1;
image[0].Init(fn1.str(),is,is,swidth,sheight);
image[1].Init(fn2.str(),is,is,swidth,sheight);
//Obtain Image Border
lw=image[0].GetImageHalfLength();
lh=image[0].GetImageHalfHeight();
};
void Cleanup()
{
image[0].Cleanup();
image[1].Cleanup();
};
//***************************************
// Check if the mouse is over the Icon
//***************************************
/*
Function returns true if the mouse
is over the icon given the xmp,ymp
mouse coordinates and lw,lh button
width and height.
*/
bool CheckIfOver(float xmp,float ymp)
{
// Check X over
bool xchk=false;
float xl=x-lw;
float xr=x+lw;
if (xmp>=xl && xmp<=xr)
{
xchk=true;
}
// Check y over
bool ychk=false;
float yb=y-lh;
float yt=y+lh;
if (ymp>=yb && ymp<=yt)
{
ychk=true;
}
// Check if both are true
bool Over=false;
if (xchk && ychk)
{
Over=true;
}
//std::cout << "xleft: " << xl << " xright: " << xr << " xmp: " << xmp << " yb: " << yb << " yt: " << yt << " ymp: " << ymp << std::endl;
// Return Result
return Over;
};
};
//*****************************************//
// Menu Icons Class //
//*****************************************//
class MenuIcons
{
// Variables
std::vector<Icon> icon;
float swidth,sheight;
int activeicon;
int hovericon;
keyhandler kh;
// Check if mouse is over button
void CheckMouseOver(float x,float y);
//Check if button is pressed -- set activeicon
void CheckPress(bool press,int IconID);
public:
// Initialize Button Class
void Init(Properties *props);
// Cleanup function for destruction
void Cleanup();
// Adds a new button to the class
void DefineNewIcon(float x, float y,std::string iconimage,float scale);
// Returns ButtonID if button was Pressed and Released while over a Button
void UpdateIconEvents(InputStruct &input);
// Draw all buttons to the screen
void DrawIcons(void);
// Function resets all buttons to default state
void ResetIconStates();
// Function gets the active icon ID.
int GetActiveIcon();
};
#endif
|
//
// ViewController.h
// 链式编程思想
//
// Created by LvYuan on 16/7/25.
// Copyright © 2016年 LvYuan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double MRTableViewCellCountScrollIndicatorVersionNumber;
FOUNDATION_EXPORT const unsigned char MRTableViewCellCountScrollIndicatorVersionString[];
|
#pragma once
#include "ComRefCntBase.h"
class AudioSessionEventsSink : public ComRefCntBase<IAudioSessionEvents>
{
public:
using StateCallback = std::function<void(AudioSessionState)>;
using DisconnectedCallback = std::function<void(AudioSessionDisconnectReason)>;
private:
StateCallback stateCallback;
DisconnectedCallback disconnectedCallback;
AudioSessionEventsSink(StateCallback const& stateCallback, DisconnectedCallback const& disconnectedCallback)
{
this->stateCallback = stateCallback;
this->disconnectedCallback = disconnectedCallback;
}
public:
static HRESULT STDMETHODCALLTYPE Create(IAudioSessionEvents** ppNewSink, StateCallback const& stateCallback,
DisconnectedCallback const& disconnectedCallback)
{
if (ppNewSink == nullptr) return E_POINTER;
*ppNewSink = static_cast<IAudioSessionEvents*>(new AudioSessionEventsSink(stateCallback, disconnectedCallback));
return S_OK;
}
// Inherited via IAudioSessionEvents
virtual HRESULT STDMETHODCALLTYPE OnDisplayNameChanged(LPCWSTR NewDisplayName, LPCGUID EventContext) override
{
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnIconPathChanged(LPCWSTR NewIconPath, LPCGUID EventContext) override
{
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnSimpleVolumeChanged(float NewVolume, BOOL NewMute, LPCGUID EventContext) override
{
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnChannelVolumeChanged(DWORD ChannelCount, float NewChannelVolumeArray[], DWORD ChangedChannel, LPCGUID EventContext) override
{
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnGroupingParamChanged(LPCGUID NewGroupingParam, LPCGUID EventContext) override
{
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnStateChanged(AudioSessionState NewState) override
{
this->stateCallback(NewState);
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnSessionDisconnected(AudioSessionDisconnectReason DisconnectReason) override
{
this->disconnectedCallback(DisconnectReason);
return S_OK;
}
};
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@class NSCache, NSSet;
@interface IDEClassIconProvider : NSObject
{
NSSet *_extensions;
NSCache *_cache;
}
+ (id)sharedInstance;
- (void).cxx_destruct;
- (id)_iconEntryForClassName:(id)arg1;
- (void)cachedImageForClassNameOrAnySuperclassName:(id)arg1 index:(id)arg2 completionHandler:(CDUnknownBlockType)arg3;
- (id)cachedImageForAnyClassName:(id)arg1;
- (id)_cachedIconEntryForAnyClassName:(id)arg1;
- (id)cachedImageForClassName:(id)arg1;
- (id)_cachedIconEntryForClassName:(id)arg1;
- (id)init;
@end
|
/*
* MIT License
*
* Copyright (c) 2016-2017 Abel Lucas <www.github.com/uael>
*
* 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 "nt/ex/nimpl.h"
i32_t nimpl_code;
FORCEINLINE ex_t
nimpl(char_t __const *fn)
{
EX_REGISTER(nimpl);
return ex_usr(ERRLVL_ERROR, nimpl_code,
"The function '%s' is not implemented.", fn
);
}
|
// Copyright 2021 Phyronnaz
#pragma once
#include "CoreMinimal.h"
#include "VoxelIntBox.h"
#include "VoxelInvokerSettings.generated.h"
USTRUCT(BlueprintType)
struct FVoxelInvokerSettings
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
bool bUseForLOD = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
int32 LODToSet = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
FVoxelIntBox LODBounds;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
bool bUseForCollisions = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
FVoxelIntBox CollisionsBounds;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
bool bUseForNavmesh = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Voxel")
FVoxelIntBox NavmeshBounds;
}; |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <IDEInterfaceBuilderKit/IBAutolayoutIssueResolvingViewController.h>
@class IBDocument, NSString;
@interface IBAutolayoutMissingConstraintsResolvingViewController : IBAutolayoutIssueResolvingViewController
{
id <IBCollection> _views;
IBDocument *_document;
NSString *_descriptionText;
}
@property(readonly, nonatomic) NSString *descriptionText; // @synthesize descriptionText=_descriptionText;
@property(readonly, nonatomic) IBDocument *document; // @synthesize document=_document;
@property(readonly, nonatomic) id <IBCollection> views; // @synthesize views=_views;
- (void).cxx_destruct;
- (void)confirmChanges;
- (void)primitiveInvalidate;
- (id)initWithViews:(id)arg1 document:(id)arg2;
@end
|
//
//Copyright (c) 2013, Hongbo Yang (hongbo@yang.me)
//
//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.
// Logic unit tests contain unit test code that is designed to be linked into an independent test executable.
// See Also: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html
#import <SenTestingKit/SenTestingKit.h>
@interface OAuthv1Teset : SenTestCase
@end
|
/*******************************************************************************
File: events.h
Author: Simon Ortego Parra
*******************************************************************************/
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <pthread.h>
#include "events.h"
#include "tasks.h"
#include "servers.h"
#include "ts_util.h"
extern int max_sched_priority;
events_history *create_events_history (int task_id)
{
events_history *new_history;
new_history = malloc(sizeof(events_history));
if (new_history != NULL) {
new_history->task_id = task_id;
new_history->first_event = NULL;
new_history->last_event = NULL;
}
return new_history;
}
void clear_history (events_history *history)
{
event *current, *next;
for(current = history->first_event; current != NULL; current = next) {
next = current->next_event;
free(current);
}
free(history);
}
void add_event (unsigned char type, unsigned char server_id, events_history *history)
{
int thread_priority;
pthread_attr_t thread_attr;
struct sched_param thread_sched;
struct timespec timestamp;
event *new_event;
// Retrieve the thread attributes and with those, the scheduling parameters: thread priority
if (pthread_getattr_np(pthread_self(), &thread_attr)) {
fprintf(stderr, "add_event(): failed to get the running thread attributes: ");
perror(NULL);
return;
} else if (pthread_attr_getschedparam(&thread_attr, &thread_sched)) {
fprintf(stderr, "add_event(): failed to get the running thread scheduling parameters (priority): ");
perror(NULL);
return;
}
// Save the current thread's priority
thread_priority = thread_sched.sched_priority;
// Set the thread's priority to the max level
if (pthread_setschedprio(pthread_self(), max_sched_priority)) {
fprintf(stderr, "add_event(): failed to elevate the thread's priority: ");
perror(NULL);
return;
}
clock_gettime(CLOCK_REALTIME, ×tamp);
new_event = malloc(sizeof(event));
if (new_event != NULL) {
/* if could allocate memory for the new event */
new_event->type = type;
new_event->server_id = server_id;
new_event->timestamp.tv_sec = timestamp.tv_sec;
new_event->timestamp.tv_nsec = timestamp.tv_nsec;
new_event->next_event = NULL;
if (history->last_event != NULL) {
/* if history is not empty */
history->last_event->next_event = new_event;
} else {
/* if history is empty */
history->first_event = new_event;
}
history->last_event = new_event;
} else {
fprintf(stderr, "add_event(): could not allocate memory for new event: ");
}
// Restore the original thread priority
if (pthread_setschedprio(pthread_self(), thread_priority)) {
fprintf(stderr, "add_event(): failed to restore the thread's priority: ");
perror(NULL);
return;
}
}
void print_event (event event, int task_id)
{
time_t millis[2];
tsConvertToMs (event.timestamp, &millis[0], &millis[1]);
switch(event.type) {
case TASK_BIRTH:
printf("[%5ld.%-7ld] T%d: is born\n", millis[0], millis[1], task_id);
break;
case TASK_ACTIVATION:
printf("[%5ld.%-7ld] T%d: activates\n", millis[0], millis[1], task_id);
break;
case TASK_BUSY:
printf("[%5ld.%-7ld] T%d: starts ", millis[0], millis[1], task_id);
switch(task_id) {
case T1:
printf("CS(%d)\n", T1_COMP_TIME);
break;
case T2:
printf("CS(%d)\n", T2_COMP_TIME);
break;
case T3:
printf("CS(%d)\n", T3_COMP_TIME);
}
break;
case TASK_FINISHED:
printf("[%5ld.%-7ld] T%d: finishes\n", millis[0], millis[1], task_id);
break;
case SERVER_ENTRY:
printf("[%5ld.%-7ld] T%d: enters ", millis[0], millis[1], task_id);
switch(event.server_id) {
case S11:
printf("S11(%d)\n", S11_COMP_TIME);
break;
case S12:
printf("S12(%d)\n", S12_COMP_TIME);
break;
case S21:
printf("S21(%d)\n", S21_COMP_TIME);
break;
case S22:
printf("S22(%d)\n", S22_COMP_TIME);
}
break;
case MUTEX_LOCK:
printf("[%5ld.%-7ld] T%d: tries to acquire lock ", millis[0], millis[1], task_id);
switch(event.server_id) {
case S11: case S12:
printf("S1\n");
break;
case S21: case S22:
printf("S2\n");
}
break;
case MUTEX_AQUIRE:
printf("[%5ld.%-7ld] T%d: acquires lock ", millis[0], millis[1], task_id);
switch(event.server_id) {
case S11: case S12:
printf("S1\n");
break;
case S21: case S22:
printf("S2\n");
}
break;
case MUTEX_RELEASE:
printf("[%5ld.%-7ld] T%d: releases lock ", millis[0], millis[1], task_id);
switch(event.server_id) {
case S11: case S12:
printf("S1\n");
break;
case S21: case S22:
printf("S2\n");
}
break;
case SERVER_EXIT:
printf("[%5ld.%-7ld] T%d: exits ", millis[0], millis[1], task_id);
switch(event.server_id) {
case S11:
printf("S11(%d)\n", S11_COMP_TIME);
break;
case S12:
printf("S12(%d)\n", S12_COMP_TIME);
break;
case S21:
printf("S21(%d)\n", S21_COMP_TIME);
break;
case S22:
printf("S22(%d)\n", S22_COMP_TIME);
}
break;
case TASK_DEATH:
printf("[%5ld.%-7ld] T%d: dies\n", millis[0], millis[1], task_id);
}
}
void print_events (events_history history)
{
event *current;
for(current = history.first_event; current != NULL; current = current->next_event) {
print_event(*current, history.task_id);
}
}
|
/*
* Search first occurence of a particular string in a given text [Finite Automata]
* Author: Progyan Bhattacharya <progyanb@acm.org>
* Repo: Design-And-Analysis-of-Algorithm [MIT LICENSE]
*/
#ifndef __Search_h
#define __Search_h
#ifndef __limits_h
#include <limits.h>
#endif
#ifndef __stdio_h
#include <stdio.h>
#endif
#ifndef __stdlib_h
#include <stdlib.h>
#endif
/**
* Proto type for Search function
*/
int Search(int, char*, int, char*);
#endif
|
#ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED
#include <glwindow.h>
#include <shader.h>
#include <SOIL.h>
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <iostream>
#include <chrono>
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::chrono::steady_clock;
#endif
int main(int argc, char* argv[]);
|
/**
* Project: CoCo
* Copyright (c) 2016, Scuola Superiore Sant'Anna
*
* Authors: Filippo Brizzi <fi.brizzi@sssup.it>, Emanuele Ruffaldi
*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
#pragma once
#include <unordered_map>
#include <unordered_set>
#include "tinyxml2/tinyxml2.h"
#include "coco/register.h"
#include "graph_spec.h"
namespace coco
{
class XmlParser
{
public:
bool parseFile(const std::string &config_file,
std::shared_ptr<TaskGraphSpec> app_spec, bool first = true);
bool createXML(const std::string &xml_file,
std::shared_ptr<TaskGraphSpec> app_spec);
private:
void parseLogConfig(tinyxml2::XMLElement *logconfig);
void parsePaths(tinyxml2::XMLElement *paths);
bool parseIncludes(tinyxml2::XMLElement *includes);
bool parseInclude(tinyxml2::XMLElement *include);
void parseComponents(tinyxml2::XMLElement *components,
TaskSpec * task_owner);
void parseComponent(tinyxml2::XMLElement *component,
TaskSpec * task_owner);
//std::string findLibrary(const std::string & library_name);
void parseAttribute(tinyxml2::XMLElement *attributes,
TaskSpec * task_spec);
void parseContents(tinyxml2::XMLElement *attributes,
TaskSpec * task_spec);
std::string checkResource(const std::string &resource, bool is_library = false);
void parseConnections(tinyxml2::XMLElement *connections);
void parseConnection(tinyxml2::XMLElement *connection);
void parseActivities(tinyxml2::XMLElement *activities);
void parseSchedule(tinyxml2::XMLElement *schedule_policy,
SchedulePolicySpec &policy, bool &is_parallel);
void parseActivity(tinyxml2::XMLElement *activity);
void parsePipeline(tinyxml2::XMLElement *pipeline);
void addPipelineConnections(std::unique_ptr<PipelineSpec> &pipe_spec);
void parseFarm(tinyxml2::XMLElement *farm);
tinyxml2::XMLElement* xmlNodeTxt(tinyxml2::XMLElement * parent,
const std::string &tag,
const std::string text);
void createComponent(std::shared_ptr<TaskSpec> task,
tinyxml2::XMLElement *components);
void createConnection(std::unique_ptr<ConnectionSpec> &connection_spec,
tinyxml2::XMLElement *connections);
void parseExtendComponent(std::string name, tinyxml2::XMLElement *component,
TaskSpec * task_owner);
private:
tinyxml2::XMLDocument xml_doc_;
std::shared_ptr<TaskGraphSpec> app_spec_;
std::vector<std::string> resources_paths_;
std::vector<std::string> libraries_paths_;
};
}
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define NEWPTR(type) (type*)malloc(sizeof(type))
typedef struct{
int time;
int id;
int bus;
}Type;
typedef struct node{
Type data;
struct node *next;
struct node *prev;
}node;
typedef struct queue{
node *front;
node *rear;
}queue;
queue *init(){
queue *q=NEWPTR(queue);
q->front=q->rear=NULL;
return q;
}
queue *create(int length){
queue *q=NEWPTR(queue);
q->front=NEWPTR(node);
q->front->prev=NULL;
node *temp=q->front;
for(;length>1;length--){
temp->next=NEWPTR(node);
temp->next->prev=temp;
temp=temp->next;
}
temp->next=NULL;
q->rear=temp;
return q;
}
void destroy(queue *q){
node *save,*temp=q->front;
while(temp!=NULL){
save=temp->next;
free(temp);
temp=save;
}
q->front=q->rear=NULL;
}
void en_queue(queue *q,Type *elem){
if(q->front==NULL){
q->front=q->rear=NEWPTR(node);
q->front->data=*elem;
q->front->next=q->front->prev=NULL;
}
else{
node *temp=NEWPTR(node);
temp->data=*elem;
temp->next=q->front;
temp->next->prev=temp;
temp->prev=NULL;
q->front=temp;
}
}
void de_queue(queue *q,Type *elem){
if(q->rear==NULL)
perror("Error while accessing rear pointer!\n");
*elem=q->rear->data;
if(q->rear==q->front){
free(q->rear);
q->front=q->rear=NULL;
}
node *save=q->rear->prev;
save->next=NULL;
free(q->rear);
q->rear=save;
}
int queue_length(queue *q){
node *temp=q->front;
int i=0;
while(temp!=NULL){
i++;
temp=temp->next;
}
return i;
}
int empty(queue *q){
return q->front==NULL;
}
void swap(Type *a,Type *b){
Type t;
t.time=a->time;t.id=a->id;t.bus=a->bus;
a->time=b->time;a->id=b->id;a->bus=b->bus;
b->time=t.time;b->id=t.id;b->bus=t.bus;
}
void bubble_sort(Type *a,int length){
for(int i=0;i<length-1;i++){
for(int j=0;j<length-i-1;j++){
if(a[j].time>a[j+1].time)
swap(a+j,a+j+1);
}
}
}
void generate(Type *elem){
static int i=0;
srand(time(NULL));
elem->id=i++;
elem->bus=(rand()+1)%4;
elem->time=rand()%940;
}
int main(void){
Type passenger[5];queue *q=init();
for(int i=0;i<5;i++)
generate(passenger+i);
bubble_sort(passenger,5);
for(int i=0;i<5;i++)
en_queue(q,passenger+i);
for(int i=0;i<5;i++){
Type p;
de_queue(q,&p);
printf("%d %d\n",p.id,p.bus);
}
return 0;
}
|
/*******************************************************************************
* god.c -- UDP server that will take and parse actions by the clients. These *
* actions will affect "favor" of these clients, which will be *
* managed by this server. Will keep track of the clients and their *
* "favor" with the "God." Will also assign who will be the "prophet" *
* of the clients. Will keep certain variables to influence the game. *
******************************************************************************/
// Header information(needs to be moved to header file)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#define PORT 30303
#define DATAMAX 512
#define MAXCONNECTIONS 10
int make_socket (uint16_t port);
void *get_in_addr(struct sockaddr *sa);
// Obvious main is obvious
int main(void)
{
// File descriptor sets. One master and one for basic handling.
// fdmax holds the total amount of file descriptors to handle.
fd_set master;
fd_set readfds;
int fdmax;
// Socket variables: Socket; Socket Structure; Socket size
int listener;
int newfd;
struct sockaddr_storage remoteaddr;
socklen_t addrlen;
char remoteIP[INET_ADDRSTRLEN];
// Flags, buffers, and other basic variables
int i, j;
char data[DATAMAX];
char reply[DATAMAX];
int nbytes;
// Initialize the sets
FD_ZERO(&master);
FD_ZERO(&readfds);
// Start the socket and bind it.
listener = make_socket(PORT);
if(listen(listener, MAXCONNECTIONS) == -1)
{
perror("listen");
return 1;
}
// Add the listener to the master set.
FD_SET(listener, &master);
// Listener is the biggest file descriptor so far.
fdmax = listener;
// Main loop
for(;;)
{
readfds = master; // Copy the master set for use
if(select(fdmax+1, &readfds, NULL, NULL, NULL) == -1)
{
perror("select");
return 2;
}
for(i = 0; i <= fdmax; i++)
{
if(FD_ISSET(i, &readfds)) // Have a connection
{
if(i == listener) // Handle a new client
{
addrlen = sizeof(remoteaddr);
newfd = accept(listener, (struct sockaddr *)&remoteaddr, &addrlen);
if(newfd == -1)
{
perror("accept");
return 3;
}
else
{
// Add the new connection to the set, and set the new max
FD_SET(newfd, &master);
if(newfd > fdmax)
{
fdmax = newfd;
}
printf("New connection from %s on socket %d.\n",
inet_ntop(remoteaddr.ss_family,
get_in_addr((struct sockaddr *)&remoteaddr), remoteIP,
INET_ADDRSTRLEN), newfd);
}
}
else // Handle data from known client
{
bzero(data, DATAMAX);
if((nbytes = recv(i, data, sizeof(data), 0)) <= 0)
{
if(nbytes == 0) // Error or disconnect
{
printf("Socket %d hung up.\n", i);
}
else
{
perror("recv");
}
close(i); // See ya (cockbite).
FD_CLR(i, &master);
}
else // We got data from the client, now do something with it
{
// Get rid of any possible newline characters that made it's way in.
strtok(data, "\n"); strtok(data, "\r");
strcpy(reply, "Default");
if(!strcmp(data, "close") || !strcmp(data, "Close"))
{
// Send the close flag to the client
strcpy(reply, "___CLS___");
}
else if(!strcmp(data, "shutdown") || !strcmp(data, "Shutdown"))
{
strcpy(reply, "Server shutting down.\n___CLS___\n");
for(j = 4; j <= fdmax; j++)
{
if(send(j, reply, strlen(reply), 0) == -1)
{
perror("send");
exit(1);
}
}
close(listener);
return 0;
}
if((nbytes = send(i, reply, strlen(reply), 0)) == -1)
{
perror("send");
exit(1);
}
}
}
}
}
}
return 0;
}
// Socket creation and binding function taken from GNU exapmles
int make_socket (uint16_t port)
{
int sock;
struct sockaddr_in name;
/* Create the socket. */
sock = socket (PF_INET, SOCK_STREAM, 0);
if (sock < 0)
{
perror ("socket");
exit (EXIT_FAILURE);
}
/* Give the socket a name. */
name.sin_family = AF_INET;
name.sin_port = htons (port);
name.sin_addr.s_addr = htonl (INADDR_ANY);
if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
{
perror ("bind");
exit (EXIT_FAILURE);
}
return sock;
}
// Get the address from a struct
void *get_in_addr(struct sockaddr *sa)
{
return &(((struct sockaddr_in *)sa)->sin_addr);
}
|
//
// ViewController.h
// PayDirectCardDemo
//
// Created by Toan M. Ha on 1/7/16.
// Copyright © 2016 HomeDirect. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GUNAlert.h"
@interface ViewController : UIViewController
@end
|
#include "config.h"
#include "xyzsh.h"
#include <string.h>
#include <stdio.h>
static int options_hash_fun(char* key)
{
int value = 0;
while(*key) {
value += *key;
key++;
}
return value % XYZSH_OPTION_MAX;
}
sObject* fun_new_on_gc(sObject* parent, BOOL user_object, BOOL no_stackframe)
{
sObject* self = gc_get_free_object(T_FUN, user_object);
SFUN(self).mBlock = NULL;
SFUN(self).mParent = parent;
SFUN(self).mLocalObjects = NULL;
SFUN(self).mArgBlocks = NULL;
SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX);
memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX);
SFUN(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0;
return self;
}
sObject* fun_new_on_stack(sObject* parent)
{
sObject* self = stack_get_free_object(T_FUN);
SFUN(self).mBlock = NULL;
SFUN(self).mParent = parent;
SFUN(self).mLocalObjects = NULL;
SFUN(self).mArgBlocks = NULL;
SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX);
memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX);
SFUN(self).mFlags = 0;
return self;
}
sObject* fun_clone_on_gc_from_stack_block(sObject* block, BOOL user_object, sObject* parent, BOOL no_stackframe)
{
sObject* self = gc_get_free_object(T_FUN, user_object);
SFUN(self).mBlock = block_clone_on_gc(block, T_BLOCK, FALSE);
SFUN(self).mParent = parent;
SFUN(self).mLocalObjects = NULL;
SFUN(self).mArgBlocks = NULL;
SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX);
memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX);
SFUN(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0;
return self;
}
sObject* fun_clone_on_stack_from_stack_block(sObject* block, sObject* parent, BOOL no_stackframe)
{
sObject* self = stack_get_free_object(T_FUN);
SFUN(self).mBlock = block_clone_on_stack(block, T_BLOCK);
SFUN(self).mParent = parent;
SFUN(self).mLocalObjects = NULL;
SFUN(self).mArgBlocks = NULL;
SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX);
memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX);
SFUN(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0;
return self;
}
void fun_delete_on_gc(sObject* self)
{
int i;
for(i=0; i<XYZSH_OPTION_MAX; i++) {
if(SFUN(self).mOptions[i].mKey) { FREE(SFUN(self).mOptions[i].mKey); }
if(SFUN(self).mOptions[i].mArg) { FREE(SFUN(self).mOptions[i].mArg); }
}
FREE(SFUN(self).mOptions);
}
void fun_delete_on_stack(sObject* self)
{
int i;
for(i=0; i<XYZSH_OPTION_MAX; i++) {
if(SFUN(self).mOptions[i].mKey) { FREE(SFUN(self).mOptions[i].mKey); }
if(SFUN(self).mOptions[i].mArg) { FREE(SFUN(self).mOptions[i].mArg); }
}
FREE(SFUN(self).mOptions);
}
int fun_gc_children_mark(sObject* self)
{
int count = 0;
sObject* block = SFUN(self).mBlock;
if(block) {
if(IS_MARKED(block) == 0) {
SET_MARK(block);
count++;
count += object_gc_children_mark(block);
}
}
sObject* parent = SFUN(self).mParent;
if(parent) {
if(IS_MARKED(parent) == 0) {
SET_MARK(parent);
count++;
count += object_gc_children_mark(parent);
}
}
sObject* lobjects = SFUN(self).mLocalObjects;
if(lobjects) {
if(IS_MARKED(lobjects) == 0) {
SET_MARK(lobjects);
count++;
count += object_gc_children_mark(lobjects);
}
}
sObject* arg_blocks = SFUN(self).mArgBlocks;
if(arg_blocks) {
if(IS_MARKED(arg_blocks) == 0) {
SET_MARK(arg_blocks);
count++;
count += object_gc_children_mark(arg_blocks);
}
}
return count;
}
BOOL fun_put_option_with_argument(sObject* self, MANAGED char* key)
{
int hash_value = options_hash_fun(key);
option_hash_it* p = SFUN(self).mOptions + hash_value;
while(1) {
if(p->mKey) {
p++;
if(p == SFUN(self).mOptions + hash_value) {
return FALSE;
}
else if(p == SFUN(self).mOptions + XYZSH_OPTION_MAX) {
p = SFUN(self).mOptions;
}
}
else {
p->mKey = MANAGED key;
return TRUE;
}
}
}
BOOL fun_option_with_argument(sObject* self, char* key)
{
int hash_value = options_hash_fun(key);
option_hash_it* p = SFUN(self).mOptions + hash_value;
while(1) {
if(p->mKey) {
if(strcmp(p->mKey, key) == 0) {
return TRUE;
}
else {
p++;
if(p == SFUN(self).mOptions + hash_value) {
return FALSE;
}
else if(p == SFUN(self).mOptions + XYZSH_OPTION_MAX) {
p = SFUN(self).mOptions;
}
}
}
else {
return FALSE;
}
}
}
|
#pragma once
#include "LuaLibIF.h"
class CLuaCommandEnv
{
public:
CLuaCommandEnv(lua_State* L);
operator LPCTSTR() { return m_lasterror; }
// Set the command environment for a function at stacktop:
void SetCmdEnvironment(void);
// Check if a symbol in the command environment exists and is of a specific type:
BOOL CheckCmdField(LPCTSTR nm, int type /*=-1*/);
// Get a string from a string field in the command environment, nm is the name, def a default value.
CString GetCmdVar(LPCTSTR nm, LPCTSTR def);
// Pushes the named field from the command environment onto the stack and returns 1.
int GetCmdVar(LPCTSTR nm);
// Pop a value off the stack and set it as a field in the command environment under nm:
void SetCmdVar(LPCTSTR nm);
// Returns the full path to a Lua library specified by its name (as for 'require'):
CString FindLuaLib(LPCTSTR name);
private:
int m_refCC; //Index of table in registry, Environment for Immediate Commands
lua_State* L;
CString m_lasterror;
};
|
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include <string>
#include <mraa/gpio.h>
#ifdef SWIGJAVA
#include "../IsrCallback.h"
#endif
namespace upm {
/**
* @brief RPR220 IR Reflective Sensor library
* @defgroup rpr220 libupm-rpr220
* @ingroup seeed gpio light tsk hak
*/
/**
* @library rpr220
* @sensor rpr220
* @comname RPR220 IR Reflective Sensor
* @altname Grove IR Reflective Sensor
* @type light
* @man seeed
* @web http://www.seeedstudio.com/wiki/Grove_-_Infrared_Reflective_Sensor
* @con gpio
* @kit tsk hak
*
* @brief API for the RPR220-based Grove IR Reflective Sensor
*
* UPM module for the Grove IR reflective sensor. The sensitivity
* can be adjusted with the potentiometer on the sensor module. It
* has a range of approximately 15 mm, and a quick response time.
*
* It detects high-contrast dark areas on a light background.
*
* This module allows the user to determine the current status
* (black detected or not). Additionally, if desired, an interrupt
* service routine (ISR) can be installed that is called when
* black is detected. Either method can be used, depending on your
* use case.
*
* @image html rpr220.jpg
* @snippet rpr220.cxx Interesting
* @snippet rpr220-intr.cxx Interesting
*/
class RPR220 {
public:
/**
* RPR220 constructor
*
* @param pin Digital pin to use
*/
RPR220(int pin);
/**
* RPR220 destructor
*/
~RPR220();
/**
* Gets the status of the pin; true means black has been detected
*
* @return True if the sensor has detected black
*/
bool blackDetected();
#ifdef SWIGJAVA
void installISR(IsrCallback *cb);
#else
/**
* Installs an ISR to be called when
* black is detected
*
* @param fptr Pointer to a function to be called on interrupt
* @param arg Pointer to an object to be supplied as an
* argument to the ISR.
*/
void installISR(void (*isr)(void *), void *arg);
#endif
/**
* Uninstalls the previously installed ISR
*
*/
void uninstallISR();
private:
#ifdef SWIGJAVA
void installISR(void (*isr)(void *), void *arg);
#endif
bool m_isrInstalled;
mraa_gpio_context m_gpio;
};
}
|
//
// DFPInterstitial.h
// Google Mobile Ads SDK
//
// Copyright 2012 Google LLC. All rights reserved.
//
#import <GoogleMobileAds/GADAppEventDelegate.h>
#import <GoogleMobileAds/GADInterstitial.h>
/// Google Ad Manager interstitial ad, a full-screen advertisement shown at natural
/// transition points in your application such as between game levels or news stories.
@interface DFPInterstitial : GADInterstitial
/// Initializes an interstitial with an ad unit created on the Ad Manager website. Create a new ad
/// unit for every unique placement of an ad in your application. Set this to the ID assigned for
/// this placement. Ad units are important for targeting and statistics.
///
/// Example Ad Manager ad unit ID: @"/6499/example/interstitial"
- (nonnull instancetype)initWithAdUnitID:(nonnull NSString *)adUnitID NS_DESIGNATED_INITIALIZER;
/// Optional delegate that is notified when creatives send app events.
@property(nonatomic, weak, nullable) id<GADAppEventDelegate> appEventDelegate;
@end
|
/*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmidt
*
*/
#ifdef LIBOHIBOARD_ETHERNET_LWIP_2_0_3
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */
#define NO_SYS 1
#define LWIP_NETCONN 0
#define LWIP_SOCKET 0
//#define LWIP_DNS 1 // Enable DNS support
#define MEM_ALIGNMENT 4
#define MEMP_MEM_MALLOC 1
#define MEMP_OVERFLOW_CHECK 1
/* Minimal changes to opt.h required for tcp unit tests: */
#define TCP_MSS 4288//2144
#define MEM_SIZE 32000/**the size of ram_heap**/
#define TCP_SND_QUEUELEN 40
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
#define TCP_SND_BUF (12 * TCP_MSS)
#define TCP_WND (12 * TCP_MSS)
/* Minimal changes to opt.h required for etharp unit tests: */
#define ETHARP_SUPPORT_STATIC_ENTRIES 1
/* New in 2.0.x */
#define SYS_LIGHTWEIGHT_PROT 0
#define LWIP_STATS 0
#define LWIP_DBG_OFF 0x00U
#define LWIP_PERF 0
#define LWIP_NETIF_STATUS_CALLBACK 0
#define LWIP_NETIF_LINK_CALLBACK 0
#endif /* __LWIPOPTS_H__ */
#endif /* LIBOHIBOARD_ETHERNET_LWIP_2_0_3 */
|
#pragma once
#include "Query.h"
#include "IndexNode.h"
#include "IndexService.h"
#ifdef LITECPPDB_EXPORTS
#define LITECPPDB_API __declspec(dllexport)
#else
#define LITECPPDB_API __declspec(dllimport)
#endif
namespace LiteCppDB
{
// All is an Index Scan operation
class QueryAll : public Query
{
private:
int32_t _order;
public:
LITECPPDB_API QueryAll(std::string field, int32_t order) noexcept;// : base(field);
LITECPPDB_API std::vector<IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) noexcept override;
};
} |
// -*- c++ -*-
#ifndef BREAKPOINTS_H
#define BREAKPOINTS_H
#include <sim/kernel.h>
#include <arch/symtable.h>
#include <sim/except.h>
#include <map>
#include <string>
#include <iostream>
namespace Simulator
{
class BreakPointManager
{
public:
enum BreakPointType {
FETCH = 1,
EXEC = 2,
MEMREAD = 4,
MEMWRITE = 8,
TRACEONLY = 16,
};
private:
struct BreakPointInfo {
unsigned id;
int type;
bool enabled;
};
typedef std::map<MemAddr, BreakPointInfo> breakpoints_t;
struct ActiveBreak {
MemAddr addr;
Object *obj;
int type;
ActiveBreak(MemAddr addr_, Object& obj_, int type_)
: addr(addr_), obj(&obj_), type(type_) {}
// For std::set
bool operator<(const ActiveBreak& other) const
{
return (addr < other.addr) ||
(addr == other.addr && (obj < other.obj)) ||
(obj == other.obj && type < other.type);
}
};
typedef std::set<ActiveBreak> active_breaks_t;
breakpoints_t m_breakpoints;
active_breaks_t m_activebreaks;
#ifndef STATIC_KERNEL
Kernel* m_kernel;
#endif
SymbolTable* m_symtable;
unsigned m_counter;
bool m_enabled;
void CheckMore(int type, MemAddr addr, Object& obj);
void CheckEnabled(void);
static std::string GetModeName(int);
#ifdef STATIC_KERNEL
static Kernel* GetKernel() { return &Kernel::GetGlobalKernel(); }
#else
Kernel* GetKernel() { return m_kernel; }
#endif
public:
BreakPointManager(SymbolTable* symtable = 0)
: m_breakpoints(), m_activebreaks(),
#ifndef STATIC_KERNEL
m_kernel(0),
#endif
m_symtable(symtable),
m_counter(0), m_enabled(false) {}
BreakPointManager(const BreakPointManager& other)
: m_breakpoints(other.m_breakpoints), m_activebreaks(other.m_activebreaks),
#ifndef STATIC_KERNEL
m_kernel(other.m_kernel),
#endif
m_symtable(other.m_symtable),
m_counter(other.m_counter), m_enabled(other.m_enabled) {}
BreakPointManager& operator=(const BreakPointManager& other) = delete;
#ifdef STATIC_KERNEL
void AttachKernel(Kernel&) {}
#else
void AttachKernel(Kernel& k) { m_kernel = &k; }
#endif
void EnableCheck(void) { m_enabled = true; }
void DisableCheck(void) { m_enabled = false; }
void EnableBreakPoint(unsigned id);
void DisableBreakPoint(unsigned id);
void DeleteBreakPoint(unsigned id);
void AddBreakPoint(MemAddr addr, int type = EXEC);
void AddBreakPoint(const std::string& sym, int offset, int type = EXEC);
void ClearAllBreakPoints(void);
void ListBreakPoints(std::ostream& out) const;
// Call Resume() once after some breakpoints have been
// encountered and before execution should resume.
void Resume(void);
void ReportBreaks(std::ostream& out) const;
bool NewBreaksDetected(void) const { return !m_activebreaks.empty(); }
void Check(int type, MemAddr addr, Object& obj)
{
if (m_enabled)
CheckMore(type, addr, obj);
}
void SetSymbolTable(SymbolTable &symtable) { m_symtable = &symtable; }
SymbolTable& GetSymbolTable() const { return *m_symtable; }
};
}
#endif
|
//
// NSPersistentStoreCoordinator+MagicalRecord.h
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
//
#import "MagicalRecordHelpers.h"
#import "NSPersistentStore+MagicalRecord.h"
@interface NSPersistentStoreCoordinator (MagicalRecord)
+ (NSPersistentStoreCoordinator *) MR_defaultStoreCoordinator;
+ (void) MR_setDefaultStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator;
+ (NSPersistentStoreCoordinator *) MR_coordinatorWithInMemoryStore;
+ (NSPersistentStoreCoordinator *) MR_newPersistentStoreCoordinator NS_RETURNS_RETAINED;
+ (NSPersistentStoreCoordinator *) MR_coordinatorWithSqliteStoreNamed:(NSString *)storeFileName;
+ (NSPersistentStoreCoordinator *) MR_coordinatorWithAutoMigratingSqliteStoreNamed:(NSString *) storeFileName;
+ (NSPersistentStoreCoordinator *) MR_coordinatorWithPersitentStore:(NSPersistentStore *)persistentStore;
- (NSPersistentStore *) MR_addInMemoryStore;
@end
|
// 2015-05-29 00:53:48
#include <stdio.h>
#include <stdlib.h>
#define MAX 200
int main(){
int var[MAX], i=0, maior=0, X, N, maior_v=0;
while(i<101){
var[i]=0;
i++;
}
scanf(" %d" , &N);
i=0;
while(i<N){
scanf(" %d" , &X);
var[X]++;
i++;
}
i=0;
while(i<101){
if(var[i]>=maior){
if(i>maior_v){
maior = var[i];
maior_v = i;
}
}
i++;
}
printf("%d" , maior_v);
return 0;
} |
//
// PKTCalendarEvent.h
// PodioKit
//
// Created by Sebastian Rehnby on 08/05/14.
// Copyright (c) 2014 Citrix Systems, Inc. All rights reserved.
//
#import "PKTModel.h"
#import "PKTConstants.h"
@class PKTApp, PKTAsyncTask;
@interface PKTCalendarEvent : PKTModel
@property (nonatomic, copy, readonly) NSString *title;
@property (nonatomic, copy, readonly) NSString *descr;
@property (nonatomic, copy, readonly) NSString *source;
@property (nonatomic, copy, readonly) NSString *UID;
@property (nonatomic, copy, readonly) NSString *location;
@property (nonatomic, copy, readonly) NSDate *startDate;
@property (nonatomic, copy, readonly) NSDate *startTime;
@property (nonatomic, copy, readonly) NSDate *endDate;
@property (nonatomic, copy, readonly) NSDate *endTime;
@property (nonatomic, copy, readonly) NSURL *linkURL;
@property (nonatomic, copy, readonly) PKTApp *app;
@property (nonatomic, copy, readonly) NSString *colorString;
@property (nonatomic, copy, readonly) NSString *categoryText;
@property (nonatomic, assign, readonly) BOOL busy;
@property (nonatomic, assign, readonly) PKTReferenceType referenceType;
@property (nonatomic, assign, readonly) NSUInteger referenceID;
@property (nonatomic, assign, readonly) BOOL forged;
#pragma mark - API
+ (PKTAsyncTask *)fetchAllFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate;
+ (PKTAsyncTask *)fetchAllFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate priority:(NSUInteger)priority;
+ (PKTAsyncTask *)fetchEventsFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate;
+ (PKTAsyncTask *)fetchEventsFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate priority:(NSUInteger)priority;
+ (PKTAsyncTask *)fetchAllForSpace:(NSInteger)spaceId fromDate:(NSDate *)fromDate toDate:(NSDate *)toDate;
+ (PKTAsyncTask *)fetchAllForSpace:(NSInteger)spaceId fromDate:(NSDate *)fromDate toDate:(NSDate *)toDate priority:(NSUInteger)priority;
+ (PKTAsyncTask *)fetchEventsForSpace:(NSInteger)spaceId fromDate:(NSDate *)fromDate toDate:(NSDate *)toDate;
+ (PKTAsyncTask *)fetchEventsForSpace:(NSInteger)spaceId fromDate:(NSDate *)fromDate toDate:(NSDate *)toDate priority:(NSUInteger)priority;
@end
|
//
// ORMessage.h
// ORMessage
//
// Created by Robert Kramann on 09/05/14.
// Copyright (c) 2014 OpenResearch Software Development OG. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class ORMessage;
@class ORMessageController;
@protocol ORMessageViewDelegate <NSObject>
@optional
- (CGFloat)message:(ORMessage*)message viewHeightForWidth:(CGFloat)width;
@end
typedef NS_OPTIONS(NSInteger, ORMessageAnimationOption)
{
ORMessageAnimationOptionNone = 0,
ORMessageAnimationOptionFade = (1 << 0),
ORMessageAnimationOptionMove = (1 << 1),
};
@interface ORMessage : NSObject
@property(weak,nonatomic) id<ORMessageViewDelegate> delegate;
@property(strong,nonatomic) NSArray* identifiers;
@property(strong,nonatomic) UIView* view;
@property(assign,nonatomic) BOOL hidesWhenTouched;
@property(assign,nonatomic) BOOL hidesWhenTouchedOutside;
@property(assign,nonatomic) BOOL showOnTop;
@property(assign,nonatomic) NSTimeInterval duration;
@property(assign,nonatomic) CGFloat padding;
@property(assign,nonatomic) BOOL inheritsWidthFromViewController;
@property(assign,nonatomic) ORMessageAnimationOption animationOptions;
@property(copy,nonatomic) void (^touchedBlock)(ORMessage* message);
@property(copy,nonatomic) void (^touchedOutsideBlock)(ORMessage* message);
@property(strong,nonatomic) UIView* widthLayoutReferenceView;
@property(weak,readonly) ORMessageController* messsageController;
- (void)removeAnimated:(BOOL)animated;
- (void)removeAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated;
@end
|
/**
* Swaggy Jenkins
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: blah@cliffano.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* QueueBlockedItem.h
*
*
*/
#ifndef QueueBlockedItem_H_
#define QueueBlockedItem_H_
#include <string>
#include "CauseAction.h"
#include "FreeStyleProject.h"
#include <vector>
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class QueueBlockedItem
{
public:
QueueBlockedItem();
virtual ~QueueBlockedItem() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const QueueBlockedItem& rhs) const;
bool operator!=(const QueueBlockedItem& rhs) const;
/////////////////////////////////////////////
/// QueueBlockedItem members
/// <summary>
///
/// </summary>
std::string getClass() const;
void setClass(std::string const& value);
bool r_classIsSet() const;
void unset_class();
/// <summary>
///
/// </summary>
std::vector<CauseAction> getActions() const;
void setActions(std::vector<CauseAction> const& value);
bool actionsIsSet() const;
void unsetActions();
/// <summary>
///
/// </summary>
bool isBlocked() const;
void setBlocked(bool const value);
bool blockedIsSet() const;
void unsetBlocked();
/// <summary>
///
/// </summary>
bool isBuildable() const;
void setBuildable(bool const value);
bool buildableIsSet() const;
void unsetBuildable();
/// <summary>
///
/// </summary>
int32_t getId() const;
void setId(int32_t const value);
bool idIsSet() const;
void unsetId();
/// <summary>
///
/// </summary>
int32_t getInQueueSince() const;
void setInQueueSince(int32_t const value);
bool inQueueSinceIsSet() const;
void unsetInQueueSince();
/// <summary>
///
/// </summary>
std::string getParams() const;
void setParams(std::string const& value);
bool paramsIsSet() const;
void unsetParams();
/// <summary>
///
/// </summary>
bool isStuck() const;
void setStuck(bool const value);
bool stuckIsSet() const;
void unsetStuck();
/// <summary>
///
/// </summary>
FreeStyleProject getTask() const;
void setTask(FreeStyleProject const& value);
bool taskIsSet() const;
void unsetTask();
/// <summary>
///
/// </summary>
std::string getUrl() const;
void setUrl(std::string const& value);
bool urlIsSet() const;
void unsetUrl();
/// <summary>
///
/// </summary>
std::string getWhy() const;
void setWhy(std::string const& value);
bool whyIsSet() const;
void unsetWhy();
/// <summary>
///
/// </summary>
int32_t getBuildableStartMilliseconds() const;
void setBuildableStartMilliseconds(int32_t const value);
bool buildableStartMillisecondsIsSet() const;
void unsetBuildableStartMilliseconds();
friend void to_json(nlohmann::json& j, const QueueBlockedItem& o);
friend void from_json(const nlohmann::json& j, QueueBlockedItem& o);
protected:
std::string m__class;
bool m__classIsSet;
std::vector<CauseAction> m_Actions;
bool m_ActionsIsSet;
bool m_Blocked;
bool m_BlockedIsSet;
bool m_Buildable;
bool m_BuildableIsSet;
int32_t m_Id;
bool m_IdIsSet;
int32_t m_InQueueSince;
bool m_InQueueSinceIsSet;
std::string m_Params;
bool m_ParamsIsSet;
bool m_Stuck;
bool m_StuckIsSet;
FreeStyleProject m_Task;
bool m_TaskIsSet;
std::string m_Url;
bool m_UrlIsSet;
std::string m_Why;
bool m_WhyIsSet;
int32_t m_BuildableStartMilliseconds;
bool m_BuildableStartMillisecondsIsSet;
};
} // namespace org::openapitools::server::model
#endif /* QueueBlockedItem_H_ */
|
#ifndef POST_EFFECT_H
#define POST_EFFECT_H
#include <SFML/System/NonCopyable.hpp>
namespace sf
{
class RenderTarget;
class RenderTexture;
class Shader;
}
class PostEffect : private sf::NonCopyable {
public:
virtual ~PostEffect();
virtual void Apply( const sf::RenderTexture& input, sf::RenderTarget& output ) = 0;
protected:
static void ApplyShader( const sf::Shader& shader, sf::RenderTarget& output );
};
#endif // POST_EFFECT_H
|
// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_EMITTER_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_EMITTER_H_
#include <utility>
#include <vector>
#include "content/public/browser/browser_thread.h"
#include "electron/shell/common/api/api.mojom.h"
#include "shell/common/gin_helper/event_emitter_caller.h"
#include "shell/common/gin_helper/wrappable.h"
namespace content {
class RenderFrameHost;
}
namespace gin_helper {
namespace internal {
v8::Local<v8::Object> CreateCustomEvent(
v8::Isolate* isolate,
v8::Local<v8::Object> sender = v8::Local<v8::Object>(),
v8::Local<v8::Object> custom_event = v8::Local<v8::Object>());
v8::Local<v8::Object> CreateNativeEvent(
v8::Isolate* isolate,
v8::Local<v8::Object> sender,
content::RenderFrameHost* frame,
electron::mojom::ElectronBrowser::MessageSyncCallback callback);
} // namespace internal
// Provide helperers to emit event in JavaScript.
template <typename T>
class EventEmitter : public gin_helper::Wrappable<T> {
public:
using Base = gin_helper::Wrappable<T>;
using ValueArray = std::vector<v8::Local<v8::Value>>;
// Make the convinient methods visible:
// https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-members
v8::Isolate* isolate() const { return Base::isolate(); }
v8::Local<v8::Object> GetWrapper() const { return Base::GetWrapper(); }
v8::MaybeLocal<v8::Object> GetWrapper(v8::Isolate* isolate) const {
return Base::GetWrapper(isolate);
}
// this.emit(name, event, args...);
template <typename... Args>
bool EmitCustomEvent(base::StringPiece name,
v8::Local<v8::Object> event,
Args&&... args) {
return EmitWithEvent(
name, internal::CreateCustomEvent(isolate(), GetWrapper(), event),
std::forward<Args>(args)...);
}
// this.emit(name, new Event(), args...);
template <typename... Args>
bool Emit(base::StringPiece name, Args&&... args) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
v8::Local<v8::Object> wrapper = GetWrapper();
if (wrapper.IsEmpty())
return false;
v8::Local<v8::Object> event =
internal::CreateCustomEvent(isolate(), wrapper);
return EmitWithEvent(name, event, std::forward<Args>(args)...);
}
// disable copy
EventEmitter(const EventEmitter&) = delete;
EventEmitter& operator=(const EventEmitter&) = delete;
protected:
EventEmitter() {}
private:
// this.emit(name, event, args...);
template <typename... Args>
bool EmitWithEvent(base::StringPiece name,
v8::Local<v8::Object> event,
Args&&... args) {
// It's possible that |this| will be deleted by EmitEvent, so save anything
// we need from |this| before calling EmitEvent.
auto* isolate = this->isolate();
auto context = isolate->GetCurrentContext();
gin_helper::EmitEvent(isolate, GetWrapper(), name, event,
std::forward<Args>(args)...);
v8::Local<v8::Value> defaultPrevented;
if (event->Get(context, gin::StringToV8(isolate, "defaultPrevented"))
.ToLocal(&defaultPrevented)) {
return defaultPrevented->BooleanValue(isolate);
}
return false;
}
};
} // namespace gin_helper
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_EMITTER_H_
|
#pragma once
#include <lucid/core/Noncopyable.h>
#include <lucid/core/Types.h>
///
///
///
namespace lucid {
namespace core {
class Reader;
} /// core
} /// lucid
///
///
///
namespace lucid {
namespace gal {
/// IndexBuffer
///
/// collection of indices used to render geometry.
class IndexBuffer
{
public:
enum USAGE
{
USAGE_UNDEFINED = -1,
USAGE_STATIC,
USAGE_DYNAMIC,
};
enum FORMAT
{
FORMAT_UNDEFINED = -1,
FORMAT_UINT16,
FORMAT_UINT32,
};
virtual ~IndexBuffer() = 0 {}
virtual USAGE usage() const = 0;
virtual FORMAT format() const = 0;
virtual int32_t count() const = 0;
virtual void *lock(int32_t start = 0, int32_t count = 0) = 0;
virtual void unlock() = 0;
static IndexBuffer *create(USAGE usage, FORMAT format, int32_t count);
static IndexBuffer *create(::lucid::core::Reader &reader);
protected:
IndexBuffer() {}
LUCID_PREVENT_COPY(IndexBuffer);
LUCID_PREVENT_ASSIGNMENT(IndexBuffer);
};
} /// gal
} /// lucid
|
#include "lcdLib.h"
#define LOWNIB(x) P2OUT = (P2OUT & 0xF0) + (x & 0x0F)
void lcdInit() {
delay_ms(100);
// Wait for 100ms after power is applied.
P2DIR = EN + RS + DATA; // Make pins outputs
P2OUT = 0x03; // Start LCD (send 0x03)
lcdTriggerEN(); // Send 0x03 3 times at 5ms then 100 us
delay_ms(5);
lcdTriggerEN();
delay_ms(5);
lcdTriggerEN();
delay_ms(5);
P2OUT = 0x02; // Switch to 4-bit mode
lcdTriggerEN();
delay_ms(5);
lcdWriteCmd(0x28); // 4-bit, 2 line, 5x8
lcdWriteCmd(0x08); // Instruction Flow
lcdWriteCmd(0x01); // Clear LCD
lcdWriteCmd(0x06); // Auto-Increment
lcdWriteCmd(0x0C); // Display On, No blink
}
void lcdTriggerEN() {
P2OUT |= EN;
P2OUT &= ~EN;
}
void lcdWriteData(unsigned char data) {
P2OUT |= RS; // Set RS to Data
LOWNIB(data >> 4); // Upper nibble
lcdTriggerEN();
LOWNIB(data); // Lower nibble
lcdTriggerEN();
delay_us(50); // Delay > 47 us
}
void lcdWriteCmd(unsigned char cmd) {
P2OUT &= ~RS; // Set RS to Data
LOWNIB(cmd >> 4); // Upper nibble
lcdTriggerEN();
LOWNIB(cmd); // Lower nibble
lcdTriggerEN();
delay_ms(5); // Delay > 1.5ms
}
void lcdSetText(char* text, int x, int y) {
int i;
if (x < 16) {
x |= 0x80; // Set LCD for first line write
switch (y){
case 1:
x |= 0x40; // Set LCD for second line write
break;
case 2:
x |= 0x60; // Set LCD for first line write reverse
break;
case 3:
x |= 0x20; // Set LCD for second line write reverse
break;
}
lcdWriteCmd(x);
}
i = 0;
while (text[i] != '\0') {
lcdWriteData(text[i]);
i++;
}
}
void lcdSetInt(int val, int x, int y){
char number_string[16];
sprintf(number_string, "%d", val); // Convert the integer to character string
lcdSetText(number_string, x, y);
}
void lcdClear() {
lcdWriteCmd(CLEAR);
} |
/*
* This file is part of the kyuba.org Katal project.
* See the appropriate repository at http://git.kyuba.org/ for exact file
* modification records.
*/
/*
* Copyright (c) 2010, Kyuba Project Members
*
* 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 LIBKATAL_COMMON_H
#define LIBKATAL_COMMON_H
extern const char *katal_include_directories[];
#define KATAL_PREPROCESS_STRIP_COMMENTS (1 << 0)
#define KATAL_PREPROCESS_STRIP_WHITESPACE (1 << 1)
enum katal_return_value
{
krv_ok,
krv_invalid_token,
krv_incomplete
};
enum katal_notice
{
kn_invalid_nesting,
kn_custom
};
#define KATAL_TOKEN_FLAG_HAVE_NEXT (1 << 31)
#define KATAL_TOKEN_FLAG_HAVE_PAYLOAD_1 (1 << 30)
#define KATAL_TOKEN_FLAG_HAVE_PAYLOAD_2 (1 << 29)
#define KATAL_TOKEN_FLAG_HAVE_PAYLOAD_3 (1 << 28)
enum katal_token_type
{
/* dummies/informational */
ktt_none,
ktt_end_of_file,
ktt_whitespace,
/* tokens for symbols */
ktt_question_mark,
ktt_colon,
ktt_hash,
ktt_bang,
ktt_asterisk,
ktt_plus,
ktt_minus,
ktt_slash,
ktt_ampersand,
ktt_equals,
ktt_comma,
ktt_dot,
ktt_semicolon,
ktt_pipe,
ktt_circumflex,
ktt_tilde,
ktt_percent,
ktt_right_arrow,
ktt_opening_parenthesis, /* () */
ktt_closing_parenthesis,
ktt_opening_brace, /* {} */
ktt_closing_brace,
ktt_opening_bracket, /* [] */
ktt_closing_bracket,
ktt_opening_angle_bracket, /* <> */
ktt_closing_angle_bracket,
/* extended symbolic tokens (keywords) */
ktt_void,
ktt_struct,
ktt_union,
ktt_enum,
ktt_typedef,
ktt_unsigned,
ktt_signed,
ktt_short,
ktt_long,
ktt_char,
ktt_int,
ktt_double,
ktt_float,
ktt_return,
ktt_const,
ktt_volatile,
ktt_static,
ktt_extern,
ktt_auto,
ktt_register,
ktt_do,
ktt_while,
ktt_for,
ktt_continue,
ktt_break,
ktt_if,
ktt_else,
ktt_switch,
ktt_case,
ktt_default,
ktt_goto,
ktt_sizeof,
ktt_inline,
ktt_complex,
ktt_typeof,
/* (mostly) logical tokens */
ktt_comment,
ktt_integer,
ktt_integer_signed,
ktt_floating_point,
ktt_string,
ktt_character_literal,
ktt_symbol,
ktt_block,
ktt_begin_block,
ktt_end_block,
ktt_assign,
ktt_arithmetic_add,
ktt_arithmetic_subtract,
ktt_arithmetic_divide,
ktt_arithmetic_multiply,
ktt_arithmetic_modulo,
ktt_shift_left,
ktt_shift_right,
ktt_arithmetic_add_and_assign,
ktt_arithmetic_subtract_and_assign,
ktt_arithmetic_divide_and_assign,
ktt_arithmetic_multiply_and_assign,
ktt_arithmetic_modulo_and_assign,
ktt_shift_left_and_assign,
ktt_shift_right_and_assign,
ktt_lesser_than,
ktt_greater_than,
ktt_equality,
ktt_unequality,
ktt_end_of_expression,
ktt_group,
ktt_group_begin,
ktt_group_end,
ktt_logical_or,
ktt_logical_and,
ktt_logical_xor,
ktt_logical_negation,
ktt_bitwise_or,
ktt_bitwise_and,
ktt_bitwise_xor,
ktt_bitwise_negation,
ktt_bitwise_or_and_assign,
ktt_bitwise_and_and_assign,
ktt_bitwise_xor_and_assign,
ktt_bitwise_negation_and_assign,
ktt_trinear_if_condition_mark,
ktt_trinear_if_branch_delimiter,
ktt_shebang,
ktt_pointer_to,
ktt_reference_of,
ktt_dereference_of,
ktt_increment,
ktt_decrement,
/* purely logical tokens */
ktt_declaration,
ktt_definition,
ktt_type,
ktt_variable,
ktt_literal,
ktt_function_prototype,
ktt_typecast,
ktt_label
};
union katal_token_payload;
struct katal_token;
struct katal_token_with_next;
union katal_token_payload
{
unsigned long long integer;
signed long long integer_signed;
long double floating_point;
const char *string;
struct kata_token *token;
};
struct katal_token
{
enum katal_token_type type;
unsigned long flags;
union katal_token_payload payload[];
};
struct katal_token_with_next
{
enum katal_token_type type;
unsigned long flags;
struct katal_token *next;
union katal_token_payload payload[];
};
void initialise_katal ( void );
struct katal_token *katal_token_immutable
(enum katal_token_type type, unsigned long flags,
struct katal_token *next,
union katal_token_payload *primus,
union katal_token_payload *secundus,
union katal_token_payload *tertius);
void katal_token_free_all ( void );
#endif
|
#ifndef PERFT_H
#define PERFT_H
#include <stdio.h>
struct EPDFile;
struct Board;
int perft_test_perft(struct EPDFile* epd);
unsigned int perft_perft(struct Board* board, unsigned int depth);
void perft_divide(FILE* stream, struct Board* board, unsigned int depth);
#endif
|
/*
SHA512.h
The SHA2 algorithm SHA-512
Copyright (c) 2013 - 2019 Jason Lee @ calccrypto at gmail.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.
*/
#ifndef __OPENPGP_SHA512__
#define __OPENPGP_SHA512__
#ifdef OPENSSL_HASH
#include "Hashes/OpenSSL/SHA512.h"
#else
#include "Hashes/Unsafe/SHA512.h"
#endif
#endif
|
//
// UIColor+HexString.h
// AwkwardLineShare
//
// Created by YuheiMiyazato on 3/27/15.
// Copyright (c) 2015 mitolab. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (HexString)
+ (UIColor *) colorFromHexString:(NSString *)hexString;
@end
|
/**
* \file
* \brief Hashtable headers
*/
/*
* Copyright (c) 2008, 2011, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef HASHTABLE_H_
#define HASHTABLE_H_
#include <hashtable/dictionary.h>
#include <stdio.h>
/**
* \brief an entry of a hashtable
*/
struct _ht_entry {
const void* key;
size_t key_len;
void* value;
struct capref capvalue;
ENTRY_TYPE type;
int hash_value;
struct _ht_entry *next;
};
/**
* \brief hashtable
*/
struct hashtable {
struct dictionary d;
int table_length;
int entry_count;
struct _ht_entry **entries;
int threshold;
int capacity;
int load_factor;
};
/**
* \brief create an empty hashtable with a given capacity and load factor
* \param capacity the capacity
* \param the load factor
* \return an empty hashtable.
*/
struct hashtable* create_hashtable2(int capacity, int loadFactor);
/**
* \brief create an empty hashtable with default capacity and load factor
* \return an empty hashtable
*/
struct hashtable* create_hashtable(void);
void print_hashtable(FILE *stream, struct hashtable *ht);
#endif /*HASHTABLE_H_*/
|
//
// UIImage+SYBytes.h
// zhangshaoyu
//
// Created by zhangshaoyu on 16/12/7.
// Copyright © 2016年 zhangshaoyu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (SYBytes)
#pragma mark - 图片转二进制流字符串
/**
* 图片转二进制流字符串
*
* @param quality 压缩精度(0.0 ~ 1.0)
*
* @return 返回二进制流字符串
*/
- (NSString *)imageBytesStringWithQuality:(CGFloat)quality;
/**
* 二进制流字符串转图片
*
* @param string 二进制流字符串
*
* @return image
*/
+ (UIImage *)imageWithImageBytes:(NSString *)string;
/**
* 图片转二进制流
*
* @param quality 压缩精度(0.0 ~ 1.0)
*
* @return 返回二进制流
*/
- (NSData *)imageDataWithQuality:(CGFloat)quality;
/**
* 图片转二进制流base64字符串
*
* @param quality 压缩精度(0.0 ~ 1.0)
*
* @return 返回二进制流base64字符串
*/
- (NSString *)imageBase64StringWithQuality:(CGFloat)quality;
// base64字符串转图片
+ (UIImage *)imageWithImageBase64:(NSString *)string;
@end
|
//
// TLAlertView.h
// TLKit
//
// Created by 李伯坤 on 2020/1/27.
//
#import <UIKit/UIKit.h>
#pragma mark - # TLAlertViewItem
@class TLAlertView;
@class TLAlertViewItem;
typedef void (^TLAlertViewItemClickAction)(TLAlertView *alertView, TLAlertViewItem *item, NSInteger index);
typedef void (^TLAlertViewTextFieldConfigAction)(TLAlertView *alertView, UITextField *textField);
typedef NS_ENUM(NSInteger, TLAlertViewItemType) {
TLAlertViewItemTypeNormal = 0,
TLAlertViewItemTypeCancel = 1,
TLAlertViewItemTypeDestructive = 2,
};
@interface TLAlertViewItem : NSObject
/// 类型
@property (nonatomic, assign) TLAlertViewItemType type;
/// 标题
@property (nonatomic, strong) NSString *title;
/// 点击事件
@property (nonatomic, copy) TLAlertViewItemClickAction clickAction;
#pragma mark - 自定义项
@property (nonatomic, strong) UIColor *titleColor;
@property (nonatomic, strong) UIFont *titleFont;
- (instancetype)initWithTitle:(NSString *)title clickAction:(TLAlertViewItemClickAction)clickAction;
@end
#pragma mark - # TLAlertView
@interface TLAlertView : UIView
/// 标题
@property (nonatomic, strong) NSString *title;
/// 正文
@property (nonatomic, strong) NSString *message;
/// 按钮(不包含取消按钮)
@property (nonatomic, strong, readonly) NSArray<TLAlertViewItem *> *items;
@property (nonatomic, strong, readonly) UIView *customView;
@property (nonatomic, strong, readonly) UITextField *textField;
- (instancetype)initWithTitle:(NSString *)title message:(NSString *)message;
- (void)addTextFieldWithConfigAction:(TLAlertViewTextFieldConfigAction)configAction;
- (void)addItemWithTitle:(NSString *)title clickAction:(TLAlertViewItemClickAction)clickAction;
- (void)addDestructiveItemWithTitle:(NSString *)title clickAction:(TLAlertViewItemClickAction)clickAction;
- (void)addCancelItemTitle:(NSString *)title clickAction:(TLAlertViewItemClickAction)clickAction;
- (void)addItem:(TLAlertViewItem *)item;
- (void)show;
- (void)dismiss;
#pragma mark - 兼容旧版本API
+ (void)showWithTitle:(NSString *)title message:(NSString *)message;
+ (void)showWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle;
+ (void)showWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle actionHandler:(void (^)(NSInteger buttonIndex))actionHandler;
+ (void)showWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles actionHandler:(void (^)(NSInteger buttonIndex))actionHandler;
@end
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/frameworks/base/core/java/android/test/suitebuilder/annotation/SmallTest.java
//
#include "../../../../J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_AndroidTestSuitebuilderAnnotationSmallTest")
#ifdef RESTRICT_AndroidTestSuitebuilderAnnotationSmallTest
#define INCLUDE_ALL_AndroidTestSuitebuilderAnnotationSmallTest 0
#else
#define INCLUDE_ALL_AndroidTestSuitebuilderAnnotationSmallTest 1
#endif
#undef RESTRICT_AndroidTestSuitebuilderAnnotationSmallTest
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#if !defined (AndroidTestSuitebuilderAnnotationSmallTest_) && (INCLUDE_ALL_AndroidTestSuitebuilderAnnotationSmallTest || defined(INCLUDE_AndroidTestSuitebuilderAnnotationSmallTest))
#define AndroidTestSuitebuilderAnnotationSmallTest_
#define RESTRICT_JavaLangAnnotationAnnotation 1
#define INCLUDE_JavaLangAnnotationAnnotation 1
#include "../../../../java/lang/annotation/Annotation.h"
@class IOSClass;
@class IOSObjectArray;
/*!
@brief Marks a test that should run as part of the small tests.
*/
@protocol AndroidTestSuitebuilderAnnotationSmallTest < JavaLangAnnotationAnnotation >
@end
@interface AndroidTestSuitebuilderAnnotationSmallTest : NSObject < AndroidTestSuitebuilderAnnotationSmallTest >
@end
J2OBJC_EMPTY_STATIC_INIT(AndroidTestSuitebuilderAnnotationSmallTest)
FOUNDATION_EXPORT id<AndroidTestSuitebuilderAnnotationSmallTest> create_AndroidTestSuitebuilderAnnotationSmallTest();
J2OBJC_TYPE_LITERAL_HEADER(AndroidTestSuitebuilderAnnotationSmallTest)
#endif
#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_AndroidTestSuitebuilderAnnotationSmallTest")
|
//
// CDAAFNetworkingConnector.h
// Pods
//
// Created by Tamara Bernad on 19/04/16.
//
//
#import <Foundation/Foundation.h>
#import "CDASyncConnectorProtocol.h"
@interface CDAAFNetworkingConnector : NSObject<CDASyncConnectorProtocol>
@end
|
// C++ for the Windows Runtime v1.0.161012.5
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.Devices.Adc.Provider.1.h"
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::Foundation::Collections {
#ifndef WINRT_GENERIC_7c4789c0_8445_5757_aab7_659cbf50aaa7
#define WINRT_GENERIC_7c4789c0_8445_5757_aab7_659cbf50aaa7
template <> struct __declspec(uuid("7c4789c0-8445-5757-aab7-659cbf50aaa7")) __declspec(novtable) IVectorView<Windows::Devices::Adc::Provider::IAdcControllerProvider> : impl_IVectorView<Windows::Devices::Adc::Provider::IAdcControllerProvider> {};
#endif
#ifndef WINRT_GENERIC_b43acf15_a24a_5b00_b710_1737ba550a18
#define WINRT_GENERIC_b43acf15_a24a_5b00_b710_1737ba550a18
template <> struct __declspec(uuid("b43acf15-a24a-5b00-b710-1737ba550a18")) __declspec(novtable) IIterator<Windows::Devices::Adc::Provider::IAdcControllerProvider> : impl_IIterator<Windows::Devices::Adc::Provider::IAdcControllerProvider> {};
#endif
#ifndef WINRT_GENERIC_30047155_1f71_5223_8482_e5159d0137d0
#define WINRT_GENERIC_30047155_1f71_5223_8482_e5159d0137d0
template <> struct __declspec(uuid("30047155-1f71-5223-8482-e5159d0137d0")) __declspec(novtable) IIterable<Windows::Devices::Adc::Provider::IAdcControllerProvider> : impl_IIterable<Windows::Devices::Adc::Provider::IAdcControllerProvider> {};
#endif
}
namespace Windows::Devices::Adc::Provider {
template <typename D>
struct WINRT_EBO impl_IAdcControllerProvider
{
int32_t ChannelCount() const;
int32_t ResolutionInBits() const;
int32_t MinValue() const;
int32_t MaxValue() const;
Windows::Devices::Adc::Provider::ProviderAdcChannelMode ChannelMode() const;
void ChannelMode(Windows::Devices::Adc::Provider::ProviderAdcChannelMode value) const;
bool IsChannelModeSupported(Windows::Devices::Adc::Provider::ProviderAdcChannelMode channelMode) const;
void AcquireChannel(int32_t channel) const;
void ReleaseChannel(int32_t channel) const;
int32_t ReadValue(int32_t channelNumber) const;
};
template <typename D>
struct WINRT_EBO impl_IAdcProvider
{
Windows::Foundation::Collections::IVectorView<Windows::Devices::Adc::Provider::IAdcControllerProvider> GetControllers() const;
};
struct IAdcControllerProvider :
Windows::IInspectable,
impl::consume<IAdcControllerProvider>
{
IAdcControllerProvider(std::nullptr_t = nullptr) noexcept {}
auto operator->() const noexcept { return ptr<IAdcControllerProvider>(m_ptr); }
};
struct IAdcProvider :
Windows::IInspectable,
impl::consume<IAdcProvider>
{
IAdcProvider(std::nullptr_t = nullptr) noexcept {}
auto operator->() const noexcept { return ptr<IAdcProvider>(m_ptr); }
};
}
}
|
/***************************************************************************//**
* @file SALAZAR_URIEL_Aircraft.h
* @brief Final Project
* @author Uriel Salazar
* @date June 2016
* @details
*******************************************************************************/
// prevent multiple inclusions
#ifndef AIRCRAFT_H
#define AIRCRAFT_H
// system libraries
#include <string>
// declare class "Aircraft"
class Aircraft
{
public:
// constructor
Aircraft(std::string, unsigned short, unsigned int, unsigned short,
unsigned int, float, unsigned short);
// modelName; setter/getter
void setModelName(std::string mn)
{
modelName = mn;
}
std::string getModelName()
{
return modelName;
}
// passengerCount; setter/getter
void setPassengerCount(unsigned short pc)
{
passengerCount = pc;
}
unsigned short getPassengerCount()
{
return passengerCount;
}
// fuelCapacity; setter/getter
void setFuelCapacity(unsigned int fc)
{
fuelCapacity = fc;
}
unsigned int getFuelCapacity()
{
return fuelCapacity;
}
// averageSpeed; setter/getter
void setAverageSpeed(unsigned short as)
{
averageSpeed = as;
}
unsigned short getAverageSpeed()
{
return averageSpeed;
}
// averageAltitude; setter/getter
void setAverageAltitude(unsigned int aa)
{
averageAltitude = aa;
}
unsigned int getAverageAltitude()
{
return averageAltitude;
}
// thrustWeightRatio; setter/getter
void setThrustWeightRatio(float twr)
{
thrustWeightRatio = twr;
}
float getThrustWeightRatio()
{
return thrustWeightRatio;
}
// priorityLevel; setter/getter
void setPriorityLevel(unsigned short pl)
{
priorityLevel = pl;
}
unsigned short getPriorityLevel()
{
return priorityLevel;
}
// virtual functions
virtual void launch() {}
virtual void land() {}
private:
std::string modelName;
unsigned short passengerCount;
unsigned int fuelCapacity;
unsigned short averageSpeed;
unsigned int averageAltitude;
float thrustWeightRatio;
public:
unsigned short priorityLevel;
};
#endif |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.