text stringlengths 4 6.14k |
|---|
/*
* Quadromania
* (c) 2002/2003/2009/2010 by Matthias Arndt <marndt@asmsoftware.de> / ASM Software
*
* File: sound.h - header file for the sound and music API
* last Modified: 29.06.2010 : 19:23
*
* 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
*
* THIS SOFTWARE IS SUPPLIED AS IT IS WITHOUT ANY WARRANTY!
*
*/
#ifndef __SOUND_H
#define __SOUND_H
#include "datatypes.h"
#include "sysconfig.h"
/**************************
* DATA TYPE DECLARATIONS *
**************************/
typedef enum
{
SOUND_MENU = 1,
SOUND_TURN = 2,
SOUND_WIN = 3,
SOUND_LOOSE = 4
} SoundEffect;
/**************
* PROTOTYPES *
**************/
void Sound_Init(void);
void Sound_PlayEffect(SoundEffect snd);
void Sound_Exit(void);
void Sound_SetVolume(Uint8 volume);
void Sound_IncreaseVolume(void);
void Sound_DecreaseVolume(void);
#endif /* __SOUND_H */
|
/*
* Author: andip71
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
extern int ac_level;
#define AC_CHARGE_LEVEL_DEFAULT 1100
#define AC_CHARGE_LEVEL_MIN 600
#define AC_CHARGE_LEVEL_MAX 1200
extern int usb_level;
#define USB_CHARGE_LEVEL_DEFAULT 900
#define USB_CHARGE_LEVEL_MIN 475
#define USB_CHARGE_LEVEL_MAX 1000
|
//
// RouteDetailsTableViewController.h
// Route Recorder
//
// Created by skobbler on 7/12/13.
// Copyright (c) 2013 skobbler. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface RouteDetailsTableViewController : UITableViewController <MKMapViewDelegate>
@property (nonatomic, strong) NSDate *startTime;
@property (nonatomic, strong) NSDate *endTime;
@property (nonatomic, strong) NSSet *routePoints;
@property (nonatomic, strong) NSSet *routePhotos;
@end
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
/****************************************************************************
**
** Implementation of QInputContext class
**
** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QINPUTCONTEXT_P_H
#define QINPUTCONTEXT_P_H
#include "private/qobject_p.h"
#include "qwidget.h"
#include "qinputcontext.h"
#ifndef QT_NO_IM
QT_BEGIN_NAMESPACE
class QInputContextPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QInputContext)
public:
QInputContextPrivate()
: focusWidget(0)
{}
QWidget *focusWidget;
#if defined(Q_WS_WIN) || defined(Q_WS_QWS)
static void updateImeStatus(QWidget *w, bool hasFocus);
#endif
};
QT_END_NAMESPACE
#endif
#endif
|
/*
*
*
*
*
* 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 _VMAPTOOLS_H
#define _VMAPTOOLS_H
#include <G3D/CollisionDetection.h>
#include <G3D/AABox.h>
#include "NodeValueAccess.h"
/**
The Class is mainly taken from G3D/AABSPTree.h but modified to be able to use our internal data structure.
This is an iterator that helps us analysing the BSP-Trees.
The collision detection is modified to return true, if we are inside an object.
*/
namespace VMAP
{
template<class TValue>
class IntersectionCallBack {
public:
TValue* closestEntity;
G3D::Vector3 hitLocation;
G3D::Vector3 hitNormal;
void operator()(const G3D::Ray& ray, const TValue* entity, bool pStopAtFirstHit, float& distance) {
entity->intersect(ray, distance, pStopAtFirstHit, hitLocation, hitNormal);
}
};
//==============================================================
//==============================================================
//==============================================================
class MyCollisionDetection
{
private:
public:
static bool collisionLocationForMovingPointFixedAABox(
const G3D::Vector3& origin,
const G3D::Vector3& dir,
const G3D::AABox& box,
G3D::Vector3& location,
bool& Inside)
{
// Integer representation of a floating-point value.
#define IR(x) ((G3D::uint32&)x)
Inside = true;
const G3D::Vector3& MinB = box.low();
const G3D::Vector3& MaxB = box.high();
G3D::Vector3 MaxT(-1.0f, -1.0f, -1.0f);
// Find candidate planes.
for (int i = 0; i < 3; ++i)
{
if (origin[i] < MinB[i])
{
location[i] = MinB[i];
Inside = false;
// Calculate T distances to candidate planes
if (IR(dir[i]))
{
MaxT[i] = (MinB[i] - origin[i]) / dir[i];
}
}
else if (origin[i] > MaxB[i])
{
location[i] = MaxB[i];
Inside = false;
// Calculate T distances to candidate planes
if (IR(dir[i]))
{
MaxT[i] = (MaxB[i] - origin[i]) / dir[i];
}
}
}
if (Inside)
{
// definite hit
location = origin;
return true;
}
// Get largest of the maxT's for final choice of intersection
int WhichPlane = 0;
if (MaxT[1] > MaxT[WhichPlane])
{
WhichPlane = 1;
}
if (MaxT[2] > MaxT[WhichPlane])
{
WhichPlane = 2;
}
// Check final candidate actually inside box
if (IR(MaxT[WhichPlane]) & 0x80000000)
{
// Miss the box
return false;
}
for (int i = 0; i < 3; ++i)
{
if (i != WhichPlane)
{
location[i] = origin[i] + MaxT[WhichPlane] * dir[i];
if ((location[i] < MinB[i]) ||
(location[i] > MaxB[i]))
{
// On this plane we're outside the box extents, so
// we miss the box
return false;
}
}
}
/*
// Choose the normal to be the plane normal facing into the ray
normal = G3D::Vector3::zero();
normal[WhichPlane] = (dir[WhichPlane] > 0) ? -1.0 : 1.0;
*/
return true;
#undef IR
}
};
}
#endif
|
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2010 Martin Gräßlin <mgraesslin@kde.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, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_SCREENSHOT_H
#define KWIN_SCREENSHOT_H
#include <kwineffects.h>
#include <QObject>
#include <QImage>
namespace KWin
{
class ScreenShotEffect : public Effect
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Screenshot")
public:
enum ScreenShotType {
INCLUDE_DECORATION = 1 << 0,
INCLUDE_CURSOR = 1 << 1
};
ScreenShotEffect();
virtual ~ScreenShotEffect();
virtual void postPaintScreen();
virtual bool isActive() const;
int requestedEffectChainPosition() const override {
return 50;
}
static bool supported();
static void convertFromGLImage(QImage &img, int w, int h);
public Q_SLOTS:
Q_SCRIPTABLE void screenshotForWindow(qulonglong winid, int mask = 0);
Q_SCRIPTABLE void screenshotWindowUnderCursor(int mask = 0);
/**
* Saves a screenshot of all screen into a file and returns the path to the file.
* Functionality requires hardware support, if not available a null string is returned.
* @returns Path to stored screenshot, or null string in failure case.
**/
Q_SCRIPTABLE QString screenshotFullscreen();
/**
* Saves a screenshot of the screen identified by @p screen into a file and returns the path to the file.
* Functionality requires hardware support, if not available a null string is returned.
* @param screen Number of screen as numbered by QDesktopWidget
* @returns Path to stored screenshot, or null string in failure case.
**/
Q_SCRIPTABLE QString screenshotScreen(int screen);
/**
* Saves a screenshot of the selected geometry into a file and returns the path to the file.
* Functionality requires hardware support, if not available a null string is returned.
* @param x Left upper x coord of region
* @param y Left upper y coord of region
* @param width Width of the region to screenshot
* @param height Height of the region to screenshot
* @returns Path to stored screenshot, or null string in failure case.
**/
Q_SCRIPTABLE QString screenshotArea(int x, int y, int width, int height);
Q_SIGNALS:
Q_SCRIPTABLE void screenshotCreated(qulonglong handle);
private Q_SLOTS:
void windowClosed( KWin::EffectWindow* w );
private:
void grabPointerImage(QImage& snapshot, int offsetx, int offsety);
QString blitScreenshot(const QRect &geometry);
EffectWindow *m_scheduledScreenshot;
ScreenShotType m_type;
};
} // namespace
#endif // KWIN_SCREENSHOT_H
|
//
// Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences.
// All rights reserved.
// This file is part of FirteX (www.firtex.org)
//
// Use of the FirteX is subject to the terms of the software license set forth in
// the LICENSE file included with this software, and also available at
// http://www.firtex.org/license.html
//
// Author : ¹ùÈð½Ü(GuoRuijie)
// Email : ruijieguo@software.ict.ac.cn
// Created : 2005/12/07
//
#ifndef _INDEX_H
#define _INDEX_H
#include "utility/StdHeader.h"
#include "../document/Document.h"
#include "../store/Directory.h"
#include "IndexWriter.h"
#include "IndexReader.h"
using namespace firtex;
using namespace firtex::store;
namespace firtex
{
namespace index
{
class CNormBytes;
class CBarrelsInfo;
class CIndex
{
public:
typedef int32_t ACCESS_MODE;
///Ë÷Òý·ÃÎÊģʽ¶¨Òå
const static int32_t ACCESS_READONLY = 0x00; /// Ö»¶Á£¬¿ÉÒÔ¶Á£¬ËÑË÷Ë÷ÒýÊý¾Ý¿â£¬µ«ÊDz»ÄÜÐ޸ģ¨Ìí¼ÓºÍɾ³ýÎļþ£©
/// read only,can read,search it but can't modify it,i.e.add files or delete files.
const static int32_t ACCESS_CREATE = 0x10; /// ´´½¨£¬¿ÉÒÔÌí¼Ó£¬É¾³ýÎĵµ£¬ÄܶÁÈ¡Ë÷ÒýµÄ²¿·ÖÊý¾Ý£¨ÀýÈçÎĵµ×ÜÊýµÈͳ¼ÆÐÅÏ¢£©£¬µ«ÊDz»ÄܽøÐÐËÑË÷²Ù×÷£¬Èç¹ûË÷ÒýÊý¾Ý¿âÒѾ´æÔÚÔò×Ô¶¯É¾³ý
/// write only,can add or delete files but can't search over it,will delete existed index database
const static int32_t ACCESS_APPEND = 0x20; /// ÔöÁ¿Ë÷Òý£¬µ«ÊDz»Í¬ÓÚACCESS_WRITE£¬Èç¹ûË÷ÒýÊý¾Ý¿âÒѾ´æÔÚ£¬Ôò×·¼ÓÐÂË÷ÒýÊý¾Ý¶ø²»É¾³ýÒÑÓÐË÷ÒýÊý¾Ý
/// write only,but unlike ACCESS_WRITE,will append index data do existed index database.
const static int32_t ACCESS_MODIFY = 0x40; /// Ð޸쬴ò¿ªÒÑ´æÔÚµÄË÷ÒýÊý¾Ý£¬¿ÉÒÔ×öÏàÓ¦µÄÐ޸ģ¬ÀýÈçË÷ÒýºÏ²¢£¬É¾³ýÎĵµµÈ
/// modify, open exist database, can modify database,etc.merge index,delete documents
const static int32_t ACCESS_SEARCH = 0x01; /// ËÑË÷£¬´ò¿ªÒÑ´æÔÚµÄË÷ÒýÊý¾Ý£¬¿ÉÒÔ¶ÁÈ¡Ë÷ÒýÐÅÏ¢ºÍËÑË÷£¬²»ÄÜÐÞ¸Ä
/// search, open exist database, can read/search database, but can't modify it.
public:
CIndex(const tchar* indName,ACCESS_MODE am);
CIndex(CDirectory* pDirectory,ACCESS_MODE am);
CIndex(void);
virtual ~CIndex(void);
public:
/**
* »ñÈ¡Ë÷ÒýµÄ°æ±¾ºÅ
* @return °æ±¾ºÅ×Ö·û´®£¬¸ñʽ£ºÃû³Æ.°æ±¾ºÅ
*/
tstring getVersion(){return FIRTEX_VERSION;}
/**
* ´ò¿ªË÷Òý
* @param name Ë÷Òý·¾¶
* @param am Ë÷ÒýµÄ·ÃÎÊ·½Ê½
*/
void open(const tchar* path,ACCESS_MODE am);
/**
* ´ò¿ªË÷Òý
* @param pDirectory Ë÷Òý´æ´¢É豸
* @param am Ë÷ÒýµÄ·ÃÎÊ·½Ê½
*/
void open(CDirectory* pDirectory,ACCESS_MODE am);
/**
* ¹Ø±ÕË÷ÒýÊÍ·Å×ÊÔ´
*/
void close();
/**
* ÉèÖÃÎĵµµÄschema,±ØÐëÔÚµ÷ÓÃacquireWriter()ǰµ÷ÓÃ,µ÷Óúó¾ÉµÄschemaÐÅÏ¢½«Çå³ý
* @param pSchema schema¶ÔÏóÖ¸Õë,²»×÷ΪÄÚ²¿¶ÔÏó
*/
void setDocSchema(CDocumentSchema* pSchema);
/** »ñÈ¡Ë÷ÒýÎĵµSchema */
CDocumentSchema* getSchema(){return m_pDocSchema;}
/**
* »ñÈ¡Ë÷ÒýµÄdirectory¶ÔÏó
*/
CDirectory* getDirectory(){return m_pDirectory;}
/**
* ÉèÖÃË÷ÒýÃû³Æ
*/
void setDirectory(CDirectory* pDir);
/**
* »ñÈ¡Ë÷ÒýͰÐÅÏ¢
*/
CBarrelsInfo* getBarrelsInfo(){return m_pBarrelsInfo;}
/** get access mode */
ACCESS_MODE getAccessMode(){return m_accessMode;}
/**
* is index modified?
* @return true if modified, otherwise false
*/
bool isDirty(){return m_bDirty;}
/**
* set or clear index modification state
* @param bDirty modification state
*/
void setDirty(bool bDirty = true);
/**
* »ñÈ¡Ë÷ÒýµÄreader¶ÔÏ󣬽öµ±ACCESS_MODE = ACCESS_READONLY »ò
* ACCESS_READWRITE »ò ACCESS_READAPPENDʱ·µ»ØÓÐЧ¶ÔÏó
* @return reader¶ÔÏóµÄÒýÓÃ
* @memory ÄÚ²¿¶ÔÏó£¬Íⲿ²»ÄÜɾ³ý
*/
CIndexReader* acquireReader();
/**
* »ñÈ¡Ë÷ÒýµÄwriter¶ÔÏ󣬽öµ±ACCESS_MODE = ACCESS_WRITE »ò
* ACCESS_READWRITE »ò ACCESS_APPEND»òACCEACCESS_READAPPENDʱ·µ»ØÓÐЧ¶ÔÏó
* @param pParser Îı¾¸ñʽ·ÖÎöÆ÷,ÓÉÄÚ²¿Î¬»¤
* @param pAnalyzer Îı¾ÄÚÈÝ·ÖÎöÆ÷£¬ÓÉÄÚ²¿Î¬»¤
* @param ms Ë÷ÒýºÏ²¢²ßÂÔ
* @return writer¶ÔÏóµÄÒýÓã¬ÄÚ²¿¶ÔÏó£¬Íⲿ²»ÄÜɾ³ý
*/
CIndexWriter* acquireWriter(CParser* pParser,CAnalyzer* pAnalyzer);
/**
* »ñÈ¡Ë÷ÒýµÄwriter¶ÔÏ󣬽öµ±ACCESS_MODE = ACCESS_WRITE »ò
* ACCESS_READWRITE »ò ACCESS_APPEND»òACCEACCESS_READAPPENDʱ·µ»ØÓÐЧ¶ÔÏó
* @param ms Ë÷ÒýºÏ²¢²ßÂÔ
* @return writer¶ÔÏóµÄÒýÓã¬ÄÚ²¿¶ÔÏó£¬Íⲿ²»ÄÜɾ³ý
*/
CIndexWriter* acquireWriter();
protected:
/** ´ÓË÷Òý´´½¨Óò¹¤³§ */
CFactoryFinder* createFactoryFinderFromExistIndex();
/** ´ÓË÷Òý´´½¨ÎĵµÄ£Ê½ */
CDocumentSchema* createSchemaFromExistIndex();
/** »ñÈ¡Óò¹¤³§*/
CFactoryFinder* getFactoryFinder();
protected:
CDirectory* m_pDirectory; ///Ë÷Òý´æ´¢Î»ÖÃ
CIndexReader* m_pReader; ///Ë÷Òý¶Á·ÃÎÊ
CIndexWriter* m_pWriter; ///Ë÷Òýд·ÃÎÊ
CBarrelsInfo* m_pBarrelsInfo; ///Ë÷ÒýÈ«¾ÖÐÅÏ¢
ACCESS_MODE m_accessMode; ///Ë÷Òý´æÈ¡Ä£Ê½
bool m_bDirty; ///Ë÷ÒýÊÇ·ñ½øÐйýÐÞ¸Ä
CDocumentSchema* m_pDocSchema; ///ÎĵµµÄschemaÐÅÏ¢
CFactoryFinder* m_pFactoryFinder; ///field component factory finder
friend class CIndexWriter;
friend class CIndexReader;
friend class CIndexBarrelReader;
};
}
}
#endif
|
# ifndef C_NSF_CACHED_INCLUDE_I
# define C_NSF_CACHED_INCLUDE_I
# include "Libraries/C-Root.h"
# include "Libraries/C-NSF-Cached.h"
# include "Libraries/C-NGroup.h"
// -- this classes names, etc --------------------------------------------
# define SW_CLIB SWC_NSF_Cached
# define SW_CNAME "NSF_Cached"
# define SW_SUPERPUB SWC_NSFilter
# define SW_CATVER 1
# include "S-Params.h"
# include "Proto/NSF_Cached_protos.h"
// -- catalog strings (must match with SW_CATSTR) -------------------------
enum {
SWS_H_Cached = 1,
SWS_LASTSTR,
};
# include "S-CatMsgs.h"
// -- our instance specific data ------------------------------------------
typedef struct SW_IDATA
{
ULONG Total, Found, Inv;
} SW_IDATA;
# endif // C_NSF_CACHED_INCLUDE_I
|
/*
* $Id: keyword.c,v 1.6 2006/05/30 04:37:12 darren Exp $
*
* Copyright (c) 1998-2002, Darren Hiebert
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* Manages a keyword hash.
*/
/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include <string.h>
#include "debug.h"
#include "keyword.h"
#include "options.h"
#include "routines.h"
/*
* MACROS
*/
#define HASH_EXPONENT 7 /* must be less than 17 */
/*
* DATA DECLARATIONS
*/
typedef struct sHashEntry {
struct sHashEntry *next;
const char *string;
langType language;
int value;
} hashEntry;
/*
* DATA DEFINITIONS
*/
static const unsigned int TableSize = 1 << HASH_EXPONENT;
static hashEntry **HashTable = NULL;
/*
* FUNCTION DEFINITIONS
*/
static hashEntry **getHashTable (void)
{
static boolean allocated = FALSE;
if (! allocated)
{
unsigned int i;
HashTable = xMalloc (TableSize, hashEntry*);
for (i = 0 ; i < TableSize ; ++i)
HashTable [i] = NULL;
allocated = TRUE;
}
return HashTable;
}
static hashEntry *getHashTableEntry (unsigned long hashedValue)
{
hashEntry **const table = getHashTable ();
hashEntry *entry;
Assert (hashedValue < TableSize);
entry = table [hashedValue];
return entry;
}
static unsigned long hashValue (const char *const string)
{
unsigned long value = 0;
const unsigned char *p;
Assert (string != NULL);
/* We combine the various words of the multiword key using the method
* described on page 512 of Vol. 3 of "The Art of Computer Programming".
*/
for (p = (const unsigned char *) string ; *p != '\0' ; ++p)
{
value <<= 1;
if (value & 0x00000100L)
value = (value & 0x000000ffL) + 1L;
value ^= *p;
}
/* Algorithm from page 509 of Vol. 3 of "The Art of Computer Programming"
* Treats "value" as a 16-bit integer plus 16-bit fraction.
*/
value *= 40503L; /* = 2^16 * 0.6180339887 ("golden ratio") */
value &= 0x0000ffffL; /* keep fractional part */
value >>= 16 - HASH_EXPONENT; /* scale up by hash size and move down */
return value;
}
static hashEntry *newEntry (
const char *const string, langType language, int value)
{
hashEntry *const entry = xMalloc (1, hashEntry);
entry->next = NULL;
entry->string = string;
entry->language = language;
entry->value = value;
return entry;
}
/* Note that it is assumed that a "value" of zero means an undefined keyword
* and clients of this function should observe this. Also, all keywords added
* should be added in lower case. If we encounter a case-sensitive language
* whose keywords are in upper case, we will need to redesign this.
*/
extern void addKeyword (const char *const string, langType language, int value)
{
const unsigned long hashedValue = hashValue (string);
hashEntry *tableEntry = getHashTableEntry (hashedValue);
hashEntry *entry = tableEntry;
if (entry == NULL)
{
hashEntry **const table = getHashTable ();
table [hashedValue] = newEntry (string, language, value);
}
else
{
hashEntry *prev = NULL;
while (entry != NULL)
{
if (language == entry->language &&
strcmp (string, entry->string) == 0)
{
Assert (("Already in table" == NULL));
}
prev = entry;
entry = entry->next;
}
if (entry == NULL)
{
Assert (prev != NULL);
prev->next = newEntry (string, language, value);
}
}
}
extern int lookupKeyword (const char *const string, langType language)
{
const unsigned long hashedValue = hashValue (string);
hashEntry *entry = getHashTableEntry (hashedValue);
int result = -1;
while (entry != NULL)
{
if (language == entry->language && strcmp (string, entry->string) == 0)
{
result = entry->value;
break;
}
entry = entry->next;
}
return result;
}
extern void freeKeywordTable (void)
{
if (HashTable != NULL)
{
unsigned int i;
for (i = 0 ; i < TableSize ; ++i)
{
hashEntry *entry = HashTable [i];
while (entry != NULL)
{
hashEntry *next = entry->next;
eFree (entry);
entry = next;
}
}
eFree (HashTable);
}
}
#ifdef DEBUG
static void printEntry (const hashEntry *const entry)
{
printf (" %-15s %-7s\n", entry->string, getLanguageName (entry->language));
}
static unsigned int printBucket (const unsigned int i)
{
hashEntry **const table = getHashTable ();
hashEntry *entry = table [i];
unsigned int measure = 1;
boolean first = TRUE;
printf ("%2d:", i);
if (entry == NULL)
printf ("\n");
else while (entry != NULL)
{
if (! first)
printf (" ");
else
{
printf (" ");
first = FALSE;
}
printEntry (entry);
entry = entry->next;
measure = 2 * measure;
}
return measure - 1;
}
extern void printKeywordTable (void)
{
unsigned long emptyBucketCount = 0;
unsigned long measure = 0;
unsigned int i;
for (i = 0 ; i < TableSize ; ++i)
{
const unsigned int pass = printBucket (i);
measure += pass;
if (pass == 0)
++emptyBucketCount;
}
printf ("spread measure = %ld\n", measure);
printf ("%ld empty buckets\n", emptyBucketCount);
}
#endif
/* vi:set tabstop=4 shiftwidth=4: */
|
/* drivers/atm/tonga.h - Efficient Networks Tonga (PCI bridge) declarations */
/* Written 1995 by Werner Almesberger, EPFL LRC */
#ifndef DRIVER_ATM_TONGA_H
#define DRIVER_ATM_TONGA_H
#define PCI_TONGA_CTRL 0x60 /* control register */
#define END_SWAP_DMA 0x80 /* endian swap on DMA */
#define END_SWAP_BYTE 0x40 /* endian swap on slave byte accesses */
#define END_SWAP_WORD 0x20 /* endian swap on slave word accesses */
#define SEPROM_MAGIC 0x0c /* obscure required pattern (ASIC only) */
#define SEPROM_DATA 0x02 /* serial EEPROM data (ASIC only) */
#define SEPROM_CLK 0x01 /* serial EEPROM clock (ASIC only) */
#define SEPROM_ESI_BASE 64 /* start of ESI in serial EEPROM */
#endif
|
// Copyright 2014 The Android Open Source Project
//
// This software is licensed under the terms of the GNU General Public
// License version 2, as published by the Free Software Foundation, and
// may be copied, distributed, and modified under those terms.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
#pragma once
// Older Mingw32 headers didn't define all error macros appropriately.
// Include this header to work-around this.
#include <errno.h>
#ifdef _WIN32
# include "android/base/sockets/Winsock.h"
# ifndef EINTR
# define EINTR 10004
# endif
# ifndef EAGAIN
# define EAGAIN 10035
# endif
# ifndef EWOULDBLOCK
# define EWOULDBLOCK EAGAIN
# endif
# ifndef EINPROGRESS
# define EINPROGRESS 10036
# endif
# ifndef EALREADY
# define EALREADY 10037
# endif
# ifndef EDESTADDRREQ
# define EDESTADDRREQ 10039
# endif
# ifndef EMSGSIZE
# define EMSGSIZE 10040
# endif
# ifndef EPROTOTYPE
# define EPROTOTYPE 10041
# endif
# ifndef ENOPROTOOPT
# define ENOPROTOOPT 10042
# endif
# ifndef EAFNOSUPPORT
# define EAFNOSUPPORT 10047
# endif
# ifndef EADDRINUSE
# define EADDRINUSE 10048
# endif
# ifndef EADDRNOTAVAIL
# define EADDRNOTAVAIL 10049
# endif
# ifndef ENETDOWN
# define ENETDOWN 10050
# endif
# ifndef ENETUNREACH
# define ENETUNREACH 10051
# endif
# ifndef ENETRESET
# define ENETRESET 10052
# endif
# ifndef ECONNABORTED
# define ECONNABORTED 10053
# endif
# ifndef ECONNRESET
# define ECONNRESET 10054
# endif
# ifndef ENOBUFS
# define ENOBUFS 10055
# endif
# ifndef EISCONN
# define EISCONN 10056
# endif
# ifndef ENOTCONN
# define ENOTCONN 10057
# endif
# ifndef ESHUTDOWN
# define ESHUTDOWN 10058
# endif
# ifndef ETOOMANYREFS
# define ETOOMANYREFS 10059
# endif
# ifndef ETIMEDOUT
# define ETIMEDOUT 10060
# endif
# ifndef ECONNREFUSED
# define ECONNREFUSED 10061
# endif
# ifndef ELOOP
# define ELOOP 10062
# endif
# ifndef EHOSTDOWN
# define EHOSTDOWN 10064
# endif
# ifndef EHOSTUNREACH
# define EHOSTUNREACH 10065
# endif
#endif /* _WIN32 */
|
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% CCCC OOO M M PPPP OOO SSSSS IIIII TTTTT EEEEE %
% C O O MM MM P P O O SS I T E %
% C O O M.M M PPPP O O SSS I T EEE %
% C O O M M P O O SS I T E %
% CCCC OOO M M P OOO SSSSS IIIII T EEEEE %
% %
% %
% Digitally composite two images. %
% %
% Software Design %
% John Cristy %
% January 1993 %
% %
% %
% Copyright 1999-2005 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% http://www.imagemagick.org/script/license.php %
% %
% 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. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Program Composite composites images to create new images.
%
%
*/
/*
Include declarations.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "magick/ImageMagick.h"
#if defined(__WINDOWS__)
#include <windows.h>
#endif
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a i n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
int main(int argc,char **argv)
{
char
*option;
ExceptionInfo
exception;
ImageInfo
*image_info;
MagickBooleanType
status;
register long
i;
InitializeMagick(*argv);
GetExceptionInfo(&exception);
for (i=1; i < (long) argc; i++)
{
option=argv[i];
if ((strlen(option) == 1) || ((*option != '-') && (*option != '+')))
continue;
if ((LocaleCompare("debug",option+1) == 0) && (i < (long) (argc-1)))
(void) SetLogEventMask(argv[++i]);
if (LocaleCompare("version",option+1) == 0)
{
(void) fprintf(stdout,"Version: %s\n",
GetMagickVersion((unsigned long *) NULL));
(void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright());
exit(0);
}
}
image_info=CloneImageInfo((ImageInfo *) NULL);
status=CompositeImageCommand(image_info,argc,argv,(char **) NULL,&exception);
if (exception.severity != UndefinedException)
CatchException(&exception);
image_info=DestroyImageInfo(image_info);
DestroyExceptionInfo(&exception);
DestroyMagick();
exit(!status);
return(MagickFalse);
}
|
#ifndef LOGIC_TEST_MOCK_POSSIBILITIES_REGISTRY_H
#define LOGIC_TEST_MOCK_POSSIBILITIES_REGISTRY_H
#include "config.h"
#include "logic/IPossibilitiesRegistry.h"
MOCK_BASE_CLASS(MockPossibilitiesRegistry, IPossibilitiesRegistry)
{
MOCK_METHOD(add, 1);
MOCK_METHOD(remove, 1);
MOCK_METHOD(valuesForCell, 1);
MOCK_METHOD(cellsForValue, 1);
};
#endif
|
// WinSystem.h
// this file is part of Context Free
// ---------------------
// Copyright (C) 2005-2012 John Horigan - john@glyphic.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// John Horigan can be contacted at john@glyphic.com or at
// John Horigan, 1209 Villa St., Mountain View, CA 94041-1123, USA
//
//
#ifndef INCLUDE_WINSYSTEM_H
#define INCLUDE_WINSYSTEM_H
#include <iostream>
#include <string>
#include <map>
#include "Win32System.h"
#define myWM_USER (0x400)
class WinSystem : public Win32System
{
public:
enum { WM_USER_MESSAGE_UPDATE = myWM_USER + 100,
WM_USER_STATUS_UPDATE = myWM_USER + 101,
WM_USER_SYNTAX_ERROR = myWM_USER + 102,
WM_ACTIVATE = 0x0006,
WA_ACTIVE = 1,
WM_DDE_INITIATE = 0x03E0,
WM_DDE_EXECUTE = 0x03E8,
WM_DDE_ACK = 0x3E4,
SW_SHOWNORMAL = 1,
EM_SETTABSTOPS = 0x00CB};
WinSystem(void*);
~WinSystem();
virtual void message(const char* fmt, ...);
virtual void syntaxError(const CfdgError& err);
virtual bool error(bool errorOccurred = true);
virtual void catastrophicError(const char* what);
virtual std::istream* openFileForRead(const std::string& path) override;
// caller must delete returned streams when done
virtual void orphan();
virtual void stats(const Stats&);
void statusUpdate();
bool updateInfo(const char* name, const char* text);
static std::map<const std::string, std::string> ExampleMap;
static void AddExample(const char* name, const char* text);
std::string mName;
std::string mText;
private:
void* mWindow;
bool mErrorMode;
};
#endif // INCLUDE_WINSYSTEM_H |
/*
* Bitmap.h
*
* Created on: 25.01.2009
* Author: André Wachter
This file is part of arduino-utils.
arduino-utils 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.
arduino-utils 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 arduino-utils. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BITMAP_H_
#define BITMAP_H_
#include <stdint.h>
#include <stdlib.h>
class Bitmap {
public:
Bitmap(uint8_t width, uint8_t heigth, uint8_t* data);
uint8_t width() const;
uint8_t height() const;
uint16_t verticalLine(uint8_t x) const;
void setData(const uint8_t* data);
uint8_t bytesPerLine() const;
size_t sizeInBytes() const;
private:
uint8_t mWidth;
uint8_t mHeight;
const uint8_t* mData;
};
#endif /* BITMAP_H_ */
|
/*
* Copyright (C) 2013-2014 Olivier Gayot
*
* 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 RB_STR_H
#define RB_STR_H
#include <string.h>
#include <stdarg.h>
#include "rb.h"
/*
* locate in the ring buffer pointed to by rb the first string ending by the
* string pointed to by string and return it. the string returned is
* allocated using malloc and should be freed by the developer.
* if no such delimiter can be found, NULL is returned and the ring buffer
* is left unmodified. Otherwise, the string is removed from it.
* nb: the delimiter is discarded in the returned string
*
* common use case:
* request = rb_gets(rb, "\r\n")
*/
char *rb_gets(rb_t *rb, const char *delim);
/*
* same as the above function but takes a null terminated array of delimiters
* the function will return the shortest string matching the criteria.
* if two or more delimiters are found at the same place in the ring buffer,
* the longest will be discarded
*
* common use case:
* request = rb_gets(rb, (const char *[]){"\n", "\r", "\r\n", NULL})
* which will return a request disregarding whether netcat or telnet is used
*/
char *rb_gets2(rb_t *rb, const char *const *delim);
/*
* this functions writes str to the ring buffer pointed by rb. If the ring
* buffer is not large enough to contain all the data, the beginning will be
* overriden. However, a buffer overflow is not susceptible to happen.
*/
static inline rb_t *rb_puts(rb_t *rb, const char *str)
{
return rb_put(rb, str, strlen(str));
}
rb_t *rb_vprintf(rb_t *rb, const char *fmt, va_list list);
/*
* function which behaves like sprintf but which writes into a ring buffer
* if the ring buffer is not large enough to contain all the data,
* the beginning will be overriden. However, a buffer overflow will not occur
*/
__attribute__((format(printf, 2, 3)))
rb_t *rb_printf(rb_t *rb, const char *fmt, ...);
#endif /* RB_STR_H */
|
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: consrv/include/console.h
* PURPOSE: Public Console Management Interface
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#pragma once
VOID NTAPI
ConDrvInitConsoleSupport(VOID);
NTSTATUS NTAPI
ConDrvInitConsole(OUT PCONSOLE* NewConsole,
IN PCONSOLE_INFO ConsoleInfo);
NTSTATUS NTAPI
ConDrvAttachTerminal(IN PCONSOLE Console,
IN PTERMINAL Terminal);
NTSTATUS NTAPI
ConDrvDetachTerminal(IN PCONSOLE Console);
VOID NTAPI
ConDrvDeleteConsole(IN PCONSOLE Console);
BOOLEAN NTAPI
ConDrvValidateConsoleState(IN PCONSOLE Console,
IN CONSOLE_STATE ExpectedState);
BOOLEAN NTAPI
ConDrvValidateConsoleUnsafe(IN PCONSOLE Console,
IN CONSOLE_STATE ExpectedState,
IN BOOLEAN LockConsole);
/* EOF */
|
/*
* MidiPort.h - abstraction of MIDI ports which are part of LMMS's MIDI-
* sequencing system
*
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _MIDI_PORT_H
#define _MIDI_PORT_H
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QPair>
#include "midi.h"
#include "AutomatableModel.h"
class MidiClient;
class MidiEventProcessor;
class MidiPortMenu;
class midiTime;
// class for abstraction of MIDI-port
class MidiPort : public Model, public SerializingObject
{
Q_OBJECT
mapPropertyFromModel(int,inputChannel,setInputChannel,
m_inputChannelModel);
mapPropertyFromModel(int,outputChannel,setOutputChannel,
m_outputChannelModel);
mapPropertyFromModel(int,inputController,setInputController,
m_inputControllerModel);
mapPropertyFromModel(int,outputController,setOutputController,
m_outputControllerModel);
mapPropertyFromModel(int,fixedInputVelocity,setFixedInputVelocity,
m_fixedInputVelocityModel);
mapPropertyFromModel(int,fixedOutputVelocity,setFixedOutputVelocity,
m_fixedOutputVelocityModel);
mapPropertyFromModel(int,fixedOutputNote,setFixedOutputNote,
m_fixedOutputNoteModel);
mapPropertyFromModel(int,outputProgram,setOutputProgram,
m_outputProgramModel);
mapPropertyFromModel(bool,isReadable,setReadable,m_readableModel);
mapPropertyFromModel(bool,isWritable,setWritable,m_writableModel);
public:
typedef QMap<QString, bool> Map;
enum Modes
{
Disabled, // don't route any MIDI-events (default)
Input, // from MIDI-client to MIDI-event-processor
Output, // from MIDI-event-processor to MIDI-client
Duplex // both directions
} ;
MidiPort( const QString & _name,
MidiClient * _mc,
MidiEventProcessor * _mep,
Model * _parent = NULL,
Modes _mode = Disabled );
virtual ~MidiPort();
void setName( const QString & _name );
inline Modes mode() const
{
return m_mode;
}
void setMode( Modes _mode );
inline bool inputEnabled() const
{
return mode() == Input || mode() == Duplex;
}
inline bool outputEnabled() const
{
return mode() == Output || mode() == Duplex;
}
inline int realOutputChannel() const
{
return outputChannel() - 1;
}
void processInEvent( const midiEvent & _me, const midiTime & _time );
void processOutEvent( const midiEvent & _me, const midiTime & _time );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual QString nodeName() const
{
return "midiport";
}
void subscribeReadablePort( const QString & _port,
bool _subscribe = true );
void subscribeWritablePort( const QString & _port,
bool _subscribe = true );
const Map & readablePorts() const
{
return m_readablePorts;
}
const Map & writablePorts() const
{
return m_writablePorts;
}
MidiPortMenu * m_readablePortsMenu;
MidiPortMenu * m_writablePortsMenu;
public slots:
void updateMidiPortMode();
private slots:
void updateReadablePorts();
void updateWritablePorts();
void updateOutputProgram();
private:
MidiClient * m_midiClient;
MidiEventProcessor * m_midiEventProcessor;
Modes m_mode;
IntModel m_inputChannelModel;
IntModel m_outputChannelModel;
IntModel m_inputControllerModel;
IntModel m_outputControllerModel;
IntModel m_fixedInputVelocityModel;
IntModel m_fixedOutputVelocityModel;
IntModel m_fixedOutputNoteModel;
IntModel m_outputProgramModel;
BoolModel m_readableModel;
BoolModel m_writableModel;
Map m_readablePorts;
Map m_writablePorts;
friend class ControllerConnectionDialog;
friend class InstrumentMidiIOView;
signals:
void readablePortsChanged();
void writablePortsChanged();
void modeChanged();
} ;
typedef QList<MidiPort *> MidiPortList;
#endif
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Car.h
* Author: cyrax
*
* Created on November 28, 2015, 1:06 AM
*/
#ifndef CAR_H
#define CAR_H
class Car
{
public:
Car() {}
~Car() {}
bool StartEngine() { return true; }
private:
};
#endif /* CAR_H */
|
/*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/power_supply.h>
#include <mach-msm/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/flash.h>
#include <asm/setup.h>
#ifdef CONFIG_CACHE_L2X0
#include <asm/hardware/cache-l2x0.h>
#endif
#include <mach-msm/vreg.h>
#include <mach-msm/mpp.h>
#include <mach-msm/board.h>
#include <mach-msm/msm_iomap.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include "devices.h"
#include "socinfo.h"
#include "clock.h"
static struct resource smc91x_resources[] = {
[0] = {
.start = 0x9C004300,
.end = 0x9C0043ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MSM_GPIO_TO_INT(132),
.end = MSM_GPIO_TO_INT(132),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device smc91x_device = {
.name = "smc91x",
.id = 0,
.num_resources = ARRAY_SIZE(smc91x_resources),
.resource = smc91x_resources,
};
static struct platform_device *devices[] __initdata = {
&msm_device_uart3,
&msm_device_smd,
&msm_device_dmov,
&msm_device_nand,
&smc91x_device,
};
extern struct sys_timer msm_timer;
static void __init msm7x2x_init_irq(void)
{
msm_init_irq();
}
static void __init msm7x2x_init(void)
{
if (socinfo_init() < 0)
BUG();
if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
smc91x_resources[0].start = 0x98000300;
smc91x_resources[0].end = 0x980003ff;
smc91x_resources[1].start = MSM_GPIO_TO_INT(85);
smc91x_resources[1].end = MSM_GPIO_TO_INT(85);
if (gpio_tlmm_config(GPIO_CFG(85, 0,
GPIO_INPUT,
GPIO_PULL_DOWN,
GPIO_2MA),
GPIO_ENABLE)) {
printk(KERN_ERR
"%s: Err: Config GPIO-85 INT\n",
__func__);
}
}
platform_add_devices(devices, ARRAY_SIZE(devices));
}
static void __init msm7x2x_map_io(void)
{
msm_map_common_io();
/* Technically dependent on the SoC but using machine_is
* macros since socinfo is not available this early and there
* are plans to restructure the code which will eliminate the
* need for socinfo.
*/
if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa())
msm_clock_init(msm_clocks_7x27, msm_num_clocks_7x27);
if (machine_is_msm7x25_surf() || machine_is_msm7x25_ffa())
msm_clock_init(msm_clocks_7x25, msm_num_clocks_7x25);
#ifdef CONFIG_CACHE_L2X0
if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) {
/* 7x27 has 256KB L2 cache:
64Kb/Way and 4-Way Associativity;
R/W latency: 3 cycles;
evmon/parity/share disabled. */
l2x0_init(MSM_L2CC_BASE, 0x00068012, 0xfe000000);
}
#endif
}
static void __init msm7x2x_init_late(void)
{
smd_debugfs_init();
}
MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
.atag_offset = 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.init_late = msm7x2x_init_late,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
.atag_offset = 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.init_late = msm7x2x_init_late,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
.atag_offset = 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.init_late = msm7x2x_init_late,
.timer = &msm_timer,
MACHINE_END
MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA")
.atag_offset = 0x100,
.map_io = msm7x2x_map_io,
.init_irq = msm7x2x_init_irq,
.init_machine = msm7x2x_init,
.init_late = msm7x2x_init_late,
.timer = &msm_timer,
MACHINE_END
|
#ifndef _IDLE_H_INCLUDED
#define _IDLE_H_INCLUDED
#include <string>
namespace xchat {
using namespace std;
string genidle();
bool checkidle(string s);
}
#endif /* _IDLE_H_INCLUDED */
|
/*
* Xournal++
*
* Custom Poppler access library
*
* @author Xournal++ Team
* https://github.com/xournalpp/xournalpp
*
* @license GNU GPLv2 or later
*/
#pragma once
#include "model/LinkDestination.h"
#include <poppler/Link.h>
#include "XojPopplerDocument.h"
#include <StringUtils.h>
class XojPopplerAction
{
public:
XojPopplerAction(XojPopplerDocument doc, LinkAction* linkAction, string title);
virtual ~XojPopplerAction();
public:
XojLinkDest* getDestination();
string getTitle();
private:
void linkFromDest(LinkDestination* link, LinkDest* dest);
private:
XOJ_TYPE_ATTRIB;
XojPopplerDocument doc;
LinkAction* linkAction;
string title;
};
|
/* TA3D, a remake of Total Annihilation
Copyright (C) 2005 Roland BROCHARD
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*/
#ifndef __TA3D_INGAME_MENUS_UNIT_SELECTOR_H__
#define __TA3D_INGAME_MENUS_UNIT_SELECTOR_H__
#include "base.h"
#include <vector>
namespace TA3D
{
namespace Menus
{
/*!
** \brief
*/
class UnitSelector : public Abstract
{
public:
/*!
** \brief Execute an instance of UnitSelector
**
** \param preSelectedUnits The name of the file that contains selected units
** \param[out] useOnly Name of the useOnly file.
** It is guaranteed this var will be set to preSelectedMap if cancel button is clicked (returned value = false)
**
** \return True if selection has been validated by the user, false otherwise
*/
static bool Execute(const String& preSelectedUnits, String& useOnly);
public:
//! \name Constructor & Destructor
//@{
//! Default constructor
UnitSelector();
/*!
** \brief Constructor
** \param PreSelected map
*/
UnitSelector(const String& preSelectedUnits);
//! Destructor
virtual ~UnitSelector();
//@}
/*!
** \brief Get the useOnly file created if any
**
** This value is affected by the last call to execute(), and is empty by default
**
** \return Name of the useOnly file, empty if none has been selected
*/
const String& selected() const { return pUseOnly; }
protected:
virtual bool doInitialize();
virtual void doFinalize();
virtual void waitForEvent();
virtual bool maySwitchToAnotherMenu();
private:
void reloadUnitsForGUIControl();
bool doGoSelectSingleUnit(const int unitIndex);
void doUpdateUnitInfo();
void createUseOnlyFile();
private:
//! Name of the UseOnly file
String pUseOnly;
//! Default Name of the UseOnly file
String pDefaultUseOnly;
//! List of units
String::List pUnitList;
//! Reference to the unit picture object (Gui)
Gui::GUIOBJ::Ptr pUnitPicObj;
//! Last selected index
int pLastUnitIndex;
//! The list of units (Gui)
Gui::GUIOBJ::Ptr pUnitListObj;
}; // class MapSelector
} // namespace Menus
} // namespace TA3D
#endif // __TA3D_INGAME_MENUS_MAP_SELECTOR_H__
|
#ifndef RDESTL_FIXED_ARRAY_H
#define RDESTL_FIXED_ARRAY_H
#include "algorithm.h"
namespace rde
{
//=============================================================================
template<typename T, ::size_t N>
class fixed_array
{
typedef char ERR_N_MustBeBiggerThanZero[N > 0 ? 1 : -1];
public:
typedef T value_type;
typedef T* iterator;
typedef const T* const_iterator;
typedef ::size_t size_type;
fixed_array() {/**/}
fixed_array(const T array[N])
{
rde::copy_n(&array[0], N, m_data);
}
// copy ctor/dtor generated
// assignment op generated
iterator begin() { return &m_data[0]; }
const_iterator begin() const { return &m_data[0]; }
iterator end() { return begin() + N; }
const_iterator end() const { return begin() + N; }
size_type size() const { return N; }
T* data() { return &m_data[0]; }
const T* data() const { return &m_data[0]; }
const T& front() const { return *begin(); }
T& front() { return *begin(); }
const T& back() const { return *(end() - 1); }
T& back() { return *(end() - 1); }
RDE_FORCEINLINE T& operator[](size_type i)
{
RDE_ASSERT(i < size());
return m_data[i];
}
RDE_FORCEINLINE const T& operator[](size_type i) const
{
RDE_ASSERT(i < size());
return m_data[i];
}
private:
T m_data[N];
};
} // rde
//-----------------------------------------------------------------------------
#endif // #ifndef RDESTL_FIXED_ARRAY_H
|
typedef unsigned char des_user_key[8];
typedef unsigned char des_cblock[8];
typedef unsigned long des_ks[32];
void des_crypt( des_cblock in, des_cblock out, des_ks key, int encrypt );
void des_expand_key( des_user_key userKey, des_ks key );
|
/*
Copyright 2020-2020 by Gustavo Carneiro <gcarneiroa@hotmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef SESSIONDISPLAYCONNECTION_H
#define SESSIONDISPLAYCONNECTION_H
// Qt
#include <QPointer>
// Konsole
#include "konsolesession_export.h"
namespace Konsole
{
class Session;
class TerminalDisplay;
class KONSOLESESSION_EXPORT SessionDisplayConnection : public QObject
{
Q_OBJECT
public:
SessionDisplayConnection(Session *session, TerminalDisplay *view, QObject *parent = nullptr);
~SessionDisplayConnection() = default;
QPointer<Session> session();
QPointer<TerminalDisplay> view();
/**
* Returns true if the session and view is valid.
* A valid connection and view is one which has a non-null session() and view().
*
* Equivalent to "!session().isNull() && !view().isNull()"
*/
bool isValid() const;
private:
QPointer<Session> _session;
QPointer<TerminalDisplay> _view;
};
}
#endif
|
/* $Id: $ */
/*--------------------------------------------------------------------*/
/*; Copyright (C) 2014 */
/*; Associated Universities, Inc. Washington DC, USA. */
/*; */
/*; 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 Massachusetts Ave, Cambridge, */
/*; MA 02139, USA. */
/*; */
/*;Correspondence about this software should be addressed as follows: */
/*; Internet email: bcotton@nrao.edu. */
/*; Postal address: William Cotton */
/*; National Radio Astronomy Observatory */
/*; 520 Edgemont Road */
/*; Charlottesville, VA 22903-2475 USA */
/*--------------------------------------------------------------------*/
#ifndef OBITGPUSKYMODEL_H
#define OBITGPUSKYMODEL_H
#include "Obit.h"
#include "ObitErr.h"
#include "ObitUV.h"
#include "CUDAFInterpolate.h"
#include "ObitFArray.h"
#include "ObitGPUFArray.h"
#define STREAM_COUNT 4 /* Number of GPU Streams */
/*-------- Obit: Merx mollis mortibus nuper ------------------*/
/**
* \file ObitGPUFInterpolate.h
*
* ObitGPUFInterpolate GPU enhanced FArray interpolation class
* Uses functions in ObitCUDAFInterpolate
*
* 2D FArrays are interpolated using a GPU.
*
* \section ObitGPUFInterpolateaccess Creators and Destructors
* An ObitGPUFInterpolate will usually be created using ObitGPUFInterpolateCreate which allows
* specifying a name for the object as well as other information.
*
* A copy of a pointer to an ObitGPUFInterpolate should always be made using the
* #ObitGPUFInterpolateRef function which updates the reference count in the object.
* Then whenever freeing an ObitGPUFInterpolate or changing a pointer, the function
* #ObitGPUFInterpolateUnref will decrement the reference count and destroy the object
* when the reference count hits 0.
* There is no explicit destructor.
*/
/*--------------Class definitions-------------------------------------*/
/** ObitGPUFInterpolate Class structure. */
typedef struct {
#include "ObitGPUFInterpolateDef.h" /* this class definition */
} ObitGPUFInterpolate;
/*----------------- Macroes ---------------------------*/
/**
* Macro to unreference (and possibly destroy) an ObitGPUFInterpolate
* returns a ObitGPUFInterpolate*.
* in = object to unreference
*/
#define ObitGPUFInterpolateUnref(in) ObitUnref (in)
/**
* Macro to reference (update reference count) an ObitGPUFInterpolate.
* returns a ObitGPUFInterpolate*.
* in = object to reference
*/
#define ObitGPUFInterpolateRef(in) ObitRef (in)
/**
* Macro to determine if an object is the member of this or a
* derived class.
* Returns TRUE if a member, else FALSE
* in = object to reference
*/
#define ObitGPUFInterpolateIsA(in) ObitIsA (in, ObitGPUFInterpolateGetClass())
/*---------------------------------- Structures ----------------------------*/
/*---------------Public functions---------------------------*/
/** Public: Class initializer. */
void ObitGPUFInterpolateClassInit (void);
/** Public: Default Constructor. */
ObitGPUFInterpolate* newObitGPUFInterpolate (gchar* name);
/** Public: Create/initialize ObitGPUFInterpolate structures */
ObitGPUFInterpolate* ObitGPUFInterpolateCreate (gchar* name, ObitFArray *inArray,
ObitFArray *xArray, ObitFArray *yArray,
int hwidth, ObitErr *err);
/** Typedef for definition of class pointer structure */
typedef ObitGPUFInterpolate*
(*ObitGPUFInterpolateCreateFP) (gchar* name, ObitFArray *inArray,
ObitFArray *xArray, ObitFArray *yArray,
int hwidth, ObitErr *err);
/** Public: interpolate image (as FArray) */
void ObitGPUFInterpolateImage (ObitGPUFInterpolate *in, ObitFArray *inArray,
ObitFArray *outArray, ObitErr *err);
/** Typedef for definition of class pointer structure */
typedef void (*ObitGPUFInterpolateImageFP) (ObitGPUFInterpolate *in, ObitFArray *inArray,
ObitFArray *outArray, ObitErr *err);
/** Public: ClassInfo pointer */
gconstpointer ObitGPUFInterpolateGetClass (void);
/** Public: Copy (deep) constructor. */
ObitGPUFInterpolate* ObitGPUFInterpolateCopy (ObitGPUFInterpolate *in,
ObitGPUFInterpolate *out, ObitErr *err);
/** Public: Copy structure. */
void ObitGPUFInterpolateClone (ObitGPUFInterpolate *in,
ObitGPUFInterpolate *out, ObitErr *err);
/*----------- ClassInfo Structure -----------------------------------*/
/**
* ClassInfo Structure.
* Contains class name, a pointer to any parent class
* (NULL if none) and function pointers.
*/
typedef struct {
#include "ObitGPUFInterpolateClassDef.h"
} ObitGPUFInterpolateClassInfo;
#endif /* OBITFGPUSKYMODEL_H */
|
/**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2017 UniPro <ugene@unipro.ru>
* http://ugene.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef GTWEBENGINEVIEW_H
#define GTWEBENGINEVIEW_H
#include <QEventLoop>
#include <QWebEngineView>
#include "GTGlobals.h"
#include "GTWebView.h"
namespace HI {
class SynchronizedCall : public QObject {
Q_OBJECT
public:
static void run(QWebEngineView* view, const QString& scriptSource, const std::function<void(QVariant)>& resultCallback);
signals:
void callbackFinished();
private:
QEventLoop eventLoop;
};
class HI_EXPORT GTWebEngineView {
public:
static QList<HIWebElement> findElementsBySelector(GUITestOpStatus& os, QWebEngineView* view, const QString& selector, const GTGlobals::FindOptions& options = {});
private:
static HIWebElement toHiWebElement(const QMap<QString, QVariant>& map);
static const QString X;
static const QString Y;
static const QString WIDTH;
static const QString HEIGHT;
static const QString TEXT;
static const QString XML;
static const QString TAG;
static const QString ID;
static const QString ATTRIBUTES_MAP;
static const QString VISIBLE;
};
typedef class GTWebEngineView GTWebViewPrivate;
} // namespace HI
#endif // GTWEBENGINEVIEW_H
|
/*=========================================================================
Program: OsiriX
Copyright (c) OsiriX Team
All rights reserved.
Distributed under GNU - LGPL
See http://www.osirix-viewer.com/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
=========================================================================*/
#import <Cocoa/Cocoa.h>
#import "DCMObject.h"
/** DCMObject category for dealing with Presentation States */
@interface DCMObject (DCMPresentationState)
- (BOOL)isPresentationState;
//- (NSArray *)referencedImageSequenceForObject:(DCMObject *)object;
- (NSArray *)graphicObjectSequence;
- (NSArray *)displayedAreaSelectionSequence;
- (NSArray *)graphicLayerSequence;
- (NSArray *)softcopyVOILUTSequence;
- (int)imageRotation;
- (BOOL)horizontalFlip;
// anchor Point
- (NSPoint)anchorPointForGraphicsObject:(DCMObject *)object;
- (BOOL)anchorPointVisibiltyForGraphicsObject:(DCMObject *)object;
- (BOOL)anchorPointAnnotationUnitsIsPixelForGraphicsObject:(DCMObject *)object;
//BoundingBox
- (NSPoint)boundingBoxTopLeftHandCornerForObject:(DCMObject *)object;
- (NSPoint)boundingBoxBottomRightHandCornerForObject:(DCMObject *)object;
/**Justification Values
* LEFT
* RIGHT
* CENTER
*/
- (NSString *)boundingBoxTextHorizontalJustificationForObject:(DCMObject *)object;
//** graphic annotation sequence info */
- (NSArray *)graphicAnnotationSequence;
- (NSArray *)textObjectSequenceForObject:(DCMObject *)object;
- (NSArray *)graphicObjectSequenceForObject:(DCMObject *)object;
- (NSString *)unformattedTextValueForObject:(DCMObject *)object;
- (int)numberOfGraphicPointsForGraphicsObject:(DCMObject *)object;
- (NSArray *)graphicDataForGraphicsObject:(DCMObject *)object;
//graphic layer module attributes
// do nothing for now.
/** DICOM graphic types
* POINT
* POLYLINE
* INTERPOLATED
* CIRCLE
* ELLIPSE
*/
- (NSString *)graphicTypeForGraphicsObject:(DCMObject *)object;
- (BOOL)graphicFilledForGraphicsObject:(DCMObject *)object;
//MODALITY LUT MODULE ATTRIBUTES
/*
rescaleSlope
rescaleintercpet
LUT Data
Modality LUT Type
*/
//VOI LUT module
/*
LUT Descriptor
LUTData
windowCenter
windowWidth
*/
@end |
/*
* CIPlugInInterface.h
*
*
* Copyright (c) 2004 Apple Computer. All rights reserved.
*
*/
/*!
@header CIPlugInInterface
@abstract Definition of the plug-in registration protocol
@discussion The principal class of a CIPlugIn must support the CIPlugInRegistration protocol
*/
/*!
@protocol CIPlugInRegistration
@abstract This protocol defines the calls made by the host to the CIPlugIn when initializing it
@discussion The principal class of a CIPlugIn must support the CIPlugInRegistration protocol
*/
@protocol CIPlugInRegistration
/*!
@method load
@abstract the plugin gets a chance to do custom initialization (like registration check ) here
@discussion Load gets called once by the host when the first filter from the plug-in gets instantiated. Return of true means that the plugIn successfully initialized
@param host for future use only
*/
-(BOOL)load:(void*)host;
@end
|
/**
* Copyright (c) 2012 Sukanto Ghosh.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* @file generic_timer.h
* @author Sukanto Ghosh (sukantoghosh@gmail.com)
* @brief API for ARM architecture generic timers
*/
#ifndef __GENERIC_TIMER_H__
#define __GENERIC_TIMER_H__
#define GENERIC_TIMER_HCTL_KERN_PCNT_EN (1 << 0)
#define GENERIC_TIMER_HCTL_KERN_PTMR_EN (1 << 1)
#define GENERIC_TIMER_CTRL_ENABLE (1 << 0)
#define GENERIC_TIMER_CTRL_IT_MASK (1 << 1)
#define GENERIC_TIMER_CTRL_IT_STAT (1 << 2)
#define GENERIC_TIMER_CONTEXT_phys_timer_irq 0x0
#define GENERIC_TIMER_CONTEXT_virt_timer_irq 0x4
#define GENERIC_TIMER_CONTEXT_cntvoff 0x8
#define GENERIC_TIMER_CONTEXT_cntpcval 0x10
#define GENERIC_TIMER_CONTEXT_cntvcval 0x18
#define GENERIC_TIMER_CONTEXT_cntkctl 0x20
#define GENERIC_TIMER_CONTEXT_cntpctl 0x24
#define GENERIC_TIMER_CONTEXT_cntvctl 0x28
#ifndef __ASSEMBLY__
#include <vmm_types.h>
#include <vmm_compiler.h>
#include <vmm_timer.h>
enum {
GENERIC_TIMER_REG_FREQ,
GENERIC_TIMER_REG_HCTL,
GENERIC_TIMER_REG_KCTL,
GENERIC_TIMER_REG_HYP_CTRL,
GENERIC_TIMER_REG_HYP_TVAL,
GENERIC_TIMER_REG_HYP_CVAL,
GENERIC_TIMER_REG_PHYS_CTRL,
GENERIC_TIMER_REG_PHYS_TVAL,
GENERIC_TIMER_REG_PHYS_CVAL,
GENERIC_TIMER_REG_VIRT_CTRL,
GENERIC_TIMER_REG_VIRT_TVAL,
GENERIC_TIMER_REG_VIRT_CVAL,
GENERIC_TIMER_REG_VIRT_OFF,
};
struct generic_timer_context {
struct {
u32 phys_timer_irq;
u32 virt_timer_irq;
u64 cntvoff;
u64 cntpcval;
u64 cntvcval;
u32 cntkctl;
u32 cntpctl;
u32 cntvctl;
} __packed;
struct vmm_timer_event virt_ev;
struct vmm_timer_event phys_ev;
};
int generic_timer_vcpu_context_init(void *vcpu_ptr,
void **context,
u32 phys_irq, u32 virt_irq);
int generic_timer_vcpu_context_deinit(void *vcpu_ptr, void **context);
void generic_timer_vcpu_context_save(void *vcpu_ptr, void *context);
void generic_timer_vcpu_context_restore(void *vcpu_ptr, void *context);
void generic_timer_vcpu_context_post_restore(void *vcpu_ptr, void *context);
#endif /* __ASSEMBLY__ */
#endif /* __GENERIC_TIMER_H__ */
|
/*
* valarray - Storage for plain variable values
*
* Copyright (C) 2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Enrico Zini <enrico@enricozini.com>
*/
#ifndef B2NC_VALARRAY_H
#define B2NC_VALARRAY_H
#include "namer.h"
#include <wreport/varinfo.h>
#include <string>
#include <vector>
#include <cstdio>
namespace wreport {
struct Var;
}
namespace b2nc {
struct NCOutfile;
struct ValArray;
struct LoopInfo
{
/**
* Pointer to variable holding the delayed replication count for this
* section's loop, if any
*/
ValArray* var;
/**
* Index of the loop, used to name Loop_NNN_maxlen attributes
*/
unsigned index;
/// NetCDF dimension ID of the loop dimension
int nc_dimid;
LoopInfo()
: var(0), index(0), nc_dimid(-1) {}
void define(NCOutfile& outfile, size_t size);
};
struct ValArray
{
std::string name;
std::string mnemo;
wreport::Varinfo info;
unsigned rcnt;
int nc_varid;
std::vector< std::pair<wreport::Varcode, const ValArray*> > references;
Namer::DataType type;
ValArray* master;
std::vector<ValArray*> slaves;
// True if the value of the variable never changes
bool is_constant;
ValArray(wreport::Varinfo info);
virtual ~ValArray() {}
virtual void add(const wreport::Var& var, unsigned bufr_idx) = 0;
/// Returns the variable for the given BUFR and repetition instance
virtual wreport::Var get_var(unsigned bufr_idx, unsigned rep=0) const = 0;
/// Returns the array size (number of BUFR messages seen)
virtual size_t get_size() const = 0;
/// Returns the maximum number of repetition instances found
virtual size_t get_max_rep() const = 0;
/// Returns true if the array contains some defined values, false if it's
/// all undefined values
virtual bool has_values() const = 0;
virtual bool define(NCOutfile& outfile) = 0;
virtual void putvar(NCOutfile& outfile) const = 0;
virtual void dump(FILE* out) = 0;
static ValArray* make_singlevalarray(Namer::DataType type, wreport::Varinfo info);
static ValArray* make_multivalarray(Namer::DataType type, wreport::Varinfo info, LoopInfo& loopinfo);
};
}
#endif
|
/*
* File: yearBook.h
* Author: yvan
*
* Created on May 12, 2014, 7:47 PM
*/
#ifndef YEARBOOK_H
#define YEARBOOK_H
#include <admintools.h>
#include <Wt/WBootstrapTheme>
#include <Wt/WTable>
#include <Wt/WDate>
#include <Wt/WStackedWidget>
#include <vector>
#include "step.h"
#include "data.h"
using namespace y;
enum action {
A_PREVIOUS,
A_NEXT,
A_LOGOUT,
A_SAVE,
};
class yearBook : public Wt::WApplication {
public:
yearBook(const Wt::WEnvironment & env);
//void loginButtonClicked();
//void setAction(action message);
/*bool loggedIn;
//y::ldap::account account;
//data
//dataconnect store;
Wt::WString name;
Wt::WString surname;
Wt::WString group;
Wt::WDate date;
Wt::WString mail;
Wt::WString answer1;
Wt::WString answer2;
Wt::WString answer3;
Wt::WString answer4;
*/
private:
/*
* Wt::WBootstrapTheme * theme;
// auth
Wt::WDialog * loginDialog;
Wt::WContainerWidget * loginContainer;
Wt::WHBoxLayout * nameBox;
Wt::WLineEdit * nameEdit;
Wt::WLineEdit * passEdit;
Wt::WPushButton * sendButton;
Wt::WText * loginFeedback;
// content
std::vector<std::unique_ptr<step>> steps;
Wt::WStackedWidget * stack;
int currentStep;
*/
};
#endif /* YEARBOOK_H */
|
#include <stdio.h>
int main(int argc, const char *argv[])
{
int a, b, c, i;
double sum=0;
scanf("%d %d %d", &a, &b, &c);
for (i = 1; i <= a; i++) {
sum += i;
}
for (i = 1; i <= b; i++) {
sum += i*i;
}
for (i = 1; i <= c; i++) {
sum += 1.0 / i;
}
printf("%.2lf\n", sum);
return 0;
}
|
/*
* linux/arch/arm/mach-aspeed/core.h
*
* Copyright (C) ASPEED Tech. Corp.
* 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 __ASM_ARCH_ASPEED_CORE_H
#define __ASM_ARCH_ASPEED_CORE_H
extern struct sys_timer ast_timer;
extern void __init ast_init_irq(void);
#endif
|
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_adpcm_chan_inst.h
Copyright (c) 2001-2010 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_adpcm_chan.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_adpcm_chan_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.04.01 $
$Octasic_Revision: 6 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_ADPCM_CHAN_INST_H__
#define __OCT6100_ADPCM_CHAN_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_ADPCM_CHAN_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
/* TSI chariot memory entry. */
UINT16 usTsiMemIndex;
/* ADPCM memory entry. */
UINT16 usAdpcmMemIndex;
/* Input and output timeslot information. */
UINT16 usInputTimeslot;
UINT16 usInputStream;
UINT8 byInputNumTssts;
UINT8 byInputPcmLaw;
UINT16 usOutputTimeslot;
UINT16 usOutputStream;
UINT8 byOutputNumTssts;
UINT8 byOutputPcmLaw;
/* Internal info for quick access to structures associated to this TSI cnct. */
UINT16 usInputTsstIndex;
UINT16 usOutputTsstIndex;
} tOCT6100_API_ADPCM_CHAN, *tPOCT6100_API_ADPCM_CHAN;
#endif /* __OCT6100_ADPCM_CHAN_INST_H__ */
|
/******************************************************************************
°æÈ¨ËùÓÐ (C), 2001-2011, »ªÎª¼¼ÊõÓÐÏÞ¹«Ë¾
******************************************************************************
ÎÄ ¼þ Ãû : TafStdlib.h
°æ ±¾ ºÅ : ³õ¸å
Éú³ÉÈÕÆÚ : 2013Äê5ÔÂ25ÈÕ
×î½üÐÞ¸Ä :
¹¦ÄÜÃèÊö : TafStdlib.cµÄÍ·Îļþ
º¯ÊýÁбí :
ÐÞ¸ÄÀúÊ· :
1.ÈÕ ÆÚ : 2013Äê5ÔÂ25ÈÕ
ÐÞ¸ÄÄÚÈÝ : ´´½¨Îļþ
******************************************************************************/
#ifndef _TAF_STD_LIB_H_
#define _TAF_STD_LIB_H_
/*****************************************************************************
1 ÆäËûÍ·Îļþ°üº¬
*****************************************************************************/
#include "PsTypeDef.h"
#include "MnMsgApi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#pragma pack(4)
/*****************************************************************************
2 ºê¶¨Òå
*****************************************************************************/
#define TAF_STD_7BIT_MASK (0x7f)
#define TAF_STD_MAX_GSM7BITDEFALPHA_NUM (128)
#define TAF_STD_NOSTANDARD_ASCII_CODE (0xff)
#define TAF_STD_GSM_7BIT_EXTENSION_FLAG (0xfe)
/*****************************************************************************
3 ö¾Ù¶¨Òå
*****************************************************************************/
/*****************************************************************************
4 È«¾Ö±äÁ¿ÉùÃ÷
*****************************************************************************/
/*****************************************************************************
5 ÏûϢͷ¶¨Òå
*****************************************************************************/
/*****************************************************************************
6 ÏûÏ¢¶¨Òå
*****************************************************************************/
/*****************************************************************************
7 STRUCT¶¨Òå
*****************************************************************************/
/*****************************************************************************
8 UNION¶¨Òå
*****************************************************************************/
/*****************************************************************************
9 OTHERS¶¨Òå
*****************************************************************************/
/*****************************************************************************
10 º¯ÊýÉùÃ÷
*****************************************************************************/
VOS_UINT32 TAF_STD_Itoa(
VOS_UINT32 ulDigit,
VOS_CHAR *pcDigitStr,
VOS_UINT32 *pulDigitStrLength
);
VOS_UINT32 TAF_STD_AsciiNum2HexString(
VOS_UINT8 *pucSrc,
VOS_UINT16 *pusSrcLen
);
VOS_UINT16 TAF_STD_HexAlpha2AsciiString(
VOS_UINT8 *pucSrc,
VOS_UINT16 usSrcLen,
VOS_UINT8 *pucDst
);
/*½«7bit±àÂ뷽ʽµÄ×Ö·ûת»»Îª8bit×Ö·û*/
VOS_UINT32 TAF_STD_UnPack7Bit(
const VOS_UINT8 *pucOrgChar,
VOS_UINT32 ulLen,
VOS_UINT8 ucFillBit,
VOS_UINT8 *pucUnPackedChar
);
/*½«×Ö·ûת»»Îª7bit±àÂ뷽ʽ*/
VOS_UINT32 TAF_STD_Pack7Bit(
const VOS_UINT8 *pucOrgChar,
VOS_UINT32 ulLen,
VOS_UINT8 ucFillBit,
VOS_UINT8 *pucPackedChar,
VOS_UINT32 *pulLen
);
VOS_UINT32 TAF_STD_ConvertBcdNumberToAscii(
const VOS_UINT8 *pucBcdNumber,
VOS_UINT8 ucBcdLen,
VOS_CHAR *pcAsciiNumber
);
VOS_UINT32 TAF_STD_ConvertBcdCodeToAscii(
VOS_UINT8 ucBcdCode,
VOS_CHAR *pcAsciiCode
);
VOS_UINT32 TAF_STD_ConvertAsciiNumberToBcd(
const VOS_CHAR *pcAsciiNumber,
VOS_UINT8 *pucBcdNumber,
VOS_UINT8 *pucBcdLen
);
VOS_UINT32 TAF_STD_ConvertAsciiAddrToBcd(
MN_MSG_ASCII_ADDR_STRU *pstAsciiAddr,
MN_MSG_BCD_ADDR_STRU *pstBcdAddr
);
VOS_UINT32 TAF_STD_ConvertAsciiCodeToBcd(
VOS_CHAR cAsciiCode,
VOS_UINT8 *pucBcdCode
);
VOS_UINT8 TAF_STD_ConvertDeciDigitToBcd(
VOS_UINT8 ucDeciDigit,
VOS_BOOL bReverseOrder
);
VOS_UINT32 TAF_STD_ConvertBcdToDeciDigit(
VOS_UINT8 ucBcdDigit,
VOS_BOOL bReverseOrder,
VOS_UINT8 *pucDigit
);
VOS_UINT32 TAF_STD_ConvertAsciiToDefAlpha(
const VOS_UINT8 *pucAsciiChar,
VOS_UINT32 ulLen,
VOS_UINT8 *pucDefAlpha
);
VOS_UINT32 TAF_STD_ConvertDefAlphaToAscii(
const VOS_UINT8 *pucDefAlpha,
VOS_UINT32 ulDefAlphaLen,
VOS_UINT8 *pucAsciiChar,
VOS_UINT32 *pulAsciiCharLen
);
#if (VOS_OS_VER == VOS_WIN32)
#pragma pack()
#else
#pragma pack(0)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* end of TafSpmCtx.h */
|
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id: lib505.c,v 1.11 2006-10-25 05:59:47 yangtse Exp $
*/
#include "setup.h" /* struct_stat etc. */
#include "test.h"
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*
* This example shows an FTP upload, with a rename of the file just after
* a successful upload.
*
* Example based on source code provided by Erick Nuwendam. Thanks!
*/
int test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
FILE *hd_src ;
int hd ;
struct_stat file_info;
struct curl_slist *hl;
struct curl_slist *headerlist=NULL;
const char *buf_1 = "RNFR 505";
const char *buf_2 = "RNTO 505-forreal";
if (!arg2) {
fprintf(stderr, "Usage: <url> <file-to-upload>\n");
return -1;
}
/* get the file size of the local file */
hd = stat(arg2, &file_info);
if(hd == -1) {
/* can't open file, bail out */
fprintf(stderr, "WARNING: cannot open file %s\n", arg2);
return -1;
}
if(! file_info.st_size) {
fprintf(stderr, "WARNING: file %s has no size!\n", arg2);
return -4;
}
/* get a FILE * of the same file, could also be made with
fdopen() from the previous descriptor, but hey this is just
an example! */
hd_src = fopen(arg2, "rb");
if(NULL == hd_src) {
return -2; /* if this happens things are major weird */
}
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
}
/* get a curl handle */
if ((curl = curl_easy_init()) == NULL) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup();
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
}
/* build a list of commands to pass to libcurl */
if ((hl = curl_slist_append(headerlist, buf_1)) == NULL) {
fprintf(stderr, "curl_slist_append() failed\n");
curl_easy_cleanup(curl);
curl_global_cleanup();
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
}
if ((headerlist = curl_slist_append(hl, buf_2)) == NULL) {
fprintf(stderr, "curl_slist_append() failed\n");
curl_slist_free_all(hl);
curl_easy_cleanup(curl);
curl_global_cleanup();
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
}
headerlist = hl;
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;
/* enable verbose */
curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE) ;
/* specify target */
curl_easy_setopt(curl,CURLOPT_URL, URL);
/* pass in that last of FTP commands to run after the transfer */
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
/* now specify which file to upload */
curl_easy_setopt(curl, CURLOPT_INFILE, hd_src);
/* and give the size of the upload (optional) */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)file_info.st_size);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* clean up the FTP commands list */
curl_slist_free_all(headerlist);
/* close the local file */
fclose(hd_src);
curl_easy_cleanup(curl);
curl_global_cleanup();
return res;
}
|
#ifndef HTTPCOMMANDENTITY_H
#define HTTPCOMMANDENTITY_H
#include <QObject>
#include <QMap>
#include <commandentity.h>
#include <settings/nextcloudsettingsbase.h>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
class HttpCommandEntity : public CommandEntity
{
Q_OBJECT
public:
explicit HttpCommandEntity(QObject *parent = Q_NULLPTR,
QString path = QStringLiteral(""),
QMap<QByteArray, QByteArray> headers = QMap<QByteArray, QByteArray>(),
AccountBase* settings = Q_NULLPTR);
~HttpCommandEntity();
bool startWork();
bool abortWork();
protected:
QUrl m_requestUrl;
QNetworkReply* m_reply = Q_NULLPTR;
QNetworkRequest m_request;
QNetworkAccessManager m_accessManager;
AccountBase* m_settings = Q_NULLPTR;
private:
QUrl setupRequestUrl();
QString m_path;
QMap<QByteArray, QByteArray> m_headers;
signals:
void sslErrorOccured(QString md5Digest, QString sha1Digest);
};
#endif // HTTPCOMMANDENTITY_H
|
#ifndef __HEADERS_INCLUDED__
#define __HEADERS_INCLUDED__
#include <stdio.h>
#include <stdlib.h>
#ifndef GBA
#include <memory.h>
#endif
#include <string.h>
#endif
|
/*
* SpanDSP - a series of DSP components for telephony
*
* schedule.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#include <memory.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/schedule.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/schedule.h"
SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data)
{
int i;
for (i = 0; i < s->max_to_date; i++)
{
if (s->sched[i].callback == NULL)
break;
/*endif*/
}
/*endfor*/
if (i >= s->allocated)
{
s->allocated += 5;
s->sched = (span_sched_t *) span_realloc(s->sched, sizeof(span_sched_t)*s->allocated);
}
/*endif*/
if (i >= s->max_to_date)
s->max_to_date = i + 1;
/*endif*/
s->sched[i].when = s->ticker + us;
s->sched[i].callback = function;
s->sched[i].user_data = user_data;
return i;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint64_t) span_schedule_next(span_sched_state_t *s)
{
int i;
uint64_t earliest;
earliest = ~((uint64_t) 0);
for (i = 0; i < s->max_to_date; i++)
{
if (s->sched[i].callback && earliest > s->sched[i].when)
earliest = s->sched[i].when;
/*endif*/
}
/*endfor*/
return earliest;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint64_t) span_schedule_time(span_sched_state_t *s)
{
return s->ticker;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) span_schedule_update(span_sched_state_t *s, int us)
{
int i;
span_sched_callback_func_t callback;
void *user_data;
s->ticker += us;
for (i = 0; i < s->max_to_date; i++)
{
if (s->sched[i].callback && s->sched[i].when <= s->ticker)
{
callback = s->sched[i].callback;
user_data = s->sched[i].user_data;
s->sched[i].callback = NULL;
s->sched[i].user_data = NULL;
callback(s, user_data);
}
/*endif*/
}
/*endfor*/
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) span_schedule_del(span_sched_state_t *s, int i)
{
if (i >= s->max_to_date
||
i < 0
||
s->sched[i].callback == NULL)
{
span_log(&s->logging, SPAN_LOG_WARNING, "Requested to delete invalid scheduled ID %d ?\n", i);
return;
}
/*endif*/
s->sched[i].callback = NULL;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(span_sched_state_t *) span_schedule_init(span_sched_state_t *s)
{
memset(s, 0, sizeof(*s));
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "SCHEDULE");
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s)
{
if (s->sched)
{
span_free(s->sched);
s->sched = NULL;
}
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s)
{
span_schedule_release(s);
if (s)
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
|
/* Copyright (c) 1999-2005, Broadcom Corporation
*
* 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.
*/
#ifndef BOARDMAP_H
#define BOARDMAP_H
/*****************************************************************************/
/* Include common chip definitions */
/*****************************************************************************/
#include "bcmmips.h"
#include "bchp_common.h"
/*****************************************************************************/
/* MIPS Physical Memory Map */
/*****************************************************************************/
#define CPU_PHYS_SDRAM_BASE 0x00000000 /* SDRAM Base */
#define CPU_PHYS_ROM_BASE 0x1FC00000 /* ROM */
#define CPU_PHYS_FLASH_BASE 0x1C000000
#define CPU_PHYS_FPGA_BASE 0x1A000000
#define CPU_PHYS_1394_BASE 0x19000000
#define CPU_PHYS_POD_BASE 0x19800000
#define BRCM_FLASH_SIZE 0x00400000
/*****************************************************************************/
/* CPU to PCI Bridge Memory Map */
/*****************************************************************************/
#define CPU2PCI_CPU_PHYS_MEM_WIN_BASE 0xd0000000
/* Allow CPU to access PCI memory addresses 0xd0000000 to 0xdfffffff */
#define CPU2PCI_PCI_PHYS_MEM_WIN0_BASE 0xd0000000 /* Not used in A0 */
#define CPU2PCI_PCI_PHYS_MEM_WIN1_BASE 0xd8000000 /* Not used in A0 */
#define CPU2PCI_PCI_PHYS_MEM_WIN2_BASE 0xe0000000
#define CPU2PCI_PCI_PHYS_MEM_WIN3_BASE 0xe8000000
/* Allow CPU to access PCI I/O addresses 0xe0000000 to 0xe05fffff */
#ifdef LITTLE_ENDIAN
#define CPU2PCI_PCI_PHYS_IO_WIN0_BASE 0x00000000
#define CPU2PCI_PCI_PHYS_IO_WIN1_BASE 0x00200000
#define CPU2PCI_PCI_PHYS_IO_WIN2_BASE 0x00400000
#else
#define CPU2PCI_PCI_PHYS_IO_WIN0_BASE 0x00000002
#define CPU2PCI_PCI_PHYS_IO_WIN1_BASE 0x00200002
#define CPU2PCI_PCI_PHYS_IO_WIN2_BASE 0x00400002
#endif
/*****************************************************************************/
/* PCI Physical Memory Map */
/*****************************************************************************/
/* PCI physical memory map */
#define PCI_7401_PHYS_ISB_WIN_BASE 0x10000000
#define PCI_7401_PHYS_MEM_WIN0_BASE 0x00000000
#define PCI_7401_PHYS_MEM_WIN1_BASE 0x02000000
#define PCI_7401_PHYS_MEM_WIN2_BASE 0x04000000
#define PCI_1394_PHYS_MEM_WIN0_BASE 0xd0000000
#define PCI_DEVICE_ID_EXT 0x0d
#define PCI_DEVICE_ID_1394 0x0e
#define PCI_DEVICE_ID_MINI 0x04
#define PCI_DEVICE_ID_SATA 0 /* On 2ndary PCI bus */
#define PCI_IDSEL_EXT (0x10000 << PCI_DEVICE_ID_EXT)
#define PCI_IDSEL_1394 (0x10000 << PCI_DEVICE_ID_1394)
#define PCI_IDSEL_MINI (0x10000 << PCI_DEVICE_ID_MINI)
#define PCI_IDSEL_SATA (0x10000 << PCI_DEVICE_ID_SATA)
#define PCI_DEV_NUM_EXT (PCI_DEVICE_ID_EXT << 11)
#define PCI_DEV_NUM_1394 (PCI_DEVICE_ID_1394 << 11)
#define PCI_DEV_NUM_MINI (PCI_DEVICE_ID_MINI << 11)
#define PCI_DEV_NUM_SATA (PCI_DEVICE_ID_SATA << 11)
/* SATA device */
#define PCS0_OFS 0x200
#define PCS1_OFS 0x240
#define SCS0_OFS 0x280
#define SCS1_OFS 0x2c0
#define BM_OFS 0x300
#define DRAM_SIZE (256*1024*1024)
/*****************************************************************************/
/* MIPS Virtual Memory Map */
/* */
/* Note that the addresses above are physical addresses and that programs */
/* have to use converted addresses defined below: */
/*****************************************************************************/
#define DRAM_BASE_CACHE BCM_PHYS_TO_K0(CPU_PHYS_SDRAM_BASE) /* cached DRAM */
#define DRAM_BASE_NOCACHE BCM_PHYS_TO_K1(CPU_PHYS_SDRAM_BASE) /* uncached DRAM */
#define ROM_BASE_CACHE BCM_PHYS_TO_K0(CPU_PHYS_ROM_BASE)
#define ROM_BASE_NOCACHE BCM_PHYS_TO_K1(CPU_PHYS_ROM_BASE)
#define FLASH_BASE_NOCACHE BCM_PHYS_TO_K1(CPU_PHYS_FLASH_BASE)
#define FPGA_BASE_NOCACHE BCM_PHYS_TO_K1(CPU_PHYS_FPGA_BASE)
#define IEEE1394_BASE_NOCACHE BCM_PHYS_TO_K1(CPU_PHYS_1394_BASE)
#define PCI_MEM_WIN_BASE 0xd0000000
#define PCI_MEM_WIN_SIZE 0x10000000
#define PCI_IO_WIN_BASE 0xf0000000
#define PCI_IO_WIN_SIZE 0x00600000
/*****************************************************************************/
/* Include chip specific .h files */
/*****************************************************************************/
#endif
|
#pragma once
#include <sweet/UI.h>
#include <PD_PhraseGenerator_Insults.h>
#include <OpenALSound.h>
#include <NumberUtils.h>
#include <shader/ComponentShaderText.h>
#include "Player.h"
#include "PD_Character.h"
class Shader;
class PD_InsultButton;
class Keyboard;
class Sprite;
class ComponentShaderText;
struct DissBattleValues{
// Stats multipliers
float playerAttackMultiplier[4]; // enemy defense, player strength
float enemyAttackMultiplier[4]; // player defense, enemy strength
float insightMultiplier[4]; // player insight - enemy insight
float insightAlpha[4];
float sassInsultMultiplier[4]; // player sass - enemy sass
float sassInterjectMultiplier[4]; // player sass - enemy sass
// combo increments
float playerComboIncrement;
float enemyComboIncrement;
DissBattleValues();
};
class InterjectAccuracy {
public:
wchar_t character;
float padding;
float targetTime;
float hitTime;
unsigned long int iteration;
InterjectAccuracy(wchar_t character, float _padding, float _targetTime, float _hitTime, unsigned long int _iteration);
};
/**
* Events:
* interject: data "success" int
* miss // missed punctuation opportunity
* insult: data "success" int
* changeturn data "isPlayerTurn" int
* confidence data "value" float // the value the confidence is being incremented by
* gameover data "win" int // occurs immediately when the player wins or loses
* complete: data "win" int // occurs after the game over animation
*/
class PD_UI_DissBattle : public VerticalLinearLayout{
private:
// number of punctuation marks passed
unsigned long int iteration;
PD_PhraseGenerator_Insults insultGenerator;
bool enabled;
bool canInterject;
NodeUI * displayContainer;
HorizontalLinearLayout * tutorialSpacebar;
NodeUI * tutorialSpacebarImage;
VerticalLinearLayout * healthContainer;
NodeUI * gameContainer;
HorizontalLinearLayout * livesContainer;
// lives in the current fight
std::vector<NodeUI *> lives;
// lost lives in the current fight
std::vector<NodeUI *> lostLives;
// duplicates of lifeTokens, modified to have a red cross through them to show lost lives
std::vector<Texture *> lifeTokensCrossed;
SliderControlled * confidenceSlider;
float basePlayerInsultSpeedMultiplier;
float playerInsultSpeedMultiplier;
float basePlayerQuestionTimerLength;
float playerQuestionTimerLength;
float playerQuestionTimer;
float basePlayerAnswerTimerLength;
float playerAnswerTimerLength;
float playerAnswerTimer;
bool playerResult;
bool playerResultEffective;
float playerResultTimerLength;
float playerResultTimer;
Sprite * enemyCursor;
UIGlyph * prevHighlightedPunctuation;
UIGlyph * highlightedPunctuation;
Sprite * punctuationHighlight;
UIGlyph * highlightedWordStart;
UIGlyph * highlightedWordEnd;
Sprite * wordHighlight;
NodeUI * enemyBubble;
TextArea * enemyBubbleText;
NodeUI * playerBubble;
HorizontalLinearLayout * playerBubbleLayout;
TextArea * playerBubbleText;
HorizontalLinearLayout * playerBubbleOptions;
PD_InsultButton * pBubbleBtn1;
PD_InsultButton * pBubbleBtn2;
SliderControlled * playerTimerSlider;
Sprite * complimentBubble;
float complimentBubbleTimerBaseLength;
float complimentBubbleTimerLength;
float complimentBubbleTimer;
float complimentBubbleScale;
Sprite * interjectBubble;
bool interjected; // interjected successfully
float interjectBubbleTimerBaseLength;
float interjectBubbleTimerLength;
float interjectBubbleTimer;
float interjectBubbleScale;
Shader * shader;
ComponentShaderText * optionOneShader;
ComponentShaderText * optionTwoShader;
float baseCursorDelayLength;
float baseCursorPunctDelayLength;
float cursorDelayLength;
float cursorDelayDuration;
float baseGlyphWidth;
std::vector<UIGlyph *> glyphs;
unsigned int glyphIdx;
float confidence;
bool isGameOver;
LinearLayout * gameOverContainer;
NodeUI * gameOverImage;
float gameOverLength;
float gameOverDuration;
bool win;
bool isComplete;
// USER TESTING VARIABLES
// Button Presses Success Rate
int offensiveCorrect;
int offensiveWrong;
int defensiveCorrect;
int defensiveWrong;
// Button Presses Speed
std::vector<float> insultTimes;
int punctuationCnt;
std::vector<InterjectAccuracy> interjectTimes;
float interjectTimer;
//Sounds
std::vector<OpenAL_Sound *> missInterjectSounds;
Player * player;
std::vector<OpenAL_Sound *> succeedInsultSounds;
// Stats multipliers
float playerAttackMultiplier; // enemy defense, player strength
float enemyAttackMultiplier; // player defense, enemy strength
float insightMultiplier; // player insight - enemy insight
float insightAlpha;
float sassInsultMultiplier; // player sass - enemy sass
float sassInterjectMultiplier; // player sass - enemy sass
float playerComboIncrement;
float enemyComboIncrement;
void setupDissValues();
public:
float prevXP;
float wonXP;
// the life tokens accumulated so far
// this size of the list also indicates how many lives the player gets at the start of a fight
std::vector<Texture *> lifeTokens;
TextArea * selectedGlyphText;
float damage;
float playerComboMultiplier;
float enemyComboMultiplier;
Keyboard * keyboard;
PD_Character * enemy;
bool modeOffensive;
PD_UI_DissBattle(BulletWorld * _bulletWorld, Player * _player, Font * _font, Shader * _textShader, Shader * _shader);
~PD_UI_DissBattle();
void setEnemyText();
void setPlayerText();
virtual void update(Step * _step) override;
void setUIMode(bool _isOffensive);
void interject();
void insult(bool _isEffective, std::wstring _word);
void incrementConfidence(float _value);
void startNewFight(PD_Character * _enemy, bool _playerFirst = true);
void gameOver(bool _win);
void complete();
void addLife(Texture * _tokenTexture);
void disable();
void enable();
bool isEnabled();
UIGlyph * findFirstPunctuation(int startIdx = 0);
void highlightNextWord(int startIdx = 0);
bool isPunctuation(UIGlyph * _glyph);
// USER TESTING FUNCTIONS
void countButtonPresses(bool _isCorrect, bool _isOffensive);
void countInterjectAccuracy(float _pressTime);
void countInsultAccuracy(float _insultHitTime);
}; |
//
// AppDelegate.h
// BottomViewDemo
//
// Created by river on 15/8/11.
// Copyright (c) 2015年 river. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* uartport.h
*
* Created on: 9 лют. 2016
* Author: sd
*/
#ifndef UARTPORT_UARTPORT_H_
#define UARTPORT_UARTPORT_H_
#include "../platformDepend/UART/UART.h"
void sendData(UART & port, const char* portName, uint8_t pinNum,
uint16_t distance);
#endif /* UARTPORT_UARTPORT_H_ */
|
/*******************************************************************************************
Copyright 2010 Broadcom Corporation. All rights reserved.
Unless you and Broadcom execute a separate written software license agreement
governing use of this software, this software is licensed to you under the
terms of the GNU General Public License version 2, available at
http://www.gnu.org/copyleft/gpl.html (the "GPL").
Notwithstanding the above, under no circumstances may you combine this software
in any way with any other Broadcom software provided under a license other than
the GPL, without Broadcom's express prior written consent.
*******************************************************************************************/
/**
* @file hal_audio_enum.h
* @brief API declaration of hardware abstraction layer for Audio driver.
* This code is OS independent and Device independent for audio device control.
****************************************************************************/
#ifndef _HAL_AUDIO_ENUM_H__
#define _HAL_AUDIO_ENUM_H__
//! The higher layer calls this Audio hardware abstraction layer to perform the following actions. This is expandable
//! if audio controller need to handle more requests.
typedef enum
{
ACTION_AUD_MuteSpeaker, ///< Mute speaker output
ACTION_AUD_UnmuteSpeaker, ///< Un-mute speaker output
ACTION_AUD_MuteMic, ///< Mute microphone input
ACTION_AUD_UnmuteMic, ///< Un-mute microphone input
ACTION_AUD_SetMicGain, ///<Element type {::HAL_AUDIO_Param_MicGain_t}, Set Mic Gain
ACTION_AUD_PlayTone, ///<Element type {::HAL_AUDIO_Param_Tone_t}, DSP generates DTMF tone or Supervisory tone
ACTION_AUD_PlayGenericTone, ///<Element type {::HAL_AUDIO_Param_GenericTone_t}, DSP generates generic tone
ACTION_AUD_StopPlayTone, ///< Stop DSP tone generation
ACTION_AUD_SetSpeakerVol, ///<Element type {::HAL_AUDIO_Param_SpkrVol_t}, Change speaker gain setting for current audio ID and output channel.
ACTION_AUD_SetVolumeWithPath, ///<Element type {::HAL_AUDIO_Param_PathCfg_t}, Change audio path settings (volume, output channel)
ACTION_AUD_EnablePath, ///<Element type {::HAL_AUDIO_Param_PathCfg_t}, Enable the audio path(select the audio mode and volume, turn on speaker/mic)
ACTION_AUD_DisablePath, ///<Element type {::HAL_AUDIO_Param_PathCfg_t}, Disable audio path(turn off speaker/mic and set volume to 0)
ACTION_AUD_ConfigCodecParam, ///<Element type {::HAL_AUDIO_Param_CodecCfg_t}, Config audio codec settings (sampling rate, bits per sample)
ACTION_AUD_SetEqualizer, ///<Element type {::HAL_AUDIO_Param_Equalizer_t}, Change equalizer's band gains
ACTION_AUD_SetEqualizerProfile, ///<Element type {::HAL_AUDIO_Param_EqualizerProfile_t}, Change equalizer's profile (a set of band gains and filter coefficients)
ACTION_AUD_SetSTWidening, ///<Element type {::HAL_AUDIO_Param_STW_t}, Change stereo widening settigns
ACTION_AUD_SetMixer, ///<Element type {::HAL_AUDIO_Param_Mixer_t}, Change mixer settings
ACTION_AUD_GetParam, ///<Element type {::HAL_AUDIO_Get_Param_t}, Get parameters of audio controller
#if defined(SS_2153)
ACTION_AUD_SetCustomGain, ///< Set customer's gain table for SPEAKER_PGA, MIC_PGA, and MIXER_GAIN // 02062009 michael
#endif // SS_2153
ACTION_AUD_CtrlAudAlg, ///<Element type {::HAL_AUDIO_Param_AlgCfg_t}, Config dsp algorithms such as EC/NS for BT devices
#ifdef FEATURE_AUDIO_VOICECALL16K
ACTION_AUD_RateChange, ///<Element type {::HAL_AUDIO_Param_RateCfg_t},
#endif // FEATURE_AUDIO_VOICECALL16K
ACTION_AUD_TUNE, ///< Set the tuning parameter to hardware
ACTION_AUD_TOTAL ///< A placeholder
} HAL_AUDIO_ACTION_en_t;
#endif //_HAL_CORE_ENUM_H_
|
#include <linux/version.h>
#include <linux/netlink.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/genetlink.h>
#include "bgw_desense.h"
static struct sock *g_nl_sk;
/* static struct sockaddr_nl src_addr, des_addr; */
/* static struct iovec iov; */
static int pid;
/* static struct msghdr msg; */
void bgw_destory_netlink_kernel(void)
{
if (g_nl_sk != NULL) {
/* sock_release(g_nl_sk->sk_socket); */
netlink_kernel_release(g_nl_sk);
MSG("release socket\n");
return;
}
ERR("no socket yet\n");
return;
}
void send_command_to_daemon(const int command /*struct sk_buff *skb */)
{
/*
struct iphdr *iph;
struct ethhdr *ehdr;
*/
struct nlmsghdr *nlh;
struct sk_buff *nl_skb;
int res;
MSG("here we will send command to native daemon\n");
/* if(skb == NULL)
{
ERR("invalid sk_buff\n");
return;
}
*/
if (!g_nl_sk) {
ERR("invalid socket\n");
return;
}
if (pid == 0) {
ERR("invalid native process pid\n");
return;
}
/*alloc data buffer for sending to native */
nl_skb = alloc_skb(NLMSG_SPACE(MAX_NL_MSG_LEN), GFP_ATOMIC); /*malloc data space at least 1500 bytes, which is ethernet data length */
if (nl_skb == NULL) {
ERR("malloc skb error\n");
return;
}
MSG("malloc data space done\n");
/*
ehdr = eth_hdr(skb);
iph = ip_hdr(skb);
*/
/* nlh = NLMSG_PUT(nl_skb, 0, 0, 0, NLMSG_SPACE(1500)-sizeof(struct nlmsghdr)); */
nlh = nlmsg_put(nl_skb, 0, 0, 0, MAX_NL_MSG_LEN, 0);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
NETLINK_CB(nl_skb).pid = 0;
#else
NETLINK_CB(nl_skb).portid = 0;
#endif
/* memcpy(NLMSG_DATA(nlh), ACK, 5); */
*(char *)NLMSG_DATA(nlh) = command;
res = netlink_unicast(g_nl_sk, nl_skb, pid, MSG_DONTWAIT);
if (res == 0) {
MSG("send to user space process error\n");
return;
} else {
ERR("send to user space process done, data length = %d\n", res);
return;
}
}
static void nl_data_handler(struct sk_buff *__skb)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
int i;
int len;
char str[128];
MSG("we got netlink message\n");
len = NLMSG_SPACE(MAX_NL_MSG_LEN);
skb = skb_get(__skb);
if (skb == NULL)
ERR("skb_get return NULL");
if (skb->len >= NLMSG_SPACE(0)) { /*presume there is 5byte payload at leaset */
MSG("length is enough\n");
nlh = nlmsg_hdr(skb); /* point to data which include in skb */
memcpy(str, NLMSG_DATA(nlh), sizeof(str));
for (i = 0; i < 3; i++)
MSG("str[%d = %c]", i, str[i]);
MSG("str[0] = %d, str[1] = %d, str[2] = %d\n", str[0], str[1], str[2]);
if (str[0] == 'B' && str[1] == 'G' && str[2] == 'W') {
MSG("got native daemon init command, record it's pid\n");
pid = nlh->nlmsg_pid; /*record the native process PID */
MSG("native daemon pid is %d\n", pid);
} else
{
ERR("this is not BGW message, ignore it\n");
return;
}
} else {
ERR("not engouth data length\n");
return;
}
kfree_skb(skb);
send_command_to_daemon(ACK);
return;
}
int bgw_init_socket(void)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
struct netlink_kernel_cfg cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.input = nl_data_handler;
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
g_nl_sk =
netlink_kernel_create(&init_net, NETLINK_TEST, 0, nl_data_handler, NULL, THIS_MODULE);
#else
g_nl_sk = __netlink_kernel_create(&init_net, NETLINK_TEST, THIS_MODULE, &cfg);
#endif
if (g_nl_sk == NULL) {
ERR("netlink_kernel_create error\n");
return -1;
}
MSG("netlink_kernel_create ok\n");
return 0;
}
#if 0
static int mtk_BGW_probe(void)
{
MSG("hello world\n");
init_socket();
return 0;
}
static void mtk_BGW_remove(void)
{
MSG("remove BGW module\n");
destory_netlink_kernel();
return;
}
module_init(mtk_BGW_probe);
module_exit(mtk_BGW_remove);
MODULE_LICENSE("Proprietary. Send bug reports to Guang.Yu@MediaTek.com");
MODULE_DESCRIPTION("MediaTek BGW driver");
MODULE_AUTHOR("Guang Yu <Guang.Yu@MediaTek.com>");
#endif
|
#ifndef _APP_H
#define _APP_H
#include "wx/wx.h"
#include "Studio.h"
using namespace sf;
namespace NESStudio {
class Frame;
class App : public wxApp {
private:
virtual bool OnInit();
};
class Frame : public wxFrame {
private:
public:
Frame(const wxString & title, const wxPoint & pos,
const wxSize & size);
void OnQuit(wxCommandEvent & event);
void OnAbout(wxCommandEvent & event);
void OnSave(wxCommandEvent & event);
void OnLoad(wxCommandEvent & event);
void OnPlayPulse1(wxCommandEvent & event);
void OnPlayPulse2(wxCommandEvent & event);
void OnPlayTriangle(wxCommandEvent & event);
DECLARE_EVENT_TABLE()
};
enum {
ID_Quit = 1,
ID_About,
ID_Save,
ID_Load,
BUTTON_PlayPulse1,
BUTTON_PlayPulse2,
BUTTON_PlayTriangle,
};
}
#endif
|
/*
==========
Copyright 2002 Energon Software
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
==========
*/
#if !defined MAINWINDOW_H
#define MAINWINDOW_H
#include <string>
namespace Gtk
{
class Tree;
};
class MainWindowImpl;
class TreeItem;
class MainWindow
{
public:
MainWindow(const int width, const int height, const std::string& title="");
virtual ~MainWindow();
public:
// adds a subtree under the passed item
Gtk::Tree* addTreeSubtree(TreeItem* const item);
// adds a tree item under a tree (or under the main tree if parent == NULL), name is passed to TreeItem
TreeItem* addTreeItem(const std::string& label, const std::string& name="", Gtk::Tree* const parent=NULL);
// gets the tree view from the window
Gtk::Tree* getTree();
// shows the window
void show();
// enables/disables the Close menu option
void enable_close(const bool enable);
private:
MainWindowImpl* m_impl;
};
#endif
|
#include "sane/config.h"
#include "stdio.h"
#include <syslog.h>
#include <stdarg.h>
#ifndef HAVE_VSYSLOG
void
vsyslog(int priority, const char *format, va_list args)
{
char buf[1024];
vsnprintf(buf, sizeof(buf), format, args);
syslog(priority, "%s", buf);
}
#endif /* !HAVE_VSYSLOG */
|
/*
* linux/arch/arm/mach-m2s/i2c.c
*
* Copyright (C) 2012 Vladimir Khusainov, Emcraft Systems
*
* 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 <linux/init.h>
#include <linux/platform_device.h>
#include <linux/sysdev.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/serial_8250.h>
#include <linux/i2c.h>
#include <mach/m2s.h>
#include <mach/platform.h>
#include <mach/clock.h>
#include <mach/i2c.h>
/*
* MSS I2C_0
*/
#if defined(CONFIG_M2S_MSS_I2C0)
#define I2C_M2S_DEV0_IRQ 4
#define I2C_M2S_DEV0_REGS 0x40002000
#define I2C0_RST_CLR (1 << 11)
static struct resource i2c_m2s_dev0_resources[] = {
{
.start = I2C_M2S_DEV0_IRQ,
.end = I2C_M2S_DEV0_IRQ,
.flags = IORESOURCE_IRQ,
},
{
.start = I2C_M2S_DEV0_REGS,
.end = I2C_M2S_DEV0_REGS + 0xFFF,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device i2c_m2s_dev0 = {
.name = "i2c_a2f",
.id = 0,
.num_resources = ARRAY_SIZE(i2c_m2s_dev0_resources),
.resource = i2c_m2s_dev0_resources,
};
static struct i2c_a2f_data i2c_m2s_data_dev0 = {
.i2c_clk = 100000,
};
#endif /* CONFIG_M2S_MSS_I2C0 */
/*
* MSS I2C_1
*/
#if defined(CONFIG_M2S_MSS_I2C1)
#define I2C_M2S_DEV1_IRQ 7
#define I2C_M2S_DEV1_REGS 0x40012000
#define I2C1_RST_CLR (1 << 12)
static struct resource i2c_m2s_dev1_resources[] = {
{
.start = I2C_M2S_DEV1_IRQ,
.end = I2C_M2S_DEV1_IRQ,
.flags = IORESOURCE_IRQ,
},
{
.start = I2C_M2S_DEV1_REGS,
.end = I2C_M2S_DEV1_REGS + 0xFFF,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device i2c_m2s_dev1 = {
.name = "i2c_a2f",
.id = 1,
.num_resources = ARRAY_SIZE(i2c_m2s_dev1_resources),
.resource = i2c_m2s_dev1_resources,
};
static struct i2c_a2f_data i2c_m2s_data_dev1 = {
.i2c_clk = 400000,
};
#endif /* CONFIG_M2S_MSS_I2C1 */
/*
* Register the M2S specific I2C devices with the kernel.
*/
void __init m2s_i2c_init(void)
{
int p = m2s_platform_get();
#if defined(CONFIG_M2S_MSS_I2C0)
/*
* Reset the I2C controller and then bring it out of reset
*/
writel(readl(&M2S_SYSREG->soft_reset_cr) | I2C0_RST_CLR,
&M2S_SYSREG->soft_reset_cr);
writel(readl(&M2S_SYSREG->soft_reset_cr) & ~I2C0_RST_CLR,
&M2S_SYSREG->soft_reset_cr);
/*
* Pass the device parameters to the driver
*/
i2c_m2s_data_dev0.ref_clk = m2s_clock_get(CLCK_PCLK0);
platform_set_drvdata(&i2c_m2s_dev0, &i2c_m2s_data_dev0);
/*
* Register a platform device for this interface
*/
platform_device_register(&i2c_m2s_dev0);
#endif
#if defined(CONFIG_M2S_MSS_I2C1)
/*
* Reset the I2C controller and then bring it out of reset
*/
writel(readl(&M2S_SYSREG->soft_reset_cr) | I2C1_RST_CLR,
&M2S_SYSREG->soft_reset_cr);
writel(readl(&M2S_SYSREG->soft_reset_cr) & ~I2C1_RST_CLR,
&M2S_SYSREG->soft_reset_cr);
/*
* Pass the device parameters to the driver
*/
i2c_m2s_data_dev1.ref_clk = m2s_clock_get(CLCK_PCLK1);
platform_set_drvdata(&i2c_m2s_dev1, &i2c_m2s_data_dev1);
/*
* Register a platform device for this interface
*/
platform_device_register(&i2c_m2s_dev1);
#endif
/*
* Perform board-specific I2C device registration
*/
if (p == PLATFORM_M2S_SOM) {
#if defined(CONFIG_M2S_MSS_I2C1)
/*
* This assumes that a compatible I2C Flash is
* wired to I2C_1 in the baseboard area.
*/
#if defined(CONFIG_EEPROM_AT24)
static struct i2c_board_info i2c_eeprom__m2s_som= {
I2C_BOARD_INFO("24c512", 0x51)
};
#endif
#if defined(CONFIG_EEPROM_AT24)
i2c_register_board_info(1, &i2c_eeprom__m2s_som, 1);
#endif
#endif
}
}
|
// **********************************************************************
//
// Copyright (c) 2010-2014 Bernard Luo. All rights reserved.
//
// <Email: luo (dot) xiaowei (at) hotmail (dot) com>
//
// **********************************************************************
#ifndef CONCURRENCY_MUTEX_PTR_TRY_LOCK_H
#define CONCURRENCY_MUTEX_PTR_TRY_LOCK_H
#include <Util/Util.h>
#include <Concurrency/ThreadException.h>
THREADING_BEGIN
template <typename M>
class MutexPtrTryLock : public noncopyable
{
public:
MutexPtrTryLock<M>(const M* mutex) :
m_mutex(mutex),
m_acquired(false)
{
if (m_mutex)
{
m_acquired = m_mutex->TryLock();
}
}
~MutexPtrTryLock()
{
if (m_mutex && m_acquired)
{
m_mutex->Unlock();
}
}
void Acquire() const
{
if (m_acquired)
{
throw ThreadLockedException(__FILE__, __LINE__);
}
if (m_mutex)
{
m_mutex->Lock();
m_acquired = true;
}
}
void TryAcquire() const
{
if (m_acquired)
{
throw ThreadLockedException(__FILE__, __LINE__);
}
if (m_mutex)
{
m_acquired = m_mutex->TryLock();
return m_acquired;
}
}
void Release() const
{
if (m_mutex)
{
if (!m_acquired)
{
throw ThreadLockedException(__FILE__, __LINE__);
}
m_mutex->Unlock();
m_acquired = false;
}
}
bool Acquired() const
{
return m_acquired;
}
private:
// Not implemented; prevents accidental use.
//
//MutexPtrTryLock<M>(const MutexPtrTryLock<M>&);
//MutexPtrTryLock<M>& operator=(const MutexPtrTryLock<M>&);
const M* m_mutex;
mutable bool m_acquired;
};
THREADING_END
#endif |
// CkSpiderProgress.h: interface for the CkSpiderProgress class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _CKSPIDERPROGRESS_H
#define _CKSPIDERPROGRESS_H
#pragma once
class CkSpiderProgress
{
public:
CkSpiderProgress();
virtual ~CkSpiderProgress();
// Called periodically to check to see if the method call should be aborted.
virtual void AbortCheck(bool *abort) { }
};
#endif
|
//
// Generated file, do not edit! Created by nedtool 4.6 from veins/modules/application/platooning/messages/BikesMessage.msg.
//
#ifndef _BIKESMESSAGE_M_H_
#define _BIKESMESSAGE_M_H_
#include <omnetpp.h>
// nedtool version check
#define MSGC_VERSION 0x0406
#if (MSGC_VERSION!=OMNETPP_VERSION)
# error Version mismatch! Probably this file was generated by an earlier version of nedtool: 'make clean' should help.
#endif
/**
* Class generated from <tt>veins/modules/application/platooning/messages/BikesMessage.msg:1</tt> by nedtool.
* <pre>
* packet BikesMessage
* {
* //type of vehicle generating the message
* int vehicleType;
* //id of the originator
* int vehicleId;
* //platoon id
* int platoonId;
* //message type
* int messageType;
* //platoon speed
* double platoonSpeed;
* //platoon lane
* int platoonLane;
* //id of vehicle in front of the joiner (G)
* int frontVehicleId;
* //id of the follower vehicle (F)
* int followerVehicleId;
* //platoon formation
* int platoonFormation[];
* }
* </pre>
*/
class BikesMessage : public ::cPacket
{
protected:
int vehicleType_var;
int vehicleId_var;
int platoonId_var;
int messageType_var;
double platoonSpeed_var;
int platoonLane_var;
int frontVehicleId_var;
int followerVehicleId_var;
int *platoonFormation_var; // array ptr
unsigned int platoonFormation_arraysize;
private:
void copy(const BikesMessage& other);
protected:
// protected and unimplemented operator==(), to prevent accidental usage
bool operator==(const BikesMessage&);
public:
BikesMessage(const char *name=NULL, int kind=0);
BikesMessage(const BikesMessage& other);
virtual ~BikesMessage();
BikesMessage& operator=(const BikesMessage& other);
virtual BikesMessage *dup() const {return new BikesMessage(*this);}
virtual void parsimPack(cCommBuffer *b);
virtual void parsimUnpack(cCommBuffer *b);
// field getter/setter methods
virtual int getVehicleType() const;
virtual void setVehicleType(int vehicleType);
virtual int getVehicleId() const;
virtual void setVehicleId(int vehicleId);
virtual int getPlatoonId() const;
virtual void setPlatoonId(int platoonId);
virtual int getMessageType() const;
virtual void setMessageType(int messageType);
virtual double getPlatoonSpeed() const;
virtual void setPlatoonSpeed(double platoonSpeed);
virtual int getPlatoonLane() const;
virtual void setPlatoonLane(int platoonLane);
virtual int getFrontVehicleId() const;
virtual void setFrontVehicleId(int frontVehicleId);
virtual int getFollowerVehicleId() const;
virtual void setFollowerVehicleId(int followerVehicleId);
virtual void setPlatoonFormationArraySize(unsigned int size);
virtual unsigned int getPlatoonFormationArraySize() const;
virtual int getPlatoonFormation(unsigned int k) const;
virtual void setPlatoonFormation(unsigned int k, int platoonFormation);
};
inline void doPacking(cCommBuffer *b, BikesMessage& obj) {obj.parsimPack(b);}
inline void doUnpacking(cCommBuffer *b, BikesMessage& obj) {obj.parsimUnpack(b);}
#endif // ifndef _BIKESMESSAGE_M_H_
|
// Copyright (c) 2010 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 CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_
#define CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_
#pragma once
#include <string>
#include "base/basictypes.h"
#include "ui/gfx/native_widget_types.h"
class InputWindowDialog {
public:
class Delegate {
public:
virtual ~Delegate() {}
virtual bool IsValid(const std::wstring& text) = 0;
virtual void InputAccepted(const std::wstring& text) = 0;
virtual void InputCanceled() = 0;
};
static InputWindowDialog* Create(gfx::NativeWindow parent,
const std::wstring& window_title,
const std::wstring& label,
const std::wstring& contents,
Delegate* delegate);
virtual void Show() = 0;
virtual void Close() = 0;
protected:
InputWindowDialog() {}
virtual ~InputWindowDialog() {}
private:
DISALLOW_COPY_AND_ASSIGN(InputWindowDialog);
};
#endif
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2009-2013 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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 __HIF_LOCK_H
#define __HIF_LOCK_H
#include <glib-object.h>
G_BEGIN_DECLS
#define HIF_TYPE_LOCK (hif_lock_get_type ())
#define HIF_LOCK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), HIF_TYPE_LOCK, HifLock))
#define HIF_LOCK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), HIF_TYPE_LOCK, HifLockClass))
#define HIF_IS_LOCK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), HIF_TYPE_LOCK))
#define HIF_IS_LOCK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), HIF_TYPE_LOCK))
#define HIF_LOCK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), HIF_TYPE_LOCK, HifLockClass))
typedef struct _HifLock HifLock;
typedef struct _HifLockPrivate HifLockPrivate;
typedef struct _HifLockClass HifLockClass;
struct _HifLock
{
GObject parent;
HifLockPrivate *priv;
};
struct _HifLockClass
{
GObjectClass parent_class;
/* Signals */
void (* state_changed) (HifLock *lock,
guint state_bitfield);
};
typedef enum {
HIF_LOCK_TYPE_RPMDB,
HIF_LOCK_TYPE_REPO,
HIF_LOCK_TYPE_METADATA,
HIF_LOCK_TYPE_CONFIG,
HIF_LOCK_TYPE_LAST
} HifLockType;
typedef enum {
HIF_LOCK_MODE_THREAD,
HIF_LOCK_MODE_PROCESS,
HIF_LOCK_MODE_LAST
} HifLockMode;
GType hif_lock_get_type (void);
HifLock *hif_lock_new (void);
guint hif_lock_take (HifLock *lock,
HifLockType type,
HifLockMode mode,
GError **error);
gboolean hif_lock_release (HifLock *lock,
guint id,
GError **error);
void hif_lock_release_noerror (HifLock *lock,
guint id);
const gchar *hif_lock_type_to_string (HifLockType lock_type);
guint hif_lock_get_state (HifLock *lock);
G_END_DECLS
#endif /* __HIF_LOCK_H */
|
#include <linux/kernel.h>
#include <linux/syscalls.h>
#include <linux/hetfs.h>
#include <linux/init_task.h>
int print_tree(int flag, int name) {
struct rb_node *node;
struct data *entry;
struct analyze_request *posh, *nh;
int all_nodes, all_requests, requests;
all_nodes = all_requests = requests = 0;
if (RB_EMPTY_ROOT(init_task.hetfstree)) {
__exact = -4;
printk(KERN_EMERG "[ERROR] __exact empty root\n");
return 1;
}
for (node = rb_first(init_task.hetfstree); node; node = rb_next(node)) {
++all_nodes;
entry = rb_entry(node, struct data, node);
if (name)
printk(KERN_EMERG "[HETFS] file: %s\n", entry->dentry->d_name.name);
//sha512print(entry->hash, 1);
if (flag) {
if (!list_empty(entry->read_reqs) && flag)
printk(KERN_EMERG "[HETFS] READ req:\n");
list_for_each_entry_safe(posh, nh, entry->read_reqs, list) {
all_requests += posh->times;
printk(KERN_EMERG "[HETFS] start: %lld - end:%lld times:%d\n",
posh->start_offset, posh->end_offset, posh->times);
}
if (!list_empty(entry->write_reqs))
printk(KERN_EMERG "[HETFS] WRITE req:\n");
list_for_each_entry_safe(posh, nh, entry->write_reqs, list) {
all_requests += posh->times;
printk(KERN_EMERG "[HETFS] start: %lld - end:%lld times:%d\n",
posh->start_offset, posh->end_offset, posh->times);
}
}
}
if (flag)
printk(KERN_EMERG "[HETFS]Tree Nodes:%d, requests:%d\n", all_nodes, all_requests);
else
printk(KERN_EMERG "[HETFS]Tree Nodes:%d\n", all_nodes);
return 0;
}
EXPORT_SYMBOL(print_tree);
struct list_head *zip_list(struct list_head *general)
{
struct list_head *pos, *n, *pos1, *new;
struct analyze_request *areq, *areq1;
int found;
new = kzalloc(sizeof(struct list_head), GFP_KERNEL);
if (new == NULL)
return NULL;
INIT_LIST_HEAD(new);
list_for_each_safe(pos, n, general) {
found = 0;
areq = list_entry(pos, struct analyze_request, list);
list_for_each(pos1, new){
areq1 = list_entry(pos1, struct analyze_request, list);
if (areq->start_offset == areq1->start_offset &&
areq->end_offset == areq1->end_offset) {
areq1->times += areq->times;
found = 1;
break;
}
}
if (!found)
list_move_tail(pos,new);
}
list_for_each_safe(pos, n, general) {
areq = list_entry(pos, struct analyze_request, list);
list_del(pos);
kfree(areq);
}
kfree(general);
return new;
}
void analyze(struct data* InsNode)
{
struct list_head *pos, *n;
struct analyze_request *areq;
loff_t part, half;
int mid, all = 0;
half = InsNode->size >> 1;
if (!list_empty(InsNode->read_reqs)) {
InsNode->to_rot = 0;
InsNode->read_reqs = zip_list(InsNode->read_reqs);
printk(KERN_EMERG "[HETFS]File %s\n", InsNode->file);
list_for_each_safe(pos, n, InsNode->read_reqs) {
areq = list_entry(pos, struct analyze_request, list);
part = areq->end_offset - areq->start_offset;
InsNode->read_all_file += areq->times;
if (part == InsNode->size) {
all += areq->times;
}
else if (part >= half) {
printk(KERN_EMERG "[HETFS] This part is a big read start %lld end %lld accessed %d times\n",
areq->start_offset, areq->end_offset, areq->times);
}
}
mid = InsNode->read_all_file >> 1;
if (all > 0 && (((all & 1) && all > mid) || (!(all & 1) && all >= mid))) {
InsNode->to_rot |= METASLAB_ROTOR_VDEV_TYPE_HDD;
printk(KERN_EMERG "[HETFS] It was read sequentially\n");
}
else {
InsNode->to_rot |= METASLAB_ROTOR_VDEV_TYPE_SSD;
}
}
if (!list_empty(InsNode->write_reqs)) {
InsNode->write_reqs = zip_list(InsNode->write_reqs);
all = 0;
list_for_each_safe(pos, n, InsNode->write_reqs) {
areq = list_entry(pos, struct analyze_request, list);
part = areq->end_offset - areq->start_offset;
InsNode->write_all_file += areq->times;
if (part == InsNode->size)
all++;
else if (part >= half) {
printk(KERN_EMERG "[HETFS] This part is a big write start %lld end %lld accessed %d times\n",
areq->start_offset, areq->end_offset, areq->times);
}
}
mid = InsNode->write_all_file >> 1;
if (all > 0 && (((all & 1) && all > mid) || (!(all & 1) && all >= mid)))
printk(KERN_EMERG "[HETFS] It was write sequentially\n");
}
}
SYSCALL_DEFINE0(chprint)
{
_myprint = (_myprint)?0:1;
return 0;
}
SYSCALL_DEFINE0(pprint)
{
printk(KERN_EMERG "_myprint is %s\n", _myprint ? "true" : "false");
return 0;
}
SYSCALL_DEFINE2(hetfs, int, flag, int, name)
{
printk(KERN_EMERG "[HETFS]Start of hetfs\n");
printk(KERN_EMERG "[HETFS] Start of hetfs\n");
down_read(&tree_sem);
print_tree(flag, name);
up_read(&tree_sem);
printk(KERN_EMERG "[HETFS] End of hetfs\n");
return 0;
}
SYSCALL_DEFINE0(analyze){
struct rb_node *node;
struct data *entry;
printk(KERN_EMERG "[HETFS]Start of analyze\n");
down_read(&tree_sem);
/*We actually write to nodes inthe tree but no insert or delete*/
for (node = rb_first(init_task.hetfstree); node; node = rb_next(node)) {
entry = rb_entry(node, struct data, node);
analyze(entry);
}
up_read(&tree_sem);
printk(KERN_EMERG "[HETFS] End of analyze\n");
return 0;
}
|
/*
* platform-helpers.h
* Copyright (C) 2010-2018 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _L_PLATFORM_HELPERS_H_
#define _L_PLATFORM_HELPERS_H_
#include <string>
#include "linphone/utils/general.h"
// =============================================================================
L_DECL_C_STRUCT(LinphoneCore);
LINPHONE_BEGIN_NAMESPACE
/**
* This interface aims at abstracting some features offered by the platform, most often mobile platforms.
* A per platform implementation is to be made to implement these features, if available on the platform.
*/
class PlatformHelpers {
public:
virtual ~PlatformHelpers () = default;
// This method shall retrieve DNS server list from the platform and assign it to the core.
virtual void setDnsServers () = 0;
virtual void acquireWifiLock () = 0;
virtual void releaseWifiLock () = 0;
virtual void acquireMcastLock () = 0;
virtual void releaseMcastLock () = 0;
virtual void acquireCpuLock () = 0;
virtual void releaseCpuLock () = 0;
virtual std::string getDataPath () = 0;
virtual std::string getConfigPath () = 0;
protected:
inline explicit PlatformHelpers (LinphoneCore *lc) : mCore(lc) {}
LinphoneCore *mCore;
};
class StubbedPlatformHelpers : public PlatformHelpers {
public:
explicit StubbedPlatformHelpers (LinphoneCore *lc);
virtual ~StubbedPlatformHelpers () = default;
void setDnsServers () override;
void acquireWifiLock () override;
void releaseWifiLock () override;
void acquireMcastLock () override;
void releaseMcastLock () override;
void acquireCpuLock () override;
void releaseCpuLock () override;
std::string getDataPath () override;
std::string getConfigPath () override;
};
PlatformHelpers *createAndroidPlatformHelpers (LinphoneCore *lc, void *systemContext);
PlatformHelpers *createIosPlatformHelpers (LinphoneCore *lc, void *systemContext);
LINPHONE_END_NAMESPACE
#endif // indef _L_PLATFORM_HELPERS_H_
|
/*
* Copyright (C) 2005-2013 Team XBMC
* http://kodi.tv
*
* 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "Addon.h"
#include "utils/Digest.h"
#include "utils/Job.h"
#include "utils/ProgressJob.h"
struct cp_cfg_element_t;
namespace ADDON
{
class CRepository : public CAddon
{
public:
struct DirInfo
{
AddonVersion version{""};
std::string info;
std::string checksum;
KODI::UTILITY::CDigest::Type checksumType{KODI::UTILITY::CDigest::Type::INVALID};
std::string datadir;
std::string artdir;
KODI::UTILITY::CDigest::Type hashType{KODI::UTILITY::CDigest::Type::INVALID};
};
typedef std::vector<DirInfo> DirList;
static std::unique_ptr<CRepository> FromExtension(CAddonInfo addonInfo, const cp_extension_t* ext);
explicit CRepository(CAddonInfo addonInfo) : CAddon(std::move(addonInfo)) {};
CRepository(CAddonInfo addonInfo, DirList dirs);
/*! \brief Get the md5 hash for an addon.
\param the addon in question.
*/
bool GetAddonHash(const AddonPtr& addon, std::string& checksum) const;
enum FetchStatus
{
STATUS_OK,
STATUS_NOT_MODIFIED,
STATUS_ERROR
};
FetchStatus FetchIfChanged(const std::string& oldChecksum, std::string& checksum, VECADDONS& addons) const;
struct ResolveResult
{
std::string location;
KODI::UTILITY::TypedDigest digest;
};
ResolveResult ResolvePathAndHash(AddonPtr const& addon) const;
private:
static bool FetchChecksum(const std::string& url, std::string& checksum) noexcept;
static bool FetchIndex(const DirInfo& repo, std::string const& digest, VECADDONS& addons) noexcept;
static DirInfo ParseDirConfiguration(cp_cfg_element_t* configuration);
DirList m_dirs;
};
typedef std::shared_ptr<CRepository> RepositoryPtr;
class CRepositoryUpdateJob : public CProgressJob
{
public:
explicit CRepositoryUpdateJob(const RepositoryPtr& repo);
~CRepositoryUpdateJob() override = default;
bool DoWork() override;
const RepositoryPtr& GetAddon() const { return m_repo; };
private:
const RepositoryPtr m_repo;
};
}
|
#ifndef Config_H
#define Config_H
#include <qstringlist.h>
class KConfig;
namespace Filelight
{
enum MapScheme { Rainbow, HighContrast, KDE, FileDensity, ModTime };
class Config
{
static KConfig& kconfig();
public:
static void read();
static void write();
//keep everything positive, avoid using DON'T, NOT or NO
static bool varyLabelFontSizes;
static bool showSmallFiles;
static uint contrast;
static uint antiAliasFactor;
static uint minFontPitch;
static uint defaultRingDepth;
static MapScheme scheme;
};
}
using Filelight::Config;
#endif
|
/* drivers/sharp/shdiag/smd_read.c
*
* Copyright (C) 2010 Sharp Corporation
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <sharp/sh_smem.h>
#include <sharp/shdiag_smd.h>
#include <sharp/sh_boot_manager.h>
/* Soft Update Flag */
#define D_SHSOFTUP_F_MASK 0x00000010 /* bit4 */
#define D_SHSOFTUP_F_SHIFT 4
static int smd_mode_open(struct inode *inode, struct file *filp)
{
/* printk("%s\n", __func__);*/
return 0;
}
static ssize_t smd_mode_read(struct file *filp, char __user *buf,size_t count, loff_t *ppos)
{
sharp_smem_common_type *p_sh_smem_common_type = NULL;
struct smem_comm_mode smem_comm_data;
unsigned long UpDateFlgStatus;
/* printk("%s\n", __func__);*/
if(count != sizeof(smem_comm_data)){
return -EINVAL;
}
p_sh_smem_common_type = sh_smem_get_common_address();
if( p_sh_smem_common_type != NULL){
smem_comm_data.BootMode = p_sh_smem_common_type->sh_boot_mode;
UpDateFlgStatus = p_sh_smem_common_type->shdiag_FlagData;
smem_comm_data.UpDateFlg = ( UpDateFlgStatus & D_SHSOFTUP_F_MASK )>>D_SHSOFTUP_F_SHIFT;
/* user aera */
if( copy_to_user( buf, (void *)&smem_comm_data, sizeof(smem_comm_data) ) ){
printk( "copy_to_user failed\n" );
return -EFAULT;
}
} else {
printk("[SH]smd_read_probe: smem_alloc FAILE\n");
}
return count;
}
static ssize_t smd_mode_write(struct file *filp, const char __user *buf,size_t count, loff_t *ppos)
{
/* printk("%s\n", __func__);*/
return count;
}
static int smd_mode_release(struct inode *inode, struct file *filp)
{
/* printk("%s\n", __func__);*/
return 0;
}
static int smd_ioctl_get_hw_revision(unsigned long arg)
{
int ret = 0;
unsigned short hw_revision;
#if 0
hw_revision = sh_boot_get_hw_revision();
#endif
if(copy_to_user((unsigned short __user *)arg, &hw_revision, sizeof(unsigned short)) != 0)
{
printk("[SH]smd_ioctl_get_hw_revision: cpy_to_user FAILE\n");
ret = -EFAULT;
}
return ret;
}
static long smd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
int ret;
switch(cmd) {
case SHDIAG_IOCTL_GET_HW_REVISION:
ret = smd_ioctl_get_hw_revision(arg);
break;
default:
printk("[SH]smd_ioctl: cmd FAILE\n");
ret = -EFAULT;
break;
}
return ret;
}
static struct file_operations smd_mode_fops = {
.owner = THIS_MODULE,
.read = smd_mode_read,
.write = smd_mode_write,
.open = smd_mode_open,
.release = smd_mode_release,
.unlocked_ioctl = smd_ioctl,
};
static struct miscdevice smd_mode_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "smd_read",
.fops = &smd_mode_fops,
};
static int __init smd_mode_init( void )
{
int ret;
ret = misc_register(&smd_mode_dev);
if (ret) {
printk("fail to misc_register (smd_mode_dev)\n");
return ret;
}
printk("smd_mode loaded.\n");
return 0;
}
module_init(smd_mode_init);
MODULE_DESCRIPTION("smd_read");
MODULE_LICENSE("GPL v2");
|
/*
* Copyright (c) Stephan Arts 2006-2012 <stephan@xfce.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 __RISTRETTO_IMAGE_LIST_H__
#define __RISTRETTO_IMAGE_LIST_H__
G_BEGIN_DECLS
#define RSTTO_TYPE_IMAGE_LIST rstto_image_list_get_type()
#define RSTTO_IMAGE_LIST(obj)( \
G_TYPE_CHECK_INSTANCE_CAST ((obj), \
RSTTO_TYPE_IMAGE_LIST, \
RsttoImageList))
#define RSTTO_IS_IMAGE_LIST(obj)( \
G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
RSTTO_TYPE_IMAGE_LIST))
#define RSTTO_IMAGE_LIST_CLASS(klass)( \
G_TYPE_CHECK_CLASS_CAST ((klass), \
RSTTO_TYPE_IMAGE_LIST, \
RsttoImageListClass))
#define RSTTO_IS_IMAGE_LIST_CLASS(klass)( \
G_TYPE_CHECK_CLASS_TYPE ((klass), \
RSTTO_TYPE_IMAGE_LIST()))
typedef struct _RsttoImageListPriv RsttoImageListPriv;
typedef struct _RsttoImageList RsttoImageList;
struct _RsttoImageList
{
GObject parent;
RsttoImageListPriv *priv;
};
typedef struct _RsttoImageListClass RsttoImageListClass;
struct _RsttoImageListClass
{
GObjectClass parent_class;
};
#define RSTTO_TYPE_IMAGE_LIST_ITER rstto_image_list_iter_get_type()
#define RSTTO_IMAGE_LIST_ITER(obj)( \
G_TYPE_CHECK_INSTANCE_CAST ((obj), \
RSTTO_TYPE_IMAGE_LIST_ITER, \
RsttoImageListIter))
#define RSTTO_IS_IMAGE_LIST_ITER(obj)( \
G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
RSTTO_TYPE_IMAGE_LIST_ITER))
#define RSTTO_IMAGE_LIST_ITER_CLASS(klass)( \
G_TYPE_CHECK_CLASS_CAST ((klass), \
RSTTO_TYPE_IMAGE_LIST_ITER, \
RsttoImageListIterClass))
#define RSTTO_IS_IMAGE_LIST_ITER_CLASS(klass)( \
G_TYPE_CHECK_CLASS_TYPE ((klass), \
RSTTO_TYPE_IMAGE_LIST_ITER()))
typedef struct _RsttoImageListIter RsttoImageListIter;
typedef struct _RsttoImageListIterPriv RsttoImageListIterPriv;
struct _RsttoImageListIter
{
GObject parent;
RsttoImageListIterPriv *priv;
};
typedef struct _RsttoImageListIterClass RsttoImageListIterClass;
struct _RsttoImageListIterClass
{
GObjectClass parent_class;
};
GType
rstto_image_list_get_type (void);
RsttoImageList *
rstto_image_list_new (void);
gint
rstto_image_list_get_n_images (
RsttoImageList *image_list);
gboolean
rstto_image_list_add_file (
RsttoImageList *image_list,
RsttoFile *file,
GError **);
gboolean
rstto_image_list_set_directory (
RsttoImageList *image_list,
GFile *dir,
GError **);
gboolean
rstto_image_list_is_busy (
RsttoImageList *list );
GCompareFunc
rstto_image_list_get_compare_func (
RsttoImageList *image_list);
void
rstto_image_list_set_compare_func (
RsttoImageList *image_list,
GCompareFunc func);
/** Built-in Sorting Functions */
void
rstto_image_list_set_sort_by_name (
RsttoImageList *image_list);
void
rstto_image_list_set_sort_by_date (
RsttoImageList *image_list);
RsttoImageListIter *
rstto_image_list_get_iter (RsttoImageList *image_list);
/** Iter functions */
GType
rstto_image_list_iter_get_type ();
RsttoFile *
rstto_image_list_iter_get_file (
RsttoImageListIter *iter );
gboolean
rstto_image_list_iter_previous (
RsttoImageListIter *iter);
gboolean
rstto_image_list_iter_next (
RsttoImageListIter *iter);
gboolean
rstto_image_list_iter_has_previous (
RsttoImageListIter *iter);
gboolean
rstto_image_list_iter_has_next (
RsttoImageListIter *iter);
gint
rstto_image_list_iter_get_position (
RsttoImageListIter *iter);
void
rstto_image_list_iter_set_position (
RsttoImageListIter *iter,
gint pos);
void
rstto_image_list_remove_file (
RsttoImageList *image_list,
RsttoFile *file);
gboolean
rstto_image_list_iter_find_file (
RsttoImageListIter *iter,
RsttoFile *file);
RsttoImageListIter *
rstto_image_list_iter_clone (
RsttoImageListIter *iter);
gboolean
rstto_image_list_iter_get_sticky (
RsttoImageListIter *iter);
G_END_DECLS
#endif /* __RISTRETTO_IMAGE_LIST_H__ */
|
#ifndef DELEGATE_H
#define DELEGATE_H
#include <QtGui/QItemDelegate>
#include "ui_texturepropertiesdialog.h"
#include "texmanager.h"
class Parameter;
class ParameterDelegate: public QItemDelegate
{
Q_OBJECT
public:
ParameterDelegate(QObject *parent = 0);
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
void setEditorData ( QWidget * editor, const QModelIndex & index ) const;
void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const;
void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const;
bool eventFilter(QObject* object, QEvent* event);
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
bool isEditorActive() const;
static const QString & lastPath();
static void setLastPath(const QString & lastPath);
private slots:
void editorValueChanged();
void editorOpened();
void editorClosed();
private:
QWidget* createScalarEditor(QWidget* parent, const QVariant& min, const QVariant& max) const;
QWidget* createBooleanEditor(QWidget* parent) const;
mutable bool m_editorActive;
};
class QTableView;
class Effect;
class QDoubleSpinBox;
class QLabel;
class QComboBox;
class QSpinBox;
class ParameterEditor: public QWidget
{
Q_OBJECT
public:
ParameterEditor(Parameter* param, QWidget* parent = 0);
void updateValue(); // from param
QVariant value() const;
signals:
void valueChanged();
void activated();
void done();
private slots:
void openParameterSettings();
private:
void updateMetaData();
private:
Parameter* m_param;
QWidget* m_editor;
};
class FileEditor : public QWidget
{
Q_OBJECT
public:
FileEditor(QWidget * parent = 0);
QString text() const;
void setText(const QString & str);
QLineEdit * lineEditor() { return m_lineEdit; }
private slots:
void openFileDialog();
void textChanged();
signals:
void valueChanged();
void activated();
void done(QWidget *);
private:
QLineEdit * m_lineEdit;
};
class ColorEditor: public QWidget
{
Q_OBJECT
public:
ColorEditor(QWidget* parent = 0);
const QVariant & value() const;
void setValue(const QVariant & color);
signals:
void valueChanged();
void done(QWidget* widget);
void activated();
private slots:
void openColorPicker();
private:
void init();
void updateLabel();
private:
QColor m_color;
QVariant m_value;
QLabel* m_colorLabel;
};
class DoubleNumInput : public QWidget
{
Q_OBJECT
public:
DoubleNumInput(QWidget * parent = 0);
double value() const;
void setSingleStep(double step);
void setPageStep(double step);
void setDecimals(int decimals);
void setRange(double min, double max);
void clearRange();
public slots:
void setValue(double value);
signals:
void valueChanged(double value);
protected:
void keyPressEvent(QKeyEvent* event);
private slots:
void spinBoxValueChanged(double value);
void sliderValueChanged(int value);
private:
QDoubleSpinBox * m_spinBox;
QSlider * m_slider;
};
/// Boolean parameter editor.
class BooleanInput : public QWidget
{
Q_OBJECT
public:
BooleanInput(QWidget * parent = 0);
bool value() const;
public slots:
void setValue(bool value);
signals:
void valueChanged(bool value);
private slots:
void comboBoxValueChanged(int value);
private:
QComboBox * m_comboBox;
};
/// Integer parameter editor.
class IntegerInput : public QWidget
{
Q_OBJECT
public:
IntegerInput(QWidget * parent = 0);
int value() const;
void setRange(int min, int max);
void clearRange();
public slots:
void setValue(int value);
signals:
void valueChanged(int value);
private slots:
void spinBoxValueChanged(int value);
private:
QSpinBox * m_spinBox;
};
/// Texture properties.
class TexturePropertiesDialog : public QDialog, public Ui::TexturePropertiesDialog
{
Q_OBJECT
public:
TexturePropertiesDialog(QWidget * parent = 0);
void setWrapMode(GLint s, GLint t);
void setMinFilter(GLint filter);
void setMagFilter(GLint filter);
GLint wrapS() const;
GLint wrapT() const;
GLint minFilter() const;
GLint magFilter() const;
};
#endif
|
/*
* COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <tmacros.h>
#include "test_support.h"
rtems_id TaskID[10];
void create_helper(int task)
{
rtems_status_code status;
printf( "Creating task %d - OK\n", task );
status = rtems_task_create(
rtems_build_name( 'T', 'A', task + 0x30, ' ' ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&TaskID[task]
);
directive_failed( status, "rtems_task_create" );
}
void delete_helper( int task )
{
rtems_status_code status;
printf( "Deleting task %d\n", task );
status = rtems_task_delete( TaskID[task] );
directive_failed( status, "rtems_task_delete" );
}
rtems_task Init(
rtems_task_argument argument
)
{
puts( "\n\n*** TEST 70 ***" );
create_helper( 1 );
create_helper( 2 );
create_helper( 3 );
create_helper( 4 );
create_helper( 5 );
create_helper( 6 );
delete_helper( 2 );
delete_helper( 3 );
delete_helper( 4 );
delete_helper( 5 );
create_helper( 2 );
create_helper( 3 );
create_helper( 4 );
create_helper( 5 );
puts( "*** END OF TEST 70 ***" );
rtems_test_exit(0);
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_UNIFIED_WORK_AREAS
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(1)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */
|
/***************************************************************************
GLU.h
(c) 2005-2007 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, 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 __GLU_H
#define __GLU_H
#include "main.h"
#ifndef __GLU_C
extern GB_DESC Cglu[];
#endif /* __GLU_C */
#endif /* __GLU_H */
|
/*
daemon-pipetest.c
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#ifndef _WIN32
#include <poll.h>
#endif
#include "ortp/ortp.h"
static int running=1;
int main(int argc, char *argv[]){
char buf[32768];
ortp_pipe_t fd;
/* handle args */
if (argc < 2) {
ortp_error("Usage: %s pipename", argv[0]);
return 1;
}
ortp_init();
ortp_set_log_level_mask(NULL, ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
fd=ortp_client_pipe_connect(argv[1]);
if (fd==(ortp_pipe_t)-1){
ortp_error("Could not connect to control pipe: %s",strerror(errno));
return -1;
}
#ifdef _WIN32
DWORD fdwMode, fdwOldMode;
HANDLE hin = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleMode(hin, &fdwOldMode);
fdwMode = fdwOldMode ^ ENABLE_MOUSE_INPUT ^ ENABLE_WINDOW_INPUT;
SetConsoleMode(hin, fdwMode);
FlushConsoleInputBuffer(hin);
while (running) {
DWORD read = 0;
DWORD written = 0;
ReadFile(hin, buf, sizeof(buf), &read, NULL);
if (read > 2) {
buf[read - 2] = '\0'; // Remove ending '\r\n'
if (ortp_pipe_write(fd, (uint8_t *)buf, (int)strlen(buf)) < 0) {
running = 0;
} else {
read = ortp_pipe_read(fd, (uint8_t *)buf, sizeof(buf));
if (read > 0) {
WriteFile(hout, buf, read, &written, NULL);
} else {
running = 0;
}
}
}
}
SetConsoleMode(hin, fdwOldMode);
#else
struct pollfd pfds[2] = { { 0 } };
ssize_t bytes;
pfds[0].fd=fd;
pfds[0].events=POLLIN;
pfds[1].fd=1;
pfds[1].events=POLLIN;
while (running){
int err;
err=poll(pfds,2,-1);
if (err>0){
/*splice to stdout*/
if (pfds[0].revents & POLLIN){
if ((bytes=read(pfds[0].fd,buf,sizeof(buf)))>0){
if (write(0,buf,(size_t)bytes)==-1){
ortp_error("Fail to write to stdout?");
break;
}
fprintf(stdout,"\n");
}else if (bytes==0){
break;
}
}
/*splice from stdin to pipe */
if (pfds[1].revents & POLLIN){
if ((bytes=read(pfds[1].fd,buf,sizeof(buf)))>0){
if (write(pfds[0].fd,buf,(size_t)bytes)==-1){
ortp_error("Fail to write to unix socket");
break;
}
}else if (bytes==0){
break;
}
}
}
}
#endif
return 0;
}
|
/**
* EFM32 protothreads
* Copyright (C) 2014 Erki Aring
*
* 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 LPM_H_
#define LPM_H_
void LPM_RegisterEvent (void);
void LPM_WaitForEvent (void);
#endif /* LPM_H_ */
|
/*
* @(#) $Id$
* Copyright (C) 2003 David Necas (Yeti), Petr Klapetek.
* E-mail: yeti@gwyddion.net, klapetek@gwyddion.net.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GWY_SERIALIZABLE_H__
#define __GWY_SERIALIZABLE_H__
#include <glib-object.h>
#include <libgwyddion/gwyddionenums.h>
G_BEGIN_DECLS
#define GWY_TYPE_SERIALIZABLE (gwy_serializable_get_type())
#define GWY_SERIALIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GWY_TYPE_SERIALIZABLE, GwySerializable))
#define GWY_IS_SERIALIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GWY_TYPE_SERIALIZABLE))
#define GWY_SERIALIZABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), GWY_TYPE_SERIALIZABLE, GwySerializableIface))
#define GWY_IMPLEMENT_SERIALIZABLE(iface_init) \
{ \
static const GInterfaceInfo gwy_serializable_iface_info = { \
(GInterfaceInitFunc)iface_init, NULL, NULL \
}; \
g_type_add_interface_static(g_define_type_id, \
GWY_TYPE_SERIALIZABLE, \
&gwy_serializable_iface_info); \
}
typedef struct _GwySerializableIface GwySerializableIface;
typedef struct _GwySerializable GwySerializable; /* dummy */
typedef GByteArray* (*GwySerializeFunc)(GObject *serializable,
GByteArray *buffer);
typedef GObject* (*GwyDeserializeFunc)(const guchar *buffer,
gsize size,
gsize *position);
struct _GwySerializableIface {
/*< private >*/
GTypeInterface parent_class;
/*< public >*/
GwySerializeFunc serialize;
GwyDeserializeFunc deserialize;
void (*clone)(GObject *source, GObject *copy);
GObject* (*duplicate)(GObject *object);
gsize (*get_size)(GObject *object);
};
typedef struct {
guchar ctype;
const guchar *name;
gpointer value;
guint32 *array_size;
} GwySerializeSpec;
typedef union {
gboolean v_boolean;
guchar v_char;
guint32 v_int32;
guint64 v_int64;
gdouble v_double;
guchar *v_string;
GObject *v_object;
gboolean *v_boolean_array;
guchar *v_char_array;
guint32 *v_int32_array;
guint64 *v_int64_array;
gdouble *v_double_array;
guchar **v_string_array;
GObject **v_object_array;
} GwySerializeValue;
typedef struct {
guchar ctype;
const guchar *name;
GwySerializeValue value;
guint32 array_size;
} GwySerializeItem;
GType gwy_serializable_get_type (void) G_GNUC_CONST;
GByteArray* gwy_serializable_serialize (GObject *serializable,
GByteArray *buffer);
GObject* gwy_serializable_deserialize (const guchar *buffer,
gsize size,
gsize *position);
GObject* gwy_serializable_duplicate (GObject *object);
void gwy_serializable_clone (GObject *source,
GObject *copy);
gsize gwy_serializable_get_size (GObject *serializable);
gsize gwy_serialize_get_struct_size (const guchar *object_name,
gsize nspec,
const GwySerializeSpec *spec);
gsize gwy_serialize_get_items_size (const guchar *object_name,
gsize nitems,
const GwySerializeItem *items);
GByteArray* gwy_serialize_pack_object_struct (GByteArray *buffer,
const guchar *object_name,
gsize nspec,
const GwySerializeSpec *spec);
gboolean gwy_serialize_unpack_object_struct (const guchar *buffer,
gsize size,
gsize *position,
const guchar *object_name,
gsize nspec,
GwySerializeSpec *spec);
gsize gwy_serialize_check_string (const guchar *buffer,
gsize size,
gsize position,
const guchar *compare_to);
GByteArray* gwy_serialize_object_items (GByteArray *buffer,
const guchar *object_name,
gsize nitems,
const GwySerializeItem *items);
GwySerializeItem* gwy_deserialize_object_hash (const guchar *buffer,
gsize size,
gsize *position,
const guchar *object_name,
gsize *nitems);
G_END_DECLS
#endif /* __GWY_SERIALIZABLE_H__ */
/* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */
|
/*
* Copyright (C) Actility, SA. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* 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.
*
* 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 version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Actility, SA., 4, rue Ampere 22300 LANNION FRANCE
* or visit www.actility.com if you need additional
* information or have any questions.
*/
//************************************************************************
//************************************************************************
//**
//** File : point_t.h
//**
//** Description :
//**
//**
//** Date : 09/08/2014
//** Author : Mathias Louiset, Actility (c), 201r4
//**
//************************************************************************
//************************************************************************
#ifndef _POINT_T__H_
#define _POINT_T__H_
/**
* @file point_t.h
* @brief The file gives the definition of a Point in logging config
* @author mlouiset
* @date 2014-09-08
*/
typedef struct Point_t
{
/* methods */
/** @ref Point_t_newFree */
void (*setModbusType) (struct Point_t *, int modbusType);
void (*free) (struct Point_t *);
/* members */
struct list_head list;
bool isInit;
bool toDelete;
time_t nextMaxInterval;
time_t nextRead;
int minInterval;
int maxInterval;
char *containerID;
Value_t *lastVal;
uint16_t rq_cluster, rq_attribut, rq_member;
void *xo;
Attr_t *attr;
} Point_t;
/* dynamic allocation */
Point_t *new_Point_t();
void Point_t_newFree(Point_t *This);
void Point_t_setModbusType(Point_t * This, int modbusType);
#endif
|
/*____________________________________________________________________________
FreeAmp - The Free MP3 Player
Portions Copyright (C) 1999 EMusic.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: FavoriteDialog.h,v 1.2 2000/06/12 16:13:55 robert Exp $
____________________________________________________________________________*/
#ifndef INCLUDED_FAVORITEDIALOG_H_
#define INCLUDED_FAVORITEDIALOG_H_
#include <windows.h>
#include <commctrl.h>
#include <vector>
#include <string>
#include <set>
using namespace std;
#include "config.h"
class FAContext;
class PlaylistItem;
class FavoriteDialog
{
public:
FavoriteDialog(FAContext* context, HWND hwnd, PlaylistItem* item);
virtual ~FavoriteDialog();
bool Show();
BOOL DialogProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
protected:
private:
FAContext* m_context;
HWND m_hwnd;
PlaylistItem* m_item;
};
#endif // INCLUDED_FAVORITEDIALOG_H_
|
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
// machine-specific C++ -> Fortran calling syntax
// It defines the FORTRAN macro for converting variable and function
// names from FORTRAN to C. Different compilers do this in different
// ways. The default is add an underscore to the lower case string.
// Other definitions of the macro can be invoked by defining the
// corresponding macro at compile time using -D e.g. -D_IBM
// CONS(a,b) should return ab, the concatenation of its arguments.
// If compiler is using strict ISO C standards, the ## works.
// Otherwise try the old /**/ trick and test.
// If that fails, you will need to figure out
// a definition for the FORTRAN macro that works on your machine.
#if __STDC__
#define CONS(a,b) a##b
#else
#define CONS(a,b) a/**/b
#warning "The following declaration is a test of the CONS macro."
#warning "If it fails with an error, pair_reax_fortran.h must be modified by hand."
static int my_apples_my_oranges = 1;
static int my_applesoroanges = CONS(my_apples,_my_oranges);
#endif
#ifdef _IBM
#define FORTRAN(lcname,ucname) lcname
#endif
#ifdef _F2C_LINUX
#define FORTRAN(lcname,ucname) CONS(lcname,__)
#endif
#ifndef FORTRAN
#define FORTRAN(lcname,ucname) CONS(lcname,_)
#endif
// hard-wired array sizes set in Fortran library
// accesses include file from Fortran library
#include "reax_defs.h"
class ReaxParams {
public:
enum {nneighmax=NNEIGHMAXDEF,
nat=NATDEF,
nattot=NATTOTDEF,
nsort=NSORTDEF,
mbond=MBONDDEF,
nbomax=NBOMAXDEF,
};
};
// data structures corresponding to values in Fortran library
extern "C" struct {
double abo[ReaxParams::nat];
} FORTRAN(cbkabo,CBKABO);
extern "C" struct {
double bo[ReaxParams::nbomax];
} FORTRAN(cbkbo,CBKBO);
extern "C" struct {
double c[3*ReaxParams::nat]; double cglobal[3*ReaxParams::nattot];
int itag[ReaxParams::nat];
} FORTRAN(cbkc,CBKC);
extern "C" struct {
double ch[ReaxParams::nat];
} FORTRAN(cbkch,CBKCH);
extern "C" struct {
double chi[ReaxParams::nsort];
double eta[ReaxParams::nsort];
double gam[ReaxParams::nsort];
} FORTRAN(cbkchb,CBKCHB);
extern "C" struct {
double d[3*ReaxParams::nat]; double estrain[ReaxParams::nat];
} FORTRAN(cbkd,CBKD);
extern "C" struct {
double atomvirial[6*ReaxParams::nat];
double virial[6];
int Lvirial;
int Latomvirial;
} FORTRAN(cbkvirial,CBKVIRIAL);
extern "C" struct {
int ia[ReaxParams::nat*(ReaxParams::mbond+3)];
int iag[ReaxParams::nat*(ReaxParams::mbond+3)];
} FORTRAN(cbkia,CBKIA);
extern "C" struct {
double vlp[ReaxParams::nat];
double dvlpdsbo[ReaxParams::nat];
} FORTRAN(cbklonpar,CBKLONPAR);
extern "C" struct {
int nubon1[ReaxParams::nat*(ReaxParams::mbond)];
int nubon2[ReaxParams::nat*(ReaxParams::mbond)];
} FORTRAN(cbknubon2,CBKNUBON2);
extern "C" struct {
int nvl1[ReaxParams::nneighmax * ReaxParams::nat];
int nvl2[ReaxParams::nneighmax * ReaxParams::nat];
int nvpair;
int nvlself;
} FORTRAN(cbkpairs,CBKPAIRS);
extern "C" struct {
int nvlbo[ReaxParams::nneighmax * ReaxParams::nat];
} FORTRAN(cbknvlbo,CBKNVLBO);
extern "C" struct {
int nvlown[ReaxParams::nneighmax * ReaxParams::nat];
} FORTRAN(cbknvlown,CBKNVLOWN);
extern "C" struct {
char qa[20*ReaxParams::nattot+10];
} FORTRAN(cbkqa,CBKQA);
extern "C" struct {
double eb;
double eoop;
double epen;
double estrc;
double deda[3];
double pressu;
double efi;
double elp;
double emol;
double ea;
double eres;
double et;
double eradbo;
double ev;
double eco;
double ecoa;
double ehb;
double sw;
double ew;
double ep;
double ekin;
} FORTRAN(cbkenergies,CBKENERGIES);
extern "C" struct {
double tset;
double dseed;
double tempmd;
double ts2;
double ts22;
int nmolo;
int nmolo5;
int nbon;
int na;
int namov;
int na_local;
} FORTRAN(rsmall,RSMALL);
// external routines provided by Fortran library
extern "C" void FORTRAN(readc,READC)();
extern "C" void FORTRAN(reaxinit,REAXINIT)();
extern "C" void FORTRAN(ffinpt,FFINPT)();
extern "C" void FORTRAN(tap7th,TAP7TH)();
extern "C" void FORTRAN(taper,TAPER)(double*,double*);
extern "C" void FORTRAN(readgeo,READGEO)();
extern "C" void FORTRAN(srtatom,SRTATOM)();
extern "C" void FORTRAN(vlist,VLIST) ();
extern "C" void FORTRAN(srtbon1,SRTBON1)(int*,int*,double*,int*,int*);
extern "C" void FORTRAN(molec,MOLEC)();
extern "C" void FORTRAN(encalc,ENCALC)();
extern "C" void FORTRAN(getswb,GETSWB)(double*);
extern "C" void FORTRAN(getswa,GETSWA)(double*);
extern "C" void FORTRAN(getvrange,GET_VRANGE)(double*);
extern "C" void FORTRAN(getnvlist,GET_NVLIST)(int*);
extern "C" void FORTRAN(getvlbora,GETVLBORA)(double*);
extern "C" void FORTRAN(cgsolve,CGSOLVE)
(int*,double*,int*,double*,double*,int*);
extern "C" void FORTRAN(getnval,GETNVAL)(int*);
extern "C" void FORTRAN(getntor,GETNTOR)(int*);
extern "C" void FORTRAN(getnhb,GETNHB)(int*);
extern "C" void FORTRAN(getnbonall,GETNBONALL)(int*);
extern "C" void FORTRAN(getnneighmax,GETNNEIGHMAX)(int*);
extern "C" void FORTRAN(getnat,GETNAT)(int*);
extern "C" void FORTRAN(getnattot,GETNATTOT)(int*);
extern "C" void FORTRAN(getnsort,GETNSORT)(int*);
extern "C" void FORTRAN(getmbond,GETMBOND)(int*);
extern "C" void FORTRAN(getnso,GETNSO)(int*);
extern "C" void FORTRAN(setngeofor,SETNGEOFOR)(int*);
extern "C" void FORTRAN(mdsav,MDSAV)(int*);
extern "C" void FORTRAN(getnsbmax,GETNSBMAX)(int*);
extern "C" void FORTRAN(getnsbma2,GETNSBMA2)(int*);
extern "C" void FORTRAN(getcutof3,GETCUTOF3)(double*);
|
/**
******************************************************************************
* @file USB_Device/MSC_Standalone/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.2.1
* @date 09-October-2015
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
#ifdef USE_USB_FS
void OTG_FS_IRQHandler(void);
#else
void OTG_HS_IRQHandler(void);
#endif
void EXTI15_10_IRQHandler(void);
void SDIO_IRQHandler(void);
void DMA2_Stream3_IRQHandler(void);
void DMA2_Stream6_IRQHandler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
#ifndef __ASM_GENERIC_GETORDER_H
#define __ASM_GENERIC_GETORDER_H
#ifndef __ASSEMBLY__
#include <linux/compiler.h>
#include <linux/log2.h>
/*
* Runtime evaluation of get_order()
*/
static inline __attribute_const__
int __get_order(unsigned long size)
{
int order;
size--;
size >>= PAGE_SHIFT;
#if BITS_PER_LONG == 32
order = fls(size);
#else
order = fls64(size);
#endif
return order;
}
/**
* get_order - Determine the allocation order of a memory size
* @size: The size for which to get the order
*
* Determine the allocation order of a particular sized block of memory. This
* is on a logarithmic scale, where:
*
* 0 -> 2^0 * PAGE_SIZE and below
* 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1
* 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1
* 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1
* 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1
* ...
*
* The order returned is used to find the smallest allocation granule required
* to hold an object of the specified size.
*
* The result is undefined if the size is 0.
*
* This function may be used to initialise variables with compile time
* evaluations of constants.
*/
#define get_order(n) \
( \
__builtin_constant_p(n) ? ( \
((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \
(((n) < (1UL << PAGE_SHIFT)) ? 0 : \
ilog2((n) - 1) - PAGE_SHIFT + 1) \
) : \
__get_order(n) \
)
#endif /* __ASSEMBLY__ */
#endif /* __ASM_GENERIC_GETORDER_H */
|
/*
wdb - weather and water data storage
Copyright (C) 2009 met.no
Contact information:
Norwegian Meteorological Institute
Box 43 Blindern
0313 OSLO
NORWAY
E-mail: wdb@met.no
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 WCIFETCHTEST_H_
#define WCIFETCHTEST_H_
#include "AbstractWciTestFixture.h"
class WciRemoveTest: public AbstractWciTestFixture
{
CPPUNIT_TEST_SUITE( WciRemoveTest );
CPPUNIT_TEST( testRemoveGridData );
CPPUNIT_TEST( testRemoveFloatData );
CPPUNIT_TEST( testRemoveFloatDataWithTimeModifier );
CPPUNIT_TEST_SUITE_END();
public:
WciRemoveTest();
virtual ~WciRemoveTest();
virtual void setUp();
virtual void tearDown();
void testRemoveGridData();
void testRemoveFloatData();
void testRemoveFloatDataWithTimeModifier();
};
#endif /* WCIFETCHTEST_H_ */
|
#include <stdio.h>
void byteorder()
{
union
{
short value;
char union_bytes[sizeof(short)];
}test;
test.value = 0x0102;
if (test.union_bytes[0] == 1 && test.union_bytes[1] == 2)
{
printf("Big-endian\n");
}
else if (test.union_bytes[0] == 2 && test.union_bytes[1] == 1)
{
printf("Little-endian\n");
}
else
{
printf("Unkown...\n");
}
}
int main(int argc, char *argv[])
{
byteorder();
return 0;
}
|
/*
DC++ Widget Toolkit
Copyright (c) 2007-2013, Jacek Sieka
SmartWin++
Copyright (c) 2005 Thomas Hansen
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the DWT nor SmartWin++ nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DWT_aspects_Painting_h
#define DWT_aspects_Painting_h
#include "../CanvasClasses.h"
namespace dwt { namespace aspects {
/// Aspect class used by Widgets that can be custom painted.
/** \ingroup aspects::Classes
* When a Painting Event is raised the Widget needs to be repainted.
*/
template< class WidgetType >
class Painting
{
WidgetType& W() { return *static_cast<WidgetType*>(this); }
public:
/// \ingroup EventHandlersaspects::Painting
/// Painting event handler setter
/** If supplied, event handler is called with a PaintCanvas& which you can use to
* paint stuff onto the window with. <br>
* Parameters passed is PaintCanvas&
*/
void onPainting(std::function<void (PaintCanvas&)> f) {
W().addCallback(Message(WM_PAINT), [f, this](const MSG&, LRESULT&) -> bool {
PaintCanvas canvas { &this->W() };
f(canvas);
return true;
});
}
void onPrinting(std::function<void (Canvas&)> f) {
W().addCallback(Message(WM_PRINTCLIENT), [f](const MSG& msg, LRESULT&) -> bool {
FreeCanvas canvas { reinterpret_cast<HDC>(msg.wParam) };
f(canvas);
return true;
});
}
};
} }
#endif
|
/*
* Copyright (c) 2014 James Almer
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavcodec/flacdsp.h"
#include "libavutil/x86/cpu.h"
#include "config.h"
void ff_flac_lpc_32_sse4(int32_t *samples, const int coeffs[32], int order,
int qlevel, int len);
void ff_flac_lpc_32_xop(int32_t *samples, const int coeffs[32], int order,
int qlevel, int len);
void ff_flac_enc_lpc_16_sse4(int32_t *, const int32_t *, int, int, const int32_t *,int);
av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt,
int bps)
{
#if HAVE_YASM
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE4(cpu_flags)) {
if (bps > 16 && CONFIG_FLAC_DECODER)
c->lpc = ff_flac_lpc_32_sse4;
if (bps == 16 && CONFIG_FLAC_ENCODER && CONFIG_GPL)
c->lpc_encode = ff_flac_enc_lpc_16_sse4;
}
if (EXTERNAL_XOP(cpu_flags)) {
if (bps > 16 && CONFIG_FLAC_DECODER)
c->lpc = ff_flac_lpc_32_xop;
}
#endif
}
|
/*
** my_str_isalpha.c for mysh in /home/pirou_g/minishell2/src
**
** Made by Guillaume Pirou
** Login <pirou_g@epitech.net>
**
** Started on Sun Feb 1 08:35:01 2015 Guillaume Pirou
** Last update Sun Feb 1 08:35:02 2015 Guillaume Pirou
*/
#include <stdlib.h>
int my_str_isalpha(char *str)
{
int lp;
if (str == NULL)
return (1);
lp = 0;
while (str[lp] != '\0')
{
if ((str[lp] >= 0 && str[lp] < 65) || (str[lp] > 90 && str[lp] < 97) ||
(str[lp] > 122))
return (0);
++lp;
}
return (1);
}
|
/*
* DEBUG: section 67 String
* AUTHOR: Duane Wessels
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* Squid is the result of efforts by numerous individuals from
* the Internet community; see the CONTRIBUTORS file for full
* details. Many organizations have provided support for Squid's
* development; see the SPONSORS file for full details. Squid is
* Copyrighted (C) 2001 by the Regents of the University of
* California; see the COPYRIGHT file for full details. Squid
* incorporates software developed and/or copyrighted by other
* sources; see the CREDITS file for full details.
*
* 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, USA.
*
*/
#ifndef SQUID_STRING_H
#define SQUID_STRING_H
#include <ostream>
/* squid string placeholder (for printf) */
#ifndef SQUIDSTRINGPH
#define SQUIDSTRINGPH "%.*s"
#define SQUIDSTRINGPRINT(s) (s).psize(),(s).rawBuf()
#endif /* SQUIDSTRINGPH */
class String
{
public:
_SQUID_INLINE_ String();
String(char const *);
String(String const &);
~String();
typedef size_t size_type; //storage size intentionally unspecified
const static size_type npos = static_cast<size_type>(-1);
String &operator =(char const *);
String &operator =(String const &);
bool operator ==(String const &) const;
bool operator !=(String const &) const;
/**
* Retrieve a single character in the string.
\param pos Position of character to retrieve.
*/
_SQUID_INLINE_ char operator [](unsigned int pos) const;
_SQUID_INLINE_ size_type size() const;
/// variant of size() suited to be used for printf-alikes.
/// throws when size() > MAXINT
int psize() const;
/**
* Returns a raw pointer to the underlying backing store. The caller has been
* verified not to make any assumptions about null-termination
*/
_SQUID_INLINE_ char const * rawBuf() const;
/**
* Returns a raw pointer to the underlying backing store.
* The caller requires it to be null-terminated.
*/
_SQUID_INLINE_ char const * termedBuf() const;
void limitInit(const char *str, int len); // TODO: rename to assign()
void clean();
void reset(char const *str);
void append(char const *buf, int len);
void append(char const *buf);
void append(char const);
void append(String const &);
void absorb(String &old);
const char * pos(char const *aString) const;
const char * pos(char const ch) const;
///offset from string start of the first occurrence of ch
/// returns String::npos if ch is not found
size_type find(char const ch) const;
size_type find(char const *aString) const;
const char * rpos(char const ch) const;
size_type rfind(char const ch) const;
_SQUID_INLINE_ int cmp(char const *) const;
_SQUID_INLINE_ int cmp(char const *, size_type count) const;
_SQUID_INLINE_ int cmp(String const &) const;
_SQUID_INLINE_ int caseCmp(char const *) const;
_SQUID_INLINE_ int caseCmp(char const *, size_type count) const;
_SQUID_INLINE_ int caseCmp(String const &) const;
String substr(size_type from, size_type to) const;
_SQUID_INLINE_ void cut(size_type newLength);
private:
void allocAndFill(const char *str, int len);
void allocBuffer(size_type sz);
void setBuffer(char *buf, size_type sz);
bool defined() const {return buf_!=NULL;}
bool undefined() const {return !defined();}
_SQUID_INLINE_ bool nilCmp(bool, bool, int &) const;
/* never reference these directly! */
size_type size_; /* buffer size; 64K limit */
size_type len_; /* current length */
char *buf_;
_SQUID_INLINE_ void set(char const *loc, char const ch);
_SQUID_INLINE_ void cutPointer(char const *loc);
};
_SQUID_INLINE_ std::ostream & operator<<(std::ostream& os, String const &aString);
_SQUID_INLINE_ bool operator<(const String &a, const String &b);
#if _USE_INLINE_
#include "String.cci"
#endif
const char *checkNullString(const char *p);
int stringHasWhitespace(const char *);
int stringHasCntl(const char *);
char *strwordtok(char *buf, char **t);
#endif /* SQUID_STRING_H */
|
/****************************************************************************
(c) Cambridge Silicon Radio Limited 2009
All rights reserved and confidential information of CSR
REVISION: $Revision: #1 $
****************************************************************************/
#include "csr_pmalloc.h"
#include "csr_framework_ext.h"
#include "csr_panic.h"
/* --------------------------------------------------------------------------
* Initialise the mutex so that it can be used to lock
* areas of code */
CsrErrorCode CsrMutexCreate(CsrMutexHandle* mutex)
{
if (mutex == NULL)
{
return CSR_ERROR_INVALID_POINTER;
}
*mutex = (struct semaphore*)CsrPmalloc(sizeof(struct semaphore));
init_MUTEX(*mutex);
return CSR_ERROR_SUCCESS;
}
/* --------------------------------------------------------------------------
* Destroys the mutex so that the associate resources are freed
*/
void CsrMutexDestroy(CsrMutexHandle mutex)
{
if (mutex == NULL)
{
return;
}
CsrPfree(mutex);
}
/* --------------------------------------------------------------------------
* Marks the code following this function as critical. This means no other
* context that uses the same critical section handle may execute the code
*/
CsrErrorCode CsrMutexLock(CsrMutexHandle mutex)
{
if (mutex == NULL)
{
return CSR_ERROR_INVALID_HANDLE;
}
if (down_interruptible(mutex))
{
CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_UNEXPECTED_VALUE, "CsrMutexLock Failed");
return CSR_ERROR_INVALID_HANDLE;
}
return CSR_ERROR_SUCCESS;
}
/* --------------------------------------------------------------------------
* Marks the end of the critical section - many execution contexts may
* execute the code after this call.
*/
CsrErrorCode CsrMutexUnlock(CsrMutexHandle mutex)
{
if (mutex == NULL)
{
return CSR_ERROR_INVALID_HANDLE;
}
up(mutex);
return CSR_ERROR_SUCCESS;
}
void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p)
{
WARN_ON(1);
}
void CsrThreadSleep(CsrUint32 sleepTimeInMs)
{
unsigned long t, j;
/* Convert t in ms to jiffies and round up */
t = ((sleepTimeInMs * HZ) + 999) / 1000;
j = schedule_timeout_interruptible(t);
}
void *CsrMemAlloc(size_t size)
{
return kmalloc(size, GFP_KERNEL);
} /* CsrMemAlloc() */
void CsrMemFree(void *pointer)
{
kfree(pointer);
} /* CsrMemFree() */
|
#pragma once
/*
* Copyright (C) 2013 Team XBMC
* http://www.xbmc.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, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "JNIBase.h"
class CJNICursor;
class CJNIURI;
class CJNIContentResolver : public CJNIBase
{
public:
CJNIContentResolver(const jni::jhobject &object) : CJNIBase(object){};
static std::string SCHEME_CONTENT;
static std::string SCHEME_ANDROID_RESOURCE;
static std::string SCHEME_FILE;
static std::string CURSOR_ITEM_BASE_TYPE;
static std::string CURSOR_DIR_BASE_TYPE;
CJNICursor query(const CJNIURI &uri, const std::vector<std::string> &projection, const std::string &selection, const std::vector<std::string> &selectionArgs, const std::string &sortOrder);
static void PopulateStaticFields();
private:
CJNIContentResolver();
};
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
*
* Authors: Erik Nordström <enordstr@cs.princeton.edu>
*
*
* 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 _COMMON_LOG_H
#define _COMMON_LOG_H
#include <stdarg.h>
#include <stdio.h>
enum log_mode {
LOG_APPEND,
LOG_TRUNCATE,
};
enum log_flag {
LOG_F_TIMESTAMP = 1 << 0, /* Add a timestamp to each log entry */
LOG_F_SYNC = 1 << 1, /* Flush log to disk after each write */
};
struct log_handle {
FILE *fp;
unsigned char flags;
};
#define LOG_INIT { NULL, 0 }
#define LOG_DEFINE(name) \
struct log_handle name = LOG_INIT;
extern struct log_handle __default_log;
#define DEFAULT_LOG (&__default_log)
extern struct log_handle __default_error_log;
#define DEFAULT_ERR_LOG (&__default_error_log)
int log_is_open(struct log_handle *lh);
void log_set_flag(struct log_handle *lh, enum log_flag flag);
void log_unset_flag(struct log_handle *lh, enum log_flag flag);
int log_open(struct log_handle *lh, const char *path, enum log_mode mode);
void log_close(struct log_handle *lh);
int log_printf(struct log_handle *lh, const char *format, ...);
int log_vprintf(struct log_handle *lh, const char *format, va_list ap);
#endif /* _COMMON_LOG_H */
|
#ifndef LEDS_H
#define LEDS_H
int disable_mpp9(int flag_control);
#endif
|
/*
* This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOSSERVER_MOVEPLINE_H
#define MANGOSSERVER_MOVEPLINE_H
#include "spline.h"
#include "Movement/MoveSplineInitArgs.h"
namespace Movement
{
enum MonsterMoveType
{
MonsterMoveNormal = 0,
MonsterMoveStop = 1,
MonsterMoveFacingSpot = 2,
MonsterMoveFacingTarget = 3,
MonsterMoveFacingAngle = 4
};
struct Location : public Vector3
{
Location() : orientation(0) {}
Location(float x, float y, float z, float o) : Vector3(x, y, z), orientation(o) {}
Location(const Vector3& v) : Vector3(v), orientation(0) {}
Location(const Vector3& v, float o) : Vector3(v), orientation(o) {}
float orientation;
};
// MoveSpline represents smooth catmullrom or linear curve and point that moves belong it
// curve can be cyclic - in this case movement will be cyclic
// point can have vertical acceleration motion componemt(used in fall, parabolic movement)
class MoveSpline
{
public:
typedef Spline<int32> MySpline;
enum UpdateResult
{
Result_None = 0x01,
Result_Arrived = 0x02,
Result_NextCycle = 0x04,
Result_NextSegment = 0x08,
};
friend class PacketBuilder;
protected:
MySpline spline;
FacingInfo facing;
uint32 m_Id;
MoveSplineFlag splineflags;
int32 time_passed;
int32 point_Idx;
int32 point_Idx_offset;
void init_spline(const MoveSplineInitArgs& args);
protected:
const MySpline::ControlArray& getPath() const { return spline.getPoints();}
void computeFallElevation(float& el) const;
UpdateResult _updateState(int32& ms_time_diff);
int32 next_timestamp() const { return spline.length(point_Idx + 1);}
int32 segment_time_elapsed() const { return next_timestamp() - time_passed;}
int32 timeElapsed() const { return Duration() - time_passed;}
int32 timePassed() const { return time_passed;}
public:
const MySpline& _Spline() const { return spline;}
int32 _currentSplineIdx() const { return point_Idx;}
void _Finalize();
void _Interrupt() { splineflags.done = true;}
public:
void Initialize(const MoveSplineInitArgs&);
bool Initialized() const { return !spline.empty();}
explicit MoveSpline();
template<class UpdateHandler>
void updateState(int32 difftime, UpdateHandler& handler)
{
MANGOS_ASSERT(Initialized());
do
handler(_updateState(difftime));
while (difftime > 0);
}
void updateState(int32 difftime)
{
MANGOS_ASSERT(Initialized());
do _updateState(difftime);
while (difftime > 0);
}
Location ComputePosition() const;
uint32 GetId() const { return m_Id;}
bool Finalized() const { return splineflags.done; }
bool isCyclic() const { return splineflags.cyclic;}
const Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3();}
const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3();}
int32 currentPathIdx() const;
int32 Duration() const { return spline.length();}
std::string ToString() const;
};
}
#endif // MANGOSSERVER_MOVEPLINE_H
|
#ifndef QGPK_H
#define QGPK_H
#include <QObject>
#include <QStringList>
#include <QList>
#define GPK_TAILER_IDENT0 "STKFile0PIDX"
#define GPK_TAILER_IDENT1 "STKFile0PACKFILE"
const unsigned char CIPHERCODE[16] = {0x82, 0xEE, 0x1D, 0xB3,
0x57, 0xE9, 0x2C, 0xC2,
0x2F, 0x54, 0x7B, 0x10,
0x4C, 0x9A, 0x75, 0x49
};
#pragma pack (1)
typedef struct
{
char sig0[12];
quint32 pidx_length;
char sig1[16];
} GPKsig;
typedef struct
{
quint16 sub_version; // same as script.gpk.* suffix
quint16 version; // major version(always 1)
quint16 zero; // always 0
quint32 offset; // pidx data file offset
quint32 comprlen; // compressed pidx data length
char dflt[4]; // magic "DFLT" or " "
quint32 uncomprlen; // raw pidx data length(if magic isn't DFLT, then this filed always zero)
char comprheadlen; // pidx data header length
} GPKEntryHeader;
typedef struct
{
QString name;
GPKEntryHeader header;
} GPKentry;
#pragma pack ()
class QGPKFile;
class QGPK : public QObject
{
Q_OBJECT
public:
explicit QGPK(QObject *parent = 0);
bool load(QString file_name);
QGPKFile* open(QString filename);
QStringList list(QString mask);
QString getName();
void unpack_all(QString dir);
signals:
public slots:
private:
QList<GPKentry> entries;
QString name;
};
#endif // QGPK_H
|
/*
* pluma-commands-file-print.c
* This file is part of pluma
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
* Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
* Copyright (C) 2002-2005 Paolo Maggi
* Copyright (C) 2012-2021 MATE 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Modified by the pluma Team, 1998-2005. See the AUTHORS file for a
* list of people on the pluma Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "pluma-commands.h"
#include "pluma-window.h"
#include "pluma-tab.h"
#include "pluma-debug.h"
void
_pluma_cmd_file_print_preview (GtkAction *action,
PlumaWindow *window)
{
PlumaTab *tab;
pluma_debug (DEBUG_COMMANDS);
tab = pluma_window_get_active_tab (window);
if (tab == NULL)
return;
_pluma_tab_print_preview (tab);
}
void
_pluma_cmd_file_print (GtkAction *action,
PlumaWindow *window)
{
PlumaTab *tab;
pluma_debug (DEBUG_COMMANDS);
tab = pluma_window_get_active_tab (window);
if (tab == NULL)
return;
_pluma_tab_print (tab);
}
|
/*
* Author: Paul Reioux aka Faux123 <reioux@gmail.com>
*
* Copyright 2012-2014 Paul Reioux
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/cpu.h>
#include <linux/cpufreq.h>
#include <mach/cpufreq.h>
#define MSM_CPUFREQ_LIMIT_MAJOR 1
#define MSM_CPUFREQ_LIMIT_MINOR 2
//#define DEBUG_CPU_LIMITER
#ifdef CONFIG_MSM_CPU_FREQ_SET_MIN_MAX
uint32_t limited_max_freq = CONFIG_MSM_CPU_FREQ_MAX;
#else
uint32_t limited_max_freq = 2265600;
#endif
static int update_cpu_max_freq(int cpu, uint32_t max_freq)
{
int ret = 0;
ret = msm_cpufreq_set_freq_limits(cpu, MSM_CPUFREQ_NO_LIMIT, max_freq);
if (ret)
return ret;
limited_max_freq = max_freq;
#ifdef DEBUG_CPU_LIMITER
if (max_freq != MSM_CPUFREQ_NO_LIMIT)
pr_info("%s: Limiting cpu%d max frequency to %d\n",
__func__, cpu, max_freq);
else
pr_info("%s: Max frequency reset for cpu%d\n",
__func__, cpu);
#endif
ret = cpufreq_update_policy(cpu);
return ret;
}
static ssize_t msm_cpufreq_limit_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%u\n", limited_max_freq);
}
static ssize_t msm_cpufreq_limit_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
int cpu = 0;
int ret = 0;
unsigned int data;
if(sscanf(buf, "%u\n", &data) == 1) {
for_each_possible_cpu(cpu) {
ret = update_cpu_max_freq(cpu, data);
if (ret)
pr_debug("Unable to limit cpu%d max freq to %d\n",
cpu, data);
}
if (!ret)
limited_max_freq = data;
}
return count;
}
static ssize_t msm_cpufreq_limit_version_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "version: %u.%u\n",
MSM_CPUFREQ_LIMIT_MAJOR, MSM_CPUFREQ_LIMIT_MINOR);
}
static struct kobj_attribute msm_cpufreq_limit_attribute =
__ATTR(cpufreq_limit, 0666,
msm_cpufreq_limit_show,
msm_cpufreq_limit_store);
static struct kobj_attribute msm_cpufreq_limit_version_attribute =
__ATTR(msm_cpufreq_limit_version, 0444 ,
msm_cpufreq_limit_version_show,
NULL);
static struct attribute *msm_cpufreq_limit_attrs[] =
{
&msm_cpufreq_limit_attribute.attr,
&msm_cpufreq_limit_version_attribute.attr,
NULL,
};
static struct attribute_group msm_cpufreq_limit_attr_group =
{
.attrs = msm_cpufreq_limit_attrs,
};
static struct kobject *msm_cpufreq_limit_kobj;
static int msm_cpufreq_limit_init(void)
{
int sysfs_result;
msm_cpufreq_limit_kobj =
kobject_create_and_add("msm_cpufreq_limit", kernel_kobj);
if (!msm_cpufreq_limit_kobj) {
pr_err("%s msm_cpufreq_limit_kobj kobject create failed!\n",
__func__);
return -ENOMEM;
}
sysfs_result = sysfs_create_group(msm_cpufreq_limit_kobj,
&msm_cpufreq_limit_attr_group);
if (sysfs_result) {
pr_info("%s msm_cpufreq_limit_kobj create failed!\n",
__func__);
kobject_put(msm_cpufreq_limit_kobj);
}
return sysfs_result;
}
static void msm_cpufreq_limit_exit(void)
{
if (msm_cpufreq_limit_kobj != NULL)
kobject_put(msm_cpufreq_limit_kobj);
}
module_init(msm_cpufreq_limit_init);
module_exit(msm_cpufreq_limit_exit);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Paul Reioux <reioux@gmail.com>");
MODULE_DESCRIPTION("Krait CPU frequency Limit Driver");
|
//
// GFoundation.h
// GFoundation
//
// Created by Ghost on 14-9-20.
// Copyright (c) 2014年 Ghost. All rights reserved.
//
#ifndef GFoundation_GFoundation_h
#define GFoundation_GFoundation_h
#import "GUIFramework.h"
#import "GUIQuickStoryboardFramework.h"
#import "GTMBase64.h"
#import "NSArrayExtensions.h"
#import "NSDataExtensions.h"
#import "NSDictionaryExtensions.h"
#import "NSString+DES.h"
#import "NSString+MD5.h"
#import "NSStringExtensions.h"
#import "UIView+CGRectExtension.h"
#import "UINavigationBar+BackgroundColor.h"
#import "UIImage+ImageEffects.h"
#import "NSObject+DoNothing.h"
#define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0)
#define WeakSelf(ws) __weak __typeof(&*self)ws = self;
#define getScreenWidth() ([UIScreen mainScreen].bounds.size.width)
#define getScreenHeight() ([UIScreen mainScreen].bounds.size.height)
#endif
|
#define GLUE_HELPER(x, y) x ## _ ## y
#define GLUE(x, y) GLUE_HELPER(x, y)
#define TOSTRING(x) #x
static const char *GLUE(make_string, TYPE_FUNC)(TYPE value, int base)
{
static char buffer[66];
char *s; /* allows 64-bit base 2 value with minus and null */
TYPEU valuetemp;
/* build number string in proper base, work backwards, starting with null */
s = buffer + sizeof(buffer);
*--s = 0;
/* fill in the digits */
valuetemp = (value < 0) ? -value : value;
do
{
*--s = "0123456789abcdefghijklmnopqrstuvwxyz"[valuetemp % base];
valuetemp /= base;
} while (valuetemp);
/* add sign if needed */
if (value < 0)
*--s = '-';
return s;
}
static void GLUE(e, TYPE_FUNC)(int n, const char *s, TYPE result, int base)
{
/* watch out: don't overwrite the static buffer in make_string */
printf("Subtest %s, error %d, errno=%d, s=\"%s\", base=%d, ", TOSTRING(TYPE_FUNC), n, errno, s, base);
printf("result=%s\n", GLUE(make_string, TYPE_FUNC)(result, base));
if (errct++ > MAX_ERROR)
{
printf("Too many errors; test aborted\n");
exit(1);
}
}
static void GLUE(test_string, TYPE_FUNC)(const char *s, TYPE value, int base)
{
char *end;
TYPE result;
/* must convert the entire string, resulting in the requested value */
result = TYPE_FUNC(s, &end, base);
if (result != value) GLUE(e, TYPE_FUNC)(1, s, result, base);
if (*end) GLUE(e, TYPE_FUNC)(2, s, result, base);
}
static void GLUE(test_value_with_base, TYPE_FUNC)(TYPE value, int base)
{
const char *s;
/* convert to string, then convert back */
s = GLUE(make_string, TYPE_FUNC)(value, base);
GLUE(test_string, TYPE_FUNC)(s, value, base);
}
static void GLUE(test_value, TYPE_FUNC)(TYPE value)
{
int base;
/* let's get all our bases covered */
for (base = 2; base <= 36; base++)
GLUE(test_value_with_base, TYPE_FUNC)(value, base);
}
static void GLUE(test, TYPE_FUNC)(void)
{
int base, i;
TYPE value, valuenext;
/* check 0x0000.... and 0xffff.... */
value = 0;
for (i = 0; i < 0x10000; i++)
{
/* test current value */
GLUE(test_value, TYPE_FUNC)(value);
GLUE(test_value, TYPE_FUNC)(-value);
value++;
}
/* check 0x8000.... and 0x7fff.... */
value = 0;
value = ((~value) << 1) >> 1;
for (i = 0; i < 0x10000; i++)
{
/* test current value */
GLUE(test_value, TYPE_FUNC)(value);
GLUE(test_value, TYPE_FUNC)(-value);
value++;
}
/* check powers of possible bases */
for (base = 2; base <= 36; base++)
{
value = 1;
while (1)
{
/* test current value with offsets */
for (i = -36; i <= 36; i++)
{
GLUE(test_value, TYPE_FUNC)(value + i);
GLUE(test_value, TYPE_FUNC)(-value + i);
}
/* stop after overflow */
valuenext = value * base;
if (valuenext <= value)
break;
value = valuenext;
}
}
/* automatic base */
GLUE(test_string, TYPE_FUNC)("10", 10, 0);
GLUE(test_string, TYPE_FUNC)("010", 010, 0);
GLUE(test_string, TYPE_FUNC)("010", 010, 8);
GLUE(test_string, TYPE_FUNC)("0x10", 0x10, 0);
GLUE(test_string, TYPE_FUNC)("0X10", 0X10, 0);
GLUE(test_string, TYPE_FUNC)("0x10", 0x10, 16);
GLUE(test_string, TYPE_FUNC)("0X10", 0X10, 16);
/* ignore plus sign, leading spaces and zeroes */
GLUE(test_string, TYPE_FUNC)("10", 10, 10);
GLUE(test_string, TYPE_FUNC)("010", 10, 10);
GLUE(test_string, TYPE_FUNC)("0010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" 10", 10, 10);
GLUE(test_string, TYPE_FUNC)(" 010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" 0010", 10, 10);
GLUE(test_string, TYPE_FUNC)("\t10", 10, 10);
GLUE(test_string, TYPE_FUNC)("\t010", 10, 10);
GLUE(test_string, TYPE_FUNC)("\t0010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" \t10", 10, 10);
GLUE(test_string, TYPE_FUNC)(" \t010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" \t0010", 10, 10);
GLUE(test_string, TYPE_FUNC)("+10", 10, 10);
GLUE(test_string, TYPE_FUNC)("+010", 10, 10);
GLUE(test_string, TYPE_FUNC)("+0010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" +10", 10, 10);
GLUE(test_string, TYPE_FUNC)(" +010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" +0010", 10, 10);
GLUE(test_string, TYPE_FUNC)("\t+10", 10, 10);
GLUE(test_string, TYPE_FUNC)("\t+010", 10, 10);
GLUE(test_string, TYPE_FUNC)("\t+0010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" \t+10", 10, 10);
GLUE(test_string, TYPE_FUNC)(" \t+010", 10, 10);
GLUE(test_string, TYPE_FUNC)(" \t+0010", 10, 10);
}
#undef GLUE_HELPER
#undef GLUE
#undef TOSTRING
|
/*
* Linball - un pinball 2D multiplataforma escrito en C + SDL (desarrollado en Linux)
*
* COSAS FEAS DEL CODIGO QUE QUISIERA CAMBIAR (pero que en el estado actual
* en que estan funcionan):
*
* - la "V" roja donde se posiciona la pelota (en pinball.bmp) antes de empezar
* el nivel de juego es un truco para que la pelota caiga y se posicione
* sin moverse. dx tiene que ser igual a 0, y pelotax = 743 (pelotay = 600)
*
* - la posicion de la tabla inicial es -700 (y0pantalla).
*
* Los valores anteriores estan dentro del codigo de juego como inicializacion.
* Lo feo de esos valores es que si alguien (yo talvez) cambia un valor de
* esos la pelota caerá mal al comenzar el nivel y no se posicionará delante
* del "resorte" disparador
*
* - en colisiones() no se hara un efecto de sonido cuando la pelota "rebote"
* en alguna parte inferior. Esto es porque cuando la pelota es retenida
* por los flippers en realidad lo que sucede es que rebota en ambos lados
* constantemente. Si hacemos un efecto de sonido en esos rebotes se escucharia
* una especie de "ametralladora".
*
*/
#define MAX_OBJ 20
#define NUM_OBJ 10
/* macros para modificar la resolucion del juego a 320x240 (tabla 320x480) */
/* macros para la bola */
#define ANCHO_BOLA 32 /* para 320x240 el ancho de la bola es 12/
* para 800x600 el ancho de la bola es 32
*/
#define MOD_BOLA ANCHO_BOLA / 32
/* macros del ancho y largo de la pantalla y de la tabla*/
//#define ANCHO 800 /* puede ser 320 u 800 */
#define LARGO 600 /* puede ser 240 u 600 */
#define LARGO_TABLA 1200 /* puede ser 480 u 1200 */
#define MODX ANCHO / 800
#define MODY LARGO / 600
#define MODY_REAL LARGO_TABLA / 1200
struct object {
int posx,posy;
int visible; /*booleano para saber si dibujarlo o no*/
SDL_Surface * imagen;
};
enum objects{fondo=0,fondo_dummy,fondo_sup,fondo_sup_dummy, fondo_objetos,
aquibonus, ball,flipper_Ldwn,flipper_Rdwn,flipper_Lup,flipper_Rup,
flipper_LdwnR,flipper_RdwnR,flipper_LupR,flipper_RupR, bumperi1,
bumperi2, bumperi3, bumpizq, bumpder, tabla_luz1, tabla_luz2, tabla_luz3, last};
enum luces {roja, verde, azul, magenta, ult_luz};
struct luces_colores {
SDL_Surface * imagen;
};
struct luz {
int posx;
int posy;
int visible;
enum luces clase;
int modo;
int inc;
};
SDL_Surface * image, *scr, *pelota,*temp,*temp2,*dummy;
SDL_Surface *fondoi1, *fondoi2;
SDL_Rect dest;
/* profundidad de colores */
const int prof=16;
/* para habilitar sonido */
int enable_sound=1;
/* sonido de la bola ingresando al tablero cuando inicia el nivel */
int phaserChannel = -1;
/* Font a utilizar */
TTF_Font *font, *font_bonus, *font2;
/* Variables del nivel (deberian estar todas dentro de una estructura) */
int potencia_disparador;
int nivel;
int bolas_por_jugar;
int chance_izq;
int chance_der;
int puntaje, puntaje_anterior;
int tecla_space;
char banner[80]; /* texto en la parte superior de la pantalla */
char banner_b[80]; /* texto bonus en la parte superior de la pantalla */
int juego_finalizado;
int puente; /* esta variable indica si la bola esta abajo o en el
* puente
*/
/* parametros del tiempo para calcular el FPS */
int prev_ticks = 0, cur_ticks = 0; /* for keeping track of timing */
int bonus_timer;
enum personajes { belgrano, moreno, borges, guevara, fangio, favaloro,
fontanarrosa, sanmartin, storni, piazzolla, tato,
olmedo, sabato, lastpersonaje };
char *bonus_banner;
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:38 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/linux/atm_suni.h */
/* atm_suni.h - Driver-specific declarations of the SUNI driver (for use by
driver-specific utilities) */
/* Written 1998,2000 by Werner Almesberger, EPFL ICA */
#ifndef LINUX_ATM_SUNI_H
#if defined(__cplusplus) && !CLICK_CXX_PROTECTED
# error "missing #include <click/cxxprotect.h>"
#endif
#define LINUX_ATM_SUNI_H
/* everything obsoleted */
#endif
|
/*
* This set of routines starts the application. It includes application,
* board, and monitor specific initialization and configuration.
* The generic CPU dependent initialization has been performed
* before any of these are invoked.
*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#include <string.h>
#include <fcntl.h>
#include <bsp.h>
#include <bsp/irq.h>
#include <psim.h>
#include <bsp/bootcard.h>
#include <bsp/linker-symbols.h>
#include <rtems/bspIo.h>
#include <rtems/powerpc/powerpc.h>
#include <libcpu/cpuIdent.h>
#include <libcpu/bat.h>
#include <libcpu/spr.h>
#include <libcpu/mmu_support.h>
SPR_RW(SPRG1)
/* On psim, each click of the decrementer register corresponds
* to 1 instruction. By setting this to 100, we are indicating
* that we are assuming it can execute 100 instructions per
* microsecond. This corresponds to sustaining 1 instruction
* per cycle at 100 Mhz. Whether this is a good guess or not
* is anyone's guess.
*/
extern int PSIM_INSTRUCTIONS_PER_MICROSECOND;
/*
* PCI Bus Frequency
*/
unsigned int BSP_bus_frequency;
/*
* Driver configuration parameters
*/
uint32_t bsp_clicks_per_usec;
/*
* Memory on this board.
*/
uint32_t BSP_mem_size = (uint32_t)RamSize;
/*
* Time base divisior (how many tick for 1 second).
*/
unsigned int BSP_time_base_divisor;
extern unsigned long __rtems_end[];
void BSP_panic(char *s)
{
printk("%s PANIC %s\n",_RTEMS_version, s);
__asm__ __volatile ("sc");
}
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
/*
* bsp_start
*
* This routine does the bulk of the system initialization.
*/
void bsp_start( void )
{
/*
* Note we can not get CPU identification dynamically.
* PVR has to be set to PPC_PSIM (0xfffe) from the device
* file.
*/
get_ppc_cpu_type();
/*
* initialize the device driver parameters
*/
BSP_bus_frequency = (unsigned int)&PSIM_INSTRUCTIONS_PER_MICROSECOND;
bsp_clicks_per_usec = BSP_bus_frequency;
BSP_time_base_divisor = 1;
/*
* The simulator likes the exception table to be at 0xfff00000.
*/
bsp_exceptions_in_RAM = FALSE;
/*
* Initialize default raw exception handlers.
*/
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) bsp_section_work_begin,
rtems_configuration_get_interrupt_stack_size()
);
/*
* Initalize RTEMS IRQ system
*/
BSP_rtems_irq_mng_init(0);
mmu_irq_init();
/*
* Setup BATs and enable MMU
*/
/* Memory */
setdbat(0, 0x0<<24, 0x0<<24, 2<<24, _PAGE_RW);
setibat(0, 0x0<<24, 0x0<<24, 2<<24, 0);
/* PCI */
setdbat(1, 0x8<<24, 0x8<<24, 1<<24, IO_PAGE);
setdbat(2, 0xc<<24, 0xc<<24, 1<<24, IO_PAGE);
/* Invalidate all TLB Entries */
asm volatile("sync; isync; tlbia; sync; isync");
_write_MSR(_read_MSR() | MSR_DR | MSR_IR);
__asm__ volatile("sync; isync");
}
|
#ifndef SIMPLETEXTUREDQUAD_PS_H
#define SIMPLETEXTUREDQUAD_PS_H
static const unsigned char SimpleTexturedQuad_ps[] = {
0x44, 0x58, 0x42, 0x43, 0x6f, 0xe9, 0x29, 0xf5, 0x0b, 0xd6, 0xf6, 0xfd,
0x54, 0x41, 0x88, 0xc6, 0xe9, 0xa0, 0xae, 0xf4, 0x01, 0x00, 0x00, 0x00,
0x44, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x54, 0x01, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00,
0xc8, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x18, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00,
0xe4, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x8a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x53, 0x61,
0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x73, 0x00, 0xab,
0x92, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52,
0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65,
0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39,
0x2e, 0x33, 0x30, 0x2e, 0x39, 0x32, 0x30, 0x30, 0x2e, 0x32, 0x30, 0x37,
0x38, 0x39, 0x00, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x43, 0x4f, 0x4c, 0x4f,
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab,
0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65,
0x74, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xc4, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09,
0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07,
0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#endif
|
//
// Notice Regarding Standards. AMD does not provide a license or sublicense to
// any Intellectual Property Rights relating to any standards, including but not
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
// (collectively, the "Media Technologies"). For clarity, you will pay any
// royalties due for such third party technologies, which may include the Media
// Technologies that are owed as a result of AMD providing the Software to you.
//
// MIT license
//
// Copyright (c) 2018 Advanced Micro Devices, 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.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef AMF_Factory_h
#define AMF_Factory_h
#pragma once
#include "Platform.h"
#include "Version.h"
#include "Result.h"
#include "Context.h"
#include "Debug.h"
#include "Trace.h"
#include "Compute.h"
#include "../components/Component.h"
#if defined(__cplusplus)
namespace amf
{
#endif
//----------------------------------------------------------------------------------------------
// AMFFactory interface - singleton
//----------------------------------------------------------------------------------------------
#if defined(__cplusplus)
class AMF_NO_VTABLE AMFFactory
{
public:
virtual AMF_RESULT AMF_STD_CALL CreateContext(AMFContext** ppContext) = 0;
virtual AMF_RESULT AMF_STD_CALL CreateComponent(AMFContext* pContext, const wchar_t* id, AMFComponent** ppComponent) = 0;
virtual AMF_RESULT AMF_STD_CALL SetCacheFolder(const wchar_t* path) = 0;
virtual const wchar_t* AMF_STD_CALL GetCacheFolder() = 0;
virtual AMF_RESULT AMF_STD_CALL GetDebug(AMFDebug** ppDebug) = 0;
virtual AMF_RESULT AMF_STD_CALL GetTrace(AMFTrace** ppTrace) = 0;
virtual AMF_RESULT AMF_STD_CALL GetPrograms(AMFPrograms** ppPrograms) = 0;
};
#else
typedef struct AMFFactory AMFFactory;
typedef struct AMFFactoryVtbl
{
AMF_RESULT (AMF_STD_CALL *CreateContext)(AMFFactory* pThis, AMFContext** ppContext);
AMF_RESULT (AMF_STD_CALL *CreateComponent)(AMFFactory* pThis, AMFContext* pContext, const wchar_t* id, AMFComponent** ppComponent);
AMF_RESULT (AMF_STD_CALL *SetCacheFolder)(AMFFactory* pThis, const wchar_t* path);
const wchar_t* (AMF_STD_CALL *GetCacheFolder)(AMFFactory* pThis);
AMF_RESULT (AMF_STD_CALL *GetDebug)(AMFFactory* pThis, AMFDebug** ppDebug);
AMF_RESULT (AMF_STD_CALL *GetTrace)(AMFFactory* pThis, AMFTrace** ppTrace);
AMF_RESULT (AMF_STD_CALL *GetPrograms)(AMFFactory* pThis, AMFPrograms** ppPrograms);
} AMFFactoryVtbl;
struct AMFFactory
{
const AMFFactoryVtbl *pVtbl;
};
#endif
#if defined(__cplusplus)
}
#endif
//----------------------------------------------------------------------------------------------
// DLL entry points
//----------------------------------------------------------------------------------------------
#define AMF_INIT_FUNCTION_NAME "AMFInit"
#define AMF_QUERY_VERSION_FUNCTION_NAME "AMFQueryVersion"
#if defined(__cplusplus)
extern "C"
{
typedef AMF_RESULT (AMF_CDECL_CALL *AMFInit_Fn)(amf_uint64 version, amf::AMFFactory **ppFactory);
typedef AMF_RESULT (AMF_CDECL_CALL *AMFQueryVersion_Fn)(amf_uint64 *pVersion);
}
#else
typedef AMF_RESULT (AMF_CDECL_CALL *AMFInit_Fn)(amf_uint64 version, AMFFactory **ppFactory);
typedef AMF_RESULT (AMF_CDECL_CALL *AMFQueryVersion_Fn)(amf_uint64 *pVersion);
#endif
#if defined(_WIN32)
#if defined(_M_AMD64)
#define AMF_DLL_NAME L"amfrt64.dll"
#define AMF_DLL_NAMEA "amfrt64.dll"
#else
#define AMF_DLL_NAME L"amfrt32.dll"
#define AMF_DLL_NAMEA "amfrt32.dll"
#endif
#elif defined(__linux__)
#if defined(__x86_64__)
#define AMF_DLL_NAME L"libamfrt64.so.1"
#define AMF_DLL_NAMEA "libamfrt64.so.1"
#else
#define AMF_DLL_NAME L"libamfrt32.so.1"
#define AMF_DLL_NAMEA "libamfrt32.so.1"
#endif
#endif
//----------------------------------------------------------------------------------------------
#endif // AMF_Factory_h |
/************************************************************************
* IRC - Internet Relay Chat, events.c
* (C) 2001 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* 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 1, 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.
*/
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include "version.h"
#include "proto.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#include "modules.h"
ID_Copyright("(C) Carsten Munk 2001");
MODVAR Event *events = NULL;
extern EVENT(unrealdns_removeoldrecords);
void LockEventSystem(void)
{
}
void UnlockEventSystem(void)
{
}
Event *EventAddEx(Module *module, char *name, long every, long howmany,
vFP event, void *data)
{
Event *newevent;
if (!name || (every < 0) || (howmany < 0) || !event)
{
if (module)
module->errorcode = MODERR_INVALID;
return NULL;
}
newevent = (Event *) MyMallocEx(sizeof(Event));
newevent->name = strdup(name);
newevent->howmany = howmany;
newevent->every = every;
newevent->event = event;
newevent->data = data;
/* We don't want a quick execution */
newevent->last = TStime();
newevent->owner = module;
AddListItem(newevent,events);
if (module) {
ModuleObject *eventobj = (ModuleObject *)MyMallocEx(sizeof(ModuleObject));
eventobj->object.event = newevent;
eventobj->type = MOBJ_EVENT;
AddListItem(eventobj, module->objects);
module->errorcode = MODERR_NOERROR;
}
return newevent;
}
Event *EventMarkDel(Event *event)
{
event->howmany = -1;
return event;
}
Event *EventDel(Event *event)
{
Event *p, *q;
for (p = events; p; p = p->next) {
if (p == event) {
q = p->next;
MyFree(p->name);
DelListItem(p, events);
if (p->owner) {
ModuleObject *eventobjs;
for (eventobjs = p->owner->objects; eventobjs; eventobjs = eventobjs->next) {
if (eventobjs->type == MOBJ_EVENT && eventobjs->object.event == p) {
DelListItem(eventobjs, p->owner->objects);
MyFree(eventobjs);
break;
}
}
}
MyFree(p);
return q;
}
}
return NULL;
}
Event *EventFind(char *name)
{
Event *eventptr;
for (eventptr = events; eventptr; eventptr = eventptr->next)
if (!strcmp(eventptr->name, name))
return (eventptr);
return NULL;
}
int EventMod(Event *event, EventInfo *mods) {
if (!event || !mods)
{
if (event && event->owner)
event->owner->errorcode = MODERR_INVALID;
return -1;
}
if (mods->flags & EMOD_EVERY)
event->every = mods->every;
if (mods->flags & EMOD_HOWMANY)
event->howmany = mods->howmany;
if (mods->flags & EMOD_NAME) {
free(event->name);
event->name = strdup(mods->name);
}
if (mods->flags & EMOD_EVENT)
event->event = mods->event;
if (mods->flags & EMOD_DATA)
event->data = mods->data;
if (event->owner)
event->owner->errorcode = MODERR_NOERROR;
return 0;
}
#ifndef _WIN32
inline void DoEvents(void)
#else
void DoEvents(void)
#endif
{
Event *eventptr;
Event temp;
for (eventptr = events; eventptr; eventptr = eventptr->next)
{
if (eventptr->howmany == -1)
goto freeit;
if ((eventptr->every == 0) || ((TStime() - eventptr->last) >= eventptr->every))
{
eventptr->last = TStime();
(*eventptr->event)(eventptr->data);
if (eventptr->howmany > 0)
{
eventptr->howmany--;
if (eventptr->howmany == 0)
{
freeit:
temp.next = EventDel(eventptr);
eventptr = &temp;
continue;
}
}
}
}
}
void EventStatus(aClient *sptr)
{
Event *eventptr;
time_t now = TStime();
if (!events)
{
sendto_one(sptr, ":%s NOTICE %s :*** No events",
me.name, sptr->name);
return;
}
for (eventptr = events; eventptr; eventptr = eventptr->next)
{
sendto_one(sptr, ":%s NOTICE %s :*** Event %s: e/%ld h/%ld n/%ld l/%ld", me.name,
sptr->name, eventptr->name, eventptr->every, eventptr->howmany,
now - eventptr->last, (eventptr->last + eventptr->every) - now);
}
}
void SetupEvents(void)
{
LockEventSystem();
/* Start events */
EventAddEx(NULL, "tunefile", 300, 0, save_tunefile, NULL);
EventAddEx(NULL, "garbage", GARBAGE_COLLECT_EVERY, 0, garbage_collect, NULL);
EventAddEx(NULL, "loop", 0, 0, loop_event, NULL);
EventAddEx(NULL, "unrealdns_removeoldrecords", 15, 0, unrealdns_removeoldrecords, NULL);
EventAddEx(NULL, "check_pings", 1, 0, check_pings, NULL);
EventAddEx(NULL, "check_deadsockets", 1, 0, check_deadsockets, NULL);
EventAddEx(NULL, "check_unknowns", 16, 0, check_unknowns, NULL);
EventAddEx(NULL, "try_connections", 10, 0, try_connections, NULL);
UnlockEventSystem();
}
|
/*
* Singularity-compress: rangecoder decoder
* Copyright (C) 2006-2007 Torok Edwin (edwintorok@gmail.com)
*
* Based on Michael Schindler's rangecoder, which is:
* (c) Michael Schindler 1997, 1998, 1999, 2000
* http://www.compressconsult.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; version 2
* of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef NDEBUG
#define DO_CHEKCS
#endif
#include "rangecod.h"
/* Start the decoder */
/* rc is the range coder to be used */
/* returns the char from start_encoding or EOF */
static inline int start_decoding( rangecoder *rc )
{
int c = inbyte(rc);
if (c==EOF)
return EOF;
rc->buffer = inbyte(rc);
rc->low = rc->buffer >> (8-EXTRA_BITS);
rc->range = (code_value)1 << EXTRA_BITS;
return c;
}
static inline void dec_normalize( rangecoder *rc )
{
while (rc->range <= Bottom_value) {
rc->low = (rc->low<<8) | ((rc->buffer<<EXTRA_BITS)&0xff);
rc->buffer = inbyte(rc);
rc->low |= rc->buffer >> (8-EXTRA_BITS);
rc->range <<= 8;
}
}
/* Calculate culmulative frequency for next symbol. Does NO update!*/
/* rc is the range coder to be used */
/* tot_f is the total frequency */
/* or: totf is (code_value)1<<shift */
/* returns the culmulative frequency */
static inline freq decode_culfreq( rangecoder *rc, freq tot_f )
{
freq tmp;
dec_normalize(rc);
rc->help = rc->range/tot_f;
tmp = rc->low/rc->help;
return (tmp>=tot_f ? tot_f-1 : tmp);
}
static inline freq decode_culshift( rangecoder *rc, freq shift )
{
freq tmp;
dec_normalize(rc);
rc->help = rc->range>>shift;
tmp = rc->low/rc->help;
return (tmp>>shift ? ((code_value)1<<shift)-1 : tmp);
}
/* Update decoding state */
/* rc is the range coder to be used */
/* sy_f is the interval length (frequency of the symbol) */
/* lt_f is the lower end (frequency sum of < symbols) */
/* tot_f is the total interval length (total frequency sum) */
static inline void decode_update( rangecoder *rc, freq sy_f, freq lt_f, freq tot_f)
{
code_value tmp;
tmp = rc->help * lt_f;
rc->low -= tmp;
if (lt_f + sy_f < tot_f)
rc->range = rc->help * sy_f;
else
rc->range -= tmp;
}
#define decode_update_shift(rc,f1,f2,f3) decode_update((rc),(f1),(f2),(freq)1<<(f3));
/* Decode a byte/short without modelling */
/* rc is the range coder to be used */
static inline unsigned char decode_byte(rangecoder *rc)
{
unsigned char tmp = decode_culshift(rc,8);
decode_update( rc,1,tmp,(freq)1<<8);
return tmp;
}
static inline unsigned short decode_short(rangecoder *rc)
{
unsigned short tmp = decode_culshift(rc,16);
decode_update( rc,1,tmp,(freq)1<<16);
return tmp;
}
/* Finish decoding */
/* rc is the range coder to be used */
static inline void done_decoding( rangecoder *rc )
{
dec_normalize(rc); /* normalize to use up all bytes */
}
|
/**
* Navit, a modular navigation system.
* Copyright (C) 2005-2008 Navit Team
*
* 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.
*/
#include <string.h>
#include <stdlib.h>
#include "event.h"
#include "plugin.h"
#include "debug.h"
static struct event_methods event_methods;
static const char *e_requestor;
static const char *e_system;
static int has_quit;
void event_main_loop_run(void)
{
if (! event_methods.main_loop_run)
{
dbg(0,"no event system set\n");
return;
}
event_methods.main_loop_run();
}
void event_main_loop_quit(void)
{
if (event_methods.main_loop_quit)
{
event_methods.main_loop_quit();
}
has_quit=1;
}
int
event_main_loop_has_quit(void)
{
return has_quit;
}
struct event_watch *
event_add_watch(void *fd, enum event_watch_cond cond, struct callback *cb)
{
return event_methods.add_watch(fd, cond, cb);
}
void
event_remove_watch(struct event_watch *ev)
{
event_methods.remove_watch(ev);
}
struct event_timeout *
event_add_timeout(int timeout, int multi, struct callback *cb)
{
return event_methods.add_timeout(timeout, multi, cb);
}
void
event_remove_timeout(struct event_timeout *ev)
{
event_methods.remove_timeout(ev);
}
struct event_idle *
event_add_idle(int priority, struct callback *cb)
{
return event_methods.add_idle(priority,cb);
}
void
event_remove_idle(struct event_idle *ev)
{
event_methods.remove_idle(ev);
}
void
event_call_callback(struct callback_list *cb)
{
event_methods.call_callback(cb);
}
char const *
event_system(void)
{
return e_system;
}
int
event_request_system(const char *system, const char *requestor)
{
void (*event_type_new)(struct event_methods *meth);
if (e_system)
{
if (strcmp(e_system, system))
{
dbg(0,"system '%s' already requested by '%s', can't set to '%s' as requested from '%s'\n", e_system, e_requestor, system, requestor);
return 0;
}
return 1;
}
#ifdef PLUGSSS
event_type_new=plugin_get_event_type(system);
if (! event_type_new)
{
dbg(0,"unsupported event system '%s' requested from '%s'\n", system, requestor);
return 0;
}
event_type_new(&event_methods);
#else
event_android_new(&event_methods);
#endif
e_system=system;
e_requestor=requestor;
return 1;
}
|
/**
* @file history.h MSN history functions
*
* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef MSN_HISTORY_H
#define MSN_HISTORY_H
typedef struct _MsnHistory MsnHistory;
#include "transaction.h"
#define MSN_NS_HIST_ELEMS 0x300
#define MSN_SB_HIST_ELEMS 0x30
/**
* The history.
*/
struct _MsnHistory
{
GQueue *queue;
unsigned int trId;
};
MsnHistory *msn_history_new(void);
void msn_history_destroy(MsnHistory *history);
MsnTransaction *msn_history_find(MsnHistory *history, unsigned int triId);
void msn_history_add(MsnHistory *history, MsnTransaction *trans);
#endif /* MSN_HISTORY_H */
|
/* linux/arch/arm/mach-s3c2416/pm.c
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM 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.
*/
#include <linux/device.h>
#include <linux/syscore_ops.h>
#include <linux/io.h>
#include <asm/cacheflush.h>
#include <mach/regs-s3c2443-clock.h>
#include <plat/cpu.h>
#include <plat/pm.h>
#include "s3c2412-power.h"
extern void s3c2412_sleep_enter(void);
static int s3c2416_cpu_suspend(unsigned long arg)
{
/* enable wakeup sources regardless of battery state */
__raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
/* set the mode as sleep, 2BED represents "Go to BED" */
__raw_writel(0x2BED, S3C2443_PWRMODE);
s3c2412_sleep_enter();
pr_info("Failed to suspend the system\n");
return 1; /* Aborting suspend */
}
static void s3c2416_pm_prepare(void)
{
/*
* write the magic value u-boot uses to check for resume into
* the INFORM0 register, and ensure INFORM1 is set to the
* correct address to resume from.
*/
__raw_writel(0x2BED, S3C2412_INFORM0);
__raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1);
}
static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif)
{
pm_cpu_prep = s3c2416_pm_prepare;
pm_cpu_sleep = s3c2416_cpu_suspend;
return 0;
}
static struct subsys_interface s3c2416_pm_interface = {
.name = "s3c2416_pm",
.subsys = &s3c2416_subsys,
.add_dev = s3c2416_pm_add,
};
static __init int s3c2416_pm_init(void)
{
return subsys_interface_register(&s3c2416_pm_interface);
}
arch_initcall(s3c2416_pm_init);
static void s3c2416_pm_resume(void)
{
/* unset the return-from-sleep amd inform flags */
__raw_writel(0x0, S3C2443_PWRMODE);
__raw_writel(0x0, S3C2412_INFORM0);
__raw_writel(0x0, S3C2412_INFORM1);
}
struct syscore_ops s3c2416_pm_syscore_ops = {
.resume = s3c2416_pm_resume,
};
|
/*****************************************************************************
The following code is derived, directly or indirectly, from the SystemC
source code Copyright (c) 1996-2011 by all Contributors.
All Rights reserved.
The contents of this file are subject to the restrictions and limitations
set forth in the SystemC Open Source License Version 3.0 (the "License");
You may not use this file except in compliance with such restrictions and
limitations. You may obtain instructions on how to receive a copy of the
License at http://www.systemc.org/. Software distributed by Contributors
under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License.
*****************************************************************************/
/*****************************************************************************
sc_cor_qt.h -- Coroutine implementation with QuickThreads.
Original Author: Martin Janssen, Synopsys, Inc., 2001-12-18
CHANGE LOG AT THE END OF THE FILE
*****************************************************************************/
#ifndef SC_COR_QT_H
#define SC_COR_QT_H
#if !defined(WIN32) && !defined(SC_USE_PTHREADS)
#include "sysc/kernel/sc_cor.h"
#include "sysc/qt/qt.h"
namespace sc_core {
class sc_cor_pkg_qt;
// ----------------------------------------------------------------------------
// CLASS : sc_cor_qt
//
// Coroutine class implemented with QuickThreads.
// ----------------------------------------------------------------------------
class sc_cor_qt
: public sc_cor
{
public:
// constructor
sc_cor_qt()
: m_stack_size( 0 ), m_stack( 0 ), m_sp( 0 ), m_pkg( 0 )
{}
// destructor
virtual ~sc_cor_qt()
{ delete[] (char*) m_stack; }
// switch stack protection on/off
virtual void stack_protect( bool enable );
public:
std::size_t m_stack_size; // stack size
void* m_stack; // stack
qt_t* m_sp; // stack pointer
sc_cor_pkg_qt* m_pkg; // the creating coroutine package
private:
// disabled
sc_cor_qt( const sc_cor_qt& );
sc_cor_qt& operator = ( const sc_cor_qt& );
};
// ----------------------------------------------------------------------------
// CLASS : sc_cor_pkg_qt
//
// Coroutine package class implemented with QuickThreads.
// ----------------------------------------------------------------------------
class sc_cor_pkg_qt
: public sc_cor_pkg
{
public:
// constructor
sc_cor_pkg_qt( sc_simcontext* simc );
// destructor
virtual ~sc_cor_pkg_qt();
// create a new coroutine
virtual sc_cor* create( std::size_t stack_size, sc_cor_fn* fn, void* arg );
// yield to the next coroutine
virtual void yield( sc_cor* next_cor );
// abort the current coroutine (and resume the next coroutine)
virtual void abort( sc_cor* next_cor );
// get the main coroutine
virtual sc_cor* get_main();
private:
static int instance_count;
private:
// disabled
sc_cor_pkg_qt();
sc_cor_pkg_qt( const sc_cor_pkg_qt& );
sc_cor_pkg_qt& operator = ( const sc_cor_pkg_qt& );
};
} // namespace sc_core
#endif
// $Log: sc_cor_qt.h,v $
// Revision 1.6 2011/08/29 18:04:32 acg
// Philipp A. Hartmann: miscellaneous clean ups.
//
// Revision 1.5 2011/08/26 20:46:09 acg
// Andy Goodrich: moved the modification log to the end of the file to
// eliminate source line number skew when check-ins are done.
//
// Revision 1.4 2011/02/18 20:27:14 acg
// Andy Goodrich: Updated Copyrights.
//
// Revision 1.3 2011/02/13 21:47:37 acg
// Andy Goodrich: update copyright notice.
//
// Revision 1.2 2008/05/22 17:06:25 acg
// Andy Goodrich: updated copyright notice to include 2008.
//
// Revision 1.1.1.1 2006/12/15 20:20:05 acg
// SystemC 2.3
//
// Revision 1.3 2006/01/13 18:44:29 acg
// Added $Log to record CVS changes into the source.
//
#endif
// Taf!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.