text stringlengths 4 6.14k |
|---|
//
// shaders.h
// CppTest
//
// Created by Андрей Жаткин on 08.01.15.
// Copyright (c) 2015 Андрей Жаткин. All rights reserved.
//
#ifndef CppTest_shaders_h
#define CppTest_shaders_h
static const char vert_color_passthrough[] =
"#version 120 \n\
\n\
attribute vec3 position; \n\
attribute vec3 color; \n\
\n\
varying vec3 fragmentColor; \n\
\n\
void main(void) \n\
{ \n\
// перевод вершинных координат в однородные \n\
gl_Position = vec4(position, 1.0); \n\
// передаем цвет вершины в фрагментный шейдер \n\
fragmentColor = color; \n\
} \n\
";
static const char frag_color_passthrough[] =
"#version 120 \n\
\n\
varying vec3 fragmentColor; \n\
\n\
void main(void) \n\
{ \n\
// зададим цвет пикселя \n\
gl_FragColor = vec4(fragmentColor, 1.0); \n\
} \n\
";
#endif
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/*
Code for generell handling of priority Queues.
Implemention of queues from "Algoritms in C" by Robert Sedgewick.
Copyright Monty Program KB.
By monty.
*/
#ifndef _queues_h
#define _queues_h
#ifdef __cplusplus
extern "C" {
#endif
typedef struct st_queue {
byte **root;
void *first_cmp_arg;
uint elements;
uint max_elements;
uint offset_to_key; /* compare is done on element+offset */
int max_at_top; /* Set if queue_top gives max */
int (*compare)(void *, byte *,byte *);
} QUEUE;
#define queue_top(queue) ((queue)->root[1])
#define queue_element(queue,index) ((queue)->root[index+1])
#define queue_end(queue) ((queue)->root[(queue)->elements])
#define queue_replaced(queue) _downheap(queue,1)
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, int (*compare)(void *,byte *, byte *),
void *first_cmp_arg);
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, int (*compare)(void *,byte *, byte *),
void *first_cmp_arg);
void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element);
byte *queue_remove(QUEUE *queue,uint idx);
void _downheap(QUEUE *queue,uint idx);
#define is_queue_inited(queue) ((queue)->root != 0)
#ifdef __cplusplus
}
#endif
#endif
|
#ifndef TESTOUTPUTFF_H
#define TESTOUTPUTFF_H
#include "AutoTest.h"
class TestOutputFF : public QObject
{
Q_OBJECT
private slots:
void encode();
};
DECLARE_TEST(TestOutputFF)
#endif // TESTOUTPUTFF_H
|
/* horst - Highly Optimized Radio Scanning Tool
*
* Copyright (C) 2005-2016 Bruno Randolf (br1@einfach.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <err.h>
#include <uwifi/log.h>
#include "main.h"
#include "control.h"
#include "conf_options.h"
#define MAX_CMD 255
/* FIFO (named pipe) */
int ctlpipe = -1;
void control_init_pipe(void)
{
mkfifo(conf.control_pipe, 0666);
ctlpipe = open(conf.control_pipe, O_RDWR|O_NONBLOCK);
}
void control_send_command(const char* cmd)
{
int len = strlen(cmd);
char new[len + 2];
char* pos;
if (conf.control_pipe[0] == '\0') {
strncpy(conf.control_pipe, DEFAULT_CONTROL_PIPE, MAX_CONF_VALUE_STRLEN);
conf.control_pipe[MAX_CONF_VALUE_STRLEN] = '\0';
}
while (access(conf.control_pipe, F_OK) < 0) {
LOG_INF("Waiting for control pipe '%s'...", conf.control_pipe);
sleep(1);
}
ctlpipe = open(conf.control_pipe, O_WRONLY);
if (ctlpipe < 0)
err(1, "Could not open control socket '%s'", conf.control_pipe);
/* always terminate command with newline */
strncpy(new, cmd, len);
new[len] = '\n';
new[len+1] = '\0';
/* replace : with newline */
while ((pos = strchr(new, ';')) != NULL) {
*pos = '\n';
}
LOG_INF("Sending command: %s", new);
write(ctlpipe, new, len+1);
close(ctlpipe);
}
static void parse_command(char* in) {
char* cmd;
char* val;
cmd = strsep(&in, "=");
val = in;
//LOG_ERR("RECV CMD %s VAL %s", cmd, val);
/* commands without value */
if (strcmp(cmd, "pause") == 0) {
main_pause(1);
}
else if (strcmp(cmd, "resume") == 0) {
main_pause(0);
}
else if (strcmp(cmd, "reset") == 0) {
main_reset();
}
else {
/* handle the rest thru config options */
config_handle_option(0, cmd, val);
}
}
void control_receive_command(void)
{
char buf[MAX_CMD];
char *pos = buf;
char *end;
int len;
len = read(ctlpipe, buf, MAX_CMD);
if (len > 0) {
buf[len] = '\0';
/* we can receive multiple \n separated commands */
while ((end = strchr(pos, '\n')) != NULL) {
*end = '\0';
parse_command(pos);
pos = end + 1;
}
}
}
void control_finish(void)
{
if (ctlpipe == -1)
return;
close(ctlpipe);
unlink(conf.control_pipe);
ctlpipe = -1;
}
|
/****************************************************************************
* Frogg - an extensible audio clip player for Mac OS X 10.1 *
* *
* Frogg copyright (C) 2002 Ryan Myers. Email contact: osx@poweredbyg.nu *
* Ogg Vorbis copyright (C) 1994-2002 Xiphophorus. http://www.xiph.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but *
* is supplied 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. at 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. Or, *
* download it from the WWW at: http://www.gnu.org/licenses/gpl.html *
****************************************************************************/
/* $Id: CFileDataSource.h,v 1.1 2003/01/10 22:16:48 rmyers Exp $ */
#ifndef __CFILEDATASOURCE_H__
#define __CFILEDATASOURCE_H__
#include <Carbon/Carbon.h>
#include "CDataSource.h"
class CFileDataSource : public CDataSource
{
public:
CFileDataSource();
virtual ~CFileDataSource();
virtual bool initAndOpen(const FSRef *pRef);
virtual bool isFinite() const;
virtual UInt64 bytesTotal() const;
virtual UInt64 bytesRead() const;
virtual UInt64 bytesLeft() const;
virtual CFStringRef getInfoString() const;
virtual CFStringRef getShortName() const;
virtual bool seekTo(UInt64 iByteOffset);
virtual bool getBytes(UInt64 iByteCount, void *pvBuffer);
protected:
bool m_bInited;
SInt16 m_iForkRefNum;
CFStringRef m_sInfoString;
CFStringRef m_sShortName;
SInt64 m_iForkSize;
SInt64 m_iForkPos;
};
#endif
|
#ifndef _INCLUDES_H
#define _INCLUDES_H
/*
Unix SMB/CIFS implementation.
Machine customisation and include handling
Copyright (C) Andrew Tridgell 1994-1998
Copyright (C) 2002 by Martin Pool <mbp@samba.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 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../replace/replace.h"
#ifndef NO_DNI_CONFIG_H
#include "dni_config.h"
#endif
/* make sure we have included the correct config.h */
#ifndef NO_CONFIG_H /* for some tests */
#ifndef CONFIG_H_IS_FROM_SAMBA
#error "make sure you have removed all config.h files from standalone builds!"
#error "the included config.h isn't from samba!"
#endif
#endif /* NO_CONFIG_H */
#include "system/time.h"
#include "system/wait.h"
#include "system/locale.h"
/* only do the C++ reserved word check when we compile
to include --with-developer since too many systems
still have comflicts with their header files (e.g. IRIX 6.4) */
#if !defined(__cplusplus) && defined(DEVELOPER) && defined(__linux__)
#define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define protected #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define this #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define new #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define delete #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define friend #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#endif
/* Lists, trees, caching, database... */
#include <talloc.h>
#ifndef _PRINTF_ATTRIBUTE
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
#endif
#include "../lib/util/attr.h"
/* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
#include "../lib/util/debug.h"
#include "../lib/util/samba_util.h"
#include "libcli/util/error.h"
/* String routines */
#include "../lib/util/safe_string.h"
/* Thread functions. */
#include "../lib/util/smb_threads.h"
#include "../lib/util/smb_threads_internal.h"
/* samba_setXXid functions. */
#include "../lib/util/setid.h"
#endif /* _INCLUDES_H */
|
/***************************************************************************
qgscomposerscalebarwidget.h
---------------------------
begin : 11 June 2008
copyright : (C) 2008 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* 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 QGSCOMPOSERSCALEBARWIDGET_H
#define QGSCOMPOSERSCALEBARWIDGET_H
#include "ui_qgscomposerscalebarwidgetbase.h"
class QgsComposerScaleBar;
/** \ingroup MapComposer
* A widget to define the properties of a QgsComposerScaleBarItem.
*/
class QgsComposerScaleBarWidget: public QWidget, private Ui::QgsComposerScaleBarWidgetBase
{
Q_OBJECT
public:
QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar );
~QgsComposerScaleBarWidget();
public slots:
void on_mMapComboBox_activated( const QString& text );
void on_mHeightSpinBox_valueChanged( int i );
void on_mLineWidthSpinBox_valueChanged( double d );
void on_mSegmentSizeSpinBox_valueChanged( double d );
void on_mSegmentsLeftSpinBox_valueChanged( int i );
void on_mNumberOfSegmentsSpinBox_valueChanged( int i );
void on_mUnitLabelLineEdit_textChanged( const QString& text );
void on_mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
void on_mColorPushButton_clicked();
void on_mStrokeColorPushButton_clicked();
void on_mFontButton_clicked();
void on_mFontColorPushButton_clicked();
void on_mStyleComboBox_currentIndexChanged( const QString& text );
void on_mLabelBarSpaceSpinBox_valueChanged( double d );
void on_mBoxSizeSpinBox_valueChanged( double d );
void on_mAlignmentComboBox_currentIndexChanged( int index );
void on_mUnitsComboBox_currentIndexChanged( int index );
private slots:
void setGuiElements();
protected:
void showEvent( QShowEvent * event );
private:
QgsComposerScaleBar* mComposerScaleBar;
void refreshMapComboBox();
/**Enables/disables the signals of the input gui elements*/
void blockMemberSignals( bool enable );
void connectUpdateSignal();
void disconnectUpdateSignal();
};
#endif //QGSCOMPOSERSCALEBARWIDGET_H
|
/** ****************************************************************************
Huawei Technologies Sweden AB (C), 2001-2016
********************************************************************************
* @author Automatically generated by DAISY
* @version
* @date 2016-02-03 15:04:02
* @file
* @brief
* @copyright Huawei Technologies Sweden AB
*******************************************************************************/
#ifndef CPROC_HRPD_H
#define CPROC_HRPD_H
/*******************************************************************************
1. Other files included
*******************************************************************************/
#include "vos.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#pragma pack(4)
/*******************************************************************************
2. Macro definitions
*******************************************************************************/
/*******************************************************************************
3. Enumerations declarations
*******************************************************************************/
/** ****************************************************************************
* Name : CPROC_HRPD_WORKMODE_ENUM_UINT16
*
* Description :
*******************************************************************************/
enum CPROC_HRPD_WORKMODE_ENUM
{
CPROC_HRPD_WORKMODE_MASTER = 0x0000, /**< Work mode is master */
CPROC_HRPD_WORKMODE_SLAVE = 0x0001, /**< Work mode is slave */
CPROC_HRPD_WORKMODE_SLAVE_KEEP_TIMING = 0x0002, /**< Work mode is slave, request csdr to keep timing. Used during cell reselection
to other rat (C2L) */
CPROC_HRPD_WORKMODE_BUTT = 0x0003
};
typedef VOS_UINT16 CPROC_HRPD_WORKMODE_ENUM_UINT16;
/*******************************************************************************
4. Message Header declaration
*******************************************************************************/
/*******************************************************************************
5. Message declaration
*******************************************************************************/
/*******************************************************************************
6. STRUCT and UNION declaration
*******************************************************************************/
/** ****************************************************************************
* Name : CPROC_HRPD_CHANNEL_RECORD_STRU
*
* Description :
*******************************************************************************/
typedef struct
{
VOS_UINT16 usBandClass;
VOS_UINT16 usChannelNumber;
} CPROC_HRPD_CHANNEL_RECORD_STRU;
/*******************************************************************************
7. OTHER declarations
*******************************************************************************/
/*******************************************************************************
8. Global declaration
*******************************************************************************/
/*******************************************************************************
9. Function declarations
*******************************************************************************/
#if ((VOS_OS_VER == VOS_WIN32) || (VOS_OS_VER == VOS_NUCLEUS))
#pragma pack()
#else
#pragma pack(0)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif
|
/**
* \file CbmLink.h
* \author Andrey Lebedev <andrey.lebedev@gsi.de>
* \date 2013
*
* Base data class for storing MC information link.
**/
#ifndef CBMLINK_H_
#define CBMLINK_H_
#include "TObject.h"
#include <string>
using std::string;
class CbmLink : public TObject
{
public:
/**
* \brief Constructor.
*/
CbmLink();
/**
* \brief Standard constructor.
*/
CbmLink(Float_t weight, Int_t index, Int_t entry = -1, Int_t file = -1);
/**
* \brief Destructor.
*/
virtual ~CbmLink();
/* Modifiers */
Int_t GetFile() const { return fFile; }
Int_t GetEntry() const { return fEntry; }
Int_t GetIndex() const { return fIndex; }
Float_t GetWeight() const { return fWeight; }
/* Accessors */
void SetFile(Int_t file) { fFile = file; }
void SetEntry(Int_t entry) { fEntry = entry; }
void SetIndex(Int_t index) { fIndex = index; }
void SetWeight(Float_t weight) { fWeight = weight; }
void AddWeight(Float_t weight) { fWeight += weight; }
/**
* \brief Return string representation of the object.
* \return String representation of the object.
**/
virtual string ToString() const;
friend Bool_t operator==(const CbmLink& lhs, const CbmLink& rhs) {
return (lhs.GetFile() == rhs.GetFile() && lhs.GetEntry() == rhs.GetEntry() && lhs.GetIndex() == rhs.GetIndex());
}
private:
Int_t fFile; // File ID
Int_t fEntry; // Entry number
Int_t fIndex; // Index in array
Float_t fWeight; // Weight
ClassDef(CbmLink, 1)
};
#endif /* CBMLINK_H_ */
|
#include <gtk/gtk.h>
#include <pthread.h>
#include <unistd.h>
void
thread_invoke_operation(gint sock, gchar *operation, gchar *data, gint len)
{
write(sock, operation, 4);
if(len > 0) {
write(sock, &len, sizeof(gint));
write(sock, data, len);
}
}
void
thread_relay_message(gint sock, gchar *message)
{
thread_invoke_operation(sock, "MESG", message, strlen(message));
}
|
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "Modem.h"
class ModemKitAnalog : public ModemKit {
public:
ModemKitAnalog() : ModemKit(), audioResampler(nullptr), audioResampleRatio(0) {
};
msresamp_rrrf audioResampler;
double audioResampleRatio;
};
class ModemAnalog : public Modem {
public:
ModemAnalog();
std::string getType() override;
int checkSampleRate(long long sampleRate, int audioSampleRate) override;
ModemKit *buildKit(long long sampleRate, int audioSampleRate) override;
void disposeKit(ModemKit *kit) override;
virtual void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input);
virtual void buildAudioOutput(ModemKitAnalog *akit, AudioThreadInput *audioOut, bool autoGain);
virtual std::vector<float> *getDemodOutputData();
virtual std::vector<float> *getResampledOutputData();
protected:
size_t bufSize;
std::vector<float> demodOutputData;
std::vector<float> resampledOutputData;
float aOutputCeil;
float aOutputCeilMA;
float aOutputCeilMAA;
};
|
// Copyright (C) 1999-2000 Id Software, Inc.
//
//
// g_mem.c
//
#include "g_local.h"
//[CoOp]
//some SP maps require more memory. Bumped the memory size a little.
#define POOLSIZE (4 * 88400)
//#define POOLSIZE (256 * 1024) //racc - 32 x 8192
//[/CoOp]
static char memoryPool[POOLSIZE];
static int allocPoint;
void *G_Alloc( int size ) {
char *p;
if ( g_debugAlloc.integer ) {
G_Printf( "G_Alloc of %i bytes (%i left)\n", size, POOLSIZE - allocPoint - ( ( size + 31 ) & ~31 ) );
}
if ( allocPoint + size > POOLSIZE ) {
G_Error( "G_Alloc: failed on allocation of %i bytes\n", size ); // bk010103 - was %u, but is signed
return NULL;
}
p = &memoryPool[allocPoint];
allocPoint += ( size + 31 ) & ~31;
return p;
}
void G_InitMemory( void ) {
allocPoint = 0;
}
void Svcmd_GameMem_f( void ) {
G_Printf( "Game memory status: %i out of %i bytes allocated\n", allocPoint, POOLSIZE );
}
|
/*
MobileRobots Advanced Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009 MobileRobots Inc.
Copyright (C) 2010, 2011 Adept Technology, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; 800-639-9481
*/
#ifndef ARACTIONGOTOSTRAIGHT_H
#define ARACTIONGOTOSTRAIGHT_H
#include "ariaTypedefs.h"
#include "ariaUtil.h"
#include "ArAction.h"
/// This action goes to a given ArPose very naively
/**
This action naively drives straight towards a given ArPose. The
action stops the robot when it has travelled the distance that that
pose is away. It travels at 'speed' mm/sec.
You can give it a new goal pose with setGoal(), cancel its movement
with cancelGoal(), and see if it got there with haveAchievedGoal().
For arguments to the goals and encoder goals you can tell it to go
backwards by calling them with the backwards parameter true. If
you set the justDistance to true it will only really care about
having driven the distance, if false it'll try to get to the spot
you wanted within close distance.
This doesn't avoid obstacles or anything, you could add have an obstacle
avoidance ArAction at a higher priority to try to do this. (For
truly intelligent navigation, see the ARNL and SONARNL software libraries.)
**/
class ArActionGotoStraight : public ArAction
{
public:
AREXPORT ArActionGotoStraight(const char *name = "goto",
double speed = 400);
AREXPORT virtual ~ArActionGotoStraight();
/// Sees if the goal has been achieved
AREXPORT bool haveAchievedGoal(void);
/// Cancels the goal the robot has
AREXPORT void cancelGoal(void);
/// Sets a new goal and sets the action to go there
AREXPORT void setGoal(ArPose goal, bool backwards = false,
bool justDistance = true);
/// Sets the goal in a relative way
AREXPORT void setGoalRel(double dist, double deltaHeading,
bool backwards = false, bool justDistance = true);
/// Gets the goal the action has
ArPose getGoal(void) { return myGoal; }
/// Gets whether we're using the encoder goal or the normal goal
bool usingEncoderGoal(void) { return myUseEncoderGoal; }
/// Sets a new goal and sets the action to go there
AREXPORT void setEncoderGoal(ArPose encoderGoal, bool backwards = false,
bool justDistance = true);
/// Sets the goal in a relative way
AREXPORT void setEncoderGoalRel(double dist, double deltaHeading,
bool backwards = false,
bool justDistance = true);
/// Gets the goal the action has
ArPose getEncoderGoal(void) { return myEncoderGoal; }
/// Sets the speed the action will travel to the goal at (mm/sec)
void setSpeed(double speed) { mySpeed = speed; }
/// Gets the speed the action will travel to the goal at (mm/sec)
double getSpeed(void) { return mySpeed; }
/// Sets how close we have to get if we're not in just distance mode
void setCloseDist(double closeDist = 100) { myCloseDist = closeDist; }
/// Gets how close we have to get if we're not in just distance mode
double getCloseDist(void) { return myCloseDist; }
/// Sets whether we're backing up there or not (set in the setGoals)
bool getBacking(void) { return myBacking; }
AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired);
AREXPORT virtual ArActionDesired *getDesired(void) { return &myDesired; }
#ifndef SWIG
AREXPORT virtual const ArActionDesired *getDesired(void) const
{ return &myDesired; }
#endif
protected:
ArPose myGoal;
bool myUseEncoderGoal;
ArPose myEncoderGoal;
double mySpeed;
bool myBacking;
ArActionDesired myDesired;
bool myPrinting;
double myDist;
double myCloseDist;
bool myJustDist;
double myDistTravelled;
ArPose myLastPose;
enum State
{
STATE_NO_GOAL,
STATE_ACHIEVED_GOAL,
STATE_GOING_TO_GOAL
};
State myState;
};
#endif // ARACTIONGOTO
|
// stdafx.h : ±ê׼ϵͳ°üº¬ÎļþµÄ°üº¬Îļþ£¬
// »òÊǾ³£Ê¹Óõ«²»³£¸ü¸ÄµÄ
// ÌØ¶¨ÓÚÏîÄ¿µÄ°üº¬Îļþ
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // ´Ó Windows Í·ÎļþÖÐÅųý¼«ÉÙʹÓõÄÐÅÏ¢
// Windows Í·Îļþ:
#include <windows.h>
#include <Shellapi.h>
#include <windowsx.h>
// C ÔËÐÐʱͷÎļþ
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <string>
#include "MemoryModule.h"
#include "StringUnit.h"
// TODO: ÔÚ´Ë´¦ÒýÓóÌÐòÐèÒªµÄÆäËûÍ·Îļþ
//³£Óúê
#define PropertyMember(Type,name) private: Type _##name;\
public: void set##name(Type v){_##name=v;}\
Type get##name(){return (Type)_##name;}
#define PropertyMemberRef(Type,name) private: Type _##name;\
public: void set##name(Type v){_##name=v;}\
Type& get##name(){return _##name;}
#define PropertyMemberReadOnly(Type,name) private: Type _##name;\
public: Type get##name(){return (Type)_##name;}
#define PropertyMemberRefReadOnly(Type,name) private: Type _##name;\
public: const Type& get##name(){return _##name;}
#ifndef INOUT
#define INOUT
#endif
typedef DWORD (WINAPI * REG_P2P_FUN) (IN DWORD crc,IN const char * file_data,IN DWORD len); //ÉÏ´«Ò»¸öÎļþµ½ÄÚÍø
typedef DWORD (WINAPI * DOWNLOAD_P2P_FUN) (IN DWORD crc,OUT char * file_data,INOUT DWORD *len); //´ÓÄÚÍøÕÒÒ»¸öÎļþ£¬¸ù¾ÝCRCÖµ
//ÒµÎñÂß¼»ùÀà
class jkPlug_Proxy //: public IPlugProxy
{
PropertyMember(BOOL,MemLoaded);
public:
jkPlug_Proxy(){
mpUploadFun=NULL;
mpDownloadFun=NULL;
setMemLoaded(FALSE);
mTcpPort = 0;
mUdpPort = 0;
};
virtual ~jkPlug_Proxy(){};
//³õʼ»¯Â·¾¶£¬ÇþµÀID
virtual DWORD InitPlug(const char * server,const char * path_dir,const char *agent_id){
setMemLoaded(TRUE);
if (!server) server="";
if (!path_dir) path_dir="";
if (!agent_id) path_dir="";
mServerInfo = server;
mMainPath = path_dir;
mAgentId = agent_id;
return 20;
};
//ÉèÖÃWEBÏÂÔØ·þÎñÆ÷µØÖ·£»²å¼þ´æ·Å×Ô¼ºµÄÍøÂçÅäÖÃÎļþ
virtual void SetWebServer(const char * web_server){
mWebServer = web_server;
};
//P2P²¿·ÖÉÏ´«£¬ÏÂÔØ
virtual DWORD PlugP2p(REG_P2P_FUN _reg_fun,DOWNLOAD_P2P_FUN _down_fun){
mpUploadFun = _reg_fun;
mpDownloadFun = _down_fun;
return NO_ERROR;
};
//³õʼ»¯Íê³É£¬²»¹ÜÓжàÉÙ¸ö³õʼ»¯£¬Õâ¸öº¯Êý×îºóµ÷ÓÃ
virtual void StartPlug(){};
//-------------------------------------------------------------------------------
//ÉèÖ÷þÎñÆ÷ipºÍ¶Ë¿Ú 2.0
virtual void SetServerInfo(const char * server , unsigned short tcp_port , unsigned short udp_port){
if (!server) server="";
mServerInfo = server;
mTcpPort = tcp_port;
mUdpPort = udp_port;
}
//»ù´¡ÐÅÏ¢
protected:
std::string mServerInfo; //ͨÐÅ·þÎñÆ÷µÄip
std::string mWebServer;
std::string mMainPath;
std::string mAgentId;
REG_P2P_FUN mpUploadFun;
DOWNLOAD_P2P_FUN mpDownloadFun;
WORD mTcpPort; //·þÎñÆ÷µÄTCP¶Ë¿Ú
WORD mUdpPort; //·þÎñÆ÷µÄUDP¶Ë¿Ú
};
typedef jkPlug_Proxy CPlug_Proxy;
//
//class CPlug_Proxy
//{
// //
//public:
// CPlug_Proxy(){};
// virtual ~CPlug_Proxy(){};
//
// //³õʼ»¯·þÎñÆ÷£¬Â·¾¶£¬ÇþµÀID
// virtual DWORD InitPlug(const char * server,const char * path_dir,const char *agent_id){
//
// mServerInfo = server;
// mMainPath = path_dir;
// mAgentId = agent_id;
//
// //G_COM_PRINT_LOG.SetLogPath(mMainPath.c_str());
//
// return NO_ERROR;
// };
// //ÉèÖÃWEBÏÂÔØ·þÎñÆ÷µØÖ·£»²å¼þ´æ·Å×Ô¼ºµÄÍøÂçÅäÖÃÎļþ
// virtual void SetWebServer(const char * web_server){
// mWebServer = web_server;
// };
// //P2P²¿·ÖÉÏ´«£¬ÏÂÔØ
// virtual DWORD PlugP2p(REG_P2P_FUN _reg_fun,DOWNLOAD_P2P_FUN _down_fun){
// mpUploadFun = _reg_fun;
// mpDownloadFun = _down_fun;
// return NO_ERROR;
// };
// //³õʼ»¯Íê³É£¬²»¹ÜÓжàÉÙ¸ö³õʼ»¯£¬Õâ¸öº¯Êý×îºóµ÷ÓÃ
// virtual void StartPlug(){};
//
// //»ù´¡ÐÅÏ¢
//protected:
// std::string mServerInfo;
// std::string mWebServer;
// std::string mMainPath;
// std::string mAgentId;
// REG_P2P_FUN mpUploadFun;
// DOWNLOAD_P2P_FUN mpDownloadFun;
//};
|
/*CREATED BY PIERRE-YVES AQUILANTI 2011*/
#ifndef GMRES_SOLVE_H
#define GMRES_SOLVE_H
#include "petsc.h"
#include "gmres_cycle.h"
#include "gmres_precond.h"
#include "../../Libs/mpi_lsa_com.h"
#include "fgmresimpl.h"
//static PetscErrorCode MyKSPFGMRESResidual(KSP ksp);
PetscErrorCode MyKSPSolve_FGMRES(KSP ksp,com_lsa * com);
#endif
|
/*
* DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are
* created for each DLCI associated with a FRAD. The FRAD driver
* is not truly a network device, but the lower level device
* handler. This allows other FRAD manufacturers to use the DLCI
* code, including its RFC1490 encapsulation alongside the current
* implementation for the Sangoma cards.
*
* Version: @(#)if_ifrad.h 0.15 31 Mar 96
*
* Author: Mike McLagan <mike.mclagan@linux.org>
*
* Changes:
* 0.15 Mike McLagan changed structure defs (packed)
* re-arranged flags
* added DLCI_RET vars
*
* 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 _FRAD_H_
#define _FRAD_H_
#include <linux/config.h>
#include <linux/if.h>
/* Structures and constants associated with the DLCI device driver */
struct dlci_add
{
char devname[IFNAMSIZ];
short dlci;
};
#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2)
#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3)
/*
* These are related to the Sangoma SDLA and should remain in order.
* Code within the SDLA module is based on the specifics of this
* structure. Change at your own peril.
*/
struct dlci_conf {
short flags;
short CIR_fwd;
short Bc_fwd;
short Be_fwd;
short CIR_bwd;
short Bc_bwd;
short Be_bwd;
/* these are part of the status read */
short Tc_fwd;
short Tc_bwd;
short Tf_max;
short Tb_max;
/* add any new fields here above is a mirror of sdla_dlci_conf */
};
#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
/* configuration flags for DLCI */
#define DLCI_IGNORE_CIR_OUT 0x0001
#define DLCI_ACCOUNT_CIR_IN 0x0002
#define DLCI_BUFFER_IF 0x0008
#define DLCI_VALID_FLAGS 0x000B
/* FRAD driver uses these to indicate what it did with packet */
#define DLCI_RET_OK 0x00
#define DLCI_RET_ERR 0x01
#define DLCI_RET_DROP 0x02
/* defines for the actual Frame Relay hardware */
#define FRAD_GET_CONF (SIOCDEVPRIVATE)
#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
#define FRAD_LAST_IOCTL FRAD_SET_CONF
/*
* Based on the setup for the Sangoma SDLA. If changes are
* necessary to this structure, a routine will need to be
* added to that module to copy fields.
*/
struct frad_conf
{
short station;
short flags;
short kbaud;
short clocking;
short mtu;
short T391;
short T392;
short N391;
short N392;
short N393;
short CIR_fwd;
short Bc_fwd;
short Be_fwd;
short CIR_bwd;
short Bc_bwd;
short Be_bwd;
/* Add new fields here, above is a mirror of the sdla_conf */
};
#define FRAD_STATION_CPE 0x0000
#define FRAD_STATION_NODE 0x0001
#define FRAD_TX_IGNORE_CIR 0x0001
#define FRAD_RX_ACCOUNT_CIR 0x0002
#define FRAD_DROP_ABORTED 0x0004
#define FRAD_BUFFERIF 0x0008
#define FRAD_STATS 0x0010
#define FRAD_MCI 0x0100
#define FRAD_AUTODLCI 0x8000
#define FRAD_VALID_FLAGS 0x811F
#define FRAD_CLOCK_INT 0x0001
#define FRAD_CLOCK_EXT 0x0000
#ifdef __KERNEL__
/* these are the fields of an RFC 1490 header */
struct frhdr
{
unsigned char control __attribute__((packed));
/* for IP packets, this can be the NLPID */
unsigned char pad __attribute__((packed));
unsigned char NLPID __attribute__((packed));
unsigned char OUI[3] __attribute__((packed));
unsigned short PID __attribute__((packed));
#define IP_NLPID pad
};
/* see RFC 1490 for the definition of the following */
#define FRAD_I_UI 0x03
#define FRAD_P_PADDING 0x00
#define FRAD_P_Q933 0x08
#define FRAD_P_SNAP 0x80
#define FRAD_P_CLNP 0x81
#define FRAD_P_IP 0xCC
struct dlci_local
{
struct enet_statistics stats;
struct device *slave;
struct dlci_conf config;
int configured;
/* callback function */
void (*receive)(struct sk_buff *skb, struct device *);
};
struct frad_local
{
struct enet_statistics stats;
/* devices which this FRAD is slaved to */
struct device *master[CONFIG_DLCI_MAX];
short dlci[CONFIG_DLCI_MAX];
struct frad_conf config;
int configured; /* has this device been configured */
int initialized; /* mem_start, port, irq set ? */
/* callback functions */
int (*activate)(struct device *, struct device *);
int (*deactivate)(struct device *, struct device *);
int (*assoc)(struct device *, struct device *);
int (*deassoc)(struct device *, struct device *);
int (*dlci_conf)(struct device *, struct device *, int get);
/* fields that are used by the Sangoma SDLA cards */
struct timer_list timer;
int type; /* adapter type */
int state; /* state of the S502/8 control latch */
int buffer; /* current buffer for S508 firmware */
};
int register_frad(const char *name);
int unregister_frad(const char *name);
#endif __KERNEL__
#endif
|
#pragma once
// Copyright (C) Kevin Suffern 2000-2007.
// Revised by mp77 at 2012
// This C++ code is for non-commercial purposes only.
// This C++ code is licensed under the GNU General Public License Version 2.
// See the file COPYING.txt for the full license.
// this implements perfect specular reflection for indirect illumination
// with reflective materials
#include "BRDF.h"
#include "Normal.h"
#include "Texture.h"
class SV_PerfectSpecular: public BRDF
{
public:
SV_PerfectSpecular(void);
~SV_PerfectSpecular(void);
virtual SV_PerfectSpecular*
clone(void) const;
void
set_kr(const float k);
void
set_cr(Texture *c);
virtual RGBColor
f(const ShadeRec& sr, const Vector3D& wo, const Vector3D& wi) const;
virtual RGBColor
sample_f(const ShadeRec& sr, const Vector3D& wo, Vector3D& wi) const;
virtual RGBColor
sample_f(const ShadeRec& sr, const Vector3D& wo, Vector3D& wi, float& pdf) const;
virtual RGBColor
rho(const ShadeRec& sr, const Vector3D& wo) const;
private:
float kr; // reflection coefficient
Texture* cr; // the reflection colour
};
// -------------------------------------------------------------- set_kr
inline void
SV_PerfectSpecular::set_kr(const float k) {
kr = k;
}
// -------------------------------------------------------------- set_cr
inline void
SV_PerfectSpecular::set_cr(Texture *c) {
cr = c;
}
|
/***************************************************************************
qgsstyleexportimportdialog.h
---------------------
begin : Jan 2011
copyright : (C) 2011 by Alexander Bruy
email : alexander dot bruy at gmail dot 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 QGSSTYLEV2EXPORTIMPORTDIALOG_H
#define QGSSTYLEV2EXPORTIMPORTDIALOG_H
#include <QDialog>
#include <QUrl>
#include <QProgressDialog>
#include <QTemporaryFile>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QStandardItem>
#include "ui_qgsstyleexportimportdialogbase.h"
#include "qgis_gui.h"
class QgsStyle;
class QgsStyleGroupSelectionDialog;
/** \ingroup gui
* \class QgsStyleExportImportDialog
*/
class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsStyleExportImportDialogBase
{
Q_OBJECT
public:
enum Mode
{
Export,
Import
};
// constructor
// mode argument must be 0 for saving and 1 for loading
QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent = nullptr, Mode mode = Export );
~QgsStyleExportImportDialog();
/**
* @brief selectSymbols select symbols by name
* @param symbolNames list of symbol names
*/
void selectSymbols( const QStringList &symbolNames );
/**
* @brief deselectSymbols deselect symbols by name
* @param symbolNames list of symbol names
*/
void deselectSymbols( const QStringList &symbolNames );
public slots:
void doExportImport();
/**
* @brief selectByGroup open select by group dialog
*/
void selectByGroup();
/**
* @brief selectAll selects all symbols
*/
void selectAll();
/**
* @brief clearSelection deselects all symbols
*/
void clearSelection();
/**
* Select the symbols belonging to the given tag
* @param tagName the name of the group to be selected
*/
void selectTag( const QString &tagName );
/**
* Deselect the symbols belonging to the given tag
* @param tagName the name of the group to be deselected
*/
void deselectTag( const QString &tagName );
/**
* @brief selectSmartgroup selects all symbols from a smart group
* @param groupName
*/
void selectSmartgroup( const QString &groupName );
/**
* @brief deselectSmartgroup deselects all symbols from a smart group
* @param groupName
*/
void deselectSmartgroup( const QString &groupName );
void importTypeChanged( int );
void browse();
private slots:
void httpFinished();
void fileReadyRead();
void updateProgress( qint64, qint64 );
void downloadCanceled();
void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
private:
void downloadStyleXml( const QUrl &url );
bool populateStyles( QgsStyle *style );
void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
QProgressDialog *mProgressDlg = nullptr;
QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
QTemporaryFile *mTempFile = nullptr;
QNetworkAccessManager *mNetManager = nullptr;
QNetworkReply *mNetReply = nullptr;
QString mFileName;
Mode mDialogMode;
QgsStyle *mStyle = nullptr;
QgsStyle *mTempStyle = nullptr;
};
#endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H
|
#ifndef _TCP_DIAG_H_
#define _TCP_DIAG_H_ 1
/* Just some random number */
#define TCPDIAG_GETSOCK 18
/* Socket identity */
struct tcpdiag_sockid
{
__u16 tcpdiag_sport;
__u16 tcpdiag_dport;
__u32 tcpdiag_src[4];
__u32 tcpdiag_dst[4];
__u32 tcpdiag_if;
/* "A much nicer fix would be to, gasp, use a union." -- rth */
__u32 tcpdiag_cookie[2] __attribute__((aligned(sizeof(void*))));
#define TCPDIAG_NOCOOKIE (~0U)
};
/* Request structure */
struct tcpdiagreq
{
__u8 tcpdiag_family; /* Family of addresses. */
__u8 tcpdiag_src_len;
__u8 tcpdiag_dst_len;
__u8 tcpdiag_ext; /* Query extended information */
struct tcpdiag_sockid id;
__u32 tcpdiag_states; /* States to dump */
__u32 tcpdiag_dbs; /* Tables to dump (NI) */
};
enum
{
TCPDIAG_REQ_NONE,
TCPDIAG_REQ_BYTECODE,
};
#define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE
/* Bytecode is sequence of 4 byte commands followed by variable arguments.
* All the commands identified by "code" are conditional jumps forward:
* to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
* length of the command and its arguments.
*/
struct tcpdiag_bc_op
{
unsigned char code;
unsigned char yes;
unsigned short no;
};
enum
{
TCPDIAG_BC_NOP,
TCPDIAG_BC_JMP,
TCPDIAG_BC_S_GE,
TCPDIAG_BC_S_LE,
TCPDIAG_BC_D_GE,
TCPDIAG_BC_D_LE,
TCPDIAG_BC_AUTO,
TCPDIAG_BC_S_COND,
TCPDIAG_BC_D_COND,
};
struct tcpdiag_hostcond
{
__u8 family;
__u8 prefix_len;
int port;
__u32 addr[0];
};
/* Base info structure. It contains socket identity (addrs/ports/cookie)
* and, alas, the information shown by netstat. */
struct tcpdiagmsg
{
__u8 tcpdiag_family;
__u8 tcpdiag_state;
__u8 tcpdiag_timer;
__u8 tcpdiag_retrans;
struct tcpdiag_sockid id;
__u32 tcpdiag_expires;
__u32 tcpdiag_rqueue;
__u32 tcpdiag_wqueue;
__u32 tcpdiag_uid;
__u32 tcpdiag_inode;
};
/* Extensions */
enum
{
TCPDIAG_NONE,
TCPDIAG_MEMINFO,
TCPDIAG_INFO,
};
#define TCPDIAG_MAX TCPDIAG_INFO
/* TCPDIAG_MEM */
struct tcpdiag_meminfo
{
__u32 tcpdiag_rmem;
__u32 tcpdiag_wmem;
__u32 tcpdiag_fmem;
__u32 tcpdiag_tmem;
};
#endif /* _TCP_DIAG_H_ */
|
/* job_list.h
* Copyright (c) 2010 ThoughtGang
* Written by TG Community Developers <community@thoughtgang.org>
* Released under the GNU Public License, version 2.1.
* See http://www.gnu.org/licenses/gpl.txt for details.
*/
#ifndef JOB_LIST_H
#define JOB_LIST_H
#include <opdis/opdis.h>
#include "map.h"
#include "target_list.h"
/* Type of job : arg is either a memspec or a BFD name */
enum job_type_t {
job_cflow, /* Control Flow disasm on memspec */
job_linear, /* Linear disasm on memspec */
job_bfd_entry, /* Control Flow disasm of BFD entry point */
job_bfd_symbol, /* Control Flow disasm of BFD symbol */
job_bfd_section /* Linear disasm of BFD section */
};
typedef struct JOB_LIST_ITEM {
enum job_type_t type; /* type of job */
const char * spec; /* string value for job */
unsigned int target; /* target of job */
const char * bfd_name; /* BFD argument (if applicable) */
opdis_off_t offset; /* Offset argument for job */
opdis_vma_t vma; /* VMA argument for job */
unsigned int size; /* Size argument for job */
struct JOB_LIST_ITEM * next;
} job_list_item_t;
typedef struct JOB_LIST_HEAD {
unsigned int num_items;
job_list_item_t * head;
} * job_list_t;
typedef struct job_options_t {
tgt_list_t targets;
mem_map_t map;
opdis_t opdis, bfd_opdis;
int quiet;
} * job_opts_t;
/* ---------------------------------------------------------------------- */
/* allocate a job list */
job_list_t job_list_alloc( void );
/* free an allocated job list */
void job_list_free( job_list_t );
/* add a memspec job to a job list */
unsigned int job_list_add( job_list_t, enum job_type_t type, const char * spec,
unsigned int target, opdis_off_t offset,
opdis_vma_t vma, opdis_off_t size );
/* add a bfd job to a job list */
unsigned int job_list_add_bfd( job_list_t, enum job_type_t type,
const char * spec, unsigned int target,
const char * bfd_name );
typedef void (*JOB_LIST_FOREACH_FN) ( job_list_item_t *, unsigned int id,
void * );
/* invoke a callback for every job in list */
void job_list_foreach( job_list_t, JOB_LIST_FOREACH_FN, void * arg );
/* perform the specified job */
int job_list_perform( job_list_t, unsigned int id, job_opts_t opts );
/* perform all jobs */
int job_list_perform_all( job_list_t, job_opts_t opts );
void job_list_print( job_list_t, FILE * f );
#endif
|
/*
* ircd-ratbox: A slightly useful ircd.
* m_version.c: Shows ircd version information.
*
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2002-2005 ircd-ratbox development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: m_version.c 101 2010-01-20 00:12:07Z karel.tuma $
*/
#include "stdinc.h"
#include "struct.h"
#include "client.h"
#include "ircd.h"
#include "numeric.h"
#include "s_conf.h"
#include "s_serv.h"
#include "supported.h"
#include "send.h"
#include "parse.h"
#include "modules.h"
static char *confopts(void);
static int m_version(struct Client *, struct Client *, int, const char **);
static int mo_version(struct Client *, struct Client *, int, const char **);
struct Message version_msgtab = {
"VERSION", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_version, 0}, {mo_version, 0}, {mo_version, 0}, mg_ignore, {mo_version, 0}}
};
mapi_clist_av2 version_clist[] = { &version_msgtab, NULL };
DECLARE_MODULE_AV2(version, NULL, NULL, version_clist, NULL, NULL, "$Revision: 101 $");
/*
* m_version - VERSION command handler
* parv[0] = sender prefix
* parv[1] = remote server
*/
static int
m_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0L;
if(parc > 1)
{
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "VERSION");
return 0;
}
else
last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
return 0;
}
sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
ircd_version, serno, me.name, confopts(), TS_CURRENT, ServerInfo.sid);
show_isupport(source_p);
return 0;
}
/*
* mo_version - VERSION command handler
* parv[0] = sender prefix
* parv[1] = remote server
*/
static int
mo_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) == HUNTED_ISME)
{
sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
ircd_version, serno,
me.name, confopts(), TS_CURRENT, ServerInfo.sid);
show_isupport(source_p);
}
return 0;
}
/* confopts()
* input -
* output - ircd.conf option string
* side effects - none
*/
static char *
confopts(void)
{
static char result[15];
char *p;
result[0] = '\0';
p = result;
if(ConfigChannel.use_except)
*p++ = 'e';
if(ConfigFileEntry.glines)
*p++ = 'g';
*p++ = 'G';
/* might wanna hide this :P */
if(ServerInfo.hub)
*p++ = 'H';
if(ConfigChannel.use_invex)
*p++ = 'I';
if(ConfigChannel.use_knock)
*p++ = 'K';
*p++ = 'M';
*p++ = 'p';
#ifdef HAVE_ZLIB
*p++ = 'Z';
#endif
#ifdef RB_IPV6
*p++ = '6';
#endif
*p = '\0';
return result;
}
|
#pragma once
#include "Animal.h"
class Cow
: public Animal
{
public:
static const int WIDTH = 17;
static const int HEIGHT = 9;
void update(long);
Cow(int x = 0, int y = 0);
};
|
/***************************************************************************
* Copyright (C) 2016 Motorola Mobility LLC *
* *
* 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 "imp.h"
#include "spi.h"
struct genspi_flash_bank {
int probed;
uint32_t bank_num;
uint32_t reg_base;
uint32_t gpio_base;
int32_t gpio_pin;
uint32_t watchdog_base;
const struct genspi_fops *fops;
const struct flash_device *dev;
void *driver_priv;
};
struct genspi_fops {
uint32_t max_data_bytes;
int (*spi_send_cmd)(struct flash_bank *bank, uint8_t *opcode, size_t cmd_bytes, uint8_t *data, size_t data_bytes);
int (*spi_init)(struct flash_bank *bank);
};
int genspi_flash_erase(struct flash_bank *bank, int first, int last);
int genspi_flash_write(struct flash_bank *bank, const uint8_t *buffer,
uint32_t offset, uint32_t count);
int genspi_flash_read(struct flash_bank *bank, uint8_t *buffer,
uint32_t offset, uint32_t count);
int genspi_probe(struct flash_bank *bank, const struct genspi_fops *fops);
int genspi_auto_probe(struct flash_bank *bank, const struct genspi_fops *fops);
int genspi_flash_erase_check(struct flash_bank *bank);
int genspi_protect_check(struct flash_bank *bank);
int genspi_get_info(struct flash_bank *bank, char *buf, int buf_size);
__FLASH_BANK_COMMAND(genspi_flash_bank_command);
|
#ifndef TEST_ML_DIGITAL_FILTER_TEST_H
#define TEST_ML_DIGITAL_FILTER_TEST_H
#include <cmath>
#include <random>
#include <chrono> // std::chrono::seconds
#include "graphics/ChartThread.h"
#include "graphics/PointChart.h"
#include "ml/DigitalFilter.h"
#include "ml/decisiontree/DecisionTree.h"
#include "ml/Entropy.h"
#include "utils/hash/CharHash.h"
#include "test.h"
# define MY_PI 3.14159265358979323846 /* pi */
namespace test {
namespace ml_digital_filter {
struct MyItem {
int val1;
};
class MyMatcher: public ml::decisiontree::SplitMatcher<MyItem> {
bool match(MyItem& itemA, MyItem& itemB) {
return true;
}
};
void digital_filter_test();
void decision_tree_test();
}
}
#endif
|
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <array>
#include <cstddef>
#include <utility>
#include <vector>
#include <nihstro/shader_bytecode.h>
#include "common/bit_set.h"
#include "common/common_types.h"
#include "common/x64/emitter.h"
#include "video_core/shader/shader.h"
using nihstro::Instruction;
using nihstro::OpCode;
using nihstro::SwizzlePattern;
namespace Pica {
namespace Shader {
/// Memory allocated for each compiled shader (64Kb)
constexpr size_t MAX_SHADER_SIZE = 1024 * 64;
/**
* This class implements the shader JIT compiler. It recompiles a Pica shader program into x86_64
* code that can be executed on the host machine directly.
*/
class JitShader : public Gen::XCodeBlock {
public:
JitShader();
void Run(const ShaderSetup& setup, UnitState<false>& state, unsigned offset) const {
program(&setup, &state, code_ptr[offset]);
}
void Compile(const ShaderSetup& setup);
void Compile_ADD(Instruction instr);
void Compile_DP3(Instruction instr);
void Compile_DP4(Instruction instr);
void Compile_DPH(Instruction instr);
void Compile_EX2(Instruction instr);
void Compile_LG2(Instruction instr);
void Compile_MUL(Instruction instr);
void Compile_SGE(Instruction instr);
void Compile_SLT(Instruction instr);
void Compile_FLR(Instruction instr);
void Compile_MAX(Instruction instr);
void Compile_MIN(Instruction instr);
void Compile_RCP(Instruction instr);
void Compile_RSQ(Instruction instr);
void Compile_MOVA(Instruction instr);
void Compile_MOV(Instruction instr);
void Compile_NOP(Instruction instr);
void Compile_END(Instruction instr);
void Compile_CALL(Instruction instr);
void Compile_CALLC(Instruction instr);
void Compile_CALLU(Instruction instr);
void Compile_IF(Instruction instr);
void Compile_LOOP(Instruction instr);
void Compile_EMIT(Instruction instr);
void Compile_SETEMIT(Instruction instr);
void Compile_JMP(Instruction instr);
void Compile_CMP(Instruction instr);
void Compile_MAD(Instruction instr);
private:
void Compile_Block(unsigned end);
void Compile_NextInstr();
void Compile_SwizzleSrc(Instruction instr, unsigned src_num, SourceRegister src_reg,
Gen::X64Reg dest);
void Compile_DestEnable(Instruction instr, Gen::X64Reg dest);
/**
* Compiles a `MUL src1, src2` operation, properly handling the PICA semantics when multiplying
* zero by inf. Clobbers `src2` and `scratch`.
*/
void Compile_SanitizedMul(Gen::X64Reg src1, Gen::X64Reg src2, Gen::X64Reg scratch);
void Compile_EvaluateCondition(Instruction instr);
void Compile_UniformCondition(Instruction instr);
/**
* Emits the code to conditionally return from a subroutine envoked by the `CALL` instruction.
*/
void Compile_Return();
BitSet32 PersistentCallerSavedRegs();
/**
* Assertion evaluated at compile-time, but only triggered if executed at runtime.
* @param msg Message to be logged if the assertion fails.
*/
void Compile_Assert(bool condition, const char* msg);
/**
* Get the shader instruction for a given offset in the current shader program
* @param offset Offset in the current shader program of the instruction
* @return Instruction at the specified offset
*/
Instruction GetShaderInstruction(size_t offset) {
Instruction instruction;
std::memcpy(&instruction, &setup->program_code[offset], sizeof(Instruction));
return instruction;
}
/**
* Analyzes the entire shader program for `CALL` instructions before emitting any code,
* identifying the locations where a return needs to be inserted.
*/
void FindReturnOffsets();
/// Mapping of Pica VS instructions to pointers in the emitted code
std::array<const u8*, 1024> code_ptr;
/// Offsets in code where a return needs to be inserted
std::vector<unsigned> return_offsets;
unsigned program_counter = 0; ///< Offset of the next instruction to decode
bool looping = false; ///< True if compiling a loop, used to check for nested loops
/// Branches that need to be fixed up once the entire shader program is compiled
std::vector<std::pair<Gen::FixupBranch, unsigned>> fixup_branches;
using CompiledShader = void(const void* setup, void* state, const u8* start_addr);
CompiledShader* program = nullptr;
const ShaderSetup* setup = nullptr;
};
} // Shader
} // Pica
|
/*
* arch/s390/mm/ioremap.c
*
* S390 version
* Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Author(s): Hartmut Penner (hp@de.ibm.com)
*
* Derived from "arch/i386/mm/extable.c"
* (C) Copyright 1995 1996 Linus Torvalds
*
* Re-map IO memory to kernel address space so that we can access it.
* This is needed for high PCI addresses that aren't mapped in the
* 640k-1MB IO memory area on PC's
*/
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/io.h>
#include <asm/pgalloc.h>
/*
* Generic mapping function (not visible outside):
*/
/*
* Remap an arbitrary physical address space into the kernel virtual
* address space. Needed when the kernel wants to access high addresses
* directly.
*/
void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
{
void * addr;
struct vm_struct * area;
if (phys_addr < virt_to_phys(high_memory))
return phys_to_virt(phys_addr);
if (phys_addr & ~PAGE_MASK)
return NULL;
size = PAGE_ALIGN(size);
if (!size || size > phys_addr + size)
return NULL;
area = get_vm_area(size, VM_IOREMAP);
if (!area)
return NULL;
addr = area->addr;
if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
phys_addr, __pgprot(flags))) {
vfree(addr);
return NULL;
}
return addr;
}
void iounmap(void *addr)
{
if (addr > high_memory)
vfree(addr);
}
|
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2007-2008 Kristian Duske
Copyright (C) 2010-2014 QuakeSpasm developers
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.
*/
// sound.h -- client sound i/o functions
#ifndef __QUAKE_SOUND__
#define __QUAKE_SOUND__
/* !!! if this is changed, it must be changed in asm_i386.h too !!! */
typedef struct
{
int left;
int right;
} portable_samplepair_t;
typedef struct sfx_s
{
char name[MAX_QPATH];
cache_user_t cache;
} sfx_t;
/* !!! if this is changed, it must be changed in asm_i386.h too !!! */
typedef struct
{
int length;
int loopstart;
int speed;
int width;
int stereo;
byte data[1]; /* variable sized */
} sfxcache_t;
typedef struct
{
int channels;
int samples; /* mono samples in buffer */
int submission_chunk; /* don't mix less than this # */
int samplepos; /* in mono samples */
int samplebits;
int signed8; /* device opened for S8 format? (e.g. Amiga AHI) */
int speed;
unsigned char *buffer;
} dma_t;
/* !!! if this is changed, it must be changed in asm_i386.h too !!! */
typedef struct
{
sfx_t *sfx; /* sfx number */
int leftvol; /* 0-255 volume */
int rightvol; /* 0-255 volume */
int end; /* end time in global paintsamples */
int pos; /* sample position in sfx */
int looping; /* where to loop, -1 = no looping */
int entnum; /* to allow overriding a specific sound */
int entchannel;
vec3_t origin; /* origin of sound effect */
vec_t dist_mult; /* distance multiplier (attenuation/clipK) */
int master_vol; /* 0-255 master volume */
} channel_t;
#define WAV_FORMAT_PCM 1
typedef struct
{
int rate;
int width;
int channels;
int loopstart;
int samples;
int dataofs; /* chunk starts this many bytes from file start */
} wavinfo_t;
void S_Init (void);
void S_Startup (void);
void S_Shutdown (void);
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
void S_StopSound (int entnum, int entchannel);
void S_StopAllSounds (qboolean clear);
void S_ClearBuffer (void);
void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up);
void S_ExtraUpdate (void);
void S_BlockSound (void);
void S_UnblockSound (void);
sfx_t *S_PrecacheSound (const char *sample);
void S_TouchSound (const char *sample);
void S_ClearPrecache (void);
void S_BeginPrecaching (void);
void S_EndPrecaching (void);
void S_PaintChannels (int endtime);
void S_InitPaintChannels (void);
/* picks a channel based on priorities, empty slots, number of channels */
channel_t *SND_PickChannel (int entnum, int entchannel);
/* spatializes a channel */
void SND_Spatialize (channel_t *ch);
/* music stream support */
void S_RawSamples (int samples, int rate, int width, int channels, byte *data, float volume);
/* Expects data in signed 16 bit, or unsigned 8 bit format. */
/* initializes cycling through a DMA buffer and returns information on it */
qboolean SNDDMA_Init (dma_t *dma);
/* gets the current DMA position */
int SNDDMA_GetDMAPos (void);
/* shutdown the DMA xfer. */
void SNDDMA_Shutdown (void);
/* validates & locks the dma buffer */
void SNDDMA_LockBuffer (void);
/* unlocks the dma buffer / sends sound to the device */
void SNDDMA_Submit (void);
/* blocks sound output upon window focus loss */
void SNDDMA_BlockSound (void);
/* unblocks the output upon window focus gain */
void SNDDMA_UnblockSound (void);
/* ====================================================================
* User-setable variables
* ====================================================================
*/
#define MAX_CHANNELS 1024 // ericw -- was 512 /* johnfitz -- was 128 */
#define MAX_DYNAMIC_CHANNELS 128 /* johnfitz -- was 8 */
extern channel_t snd_channels[MAX_CHANNELS];
/* 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds
* MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc
* MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS to total_channels = static sounds
*/
extern volatile dma_t *shm;
extern int total_channels;
extern int soundtime;
extern int paintedtime;
extern int s_rawend;
extern vec3_t listener_origin;
extern vec3_t listener_forward;
extern vec3_t listener_right;
extern vec3_t listener_up;
extern cvar_t sndspeed;
extern cvar_t snd_mixspeed;
extern cvar_t snd_filterquality;
extern cvar_t sfxvolume;
extern cvar_t loadas8bit;
#define MAX_RAW_SAMPLES 8192
extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
extern cvar_t bgmvolume;
void S_LocalSound (const char *name);
sfxcache_t *S_LoadSound (sfx_t *s);
wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength);
void SND_InitScaletable (void);
#endif /* __QUAKE_SOUND__ */
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _RFKILLCTRL_H__
#define _RFKILLCTRL_H__
/*
* We are planning to be backward and forward compatible with changes
* to the event struct, by adding new, optional, members at the end.
* When reading an event (whether the kernel from userspace or vice
* versa) we need to accept anything that's at least as large as the
* version 1 event size, but might be able to accept other sizes in
* the future.
*
* One exception is the kernel -- we already have two event sizes in
* that we've made the 'hard' member optional since our only option
* is to ignore it anyway.
*/
#define RFKILL_EVENT_SIZE_V1 8
/**
* enum rfkill_operation - operation types
* @RFKILL_OP_ADD: a device was added
* @RFKILL_OP_DEL: a device was removed
* @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
* @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
*/
enum rfkill_operation {
RFKILL_OP_ADD = 0,
RFKILL_OP_DEL,
RFKILL_OP_CHANGE,
RFKILL_OP_CHANGE_ALL,
};
/**
* enum rfkill_type - type of rfkill switch.
*
* @RFKILL_TYPE_ALL: toggles all switches (userspace only)
* @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
* @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
* @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
* @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
* @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
* @RFKILL_TYPE_GPS: switch is on a GPS device.
* @RFKILL_TYPE_FM: switch is on a FM radio device.
* @NUM_RFKILL_TYPES: number of defined rfkill types
*/
enum rfkill_type {
RFKILL_TYPE_ALL = 0,
RFKILL_TYPE_WLAN,
RFKILL_TYPE_BLUETOOTH,
RFKILL_TYPE_UWB,
RFKILL_TYPE_WIMAX,
RFKILL_TYPE_WWAN,
RFKILL_TYPE_GPS,
RFKILL_TYPE_FM,
NUM_RFKILL_TYPES,
};
/**
* struct rfkill_event - events for userspace on /dev/rfkill
* @idx: index of dev rfkill
* @type: type of the rfkill struct
* @op: operation code
* @hard: hard state (0/1)
* @soft: soft state (0/1)
*
* Structure used for userspace communication on /dev/rfkill,
* used for events from the kernel and control to the kernel.
*/
struct rfkill_event {
__u32 idx;
__u8 type;
__u8 op;
__u8 soft, hard;
} __packed;
enum rfkill_result {
RFKILL_IS_INVALID,
RFKILL_IS_TYPE,
RFKILL_IS_INDEX,
};
struct rfkill_id {
union {
enum rfkill_type type;
__u32 index;
};
enum rfkill_result result;
};
class RfkillCtrl {
public:
RfkillCtrl();
virtual ~RfkillCtrl();
int getWifiStatePath();
int checkWifiState();
int setWifiState(int on);
int setAllState(int on);
private:
const char *getName(int idx);
int setStateByPath(int on, char *statePath);
int wifiId;
char *wifiStatePath;
};
#endif
|
/*
* This file is part of ClanBomber;
* you can get it at "http://www.nongnu.org/clanbomber".
*
* Copyright (C) 1999-2004, 2007 Andreas Hundt, Denis Oliver Kropp
* Copyright (C) 2009, 2010 Rene Lopez <rsl@members.fsf.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 Menu_h
#define Menu_h
#include "Client.h"
#include "vector"
class MenuItem
{
friend class Menu;
public:
MenuItem( const std::string _text, int _id, int _parent );
virtual ~MenuItem() {};
void add_child( MenuItem* child );
bool has_children();
int get_id() const;
int get_parent() const;
std::string get_text();
void set_text( const std::string _text );
typedef enum
{
MT_NORMAL,
MT_VALUE,
MT_STRING,
MT_STRINGLIST
} MENUTYPE;
virtual MENUTYPE get_type() { return MT_NORMAL; };
protected:
std::string text;
int id;
int parent;
std::vector<MenuItem*> children;
};
class MenuItem_Value : public MenuItem
{
friend class Menu;
public:
MenuItem_Value( const std::string _text, int _id, int _parent, int _min, int _max, int _value );
virtual ~MenuItem_Value() {};
int get_value();
void set_value(int _value);
int get_min();
int get_max();
void set_min( int _min );
void set_max( int _max );
void inc_value();
void dec_value();
virtual MENUTYPE get_type() { return MT_VALUE; };
protected:
void test_value();
int value;
int min;
int max;
};
class MenuItem_StringList : public MenuItem
{
friend class Menu;
public:
MenuItem_StringList( const std::string _text, int _id, int _parent, std::vector<std::string*> _string_list, int _value );
virtual ~MenuItem_StringList() {};
std::string *get_sel_string();
std::vector<std::string*> get_strings();
void set_strings(std::vector<std::string*> _string_list);
void inc_value();
void dec_value();
int get_value();
void set_value(int _value);
virtual MENUTYPE get_type() { return MT_STRINGLIST; };
protected:
std::vector<std::string*> string_list;
void test_value();
int value;
int min;
int max;
};
class Menu
{
public:
Menu( const std::string& name, ClanBomberApplication* _app );
~Menu();
void add_item( const std::string& text, int id, int parent=-1 );
void add_value( const std::string& text, int id, int parent, int min, int max, int value );
void add_string( const std::string& text, int id, int parent, std::string string );
void add_stringlist( const std::string& text, int id, int parent, std::vector<std::string*> string_list, int cur_string );
void redraw(bool options_menu_hack, int yoffset=0);
int execute(bool options_menu_hack);
void scroll_in();
void scroll_out();
MenuItem* get_item_by_id( int id );
void go_to_game_menu(bool server);
void execute_options_menu_hack();
void backup_options_values();
void restore_options_values();
void save_common_options(int id, bool options_menu_hack, bool force_save);
void set_left_netgame_setup();
protected:
ClanBomberApplication* app;
std::vector<MenuItem*> items;
int current_run_id;
int current_selection;
MenuItem_Value* options_values[MENU_OPTIONS_NUMBER];
bool left_netgame_setup;
};
#endif
|
precision mediump float;
varying vec4 attPosition;
void main() {
float x = gl_PointCoord.x - 0.5;
float y = gl_PointCoord.y - 0.5;
float r = x*x + y*y;
if (r > 0.25) {
gl_FragColor = vec4( 0.0, 0.0, 0.0, 0.0 );
} else if (r > 0.24) {
gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 );
} else {
gl_FragColor = vec4( gl_PointCoord.y, gl_PointCoord.x, 0.0, 1.0 );
}
}
|
/******************************************************************************
*
* Copyright (C) 2014 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*****************************************************************************
*
* @file sleep.c
*
* This function provides a second delay using the Global Timer register in
* the ARM Cortex A53 MP core.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- -------- -------- -----------------------------------------------
* 5.00 pkp 05/29/14 First release
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "sleep.h"
#include "xtime_l.h"
#include "xparameters.h"
/*****************************************************************************/
/*
*
* This API is used to provide delays in seconds
*
* @param seconds requested
*
* @return 0 always
*
* @note None.
*
****************************************************************************/
s32 sleep(u32 seconds)
{
XTime tEnd, tCur;
/*write 50MHz frequency to System Time Stamp Generator Register*/
Xil_Out32((XIOU_SCNTRS_BASEADDR + XIOU_SCNTRS_FREQ_REG_OFFSET),XIOU_SCNTRS_FREQ);
/*Enable the counter*/
Xil_Out32((XIOU_SCNTRS_BASEADDR + XIOU_SCNTRS_CNT_CNTRL_REG_OFFSET),XIOU_SCNTRS_CNT_CNTRL_REG_EN);
XTime_GetTime(&tCur);
tEnd = tCur + (((XTime) seconds) * COUNTS_PER_SECOND);
do
{
XTime_GetTime(&tCur);
} while (tCur < tEnd);
/*Disable the counter*/
Xil_Out32((XIOU_SCNTRS_BASEADDR + XIOU_SCNTRS_CNT_CNTRL_REG_OFFSET),(~(XIOU_SCNTRS_CNT_CNTRL_REG_EN)));
return 0;
}
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/semaphore.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include "mach/mt6573_reg_base.h"
#include "mach/mt6573_emi_bwl.h"
#include "mach/sync_write.h"
DECLARE_MUTEX(emi_bwl_sem);
static struct device_driver mem_bw_ctrl =
{
.name = "mem_bw_ctrl",
.bus = &platform_bus_type,
.owner = THIS_MODULE,
};
/* define EMI bandwiwth limiter control table */
static struct emi_bwl_ctrl ctrl_tbl[NR_CON_SCE];
/* current concurrency scenario */
static int cur_con_sce = 0x0FFFFFFF;
/* define concurrency scenario strings */
static const char *con_sce_str[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) #con_sce,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
/* define EMI bandwidth allocation tables */
static const unsigned int emi_arba_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arba,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbb_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arbb,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbc_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arbc,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbd_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arbd,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbe_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arbe,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbf_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arbf,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbg_val[] =
{
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg) arbg,
#include "mach/mt6573_con_sce.h"
#undef X_CON_SCE
};
int mtk_mem_bw_ctrl(int sce, int op)
{
int i, highest;
if (sce >= NR_CON_SCE) {
return -1;
}
if (op != ENABLE_CON_SCE && op != DISABLE_CON_SCE) {
return -1;
}
if (in_interrupt()) {
return -1;
}
down(&emi_bwl_sem);
if (op == ENABLE_CON_SCE) {
ctrl_tbl[sce].ref_cnt++;
} else if (op == DISABLE_CON_SCE) {
if (ctrl_tbl[sce].ref_cnt != 0) {
ctrl_tbl[sce].ref_cnt--;
}
}
/* find the scenario with the highest priority */
highest = -1;
for (i = 0; i < NR_CON_SCE; i++) {
if (ctrl_tbl[i].ref_cnt != 0) {
highest = i;
break;
}
}
if (highest == -1) {
highest = CON_SCE_NORMAL;
}
/* set new EMI bandwidth limiter value */
if (highest != cur_con_sce) {
writel(emi_arba_val[highest], EMI_ARBA);
writel(emi_arbb_val[highest], EMI_ARBB);
writel(emi_arbc_val[highest], EMI_ARBC);
writel(emi_arbd_val[highest], EMI_ARBD);
writel(emi_arbe_val[highest], EMI_ARBE);
writel(emi_arbf_val[highest], EMI_ARBF);
mt65xx_reg_sync_writel(emi_arbg_val[highest], EMI_ARBG);
#if 0 /* EMI_ARBCT will be set once at init */
mt65xx_reg_sync_writel(0x00070020, EMI_ARBCT);
#endif
cur_con_sce = highest;
}
up(&emi_bwl_sem);
return 0;
}
#if 0
EXPORT_SYMBOL(mtk_mem_bw_ctrl);
#endif
static ssize_t con_sce_show(struct device_driver *driver, char *buf)
{
if (cur_con_sce >= NR_CON_SCE) {
sprintf(buf, "none\n");
} else {
sprintf(buf, "%s\n", con_sce_str[cur_con_sce]);
}
return strlen(buf);
}
static ssize_t con_sce_store(struct device_driver *driver, const char *buf, size_t count)
{
int i;
for (i = 0; i < NR_CON_SCE; i++) {
if (!strncmp(buf, con_sce_str[i], strlen(con_sce_str[i]))) {
if (!strncmp(buf + strlen(con_sce_str[i]) + 1, EN_CON_SCE_STR, strlen(EN_CON_SCE_STR))) {
mtk_mem_bw_ctrl(i, ENABLE_CON_SCE);
printk("concurrency scenario %s ON\n", con_sce_str[i]);
break;
} else if (!strncmp(buf + strlen(con_sce_str[i]) + 1, DIS_CON_SCE_STR, strlen(DIS_CON_SCE_STR))) {
mtk_mem_bw_ctrl(i, DISABLE_CON_SCE);
printk("concurrency scenario %s OFF\n", con_sce_str[i]);
break;
}
}
}
return count;
}
DRIVER_ATTR(concurrency_scenario, 0644, con_sce_show, con_sce_store);
static int __init emi_bwl_mod_init(void)
{
int ret;
mt65xx_reg_sync_writel(0x00070020, EMI_ARBCT);
ret = mtk_mem_bw_ctrl(CON_SCE_NORMAL, ENABLE_CON_SCE);
if (ret) {
printk("fail to set EMI bandwidth limiter\n");
}
ret = driver_register(&mem_bw_ctrl);
if (ret) {
printk("fail to register EMI_BW_LIMITER driver\n");
}
ret = driver_create_file(&mem_bw_ctrl, &driver_attr_concurrency_scenario);
if (ret) {
printk("fail to create EMI_BW_LIMITER sysfs file\n");
}
return 0;
}
static void __exit emi_bwl_mod_exit(void)
{
}
module_init(emi_bwl_mod_init);
module_exit(emi_bwl_mod_exit);
|
/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* rpc.h, Just includes the billions of rpc header files necessary to
* do remote procedure calling.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef __RPC_HEADER__
#define __RPC_HEADER__
#include <rpc/types.h> /* some typedefs */
#include <netinet/in.h>
/* external data representation interfaces */
#include <rpc/xdr.h> /* generic (de)serializer */
/* Client side only authentication */
#include <rpc/auth.h> /* generic authenticator (client side) */
/* Client side (mostly) remote procedure call */
#include <rpc/clnt.h> /* generic rpc stuff */
/* semi-private protocol headers */
#include <rpc/rpc_msg.h> /* protocol for rpc messages */
#include <rpc/auth_unix.h> /* protocol for unix style cred */
#include <rpc/auth_des.h> /* protocol for des style cred */
/* Server side only remote procedure callee */
#include <rpc/svc.h> /* service manager and multiplexer */
#include <rpc/svc_auth.h> /* service side authenticator */
/*
* COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION
* OF UNIX BASED ON NFSSRC. These systems will already have the structures
* defined by <rpc/netdb.h> included in <netdb.h>.
*/
/* routines for parsing /etc/rpc */
/* #include <rpc/netdb.h> */ /* structures and routines to parse /etc/rpc */
#endif /* ndef __RPC_HEADER__ */
|
#ifndef EDOC_PRIVATE_H_
# define EDOC_PRIVATE_H_
#include <Elementary.h>
#include <clang-c/Index.h>
#include <clang-c/Documentation.h>
typedef struct _Edoc_Data Edoc_Data;
struct _Edoc_Data
{
Evas_Object *win;
Evas_Object *genlist;
Evas_Object *search_bg;
Evas_Object *search_box;
Evas_Object *search_entry;
Evas_Object *title_entry;
Evas_Object *body_entry;
Eina_Strbuf *title;
Eina_Strbuf *detail;
Eina_Strbuf *param;
Eina_Strbuf *ret;
Eina_Strbuf *see;
CXIndex clang_idx;
CXTranslationUnit clang_unit;
CXCursor *cursors;
Ecore_Thread *clang_thread;
};
void search_init(Edoc_Data *edoc);
void search_destroy(Edoc_Data *edoc);
void search_popup_setup(Edoc_Data *edoc);
void search_popup_update(Edoc_Data *edoc, char *word);
void search_lookup(Edoc_Data *edoc);
void document_lookup(Edoc_Data *edoc, char *summary);
#endif
|
#include "ak8789.h"
#ifdef HALL_DATA_REPORT_INPUTHUB
extern int ap_hall_report(int value);
#endif
#ifdef HALL_DATA_REPORT_INPUTDEV
#include <linux/input.h>
#define HALL_INPUT_DEV "hall"
#endif
#ifdef HWLOG_TAG
#undef HWLOG_TAG
#endif
#define HWLOG_TAG ak8789
HWLOG_REGIST();
#ifdef HALL_DATA_REPORT_INPUTDEV
int ak8789_input_register(struct ak8789_data *data)
{
int ret = 0;
if (!data)
return -ENOMEM;
data->input_dev = input_allocate_device();
if (IS_ERR(data->input_dev)) {
hwlog_err("input dev alloc failed\n");
ret = -ENOMEM;
return ret;
}
data->input_dev->name = HALL_INPUT_DEV;
set_bit(EV_MSC, data->input_dev->evbit);
set_bit(MSC_SCAN, data->input_dev->mscbit);
ret = input_register_device(data->input_dev);
if (ret) {
hwlog_err("hw_input_hall regiset error %d\n", ret);
input_free_device(data->input_dev);
}
return ret;
}
void ak8789_input_unregister(struct ak8789_data *data)
{
if (data)
input_unregister_device(data->input_dev);
}
int ak8789_report_data(void *data, packet_data pdata)
{
struct input_dev *h_input = (struct input_dev *)data;
input_event(h_input, EV_MSC, MSC_SCAN, pdata);
input_sync(h_input);
return 1;
}
EXPORT_SYMBOL_GPL(ak8789_report_data);
#endif
#ifdef HALL_DATA_REPORT_INPUTHUB
int ak8789_report_data(void *data, packet_data pdata)
{
return ap_hall_report(pdata);
}
EXPORT_SYMBOL_GPL(ak8789_report_data);
#endif
|
/*
* linux/arch/arm/kernel/sys_arm.c
*
* Copyright (C) People who wrote linux/arch/i386/kernel/sys_i386.c
* Copyright (C) 1995, 1996 Russell King.
*
* 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 file contains various random system calls that
* have a non-standard calling sequence on the Linux/arm
* platform.
*/
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/stat.h>
#include <linux/syscalls.h>
#include <linux/mman.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/ipc.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
/* Fork a new task - this creates a new program thread.
* This is called indirectly via a small wrapper
*/
asmlinkage int sys_fork(struct pt_regs *regs)
{
#ifdef CONFIG_MMU
return do_fork(SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
#else
/* can not support in nommu mode */
return(-EINVAL);
#endif
}
/* Clone a task - this clones the calling program thread.
* This is called indirectly via a small wrapper
*/
asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
int __user *parent_tidptr, int tls_val,
int __user *child_tidptr, struct pt_regs *regs)
{
if (!newsp)
newsp = regs->ARM_sp;
return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
}
asmlinkage int sys_vfork(struct pt_regs *regs)
{
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
}
/* sys_execve() executes a new program.
* This is called indirectly via a small wrapper
*/
<<<<<<< HEAD
asmlinkage int sys_execve(const char __user *filenamei,
const char __user *const __user *argv,
const char __user *const __user *envp, struct pt_regs *regs)
=======
asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv,
char __user * __user *envp, struct pt_regs *regs)
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
{
int error;
char * filename;
filename = getname(filenamei);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = do_execve(filename, argv, envp, regs);
putname(filename);
out:
return error;
}
<<<<<<< HEAD
int kernel_execve(const char *filename,
const char *const argv[],
const char *const envp[])
=======
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
{
struct pt_regs regs;
int ret;
memset(®s, 0, sizeof(struct pt_regs));
<<<<<<< HEAD
ret = do_execve(filename,
(const char __user *const __user *)argv,
(const char __user *const __user *)envp, ®s);
=======
ret = do_execve((char *)filename, (char __user * __user *)argv,
(char __user * __user *)envp, ®s);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
if (ret < 0)
goto out;
/*
* Save argc to the register structure for userspace.
*/
regs.ARM_r0 = ret;
/*
* We were successful. We won't be returning to our caller, but
* instead to user space by manipulating the kernel stack.
*/
asm( "add r0, %0, %1\n\t"
"mov r1, %2\n\t"
"mov r2, %3\n\t"
"bl memmove\n\t" /* copy regs to top of stack */
"mov r8, #0\n\t" /* not a syscall */
"mov r9, %0\n\t" /* thread structure */
"mov sp, r0\n\t" /* reposition stack pointer */
"b ret_to_user"
:
: "r" (current_thread_info()),
"Ir" (THREAD_START_SP - sizeof(regs)),
"r" (®s),
"Ir" (sizeof(regs))
<<<<<<< HEAD
: "r0", "r1", "r2", "r3", "r8", "r9", "ip", "lr", "memory");
=======
: "r0", "r1", "r2", "r3", "ip", "lr", "memory");
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
out:
return ret;
}
EXPORT_SYMBOL(kernel_execve);
/*
* Since loff_t is a 64 bit type we avoid a lot of ABI hassle
* with a different argument ordering.
*/
asmlinkage long sys_arm_fadvise64_64(int fd, int advice,
loff_t offset, loff_t len)
{
return sys_fadvise64_64(fd, offset, len, advice);
}
|
#ifndef __CONNECTIONDIALOG_H__
#define __CONNECTIONDIALOG_H__
#include <QDialog>
#include <QSqlDatabase>
#include <QHash>
#include "ui_connectiondialog.h"
#include "types.h"
class ConnectionListItem;
class ConnectionDialog :
public QDialog, Ui::ConnectionDialog
{
Q_OBJECT
public:
ConnectionDialog(QWidget *parent = 0, Qt::WFlags f = 0);
public slots:
void readSettings();
void writeSettings();
signals:
void settingsWritten();
private slots:
void checkConnectionFields();
void addConnection();
void saveConnection();
void deleteConnection();
void itemConnectionSelected(QListWidgetItem*);
void addDbConnection(ConnectionSettings*);
void checkSelectedDriver(const QString &driverName);
void browseFiles();
void editConnection();
private:
void setupObjectConnections();
void setupDriversList();
bool eventFilter(QObject *watched, QEvent *event);
void restoreUIState();
void clearFields();
// void findDriverInList(const QString &driverName);
QHash<QString, QSqlDatabase>connectionHash;
QHash<QString, int> driversListIndexes;
bool saved;
};
#endif // __CONNECTIONDIALOG_H__
|
/*
* Minion http://minion.sourceforge.net
* Copyright (C) 2006-09
*
* 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 CONSTANT_VAR_FDSK
#define CONSTANT_VAR_FDSK
class AbstractConstraint;
struct ConstantVar {
// TODO: This really only needs enough to get 'fail'
static const BOOL isBool = false;
static const BoundType isBoundConst = Bound_No;
// Hmm.. no sure if it's better to make this true or false.
BOOL isBound() const {
return false;
}
DomainInt val;
AnyVarRef popOneMapper() const {
FATAL_REPORTABLE_ERROR();
}
explicit ConstantVar(DomainInt _val) : val(_val) {}
ConstantVar() {}
ConstantVar(const ConstantVar& b) : val(b.val) {}
BOOL isAssigned() const {
return true;
}
DomainInt getAssignedValue() const {
return val;
}
BOOL isAssignedValue(DomainInt i) const {
return i == val;
}
BOOL inDomain(DomainInt b) const {
return b == val;
}
BOOL inDomain_noBoundCheck(DomainInt b) const {
D_ASSERT(b == val);
return true;
}
DomainInt getDomSize() const {
return 1;
}
DomainInt getMax() const {
return val;
}
DomainInt getMin() const {
return val;
}
DomainInt getInitialMax() const {
return val;
}
DomainInt getInitialMin() const {
return val;
}
void setMax(DomainInt i) {
if(i < val)
getState().setFailed(true);
}
void setMin(DomainInt i) {
if(i > val)
getState().setFailed(true);
}
void uncheckedAssign(DomainInt) {
FAIL_EXIT();
}
void assign(DomainInt b) {
if(b != val)
getState().setFailed(true);
}
void removeFromDomain(DomainInt b) {
if(b == val)
getState().setFailed(true);
}
void addDynamicTrigger(Trig_ConRef t, TrigType, DomainInt = NoDomainValue,
TrigOp op = TO_Default) {
attachTriggerToNullList(t, op);
}
vector<AbstractConstraint*>* getConstraints() {
return NULL;
}
void addConstraint(AbstractConstraint* c) {
;
}
DomainInt getBaseVal(DomainInt v) const {
D_ASSERT(v == val);
return val;
}
Var getBaseVar() const {
return Var(VAR_CONSTANT, val);
}
vector<Mapper> getMapperStack() const {
return vector<Mapper>();
}
#ifdef WDEG
DomainInt getBaseWdeg() {
return 0;
} // wdeg is irrelevant for non-search var
void incWdeg() {
;
}
#endif
DomainInt getDomainChange(DomainDelta d) {
D_ASSERT(d.XXX_get_domain_diff() == 0);
return 0;
}
friend std::ostream& operator<<(std::ostream& o, const ConstantVar& constant) {
return o << "Constant" << constant.val;
}
};
#endif
|
/*
* font.h header for access to fontdevice
*
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
* 1998- <masaki-c@is.aist-nara.ac.jp>
*
* 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: font.h,v 1.9 2002/12/21 12:28:35 chikama Exp $ */
#ifndef __FONT_H__
#define __FONT_H__
#include <SDL_surface.h>
#include "config.h"
#include "portab.h"
/* font の種類 */
#define FONTTYPEMAX 2
extern void font_init(void);
extern void font_set_name_and_index(int type, const char *name, int index);
extern void font_set_antialias(boolean enable);
extern boolean font_get_antialias(void);
extern void font_select(int type, int size);
extern struct SDL_Surface *font_get_glyph(const char *str_utf8);
extern SDL_Rect font_draw_glyph(int x, int y, const char *str_utf8, BYTE col);
#ifdef __EMSCRIPTEN__
extern int load_mincho_font(void);
#endif
#endif /* __FONT_H__ */
|
#pragma once
template<typename T, typename C>
class Property {
public:
using SetterType = void (C::*)(T);
using GetterType = T(C::*)() const;
Property(C* theObject, SetterType theSetter, GetterType theGetter)
:itsObject(theObject),
itsSetter(theSetter),
itsGetter(theGetter)
{ }
operator T() const
{
return (itsObject->*itsGetter)();
}
C& operator = (T theValue) {
(itsObject->*itsSetter)(theValue);
return *itsObject;
}
private:
C* const itsObject;
SetterType const itsSetter;
GetterType const itsGetter;
};
static int CountChars(String _data, char _separator) {
int count = 0;
for (int i = 0; i < _data.length(); i++)
if (_data[i] == _separator)
count++;
return count;
}
static String GetStringPartByNr(String data, char separator, int index)
{
// spliting a string and return the part nr index
// split by separator
int stringData = 0; //variable to count data part nr
String dataPart = ""; //variable to hole the return text
for (int i = 0; i < data.length(); i++) { //Walk through the text one letter at a time
if (data[i] == separator) {
//Count the number of times separator character appears in the text
stringData++;
}
else if (stringData == index) {
//get the text when separator is the rignt one
dataPart.concat(data[i]);
}
else if (stringData > index) {
//return text and stop if the next separator appears - to save CPU-time
return dataPart;
break;
}
}
//return text if this is the last part
return dataPart;
}
//Task Messages
enum MessageClass
{
MessageClass_Heartbeat,
MessageClass_Button,
MessageClass_Float,
MessageClass_Extern,
MessageClass_Mqqt
};
enum Button_State
{
buttonstate_released = 0b00000000,
buttonstate_pressed = 0b00000001,
buttonstate_autorepeat = 0b00000011,
buttonstate_tracking = 0b10000001
};
struct TaskMessage
{
TaskMessage(uint8_t classEnum, uint8_t size) :
size(size),
Class(classEnum)
{
};
uint8_t size;
uint8_t Class;
};
struct HeartbeatMessage : TaskMessage
{
HeartbeatMessage(bool state) :
TaskMessage(MessageClass_Heartbeat, sizeof(HeartbeatMessage)),
State(state)
{
};
bool State;
};
struct ButtonMessage : TaskMessage
{
ButtonMessage(int id, uint32_t state) :
TaskMessage(MessageClass_Button, sizeof(ButtonMessage)),
Id(id),
State(state)
{
};
int Id;
uint32_t State;
};
//Template please
struct FloatMessage : TaskMessage
{
FloatMessage(int _id, float _absvalue) :
TaskMessage(MessageClass_Float, sizeof(FloatMessage)),
__id(_id),
__absValue(_absvalue)
{
};
int __id;
float __absValue;
};
struct ExternMessage : TaskMessage
{
ExternMessage(int _Id, int _CmdId, String _Value) :
TaskMessage(MessageClass_Extern, sizeof(ExternMessage))
{
__Id = _Id;
__CmdId = _CmdId;
__Value = _Value;
};
int __Id;
int __CmdId;
String __Value;
};
struct MqqtMessage : TaskMessage
{
MqqtMessage(char message[50]) :
TaskMessage(MessageClass_Mqqt, sizeof(MqqtMessage))
{
*Message = *message;
};
char Message[50];
};
|
///////////////////////////////////////////////////////////
// NYSuace.h
// Implementation of the Class NYSuace
// Created on: 05-10ÔÂ-2015 19:49:55
// Original author: huoyao
///////////////////////////////////////////////////////////
#if !defined(EA_84260EC1_BF6F_48fd_A22B_843840BAC20C__INCLUDED_)
#define EA_84260EC1_BF6F_48fd_A22B_843840BAC20C__INCLUDED_
#include "Sauce.h"
namespace AbstractFactory
{
class NYSuace : public Sauce
{
public:
NYSuace();
virtual ~NYSuace();
};
}
#endif // !defined(EA_84260EC1_BF6F_48fd_A22B_843840BAC20C__INCLUDED_)
|
#include <acpi/acpi.h>
#include "accommon.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utmutex")
/* Local prototypes */
static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id);
static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);
acpi_status acpi_ut_mutex_initialize(void)
{
u32 i;
acpi_status status;
ACPI_FUNCTION_TRACE(ut_mutex_initialize);
/* Create each of the predefined mutex objects */
for (i = 0; i < ACPI_NUM_MUTEX; i++) {
status = acpi_ut_create_mutex(i);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
/* Create the spinlocks for use at interrupt level */
spin_lock_init(acpi_gbl_gpe_lock);
spin_lock_init(acpi_gbl_hardware_lock);
/* Create the reader/writer lock for namespace access */
status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock);
return_ACPI_STATUS(status);
}
void acpi_ut_mutex_terminate(void)
{
u32 i;
ACPI_FUNCTION_TRACE(ut_mutex_terminate);
/* Delete each predefined mutex object */
for (i = 0; i < ACPI_NUM_MUTEX; i++) {
acpi_ut_delete_mutex(i);
}
/* Delete the spinlocks */
acpi_os_delete_lock(acpi_gbl_gpe_lock);
acpi_os_delete_lock(acpi_gbl_hardware_lock);
/* Delete the reader/writer lock */
acpi_ut_delete_rw_lock(&acpi_gbl_namespace_rw_lock);
return_VOID;
}
static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
if (!acpi_gbl_mutex_info[mutex_id].mutex) {
status =
acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex);
acpi_gbl_mutex_info[mutex_id].thread_id =
ACPI_MUTEX_NOT_ACQUIRED;
acpi_gbl_mutex_info[mutex_id].use_count = 0;
}
return_ACPI_STATUS(status);
}
static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
{
ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
acpi_gbl_mutex_info[mutex_id].mutex = NULL;
acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
}
acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
{
acpi_status status;
acpi_thread_id this_thread_id;
ACPI_FUNCTION_NAME(ut_acquire_mutex);
if (mutex_id > ACPI_MAX_MUTEX) {
return (AE_BAD_PARAMETER);
}
this_thread_id = acpi_os_get_thread_id();
#ifdef ACPI_MUTEX_DEBUG
{
u32 i;
/*
* Mutex debug code, for internal debugging only.
*
* Deadlock prevention. Check if this thread owns any mutexes of value
* greater than or equal to this one. If so, the thread has violated
* the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
ACPI_ERROR((AE_INFO,
"Mutex [%s] already acquired by this thread [%p]",
acpi_ut_get_mutex_name
(mutex_id),
ACPI_CAST_PTR(void,
this_thread_id)));
return (AE_ALREADY_ACQUIRED);
}
ACPI_ERROR((AE_INFO,
"Invalid acquire order: Thread %p owns [%s], wants [%s]",
ACPI_CAST_PTR(void, this_thread_id),
acpi_ut_get_mutex_name(i),
acpi_ut_get_mutex_name(mutex_id)));
return (AE_ACQUIRE_DEADLOCK);
}
}
}
#endif
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
"Thread %p attempting to acquire Mutex [%s]\n",
ACPI_CAST_PTR(void, this_thread_id),
acpi_ut_get_mutex_name(mutex_id)));
status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex,
ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
"Thread %p acquired Mutex [%s]\n",
ACPI_CAST_PTR(void, this_thread_id),
acpi_ut_get_mutex_name(mutex_id)));
acpi_gbl_mutex_info[mutex_id].use_count++;
acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
} else {
ACPI_EXCEPTION((AE_INFO, status,
"Thread %p could not acquire Mutex [0x%X]",
ACPI_CAST_PTR(void, this_thread_id), mutex_id));
}
return (status);
}
acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
{
acpi_thread_id this_thread_id;
ACPI_FUNCTION_NAME(ut_release_mutex);
this_thread_id = acpi_os_get_thread_id();
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
ACPI_CAST_PTR(void, this_thread_id),
acpi_ut_get_mutex_name(mutex_id)));
if (mutex_id > ACPI_MAX_MUTEX) {
return (AE_BAD_PARAMETER);
}
/*
* Mutex must be acquired in order to release it!
*/
if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
ACPI_ERROR((AE_INFO,
"Mutex [0x%X] is not acquired, cannot release",
mutex_id));
return (AE_NOT_ACQUIRED);
}
#ifdef ACPI_MUTEX_DEBUG
{
u32 i;
/*
* Mutex debug code, for internal debugging only.
*
* Deadlock prevention. Check if this thread owns any mutexes of value
* greater than this one. If so, the thread has violated the mutex
* ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
continue;
}
ACPI_ERROR((AE_INFO,
"Invalid release order: owns [%s], releasing [%s]",
acpi_ut_get_mutex_name(i),
acpi_ut_get_mutex_name(mutex_id)));
return (AE_RELEASE_DEADLOCK);
}
}
}
#endif
/* Mark unlocked FIRST */
acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
acpi_os_release_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
return (AE_OK);
}
|
#ifndef __sctp_ulpqueue_h__
#define __sctp_ulpqueue_h__
/* A structure to carry information to the ULP (e.g. Sockets API) */
struct sctp_ulpq {
char malloced;
char pd_mode;
struct sctp_association *asoc;
struct sk_buff_head reasm;
struct sk_buff_head lobby;
};
/* Prototypes. */
struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
struct sctp_association *);
void sctp_ulpq_flush(struct sctp_ulpq *ulpq);
void sctp_ulpq_free(struct sctp_ulpq *);
/* Add a new DATA chunk for processing. */
int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
/* Add a new event for propagation to the ULP. */
int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
/* Renege previously received chunks. */
void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
/* Perform partial delivery. */
void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
/* Abort the partial delivery. */
void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
/* Clear the partial data delivery condition on this socket. */
int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc);
/* Skip over an SSN. */
void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn);
void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *, __u32);
#endif /* __sctp_ulpqueue_h__ */
|
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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/>.
*/
#include "../private.h"
#include "saml2_subject_confirmation_data.h"
/**
* SECTION:saml2_subject_confirmation_data
* @short_description: <saml2:SubjectConfirmationData>
*
* <figure><title>Schema fragment for saml2:SubjectConfirmationData</title>
* <programlisting><![CDATA[
*
* <complexType name="SubjectConfirmationDataType" mixed="true">
* <complexContent>
* <restriction base="anyType">
* <sequence>
* <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
* </sequence>
* <attribute name="NotBefore" type="dateTime" use="optional"/>
* <attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
* <attribute name="Recipient" type="anyURI" use="optional"/>
* <attribute name="InResponseTo" type="NCName" use="optional"/>
* <attribute name="Address" type="string" use="optional"/>
* <anyAttribute namespace="##other" processContents="lax"/>
* </restriction>
* </complexContent>
* </complexType>
* ]]></programlisting>
* </figure>
*/
struct _LassoSaml2SubjectConfirmationDataPrivate {
GList *any;
GHashTable *attributes;
};
/*****************************************************************************/
/* private methods */
/*****************************************************************************/
static struct XmlSnippet schema_snippets[] = {
{ "NotBefore", SNIPPET_ATTRIBUTE,
G_STRUCT_OFFSET(LassoSaml2SubjectConfirmationData, NotBefore), NULL, NULL, NULL},
{ "NotOnOrAfter", SNIPPET_ATTRIBUTE,
G_STRUCT_OFFSET(LassoSaml2SubjectConfirmationData, NotOnOrAfter), NULL, NULL, NULL},
{ "Recipient", SNIPPET_ATTRIBUTE,
G_STRUCT_OFFSET(LassoSaml2SubjectConfirmationData, Recipient), NULL, NULL, NULL},
{ "InResponseTo", SNIPPET_ATTRIBUTE,
G_STRUCT_OFFSET(LassoSaml2SubjectConfirmationData, InResponseTo), NULL, NULL, NULL},
{ "Address", SNIPPET_ATTRIBUTE,
G_STRUCT_OFFSET(LassoSaml2SubjectConfirmationData, Address), NULL, NULL, NULL},
{ "", SNIPPET_LIST_NODES | SNIPPET_ANY | SNIPPET_PRIVATE,
G_STRUCT_OFFSET(struct _LassoSaml2SubjectConfirmationDataPrivate, any), NULL, NULL, NULL},
{ "", SNIPPET_ATTRIBUTE | SNIPPET_ANY | SNIPPET_PRIVATE,
G_STRUCT_OFFSET(struct _LassoSaml2SubjectConfirmationDataPrivate, attributes), NULL, NULL, NULL},
{NULL, 0, 0, NULL, NULL, NULL}
};
static LassoNodeClass *parent_class = NULL;
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
class_init(LassoSaml2SubjectConfirmationDataClass *klass)
{
LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
parent_class = g_type_class_peek_parent(klass);
nclass->node_data = g_new0(LassoNodeClassData, 1);
lasso_node_class_set_nodename(nclass, "SubjectConfirmationData");
lasso_node_class_set_ns(nclass, LASSO_SAML2_ASSERTION_HREF, LASSO_SAML2_ASSERTION_PREFIX);
lasso_node_class_add_snippets(nclass, schema_snippets);
g_type_class_add_private(klass, sizeof(struct _LassoSaml2SubjectConfirmationDataPrivate));
}
GType
lasso_saml2_subject_confirmation_data_get_type()
{
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSaml2SubjectConfirmationDataClass),
NULL,
NULL,
(GClassInitFunc) class_init,
NULL,
NULL,
sizeof(LassoSaml2SubjectConfirmationData),
0,
NULL,
NULL
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSaml2SubjectConfirmationData", &this_info, 0);
}
return this_type;
}
/**
* lasso_saml2_subject_confirmation_data_new:
*
* Creates a new #LassoSaml2SubjectConfirmationData object.
*
* Return value: a newly created #LassoSaml2SubjectConfirmationData object
**/
LassoNode*
lasso_saml2_subject_confirmation_data_new()
{
return g_object_new(LASSO_TYPE_SAML2_SUBJECT_CONFIRMATION_DATA, NULL);
}
|
/*===================================================================*/
/* */
/* Mapper 246 : Phone Serm Berm */
/* */
/*===================================================================*/
/*-------------------------------------------------------------------*/
/* Initialize Mapper 246 */
/*-------------------------------------------------------------------*/
void Map246_Init()
{
/* Initialize Mapper */
MapperInit = Map246_Init;
/* Write to Mapper */
MapperWrite = Map0_Write;
/* Write to SRAM */
MapperSram = Map246_Sram;
/* Write to APU */
MapperApu = Map0_Apu;
/* Read from APU */
MapperReadApu = Map0_ReadApu;
/* Callback at VSync */
MapperVSync = Map0_VSync;
/* Callback at HSync */
MapperHSync = Map0_HSync;
/* Callback at PPU */
MapperPPU = Map0_PPU;
/* Callback at Rendering Screen ( 1:BG, 0:Sprite ) */
MapperRenderScreen = Map0_RenderScreen;
/* Set SRAM Banks */
SRAMBANK = SRAM;
/* Set ROM Banks */
ROMBANK0 = ROMPAGE( 0 );
ROMBANK1 = ROMPAGE( 1 );
ROMBANK2 = ROMLASTPAGE( 1 );
ROMBANK3 = ROMLASTPAGE( 0 );
/* Set up wiring of the interrupt pin */
K6502_Set_Int_Wiring( 1, 1 );
}
/*-------------------------------------------------------------------*/
/* Mapper 246 Write to SRAM Function */
/*-------------------------------------------------------------------*/
void Map246_Sram( WORD wAddr, BYTE byData )
{
if( wAddr>=0x6000 && wAddr<0x8000 ) {
switch( wAddr ) {
case 0x6000:
ROMBANK0 = ROMPAGE(((byData<<2)+0) % (NesHeader.byRomSize<<1));
break;
case 0x6001:
ROMBANK1 = ROMPAGE(((byData<<2)+1) % (NesHeader.byRomSize<<1));
break;
case 0x6002:
ROMBANK2 = ROMPAGE(((byData<<2)+2) % (NesHeader.byRomSize<<1));
break;
case 0x6003:
ROMBANK3 = ROMPAGE(((byData<<2)+3) % (NesHeader.byRomSize<<1));
break;
case 0x6004:
PPUBANK[ 0 ] = VROMPAGE(((byData<<1)+0) % (NesHeader.byVRomSize<<3));
PPUBANK[ 1 ] = VROMPAGE(((byData<<1)+1) % (NesHeader.byVRomSize<<3));
InfoNES_SetupChr();
break;
case 0x6005:
PPUBANK[ 2 ] = VROMPAGE(((byData<<1)+0) % (NesHeader.byVRomSize<<3));
PPUBANK[ 3 ] = VROMPAGE(((byData<<1)+1) % (NesHeader.byVRomSize<<3));
InfoNES_SetupChr();
break;
case 0x6006:
PPUBANK[ 4 ] = VROMPAGE(((byData<<1)+0) % (NesHeader.byVRomSize<<3));
PPUBANK[ 5 ] = VROMPAGE(((byData<<1)+1) % (NesHeader.byVRomSize<<3));
InfoNES_SetupChr();
break;
case 0x6007:
PPUBANK[ 6 ] = VROMPAGE(((byData<<1)+0) % (NesHeader.byVRomSize<<3));
PPUBANK[ 7 ] = VROMPAGE(((byData<<1)+1) % (NesHeader.byVRomSize<<3));
InfoNES_SetupChr();
break;
default:
SRAMBANK[wAddr&0x1FFF] = byData;
break;
}
}
}
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/DataAccess.framework/Frameworks/DAEAS.framework/DAEAS
*/
#import <DAEAS/ASParsing.h>
@protocol ASParsingWithSubItems <ASParsing>
- (id)initWithSubclassRuleSet:(id)subclassRuleSet;
@end
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
#define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
#include <map>
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
#include "base/containers/mru_cache.h"
#include "base/gtest_prod_util.h"
#include "base/threading/non_thread_safe.h"
#include "base/values.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_export.h"
#include "net/http/http_pipelined_host_capability.h"
#include "net/http/http_server_properties.h"
namespace base {
class ListValue;
}
namespace net {
class NET_EXPORT HttpServerPropertiesImpl
: public HttpServerProperties,
NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
HttpServerPropertiesImpl();
virtual ~HttpServerPropertiesImpl();
void InitializeSpdyServers(std::vector<std::string>* spdy_servers,
bool support_spdy);
void InitializeAlternateProtocolServers(
AlternateProtocolMap* alternate_protocol_servers);
void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map);
void InitializePipelineCapabilities(
const PipelineCapabilityMap* pipeline_capability_map);
void GetSpdyServerList(base::ListValue* spdy_server_list) const;
static std::string GetFlattenedSpdyServer(
const net::HostPortPair& host_port_pair);
static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair);
static void DisableForcedAlternateProtocol();
void SetNumPipelinedHostsToRemember(int max_size);
virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE;
virtual void Clear() OVERRIDE;
virtual bool SupportsSpdy(const HostPortPair& server) const OVERRIDE;
virtual void SetSupportsSpdy(const HostPortPair& server,
bool support_spdy) OVERRIDE;
virtual bool HasAlternateProtocol(const HostPortPair& server) const OVERRIDE;
virtual PortAlternateProtocolPair GetAlternateProtocol(
const HostPortPair& server) const OVERRIDE;
virtual void SetAlternateProtocol(
const HostPortPair& server,
uint16 alternate_port,
AlternateProtocol alternate_protocol) OVERRIDE;
virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE;
virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE;
virtual const SettingsMap& GetSpdySettings(
const HostPortPair& host_port_pair) const OVERRIDE;
virtual bool SetSpdySetting(const HostPortPair& host_port_pair,
SpdySettingsIds id,
SpdySettingsFlags flags,
uint32 value) OVERRIDE;
virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE;
virtual void ClearAllSpdySettings() OVERRIDE;
virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE;
virtual HttpPipelinedHostCapability GetPipelineCapability(
const HostPortPair& origin) OVERRIDE;
virtual void SetPipelineCapability(
const HostPortPair& origin,
HttpPipelinedHostCapability capability) OVERRIDE;
virtual void ClearPipelineCapabilities() OVERRIDE;
virtual PipelineCapabilityMap GetPipelineCapabilityMap() const OVERRIDE;
private:
typedef base::MRUCache<
HostPortPair, HttpPipelinedHostCapability> CachedPipelineCapabilityMap;
typedef base::hash_map<std::string, bool> SpdyServerHostPortTable;
SpdyServerHostPortTable spdy_servers_table_;
AlternateProtocolMap alternate_protocol_map_;
SpdySettingsMap spdy_settings_map_;
scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_;
base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
};
}
#endif
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright (C) 2009 Red Hat, Inc.
* Copyright (C) 2009 Shaun McCance <shaunm@gnome.org>
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Author: Shaun McCance <shaunm@gnome.org>
*/
#include "config.h"
#include <errno.h>
#include <string.h>
#include <glib/gi18n.h>
#include "yelp-bz2-decompressor.h"
static void yelp_bz2_decompressor_iface_init (GConverterIface *iface);
struct _YelpBz2Decompressor
{
GObject parent_instance;
bz_stream bzstream;
};
G_DEFINE_TYPE_WITH_CODE (YelpBz2Decompressor, yelp_bz2_decompressor, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_CONVERTER,
yelp_bz2_decompressor_iface_init))
static void
yelp_bz2_decompressor_finalize (GObject *object)
{
YelpBz2Decompressor *decompressor;
decompressor = YELP_BZ2_DECOMPRESSOR (object);
BZ2_bzDecompressEnd (&decompressor->bzstream);
G_OBJECT_CLASS (yelp_bz2_decompressor_parent_class)->finalize (object);
}
static void
yelp_bz2_decompressor_init (YelpBz2Decompressor *decompressor)
{
}
static void
yelp_bz2_decompressor_constructed (GObject *object)
{
YelpBz2Decompressor *decompressor;
int res;
decompressor = YELP_BZ2_DECOMPRESSOR (object);
res = BZ2_bzDecompressInit (&decompressor->bzstream, 0, FALSE);
if (res == BZ_MEM_ERROR )
g_error ("YelpBz2Decompressor: Not enough memory for bzip2 use");
if (res != BZ_OK)
g_error ("YelpBz2Decompressor: Unexpected bzip2 error");
}
static void
yelp_bz2_decompressor_class_init (YelpBz2DecompressorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = yelp_bz2_decompressor_finalize;
gobject_class->constructed = yelp_bz2_decompressor_constructed;
}
YelpBz2Decompressor *
yelp_bz2_decompressor_new (void)
{
YelpBz2Decompressor *decompressor;
decompressor = g_object_new (YELP_TYPE_BZ2_DECOMPRESSOR, NULL);
return decompressor;
}
static void
yelp_bz2_decompressor_reset (GConverter *converter)
{
YelpBz2Decompressor *decompressor = YELP_BZ2_DECOMPRESSOR (converter);
int res;
/* libbzip2 doesn't have a reset function. Ending and reiniting
* might do the trick. But this is untested. If reset matters
* to you, test this.
*/
BZ2_bzDecompressEnd (&decompressor->bzstream);
res = BZ2_bzDecompressInit (&decompressor->bzstream, 0, FALSE);
if (res == BZ_MEM_ERROR )
g_error ("YelpBz2Decompressor: Not enough memory for bzip2 use");
if (res != BZ_OK)
g_error ("YelpBz2Decompressor: Unexpected bzip2 error");
}
static GConverterResult
yelp_bz2_decompressor_convert (GConverter *converter,
const void *inbuf,
gsize inbuf_size,
void *outbuf,
gsize outbuf_size,
GConverterFlags flags,
gsize *bytes_read,
gsize *bytes_written,
GError **error)
{
YelpBz2Decompressor *decompressor;
gsize header_size;
int res;
decompressor = YELP_BZ2_DECOMPRESSOR (converter);
decompressor->bzstream.next_in = (void *)inbuf;
decompressor->bzstream.avail_in = inbuf_size;
decompressor->bzstream.next_out = outbuf;
decompressor->bzstream.avail_out = outbuf_size;
res = BZ2_bzDecompress (&decompressor->bzstream);
if (res == BZ_DATA_ERROR || res == BZ_DATA_ERROR_MAGIC) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
_("Invalid compressed data"));
return G_CONVERTER_ERROR;
}
if (res == BZ_MEM_ERROR) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Not enough memory"));
return G_CONVERTER_ERROR;
}
if (res == BZ_OK || res == BZ_STREAM_END) {
*bytes_read = inbuf_size - decompressor->bzstream.avail_in;
*bytes_written = outbuf_size - decompressor->bzstream.avail_out;
if (res == BZ_STREAM_END)
return G_CONVERTER_FINISHED;
return G_CONVERTER_CONVERTED;
}
g_assert_not_reached ();
}
static void
yelp_bz2_decompressor_iface_init (GConverterIface *iface)
{
iface->convert = yelp_bz2_decompressor_convert;
iface->reset = yelp_bz2_decompressor_reset;
}
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/* mdu-section-hub.h
*
* Copyright (C) 2007 David Zeuthen
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#include <gtk/gtk.h>
#include "mdu-section.h"
#ifndef MDU_SECTION_HUB_H
#define MDU_SECTION_HUB_H
#define MDU_TYPE_SECTION_HUB (mdu_section_hub_get_type ())
#define MDU_SECTION_HUB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MDU_TYPE_SECTION_HUB, MduSectionHub))
#define MDU_SECTION_HUB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), MDU_TYPE_SECTION_HUB, MduSectionHubClass))
#define MDU_IS_SECTION_HUB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MDU_TYPE_SECTION_HUB))
#define MDU_IS_SECTION_HUB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MDU_TYPE_SECTION_HUB))
#define MDU_SECTION_HUB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MDU_TYPE_SECTION_HUB, MduSectionHubClass))
typedef struct _MduSectionHubClass MduSectionHubClass;
typedef struct _MduSectionHub MduSectionHub;
struct _MduSectionHubPrivate;
typedef struct _MduSectionHubPrivate MduSectionHubPrivate;
struct _MduSectionHub
{
MduSection parent;
/* private */
MduSectionHubPrivate *priv;
};
struct _MduSectionHubClass
{
MduSectionClass parent_class;
};
GType mdu_section_hub_get_type (void);
GtkWidget *mdu_section_hub_new (MduShell *shell,
MduPresentable *presentable);
#endif /* MDU_SECTION_HUB_H */
|
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2017 Belledonne Communications SARL
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/>.
*/
#include "belle-sip/belle-sip.h"
#include "belle_sip_tester.h"
#include "belle_sip_internal.h"
/*test body*/
#include "belle_sip_base_uri_tester.c"
test_suite_t sip_uri_test_suite = {"SIP URI", NULL, NULL, belle_sip_tester_before_each, belle_sip_tester_after_each,
sizeof(uri_tests) / sizeof(uri_tests[0]), uri_tests};
|
/* This file is part of the KDE libraries
Copyright (C) 2001, 2002 Ellis Whitehead <ellis@kde.org>
Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
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 KKEYSEQUENCEWIDGET_P_H
#define KKEYSEQUENCEWIDGET_P_H
#include <QPushButton>
class KKeySequenceButton: public QPushButton
{
Q_OBJECT
public:
explicit KKeySequenceButton(KKeySequenceWidgetPrivate *d, QWidget *parent)
: QPushButton(parent),
d(d) {}
virtual ~KKeySequenceButton();
protected:
/**
* Reimplemented for internal reasons.
*/
virtual bool event(QEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
private:
KKeySequenceWidgetPrivate *const d;
};
#endif //KKEYSEQUENCEWIDGET_P_H
|
/**************
FILE : init.h
***************
PROJECT : SaX2 - library interface [header]
:
AUTHOR : Marcus Schäfer <ms@suse.de>
:
BELONGS TO : SaX2 - SuSE advanced X11 configuration
:
:
DESCRIPTION : native C++ class library to access SaX2
: functionality. Easy to use interface for
: //.../
: - importing/exporting X11 configurations
: - modifying/creating X11 configurations
: ---
:
:
STATUS : Status: Development
**************/
#ifndef SAX_INIT_H
#define SAX_INIT_H 1
//====================================
// Includes...
//------------------------------------
#include <stdlib.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include "processcall.h"
#include "exception.h"
namespace SaX {
//====================================
// Defines...
//------------------------------------
#define SAX_INIT "/usr/share/sax/init.pl"
#define CACHE_CONFIG "/var/cache/sax/files/config"
#define GET_PRIMARY "/usr/sbin/getPrimary"
#define GET_BASH "/bin/bash"
//====================================
// Interface class for dlopen ability
//------------------------------------
/*! \brief SaX2 - Init class interface.
*
* The interface class is provided to be able to dlopen the
* library and have all methods available in the compilers
* virtual table. For a detailed description of the class itself
* please refer to the derived class definition
*/
class SaXInitIF : public SaXException {
public:
virtual bool needInit (void) = 0;
virtual void ignoreProfile (void) = 0;
virtual void setPrimaryChip (void) = 0;
virtual void setValidBusID (void) = 0;
public:
virtual void doInit (void) = 0;
public:
virtual ~SaXInitIF ( void ) { }
};
//====================================
// Class SaXInit...
//------------------------------------
/*! \brief SaX2 - Init class.
*
* SaXInit is used to create the SaX cache files. SaX will provide a
* configuration suggestion which is the basis for all actions. To be
* sure not to make use of an outdated cache every program using libsax
* should create this cache first. The following example illustrates
* that more detailed:
*
* \code
* #include <sax/sax.h>
*
* SaXInit init;
* if (init.needInit()) {
* printf ("initialize cache...\n");
* //init.ignoreProfile();
* init.doInit();
* }
* \endcode
*/
class SaXInit : public SaXInitIF {
private:
QList<const char*> mOptions;
public:
bool needInit (void);
void ignoreProfile (void);
void setPrimaryChip (void);
void setValidBusID (void);
public:
void doInit (void);
public:
SaXInit ( QList<const char*> );
SaXInit ( void );
};
} // end namespace
#endif
|
/*
* SPI flash internal definitions
*
* Copyright (C) 2008 Atmel Corporation
* Copyright (C) 2013 Jagannadha Sutradharudu Teki, Xilinx Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _SF_INTERNAL_H_
#define _SF_INTERNAL_H_
#define SPI_FLASH_16MB_BOUN 0x1000000
#define STATUS_QEB_MXIC (1 << 6)
/* SECT flags */
#define SECT_4K (1 << 1)
#define SECT_32K (1 << 2)
#define E_FSR (1 << 3)
/* Erase commands */
#define CMD_ERASE_4K 0x20
#define CMD_ERASE_32K 0x52
#define CMD_ERASE_CHIP 0xc7
#define CMD_ERASE_64K 0xd8
/* Write commands */
#define CMD_WRITE_STATUS 0x01
#define CMD_PAGE_PROGRAM 0x02
#define CMD_WRITE_DISABLE 0x04
#define CMD_READ_STATUS 0x05
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ_CONFIG 0x35
#define CMD_FLAG_STATUS 0x70
/* Read commands */
#define CMD_READ_ARRAY_SLOW 0x03
#define CMD_READ_ARRAY_FAST 0x0b
#define CMD_READ_ID 0x9f
/* Bank addr access commands */
#ifdef CONFIG_SPI_FLASH_BAR
# define CMD_BANKADDR_BRWR 0x17
# define CMD_BANKADDR_BRRD 0x16
# define CMD_EXTNADDR_WREAR 0xC5
# define CMD_EXTNADDR_RDEAR 0xC8
#endif
/* Common status */
#define STATUS_WIP 0x01
#define STATUS_PEC 0x80
/* Flash timeout values */
#define SPI_FLASH_PROG_TIMEOUT (2 * CONFIG_SYS_HZ)
#define SPI_FLASH_PAGE_ERASE_TIMEOUT (5 * CONFIG_SYS_HZ)
#define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONFIG_SYS_HZ)
/* SST specific */
#ifdef CONFIG_SPI_FLASH_SST
# define SST_WP 0x01 /* Supports AAI word program */
# define CMD_SST_BP 0x02 /* Byte Program */
# define CMD_SST_AAI_WP 0xAD /* Auto Address Incr Word Program */
int sst_write_wp(struct spi_flash *flash, u32 offset, size_t len,
const void *buf);
#endif
/* Send a single-byte command to the device and read the response */
int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);
/*
* Send a multi-byte command to the device and read the response. Used
* for flash array reads, etc.
*/
int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,
size_t cmd_len, void *data, size_t data_len);
/*
* Send a multi-byte command to the device followed by (optional)
* data. Used for programming the flash array, etc.
*/
int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
const void *data, size_t data_len);
/* Flash erase(sectors) operation, support all possible erase commands */
int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len);
/* Program the status register */
int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr);
/* Set quad enbale bit */
int spi_flash_set_qeb(struct spi_flash *flash);
int spi_flash_set_qeb_mxic(struct spi_flash *flash);
/* Enable writing on the SPI flash */
static inline int spi_flash_cmd_write_enable(struct spi_flash *flash)
{
return spi_flash_cmd(flash->spi, CMD_WRITE_ENABLE, NULL, 0);
}
/* Disable writing on the SPI flash */
static inline int spi_flash_cmd_write_disable(struct spi_flash *flash)
{
return spi_flash_cmd(flash->spi, CMD_WRITE_DISABLE, NULL, 0);
}
/*
* Send the read status command to the device and wait for the wip
* (write-in-progress) bit to clear itself.
*/
int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout);
/*
* Used for spi_flash write operation
* - SPI claim
* - spi_flash_cmd_write_enable
* - spi_flash_cmd_write
* - spi_flash_cmd_wait_ready
* - SPI release
*/
int spi_flash_write_common(struct spi_flash *flash, const u8 *cmd,
size_t cmd_len, const void *buf, size_t buf_len);
/*
* Flash write operation, support all possible write commands.
* Write the requested data out breaking it up into multiple write
* commands as needed per the write size.
*/
int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
size_t len, const void *buf);
/*
* Same as spi_flash_cmd_read() except it also claims/releases the SPI
* bus. Used as common part of the ->read() operation.
*/
int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
size_t cmd_len, void *data, size_t data_len);
/* Flash read operation, support all possible read commands */
int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
size_t len, void *data);
#endif /* _SF_INTERNAL_H_ */
|
/***************************************************************************
* Copyright (C) 2005 by Jean-Michel Petit *
* jm_petit@laposte.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef K9CELLCOPYLIST_H
#define K9CELLCOPYLIST_H
#include "k9common.h"
#include "k9dvd.h"
#include "k9cell.h"
#include "k9dvdread.h"
class k9CellCopyVTS {
private:
uint num;
uint64_t size;
public:
k9CellCopyVTS (int _num) {
num=_num;
size=0;
};
uint getnum() ;
void addsize(uint32_t _size) ;
uint64_t getsize() ;
};
/**
@author Jean-Michel PETIT
*/
class k9CellVTSList : public QPtrList<k9CellCopyVTS> {
protected:
int compareItems ( QPtrCollection::Item item1, QPtrCollection::Item item2 );
};
class k9CellCopyList : public QObjectList {
public:
k9CellCopyList(k9DVDRead * _dvdHandle,k9DVD *_DVD);
double getfactor(bool _withMenus,bool _streams);
double gettotalSize();
double getforcedSize(bool _withFactor);
double getMinFactor(bool _withMenus);
k9CellVTSList VTSList;
~k9CellCopyList();
void addInbytes(const uint64_t& _value) {
m_inbytes += _value;
}
void addOutbytes(const uint64_t& _value) {
m_outbytes += _value;
}
void addFrcinbytes(const uint64_t& _value) {
m_frcinbytes += _value;
}
void addFrcoutbytes(const uint64_t& _value) {
m_frcoutbytes += _value;
}
private:
k9DVD *DVD;
k9DVDRead *dvdHandle;
uint64_t m_inbytes,m_outbytes;
uint64_t m_frcinbytes,m_frcoutbytes;
void fill();
k9Cell *addCell(int _VTS,int _pgc,int _id,uint32_t startSector,uint32_t lastSector,uchar _angleBlock);
bool checkSelected(k9Cell *_cell);
void addStreams(k9DVDTitle *_title,k9Cell *_cell);
void setVTS(uint _numVTS,uint32_t _size);
//QPtrList <k9CellCopyVTS> VTSList;
void sortVTSList();
};
#endif
|
/*
* synergy-plus -- mouse and keyboard sharing utility
* Copyright (C) 2009 The Synergy+ Project
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CEVENT_H
#define CEVENT_H
#include "BasicTypes.h"
#include "stdmap.h"
//! Event
/*!
A \c CEvent holds an event type and a pointer to event data.
*/
class CEvent {
public:
typedef UInt32 Type;
enum {
kUnknown, //!< The event type is unknown
kQuit, //!< The quit event
kSystem, //!< The data points to a system event type
kTimer, //!< The data points to timer info
kLast //!< Must be last
};
typedef UInt32 Flags;
enum {
kNone = 0x00, //!< No flags
kDeliverImmediately = 0x01, //!< Dispatch and free event immediately
kDontFreeData = 0x02 //!< Don't free data in deleteData
};
CEvent();
//! Create \c CEvent with data
/*!
The \p type must have been registered using \c registerType().
The \p data must be POD (plain old data) allocated by malloc(),
which means it cannot have a constructor, destructor or be
composed of any types that do. \p target is the intended
recipient of the event. \p flags is any combination of \c Flags.
*/
CEvent(Type type, void* target = NULL, void* data = NULL,
UInt32 flags = kNone);
//! @name manipulators
//@{
//! Creates a new event type
/*!
Returns a unique event type id.
*/
static Type registerType(const char* name);
//! Creates a new event type
/*!
If \p type contains \c kUnknown then it is set to a unique event
type id otherwise it is left alone. The final value of \p type
is returned.
*/
static Type registerTypeOnce(Type& type, const char* name);
//! Get name for event
/*!
Returns the name for the event \p type. This is primarily for
debugging.
*/
static const char* getTypeName(Type type);
//! Release event data
/*!
Deletes event data for the given event (using free()).
*/
static void deleteData(const CEvent&);
//@}
//! @name accessors
//@{
//! Get event type
/*!
Returns the event type.
*/
Type getType() const;
//! Get the event target
/*!
Returns the event target.
*/
void* getTarget() const;
//! Get the event data
/*!
Returns the event data.
*/
void* getData() const;
//! Get event flags
/*!
Returns the event flags.
*/
Flags getFlags() const;
//@}
private:
Type m_type;
void* m_target;
void* m_data;
Flags m_flags;
};
#endif
|
/* arch/arm/mach-s3c64xx/include/macht/s3c6400.h
*
* Copyright 2008 Openmoko, Inc.
* Copyright 2008 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
* http://armlinux.simtec.co.uk/
*
* Header file for s3c6400 cpu support
*
* 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.
*/
/* Common init code for S3C6400 related SoCs */
extern void s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
extern void s3c6400_setup_clocks(void);
extern void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit);
#ifdef CONFIG_CPU_S3C6400
extern int s3c6400_init(void);
extern void s3c6400_init_irq(void);
extern void s3c6400_map_io(void);
extern void s3c6400_init_clocks(int xtal);
#define s3c6400_init_uarts s3c6400_common_init_uarts
#else
#define s3c6400_init_clocks NULL
#define s3c6400_init_uarts NULL
#define s3c6400_map_io NULL
#define s3c6400_init NULL
#endif
|
#ifndef __BOSS_BLOODPRINCEKELESETH_H_
#define __BOSS_BLOODPRINCEKELESETH_H_
#include "BloodPrinceCouncil.h"
class BossBloodPrinceKelesethAI : public BossAI
{
public:
BossBloodPrinceKelesethAI(Creature* creature) : BossAI(creature, DATA_BLOOD_PRINCE_COUNCIL)
{
_isEmpowered = false;
_spawnHealth = creature->GetMaxHealth();
}
void InitializeAI();
void Reset();
void EnterCombat(Unit* /*who*/);
void JustDied(Unit* /*killer*/);
void JustReachedHome();
void JustRespawned();
void SpellHit(Unit* /*caster*/, SpellInfo const* spell);
void JustSummoned(Creature* summon);
void DamageDealt(Unit* /*target*/, uint32& damage, DamageEffectType damageType);
void DamageTaken(Unit* attacker, uint32& damage);
void KilledUnit(Unit* victim);
void DoAction(int32 const action);
bool CheckRoom();
void UpdateAI(uint32 const diff);
private:
uint32 _spawnHealth;
bool _isEmpowered;
};
class BossBloodPrinceKeleseth : public CreatureScript
{
public:
BossBloodPrinceKeleseth() : CreatureScript("boss_prince_keleseth_icc") { }
CreatureAI* GetAI(Creature* creature) const
{
return GetIcecrownCitadelAI<BossBloodPrinceKelesethAI>(creature);
}
};
#endif |
/* Airhook protocol library, copyright 2001 Dan Egnor.
* This software comes with ABSOLUTELY NO WARRANTY. You may redistribute it
* under the terms of the GNU General Public License, version 2.
* See the file COPYING for more details. */
#ifndef AIRHOOK_H
#define AIRHOOK_H
#include <stddef.h>
#ifndef AIRHOOK_DEBUG
# ifdef NDEBUG
# define AIRHOOK_DEBUG 0
# else
# define AIRHOOK_DEBUG 1
# endif
#endif
struct airhook_time {
unsigned long second;
unsigned long nanosecond;
};
struct airhook_data {
const unsigned char *begin;
const unsigned char *end;
};
enum airhook_state { ah_pending, ah_sent, ah_confirmed, ah_discarded };
struct airhook_settings {
struct airhook_time retransmit;
unsigned long window_size;
};
struct airhook_status {
struct airhook_settings settings;
unsigned long session,remote_session;
enum airhook_state state,remote_state;
signed long wanted;
struct airhook_time last_transmit;
struct airhook_time next_transmit;
struct airhook_time last_response;
};
struct airhook_outgoing_status {
struct airhook_data data;
void *user;
enum airhook_state state;
unsigned long transmit_count;
struct airhook_time last_change;
};
enum { airhook_bits = 8 };
enum { airhook_size = 1 << airhook_bits };
enum { airhook_message_size = airhook_size - 1 };
struct airhook_socket;
struct airhook_outgoing;
#include "airhook-internal.h"
void airhook_init(struct airhook_socket *,unsigned long session);
void airhook_settings(struct airhook_socket *,struct airhook_settings);
struct airhook_status airhook_status(const struct airhook_socket *);
/* -- top half -------------------------------------------------------------- */
int airhook_next_incoming(struct airhook_socket *,struct airhook_data *);
int airhook_next_changed(struct airhook_socket *,struct airhook_outgoing **);
void airhook_init_outgoing(struct airhook_outgoing *,
struct airhook_socket *,
struct airhook_data,void *user);
void airhook_discard_outgoing(struct airhook_outgoing *);
struct airhook_outgoing_status airhook_outgoing_status(
const struct airhook_outgoing *);
/* -- bottom half ----------------------------------------------------------- */
size_t airhook_transmit(
struct airhook_socket *,
struct airhook_time now,
size_t length,unsigned char *data);
int airhook_receive(struct airhook_socket *,
struct airhook_time now,
struct airhook_data data);
#endif
|
/* linux/arch/arm/mach-s5p64x0/pm.c
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* S5P64X0 Power Management Support
*
* Based on arch/arm/mach-s3c64xx/pm.c by Ben Dooks
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/io.h>
#include <plat/cpu.h>
#include <plat/pm.h>
#include <plat/regs-timer.h>
#include <plat/wakeup-mask.h>
#include <mach/regs-clock.h>
#include <mach/regs-gpio.h>
static struct sleep_save s5p64x0_core_save[] = {
SAVE_ITEM(S5P64X0_APLL_CON),
SAVE_ITEM(S5P64X0_MPLL_CON),
SAVE_ITEM(S5P64X0_EPLL_CON),
SAVE_ITEM(S5P64X0_EPLL_CON_K),
SAVE_ITEM(S5P64X0_CLK_SRC0),
SAVE_ITEM(S5P64X0_CLK_SRC1),
SAVE_ITEM(S5P64X0_CLK_DIV0),
SAVE_ITEM(S5P64X0_CLK_DIV1),
SAVE_ITEM(S5P64X0_CLK_DIV2),
SAVE_ITEM(S5P64X0_CLK_DIV3),
SAVE_ITEM(S5P64X0_CLK_GATE_MEM0),
SAVE_ITEM(S5P64X0_CLK_GATE_HCLK1),
SAVE_ITEM(S5P64X0_CLK_GATE_SCLK1),
};
static struct sleep_save s5p64x0_misc_save[] = {
SAVE_ITEM(S5P64X0_AHB_CON0),
SAVE_ITEM(S5P64X0_SPCON0),
SAVE_ITEM(S5P64X0_SPCON1),
SAVE_ITEM(S5P64X0_MEM0CONSLP0),
SAVE_ITEM(S5P64X0_MEM0CONSLP1),
SAVE_ITEM(S5P64X0_MEM0DRVCON),
SAVE_ITEM(S5P64X0_MEM1DRVCON),
SAVE_ITEM(S3C64XX_TINT_CSTAT),
};
/* DPLL is present only in S5P6450 */
static struct sleep_save s5p6450_core_save[] = {
SAVE_ITEM(S5P6450_DPLL_CON),
SAVE_ITEM(S5P6450_DPLL_CON_K),
};
void s3c_pm_configure_extint(void)
{
__raw_writel(s3c_irqwake_eintmask, S5P64X0_EINT_WAKEUP_MASK);
}
void s3c_pm_restore_core(void)
{
__raw_writel(0, S5P64X0_EINT_WAKEUP_MASK);
s3c_pm_do_restore_core(s5p64x0_core_save,
ARRAY_SIZE(s5p64x0_core_save));
if (soc_is_s5p6450())
s3c_pm_do_restore_core(s5p6450_core_save,
ARRAY_SIZE(s5p6450_core_save));
s3c_pm_do_restore(s5p64x0_misc_save, ARRAY_SIZE(s5p64x0_misc_save));
}
void s3c_pm_save_core(void)
{
s3c_pm_do_save(s5p64x0_misc_save, ARRAY_SIZE(s5p64x0_misc_save));
if (soc_is_s5p6450())
s3c_pm_do_save(s5p6450_core_save,
ARRAY_SIZE(s5p6450_core_save));
s3c_pm_do_save(s5p64x0_core_save, ARRAY_SIZE(s5p64x0_core_save));
}
static int s5p64x0_cpu_suspend(unsigned long arg)
{
unsigned long tmp = 0;
/*
* Issue the standby signal into the pm unit. Note, we
* issue a write-buffer drain just in case.
*/
asm("b 1f\n\t"
".align 5\n\t"
"1:\n\t"
"mcr p15, 0, %0, c7, c10, 5\n\t"
"mcr p15, 0, %0, c7, c10, 4\n\t"
"mcr p15, 0, %0, c7, c0, 4" : : "r" (tmp));
/* we should never get past here */
panic("sleep resumed to originator?");
}
/* mapping of interrupts to parts of the wakeup mask */
static struct samsung_wakeup_mask s5p64x0_wake_irqs[] = {
{ .irq = IRQ_RTC_ALARM, .bit = S5P64X0_PWR_CFG_RTC_ALRM_DISABLE, },
{ .irq = IRQ_RTC_TIC, .bit = S5P64X0_PWR_CFG_RTC_TICK_DISABLE, },
{ .irq = IRQ_HSMMC0, .bit = S5P64X0_PWR_CFG_MMC0_DISABLE, },
{ .irq = IRQ_HSMMC1, .bit = S5P64X0_PWR_CFG_MMC1_DISABLE, },
};
static void s5p64x0_pm_prepare(void)
{
u32 tmp;
samsung_sync_wakemask(S5P64X0_PWR_CFG,
s5p64x0_wake_irqs, ARRAY_SIZE(s5p64x0_wake_irqs));
/* store the resume address in INFORM0 register */
__raw_writel(virt_to_phys(s3c_cpu_resume), S5P64X0_INFORM0);
/* setup clock gating for FIMGVG block */
__raw_writel((__raw_readl(S5P64X0_CLK_GATE_HCLK1) | \
(S5P64X0_CLK_GATE_HCLK1_FIMGVG)), S5P64X0_CLK_GATE_HCLK1);
__raw_writel((__raw_readl(S5P64X0_CLK_GATE_SCLK1) | \
(S5P64X0_CLK_GATE_SCLK1_FIMGVG)), S5P64X0_CLK_GATE_SCLK1);
/* Configure the stabilization counter with wait time required */
__raw_writel(S5P64X0_PWR_STABLE_PWR_CNT_VAL4, S5P64X0_PWR_STABLE);
/* set WFI to SLEEP mode configuration */
tmp = __raw_readl(S5P64X0_SLEEP_CFG);
tmp &= ~(S5P64X0_SLEEP_CFG_OSC_EN);
__raw_writel(tmp, S5P64X0_SLEEP_CFG);
tmp = __raw_readl(S5P64X0_PWR_CFG);
tmp &= ~(S5P64X0_PWR_CFG_WFI_MASK);
tmp |= S5P64X0_PWR_CFG_WFI_SLEEP;
__raw_writel(tmp, S5P64X0_PWR_CFG);
/*
* set OTHERS register to disable interrupt before going to
* sleep. This bit is present only in S5P6450, it is reserved
* in S5P6440.
*/
if (soc_is_s5p6450()) {
tmp = __raw_readl(S5P64X0_OTHERS);
tmp |= S5P6450_OTHERS_DISABLE_INT;
__raw_writel(tmp, S5P64X0_OTHERS);
}
/* ensure previous wakeup state is cleared before sleeping */
__raw_writel(__raw_readl(S5P64X0_WAKEUP_STAT), S5P64X0_WAKEUP_STAT);
}
static int s5p64x0_pm_add(struct device *dev, struct subsys_interface *sif)
{
pm_cpu_prep = s5p64x0_pm_prepare;
pm_cpu_sleep = s5p64x0_cpu_suspend;
pm_uart_udivslot = 1;
return 0;
}
static struct subsys_interface s5p64x0_pm_interface = {
.name = "s5p64x0_pm",
.subsys = &s5p64x0_subsys,
.add_dev = s5p64x0_pm_add,
};
static __init int s5p64x0_pm_drvinit(void)
{
s3c_pm_init();
return subsys_interface_register(&s5p64x0_pm_interface);
}
arch_initcall(s5p64x0_pm_drvinit);
static void s5p64x0_pm_resume(void)
{
u32 tmp;
tmp = __raw_readl(S5P64X0_OTHERS);
tmp |= (S5P64X0_OTHERS_RET_MMC0 | S5P64X0_OTHERS_RET_MMC1 | \
S5P64X0_OTHERS_RET_UART);
__raw_writel(tmp , S5P64X0_OTHERS);
}
static struct syscore_ops s5p64x0_pm_syscore_ops = {
.resume = s5p64x0_pm_resume,
};
static __init int s5p64x0_pm_syscore_init(void)
{
register_syscore_ops(&s5p64x0_pm_syscore_ops);
return 0;
}
arch_initcall(s5p64x0_pm_syscore_init);
|
/* This file was generated automatically by the Snowball to ANSI C compiler */
#ifdef __cplusplus
extern "C" {
#endif
extern struct SN_env* german_ISO_8859_1_create_env(void);
extern void german_ISO_8859_1_close_env(struct SN_env* z);
extern int german_ISO_8859_1_stem(struct SN_env* z);
#ifdef __cplusplus
}
#endif
|
/**
* @file
*/
/*
Copyright (C) 2002-2011 UFO: Alien Invasion.
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 TEST_MAPDEF_H_
#define TEST_MAPDEF_H_
int UFO_AddMapDefTests(void);
#endif
|
/*****************************************************************************
*
* $Id: CommandDomains.h,v 4f682084c643 2010/10/25 08:12:26 fp $
*
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
*
* This file is part of the IgH EtherCAT Master.
*
* The IgH EtherCAT Master 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.
*
* The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* ---
*
* The license mentioned above concerns the source code only. Using the
* EtherCAT technology and brand is only permitted in compliance with the
* industrial property and similar rights of Beckhoff Automation GmbH.
*
****************************************************************************/
#ifndef __COMMANDDOMAINS_H__
#define __COMMANDDOMAINS_H__
#include "Command.h"
/****************************************************************************/
class CommandDomains:
public Command
{
public:
CommandDomains();
string helpString(const string &) const;
void execute(const StringVector &);
protected:
void showDomain(MasterDevice &, const ec_ioctl_domain_t &, bool);
};
/****************************************************************************/
#endif
|
/*
* Copyright (C) 2004-2016 Michael Medin
*
* This file is part of NSClient++ - https://nsclient.org
*
* NSClient++ 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.
*
* NSClient++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NSClient++. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <nscapi/nscapi_protobuf.hpp>
#include <nscapi/nscapi_settings_proxy.hpp>
#include <nscapi/nscapi_plugin_impl.hpp>
#include <nscapi/nscapi_settings_object.hpp>
#include "filter_config_object.hpp"
class CheckSystem : public nscapi::impl::simple_plugin {
public:
CheckSystem() {}
virtual ~CheckSystem() {}
virtual bool loadModuleEx(std::string alias, NSCAPI::moduleLoadMode mode);
virtual bool unloadModule();
void check_service(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
void check_memory(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
//void check_pdh(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
void check_process(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
void check_cpu(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
void check_uptime(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
void check_pagefile(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
void add_counter(boost::shared_ptr<nscapi::settings_proxy> proxy, std::string path, std::string key, std::string query);
void check_os_version(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response);
};
|
/* Copyright (c) 2005 MySQL AB
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.
*/
#ifndef _MNSERVERSOCKET_H_
#define _MNSERVERSOCKET_H_
#include "MNSocket.h"
class MNSocket;
class MNServerSocket {
protected:
MYX_SOCKET _socket;
public:
MNServerSocket();
virtual ~MNServerSocket();
bool bind(int port);
bool listen();
MNSocket *accept();
};
#endif /* _MNSERVERSOCKET_H_ */
|
/*
* Copyright 2008 Freescale Semiconductor, Inc.
*
* 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 <config.h>
#include <openssl/sha.h>
#include <openssl/rsa.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/bn.h>
#include <openssl/pem.h>
#include "../fs/aw_fs/ff.h"
extern RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, void *cb, void *u);
/*
************************************************************************************************************
*
* function
*
* name :
*
* parmeters :
*
* return :
*
* note :
*
*
************************************************************************************************************
*/
int sunxi_rsa_publickey_decrypt(char *source_str, char *decryped_data, int data_bytes, char *key_path)
{
RSA *p_rsa;
FILE file;
int rsa_len, ret = -1;
printf("sunxi_rsa_publickey_decrypt key name=%s\n", key_path);
ret = f_open (&file, key_path, FA_OPEN_EXISTING | FA_READ );
if(ret)
{
printf("open key file error\n");
return -1;
}
if((p_rsa=PEM_read_RSA_PUBKEY(&file,NULL,NULL,NULL))==NULL)
{
printf("unable to get public key\n");
goto __sunxi_rsa_publickey_decrypt_err;
}
rsa_len=RSA_size(p_rsa);
if(RSA_public_decrypt(rsa_len,(unsigned char *)source_str, (unsigned char*)decryped_data, p_rsa, RSA_NO_PADDING)<0)
{
goto __sunxi_rsa_publickey_decrypt_err;
}
ret = 0;
__sunxi_rsa_publickey_decrypt_err:
f_close(&file);
if(p_rsa != NULL)
RSA_free(p_rsa);
return ret;
}
/*
************************************************************************************************************
*
* function
*
* name :
*
* parmeters :
*
* return :
*
* note :
*
*
************************************************************************************************************
*/
//char *sunxi_rsa_privatekey_encrypt(char *source_str, char *encryped_data, int data_bytes, char *key_path)
//{
// RSA *p_rsa;
// FILE file;
// int rsa_len, ret;
// FATFS openssl_mount;
//
// printf("sunxi_rsa_encrypt key name=%s\n", key_path);
//
// f_mount(0, &openssl_mount, "bootloader");
// ret = f_open (&file, key_path, FA_OPEN_EXISTING | FA_READ );
// if(ret)
// {
// printf("open key file error\n");
//
// return NULL;
// }
// if((p_rsa=PEM_read_RSAPrivateKey(&file,NULL,NULL,NULL))==NULL)
// {
// printf("unable to get private key\n");
//
// goto __sunxi_rsa_privatekey_encrypt_err;
// }
//
// rsa_len=RSA_size(p_rsa);
// ret = RSA_private_encrypt(rsa_len, (unsigned char *)source_str,(unsigned char*)encryped_data, p_rsa, RSA_NO_PADDING);
// if(ret)
// {
// goto __sunxi_rsa_privatekey_encrypt_err;
// }
//
//__sunxi_rsa_privatekey_encrypt_err:
// f_close(&file);
// f_mount(0, NULL, NULL);
//
// if(p_rsa != NULL)
// RSA_free(p_rsa);
//
// return 0;
//}
///*
//************************************************************************************************************
//*
//* function
//*
//* name :
//*
//* parmeters :
//*
//* return :
//*
//* note :
//*
//*
//************************************************************************************************************
//*/
//int sha256(char *source_str, int str_len, char *sha256_value)
//{
// SHA256_CTX ctx;
// char data_default[128];
// char *data;
// const char *info = "Testing SHA-256";
// uint size;
//
// memset(sha256_value, 0, SHA256_DIGEST_LENGTH);
//
// SHA256_Init(&ctx);
// SHA256_Update(&ctx, (u_int8_t *)source_str, str_len);
// SHA256_Final(sha256_value, &ctx);
//
// dump(sha256, 256 + 32);
//
// arm_neon_init();
//
// return 0;
//}
|
/**************************************************************************
XercesString.h
***************************************************************************/
#ifndef _XERCESSTRING_H
#define _XERCESSTRING_H
#include <xercesc/util/XMLString.hpp>
#ifdef XERCES_CPP_NAMESPACE_USE
XERCES_CPP_NAMESPACE_USE
#endif
class XercesString
{
XMLCh *_wstr;
public:
XercesString() : _wstr(0L) { };
XercesString(const char *str);
XercesString(XMLCh *wstr);
XercesString(const XMLCh *wstr);
XercesString(const XercesString ©);
~XercesString();
bool append(const XMLCh *tail);
bool erase(const XMLCh *head, const XMLCh *tail);
const XMLCh* begin() const;
const XMLCh* end() const;
int size() const;
XMLCh & operator [] (const int i);
const XMLCh operator [] (const int i) const;
operator const XMLCh * () const { return _wstr; };
};
#endif
|
/***************************************************************************
qgsauthmethodmetadata.h
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot 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 QGSAUTHMETHODMETADATA_H
#define QGSAUTHMETHODMETADATA_H
#include <QString>
#include "qgis_core.h"
/** \ingroup core
* Holds data auth method key, description, and associated shared library file information.
The metadata class is used in a lazy load implementation in
QgsAuthMethodRegistry. To save memory, auth methods are only actually
loaded via QLibrary calls if they're to be used. (Though they're all
iteratively loaded once to get their metadata information, and then
unloaded when the QgsAuthMethodRegistry is created.) QgsProviderMetadata
supplies enough information to be able to later load the associated shared
library object.
* \note Culled from QgsProviderMetadata
* \note not available in Python bindings
*/
class CORE_EXPORT QgsAuthMethodMetadata
{
public:
/**
* Construct an authentication method metadata container
* \param _key Textual key of the library plugin
* \param _description Description of the library plugin
* \param _library File name of library plugin
*/
QgsAuthMethodMetadata( const QString &_key, const QString &_description, const QString &_library );
/** This returns the unique key associated with the method
This key string is used for the associative container in QgsAtuhMethodRegistry
*/
QString key() const;
/** This returns descriptive text for the method
This is used to provide a descriptive list of available data methods.
*/
QString description() const;
/** This returns the library file name
This is used to QLibrary calls to load the method.
*/
QString library() const;
private:
/// unique key for method
QString key_;
/// associated terse description
QString description_;
/// file path
QString library_;
};
#endif // QGSAUTHMETHODMETADATA_H
|
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
MODULE_INFO(intree, "Y");
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0x78ec5434, "module_layout" },
{ 0x631b413d, "crypto_aead_type" },
{ 0xeaab72e5, "crypto_ahash_type" },
{ 0xf58542df, "crypto_ablkcipher_type" },
{ 0x790b57dc, "platform_driver_unregister" },
{ 0xf087137d, "__dynamic_pr_debug" },
{ 0x784fbacc, "platform_driver_register" },
{ 0xf9318674, "__init_waitqueue_head" },
{ 0x528c709d, "simple_read_from_buffer" },
{ 0xb2422a9, "debugfs_remove_recursive" },
{ 0xa853328d, "debugfs_create_file" },
{ 0x27dd566b, "debugfs_create_dir" },
{ 0xb81960ca, "snprintf" },
{ 0x86de10c0, "crypto_register_ahash" },
{ 0xcd934a25, "_dev_info" },
{ 0xa099e649, "dev_err" },
{ 0xa54943be, "crypto_register_alg" },
{ 0xc3593841, "msm_bus_scale_register_client" },
{ 0x544253c4, "qce_hw_support" },
{ 0x499043d3, "crypto_init_queue" },
{ 0x9545af6d, "tasklet_init" },
{ 0x5083fed, "__raw_spin_lock_init" },
{ 0x84164b42, "dev_set_drvdata" },
{ 0xf2dd8cd8, "qce_open" },
{ 0xcfd9a2c0, "des_ekey" },
{ 0x79aa04a2, "get_random_bytes" },
{ 0x4f7b0e59, "complete" },
{ 0xa9dcc10e, "mutex_unlock" },
{ 0x78f062cb, "msm_bus_scale_client_update_request" },
{ 0x5366ee05, "mutex_lock" },
{ 0xa820fd00, "wait_for_completion_interruptible" },
{ 0xa1fe82ed, "crypto_enqueue_request" },
{ 0x76c6f7a2, "mem_section" },
{ 0xd53cd7b5, "membank0_size" },
{ 0x46ce1a07, "membank1_start" },
{ 0xbe917b8a, "qce_aead_req" },
{ 0xad90232b, "qce_process_sha_req" },
{ 0xb03f0e17, "qce_ablk_cipher_req" },
{ 0x6b13be2f, "crypto_dequeue_request" },
{ 0xd5152710, "sg_next" },
{ 0xbaec3d71, "page_address" },
{ 0x12da5bb2, "__kmalloc" },
{ 0xff088cfe, "kmalloc_caches" },
{ 0x27e1a049, "printk" },
{ 0xc3377a31, "kmem_cache_alloc_trace" },
{ 0x8f678b07, "__stack_chk_guard" },
{ 0xf0fdf6cb, "__stack_chk_fail" },
{ 0xfaef0ed, "__tasklet_schedule" },
{ 0xca54fee, "_test_and_set_bit" },
{ 0x8949858b, "schedule_work" },
{ 0x71c90087, "memcmp" },
{ 0x5f754e5a, "memset" },
{ 0x91dda801, "scatterwalk_map_and_copy" },
{ 0x7a4497db, "kzfree" },
{ 0xfa2a45e, "__memzero" },
{ 0x9d669763, "memcpy" },
{ 0x9cd9dce, "_raw_spin_unlock_irqrestore" },
{ 0x56f31e92, "_raw_spin_lock_irqsave" },
{ 0xdfabe0ff, "scm_call" },
{ 0x2e5810c6, "__aeabi_unwind_cpp_pr1" },
{ 0x82072614, "tasklet_kill" },
{ 0x575c81e1, "qce_close" },
{ 0x37a0cba, "kfree" },
{ 0x5ff3a021, "crypto_unregister_ahash" },
{ 0x791c5258, "crypto_unregister_alg" },
{ 0xcf8cc5ee, "msm_bus_scale_unregister_client" },
{ 0x2a87e02e, "dev_get_drvdata" },
{ 0xefd6cf06, "__aeabi_unwind_cpp_pr0" },
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=qce40";
MODULE_INFO(srcversion, "D47ACD5E22578E7A8A7FAEA");
|
/*
* vdso setup for s390
*
* Copyright IBM Corp. 2008
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/user.h>
#include <linux/elf.h>
#include <linux/security.h>
#include <linux/bootmem.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/mmu_context.h>
#include <asm/sections.h>
#include <asm/vdso.h>
/* Max supported size for symbol names */
#define MAX_SYMNAME 64
#if defined(CONFIG_32BIT) || defined(CONFIG_COMPAT)
extern char vdso32_start, vdso32_end;
static void *vdso32_kbase = &vdso32_start;
static unsigned int vdso32_pages;
static struct page **vdso32_pagelist;
#endif
#ifdef CONFIG_64BIT
extern char vdso64_start, vdso64_end;
static void *vdso64_kbase = &vdso64_start;
static unsigned int vdso64_pages;
static struct page **vdso64_pagelist;
#endif /* CONFIG_64BIT */
/*
* Should the kernel map a VDSO page into processes and pass its
* address down to glibc upon exec()?
*/
unsigned int __read_mostly vdso_enabled = 1;
static int __init vdso_setup(char *s)
{
vdso_enabled = simple_strtoul(s, NULL, 0);
return 1;
}
__setup("vdso=", vdso_setup);
/*
* The vdso data page
*/
static union {
struct vdso_data data;
u8 page[PAGE_SIZE];
} vdso_data_store __attribute__((__section__(".data.page_aligned")));
struct vdso_data *vdso_data = &vdso_data_store.data;
/*
* This is called from binfmt_elf, we create the special vma for the
* vDSO and insert it into the mm struct tree
*/
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
{
struct mm_struct *mm = current->mm;
struct page **vdso_pagelist;
unsigned long vdso_pages;
unsigned long vdso_base;
int rc;
if (!vdso_enabled)
return 0;
/*
* Only map the vdso for dynamically linked elf binaries.
*/
if (!uses_interp)
return 0;
vdso_base = mm->mmap_base;
#ifdef CONFIG_64BIT
vdso_pagelist = vdso64_pagelist;
vdso_pages = vdso64_pages;
#ifdef CONFIG_COMPAT
if (test_thread_flag(TIF_31BIT)) {
vdso_pagelist = vdso32_pagelist;
vdso_pages = vdso32_pages;
}
#endif
#else
vdso_pagelist = vdso32_pagelist;
vdso_pages = vdso32_pages;
#endif
/*
* vDSO has a problem and was disabled, just don't "enable" it for
* the process
*/
if (vdso_pages == 0)
return 0;
current->mm->context.vdso_base = 0;
/*
* pick a base address for the vDSO in process space. We try to put
* it at vdso_base which is the "natural" base for it, but we might
* fail and end up putting it elsewhere.
*/
down_write(&mm->mmap_sem);
vdso_base = get_unmapped_area(NULL, vdso_base,
vdso_pages << PAGE_SHIFT, 0, 0);
if (IS_ERR_VALUE(vdso_base)) {
rc = vdso_base;
goto out_up;
}
/*
* our vma flags don't have VM_WRITE so by default, the process
* isn't allowed to write those pages.
* gdb can break that with ptrace interface, and thus trigger COW
* on those pages but it's then your responsibility to never do that
* on the "data" page of the vDSO or you'll stop getting kernel
* updates and your nice userland gettimeofday will be totally dead.
* It's fine to use that for setting breakpoints in the vDSO code
* pages though
*
* Make sure the vDSO gets into every core dump.
* Dumping its contents makes post-mortem fully interpretable later
* without matching up the same kernel and hardware config to see
* what PC values meant.
*/
rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
VM_READ|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
VM_ALWAYSDUMP,
vdso_pagelist);
if (rc)
goto out_up;
/* Put vDSO base into mm struct */
current->mm->context.vdso_base = vdso_base;
up_write(&mm->mmap_sem);
return 0;
out_up:
up_write(&mm->mmap_sem);
return rc;
}
const char *arch_vma_name(struct vm_area_struct *vma)
{
if (vma->vm_mm && vma->vm_start == vma->vm_mm->context.vdso_base)
return "[vdso]";
return NULL;
}
static int __init vdso_init(void)
{
int i;
#if defined(CONFIG_32BIT) || defined(CONFIG_COMPAT)
/* Calculate the size of the 32 bit vDSO */
vdso32_pages = ((&vdso32_end - &vdso32_start
+ PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
/* Make sure pages are in the correct state */
vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 1),
GFP_KERNEL);
BUG_ON(vdso32_pagelist == NULL);
for (i = 0; i < vdso32_pages - 1; i++) {
struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
ClearPageReserved(pg);
get_page(pg);
vdso32_pagelist[i] = pg;
}
vdso32_pagelist[vdso32_pages - 1] = virt_to_page(vdso_data);
vdso32_pagelist[vdso32_pages] = NULL;
#endif
#ifdef CONFIG_64BIT
/* Calculate the size of the 64 bit vDSO */
vdso64_pages = ((&vdso64_end - &vdso64_start
+ PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
/* Make sure pages are in the correct state */
vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 1),
GFP_KERNEL);
BUG_ON(vdso64_pagelist == NULL);
for (i = 0; i < vdso64_pages - 1; i++) {
struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
ClearPageReserved(pg);
get_page(pg);
vdso64_pagelist[i] = pg;
}
vdso64_pagelist[vdso64_pages - 1] = virt_to_page(vdso_data);
vdso64_pagelist[vdso64_pages] = NULL;
#endif /* CONFIG_64BIT */
get_page(virt_to_page(vdso_data));
smp_wmb();
return 0;
}
arch_initcall(vdso_init);
int in_gate_area_no_task(unsigned long addr)
{
return 0;
}
int in_gate_area(struct task_struct *task, unsigned long addr)
{
return 0;
}
struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
{
return NULL;
}
|
/*
* Copyright 2021 KylinSoft Co., Ltd.
*
* 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 PRESCENE_H
#define PRESCENE_H
#include <QSize>
#include <QWidget>
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
class PreScene : public QWidget
{
public:
PreScene(QLabel *label, QSize size, QWidget * parent = nullptr);
~PreScene();
private:
QSize m_size;
QHBoxLayout * m_hlayout;
QVBoxLayout * m_vlayout;
QWidget * titlebar;
QLabel * mTitleIcon;
QLabel * titleLabel;
QLabel * logoLabel;
QHBoxLayout * m_logoLayout = nullptr;
protected:
void paintEvent(QPaintEvent *event);
private:
const QPixmap loadSvg(const QString &fileName);
};
#endif // PRESCENE_H
|
/*
* Copyright (C)2005 USAGI/WIDE 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/icmp6.h>
#include "utils.h"
#define IF_PREFIX_ONLINK 0x01
#define IF_PREFIX_AUTOCONF 0x02
int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
struct prefixmsg *prefix = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[RTA_MAX+1];
int family = preferred_family;
if (n->nlmsg_type != RTM_NEWPREFIX) {
fprintf(stderr, "Not a prefix: %08x %08x %08x\n",
n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
return 0;
}
len -= NLMSG_LENGTH(sizeof(*prefix));
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
return -1;
}
if (family == AF_UNSPEC)
family = AF_INET6;
if (family != AF_INET6)
return 0;
if (prefix->prefix_family != AF_INET6) {
fprintf(stderr, "wrong family %d\n", prefix->prefix_family);
return 0;
}
if (prefix->prefix_type != ND_OPT_PREFIX_INFORMATION) {
fprintf(stderr, "wrong ND type %d\n", prefix->prefix_type);
return 0;
}
parse_rtattr(tb, RTA_MAX, RTM_RTA(prefix), len);
fprintf(fp, "prefix ");
if (tb[PREFIX_ADDRESS]) {
struct in6_addr *pfx;
char abuf[256];
pfx = (struct in6_addr *)RTA_DATA(tb[PREFIX_ADDRESS]);
memset(abuf, '\0', sizeof(abuf));
fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*pfx), pfx,
abuf, sizeof(abuf)));
}
fprintf(fp, "/%u ", prefix->prefix_len);
fprintf(fp, "dev %s ", ll_index_to_name(prefix->prefix_ifindex));
if (prefix->prefix_flags & IF_PREFIX_ONLINK)
fprintf(fp, "onlink ");
if (prefix->prefix_flags & IF_PREFIX_AUTOCONF)
fprintf(fp, "autoconf ");
if (tb[PREFIX_CACHEINFO]) {
struct prefix_cacheinfo *pc;
pc = (struct prefix_cacheinfo *)tb[PREFIX_CACHEINFO];
fprintf(fp, "valid %u ", pc->valid_time);
fprintf(fp, "preferred %u ", pc->preferred_time);
}
fprintf(fp, "\n");
fflush(fp);
return 0;
}
|
#ifndef _ASM_M32R_TIMEX_H
#define _ASM_M32R_TIMEX_H
/* $Id: timex.h,v 1.1.1.1 2006/01/06 00:51:59 jsantiago Exp $ */
/*
* linux/include/asm-m32r/timex.h
*
* m32r architecture timex specifications
*/
#include <linux/config.h>
#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE)
#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
<< (SHIFT_SCALE-SHIFT_HZ)) / HZ)
#ifdef __KERNEL__
/*
* Standard way to access the cycle counter.
* Currently only used on SMP.
*/
typedef unsigned long long cycles_t;
static __inline__ cycles_t get_cycles (void)
{
return 0;
}
#endif /* __KERNEL__ */
#endif /* _ASM_M32R_TIMEX_H */
|
/* array.c
*
* Copyright (C) 2010, 2012 Henrik Hautakoski <henrik@fiktivkod.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include <string.h>
#include "xalloc.h"
#include "array.h"
struct __array {
void *items;
unsigned nr;
};
static void resize(struct __array *arr, unsigned n) {
if (!arr->nr) {
xfree(arr->items);
arr->items = NULL;
return;
}
arr->items = xrealloc(arr->items, n * arr->nr);
}
void* array_create(void) {
struct __array *arr = xmalloc(sizeof(struct __array));
arr->items = NULL;
arr->nr = 0;
return arr;
}
void* __array_copy(void *__arr, unsigned n) {
struct __array *arr = __arr, *copy;
if (arr && arr->nr && n) {
copy = xmalloc(sizeof(*arr));
copy->items = xmemdup(arr->items, n * arr->nr);
copy->nr = arr->nr;
return copy;
}
return NULL;
}
int array_destroy(void *arr) {
array_clear(arr);
xfree(arr);
return 0;
}
void __array_clear_fn(void *__arr, array_clear_fn_t *fn,
unsigned n) {
struct __array *arr = __arr;
if (arr->items) {
if (fn) {
int i;
for(i=0; i < arr->nr; i++)
fn(arr->items + (i * n));
}
xfree(arr->items);
}
arr->items = NULL;
arr->nr = 0;
}
int __array_insert(void *__arr, const void *item, unsigned n) {
struct __array *arr = __arr;
if (arr) {
arr->items = xrealloc(arr->items, n * (++arr->nr));
memcpy(arr->items + ((arr->nr - 1) * n), item, n);
return arr->nr;
}
return -1;
}
void* __array_remove(void *__arr, unsigned i, unsigned n) {
struct __array *arr = __arr;
void *item = NULL;
if (i < arr->nr) {
/* I bet this will come back and bite me in the ass. */
item = arr->items + (i * n);
if (i < --arr->nr) {
memmove(arr->items + (i * n),
arr->items + ((i + 1) * n),
(arr->nr - i) * n);
}
resize(arr, n);
}
return item;
}
void* __array_reduce(void *__arr, unsigned n) {
struct __array *arr = __arr;
void *item = NULL;
if (arr->nr) {
item = arr->items + ((--arr->nr) * n);
resize(arr, n);
}
return item;
}
int __array_indexof(void *__arr, const void *item, unsigned n) {
int i;
struct __array *arr = __arr;
for(i=0; i < arr->nr; i++) {
if (!memcmp(arr->items + (i * n), item, n))
return i;
}
return -1;
}
void* __array_lookup(void *__arr, const void *item,
array_cmp_fn_t fn, unsigned n) {
int i;
struct __array *arr = __arr;
if (fn) {
for(i=0; i < arr->nr; i++) {
void *cmp = arr->items + (i * n);
if (fn(cmp, item) == 0)
return cmp;
}
} else {
i = __array_indexof(arr, item, n);
if (i >= 0)
return arr->items + (i * n);
}
return NULL;
}
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_LAYERS_PAINT_PROPERTIES_H_
#define CC_LAYERS_PAINT_PROPERTIES_H_
#include "ui/gfx/size.h"
namespace cc {
struct CC_EXPORT PaintProperties {
PaintProperties() : source_frame_number(-1) {}
gfx::Size bounds;
int source_frame_number;
};
}
#endif
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2016 Luis Ricardo Gallego Tercero
* <luiss_121314@hotmail.com>, Network and Data Science Laboratory (NDS-Lab)
* at the Computing Research Center (CIC-IPN) <www.prime.cic.ipn.mx>
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Luis Ricardo Gallego Tercero <luiss_121314@hotmail.com>
*
* Written after DuplicatePacketDetection by Pavel Boyko <boyko@iitp.ru> and
* Elena Buchatskaia <borovkovaes@iitp.ru>.
*/
#ifndef GEOTEMPORALDUPLICATEDETECTOR_H
#define GEOTEMPORALDUPLICATEDETECTOR_H
#include "geotemporal-data-id-cache.h"
#include "geotemporal-utils.h"
#include <ns3/nstime.h>
#include <ns3/packet.h>
#include <ns3/ipv4-header.h>
namespace ns3
{
namespace geotemporal
{
/**
* \ingroup geotemporal
* \brief Helper class used to remember already seen packets and detect duplicates.
*
* Currently, duplicate detection is based on packet PacketIdentifier and its time
* to live.
*/
class DuplicatePacketDetection
{
private:
/// Contains the identifiers of the received data packets.
PacketIdentifierCache m_data_packets_cache;
/// Contains the identifiers of the received control packets.
PacketIdentifierCache m_control_packets_cache;
public:
DuplicatePacketDetection (const Time & expiration_time);
/// Checks if the packet is duplicated. If not, saves information about the packet.
bool IsDuplicate (Ptr<const Packet> packet, const Ipv4Header & ipv4_header);
/// Set cached data default time to live
void SetDataExpirationTime (const Time & expiration_time);
/// Get cached data default time to live
Time GetDataExpirationTime () const;
/// Set cached control packet identifiers default time to live.
void SetControlExpirationTime (const Time & expiration_time);
Time GetControlExpirationTime () const;
/// Adds the identifier of a DATA packet together with its start_time and
/// expiration_time.
void AddDataToCache (const DataIdentifier & data_id, const uint32_t start_time,
const uint32_t expiration_time);
void Print () const;
};
}
}
#endif /* GEOTEMPORALDUPLICATEDETECTOR_H */
|
/*
* BB: The portable demo
*
* (C) 1997 by AA-group (e-mail: aa@horac.ta.jcu.cz)
*
* 3rd August 1997
* version: 1.2 [final3]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public Licences as by published
* by the Free Software Foundation; either version 2; or (at your option)
* any later version
*
* This program is distributed in the hope that it will entertaining,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Publis 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.
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "bb.h"
#define DWIDTH aa_imgwidth(context)
#define DHEIGHT aa_imgheight(context)
#define STIME 11*1000000
#define TTIME 1000000
#define N_FRAMERATE 35
#define ZTABSIZE ((int)((float)(MAXZOOM-MINZOOM)/ZOOMSTEP))
#define ZOOMSTEP 0.01
#define MINZOOM 0.80
#define MAXZOOM 2.70
#define POW4(x) (x*x*x*x)
#define RAD(angle) ((double) angle * M_PI / 180)
#define RANDOM(x) (rand()%x)
static aa_palette TempPal, Pal[2];
static char *PlasmaTbl;
static unsigned char pos1, pos2, pos3, pos4;
static unsigned int pnum;
static int dir = 1;
static void compute_custom_palette()
{
int i;
for (i = 0; i < 64; i++) {
Pal[0][i] = i * 4;
Pal[1][i] = i * 1;
}
for (i = 64; i < 128; i++) {
Pal[0][i] = (128 - i) * 4;
Pal[1][i] = (128 - i) * 1;
}
for (i = 128; i < 192; i++) {
Pal[0][i] = (i - 128) * 1;
Pal[1][i] = (i - 128) * 4;
}
for (i = 192; i < 256; i++) {
Pal[0][i] = (256 - i) * 1;
Pal[1][i] = (256 - i) * 4;
}
}
void initscene3(void)
{
int i;
float czoom;
for (czoom = MINZOOM, pnum = 0; pnum < ZTABSIZE; czoom += ZOOMSTEP, pnum++)
for (i = 0; i < 256; i++)
PlasmaTbl[(pnum << 8) + i] = (char) (((float) cos(RAD(i * 256 / 180))) * 256 / (POW4(czoom)));
compute_custom_palette();
pnum = 0;
}
static void draw_plasma(void)
{
int i, j, color;
unsigned char p1, p2, p3 = pos3, p4 = pos4;
char *text[] =
{
"STILL",
"WATCHING",
"BB",
"?",
"GREAT",
"",
"",
"NOW",
"IT'S",
"A GREAT",
"TIME",
"TO",
"FILL",
"IN",
"YOUR",
"REGISTRATION",
"CARD",
"",
"????",
"NEVER",
"MORE",
"",
"(E.A. POE)",
"..."
};
for (i = 0; i < DWIDTH; i++) {
p1 = pos1;
p2 = pos2;
for (j = 0; j < DHEIGHT; j++) {
color = PlasmaTbl[(pnum << 8) + p1] + PlasmaTbl[(pnum << 8) + p2] + PlasmaTbl[(pnum << 8) + p3] + PlasmaTbl[(pnum << 8) + p4] + PlasmaTbl[(pnum << 8) + ((unsigned char) i)] + PlasmaTbl[(pnum << 8) + ((unsigned char) j)];
aa_putpixel(context, i, j, color);
p1 += 3;
p2 += 1;
}
p3 += 2;
p4 += 3;
}
for (i = 0; i < sizeof(text) / sizeof(char *); i++) {
message(text[i], starttime + STIME + i * TTIME);
}
aa_renderpalette(context, TempPal, params, 0, 0, aa_imgwidth(context), aa_imgheight(context));
aa_flush(context);
emscripten_sleep(1);
}
static void move_plasma(void)
{
pos1 -= 4 + RANDOM(2);
pos3 += 4 + RANDOM(1);
pos2 -= RANDOM(2);
pos4 -= RANDOM(2);
pnum += dir;
if (pnum > (ZTABSIZE - 2))
dir = -1;
else if (pnum <= 0)
dir = 1;
}
static void cplasma(aa_palette dest, aa_palette src, aa_palette temp, float step)
{
int j;
for (j = 0; j < 256; j++)
temp[j] = src[j] + ((dest[j] - src[j]) * step / 64);
}
static void do_plasma(int step)
{
static int m = 0, n = 0, f = 0;
int i = 0;
if (TIME > endtime - 128 * 1000000 / N_FRAMERATE)
params->bright -= step * 2;
else {
params->bright -= step * 2;
if (params->bright < 0)
params->bright = 0;
}
if ((f += step) > 64) {
f = 0;
m = n, n = RANDOM(2);
}
cplasma(Pal[n], Pal[m], TempPal, f);
for (i = 0; i < step; i++)
move_plasma();
}
void scene3(void)
{
pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0, pnum = 0, dir = 1;
PlasmaTbl = (char *) malloc(ZTABSIZE * 256);
params->dither = AA_FLOYD_S;
initscene3();
bbwait(500000);
timestuff(-N_FRAMERATE, do_plasma, draw_plasma, 42 * 1000000);
params->bright = 0;
free(PlasmaTbl);
clrscr();
}
|
#include <stdio.h>
#include <errno.h>
#include <sys/select.h>
#include "my_poll.h"
int my_poll(struct pollfd *pollfds, int npollfds, int timeout)
{
fd_set reads, writes, excepts;
int i, n;
int highest = -1;
int events;
FD_ZERO(&reads); FD_ZERO(&writes); FD_ZERO(&excepts);
/* Convert pollfds array to fd_set's. */
for (i = 0; i < npollfds; i++) {
/* Ignore invalid descriptors. */
n = pollfds[i].fd;
if (n < 0) continue;
events = pollfds[i].events;
if (events & POLLIN) FD_SET(n, &reads);
if (events & POLLOUT) FD_SET(n, &writes);
FD_SET(n, &excepts);
if (n > highest) highest = n;
}
if (timeout >= 0) {
struct timeval tv;
tv.tv_sec = (timeout / 1000);
timeout -= 1000 * tv.tv_sec;
tv.tv_usec = timeout * 1000;
events = select(highest+1, &reads, &writes, &excepts, &tv);
}
else events = select(highest+1, &reads, &writes, &excepts, NULL);
if (events < 0) {
/* There is a bad descriptor among us... find it! */
char temp[1];
events = 0;
for (i = 0; i < npollfds; i++) {
if (pollfds[i].fd < 0) continue;
errno = 0;
n = write(pollfds[i].fd, temp, 0);
if (n < 0 && errno != EINVAL) {
pollfds[i].revents = POLLNVAL;
events++;
}
else pollfds[i].revents = 0;
}
}
else for (i = 0; i < npollfds; i++) {
n = pollfds[i].fd;
pollfds[i].revents = 0;
if (FD_ISSET(n, &reads)) pollfds[i].revents |= POLLIN;
if (FD_ISSET(n, &writes)) pollfds[i].revents |= POLLOUT;
if (FD_ISSET(n, &excepts)) pollfds[i].revents |= POLLERR;
}
return(events);
}
|
// Copyright (c) 2008, Google Inc.
// * Redistributions of source code must retain the above copyright
// copyright notice, this list of conditions and the following disclaimer
// this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
#ifndef TCMALLOC_PAGE_HEAP_ALLOCATOR_H_
#define TCMALLOC_PAGE_HEAP_ALLOCATOR_H_
#include <stddef.h>
#include "common.h"
#include "internal_logging.h"
namespace tcmalloc {
template <class T>
class PageHeapAllocator {
public:
void Init() {
ASSERT(sizeof(T) <= kAllocIncrement);
inuse_ = 0;
free_area_ = NULL;
free_avail_ = 0;
free_list_ = NULL;
Delete(New());
}
T* New() {
void* result;
if (free_list_ != NULL) {
result = free_list_;
free_list_ = *(reinterpret_cast<void**>(result));
} else {
if (free_avail_ < sizeof(T)) {
free_area_ = reinterpret_cast<char*>(MetaDataAlloc(kAllocIncrement));
if (free_area_ == NULL) {
Log(kCrash, __FILE__, __LINE__,
"FATAL ERROR: Out of memory trying to allocate internal "
"tcmalloc data (bytes, object-size)",
kAllocIncrement, sizeof(T));
}
free_avail_ = kAllocIncrement;
}
result = free_area_;
free_area_ += sizeof(T);
free_avail_ -= sizeof(T);
}
inuse_++;
return reinterpret_cast<T*>(result);
}
void Delete(T* p) {
*(reinterpret_cast<void**>(p)) = free_list_;
free_list_ = p;
inuse_--;
}
int inuse() const { return inuse_; }
private:
static const int kAllocIncrement = 128 << 10;
char* free_area_;
size_t free_avail_;
void* free_list_;
int inuse_;
};
}
#endif
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
// AtomicPointer provides storage for a lock-free pointer.
// Platform-dependent implementation of AtomicPointer:
// - If the platform provides a cheap barrier, we use it with raw pointers
// - If <atomic> is present (on newer versions of gcc, it is), we use
// a <atomic>-based AtomicPointer. However we prefer the memory
// barrier based version, because at least on a gcc 4.4 32-bit build
// on linux, we have encountered a buggy <atomic> implementation.
// Also, some <atomic> implementations are much slower than a memory-barrier
// based implementation (~16ns for <atomic> based acquire-load vs. ~1ns for
// a barrier based acquire-load).
// This code is based on atomicops-internals-* in Google's perftools:
// http://code.google.com/p/google-perftools/source/browse/#svn%2Ftrunk%2Fsrc%2Fbase
#ifndef PORT_ATOMIC_POINTER_H_
#define PORT_ATOMIC_POINTER_H_
#include <stdint.h>
#ifdef LEVELDB_ATOMIC_PRESENT
#include <atomic>
#endif
namespace leveldb {
namespace port {
inline void MemoryBarrier() {
__asm__ __volatile__("" : : : "memory");
}
#ifdef LEVELDB_ATOMIC_PRESENT
class AtomicPointer {
private:
std::atomic<void*> rep_;
public:
AtomicPointer() { }
explicit AtomicPointer(void* v) : rep_(v) { }
inline void* Acquire_Load() const {
return rep_.load(std::memory_order_acquire);
}
inline void Release_Store(void* v) {
rep_.store(v, std::memory_order_release);
}
inline void* NoBarrier_Load() const {
return rep_.load(std::memory_order_relaxed);
}
inline void NoBarrier_Store(void* v) {
rep_.store(v, std::memory_order_relaxed);
}
};
#else
class AtomicPointer {
private:
void* rep_;
public:
AtomicPointer() { }
explicit AtomicPointer(void* p) : rep_(p) {}
inline void* NoBarrier_Load() const { return rep_; }
inline void NoBarrier_Store(void* v) { rep_ = v; }
inline void* Acquire_Load() const {
void* result = rep_;
MemoryBarrier();
return result;
}
inline void Release_Store(void* v) {
MemoryBarrier();
rep_ = v;
}
};
#endif
} // namespace port
} // namespace leveldb
#endif // PORT_ATOMIC_POINTER_H_
|
/*
* src/irc/irc_network.h
*
* Copyright 2001 Colin O'Leary
*
*/
#ifndef _irc_network_h
#define _irc_network_h
int _irc_net_send(char *text);
int _irc_net_connect(char *addr, int port);
int _irc_net_disconnect(void);
int _irc_net_readstatus(int delay);
int _irc_net_readline(char *buf, int maxlen, int delay);
#endif
|
/*******************************************************************************
Copyright (C) 2016 OLogN Technologies AG
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*******************************************************************************/
#ifndef BASELIB_FUNC_BENCHMARK_H
#define BASELIB_FUNC_BENCHMARK_H
#include <iostream>
#include <memory>
#include <vector>
#include <assert.h>
#include <stdio.h>
#include <string>
#include <cstring>
using namespace std;
#
namespace bnchmrk
{
constexpr
uint64_t sint64ToUint64(int64_t src)
{
return (src << 1) ^ (src >> 63);
}
constexpr
int64_t uint64ToSint64(uint64_t src)
{
return (src >> 1) ^ -(src & 1);
}
/////////////////////////// WIRE_TYPE::VARINT ////////////////////////////////////
uint8_t* serializeToStringVariantUint64_loop(uint64_t value, uint8_t* buff);
uint8_t* deserializeFromStringVariantUint64_loop(uint64_t& value, uint8_t* buff);
/*
mb: serializeToStringVariantUint64 will read at most 10 bytes from buffer
However, if there is risk of buffer being overread, a null byte must be
set after the last buffer position, to force stop the algorithm.
*/
uint8_t* serializeToStringVariantUint64(uint64_t value, uint8_t* buff);
void serializeToStringVariantUint64_ref(uint64_t value, uint8_t*& buff);
uint8_t* deserializeFromStringVariantUint64(uint64_t& value, uint8_t* buff);
const uint8_t* deserializeFromStringVariantUint64_const(uint64_t& value, const uint8_t* buff);
uint64_t deserializeFromStringVariantUint64_ref(const uint8_t*& buff, bool& ok);
//bool deserializeFromStringVariantUint64_ref(uint64_t& value, uint8_t*& buff);
/////////////////////////// WIRE_TYPE::FIXED_64_BIT ////////////////////////////////////
uint8_t* serializeToStringFixedUint64_little(uint64_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint64_little(uint64_t& value, uint8_t* buff);
uint64_t deserializeFromStringFixedUint64_little_ref(const uint8_t*& buff);
uint8_t* serializeToStringFixedUint64(uint64_t value, uint8_t* buff);
uint8_t* serializeToStringFixedUint64_2(uint64_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint64(uint64_t& value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint64_2(uint64_t& value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint64_3(uint64_t& value, uint8_t* buff);
uint64_t deserializeFromStringFixedUint64_3_ref(const uint8_t*& buff);
uint8_t* serializeToStringFixedUint64_loop(uint64_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint64_loop(uint64_t& value, uint8_t* buff);
uint8_t* serializeToStringFixedUint64_loop2(uint64_t value, uint8_t* buff);
/////////////////////////// WIRE_TYPE::FIXED_32_BIT ////////////////////////////////////
uint8_t* serializeToStringFixedUint32_little(uint32_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint32_little(uint32_t& value, uint8_t* buff);
uint32_t deserializeFromStringFixedUint32_little_ref(const uint8_t*& buff);
uint8_t* serializeToStringFixedUint32(uint32_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint32(uint32_t& value, uint8_t* buff);
uint8_t* serializeToStringFixedUint32_2(uint32_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint32_2(uint32_t& value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint32_3(uint32_t& value, uint8_t* buff);
uint32_t deserializeFromStringFixedUint32_3_ref(const uint8_t*& buff);
uint8_t* serializeToStringFixedUint32_loop(uint32_t value, uint8_t* buff);
uint8_t* deserializeFromStringFixedUint32_loop(uint32_t& value, uint8_t* buff);
uint8_t* serializeToStringFixedUint32_loop2(uint32_t value, uint8_t* buff);
/////////////////////////// WIRE_TYPE::LENGTH_DELIMITED ////////////////////////////////////
} //namespace bnchmrk
#endif // BASELIB_FUNC_BENCHMARK_H
|
int get_flash_params_count(void){
return 0x5e;
}
void shutdown()
{
volatile long *p = (void*)0xc02200a0;
asm(
"MRS R1, CPSR\n"
"AND R0, R1, #0x80\n"
"ORR R1, R1, #0x80\n"
"MSR CPSR_cf, R1\n"
:::"r1","r0");
*p = 0x44;
while(1);
}
#define LED_PR 0xc0220084
void debug_led(int state)
{
volatile long *p=(void*)LED_PR;
if (state)
p[0]=0x46;
else
p[0]=0x44;
}
#define LED_AF 0xc0220080
void __attribute__((weak)) camera_set_led(int led, int state, int bright)
{
int leds[] = {12,16,4,8,4,0,4};
if(led < 4 || led > 10 || led == 6) return;
volatile long *p=(void*)LED_AF + leds[led-4];
if (state)
p[0]=0x46;
else
p[0]=0x44;
}
|
/**
* This file is a part of Esperanza, an XMMS2 Client.
*
* Copyright (C) 2005-2007 XMMS2 Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __XCLIENT_H__
#define __XCLIENT_H__
#include <xmmsclient/xmmsclient++.h>
class XClient;
#include <QObject>
#include <QHash>
#include <QVariant>
#include <QDir>
#include <QWidget>
#include "xclientcache.h"
class XSettings : public QObject
{
Q_OBJECT
public:
XSettings (QObject *);
void change_settings ();
signals:
void settingsChanged ();
};
class XClient : public QObject {
Q_OBJECT
public:
XClient (QObject *, const std::string &);
void disconnect ();
bool connect (const char *path = NULL, const bool &sync = false, QWidget* parent = NULL);
static void propDictToQHash (const std::string &key,
const Xmms::Dict::Variant &value,
const std::string &source,
QHash<QString, QVariant> &hash);
static void dictToQHash (const std::string &key,
const Xmms::Dict::Variant &value,
QHash<QString, QVariant> &hash);
static QHash<QString, QVariant> convert_propdict (const Xmms::PropDict &);
static QHash<QString, QVariant> convert_dict (const Xmms::Dict &);
XClientCache *cache () const {
return m_cache;
};
XSettings *settings () const {
return m_settings;
};
const Xmms::Client *sync () const {
return &m_sync;
};
static QString stdToQ (const std::string &);
static std::string qToStd (const QString &);
bool isConnected () const {
return m_isconnected;
};
static QDir esperanza_dir ();
void setDisconnectCallback (const Xmms::DisconnectCallback::slot_type &slot) { m_client->setDisconnectCallback (slot); }
const Xmms::Collection* collection () { if (m_client && m_client->isConnected ()) return &m_client->collection; else return NULL; }
const Xmms::Playlist* playlist () { if (m_client && m_client->isConnected ()) return &m_client->playlist; else return NULL; }
const Xmms::Playback* playback () { if (m_client && m_client->isConnected ()) return &m_client->playback; else return NULL; }
const Xmms::Medialib* medialib () { if (m_client && m_client->isConnected ()) return &m_client->medialib; else return NULL; }
const Xmms::Bindata* bindata () { if (m_client && m_client->isConnected ()) return &m_client->bindata; else return NULL; }
const Xmms::Config* config () { if (m_client && m_client->isConnected ()) return &m_client->config; else return NULL; }
const Xmms::Stats* stats () { if (m_client && m_client->isConnected ()) return &m_client->stats; else return NULL; }
signals:
void gotConnection (XClient *);
private:
std::string m_name;
Xmms::Client *m_client;
XClientCache *m_cache;
XSettings *m_settings;
bool m_isconnected;
Xmms::Client m_sync;
};
#endif
|
//
// AWParams.h
// VKAlbumsWatcher
//
// Created by vmalikov on 9/6/14.
// Copyright (c) 2014 owner organisation. All rights reserved.
//
#import <Foundation/Foundation.h>
static NSString * const ACCESS_TOKEN = @"ACCESS_TOKEN";
static NSString * const CURRENT_USER_ID = @"CURRENT_USER_ID";
static NSString * const FRIEND_ID = @"FRIEND_ID";
static NSString * const ALBUM_ID = @"ALBUM_ID";
static NSString * const PHOTO_URL = @"PHOTO_URL";
@interface AWParams : NSObject
- (void) addParam:(id)key withValue:(id <NSCopying>)value;
- (NSString *) paramsAsString;
@end
|
/*
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2011-2013 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TA_GUILDTAB_H
#define TA_GUILDTAB_H
#include "net/ea/gui/guildtab.h"
namespace TmwAthena
{
/**
* A tab for a guild chat channel.
*/
class GuildTab : public Ea::GuildTab
{
public:
explicit GuildTab(const Widget2 *const widget);
A_DELETE_COPY(GuildTab)
~GuildTab();
};
} // namespace TmwAthena
#endif // TA_GUILDTAB_H
|
// $Id: pluginexample1.c 80 2009-06-20 15:49:07Z mo $
/*
Qxw is a program to help construct and publish crosswords.
Copyright 2011 Mark Owen
http://www.quinapalus.com
E-mail: qxw@quinapalus.com
This file is part of Qxw.
Qxw is free software: you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License
as published by the Free Software Foundation.
Qxw 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 Qxw. If not, see <http://www.gnu.org/licenses/> or
write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301, USA.
*/
// gcc -Wall plugin_behead_message.c -o plugin_behead_message.so -shared
#include <qxw/qxwplugin.h>
int treat(const char*answer) {
if(clueorderindex>=strlen(treatmessageAZ[0])) return 0;
if(answer[0]!=treatmessageAZ[0][clueorderindex]) return 0;
strcpy(light,answer+1);
return treatedanswer(light);
}
|
//
// Valine.h
// Valine
//
// Created by Valo on 15/12/23.
// Copyright © 2015年 Valo. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for Valine.
FOUNDATION_EXPORT double ValineVersionNumber;
//! Project version string for Valine.
FOUNDATION_EXPORT const unsigned char ValineVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Valine/PublicHeader.h>
|
/*
* Copyright (c) 1998-2006 The TCPDUMP project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code
* distributions retain the above copyright notice and this paragraph
* in its entirety, and (2) distributions including binary code include
* the above copyright notice and this paragraph in its entirety in
* the documentation or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
* Original code by Hannes Gredler (hannes@juniper.net)
*/
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/af.c,v 1.3 2006-03-23 14:58:44 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <tcpdump-stdinc.h>
#include "interface.h"
#include "af.h"
struct tok af_values[] = {
{ 0, "Reserved"},
{ AFNUM_INET, "IPv4"},
{ AFNUM_INET6, "IPv6"},
{ AFNUM_NSAP, "NSAP"},
{ AFNUM_HDLC, "HDLC"},
{ AFNUM_BBN1822, "BBN 1822"},
{ AFNUM_802, "802"},
{ AFNUM_E163, "E.163"},
{ AFNUM_E164, "E.164"},
{ AFNUM_F69, "F.69"},
{ AFNUM_X121, "X.121"},
{ AFNUM_IPX, "Novell IPX"},
{ AFNUM_ATALK, "Appletalk"},
{ AFNUM_DECNET, "Decnet IV"},
{ AFNUM_BANYAN, "Banyan Vines"},
{ AFNUM_E164NSAP, "E.164 with NSAP subaddress"},
{ AFNUM_L2VPN, "Layer-2 VPN"},
{ AFNUM_VPLS, "VPLS"},
{ 0, NULL},
};
struct tok bsd_af_values[] = {
{ BSD_AFNUM_INET, "IPv4" },
{ BSD_AFNUM_NS, "NS" },
{ BSD_AFNUM_ISO, "ISO" },
{ BSD_AFNUM_APPLETALK, "Appletalk" },
{ BSD_AFNUM_IPX, "IPX" },
{ BSD_AFNUM_INET6_BSD, "IPv6" },
{ BSD_AFNUM_INET6_FREEBSD, "IPv6" },
{ BSD_AFNUM_INET6_DARWIN, "IPv6" },
{ 0, NULL}
};
|
/*
** my_get_el.c for mysh in /home/pirou_g/minishell2/src
**
** Made by Guillaume Pirou
** Login <pirou_g@epitech.net>
**
** Started on Sun Feb 1 08:28:51 2015 Guillaume Pirou
** Last update Sun Feb 1 08:28:53 2015 Guillaume Pirou
*/
int my_get_el(char c, char *base)
{
int lp;
lp = 0;
while (base[lp] != '\0')
{
if (c == base[lp])
return (lp);
++lp;
}
return (-1);
}
|
/* MJS Portable C Library.
* Module: test specified bit of a bitmap
* @(#) mbmtstb.c 1.0 30jun97 MJS
*
* Copyright (c) 1997 Mike Spooner
*----------------------------------------------------------------------
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*----------------------------------------------------------------------
* Source-code conforms to ANSI standard X3.159-1989.
*/
#include "mjsu.h"
#include "mjsuimpl.h"
BOOL mbm_tstb(const MBITMAP *p, USHORT row, USHORT col)
{
UINT n = (row * p->width) + col; /* linear bit-number */
return (p->bits[n >> 3] & (1 << (n & 7)));
}
|
/* Duplicate an open file descriptor to a specified file descriptor.
Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, 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. */
/* written by Paul Eggert */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#ifndef F_DUPFD
static int
dupfd (int fd, int desired_fd)
{
int duplicated_fd = dup (fd);
if (duplicated_fd < 0 || duplicated_fd == desired_fd)
return duplicated_fd;
else
{
int r = dupfd (fd, desired_fd);
int e = errno;
close (duplicated_fd);
errno = e;
return r;
}
}
#endif
int
dup2 (int fd, int desired_fd)
{
if (fd == desired_fd)
return fd;
close (desired_fd);
#ifdef F_DUPFD
return fcntl (fd, F_DUPFD, desired_fd);
#else
return dupfd (fd, desired_fd);
#endif
}
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. and/or its licensors.
* Without the prior written permission of MediaTek inc. and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek Software")
* have been modified by MediaTek Inc. All revisions are subject to any receiver's
* applicable license agreements with MediaTek Inc.
*/
/*
* U-boot - main board file
*
* Copyright (c) 2005-2009 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#include <common.h>
#include <config.h>
#include <command.h>
#include <net.h>
#include <netdev.h>
#include <asm/blackfin.h>
#include <asm/net.h>
#include "gpio_cfi_flash.h"
DECLARE_GLOBAL_DATA_PTR;
int checkboard(void)
{
printf("Board: Bluetechnix TCM-BF537 board\n");
printf(" Support: http://www.bluetechnix.at/\n");
return 0;
}
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
puts("Warning: Generating 'random' MAC address\n");
bfin_gen_rand_mac(mac_addr);
eth_setenv_enetaddr("ethaddr", mac_addr);
}
int board_eth_init(bd_t *bis)
{
return bfin_EMAC_initialize(bis);
}
#endif
int misc_init_r(void)
{
#ifdef CONFIG_BFIN_MAC
uchar enetaddr[6];
if (!eth_getenv_enetaddr("ethaddr", enetaddr))
board_init_enetaddr(enetaddr);
#endif
gpio_cfi_flash_init();
return 0;
}
|
#ifndef IO_LOOP_H
#define IO_LOOP_H
#include <types.h>
#define EPOLL_MAXEVENT 5
typedef void (*io_loop_walk)(io_handle_t *handle);
int io_loop_init(io_loop_t *loop);
int io_loop_run(io_loop_t *loop);
int io_loop_break(io_loop_t *loop);
int io_loop_close(io_loop_t *loop);
int io_loop_foreach(io_loop_t *loop, io_loop_walk walk);
#endif
|
/*
* tvdaemon
*
* Logging
*
* Copyright (C) 2012 André Roth
*
* 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 _Log_
#define _Log_
#include <stdio.h>
#include <syslog.h>
typedef void (*logfnc)( int level, const char *fmt, ... );
class Logger
{
public:
static Logger *Instance( );
virtual ~Logger( );
virtual void Log( int level, char *log );
protected:
static Logger *logger;
struct loglevel
{
const char *name;
const char *color;
FILE *io;
};
Logger( );
};
class LoggerSyslog : public Logger
{
public:
LoggerSyslog( const char *ident );
virtual ~LoggerSyslog( );
virtual void Log( int level, char *log );
};
void TVD_Log( int level, const char *fmt, ... ) __attribute__ (( format( printf, 2, 3 )));
void Log( const char *fmt, ... ) __attribute__ (( format( printf, 1, 2 )));
void LogInfo( const char *fmt, ... ) __attribute__ (( format( printf, 1, 2 )));
void LogWarn( const char *fmt, ... ) __attribute__ (( format( printf, 1, 2 )));
void LogError( const char *fmt, ... ) __attribute__ (( format( printf, 1, 2 )));
#endif
|
/*
* Copyright (c) 2009 Justin F. Knotzke (jknotzke@shampoo.ca)
*
* 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 TWITTERDIALOG_H
#define TWITTERDIALOG_H
#include "GoldenCheetah.h"
#include <QObject>
#include <QtGui>
#include <QCheckBox>
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QGroupBox>
#include <QtGui>
#include "MainWindow.h"
#include "RideItem.h"
// acccess to metrics
#include "RideMetric.h"
#include "MetricAggregator.h"
#include "DBAccess.h"
#include "Context.h"
#ifdef GC_HAVE_LIBOAUTH
extern "C" {
#include <oauth.h>
}
#endif
class TwitterDialog : public QDialog
{
Q_OBJECT
G_OBJECT
public:
TwitterDialog(Context *context, RideItem *item);
signals:
private slots:
void onCheck(int state);
void tweetMsgChange(QString);
void tweetCurrentRide();
private:
Context *context;
QPushButton *tweetButton;
QPushButton *cancelButton;
MainWindow *mainWindow;
QCheckBox *workoutTimeChk;
QCheckBox *timeRidingChk;
QCheckBox *totalDistanceChk;
QCheckBox *elevationGainChk;
QCheckBox *totalWorkChk;
QCheckBox *averageSpeedChk;
QCheckBox *averagePowerChk;
QCheckBox *averageHRMChk;
QCheckBox *averageCadenceChk;
QCheckBox *maxPowerChk;
QCheckBox *maxHRMChk;
QLineEdit *twitterMessageEdit;
QLineEdit *twitterLengthLabel;
RideItem *ride;
QString getTwitterMessage();
QString metricToString(const RideMetric *m, SummaryMetrics &metrics, bool metricUnits);
};
#endif // TWITTERDIALOG_H
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/earlysuspend.h>
#include <linux/spinlock.h>
#include <linux/kthread.h>
#include <linux/hrtimer.h>
#include <linux/ktime.h>
#include <linux/xlog.h>
#include <linux/jiffies.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include "mach/mt_typedefs.h"
#include "mach/mt_freqhopping.h"
#include "mach/mt_emifreq.h"
/* #include "mach/upmu_common.h" */
/***************************
* debug message
****************************/
#define dprintk(fmt, args...) \
do { \
if (mt_emifreq_debug) { \
xlog_printk(ANDROID_LOG_INFO, "Power/EMI_DFS", fmt, ##args); \
} \
} while (0)
#ifdef CONFIG_HAS_EARLYSUSPEND
static struct early_suspend mt_emifreq_early_suspend_handler = {
.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 200,
.suspend = NULL,
.resume = NULL,
};
#endif
/**************************
* Global variable
***************************/
static bool mt_emifreq_debug;
static bool mt_emifreq_pause = true;
/******************************
* Extern Function Declaration
*******************************/
/******************************
* show current EMI DFS stauts
*******************************/
static int mt_emifreq_state_read(char *buf, char **start, off_t off, int count, int *eof,
void *data)
{
int len = 0;
char *p = buf;
if (!mt_emifreq_pause)
p += sprintf(p, "EMI DFS enabled\n");
else
p += sprintf(p, "EMI DFS disabled\n");
len = p - buf;
return len;
}
/****************************************
* set EMI DFS stauts by sysfs interface
*****************************************/
static ssize_t mt_emifreq_state_write(struct file *file, const char *buffer, unsigned long count,
void *data)
{
int enabled = 0;
if (sscanf(buffer, "%d", &enabled) == 1) {
if (enabled == 1) {
mt_emifreq_pause = false;
} else if (enabled == 0) {
mt_emifreq_pause = true;
} else {
xlog_printk(ANDROID_LOG_INFO, "Power/EMI_DFS",
"bad argument!! argument should be \"1\" or \"0\"\n");
}
} else {
xlog_printk(ANDROID_LOG_INFO, "Power/EMI_DFS",
"bad argument!! argument should be \"1\" or \"0\"\n");
}
return count;
}
/***************************
* show current debug status
****************************/
static int mt_emifreq_debug_read(char *buf, char **start, off_t off, int count, int *eof,
void *data)
{
int len = 0;
char *p = buf;
if (mt_emifreq_debug)
p += sprintf(p, "emifreq debug enabled\n");
else
p += sprintf(p, "emifreq debug disabled\n");
len = p - buf;
return len;
}
/***********************
* enable debug message
************************/
static ssize_t mt_emifreq_debug_write(struct file *file, const char *buffer, unsigned long count,
void *data)
{
int debug = 0;
if (sscanf(buffer, "%d", &debug) == 1) {
if (debug == 0) {
mt_emifreq_debug = 0;
return count;
} else if (debug == 1) {
mt_emifreq_debug = 1;
return count;
} else {
xlog_printk(ANDROID_LOG_INFO, "Power/EMI_DFS",
"bad argument!! should be 0 or 1 [0: disable, 1: enable]\n");
}
} else {
xlog_printk(ANDROID_LOG_INFO, "Power/EMI_DFS",
"bad argument!! should be 0 or 1 [0: disable, 1: enable]\n");
}
return -EINVAL;
}
/*********************************
* early suspend callback function
**********************************/
void mt_emifreq_early_suspend(struct early_suspend *h)
{
if (mt_emifreq_pause == false) {
mt_h2l_mempll();
dprintk("mt_emifreq_early_suspend\n");
}
}
/*******************************
* late resume callback function
********************************/
void mt_emifreq_late_resume(struct early_suspend *h)
{
if (mt_emifreq_pause == false) {
mt_l2h_mempll();
dprintk("mt_emifreq_late_resume\n");
}
}
/**********************************
* mediatek emifreq initialization
***********************************/
static int __init mt_emifreq_init(void)
{
struct proc_dir_entry *mt_entry = NULL;
struct proc_dir_entry *mt_emifreq_dir = NULL;
#ifdef CONFIG_HAS_EARLYSUSPEND
mt_emifreq_early_suspend_handler.suspend = mt_emifreq_early_suspend;
mt_emifreq_early_suspend_handler.resume = mt_emifreq_late_resume;
register_early_suspend(&mt_emifreq_early_suspend_handler);
#endif
mt_emifreq_dir = proc_mkdir("emifreq", NULL);
if (!mt_emifreq_dir) {
pr_err("[%s]: mkdir /proc/emifreq failed\n", __func__);
} else {
mt_entry =
create_proc_entry("emifreq_debug", S_IRUGO | S_IWUSR | S_IWGRP, mt_emifreq_dir);
if (mt_entry) {
mt_entry->read_proc = mt_emifreq_debug_read;
mt_entry->write_proc = mt_emifreq_debug_write;
}
mt_entry =
create_proc_entry("emifreq_state", S_IRUGO | S_IWUSR | S_IWGRP, mt_emifreq_dir);
if (mt_entry) {
mt_entry->read_proc = mt_emifreq_state_read;
mt_entry->write_proc = mt_emifreq_state_write;
}
}
return 0;
}
static void __exit mt_emifreq_exit(void)
{
}
module_init(mt_emifreq_init);
module_exit(mt_emifreq_exit);
MODULE_DESCRIPTION("MediaTek EMI Frequency Scaling driver");
MODULE_LICENSE("GPL");
|
/*****************************************************************************/
/* */
/* fragdefs.h */
/* */
/* Fragment definitions for the bin65 binary utils */
/* */
/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* Römerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed 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 FRAGDEFS_H
#define FRAGDEFS_H
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Masks for the fragment type byte */
#define FRAG_TYPEMASK 0x38 /* Mask the type of the fragment */
#define FRAG_BYTEMASK 0x07 /* Mask for byte count */
/* Fragment types */
#define FRAG_LITERAL 0x00 /* Literal data */
#define FRAG_EXPR 0x08 /* Expression */
#define FRAG_EXPR8 (FRAG_EXPR | 1) /* 8 bit expression */
#define FRAG_EXPR16 (FRAG_EXPR | 2) /* 16 bit expression */
#define FRAG_EXPR24 (FRAG_EXPR | 3) /* 24 bit expression */
#define FRAG_EXPR32 (FRAG_EXPR | 4) /* 32 bit expression */
#define FRAG_SEXPR 0x10 /* Signed expression */
#define FRAG_SEXPR8 (FRAG_SEXPR | 1)/* 8 bit signed expression */
#define FRAG_SEXPR16 (FRAG_SEXPR | 2)/* 16 bit signed expression */
#define FRAG_SEXPR24 (FRAG_SEXPR | 3)/* 24 bit signed expression */
#define FRAG_SEXPR32 (FRAG_SEXPR | 4)/* 32 bit signed expression */
#define FRAG_FILL 0x20 /* Fill bytes */
/* End of fragdefs.h */
#endif
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2006 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*
* Copyright © 2006-2011 Guillaume Mercier, Institut Polytechnique de
* Bordeaux. All rights reserved. Permission is hereby granted to use,
* reproduce, prepare derivative works, and to redistribute to others.
*/
#include "mx_impl.h"
#include "my_papi_defs.h"
#undef FUNCNAME
#define FUNCNAME MPID_nem_mx_probe
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_nem_mx_probe(MPIDI_VC_t *vc, int source, int tag, MPID_Comm *comm, int context_offset, MPI_Status *status)
{
uint64_t match_info = NEM_MX_MATCH_DIRECT;
uint64_t match_mask = NEM_MX_MATCH_FULL_MASK;
int mpi_errno = MPI_SUCCESS;
mx_return_t ret;
mx_status_t mx_status;
uint32_t result;
NEM_MX_DIRECT_MATCH(match_info,0,source,comm->context_id + context_offset);
if (tag == MPI_ANY_TAG)
{
NEM_MX_SET_ANYTAG(match_info);
NEM_MX_SET_ANYTAG(match_mask);
}
else
NEM_MX_SET_TAG(match_info,tag);
ret = mx_probe(MPID_nem_mx_local_endpoint,MX_INFINITE,match_info,match_mask,&mx_status,&result);
MPIU_Assert(ret == MX_SUCCESS);
MPIU_Assert(result != 0);
NEM_MX_MATCH_GET_RANK(mx_status.match_info,status->MPI_SOURCE);
NEM_MX_MATCH_GET_TAG(mx_status.match_info,status->MPI_TAG);
status->count = mx_status.xfer_length;
fn_exit:
return mpi_errno;
fn_fail: ATTRIBUTE((unused))
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPID_nem_mx_iprobe
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_nem_mx_iprobe(MPIDI_VC_t *vc, int source, int tag, MPID_Comm *comm, int context_offset, int *flag, MPI_Status *status)
{
uint64_t match_info = NEM_MX_MATCH_DIRECT;
uint64_t match_mask = NEM_MX_MATCH_FULL_MASK;
int mpi_errno = MPI_SUCCESS;
mx_return_t ret;
mx_status_t mx_status;
uint32_t result;
NEM_MX_SET_CTXT(match_info,comm->context_id + context_offset);
if( source == MPI_ANY_SOURCE)
{
NEM_MX_SET_ANYSRC(match_info);
NEM_MX_SET_ANYSRC(match_mask);
}
else
NEM_MX_SET_SRC(match_info,source);
if (tag == MPI_ANY_TAG)
{
NEM_MX_SET_ANYTAG(match_info);
NEM_MX_SET_ANYTAG(match_mask);
}
else
NEM_MX_SET_TAG(match_info,tag);
ret = mx_iprobe(MPID_nem_mx_local_endpoint,match_info,match_mask,&mx_status,&result);
MPIU_Assert(ret == MX_SUCCESS);
if (result != 0)
{
NEM_MX_MATCH_GET_RANK(mx_status.match_info,status->MPI_SOURCE);
NEM_MX_MATCH_GET_TAG(mx_status.match_info,status->MPI_TAG);
status->count = mx_status.xfer_length;
*flag = TRUE;
}
else
*flag = FALSE;
fn_exit:
return mpi_errno;
fn_fail: ATTRIBUTE((unused))
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPID_nem_mx_improbe
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_nem_mx_improbe(MPIDI_VC_t *vc, int source, int tag, MPID_Comm *comm, int context_offset, int *flag, MPID_Request **message, MPI_Status *status)
{
int mpi_errno = MPI_SUCCESS;
/* not currently implemented for MX */
MPIU_ERR_SET(mpi_errno, MPI_ERR_INTERN, "**nomprobe");
fn_exit:
return mpi_errno;
fn_fail: ATTRIBUTE((unused))
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPID_nem_mx_anysource_iprobe
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPID_nem_mx_anysource_iprobe(int tag, MPID_Comm *comm, int context_offset, int *flag, MPI_Status *status)
{
return MPID_nem_mx_iprobe(NULL, MPI_ANY_SOURCE, tag, comm, context_offset, flag, status);
}
#undef FUNCNAME
#define FUNCNAME MPID_nem_mx_anysource_iprobe
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPID_nem_mx_anysource_improbe(int tag, MPID_Comm *comm, int context_offset, int *flag, MPID_Request **message, MPI_Status *status)
{
return MPID_nem_mx_improbe(NULL, MPI_ANY_SOURCE, tag, comm, context_offset, flag, message, status);
}
|
//
// XtifyGlobal.h
//
//
// Created by Gilad on 4/25/11.
// Copyright 2011 Xtify. All rights reserved.
//
// For help, visit: http://developer.xtify.com
//xSdkVer @"v2.51" // internal xtify sdk version
// Xtify AppKey
//
// Enter the AppKey assigned to your app at http://console.xtify.com
// Nothing works without this.
#define xAppKey @"REPLACE_WITH_YOUR_APP_KEY"
//
// Location updates
//
// Set to YES to let Xtify receive location updates from the user. The user will also receive a prompt asking for permission to do so.
// Set to NO to completely turn off location updates. No prompt will appear. Suitable for simple/rich notification push only
#define xLocationRequired NO
// Background location update
//
// Set this to TRUE if you want to also send location updates on significant change to Xtify while the app is in the background.
// Set this to FALSE if you want to send location updates on significant change to Xtify while the app is in the foreground only.
#define xRunAlsoInBackground FALSE
// Desired location accuracy
//
// If using location feature, set xDesiredLocationAccuracy value to one of the following. (Keep in mind, there is a trade off between battery life and accuracy. The higher the accuracy the longer it takes to find the position and the greater the battery consumtion is).
// kCLLocationAccuracyBestForNavigation, kCLLocationAccuracyBest, kCLLocationAccuracyNearestTenMeters,
// kCLLocationAccuracyHundredMeters, kCLLocationAccuracyKilometer, kCLLocationAccuracyThreeKilometers
// For a detailed description about these options, please visit the Apple Documentation at the url:
// http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
#define xDesiredLocationAccuracy kCLLocationAccuracyKilometer // kCLLocationAccuracyBest
// Badge management
//
// Set to XLInboxManagedMethod to let the Xtify SDK manage the badge count on the client and the server
// Set to XLDeveloperManagedMethod if you want to handle updating the badge on the client and server (you'll need to create your own method)
// We've included an example on how to set/update the badge in the main delegate file within our sample apps
#define xBadgeManagerMethod XLInboxManagedMethod
// Logging Flag
//
// To turn on logging change xLogging to true
#define xLogging TRUE
// This is a premium feature that supports a regional control of messaging by multiple user governed by one primary organization account. Suitable for organizations that have multiple geographical regions or franchise business models. This feature will only work with Enterprise accounts. Please inquire with Xtify to enable this feature.
#define xMultipleMarkets FALSE
|
/*
test_softacc_cipher.c
Author: Pekka Riikonen <priikone@silcnet.org>
Copyright (C) 2008 Pekka Riikonen
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 "silccrypto.h"
#include "softacc.h"
#define ENC_LEN 0x00100000 /* enc data len (at least) */
#define ENC_ROUND 512 /* enc rounds (at least) */
#define ENC_MIN_TIME 15.0 /* seconds to run the test (at least) */
SilcTimerStruct timer;
SilcCipher cipher, acc_cipher;
int main(int argc, char **argv)
{
SilcUInt64 sec;
SilcUInt32 usec;
double totsec;
unsigned char *data;
SilcUInt32 rounds;
SilcUInt32 i, k;
silc_runtime_init();
silc_crypto_init(NULL);
#if 0
silc_log_debug(TRUE);
silc_log_quick(TRUE);
silc_log_debug_hexdump(TRUE);
silc_log_set_debug_string("*acc*,*thread*");
#endif
if (!silc_acc_init(SILC_SOFTACC, (void *)0x01, "min_threads", 2,
"max_threads", 8, NULL))
exit(1);
data = malloc(ENC_LEN * sizeof(*data));
if (!data)
exit(1);
for (i = 0; i < ENC_LEN; i++)
data[i] = i % 255;
silc_timer_synchronize(&timer);
for (i = 0; silc_default_ciphers[i].name; i++) {
if (!silc_cipher_alloc(silc_default_ciphers[i].name, &cipher)) {
fprintf(stderr, "Error allocating %s\n", silc_default_ciphers[i].name);
exit(1);
}
acc_cipher = silc_acc_cipher(SILC_SOFTACC, cipher);
if (!acc_cipher)
continue;
silc_cipher_set_iv(acc_cipher, data);
silc_cipher_set_key(acc_cipher, data, silc_cipher_get_key_len(cipher),
TRUE);
sleep(1);
rounds = ENC_ROUND;
retry:
silc_timer_start(&timer);
for (k = 0; k < rounds; k++)
silc_cipher_encrypt(acc_cipher, data, data, ENC_LEN, NULL);
silc_timer_stop(&timer);
silc_timer_value(&timer, &sec, &usec);
totsec = (double)sec;
totsec += ((double)usec / (double)((double)1000 * (double)1000));
if (totsec < ENC_MIN_TIME) {
rounds += rounds;
goto retry;
}
silc_cipher_free(acc_cipher);
silc_cipher_free(cipher);
sleep(1);
printf("%s:\t%.2f KB (%.2f MB, %.2f Mbit) / sec (total %.3f secs)\n",
silc_default_ciphers[i].name,
(((double)((double)ENC_LEN * (double)rounds) / 1024.0) / totsec),
(((double)((double)ENC_LEN * (double)rounds) / (1024.0 *
1024.0)) / totsec),
((((double)((double)ENC_LEN * (double)rounds) / 1024.0)
/ 128.0) / totsec),
totsec);
}
silc_acc_uninit(SILC_SOFTACC);
silc_crypto_uninit();
silc_runtime_uninit();
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.