text
stringlengths 4
6.14k
|
|---|
/* $Header: /usr/local/dslrepos/uClinux-dist/user/tcsh/patchlevel.h,v 1.1.1.1 2003/08/18 05:40:15 kaohj Exp $ */
/*
* patchlevel.h: Our life story.
*/
#ifndef _h_patchlevel
#define _h_patchlevel
#define ORIGIN "Astron"
#define REV 6
#define VERS 10
#define PATCHLEVEL 0
#define DATE "2000-11-19"
#endif /* _h_patchlevel */
|
/*
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_GAMEOBJECTAI_H
#define TRINITY_GAMEOBJECTAI_H
#include "Define.h"
#include "ObjectGuid.h"
#include "QuestDef.h"
class GameObject;
class Unit;
class SpellInfo;
class TC_GAME_API GameObjectAI
{
protected:
GameObject* const me;
public:
explicit GameObjectAI(GameObject* g) : me(g) { }
virtual ~GameObjectAI() { }
virtual void UpdateAI(uint32 /*diff*/) { }
virtual void InitializeAI() { Reset(); }
virtual void Reset() { }
// Pass parameters between AI
virtual void DoAction(int32 /*param = 0 */) { }
virtual void SetGUID(ObjectGuid const& /*guid*/, int32 /*id = 0 */) { }
virtual ObjectGuid GetGUID(int32 /*id = 0 */) const { return ObjectGuid::Empty; }
static int32 Permissible(GameObject const* go);
// Called when a player opens a gossip dialog with the gameobject.
virtual bool GossipHello(Player* /*player*/) { return false; }
// Called when a player selects a gossip item in the gameobject's gossip menu.
virtual bool GossipSelect(Player* /*player*/, uint32 /*menuId*/, uint32 /*gossipListId*/) { return false; }
// Called when a player selects a gossip with a code in the gameobject's gossip menu.
virtual bool GossipSelectCode(Player* /*player*/, uint32 /*menuId*/, uint32 /*gossipListId*/, char const* /*code*/) { return false; }
// Called when a player accepts a quest from the gameobject.
virtual void QuestAccept(Player* /*player*/, Quest const* /*quest*/) { }
// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
virtual void QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { }
// Called when the dialog status between a player and the gameobject is requested.
virtual uint32 GetDialogStatus(Player* /*player*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
// Called when a Player clicks a GameObject, before GossipHello
// prevents achievement tracking if returning true
virtual bool OnReportUse(Player* /*player*/) { return false; }
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) { }
virtual void Damaged(Player* /*player*/, uint32 /*eventId*/) { }
virtual uint32 GetData(uint32 /*id*/) const { return 0; }
virtual void SetData64(uint32 /*id*/, uint64 /*value*/) { }
virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) { }
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) { }
virtual void OnLootStateChanged(uint32 /*state*/, Unit* /*unit*/) { }
virtual void OnStateChanged(uint32 /*state*/) { }
virtual void EventInform(uint32 /*eventId*/) { }
virtual void SpellHit(Unit* /*unit*/, SpellInfo const* /*spellInfo*/) { }
};
class TC_GAME_API NullGameObjectAI : public GameObjectAI
{
public:
explicit NullGameObjectAI(GameObject* g);
void UpdateAI(uint32 /*diff*/) override { }
static int32 Permissible(GameObject const* go);
};
#endif
|
//
// DataBackupView.h
// PUER
//
// Created by admin on 14-9-12.
// Copyright (c) 2014年 com.dieshang.PUER. All rights reserved.
//
#import <UIKit/UIKit.h>
@class DataBackupView;
@protocol DataBackupViewDelegate <NSObject>
- (UIView *)overlayView:(DataBackupView *)view didHitTest:(CGPoint)point withEvent:(UIEvent *)event;
@end
@interface DataBackupView : UIView
@property (weak, nonatomic) id<DataBackupViewDelegate> delegate;
@end
|
/* Definitions for Linux-based GNU systems with ELF format
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004
Free Software Foundation, Inc.
Contributed by Eric Youngdale.
Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org).
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Don't assume anything about the header files. */
#define NO_IMPLICIT_EXTERN_C
#undef ASM_APP_ON
#define ASM_APP_ON "#APP\n"
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
#undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX
/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
provides part of the support for getting C++ file-scope static
object constructed before entering `main'. */
#undef STARTFILE_SPEC
#if defined HAVE_LD_PIE
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
#else
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
#endif
/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
the GNU/Linux magical crtend.o file (see crtstuff.c) which
provides part of the support for getting C++ file-scope static
object constructed before entering `main', followed by a normal
GNU/Linux "finalizer" file, `crtn.o'. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
/* This is for -profile to use -lc_p instead of -lc. */
#ifndef CC1_SPEC
#define CC1_SPEC "%{profile:-p}"
#endif
/* The GNU C++ standard library requires that these macros be defined. */
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
#undef LIB_SPEC
#define LIB_SPEC \
"%{pthread:-lpthread} \
%{shared:-lc} \
%{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
#define LINUX_TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define ("__gnu_linux__"); \
builtin_define_std ("linux"); \
builtin_define_std ("unix"); \
builtin_assert ("system=linux"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} while (0)
#if defined(HAVE_LD_EH_FRAME_HDR)
#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
#endif
/* Define this so we can compile MS code for use with WINE. */
#define HANDLE_PRAGMA_PACK_PUSH_POP
#define LINK_GCC_C_SEQUENCE_SPEC \
"%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
/* Use --as-needed -lgcc_s for eh support. */
#ifdef HAVE_LD_AS_NEEDED
#define USE_LD_AS_NEEDED 1
#endif
/* Determine whether the the entire c99 runtime
is present in the runtime library. */
#define TARGET_C99_FUNCTIONS 1
#define TARGET_HAS_F_SETLKW
|
/* Load firmware into Core B on a BF561
*
* Copyright 2004-2009 Analog Devices Inc.
* Licensed under the GPL-2 or later.
*/
/* The Core B reset func requires code in the application that is loaded into
* Core B. In order to reset, the application needs to install an interrupt
* handler for Supplemental Interrupt 0, that sets RETI to 0xff600000 and
* writes bit 11 of SICB_SYSCR when bit 5 of SICA_SYSCR is 0. This causes Core
* B to stall when Supplemental Interrupt 0 is set, and will reset PC to
* 0xff600000 when COREB_SRAM_INIT is cleared.
*/
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#define CMD_COREB_START _IO('b', 0)
#define CMD_COREB_STOP _IO('b', 1)
#define CMD_COREB_RESET _IO('b', 2)
static long
coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret = 0;
switch (cmd) {
case CMD_COREB_START:
bfin_write_SYSCR(bfin_read_SYSCR() & ~0x0020);
break;
case CMD_COREB_STOP:
bfin_write_SYSCR(bfin_read_SYSCR() | 0x0020);
bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080);
break;
case CMD_COREB_RESET:
bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080);
break;
default:
ret = -EINVAL;
break;
}
CSYNC();
return ret;
}
static const struct file_operations coreb_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = coreb_ioctl,
.llseek = noop_llseek,
};
static struct miscdevice coreb_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "coreb",
.fops = &coreb_fops,
};
static int __init bf561_coreb_init(void)
{
return misc_register(&coreb_dev);
}
module_init(bf561_coreb_init);
static void __exit bf561_coreb_exit(void)
{
misc_deregister(&coreb_dev);
}
module_exit(bf561_coreb_exit);
MODULE_AUTHOR("Bas Vermeulen <bvermeul@blackstar.xs4all.nl>");
MODULE_DESCRIPTION("BF561 Core B Support");
MODULE_LICENSE("GPL");
|
/* $Header: /roq/tiff/tif_dumpmode.c 1 11/02/99 4:39p Zaphod $ */
/*
* Copyright (c) 1988-1996 Sam Leffler
* Copyright (c) 1991-1996 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* TIFF Library.
*
* "Null" Compression Algorithm Support.
*/
#include "tiffiop.h"
/*
* Encode a hunk of pixels.
*/
static int
DumpModeEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
{
(void) s;
while (cc > 0) {
tsize_t n;
n = cc;
if (tif->tif_rawcc + n > tif->tif_rawdatasize)
n = tif->tif_rawdatasize - tif->tif_rawcc;
/*
* Avoid copy if client has setup raw
* data buffer to avoid extra copy.
*/
if (tif->tif_rawcp != pp)
_TIFFmemcpy(tif->tif_rawcp, pp, n);
tif->tif_rawcp += n;
tif->tif_rawcc += n;
pp += n;
cc -= n;
if (tif->tif_rawcc >= tif->tif_rawdatasize &&
!TIFFFlushData1(tif))
return (-1);
}
return (1);
}
/*
* Decode a hunk of pixels.
*/
static int
DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
{
(void) s;
if (tif->tif_rawcc < cc) {
TIFFError(tif->tif_name,
"DumpModeDecode: Not enough data for scanline %d",
tif->tif_row);
return (0);
}
/*
* Avoid copy if client has setup raw
* data buffer to avoid extra copy.
*/
if (tif->tif_rawcp != buf)
_TIFFmemcpy(buf, tif->tif_rawcp, cc);
tif->tif_rawcp += cc;
tif->tif_rawcc -= cc;
return (1);
}
/*
* Seek forwards nrows in the current strip.
*/
static int
DumpModeSeek(TIFF* tif, uint32 nrows)
{
tif->tif_rawcp += nrows * tif->tif_scanlinesize;
tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
return (1);
}
/*
* Initialize dump mode.
*/
int
TIFFInitDumpMode(TIFF* tif, int scheme)
{
(void) scheme;
tif->tif_decoderow = DumpModeDecode;
tif->tif_decodestrip = DumpModeDecode;
tif->tif_decodetile = DumpModeDecode;
tif->tif_encoderow = DumpModeEncode;
tif->tif_encodestrip = DumpModeEncode;
tif->tif_encodetile = DumpModeEncode;
tif->tif_seek = DumpModeSeek;
return (1);
}
|
/*
* (C) Copyright 2000
* Sangmoon Kim, Etin Systems. dogoil@etinsys.com.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <mpc824x.h>
#include <pci.h>
#include <i2c.h>
#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
int checkboard (void)
{
/*TODO: Check processor type */
puts ( "Board: Debris "
#ifdef CONFIG_MPC8240
"8240"
#endif
#ifdef CONFIG_MPC8245
"8245"
#endif
" ##Test not implemented yet##\n");
return 0;
}
#if 0 /* NOT USED */
int checkflash (void)
{
/* TODO: XXX XXX XXX */
printf ("## Test not implemented yet ##\n");
return (0);
}
#endif
phys_size_t initdram (int board_type)
{
int m, row, col, bank, i;
unsigned long start, end;
uint32_t mccr1;
uint32_t mear1 = 0, emear1 = 0, msar1 = 0, emsar1 = 0;
uint32_t mear2 = 0, emear2 = 0, msar2 = 0, emsar2 = 0;
uint8_t mber = 0;
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
if (i2c_reg_read (0x50, 2) != 0x04) return 0; /* Memory type */
m = i2c_reg_read (0x50, 5); /* # of physical banks */
row = i2c_reg_read (0x50, 3); /* # of rows */
col = i2c_reg_read (0x50, 4); /* # of columns */
bank = i2c_reg_read (0x50, 17); /* # of logical banks */
CONFIG_READ_WORD(MCCR1, mccr1);
mccr1 &= 0xffff0000;
start = CONFIG_SYS_SDRAM_BASE;
end = start + (1 << (col + row + 3) ) * bank - 1;
for (i = 0; i < m; i++) {
mccr1 |= ((row == 13)? 2 : (bank == 4)? 0 : 3) << i * 2;
if (i < 4) {
msar1 |= ((start >> 20) & 0xff) << i * 8;
emsar1 |= ((start >> 28) & 0xff) << i * 8;
mear1 |= ((end >> 20) & 0xff) << i * 8;
emear1 |= ((end >> 28) & 0xff) << i * 8;
} else {
msar2 |= ((start >> 20) & 0xff) << (i-4) * 8;
emsar2 |= ((start >> 28) & 0xff) << (i-4) * 8;
mear2 |= ((end >> 20) & 0xff) << (i-4) * 8;
emear2 |= ((end >> 28) & 0xff) << (i-4) * 8;
}
mber |= 1 << i;
start += (1 << (col + row + 3) ) * bank;
end += (1 << (col + row + 3) ) * bank;
}
for (; i < 8; i++) {
if (i < 4) {
msar1 |= 0xff << i * 8;
emsar1 |= 0x30 << i * 8;
mear1 |= 0xff << i * 8;
emear1 |= 0x30 << i * 8;
} else {
msar2 |= 0xff << (i-4) * 8;
emsar2 |= 0x30 << (i-4) * 8;
mear2 |= 0xff << (i-4) * 8;
emear2 |= 0x30 << (i-4) * 8;
}
}
CONFIG_WRITE_WORD(MCCR1, mccr1);
CONFIG_WRITE_WORD(MSAR1, msar1);
CONFIG_WRITE_WORD(EMSAR1, emsar1);
CONFIG_WRITE_WORD(MEAR1, mear1);
CONFIG_WRITE_WORD(EMEAR1, emear1);
CONFIG_WRITE_WORD(MSAR2, msar2);
CONFIG_WRITE_WORD(EMSAR2, emsar2);
CONFIG_WRITE_WORD(MEAR2, mear2);
CONFIG_WRITE_WORD(EMEAR2, emear2);
CONFIG_WRITE_BYTE(MBER, mber);
return (1 << (col + row + 3) ) * bank * m;
}
/*
* Initialize PCI Devices, report devices found.
*/
#ifndef CONFIG_PCI_PNP
static struct pci_config_table pci_debris_config_table[] = {
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
PCI_ENET0_MEMADDR,
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
PCI_ENET1_MEMADDR,
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
{ }
};
#endif
struct pci_controller hose = {
#ifndef CONFIG_PCI_PNP
config_table: pci_debris_config_table,
#endif
};
void pci_init_board(void)
{
pci_mpc824x_init(&hose);
}
void *nvram_read(void *dest, const long src, size_t count)
{
volatile uchar *d = (volatile uchar*) dest;
volatile uchar *s = (volatile uchar*) src;
while(count--) {
*d++ = *s++;
asm volatile("sync");
}
return dest;
}
void nvram_write(long dest, const void *src, size_t count)
{
volatile uchar *d = (volatile uchar*)dest;
volatile uchar *s = (volatile uchar*)src;
while(count--) {
*d++ = *s++;
asm volatile("sync");
}
}
int misc_init_r(void)
{
/* Write ethernet addr in NVRAM for VxWorks */
nvram_write(CONFIG_ENV_ADDR + CONFIG_SYS_NVRAM_VXWORKS_OFFS,
(char*)&gd->bd->bi_enetaddr[0], 6);
return 0;
}
int board_eth_init(bd_t *bis)
{
return pci_eth_init(bis);
}
|
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ENTRY_EDITOR_H_
#define _KIS_ENTRY_EDITOR_H_
#include <QObject>
class QString;
namespace KisMetaData
{
class Store;
}
class KisEntryEditor : public QObject
{
Q_OBJECT
struct Private;
public:
KisEntryEditor(QObject* obj, KisMetaData::Store* store, QString key, QString propertyName, QString structField, int arrayIndex);
~KisEntryEditor();
public Q_SLOTS:
void valueEdited();
void valueChanged();
Q_SIGNALS:
void valueHasBeenEdited();
private:
Private* const d;
};
#endif
|
//////////////////////////////////////////////////////////////////////////
// Family Basic Keyboard //
//////////////////////////////////////////////////////////////////////////
class EXPAD_Keyboard : public EXPAD
{
public:
EXPAD_Keyboard( NES* parent ) : EXPAD( parent ) {}
void Reset();
BYTE Read4016();
BYTE Read4017();
void Write4016( BYTE data );
protected:
BOOL bGraph;
BOOL bOut;
BYTE ScanNo;
private:
};
|
/*
* $Id: tcp_server.h,v 1.3 2003/07/01 20:23:51 andrei Exp $
*
* Copyright (C) 2001-2003 Fhg Fokus
*
* This file is part of ser, a free SIP server.
*
* ser is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* For a license to use the ser software under conditions
* other than those described here, or to purchase support for this
* software, please contact iptel.org by e-mail at the following addresses:
* info@iptel.org
*
* ser is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef tcp_server_h
#define tcp_server_h
/* "public" functions*/
struct tcp_connection* tcpconn_get(int id, struct ip_addr* ip, int port,
int timeout);
void tcpconn_put(struct tcp_connection* c);
int tcp_send(int type, char* buf, unsigned len, union sockaddr_union* to,
int id);
#endif
|
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
* Copyright (C) 2010, 2012, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <functional>
#include <wtf/Forward.h>
#include <wtf/Function.h>
namespace WebCore {
class FileStreamClient;
class FileStream;
class URL;
class WEBCORE_EXPORT AsyncFileStream {
public:
explicit AsyncFileStream(FileStreamClient&);
~AsyncFileStream();
void getSize(const String& path, double expectedModificationTime);
void openForRead(const String& path, long long offset, long long length);
void close();
void read(char* buffer, int length);
private:
void start();
void perform(Function<std::function<void(FileStreamClient&)>(FileStream&)>&&);
struct Internals;
std::unique_ptr<Internals> m_internals;
};
} // namespace WebCore
|
/*
* Copyright (c) International Business Machines Corp., 2001
*
* 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
*
* NAME
* fork08.c
*
* DESCRIPTION
* Check if the parent's file descriptors are affected by
* actions in the child; they should not be.
*
* ALGORITHM
* Parent opens a file.
* Forks a child which closes a file.
* Parent forks a second child which attempts to read the (closed)
* file.
*
* USAGE
* fork08
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
*
* RESTRICTIONS
* None
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <stdio.h>
#include "test.h"
#include "usctest.h"
char *TCID = "fork08";
int TST_TOTAL = 1;
static void setup(void);
static void cleanup(void);
static char pbuf[10];
static char fnamebuf[40];
int main(int ac, char **av)
{
int status, count, forks, pid1;
int ch_r_stat;
FILE *rea, *writ;
int lc;
const char *msg;
msg = parse_opts(ac, av, NULL, NULL);
if (msg != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
writ = fopen(fnamebuf, "w");
if (writ == NULL)
tst_resm(TFAIL, "failed to fopen file for write");
rea = fopen(fnamebuf, "r");
if (rea == NULL)
tst_resm(TFAIL, "failed to fopen file for read");
fprintf(writ, "abcdefghijklmnopqrstuv");
fflush(writ);
sleep(1);
if ((getc(rea)) != 'a')
tst_resm(TFAIL, "getc from read side was confused");
forks = 0;
forkone:
++forks;
pid1 = fork();
if (pid1 != 0) {
tst_resm(TINFO, "parent forksval: %d", forks);
if ((pid1 != (-1)) && (forks < 2))
goto forkone;
else if (pid1 < 0)
tst_resm(TINFO, "Fork failed");
} else { /* child */
/*
* If first child close the file descriptor for the
* read stream
*/
if (forks == 1) {
if ((fclose(rea)) == -1) {
tst_resm(TFAIL, "error in first child"
" closing fildes");
}
_exit(0);
}
/*
* If second child attempt to read from the file
*/
else if (forks == 2) {
ch_r_stat = getc(rea);
tst_resm(TINFO, "second child got char: %c",
ch_r_stat);
if (ch_r_stat == 'b') {
tst_resm(TPASS, "Test passed in child"
"number %d", forks);
exit(0);
} else if (ch_r_stat == EOF) {
tst_resm(TFAIL, "Second child got "
"EOF");
exit(-1);
} else {
tst_resm(TFAIL, "test failed in child"
"no %d", forks);
exit(-1);
}
} else { /* end of second child */
tst_resm(TINFO, "forksnumber: %d", forks);
exit(3);
}
}
for (count = 0; count <= forks; count++) {
wait(&status);
tst_resm(TINFO, "exit status of wait "
" expected 0 got %d", status);
status >>= 8;
if (status == 0)
tst_resm(TPASS, "parent test PASSED");
else
tst_resm(TFAIL, "parent test FAILED");
}
tst_resm(TINFO, "Number of processes forked is %d", forks);
fclose(rea);
fclose(writ);
}
cleanup();
tst_exit();
}
static void setup(void)
{
tst_sig(FORK, DEF_HANDLER, cleanup);
umask(0);
TEST_PAUSE;
tst_tmpdir();
strcpy(fnamebuf, "fork07.");
sprintf(pbuf, "%d", getpid());
strcat(fnamebuf, pbuf);
}
static void cleanup(void)
{
TEST_CLEANUP;
tst_rmdir();
}
|
/*
* Copyright (C) 2011 Department of Robotics Brain and Cognitive Sciences - Istituto Italiano di Tecnologia
* Authors: Vadim Tikhanoff
* email: vadim.tikhanoff@iit.it
* website: www.robotcub.org
* Permission is granted to copy, distribute, and/or modify this program
* under the terms of the GNU General Public License, version 2 or any
* later version published by the Free Software Foundation.
*
* A copy of the license can be found at
* http://www.robotcub.org/icub/license/gpl.txtd
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details
*/
#include <cv.h>
#include <highgui.h>
#include <yarp/os/RateThread.h>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <yarp/os/all.h>
#define DENSE 1
using namespace cv;
/**
* \ingroup StereoVisionLib
*
* The base class defining the 2D optical flow.
* It computes the 2D motion field in the image.
*/
class OpticalFlowThread : public yarp::os::RateThread
{
private:
cv::Mat optFlow;
cv::Mat leftPrev;
cv::Mat leftNext;
bool done;
bool work;
bool dense;
void computeFlowSparse(IplImage* previous, IplImage* current, Mat &optFlow);
public:
OpticalFlowThread(yarp::os::ResourceFinder &rf);
~OpticalFlowThread() {};
void setImages(cv::Mat &_leftPrev, cv::Mat &_leftNext);
void getOptFlow(cv::Mat &_optFlow);
void setFlow(int flowType);
bool checkDone();
bool threadInit();
void threadRelease();
void run();
void onStop(void);
};
|
/*
translation.c : irssi
Copyright (C) 1999-2000 Timo Sirainen
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 "module.h"
#include "module-formats.h"
#include "signals.h"
#include "line-split.h"
#include "misc.h"
#include "levels.h"
#include "settings.h"
#include "printtext.h"
unsigned char translation_in[256], translation_out[256];
static char *current_translation;
void translation_reset(void)
{
int n;
for (n = 0; n < 256; n++)
translation_in[n] = (unsigned char) n;
for (n = 0; n < 256; n++)
translation_out[n] = (unsigned char) n;
}
void translate_output(char *text)
{
while (*text != '\0') {
*text = (char) translation_out[(int) (unsigned char) *text];
text++;
}
}
#define gethex(a) \
(i_isdigit(a) ? ((a)-'0') : (i_toupper(a)-'A'+10))
void translation_parse_line(const char *str, int *pos)
{
const char *ptr;
int value;
for (ptr = str; *ptr != '\0'; ptr++) {
if (ptr[0] != '0' || ptr[1] != 'x')
break;
ptr += 2;
value = (gethex(ptr[0]) << 4) + gethex(ptr[1]);
if (*pos < 256)
translation_in[*pos] = (unsigned char) value;
else
translation_out[*pos-256] = (unsigned char) value;
(*pos)++;
ptr += 2;
if (*ptr != ',') break;
}
}
int translation_read(const char *file)
{
char tmpbuf[1024], *str, *path;
LINEBUF_REC *buffer;
int f, pos, ret, recvlen;
g_return_val_if_fail(file != NULL, FALSE);
path = convert_home(file);
f = open(file, O_RDONLY);
g_free(path);
if (f == -1) {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_TRANSLATION_NOT_FOUND, file,
g_strerror(errno));
return FALSE;
}
pos = 0; buffer = NULL;
while (pos < 512) {
recvlen = read(f, tmpbuf, sizeof(tmpbuf));
ret = line_split(tmpbuf, recvlen, &str, &buffer);
if (ret <= 0) break;
translation_parse_line(str, &pos);
}
line_split_free(buffer);
close(f);
if (pos != 512) {
translation_reset();
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_TRANSLATION_FILE_ERROR, file);
}
return pos == 512;
}
static void read_settings(void)
{
const char *translation;
translation = settings_get_str("translation");
if (*translation == '\0') {
if (current_translation != NULL) {
g_free_and_null(current_translation);
translation_reset();
}
return;
}
if (current_translation == NULL ||
strcmp(translation, current_translation) != 0) {
g_free_not_null(current_translation);
current_translation = g_strdup(translation);
translation_read(translation);
}
}
void translation_init(void)
{
translation_reset();
current_translation = NULL;
settings_add_str("misc", "translation", "");
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
read_settings();
}
void translation_deinit(void)
{
read_settings();
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}
|
#ifndef __TUNER_E4000_H
#define __TUNER_E4000_H
/**
@file
@brief E4000 tuner module declaration
One can manipulate E4000 tuner through E4000 module.
E4000 module is derived from tuner module.
@par Example:
@code
// The example is the same as the tuner example in tuner_base.h except the listed lines.
#include "tuner_e4000.h"
...
int main(void)
{
TUNER_MODULE *pTuner;
E4000_EXTRA_MODULE *pTunerExtra;
TUNER_MODULE TunerModuleMemory;
BASE_INTERFACE_MODULE BaseInterfaceModuleMemory;
I2C_BRIDGE_MODULE I2cBridgeModuleMemory;
unsigned long BandwidthMode;
...
// Build E4000 tuner module.
BuildE4000Module(
&pTuner,
&TunerModuleMemory,
&BaseInterfaceModuleMemory,
&I2cBridgeModuleMemory,
0xac, // I2C device address is 0xac in 8-bit format.
CRYSTAL_FREQ_16384000HZ, // Crystal frequency is 16.384 MHz.
E4000_AGC_INTERNAL // The E4000 AGC mode is internal AGC mode.
);
// Get E4000 tuner extra module.
pTunerExtra = (T2266_EXTRA_MODULE *)(pTuner->pExtra);
// ==== Initialize tuner and set its parameters =====
...
// Set E4000 bandwidth.
pTunerExtra->SetBandwidthMode(pTuner, E4000_BANDWIDTH_6MHZ);
// ==== Get tuner information =====
...
// Get E4000 bandwidth.
pTunerExtra->GetBandwidthMode(pTuner, &BandwidthMode);
// See the example for other tuner functions in tuner_base.h
return 0;
}
@endcode
*/
#include "tuner_base.h"
// The following context is implemented for E4000 source code.
// Definition (implemeted for E4000)
#define E4000_1_SUCCESS 1
#define E4000_1_FAIL 0
#define E4000_I2C_SUCCESS 1
#define E4000_I2C_FAIL 0
// Function (implemeted for E4000)
int
I2CReadByte(
TUNER_MODULE *pTuner,
unsigned char NoUse,
unsigned char RegAddr,
unsigned char *pReadingByte
);
int
I2CWriteByte(
TUNER_MODULE *pTuner,
unsigned char NoUse,
unsigned char RegAddr,
unsigned char WritingByte
);
int
I2CWriteArray(
TUNER_MODULE *pTuner,
unsigned char NoUse,
unsigned char RegStartAddr,
unsigned char ByteNum,
unsigned char *pWritingBytes
);
// Functions (from E4000 source code)
int tunerreset (TUNER_MODULE *pTuner);
int Tunerclock(TUNER_MODULE *pTuner);
int Qpeak(TUNER_MODULE *pTuner);
int DCoffloop(TUNER_MODULE *pTuner);
int GainControlinit(TUNER_MODULE *pTuner);
int Gainmanual(TUNER_MODULE *pTuner);
int E4000_gain_freq(TUNER_MODULE *pTuner, int frequency);
int PLL(TUNER_MODULE *pTuner, int Ref_clk, int Freq);
int LNAfilter(TUNER_MODULE *pTuner, int Freq);
int IFfilter(TUNER_MODULE *pTuner, int bandwidth, int Ref_clk);
int freqband(TUNER_MODULE *pTuner, int Freq);
int DCoffLUT(TUNER_MODULE *pTuner);
int GainControlauto(TUNER_MODULE *pTuner);
int E4000_sensitivity(TUNER_MODULE *pTuner, int Freq, int bandwidth);
int E4000_linearity(TUNER_MODULE *pTuner, int Freq, int bandwidth);
int E4000_high_linearity(TUNER_MODULE *pTuner);
int E4000_nominal(TUNER_MODULE *pTuner, int Freq, int bandwidth);
// The following context is E4000 tuner API source code
// Definitions
// Bandwidth in Hz
enum E4000_BANDWIDTH_HZ
{
E4000_BANDWIDTH_6000000HZ = 6000000,
E4000_BANDWIDTH_7000000HZ = 7000000,
E4000_BANDWIDTH_8000000HZ = 8000000,
};
// Builder
void
BuildE4000Module(
TUNER_MODULE **ppTuner,
TUNER_MODULE *pTunerModuleMemory,
BASE_INTERFACE_MODULE *pBaseInterfaceModuleMemory,
I2C_BRIDGE_MODULE *pI2cBridgeModuleMemory,
unsigned char DeviceAddr,
unsigned long CrystalFreqHz
);
// Manipulaing functions
void
e4000_GetTunerType(
TUNER_MODULE *pTuner,
int *pTunerType
);
void
e4000_GetDeviceAddr(
TUNER_MODULE *pTuner,
unsigned char *pDeviceAddr
);
int
e4000_Initialize(
TUNER_MODULE *pTuner
);
int
e4000_SetRfFreqHz(
TUNER_MODULE *pTuner,
unsigned long RfFreqHz
);
int
e4000_GetRfFreqHz(
TUNER_MODULE *pTuner,
unsigned long *pRfFreqHz
);
// Extra manipulaing functions
int
e4000_GetRegByte(
TUNER_MODULE *pTuner,
unsigned char RegAddr,
unsigned char *pReadingByte
);
int
e4000_SetBandwidthHz(
TUNER_MODULE *pTuner,
unsigned long BandwidthHz
);
int
e4000_GetBandwidthHz(
TUNER_MODULE *pTuner,
unsigned long *pBandwidthHz
);
#endif
|
#ifndef __DRV_PQ_H__
#define __DRV_PQ_H__
#include "hi_type.h"
#include "drv_pq_ext.h"
#include "drv_pq_define.h"
#ifdef __cplusplus
extern "C" {
#endif
HI_VOID PQ_DRV_GetOption(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetOption(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetDeiParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetDeiParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetFmdParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetFmdParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetDnrParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetDnrParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetSharpParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetVpssSharpParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetGfxSharpParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetCscParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetVoCscParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetDispCscParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetGfxCscParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetAccParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetAccParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetAcmParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetAcmParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetGammaParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetGammaParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetGammaCtrlParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetGammaCtrlParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_GetDitherParam(PQ_IO_S* arg);
HI_VOID PQ_DRV_SetDitherParam(PQ_IO_S* arg);
HI_S32 PQ_DRV_FixParaToFlash(PQ_IO_S* arg);
HI_S32 PQ_DRV_UpdateVpss(HI_U32 u32UpdateType, PQ_PARAM_S* pstPqParam);
HI_S32 PQ_DRV_UpdateVo(HI_U32 u32UpdateType, PQ_PARAM_S* pstPqParam);
HI_S32 PQ_DRV_UpdateDisp(HI_U32 u32UpdateType, PQ_PARAM_S* pstPqParam);
HI_S32 PQ_DRV_UpdateGfx(HI_U32 u32UpdateType, PQ_PARAM_S* pstPqParam);
HI_S32 PQ_DRV_GetPqParam(PQ_PARAM_S** pstPqParam);
HI_S32 PQ_DRV_SetPqParam(PQ_PARAM_S* pstPqParam);
HI_S32 PQ_DRV_GetFlashPqBin(PQ_PARAM_S* pstPqParam);
HI_S32 PQ_DRV_CopyPqBinToPqApp(PQ_PARAM_S* pstPqParam);
#ifdef __cplusplus
}
#endif
#endif
|
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Definitions for the HIPPI handlers.
*
* Version: @(#)hippidevice.h 1.0.0 05/26/97
*
* Author: Jes Sorensen, <Jes.Sorensen@cern.ch>
*
* hippidevice.h is based on previous fddidevice.h work by
* Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Alan Cox, <gw4pts@gw4pts.ampr.org>
* Lawrence V. Stefani, <stefani@lkg.dec.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.
*/
#ifndef _LINUX_HIPPIDEVICE_H
#define _LINUX_HIPPIDEVICE_H
#include <linux/if_hippi.h>
#ifdef __KERNEL__
extern int hippi_header(struct sk_buff *skb,
struct device *dev,
unsigned short type,
void *daddr,
void *saddr,
unsigned len);
extern int hippi_rebuild_header(struct sk_buff *skb);
extern unsigned short hippi_type_trans(struct sk_buff *skb,
struct device *dev);
extern void hippi_header_cache_bind(struct hh_cache ** hhp,
struct device *dev,
unsigned short htype,
__u32 daddr);
extern void hippi_header_cache_update(struct hh_cache *hh,
struct device *dev,
unsigned char * haddr);
extern int hippi_header_parse(struct sk_buff *skb, unsigned char *haddr);
extern void hippi_net_init(void);
void hippi_setup(struct device *dev);
extern struct device *init_hippi_dev(struct device *, int);
#endif
#endif /* _LINUX_HIPPIDEVICE_H */
|
/***************************************************************************
NWNX FOR LINUX Vaultster plugin Class interface
Copyright (C) 2009 John Klar (plasmajohn at avlis dot org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
#ifndef NWNXVaultster_h_
#define NWNXVaultster_h_
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include "NWNXBase.h"
#include "client.h"
#include "NWNXLib.h"
using namespace::std;
using namespace boost::asio;
class CNWNXVaultster : public CNWNXBase
{
public:
CNWNXVaultster();
~CNWNXVaultster();
bool OnCreate(gline *nwnxConfig, const char *LogDir=NULL);
char *OnRequest(char* gameObject, char* Request, char* Parameters);
// bool OnRelease();
protected:
bool Configure();
private:
string key_, pass_, path_;
int numclients_;
int lastclient_;
request *clients_;
};
#endif
|
#include <linux/hardirq.h>
/*
* may_use_simd - whether it is allowable at this time to issue SIMD
* instructions or access the SIMD register file
*
* As architectures typically don't preserve the SIMD register file when
* taking an interrupt, !in_interrupt() should be a reasonable default.
*/
static __must_check inline bool may_use_simd(void)
{
return !in_interrupt();
}
|
/*
* (C) Copyright 2012
* Joe Hershberger, National Instruments, joe.hershberger@ni.com
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __ENV_CALLBACK_H__
#define __ENV_CALLBACK_H__
#include <env_flags.h>
#include <linker_lists.h>
#include <search.h>
#define ENV_CALLBACK_VAR ".callbacks"
/* Board configs can define additional static callback bindings */
#ifndef CONFIG_ENV_CALLBACK_LIST_STATIC
#define CONFIG_ENV_CALLBACK_LIST_STATIC
#endif
#ifdef CONFIG_SILENT_CONSOLE
#define SILENT_CALLBACK "silent:silent,"
#else
#define SILENT_CALLBACK
#endif
/*
* This list of callback bindings is static, but may be overridden by defining
* a new association in the ".callbacks" environment variable.
*/
#define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR ":callbacks," \
ENV_FLAGS_VAR ":flags," \
"baudrate:baudrate," \
"bootfile:bootfile," \
"loadaddr:loadaddr," \
SILENT_CALLBACK \
"stdin:console,stdout:console,stderr:console," \
CONFIG_ENV_CALLBACK_LIST_STATIC
struct env_clbk_tbl {
const char *name; /* Callback name */
int (*callback)(const char *name, const char *value, enum env_op op,
int flags);
};
void env_callback_init(ENTRY *var_entry);
/*
* Define a callback that can be associated with variables.
* when associated through the ".callbacks" environment variable, the callback
* will be executed any time the variable is inserted, overwritten, or deleted.
*/
#ifdef CONFIG_SPL_BUILD
#define U_BOOT_ENV_CALLBACK(name, callback) \
static inline void _u_boot_env_noop_##name(void) \
{ \
(void)callback; \
}
#else
#define U_BOOT_ENV_CALLBACK(name, callback) \
ll_entry_declare(struct env_clbk_tbl, name, env_clbk, env_clbk) = \
{#name, callback}
#endif
#endif /* __ENV_CALLBACK_H__ */
|
// rdadd_cart.h
//
// Add a Rivendell Cart
//
// (C) Copyright 2002-2004 Fred Gleason <fredg@paravelsystems.com>
//
// $Id: rdadd_cart.h,v 1.3 2007/02/14 21:48:41 fredg Exp $
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDADD_CART_H
#define RDADD_CART_H
#include <qdialog.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <rdcart.h>
#include <rduser.h>
class RDAddCart : public QDialog
{
Q_OBJECT
public:
RDAddCart(QString *group,RDCart::Type *type,QString *title,
const QString &username,QWidget *parent=0,const char *name=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void groupActivatedData(const QString &);
void okData();
void cancelData();
protected:
void closeEvent(QCloseEvent *e);
private:
QLineEdit *cart_number_edit;
QComboBox *cart_group_box;
QComboBox *cart_type_box;
QLineEdit *cart_title_edit;
QString *cart_group;
RDCart::Type *cart_type;
QString *cart_title;
};
#endif // RDADD_CART_H
|
/**
* @file
*
* @brief RTEMS Message Queue Name to Id
* @ingroup ClassicMessageQueue
*/
/*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/system.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/chain.h>
#include <rtems/score/isr.h>
#include <rtems/score/coremsg.h>
#include <rtems/score/object.h>
#include <rtems/score/states.h>
#include <rtems/score/thread.h>
#include <rtems/score/wkspace.h>
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/score/mpci.h>
#endif
#include <rtems/rtems/status.h>
#include <rtems/rtems/attr.h>
#include <rtems/rtems/message.h>
#include <rtems/rtems/options.h>
#include <rtems/rtems/support.h>
rtems_status_code rtems_message_queue_ident(
rtems_name name,
uint32_t node,
rtems_id *id
)
{
Objects_Name_or_id_lookup_errors status;
status = _Objects_Name_to_id_u32(
&_Message_queue_Information,
name,
node,
id
);
return _Status_Object_name_errors_to_status[ status ];
}
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2017 Intel Corporation
*/
#include "gso_common.h"
#include "gso_tunnel_tcp4.h"
static void
update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta,
struct rte_mbuf **segs, uint16_t nb_segs)
{
struct rte_ipv4_hdr *ipv4_hdr;
struct rte_tcp_hdr *tcp_hdr;
uint32_t sent_seq;
uint16_t outer_id, inner_id, tail_idx, i;
uint16_t outer_ipv4_offset, inner_ipv4_offset;
uint16_t udp_gre_offset, tcp_offset;
uint8_t update_udp_hdr;
outer_ipv4_offset = pkt->outer_l2_len;
udp_gre_offset = outer_ipv4_offset + pkt->outer_l3_len;
inner_ipv4_offset = udp_gre_offset + pkt->l2_len;
tcp_offset = inner_ipv4_offset + pkt->l3_len;
/* Outer IPv4 header. */
ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +
outer_ipv4_offset);
outer_id = rte_be_to_cpu_16(ipv4_hdr->packet_id);
/* Inner IPv4 header. */
ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +
inner_ipv4_offset);
inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id);
tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);
sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);
tail_idx = nb_segs - 1;
/* Only update UDP header for VxLAN packets. */
update_udp_hdr = (pkt->ol_flags & PKT_TX_TUNNEL_VXLAN) ? 1 : 0;
for (i = 0; i < nb_segs; i++) {
update_ipv4_header(segs[i], outer_ipv4_offset, outer_id);
if (update_udp_hdr)
update_udp_header(segs[i], udp_gre_offset);
update_ipv4_header(segs[i], inner_ipv4_offset, inner_id);
update_tcp_header(segs[i], tcp_offset, sent_seq, i < tail_idx);
outer_id++;
inner_id += ipid_delta;
sent_seq += (segs[i]->pkt_len - segs[i]->data_len);
}
}
int
gso_tunnel_tcp4_segment(struct rte_mbuf *pkt,
uint16_t gso_size,
uint8_t ipid_delta,
struct rte_mempool *direct_pool,
struct rte_mempool *indirect_pool,
struct rte_mbuf **pkts_out,
uint16_t nb_pkts_out)
{
struct rte_ipv4_hdr *inner_ipv4_hdr;
uint16_t pyld_unit_size, hdr_offset, frag_off;
int ret = 1;
hdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len;
inner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +
hdr_offset);
/*
* Don't process the packet whose MF bit or offset in the inner
* IPv4 header are non-zero.
*/
frag_off = rte_be_to_cpu_16(inner_ipv4_hdr->fragment_offset);
if (unlikely(IS_FRAGMENTED(frag_off))) {
pkts_out[0] = pkt;
return 1;
}
hdr_offset += pkt->l3_len + pkt->l4_len;
/* Don't process the packet without data */
if (hdr_offset >= pkt->pkt_len) {
pkts_out[0] = pkt;
return 1;
}
pyld_unit_size = gso_size - hdr_offset;
/* Segment the payload */
ret = gso_do_segment(pkt, hdr_offset, pyld_unit_size, direct_pool,
indirect_pool, pkts_out, nb_pkts_out);
if (ret <= 1)
return ret;
update_tunnel_ipv4_tcp_headers(pkt, ipid_delta, pkts_out, ret);
return ret;
}
|
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __TLB_H__
#define __TLB_H__
#include "um_mmu.h"
struct host_vm_op {
enum { MMAP, MUNMAP, MPROTECT } type;
union {
struct {
unsigned long addr;
unsigned long len;
unsigned int r:1;
unsigned int w:1;
unsigned int x:1;
int fd;
__u64 offset;
} mmap;
struct {
unsigned long addr;
unsigned long len;
} munmap;
struct {
unsigned long addr;
unsigned long len;
unsigned int r:1;
unsigned int w:1;
unsigned int x:1;
} mprotect;
} u;
};
extern void mprotect_kernel_vm(int w);
extern void force_flush_all(void);
extern void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
unsigned long end_addr, int force,
void (*do_ops)(union mm_context *,
struct host_vm_op *, int));
extern int flush_tlb_kernel_range_common(unsigned long start,
unsigned long end);
extern int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
int r, int w, int x, struct host_vm_op *ops, int index,
int last_filled, union mm_context *mmu,
void (*do_ops)(union mm_context *, struct host_vm_op *,
int));
extern int add_munmap(unsigned long addr, unsigned long len,
struct host_vm_op *ops, int index, int last_filled,
union mm_context *mmu,
void (*do_ops)(union mm_context *, struct host_vm_op *,
int));
extern int add_mprotect(unsigned long addr, unsigned long len, int r, int w,
int x, struct host_vm_op *ops, int index,
int last_filled, union mm_context *mmu,
void (*do_ops)(union mm_context *, struct host_vm_op *,
int));
#endif
|
#ifndef MODINITTOOLS_TABLES_H
#define MODINITTOOLS_TABLES_H
#include <stddef.h>
/* Taken from the 2.5.49 kernel, with the kernel specific fields removed */
struct pci_device_id {
unsigned int vendor, device; /* Vendor and device ID or PCI_ANY_ID */
unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
unsigned int class, class_mask; /* (class,subclass,prog-if) triplet */
};
#define PCI_DEVICE_SIZE32 (6 * 4 + 4)
#define PCI_DEVICE_SIZE64 (6 * 4 + 8)
struct usb_device_id {
/* which fields to match against? */
unsigned short match_flags;
/* Used for product specific matches; range is inclusive */
unsigned short idVendor;
unsigned short idProduct;
unsigned short bcdDevice_lo;
unsigned short bcdDevice_hi;
/* Used for device class matches */
unsigned char bDeviceClass;
unsigned char bDeviceSubClass;
unsigned char bDeviceProtocol;
/* Used for interface class matches */
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
};
#define USB_DEVICE_SIZE32 (5 * 2 + 6 * 1 + 4)
#define USB_DEVICE_SIZE64 (5 * 2 + 6 * 1 + 8)
struct ieee1394_device_id {
unsigned int match_flags;
unsigned int vendor_id;
unsigned int model_id;
unsigned int specifier_id;
unsigned int version;
};
#define IEEE1394_DEVICE_SIZE32 (5 * 4 + 4)
#define IEEE1394_DEVICE_SIZE64 (5 * 4 + 4 /*padding*/ + 8)
struct ccw_device_id {
unsigned short match_flags; /* which fields to match against */
unsigned short cu_type; /* control unit type */
unsigned short dev_type; /* device type */
unsigned char cu_model; /* control unit model */
unsigned char dev_model; /* device model */
};
#define CCW_DEVICE_SIZE32 (3 * 2 + 2 * 1 + 4)
#define CCW_DEVICE_SIZE64 (3 * 2 + 2 * 1 + 8)
struct pnp_device_id {
char id[8];
};
#define PNP_DEVICE_SIZE32 (8 + 4)
#define PNP_DEVICE_SIZE64 (8 + 8)
struct pnp_card_devid
{
char devid[8][8];
};
struct pnp_card_device_id_32 {
char id[8];
char driver_data[4];
char devid[8][8];
};
struct pnp_card_device_id_64 {
char id[8];
char driver_data[8];
char devid[8][8];
};
#define PNP_CARD_DEVICE_SIZE32 (sizeof(struct pnp_card_device_id_32))
#define PNP_CARD_DEVICE_SIZE64 (sizeof(struct pnp_card_device_id_64))
#define PNP_CARD_DEVICE_OFFSET32 (offsetof(struct pnp_card_device_id_32, devid))
#define PNP_CARD_DEVICE_OFFSET64 (offsetof(struct pnp_card_device_id_64, devid))
struct input_device_id_64 {
unsigned long long match_flags;
unsigned short bustype;
unsigned short vendor;
unsigned short product;
unsigned short version;
unsigned long long evbit[1];
unsigned long long keybit[8]; /* 512 bits */
unsigned long long relbit[1];
unsigned long long absbit[1]; /* 64 bits */
unsigned long long mscbit[1];
unsigned long long ledbit[1];
unsigned long long sndbit[1];
unsigned long long ffbit[2]; /* 128 bits */
unsigned long long driver_info;
};
struct input_device_id_32 {
unsigned int match_flags;
unsigned short bustype;
unsigned short vendor;
unsigned short product;
unsigned short version;
unsigned int evbit[1];
unsigned int keybit[16]; /* 512 bits */
unsigned int relbit[1];
unsigned int absbit[2]; /* 64 bits */
unsigned int mscbit[1];
unsigned int ledbit[1];
unsigned int sndbit[1];
unsigned int ffbit[4]; /* 128 bits */
unsigned int driver_info;
};
#define INPUT_DEVICE_SIZE32 (4 + 4 * 2 + 4 + 16 * 4 + 4 + 2 * 4 + 4 + 4 + 4 + 4 * 4 + 4)
#define INPUT_DEVICE_SIZE64 (8 + 4 * 2 + 8 + 8 * 8 + 8 + 8 + 8 + 8 + 8 + 2 * 8 + 8)
/* Functions provided by tables.c */
struct module;
void output_usb_table(struct module *modules, FILE *out);
void output_ieee1394_table(struct module *modules, FILE *out);
void output_pci_table(struct module *modules, FILE *out);
void output_ccw_table(struct module *modules, FILE *out);
void output_isapnp_table(struct module *modules, FILE *out);
void output_input_table(struct module *modules, FILE *out);
#endif /* MODINITTOOLS_TABLES_H */
|
#ifndef _ASM_X8664_PROTO_H
#define _ASM_X8664_PROTO_H 1
#include <asm/ldt.h>
/* misc architecture specific prototypes */
struct cpuinfo_x86;
struct pt_regs;
extern void get_cpu_vendor(struct cpuinfo_x86*);
extern void start_kernel(void);
extern void pda_init(int);
extern void early_idt_handler(void);
extern void mcheck_init(struct cpuinfo_x86 *c);
#ifdef CONFIG_MTRR
extern void mtrr_ap_init(void);
extern void mtrr_bp_init(void);
#else
#define mtrr_ap_init() do {} while (0)
#define mtrr_bp_init() do {} while (0)
#endif
extern void init_memory_mapping(unsigned long start, unsigned long end);
extern void system_call(void);
extern int kernel_syscall(void);
extern void syscall_init(void);
extern void ia32_syscall(void);
extern void ia32_cstar_target(void);
extern void ia32_sysenter_target(void);
extern void config_acpi_tables(void);
extern void ia32_syscall(void);
extern void iommu_hole_init(void);
extern void time_init_gtod(void);
extern int pmtimer_mark_offset(void);
extern unsigned int do_gettimeoffset_pm(void);
extern u32 pmtmr_ioport;
extern unsigned long long monotonic_base;
extern int sysctl_vsyscall;
extern void do_softirq_thunk(void);
extern int numa_setup(char *opt);
extern int setup_early_printk(char *);
extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
extern void early_identify_cpu(struct cpuinfo_x86 *c);
extern int k8_scan_nodes(unsigned long start, unsigned long end);
extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
extern unsigned long numa_free_all_bootmem(void);
extern void reserve_bootmem_generic(unsigned long phys, unsigned len);
extern void free_bootmem_generic(unsigned long phys, unsigned len);
extern void load_gs_index(unsigned gs);
extern unsigned long end_pfn_map;
extern cpumask_t cpu_initialized;
extern void show_trace(unsigned long * rsp);
extern void show_registers(struct pt_regs *regs);
extern void exception_table_check(void);
extern void acpi_reserve_bootmem(void);
extern void swap_low_mappings(void);
extern void oops_begin(void);
extern void die(const char *,struct pt_regs *,long);
extern void __die(const char * str, struct pt_regs * regs, long err);
extern void __show_regs(struct pt_regs * regs);
extern void show_regs(struct pt_regs * regs);
extern char *syscall32_page;
extern void syscall32_cpu_init(void);
extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end);
extern void check_ioapic(void);
extern void check_efer(void);
extern int unhandled_signal(struct task_struct *tsk, int sig);
extern void select_idle_routine(const struct cpuinfo_x86 *c);
extern void swiotlb_init(void);
extern unsigned long max_mapnr;
extern unsigned long end_pfn;
extern unsigned long table_start, table_end;
extern int exception_trace;
extern int force_iommu, no_iommu;
extern int using_apic_timer;
extern int disable_apic;
extern unsigned cpu_khz;
extern int ioapic_force;
extern int skip_ioapic_setup;
extern int acpi_ht;
extern int acpi_disabled;
extern int fallback_aper_order;
extern int fallback_aper_force;
extern int iommu_aperture;
extern int iommu_aperture_disabled;
extern int iommu_aperture_allowed;
extern int fix_aperture;
extern int force_iommu;
extern int reboot_force;
extern void smp_local_timer_interrupt(struct pt_regs * regs);
long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
#define round_up(x,y) (((x) + (y) - 1) & ~((y)-1))
#define round_down(x,y) ((x) & ~((y)-1))
#endif
|
//
// VEXT2 Linux SDK Header File
//
// 2013.09.05 ikki Create
#include "SMIMS_define.h"
typedef BOOL (*DEF_SMIMS_VEXT2_ProgramFPGA)(int iBoard, char * BitFile);
typedef BOOL (*DEF_SMIMS_VEXT2_ProgramFPGAFromSD)(int iBoard, int iBitFileIndex);
typedef BOOL (*DEF_SMIMS_VEXT2_AppOpen)(int iBoard, char * SerialNO, int ClkMode);
typedef BOOL (*DEF_SMIMS_VEXT2_AppFIFOReadData)(int iBoard, WORD *Buffer, unsigned size);
typedef BOOL (*DEF_SMIMS_VEXT2_AppFIFOWriteData)(int iBoard, WORD *Buffer, unsigned size);
typedef BOOL (*DEF_SMIMS_VEXT2_AppChannelSelector)(int iBoard, BYTE channel);
typedef BOOL (*DEF_SMIMS_VEXT2_AppClose)(int iBoard);
typedef char *(*DEF_SMIMS_VEXT2_GetLastErrorMsg)(int iBoard);
typedef BOOL (*DEF_SMIMS_VEXT2_Reset)(int iBoard);
typedef BOOL (*DEF_SMIMS_VEXT2_WaitInterrupt)(int iBoard, unsigned TimeOut);
typedef BOOL (*DEF_SMIMS_VEXT2_NBReadData)(int iBoard, WORD *Buffer, unsigned size);
typedef BOOL (*DEF_SMIMS_VEXT2_NBWriteData)(int iBoard, WORD *Buffer, unsigned size);
typedef BOOL (*DEF_SMIMS_VEXT2_WaitReadComplete)(int iBoard, unsigned TimeOut);
typedef BOOL (*DEF_SMIMS_VEXT2_WaitWriteComplete)(int iBoard, unsigned TimeOut);
extern DEF_SMIMS_VEXT2_ProgramFPGA SMIMS_VEXT2_ProgramFPGA;
extern DEF_SMIMS_VEXT2_ProgramFPGAFromSD SMIMS_VEXT2_ProgramFPGAFromSD;
extern DEF_SMIMS_VEXT2_AppOpen SMIMS_VEXT2_AppOpen;
extern DEF_SMIMS_VEXT2_AppFIFOReadData SMIMS_VEXT2_AppFIFOReadData;
extern DEF_SMIMS_VEXT2_AppFIFOWriteData SMIMS_VEXT2_AppFIFOWriteData;
extern DEF_SMIMS_VEXT2_AppChannelSelector SMIMS_VEXT2_AppChannelSelector;
extern DEF_SMIMS_VEXT2_AppClose SMIMS_VEXT2_AppClose;
extern DEF_SMIMS_VEXT2_GetLastErrorMsg SMIMS_VEXT2_GetLastErrorMsg;
extern DEF_SMIMS_VEXT2_Reset SMIMS_VEXT2_Reset;
extern DEF_SMIMS_VEXT2_WaitInterrupt SMIMS_VEXT2_WaitInterrupt;
extern DEF_SMIMS_VEXT2_NBReadData SMIMS_VEXT2_NBReadData;
extern DEF_SMIMS_VEXT2_NBWriteData SMIMS_VEXT2_NBWriteData;
extern DEF_SMIMS_VEXT2_WaitReadComplete SMIMS_VEXT2_WaitReadComplete;
extern DEF_SMIMS_VEXT2_WaitWriteComplete SMIMS_VEXT2_WaitWriteComplete;
bool LoadShareObject();
|
/*
* This file is part of the coreboot project.
*
* Copyright 2015 MediaTek Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <boardid.h>
#include <gpio.h>
#include <console/console.h>
#include <stdlib.h>
#include "gpio.h"
static int board_id_value = -1;
static uint8_t get_board_id(void)
{
uint8_t bid = 0;
static gpio_t pins[] = {[2] = BOARD_ID_2, [1] = BOARD_ID_1,
[0] = BOARD_ID_0};
bid = gpio_base2_value(pins, ARRAY_SIZE(pins));
printk(BIOS_INFO, "Board ID %d\n", bid);
return bid;
}
uint32_t board_id(void)
{
if (board_id_value < 0)
board_id_value = get_board_id();
return board_id_value;
}
uint32_t ram_code(void)
{
uint32_t code;
static gpio_t pins[] = {[3] = RAM_ID_3, [2] = RAM_ID_2, [1] = RAM_ID_1,
[0] = RAM_ID_0};
code = gpio_base2_value(pins, ARRAY_SIZE(pins));
printk(BIOS_INFO, "RAM Config: %u\n", code);
return code;
}
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WORLDMODEL_H
#define _WORLDMODEL_H
#include <G3D/Vector3.h>
#include <G3D/AABox.h>
#include <G3D/Ray.h>
#include "BoundingIntervalHierarchy.h"
#include "Define.h"
namespace VMAP
{
class TreeNode;
struct AreaInfo;
struct LocationInfo;
enum class ModelIgnoreFlags : uint32;
class TC_COMMON_API MeshTriangle
{
public:
MeshTriangle() : idx0(0), idx1(0), idx2(0) { }
MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) { }
uint32 idx0;
uint32 idx1;
uint32 idx2;
};
class TC_COMMON_API WmoLiquid
{
public:
WmoLiquid(uint32 width, uint32 height, G3D::Vector3 const& corner, uint32 type);
WmoLiquid(WmoLiquid const& other);
~WmoLiquid();
WmoLiquid& operator=(WmoLiquid const& other);
bool GetLiquidHeight(G3D::Vector3 const& pos, float& liqHeight) const;
uint32 GetType() const { return iType; }
float *GetHeightStorage() { return iHeight; }
uint8 *GetFlagsStorage() { return iFlags; }
uint32 GetFileSize();
bool writeToFile(FILE* wf);
static bool readFromFile(FILE* rf, WmoLiquid* &liquid);
void getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const;
private:
WmoLiquid() : iTilesX(0), iTilesY(0), iCorner(), iType(0), iHeight(nullptr), iFlags(nullptr) { }
uint32 iTilesX; //!< number of tiles in x direction, each
uint32 iTilesY;
G3D::Vector3 iCorner; //!< the lower corner
uint32 iType; //!< liquid type
float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values
uint8 *iFlags; //!< info if liquid tile is used
};
/*! holding additional info for WMO group files */
class TC_COMMON_API GroupModel
{
public:
GroupModel() : iBound(), iMogpFlags(0), iGroupWMOID(0), iLiquid(nullptr) { }
GroupModel(GroupModel const& other);
GroupModel(uint32 mogpFlags, uint32 groupWMOID, G3D::AABox const& bound):
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { }
~GroupModel() { delete iLiquid; }
//! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry!
void setMeshData(std::vector<G3D::Vector3> &vert, std::vector<MeshTriangle> &tri);
void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = nullptr; }
bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const;
bool IsInsideObject(const G3D::Vector3 &pos, const G3D::Vector3 &down, float &z_dist) const;
bool GetLiquidLevel(const G3D::Vector3 &pos, float &liqHeight) const;
uint32 GetLiquidType() const;
bool writeToFile(FILE* wf);
bool readFromFile(FILE* rf);
const G3D::AABox& GetBound() const { return iBound; }
uint32 GetMogpFlags() const { return iMogpFlags; }
uint32 GetWmoID() const { return iGroupWMOID; }
void getMeshData(std::vector<G3D::Vector3>& outVertices, std::vector<MeshTriangle>& outTriangles, WmoLiquid*& liquid);
protected:
G3D::AABox iBound;
uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor
uint32 iGroupWMOID;
std::vector<G3D::Vector3> vertices;
std::vector<MeshTriangle> triangles;
BIH meshTree;
WmoLiquid* iLiquid;
};
/*! Holds a model (converted M2 or WMO) in its original coordinate space */
class TC_COMMON_API WorldModel
{
public:
WorldModel(): Flags(0), RootWMOID(0) { }
//! pass group models to WorldModel and create BIH. Passed vector is swapped with old geometry!
void setGroupModels(std::vector<GroupModel> &models);
void setRootWmoID(uint32 id) { RootWMOID = id; }
bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) const;
bool IntersectPoint(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, AreaInfo &info) const;
bool GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, LocationInfo &info) const;
bool writeFile(const std::string &filename);
bool readFile(const std::string &filename);
void getGroupModels(std::vector<GroupModel>& outGroupModels);
std::string const& GetName() const { return name; }
void SetName(std::string newName) { name = std::move(newName); }
uint32 Flags;
protected:
uint32 RootWMOID;
std::vector<GroupModel> groupModels;
BIH groupTree;
std::string name;
};
} // namespace VMAP
#endif // _WORLDMODEL_H
|
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/* 11/12/2002 Port to LTP robbiew@us.ibm.com */
/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
/*
* NAME
* rename14.c - create and rename files
*
* CALLS
* create, unlink, rename
*
* ALGORITHM
* Creates two processes. One creates and unlinks a file.
* The other renames that file.
*
*/
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
/** LTP Port **/
#include "test.h"
#include "usctest.h"
#define FAILED 0
#define PASSED 1
int local_flag = PASSED;
char *TCID = "rename14";
int TST_TOTAL = 1;
/**************/
#define RUNTIME 45
int kidpid[2];
int parent_pid;
int main(int argc, char *argv[])
{
int pid;
sigset_t set;
struct sigaction act, oact;
int term();
int al();
void dochild1();
void dochild2();
#ifdef UCLINUX
const char *msg;
if ((msg = parse_opts(argc, argv, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
maybe_run_child(&dochild1, "n", 1);
maybe_run_child(&dochild2, "n", 2);
#endif
sigemptyset(&set);
act.sa_handler = (void (*)())term;
act.sa_mask = set;
act.sa_flags = 0;
if (sigaction(SIGTERM, &act, &oact)) {
tst_brkm(TBROK, NULL, "Sigaction(SIGTERM)");
}
sigemptyset(&set);
act.sa_handler = (void (*)())al;
act.sa_mask = set;
act.sa_flags = 0;
if (sigaction(SIGALRM, &act, 0)) {
tst_brkm(TBROK, NULL, "Sigaction(SIGALRM)");
}
parent_pid = getpid();
tst_tmpdir();
/*--------------------------------------------------------------*/
pid = FORK_OR_VFORK();
if (pid < 0) {
tst_brkm(TBROK, NULL, "fork() returned %d", pid);
}
if (pid == 0) {
#ifdef UCLINUX
if (self_exec(argv[0], "n", 1) < 0) {
tst_resm(TBROK, "self_exec failed");
}
#else
dochild1();
#endif
}
kidpid[0] = pid;
pid = FORK_OR_VFORK();
if (pid < 0) {
(void)kill(kidpid[0], SIGTERM);
(void)unlink("./rename14");
tst_brkm(TBROK, NULL, "fork() returned %d", pid);
}
if (pid == 0) {
#ifdef UCLINUX
if (self_exec(argv[0], "n", 1) < 0) {
tst_resm(TBROK, "self_exec failed");
}
#else
dochild2();
#endif
}
kidpid[1] = pid;
alarm(RUNTIME);
/* Collect child processes. */
/* Wait for timeout */
pause();
kill(kidpid[0], SIGTERM);
kill(kidpid[1], SIGTERM);
waitpid(kidpid[0], NULL, 0);
waitpid(kidpid[1], NULL, 0);
unlink("./rename14");
unlink("./rename14xyz");
(local_flag == PASSED) ? tst_resm(TPASS, "Test Passed")
: tst_resm(TFAIL, "Test Failed");
tst_rmdir();
tst_exit();
}
/* FUNCTIONS GO HERE */
int term(void)
{
if (parent_pid != getpid())
exit(0);
if (kidpid[0])
return (kill(kidpid[0], SIGTERM));
if (kidpid[1])
return (kill(kidpid[1], SIGTERM));
return 0;
}
int al(void)
{
if (kidpid[0])
return (kill(kidpid[0], SIGTERM));
if (kidpid[1])
return (kill(kidpid[1], SIGTERM));
return 0;
}
void dochild1(void)
{
int fd;
for (;;) {
fd = creat("./rename14", 0666);
unlink("./rename14");
close(fd);
}
}
void dochild2(void)
{
for (;;) {
rename("./rename14", "./rename14xyz");
}
}
|
/*
* Copyright (C) 2012 Red Hat, Inc.
*
* Nautilus 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.
*
* Nautilus 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 COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
*/
#ifndef NAUTILUS_SEARCH_HIT_H
#define NAUTILUS_SEARCH_HIT_H
#include <glib-object.h>
#include "nautilus-query.h"
G_BEGIN_DECLS
#define NAUTILUS_TYPE_SEARCH_HIT (nautilus_search_hit_get_type ())
G_DECLARE_FINAL_TYPE (NautilusSearchHit, nautilus_search_hit, NAUTILUS, SEARCH_HIT, GObject);
NautilusSearchHit * nautilus_search_hit_new (const char *uri);
void nautilus_search_hit_set_fts_rank (NautilusSearchHit *hit,
gdouble fts_rank);
void nautilus_search_hit_set_modification_time (NautilusSearchHit *hit,
GDateTime *date);
void nautilus_search_hit_set_access_time (NautilusSearchHit *hit,
GDateTime *date);
void nautilus_search_hit_compute_scores (NautilusSearchHit *hit,
NautilusQuery *query);
const char * nautilus_search_hit_get_uri (NautilusSearchHit *hit);
gdouble nautilus_search_hit_get_relevance (NautilusSearchHit *hit);
G_END_DECLS
#endif /* NAUTILUS_SEARCH_HIT_H */
|
#include "../qcommon/q_shared.h"
#include "cg_local.h"
#include <jsapi.h>
static JSClass vector3_class = {
"Vec3", 0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
static JSClass vector4_class = {
"Vec4", 0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
static JSBool vector3_constructor(JSContext *cx, unsigned argc, jsval *vp)
{
JSObject *returnObject;
jsval returnValue;
double x, y, z;
jsval r, g, b;
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "ddd", &x, &y, &z))
return JS_FALSE;
returnObject = JS_NewObject(cx, &vector3_class, NULL, NULL);
returnValue = OBJECT_TO_JSVAL(returnObject);
JS_NewNumberValue(cx, x, &r);
JS_NewNumberValue(cx, y, &g);
JS_NewNumberValue(cx, z, &b);
JS_SetProperty(cx, returnObject, "X", &r);
JS_SetProperty(cx, returnObject, "Y", &g);
JS_SetProperty(cx, returnObject, "Z", &b);
JS_SET_RVAL(cx, vp, returnValue);
return JS_TRUE;
}
static JSBool vector4_constructor(JSContext *cx, unsigned argc, jsval *vp)
{
JSObject *returnObject;
jsval returnValue;
double w, x, y, z;
jsval r, g, b, a;
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "dddd", &w, &x, &y, &z))
return JS_FALSE;
returnObject = JS_NewObject(cx, &vector4_class, NULL, NULL);
returnValue = OBJECT_TO_JSVAL(returnObject);
JS_NewNumberValue(cx, w, &r);
JS_NewNumberValue(cx, x, &g);
JS_NewNumberValue(cx, y, &b);
JS_NewNumberValue(cx, z, &a);
JS_SetProperty(cx, returnObject, "R", &r);
JS_SetProperty(cx, returnObject, "G", &g);
JS_SetProperty(cx, returnObject, "G", &b);
JS_SetProperty(cx, returnObject, "A", &b);
JS_SET_RVAL(cx, vp, returnValue);
return JS_TRUE;
}
void CG_JS_Vector_Init(JSContext *ctx, JSObject *global)
{
JS_InitClass(ctx, global, NULL, &vector3_class, vector3_constructor, 3, NULL, NULL, NULL, NULL);
JS_InitClass(ctx, global, NULL, &vector4_class, vector4_constructor, 4, NULL, NULL, NULL, NULL);
}
JSBool JS_NewVector3Value(JSContext *cx, vec3_t v, jsval *rval)
{
JSObject *obj;
jsval a,b,c;
if (!JS_NewNumberValue(cx,v[0],&a))
{
JS_ReportError(cx,"NewVector3_Value: Failed to get X\n");
return JS_FALSE;
}
if (!JS_NewNumberValue(cx,v[1],&b))
{
JS_ReportError(cx,"NewVector3_Value: Failed to get Y\n");
return JS_FALSE;
}
if (!JS_NewNumberValue(cx,v[2],&c))
{
JS_ReportError(cx,"NewVector3_Value: Failed to get Z\n");
return JS_FALSE;
}
obj = JS_NewObject(cx, &vector3_class, NULL, NULL);
*rval = OBJECT_TO_JSVAL(obj);
JS_SetProperty(cx, obj, "X", &a);
JS_SetProperty(cx, obj, "Y", &b);
JS_SetProperty(cx, obj, "Z", &c);
return JS_TRUE;
}
JSBool JS_NewVector4Value(JSContext *cx, vec4_t v, jsval *rval)
{
JSObject *obj;
jsval a,b,c,d;
if (!JS_NewNumberValue(cx,v[0],&a))
{
JS_ReportError(cx,"NewVector4_Value: Failed to get R\n");
return JS_FALSE;
}
if (!JS_NewNumberValue(cx,v[1],&b))
{
JS_ReportError(cx,"NewVector4_Value: Failed to get G\n");
return JS_FALSE;
}
if (!JS_NewNumberValue(cx,v[2],&c))
{
JS_ReportError(cx,"NewVector4_Value: Failed to get B\n");
return JS_FALSE;
}
if (!JS_NewNumberValue(cx,v[3],&d))
{
JS_ReportError(cx,"NewVector4_Value: Failed to get A\n");
return JS_FALSE;
}
obj = JS_NewObject(cx, &vector4_class, NULL, NULL);
*rval = OBJECT_TO_JSVAL(obj);
JS_SetProperty(cx, obj, "R", &a);
JS_SetProperty(cx, obj, "G", &b);
JS_SetProperty(cx, obj, "B", &c);
JS_SetProperty(cx, obj, "A", &d);
return JS_TRUE;
}
|
#ifndef __STMMAC_H__
#define __STMMAC_H__
#include <common.h>
#include <command.h>
#include <linux/list.h>
#include <asm/io.h>
#include <malloc.h> /* malloc, free, realloc*/
#include <net.h>
#include <miiphy.h>
#define print_mac(mac) do { int i;\
printf("MAC: ");\
for (i = 0; i < MAC_LEN; i++)\
printf("%c%02X", i ? '-' : ' ', *(((unsigned char *)mac)+i));\
printf("\n");\
} while (0)
#define MAC_LEN 6
#define MAX_PHY_NAME_LEN 6
#define MIN_PKG_LEN (42)
#define MAX_PKG_LEN (1600)
#define STMMAC_INVALID_RXPKG_LEN(len) \
(!(((len) >= MIN_PKG_LEN) && ((len) <= MAX_PKG_LEN)))
#define PORT_MOD_10M_MII 0
#define PORT_MOD_100M_MII 1
#define PORT_MOD_1000M_GMII 2
#define PORT_MOD_10M_RGMII 3
#define PORT_MOD_100M_RGMII 4
#define PORT_MOD_1000M_RGMII 5
#define DEFAULT_PHY_LINK_TIMES 20000
#define STMMAC_LINKED (1 << 0)
#define STMMAC_DUP_FULL (1 << 1)
#define STMMAC_SPD_10M (1 << 2)
#define STMMAC_SPD_100M (1 << 3)
#define STMMAC_SPD_1000M (1 << 4)
#define GMAC0_PORT 0
#ifndef STMMAC_SINGLE_MAC
#define GMAC1_PORT 1
#endif
#define STMMAC_IOBASE STMMAC_GMACADDR
#define STMMAC_IOBASE_DMA STMMAC_DMAADDR
#define STMMAC_PHYID STMMAC_PHYADDR
#define SZ_1K 1024
#define STMMAC_HW_QUEUE_DEPTH 1
#define STMMAC_MAX_FRAME_SIZE (SZ_1K*2)
#define SKB_SIZE (STMMAC_MAX_FRAME_SIZE)
struct dma_desc_tx {
unsigned int volatile status;
unsigned int volatile length;
unsigned int volatile buffer1;
unsigned int volatile buffer2;
};
struct dma_desc_rx {
unsigned int volatile status_0;
unsigned int volatile length_0;
unsigned int volatile buffer1_0;
unsigned int volatile buffer2_0;
unsigned int volatile status_1;
unsigned int volatile length_1;
unsigned int volatile buffer1_1;
unsigned int volatile buffer2_1;
};
struct stmmac_netdev_local {
/* gmac addr */
unsigned long iobase_gmac;
/* dma addr */
unsigned long iobase_dma;
/* 0 => GMAC0, 1 => GMAC1 */
int port;
struct dma_desc_rx *rx_addr;
struct dma_desc_tx *tx_addr;
char *phy_name;
int link_stat;
};
#endif
|
/* file generated by oo2c -- do not edit */
#include "__oo2c.h"
#include "__libc.h"
#include "CharClass.d"
static _ModId _mid;
unsigned char CharClass__IsNumeric(unsigned char ch) {
register int i0;
i0 = (int)ch < 48;
if (i0) goto l0;
i0 = (int)ch <= 57;
if (i0) goto l1;
l0:
i0 = 0;
goto l2;
l1:
i0 = 1;
l2:
return (unsigned char)i0;
}
unsigned char CharClass__IsLetter(unsigned char ch) {
register int i0;
i0 = (int)ch < 97;
if (i0) goto l0;
i0 = (int)ch <= 122;
if (i0) goto l2;
l0:
i0 = (int)ch >= 65;
if (!(i0)) goto l1;
i0 = (int)ch <= 90;
if (i0) goto l2;
l1:
i0 = 0;
goto l3;
l2:
i0 = 1;
l3:
return (unsigned char)i0;
}
unsigned char CharClass__IsUpper(unsigned char ch) {
register int i0;
i0 = (int)ch < 65;
if (i0) goto l0;
i0 = (int)ch <= 90;
if (i0) goto l1;
l0:
i0 = 0;
goto l2;
l1:
i0 = 1;
l2:
return (unsigned char)i0;
}
unsigned char CharClass__IsLower(unsigned char ch) {
register int i0;
i0 = (int)ch < 97;
if (i0) goto l0;
i0 = (int)ch <= 122;
if (i0) goto l1;
l0:
i0 = 0;
goto l2;
l1:
i0 = 1;
l2:
return (unsigned char)i0;
}
unsigned char CharClass__IsControl(unsigned char ch) {
register int i0;
i0 = (int)ch < 32;
return (unsigned char)i0;
}
unsigned char CharClass__IsWhiteSpace(unsigned char ch) {
register int i0;
i0 = (int)ch == 32;
if (i0) goto l0;
i0 = (int)ch == 12;
if (i0) goto l0;
i0 = (int)ch == 10;
if (i0) goto l0;
i0 = (int)ch == 13;
if (i0) goto l0;
i0 = (int)ch == 9;
if (i0) goto l0;
i0 = (int)ch == 11;
if (i0) goto l0;
i0 = 0;
goto l1;
l0:
i0 = 1;
l1:
return (unsigned char)i0;
}
unsigned char CharClass__IsEol(unsigned char ch) {
register int i0;
i0 = (int)ch == 10;
return (unsigned char)i0;
}
void CharClass_init(void) {
register int i0;
_mid = _register_module(&CharClass_md.md, NULL);
i0 = (int)CharClass__systemEol + 1;
*(unsigned char*)(int)CharClass__systemEol = 10;
*(unsigned char*)i0 = 0;
}
|
/*
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef WLAN_QCT_MSG_MAP_H
#define WLAN_QCT_MSG_MAP_H
/*===========================================================================
W L A N DEVICE ADAPTATION L A Y E R
MSG MAPPING
DESCRIPTION
This file contains the external API exposed by the wlan adaptation layer
Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
Qualcomm Confidential and Proprietary
===========================================================================*/
/*
*/
/* */
#include "wlan_qct_pack_align.h"
#define WDA_CONFIG_PARAM_UPDATE_REQ SIR_CFG_PARAM_UPDATE_IND
#define ALIGNED_WORD_SIZE 4
/* */
WPT_PACK_START
typedef WPT_PACK_PRE struct
{
/*
*/
tANI_U16 type;
/*
*/
tANI_U16 length;
/* */
tANI_U16 padBytes;
/* */
tANI_U16 reserved;
/*
*/
}WPT_PACK_POST tHalCfg, *tpHalCfg;
WPT_PACK_END
//
#ifdef WDA_UT
#define WDA_WDI_EVENT_MSG 0x00FF
void WDI_processEvent(void *wdiEventData, void *pUserData);
#endif
#endif
|
/*
* Copyright (c) 2014 Qualcomm Atheros, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* This file contains the configuration parameters for the dbau1x00 board.
*/
#ifndef __AR7240_H
#define __AR7240_H
#define CONFIG_MIPS32 1 /* MIPS32 CPU core */
#define CONFIG_BOOTDELAY 4 /* autoboot after 4 seconds */
#define CONFIG_BAUDRATE 115200
#define CFG_BAUDRATE_TABLE { 115200}
#define CONFIG_TIMESTAMP /* Print image info with timestamp */
#define CONFIG_ROOTFS_RD
#define CONFIG_BOOTARGS_RD "console=ttyS0,115200 root=01:00 rd_start=0x80600000 rd_size=5242880 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),4096k(rootfs),2048k(uImage)"
/* XXX - putting rootfs in last partition results in jffs errors */
#define CONFIG_BOOTARGS_FL "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),5120k(rootfs),2048k(uImage)"
#ifdef CONFIG_ROOTFS_FLASH
#define CONFIG_BOOTARGS CONFIG_BOOTARGS_FL
#else
#define CONFIG_BOOTARGS ""
#endif
/*
* Miscellaneous configurable options
*/
#define CFG_LONGHELP /* undef to save memory */
#define CFG_PROMPT "ar7240> " /* Monitor Command Prompt */
#define CFG_CBSIZE 512 /* Console I/O Buffer Size */
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
#define CFG_MAXARGS 16 /* max number of command args*/
#define CFG_MALLOC_LEN 128*1024
#define CFG_BOOTPARAMS_LEN 128*1024
#define CFG_SDRAM_BASE 0x80000000 /* Cached addr */
//#define CFG_SDRAM_BASE 0xa0000000 /* Cached addr */
#define CFG_LOAD_ADDR 0x81000000 /* default load address */
//#define CFG_LOAD_ADDR 0xa1000000 /* default load address */
#define CFG_MEMTEST_START 0x80100000
#undef CFG_MEMTEST_START
#define CFG_MEMTEST_START 0x80200000
#define CFG_MEMTEST_END 0x83800000
/*------------------------------------------------------------------------
* * * JFFS2
*/
#define CFG_JFFS_CUSTOM_PART /* board defined part */
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=ar7240-nor0"
#define CONFIG_MEMSIZE_IN_BYTES
#ifdef CONFIG_HORNET_EMU_HARDI_WLAN
#define CFG_HZ 24000000
#else
#define CFG_HZ 40000000
#endif
#define CFG_RX_ETH_BUFFER 16
/*
** PLL Config for different CPU/DDR/AHB frequencies
*/
#define CFG_PLL_200_200_100 0x00
#define CFG_PLL_300_300_150 0x01
#define CFG_PLL_320_320_160 0x02
#define CFG_PLL_340_340_170 0x03
#define CFG_PLL_350_350_175 0x04
#define CFG_PLL_360_360_180 0x05
#define CFG_PLL_400_400_200 0x06
#define CFG_PLL_300_300_75 0x07
#define CFG_PLL_400_400_100 0x08
#define CFG_PLL_320_320_80 0x09
#define CFG_PLL_410_400_200 0x0a
#define CFG_PLL_420_400_200 0x0b
#define CFG_PLL_80_80_40 0x0c
#define CFG_PLL_64_64_32 0x0d
#define CFG_PLL_48_48_24 0x0e
#define CFG_PLL_32_32_16 0x0f
#define CFG_PLL_333_333_166 0x10
#define CFG_PLL_266_266_133 0x11
#define CFG_PLL_266_266_66 0x12
#define CFG_PLL_240_240_120 0x13
#define CFG_PLL_160_160_80 0x14
#define CFG_PLL_400_200_200 0x15
#define CFG_PLL_500_400_200 0x16
#define CFG_PLL_600_400_200 0x17
#define CFG_PLL_600_500_250 0x18
#define CFG_PLL_600_400_300 0x19
#define CFG_PLL_500_500_250 0x1a
#define CFG_PLL_600_350_175 0x1b
#define CFG_PLL_600_300_150 0x1c
#define CFG_PLL_600_550_1_1G_275 0x1d
#define CFG_PLL_600_500_1G_250 0x1e
#define CFG_PLL_533_400_200 0x1f
#define CFG_PLL_600_450_200 0x20
#define CFG_PLL_533_500_250 0x21
#define CFG_PLL_700_400_200 0x22
#define CFG_PLL_650_600_300 0x23
#define CFG_PLL_600_600_300 0x24
#define CFG_PLL_600_550_275 0x25
#define CFG_PLL_566_475_237 0x26
#define CFG_PLL_566_450_225 0x27
#define CFG_PLL_600_332_166 0x28
#define CFG_PLL_600_575_287 0x29
#define CFG_PLL_600_525_262 0x2a
#define CFG_PLL_566_550_275 0x2b
#define CFG_PLL_566_525_262 0x2c
#define CFG_PLL_600_332_200 0x2d
#define CFG_PLL_600_266_133 0x2e
#define CFG_PLL_600_266_200 0x2f
#define CFG_PLL_600_650_325 0x30
#define CFG_PLL_566_400_200 0x31
#define CFG_PLL_566_500_250 0x32
#define CFG_PLL_600_1_2G_400_200 0x33
#define CFG_PLL_560_480_240 0x34
#define CFG_PLL_333_166_166 0x35
#define CFG_PLL_350_175_175 0x36
#define CFG_PLL_360_180_180 0x37
#define CFG_PLL_380_190_190 0x38
#define CFG_PLL_262_262_131 0x39
#define CFG_PLL_275_275_137 0x3a
#define CFG_PLL_200_200_200 0x3b
#define CFG_PLL_250_250_125 0x3c
#define CFG_PLL_225_225_112 0x3d
#define CFG_PLL_212_212_106 0x3e
#define CFG_PLL_187_187_93 0x3f
#define CFG_PLL_535_400_200 0x40
#define CFG_PLL_560_400_200 0x41
#define CFG_PLL_560_450_225 0x42
#define CFG_PLL_400_480_240 0x43
/*-----------------------------------------------------------------------
* Cache Configuration
*/
#define CFG_DCACHE_SIZE 32768
#define CFG_ICACHE_SIZE 65536
#define CFG_CACHELINE_SIZE 32
#endif /* __CONFIG_H */
|
/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program 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
* version 2 along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
/**
* \file
*
* \author Victor Julien <victor@inliniac.net>
* \author Anoop Saldanha <anoopsaldanha@gmail.com>
*/
#ifndef __TM_THREADS_COMMON_H__
#define __TM_THREADS_COMMON_H__
/** \brief Thread Model Module id's.
*
* \note anything added here should also be added to TmModuleTmmIdToString
* in tm-modules.c
*/
typedef enum {
TMM_DECODENFQ,
TMM_VERDICTNFQ,
TMM_RECEIVENFQ,
TMM_RECEIVEPCAP,
TMM_RECEIVEPCAPFILE,
TMM_DECODEPCAP,
TMM_DECODEPCAPFILE,
TMM_RECEIVEPFRING,
TMM_DECODEPFRING,
TMM_DETECT,
TMM_ALERTFASTLOG,
TMM_ALERTFASTLOG4,
TMM_ALERTFASTLOG6,
TMM_ALERTUNIFIED2ALERT,
TMM_ALERTPRELUDE,
TMM_ALERTDEBUGLOG,
TMM_ALERTSYSLOG,
TMM_LOGDROPLOG,
TMM_ALERTSYSLOG4,
TMM_ALERTSYSLOG6,
TMM_RESPONDREJECT,
TMM_LOGDNSLOG,
TMM_LOGHTTPLOG,
TMM_LOGHTTPLOG4,
TMM_LOGHTTPLOG6,
TMM_LOGTLSLOG,
TMM_LOGTLSLOG4,
TMM_LOGTLSLOG6,
TMM_LOGTCPDATALOG,
TMM_OUTPUTJSON,
TMM_PCAPLOG,
TMM_FILELOG,
TMM_FILESTORE,
TMM_STREAMTCP,
TMM_DECODEIPFW,
TMM_VERDICTIPFW,
TMM_RECEIVEIPFW,
TMM_RECEIVEERFFILE,
TMM_DECODEERFFILE,
TMM_RECEIVEERFDAG,
TMM_DECODEERFDAG,
TMM_RECEIVEAFP,
TMM_DECODEAFP,
TMM_RECEIVENETMAP,
TMM_DECODENETMAP,
TMM_ALERTPCAPINFO,
TMM_RECEIVEMPIPE,
TMM_DECODEMPIPE,
TMM_RECEIVENAPATECH,
TMM_DECODENAPATECH,
TMM_PACKETLOGGER,
TMM_TXLOGGER,
TMM_STATSLOGGER,
TMM_FILELOGGER,
TMM_FILEDATALOGGER,
TMM_STREAMINGLOGGER,
TMM_JSONALERTLOG,
TMM_JSONDROPLOG,
TMM_JSONHTTPLOG,
TMM_JSONDNSLOG,
TMM_JSONSMTPLOG,
TMM_JSONSSHLOG,
TMM_JSONSTATSLOG,
TMM_JSONTLSLOG,
TMM_JSONFILELOG,
TMM_RECEIVENFLOG,
TMM_DECODENFLOG,
TMM_JSONFLOWLOG,
TMM_JSONNETFLOWLOG,
TMM_LOGSTATSLOG,
TMM_FLOWMANAGER,
TMM_FLOWRECYCLER,
TMM_DETECTLOADER,
TMM_UNIXMANAGER,
TMM_LUALOG,
TMM_TLSSTORE,
TMM_SIZE,
} TmmId;
/*Error codes for the thread modules*/
typedef enum {
TM_ECODE_OK = 0, /**< Thread module exits OK*/
TM_ECODE_FAILED, /**< Thread module exits due to failure*/
TM_ECODE_DONE, /**< Thread module task is finished*/
} TmEcode;
/* ThreadVars type */
enum {
TVT_PPT,
TVT_MGMT,
TVT_CMD,
TVT_MAX,
};
#endif /* __TM_THREADS_COMMON_H__ */
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
*/
#include "mycrypt.h"
int find_cipher(const char *name)
{
int x;
_ARGCHK(name != NULL);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name != NULL && !strcmp(cipher_descriptor[x].name, name)) {
return x;
}
}
return -1;
}
|
/***************************************************************************
collectionscannerdcopiface.h - DCOP Interface
-------------------
begin : 16/08/05
copyright : (C) 2006 by Jeff Mitchell
email : kde-dev@emailgoeshere.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. *
* *
***************************************************************************/
#ifndef COLLECTIONSCANNER_DCOPIFACE_H
#define COLLECTIONSCANNER_DCOPIFACE_H
#include <dcopobject.h>
///////////////////////////////////////////////////////////////////////
// WARNING! Please ask before modifying the DCOP interface!
///////////////////////////////////////////////////////////////////////
class CollectionScannerInterface : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual void pause() = 0; ///< Pause the scanner
virtual void unpause() = 0; ///< Unpause the scanner
};
#endif
|
//# -*- mode: c++ -*-
//#
//# StopCmd.h: III
//#
//# Copyright (C) 2002-2004
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@astron.nl
//#
//# This program is free software; you can redistribute it and/or modify
//# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#ifndef STOPCMD_H_
#define STOPCMD_H_
#include <Common/LofarTypes.h>
#include <GCF/TM/GCF_Control.h>
#include <APL/TBB_Protocol/TBB_Protocol.ph>
#include "TP_Protocol.ph"
#include "Command.h"
#include "DriverSettings.h"
namespace LOFAR {
using namespace TBB_Protocol;
namespace TBB {
class StopCmd : public Command
{
public:
// Constructors for a StopCmd object.
StopCmd();
// Destructor for StopCmd.
virtual ~StopCmd();
virtual bool isValid(GCFEvent& event);
virtual void saveTbbEvent(GCFEvent& event);
virtual void sendTpEvent();
virtual void saveTpAckEvent(GCFEvent& event);
virtual void sendTbbAckEvent(GCFPortInterface* clientport);
private:
TbbSettings *TS;
int32 itsChannels;
};
} // end TBB namespace
} // end LOFAR namespace
#endif /* STOPCMD_H_ */
|
/* StarField.h
Copyright (c) 2014 by Michael Zahniser
Endless Sky 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.
Endless Sky 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.
*/
#ifndef STAR_FIELD_H_
#define STAR_FIELD_H_
#include "Body.h"
#include "Shader.h"
#include "gl_header.h"
#include <vector>
class Point;
// Object to hold a set of "stars" to be drawn as a backdrop. The star pattern
// repeats every 4096 pixels. The pattern is generated by a random walk method
// so that some parts will be much denser than others, which is visually more
// interesting than if the stars were evenly spread out in perfectly random
// noise. If the view is moving, the stars are elongated in a motion blur to
// match the motion; otherwise they would seem to jitter around.
class StarField {
public:
void Init(int stars, int width);
void Draw(const Point &pos, const Point &vel) const;
private:
void SetUpGraphics();
void MakeStars(int stars, int width);
private:
int widthMod;
int tileCols;
std::vector<int> tileIndex;
std::vector<Body> haze;
Shader shader;
GLuint vao;
GLuint vbo;
GLuint offsetI;
GLuint sizeI;
GLuint cornerI;
GLuint scaleI;
GLuint rotateI;
GLuint lengthI;
GLuint translateI;
};
#endif
|
/*
dat-level.c -- dat level module;
Copyright (C) 2015, 2016, 2017 Bruno Félix Rezende Ribeiro
<oitofelix@gnu.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, 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 "mininim.h"
struct level *
next_dat_level (struct level *l, int n)
{
n = validate_legacy_level_number (n);
return load_dat_level (l, n);
}
struct level *
load_dat_level (struct level *l, int n)
{
char *filename;
filename = xasprintf ("%s", levels_dat_filename);
int8_t *dat = (int8_t *)
load_resource (filename, (load_resource_f) load_file, true);
if (! dat) {
error (0, 0, "cannot read dat level file %s", filename);
return NULL;
}
al_free (filename);
int8_t *offset;
int16_t size;
dat_getres (dat, 2000 + n, &offset, &size);
if (! offset) {
error (0, 0, "incorrect format for dat level file %s", filename);
return NULL;
}
memcpy (&lv, offset, sizeof (lv));
interpret_legacy_level (l, n);
l->next_level = next_dat_level;
al_free (dat);
return l;
}
|
/*
* Vortex OpenSplice
*
* This software and documentation are Copyright 2006 to TO_YEAR ADLINK
* Technology Limited, its affiliated companies and licensors. All rights
* reserved.
*
* Licensed under the ADLINK Software License Agreement Rev 2.7 2nd October
* 2014 (the "License"); you may not use this file except in compliance with
* the License.
* You may obtain a copy of the License at:
* $OSPL_HOME/LICENSE
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#define OS_HAS_STRTOK_R 1
#include <netdb.h>
#include "../common/code/os_gethostname.c"
#include "../common/code/os_stdlib.c"
#include "../common/code/os_stdlib_bsearch.c"
#include "../common/code/os_stdlib_strtod.c"
#include "../common/code/os_stdlib_strtol.c"
#include "../common/code/os_stdlib_strtok_r.c"
|
/* console pcopy function */
#include "../fb.h"
#include "fb_private_console.h"
#include <go32.h>
int fb_ConsolePageCopy( int src, int dst )
{
/* use current? */
if( src < 0 )
src = __fb_con.active;
if( dst < 0 )
dst = __fb_con.visible;
if( src == dst )
return fb_ErrorSetNum( FB_RTERROR_OK );
/* do the copy */
int cols, rows;
fb_ConsoleGetSize( &cols, &rows );
unsigned long srcAddr = fb_hGetPageAddr( src, cols, rows );
unsigned long dstAddr = fb_hGetPageAddr( dst, cols, rows );
_movedataw( _dos_ds, srcAddr, _dos_ds, dstAddr, cols * rows );
return fb_ErrorSetNum( FB_RTERROR_OK );
}
|
/*
* Copyright (c) 2017-2021 Free Software Foundation, Inc.
*
* This file is part of GNU Wget.
*
* GNU Wget 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.
*
* GNU Wget 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 Wget. If not, see <https://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <dirent.h> // opendir, readdir
#include <stdint.h> // uint8_t
#include <stdio.h> // fmemopen
#include <string.h> // strncmp
#include <stdlib.h> // free
#include <fcntl.h> // open flags
#include <unistd.h> // close
#include <setjmp.h> // longjmp, setjmp
#include "wget.h"
#undef fopen_wgetrc
#ifdef __cplusplus
extern "C" {
#endif
#include "ftp.h"
// declarations for wget internal functions
int main_wget(int argc, const char **argv);
void cleanup(void);
FILE *fopen_wget(const char *pathname, const char *mode);
FILE *fopen_wgetrc(const char *pathname, const char *mode);
void exit_wget(int status);
#ifdef __cplusplus
}
#endif
#include "fuzzer.h"
FILE *fopen_wget(const char *pathname, const char *mode)
{
return fopen("/dev/null", mode);
}
FILE *fopen_wgetrc(const char *pathname, const char *mode)
{
return NULL;
}
static int do_jump;
static jmp_buf jmpbuf;
#ifdef FUZZING
void exit_wget(int status)
{
longjmp(jmpbuf, 1);
}
#elif defined HAVE_DLFCN_H
#include <dlfcn.h> // dlsym
#ifndef RTLD_NEXT
#define RTLD_NEXT RTLD_GLOBAL
#endif
void exit(int status)
{
if (do_jump) {
longjmp(jmpbuf, 1);
} else {
void (*libc_exit)(int) = (void(*)(int)) dlsym (RTLD_NEXT, "exit");
libc_exit(status);
}
}
#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
#ifdef HAVE_FMEMOPEN
FILE *fp;
struct fileinfo *fi;
if (size > 4096) // same as max_len = ... in .options file
return 0;
fp = fmemopen((void *) data, size, "r");
if (!fp) return 0;
CLOSE_STDERR
do_jump = 1;
if (setjmp(jmpbuf))
goto done;
fi = ftp_parse_ls_fp(fp, ST_UNIX);
freefileinfo(fi);
rewind(fp);
fi = ftp_parse_ls_fp(fp, ST_VMS);
freefileinfo(fi);
rewind(fp);
fi = ftp_parse_ls_fp(fp, ST_WINNT);
freefileinfo(fi);
rewind(fp);
fi = ftp_parse_ls_fp(fp, ST_MACOS);
done:
freefileinfo(fi);
fclose(fp);
do_jump = 0;
RESTORE_STDERR
#endif
return 0;
}
|
/*=========================================================================
Program: ITK-SNAP
Module: $RCSfile: Filename.cxx,v $
Language: C++
Date: $Date: 2010/10/18 11:25:44 $
Version: $Revision: 1.12 $
Copyright (c) 2011 Paul A. Yushkevich
This file is part of ITK-SNAP
ITK-SNAP 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 QTABSTRACTOPENGLBOX_H
#define QTABSTRACTOPENGLBOX_H
#include <QOpenGLWidget>
#include <SNAPCommon.h>
#include <SNAPEvents.h>
class QMouseEvent;
class EventBucket;
class QtInteractionDelegateWidget;
class AbstractRenderer;
namespace itk { class Object; }
class QtAbstractOpenGLBox : public QOpenGLWidget
{
Q_OBJECT
public:
explicit QtAbstractOpenGLBox(QWidget *parent = 0);
// Whether to grab keyboard focus when the mouse enters this widget
irisGetSetMacro(GrabFocusOnEntry, bool)
/**
Use this function when the GL widget is only associated with a single
interaction mode.
*/
void AttachSingleDelegate(QtInteractionDelegateWidget *delegate);
/**
The child class must override this method to return its pointer to the
renderer object. Every instance of this object must have a renderer.
*/
virtual AbstractRenderer* GetRenderer() const = 0;
/**
Take a screenshot, save to a PNG file
*/
virtual bool SaveScreenshot(std::string filename);
public slots:
// Default slot for model updates
virtual void onModelUpdate(const EventBucket &bucket) {}
protected:
/** Register to receive ITK events from object src. Events will be cached in
an event bucket and delivered once execution returns to the UI loop */
void connectITK(itk::Object *src, const itk::EventObject &ev,
const char *slot = SLOT(onModelUpdate(const EventBucket &)));
// OpenGL painter methods
virtual void paintGL();
virtual void resizeGL(int w, int h);
virtual void initializeGL();
// Resize event
// virtual void resizeEvent(QResizeEvent *);
virtual void enterEvent(QEvent *);
virtual void leaveEvent(QEvent *);
// Whether we need to call GL resize next time a paint command occurs
bool m_NeedResizeOnNextRepaint;
// Whether this widget grabs keyboard focus when the mouse enters it
bool m_GrabFocusOnEntry;
// Whether a screenshot has been requested (non-empty string)
QString m_ScreenshotRequest;
signals:
public slots:
};
#endif // QTABSTRACTOPENGLBOX_H
|
#ifndef STRTAG_H
#define STRTAG_H
/* When a struct use a struct-tag, it doesn't allocate memory */
struct strtag {
unsigned int year;
unsigned int month;
unsigned int dat;
};
#endif
/*
Within a .c file we can include this file:
#include "strtag.h"
*/
/* A good way to create a new type is:
typedef struct strtag NewType;
Then we can declare a new struct data type with:
NewType data;
Now the memory will be allocated.
*/
|
/*
This file is part of Mitsuba, a physically based rendering system.
Copyright (c) 2007-2012 by Wenzel Jakob and others.
Mitsuba is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License Version 3
as published by the Free Software Foundation.
Mitsuba 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/>.
*/
#pragma once
#if !defined(__MITSUBA_CORE_NORMAL_H_)
#define __MITSUBA_CORE_NORMAL_H_
#include <mitsuba/core/vector.h>
MTS_NAMESPACE_BEGIN
/**
* \headerfile mitsuba/core/normal.h mitsuba/mitsuba.h
* \brief Three-dimensional normal data structure
*
* Internally represented using floating point numbers of the chosen
* compile-time precision. The main difference of this data structure
* when compared to \ref TVector3<Float> is in how instances of
* \ref Normal are treated by linear transformations.
*
* \ingroup libcore
* \ingroup libpython
*/
struct Normal : public TVector3<Float> {
/** \brief Construct a new normal without initializing it.
*
* This construtor is useful when the normal will either not
* be used at all (it might be part of a larger data structure)
* or initialized at a later point in time. Always make sure
* that one of the two is the case! Otherwise your program will do
* computations involving uninitialized memory, which will probably
* lead to a difficult-to-find bug.
*/
Normal() { }
/// Initialize the vector with the specified X and Z components
Normal(Float x, Float y, Float z) : TVector3<Float>(x, y, z) { }
/// Initialize all components of the the normal with the specified value
explicit Normal(Float val) : TVector3<Float>(val) { }
/// Unserialize a normal from a binary data stream
Normal(Stream *stream) {
x = stream->readElement<Float>();
y = stream->readElement<Float>();
z = stream->readElement<Float>();
}
/// Construct a normal from a vector data structure
Normal(const TVector3<Float> &v) : TVector3<Float>(v.x, v.y, v.z) { }
/// Assign a vector to this normal
void operator=(const TVector3<Float> &v) {
x = v.x; y = v.y; z = v.z;
}
};
inline Normal normalize(const Normal &n) {
return n / n.length();
}
MTS_NAMESPACE_END
#endif /* __MITSUBA_CORE_NORMAL_H_ */
|
/* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla.
* The Game Closure SDK 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
* Mozilla Public License v. 2.0 for more details.
* You should have received a copy of the Mozilla Public License v. 2.0
* along with the Game Closure SDK. If not, see <http://mozilla.org/MPL/2.0/>.
*/
#ifndef TIMESTEP_TEXT_DATA_H
#define TIMESTEP_TEXT_DATA_H
#include "core/types.h"
#include "core/rgba.h"
typedef struct timestep_text_data_t {
rgba color;
rgba background_color;
double horizontal_padding;
double vertical_padding;
double line_height;
char *text_align;
char *vertical_align;
bool multiline;
int font_size;
char *font_family;
char *font_weight;
char *stroke_style;
double line_width;
char *text;
bool shadow;
rgba shadow_color;
} timestep_text_data;
timestep_text_data *timestep_text_data_init();
void timestep_text_data_delete(timestep_text_data *text_data);
#endif
|
//
// File assets/prueba.tmx converted to csv using cpct_tmx2csv [20170618 13:25:43 CEST]
// * Width: 20
// * Height: 20
// * Bytes: 400
//
#include <types.h>
// Generated CSV tilemap from assets/prueba.tmx
// 400 bytes (20 x 20)
#define g_nivel_1_W 20
#define g_nivel_1_H 20
extern const u8 g_nivel_1[20*20];
|
#include "printf.h"
#include "scanf.h"
#include "platform.h"
#include "soft_timer.h"
#include "unique_id.h"
#include "shell.h"
/* Leds Commands */
static int cmd_leds_on(int argc, char **argv)
{
uint8_t leds = 0;
if (argc != 2)
return 1;
if (1 != sscanf(argv[1], "%u", &leds))
return 1;
leds_on(leds);
printf("%s %x\n", argv[0], leds);
return 0;
}
static int cmd_leds_off(int argc, char **argv)
{
uint8_t leds = 0;
if (argc != 2)
return 1;
if (!sscanf(argv[1], "%u", &leds))
return 1;
leds_off(leds);
printf("%s %x\n", argv[0], leds);
return 0;
}
static int cmd_leds_blink(int argc, char **argv)
{
uint8_t leds = 0;
uint32_t time = 0;
static soft_timer_t led_alarm;
if (argc != 3)
return 1;
if (!sscanf(argv[1], "%u", &leds))
return 1;
if (!sscanf(argv[2], "%u", &time))
return 1;
if (time) {
soft_timer_set_handler(&led_alarm, (handler_t)leds_toggle,
(handler_arg_t)(uint32_t)leds);
soft_timer_start(&led_alarm, soft_timer_ms_to_ticks(time), 1);
printf("%s %u %u\n", argv[0], leds, time);
} else {
soft_timer_stop(&led_alarm);
printf("%s stop\n", argv[0]);
}
return 0;
}
/* Simple Commands */
static int cmd_echo(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++)
if (i == 1)
printf("%s", argv[i]);
else
printf(" %s", argv[i]);
printf("\n");
return 0;
}
static int cmd_get_time(int argc, char **argv)
{
if (argc != 1)
return 1;
printf("%s %u ticks_32khz\n", argv[0], soft_timer_time());
return 0;
}
static int cmd_get_uid(int argc, char **argv)
{
if (argc != 1)
return 1;
printf("%s %08x%08x%08x\n", argv[0],
uid->uid32[0], uid->uid32[1], uid->uid32[2]);
return 0;
}
struct shell_command commands[] = {
{"echo", "echo given arguments", cmd_echo},
{"get_time", "Print board time", cmd_get_time},
{"get_uid", "Print board uid", cmd_get_uid},
{"leds_on", "[leds_flag] Turn given leds on", cmd_leds_on},
{"leds_off", "[leds_flag] Turn given leds off", cmd_leds_off},
{"leds_blink", "[leds_flag] [time] Blink leds every 'time'. If 'time' == 0 disable", cmd_leds_blink},
{NULL, NULL, NULL},
};
int main(void)
{
platform_init();
soft_timer_init();
event_init();
shell_init(commands, 1);
platform_run();
return 1;
}
|
/*
========================================================================
D O O M R e t r o
The classic, refined DOOM source port. For Windows PC.
========================================================================
Copyright © 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright © 2013-2018 Brad Harding.
DOOM Retro is a fork of Chocolate DOOM. For a list of credits, see
<https://github.com/bradharding/doomretro/wiki/CREDITS>.
This file is part of DOOM Retro.
DOOM Retro 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.
DOOM Retro 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 DOOM Retro. If not, see <https://www.gnu.org/licenses/>.
DOOM is a registered trademark of id Software LLC, a ZeniMax Media
company, in the US and/or other countries and is used without
permission. All other trademarks are the property of their respective
holders. DOOM Retro is in no way affiliated with nor endorsed by
id Software.
========================================================================
*/
#if !defined(__W_WAD_H__)
#define __W_WAD_H__
#include "doomdef.h"
#include "w_file.h"
//
// TYPES
//
//
// WADFILE I/O related stuff.
//
#define IWAD 1
#define PWAD 2
typedef struct lumpinfo_s lumpinfo_t;
struct lumpinfo_s
{
char name[9];
int size;
void *cache;
// killough 1/31/98: hash table fields, used for ultra-fast hash table lookup
int index;
int next;
int position;
wadfile_t *wadfile;
};
extern lumpinfo_t **lumpinfo;
extern int numlumps;
extern char *iwadsrequired[];
char *GetCorrectCase(char *path);
wadfile_t *W_AddFile(char *filename, dboolean automatic);
int W_WadType(char *filename);
int W_CheckNumForName(const char *name);
int W_RangeCheckNumForName(int min, int max, const char *name);
int W_GetNumForName(const char *name);
int W_GetNumForName2(const char *name);
int W_CheckMultipleLumps(const char *name);
int W_LumpLength(int lump);
void W_ReadLump(int lump, void *dest);
void *W_CacheLumpNum(int lumpnum);
#define W_CacheLumpName(name) W_CacheLumpNum(W_GetNumForName(name))
#define W_CacheLumpName2(name) W_CacheLumpNum(W_GetNumForName2(name))
void W_Init(void);
unsigned int W_LumpNameHash(const char *s);
void W_ReleaseLumpNum(int lumpnum);
#define W_ReleaseLumpName(name) W_ReleaseLumpNum(W_GetNumForName(name))
GameMission_t IWADRequiredByPWAD(char *pwadname);
dboolean HasDehackedLump(const char *pwadname);
#endif
|
// @file
/*
* Copyright (C) 2010 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <map>
#include "../security_common.h"
namespace mongo {
/** here we keep a single connection (with reconnect) for a set of hosts,
one each, and allow one user at a time per host. if in use already for that
host, we block. so this is an easy way to keep a 1-deep pool of connections
that many threads can share.
thread-safe.
Example:
{
ScopedConn c("foo.acme.com:9999");
c->runCommand(...);
}
throws exception on connect error (but fine to try again later with a new
scopedconn object for same host).
*/
class ScopedConn {
public:
/** throws assertions if connect failure etc. */
ScopedConn(string hostport);
~ScopedConn() {
// conLock releases...
}
void reconnect() {
connInfo->cc.reset(new DBClientConnection(true, 0, 10));
connInfo->cc->_logLevel = 2;
connInfo->connected = false;
connect();
}
/* If we were to run a query and not exhaust the cursor, future use of the connection would be problematic.
So here what we do is wrapper known safe methods and not allow cursor-style queries at all. This makes
ScopedConn limited in functionality but very safe. More non-cursor wrappers can be added here if needed.
*/
bool runCommand(const string &dbname,
const BSONObj& cmd,
BSONObj &info,
int options=0,
const AuthenticationTable* auth=NULL) {
return conn()->runCommand(dbname, cmd, info, options, auth);
}
unsigned long long count(const string &ns) {
return conn()->count(ns);
}
BSONObj findOne(const string &ns, const Query& q, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) {
return conn()->findOne(ns, q, fieldsToReturn, queryOptions);
}
private:
auto_ptr<scoped_lock> connLock;
static mongo::mutex mapMutex;
struct ConnectionInfo {
mongo::mutex lock;
scoped_ptr<DBClientConnection> cc;
bool connected;
ConnectionInfo() : lock("ConnectionInfo"),
cc(new DBClientConnection(/*reconnect*/ true, 0, /*timeout*/ 10.0)),
connected(false) {
cc->_logLevel = 2;
}
} *connInfo;
typedef map<string,ScopedConn::ConnectionInfo*> M;
static M& _map;
scoped_ptr<DBClientConnection>& conn() { return connInfo->cc; }
const string _hostport;
// we should already be locked...
bool connect() {
string err;
if (!connInfo->cc->connect(_hostport, err)) {
log() << "couldn't connect to " << _hostport << ": " << err << rsLog;
return false;
}
connInfo->connected = true;
// if we cannot authenticate against a member, then either its key file
// or our key file has to change. if our key file has to change, we'll
// be rebooting. if their file has to change, they'll be rebooted so the
// connection created above will go dead, reconnect, and reauth.
if (!noauth) {
if (!connInfo->cc->auth("local",
internalSecurity.user,
internalSecurity.pwd,
err,
false)) {
log() << "could not authenticate against " << _hostport << ", " << err << rsLog;
return false;
}
connInfo->cc->setAuthenticationTable(
AuthenticationTable::getInternalSecurityAuthenticationTable() );
}
return true;
}
};
inline ScopedConn::ScopedConn(string hostport) : _hostport(hostport) {
bool first = false;
{
scoped_lock lk(mapMutex);
connInfo = _map[_hostport];
if( connInfo == 0 ) {
connInfo = _map[_hostport] = new ConnectionInfo();
first = true;
connLock.reset( new scoped_lock(connInfo->lock) );
}
}
// already locked connLock above
if (first) {
connect();
return;
}
connLock.reset( new scoped_lock(connInfo->lock) );
if (connInfo->connected) {
return;
}
// Keep trying to connect if we're not yet connected
connect();
}
}
|
#pragma region Copyright (c) 2014-2017 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
#ifndef _WIDGET_H_
#define _WIDGET_H_
#include "window.h"
typedef enum {
WWT_EMPTY = 0,
WWT_FRAME = 1,
WWT_RESIZE = 2,
WWT_IMGBTN = 3,
WWT_4 = 4, // Same as IMGBTN but uses .image + 1 while pressed/active
WWT_5 = 5,
WWT_COLOURBTN = 6,
WWT_TRNBTN = 7,
WWT_TAB = 8,
WWT_FLATBTN = 9,
WWT_DROPDOWN_BUTTON = 10,
WWT_11, // Same as dropdown button but uses .text + 1 while pressed/active
WWT_12, // looks like a normal label to me
WWT_13,
WWT_14,
WWT_SPINNER = 15,
WWT_DROPDOWN = 16,
WWT_VIEWPORT = 17,
WWT_18,
WWT_GROUPBOX = 19,
WWT_CAPTION = 20,
WWT_CLOSEBOX = 21,
WWT_SCROLL = 22,
WWT_CHECKBOX = 23,
WWT_24,
WWT_25,
WWT_TEXT_BOX = 27,
WWT_LAST = 26,
} WINDOW_WIDGET_TYPES;
#define WIDGETS_END WWT_LAST, 0, 0, 0, 0, 0, 0, 0
#define BAR_BLINK (1u << 31)
enum {
SCROLL_HORIZONTAL = (1 << 0),
SCROLL_VERTICAL = (1 << 1),
SCROLL_BOTH = SCROLL_HORIZONTAL | SCROLL_VERTICAL
};
#ifdef __cplusplus
extern "C" {
#endif
void widget_scroll_update_thumbs(rct_window *w, rct_widgetindex widget_index);
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex);
bool widget_is_enabled(rct_window *w, rct_widgetindex widgetIndex);
bool widget_is_disabled(rct_window *w, rct_widgetindex widgetIndex);
bool widget_is_pressed(rct_window *w, rct_widgetindex widgetIndex);
bool widget_is_highlighted(rct_window *w, rct_widgetindex widgetIndex);
bool widget_is_active_tool(rct_window *w, rct_widgetindex widgetIndex);
void widget_scroll_get_part(rct_window *w, rct_widget* widget, sint32 x, sint32 y, sint32 *output_x, sint32 *output_y, sint32 *output_scroll_area, sint32 *scroll_id);
void widget_set_enabled(rct_window *w, rct_widgetindex widgetIndex, bool enabled);
void widget_set_checkbox_value(rct_window *w, rct_widgetindex widgetIndex, sint32 value);
#ifdef __cplusplus
}
#endif
#endif
|
extern void __assert_fail();
int main() {
int N;
int x = 0;
int i = 0;
while (i < N) {
if (!(x == 0)) {
__assert_fail();
return 1;
}
i = i+1;
}
if (!(x == 0)) {
__assert_fail();
return 1;
}
}
|
#ifndef QT3KLOADSENSORDATAOBJECT_H
#define QT3KLOADSENSORDATAOBJECT_H
#include <QObject>
#include "QT3kHIDObject.h"
#include "LogDataDef.h"
class QT3kLoadSensorDataObject : public QT3kHIDObject
{
Q_OBJECT
public:
explicit QT3kLoadSensorDataObject(QT3kDevice*& pHandle, QObject *parent = 0);
virtual ~QT3kLoadSensorDataObject();
enum eDataPart { DP_CM1 = 1, DP_CM2, DP_CM1_1, DP_CM2_1, DP_MM, DP_END };
// QT3kHIDObject
virtual bool Start( SensorLogData* pStorage );
protected:
void LoadNextCamData( eDataPart ePart );
void NextCommand();
void Push_Data(ResponsePart Part, PairRSP &stRSP, const char* sCmd);
protected:
// QT3kDeviceEventHandler::IListener
virtual void TPDP_OnRSP(T3K_DEVICE_INFO devInfo, ResponsePart Part, unsigned short ticktime, const char *partid, int id, bool bFinal, const char *cmd);
virtual void TPDP_OnRSE(T3K_DEVICE_INFO devInfo, ResponsePart Part, unsigned short ticktime, const char *partid, int id, bool bFinal, const char *cmd);
virtual void TPDP_OnVER(T3K_DEVICE_INFO devInfo, ResponsePart Part, unsigned short ticktime, const char *partid, t3kpacket::_body::_ver *ver);
protected:
long m_nNVIndex;
bool m_bFactoryCmd;
eDataPart m_eDataPart;
SensorLogData* m_pStorageHandle;
signals:
public slots:
};
#endif // QT3KLOADSENSORDATAOBJECT_H
|
/* $Id: ncbi_math.h 351792 2012-02-01 16:20:19Z ucko $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Authors: Gish, Kans, Ostell, Schuler
*
* Version Creation Date: 10/23/91
*
* ==========================================================================
*/
/** @file ncbi_math.h
* Prototypes for portable math library (ported from C Toolkit)
*/
#ifndef ALGO_BLAST_CORE__NCBIMATH
#define ALGO_BLAST_CORE__NCBIMATH
/** Natural logarithm with shifted input
* @param x input operand (x > -1)
* @return log(x+1)
*/
double BLAST_Log1p (double x);
/** Exponentional with base e
* @param x input operand
* @return exp(x) - 1
*/
double BLAST_Expm1 (double x);
/** Factorial function
* @param n input operand
* @return (double)(1 * 2 * 3 * ... * n)
*/
double BLAST_Factorial(int32_t n);
/** Logarithm of the factorial
* @param x input operand
* @return log(1 * 2 * 3 * ... * x)
*/
double BLAST_LnFactorial (double x);
/** log(gamma(n)), integral n
* @param n input operand
* @return log(1 * 2 * 3 * ... (n-1))
*/
double BLAST_LnGammaInt (int32_t n);
/** Romberg numerical integrator
* @param f Pointer to the function to integrate; the first argument
* is the variable to integrate over, the second is a pointer
* to a list of additional arguments that f may need
* @param fargs Pointer to an array of extra arguments or parameters
* needed to compute the function to be integrated. None
* of the items in this list may vary over the region
* of integration
* @param p Left-hand endpoint of the integration interval
* @param q Right-hand endpoint of the integration interval
* (q is assumed > p)
* @param eps The relative error tolerance that indicates convergence
* @param epsit The number of consecutive diagonal entries in the
* Romberg array whose relative difference must be less than
* eps before convergence is assumed. This is presently
* limited to 1, 2, or 3
* @param itmin The minimum number of diagnonal Romberg entries that
* will be computed
* @return The computed integral of f() between p and q
*/
double BLAST_RombergIntegrate (double (*f) (double, void*),
void* fargs, double p, double q,
double eps, int32_t epsit, int32_t itmin);
/** Greatest common divisor
* @param a First operand (any integer)
* @param b Second operand (any integer)
* @return The largest integer that evenly divides a and b
*/
int32_t BLAST_Gcd (int32_t a, int32_t b);
/** Divide 3 numbers by their greatest common divisor
* @param a First integer [in] [out]
* @param b Second integer [in] [out]
* @param c Third integer [in] [out]
* @return The greatest common divisor
*/
int32_t BLAST_Gdb3(int32_t* a, int32_t* b, int32_t* c);
/** Nearest integer
* @param x Input to round (rounded value must be representable
* as a 32-bit signed integer)
* @return floor(x + 0.5);
*/
long BLAST_Nint (double x);
/** Integral power of x
* @param x floating-point base of the exponential
* @param n (integer) exponent
* @return x multiplied by itself n times
*/
double BLAST_Powi (double x, int32_t n);
/** The error function of x: the integral from 0 to x of e(-t*t) dt,
* scaled by 2/sqrt(pi) to fall within the range (-1,1). */
double BLAST_Erf (double x);
/** The complementary error function of x: 1 - erf(x), but calculated
* more accurately for large x (where erf(x) approaches unity). */
double BLAST_ErfC (double x);
/** Number of derivatives of log(x) to carry in gamma-related
computations */
#define LOGDERIV_ORDER_MAX 4
/** Number of derivatives of polygamma(x) to carry in gamma-related
computations for non-integral values of x */
#define POLYGAMMA_ORDER_MAX LOGDERIV_ORDER_MAX
/** value of pi is only used in gamma-related computations */
#define NCBIMATH_PI 3.1415926535897932384626433832795
/** Natural log(2) */
#define NCBIMATH_LN2 0.69314718055994530941723212145818
/** Natural log(PI) */
#define NCBIMATH_LNPI 1.1447298858494001741434273513531
#endif /* !ALGO_BLAST_CORE__NCBIMATH */
|
/*
* Copyright (C) 2008-2013 FreeIPMI Core Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 IPMI_CHASSIS_CONFIG_VALIDATE_H
#define IPMI_CHASSIS_CONFIG_VALIDATE_H
#include "ipmi-chassis-config.h"
#include "ipmi-chassis-config-sections.h"
config_validate_t power_restore_policy_number_validate (const char *section_name,
const char *key_name,
const char *value,
void *arg);
config_validate_t bios_boot_type_number_validate (const char *section_name,
const char *key_name,
const char *value,
void *arg);
config_validate_t boot_device_number_validate (const char *section_name,
const char *key_name,
const char *value,
void *arg);
config_validate_t device_instance_selector_number_validate (const char *section_name,
const char *key_name,
const char *value,
void *arg);
config_validate_t firmware_bios_verbosity_number_validate (const char *section_name,
const char *key_name,
const char *value,
void *arg);
config_validate_t console_redirection_number_validate (const char *section_name,
const char *key_name,
const char *value,
void *arg);
#endif /* IPMI_CHASSIS_CONFIG_VALIDATE_H */
|
//
// BAGEL - Brilliantly Advanced General Electronic Structure Library
// Filename: rnbatch.h
// Copyright (C) 2012 Toru Shiozaki
//
// Author: Hai-Anh Le <anh@u.northwestern.edu>
// Maintainer: Shiozaki group
//
// This file is part of the BAGEL package.
//
// 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 __SRC_RYSINT_RNBATCH_H
#define __SRC_RYSINT_RNBATCH_H
#include <src/integral/rys/coulombbatch_energy.h>
namespace bagel {
class RnBatch: public CoulombBatch_energy {
protected:
int get_max_rterms() const {
int out = 0;
for (auto& aiter : mol_->atoms())
if (aiter->use_ecp_basis())
if (aiter->ecp_parameters()->shell_maxl_ecp()->ecp_exponents().size() > out)
out = aiter->ecp_parameters()->shell_maxl_ecp()->ecp_exponents().size();
return out;
}
public:
RnBatch(const std::array<std::shared_ptr<const Shell>,2>& _info,
const std::shared_ptr<const Molecule> mol, std::shared_ptr<StackMem> stack = nullptr)
: CoulombBatch_energy (_info, mol, stack) {
max_rterms_ = get_max_rterms();
this->allocate_arrays(primsize_ * natom_ * max_rterms_);
}
~RnBatch() { }
};
}
#endif
|
//____________________________________________________________________________
/*!
\class genie::AlgId
\brief Algorithm ID (algorithm name + configuration set name)
\author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
University of Liverpool & STFC Rutherford Appleton Lab
\created October 20, 2005
\cpright Copyright (c) 2003-2017, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
*/
//____________________________________________________________________________
#ifndef _ALGID_H_
#define _ALGID_H_
#include <string>
#include <iostream>
#include "Registry/RegistryItemTypeDef.h"
using std::string;
using std::ostream;
namespace genie {
class AlgId;
ostream & operator << (ostream & stream, const AlgId & alg);
class AlgId {
public:
AlgId();
AlgId(string name, string config);
AlgId(const AlgId & id);
AlgId(const RgAlg & registry_item);
~AlgId();
string Name (void) const { return fName; }
string Config (void) const { return fConfig; }
string Key (void) const { return fKey; }
void SetId (string name, string config="");
void SetName (string name);
void SetConfig (string config);
void Copy (const AlgId & id);
void Copy (const RgAlg & registry_item);
void Print (ostream & stream) const;
friend ostream & operator << (ostream & stream, const AlgId & alg);
private:
void Init (void);
void UpdateKey (void);
string fName; ///< Algorithm name (including namespaces)
string fConfig; ///< Configuration set name
string fKey; ///< Unique key: namespace::alg_name/alg_config
};
} // genie namespace
#endif // _ALGID_H_
|
/*
* Copyright (c) 2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*
* File: errorlib.h
* Author: Douglas Orr, Carnegie Mellon University
* Date: Mar. 1988
*
* Error bases for subsytems errors.
*/
#include <stddef.h>
#include <mach/error.h>
#include <mach/boolean.h>
#define MACH_IPC_SEND_MOD (err_mach_ipc|err_sub(0))
#define MACH_IPC_RCV_MOD (err_mach_ipc|err_sub(1))
#define MACH_IPC_MIG_MOD (err_mach_ipc|err_sub(2))
#define IPC_SEND_MOD (err_ipc|err_sub(0))
#define IPC_RCV_MOD (err_ipc|err_sub(1))
#define IPC_MIG_MOD (err_ipc|err_sub(2))
#define SERV_NETNAME_MOD (err_server|err_sub(0))
#define SERV_ENV_MOD (err_server|err_sub(1))
#define SERV_EXECD_MOD (err_server|err_sub(2))
#define NO_SUCH_ERROR "unknown error code"
struct error_sparse_map {
unsigned start;
unsigned end;
};
#define err_sub_map_entry(start, end) { err_get_sub(start), err_get_sub(end) }
#define err_code_map_entry(start, end) { err_get_code(start), err_get_code(end) }
struct error_subsystem {
const char *subsys_name;
int max_code;
const char * const *codes;
const struct error_sparse_map *map_table;
int map_count;
};
#define errorlib_system_null { NULL, 0, NULL, NULL, 0 }
struct error_system {
int max_sub;
const char *bad_sub;
const struct error_subsystem *subsystem;
const struct error_sparse_map *map_table;
int map_count;
};
#define errorlib_sub_null { 0, NULL, NULL, NULL, 0 }
extern const struct error_system _mach_errors[err_max_system + 1];
char *mach_error_string_int(mach_error_t, boolean_t *);
#define errlib_count(s) (sizeof(s)/sizeof(s[0]))
|
/**************************************************************************
*
* File name: ompcore.h
*
* Ron Rubinstein
* Computer Science Department
* Technion, Haifa 32000 Israel
* ronrubin@cs
*
* Last Updated: 18.8.2009
*
* Contains the core implementation of Batch-OMP / OMP-Cholesky.
*
*************************************************************************/
#ifndef __OMP_CORE_H__
#define __OMP_CORE_H__
#include "mex.h"
/**************************************************************************
* Perform Batch-OMP or OMP-Cholesky on a specified set of signals, using
* either a fixed number of atoms or an error bound.
*
* Parameters (not all required):
*
* D - the dictionary, of size n X m
* x - the signals, of size n X L
* DtX - D'*x, of size m X L
* XtX - squared norms of the signals in x, sum(x.*x), of length L
* G - D'*D, of size m X m
* T - target sparsity, or maximal number of atoms for error-based OMP
* eps - target residual norm for error-based OMP
* gamma_mode - one of the constants FULL_GAMMA or SPARSE_GAMMA
* profile - if non-zero, profiling info is printed
* msg_delta - positive: the # of seconds between status prints, otherwise: nothing is printed
* erroromp - if nonzero indicates error-based OMP, otherwise fixed sparsity OMP
*
* Usage:
*
* The function can be called using different parameters, and will have
* different complexity depending on the parameters specified. Arrays which
* are not specified should be passed as null (0). When G is specified,
* Batch-OMP is performed. Otherwise, OMP-Cholesky is performed.
*
* Fixed-sparsity usage:
* ---------------------
* Either DtX, or D and x, must be specified. Specifying DtX is more efficient.
* XtX does not need to be specified.
* When D and x are specified, G is not required. However, not providing G
* will significantly degrade efficiency.
* The number of atoms must be specified in T. The value of eps is ignored.
* Finally, set erroromp to 0.
*
* Error-OMP usage:
* ----------------
* Either DtX and Xtx, or D and x, must be specified. Specifying DtX and XtX
* is more efficient.
* When D and x are specified, G is not required. However, not providing G
* will significantly degrade efficiency.
* The target error must be specified in eps. A hard limit on the number
* of atoms can also be specified via the parameter T. Otherwise, T should
* be negative. Finally, set erroromp to nonzero.
*
*
* Returns:
* An mxArray containing the sparse representations of the signals in x
* (allocated using the appropriate mxCreateXXX() function).
* The array is either full or sparse, depending on gamma_mode.
*
**************************************************************************/
mxArray* ompcore(double D[], double x[], double DtX[], double XtX[], double G[], mwSize n, mwSize m, mwSize L,
int T, double eps, int gamma_mode, int profile, double msg_delta, int erroromp);
#endif
|
/*
* Vortex OpenSplice
*
* This software and documentation are Copyright 2006 to TO_YEAR ADLINK
* Technology Limited, its affiliated companies and licensors. All rights
* reserved.
*
* Licensed under the ADLINK Software License Agreement Rev 2.7 2nd October
* 2014 (the "License"); you may not use this file except in compliance with
* the License.
* You may obtain a copy of the License at:
* $OSPL_HOME/LICENSE
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "d_nameSpacesRequest.h"
#include "d_message.h"
#include "os_heap.h"
d_nameSpacesRequest
d_nameSpacesRequestNew(
d_admin admin)
{
d_nameSpacesRequest request;
request = NULL;
if(admin){
request = d_nameSpacesRequest(os_malloc(C_SIZEOF(d_nameSpacesRequest)));
if(request){
d_messageInit(d_message(request), admin);
}
}
return request;
}
void
d_nameSpacesRequestFree(
d_nameSpacesRequest request)
{
if(request){
d_messageDeinit(d_message(request));
os_free(request);
}
}
|
#define _GNU_SOURCE
#include "animation.h"
#include "testParameters.h"
#include "graphics.h"
#include <stdbool.h>
#include <string.h>
void init()
{
allegro_init();
set_gfx_mode(GFX_AUTODETECT_WINDOWED, XWIN, YWIN, 0, 0);
clear_to_color(screen, BGC);
install_keyboard();
install_mouse();
srand(time(NULL));
pmux_create_pi(&mxa);
}
/*--------------------------------------------------------------*/
/* MAIN process */
/*--------------------------------------------------------------*/
int main(void)
{
bool state_task [NUM_T_TEST]; /* state_i==true task created*/
int priority [NUM_T_TEST];
int i, id, k;
int c; /* character from keyboard */
int ntasks = 0; /* total number of activated tasks*/
int ret = 0;
int tipo_prio = PRIO_DIFF;
int sched = SCHED_OTHER;
int prot = NO_PROTOCOL;
int test = PART;
for (i = 0; i < NUM_T_TEST; i++){
state_task[NUM_T_TEST]=false;
}
init();
ret = select_part ();
if ( ret == -1 ) {
allegro_exit();
return 0;
}
init_vettore_prio(tipo_prio, priority, NUM_T_TEST);
ptask_init(sched, ret, prot);
draw_system_info(sched, ret, prot, tipo_prio, test);
/*Creation aperiodic task*/
for ( i=0; i < NUM_T_TEST; i++) {
tpars params = TASK_SPEC_DFL;
params.period = tspec_from(PER, MILLI);
params.priority = priority[i];
params.measure_flag = 0;
params.act_flag = DEFERRED;
params.processor = 0;
id = ptask_create_param(periodicBall_testPart, ¶ms);
if (id != -1) {
printf("Task %d created \n", id);
state_task[id] = true; // task create state=true
}
else {
allegro_exit();
printf("Error in creating task!\n");
exit(-1);
}
}
do {
k = 0;
if (keypressed()) {
c = readkey();
k = c >> 8;
}
/*section for task activation*/
if ((k >= KEY_1) && (k <= KEY_0 + NUM_T_TEST)) {
id = k - KEY_0 - 1;
if ( state_task[id] ){//if task is create but not activate
ret = ptask_activate(id);
if (ret != -1){
printf("Task %d activated\n", id);
draw_activation (ntasks, id, priority[id], false);
ntasks++;
state_task[id]=false;
}
}
}
} while (k != KEY_ESC);
pmux_destroy(&mxa);
allegro_exit();
return 0;
}
/*--------------------------------------------------------------*/
|
/*
* Copyright © 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* 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 Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Alan Griffiths <alan@octopull.co.uk>
*/
#ifndef MIR_FRONTEND_SESSION_MEDIATOR_H_
#define MIR_FRONTEND_SESSION_MEDIATOR_H_
#include "mir_protobuf.pb.h"
#include <map>
#include <memory>
namespace mir
{
namespace graphics
{
class Platform;
class ViewableArea;
}
namespace compositor
{
class GraphicBufferAllocator;
}
/// Frontend interface. Mediates the interaction between client
/// processes and the core of the mir system.
namespace frontend
{
class Shell;
class Session;
class ResourceCache;
class SessionMediatorReport;
// SessionMediator relays requests from the client process into the server.
class SessionMediator : public mir::protobuf::DisplayServer
{
public:
SessionMediator(
std::shared_ptr<Shell> const& shell,
std::shared_ptr<graphics::Platform> const& graphics_platform,
std::shared_ptr<graphics::ViewableArea> const& viewable_area,
std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,
std::shared_ptr<SessionMediatorReport> const& report,
std::shared_ptr<ResourceCache> const& resource_cache);
/* Platform independent requests */
void connect(::google::protobuf::RpcController* controller,
const ::mir::protobuf::ConnectParameters* request,
::mir::protobuf::Connection* response,
::google::protobuf::Closure* done);
void create_surface(google::protobuf::RpcController* controller,
const mir::protobuf::SurfaceParameters* request,
mir::protobuf::Surface* response,
google::protobuf::Closure* done);
void next_buffer(
google::protobuf::RpcController* controller,
mir::protobuf::SurfaceId const* request,
mir::protobuf::Buffer* response,
google::protobuf::Closure* done);
void select_focus_by_lightdm_id(
google::protobuf::RpcController* controller,
mir::protobuf::LightdmId const* request,
mir::protobuf::Void* response,
google::protobuf::Closure* done);
void release_surface(google::protobuf::RpcController* controller,
const mir::protobuf::SurfaceId*,
mir::protobuf::Void*,
google::protobuf::Closure* done);
void disconnect(google::protobuf::RpcController* controller,
const mir::protobuf::Void* request,
mir::protobuf::Void* response,
google::protobuf::Closure* done);
/* Platform specific requests */
void drm_auth_magic(google::protobuf::RpcController* controller,
const mir::protobuf::DRMMagic* request,
mir::protobuf::DRMAuthMagicStatus* response,
google::protobuf::Closure* done);
void configure_surface(google::protobuf::RpcController* controller,
const mir::protobuf::SurfaceSetting*,
mir::protobuf::SurfaceSetting*,
google::protobuf::Closure* done);
private:
std::shared_ptr<Shell> const shell;
std::shared_ptr<graphics::Platform> const graphics_platform;
// TODO this is a dubious dependency - to get display_info (is there only one?)
std::shared_ptr<graphics::ViewableArea> const viewable_area;
// TODO this is a dubious dependency - to get supported_pixel_formats
std::shared_ptr<compositor::GraphicBufferAllocator> const buffer_allocator;
std::shared_ptr<SessionMediatorReport> const report;
std::shared_ptr<ResourceCache> const resource_cache;
std::shared_ptr<Session> session;
};
}
}
#endif /* MIR_FRONTEND_SESSION_MEDIATOR_H_ */
|
/*
Generated by sbus code generator
Copyright (C) 2017 Red Hat
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 _SBUS_SSS_KEYGENS_H_
#define _SBUS_SSS_KEYGENS_H_
#include <talloc.h>
#include "sbus/sbus_request.h"
#include "sss_iface/sbus_sss_arguments.h"
const char *
_sbus_sss_key_
(TALLOC_CTX *mem_ctx,
struct sbus_request *sbus_req);
const char *
_sbus_sss_key_s_0
(TALLOC_CTX *mem_ctx,
struct sbus_request *sbus_req,
struct _sbus_sss_invoker_args_s *args);
const char *
_sbus_sss_key_u_0
(TALLOC_CTX *mem_ctx,
struct sbus_request *sbus_req,
struct _sbus_sss_invoker_args_u *args);
const char *
_sbus_sss_key_us_0_1
(TALLOC_CTX *mem_ctx,
struct sbus_request *sbus_req,
struct _sbus_sss_invoker_args_us *args);
const char *
_sbus_sss_key_uss_0_1
(TALLOC_CTX *mem_ctx,
struct sbus_request *sbus_req,
struct _sbus_sss_invoker_args_uss *args);
const char *
_sbus_sss_key_uusss_0_1_2_3_4
(TALLOC_CTX *mem_ctx,
struct sbus_request *sbus_req,
struct _sbus_sss_invoker_args_uusss *args);
#endif /* _SBUS_SSS_KEYGENS_H_ */
|
/*
Copyright (c) 2012-2020 Maarten Baert <maarten-baert@hotmail.com>
This file is part of SimpleScreenRecorder.
SimpleScreenRecorder 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.
SimpleScreenRecorder 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 SimpleScreenRecorder. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Global.h"
template<typename E>
class EnumStrings {
private:
static const EnumStrings SINGLETON;
private:
std::vector<std::pair<E, QString> > m_to_string, m_from_string;
private:
inline static bool CompareFirst(const std::pair<E, QString>& a, const std::pair<E, QString>& b) { return (a.first < b.first); }
inline static bool CompareSecond(const std::pair<E, QString>& a, const std::pair<E, QString>& b) { return (a.second < b.second); }
public:
EnumStrings(std::initializer_list<std::pair<E, QString> > list) {
m_to_string = m_from_string = list;
std::sort(m_to_string.begin(), m_to_string.end(), CompareFirst);
std::sort(m_from_string.begin(), m_from_string.end(), CompareSecond);
}
inline static QString ToString(E value) {
auto it = std::lower_bound(SINGLETON.m_to_string.begin(), SINGLETON.m_to_string.end(), std::make_pair(value, QString()), CompareFirst);
if(it == SINGLETON.m_to_string.end() || it->first != value) {
assert(false);
return QString();
}
return it->second;
}
inline static E FromString(const QString& string, E fallback) {
auto it = std::lower_bound(SINGLETON.m_from_string.begin(), SINGLETON.m_from_string.end(), std::make_pair((E) 0, string), CompareSecond);
if(it == SINGLETON.m_from_string.end() || it->second != string)
return fallback;
return it->first;
}
};
template<typename E>
inline QString EnumToString(E value) { return EnumStrings<E>::ToString(value); }
template<typename E>
inline E StringToEnum(const QString& string, E fallback) { return EnumStrings<E>::FromString(string, fallback); }
#define ENUMSTRINGS(E) template<> const EnumStrings<E> EnumStrings<E>::SINGLETON
|
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_GRAPHICS_DRAWABLE_H
#define LOVE_GRAPHICS_DRAWABLE_H
// LOVE
#include <common/Object.h>
namespace love
{
namespace graphics
{
/**
* A Drawable is anything that can be drawn on screen with a
* position, scale and orientation.
**/
class Drawable : public Object
{
public:
/**
* Destructor.
**/
virtual ~Drawable();
/**
* Draws the object with the specified transformation.
*
* @param x The position of the object along the x-axis.
* @param y The position of the object along the y-axis.
* @param angle The angle of the object (in radians).
* @param sx The scale factor along the x-axis.
* @param sy The scale factor along the y-axis.
* @param ox The origin offset along the x-axis.
* @param oy The origin offset along the y-axis.
* @param kx Shear along the x-axis.
* @param ky Shear along the y-axis.
**/
virtual void draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) const = 0;
};
} // graphics
} // love
#endif // LOVE_GRAPHICS_DRAWABLE_H
|
/*
* vector.c - This file contains all of the vector arithmetic functions.
*
* $Id: vector.c,v 1.8 2012/10/17 04:25:57 johns Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define TACHYON_INTERNAL 1
#include "tachyon.h"
#include "macros.h"
flt VDot(const vector *a, const vector *b) {
return (a->x*b->x + a->y*b->y + a->z*b->z);
}
void VCross(const vector * a, const vector * b, vector * c) {
c->x = (a->y * b->z) - (a->z * b->y);
c->y = (a->z * b->x) - (a->x * b->z);
c->z = (a->x * b->y) - (a->y * b->x);
}
flt VLength(const vector * a) {
return (flt) SQRT((a->x * a->x) + (a->y * a->y) + (a->z * a->z));
}
void VNorm(vector * a) {
flt len;
len=SQRT((a->x * a->x) + (a->y * a->y) + (a->z * a->z));
if (len != 0.0) {
a->x /= len;
a->y /= len;
a->z /= len;
}
}
void VAdd(const vector * a, const vector * b, vector * c) {
c->x = (a->x + b->x);
c->y = (a->y + b->y);
c->z = (a->z + b->z);
}
void VSub(const vector * a, const vector * b, vector * c) {
c->x = (a->x - b->x);
c->y = (a->y - b->y);
c->z = (a->z - b->z);
}
void VAddS(flt a, const vector * A, const vector * B, vector * C) {
C->x = (a * A->x) + B->x;
C->y = (a * A->y) + B->y;
C->z = (a * A->z) + B->z;
}
vector Raypnt(const ray * a, flt t) {
vector temp;
temp.x=a->o.x + (a->d.x * t);
temp.y=a->o.y + (a->d.y * t);
temp.z=a->o.z + (a->d.z * t);
return temp;
}
void VScale(vector * a, flt s) {
a->x *= s;
a->y *= s;
a->z *= s;
}
void ColorAddS(color * a, const color * b, flt s) {
a->r += b->r * s;
a->g += b->g * s;
a->b += b->b * s;
}
void ColorAccum(color * a, const color * b) {
a->r += b->r;
a->g += b->g;
a->b += b->b;
}
void ColorScale(color * a, flt s) {
a->r *= s;
a->g *= s;
a->b *= s;
}
|
//
// SAXParser.h
//
// Library: XML
// Package: SAX
// Module: SAX
//
// Implementation of the XMLReader interface.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef SAX_SAXParser_INCLUDED
#define SAX_SAXParser_INCLUDED
#include "Poco/XML/XML.h"
#include "Poco/SAX/XMLReader.h"
#include "Poco/XML/ParserEngine.h"
namespace Poco {
namespace XML {
class XML_API SAXParser: public XMLReader
/// This class provides a SAX2 (Simple API for XML) interface to expat,
/// the XML parser toolkit.
/// The following SAX2 features and properties are supported:
/// * http://xml.org/sax/features/external-general-entities
/// * http://xml.org/sax/features/external-parameter-entities
/// * http://xml.org/sax/features/namespaces
/// * http://xml.org/sax/features/namespace-prefixes
/// * http://xml.org/sax/properties/lexical-handler
/// * http://xml.org/sax/properties/declaration-handler
///
/// The following proprietary extensions are supported:
/// * http://www.appinf.com/features/enable-partial-reads --
/// see ParserEngine::setEnablePartialReads()
{
public:
SAXParser();
/// Creates an SAXParser.
SAXParser(const XMLString& encoding);
/// Creates an SAXParser with the given encoding.
~SAXParser();
/// Destroys the SAXParser.
void setEncoding(const XMLString& encoding);
/// Sets the encoding used by the parser if no
/// encoding is specified in the XML document.
const XMLString& getEncoding() const;
/// Returns the name of the encoding used by
/// the parser if no encoding is specified in
/// the XML document.
void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding);
/// Adds an encoding to the parser. Does not take ownership of the pointer!
/// XMLReader
void setEntityResolver(EntityResolver* pResolver);
EntityResolver* getEntityResolver() const;
void setDTDHandler(DTDHandler* pDTDHandler);
DTDHandler* getDTDHandler() const;
void setContentHandler(ContentHandler* pContentHandler);
ContentHandler* getContentHandler() const;
void setErrorHandler(ErrorHandler* pErrorHandler);
ErrorHandler* getErrorHandler() const;
void setFeature(const XMLString& featureId, bool state);
bool getFeature(const XMLString& featureId) const;
void setProperty(const XMLString& propertyId, const XMLString& value);
void setProperty(const XMLString& propertyId, void* value);
void* getProperty(const XMLString& propertyId) const;
void parse(InputSource* pSource);
void parse(const XMLString& systemId);
void parseMemoryNP(const char* xml, std::size_t size);
/// Extensions
void parseString(const std::string& xml);
static const XMLString FEATURE_PARTIAL_READS;
protected:
void setupParse();
private:
ParserEngine _engine;
bool _namespaces;
bool _namespacePrefixes;
};
} } // namespace Poco::XML
#endif // SAX_SAXParser_INCLUDED
|
/***************************************************************************
File : LineNumberDisplay.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2008 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : A widget displaying line numbers for a QTextEdit
***************************************************************************/
/***************************************************************************
* *
* 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 LineNumberDisplay_H
#define LineNumberDisplay_H
#include <QTextEdit>
//! A QTextEdit displaying line numbers.
/**
* It must be used in connection with another "source" QTextEdit.
*/
class LineNumberDisplay : public QTextEdit {
Q_OBJECT
public:
//! Constructor
/**
* \param te the "source" QTextEdit for which we want to display the line
* numbers
* \param parent parent widget (only affects placement of the dialog)
*/
LineNumberDisplay(QTextEdit *te, QWidget *parent = nullptr);
public slots:
void updateLineNumbers(bool force = false);
void updateDocumentSelection();
private slots:
void changeCharFormat(const QTextCharFormat &);
private:
void showEvent(QShowEvent *) override;
QTextEdit *d_text_edit;
};
#endif
|
/*
Copyright 2005-2010 Jakub Kruszona-Zawadzki, Gemius SA, 2013-2014 EditShare, 2013-2015 Skytechnology sp. z o.o..
This file was part of MooseFS and is part of LizardFS.
LizardFS 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 3.
LizardFS 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 LizardFS If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/platform.h"
#include <stdio.h>
#include "chunkserver/chartsdata.h"
#include "chunkserver/hddspacemgr.h"
#include "chunkserver/masterconn.h"
#include "chunkserver/network_main_thread.h"
#include "common/random.h"
#define STR_AUX(x) #x
#define STR(x) STR_AUX(x)
/* Run Tab */
typedef int (*runfn)(void);
struct run_tab {
runfn fn;
const char *name;
};
run_tab RunTab[]={
{rnd_init,"random generator"},
{hdd_init,"hdd space manager"},
{mainNetworkThreadInit,"main server module"}, /* it has to be before "masterconn" */
{masterconn_init,"master connection module"},
{chartsdata_init,"charts module"},
{(runfn)0,"****"}
},LateRunTab[]={
{masterconn_init_threads,"master connection module - threads"},
{hdd_late_init,"hdd space manager - threads"},
{mainNetworkThreadInitThreads,"main server module - threads"},
{(runfn)0,"****"}
},EarlyRunTab[]={
{(runfn)0,"****"}
};
|
#ifndef EDGE_H
#define EDGE_H
//============================================================================
// Name : EdgeSimple.h
// Author : Tae-Hyuk (Ted) Ahn, JJ Crosskey, Abhishek Biswas
// Version : v1.2
// Copyright : 2015 Oak Ridge National Lab (ORNL). All rights reserved.
// Description : EdgeSimple header file
//============================================================================
#include "Config.h"
#include "Utils.h"
extern TLogLevel loglevel; /* verbosity level of logging */
typedef vector<pair<UINT32, UINT32> > t_vpair;
class EdgeSimple{
private:
/* ==================== DATA MEMBERS ======================================= */
UINT64 m_source;
UINT64 m_sourceLen;
UINT64 m_destination;
UINT64 m_destinationLen;
EdgeSimple *m_reverseEdge;
// Packed list of ordered reads in the current edge. NOT including u and v.
// First 32LSB ReadID
// First MSB orientation
/* Orientations of the ordered reads in the current edge.
* orientation is 0 or 1.
* 0 means read's reverse complement read.getStringReverse().
* 1 means read's forward string.
*/
/* Middle 31MSB overlap offsets of the ordered reads in the current edge.
* The offset of the destination read is calculated as
* m_overlapOffset - sum(getOverlapOffset(i)) or it can retrieved from the reverse edge
*/
UINT64 *m_listOfReads;
UINT32 m_listSize; // Size of m_listOfReads
/* overlap offset in the following example is 6
* 012345678901234567890123456789
* u ACTTACGGGATTATACCATCGAGA
* v GGGATTATACCATCGAGATTCAAT
*/
UINT32 m_overlapOffset;
/* 0 = u<-----------<v reverse of u to reverse of v
* 1 = u<----------->v reverse of u to forward of v
* 2 = u>-----------<v forward of u to reverse of v
* 3 = u>----------->v forward of u to forward of v
*/
UINT8 m_orient;
/* flag of edge that has these bits:
* 0x1: not dead end
* 0x2: loop
*/
INT8 m_flag;
/* flag of edge that has these bits:
* 0x0: valid edge
* 0x1: invalidated edge; to be deleted
*/
bool m_invalid;
/* ==================== METHODS ======================================= */
friend EdgeSimple* merge_forward_edges(const EdgeSimple & edge1, const EdgeSimple & edge2);
void copyEdge(const EdgeSimple &edge);
void clearEdge();
public:
/* ==================== LIFECYCLE ======================================= */
// Default constructor.
EdgeSimple(void);
// constructor for a non-empty edge
EdgeSimple(UINT64 source, UINT64 sourceLen, UINT64 destination, UINT64 destLen, UINT8 orient, UINT32 overlapOffset);
EdgeSimple(UINT64 source, UINT64 sourceLen, UINT64 destination, UINT64 destLen, UINT8 orient, UINT32 overlapOffset,
UINT64 *listOfReads, UINT32 listSize);
EdgeSimple(const EdgeSimple &edge);
// Destructor.
~EdgeSimple();
/* ==================== OPERATORS ======================================= */
EdgeSimple& operator=(const EdgeSimple &edge);
friend bool operator== (const EdgeSimple &subject, const EdgeSimple &query);
friend EdgeSimple* Add( const EdgeSimple *edge1, const EdgeSimple *edge2);
/* ==================== MUTATORS ======================================= */
// Set the pointer to the reverse edge, only if reverse edge is nullptr
void setReverseEdge(EdgeSimple * edge);
void markNotDeadEnd() {m_flag |= 1; m_reverseEdge->m_flag |= 1;}
void markLoop() {m_flag |= (1 << 1);}
void loadReadString(const std::string read_str, int index);
void make_nonComposite_reverseEdge();
void setInvalid() {m_invalid=true;}
/* ==================== ACCESSORS ======================================= */
// Get the read object of the source node.
UINT64 getSourceRead() const {return m_source;}
// Check if an edge is marked as not dead end
bool isNotDeadEnd() const { return (m_flag & 1);}
// Check if an edge is a loop
bool isLoop() const {return (m_flag >> 1) & 1;}
// Get the read object of the destination node.
UINT64 getDestinationRead() const {return m_destination; }
// Return the orientation of the edge.
UINT8 getOrientation() const {return m_orient;}
// Return the overlap offset.
UINT32 getOverlapOffset() const {return m_overlapOffset;}
UINT64 getInnerReadInfo(int indx) const
{
return m_listOfReads[indx];
}
UINT64 getInnerReadID(int indx) const
{
return (m_listOfReads[indx] & 0X00000000FFFFFFFF);
}
UINT32 getInnerOverlapOffset(int indx) const
{
return ((m_listOfReads[indx] >> 32) & 0X000000007FFFFFFF);
}
UINT8 getInnerOrientation(int indx) const
{
return (m_listOfReads[indx] >> 63);
}
bool isListofReads() const { return !(m_listOfReads==nullptr);}
size_t getListofReadsSize() const { return m_listSize; }
UINT32 getInnerOverlapSum(size_t start, size_t end) const;
// Return the pointer to the reverse edge.
EdgeSimple * getReverseEdge() const {return m_reverseEdge;}
UINT32 getOverlapLen() const;
UINT32 getFirstOverlapOffset() const
{
if (!m_listOfReads || m_listSize==0)
return m_overlapOffset;
else
return (getInnerOverlapOffset(0));
}
UINT64 getEdgeLength() const {return m_overlapOffset + m_destinationLen;}
UINT32 getLastOverlapOffset() const;
bool isSmallerEdge() const
{
if(m_source < m_destination)
return true;
else if (m_source > m_destination)
return false;
else if(this < m_reverseEdge)
return true;
else
return false;
}
INT8 getFlag() const {return m_flag;}
bool isInvalid() {return m_invalid;}
};
bool is_mergeable(const EdgeSimple *edge1, const EdgeSimple *edge2);
UINT8 mergedEdgeOrientation(const UINT8 &orient1, const UINT8 &orient2);
UINT8 get_twin_orient(const UINT8 &orient);
void mergeList(const EdgeSimple *edge1, const EdgeSimple *edge2,
UINT64 **listReads, UINT64 &lSize);
EdgeSimple * mergeEdges(const vector<EdgeSimple *> & list_edges);
template <typename T>
float get_mean(const vector<T> &numbers);
template <typename T>
float get_sd(const vector<T> &numbers);
#endif /* EDGE_H */
|
/*****************************************************************************
ATENTION
DO NOT EDIT THIS FILE.
THIS FILE IS AUTOMATIC GENERATED BY MARIAMOLE
ALL CHANGES IN THIS FILE WILL BE LOST
*****************************************************************************/
//---------------------------------------------------------------------------
#ifndef _MARIAMOLE_AUTOMATIC_CODE_H
#define _MARIAMOLE_AUTOMATIC_CODE_H
//---------------------------------------------------------------------------
#include <Arduino.h>
/*--MARIMOLE-DEF_BEGIN--*/
/*--MARIMOLE-DEF_END--*/
#endif
|
/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
* See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
#include <signal.h>
#ifdef UA_NO_AMALGAMATION
#include "ua_types.h"
#include "ua_server.h"
#include "ua_config_standard.h"
#include "ua_network_tcp.h"
#else
#include "open62541.h"
#endif
UA_Boolean running = true;
static void stopHandler(int sig) {
running = false;
}
int main(void) {
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);
UA_ServerConfig config = UA_ServerConfig_standard;
UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664);
config.networkLayers = &nl;
config.networkLayersSize = 1;
UA_Server *server = UA_Server_new(config);
/* Create a rudimentary objectType
*
* BaseObjectType
* |
* +- (OT) MamalType
* + (V) Age
* + (OT) DogType
* |
* + (V) Name
*/
UA_StatusCode retval;
UA_ObjectTypeAttributes otAttr;
UA_ObjectTypeAttributes_init(&otAttr);
otAttr.description = UA_LOCALIZEDTEXT("en_US", "A mamal");
otAttr.displayName = UA_LOCALIZEDTEXT("en_US", "MamalType");
UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(1, 10000),
UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE), UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
UA_QUALIFIEDNAME(1, "MamalType"), otAttr, NULL, NULL);
UA_VariableAttributes vAttr;
UA_VariableAttributes_init(&vAttr);
vAttr.description = UA_LOCALIZEDTEXT("en_US", "This mamals Age in months");
vAttr.displayName = UA_LOCALIZEDTEXT("en_US", "Age");
UA_UInt32 ageVar = 0;
UA_Variant_setScalarCopy(&vAttr.value, &ageVar, &UA_TYPES[UA_TYPES_UINT32]);
UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(1, 10001),
UA_NODEID_NUMERIC(1, 10000), UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
UA_QUALIFIEDNAME(1, "Age"), UA_NODEID_NULL, vAttr, NULL, NULL);
UA_ObjectTypeAttributes_init(&otAttr);
otAttr.description = UA_LOCALIZEDTEXT("en_US", "A dog, subtype of mamal");
otAttr.displayName = UA_LOCALIZEDTEXT("en_US", "DogType");
UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(1, 10002),
UA_NODEID_NUMERIC(1, 10000), UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
UA_QUALIFIEDNAME(1, "DogType"), otAttr, NULL, NULL);
UA_VariableAttributes_init(&vAttr);
vAttr.description = UA_LOCALIZEDTEXT("en_US", "This mamals Age in months");
vAttr.displayName = UA_LOCALIZEDTEXT("en_US", "Name");
UA_String defaultName = UA_STRING("unnamed dog");
UA_Variant_setScalarCopy(&vAttr.value, &defaultName, &UA_TYPES[UA_TYPES_STRING]);
UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(1, 10003),
UA_NODEID_NUMERIC(1, 10002), UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
UA_QUALIFIEDNAME(1, "Name"), UA_NODEID_NULL, vAttr, NULL, NULL);
/* Instatiate a dog named bello:
* (O) Objects
* + O Bello <DogType>
* + Age
* + Name
*/
UA_ObjectAttributes oAttr;
UA_ObjectAttributes_init(&oAttr);
oAttr.description = UA_LOCALIZEDTEXT("en_US", "A dog named Bello");
oAttr.displayName = UA_LOCALIZEDTEXT("en_US", "Bello");
UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 0),
UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
UA_QUALIFIEDNAME(1, "Bello"), UA_NODEID_NUMERIC(1, 10002), oAttr, NULL, NULL);
retval = UA_Server_run(server, &running);
UA_Server_delete(server);
nl.deleteMembers(&nl);
return (int)retval;
}
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwpd
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwpd.sourceforge.net
*/
/* "This product is not manufactured, approved, or supported by
* Corel Corporation or Corel Corporation Limited."
*/
#ifndef WP6UNDOGROUP_H
#define WP6UNDOGROUP_H
#include "WP6FixedLengthGroup.h"
class WP6UndoGroup : public WP6FixedLengthGroup
{
public:
WP6UndoGroup(WPXInputStream *input, WPXEncryption *encryption, uint8_t groupID);
void parse(WP6Listener *listener);
protected:
void _readContents(WPXInputStream *input, WPXEncryption *encryption);
private:
uint8_t m_undoType;
uint16_t m_undoLevel;
};
#endif /* WP6UNDOGROUP_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the PKIX-C library.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s):
* Sun Microsystems, Inc.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* test_basicconstraintschecker.c
*
* Test Basic Constraints Checking
*
*/
#include "testutil.h"
#include "testutil_nss.h"
#define PKIX_TEST_MAX_CERTS 10
static void *plContext = NULL;
static
void printUsage1(char *pName){
printf("\nUSAGE: %s test-name [ENE|EE] ", pName);
printf("cert [certs].\n");
}
static
void printUsageMax(PKIX_UInt32 numCerts){
printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n",
numCerts, PKIX_TEST_MAX_CERTS);
}
int test_basicconstraintschecker(int argc, char *argv[]){
PKIX_List *chain = NULL;
PKIX_ValidateParams *valParams = NULL;
PKIX_ValidateResult *valResult = NULL;
PKIX_UInt32 actualMinorVersion;
char *certNames[PKIX_TEST_MAX_CERTS];
PKIX_PL_Cert *certs[PKIX_TEST_MAX_CERTS];
PKIX_VerifyNode *verifyTree = NULL;
PKIX_PL_String *verifyString = NULL;
PKIX_UInt32 chainLength = 0;
PKIX_UInt32 i = 0;
PKIX_UInt32 j = 0;
PKIX_Boolean testValid = PKIX_FALSE;
char *dirName = NULL;
PKIX_TEST_STD_VARS();
if (argc < 4){
printUsage1(argv[0]);
return (0);
}
startTests("BasicConstraintsChecker");
PKIX_TEST_EXPECT_NO_ERROR(
PKIX_PL_NssContext_Create(0, PKIX_FALSE, NULL, &plContext));
/* ENE = expect no error; EE = expect error */
if (PORT_Strcmp(argv[2+j], "ENE") == 0) {
testValid = PKIX_TRUE;
} else if (PORT_Strcmp(argv[2+j], "EE") == 0) {
testValid = PKIX_FALSE;
} else {
printUsage1(argv[0]);
return (0);
}
dirName = argv[3+j];
chainLength = (argc - j) - 4;
if (chainLength > PKIX_TEST_MAX_CERTS) {
printUsageMax(chainLength);
}
for (i = 0; i < chainLength; i++) {
certNames[i] = argv[(4+j)+i];
certs[i] = NULL;
}
subTest(argv[1+j]);
subTest("Basic-Constraints - Create Cert Chain");
chain = createCertChainPlus
(dirName, certNames, certs, chainLength, plContext);
/*
* Error occurs when creating Cert, this is critical and test
* should not continue. Since we expect error, we assume this
* error is the one that is expected, so undo the error count.
*
* This work needs future enhancement. We will introduce another
* flag ESE, in addition to the existing EE(expect validation
* error) and ENE(expect no validation error). ESE stands for
* "expect setup error". When running with ESE, if any of the setup
* calls such creating Cert Chain fails, the test can end and
* considered to be successful.
*/
if (testValid == PKIX_FALSE && chain == NULL) {
testErrorUndo("Cert Error - Create failed");
goto cleanup;
}
subTest("Basic-Constraints - Create Params");
valParams = createValidateParams
(dirName,
argv[4+j],
NULL,
NULL,
NULL,
PKIX_FALSE,
PKIX_FALSE,
PKIX_FALSE,
PKIX_FALSE,
chain,
plContext);
subTest("Basic-Constraints - Validate Chain");
if (testValid == PKIX_TRUE) {
PKIX_TEST_EXPECT_NO_ERROR(PKIX_ValidateChain
(valParams, &valResult, &verifyTree, plContext));
} else {
PKIX_TEST_EXPECT_ERROR(PKIX_ValidateChain
(valParams, &valResult, &verifyTree, plContext));
}
cleanup:
PKIX_TEST_DECREF_AC(verifyString);
PKIX_TEST_DECREF_AC(verifyTree);
PKIX_TEST_DECREF_AC(chain);
PKIX_TEST_DECREF_AC(valParams);
PKIX_TEST_DECREF_AC(valResult);
PKIX_Shutdown(plContext);
PKIX_TEST_RETURN();
endTests("BasicConstraintsChecker");
return (0);
}
|
/**
** TALLOC.C
**
** lean_and_mean malloc()/free implementation
** by tom ehlert, te@drivesnapshot.de
**
** please be careful:
**
** this is only slightly tested and has NO ERRORCHECCKING AT ALL
** no internal checking. no stack checking. nothing !!
**
** use it only, if your programs are already debugged !!
**/
#include <stddef.h>
#include <string.h>
#ifdef __TURBOC__
extern void *__brklvl;
#define sbrk(x) __brklvl
#define brk(newbrk) \
(((char *)(newbrk) > (char *)(&length) - 0x200) ? \
-1 : \
(__brklvl = (newbrk), 0))
#endif
#ifdef __WATCOMC__
#include <stdlib.h>
#define brk(newbrk) ((int)__brk((unsigned)(newbrk)))
#endif
#ifdef __GNUC__
#include <unistd.h>
#endif
#define BUSY (sizeof(size_t)-1) /* Bit set if memory block in use*/
#define isbusy(x) ((x->length)&BUSY)
/**
*** _memavl()
*** return max. memory available
*** Q & D
**/
#ifdef DEBUG
extern int printf(const char *x, ...);
#define dbprintf(x) printf x
#else
#define dbprintf(x)
#endif
/*#define printf getch() != ' ' ? exit(0) : printf*/
typedef union {
size_t length;
char data[1];
} block;
void *malloc(size_t length)
{
static block *alloc_bottom = NULL;
block *akt, *next;
block *ltop = sbrk(0);
if (alloc_bottom == NULL)
alloc_bottom = ltop;
length = (length + sizeof(size_t) + BUSY) & ~BUSY;
akt = alloc_bottom;
for (;;) {
if (akt == ltop) {
/* end of initialized memory */
next = (block *)&akt->data[length];
if (next < akt || brk(next) == -1)
return NULL;
break;
}
dbprintf(("follow [%x] = %x\n",akt, akt->length));
next = (block *)(&akt->data[akt->length & ~BUSY]);
if (next == ltop || isbusy(akt)) {
akt = next; /* next block */
} else if (isbusy(next)) {
size_t size = akt->length;
if (size >= length) { /* try to split */
if (size > length) { /* split */
((block *)&akt->data[length])->length =
size - length;
}
break;
}
akt = next; /* next block */
} else {
/* merge 2 blocks */
akt->length += next->length;
}
}
akt->length = length | BUSY;
dbprintf(("set [%x] = %x\n",akt,akt->length));
return &akt->data[sizeof(size_t)];
}
#ifdef __WATCOMC__
void *_nmalloc(unsigned length)
{
return malloc(length);
}
#endif
/**
** reset busy-bit
**/
void free(void *ptr)
{
if (ptr)
((char *) ptr)[-sizeof(size_t)] &= ~BUSY;
}
#ifdef TALLOC_NEED_REALLOC
/* there isn't often need for realloc ;)
*/
void* realloc(void *ptr,size_t newlength)
{
size_t oldlength = ((size_t*)ptr)[-1] & ~BUSY;
void *newptr;
newptr = malloc(newlength);
if (newptr == NULL)
{
if (newlength <= oldlength)
return ptr;
}
else {
memcpy(newptr,ptr,oldlength);
}
free(ptr);
return newptr;
}
#endif
#ifdef TEST
#include <stdio.h>
int gallocated = 0;
void *testalloc(size_t length)
{
void *p;
printf("alloc %x bytes - ",length);
p = malloc(length);
if (p) gallocated += length,printf("at %x - sum=%x\n",p,gallocated);
else printf("failed\n");
return p;
}
void testfree(void* p)
{
gallocated -= ((size_t*)p)[-1] & ~BUSY;
printf("free %x \n",p);
free(p);
}
main()
{
char *s1,*s2,*s3,*s4,*s5,*s6;
unsigned size;
s1 = testalloc(1);
s2 = testalloc(2);
s3 = testalloc(0x10);
s4 = testalloc(0x100);
s5 = testalloc(0x1000);
s6 = testalloc(0xfff0);
testfree(s3);
s3 = testalloc(6);
testfree(s2);
testalloc(8);
#ifdef __GNUC__
for(size = 0xe0000000; size;)
#else
for(size = 0xe000; size;)
#endif
{
if (testalloc(size))
;
else
size >>= 1;
}
testfree(s1);
testfree(s5);
testfree(s4);
testfree(s6);
return 1;
}
#endif
|
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACLELEMENTCONVERT_H
#define ACLELEMENTCONVERT_H
#include "../Operators/aclOperatorUnary.h"
namespace acl
{
///realizes \p convert_ functionality
/**
\ingroup SpecialPurposeFunctions
The element generates code corresponding to convert function with
an apropriate vector index.
The \p strong parameter defines the form of the operator:
convert_ in case of \p true or (type) in case of false
*/
class ElementConvert: public OperatorUnary
{
private:
bool strongForm;
public:
ElementConvert(Element a, TypeID type, bool strong=true);
virtual string str(const KernelConfiguration & kernelConfig) const;
};
} // namespace acl
#endif // ACLELEMENTCONVERT_H
|
//
// NCPriceManager.h
// Neocom
//
// Created by Артем Шиманский on 03.03.14.
// Copyright (c) 2014 Artem Shimanski. All rights reserved.
//
#import <Foundation/Foundation.h>
#define NCPriceManagerDidUpdateNotification @"NCPriceManagerDidUpdateNotification"
@interface NCPriceManager : NSObject
+ (instancetype) sharedManager;
- (void) requestPriceWithType:(NSInteger) typeID completionBlock:(void(^)(NSNumber* price)) completionBlock;
- (void) requestPricesWithTypes:(NSArray*) typeIDs completionBlock:(void(^)(NSDictionary* prices)) completionBlock;
- (void) updateIfNeeded;
@end
|
//===-- Sparc.h - Top-level interface for Sparc representation --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the entry points for global functions defined in the LLVM
// Sparc back-end.
//
//===----------------------------------------------------------------------===//
#ifndef TARGET_SPARC_H
#define TARGET_SPARC_H
#include "MCTargetDesc/SparcMCTargetDesc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetMachine.h"
namespace llvm {
class FunctionPass;
class SparcTargetMachine;
class formatted_raw_ostream;
FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
} // end namespace llvm;
namespace llvm {
// Enums corresponding to Sparc condition codes, both icc's and fcc's. These
// values must be kept in sync with the ones in the .td file.
namespace SPCC {
enum CondCodes {
//ICC_A = 8 , // Always
//ICC_N = 0 , // Never
ICC_NE = 9 , // Not Equal
ICC_E = 1 , // Equal
ICC_G = 10 , // Greater
ICC_LE = 2 , // Less or Equal
ICC_GE = 11 , // Greater or Equal
ICC_L = 3 , // Less
ICC_GU = 12 , // Greater Unsigned
ICC_LEU = 4 , // Less or Equal Unsigned
ICC_CC = 13 , // Carry Clear/Great or Equal Unsigned
ICC_CS = 5 , // Carry Set/Less Unsigned
ICC_POS = 14 , // Positive
ICC_NEG = 6 , // Negative
ICC_VC = 15 , // Overflow Clear
ICC_VS = 7 , // Overflow Set
//FCC_A = 8+16, // Always
//FCC_N = 0+16, // Never
FCC_U = 7+16, // Unordered
FCC_G = 6+16, // Greater
FCC_UG = 5+16, // Unordered or Greater
FCC_L = 4+16, // Less
FCC_UL = 3+16, // Unordered or Less
FCC_LG = 2+16, // Less or Greater
FCC_NE = 1+16, // Not Equal
FCC_E = 9+16, // Equal
FCC_UE = 10+16, // Unordered or Equal
FCC_GE = 11+16, // Greater or Equal
FCC_UGE = 12+16, // Unordered or Greater or Equal
FCC_LE = 13+16, // Less or Equal
FCC_ULE = 14+16, // Unordered or Less or Equal
FCC_O = 15+16 // Ordered
};
}
inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
switch (CC) {
case SPCC::ICC_NE: return "ne";
case SPCC::ICC_E: return "e";
case SPCC::ICC_G: return "g";
case SPCC::ICC_LE: return "le";
case SPCC::ICC_GE: return "ge";
case SPCC::ICC_L: return "l";
case SPCC::ICC_GU: return "gu";
case SPCC::ICC_LEU: return "leu";
case SPCC::ICC_CC: return "cc";
case SPCC::ICC_CS: return "cs";
case SPCC::ICC_POS: return "pos";
case SPCC::ICC_NEG: return "neg";
case SPCC::ICC_VC: return "vc";
case SPCC::ICC_VS: return "vs";
case SPCC::FCC_U: return "u";
case SPCC::FCC_G: return "g";
case SPCC::FCC_UG: return "ug";
case SPCC::FCC_L: return "l";
case SPCC::FCC_UL: return "ul";
case SPCC::FCC_LG: return "lg";
case SPCC::FCC_NE: return "ne";
case SPCC::FCC_E: return "e";
case SPCC::FCC_UE: return "ue";
case SPCC::FCC_GE: return "ge";
case SPCC::FCC_UGE: return "uge";
case SPCC::FCC_LE: return "le";
case SPCC::FCC_ULE: return "ule";
case SPCC::FCC_O: return "o";
}
llvm_unreachable("Invalid cond code");
}
} // end namespace llvm
#endif
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CHATCLIENT_H
#define CHATCLIENT_H
#include <qbluetoothserviceinfo.h>
#include <qbluetoothsocket.h>
#include <QtCore/QObject>
#include <QtCore/QTime>
#include <QtCore/QTimer>
QTM_BEGIN_NAMESPACE
class QBluetoothSocket;
QTM_END_NAMESPACE
class QDataStream;
QTM_USE_NAMESPACE
//! [declaration]
class TennisClient : public QObject
{
Q_OBJECT
public:
explicit TennisClient(QObject *parent = 0);
~TennisClient();
void startClient(const QBluetoothServiceInfo &remoteService);
void stopClient();
public slots:
void moveRightPaddle(int y);
void error(QBluetoothSocket::SocketError);
signals:
void moveBall(int x, int y);
void score(int left, int right);
void moveLeftPaddle(int y);
void connected(const QString &name);
void disconnected();
void lag(int ms);
private slots:
void readSocket();
void connected();
void sendEcho();
void socketDisconnected();
private:
QBluetoothSocket *socket;
QDataStream *stream;
QBluetoothServiceInfo serviceInfo;
QTime *elapsed;
QTimer lagTimer;
int lagTimeout;
};
//! [declaration]
#endif // CHATCLIENT_H
|
/*
Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef SVGURIReference_h
#define SVGURIReference_h
#if ENABLE(SVG)
#include "SVGElement.h"
#include "XLinkNames.h"
namespace WebCore {
extern char SVGURIReferenceIdentifier[];
class MappedAttribute;
class SVGURIReference {
public:
SVGURIReference();
virtual ~SVGURIReference();
bool parseMappedAttribute(MappedAttribute*);
bool isKnownAttribute(const QualifiedName&);
static String getTarget(const String& url);
protected:
virtual void setHrefBaseValue(SVGAnimatedTypeValue<String>::DecoratedType type) = 0;
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGURIReference_h
|
/*
* src/nl-class-delete.c Delete Traffic Classes
*
* 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 version 2.1
* of the License.
*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#include <netlink/cli/utils.h>
#include <netlink/cli/class.h>
#include <netlink/cli/link.h>
#include <linux/netlink.h>
static int quiet = 0, default_yes = 0, deleted = 0, interactive = 0;
static struct nl_sock *sock;
static void print_usage(void)
{
printf(
"Usage: nl-class-delete [OPTION]... [class]\n"
"\n"
"OPTIONS\n"
" --interactive Run interactively.\n"
" --yes Set default answer to yes.\n"
" -q, --quiet Do not print informal notifications.\n"
" -h, --help Show this help text and exit.\n"
" -v, --version Show versioning information and exit.\n"
"\n"
" -d, --dev=DEV Device the class is attached to.\n"
" -p, --parent=ID Identifier of parent qdisc/class.\n"
" -i, --id=ID Identifier\n"
" -k, --kind=NAME Kind of class (e.g. pfifo_fast)\n"
"\n"
"EXAMPLE\n"
" # Delete all classes on eth0 attached to parent 1:\n"
" $ nl-class-delete --dev eth0 --parent 1:\n"
"\n"
);
exit(0);
}
static void delete_cb(struct nl_object *obj, void *arg)
{
struct rtnl_class *class = nl_object_priv(obj);
struct nl_dump_params params = {
.dp_type = NL_DUMP_LINE,
.dp_fd = stdout,
};
int err;
if (interactive && !nl_cli_confirm(obj, ¶ms, default_yes))
return;
if ((err = rtnl_class_delete(sock, class)) < 0)
nl_cli_fatal(err, "Unable to delete class: %s\n", nl_geterror(err));
if (!quiet) {
printf("Deleted ");
nl_object_dump(obj, ¶ms);
}
deleted++;
}
int main(int argc, char *argv[])
{
struct rtnl_class *class;
struct rtnl_tc *tc;
struct nl_cache *link_cache, *class_cache;
sock = nl_cli_alloc_socket();
nl_cli_connect(sock, NETLINK_ROUTE);
link_cache = nl_cli_link_alloc_cache(sock);
class = nl_cli_class_alloc();
tc = (struct rtnl_tc *) class;
for (;;) {
int c, optidx = 0;
enum {
ARG_YES = 257,
ARG_INTERACTIVE = 258,
};
static struct option long_opts[] = {
{ "interactive", 0, 0, ARG_INTERACTIVE },
{ "yes", 0, 0, ARG_YES },
{ "quiet", 0, 0, 'q' },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' },
{ "dev", 1, 0, 'd' },
{ "parent", 1, 0, 'p' },
{ "id", 1, 0, 'i' },
{ "kind", 1, 0, 'k' },
{ 0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "qhvd:p:i:k:", long_opts, &optidx);
if (c == -1)
break;
switch (c) {
case '?': nl_cli_fatal(EINVAL, "Invalid options");
case ARG_INTERACTIVE: interactive = 1; break;
case ARG_YES: default_yes = 1; break;
case 'q': quiet = 1; break;
case 'h': print_usage(); break;
case 'v': nl_cli_print_version(); break;
case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
case 'p': nl_cli_tc_parse_parent(tc, optarg); break;
case 'i': nl_cli_tc_parse_handle(tc, optarg, 0); break;
case 'k': nl_cli_tc_parse_kind(tc, optarg); break;
}
}
if (!rtnl_tc_get_ifindex(tc))
nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
class_cache = nl_cli_class_alloc_cache(sock, rtnl_tc_get_ifindex(tc));
nl_cache_foreach_filter(class_cache, OBJ_CAST(class), delete_cb, NULL);
if (!quiet)
printf("Deleted %d classs\n", deleted);
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLBACKENDMONITORINFO_H_
#define QMLBACKENDMONITORINFO_H_
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qmlbackendmonitorao_s60_p.h"
QTM_BEGIN_NAMESPACE
//linked list information structure
struct CMonitorTriggerInfo {
QGeoAreaMonitorS60* iParent;
TLbtTriggerId iTriggerID;
enum enTriggerType iType;
CMonitorTriggerInfo* next;
};
class CBackendMonitorInfo : public CBase
{
public :
static CBackendMonitorInfo *NewL();
//return CMonitorTriggerInfo from TriggerID
CMonitorTriggerInfo* getMonitorTriggerInfo(TLbtTriggerId aTrigID);
//return CMonitorTriggerInfo from the QGeoAreaMonitorS60
CMonitorTriggerInfo* getMonitorTriggerInfo(QGeoAreaMonitorS60* aParent, enTriggerType aType);
//return the header of the linked list
inline CMonitorTriggerInfo* getMonitorTriggerInfo() {
return iMonitorInfo;
}
//add the entry and exit trigger info to the list
bool addMonitorTriggerInfo(QGeoAreaMonitorS60* aParent, TLbtTriggerId aTriggerID, enTriggerType aType);
//remove the CMonitorTriggerInfo corresponding to the TriggerID
void removeMonitorTriggerInfo(TLbtTriggerId aTrigID);
~CBackendMonitorInfo();
private :
CBackendMonitorInfo() : iMonitorInfo(NULL) { }
CMonitorTriggerInfo* iMonitorInfo;
static CBackendMonitorInfo* iBackendMonitorInfo;
};
QTM_END_NAMESPACE
#endif /* QMLBACKENDMONITORINFO_H_ */
|
/*
Copyright (C) 2011 Sebastian Pancratz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include "flint.h"
#include "fmpq.h"
#include "fmpq_mat.h"
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("neg....");
fflush(stdout);
/* Aliasing */
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
fmpq_mat_t A, B;
slong m, n, bits;
m = n_randint(state, 10);
n = n_randint(state, 10);
bits = 1 + n_randint(state, 100);
fmpq_mat_init(A, m, n);
fmpq_mat_init(B, m, n);
fmpq_mat_randtest(B, state, bits);
fmpq_mat_neg(A, B);
fmpq_mat_neg(B, B);
result = fmpq_mat_equal(A, B);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("A:\n");
fmpq_mat_print(A);
flint_printf("B:\n");
fmpq_mat_print(B);
fflush(stdout);
flint_abort();
}
fmpq_mat_clear(A);
fmpq_mat_clear(B);
}
/* --A == A */
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
fmpq_mat_t A, B;
slong m, n, bits;
m = n_randint(state, 10);
n = n_randint(state, 10);
bits = 1 + n_randint(state, 100);
fmpq_mat_init(A, m, n);
fmpq_mat_init(B, m, n);
fmpq_mat_randtest(B, state, bits);
fmpq_mat_neg(A, B);
fmpq_mat_neg(A, A);
result = fmpq_mat_equal(A, B);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("A:\n");
fmpq_mat_print(A);
flint_printf("B:\n");
fmpq_mat_print(B);
fflush(stdout);
flint_abort();
}
fmpq_mat_clear(A);
fmpq_mat_clear(B);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return EXIT_SUCCESS;
}
|
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* SPDX-License-Identifier: LGPL-2.0+
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <libglnx.h>
#include <gio/gunixinputstream.h>
#include "otutil.h"
#include "ot-main.h"
#include "ot-remote-builtins.h"
/* XXX This belongs in libotutil. */
#include "ostree-chain-input-stream.h"
static gboolean opt_stdin;
static char **opt_keyrings;
/* ATTENTION:
* Please remember to update the bash-completion script (bash/ostree) and
* man page (man/ostree-remote.xml) when changing the option list.
*/
static GOptionEntry option_entries[] = {
{ "keyring", 'k', 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_keyrings, "Import keys from a keyring file (repeatable)", "FILE" },
{ "stdin", 0, 0, G_OPTION_ARG_NONE, &opt_stdin, "Import keys from standard input", NULL },
{ NULL }
};
static gboolean
open_source_stream (GInputStream **out_source_stream,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GInputStream) source_stream = NULL;
guint n_keyrings = 0;
gboolean ret = FALSE;
if (opt_keyrings != NULL)
n_keyrings = g_strv_length (opt_keyrings);
if (opt_stdin)
{
source_stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
}
else
{
g_autoptr(GPtrArray) streams = NULL;
guint ii;
streams = g_ptr_array_new_with_free_func (g_object_unref);
for (ii = 0; ii < n_keyrings; ii++)
{
g_autoptr(GFile) file = NULL;
GFileInputStream *input_stream = NULL;
file = g_file_new_for_path (opt_keyrings[ii]);
input_stream = g_file_read (file, cancellable, error);
if (input_stream == NULL)
goto out;
/* Takes ownership. */
g_ptr_array_add (streams, input_stream);
}
/* Chain together all the --keyring options as one long stream. */
source_stream = (GInputStream *) ostree_chain_input_stream_new (streams);
}
*out_source_stream = g_steal_pointer (&source_stream);
ret = TRUE;
out:
return ret;
}
gboolean
ot_remote_builtin_gpg_import (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
g_autoptr(GOptionContext) context = NULL;
g_autoptr(OstreeRepo) repo = NULL;
g_autoptr(GInputStream) source_stream = NULL;
const char *remote_name;
const char * const *key_ids;
guint imported = 0;
gboolean ret = FALSE;
context = g_option_context_new ("NAME [KEY-ID...]");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
goto out;
if (argc < 2)
{
ot_util_usage_error (context, "NAME must be specified", error);
goto out;
}
if (opt_stdin && opt_keyrings != NULL)
{
ot_util_usage_error (context, "--keyring and --stdin are mutually exclusive", error);
goto out;
}
remote_name = argv[1];
key_ids = (argc > 2) ? (const char * const *) argv + 2 : NULL;
if (!open_source_stream (&source_stream, cancellable, error))
goto out;
if (!ostree_repo_remote_gpg_import (repo, remote_name, source_stream,
key_ids, &imported, cancellable, error))
goto out;
/* XXX If we ever add internationalization, use ngettext() here. */
g_print ("Imported %u GPG key%s to remote \"%s\"\n",
imported, (imported == 1) ? "" : "s", remote_name);
ret = TRUE;
out:
return ret;
}
|
#ifndef __GSK_XML_VALUE_READER_H_
#define __GSK_XML_VALUE_READER_H_
/*
*
* GskXmlValueReader -- streaming GValue instantiation from XML.
*
*/
#include <glib-object.h>
#include "gskgtypeloader.h"
G_BEGIN_DECLS
typedef struct _GskXmlValueReader GskXmlValueReader;
/* Callback to asynchronously return a GValue. */
typedef void (*GskXmlValueFunc) (const GValue *value, gpointer user_data);
GskXmlValueReader *
gsk_xml_value_reader_new (GskGtypeLoader *type_loader,
GType output_type,
GskXmlValueFunc value_func,
gpointer value_func_data,
GDestroyNotify value_func_destroy);
void gsk_xml_value_reader_free (GskXmlValueReader *reader);
gboolean gsk_xml_value_reader_input (GskXmlValueReader *reader,
const char *input,
guint len,
GError **error);
void gsk_xml_value_reader_set_pos (GskXmlValueReader *reader,
const char *filename,
gint lineno,
gint charno);
gboolean gsk_xml_value_reader_had_error (GskXmlValueReader *reader);
/* Load an object from an XML file, for program configuration, etc. */
GObject * gsk_load_object_from_xml_file (const char *path,
GskGtypeLoader *type_loader,
GType object_type,
GError **error);
G_END_DECLS
#endif
|
/*
Copyright (C) 2014 Fredrik Johansson
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include <gmp.h>
#include "flint.h"
#include "ulong_extras.h"
#include "nmod_vec.h"
#include "nmod_poly.h"
void
nmod_poly_set_trunc(nmod_poly_t res, const nmod_poly_t poly, slong n)
{
if (poly == res)
{
nmod_poly_truncate(res, n);
}
else
{
slong rlen;
rlen = FLINT_MIN(n, poly->length);
while (rlen > 0 && poly->coeffs[rlen - 1] == 0)
rlen--;
nmod_poly_fit_length(res, rlen);
_nmod_vec_set(res->coeffs, poly->coeffs, rlen);
_nmod_poly_set_length(res, rlen);
}
}
|
/*
* xmlformat - registration of xml object formats
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef XMLFORMAT_COMMON_H
#define XMLFORMAT_COMMON_H
// Categories
#define XMLFORMAT_COMMON_CATEGORIES "Categories"
#define XMLFORMAT_COMMON_CATEGORIES_CATEGORY "Category"
// Class
#define XMLFORMAT_COMMON_CLASS "Class"
#define XMLFORMAT_COMMON_CLASS_CONTENT "Content"
#define XMLFORMAT_COMMON_CLASS_CONTENT_PUBLIC "PUBLIC"
#define XMLFORMAT_COMMON_CLASS_CONTENT_PRIVATE "PRIVATE"
#define XMLFORMAT_COMMON_CLASS_CONTENT_CONFIDENTIAL "CONFIDENTIAL"
#define XMLFORMAT_COMMON_CLASS_CONTENT_DEFAULT XMLFORMAT_COMMON_CONTENT_PUBLIC
// DateValueType
#define XMLFORMAT_COMMON_DATEVALUETYPE "DateValueType"
#define XMLFORMAT_COMMON_DATEVALUETYPE_DATE "DATE"
#define XMLFORMAT_COMMON_DATEVALUETYPE_DATETIME "DATE-TIME"
// DateTimeContent
#define XMLFORMAT_COMMON_DATETIMECONTENT "DateTimeContent"
#define XMLFORMAT_COMMON_DATETIMECONTENT_CONTENT "Content" // Element
#define XMLFORMAT_COMMON_DATETIMECONTENT_VALUE "Value" // Attribute
#define XMLFORMAT_COMMON_DATETIMECONTENT_TIMEZONEID "TimezoneID" // Attribute
// Multitext
#define XMLFORMAT_COMMON_MULTITEXT "MultiText"
#define XMLFORMAT_COMMON_MULTITEXT_CONTENT "Content"
#define XMLFORMAT_COMMON_MULTITEXT_ALTERNATIVETEXTREP "AlternativeTextRep"
#define XMLFORMAT_COMMON_MULTITEXT_LANGUAGE "Language"
// StringContent
#define XMLFORMAT_COMMON_STRINGCONTENT "StringContent"
#define XMLFORMAT_COMMON_STRINGCONTENT_CONTENT "Content"
#endif /* XMLFORMAT_COMMON_H */
|
/****************************************************************************
**
** Copyright (C) 2014 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 GRADIENTMODEL_H
#define GRADIENTMODEL_H
#include <qmlitemnode.h>
#include <QAbstractListModel>
#include <QColor>
#include <QtQml>
class GradientModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(QVariant anchorBackendProperty READ anchorBackend WRITE setAnchorBackend NOTIFY anchorBackendChanged)
Q_PROPERTY(QString gradientPropertyName READ gradientPropertyName WRITE setGradientPropertyName)
Q_PROPERTY(int count READ rowCount)
Q_PROPERTY(bool hasGradient READ hasGradient NOTIFY anchorBackendChanged)
public:
explicit GradientModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QHash<int, QByteArray> roleNames() const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
Q_INVOKABLE void addStop(qreal position, const QColor &color);
Q_INVOKABLE void addGradient();
Q_INVOKABLE void setColor(int index, const QColor &color);
Q_INVOKABLE void setPosition(int index, qreal positition);
Q_INVOKABLE QColor getColor(int index) const;
Q_INVOKABLE qreal getPosition(int index) const;
Q_INVOKABLE void removeStop(int index);
Q_INVOKABLE void deleteGradient();
static void registerDeclarativeType();
signals:
void anchorBackendChanged();
public slots:
private:
void setupModel();
void setAnchorBackend(const QVariant anchorBackend);
QVariant anchorBackend() const {return QVariant(); }
QString gradientPropertyName() const;
void setGradientPropertyName(const QString &name);
bool hasGradient() const;
private:
QmlDesigner::QmlItemNode m_itemNode;
QString m_gradientPropertyName;
bool m_lock;
};
QML_DECLARE_TYPE(GradientModel)
#endif // GRADIENTMODEL_H
|
/*BHEADER**********************************************************************
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
* Produced at the Lawrence Livermore National Laboratory.
* This file is part of HYPRE. See file COPYRIGHT for details.
*
* HYPRE 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) version 2.1 dated February 1999.
*
* $Revision$
***********************************************************************EHEADER*/
/*****************************************************************************
*
* This code implements a class for a dense block of a compressed sparse row
* matrix.
*
*****************************************************************************/
#ifndef hypre_BCSR_MATRIX_DENSE_BLOCK_HEADER
#define hypre_BCSR_MATRIX_DENSE_BLOCK_HEADER
typedef struct {
HYPRE_Real* data;
HYPRE_Int num_rows;
HYPRE_Int num_cols;
} hypre_BCSRMatrixDenseBlock;
/*****************************************************************************
*
* Prototypes
*
*****************************************************************************/
hypre_BCSRMatrixDenseBlock*
hypre_BCSRMatrixDenseBlockCreate(HYPRE_Int num_rows, HYPRE_Int num_cols);
HYPRE_Int
hypre_BCSRMatrixDenseBlockDestroy(hypre_BCSRMatrixDenseBlock* A);
HYPRE_Int
hypre_BCSRMatrixDenseBlockInitialise(hypre_BCSRMatrixDenseBlock* A);
HYPRE_Int
hypre_BCSRMatrixDenseBlockFillData(hypre_BCSRMatrixDenseBlock* A,
HYPRE_Real* data);
HYPRE_Int
hypre_BCSRMatrixDenseBlockGetData(hypre_BCSRMatrixDenseBlock* A,
HYPRE_Real* data);
hypre_BCSRMatrixDenseBlock*
hypre_BCSRMatrixDenseBlockCopy(hypre_BCSRMatrixDenseBlock* A);
HYPRE_Int
hypre_BCSRMatrixDenseBlockAdd(hypre_BCSRMatrixDenseBlock* A,
hypre_BCSRMatrixDenseBlock* B);
HYPRE_Int
hypre_BCSRMatrixDenseBlockMultiply(hypre_BCSRMatrixDenseBlock* A,
hypre_BCSRMatrixDenseBlock* B);
HYPRE_Int
hypre_BCSRMatrixDenseBlockNeg(hypre_BCSRMatrixDenseBlock* A);
hypre_BCSRMatrixDenseBlock*
hypre_BCSRMatrixDenseBlockDiag(hypre_BCSRMatrixDenseBlock* A);
HYPRE_Int
hypre_BCSRMatrixDenseBlockMulInv(hypre_BCSRMatrixDenseBlock* A,
hypre_BCSRMatrixDenseBlock* B);
HYPRE_Int
hypre_BCSRMatrixDenseBlockMultiplyInverse2(hypre_BCSRMatrixDenseBlock* A,
hypre_BCSRMatrixDenseBlock* B);
HYPRE_Int
hypre_BCSRMatrixDenseBlockTranspose(hypre_BCSRMatrixDenseBlock* A);
HYPRE_Int
hypre_BCSRMatrixBlockMatvec(HYPRE_Real alpha, hypre_BCSRMatrixDenseBlock* A,
HYPRE_Real* x_data, HYPRE_Real beta, HYPRE_Real* y_data);
HYPRE_Int
hypre_BCSRMatrixBlockMatvecT(HYPRE_Real alpha, hypre_BCSRMatrixDenseBlock* A,
HYPRE_Real* x_data, HYPRE_Real beta, HYPRE_Real* y_data);
HYPRE_Real
hypre_BCSRMatrixDenseBlockNorm(hypre_BCSRMatrixDenseBlock* A,
const char* norm);
HYPRE_Int
hypre_BCSRMatrixDenseBlockPrint(hypre_BCSRMatrixDenseBlock* A,
FILE* out_file);
#ifdef hypre_BCSR_MATRIX_USE_DENSE_BLOCKS
#define hypre_BCSRMatrixBlock hypre_BCSRMatrixDenseBlock
#define hypre_BCSRMatrixBlockCreate hypre_BCSRMatrixDenseBlockCreate
#define hypre_BCSRMatrixBlockDestroy hypre_BCSRMatrixDenseBlockDestroy
#define hypre_BCSRMatrixBlockInitialise hypre_BCSRMatrixDenseBlockInitialise
#define hypre_BCSRMatrixBlockFillData hypre_BCSRMatrixDenseBlockFillData
#define hypre_BCSRMatrixBlockGetData hypre_BCSRMatrixDenseBlockGetData
#define hypre_BCSRMatrixBlockCopy hypre_BCSRMatrixDenseBlockCopy
#define hypre_BCSRMatrixBlockAdd hypre_BCSRMatrixDenseBlockAdd
#define hypre_BCSRMatrixBlockMultiply hypre_BCSRMatrixDenseBlockMultiply
#define hypre_BCSRMatrixBlockNeg hypre_BCSRMatrixDenseBlockNeg
#define hypre_BCSRMatrixBlockDiag hypre_BCSRMatrixDenseBlockDiag
#define hypre_BCSRMatrixBlockMulInv hypre_BCSRMatrixDenseBlockMulInv
#define hypre_BCSRMatrixBlockMultiplyInverse2 hypre_BCSRMatrixDenseBlockMultiplyInverse2
#define hypre_BCSRMatrixBlockTranspose hypre_BCSRMatrixDenseBlockTranspose
#define hypre_BCSRMatrixBlockMatvec hypre_BCSRMatrixDenseBlockMatvec
#define hypre_BCSRMatrixBlockMatvecT hypre_BCSRMatrixDenseBlockMatvecT
#define hypre_BCSRMatrixBlockNorm hypre_BCSRMatrixDenseBlockNorm
#define hypre_BCSRMatrixBlockPrint hypre_BCSRMatrixDenseBlockPrint
#endif
#endif
|
/*
*********************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the autotests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
*********************************************************************
*/
/********************************************************************************
** Form generated from reading UI file 'qtgradientviewdialog.ui'
**
** Created: Fri Sep 4 10:17:14 2009
** by: Qt User Interface Compiler version 4.6.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTGRADIENTVIEWDIALOG_H
#define QTGRADIENTVIEWDIALOG_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QHeaderView>
#include <QtGui/QVBoxLayout>
#include "qtgradientview.h"
QT_BEGIN_NAMESPACE
class Ui_QtGradientViewDialog
{
public:
QVBoxLayout *vboxLayout;
QtGradientView *gradientView;
QDialogButtonBox *buttonBox;
void setupUi(QDialog *QtGradientViewDialog)
{
if (QtGradientViewDialog->objectName().isEmpty())
QtGradientViewDialog->setObjectName(QString::fromUtf8("QtGradientViewDialog"));
QtGradientViewDialog->resize(178, 72);
vboxLayout = new QVBoxLayout(QtGradientViewDialog);
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
gradientView = new QtGradientView(QtGradientViewDialog);
gradientView->setObjectName(QString::fromUtf8("gradientView"));
QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(gradientView->sizePolicy().hasHeightForWidth());
gradientView->setSizePolicy(sizePolicy);
vboxLayout->addWidget(gradientView);
buttonBox = new QDialogButtonBox(QtGradientViewDialog);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
vboxLayout->addWidget(buttonBox);
retranslateUi(QtGradientViewDialog);
QObject::connect(buttonBox, SIGNAL(accepted()), QtGradientViewDialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), QtGradientViewDialog, SLOT(reject()));
QMetaObject::connectSlotsByName(QtGradientViewDialog);
} // setupUi
void retranslateUi(QDialog *QtGradientViewDialog)
{
QtGradientViewDialog->setWindowTitle(QApplication::translate("QtGradientViewDialog", "Select Gradient", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class QtGradientViewDialog: public Ui_QtGradientViewDialog {};
} // namespace Ui
QT_END_NAMESPACE
#endif // QTGRADIENTVIEWDIALOG_H
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef LIBMESH_PARALLEL_HISTOGRAM_H
#define LIBMESH_PARALLEL_HISTOGRAM_H
// This class contains all the functionality for bin sorting
// Templated on the type of keys you will be sorting and the
// type of iterator you will be using.
// C++ includes
#include "libmesh/libmesh_common.h" // for libmesh_assert()
#include "libmesh/parallel_object.h"
// Local includes
#include <vector>
#include <iterator>
namespace libMesh
{
namespace Parallel
{
/**
* Defines a histogram to be used in parallel in conjunction with
* a \p BinSorter.
*
* \author Benjamin S. Kirk
* \author John W. Peterson
* \date 2007
* \brief Used in conjunction with a BinSorter for parallel sorting.
*/
template <typename KeyType, typename IdxType=unsigned int>
class Histogram : public ParallelObject
{
// The type of iterator we will be using is inferred from KeyType
typedef typename std::vector<KeyType>::const_iterator IterType;
public:
/**
* Constructor.
*/
explicit
Histogram (const Parallel::Communicator & comm,
const std::vector<KeyType> & d);
/**
* The actual function which sorts the data into
* nbins. Currently based on the global min and
* max which you must provide e.g. by using MPI.
*/
void make_histogram (const IdxType nbins,
KeyType max,
KeyType min);
/**
* Build the histogram across all processors and store the
* result in the input vector \p hist.
*/
void build_histogram ();
/**
* \returns The raw histogram data to the user.
*/
const std::vector<IdxType> & get_histogram() const;
/**
* The number of bins in the histogram.
*/
IdxType n_bins () const;
/**
* \returns The size of local bin \p bin.
*/
IdxType local_bin_size (const IdxType bin) const;
/**
* \returns The size of global bin \p bin.
*
* Requires that the user first call \p build_histogram().
*/
IdxType global_bin_size (const IdxType bin) const;
/**
* \returns The lower boundary of bin \p bin.
*/
double lower_bound (const IdxType bin) const;
/**
* \returns The upper boundary of bin \p bin.
*/
double upper_bound (const IdxType bin) const;
private:
const std::vector<KeyType> & data;
std::vector<IdxType> hist; // The actual histogram
std::vector<double> bin_bounds; // The boundary values of each bin
std::vector<IterType> bin_iters; // Iterators to the bin boundaries in data
};
template <typename KeyType, typename IdxType>
inline
const std::vector<IdxType> & Histogram<KeyType,IdxType>::get_histogram () const
{
return hist;
}
template <typename KeyType, typename IdxType>
inline
IdxType Histogram<KeyType,IdxType>::n_bins () const
{
if (bin_iters.empty())
return 0;
return cast_int<IdxType>(bin_iters.size()-1);
}
template <typename KeyType, typename IdxType>
inline
IdxType Histogram<KeyType,IdxType>::local_bin_size (const IdxType bin) const
{
libmesh_assert_less ((bin+1), bin_iters.size());
// The number of entries in the bin (locally)
return cast_int<IdxType>
(std::distance (bin_iters[bin], bin_iters[bin+1]));
}
template <typename KeyType, typename IdxType>
inline
IdxType Histogram<KeyType,IdxType>::global_bin_size (const IdxType bin) const
{
libmesh_assert_less (bin, hist.size());
// The number of entries in the bin (globally)
return hist[bin];
}
template <typename KeyType, typename IdxType>
inline
double Histogram<KeyType,IdxType>::lower_bound (const IdxType bin) const
{
libmesh_assert_less ((bin+1), bin_bounds.size());
return bin_bounds[bin];
}
template <typename KeyType, typename IdxType>
inline
double Histogram<KeyType,IdxType>::upper_bound (const IdxType bin) const
{
libmesh_assert_less ((bin+1), bin_bounds.size());
return bin_bounds[bin+1];
}
}
} // namespace libMesh
#endif // LIBMESH_PARALLEL_HISTOGRAM_H
|
/*
Copyright (C) 2012-2014 Fredrik Johansson
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "arb.h"
int main()
{
slong iter;
flint_rand_t state;
flint_printf("add_fmpz....");
fflush(stdout);
flint_randinit(state);
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
{
arb_t a, b, c, d;
fmpz_t x;
slong prec;
arb_init(a);
arb_init(b);
arb_init(c);
arb_init(d);
fmpz_init(x);
arb_randtest_special(a, state, 1 + n_randint(state, 2000), 100);
arb_randtest_special(b, state, 1 + n_randint(state, 2000), 100);
arb_randtest_special(c, state, 1 + n_randint(state, 2000), 100);
fmpz_randtest(x, state, 1 + n_randint(state, 2000));
prec = 2 + n_randint(state, 2000);
arb_set_fmpz(b, x);
arb_add_fmpz(c, a, x, prec);
arb_add(d, a, b, prec);
if (!arb_equal(c, d))
{
flint_printf("FAIL\n\n");
flint_printf("a = "); arb_print(a); flint_printf("\n\n");
flint_printf("b = "); arb_print(b); flint_printf("\n\n");
flint_printf("c = "); arb_print(c); flint_printf("\n\n");
flint_printf("d = "); arb_print(d); flint_printf("\n\n");
flint_abort();
}
arb_clear(a);
arb_clear(b);
arb_clear(c);
arb_clear(d);
fmpz_clear(x);
}
/* aliasing */
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
{
arb_t a, b, c;
fmpz_t x;
slong prec;
arb_init(a);
arb_init(b);
arb_init(c);
fmpz_init(x);
arb_randtest_special(a, state, 1 + n_randint(state, 2000), 100);
arb_randtest_special(b, state, 1 + n_randint(state, 2000), 100);
arb_randtest_special(c, state, 1 + n_randint(state, 2000), 100);
fmpz_randtest(x, state, 1 + n_randint(state, 2000));
prec = 2 + n_randint(state, 2000);
arb_set_fmpz(b, x);
arb_add_fmpz(c, a, x, prec);
arb_add_fmpz(a, a, x, prec);
if (!arb_equal(a, c))
{
flint_printf("FAIL (aliasing)\n\n");
flint_printf("a = "); arb_print(a); flint_printf("\n\n");
flint_printf("b = "); arb_print(b); flint_printf("\n\n");
flint_printf("c = "); arb_print(c); flint_printf("\n\n");
flint_abort();
}
arb_clear(a);
arb_clear(b);
arb_clear(c);
fmpz_clear(x);
}
flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return EXIT_SUCCESS;
}
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* GData Client
* Copyright (C) Philip Withnall 2008-2009 <philip@tecnocode.co.uk>
*
* GData Client 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.
*
* GData Client 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 GData Client. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#ifndef GDATA_TYPES_H
#define GDATA_TYPES_H
G_BEGIN_DECLS
/**
* GDataColor:
* @red: red color intensity, from 0–255
* @green: green color intensity, from 0–255
* @blue: blue color intensity, from 0–255
*
* Describes a color, such as used in the Google Calendar interface to
* differentiate calendars.
*/
typedef struct {
/*< public >*/
guint16 red;
guint16 green;
guint16 blue;
} GDataColor;
#define GDATA_TYPE_COLOR (gdata_color_get_type ())
GType gdata_color_get_type (void) G_GNUC_CONST;
gboolean gdata_color_from_hexadecimal (const gchar *hexadecimal, GDataColor *color);
gchar *gdata_color_to_hexadecimal (const GDataColor *color) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
G_END_DECLS
#endif /* !GDATA_TYPES_H */
|
/*
Copyright(C) 2015-2016 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif
mrb_value grn_mrb_options_get_static(mrb_state *mrb,
mrb_value mrb_options,
const char *key,
size_t key_size);
#define grn_mrb_options_get_lit(mrb, mrb_options, literal) \
grn_mrb_options_get_static(mrb, mrb_options, \
(literal), mrb_strlen_lit(literal))
#ifdef __cplusplus
}
#endif
|
/*
Copyright (C) 2013 Mike Hansen
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "fq_zech_poly.h"
#ifdef T
#undef T
#endif
#define T fq_zech
#define CAP_T FQ_ZECH
#include "fq_poly_templates/truncate.c"
#undef CAP_T
#undef T
|
/*
* Settings.h
*
* Created on: Jan 11, 2014
* Author: denia
*/
#include <map>
#include <libconfig.h++>
#ifndef SETTINGS_H_
#define SETTINGS_H_
namespace ydle {
class SettingsParser {
private:
libconfig::Config * g_configuration;
std::string config_file;
public:
SettingsParser();
int parseCommandLine(int argc, char **argv);
int parseConfigFile(std::string config_file);
int parseConfigFile();
int writeConfigFile();
int parseSettings();
bool configIsOk();
void showUsage();
void showConfig();
virtual ~SettingsParser();
std::map<std::string, std::string> getConfig();
};
} /* namespace ydle */
#endif /* SETTINGS_H_ */
|
/*
* --------------------------------------------------------------------------- *
* CAMPAIGN *
* --------------------------------------------------------------------------- *
* This is part of the CAMPAIGN data clustering library originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of Biological *
* Structures at Stanford, funded under the NIH Roadmap for Medical Research, *
* grant U54 GM072970 (See https://simtk.org), and the FEATURE Project at *
* Stanford, funded under the NIH grant LM05652 *
* (See http://feature.stanford.edu/index.php). *
* *
* Portions copyright (c) 2010 Stanford University, Authors, and Contributors. *
* Authors: Kai J. Kolhoff *
* Contributors: Marc Sosnick, William Hsu *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This 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 Lesser General Public *
* License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* --------------------------------------------------------------------------- *
*/
/* $Id: rmsdGPU.h 158 2011-01-12 23:06:27Z msosnick $ */
/**
* \file rmsdGPU.h
* \brief A CUDA implementation of Theobald's algorithm
*
* An implementation of Theobald's algorithm for the calculation of
* protein backbone C-alpha rmsds using quaternions for the GPU
*
* \author Author: Kai J. Kohlhoff, Contributors: Marc Sosnick, William Hsu
* \date 10/22/2009
* \version 1.0
*/
#ifndef HAVE_CONFIG_H
#include <iostream>
#include "../util/dataio.h"
#include "../util/timing.h"
#include "../util/gpudevices.h"
#include "../util/defaults.h"
#define FLOAT_TYPE float
#else
#include "../config.h"
#include "../campaign.h"
#endif
#define DIM 3
#define isCentered false
using namespace std;
/**
* \brief calculates center of mass of C-alphas and shifts all structures to origin
* each thread works on one coordinate of one conformation (3 * numConf threads)
*
* \param numAtoms number of atoms in each conformation (DIM coordinates each)
* \param numConf number of conformations in data set
* \param conf coordinates of atoms in all conformations
*/
__global__ static void centerAllConformations(int numAtoms, int numConf, FLOAT_TYPE *conf);
/**
* \brief get rmsd for a set of two structures
*/
__global__ static void getRMSD(int numConf, int numAtoms, int ctrConf, FLOAT_TYPE *conf, FLOAT_TYPE *rmsd);
/**
* \brief Runs RMSD on the GPU. Requires CUDA-enabled grapnics processor.
*
* \param numAtoms number of atoms in each conformation (DIM coordinates each)
* \param numConf number of conformations in data set
* \param conf coordinates of atoms in all conformations
*/
FLOAT_TYPE* rmsdGPU(int numConf, int numAtoms, FLOAT_TYPE *conf, DataIO *data);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.