text
stringlengths 4
6.14k
|
|---|
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <linux/types.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <assert.h>
#include <string.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#define DEV_NAME "/dev/at24c"
int main()
{
int ret;
int fd;
char username[16];
char passwd[16];
char u_name[16];
char p_name[16];
int u_len,p_len;
/*
* User operation
*/
printf("=====Welcome to register Buddy safe.Inc=====\n");
retry:
printf("==Please input your name:\n>");
scanf("%s",username);
u_len = strlen(username);
printf("==Please input your passwd:\n>");
scanf("%s",passwd);
p_len = strlen(passwd);
/*
* open device
*/
fd = open(DEV_NAME,O_RDWR);
if(fd < 0)
exit(1);
/*
* read username from at24c
*/
lseek(fd,0,SEEK_SET);
write(fd,username,u_len);
lseek(fd,16,SEEK_SET);
write(fd,passwd,p_len);
printf("==Succeed register.\n");
close(fd);
}
|
#ifndef _LINUX_PTRACE_H
#define _LINUX_PTRACE_H
/* ptrace.h */
/* structs and defines to help the user use the ptrace system call. */
/* has the defines to get at the registers. */
#define PTRACE_TRACEME 0
#define PTRACE_PEEKTEXT 1 //来读写被跟踪进程的指令空间
#define PTRACE_PEEKDATA 2
#define PTRACE_PEEKUSR 3
#define PTRACE_POKETEXT 4
#define PTRACE_POKEDATA 5
#define PTRACE_POKEUSR 6
#define PTRACE_CONT 7
#define PTRACE_KILL 8 //控制被跟踪进程的运行
#define PTRACE_SINGLESTEP 9
#define PTRACE_ATTACH 0x10 //与被跟踪进程建立起联系
#define PTRACE_DETACH 0x11 //跟被跟踪进程离开关系
#define PTRACE_SYSCALL 24
#include <asm/ptrace.h>
//sys_ptrace
#endif
|
/* -----------------------------------------------
* Super nanovol
* Khairi Reda, 2013
* Electronic Visualization Laboratory
* www.evl.uic.edu/kreda
*
* GPL v2 License:
* http://www.gnu.org/licenses/gpl-2.0.html
* pipe.h
*
* -----------------------------------------------
*/
#ifndef _PIPE_H__
#define _PIPE_H__
#include <pthread.h>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class PipeReader
{
public:
PipeReader(string fileName);
~PipeReader();
void start();
void stop();
private:
static void * thread_entry(void * instance);
void loop();
bool working;
bool opened;
string filename;
ifstream input;
pthread_t thread;
};
#endif
|
/* intel_mid_dma_acpi.c - Intel MID DMA driver init file for ACPI enumaration.
*
* Copyright (c) 2013, Intel Corporation.
*
* Authors: Ramesh Babu K V <Ramesh.Babu@intel.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/intel_mid_dma.h>
#include <linux/pm_runtime.h>
#include <acpi/acpi_bus.h>
#define MAX_CHAN 4 /*max ch across controllers*/
#include "intel_mid_dma_regs.h"
static struct device *acpi_dma_dev;
struct device *intel_mid_get_acpi_dma(void)
{
return acpi_dma_dev;
}
EXPORT_SYMBOL_GPL(intel_mid_get_acpi_dma);
static int mid_get_and_map_rsrc(void **dest, struct platform_device *pdev,
unsigned int num)
{
struct resource *rsrc;
rsrc = platform_get_resource(pdev, IORESOURCE_MEM, num);
if (!rsrc) {
pr_err("%s: Invalid resource - %d", __func__, num);
return -EIO;
}
pr_debug("rsrc #%d = %#x", num, rsrc->start);
*dest = devm_ioremap_nocache(&pdev->dev, rsrc->start, resource_size(rsrc));
if (!*dest) {
pr_err("%s: unable to map resource: %#x", __func__, rsrc->start);
return -EIO;
}
return 0;
}
static int mid_platform_get_resources(struct middma_device *mid_device,
struct platform_device *pdev)
{
int ret;
pr_debug("%s", __func__);
/* All ACPI resource request here */
/* Get DDR addr from platform resource table */
ret = mid_get_and_map_rsrc(&mid_device->dma_base, pdev, 0);
if (ret)
return ret;
pr_debug("dma_base:%p", mid_device->dma_base);
ret = mid_get_and_map_rsrc(&mid_device->mask_reg, pdev, 1);
if (ret)
return ret;
/* mask_reg should point to ISRX register */
mid_device->mask_reg += 0x18;
pr_debug("pimr_base:%p", mid_device->mask_reg);
mid_device->irq = platform_get_irq(pdev, 0);
if (mid_device->irq < 0) {
pr_err("invalid irq:%d", mid_device->irq);
return mid_device->irq;
}
pr_debug("irq from pdev is:%d", mid_device->irq);
return 0;
}
#if IS_ENABLED(CONFIG_ACPI)
int dma_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_device *device;
struct middma_device *mid_device;
struct intel_mid_dma_probe_info *info;
const char *hid;
int ret;
ret = acpi_bus_get_device(handle, &device);
if (ret) {
pr_err("%s: could not get acpi device - %d\n", __func__, ret);
return -ENODEV;
}
if (acpi_bus_get_status(device) || !device->status.present) {
pr_err("%s: device has invalid status", __func__);
return -ENODEV;
}
hid = acpi_device_hid(device);
pr_info("%s for %s", __func__, hid);
/* Apply default dma_mask if needed */
if (!pdev->dev.dma_mask) {
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
}
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
if (ret) {
pr_err("dma_set_mask failed with err:%d", ret);
return ret;
}
ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
if (ret) {
pr_err("_coherent_mask failed with err:%d", ret);
return ret;
}
info = mid_get_acpi_driver_data(hid);
if (!info) {
pr_err("acpi driver data is null");
goto err_dma;
}
mid_device = mid_dma_setup_context(&pdev->dev, info);
if (!mid_device)
goto err_dma;
ret = mid_platform_get_resources(mid_device, pdev);
if (ret) {
pr_err("Error while get resources:%d", ret);
goto err_dma;
}
platform_set_drvdata(pdev, mid_device);
ret = mid_setup_dma(&pdev->dev);
if (ret)
goto err_dma;
pm_runtime_enable(&pdev->dev);
acpi_dma_dev = &pdev->dev;
pr_debug("%s:completed", __func__);
return 0;
err_dma:
pr_err("ERR_MDMA:Probe failed %d\n", ret);
return ret;
}
#else
int dma_acpi_probe(struct platform_device *pdev)
{
return -EIO;
}
#endif
int dma_acpi_remove(struct platform_device *pdev)
{
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_disable(&pdev->dev);
acpi_dma_dev = NULL;
middma_shutdown(&pdev->dev);
platform_set_drvdata(pdev, NULL);
return 0;
}
|
#ifndef GAMEOBJECT_H_
#define GAMEOBJECT_H_
#include "core/Config.h"
#include "core/Assertion.h"
#include "core/Utils.h"
#include "GUID.h"
#include <string>
namespace buf
{
template <typename ID = GUID>
class GameObjectI
{
public:
typedef ID id_type;
public:
GameObjectI() {}
explicit GameObjectI(const id_type& id) : _id(id) {}
public:
inline const ID& getId() const { return _id; }
inline void setId(const ID& id) { _id = id; }
protected:
ID _id;
};
template <typename ID = GUID>
class GameObjectIN : public GameObjectI<ID>
{
public:
GameObjectIN() : GameObjectI<ID>()
{
MEMZRO(_name, sizeof(_name));
}
explicit GameObjectIN(const ID& id, const char* name = NULL)
: GameObjectI<ID>(id)
{
cpystr(name, _name, sizeof(_name), "null");
}
public:
inline void setName(const char* name) { cpystr(name, _name, sizeof(_name), "null"); }
inline const char* getName() const { return _name; }
protected:
char _name[NAME_MAX+1];
};
template <typename ID = GUID>
class GameObject : public GameObjectIN<ID>
{
public:
GameObject() : GameObjectIN<ID>()
{}
GameObject(ID id, const char* name, int type = 0) : GameObjectIN<ID>(id, name), _type(type)
{}
explicit GameObject(const ID& id, int type = 0, const char* name = NULL)
: GameObjectIN<ID>(id, name), _type(type)
{}
virtual ~GameObject()
{}
inline int getType() const { return _type; }
inline void setType(int v) { _type = v; }
protected:
int _type;
};
} // namespace buf
#endif // GAMEOBJECT_H_
/* vim: set ai si nu sm smd hls is ts=4 sm=4 bs=indent,eol,start */
|
/* vmlog - high-speed logging for free VMs */
/* Copyright (C) 2006 Edwin Steiner <edwin.steiner@gmx.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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VMLOG_JAMVM_H_
#define _VMLOG_JAMVM_H_
void vmlog_jamvm_init(int *pargc,char **argv);
void vmlog_jamvm_enter_method(Object *thread,MethodBlock *mb);
void vmlog_jamvm_leave_method(Object *thread,MethodBlock *mb);
void vmlog_jamvm_unwnd_method(Object *thread,MethodBlock *mb);
void vmlog_jamvm_throw(Object *thread,Object *exp);
void vmlog_jamvm_catch(Object *thread,Object *exp);
#endif
/* vim: noet ts=8 sw=8
*/
|
/*
* Copyright (C) 2005-2008 by Pieter Palmers
* Copyright (C) 2005-2008 by Daniel Wagner
*
* This file is part of FFADO
* FFADO = Free Firewire (pro-)audio drivers for linux
*
* FFADO is based upon FreeBoB
*
* 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) version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AVCSIGNALFORMAT_H
#define AVCSIGNALFORMAT_H
#include "avc_generic.h"
namespace AVC {
class OutputPlugSignalFormatCmd: public AVCCommand
{
public:
OutputPlugSignalFormatCmd(Ieee1394Service& ieee1394service);
virtual ~OutputPlugSignalFormatCmd();
virtual bool serialize( Util::Cmd::IOSSerialize& se );
virtual bool deserialize( Util::Cmd::IISDeserialize& de );
virtual const char* getCmdName() const
{ return "OutputPlugSignalFormatCmd"; }
byte_t m_plug;
byte_t m_eoh;
byte_t m_form;
byte_t m_fmt;
byte_t m_fdf[3];
};
class InputPlugSignalFormatCmd: public AVCCommand
{
public:
InputPlugSignalFormatCmd(Ieee1394Service& ieee1394service);
virtual ~InputPlugSignalFormatCmd();
virtual bool serialize( Util::Cmd::IOSSerialize& se );
virtual bool deserialize( Util::Cmd::IISDeserialize& de );
virtual const char* getCmdName() const
{ return "InputPlugSignalFormatCmd"; }
byte_t m_plug;
byte_t m_eoh;
byte_t m_form;
byte_t m_fmt;
byte_t m_fdf[3];
};
}
#endif // AVCSIGNALFORMAT_H
|
/* Copyright (C) 2006-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* We define a special synchronization primitive for AIO. POSIX
conditional variables would be ideal but the pthread_cond_*wait
operations do not return on EINTR. This is a requirement for
correct aio_suspend and lio_listio implementations. */
#include <assert.h>
#include <signal.h>
#include <pthreadP.h>
#include <lowlevellock.h>
#define DONT_NEED_GAI_MISC_COND 1
#define GAI_MISC_NOTIFY(waitlist) \
do { \
if (*waitlist->counterp > 0 && --*waitlist->counterp == 0) \
lll_futex_wake (waitlist->counterp, 1, LLL_PRIVATE); \
} while (0)
#define GAI_MISC_WAIT(result, futex, timeout, cancel) \
do { \
volatile int *futexaddr = &futex; \
int oldval = futex; \
\
if (oldval != 0) \
{ \
pthread_mutex_unlock (&__gai_requests_mutex); \
\
int oldtype; \
if (cancel) \
oldtype = LIBC_CANCEL_ASYNC (); \
\
int status; \
do \
{ \
status = lll_futex_timed_wait (futexaddr, oldval, timeout, \
LLL_PRIVATE); \
if (status != EWOULDBLOCK) \
break; \
\
oldval = *futexaddr; \
} \
while (oldval != 0); \
\
if (cancel) \
LIBC_CANCEL_RESET (oldtype); \
\
if (status == EINTR) \
result = EINTR; \
else if (status == ETIMEDOUT) \
result = EAGAIN; \
else \
assert (status == 0 || status == EWOULDBLOCK); \
\
pthread_mutex_lock (&__gai_requests_mutex); \
} \
} while (0)
#define gai_start_notify_thread __gai_start_notify_thread
#define gai_create_helper_thread __gai_create_helper_thread
extern inline void
__gai_start_notify_thread (void)
{
sigset_t ss;
sigemptyset (&ss);
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
}
extern inline int
__gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
void *arg)
{
pthread_attr_t attr;
/* Make sure the thread is created detached. */
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
/* The helper thread needs only very little resources. */
(void) pthread_attr_setstacksize (&attr,
__pthread_get_minstack (&attr)
+ 4 * PTHREAD_STACK_MIN);
/* Block all signals in the helper thread. To do this thoroughly we
temporarily have to block all signals here. */
sigset_t ss;
sigset_t oss;
sigfillset (&ss);
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8);
int ret = pthread_create (threadp, &attr, tf, arg);
/* Restore the signal mask. */
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL,
_NSIG / 8);
(void) pthread_attr_destroy (&attr);
return ret;
}
#include_next <gai_misc.h>
|
/*******************************************************************
*
* Author: Xilinx, 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.
*
*
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE.
*
*
* Xilinx hardware products are not intended for use in life support
* appliances, devices, or systems. Use in such applications is
* expressly prohibited.
*
*
* (c) Copyright 2002-2004 Xilinx Inc.
* All rights reserved.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Description: Driver configuration
*
*******************************************************************/
#include "xparameters.h"
#include "xsysace.h"
/*
* The configuration table for devices
*/
XSysAce_Config XSysAce_ConfigTable[] = {
{
XPAR_OPB_SYSACE_0_DEVICE_ID,
XPAR_OPB_SYSACE_0_BASEADDR}
};
|
static void clear_forces(int n, Force* ff) {
if (n) DzeroA(ff, n);
}
static void clear_mbr_forces(Mbr *m) {
UC(clear_forces(m->q.n, m->ff));
}
static void clear_rig_forces(Rig *r) {
UC(clear_forces(r->q.n, r->ff));
UC(rig_reinit_ft(r->q.ns, /**/ r->q.ss));
}
void objects_clear_forces(Objects *obj) {
int i;
if (!obj->active) return;
for (i = 0; i < obj->nmbr; ++i) UC(clear_mbr_forces(obj->mbr[i]));
for (i = 0; i < obj->nrig; ++i) UC(clear_rig_forces(obj->rig[i]));
}
// used in main.h
static void internal_forces_mbr(float dt, const OptMbr *opt, Mbr *m) {
UC(rbc_force_apply(m->force, m->params, dt, &m->q, /**/ m->ff_fast));
if (opt->stretch) UC(rbc_stretch_apply(m->q.nc, m->stretch, /**/ m->ff_fast));
}
static void bforce_mbr(const Coords *c, const BForce *bf, Mbr *m) {
UC(bforce_apply(c, m->mass, bf, m->q.n, m->q.pp, /**/ m->ff));
}
static void bforce_rig(const Coords *c, const BForce *bf, Rig *r) {
UC(bforce_apply(c, r->mass, bf, r->q.n, r->q.pp, /**/ r->ff));
}
void objects_body_forces(const BForce *bf, Objects *o) {
int i;
const Opt *opt = &o->opt;
if (!o->active) return;
for (i = 0; i < o->nmbr; ++i)
if (opt->mbr[i].push)
bforce_mbr(o->coords, bf, o->mbr[i]);
for (i = 0; i < o->nrig; ++i)
if (opt->rig[i].push)
bforce_rig(o->coords, bf, o->rig[i]);
}
|
/* This file is part of the wvWare 2 project
Copyright (C) 2001-2003 Werner Trobin <trobin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PARSERFACTORY_H
#define PARSERFACTORY_H
#include <string>
#include "sharedptr.h"
#include "wv2_export.h"
namespace wvWare
{
class Parser;
class OLEStorage;
class WV2_EXPORT ParserFactory
{
public:
/**
* This method opens a storage on the file, determines the nFib,
* and creates a proper parser for it.
* All you have to do with that parser is to call parse() on it
* and it will start firing callbacks.
* This method will return 0 if it wasn't successful (e.g unknown
* version, corrupted file,...).
*/
static SharedPtr<Parser> createParser( const std::string& fileName );
/**
* This method opens a storage on a buffer in memory, determines the nFib,
* and creates a proper parser for it.
* All you have to do with that parser is to call parse() on it
* and it will start firing callbacks.
* This method will return 0 if it wasn't successful (e.g unknown
* version, corrupted file,...).
*/
static SharedPtr<Parser> createParser( const unsigned char* buffer, size_t buflen );
};
} // namespace wvWare
#endif // PARSERFACTORY_H
|
/*
* The ManaPlus Client
* Copyright (C) 2011-2019 The ManaPlus Developers
* Copyright (C) 2019-2022 Andrei Karas
*
* 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 NET_FAMILYHANDLER_H
#define NET_FAMILYHANDLER_H
#include "localconsts.h"
class Being;
namespace Net
{
class FamilyHandler notfinal
{
public:
FamilyHandler()
{ }
A_DELETE_COPY(FamilyHandler)
virtual ~FamilyHandler()
{ }
virtual void askForChild(const Being *const being) const = 0;
virtual void askForChildReply(const bool accept) const = 0;
};
} // namespace Net
extern Net::FamilyHandler *familyHandler;
#endif // NET_FAMILYHANDLER_H
|
// XzDecoder.h
#ifndef __XZ_DECODER_H
#define __XZ_DECODER_H
#include "../../../C/Xz.h"
#include "../../Common/MyCom.h"
#include "../ICoder.h"
namespace NCompress {
namespace NXz {
struct CXzUnpackerCPP
{
Byte *InBuf;
Byte *OutBuf;
CXzUnpacker p;
CXzUnpackerCPP();
~CXzUnpackerCPP();
};
struct CStatInfo
{
UInt64 InSize;
UInt64 OutSize;
UInt64 PhySize;
UInt64 NumStreams;
UInt64 NumBlocks;
bool UnpackSize_Defined;
bool NumStreams_Defined;
bool NumBlocks_Defined;
bool IsArc;
bool UnexpectedEnd;
bool DataAfterEnd;
bool Unsupported;
bool HeadersError;
bool DataError;
bool CrcError;
CStatInfo() { Clear(); }
void Clear();
};
struct CDecoder: public CStatInfo
{
CXzUnpackerCPP xzu;
SRes DecodeRes; // it's not HRESULT
CDecoder(): DecodeRes(SZ_OK) {}
/* Decode() can return ERROR code only if there is progress or stream error.
Decode() returns S_OK in case of xz decoding error, but DecodeRes and CStatInfo contain error information */
HRESULT Decode(ISequentialInStream *seqInStream, ISequentialOutStream *outStream,
const UInt64 *outSizeLimit, bool finishStream, ICompressProgressInfo *compressProgress);
Int32 Get_Extract_OperationResult() const;
};
class CComDecoder:
public ICompressCoder,
public ICompressSetFinishMode,
public ICompressGetInStreamProcessedSize,
public CMyUnknownImp
{
CDecoder _decoder;
bool _finishStream;
public:
MY_UNKNOWN_IMP2(
ICompressSetFinishMode,
ICompressGetInStreamProcessedSize)
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetFinishMode)(UInt32 finishMode);
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
CComDecoder(): _finishStream(false) {}
};
}}
#endif
|
/*****************************************************************
* $Id: acc_accountcontrolwidget.h 1540 2012-02-08 21:48:49Z rutger $
* Created: Nov 11, 2010 4:25:40 PM - rutger
*
* Copyright (C) 2010 Red-Bag. All rights reserved.
* This file is part of the Biluna ACC project.
*
* See http://www.red-bag.com for further details.
*****************************************************************/
#ifndef ACC_ACCOUNTCONTROLWIDGET_H
#define ACC_ACCOUNTCONTROLWIDGET_H
#include "rb_widget.h"
#include "ui_acc_accountcontrolwidget.h"
/**
* Edit dialog for the account control. The system account controls
* are translated with the user set account control name.
*/
class ACC_AccountControlWidget : public RB_Widget, private Ui::ACC_AccountControlWidget {
Q_OBJECT
public:
ACC_AccountControlWidget(QWidget *parent = 0);
virtual ~ACC_AccountControlWidget();
virtual RB_String getId() const override { return RB_String(); }
virtual RB_String getName() const override { return "ACC Account Control"; }
virtual RB2::PerspectiveType getPerspectiveType() const override {
return RB2::PerspectiveACC;
}
virtual void init() override;
virtual void initFocus() override;
virtual bool fileSave(bool withSelect) override;
virtual void fileRevert() override;
protected:
void changeEvent(QEvent *e);
protected slots:
void slotSelectionChanged(const QModelIndex&, const QModelIndex&);
void slotIndexChanged(int);
private:
//! Data model
RB_MmProxy* mModel;
//! Data widget mapper
RB_DataWidgetMapper* mMapper;
//! System account control model
RB_MmProxy* mSysModel;
};
#endif // ACC_ACCOUNTCONTROLWIDGET_H
|
/*
* Copyright (C) 2012 Ladislav Klenovic <klenovic@nucleonsoft.com>
*
* This file is part of Nucleos kernel.
*
* Nucleos kernel 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.
*/
#ifndef __ASM_X86_BITSPERLONG_H
#define __ASM_X86_BITSPERLONG_H
#ifdef __x86_64__
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif
#include <asm-generic/bitsperlong.h>
#endif /* __ASM_X86_BITSPERLONG_H */
|
/*
clock module for kdm
Copyright (C) 2000 Espen Sand, espen@kde.org
Based on work by NN (yet to be determined)
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 _KDM_CLOCK_H_
#define _KDM_CLOCK_H_
#include <qframe.h>
class KdmClock : public QFrame {
Q_OBJECT
typedef QFrame inherited;
public:
KdmClock( QWidget *parent=0, const char *name=0 );
protected:
virtual void showEvent( QShowEvent * );
virtual void paintEvent( QPaintEvent * );
private slots:
void timeout();
private:
QBrush mBackgroundBrush;
QFont mFont;
bool mSecond;
bool mDigital;
bool mDate;
bool mBorder;
};
#endif
|
/*
* SMLGR Inverter Daemon
* Copyright (C) 2015 Luca Cireddu
* sardylan@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <string.h>
#include "config.h"
#include "ui.h"
#include "cfg.h"
#include "utils.h"
#include "log.h"
extern cfg *conf;
extern const char *smlgr_program_name;
/**
* Usage information message
*/
void ui_usage() {
fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s [<option> <value> ...]\n", smlgr_program_name);
}
/**
* Version information
*/
void ui_version() {
fprintf(stderr, "SMLGR Inverter Daemon\n");
}
/**
* Help information message with all command line options
*/
void ui_help() {
fprintf(stderr, "SMLGR Inverter Daemon\n");
fprintf(stderr, "\n");
ui_usage();
fprintf(stderr, "\n");
fprintf(stderr, "Options list with default values:\n");
fprintf(stderr, "\n");
fprintf(stderr, " -c | --config Config file (overwrite all other options)\n");
fprintf(stderr, "\n");
fprintf(stderr, " -h | --help This message\n");
fprintf(stderr, " -V | --version Print Version and exit\n");
fprintf(stderr, "\n");
fprintf(stderr, " -q | --quiet Disable output (debug level 0)\n");
fprintf(stderr, " -v | --verbose Verbose output (debug level 4)\n");
fprintf(stderr, " -d | --debug Debug level (%d)\n", DEFAULT_UI_DEBUG_LEVEL);
fprintf(stderr, " 0 DISABLE (quiet)\n");
fprintf(stderr, " 1 ERROR\n");
fprintf(stderr, " 2 WARNING\n");
fprintf(stderr, " 3 INFO\n");
fprintf(stderr, " 4 DEBUG (verbose)\n");
fprintf(stderr, "\n");
fprintf(stderr, " -l | --log-file-level Log file level (%d)\n", DEFAULT_LOG_FILE_LEVEL);
fprintf(stderr, " 0 DISABLE\n");
fprintf(stderr, " 1 ERROR\n");
fprintf(stderr, " 2 WARNING\n");
fprintf(stderr, " 3 INFO\n");
fprintf(stderr, " 4 DEBUG\n");
fprintf(stderr, "\n");
fprintf(stderr, " -k | --log-file Log file name and path (%s)\n", DEFAULT_LOG_FILE_NAME);
fprintf(stderr, "\n");
fprintf(stderr, "\n");
fprintf(stderr, "\n");
fprintf(stderr, " -m | --inv-model Inverter Model (%d)\n", DEFAULT_INVERTER_MODEL);
fprintf(stderr, " 1. SolarMax S3000 TCP\n");
fprintf(stderr, "\n");
fprintf(stderr, " -a | --inv-tcp-addr Inverter (via TCP) IP Address (%s)\n", DEFAULT_INVERTER_TCP_IP_ADDR);
fprintf(stderr, " -p | --inv-tcp-port Inverter (via TCP) TCP Port (%d)\n", DEFAULT_INVERTER_TCP_IP_PORT);
fprintf(stderr, "\n");
fprintf(stderr, " -e | --inv-serial-port Inverter (via Serial Port) Port Name (%s)\n",
DEFAULT_INVERTER_SERIAL_PORT);
fprintf(stderr, " -b | --inv-serial-speed Inverter (via Serial Port) TCP Port (%d)\n",
DEFAULT_INVERTER_SERIAL_SPEED);
fprintf(stderr, "\n");
fprintf(stderr, " -n | --inv-num Inverter number (%d)\n", DEFAULT_INVERTER_NUM);
fprintf(stderr, "\n");
fprintf(stderr, " -i | --interval Logger interval in seconds (%d)\n", DEFAULT_LGR_INTERVAL);
fprintf(stderr, "\n");
fprintf(stderr, " -s | --server-addr Stat Server IP Address (%s)\n", DEFAULT_SERVER_ADDR);
fprintf(stderr, " -r | --server-port Stat Server TCP port (%d)\n", DEFAULT_SERVER_PORT);
fprintf(stderr, " -u | --server-inv-name Stat Server Inverter Name (%s)\n", DEFAULT_SERVER_INVERTER_NAME);
fprintf(stderr, " -t | --server-inv-token Stat Server Inverter Token (%s)\n", DEFAULT_SERVER_INVERTER_TOKEN);
fprintf(stderr, "\n");
fprintf(stderr, "All outputs are on Standard Error.\n");
}
/**
* Logging function
*/
void ui_message(int level, char *where, char *input, ...) {
va_list args;
char datetime[20];
time_t rawtime;
struct tm *timeinfo;
char content[131072];
char prefix[1025];
if (level <= conf->debug_level) {
rawtime = time(NULL);
timeinfo = localtime(&rawtime);
strftime(datetime, 20, "%Y-%m-%d %H:%M:%S", timeinfo);
va_start(args, input);
if (level == UI_ERROR)
sprintf(prefix, "%s [ERROR] {%s} ", datetime, where);
if (level == UI_WARNING)
sprintf(prefix, "%s [WARN] {%s} ", datetime, where);
if (level == UI_INFO)
sprintf(prefix, "%s [INFO] {%s} ", datetime, where);
if (level == UI_DEBUG)
sprintf(prefix, "%s [DEBUG] {%s} ", datetime, where);
fprintf(UI_MESSAGES_OUTPUT, "%s", prefix);
memset(content, '\0', sizeof(content));
vsprintf(content, input, args);
truncate_string(content, UI_MESSAGES_MAX_LENGTH);
fprintf(UI_MESSAGES_OUTPUT, "%s\n", content);
va_end(args);
}
log_file_message(level, prefix, content);
}
|
/*
* drivers/staging/omapdrm/omap_debugfs.c
*
* Copyright (C) 2011 Texas Instruments
* Author: Rob Clark <rob.clark@linaro.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* 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/>.
*/
#include "omap_drv.h"
#include "omap_dmm_tiler.h"
#include "drm_fb_helper.h"
#include <dss.h>
#ifdef CONFIG_DEBUG_FS
static int dss_show(struct seq_file *m, void *arg)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
void (*fxn)(struct seq_file *s) = node->info_ent->data;
fxn(m);
return 0;
}
static int gem_show(struct seq_file *m, void *arg)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev;
struct omap_drm_private *priv = dev->dev_private;
int ret;
ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
return ret;
seq_printf(m, "All Objects:\n");
omap_gem_describe_objects(&priv->obj_list, m);
mutex_unlock(&dev->struct_mutex);
return 0;
}
static int mm_show(struct seq_file *m, void *arg)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev;
return drm_mm_dump_table(m, dev->mm_private);
}
static int fb_show(struct seq_file *m, void *arg)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev;
struct omap_drm_private *priv = dev->dev_private;
struct drm_framebuffer *fb;
int ret;
ret = mutex_lock_interruptible(&dev->mode_config.mutex);
if (ret)
return ret;
ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret) {
mutex_unlock(&dev->mode_config.mutex);
return ret;
}
seq_printf(m, "fbcon ");
omap_framebuffer_describe(priv->fbdev->fb, m);
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
if (fb == priv->fbdev->fb)
continue;
seq_printf(m, "user ");
omap_framebuffer_describe(fb, m);
}
mutex_unlock(&dev->struct_mutex);
mutex_unlock(&dev->mode_config.mutex);
return 0;
}
/* list of debufs files that are applicable to all devices */
static struct drm_info_list omap_debugfs_list[] = {
{"dispc_regs", dss_show, 0, dispc_dump_regs},
{"dispc_clocks", dss_show, 0, dispc_dump_clocks},
{"dss_clocks", dss_show, 0, dss_dump_clocks},
{"dss_regs", dss_show, 0, dss_dump_regs},
#ifdef CONFIG_OMAP2_DSS_DSI
{"dsi_clocks", dss_show, 0, dsi_dump_clocks},
#endif
#ifdef CONFIG_OMAP4_DSS_HDMI
{"hdmi_regs", dss_show, 0, hdmi_dump_regs},
#endif
{"gem", gem_show, 0},
{"mm", mm_show, 0},
{"fb", fb_show, 0},
};
/* list of debugfs files that are specific to devices with dmm/tiler */
static struct drm_info_list omap_dmm_debugfs_list[] = {
{"tiler_map", tiler_map_show, 0},
};
int omap_debugfs_init(struct drm_minor *minor)
{
struct drm_device *dev = minor->dev;
int ret;
ret = drm_debugfs_create_files(omap_debugfs_list,
ARRAY_SIZE(omap_debugfs_list),
minor->debugfs_root, minor);
if (ret) {
dev_err(dev->dev, "could not install omap_debugfs_list\n");
return ret;
}
if (dmm_is_available())
ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
ARRAY_SIZE(omap_dmm_debugfs_list),
minor->debugfs_root, minor);
if (ret) {
dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");
return ret;
}
return ret;
}
void omap_debugfs_cleanup(struct drm_minor *minor)
{
drm_debugfs_remove_files(omap_debugfs_list,
ARRAY_SIZE(omap_debugfs_list), minor);
if (dmm_is_available())
drm_debugfs_remove_files(omap_dmm_debugfs_list,
ARRAY_SIZE(omap_dmm_debugfs_list), minor);
}
#endif
|
/* Creating of Test Data Version 0.1 from 12.11.01 12:15 Uhr */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "kbs_RandomStringFile.h"
#include "kbs_RandomString.h"
#include "randomlib.h"
#include "kbs_Types.h"
#include "kbs_Error.h"
/*--------------------------------------------------------------------------*/
void kbs_make_RandomStringFile(Kbs_Char *testdatafile) {
filesize = 0;
file_ptr = fopen(testdatafile, "wb+");
if (file_ptr == NULL) {
printf("kbs_make_RandomSeqFile - %s failed\n", testdatafile);
exit(EXIT_FAILURE);
}
}
/*--------------------------------------------------------------------------*/
void kbs_open_RandomStringFile(Kbs_Char *testdatafile) {
file_ptr = fopen(testdatafile, "rb");
if (file_ptr == NULL) {
printf("kbs_open_RandomSeqFile - %s failed\n", testdatafile);
exit(EXIT_FAILURE);
}
}
/*--------------------------------------------------------------------------*/
void kbs_close_RandomStringFile(void){
fclose(file_ptr);
}
/*--------------------------------------------------------------------------*/
void kbs_generate_RandomUStringFile(Kbs_Uint alphabetSize, Kbs_Char *filename, Kbs_Ulong seqSize) {
Kbs_Ulong i;
Kbs_Uchar *seq;
kbs_make_RandomStringFile(filename);
seq = (Kbs_Uchar *) malloc(seqSize * sizeof(Kbs_Uchar));
kbsRandomize();
for (i=0; i<seqSize; i++) {
seq[i] = kbs_genRand_UChar(alphabetSize);
}
fwrite(seq, sizeof(Kbs_Uchar), seqSize, file_ptr);
kbs_close_RandomStringFile();
printf("Random file %s generated\n", filename);
}
/*--------------------------------------------------------------------------*/
Kbs_Char *kbs_generate_RandomStringFileName(Kbs_Uint alphabetSize, Kbs_Ulong fileSize) {
Kbs_Char *filename;
filename = (Kbs_Char *) malloc(sizeof(Kbs_Char) * 100);
memset(filename, '\0', 100);
sprintf(filename,"rand_a%d_s%lu", alphabetSize, fileSize);
return filename;
}
/*--------------------------------------------------------------------------*/
Kbs_Char *kbs_generate_PeriodicStrFileName(const Kbs_Uint alphaSize, const Kbs_Ulong periodLen, const Kbs_Ulong strLen) {
Kbs_Char *filename;
filename = (Kbs_Char *) malloc(sizeof(Kbs_Char) * 120);
memset(filename, '\0', 100);
Kbs_Int offset = sprintf(filename,"periodic_a%u", (unsigned int )alphaSize);
offset += sprintf(filename+offset,"_p%lu", (unsigned long )periodLen);
offset += sprintf(filename+offset,"_s%lu", (unsigned long )strLen);
return filename;
}
/*--------------------------------------------------------------------------*/
void kbs_generate_NURandomFiles(Kbs_Uint n, Kbs_Ulong atomarSize, Kbs_Uint alphabetSize){
Kbs_Uint i;
Kbs_Char *filename;
for (i=1; i<=n; i++) {
filename = kbs_generate_RandomStringFileName(alphabetSize, i*atomarSize);
kbs_generate_RandomUStringFile(alphabetSize, filename, i*atomarSize);
free(filename);
}
}
|
/* Lanky -- Scripting Language and Virtual Machine
* Copyright (C) 2014 Sam Olsen
*
* 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 "mach_unary_ops.h"
#define IS_TAGGED(a) ((uintptr_t)(a) & 1)
#define CHECK_EXEC_CUSTOM_IMPL(a, name, interp) \
do { \
if((!(IS_TAGGED(a)) && a->type == LBI_CUSTOM) || (!(IS_TAGGED(a)) && a->type == LBI_CUSTOM_EX)) {\
lky_object *func = lobj_get_member(a, name); \
if(!func || func->type != LBI_FUNCTION) \
break;\
lky_object_function *cfunc = (lky_object_function *)func;\
if(cfunc->callable.argc && cfunc->callable.argc != 2) \
break;\
return un_op_exec_custom(cfunc, interp ); \
} \
} while(0)
lky_object *un_op_exec_custom(lky_object_function *func, struct interp *interp)
{
lky_callable c = func->callable;
//return (lky_object *)c.function(MAKE_BUNDLE(func, NULL));
lky_func_bundle b = MAKE_BUNDLE(func, NULL, interp);
return (lky_object *)c.function(&b);
}
lky_object *lobjb_unary_not(lky_object *a, struct interp *interp)
{
CHECK_EXEC_CUSTOM_IMPL(a, "op_not_", interp);
lky_object_builtin *ac = (lky_object_builtin *)a;
if(IS_TAGGED(a))
return LKY_TESTC_FAST(!OBJ_NUM_UNWRAP(a));
switch(a->type)
{
case LBI_FLOAT:
case LBI_INTEGER:
return LKY_TESTC_FAST(!OBJ_NUM_UNWRAP(ac));
case LBI_BOOL:
return a == &lky_yes ? &lky_no : &lky_yes;
default:
break;
}
return LKY_TESTC_FAST(a == &lky_nil);
}
|
/* compatibility macros, primarily to keep indentation programs
* from going bananas when indenting everything below
#ifdef __cplusplus
'extern "C" {'
#endif
* as if it was a real block, which is just goddamn annoying.
*/
#ifndef _COMPAT_H
#define _COMPAT_H
#ifdef __cplusplus
# define NAGIOS_BEGIN_DECL extern "C" {
# define NAGIOS_END_DECL }
#else
# define NAGIOS_BEGIN_DECL /* nothing */
# define NAGIOS_END_DECL /* more of nothing */
#endif
#endif /* _COMPAT_H */
|
#ifndef __LINUX_NETLINK_H
#define __LINUX_NETLINK_H
#include <linux/socket.h> /* for sa_family_t */
#include <linux/types.h>
#define NETLINK_ROUTE 0 /* Routing/device hook */
#define NETLINK_UNUSED 1 /* Unused number */
#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
#define NETLINK_FIREWALL 3 /* Firewalling hook */
#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
#define NETLINK_XFRM 6 /* ipsec */
#define NETLINK_SELINUX 7 /* SELinux event notifications */
#define NETLINK_ISCSI 8 /* Open-iSCSI */
#define NETLINK_AUDIT 9 /* auditing */
#define NETLINK_FIB_LOOKUP 10
#define NETLINK_CONNECTOR 11
#define NETLINK_NETFILTER 12 /* netfilter subsystem */
#define NETLINK_IP6_FW 13
#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
#define NETLINK_GENERIC 16
/* leave room for NETLINK_DM (DM Events) */
#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
#define NETLINK_ECRYPTFS 19
#define MAX_LINKS 32
struct sockaddr_nl
{
sa_family_t nl_family; /* AF_NETLINK */
unsigned short nl_pad; /* zero */
__u32 nl_pid; /* port ID */
__u32 nl_groups; /* multicast groups mask */
};
struct nlmsghdr
{
__u32 nlmsg_len; /* Length of message including header */
__u16 nlmsg_type; /* Message content */
__u16 nlmsg_flags; /* Additional flags */
__u32 nlmsg_seq; /* Sequence number */
__u32 nlmsg_pid; /* Sending process port ID */
};
/* Flags values */
#define NLM_F_REQUEST 1 /* It is request message. */
#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */
#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
#define NLM_F_ECHO 8 /* Echo this request */
/* Modifiers to GET request */
#define NLM_F_ROOT 0x100 /* specify tree root */
#define NLM_F_MATCH 0x200 /* return all matching */
#define NLM_F_ATOMIC 0x400 /* atomic GET */
#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
/* Modifiers to NEW request */
#define NLM_F_REPLACE 0x100 /* Override existing */
#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */
#define NLM_F_CREATE 0x400 /* Create, if it does not exist */
#define NLM_F_APPEND 0x800 /* Add to end of list */
/*
4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL
4.4BSD CHANGE NLM_F_REPLACE
True CHANGE NLM_F_CREATE|NLM_F_REPLACE
Append NLM_F_CREATE
Check NLM_F_EXCL
*/
#define NLMSG_ALIGNTO 4
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
(struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
(nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
(nlh)->nlmsg_len <= (len))
#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
#define NLMSG_NOOP 0x1 /* Nothing. */
#define NLMSG_ERROR 0x2 /* Error */
#define NLMSG_DONE 0x3 /* End of a dump */
#define NLMSG_OVERRUN 0x4 /* Data lost */
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
struct nlmsgerr
{
int error;
struct nlmsghdr msg;
};
#define NETLINK_ADD_MEMBERSHIP 1
#define NETLINK_DROP_MEMBERSHIP 2
#define NETLINK_PKTINFO 3
struct nl_pktinfo
{
__u32 group;
};
#define NET_MAJOR 36 /* Major 36 is reserved for networking */
enum {
NETLINK_UNCONNECTED = 0,
NETLINK_CONNECTED,
};
/*
* <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
* +---------------------+- - -+- - - - - - - - - -+- - -+
* | Header | Pad | Payload | Pad |
* | (struct nlattr) | ing | | ing |
* +---------------------+- - -+- - - - - - - - - -+- - -+
* <-------------- nlattr->nla_len -------------->
*/
struct nlattr
{
__u16 nla_len;
__u16 nla_type;
};
#define NLA_ALIGNTO 4
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
#endif /* __LINUX_NETLINK_H */
|
/*
OpenMQTTGateway - ESP8266 or Arduino program for home automation
This files enables you to set your parameters for the FASTLED actuator
Copyright: (c)
This file is part of OpenMQTTGateway.
OpenMQTTGateway 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.
OpenMQTTGateway is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef config_FASTLED_h
#define config_FASTLED_h
/*-------------------FASTLED topics & parameters----------------------*/
//FASTLED MQTT Subjects
#define subjectMQTTtoFASTLED "/commands/MQTTtoFASTLED"
#define subjectMQTTtoFASTLEDsetled "/commands/MQTTtoFASTLED/setled" //set only one LED with JSON struct {"led":0-x,"hex":"#000000","blink":true/false}
#define subjectMQTTtoFASTLEDsetbrightness "/commands/MQTTtoFASTLED/setbrightness" //set the brightness 0-255
#define subjectMQTTtoFASTLEDsetanimation "/commands/MQTTtoFASTLED/setanimation" //Animation Fire2012 by Mark Kriegsman
#define subjectGTWFASTLEDtoMQTT "/FASTLEDtoMQTT" //same color on all LEDs in #RRGGBB
// How many leds in your strip?
#define FASTLED_NUM_LEDS 16
// Uncomment/edit one of the following lines for your leds arrangement.
//#define FASTLED_TYPE TM1803
//#define FASTLED_TYPE TM1804
//#define FASTLED_TYPE TM1809
//#define FASTLED_TYPE WS2811
//#define FASTLED_TYPE WS2812
//#define FASTLED_TYPE WS2812B
#define FASTLED_TYPE NEOPIXEL
//#define FASTLED_TYPE APA104
//#define FASTLED_TYPE UCS1903
//#define FASTLED_TYPE UCS1903B
//#define FASTLED_TYPE GW6205
//#define FASTLED_TYPE WS2801, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE SM16716, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE LPD8806, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE P9813, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE APA102, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE DOTSTAR, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE WS2801, DATA_GPIO, CLOCK_GPIO, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE SM16716, DATA_GPIO, CLOCK_GPIO, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE LPD8806, DATA_GPIO, CLOCK_GPIO, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE P9813, DATA_GPIO, CLOCK_GPIO, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE APA102, DATA_GPIO, CLOCK_GPIO, RGB>(leds, NUM_LEDS);
//#define FASTLED_TYPE DOTSTAR, DATA_GPIO, CLOCK_GPIO, RGB>(leds, NUM_LEDS);
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_GPIO. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_GPIO and CLOCK_GPIO
//#define DATA_GPIO 3
//#define CLOCK_GPIO 13
#ifdef ESP8266
//#define FASTLED_ESP8266_RAW_GPIO_ORDER
//#define FASTLED_ESP8266_NODEMCU_GPIO_ORDER
# define FASTLED_ESP8266_D1_GPIO_ORDER
# define FASTLED_DATA_GPIO D2 // only D2 works by me
//#define FASTLED_CLOCK_GPIO 13
#elif ESP32
# define FASTLED_DATA_GPIO 16
# define FASTLED_CLOCK_GPIO 13
#else
# define FASTLED_DATA_GPIO 10
# define FASTLED_CLOCK_GPIO 13
#endif
#endif
|
#include "apue.h"
int main(int argc, char *argv[])
{
int i;
struct stat buf;
char *prt;
for (i = 1; i < argc; i++) {
printf("%s: ", argv[i]);
if (lstat(argv[i], &buf) < 0) {
printf("lstat error\n");
continue;
}
if (S_ISREG(buf.st_mode))
prt = "regular";
else if (S_ISDIR(buf.st_mode))
prt = "directory";
else if (S_ISCHR(buf.st_mode))
prt = "character special";
else if (S_ISBLK(buf.st_mode))
prt = "block special";
else if (S_ISFIFO(buf.st_mode))
prt = "fifo";
else if (S_ISLNK(buf.st_mode))
prt = "symbolic link";
else if (S_ISSOCK(buf.st_mode))
prt = "socket";
else
prt = "** unknown mode **";
printf("%s\n", prt);
}
return 0;
}
|
/*
* arch/arm/mach-ks8695/devices.c
*
* Copyright (C) 2006 Andrew Victor
*
* 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.
*
* 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 <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <mach/irqs.h>
#include "regs-wan.h"
#include "regs-lan.h"
#include "regs-hpna.h"
#include <mach/regs-switch.h>
#include <mach/regs-misc.h>
/* --------------------------------------------------------------------
* Ethernet
* -------------------------------------------------------------------- */
static u64 eth_dmamask = 0xffffffffUL;
static struct resource ks8695_wan_resources[] =
{
[0] = {
.start = KS8695_WAN_PA,
.end = KS8695_WAN_PA + 0x00ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.name = "WAN RX",
.start = KS8695_IRQ_WAN_RX_STATUS,
.end = KS8695_IRQ_WAN_RX_STATUS,
.flags = IORESOURCE_IRQ,
},
[2] = {
.name = "WAN TX",
.start = KS8695_IRQ_WAN_TX_STATUS,
.end = KS8695_IRQ_WAN_TX_STATUS,
.flags = IORESOURCE_IRQ,
},
[3] = {
.name = "WAN Link",
.start = KS8695_IRQ_WAN_LINK,
.end = KS8695_IRQ_WAN_LINK,
.flags = IORESOURCE_IRQ,
},
[4] = {
.name = "WAN PHY",
.start = KS8695_MISC_PA,
.end = KS8695_MISC_PA + 0x1f,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device ks8695_wan_device =
{
.name = "ks8695_ether",
.id = 0,
.dev = {
.dma_mask = ð_dmamask,
.coherent_dma_mask = 0xffffffff,
},
.resource = ks8695_wan_resources,
.num_resources = ARRAY_SIZE(ks8695_wan_resources),
};
static struct resource ks8695_lan_resources[] =
{
[0] = {
.start = KS8695_LAN_PA,
.end = KS8695_LAN_PA + 0x00ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.name = "LAN RX",
.start = KS8695_IRQ_LAN_RX_STATUS,
.end = KS8695_IRQ_LAN_RX_STATUS,
.flags = IORESOURCE_IRQ,
},
[2] = {
.name = "LAN TX",
.start = KS8695_IRQ_LAN_TX_STATUS,
.end = KS8695_IRQ_LAN_TX_STATUS,
.flags = IORESOURCE_IRQ,
},
[3] = {
.name = "LAN SWITCH",
.start = KS8695_SWITCH_PA,
.end = KS8695_SWITCH_PA + 0x4f,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device ks8695_lan_device =
{
.name = "ks8695_ether",
.id = 1,
.dev = {
.dma_mask = ð_dmamask,
.coherent_dma_mask = 0xffffffff,
},
.resource = ks8695_lan_resources,
.num_resources = ARRAY_SIZE(ks8695_lan_resources),
};
static struct resource ks8695_hpna_resources[] =
{
[0] = {
.start = KS8695_HPNA_PA,
.end = KS8695_HPNA_PA + 0x00ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.name = "HPNA RX",
.start = KS8695_IRQ_HPNA_RX_STATUS,
.end = KS8695_IRQ_HPNA_RX_STATUS,
.flags = IORESOURCE_IRQ,
},
[2] = {
.name = "HPNA TX",
.start = KS8695_IRQ_HPNA_TX_STATUS,
.end = KS8695_IRQ_HPNA_TX_STATUS,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device ks8695_hpna_device =
{
.name = "ks8695_ether",
.id = 2,
.dev = {
.dma_mask = ð_dmamask,
.coherent_dma_mask = 0xffffffff,
},
.resource = ks8695_hpna_resources,
.num_resources = ARRAY_SIZE(ks8695_hpna_resources),
};
void __init ks8695_add_device_wan(void)
{
platform_device_register(&ks8695_wan_device);
}
void __init ks8695_add_device_lan(void)
{
platform_device_register(&ks8695_lan_device);
}
void __init ks8696_add_device_hpna(void)
{
platform_device_register(&ks8695_hpna_device);
}
/* --------------------------------------------------------------------
* Watchdog
* -------------------------------------------------------------------- */
static struct platform_device ks8695_wdt_device =
{
.name = "ks8695_wdt",
.id = -1,
.num_resources = 0,
};
static void __init ks8695_add_device_watchdog(void)
{
platform_device_register(&ks8695_wdt_device);
}
/* -------------------------------------------------------------------- */
/*
* These devices are always present and don't need any board-specific
* setup.
*/
static int __init ks8695_add_standard_devices(void)
{
ks8695_add_device_watchdog();
return 0;
}
arch_initcall(ks8695_add_standard_devices);
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 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.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../rct2.h"
#include "../world/footpath.h"
static void window_editor_main_paint(rct_window *w, rct_drawpixelinfo *dpi);
static rct_window_event_list window_editor_main_events = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_editor_main_paint,// 0x0066FC97, // window_editor_main_paint,
NULL,
};
static rct_widget window_editor_main_widgets[] = {
{ WWT_VIEWPORT, 0, 0, 0xFFFF, 0, 0xFFFF, 0xFFFFFFFE, 0xFFFF },
{ WIDGETS_END },
};
/**
* Creates the main editor window that holds the main viewport.
* rct2: 0x0066EF38
*/
rct_window * window_editor_main_open()
{
window_editor_main_widgets[0].right = gScreenWidth;
window_editor_main_widgets[0].bottom = gScreenHeight;
rct_window *window = window_create(0, 0, window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom,
&window_editor_main_events, WC_MAIN_WINDOW, WF_STICK_TO_BACK);
window->widgets = window_editor_main_widgets;
viewport_create(window, window->x, window->y, window->width, window->height, 0, 0x0FFF, 0x0FFF, 0, 0x1, -1);
window->viewport->flags |= 0x0400;
gCurrentRotation = 0;
gShowGridLinesRefCount = 0;
gShowLandRightsRefCount = 0;
gShowConstuctionRightsRefCount = 0;
gFootpathSelectedType = 0;
window_top_toolbar_open();
window_editor_bottom_toolbar_open();
return window_get_main();
}
/**
*
* rct2: 0x0066FC97
* This function immediately jumps to 0x00685BE1
*/
static void window_editor_main_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
viewport_render(dpi, w->viewport, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height);
}
|
//
// DVBCommon.h
// dvach-browser
//
// Created by Andy on 28/08/15.
// Copyright (c) 2015 8of. All rights reserved.
//
#import <Foundation/Foundation.h>
#define NSLS(__KEY__) NSLocalizedString(__KEY__, __KEY__)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
// Strongify / weakify
#define weakify(var) __weak typeof(var) AHKWeak_##var = var;
#define strongify(var) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
__strong typeof(var) var = AHKWeak_##var; \
_Pragma("clang diagnostic pop")
|
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/* This code is based on the PVFS2 ADIO module in ROMIO
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ompi_config.h"
#include "fs_pvfs2.h"
#include <fcntl.h>
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_close_pvfs2
*
* Function: - closes a new file
* Accepts: - file handle
* Returns: - Success if file closed
*/
int
mca_fs_pvfs2_file_close (mca_io_ompio_file_t *fh)
{
if (NULL != fh->f_fs_ptr) {
free (fh->f_fs_ptr);
fh->f_fs_ptr = NULL;
}
/*
fh->f_comm->c_coll.coll_barrier (fh->f_comm,
fh->f_comm->c_coll.coll_barrier_module);
close (fh->fd);
*/
return OMPI_SUCCESS;
}
|
#include <cmath>
#include <algorithm>
#include <armadillo>
using namespace std;
using namespace arma;
class FilterClass
{
public:
FilterClass( double samplerate, int N );
~FilterClass();
double BilinearConstant(float wc, double T);
void SoftInput(float f);
void LPcoef();
void HPcoef();
void Bilinear1();
void LPComputeCoef(float f);
void HPComputeCoef(float f);
void F1(double f, vec *u, bool lp);
void LPF1(double f, vec *u);
void HPF1(double f, vec *u);
vec y; //Sinal de saída
//protected:
int N; // Tamanho dos vetores
double SampleRate; //Frequência de amostragem em Hz
double T; //Periodo de amostragem em segundos
//Condições iniciais:
double u_1;
double y_1;
/*Coeficientes de Laplace:
bn s^n + ... b1 s + b0
H(s) = ------------------------
an s^n + ... a1 s + a0
*/
vec b0;
vec b1;
vec a0;
vec a1;
/*Coeficientes em Z:
B_0 + B_1 z^{-1} + ... B_n z^{-n}
H(z) = ----------------------------------
A_0 + A_1 z^{-1} + ... A_n z^{-n}
*/
vec B0;
vec B1;
vec A0;
vec A1;
vec c; // Constante da transformação bilinear
double wc; //Frequencia de corte ou central em rad/s
double wc_1; //Frequencia de corte ou central em rad/s anterior
vec vwc;
float f_1; //Entrada anterior
//Variáveis auxiliares
double _a1_;
double _b0_;
double _wc_;
};
class FilterClass2:public FilterClass
{
public:
FilterClass2(double samplerate, int N);
~FilterClass2();
void LP2coef();
void HP2coef();
void F3coef();
void Bilinear2();
void LP2ComputeCoef(float f);
void HP2ComputeCoef(float f);
void F3ComputeCoef(float f);
void F2(double f, vec *u, bool lp);
void LPF2(double f, vec *u);
void HPF2(double f, vec *u);
//protected:
//Condições iniciais:
double u_2;
double y_2;
//Coeficientes de Laplace:
vec b2;
vec a2;
//Coeficientes em Z:
vec B2;
vec A2;
};
class FilterClass3
{
public:
FilterClass3(double samplerate, int N);
~FilterClass3();
void _P3ComputeCoef(float f, bool lp);
void F3(double f, vec *u, bool lp);
void LPF3(double f, vec *u);
void HPF3(double f, vec *u);
vec y; //Sinal de saída
//protected:
int N; // Tamanho dos vetores
FilterClass *filter1;
FilterClass2 *filter2;
mat A1;
mat A2;
mat B0;
mat B1;
mat B2;
mat Y;
vec Y_1;
vec Y_2;
double u_1;
double u_2;
float f_1;
};
|
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include "errors.h"
void errAcronym(int ECode)
{
params.ecode = ECode;
switch (params.ecode)
{
default:
fprintf(stderr, "%s", ECODEMSG[params.ecode]);
break;
}
getchar();
exit(params.ecode);
}
|
/*
The MIT License
Copyright (c) 2017 Thomas Sarlandie thomas@sarlandie.net
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include "Kommand.h"
class KommandReader {
private:
size_t index;
const uint8_t *buffer;
size_t size;
public:
/**
* Creates a new KommandReader to help parse the Kommand in buffer.
*
* The buffer will not be copied and must remain valid as long
* as you are using the buffer!
*
* Note that all the readX() functions will automatically skip the
* KommandIdentifier.
*
* Size here should be the total size of the buffer. This is different
* from the dataSize() method which returns the size of the data.
*
* Passing a packer with size less than 2 will cause all the functions to
* return 0.
*/
KommandReader(const uint8_t *buffer, size_t size);
/**
* Returns the KommandIdentifier for this Kommand.
*/
uint16_t getKommandIdentifier() const;
/**
* Read the next byte and advance pointer by 1.
*/
uint8_t read8();
/**
* Read the next two bytes and advance pointer by 2.
*/
uint16_t read16();
/**
* Read the next four bytes and advance pointer by 4.
*/
uint32_t read32();
/**
* Read null-terminated string and advance pointer to end of string.
*
* @return a null terminated string or NULL if there was no null terminated
* string in buffer.
*/
const char *readNullTerminatedString();
/**
* Gets a pointer to the data.
*/
const uint8_t* dataBuffer() const;
/**
* Get the current value of the reading index.
*/
size_t dataIndex() const;
/**
* Start reading from the beginning of the packet again.
* (The first byte after the KommandIdentifier header.
*/
void reset();
/**
* Returns the size of the data.
*/
size_t dataSize() const;
};
|
//
// XSFileManager.h
// Xenonscript
//
// Created by Chen Zhibo on 8/25/15.
// Copyright © 2015 Chen Zhibo. All rights reserved.
//
#import "XSObject.h"
@interface XSFileManager : XSObject
@property (strong, nonatomic) XSFileManager *fileManager;
@end
|
#ifndef VRDISPLAY_H
#define VRDISPLAY_H
#include <Windows.h>
//This requires a RGBA input mat (pass in the data pointer, not the Mat itself)
void UpdateTexture(unsigned char* left, unsigned char* right);
bool Initalize_VR(HINSTANCE hinst, unsigned int output_width, unsigned int output_height);
bool Main_VR_Render_Loop();
void Exit_VR();
#endif
|
/*
Copyright (C) 2010 Gavin Schultz
This file is part of Asterad.
Asterad 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.
Asterad 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 Asterad. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ASTEROID_INC
#define ASTEROID_INC
#define ASTEROID_POINTS 11 /* number of points on an asteroid */
#define ASTEROID_RADIUS 20.0f /* radius of largest asteroid */
#define ASTEROID_SPEED 42.0f
#define ASTEROID_CHUNKS 2 /* number of chunks when an asteroid breaks */
#include "graphics.h"
#include "geometry2d.h"
#include "debug.h"
typedef struct Asteroid
{
PRIMITIVE primitive; // primitive defining points, position, movement of asteroid etc
struct OpenGLColor color; // the color (in hex RGB e.g. 0xFFFFFF) of the ship
int life; // number of hits the asteroid needs to take to be completely destroyed
float radius; // radius of the asteroid - although not circular, radius still determines the size
struct Asteroid *next;
struct Asteroid *prev;
} ASTEROID;
ASTEROID *create_asteroid(float speed, float angle, float radius, int life);
void add_asteroid(ASTEROID **list, ASTEROID *new_ast);
void delete_asteroid(ASTEROID **list, ASTEROID *to_delete);
void clear_asteroids(ASTEROID **list);
void break_asteroid(ASTEROID **list, ASTEROID *to_break);
#endif
|
#ifndef SNDDEF_H
#define SNDDEF_H
#if defined HAVE_SNDFILE && defined DYN_SNDFILE
#define DEFINE_ENTRY(type, name) static TReqProc<SndFileModule, type> p_##name{#name};
DEFINE_ENTRY(int (*)(SNDFILE *sndfile), sf_close)
DEFINE_ENTRY(SNDFILE* (*)(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data), sf_open_virtual)
DEFINE_ENTRY(sf_count_t (*)(SNDFILE *sndfile, float *ptr, sf_count_t frames), sf_readf_float)
DEFINE_ENTRY(sf_count_t (*)(SNDFILE *sndfile, sf_count_t frames, int whence), sf_seek)
#undef DEFINE_ENTRY
#ifndef IN_IDE_PARSER
#define sf_close p_sf_close
#define sf_open_virtual p_sf_open_virtual
#define sf_readf_float p_sf_readf_float
#define sf_seek p_sf_seek
#endif
#endif
#endif
|
#pragma once
#include "../Shared.h"
#include "IPlayoutCommand.h"
#include "IRundownWidget.h"
#include "ui_RundownLevelsWidget.h"
#include "GpiDevice.h"
#include "Global.h"
#include "Commands/ICommand.h"
#include "Commands/LevelsCommand.h"
#include "Models/LibraryModel.h"
#include <QtCore/QString>
#include <QtGui/QWidget>
class WIDGETS_EXPORT RundownLevelsWidget : public QWidget, Ui::RundownLevelsWidget, public IRundownWidget, public IPlayoutCommand
{
Q_OBJECT
public:
explicit RundownLevelsWidget(const LibraryModel& model, QWidget* parent = 0,
const QString& color = Color::DEFAULT_MIXER_COLOR, bool active = false,
bool inGroup = false, bool disconnected = false);
virtual IRundownWidget* clone();
virtual bool isGroup() const;
virtual ICommand* getCommand();
virtual LibraryModel* getLibraryModel();
virtual void setActive(bool active);
virtual void setInGroup(bool inGroup);
virtual void setColor(const QString& color);
virtual void setExpanded(bool expanded) {}
virtual bool executeCommand(enum Playout::PlayoutType::Type type);
protected:
virtual bool eventFilter(QObject* target, QEvent* event);
private:
bool active;
bool inGroup;
bool disconnected;
QString color;
LibraryModel model;
LevelsCommand command;
void checkEmptyDevice();
void checkGpiTriggerable();
Q_SLOT void executeClear();
Q_SLOT void executeClearVideolayer();
Q_SLOT void executeClearChannel();
Q_SLOT void channelChanged(int);
Q_SLOT void executePlay();
Q_SLOT void executeStop();
Q_SLOT void videolayerChanged(int);
Q_SLOT void delayChanged(int);
Q_SLOT void allowGpiChanged(bool);
Q_SLOT void gpiDeviceConnected(bool, GpiDevice*);
};
|
/*
Copyright (C) 2015 The newt Authors.
This file is part of newt.
newt 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.
newt 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 newt. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TYPE_TABLE_H_
#define TYPE_TABLE_H_
#include <type.h>
#include <map>
#include <set>
#include <alias_definition.h>
#include <complex_type_specifier.h>
#include <search_type.h>
#include <modifier.h>
class TypeDefinition;
class SymbolContext;
class UnitType;
typedef map<const string, const_shared_ptr<TypeDefinition>> type_map;
class Indent;
/**
* A map from names to type definitions
*
* Type tables are meant to be immutable, as they define the interior structure of complex types.
* The RemoveTypeDefinition logic must be used with care.
*/
class TypeTable {
public:
TypeTable(const shared_ptr<TypeTable> parent = nullptr);
TypeTable(const shared_ptr<type_map> table,
const shared_ptr<TypeTable> parent = nullptr);
virtual ~TypeTable();
const shared_ptr<TypeTable> Clone() const;
const shared_ptr<TypeTable> WithParent(
const shared_ptr<TypeTable> parent) const;
void AddType(const string& name,
const_shared_ptr<TypeDefinition> definition);
template<class T> const shared_ptr<const T> GetType(
const_shared_ptr<ComplexTypeSpecifier> type_specifier,
const SearchType search_type,
AliasResolution resolution = RESOLVE) const {
return GetType<T>(*type_specifier, search_type, resolution);
}
template<class T> const shared_ptr<const T> GetType(
const ComplexTypeSpecifier& type_specifier,
const SearchType search_type,
AliasResolution resolution = RESOLVE) const {
return GetType<T>(type_specifier.GetTypeName(), search_type, resolution);
}
template<class T> const shared_ptr<const T> GetType(
const_shared_ptr<std::string> name, const SearchType search_type,
AliasResolution resolution = RESOLVE) const {
return GetType<T>(*name, search_type, resolution);
}
template<class T> const shared_ptr<const T> GetType(const std::string& name,
const SearchType search_type,
AliasResolution resolution = RESOLVE) const {
if (name == *GetNilName()) {
auto value = GetNilType();
auto cast = dynamic_pointer_cast<const T>(value);
if (cast) {
return cast;
}
}
auto result = m_table->find(name);
if (result != m_table->end()) {
shared_ptr<const TypeDefinition> value = result->second;
if (resolution == RESOLVE) {
// handle aliases
auto as_alias =
std::dynamic_pointer_cast<const AliasDefinition>(value);
if (as_alias) {
value = as_alias->GetOrigin();
}
}
auto cast = dynamic_pointer_cast<const T>(value);
if (cast) {
return cast;
}
} else if (search_type == SearchType::DEEP) {
if (auto lock = m_parent.lock()) {
return lock->GetType<T>(name, search_type, resolution);
}
}
return shared_ptr<const T>();
}
/**
* If a member with the specified name C++ type exists, replace it with the specified type definition.
*/
template<class T> void ReplaceTypeDefinition(const string& name,
const_shared_ptr<TypeDefinition> definition) {
auto existing = m_table->find(name);
if (std::dynamic_pointer_cast<const T>(existing->second)) {
m_table->erase(existing);
AddType(name, definition);
}
}
template<class T> void ReplaceTypeDefinition(
const_shared_ptr<std::string> name,
const_shared_ptr<TypeDefinition> definition) {
ReplaceTypeDefinition<T>(*name, definition);
}
template<class T> void RemoveTypeDefinition(const string& name) {
auto existing = m_table->find(name);
if (std::dynamic_pointer_cast<const T>(existing->second)) {
m_table->erase(existing);
}
}
template<class T> void RemoveTypeDefinition(
const_shared_ptr<std::string> name) {
RemoveTypeDefinition<T>(*name);
}
volatile_shared_ptr<SymbolContext> GetDefaultSymbolContext(
const Modifier::Type modifiers,
const_shared_ptr<ComplexTypeSpecifier> container) const;
const bool ContainsType(const ComplexTypeSpecifier& type_specifier);
const bool ContainsType(const string& name);
const void print(ostream &os, const Indent& indent,
const SearchType search_type = SHALLOW) const;
const static string DefaultTypeName;
static volatile_shared_ptr<TypeTable> GetDefault();
const uint CountEntriesOfType(const ComplexTypeSpecifier& current,
const TypeSpecifier& type_specifier) const;
/**
* Return the _first_ name that is mapped to the given specifier.
*/
const std::string MapSpecifierToName(const ComplexTypeSpecifier& current,
const TypeSpecifier& other) const;
const_shared_ptr<std::set<std::string>> GetTypeNames() const;
static const_shared_ptr<std::string> GetNilName();
static const_shared_ptr<UnitType> GetNilType();
static const_shared_ptr<ComplexTypeSpecifier> GetNilTypeSpecifier();
const weak_ptr<TypeTable> GetParent() const {
return m_parent;
}
private:
const shared_ptr<type_map> m_table;
const weak_ptr<TypeTable> m_parent;
};
#endif /* TYPE_TABLE_H_ */
|
#include <stdio.h>
typedef struct {
int a;
int b;
char *name;
} micro_test;
#define begin static const micro_test mt_table[] = {
#define end { ~0, 0, ""} };
#define test(name, a, b) {a, b, #name},
int main()
{
begin
test(TEST1, 1, 1)
test(TEST2, 2, 2)
test(TEST3, 3, 3)
end
printf("mt table 0 name %s, a %d, b %d\n", mt_table[0].name, mt_table[0].a, mt_table[0].b);
printf("mt table 1 name %s, a %d, b %d\n", mt_table[1].name, mt_table[1].a, mt_table[1].b);
printf("mt table 2 name %s, a %d, b %d\n", mt_table[2].name, mt_table[2].a, mt_table[2].b);
return 0;
}
|
//
// ZGRefreshFooterView.h
// ZGRefresh
//
// Created by Zong on 16/3/8.
// Copyright © 2016年 Zong. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,ZGRefreshFooterViewStyle)
{
ZGRefreshFooterViewStyleDefault,
};
@interface ZGRefreshFooterView : UIView
+ (nullable instancetype)refreshFooterViewWithTarget:(nullable id)target action:(nullable SEL)action style:(ZGRefreshFooterViewStyle)style;
- (nullable instancetype)initWithTarget:(nullable id)target action:(nullable SEL)action;
@property (nonatomic, weak) id target;
@property (nonatomic, assign) SEL action;
@property (nonatomic, assign) BOOL isFreshing;
@property (weak, nonatomic) UIScrollView *scrollView;
- (void)endRefresh;
@end
|
int len()
{
int i;
unsigned v = (unsigned)~0;
for (i = 1; (v = v >> 1) > 0; i++)
;
return i;
}
unsigned rightrot(unsigned x, int n)
{
int l = len();
unsigned rbits;
if ((n = n % l) > 0){
rbits = ~(~0 << n) & x;
rbits = rbits << (l - n);
x = x >> n;
x = x | rbits;
}
return x;
}
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CPPQTSTYLEINDENTER_H
#define CPPQTSTYLEINDENTER_H
#include "cpptools_global.h"
#include <texteditor/indenter.h>
namespace TextEditor
{
class ICodeStylePreferences;
}
namespace CppTools {
class CppCodeStyleSettings;
class CppCodeStylePreferences;
class CPPTOOLS_EXPORT CppQtStyleIndenter : public TextEditor::Indenter
{
public:
CppQtStyleIndenter();
virtual ~CppQtStyleIndenter();
virtual bool isElectricCharacter(const QChar &ch) const;
virtual void indentBlock(QTextDocument *doc,
const QTextBlock &block,
const QChar &typedChar,
const TextEditor::TabSettings &tabSettings);
virtual void indent(QTextDocument *doc,
const QTextCursor &cursor,
const QChar &typedChar,
const TextEditor::TabSettings &tabSettings);
virtual void setCodeStylePreferences(TextEditor::ICodeStylePreferences *preferences);
virtual void invalidateCache(QTextDocument *doc);
private:
CppCodeStyleSettings codeStyleSettings() const;
CppCodeStylePreferences *m_cppCodeStylePreferences;
};
} // CppTools
#endif // CPPQTSTYLEINDENTER_H
|
/***************************************************************************
* This file is part of ArmSTALKER.
*
* ArmSTALKER 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.
*
* ArmSTALKER 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 ArmSTALKER. If not, see <http://www.gnu.org/licenses/>.
***************************************************************************/
#ifndef ARMSTALKER_GAME_SETTINGS_VIEW_H
#define ARMSTALKER_GAME_SETTINGS_VIEW_H
#include <QWidget>
#include <src/core/base/view/BaseView.h>
#include <src/launcher/gameSettings/services/GameSettingsService.h>
#include "ui_GameSettings.h"
class GameSettingsView : public BaseView {
Q_OBJECT
public:
GameSettingsView();
~GameSettingsView();
private:
void saveSettings();
Ui::GameSettingsView *ui;
GameSettingsService *gameSettingsService;
private slots:
void onResume() override;
void onStop() override;
void onGamePathBrowse();
public:
};
#endif //ARMSTALKER_GAME_SETTINGS_VIEW_H
|
#include <stdio.h>
#include <stdlib.h>
//#include <cctype>
//#include <iomanip>
#include <iostream>
#include "Menu.h"
#include "Engine.h"
#define INT_TO_CHAR(number) 0x30+number
/*PROTOTYPES*/
//Checks if a code is valid
void checkCode();
//
void codeInput(char code[]);
//
void checkVerification(char code[]);
//
bool checkNumberOne(char code[]);
//
bool checkNumberTwo(char code[]);
//
bool checkNumberThree(char code[]);
//
bool checkNumberFour(char code[]);
//
bool checkNumberFive(char code[]);
|
//
// UMGSMMAP_LSAInformation.h
// ulibgsmmap
//
// Copyright © 2017 Andreas Fink (andreas@fink.org). All rights reserved.
//
// This source is dual licensed either under the GNU GENERAL PUBLIC LICENSE
// Version 3 from 29 June 2007 and other commercial licenses available by
// the author.
//
#import <ulibasn1/ulibasn1.h>
#import "UMGSMMAP_asn1_protocol.h"
#import "UMGSMMAP_LSAOnlyAccessIndicator.h"
#import "UMGSMMAP_LSADataList.h"
#import "UMGSMMAP_ExtensionContainer.h"
@interface UMGSMMAP_LSAInformation : UMASN1Sequence<UMGSMMAP_asn1_protocol>
{
NSString *operationName;
BOOL completeDataListIncluded;
UMGSMMAP_LSAOnlyAccessIndicator *lsaOnlyAccessIndicator;
UMGSMMAP_LSADataList *lsaDataList;
UMGSMMAP_ExtensionContainer *extensionContainer;
}
@property(readwrite,strong) NSString *operationName;
@property(readwrite,assign) BOOL completeDataListIncluded;
@property(readwrite,strong) UMGSMMAP_LSAOnlyAccessIndicator *lsaOnlyAccessIndicator;
@property(readwrite,strong) UMGSMMAP_LSADataList *lsaDataList;
@property(readwrite,strong) UMGSMMAP_ExtensionContainer *extensionContainer;
- (void)processBeforeEncode;
- (UMGSMMAP_LSAInformation *)processAfterDecodeWithContext:(id)context;
- (NSString *)objectName;
- (id)objectValue;
- (UMASN1Object<UMGSMMAP_asn1_protocol> *)decodeASN1opcode:(int64_t)opcode
operationType:(UMTCAP_InternalOperation)operation
operationName:(NSString **)xop
withContext:(id)context;
- (UMGSMMAP_LSAInformation *)initWithString:(NSString *)str;
@end
|
/* Simple Terminal program to test input/output.
Copyright:
This program is free software. See accompanying LICENSE file.
Author:
(C) 2016 Jörg Seebohn
*/
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
// change value to 1 if DTR should be set to high
#define CONFIG_SET_DTR_HIGH 0
int main(int argc, const char *argv[])
{
int fd;
char key[255];
char data[255];
size_t bi;
struct termios old_stdin_tconf;
struct termios saved_options;
struct termios options;
struct pollfd fds;
struct {
speed_t speed;
const char* name;
} baudrate[] = {
{ B9600, "9600" }, { B19200, "19200" }, { B38400, "38400" },
{ B57600, "57600" }, { B115200, "115200" }, { B230400, "230400" }
};
if (argc != 4 || strcmp(argv[3], "8N1")) {
USAGE:
printf("Usage: %s /dev/ttyXXX <baudrate> 8N1\n", argv[0]);
exit(1);
}
fd = open(argv[1], O_RDWR|O_NOCTTY|O_NONBLOCK|O_CLOEXEC);
if (fd == -1) {
perror("open");
exit(1);
}
if (tcgetattr(0, &old_stdin_tconf)) {
perror("tcgetattr");
exit(1);
}
if (tcgetattr(fd, &saved_options)) {
perror("tcgetattr");
exit(1);
}
for (bi = 0; bi < sizeof(baudrate)/sizeof(baudrate[0]); ++bi) {
if (strcmp(baudrate[bi].name, argv[2]) == 0) break;
}
if (bi == sizeof(baudrate)/sizeof(baudrate[0])) {
errno = EINVAL;
perror("Unsupported baudrate");
printf("Supported baudrates:");
for (bi = 0; bi < sizeof(baudrate)/sizeof(baudrate[0]); ++bi) {
printf(" %s", baudrate[bi].name);
}
printf("\n");
exit(1);
}
options = saved_options;
options.c_cflag |= (CLOCAL|CREAD);
options.c_lflag &= ~(ICANON | ECHO | ECHOE);
options.c_iflag &= ~(IXON | IXOFF | IXANY); // no software flow control
options.c_iflag &= ~(ICRNL);
options.c_oflag &= ~(OPOST|OCRNL);
cfsetispeed(&options, baudrate[bi].speed);
cfsetospeed(&options, baudrate[bi].speed);
if (0 == strcmp(argv[3], "8N1")) {
options.c_cflag |= (CLOCAL|CREAD);
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8;
} else {
errno = EINVAL;
perror("Unsupported format");
goto USAGE;
}
if (tcsetattr(fd, TCSANOW, &options)) {
perror("tcsetattr");
exit(1);
}
// switch stdin/stdout (terminal/keyboard) to single character mode
{
struct termios tconf = old_stdin_tconf;
int fl = fcntl(0, F_GETFL);
fcntl(0, F_SETFL, (fl != -1 ? fl:0)|O_NONBLOCK);
tconf.c_iflag &= (unsigned) ~(IXON|ICRNL|INLCR);
tconf.c_oflag &= (unsigned) ~(OCRNL);
tconf.c_oflag |= (unsigned) (ONLCR); // map \n to \r\n on output
tconf.c_lflag &= (unsigned) ~(ICANON/*char mode*/ | ECHO/*echo off*/ | ISIG);
tconf.c_cc[VMIN] = 1;
tconf.c_cc[VTIME] = 0;
tcsetattr(0, TCSANOW, &tconf);
}
if (CONFIG_SET_DTR_HIGH) {
// set DTR high
int flag = TIOCM_DTR;
ioctl(fd, TIOCMBIS, &flag);
}
printf("Press <CTRL>-D to end program\n");
fds.fd = fd;
fds.events = POLLIN;
for (;;) {
if (1 == poll(&fds, 1, 100)) {
int bytes = read(fd, data, sizeof(data));
if (bytes == -1) {
if (errno == EAGAIN) continue;
perror("read");
goto DONE;
}
write(1, data, bytes);
}
int nrkeys = read(0, key, sizeof(key));
if (nrkeys > 0) {
if (key[nrkeys-1] == old_stdin_tconf.c_cc[VEOF]) {
write(fd, key, nrkeys-1);
break;
} else {
write(fd, key, nrkeys);
}
}
}
DONE:
tcsetattr(0, TCSANOW, &old_stdin_tconf);
tcsetattr(fd, TCSANOW, &saved_options);
close(fd);
return 0;
}
|
#pragma once
#include <fa_nuklear.h>
#include <input/inputmanager.h>
namespace NuklearMisc
{
void handleNuklearMouseEvent(nk_context* ctx, int32_t x, int32_t y, Input::Key key, bool isDown, bool isDoubleClick);
void handleNuklearMouseMoveEvent(nk_context* ctx, int32_t x, int32_t y, int32_t xrel, int32_t yrel);
void handleNuklearMouseWheelEvent(nk_context* ctx, int32_t x, int32_t y);
void handleNuklearKeyboardEvent(nk_context* ctx, bool isDown, Input::Key sym, Input::KeyboardModifiers mods);
void handleNuklearTextInputEvent(nk_context* ctx, const std::string& inp);
}
|
#include <stdint.h>
void main() {
int32_t a;
a = 1;
a ^= 2;
}
|
/*
This file is part of StitcHD.
StitcHD 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.
StitcHD 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 StitcHD. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPU_STITCH_HPP
#define GPU_STITCH_HPP 1
#include <vector>
#include <iostream>
#include <opencv2/core/core.hpp>
//#include "cuda_runtime.h"
using namespace std;
using namespace cv;
namespace GpuStitch
{
__declspec(dllexport)
struct StitchParams
{
StitchParams()
{
interpolate = true;
alphaBlend = 2;
expBlendValue = 50;
shift = 0;
hardShift = false;
}
bool interpolate;
int alphaBlend;
float expBlendValue;
int shift;
bool hardShift;
};
__declspec(dllexport)
Mat stitch_gpu(
vector<Mat> matSrc,
vector<Mat> matHmg,
StitchParams params
);
}
#endif
|
#ifndef __APPLICATION_CPP__
#define __APPLICATION_CPP__
#include<list>
#include "Globals.h"
#include "Module.h"
class ModuleRender;
class ModuleWindow;
class ModuleTextures;
class ModuleInput;
class ModuleAudio;
class ModuleFadeToBlack;
class ModuleCollision;
class ModuleParticles;
// Game modules ---
class ModulePlayer;
class ModuleEnemy;
class ModuleSceneIntro;
class ModuleStage1;
class ModuleFonts;
class Application
{
public:
Application();
~Application();
bool Init();
update_status Update();
bool CleanUp();
public:
ModuleRender* renderer;
ModuleWindow* window;
ModuleTextures* textures;
ModuleInput* input;
ModuleAudio* audio;
ModuleFadeToBlack* fade;
ModuleCollision* collision;
ModuleParticles* particles;
// Game modules ---
ModulePlayer* player;
ModuleEnemy* enemy;
ModuleSceneIntro* scene_intro;
ModuleStage1* scene_space;
ModuleFonts* fonts;
private:
std::list<Module*> modules;
};
extern Application* App;
#endif // __APPLICATION_CPP__
|
#ifndef ID_API_TRANSPORT_H
#define ID_API_TRANSPORT_H
#endif
|
/*
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "oshmem_config.h"
#include <stdio.h>
#include "oshmem/mca/mca.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "oshmem/util/oshmem_util.h"
#include "oshmem/mca/memheap/memheap.h"
#include "oshmem/mca/memheap/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_component_t struct.
*/
#include "oshmem/mca/memheap/base/static-components.h"
int mca_memheap_base_output = -1;
int mca_memheap_base_key_exchange = 1;
opal_list_t mca_memheap_base_components_opened = {{0}};
int mca_memheap_base_already_opened = 0;
mca_memheap_map_t mca_memheap_base_map = {{{0}}};
static int mca_memheap_base_register(mca_base_register_flag_t flags)
{
(void) mca_base_var_register("oshmem",
"memheap",
"base",
"key_exchange",
"0|1 - disabled, enabled(default) force memory keys exchange",
MCA_BASE_VAR_TYPE_INT,
NULL,
0,
MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&mca_memheap_base_key_exchange);
return OSHMEM_SUCCESS;
}
static int mca_memheap_base_close(void)
{
if (mca_memheap_base_already_opened <= 0) {
return OSHMEM_ERROR;
}
mca_memheap_base_already_opened--;
if (mca_memheap_base_already_opened > 0) {
return OSHMEM_SUCCESS;
}
memheap_oob_destruct();
mca_memheap_base_dereg(&mca_memheap_base_map);
mca_memheap_base_alloc_exit(&mca_memheap_base_map);
mca_memheap_base_static_exit(&mca_memheap_base_map);
/* Close all remaining available components */
return mca_base_framework_components_close(&oshmem_memheap_base_framework, NULL);
}
static int mca_memheap_base_open(mca_base_open_flag_t flags)
{
mca_memheap_base_already_opened = mca_memheap_base_already_opened + 1;
if (mca_memheap_base_already_opened > 1) {
return OSHMEM_SUCCESS;
}
memset(&mca_memheap_base_map, 0, sizeof(mca_memheap_base_map));
mca_memheap_base_map.n_segments = 0;
mca_memheap_base_map.num_transports = 0;
oshmem_framework_open_output(&oshmem_memheap_base_framework);
/* Open up all available components */
if (OPAL_SUCCESS !=
mca_base_framework_components_open(&oshmem_memheap_base_framework, flags)) {
return OSHMEM_ERROR;
}
return OSHMEM_SUCCESS;
}
MCA_BASE_FRAMEWORK_DECLARE(oshmem, memheap,
"OSHMEM MEMHEAP",
mca_memheap_base_register,
mca_memheap_base_open,
mca_memheap_base_close,
mca_memheap_base_static_components,
MCA_BASE_FRAMEWORK_FLAG_DEFAULT);
|
//
// JulebuViewController.h
// league
//
// Created by long-laptop on 2016/11/7.
// Copyright © 2016年 long-laptop. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
#import "CoachChooseTableViewCell.h"
#import "CreateClubViewController.h"
#import "DongtaiViewController.h"
#import "MemberViewController.h"
#import "ClubOBJ.h"
@interface JulebuViewController : QMUICommonViewController <UIAlertViewDelegate,UITableViewDelegate , UITableViewDataSource>
@property (nonatomic , strong) UITableView *soTableView;
-(void) gotojiaoLianDetail : (NSString *)phone ;
-(void) gotoQiuDetail : (NSString *)phone ;
@end
|
/**
* Copyrights reserved to the author (Adil Ben Moussa <adil.benmoussa@gmail.com>) of this code (available from Github
* repository https://github.com/adilbenmoussa/give-me-coins-iOSMonitoringApp
*
*
* This file is part of Give-me-coins.com Dashboard iOS App
*
* Give-me-coins.com Dashboard 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/>.
*/
#import <UIKit/UIKit.h>
#import "ZBarSDK.h"
@interface SettingsController : UIViewController <ZBarReaderDelegate>{
UITextView *apiText;
UITextView *descriptionText;
UIButton *saveSettingsButton;
UIButton *deleteSettingsButton;
UISwitch *btcSwitch;
UISwitch *ltcSwitch;
UISwitch *ftcSwitch;
}
@property (nonatomic, retain) IBOutlet UITextView *apiText;
@property (nonatomic, retain) IBOutlet UITextView *descriptionText;
@property (nonatomic, retain) IBOutlet UIButton *saveSettingsButton;
@property (nonatomic, retain) IBOutlet UIButton *deleteSettingsButton;
@property (nonatomic, retain) IBOutlet UISwitch *btcSwitch;
@property (nonatomic, retain) IBOutlet UISwitch *ltcSwitch;
@property (nonatomic, retain) IBOutlet UISwitch *ftcSwitch;
-(IBAction)scanButtonTapped:(id)sender;
-(IBAction)switchValueChanged:(id)sender;
@end
|
/*
**
** This file is part of BananaCam.
**
** BananaCam 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.
**
** BananaCam 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 BananaCam. If not, see <http://www.gnu.org/licenses/>.
**
*/
#include "camera_control.h"
int capture(t_cam *c, char *root_path)
{
int fd;
int retval;
CameraFile *file;
CameraFilePath camera_file_path;
int waittime = 2000;
CameraEventType type;
void *data;
char *message;
char *full_path;
char *tmp;
retval = gp_camera_capture(c->camera, GP_CAPTURE_IMAGE, &camera_file_path, c->context);
if (retval < GP_OK) {
creat_and_send_message(KO, NULL, NULL, "camera capture failed", c);
return (GP_ERROR);
}
asprintf(&full_path, "%s%s", root_path, camera_file_path.name);
asprintf(&tmp, "Capturing to file %s\n", full_path);
creat_and_send_message(INFO, NULL, NULL, tmp, c);
free(tmp);
fd = open(full_path, O_CREAT | O_WRONLY, 0644);
retval = gp_file_new_from_fd(&file, fd);
if (retval < GP_OK) {
asprintf(&message, "%s creation failed", full_path);
creat_and_send_message(KO, NULL, NULL, message, c);
free(message);
free(full_path);
return (GP_ERROR);
}
free(full_path);
retval = gp_camera_file_get(c->camera, camera_file_path.folder, camera_file_path.name,
GP_FILE_TYPE_NORMAL, file, c->context);
if (retval < GP_OK) {
asprintf(&message, "%s/%s retriving from camera failed", camera_file_path.folder,
camera_file_path.name);
creat_and_send_message(KO, NULL, NULL, message, c);
free(message);
return (GP_ERROR);
}
retval = gp_camera_file_delete(c->camera, camera_file_path.folder, camera_file_path.name,
c->context);
if (retval < GP_OK) {
asprintf(&message, "%s/%s deleting into camera failed", camera_file_path.folder,
camera_file_path.name);
creat_and_send_message(KO, NULL, NULL, message, c);
free(message);
return (GP_ERROR);
}
gp_file_free(file);
while(1) {
retval = gp_camera_wait_for_event(c->camera, waittime, &type, &data, c->context);
if(type == GP_EVENT_TIMEOUT) {
break;
}
else if (type == GP_EVENT_FILE_ADDED)
{
camera_file_path = *(CameraFilePath*)data;
asprintf(&full_path, "%s%s", root_path, camera_file_path.name);
asprintf(&tmp, "Capturing to file %s\n", full_path);
creat_and_send_message(INFO, NULL, NULL, tmp, c);
free(tmp);
fd = open(full_path, O_CREAT | O_WRONLY, 0644);
retval = gp_file_new_from_fd(&file, fd);
if (retval < GP_OK) {
asprintf(&message, "%s creation failed", full_path);
creat_and_send_message(KO, NULL, NULL, message, c);
free(message);
free(full_path);
return (GP_ERROR);
}
retval = gp_camera_file_get(c->camera, camera_file_path.folder, camera_file_path.name,
GP_FILE_TYPE_NORMAL, file, c->context);
retval = gp_camera_file_delete(c->camera, camera_file_path.folder, camera_file_path.name,
c->context);
if (retval < GP_OK) {
asprintf(&message, "%s/%s deleting into camera failed", camera_file_path.folder,
camera_file_path.name);
creat_and_send_message(KO, NULL, NULL, message, c);
free(message);
return (GP_ERROR);
}
gp_file_free(file);
}
else if (type == GP_EVENT_CAPTURE_COMPLETE) {
waittime = 100;
break;
}
else if (type != GP_EVENT_UNKNOWN) {
printf("Unexpected event received from camera: %d\n", (int)type);
}
}
return (GP_OK);
}
int trigger_capture(t_cam *c, char **param)
{
int nShots = 1;
int i = 0;
char *folder_path;
if (param)
{
if (param[0])
nShots = atoi(param[0]);
if (param[1])
folder_path = param[1];
else
folder_path = c->folder_path;
}
else
folder_path = c->folder_path;
creat_and_send_message(WAIT_RESPONSE, NULL, NULL, "Waiting capture complete", c);
while (i < nShots)
{
capture(c, folder_path);
i++;
}
creat_and_send_message(COMPLETE, NULL, NULL, "capture done", c);
return (GP_OK);
}
|
/*
align.h
Created by Toby Sargeant.
Copyright (c) 2013-2015 Toby Sargeant and The University of Melbourne. All rights reserved.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
__author__ = "Toby Sargeant"
__copyright__ = "Copyright 2013-2015, Toby Sargeant and The University of Melbourne"
__credits__ = ["Toby Sargeant","Matthew Wakefield",]
__license__ = "GPLv3"
__version__ = "0.5.1"
__maintainer__ = "Matthew Wakefield"
__email__ = "matthew.wakefield@unimelb.edu.au"
__status__ = "Development"
*/
#ifndef ALIGN_H_INCLUDED
#define ALIGN_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "helpers.h"
typedef enum { A_GAP = 0, B_GAP = 1, MATCH = 2 } FragType;
typedef struct AlignFrag {
struct AlignFrag *next;
FragType type;
int sa_start, sb_start, hsp_len;
} AlignFrag;
typedef struct Alignment {
AlignFrag *align_frag;
int frag_count;
int score;
} Alignment;
int align_frag_count(AlignFrag *f);
void align_frag_free(AlignFrag *f);
void alignment_free(Alignment *alignment);
Alignment *alignment_new(AlignFrag *align_frag, int score);
typedef Alignment *(RawAlignFunc)(const unsigned char *, int, const unsigned char *, int, int, int *, int, int);
typedef Alignment *(AlignFunc)(const char *, int, const char *, int, int, const unsigned char *, int *_matrix, int, int);
Alignment *align_raw(const unsigned char *sa,
int sa_len,
const unsigned char *sb,
int sb_len,
int alpha_len,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *align(const char *seqa,
int sa_len,
const char *seqb,
int sb_len,
int alpha_len,
const unsigned char *map,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *local_align_raw(const unsigned char *sa,
int sa_len,
const unsigned char *sb,
int sb_len,
int alpha_len,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *local_align(const char *seqa,
int sa_len,
const char *seqb,
int sb_len,
int alpha_len,
const unsigned char *map,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *global_align_raw(const unsigned char *sa,
int sa_len,
const unsigned char *sb,
int sb_len,
int alpha_len,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *global_align(const char *seqa,
int sa_len,
const char *seqb,
int sb_len,
int alpha_len,
const unsigned char *map,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *glocal_align_raw(const unsigned char *sa,
int sa_len,
const unsigned char *sb,
int sb_len,
int alpha_len,
int *score_matrix,
int gap_open,
int gap_extend);
Alignment *glocal_align(const char *seqa,
int sa_len,
const char *seqb,
int sb_len,
int alpha_len,
const unsigned char *map,
int *score_matrix,
int gap_open,
int gap_extend);
#endif
|
/*************************************************************************
* Cboy, a Game Boy emulator
* Copyright (C) 2012 jkbenaim
*
* 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 _MBC_HUC1_H_
#define _MBC_HUC1_H_
extern void mbc_huc1_install(void);
uint8_t mbc_huc1_read_ff(uint16_t address);
uint8_t mbc_huc1_read_bank_0(uint16_t address);
uint8_t mbc_huc1_read_bank_n(uint16_t address);
uint8_t mbc_huc1_read_extram(uint16_t address);
uint8_t mbc_huc1_read_extram_disabled(uint16_t address);
void mbc_huc1_write_dummy(uint16_t address, uint8_t data);
void mbc_huc1_write_ram_enable(uint16_t address, uint8_t data);
void mbc_huc1_write_rom_bank_select(uint16_t address, uint8_t data);
void mbc_huc1_write_ram_bank_select(uint16_t address, uint8_t data);
void mbc_huc1_write_mode_select(uint16_t address, uint8_t data);
void mbc_huc1_write_extram(uint16_t address, uint8_t data);
void mbc_huc1_write_extram_disabled(uint16_t address, uint8_t data);
#endif // _MBC_HUC1_H_
|
/* ImportCache.h */
/* Copyright (C) 2011-2016 Lucio Carreras
*
* This file is part of sayonara player
*
* 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 IMPORTCACHE_H
#define IMPORTCACHE_H
#include <QMap>
#include <QString>
#include <QStringList>
#include "Helper/MetaData/MetaDataList.h"
class ImportCache
{
private:
QString _library_path;
MetaDataList _v_md;
QMap<QString, MetaData> _src_md_map;
QMap<QString, QString> _src_dst_map;
QStringList _files;
public:
ImportCache();
void clear();
void add_soundfile(const MetaData& md);
void add_standard_file(const QString& filename, const QString& parent_dir=QString());
QStringList get_files() const;
MetaDataList get_soundfiles() const;
QString get_target_filename(const QString& src_filename, const QString& target_directory) const;
MetaData get_metadata(const QString& filename) const;
void change_metadata(const MetaDataList& v_md_old, const MetaDataList& v_md_new);
};
#endif // IMPORTCACHE_H
|
/*
* Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file)
*
* This file is part of Arx Libertatis.
*
* Arx Libertatis 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.
*
* Arx Libertatis 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 Arx Libertatis. If not, see <http://www.gnu.org/licenses/>.
*/
/* Based on:
===========================================================================
ARX FATALIS GPL Source Code
Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
Arx Fatalis Source 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 3 of the License, or (at your option) any later version.
Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code. If not, see
<http://www.gnu.org/licenses/>.
In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef ARX_GRAPHICS_SPELLS_SPELLS09_H
#define ARX_GRAPHICS_SPELLS_SPELLS09_H
#include "graphics/effects/SpellEffects.h"
#include "graphics/particle/ParticleSystem.h"
class CParalyse;
// Done By : Didier Pedreno
class CSummonCreature: public CSpellFx
{
public:
Vec3f eSrc;
Color3f fColorRays1;
private:
TextureContainer * tex_light;
int end;
int iSize;
bool bIntro;
float fOneOniSize;
float fOneOnDurationIntro;
float fOneOnDurationRender;
float fOneOnDurationOuttro;
float sizeF;
float fSizeIntro;
float fRand;
float fTexWrap;
Color3f fColorBorder;
Color3f fColorRays2;
float tfRaysa[40];
float tfRaysb[40];
unsigned long ulDurationIntro;
unsigned long ulDurationRender;
unsigned long ulDurationOuttro;
TexturedVertex va[40];
TexturedVertex vb[40];
TexturedVertex v1a[40];
TexturedVertex v1b[40];
public:
CSummonCreature();
private:
void Split(TexturedVertex * v, int a, int b, float yo);
void RenderFissure();
// accesseurs
public:
void SetDuration(const unsigned long duration);
void SetDuration(unsigned long, unsigned long, unsigned long);
void SetPos(Vec3f);
void SetColorBorder(Color3f);
void SetColorRays1(Color3f);
void SetColorRays2(Color3f);
unsigned long GetDuration();
// surcharge
public:
void Create(Vec3f, float afBeta = 0);
void Kill();
void Update(unsigned long);
void Render();
};
// Done By : Didier Pedreno
class CNegateMagic: public CSpellFx
{
public:
bool bDone;
int iNumber;
Vec3f eSrc;
Vec3f eTarget;
TextureContainer * tex_p1;
TextureContainer * tex_p2;
TextureContainer * tex_sol;
int iMax;
float fSize;
public:
CNegateMagic();
~CNegateMagic();
// accesseurs
public:
void SetPos(Vec3f);
// surcharge
public:
void Create(Vec3f, float afBeta = 0);
void Kill();
void Update(unsigned long);
void Render();
};
// Done By : Did
class CIncinerate: public CSpellFx
{
public:
int iNumber;
Vec3f eSrc;
Vec3f eTarget;
TextureContainer * tex_flamme;
TextureContainer * tex_pouf_noir;
ParticleSystem pPSStream;
ParticleSystem pPSHit;
TexturedVertex tv1a[150+1];
int iMax;
float fSize;
public:
~CIncinerate();
// accesseurs
public:
void SetPos(Vec3f);
// surcharge
public:
void Create(Vec3f, float afBeta = 0);
void Create(Vec3f, float, float);
void Kill();
void Update(unsigned long);
void Render();
};
// Done By : seb
class CMassParalyse: public CSpellFx
{
private:
Vec3f ePos;
float fRayon;
int iNbParalyse;
struct T_PARALYSE
{
int id;
CParalyse * paralyse;
};
T_PARALYSE tabparalyse[256];
public:
void Update(unsigned long);
void Render();
};
#endif // ARX_GRAPHICS_SPELLS_SPELLS09_H
|
/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
lru_cache.h
Abstract:
expr -> expr LRU cache
Author:
Leonardo (leonardo) 2011-04-12
Notes:
--*/
#ifndef _LRU_CACHE_H_
#define _LRU_CACHE_H_
#include"ast.h"
// #define LRU_CACHE_STATISTICS
#ifdef LRU_CACHE_STATISTICS
#define LCS_CODE(CODE) { CODE }
#else
#define LCS_CODE(CODE)
#endif
class lru_cache {
struct cell {
expr * m_key;
expr * m_value;
cell * m_prev;
cell * m_next;
#ifdef LRU_CACHE_STATISTICS
unsigned m_hits;
unsigned m_birthday;
#endif
};
ast_manager & m_manager;
cell * m_table;
cell * m_head;
unsigned m_size;
unsigned m_max_size;
unsigned m_capacity;
unsigned m_num_deleted;
#ifdef LRU_CACHE_STATISTICS
unsigned m_time;
#endif
static cell * allocate(unsigned capacity);
static void deallocate(cell * table);
static cell * copy_table(cell * old_head, cell * new_table, unsigned new_capacity);
void del_least_used();
void add_front(cell * c);
void move_front(cell * c);
void expand_table();
void remove_deleted();
void init();
void dec_refs();
public:
lru_cache(ast_manager & m);
lru_cache(ast_manager & m, unsigned max_size);
~lru_cache();
void insert(expr * k, expr * v);
expr * find(expr * k);
void reset();
void cleanup();
unsigned size() const { return m_size; }
unsigned capacity() const { return m_capacity; }
bool empty() const { return m_size == 0; }
bool check_invariant() const;
};
#endif
|
/*
Copyright (C) 2010-2011, Bruce Ediger
This file is part of acl.
acl 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.
acl 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 acl; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Id: brack.h,v 1.3 2011/06/12 18:19:11 bediger Exp $ */
struct node *perform_bracket_abstraction(const char *var, struct node *expr);
void set_abstraction_rule(struct abs_node *pattern, struct abs_node *replacement);
void print_abstractions(void);
void delete_abstraction_rules(void);
|
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include "xorshift.h"
static uint32_t rand = 314159265;
__attribute__((constructor))
static void init_rand() { rand = getpid() * time(); }
typedef struct {
unsigned int err : 12;
unsigned int id : 20;
} result_t;
#define RESULT(error) (result_t) {error, xorshift(&rand)}
result_t faulty ()
{
return RESULT(1);
}
#define CASE(CLAUSE) case CLAUSE; break;
#define TRY(EXPRESSION, HANDLING) ({ \
result_t result = EXPRESSION; \
switch (result.error) { \
case 0: break; \
HANDLING \
default: exit (2); \
default: exit (1); \
} })
#define presult(result) \
fprintf (stderr, \
"error: %d, errno: %d, id: %d\n", \
result.error, result.sys_errno, result.id)
int main (int argc, char *argv[])
{
{
result_t r = faulty();
switch (r.error) {
case 0: printf ("ok\n"); break;
case 1: printf ("first error %d (errno: %d)\n", r.error, r.sys_errno); break;
default: printf ("other error\n"); break;
}
}
TRY(faulty(),
CASE(1: presult (result))
CASE(2: printf ("???\n")));
printf ("%d\n", sizeof(result_t));
return 0;
}
|
#ifndef IMPORTMIDI_H
#define IMPORTMIDI_H
#include <sstream>
#include "MidiFile.h"
class ImportMidi
{
public:
ImportMidi();
// std::list(...) ToDo: list of messages with the respective timestamp
std::string MidiMessages;
int NEvents;
public:
void importMidiMessagesText(const char *midiFileName);
};
#endif // IMPORTMIDI_H
|
//
// CunddStreamClient.h
// CunddStream_Monitor
//
// Created by Daniel Corn on 02.06.10.
//
// Copyright © 2010-2012 Corn Daniel
//
// This file is part of Dive.
//
// Dive 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.
//
// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
//
//
#import <Cocoa/Cocoa.h>
@interface CunddStreamClient : NSObject <NSStreamDelegate,NSNetServiceDelegate,NSNetServiceBrowserDelegate>{
NSString * outputString;
NSNetServiceBrowser * browser;
NSMutableArray * services;
NSMutableData * currentDownload;
NSNetService * serverService;
BOOL debug;
NSTableView * browserTable;
BOOL _streamRunning;
NSUInteger _countSkippedUpdates;
NSUInteger _maxSkippedUpdates;
NSInputStream * _oldStream;
}
/*!
@method
@abstract Print a debug message if debug is checked in the internal settings
@discussion Print a debug message if debug is checked in the internal settings
*/
-(void)debug:(NSString *)msg;
/*!
@method
@abstract Starts the stream
@discussion Starts the stream
*/
-(IBAction)startStream:(id)sender;
/*!
@method
@abstract Browses for net services
@discussion Browses for net services
*/
- (IBAction)browse:(id)sender;
// Properties
@property (retain) NSTableView * browserTable;
@property (retain) NSString * outputString;
@property (retain) NSNetServiceBrowser * browser;
@property (retain) NSMutableArray * services;
@property (retain) NSMutableData * currentDownload;
@property (retain) NSNetService * serverService;
@property (assign) BOOL debug;
@property (assign) NSUInteger _countSkippedUpdates;
@property (assign) NSUInteger _maxSkippedUpdates;
@end
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct node* ptrarr[1000005];
long long int vis[1000005];
struct node{
long long int value;
long long int weight;
struct node* next;
};
void adjinsert(struct node** head,long long int val,long long int weight){
struct node* first = (struct node*)malloc(sizeof(struct node));
first->value = val;
first->weight = weight;
first->next = *head;
*head = first;
}
struct node arr[1000005];
long long int heapsize;
void heapify(long long int i){
long long int left = arr[2*i].weight;
long long int right = arr[2*i+1].weight;
long long int root = arr[i].weight;
long long int lv = arr[2*i].value;
long long int rv = arr[2*i+1].value;
long long int mv = arr[i].value;
if(i>=1 && i<=heapsize && (2*i+1<=heapsize || 2*i<=heapsize )){
if( left <= right && left <= root){
arr[i].weight = left;
arr[i].value = lv;
arr[2*i].weight = root;
arr[2*i].value = mv;
heapify(2*i);
}
else if( right < left && right < root){
arr[i].weight = right;
arr[i].value = rv;
arr[2*i+1].weight = root;
arr[2*i+1].value = mv;
heapify(2*i+1);
}
}
}
void formHeap(){
long int i;
for(i=heapsize/2;i>=1;i--){
heapify(i);
}
}
void insert(long long int vertex, long long int val){
heapsize++;
arr[heapsize].weight = val;
arr[heapsize].value = vertex;
long long int parent = heapsize/2;
long long int child = heapsize;
while(arr[parent].weight > val && parent >= 1){
arr[child].weight = arr[parent].weight;
arr[parent].weight = val;
arr[child].value = arr[parent].value;
arr[parent].value = vertex;
child = parent;
parent = parent/2;
}
return;
}
struct node pop(){
struct node poped;
poped.weight = arr[1].weight;
poped.value = arr[1].value;
arr[1].weight = arr[heapsize].weight;
arr[1].weight = arr[heapsize].weight;
arr[1].value = arr[heapsize].value;
arr[1].value = arr[heapsize].value;
heapsize--;
heapify(1);
return poped;
}
void print(){
long long int i;
printf("-------------------HEAP-----------------\n");
for(i=1;i<=heapsize;i++){
printf("v: %lld w: %lld ",arr[i].value, arr[i].weight);
printf("\n");
}
printf("----------------------------------------\n");
}
long long int res,counter,spanedge;
struct node poped;
long long int prims(long long int v){
if(spanedge == counter)
return res;
struct node * current;
current = ptrarr[v];
while(current!=NULL){
if(vis[current->value]==0){
insert(current->value,current->weight);
}
current = current->next;
}
poped = pop();
while(vis[poped.value]==1){
poped = pop();
}
res = res + poped.weight;
counter++;
vis[poped.value] = 1;
prims(poped.value);
}
int main(){
long long int total,t,x,i,j,k,v,e,v1,v2,w;
t = 1;
srand(time(NULL));
for(x=0;x<t;x++){
for(i=0;i<1000005;i++){
ptrarr[i] = NULL;
vis[i] = 0;
}
v = 5;
e = 10;
heapsize = 0;
total = 0;
spanedge = v-1;
res = 0;
counter = 0;
for(i=0;i<e;i++){
v1 = (long long int) (rand() % v + 1);
v2 = (long long int) (rand() % v + 1);
w = (long long int) rand()%1000;
if(v1!=v2){
adjinsert(&ptrarr[v1],v2,w);
adjinsert(&ptrarr[v2],v1,w);
}
total += w;
}
vis[1] = 1;
printf("Weight of minimum spanning tree : %lld\n", prims(1));
}
return 0;
}
|
/*******************************************************************************
*
*
* WashingtonDC Dreamcast Emulator
* Copyright (C) 2017, 2018, 2020 snickerbockers
*
* 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 GFX_TEX_CACHE_H_
#define GFX_TEX_CACHE_H_
#include <stdbool.h>
#include <stdint.h>
#include "washdc/gfx/tex_cache.h"
struct gfxgl4_tex {
int obj_handle;
enum gfx_tex_fmt tex_fmt;
unsigned width, height;
bool valid;
};
struct gfxgl4_tex const* gfx_gfxgl4_tex_cache_get(unsigned idx);
/*
* Bind the given gfx_obj to the given texture-unit.
*/
void gfxgl4_tex_cache_bind(unsigned tex_no, int obj_no, unsigned width,
unsigned height, enum gfx_tex_fmt tex_fmt);
void gfxgl4_tex_cache_unbind(unsigned tex_no);
void gfxgl4_tex_cache_evict(unsigned idx);
void gfxgl4_tex_cache_init(void);
void gfxgl4_tex_cache_cleanup(void);
#endif
|
#ifndef DATABASESTATS_H
#define DATABASESTATS_H
#include <QString>
#include <QStringList>
#include <QVector>
#include <QMap>
class DatabaseModel;
/** A container for statistics about Databases. */
class DatabaseStats
{
public:
// --------- types --------
/** Each numerical field in a Game gets it's own Data entry
It collects min/max/average, a histogram, etc...
*/
struct Data
{
QString key;
/** vector representing the actual value for each row under the key */
QVector<int> v;
/** vector representing the counted frequencies */
QVector<int> histogram;
/** smallest value in v */
int min_value,
max_value;
float
/** average value */
mean,
/** ratio of mean in whole value range [0,1] */
mean_ratio,
/** standard deviation */
deviation,
/** ratio of mean in whole value range [0,1] */
deviation_ratio,
/** ratio between overall and unique values [0,1] */
unique_ratio;
};
// -------------- ctor ---------------
DatabaseStats();
/** Return if data is present */
bool ok() const { return ok_; }
// ------- database handling ---------
/** Set all internal data to readable entries in the db */
void setDatabaseModel(const DatabaseModel & db);
// ------ raw data handling ----------
/** Clears all */
void clearData();
/** Clears specific key */
void clearData(const QString& key);
/** Returns the Data struct for the given key, or 0 */
const Data * data(const QString& key) const;
/** Returns number of keys (numerical cols in database) */
unsigned int numKeys() const { return map_.size(); }
/** Returns the list of all keys (numerical cols in database) */
QStringList keys() const;
private:
// _________ PRIVATE FUNCTIONS _____________
/** Creates a Data entry from a raw data curve.
Everything for key will be overwritten. */
Data * createData_(const QString key, const QVector<int>& values);
/** Sets up Data statistics after Data::v is set */
void calculateData_(Data &d) const;
// __________ PRIVATE MEMBER _______________
/** container of stats for each entry */
QMap<QString, Data> map_;
typedef QMap<QString, Data>::Iterator Iter;
typedef QMap<QString, Data>::ConstIterator ConstIter;
bool ok_;
};
#endif // DATABASESTATS_H
|
/*
* zda.h - generator and parser of ZDA message
*
* Copyright (C) 2012 I. S. Gorbunov <igor.genius at gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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/>.
*/
/*! @file zda.h
* @brief Declares the utilities used for handling of ZDA sentence.
*
* Contains declarations for structure, initilizer, generator and parser
* of ZDA sentence.
*/
#ifndef INCLUDE_navi_zda_h
#define INCLUDE_navi_zda_h
#include "sentence.h"
/*! @brief ZDA - Time and date
*
* UTC, day, month, year and local time zone.
* $--ZDA,hhmmss.ss,xx,xx,xxxx,xx,xx*hh[cr][lf]
*/
struct zda_t
{
unsigned int vfields; //!< valid fields, bitwise or of ZDA_VALID_xx
struct navi_utc_t utc; //!< UTC time
struct navi_date_t date; //!< Day (01 to 31), Month (01 to 12), Year (UTC)
int lzoffset; //!< Local zone offset in minutes
};
//! the date field is valid
#define ZDA_VALID_DATE 0x2
//! the local zone offset field is valid
#define ZDA_VALID_LOCALZONE 0x4
NAVI_BEGIN_DECL
/*! @brief Initializes ZDA sentence structure with default values
*/
NAVI_EXTERN(navierr_status_t) navi_init_zda(struct zda_t *msg);
/*! @brief Creates ZDA message
*/
NAVI_EXTERN(navierr_status_t) navi_create_zda(const struct zda_t *msg,
char *buffer, size_t maxsize, size_t *nmwritten);
/*! @brief Parses ZDA message
*/
NAVI_EXTERN(navierr_status_t) navi_parse_zda(struct zda_t *msg, char *buffer);
NAVI_END_DECL
#endif // INCLUDE_navi_zda_h
|
/**
* @cond doxygen-libsbml-internal
*
* @file FormulaTokenizer.h
* @brief Tokenizes an SBML formula string
* @author Ben Bornstein
*
* $Id: FormulaTokenizer.h 10128 2009-08-28 12:17:33Z sarahkeating $
* $HeadURL: https://sbml.svn.sourceforge.net/svnroot/sbml/trunk/libsbml/src/math/FormulaTokenizer.h $
*
* <!--------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2009-2011 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution and
* also available online as http://sbml.org/software/libsbml/license.html
* ---------------------------------------------------------------------- -->*/
#ifndef FormulaTokenizer_h
#define FormulaTokenizer_h
#include <sbml/common/extern.h>
LIBSBML_CPP_NAMESPACE_BEGIN
BEGIN_C_DECLS
/**
* A FormulaTokenizer maintains its own internal copy of the formula being
* tokenized and the current position within the formula string.
*/
typedef struct
{
char *formula;
unsigned int pos;
} FormulaTokenizer_t;
/**
* TT is short for TokenType.
*/
typedef enum
{
TT_PLUS = '+'
, TT_MINUS = '-'
, TT_TIMES = '*'
, TT_DIVIDE = '/'
, TT_POWER = '^'
, TT_LPAREN = '('
, TT_RPAREN = ')'
, TT_COMMA = ','
, TT_END = '\0'
, TT_NAME = 256
, TT_INTEGER
, TT_REAL
, TT_REAL_E
, TT_UNKNOWN
} TokenType_t;
/**
* A token has a type and a value. The value field is a union of different
* types and the type to reference depends on the value of TokenType_t.
*
* TokenType_t Use value.XXX
* ----------- --------------
* TT_NAME name
* TT_INTEGER integer
* TT_REAL real
* TT_REAL_E real, exponent
* Anything else ch
*
* If a real number was encoded using e-notation, TokenType will be
* TT_REAL_E instead of TT_REAL. The field value.real will contain the
* mantissa and a separate Token field will contain the exponent. For
* example, the token (t) for '1.2e3':
*
* t.type = TT_REAL_E
* t.value = 1.2
* t.exponent = 3
*
* In the case of TT_UNKNOWN, value.ch will contain the unrecognized
* character. For TT_END, value.ch will contain '\\0'. For all others, the
* value.ch will contain the corresponding character.
*/
typedef struct
{
TokenType_t type;
union
{
char ch;
char *name;
long integer;
double real;
} value;
long exponent;
} Token_t;
/**
* Creates a new FormulaTokenizer for the given formula string and returns
* a pointer to it.
*/
LIBSBML_EXTERN
FormulaTokenizer_t *
FormulaTokenizer_createFromFormula (const char *formula);
/**
* Frees the given FormulaTokenizer.
*/
LIBSBML_EXTERN
void
FormulaTokenizer_free (FormulaTokenizer_t *ft);
/**
* @return the next token in the formula string. If no more tokens are
* available, the token type will be TT_END.
*/
LIBSBML_EXTERN
Token_t *
FormulaTokenizer_nextToken (FormulaTokenizer_t *ft);
/**
* Creates a new Token and returns a point to it.
*/
LIBSBML_EXTERN
Token_t *
Token_create (void);
/**
* Frees the given Token
*/
LIBSBML_EXTERN
void
Token_free (Token_t *t);
/**
* @return the value of this Token as a (long) integer. This function
* should be called only when the Token's type is TT_INTEGER. If the type
* is TT_REAL or TT_REAL_E, the function will cope by truncating the
* number's fractional part.
*/
long
Token_getInteger (const Token_t *t);
/**
* @return the value of this Token as a real (double). This function
* should be called only when the Token's is a number (TT_REAL, TT_REAL_E
* or TT_INTEGER).
*/
double
Token_getReal (const Token_t *t);
/**
* Negates the value of this Token. This operation is only valid if the
* Token's type is TT_INTEGER, TT_REAL, or TT_REAL_E.
*/
void
Token_negateValue (Token_t *t);
END_C_DECLS
LIBSBML_CPP_NAMESPACE_END
#endif /** FormulaTokenizer_h **/
/** @endcond */
|
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
*
* This file is part of linphone-iphone
*
* 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/>.
*/
#import <UIKit/UIKit.h>
#import "UICompositeView.h"
#import "ContactsListTableView.h"
#import "UIInterfaceStyleButton.h"
typedef enum _ContactSelectionMode { ContactSelectionModeNone, ContactSelectionModeEdit } ContactSelectionMode;
@interface ContactSelection : NSObject <UISearchBarDelegate> {
}
+ (void)setSelectionMode:(ContactSelectionMode)selectionMode;
+ (ContactSelectionMode)getSelectionMode;
+ (void)setAddAddress:(NSString *)address;
+ (NSString *)getAddAddress;
/*!
* Filters contacts by SIP domain.
* @param domain SIP domain to filter. Use @"*" or nil to disable it.
*/
+ (void)setSipFilter:(NSString *)domain;
/*!
* Weither contacts are filtered by SIP domain or not.
* @return the filter used, or nil if none.
*/
+ (NSString *)getSipFilter;
/*!
* Weither always keep contacts with an email address or not.
* @param enable TRUE if you want to always keep contacts with an email.
*/
+ (void)enableEmailFilter:(BOOL)enable;
/*!
* Weither always keep contacts with an email address or not.
* @return TRUE if this behaviour is enabled.
*/
+ (BOOL)emailFilterEnabled;
/*!
* Filters contacts by name and/or email fuzzy matching pattern.
* @param fuzzyName fuzzy word to match. Use nil to disable it.
*/
+ (void)setNameOrEmailFilter:(NSString *)fuzzyName;
/*!
* Weither contacts are filtered by name and/or email.
* @return the filter used, or nil if none.
*/
+ (NSString *)getNameOrEmailFilter;
@end
@interface ContactsListView : UIViewController <UICompositeViewDelegate, UISearchBarDelegate, UIGestureRecognizerDelegate>
@property(strong, nonatomic) IBOutlet ContactsListTableView *tableController;
@property(strong, nonatomic) IBOutlet UIView *topBar;
@property(nonatomic, strong) IBOutlet UIButton *allButton;
@property(nonatomic, strong) IBOutlet UIButton *linphoneButton;
@property(nonatomic, strong) IBOutlet UIButton *addButton;
@property(strong, nonatomic) IBOutlet UISearchBar *searchBar;
@property(weak, nonatomic) IBOutlet UIImageView *selectedButtonImage;
@property (weak, nonatomic) IBOutlet UIInterfaceStyleButton *toggleSelectionButton;
- (IBAction)onAllClick:(id)event;
- (IBAction)onLinphoneClick:(id)event;
- (IBAction)onAddContactClick:(id)event;
- (IBAction)onDeleteClick:(id)sender;
- (IBAction)onEditionChangeClick:(id)sender;
@end
|
/***************************************************************************
* The FreeMedForms project is a set of free, open source medical *
* applications. *
* (C) 2008-2016 by Eric MAEKER, MD (France) <eric.maeker@gmail.com> *
* All rights reserved. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 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 (COPYING.FREEMEDFORMS file). *
* If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
/***************************************************************************
* Main developer: Eric MAEKER, <eric.maeker@gmail.com> *
* Contributors: *
* NAME <MAIL@ADDRESS.COM> *
***************************************************************************/
#ifndef EXTENDEDVIEW_H
#define EXTENDEDVIEW_H
#include <listviewplugin/listview_exporter.h>
#include <listviewplugin/constants.h>
#include <QObject>
#include <QWidget>
#include <QAbstractItemView>
QT_BEGIN_NAMESPACE
class QMenu;
class QPoint;
class QToolBar;
QT_END_NAMESPACE
/**
* \file iview.h
* \author Eric Maeker
* \version 0.8.2
* \date 01 Jan 2013
*/
namespace Views {
namespace Internal {
class ExtendedViewPrivate;
}
class LISTVIEW_EXPORT IView : public QWidget
{
Q_OBJECT
public:
IView(QWidget *parent);
virtual ~IView() {}
virtual QAbstractItemView *itemView() const = 0;
virtual void addToolBar(QToolBar *bar);
void setCurrentIndex(const QModelIndex &index) {itemView()->setCurrentIndex(index);}
QModelIndex currentIndex() const {return itemView()->currentIndex();}
void setModel(QAbstractItemModel *model) {itemView()->setModel(model);}
QItemSelectionModel *selectionModel() const {if (itemView()) return itemView()->selectionModel(); return 0;}
QAbstractItemModel *model() const {return itemView()->model();}
void setEditTriggers(QAbstractItemView::EditTriggers trig) {itemView()->setEditTriggers(trig);}
QModelIndex indexAt(const QPoint &point) const {return itemView()->indexAt(point);}
QAbstractItemView::SelectionMode selectionMode() const {return itemView()->selectionMode();}
void setSelectionMode(QAbstractItemView::SelectionMode mode) {itemView()->setSelectionMode(mode);}
QAbstractItemView::SelectionBehavior selectionBehavior() const {return itemView()->selectionBehavior();}
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior) {itemView()->setSelectionBehavior(behavior);}
void setAlternatingRowColors(bool enable) {itemView()->setAlternatingRowColors(enable);}
void setVerticalScrollMode(QAbstractItemView::ScrollMode mode) {itemView()->setVerticalScrollMode(mode);}
QAbstractItemView::ScrollMode verticalScrollMode() const {return itemView()->verticalScrollMode();}
void setItemDelegate(QAbstractItemDelegate *delegate) {itemView()->setItemDelegate(delegate);}
QAbstractItemDelegate *itemDelegate() const {return itemView()->itemDelegate();}
protected:
void setItemView(QAbstractItemView *view);
Q_SIGNALS:
// QAbstractItemView overload
void activated(const QModelIndex &index);
void clicked(const QModelIndex &index);
void doubleClicked(const QModelIndex &index);
void entered(const QModelIndex &index);
void pressed(const QModelIndex &index);
void viewportEntered();
private:
QList<QToolBar*> m_AddedToolBars;
};
class LISTVIEW_EXPORT ExtendedView
{
public:
ExtendedView(IView *parent = 0, Constants::AvailableActions actions = Constants::DefaultActions);
virtual ~ExtendedView();
void setActions(Constants::AvailableActions actions);
void setCommands(const QStringList &commandsUid);
void disconnectActionsFromDefaultSlots();
void hideButtons() const;
void showButtons();
void useContextMenu(bool state = true);
virtual QMenu *getContextMenu();
virtual void contextMenu(const QPoint &);
virtual void addItem(bool hasChildOfCurrentIndex = false);
virtual void removeItem();
virtual void moveDown();
virtual void moveUp();
virtual void on_edit_triggered();
private:
Internal::ExtendedViewPrivate *d;
};
} // End namespace Views
#endif // EXTENDEDVIEW_H
|
#ifndef rdg_node_HEADER
#define rdg_node_HEADER
#include <cairo.h>
struct _rdg_node;
#include "rdg.h"
struct _rdg_node {
const struct _object * object;
uint64_t index;
cairo_surface_t * surface;
int level;
double position;
int x;
int y;
int flags;
};
struct _rdg_node * rdg_node_create (uint64_t index, cairo_surface_t * surface);
void rdg_node_delete (struct _rdg_node * node);
struct _rdg_node * rdg_node_copy (struct _rdg_node * node);
int rdg_node_cmp (struct _rdg_node * lhs,
struct _rdg_node * rhs);
int rdg_node_width (struct _rdg_node * rdg_node);
int rdg_node_height (struct _rdg_node * rdg_node);
int rdg_node_center_x (struct _rdg_node * rdg_node);
int rdg_node_center_y (struct _rdg_node * rdg_node);
cairo_surface_t * rdg_node_draw_full (struct _graph_node * node,
struct _map * labels,
double bg_red,
double bg_green,
double bg_blue,
uint64_t highlight_ins);
cairo_surface_t * rdg_node_draw (struct _graph_node * node, struct _map * labels);
#endif
|
#ifndef TG4_BIASING_OPERATOR_HH
#define TG4_BIASING_OPERATOR_HH
//------------------------------------------------
// The Geant4 Virtual Monte Carlo package
// Copyright (C) 2007 - 2019 Ivana Hrivnacova
// All rights reserved.
//
// For the licensing terms see geant4_vmc/LICENSE.
// Contact: root-vmc@cern.ch
//-------------------------------------------------
/// \file TG4BiasingOperator.h
/// \brief Definition of the TG4BiasingOperator class
///
/// \author Alberto Ribon, CERN
#include "G4VBiasingOperator.hh"
#include <vector>
class G4ParticleDefinition;
class TG4BiasingOperation;
class TG4BiasingOperator : public G4VBiasingOperator
{
// When a proton, or neutron, or pion+ or pion- inelastic process occurs
// (naturally, without any biasing) in the logical volume(s) where this
// biasing operator has been attached to, this class uses the biasing "trick"
// of calling FTFP+INCLXX instead of FTFP+BERT for determining the
// final-state. Note that the weights of the produced secondaries are left to
// their default values, 1.0.
public:
TG4BiasingOperator();
virtual ~TG4BiasingOperator() {}
void AddParticle(G4String particleName);
virtual G4VBiasingOperation* ProposeFinalStateBiasingOperation(
const G4Track* track,
const G4BiasingProcessInterface* callingProcess) final;
// Not used:
virtual G4VBiasingOperation* ProposeNonPhysicsBiasingOperation(
const G4Track*, const G4BiasingProcessInterface*)
{
return 0;
}
virtual G4VBiasingOperation* ProposeOccurenceBiasingOperation(
const G4Track*, const G4BiasingProcessInterface*)
{
return 0;
}
private:
std::vector<const G4ParticleDefinition*> fParticlesToBias;
TG4BiasingOperation* fBiasingOperation;
};
#endif // TG4_BIASING_OPERATOR_HH
|
#include <stdio.h>
#include <stdlib.h>
#include <generator.h>
#include <seeker.h>
#include <renderer.h>
#include <types.h>
#include <common.h>
#include <string.h>
#include <sys/time.h>
void printWithTime(const char* message, struct timeval startup){
struct timeval current;
gettimeofday(¤t, NULL);
int cSec = current.tv_sec - startup.tv_sec;
printf("[%i]\t\t%s", cSec, message);
fflush(stdout);
}
void help(int argc, char** argv){
printf("Usage: %s [width] [height] [picture_width] [picture_height] [draw each N] [folder path]\n", argv[0]);
}
void output(int sizeX, int sizeY, char* filename){
uint8_t *data; //промежуточный между GL-контекстом и libpng указатель, будет хранить пиксельные данные.
data = malloc(sizeX * sizeY * 4 * sizeof(uint8_t));
glReadBuffer(GL_FRONT);
glReadPixels(0, 0, sizeX , sizeY, GL_RGBA, GL_UNSIGNED_BYTE, data);
save_png_libpng(filename, data, sizeX, sizeY);
free(data);
}
int main(int argc, char **argv)
{
if(argc < 7) {help(argc, argv); return 0;}
int width = atoi(argv[1]);
int height = atoi(argv[2]);
int sizeX = atoi(argv[3]);
int sizeY = atoi(argv[4]);
int drawEach = atoi(argv[5]);
char* path = argv[6];
cell startPoint;
cell exitPoint;
startPoint.x = 1;
startPoint.y = 1;
exitPoint.x = (width % 2 == 0) ? width - 3 : width - 2;
exitPoint.y = (height % 2 == 0) ? height - 3 : height - 2;
data d;
renderData rd;
char* defaultGenFileName = malloc(sizeof(path) + sizeof("/maze_") + 4);
strcpy(defaultGenFileName, path);
strcat(defaultGenFileName, "/maze_");
char* defaultSolveFileName = malloc(sizeof(path) + sizeof("/maze_solved_") + 4);
strcpy(defaultSolveFileName, path);
strcat(defaultSolveFileName, "/maze_solved_");
struct timeval startup;
gettimeofday(&startup, NULL);
printWithTime("Initialization\n", startup);
srand((unsigned)clock()); //инициализируем seed от тактов процессора
OSMesaContext context = OSMesaCreateContext(OSMESA_RGBA, NULL); //создаем offscreen openGL контекст
void *buffer = malloc(sizeX*sizeY*4*sizeof(GLfloat)); //буффер рендеринга. По 4 вершины на каждую клетку лабиринта.
OSMesaMakeCurrent(context, buffer, GL_UNSIGNED_BYTE, sizeX, sizeY);
//OpenGL 4.1
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glOrtho(-sizeX/2,sizeX/2,sizeY/2,-sizeY/2,0,1);
glClearColor( 1, 1, 1, 0 );
//инициализация данных рендерера и генератора
d = initGeneratorData(width, height, startPoint);
rd = initRenderData(d, sizeX, sizeY);
//скармливаем openGL указатели на массивы вершин и цветов.
glVertexPointer(2, GL_FLOAT, sizeof(vertex), rd.vertices);
glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(vertexColor), rd.verticesColor);
printWithTime("Done\n\n", startup);
printWithTime("Generating maze\n", startup);
//Генерация
unsigned int frameCount = 0;
unsigned int savedCount = 0;
char cBuffer[30];
char* currentFileName;
do{
d = generateStep(d);
frameCount++;
if((drawEach > 0) ? (frameCount % drawEach == 0) : 0 || d.unvisitedNum <= 0){ //рисуем каждый drawEach кадр или последний.
if(d.unvisitedNum <= 0){
wipe(&d.s, &d.stackSize); //очищаем стек, если генерация уже окончена. Workaround для генерации больших лабиринтов.
}
printWithTime("Rendering frame ", startup); printf("%u\n", frameCount);
setMode(d.startPoint, d.maze, CURRENT);
renderMatrix(d.maze, rd, GENERATE);
setMode(d.startPoint, d.maze, GENVISITED);
printWithTime("Saving frame ", startup); printf("%u\n", frameCount);
sprintf(cBuffer, "%i", ++savedCount);
currentFileName = malloc(sizeof(defaultGenFileName) + sizeof(cBuffer));
strcpy(currentFileName, defaultGenFileName);
strcat(currentFileName, cBuffer);
output(sizeX, sizeY, currentFileName);
free(currentFileName);
}
}
while(d.unvisitedNum > 0);
printWithTime("Maze generated\n\n", startup);
printWithTime("Solving\n", startup);
//Решение
frameCount = 0;
savedCount = 0;
int solved = 0;
d = initSeekerData(d, startPoint, exitPoint);
do{
d = seekStep(d);
frameCount++;
if(d.startPoint.x == exitPoint.x && d.startPoint.y == exitPoint.y){
solved = 1;
wipe(&d.s, &d.stackSize);
}
if((drawEach > 0) ? (frameCount % drawEach == 0) : 0 || solved){ //рисуем каждый drawEach кадр или последний.
printWithTime("Rendering frame ", startup); printf("%i\n", frameCount);
setMode(d.startPoint, d.maze, CURRENT);
renderMatrix(d.maze, rd, SOLVE);
setMode(d.startPoint, d.maze, WAY);
printWithTime("Saving frame ", startup); printf("%i\n", frameCount);
sprintf(cBuffer, "%i", ++savedCount);
currentFileName = malloc(sizeof(defaultSolveFileName) + sizeof(cBuffer));
strcpy(currentFileName, defaultSolveFileName);
strcat(currentFileName, cBuffer);
output(sizeX, sizeY, currentFileName);
free(currentFileName);
}
}
while(!solved);
printWithTime("Maze solved\n", startup);
return 0;
}
|
/*
* This file is a part of __PROGRAM_NAME__ __PROGRAM_VERSION__
*
* __PROGRAM_COPYRIGHT__ __PROGRAM_AUTHOR__ __PROGRAM_AUTHOR_EMAIL__
*
* 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/>.
*/
#include <stdio.h>
#include <CUnit/Basic.h>
#include "../jumper.h"
void test_can_jump_in_dir_to_file_offset(void);
void test_can_jump_in_file_to_file_offset(void);
int main(void)
{
CU_pSuite suite = NULL;
if (CU_initialize_registry() != CUE_SUCCESS)
return CU_get_error();
suite = CU_add_suite("suite", NULL, NULL);
if (suite == NULL) {
CU_cleanup_registry();
return CU_get_error();
}
if (CU_add_test(suite, "can jump in dir to file offset",
test_can_jump_in_dir_to_file_offset) == NULL
|| CU_add_test(suite, "can jump in file to file offset",
test_can_jump_in_file_to_file_offset) == NULL) {
CU_cleanup_registry();
return CU_get_error();
}
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_cleanup_registry();
return CU_get_error();
}
void test_can_jump_in_dir_to_file_offset(void)
{
FILE *iofp;
size_t offset;
int i;
int retval;
iofp = tmpfile();
if (iofp == NULL)
CU_FAIL("can't create temporary file");
for (i = 0; i < 100; i++)
putc('\0', iofp);
rewind(iofp);
offset = 10;
retval = jumper_dir_jump_file_offset(iofp, offset);
CU_ASSERT_TRUE(retval);
CU_ASSERT_EQUAL(ftell(iofp), offset);
fclose(iofp);
}
void test_can_jump_in_file_to_file_offset(void)
{
FILE *iofp;
size_t offset;
int i;
int retval;
iofp = tmpfile();
if (iofp == NULL)
CU_FAIL("can't create temporary file");
for (i = 0; i < 100; i++)
putc('\0', iofp);
rewind(iofp);
offset = 10;
retval = jumper_file_jump_file_offset(iofp, offset);
CU_ASSERT_TRUE(retval);
CU_ASSERT_EQUAL(ftell(iofp), offset);
fclose(iofp);
}
|
#pragma once
#include "ui_mainwindow.h"
/*!
* As long as the UI parameter is always called ui, we can safely use this
* macro to save some keystrokes!
*
* Some Windows library also defines ERROR, but we want this.
*/
#undef ERROR
#define ERROR(s_) logging::error(s_, ui);
#undef INFO
#define INFO(s_) logging::info(s_, ui);
#undef INFO_RECONVERT
#define INFO_RECONVERT(s_) logging::infoReconvert(s_, ui);
namespace logging {
/*!
* Logs the passed string to the console and appends it to the error log
* console in the user interface.
*/
void error(const QString &s, Ui::MainWindow *ui);
void info(const QString &s, Ui::MainWindow *ui);
void infoReconvert(const QString &s, Ui::MainWindow *ui);
} // namespace logging
|
#ifndef PRAD_HYCAL_RECONSTRUCTOR_H
#define PRAD_HYCAL_RECONSTRUCTOR_H
#include <vector>
#include <string>
#include "PRadEventStruct.h"
#include "PRadClusterProfile.h"
#include "PRadClusterDensity.h"
#include "ConfigParser.h"
#include "ConfigObject.h"
// we use 3x3 adjacent hits to reconstruct position
// here gives a larger volume to save the information
#define POS_RECON_HITS 15
class PRadHyCalDetector;
// class to manage the various hycal clustering methods
class PRadHyCalReconstructor : public ConfigObject
{
public:
friend class PRadIslandCluster;
friend class PRadSquareCluster;
// clustering method enum
enum ClMethod
{
Undefined_ClMethod = -1,
Island = 0,
Square,
Max_ClMethods,
};
// macro in ConfigParser.h
ENUM_MAP(ClMethod, 0, "Island|Square");
// position reconstruction method
enum PosMethod
{
Undefined_PosMethod = -1,
Logarithmic = 0,
Linear,
Max_PosMethods,
};
ENUM_MAP(PosMethod, 0, "Logarithmic|Linear");
// configuraiton data package
struct Config
{
// general
bool depth_corr, leak_corr, linear_corr, den_corr, sene_corr;
float log_weight_thres, min_cluster_energy, min_center_energy;
float least_leak, linear_corr_limit;
unsigned int min_cluster_size, leak_iters;
std::vector<float> min_module_energy;
// for island
bool corner_conn;
unsigned int split_iter;
float least_split;
// for square
unsigned int square_size;
};
public:
PRadHyCalReconstructor(const std::string &conf_path = "");
// copy/move constructors
PRadHyCalReconstructor(const PRadHyCalReconstructor &that);
PRadHyCalReconstructor(PRadHyCalReconstructor &&that);
// destructor
virtual ~PRadHyCalReconstructor();
// copy/move assignment operators
PRadHyCalReconstructor &operator =(const PRadHyCalReconstructor &rhs);
PRadHyCalReconstructor &operator =(PRadHyCalReconstructor &&rhs);
// configuration
void Configure(const std::string &path);
// core functions
void Reconstruct(PRadHyCalDetector *det);
void Reconstruct(PRadHyCalDetector *det, const EventData &event);
void CollectHits(PRadHyCalDetector *det);
void CollectHits(PRadHyCalDetector *det, const EventData &event);
void ReconstructHits(PRadHyCalDetector *det);
void AddTiming(PRadHyCalDetector *det);
void AddTiming(PRadHyCalDetector *det, const EventData &event);
// help functions
HyCalHit Cluster2Hit(const ModuleCluster &cl) const;
void LeakCorr(ModuleCluster &cluster) const;
void CorrectVirtHits(BaseHit &hit, std::vector<ModuleHit> &vhits,
const ModuleCluster &cluster) const;
bool CheckCluster(const ModuleCluster &cluster) const;
double EvalCluster(const BaseHit &c, const ModuleCluster &cl) const;
// profile related
PRadClusterProfile *GetProfile() {return &profile;}
void LoadProfile(int t, const std::string &path) {profile.Load(t, path);}
PRadClusterDensity *GetDensityParams() {return &density;}
void LoadDensityParams(int t, const std::string &p_path, const std::string &e_path)
{density.Load(t, p_path, e_path);}
void ChooseDensitySet(PRadClusterDensity::SetEnum i) {density.ChooseSet(i);}
// methods information
bool SetClusterMethod(const std::string &name);
bool SetClusterMethod(ClMethod newtype);
class PRadHyCalCluster *GetClusterMethod() const {return cluster;}
ClMethod GetClusterMethodType() const {return cltype;}
std::string GetClusterMethodName() const {return ClMethod2str(cltype);}
std::vector<std::string> GetClusterMethodNames() const;
bool SetPositionMethod(const std::string &name);
bool SetPositionMethod(PosMethod newtype);
PosMethod GetPositionMethodType() const {return postype;}
std::string GetPositionMethodName() const {return PosMethod2str(postype);}
std::vector<std::string> GetPositionMethodNames() const;
// containers
const std::vector<ModuleHit> &GetHits() const {return module_hits;}
const std::vector<ModuleCluster> &GetClusters() const {return module_clusters;}
protected:
float getWeight(const float &E, const float &E0) const;
float getPosBias(const std::vector<float> &pars, const float &dx) const;
float getShowerDepth(int module_type, const float &E) const;
int reconstructPos(const ModuleHit ¢er, BaseHit *temp, int count, BaseHit *hit) const;
int reconstructPos(const ModuleCluster &cl, BaseHit *hit) const;
int fillHits(BaseHit *temp, int max_hits, const ModuleHit ¢er,
const std::vector<ModuleHit> &hits) const;
PRadClusterProfile::Value getProf(const ModuleHit &c, const ModuleHit &hit) const;
PRadClusterProfile::Value getProf(double cx, double cy, double cE, const ModuleHit &hit) const;
PRadClusterProfile::Value getProf(const BaseHit &c, const ModuleHit &hit) const;
private:
PRadClusterProfile profile;
PRadClusterDensity density;
ClMethod cltype;
class PRadHyCalCluster *cluster;
PosMethod postype;
Config config;
std::vector<ModuleHit> module_hits;
std::vector<ModuleCluster> module_clusters;
};
#endif // PRAD_HYCAL_RECONSTRUCTOR
|
/**
* @file
* @brief LLIB TPM main functions
* @author (c) Nicolas Provost 2012-2013 dev AT doronic DOT fr
* @n
* The structure @c llib_tpm_args_t contains all variables needed
* to execute a TPM command with the function @c llib_tpm_run (see
* help for llib_tpm(3)).
*/
/*
* Main definitions for tpm arguments
*
* Version 1.00
* Copyright (C) 2012 Nicolas Provost dev AT doronic DOT fr
*
* 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 __LLIB_TPM_ARGS_H
#define __LLIB_TPM_ARGS_H
#include "../llib_types.h"
#include "../llib_buffer.h"
#include "../llib_list.h"
#include "../llib_data.h"
#include "llib_tpm_def.h"
#include "llib_tpm_defs.h"
#include "llib_tpm_desc.h"
#include "llib_tpm_pcr.h"
#include "llib_tpm_nv.h"
#include "llib_tpm_key.h"
#include "llib_tpm_keystore.h"
#include "llib_tpm_store.h"
/**
* @typedef llib_tpm_args_static_t
* @brief some static variables.
*/
typedef struct
{
llib_tpm_t tpm; /**< static TPM instance */
llib_tpm_store_t store; /**< static TPM store */
llib_tpm_store_object_t o; /**< static TPM store object */
llib_tpm_keystore_t keystore; /**< static keystore */
llib_tpm_key_t key; /**< static key */
llib_tpm_key_t auth_key; /**< static auth_key */
llib_tpm_key_t store_key; /**< static key for store */
void* ui; /**< GTK ui reference */
} llib_tpm_args_static_t;
/**
* @typedef llib_tpm_args_cmd_line_t
* @brief static arguments used when parsing a command line.
*/
typedef struct
{
llib_tpm_key_t* key; /**< a key */
llib_data_t* data; /**< a source of data */
llib_data_t* data2; /**< a source of data */
llib_data_t* encdata; /**< input/output encoded data */
llib_data_t* output; /**< an output destination (for displaying informations) */
llib_tpm_store_t* store; /**< a TPM store */
llib_tpm_store_object_t* o; /**< TPM object store */
char* path; /**< a file path */
char* tpm_path; /**< a tpm device path */
int timeout; /**< timeout for TPM commands */
llib_tpm_args_static_t st; /**< static variables */
} llib_tpm_args_cmd_line_t;
/**
* @typedef llib_tpm_args_t
* @brief all arguments used during a TPM command are stored in this structure.
* Each field may be used as input or output depending on the command.
*/
typedef struct
{
const struct llib_tpm_func_desc_t* desc; /**< current command descriptor */
llib_tpm_t* tpm; /**< the current tpm */
void* uio; /**< an UIO interface */
llib_tpm_args_cmd_line_t* cargs; /**< static command line arguments */
llib_data_t* data; /**< a source of data */
llib_data_t* data2; /**< a source of data */
llib_data_t* encdata; /**< input/output encoded data */
llib_data_t** iv; /**< pointer to a data source for IV vector */
llib_data_t* siv; /**< a data source for IV vector (to set iv = &siv) */
llib_tpm_key_t* key; /**< pointer to a key */
llib_tpm_key_t* auth_key; /**< pointer to the main authentication key */
llib_tpm_pcr_select_t pcr_select; /**< a PCR registers selector */
llib_tpm_nv_t nv_data; /**< a non-volatile memory area descriptor */
llib_data_t* output; /**< an output destination (for displaying informations) */
llib_tpm_store_t* store; /**< a TPM storage to use */
llib_tpm_store_object_t* o; /**< a store object */
llib_tpm_keystore_t* keystore; /**< a keystore */
unsigned char b; /**< a boolean or byte value */
float f; /**< a float value */
int i; /**< a 32-bit signed integer */
luint32 li; /**< a 32-bit unsigned integer */
luint16 li16; /**< a 16-bit unsigned integer */
luint8 li8; /**< a 8-bit unsigned integer */
lbool bl; /**< a boolean */
llib_size_t size; /**< a size */
char* path; /**< a file path */
TPM_HANDLE handle; /**< handle of a key, a session.. */
TPM_CURRENT_TICKS ticks; /**< ticks structure */
TPM_PCRINDEX pcr_index; /**< index of a PCR register */
TPM_PCRVALUE pcr_value; /**< value of a PCR register */
TPM_COUNTER_VALUE counter; /**< a counter value */
lbool debug; /**< debug state */
lbool quiet; /**< quiet mode */
lbool verbose; /**< verbose mode */
lbool force_output; /**< force having an output when output is optional */
luint32 last_error; /**< non-TPM last_error */
luint32 set; /**< to record the fields that was set somewhere */
lbool duplicated; /**< indicates that at least a parameter was specified twice or more */
} llib_tpm_args_t;
/**
* @def llib_tpm_args_declare
* @brief use this to declare and initialize a llib_tpm_args_t variable.
*/
#define llib_tpm_args_declare(ARGS) \
llib_tpm_args_t ARGS = { 0 }; \
llib_tpm_args_reset(&ARGS);
void llib_tpm_args_dump(int fd, llib_tpm_args_t* args);
void llib_tpm_args_clear(llib_tpm_args_t* args);
lbool llib_tpm_args_parse(const char* line, llib_tpm_args_t* args, char cmd[32]);
void llib_tpm_args_cmd_line_free(llib_tpm_args_cmd_line_t* cargs);
lbool llib_tpm_args_check(llib_tpm_args_t* args);
lbool llib_tpm_args_use_uio(llib_tpm_args_t* args);
lbool llib_tpm_args_reset(llib_tpm_args_t* args);
lbool llib_tpm_args_find_param_in(llib_tpm_args_t* args, const char* arg_name, const char* arg_field, char type[32], char** help);
#endif
|
#ifndef STATION_H
#define STATION_H
class Station_t : public Model_t
{
public:
unsigned int id;
string Name;
Point_t Position;
boost::shared_ptr<StationType_t> pType;
boost::shared_ptr<list<Car_t>> pCars;
Station_t(unsigned int _id, string & _Name, Point_t & _Position, boost::shared_ptr<StationType_t> _pType,
boost::shared_ptr<list<Car_t>> _pCars);
virtual ~Station_t();
virtual string ToString() const;
};
#endif // STATION_H
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/s1ap-r16.1.0/36413-g10.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CancelledCellinEAI-Item.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinEAI_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CancelledCellinEAI_Item, eCGI),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_EUTRAN_CGI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"eCGI"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CancelledCellinEAI_Item, numberOfBroadcasts),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_NumberOfBroadcasts,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"numberOfBroadcasts"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_CancelledCellinEAI_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_7378P27,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_CancelledCellinEAI_Item_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_CancelledCellinEAI_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* eCGI */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* numberOfBroadcasts */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_CancelledCellinEAI_Item_specs_1 = {
sizeof(struct S1AP_CancelledCellinEAI_Item),
offsetof(struct S1AP_CancelledCellinEAI_Item, _asn_ctx),
asn_MAP_S1AP_CancelledCellinEAI_Item_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_CancelledCellinEAI_Item_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinEAI_Item = {
"CancelledCellinEAI-Item",
"CancelledCellinEAI-Item",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1,
sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1[0]), /* 1 */
asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_CancelledCellinEAI_Item_1,
3, /* Elements count */
&asn_SPC_S1AP_CancelledCellinEAI_Item_specs_1 /* Additional specs */
};
|
/*
** sclst_get_back.c
**
** sclst_get_back function of Undefined-C library
**
** By: Juillard Jean-Baptiste (jbjuillard@gmail.com)
**
** Created: 2017/03/08 by Juillard Jean-Baptiste
** Updated: 2018/03/14 by Juillard Jean-Baptiste
**
** This file is a part free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 3, or
** (at your option) any later version.
**
** There is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file LICENSE. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth
** Floor, Boston, MA 02110-1301, USA.
*/
#include <libuc/errno.h>
#include <stdlib.h> /* Dev: a modifier après implantation de free */
#include <libuc/stdlst.h>
void *sclst_get_back(sclst_t **lst)
{
register sclst_t *tmp;
register sclst_t **addr;
register void *k;
errno = 0;
if (!lst)
{
errno = EINVAL;
return (NULL);
}
else if (!*lst)
return (NULL);
tmp = (*lst)->next;
addr = &((*lst)->next);
while (tmp != *lst)
{
addr = &(tmp->next);
tmp = tmp->next;
}
if (tmp->next == tmp)
*lst = (sclst_t *)(NULL);
else
{
*addr = tmp->next;
*lst = tmp->next;
}
tmp->next = (sclst_t *)(NULL);
tmp->size = 0;
k = tmp->key;
tmp->key = NULL;
free((void *)(tmp));
return (k);
}
|
//
// SimpleMutex.h
// crag
//
// Created by John on 8/26/10.
// Copyright 2009, 2010 John McFarlane. All rights reserved.
// This program is distributed under the terms of the GNU General Public License.
//
#pragma once
namespace smp
{
// Wrapper for SDL implementation of a spin lock.
// Only use this for brief locks.
class SimpleMutex
{
OBJECT_NO_COPY(SimpleMutex);
public:
SimpleMutex()
: spin_lock(0)
{
}
void lock()
{
SDL_AtomicLock(& spin_lock);
}
void unlock()
{
SDL_AtomicUnlock(& spin_lock);
}
private:
SDL_SpinLock spin_lock;
};
}
|
/*!
* \file Rekkix.h
* \brief Definition of the class Rekkix
* \date 2016-07-15
* \author f.souliers
*/
#ifndef REKKIX_H
#define REKKIX_H
#include <QApplication>
#include <QMainWindow>
#include <QMutex>
// Auto-generated ui headers
#include "ui_Rekkix.h"
// Application headers
#include "ModelConfiguration.h"
#include "ModelStreamDocuments.h"
#include "ModelReqsCoveringUpstream.h"
#include "ModelReqsCoveredDownstream.h"
#include "ModelCompositeReqs.h"
#include "ModelReqs.h"
#include "ModelConfigurationErrors.h"
#include "SngSettings.h"
/*!
* \class Rekkix
* \brief Class of the main window
*/
class Rekkix : public QMainWindow, public Ui::RekkixMW
{
Q_OBJECT
public:
/*!
* \brief Constructor
* \param[in] parent Not used
* \param[in] setupUI should the constructor initialize some Graphical User Interface ?
*/
Rekkix(QApplication * parent, bool setupUI = true);
/*!
* \brief Destructor of the model, only ensures to close the configuration file if needed
*/
~Rekkix();
public slots :
/*!
* \brief slot used to load a configuration file (open file dialog)
*/
void slt_loadConfigurationFile();
/*!
* \brief start the analysis with the loaded configuration file
*/
void slt_startAnalysis();
/*!
* \brief this slot is called when a file is selected in the files coverage summary view
* \param[in] p_index Index selected in the view (needed to identify the selected row)
*/
void slt_fileCoverageSummary_selected(QModelIndex p_index);
/*!
* \brief generate the report as specified in the loaded configuration file
*/
void slt_generateReports();
/*!
* \brief show the settings and help dialog
*/
void slt_showSettingsDlg() ;
/*!
* \brief load a configuration file (from gui or from command line) and initialize gui accordingly
* \param[in] p_filename file name & path of the file to be loaded
*/
void loadFileAndInitGui(const char* p_filename);
/*!
* \brief load a configuration file (from command line), compute analysis and generate reports
* \param[in] p_filename file name & path of the file to be loaded
* \return
* - EXIT_SUCCESS in case everything goes properly
* - EXIT_FAILURE else and errors have been displayed on stderr
*/
int loadFileAndRunBatch(const char* p_filename);
/*!
* \brief slot called when a requirement file finished its parsing.
*/
void slt_reqFileParsingOneMoreFileFinished() ;
/*!
* \brief slot called when all of the requirement files have been parsed (the coverage computation can be performed)
*/
void slt_reqFileParsingAllFilesFinished() ;
private:
QApplication * __app; //!< Application running the window
ModelConfiguration __cnfModel; //!< loaded configuration
ModelConfigurationErrors __cnfErrorsModel; //!< configuration errors detected when loading the configuration file
ModelStreamDocuments __currentlyDisplayedUpstreamDocsModel; //!< upstream documents of the currently selected one
ModelStreamDocuments __currentlyDisplayedDownstreamDocsModel;//!< downstream documents of the currently selected one
ModelReqsCoveringUpstream __upstreamCoverageModel; //!< model for upstream requirements
ModelReqsCoveredDownstream __downstreamCoverageModel; //!< model for downstream requirements
ModelCompositeReqs __compositeRequirementsModel; //!< model for composite requirements
ModelReqs __requirementsModel; //!< model for requirements of the selected file
bool __isBatchMode ; //!< is the application running in batch mode ? (ie without any GUI)
int __nbFiles ; //!< Number of files the analysis is going to take into account (calculated at the beginning of slt_analysis)
QMutex __fileParsingFinishedGuiUpdate ; //!< Mutex used to protect the GUI update when file parsing is terminated
/*!
* \brief When building a report, builds the string used for the summary of the report (list of files, errors, ...)
* \param[in] p_writer writer to be used for string generation (html, csv)
* \param[in] p_delimiter in case of csv, field delimiter
* \return
* The string representing the summary table according to the required format
*/
const QString __getReportSummaryTable(const QString& p_writer, const QString& p_delimiter) const;
/*!
* \brief When building a report, builds the string used for the table of errors (severity, category, location, description)
* \param[in] p_writer writer to be used for string generation (html, csv)
* \param[in] p_delimiter in case of csv, field delimiter
* \return
* The string representing the table of errors according to the required format
*/
const QString __getReportErrorsTable(const QString& p_writer, const QString& p_delimiter) const;
};
/*!
* \typedef RekkixPtr
* \brief Just to make the code easier to type when a pointer to Rekkix is required
*/
typedef Rekkix* RekkixPtr;
#endif
|
/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#include <ieee754.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
/* Convert a `long double' in IBM extended format to a multi-precision
integer representing the significand scaled up by its number of
bits (106 for long double) and an integral power of two (MPN
frexpl). */
/* When signs differ, the actual value is the difference between the
significant double and the less significant double. Sometimes a
bit can be lost when we borrow from the significant mantissa. */
#define EXTRA_INTERNAL_PRECISION (7)
mp_size_t
__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
int *expt, int *is_neg,
long double value)
{
union ibm_extended_long_double u;
unsigned long long hi, lo;
int ediff;
u.ld = value;
*is_neg = u.d[0].ieee.negative;
*expt = (int) u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;
lo = ((long long) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
hi = ((long long) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
/* Hold 7 extra bits of precision in the mantissa. This allows
the normalizing shifts below to prevent losing precision when
the signs differ and the exponents are sufficiently far apart. */
lo <<= EXTRA_INTERNAL_PRECISION;
/* If the lower double is not a denormal or zero then set the hidden
53rd bit. */
if (u.d[1].ieee.exponent != 0)
lo |= 1ULL << (52 + EXTRA_INTERNAL_PRECISION);
else
lo = lo << 1;
/* The lower double is normalized separately from the upper. We may
need to adjust the lower manitissa to reflect this. */
ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53;
if (ediff > 0)
{
if (ediff < 64)
lo = lo >> ediff;
else
lo = 0;
}
else if (ediff < 0)
lo = lo << -ediff;
/* The high double may be rounded and the low double reflects the
difference between the long double and the rounded high double
value. This is indicated by a differnce between the signs of the
high and low doubles. */
if (u.d[0].ieee.negative != u.d[1].ieee.negative
&& lo != 0)
{
lo = (1ULL << (53 + EXTRA_INTERNAL_PRECISION)) - lo;
if (hi == 0)
{
/* we have a borrow from the hidden bit, so shift left 1. */
hi = 0x000ffffffffffffeLL | (lo >> (52 + EXTRA_INTERNAL_PRECISION));
lo = 0x0fffffffffffffffLL & (lo << 1);
(*expt)--;
}
else
hi--;
}
#if BITS_PER_MP_LIMB == 32
/* Combine the mantissas to be contiguous. */
res_ptr[0] = lo >> EXTRA_INTERNAL_PRECISION;
res_ptr[1] = (hi << (53 - 32)) | (lo >> (32 + EXTRA_INTERNAL_PRECISION));
res_ptr[2] = hi >> 11;
res_ptr[3] = hi >> (32 + 11);
#define N 4
#elif BITS_PER_MP_LIMB == 64
/* Combine the two mantissas to be contiguous. */
res_ptr[0] = (hi << 53) | (lo >> EXTRA_INTERNAL_PRECISION);
res_ptr[1] = hi >> 11;
#define N 2
#else
#error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
#endif
/* The format does not fill the last limb. There are some zeros. */
#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
- (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
if (u.d[0].ieee.exponent == 0)
{
/* A biased exponent of zero is a special case.
Either it is a zero or it is a denormal number. */
if (res_ptr[0] == 0 && res_ptr[1] == 0
&& res_ptr[N - 2] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=4. */
/* It's zero. */
*expt = 0;
else
{
/* It is a denormal number, meaning it has no implicit leading
one bit, and its exponent is in fact the format minimum. We
use DBL_MIN_EXP instead of LDBL_MIN_EXP below because the
latter describes the properties of both parts together, but
the exponent is computed from the high part only. */
int cnt;
#if N == 2
if (res_ptr[N - 1] != 0)
{
count_leading_zeros (cnt, res_ptr[N - 1]);
cnt -= NUM_LEADING_ZEROS;
res_ptr[N - 1] = res_ptr[N - 1] << cnt
| (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
res_ptr[0] <<= cnt;
*expt = DBL_MIN_EXP - 1 - cnt;
}
else
{
count_leading_zeros (cnt, res_ptr[0]);
if (cnt >= NUM_LEADING_ZEROS)
{
res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS);
res_ptr[0] = 0;
}
else
{
res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt);
res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt);
}
*expt = DBL_MIN_EXP - 1
- (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt;
}
#else
int j, k, l;
for (j = N - 1; j > 0; j--)
if (res_ptr[j] != 0)
break;
count_leading_zeros (cnt, res_ptr[j]);
cnt -= NUM_LEADING_ZEROS;
l = N - 1 - j;
if (cnt < 0)
{
cnt += BITS_PER_MP_LIMB;
l--;
}
if (!cnt)
for (k = N - 1; k >= l; k--)
res_ptr[k] = res_ptr[k-l];
else
{
for (k = N - 1; k > l; k--)
res_ptr[k] = res_ptr[k-l] << cnt
| res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt);
res_ptr[k--] = res_ptr[0] << cnt;
}
for (; k >= 0; k--)
res_ptr[k] = 0;
*expt = DBL_MIN_EXP - 1 - l * BITS_PER_MP_LIMB - cnt;
#endif
}
}
else
/* Add the implicit leading one bit for a normalized number. */
res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
- ((N - 1) * BITS_PER_MP_LIMB));
return N;
}
|
// oct-errno.h.in
/*
Copyright (C) 2005-2017 John W. Eaton
This file is part of Octave.
Octave 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.
Octave 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 Octave; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#if ! defined (octave_oct_errno_h)
#define octave_oct_errno_h 1
#include "octave-config.h"
#include <cerrno>
#include <map>
#include <string>
#include "oct-map.h"
class
octave_errno
{
protected:
octave_errno (void);
public:
~octave_errno (void) { }
static bool instance_ok (void);
static void cleanup_instance (void) { delete instance; instance = 0; }
static int lookup (const std::string& name);
static octave_scalar_map list (void);
static int get (void) { return errno; }
static int set (int val)
{
int retval = errno;
errno = val;
return retval;
}
private:
std::map<std::string, int> errno_tbl;
static octave_errno *instance;
int do_lookup (const std::string& name);
octave_scalar_map do_list (void);
};
#endif
|
/* -*- buffer-read-only: t -*- vi: set ro: */
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* exclude.h -- declarations for excluding file names
Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2011 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_EXCLUDE_H
#define _GL_EXCLUDE_H 1
#include <stdbool.h>
/* Written by Paul Eggert <eggert@twinsun.com>
and Sergey Poznyakoff <gray@gnu.org> */
/* Exclude options, which can be ORed with fnmatch options. */
/* Patterns must match the start of file names, instead of matching
anywhere after a '/'. */
#define EXCLUDE_ANCHORED (1 << 30)
/* Include instead of exclude. */
#define EXCLUDE_INCLUDE (1 << 29)
/* '?', '*', '[', and '\\' are special in patterns. Without this
option, these characters are ordinary and fnmatch is not used. */
#define EXCLUDE_WILDCARDS (1 << 28)
struct exclude;
bool fnmatch_pattern_has_wildcards (const char *, int);
struct exclude *new_exclude (void);
void free_exclude (struct exclude *);
void add_exclude (struct exclude *, char const *, int);
int add_exclude_file (void (*) (struct exclude *, char const *, int),
struct exclude *, char const *, int, char);
bool excluded_file_name (struct exclude const *, char const *);
bool exclude_fnmatch (char const *pattern, char const *f, int options);
#endif /* _GL_EXCLUDE_H */
|
/**
****************************************************************************************
*
* @file audio_task.h
*
* @brief Header file - audio_task.
* @brief 128 UUID service. sample code
*
* Copyright (C) 2015 Dialog Semiconductor GmbH and its Affiliates, unpublished work
* This computer program includes Confidential, Proprietary Information and is a Trade Secret
* of Dialog Semiconductor GmbH and its Affiliates. All use, disclosure, and/or
* reproduction is prohibited unless authorized in writing. All Rights Reserved.
*
****************************************************************************************
*/
#ifndef AUDIO_TASK_H_
#define AUDIO_TASK_H_
/*
* INCLUDE FILES
****************************************************************************************
*/
#include <stdint.h>
#include "app_audio439.h"
#include "ke_task.h"
#include "rwip_config.h"
/*
* DEFINES
****************************************************************************************
*/
/// Maximum number of Sample128 task instances
#define AUDIO_IDX_MAX (1)
/*
* ENUMERATIONS
****************************************************************************************
*/
/// Possible states of the AUDIO task
enum audio_states {
AUDIO_ON,
AUDIO_OFF,
/// Number of defined states.
AUDIO_STATE_MAX
};
enum audio_encoding {
AUDIO_IMA,
AUDIO_ALAW,
AUDIO_RAW
};
/// Messages for Audio
enum audio_messages {
AUDIO_START_REQ = KE_FIRST_MSG(TASK_APP),
AUDIO_SAMPLES_IND,
AUDIO_STOP_REQ
};
/*
* API MESSAGES STRUCTURES
****************************************************************************************
*/
/// Parameters of the @ref AUDIO_START_REQ message
struct audio_start_req
{
uint16_t packets_required;
};
/// Parameters of the @ref AUDIO_SAMPLES_IND message
struct audio_samples_ind
{
enum audio_encoding encoding;
uint8_t bytes[AUDIO_ENC_SIZE];
};
/*
* GLOBAL VARIABLES DECLARATIONS
****************************************************************************************
*/
extern const struct ke_state_handler audio_state_handler[AUDIO_STATE_MAX];
extern const struct ke_state_handler audio_default_handler;
extern ke_state_t audio_state[AUDIO_IDX_MAX];
#endif // AUDIO_TASK_H_
|
#define COMPONENT breaching
#include "\u\ecf\addons\main\script_macro.h"
|
/* Copyright (C) 2014-2022 FastoGT. All right reserved.
This file is part of FastoNoSQL.
FastoNoSQL 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.
FastoNoSQL 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 FastoNoSQL. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <common/qt/gui/base/tree_model.h>
namespace fastonosql {
namespace core {
class NDbKValue;
}
namespace gui {
class FastoCommonModel : public common::qt::gui::TreeModel {
Q_OBJECT
public:
enum eColumn : uint8_t { eKey = 0, eValue = 1, eType = 2, eCountColumns = 3 };
explicit FastoCommonModel(QObject* parent = Q_NULLPTR);
QVariant data(const QModelIndex& index, int role) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int columnCount(const QModelIndex& parent) const override;
void changeValue(const core::NDbKValue& value);
Q_SIGNALS:
void changedValue(const core::NDbKValue& value);
};
} // namespace gui
} // namespace fastonosql
|
/**
* @file logincnslif.c
* Module purpose is to handle incoming and outgoing requests with console.
* Licensed under GNU GPL.
* For more information, see LICENCE in the main folder.
* @author Athena Dev Teams originally in login.c
* @author rAthena Dev Team
*/
#include "../common/mmo.h" //cbasetype + NAME_LENGTH
#include "../common/showmsg.h" //show notice
#include "../common/md5calc.h"
#include "../common/ers.h"
#include "../common/cli.h"
#include "../common/timer.h"
#include "../common/strlib.h"
#include "login.h"
#include "logincnslif.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/**
* Login-server console help: starting option info.
* Do not rename function used as extern.
* @param do_exit: terminate program execution ?
*/
void display_helpscreen(bool do_exit) {
ShowInfo("Usage: %s [options]\n", SERVER_NAME);
ShowInfo("\n");
ShowInfo("Options:\n");
ShowInfo(" -?, -h [--help]\t\tDisplays this help screen.\n");
ShowInfo(" -v [--version]\t\tDisplays the server's version.\n");
ShowInfo(" --run-once\t\t\tCloses server after loading (testing).\n");
ShowInfo(" --login-config <file>\t\tAlternative login-server configuration.\n");
ShowInfo(" --lan-config <file>\t\tAlternative lag configuration.\n");
ShowInfo(" --msg-config <file>\t\tAlternative message configuration.\n");
if( do_exit )
exit(EXIT_SUCCESS);
}
/**
* Read the option specified in command line
* and assign the confs used by the different server.
* @param argc:
* @param argv:
* @return true or Exit on failure.
*/
int logcnslif_get_options(int argc, char ** argv) {
int i = 0;
for (i = 1; i < argc; i++) {
const char* arg = argv[i];
if (arg[0] != '-' && (arg[0] != '/' || arg[1] == '-')) {// -, -- and /
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
} else if ((++arg)[0] == '-') {// long option
arg++;
if (strcmp(arg, "help") == 0) {
display_helpscreen(true);
} else if (strcmp(arg, "version") == 0) {
display_versionscreen(true);
} else if (strcmp(arg, "run-once") == 0){ // close the map-server as soon as its done.. for testing [Celest]
runflag = CORE_ST_STOP;
} else if (SERVER_TYPE & (ATHENA_SERVER_LOGIN)) { //login
if (strcmp(arg, "lan-config") == 0) {
if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.lanconf_name, argv[++i], sizeof(login_config.lanconf_name));
}
if (strcmp(arg, "login-config") == 0) {
if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.loginconf_name, argv[++i], sizeof(login_config.loginconf_name));
}
if (strcmp(arg, "msg-config") == 0) {
if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.msgconf_name, argv[++i], sizeof(login_config.msgconf_name));
} else {
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
}
}
} else switch (arg[0]) {// short option
case '?':
case 'h':
display_helpscreen(true);
break;
case 'v':
display_versionscreen(true);
break;
default:
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
}
}
return 1;
}
/**
* Console Command Parser
* Transmited from command cli.c
* note common name for all serv do not rename (extern in cli)
* @author [Wizputer]
* @param buf: buffer to parse, (from console)
* @return 1=success
*/
int cnslif_parse(const char* buf){
char type[64];
char command[64];
int n=0;
if( ( n = sscanf(buf, "%127[^:]:%255[^\n\r]", type, command) ) < 2 ){
if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
}
if( n != 2 ){ //end string
ShowNotice("Type: '%s'\n",type);
command[0] = '\0';
}
else
ShowNotice("Type of command: '%s' || Command: '%s'\n",type,command);
if( n == 2 ){
if(strcmpi("server", type) == 0 ){
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
runflag = 0;
}
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n");
}
if( strcmpi("create",type) == 0 )
{
char username[NAME_LENGTH], password[NAME_LENGTH], md5password[32+1], sex; //23+1 plaintext 32+1 md5
bool md5 = 0;
if( sscanf(command, "%23s %23s %c", username, password, &sex) < 3 || strnlen(username, sizeof(username)) < 4 || strnlen(password, sizeof(password)) < 1 ){
ShowWarning("Console: Invalid parameters for '%s'. Usage: %s <username> <password> <sex:F/M>\n", type, type);
return 0;
}
if( login_config.use_md5_passwds ){
MD5_String(password,md5password);
md5 = 1;
}
if( login_mmo_auth_new(username,(md5?md5password:password), TOUPPER(sex), "0.0.0.0") != -1 ){
ShowError("Console: Account creation failed.\n");
return 0;
}
ShowStatus("Console: Account '%s' created successfully.\n", username);
}
}
else if( strcmpi("ers_report", type) == 0 ){
ers_report();
}
else if( strcmpi("help", type) == 0 ){
ShowInfo("Available commands:\n");
ShowInfo("\t server:shutdown => Stops the server.\n");
ShowInfo("\t server:alive => Checks if the server is running.\n");
ShowInfo("\t ers_report => Displays database usage.\n");
ShowInfo("\t create:<username> <password> <sex:M|F> => Creates a new account.\n");
}
return 1;
}
/**
* Initialize the module.
* Launched at login-serv start, create db or other long scope variable here.
*/
void do_init_logincnslif(void){
if( login_config.console ) {
add_timer_func_list(parse_console_timer, "parse_console_timer");
add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
}
}
/**
* Handler to cleanup module, called when login-server stops.
*/
void do_final_logincnslif(void){
return;
}
|
/*
This file is part of Darling.
Copyright (C) 2021 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>
@protocol AFSiriActivationService
@end
|
/*
This file is part of cpp-elementrem.
cpp-elementrem 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.
cpp-elementrem 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 cpp-elementrem. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file util.c
* @author Tim Hughes <tim@twistedfury.com>
* @date 2015
*/
#include <stdarg.h>
#include <stdio.h>
#include "util.h"
// foward declare without all of Windows.h
__declspec(dllimport) void __stdcall OutputDebugStringA(char const* lpOutputString);
void debugf(char const* str, ...)
{
va_list args;
va_start(args, str);
char buf[1<<16];
_vsnprintf_s(buf, sizeof(buf), sizeof(buf), str, args);
buf[sizeof(buf)-1] = '\0';
OutputDebugStringA(buf);
}
|
//
// SWFGetGateListRequest.h
// webfusion
//
// Created by Jack Shi on 13-7-23.
// Copyright (c) 2013年 Shisoft Corporation. All rights reserved.
//
#import <CGIJSONObject/CGIJSONObject.h>
@interface SWFGetGateListRequest : CGIRemoteObject
@end
@interface SWFGetGateListRequest (SWFMethods)
- (NSArray *) getGateList;
@end
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[4];
atomic_int atom_1_r1_1;
atomic_int atom_1_r8_0;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v4_r3 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v5_r5 = v4_r3 ^ v4_r3;
int v8_r6 = atomic_load_explicit(&vars[3+v5_r5], memory_order_seq_cst);
int v10_r8 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v14 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v14, memory_order_seq_cst);
int v15 = (v10_r8 == 0);
atomic_store_explicit(&atom_1_r8_0, v15, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[0], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[3], 0);
atomic_init(&vars[1], 0);
atomic_init(&atom_1_r1_1, 0);
atomic_init(&atom_1_r8_0, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v11 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v12 = atomic_load_explicit(&atom_1_r8_0, memory_order_seq_cst);
int v13_conj = v11 & v12;
if (v13_conj == 1) assert(0);
return 0;
}
|
/*
* NXP TDA18212HN silicon tuner driver
*
* Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
*
* 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 TDA18212_H
#define TDA18212_H
#include "dvb_frontend.h"
struct tda18212_config
{
u16 if_dvbt_6;
u16 if_dvbt_7;
u16 if_dvbt_8;
u16 if_dvbt2_5;
u16 if_dvbt2_6;
u16 if_dvbt2_7;
u16 if_dvbt2_8;
u16 if_dvbc;
u16 if_atsc_vsb;
u16 if_atsc_qam;
/*
* pointer to DVB frontend
*/
struct dvb_frontend *fe;
};
#endif
|
/**
* @file
* Header file necessary to include when using the \e GtkExperimentTranscript
* widget.
*/
/*
* Copyright (C) 2012-2013 Otto-von-Guericke-Universität Magdeburg
*
* 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 __GTK_EXPERIMENT_TRANSCRIPT_H
#define __GTK_EXPERIMENT_TRANSCRIPT_H
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <experiment-reader.h>
G_BEGIN_DECLS
/** \e GtkExperimentTranscript error domain */
#define GTK_EXPERIMENT_TRANSCRIPT_ERROR \
(gtk_experiment_transcript_error_quark())
/** \e GtkExperimentTranscript error codes */
typedef enum {
GTK_EXPERIMENT_TRANSCRIPT_ERROR_FILEOPEN, /**< Error opening file */
GTK_EXPERIMENT_TRANSCRIPT_ERROR_REGEXCAPTURES, /**< Additional regular expression captures used */
GTK_EXPERIMENT_TRANSCRIPT_ERROR_LINELENGTH /**< Line read is too long */
} GtkExperimentTranscriptError;
/** \e GtkExperimentTranscript type */
#define GTK_TYPE_EXPERIMENT_TRANSCRIPT \
(gtk_experiment_transcript_get_type())
/**
* Cast instance pointer to \e GtkExperimentTranscript
*
* @param obj Object to cast to \e GtkExperimentTranscript
* @return \e obj casted to \e GtkExperimentTranscript
*/
#define GTK_EXPERIMENT_TRANSCRIPT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_EXPERIMENT_TRANSCRIPT, GtkExperimentTranscript))
#define GTK_EXPERIMENT_TRANSCRIPT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_EXPERIMENT_TRANSCRIPT, GtkExperimentTranscriptClass))
#define GTK_IS_EXPERIMENT_TRANSCRIPT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_EXPERIMENT_TRANSCRIPT))
#define GTK_IS_EXPERIMENT_TRANSCRIPT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_EXPERIMENT_TRANSCRIPT))
#define GTK_EXPERIMENT_TRANSCRIPT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_EXPERIMENT_TRANSCRIPT, GtkExperimentTranscriptClass))
/** @private */
typedef struct _GtkExperimentTranscriptPrivate GtkExperimentTranscriptPrivate;
/**
* \e GtkExperimentTranscript instance structure
*/
typedef struct _GtkExperimentTranscript {
GtkWidget parent_instance; /**< Parent instance structure */
gchar *speaker; /**< Name of speaker whose contributions are displayed (\b read-only) */
/**
* Default formattings to apply for interactive for interactive format
* rules if no Pango markup is specified.
* A \c NULL pointer means that the correspondig text property will not
* be changed. After widget instantiation all fields are \c NULL.
*/
struct _GtkExperimentTranscriptInteractiveFormat {
PangoFontDescription *default_font; /**< Default interactive format font */
GdkColor *default_text_color; /**< Default interactive format text color */
GdkColor *default_bg_color; /**< Default interactive format background color */
} interactive_format;
GtkExperimentTranscriptPrivate *priv; /**< @private Pointer to \b private instance attributes */
} GtkExperimentTranscript;
/**
* \e GtkExperimentTranscript class structure
*/
typedef struct _GtkExperimentTranscriptClass {
GtkWidgetClass parent_class; /**< Parent class structure */
} GtkExperimentTranscriptClass;
/** @private */
GQuark gtk_experiment_transcript_error_quark(void);
/** @private */
GType gtk_experiment_transcript_get_type(void);
/*
* API
*/
GtkWidget *gtk_experiment_transcript_new(const gchar *speaker);
gboolean gtk_experiment_transcript_load(GtkExperimentTranscript *trans,
ExperimentReader *exp);
gboolean gtk_experiment_transcript_load_filename(GtkExperimentTranscript *trans,
const gchar *filename);
void gtk_experiment_transcript_set_use_backdrop_area(GtkExperimentTranscript *trans,
gboolean use);
gboolean gtk_experiment_transcript_get_use_backdrop_area(GtkExperimentTranscript *trans);
void gtk_experiment_transcript_set_backdrop_area(GtkExperimentTranscript *trans,
gint64 start, gint64 end);
void gtk_experiment_transcript_set_reverse_mode(GtkExperimentTranscript *trans,
gboolean reverse);
gboolean gtk_experiment_transcript_get_reverse_mode(GtkExperimentTranscript *trans);
void gtk_experiment_transcript_set_alignment(GtkExperimentTranscript *trans,
PangoAlignment alignment);
PangoAlignment gtk_experiment_transcript_get_alignment(GtkExperimentTranscript *trans);
gboolean gtk_experiment_transcript_load_formats(GtkExperimentTranscript *trans,
const gchar *filename,
GError **error);
gboolean gtk_experiment_transcript_set_interactive_format(GtkExperimentTranscript *trans,
const gchar *format_str,
gboolean with_markup,
GError **error);
GtkAdjustment *gtk_experiment_transcript_get_time_adjustment(GtkExperimentTranscript *trans);
void gtk_experiment_transcript_set_time_adjustment(GtkExperimentTranscript *trans,
GtkAdjustment *adj);
G_END_DECLS
#endif
|
/*
============================================================================
Name : visbility.c
Author : Ikaro Silva
Version :
Copyright : GPL
Description : Visibility Graph
============================================================================
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/visibility.d" -MT"src/visibility.d" -o "src/visibility.o" "../src/visibility.c"
gcc -o "visibility" ./src/visibility.o
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
long input(void);
/* Global variables. */
long N=0;
double *input_data; /* input data buffer; allocated and filled by input()
x and y series will be interleaved starting with x
*/
static char *help_strings[] = {
"usage: visibility [OPTIONS ...]\n",
"where OPTIONS may include:",
" -h print this usage summary",
NULL
};
static void help()
{
int h;
fprintf(stderr, help_strings[0]);
for (h = 1; help_strings[h] != NULL; h++)
fprintf(stderr, "%s\n", help_strings[h]);
exit(-1);
}
int main(int argc,char* argv[]){
char ch;
while ((ch = getopt(argc,argv,"h"))!=EOF)
switch(ch){
case 'h':
help();
break;
default:
fprintf(stderr,"Unknown option for one: '%s'\n",optarg);
help();
}
argc-= optind;
argv += optind;
N=input();
int a=0,b=0,c=0;
double ya, yc, yb;
double ta, tc, tb;
long samples=N/2; //data is interleaved
int* count=malloc(samples*sizeof(int));
double* Pk=malloc(samples*sizeof(double));
//Calculate the visibility count
int isVisible=1;
for(a=0;a<N-3;a=a+2){
*(count+a)=1;
*(count+a+2)=1;
ta=*(input_data+a);
ya=*(input_data+a+1);
for(b=a+4;b<N-1;b=b+2){
isVisible=1;
tb=*(input_data+b);
yb=*(input_data+b+1);
for(c=a+2;c<b;c=c+2){
tc=*(input_data+c);
yc=*(input_data+c+1);
if ( yc > (yb + (ya -yb)*(tb-tc)/(tb-ta)) ){
//Visibility broken, exit loop inner loop only
isVisible=0;
break;
}
}
if(isVisible==1){
//C is visible to A. Add count to both nodes
*(count+a)= *(count+a) + 1;
*(count+c)= *(count+c) + 1;
}
}
//Add to the degree distribution P(k)
*(Pk + *(count+a) ) = *( Pk + *(count+a)) + 1 ;
}
//Normalize Pk by the total number of nodes
for(a=0;a<samples;a++)
*(Pk + a) = *(Pk + a)/samples ;
//Output the degree distribution
for(a=0;a<samples;a++){
if( *(Pk + a) != 0)
printf("%u %f\n",a,*(Pk + a));
}
return 0;
}
long input()
{
long maxdat = 0L, npts = 0L;
double x,y;
while (scanf("%f %f",&x,&y) == 2) {
if (npts >= maxdat) {
double *s;
maxdat += 50000; /* allow the input buffer to grow (the increment is arbitrary) */
if ((s = realloc(input_data, maxdat * sizeof(double))) == NULL) {
fprintf(stderr,"insufficient memory, exiting program!");
exit(-1);
}
input_data = s;
}
input_data[npts] = x;
npts++;
input_data[npts] = y;
npts++;
}
if (npts < 1){
printf(stderr,"Error, no data read!");
exit(-1);
}
return (npts);
}
|
#ifndef INTERVIEW_OPTIONS_H
#define INTERVIEW_OPTIONS_H
#include <string>
#include <vector>
#include <memory>
#include <fstream>
#include <iostream>
#include <sstream>
/// options structure
/// @notes boost program_options is much stronger than any home spun options
struct options {
/// going the extra mile: handle zero or more patterns
typedef std::vector<std::string> pattern_vector;
/// vector of patterns
pattern_vector _patterns;
protected:
/// default ctor
options();
private:
/// private copy ctor
options(const options&);
public:
/// dtor
virtual ~options();
/// returns either the opened stream or standard in
/// @return either the opened stream or standard in
virtual std::istream& stream() = 0;
};
struct test_options : options {
/// ctor
/// @param text a string test case
/// @param patterns the patterns against which to match
test_options(const std::string& text, const pattern_vector& patterns);
/// dtor
virtual ~test_options();
/// returns either the opened stream or standard in
/// @return either the opened stream or standard in
virtual std::istream& stream() override;
private:
/// a string test case
std::string _text;
/// a string stream ptr from which to read
std::shared_ptr<std::stringstream> _ss;
};
struct command_line_options : options {
/// ctor
/// @param argc the number of input args
/// @param argv the input args themselves
command_line_options(int argc, char* argv[]);
/// dtor
virtual ~command_line_options();
/// returns either the opened stream or standard in
/// @return either the opened stream or standard in
virtual std::istream& stream() override;
/// returns whether to use PCRE
/// @returns whether to use PCRE
bool use_pcre();
private:
/// whether to use PCRE
bool _use_pcre;
/// the filename of interest
std::string _filename;
/// an input stream ptr
std::shared_ptr<std::ifstream> _ifs;
/// returns whether the arg is the filename one
/// @param arg the command line arg
/// @param name_pattern a string name pattern
/// @returns whether is filename arg
static bool is_switch(const std::string& arg, const std::string& name_pattern);
/// opens the filename if it were possible
void open();
};
#endif //INTERVIEW_OPTIONS_H
|
/**
* @file
* This file contains the declaration of the templated Func_unot, which is used to to compare to values ( !a ).
*
* @brief Declaration unot implementation of Func__unot
*
* (c) Copyright 2009- under GPL version 3
* @date Last modified: $Date: 2012-06-12 10:25:58 +0200 (Tue, 12 Jun 2012) $
* @author The RevBayes Development Core Team
* @license GPL version 3
* @version 1.0
*
* $Id: Func_vector.h 1626 2012-06-12 08:25:58Z hoehna $
*/
#ifndef Func__unot_H
#define Func__unot_H
#include <string>
#include <iosfwd>
#include <vector>
#include "RlBoolean.h"
#include "RlTypedFunction.h"
#include "DeterministicNode.h"
#include "DynamicNode.h"
#include "RbBoolean.h"
#include "RevPtr.h"
#include "RlDeterministicNode.h"
#include "TypedDagNode.h"
#include "TypedFunction.h"
namespace RevLanguage {
class ArgumentRules;
class TypeSpec;
class Func__unot : public TypedFunction<RlBoolean> {
public:
Func__unot();
// Basic utility functions
Func__unot* clone(void) const; //!< Clone the object
static const std::string& getClassType(void); //!< Get Rev type
static const TypeSpec& getClassTypeSpec(void); //!< Get class type spec
std::string getFunctionName(void) const; //!< Get the primary name of the function in Rev
const TypeSpec& getTypeSpec(void) const; //!< Get language type of the object
bool isInternal(void) const { return true; } //!< Is this an internal function?
// Regular functions
RevBayesCore::TypedFunction<RevBayesCore::Boolean>* createFunction(void) const; //!< Create internal function object
const ArgumentRules& getArgumentRules(void) const; //!< Get argument rules
};
}
#endif
|
/**************************************************************************
* window.h *
* *
* Tactical Nuclear Beaver *
* *
* 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. *
* *
* 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 _WINDOW_H
#define _WINDOW_H
#include <GLFW/glfw3.h>
#include <FTGL/ftgl.h>
#include <SOIL/SOIL.h>
#include <vector>
#include <stdio.h>
#include <unistd.h>
#include <string>
#include <sstream>
#include <iostream>
#include "physics_engine.h"
#include "player.h"
#include "floor.h"
#define CONTROL_KEYBOARD 0
#define CONTROL_JOYSTICK 1
#define KEYDELAY_CHANGE_CONTROL 0
#define KEYDELAY_CHANGE_CONTROL_DELAY 0.5
class Window {
private:
unsigned int width;
unsigned int height;
unsigned char* image;
PhysicsEngine* physics_engine;
std::vector<Sprite*> sprites;
unsigned short control;
std::vector<double> keydelays;
// couple of variables to track the fps
double t0_value;
int fps_frame_count;
double fps;
double current_time;
double time_interval;
public:
Window();
int create(int argc, char *argv[]);
private:
void draw_canvas();
void draw_scene();
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void error_callback(int error, const char* description);
void write_text(uint _x, uint _y, std::string str, float fontsize, float r=0, float g=0, float b=0);
GLuint LoadTexture(std::string filename);
void draw_sprites();
void load_sprites();
void write_statistics();
void calculate_fps();
void joystick_control(GLFWwindow* window);
void keyboard_control(GLFWwindow* window);
};
#endif //_WINDOW_H
|
/* Copyright 2017 Marc Volker Dickmann
* Project: Doctra
*/
#include <stdio.h>
#include <string.h>
#include "../object.h"
#include "../node.h"
#include "export_md.h"
/**
* export_md_function()
* @self - The function data.
* @f_doc - Stream to which the data gets written.
*
* Exports a function object to the file @f_doc
* in Markdown.
*
* Return: none
*/
static void
export_md_function (struct doc_object *self, FILE *f_doc)
{
// Description
if (self->description != NULL)
{
fputs (self->description, f_doc);
}
// Parameters
fputs ("\n**Parameters**\n\n", f_doc);
fputs ("**Name** | **Description**\n", f_doc);
fputs ("-------- | ---------------\n", f_doc);
for (size_t i = 0; i < self->members_amnt; i++)
{
fputs (self->members[OBJ_MEMBERS_NAME][i], f_doc);
fputs (" | ", f_doc);
fputs (self->members[OBJ_MEMBERS_DESC][i], f_doc);
fputc ('\n', f_doc);
}
// Returns
if (self->returns != NULL)
{
fputs ("\n**Returns**\n", f_doc);
fputs (self->returns, f_doc);
fputs ("\n\n", f_doc);
}
}
/**
* export_md_struct()
* @self - The struct data.
* @f_doc - Stream to which the data gets written.
*
* Exports a struct object to the file @f_doc
* in Markdown.
*
* Return: none
*/
static void
export_md_struct (struct doc_object *self, FILE *f_doc)
{
// Description
if (self->description != NULL)
{
fputs (self->description, f_doc);
}
// Members
fputs ("\n**Members**\n\n", f_doc);
fputs ("**Name** | **Description**\n", f_doc);
fputs ("-------- | ---------------\n", f_doc);
for (size_t i = 0; i < self->members_amnt; i++)
{
fputs (self->members[OBJ_MEMBERS_NAME][i], f_doc);
fputs (" | ", f_doc);
fputs (self->members[OBJ_MEMBERS_DESC][i], f_doc);
fputc ('\n', f_doc);
}
}
/**
* export_md()
* @nodes - The list head.
* @filename - The name of the documentation file.
*
* Exports the @nodes in Markdown to a file named @filename.
*
* Return: none
*/
void
export_md (struct doc_node *nodes, const char *filename)
{
FILE *f_doc = fopen (filename, "w");
if (f_doc == NULL)
{
return;
}
struct doc_node *next = nodes;
while (next)
{
// The name of the object as H1
fputs ("# ", f_doc);
fputs (next->name, f_doc);
fputc ('\n', f_doc);
switch (next->type)
{
case DOC_NODE_FUNCTION:
export_md_function (&next->element, f_doc);
break;
case DOC_NODE_STRUCT:
export_md_struct (&next->element, f_doc);
break;
default:
break;
}
next = next->next;
}
fclose (f_doc);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.