text stringlengths 4 6.14k |
|---|
/*
* RegisterIOSPI.h
*
* Created on: Jul 29, 2015
* Author: Scott
*/
#ifndef SRC_REGISTERIOSPI_H_
#define SRC_REGISTERIOSPI_H_
#include "RegisterIO.h"
#include <WPILib.h>
static const int MAX_SPI_MSG_LENGTH = 256;
class RegisterIO_SPI: public IRegisterIO {
public:
RegisterIO_SPI(SPI *port, uint32_t bitrate);
virtual ~RegisterIO_SPI() {}
bool Init();
bool Write(uint8_t address, uint8_t value );
bool Read(uint8_t first_address, uint8_t* buffer, uint8_t buffer_len);
bool Shutdown();
private:
SPI *port;
uint32_t bitrate;
uint8_t rx_buffer[MAX_SPI_MSG_LENGTH];
};
#endif /* SRC_REGISTERIOSPI_H_ */
|
/* glpios12.c (node selection heuristics) */
/***********************************************************************
* This code is part of GLPK (GNU Linear Programming Kit).
*
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied
* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights
* reserved. E-mail: <mao@gnu.org>.
*
* GLPK is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GLPK 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 GLPK. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/
#include "glpios.h"
/***********************************************************************
* NAME
*
* ios_choose_node - select subproblem to continue the search
*
* SYNOPSIS
*
* #include "glpios.h"
* int ios_choose_node(glp_tree *T);
*
* DESCRIPTION
*
* The routine ios_choose_node selects a subproblem from the active
* list to continue the search. The choice depends on the backtracking
* technique option.
*
* RETURNS
*
* The routine ios_choose_node return the reference number of the
* subproblem selected. */
static int most_feas(glp_tree *T);
static int best_proj(glp_tree *T);
static int best_node(glp_tree *T);
int ios_choose_node(glp_tree *T)
{ int p;
if (T->parm->bt_tech == GLP_BT_DFS)
{ /* depth first search */
xassert(T->tail != NULL);
p = T->tail->p;
}
else if (T->parm->bt_tech == GLP_BT_BFS)
{ /* breadth first search */
xassert(T->head != NULL);
p = T->head->p;
}
else if (T->parm->bt_tech == GLP_BT_BLB)
{ /* select node with best local bound */
p = best_node(T);
}
else if (T->parm->bt_tech == GLP_BT_BPH)
{ if (T->mip->mip_stat == GLP_UNDEF)
{ /* "most integer feasible" subproblem */
p = most_feas(T);
}
else
{ /* best projection heuristic */
p = best_proj(T);
}
}
else
xassert(T != T);
return p;
}
static int most_feas(glp_tree *T)
{ /* select subproblem whose parent has minimal sum of integer
infeasibilities */
IOSNPD *node;
int p;
double best;
p = 0, best = DBL_MAX;
for (node = T->head; node != NULL; node = node->next)
{ xassert(node->up != NULL);
if (best > node->up->ii_sum)
p = node->p, best = node->up->ii_sum;
}
return p;
}
static int best_proj(glp_tree *T)
{ /* select subproblem using the best projection heuristic */
IOSNPD *root, *node;
int p;
double best, deg, obj;
/* the global bound must exist */
xassert(T->mip->mip_stat == GLP_FEAS);
/* obtain pointer to the root node, which must exist */
root = T->slot[1].node;
xassert(root != NULL);
/* deg estimates degradation of the objective function per unit
of the sum of integer infeasibilities */
xassert(root->ii_sum > 0.0);
deg = (T->mip->mip_obj - root->bound) / root->ii_sum;
/* nothing has been selected so far */
p = 0, best = DBL_MAX;
/* walk through the list of active subproblems */
for (node = T->head; node != NULL; node = node->next)
{ xassert(node->up != NULL);
/* obj estimates optimal objective value if the sum of integer
infeasibilities were zero */
obj = node->up->bound + deg * node->up->ii_sum;
if (T->mip->dir == GLP_MAX) obj = - obj;
/* select the subproblem which has the best estimated optimal
objective value */
if (best > obj) p = node->p, best = obj;
}
return p;
}
static int best_node(glp_tree *T)
{ /* select subproblem with best local bound */
IOSNPD *node, *best = NULL;
double bound, eps;
switch (T->mip->dir)
{ case GLP_MIN:
bound = +DBL_MAX;
for (node = T->head; node != NULL; node = node->next)
if (bound > node->bound) bound = node->bound;
xassert(bound != +DBL_MAX);
eps = 0.001 * (1.0 + fabs(bound));
for (node = T->head; node != NULL; node = node->next)
{ if (node->bound <= bound + eps)
{ xassert(node->up != NULL);
if (best == NULL ||
#if 1
best->up->ii_sum > node->up->ii_sum) best = node;
#else
best->lp_obj > node->lp_obj) best = node;
#endif
}
}
break;
case GLP_MAX:
bound = -DBL_MAX;
for (node = T->head; node != NULL; node = node->next)
if (bound < node->bound) bound = node->bound;
xassert(bound != -DBL_MAX);
eps = 0.001 * (1.0 + fabs(bound));
for (node = T->head; node != NULL; node = node->next)
{ if (node->bound >= bound - eps)
{ xassert(node->up != NULL);
if (best == NULL ||
#if 1
best->up->ii_sum > node->up->ii_sum) best = node;
#else
best->lp_obj < node->lp_obj) best = node;
#endif
}
}
break;
default:
xassert(T != T);
}
xassert(best != NULL);
return best->p;
}
/* eof */
|
/**
* The Forgotten Server - a free and open-source MMORPG server emulator
* Copyright (C) 2016 Mark Samman <mark.samman@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef __PROTOCOL_800__
#ifndef FS_OUTFIT_H_C56E7A707E3F422C8C93D9BE09916AA3
#define FS_OUTFIT_H_C56E7A707E3F422C8C93D9BE09916AA3
#include "enums.h"
struct Outfit {
Outfit(std::string name, uint16_t lookType, bool premium, bool unlocked) : name(name), lookType(lookType), premium(premium), unlocked(unlocked) {}
std::string name;
uint16_t lookType;
bool premium;
bool unlocked;
};
struct ProtocolOutfit {
#ifdef __PROTOCOL_800__
ProtocolOutfit(const std::string* name, uint16_t lookType, uint8_t addons) : name(name), lookType(lookType), addons(addons) {}
#else
ProtocolOutfit(const std::string* name, uint16_t lookType) : name(name), lookType(lookType) {}
#endif
const std::string* name;
uint16_t lookType;
#ifdef __PROTOCOL_800__
uint8_t addons;
#endif
};
class Outfits
{
public:
static Outfits* getInstance() {
static Outfits instance;
return &instance;
}
bool loadFromXml();
const Outfit* getOutfitByLookType(PlayerSex_t sex, uint16_t lookType) const;
const std::vector<Outfit>& getOutfits(PlayerSex_t sex) const {
return outfits[sex];
}
private:
std::vector<Outfit> outfits[PLAYERSEX_LAST + 1];
};
#endif
#endif |
/*
* AJ-HPM100/110 header
*/
#ifndef _MACH_XXXX_H
#define _MACH_XXXX_H
static inline int hwif_pci_to_id(struct pci_dev *pci)
{
int devfn;
if(pci == NULL){
PALERT("null pointer");
return -EFAULT;
}
devfn = pci->bus->self->devfn;
switch(devfn){
case 16:
return 0;
case 17:
return 1;
case 24:
return 2;
case 25:
return 3;
case 32:
return 4;
case 33:
return 5;
}
PERROR("unknown device");
return -EINVAL;
}
#if defined(CONFIG_ZION)
extern int ZION_pci_cache_clear(void);
static inline void hwif_adjust_pci(spd_dev_t *dev, int io_dir, int target)
{
if(io_dir == SPD_DIR_WRITE){
spd_out8(dev, SPD_REG_BURST_LENGTH, 0x20);
ZION_pci_cache_clear();
} else {
if(target == SPD_TARGET_ZION){
spd_out8(dev, SPD_REG_BURST_LENGTH, 0x20);
} else {
spd_out8(dev, SPD_REG_BURST_LENGTH, 0x08);
}
}
}
static inline int hwif_target_of(u32 bus_addr)
{
if((bus_addr&0xf0000000) != 0){
return SPD_TARGET_ZION;
}
return SPD_TARGET_LOCAL;
}
#else /* ! CONFIG_ZION */
static inline void hwif_adjust_pci(spd_dev_t *dev, int io_dir, int target)
{
if(io_dir == SPD_DIR_WRITE){
spd_out8(dev, SPD_REG_BURST_LENGTH, 0x20);
} else {
spd_out8(dev, SPD_REG_BURST_LENGTH, 0x08);
}
}
static inline int hwif_target_of(u32 bus_addr)
{
return SPD_TARGET_LOCAL;
}
#endif /* CONFIG_ZION */
static inline void hwif_adjust_latency_timer(spd_dev_t *dev)
{
}
static inline u32 hwif_get_sys_ru(spd_dev_t *dev)
{
return (SPD_WSIZE_64K);
}
static inline u32 hwif_get_usr_ru(spd_dev_t *dev)
{
return (SPD_WSIZE_4M);
}
#endif /* _MACH_XXXX_H */
|
#import <Foundation/Foundation.h>
#import "SWGObject.h"
/**
* QuantiModo
* QuantiModo makes it easy to retrieve normalized user data from a wide array of devices and applications. [Learn about QuantiModo](https://quantimo.do), check out our [docs](https://github.com/QuantiModo/docs) or contact us at [help.quantimo.do](https://help.quantimo.do).
*
* OpenAPI spec version: 2.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "SWGVariableNew.h"
@protocol SWGVariablesNew
@end
@interface SWGVariablesNew : NSMutableArray
@end
|
#pragma once
#ifndef __ANDROID__
#include "../qcommon/qcommon.h"
#else
#include "ghoul2_shared.h"
#include "../qcommon/q_shared.h"
#endif
#ifdef _G2_GORE
#define MAX_LODS (8)
struct GoreTextureCoordinates {
float *tex[MAX_LODS];
GoreTextureCoordinates() {
int i;
for (i=0;i<MAX_LODS;i++) {
tex[i]=0;
}
}
~GoreTextureCoordinates() {
int i;
for (i=0;i<MAX_LODS;i++) {
if (tex[i]) {
#ifdef _DEBUG
extern int g_goreTexAllocs;
g_goreTexAllocs--;
#endif
Z_Free(tex[i]);
tex[i] = 0;
}
}
}
};
int AllocGoreRecord();
GoreTextureCoordinates *FindGoreRecord(int tag);
void DeleteGoreRecord(int tag);
struct SGoreSurface
{
int shader;
int mGoreTag;
int mDeleteTime;
int mFadeTime;
bool mFadeRGB;
int mGoreGrowStartTime;
int mGoreGrowEndTime; // set this to -1 to disable growing
//curscale = (curtime-mGoreGrowStartTime)*mGoreGrowFactor + mGoreGrowOffset;
float mGoreGrowFactor;
float mGoreGrowOffset;
};
class CGoreSet
{
public:
int mMyGoreSetTag;
unsigned char mRefCount;
multimap<int,SGoreSurface> mGoreRecords; // a map from surface index
CGoreSet(int tag) : mMyGoreSetTag(tag), mRefCount(0) {}
~CGoreSet();
};
CGoreSet *FindGoreSet(int goreSetTag);
CGoreSet *NewGoreSet();
void DeleteGoreSet(int goreSetTag);
#endif // _G2_GORE
//rww - RAGDOLL_BEGIN
/// ragdoll stuff
#ifdef _MSC_VER
#pragma warning(disable: 4512)
#endif
struct SRagDollEffectorCollision
{
vec3_t effectorPosition;
const trace_t &tr;
bool useTracePlane;
SRagDollEffectorCollision(const vec3_t effectorPos,const trace_t &t) :
tr(t),
useTracePlane(false)
{
VectorCopy(effectorPos,effectorPosition);
}
};
class CRagDollUpdateParams
{
public:
vec3_t angles;
vec3_t position;
vec3_t scale;
vec3_t velocity;
//CServerEntity *me;
int me; //index!
int settleFrame;
//at some point I'll want to make VM callbacks in here. For now I am just doing nothing.
virtual void EffectorCollision(const SRagDollEffectorCollision &data)
{
// assert(0); // you probably meant to override this
}
virtual void RagDollBegin()
{
// assert(0); // you probably meant to override this
}
virtual void RagDollSettled()
{
// assert(0); // you probably meant to override this
}
virtual void Collision()
{
// assert(0); // you probably meant to override this
// we had a collision, uhh I guess call SetRagDoll RP_DEATH_COLLISION
}
#ifdef _DEBUG
virtual void DebugLine(const vec3_t p1,const vec3_t p2,bool bbox) {assert(0);}
#endif
};
class CRagDollParams
{
public:
enum ERagPhase
{
RP_START_DEATH_ANIM,
RP_END_DEATH_ANIM,
RP_DEATH_COLLISION,
RP_CORPSE_SHOT,
RP_GET_PELVIS_OFFSET, // this actually does nothing but set the pelvisAnglesOffset, and pelvisPositionOffset
RP_SET_PELVIS_OFFSET, // this actually does nothing but set the pelvisAnglesOffset, and pelvisPositionOffset
RP_DISABLE_EFFECTORS // this removes effectors given by the effectorsToTurnOff member
};
vec3_t angles;
vec3_t position;
vec3_t scale;
vec3_t pelvisAnglesOffset; // always set on return, an argument for RP_SET_PELVIS_OFFSET
vec3_t pelvisPositionOffset; // always set on return, an argument for RP_SET_PELVIS_OFFSET
float fImpactStrength; //should be applicable when RagPhase is RP_DEATH_COLLISION
float fShotStrength; //should be applicable for setting velocity of corpse on shot (probably only on RP_CORPSE_SHOT)
//CServerEntity *me;
int me;
//rww - we have convenient animation/frame access in the game, so just send this info over from there.
int startFrame;
int endFrame;
int collisionType; // 1 = from a fall, 0 from effectors, this will be going away soon, hence no enum
qboolean CallRagDollBegin; // a return value, means that we are now begininng ragdoll and the NPC stuff needs to happen
ERagPhase RagPhase;
// effector control, used for RP_DISABLE_EFFECTORS call
enum ERagEffector
{
RE_MODEL_ROOT= 0x00000001, //"model_root"
RE_PELVIS= 0x00000002, //"pelvis"
RE_LOWER_LUMBAR= 0x00000004, //"lower_lumbar"
RE_UPPER_LUMBAR= 0x00000008, //"upper_lumbar"
RE_THORACIC= 0x00000010, //"thoracic"
RE_CRANIUM= 0x00000020, //"cranium"
RE_RHUMEROUS= 0x00000040, //"rhumerus"
RE_LHUMEROUS= 0x00000080, //"lhumerus"
RE_RRADIUS= 0x00000100, //"rradius"
RE_LRADIUS= 0x00000200, //"lradius"
RE_RFEMURYZ= 0x00000400, //"rfemurYZ"
RE_LFEMURYZ= 0x00000800, //"lfemurYZ"
RE_RTIBIA= 0x00001000, //"rtibia"
RE_LTIBIA= 0x00002000, //"ltibia"
RE_RHAND= 0x00004000, //"rhand"
RE_LHAND= 0x00008000, //"lhand"
RE_RTARSAL= 0x00010000, //"rtarsal"
RE_LTARSAL= 0x00020000, //"ltarsal"
RE_RTALUS= 0x00040000, //"rtalus"
RE_LTALUS= 0x00080000, //"ltalus"
RE_RRADIUSX= 0x00100000, //"rradiusX"
RE_LRADIUSX= 0x00200000, //"lradiusX"
RE_RFEMURX= 0x00400000, //"rfemurX"
RE_LFEMURX= 0x00800000, //"lfemurX"
RE_CEYEBROW= 0x01000000 //"ceyebrow"
};
ERagEffector effectorsToTurnOff; // set this to an | of the above flags for a RP_DISABLE_EFFECTORS
};
//rww - RAGDOLL_END
|
/*
* %kadu copyright begin%
* Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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/>.
*/
#pragma once
#include "exports.h"
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QTimer>
#include <QtGui/QIcon>
#include <injeqt/injeqt.h>
class Chat;
class ChatTypeManager;
class ChatWidget;
class ContactDataExtractor;
class IconsManager;
enum class ChatWidgetTitleComposingStatePosition;
class KADUAPI ChatWidgetTitle : public QObject
{
Q_OBJECT
public:
explicit ChatWidgetTitle(ChatWidget *parent = nullptr);
virtual ~ChatWidgetTitle();
ChatWidget *chatWidget() const;
QString title() const;
QString shortTitle() const;
QString fullTitle() const;
QString blinkingFullTitle() const;
QString tooltip() const;
QIcon icon() const;
QIcon blinkingIcon() const;
void setComposingStatePosition(ChatWidgetTitleComposingStatePosition composingStatePosition);
void setShowUnreadMessagesCount(bool showUnreadMessagesCount);
void setBlinkTitleWhenUnreadMessages(bool blinkTitleWhenUnreadMessages);
void setBlinkIconWhenUnreadMessages(bool blinkIconWhenUnreadMessages);
signals:
void titleChanged(ChatWidget *chatWidget);
private:
QPointer<ChatTypeManager> m_chatTypeManager;
QPointer<ContactDataExtractor> m_contactDataExtractor;
QPointer<IconsManager> m_iconsManager;
QString m_title;
QString m_fullTitle;
QString m_tooltip;
QIcon m_icon;
ChatWidgetTitleComposingStatePosition m_composingStatePosition;
bool m_showUnreadMessagesCount;
bool m_blinkTitleWhenUnreadMessages;
bool m_blinkIconWhenUnreadMessages;
bool m_blink;
QPointer<QTimer> m_blinkTimer;
QString chatTitle(const Chat &chat) const;
QString withDescription(const Chat &chat, const QString &title) const;
QString withCompositionInfo(const QString &title) const;
QString withUnreadMessagesCount(QString title) const;
QString cleanUp(QString title) const;
QIcon chatIcon(const Chat &chat) const;
private slots:
INJEQT_SET void setChatTypeManager(ChatTypeManager *chatTypeManager);
INJEQT_SET void setContactDataExtractor(ContactDataExtractor *contactDataExtractor);
INJEQT_SET void setIconsManager(IconsManager *iconsManager);
void startBlinking();
void stopBlinking();
void blink();
void update();
};
|
/******************************************************************************
*
*
*
*
* Copyright (C) 1997-2008 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef _REFLIST_H
#define _REFLIST_H
#include "qtbc.h"
#include <qintdict.h>
//#include "outputgen.h"
/*! This struct represents an item in the list of references. */
struct RefItem
{
RefItem() : written(FALSE) {}
QCString text; //!< text of the item.
QCString listAnchor; //!< anchor in the list
bool written;
};
/*! @brief List of cross-referenced items
*
* This class represents a list of items that are put
* at a certain point in the documentation by some special command
* and are collected in a list. The items cross-reference the
* documentation and the list.
*
* Examples are the todo list, the test list and the bug list,
* introduced by the \\todo, \\test, and \\bug commands respectively.
*/
class RefList
{
public:
int addRefItem();
RefItem *getRefItem(int todoItemId);
RefItem *getFirstRefItem();
RefItem *getNextRefItem();
QCString listName() const;
QCString pageTitle() const;
QCString sectionTitle() const;
RefList(const char *listName,
const char *pageTitle,const char *secTitle
);
~RefList();
private:
int m_id;
QCString m_listName;
QCString m_pageTitle;
QCString m_secTitle;
QIntDict<RefItem> *m_dict;
QIntDictIterator<RefItem> *m_dictIterator;
};
#endif
|
#ifndef FILEZILLA_INTERFACE_CONTEXT_CONTROL_HEADER
#define FILEZILLA_INTERFACE_CONTEXT_CONTROL_HEADER
#include <wx/aui/auibook.h>
#include "state.h"
#include <memory>
class wxAuiNotebookEx;
class CLocalListView;
class CLocalTreeView;
class CMainFrame;
class CRemoteListView;
class CRemoteTreeView;
class CView;
class CViewHeader;
class CSplitterWindowEx;
class CState;
class CContextControl final : public wxSplitterWindow, public CGlobalStateEventHandler
{
public:
struct _context_controls
{
bool used() const { return pViewSplitter != 0; }
// List of all windows and controls assorted with a context
CView* pLocalTreeViewPanel{};
CView* pLocalListViewPanel{};
CLocalTreeView* pLocalTreeView{};
CLocalListView* pLocalListView{};
CView* pRemoteTreeViewPanel{};
CView* pRemoteListViewPanel{};
CRemoteTreeView* pRemoteTreeView{};
CRemoteListView* pRemoteListView{};
CViewHeader* pLocalViewHeader{};
CViewHeader* pRemoteViewHeader{};
CSplitterWindowEx* pViewSplitter{}; // Contains local and remote splitters
CSplitterWindowEx* pLocalSplitter{};
CSplitterWindowEx* pRemoteSplitter{};
CState* pState{};
};
CContextControl(CMainFrame& mainFrame);
virtual ~CContextControl();
void Create(wxWindow* parent);
void CreateTab();
bool CloseTab(int tab);
_context_controls* GetCurrentControls();
_context_controls* GetControlsFromState(CState* pState);
int GetCurrentTab() const;
int GetTabCount() const;
_context_controls* GetControlsFromTabIndex(int i);
bool SelectTab(int i);
void AdvanceTab(bool forward);
protected:
void CreateContextControls(CState& state);
std::vector<_context_controls> m_context_controls;
int m_current_context_controls{-1};
wxAuiNotebookEx* m_tabs{};
int m_right_clicked_tab{-1};
CMainFrame& m_mainFrame;
protected:
DECLARE_EVENT_TABLE()
void OnTabRefresh(wxCommandEvent&);
void OnTabChanged(wxAuiNotebookEvent& event);
void OnTabClosing(wxAuiNotebookEvent& event);
void OnTabClosing_Deferred(wxCommandEvent& event);
void OnTabBgDoubleclick(wxAuiNotebookEvent&);
void OnTabRightclick(wxAuiNotebookEvent& event);
void OnTabContextClose(wxCommandEvent& event);
void OnTabContextCloseOthers(wxCommandEvent& event);
void OnTabContextNew(wxCommandEvent&);
virtual void OnStateChange(CState* pState, t_statechange_notifications notification, const wxString&, const void*);
};
#endif
|
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
void ScanResults::init()
{
wpagui = NULL;
}
void ScanResults::destroy()
{
delete timer;
}
void ScanResults::setWpaGui(WpaGui *_wpagui)
{
wpagui = _wpagui;
updateResults();
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(getResults()));
timer->start(10000, FALSE);
}
void ScanResults::updateResults()
{
char reply[8192];
size_t reply_len;
if (wpagui == NULL)
return;
reply_len = sizeof(reply) - 1;
if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
return;
reply[reply_len] = '\0';
scanResultsView->clear();
QString res(reply);
QStringList lines = QStringList::split(QChar('\n'), res);
bool first = true;
for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
if (first) {
first = false;
continue;
}
QStringList cols = QStringList::split(QChar('\t'), *it, true);
QString ssid, bssid, freq, signal, flags;
bssid = cols.count() > 0 ? cols[0] : "";
freq = cols.count() > 1 ? cols[1] : "";
signal = cols.count() > 2 ? cols[2] : "";
flags = cols.count() > 3 ? cols[3] : "";
ssid = cols.count() > 4 ? cols[4] : "";
new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal, flags);
}
}
void ScanResults::scanRequest()
{
char reply[10];
size_t reply_len = sizeof(reply);
if (wpagui == NULL)
return;
wpagui->ctrlRequest("SCAN", reply, &reply_len);
}
void ScanResults::getResults()
{
updateResults();
}
void ScanResults::bssSelected( Q3ListViewItem * sel )
{
NetworkConfig *nc = new NetworkConfig();
if (nc == NULL)
return;
nc->setWpaGui(wpagui);
nc->paramsFromScanResults(sel);
nc->show();
nc->exec();
}
|
/* timer.c
*
* This file manages the interval timer on the PowerPC MPC5xx.
* NOTE: This is not the PIT, but rather the RTEMS interval
* timer
* We shall use the bottom 32 bits of the timebase register,
*
* The following was in the 403 version of this file. I don't
* know what it means. JTM 5/19/98
* NOTE: It is important that the timer start/stop overhead be
* determined when porting or modifying this code.
*
*
* MPC5xx port sponsored by Defence Research and Development Canada - Suffield
* Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
*
* Derived from c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c:
*
* Author: Jay Monkman (jmonkman@frasca.com)
* Copywright (C) 1998 by Frasca International, Inc.
*
* Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
*
* Author: Andrew Bray <andy@i-cubed.co.uk>
*
* COPYRIGHT (c) 1995 by i-cubed ltd.
*
* To anyone who acknowledges that this file is provided "AS IS"
* without any express or implied warranty:
* permission to use, copy, modify, and distribute this file
* for any purpose is hereby granted without fee, provided that
* the above copyright notice and this notice appears in all
* copies, and that the name of i-cubed limited not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* i-cubed limited makes no representations about the suitability
* of this software for any purpose.
*
* Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
*
* COPYRIGHT (c) 1989-2007.
* 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$
*/
#include <rtems.h>
#include <mpc5xx.h>
static volatile uint32_t Timer_starting;
static bool benchmark_timer_find_average_overhead;
extern uint32_t bsp_timer_least_valid;
extern uint32_t bsp_timer_average_overhead;
/*
* This is so small that this code will be reproduced where needed.
*/
static inline uint32_t get_itimer(void)
{
uint32_t ret;
asm volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
return ret;
}
void benchmark_timer_initialize(void)
{
/* set interrupt level and enable timebase. This should never */
/* generate an interrupt however. */
usiu.tbscrk = USIU_UNLOCK_KEY;
usiu.tbscr |= USIU_TBSCR_TBIRQ(4) /* interrupt priority level */
| USIU_TBSCR_TBF /* freeze timebase during debug */
| USIU_TBSCR_TBE; /* enable timebase */
usiu.tbscrk = 0;
Timer_starting = get_itimer();
}
int benchmark_timer_read(void)
{
uint32_t clicks;
uint32_t total;
clicks = get_itimer();
total = clicks - Timer_starting;
if ( benchmark_timer_find_average_overhead == 1 )
return total; /* in XXX microsecond units */
else {
if ( total < bsp_timer_least_valid ) {
return 0; /* below timer resolution */
}
return (total - bsp_timer_average_overhead);
}
}
void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
{
benchmark_timer_find_average_overhead = find_flag;
}
|
/*
* GPL HEADER START
*
* 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
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2011, 2014, Intel Corporation.
*
* Copyright 2015 Cray Inc, all rights reserved.
* Author: Ben Evans.
*
* Define lu_seq_range associated functions
*/
#ifndef _SEQ_RANGE_H_
#define _SEQ_RANGE_H_
#include <lustre/lustre_idl.h>
/**
* computes the sequence range type \a range
*/
static inline unsigned fld_range_type(const struct lu_seq_range *range)
{
return range->lsr_flags & LU_SEQ_RANGE_MASK;
}
/**
* Is this sequence range an OST? \a range
*/
static inline bool fld_range_is_ost(const struct lu_seq_range *range)
{
return fld_range_type(range) == LU_SEQ_RANGE_OST;
}
/**
* Is this sequence range an MDT? \a range
*/
static inline bool fld_range_is_mdt(const struct lu_seq_range *range)
{
return fld_range_type(range) == LU_SEQ_RANGE_MDT;
}
/**
* ANY range is only used when the fld client sends a fld query request,
* but it does not know whether the seq is an MDT or OST, so it will send the
* request with ANY type, which means any seq type from the lookup can be
* expected. /a range
*/
static inline unsigned fld_range_is_any(const struct lu_seq_range *range)
{
return fld_range_type(range) == LU_SEQ_RANGE_ANY;
}
/**
* Apply flags to range \a range \a flags
*/
static inline void fld_range_set_type(struct lu_seq_range *range,
unsigned flags)
{
range->lsr_flags |= flags;
}
/**
* Add MDT to range type \a range
*/
static inline void fld_range_set_mdt(struct lu_seq_range *range)
{
fld_range_set_type(range, LU_SEQ_RANGE_MDT);
}
/**
* Add OST to range type \a range
*/
static inline void fld_range_set_ost(struct lu_seq_range *range)
{
fld_range_set_type(range, LU_SEQ_RANGE_OST);
}
/**
* Add ANY to range type \a range
*/
static inline void fld_range_set_any(struct lu_seq_range *range)
{
fld_range_set_type(range, LU_SEQ_RANGE_ANY);
}
/**
* computes width of given sequence range \a range
*/
static inline __u64 lu_seq_range_space(const struct lu_seq_range *range)
{
return range->lsr_end - range->lsr_start;
}
/**
* initialize range to zero \a range
*/
static inline void lu_seq_range_init(struct lu_seq_range *range)
{
memset(range, 0, sizeof(*range));
}
/**
* check if given seq id \a s is within given range \a range
*/
static inline bool lu_seq_range_within(const struct lu_seq_range *range,
__u64 seq)
{
return seq >= range->lsr_start && seq < range->lsr_end;
}
/**
* Is the range sane? Is the end after the beginning? \a range
*/
static inline bool lu_seq_range_is_sane(const struct lu_seq_range *range)
{
return range->lsr_end >= range->lsr_start;
}
/**
* Is the range 0? \a range
*/
static inline bool lu_seq_range_is_zero(const struct lu_seq_range *range)
{
return range->lsr_start == 0 && range->lsr_end == 0;
}
/**
* Is the range out of space? \a range
*/
static inline bool lu_seq_range_is_exhausted(const struct lu_seq_range *range)
{
return lu_seq_range_space(range) == 0;
}
/**
* return 0 if two ranges have the same location, nonzero if they are
* different \a r1 \a r2
*/
static inline int lu_seq_range_compare_loc(const struct lu_seq_range *r1,
const struct lu_seq_range *r2)
{
return r1->lsr_index != r2->lsr_index ||
r1->lsr_flags != r2->lsr_flags;
}
#if !defined(__REQ_LAYOUT_USER__)
/**
* byte swap range structure \a range
*/
void lustre_swab_lu_seq_range(struct lu_seq_range *range);
#endif
/**
* printf string and argument list for sequence range
*/
#define DRANGE "[%#16.16llx-%#16.16llx]:%x:%s"
#define PRANGE(range) \
(unsigned long long)(range)->lsr_start, \
(unsigned long long)(range)->lsr_end, \
(range)->lsr_index, \
fld_range_is_mdt(range) ? "mdt" : "ost"
#endif
|
#ifndef __UNICAM_HW_H__
#define __UNICAM_HW_H__
#ifndef UNI_NO_EXT
#include "unicam_hm8131.h"
#include "unicam_hm2056.h"
#include "unicam_m1040.h"
#include "unicam_ar0543.h"
#include "unicam_hm2051.h"
#include "unicam_ov8865.h"
#include "unicam_gc2355.h"
#include "unicam_ov5648.h"
#include "unicam_hm5040.h"
#include "unicam_gc0310.h"
enum SENSOR_CAM_TYPE {
sensor_ppr_cam_type,
sensor_spr_cam_type,
};
//#define SENSOR_PPR_CAM "unicam"
#define SENSOR_PPR_CAM "ppr_cam"
#define SENSOR_SPR_CAM "spr_cam"
static struct match_data m_data[]={
// {"ar0543",&ar0543_unidev},//aptina ar0543 5M
// {"hm8131",&hm8131_unidev},//himax hm8131 8M
// {"ov8865",&ov8865_unidev},//ov8865 8M
{"ov5648",&ov5648_unidev},//ov ov5648 5M
// {"hm5040",&hm5040_unidev},//himax hm5040 5M
{},
};
static struct match_data m_data_front[]={
// {"m1040",&m1040_unidev},//aptina m1040 1.2M
// {"hm2051",&hm2051_unidev},//himax hm2056 2M
{"gc2355",&gc2355_unidev},//galaxycore gc2355 2M
// {"gc0310",&gc0310_unidev},//galaxycore gc2355 2M
{},
};
const struct i2c_device_id uni_id_ppr_cam[] = {
{"ppr_cam", sensor_ppr_cam_type},
{"spr_cam", sensor_spr_cam_type},
{}
};
#endif
#endif
|
#ifndef _LINUX_MSG_H
#define _LINUX_MSG_H
#include <linux/ipc.h>
/* ipcs ctl commands */
#define MSG_STAT 11
#define MSG_INFO 12
/* msgrcv options */
#define MSG_NOERROR 010000 /* no error if message is too big */
#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
/* Obsolete, used only for backwards compatibility and libc5 compiles */
struct msqid_ds {
struct ipc_perm msg_perm;
struct msg *msg_first; /* first message on queue,unused */
struct msg *msg_last; /* last message in queue,unused */
__kernel_time_t msg_stime; /* last msgsnd time */
__kernel_time_t msg_rtime; /* last msgrcv time */
__kernel_time_t msg_ctime; /* last change time */
unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
unsigned long msg_lqbytes; /* ditto */
unsigned short msg_cbytes; /* current number of bytes on queue */
unsigned short msg_qnum; /* number of messages in queue */
unsigned short msg_qbytes; /* max number of bytes on queue */
__kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
__kernel_ipc_pid_t msg_lrpid; /* last receive pid */
};
/* Include the definition of msqid64_ds */
#include <asm/msgbuf.h>
/* message buffer for msgsnd and msgrcv calls */
struct msgbuf {
long mtype; /* type of message */
char mtext[1]; /* message text */
};
/* buffer for msgctl calls IPC_INFO, MSG_INFO */
struct msginfo {
int msgpool;
int msgmap;
int msgmax;
int msgmnb;
int msgmni;
int msgssz;
int msgtql;
unsigned short msgseg;
};
#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */
#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
/* unused */
#define MSGPOOL (MSGMNI*MSGMNB/1024) /* size in kilobytes of message pool */
#define MSGTQL MSGMNB /* number of system message headers */
#define MSGMAP MSGMNB /* number of entries in message map */
#define MSGSSZ 16 /* message segment size */
#define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */
#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
#ifdef __KERNEL__
/* one msg_msg structure for each message */
struct msg_msg {
struct list_head m_list;
long m_type;
int m_ts; /* message text size */
struct msg_msgseg* next;
void *security;
/* the actual message follows immediately */
};
#define DATALEN_MSG (PAGE_SIZE-sizeof(struct msg_msg))
#define DATALEN_SEG (PAGE_SIZE-sizeof(struct msg_msgseg))
/* one msq_queue structure for each present queue on the system */
struct msg_queue {
struct kern_ipc_perm q_perm;
time_t q_stime; /* last msgsnd time */
time_t q_rtime; /* last msgrcv time */
time_t q_ctime; /* last change time */
unsigned long q_cbytes; /* current number of bytes on queue */
unsigned long q_qnum; /* number of messages in queue */
unsigned long q_qbytes; /* max number of bytes on queue */
pid_t q_lspid; /* pid of last msgsnd */
pid_t q_lrpid; /* last receive pid */
struct list_head q_messages;
struct list_head q_receivers;
struct list_head q_senders;
};
asmlinkage long sys_msgget (key_t key, int msgflg);
asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg);
asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
#endif /* __KERNEL__ */
#endif /* _LINUX_MSG_H */
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM 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 02110-1301, USA.
*
*/
#ifndef PLATFORM_SDL_H
#define PLATFORM_SDL_H
#include "backends/platform/sdl/sdl-sys.h"
#include "backends/modular-backend.h"
#include "backends/mixer/sdl/sdl-mixer.h"
#include "backends/events/sdl/sdl-events.h"
#include "backends/log/log.h"
#include "backends/platform/sdl/sdl-window.h"
#include "common/array.h"
#ifdef USE_DISCORD
class DiscordPresence;
#endif
/**
* Base OSystem class for all SDL ports.
*/
class OSystem_SDL : public ModularMutexBackend, public ModularMixerBackend, public ModularGraphicsBackend {
public:
OSystem_SDL();
virtual ~OSystem_SDL();
/**
* Pre-initialize backend. It should be called after
* instantiating the backend. Early needed managers are
* created here.
*/
virtual void init() override;
virtual bool hasFeature(Feature f) override;
// Override functions from ModularBackend and OSystem
virtual void initBackend() override;
virtual void engineInit() override;
virtual void engineDone() override;
virtual void quit() override;
virtual void fatalError() override;
Common::KeymapArray getGlobalKeymaps() override;
Common::HardwareInputSet *getHardwareInputSet() override;
// Logging
virtual void logMessage(LogMessageType::Type type, const char *message) override;
virtual Common::String getSystemLanguage() const override;
#if SDL_VERSION_ATLEAST(2, 0, 0)
// Clipboard
virtual bool hasTextInClipboard() override;
virtual Common::U32String getTextFromClipboard() override;
virtual bool setTextInClipboard(const Common::U32String &text) override;
#endif
virtual void setWindowCaption(const Common::U32String &caption) override;
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) override;
virtual uint32 getMillis(bool skipRecord = false) override;
virtual void delayMillis(uint msecs) override;
virtual void getTimeAndDate(TimeDate &td) const override;
virtual MixerManager *getMixerManager() override;
virtual Common::TimerManager *getTimerManager() override;
virtual Common::SaveFileManager *getSavefileManager() override;
//Screenshots
virtual Common::String getScreenshotsPath();
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
Common::Array<uint> getSupportedAntiAliasingLevels() const override;
#endif
protected:
bool _inited;
bool _initedSDL;
#ifdef USE_SDL_NET
bool _initedSDLnet;
#endif
#ifdef USE_DISCORD
DiscordPresence *_presence;
#endif
/**
* The path of the currently open log file, if any.
*
* @note This is currently a string and not an FSNode for simplicity;
* e.g. we don't need to include fs.h here, and currently the
* only use of this value is to use it to open the log file in an
* editor; for that, we need it only as a string anyway.
*/
Common::String _logFilePath;
/**
* The event source we use for obtaining SDL events.
*/
SdlEventSource *_eventSource;
Common::EventSource *_eventSourceWrapper;
/**
* The SDL output window.
*/
SdlWindow *_window;
SdlGraphicsManager::State _gfxManagerState;
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
// Graphics capabilities
void detectFramebufferSupport();
void detectAntiAliasingSupport();
bool _supportsFrameBuffer;
Common::Array<uint> _antiAliasLevels;
#endif
/**
* Initialze the SDL library.
*/
virtual void initSDL();
/**
* Create the audio CD manager
*/
virtual AudioCDManager *createAudioCDManager();
// Logging
virtual Common::String getDefaultLogFileName() { return Common::String(); }
virtual Common::WriteStream *createLogFile();
Backends::Log::Log *_logger;
#ifdef USE_OPENGL
typedef Common::Array<GraphicsMode> GraphicsModeArray;
GraphicsModeArray _graphicsModes;
Common::Array<int> _graphicsModeIds;
int _graphicsMode;
int _firstGLMode;
int _defaultSDLMode;
int _defaultGLMode;
/**
* Creates the merged graphics modes list
*/
void setupGraphicsModes();
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override;
virtual int getDefaultGraphicsMode() const override;
virtual bool setGraphicsMode(int mode, uint flags) override;
virtual int getGraphicsMode() const override;
#endif
};
#endif
|
/*
* Fortezza support is removed.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "seccomon.h"
#include "prio.h"
typedef struct PEHeaderStr PEHeader;
#define PE_MIME_TYPE "application/pre-encrypted"
typedef struct PEFortezzaHeaderStr PEFortezzaHeader;
typedef struct PEFortezzaGeneratedHeaderStr PEFortezzaGeneratedHeader;
typedef struct PEFixedKeyHeaderStr PEFixedKeyHeader;
typedef struct PERSAKeyHeaderStr PERSAKeyHeader;
struct PEFortezzaHeaderStr {
unsigned char key[12];
unsigned char iv[24];
unsigned char hash[20];
unsigned char serial[8];
};
struct PEFortezzaGeneratedHeaderStr {
unsigned char key[12];
unsigned char iv[24];
unsigned char hash[20];
unsigned char Ra[128];
unsigned char Y[128];
};
struct PEFixedKeyHeaderStr {
unsigned char pkcs11Mech[4];
unsigned char labelLen[2];
unsigned char keyIDLen[2];
unsigned char ivLen[2];
unsigned char keyLen[2];
unsigned char data[1];
};
struct PERSAKeyHeaderStr {
unsigned char pkcs11Mech[4];
unsigned char issuerLen[2];
unsigned char serialLen[2];
unsigned char ivLen[2];
unsigned char keyLen[2];
unsigned char data[1];
};
#define PEFIXED_Label(header) (header->data)
#define PEFIXED_KeyID(header) (&header->data[GetInt2(header->labelLen)])
#define PEFIXED_IV(header) (&header->data[GetInt2(header->labelLen)\
+GetInt2(header->keyIDLen)])
#define PEFIXED_Key(header) (&header->data[GetInt2(header->labelLen)\
+GetInt2(header->keyIDLen)+GetInt2(header->keyLen)])
#define PERSA_Issuer(header) (header->data)
#define PERSA_Serial(header) (&header->data[GetInt2(header->issuerLen)])
#define PERSA_IV(header) (&header->data[GetInt2(header->issuerLen)\
+GetInt2(header->serialLen)])
#define PERSA_Key(header) (&header->data[GetInt2(header->issuerLen)\
+GetInt2(header->serialLen)+GetInt2(header->keyLen)])
struct PEHeaderStr {
unsigned char magic [2];
unsigned char len [2];
unsigned char type [2];
unsigned char version[2];
union {
PEFortezzaHeader fortezza;
PEFortezzaGeneratedHeader g_fortezza;
PEFixedKeyHeader fixed;
PERSAKeyHeader rsa;
} u;
};
#define PE_CRYPT_INTRO_LEN 8
#define PE_INTRO_LEN 4
#define PE_BASE_HEADER_LEN 8
#define PRE_BLOCK_SIZE 8
#define GetInt2(c) ((c[0] << 8) | c[1])
#define GetInt4(c) (((unsigned long)c[0] << 24)|((unsigned long)c[1] << 16)\
|((unsigned long)c[2] << 8)| ((unsigned long)c[3]))
#define PutInt2(c,i) ((c[1] = (i) & 0xff), (c[0] = ((i) >> 8) & 0xff))
#define PutInt4(c,i) ((c[0]=((i) >> 24) & 0xff),(c[1]=((i) >> 16) & 0xff),\
(c[2] = ((i) >> 8) & 0xff), (c[3] = (i) & 0xff))
#define PRE_MAGIC 0xc0de
#define PRE_VERSION 0x1010
#define PRE_FORTEZZA_FILE 0x00ff
#define PRE_FORTEZZA_STREAM 0x00f5
#define PRE_FORTEZZA_GEN_STREAM 0x00f6
#define PRE_FIXED_FILE 0x000f
#define PRE_RSA_FILE 0x001f
#define PRE_FIXED_STREAM 0x0005
PEHeader *SSL_PreencryptedStreamToFile(PRFileDesc *fd, PEHeader *,
int *headerSize);
PEHeader *SSL_PreencryptedFileToStream(PRFileDesc *fd, PEHeader *,
int *headerSize);
|
// $Id$
// $Locker$
// Author. Roar Thronæs.
// should be started by VMS$INITIAL-050_CONFIGURE.COM
// but for now we will use a kernel thread
// configure is supposed to use polling but if we use polling
// we might never be aware of the other devices
#include <linux/config.h>
#include <linux/mm.h>
#include <descrip.h>
#include <prcpoldef.h>
#include <cdldef.h>
#include <cdrpdef.h>
#include <cdtdef.h>
#include <chdef.h>
#include <cwpsdef.h>
#include <ddbdef.h>
#include <ddtdef.h>
#include <dptdef.h>
#include <dyndef.h>
#include <fdtdef.h>
#include <iodef.h>
#include <iosbdef.h>
#include <mscpdef.h> // does not belong here
#include <nisca.h>
#include <pbdef.h>
#include <pdtdef.h>
#include <rddef.h>
#include <rdtdef.h>
#include <sbdef.h>
#include <sbnbdef.h>
#include <scsdef.h>
#include <ssdef.h>
#include <system_data_cells.h>
#include <ucbdef.h>
#include <vcdef.h>
#include<starlet.h>
#include <exe_routines.h>
#include <misc_routines.h>
extern struct _pb mypb;
extern struct _sb mysb;
extern struct _pdt mypdt;
extern struct _pb otherpb;
extern struct _sb othersb;
int cluster_not_started = 1;
short int cf_mbxchan = 0;
void configure_init(void)
{
int promsk=0;
int sts = exe$crembx(1,&cf_mbxchan,0,0,promsk,0,0,0);
}
void someone_wrote(void)
{
int sts;
struct _iosb iosb;
printk("someone wrote\n");
struct _prcpol prcpol_, *prcpol=&prcpol_;
memset(prcpol, 0, sizeof(struct _prcpol));
sts = sys$qiow(0, cf_mbxchan, /*IO$M_NOW|*/IO$_READVBLK, &iosb, 0, 0, prcpol, sizeof(struct _prcpol), 0, 0, 0, 0);
if (0==strncmp("mscp$disk",&prcpol->prcpol$b_prcnam[0],9))
{
mscp_talk_with(&prcpol->prcpol$t_nodnam,"mscp$disk");
}
else
{
printk("prcnam not recognized: %s\n",&prcpol->prcpol$b_prcnam[0]);
}
sts = sys$qiow(0, cf_mbxchan, IO$_SETMODE|IO$M_WRTATTN, &iosb, 0, 0, someone_wrote, 0, 0, 0, 0, 0);
}
void configure(void)
{
struct _iosb iosb;
signed long long sec=-10000000;
signed long long tensec=-100000000;
$DESCRIPTOR(process_name_,"CONFIGURE");
struct dsc$descriptor * process_name = &process_name_;
exe$setprn(process_name);
#if 0
if (cluster_not_started)
{
exe$schdwk(0,0,&sec,0);
sys$hiber();
}
#endif
int sts = sys$qiow(0, cf_mbxchan, IO$_SETMODE|IO$M_WRTATTN, &iosb, 0, 0, someone_wrote, 0, 0, 0, 0, 0);
while (1)
{
sys$hiber();
}
}
|
/*
* Voxels 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.
*
* Voxels 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 Voxels; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef PNG_DECODER_H_INCLUDED
#define PNG_DECODER_H_INCLUDED
#include <string>
#include <cstdint>
#include <stdexcept>
#include "stream/stream.h"
using namespace std;
class PngLoadError final : public stream::IOException
{
public:
explicit PngLoadError(const string & arg)
: IOException(arg)
{
}
};
/** read and decode png files<br/>
bytes in RGBA format
*/
class PngDecoder final
{
private:
unsigned w, h;
uint8_t * data;
PngDecoder(const PngDecoder &) = delete;
const PngDecoder &operator =(const PngDecoder &) = delete;
public:
explicit PngDecoder(stream::Reader & reader);
PngDecoder(PngDecoder && rt)
{
w = rt.w;
h = rt.h;
data = rt.data;
rt.data = nullptr;
}
~PngDecoder()
{
delete []data;
}
uint8_t operator()(int x, int y, int byteNum) const
{
if(x < 0 || (unsigned)x >= w || y < 0 || (unsigned)y >= h || byteNum < 0 || byteNum >= 4)
throw range_error("index out of range in PngDecoder::operator()(int x, int y, int byteNum) const");
size_t index = y;
index *= w;
index += x;
index *= 4;
index += byteNum;
return data[index];
}
int width() const
{
return w;
}
int height() const
{
return h;
}
uint8_t * removeData()
{
uint8_t * retval = data;
data = nullptr;
return retval;
}
};
#endif // PNG_DECODER_H_INCLUDED
|
/* bsp.h
*
* This include file contains all MVME147 board IO definitions.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* MVME147 port for TNI - Telecom Bretagne
* by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
* May 1996
*/
#ifndef _BSP_H
#define _BSP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <bspopts.h>
#include <rtems.h>
#include <rtems/clockdrv.h>
#include <rtems/console.h>
#include <rtems/iosupp.h>
/* Constants */
#define RAM_START 0x00005000
#define RAM_END 0x00400000
/* MVME 147 Peripheral controller chip
see MVME147/D1, 3.4 */
struct pcc_map {
/* 32 bit registers */
uint32_t dma_table_address; /* 0xfffe1000 */
uint32_t dma_data_address; /* 0xfffe1004 */
uint32_t dma_bytecount; /* 0xfffe1008 */
uint32_t dma_data_holding; /* 0xfffe100c */
/* 16 bit registers */
uint16_t timer1_preload; /* 0xfffe1010 */
uint16_t timer1_count; /* 0xfffe1012 */
uint16_t timer2_preload; /* 0xfffe1014 */
uint16_t timer2_count; /* 0xfffe1016 */
/* 8 bit registers */
uint8_t timer1_int_control; /* 0xfffe1018 */
uint8_t timer1_control; /* 0xfffe1019 */
uint8_t timer2_int_control; /* 0xfffe101a */
uint8_t timer2_control; /* 0xfffe101b */
uint8_t acfail_int_control; /* 0xfffe101c */
uint8_t watchdog_control; /* 0xfffe101d */
uint8_t printer_int_control; /* 0xfffe101e */
uint8_t printer_control; /* 0xfffe102f */
uint8_t dma_int_control; /* 0xfffe1020 */
uint8_t dma_control; /* 0xfffe1021 */
uint8_t bus_error_int_control; /* 0xfffe1022 */
uint8_t dma_status; /* 0xfffe1023 */
uint8_t abort_int_control; /* 0xfffe1024 */
uint8_t table_address_function_code; /* 0xfffe1025 */
uint8_t serial_port_int_control; /* 0xfffe1026 */
uint8_t general_purpose_control; /* 0xfffe1027 */
uint8_t lan_int_control; /* 0xfffe1028 */
uint8_t general_purpose_status; /* 0xfffe1029 */
uint8_t scsi_port_int_control; /* 0xfffe102a */
uint8_t slave_base_address; /* 0xfffe102b */
uint8_t software_int_1_control; /* 0xfffe102c */
uint8_t int_base_vector; /* 0xfffe102d */
uint8_t software_int_2_control; /* 0xfffe102e */
uint8_t revision_level; /* 0xfffe102f */
};
#define pcc ((volatile struct pcc_map * const) 0xfffe1000)
#define z8530 0xfffe3001
/* interrupt vectors - see MVME146/D1 4.14 */
#define PCC_BASE_VECTOR 0x40 /* First user int */
#define SCC_VECTOR PCC_BASE_VECTOR+3
#define TIMER_1_VECTOR PCC_BASE_VECTOR+8
#define TIMER_2_VECTOR PCC_BASE_VECTOR+9
#define SOFT_1_VECTOR PCC_BASE_VECTOR+10
#define SOFT_2_VECTOR PCC_BASE_VECTOR+11
#define USE_CHANNEL_A 1 /* 1 = use channel A for console */
#define USE_CHANNEL_B 0 /* 1 = use channel B for console */
#if (USE_CHANNEL_A == 1)
#define CONSOLE_CONTROL 0xfffe3002
#define CONSOLE_DATA 0xfffe3003
#elif (USE_CHANNEL_B == 1)
#define CONSOLE_CONTROL 0xfffe3000
#define CONSOLE_DATA 0xfffe3001
#endif
extern rtems_isr_entry M68Kvec[]; /* vector table address */
/* functions */
rtems_isr_entry set_vector(
rtems_isr_entry handler,
rtems_vector_number vector,
int type
);
#ifdef __cplusplus
}
#endif
#endif
|
//
// CoreDataUtils.h
// Handbook
//
// Created by Admin on 3/31/15.
// Copyright (c) 2015 DyvenSvit. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "HAppDelegate.h"
@interface CoreDataUtils : NSObject
+(BOOL)isManagedObjectOfClass:(Class)classArg byID:(NSInteger)idArg;
+(NSManagedObject*)getManagedObjectOfClass:(Class)classArg byID:(NSInteger)idArg;
+(NSEntityDescription*)getEntityForClass:(Class)classArg;
+(NSArray*)getManagedObjectsOfClass:(Class)classArg;
@end
|
//
// linkage.h
//
// Copyright (C) 2001 Edward Valeev
//
// Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
// Maintainer: EV
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//
#ifndef _chemistry_qc_mbptr12_linkage_h
#define _chemistry_qc_mbptr12_linkage_h
#include <util/class/class.h>
#include <chemistry/qc/mbptr12/mbptr12.h>
namespace sc {
static ForceLink<MBPT2_R12> mbptr12_force_link_a_;
}
#endif
|
/*******************************************************************************
* Copyright (c) 2008, 2013 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
#if !defined(USERS_H)
#define USERS_H
#include "LinkedList.h"
#define ACL_FULL 0
#define ACL_WRITE 1
#define ACL_READ 2
/*BE
include "LinkedList"
BE*/
/*BE
map permission
{
"full" .
"write" .
"read" .
}
def RULE
{
n32 ptr STRING open "topic"
n32 map permission "permission"
}
defList(RULE)
BE*/
/*BE
def USER
{
n32 ptr STRING open "username"
n32 ptr STRING open "password"
n32 ptr RULEList open "acl"
}
defList(USER)
BE*/
typedef struct
{
char* username; /**< username */
char* password; /**< password */
List* acl; /**< Access Control List */
} User;
typedef struct
{
char* topic;
int permission;
} Rule;
void Users_add_user(char* username, char* pword);
void Users_free_list();
int Users_authenticate(char* username, char* pword);
User* Users_get_user(char* username);
void Users_add_default_rule(char* topic, int permission);
void Users_add_rule(User* user, char* topic, int permission);
int Users_authorise(User* user, char* topic, int action);
#endif /* USERS_H_ */
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright © 2000 Eazel, Inc.
* Copyright © 2004, 2006 Christian Persch
*
* Nautilus is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Nautilus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Andy Hertzfeld <andy@eazel.com>
*
* $Id: ephy-spinner.h 12639 2006-12-12 17:06:55Z chpe $
*/
#ifndef EPHY_SPINNER_H
#define EPHY_SPINNER_H
#include <gtk/gtkwidget.h>
#include <gtk/gtkenums.h>
G_BEGIN_DECLS
#define EPHY_TYPE_SPINNER (ephy_spinner_get_type ())
#define EPHY_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SPINNER, EphySpinner))
#define EPHY_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SPINNER, EphySpinnerClass))
#define EPHY_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SPINNER))
#define EPHY_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SPINNER))
#define EPHY_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SPINNER, EphySpinnerClass))
typedef struct _EphySpinner EphySpinner;
typedef struct _EphySpinnerClass EphySpinnerClass;
typedef struct _EphySpinnerDetails EphySpinnerDetails;
struct _EphySpinner
{
GtkWidget parent;
/*< private >*/
EphySpinnerDetails *details;
};
struct _EphySpinnerClass
{
GtkWidgetClass parent_class;
};
GType ephy_spinner_get_type (void);
GtkWidget *ephy_spinner_new (void);
void ephy_spinner_start (EphySpinner *throbber);
void ephy_spinner_stop (EphySpinner *throbber);
void ephy_spinner_set_size (EphySpinner *spinner,
GtkIconSize size);
G_END_DECLS
#endif /* EPHY_SPINNER_H */
|
#include "testutils.h"
#include "pkcs1.h"
int
test_main(void)
{
uint8_t buffer[16];
uint8_t expected[16] = { 1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0, 'a', 'b', 'c' };
pkcs1_signature_prefix(sizeof(buffer), buffer,
3, "abc");
ASSERT(MEMEQ(sizeof(buffer), buffer, expected));
SUCCESS();
}
|
/*
* Copyright (C) 2009-2010 The Paparazzi Team
*
* This file is part of paparazzi.
*
* paparazzi 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.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file arch/stm32/mcu_periph/uart_arch.h
* @ingroup stm32_arch
*
* Handling of UART hardware for STM32.
*/
#ifndef STM32_UART_ARCH_H
#define STM32_UART_ARCH_H
#define B1200 1200
#define B2400 2400
#define B4800 4800
#define B9600 9600
#define B19200 19200
#define B38400 38400
#define B57600 57600
#define B100000 100000
#define B115200 115200
#define B230400 230400
#define B921600 921600
#endif /* STM32_UART_ARCH_H */
|
#ifndef _SHA512_H_
#define _SHA512_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sha512_ctx
{
uint64_t s[8];
unsigned char buf[128];
size_t bytes;
}sha512_ctx_t;
void sha512_init(sha512_ctx_t * sha);
void sha512_update(sha512_ctx_t * sha, const void * data, size_t len);
void sha512_final(sha512_ctx_t * sha, unsigned char hash[64]);
#ifdef __cplusplus
}
#endif
#endif
|
/*
mkvmerge -- utility for splicing together matroska files
from component media subtypes
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
class definitions for the Flash Video (FLV) demultiplexer module
Written by Moritz Bunkus <moritz@bunkus.org>.
*/
#ifndef MTX_R_FLV_H
#define MTX_R_FLV_H
#include "common/common_pch.h"
#include <ostream>
#include "common/byte_buffer.h"
#include "common/fourcc.h"
#include "common/mm_io.h"
#include "merge/pr_generic.h"
#if defined(COMP_MSC)
#pragma pack(push,1)
#endif
struct PACKED_STRUCTURE flv_header_t {
char signature[3];
uint8_t version, type_flags;
uint32_t data_offset;
flv_header_t();
bool read(mm_io_c *in);
bool read(mm_io_cptr const &in);
bool has_video() const;
bool has_audio() const;
bool is_valid() const;
};
inline std::ostream &
operator <<(std::ostream &out,
flv_header_t const &h) {
// "Cannot bind packed field to unsigned int &" if "data_offset" is used directly.
auto local_data_offset = h.data_offset;
out << (boost::format("[file version: %1% data offset: %2% video track present: %3% audio track present: %4%]")
% static_cast<unsigned int>(h.version) % local_data_offset % h.has_video() % h.has_audio()).str();
return out;
}
#if defined(COMP_MSC)
#pragma pack(pop)
#endif
class flv_tag_c {
public:
typedef enum {
CODEC_SORENSON_H263 = 2
, CODEC_SCREEN_VIDEO
, CODEC_VP6
, CODEC_VP6_WITH_ALPHA
, CODEC_SCREEN_VIDEO_V2
, CODEC_H264
} codec_type_e;
public:
uint32_t m_previous_tag_size;
uint8_t m_flags;
uint64_t m_data_size, m_timecode, m_timecode_extended, m_next_position;
bool m_ok;
debugging_option_c m_debug;
public:
flv_tag_c();
bool read(const mm_io_cptr &in);
bool is_encrypted() const;
bool is_audio() const;
bool is_video() const;
bool is_script_data() const;
};
inline std::ostream &
operator <<(std::ostream &out,
flv_tag_c const &t) {
out << (boost::format("[prev size: %1% flags: %2% data size: %3% timecode+ex: %4%/%5% next pos: %6% ok: %7%]")
% t.m_previous_tag_size % static_cast<unsigned int>(t.m_flags) % t.m_data_size % t.m_timecode % t.m_timecode_extended % t.m_next_position % t.m_ok).str();
return out;
}
class flv_track_c {
public:
char m_type; // 'v' for video, 'a' for audio
fourcc_c m_fourcc;
bool m_headers_read;
memory_cptr m_payload, m_private_data, m_extra_data;
int m_ptzr; // the actual packetizer instance
int64_t m_timecode;
// video related parameters
unsigned int m_v_version, m_v_width, m_v_height, m_v_dwidth, m_v_dheight;
double m_v_frame_rate, m_v_aspect_ratio;
int64_t m_v_cts_offset;
char m_v_frame_type;
// audio related parameters
unsigned int m_a_channels, m_a_sample_rate, m_a_bits_per_sample, m_a_profile;
flv_track_c(char type);
bool is_audio() const;
bool is_video() const;
bool is_valid() const;
bool is_ptzr_set() const;
void postprocess_header_data();
void extract_flv1_width_and_height();
};
typedef std::shared_ptr<flv_track_c> flv_track_cptr;
class flv_reader_c: public generic_reader_c {
private:
int m_audio_track_idx, m_video_track_idx, m_selected_track_idx;
flv_tag_c m_tag;
bool m_file_done;
std::vector<flv_track_cptr> m_tracks;
debugging_option_c m_debug;
public:
flv_reader_c(const track_info_c &ti, const mm_io_cptr &in);
virtual ~flv_reader_c();
virtual bool new_stream_v_avc(flv_track_cptr &track, memory_cptr const &data);
virtual void read_headers();
virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false);
virtual void identify();
virtual void create_packetizer(int64_t tid);
virtual void create_packetizers();
virtual void add_available_track_ids();
static int probe_file(mm_io_c *io, uint64_t size);
virtual translatable_string_c get_format_name() const;
protected:
bool process_tag(bool skip_payload = false);
bool process_script_tag();
bool process_audio_tag(flv_track_cptr &track);
bool process_audio_tag_sound_format(flv_track_cptr &track, uint8_t sound_format);
bool process_video_tag(flv_track_cptr &track);
bool process_video_tag_avc(flv_track_cptr &track);
bool process_video_tag_generic(flv_track_cptr &track, flv_tag_c::codec_type_e codec_id);
void create_a_aac_packetizer(flv_track_cptr &track);
void create_a_mp3_packetizer(flv_track_cptr &track);
void create_v_avc_packetizer(flv_track_cptr &track);
void create_v_generic_packetizer(flv_track_cptr &track);
unsigned int add_track(char type);
};
#endif // MTX_R_FLV_H
|
#ifndef BSWAP_H_INCLUDED
#define BSWAP_H_INCLUDED
/*
* Copyright (C) 2000, 2001 Billy Biggs <vektor@dumbterm.net>,
* Håkan Hjort <d95hjort@dtek.chalmers.se>
*
* Modified for use with MPlayer, changes contained in libdvdread_changes.diff.
* detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id: bswap.h 15875 2005-06-30 22:48:26Z aurel $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if defined(WORDS_BIGENDIAN)
/* All bigendian systems are fine, just ignore the swaps. */
#define B2N_16(x) (void)(x)
#define B2N_32(x) (void)(x)
#define B2N_64(x) (void)(x)
#else
/* For __FreeBSD_version */
#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h>
#endif
#if defined(__linux__)
#include <byteswap.h>
#define B2N_16(x) x = bswap_16(x)
#define B2N_32(x) x = bswap_32(x)
#define B2N_64(x) x = bswap_64(x)
#elif defined(__NetBSD__)
#include <sys/endian.h>
#define B2N_16(x) BE16TOH(x)
#define B2N_32(x) BE32TOH(x)
#define B2N_64(x) BE64TOH(x)
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define B2N_16(x) x = swap16(x)
#define B2N_32(x) x = swap32(x)
#define B2N_64(x) x = swap64(x)
#elif defined(__FreeBSD__) && __FreeBSD_version >= 470000
#include <sys/endian.h>
#define B2N_16(x) x = be16toh(x)
#define B2N_32(x) x = be32toh(x)
#define B2N_64(x) x = be64toh(x)
#elif defined(__DragonFly__)
#include <sys/endian.h>
#define B2N_16(x) x = be16toh(x)
#define B2N_32(x) x = be32toh(x)
#define B2N_64(x) x = be64toh(x)
#elif defined(ARCH_X86)
inline static unsigned short bswap_16(unsigned short x)
{
__asm("xchgb %b0,%h0" :
"=q" (x) :
"0" (x));
return x;
}
#define B2N_16(x) x = bswap_16(x)
inline static unsigned int bswap_32(unsigned int x)
{
__asm(
#if __CPU__ > 386
"bswap %0":
"=r" (x) :
#else
"xchgb %b0,%h0\n"
" rorl $16,%0\n"
" xchgb %b0,%h0":
"=q" (x) :
#endif
"0" (x));
return x;
}
#define B2N_32(x) x = bswap_32(x)
inline static unsigned long long int bswap_64(unsigned long long int x)
{
register union { __extension__ uint64_t __ll;
uint32_t __l[2]; } __x;
asm("xchgl %0,%1":
"=r"(__x.__l[0]),"=r"(__x.__l[1]):
"0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
return __x.__ll;
}
#define B2N_64(x) x = bswap_64(x)
/* This is a slow but portable implementation, it has multiple evaluation
* problems so beware.
* Old FreeBSD's and Solaris don't have <byteswap.h> or any other such
* functionality!
*/
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__)
#define B2N_16(x) \
x = ((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
#define B2N_32(x) \
x = ((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define B2N_64(x) \
x = ((((x) & 0xff00000000000000) >> 56) | \
(((x) & 0x00ff000000000000) >> 40) | \
(((x) & 0x0000ff0000000000) >> 24) | \
(((x) & 0x000000ff00000000) >> 8) | \
(((x) & 0x00000000ff000000) << 8) | \
(((x) & 0x0000000000ff0000) << 24) | \
(((x) & 0x000000000000ff00) << 40) | \
(((x) & 0x00000000000000ff) << 56))
#else
/* If there isn't a header provided with your system with this functionality
* add the relevant || define( ) to the portable implementation above.
*/
#error "You need to add endian swap macros for you're system"
#endif
#endif /* WORDS_BIGENDIAN */
#endif /* BSWAP_H_INCLUDED */
|
/*************************************************************************/ /*!
@File
@Title System Description Header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description This header provides system-specific declarations and macros
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
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.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) 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.
*/ /**************************************************************************/
#if !defined(__SYSINFO_H__)
#define __SYSINFO_H__
/*!< System specific poll/timeout details */
#if defined(PVR_LINUX_USING_WORKQUEUES)
#define MAX_HW_TIME_US (1000000)
#define DEVICES_WATCHDOG_POWER_ON_SLEEP_TIMEOUT (10000)
#define DEVICES_WATCHDOG_POWER_OFF_SLEEP_TIMEOUT (3600000)
#define WAIT_TRY_COUNT (20000)
#else
#define MAX_HW_TIME_US (500000)
#define DEVICES_WATCHDOG_POWER_ON_SLEEP_TIMEOUT (10000)
#define DEVICES_WATCHDOG_POWER_OFF_SLEEP_TIMEOUT (3600000)
#define WAIT_TRY_COUNT (10000)
#endif
#define SYS_DEVICE_COUNT 3 /* RGX, DISPLAY (external), BUFFER (external) */
#define SYS_PHYS_HEAP_COUNT 1
#if defined(__linux__)
#define SYS_RGX_DEV_NAME "pvrsrvkm"
#if defined(SUPPORT_DRM)
/*
* Use the static bus ID for the platform DRM device.
*/
#if defined(PVR_DRM_DEV_BUS_ID)
#define SYS_RGX_DEV_DRM_BUS_ID PVR_DRM_DEV_BUS_ID
#else
#define SYS_RGX_DEV_DRM_BUS_ID "platform:pvrsrvkm"
#endif /* defined(PVR_DRM_DEV_BUS_ID) */
#endif /* defined(SUPPORT_DRM) */
#endif
#endif /* !defined(__SYSINFO_H__) */
|
#ifndef __ARCH_ARM_MACH_MSM_CLOCK_PCOM_H
#define __ARCH_ARM_MACH_MSM_CLOCK_PCOM_H
#define P_ACPU_CLK 0
#define P_ADM_CLK 1
#define P_ADSP_CLK 2
#define P_EBI1_CLK 3
#define P_EBI2_CLK 4
#define P_ECODEC_CLK 5
#define P_EMDH_CLK 6
#define P_GP_CLK 7
#define P_GRP_3D_CLK 8
#define P_I2C_CLK 9
#define P_ICODEC_RX_CLK 10
#define P_ICODEC_TX_CLK 11
#define P_IMEM_CLK 12
#define P_MDC_CLK 13
#define P_MDP_CLK 14
#define P_PBUS_CLK 15
#define P_PCM_CLK 16
#define P_PMDH_CLK 17
#define P_SDAC_CLK 18
#define P_SDC1_CLK 19
#define P_SDC1_P_CLK 20
#define P_SDC2_CLK 21
#define P_SDC2_P_CLK 22
#define P_SDC3_CLK 23
#define P_SDC3_P_CLK 24
#define P_SDC4_CLK 25
#define P_SDC4_P_CLK 26
#define P_TSIF_CLK 27
#define P_TSIF_REF_CLK 28
#define P_TV_DAC_CLK 29
#define P_TV_ENC_CLK 30
#define P_UART1_CLK 31
#define P_UART2_CLK 32
#define P_UART3_CLK 33
#define P_UART1DM_CLK 34
#define P_UART2DM_CLK 35
#define P_USB_HS_CLK 36
#define P_USB_HS_P_CLK 37
#define P_USB_OTG_CLK 38
#define P_VDC_CLK 39
#define P_VFE_MDC_CLK 40
#define P_VFE_CLK 41
#define P_MDP_LCDC_PCLK_CLK 42
#define P_MDP_LCDC_PAD_PCLK_CLK 43
#define P_MDP_VSYNC_CLK 44
#define P_SPI_CLK 45
#define P_VFE_AXI_CLK 46
#define P_USB_HS2_CLK 47
#define P_USB_HS2_P_CLK 48
#define P_USB_HS3_CLK 49
#define P_USB_HS3_P_CLK 50
#define P_GRP_3D_P_CLK 51
#define P_USB_PHY_CLK 52
#define P_USB_HS_CORE_CLK 53
#define P_USB_HS2_CORE_CLK 54
#define P_USB_HS3_CORE_CLK 55
#define P_CAM_M_CLK 56
#define P_CAMIF_PAD_P_CLK 57
#define P_GRP_2D_CLK 58
#define P_GRP_2D_P_CLK 59
#define P_I2S_CLK 60
#define P_JPEG_CLK 61
#define P_JPEG_P_CLK 62
#define P_LPA_CODEC_CLK 63
#define P_LPA_CORE_CLK 64
#define P_LPA_P_CLK 65
#define P_MDC_IO_CLK 66
#define P_MDC_P_CLK 67
#define P_MFC_CLK 68
#define P_MFC_DIV2_CLK 69
#define P_MFC_P_CLK 70
#define P_QUP_I2C_CLK 71
#define P_ROTATOR_IMEM_CLK 72
#define P_ROTATOR_P_CLK 73
#define P_VFE_CAMIF_CLK 74
#define P_VFE_P_CLK 75
#define P_VPE_CLK 76
#define P_I2C_2_CLK 77
#define P_MI2S_CODEC_RX_S_CLK 78
#define P_MI2S_CODEC_RX_M_CLK 79
#define P_MI2S_CODEC_TX_S_CLK 80
#define P_MI2S_CODEC_TX_M_CLK 81
#define P_PMDH_P_CLK 82
#define P_EMDH_P_CLK 83
#define P_SPI_P_CLK 84
#define P_TSIF_P_CLK 85
#define P_MDP_P_CLK 86
#define P_SDAC_M_CLK 87
#define P_MI2S_S_CLK 88
#define P_MI2S_M_CLK 89
#define P_AXI_ROTATOR_CLK 90
#define P_HDMI_CLK 91
#define P_CSI0_CLK 92
#define P_CSI0_VFE_CLK 93
#define P_CSI0_P_CLK 94
#define P_CSI1_CLK 95
#define P_CSI1_VFE_CLK 96
#define P_CSI1_P_CLK 97
#define P_GSBI_CLK 98
#define P_GSBI_P_CLK 99
#define P_CE_CLK 100
#define P_CODEC_SSBI_CLK 101
#define P_NR_CLKS 102
struct clk_ops;
extern struct clk_ops clk_ops_remote;
int pc_clk_reset(unsigned id, enum clk_reset_action action);
#define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \
.name = clk_name, \
.id = P_##clk_id, \
.remote_id = P_##clk_id, \
.ops = &clk_ops_remote, \
.flags = clk_flags, \
.dev = clk_dev, \
.dbg_name = #clk_id, \
}
#endif
|
/***************************************************************************
* Copyright (C) 2014 by Michael Ambrus *
* michael.ambrus@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef TK_STYPES_H
#define TK_STYPES_H
#include <stddef.h>
typedef struct {
char *tstack;
size_t stack_size;
} stack_t;
#endif
|
#define APPTITLE "DLViewer"
#define VERSION "v0.0"
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
// ----------------------------------------
enum { true = 1, false = 0 };
typedef struct {
short X, Y, Z;
} __Vect3D;
// ----------------------------------------
#ifdef WIN32
#include "__win32.h"
#else
#include "__linux.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include <time.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <png.h>
#include <curses.h>
#include "misaka.h"
#include "badrdp.h"
#include "oz.h"
#include "hud.h"
#include "hud_menu.h"
#include "draw.h"
#include "mouse.h"
#include "camera.h"
#include "dlist.h"
#include "confunc.h"
// ----------------------------------------
#define Read16(Buffer, Offset) \
(Buffer[Offset] << 8) | Buffer[(Offset) + 1]
#define Read32(Buffer, Offset) \
(Buffer[Offset] << 24) | (Buffer[(Offset) + 1] << 16) | (Buffer[(Offset) + 2] << 8) | Buffer[(Offset) + 3]
#define Write16(Buffer, Offset, Value) \
Buffer[Offset] = (Value & 0xFF00) >> 8; \
Buffer[Offset + 1] = (Value & 0x00FF);
#define Write32(Buffer, Offset, Value) \
Buffer[Offset] = (Value & 0xFF000000) >> 24; \
Buffer[Offset + 1] = (Value & 0x00FF0000) >> 16; \
Buffer[Offset + 2] = (Value & 0x0000FF00) >> 8; \
Buffer[Offset + 3] = (Value & 0x000000FF);
#define Write64(Buffer, Offset, Value1, Value2) \
Buffer[Offset] = (Value1 & 0xFF000000) >> 24; \
Buffer[Offset + 1] = (Value1 & 0x00FF0000) >> 16; \
Buffer[Offset + 2] = (Value1 & 0x0000FF00) >> 8; \
Buffer[Offset + 3] = (Value1 & 0x000000FF); \
Buffer[Offset + 4] = (Value2 & 0xFF000000) >> 24; \
Buffer[Offset + 5] = (Value2 & 0x00FF0000) >> 16; \
Buffer[Offset + 6] = (Value2 & 0x0000FF00) >> 8; \
Buffer[Offset + 7] = (Value2 & 0x000000FF);
#define _SHIFTL( v, s, w ) \
(((unsigned long)v & ((0x01 << w) - 1)) << s)
#define _SHIFTR( v, s, w ) \
(((unsigned long)v >> s) & ((0x01 << w) - 1))
#define ArraySize(x) (sizeof((x)) / sizeof((x)[0]))
#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#define GetPaddingSize(Filesize, Factor) \
(((Filesize / Factor) + 1) * Factor) - Filesize
// ----------------------------------------
struct __zProgram {
bool IsRunning;
bool Key[256];
int WindowWidth, WindowHeight;
int HandleAbout;
float LastTime;
int Frames;
int LastFPS;
int MousePosX, MousePosY;
int MouseCenterX, MouseCenterY;
bool MouseButtonLDown, MouseButtonRDown;
__Vect3D SceneCoords;
char Title[256];
char WndTitle[256];
char AppPath[MAX_PATH];
GLuint GLAxisMarker;
GLuint GLGrid;
float ScaleFactor;
unsigned int UCode;
GLuint DListGL[2048];
unsigned int DListAddr[2048];
int DListCount;
int DListSel;
};
struct __zOptions {
int DebugLevel;
bool EnableHUD;
bool EnableGrid;
};
struct __zCamera {
float AngleX, AngleY;
float X, Y, Z;
float LX, LY, LZ;
float CamSpeed;
};
// ----------------------------------------
extern struct __zProgram zProgram;
extern struct __zOptions zOptions;
extern struct __zCamera zCamera;
// ----------------------------------------
extern char * UCodeNames[];
extern int DoMainKbdInput();
extern float ScaleRange(float in, float oldMin, float oldMax, float newMin, float newMax);
extern void GetFilePath(char * FullPath, char * Target);
extern void GetFileName(char * FullPath, char * Target);
extern inline void dbgprintf(int Level, int Type, char * Format, ...);
|
/*
* Toshiba RBTX4938 specific interrupt handlers
* Copyright (C) 2000-2001 Toshiba Corporation
*
* 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
* terms of the GNU General Public License version 2. This program is
* licensed "as is" without any warranty of any kind, whether express
* or implied.
*
* Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
*/
/*
* MIPS_CPU_IRQ_BASE+00 Software 0
* MIPS_CPU_IRQ_BASE+01 Software 1
* MIPS_CPU_IRQ_BASE+02 Cascade TX4938-CP0
* MIPS_CPU_IRQ_BASE+03 Multiplexed -- do not use
* MIPS_CPU_IRQ_BASE+04 Multiplexed -- do not use
* MIPS_CPU_IRQ_BASE+05 Multiplexed -- do not use
* MIPS_CPU_IRQ_BASE+06 Multiplexed -- do not use
* MIPS_CPU_IRQ_BASE+07 CPU TIMER
*
* TXX9_IRQ_BASE+00
* TXX9_IRQ_BASE+01
* TXX9_IRQ_BASE+02 Cascade RBTX4938-IOC
* TXX9_IRQ_BASE+03 RBTX4938 RTL-8019AS Ethernet
* TXX9_IRQ_BASE+04
* TXX9_IRQ_BASE+05 TX4938 ETH1
* TXX9_IRQ_BASE+06 TX4938 ETH0
* TXX9_IRQ_BASE+07
* TXX9_IRQ_BASE+08 TX4938 SIO 0
* TXX9_IRQ_BASE+09 TX4938 SIO 1
* TXX9_IRQ_BASE+10 TX4938 DMA0
* TXX9_IRQ_BASE+11 TX4938 DMA1
* TXX9_IRQ_BASE+12 TX4938 DMA2
* TXX9_IRQ_BASE+13 TX4938 DMA3
* TXX9_IRQ_BASE+14
* TXX9_IRQ_BASE+15
* TXX9_IRQ_BASE+16 TX4938 PCIC
* TXX9_IRQ_BASE+17 TX4938 TMR0
* TXX9_IRQ_BASE+18 TX4938 TMR1
* TXX9_IRQ_BASE+19 TX4938 TMR2
* TXX9_IRQ_BASE+20
* TXX9_IRQ_BASE+21
* TXX9_IRQ_BASE+22 TX4938 PCIERR
* TXX9_IRQ_BASE+23
* TXX9_IRQ_BASE+24
* TXX9_IRQ_BASE+25
* TXX9_IRQ_BASE+26
* TXX9_IRQ_BASE+27
* TXX9_IRQ_BASE+28
* TXX9_IRQ_BASE+29
* TXX9_IRQ_BASE+30
* TXX9_IRQ_BASE+31 TX4938 SPI
*
* RBTX4938_IRQ_IOC+00 PCI-D
* RBTX4938_IRQ_IOC+01 PCI-C
* RBTX4938_IRQ_IOC+02 PCI-B
* RBTX4938_IRQ_IOC+03 PCI-A
* RBTX4938_IRQ_IOC+04 RTC
* RBTX4938_IRQ_IOC+05 ATA
* RBTX4938_IRQ_IOC+06 MODEM
* RBTX4938_IRQ_IOC+07 SWINT
*/
#include <linux/init.h>
#include <linux/interrupt.h>
<<<<<<< HEAD
#include <linux/irq.h>
=======
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
#include <asm/mipsregs.h>
#include <asm/txx9/generic.h>
#include <asm/txx9/rbtx4938.h>
<<<<<<< HEAD
=======
static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq);
static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq);
#define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC"
static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
.name = TOSHIBA_RBTX4938_IOC_NAME,
.ack = toshiba_rbtx4938_irq_ioc_disable,
.mask = toshiba_rbtx4938_irq_ioc_disable,
.mask_ack = toshiba_rbtx4938_irq_ioc_disable,
.unmask = toshiba_rbtx4938_irq_ioc_enable,
};
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
static int toshiba_rbtx4938_irq_nested(int sw_irq)
{
u8 level3;
level3 = readb(rbtx4938_imstat_addr);
if (unlikely(!level3))
return -1;
/* must use fls so onboard ATA has priority */
return RBTX4938_IRQ_IOC + __fls8(level3);
}
<<<<<<< HEAD
static void toshiba_rbtx4938_irq_ioc_enable(struct irq_data *d)
=======
static void __init
toshiba_rbtx4938_irq_ioc_init(void)
{
int i;
for (i = RBTX4938_IRQ_IOC;
i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++)
set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type,
handle_level_irq);
set_irq_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq);
}
static void
toshiba_rbtx4938_irq_ioc_enable(unsigned int irq)
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
{
unsigned char v;
v = readb(rbtx4938_imask_addr);
<<<<<<< HEAD
v |= (1 << (d->irq - RBTX4938_IRQ_IOC));
=======
v |= (1 << (irq - RBTX4938_IRQ_IOC));
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
writeb(v, rbtx4938_imask_addr);
mmiowb();
}
<<<<<<< HEAD
static void toshiba_rbtx4938_irq_ioc_disable(struct irq_data *d)
=======
static void
toshiba_rbtx4938_irq_ioc_disable(unsigned int irq)
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
{
unsigned char v;
v = readb(rbtx4938_imask_addr);
<<<<<<< HEAD
v &= ~(1 << (d->irq - RBTX4938_IRQ_IOC));
=======
v &= ~(1 << (irq - RBTX4938_IRQ_IOC));
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
writeb(v, rbtx4938_imask_addr);
mmiowb();
}
<<<<<<< HEAD
#define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC"
static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
.name = TOSHIBA_RBTX4938_IOC_NAME,
.irq_mask = toshiba_rbtx4938_irq_ioc_disable,
.irq_unmask = toshiba_rbtx4938_irq_ioc_enable,
};
=======
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
static int rbtx4938_irq_dispatch(int pending)
{
int irq;
if (pending & STATUSF_IP7)
irq = MIPS_CPU_IRQ_BASE + 7;
else if (pending & STATUSF_IP2) {
irq = txx9_irq();
if (irq == RBTX4938_IRQ_IOCINT)
irq = toshiba_rbtx4938_irq_nested(irq);
} else if (pending & STATUSF_IP1)
irq = MIPS_CPU_IRQ_BASE + 0;
else if (pending & STATUSF_IP0)
irq = MIPS_CPU_IRQ_BASE + 1;
else
irq = -1;
return irq;
}
<<<<<<< HEAD
static void __init toshiba_rbtx4938_irq_ioc_init(void)
{
int i;
for (i = RBTX4938_IRQ_IOC;
i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++)
irq_set_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type,
handle_level_irq);
irq_set_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq);
}
=======
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
void __init rbtx4938_irq_setup(void)
{
txx9_irq_dispatch = rbtx4938_irq_dispatch;
/* Now, interrupt control disabled, */
/* all IRC interrupts are masked, */
/* all IRC interrupt mode are Low Active. */
/* mask all IOC interrupts */
writeb(0, rbtx4938_imask_addr);
/* clear SoftInt interrupts */
writeb(0, rbtx4938_softint_addr);
tx4938_irq_init();
toshiba_rbtx4938_irq_ioc_init();
/* Onboard 10M Ether: High Active */
<<<<<<< HEAD
irq_set_irq_type(RBTX4938_IRQ_ETHER, IRQF_TRIGGER_HIGH);
=======
set_irq_type(RBTX4938_IRQ_ETHER, IRQF_TRIGGER_HIGH);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
}
|
/*
* Copyright 2011 Dog Hunter SA
* Author: Davide Ciminaghi <ciminaghi@gnudd.com>
*
* GNU GPLv2 or later
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/mcuio.h>
#include <linux/mcuio_ids.h>
#include "mcuio-internal.h"
static inline int mcuio_device_is_host_controller(struct mcuio_device *mdev)
{
return mdev->id.class == MCUIO_CLASS_HOST_CONTROLLER ||
mdev->id.class == MCUIO_CLASS_SOFT_HOST_CONTROLLER;
}
static struct bus_attribute def_bus_attrs[] = {
__ATTR_NULL,
};
static void mcuio_dev_default_release(struct device *dev)
{
struct mcuio_device *mdev = to_mcuio_dev(dev);
kfree(mdev);
}
/*
* mcuio_match_device
* @drv driver to match
* @dev device to match
*
*/
static int mcuio_match_device(struct device *dev, struct device_driver *drv)
{
struct mcuio_device *mdev = to_mcuio_dev(dev);
struct mcuio_driver *mdrv = to_mcuio_drv(drv);
const struct mcuio_device_id *id;
pr_debug("%s:%d\n", __func__, __LINE__);
for (id = mdrv->id_table;
!(id->device == MCUIO_NO_DEVICE &&
id->class == MCUIO_CLASS_UNDEFINED);
id++) {
/* Device and vendor match first */
if (mdev->id.device == id->device &&
mdev->id.vendor == id->vendor)
return 1;
/* Next try class match */
if (mdev->id.class == (id->class & id->class_mask))
return 1;
}
return 0;
}
struct bus_type mcuio_bus_type = {
.name = "mcuio",
.bus_attrs = def_bus_attrs,
.match = mcuio_match_device,
};
static int mcuio_drv_probe(struct device *_dev)
{
struct mcuio_driver *drv = to_mcuio_drv(_dev->driver);
struct mcuio_device *dev = to_mcuio_dev(_dev);
if (!drv->probe)
return -ENODEV;
return drv->probe(dev);
}
static int mcuio_drv_remove(struct device *_dev)
{
struct mcuio_driver *drv = to_mcuio_drv(_dev->driver);
struct mcuio_device *dev = to_mcuio_dev(_dev);
if (drv->remove)
return drv->remove(dev);
_dev->driver = NULL;
return 0;
}
int mcuio_driver_register(struct mcuio_driver *drv, struct module *owner)
{
drv->driver.owner = owner;
drv->driver.bus = &mcuio_bus_type;
if (drv->probe)
drv->driver.probe = mcuio_drv_probe;
if (drv->remove)
drv->driver.remove = mcuio_drv_remove;
return driver_register(&drv->driver);
}
EXPORT_SYMBOL_GPL(mcuio_driver_register);
void mcuio_driver_unregister(struct mcuio_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL_GPL(mcuio_driver_unregister);
struct device mcuio_bus = {
.init_name = "mcuio",
};
EXPORT_SYMBOL_GPL(mcuio_bus);
static const struct attribute_group *default_dev_attr_groups[] = {
&mcuio_default_dev_attr_group,
NULL,
};
struct device_type mcuio_default_device_type = {
.name = "mcuiodev",
.groups = default_dev_attr_groups,
.release = mcuio_dev_default_release,
};
int mcuio_device_register(struct mcuio_device *mdev,
struct device_type *type,
struct device *parent)
{
int ret;
if (!mdev)
return -EINVAL;
mdev->dev.parent = parent ? parent : &mcuio_bus;
mdev->dev.bus = &mcuio_bus_type;
mdev->dev.type = type ? type : &mcuio_default_device_type;
dev_set_name(&mdev->dev, "%d:%d.%d", mdev->bus, mdev->device, mdev->fn);
ret = device_register(&mdev->dev);
if (!ret)
return ret;
put_device(&mdev->dev);
return ret;
}
EXPORT_SYMBOL_GPL(mcuio_device_register);
static int __mcuio_device_unregister(struct device *dev, void *dummy)
{
device_unregister(dev);
return 0;
}
static void mcuio_unregister_children(struct mcuio_device *mdev)
{
device_for_each_child(&mdev->dev, NULL, __mcuio_device_unregister);
}
void mcuio_device_unregister(struct mcuio_device *mdev)
{
if (mcuio_device_is_host_controller(mdev))
mcuio_unregister_children(mdev);
__mcuio_device_unregister(&mdev->dev, NULL);
}
EXPORT_SYMBOL_GPL(mcuio_device_unregister);
|
/****************************************************************************
**
** This file is part of the Qtopia Opensource Edition Package.
**
** Copyright (C) 2008 Trolltech ASA.
**
** Contact: Qt Extended Information (info@qtextended.org)
**
** This file may be used under the terms of the GNU General Public License
** versions 2.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 GNU General Public
** Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html.
**
**
****************************************************************************/
#ifndef __QTOPIA_CAMERA_FORMATCONVERTER_H
#define __QTOPIA_CAMERA_FORMATCONVERTER_H
#include <QList>
namespace camera
{
/*
convert something to RGB32
*/
class FormatConverter
{
public:
virtual ~FormatConverter() {}
virtual unsigned char* convert(unsigned char* src) = 0;
static FormatConverter* createFormatConverter(unsigned int type, int width, int height);
static void releaseFormatConverter(FormatConverter* converter);
static QList<unsigned int> supportedFormats();
};
class NullConverter : public FormatConverter
{
public:
virtual unsigned char* convert(unsigned char* src);
};
} // ns camera
#endif //__QTOPIA_CAMERA_FORMATCONVERTER_H
|
/****************************************************************
Siano Mobile Silicon, Inc.
MDTV receiver kernel modules.
Copyright (C) 2006-2009, Uri Shkolnik
Copyright (c) 2010 - Mauro Carvalho Chehab
- Ported the driver to use rc-core
- IR raw event decoding is now done at rc-core
- Code almost re-written
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************/
#include <linux/types.h>
#include <linux/input.h>
#include "smscoreapi.h"
#include "smsir.h"
#include "sms-cards.h"
#define MODULE_NAME "smsmdtv"
void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len)
{
int i;
const s32 *samples = (const void *)buf;
for (i = 0; i < len >> 2; i++) {
DEFINE_IR_RAW_EVENT(ev);
ev.duration = abs(samples[i]) * 1000; /* Convert to ns */
ev.pulse = (samples[i] > 0) ? false : true;
ir_raw_event_store(coredev->ir.dev, &ev);
}
ir_raw_event_handle(coredev->ir.dev);
}
int sms_ir_init(struct smscore_device_t *coredev)
{
int err;
int board_id = smscore_get_board_id(coredev);
struct rc_dev *dev;
sms_log("Allocating rc device");
dev = rc_allocate_device();
if (!dev) {
sms_err("Not enough memory");
return -ENOMEM;
}
coredev->ir.controller = 0; /* Todo: vega/nova SPI number */
coredev->ir.timeout = IR_DEFAULT_TIMEOUT;
sms_log("IR port %d, timeout %d ms",
coredev->ir.controller, coredev->ir.timeout);
snprintf(coredev->ir.name, sizeof(coredev->ir.name),
"SMS IR (%s)", sms_get_board(board_id)->name);
strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys));
strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys));
dev->input_name = coredev->ir.name;
dev->input_phys = coredev->ir.phys;
dev->dev.parent = coredev->device;
#if 0
/* TODO: properly initialize the parameters bellow */
dev->input_id.bustype = BUS_USB;
dev->input_id.version = 1;
dev->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
dev->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
#endif
dev->priv = coredev;
dev->driver_type = RC_DRIVER_IR_RAW;
dev->allowed_protos = RC_TYPE_ALL;
dev->map_name = sms_get_board(board_id)->rc_codes;
dev->driver_name = MODULE_NAME;
sms_log("Input device (IR) %s is set for key events", dev->input_name);
err = rc_register_device(dev);
if (err < 0) {
sms_err("Failed to register device");
rc_free_device(dev);
return err;
}
coredev->ir.dev = dev;
return 0;
}
void sms_ir_exit(struct smscore_device_t *coredev)
{
if (coredev->ir.dev)
rc_unregister_device(coredev->ir.dev);
sms_log("");
}
|
#include <newNTL/ZZXFactoring.h>
newNTL_CLIENT
long NumFacs(const vec_pair_ZZX_long& v)
{
long i;
long res;
res = 0;
for (i = 0; i < v.length(); i++)
res += v[i].b;
return res;
}
int main()
{
long cnt = 0;
while (SkipWhiteSpace(cin)) {
cnt++;
cerr << ".";
vec_ZZ w;
ZZX f1, f;
long nfacs;
cin >> w;
cin >> nfacs;
long i, n;
n = w.length();
f.rep.SetLength(n);
for (i = 0; i < n; i++)
f.rep[i] = w[n-1-i];
f.normalize();
vec_pair_ZZX_long factors;
ZZ c;
factor(c, factors, f, 0);
mul(f1, factors);
mul(f1, f1, c);
if (f != f1) {
cerr << f << "\n";
cerr << c << " " << factors << "\n";
Error("FACTORIZATION INCORRECT (1) !!!");
}
long nfacs1 = NumFacs(factors);
if (nfacs1 != nfacs)
Error("FACTORIZATION INCORRECT (2) !!!");
}
cerr << "\n";
cerr << "MoreFacTest OK\n";
return 0;
}
|
#ifndef ALOCMEM_H
#define ALOCMEM_H
void alocmem(void);
#endif /* ALOCMEM_H */
|
/**
* @file feature_set.h
* @author Thomas M. Howard (tmhoward@csail.mit.edu)
* Matthew R. Walter (mwalter@csail.mit.edu)
* @version 1.0
*
* @section LICENSE
*
* This file is part of h2sl.
*
* Copyright (C) 2014 by the Massachusetts Institute of Technology
*
* 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/gpl-2.0.html> or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* @section DESCRIPTION
*
* The interface for a class used to describe a set of features
*/
#ifndef H2SL_FEATURE_SET_H
#define H2SL_FEATURE_SET_H
#include <iostream>
#include <vector>
#include <libxml/tree.h>
#include <h2sl/grounding.h>
#include <h2sl/feature.h>
#include <h2sl/feature_product.h>
namespace h2sl {
class Feature_Set {
public:
Feature_Set();
virtual ~Feature_Set();
Feature_Set( const Feature_Set& other );
Feature_Set& operator=( const Feature_Set& other );
void indices( const unsigned int& cv, const Grounding* grounding, const std::vector< std::pair< const Phrase*, std::vector< Grounding* > > >& children, const Phrase* phrase, const World* world, std::vector< unsigned int >& indices, std::vector< Feature* >& features, const std::vector< bool >& evaluateFeatureTypes );
void evaluate( const unsigned int& cv, const Grounding* grounding, const std::vector< std::pair< const Phrase*, std::vector< Grounding* > > >& children, const Phrase* phrase, const World* world, const std::vector< bool >& evaluateFeatureTypes );
virtual void to_xml( const std::string& filename )const;
virtual void to_xml( xmlDocPtr doc, xmlNodePtr root )const;
virtual void from_xml( const std::string& filename );
virtual void from_xml( xmlNodePtr root );
unsigned int size( void )const;
inline std::vector< Feature_Product* >& feature_products( void ){ return _feature_products; };
inline const std::vector< Feature_Product* >& feature_products( void )const{ return _feature_products; };
protected:
std::vector< Feature_Product* > _feature_products;
private:
};
std::ostream& operator<<( std::ostream& out, const Feature_Set& other );
}
#endif /* H2SL_FEATURE_SET_H */
|
#ifndef GLOBALS_H
#define GLOBALS_H
#include <cuda_runtime.h>
#include <curand_kernel.h>
#include <string>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <iostream>
using namespace std;
#include "params.h"
#include "particles.h"
#include "utils/cuda_vector_math.cuh"
struct SimParams{ // using struct for C compatibility in kernel functions
// time step
float dt;
// particle constants
float Rr;
float Rs;
float speed;
float turnRateMax;
float cosphi; // cos(P_turnRateMax*dt) !!
float kA;
float kO;
float errSd;
// boundaries
float xmin;
float xmax;
float ymin;
float ymax;
};
enum Strategy {Cooperate = 1, Defect = 0};
extern int cDevice; // device on which to run
extern int genMax; // max generations to simulate
extern int plotStep; // # steps after which progress if displayed on terminal
extern string outDir, dataDir, framesDir; // path of putput and data dir
extern int moveStepsPerGen; // movement steps per generation
extern float arenaSize; // arena size determines density
extern float RsNoiseSd; // mutation rate in Rs
// sim params (to be set manually before each run)
extern SimParams host_params;//, *dev_params;
extern float fitness_base; // base fitness
extern vector <float> c, cS; // costs
extern vector <float> mu; // mutation rate
extern float Rg, Rs_base; // Radius for grouping
// ensemble params
extern int iEns; // formerly iRunSet. ensemble number. each ensemble consists of nBlocks runs
extern int iExpt; // formerly exptID. each expt consists of 1 or more ensembles.
extern string exptDesc, exptDescFull; // exptDesc is unique for each ensemble, edfull is unique for each run
// GPU random number generator states and seeds
extern curandState * dev_XWstates;
extern int *seeds_h, *seeds_dev; // seeds will have size nFish*nBlocks (each thread will get unique seed)
// Host random number generator
extern curandGenerator_t generator_host;
extern int seed_cpu;
// movement
extern int gRun; // which run to display
//extern int imstep; // current movement step
extern bool b_anim_on; // movement on?
// device state arrays
extern float2 * pos_dev, * vel_dev;
extern float * Rs_dev;
extern float * kA_dev, * kO_dev; // kA and kO, the attraction and orientation constants
// host state arrays
extern vector <Particle> animals; // vector for all parents (this must include all blocks)
extern vector <Particle> offspring; // vector for all offspring (1 block is sufficient)
extern map <int, int> g2ng_map, g2kg_map; // gid -> x maps, x is ng or kg
extern int genNum, stepNum; // current generation number
extern int nCoop; // current # atruists
extern float EpgNg, varPg, r, pbar, dp, Skg2bNg, SkgbNg, r2; //
// grid
extern int *gridCount, *cummCount;
extern int *gridCount_dev, *cummCount_dev, *filledCount_dev, *pStartIds_dev, *pEndIds_dev;; // grid sized arrays
extern int *cellIds_dev, *sortedIds_dev; // n-particles sized arrays
extern int nCellsX, nCells; // number of cells in X, Y and total (X*Y)
extern int nCellsMaxX, nCellsMax; // this depends on Rr, and memory of upto these many cells will be allocated.
extern float cellSize;
// output streams
//extern ofstream ng_fout[nBlocks], kg_fout[nBlocks], gid_fout[nBlocks],
// wa_fout[nBlocks], rs_fout[nBlocks], p_fout[nBlocks], fit_fout[nBlocks], gix_fout[nBlocks],
// ko_fout[nBlocks], ka_fout[nBlocks];
//extern ofstream fout_fcs;
extern string homeDir_path, outDir_name, exptName;
extern int wks, gpu; // gpu on which to run
extern ofstream * p_fout;
// population
extern int nFish; // number of fish in each run
extern int nBlocks; // number of runs
// graphics
extern int graphicsQual; // 0 = no graphics, 1 = basic graphics, 2 = good graphics, 3 = fancy graphics, charts etc
extern int dispInterval;
extern bool b_displayEveryStep;
// experiment properties
extern float rDisp; // Dispersal - Radius of dispersal. (-1 for random dispersal)
extern bool b_baseline; // Baseline - is this a baseline experiment (Rs = 0)
extern bool b_constRg; // Grouping - use constant radius of grouping?
// selection and mutation
extern float b; // benefit value
// init
extern float fC0; // initial frequency of cooperators
// output
extern int ngen_plot; // number of points in generation axis to output in terminal/plots
extern int ngenScan; // number of end generations to average over for parameter scan graphs
extern bool dataOut; // output all values in files?
extern bool plotsOut; // output plots
extern bool framesOut; // output frames
extern vector <float> fb_sweep, as_sweep, nfish_sweep, rsb_sweep, rg_sweep, ens_sweep, mu_sweep, nm_sweep;
// overload random generator functions to use the generator_host declared above
inline float runif(float rmin=0, float rmax=1){ return runif(generator_host, rmin, rmax); }
inline float rnorm(float mu=0, float sd=1){ return rnorm(generator_host, mu, sd);}
inline float2 runif2(float xlim, float ylim){ return runif2(generator_host, xlim, ylim);}
inline float2 rnorm2(float mu=0, float sd=1){ return rnorm2(generator_host, mu, sd); }
inline float2 runif2(float _norm){ return runif2(generator_host, _norm); }
inline float2 rnorm2_bounded(float mu, float sd, float rmin, float rmax){
return rnorm2_bounded(generator_host, mu, sd, rmin, rmax);
}
#endif
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM 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 02110-1301, USA.
*
*/
#ifndef TITANIC_DIRECT_DRAW_H
#define TITANIC_DIRECT_DRAW_H
#include "common/scummsys.h"
#include "common/array.h"
#include "titanic/support/direct_draw_surface.h"
namespace Titanic {
class TitanicEngine;
class DirectDraw {
private:
TitanicEngine *_vm;
public:
bool _windowed;
int _fieldC;
int _width;
int _height;
int _bpp;
int _numBackSurfaces;
int _field24;
public:
DirectDraw(TitanicEngine *vm);
/**
* Sets a new display mode
*/
void setDisplayMode(int width, int height, int bpp, int refreshRate);
/**
* Logs diagnostic information
*/
void diagnostics();
/**
* Create a surface from a passed description record
*/
DirectDrawSurface *createSurfaceFromDesc(const DDSurfaceDesc &desc);
};
class DirectDrawManager {
public:
DirectDraw _directDraw;
DirectDrawSurface *_mainSurface;
DirectDrawSurface *_backSurfaces[2];
public:
DirectDrawManager(TitanicEngine *vm, bool windowed);
/**
* Initializes video surfaces
* @param width Screen width
* @param height Screen height
* @param bpp Bits per pixel
* @param numBackSurfaces Number of back surfaces
*/
void initVideo(int width, int height, int bpp, int numBackSurfaces);
void setResolution();
void proc2();
void proc3();
/**
* Initializes the surfaces in windowed mode
*/
void initWindowed() { initFullScreen(); }
/**
* Initializes the surfaces for the screen
*/
void initFullScreen();
/**
* Create a surface
*/
DirectDrawSurface *createSurface(int w, int h, int surfaceNum);
};
} // End of namespace Titanic
#endif /* TITANIC_DIRECT_DRAW_H */
|
/*
* BMP parser
* Copyright (c) 2012 Paul B Mahol
*
* 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
*/
/**
* @file
* BMP parser
*/
#include "libavutil/bswap.h"
#include "libavutil/common.h"
#include "parser.h"
typedef struct BMPParseContext {
ParseContext pc;
uint32_t fsize;
uint32_t remaining_size;
} BMPParseContext;
static int bmp_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
BMPParseContext *bpc = s->priv_data;
uint64_t state = bpc->pc.state64;
int next = END_NOT_FOUND;
int i = 0;
*poutbuf_size = 0;
restart:
if (bpc->pc.frame_start_found <= 2+4+4) {
for (; i < buf_size; i++) {
state = (state << 8) | buf[i];
if (bpc->pc.frame_start_found == 0) {
if ((state >> 48) == (('B' << 8) | 'M')) {
bpc->fsize = av_bswap32(state >> 16);
bpc->pc.frame_start_found = 1;
}
} else if (bpc->pc.frame_start_found == 2+4+4) {
// unsigned hsize = av_bswap32(state>>32);
unsigned ihsize = av_bswap32(state);
if (ihsize < 12 || ihsize > 200) {
bpc->pc.frame_start_found = 0;
continue;
}
bpc->pc.frame_start_found++;
bpc->remaining_size = bpc->fsize + i - 17;
if (bpc->pc.index + i > 17) {
next = i - 17;
} else
goto restart;
} else if (bpc->pc.frame_start_found)
bpc->pc.frame_start_found++;
}
bpc->pc.state64 = state;
} else {
if (bpc->remaining_size) {
i = FFMIN(bpc->remaining_size, buf_size);
bpc->remaining_size -= i;
if (bpc->remaining_size)
goto flush;
bpc->pc.frame_start_found = 0;
goto restart;
}
}
flush:
if (ff_combine_frame(&bpc->pc, next, &buf, &buf_size) < 0)
return buf_size;
bpc->pc.frame_start_found = 0;
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
AVCodecParser ff_bmp_parser = {
.codec_ids = { AV_CODEC_ID_BMP },
.priv_data_size = sizeof(BMPParseContext),
.parser_parse = bmp_parse,
.parser_close = ff_parse_close,
};
|
/*
Copyright (C) 2013 Matthew Denwood <matthewdenwood@mac.com>
This header is based on the pareto distribution in JAGS version 3.3,
and specifies the generalised pareto distribution
This file is part of runjags
Original DPar.h file is Copyright (C) 2002-10 Martyn Plummer,
from the source for JAGS version 3.3, licensed under GPL-2
runjags is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
runjags 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 runjags If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DGENPAR_H_
#define DGENPAR_H_
// Checks the JAGS version and sets necessary macros:
#include "../jagsversions.h"
#ifndef INCLUDERSCALARDIST
#include <distribution/RScalarDist.h>
namespace jags {
#else
#include "jags/RScalarDist.h"
#endif /* INCLUDERSCALARDIST */
namespace runjags {
/**
* <pre>
* x ~ dgenpar(sigma, mu, xi);
// when xi != 0:
* f(x|sigma,mu,xi) = 1/sigma * (1 + xi * (x-mu)/sigma)^-(1/xi +1) ; x >= mu where xi >= 0, mu <= x <= (mu - sigma/xi) for xi < 0
// when xi == 0:
f(x|sigma,mu,xi) = 1/sigma * exp(-(x-mu)/sigma) ; ; x >= mu where xi >= 0, mu <= x <= (mu - sigma/xi) for xi < 0
* </pre>
* @short Generalised Pareto distribution
*/
class DGenPar : public RScalarDist {
public:
DGenPar();
double d(double x, PDFType type,
std::vector<double const *> const ¶meters, bool give_log) const;
double p(double q, std::vector<double const *> const ¶meters, bool lower,
bool give_log) const;
double q(double p, std::vector<double const *> const ¶meters, bool lower,
bool log_p) const;
double r(std::vector<double const *> const ¶meters, RNG *rng) const;
double l(std::vector<double const*> const ¶meters) const;
double u(std::vector<double const*> const ¶meters) const;
bool checkParameterValue(std::vector<double const *> const ¶meters) const;
bool isSupportFixed(std::vector<bool> const &fixmask) const;
};
} // namespace runjags
#ifndef INCLUDERSCALARDIST
} // namespace jags
#endif /* INCLUDERSCALARDIST */
#endif /* DGENPAR_H_ */
|
#ifndef QEMU_CPUS_H
#define QEMU_CPUS_H
#include "qemu/timer.h"
/* cpus.c */
bool qemu_in_vcpu_thread(void);
void qemu_init_cpu_loop(void);
void resume_all_vcpus(void);
void pause_all_vcpus(void);
void cpu_stop_current(void);
void cpu_ticks_init(void);
void configure_icount(QemuOpts *opts, Error **errp);
extern int use_icount;
extern int icount_align_option;
/* drift information for info jit command */
extern int64_t max_delay;
extern int64_t max_advance;
void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
/* Unblock cpu */
void qemu_cpu_kick_self(void);
void qemu_timer_notify_cb(void *opaque, QEMUClockType type);
void cpu_synchronize_all_states(void);
void cpu_synchronize_all_post_reset(void);
void cpu_synchronize_all_post_init(void);
void qtest_clock_warp(int64_t dest);
#ifndef CONFIG_USER_ONLY
/* vl.c */
/* *-user doesn't have configurable SMP topology */
extern int smp_cores;
extern int smp_threads;
#endif
void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg);
void qemu_tcg_configure(QemuOpts *opts, Error **errp);
#endif
|
#include <boost/shared_ptr.hpp>
#include <liboptions/liboptions.h>
#include "libmints/basisset.h"
#include "libmints/molecule.h"
#include "libmints/wavefunction.h"
/*
* Fake reference WF and CC WF to mimic the PSI4 default one because
* Wavefunction constructor calls Wavefunction::common_init which
* requires more parameters we don't initialized
*/
namespace psi {
class FakeRefWavefunction : public Wavefunction {
public:
FakeRefWavefunction(Options &options);
~FakeRefWavefunction();
double compute_energy() { return 0; }
};
class FakeCCWavefunction : public Wavefunction {
public:
FakeCCWavefunction(Options &options);
~FakeCCWavefunction();
double compute_energy() { return 0; }
};
class FakeBasisSet : public BasisSet {
public:
FakeBasisSet(int nao);
~FakeBasisSet();
};
class FakeMolecule : public Molecule {
public:
FakeMolecule(double e_nuc);
~FakeMolecule();
private:
double nuclear_repulsion_;
};
}
|
/*-*- linux-c -*-
* linux/drivers/video/i810-i2c.c -- Intel 810/815 I2C support
*
* Copyright (C) 2004 Antonino Daplas<adaplas@pol.net>
* All Rights Reserved
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/gfp.h>
#include <linux/pci.h>
#include <linux/fb.h>
#include "i810.h"
#include "i810_regs.h"
#include "i810_main.h"
#include "../edid.h"
/* bit locations in the registers */
#define SCL_DIR_MASK 0x0001
#define SCL_DIR 0x0002
#define SCL_VAL_MASK 0x0004
#define SCL_VAL_OUT 0x0008
#define SCL_VAL_IN 0x0010
#define SDA_DIR_MASK 0x0100
#define SDA_DIR 0x0200
#define SDA_VAL_MASK 0x0400
#define SDA_VAL_OUT 0x0800
#define SDA_VAL_IN 0x1000
#define DEBUG /* define this for verbose EDID parsing output */
#ifdef DEBUG
#define DPRINTK(fmt, args...) printk(fmt,## args)
#else
#define DPRINTK(fmt, args...)
#endif
static void i810i2c_setscl(void *data, int state)
{
struct i810fb_i2c_chan *chan = data;
struct i810fb_par *par = chan->par;
u8 __iomem *mmio = par->mmio_start_virtual;
<<<<<<< HEAD
if (state)
i810_writel(mmio, chan->ddc_base, SCL_DIR_MASK | SCL_VAL_MASK);
else
i810_writel(mmio, chan->ddc_base, SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK);
=======
i810_writel(mmio, chan->ddc_base, (state ? SCL_VAL_OUT : 0) | SCL_DIR |
SCL_DIR_MASK | SCL_VAL_MASK);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
i810_readl(mmio, chan->ddc_base); /* flush posted write */
}
static void i810i2c_setsda(void *data, int state)
{
struct i810fb_i2c_chan *chan = data;
struct i810fb_par *par = chan->par;
u8 __iomem *mmio = par->mmio_start_virtual;
<<<<<<< HEAD
if (state)
i810_writel(mmio, chan->ddc_base, SDA_DIR_MASK | SDA_VAL_MASK);
else
i810_writel(mmio, chan->ddc_base, SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK);
=======
i810_writel(mmio, chan->ddc_base, (state ? SDA_VAL_OUT : 0) | SDA_DIR |
SDA_DIR_MASK | SDA_VAL_MASK);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
i810_readl(mmio, chan->ddc_base); /* flush posted write */
}
static int i810i2c_getscl(void *data)
{
struct i810fb_i2c_chan *chan = data;
struct i810fb_par *par = chan->par;
u8 __iomem *mmio = par->mmio_start_virtual;
i810_writel(mmio, chan->ddc_base, SCL_DIR_MASK);
i810_writel(mmio, chan->ddc_base, 0);
return ((i810_readl(mmio, chan->ddc_base) & SCL_VAL_IN) != 0);
}
static int i810i2c_getsda(void *data)
{
struct i810fb_i2c_chan *chan = data;
struct i810fb_par *par = chan->par;
u8 __iomem *mmio = par->mmio_start_virtual;
i810_writel(mmio, chan->ddc_base, SDA_DIR_MASK);
i810_writel(mmio, chan->ddc_base, 0);
return ((i810_readl(mmio, chan->ddc_base) & SDA_VAL_IN) != 0);
}
static int i810_setup_i2c_bus(struct i810fb_i2c_chan *chan, const char *name)
{
int rc;
strcpy(chan->adapter.name, name);
chan->adapter.owner = THIS_MODULE;
chan->adapter.algo_data = &chan->algo;
chan->adapter.dev.parent = &chan->par->dev->dev;
chan->algo.setsda = i810i2c_setsda;
chan->algo.setscl = i810i2c_setscl;
chan->algo.getsda = i810i2c_getsda;
chan->algo.getscl = i810i2c_getscl;
chan->algo.udelay = 10;
chan->algo.timeout = (HZ/2);
chan->algo.data = chan;
i2c_set_adapdata(&chan->adapter, chan);
/* Raise SCL and SDA */
chan->algo.setsda(chan, 1);
chan->algo.setscl(chan, 1);
udelay(20);
rc = i2c_bit_add_bus(&chan->adapter);
if (rc == 0)
dev_dbg(&chan->par->dev->dev, "I2C bus %s registered.\n",name);
else {
dev_warn(&chan->par->dev->dev, "Failed to register I2C bus "
"%s.\n", name);
chan->par = NULL;
}
return rc;
}
void i810_create_i2c_busses(struct i810fb_par *par)
{
par->chan[0].par = par;
par->chan[1].par = par;
par->chan[2].par = par;
par->chan[0].ddc_base = GPIOA;
i810_setup_i2c_bus(&par->chan[0], "I810-DDC");
par->chan[1].ddc_base = GPIOB;
i810_setup_i2c_bus(&par->chan[1], "I810-I2C");
par->chan[2].ddc_base = GPIOC;
i810_setup_i2c_bus(&par->chan[2], "I810-GPIOC");
}
void i810_delete_i2c_busses(struct i810fb_par *par)
{
if (par->chan[0].par)
i2c_del_adapter(&par->chan[0].adapter);
par->chan[0].par = NULL;
if (par->chan[1].par)
i2c_del_adapter(&par->chan[1].adapter);
par->chan[1].par = NULL;
if (par->chan[2].par)
i2c_del_adapter(&par->chan[2].adapter);
par->chan[2].par = NULL;
}
int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn)
{
struct i810fb_par *par = info->par;
u8 *edid = NULL;
DPRINTK("i810-i2c: Probe DDC%i Bus\n", conn+1);
if (conn < par->ddc_num) {
edid = fb_ddc_read(&par->chan[conn].adapter);
} else {
const u8 *e = fb_firmware_edid(info->device);
if (e != NULL) {
DPRINTK("i810-i2c: Getting EDID from BIOS\n");
edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
}
}
*out_edid = edid;
return (edid) ? 0 : 1;
}
|
#include <asm/assembler.h>
#include <asm/unwind.h>
#if __LINUX_ARM_ARCH__ >= 6
.macro bitop, name, instr
ENTRY( \name )
UNWIND( .fnstart )
ands ip, r1, #3
strneb r1, [ip] @ assert word-aligned
mov r2, #1
and r3, r0, #31 @ Get bit offset
mov r0, r0, lsr #5
add r1, r1, r0, lsl #2 @ Get word offset
#if __LINUX_ARM_ARCH__ >= 7
.arch_extension mp
ALT_SMP(W(pldw) [r1])
ALT_UP(W(nop))
#endif
mov r3, r2, lsl r3
1: ldrex r2, [r1]
\instr r2, r2, r3
strex r0, r2, [r1]
cmp r0, #0
bne 1b
bx lr
UNWIND( .fnend )
ENDPROC(\name )
.endm
.macro testop, name, instr, store
ENTRY( \name )
UNWIND( .fnstart )
ands ip, r1, #3
strneb r1, [ip] @ assert word-aligned
mov r2, #1
and r3, r0, #31 @ Get bit offset
mov r0, r0, lsr #5
add r1, r1, r0, lsl #2 @ Get word offset
mov r3, r2, lsl r3 @ create mask
smp_dmb
1: ldrex r2, [r1]
ands r0, r2, r3 @ save old value of bit
\instr r2, r2, r3 @ toggle bit
strex ip, r2, [r1]
cmp ip, #0
bne 1b
smp_dmb
cmp r0, #0
movne r0, #1
2: bx lr
UNWIND( .fnend )
ENDPROC(\name )
.endm
#else
.macro bitop, name, instr
ENTRY( \name )
UNWIND( .fnstart )
ands ip, r1, #3
strneb r1, [ip] @ assert word-aligned
and r2, r0, #31
mov r0, r0, lsr #5
mov r3, #1
mov r3, r3, lsl r2
save_and_disable_irqs ip
ldr r2, [r1, r0, lsl #2]
\instr r2, r2, r3
str r2, [r1, r0, lsl #2]
restore_irqs ip
ret lr
UNWIND( .fnend )
ENDPROC(\name )
.endm
/**
* testop - implement a test_and_xxx_bit operation.
* @instr: operational instruction
* @store: store instruction
*
* Note: we can trivially conditionalise the store instruction
* to avoid dirtying the data cache.
*/
.macro testop, name, instr, store
ENTRY( \name )
UNWIND( .fnstart )
ands ip, r1, #3
strneb r1, [ip] @ assert word-aligned
and r3, r0, #31
mov r0, r0, lsr #5
save_and_disable_irqs ip
ldr r2, [r1, r0, lsl #2]!
mov r0, #1
tst r2, r0, lsl r3
\instr r2, r2, r0, lsl r3
\store r2, [r1]
moveq r0, #0
restore_irqs ip
ret lr
UNWIND( .fnend )
ENDPROC(\name )
.endm
#endif
|
/*
OSMesa LDG loader
Copyright (C) 2004 Patrice Mandin
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*--- Includes ---*/
#include "lib-osmesa.h"
#include "nfosmesa_nfapi.h"
#define OSMESA_PROC(type, gl, name, export, upper, params, first, ret)
#define GL_GETSTRING(type, gl, name, export, upper, params, first, ret)
#define GL_GETSTRINGI(type, gl, name, export, upper, params, first, ret)
#define GL_PROC(type, gl, name, export, upper, params, first, ret) \
type APIENTRY gl ## name params \
{ \
ret (*HostCall_p)(NFOSMESA_GL ## upper, cur_context, first); \
}
#define GLU_PROC(type, gl, name, export, upper, params, first, ret) \
type APIENTRY gl ## name params \
{ \
ret (*HostCall_p)(NFOSMESA_GLU ## upper, cur_context, first); \
}
#include "glfuncs.h"
|
/* Copyright (c) 2010-2011, Code Aurora Forum. 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 version 2 and
* only 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.
*
*/
#ifndef __MSM_CHARGER_H__
#define __MSM_CHARGER_H__
#include <linux/power_supply.h>
#ifndef CONFIG_OPPO_MODIFY
#error
enum {
CHG_TYPE_USB,
CHG_TYPE_AC
};
#endif
enum msm_hardware_charger_event {
CHG_INSERTED_EVENT,
CHG_ENUMERATED_EVENT,
CHG_REMOVED_EVENT,
CHG_DONE_EVENT,
CHG_BATT_BEGIN_FAST_CHARGING,
CHG_BATT_CHG_RESUME,
CHG_BATT_TEMP_OUTOFRANGE,
CHG_BATT_TEMP_INRANGE,
CHG_BATT_INSERTED,
CHG_BATT_REMOVED,
CHG_BATT_STATUS_CHANGE,
CHG_BATT_NEEDS_RECHARGING,
};
/**
* enum hardware_charger_state
* @CHG_ABSENT_STATE: charger cable is unplugged
* @CHG_PRESENT_STATE: charger cable is plugged but charge current isnt drawn
* @CHG_READY_STATE: charger cable is plugged and kernel knows how much current
* it can draw
* @CHG_CHARGING_STATE: charger cable is plugged and current is drawn for
* charging
*/
enum msm_hardware_charger_state {
CHG_ABSENT_STATE,
CHG_PRESENT_STATE,
CHG_READY_STATE,
CHG_CHARGING_STATE,
};
struct msm_hardware_charger {
int type;
int rating;
const char *name;
int (*start_charging) (struct msm_hardware_charger *hw_chg,
int chg_voltage, int chg_current);
int (*stop_charging) (struct msm_hardware_charger *hw_chg);
int (*charging_switched) (struct msm_hardware_charger *hw_chg);
void (*start_system_current) (struct msm_hardware_charger *hw_chg,
int chg_current);
void (*stop_system_current) (struct msm_hardware_charger *hw_chg);
void *charger_private; /* used by the msm_charger.c */
};
struct msm_battery_gauge {
int (*get_battery_mvolts) (void);
int (*get_battery_temperature) (void);
int (*is_battery_present) (void);
int (*is_battery_temp_within_range) (void);
int (*is_battery_id_valid) (void);
int (*get_battery_status)(void);
int (*get_batt_remaining_capacity) (void);
int (*monitor_for_recharging) (void);
};
/**
* struct msm_charger_platform_data
* @safety_time: max charging time in minutes
* @update_time: how often the userland be updated of the charging progress
* @max_voltage: the max voltage the battery should be charged upto
* @min_voltage: the voltage where charging method switches from trickle to fast
* @get_batt_capacity_percent: a board specific function to return battery
* capacity. Can be null - a default one will be used
*/
struct msm_charger_platform_data {
unsigned int safety_time;
unsigned int update_time;
unsigned int max_voltage;
unsigned int min_voltage;
unsigned int (*get_batt_capacity_percent) (void);
};
typedef void (*notify_vbus_state) (int);
#if defined(CONFIG_BATTERY_MSM8X60) || defined(CONFIG_BATTERY_MSM8X60_MODULE)
void msm_battery_gauge_register(struct msm_battery_gauge *batt_gauge);
void msm_battery_gauge_unregister(struct msm_battery_gauge *batt_gauge);
int msm_charger_register(struct msm_hardware_charger *hw_chg);
int msm_charger_unregister(struct msm_hardware_charger *hw_chg);
int msm_charger_notify_event(struct msm_hardware_charger *hw_chg,
enum msm_hardware_charger_event event);
void msm_charger_vbus_draw(unsigned int mA);
int msm_charger_register_vbus_sn(void (*callback)(int));
void msm_charger_unregister_vbus_sn(void (*callback)(int));
#else
static inline void msm_battery_gauge_register(struct msm_battery_gauge *gauge)
{
}
static inline void msm_battery_gauge_unregister(struct msm_battery_gauge *gauge)
{
}
static inline int msm_charger_register(struct msm_hardware_charger *hw_chg)
{
return -ENXIO;
}
static inline int msm_charger_unregister(struct msm_hardware_charger *hw_chg)
{
return -ENXIO;
}
static inline int msm_charger_notify_event(struct msm_hardware_charger *hw_chg,
enum msm_hardware_charger_event event)
{
return -ENXIO;
}
static inline void msm_charger_vbus_draw(unsigned int mA)
{
}
static inline int msm_charger_register_vbus_sn(void (*callback)(int))
{
return -ENXIO;
}
static inline void msm_charger_unregister_vbus_sn(void (*callback)(int))
{
}
#endif
#endif /* __MSM_CHARGER_H__ */
|
/*
* Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
*
* Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
*
* Copyright (C) 2011 - 2012 TrilliumEMU <http://trilliumx.code-engine.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 TRILLIUM_OBJECTREGISTRY_H
#define TRILLIUM_OBJECTREGISTRY_H
#include "Define.h"
#include "Dynamic/UnorderedMap.h"
#include <ace/Singleton.h>
#include <string>
#include <vector>
#include <map>
/** ObjectRegistry holds all registry item of the same type
*/
template<class T, class Key = std::string>
class ObjectRegistry
{
public:
typedef std::map<Key, T *> RegistryMapType;
/// Returns a registry item
const T* GetRegistryItem(Key key) const
{
typename RegistryMapType::const_iterator iter = i_registeredObjects.find(key);
return( iter == i_registeredObjects.end() ? NULL : iter->second );
}
/// Inserts a registry item
bool InsertItem(T *obj, Key key, bool override = false)
{
typename RegistryMapType::iterator iter = i_registeredObjects.find(key);
if ( iter != i_registeredObjects.end() )
{
if ( !override )
return false;
delete iter->second;
i_registeredObjects.erase(iter);
}
i_registeredObjects[key] = obj;
return true;
}
/// Removes a registry item
void RemoveItem(Key key, bool delete_object = true)
{
typename RegistryMapType::iterator iter = i_registeredObjects.find(key);
if ( iter != i_registeredObjects.end() )
{
if ( delete_object )
delete iter->second;
i_registeredObjects.erase(iter);
}
}
/// Returns true if registry contains an item
bool HasItem(Key key) const
{
return (i_registeredObjects.find(key) != i_registeredObjects.end());
}
/// Inefficiently return a vector of registered items
unsigned int GetRegisteredItems(std::vector<Key> &l) const
{
unsigned int sz = l.size();
l.resize(sz + i_registeredObjects.size());
for (typename RegistryMapType::const_iterator iter = i_registeredObjects.begin(); iter != i_registeredObjects.end(); ++iter)
l[sz++] = iter->first;
return i_registeredObjects.size();
}
/// Return the map of registered items
RegistryMapType const &GetRegisteredItems() const
{
return i_registeredObjects;
}
ObjectRegistry() {}
~ObjectRegistry()
{
for (typename RegistryMapType::iterator iter=i_registeredObjects.begin(); iter != i_registeredObjects.end(); ++iter)
delete iter->second;
i_registeredObjects.clear();
}
private:
RegistryMapType i_registeredObjects;
};
#endif
|
#ifndef __ASM_SPINLOCK_H
#define __ASM_SPINLOCK_H
#include <asm/system.h>
#include <asm/processor.h>
#include <asm/spinlock_types.h>
static inline int arch_spin_is_locked(arch_spinlock_t *x)
{
volatile unsigned int *a = __ldcw_align(x);
return *a == 0;
}
#define arch_spin_lock(lock) arch_spin_lock_flags(lock, 0)
#define arch_spin_unlock_wait(x) \
do { cpu_relax(); } while (arch_spin_is_locked(x))
static inline void arch_spin_lock_flags(arch_spinlock_t *x,
unsigned long flags)
{
volatile unsigned int *a;
mb();
a = __ldcw_align(x);
while (__ldcw(a) == 0)
while (*a == 0)
if (flags & PSW_SM_I) {
local_irq_enable();
cpu_relax();
local_irq_disable();
} else
cpu_relax();
mb();
}
static inline void arch_spin_unlock(arch_spinlock_t *x)
{
volatile unsigned int *a;
mb();
a = __ldcw_align(x);
*a = 1;
mb();
}
static inline int arch_spin_trylock(arch_spinlock_t *x)
{
volatile unsigned int *a;
int ret;
mb();
a = __ldcw_align(x);
ret = __ldcw(a) != 0;
mb();
return ret;
}
static __inline__ void arch_read_lock(arch_rwlock_t *rw)
{
unsigned long flags;
local_irq_save(flags);
arch_spin_lock_flags(&rw->lock, flags);
rw->counter++;
arch_spin_unlock(&rw->lock);
local_irq_restore(flags);
}
static __inline__ void arch_read_unlock(arch_rwlock_t *rw)
{
unsigned long flags;
local_irq_save(flags);
arch_spin_lock_flags(&rw->lock, flags);
rw->counter--;
arch_spin_unlock(&rw->lock);
local_irq_restore(flags);
}
static __inline__ int arch_read_trylock(arch_rwlock_t *rw)
{
unsigned long flags;
retry:
local_irq_save(flags);
if (arch_spin_trylock(&rw->lock)) {
rw->counter++;
arch_spin_unlock(&rw->lock);
local_irq_restore(flags);
return 1;
}
local_irq_restore(flags);
/* If write-locked, we fail to acquire the lock */
if (rw->counter < 0)
return 0;
/* Wait until we have a realistic chance at the lock */
while (arch_spin_is_locked(&rw->lock) && rw->counter >= 0)
cpu_relax();
goto retry;
}
static __inline__ void arch_write_lock(arch_rwlock_t *rw)
{
unsigned long flags;
retry:
local_irq_save(flags);
arch_spin_lock_flags(&rw->lock, flags);
if (rw->counter != 0) {
arch_spin_unlock(&rw->lock);
local_irq_restore(flags);
while (rw->counter != 0)
cpu_relax();
goto retry;
}
rw->counter = -1; /* mark as write-locked */
mb();
local_irq_restore(flags);
}
static __inline__ void arch_write_unlock(arch_rwlock_t *rw)
{
rw->counter = 0;
arch_spin_unlock(&rw->lock);
}
static __inline__ int arch_write_trylock(arch_rwlock_t *rw)
{
unsigned long flags;
int result = 0;
local_irq_save(flags);
if (arch_spin_trylock(&rw->lock)) {
if (rw->counter == 0) {
rw->counter = -1;
result = 1;
} else {
/* Read-locked. Oh well. */
arch_spin_unlock(&rw->lock);
}
}
local_irq_restore(flags);
return result;
}
static __inline__ int arch_read_can_lock(arch_rwlock_t *rw)
{
return rw->counter >= 0;
}
static __inline__ int arch_write_can_lock(arch_rwlock_t *rw)
{
return !rw->counter;
}
#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
#define arch_spin_relax(lock) cpu_relax()
#define arch_read_relax(lock) cpu_relax()
#define arch_write_relax(lock) cpu_relax()
#endif /* __ASM_SPINLOCK_H */
|
/*
*/
#ifndef __TUNERBB_DRV_FC8050_H__
#define __TUNERBB_DRV_FC8050_H__
/*
*/
#include "../../broadcast_tdmb_typedef.h"
#include "../../broadcast_tdmb_drv_ifdef.h"
/*
*/
#define TDMB_UPLOAD_MODE_SPI
#if defined(TDMB_UPLOAD_MODE_TSIF)
//
#elif defined(TDMB_UPLOAD_MODE_EBI)
//
#elif defined(TDMB_UPLOAD_MODE_SPI)
#define STREAM_SPI_UPLOAD
#endif
//
//
//
//
#if defined(STREAM_TS_UPLOAD)
#define TSIF_EN_ACTIVE_HIGH
#endif
#if defined(STREAM_SLAVE_PARALLEL_UPLOAD)
#define DMB_IRQ_TYPE GPIO_INT_36 /* */
#define DMB_RESET_TYPE GPIO_INT_39 /* */
#define DMB_EN_TYPE GPIO_INT_41 /* */
#define DMB_CS_TYPE GPIO_INT_36 /* */
#define TDMB_RFBB_BASE_ADDR EBI2_GP3_BASE
#define DMB_PATTER_EN GPIO_INT_86 /* */
#define DMB_EAR_ANT_EN GPIO_INT_87 /* */
#endif
#define TDMB_RFBB_DEV_ADDR 0x80 /* */
#define TDMB_RFBB_RW_RETRY 3
typedef enum
{
TDMB_BB_DATA_TS,
TDMB_BB_DATA_DAB,
TDMB_BB_DATA_PACK,
TDMB_BB_DATA_FIC,
TDMB_BB_DATA_FIDC
} TDMB_BB_DATA_TYPE;
typedef struct
{
uint16 reserved;
uint8 subch_id;
uint16 size;
uint8 data_type:7;
uint8 ack_bit:1;
} TDMB_BB_HEADER_TYPE;
/*
*/
/*
*/
/*
*/
/*
*/
typedef enum fc8050_service_type
{
FC8050_DAB = 1,
FC8050_DMB = 2,
FC8050_VISUAL =3,
FC8050_DATA,
FC8050_ENSQUERY = 6, /* */
FC8050_BLT_TEST = 9,
FC8050_SERVICE_MAX
} fc8050_service_type;
/*
*/
/*
*/
/*
*/
extern int8 tunerbb_drv_fc8050_power_on(void);
extern int8 tunerbb_drv_fc8050_power_off(void);
extern int8 tunerbb_drv_fc8050_select_antenna(unsigned int sel);
extern int8 tunerbb_drv_fc8050_init(void);
extern int8 tunerbb_drv_fc8050_stop(void);
extern int8 tunerbb_drv_fc8050_get_ber(struct broadcast_tdmb_sig_info *dmb_bb_info);
extern int8 tunerbb_drv_fc8050_get_msc_ber(uint32 *msc_ber);
extern int8 tunerbb_drv_fc8050_set_channel(int32 freq_num, uint8 subch_id, uint8 op_mode);
extern int8 tunerbb_drv_fc8050_re_syncdetector(uint8 op_mode);
extern int8 tunerbb_drv_fc8050_re_sync(void);
extern int8 tunerbb_drv_fc8050_get_fic(uint8* buffer, uint32* buffer_size);
extern int8 tunerbb_drv_fc8050_control_fic(uint8 enable);
extern int8 tunerbb_drv_fc8050_read_data(uint8* buffer, uint32* buffer_size);
extern int8 tunerbb_drv_fc8050_multi_set_channel(int32 freq_num, uint8 subch_cnt, uint8 subch_id[ ], uint8 op_mode[ ]);
extern int8 tunerbb_drv_fc8050_process_multi_data(uint8 subch_cnt,uint8* input_buf, uint32 input_size, uint32* read_size);
extern int8 tunerbb_drv_fc8050_get_multi_data(uint8 subch_cnt, uint8* buf_ptr, uint32 buf_size);
extern int8 tunerbb_drv_fc8050_start_tii(void);
extern int8 tunerbb_drv_fc8050_check_tii(uint8 * pmain_tii,uint8 * psub_tii);
extern int8 tunerbb_drv_fc8050_reset_ch(void);
extern void tunerbb_drv_fc8050_set_userstop(int mode);
extern int tunerbb_drv_fc8050_is_on(void);
#endif /* */
|
/*
* Boa, an http server
* Copyright (C) 1999 Larry Doolittle <ldoolitt@boa.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 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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int open_pipe_fd(char *command);
int open_net_fd(char *spec);
int open_gen_fd(char *spec);
int open_pipe_fd(char *command)
{
int pipe_fds[2];
int pid;
/* "man pipe" says "filedes[0] is for reading,
* filedes[1] is for writing. */
if (pipe(pipe_fds) == -1)
return -1;
pid = fork();
if (pid == 0) {
close(pipe_fds[1]);
if (pipe_fds[0] != 0) {
dup2(pipe_fds[0], 0);
close(pipe_fds[0]);
}
execl("/bin/sh", "sh", "-c", command, (char *) 0);
exit(127);
}
close(pipe_fds[0]);
if (pid < 0) {
close(pipe_fds[1]);
return -1;
}
return pipe_fds[1];
}
int open_net_fd(char *spec)
{
char *p;
int fd, port;
struct sockaddr_in sa;
struct hostent *he;
p = strchr(spec, ':');
if (!p)
return -1;
*p++ = '\0';
port = strtol(p, NULL, 10);
sa.sin_family = AF_INET;
sa.sin_port = htons(port);
he = gethostbyname(spec);
if (!he) {
herror("open_net_fd");
return -1;
}
memcpy(&sa.sin_addr, he->h_addr, he->h_length);
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd < 0)
return fd;
if (connect(fd, (struct sockaddr *) &sa, sizeof (sa)) < 0)
return -1;
return fd;
}
int open_gen_fd(char *spec)
{
int fd;
if (*spec == '|') {
fd = open_pipe_fd(spec + 1);
} else if (*spec == ':') {
fd = open_net_fd(spec + 1);
} else {
fd = open(spec,
O_WRONLY | O_CREAT | O_APPEND,
S_IRUSR | S_IWUSR | S_IROTH | S_IRGRP);
}
return fd;
}
#ifdef STANDALONE_TEST
int main(int argc, char *argv[])
{
char buff[1024];
int fd, nr, nw;
if (argc < 2) {
fprintf(stderr,
"usage: %s output-filename\n"
" %s |output-command\n"
" %s :host:port\n", argv[0], argv[0], argv[0]);
return 1;
}
fd = open_gen_fd(argv[1]);
if (fd < 0) {
perror("open_gen_fd");
exit(1);
}
while ((nr = read(0, buff, sizeof (buff))) != 0) {
if (nr < 0) {
if (errno == EINTR)
continue;
perror("read");
exit(1);
}
nw = write(fd, buff, nr);
if (nw < 0) {
perror("write");
exit(1);
}
}
return 0;
}
#endif
|
#ifndef _ASM_POWERPC_COPRO_REGX_H
#define _ASM_POWERPC_COPRO_REGX_H
/*
* Copyright 2009 Michael Ellerman, IBM Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <asm/copro-driver.h>
#define _REGX_IOCTL_NR(_nr) (COPRO_UNIT_EXTN_NR_START + (_nr))
#define REGX_IOCTL_REQUEST_UM_PRIV _IO('c', _REGX_IOCTL_NR(0))
#define REGX_IOCTL_DROP_UM_PRIV _IO('c', _REGX_IOCTL_NR(1))
/* Register numbers for SET_REG/GET_REG ioctls */
#define REGX_REG_RXBPCR 0
#define REGX_REG_RXBP0SR 1
#define REGX_REG_RXBP1SR 2
#define REGX_REG_RXBP0HR 3
#define REGX_REG_RXBP1HR 4
#define REGX_REG_RXBP0MR0 5
#define REGX_REG_RXBP0MR1 6
#define REGX_REG_RXBP1MR0 7
#define REGX_REG_RXBP1MR1 8
#define REGX_REG_RXRBAR 9
/* Mask of valid bits for above registers */
#define RXBPCR_MASK 0xFF0307
#define RXBPnSR_MASK 0x1FFFFFFFFULL
#define RXBPnHR_MASK 0x1F1F1F1F1F1F1F00ULL
#define RXBPnMRn_MASK 0xFFFFFFFFULL
#endif /* _ASM_POWERPC_COPRO_REGX_H */
|
/*
* This file is part of the OregonCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _MMAP_TERRAIN_BUILDER_H
#define _MMAP_TERRAIN_BUILDER_H
#include "MMapCommon.h"
#include "MangosMap.h"
#include "../../src/game/MoveMapSharedDefines.h"
#include "WorldModel.h"
#include "G3D/Array.h"
#include "G3D/Vector3.h"
#include "G3D/Matrix3.h"
using namespace MaNGOS;
namespace MMAP
{
enum Spot
{
TOP = 1,
RIGHT = 2,
LEFT = 3,
BOTTOM = 4,
ENTIRE = 5
};
enum Grid
{
GRID_V8,
GRID_V9
};
static const int V9_SIZE = 129;
static const int V9_SIZE_SQ = V9_SIZE* V9_SIZE;
static const int V8_SIZE = 128;
static const int V8_SIZE_SQ = V8_SIZE* V8_SIZE;
static const float GRID_SIZE = 533.3333f;
static const float GRID_PART_SIZE = GRID_SIZE / V8_SIZE;
// see contrib/extractor/system.cpp, CONF_use_minHeight
static const float INVALID_MAP_LIQ_HEIGHT = -500.f;
static const float INVALID_MAP_LIQ_HEIGHT_MAX = 5000.0f;
// see following files:
// contrib/extractor/system.cpp
// src/game/GridMap.cpp
static char const* MAP_VERSION_MAGIC = "v1.3";
struct MeshData
{
G3D::Array<float> solidVerts;
G3D::Array<int> solidTris;
G3D::Array<float> liquidVerts;
G3D::Array<int> liquidTris;
G3D::Array<uint8> liquidType;
// offmesh connection data
G3D::Array<float> offMeshConnections; // [p0y,p0z,p0x,p1y,p1z,p1x] - per connection
G3D::Array<float> offMeshConnectionRads;
G3D::Array<unsigned char> offMeshConnectionDirs;
G3D::Array<unsigned char> offMeshConnectionsAreas;
G3D::Array<unsigned short> offMeshConnectionsFlags;
};
class TerrainBuilder
{
public:
TerrainBuilder(bool skipLiquid);
~TerrainBuilder();
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData);
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData);
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, const char* offMeshFilePath);
bool usesLiquids()
{
return !m_skipLiquid;
}
// vert and triangle methods
static void transform(vector<G3D::Vector3>& original, vector<G3D::Vector3>& transformed,
float scale, G3D::Matrix3& rotation, G3D::Vector3& position);
static void copyVertices(vector<G3D::Vector3>& source, G3D::Array<float>& dest);
static void copyIndices(vector<VMAP::MeshTriangle>& source, G3D::Array<int>& dest, int offest, bool flip);
static void copyIndices(G3D::Array<int>& src, G3D::Array<int>& dest, int offset);
static void cleanVertices(G3D::Array<float>& verts, G3D::Array<int>& tris);
private:
/// Loads a portion of a map's terrain
bool loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, Spot portion);
/// Sets loop variables for selecting only certain parts of a map's terrain
void getLoopVars(Spot portion, int& loopStart, int& loopEnd, int& loopInc);
/// Controls whether liquids are loaded
bool m_skipLiquid;
/// Load the map terrain from file
bool loadHeightMap(uint32 mapID, uint32 tileX, uint32 tileY, G3D::Array<float>& vertices, G3D::Array<int>& triangles, Spot portion);
/// Get the vector coordinate for a specific position
void getHeightCoord(int index, Grid grid, float xOffset, float yOffset, float* coord, float* v);
/// Get the triangle's vector indices for a specific position
void getHeightTriangle(int square, Spot triangle, int* indices, bool liquid = false);
/// Determines if the specific position's triangles should be rendered
bool isHole(int square, const uint16 holes[16][16]);
/// Get the liquid vector coordinate for a specific position
void getLiquidCoord(int index, int index2, float xOffset, float yOffset, float* coord, float* v);
/// Get the liquid type for a specific position
uint8 getLiquidType(int square, const uint8 liquid_type[16][16]);
// hide parameterless and copy constructor
TerrainBuilder();
TerrainBuilder(const TerrainBuilder& tb);
};
}
#endif
|
#ifndef SABASLIBRARY_H
#define SABASLIBRARY_H
#include "sabasbook.h"
#include <QObject>
#include <QList>
#include <QStringList>
class QMediaPlayer;
class QTimer;
class QNetworkAccessManager;
class QFileSystemWatcher;
class SabasLibrary : public QObject
{
Q_OBJECT
Q_PROPERTY(bool playing READ playing NOTIFY playingChanged)
Q_PROPERTY(qint64 trackDuration READ trackDuration NOTIFY trackDurationChanged)
Q_PROPERTY(qint64 trackPosition READ trackPosition WRITE setTrackPosition NOTIFY trackPositionChanged)
Q_PROPERTY(SabasBook* selectedBook READ selectedBook NOTIFY selectedBookChanged)
Q_PROPERTY(bool sleepTimerActive READ sleepTimerActive NOTIFY sleepTimerActiveChanged)
Q_PROPERTY(bool searchingCover READ searchingCover NOTIFY searchingCoverChanged)
Q_PROPERTY(QStringList books READ books NOTIFY booksChanged)
public:
explicit SabasLibrary(QObject *parent = 0);
~SabasLibrary();
Q_INVOKABLE SabasBook *at(int index);
qint64 trackDuration() const;
qint64 trackPosition() const;
SabasBook *selectedBook() const;
bool sleepTimerActive() const;
Q_INVOKABLE bool coverSearchEnabled() const;
bool searchingCover() const;
QStringList books() const;
public slots:
void toggle() const;
bool playing() const;
void skip(qint64 msec) const;
void stop();
void pause();
void play(SabasBook *book, bool fromBeginning = false);
void setTrackPosition(qint64 position);
void startSleepTimer(int minutes);
void stopSleepTimer();
void searchCover(SabasBook *book, const QString &customSearchString = "", bool feelingLucky = true);
void searchMissingCovers();
void downloadCover(const QString &url, SabasBook *forBook);
void setLibraryRootPath(const QString &path);
signals:
void playingChanged(bool playing);
void trackDurationChanged(qint64 duration);
void trackPositionChanged(qint64 position);
void selectedBookChanged(SabasBook* book);
void sleepTimerActiveChanged(bool isRunning);
void searchingCoverChanged(bool searching);
void booksChanged(QStringList books);
private:
void saveSettings();
void loadSettings();
void scanNewBooks();
void scanDeletedBooks();
void scanChanges(const QString &path);
bool isUnderLibraryPaths(const QString &path) const;
QList<SabasBook*> m_books;
QMediaPlayer *m_player;
QTimer *m_sleepTimer;
SabasBook *m_selectedBook;
QNetworkAccessManager *m_nam;
QStringList m_libraryRootPaths;
QTimer *m_saveTimer;
bool m_searchingCover;
QFileSystemWatcher *m_fsw;
};
#endif // SABASLIBRARY_H
|
#ifndef MESH_SORT_H
#define MESH_SORT_H
#include <ag_geometry.h>
#include "scenenode.h"
/**
The class is for sorting purpose only. It provides the operator() function, that's needed
for the STL-sorting algorithms.
Here SceneNodes are sorted by their middle distance the camera.
*/
class SortDistance
{
AGVector3 cam;
public:
SortDistance(AGVector3 c):cam(c){}
bool operator()(const SceneNode *n1,const SceneNode *n2);
};
/**
This is a sorting class, too. It sorts by the given "SortOrder" of the scene-nodes
*/
class SortOrder
{
public:
SortOrder(){}
bool operator()(const SceneNode *n1,const SceneNode *n2);
};
class SortYCoord
{
public:
SortYCoord(){}
bool operator()(const SceneNode *n1,const SceneNode *n2);
};
#endif
|
/*
* categorydialog.h
*
* Copyright 2013 Christian Herold <harryherold@googlemail.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 CATEGORYDIALOG_H
#define CATEGORYDIALOG_H
#include <QString>
#include <QDialog>
#include <util.h>
namespace Ui
{
class CategoryDialog;
}
class CategoryDialog : public QDialog
{
Q_OBJECT
public:
save_t save_mode;
explicit CategoryDialog(QWidget *parent = 0);
~CategoryDialog();
QString getCategoryText(void);
void setCategoryDesc( QString cat_desc );
public slots:
void slot_saveCategory( void );
signals:
void sig_saveCategory( CategoryDialog *cat_dialog );
private:
Ui::CategoryDialog *ui;
};
#endif // CATEGORYDIALOG_H
|
//
// FDFlowViewController.h
// FluxDeck
//
// Created by Ian Quick on 2013-08-10.
// Copyright (c) 2013 Ian Quick. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "FDFlow.h"
#import <Rebel.h>
@interface FDFlowViewController : RBLViewController<NSTableViewDataSource,NSTableViewDelegate>
-(IBAction)textEntered:(id)sender;
-(IBAction)attachFilePushed:(id)sender;
@property (nonatomic,weak) IBOutlet NSTextField *titleField;
@property (nonatomic,weak) IBOutlet RBLView *userView;
@property (nonatomic,weak) IBOutlet RBLView *titleView;
@property (nonatomic,weak) IBOutlet RBLTableView *chatTableView;
@property (nonatomic,weak) IBOutlet RBLTableView *userTableView;
@property (nonatomic,weak) IBOutlet NSTableView *influxTableView;
@property (nonatomic,strong) NSNumber *lastMessageID;
@property (nonatomic,strong) FDFlow *flow;
@property (nonatomic,strong) NSMutableArray *messages;
@property (nonatomic,strong) NSMutableArray *influx;
@property (nonatomic,assign) BOOL onScreen;
@property (nonatomic,assign) NSTimeInterval timeToRefresh;
@property (nonatomic,strong) NSMutableArray *imagesToRefresh;
@property (nonatomic,strong) NSTimer *imageTimer;
@property (nonatomic,assign) NSUInteger threadColorIndex;
@end
|
/*
* Copyright 2016 Peter Beard
* Distributed under the GNU GPL v2. For full terms, see the LICENSE file.
*
* Problem #6
*
* The sum of the squares of the first ten natural numbers is,
* 1^2 + 2^2 + ... + 10^2 = 385
*
* The square of the sum of the first ten natural numbers is,
* (1 + 2 + ... + 10)^2 = 552 = 3025
*
* Hence the difference between the sum of the squares of the first ten natural
* numbers and the square of the sum is 3025 − 385 = 2640.
*
* Find the difference between the sum of the squares of the first one hundred
* natural numbers and the square of the sum.
*/
#include <stdio.h>
int main()
{
int sum = 0;
int sum_of_squares = 0;
for(int n = 1; n <= 100; n++)
{
sum += n;
sum_of_squares += (n*n);
}
printf("The difference between the sums is %d.\n", (sum*sum - sum_of_squares));
}
|
/*
* $Id: stinger.c 2 2007-04-05 08:51:12Z tt $
*
* Copyright (c) 2000-2001 Vojtech Pavlik
* Copyright (c) 2000 Mark Fletcher
*/
/*
* Gravis Stinger gamepad driver for Linux
*/
/*
* This program is free warftware; 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
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/init.h>
#define DRIVER_DESC "Gravis Stinger gamepad driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
/*
* Constants.
*/
#define STINGER_MAX_LENGTH 8
/*
* Per-Stinger data.
*/
struct stinger {
struct input_dev *dev;
int idx;
unsigned char data[STINGER_MAX_LENGTH];
char phys[32];
};
/*
* stinger_process_packet() decodes packets the driver receives from the
* Stinger. It updates the data accordingly.
*/
static void stinger_process_packet(struct stinger *stinger, struct pt_regs *regs)
{
struct input_dev *dev = stinger->dev;
unsigned char *data = stinger->data;
if (!stinger->idx) return;
input_regs(dev, regs);
input_report_key(dev, BTN_A, ((data[0] & 0x20) >> 5));
input_report_key(dev, BTN_B, ((data[0] & 0x10) >> 4));
input_report_key(dev, BTN_C, ((data[0] & 0x08) >> 3));
input_report_key(dev, BTN_X, ((data[0] & 0x04) >> 2));
input_report_key(dev, BTN_Y, ((data[3] & 0x20) >> 5));
input_report_key(dev, BTN_Z, ((data[3] & 0x10) >> 4));
input_report_key(dev, BTN_TL, ((data[3] & 0x08) >> 3));
input_report_key(dev, BTN_TR, ((data[3] & 0x04) >> 2));
input_report_key(dev, BTN_SELECT, ((data[3] & 0x02) >> 1));
input_report_key(dev, BTN_START, (data[3] & 0x01));
input_report_abs(dev, ABS_X, (data[1] & 0x3F) - ((data[0] & 0x01) << 6));
input_report_abs(dev, ABS_Y, ((data[0] & 0x02) << 5) - (data[2] & 0x3F));
input_sync(dev);
return;
}
/*
* stinger_interrupt() is called by the low level driver when characters
* are ready for us. We then buffer them for further processing, or call the
* packet processing routine.
*/
static irqreturn_t stinger_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct stinger *stinger = serio_get_drvdata(serio);
/* All Stinger packets are 4 bytes */
if (stinger->idx < STINGER_MAX_LENGTH)
stinger->data[stinger->idx++] = data;
if (stinger->idx == 4) {
stinger_process_packet(stinger, regs);
stinger->idx = 0;
}
return IRQ_HANDLED;
}
/*
* stinger_disconnect() is the opposite of stinger_connect()
*/
static void stinger_disconnect(struct serio *serio)
{
struct stinger *stinger = serio_get_drvdata(serio);
serio_close(serio);
serio_set_drvdata(serio, NULL);
input_unregister_device(stinger->dev);
kfree(stinger);
}
/*
* stinger_connect() is the routine that is called when someone adds a
* new serio device that supports Stinger protocol and registers it as
* an input device.
*/
static int stinger_connect(struct serio *serio, struct serio_driver *drv)
{
struct stinger *stinger;
struct input_dev *input_dev;
int err = -ENOMEM;
stinger = kmalloc(sizeof(struct stinger), GFP_KERNEL);
input_dev = input_allocate_device();
if (!stinger || !input_dev)
goto fail;
stinger->dev = input_dev;
sprintf(stinger->phys, "%s/serio0", serio->phys);
input_dev->name = "Gravis Stinger";
input_dev->phys = stinger->phys;
input_dev->id.bustype = BUS_RS232;
input_dev->id.vendor = SERIO_STINGER;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = stinger;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) |
BIT(BTN_Y) | BIT(BTN_Z) | BIT(BTN_TL) | BIT(BTN_TR) |
BIT(BTN_START) | BIT(BTN_SELECT);
input_set_abs_params(input_dev, ABS_X, -64, 64, 0, 4);
input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 4);
serio_set_drvdata(serio, stinger);
err = serio_open(serio, drv);
if (err)
goto fail;
input_register_device(stinger->dev);
return 0;
fail: serio_set_drvdata(serio, NULL);
input_free_device(input_dev);
kfree(stinger);
return err;
}
/*
* The serio driver structure.
*/
static struct serio_device_id stinger_serio_ids[] = {
{
.type = SERIO_RS232,
.proto = SERIO_STINGER,
.id = SERIO_ANY,
.extra = SERIO_ANY,
},
{ 0 }
};
MODULE_DEVICE_TABLE(serio, stinger_serio_ids);
static struct serio_driver stinger_drv = {
.driver = {
.name = "stinger",
},
.description = DRIVER_DESC,
.id_table = stinger_serio_ids,
.interrupt = stinger_interrupt,
.connect = stinger_connect,
.disconnect = stinger_disconnect,
};
/*
* The functions for inserting/removing us as a module.
*/
static int __init stinger_init(void)
{
serio_register_driver(&stinger_drv);
return 0;
}
static void __exit stinger_exit(void)
{
serio_unregister_driver(&stinger_drv);
}
module_init(stinger_init);
module_exit(stinger_exit);
|
/* roadmap_sunrise.h - Calculate sunrise/sunset time
*
* LICENSE:
*
* Copyright 2003 Eric Domazlicky
*
* This file is part of RoadMap.
*
* RoadMap 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.
*
* RoadMap 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 RoadMap; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* DESCRIPTION:
*
* roadmap_sunrise() computes the time for sunrise at the specified location.
*
* roadmap_sunset() computes the time for sunset at the specified location.
*
* position: the longitude/latitude of the position considered.
*
* The function returns -1 on failure or the GMT time on success.
*
* LIMITATIONS:
*
* These functions won't work for latitudes at 63 and above or -63 and
* below.
*/
#ifndef INCLUDE__ROADMAP_SUNRISE__H
#define INCLUDE__ROADMAP_SUNRISE__H
#include <time.h>
#include "roadmap.h"
#include "roadmap_gps.h"
time_t roadmap_sunrise (const RoadMapGpsPosition *position, time_t now);
time_t roadmap_sunset (const RoadMapGpsPosition *position, time_t now);
#endif // INCLUDE__ROADMAP_SUNRISE_H
|
/*
* Dump R4x00 TLB for debugging purposes.
*
* Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle.
* Copyright (C) 1999 by Silicon Graphics, Inc.
*/
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <asm/bootinfo.h>
#include <asm/cachectl.h>
#include <asm/cpu.h>
#include <asm/mipsregs.h>
#include <asm/page.h>
#include <asm/pgtable.h>
void
dump_tlb(int first, int last)
{
int i;
unsigned int pagemask, c0, c1, asid;
unsigned long entryhi, entrylo0, entrylo1;
asid = get_entryhi() & 0xff;
for(i=first;i<=last;i++)
{
write_32bit_cp0_register(CP0_INDEX, i);
__asm__ __volatile__(
".set\tmips3\n\t"
".set\tnoreorder\n\t"
"nop;nop;nop;nop\n\t"
"tlbr\n\t"
"nop;nop;nop;nop\n\t"
".set\treorder\n\t"
".set\tmips0\n\t");
pagemask = read_32bit_cp0_register(CP0_PAGEMASK);
entryhi = read_32bit_cp0_register(CP0_ENTRYHI);
entrylo0 = read_32bit_cp0_register(CP0_ENTRYLO0);
entrylo1 = read_32bit_cp0_register(CP0_ENTRYLO1);
/* Unused entries have a virtual address of KSEG0. */
if ((entryhi & 0xffffe000) != 0x80000000
&& (entryhi & 0xff) == asid) {
/*
* Only print entries in use
*/
printk("Index: %2d pgmask=%08x ", i, pagemask);
c0 = (entrylo0 >> 3) & 7;
c1 = (entrylo1 >> 3) & 7;
printk("va=%08lx asid=%08lx"
" [pa=%06lx c=%d d=%d v=%d g=%ld]"
" [pa=%06lx c=%d d=%d v=%d g=%ld]",
(entryhi & 0xffffe000),
entryhi & 0xff,
entrylo0 & PAGE_MASK, c0,
(entrylo0 & 4) ? 1 : 0,
(entrylo0 & 2) ? 1 : 0,
(entrylo0 & 1),
entrylo1 & PAGE_MASK, c1,
(entrylo1 & 4) ? 1 : 0,
(entrylo1 & 2) ? 1 : 0,
(entrylo1 & 1));
}
}
printk("\n");
set_entryhi(asid);
}
void
dump_tlb_all(void)
{
dump_tlb(0, mips_cpu.tlbsize - 1);
}
void
dump_tlb_wired(void)
{
int wired;
wired = read_32bit_cp0_register(CP0_WIRED);
printk("Wired: %d", wired);
dump_tlb(0, read_32bit_cp0_register(CP0_WIRED));
}
#define BARRIER \
__asm__ __volatile__( \
".set\tnoreorder\n\t" \
"nop;nop;nop;nop;nop;nop;nop\n\t" \
".set\treorder");
void
dump_tlb_addr(unsigned long addr)
{
unsigned int flags, oldpid;
int index;
__save_and_cli(flags);
oldpid = get_entryhi() & 0xff;
BARRIER;
set_entryhi((addr & PAGE_MASK) | oldpid);
BARRIER;
tlb_probe();
BARRIER;
index = get_index();
set_entryhi(oldpid);
__restore_flags(flags);
if (index < 0) {
printk("No entry for address 0x%08lx in TLB\n", addr);
return;
}
printk("Entry %d maps address 0x%08lx\n", index, addr);
dump_tlb(index, index);
}
void
dump_tlb_nonwired(void)
{
dump_tlb(read_32bit_cp0_register(CP0_WIRED), mips_cpu.tlbsize - 1);
}
void
dump_list_process(struct task_struct *t, void *address)
{
pgd_t *page_dir, *pgd;
pmd_t *pmd;
pte_t *pte, page;
unsigned int addr;
unsigned long val;
addr = (unsigned int) address;
printk("Addr == %08x\n", addr);
printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd);
page_dir = pgd_offset(t->mm, 0);
printk("page_dir == %08x\n", (unsigned int) page_dir);
pgd = pgd_offset(t->mm, addr);
printk("pgd == %08x, ", (unsigned int) pgd);
pmd = pmd_offset(pgd, addr);
printk("pmd == %08x, ", (unsigned int) pmd);
pte = pte_offset(pmd, addr);
printk("pte == %08x, ", (unsigned int) pte);
page = *pte;
printk("page == %08x\n", (unsigned int) pte_val(page));
val = pte_val(page);
if (val & _PAGE_PRESENT) printk("present ");
if (val & _PAGE_READ) printk("read ");
if (val & _PAGE_WRITE) printk("write ");
if (val & _PAGE_ACCESSED) printk("accessed ");
if (val & _PAGE_MODIFIED) printk("modified ");
if (val & _PAGE_R4KBUG) printk("r4kbug ");
if (val & _PAGE_GLOBAL) printk("global ");
if (val & _PAGE_VALID) printk("valid ");
printk("\n");
}
void
dump_list_current(void *address)
{
dump_list_process(current, address);
}
unsigned int
vtop(void *address)
{
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
unsigned int addr, paddr;
addr = (unsigned long) address;
pgd = pgd_offset(current->mm, addr);
pmd = pmd_offset(pgd, addr);
pte = pte_offset(pmd, addr);
paddr = (KSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK;
paddr |= (addr & ~PAGE_MASK);
return paddr;
}
void
dump16(unsigned long *p)
{
int i;
for (i=0;i<8;i++) {
printk("*%08lx == %08lx, ", (unsigned long)p, p[0]);
printk("*%08lx == %08lx\n", (unsigned long)p, p[1]);
p += 2;
}
}
|
#include "tpm.h"
#include "tpm_atmel.h"
enum tpm_atmel_write_status {
ATML_STATUS_ABORT = 0x01,
ATML_STATUS_LASTBYTE = 0x04
};
enum tpm_atmel_read_status {
ATML_STATUS_BUSY = 0x01,
ATML_STATUS_DATA_AVAIL = 0x02,
ATML_STATUS_REWRITE = 0x04,
ATML_STATUS_READY = 0x08
};
static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
{
u8 status, *hdr = buf;
u32 size;
int i;
__be32 *native_size;
if (count < 6)
return -EIO;
for (i = 0; i < 6; i++) {
status = ioread8(chip->vendor.iobase + 1);
if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
dev_err(chip->dev, "error reading header\n");
return -EIO;
}
*buf++ = ioread8(chip->vendor.iobase);
}
native_size = (__force __be32 *) (hdr + 2);
size = be32_to_cpu(*native_size);
if (count < size) {
dev_err(chip->dev,
"Recv size(%d) less than available space\n", size);
for (; i < size; i++) {
status = ioread8(chip->vendor.iobase + 1);
if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
dev_err(chip->dev, "error reading data\n");
return -EIO;
}
}
return -EIO;
}
for (; i < size; i++) {
status = ioread8(chip->vendor.iobase + 1);
if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
dev_err(chip->dev, "error reading data\n");
return -EIO;
}
*buf++ = ioread8(chip->vendor.iobase);
}
status = ioread8(chip->vendor.iobase + 1);
if (status & ATML_STATUS_DATA_AVAIL) {
dev_err(chip->dev, "data available is stuck\n");
return -EIO;
}
return size;
}
static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count)
{
int i;
dev_dbg(chip->dev, "tpm_atml_send:\n");
for (i = 0; i < count; i++) {
dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]);
iowrite8(buf[i], chip->vendor.iobase);
}
return count;
}
static void tpm_atml_cancel(struct tpm_chip *chip)
{
iowrite8(ATML_STATUS_ABORT, chip->vendor.iobase + 1);
}
static u8 tpm_atml_status(struct tpm_chip *chip)
{
return ioread8(chip->vendor.iobase + 1);
}
static const struct file_operations atmel_ops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.open = tpm_open,
.read = tpm_read,
.write = tpm_write,
.release = tpm_release,
};
static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
static DEVICE_ATTR(cancel, S_IWUSR |S_IWGRP, NULL, tpm_store_cancel);
static struct attribute* atmel_attrs[] = {
&dev_attr_pubek.attr,
&dev_attr_pcrs.attr,
&dev_attr_caps.attr,
&dev_attr_cancel.attr,
NULL,
};
static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs };
static const struct tpm_vendor_specific tpm_atmel = {
.recv = tpm_atml_recv,
.send = tpm_atml_send,
.cancel = tpm_atml_cancel,
.status = tpm_atml_status,
.req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
.req_complete_val = ATML_STATUS_DATA_AVAIL,
.req_canceled = ATML_STATUS_READY,
.attr_group = &atmel_attr_grp,
.miscdev = { .fops = &atmel_ops, },
};
static struct platform_device *pdev;
static void atml_plat_remove(void)
{
struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);
if (chip) {
if (chip->vendor.have_region)
atmel_release_region(chip->vendor.base,
chip->vendor.region_size);
atmel_put_base_addr(chip->vendor.iobase);
tpm_remove_hardware(chip->dev);
platform_device_unregister(pdev);
}
}
static int tpm_atml_suspend(struct platform_device *dev, pm_message_t msg)
{
return tpm_pm_suspend(&dev->dev, msg);
}
static int tpm_atml_resume(struct platform_device *dev)
{
return tpm_pm_resume(&dev->dev);
}
static struct platform_driver atml_drv = {
.driver = {
.name = "tpm_atmel",
.owner = THIS_MODULE,
},
.suspend = tpm_atml_suspend,
.resume = tpm_atml_resume,
};
static int __init init_atmel(void)
{
int rc = 0;
void __iomem *iobase = NULL;
int have_region, region_size;
unsigned long base;
struct tpm_chip *chip;
rc = platform_driver_register(&atml_drv);
if (rc)
return rc;
if ((iobase = atmel_get_base_addr(&base, ®ion_size)) == NULL) {
rc = -ENODEV;
goto err_unreg_drv;
}
have_region =
(atmel_request_region
(tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1;
pdev = platform_device_register_simple("tpm_atmel", -1, NULL, 0);
if (IS_ERR(pdev)) {
rc = PTR_ERR(pdev);
goto err_rel_reg;
}
if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_atmel))) {
rc = -ENODEV;
goto err_unreg_dev;
}
chip->vendor.iobase = iobase;
chip->vendor.base = base;
chip->vendor.have_region = have_region;
chip->vendor.region_size = region_size;
return 0;
err_unreg_dev:
platform_device_unregister(pdev);
err_rel_reg:
atmel_put_base_addr(iobase);
if (have_region)
atmel_release_region(base,
region_size);
err_unreg_drv:
platform_driver_unregister(&atml_drv);
return rc;
}
static void __exit cleanup_atmel(void)
{
platform_driver_unregister(&atml_drv);
atml_plat_remove();
}
module_init(init_atmel);
module_exit(cleanup_atmel);
MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
MODULE_DESCRIPTION("TPM Driver");
MODULE_VERSION("2.0");
MODULE_LICENSE("GPL");
|
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <linux/memblock.h>
#include <asm/proto.h>
/*
* Some BIOSes seem to corrupt the low 64k of memory during events
* like suspend/resume and unplugging an HDMI cable. Reserve all
* remaining free memory in that area and fill it with a distinct
* pattern.
*/
#define MAX_SCAN_AREAS 8
static int __read_mostly memory_corruption_check = -1;
static unsigned __read_mostly corruption_check_size = 64*1024;
static unsigned __read_mostly corruption_check_period = 60; /* seconds */
static struct scan_area {
u64 addr;
u64 size;
} scan_areas[MAX_SCAN_AREAS];
static int num_scan_areas;
static __init int set_corruption_check(char *arg)
{
char *end;
memory_corruption_check = simple_strtol(arg, &end, 10);
return (*end == 0) ? 0 : -EINVAL;
}
early_param("memory_corruption_check", set_corruption_check);
static __init int set_corruption_check_period(char *arg)
{
char *end;
corruption_check_period = simple_strtoul(arg, &end, 10);
return (*end == 0) ? 0 : -EINVAL;
}
early_param("memory_corruption_check_period", set_corruption_check_period);
static __init int set_corruption_check_size(char *arg)
{
char *end;
unsigned size;
size = memparse(arg, &end);
if (*end == '\0')
corruption_check_size = size;
return (size == corruption_check_size) ? 0 : -EINVAL;
}
early_param("memory_corruption_check_size", set_corruption_check_size);
/* suspend, resume할때 bios의 64KB를 60초마다 체크한다. */
void __init setup_bios_corruption_check(void)
{
u64 addr = PAGE_SIZE; /* assume first page is reserved anyway */
if (memory_corruption_check == -1) {
memory_corruption_check =
/* 변태적인놈의 코딩 */
#ifdef CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK
1
#else
0
#endif
;
}
if (corruption_check_size == 0)
memory_corruption_check = 0;
if (!memory_corruption_check)
return;
/* 올림 */
corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
/* 체크사이즈는 기본 64KB, 검사 주기는 60초
* 0부터 크기를 넘지 않거나 체크할 최대갯수(8개)를 넘지 않으면 계속 체크
*/
while (addr < corruption_check_size && num_scan_areas < MAX_SCAN_AREAS) {
u64 size;
/* 사용가능한 메모리 블럭 시작주소를 구함 */
addr = memblock_x86_find_in_range_size(addr, &size, PAGE_SIZE);
if (addr == MEMBLOCK_ERROR) /* 크기가 안됨 */
break;
/* 할당불가, 역시 예외처리 */
if (addr >= corruption_check_size)
break;
/* addr부터 체크사이즈만큼의 크기 */
if ((addr + size) > corruption_check_size)
size = corruption_check_size - addr;
/* scan ram으로 등록 */
memblock_x86_reserve_range(addr, addr + size, "SCAN RAM");
scan_areas[num_scan_areas].addr = addr;
scan_areas[num_scan_areas].size = size;
num_scan_areas++;
/* Assume we've already mapped this early memory */
/* 0으로 set해서 체크한다. */
memset(__va(addr), 0, size);
addr += size;
}
if (num_scan_areas)
printk(KERN_INFO "Scanning %d areas for low memory corruption\n", num_scan_areas);
}
void check_for_bios_corruption(void)
{
int i;
int corruption = 0;
if (!memory_corruption_check)
return;
for (i = 0; i < num_scan_areas; i++) {
unsigned long *addr = __va(scan_areas[i].addr);
unsigned long size = scan_areas[i].size;
for (; size; addr++, size -= sizeof(unsigned long)) {
if (!*addr)
continue;
printk(KERN_ERR "Corrupted low memory at %p (%lx phys) = %08lx\n",
addr, __pa(addr), *addr);
corruption = 1;
*addr = 0;
}
}
WARN_ONCE(corruption, KERN_ERR "Memory corruption detected in low memory\n");
}
static void check_corruption(struct work_struct *dummy);
static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
static void check_corruption(struct work_struct *dummy)
{
check_for_bios_corruption();
schedule_delayed_work(&bios_check_work,
round_jiffies_relative(corruption_check_period*HZ));
}
static int start_periodic_check_for_corruption(void)
{
if (!num_scan_areas || !memory_corruption_check || corruption_check_period == 0)
return 0;
printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
corruption_check_period);
/* First time we run the checks right away */
schedule_delayed_work(&bios_check_work, 0);
return 0;
}
module_init(start_periodic_check_for_corruption);
|
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/vad/include/webrtc_vad.h"
#include <stdlib.h>
#include <string.h>
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "common_audio/vad/vad_core.h"
static const int kInitCheck = 42;
static const int kValidRates[] = {8000, 16000, 32000, 48000};
static const size_t kRatesSize = sizeof(kValidRates) / sizeof(*kValidRates);
static const int kMaxFrameLengthMs = 30;
VadInst* WebRtcVad_Create()
{
VadInstT* self = (VadInstT*)malloc(sizeof(VadInstT));
WebRtcSpl_Init();
self->init_flag = 0;
return (VadInst*)self;
}
void WebRtcVad_Free(VadInst* handle)
{
free(handle);
}
// TODO(bjornv): Move WebRtcVad_InitCore() code here.
int WebRtcVad_Init(VadInst* handle)
{
// Initialize the core VAD component.
return WebRtcVad_InitCore((VadInstT*)handle);
}
// TODO(bjornv): Move WebRtcVad_set_mode_core() code here.
int WebRtcVad_set_mode(VadInst* handle, int mode)
{
VadInstT* self = (VadInstT*)handle;
if (handle == NULL)
{
return -1;
}
if (self->init_flag != kInitCheck)
{
return -1;
}
return WebRtcVad_set_mode_core(self, mode);
}
int WebRtcVad_Process(VadInst* handle, int fs, const int16_t* audio_frame,
size_t frame_length)
{
int vad = -1;
VadInstT* self = (VadInstT*)handle;
if (handle == NULL)
{
return -1;
}
if (self->init_flag != kInitCheck)
{
return -1;
}
if (audio_frame == NULL)
{
return -1;
}
if (WebRtcVad_ValidRateAndFrameLength(fs, frame_length) != 0)
{
return -1;
}
if (fs == 48000)
{
vad = WebRtcVad_CalcVad48khz(self, audio_frame, frame_length);
}
else if (fs == 32000)
{
vad = WebRtcVad_CalcVad32khz(self, audio_frame, frame_length);
}
else if (fs == 16000)
{
vad = WebRtcVad_CalcVad16khz(self, audio_frame, frame_length);
}
else if (fs == 8000)
{
vad = WebRtcVad_CalcVad8khz(self, audio_frame, frame_length);
}
if (vad > 0)
{
vad = 1;
}
return vad;
}
int WebRtcVad_ValidRateAndFrameLength(int rate, size_t frame_length)
{
int return_value = -1;
size_t i;
int valid_length_ms;
size_t valid_length;
// We only allow 10, 20 or 30 ms frames. Loop through valid frame rates and
// see if we have a matching pair.
for (i = 0; i < kRatesSize; i++)
{
if (kValidRates[i] == rate)
{
for (valid_length_ms = 10; valid_length_ms <= kMaxFrameLengthMs;
valid_length_ms += 10)
{
valid_length = (size_t)(kValidRates[i] / 1000 * valid_length_ms);
if (frame_length == valid_length)
{
return_value = 0;
break;
}
}
break;
}
}
return return_value;
}
|
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/serial_8250.h>
#include <linux/smsc911x.h>
#include <linux/interrupt.h>
#include <plat/gpmc.h>
#define ZOOM_SMSC911X_CS 7
#define ZOOM_SMSC911X_GPIO 158
#define ZOOM_QUADUART_CS 3
#define ZOOM_QUADUART_GPIO 102
#define QUART_CLK 1843200
#define DEBUG_BASE 0x08000000
#define ZOOM_ETHR_START DEBUG_BASE
static struct resource zoom_smsc911x_resources[] = {
[0] = {
.start = ZOOM_ETHR_START,
.end = ZOOM_ETHR_START + SZ_4K,
.flags = IORESOURCE_MEM,
},
[1] = {
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
},
};
static struct smsc911x_platform_config zoom_smsc911x_config = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = SMSC911X_USE_32BIT,
.phy_interface = PHY_INTERFACE_MODE_MII,
};
static struct platform_device zoom_smsc911x_device = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(zoom_smsc911x_resources),
.resource = zoom_smsc911x_resources,
.dev = {
.platform_data = &zoom_smsc911x_config,
},
};
static inline void __init zoom_init_smsc911x(void)
{
int eth_cs;
unsigned long cs_mem_base;
int eth_gpio = 0;
eth_cs = ZOOM_SMSC911X_CS;
if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
return;
}
zoom_smsc911x_resources[0].start = cs_mem_base + 0x0;
zoom_smsc911x_resources[0].end = cs_mem_base + 0xff;
eth_gpio = ZOOM_SMSC911X_GPIO;
zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
eth_gpio);
return;
}
gpio_direction_input(eth_gpio);
}
static struct plat_serial8250_port serial_platform_data[] = {
{
.mapbase = ZOOM_UART_BASE,
.irq = OMAP_GPIO_IRQ(102),
.flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
.irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING,
.iotype = UPIO_MEM,
.regshift = 1,
.uartclk = QUART_CLK,
}, {
.flags = 0
}
};
static struct platform_device zoom_debugboard_serial_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = serial_platform_data,
},
};
static inline void __init zoom_init_quaduart(void)
{
int quart_cs;
unsigned long cs_mem_base;
int quart_gpio = 0;
quart_cs = ZOOM_QUADUART_CS;
if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
printk(KERN_ERR "Failed to request GPMC mem"
"for Quad UART(TL16CP754C)\n");
return;
}
quart_gpio = ZOOM_QUADUART_GPIO;
if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) {
printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
quart_gpio);
return;
}
gpio_direction_input(quart_gpio);
}
static inline int omap_zoom_debugboard_detect(void)
{
int debug_board_detect = 0;
int ret = 1;
debug_board_detect = ZOOM_SMSC911X_GPIO;
if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) {
printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"
"board detect\n", debug_board_detect);
return 0;
}
gpio_direction_input(debug_board_detect);
if (!gpio_get_value(debug_board_detect)) {
ret = 0;
}
gpio_free(debug_board_detect);
return ret;
}
static struct platform_device *zoom_devices[] __initdata = {
&zoom_smsc911x_device,
&zoom_debugboard_serial_device,
};
int __init zoom_debugboard_init(void)
{
if (!omap_zoom_debugboard_detect())
return 0;
zoom_init_smsc911x();
zoom_init_quaduart();
return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
}
|
/* Copyright (c) 2004, 2017, Oracle and/or its affiliates. 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; 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 _mysql_time_h_
#define _mysql_time_h_
/**
@file include/mysql_time.h
Time declarations shared between the server and client API:
you should not add anything to this header unless it's used
(and hence should be visible) in mysql.h.
If you're looking for a place to add new time-related declaration,
it's most likely my_time.h. See also "C API Handling of Date
and Time Values" chapter in documentation.
*/
#include "my_inttypes.h"
enum enum_mysql_timestamp_type
{
MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
};
/*
Structure which is used to represent datetime values inside MySQL.
We assume that values in this structure are normalized, i.e. year <= 9999,
month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
in server such as my_system_gmt_sec() or make_time() family of functions
rely on this (actually now usage of make_*() family relies on a bit weaker
restriction). Also functions that produce MYSQL_TIME as result ensure this.
There is one exception to this rule though if this structure holds time
value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
bigger values.
*/
typedef struct st_mysql_time
{
unsigned int year, month, day, hour, minute, second;
unsigned long second_part; /**< microseconds */
bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
#endif /* _mysql_time_h_ */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 AMD
* Written by Yinghai Lu <yinghailu@amd.com> for AMD.
*
* 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
*/
#define K8_REV_F_SUPPORT_F0_F1_WORKAROUND 0
#include <stdint.h>
#include <device/pci_def.h>
#include <device/pci_ids.h>
#include <arch/io.h>
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <cpu/x86/lapic.h>
#include <pc80/mc146818rtc.h>
#include "lib/uart8250.c"
#include "arch/x86/lib/printk_init.c"
#include "console/vtxprintf.c"
#include "console/console.c"
#include <cpu/amd/model_fxx_rev.h>
#include "northbridge/amd/amdk8/raminit.h"
#include "lib/delay.c"
#include "northbridge/amd/amdk8/reset_test.c"
#include "northbridge/amd/amdk8/debug.c"
#include "southbridge/nvidia/mcp55/mcp55_early_ctrl.c"
#include "northbridge/amd/amdk8/amdk8_f.h"
#include "cpu/x86/mtrr.h"
#include "cpu/amd/mtrr.h"
#include "cpu/x86/tsc.h"
#include "northbridge/amd/amdk8/amdk8_f_pci.c"
#include "northbridge/amd/amdk8/raminit_f_dqs.c"
#include "cpu/amd/dualcore/dualcore.c"
void hardwaremain(int ret_addr)
{
struct sys_info *sysinfo = &sysinfo_car; // in CACHE
struct sys_info *sysinfox = ((CONFIG_RAMTOP) - sizeof(*sysinfox)); // in RAM
struct node_core_id id;
id = get_node_core_id_x();
//FIXME: for USBDEBUG you need to make sure dbg_info get assigned in AP
print_debug("CODE IN CACHE ON NODE:"); print_debug_hex8(id.nodeid); print_debug("\n");
train_ram(id.nodeid, sysinfo, sysinfox);
/*
* go back, but can not use stack any more, because we only keep
* ret_addr and can not restore esp, and ebp
*/
__asm__ volatile (
"movl %0, %%edi\n\t"
"jmp *%%edi\n\t"
:: "a"(ret_addr)
);
}
#include <arch/registers.h>
void x86_exception(struct eregs *info)
{
do {
hlt();
} while(1);
}
|
/****************************************************************************
** $Id: archivedialog.ui.h 2 2005-11-16 15:49:26Z dmik $
**
** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
**
** This file is part of an example program for Qt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/
void ArchiveDialog::init()
{
connect(&articleSearcher, SIGNAL(done(bool)), this, SLOT(searchDone(bool)));
connect(&articleFetcher, SIGNAL(done(bool)), this, SLOT(fetchDone(bool)));
connect(myListView, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(fetch(QListViewItem*)));
connect(myLineEdit, SIGNAL(returnPressed()), this, SLOT(search()));
connect(myListView, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(fetch(QListViewItem*)));
connect(myPushButton, SIGNAL(clicked()), this, SLOT(close()));
}
void ArchiveDialog::fetch( QListViewItem *it )
{
QUrl u(it->text(1));
articleFetcher.setHost(u.host());
articleFetcher.get(it->text(1));
}
void ArchiveDialog::fetchDone( bool error )
{
if (error) {
QMessageBox::critical(this, "Error fetching",
"An error occurred when fetching this document: "
+ articleFetcher.errorString(),
QMessageBox::Ok, QMessageBox::NoButton);
} else {
myTextBrowser->setText(articleFetcher.readAll());
}
}
void ArchiveDialog::search()
{
if (articleSearcher.state() == QHttp::HostLookup
|| articleSearcher.state() == QHttp::Connecting
|| articleSearcher.state() == QHttp::Sending
|| articleSearcher.state() == QHttp::Reading) {
articleSearcher.abort();
}
if (myLineEdit->text() == "") {
QMessageBox::critical(this, "Empty query",
"Please type a search string.",
QMessageBox::Ok, QMessageBox::NoButton);
} else {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
articleSearcher.setHost("www.trolltech.com");
QHttpRequestHeader header("POST", "/search.html");
header.setValue("Host", "www.trolltech.com");
header.setContentType("application/x-www-form-urlencoded");
QString encodedTopic = myLineEdit->text();
QUrl::encode(encodedTopic);
QString searchString = "qt-interest=on&search=" + encodedTopic;
articleSearcher.request(header, searchString.utf8());
}
}
void ArchiveDialog::searchDone( bool error )
{
if (error) {
QMessageBox::critical(this, "Error searching",
"An error occurred when searching: "
+ articleSearcher.errorString(),
QMessageBox::Ok, QMessageBox::NoButton);
} else {
QString result(articleSearcher.readAll());
QRegExp rx("<a href=\"(http://lists\\.trolltech\\.com/qt-interest/.*)\">(.*)</a>");
rx.setMinimal(TRUE);
int pos = 0;
while (pos >= 0) {
pos = rx.search(result, pos);
if (pos > -1) {
pos += rx.matchedLength();
new QListViewItem(myListView, rx.cap(2), rx.cap(1));
}
}
}
QApplication::restoreOverrideCursor();
}
|
/*
* Copyright (c) 2015 - 2025 MaiKe Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "user_config.h"
irom void relay_all_on()
{
INFO("set all relay on\r\n");
digitalWrite(D4, HIGH);
digitalWrite(D5, HIGH);
digitalWrite(D6, HIGH);
digitalWrite(D7, HIGH);
digitalWrite(15, HIGH);
}
irom void relay_all_off()
{
INFO("set all relay off\r\n");
digitalWrite(D4, LOW);
digitalWrite(D5, LOW);
digitalWrite(D6, LOW);
digitalWrite(D7, LOW);
digitalWrite(15, LOW);
}
irom void relay_init()
{
pinMode(D4, OUTPUT);
pinMode(D5, OUTPUT);
pinMode(D6, OUTPUT);
pinMode(D7, OUTPUT);
pinMode(15, OUTPUT);
relay_set_status(NULL);
}
irom void relay_set_status(relay_status_t *st)
{
if(st == NULL) {
extern ctrl_status_t ctrl_st;
st = &(ctrl_st.relay_status);
}
digitalWrite(D4, (st->r1) & 0x1);
digitalWrite(D5, (st->r2) & 0x1);
digitalWrite(D6, (st->r3) & 0x1);
digitalWrite(D7, (st->r4) & 0x1);
digitalWrite(15, (st->r5) & 0x1);
}
irom void relay_get_status(relay_status_t *st)
{
st->r1 = digitalRead(D4);
st->r1 = digitalRead(D5);
st->r3 = digitalRead(D6);
st->r4 = digitalRead(D7);
st->r5 = digitalRead(15);
}
|
/*-
* Copyright (c) 1990 The Regents of the University of California.
* Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)sscanf.c 5.1 (Berkeley) 1/20/91";*/
static char *rcsid = "$Id$";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <string.h>
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include "local.h"
#if __STDC__
sscanf(const char *str, char const *fmt, ...)
#else
sscanf(str, fmt, va_alist)
const char *str;
char *fmt;
va_dcl
#endif
{
int ret;
va_list ap;
FILE f;
f._flags = __SRD;
f._file = -1;
f._bf._base = f._p = (unsigned char *)str;
f._bf._size = f._r = strlen(str);
f._ub._base = NULL;
f._lb._base = NULL;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
ret = __svfscanf(&f, fmt, ap);
va_end(ap);
return (ret);
}
|
/* pidgin
*
* Pidgin 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 __PIDGIN_STATUS_BOX_H__
#define __PIDGIN_STATUS_BOX_H__
/**
* SECTION:gtkstatusbox
* @section_id: pidgin-gtkstatusbox
* @short_description: <filename>gtkstatusbox.h</filename>
* @title: Status Selection Widget
*/
#include <gtk/gtk.h>
#include "gtkwebview.h"
#include "account.h"
#include "imgstore.h"
#include "savedstatuses.h"
#include "status.h"
G_BEGIN_DECLS
#define PIDGIN_TYPE_STATUS_BOX (pidgin_status_box_get_type ())
#define PIDGIN_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STATUS_BOX, PidginStatusBox))
#define PIDGIN_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
#define PIDGIN_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STATUS_BOX))
#define PIDGIN_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), PIDGIN_TYPE_STATUS_BOX))
#define PIDGIN_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
/**
* PidginStatusBoxItemType:
*
* This is a hidden field in the GtkStatusBox that identifies the
* item in the list store. The item could be a normal
* PurpleStatusPrimitive, or it could be something special like the
* "Custom..." item, or "Saved..." or a GtkSeparator.
*/
typedef enum
{
PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
PIDGIN_STATUS_BOX_TYPE_POPULAR,
PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
PIDGIN_STATUS_BOX_TYPE_CUSTOM,
PIDGIN_STATUS_BOX_TYPE_SAVED,
PIDGIN_STATUS_BOX_NUM_TYPES
} PidginStatusBoxItemType;
typedef struct _PidginStatusBox PidginStatusBox;
typedef struct _PidginStatusBoxClass PidginStatusBoxClass;
/**
* PidginStatusBox:
* @store: This GtkListStore contains only one row--the currently
* selected status.
* @dropdown_store: This is the dropdown GtkListStore that contains the
* available statuses, plus some recently used statuses, plus
* the "Custom..." and "Saved..." options.
* @token_status_account: This will be non-NULL and contain a sample account
* when all enabled accounts use the same statuses
*/
struct _PidginStatusBox
{
GtkContainer parent_instance;
/*< public >*/
GtkListStore *store;
GtkListStore *dropdown_store;
PurpleAccount *account;
PurpleAccount *token_status_account;
GtkWidget *vbox, *sw;
GtkWidget *webview;
PurpleStoredImage *buddy_icon_img;
GdkPixbuf *buddy_icon;
GdkPixbuf *buddy_icon_hover;
GtkWidget *buddy_icon_sel;
GtkWidget *icon;
GtkWidget *icon_box;
GtkWidget *icon_box_menu;
GdkCursor *hand_cursor;
GdkCursor *arrow_cursor;
int icon_size;
gboolean icon_opaque;
gboolean webview_visible;
GtkWidget *cell_view;
GtkCellRenderer *icon_rend;
GtkCellRenderer *text_rend;
GdkPixbuf *error_pixbuf;
int connecting_index;
GdkPixbuf *connecting_pixbufs[9];
int typing_index;
GdkPixbuf *typing_pixbufs[6];
gboolean network_available;
gboolean connecting;
guint typing;
GtkTreeIter iter;
char *error;
/*
* These widgets are made for renderin'
* That's just what they'll do
* One of these days these widgets
* Are gonna render all over you
*/
GtkWidget *hbox;
GtkWidget *toggle_button;
GtkWidget *vsep;
GtkWidget *arrow;
GtkWidget *popup_window;
GtkWidget *popup_frame;
GtkWidget *scrolled_window;
GtkWidget *cell_view_frame;
GtkTreeViewColumn *column;
GtkWidget *tree_view;
gboolean popup_in_progress;
GtkTreeRowReference *active_row;
};
struct _PidginStatusBoxClass
{
GtkContainerClass parent_class;
/* signals */
void (* changed) (GtkComboBox *combo_box);
/*< private >*/
void (*_gtk_reserved0) (void);
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
};
GType pidgin_status_box_get_type (void) G_GNUC_CONST;
GtkWidget *pidgin_status_box_new (void);
GtkWidget *pidgin_status_box_new_with_account (PurpleAccount *);
void
pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
void
pidgin_status_box_add_separator(PidginStatusBox *status_box);
void
pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
void
pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
void
pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
void
pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleStoredImage *img);
char *pidgin_status_box_get_message(PidginStatusBox *status_box);
G_END_DECLS
#endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */
|
#ifndef AQLEDS_H
#define AQLEDS_H
#include <QMainWindow>
#include "comm/aqled.h"
#include <QLineEdit>
namespace Ui {
class AqLeds;
}
class AqLeds : public QMainWindow
{
Q_OBJECT
public:
explicit AqLeds(QWidget *parent = 0);
~AqLeds();
private:
Ui::AqLeds *ui;
// vmin/vmax helpers
QLineEdit* vminLines(int index);
QLineEdit* vmaxLines(int index);
float getMomentBrightness(int moment);
// H/M helpers (sunrise, day, sunset, night..)
QLineEdit* momentLines(int moment);
bool setMoment_H_M(int moment, int hour, int minute);
bool getMoment_H_M(int moment, int* hour, int* minute);
// the device and timers...
AqLed *m_device;
QTimer rtc_check_timer;
// voltage read/write
bool checkVoltagesAreOk();
void readChannelLamps();
void writeChannelLamps();
// ramp timetables read/write
bool checkRampTimesAreOk();
bool writeRampTimes();
bool readRampTimes();
// channel ramps read/write
int getSelectedRampChannel();
bool readChannelRamp();
void writeChannelRamp();
void readDeviceSettings();
void writeTurboMode();
void readTurboMode();
public slots:
void connected(QString port_name);
void disconnected();
void rtc_check_timeout();
void on_rbChannel1_clicked();
void on_rbChannel2_clicked();
void on_rbChannel3_clicked();
void on_slSunrise_sliderMoved(int value);
void on_slDay_sliderMoved(int value);
void on_slSunset_sliderMoved(int value);
void on_slNight_sliderMoved(int value);
void on_slGlobal_sliderMoved(int value);
void on_cbIUnderstand_clicked(bool checked);
void on_btVoltagesRestore_clicked();
void on_btVoltagesSend_clicked();
void on_btRampTimesRestore_clicked();
void on_btRampTimesSend_clicked();
void on_sunriseLineEdit_textChanged(QString text);
void on_dayLineEdit_textChanged(QString text);
void on_sunsetLineEdit_textChanged(QString text);
void on_nightLineEdit_textChanged(QString text);
void on_btWriteConfig_clicked();
void on_btReloadConfig_clicked();
void on_btExportConfig_clicked();
void on_btImportConfig_clicked();
void on_cbTurboMode_toggled();
void on_btSyncSystemTime_clicked();
void on_menuActionUpdate_triggered();
};
#endif // AQLEDS_H
|
/*
*
* Author: Sylvain Afchain <safchain@gmail.com>, (C) 2008 - 2013
*
* Copyright: See COPYING file that comes with this distribution
*
*/
#ifndef __RDB_ASECTION_H
#define __RDB_ASECTION_H
#include <types.h>
#include <hl.h>
#include <dns.h>
/* prototypes */
int rdb_add_asection(HCODE *, char *, struct dns_asection_s *);
#endif
|
/*
* Copyright (c) 2011-2017 Mohammed Sameer <msameer@foolab.org>.
*
* This package 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 NORMALIZE_H
#define NORMALIZE_H
#include <QString>
namespace Normalize {
QString normalize(const QString& in);
};
#endif /* NORMALIZE_H */
|
#include <limits.h>
#include "media.h"
void mix_channels(char* in_out_a, char* in_b, int length)
{
short sample_a = 0;
short sample_b = 0;
int sample_c = 0;
int i = 0;
for (i = 0; i < length; i+= 2)
{
sample_a = (short)((in_out_a[i] << 8) | in_out_a[i+1]);
sample_b = (short)((in_b[i] << 8) | in_b[i+1]);
sample_c = sample_a + sample_b;
// if (sample_c < SHRT_MIN) {
// sample_c += ((sample_a * sample_b) / SHRT_MIN);
// } else if (sample_c > SHRT_MAX) {
// sample_c -= ((sample_a * sample_b) / SHRT_MAX);
// }
in_out_a[i] = (sample_c >> 8) & 0xFF;
in_out_a[i+1] = sample_c & 0xFF;
}
}
|
/**
* 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 Library 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PLUGIN_C
#ifdef __cplusplus
extern "C" {
#endif
struct plugin;
enum plugin_type {
plugin_type_graphics,
plugin_type_gui,
plugin_type_map,
plugin_type_osd,
plugin_type_speech,
plugin_type_vehicle,
plugin_type_event,
plugin_type_font,
plugin_type_last,
};
#endif
struct container;
struct popup;
struct popup_item;
#undef PLUGIN_FUNC1
#undef PLUGIN_FUNC3
#undef PLUGIN_FUNC4
#undef PLUGIN_TYPE
#define PLUGIN_PROTO(name,...) void name(__VA_ARGS__)
#ifdef PLUGIN_C
#define PLUGIN_REGISTER(name,...) \
void \
plugin_register_##name(PLUGIN_PROTO((*func),__VA_ARGS__)) \
{ \
plugin_##name##_func=func; \
}
#define PLUGIN_CALL(name,...) \
{ \
if (plugin_##name##_func) \
(*plugin_##name##_func)(__VA_ARGS__); \
}
#define PLUGIN_FUNC1(name,t1,p1) \
PLUGIN_PROTO((*plugin_##name##_func),t1 p1); \
void plugin_call_##name(t1 p1) PLUGIN_CALL(name,p1) \
PLUGIN_REGISTER(name,t1 p1)
#define PLUGIN_FUNC3(name,t1,p1,t2,p2,t3,p3) \
PLUGIN_PROTO((*plugin_##name##_func),t1 p1,t2 p2,t3 p3); \
void plugin_call_##name(t1 p1,t2 p2, t3 p3) PLUGIN_CALL(name,p1,p2,p3) \
PLUGIN_REGISTER(name,t1 p1,t2 p2,t3 p3)
#define PLUGIN_FUNC4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
PLUGIN_PROTO((*plugin_##name##_func),t1 p1,t2 p2,t3 p3,t4 p4); \
void plugin_call_##name(t1 p1,t2 p2, t3 p3, t4 p4) PLUGIN_CALL(name,p1,p2,p3,p4) \
PLUGIN_REGISTER(name,t1 p1,t2 p2,t3 p3,t4 p4)
struct name_val {
char *name;
void *val;
};
GList *plugin_types[plugin_type_last];
#define PLUGIN_TYPE(type,newargs) \
struct type##_priv; \
struct type##_methods; \
void \
plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs) \
{ \
struct name_val *nv; \
nv=g_new(struct name_val, 1); \
nv->name=g_strdup(name); \
nv->val=new_; \
plugin_types[plugin_type_##type]=g_list_append(plugin_types[plugin_type_##type], nv); \
} \
\
void * \
plugin_get_##type##_type(const char *name) \
{ \
return plugin_get_type(plugin_type_##type, #type, name); \
}
#else
#define PLUGIN_FUNC1(name,t1,p1) \
void plugin_register_##name(void(*func)(t1 p1)); \
void plugin_call_##name(t1 p1);
#define PLUGIN_FUNC3(name,t1,p1,t2,p2,t3,p3) \
void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3)); \
void plugin_call_##name(t1 p1,t2 p2,t3 p3);
#define PLUGIN_FUNC4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3,t4 p4)); \
void plugin_call_##name(t1 p1,t2 p2,t3 p3,t4 p4);
#define PLUGIN_TYPE(type,newargs) \
struct type##_priv; \
struct type##_methods; \
void plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs); \
void *plugin_get_##type##_type(const char *name);
#endif
#include "plugin_def.h"
#ifndef USE_PLUGINS
#define plugin_module_cat3(pre,mod,post) pre##mod##post
#define plugin_module_cat2(pre,mod,post) plugin_module_cat3(pre,mod,post)
#define plugin_module_cat(pre,post) plugin_module_cat2(pre,MODULE,post)
#define plugin_init plugin_module_cat(module_,_init)
#endif
struct attr;
/* prototypes */
void plugin_init(void);
int plugin_load(struct plugin *pl);
char *plugin_get_name(struct plugin *pl);
int plugin_get_active(struct plugin *pl);
void plugin_set_active(struct plugin *pl, int active);
void plugin_set_lazy(struct plugin *pl, int lazy);
void plugin_call_init(struct plugin *pl);
void plugin_unload(struct plugin *pl);
void plugin_destroy(struct plugin *pl);
struct plugins *plugins_new(void);
struct plugin *plugin_new(struct attr *parent, struct attr ** attrs);
void plugins_init(struct plugins *pls);
void plugins_destroy(struct plugins *pls);
void *plugin_get_type(enum plugin_type type, const char *type_name, const char *name);
/* end of prototypes */
#ifdef __cplusplus
}
#endif
|
/*
** Job Arranger for ZABBIX
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
** Copyright (C) 2013 Daiwa Institute of Research Business Innovation Ltd. 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 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.
**/
/*
** $Date:: 2014-10-17 16:00:02 +0900 #$
** $Rev: 6528 $
** $Author: nagata@FITECHLABS.CO.JP $
**/
#ifndef JOBARG_JALOADER_H
#define JOBARG_JALOADER_H
extern int CONFIG_JALOADER_INTERVAL;
extern int CONFIG_JALAUNCH_INTERVAL;
void main_jaloader_loop();
#endif
|
#ifndef _TRUSTZONE_COMMUNICATION_DRIVER_H_
#define _TRUSTZONE_COMMUNICATION_DRIVER_H_
#include <linux/ioctl.h>
#include "communication/types.h"
#define TZ_MAGIC 'T'
#define TZ_MAX_NR 3 // 最大命令叙述
/* IOCTL的操作有
* 1. Open Session
* 2. Close Session
* 3. Invoke Session
*/
#define TZ_IOCTL_OPEN_SESSION _IOWR(TZ_MAGIC, 1, OPEN_SESSION_DATA)
#define TZ_IOCTL_CLOSE_SESSION _IOWR(TZ_MAGIC, 2, CLOSE_SESSION_DATA)
#define TZ_IOCTL_INVOKE_SESSION _IOWR(TZ_MAGIC, 3, INVOKE_SESSION_DATA)
typedef struct
{
unsigned int started;
unsigned int param_type;
TEEC_Param params[4];
// TEEC_Param *params;
//<Implementation-Defined Type> imp;
} TZ_Operation;
typedef struct _OPEN_SESSION_DATA{
TZ_Operation *tz_operation;
SESSION_CONTEXT *session_context;
unsigned int *return_origin;
}OPEN_SESSION_DATA;
typedef struct _CLOSE_SESSION_DATA {
SESSION_CONTEXT *session_context;
}CLOSE_SESSION_DATA;
typedef struct _INVOKE_SESSION_DATA {
TZ_Operation *tz_operation;
SESSION_CONTEXT *session_context;
int command;
uint32_t *return_origin;
}INVOKE_SESSION_DATA;
#endif |
#ifndef NAME_SURNAME_INFO_WIDGET_H
#define NAME_SURNAME_INFO_WIDGET_H
#include "IInfoWidget.h"
#include <QWidget>
#include <QObject>
class QLineEdit;
namespace CentPatient
{
struct Data;
}
class NameSurnameInfoWidget : public QWidget, public IInfoWidget
{
Q_OBJECT
public:
explicit NameSurnameInfoWidget(QWidget* parent = 0);
virtual ~NameSurnameInfoWidget();
virtual void getQuestionaryData(CentPatient::Data& data);
virtual void reset();
virtual void triggerValidityCheck();
virtual bool checkValid();
signals:
void isValid(bool valid);
private slots:
void onChange();
private:
void createConnections();
void createLayout();
private:
QLineEdit* m_name;
QLineEdit* m_lastName;
};
#endif //NAME_SURNAME_INFO_WIDGET_H |
#ifndef INCLUDE_JOB_OPTIONS
#define INCLUDE_JOB_OPTIONS
#include <list>
#include <string>
#include <iostream>
class verbatim_option;
class JobFile;
class JobOptions {
public:
JobOptions(JobFile* parent) :
m_parent(parent), m_Density(-1), m_Speed(-1) {};
bool saveOption(char id, char* value, int len);
void dump();
private:
JobFile* m_parent;
int m_HRes;
int m_VRes;
int m_HSize;
int m_VSize;
int m_Copies;
int m_Density; // fixme, enum
int m_Speed; // fixme, enum
int m_GenSteps; // fixme, enum
std::string m_File;
std::string m_Host;
std::string m_Time;
std::list<verbatim_option> m_Unknown;
};
class verbatim_option {
public:
verbatim_option(char id, char* value, int len) :
m_Id(id), m_Value(value), m_len(len) {};
void dump() { std::cout << m_Id << ": " << std::string(m_Value, m_len) << std::endl;}
private:
char m_Id;
char* m_Value;
int m_len;
};
#endif // INCLUDE_JOB_OPTIONS
|
/*
* This file is part of the KDE project
*
* Copyright (C) 2011 Shantanu Tushar <shaan7in@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef CAPAVIEW_H
#define CAPAVIEW_H
#include <KoPAViewBase.h>
#include <KoZoomMode.h>
class KoCanvasController;
class KPrDocument;
class KoPACanvasBase;
class CAPAView : public QObject, public KoPAViewBase
{
Q_OBJECT
public:
CAPAView (KoCanvasController* canvasController, KoPACanvasBase* canvas, KPrDocument* prDocument);
virtual ~CAPAView();
virtual void setShowRulers (bool show);
virtual void editPaste();
virtual void pagePaste();
virtual void insertPage();
virtual void updatePageNavigationActions();
virtual void setActionEnabled (int actions, bool enable);
virtual void navigatePage (KoPageApp::PageNavigation pageNavigation);
virtual KoPAPageBase* activePage() const;
virtual void setActivePage (KoPAPageBase* page);
virtual void doUpdateActivePage (KoPAPageBase* page);
virtual KoZoomController* zoomController() const;
virtual KoPADocument* kopaDocument() const;
virtual KoPACanvasBase* kopaCanvas() const;
public slots:
void connectToZoomController();
private:
KoCanvasController* m_canvasController;
KoPACanvasBase* m_paCanvas;
KPrDocument* m_prDocument;
KoPAPageBase* m_page;
private slots:
void slotZoomChanged (KoZoomMode::Mode mode, qreal zoom);
};
#endif // CAPAVIEW_H
|
//
// CLCenterViewController.h
// 聚派
//
// Created by 伍晨亮 on 15/5/27.
// Copyright (c) 2015年 伍晨亮. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
#import "BaseTableView.h"
#import "UIImage+FixOrientation.h"
/**
* 个人信息
*/
@interface CLCenterViewController : BaseViewController
@property (nonatomic,retain) BaseTableView *tableView;
@property (nonatomic,copy)NSString *userID;
@property (nonatomic,copy)NSString *imgUrl;
@property (nonatomic,copy)NSString *userName;
@end
|
#ifndef GDFX_H
#define GDFX_H 1
#include "gd.h"
/* im MUST be square, but can have any size. Returns a new image
of width and height radius * 2, in which the X axis of
the original has been remapped to theta (angle) and the Y axis
of the original has been remapped to rho (distance from center).
This is known as a "polar coordinate transform." */
BGD_EXPORT gdImagePtr gdImageSquareToCircle(gdImagePtr im, int radius);
/* Draws the text 'top' and 'bottom' on 'im', curved along the
edge of a circle of radius 'radius', with its
center at 'cx' and 'cy'. 'top' is written clockwise
along the top; 'bottom' is written counterclockwise
along the bottom. 'textRadius' determines the 'height'
of each character; if 'textRadius' is 1/2 of 'radius',
characters extend halfway from the edge to the center.
'fillPortion' varies from 0 to 1.0, with useful values
from about 0.4 to 0.9, and determines how much of the
180 degrees of arc assigned to each section of text
is actually occupied by text; 0.9 looks better than
1.0 which is rather crowded. 'font' is a freetype
font; see gdImageStringFT. 'points' is passed to the
freetype engine and has an effect on hinting; although
the size of the text is determined by radius, textRadius,
and fillPortion, you should pass a point size that
'hints' appropriately -- if you know the text will be
large, pass a large point size such as 24.0 to get the
best results. 'fgcolor' can be any color, and may have
an alpha component, do blending, etc.
Returns 0 on success, or an error string. */
BGD_EXPORT char *gdImageStringFTCircle(
gdImagePtr im,
int cx,
int cy,
double radius,
double textRadius,
double fillPortion,
char *font,
double points,
char *top,
char *bottom,
int fgcolor);
/* 2.0.16:
* Sharpen function added on 2003-11-19
* by Paul Troughton (paul<dot>troughton<at>ieee<dot>org)
* Simple 3x3 convolution kernel
* Makes use of seperability
* Faster, but less flexible, than full-blown unsharp masking
* pct is sharpening percentage, and can be greater than 100
* Silently does nothing to non-truecolor images
* Silently does nothing for pct<0, as not a useful blurring function
* Leaves transparency/alpha-channel untouched
*/
BGD_EXPORT void gdImageSharpen (gdImagePtr im, int pct);
#endif /* GDFX_H */
|
/*
Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
This class provides all functionality needed for loading images, style sheets and html
pages from the web. It has a memory cache for these objects.
*/
#ifndef CachedCSSStyleSheet_h
#define CachedCSSStyleSheet_h
#include "CachedResource.h"
#include <wtf/Vector.h>
namespace WebCore {
class CachedResourceClient;
class StyleSheetContents;
class TextResourceDecoder;
struct CSSParserContext;
class CachedCSSStyleSheet final : public CachedResource {
public:
CachedCSSStyleSheet(const ResourceRequest&, const String& charset, SessionID);
virtual ~CachedCSSStyleSheet();
enum class MIMETypeCheck { Strict, Lax };
const String sheetText(MIMETypeCheck = MIMETypeCheck::Strict, bool* hasValidMIMEType = nullptr) const;
PassRefPtr<StyleSheetContents> restoreParsedStyleSheet(const CSSParserContext&, CachePolicy);
void saveParsedStyleSheet(Ref<StyleSheetContents>&&);
private:
bool canUseSheet(MIMETypeCheck, bool* hasValidMIMEType) const;
virtual bool mayTryReplaceEncodedData() const override { return true; }
virtual void didAddClient(CachedResourceClient*) override;
virtual void setEncoding(const String&) override;
virtual String encoding() const override;
virtual void finishLoading(SharedBuffer*) override;
virtual void destroyDecodedData() override;
protected:
virtual void checkNotify() override;
RefPtr<TextResourceDecoder> m_decoder;
String m_decodedSheetText;
RefPtr<StyleSheetContents> m_parsedStyleSheetCache;
};
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_CACHED_RESOURCE(CachedCSSStyleSheet, CachedResource::CSSStyleSheet)
#endif // CachedCSSStyleSheet_h
|
/* Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_gtdd2 (_Decimal64 x, _Decimal64 y) {
CMPtype res;
union decimal64 ux, uy;
ux.d = x;
uy.d = y;
res = __bid64_quiet_greater (ux.i, uy.i);
return (res);
}
|
#include <stdlib.h>
#include "skyeye_mm.h"
#include "skyeye_mach.h"
#include "skyeye_options.h"
#include "skyeye_config.h"
#include "skyeye_log.h"
static machine_config_t* mach_list;
int
do_mach_option (skyeye_option_t * this_option, int num_params,
const char *params[])
{
int ret;
machine_config_t *mach = get_mach(params[0]);
skyeye_config_t* config = get_current_config();
if(mach != NULL){
config->mach = mach;
skyeye_log(Info_log,__FUNCTION__,"mach info: name %s, mach_init addr %p\n", config->mach->machine_name, config->mach->mach_init);
ret = 0;
}
else{
SKYEYE_ERR ("Error: Unknown mach name \"%s\"\n", params[0]);
ret = -1;
}
return ret;
}
void init_mach(){
mach_list = NULL;
register_option("mach", do_mach_option, "machine option");
}
void register_mach(const char* mach_name, mach_init_t mach_init){
machine_config_t * mach;
mach = skyeye_mm_zero(sizeof(machine_config_t));
mach->machine_name = skyeye_strdup(mach_name);
mach->mach_init = mach_init;
mach->next = mach_list;
mach_list = mach;
//skyeye_log(Debug_log, __FUNCTION__, "regiser mach %s successfully.\n", mach->machine_name);
}
/*
* get machine by its name
*/
machine_config_t * get_mach(const char* mach_name){
machine_config_t* node;
node = mach_list;
while(node){
//if(!strncmp(node->machine_name, mach_name, strlen(node->machine_name))){
if(!strcmp(node->machine_name, mach_name)){
return node;
}
node = node->next;
}
return NULL;
}
#if 0
machine_config_t* get_mach(skyeye_config_t* config){
return config->mach;
}
#endif
machine_config_t * get_mach_list(){
return mach_list;
}
machine_config_t *get_current_mach(){
skyeye_config_t* config = get_current_config();
return config->mach;
}
|
/*
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
* Copyright (C) 2009-2011 MaNGOSZero <https://github.com/mangos/zero>
* Copyright (C) 2011-2016 Nostalrius <https://nostalrius.org>
* Copyright (C) 2016-2017 Elysium Project <https://github.com/elysium-project>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @addtogroup mailing The mail system
* The mailing system in MaNGOS consists of mostly 4 files:
* - Mail.h
* - Mail.cpp
* - MassMailMgr.h
* - MassMailMgr.cpp
*
* @{
*
* @file MassMailMgr.h
* This file contains the the headers needed for MaNGOS to handle mass mails send in safe and perfomence not affecting way.
*
*/
#ifndef MANGOS_MASS_MAIL_MGR_H
#define MANGOS_MASS_MAIL_MGR_H
#include "Common.h"
#include "Mail.h"
#include "Policies/Singleton.h"
#include <memory>
/**
* A class to represent the mail send factory to multiple (often all existing) characters.
*
* Note: implementation not persistence for server shutdowns
*/
class MassMailMgr
{
public: // Constructors
MassMailMgr() {}
public: // Accessors
void GetStatistic(uint32& tasks, uint32& mails, uint32& needTime) const;
public: // modifiers
typedef UNORDERED_SET<uint32> ReceiversList;
/**
* And new mass mail task for raceMask filter applied to characters list.
*
* @param mailProto prepared mail for clone and send to characters, will deleted in result call.
* @param raceMask mask of races that must receive mail.
*
* Note: this function safe to be called from Map::Update content/etc, real data add will executed in next tick after query results ready
*/
void AddMassMailTask(MailDraft* mailProto, MailSender sender, uint32 raceMask);
/**
* And new mass mail task with SQL query text for fill receivers list.
*
* @param mailProto prepared mail for clone and send to characters, will deleted in result call
* @param queryStr SQL query for get guid list of receivers, first field in query result must be uint32 low guids list.
*
* Note: this function safe to be called from Map::Update content/etc, real data add will executed in next tick after query results ready
*/
void AddMassMailTask(MailDraft* mailProto, MailSender sender, char const* queryStr);
/**
* And new mass mail task and let fill receivers list returned as result.
*
* @param mailProto prepared mail for clone and send to characters, will deleted in result call
* @returns reference to receivers list for it fill in caller code.
*
* Note: this function NOT SAFE for call from Map::Update content/etc
*/
ReceiversList& AddMassMailTask(MailDraft* mailProto, MailSender sender)
{
m_massMails.push_back(MassMail(mailProto, sender));
return m_massMails.rbegin()->m_receivers;
}
/**
* Next step in mass mail activity, send some amount mails from queued tasks
*/
void Update(bool sendall = false);
private:
/// Mass mail task store mail prototype and receivers list who not get mail yet
struct MassMail
{
explicit MassMail(MailDraft* mailProto, MailSender sender)
: m_protoMail(mailProto), m_sender(sender)
{
MANGOS_ASSERT(mailProto);
}
MassMail(MassMail const& massmail)
: m_protoMail(std::move(const_cast<MassMail&>(massmail).m_protoMail)), m_sender(massmail.m_sender)
{
}
/// m_protoMail is owned by MassMail, so at copy original MassMail field set to NULL
std::unique_ptr<MailDraft> m_protoMail;
MailSender m_sender;
ReceiversList m_receivers;
};
typedef std::list<MassMail> MassMailList;
/// List of current queued mass mail tasks
MassMailList m_massMails;
};
#define sMassMailMgr MaNGOS::Singleton<MassMailMgr>::Instance()
#endif
/*! @} */
|
// Copyright 2013 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_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_
#define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
class CommandLine;
namespace diagnostics {
class DiagnosticsWriter;
class DiagnosticsModel;
class DiagnosticsController {
public:
static DiagnosticsController* GetInstance();
int Run(const CommandLine& command_line, DiagnosticsWriter* writer);
int RunRecovery(const CommandLine& command_line, DiagnosticsWriter* writer);
const DiagnosticsModel& GetResults() const;
bool HasResults();
void ClearResults();
void RecordRegularStartup();
private:
friend struct DefaultSingletonTraits<DiagnosticsController>;
DiagnosticsController();
~DiagnosticsController();
scoped_ptr<DiagnosticsModel> model_;
DiagnosticsWriter* writer_;
DISALLOW_COPY_AND_ASSIGN(DiagnosticsController);
};
}
#endif
|
#include "../generic/wrappers.c"
long lens_get_focus_pos()
{
return _GetFocusLensSubjectDistance();
}
long lens_get_focus_pos_from_lense()
{
return _GetFocusLensSubjectDistanceFromLens();
}
long lens_get_target_distance()
{
return _GetCurrentTargetDistance();
}
|
#ifndef __DEFINES_H__
#define __DEFINES_H__
#define SERVER_MSGTYP 1
#define FTOK_FILE "bin/server"
#define FTOK_CHAR 'a'
typedef struct {
char nombre[61];
char direccion[120];
char telefono[13];
} Register;
typedef enum {
SELECT=0,
INSERT,
DELETE,
UPDATE,
ERROR,
SUCCESS
} MsgType;
typedef struct {
MsgType type;
pid_t pid;
Register reg;
} MsgData;
typedef struct {
long mtype;
MsgData data;
} MsgStruct ;
#endif
|
#include "../../corelibs/U2View/src/ov_msa/MsaEditorSimilarityColumn.h"
|
/*----------------------------------------------------------------------------
*
* Name: config.h
*
* Purpose:
*
* Description:
*
*-----------------------------------------------------------------------------*/
#ifndef CONFIG_H
#define CONFIG_H 1
#include "audio.h" /* for struct audio_s */
#include "digipeater.h" /* for struct digi_config_s */
#include "aprs_tt.h" /* for struct tt_config_s */
#include "igate.h" /* for struct igate_config_s */
/*
* All the leftovers.
* This wasn't thought out. It just happened.
*/
enum beacon_type_e { BEACON_IGNORE, BEACON_POSITION, BEACON_OBJECT, BEACON_TRACKER, BEACON_CUSTOM };
enum sendto_type_e { SENDTO_XMIT, SENDTO_IGATE, SENDTO_RECV };
#define MAX_BEACONS 30
struct misc_config_s {
int agwpe_port; /* Port number for the "AGW TCPIP Socket Interface" */
int kiss_port; /* Port number for the "KISS" protocol. */
int enable_kiss_pt; /* Enable pseudo terminal for KISS. */
/* Want this to be off by default because it hangs */
/* after a while if nothing is reading from other end. */
char nullmodem[20]; /* Serial port name for our end of the */
/* virtual null modem for native Windows apps. */
char gpsnmea_port[20]; /* Serial port name for reading NMEA sentences from GPS. */
/* e.g. COM22, /dev/ttyACM0 */
char gpsd_host[20]; /* Host for gpsd server. */
/* e.g. localhost, 192.168.1.2 */
int gpsd_port; /* Port number for gpsd server. */
/* Default is 2947. */
/* e.g. COM22, /dev/ttyACM0 */
char nmea_port[20]; /* Serial port name for NMEA communication with GPS */
/* receiver and/or mapping application. Change this. */
char logdir[80]; /* Directory for saving activity logs. */
int sb_configured; /* TRUE if SmartBeaconing is configured. */
int sb_fast_speed; /* MPH */
int sb_fast_rate; /* seconds */
int sb_slow_speed; /* MPH */
int sb_slow_rate; /* seconds */
int sb_turn_time; /* seconds */
int sb_turn_angle; /* degrees */
int sb_turn_slope; /* degrees * MPH */
int num_beacons; /* Number of beacons defined. */
struct beacon_s {
enum beacon_type_e btype; /* Position or object. */
int lineno; /* Line number from config file for later error messages. */
enum sendto_type_e sendto_type;
/* SENDTO_XMIT - Usually beacons go to a radio transmitter. */
/* chan, below is the channel number. */
/* SENDTO_IGATE - Send to IGate, probably to announce my position */
/* rather than relying on someone else to hear */
/* me on the radio and report me. */
/* SENDTO_RECV - Pretend this was heard on the specified */
/* radio channel. Mostly for testing. It is a */
/* convenient way to send packets to attached apps. */
int sendto_chan; /* Transmit or simulated receive channel for above. Should be 0 for IGate. */
int delay; /* Seconds to delay before first transmission. */
int every; /* Time between transmissions, seconds. */
/* Remains fixed for PBEACON and OBEACON. */
/* Dynamically adjusted for TBEACON. */
time_t next; /* Unix time to transmit next one. */
char *dest; /* NULL or explicit AX.25 destination to use */
/* instead of the software version such as APDW11. */
int compress; /* Use more compact form? */
char objname[10]; /* Object name. Any printable characters. */
char *via; /* Path, e.g. "WIDE1-1,WIDE2-1" or NULL. */
char *custom_info; /* Info part for handcrafted custom beacon. */
/* Ignore the rest below if this is set. */
char *custom_infocmd; /* Command to generate info part. */
/* Again, other options below are then ignored. */
int messaging; /* Set messaging attribute for position report. */
/* i.e. Data Type Indicator of '=' rather than '!' */
double lat; /* Latitude and longitude. */
double lon;
float alt_m; /* Altitude in meters. */
char symtab; /* Symbol table: / or \ or overlay character. */
char symbol; /* Symbol code. */
float power; /* For PHG. */
float height;
float gain; /* Original protocol spec was unclear. */
/* Addendum 1.1 clarifies it is dBi not dBd. */
char dir[3]; /* 1 or 2 of N,E,W,S, or empty for omni. */
float freq; /* MHz. */
float tone; /* Hz. */
float offset; /* MHz. */
char *comment; /* Comment or NULL. */
char *commentcmd; /* Command to append more to Comment or NULL. */
} beacon[MAX_BEACONS];
};
#define MIN_IP_PORT_NUMBER 1024
#define MAX_IP_PORT_NUMBER 49151
#define DEFAULT_AGWPE_PORT 8000 /* Like everyone else. */
#define DEFAULT_KISS_PORT 8001 /* Above plus 1. */
#define DEFAULT_NULLMODEM "COM3" /* should be equiv. to /dev/ttyS2 on Cygwin */
extern void config_init (char *fname, struct audio_s *p_modem,
struct digi_config_s *digi_config,
struct tt_config_s *p_tt_config,
struct igate_config_s *p_igate_config,
struct misc_config_s *misc_config);
#endif /* CONFIG_H */
/* end config.h */
|
// Copyright 2013 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_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_
#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_
#include "ash/desktop_background/desktop_background_controller.h"
#include "extensions/browser/extension_function.h"
#include "ui/gfx/image/image_skia.h"
namespace wallpaper_api_util {
ash::WallpaperLayout GetLayoutEnum(const std::string& layout);
}
class WallpaperFunctionBase : public AsyncExtensionFunction {
public:
WallpaperFunctionBase();
protected:
virtual ~WallpaperFunctionBase();
class UnsafeWallpaperDecoder;
static UnsafeWallpaperDecoder* unsafe_wallpaper_decoder_;
void StartDecode(const std::string& data);
void OnCancel();
void OnFailure(const std::string& error);
private:
virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) = 0;
};
#endif
|
/*
linphone, gtk-glade interface.
Copyright (C) 2008 Simon MORLAT (simon.morlat@linphone.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const char *with){
GtkWidget *w;
GtkTextBuffer *b;
gchar *tmp;
w=linphone_gtk_create_window("chatroom");
tmp=g_strdup_printf(_("Chat with %s"),with);
gtk_window_set_title(GTK_WINDOW(w),tmp);
g_free(tmp);
g_object_set_data(G_OBJECT(w),"cr",cr);
gtk_widget_show(w);
linphone_chat_room_set_user_data(cr,w);
b=gtk_text_view_get_buffer(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")));
gtk_text_buffer_create_tag(b,"blue","foreground","blue",NULL);
gtk_text_buffer_create_tag(b,"green","foreground","green",NULL);
return w;
}
void linphone_gtk_create_chatroom(const char *with){
LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),with);
if (!cr) return;
linphone_gtk_init_chatroom(cr,with);
}
void linphone_gtk_chat_destroyed(GtkWidget *w){
LinphoneChatRoom *cr=(LinphoneChatRoom*)g_object_get_data(G_OBJECT(w),"cr");
linphone_chat_room_destroy(cr);
}
void linphone_gtk_chat_close(GtkWidget *button){
GtkWidget *w=gtk_widget_get_toplevel(button);
gtk_widget_destroy(w);
}
void linphone_gtk_push_text(GtkTextView *v, const char *from, const char *message, gboolean me){
GtkTextBuffer *b=gtk_text_view_get_buffer(v);
GtkTextIter iter,begin;
int off;
gtk_text_buffer_get_end_iter(b,&iter);
off=gtk_text_iter_get_offset(&iter);
gtk_text_buffer_insert(b,&iter,from,-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_insert(b,&iter,":\t",-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_get_iter_at_offset(b,&begin,off);
gtk_text_buffer_apply_tag_by_name(b,me ? "green" : "blue" ,&begin,&iter);
gtk_text_buffer_insert(b,&iter,message,-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_buffer_insert(b,&iter,"\n",-1);
gtk_text_buffer_get_end_iter(b,&iter);
gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,0,0);
}
const char* linphone_gtk_get_used_identity(){
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneProxyConfig *cfg;
linphone_core_get_default_proxy(lc,&cfg);
if (cfg) return linphone_proxy_config_get_identity(cfg);
else return linphone_core_get_primary_contact(lc);
}
void linphone_gtk_send_text(GtkWidget *button){
GtkWidget *w=gtk_widget_get_toplevel(button);
GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry");
LinphoneChatRoom *cr=(LinphoneChatRoom*)g_object_get_data(G_OBJECT(w),"cr");
const gchar *entered;
entered=gtk_entry_get_text(GTK_ENTRY(entry));
if (strlen(entered)>0) {
linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")),
linphone_gtk_get_used_identity(),
entered,TRUE);
linphone_chat_room_send_message(cr,entered);
gtk_entry_set_text(GTK_ENTRY(entry),"");
}
}
void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message){
GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room);
if (w==NULL){
w=linphone_gtk_init_chatroom(room,from);
}
linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")),
from,
message,FALSE);
gtk_window_present(GTK_WINDOW(w));
/*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/
}
|
/*
* linux/include/asm-arm/arch-pnx0106/dbgmsg.h
*
* Copyright (C) 2005 Andre McCurdy, Philips Semiconductors.
*
* This source code 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.
*/
#ifndef __ASM_ARCH_DBGMSG_H_
#define __ASM_ARCH_DBGMSG_H_
extern void dbgmsg (char const *format, ...);
#endif
|
/*
*
* (c) 2004-2007 Laurent Vivier <Laurent@Vivier.EU>
*
*/
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
#include <macos/types.h>
#include "misc.h"
#include "head.h"
extern void console_init(void);
extern int console_putchar(int c);
extern void console_putstring(const char *s);
int wait_char;
#ifdef USE_CLI
extern int console_keypressed(int timeout);
extern int console_getchar(void);
extern void console_clear(void);
extern void console_cursor_on(void);
extern void console_cursor_off(void);
extern void console_cursor_save(void);
extern void console_cursor_restore(void);
extern void console_video_inverse(void);
extern void console_video_normal(void);
extern void console_set_cursor_position(int l, int c);
extern int console_get_cursor_position(int* l, int* c);
extern int console_get_size(int *l, int *c);
extern int console_select(int timeout);
extern int console_status_request();
#endif
#endif
|
#ifndef SX1255_CONFIG_H
#define SX1255_CONFIG_H
#define SX1255_BASE_ADDR 0x78C00000
#define SPI_WRITE_REG 0x00
#define SPI_READ_REG 0x04
#define SPI_STATUS_REG 0x08
#define SEND_IQ_REG 0x10
#define SPI_SPEED_REG 0x14
#define ID_REG 0x18
#define IOC_MAGIC 'a'
#define SPI_WRITE_CMD _IOW(IOC_MAGIC, 0, int)
#define SPI_READ_CMD _IOR(IOC_MAGIC, 1, int)
#define SPI_STATUS_CMD _IOR(IOC_MAGIC, 2, int)
#define SPI_SPEED_CMD _IOW(IOC_MAGIC, 3, int)
#define SEND_IQ_CMD _IOW(IOC_MAGIC, 4, int)
#define ID_CMD _IOR(IOC_MAGIC, 5, int)
/* platform device */
struct plat_sx1255_port {
const char *name;
int num;
int id;
int idoffset;
struct sx1255_dev *sdev;
};
#endif
|
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/
#include "diskio.h" /* FatFs lower layer API */
#include "dldi.h"
#include <stdbool.h>
/* Definitions of physical drive number for each media */
//#define SDCARD 0
//#define CTRNAND 1
#define DLDICART 0
//coto: support for dldi driver (:
/*-----------------------------------------------------------------------*/
/* Get Drive Status */
/*-----------------------------------------------------------------------*/
DSTATUS disk_status (
__attribute__((unused))
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
return RES_OK;
}
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS ret = 0;
//3DS
/*
static uint32 sdmmcInitResult = 4;
if(sdmmcInitResult == 4) sdmmcInitResult = sdmmc_sdcard_init();
if(pdrv == CTRNAND)
{
if(!(sdmmcInitResult & 1))
{
ctrNandInit();
ret = 0;
}
else ret = STA_NOINIT;
}
else
ret = (!(sdmmcInitResult & 2)) ? 0 : STA_NOINIT;
*/
//DS
if(pdrv == DLDICART){
//DS DLDI
struct DISC_INTERFACE_STRUCT* inst = (struct DISC_INTERFACE_STRUCT*)dldiGetInternal();
if( (!inst->startup()) || (!inst->isInserted()) ){
ret = STA_NOINIT;
}
else{
ret = 0; //init OK!
}
}
return ret;
}
/*-----------------------------------------------------------------------*/
/* Read Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */
)
{
return ( ((pdrv == DLDICART) && io_dldi_data->ioInterface.readSectors(sector, count, buff) == true) ? RES_OK : RES_ERROR);
}
/*-----------------------------------------------------------------------*/
/* Write Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_write (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to write */
)
{
return ( ((pdrv == DLDICART) && io_dldi_data->ioInterface.writeSectors(sector, count, buff) == true) ? RES_OK : RES_ERROR);
}
/*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */
/*-----------------------------------------------------------------------*/
DRESULT disk_ioctl (
BYTE pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
return RES_PARERR;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.