text stringlengths 4 6.14k |
|---|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// System.IAsyncResult
struct IAsyncResult_t47;
// System.AsyncCallback
struct AsyncCallback_t48;
// System.Object
struct Object_t;
#include "mscorlib_System_MulticastDelegate.h"
#include "System_System_Text_RegularExpressions_Interval.h"
// System.Text.RegularExpressions.IntervalCollection/CostDelegate
struct CostDelegate_t525 : public MulticastDelegate_t46
{
};
|
#ifndef DLG_UPDATE_H
#define DLG_UPDATE_H
#include <QDialogButtonBox>
#include <QProgressDialog>
#include <QtNetwork>
#include "update_downloader.h"
class Release;
class DlgUpdate : public QDialog
{
Q_OBJECT
public:
DlgUpdate(QWidget *parent);
private slots:
void finishedUpdateCheck(bool needToUpdate, bool isCompatible, Release *release);
void gotoDownloadPage();
void downloadUpdate();
void cancelDownload();
void updateCheckError(QString errorString);
void downloadSuccessful(QUrl filepath);
void downloadProgressMade(qint64 bytesRead, qint64 totalBytes);
void downloadError(QString errorString);
void closeDialog();
private:
QUrl updateUrl;
void enableUpdateButton(bool enable);
void enableOkButton(bool enable);
void addStopDownloadAndRemoveOthers(bool enable);
void beginUpdateCheck();
void setLabel(QString text);
QLabel *statusLabel, *descriptionLabel;
QProgressBar *progress;
QPushButton *manualDownload, *gotoDownload, *ok, *stopDownload;
QPushButton *cancel;
UpdateDownloader *uDownloader;
QDialogButtonBox *buttonBox;
};
#endif
|
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package 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 CSTRINGUTIL_H
#define CSTRINGUTIL_H
#include "CString.h"
#include <stdarg.h>
//! String utilities
/*!
This class provides various functions for string manipulation.
*/
class CStringUtil {
public:
//! Format positional arguments
/*!
Format a string using positional arguments. fmt has literal
characters and conversion specifications introduced by `\%':
- \c\%\% -- literal `\%'
- \c\%{n} -- positional element n, n a positive integer, {} are literal
All arguments in the variable list are const char*. Positional
elements are indexed from 1.
*/
static CString format(const char* fmt, ...);
//! Format positional arguments
/*!
Same as format() except takes va_list.
*/
static CString vformat(const char* fmt, va_list);
//! Print a string using printf-style formatting
/*!
Equivalent to printf() except the result is returned as a CString.
*/
static CString print(const char* fmt, ...);
//! Case-insensitive comparisons
/*!
This class provides case-insensitve comparison functions.
*/
class CaselessCmp {
public:
//! Same as less()
bool operator()(const CString& a, const CString& b) const;
//! Returns true iff \c a is lexicographically less than \c b
static bool less(const CString& a, const CString& b);
//! Returns true iff \c a is lexicographically equal to \c b
static bool equal(const CString& a, const CString& b);
//! Returns true iff \c a is lexicographically less than \c b
static bool cmpLess(const CString::value_type& a,
const CString::value_type& b);
//! Returns true iff \c a is lexicographically equal to \c b
static bool cmpEqual(const CString::value_type& a,
const CString::value_type& b);
};
};
#endif
|
/*
* Copyright (c) 2005, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
* This sample test aims to check the following assertions:
*
* If SA_NODEFER is not set in sa_flags, the caught signal is added to the
* thread's signal mask during the handler execution.
* The steps are:
* -> register a signal handler for SIGUSR2
* -> raise SIGUSR2
* -> In handler, check for reentrance then raise SIGUSR2 again.
* The test fails if signal handler if reentered or signal is not pending when raised again.
*/
/******************************************************************************/
/*************************** standard includes ********************************/
/******************************************************************************/
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
/******************************************************************************/
/*************************** Test framework *******************************/
/******************************************************************************/
#include "../testfrmw/testfrmw.h"
#include "../testfrmw/testfrmw.c"
/* This header is responsible for defining the following macros:
* UNRESOLVED(ret, descr);
* where descr is a description of the error and ret is an int
* (error code for example)
* FAILED(descr);
* where descr is a short text saying why the test has failed.
* PASSED();
* No parameter.
*
* Both three macros shall terminate the calling process.
* The testcase shall not terminate in any other maneer.
*
* The other file defines the functions
* void output_init()
* void output(char * string, ...)
*
* Those may be used to output information.
*/
/******************************************************************************/
/**************************** Configuration ***********************************/
/******************************************************************************/
#ifndef VERBOSE
#define VERBOSE 1
#endif
#define SIGNAL SIGUSR2
/******************************************************************************/
/*************************** Test case ***********************************/
/******************************************************************************/
int called = 0;
void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
called++;
if (called == 2) {
FAILED("Signal was not masked in signal handler");
}
if (called == 1) {
/* Raise the signal again. It should be masked */
ret = raise(SIGNAL);
if (ret != 0) {
UNRESOLVED(ret, "Failed to raise SIGUSR2 again");
}
/* check the signal is pending */
ret = sigpending(&pending);
if (ret != 0) {
UNRESOLVED(ret, "Failed to get pending signal set");
}
ret = sigismember(&pending, SIGNAL);
if (ret != 1) {
FAILED("signal is not pending");
}
}
called++;
}
/* main function */
int main(void)
{
int ret;
struct sigaction sa;
/* Initialize output */
output_init();
/* Set the signal handler */
sa.sa_flags = 0;
sa.sa_handler = handler;
ret = sigemptyset(&sa.sa_mask);
if (ret != 0) {
UNRESOLVED(ret, "Failed to empty signal set");
}
/* Install the signal handler for SIGUSR2 */
ret = sigaction(SIGNAL, &sa, 0);
if (ret != 0) {
UNRESOLVED(ret, "Failed to set signal handler");
}
ret = raise(SIGNAL);
if (ret != 0) {
UNRESOLVED(ret, "Failed to raise SIGUSR2");
}
while (called != 4)
sched_yield();
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
#endif
PASSED;
}
|
/**
******************************************************************************
* @file crc_hw.h
* @author Nightmare
* @version V1.0.0
* @date 2014.5.6
* @brief Project config file.
******************************************************************************
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CRC_HW_H
#define __CRC_HW_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
extern const uint32_t CRC_POLY_32BIT;
extern const uint32_t CRC_POLY_16BIT;
extern const uint32_t CRC_POLY_8BIT;
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void CRC_Config_32Bit(uint32_t init);
uint32_t CRC_Calc_32Bits(uint32_t* data, uint32_t size);
void CRC_Config(uint32_t width, uint32_t poly); //Only support in STM32F07x & STM32F04x
uint16_t CRC_Calc_16Bits(uint16_t* data, uint32_t size); //Only support in STM32F07x & STM32F04x
uint8_t CRC_Calc_8Bits(uint8_t* data, uint32_t size); //Only support in STM32F07x & STM32F04x
#endif /* __MAIN_H */
/************************ END OF FILE****/
|
/*
* The Qubes OS Project, http://www.qubes-os.org
*
* Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.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.
*
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvchan.h>
#include <sys/select.h>
#include <errno.h>
#include "double-buffer.h"
#include <assert.h>
void (*vchan_at_eof)(void) = NULL;
int vchan_is_closed = 0;
/* double buffered in gui-daemon to deal with deadlock
* during send large clipboard content
*/
int double_buffered = 1;
int wait_for_vchan_or_argfd_once(libvchan_t *vchan, int nfd, int *fd, fd_set * retset);
void vchan_register_at_eof(void (*new_vchan_at_eof)(void)) {
vchan_at_eof = new_vchan_at_eof;
}
void handle_vchan_error(libvchan_t *vchan, const char *op)
{
if (!libvchan_is_open(vchan)) {
fprintf(stderr, "EOF\n");
exit(0);
} else {
fprintf(stderr, "Error while vchan %s\n, terminating", op);
exit(1);
}
}
int write_data_exact(libvchan_t *vchan, char *buf, int size)
{
int written = 0;
int ret;
while (written < size) {
ret = libvchan_write(vchan, buf + written, size - written);
if (ret <= 0)
handle_vchan_error(vchan, "write data");
written += ret;
}
// fprintf(stderr, "sent %d bytes\n", size);
return size;
}
int write_data(libvchan_t *vchan, char *buf, int size)
{
int count;
if (!double_buffered)
return write_data_exact(vchan, buf, size); // this may block
double_buffer_append(buf, size);
count = libvchan_buffer_space(vchan);
if (count > double_buffer_datacount())
count = double_buffer_datacount();
// below, we write only as much data as possible without
// blocking; remainder of data stays in the double buffer
write_data_exact(vchan, double_buffer_data(), count);
double_buffer_substract(count);
return size;
}
int real_write_message(libvchan_t *vchan, char *hdr, int size, char *data, int datasize)
{
write_data(vchan, hdr, size);
write_data(vchan, data, datasize);
return 0;
}
int read_data(libvchan_t *vchan, char *buf, int size)
{
int written = 0;
int ret;
while (written < size) {
while (!libvchan_data_ready(vchan))
wait_for_vchan_or_argfd_once(vchan, 0, NULL, NULL);
ret = libvchan_read(vchan, buf + written, size - written);
if (ret <= 0)
handle_vchan_error(vchan, "read data");
written += ret;
}
// fprintf(stderr, "read %d bytes\n", size);
return size;
}
int wait_for_vchan_or_argfd_once(libvchan_t *vchan, int nfd, int *fd, fd_set * retset)
{
fd_set rfds;
int vfd, max = 0, ret, i;
struct timeval tv = { 0, 1000000 };
write_data(vchan, NULL, 0); // trigger write of queued data, if any present
vfd = libvchan_fd_for_select(vchan);
FD_ZERO(&rfds);
for (i = 0; i < nfd; i++) {
int cfd = fd[i];
assert(cfd >= 0 && cfd < FD_SETSIZE && "bad external file descriptor number");
FD_SET(cfd, &rfds);
if (cfd > max)
max = cfd;
}
assert(vfd >= 0 && vfd < FD_SETSIZE && "bad vchan file descriptor number");
FD_SET(vfd, &rfds);
if (vfd > max)
max = vfd;
max++;
ret = select(max, &rfds, NULL, NULL, &tv);
if (ret < 0 && errno == EINTR)
return -1;
if (ret < 0) {
perror("select");
exit(1);
}
if (!libvchan_is_open(vchan)) {
fprintf(stderr, "libvchan_is_eof\n");
libvchan_close(vchan);
if (vchan_at_eof != NULL) {
vchan_at_eof();
return -1;
} else
exit(0);
}
if (FD_ISSET(vfd, &rfds))
// the following will never block; we need to do this to
// clear libvchan_fd pending state
libvchan_wait(vchan);
if (retset)
*retset = rfds;
return ret;
}
int wait_for_vchan_or_argfd(libvchan_t *vchan, int nfd, int *fd, fd_set * retset)
{
int ret;
while ((ret=wait_for_vchan_or_argfd_once(vchan, nfd, fd, retset)) == 0);
return ret;
}
|
/*
* The ManaPlus Client
* Copyright (C) 2008 Aethyra Development Team
* Copyright (C) 2011-2015 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
* 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
* 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 RESOURCES_DB_CHARDB_H
#define RESOURCES_DB_CHARDB_H
#include "utils/xml.h"
#include <vector>
/**
* Char information database.
*/
namespace CharDB
{
/**
* Loads the chars data.
*/
void load();
/**
* Clear the chars data
*/
void unload();
void loadMinMax(const XmlNodePtr node,
unsigned *restrict const min,
unsigned *restrict const max);
unsigned getMinHairColor() A_WARN_UNUSED;
unsigned getMaxHairColor() A_WARN_UNUSED;
unsigned getMinHairStyle() A_WARN_UNUSED;
unsigned getMaxHairStyle() A_WARN_UNUSED;
unsigned getMinStat() A_WARN_UNUSED;
unsigned getMaxStat() A_WARN_UNUSED;
unsigned getSumStat() A_WARN_UNUSED;
unsigned getMinLook() A_WARN_UNUSED;
unsigned getMaxLook() A_WARN_UNUSED;
unsigned getMinRace() A_WARN_UNUSED;
unsigned getMaxRace() A_WARN_UNUSED;
const std::vector<int> &getDefaultItems() A_WARN_UNUSED;
} // namespace CharDB
#endif // RESOURCES_DB_CHARDB_H
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/nodes/composite/nodes/node_composite_composite.c
* \ingroup cmpnodes
*/
#include "node_composite_util.h"
/* **************** COMPOSITE ******************** */
static bNodeSocketTemplate cmp_node_composite_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
void register_node_type_cmp_composite(void)
{
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
/* Do not allow muting for this node. */
node_type_internal_links(&ntype, NULL);
nodeRegisterType(&ntype);
}
|
/*
* Copyright (c) 2005, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
* Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This sample test aims to check the following assertions:
*
* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported,
* sa_sigaction is used as the signal handling function.
*
* The steps are:
* -> test for RTS extension
* -> register a handler for SIGURG with SA_SIGINFO, and a known function
* as sa_sigaction
* -> raise SIGURG, and check the function has been called.
*
* The test fails if the function is not called
*/
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include "posixtest.h"
static volatile sig_atomic_t called = 0;
static void handler(int sig, siginfo_t *info, void *context)
{
(void) sig;
(void) context;
if (info->si_signo != SIGURG) {
PTS_WRITE_MSG("Wrong signal generated?\n");
_exit(PTS_FAIL);
}
called = 1;
}
int main(void)
{
int ret;
long rts;
struct sigaction sa;
/* Test the RTS extension */
rts = sysconf(_SC_REALTIME_SIGNALS);
if (rts < 0L) {
fprintf(stderr, "This test needs the RTS extension");
return PTS_UNTESTED;
}
/* Set the signal handler */
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = handler;
ret = sigemptyset(&sa.sa_mask);
if (ret != 0) {
perror("Failed to empty signal set");
return PTS_UNRESOLVED;
}
/* Install the signal handler for SIGURG */
ret = sigaction(SIGURG, &sa, 0);
if (ret != 0) {
perror("Failed to set signal handler");
return PTS_UNTESTED;
}
if (called) {
fprintf(stderr,
"The signal handler has been called before signal was raised");
return PTS_FAIL;
}
ret = raise(SIGURG);
if (ret != 0) {
perror("Failed to raise SIGURG");
return PTS_UNRESOLVED;
}
if (!called) {
fprintf(stderr, "The sa_handler was not called");
return PTS_FAIL;
}
printf("Test PASSED\n");
return PTS_PASS;
}
|
/******************************************************************************/
/* Mednafen Sega Saturn Emulation Module */
/******************************************************************************/
/* rom.h - ROM cart emulation
** Copyright (C) 2016-2017 Mednafen Team
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License
** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __MDFN_SS_CART_ROM_H
#define __MDFN_SS_CART_ROM_H
namespace MDFN_IEN_SS
{
void CART_ROM_Init(CartInfo* c, Stream* str) MDFN_COLD;
}
#endif
|
/*
* Definitions for memory preallocations
*
* Copyright (C) 2005-2009 Scientific-Atlanta, 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
#define _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
#define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */
#define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
/* "struct resource" array element definition */
#define PREALLOC(NAME, START, END, FLAGS) { \
.name = (NAME), \
.start = (START), \
.end = (END), \
.flags = (FLAGS) \
},
/* Individual resources in the preallocated resource arrays are defined using
* macros. These macros are conditionally defined based on their
* corresponding kernel configuration flag:
* - CONFIG_PREALLOC_NORMAL: preallocate resources for a normal settop box
* - CONFIG_PREALLOC_TFTP: preallocate the TFTP download resource
* - CONFIG_PREALLOC_DOCSIS: preallocate the DOCSIS resource
* - CONFIG_PREALLOC_PMEM: reserve space for persistent memory
*/
#ifdef CONFIG_PREALLOC_NORMAL
#define PREALLOC_NORMAL(name, start, end, flags) \
PREALLOC(name, start, end, flags)
#else
#define PREALLOC_NORMAL(name, start, end, flags)
#endif
#ifdef CONFIG_PREALLOC_TFTP
#define PREALLOC_TFTP(name, start, end, flags) \
PREALLOC(name, start, end, flags)
#else
#define PREALLOC_TFTP(name, start, end, flags)
#endif
#ifdef CONFIG_PREALLOC_DOCSIS
#define PREALLOC_DOCSIS(name, start, end, flags) \
PREALLOC(name, start, end, flags)
#else
#define PREALLOC_DOCSIS(name, start, end, flags)
#endif
#ifdef CONFIG_PREALLOC_PMEM
#define PREALLOC_PMEM(name, start, end, flags) \
PREALLOC(name, start, end, flags)
#else
#define PREALLOC_PMEM(name, start, end, flags)
#endif
#endif
|
#ifndef _LINUX_VIRTIO_RING_H
#define _LINUX_VIRTIO_RING_H
#include <linux/irqreturn.h>
#include <uapi/linux/virtio_ring.h>
/*
* Barriers in virtio are tricky. Non-SMP virtio guests can't assume
* they're not on an SMP host system, so they need to assume real
* barriers. Non-SMP virtio hosts could skip the barriers, but does
* anyone care?
*
* For virtio_pci on SMP, we don't need to order with respect to MMIO
* accesses through relaxed memory I/O windows, so smp_mb() et al are
* sufficient.
*
* For using virtio to talk to real devices (eg. other heterogeneous
* CPUs) we do need real barriers. In theory, we could be using both
* kinds of virtio, so it's a runtime decision, and the branch is
* actually quite cheap.
*/
#ifdef CONFIG_SMP
static inline void virtio_mb(bool weak_barriers)
{
if (weak_barriers)
smp_mb();
else
mb();
}
static inline void virtio_rmb(bool weak_barriers)
{
if (weak_barriers)
smp_rmb();
else
rmb();
}
static inline void virtio_wmb(bool weak_barriers)
{
if (weak_barriers)
smp_wmb();
else
wmb();
}
#else
static inline void virtio_mb(bool weak_barriers)
{
mb();
}
static inline void virtio_rmb(bool weak_barriers)
{
rmb();
}
static inline void virtio_wmb(bool weak_barriers)
{
wmb();
}
#endif
struct virtio_device;
struct virtqueue;
struct virtqueue *vring_new_virtqueue(unsigned int index,
unsigned int num,
unsigned int vring_align,
struct virtio_device *vdev,
bool weak_barriers,
void *pages,
bool (*notify)(struct virtqueue *vq),
void (*callback)(struct virtqueue *vq),
const char *name);
void vring_del_virtqueue(struct virtqueue *vq);
/* Filter out transport-specific feature bits. */
void vring_transport_features(struct virtio_device *vdev);
irqreturn_t vring_interrupt(int irq, void *_vq);
#endif /* _LINUX_VIRTIO_RING_H */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2012 Advanced Micro Devices, 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <arch/io.h>
#include <console/console.h>
#include <spi_flash.h>
#include <spi-generic.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <Proc/Fch/FchPlatform.h>
#define SPI_REG_OPCODE 0x0
#define SPI_REG_CNTRL01 0x1
#define SPI_REG_CNTRL02 0x2
#define CNTRL02_FIFO_RESET (1 << 4)
#define CNTRL02_EXEC_OPCODE (1 << 0)
#define SPI_REG_CNTRL03 0x3
#define CNTRL03_SPIBUSY (1 << 7)
#define SPI_REG_FIFO 0xc
#define SPI_REG_CNTRL11 0xd
#define CNTRL11_FIFOPTR_MASK 0x07
#if IS_ENABLED(CONFIG_SOUTHBRIDGE_AMD_AGESA_YANGTZE)
#define AMD_SB_SPI_TX_LEN 64
#else
#define AMD_SB_SPI_TX_LEN 8
#endif
static uintptr_t spibar;
static inline uint8_t spi_read(uint8_t reg)
{
return read8((void *)(spibar + reg));
}
static inline void spi_write(uint8_t reg, uint8_t val)
{
write8((void *)(spibar + reg), val);
}
static void reset_internal_fifo_pointer(void)
{
uint8_t reg8;
do {
reg8 = spi_read(SPI_REG_CNTRL02);
reg8 |= CNTRL02_FIFO_RESET;
spi_write(SPI_REG_CNTRL02, reg8);
} while (spi_read(SPI_REG_CNTRL11) & CNTRL11_FIFOPTR_MASK);
}
static void execute_command(void)
{
uint8_t reg8;
reg8 = spi_read(SPI_REG_CNTRL02);
reg8 |= CNTRL02_EXEC_OPCODE;
spi_write(SPI_REG_CNTRL02, reg8);
while ((spi_read(SPI_REG_CNTRL02) & CNTRL02_EXEC_OPCODE) &&
(spi_read(SPI_REG_CNTRL03) & CNTRL03_SPIBUSY));
}
void spi_init(void)
{
device_t dev;
dev = dev_find_slot(0, PCI_DEVFN(0x14, 3));
spibar = pci_read_config32(dev, 0xA0) & ~0x1F;
}
unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
{
return min(AMD_SB_SPI_TX_LEN - cmd_len, buf_len);
}
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytesout, void *din, size_t bytesin)
{
/* First byte is cmd which can not being sent through FIFO. */
u8 cmd = *(u8 *)dout++;
u8 readoffby1;
size_t count;
bytesout--;
/*
* Check if this is a write command attempting to transfer more bytes
* than the controller can handle. Iterations for writes are not
* supported here because each SPI write command needs to be preceded
* and followed by other SPI commands, and this sequence is controlled
* by the SPI chip driver.
*/
if (bytesout > AMD_SB_SPI_TX_LEN) {
printk(BIOS_DEBUG, "FCH SPI: Too much to write. Does your SPI chip driver use"
" spi_crop_chunk()?\n");
return -1;
}
readoffby1 = bytesout ? 0 : 1;
#if CONFIG_SOUTHBRIDGE_AMD_AGESA_YANGTZE
spi_write(0x1E, 5);
spi_write(0x1F, bytesout); /* SpiExtRegIndx [5] - TxByteCount */
spi_write(0x1E, 6);
spi_write(0x1F, bytesin); /* SpiExtRegIndx [6] - RxByteCount */
#else
u8 readwrite = (bytesin + readoffby1) << 4 | bytesout;
spi_write(SPI_REG_CNTRL01, readwrite);
#endif
spi_write(SPI_REG_OPCODE, cmd);
reset_internal_fifo_pointer();
for (count = 0; count < bytesout; count++, dout++) {
spi_write(SPI_REG_FIFO, *(uint8_t *)dout);
}
reset_internal_fifo_pointer();
execute_command();
reset_internal_fifo_pointer();
/* Skip the bytes we sent. */
for (count = 0; count < bytesout; count++) {
cmd = spi_read(SPI_REG_FIFO);
}
for (count = 0; count < bytesin; count++, din++) {
*(uint8_t *)din = spi_read(SPI_REG_FIFO);
}
return 0;
}
int chipset_volatile_group_begin(const struct spi_flash *flash)
{
if (!IS_ENABLED (CONFIG_HUDSON_IMC_FWM))
return 0;
ImcSleep(NULL);
return 0;
}
int chipset_volatile_group_end(const struct spi_flash *flash)
{
if (!IS_ENABLED (CONFIG_HUDSON_IMC_FWM))
return 0;
ImcWakeup(NULL);
return 0;
}
static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
{
slave->bus = bus;
slave->cs = cs;
slave->ctrlr = &spi_ctrlr;
return 0;
}
|
/***************************************************************************
* Copyright (C) 2004 by Alexander Dymo <adymo@kdevelop.org> *
* *
* This 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 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 Library 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 PROFILE_H
#define PROFILE_H
#include <kurl.h>
#include <qstringlist.h>
/**
@short KDevelop profile
A class which represents a profile for KDevelop platform stored on disk.
*/
class Profile {
public:
/**An entry in the lists that store profile information*/
struct Entry {
Entry() {}
Entry(const QString &_name, bool _derived): name(_name), derived(_derived) {}
QString name;
bool derived;
};
typedef QValueList<Entry> EntryList;
/**Lists which are held by a profile.*/
enum List {
Properties /**<X-KDevelop-Properties defined for this profile.*/,
ExplicitEnable /**<A list of explicitly enabled plugins (names).*/,
ExplicitDisable /**<A list of explicitly disabled plugins (names).*/
};
Profile(Profile *parent, const QString &name);
Profile(Profile *parent, const QString &name, const QString &genericName, const QString &description);
~Profile();
QValueList<Profile*> children() const { return m_children; }
Profile *parent() const { return m_parent; }
void save();
bool remove();
QString name() const { return m_name; }
QString genericName() const { return m_genericName; }
QString description() const { return m_description; }
EntryList list(List type);
void addEntry(List type, const QString &value);
void removeEntry(List type, const QString &value);
void clearList(List type);
bool hasInEntryList(EntryList &list, QString value);
KURL::List resources(const QString &nameFilter);
void addResource(const KURL &url);
void detachFromParent();
protected:
void addChildProfile(Profile *profile);
void removeChildProfile(Profile *profile);
QString dirName() const;
QStringList &listByType(List type);
private:
Profile *m_parent;
QValueList<Profile*> m_children;
QString m_name;
QString m_genericName;
QString m_description;
QStringList m_properties;
QStringList m_explicitEnable;
QStringList m_explicitDisable;
};
#endif
|
/*
* dsp_mec2.c: mISDN dsp pipeline element for the mec2 echo canceller
*
* Copyright (C) 2007, Nadi Sarrar
*
* Nadi Sarrar <nadi@beronet.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., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
*/
#include <linux/mISDNif.h>
#include <linux/mISDNdsp.h>
#include <linux/module.h>
#include "core.h"
#include "dsp.h"
#include "dsp_mec2.h"
#include "dsp_cancel.h"
static void *new(const char *arg)
{
int deftaps = 128,
training = 0,
len;
if (!arg)
goto _out;
len = strlen(arg);
if (!len)
goto _out;
{
char _dup[len + 1];
char *dup, *tok, *name, *val;
int tmp;
strcpy(_dup, arg);
dup = _dup;
while ((tok = strsep(&dup, ","))) {
if (!strlen(tok))
continue;
name = strsep(&tok, "=");
val = tok;
if (!val)
continue;
if (!strcmp(name, "deftaps")) {
if (sscanf(val, "%d", &tmp) == 1)
deftaps = tmp;
} else if (!strcmp(name, "training")) {
if (sscanf(val, "%d", &tmp) == 1)
training = tmp;
}
}
}
_out:
printk(KERN_DEBUG "%s: creating %s with deftaps=%d and training=%d\n",
__func__, EC_TYPE, deftaps, training);
return dsp_cancel_new(deftaps, training);
}
static void free(void *p)
{
dsp_cancel_free(p);
}
static void process_tx(void *p, u8 *data, int len)
{
dsp_cancel_tx(p, data, len);
}
static void process_rx(void *p, u8 *data, int len, unsigned int txlen)
{
dsp_cancel_rx(p, data, len, txlen);
}
static struct mISDN_dsp_element_arg args[] = {
{ "deftaps", "128", "Set the number of taps of cancellation." },
{ "training", "0", "Enable echotraining (0: disabled, 1: enabled)." },
};
static struct mISDN_dsp_element dsp_mec2 = {
.name = "mec2",
.new = new,
.free = free,
.process_tx = process_tx,
.process_rx = process_rx,
.num_args = sizeof(args) / sizeof(struct mISDN_dsp_element_arg),
.args = args,
};
#ifdef MODULE
static int __init dsp_mec2_init(void)
{
mISDN_dsp_element_register(&dsp_mec2);
return 0;
}
static void __exit dsp_mec2_exit(void)
{
mISDN_dsp_element_unregister(&dsp_mec2);
}
module_init(dsp_mec2_init);
module_exit(dsp_mec2_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Nadi Sarrar <nadi@beronet.com>");
#endif
|
/*
* This source code is part of
*
* E R K A L E
* -
* DFT from Hel
*
* Written by Susi Lehtola, 2010-2011
* Copyright (c) 2010-2011, Susi Lehtola
*
* 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 file contains the necessary stuff needed to evaluate the TDLDA
* integrals in Casida formalism.
*/
#ifndef ERKALE_CASIDAGRID
#define ERKALE_CASIDAGRID
#include "casida.h"
#include "../dftgrid.h"
/// Perform integral over atomic grid
class CasidaShell : public AngularGrid {
/// Stack of values of orbitals at grid points: orbs[nspin][ngrid][norb]
std::vector< std::vector< std::vector<double> > > orbs;
/// Values of the exchange part of \f$ \frac {\delta^2 E_{xc} [\rho_\uparrow,\rho_\downarrow]} {\delta \rho_\sigma ({\bf r}) \delta \rho_\tau ({\bf r})} \f$
std::vector<double> fx;
/// Values of the correlation part
std::vector<double> fc;
public:
/// Constructor. Need to set tolerance as well before using constructor!
CasidaShell(bool lobatto=false);
/// Destructor
~CasidaShell();
/// Evaluate values of orbitals at grid points
void compute_orbs(const std::vector<arma::mat> & C);
/// Evaluate fx and fc
void eval_fxc(int x_func, int c_func);
/// Evaluate Kxc
void Kxc(const std::vector< std::vector<states_pair_t> > & pairs, arma::mat & K) const;
void free();
};
/// Perform integral over molecular grid
class CasidaGrid {
/// Work grids
std::vector<CasidaShell> wrk;
/// Angular grids
std::vector<angshell_t> grids;
/// Basis set
const BasisSet * basp;
/// Verbose operation?
bool verbose;
/// Use Lobatto quadrature?
bool use_lobatto;
/// Construct grid
void construct(const std::vector<arma::mat> & P, double tol, int x_func, int c_func);
/// Prune shells without points
void prune_shells();
public:
CasidaGrid(const BasisSet * bas, bool verbose=false, bool lobatto=false);
~CasidaGrid();
/// Evaluate Kxc
void Kxc(const std::vector<arma::mat> & P, double tol, int x_func, int c_func, const std::vector<arma::mat> & C, const std::vector < std::vector<states_pair_t> > & pairs, arma::mat & Kx);
/// Print out grid composition
void print_grid() const;
};
#endif
|
#ifndef HCENSOR_H
#define HCENSOR_H
#include "../lib/sstring.h"
/* forward declarations */
struct hchannel_struct;
struct huser_struct;
typedef enum
{
HCENSOR_WARN,
HCENSOR_KICK,
HCENSOR_CHANBAN,
HCENSOR_BAN
} hcensor_type;
typedef struct hcensor_struct
{
sstring *pattern;
sstring *reason; /* optional */
hcensor_type type;
struct hcensor_struct *next;
} hcensor;
hcensor *hcensor_get_by_pattern(hcensor *, const char *);
hcensor *hcensor_get_by_index(hcensor *, int);
hcensor *hcensor_check(hcensor *, const char *); /* first matching pattern is returned, NULL if ok */
hcensor *hcensor_add(hcensor **, const char*, const char*, hcensor_type);
hcensor *hcensor_del(hcensor **, hcensor *);
/* Handle a censor match, if returnvalue is non-zero then the user was removed from channel */
int hcensor_match(struct hchannel_struct*, struct huser_struct*, hcensor*);
const char *hcensor_get_typename(hcensor_type);
int hcensor_count(hcensor *);
void hcensor_del_all(hcensor **);
#endif
|
/* Copyright (c) 2012 Google 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.
*/
//
// GTLYouTubePlaylist.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// YouTube Data API (youtube/v3)
// Description:
// Programmatic access to YouTube features.
// Documentation:
// https://developers.google.com/youtube/v3
// Classes:
// GTLYouTubePlaylist (0 custom class methods, 7 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLYouTubePlaylistContentDetails;
@class GTLYouTubePlaylistPlayer;
@class GTLYouTubePlaylistSnippet;
@class GTLYouTubePlaylistStatus;
// ----------------------------------------------------------------------------
//
// GTLYouTubePlaylist
//
// A playlist resource represents a YouTube playlist. A playlist is a collection
// of videos that can be viewed sequentially and shared with other users. A
// playlist can contain up to 200 videos, and YouTube does not limit the number
// of playlists that each user creates. By default, playlists are publicly
// visible to other users, but playlists can be public or private.
// YouTube also uses playlists to identify special collections of videos for a
// channel, such as:
// - uploaded videos
// - favorite videos
// - positively rated (liked) videos
// - watch history
// - watch later To be more specific, these lists are associated with a channel,
// which is a collection of a person, group, or company's videos, playlists, and
// other YouTube information. You can retrieve the playlist IDs for each of
// these lists from the channel resource for a given channel.
// You can then use the playlistItems.list method to retrieve any of those
// lists. You can also add or remove items from those lists by calling the
// playlistItems.insert and playlistItems.delete methods.
@interface GTLYouTubePlaylist : GTLObject
// The contentDetails object contains information like video count.
@property (retain) GTLYouTubePlaylistContentDetails *contentDetails;
// The ETag for the playlist resource.
@property (copy) NSString *ETag;
// The ID that YouTube uses to uniquely identify the playlist.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The type of the API resource. For video resources, the value will be
// youtube#playlist.
@property (copy) NSString *kind;
// The player object contains information that you would use to play the
// playlist in an embedded player.
@property (retain) GTLYouTubePlaylistPlayer *player;
// The snippet object contains basic details about the playlist, such as its
// title and description.
@property (retain) GTLYouTubePlaylistSnippet *snippet;
// The status object contains status information for the playlist.
@property (retain) GTLYouTubePlaylistStatus *status;
@end
|
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-rtl-expand-details" } */
/* { dg-skip-if "PR64886" { hppa*-*-hpux* } { "*" } { "" } } */
#define N 256
int a1[N], a2[N], a3[N], a4[N];
void foo ()
{
int i;
for (i=0; i<N; i++) {
int c;
c = a3[i] + (a1[i] * a2[i]);
a4[i] = c + 1;
a1[i] = a2[i] - 1;
}
}
/* { dg-final { scan-rtl-dump-times "Swap operands" 1 "expand" } } */
/* { dg-final { cleanup-rtl-dump "expand" } } */
|
/*
* drivers/video/tegra/host/chip_support.h
*
* Tegra Graphics Host Chip Support
*
* Copyright (c) 2011, NVIDIA Corporation.
*
* 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 _NVHOST_CHIP_SUPPORT_H_
#define _NVHOST_CHIP_SUPPORT_H_
#include <linux/types.h>
struct output;
struct nvhost_waitchk;
struct nvhost_userctx_timeout;
struct nvhost_master;
struct nvhost_channel;
struct nvmap_handle;
struct nvmap_client;
struct nvhost_hwctx;
struct nvhost_cdma;
struct nvhost_intr;
struct push_buffer;
struct nvhost_syncpt;
struct nvhost_cpuaccess;
struct nvhost_master;
struct dentry;
struct nvhost_job;
struct nvhost_chip_support {
struct {
int (*init)(struct nvhost_channel *,
struct nvhost_master *,
int chid);
int (*submit)(struct nvhost_job *job);
int (*read3dreg)(struct nvhost_channel *channel,
struct nvhost_hwctx *hwctx,
u32 offset,
u32 *value);
} channel;
struct {
void (*start)(struct nvhost_cdma *);
void (*stop)(struct nvhost_cdma *);
void (*kick)(struct nvhost_cdma *);
int (*timeout_init)(struct nvhost_cdma *,
u32 syncpt_id);
void (*timeout_destroy)(struct nvhost_cdma *);
void (*timeout_teardown_begin)(struct nvhost_cdma *);
void (*timeout_teardown_end)(struct nvhost_cdma *,
u32 getptr);
void (*timeout_cpu_incr)(struct nvhost_cdma *,
u32 getptr,
u32 syncpt_incrs,
u32 syncval,
u32 nr_slots);
void (*timeout_pb_incr)(struct nvhost_cdma *,
u32 getptr,
u32 syncpt_incrs,
u32 nr_slots,
bool exec_ctxsave);
} cdma;
struct {
void (*reset)(struct push_buffer *);
int (*init)(struct push_buffer *);
void (*destroy)(struct push_buffer *);
void (*push_to)(struct push_buffer *,
struct nvmap_client *,
struct nvmap_handle *,
u32 op1, u32 op2);
void (*pop_from)(struct push_buffer *,
unsigned int slots);
u32 (*space)(struct push_buffer *);
u32 (*putptr)(struct push_buffer *);
} push_buffer;
struct {
void (*debug_init)(struct dentry *de);
void (*show_channel_cdma)(struct nvhost_master *,
struct output *,
int chid);
void (*show_channel_fifo)(struct nvhost_master *,
struct output *,
int chid);
void (*show_mlocks)(struct nvhost_master *m,
struct output *o);
} debug;
struct {
void (*reset)(struct nvhost_syncpt *, u32 id);
void (*reset_wait_base)(struct nvhost_syncpt *, u32 id);
void (*read_wait_base)(struct nvhost_syncpt *, u32 id);
u32 (*update_min)(struct nvhost_syncpt *, u32 id);
void (*cpu_incr)(struct nvhost_syncpt *, u32 id);
int (*wait_check)(struct nvhost_syncpt *sp,
struct nvmap_client *nvmap,
u32 waitchk_mask,
struct nvhost_waitchk *wait,
int num_waitchk);
void (*debug)(struct nvhost_syncpt *);
const char * (*name)(struct nvhost_syncpt *, u32 id);
} syncpt;
struct {
void (*init_host_sync)(struct nvhost_intr *);
void (*set_host_clocks_per_usec)(
struct nvhost_intr *, u32 clocks);
void (*set_syncpt_threshold)(
struct nvhost_intr *, u32 id, u32 thresh);
void (*enable_syncpt_intr)(struct nvhost_intr *, u32 id);
void (*disable_all_syncpt_intrs)(struct nvhost_intr *);
int (*request_host_general_irq)(struct nvhost_intr *);
void (*free_host_general_irq)(struct nvhost_intr *);
int (*request_syncpt_irq)(struct nvhost_intr_syncpt *syncpt);
} intr;
struct {
int (*mutex_try_lock)(struct nvhost_cpuaccess *,
unsigned int idx);
void (*mutex_unlock)(struct nvhost_cpuaccess *,
unsigned int idx);
} cpuaccess;
};
int nvhost_init_t20_support(struct nvhost_master *host);
int nvhost_init_t30_support(struct nvhost_master *host);
#endif /* _NVHOST_CHIP_SUPPORT_H_ */
|
/*
* connectiondatum.h
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST 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.
*
* NEST 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 NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CONNECTIONDATUM_H
#define CONNECTIONDATUM_H
/**
* SLI Datum types related to the NEST kernel.
*/
#include "nestmodule.h"
#include "connection_id.h"
#include "aggregatedatum.h"
#ifndef HAVE_STATIC_TEMPLATE_DECLARATION_FAILS
template<>
sli::pool AggregateDatum<nest::ConnectionID, &nest::NestModule::ConnectionType>::memory;
#endif
template<>
void AggregateDatum<nest::ConnectionID, &nest::NestModule::ConnectionType>::print(std::ostream &) const;
template<>
void AggregateDatum<nest::ConnectionID, &nest::NestModule::ConnectionType>::pprint(std::ostream &) const;
typedef AggregateDatum<nest::ConnectionID, &nest::NestModule::ConnectionType> ConnectionDatum;
#endif
|
/*
* Copyright (C) 2013-2015 DeathCore <http://www.noffearrdeathproject.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. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPENDERCONSOLE_H
#define APPENDERCONSOLE_H
#include "Appender.h"
#include <string>
enum ColorTypes
{
BLACK,
RED,
GREEN,
BROWN,
BLUE,
MAGENTA,
CYAN,
GREY,
YELLOW,
LRED,
LGREEN,
LBLUE,
LMAGENTA,
LCYAN,
WHITE
};
const uint8 MaxColors = uint8(WHITE) + 1;
class AppenderConsole: public Appender
{
public:
AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags);
void InitColors(const std::string& init_str);
private:
void SetColor(bool stdout_stream, ColorTypes color);
void ResetColor(bool stdout_stream);
void _write(LogMessage const& message);
bool _colored;
ColorTypes _colors[MaxLogLevels];
};
#endif
|
/*
* libjingle
* Copyright 2004--2005, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SESSIONCLIENT_H_
#define _SESSIONCLIENT_H_
#include "talk/p2p/base/sessiondescription.h"
#include "talk/p2p/base/sessionmessage.h"
#include "talk/p2p/base/sessionmanager.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/jid.h"
namespace cricket {
// Generic XMPP session client. This class knows how to translate
// a SessionMessage to and from XMPP stanzas. The SessionDescription
// is a custom description implemented by the client.
// This class knows how to talk to the session manager, however the
// session manager doesn't have knowledge of a particular SessionClient.
class SessionClient : public sigslot::has_slots<> {
public:
SessionClient(SessionManager *psm);
virtual ~SessionClient();
// Call this method to determine if a stanza is for this session client
bool IsClientStanza(const buzz::XmlElement *stanza);
// Call this method to deliver a stanza to this session client
void OnIncomingStanza(const buzz::XmlElement *stanza);
// Call this whenever an error is recieved in response to an outgoing
// session IQ. Include the original stanza and any failure stanza. If
// the failure is due to a time out, the failure_stanza should be NULL
void OnFailedSend(const buzz::XmlElement* original_stanza,
const buzz::XmlElement* failure_stanza);
SessionManager *session_manager();
// Implement this method for stanza sending
sigslot::signal2<SessionClient*, const buzz::XmlElement*> SignalSendStanza;
protected:
// Override these to know when sessions belonging to this client create/destroy
virtual void OnSessionCreate(Session * /*session*/, bool /*received_initiate*/) {}
virtual void OnSessionDestroy(Session * /*session*/) {}
// Implement these methods for a custom session description
virtual const SessionDescription *CreateSessionDescription(const buzz::XmlElement *element) = 0;
virtual buzz::XmlElement *TranslateSessionDescription(const SessionDescription *description) = 0;
virtual const std::string &GetSessionDescriptionName() = 0;
virtual const buzz::Jid &GetJid() const = 0;
SessionManager *session_manager_;
private:
void OnSessionCreateSlot(Session *session, bool received_initiate);
void OnSessionDestroySlot(Session *session);
void OnOutgoingMessage(Session *session, const SessionMessage &message);
void ParseHeader(const buzz::XmlElement *stanza, SessionMessage &message);
bool ParseCandidate(const buzz::XmlElement *child, Candidate* candidate);
bool ParseIncomingMessage(const buzz::XmlElement *stanza,
SessionMessage& message);
void ParseInitiateAcceptModify(const buzz::XmlElement *stanza, SessionMessage &message);
void ParseCandidates(const buzz::XmlElement *stanza, SessionMessage &message);
void ParseRejectTerminate(const buzz::XmlElement *stanza, SessionMessage &message);
void ParseRedirect(const buzz::XmlElement *stanza, SessionMessage &message);
buzz::XmlElement *TranslateHeader(const SessionMessage &message);
buzz::XmlElement *TranslateCandidate(const Candidate &candidate);
buzz::XmlElement *TranslateInitiateAcceptModify(const SessionMessage &message);
buzz::XmlElement *TranslateCandidates(const SessionMessage &message);
buzz::XmlElement *TranslateRejectTerminate(const SessionMessage &message);
buzz::XmlElement *TranslateRedirect(const SessionMessage &message);
};
} // namespace cricket
#endif // _SESSIONCLIENT_H_
|
/**
* @file sync.c MSN list synchronization functions
*
* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include "msn.h"
#include "sync.h"
#include "state.h"
static MsnTable *cbs_table;
static void
blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
PurpleConnection *gc = cmdproc->session->account->gc;
const char *list_name;
list_name = cmd->params[0];
if (!g_ascii_strcasecmp(list_name, "AL"))
{
/*
* If the current setting is AL, messages from users who
* are not in BL will be delivered.
*
* In other words, deny some.
*/
gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
}
else
{
/* If the current setting is BL, only messages from people
* who are in the AL will be delivered.
*
* In other words, permit some.
*/
gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
}
}
static void
prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
MsnSession *session = cmdproc->session;
const char *type, *value;
type = cmd->params[0];
value = cmd->params[1];
if (cmd->param_count == 2)
{
if (!strcmp(type, "PHH"))
msn_user_set_home_phone(session->user, purple_url_decode(value));
else if (!strcmp(type, "PHW"))
msn_user_set_work_phone(session->user, purple_url_decode(value));
else if (!strcmp(type, "PHM"))
msn_user_set_mobile_phone(session->user, purple_url_decode(value));
}
else
{
if (!strcmp(type, "PHH"))
msn_user_set_home_phone(session->user, NULL);
else if (!strcmp(type, "PHW"))
msn_user_set_work_phone(session->user, NULL);
else if (!strcmp(type, "PHM"))
msn_user_set_mobile_phone(session->user, NULL);
}
}
static void
lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
MsnSession *session = cmdproc->session;
const char *name;
const char *group_id;
group_id = cmd->params[0];
name = purple_url_decode(cmd->params[1]);
msn_group_new(session->userlist, group_id, name);
/* HACK */
if (group_id == 0)
{
/* Group of ungroupped buddies */
if (session->sync->total_users == 0)
{
cmdproc->cbs_table = session->sync->old_cbs_table;
msn_session_finish_login(session);
msn_sync_destroy(session->sync);
session->sync = NULL;
}
return;
}
if ((purple_find_group(name)) == NULL)
{
PurpleGroup *g = purple_group_new(name);
purple_blist_add_group(g, NULL);
}
}
static void
lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
MsnSession *session = cmdproc->session;
char *passport = NULL;
const char *friend = NULL;
int list_op;
MsnUser *user;
passport = cmd->params[0];
friend = purple_url_decode(cmd->params[1]);
list_op = atoi(cmd->params[2]);
user = msn_user_new(session->userlist, passport, friend);
msn_userlist_add_user(session->userlist, user);
session->sync->last_user = user;
/* TODO: This can be improved */
if (list_op & MSN_LIST_FL_OP)
{
char **c;
char **tokens;
const char *group_nums;
GSList *group_ids;
group_nums = cmd->params[3];
group_ids = NULL;
tokens = g_strsplit(group_nums, ",", -1);
for (c = tokens; *c != NULL; c++)
{
group_ids = g_slist_append(group_ids, *c);
}
msn_got_lst_user(session, user, list_op, group_ids);
g_strfreev(tokens);
g_slist_free(group_ids);
}
else
{
msn_got_lst_user(session, user, list_op, NULL);
}
session->sync->num_users++;
if (session->sync->num_users == session->sync->total_users)
{
cmdproc->cbs_table = session->sync->old_cbs_table;
msn_session_finish_login(session);
msn_sync_destroy(session->sync);
session->sync = NULL;
}
}
static void
bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
MsnSync *sync = cmdproc->session->sync;
const char *type, *value;
MsnUser *user;
user = sync->last_user;
g_return_if_fail(user != NULL);
type = cmd->params[0];
value = cmd->params[1];
if (value)
{
if (!strcmp(type, "MOB"))
{
if (!strcmp(value, "Y"))
user->mobile = TRUE;
}
else if (!strcmp(type, "PHH"))
msn_user_set_home_phone(user, purple_url_decode(value));
else if (!strcmp(type, "PHW"))
msn_user_set_work_phone(user, purple_url_decode(value));
else if (!strcmp(type, "PHM"))
msn_user_set_mobile_phone(user, purple_url_decode(value));
}
}
void
msn_sync_init(void)
{
cbs_table = msn_table_new();
/* Syncing */
msn_table_add_cmd(cbs_table, NULL, "GTC", NULL);
msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd);
msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd);
msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd);
msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd);
msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd);
}
void
msn_sync_end(void)
{
msn_table_destroy(cbs_table);
}
MsnSync *
msn_sync_new(MsnSession *session)
{
MsnSync *sync;
sync = g_new0(MsnSync, 1);
sync->session = session;
sync->cbs_table = cbs_table;
return sync;
}
void
msn_sync_destroy(MsnSync *sync)
{
g_free(sync);
}
|
// -*- mode: c++; coding: utf-8 -*-
// Linthesia
// Copyright (c) 2007 Nicholas Piegdon
// Adaptation to GNU/Linux by Oscar Aceña
// See COPYING for license information
#ifndef __PLAYING_STATE_H
#define __PLAYING_STATE_H
#include <string>
#include <vector>
#include <set>
#include "libmidi/Midi.h"
#include "SharedState.h"
#include "GameState.h"
#include "KeyboardDisplay.h"
#include "MidiComm.h"
struct ActiveNote {
bool operator()(const ActiveNote &lhs, const ActiveNote &rhs) {
if (lhs.note_id < rhs.note_id)
return true;
if (lhs.note_id > rhs.note_id)
return false;
if (lhs.channel < rhs.channel)
return true;
if (lhs.channel > rhs.channel)
return false;
return false;
}
NoteId note_id;
unsigned char channel;
int velocity;
};
typedef std::set<ActiveNote, ActiveNote> ActiveNoteSet;
class PlayingState : public GameState {
public:
PlayingState(const SharedState &state);
~PlayingState();
bool ResetKeyboardActive();
protected:
virtual void Init();
virtual void Update();
virtual void Draw(Renderer &renderer) const;
private:
std::set<int> m_pressed_notes;
std::set<int> m_required_notes;
void userPressedKey(int note_number, bool active);
void filePressedKey(int note_number, bool active, size_t track_id);
bool areAllRequiredKeysPressed();
bool isKeyPressed(int note_number);
bool isUserPlayableTrack(size_t track_id);
int CalcKeyboardHeight() const;
void SetupNoteState();
void ResetSong();
void Play(microseconds_t delta_microseconds);
void Listen();
double CalculateScoreMultiplier() const;
bool m_paused;
KeyboardDisplay *m_keyboard;
microseconds_t m_show_duration;
TranslatedNoteSet m_notes;
TranslatedNoteSet m_notes_history;
bool m_any_you_play_tracks;
size_t m_look_ahead_you_play_note_count;
ActiveNoteSet m_active_notes;
bool m_first_update;
SharedState m_state;
int m_current_combo;
double m_title_alpha;
double m_max_allowed_title_alpha;
// For octave sliding
int m_note_offset;
// For retries
bool m_should_retry;
bool m_should_wait_after_retry;
microseconds_t m_retry_start;
void eraseUntilTime(microseconds_t time);
NoteState findNodeState(const TranslatedNote& note, TranslatedNoteSet& notes, NoteState default_note_state);
};
#endif // __PLAYING_STATE_H
|
/*
* can_queue.h
*
* Created on: 03.08.2015
* Author: hd
*/
#ifndef CAN_QUEUE_H_
#define CAN_QUEUE_H_
#include "config.h"
#include "can.h"
typedef struct {
void *next;
void *prev;
can_message_t msg;
} can_queue_item_t;
typedef struct {
can_queue_item_t *first;
can_queue_item_t *last;
unsigned count;
} can_queue_t;
void can_queue_init(can_queue_t *queue);
void can_queue_push_back(can_queue_t *queue, can_queue_item_t *item);
int can_queue_pop_front(can_queue_t *queue, can_queue_item_t **item);
#endif /* CAN_QUEUE_H_ */
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2006 Dan Everton
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <SDL.h>
#include "config.h"
#include "button.h"
#include "buttonmap.h"
int key_to_button(int keyboard_button)
{
int new_btn = BUTTON_NONE;
switch (keyboard_button)
{
case SDLK_KP4:
case SDLK_LEFT:
new_btn = BUTTON_LEFT;
break;
case SDLK_KP6:
case SDLK_RIGHT:
new_btn = BUTTON_RIGHT;
break;
case SDLK_KP8:
case SDLK_UP:
new_btn = BUTTON_UP;
break;
case SDLK_KP2:
case SDLK_DOWN:
new_btn = BUTTON_DOWN;
break;
case SDLK_KP_PLUS:
case SDLK_F8:
new_btn = BUTTON_ON;
break;
case SDLK_KP_ENTER:
case SDLK_RETURN:
case SDLK_a:
new_btn = BUTTON_OFF;
break;
case SDLK_KP_DIVIDE:
case SDLK_F1:
new_btn = BUTTON_REC;
break;
case SDLK_KP5:
case SDLK_SPACE:
new_btn = BUTTON_SELECT;
break;
case SDLK_KP_PERIOD:
case SDLK_INSERT:
new_btn = BUTTON_MODE;
break;
}
return new_btn;
}
struct button_map bm[] = {
#if defined (IRIVER_H120) || defined (IRIVER_H100)
{ SDLK_KP_DIVIDE, 46, 162, 13, "Record" },
{ SDLK_KP_PLUS, 327, 36, 16, "Play" },
{ SDLK_KP_ENTER, 330, 99, 18, "Stop" },
{ SDLK_KP_PERIOD, 330, 163, 18, "AB" },
{ SDLK_KP5, 186, 227, 27, "5" },
{ SDLK_KP8, 187, 185, 19, "8" },
{ SDLK_KP4, 142, 229, 23, "4" },
{ SDLK_KP6, 231, 229, 22, "6" },
{ SDLK_KP2, 189, 272, 28, "2" },
/* Remote Buttons */
{ SDLK_KP_ENTER, 250, 404, 20, "Stop" },
{ SDLK_SPACE, 285, 439, 29, "Space" },
{ SDLK_h, 336, 291, 24, "Hold" },
#elif defined (IRIVER_H300)
{ SDLK_KP_PLUS, 56, 335, 20, "Play" },
{ SDLK_KP8, 140, 304, 29, "Up" },
{ SDLK_KP_DIVIDE, 233, 331, 23, "Record" },
{ SDLK_KP_ENTER, 54, 381, 24, "Stop" },
{ SDLK_KP4, 100, 353, 17, "Left" },
{ SDLK_KP5, 140, 351, 19, "Navi" },
{ SDLK_KP6, 185, 356, 19, "Right" },
{ SDLK_KP_PERIOD, 230, 380, 20, "AB" },
{ SDLK_KP2, 142, 402, 24, "Down" },
{ SDLK_KP_ENTER, 211, 479, 21, "Stop" },
{ SDLK_KP_PLUS, 248, 513, 29, "Play" },
#endif
{ 0, 0, 0, 0, "None" }
};
|
/*
*
* BATMAN Bit Array/Sliding Window insipred by the bitarray class in the real BATMAN implementation
*
* Author : Anne Gabrielle Bowitz
* Email : bowitz@stud.ntnu.no
* Project : Simulation of a Secure Ad Hoc Network Routing protocol
* Institution: NTNU (Norwegian University of Science & Technology), ITEM (Institute of Telematics)
*
*/
#include "batman-routing-protocol.h"
#define TYPE_OF_WORD uintmax_t /* you should choose something big, if you don't want to waste cpu */
#define WORD_BIT_SIZE ( sizeof(TYPE_OF_WORD) * 8 )
void bit_init( TYPE_OF_WORD *seq_bits );
uint8_t get_bit_status( TYPE_OF_WORD *seq_bits, uint16_t last_seqno, uint16_t curr_seqno );
char *bit_print( TYPE_OF_WORD *seq_bits );
void bit_mark( TYPE_OF_WORD *seq_bits, int32_t n );
void bit_shift( TYPE_OF_WORD *seq_bits, int32_t n );
char bit_get_packet( TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, int8_t set_mark );
int bit_packet_count( TYPE_OF_WORD *seq_bits );
uint8_t bit_count( int32_t to_count );
|
#if !defined(CONDITIONS_CIRCE_KAMIKAZE_H)
#define CONDITIONS_CIRCE_KAMIKAZE_H
#include "solving/machinery/solve.h"
/* Instrument the solving machinery with Circe Kamikaze
* @param si identifies the root slice of the solving machinery
*/
void circe_kamikaze_initialise_solving(slice_index si);
/* Try to solve in solve_nr_remaining half-moves.
* @param si slice index
* @note assigns solve_result the length of solution found and written, i.e.:
* previous_move_is_illegal the move just played is illegal
* this_move_is_illegal the move being played is illegal
* immobility_on_next_move the moves just played led to an
* unintended immobility on the next move
* <=n+1 length of shortest solution found (n+1 only if in next
* branch)
* n+2 no solution found in this branch
* n+3 no solution found in next branch
* (with n denominating solve_nr_remaining)
*/
void circe_kamikaze_capture_fork_solve(slice_index si);
#endif
|
/*
* Copyright (C) 2009 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.
*/
#ifndef ANDROID_RS_OBJECT_BASE_H
#define ANDROID_RS_OBJECT_BASE_H
#include "rsUtils.h"
#include "rsDefines.h"
#define RS_OBJECT_DEBUG 0
#include <utils/CallStack.h>
namespace android {
namespace renderscript {
class Context;
class OStream;
// An element is a group of Components that occupies one cell in a structure.
class ObjectBase {
public:
ObjectBase(Context *rsc);
void incSysRef() const;
bool decSysRef() const;
void incUserRef() const;
bool decUserRef() const;
bool zeroUserRef() const;
static bool checkDelete(const ObjectBase *);
const char * getName() const {
return mName.string();
}
void setName(const char *);
void setName(const char *, uint32_t len);
Context * getContext() const {return mRSC;}
virtual bool freeChildren();
static void zeroAllUserRef(Context *rsc);
static void freeAllChildren(Context *rsc);
static void dumpAll(Context *rsc);
virtual void dumpLOGV(const char *prefix) const;
virtual void serialize(Context *rsc, OStream *stream) const = 0;
virtual RsA3DClassID getClassId() const = 0;
static bool isValid(const Context *rsc, const ObjectBase *obj);
// The async lock is taken during object creation in non-rs threads
// and object deletion in the rs thread.
static void asyncLock();
static void asyncUnlock();
protected:
// Called inside the async lock for any object list management that is
// necessary in derived classes.
virtual void preDestroy() const;
Context *mRSC;
virtual ~ObjectBase();
private:
static pthread_mutex_t gObjectInitMutex;
void add() const;
void remove() const;
String8 mName;
mutable int32_t mSysRefCount;
mutable int32_t mUserRefCount;
mutable const ObjectBase * mPrev;
mutable const ObjectBase * mNext;
#if RS_OBJECT_DEBUG
CallStack mStack;
#endif
};
template<class T>
class ObjectBaseRef {
public:
ObjectBaseRef() {
mRef = NULL;
}
ObjectBaseRef(const ObjectBaseRef &ref) {
mRef = ref.get();
if (mRef) {
mRef->incSysRef();
}
}
ObjectBaseRef(T *ref) {
mRef = ref;
if (mRef) {
ref->incSysRef();
}
}
ObjectBaseRef & operator= (const ObjectBaseRef &ref) {
if (&ref != this) {
set(ref);
}
return *this;
}
~ObjectBaseRef() {
clear();
}
void set(T *ref) {
if (mRef != ref) {
clear();
mRef = ref;
if (mRef) {
ref->incSysRef();
}
}
}
void set(const ObjectBaseRef &ref) {
set(ref.mRef);
}
void clear() {
if (mRef) {
mRef->decSysRef();
}
mRef = NULL;
}
inline T * get() const {
return mRef;
}
inline T * operator-> () const {
return mRef;
}
protected:
T * mRef;
};
}
}
#endif //ANDROID_RS_OBJECT_BASE_H
|
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(sph/heatconduction/phasechange,PairSPHHeatConductionPhaseChange)
#else
#ifndef LMP_PAIR_SPH_HEATCONDUCTION_PHASECHANGE_H
#define LMP_PAIR_SPH_HEATCONDUCTION_PHASECHANGE_H
#include "pair.h"
namespace LAMMPS_NS {
class PairSPHHeatConductionPhaseChange : public Pair {
public:
PairSPHHeatConductionPhaseChange(class LAMMPS *);
virtual ~PairSPHHeatConductionPhaseChange();
virtual void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
virtual double init_one(int, int);
virtual double single(int, int, int, int, double, double, double, double &);
protected:
double **cut, **alpha, **tc;
int **fixflag;
void allocate();
};
}
#endif
#endif
|
/* linux/arch/arm/mach-msm/board-swift-gpio-i2c.c
*
* Copyright (C) 2009 LGE, Inc.
* Author: SungEun Kim <cleaneye@lge.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <mach/gpio.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/delay.h>
#define GPIOF_DRIVE_OUTPUT 0x00040000
#define LGE_GPIO_I2C_DBG
#define LGE_GPIO_I2C_ERR
#if defined(LGE_GPIO_I2C_DBG)
#define GI2C_D(fmt, args...) printk(KERN_INFO "swift i2c[%-18s:%5d]" fmt, __func__, __LINE__, ## args)
#else
#define GI2C_D(fmt, args...) do {} while(0)
#endif
#if defined(LGE_GPIO_I2C_ERR)
#define GI2C_E(fmt, args...) printk(KERN_INFO "swift i2c [%-18s:%5d]" fmt, __func__, __LINE__, ## args)
#else
#define GI2C_E(fmt, args...) do {} while(0)
#endif
/* GPIO I2C BUS Number Lists */
#define I2C_BUS_NUM_ECOMPASS 2
#define I2C_BUS_NUM_MOTION 3
typedef void (gpio_i2c_init_func_t)(void);
/* E-COMPASS : AKM8973 */
#define GPIO_ECOMPASS_INT (18)
#define GPIO_ECOMPASS_I2C_SDA (31)
#define GPIO_ECOMPASS_I2C_SCL (30)
#define ECOMPASS_I2C_ADDR (0x1C)
/* MOTION : BMA150 */
#define GPIO_MOTION_INT (33)
#define GPIO_MOTION_I2C_SDA (41)
#define GPIO_MOTION_I2C_SCL (40)
#define MOTION_I2C_ADDR (0x38)
static struct i2c_gpio_platform_data ecompass_i2c_gpio_pdata = {
.sda_pin = GPIO_ECOMPASS_I2C_SDA,
.scl_pin = GPIO_ECOMPASS_I2C_SCL,
.sda_is_open_drain = 0,
.scl_is_open_drain = 0,
.udelay = 2,
};
static struct platform_device ecompass_pdevice = {
.name = "i2c-gpio",
.id = I2C_BUS_NUM_ECOMPASS,
.dev.platform_data = &ecompass_i2c_gpio_pdata,
};
static struct i2c_board_info ecompass_i2c_bdinfo[] = {
{
I2C_BOARD_INFO("akm8973-swift", ECOMPASS_I2C_ADDR),
.irq = MSM_GPIO_TO_INT(GPIO_ECOMPASS_INT),
},
};
static struct i2c_gpio_platform_data motion_i2c_gpio_pdata = {
.sda_pin = GPIO_MOTION_I2C_SDA,
.scl_pin = GPIO_MOTION_I2C_SCL,
.sda_is_open_drain = 0,
.scl_is_open_drain = 0,
.udelay = 2,
};
static struct platform_device motion_pdevice = {
.name = "i2c-gpio",
.id = I2C_BUS_NUM_MOTION,
.dev.platform_data = &motion_i2c_gpio_pdata,
};
static struct i2c_board_info motion_i2c_bdinfo[] = {
{
I2C_BOARD_INFO("bma150", MOTION_I2C_ADDR),
.irq = MSM_GPIO_TO_INT(GPIO_MOTION_INT),
},
};
void __init init_i2c_gpio_compass(void)
{
int rc = 0;
rc = i2c_register_board_info(I2C_BUS_NUM_ECOMPASS, ecompass_i2c_bdinfo, 1);
if (rc < 0) {
GI2C_E("failed to i2c register board info(busnum=%d, ret=%d)\n", I2C_BUS_NUM_ECOMPASS, rc);
return;
}
rc = platform_device_register(&ecompass_pdevice);
if (rc != 0) {
GI2C_E("failed to register motion platform device(ret=%d)\n", rc);
}
}
void __init init_i2c_gpio_motion(void)
{
int rc = 0;
rc = i2c_register_board_info(I2C_BUS_NUM_MOTION, motion_i2c_bdinfo, 1);
if (rc < 0) {
GI2C_E("failed to i2c register board info(busnum=%d, ret=%d)\n", I2C_BUS_NUM_MOTION, rc);
return;
}
rc = platform_device_register(&motion_pdevice);
if (rc != 0) {
GI2C_E("failed to register motion platform device(ret=%d)\n", rc);
}
}
void __init swift_init_gpio_i2c_devices(void)
{
init_i2c_gpio_compass();
init_i2c_gpio_motion();
}
|
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "hgen.h"
int ci_strcmp(const char *str1, const char *str2)
{
while (*str1)
{
if (tolower(*str1) != tolower(*str2))
return tolower(*str1) - tolower(*str2);
str1++;
str2++;
}
return tolower(*str1) - tolower(*str2);
}
/* can't even remember what this does, but it works */
static char *rstrchr(const char * str, char chr)
{
while (*str)
if (tolower(*str) == tolower(chr))
return (char*)str;
else
str++;
return NULL;
}
int strregexp(const char * str, const char * pattern)
{
if (!pattern)
return 1;
while (*pattern && *str)
{
if (*pattern == '?')
pattern++, str++;
else if (*pattern == '*')
{
while (*(++pattern) == '*');
if (!*pattern)
return 1;
if (*pattern == '?')
{
while (*str)
if (strregexp(str++, pattern))
return 1;
}
else
{
while ((str = rstrchr(str, *pattern)))
if (strregexp(str++, pattern))
return 1;
}
return 0;
}
else if (tolower(*pattern) != tolower(*str))
return 0;
else
pattern++, str++;
}
while(*pattern == '*')
pattern++;
if (!*pattern && !*str)
return 1;
else
return 0;
}
#define TIME_PRINT(elem,marker)\
if (elem)\
{\
buf+=sprintf(buf, " %d%s", elem, marker);\
}\
/* This implementation might look a little evil but it does work */
const char *helpmod_strtime(int total_seconds)
{
static int buffer_index = 0;
static char buffers[3][64];
char *buf = buffers[buffer_index];
char *buffer = buf;
int years, months, days, hours, minutes, seconds;
buffer_index = (buffer_index+1) % 3;
/* trivial case */
if (!total_seconds)
return "0s";
if (total_seconds < 0)
{
*buf = '-';
buf++;
total_seconds = -total_seconds;
}
years = total_seconds / HDEF_y;
total_seconds %= HDEF_y;
months = total_seconds / HDEF_M;
total_seconds %= HDEF_M;
days = total_seconds / HDEF_d;
total_seconds %= HDEF_d;
hours = total_seconds / HDEF_h;
total_seconds %= HDEF_h;
minutes = total_seconds / HDEF_m;
total_seconds %= HDEF_m;
seconds = total_seconds;
TIME_PRINT(years, "y");
TIME_PRINT(months, "M");
TIME_PRINT(days, "d");
TIME_PRINT(hours, "h");
TIME_PRINT(minutes, "m");
TIME_PRINT(seconds, "s");
if (*buffer != '-')
return buffer+1;
else
return buffer;
}
int helpmod_read_strtime(const char *str)
{
int sum = 0, tmp_sum, tmp;
while (*str)
{
if (!sscanf(str, "%d%n", &tmp_sum, &tmp))
return -1;
str+=tmp;
switch (*str)
{
case 's':
break;
case 'm':
tmp_sum*=HDEF_m;
break;
case 'h':
tmp_sum*=HDEF_h;
break;
case 'd':
tmp_sum*=HDEF_d;
break;
case 'w':
tmp_sum*=HDEF_w;
break;
case 'M':
tmp_sum*=HDEF_M;
break;
case 'y':
tmp_sum*=HDEF_y;
break;
default: /* includes '\0' */
return -1;
}
str++;
/* sanity checks */
if (tmp_sum > 10 * HDEF_y)
return -1;
sum+=tmp_sum;
if (sum > 10 * HDEF_y)
return -1;
}
return sum;
}
int hword_count(const char *ptr)
{
int wordc = 0;
while (*ptr)
{
while (isspace(*ptr) && *ptr)
ptr++;
if (*ptr)
wordc++;
while (!isspace(*ptr) && *ptr)
ptr++;
}
return wordc;
}
int helpmod_is_lame_line(const char *line)
{
const char lamechars[] = {(char)2, (char)3, (char)22, (char)31, (char)0};
if (strpbrk(line, lamechars) != NULL)
return 1;
else
return 0;
}
int strislower(const char *str)
{
for (;*str;str++)
if (isupper(*str))
return 0;
return 1;
}
int strisupper(const char *str)
{
for (;*str;str++)
if (islower(*str))
return 0;
return 1;
}
int strisalpha(const char *str)
{
for (;*str;str++)
if (!isalpha(*str))
return 0;
return 1;
}
int strnumcount(const char *str)
{
int count = 0;
for (;*str;str++)
if (isdigit(*str))
count++;
return count;
}
float helpmod_percentage(int larger, int smaller)
{
if (larger == 0)
return 0.0;
return 100.0 * ((float)smaller / (float)larger);
}
int helpmod_select(const char *str, const char **strs, int *enums, int count)
{
int i;
if (count == 0)
return -1;
for (i = 0;i < count;i++)
if (!ci_strcmp(strs[i], str))
return enums[i];
return -1;
}
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
*/
#include "tomcrypt.h"
/**
@file rng_make_prng.c
portable way to get secure random bits to feed a PRNG (Tom St Denis)
*/
/**
Create a PRNG from a RNG
@param bits Number of bits of entropy desired (64 ... 1024)
@param wprng Index of which PRNG to setup
@param prng [out] PRNG state to initialize
@param callback A pointer to a void function for when the RNG is slow, this can be NULL
@return CRYPT_OK if successful
*/
int rng_make_prng(int bits, int wprng, prng_state *prng,
void (*callback)(void))
{
unsigned char buf[256];
int err;
LTC_ARGCHK(prng != NULL);
/* check parameter */
if ((err = prng_is_valid(wprng)) != CRYPT_OK) {
return err;
}
if (bits < 64 || bits > 1024) {
return CRYPT_INVALID_PRNGSIZE;
}
if ((err = prng_descriptor[wprng].start(prng)) != CRYPT_OK) {
return err;
}
bits = ((bits/8)+((bits&7)!=0?1:0)) * 2;
if (rng_get_bytes(buf, (unsigned long)bits, callback) != (unsigned long)bits) {
return CRYPT_ERROR_READPRNG;
}
if ((err = prng_descriptor[wprng].add_entropy(buf, (unsigned long)bits, prng)) != CRYPT_OK) {
return err;
}
if ((err = prng_descriptor[wprng].ready(prng)) != CRYPT_OK) {
return err;
}
#ifdef LTC_CLEAN_STACK
zeromem(buf, sizeof(buf));
#endif
return CRYPT_OK;
}
/* $Source: /usr/local/dslrepos/uClinux-dist/user/dropbear-0.48.1/libtomcrypt/src/prngs/rng_make_prng.c,v $ */
/* $Revision: 1.1 $ */
/* $Date: 2006/06/08 13:51:19 $ */
|
/*
* RapidIO Tsi500 switch support
*
* Copyright 2009-2010 Integrated Device Technology, Inc.
* Alexandre Bounine <alexandre.bounine@idt.com>
* - Modified switch operations initialization.
*
* Copyright 2005 MontaVista Software, Inc.
* Matt Porter <mporter@kernel.crashing.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/rio.h>
#include <linux/rio_drv.h>
#include <linux/rio_ids.h>
#include "../rio.h"
static int
tsi500_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 route_port)
{
int i;
u32 offset = 0x10000 + 0xa00 + ((route_destid / 2)&~0x3);
u32 result;
if (table == 0xff) {
rio_mport_read_config_32(mport, destid, hopcount, offset, &result);
result &= ~(0xf << (4*(route_destid & 0x7)));
for (i=0;i<4;i++)
rio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*i), result | (route_port << (4*(route_destid & 0x7))));
}
else {
rio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*table), &result);
result &= ~(0xf << (4*(route_destid & 0x7)));
rio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*table), result | (route_port << (4*(route_destid & 0x7))));
}
return 0;
}
static int
tsi500_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 *route_port)
{
int ret = 0;
u32 offset = 0x10000 + 0xa00 + ((route_destid / 2)&~0x3);
u32 result;
if (table == 0xff)
rio_mport_read_config_32(mport, destid, hopcount, offset, &result);
else
rio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*table), &result);
result &= 0xf << (4*(route_destid & 0x7));
*route_port = result >> (4*(route_destid & 0x7));
if (*route_port > 3)
ret = -1;
return ret;
}
static int tsi500_switch_init(struct rio_dev *rdev, int do_enum)
{
pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
rdev->rswitch->add_entry = tsi500_route_add_entry;
rdev->rswitch->get_entry = tsi500_route_get_entry;
rdev->rswitch->clr_table = NULL;
rdev->rswitch->set_domain = NULL;
rdev->rswitch->get_domain = NULL;
rdev->rswitch->em_init = NULL;
rdev->rswitch->em_handle = NULL;
return 0;
}
DECLARE_RIO_SWITCH_INIT(RIO_VID_TUNDRA, RIO_DID_TSI500, tsi500_switch_init);
|
// This file is generated by kconfig_compiler from pppoe.kcfg.
// All changes you do to this file will be lost.
#ifndef PPPOEDBUS_H
#define PPPOEDBUS_H
#include <nm-setting-pppoe.h>
#include <kdebug.h>
#include <kcoreconfigskeleton.h>
#include "settingdbus.h"
#include "nm09dbus_export.h"
namespace Knm{
class PppoeSetting;
}
class NM09DBUS_EXPORT PppoeDbus : public SettingDbus
{
public:
PppoeDbus(Knm::PppoeSetting * setting);
~PppoeDbus();
void fromMap(const QVariantMap&);
QVariantMap toMap();
QVariantMap toSecretsMap();
};
#endif
|
#include "test.h"
volatile uint8_t rval=0;
volatile uint8_t gval=0;
volatile uint8_t bval=0;
uint8_t time_val;
void main(void)
{
CLK_CKDIVR = 0x00; // Set the frequency to 16 MHz
init_clock();
//leds
PD_DDR |= 0x01;
PD_CR1 |= 0x01;
PD_ODR |= 0x01;
PC_DDR |= 0x60;
PC_CR1 |= 0x60;
PC_ODR |= 0x60;
PB_DDR |= 0x07;
PB_CR1 |= 0x07;
PB_ODR |= 0x07;
init_serial();
__asm
rim
__endasm;
// use test set command to test this
while(1){
time_val = TIM2_CNTRL>>2;
if(time_val>=bval){
PC_ODR |= 0x40;
}else{
PC_ODR &= ~0x40;
}
if(time_val>=rval){
PC_ODR |= 0x20;
}else{
PC_ODR &= ~0x20;
}
if(time_val>=gval){
PD_ODR |= 0x01;
}else{
PD_ODR &= ~0x01;
}
if(serial_data_ready_flag){
if(serial_cmd ==0){
bval=0;
gval=0;
rval=0;
}else if(serial_cmd == 1){
bval = serial_data[0];
}else if(serial_cmd==2){
gval = serial_data[0];
}else if(serial_cmd==3){
rval = serial_data[0];
}
serial_data_ready_flag=0;
}
if(comm_state==WAIT){
PB_ODR = 0x06;
}else if(comm_state==START){
PB_ODR = 0x05;
}else if(comm_state==DATA){
PB_ODR = 0x03;
}else if(comm_state==END_BYTE){
PB_ODR = 0x01;
}else if(comm_state==CMD_DLE){
PB_ODR = 0x02;
}else if(comm_state==DATA_DLE){
PB_ODR = 0x04;
}else{
PB_ODR = 0x07;
}
}
}
|
/*
*
* Authors:
* Lars Fenneberg <lf@elemental.net>
* Reuben Hawkins <reubenhwk@gmail.com>
*
* This software is Copyright 1996,1997 by the above mentioned author(s),
* All Rights Reserved.
*
* The license which is distributed with this software in the file COPYRIGHT
* applies to this software. If your distribution is missing this file, you
* may request it from <pekkas@netcore.fi>.
*
*/
#include "config.h"
#include "radvd.h"
#include "log.h"
#include "netlink.h"
#include <asm/types.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifndef SOL_NETLINK
#define SOL_NETLINK 270
#endif
void process_netlink_msg(int sock)
{
int len;
char buf[4096];
struct iovec iov = { buf, sizeof(buf) };
struct sockaddr_nl sa;
struct msghdr msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
struct nlmsghdr *nh;
struct ifinfomsg * ifinfo;
char ifname[IF_NAMESIZE] = {""};
len = recvmsg (sock, &msg, 0);
if (len == -1) {
flog(LOG_ERR, "recvmsg failed: %s", strerror(errno));
}
for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len); nh = NLMSG_NEXT (nh, len)) {
/* The end of multipart message. */
if (nh->nlmsg_type == NLMSG_DONE)
return;
if (nh->nlmsg_type == NLMSG_ERROR) {
flog(LOG_ERR, "%s:%d Some type of netlink error.\n", __FILE__, __LINE__);
abort();
}
/* Continue with parsing payload. */
ifinfo = NLMSG_DATA(nh);
if_indextoname(ifinfo->ifi_index, ifname);
if (ifinfo->ifi_flags & IFF_RUNNING) {
dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is running", ifname, ifinfo->ifi_index);
}
else {
dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is *NOT* running", ifname, ifinfo->ifi_index);
}
reload_config();
}
}
int netlink_socket(void)
{
int rc, sock;
unsigned int val = 1;
struct sockaddr_nl snl;
sock = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock == -1) {
flog(LOG_ERR, "Unable to open netlink socket: %s", strerror(errno));
}
#ifdef NETLINK_NO_ENOBUFS
else if (setsockopt(sock, SOL_NETLINK, NETLINK_NO_ENOBUFS, &val, sizeof(val)) < 0 ) {
flog(LOG_ERR, "Unable to setsockopt NETLINK_NO_ENOBUFS: %s", strerror(errno));
}
#endif
memset(&snl, 0, sizeof(snl));
snl.nl_family = AF_NETLINK;
snl.nl_groups = RTMGRP_LINK;
rc = bind(sock, (struct sockaddr*)&snl, sizeof(snl));
if (rc == -1) {
flog(LOG_ERR, "Unable to bind netlink socket: %s", strerror(errno));
close(sock);
sock = -1;
}
return sock;
}
|
/*-
* Public platform independent Near Field Communication (NFC) library examples
*
* Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010-2011, Romain Tartière
* Copyright (C) 2009-2012, Romuald Conty
*
* 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 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.
*
* Note that this license only applies on the examples, NFC library itself is under LGPL
*
*/
/**
* @file nfc-utils.c
* @brief Provide some examples shared functions like print, parity calculation, options parsing.
*/
#include <nfc/nfc.h>
#include <err.h>
#include "nfc-utils.h"
uint8_t
oddparity(const uint8_t bt)
{
// cf http://graphics.stanford.edu/~seander/bithacks.html#ParityParallel
return (0x9669 >> ((bt ^(bt >> 4)) & 0xF)) & 1;
}
void
oddparity_bytes_ts(const uint8_t *pbtData, const size_t szLen, uint8_t *pbtPar)
{
size_t szByteNr;
// Calculate the parity bits for the command
for (szByteNr = 0; szByteNr < szLen; szByteNr++) {
pbtPar[szByteNr] = oddparity(pbtData[szByteNr]);
}
}
void
print_hex(const uint8_t *pbtData, const size_t szBytes)
{
size_t szPos;
for (szPos = 0; szPos < szBytes; szPos++) {
printf("%02x ", pbtData[szPos]);
}
printf("\n");
}
void
print_hex_bits(const uint8_t *pbtData, const size_t szBits)
{
uint8_t uRemainder;
size_t szPos;
size_t szBytes = szBits / 8;
for (szPos = 0; szPos < szBytes; szPos++) {
printf("%02x ", pbtData[szPos]);
}
uRemainder = szBits % 8;
// Print the rest bits
if (uRemainder != 0) {
if (uRemainder < 5)
printf("%01x (%d bits)", pbtData[szBytes], uRemainder);
else
printf("%02x (%d bits)", pbtData[szBytes], uRemainder);
}
printf("\n");
}
void
print_hex_par(const uint8_t *pbtData, const size_t szBits, const uint8_t *pbtDataPar)
{
uint8_t uRemainder;
size_t szPos;
size_t szBytes = szBits / 8;
for (szPos = 0; szPos < szBytes; szPos++) {
printf("%02x", pbtData[szPos]);
if (oddparity(pbtData[szPos]) != pbtDataPar[szPos]) {
printf("! ");
} else {
printf(" ");
}
}
uRemainder = szBits % 8;
// Print the rest bits, these cannot have parity bit
if (uRemainder != 0) {
if (uRemainder < 5)
printf("%01x (%d bits)", pbtData[szBytes], uRemainder);
else
printf("%02x (%d bits)", pbtData[szBytes], uRemainder);
}
printf("\n");
}
void
print_nfc_target(const nfc_target nt, bool verbose)
{
char *s;
str_nfc_target(&s, nt, verbose);
printf("%s", s);
free(s);
}
|
/*
* 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 DisplaySleepDisabler_h
#define DisplaySleepDisabler_h
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class DisplaySleepDisabler {
WTF_MAKE_NONCOPYABLE(DisplaySleepDisabler);
public:
static PassOwnPtr<DisplaySleepDisabler> create(const char* reason) { return adoptPtr(new DisplaySleepDisabler(reason)); }
~DisplaySleepDisabler();
private:
DisplaySleepDisabler(const char* reason);
#if !PLATFORM(IOS)
uint32_t m_disableDisplaySleepAssertion;
#endif // !PLATFORM(IOS)
};
}
#endif // DisplaySleepDisabler_h
|
#ifndef GUICREATEPROJECT_H
#define GUICREATEPROJECT_H
#include <dmcompilersettings.h>
#include <QDialog>
namespace Ui {
class GUICreateProject;
}
class GUISimulation;
class DM_HELPER_DLL_EXPORT GUICreateProject : public QDialog
{
Q_OBJECT
public:
explicit GUICreateProject(GUISimulation *sim, QWidget *parent = 0);
~GUICreateProject();
public slots:
void accept();
void reject();
private:
Ui::GUICreateProject *ui;
GUISimulation * sim;
};
#endif // GUICREATEPROJECT_H
|
/*
* Copyright (c) 2013 - 2015, 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_cop_hal.h"
/*******************************************************************************
* Definitions
*******************************************************************************/
/*******************************************************************************
* Variables
*******************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
/*FUNCTION**********************************************************************
*
* Function Name : COP_HAL_SetConfig
* Description : Configures COP.
*
*END**************************************************************************/
void COP_HAL_SetConfig(SIM_Type * base, const cop_config_t *configPtr)
{
uint32_t value = 0;
#if FSL_FEATURE_COP_HAS_LONGTIME_MODE
value = SIM_COPC_COPW(configPtr->copWindowModeEnable) | SIM_COPC_COPCLKS(configPtr->copTimeoutMode) |
SIM_COPC_COPT(configPtr->copTimeout) | SIM_COPC_COPSTPEN(configPtr->copStopModeEnable) |
SIM_COPC_COPDBGEN(configPtr->copDebugModeEnable) | SIM_COPC_COPCLKSEL(configPtr->copClockSource);
#else
value = SIM_COPC_COPW(configPtr->copWindowModeEnable) | SIM_COPC_COPCLKS(configPtr->copClockSource) |
SIM_COPC_COPT(configPtr->copTimeout);
#endif
SIM_WR_COPC(base, value);
}
/*FUNCTION**********************************************************************
*
* Function Name : COP_HAL_Init
* Description : Initialize COP peripheral to workable state.
*
*END**************************************************************************/
void COP_HAL_Init(SIM_Type * base)
{
cop_config_t copCommonConfig;
copCommonConfig.copWindowModeEnable = false;
#if FSL_FEATURE_COP_HAS_LONGTIME_MODE
copCommonConfig.copTimeoutMode = kCopShortTimeoutMode;
copCommonConfig.copStopModeEnable = false;
copCommonConfig.copDebugModeEnable = true;
#endif
copCommonConfig.copClockSource = kCopLpoClock;
copCommonConfig.copTimeout = kCopTimeout_short_2to10_or_long_2to18;
COP_HAL_SetConfig(base, &copCommonConfig);
}
/*******************************************************************************
* EOF
*******************************************************************************/
|
// SPDX-License-Identifier: GPL-2.0+
/*
* (c) 2011 Graf-Syteco, Matthias Weisser
* <weisserm@arcor.de>
*
* Based on tx25.c:
* (C) Copyright 2009 DENX Software Engineering
* Author: John Rigby <jrigby@gmail.com>
*
* Based on imx27lite.c:
* Copyright (C) 2008,2009 Eric Jarrige <jorasse@users.sourceforge.net>
* Copyright (C) 2009 Ilya Yanok <yanok@emcraft.com>
* And:
* RedBoot tx25_misc.c Copyright (C) 2009 Red Hat
*/
#include <common.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux-mx25.h>
DECLARE_GLOBAL_DATA_PTR;
int board_init()
{
static const iomux_v3_cfg_t sdhc1_pads[] = {
NEW_PAD_CTRL(MX25_PAD_SD1_CMD__SD1_CMD, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_CLK__SD1_CLK, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA0__SD1_DATA0, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA1__SD1_DATA1, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA2__SD1_DATA2, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA3__SD1_DATA3, NO_PAD_CTRL),
};
static const iomux_v3_cfg_t dig_out_pads[] = {
MX25_PAD_CSI_D8__GPIO_1_7, /* Ouput 1 Ctrl */
MX25_PAD_CSI_D7__GPIO_1_6, /* Ouput 2 Ctrl */
NEW_PAD_CTRL(MX25_PAD_CSI_D6__GPIO_1_31, 0), /* Ouput 1 Stat */
NEW_PAD_CTRL(MX25_PAD_CSI_D5__GPIO_1_30, 0), /* Ouput 2 Stat */
};
static const iomux_v3_cfg_t led_pads[] = {
MX25_PAD_CSI_D9__GPIO_4_21,
MX25_PAD_CSI_D4__GPIO_1_29,
};
static const iomux_v3_cfg_t can_pads[] = {
NEW_PAD_CTRL(MX25_PAD_GPIO_A__CAN1_TX, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_GPIO_B__CAN1_RX, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_GPIO_C__CAN2_TX, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_GPIO_D__CAN2_RX, NO_PAD_CTRL),
};
static const iomux_v3_cfg_t i2c3_pads[] = {
MX25_PAD_CSPI1_SS1__I2C3_DAT,
MX25_PAD_GPIO_E__I2C3_CLK,
};
icache_enable();
/* Setup of core voltage selection pin to run at 1.4V */
imx_iomux_v3_setup_pad(MX25_PAD_EXT_ARMCLK__GPIO_3_15); /* VCORE */
gpio_direction_output(IMX_GPIO_NR(3, 15), 1);
/* Setup of SD card pins*/
imx_iomux_v3_setup_multiple_pads(sdhc1_pads, ARRAY_SIZE(sdhc1_pads));
/* Setup of digital output for USB power and OC */
imx_iomux_v3_setup_pad(MX25_PAD_CSI_D3__GPIO_1_28); /* USB Power */
gpio_direction_output(IMX_GPIO_NR(1, 28), 1);
imx_iomux_v3_setup_pad(MX25_PAD_CSI_D2__GPIO_1_27); /* USB OC */
gpio_direction_input(IMX_GPIO_NR(1, 18));
/* Setup of digital output control pins */
imx_iomux_v3_setup_multiple_pads(dig_out_pads,
ARRAY_SIZE(dig_out_pads));
/* Switch both output drivers off */
gpio_direction_output(IMX_GPIO_NR(1, 7), 0);
gpio_direction_output(IMX_GPIO_NR(1, 6), 0);
/* Setup of key input pin */
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX25_PAD_KPP_ROW0__GPIO_2_29, 0));
gpio_direction_input(IMX_GPIO_NR(2, 29));
/* Setup of status LED outputs */
imx_iomux_v3_setup_multiple_pads(led_pads, ARRAY_SIZE(led_pads));
/* Switch both LEDs off */
gpio_direction_output(IMX_GPIO_NR(4, 21), 0);
gpio_direction_output(IMX_GPIO_NR(1, 29), 0);
/* Setup of CAN1 and CAN2 signals */
imx_iomux_v3_setup_multiple_pads(can_pads, ARRAY_SIZE(can_pads));
/* Setup of I2C3 signals */
imx_iomux_v3_setup_multiple_pads(i2c3_pads, ARRAY_SIZE(i2c3_pads));
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
return 0;
}
int board_late_init(void)
{
const char *e;
#ifdef CONFIG_FEC_MXC
/*
* FIXME: need to revisit this
* The original code enabled PUE and 100-k pull-down without PKE, so the right
* value here is likely:
* 0 for no pull
* or:
* PAD_CTL_PUS_100K_DOWN for 100-k pull-down
*/
#define FEC_OUT_PAD_CTRL 0
static const iomux_v3_cfg_t fec_pads[] = {
MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
MX25_PAD_FEC_RX_DV__FEC_RX_DV,
MX25_PAD_FEC_RDATA0__FEC_RDATA0,
NEW_PAD_CTRL(MX25_PAD_FEC_TDATA0__FEC_TDATA0, FEC_OUT_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_FEC_TX_EN__FEC_TX_EN, FEC_OUT_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_FEC_MDC__FEC_MDC, FEC_OUT_PAD_CTRL),
MX25_PAD_FEC_MDIO__FEC_MDIO,
MX25_PAD_FEC_RDATA1__FEC_RDATA1,
NEW_PAD_CTRL(MX25_PAD_FEC_TDATA1__FEC_TDATA1, FEC_OUT_PAD_CTRL),
MX25_PAD_UPLL_BYPCLK__GPIO_3_16, /* LAN-RESET */
MX25_PAD_UART2_CTS__FEC_RX_ER, /* FEC_RX_ERR */
};
imx_iomux_v3_setup_multiple_pads(fec_pads, ARRAY_SIZE(fec_pads));
/* assert PHY reset (low) */
gpio_direction_output(IMX_GPIO_NR(3, 16), 0);
udelay(5000);
/* deassert PHY reset */
gpio_set_value(IMX_GPIO_NR(3, 16), 1);
udelay(5000);
#endif
e = env_get("gs_base_board");
if (e != NULL) {
if (strcmp(e, "G283") == 0) {
int key = gpio_get_value(IMX_GPIO_NR(2, 29));
if (key) {
/* Switch on both LEDs to inidcate boot mode */
gpio_set_value(IMX_GPIO_NR(1, 29), 0);
gpio_set_value(IMX_GPIO_NR(4, 21), 0);
env_set("preboot", "run gs_slow_boot");
} else
env_set("preboot", "run gs_fast_boot");
}
}
return 0;
}
int dram_init(void)
{
/* dram_init must store complete ramsize in gd->ram_size */
gd->ram_size = get_ram_size((void *)PHYS_SDRAM,
PHYS_SDRAM_SIZE);
return 0;
}
|
#include "emu.h"
#include "includes/timelimt.h"
/***************************************************************************
Convert the color PROMs into a more useable format.
Time Limit has two 32 bytes palette PROM, connected to the RGB output this
way:
bit 7 -- 220 ohm resistor -- BLUE
-- 470 ohm resistor -- BLUE
-- 220 ohm resistor -- GREEN
-- 470 ohm resistor -- GREEN
-- 1 kohm resistor -- GREEN
-- 220 ohm resistor -- RED
-- 470 ohm resistor -- RED
bit 0 -- 1 kohm resistor -- RED
***************************************************************************/
PALETTE_INIT( timelimt ) {
int i;
for (i = 0;i < machine.total_colors();i++)
{
int bit0,bit1,bit2,r,g,b;
/* red component */
bit0 = (*color_prom >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
bit0 = (*color_prom >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = (*color_prom >> 6) & 0x01;
bit1 = (*color_prom >> 7) & 0x01;
b = 0x4f * bit0 + 0xa8 * bit1;
palette_set_color(machine,i,MAKE_RGB(r,g,b));
color_prom++;
}
}
/***************************************************************************
Start the video hardware emulation.
***************************************************************************/
static TILE_GET_INFO( get_bg_tile_info )
{
timelimt_state *state = machine.driver_data<timelimt_state>();
SET_TILE_INFO(1, state->m_bg_videoram[tile_index], 0, 0);
}
static TILE_GET_INFO( get_fg_tile_info )
{
timelimt_state *state = machine.driver_data<timelimt_state>();
UINT8 *videoram = state->m_videoram;
SET_TILE_INFO(0, videoram[tile_index], 0, 0);
}
VIDEO_START( timelimt )
{
timelimt_state *state = machine.driver_data<timelimt_state>();
state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
8, 8, 64, 32);
state->m_fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,
8, 8, 32, 32);
tilemap_set_transparent_pen(state->m_fg_tilemap, 0);
}
/***************************************************************************/
WRITE8_HANDLER( timelimt_videoram_w )
{
timelimt_state *state = space->machine().driver_data<timelimt_state>();
UINT8 *videoram = state->m_videoram;
videoram[offset] = data;
tilemap_mark_tile_dirty(state->m_fg_tilemap, offset);
}
WRITE8_HANDLER( timelimt_bg_videoram_w )
{
timelimt_state *state = space->machine().driver_data<timelimt_state>();
state->m_bg_videoram[offset] = data;
tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
}
WRITE8_HANDLER( timelimt_scroll_x_lsb_w )
{
timelimt_state *state = space->machine().driver_data<timelimt_state>();
state->m_scrollx &= 0x100;
state->m_scrollx |= data & 0xff;
}
WRITE8_HANDLER( timelimt_scroll_x_msb_w )
{
timelimt_state *state = space->machine().driver_data<timelimt_state>();
state->m_scrollx &= 0xff;
state->m_scrollx |= ( data & 1 ) << 8;
}
WRITE8_HANDLER( timelimt_scroll_y_w )
{
timelimt_state *state = space->machine().driver_data<timelimt_state>();
state->m_scrolly = data;
}
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
{
timelimt_state *state = machine.driver_data<timelimt_state>();
UINT8 *spriteram = state->m_spriteram;
int offs;
for( offs = state->m_spriteram_size; offs >= 0; offs -= 4 )
{
int sy = 240 - spriteram[offs];
int sx = spriteram[offs+3];
int code = spriteram[offs+1] & 0x3f;
int attr = spriteram[offs+2];
int flipy = spriteram[offs+1] & 0x80;
int flipx = spriteram[offs+1] & 0x40;
code += ( attr & 0x80 ) ? 0x40 : 0x00;
code += ( attr & 0x40 ) ? 0x80 : 0x00;
drawgfx_transpen( bitmap, cliprect,machine.gfx[2],
code,
attr & 7,
flipx,flipy,
sx,sy,0);
}
}
SCREEN_UPDATE( timelimt )
{
timelimt_state *state = screen->machine().driver_data<timelimt_state>();
tilemap_set_scrollx(state->m_bg_tilemap, 0, state->m_scrollx);
tilemap_set_scrolly(state->m_bg_tilemap, 0, state->m_scrolly);
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
draw_sprites(screen->machine(), bitmap, cliprect);
tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
return 0;
}
|
/* $Revision: 1.1.1.1 $
**
*/
/*#include "configdata.h"*/
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/ioctl.h>
#include "clibrary.h"
#ifndef CLX_IOCTL
# define CLX_IOCTL
#endif
#ifndef CLX_FCNTL
# define CLX_FCNTL
#endif
#if defined(CLX_IOCTL) && !defined(IRIX)
#ifdef __linux
# include <termios.h>
#else
# include <sgtty.h>
#endif
/*
** Mark a file close-on-exec so that it doesn't get shared with our
** children. Ignore any error codes.
*/
void
closeOnExec(fd, flag)
int fd;
int flag;
{
int oerrno;
oerrno = errno;
(void)ioctl(fd, flag ? FIOCLEX : FIONCLEX, (char *)NULL);
errno = oerrno;
}
#endif /* defined(CLX_IOCTL) */
#if defined(CLX_FCNTL)
#include <fcntl.h>
/*
** Mark a file close-on-exec so that it doesn't get shared with our
** children. Ignore any error codes.
*/
void
CloseOnExec(fd, flag)
int fd;
int flag;
{
int oerrno;
oerrno = errno;
(void)fcntl(fd, F_SETFD, flag ? 1 : 0);
errno = oerrno;
}
#endif /* defined(CLX_FCNTL) */
|
#ifndef DATASET_H
#define DATASET_H
#include <MRICommon.h>
#include <LabeledResults.h>
class Config_MriCommon
{
public :
Config_MriCommon()
{
this->totran=0;
this->tosag = 0;
this->tocor = 0;
}
int id;
MRICommon * imageset;
int totran;
int tocor;
int tosag;
QString FilePath;
};
class Config_Labeledcartilage
{
public:
Config_Labeledcartilage()
{
this->id =0;
}
int id;
LabeledResults * results;
QString PCLpath;
QString VTK;
};
class Dataset
{
public:
Dataset();
bool load(QString filepath);
bool Savetofile(QString save);
vector<Config_Labeledcartilage *> * Labels;
vector<Config_MriCommon *> * Imagesets;
QString destinationpath;
};
#endif // DATASET_H
|
/*----------- defined in vidhrdw/gcpinbal.c -----------*/
VIDEO_START( gcpinbal );
VIDEO_UPDATE( gcpinbal );
READ16_HANDLER ( gcpinbal_tilemaps_word_r );
WRITE16_HANDLER( gcpinbal_tilemaps_word_w );
extern UINT16 *gcpinbal_tilemapram;
extern UINT16 *gcpinbal_ioc_ram;
|
/* $Id: memcmp_alias.c $ */
/** @file
* IPRT - No-CRT memcmp() alias for gcc.
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <iprt/nocrt/string.h>
#undef memcmp
#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
# ifndef __MINGW32__
# pragma weak memcmp
# endif
/* No alias support here (yet in the ming case). */
extern int (memcmp)(const void *pv1, const void *pv2, size_t cb)
{
return RT_NOCRT(memcmp)(pv1, pv2, cb);
}
#elif __GNUC__ >= 4
/* create a weak alias. */
__asm__(".weak memcmp\t\n"
" .set memcmp," RT_NOCRT_STR(memcmp) "\t\n");
#else
/* create a weak alias. */
extern __typeof(RT_NOCRT(memcmp)) memcmp __attribute__((weak, alias(RT_NOCRT_STR(memcmp))));
#endif
|
#pragma once
#include "common/common_pch.h"
#include <QStringList>
namespace mtx { namespace gui { namespace Util {
class FileTypeFilter {
public:
static QStringList const & get();
public:
static QStringList s_filter;
};
}}}
|
/***************************************************************************
* Copyright (C) 2011 by corwin @ *
* http://niftools.sourceforge.net/forum/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include "nif_reader2.h"
typedef void (*actn)(char *fname);
static void
pathwalk (char *folder, actn onFile)
{
struct stat dirinfo;
struct stat finfo;
struct dirent *file;
DIR *directory;
char path[MAXPATHLEN];
if (lstat (folder, &dirinfo) < 0) {
perror (folder);
return;
}
if (!S_ISDIR (dirinfo.st_mode))
return;
if ((directory = opendir (folder)) == NULL) {
perror (folder);
return;
}
while ((file = readdir (directory)) != NULL) {
sprintf (path, "%s/%s", folder, file->d_name);
if (lstat (path, &finfo) < 0) {
perror (path);
continue;
}
if (S_ISDIR (finfo.st_mode)) {
int pl = strlen (path);
if (pl > 1) {
if (path[pl-1] == '.' && path[pl-2] == '.')
continue;
if (path[pl-1] == '.')
continue;
}
pathwalk (path, onFile);
}
else {
if (onFile)
onFile (path);
}
}
closedir (directory);
}
static void DoReadNif(char *fname);
static int nifcnt = 0;
// Returns (b - a) in microseconds
long
time_interval(struct timeval *a, struct timeval *b)
{
return ( (b->tv_sec - a->tv_sec) * 1000000 ) + (b->tv_usec - a->tv_usec);
}
static long long total_bytes = 0;
static int total_blocks = 0;
static int total_niobjects = 0;
static int total_malloc_calls = 0;
static int total_reallocs = 0;
int
main(int argc, char **argv)
{
struct timeval tstart, tstop;
/*if (argc == 2)
return !readnif (argv[1]);*/
/*gettimeofday (&tstart, NULL);
int r = readnif ("");
gettimeofday (&tstop, NULL);
long ttaken = time_interval (&tstart, &tstop);
printf ("time %.2f milliseconds \n", ttaken/1000.0f);
return !r;*/
char *dir = ".";
gettimeofday (&tstart, NULL);
pathwalk (dir, DoReadNif);
gettimeofday (&tstop, NULL);
long ttaken = time_interval (&tstart, &tstop) / (1000*1000);
printf ("files done: %d (%ld file(s) per second)\n",
nifcnt, nifcnt / (ttaken ? ttaken : 1));
printf ("time taken: %ld %.2ld:%.2ld\n",
ttaken, ttaken / 60, ttaken % 60);
printf ("total byte(s) read: %lld\n", total_bytes);
printf ("major niff block(s) parsed: %d\n", total_blocks);
printf ("niff object(s) parsed: %d\n", total_niobjects);
printf ("malloc call(s): %d\n", total_malloc_calls);
printf ("realloc(s): %d\n", total_reallocs);
printf ("byte(s)/second: %lld\n",
(total_bytes/(ttaken ? ttaken : 1)));
return 0;
}
/*static void
simple_read(char *fname)
{
FILE *fh = fopen (fname, "r");
const int bufsize = 1*1024*1024;
byte buf[bufsize];
int r;
while ((r = fread (buf, 1, bufsize, fh)));
fclose (fh);
}*/
static void
DoReadNif(char *fname)
{
int len = strlen (fname);
if (len < 4)
return;
if (fname[len-1] == 'f' || fname[len-1] == 'F')
if (fname[len-2] == 'i' || fname[len-2] == 'I')
if (fname[len-3] == 'n' || fname[len-3] == 'N')
if (fname[len-4] == '.') {
//simple_read (fname);
if (!readnif (fname)) {
printf ("files ok %d\n", nifcnt);
exit (1);
} else {
total_bytes += NIFF_FSIZE;
total_blocks += NIFF_BLOCK_COUNT;
total_niobjects += NIFF_OBJECT_COUNT;
total_malloc_calls += NIFF_MALLOCS;
total_reallocs += NIFF_REALLOCS;
}
nifcnt++;
printf ("%5d\r", nifcnt); fflush (stdout);
}
}
|
/***************************************************************************
qgsgpsconnection.h - description
-------------------
begin : November 30th, 2009
copyright : (C) 2009 by Marco Hugentobler
email : marco at hugis dot 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. *
* *
***************************************************************************/
#ifndef QGSGPSCONNECTION_H
#define QGSGPSCONNECTION_H
#include <QDateTime>
#include "qgis.h"
#include <QObject>
#include <QString>
#include "qgis_core.h"
class QIODevice;
struct CORE_EXPORT QgsSatelliteInfo
{
int id;
bool inUse;
int elevation;
int azimuth;
int signal;
};
struct CORE_EXPORT QgsGPSInformation
{
double latitude;
double longitude;
double elevation;
double speed; //in km/h
double direction;
QList<QgsSatelliteInfo> satellitesInView;
double pdop;
double hdop;
double vdop;
double hacc; //horizontal accuracy in meters
double vacc; //vertical accuracy in meters
QDateTime utcDateTime;
QChar fixMode;
int fixType;
int quality; // from GPGGA
int satellitesUsed; // from GPGGA
QChar status; // from GPRMC A,V
QList<int> satPrn; // list of SVs in use; needed for QgsSatelliteInfo.inUse and other uses
bool satInfoComplete; // based on GPGSV sentences - to be used to determine when to graph signal and satellite position
};
/**
* \ingroup core
* Abstract base class for connection to a GPS device*/
class CORE_EXPORT QgsGPSConnection : public QObject
{
#ifdef SIP_RUN
#include <qgsgpsdconnection.h>
#include <qgsnmeaconnection.h>
#endif
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->inherits( "QgsGpsdConnection" ) )
sipType = sipType_QgsGpsdConnection;
else if ( sipCpp->inherits( "QgsNMEAConnection" ) )
sipType = sipType_QgsNMEAConnection;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT
public:
enum Status
{
NotConnected,
Connected,
DataReceived,
GPSDataReceived
};
/**
* Constructor
\param dev input device for the connection (e.g. serial device). The class takes ownership of the object
*/
QgsGPSConnection( QIODevice *dev SIP_TRANSFER );
virtual ~QgsGPSConnection();
//! Opens connection to device
bool connect();
//! Closes connection to device
bool close();
//! Sets the GPS source. The class takes ownership of the device class
void setSource( QIODevice *source SIP_TRANSFER );
//! Returns the status. Possible state are not connected, connected, data received
Status status() const { return mStatus; }
//! Returns the current gps information (lat, lon, etc.)
QgsGPSInformation currentGPSInformation() const { return mLastGPSInformation; }
signals:
void stateChanged( const QgsGPSInformation &info );
void nmeaSentenceReceived( const QString &substring ); // added to capture 'raw' data
protected:
//! Data source (e.g. serial device, socket, file,...)
QIODevice *mSource = nullptr;
//! Last state of the gps related variables (e.g. position, time, ...)
QgsGPSInformation mLastGPSInformation;
//! Connection status
Status mStatus;
private:
//! Closes and deletes mSource
void cleanupSource();
void clearLastGPSInformation();
protected slots:
//! Parse available data source content
virtual void parseData() = 0;
};
#endif // QGSGPSCONNECTION_H
|
#ifndef LANGUAGEDIALOG_H
#define LANGUAGEDIALOG_H
#include <3rd_party/Widgets/QLightBoxWidget/qlightboxdialog.h>
namespace Ui {
class LanguageDialog;
}
namespace UserInterface
{
/**
* @brief Диалог выбора языка программы
*/
class LanguageDialog : public QLightBoxDialog
{
Q_OBJECT
public:
explicit LanguageDialog(QWidget *parent = 0, int _language = -1);
~LanguageDialog();
/**
* @brief Выбранный язык
*/
int language() const;
private:
/**
* @brief Настроить представление
*/
void initView() override;
/**
* @brief Настроить соединения
*/
void initConnections() override;
private:
/**
* @brief Интерфейс
*/
Ui::LanguageDialog *m_ui;
};
}
#endif // LANGUAGEDIALOG_H
|
/*
* CommonConstructors.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "CObjectClassesHandler.h"
#include "../CTownHandler.h" // for building ID-based filters
#include "MapObjects.h"
class CGObjectInstance;
class CGTownInstance;
class CGHeroInstance;
class CGDwelling;
class CHeroClass;
class CBank;
class CStackBasicDescriptor;
/// Class that is used for objects that do not have dedicated handler
template<class ObjectType>
class CDefaultObjectTypeHandler : public AObjectTypeHandler
{
protected:
ObjectType * createTyped(const ObjectTemplate & tmpl) const
{
auto obj = new ObjectType();
preInitObject(obj);
obj->appearance = tmpl;
return obj;
}
public:
CDefaultObjectTypeHandler(){}
CGObjectInstance * create(const ObjectTemplate & tmpl) const override
{
return createTyped(tmpl);
}
virtual void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override
{
}
virtual std::unique_ptr<IObjectInfo> getObjectInfo(const ObjectTemplate & tmpl) const override
{
return nullptr;
}
};
class CObstacleConstructor : public CDefaultObjectTypeHandler<CGObjectInstance>
{
public:
CObstacleConstructor();
bool isStaticObject() override;
};
class CTownInstanceConstructor : public CDefaultObjectTypeHandler<CGTownInstance>
{
JsonNode filtersJson;
protected:
bool objectFilter(const CGObjectInstance *, const ObjectTemplate &) const override;
void initTypeData(const JsonNode & input) override;
public:
CFaction * faction;
std::map<std::string, LogicalExpression<BuildingID>> filters;
CTownInstanceConstructor();
CGObjectInstance * create(const ObjectTemplate & tmpl) const override;
void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
void afterLoadFinalization() override;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & filtersJson;
h & faction;
h & filters;
h & static_cast<CDefaultObjectTypeHandler<CGTownInstance>&>(*this);
}
};
class CHeroInstanceConstructor : public CDefaultObjectTypeHandler<CGHeroInstance>
{
JsonNode filtersJson;
protected:
bool objectFilter(const CGObjectInstance *, const ObjectTemplate &) const override;
void initTypeData(const JsonNode & input) override;
public:
CHeroClass * heroClass;
std::map<std::string, LogicalExpression<HeroTypeID>> filters;
CHeroInstanceConstructor();
CGObjectInstance * create(const ObjectTemplate & tmpl) const override;
void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
void afterLoadFinalization() override;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & filtersJson;
h & heroClass;
h & filters;
h & static_cast<CDefaultObjectTypeHandler<CGHeroInstance>&>(*this);
}
};
class CDwellingInstanceConstructor : public CDefaultObjectTypeHandler<CGDwelling>
{
std::vector<std::vector<const CCreature *>> availableCreatures;
JsonNode guards;
protected:
bool objectFilter(const CGObjectInstance *, const ObjectTemplate &) const override;
void initTypeData(const JsonNode & input) override;
public:
CDwellingInstanceConstructor();
CGObjectInstance * create(const ObjectTemplate & tmpl) const override;
void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
bool producesCreature(const CCreature * crea) const;
std::vector<const CCreature *> getProducedCreatures() const;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & availableCreatures;
h & guards;
h & static_cast<CDefaultObjectTypeHandler<CGDwelling>&>(*this);
}
};
struct BankConfig
{
BankConfig() { chance = upgradeChance = combatValue = value = 0; };
ui32 value; //overall value of given things
ui32 chance; //chance for this level being chosen
ui32 upgradeChance; //chance for creatures to be in upgraded versions
ui32 combatValue; //how hard are guards of this level
std::vector<CStackBasicDescriptor> guards; //creature ID, amount
Res::ResourceSet resources; //resources given in case of victory
std::vector<CStackBasicDescriptor> creatures; //creatures granted in case of victory (creature ID, amount)
std::vector<ArtifactID> artifacts; //artifacts given in case of victory
std::vector<SpellID> spells; // granted spell(s), for Pyramid
template <typename Handler> void serialize(Handler &h, const int version)
{
h & chance;
h & upgradeChance;
h & guards;
h & combatValue;
h & resources;
h & creatures;
h & artifacts;
h & value;
h & spells;
}
};
typedef std::vector<std::pair<ui8, IObjectInfo::CArmyStructure>> TPossibleGuards;
class DLL_LINKAGE CBankInfo : public IObjectInfo
{
const JsonVector & config;
public:
CBankInfo(const JsonVector & Config);
TPossibleGuards getPossibleGuards() const;
// These functions should try to evaluate minimal possible/max possible guards to give provide information on possible thread to AI
CArmyStructure minGuards() const override;
CArmyStructure maxGuards() const override;
bool givesResources() const override;
bool givesArtifacts() const override;
bool givesCreatures() const override;
bool givesSpells() const override;
};
class CBankInstanceConstructor : public CDefaultObjectTypeHandler<CBank>
{
BankConfig generateConfig(const JsonNode & conf, CRandomGenerator & rng) const;
JsonVector levels;
protected:
void initTypeData(const JsonNode & input) override;
public:
// all banks of this type will be reset N days after clearing,
si32 bankResetDuration;
CBankInstanceConstructor();
CGObjectInstance * create(const ObjectTemplate & tmpl) const override;
void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
std::unique_ptr<IObjectInfo> getObjectInfo(const ObjectTemplate & tmpl) const override;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & levels;
h & bankResetDuration;
h & static_cast<CDefaultObjectTypeHandler<CBank>&>(*this);
}
};
|
// -------------------------------------------------------------------------
// ----- CbmStsStationDigiPar header file -----
// ----- Created 27/06/05 by V. Friese -----
// -------------------------------------------------------------------------
/** CbmStsStationDigiPar.h
*@author V.Friese <v.friese@gsi.de>
**
** Parameter container for the digitisation of a STS strip station.
** Holds and manages an array of CbmStsSectorDigiPar objects.
**/
#ifndef CBMSTSSTATIONDIGIPAR_H
#define CBMSTSSTATIONDIGIPAR_H 1
#include "CbmStsSectorDigiPar.h"
#include "TObjArray.h"
class CbmStsStationDigiPar : public TObject
{
public:
/** Default constructor **/
CbmStsStationDigiPar();
/** Standard constructor
*@param iStation number of station
*@param rotation Rotation w.r.t. global system [degrees]
**/
CbmStsStationDigiPar(Int_t iStation, Double_t rotation);
/** Destructor */
virtual ~CbmStsStationDigiPar();
/** Accessors **/
Int_t GetStationNr() { return fStationNr; }
Double_t GetRotation() { return fRotation; }
Int_t GetNSectors() { return fSectors->GetEntries(); }
TObjArray* GetSectorArray() { return fSectors; }
CbmStsSectorDigiPar* GetSector(Int_t iSector) {
return (CbmStsSectorDigiPar*) fSectors->At(iSector);
}
/** Add parameters of one sector **/
void AddSector(CbmStsSectorDigiPar* sec) { fSectors->Add(sec); }
private:
Int_t fStationNr; // Station identifier
Double_t fRotation; // Rotation angle in global c.s. [rad]
TObjArray* fSectors; // Array of sector parameters
CbmStsStationDigiPar(const CbmStsStationDigiPar&);
CbmStsStationDigiPar operator=(const CbmStsStationDigiPar&);
ClassDef(CbmStsStationDigiPar,1);
};
#endif
|
/*
* include/asm-sh/cpu-sh4/freq.h
*
* Copyright (C) 2002, 2003 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#ifndef __ASM_CPU_SH4_FREQ_H
#define __ASM_CPU_SH4_FREQ_H
#if defined(CONFIG_CPU_SUBTYPE_SH73180)
#define FRQCR 0xa4150000
#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
#define FRQCR 0xffc80000
#else
#define FRQCR 0xffc00000
#endif
#define MIN_DIVISOR_NR 0
#define MAX_DIVISOR_NR 3
#endif /* __ASM_CPU_SH4_FREQ_H */
|
/*
* Author: MontaVista Software, Inc. <source@mvista.com>
*
* 2006 (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(554);
}
module_init(regpatch);
|
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
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.
UFFS 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
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file api_test_server_win32.c
* \brief uffs API test server.
* \author Ricky Zheng
*/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include "api_test.h"
#pragma comment(lib, "Ws2_32.lib")
#define BACKLOGS 10
static int _io_read(int fd, void *buf, int len)
{
return recv((SOCKET)fd, buf, len, 0);
}
static int _io_write(int fd, const void *buf, int len)
{
return send((SOCKET)fd, buf, len, 0);
}
static int _io_close(int fd)
{
closesocket((SOCKET)fd);
return 0;
}
static struct uffs_ApiSrvIoSt m_io = {
NULL, // open
_io_read,
_io_write,
_io_close,
};
static struct uffs_ApiSt m_api = {
uffs_version,
uffs_open,
uffs_close,
uffs_read,
uffs_write,
uffs_flush,
uffs_seek,
uffs_tell,
uffs_eof,
uffs_rename,
uffs_remove,
uffs_ftruncate,
uffs_mkdir,
uffs_rmdir,
uffs_stat,
uffs_lstat,
uffs_fstat,
uffs_opendir,
uffs_closedir,
uffs_readdir,
uffs_rewinddir,
uffs_get_error,
uffs_set_error,
uffs_format,
uffs_space_total,
uffs_space_used,
uffs_space_free,
uffs_flush_all,
};
int api_server_start(void)
{
int iResult;
int ret;
WSADATA wsaData;
SOCKET ListenSocket = INVALID_SOCKET;
SOCKET ClientSocket = INVALID_SOCKET;
struct addrinfo *result = NULL;
struct addrinfo hints;
char port_buf[16];
// Initialize Winsock
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != 0) {
printf("WSAStartup failed: %d\n", iResult);
return -1;
}
ZeroMemory( &hints, sizeof(hints) );
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE;
// Resolve the server address and port
sprintf_s(port_buf, sizeof(port_buf), "%d", SRV_PORT);
iResult = getaddrinfo("0.0.0.0", port_buf, &hints, &result);
if ( iResult != 0 ) {
printf("getaddrinfo failed with error: %d\n", iResult);
ret = -1;
goto ext;
}
// Create a SOCKET for connecting to server
ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
if (ListenSocket == INVALID_SOCKET) {
printf("socket failed with error: %ld\n", WSAGetLastError());
freeaddrinfo(result);
ret = -1;
goto ext;
}
// Setup the TCP listening socket
iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen);
if (iResult == SOCKET_ERROR) {
printf("bind failed with error: %d\n", WSAGetLastError());
freeaddrinfo(result);
closesocket(ListenSocket);
ret = -1;
goto ext;
}
freeaddrinfo(result);
iResult = listen(ListenSocket, SOMAXCONN);
if (iResult == SOCKET_ERROR) {
printf("listen failed with error: %d\n", WSAGetLastError());
closesocket(ListenSocket);
ret = -1;
goto ext;
}
apisrv_setup_io(&m_io);
ret = -1;
do {
// Accept a client socket
ClientSocket = accept(ListenSocket, NULL, NULL);
if (ClientSocket == INVALID_SOCKET) {
printf("accept failed with error: %d\n", WSAGetLastError());
continue;
}
ret = apisrv_serve((int)ClientSocket, &m_api);
closesocket(ClientSocket);
} while (ret >= 0);
ext:
WSACleanup();
return ret;
}
|
#ifndef MANTID_ALGORITHMS_SPECULARREFLECTIONCORRECTTHETA2TEST_H_
#define MANTID_ALGORITHMS_SPECULARREFLECTIONCORRECTTHETA2TEST_H_
#include <cxxtest/TestSuite.h>
#include "SpecularReflectionAlgorithmTest.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
#include "MantidAlgorithms/SpecularReflectionCalculateTheta2.h"
using namespace Mantid::Algorithms;
using namespace Mantid::API;
// clang-format off
class SpecularReflectionCalculateTheta2Test: public CxxTest::TestSuite,
public SpecularReflectionAlgorithmTest
// clang-format on
{
private:
Mantid::API::IAlgorithm_sptr makeAlgorithm() const {
IAlgorithm_sptr alg =
boost::make_shared<SpecularReflectionCalculateTheta2>();
alg->setRethrows(true);
alg->setChild(true);
alg->initialize();
return alg;
}
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static SpecularReflectionCalculateTheta2Test *createSuite() {
return new SpecularReflectionCalculateTheta2Test();
}
static void destroySuite(SpecularReflectionCalculateTheta2Test *suite) {
delete suite;
}
void test_Init() {
SpecularReflectionCalculateTheta2 alg;
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
}
SpecularReflectionCalculateTheta2Test() {}
void test_throws_if_SpectrumNumbersOfDetectors_less_than_zero() {
IAlgorithm_sptr alg = makeAlgorithm();
alg->setProperty(
"InputWorkspace",
WorkspaceCreationHelper::create1DWorkspaceConstant(1, 1, 1, true));
SpecularReflectionAlgorithmTest::
test_throws_if_SpectrumNumbersOfDetectors_less_than_zero(alg);
}
void test_throws_if_SpectrumNumbersOfDetectors_outside_range() {
IAlgorithm_sptr alg = makeAlgorithm();
alg->setProperty(
"InputWorkspace",
WorkspaceCreationHelper::create1DWorkspaceConstant(1, 1, 1, true));
SpecularReflectionAlgorithmTest::
test_throws_if_SpectrumNumbersOfDetectors_outside_range(alg);
}
void test_throws_if_DetectorComponentName_unknown() {
IAlgorithm_sptr alg = makeAlgorithm();
alg->setProperty(
"InputWorkspace",
WorkspaceCreationHelper::create2DWorkspaceWithRectangularInstrument(
1, 1, 1));
SpecularReflectionAlgorithmTest::
test_throws_if_DetectorComponentName_unknown(alg);
}
void test_correct_point_detector_to_current_position() {
auto toConvert = pointDetectorWS;
auto referenceFrame = toConvert->getInstrument()->getReferenceFrame();
auto moveComponentAlg =
AlgorithmManager::Instance().create("MoveInstrumentComponent");
moveComponentAlg->initialize();
moveComponentAlg->setProperty("Workspace", toConvert);
const std::string componentName = "point-detector";
moveComponentAlg->setProperty("ComponentName", componentName);
moveComponentAlg->setProperty("RelativePosition", true);
moveComponentAlg->setProperty(
referenceFrame->pointingUpAxis(),
0.5); // Give the point detector a starting vertical offset.
// Execute the movement.
moveComponentAlg->execute();
VerticalHorizontalOffsetType offsetTuple =
determine_vertical_and_horizontal_offsets(
toConvert); // Offsets before correction
const double sampleToDetectorVerticalOffset = offsetTuple.get<0>();
const double sampleToDetectorBeamOffset = offsetTuple.get<1>();
// Based on the current positions, calculate the current incident theta.
const double currentTwoThetaInRad =
std::atan(sampleToDetectorVerticalOffset / sampleToDetectorBeamOffset);
const double currentTwoThetaInDeg = currentTwoThetaInRad * (180.0 / M_PI);
IAlgorithm_sptr alg = this->makeAlgorithm();
alg->setProperty("InputWorkspace", toConvert);
alg->setProperty("DetectorComponentName", "point-detector");
alg->setProperty("AnalysisMode", "PointDetectorAnalysis");
alg->execute();
const double twoThetaCalculated = alg->getProperty("TwoTheta");
TSM_ASSERT_DELTA("Two theta value should be unchanged", twoThetaCalculated,
currentTwoThetaInDeg, 1e-6);
}
};
#endif /* MANTID_ALGORITHMS_SPECULARREFLECTIONCORRECTTHETA2TEST_H_ */
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_workers_xmlhttprequestupload_h__
#define mozilla_dom_workers_xmlhttprequestupload_h__
#include "nsXMLHttpRequest.h"
BEGIN_WORKERS_NAMESPACE
class XMLHttpRequest;
class XMLHttpRequestUpload MOZ_FINAL : public nsXHREventTarget
{
nsRefPtr<XMLHttpRequest> mXHR;
XMLHttpRequestUpload(XMLHttpRequest* aXHR);
~XMLHttpRequestUpload();
public:
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
static already_AddRefed<XMLHttpRequestUpload>
Create(XMLHttpRequest* aXHR);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestUpload, nsXHREventTarget)
NS_DECL_ISUPPORTS_INHERITED
nsISupports*
GetParentObject() const
{
// There's only one global on a worker, so we don't need to specify.
return nullptr;
}
bool
HasListeners()
{
return mListenerManager && mListenerManager->HasListeners();
}
};
END_WORKERS_NAMESPACE
#endif // mozilla_dom_workers_xmlhttprequestupload_h__
|
/* -*- Mode: C++; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* THIS IS UNPUBLISHED SOURCE CODE OF create3000.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 1999, 2016 Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the Titania Project.
*
* Titania is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* Titania 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 version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with Titania. If not, see <http://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
#ifndef __TITANIA_X3D_COMPONENTS_FOLLOWERS_POSITION_CHASER2D_H__
#define __TITANIA_X3D_COMPONENTS_FOLLOWERS_POSITION_CHASER2D_H__
#include "../Followers/X3DChaserNode.h"
namespace titania {
namespace X3D {
class PositionChaser2D :
public X3DChaserNode
{
public:
PositionChaser2D (X3DExecutionContext* const executionContext);
virtual
X3DBaseNode*
create (X3DExecutionContext* const executionContext) const final override;
/// @name Common members
virtual
const Component &
getComponent () const final override
{ return component; }
virtual
const std::string &
getTypeName () const final override
{ return typeName; }
virtual
const std::string &
getContainerField () const final override
{ return containerField; }
/// @name Fields
SFVec2f &
set_value ()
{ return *fields .set_value; }
const SFVec2f &
set_value () const
{ return *fields .set_value; }
SFVec2f &
set_destination ()
{ return *fields .set_destination; }
const SFVec2f &
set_destination () const
{ return *fields .set_destination; }
SFVec2f &
initialValue ()
{ return *fields .initialValue; }
const SFVec2f &
initialValue () const
{ return *fields .initialValue; }
SFVec2f &
initialDestination ()
{ return *fields .initialDestination; }
const SFVec2f &
initialDestination () const
{ return *fields .initialDestination; }
SFVec2f &
value_changed ()
{ return *fields .value_changed; }
const SFVec2f &
value_changed () const
{ return *fields .value_changed; }
private:
/// @name Construction
virtual
void
initialize () final override;
/// @name Operations
bool
equals (const Vector2f &, const Vector2f &, const float) const;
/// @name Event handlers
void
set_value_ ();
void
set_destination_ ();
void
set_duration ();
virtual
void
prepareEvents () final override;
float
updateBuffer ();
/// @name Static members
static const Component component;
static const std::string typeName;
static const std::string containerField;
/// @name Members
struct Fields
{
Fields ();
SFVec2f* const set_value;
SFVec2f* const set_destination;
SFVec2f* const initialValue;
SFVec2f* const initialDestination;
SFVec2f* const value_changed;
};
Fields fields;
time_type bufferEndTime;
Vector2f previousValue;
std::vector <Vector2f> buffer;
};
} // X3D
} // titania
#endif
|
/**
* Yaafe
*
* Copyright (c) 2009-2010 Institut Télécom - Télécom Paristech
* Télécom ParisTech / dept. TSI
*
* Author : Jacques Prado, Benoit Mathieu
*
* This file is part of Yaafe.
*
* Yaafe 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.
*
* Yaafe 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 FFT_H_
#define FFT_H_
#include "yaafe-core/ComponentHelpers.h"
#include <Eigen/Dense>
#ifdef WITH_FFTW3
#include <fftw3.h>
#else
#include <unsupported/Eigen/FFT>
#endif
#define FFT_ID "FFT"
namespace YAAFE
{
class FFT: public YAAFE::StateLessOneInOneOutComponent<FFT>
{
public:
FFT();
virtual ~FFT();
const std::string getIdentifier() const { return FFT_ID; };
virtual ParameterDescriptorList getParameterDescriptorList() const;
StreamInfo init(const ParameterMap& params, const StreamInfo& in);
void processToken(double* inData, const int inSize, double* out, const int outSize);
private:
Eigen::VectorXd m_window;
int m_nfft;
#ifdef WITH_FFTW3
fftw_plan m_plan;
#else
Eigen::FFT<double> m_plan;
#endif
};
}
#endif /* FFT_H_ */
|
/* gw-init.c
*
* Copyright (C) 2017 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This file 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 file 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 General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gconstructor.h"
#include "gw-document.h"
#include "gw-extension-points.h"
#include "gw-segmenter.h"
#include "gw-init-dictionaries.h"
#include "gw-init-documents.h"
#include "gw-init-segmenters.h"
#include <gio/gio.h>
static void
init_dictionaries (void)
{
GIOExtensionPoint *extension_point;
/* Extension point for GwDictionary */
extension_point = g_io_extension_point_register (GW_EXTENSION_POINT_DICTIONARY);
g_io_extension_point_set_required_type (extension_point, GW_TYPE_DICTIONARY);
#define implement_dictionary(T,lang,priority) g_io_extension_point_implement (GW_EXTENSION_POINT_DICTIONARY, T, lang, priority)
implement_dictionary (GW_TYPE_DICTIONARY_FALLBACK, "fallback", 10);
implement_dictionary (GW_TYPE_DICTIONARY_PT_BR, "pt_BR", 10);
#undef implement_document
}
static void
init_documents (void)
{
GIOExtensionPoint *extension_point;
/* Extension point for GwDocument */
extension_point = g_io_extension_point_register (GW_EXTENSION_POINT_DOCUMENT);
g_io_extension_point_set_required_type (extension_point, GW_TYPE_DOCUMENT);
#define implement_document(T,lang,priority) g_io_extension_point_implement (GW_EXTENSION_POINT_DOCUMENT, T, lang, priority)
implement_document (GW_TYPE_DOCUMENT_FALLBACK, "fallback", 10);
#undef implement_document
}
static void
init_segmenters (void)
{
GIOExtensionPoint *extension_point;
/* Extension point for GwSegmenter */
extension_point = g_io_extension_point_register (GW_EXTENSION_POINT_SEGMENTER);
g_io_extension_point_set_required_type (extension_point, GW_TYPE_SEGMENTER);
#define implement_segmenter(T,lang,priority) g_io_extension_point_implement (GW_EXTENSION_POINT_SEGMENTER, T, lang, priority)
implement_segmenter (GW_TYPE_SEGMENTER_FALLBACK, "fallback", 10);
implement_segmenter (GW_TYPE_SEGMENTER_PT_BR, "pt_BR", 10);
#undef implement_segmenter
}
/* Main constructor */
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS (_gw_init)
#endif
G_DEFINE_CONSTRUCTOR (_gw_init)
static void
_gw_init (void)
{
init_dictionaries ();
init_documents ();
init_segmenters ();
}
|
// MediaHandlerHaiku.h: Haiku media kit media handler, for Gnash
//
// Copyright (C) 2007, 2008, 2009, 2010 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, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef GNASH_MEDIAHANDLERHAIKU_H
#define GNASH_MEDIAHANDLERHAIKU_H
#include "MediaHandler.h" // for inheritance
#include <vector>
#include <memory>
namespace gnash {
namespace media {
/// Haiku media kit based media handler module
//
/// The module implements the MediaHandler factory as required
/// by Gnash core for a loadable media handler module.
///
/// It uses the Haiku media kit
///
/// Starting point is MediaHandlerHaiku.
///
namespace haiku {
/// Haiku based MediaHandler
class MediaHandlerHaiku : public MediaHandler
{
public:
virtual std::string description() const {
return "Haiku Media Handler";
}
virtual std::auto_ptr<MediaParser>
createMediaParser(std::auto_ptr<IOChannel> stream);
virtual std::auto_ptr<VideoDecoder>
createVideoDecoder(const VideoInfo& info);
virtual std::auto_ptr<VideoConverter>
createVideoConverter(ImgBuf::Type4CC srcFormat,
ImgBuf::Type4CC dstFormat);
virtual std::auto_ptr<AudioDecoder>
createAudioDecoder(const AudioInfo& info);
// virtual size_t getInputPaddingSize() const;
virtual VideoInput* getVideoInput(size_t index);
virtual AudioInput* getAudioInput(size_t index);
virtual void cameraNames(std::vector<std::string>& names) const;
};
} // gnash.media.haiku namespace
} // gnash.media namespace
} // namespace gnash
#endif
|
/*
* devsCPP - a DEVS C++ library
* Copyright (c) 2013 Ricardo Guido Marelli
*
* 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 DEVS_CPP_REMOTE_SIMULATOR_ACCEPTOR__
#define DEVS_CPP_REMOTE_SIMULATOR_ACCEPTOR__
#include "RemoteMessageInterface.h"
#include "RemoteSimulator.h"
#include "RemoteMessage.h"
#include <memory>
namespace DEVS {
template <class MESSAGE_INTERFACE>
class RemoteSimulatorAcceptor
{
public:
RemoteSimulatorAcceptor() : acceptor_(NULL)
{}
virtual ~RemoteSimulatorAcceptor() {
delete(acceptor_);
}
bool listen(std::string connection_description) {
this->acceptor_ = MESSAGE_INTERFACE().listen(connection_description);
}
void close() {
}
RemoteSimulator<MESSAGE_INTERFACE>* accept() {
if( this->acceptor_ == NULL ) {
Log::write(0,"DEVS::RemoteSimulatorAcceptor", "Error: not listening");
return NULL;
}
MESSAGE_INTERFACE message_interface;
typename MESSAGE_INTERFACE::type_peer* peer = message_interface.accept(acceptor_);
// Receive a connection message
std::auto_ptr<RemoteMessage> connect_req( message_interface.recv( peer ) );
if( !connect_req.get() ) {
return NULL;
}
std::string name( connect_req->payload() );
Buffer properties;
if( name.size() < connect_req->payload_size() -1 ) {
properties.putContent( connect_req->payload()+name.size()+1, connect_req->payload_size() - name.size() - 1 );
}
Log::write(0,"DEVS::RemoteSimulatorAcceptor", "Simulator connected. Model name: %s, properties size: %d", name.c_str(), properties.size());
// Send the reply message */
RemoteMessage connect_rep( RemoteMessage::TYPE_CONNECTION_REPLY, 0, NULL );
message_interface.send( peer, connect_rep );
return new RemoteSimulator<MESSAGE_INTERFACE>( name, connect_req->nextTN(), peer, properties );
}
private:
typename MESSAGE_INTERFACE::type_acceptor *acceptor_;
}; // RemoteSimulatorAcceptor
}; // DEVS
#endif
|
#ifndef _calga5_h_
#define _calga5_h_
#include <math.h>
#include <errno.h>
template <class F>
double calg5a(F f,double x1,double x2,int ile=20)
{
if(ile==1)
{
static double const a=0.53846931010568309105; //sqrt(245-14*sqrt(70))/21
static double const b=0.90617984593866399282; //sqrt(245+14*sqrt(70))/21
static double const f0=128.0/225;
static double const fb=(1.0/3 -a*a*(1-f0/2))/(b*b-a*a); // 0.23692689
static double const fa=1-f0/2-fb; // 0.47862867
double h=(x2-x1)/2;
double xs=x1+h;
double y1m=f(xs-h*a);
double y1p=f(xs+h*a);
double y2m=f(xs-h*b);
double y2p=f(xs+h*b);
double ys=f(xs);
return h*(f0*ys+fa*(y1m+y1p)+fb*(y2m+y2p));
}
else
{
double d=(x2-x1)/ile;
double suma=0;
while(ile-->0)
{
suma+=calg5a(f,x1+ile*d,x1+(ile+1)*d,1);
}
return suma;
}
}
template <class F>
double calg20(F f,double x1,double x2, int n=3)
{
static const double w20[10]={
0.017614007139152118311861962351853,
0.040601429800386941331039952274932,
0.062672048334109063569506535187042,
0.083276741576704748724758143222046,
0.101930119817240435036750135480350,
0.118194531961518417312377377711382,
0.131688638449176626898494499748163,
0.142096109318382051329298325067165,
0.149172986472603746787828737001969,
0.152753387130725850698084331955098
};
static const double g20[10]={
0.993128599185094924786122388471320,
0.963971927277913791267666131197277,
0.912234428251325905867752441203298,
0.839116971822218823394529061701521,
0.746331906460150792614305070355642,
0.636053680726515025452836696226286,
0.510867001950827098004364050955251,
0.373706088715419560672548177024927,
0.227785851141645078080496195368575,
0.076526521133497333754640409398838
};
//if (n>1) return calg20(f,x1,x1+(x2-x1)*(n/2)/n,n/2)+calg20(f,x1+(x2-x1)*(n/2)/n,x2,n-n/2);
double wynik=0;
double A=(x2-x1)/2/n;
for (int i=0;i<n;i++)
{
double B=(x1+x2)/2+(2*i+1-n)*A;
for (int j=0; j<10; j++)
wynik+=(f(B+A*g20[j])+f(B-A*g20[j]))*w20[j];
}
return wynik*A;
}
template <class F>
double calg40(F f,double x0,double x2)
{ double x1=(x0+x2)/2;
return calg20(f,x0,x1)+calg20(f,x1,x2);
}
template <class F>
double calg60(F f,double x0,double x3)
{
double x1=(x0+x0+x3)/3, x2=(x0+x3+x3)/3;
return calg20(f,x0,x1)+calg20(f,x1,x2)+calg20(f,x2,x3);
}
template <class F>
double calg80(F f,double x0,double x4)
{
double x2=(x0+x4)/2,x1=(x0+x2)/2,x3=(x2+x4)/2;
return calg20(f,x0,x1)+calg20(f,x1,x2)+calg20(f,x2,x3)+calg20(f,x3,x4);
}
template <class F>
double calg100(F f,double x1,double x2)
{
return
calg20(f,x1,(x2+4*x1)/5)+
calg20(f,(x2+4*x1)/5,(2*x2+3*x1)/5)+
calg20(f,(3*x1+2*x2)/5,(2*x1+3*x2)/5)+
calg20(f,(2*x1+3*x2)/5,(x1+4*x2)/5)+
calg20(f,(x1+4*x2)/5,x2);
}
#endif
|
// Copyright (c) 2005 - 2015 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots 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.
//
// Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef NOF_WAREHOUSEWORKER_H_
#define NOF_WAREHOUSEWORKER_H_
#include "figures/noFigure.h"
// Enumforwarddeklaration bei VC nutzen
#ifdef _MSC_VER
enum GoodType;
#else
#include "gameData/GameConsts.h"
#endif
class Ware;
class nobBaseWarehouse;
/// Der "Warehouse-Worker" ist ein einfacher(er) Träger, der die Waren aus dem Lagerhaus holt
class nofWarehouseWorker : public noFigure
{
// Mein Lagerhaus, in dem ich arbeite, darf auch mal ein bisschen was an mir ändern
friend class nobBaseWarehouse;
private:
// Die Ware, die er gerade trägt (GD_NOTHING wenn er nix trägt?)
Ware* carried_ware;
// Aufgabe, die der Warenhaustyp hat (Ware raustragen (0) oder reinholen)
const bool task;
// Bin ich fett? (werde immer mal dünn oder fett, damits nicht immer gleich aussieht, wenn jemand rauskommt)
bool fat;
private:
void GoalReached();
void Walked();
/// wenn man beim Arbeitsplatz "kündigen" soll, man das Laufen zum Ziel unterbrechen muss (warum auch immer)
void AbrogateWorkplace();
void HandleDerivedEvent(const unsigned int id);
public:
nofWarehouseWorker(const MapPoint pt, const unsigned char player, Ware* ware, const bool task);
nofWarehouseWorker(SerializedGameData* sgd, const unsigned obj_id);
~nofWarehouseWorker();
/// Aufräummethoden
protected: void Destroy_nofWarehouseWorker();
public: void Destroy() { Destroy_nofWarehouseWorker(); }
/// Serialisierungsfunktionen
protected: void Serialize_nofWarehouseWorker(SerializedGameData* sgd) const;
public: void Serialize(SerializedGameData* sgd) const { Serialize_nofWarehouseWorker(sgd); }
GO_Type GetGOT() const { return GOT_NOF_WAREHOUSEWORKER; }
void Draw(int x, int y);
// Ware nach draußen bringen (von Lagerhaus aus aufgerufen)
void CarryWare(Ware* ware);
/// Mitglied von nem Lagerhaus(Lagerhausarbeiter, die die Träger-Bestände nicht beeinflussen?)
bool MemberOfWarehouse() const { return true; }
};
#endif
|
/*###### Copyright (c) 2015-2019 Ufasoft http://ufasoft.com mailto:support@ufasoft.com, Sergey Pavlov mailto:dev@ufasoft.com ####
# #
# See LICENSE for licensing information #
#####################################################################################################################################*/
#pragma once
namespace Coin {
enum class CoinErr {
InvalidAddress = 1
, InsufficientAmount
, MoneyOutOfRange
, VerifySignatureFailed
, AlertVerifySignatureFailed
, RejectedByCheckpoint
, ValueInLessThanValueOut
, TxFeeIsLow
, TxRejectedByRateLimiter
, TxTooLong
, TxTooManySigOps
, InconsistentDatabase
, SubsidyIsVeryBig
, ContainsNonFinalTx
, BadWitnessNonceSize
, BadWitnessMerkleMatch
, UnexpectedWitness
, IncorrectProofOfWork
, ProofOfWorkFailed
, TooEarlyTimestamp
, BlockTimestampInTheFuture
, Misbehaving
, OrphanedChain
, TxNotFound
, DupNonSpentTx
, FirstTxIsNotTheOnlyCoinbase
, RescanIsDisabledDuringInitialDownload
, BlockDoesNotHaveOurChainId
, MerkleRootMismatch
, VeryBigPayload
, RecipientAlreadyPresents
, XmlFileNotFound
, NoCurrencyWithThisName
, CheckpointVerifySignatureFailed
, BadBlockSignature
, BadBlockVersion
, BadBlockWeight
, CoinbaseTimestampIsTooEarly
, CoinstakeInWrongPos
, TimestampViolation
, CoinsAreTooRecent
, CoinstakeCheckTargetFailed
, StakeRewardExceeded
, TxOutBelowMinimum
, SizeLimits
, BlockNotFound
, AllowedErrorDuringInitialDownload
, UNAUTHORIZED_WORKER
, CURRENCY_NOT_SUPPORTED
, DupTxInputs
, DupVersionMessage
, InputsAlreadySpent
, RejectedV1Block
, BlockHeightMismatchInCoinbase
, InvalidBootstrapFile
, TxAmountTooSmall
, FirstTxIsNotCoinbase
, BadCbLength
, BadTxnsPrevoutNull
, BadTxnsVinEmpty
, BadTxnsVoutEmpty
, BadTxnsVoutNegative
, BadPrevBlock
, InvalidPrivateKey
, VersionMessageMustBeFirst
, GetBlocksLocatorSize
, NonStandardTx
, TxMissingInputs
, TxPrematureSpend
, TxOrdering
, CannotReorganizeBeyondPrunedBlocks
, NonCanonicalCompactSize
, SCRIPT_ERR_UNKNOWN_ERROR = 501
, SCRIPT_ERR_EVAL_FALSE
, SCRIPT_ERR_OP_RETURN
, SCRIPT_ERR_SCRIPT_SIZE
, SCRIPT_ERR_PUSH_SIZE
, SCRIPT_ERR_OP_COUNT
, SCRIPT_ERR_STACK_SIZE
, SCRIPT_ERR_SIG_COUNT
, SCRIPT_ERR_PUBKEY_COUNT
, SCRIPT_ERR_VERIFY
, SCRIPT_ERR_EQUALVERIFY
, SCRIPT_ERR_CHECKMULTISIGVERIFY
, SCRIPT_ERR_CHECKSIGVERIFY
, SCRIPT_ERR_NUMEQUALVERIFY
, SCRIPT_ERR_BAD_OPCODE
, SCRIPT_ERR_DISABLED_OPCODE
, SCRIPT_ERR_INVALID_STACK_OPERATION
, SCRIPT_ERR_INVALID_ALTSTACK_OPERATION
, SCRIPT_ERR_UNBALANCED_CONDITIONAL
, SCRIPT_ERR_NEGATIVE_LOCKTIME
, SCRIPT_ERR_UNSATISFIED_LOCKTIME
, SCRIPT_ERR_SIG_HASHTYPE
, SCRIPT_ERR_SIG_DER
, SCRIPT_ERR_MINIMALDATA
, SCRIPT_ERR_SIG_PUSHONLY
, SCRIPT_ERR_SIG_HIGH_S
, SCRIPT_ERR_SIG_NULLDUMMY
, SCRIPT_ERR_PUBKEYTYPE
, SCRIPT_ERR_CLEANSTACK
, SCRIPT_ERR_MINIMALIF
, SCRIPT_ERR_SIG_NULLFAIL
, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS
, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM
, SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH
, SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY
, SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH
, SCRIPT_ERR_WITNESS_MALLEATED
, SCRIPT_ERR_WITNESS_MALLEATED_P2SH
, SCRIPT_ERR_WITNESS_UNEXPECTED
, SCRIPT_ERR_WITNESS_PUBKEYTYPE
, SCRIPT_ERR_OP_CODESEPARATOR
, SCRIPT_ERR_SIG_FINDANDDELETE
, SCRIPT_DISABLED_OPCODE
, SCRIPT_RANGE
, SCRIPT_INVALID_ARG
, RPC_MISC_ERROR = 1001
, RPC_FORBIDDEN_BY_SAFE_MODE
, RPC_TYPE_ERROR
, RPC_WALLET_ERROR
, RPC_INVALID_ADDRESS_OR_KEY
, RPC_WALLET_INSUFFICIENT_FUNDS
, RPC_OUT_OF_MEMORY
, RPC_INVALID_PARAMETER
, RPC_CLIENT_NOT_CONNECTED
, RPC_CLIENT_IN_INITIAL_DOWNLOAD
, RPC_WALLET_INVALID_ACCOUNT_NAME
, RPC_WALLET_KEYPOOL_RAN_OUT
, RPC_WALLET_UNLOCK_NEEDED
, RPC_WALLET_PASSPHRASE_INCORRECT
, RPC_WALLET_WRONG_ENC_STATE
, RPC_WALLET_ENCRYPTION_FAILED
, RPC_WALLET_ALREADY_UNLOCKED
, RPC_DATABASE_ERROR = 1020
, RPC_DESERIALIZATION_ERROR = 1022
, AUXPOW_ParentHashOurChainId = 2000
, AUXPOW_ChainMerkleBranchTooLong
, AUXPOW_MerkleRootIncorrect
, AUXPOW_MissingMerkleRootInParentCoinbase
, AUXPOW_MutipleMergedMiningHeades
, AUXPOW_MergedMinignHeaderiNotJustBeforeMerkleRoot
, AUXPOW_MerkleRootMustStartInFirstFewBytes
, AUXPOW_MerkleBranchSizeIncorrect
, AUXPOW_WrongIndex
, AUXPOW_NotAllowed
, NAME_InvalidTx = 3000
, NAME_NameCoinTransactionWithInvalidVersion
, NAME_NewPointsPrevious
, NAME_ToolLongName
, NAME_ExpirationError
, MINER_BAD_CB_FLAG = 4000
, MINER_BAD_CB_LENGTH
, MINER_BAD_CB_PREFIX
, MINER_BAD_DIFFBITS
, MINER_BAD_PREVBLK
, MINER_BAD_TXNMRKLROOT
, MINER_BAD_TXNS
, MINER_BAD_VERSION
, MINER_DUPLICATE
, MINER_HIGH_HASH
, MINER_REJECTED
, MINER_STALE_PREVBLK
, MINER_STALE_WORK
, MINER_TIME_INVALID
, MINER_TIME_TOO_NEW
, MINER_TIME_TOO_OLD
, MINER_UNKNOWN_USER
, MINER_UNKNOWN_WORK
, MINER_FPGA_PROTOCOL
};
const error_category& coin_category();
inline error_code make_error_code(CoinErr v) { return error_code(int(v), coin_category()); }
inline error_condition make_error_condition(CoinErr v) { return error_condition(int(v), coin_category()); }
int SubmitRejectionCode(RCString rej);
} // Coin::
namespace std { template<> struct std::is_error_code_enum<Coin::CoinErr> : true_type {}; }
|
#ifndef _ADDRINFO_H
#define _ADDRINFO_H
#include "_global.h"
//ranges
typedef std::pair<uint, uint> Range;
typedef std::pair<uint, Range> ModuleRange; //modhash + RVA range
typedef std::pair<int, ModuleRange> DepthModuleRange; //depth + modulerange
struct RangeCompare
{
bool operator()(const Range & a, const Range & b) //a before b?
{
return a.second < b.first;
}
};
struct OverlappingRangeCompare
{
bool operator()(const Range & a, const Range & b) //a before b?
{
return a.second < b.first || a.second < b.second;
}
};
struct ModuleRangeCompare
{
bool operator()(const ModuleRange & a, const ModuleRange & b)
{
if(a.first < b.first) //module hash is smaller
return true;
if(a.first != b.first) //module hashes are not equal
return false;
return a.second.second < b.second.first; //a.second is before b.second
}
};
struct DepthModuleRangeCompare
{
bool operator()(const DepthModuleRange & a, const DepthModuleRange & b)
{
if(a.first < b.first) //module depth is smaller
return true;
if(a.first != b.first) //module depths are not equal
return false;
if(a.second.first < b.second.first) //module hash is smaller
return true;
if(a.second.first != b.second.first) //module hashes are not equal
return false;
return a.second.second.second < b.second.second.first; //a.second.second is before b.second.second
}
};
//typedefs
typedef void (*EXPORTENUMCALLBACK)(uint base, const char* mod, const char* name, uint addr);
void dbsave();
void dbload();
void dbclose();
bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum);
#endif // _ADDRINFO_H
|
/**** BSIM4.5.0 Released by Xuemei (Jane) Xi 07/29/2005 ****/
/**********
* Copyright 2004 Regents of the University of California. All rights reserved.
* File: b4trunc.c of BSIM4.5.0.
* Author: 2000 Weidong Liu
* Authors: 2001- Xuemei Xi, Mohan Dunga, Ali Niknejad, Chenming Hu.
* Project Director: Prof. Chenming Hu.
**********/
#include "spice.h"
#include <stdio.h>
#include <math.h>
#include "cktdefs.h"
#include "bsim4def.h"
#include "sperror.h"
#include "suffix.h"
int
BSIM4trunc(inModel,ckt,timeStep)
GENmodel *inModel;
register CKTcircuit *ckt;
double *timeStep;
{
register BSIM4model *model = (BSIM4model*)inModel;
register BSIM4instance *here;
#ifdef STEPDEBUG
double debugtemp;
#endif /* STEPDEBUG */
for (; model != NULL; model = model->BSIM4nextModel)
{ for (here = model->BSIM4instances; here != NULL;
here = here->BSIM4nextInstance)
{
#ifdef STEPDEBUG
debugtemp = *timeStep;
#endif /* STEPDEBUG */
CKTterr(here->BSIM4qb,ckt,timeStep);
CKTterr(here->BSIM4qg,ckt,timeStep);
CKTterr(here->BSIM4qd,ckt,timeStep);
if (here->BSIM4trnqsMod)
CKTterr(here->BSIM4qcdump,ckt,timeStep);
if (here->BSIM4rbodyMod)
{ CKTterr(here->BSIM4qbs,ckt,timeStep);
CKTterr(here->BSIM4qbd,ckt,timeStep);
}
if (here->BSIM4rgateMod == 3)
CKTterr(here->BSIM4qgmid,ckt,timeStep);
#ifdef STEPDEBUG
if(debugtemp != *timeStep)
{ printf("device %s reduces step from %g to %g\n",
here->BSIM4name,debugtemp,*timeStep);
}
#endif /* STEPDEBUG */
}
}
return(OK);
}
|
/**
******************************************************************************
* File Name : stm32f4xx_hal_msp.c
* Description : This file provides code for the MSP Initialization
* and de-Initialization codes.
******************************************************************************
** This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.
*
* COPYRIGHT(c) 2017 STMicroelectronics
*
* 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
extern void _Error_Handler(char *, int);
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/**
* Initializes the Global MSP.
*/
void HAL_MspInit(void)
{
/* USER CODE BEGIN MspInit 0 */
/* USER CODE END MspInit 0 */
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
/* System interrupt init*/
/* MemoryManagement_IRQn interrupt configuration */
HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
/* BusFault_IRQn interrupt configuration */
HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
/* UsageFault_IRQn interrupt configuration */
HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
/* SVCall_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
/* DebugMonitor_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
/* PendSV_IRQn interrupt configuration */
HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
/* USER CODE BEGIN MspInit 1 */
/* USER CODE END MspInit 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
#ifndef Move_ShrinkExpandScale_H
#define Move_ShrinkExpandScale_H
#include "RlMove.h"
#include "TypedDagNode.h"
#include <ostream>
#include <string>
namespace RevLanguage {
/**
* @brief Rev Wrapper of a scaling move on all elements of a real valued vector.
*
* This class is the RevLanguage wrapper of ShrinkExpandScale.
*
* @author The RevBayes Development Core Team (Sebastian Hoehna)
* @copyright GPL version 3
* @since 2016-08-31, version 1.0
*/
class Move_ShrinkExpandScale : public Move {
public:
Move_ShrinkExpandScale(void); //!< Default constructor
// Basic utility functions
virtual Move_ShrinkExpandScale* clone(void) const; //!< Clone the object
void constructInternalObject(void); //!< We construct the a new internal move.
static const std::string& getClassType(void); //!< Get Rev type
static const TypeSpec& getClassTypeSpec(void); //!< Get class type spec
std::string getMoveName(void) const; //!< Get the name used for the constructor function in Rev.
const MemberRules& getParameterRules(void) const; //!< Get member rules (const)
virtual const TypeSpec& getTypeSpec(void) const; //!< Get language type of the object
virtual void printValue(std::ostream& o) const; //!< Print value (for user)
protected:
void setConstParameter(const std::string& name, const RevPtr<const RevVariable> &var); //!< Set member variable
RevPtr<const RevVariable> x; //!< The variable holding the real valued vector.
RevPtr<const RevVariable> sd; //!< The variable holding the real valued vector.
RevPtr<const RevVariable> lambda; //!< The variable for the tuning parameter.
RevPtr<const RevVariable> tune; //!< The variable telling if to tune or not.
};
}
#endif
|
#include "profio.c"
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* bprint [ -c | -Idir... | -f | -b | -n ] [ file... ]
* annotate listings of files with prof.out data
*/
static char rcsid2[] = "$Id$";
#define NDIRS (sizeof dirs/sizeof dirs[0] - 1)
#define NELEMS(a) ((int)(sizeof (a)/sizeof ((a)[0])))
char *progname;
int number;
char *dirs[20];
int fcount;
void *alloc(unsigned);
void emitdata(char *);
void printfile(struct file *, int);
void printfuncs(struct file *, int);
void *allocate(unsigned long n, unsigned a) { return alloc(n); }
void *newarray(unsigned long m, unsigned long n, unsigned a) {
return alloc(m*n);
}
int main(int argc, char *argv[]) {
int i;
struct file *p;
void (*f)(struct file *, int) = printfile;
progname = argv[0];
if ((i = process("prof.out")) <= 0) {
fprintf(stderr, "%s: can't %s `%s'\n", progname,
i == 0 ? "open" : "interpret", "prof.out");
exit(1);
}
for (i = 1; i < argc && *argv[i] == '-'; i++)
if (strcmp(argv[i], "-c") == 0) {
emitdata("prof.out");
exit(0);
} else if (strcmp(argv[i], "-b") == 0)
f = printfile;
else if (strcmp(argv[i], "-f") == 0) {
fcount++;
f = printfuncs;
} else if (strcmp(argv[i], "-n") == 0)
number++;
else if (strncmp(argv[i], "-I", 2) == 0) {
int j;
for (j = 0; j < NDIRS && dirs[j]; j++)
;
if (j < NDIRS)
dirs[j] = &argv[i][2];
else
fprintf(stderr, "%s: too many -I options\n", progname);
} else {
fprintf(stderr, "usage: %s [ -c | -b | -n | -f | -Idir... ] [ file... ]\n", progname);
exit(1);
}
for (p = filelist; p; p = p->link)
qsort(p->counts, p->count, sizeof *p->counts, compare);
if (i < argc) {
int nf = i < argc - 1 ? 1 : 0;
for ( ; i < argc; i++, nf ? nf++ : 0)
if (p = findfile(string(argv[i])))
(*f)(p, nf);
else
fprintf(stderr, "%s: no data for `%s'\n", progname, argv[i]);
} else {
int nf = filelist && filelist->link ? 1 : 0;
for (p = filelist; p; p = p->link, nf ? nf++ : 0)
(*f)(p, nf);
}
return 0;
}
/* alloc - allocate n bytes or die */
void *alloc(unsigned n) {
void *new = malloc(n);
assert(new);
return new;
}
/* emitdata - write prof.out data to file */
void emitdata(char *file) {
FILE *fp;
if (fp = fopen(file, "w")) {
struct file *p;
for (p = filelist; p; p = p->link) {
int i;
struct func *q;
struct caller *r;
fprintf(fp, "1\n%s\n", p->name);
for (i = 0, q = p->funcs; q; i++, q = q->link)
if (r = q->callers)
for (i--; r; r = r->link)
i++;
fprintf(fp, "%d\n", i);
for (q = p->funcs; q; q = q->link)
if (q->count.count == 0 || !q->callers)
fprintf(fp, "%s 1 %d %d %d ? ? 0 0\n", q->name, q->count.x,
q->count.y, q->count.count);
else
for (r = q->callers; r; r = r->link)
fprintf(fp, "%s 1 %d %d %d %s %s %d %d\n", q->name, q->count.x,
q->count.y, r->count, r->name, r->file, r->x, r->y);
fprintf(fp, "%d\n", p->count);
for (i = 0; i < p->count; i++)
fprintf(fp, "1 %d %d %d\n", p->counts[i].x,
p->counts[i].y, p->counts[i].count);
}
fclose(fp);
} else
fprintf(stderr, "%s: can't create `%s'\n", progname, file);
}
/* openfile - open name for reading, searching -I directories */
FILE *openfile(char *name) {
int i;
FILE *fp;
if (*name != '/')
for (i = 0; dirs[i]; i++) {
char buf[200];
sprintf(buf, "%s/%s", dirs[i], name);
if (fp = fopen(buf, "r"))
return fp;
}
return fopen(name, "r");
}
/* printfile - print annotated listing for p */
void printfile(struct file *p, int nf) {
int lineno;
FILE *fp;
char *s, buf[512];
struct count *u = p->counts, *r, *uend;
if (u == 0 || p->count <= 0)
return;
uend = &p->counts[p->count];
if ((fp = openfile(p->name)) == NULL) {
fprintf(stderr, "%s: can't open `%s'\n", progname, p->name);
return;
}
if (nf)
printf("%s%s:\n\n", nf == 1 ? "" : "\f", p->name);
for (lineno = 1; fgets(buf, sizeof buf, fp); lineno++) {
if (number)
printf("%d\t", lineno);
while (u < uend && u->y < lineno)
u++;
for (s = buf; *s; ) {
char *t = s + 1;
while (u < uend && u->y == lineno && u->x < s - buf)
u++;
if (isalnum(*s) || *s == '_')
while (isalnum(*t) || *t == '_')
t++;
while (u < uend && u->y == lineno && u->x < t - buf) {
printf("<%d>", u->count);
for (r = u++; u < uend && u->x == r->x && u->y == r->y && u->count == r->count; u++)
;
}
while (s < t)
putchar(*s++);
}
if (*s)
printf("%s", s);
}
fclose(fp);
}
/* printfuncs - summarize data for functions in p */
void printfuncs(struct file *p, int nf) {
struct func *q;
if (nf)
printf("%s:\n", p->name);
for (q = p->funcs; q; q = q->link)
if (fcount <= 1 || q->count.count == 0 || !q->callers)
printf("%d\t%s\n", q->count.count, q->name);
else {
struct caller *r;
for (r = q->callers; r; r = r->link)
printf("%d\t%s\tfrom %s\tin %s:%d.%d\n", r->count, q->name, r->name,
r->file, r->y, r->x + 1);
}
}
/* string - save a copy of str, if necessary */
char *string(const char *str) {
static struct string { struct string *link; char str[1]; } *list;
struct string *p;
for (p = list; p; p = p->link)
if (strcmp(p->str, str) == 0)
return p->str;
p = alloc(strlen(str) + sizeof *p);
strcpy(p->str, str);
p->link = list;
list = p;
return p->str;
}
|
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface _ABBookUndoableCommandAdapter : NSObject
@end
|
/*
* FTGL - OpenGL font library
*
* Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
*
* 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 __TITANIA_FTGL_SIZE_H__
#define __TITANIA_FTGL_SIZE_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#include <cstdint>
namespace titania {
namespace FTGL {
/**
* Size class provides an abstraction layer for the Freetype Size.
*
* @see "Freetype 2 Documentation"
*
*/
class Size
{
public:
/**
* Default Constructor
*/
Size ();
/**
* Destructor
*/
virtual
~Size ();
/**
* Sets the char size for the current face.
*
* This doesn't guarantee that the size was set correctly. Clients
* should check errors. If an error does occur the size object isn't modified.
*
* @param face Parent face for this size object
* @param point_size the face size in points (1/72 inch)
* @param x_resolution the horizontal resolution of the target device.
* @param y_resolution the vertical resolution of the target device.
* @return <code>true</code> if the size has been set. Clients should check Error() for more information if this function returns false()
*/
bool
setCharSize (FT_Face* face, uint32_t point_size,
uint32_t x_resolution, uint32_t y_resolution);
/**
* get the char size for the current face.
*
* @return The char size in points
*/
uint32_t
getCharSize () const;
/**
* Gets the global ascender height for the face in pixels.
*
* @return Ascender height
*/
double
getAscender () const;
/**
* Gets the global descender height for the face in pixels.
*
* @return Ascender height
*/
double
getDescender () const;
/**
* Gets the global face height for the face.
*
* If the face is scalable this returns the height of the global
* bounding box which ensures that any glyph will be less than or
* equal to this height. If the font isn't scalable there is no
* guarantee that glyphs will not be taller than this value.
*
* @return height in pixels.
*/
double
getHeight () const;
/**
* Gets the global face width for the face.
*
* If the face is scalable this returns the width of the global
* bounding box which ensures that any glyph will be less than or
* equal to this width. If the font isn't scalable this value is
* the max_advance for the face.
*
* @return width in pixels.
*/
double
getWidth () const;
/**
* Gets the underline position for the face.
*
* @return underline position in pixels
*/
double
getUnderline () const;
/**
* Queries for errors.
*
* @return The current error code.
*/
FT_Error
getError () const { return error; }
private:
/**
* The current Freetype face that this Size object relates to.
*/
FT_Face* ftFace;
/**
* The Freetype size.
*/
FT_Size ftSize;
/**
* The size in points.
*/
uint32_t size;
/**
* The horizontal resolution.
*/
uint32_t xResolution;
/**
* The vertical resolution.
*/
uint32_t yResolution;
/**
* Current error code. Zero means no error.
*/
FT_Error error;
};
} // FTGL
} // titania
#endif
|
/*
SDbgExt2 - Copyright (C) 2013, Steve Niemitz
SDbgExt2 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.
SDbgExt2 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 SDbgExt2. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "SDbgCoreApi.h"
#include <functional>
template<typename TInterface, typename TFunc>
class CallbackAdaptorBase :
public CComObjectRoot,
public TInterface
{
BEGIN_COM_MAP(CallbackAdaptorBase)
COM_INTERFACE_ENTRY(TInterface)
END_COM_MAP()
public:
HRESULT Init(std::function<BOOL(TFunc)> cb)
{
m_cb = cb;
return S_OK;
}
STDMETHODIMP Callback(TFunc o)
{
return m_cb(o) == TRUE ? S_OK : E_ABORT;
}
ULONG InternalAddRef() { return 1; }
ULONG InternalRelease() { return 1; }
private:
void* operator new(size_t s);
std::function<BOOL(TFunc)> m_cb;
};
typedef CallbackAdaptorBase<IEnumThreadsCallback, ClrThreadData> EnumThreadCallbackAdaptor;
typedef CallbackAdaptorBase<IEnumHeapSegmentsCallback, ClrGcHeapSegmentData> EnumHeapSegmentsCallbackAdaptor;
typedef CallbackAdaptorBase<IEnumFieldsCallback, ClrFieldDescData> EnumFieldsCallbackAdaptor; |
/*********************************************************************
CombLayer : MCNP(X) Input builder
* File: essBuildInc/Wheel.h
*
* Copyright (c) 2004-2015 by Stuart Ansell
*
* 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 essSystem_Wheel_h
#define essSystem_Wheel_h
class Simulation;
namespace essSystem
{
/*!
\class Wheel
\author S. Ansell
\version 1.0
\date October 2012
\brief Specialized for a cylinder object
*/
class Wheel : public WheelBase
{
private:
double xStep; ///< X step
double yStep; ///< y step
double zStep; ///< Z step
double xyAngle; ///< xy angle
double zAngle; ///< zAngle step
double targetHeight; ///< Total height of target
double coolantThickIn; ///< Thickness of coolant (inner wheel)
double coolantThickOut; ///< Thickness of coolant (outer wheel)
double caseThick; ///< Case Thickness
double voidThick; ///< void surrounding thickness
double innerRadius; ///< Inner core
double coolantRadiusIn; ///< Inner coolant radius
double coolantRadiusOut; ///< Outer coolant radius
double caseRadius; ///< Outer case radius
double voidRadius; ///< Final outer radius
double mainTemp; ///< Main temperature
size_t nLayers; ///< number of layers
std::vector<double> radius; ///< cylinder radii
std::vector<int> matTYPE; ///< Material type
double shaftRadius; ///< Main shaft radius
double shaftCoolThick; ///< coolant
double shaftCladThick; ///< cladding
double shaftVoidThick; ///< void
double shaftHeight; ///< Shaft Height (above origin)
int wMat; ///< W material
int heMat; ///< He material
int steelMat; ///< Steel mat
int innerMat; ///< Inner Material block
int mainShaftMat; ///< Main shaft material
int cladShaftMat; ///< Cladding on shaft;
// Functions:
void populate(const FuncDataBase&);
void createUnitVector(const attachSystem::FixedComp&);
void createSurfaces();
void createObjects(Simulation&);
void createLinks();
void makeShaftSurfaces();
void makeShaftObjects(Simulation&);
public:
Wheel(const std::string&);
Wheel(const Wheel&);
Wheel& operator=(const Wheel&);
virtual Wheel* clone() const;
virtual ~Wheel();
/// total wheel void size
virtual double wheelHeight() const
{ return targetHeight+
2.0*(coolantThickIn+caseThick+voidThick); }
// virtual int getCell() const { return mainShaftCell; }
virtual void createAll(Simulation&,const attachSystem::FixedComp&);
};
}
#endif
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsHtml5StringParser_h
#define nsHtml5StringParser_h
#include "nsHtml5AtomTable.h"
#include "nsParserBase.h"
class nsHtml5OplessBuilder;
class nsHtml5TreeBuilder;
class nsHtml5Tokenizer;
class nsIContent;
class nsIDocument;
class nsHtml5StringParser : public nsParserBase
{
public:
NS_DECL_ISUPPORTS
/**
* Constructor for use ONLY by nsContentUtils. Others, please call the
* nsContentUtils statics that wrap this.
*/
nsHtml5StringParser();
virtual ~nsHtml5StringParser();
/**
* Invoke the fragment parsing algorithm (innerHTML).
* DO NOT CALL from outside nsContentUtils.cpp.
*
* @param aSourceBuffer the string being set as innerHTML
* @param aTargetNode the target container
* @param aContextLocalName local name of context node
* @param aContextNamespace namespace of context node
* @param aQuirks true to make <table> not close <p>
* @param aPreventScriptExecution true to prevent scripts from executing;
* don't set to false when parsing into a target node that has been bound
* to tree.
*/
nsresult ParseFragment(const nsAString& aSourceBuffer,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
int32_t aContextNamespace,
bool aQuirks,
bool aPreventScriptExecution);
/**
* Parse an entire HTML document from a source string.
* DO NOT CALL from outside nsContentUtils.cpp.
*
*/
nsresult ParseDocument(const nsAString& aSourceBuffer,
nsIDocument* aTargetDoc,
bool aScriptingEnabledForNoscriptParsing);
private:
nsresult Tokenize(const nsAString& aSourceBuffer,
nsIDocument* aDocument,
bool aScriptingEnabledForNoscriptParsing);
/**
* The tree operation executor
*/
nsRefPtr<nsHtml5OplessBuilder> mBuilder;
/**
* The HTML5 tree builder
*/
const nsAutoPtr<nsHtml5TreeBuilder> mTreeBuilder;
/**
* The HTML5 tokenizer
*/
const nsAutoPtr<nsHtml5Tokenizer> mTokenizer;
/**
* The scoped atom table
*/
nsHtml5AtomTable mAtomTable;
};
#endif // nsHtml5StringParser_h
|
/* Copyright 2013 the SumatraPDF project authors (see AUTHORS file).
License: GPLv3 */
#ifndef ParseCommandLine_h
#define ParseCommandLine_h
#include "DisplayState.h"
class CommandLineInfo {
public:
WStrVec fileNames;
// pathsToBenchmark contain 2 strings per each file to benchmark:
// - name of the file to benchmark
// - optional (NULL if not available) string that represents which pages
// to benchmark. It can also be a string "loadonly" which means we'll
// only benchmark loading of the catalog
WStrVec pathsToBenchmark;
bool makeDefault;
bool exitWhenDone;
bool printDialog;
WCHAR * printerName;
WCHAR * printSettings;
COLORREF bgColor;
WCHAR * inverseSearchCmdLine;
WCHAR * forwardSearchOrigin;
int forwardSearchLine;
ForwardSearch forwardSearch;
bool escToExit;
bool reuseInstance;
char * lang;
WCHAR * destName;
int pageNumber;
bool restrictedUse;
COLORREF textColor;
COLORREF backgroundColor;
bool enterPresentation;
bool enterFullScreen;
DisplayMode startView;
float startZoom;
PointI startScroll;
bool showConsole;
HWND hwndPluginParent;
WCHAR * pluginURL;
bool exitImmediately;
bool silent;
bool cbxMangaMode;
// stress-testing related
WCHAR * stressTestPath;
WCHAR * stressTestFilter; // NULL is equivalent to "*" (i.e. all files)
WCHAR * stressTestRanges;
int stressTestCycles;
int stressParallelCount;
bool stressRandomizeFiles;
bool crashOnOpen;
CommandLineInfo() : makeDefault(false), exitWhenDone(false), printDialog(false),
printerName(NULL), printSettings(NULL), bgColor((COLORREF)-1),
escToExit(false), reuseInstance(false), lang(NULL),
destName(NULL), pageNumber(-1), inverseSearchCmdLine(NULL),
restrictedUse(false), pluginURL(NULL),
enterPresentation(false), enterFullScreen(false), hwndPluginParent(NULL),
startView(DM_AUTOMATIC), startZoom(INVALID_ZOOM), startScroll(PointI(-1, -1)),
showConsole(false), exitImmediately(false), silent(false), cbxMangaMode(false),
forwardSearchOrigin(NULL), forwardSearchLine(0),
stressTestPath(NULL), stressTestFilter(NULL),
stressTestRanges(NULL), stressTestCycles(1), stressParallelCount(1),
stressRandomizeFiles(false),
crashOnOpen(false)
{
textColor = RGB(0, 0, 0); // black
backgroundColor = RGB(0xFF, 0xFF, 0xFF); // white
forwardSearch.highlightOffset = 0;
forwardSearch.highlightWidth = 0;
forwardSearch.highlightColor = (COLORREF)-1;
forwardSearch.highlightPermanent = false;
}
~CommandLineInfo() {
free(printerName);
free(printSettings);
free(inverseSearchCmdLine);
free(forwardSearchOrigin);
free(lang);
free(destName);
free(stressTestPath);
free(stressTestRanges);
free(stressTestFilter);
free(pluginURL);
}
void ParseCommandLine(WCHAR *cmdLine);
};
#endif
|
/*
* C++ Primer
* Chap. 8 Ex. 8.1
* Hao Zhang
* 2016.09.13
* read_and_print.h
*/
#ifndef READ_AND_PRINT_H_
#define READ_AND_PRINT_H_
#include <istream>
using std::istream;
istream &read_and_print(istream &in);
#endif
|
#ifndef __VERSION_H
#define __VERSION_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id: version.h,v 1.91 2004/03/04 09:56:39 bagder Exp $
***************************************************************************/
#include <curl/curl.h>
#define CURL_NAME "curl"
#define CURL_VERSION "7.11.1"
#define CURL_VERSION "7.11.1"
#define CURL_VERSION "7.11.1"
#define CURL_VERSION "7.11.1"
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
#endif
|
/* -*- Mode: C++; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* THIS IS UNPUBLISHED SOURCE CODE OF create3000.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 1999, 2016 Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the Titania Project.
*
* Titania is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* Titania 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 version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with Titania. If not, see <http://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
#ifndef __TITANIA_X3D_BITS_ERROR_H__
#define __TITANIA_X3D_BITS_ERROR_H__
#include "../Bits/X3DConstants.h"
#include <exception>
#include <string>
namespace titania {
namespace X3D {
class X3DError :
public std::exception
{
public:
/// @name Construction
explicit
X3DError (const std::string &);
/// @name Member access
virtual
const char*
what () const noexcept;
virtual
ErrorType
getType () const = 0;
virtual
const std::string &
toString () const;
/// @name Destruction
virtual
~X3DError ();
private:
/// @name Members
const std::string message;
};
/// 5.3.1 Error
template <ErrorType Type>
class Error :
public X3DError
{
public:
/// @name Construction
explicit
Error (const std::string & message) :
X3DError (message)
{ }
/// @name Member access
virtual
ErrorType
getType () const final override
{ return Type; }
/// @name Destruction
virtual
~Error ()
{ }
};
/// @relates X3DError
/// @name Input/Output operations
/// Insertion operator for X3DError.
template <class StringT, class Traits>
inline
std::basic_ostream <typename StringT::value_type, Traits> &
operator << (std::basic_ostream <typename StringT::value_type, Traits> & ostream, const X3DError & error)
{
return ostream << error .what ();
}
} // X3D
} // titania
#endif
|
extern void __VERIFIER_error() __attribute__ ((__noreturn__));
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR: __VERIFIER_error();
}
return;
}
#define a (2)
extern unsigned int __VERIFIER_nondet_uint();
int main() {
int i, j=10, n=__VERIFIER_nondet_uint(), sn=0;
for(i=1; i<=n; i++) {
if (i<j)
sn = sn + a;
j--;
}
__VERIFIER_assert(sn==n*a || sn == 0);
}
|
/*
* Softcam plugin to VDR (C++)
*
* This code 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 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. 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.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#ifndef ___FILTER_H
#define ___FILTER_H
#include <ffdecsawrapper/thread.h>
#include "misc.h"
class cDevice;
class cPidFilter;
// ----------------------------------------------------------------
#define MAX_SECT_SIZE 4096
class cAction : protected cThread {
private:
const char *devId;
int unique, pri;
cSimpleList<cPidFilter> filters;
protected:
cDevice *device;
char *id;
//
virtual void Process(cPidFilter *filter, unsigned char *data, int len)=0;
virtual void Action(void);
virtual cPidFilter *CreateFilter(int Num, int IdleTime);
//
cPidFilter *NewFilter(int IdleTime);
cPidFilter *IdleFilter(void);
void DelFilter(cPidFilter *filter);
void DelAllFilter(void);
void Priority(int Pri);
public:
cAction(const char *Id, cDevice *Device, const char *DevId);
virtual ~cAction();
};
// ----------------------------------------------------------------
class cPidFilter : public cSimpleItem, private cMutex {
friend class cAction;
private:
cDevice *device;
unsigned int idleTime;
cTimeMs lastTime;
bool forceRun;
protected:
char *id;
int fd;
int pid;
public:
void *userData;
//
cPidFilter(const char *Id, int Num, cDevice *Device, unsigned int IdleTime);
virtual ~cPidFilter();
void Flush(void);
virtual void Start(int Pid, int Section, int Mask);
void Stop(void);
void SetBuffSize(int BuffSize);
void Wakeup(void);
int SetIdleTime(unsigned int IdleTime);
int Pid(void);
bool Active(void) { return fd>=0; }
};
#endif //___FILTER_H
|
/*
LAWA - Library for Adaptive Wavelet Applications.
Copyright (C) 2008-2013 Sebastian Kestler, Mario Rometsch, Kristina Steih,
Alexander Stippler.
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 LAWA_FLENSFORLAWA_H
#define LAWA_FLENSFORLAWA_H 1
#include <flens/flens.h>
namespace flens {
// typedef double T;
// typedef flens::GeMatrix<flens::FullStorage<T,cxxblas::ColMajor> > FullColMatrixT;
// typedef flens::DenseVector<flens::Array<T> > DenseVectorT;
extern Underscore<int> _;
} // namespace flens
#endif // LAWA_FLENSFORLAWA_H
|
/****************************************************************************/
/* Trident Multimedia Technologies (Shanghai) Co, LTD */
/* SOFTWARE FILE/MODULE HEADER */
/* Copyright Trident Multimedia Technologies (Shanghai) Co, LTD 2004-200 */
/* All Rights Reserved */
/****************************************************************************/
/*
* Filename: trid_video.h
*
*
* Description: API implementation for COSHIP interface layer .
*
*
* Author: Alfred Chen 2010.11
*
****************************************************************************/
#ifndef _TRID_SCREEN_INCLUDE_H_
#define _TRID_SCREEN_INCLUDE_H_
CNXT_STATUS CS_TM_Screen_Init(void);
#endif
|
/*
Free Download Manager Copyright (c) 2003-2014 FreeDownloadManager.ORG
*/
#if !defined(AFX_FSCOMMANDLINEPARSER_H__83B66E37_1776_4D30_A255_1BC65A140AFD__INCLUDED_)
#define AFX_FSCOMMANDLINEPARSER_H__83B66E37_1776_4D30_A255_1BC65A140AFD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
class fsCommandLineParser
{
public:
BOOL Parse();
int Get_ParameterCount();
LPCSTR Get_Parameter(int iIndex);
LPCSTR Get_ParameterValue (int iIndex);
fsCommandLineParser();
virtual ~fsCommandLineParser();
protected:
struct fsCmdLineParameter
{
string strParam;
string strValue;
};
vector <fsCmdLineParameter> m_vPars;
};
#endif
|
#ifndef SCOPE_H_
# define SCOPE_H_
# include "dict.h"
# include "value.h"
# include "object.h"
# include "class_def.h"
# include "module.h"
/**
* @addtogroup objects
* @{
*
* @defgroup Scope Scope
* @{
*/
extern const wsky_ClassDef wsky_Scope_CLASS_DEF;
/** The Scope class */
extern wsky_Class *wsky_Scope_CLASS;
/**
* Represents the scope of a name binding.
* https://en.wikipedia.org/wiki/Scope_(computer_science)
*/
typedef struct wsky_Scope_s {
wsky_OBJECT_HEAD
/** The parent scope or NULL */
struct wsky_Scope_s *parent;
/** A dictionnary of the variables */
wsky_Dict variables;
/**
* The current class or NULL.
* Don't mix up it with `class`. The class of a scope object is
* always wsky_Scope_CLASS.
*/
wsky_Class *defClass;
/** The current object or NULL */
wsky_Object *self;
/**
* The module if no parent scope, NULL otherwise.
*/
wsky_Module *module;
} wsky_Scope;
/**
* Creates a new Scope.
*/
wsky_Scope *wsky_Scope_new(wsky_Scope *parent, wsky_Class *class,
wsky_Object *self);
/**
* Creates a new root scope.
*
* Its parent is NULL and it contains some builtins.
*
* @param module The module.
*/
wsky_Scope *wsky_Scope_newRoot(wsky_Module *module);
/**
* Deletes a scope.
*/
void wsky_Scope_delete(wsky_Scope *scope);
/**
* Returns `true` if the given value is a Scope.
*/
bool wsky_isScope(wsky_Value value);
/**
* Prints the given scope for debugging purposes.
*/
void wsky_Scope_print(const wsky_Scope *scope);
/**
* Adds a new variable to the scope.
*/
void wsky_Scope_addVariable(wsky_Scope *scope,
const char *name, wsky_Value value);
/**
* Looks for a variable and return its value.
* Calls abort() if the variable is not found.
*/
wsky_Value wsky_Scope_getVariable(wsky_Scope *scope, const char *name);
/**
* Sets the value of a variable.
* Returns true on error (if the variable is undefined)
*/
bool wsky_Scope_setVariable(wsky_Scope *scope,
const char *name, wsky_Value value);
/**
* Returns true if the scope or a parent scope contains a variable of the
* given name.
*/
bool wsky_Scope_containsVariable(const wsky_Scope *scope, const char *name);
/**
* Returns true if the scope contains a variable of the given name.
* Does not search in the parent scopes.
*/
bool wsky_Scope_containsVariableLocally(const wsky_Scope *scope,
const char *name);
/**
* Returns the root scope.
*/
wsky_Scope *wsky_Scope_getRoot(wsky_Scope *scope);
/**
* Returns the module of the file.
*/
wsky_Module *wsky_Scope_getModule(wsky_Scope *scope);
/**
* @}
* @}
*/
#endif /* !SCOPE_H_ */
|
/*** B4SOI 03/06/2009 Wenwei Yang Release ***/
static char rcsid[] = "$Id: b4soirunc.c 03/06/2009 Wenwei Yang Release $";
/**********
* Copyright 2009 Regents of the University of California. All rights reserved.
* Authors: 1998 Samuel Fung, Dennis Sinitsky and Stephen Tang
* Authors: 1999-2004 Pin Su, Hui Wan, Wei Jin, b3soitrunc.c
* Authors: 2005- Hui Wan, Xuemei Xi, Ali Niknejad, Chenming Hu.
* Authors: 2009- Wenwei Yang, Chung-Hsun Lin, Ali Niknejad, Chenming Hu.
* File: b4soitrunc.c
* Modified by Hui Wan, Xuemei Xi 11/30/2005
* Modified by Wenwei Yang, Chung-Hsun Lin, Darsen Lu 03/06/2009
**********/
#include "spice.h"
#include <stdio.h>
#include <math.h>
#include "cktdefs.h"
#include "b4soidef.h"
#include "sperror.h"
#include "suffix.h"
int
B4SOItrunc(inModel,ckt,timeStep)
GENmodel *inModel;
register CKTcircuit *ckt;
double *timeStep;
{
register B4SOImodel *model = (B4SOImodel*)inModel;
register B4SOIinstance *here;
#ifdef STEPDEBUG
double debugtemp;
#endif /* STEPDEBUG */
for (; model != NULL; model = model->B4SOInextModel)
{ for (here = model->B4SOIinstances; here != NULL;
here = here->B4SOInextInstance)
{
#ifdef STEPDEBUG
debugtemp = *timeStep;
#endif /* STEPDEBUG */
CKTterr(here->B4SOIqb,ckt,timeStep);
CKTterr(here->B4SOIqg,ckt,timeStep);
CKTterr(here->B4SOIqd,ckt,timeStep);
#ifdef STEPDEBUG
if(debugtemp != *timeStep)
{ printf("device %s reduces step from %g to %g\n",
here->B4SOIname,debugtemp,*timeStep);
}
#endif /* STEPDEBUG */
}
}
return(OK);
}
|
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef pyVarSyncGame_h
#define pyVarSyncGame_h
/////////////////////////////////////////////////////////////////////////////
//
// NAME: pyVarSyncGame
//
// PURPOSE: Class wrapper for the VarSync game client
//
#include "../../pyGlueHelpers.h"
#include "../pyGameCli.h"
class pyVarSyncGame : public pyGameCli
{
protected:
pyVarSyncGame();
pyVarSyncGame(pfGameCli* client);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptVarSyncGame);
static PyObject* New(pfGameCli* client);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncGame object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncGame); // converts a PyObject to a pyVarSyncGame (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
static bool IsVarSyncGame(std::wstring guid);
static void JoinCommonVarSyncGame(pyKey& callbackKey);
void SetStringVar(unsigned long id, std::wstring val);
void SetNumericVar(unsigned long id, double val);
void RequestAllVars();
void CreateStringVar(std::wstring name, std::wstring val);
void CreateNumericVar(std::wstring name, double val);
};
#endif // pyVarSyncGame_h
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_SVGFEMergeNodeElement_h
#define mozilla_dom_SVGFEMergeNodeElement_h
#include "nsSVGFilters.h"
nsresult NS_NewSVGFEMergeNodeElement(nsIContent** aResult,
already_AddRefed<nsINodeInfo>&& aNodeInfo);
namespace mozilla {
namespace dom {
typedef SVGFEUnstyledElement SVGFEMergeNodeElementBase;
class SVGFEMergeNodeElement : public SVGFEMergeNodeElementBase
{
friend nsresult (::NS_NewSVGFEMergeNodeElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo>&& aNodeInfo));
protected:
SVGFEMergeNodeElement(already_AddRefed<nsINodeInfo>& aNodeInfo)
: SVGFEMergeNodeElementBase(aNodeInfo)
{
}
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
const nsSVGString* GetIn1() { return &mStringAttributes[IN1]; }
// WebIDL
already_AddRefed<SVGAnimatedString> In1();
protected:
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
enum { IN1 };
nsSVGString mStringAttributes[1];
static StringInfo sStringInfo[1];
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGFEMergeNodeElement_h
|
//# GCF_Event.h: finite state machine events
//#
//# Copyright (C) 2002-2003
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@astron.nl
//#
//# 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
//#
//# $Id$
#ifndef GCF_EVENT_H
#define GCF_EVENT_H
#include <assert.h>
#include <sys/types.h>
#include <string>
#ifdef SWIG
%module GCFEvent
%{
#include "GCF_Event.h"
%}
#endif
/**
* This struct is the base event data container to exchange messages between two
* tasks.
* Application tasks will have to define their own protocol by specifying the
* contents of events that are exchanged between tasks. Creating sub class from
* GCFEvent creates application (tasks) specific events. All GCFEvent sub
* classes are generally the same except for the parameters that make the event
* unique. A protocol is a collection of events where each event has a specific
* direction (IN/OUT). To create a new protocol a protocol specification file
* must be created (with extension '.prot'). The autogen utility is then used to
* convert this specification file into a header file containing GCFEvent sub
* class definitions.
* The protocol specification consists of a list of the possible events in the
* protocol each with its own parameters (or no parameters) and with the
* direction in which the event can be sent. The autogen utility is used to
* generate a header file from this definition using a template for the header
* file and the nested key-value pairs from the specification file. This header
* file contains definitions of GCFEvent sub classes, one for each event.
*/
class GCFEvent
{
public:
GCFEvent() :
signal(0), length(0), _unpackDone(false), _buffer(0),
_base(0), _upperbound(0)
{}
GCFEvent(unsigned short sig) :
signal(sig), length(0), _unpackDone(false), _buffer(0),
_base(0), _upperbound(0)
{}
virtual ~GCFEvent();
enum TResult { ERROR = -1, HANDLED = 0, NOT_HANDLED = 1};
virtual void* pack(unsigned int& packsize);
static unsigned int unpackString(std::string& value, char* buffer);
static unsigned int packString(char* buffer, const std::string& value);
/**
* @code
* Signal format
*
* 2 most significant bits indicate direction of signal:
* F_IN = 0b01
* F_OUT = 0b10
* F_INOUT = 0b11 (F_IN_SIGNAL | F_OUT_SIGNAL)
*
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* | O | I | P | P | P | P | P | S | S | S | S | S | S | S | S | S |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
* <- I/O-><--- protocol ---------><--------- signal -------------->
* @endcode
*/
#ifdef SWIG
%immutable;
#endif
unsigned short signal; // lsb contains signal id (0-255)
// msb contains protocol id (0-255)
size_t length; // payload length of the event (thus excl. signal and length) should be <= SSIZE_MAX)
#ifdef SWIG
%mutable;
#endif
protected: // member functions
GCFEvent(GCFEvent& e) :
signal(e.signal), length(e.length), _unpackDone(true), _buffer(0),
_base(&e), _upperbound(0)
{}
void resizeBuf(unsigned int requiredSize);
void* unpackMember(char* data, unsigned int& offset, unsigned int& memberDim, unsigned int sizeofMemberType);
unsigned int packMember(unsigned int offset, const void* member, unsigned int memberDim, unsigned int sizeofMemberType);
protected: // data members
bool _unpackDone;
char* _buffer;
GCFEvent* _base;
private:
GCFEvent& operator= (GCFEvent& e);
unsigned int _upperbound;
};
class GCFTransportable
{
public:
virtual ~GCFTransportable() {}
virtual unsigned int pack(char* buffer) = 0;
virtual unsigned int unpack(char* buffer) = 0;
virtual unsigned int getSize() = 0;
};
/**
* Macros to aid in decoding the signal field.
*/
#define F_EVT_INOUT_MASK (0xc000)
#define F_EVT_PROTOCOL_MASK (0x3f00)
#define F_EVT_SIGNAL_MASK (0x00ff)
#define F_EVT_INOUT(e) (((e).signal & F_EVT_INOUT_MASK) >> 14)
#define F_EVT_PROTOCOL(e) (((e).signal & F_EVT_PROTOCOL_MASK) >> 8)
#define F_EVT_SIGNAL(e) ((e).signal & F_EVT_SIGNAL_MASK)
#endif
|
#ifndef RUBY_PHONEBOOK_H
#define RUBY_PHONEBOOK_H 1
#ifdef __cplusplus
extern "C" {
#endif
/********************************************
* List of supported phonebook's fields (visible in ruby)
********************************************/
#define RUBY_PB_ID "id"
#define RUBY_PB_PREFIX "prefix"
#define RUBY_PB_FIRST_NAME "first_name"
#define RUBY_PB_MIDDLE_NAME "middle_name"
#define RUBY_PB_LAST_NAME "last_name"
#define RUBY_PB_SUFFIX "suffix"
#define RUBY_PB_NICKNAME "nickname"
#define RUBY_PB_NOTE "person_note"
#define RUBY_PB_BUSINESS_NUMBER "business_number"
#define RUBY_PB_HOME_NUMBER "home_number"
#define RUBY_PB_MOBILE_NUMBER "mobile_number"
#define RUBY_PB_MAIN_MUMBER "main_number"
#define RUBY_PB_PAGER_NUMBER "pager_number"
#define RUBY_PB_HOME_FAX "home_fax"
#define RUBY_PB_WORK_FAX "work_fax"
#define RUBY_PB_ASSISTANT_NUMBER "assistant_number"
#define RUBY_PB_EMAIL_ADDRESS "email_address"
#define RUBY_PB_HOME_EMAIL_ADDRESS "home_email_address"
#define RUBY_PB_OTHER_EMAIL_ADDRESS "other_email_address"
#define RUBY_PB_COMPANY_NAME "company_name"
#define RUBY_PB_JOB_TITLE "job_title"
#define RUBY_PB_BIRTHDAY "birthday"
#define RUBY_PB_STREET_ADDRESS_1 "street_address_1"
#define RUBY_PB_CITY_1 "city_1"
#define RUBY_PB_STATE_1 "state_1"
#define RUBY_PB_ZIP_1 "zip_1"
#define RUBY_PB_COUNTRY_1 "country_1"
#define RUBY_PB_STREET_ADDRESS_2 "street_address_2"
#define RUBY_PB_CITY_2 "city_2"
#define RUBY_PB_STATE_2 "state_2"
#define RUBY_PB_ZIP_2 "zip_2"
#define RUBY_PB_COUNTRY_2 "country_2"
#define RUBY_PB_STREET_ADDRESS_3 "street_address_3"
#define RUBY_PB_CITY_3 "city_3"
#define RUBY_PB_STATE_3 "state_3"
#define RUBY_PB_ZIP_3 "zip_3"
#define RUBY_PB_COUNTRY_3 "country_3"
#define RUBY_PB_HOME_PAGE "home_page"
#define RUBY_PB_SPOUSE_NAME "spouse_name"
#define RUBY_PB_ASSISTANT_NAME "assistant_name"
#define RUBY_PB_ANNIVERSARY "anniversary"
#define RUBY_PB_CREATED "created"
#define RUBY_PB_UPDATED "updated"
#ifdef __cplusplus
}
#endif
#endif |
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface ABPeoplePickerTableRow : NSObject
@end
|
// Copyright (c) 2005 - 2015 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots 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.
//
// Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef NOF_WOODCUTTER_H_
#define NOF_WOODCUTTER_H_
#include "nofFarmhand.h"
class nofWoodcutter : public nofFarmhand
{
private:
/// Malt den Arbeiter beim Arbeiten
void DrawWorking(int x, int y);
/// Fragt die abgeleitete Klasse um die ID in JOBS.BOB, wenn der Beruf Waren rausträgt (bzw rein)
unsigned short GetCarryID() const;
/// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen)
void WorkStarted();
/// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten
void WorkFinished();
/// Returns the quality of this working point or determines if the worker can work here at all
PointQuality GetPointQuality(const MapPoint pt);
/// wird aufgerufen, wenn die Arbeit abgebrochen wird (von nofBuildingWorker aufgerufen)
void WorkAborted_Farmhand();
public:
nofWoodcutter(const MapPoint pt, const unsigned char player, nobUsual* workplace);
nofWoodcutter(SerializedGameData* sgd, const unsigned obj_id);
GO_Type GetGOT() const { return GOT_NOF_WOODCUTTER; }
};
#endif
|
// Copyright (C) 2014 Chris Richardson
//
// This file is part of DOLFIN.
//
// DOLFIN 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.
//
// DOLFIN 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 DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added:
// Last changed:
#ifndef __CSRGRAPH_H
#define __CSRGRAPH_H
#include <vector>
#include <dolfin/common/MPI.h>
namespace dolfin
{
/// This class provides a Compressed Sparse Row Graph defined by a
/// vector containing edges for each node and a vector of offsets
/// into the edge vector for each node
///
/// In parallel, all nodes must be numbered from zero on process
/// zero continuously through increasing rank processes. Edges must
/// be defined in terms of the global node numbers. The global node
/// offset of each process is given by node_distribution()
///
/// The format of the nodes, edges and distribution is identical
/// with the formats for ParMETIS and PT-SCOTCH. See the manuals
/// for these libraries for further information.
template<typename T> class CSRGraph
{
public:
/// Access edges individually by using operator()[] to get a node object
class node
{
public:
node(const typename std::vector<T>::const_iterator& begin_it,
const typename std::vector<T>::const_iterator& end_it)
: begin_edge(begin_it), end_edge(end_it)
{ }
/// Iterator pointing to beginning of edges
typename std::vector<T>::const_iterator begin() const
{ return begin_edge; }
/// Iterator pointing to beyond end of edges
typename std::vector<T>::const_iterator end() const
{ return end_edge; }
/// Number of outgoing edges for this node
std::size_t size() const
{ return (end_edge - begin_edge); }
/// Access outgoing edge i of this node
const T& operator[](std::size_t i) const
{ return *(begin_edge + i); }
private:
typename std::vector<T>::const_iterator begin_edge;
typename std::vector<T>::const_iterator end_edge;
};
/// Empty CSR Graph
CSRGraph() : _node_offsets(1, 0)
{}
/// Create a CSR Graph from a collection of edges (X is a
/// container some type, e.g. std::vector<unsigned int> or
/// std::set<std::size_t>
template<typename X>
CSRGraph(MPI_Comm mpi_comm, const std::vector<X>& graph)
: _node_offsets(1, 0), _mpi_comm(mpi_comm)
{
// Count number of outgoing edges (to pre-allocate memory)
std::size_t num_edges = 0;
for (auto const &edges : graph)
num_edges += edges.size();
// Reserve memory
_node_offsets.reserve(graph.size());
_edges.reserve(num_edges);
// Node-by-node, add outgoing edges
for (auto const &node_edges : graph)
{
_edges.insert(_edges.end(), node_edges.begin(), node_edges.end());
_node_offsets.push_back(_node_offsets.back() + node_edges.size());
}
// Compute node offsets
calculate_node_distribution();
}
/// Destructor
~CSRGraph() {}
/// Vector containing all edges for all local nodes
const std::vector<T>& edges() const
{ return _edges; }
/// Vector containing all edges for all local nodes (non-const)
std::vector<T>& edges()
{ return _edges; }
/// Return CSRGraph::node object which provides begin() and end() iterators,
/// also size(), and random-access for the edges of node i.
const node operator[](std::size_t i) const
{
return node(_edges.begin() + _node_offsets[i],
_edges.begin() + _node_offsets[i + 1]);
}
/// Vector containing index offsets into edges for all local nodes
/// (plus extra entry marking end)
const std::vector<T>& nodes() const
{ return _node_offsets; }
/// Number of local edges in graph
std::size_t num_edges() const
{ return _edges.size(); }
/// Number of edges from node i
std::size_t num_edges(std::size_t i) const
{
dolfin_assert(i < size());
return (_node_offsets[i + 1] - _node_offsets[i]);
}
/// Number of local nodes in graph
std::size_t size() const
{ return _node_offsets.size() - 1; }
/// Total (global) number of nodes in parallel graph
T size_global() const
{ return _node_distribution.back(); }
/// Return number of nodes (offset) on each process
const std::vector<T>& node_distribution() const
{ return _node_distribution; }
private:
// Compute offset of number of nodes on each process
void calculate_node_distribution()
{
// Communicate number of nodes between all processors
const std::size_t num_nodes = size();
MPI::all_gather(_mpi_comm, (T) num_nodes, _node_distribution);
_node_distribution.insert(_node_distribution.begin(), 0);
for (std::size_t i = 1; i != _node_distribution.size(); ++i)
_node_distribution[i] += _node_distribution[i - 1];
}
// Edges in compressed form. Edges for node i are stored in
// _edges[_node_offsets[i]:_node_offsets[i + 1]]
std::vector<T> _edges;
// Offsets of each node into edges (see above) corresponding to
// the nodes on this process (see below)
std::vector<T> _node_offsets;
// Distribution of nodes across processes in parallel i.e. the
// range of nodes stored on process j is
// _node_distribution[j]:_node_distribution[j+1]
std::vector<T> _node_distribution;
// MPI communicator attached to graph
MPI_Comm _mpi_comm;
};
}
#endif
|
/*
* FTGL - OpenGL font library
*
* Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
*
* 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 __FTGlyphContainer__
#define __FTGlyphContainer__
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include "FTGL/ftgl.h"
#include "FTVector.h"
class FTFace;
class FTGlyph;
class FTCharmap;
/**
* FTGlyphContainer holds the post processed FTGlyph objects.
*
* @see FTGlyph
*/
class FTGlyphContainer
{
typedef FTVector<FTGlyph*> GlyphVector;
public:
/**
* Constructor
*
* @param face The Freetype face
*/
FTGlyphContainer(FTFace* face);
/**
* Destructor
*/
~FTGlyphContainer();
/**
* Sets the character map for the face.
*
* @param encoding the Freetype encoding symbol. See above.
* @return <code>true</code> if charmap was valid
* and set correctly
*/
bool CharMap(FT_Encoding encoding);
/**
* Get the font index of the input character.
*
* @param characterCode The character code of the requested glyph in the
* current encoding eg apple roman.
* @return The font index for the character.
*/
unsigned int FontIndex(const unsigned int characterCode) const;
/**
* Adds a glyph to this glyph list.
*
* @param glyph The FTGlyph to be inserted into the container
* @param characterCode The char code of the glyph NOT the glyph index.
*/
void Add(FTGlyph* glyph, const unsigned int characterCode);
/**
* Get a glyph from the glyph list
*
* @param characterCode The char code of the glyph NOT the glyph index
* @return An FTGlyph or <code>null</code> is it hasn't been
* loaded.
*/
const FTGlyph* Glyph(const unsigned int characterCode) const;
/**
* Get the bounding box for a character.
* @param characterCode The char code of the glyph NOT the glyph index
*/
FTBBox BBox(const unsigned int characterCode) const;
/**
* Returns the kerned advance width for a glyph.
*
* @param characterCode glyph index of the character
* @param nextCharacterCode the next glyph in a string
* @return advance width
*/
float Advance(const unsigned int characterCode,
const unsigned int nextCharacterCode);
/**
* Renders a character
* @param characterCode the glyph to be Rendered
* @param nextCharacterCode the next glyph in the string. Used for kerning.
* @param penPosition the position to Render the glyph
* @param renderMode Render mode to display
* @return The distance to advance the pen position after Rendering
*/
FTPoint Render(const unsigned int characterCode,
const unsigned int nextCharacterCode,
FTPoint penPosition, int renderMode);
/**
* Queries the Font for errors.
*
* @return The current error code.
*/
FT_Error Error() const { return err; }
private:
/**
* The FTGL face
*/
FTFace* face;
/**
* The Character Map object associated with the current face
*/
FTCharmap* charMap;
/**
* A structure to hold the glyphs
*/
GlyphVector glyphs;
/**
* Current error code. Zero means no error.
*/
FT_Error err;
};
#endif // __FTGlyphContainer__
|
/*
*\class PASERUDpTrafficSender
*@brief Class provides a constant bit rate UDP sender. It simulates to a large extent an Iperf UDP client.
*
*\authors Dennis Kaulbars | Sebastian Subik \@tu-dortmund.de | Eugen.Paul | Mohamad.Sbeiti \@paser.info
*
*\copyright (C) 2012 Communication Networks Institute (CNI - Prof. Dr.-Ing. Christian Wietfeld)
* at Technische Universitaet Dortmund, Germany
* http://www.kn.e-technik.tu-dortmund.de/
*
*
* 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.
* For further information see file COPYING
* in the top level directory
********************************************************************************
* This work is part of the secure wireless mesh networks framework, which is currently under development by CNI
********************************************************************************/
#ifndef __INETMANET_PASERUDPTRAFFICSENDER_H_
#define __INETMANET_PASERUDPTRAFFICSENDER_H_
#include <omnetpp.h>
#include "csimplemodule.h"
#include "UDPSocket.h"
#include "PaserTrafficDataMsg_m.h"
#include "IInterfaceTable.h"
#include "InterfaceTableAccess.h"
#include "InterfaceEntry.h"
#include "IPv4InterfaceData.h"
#include "IPvXAddress.h"
//#define No_init_manetStats
class PASERUdpTrafficSender : public cSimpleModule
{
private:
IPvXAddress destAddr;
double bitRate;
double messageFreq;
double packetLength;
double offset;
double stopTime;
int myCounter;
int myPort;
int destPort;
int interfaceId;
int numSent;
bool runMe;
std::string myId;
IInterfaceTable *ift;
UDPSocket socket;
protected:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
void handleSelfMessage(cMessage *selfMsg);
void handleExtMessage(cMessage *extMsg);
void startDataMessage();
PaserTrafficDataMsg *createDataMessage();
void sendDataMessage(PaserTrafficDataMsg *dataMsg, std::string destId);
InterfaceEntry* getInterface();
void setSocketOptions();
public:
int getNumberOfSentMessages();
double getDataRate();
std::string getMyId();
};
#endif
|
/*
This file is part of atus-pro package.
atus-pro 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.
atus-pro 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 atus-pro. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Želimir Marojević, Ertan Göklü, Claus Lämmerzahl
(ZARM - Center of Applied Space Technology and Microgravity, Germany, http://www.zarm.uni-bremen.de/)
Public use and modification of this code are allowed provided that the following papers are cited:
Marojević, Želimir, Ertan Göklü, und Claus Lämmerzahl. "ATUS-PRO: A FEM-based solver for the time-dependent and stationary Gross–Pitaevskii equation",
Computer Physics Communications, Vol 202, 2016, p. 216--232. doi:10.1016/j.cpc.2015.12.004.
W. Bangerth and D. Davydov and T. Heister and L. Heltai and G. Kanschat and M. Kronbichler and M. Maier and B. Turcksin and D. Wells.
"The \texttt{deal.II} Library, Version 8.4", Journal of Numerical Mathematics, vol 24, 2016.
The authors would be grateful for all information and/or comments regarding the use of the code.
*/
#include "tinyxml2.h"
#include <string>
#include <vector>
#include <map>
#include <list>
#ifndef __class_MyParameterHandler__
#define __class_MyParameterHandler__
class MyParameterHandler
{
public:
MyParameterHandler( const std::string );
virtual ~MyParameterHandler() {};
std::string Get_Parameter( const std::string );
void Set_Physics( const std::string, const std::vector<double> & );
double Get_Physics( const std::string, const int );
std::vector<double> Get_Physics( const std::string );
double Get_Mesh( const std::string, const int );
std::vector<double> Get_Mesh( const std::string );
double Get_Algorithm( const std::string, const int );
std::vector<double> Get_Algorithm( const std::string );
void SaveXMLFile( const std::string & );
int Get_NA();
int Get_NK();
protected:
void populate_vconstants( const std::string, std::map<std::string, std::vector<double>> & );
void populate_parameter();
tinyxml2::XMLDocument m_xml_doc;
tinyxml2::XMLNode *m_pRoot;
std::map<std::string, std::vector<double>> m_map_physics;
std::map<std::string, std::vector<double>> m_map_mesh;
std::map<std::string, std::vector<double>> m_map_algorithm;
std::map<std::string, std::string> m_map_parameter;
};
#endif
|
#pragma once
#include "../Helper/BaseDialog.h"
#include "../Helper/ResizableDialog.h"
#include "../Helper/DialogSettings.h"
#include "../Helper/ReferenceCount.h"
class CMergeFilesDialog;
class CMergeFilesDialogPersistentSettings : public CDialogSettings
{
public:
~CMergeFilesDialogPersistentSettings();
static CMergeFilesDialogPersistentSettings &GetInstance();
private:
friend CMergeFilesDialog;
static const TCHAR SETTINGS_KEY[];
CMergeFilesDialogPersistentSettings();
CMergeFilesDialogPersistentSettings(const CMergeFilesDialogPersistentSettings &);
CMergeFilesDialogPersistentSettings & operator=(const CMergeFilesDialogPersistentSettings &);
};
class CMergeFiles : public CReferenceCount
{
public:
CMergeFiles(HWND hDlg,std::wstring strOutputFilename,std::list<std::wstring> FullFilenameList);
~CMergeFiles();
void StartMerging();
void StopMerging();
private:
HWND m_hDlg;
std::wstring m_strOutputFilename;
std::list<std::wstring> m_FullFilenameList;
CRITICAL_SECTION m_csStop;
bool m_bstopMerging;
};
class CMergeFilesDialog : public CBaseDialog
{
public:
CMergeFilesDialog(HINSTANCE hInstance,int iResource,HWND hParent,std::wstring strOutputDirectory,std::list<std::wstring> FullFilenameList,BOOL bShowFriendlyDates);
~CMergeFilesDialog();
protected:
INT_PTR OnInitDialog();
INT_PTR OnCommand(WPARAM wParam,LPARAM lParam);
INT_PTR OnClose();
INT_PTR OnDestroy();
INT_PTR OnPrivateMessage(UINT uMsg,WPARAM wParam,LPARAM lParam);
private:
void GetResizableControlInformation(CBaseDialog::DialogSizeConstraint &dsc, std::list<CResizableDialog::Control_t> &ControlList);
void SaveState();
void OnOk();
void OnCancel();
void OnChangeOutputDirectory();
void OnMove(bool bUp);
void OnFinished();
std::wstring m_strOutputDirectory;
std::list<std::wstring> m_FullFilenameList;
BOOL m_bShowFriendlyDates;
CMergeFiles *m_pMergeFiles;
bool m_bMergingFiles;
bool m_bStopMerging;
TCHAR m_szOk[32];
HICON m_hDialogIcon;
CMergeFilesDialogPersistentSettings *m_pmfdps;
}; |
#ifndef ALGORITHM_H
#define ALGORITHM_H
#ifdef __APPLE_CC__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#include <inttypes.h>
#include <stdbool.h>
typedef enum {
ALGO_UNK,
ALGO_CRE,
ALGO_SCRYPT,
ALGO_NSCRYPT,
ALGO_X11,
ALGO_X13,
ALGO_X14,
ALGO_X15,
ALGO_KECCAK,
ALGO_QUARK,
ALGO_TWE,
ALGO_FUGUE,
ALGO_NIST,
ALGO_FRESH,
ALGO_WHIRL,
ALGO_NEOSCRYPT,
ALGO_LYRA2RE,
ALGO_LYRA2REv2,
ALGO_PLUCK,
ALGO_YESCRYPT,
ALGO_YESCRYPT_MULTI,
} algorithm_type_t;
extern const char *algorithm_type_str[];
extern void gen_hash(const unsigned char *data, unsigned int len, unsigned char *hash);
struct __clState;
struct _dev_blk_ctx;
struct _build_kernel_data;
struct cgpu_info;
struct work;
/* Describes the Scrypt parameters and hashing functions used to mine
* a specific coin.
*/
typedef struct _algorithm_t {
char name[20]; /* Human-readable identifier */
algorithm_type_t type; //algorithm type
const char *kernelfile; /* alternate kernel file */
uint32_t n; /* N (CPU/Memory tradeoff parameter) */
uint8_t nfactor; /* Factor of N above (n = 2^nfactor) */
double diff_multiplier1;
double diff_multiplier2;
double share_diff_multiplier;
uint32_t xintensity_shift;
uint32_t intensity_shift;
uint32_t found_idx;
unsigned long long diff_numerator;
uint32_t diff1targ;
size_t n_extra_kernels;
long rw_buffer_size;
cl_command_queue_properties cq_properties;
void (*regenhash)(struct work *);
cl_int (*queue_kernel)(struct __clState *, struct _dev_blk_ctx *, cl_uint);
void (*gen_hash)(const unsigned char *, unsigned int, unsigned char *);
void (*set_compile_options)(struct _build_kernel_data *, struct cgpu_info *, struct _algorithm_t *);
} algorithm_t;
/* Set default parameters based on name. */
void set_algorithm(algorithm_t* algo, const char* name);
/* Set to specific N factor. */
void set_algorithm_nfactor(algorithm_t* algo, const uint8_t nfactor);
/* Compare two algorithm parameters */
bool cmp_algorithm(algorithm_t* algo1, algorithm_t* algo2);
#endif /* ALGORITHM_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.