text
stringlengths 4
6.14k
|
|---|
/*******************************************************************************
* File Name: SW2.c
* Version 2.10
*
* Description:
* This file contains API to enable firmware control of a Pins component.
*
* Note:
*
********************************************************************************
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#include "cytypes.h"
#include "SW2.h"
#define SetP4PinDriveMode(shift, mode) \
do { \
SW2_PC = (SW2_PC & \
(uint32)(~(uint32)(SW2_DRIVE_MODE_IND_MASK << (SW2_DRIVE_MODE_BITS * (shift))))) | \
(uint32)((uint32)(mode) << (SW2_DRIVE_MODE_BITS * (shift))); \
} while (0)
/*******************************************************************************
* Function Name: SW2_Write
********************************************************************************
*
* Summary:
* Assign a new value to the digital port's data output register.
*
* Parameters:
* prtValue: The value to be assigned to the Digital Port.
*
* Return:
* None
*
*******************************************************************************/
void SW2_Write(uint8 value)
{
uint8 drVal = (uint8)(SW2_DR & (uint8)(~SW2_MASK));
drVal = (drVal | ((uint8)(value << SW2_SHIFT) & SW2_MASK));
SW2_DR = (uint32)drVal;
}
/*******************************************************************************
* Function Name: SW2_SetDriveMode
********************************************************************************
*
* Summary:
* Change the drive mode on the pins of the port.
*
* Parameters:
* mode: Change the pins to one of the following drive modes.
*
* SW2_DM_STRONG Strong Drive
* SW2_DM_OD_HI Open Drain, Drives High
* SW2_DM_OD_LO Open Drain, Drives Low
* SW2_DM_RES_UP Resistive Pull Up
* SW2_DM_RES_DWN Resistive Pull Down
* SW2_DM_RES_UPDWN Resistive Pull Up/Down
* SW2_DM_DIG_HIZ High Impedance Digital
* SW2_DM_ALG_HIZ High Impedance Analog
*
* Return:
* None
*
*******************************************************************************/
void SW2_SetDriveMode(uint8 mode)
{
SetP4PinDriveMode(SW2__0__SHIFT, mode);
}
/*******************************************************************************
* Function Name: SW2_Read
********************************************************************************
*
* Summary:
* Read the current value on the pins of the Digital Port in right justified
* form.
*
* Parameters:
* None
*
* Return:
* Returns the current value of the Digital Port as a right justified number
*
* Note:
* Macro SW2_ReadPS calls this function.
*
*******************************************************************************/
uint8 SW2_Read(void)
{
return (uint8)((SW2_PS & SW2_MASK) >> SW2_SHIFT);
}
/*******************************************************************************
* Function Name: SW2_ReadDataReg
********************************************************************************
*
* Summary:
* Read the current value assigned to a Digital Port's data output register
*
* Parameters:
* None
*
* Return:
* Returns the current value assigned to the Digital Port's data output register
*
*******************************************************************************/
uint8 SW2_ReadDataReg(void)
{
return (uint8)((SW2_DR & SW2_MASK) >> SW2_SHIFT);
}
/* If Interrupts Are Enabled for this Pins component */
#if defined(SW2_INTSTAT)
/*******************************************************************************
* Function Name: SW2_ClearInterrupt
********************************************************************************
*
* Summary:
* Clears any active interrupts attached to port and returns the value of the
* interrupt status register.
*
* Parameters:
* None
*
* Return:
* Returns the value of the interrupt status register
*
*******************************************************************************/
uint8 SW2_ClearInterrupt(void)
{
uint8 maskedStatus = (uint8)(SW2_INTSTAT & SW2_MASK);
SW2_INTSTAT = maskedStatus;
return maskedStatus >> SW2_SHIFT;
}
#endif /* If Interrupts Are Enabled for this Pins component */
/* [] END OF FILE */
|
/* Header for GDB line completion.
Copyright (C) 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#if !defined (LINESPEC_H)
#define LINESPEC_H 1
struct symtab;
extern struct symtabs_and_lines
decode_line_1 (char **argptr, int funfirstline,
struct symtab *default_symtab, int default_line,
char ***canonical, int *not_found_ptr);
#endif /* defined (LINESPEC_H) */
|
/*
* Copyright (c) 2008 Intel Corporation
* Author: Matthew Wilcox <willy@linux.intel.com>
*
* Distributed under the terms of the GNU GPL, version 2
*
* Please see kernel/semaphore.c for documentation of these functions
*/
#ifndef __LINUX_SEMAPHORE_H
#define __LINUX_SEMAPHORE_H
#include <linux/list.h>
#include <linux/spinlock.h>
/* Please don't access any members of this structure directly */
struct semaphore {
spinlock_t lock;
unsigned int count;
struct list_head wait_list;
};
#define __SEMAPHORE_INITIALIZER(name, n) \
{ \
.lock = __SPIN_LOCK_UNLOCKED((name).lock), \
.count = n, \
.wait_list = LIST_HEAD_INIT((name).wait_list), \
}
#define DECLARE_MUTEX(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
#define DEFINE_SEMAPHORE(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
static inline void sema_init(struct semaphore *sem, int val)
{
static struct lock_class_key __key;
*sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
}
#define init_MUTEX(sem) sema_init(sem, 1)
#define init_MUTEX_LOCKED(sem) sema_init(sem, 0)
extern void down(struct semaphore *sem);
extern int __must_check down_interruptible(struct semaphore *sem);
extern int __must_check down_killable(struct semaphore *sem);
extern int __must_check down_trylock(struct semaphore *sem);
extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
extern void up(struct semaphore *sem);
#endif /* __LINUX_SEMAPHORE_H */
|
//
// BFLabel.h
// OpenShop
//
// Created by Petr Škorňok on 20.01.16.
// Copyright © 2016 Business-Factory. All rights reserved.
//
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
/**
* `BFAlignedImageButton` extends `UIButton` to reposition button's image at the right edge
* of the title text.
*/
IB_DESIGNABLE
@interface BFLabel : UILabel
/**
* Set custom font name for attributed label.
*/
@property (nonatomic, copy) IBInspectable NSString* fontName;
@end
NS_ASSUME_NONNULL_END
|
// view_pypad_errors.h
//
// View the Edit Log for a PyPAD Instance
//
// (C) Copyright 2018-2019 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef VIEW_PYPAD_ERRORS_H
#define VIEW_PYPAD_ERRORS_H
#include <qpushbutton.h>
#include <qtextedit.h>
#include <rddialog.h>
class ViewPypadErrors : public RDDialog
{
Q_OBJECT
public:
ViewPypadErrors(int id,QWidget *parent=0);
QSize sizeHint() const;
private slots:
void closeData();
protected:
void resizeEvent(QResizeEvent *e);
private:
QTextEdit *view_text;
QPushButton *view_close_button;
};
#endif // VIEW_PYPAD_ERRORS_H
|
/* Masquerade. Simple mapping which alters range to a local IP address
(depending on route). */
/* (C) 1999-2001 Paul `Rusty' Russell
* (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/types.h>
#include <linux/inetdevice.h>
#include <linux/ip.h>
#include <linux/timer.h>
#include <linux/module.h>
#include <linux/netfilter.h>
#include <net/protocol.h>
#include <net/ip.h>
#include <net/checksum.h>
#include <net/route.h>
#include <net/netfilter/nf_nat_rule.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter/x_tables.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
MODULE_DESCRIPTION("Xtables: automatic-address SNAT");
/* Lock protects masq region inside conntrack */
static DEFINE_RWLOCK(masq_lock);
/* FIXME: Multiple targets. --RR */
static bool masquerade_tg_check(const struct xt_tgchk_param *par)
{
const struct nf_nat_multi_range_compat *mr = par->targinfo;
if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
pr_debug("masquerade_check: bad MAP_IPS.\n");
return false;
}
if (mr->rangesize != 1) {
pr_debug("masquerade_check: bad rangesize %u\n", mr->rangesize);
return false;
}
return true;
}
static unsigned int
masquerade_tg(struct sk_buff *skb, const struct xt_target_param *par)
{
struct nf_conn *ct;
struct nf_conn_nat *nat;
enum ip_conntrack_info ctinfo;
struct nf_nat_range newrange;
const struct nf_nat_multi_range_compat *mr;
const struct rtable *rt;
__be32 newsrc;
NF_CT_ASSERT(par->hooknum == NF_INET_POST_ROUTING);
ct = nf_ct_get(skb, &ctinfo);
nat = nfct_nat(ct);
NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
|| ctinfo == IP_CT_RELATED_REPLY));
/* Source address is 0.0.0.0 - locally generated packet that is
* probably not supposed to be masqueraded.
*/
if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip == 0)
return NF_ACCEPT;
mr = par->targinfo;
rt = skb->rtable;
newsrc = inet_select_addr(par->out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
if (!newsrc) {
printk("MASQUERADE: %s ate my IP address\n", par->out->name);
return NF_DROP;
}
write_lock_bh(&masq_lock);
nat->masq_index = par->out->ifindex;
write_unlock_bh(&masq_lock);
/* Transfer from original range. */
newrange = ((struct nf_nat_range)
{ mr->range[0].flags | IP_NAT_RANGE_MAP_IPS,
newsrc, newsrc,
mr->range[0].min, mr->range[0].max });
/* Hand modified range to generic setup. */
return nf_nat_setup_info(ct, &newrange, IP_NAT_MANIP_SRC);
}
static int
device_cmp(struct nf_conn *i, void *ifindex)
{
const struct nf_conn_nat *nat = nfct_nat(i);
int ret;
if (!nat)
return 0;
read_lock_bh(&masq_lock);
ret = (nat->masq_index == (int)(long)ifindex);
read_unlock_bh(&masq_lock);
return ret;
}
static int masq_device_event(struct notifier_block *this,
unsigned long event,
void *ptr)
{
const struct net_device *dev = ptr;
struct net *net = dev_net(dev);
if (event == NETDEV_DOWN) {
/* Device was downed. Search entire table for
conntracks which were associated with that device,
and forget them. */
NF_CT_ASSERT(dev->ifindex != 0);
nf_ct_iterate_cleanup(net, device_cmp,
(void *)(long)dev->ifindex);
}
return NOTIFY_DONE;
}
static int masq_inet_event(struct notifier_block *this,
unsigned long event,
void *ptr)
{
struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
return masq_device_event(this, event, dev);
}
static struct notifier_block masq_dev_notifier = {
.notifier_call = masq_device_event,
};
static struct notifier_block masq_inet_notifier = {
.notifier_call = masq_inet_event,
};
static struct xt_target masquerade_tg_reg __read_mostly = {
.name = "MASQUERADE",
.family = NFPROTO_IPV4,
.target = masquerade_tg,
.targetsize = sizeof(struct nf_nat_multi_range_compat),
.table = "nat",
.hooks = 1 << NF_INET_POST_ROUTING,
.checkentry = masquerade_tg_check,
.me = THIS_MODULE,
};
static int __init masquerade_tg_init(void)
{
int ret;
ret = xt_register_target(&masquerade_tg_reg);
if (ret == 0) {
/* Register for device down reports */
register_netdevice_notifier(&masq_dev_notifier);
/* Register IP address change reports */
register_inetaddr_notifier(&masq_inet_notifier);
}
return ret;
}
static void __exit masquerade_tg_exit(void)
{
xt_unregister_target(&masquerade_tg_reg);
unregister_netdevice_notifier(&masq_dev_notifier);
unregister_inetaddr_notifier(&masq_inet_notifier);
}
module_init(masquerade_tg_init);
module_exit(masquerade_tg_exit);
|
#ifndef __UOS_ASSERT__H_
#define __UOS_ASSERT__H_ 1
/* This prints an "Assertion failed" message and aborts. */
#ifdef NDEBUG
# define __assert_fail(a,b,c,d) __assert_fail_ndebug()
void __assert_fail_ndebug ();
#else
void __assert_fail (const char *expr, const char *file,
unsigned line, const char *func);
#endif
/*
* Permanent assertion, independent of NDEBUG macro.
* Example:
* assert_always (ptr != NULL);
*/
#define assert_always(condition) do { \
if (__builtin_expect (! (condition), 0)) \
__assert_fail (#condition, __FILE__, \
__LINE__, __PRETTY_FUNCTION__); \
} while (0)
/*
* void assert (int expression);
*
* If NDEBUG is defined, do nothing.
* If not, and EXPRESSION is zero, print an error message and abort.
*/
#ifdef NDEBUG
# define assert(expr) do {} while (0)
#else
# define assert(expr) assert_always(expr)
#endif
#endif /* __UOS_ASSERT__H_ */
|
/*
* error.c -- Error handling routines
*
* Copyright (C) 2010-2012, Computing Systems Laboratory (CSLab)
* Copyright (C) 2010-2012, Vasileios Karakasis
*/
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "error.h"
#define ERRMSG_LEN 4096
char *program_name = NULL;
static void
do_error(int use_errno, const char *fmt, va_list arg)
{
char errmsg[ERRMSG_LEN];
*errmsg = '\0'; /* ensure initialization of errmsg */
if (program_name)
snprintf(errmsg, ERRMSG_LEN, "%s: ", program_name);
vsnprintf(errmsg + strlen(errmsg), ERRMSG_LEN, fmt, arg);
if (use_errno && errno)
/* errno is set */
snprintf(errmsg + strlen(errmsg), ERRMSG_LEN,
": %s", strerror(errno));
strncat(errmsg, "\n", ERRMSG_LEN);
fflush(stdout); /* in case stdout and stderr are the same */
fputs(errmsg, stderr);
fflush(NULL);
return;
}
void
set_program_name(char *path)
{
if (!program_name)
program_name = strdup(path);
if (!program_name)
error(1, "strdup failed");
}
void
warning(int use_errno, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
do_error(use_errno, fmt, ap);
va_end(ap);
return;
}
void
error(int use_errno, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
do_error(use_errno, fmt, ap);
va_end(ap);
exit(EXIT_FAILURE);
}
void
fatal(int use_errno, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
do_error(use_errno, fmt, ap);
va_end(ap);
abort();
exit(EXIT_FAILURE); /* should not get here */
}
|
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 JITWriteBarrier_h
#define JITWriteBarrier_h
#if ENABLE(JIT)
#include "MacroAssembler.h"
#include "SlotVisitor.h"
#include "UnusedPointer.h"
#include "WriteBarrier.h"
namespace JSC {
class JSCell;
class VM;
// Needs to be even to appease some of the backends.
#define JITWriteBarrierFlag ((void*)2)
class JITWriteBarrierBase {
public:
typedef void* (JITWriteBarrierBase::*UnspecifiedBoolType);
operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
bool operator!() const { return !get(); }
void setFlagOnBarrier()
{
ASSERT(!m_location);
m_location = CodeLocationDataLabelPtr(JITWriteBarrierFlag);
}
bool isFlagged() const
{
return !!m_location;
}
void setLocation(CodeLocationDataLabelPtr location)
{
ASSERT(!m_location);
m_location = location;
}
CodeLocationDataLabelPtr location() const
{
ASSERT((!!m_location) && m_location.executableAddress() != JITWriteBarrierFlag);
return m_location;
}
void clear() { clear(0); }
void clearToUnusedPointer() { clear(reinterpret_cast<void*>(unusedPointer)); }
protected:
JITWriteBarrierBase()
{
}
void set(VM&, CodeLocationDataLabelPtr location, JSCell* owner, JSCell* value)
{
Heap::writeBarrier(owner, value);
m_location = location;
ASSERT(((!!m_location) && m_location.executableAddress() != JITWriteBarrierFlag) || (location.executableAddress() == m_location.executableAddress()));
MacroAssembler::repatchPointer(m_location, value);
ASSERT(get() == value);
}
JSCell* get() const
{
if (!m_location || m_location.executableAddress() == JITWriteBarrierFlag)
return 0;
void* result = static_cast<JSCell*>(MacroAssembler::readPointer(m_location));
if (result == reinterpret_cast<void*>(unusedPointer))
return 0;
return static_cast<JSCell*>(result);
}
private:
void clear(void* clearedValue)
{
if (!m_location)
return;
if (m_location.executableAddress() != JITWriteBarrierFlag)
MacroAssembler::repatchPointer(m_location, clearedValue);
}
CodeLocationDataLabelPtr m_location;
};
#undef JITWriteBarrierFlag
template <typename T> class JITWriteBarrier : public JITWriteBarrierBase {
public:
JITWriteBarrier()
{
}
void set(VM& vm, CodeLocationDataLabelPtr location, JSCell* owner, T* value)
{
validateCell(owner);
validateCell(value);
JITWriteBarrierBase::set(vm, location, owner, value);
}
void set(VM& vm, JSCell* owner, T* value)
{
set(vm, location(), owner, value);
}
T* get() const
{
T* result = static_cast<T*>(JITWriteBarrierBase::get());
if (result)
validateCell(result);
return result;
}
};
template<typename T> inline void SlotVisitor::append(JITWriteBarrier<T>* slot)
{
internalAppend(slot->get());
}
}
#endif // ENABLE(JIT)
#endif
|
/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard.
*/
#import "SBAlert.h"
@class NSString;
@interface SBCallFailureAlert : SBAlert
{
int _causeCode; // 48 = 0x30
NSString *_address; // 52 = 0x34
int _uid; // 56 = 0x38
struct __CTCall *_call; // 60 = 0x3c
}
+ (void)activateForCall:(struct __CTCall *)fp8 causeCode:(long)fp12; // IMP=0x0006212c
+ (BOOL)shouldDisplayForCauseCode:(long)fp8 modemCauseCode:(long)fp12; // IMP=0x000620ac
+ (void)test; // IMP=0x00062234
- (void)activateWhenPossible; // IMP=0x000620c0
- (int)addressBookUID; // IMP=0x0006238c
- (id)alertDisplayViewWithSize:(struct CGSize)fp8; // IMP=0x0006231c
- (struct __CTCall *)call; // IMP=0x0006237c
- (id)callAddress; // IMP=0x00062384
- (long)causeCode; // IMP=0x00062374
- (void)dealloc; // IMP=0x00062048
- (id)initWithCauseCode:(long)fp8 call:(struct __CTCall *)fp12; // IMP=0x00061f78
- (void)setCallAddress:(id)fp8; // IMP=0x00062394
@end
|
/*
* linux/init/version.c
*
* Copyright (C) 1992 Theodore Ts'o
*
* May be freely distributed as part of Linux.
*/
#include <linux/compile.h>
#include <linux/module.h>
#include <linux/uts.h>
#include <linux/utsname.h>
#include <linux/utsrelease.h>
#include <linux/version.h>
#ifndef CONFIG_KALLSYMS
#define version(a) Version_ ## a
#define version_string(a) version(a)
extern int version_string(LINUX_VERSION_CODE);
int version_string(LINUX_VERSION_CODE);
#endif
struct uts_namespace init_uts_ns = {
.kref = {
.refcount = ATOMIC_INIT(2),
},
.name = {
.sysname = UTS_SYSNAME,
.nodename = UTS_NODENAME,
.release = UTS_RELEASE,
.version = UTS_VERSION,
.machine = UTS_MACHINE,
.domainname = UTS_DOMAINNAME,
},
};
EXPORT_SYMBOL_GPL(init_uts_ns);
/* FIXED STRINGS! Don't touch! */
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
const char linux_proc_banner[] =
"%s version %s" "-" LINUX_CODE_NAME
" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
" (" LINUX_COMPILER ") %s\n";
|
/*
* Copyright (C) 1996-2022 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
#ifndef SQUID_IOSTATS_H_
#define SQUID_IOSTATS_H_
/// IO statistics. Currently a POD.
class IoStats
{
public:
static const int histSize=16;
struct {
int reads;
int reads_deferred;
int read_hist[histSize];
int writes;
int write_hist[histSize];
}
Http, Ftp, Gopher;
};
#endif /* SQUID_IOSTATS_H_ */
|
/*
* Copyright (C) 2007 Francois Gouget
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_USERENV_H
#define __WINE_USERENV_H
/* FIXME: #include <wbemcli.h> */
#include <profinfo.h>
#define PT_TEMPORARY 0x00000001
#define PT_ROAMING 0x00000002
#define PT_MANDATORY 0x00000004
#ifdef __cplusplus
extern "C" {
#endif
BOOL WINAPI CreateEnvironmentBlock(LPVOID*,HANDLE,BOOL);
BOOL WINAPI DestroyEnvironmentBlock(LPVOID);
BOOL WINAPI ExpandEnvironmentStringsForUserA(HANDLE,LPCSTR,LPSTR,DWORD);
BOOL WINAPI ExpandEnvironmentStringsForUserW(HANDLE,LPCWSTR,LPWSTR,DWORD);
#define ExpandEnvironmentStringsForUser WINELIB_NAME_AW(ExpandEnvironmentStringsForUser)
BOOL WINAPI GetUserProfileDirectoryA(HANDLE,LPSTR,LPDWORD);
BOOL WINAPI GetUserProfileDirectoryW(HANDLE,LPWSTR,LPDWORD);
#define GetUserProfileDirectory WINELIB_NAME_AW(GetUserProfileDirectory)
BOOL WINAPI GetProfilesDirectoryA(LPSTR,LPDWORD);
BOOL WINAPI GetProfilesDirectoryW(LPWSTR,LPDWORD);
#define GetProfilesDirectory WINELIB_NAME_AW(GetProfilesDirectory)
BOOL WINAPI GetAllUsersProfileDirectoryA(LPSTR,LPDWORD);
BOOL WINAPI GetAllUsersProfileDirectoryW(LPWSTR,LPDWORD);
#define GetAllUsersProfileDirectory WINELIB_NAME_AW(GetAllUsersProfileDirectory)
BOOL WINAPI GetProfileType(DWORD*);
BOOL WINAPI LoadUserProfileA(HANDLE,LPPROFILEINFOA);
BOOL WINAPI LoadUserProfileW(HANDLE,LPPROFILEINFOW);
#define LoadUserProfile WINELIB_NAME_AW(LoadUserProfile)
BOOL WINAPI RegisterGPNotification(HANDLE,BOOL);
BOOL WINAPI UnloadUserProfile(HANDLE,HANDLE);
BOOL WINAPI UnregisterGPNotification(HANDLE);
#ifdef __cplusplus
}
#endif
#endif /* __WINE_USERENV_H */
|
int a,b,c;
int main()
{
float a,b;
a = 7.5;
c = a;
if (c > 7.1)
{
int a,b;
a = c+3*(10/9);
b = a/2/2;
printf("%d",b);
}
printf("%g",a);
printf("%d",c);
}
|
/*
* @file libservo.c
*
* @author Andy Lindsay
*
* @copyright
* Copyright (C) Parallax, Inc. 2013. All Rights MIT Licensed.
*
* @brief Project and test harness for the servo library for standard servos.
*/
void pulse_outCtr(int pin, int time);
#include "servo.h"
//#include "servoAux.h"
#include "simpletools.h"
int main()
{
servo_angle(0, 0);
servo_angle(1, 100);
servo_angle(2, 200);
servo_angle(3, 300);
servo_angle(4, 400);
servo_angle(5, 500);
servo_angle(6, 600);
servo_angle(7, 700);
servo_angle(8, 800);
servo_angle(9, 900);
servo_angle(10, 1000);
servo_angle(11, 1100);
servo_angle(12, 1200);
servo_angle(13, 1300);
/*
*/
//servo_speed(14, 0);
//servo_speed(15, 0);
}
|
/* time.h
written by Marc Singer
26 Aug 2008
Copyright (C) 2008 Marc Singer
-----------
DESCRIPTION
-----------
*/
#if !defined (__TIME_H__)
# define __TIME_H__
/* ----- Includes */
#include <linux/types.h>
/* ----- Types */
//typedef signed long time_t;
struct tm {
int tm_sec; /* Seconds. [0-60] (1 leap second) */
int tm_min; /* Minutes. [0-59] */
int tm_hour; /* Hours. [0-23] */
int tm_mday; /* Day. [1-31] */
int tm_mon; /* Month. [0-11] */
int tm_year; /* Year - 1900. */
int tm_wday; /* Day of week. [0-6] */
int tm_yday; /* Days in year.[0-365] */
int tm_isdst; /* DST. [-1/0/1]*/
long int tm_gmtoff; /* Seconds east of UTC. */
const char *tm_zone; /* Timezone abbreviation. */
};
/* ----- Globals */
/* ----- Prototypes */
struct tm* gmtime_r (const time_t* time_p, struct tm* tm_p);
char *asctime_r (const struct tm *t, char *buf);
#endif /* __TIME_H__ */
|
/*
* * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>,
* * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef GTK_INTERFACE_H
#define GTK_INTERFACE_H
enum {
OP_NONE = 0,
OP_BUSY,
OP_MOVE
};
extern void gui_set_busy(gboolean rawstudio_is_busy);
extern gboolean gui_is_busy(void);
extern void gui_status_notify(const char *text);
extern void gui_status_error(const char *text);
extern guint gui_status_push(const char *text) G_GNUC_WARN_UNUSED_RESULT;
extern void gui_status_pop(const guint msgid);
extern void icon_set_flags(const gchar *filename, GtkTreeIter *iter, const guint *priority, const gboolean *exported);
extern void gui_dialog_simple(gchar *title, gchar *message);
extern GtkUIManager *gui_get_uimanager(void);
extern void gui_set_values(RS_BLOB *rs, gint x, gint y);
extern int gui_init(int argc, char **argv, RS_BLOB *rs);
extern void gui_setprio(RS_BLOB *rs, guint prio);
extern void gui_widget_show(GtkWidget *widget, gboolean show, const gchar *conf_fullscreen_key, const gchar *conf_windowed_key);
extern gboolean gui_fullscreen_changed(GtkWidget *widget, gboolean is_fullscreen, const gchar *action,
gboolean default_fullscreen, gboolean default_windowed,
const gchar *conf_fullscreen_key, const gchar *conf_windowed_key);
extern void gui_make_preference_window(RS_BLOB *rs);
extern void rs_window_set_title(const char *str);
extern void gui_select_preview_screen(RS_BLOB *rs);
extern void gui_disable_preview_screen(RS_BLOB *rs);
extern GtkWindow *rawstudio_window;
#endif /* GTK_INTERFACE_H */
|
/*
* group_box.h - LMMS-groupbox
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _GROUP_BOX_H
#define _GROUP_BOX_H
#include <QtGui/QWidget>
#include "AutomatableModelView.h"
#include "pixmap_button.h"
class QPixmap;
class groupBox : public QWidget, public BoolModelView
{
Q_OBJECT
public:
groupBox( const QString & _caption, QWidget * _parent = NULL );
virtual ~groupBox();
virtual void modelChanged();
pixmapButton * ledButton()
{
return m_led;
}
int titleBarHeight() const
{
return m_titleBarHeight;
}
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * _re );
private:
void updatePixmap();
pixmapButton * m_led;
QString m_caption;
const int m_titleBarHeight;
} ;
typedef BoolModel groupBoxModel;
#endif
|
/*
* Android build config for libusb
* Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
* Copyright © 2013-2016 Martin Marinov <martintzvetomirov@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Start with debug message logging enabled */
#undef ENABLE_DEBUG_LOGGING
/* Message logging */
#define ENABLE_LOGGING
//#define ENABLE_DEBUG_LOGGING
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Linux backend */
#define OS_LINUX 1
/* Enable output to system log */
#define USE_SYSTEM_LOGGING_FACILITY 1
/* type of second poll() argument */
#define POLL_NFDS_TYPE nfds_t
/* Use POSIX Threads */
#define THREADS_POSIX 1
/* Default visibility */
#define DEFAULT_VISIBILITY __attribute__((visibility("default")))
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <linux/filter.h> header file. */
#define HAVE_LINUX_FILTER_H 1
/* Define to 1 if you have the <linux/netlink.h> header file. */
#define HAVE_LINUX_NETLINK_H 1
/* Define to 1 if you have the <asm/types.h> header file. */
#define HAVE_ASM_TYPES_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
|
/**
* \file
*
* \brief Board configuration
*
* Copyright (c) 2012 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.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* 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 CONF_BOARD_H_INCLUDED
#define CONF_BOARD_H_INCLUDED
#define CONF_BOARD_UART_CONSOLE
#define CONF_BOARD_SMC_PSRAM
#endif /* CONF_BOARD_H_INCLUDED */
|
/*
* Copyright (c) 2015 Cedric Hnyda <chnyda@suse.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it would 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 the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Create a virtual device, activate auto-repeat and
* and check that auto repeat is working
*/
#include <linux/input.h>
#include <linux/uinput.h>
#include <linux/kd.h>
#include "test.h"
#include "safe_macros.h"
#include "lapi/fcntl.h"
#include "input_helper.h"
static void setup(void);
static void send_events(void);
static int check_events(void);
static void cleanup(void);
static int fd;
static int fd2;
struct input_event events[64];
static int num_events;
static int ev_iter;
char *TCID = "input06";
int main(int ac, char **av)
{
int lc;
int pid;
tst_parse_opts(ac, av, NULL, NULL);
setup();
for (lc = 0; TEST_LOOPING(lc); ++lc) {
pid = tst_fork();
switch (pid) {
case 0:
send_events();
exit(0);
case -1:
tst_brkm(TBROK | TERRNO, cleanup, "fork() failed");
default:
if (!check_events())
tst_resm(TFAIL,
"Wrong data received in eventX");
else
tst_resm(TPASS, "Data received in eventX");
break;
}
SAFE_WAITPID(NULL, pid, NULL, 0);
}
cleanup();
tst_exit();
}
static void setup(void)
{
tst_require_root();
fd = open_uinput();
SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_KEY);
SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_REP);
SAFE_IOCTL(NULL, fd, UI_SET_KEYBIT, KEY_X);
create_device(fd);
fd2 = open_device();
SAFE_IOCTL(NULL, fd2, EVIOCGRAB, 1);
}
static void send_events(void)
{
send_event(fd, EV_KEY, KEY_X, 1);
send_event(fd, EV_SYN, 0, 0);
/*
* Sleep long enough to keep the key pressed for some time
* (auto-repeat). Default kernel delay to start auto-repeat is 250ms
* and the period is 33ms. So, we wait for a generous 500ms to make
* sure we get the auto-repeated keys
*/
usleep(500000);
send_event(fd, EV_KEY, KEY_X, 0);
send_event(fd, EV_SYN, 0, 0);
}
static int check_event(struct input_event *iev, int event, int code, int value)
{
return iev->type == event && iev->code == code && iev->value == value;
}
static int check_event_code(struct input_event *iev, int event, int code)
{
return iev->type == event && iev->code == code;
}
static void read_events(void)
{
int rd = read(fd2, events, sizeof(events));
if (rd < 0)
tst_brkm(TBROK | TERRNO, cleanup, "read() failed");
if (rd == 0)
tst_brkm(TBROK, cleanup, "Failed to read events");
if (rd % sizeof(struct input_event) != 0) {
tst_brkm(TBROK, cleanup, "read size %i not multiple of %zu",
rd, sizeof(struct input_event));
}
ev_iter = 0;
num_events = rd / sizeof(struct input_event);
}
static int have_events(void)
{
return num_events && ev_iter < num_events;
}
static struct input_event *next_event(void)
{
if (!have_events())
read_events();
return &events[ev_iter++];
}
static int check_sync_event(void)
{
return check_event_code(next_event(), EV_SYN, SYN_REPORT);
}
static int parse_autorepeat_config(struct input_event *iev)
{
if (!check_event_code(iev, EV_REP, REP_DELAY)) {
tst_resm(TFAIL,
"Didn't get EV_REP configuration with code REP_DELAY");
return 0;
}
if (!check_event_code(next_event(), EV_REP, REP_PERIOD)) {
tst_resm(TFAIL,
"Didn't get EV_REP configuration with code REP_PERIOD");
return 0;
}
return 1;
}
static int parse_key(struct input_event *iev)
{
int autorep_count = 0;
if (!check_event(iev, EV_KEY, KEY_X, 1) || !check_sync_event()) {
tst_resm(TFAIL, "Didn't get expected key press for KEY_X");
return 0;
}
iev = next_event();
while (check_event(iev, EV_KEY, KEY_X, 2) && check_sync_event()) {
autorep_count++;
iev = next_event();
}
/* make sure we have atleast one auto-repeated key event */
if (!autorep_count) {
tst_resm(TFAIL,
"Didn't get autorepeat events for the key - KEY_X");
return 0;
}
if (!check_event(iev, EV_KEY, KEY_X, 0) || !check_sync_event()) {
tst_resm(TFAIL,
"Didn't get expected key release for KEY_X");
return 0;
}
tst_resm(TINFO,
"Received %d repititions for KEY_X", autorep_count);
return 1;
}
static int check_events(void)
{
struct input_event *iev;
int ret;
int rep_config_done = 0;
int rep_keys_done = 0;
read_events();
while (have_events()) {
iev = next_event();
switch (iev->type) {
case EV_REP:
ret = parse_autorepeat_config(iev);
rep_config_done = 1;
break;
case EV_KEY:
ret = parse_key(iev);
rep_keys_done = 1;
break;
default:
tst_resm(TFAIL,
"Unexpected event type '0x%04x' received",
iev->type);
ret = 0;
break;
}
if (!ret || (rep_config_done && rep_keys_done))
break;
}
return ret;
}
static void cleanup(void)
{
if (fd2 > 0 && close(fd2))
tst_resm(TWARN | TERRNO, "close(fd2) failed");
destroy_device(fd);
}
|
#ifndef HZPI_H
#define HZPI_H
#include "structures.h"
struct common *hzpi(void);
#endif /* HZPI_H */
|
#include <xc.h>
#include <stdio.h>
#include "usart.h"
void
putch(unsigned char byte)
{
/* output one byte */
while(!TXIF) /* set when register is empty */
continue;
TXREG = byte;
}
unsigned char
getch() {
/* retrieve one byte */
while(!RCIF) /* set when register is not empty */
continue;
return RCREG;
}
unsigned char
getche(void)
{
unsigned char c;
putch(c = getch());
return c;
}
|
/* repdoc.c -- Program to strip doc-strings from C source
Copyright (C) 1993, 1994 John Harper <john@dcs.warwick.ac.uk>
$Id$
This file is part of Jade.
Jade is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Jade 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 Jade; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include <string.h>
#include <gdbm.h>
#include <fcntl.h>
#include <stdlib.h>
#ifndef GDBM_NOLOCK
# define GDBM_NOLOCK 0
#endif
static void
usage(void)
{
fputs("usage: repdoc doc-file [src-files...]\n", stderr);
exit(1);
}
static void
scanfile(FILE *src, GDBM_FILE sdbm)
{
char buf[512];
while(fgets(buf, 512, src))
{
char *start = strstr(buf, "::doc:");
if(start)
{
datum key, value;
char buf[16384]; /* so lazy.. */
char *out = buf;
char *id = start + 6;
start = strstr (id, "::");
if (start == 0)
continue;
*start = 0;
while(fgets(out, sizeof (buf) - (out - buf), src))
{
char *end = strstr (out, "::end::");
if (end != 0)
break;
out += strlen(out);
}
/* ignore trailing newline */
if (out > buf)
out--;
*out = 0;
key.dptr = id;
key.dsize = strlen(id);
value.dptr = buf;
value.dsize = strlen(buf);
if (gdbm_store (sdbm, key, value, GDBM_REPLACE) < 0)
perror ("gdbm_store");
}
}
}
int
main(int ac, char **av)
{
GDBM_FILE docdbm;
ac--;
av++;
if(ac < 2)
usage();
docdbm = gdbm_open(*av++, 0, GDBM_WRCREAT | GDBM_NOLOCK, 0666, 0);
ac--;
if(docdbm == 0)
{
fprintf(stderr, "can't open output files.\n");
exit(2);
}
if(!ac)
scanfile(stdin, docdbm);
else
{
while(ac)
{
FILE *file = fopen(*av, "r");
if(file)
{
scanfile(file, docdbm);
fclose(file);
}
ac--;
av++;
}
}
return 0;
}
|
/*
** File: evisimagedisplaywidget.h
** Author: Peter J. Ersts ( ersts at amnh.org )
** Creation Date: 2007-03-13
**
** Copyright ( c ) 2007, American Museum of Natural History. All rights reserved.
**
** This library/program is free software; you can redistribute it
** and/or modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or ( at your option ) any later version.
**
** This library/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
** Library General Public License for more details.
**
** This work was made possible through a grant by the the John D. and
** Catherine T. MacArthur Foundation. Additionally, this program was prepared by
** the American Museum of Natural History under award No. NA05SEC46391002
** from the National Oceanic and Atmospheric Administration, U.S. Department
** of Commerce. The statements, findings, conclusions, and recommendations
** are those of the author( s ) and do not necessarily reflect the views of the
** National Oceanic and Atmospheric Administration or the Department of Commerce.
**
**/
#ifndef EVISIMAGEDISPLAYWIDGET_H
#define EVISIMAGEDISPLAYWIDGET_H
#include <QLabel>
#include <QWidget>
#include <QScrollArea>
#include <QPushButton>
#include <QBuffer>
#include <QHttp>
#include <QResizeEvent>
/**
* \class eVisGenericEventBrowserGui
* \brief Generic viewer for browsing event
* The eVisImageDisplayWidget is a component of the eVisGenericEventBrowser. This widget provides
* the ability to display an image on the widget and basic zoom capabilities. This class was created
* so the same display features could be easily added to other widgets as needed.
*/
class eVisImageDisplayWidget : public QWidget
{
Q_OBJECT
public:
/** \brief Constructor */
eVisImageDisplayWidget( QWidget* parent = 0, Qt::WFlags fl = 0 );
/** \brief Destructor */
~eVisImageDisplayWidget();
/** \brief Load an image from disk and display */
void displayImage( QString );
/** \brief Load an image from a remote location using http and display */
void displayUrlImage( QString );
/*
* There needs to be more logic around setting the zoom steps as you could change it mid display
* and end up getting not being able to zoom in or out
*/
/** \brief Accessor for ZOOM_STEPS */
int getZoomSteps( ) { return ZOOM_STEPS; }
/** \brief Mutator for ZOON_STEPS */
void setZoomSteps( int steps ) { ZOOM_STEPS = steps; }
protected:
void resizeEvent( QResizeEvent *event );
private:
/** \brief Used to hold the http request to match the correct emits with the correct result */
int mCurrentHttpImageRequestId;
/** \brief CUrrent Zoom level */
int mCurrentZoomStep;
/** \brief widget to display the image in */
QScrollArea* mDisplayArea;
/** \brief Method that acually display the image in the widget */
void displayImage( );
/** \brief Pointer to the http buffer */
QBuffer* mHttpBuffer;
/** \brief Pointer to the http connection if needed */
QHttp* mHttpConnection;
/** \brief This is a point to the actual image being displayed */
QPixmap* mImage;
/** \brief Label to hold the image */
QLabel* mImageLabel;
/** \brief Flag to indicate the success of the last load request */
bool mImageLoaded;
/** \brief Ratio if height to width or width to height for the original image, which ever is smaller */
double mImageSizeRatio;
/** \brief Boolean to indicate which feature the mImageSizeRation corresponds to */
bool mScaleByHeight;
/** \brief Boolean to indicate which feature the mImageSizeRation corresponds to */
bool mScaleByWidth;
/** \brief The increment by which the image is scaled during each scaling event */
double mScaleFactor;
/** \brief The single factor by which the original image needs to be scaled to fit into current display area */
double mScaleToFit;
/** \brief Zoom in button */
QPushButton* pbtnZoomIn;
/** \brief Zoom out button */
QPushButton* pbtnZoomOut;
/** \brief Zoom to full extent button */
QPushButton* pbtnZoomFull;
/** \brief Method called to compute the various scaling parameters */
void setScalers( );
/** \brief The number of steps between the scale to fit image and full resolution */
int ZOOM_STEPS;
private slots:
void on_pbtnZoomIn_clicked( );
void on_pbtnZoomOut_clicked( );
void on_pbtnZoomFull_clicked( );
/** \brief Slot called when the http request is completed */
void displayUrlImage( int, bool );
};
#endif
|
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "i2cbusses.h"
#include "util.h"
#include "i2c-dev.h" //I2C_SMBUS* Enums
#include "i2c_set.h"
#include <fcntl.h>
#include <sys/ioctl.h>
static int check_funcs(int file, int size, int pec)
{
unsigned long funcs;
/* check adapter functionality */
if (ioctl(file, I2C_FUNCS, &funcs) < 0) {
fprintf(stderr, "Error: Could not get the adapter "
"functionality matrix: %s\n", strerror(errno));
return -1;
}
switch (size) {
case I2C_SMBUS_BYTE:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "SMBus send byte");
return -1;
}
break;
case I2C_SMBUS_BYTE_DATA:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "SMBus write byte");
return -1;
}
break;
case I2C_SMBUS_WORD_DATA:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "SMBus write word");
return -1;
}
break;
case I2C_SMBUS_BLOCK_DATA:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "SMBus block write");
return -1;
}
break;
case I2C_SMBUS_I2C_BLOCK_DATA:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
fprintf(stderr, MISSING_FUNC_FMT, "I2C block write");
return -1;
}
break;
}
if (pec
&& !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) {
fprintf(stderr, "Warning: Adapter does "
"not seem to support PEC\n");
}
return 0;
}
int Set(char *i2cbusid, char *deviceaddress, char *dataaddress, char *datavalue, int bforce)
{
char *end;
int res, i2cbus, address, size, file;
int value, daddress;
char filename[20];
int pec = 0;
int force = 0;
unsigned char block[I2C_SMBUS_BLOCK_MAX];
int len;
if(bforce == 1) { force = 1; }
i2cbus = lookup_i2c_bus(i2cbusid);
if (i2cbus < 0)
return 1;
address = parse_i2c_address(deviceaddress);
if (address < 0)
return 1;
daddress = strtol(dataaddress, &end, 0);
if (*end || daddress < 0 || daddress > 0xff) {
fprintf(stderr, "Error: Data address invalid!\n");
return 1;
}
if(datavalue != NULL)
{
size = I2C_SMBUS_BYTE_DATA;
}
else
{
size = I2C_SMBUS_BYTE;
}
len = 0; /* Must always initialize len since it is passed to confirm() */
/* read values from command line */
switch (size) {
case I2C_SMBUS_BYTE_DATA:
case I2C_SMBUS_WORD_DATA:
value = strtol(datavalue, &end, 0);
if (*end || value < 0) {
fprintf(stderr, "Error: Data value invalid!\n");
return 1;
}
if ((size == I2C_SMBUS_BYTE_DATA && value > 0xff)
|| (size == I2C_SMBUS_WORD_DATA && value > 0xffff)) {
fprintf(stderr, "Error: Data value out of range!\n");
return 1;
}
break;
default:
value = -1;
break;
}
file = open_i2c_dev(i2cbus, filename, sizeof(filename), 0);
if (file < 0
|| check_funcs(file, size, pec)
|| set_slave_addr(file, address, force))
return 1;
switch (size) {
case I2C_SMBUS_BYTE:
res = i2c_smbus_write_byte(file, daddress);
break;
case I2C_SMBUS_WORD_DATA:
res = i2c_smbus_write_word_data(file, daddress, value);
break;
case I2C_SMBUS_BLOCK_DATA:
res = i2c_smbus_write_block_data(file, daddress, len, block);
break;
case I2C_SMBUS_I2C_BLOCK_DATA:
res = i2c_smbus_write_i2c_block_data(file, daddress, len, block);
break;
default: /* I2C_SMBUS_BYTE_DATA */
res = i2c_smbus_write_byte_data(file, daddress, value);
break;
}
if (res < 0) {
fprintf(stderr, "Error: Write failed\n");
close(file);
return 1;
}
close(file);
return 0;
}
|
//
// Copyright(C) 2014 Night Dive Studios, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Configuration and netgame negotiation frontend for
// Strife: Veteran Edition
//
// AUTHORS:
// James Haley
// Samuel Villarreal (Hi-Res BG code, mouse pointer)
//
#ifndef FE_CHARACTERS_H_
#define FE_CHARACTERS_H_
// Characture structure (we're faking the in-game dialogue system here :P )
typedef struct fecharacter_s
{
char *name;
char *pic;
char *voice;
char *text;
} fecharacter_t;
extern fecharacter_t *curCharacter;
fecharacter_t *FE_GetCharacter(void);
void FE_DrawChar(void);
#define FE_MERCHANT_X 296
#define FE_MERCHANT_Y 193
void FE_MerchantSetState(int statenum);
void FE_InitMerchant(void);
void FE_MerchantTick(void);
void FE_DrawMerchant(int x, int y);
extern boolean merchantOn;
#endif
// EOF
|
/*
* Copyright (C) 2007 MontaVista Software Inc.
* Copyright (C) 2006 Texas Instruments Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option)any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DAVINCIFB_H
#define DAVINCIFB_H
#define DAVINCIFB_NAME "davincifb"
/* There are 4 framebuffer devices, one per window. */
#define OSD0_FBNAME "dm_osd0_fb"
#define OSD1_FBNAME "dm_osd1_fb"
#define VID0_FBNAME "dm_vid0_fb"
#define VID1_FBNAME "dm_vid1_fb"
/* Structure for each window */
struct vpbe_dm_win_info {
struct fb_info *info;
struct vpbe_dm_info *dm;
enum davinci_disp_layer layer;
unsigned xpos;
unsigned ypos;
unsigned own_window; /* Does the framebuffer driver own this window? */
unsigned display_window;
u32 pseudo_palette[16];
};
/*
* Structure for the driver holding information of windows,
* memory base addresses etc.
*/
struct vpbe_dm_info {
struct vpbe_dm_win_info win[4];
wait_queue_head_t vsync_wait;
unsigned int vsync_cnt;
int timeout;
struct davinci_disp_callback vsync_callback;
unsigned char ram_clut[256][3];
enum davinci_pix_format yc_pixfmt;
struct fb_videomode mode;
};
#endif /* ifndef DAVINCIFB__H */
|
#ifndef __PLAYER_INFO_H
#define __PLAYER_INFO_H
#include <qframe.h>
#include <qlabel.h>
class QPixmap;
#include <qlcdnumber.h>
#include <qcolor.h>
class PlayerInfo:public QFrame
{
Q_OBJECT
public:
PlayerInfo(int pnr,QWidget *parent=0,const char *name=0);
public slots:
void setHitpoints(int h);
void setEnergy(int e);
void setWins(int w);
private:
QPixmap* pix[4];
int currentPixmap;
QLabel lplayer,lenergy,lwins;
QLCDNumber hitpoints,energy,wins;
};
#endif
|
/* This file is part of the KDE project
* Copyright (C) 2013 Camilla Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISSELECTIONEXTRAS_H
#define KISSELECTIONEXTRAS_H
#include <QObject>
class KisViewManager;
// This class prvides some extra kisselectionmanager stuff that in krita prober is in plugins
class KisSelectionExtras : public QObject
{
Q_OBJECT
public:
KisSelectionExtras(KisViewManager *view);
virtual ~KisSelectionExtras();
Q_INVOKABLE void grow(qint32 xradius, qint32 yradius);
Q_INVOKABLE void shrink(qint32 xradius, qint32 yradius, bool edge_lock);
Q_INVOKABLE void border(qint32 xradius, qint32 yradius);
Q_INVOKABLE void feather(qint32 radius);
private:
KisViewManager *m_view;
};
#endif // KISSELECTIONEXTRAS_H
|
#include <stdio.h>
#include <fcntl.h>
#ifdef _WIN32
#include <io.h>
#endif
int main(int argc, char **argv)
{
int n = 0;
int c;
if (argc > 1)
printf("unsigned char %s[] = {\n", argv[1]);
#ifdef _WIN32
_setmode(_fileno(stdin), _O_BINARY);
#endif
do
{
printf("\t");
while ((c = getchar()) != EOF)
{
printf("0x%02x, ", c);
if (++n % 12 == 0)
break;
}
printf("\n");
}
while (c != EOF);
if (argc > 1)
printf("};\nunsigned int %s_len = %d;\n", argv[1], n);
return 0;
}
|
/*
* Author: MontaVista Software, Inc. <source@mvista.com>
*
* 2005 (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.
*/
#include <linux/init.h>
#include <linux/mvl_patch.h>
static __init int regpatch(void)
{
return mvl_register_patch(273);
}
module_init(regpatch);
|
#ifndef EDIAG_H_
#define EDIAG_H_
void kinetic_energy(int N, int DIM, double *mass, double complex *vel);
void potential_energy(int N, int DIM, double *mass, double complex *pos);
void energy_diagnostics(int N, int DIM, double *mass, double complex *pos, double complex *vel);
#endif // EDIAG_H_
|
//KK defines safe_malloc, safe_realloc
#include<stdio.h>
#include<stdlib.h>
static inline void* safe_malloc(size_t size){
void* p;
if ((p = malloc(size))==NULL){
fprintf(stderr, "ERROR: Out of Memory\n");
fflush(stderr);
fprintf(stdout, "ERROR: Out of Memory\n");
fflush(stdout);
exit(EXIT_FAILURE);
}
return p;
}
static inline void* safe_realloc(void* ptr, size_t size){
void* p;
if ((p = realloc(ptr,size))==NULL){
fprintf(stderr, "ERROR: Out of Memory\n");
fflush(stderr);
fprintf(stdout, "ERROR: Out of Memory\n");
fflush(stdout);
exit(EXIT_FAILURE);
}
return p;
}
|
/*----------------------------------------------------------------------*\
| ___ ____ __ __ ___ _ _______ |
| / _ \ _ __ ___ _ __ / ___|| \/ |/ _ \| |/ / ____| _ _ |
| | | | | '_ \ / _ \ '_ \\___ \| |\/| | | | | ' /| _| _| |_ _| |_ |
| | |_| | |_) | __/ | | |___) | | | | |_| | . \| |__|_ _|_ _| |
| \___/| .__/ \___|_| |_|____/|_| |_|\___/|_|\_\_____||_| |_| |
| |_| |
| |
| Author: Alberto Cuoci <alberto.cuoci@polimi.it> |
| CRECK Modeling Group <http://creckmodeling.chem.polimi.it> |
| Department of Chemistry, Materials and Chemical Engineering |
| Politecnico di Milano |
| P.zza Leonardo da Vinci 32, 20133 Milano |
| |
|-------------------------------------------------------------------------|
| |
| This file is part of OpenSMOKE++ framework. |
| |
| License |
| |
| Copyright(C) 2014, 2013, 2012 Alberto Cuoci |
| OpenSMOKE++ is free software: you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation, either version 3 of the License, or |
| (at your option) any later version. |
| |
| OpenSMOKE++ 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 OpenSMOKE++. If not, see <http://www.gnu.org/licenses/>. |
| |
\*-----------------------------------------------------------------------*/
#define COMPLETE_ODESOLVERINTERFACE_MEBDF(classname)\
bool classname::instanceFlag = false;\
classname* classname::m_this = NULL;
#define DEFINE_ODESOLVERINTERFACE_MEBDF(classname)\
private:\
\
static bool instanceFlag;\
static classname* m_this;\
classname()\
{\
}\
\
public:\
\
static classname* GetInstance()\
{\
if(instanceFlag == false)\
{\
m_this = new classname();\
instanceFlag = true;\
return m_this;\
}\
else\
{\
return m_this;\
}\
}\
\
~classname()\
{\
instanceFlag = false;\
std::cout << "~classname..." << std::endl; \
}\
\
static void GetSystemFunctionsStatic(int *n, double *x, double *y, double *fy, int *ipar, double *rpar)\
{\
m_this->GetSystemFunctionsCallBack(n,x,y,fy, ipar, rpar);\
}\
\
static void GetAnalyticalJacobianStatic(double *x, double *y, double *pd, int *n, int *meband, int *ipar, double *rpar)\
{\
m_this->GetAnalyticalJacobianCallBack(x, y, pd, n, meband, ipar, rpar);\
}\
\
static void GetWriteFunctionStatic(double *x, double *y)\
{\
m_this->GetWriteFunctionCallBack(x,y);\
}\
\
static void GetMassMatrixMEBDFStatic(int *n, double *am, int *masbnd, int *ipar, double *rpar)\
{\
}\
\
void GetSystemFunctionsCallBack(int *n, double *x, double *y, double *fy, int *ipar, double *rpar)\
{\
GetSystemFunctions(*x, y, fy);\
}\
\
void GetAnalyticalJacobianCallBack(double *x, double *y, double *pd, int *n, int *meband, int *ipar, double *rpar)\
{\
GetAnalyticalJacobian(*x, y, pd);\
}\
\
void GetWriteFunctionCallBack(double *x, double *y)\
{\
GetWriteFunction(*x, y);\
}\
\
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "textdocumentmanipulatorinterface.h"
namespace TextEditor {
class TextEditorWidget;
class TextDocumentManipulator final : public TextDocumentManipulatorInterface
{
public:
TextDocumentManipulator(TextEditorWidget *textEditorWidget);
int currentPosition() const final;
int positionAt(TextPositionOperation textPositionOperation) const final;
QChar characterAt(int position) const final;
QString textAt(int position, int length) const final;
QTextCursor textCursorAt(int position) const final;
void setCursorPosition(int position) final;
void setAutoCompleteSkipPosition(int position) final;
bool replace(int position, int length, const QString &text) final;
void insertCodeSnippet(int position, const QString &text, const SnippetParser &parse) final;
void paste() final;
void encourageApply() final;
void autoIndent(int position, int length) override;
private:
bool textIsDifferentAt(int position, int length, const QString &text) const;
void replaceWithoutCheck(int position, int length, const QString &text);
private:
TextEditorWidget *m_textEditorWidget;
};
} // namespace TextEditor
|
///////////////////////////////////////////////////////////////////////////////
// BOSSA
//
// Copyright (C) 2011-2012 ShumaTech http://www.shumatech.com/
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////////////////////
#ifndef _FLASHER_H
#define _FLASHER_H
#include <string>
#include <exception>
#include "Flash.h"
#include "Samba.h"
#include "FileError.h"
class FileSizeError : public FileError
{
public:
FileSizeError() : FileError() {};
virtual const char* what() const throw() { return "file operation exceeds flash size"; }
};
class Flasher
{
public:
Flasher(Flash::Ptr& flash) : _flash(flash) {}
virtual ~Flasher() {}
void erase();
void write(const char* filename);
bool verify(const char* filename);
void read(const char* filename, long fsize);
void lock(std::string& regionArg, bool enable);
void info(Samba& samba);
private:
void progressBar(int num, int div);
Flash::Ptr& _flash;
};
#endif // _FLASHER_H
|
#ifdef TI83P
# include <ti83pdefs.h>
# include <ti83p.h>
unsigned char CkOdd(void *ptr) __naked
{
ptr;
__asm
push af
push bc
push de
push hl
push ix
push iy
ld iy,#flags___dw
ld hl,#14
add hl,sp
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
BCALL(_CkOdd___db)
pop iy
pop ix
pop hl
ld l,#1
jr z,___doneZZ125
dec l
___doneZZ125:
pop de
pop bc
pop af
ret
__endasm;
}
#endif
|
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_WIN32_HEADERS_H_
#define V8_WIN32_HEADERS_H_
#ifndef WIN32_LEAN_AND_MEAN
// WIN32_LEAN_AND_MEAN implies NOCRYPT and NOGDI.
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifndef NOKERNEL
#define NOKERNEL
#endif
#ifndef NOUSER
#define NOUSER
#endif
#ifndef NOSERVICE
#define NOSERVICE
#endif
#ifndef NOSOUND
#define NOSOUND
#endif
#ifndef NOMCX
#define NOMCX
#endif
// Require Windows XP or higher (this is required for the RtlCaptureContext
// function to be present).
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x501
#endif
#include <windows.h>
#include <signal.h> // For raise().
#include <time.h> // For LocalOffset() implementation.
#include <mmsystem.h> // For timeGetTime().
#ifdef __MINGW32__
// Require Windows XP or higher when compiling with MinGW. This is for MinGW
// header files to expose getaddrinfo.
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x501
#endif // __MINGW32__
#if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
#include <dbghelp.h> // For SymLoadModule64 and al.
#include <errno.h> // For STRUNCATE
#endif // !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
#include <limits.h> // For INT_MAX and al.
#include <tlhelp32.h> // For Module32First and al.
// These additional WIN32 includes have to be right here as the #undef's below
// makes it impossible to have them elsewhere.
#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef __MINGW32__
#include <wspiapi.h>
#endif // __MINGW32__
#include <process.h> // For _beginthreadex().
#include <stdlib.h>
#undef VOID
#undef DELETE
#undef IN
#undef THIS
#undef CONST
#undef NAN
#undef UNKNOWN
#undef NONE
#undef ANY
#undef IGNORE
#undef STRICT
#undef GetObject
#undef CreateSemaphore
#undef Yield
#endif // V8_WIN32_HEADERS_H_
|
#pragma once
#define LIN_MAX_FRAME_TYPES 4
#define LIN_UNCONDITIONAL_FRAME_INDEX 0
#define LIN_EVENT_FRAME_INDEX 1
#define LIN_SPORADIC_FRAME_INDEX 2
#define LIN_DIAGNOSTIC_FRAME_INDEX 3
#define LIN_MAX_SIGNAL_TYPES 2
#define LIN_NORMAL_SIGNAL 0
#define LIN_DIAGNOSTICS_SIGNAL 1
#define LIN_MAX_ECU_TYPES 2
#define LIN_MASTER_ECU 0
#define LIN_SLAVE_ECU 1
#define MAX_UNCOND_FRAME_ID 63
#define defECU_ICON_INDEX 0
#define defFRAME_ICON_INDEX 1
#define defSIGNAL_ICON_INDEX 2
#define defCODING_ICON_INDEX 3
#define defSCHEDULETABLE_ICON_INDEX 4
#define defSIGNAL_RX_ICON_INDEX 5
#define defSIGNAL_TX_ICON_INDEX 6
#define defFRAME_RX_ICON_INDEX 7
#define defFRAME_TX_ICON_INDEX 8
#define defNODE_COMPOSITION_INDEX 9
#define def_ICON_TOTAL 10
#define defMAX_SIGNAL_STARTBIT 63
#define defCLASSIC_CHECKSUM "Classic"
#define defENHANCED_CHECKSUM "Enhanced"
#define defNEW "&New"
#define defEDIT "&Edit"
#define defDELETE "&Delete"
#define defADD_DIAGSUPPORT "&Add Diagnostic Support"
#define defREMOVE_DIAGSUPPORT "&Remove Diagnostic Support"
#define defLINMasterFrameName "MasterReq"
#define defLINSlaveFrameName "SlaveResp"
#define defLINMasterSignalName "MasterReqB%d"
#define defLINSlaveSignalName "SlaveRespB%d"
#define defNONE " "
enum eMode
{
eNew,
eEdit
};
enum eHeaderPopupMenus
{
eLinClusterHeaderPopup,
eSlaveHeaderPopup,
eUnconditionalFrameHeaderPopup,
eEventTriggeredFrameHeaderPopup,
eSporadicFrameHeaderPopup,
eDiagnosticFrameHeaderPopup,
eSignalHeaderPopup,
eCodingHeaderPopup,
eScheduleTableHeaderPopup,
eSignalGroupHeaderPopUp,
eNodeConfigHeaderPopup,
eTotalHeaderPopup
};
#define defTOTAL_ELEMENT_ACTIONS 27
enum eElementPopupMenus
{
eMasterElementPopup,
eSlaveElementPopup,
eUnconditionalFrameElementPopup,
eEventTriggeredFrameElementPopup,
eSporadicFrameElementPopup,
eDiagnosticFrameElementPopup,
eSignalElementPopup,
eDiagnosticSignalElementPopup,
eCodingElementPopup,
eScheduleTableElementPopup,
eSignalGroupElementPopup,
eNodeConfigElementPopup,
eTotalElementPopup
};
|
/* -*-c++-*-
This file is part of the IC reverse engineering tool degate.
Copyright 2008, 2009 by Martin Schobert
Degate is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
Degate 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 degate. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GATELIBRARYEXPORTERTEST_H__
#define __GATELIBRARYEXPORTERTEST_H__
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "GateLibraryExporter.h"
class GateLibraryExporterTest : public CPPUNIT_NS :: TestFixture {
CPPUNIT_TEST_SUITE(GateLibraryExporterTest);
CPPUNIT_TEST (test_export);
CPPUNIT_TEST_SUITE_END ();
public:
void setUp (void);
void tearDown (void);
protected:
void test_export(void);
};
#endif
|
/* Copyright 2008 Mattias Norrby
*
* This file is part of Test Dept..
*
* Test Dept. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Test Dept. 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 Test Dept.. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sut.h"
#include <foo.h>
#include <bar.h>
#include <stdlib.h>
int fooify(int value) {
int result = foo(value);
const int unexpected = result <= 0;
if (unexpected)
return -1;
return result;
}
float barify(float value) {
float result = bar(value);
const int unexpected = result > 1000;
if (unexpected)
return 0.3f;
return result;
}
char *stringify(char value) {
char *fie = malloc(2 * sizeof(char));
if (fie == NULL)
return "cannot_stringify";
fie[0] = value;
fie[1] = '\0';
return fie;
}
|
/*
* Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
* the contents of this file may not be disclosed to third parties, copied
* or duplicated in any form, in whole or in part, without the prior
* written permission of Broadcom Corporation.
*/
#pragma once
#include <stdint.h>
#include "besl_structures.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Endian management functions */
uint32_t besl_host_hton32(uint32_t intlong);
uint16_t besl_host_hton16(uint16_t intshort);
uint32_t besl_host_hton32_ptr(uint8_t* in, uint8_t* out);
uint16_t besl_host_hton16_ptr(uint8_t* in, uint8_t* out);
extern besl_result_t besl_host_get_mac_address(besl_mac_t* address, uint32_t interface );
extern besl_result_t besl_host_set_mac_address(besl_mac_t* address, uint32_t interface );
extern void besl_host_random_bytes(uint8_t* buffer, uint16_t buffer_length);
extern void besl_host_get_time(besl_time_t* time);
/* Memory allocation functions */
extern void* besl_host_malloc( const char* name, uint32_t size );
extern void* besl_host_calloc( const char* name, uint32_t num, uint32_t size );
extern void besl_host_free( void* p );
#ifdef __cplusplus
} /*extern "C" */
#endif
|
// EPOS Memory Segment Abstraction Declarations
#ifndef __segment_h
#define __segment_h
#include <mmu.h>
__BEGIN_SYS
class Segment: public MMU::Chunk
{
private:
typedef MMU::Chunk Chunk;
public:
typedef CPU::Phy_Addr Phy_Addr;
typedef MMU::Flags Flags;
public:
Segment(unsigned int bytes, const Color & color = Color::WHITE, const Flags & flags = Flags::APP);
Segment(const Phy_Addr & phy_addr, unsigned int bytes, const Flags & flags);
~Segment();
unsigned int size() const;
Phy_Addr phy_address() const;
int resize(int amount);
};
__END_SYS
#endif
|
/* Test of <math.h> substitute.
Copyright (C) 2007-2017 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
#include <math.h>
#ifndef NAN
# error NAN should be defined
choke me
#endif
#ifndef HUGE_VALF
# error HUGE_VALF should be defined
choke me
#endif
#ifndef HUGE_VAL
# error HUGE_VAL should be defined
choke me
#endif
#ifndef HUGE_VALL
# error HUGE_VALL should be defined
choke me
#endif
#ifndef FP_ILOGB0
# error FP_ILOGB0 should be defined
choke me
#endif
#ifndef FP_ILOGBNAN
# error FP_ILOGBNAN should be defined
choke me
#endif
#include <limits.h>
#include "macros.h"
#if 0
/* Check that NAN expands into a constant expression. */
static float n = NAN;
#endif
/* Compare two numbers with ==.
This is a separate function because IRIX 6.5 "cc -O" miscompiles an
'x == x' test. */
static int
numeric_equalf (float x, float y)
{
return x == y;
}
static int
numeric_equald (double x, double y)
{
return x == y;
}
static int
numeric_equall (long double x, long double y)
{
return x == y;
}
int
main (void)
{
double d = NAN;
double zero = 0.0;
ASSERT (!numeric_equald (d, d));
d = HUGE_VAL;
ASSERT (numeric_equald (d, 1.0 / zero));
ASSERT (numeric_equalf (HUGE_VALF, HUGE_VALF + HUGE_VALF));
ASSERT (numeric_equald (HUGE_VAL, HUGE_VAL + HUGE_VAL));
ASSERT (numeric_equall (HUGE_VALL, HUGE_VALL + HUGE_VALL));
/* Check the value of FP_ILOGB0. */
ASSERT (FP_ILOGB0 == INT_MIN || FP_ILOGB0 == - INT_MAX);
/* Check the value of FP_ILOGBNAN. */
ASSERT (FP_ILOGBNAN == INT_MIN || FP_ILOGBNAN == INT_MAX);
return 0;
}
|
/* Routines to insert, append and delete FITS cards from a header.
These routines allow FITS cards to be inserted, appended and deleted
by keyword value.
The insertion routines format a new card with the supplied keyword and
value and insert it after indicated card. The append routines add new
cards to the end of the header (before the END card).
*/
#include "fitsy.h"
/* Insert a logical value FITS card into a header.
*/
FITSCard ft_headinsl(fits, name, n, lvalue, comm, here)
FITSHead fits; /* FITS header to insert, append or
delete a card.
*/
char *name; /* Name of the FITS card. */
int n; /* keyword index number, if is zero no
index number is appended to the
keyword.
*/
int lvalue;/* Logical to format as a FITS value. */
char *comm; /* Comment for the new card. */
FITSCard here; /* Insert the new card after this card. */
{
FITSBuff card;
return ft_cardins(fits
, ft_cardfmt(&card, name, n, FT_LOGICAL, &lvalue, 0, comm)
, here);
}
/* Insert a integer value FITS card into a header.
*/
FITSCard ft_headinsi(fits, name, n, ivalue, comm, here)
FITSHead fits;
char *name;
int n;
int ivalue;/* Integer to format as a FITS value. */
char *comm;
FITSCard here;
{
FITSBuff card;
return ft_cardins(fits
, ft_cardfmt(&card, name, n, FT_INTEGER, &ivalue, 0, comm)
, here);
}
/* Insert a longlong integer value FITS card into a header.
*/
FITSCard ft_headinsil(fits, name, n, ivalue, comm, here)
FITSHead fits;
char *name;
int n;
longlong ivalue;/* Integer to format as a FITS value. */
char *comm;
FITSCard here;
{
FITSBuff card;
return ft_cardins(fits
, ft_cardfmt(&card, name, n, FT_LONG, &ivalue, 0, comm)
, here);
}
/* Insert a real value FITS card into a header.
*/
FITSCard ft_headinsr(fits, name, n, dvalue, prec, comm, here)
FITSHead fits;
char *name;
int n;
double dvalue;/* Double to format as a FITS value. */
int prec; /* Precision for the value */
char *comm;
FITSCard here;
{
FITSBuff card;
return ft_cardins(fits
, ft_cardfmt(&card, name, n, FT_REAL, &dvalue, prec, comm)
, here);
}
/* Insert a string value FITS card into a header.
*/
FITSCard ft_headinss(fits, name, n, svalue, comm, here)
FITSHead fits;
char *name;
int n;
char *svalue;/* String to format as a FITS value */
char *comm;
FITSCard here;
{
FITSBuff card;
return ft_cardins(fits
, ft_cardfmt(&card, name, n, FT_STRING, svalue, 0, comm)
, here);
}
/* Insert a raw value FITS card into a header.
*/
FITSCard ft_headinsv(fits, name, n, vvalue, comm, here)
FITSHead fits;
char *name;
int n;
char *vvalue;/* Raw value to format as a FITS value */
char *comm;
FITSCard here;
{
FITSBuff card;
return ft_cardins(fits
, ft_cardfmt(&card, name, n, FT_VALUE, vvalue, 0, comm)
, here);
}
/* Append a logical value FITS card to a header.
*/
FITSCard ft_headappl(fits, name, n, lvalue, comm)
FITSHead fits;
char *name;
int n;
int lvalue;
char *comm;
{
return ft_headinsl(fits, name, n, lvalue, comm, NULL);
}
/* Append a integer value FITS card to a header.
*/
FITSCard ft_headappi(fits, name, n, ivalue, comm)
FITSHead fits;
char *name;
int n;
int ivalue;
char *comm;
{
return ft_headinsi(fits, name, n, ivalue, comm, NULL);
}
/* Append a 64-bit integer value FITS card to a header.
*/
FITSCard ft_headappil(fits, name, n, ivalue, comm)
FITSHead fits;
char *name;
int n;
longlong ivalue;
char *comm;
{
return ft_headinsil(fits, name, n, ivalue, comm, NULL);
}
/* Append a real value FITS card to a header.
*/
FITSCard ft_headappr(fits, name, n, dvalue, prec, comm)
FITSHead fits;
char *name;
int n;
double dvalue;
int prec;
char *comm;
{
return ft_headinsr(fits, name, n, dvalue, prec, comm, NULL);
}
/* Append a string value FITS card to a header.
*/
FITSCard ft_headapps(fits, name, n, svalue, comm)
FITSHead fits;
char *name;
int n;
char *svalue;
char *comm;
{
return ft_headinss(fits, name, n, svalue, comm, NULL);
}
/* Append a raw value FITS card to a header.
*/
FITSCard ft_headappv(fits, name, n, vvalue, comm)
FITSHead fits;
char *name;
int n;
char *vvalue;
char *comm;
{
return ft_headinsv(fits, name, n, vvalue, comm, NULL);
}
/* Find and delete a card from a FITS header.
*/
FITSCard ft_headdel(fits, name, n)
FITSHead fits;
char *name;
int n;
{
return ft_carddel(fits, ft_headfind(fits, name, n, 0));
}
|
/* Jaro Mail gnome keyring handler
Originally from some Gnome example code, slightly modified
Copyright (C) 2012 Denis Roio <jaromil@dyne.org>
* This source code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Public License as published
* by the Free Software Foundation; either version 3 of the License,
* or (at your option) any later version.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* Please refer to the GNU Public License for more details.
*
* You should have received a copy of the GNU Public License along with
* this source code; if not, write to:
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gnome-keyring.h>
static GnomeKeyringPasswordSchema jaro_schema = {
GNOME_KEYRING_ITEM_GENERIC_SECRET,
{
{ "protocol", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
{ "host", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
{ "path", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
{ "username", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
{ NULL, 0 },
}
};
typedef struct jaro_credential {
gchar *protocol;
gchar *host;
gchar *path;
gchar *username;
gchar *password;
} jaro_credential_t;
static void
error(const char *err, ...)
{
char msg[4096];
va_list params;
va_start(params, err);
vsnprintf(msg, sizeof(msg), err, params);
fprintf(stderr, "%s\n", msg);
va_end(params);
}
static int
get_password(jaro_credential_t *cred)
{
GnomeKeyringResult keyres;
gchar *pass = NULL;
keyres = gnome_keyring_find_password_sync(&jaro_schema,
&pass,
"protocol", cred->protocol,
"host", cred->host,
"path", cred->path,
"username", cred->username,
NULL);
if (keyres != GNOME_KEYRING_RESULT_OK) {
error("failed to get password: %s", gnome_keyring_result_to_message(keyres));
return 1;
}
g_printf("%s\n", pass);
gnome_keyring_free_password(pass);
return 0;
}
static int
check_password(jaro_credential_t *cred)
{
GnomeKeyringResult keyres;
gchar *pass = NULL;
keyres = gnome_keyring_find_password_sync(&jaro_schema,
&pass,
"protocol", cred->protocol,
"host", cred->host,
"path", cred->path,
"username", cred->username,
NULL);
if (keyres != GNOME_KEYRING_RESULT_OK) {
error("failed to check password: %s", gnome_keyring_result_to_message(keyres));
return 1;
}
gnome_keyring_free_password(pass);
return 0;
}
static int
store_password(jaro_credential_t *cred)
{
gchar desc[1024];
GnomeKeyringResult keyres;
/* Only store complete credentials */
if (!cred->protocol || !cred->host ||
!cred->username || !cred->password)
return 1;
g_snprintf(desc, sizeof(desc), "%s %s", cred->protocol, cred->host);
keyres = gnome_keyring_store_password_sync(&jaro_schema,
GNOME_KEYRING_DEFAULT,
desc,
cred->password,
"protocol", cred->protocol,
"host", cred->host,
"path", cred->path,
"username", cred->username,
NULL);
if (keyres != GNOME_KEYRING_RESULT_OK) {
error("failed to store password: %s", gnome_keyring_result_to_message(keyres));
return 1;
}
return 0;
}
static int
erase_password(jaro_credential_t *cred)
{
GnomeKeyringResult keyres;
keyres = gnome_keyring_delete_password_sync(&jaro_schema,
"protocol", cred->protocol,
"host", cred->host,
"path", cred->path,
"username", cred->username,
NULL);
if (keyres != GNOME_KEYRING_RESULT_OK) {
error("failed to erase password: %s", gnome_keyring_result_to_message(keyres));
return 1;
}
return 0;
}
static int
read_credential(jaro_credential_t *cred)
{
char buf[1024];
while (fgets(buf, sizeof(buf), stdin)) {
char *v;
if (strcmp(buf, "\n") == 0)
break;
buf[strlen(buf) - 1] = '\0';
v = strchr(buf, '=');
if (!v) {
error("bad input: %s", buf);
return -1;
}
*v++ = '\0';
#define SET_CRED_ATTR(name) do { \
if (strcmp(buf, #name) == 0) { \
cred->name = g_strdup(v); \
} \
} while (0)
SET_CRED_ATTR(protocol);
SET_CRED_ATTR(host);
SET_CRED_ATTR(path);
SET_CRED_ATTR(username);
SET_CRED_ATTR(password);
}
return 0;
}
static void
clear_credential(jaro_credential_t *cred)
{
if (cred->protocol) g_free(cred->protocol);
if (cred->host) g_free(cred->host);
if (cred->path) g_free(cred->path);
if (cred->username) g_free(cred->username);
if (cred->password) gnome_keyring_free_password(cred->password);
}
int
main(int argc, const char **argv)
{
jaro_credential_t cred = {0};
int res = 0;
if (argc < 2) {
error("Usage: jaro-gnome-keyring <get|check|store|erase>");
error("input from stdin: newline separated parameter=value tuples");
error("i.e: protocol, path, username, host, password (password on store)");
return 1;
}
if (read_credential(&cred)) {
clear_credential(&cred);
return 1;
}
if (strcmp(argv[1], "get") == 0) {
res = get_password(&cred);
}
if (strcmp(argv[1], "check") == 0) {
res = check_password(&cred);
}
else if (strcmp(argv[1], "store") == 0) {
res = store_password(&cred);
}
else if (strcmp(argv[1], "erase") == 0) {
res = erase_password(&cred);
}
clear_credential(&cred);
return res;
}
|
#ifndef LIBA7_INCLUDED
#define LIBA7_INCLUDED
typedef int bool ;
struct gpsStruct {//GPRMC
int timeZone;
bool flagRead; // flag used by the parser, when a valid sentence has begun
bool flagDataReady; // valid GPS fix and data available, user can call reader functions
bool flagDateReady; // valid GPS fix and data available, user can call reader functions
char words[20][15]; // hold parsed words for one given NMEA sentence
char szChecksum[15]; // hold the received checksum for one given NMEA sentence
// will be set to true for characters between $ and * only
bool flagComputedCks; // used to compute checksum and indicate valid checksum interval (between $ and * in a given sentence)
int checksum; // numeric checksum, computed for a given sentence
bool flagReceivedCks; // after getting * we start cuttings the received checksum
int index_received_checksum;// used to parse received checksum
// word cutting variables
int wordIdx; // the current word in a sentence
int prevIdx; // last character index where we did a cut
int nowIdx ; // current character index
// globals to store parser results
bool positionFixIndicator; //GPGGA
bool dataValid; //GPRMC
float longitude; // GPRMC and GPGGA
float latitude; // GPRMC and GPGGA
unsigned char UTCHour, UTCMin, UTCSec, // GPRMC and GPGGA
UTCDay, UTCMonth, UTCYear; // GPRMC
int satellitesUsed;// GPGGA
float dilution; //GPGGA
float altitude; // GPGGA
float speed; // GPRMC
float bearing; // GPRMC
char time[7];
char date[7];
};
extern int A7_commond_cport_nr;
extern int A7_data_cport_nr;
extern unsigned char gps_data_buffer[];
extern int write_position,readComplete;
extern int openA7Port() ;
extern int sendA7DataToServer();
extern int getA7DeviceInfo();
extern int A7DataConnect();
extern int GPSA7NIMEAData(int ON) ;
extern int GPSA7Power(int ON);
extern resetHardA7GSMModule();
extern int sendA7DataToTCPServer(char * device_id,char * longitude,char * latitude,char * updated_time,char * updated_date);
extern void Resetbufer(unsigned char *buf,int size);
extern char *dtostrf (double val, signed char width, unsigned char prec, char *sout);
#endif
|
#include <linux/init.h>
#include <linux/ip.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include <linux/udp.h>
#define PORT 3615
static unsigned short int portnum = 0;
/* This function to be called by hook. */
static unsigned int hook_func(unsigned int hooknum, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, int (*okfn) (struct sk_buff *))
{
struct udphdr *udp_header;
struct iphdr *ip_header = (struct iphdr *)skb_network_header(skb);
if (ip_header->protocol == IPPROTO_UDP) {
udp_header = (struct udphdr *)skb_transport_header(skb);
portnum = ntohs(udp_header->dest);
if (portnum != PORT) {
return NF_ACCEPT;
}
printk(KERN_INFO "src = %d, dest = %d, converted dest %u.\n", udp_header->source, udp_header->dest, portnum);
printk(KERN_INFO "len = %u, data_len = %d, addr data %pa, data tail %pa\n", skb->len, skb->data_len, skb->data, skb->tail);
print_hex_dump(KERN_ALERT, "mem: ", DUMP_PREFIX_ADDRESS, 16, 1, &skb->data, skb->len, 0);
//return NF_DROP;
}
return NF_ACCEPT;
}
static int minitel_show(struct seq_file *m, void *v)
{
seq_printf(m, "Last UDP port knocked %d\n", portnum);
return 0;
}
static int minitel_open(struct inode *inode, struct file *file)
{
return single_open(file, minitel_show, NULL);
}
static const struct file_operations minitel_fops = {
.owner = THIS_MODULE,
.open = minitel_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* Netfilter hook */
static struct nf_hook_ops nfho = {
.hook = hook_func,
.hooknum = 1, /* NF_IP_LOCAL_IN */
.pf = PF_INET,
.priority = NF_IP_PRI_FIRST,
};
static int __init minitel_init(void)
{
printk(KERN_INFO "Loading minitel module, port = %d.\n", PORT);
proc_create("minitel", 0, NULL, &minitel_fops);
nf_register_hook(&nfho);
return 0;
}
static void __exit minitel_exit(void)
{
remove_proc_entry("minitel", NULL);
nf_unregister_hook(&nfho);
printk(KERN_INFO "Unloading minitel module.\n");
}
module_init(minitel_init);
module_exit(minitel_exit);
MODULE_LICENSE("GPL");
|
/* -*- c++ -*- */
/*
* Copyright 2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_DTV_ATSC_EQUALIZER_H
#define INCLUDED_DTV_ATSC_EQUALIZER_H
#include <gnuradio/block.h>
#include <gnuradio/dtv/api.h>
namespace gr {
namespace dtv {
/*!
* \brief ATSC Receiver Equalizer
*
* \ingroup dtv_atsc
*/
class DTV_API atsc_equalizer : virtual public gr::block
{
public:
// gr::dtv::atsc_equalizer::sptr
typedef boost::shared_ptr<atsc_equalizer> sptr;
/*!
* \brief Make a new instance of gr::dtv::atsc_equalizer.
*/
static sptr make();
virtual std::vector<float> taps() const = 0;
virtual std::vector<float> data() const = 0;
};
} /* namespace dtv */
} /* namespace gr */
#endif /* INCLUDED_DTV_ATSC_EQUALIZER_H */
|
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 jwellbelove
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 ETL_CPP11_INCLUDED
#define ETL_CPP11_INCLUDED
//*****************************************************************************
// Generic C++11
//*****************************************************************************
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC
#define ETL_CPP11_SUPPORTED 1
#define ETL_CPP14_SUPPORTED 0
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT 0
#define ETL_NO_LARGE_CHAR_SUPPORT 0
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 1
#endif
|
/************************************************************************
*
* This file is part of MetaCortex
*
* Authors:
* Richard M. Leggett (richard.leggett@earlham.ac.uk) and
* Martin Ayling (martin.ayling@earlham.ac.uk)
*
* MetaCortex is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MetaCortex 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 MetaCortex. If not, see <http://www.gnu.org/licenses/>.
*
************************************************************************
*
* This file is modified from source that was part of CORTEX. The
* original license notice for that is given below.
*
************************************************************************
*
* Copyright 2009-2011 Zamin Iqbal and Mario Caccamo
*
* CORTEX project contacts:
* M. Caccamo (mario.caccamo@bbsrc.ac.uk) and
* Z. Iqbal (zam@well.ox.ac.uk)
*
* Development team:
* R. Ramirez-Gonzalez (Ricardo.Ramirez-Gonzalez@bbsrc.ac.uk)
* R. Leggett (richard@leggettnet.org.uk)
*
************************************************************************
*
* This file is part of CORTEX.
*
* CORTEX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CORTEX 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 CORTEX. If not, see <http://www.gnu.org/licenses/>.
*
************************************************************************/
/************************************************************************
* hash_value.h
************************************************************************/
#ifndef HASH_VAL_H_
#define HASH_VAL_H_
#include <element.h>
int hash_value(Key key, int number_buckets);
#endif /* HASH_VAL_H_ */
|
/****************************************************************************/
/// @file MSActuatedTrafficLightLogic.h
/// @author Daniel Krajzewicz
/// @author Michael Behrisch
/// @date Sept 2002
/// @version $Id: MSActuatedTrafficLightLogic.h 14425 2013-08-16 20:11:47Z behrisch $
///
// An actuated (adaptive) traffic light logic
/****************************************************************************/
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
/****************************************************************************/
//
// This file is part of SUMO.
// SUMO is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
/****************************************************************************/
#ifndef MSActuatedTrafficLightLogic_h
#define MSActuatedTrafficLightLogic_h
// ===========================================================================
// included modules
// ===========================================================================
#ifdef _MSC_VER
#include <windows_config.h>
#else
#include <config.h>
#endif
#include <utility>
#include <vector>
#include <bitset>
#include <map>
#include <microsim/MSEventControl.h>
#include <microsim/traffic_lights/MSTrafficLightLogic.h>
#include "MSSimpleTrafficLightLogic.h"
#include <microsim/output/MSInductLoop.h>
// ===========================================================================
// class declarations
// ===========================================================================
class NLDetectorBuilder;
// ===========================================================================
// class definitions
// ===========================================================================
/**
* @class MSActuatedTrafficLightLogic
* @brief An actuated (adaptive) traffic light logic
*/
class MSActuatedTrafficLightLogic : public MSSimpleTrafficLightLogic {
public:
/// @brief Definition of a map from lanes to induct loops lying on them
typedef std::map<MSLane*, MSInductLoop*> InductLoopMap;
public:
/** @brief Constructor
* @param[in] tlcontrol The tls control responsible for this tls
* @param[in] id This tls' id
* @param[in] programID This tls' sub-id (program id)
* @param[in] phases Definitions of the phases
* @param[in] step The initial phase index
* @param[in] delay The time to wait before the first switch
* @param[in] parameter The parameter to use for tls set-up
*/
MSActuatedTrafficLightLogic(MSTLLogicControl& tlcontrol,
const std::string& id, const std::string& programID,
const MSSimpleTrafficLightLogic::Phases& phases,
unsigned int step, SUMOTime delay,
const std::map<std::string, std::string>& parameter);
/** @brief Initialises the tls with information about incoming lanes
* @param[in] nb The detector builder
* @exception ProcessError If something fails on initialisation
*/
void init(NLDetectorBuilder& nb);
/// @brief Destructor
~MSActuatedTrafficLightLogic();
/// @name Switching and setting current rows
/// @{
/** @brief Switches to the next phase
* @param[in] isActive Whether this program is the currently used one
* @return The time of the next switch
* @see MSTrafficLightLogic::trySwitch
*/
SUMOTime trySwitch(bool isActive);
/// @}
protected:
/// @name "actuated" algorithm methods
/// @{
/** @brief Returns the duration of the given step
* @return The wanted duration of the current step
*/
SUMOTime duration() const;
/** @brief Decides, whether a phase should be continued by checking the gaps of vehicles having green
*/
void gapControl();
/// @}
protected:
/// A map from lanes to induct loops lying on them
InductLoopMap myInductLoops;
/// information whether the current phase should be lenghtend
bool myContinue;
/// The maximum gap to check
SUMOReal myMaxGap;
/// The passing time used
SUMOReal myPassingTime;
/// The detector distance
SUMOReal myDetectorGap;
};
#endif
/****************************************************************************/
|
/****************************************************************\
* *
* Protein <-> DNA comparison model *
* *
* Guy St.C. Slater.. mailto:guy@ebi.ac.uk *
* Copyright (C) 2000-2008. All Rights Reserved. *
* *
* This source code is distributed under the terms of the *
* GNU General Public License, version 3. See the file COPYING *
* or http://www.gnu.org/licenses/gpl.txt for details *
* *
* If you use this code, please keep this notice intact. *
* *
\****************************************************************/
#ifndef INCLUDED_PROTEIN2DNA_H
#define INCLUDED_PROTEIN2DNA_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "c4.h"
#include "sequence.h"
#include "affine.h"
#include "frameshift.h"
typedef struct {
Affine_Data ad; /* inherit */
} Protein2DNA_Data;
/**/
#define Protein2DNA_Data_get_submat(p2dd) \
Affine_Data_get_protein_submat(&((p2dd)->ad))
#define Protein2DNA_Data_get_translate(p2dd) \
Affine_Data_get_translate(&((p2dd)->ad))
#define Protein2DNA_Data_get_Intron_Data(p2dd) \
Affine_Data_get_Intron_Data(&((p2dd)->ad))
#define Protein2DNA_Data_get_Frameshift_Data(p2dd) \
Affine_Data_get_Frameshift_Data(&((p2dd)->ad))
#define Protein2DNA_Data_get_query(p2dd) \
Affine_Data_get_query(&((p2dd)->ad))
#define Protein2DNA_Data_get_target(p2dd) \
Affine_Data_get_target(&((p2dd)->ad))
void Protein2DNA_Data_init(Protein2DNA_Data *p2dd,
Sequence *query, Sequence *target);
Protein2DNA_Data *Protein2DNA_Data_create(Sequence *query,
Sequence *target);
void Protein2DNA_Data_clear(Protein2DNA_Data *p2dd);
void Protein2DNA_Data_destroy(Protein2DNA_Data *p2dd);
/**/
C4_Model *Protein2DNA_create(Affine_Model_Type type);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* INCLUDED_PROTEIN2DNA_H */
|
/*
* File: ximatga.h
* Purpose: TARGA Image Class Loader and Writer
*/
/* ==========================================================
* CxImageTGA (c) 05/Jan/2002 Davide Pizzolato - www.xdp.it
* For conditions of distribution and use, see copyright notice in ximage.h
*
* Parts of the code come from Paintlib : Copyright (c) 1996-1998 Ulrich von Zadow
* ==========================================================
*/
#if !defined(__ximaTGA_h)
#define __ximaTGA_h
#include "ximage.h"
#if CXIMAGE_SUPPORT_TGA
class CxImageTGA: public CxImage
{
#pragma pack(1)
typedef struct tagTgaHeader
{
uint8_t IdLength; // Image ID Field Length
uint8_t CmapType; // Color Map Type
uint8_t ImageType; // Image Type
uint16_t CmapIndex; // First Entry Index
uint16_t CmapLength; // Color Map Length
uint8_t CmapEntrySize; // Color Map Entry Size
uint16_t X_Origin; // X-origin of Image
uint16_t Y_Origin; // Y-origin of Image
uint16_t ImageWidth; // Image Width
uint16_t ImageHeight; // Image Height
uint8_t PixelDepth; // Pixel Depth
uint8_t ImagDesc; // Image Descriptor
} TGAHEADER;
#pragma pack()
public:
CxImageTGA(): CxImage(CXIMAGE_FORMAT_TGA) {}
// bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_TGA);}
// bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_TGA);}
bool Decode(CxFile * hFile);
bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
#if CXIMAGE_SUPPORT_ENCODE
bool Encode(CxFile * hFile);
bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); }
#endif // CXIMAGE_SUPPORT_ENCODE
protected:
uint8_t ExpandCompressedLine(uint8_t* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int32_t width, int32_t y, uint8_t rleLeftover);
void ExpandUncompressedLine(uint8_t* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int32_t width, int32_t y, int32_t xoffset);
void tga_toh(TGAHEADER* p);
};
#endif
#endif
|
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// @file EntropyDecoderSpec.h
/// @brief Convert CTF (EncodedBlocks) to FV0 digit/channels strean
#ifndef O2_FV0_ENTROPYDECODER_SPEC
#define O2_FV0_ENTROPYDECODER_SPEC
#include "Framework/DataProcessorSpec.h"
#include "Framework/Task.h"
#include "FV0Reconstruction/CTFCoder.h"
#include <TStopwatch.h>
namespace o2
{
namespace fv0
{
class EntropyDecoderSpec : public o2::framework::Task
{
public:
EntropyDecoderSpec();
~EntropyDecoderSpec() override = default;
void run(o2::framework::ProcessingContext& pc) final;
void init(o2::framework::InitContext& ic) final;
void endOfStream(o2::framework::EndOfStreamContext& ec) final;
private:
o2::fv0::CTFCoder mCTFCoder;
TStopwatch mTimer;
};
/// create a processor spec
framework::DataProcessorSpec getEntropyDecoderSpec();
} // namespace fv0
} // namespace o2
#endif
|
#pragma once
#include "kernel/kernel_hlemodule.h"
namespace mic
{
class Module : public kernel::HleModuleImpl<Module>
{
public:
virtual void initialise() override;
public:
static void RegisterFunctions();
private:
static void registerCoreFunctions();
};
} // namespace mic
|
/******************************************************************************
*
* Copyright (C) 2004 - 2014 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, 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.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* 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
* XILINX CONSORTIUM 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.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
//----------------------------------------------------------------------------------------------------//
//! @file mem.h
//! Kernel level memory allocation definitions and declarations
//----------------------------------------------------------------------------------------------------//
#ifndef _SYS_MEM_H
#define _SYS_MEM_H
#include <config/config_param.h>
#include <config/config_cparam.h>
#include <sys/ktypes.h>
#include <sys/queue.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SEMQ_START (N_PRIO*MAX_READYQ)
//! This is used by buffer management routines.
//! Each Memory Block of different sizes is associated with each structure
struct _malloc_info {
unsigned int mem_bsize ; //! Memory Block Size
unsigned char max_blks ; //! Max. number of mem blocks
unsigned char n_blks ; //! No. of mem blocks allocated
unsigned short start_blk ; //! The starting mem. blk number
signed char *start_addr ; //! Starting memory location for this bll
};
void alloc_pidq_mem( queuep queue, unsigned int qtype, unsigned int qno ) ;
int se_process_init(void) ;
int kb_pthread_init(void);
void alloc_msgq_mem( queuep queue, unsigned int qno ) ;
void msgq_init(void) ;
void shm_init(void) ;
void bss_mem_init(void) ;
int alloc_bss_mem( unsigned int *start, unsigned int *end ) ;
void free_bss_mem( unsigned int memid ) ;
void malloc_init(void) ;
void sem_heap_init(void);
void bufmalloc_mem_init(void);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MEM_H */
|
// Mark Stankus 1999 (c)
// TestIO.c
#include "Source.hpp"
#include "Sink.hpp"
#include "Command.hpp"
#include "MyOstream.hpp"
void _GetInteger(Source & so, Sink & si) {
int x;
so >> x;
so.shouldBeEnd();
GBStream << "integer:" << x << '\n';
si.noOutput();
};
AddingCommand temp1TestIO("GetInteger",1,_GetInteger);
void _DoNothing(Source & so, Sink & si) {
so.shouldBeEnd();
si.noOutput();
};
AddingCommand temp2TestIO("DoNothing",0,_DoNothing);
void _GetSymbol(Source & so, Sink & si) {
symbolGB x;
so >> x;
so.shouldBeEnd();
GBStream << "symbol:" << x.value().chars() << '\n';
si.noOutput();
};
AddingCommand temp3TestIO("GetSymbol",1,_GetSymbol);
void _GetString(Source & so, Sink & si) {
symbolGB x;
so >> x;
so.shouldBeEnd();
GBStream << "symbol:" << x.value().chars() << '\n';
si.noOutput();
};
AddingCommand temp4TestIO("GetString",1,_GetString);
void _GetListInt(Source & so, Sink & si) {
int x;
Source so2(so.inputNamedFunction("List"));
while(!so2.eoi()) {
so2 >> x;
GBStream << "integer from list:" << x << '\n';
};
so.shouldBeEnd();
si.noOutput();
};
AddingCommand temp5TestIO("GetListInt",1,_GetListInt);
void _PutInteger(Source & so, Sink & si) {
so.shouldBeEnd();
si << 7;
};
AddingCommand temp6TestIO("PutInteger",0,_PutInteger);
void _PutSymbol(Source & so, Sink & si) {
symbolGB x("hi");
so.shouldBeEnd();
si << x;
};
AddingCommand temp7TestIO("PutSymbol",1,_PutSymbol);
void _PutString(Source & so, Sink & si) {
symbolGB x("there");
so.shouldBeEnd();
si << x;
};
AddingCommand temp8TestIO("PutString",1,_PutString);
void _PutListInt(Source & so, Sink & si) {
so.shouldBeEnd();
Sink si2(si.outputFunction("List",4));
si2 << 1;
si2 << 2;
si2 << 3;
si2 << 4;
};
AddingCommand temp9TestIO("PutListInt",1,_PutListInt);
|
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "window/section_widget.h"
namespace Ui {
class ScrollArea;
class PlainShadow;
template <typename Widget>
class WidgetFadeWrap;
} // namespace Ui
namespace Profile {
class SectionMemento;
class InnerWidget;
class FixedBar;
class Widget final : public Window::SectionWidget {
Q_OBJECT
public:
Widget(QWidget *parent, PeerData *peer);
PeerData *peer() const;
PeerData *peerForDialogs() const override {
return peer();
}
bool hasTopBarShadow() const override;
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override;
bool showInternal(const Window::SectionMemento *memento) override;
std::unique_ptr<Window::SectionMemento> createMemento() const override;
void setInternalState(const QRect &geometry, const SectionMemento *memento);
protected:
void resizeEvent(QResizeEvent *e) override;
void showAnimatedHook() override;
void showFinishedHook() override;
void doSetInnerFocus() override;
private slots:
void onScroll();
private:
void updateScrollState();
void updateAdaptiveLayout();
void saveState(SectionMemento *memento) const;
void restoreState(const SectionMemento *memento);
object_ptr<Ui::ScrollArea> _scroll;
QPointer<InnerWidget> _inner;
object_ptr<FixedBar> _fixedBar;
object_ptr<Ui::WidgetFadeWrap<Ui::PlainShadow>> _fixedBarShadow;
};
} // namespace Profile
|
/*
* find next grib header
*
* file = what do you think?
* pos = initial position to start looking at ( = 0 for 1st call)
* returns with position of next grib header (units=bytes)
* len_grib = length of the grib record (bytes)
* buffer[buf_len] = buffer for reading/writing
*
* returns (char *) to start of GRIB header+PDS
* NULL if not found
*
* adapted from SKGB (Mark Iredell)
*
* v1.1 9/94 Wesley Ebisuzaki
* v1.2 3/96 Wesley Ebisuzaki handles short records at end of file
* v1.3 8/96 Wesley Ebisuzaki increase NTRY from 3 to 100 for the folks
* at Automation decided a 21 byte WMO bulletin header wasn't long
* enough and decided to go to an 8K header.
* v1.4 11/10/2001 D. Haalman, looks at entire file, does not try
* to read past EOF
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include "grib.h"
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#define NTRY 100
/* #define LEN_HEADER_PDS (28+42+100) */
#define LEN_HEADER_PDS (28+8)
unsigned char *seek_grib(FILE *file, long *pos, long *len_grib,
unsigned char *buffer, unsigned int buf_len) {
int i, j, len;
j = 1;
clearerr(file);
while ( !feof(file) ) {
if (fseek(file, *pos, SEEK_SET) == -1) break;
i = fread(buffer, sizeof (unsigned char), buf_len, file);
if (ferror(file)) break;
len = i - LEN_HEADER_PDS;
for (i = 0; i < len; i++) {
if (buffer[i] == 'G' && buffer[i+1] == 'R' && buffer[i+2] == 'I'
&& buffer[i+3] == 'B' && buffer[i+7] == 1) {
*pos = i + *pos;
*len_grib = (buffer[i+4] << 16) + (buffer[i+5] << 8) +
buffer[i+6];
return (buffer+i);
}
}
if (j++ == NTRY) {
fprintf(stderr,"found unidentified data \n");
/* break; // stop seeking after NTRY records */
}
*pos = *pos + (buf_len - LEN_HEADER_PDS);
}
*len_grib = 0;
return (unsigned char *) NULL;
}
|
// Fastcgi Daemon - framework for design highload FastCGI applications on C++
// Copyright (C) 2011 Ilya Golubtsov <golubtsov@yandex-team.ru>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef _FASTCGI_COMPONENT_FACTORY_H_
#define _FASTCGI_COMPONENT_FACTORY_H_
#include <string>
#include <map>
#include <boost/utility.hpp>
namespace fastcgi
{
class Component;
class ComponentFactory;
class ComponentContext;
typedef std::map<std::string, ComponentFactory*> FactoryMap;
class ComponentFactory : private boost::noncopyable
{
public:
ComponentFactory();
virtual ~ComponentFactory();
virtual Component* createComponent(ComponentContext *context) = 0;
};
template<typename T>
class DefaultComponentFactory : public ComponentFactory {
public:
virtual Component* createComponent(ComponentContext *context) {
return new T(context);
}
virtual ~DefaultComponentFactory() {
}
};
} // namespace fastcgi
typedef fastcgi::FactoryMap* (*FastcgiGetFactoryMapFunction)();
#if __GNUC__ >= 4
# define FCGIDAEMON_DSO_GLOBALLY_VISIBLE \
__attribute__ ((visibility ("default")))
#else
# define FCGIDAEMON_DSO_GLOBALLY_VISIBLE
#endif
#define FCGIDAEMON_REGISTER_FACTORIES_BEGIN() \
extern "C" FCGIDAEMON_DSO_GLOBALLY_VISIBLE \
const fastcgi::FactoryMap* getFactoryMap() { \
static fastcgi::FactoryMap m;
#define FCGIDAEMON_ADD_DEFAULT_FACTORY(name, Type) \
m.insert(std::make_pair((name), new fastcgi::DefaultComponentFactory<Type>));
#define FCGIDAEMON_ADD_FACTORY(name, factory) \
m.insert(std::make_pair((name), (factory)));
#define FCGIDAEMON_REGISTER_FACTORIES_END() \
return &m; \
}
#endif //_FASTCGI_COMPONENT_FACTORY_H_
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QObject>
#include <QColor>
//![0]
class ApplicationData : public QObject
{
Q_OBJECT
Q_PROPERTY(QColor backgroundColor
READ backgroundColor
WRITE setBackgroundColor
NOTIFY backgroundColorChanged)
public:
void setBackgroundColor(const QColor &c) {
if (c != m_color) {
m_color = c;
emit backgroundColorChanged();
}
}
QColor backgroundColor() const {
return m_color;
}
signals:
void backgroundColorChanged();
private:
QColor m_color;
};
//![0]
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtXmlPatterns module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#ifndef Patternist_SubStringFNs_H
#define Patternist_SubStringFNs_H
#include "qcomparescaseaware_p.h"
/**
* @file
* @short Contains classes implementing the functions found in
* <a href="http://www.w3.org/TR/xpath-functions/#substring.functions">XQuery 1.0 and
* XPath 2.0 Functions and Operators, 7.5 Functions Based on Substring Matching</a>.
* @ingroup Patternist_functions
*/
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QPatternist
{
/**
* @short Implements the function <tt>fn:contains()</tt>.
*
* @ingroup Patternist_functions
* @author Frans Englich <frans.englich@nokia.com>
*/
class ContainsFN : public ComparesCaseAware
{
public:
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const;
};
/**
* @short Implements the function <tt>fn:starts-with()</tt>.
*
* @ingroup Patternist_functions
* @author Frans Englich <frans.englich@nokia.com>
*/
class StartsWithFN : public ComparesCaseAware
{
public:
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const;
};
/**
* @short Implements the function <tt>fn:ends-with()</tt>.
*
* @ingroup Patternist_functions
* @author Frans Englich <frans.englich@nokia.com>
*/
class EndsWithFN : public ComparesCaseAware
{
public:
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const;
};
/**
* @short Implements the function <tt>fn:substring-before()</tt>.
*
* @ingroup Patternist_functions
* @author Frans Englich <frans.englich@nokia.com>
*/
class SubstringBeforeFN : public FunctionCall
{
public:
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const;
};
/**
* @short Implements the function <tt>fn:substring-after()</tt>.
*
* @ingroup Patternist_functions
* @author Frans Englich <frans.englich@nokia.com>
*/
class SubstringAfterFN : public FunctionCall
{
public:
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const;
};
}
QT_END_NAMESPACE
QT_END_HEADER
#endif
|
/*
Copyright (C) 2010 William Hart
Copyright (C) 2011 Fredrik Johansson
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include "flint.h"
#include "nmod_poly.h"
#include "ulong_extras.h"
#include "fmpz.h"
int
main(void)
{
int i, result = 1;
FLINT_TEST_INIT(state);
flint_printf("interpolate_nmod_vec_newton....");
fflush(stdout);
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
nmod_poly_t P, Q;
mp_ptr x, y;
mp_limb_t mod;
slong j, n, npoints;
mod = n_randtest_prime(state, 0);
npoints = n_randint(state, FLINT_MIN(100, mod));
n = n_randint(state, npoints + 1);
nmod_poly_init(P, mod);
nmod_poly_init(Q, mod);
x = _nmod_vec_init(npoints);
y = _nmod_vec_init(npoints);
nmod_poly_randtest(P, state, n);
for (j = 0; j < npoints; j++)
x[j] = j;
nmod_poly_evaluate_nmod_vec(y, P, x, npoints);
nmod_poly_interpolate_nmod_vec_newton(Q, x, y, npoints);
result = nmod_poly_equal(P, Q);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("mod=%wu, n=%wd, npoints=%wd\n\n", mod, n, npoints);
nmod_poly_print(P), flint_printf("\n\n");
nmod_poly_print(Q), flint_printf("\n\n");
fflush(stdout);
flint_abort();
}
nmod_poly_clear(P);
nmod_poly_clear(Q);
_nmod_vec_clear(x);
_nmod_vec_clear(y);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtXmlPatterns module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#ifndef Patternist_MultiItemType_H
#define Patternist_MultiItemType_H
#include <QList>
#include "qitemtype_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QPatternist
{
/**
* @short Represents multiple types such as <tt>document()</tt> @em or <tt>xs:integer</tt>.
*
* In some situations two or more different types are allowed. For example, XQuery's
* @c validate expression accepts document or element nodes(but not attribute
* nodes, for example). MultiItemType is useful in such situations, its constructor
* takes a list of ItemType instances which its member functions treats as a wholeness.
*
* For example, xdtTypeMatches() returns @c true if any of the represented types matches.
*
* @ingroup Patternist_types
* @author Frans Englich <frans.englich@nokia.com>
*/
class MultiItemType : public ItemType
{
public:
/**
* Creates a MultiItemType representing the types in @p typeList. @p typeList must
* contain two or more types.
*/
MultiItemType(const ItemType::List &typeList);
/**
* The display name are the names concatenated with "|" as separator. For example,
* if this MultiItemType represents the types <tt>document()</tt>, <tt>xs:integer</tt>,
* and <tt>xs:anyAtomicType</tt>, the display name is
* "document() | xs:integer | xs:anyAtomicType".
*/
virtual QString displayName(const NamePool::Ptr &np) const;
/**
* If any of the types this MultiItemType represents matches @p item, it is
* considered a match.
*
* @returns @c true if any of the housed ItemType instances matches @p item, otherwise @c false
*/
virtual bool itemMatches(const Item &item) const;
/**
* If any of the types this MultiItemType represents matches @p other, it is
* considered a match.
*
* @returns @c true if any of the housed ItemType instances matches @p other, otherwise @c false
*/
virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
/**
* @returns @c true if any of the represented types is a node type.
*/
virtual bool isNodeType() const;
/**
* @returns @c true if any of the represented types is an atomic type.
*/
virtual bool isAtomicType() const;
/**
* Determines the union type of all the represented types super types. For example,
* if the represented types are <tt>xs:integer</tt>, <tt>document()</tt>
* and <tt>xs:string</tt>, <tt>item()</tt> is returned.
*/
virtual ItemType::Ptr xdtSuperType() const;
/**
* Determines the union type of all the represented types atomized types. For example,
* if the represented types are <tt>xs:integer</tt> and <tt>document()</tt>,
* <tt>xs:anyAtomicType</tt> is returned, because that's the super type of <tt>xs:integer</tt>
* and <tt>xs:untypedAtomic</tt>.
*/
virtual ItemType::Ptr atomizedType() const;
private:
const ItemType::List m_types;
const ItemType::List::const_iterator m_end;
};
}
QT_END_NAMESPACE
QT_END_HEADER
#endif
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Designer of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef FORMBUILDER_H
#define FORMBUILDER_H
#include <QtDesigner/uilib_global.h>
#include <QtDesigner/QAbstractFormBuilder>
#include <QtCore/QStringList>
#include <QtCore/QMap>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#if 0
// pragma for syncqt, don't remove.
#pragma qt_class(QFormBuilder)
#endif
class QDesignerCustomWidgetInterface;
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal
{
#endif
class QDESIGNER_UILIB_EXPORT QFormBuilder: public QAbstractFormBuilder
{
public:
QFormBuilder();
virtual ~QFormBuilder();
QStringList pluginPaths() const;
void clearPluginPaths();
void addPluginPath(const QString &pluginPath);
void setPluginPath(const QStringList &pluginPaths);
QList<QDesignerCustomWidgetInterface*> customWidgets() const;
protected:
virtual QWidget *create(DomUI *ui, QWidget *parentWidget);
virtual QWidget *create(DomWidget *ui_widget, QWidget *parentWidget);
virtual QLayout *create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget);
virtual QLayoutItem *create(DomLayoutItem *ui_layoutItem, QLayout *layout, QWidget *parentWidget);
virtual QAction *create(DomAction *ui_action, QObject *parent);
virtual QActionGroup *create(DomActionGroup *ui_action_group, QObject *parent);
virtual QWidget *createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name);
virtual QLayout *createLayout(const QString &layoutName, QObject *parent, const QString &name);
virtual void createConnections(DomConnections *connections, QWidget *widget);
virtual bool addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout);
virtual bool addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget);
virtual void updateCustomWidgets();
virtual void applyProperties(QObject *o, const QList<DomProperty*> &properties);
static QWidget *widgetByName(QWidget *topLevel, const QString &name);
private:
QStringList m_pluginPaths;
QMap<QString, QDesignerCustomWidgetInterface*> m_customWidgets;
};
#ifdef QFORMINTERNAL_NAMESPACE
}
#endif
QT_END_NAMESPACE
QT_END_HEADER
#endif // FORMBUILDER_H
|
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LAYERS_SELECT_TO_PCB_BASE_H__
#define __DIALOG_LAYERS_SELECT_TO_PCB_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/sizer.h>
#include <wx/gdicmn.h>
#include <wx/statline.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class LAYERS_MAP_DIALOG_BASE
///////////////////////////////////////////////////////////////////////////////
class LAYERS_MAP_DIALOG_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnBrdLayersCountSelection( wxCommandEvent& event ){ OnBrdLayersCountSelection( event ); }
void _wxFB_OnStoreSetup( wxCommandEvent& event ){ OnStoreSetup( event ); }
void _wxFB_OnGetSetup( wxCommandEvent& event ){ OnGetSetup( event ); }
void _wxFB_OnResetClick( wxCommandEvent& event ){ OnResetClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
protected:
enum
{
ID_LAYERS_MAP_DIALOG_BASE = 1000,
ID_M_STATICLINESEP,
ID_M_STATICTEXTCOPPERLAYERCOUNT,
ID_M_COMBOCOPPERLAYERSCOUNT,
ID_STORE_CHOICE,
ID_GET_PREVIOUS_CHOICE,
ID_RESET_CHOICE
};
wxStaticBoxSizer* sbSizerLayersTable;
wxFlexGridSizer* m_flexLeftColumnBoxSizer;
wxStaticLine* m_staticlineSep;
wxStaticText* m_staticTextCopperlayerCount;
wxComboBox* m_comboCopperLayersCount;
wxButton* m_buttonStore;
wxButton* m_buttonRetrieve;
wxButton* m_buttonReset;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnBrdLayersCountSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnStoreSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGetSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id = ID_LAYERS_MAP_DIALOG_BASE, const wxString& title = _("Layer selection:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,286 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~LAYERS_MAP_DIALOG_BASE();
};
#endif //__DIALOG_LAYERS_SELECT_TO_PCB_BASE_H__
|
/*
* Copyright (C) 2009 Nokia Corporation.
*
* Contact: Marius Vollmer <marius.vollmer@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef COMMANDWATCHER_H
#define COMMANDWATCHER_H
#include <QObject>
class QFile;
class QTextStream;
class QSocketNotifier;
class ContextProperty;
class QString;
class PropertyListener;
template <typename K, typename V> class QMap;
class CommandWatcher : public QObject
{
Q_OBJECT
public:
CommandWatcher(int commandfd, QMap<QString, PropertyListener*> *properties, QObject *parent = 0);
private:
int commandfd;
QSocketNotifier *commandNotifier;
void interpret(const QString& command) const;
QMap<QString, PropertyListener*> *properties;
static void help();
private Q_SLOTS:
void onActivated();
};
#endif
|
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fsl_dma_driver.h"
#if FSL_FEATURE_SOC_DMA_COUNT
/*******************************************************************************
* Code
******************************************************************************/
/* DMA IRQ handler with the same name in startup code*/
void DMA0_IRQHandler(void)
{
DMA_DRV_IRQhandler(0);
}
/* DMA IRQ handler with the same name in startup code*/
void DMA1_IRQHandler(void)
{
DMA_DRV_IRQhandler(1);
}
/* DMA IRQ handler with the same name in startup code*/
void DMA2_IRQHandler(void)
{
DMA_DRV_IRQhandler(2);
}
/* DMA IRQ handler with the same name in startup code*/
void DMA3_IRQHandler(void)
{
DMA_DRV_IRQhandler(3);
}
#endif
/*******************************************************************************
* EOF
******************************************************************************/
|
#ifndef IVL_entity_H
#define IVL_entity_H
/*
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
# include <map>
# include <list>
# include <vector>
# include <iostream>
# include "vtype.h"
# include "StringHeap.h"
# include "LineInfo.h"
typedef enum { PORT_NONE=0, PORT_IN, PORT_OUT, PORT_INOUT } port_mode_t;
class Architecture;
class Expression;
class InterfacePort : public LineInfo {
public:
InterfacePort(port_mode_t mod = PORT_NONE,
perm_string nam = empty_perm_string,
const VType*typ = NULL,
Expression*exp = NULL)
: mode(mod), name(nam), type(typ), expr(exp)
{}
explicit InterfacePort(const VType*typ)
: mode(PORT_NONE), type(typ), expr(NULL)
{}
InterfacePort(const VType*typ, port_mode_t mod)
: mode(mod), type(typ), expr(NULL)
{}
// Port direction from the source code.
port_mode_t mode;
// Name of the port from the source code
perm_string name;
// Name of interface type as given in the source code.
const VType*type;
// Default value expression (or nil)
Expression*expr;
};
/*
* The ComponentBase class represents the base entity
* declaration. When used as is, then this represents a forward
* declaration of an entity. Elaboration will match it to a proper
* entity. Or this can be the base class for a full-out Entity.
*/
class ComponentBase : public LineInfo {
public:
explicit ComponentBase(perm_string name);
~ComponentBase();
// Entities have names.
perm_string get_name() const { return name_; }
const InterfacePort* find_port(perm_string by_name) const;
const InterfacePort* find_generic(perm_string by_name) const;
const std::vector<InterfacePort*>& get_generics() const { return parms_; }
// Declare the ports for the entity. The parser calls this
// method with a list of interface elements that were parsed
// for the entity. This method collects those entities, and
// empties the list in the process.
void set_interface(std::list<InterfacePort*>*parms,
std::list<InterfacePort*>*ports);
void write_to_stream(std::ostream&fd) const;
public:
void dump_generics(std::ostream&out, int indent =0) const;
void dump_ports(std::ostream&out, int indent = 0) const;
private:
perm_string name_;
protected:
std::vector<InterfacePort*> parms_;
std::vector<InterfacePort*> ports_;
};
/*
* Entities are fully declared components.
*/
class Entity : public ComponentBase {
public:
explicit Entity(perm_string name);
~Entity();
// bind an architecture to the entity, and return the
// Architecture that was bound. If there was a previous
// architecture with the same name bound, then do not replace
// the architecture and instead return the old
// value. The caller can tell that the bind worked if the
// returned pointer is the same as the passed pointer.
Architecture* add_architecture(Architecture*);
// After the architecture is bound, elaboration calls this
// method to elaborate this entity. This method arranges for
// elaboration to happen all the way through the architecture
// that is bound to this entity.
int elaborate();
// During elaboration, it may be discovered that a port is
// used as an l-value in an assignment. This method tweaks the
// declaration to allow for that case.
void set_declaration_l_value(perm_string by_name, bool flag);
int emit(ostream&out);
void dump(ostream&out, int indent = 0) const;
private:
std::map<perm_string,Architecture*>arch_;
Architecture*bind_arch_;
map<perm_string,VType::decl_t> declarations_;
int elaborate_generic_exprs_(void);
int elaborate_ports_(void);
};
/*
* As the parser parses entities, it puts them into this map. It uses
* a map because sometimes it needs to look back at an entity by name.
*/
extern std::map<perm_string,Entity*> design_entities;
/*
* Elaborate the collected entities, and return the number of
* elaboration errors.
*/
extern int elaborate_entities(void);
extern int emit_entities(void);
/*
* Use this function to dump a description of the design entities to a
* file. This is for debug, not for any useful purpose.
*/
extern void dump_design_entities(ostream&file);
#endif /* IVL_entity_H */
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef Q3SIMPLEWIDGETS_H
#define Q3SIMPLEWIDGETS_H
#include <QtGui/qaccessiblewidget.h>
QT_BEGIN_NAMESPACE
class Q3AccessibleDisplay : public QAccessibleWidget
{
public:
explicit Q3AccessibleDisplay(QWidget *w, Role role = StaticText);
QString text(Text t, int child) const;
Role role(int child) const;
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
int navigate(RelationFlag, int entry, QAccessibleInterface **target) const;
};
QT_END_NAMESPACE
#endif // Q3SIMPLEWIDGETS_H
|
/*
* This file is part of hildon-status-menu
*
* Copyright (C) 2006, 2007, 2008 Nokia Corporation.
*
* Based on main.c from hildon-desktop.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libgnomevfs/gnome-vfs.h>
#include <libhildondesktop/libhildondesktop.h>
#include <hildon/hildon.h>
#include <libintl.h>
#include <locale.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "hd-status-area.h"
#include "hd-status-menu.h"
#include "hd-status-menu-config.h"
#define HD_STAMP_DIR "/tmp/hildon-desktop/"
#define HD_STATUS_MENU_STAMP_FILE HD_STAMP_DIR "status-menu.stamp"
/* signal handler, hildon-desktop sends SIGTERM to all tracked applications
* when it receives SIGTEM itself */
static void
signal_handler (int signal)
{
gtk_main_quit ();
}
static guint
load_priority_func (const gchar *plugin_id,
GKeyFile *keyfile,
gpointer data)
{
GError *error = NULL;
guint priority = G_MAXUINT;
/* The permament status area items (clock, signal and
* battery) should be loaded first (priority == 0) */
if (g_key_file_has_key (keyfile,
plugin_id,
HD_STATUS_AREA_CONFIG_KEY_PERMANENT_ITEM,
NULL))
return 0;
/* Then the plugins should be loaded regarding to there
* position in the status area. */
priority = (guint) g_key_file_get_integer (keyfile,
plugin_id,
HD_STATUS_AREA_CONFIG_KEY_POSITION,
&error);
if (error == NULL)
return priority;
/* If position is not set, load last (priority == max) */
g_error_free (error);
return G_MAXUINT;
}
static gboolean
load_plugins_idle (gpointer data)
{
/* Load the configuration of the plugin manager and load plugins */
hd_plugin_manager_run (HD_PLUGIN_MANAGER (data));
return FALSE;
}
static void
console_quiet(void)
{
close(0);
close(1);
close(2);
if (open("/dev/null", O_RDONLY) < 0)
g_warning ("%s: failed opening /dev/null read-only", __func__);
if (dup(open("/dev/null", O_WRONLY)) < 0)
g_warning ("%s: failed opening /dev/null write-only", __func__);
}
int
main (int argc, char **argv)
{
GtkWidget *status_area;
HDPluginManager *plugin_manager;
if (!g_thread_supported ())
g_thread_init (NULL);
setlocale (LC_ALL, "");
/* Initialize Gtk+ */
gtk_init (&argc, &argv);
/* Initialize Hildon */
hildon_init ();
/* Initialize GnomeVFS */
gnome_vfs_init ();
/* Add handler for TERM and signals */
signal (SIGTERM, signal_handler);
signal (SIGINT, signal_handler);
if (getenv ("DEBUG_OUTPUT") == NULL)
console_quiet ();
/* Setup Stamp File */
hd_stamp_file_init (HD_STATUS_MENU_STAMP_FILE);
/* Create a plugin manager instance */
plugin_manager = hd_plugin_manager_new (
hd_config_file_new_with_defaults ("status-menu.conf"));
/* Set the load priority function */
hd_plugin_manager_set_load_priority_func (plugin_manager,
load_priority_func,
NULL,
NULL);
/* Create simple window to show the Status Menu
*/
status_area = hd_status_area_new (plugin_manager);
/* Show Status Area */
gtk_widget_show (status_area);
/* Load Plugins when idle */
gdk_threads_add_idle (load_plugins_idle, plugin_manager);
/* Start the main loop */
gtk_main ();
/* Delete the stamp file */
hd_stamp_file_finalize (HD_STATUS_MENU_STAMP_FILE);
return 0;
}
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: icons.h,v 1.1 2004/04/16 11:24:47 amoll Exp $
// this file contains the icons needed by BALLView in XPM format
// the application icon - the BALL bucky (64x64)
extern const char* bucky_64x64_xpm[];
|
/***************************************************************************
begin : Fri Feb 15 2008
copyright : (C) 2008-2017 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* Please see toplevel file COPYING for license details *
***************************************************************************/
#ifndef GWEN_HTTP_SESSION_P_H
#define GWEN_HTTP_SESSION_P_H
#include <gwenhywfar/httpsession.h>
struct GWEN_HTTP_SESSION {
GWEN_INHERIT_ELEMENT(GWEN_HTTP_SESSION);
char *url;
char *defaultProtocol;
int defaultPort;
GWEN_SYNCIO *syncIo;
uint32_t flags;
int httpVMajor;
int httpVMinor;
char *httpUserAgent;
char *httpContentType;
GWEN_HTTPSESSION_INITSYNCIO_FN initSyncIoFn;
uint32_t usage;
};
static int GWEN_HttpSession__RecvPacket(GWEN_HTTP_SESSION *sess, GWEN_BUFFER *buf);
static int GWEN_HttpSession__RecvPacketToSio(GWEN_HTTP_SESSION *sess, GWEN_SYNCIO *sio);
static int GWEN_HttpSession_InitSyncIo(GWEN_HTTP_SESSION *sess, GWEN_SYNCIO *sio);
#endif
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Thursday, May 15, 2003
*
* Purpose: This file contains declarations which are visible only within
* the H5B package. Source files outside the H5B package should
* include H5Bprivate.h instead.
*/
#ifndef H5B_PACKAGE
#error "Do not include this file outside the H5B package!"
#endif
#ifndef _H5Bpkg_H
#define _H5Bpkg_H
/* Get package's private header */
#include "H5Bprivate.h"
/* Other private headers needed by this file */
#include "H5RCprivate.h" /* Reference counted objects */
/**************************/
/* Package Private Macros */
/**************************/
/****************************/
/* Package Private Typedefs */
/****************************/
/* The B-tree node as stored in memory... */
struct H5B_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
/* first field in structure */
H5RC_t *rc_shared; /*ref-counted shared info */
unsigned level; /*node level */
unsigned nchildren; /*number of child pointers */
haddr_t left; /*address of left sibling */
haddr_t right; /*address of right sibling */
uint8_t *native; /*array of keys in native format */
haddr_t *child; /*2k child pointers */
};
/*****************************/
/* Package Private Variables */
/*****************************/
/* H5B header inherits cache-like properties from H5AC */
H5_DLLVAR const H5AC_class_t H5AC_BT[1];
/* Declare a free list to manage the haddr_t sequence information */
H5FL_SEQ_EXTERN(haddr_t);
/* Declare a PQ free list to manage the native block information */
H5FL_BLK_EXTERN(native_block);
/* Declare a free list to manage the H5B_t struct */
H5FL_EXTERN(H5B_t);
/******************************/
/* Package Private Prototypes */
/******************************/
herr_t H5B_dest(H5F_t *f, H5B_t *b);
#endif /*_H5Bpkg_H*/
|
#ifndef CONNECT_GLOBAL_H
#define CONNECT_GLOBAL_H
#include "Connect_global.h"
#include <QObject>
#if defined(CONNECT_LIBRARY)
# define CONNECTSHARED_EXPORT Q_DECL_EXPORT
#else
# define CONNECTSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // CONNECT_GLOBAL_H
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2014. *
* *
* This program is free software. You may use, modify, and redistribute it *
* under the terms of the GNU Affero General Public License as published *
* by the Free Software Foundation, either version 3 or (at your option) *
* any later version. This program is distributed without any warranty. *
* See the file COPYING.agpl-v3 for details. *
\*************************************************************************/
/* Listing 4-3 */
/* seek_io.c
Demonstrate the use of lseek() and file I/O system calls.
Usage: seek_io file {r<length>|R<length>|w<string>|s<offset>}...
This program opens the file named on its command line, and then performs
the file I/O operations specified by its remaining command-line arguments:
r<length> Read 'length' bytes from the file at current
file offset, displaying them as text.
R<length> Read 'length' bytes from the file at current
file offset, displaying them in hex.
w<string> Write 'string' at current file offset.
s<offset> Set the file offset to 'offset'.
Example:
seek_io myfile wxyz s1 r2
*/
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include "tlpi_hdr.h"
int
main(int argc, char *argv[])
{
size_t len;
off_t offset;
int fd, ap, j;
char *buf;
ssize_t numRead, numWritten;
if (argc < 3 || strcmp(argv[1], "--help") == 0)
usageErr("%s file {r<length>|R<length>|w<string>|s<offset>}...\n",
argv[0]);
fd = open(argv[1], O_RDWR | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH); /* rw-rw-rw- */
if (fd == -1)
errExit("open");
for (ap = 2; ap < argc; ap++) {
switch (argv[ap][0]) {
case 'r': /* Display bytes at current offset, as text */
case 'R': /* Display bytes at current offset, in hex */
len = getLong(&argv[ap][1], GN_ANY_BASE, argv[ap]);
buf = malloc(len);
if (buf == NULL)
errExit("malloc");
numRead = read(fd, buf, len);
if (numRead == -1)
errExit("read");
if (numRead == 0) {
printf("%s: end-of-file\n", argv[ap]);
} else {
printf("%s: ", argv[ap]);
for (j = 0; j < numRead; j++) {
if (argv[ap][0] == 'r')
printf("%c", isprint((unsigned char) buf[j]) ?
buf[j] : '?');
else
printf("%02x ", (unsigned int) buf[j]);
}
printf("\n");
}
free(buf);
break;
case 'w': /* Write string at current offset */
numWritten = write(fd, &argv[ap][1], strlen(&argv[ap][1]));
if (numWritten == -1)
errExit("write");
printf("%s: wrote %ld bytes\n", argv[ap], (long) numWritten);
break;
case 's': /* Change file offset */
offset = getLong(&argv[ap][1], GN_ANY_BASE, argv[ap]);
if (lseek(fd, offset, SEEK_SET) == -1)
errExit("lseek");
printf("%s: seek succeeded\n", argv[ap]);
break;
default:
cmdLineErr("Argument must start with [rRws]: %s\n", argv[ap]);
}
}
exit(EXIT_SUCCESS);
}
|
#ifndef _MM_H
#define _MM_H
#define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。
// 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。
extern unsigned long get_free_page (void);
// 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。
extern unsigned long put_page (unsigned long page, unsigned long address);
// 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。
extern void free_page (unsigned long addr);
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright (C) 2009 Hiroyuki Ikezoe <poincare@ikezoe.net>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __GSD_MOUSE_EXTENSION_MANAGER_H__
#define __GSD_MOUSE_EXTENSION_MANAGER_H__
#include "gsd-pointing-device-manager.h"
G_BEGIN_DECLS
#define GSD_TYPE_MOUSE_EXTENSION_MANAGER (gsd_mouse_extension_manager_get_type ())
#define GSD_MOUSE_EXTENSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_MOUSE_EXTENSION_MANAGER, GsdMouseExtensionManager))
#define GSD_MOUSE_EXTENSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_MOUSE_EXTENSION_MANAGER, GsdTracklassPointManagerClass))
#define GSD_IS_MOUSE_EXTENSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_MOUSE_EXTENSION_MANAGER))
#define GSD_IS_MOUSE_EXTENSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_MOUSE_EXTENSION_MANAGER))
#define GSD_MOUSE_EXTENSION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_MOUSE_EXTENSION_MANAGER, GsdTracklassPointManagerClass))
typedef struct _GsdMouseExtensionManager GsdMouseExtensionManager;
typedef struct _GsdMouseExtensionManagerClass GsdMouseExtensionManagerClass;
struct _GsdMouseExtensionManager
{
GsdPointingDeviceManager parent;
};
struct _GsdMouseExtensionManagerClass
{
GsdPointingDeviceManagerClass parent_class;
};
GType gsd_mouse_extension_manager_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GSD_MOUSE_EXTENSION_MANAGER_H__ */
/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/
|
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
/**
* FairMQContext.h
*
* @since 2012-12-05
* @author D. Klein, A. Rybalchenko
*/
#ifndef FAIRMQCONTEXTZMQ_H_
#define FAIRMQCONTEXTZMQ_H_
class FairMQContextZMQ
{
public:
/// Constructor
FairMQContextZMQ(int numIoThreads);
virtual ~FairMQContextZMQ();
void* GetContext();
void Close();
private:
void* fContext;
/// Copy Constructor
FairMQContextZMQ(const FairMQContextZMQ&);
FairMQContextZMQ operator=(const FairMQContextZMQ&);
};
#endif /* FAIRMQCONTEXTZMQ_H_ */
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains a handy indexed triangle class.
* \file IceIndexedTriangle.h
* \author Pierre Terdiman
* \date January, 17, 2000
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include Guard
#ifndef __ICEINDEXEDTRIANGLE_H__
#define __ICEINDEXEDTRIANGLE_H__
// Forward declarations
#ifdef _MSC_VER
enum CubeIndex;
#else
typedef int CubeIndex;
#endif
// An indexed triangle class.
class ICEMATHS_API IndexedTriangle
{
public:
//! Constructor
inline_ IndexedTriangle() {}
//! Constructor
inline_ IndexedTriangle(udword r0, udword r1, udword r2) { mVRef[0]=r0; mVRef[1]=r1; mVRef[2]=r2; }
//! Copy constructor
inline_ IndexedTriangle(const IndexedTriangle& triangle)
{
mVRef[0] = triangle.mVRef[0];
mVRef[1] = triangle.mVRef[1];
mVRef[2] = triangle.mVRef[2];
}
//! Destructor
inline_ ~IndexedTriangle() {}
//! Vertex-references
udword mVRef[3];
// Methods
void Flip();
float Area(const Point* verts) const;
float Perimeter(const Point* verts) const;
float Compacity(const Point* verts) const;
void Normal(const Point* verts, Point& normal) const;
void DenormalizedNormal(const Point* verts, Point& normal) const;
void Center(const Point* verts, Point& center) const;
void CenteredNormal(const Point* verts, Point& normal) const;
void RandomPoint(const Point* verts, Point& random) const;
bool IsVisible(const Point* verts, const Point& source) const;
bool BackfaceCulling(const Point* verts, const Point& source) const;
float ComputeOcclusionPotential(const Point* verts, const Point& view) const;
bool ReplaceVertex(udword oldref, udword newref);
bool IsDegenerate() const;
bool HasVertex(udword ref) const;
bool HasVertex(udword ref, udword* index) const;
ubyte FindEdge(udword vref0, udword vref1) const;
udword OppositeVertex(udword vref0, udword vref1) const;
inline_ udword OppositeVertex(ubyte edgenb) const { return mVRef[2-edgenb]; }
void GetVRefs(ubyte edgenb, udword& vref0, udword& vref1, udword& vref2) const;
float MinEdgeLength(const Point* verts) const;
float MaxEdgeLength(const Point* verts) const;
void ComputePoint(const Point* verts, float u, float v, Point& pt, udword* nearvtx=null) const;
float Angle(const IndexedTriangle& tri, const Point* verts) const;
inline_ Plane PlaneEquation(const Point* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
bool Equal(const IndexedTriangle& tri) const;
CubeIndex ComputeCubeIndex(const Point* verts) const;
};
#endif // __ICEINDEXEDTRIANGLE_H__
|
/**
******************************************************************************
* @file ADC/ADC_AnalogWatchdog/Inc/main.h
* @author MCD Application Team
* @version V1.3.0
* @date 18-December-2015
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* 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. Neither the name of STMicroelectronics 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 HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
#include "stm32f1xx_nucleo.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Trigger for ADC: */
/* - If this literal is defined: ADC is operating in not continuous mode */
/* and conversions are trigger by external trigger: timer. */
/* - If this literal is not defined: ADC is operating in continuous mode */
/* and first conversion is trigger by software trigger. */
#define ADC_TRIGGER_FROM_TIMER
/* User can use this section to tailor ADCx instance under use and associated
resources */
/* ## Definition of ADC related resources ################################### */
/* Definition of ADCx clock resources */
#define ADCx ADC1
#define ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define ADCx_FORCE_RESET() __HAL_RCC_ADC1_FORCE_RESET()
#define ADCx_RELEASE_RESET() __HAL_RCC_ADC1_RELEASE_RESET()
/* Definition of ADCx channels */
#define ADCx_CHANNELa ADC_CHANNEL_4
/* Definition of ADCx channels pins */
#define ADCx_CHANNELa_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADCx_CHANNELa_GPIO_PORT GPIOA
#define ADCx_CHANNELa_PIN GPIO_PIN_4
/* Definition of ADCx DMA resources */
#define ADCx_DMA_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
#define ADCx_DMA DMA1_Channel1
#define ADCx_DMA_IRQn DMA1_Channel1_IRQn
#define ADCx_DMA_IRQHandler DMA1_Channel1_IRQHandler
/* Definition of ADCx NVIC resources */
#define ADCx_IRQn ADC1_2_IRQn
#define ADCx_IRQHandler ADC1_2_IRQHandler
#if defined(ADC_TRIGGER_FROM_TIMER)
/* ## Definition of TIM related resources ################################### */
/* Definition of TIMx clock resources */
#define TIMx TIM3 /* Caution: Timer instance must be on APB1 (clocked by PCLK1) due to frequency computation in function "TIM_Config()" */
#define TIMx_CLK_ENABLE() __HAL_RCC_TIM3_CLK_ENABLE()
#define TIMx_FORCE_RESET() __HAL_RCC_TIM3_FORCE_RESET()
#define TIMx_RELEASE_RESET() __HAL_RCC_TIM3_RELEASE_RESET()
#define ADC_EXTERNALTRIGCONV_Tx_TRGO ADC_EXTERNALTRIGCONV_T3_TRGO
#endif /* ADC_TRIGGER_FROM_TIMER */
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Manage async heap tasks.
*/
#ifndef _DALVIK_ALLOC_HEAP_WORKER
#define _DALVIK_ALLOC_HEAP_WORKER
/*
* Initialize any HeapWorker state that Heap.c
* cares about. This lets the GC start before the
* HeapWorker thread is initialized.
*/
void dvmInitializeHeapWorkerState(void);
/*
* Initialization. Starts/stops the worker thread.
*/
bool dvmHeapWorkerStartup(void);
void dvmHeapWorkerShutdown(void);
/*
* Tell the worker thread to wake up and do work.
* If shouldLock is false, the caller must have already
* acquired gDvm.heapWorkerLock.
*/
void dvmSignalHeapWorker(bool shouldLock);
/*
* Block until all pending heap worker work has finished.
*/
void dvmWaitForHeapWorkerIdle(void);
/*
* Does not return until any pending finalizers have been called.
* This may or may not happen in the context of the calling thread.
* No exceptions will escape.
*
* Used by zygote, which doesn't have a HeapWorker thread.
*/
void dvmRunFinalizationSync(void);
/*
* Requests that dvmHeapSourceTrim() be called no sooner
* than timeoutSec seconds from now. If timeoutSec
* is zero, any pending trim is cancelled.
*
* Caller must hold heapWorkerLock.
*/
void dvmScheduleHeapSourceTrim(size_t timeoutSec);
/* Make sure that the HeapWorker thread hasn't spent an inordinate
* amount of time inside interpreted code.
*
* Aborts the VM if the thread appears to be wedged.
*
* The caller must hold the heapWorkerLock.
*/
void dvmAssertHeapWorkerThreadRunning();
/*
* The type of operation for HeapWorker to perform on an object.
*/
typedef enum HeapWorkerOperation {
WORKER_FINALIZE = 0,
WORKER_ENQUEUE = 1,
} HeapWorkerOperation;
/*
* Called by the worker thread to get the next object
* to finalize/enqueue/clear. Implemented in Heap.c.
*
* @param op The operation to perform on the returned object.
* Must be non-NULL.
* @return The object to operate on, or NULL.
*/
Object *dvmGetNextHeapWorkerObject(HeapWorkerOperation *op);
#endif /*_DALVIK_ALLOC_HEAP_WORKER*/
|
#include <sys/types.h>
#include "seek.h"
#define SET 0 /* sigh */
int seek_set(fd,pos) int fd; seek_pos pos;
{ if (lseek(fd,(off_t) pos,SET) == -1) return -1; return 0; }
|
#include "debug.h"
#include "graphics.h"
#include "output.h"
#include "list.h"
#include "signal.h"
#include "string.h"
struct element* systemlog = NULL;
void haltdump(char* msg, int err)
{
int eax, ebx, ecx, edx, esi, edi;
int* stack;
asm volatile ("" // Load variables with initial register states.
:"=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx), "=S"(esi), "=D"(edi));
asm volatile ("movl %%ebp, %%eax" : "=a"(stack));
char dumpcolor = get_color(HALTDUMP_FG, HALTDUMP_BG); // Get the color to use for printing.
void* eip = __builtin_return_address(1); // Get the return address of the function above this one (as EIP).
asm volatile("cli"); // Disable interrupts, no reason to keep them running.
kclear(); // Clear the screen and fill with color.
kccolor(get_position(0, 0), COLUMNS * ROWS * 2, dumpcolor);
kprint(get_position(1, 1), "!! FATAL PROBLEM - KERNEL HALTDUMP !!", dumpcolor);
kprint(get_position(1, 3), "Message:", dumpcolor);
kprint(get_position(10, 3), msg, dumpcolor);
kprint(get_position(1, 4), "Error #:", dumpcolor);
kprintnum(get_position(10, 4), err, dumpcolor, 10);
kprint(get_position(1, 6), "Caller Location: 0x", dumpcolor);
kprintnum(get_position(20, 6), (int)eip, dumpcolor, 16);
// Print the stack:
kprint(get_position(1, 9), "Stack: 0x", dumpcolor);
kprintnum(get_position(10, 9), (int)stack, dumpcolor, 16);
kprintnum(get_position(1, 11), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(13, 11), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(25, 11), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(37, 11), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(49, 11), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(61, 11), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(1, 12), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(13, 12), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(25, 12), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(37, 12), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(49, 12), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(61, 12), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(1, 13), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(13, 13), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(25, 13), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(37, 13), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(49, 13), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(61, 13), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(1, 14), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(13, 14), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(25, 14), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(37, 14), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(49, 14), *stack, dumpcolor, 16); stack++;
kprintnum(get_position(61, 14), *stack, dumpcolor, 16); stack++;
// Print the registers:
kprint(get_position(1, 16), "Registers:", dumpcolor);
kprint(get_position(1, 18), "EAX:", dumpcolor);
kprintnum(get_position(6, 18), eax, dumpcolor, 16);
kprint(get_position(24, 18), "EBX:", dumpcolor);
kprintnum(get_position(29, 18), ebx, dumpcolor, 16);
kprint(get_position(47, 18), "ECX:", dumpcolor);
kprintnum(get_position(52, 18), ecx, dumpcolor, 16);
kprint(get_position(1, 19), "EDX:", dumpcolor);
kprintnum(get_position(6, 19), edx, dumpcolor, 16);
kprint(get_position(24, 19), "ESI:", dumpcolor);
kprintnum(get_position(29, 19), esi, dumpcolor, 16);
kprint(get_position(47, 19), "EDI:", dumpcolor);
kprintnum(get_position(52, 19), edi, dumpcolor, 16);
kprint(get_position(1, 23), "If this problem has occurred multiple times, please report it to a developer.", dumpcolor);
kflip();
while(true) { } // And loop forever, no recovering from a haltdump.
}
void klog(char* msg)
{
if (systemlog == NULL)
systemlog = list_new(msg);
else
list_add(systemlog, msg);
}
struct element* getlog()
{
return systemlog;
}
|
//
// JingXuanModel.h
// The weekend to play
//
// Created by scjy on 16/1/8.
// Copyright © 2016年 秦俊珍. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JingXuanModel : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *image;
@property (nonatomic, copy) NSString *age;
@property (nonatomic, copy) NSString *counts;
@property (nonatomic, copy) NSString *price;
@property (nonatomic, copy) NSString *activityId;
@property (nonatomic, copy) NSString *type;
@property (nonatomic, copy) NSString *address;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
@end
|
/*
* Copyright 2008-2010 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <thrust/iterator/iterator_traits.h>
#include <thrust/detail/device/cuda/fill.h>
#include <thrust/detail/device/generic/fill.h>
namespace thrust
{
namespace detail
{
namespace device
{
namespace dispatch
{
template<typename OutputIterator,
typename Size,
typename T,
typename Space>
OutputIterator fill_n(OutputIterator first,
Size n,
const T &value,
Space)
{
// generic backend
return thrust::detail::device::generic::fill_n(first, n, value);
}
template<typename OutputIterator,
typename Size,
typename T>
OutputIterator fill_n(OutputIterator first,
Size n,
const T &value,
thrust::detail::cuda_device_space_tag)
{
// refinement for the CUDA backend
return thrust::detail::device::cuda::fill_n(first, n, value);
}
} // end dispatch
} // end device
} // end detail
} // end thrust
|
#pragma once
#include "common/protobuf/protobuf.h"
#include "absl/types/optional.h"
namespace Envoy {
namespace Config {
class ApiTypeOracle {
public:
/**
* Based on a given message, determine if there exists an earlier version of
* this message. If so, return the descriptor for the earlier
* message, to support upgrading via VersionConverter::upgrade().
*
* @param message_type protobuf message type
* @return const Protobuf::Descriptor* descriptor for earlier message version
* corresponding to message, if any, otherwise nullptr.
*/
static const Protobuf::Descriptor* getEarlierVersionDescriptor(const std::string& message_type);
static const absl::optional<std::string>
getEarlierVersionMessageTypeName(const std::string& message_type);
};
} // namespace Config
} // namespace Envoy
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/route53/Route53_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace Route53
{
namespace Model
{
enum class RRType
{
NOT_SET,
SOA,
A,
TXT,
NS,
CNAME,
MX,
NAPTR,
PTR,
SRV,
SPF,
AAAA,
CAA
};
namespace RRTypeMapper
{
AWS_ROUTE53_API RRType GetRRTypeForName(const Aws::String& name);
AWS_ROUTE53_API Aws::String GetNameForRRType(RRType value);
} // namespace RRTypeMapper
} // namespace Model
} // namespace Route53
} // namespace Aws
|
@import Foundation;
@interface OBAServiceAlertsModel : NSObject
@property (nonatomic) NSUInteger unreadCount;
@property (nonatomic) NSUInteger totalCount;
@property (nonatomic,strong) NSString * unreadMaxSeverity;
@property (nonatomic,strong) NSString * maxSeverity;
@end
|
/*
* Copyright 2014 CyberVision, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../platform/platform.h"
#include "../utilities/kaa_mem.h"
#ifdef KAA_TRACE_MEMORY_ALLOCATIONS
#if KAA_LOG_LEVEL_TRACE_ENABLED
static kaa_logger_t * logger_ = NULL;
#endif
void *kaa_trace_memory_allocs_malloc(size_t s, const char *file, int line) {
#if KAA_LOG_LEVEL_TRACE_ENABLED
void *ptr = __KAA_MALLOC(s);
if (logger_)
kaa_log_write(logger_, file, line, KAA_LOG_LEVEL_TRACE, KAA_ERR_NONE, "Allocated (using malloc) %d bytes at {%p}", s, ptr);
return ptr;
#else
return malloc(s);
#endif
}
void *kaa_trace_memory_allocs_calloc(size_t n, size_t s, const char *file, int line) {
#if KAA_LOG_LEVEL_TRACE_ENABLED
void *ptr = __KAA_CALLOC(n, s);
if (logger_)
kaa_log_write(logger_, file, line, KAA_LOG_LEVEL_TRACE, KAA_ERR_NONE, "Allocated (using calloc) %u blocks of %u bytes (total %u) at {%p}", n, s, n*s, ptr);
return ptr;
#else
return calloc(n, s);
#endif
}
void kaa_trace_memory_allocs_free(void * p, const char *file, int line)
{
#if KAA_LOG_LEVEL_TRACE_ENABLED
if (logger_)
kaa_log_write(logger_, file, line, KAA_LOG_LEVEL_TRACE, KAA_ERR_NONE, "Going to deallocate memory at {%p}", p);
#endif
__KAA_FREE(p);
}
void kaa_trace_memory_allocs_set_logger(kaa_logger_t *logger)
{
#if KAA_LOG_LEVEL_TRACE_ENABLED
logger_ = logger;
#endif
}
#endif
|
/**
* FreeRDP: A Remote Desktop Protocol Implementation
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "wf_channels.h"
#include "wf_rail.h"
#include "wf_cliprdr.h"
#include <freerdp/gdi/gfx.h>
#include <freerdp/log.h>
#define TAG CLIENT_TAG("windows")
void wf_OnChannelConnectedEventHandler(rdpContext* context,
ChannelConnectedEventArgs* e)
{
wfContext* wfc = (wfContext*) context;
rdpSettings* settings = context->settings;
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
if (!settings->SoftwareGdi)
WLog_WARN(TAG, "Channel "RDPGFX_DVC_CHANNEL_NAME" does not support hardware acceleration, using fallback.");
gdi_graphics_pipeline_init(context->gdi, (RdpgfxClientContext*) e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
wf_rail_init(wfc, (RailClientContext*) e->pInterface);
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
wf_cliprdr_init(wfc, (CliprdrClientContext*) e->pInterface);
}
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
}
}
void wf_OnChannelDisconnectedEventHandler(rdpContext* context,
ChannelDisconnectedEventArgs* e)
{
wfContext* wfc = (wfContext*) context;
rdpSettings* settings = context->settings;
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_uninit(context->gdi,
(RdpgfxClientContext*) e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
wf_rail_uninit(wfc, (RailClientContext*) e->pInterface);
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
wf_cliprdr_uninit(wfc, (CliprdrClientContext*) e->pInterface);
}
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
}
}
|
/**
* Copyright (c) 2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* This generated code and related technologies are covered by patents
* or patents pending by Appcelerator, Inc.
*/
// WARNING: this file is generated and will be overwritten
// Generated on Mon May 12 2014 10:36:47 GMT-0700 (PDT)
// if you're checking out this file, you should check us out too.
// http://jobs.appcelerator.com
/**
* JSC implementation for UIKit/UIBezierPath
*/
@import JavaScriptCore;
@import UIKit;
#import <hyperloop.h>
#import <ti_coremotion_converters.h>
@import CoreGraphics;
@import Foundation;
@import UIKit;
// export typdefs we use
typedef id (*Function_id__P__id__SEL______)(id,SEL,...);
// export methods we use
extern CGAffineTransform * HyperloopJSValueRefToCGAffineTransform(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGBlendMode HyperloopJSValueRefToCGBlendMode(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGFloat * HyperloopJSValueRefToCGFloat_P(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGLineCap HyperloopJSValueRefToCGLineCap(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGLineJoin HyperloopJSValueRefToCGLineJoin(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGPoint * HyperloopJSValueRefToCGPoint(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGRect * HyperloopJSValueRefToCGRect(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern CGSize * HyperloopJSValueRefToCGSize(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern Class HyperloopJSValueRefToClass(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern JSValueRef HyperloopCGLineCapToJSValueRef(JSContextRef,CGLineCap);
extern JSValueRef HyperloopCGLineJoinToJSValueRef(JSContextRef,CGLineJoin);
extern JSValueRef HyperloopCGPointToJSValueRef(JSContextRef,CGPoint *);
extern JSValueRef HyperloopCGRectToJSValueRef(JSContextRef,CGRect *);
extern JSValueRef HyperloopClassToJSValueRef(JSContextRef,Class);
extern JSValueRef HyperloopNSArrayToJSValueRef(JSContextRef,NSArray *);
extern JSValueRef HyperloopNSMethodSignatureToJSValueRef(JSContextRef,NSMethodSignature *);
extern JSValueRef HyperloopNSSetToJSValueRef(JSContextRef,NSSet *);
extern JSValueRef HyperloopNSStringToJSValueRef(JSContextRef,NSString *);
extern JSValueRef HyperloopUIBezierPathToJSValueRef(JSContextRef,UIBezierPath *);
extern JSValueRef HyperloopboolToJSValueRef(JSContextRef,bool);
extern JSValueRef Hyperloopconst_struct_CGPath_PToJSValueRef(JSContextRef,const struct CGPath * *);
extern JSValueRef HyperloopfloatToJSValueRef(JSContextRef,float);
extern JSValueRef Hyperloopid__P__id__SEL______ToJSValueRef(JSContextRef,Function_id__P__id__SEL______);
extern JSValueRef HyperloopintToJSValueRef(JSContextRef,int);
extern NSInteger * HyperloopJSValueRefToNSInteger_P(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern NSString * HyperloopJSValueRefToNSString(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern SEL HyperloopJSValueRefToSEL(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern UIBezierPath * HyperloopJSValueRefToUIBezierPath(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern UIRectCorner HyperloopJSValueRefToUIRectCorner(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern bool HyperloopJSValueRefTobool(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern float HyperloopJSValueRefTofloat(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern id HyperloopJSValueRefToid(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern int HyperloopJSValueRefToint(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern struct CGPath * HyperloopJSValueRefToconst_struct_CGPath_P(JSContextRef,JSValueRef,JSValueRef*,bool*);
extern struct _NSZone * HyperloopJSValueRefTostruct__NSZone_P(JSContextRef,JSValueRef,JSValueRef*,bool*);
|
#ifndef __PROBABILISTICEGOMOTION_H
#define __PROBABILISTICEGOMOTION_H
/**
* @file ProbabilisticEgomotion.h
* @brief Declarations for functions used for 3D egomotion estimation.
* Code for computing Egomotion from correspondence probability distributions.
* the function compute3Dmotion provides the entire public interface.
* print3Dmotion is a trivial function which prints out the motion parameters in a
* MotionParameters struct.
*
* @author Justin Domke
*/
///structure for storing 3D egomotion parameters.
/**
@see compute3Dmotion(OvImageAdapter & image1, OvImageAdapter & image2, float f, float pp_x, float pp_y, int numpoints, int numsearches)
*/
typedef struct
{
float tx; /**< X-component of translation */
float ty; /**< Y-component of translation */
float tz; /**< Z-component of translation */
float r_x; /**< X-component of rotation */
float r_y; /**< Y-component of rotation */
float r_z; /**< Z-component of rotation */
float score; /**< motion score */
} MotionParameters;
/**
* Print out the motion parameters for this particular estimate. i.e.
* <pre>
* print3Dmotion(egomotion);
* </pre>
* @param egomotion is a MotionParameters struct containing the motion parameters
* @see compute3Dmotion
*/
void print3Dmotion(MotionParameters egomotion);
/**
* @fn MotionParameters compute3Dmotion(OvImageAdapter & image1, OvImageAdapter & image2, float f, float pp_x, float pp_y, int numpoints=500, int numsearches=100);
* Get the egomotion from two calibrated images.
* <pre>
* MotionParameters egomotion = compute3Dmotion(image1, image2, f, pp_x, pp_y, numpoints, numsearches);
* </pre>
* @param image1 the first image
* @param image2 the second image
* @param f the focal length, in pixels
* @param pp_x the x component of the focal length, in pixels, from the left side of the image
* @param pp_y the y component of the focal length, in pixels, from the left side of the image
* @param numpoints how many correspondence probability distributions to use (default 500) -- more is both slower and more accurate
* @param numsearches how many nonlinear searches to use when attempting to maximize egomotion probability (default 100) -- more is both slower and more robust
* @return a MotionParameters structure containing computed 3D motion
*/
MotionParameters compute3Dmotion(OvImageAdapter & image1, OvImageAdapter & image2, float f, float pp_x, float pp_y, int numpoints=500, int numsearches=100);
#endif //__PROBABILISTICEGOMOTION_H
|
/***********************************************************************
Copyright 2006-2009 Ma Bingyao
Copyright 2013 Gao Chunhui, Liu Tao
These sources is free software. Redistributions of source code must
retain the above copyright notice. Redistributions in binary form
must reproduce the above copyright notice. You can redistribute it
freely. You can use it with any free or commercial software.
These sources 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.
github: https://github.com/liut/pecl-xxtea
*************************************************************************/
#include "./xxtea.h"
#include <memory.h>
#include <stdlib.h>
static void xxtea_long_encrypt(xxtea_long *v, xxtea_long len, xxtea_long *k)
{
xxtea_long n = len - 1;
xxtea_long z = v[n], y = v[0], p, q = 6 + 52 / (n + 1), sum = 0, e;
if (n < 1) {
return;
}
while (0 < q--) {
sum += XXTEA_DELTA;
e = sum >> 2 & 3;
for (p = 0; p < n; p++) {
y = v[p + 1];
z = v[p] += XXTEA_MX;
}
y = v[0];
z = v[n] += XXTEA_MX;
}
}
static void xxtea_long_decrypt(xxtea_long *v, xxtea_long len, xxtea_long *k)
{
xxtea_long n = len - 1;
xxtea_long z = v[n], y = v[0], p, q = 6 + 52 / (n + 1), sum = q * XXTEA_DELTA, e;
if (n < 1) {
return;
}
while (sum != 0) {
e = sum >> 2 & 3;
for (p = n; p > 0; p--) {
z = v[p - 1];
y = v[p] -= XXTEA_MX;
}
z = v[n];
y = v[0] -= XXTEA_MX;
sum -= XXTEA_DELTA;
}
}
static unsigned char *fix_key_length(unsigned char *key, xxtea_long key_len)
{
unsigned char *tmp = (unsigned char *)malloc(16);
memcpy(tmp, key, key_len);
memset(tmp + key_len, '\0', 16 - key_len);
return tmp;
}
static xxtea_long *xxtea_to_long_array(unsigned char *data, xxtea_long len, int include_length, xxtea_long *ret_len) {
xxtea_long i, n, *result;
n = len >> 2;
n = (((len & 3) == 0) ? n : n + 1);
if (include_length) {
result = (xxtea_long *)malloc((n + 1) << 2);
result[n] = len;
*ret_len = n + 1;
} else {
result = (xxtea_long *)malloc(n << 2);
*ret_len = n;
}
memset(result, 0, n << 2);
for (i = 0; i < len; i++) {
result[i >> 2] |= (xxtea_long)data[i] << ((i & 3) << 3);
}
return result;
}
static unsigned char *xxtea_to_byte_array(xxtea_long *data, xxtea_long len, int include_length, xxtea_long *ret_len) {
xxtea_long i, n, m;
unsigned char *result;
n = len << 2;
if (include_length) {
m = data[len - 1];
if ((m < n - 7) || (m > n - 4)) return NULL;
n = m;
}
result = (unsigned char *)malloc(n + 1);
for (i = 0; i < n; i++) {
result[i] = (unsigned char)((data[i >> 2] >> ((i & 3) << 3)) & 0xff);
}
result[n] = '\0';
*ret_len = n;
return result;
}
static unsigned char *do_xxtea_encrypt(unsigned char *data, xxtea_long len, unsigned char *key, xxtea_long *ret_len) {
unsigned char *result;
xxtea_long *v, *k, v_len, k_len;
v = xxtea_to_long_array(data, len, 1, &v_len);
k = xxtea_to_long_array(key, 16, 0, &k_len);
xxtea_long_encrypt(v, v_len, k);
result = xxtea_to_byte_array(v, v_len, 0, ret_len);
free(v);
free(k);
return result;
}
static unsigned char *do_xxtea_decrypt(unsigned char *data, xxtea_long len, unsigned char *key, xxtea_long *ret_len) {
unsigned char *result;
xxtea_long *v, *k, v_len, k_len;
v = xxtea_to_long_array(data, len, 0, &v_len);
k = xxtea_to_long_array(key, 16, 0, &k_len);
xxtea_long_decrypt(v, v_len, k);
result = xxtea_to_byte_array(v, v_len, 1, ret_len);
free(v);
free(k);
return result;
}
unsigned char *xxtea_encrypt(unsigned char *data, xxtea_long data_len, unsigned char *key, xxtea_long key_len, xxtea_long *ret_length)
{
unsigned char *result;
*ret_length = 0;
if (key_len < 16) {
unsigned char *key2 = fix_key_length(key, key_len);
result = do_xxtea_encrypt(data, data_len, key2, ret_length);
free(key2);
}
else
{
result = do_xxtea_encrypt(data, data_len, key, ret_length);
}
return result;
}
unsigned char *xxtea_decrypt(unsigned char *data, xxtea_long data_len, unsigned char *key, xxtea_long key_len, xxtea_long *ret_length)
{
unsigned char *result;
*ret_length = 0;
if (key_len < 16) {
unsigned char *key2 = fix_key_length(key, key_len);
result = do_xxtea_decrypt(data, data_len, key2, ret_length);
free(key2);
}
else
{
result = do_xxtea_decrypt(data, data_len, key, ret_length);
}
return result;
}
/* }}} */
|
/*
* Copyright (c) 2017-2018, Arm Limited and affiliates.
* SPDX-License-Identifier: BSD-3-Clause
*
* 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. Neither the name of the copyright holder 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 HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file thread_bbr_api.h
* \brief Thread backbone border router (BBR) application interface.
*
* This is Thread backbone Border router service.
* When started the module takes care of starting the
* components that enables default border router functionality in Thread mesh network.
*
*/
#ifndef THREAD_BBR_API_H_
#define THREAD_BBR_API_H_
#include "ns_types.h"
/**
* Start backbone border router service.
*
* Enables the mDNS responder with default service name. \<rand\>-ARM-\<Network name\>
* if backbone interface is enabled and allows routing.
* Publishes Default route with DHCP addressing
* Enables ND proxy
*
* \param interface_id Thread network interface id.
* \param backbone_interface_id backbone interface id.
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int thread_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
/**
* Set the bbr timeout values. Default timeout values are used if not called.
*
* If this function is called it will trigger the modification to thread network causing'
* refreshing of registrations.
*
* \param interface_id interface ID of the Thread network.
* \param timeout_a timeout a set. 0 = do not change.
* \param timeout_b timeout_b set. 0 = do not change
* \param delay Jitter delay value. 0 do not change
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t timeout_b, uint32_t delay);
/**
* Set prefix to be used as combining multiple thread networks on backbone.
*
* update prefix value
*
* \param interface_id interface ID of the Thread network.
* \param prefix value must be buffer at the size of 8 bytes
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int thread_bbr_prefix_set(int8_t interface_id, uint8_t *prefix);
/**
* Set the Thread validation interface destination address.
*
* \param interface_id interface ID of the Thread network.
* \param addr_ptr IPv6 address.
* \param port UDP port.
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int thread_bbr_validation_interface_address_set(int8_t interface_id, const uint8_t *addr_ptr, uint16_t port);
/**
* Stop backbone Border router.
*
* \param interface_id interface ID of the Thread network
*
* \return 0 on success
* \return <0 in case of errors
*
*/
void thread_bbr_stop(int8_t interface_id);
#endif /* THREAD_BBR_API_H_ */
|
/* $NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $ */
/*-
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Michael Hitch.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Luke Mewburn of Wasabi Systems.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
#if !defined(__lint)
__RCSID("$NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $");
#endif /* !__lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <assert.h>
#include <err.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "installboot.h"
/* XXX Must be kept in sync with bbstart.s! */
#define CMDLN_LOC 0x10
#define CMDLN_LEN 0x20
#define CHKSUMOFFS 1
u_int32_t chksum(u_int32_t *, int);
static int amiga_setboot(ib_params *);
struct ib_mach ib_mach_amiga =
{ "amiga", amiga_setboot, no_clearboot, no_editboot,
IB_STAGE1START | IB_STAGE2START | IB_COMMAND };
static int
amiga_setboot(ib_params *params)
{
int retval;
ssize_t rv;
char *dline;
int sumlen;
u_int32_t sum2, sum16;
struct stat bootstrapsb;
u_int32_t block[128*16];
retval = 0;
if (fstat(params->s1fd, &bootstrapsb) == -1) {
warn("Examining `%s'", params->stage1);
goto done;
}
if (!S_ISREG(bootstrapsb.st_mode)) {
warnx("`%s' must be a regular file", params->stage1);
goto done;
}
rv = pread(params->s1fd, &block, sizeof(block), 0);
if (rv == -1) {
warn("Reading `%s'", params->stage1);
goto done;
} else if (rv != sizeof(block)) {
warnx("Reading `%s': short read", params->stage1);
goto done;
}
/* XXX the choices should not be hardcoded */
sum2 = chksum(block, 1024/4);
sum16 = chksum(block, 8192/4);
if (sum16 == 0xffffffff) {
sumlen = 8192/4;
} else if (sum2 == 0xffffffff) {
sumlen = 1024/4;
} else {
errx(1, "%s: wrong checksum", params->stage1);
/* NOTREACHED */
}
if (sum2 == sum16) {
warnx("eek - both sums are the same");
}
if (params->flags & IB_COMMAND) {
dline = (char *)&(block[CMDLN_LOC/4]);
/* XXX keep the default default line in sync with bbstart.s */
if (strcmp(dline, "netbsd -ASn2") != 0) {
errx(1, "Old bootblock version? Can't change command line.");
}
(void)strncpy(dline, params->command, CMDLN_LEN-1);
block[1] = 0;
block[1] = 0xffffffff - chksum(block, sumlen);
}
if (params->flags & IB_NOWRITE) {
retval = 1;
goto done;
}
if (params->flags & IB_VERBOSE)
printf("Writing boot block\n");
rv = pwrite(params->fsfd, &block, sizeof(block), 0);
if (rv == -1) {
warn("Writing `%s'", params->filesystem);
goto done;
} else if (rv != sizeof(block)) {
warnx("Writing `%s': short write", params->filesystem);
goto done;
} else {
retval = 1;
}
done:
return (retval);
}
u_int32_t
chksum(block, size)
u_int32_t *block;
int size;
{
u_int32_t sum, lastsum;
int i;
sum = 0;
for (i=0; i<size; i++) {
lastsum = sum;
sum += htobe32(block[i]);
if (sum < lastsum)
++sum;
}
return sum;
}
|
#pragma once
#include "envoy/stats/scope.h"
#include "envoy/stats/stats_macros.h"
#include "source/common/common/thread.h"
namespace Envoy {
namespace Http {
namespace Http1 {
/**
* All stats for the HTTP/1 codec. @see stats_macros.h
*/
#define ALL_HTTP1_CODEC_STATS(COUNTER) \
COUNTER(dropped_headers_with_underscores) \
COUNTER(metadata_not_supported_error) \
COUNTER(requests_rejected_with_underscores_in_headers) \
COUNTER(response_flood)
/**
* Wrapper struct for the HTTP/1 codec stats. @see stats_macros.h
*/
struct CodecStats {
using AtomicPtr = Thread::AtomicPtr<CodecStats, Thread::AtomicPtrAllocMode::DeleteOnDestruct>;
static CodecStats& atomicGet(AtomicPtr& ptr, Stats::Scope& scope) {
return *ptr.get([&scope]() -> CodecStats* {
return new CodecStats{ALL_HTTP1_CODEC_STATS(POOL_COUNTER_PREFIX(scope, "http1."))};
});
}
ALL_HTTP1_CODEC_STATS(GENERATE_COUNTER_STRUCT)
};
} // namespace Http1
} // namespace Http
} // namespace Envoy
|
/*
* Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#ifndef CONVERSIONCLOTHINGASSETPARAMETERS_0P4_0P5H_H
#define CONVERSIONCLOTHINGASSETPARAMETERS_0P4_0P5H_H
#include "ParamConversionTemplate.h"
#include "ClothingAssetParameters_0p4.h"
#include "ClothingAssetParameters_0p5.h"
namespace physx
{
namespace apex
{
namespace legacy
{
typedef ParamConversionTemplate<ClothingAssetParameters_0p4, ClothingAssetParameters_0p5, 4, 5> ConversionClothingAssetParameters_0p4_0p5Parent;
class ConversionClothingAssetParameters_0p4_0p5: ConversionClothingAssetParameters_0p4_0p5Parent
{
public:
static NxParameterized::Conversion* Create(NxParameterized::Traits* t)
{
void* buf = t->alloc(sizeof(ConversionClothingAssetParameters_0p4_0p5));
return buf ? PX_PLACEMENT_NEW(buf, ConversionClothingAssetParameters_0p4_0p5)(t) : 0;
}
protected:
ConversionClothingAssetParameters_0p4_0p5(NxParameterized::Traits* t) : ConversionClothingAssetParameters_0p4_0p5Parent(t) {}
const NxParameterized::PrefVer* getPreferredVersions() const
{
static NxParameterized::PrefVer prefVers[] =
{
//TODO:
// Add your preferred versions for included references here.
// Entry format is
// { (const char*)longName, (PxU32)preferredVersion }
{ 0, 0 } // Terminator (do not remove!)
};
return prefVers;
}
bool convert()
{
//TODO:
// Write custom conversion code here using mNewData and mLegacyData members.
//
// Note that
// - mNewData has already been initialized with default values
// - same-named/same-typed members have already been copied
// from mLegacyData to mNewData
// - included references were moved to mNewData
// (and updated to preferred versions according to getPreferredVersions)
//
// For more info see the versioning wiki.
mNewData->rootBoneIndex = 0;
PxU32 numBones = (PxU32)mLegacyData->bones.arraySizes[0];
PxU32 minDepth = numBones;
for (PxU32 i = 0; i < mNewData->bonesReferenced; i++)
{
PxU32 depth = 0;
PxI32 parent = mLegacyData->bones.buf[i].parentIndex;
while (parent != -1 && depth < numBones)
{
parent = mLegacyData->bones.buf[parent].parentIndex;
depth++;
}
if (depth < minDepth)
{
minDepth = depth;
mNewData->rootBoneIndex = i;
}
}
return true;
}
};
} // namespace legacy
} // namespace apex
} // namespace physx
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.