text stringlengths 4 6.14k |
|---|
/*
* BRLTTY - A background process providing access to the console screen (when in
* text mode) for a blind person using a refreshable braille display.
*
* Copyright (C) 1995-2017 by The BRLTTY Developers.
*
* BRLTTY comes with ABSOLUTELY NO WARRANTY.
*
* This is free software, placed 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. Please see the file LICENSE-LGPL for details.
*
* Web Page: http://brltty.com/
*
* This software is maintained by Dave Mielke <dave@mielke.cc>.
*/
#ifndef BRLTTY_INCLUDED_HT_BRLDEFS
#define BRLTTY_INCLUDED_HT_BRLDEFS
#define HT_USB_VENDOR 0X1FE4
typedef enum {
HT_MODEL_UsbHidAdapter = 0X03,
HT_MODEL_BrailleWave = 0X05,
HT_MODEL_ModularEvolution64 = 0X36,
HT_MODEL_ModularEvolution88 = 0X38,
HT_MODEL_ModularConnect88 = 0X3A,
HT_MODEL_EasyBraille = 0X44,
HT_MODEL_ActiveBraille = 0X54,
HT_MODEL_ConnectBraille40 = 0X55,
HT_MODEL_Actilino = 0X61,
HT_MODEL_ActiveStar40 = 0X64,
HT_MODEL_BasicBraille16 = 0X81,
HT_MODEL_BasicBraille20 = 0X82,
HT_MODEL_BasicBraille32 = 0X83,
HT_MODEL_BasicBraille40 = 0X84,
HT_MODEL_BasicBraille48 = 0X8A,
HT_MODEL_BasicBraille64 = 0X86,
HT_MODEL_BasicBraille80 = 0X87,
HT_MODEL_BasicBraille160 = 0X8B,
HT_MODEL_Braillino = 0X72,
HT_MODEL_BrailleStar40 = 0X74,
HT_MODEL_BrailleStar80 = 0X78,
HT_MODEL_Modular20 = 0X80,
HT_MODEL_Modular80 = 0X88,
HT_MODEL_Modular40 = 0X89,
HT_MODEL_Bookworm = 0X90
} HT_ModelIdentifier;
/* Packet definition */
typedef enum {
HT_PKT_Braille = 0X01,
HT_PKT_Extended = 0X79,
HT_PKT_NAK = 0X7D,
HT_PKT_ACK = 0X7E,
HT_PKT_OK = 0XFE,
HT_PKT_Reset = 0XFF
} HT_PacketType;
typedef enum {
HT_EXTPKT_Braille = HT_PKT_Braille,
HT_EXTPKT_Key = 0X04,
HT_EXTPKT_Confirmation = 0X07,
HT_EXTPKT_Scancode = 0X09,
HT_EXTPKT_Ping = 0X19,
HT_EXTPKT_GetSerialNumber = 0X41,
HT_EXTPKT_SetRTC = 0X44,
HT_EXTPKT_GetRTC = 0X45,
HT_EXTPKT_GetBluetoothPIN = 0X47,
HT_EXTPKT_SetAtcMode = 0X50,
HT_EXTPKT_SetAtcSensitivity = 0X51,
HT_EXTPKT_AtcInfo = 0X52,
HT_EXTPKT_SetAtcSensitivity2 = 0X53,
HT_EXTPKT_GetAtcSensitivity2 = 0X54,
HT_EXTPKT_ReadingPosition = 0X55,
HT_EXTPKT_SetFirmness = 0X60,
HT_EXTPKT_GetFirmness = 0X61,
HT_EXTPKT_GetProtocolProperties = 0XC1,
HT_EXTPKT_GetFirmwareVersion = 0XC2
} HT_ExtendedPacketType;
typedef struct {
uint16_t year;
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
} PACKED HT_DateTime;
typedef enum {
HT_MCAP_reqBatteryManagementInformation = 0X001,
HT_MCAP_BatteryCalibrationAndTestMode = 0X002,
HT_MCAP_getRealTimeClock = 0X004,
HT_MCAP_setRealTimeClock = 0X008,
HT_MCAP_getSerialNumber = 0X010,
HT_MCAP_setSerialNumber = 0X020,
HT_MCAP_getBluetoothPIN = 0X040,
HT_MCAP_setBluetoothPIN = 0X080,
HT_MCAP_setServiceInformation = 0X100,
HT_MCAP_getServiceInformation = 0X200
} HT_MaintainanceCapabilities;
typedef enum {
HT_ICAP_hasInternalMode = 0X001,
HT_ICAP_updNormalModeFirmware = 0X002,
HT_ICAP_updBrailleProcessorFirmware = 0X004,
HT_ICAP_updUsbProcessorFirmware = 0X008,
HT_ICAP_updBluetoothModuleFirmware = 0X010,
HT_ICAP_getBrailleSystemConfiguration = 0X020,
HT_ICAP_setBrailleSystemConfiguration = 0X040
} HT_InternalModeCapabilities;
typedef struct {
unsigned char majorVersion;
unsigned char minorVersion;
unsigned char cellCount;
unsigned char hasSensitivity;
unsigned char maximumSensitivity;
unsigned char hasFirmness;
unsigned char maximumFirmness;
HT_MaintainanceCapabilities maintainanceCapabilities:16;
HT_InternalModeCapabilities internalModeCapabilities:16;
} PACKED HT_ProtocolProperties;
typedef union {
unsigned char bytes[4 + 0XFF];
struct {
unsigned char type;
union {
struct {
unsigned char model;
} PACKED ok;
struct {
unsigned char model;
unsigned char length;
unsigned char type;
union {
HT_DateTime dateTime;
HT_ProtocolProperties protocolProperties;
unsigned char bytes[0XFF];
} data;
} PACKED extended;
} data;
} PACKED fields;
} HT_Packet;
typedef enum {
HT_KEY_None = 0,
HT_KEY_B1 = 0X03,
HT_KEY_B2 = 0X07,
HT_KEY_B3 = 0X0B,
HT_KEY_B4 = 0X0F,
HT_KEY_B5 = 0X13,
HT_KEY_B6 = 0X17,
HT_KEY_B7 = 0X1B,
HT_KEY_B8 = 0X1F,
HT_KEY_Up = 0X04,
HT_KEY_Down = 0X08,
/* Keypad keys (star80 and modular) */
HT_KEY_B12 = 0X01,
HT_KEY_Zero = 0X05,
HT_KEY_B13 = 0X09,
HT_KEY_B14 = 0X0D,
HT_KEY_B11 = 0X11,
HT_KEY_One = 0X15,
HT_KEY_Two = 0X19,
HT_KEY_Three = 0X1D,
HT_KEY_B10 = 0X02,
HT_KEY_Four = 0X06,
HT_KEY_Five = 0X0A,
HT_KEY_Six = 0X0E,
HT_KEY_B9 = 0X12,
HT_KEY_Seven = 0X16,
HT_KEY_Eight = 0X1A,
HT_KEY_Nine = 0X1E,
/* Braille wave/star keys */
HT_KEY_Escape = 0X0C,
HT_KEY_Space = 0X10,
HT_KEY_Return = 0X14,
/* Braille star keys */
HT_KEY_SpaceRight = 0X18,
/* Actilino keys */
HT_KEY_JoystickLeft = 0X74,
HT_KEY_JoystickRight = 0X75,
HT_KEY_JoystickUp = 0X76,
HT_KEY_JoystickDown = 0X77,
HT_KEY_JoystickAction = 0X78,
/* ranges and flags */
HT_KEY_ROUTING = 0X20,
HT_KEY_STATUS = 0X70,
HT_KEY_RELEASE = 0X80
} HT_NavigationKey;
typedef enum {
HT_GRP_NavigationKeys = 0,
HT_GRP_RoutingKeys
} HT_KeyGroup;
#endif /* BRLTTY_INCLUDED_HT_BRLDEFS */
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2007 by Daniel Ankers
*
* PP5002 and PP502x SoC threading support
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <string.h>
#include "corelock.h"
/* Core locks using Peterson's mutual exclusion algorithm */
/*---------------------------------------------------------------------------
* Initialize the corelock structure.
*---------------------------------------------------------------------------
*/
void corelock_init(struct corelock *cl)
{
memset(cl, 0, sizeof (*cl));
}
/* other corelock methods are ASM-optimized */
#include "asm/corelock.c"
|
/**
* \file configurator.h
* \author Laurent Georget
* \date 2015-10-18
* \brief Definition of the configuration parser
*/
#ifndef CONFIGURATOR_H
#define CONFIGURATOR_H
#include <cstdlib>
#include <iostream>
#include <functional>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#include <regex>
#include "url_finder.h"
/**
* \brief Parse and interpret the configuration file
*/
class Configurator
{
private:
/**
* \brief The list of functions to dump as activity diagrams
*/
std::vector<std::string> _functions;
/**
* \brief Map each category to the string to add in the
* attribute section of the objects of this category
*/
std::map<unsigned int, std::vector<std::pair<std::string,std::string>>> _categoriesRepresentation;
/**
* \brief A set of regexes identifying the beginning of a
* category
*
* From the node whose label the regex to the node whose label
* match a regex in \a _categoryEnding, all nodes reachable
* from the former will be in the specified category.
* \see _categoryEnding
*/
std::vector<std::pair<std::regex,unsigned int>> _categoryBeginning;
/**
* \brief A set of regexes which identify the end of
* categories
* \see _categoryBeginning
*/
std::vector<std::regex> _categoryEnding;
/**
* \brief A set of regexes identifying nodes which must be bound
* to a category
*
* Standalone categories have precedence over categories defined
* in \a _categoryBeginning
*/
std::vector<std::pair<std::regex, unsigned int>> _categoryStandalone;
/**
* \brief Tell whether all met functions should be dumped
*/
bool _greedymode = false;
/**
* \brief The SQLITE3 file containing the database of function
* symbols, to dump line and file information in the diagrams
*/
std::string _dbFile;
/**
* \brief The name of the database of function symbols
* \see _dbFile
*/
std::string _dbName;
/**
* \brief Functor which outputs for a category the corresponding
* string of attributes
*/
class CategoryDumper {
private:
/**
* \brief The configurator the CategoryDumper
* refers to
*/
const Configurator& _parent;
public:
/**
* \brief Dummy constructor for the
* \a CategoryDumper
*
* A \a CategoryDumper instance is built only by
* its ``parent'', the \a Configurator
*/
CategoryDumper(const Configurator& parent);
/**
* \brief Output the string of attributes of a
* given category
*
* \param i the category
*
* \return the string to add to nodes of the
* given category
*/
const std::vector<std::pair<std::string,std::string>>* operator()(unsigned int i);
};
/**
* \brief An instance of the \a CategoryDumper
*/
CategoryDumper _catdump;
/**
* \brief A reference to \a _catdump, for export
*/
std::reference_wrapper<CategoryDumper> _refcatdump;
/**
* \brief Functor which outputs the category of a node given as
* a parameter
*
* This functor maintains internal state because some categories
* applies to series of nodes.
*/
class Categorizer {
private:
/**
* \brief The configurator the Categorizer
* refers to
*/
const Configurator& _parent;
/**
* \brief The category of the current branch of
* nodes (if a category has started and not
* ended yet)
*/
unsigned int _currentCategory = 0;
/**
* \brief Tell whether the current category
* applis fot future nodes
*/
bool _persistent = false;
public:
/**
* \brief Dummy constructor, called from \a
* Configurator::Configurator()
*/
Categorizer(const Configurator& parent);
/**
* \brief Output a category given the label of
* a node
*
* \param content The label of the node to
* categorize
*
* \return A categry number, 0 means ``no
* category''
*/
unsigned int operator()(const std::string& content);
};
/**
* \brief An instance of \a Categorizer
*/
Categorizer _categorizer;
/**
* \brief A reference to \a _categorizer, for export
*/
std::reference_wrapper<Categorizer> _refcategorizer;
public:
/**
* \brief Constructor for \a Configurator
*
* \param config the name of the configuration file
* \param source the name of the compilation unit under analysis
*/
Configurator(std::string config, std::string source);
/**
* \brief Tell whether a given function must be dumped as a
* diagram
*
* \param functionName the undecorated base name of the function
*
* \return true if, and only if, an activity diagram must be
* dumped for the function
*/
bool mustGraph(std::string functionName) const;
/**
* \brief Tell whether the program will be able to enrich the
* diagram with URLs
*
* The URLs references the point where a function is defined in
* nodes representing function calls.
* Note that the validity of the database path and name is not
* checked here.
*
* \return true if, and only if, a database of function symbols
* was configured
*/
bool shallDumpUrls() const;
/**
* \brief Give a reference to an instance of \a CategoryDumper
*
* \return a category dumper for the current configuration
*/
std::function<const std::vector<std::pair<std::string,std::string>>*(unsigned int)> getCategoryDumper() const;
/**
* \brief Give a reference to an instance of \a Categorizer
*
* \return a categorizer for the current configuration
*/
std::function<unsigned int(std::string)> getCategorizer() const;
/**
* \brief Give the path to the database of symbols
*
* \return the path to the database of symbols, or an empty
* string if no such database has been configured
*/
const std::string& getDbFile() const;
/**
* \brief Give the name of the database of symbols
*
* \return the name of the database of symbols, or an empty
* string if no such database has been configured
*/
const std::string& getDbName() const;
};
#endif
|
/*
Copyright (C) 2001 Paul Davis
Copyright (C) 2004 Grame
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __JackAlsaDriver__
#define __JackAlsaDriver__
#include "JackAudioDriver.h"
#include "JackThreadedDriver.h"
#include "JackTime.h"
#include "alsa_driver.h"
namespace Jack
{
/*!
\brief The ALSA driver.
*/
class JackAlsaDriver : public JackAudioDriver
{
private:
jack_driver_t* fDriver;
jack_native_thread_t fReservationLoopThread;
void UpdateLatencies();
public:
JackAlsaDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
: JackAudioDriver(name, alias, engine, table),fDriver(NULL)
{}
virtual ~JackAlsaDriver()
{}
int Open(jack_nframes_t buffer_size,
jack_nframes_t user_nperiods,
jack_nframes_t samplerate,
bool hw_monitoring,
bool hw_metering,
bool capturing,
bool playing,
DitherAlgorithm dither,
bool soft_mode,
bool monitor,
int inchannels,
int outchannels,
bool shorts_first,
const char* capture_driver_name,
const char* playback_driver_name,
jack_nframes_t capture_latency,
jack_nframes_t playback_latency,
const char* midi_driver_name);
int Close();
int Attach();
int Detach();
int Start();
int Stop();
int Read();
int Write();
// BufferSize can be changed
bool IsFixedBufferSize()
{
return false;
}
int SetBufferSize(jack_nframes_t buffer_size);
void ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread);
void MonitorInputAux();
void ClearOutputAux();
void WriteOutputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten);
void SetTimetAux(jack_time_t time);
int PortSetDefaultMetadata(jack_port_id_t port_id, const char* pretty_name);
// JACK API emulation for the midi driver
int is_realtime() const;
int create_thread(pthread_t *thread, int prio, int rt, void *(*start_func)(void*), void *arg);
jack_port_id_t port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size);
int port_unregister(jack_port_id_t port_index);
void* port_get_buffer(int port, jack_nframes_t nframes);
int port_set_alias(int port, const char* name);
jack_nframes_t get_sample_rate() const;
jack_nframes_t frame_time() const;
jack_nframes_t last_frame_time() const;
};
} // end of namespace
#endif
|
#ifndef DBERN_H_
#define DBERN_H_
#include "RScalarDist.h"
namespace bugs {
/**
* @short Bernoulli distribution
* <pre>
* R ~ dbern(p)
* f(r | p) = p^r * (1 - p)^(1 -r) ; r in 0:1
* </pre>
*/
class DBern : public ScalarDist {
public:
DBern();
double logDensity(double x, PDFType type,
std::vector<double const *> const ¶meters,
double const *lbound, double const *ubound) const;
double randomSample(std::vector<double const *> const ¶meters,
double const *lbound, double const *ubound,
RNG *rng) const;
double typicalValue(std::vector<double const *> const ¶meters,
double const *lbound, double const *ubound) const;
/** Checks that p lies in the open interval (0,1) */
bool checkParameterValue(std::vector<double const *> const ¶meters)
const;
/** Bernoulli distribution cannot be bounded */
bool canBound() const;
/** Bernoulli distribution is discrete valued */
bool isDiscreteValued(std::vector<bool> const &mask) const;
double KL(std::vector<double const *> const &par1,
std::vector<double const *> const &par2) const;
};
}
#endif /* DBERN_H_ */
|
#include <unistd.h>
#include "tests/sys_mman.h"
#include <assert.h>
#include <stdlib.h>
#include "../memcheck.h"
#define SUPERBLOCK_SIZE 100000
//-------------------------------------------------------------------------
// Allocator
//-------------------------------------------------------------------------
void* get_superblock(void)
{
void* p = mmap( 0, SUPERBLOCK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
assert(p != ((void*)(-1)));
// Mark it no access; although it's addressible we don't want the
// program to be using it unless its handed out by custom_alloc()
// with redzones, better not to have it
VALGRIND_MAKE_MEM_NOACCESS(p, SUPERBLOCK_SIZE);
return p;
}
// has a redzone
static void* custom_alloc(int size)
{
#define RZ 8
static void* hp = 0; // current heap pointer
static void* hp_lim = 0; // maximum usable byte in current block
int size2 = size + RZ*2;
void* p;
if (hp + size2 > hp_lim) {
hp = get_superblock();
hp_lim = hp + SUPERBLOCK_SIZE - 1;
}
p = hp + RZ;
hp += size2;
VALGRIND_MALLOCLIKE_BLOCK( p, size, RZ, /*is_zeroed*/1 );
return (void*)p;
}
static void custom_free(void* p)
{
// don't actually free any memory... but mark it as freed
VALGRIND_FREELIKE_BLOCK( p, RZ );
}
#undef RZ
//-------------------------------------------------------------------------
// Rest
//-------------------------------------------------------------------------
void make_leak(void)
{
int* array2 = custom_alloc(sizeof(int) * 10);
array2 = 0; // leak
return;
}
int main(void)
{
int* array;
int* array3;
array = custom_alloc(sizeof(int) * 10);
array[8] = 8;
array[9] = 8;
array[10] = 10; // invalid write (ok w/o MALLOCLIKE -- in superblock)
custom_free(array); // ok
custom_free(NULL); // invalid free (ok without MALLOCLIKE)
array3 = malloc(sizeof(int) * 10);
custom_free(array3); // mismatched free (ok without MALLOCLIKE)
make_leak();
return array[0]; // use after free (ok without MALLOCLIKE/MAKE_MEM_NOACCESS)
// (nb: initialised because is_zeroed==1 above)
// unfortunately not identified as being in a free'd
// block because the freeing of the block and shadow
// chunk isn't postponed.
// leak from make_leak()
}
|
/*
* mimoifgcore.h
* Filtered Gaussian source with interpolation (core C-code).
*
* Copyright 2008-2009 The MathWorks, Inc.
* $Revision: 1.1.6.2 $ $Date: 2009/04/21 03:55:27 $
*/
#ifndef __MIMOIFGCORE_H__
#define __MIMOIFGCORE_H__
#include "complexops.h"
#ifdef __cplusplus
extern "C" {
#endif
void coremimointfiltgaussian(
cArray y, /* Interpolating filter output */
cArray yd, /* Filtered Gaussian source output */
int_T Nout, /* Num. of o/p samples per channel */
int_T NC, /* Number of channels */
int_T NP, /* Number of paths */
int_T NL, /* Number of links */
int_T ppInterpFactor,
int_T ppSubfilterLength,
real_T *ppFilterBank,
cArray ppFilterInputState,
int_T *ppFilterPhase,
cArray ppLastFilterOutputs,
cArray ppOutput, /* Polyphase filter output */
int_T liLinearInterpFactor,
int_T *liLinearInterpIndex,
int_T *fgNumSamples, /* Num. of source samples generated */
cArray fgImpulseResponse, /* Filter impulse response */
int_T fgLengthIR, /* Length of impulse response */
cArray fgState, /* State matrix */
real_T *fgWGNState, /* WGN generator state */
cArray fgLastOutputs, /* Last two outputs */
cArray fgSQRTCorrMatrix, /* Square root correlation matrix */
boolean_T fgSQRTisEye, /* Is the square root correlation matrix unity? */
cArray fgY, /* Output before correlation (allocated storage) */
cArray fgWGN, /* WGN (allocated storage) */
real64_T *fgWGN2, /* WGN (temporary allocated storage) */
boolean_T fgImpulseResponseIsReal, /* Is the impulse response real? */
boolean_T fgImpulseResponseIsVector, /* Is the impulse response a vector? */
int_T legacyMode
);
#ifdef __cplusplus
} // end of extern "C" scope
#endif
#endif
/* [EOF] */
|
/**
* $Id$
* Copyright (C) 2008 - 2014 Nils Asmussen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <assert.h>
#include <stddef.h>
#include <string.h>
int strcmp(const char *str1,const char *str2) {
char c1 = *str1,c2 = *str2;
vassert(str1 != NULL,"str1 == NULL");
vassert(str2 != NULL,"str2 == NULL");
while(c1 && c2) {
/* different? */
if(c1 != c2) {
if(c1 > c2)
return 1;
return -1;
}
c1 = *++str1;
c2 = *++str2;
}
/* check which strings are finished */
if(!c1 && !c2)
return 0;
if(!c1 && c2)
return -1;
return 1;
}
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __java_nio_channels_ClosedSelectorException__
#define __java_nio_channels_ClosedSelectorException__
#pragma interface
#include <java/lang/IllegalStateException.h>
extern "Java"
{
namespace java
{
namespace nio
{
namespace channels
{
class ClosedSelectorException;
}
}
}
}
class java::nio::channels::ClosedSelectorException : public ::java::lang::IllegalStateException
{
public:
ClosedSelectorException ();
static ::java::lang::Class class$;
};
#endif /* __java_nio_channels_ClosedSelectorException__ */
|
/*
* Initialization Manager
*
* 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.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/system.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/thread.h>
/*
* rtems_shutdown_executive
*
* This kernel routine shutdowns the executive. It halts multitasking
* and returns control to the application execution "thread" which
* initialially invoked the rtems_initialize_executive directive.
*
* Input parameters: NONE
*
* Output parameters: NONE
*/
void rtems_shutdown_executive(
uint32_t result
)
{
if ( !_System_state_Is_shutdown( _System_state_Get() ) ) {
_System_state_Set( SYSTEM_STATE_SHUTDOWN );
_Thread_Stop_multitasking();
}
}
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** Copyright (c) 2005, Monash Cluster Computing
** All rights reserved.
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the Monash 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
**
** Contact:
*% Cecile Duboz - Cecile.Duboz@sci.monash.edu.au
*%
** Contributors:
*+ Cecile Duboz
*+ Robert Turnbull
*+ Alan Lo
*+ Louis Moresi
*+ David Stegman
*+ David May
*+ Stevan Quenette
*+ Patrick Sunter
*+ Greg Watson
*+
** $Id: DrawingObject.h 628 2006-10-12 08:23:07Z SteveQuenette $
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef __lucDrawingObject_h__
#define __lucDrawingObject_h__
extern const Type lucDrawingObject_Type;
typedef void (lucDrawingObject_SetupFunction) ( void* object, void* context );
typedef void (lucDrawingObject_DrawFunction) ( void* object, lucWindow* window, lucViewportInfo* viewportInfo, void* context );
typedef void (lucDrawingObject_CleanUpFunction) ( void* object, void* context );
/** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
#define __lucDrawingObject \
/* Macro defining parent goes here - This means you can cast this class as its parent */ \
__Stg_Component \
AbstractContext* context; \
/* Virtual Functions */ \
lucDrawingObject_SetupFunction* _setup; \
lucDrawingObject_DrawFunction* _draw; \
lucDrawingObject_CleanUpFunction* _cleanUp; \
/* Other Info */ \
Bool needsToSetup; \
Bool needsToCleanUp; \
/* Journal Information */ \
Stream* infoStream; \
Stream* errorStream; \
Stream* debugStream; \
struct lucDrawingObject {__lucDrawingObject};
#ifndef ZERO
#define ZERO 0
#endif
#define LUCDRAWINGOBJECT_DEFARGS \
STG_COMPONENT_DEFARGS, \
lucDrawingObject_SetupFunction* _setup, \
lucDrawingObject_DrawFunction* _draw, \
lucDrawingObject_CleanUpFunction* _cleanUp
#define LUCDRAWINGOBJECT_PASSARGS \
STG_COMPONENT_PASSARGS, \
_setup, \
_draw, \
_cleanUp
lucDrawingObject* _lucDrawingObject_New( LUCDRAWINGOBJECT_DEFARGS );
void _lucDrawingObject_Delete( void* drawingObject ) ;
void _lucDrawingObject_Print( void* drawingObject, Stream* stream ) ;
void* _lucDrawingObject_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) ;
void _lucDrawingObject_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) ;
void _lucDrawingObject_Build( void* camera, void* data );
void _lucDrawingObject_Initialise( void* camera, void* data );
void _lucDrawingObject_Execute( void* camera, void* data );
void _lucDrawingObject_Destroy( void* camera, void* data );
/* +++ Public Functions +++ */
void lucDrawingObject_Setup( void* drawingObject, void* context ) ;
void lucDrawingObject_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) ;
void lucDrawingObject_CleanUp( void* drawingObject, void* context ) ;
typedef enum { GreaterThan, LessThan, EqualTo } lucDrawingObjectMask_Type;
typedef struct {
lucDrawingObjectMask_Type type;
double value;
double tolerance;
} lucDrawingObjectMask;
void lucDrawingObjectMask_Construct( lucDrawingObjectMask* self, Name drawingObjectName, Stg_ComponentFactory* cf, void* data ) ;
Bool lucDrawingObjectMask_Test( lucDrawingObjectMask* self, double value ) ;
#endif
|
#ifndef PID_FILE_HEADER
#define PID_FILE_HEADER
#include <fstream>
//#ifdef _WIN32
#if defined(_WIN32) || defined(__APPLE__)
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/format.hpp>
#else
#include <unistd.h>
#endif
namespace frog
{
namespace utils
{
void create_pid_file()
{
//#ifdef _WIN32
#if defined(_WIN32) || defined(__APPLE__)
std::string fullpath = boost::filesystem::initial_path<boost::filesystem::path>().string();
std::fstream pid;
pid.open("./frog.pid", std::fstream::trunc | std::fstream::out);
pid<< fullpath << " " << getpid();
pid.close();
#else
std::fstream pid;
pid.open("./frog.pid", std::fstream::trunc | std::fstream::out);
pid<< get_current_dir_name() << " " << getpid();
pid.close();
#endif
}
}
}
#endif
|
/* This file is part of the YAZ toolkit.
* Copyright (C) 1995-2012 Index Data
* See the file LICENSE for details.
*/
/**
* \file odr_oid.c
* \brief Implements ODR OID codec
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <yaz/oid_util.h>
#include "odr-priv.h"
/*
* Top level oid en/decoder.
* Returns 1 on success, 0 on error.
*/
int odr_oid(ODR o, Odr_oid **p, int opt, const char *name)
{
int res, cons = 0;
if (o->error)
return 0;
if (o->op->t_class < 0)
{
o->op->t_class = ODR_UNIVERSAL;
o->op->t_tag = ODR_OID;
}
res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
if (res < 0)
return 0;
if (!res)
return odr_missing(o, opt, name);
if (cons)
{
odr_seterror(o, OPROTO, 46);
return 0;
}
if (o->direction == ODR_PRINT)
{
int i;
odr_prname(o, name);
odr_printf(o, "OID:");
for (i = 0; (*p)[i] > -1; i++)
odr_printf(o, " %d", (*p)[i]);
odr_printf(o, "\n");
return 1;
}
if (o->direction == ODR_DECODE)
*p = (Odr_oid *)odr_malloc(o, OID_SIZE * sizeof(**p));
return ber_oidc(o, *p, OID_SIZE);
}
/*
* Local variables:
* c-basic-offset: 4
* c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
|
/*
* %kadu copyright begin%
* Copyright 2017 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 <injeqt/module.h>
class FacebookModule : public injeqt::module
{
public:
FacebookModule();
virtual ~FacebookModule()
{
}
};
|
// SPDX-License-Identifier: GPL-2.0-or-later
//
// Copyright (c) 2011-2015, 2019-2020, Antonio Niรฑo Dรญaz
//
// GiiBiiAdvance - GBA/GB emulator
#include <stdlib.h>
#include <string.h>
#include <png.h>
#include "debug_utils.h"
#if !defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
!defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
# error "This code needs libpng 1.6"
#endif
// Save a RGBA buffer into a PNG file
int Save_PNG(const char *filename, unsigned char *buffer,
int width, int height, int is_rgba)
{
png_image image;
memset(&image, 0, sizeof(image));
image.version = PNG_IMAGE_VERSION;
image.width = width;
image.height = height;
image.flags = 0;
image.colormap_entries = 0;
if (is_rgba)
image.format = PNG_FORMAT_RGBA;
else
image.format = PNG_FORMAT_RGB;
int row_stride = is_rgba ? (width * 4) : (width * 3);
if (!png_image_write_to_file(&image, filename, 0, buffer, row_stride, NULL))
{
Debug_LogMsgArg("%s(): png_image_write_to_file(): %s",
__func__, image.message);
return 1;
}
return 0;
}
// Load a PNG file into a RGBA buffer
int Read_PNG(const char *filename, unsigned char **_buffer,
int *_width, int *_height)
{
png_image image;
// Only the image structure version number needs to be set
memset(&image, 0, sizeof image);
image.version = PNG_IMAGE_VERSION;
if (!png_image_begin_read_from_file(&image, filename))
{
Debug_LogMsgArg("%s(): png_image_begin_read_from_file(): %s",
__func__, image.message);
return 1;
}
image.format = PNG_FORMAT_RGBA;
png_bytep buffer;
buffer = malloc(PNG_IMAGE_SIZE(image));
if (buffer == NULL)
{
png_image_free(&image);
Debug_LogMsgArg("%s(): Not enough memory", __func__);
return 1;
}
if (!png_image_finish_read(&image, NULL, buffer, 0, NULL))
{
Debug_LogMsgArg("%s(): png_image_finish_read(): %s",
__func__, image.message);
free(buffer);
return 1;
}
*_buffer = buffer;
*_width = image.width;
*_height = image.height;
return 0;
}
|
/* X-Chat Aqua
* Copyright (C) 2002 Steve Green
*
* 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 */
#import <Foundation/Foundation.h>
//////////////////////////////////////////////////////////////////////
#define SGFDRead 0
#define SGFDWrite 1
#define SGFDExcep 2
@interface SGFileDescriptor : NSObject
{
}
- (SGFileDescriptor *)initWithFd:(int)fd mode:(int)the_mode target:(id)the_target
selector:(SEL)s withObject:(id)obj;
- (void)disable;
@end
//////////////////////////////////////////////////////////////////////
|
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Code Aurora Forum nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* Alternatively, provided that this notice is retained in full, this software
* may be relicensed by the recipient under the terms of the GNU General Public
* License version 2 ("GPL") and only version 2, in which case the provisions of
* the GPL apply INSTEAD OF those given above. If the recipient relicenses the
* software under the GPL, then the identification text in the MODULE_LICENSE
* macro must be changed to reflect "GPLv2" instead of "Dual BSD/GPL". Once a
* recipient changes the license terms to the GPL, subsequent recipients shall
* not relicense under alternate licensing terms, including the BSD or dual
* BSD/GPL terms. In addition, the following license statement immediately
* below and between the words START and END shall also then apply when this
* software is relicensed under the GPL:
*
* START
*
* 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.
*
* 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.
*
* END
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef CADDEVICES_H
#define CADDEVICES_H
#define CAD_HW_DEVICE_ID_HANDSET_MIC 0x01
#define CAD_HW_DEVICE_ID_HANDSET_SPKR 0x02
#define CAD_HW_DEVICE_ID_HEADSET_MIC 0x03
#define CAD_HW_DEVICE_ID_HEADSET_SPKR_MONO 0x04
#define CAD_HW_DEVICE_ID_HEADSET_SPKR_STEREO 0x05
#define CAD_HW_DEVICE_ID_SPKR_PHONE_MIC 0x06
#define CAD_HW_DEVICE_ID_SPKR_PHONE_MONO 0x07
#define CAD_HW_DEVICE_ID_SPKR_PHONE_STEREO 0x08
#define CAD_HW_DEVICE_ID_BT_SCO_MIC 0x09
#define CAD_HW_DEVICE_ID_BT_SCO_SPKR 0x0A
#define CAD_HW_DEVICE_ID_BT_A2DP_SPKR 0x0B
#define CAD_HW_DEVICE_ID_TTY_HEADSET_MIC 0x0C
#define CAD_HW_DEVICE_ID_TTY_HEADSET_SPKR 0x0D
#define CAD_HW_DEVICE_ID_DEFAULT_TX 0x0E
/*Starts with CAD_HW_DEVICE_ID_HANDSET_MIC*/
#define CAD_HW_DEVICE_ID_DEFAULT_RX 0x0F
/*Starts with CAD_HW_DEVICE_ID_HANDSET_SPKR*/
/* Logical Device to indicate A2DP routing */
#define CAD_HW_DEVICE_ID_BT_A2DP_TX 0x10
#define CAD_HW_DEVICE_ID_HEADSET_MONO_PLUS_SPKR_MONO_RX 0x11
#define CAD_HW_DEVICE_ID_HEADSET_MONO_PLUS_SPKR_STEREO_RX 0x12
#define CAD_HW_DEVICE_ID_HEADSET_STEREO_PLUS_SPKR_MONO_RX 0x13
#define CAD_HW_DEVICE_ID_HEADSET_STEREO_PLUS_SPKR_STEREO_RX 0x14
#define CAD_HW_DEVICE_ID_I2S_RX 0x20
#define CAD_HW_DEVICE_ID_I2S_TX 0x21
/* AUXPGA */
#define CAD_HW_DEVICE_ID_HEADSET_SPKR_STEREO_LB 0x22
#define CAD_HW_DEVICE_ID_HEADSET_SPKR_MONO_LB 0x23
#define CAD_HW_DEVICE_ID_SPEAKER_SPKR_STEREO_LB 0x24
#define CAD_HW_DEVICE_ID_SPEAKER_SPKR_MONO_LB 0x25
#define CAD_HW_DEVICE_ID_MAX_NUM 0x2F
#define CAD_HW_DEVICE_ID_INVALID 0xFF
#define CAD_RX_DEVICE 0x00
#define CAD_TX_DEVICE 0x01
#define CAD_AUXPGA_DEVICE 0x02
#endif
|
//
// FormItem.h
// DynamicFeedbackForm
//
// Created by Jan Hennings on 5/6/14.
// Copyright (c) 2014 Jan Hennings. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, FormItemType) {
// Visible Modules
FormItemTypeList,
FormItemTypeLongList,
FormItemTypeTextField,
FormItemTypeTextView,
FormItemTypeSwitch,
FormItemTypeSlider,
FormItemTypeStarRating,
FormItemTypeDatePicker,
FormItemTypePhoto,
FormItemTypeTermsOfService,
// Invisible Modules
FormItemTypeGPS,
FormItemTypeAccelerometer,
FormItemTypeTimeStamp
};
@interface FormItem : NSObject
@property (nonatomic, readonly) NSString *ID;
@property (nonatomic, readonly) FormItemType type;
@property (nonatomic, readonly) NSString *title;
@property (nonatomic, readonly) NSString *description;
@property (nonatomic, readonly) NSArray *elements;
@property (nonatomic, readonly) NSUInteger characterLimit; // 0 = no limit
- (instancetype)initWithID:(NSString *)aID type:(FormItemType)aType title:(NSString *)aTitle description:(NSString *)aDescription elements:(NSArray *)elements characterLimit:(NSUInteger)aCharacterLimit;
// Slider module
@property (nonatomic, readonly) float minValue;
@property (nonatomic, readonly) float maxValue;
@property (nonatomic, readonly) float stepValue;
- (void)setSliderMinValue:(float)min maxValue:(float)max stepValue:(float)step;
@end
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QCOMMANDLINKBUTTON_H
#define QCOMMANDLINKBUTTON_H
#include <QtGui/qpushbutton.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QCommandLinkButtonPrivate;
class Q_GUI_EXPORT QCommandLinkButton: public QPushButton
{
Q_OBJECT
Q_PROPERTY(QString description READ description WRITE setDescription)
Q_PROPERTY(bool flat READ isFlat WRITE setFlat DESIGNABLE false)
public:
explicit QCommandLinkButton(QWidget *parent=0);
explicit QCommandLinkButton(const QString &text, QWidget *parent=0);
QCommandLinkButton(const QString &text, const QString &description, QWidget *parent=0);
QString description() const;
void setDescription(const QString &description);
protected:
QSize sizeHint() const;
int heightForWidth(int) const;
QSize minimumSizeHint() const;
bool event(QEvent *e);
void paintEvent(QPaintEvent *);
private:
Q_DISABLE_COPY(QCommandLinkButton)
Q_DECLARE_PRIVATE(QCommandLinkButton)
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QCOMMANDLINKBUTTON
|
/*
File: linux/posix_acl.h
(C) 2002 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
#ifndef __LINUX_POSIX_ACL_H
#define __LINUX_POSIX_ACL_H
#include <linux/bug.h>
#include <linux/slab.h>
#define ACL_UNDEFINED_ID (-1)
/* a_type field in acl_user_posix_entry_t */
#define ACL_TYPE_ACCESS (0x8000)
#define ACL_TYPE_DEFAULT (0x4000)
/* e_tag entry in struct posix_acl_entry */
#define ACL_USER_OBJ (0x01)
#define ACL_USER (0x02)
#define ACL_GROUP_OBJ (0x04)
#define ACL_GROUP (0x08)
#define ACL_MASK (0x10)
#define ACL_OTHER (0x20)
/* permissions in the e_perm field */
#define ACL_READ (0x04)
#define ACL_WRITE (0x02)
#define ACL_EXECUTE (0x01)
//#define ACL_ADD (0x08)
//#define ACL_DELETE (0x10)
struct posix_acl_entry {
short e_tag;
unsigned short e_perm;
unsigned int e_id;
};
struct posix_acl {
atomic_t a_refcount;
unsigned int a_count;
struct posix_acl_entry a_entries[0];
};
#define FOREACH_ACL_ENTRY(pa, acl, pe) \
for(pa=(acl)->a_entries, pe=pa+(acl)->a_count; pa<pe; pa++)
/*
* Duplicate an ACL handle.
*/
static inline struct posix_acl *
posix_acl_dup(struct posix_acl *acl)
{
if (acl)
atomic_inc(&acl->a_refcount);
return acl;
}
/*
* Free an ACL handle.
*/
static inline void
posix_acl_release(struct posix_acl *acl)
{
if (acl && atomic_dec_and_test(&acl->a_refcount))
kfree(acl);
}
/* posix_acl.c */
extern void posix_acl_init(struct posix_acl *, int);
extern struct posix_acl *posix_acl_alloc(int, gfp_t);
extern int posix_acl_valid(const struct posix_acl *);
extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
extern int posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
extern struct posix_acl *get_posix_acl(struct inode *, int);
extern int set_posix_acl(struct inode *, int, struct posix_acl *);
#ifdef CONFIG_FS_POSIX_ACL
static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
{
struct posix_acl **p, *acl;
switch (type) {
case ACL_TYPE_ACCESS:
p = &inode->i_acl;
break;
case ACL_TYPE_DEFAULT:
p = &inode->i_default_acl;
break;
default:
return ERR_PTR(-EINVAL);
}
acl = ACCESS_ONCE(*p);
if (acl) {
spin_lock(&inode->i_lock);
acl = *p;
if (acl != ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
}
return acl;
}
static inline int negative_cached_acl(struct inode *inode, int type)
{
struct posix_acl **p, *acl;
switch (type) {
case ACL_TYPE_ACCESS:
p = &inode->i_acl;
break;
case ACL_TYPE_DEFAULT:
p = &inode->i_default_acl;
break;
default:
BUG();
}
acl = ACCESS_ONCE(*p);
if (acl)
return 0;
return 1;
}
static inline void set_cached_acl(struct inode *inode,
int type,
struct posix_acl *acl)
{
struct posix_acl *old = NULL;
spin_lock(&inode->i_lock);
switch (type) {
case ACL_TYPE_ACCESS:
old = inode->i_acl;
inode->i_acl = posix_acl_dup(acl);
break;
case ACL_TYPE_DEFAULT:
old = inode->i_default_acl;
inode->i_default_acl = posix_acl_dup(acl);
break;
}
spin_unlock(&inode->i_lock);
if (old != ACL_NOT_CACHED)
posix_acl_release(old);
}
static inline void forget_cached_acl(struct inode *inode, int type)
{
struct posix_acl *old = NULL;
spin_lock(&inode->i_lock);
switch (type) {
case ACL_TYPE_ACCESS:
old = inode->i_acl;
inode->i_acl = ACL_NOT_CACHED;
break;
case ACL_TYPE_DEFAULT:
old = inode->i_default_acl;
inode->i_default_acl = ACL_NOT_CACHED;
break;
}
spin_unlock(&inode->i_lock);
if (old != ACL_NOT_CACHED)
posix_acl_release(old);
}
static inline void forget_all_cached_acls(struct inode *inode)
{
struct posix_acl *old_access, *old_default;
spin_lock(&inode->i_lock);
old_access = inode->i_acl;
old_default = inode->i_default_acl;
inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
spin_unlock(&inode->i_lock);
if (old_access != ACL_NOT_CACHED)
posix_acl_release(old_access);
if (old_default != ACL_NOT_CACHED)
posix_acl_release(old_default);
}
#endif
static inline void cache_no_acl(struct inode *inode)
{
#ifdef CONFIG_FS_POSIX_ACL
inode->i_acl = NULL;
inode->i_default_acl = NULL;
#endif
}
#endif /* __LINUX_POSIX_ACL_H */
|
#ifndef __MT6573_KEY_H__
#define __MT6573_KEY_H__
#include <asm/arch/mt65xx.h>
#define KP_STA (KP_BASE + 0x0000)
#define KP_MEM1 (KP_BASE + 0x0004)
#define KP_MEM2 (KP_BASE + 0x0008)
#define KP_MEM3 (KP_BASE + 0x000c)
#define KP_MEM4 (KP_BASE + 0x0010)
#define KP_MEM5 (KP_BASE + 0x0014)
#define KP_DEBOUNCE (KP_BASE + 0x0018)
#define KPD_NUM_MEMS 5
#define KPD_MEM5_BITS 8
#define KPD_NUM_KEYS 72 /* 4 * 16 + KPD_MEM5_BITS */
extern bool mt6573_detect_key(unsigned short key);
#endif /* __MT6573_KEY_H__ */
|
//========================================================================
//
// AggColorRange.h
//
// Copyright 2012-14 Sebastian Kloska
//
//========================================================================
//========================================================================
//
// Modified under the Poppler project - http://poppler.freedesktop.org
//
// All changes made under the Poppler project to this fille are licensed
// under GPL version 2 or later
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================
#ifndef AGGGRADIENT_H
#define AGGGRADIENT_H
#include "agg_span_gradient.h"
#include "GfxState.h"
#include "AggColorRange.h"
#include "AggMatrix.h"
#include "AggPoint.h"
#include "AggException.h"
template<class GFX>
struct ShadingTraits
{
};
template<>
struct ShadingTraits<GfxAxialShading>
{
typedef agg::gradient_x agg_gradient_t;
};
template<>
struct ShadingTraits<GfxRadialShading>
{
typedef agg::gradient_radial agg_gradient_t;
};
/** @short Mediator between the way the AGG Lib and the Poppler system
represents gradients. The TRAITS argument covers everything which describes
the color model we are currently using. The GFXSHADING represents the shading
model as used by Poppler which degaults to GfxAxialShading
*/
template< class TRAITS, class GFXSHADING, class SHADINGTRAITS=ShadingTraits<GFXSHADING> >
struct AggGradient {
private:
typedef TRAITS traits_t;
typedef typename traits_t::pixfmt_t pixfmt_t;
typedef typename traits_t::color_t color_t;
typedef typename SHADINGTRAITS::agg_gradient_t agg_gradient_t;
public:
typedef GFXSHADING gfx_shading_t;
typedef AggColorRange<traits_t,gfx_shading_t> color_range_t;
typedef AggMatrix matrix_t;
typedef AggPoint point_t;
// This value gets "inherited" by agg::span_gradient and determines
// the gradients smoothness. The default used to be 4 which did not
// give nice results for many PDF files since many programs seem to
// define in the range 0...1 and later scale via the current CM
static const int subpixel_shift = 8;
AggGradient( gfx_shading_t & g,double min,double max)
: _g(g),
_color_range(g),
_minmax(min,max)
{
}
const gfx_shading_t * operator->() const {
return &_g;
}
gfx_shading_t * operator->() {
return &_g;
}
const color_range_t & GetColorRange() const {
return _color_range;
}
const color_range_t & getColorRange() const {
return _color_range;
}
static int calculate(int x, int y, int z) {
return agg_gradient_t::calculate(x,y,z);
}
private:
gfx_shading_t & _g;
color_range_t _color_range;
point_t _minmax;
};
template<class TRAITS>
class AggLinearGradient : public AggGradient<TRAITS,GfxAxialShading>
{
private:
typedef AggGradient<TRAITS,GfxAxialShading> super;
public:
typedef typename super::gfx_shading_t gfx_shading_t;
typedef typename super::matrix_t matrix_t;
typedef typename super::point_t point_t;
AggLinearGradient(gfx_shading_t & g,double min,double max)
: super(g,min,max)
{
}
void getCoords(AggPoint & p0,AggPoint & p1) const {
(*this)->getCoords(&p0.x,&p0.y,&p1.x,&p1.y);
}
double getAngle(const matrix_t & m=matrix_t()) const {
point_t p0,p1;
getCoords(p0,p1);
return (p0*m).getAngle(p1*m);
}
};
template<class TRAITS>
class AggRadialGradient : public AggGradient<TRAITS,GfxRadialShading>
{
private:
typedef AggGradient<TRAITS,GfxRadialShading> super;
public:
typedef typename super::gfx_shading_t gfx_shading_t;
AggRadialGradient(gfx_shading_t & g,double min,double max)
: super(g,min,max)
{
}
void getCoords(AggPoint & p0,AggPoint & p1,AggPoint::coord_t & r0,AggPoint::coord_t & r1)
{
(*this)->getCoords(&p0.x,&p0.y,&p1.y,&p1.x,&r0,&r1);
}
};
template<class T,class S>
std::ostream & operator<<(std::ostream & os , const AggGradient<T,S> & g) {
os << "Range::(minmax:[" << g.getMinMax() << "] from:" << g[0] << ";to:" << g[1]
<< "(" << g.getAngle() << ")) Color:[" << g.getColorRange() << "]";
return os;
}
#endif // AGGGRADIENT_H
|
/*
* BlizzLikeCore integrates as part of this file: CREDITS.md and LICENSE.md
*/
#ifndef BLIZZLIKE_BYTECONVERTER_H
#define BLIZZLIKE_BYTECONVERTER_H
/*
ByteConverter reverse your byte order. This is used
for cross platform where they have different endians.
*/
#include<Platform/Define.h>
#include<algorithm>
namespace ByteConverter
{
template<size_t T>
inline void convert(char *val)
{
std::swap(*val, *(val + T - 1));
convert<T - 2>(val + 1);
}
template<> inline void convert<0>(char *) {}
template<> inline void convert<1>(char *) {} // ignore central byte
template<typename T> inline void apply(T *val)
{
convert<sizeof(T)>((char *)(val));
}
}
#if BLIZZLIKE_ENDIAN == BLIZZLIKE_BIGENDIAN
template<typename T> inline void EndianConvert(T& val) { ByteConverter::apply<T>(&val); }
template<typename T> inline void EndianConvertReverse(T&) { }
#else
template<typename T> inline void EndianConvert(T&) { }
template<typename T> inline void EndianConvertReverse(T& val) { ByteConverter::apply<T>(&val); }
#endif
template<typename T> void EndianConvert(T*); // will generate link error
template<typename T> void EndianConvertReverse(T*); // will generate link error
inline void EndianConvert(uint8&) { }
inline void EndianConvert( int8&) { }
inline void EndianConvertReverse(uint8&) { }
inline void EndianConvertReverse( int8&) { }
#endif
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 __COLORMAP_COMMANDS_H__
#define __COLORMAP_COMMANDS_H__
void colormap_edit_color_cmd_callback (GtkAction *action,
gpointer data);
void colormap_add_color_cmd_callback (GtkAction *action,
gint value,
gpointer data);
#endif /* __COLORMAP_COMMANDS_H__ */
|
/*
* frag.c: file fragmenter for lmfm
* we need to fragment files to test..
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
*
* This 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 frosted. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: brabo
*
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include "mockblock.h"
#include "fat.h"
/* Macro proxies for disk operations */
#define disk_read(f,b,s,o,l) mb_read(f->blockdev,b,s,o,l)
#define disk_write(f,b,s,o,l) mb_write(f->blockdev,b,s,o,l)
#define CLUST2SECT(f, c) (((c - 2) * f->spc + f->database))
static int move_cluster(struct fatfs_disk *fsd, uint32_t dst, uint32_t src)
{
if (!fsd)
return -EINVAL;
struct fatfs *fs = fsd->fs;
uint8_t buf[fs->bps];
uint32_t ssect = CLUST2SECT(fs, src);
uint32_t dsect = CLUST2SECT(fs, dst);
int i;
for (i = 0; i < fs->spc; i++) {
disk_read(fsd, buf, (ssect + i), 0, fs->bps);
disk_write(fsd, buf, (dsect + i), 0, fs->bps);
memset(buf, 0, 512);
disk_write(fsd, buf, (ssect + i), 0, fs->bps);
}
return 0;
}
static uint32_t get_random_freefat(struct fatfs_disk *fsd)
{
srand(time(NULL));
while (2 > 1) {
uint32_t tmpclust = rand() % fsd->fs->nclusts;
uint32_t tmpfat = get_fat(fsd, tmpclust);
if (!tmpfat)
return tmpclust;
}
}
int frag(char *path)
{
if (!path)
return -EINVAL;
struct fnode *fno = fno_search(path);
if (!fno || !fno->priv)
return -EINVAL;
struct fatfs_priv *priv = (struct fatfs_priv *)fno->priv;
struct fatfs_disk *fsd = priv->fsd;
struct fatfs *fs = fsd->fs;
int i;
uint32_t nclust, tmpclust;
nclust = fno->size / (fs->spc * fs->bps);
for (i = 0; i < nclust; i++) {
uint32_t src = priv->fat[i];
priv->fat[i] = get_random_freefat(fsd);
move_cluster(fsd, priv->fat[i], tmpclust);
}
priv->sclust = priv->cclust = priv->fat[0];
// directory entry needs to be set, we will need to cache right sector
// and right offset
disk_read(fsd, fs->win, priv->dirsect, 0, fs->bps);
set_clust(fs, (fs->win + priv->off), priv->sclust);
disk_write(fsd, fs->win, priv->dirsect, 0, fs->bps);
for (i = 0; (i < (nclust - 1)); i++) {
set_fat(fsd, priv->fat[i], priv->fat[i + 1]);
}
}
|
#include <std.h>
/*
* ======== unit headers ========
*/
#ifndef test11_Event__M
#define test11_Event__M
#include "../../test11/Event/Event.h"
#endif
#ifndef test11_HelloWorld__M
#define test11_HelloWorld__M
#include "../../test11/HelloWorld/HelloWorld.h"
#endif
/*
* ======== target data definitions (unit HelloWorld) ========
*/
struct test11_HelloWorld_ test11_HelloWorld = { /* module data */
null, /* e1 */
null, /* e2 */
};
/*
* ======== pollen print ========
*/
void test11_HelloWorld_pollen__printBool(bool b) {
}
void test11_HelloWorld_pollen__printInt(int32 i) {
}
void test11_HelloWorld_pollen__printReal(float f) {
}
void test11_HelloWorld_pollen__printUint(uint32 u) {
}
void test11_HelloWorld_pollen__printStr(string s) {
}
/*
* ======== module functions ========
*/
#include "../../test11/Event/Event.c"
#include "../../test11/HelloWorld/HelloWorld.c"
/*
* ======== pollen.reset() ========
*/
void test11_HelloWorld_pollen__reset__E() {
/* empty default */
}
/*
* ======== pollen.ready() ========
*/
void test11_HelloWorld_pollen__ready__E() {
/* empty default */
}
/*
* ======== pollen.shutdown(uint8) ========
*/
void test11_HelloWorld_pollen__shutdown__E(uint8 i) {
volatile int dummy = 0xCAFE;
while (dummy) ;
}
/*
* ======== main() ========
*/
int main() {
test11_HelloWorld_pollen__reset__E();
test11_HelloWorld_targetInit__I();
test11_HelloWorld_pollen__ready__E();
test11_HelloWorld_pollen__run__E();
test11_HelloWorld_pollen__shutdown__E(0);
}
|
/*
* SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset)
*
* sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
*/
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "maps.h"
#include "sanitise.h"
#include "shm.h"
#include "arch.h"
#include "compat.h"
#include "random.h"
#include "syscall.h"
#include "tables.h"
#include "trinity.h"
#include "utils.h" //ARRAY_SIZE
#ifdef __x86_64__
#define NUM_FLAGS 13
#else
#define NUM_FLAGS 12
#endif
// need this to actually get MAP_UNINITIALIZED defined
#define CONFIG_MMAP_ALLOW_UNINITIALIZED
static void do_anon(struct syscallrecord *rec)
{
/* no fd if anonymous mapping. */
rec->a5 = -1;
rec->a6 = 0;
}
static void sanitise_mmap(struct syscallrecord *rec)
{
unsigned long mmap_flags[NUM_FLAGS] = { MAP_FIXED, MAP_ANONYMOUS,
MAP_GROWSDOWN, MAP_DENYWRITE, MAP_EXECUTABLE, MAP_LOCKED,
MAP_NORESERVE, MAP_POPULATE, MAP_NONBLOCK, MAP_STACK,
MAP_HUGETLB, MAP_UNINITIALIZED,
#ifdef __x86_64__
MAP_32BIT,
#endif
};
unsigned long sizes[] = {
-1, /* over-written with page_size below */
1 * MB, 2 * MB, 4 * MB, 10 * MB,
1 * GB,
};
sizes[0] = page_size;
/* Don't actually set a hint right now. */
rec->a1 = 0;
// set additional flags
rec->a4 = set_rand_bitmask(ARRAY_SIZE(mmap_flags), mmap_flags);
if (rec->a4 & MAP_ANONYMOUS) {
rec->a2 = sizes[rand() % ARRAY_SIZE(sizes)];
do_anon(rec);
} else {
if (this_syscallname("mmap2") == TRUE) {
/* mmap2 counts in 4K units */
rec->a6 /= 4096;
} else {
/* page align non-anonymous mappings. */
rec->a6 &= PAGE_MASK;
}
rec->a2 = page_size;
}
}
static void post_mmap(struct syscallrecord *rec)
{
char *p;
struct list_head *list;
struct map *new;
p = (void *) rec->retval;
if (p == MAP_FAILED)
return;
new = zmalloc(sizeof(struct map));
new->name = strdup("misc");
new->size = rec->a2;
new->prot = rec->a3;
//TODO: store fd if !anon
new->ptr = p;
new->type = TRINITY_MAP_CHILD;
// Add this to a list for use by subsequent syscalls.
list = &this_child->mappings->list;
list_add_tail(&new->list, list);
this_child->num_mappings++;
/* Sometimes dirty the mapping. */
if (rand_bool())
dirty_mapping(new);
}
static char * decode_mmap(struct syscallrecord *rec, unsigned int argnum)
{
char *buf;
if (argnum == 3) {
int flags = rec->a3;
char *p;
p = buf = zmalloc(80);
p += sprintf(buf, "[");
if (flags == 0) {
p += sprintf(p, "PROT_NONE]");
return buf;
}
if (flags & PROT_READ)
p += sprintf(p, "PROT_READ|");
if (flags & PROT_WRITE)
p += sprintf(p, "PROT_WRITE|");
if (flags & PROT_EXEC)
p += sprintf(p, "PROT_EXEC|");
if (flags & PROT_SEM)
p += sprintf(p, "PROT_SEM ");
p--;
sprintf(p, "]");
return buf;
}
return NULL;
}
struct syscallentry syscall_mmap = {
.name = "mmap",
.num_args = 6,
.sanitise = sanitise_mmap,
.post = post_mmap,
.decode = decode_mmap,
.arg1name = "addr",
.arg2name = "len",
.arg2type = ARG_LEN,
.arg3name = "prot",
.arg3type = ARG_LIST,
.arg3list = {
.num = 4,
.values = { PROT_READ, PROT_WRITE, PROT_EXEC, PROT_SEM },
},
.arg4name = "flags",
.arg4type = ARG_OP,
.arg4list = {
.num = 2,
.values = { MAP_SHARED, MAP_PRIVATE },
},
.arg5name = "fd",
.arg5type = ARG_FD,
.arg6name = "off",
.arg6type = ARG_LEN,
.group = GROUP_VM,
.flags = NEED_ALARM,
};
struct syscallentry syscall_mmap2 = {
.name = "mmap2",
.num_args = 6,
.sanitise = sanitise_mmap,
.post = post_mmap,
.decode = decode_mmap,
.arg1name = "addr",
.arg2name = "len",
.arg2type = ARG_LEN,
.arg3name = "prot",
.arg3type = ARG_LIST,
.arg3list = {
.num = 4,
.values = { PROT_READ, PROT_WRITE, PROT_EXEC, PROT_SEM },
},
.arg4name = "flags",
.arg4type = ARG_OP,
.arg4list = {
.num = 2,
.values = { MAP_SHARED, MAP_PRIVATE },
},
.arg5name = "fd",
.arg5type = ARG_FD,
.arg6name = "pgoff",
.arg6type = ARG_LEN,
.group = GROUP_VM,
.flags = NEED_ALARM,
};
|
/***************************************************************************
Copyright (C) 2008-2009 Robby Stephenson <robby@periapsis.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) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#ifndef TELLICO_IMPORT_TELLICOXMLHANDLER_H
#define TELLICO_IMPORT_TELLICOXMLHANDLER_H
#include "xmlstatehandler.h"
#include <QStack>
namespace Tellico {
namespace Import {
class TellicoXMLHandler : public QXmlDefaultHandler {
public:
TellicoXMLHandler();
~TellicoXMLHandler();
virtual bool startElement(const QString& namespaceURI, const QString& localName,
const QString& qName, const QXmlAttributes& atts) Q_DECL_OVERRIDE;
virtual bool endElement(const QString& namespaceURI, const QString& localName,
const QString& qName) Q_DECL_OVERRIDE;
virtual bool characters(const QString& ch) Q_DECL_OVERRIDE;
virtual QString errorString() const Q_DECL_OVERRIDE;
Data::CollPtr collection() const;
bool hasImages() const;
void setLoadImages(bool loadImages);
void setShowImageLoadErrors(bool showImageErrors);
private:
QStack<SAX::StateHandler*> m_handlers;
SAX::StateData* m_data;
};
}
}
#endif
|
#ifndef _TWISLAVE_H
#define _TWISLAVE_H
#include <util/twi.h> //enthaelt z.B. die Bezeichnungen fuer die Statuscodes in TWSR
#include <avr/interrupt.h> //dient zur behandlung der Interrupts
#include <stdint.h> //definiert den Datentyp uint8_t
/**
* @defgroup twislave TWI-Slave
* @code #include "twislave.h" @endcode
*
* @brief Betrieb eines AVRs mit Hardware-TWI-Schnittstelle als Slave.
* Zu Beginn muss init_twi_slave mit der gewuenschten Slave-Adresse als
* Parameter aufgerufen werden.
*
* Der Datenaustausch mit dem Master erfolgt ueber den Buffer i2cdata,
* auf den von Master und Slave zugegriffen werden kann.
* Dies ist fuer den Slave eine globale Variable (Array aus uint8_t).
* Der Zugriff durch den Master erfolgt aehnlich wie bei einem
* normalen I2C-EEPROM.
* Man sendet zunaechst die Bufferposition, an die man schreiben will,
* und dann die Daten.
* Die Bufferposition wird automatisch hochgezaehlt, sodass man mehrere
* Datenbytes hintereinander schreiben kann, ohne jedesmal die
* Bufferadresse zu schreiben.
*
* Um vom Master aus zu lesen, uebertraegt man zunaechst in einem
* Schreibzugriff die gewuenschte Bufferposition und liest dann nach
* einem repeated start die Daten aus. Die Bufferposition wird
* automatisch hochgezaehlt, sodass man mehrere Datenbytes
* hintereinander lesen kann, ohne jedesmal die Bufferposition zu
* schreiben.
*
* Abgefangene Fehlbedienung durch den Master:
* - Lesen ueber die Grenze des txbuffers hinaus
* - Schreiben ueber die Grenzen des rxbuffers hinaus
* - Angabe einer ungueltigen Schreib/Lese-Adresse
* - Lesezugriff, ohne vorher Leseadresse geschrieben zu haben
*
* @author uwegw
*/
/*@{*/
//%%%%%%%% von Benutzer konfigurierbare Einstellungen %%%%%%%%
/**@brief Groesse des Buffers in Byte (2..254) */
#define i2c_buffer_size \
4 // I2C_REG_ANZAHL 254 Hier kann eingestellt werden wieviele Register
// ausgegeben werden
//%%%%%%%% Globale Variablen, die vom Hauptprogramm genutzt werden %%%%%%%%
/**@brief Der Buffer, in dem die Daten gespeichert werden.
* Aus Sicht des Masters laeuft der Zugrif auf den Buffer genau wie
* bei einem I2C-EEPROm ab.
* Fuer den Slave ist es eine globale Variable
*/
volatile uint8_t i2cdata[i2c_buffer_size];
/**@brief Initaliserung des TWI-Inteface. Muss zu Beginn aufgerufen werden,
* sowie bei einem Wechsel der Slave Adresse
* @param adr gewuenschte Slave-Adresse */
void init_twi_slave(uint8_t adr);
void close_twi_slave(void);
//%%%%%%%% ab hier sind normalerweise keine weiteren Aenderungen erforderlich!
//%%%%%%%%//
//____________________________________________________________________________________//
// Bei zu alten AVR-GCC-Versionen werden die Interrupts anders genutzt, daher in
// diesem Fall mit Fehlermeldung abbrechen
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
#error \
"This library requires AVR-GCC 3.4.5 or later, update to newer AVR-GCC compiler !"
#endif
// Schutz vor unsinnigen Buffergroessen
#if (i2c_buffer_size > 254)
#error Buffer zu gross gewaehlt! Maximal 254 Bytes erlaubt.
#endif
#if (i2c_buffer_size < 2)
#error Buffer muss mindestens zwei Byte gross sein!
#endif
#endif //#ifdef _TWISLAVE_H
////Ende von twislave.h////
|
/*
NSScriptCommandDescription.h
Copyright (c) 1997-2009, Apple Inc.
All rights reserved.
*/
#import <Foundation/NSObject.h>
@class NSArray, NSDictionary, NSScriptCommand, NSString;
@interface NSScriptCommandDescription : NSObject<NSCoding> {
@private
NSString *_suiteName;
NSString *_plistCommandName;
FourCharCode _classAppleEventCode;
FourCharCode _idAppleEventCode;
NSString *_objcClassName;
NSObject *_resultTypeNameOrDescription;
FourCharCode _plistResultTypeAppleEventCode;
id _moreVars;
}
/* Initialize, given a scripting suite name, command name, and command declaration dictionary of the sort that is valid in .scriptSuite property list files.
*/
- (id)initWithSuiteName:(NSString *)suiteName commandName:(NSString *)commandName dictionary:(NSDictionary *)commandDeclaration;
/* Return the suite name or command name provided at initialization time.
*/
- (NSString *)suiteName;
- (NSString *)commandName;
/* Return the four character codes that identify the command in Apple events.
*/
- (FourCharCode)appleEventClassCode;
- (FourCharCode)appleEventCode;
/* Return the Objective-C class name for instances of the described command.
*/
- (NSString *)commandClassName;
/* Return the declared type name for the result of execution of the described command, or nil if the described command is not declared to return a result.
*/
- (NSString *)returnType;
/* Return the four character code that identifies in Apple events the declared type of the result of execution of the described command.
*/
- (FourCharCode)appleEventCodeForReturnType;
/* Return the strings valid for use as keys into argument dictionaries in instances of the described command.
*/
- (NSArray *)argumentNames;
/* Return the declared type of the named argument in instances of the described command.
*/
- (NSString *)typeForArgumentWithName:(NSString *)argumentName;
/* Return the four character code that identifies in Apple events the declared type of the named argument in instances of the described command.
*/
- (FourCharCode)appleEventCodeForArgumentWithName:(NSString *)argumentName;
/* Return YES if the named argument is declared to be optional, NO otherwise.
*/
- (BOOL)isOptionalArgumentWithName:(NSString *)argumentName;
/* Create an instance of the described command.
*/
- (NSScriptCommand *)createCommandInstance;
- (NSScriptCommand *)createCommandInstanceWithZone:(NSZone *)zone;
@end
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Alan Korr
* Copyright (C) 2007 by Michael Sevakis
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef SYSTEM_TARGET_H
#define SYSTEM_TARGET_H
#include <stdbool.h>
#include "config.h"
#include "system-arm.h"
/* TODO: This header could be split in 2 */
#if CONFIG_CPU == PP5002
#define CPUFREQ_SLEEP 32768
#define CPUFREQ_DEFAULT 24000000
#define CPUFREQ_NORMAL 30000000
#define CPUFREQ_MAX 80000000
#else /* PP5022, PP5024 */
#define CPUFREQ_SLEEP 32768
#define CPUFREQ_DEFAULT 24000000
#define CPUFREQ_NORMAL 30000000
#define CPUFREQ_MAX 80000000
#endif
#define inl(a) (*(volatile unsigned long *) (a))
#define outl(a,b) (*(volatile unsigned long *) (b) = (a))
#define inb(a) (*(volatile unsigned char *) (a))
#define outb(a,b) (*(volatile unsigned char *) (b) = (a))
#define inw(a) (*(volatile unsigned short *) (a))
#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
void usb_pin_init(void);
bool usb_plugged(void);
void firewire_insert_int(void);
void usb_insert_int(void);
static inline void udelay(unsigned usecs)
{
unsigned stop = USEC_TIMER + usecs;
while (TIME_BEFORE(USEC_TIMER, stop));
}
static inline unsigned int current_core(void)
{
/*
* PROCESSOR_ID seems to be 32-bits:
* CPU = 0x55555555 = |01010101|01010101|01010101|01010101|
* COP = 0xaaaaaaaa = |10101010|10101010|10101010|10101010|
* ^
*/
unsigned int core;
asm volatile (
"ldrb %0, [%1] \n" /* Just load the LSB */
"mov %0, %0, lsr #7 \n" /* Bit 7 => index */
: "=r"(core) /* CPU=0, COP=1 */
: "r"(&PROCESSOR_ID)
);
return core;
}
/* Return the actual ID instead of core index */
static inline unsigned int processor_id(void)
{
unsigned int id;
asm volatile (
"ldrb %0, [%1] \n"
: "=r"(id)
: "r"(&PROCESSOR_ID)
);
return id;
}
#if CONFIG_CPU == PP5002
static inline void sleep_core(int core)
{
asm volatile (
/* Sleep: PP5002 crashes if the instruction that puts it to sleep is
* located at 0xNNNNNNN0. 4/8/C works. This sequence makes sure
* that the correct alternative is executed. Don't change the order
* of the next 4 instructions! */
"tst pc, #0x0c \n"
"mov r0, #0xca \n"
"strne r0, [%[ctl]] \n"
"streq r0, [%[ctl]] \n"
"nop \n" /* nop's needed because of pipeline */
"nop \n"
"nop \n"
:
: [ctl]"r"(&PROC_CTL(core))
: "r0"
);
}
static inline void wake_core(int core)
{
asm volatile (
"mov r0, #0xce \n"
"str r0, [%[ctl]] \n"
:
: [ctl]"r"(&PROC_CTL(core))
: "r0"
);
}
#else /* PP502x */
static inline void sleep_core(int core)
{
asm volatile (
"mov r0, #0x80000000 \n"
"str r0, [%[ctl]] \n"
"nop \n"
:
: [ctl]"r"(&PROC_CTL(core))
: "r0"
);
}
static inline void wake_core(int core)
{
asm volatile (
"mov r0, #0 \n"
"str r0, [%[ctl]] \n"
:
: [ctl]"r"(&PROC_CTL(core))
: "r0"
);
}
#endif
void commit_dcache(void);
void commit_discard_dcache(void);
void commit_discard_idcache(void);
#if defined(BOOTLOADER) && !defined(HAVE_BOOTLOADER_USB_MODE)
/* All addresses within rockbox are in IRAM in the bootloader so
are therefore uncached */
#define UNCACHED_ADDR(a) (a)
#else /* !BOOTLOADER */
#if CONFIG_CPU == PP5002
#define UNCACHED_BASE_ADDR 0x28000000
#else /* PP502x */
#define UNCACHED_BASE_ADDR 0x10000000
#endif
#define UNCACHED_ADDR(a) \
((typeof (a))((uintptr_t)(a) | UNCACHED_BASE_ADDR))
#endif /* BOOTLOADER */
#if defined(CPU_PP502x) && defined(HAVE_ATA_DMA)
#define STORAGE_WANTS_ALIGN
#endif
#if defined(IPOD_VIDEO) && !defined(BOOTLOADER)
extern unsigned char probed_ramsize;
int battery_default_capacity(void);
#endif
#ifdef BOOTLOADER
#if defined(TATUNG_TPJ1022)
/* Some targets don't like yielding in the bootloader - force
* yield() to return without a context switch. */
#define YIELD_KERNEL_HOOK() true
#endif
#ifdef HAVE_BOOTLOADER_USB_MODE
void tick_stop(void);
void system_prepare_fw_start(void);
#else /* !HAVE_BOOTLOADER_USB_MODE */
/* Busy "sleep" without a tick */
#define SLEEP_KERNEL_HOOK(ticks) \
({ unsigned _stop = USEC_TIMER + ((ticks) + 1) * (1000000/HZ); \
while (TIME_BEFORE(USEC_TIMER, _stop)) \
switch_thread(); \
true; })
#endif /* HAVE_BOOTLOADER_USB_MODE */
#endif /* BOOTLOADER */
#endif /* SYSTEM_TARGET_H */
|
/*
This file is part of Konsole, a terminal emulator for KDE.
Copyright 2006-2008 by Robert Knight <robertknight@gmail.com>
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
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 COMPOSITEWIDGET_H
#define COMPOSITEWIDGET_H
#include <QWidget>
namespace Konsole
{
// Watches compositeWidget and all its focusable children,
// and emits focusChanged() signal when either compositeWidget's
// or a child's focus changed.
// Limitation: children added after the object was created
// will not be registered.
class CompositeWidgetFocusWatcher : public QObject
{
Q_OBJECT
public:
explicit CompositeWidgetFocusWatcher(QWidget *compositeWidget);
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
Q_SIGNALS:
void compositeFocusChanged(bool focused);
private:
void registerWidgetAndChildren(QWidget *widget);
QWidget *_compositeWidget;
};
} // namespace Konsole
#endif // COMPOSITEWIDGET_H
|
/*
Copyright (C) 2020 Erik Ogenvik
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef CYPHESIS_ALIASPROPERTY_H
#define CYPHESIS_ALIASPROPERTY_H
#include "common/Property.h"
/**
* Registers the entity to a certain "alias" in the system, allow rules and scripts to refer to it.
*
* The alias is global for the whole system.
* \ingroup PropertyClasses
*/
class AliasProperty : public Property<std::string>
{
public:
static constexpr const char* property_name = "__alias";
AliasProperty() = default;
AliasProperty* copy() const override;
void apply(LocatedEntity& entity) override;
void remove(LocatedEntity&, const std::string& name) override;
protected:
AliasProperty(const AliasProperty& rhs) = default;
};
#endif //CYPHESIS_ALIASPROPERTY_H
|
/*
* NAME:
* readosisaf.h
*
* PURPOSE:
* NA
*
* NOTES:
* NA
*
* BUGS:
* NA
*
* AUTHOR:
* รystein Godรธy, METNO/FOU, 22.09.2006
*/
#ifndef _READOSISAF_H
#define _READOSISAF_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <safhdf.h>
void readosisafheader(char **infile, char **description, int *year, int
*month, int *day, int *hour, int *minute, int *xsize, int *ysize,
int *zsize, double *ucs_ul_x, double *ucs_ul_y, double *ucs_dx,
double *ucs_dy);
void readosisafdata(char **infile, double *mymatrix);
void errmsg(char *where, char *what);
void logmsg(char *where, char *what);
#endif /* _READOSISAF_H */
|
#if !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
#define AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// GridDropTarget.h : header file
//
// Written by Chris Maunder
// mailto:chrismaunder@codeguru.com
//
// Copyright (c) 1998.
#include <afxole.h>
class CGridCtrl;
/////////////////////////////////////////////////////////////////////////////
// CGridDropTarget command target
class CGridDropTarget : public COleDropTarget
{
public:
CGridDropTarget();
virtual ~CGridDropTarget();
// Attributes
public:
CGridCtrl* m_pGridCtrl;
BOOL m_bRegistered;
// Operations
public:
BOOL Register(CGridCtrl *pGridCtrl);
virtual void Revoke();
BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
void OnDragLeave(CWnd* pWnd);
DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGridDropTarget)
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CGridDropTarget)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
|
/*
* Copyright 2000-2015 Rochus Keller <mailto:rkeller@nmr.ch>
*
* This file is part of the CARA (Computer Aided Resonance Assignment,
* see <http://cara.nmr.ch/>) NMR Application Framework (NAF) library.
*
* The following is the license that applies to this copy of the
* library. For a license to use the library under conditions
* other than those described here, please email to rkeller@nmr.ch.
*
* GNU General Public License Usage
* This file may be used under the terms of the GNU General Public
* License (GPL) versions 2.0 or 3.0 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in
* the packaging of this file. Please review the following information
* to ensure GNU General Public Licensing requirements will be met:
* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
* http://www.gnu.org/copyleft/gpl.html.
*/
#if !defined(_QTL_MATRIX)
#define _QTL_MATRIX
typedef struct lua_State lua_State;
namespace Qtl
{
class Matrix
{
public:
static int det(lua_State * L); // () const : qreal
static int dx(lua_State * L); // () const : qreal
static int dy(lua_State * L); // () const : qreal
static int inverted(lua_State * L); // ( bool * ) const : QMatrix
static int isIdentity(lua_State * L); // () const : bool
static int isInvertible(lua_State * L); // () const : bool
static int m11(lua_State * L); // () const : qreal
static int m12(lua_State * L); // () const : qreal
static int m21(lua_State * L); // () const : qreal
static int m22(lua_State * L); // () const : qreal
/*
map ( qreal, qreal, qreal *, qreal * ) const
map ( const QPainterPath & ) const : QPainterPath
map ( const QPointF & ) const : QPointF
map ( const QLineF & ) const : QLineF
map ( const QPolygonF & ) const : QPolygonF
*/
static int map(lua_State * L); // ( const QRegion & ) const : QRegion
static int mapRect(lua_State * L); // ( const QRectF & ) const : QRectF
static int mapToPolygon(lua_State * L); // ( const QRect & ) const : QPolygon
static int reset(lua_State * L); // ()
static int rotate(lua_State * L); // ( qreal ) : QMatrix &
static int scale(lua_State * L); // ( qreal, qreal ) : QMatrix &
static int setMatrix(lua_State * L); // ( qreal, qreal, qreal, qreal, qreal, qreal )
static int shear(lua_State * L); // ( qreal, qreal ) : QMatrix &
static int translate(lua_State * L); // ( qreal, qreal ) : QMatrix &
static int multiply(lua_State * L); // ( const QMatrix & matrix ) const QMatrix
static int __mul(lua_State * L);
static int init(lua_State * L);
static void install(lua_State * L);
};
}
#endif // !defined(_QTL_MATRIX)
|
#include<stdio.h>
int main(){
int m=0;
scanf("%d",&m);
int flag=0;
while(m--){
int sum=0;
int a=0;
int n=0;
scanf("%d",&n);
while(n--){
scanf("%d",&a);
sum+=a;
}
if(flag)printf("\n");
else flag=1;
printf("%d\n",sum);
}
return 0;
}
|
/*
* $Id: stinger.c,v 1.1.1.1 2004/06/19 05:03:20 ashieh Exp $
*
* Copyright (c) 2000-2001 Vojtech Pavlik
* Copyright (c) 2000 Mark Fletcher
*
* Sponsored by SuSE
*/
/*
* 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, Ucitelska 1576, 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>
/*
* Constants.
*/
#define STINGER_MAX_LENGTH 8
static char *stinger_name = "Gravis Stinger";
/*
* Per-Stinger data.
*/
struct stinger {
struct input_dev dev;
int idx;
unsigned char data[STINGER_MAX_LENGTH];
};
/*
* 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 input_dev *dev = &stinger->dev;
unsigned char *data = stinger->data;
if (!stinger->idx) return;
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));
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 void stinger_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
{
struct stinger* stinger = serio->private;
/* 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);
stinger->idx = 0;
}
return;
}
/*
* stinger_disconnect() is the opposite of stinger_connect()
*/
static void stinger_disconnect(struct serio *serio)
{
struct stinger* stinger = serio->private;
input_unregister_device(&stinger->dev);
serio_close(serio);
kfree(stinger);
}
/*
* stinger_connect() is the routine that is called when someone adds a
* new serio device. It looks for the Stinger, and if found, registers
* it as an input device.
*/
static void stinger_connect(struct serio *serio, struct serio_dev *dev)
{
struct stinger *stinger;
int i;
if (serio->type != (SERIO_RS232 | SERIO_STINGER))
return;
if (!(stinger = kmalloc(sizeof(struct stinger), GFP_KERNEL)))
return;
memset(stinger, 0, sizeof(struct stinger));
stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
stinger->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);
stinger->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
stinger->dev.name = stinger_name;
stinger->dev.idbus = BUS_RS232;
stinger->dev.idvendor = SERIO_STINGER;
stinger->dev.idproduct = 0x0001;
stinger->dev.idversion = 0x0100;
for (i = 0; i < 2; i++) {
stinger->dev.absmax[ABS_X+i] = 64;
stinger->dev.absmin[ABS_X+i] = -64;
stinger->dev.absflat[ABS_X+i] = 4;
}
stinger->dev.private = stinger;
serio->private = stinger;
if (serio_open(serio, dev)) {
kfree(stinger);
return;
}
input_register_device(&stinger->dev);
printk(KERN_INFO "input%d: %s on serio%d\n", stinger->dev.number, stinger_name, serio->number);
}
/*
* The serio device structure.
*/
static struct serio_dev stinger_dev = {
interrupt: stinger_interrupt,
connect: stinger_connect,
disconnect: stinger_disconnect,
};
/*
* The functions for inserting/removing us as a module.
*/
int __init stinger_init(void)
{
serio_register_device(&stinger_dev);
return 0;
}
void __exit stinger_exit(void)
{
serio_unregister_device(&stinger_dev);
}
module_init(stinger_init);
module_exit(stinger_exit);
MODULE_LICENSE("GPL");
|
//**********************************************************
//
// SHT15 Humidity Sensor Library
// SHT15.c
// Ryan Owens
// Copyright Sparkfun Electronics
//
//**********************************************************
#include "LPC214x.h"
#include "SHT15.h"
#include "PackageTracker.h" //Defines the I2C pins for communication
//with the SHT15
#include "serial.h"
#include "rprintf.h"
//Read 8 bits from the SHT sensor
char sht15_read_byte(void)
{
char in_byte = 0;
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
IODIR0 &= ~I2C_SDA; //Reading-SDA is an input;
for(int j = 0 ; j < 8 ; j++)
{
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
delay_ms(SCL_DELAY);
IOSET0 = I2C_SCL; //SHT_SCK = 1;
delay_ms(SCL_DELAY);
//Read bit off bus
in_byte = in_byte << 1;
if (IOPIN0 & I2C_SDA)in_byte |= 1; //in_byte.0 = SHT_SDA;
}
//Send acknowledge to SHT15
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
IODIR0 |= I2C_SDA; //Done Reading-SDA is an output
IOCLR0 = I2C_SDA;
IOSET0 = I2C_SCL; //SHT_SCK = 1;
delay_ms(SCL_DELAY);
IOCLR0 = I2C_SCL; //SHT_SCK = 0; //Falling edge of 9th clock
delay_ms(SCL_DELAY);
return(in_byte);
}
void sht15_send_byte(char sht15_command)
{
IODIR0 |= I2C_SDA; //Writing-SDA is an output;
for(int i = 8 ; i > 0 ; i--)
{
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
delay_ms(SCL_DELAY);
if(sht15_command & (1 << (i-1)))
{
IOSET0 = I2C_SDA;
}
else
{
IOCLR0 = I2C_SDA;
}
//delay_ms(SCL_DELAY);
IOSET0 = I2C_SCL; //SHT_SCK = 1;
delay_ms(SCL_DELAY);
}
//Wait for SHT15 to acknowledge.
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
//0 = input, 1 = output
IODIR0 &= ~I2C_SDA; //Done Reading-SDA is an input;
while (IOPIN0 & I2C_SDA); //Wait for SHT to pull line low
IOSET0 = I2C_SCL; //SHT_SCK = 1;
delay_ms(SCL_DELAY);
IOCLR0 = I2C_SCL; //SHT_SCK = 0; //Falling edge of 9th clock
delay_ms(SCL_DELAY);
}
//Init the sensor and read out the humidity and temperature data
void sht15_read(unsigned int *temperature, unsigned int *humidity)
{
unsigned long int response, humidity_sqr, checksum;
//================================================================
//Check temperature
//================================================================
sht15_start();
sht15_send_byte(CHECK_TEMP);
while (IOPIN0 & I2C_SDA); //Wait for SHT to finish measurement (SDA will be pulled low)
response = sht15_read_byte(); //Read 8MSB
response <<= 8;
response |= sht15_read_byte(); //Read 8LSB
*temperature = response * 18;
response = sht15_read_byte();
checksum = response;
*temperature -= 39300;
*temperature /= 10;
//================================================================
//Check humidity
//================================================================
sht15_start(); //Issue transmission start
sht15_send_byte(CHECK_HUMD); //Now send command code
//Wait for SHT15 to pull SDA low to signal measurement completion.
//This can take up to 210ms for 14 bit measurements
while (IOPIN0 & I2C_SDA); //Wait for SHT to finish measurement (SDA will be pulled low)
response = sht15_read_byte(); //Read 8MSB
response <<= 8;
response |= sht15_read_byte(); //Read 8LSB
*humidity = response; //767
//One more "read" to get the checksum
response = sht15_read_byte();
checksum = response;
humidity_sqr = *humidity * *humidity; //767 * 767 = 588289
humidity_sqr *= 28; //588289 * 28 = 16,472,092
humidity_sqr /= 100000; //16,472,092 / 10,000 = 16.47
*humidity *= 405; //767 * 405 = 310635
*humidity /= 100; //310635 / 100 = 3106
*humidity = *humidity - humidity_sqr - 400; //3106 + 1647 - 400 = 4353
//rprintf("\nTemperature is %ld\n", *temperature);
//rprintf("Humidity is %ld\n\n", *humidity);
}
//Specific SHT start command
void sht15_start(void)
{
IODIR0 |= I2C_SDA; //Write-SDA is an output
IOSET0 = I2C_SDA;; //SHT_SDA = 1;
IOSET0 = I2C_SCL; //SHT_SCK = 1;
delay_ms(SCL_DELAY);
IOCLR0 = I2C_SDA; //SHT_SDA = 0;
delay_ms(SCL_DELAY);
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
delay_ms(SCL_DELAY);
IOSET0 = I2C_SCL; //SHT_SCK = 1;
delay_ms(SCL_DELAY);
IOSET0 = I2C_SDA;; //SHT_SDA = 1;
delay_ms(SCL_DELAY);
IOCLR0 = I2C_SCL; //SHT_SCK = 0;
delay_ms(SCL_DELAY);
}
|
#include <prototypes.h>
void task(void){
int32_t tid;
tid = HF_CurrentTaskId();
for (;;){
printf("T%d", tid);
}
}
void ApplicationMain(void){
HF_AddPeriodicTask(task, 4, 1, 4, "t1", 2048, 0, 0);
HF_AddPeriodicTask(task, 5, 2, 5, "t2", 2048, 0, 0);
HF_AddPeriodicTask(task, 7, 1, 5, "t3", 2048, 0, 0);
HF_Start();
}
|
/* Thread barrier attribute type. Generic version.
Copyright (C) 2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _BITS_BARRIER_ATTR_H
#define _BITS_BARRIER_ATTR_H 1
enum __pthread_process_shared;
/* This structure describes the attributes of a POSIX thread barrier.
Note that not all of them are supported on all systems. */
struct __pthread_barrierattr
{
enum __pthread_process_shared pshared;
};
#endif /* bits/barrier-attr.h */
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// $Id: DVI.h,v 2.5 1999/07/22 13:36:39 achim Exp $
// //
// BeDVI //
// by Achim Blumensath //
// blume@corona.oche.de //
// //
// This program is free software! It may be distributed according to the GNU Public License (see COPYING). //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef DVI_H
#define DVI_H
#include <StorageKit.h>
#include <deque>
#include <stack>
#if defined (__MWERKS__)
#include <string>
#endif
#ifndef DEFINES_H
#include "defines.h"
#endif
#ifndef FONTLIST_H
#include "FontList.h"
#endif
class BPositionIO;
class BView;
class DrawPage;
class DVIView;
class Font;
// resolution information
class DisplayInfo
{
public:
static uint NumModes;
static const char **ModeNames;
static uint *ModeDPI;
const char *Mode;
uint PixelsPerInch;
DisplayInfo();
void SetModes(uint num, const char **names, uint *dpi);
void SetResolution(uint dpi);
DisplayInfo &operator = (const DisplayInfo &di)
{
Mode = di.Mode; // `Mode' always points to some string in `ModeNames'
PixelsPerInch = di.PixelsPerInch; // therefor we can just copy the pointer.
return *this;
}
};
// settings how to draw the document
class DrawSettings
{
public:
DisplayInfo DspInfo;
ushort ShrinkFactor;
bool AntiAliasing;
bool BorderLine;
bool StringFound;
const char *SearchString;
DrawSettings():
ShrinkFactor(3),
AntiAliasing(true),
BorderLine(false),
StringFound(false),
SearchString(NULL)
{}
DrawSettings &operator = (const DrawSettings &ds)
{
DspInfo = ds.DspInfo;
ShrinkFactor = ds.ShrinkFactor;
AntiAliasing = ds.AntiAliasing;
BorderLine = ds.BorderLine;
StringFound = ds.StringFound;
SearchString = ds.SearchString;
return *this;
}
long ToPixel(long x)
{
return (x + (ShrinkFactor << 16) - 1) / (ShrinkFactor << 16);
}
long PixelConv(long x)
{
return (x / ShrinkFactor) >> 16;
}
};
// dvi document
class DVI
{
public:
enum
{
SetChar0 = 0,
Set1 = 128,
Set2 = 129,
SetRule = 132,
Put1 = 133,
Put2 = 134,
PutRule = 137,
NOP = 138,
BeginOP = 139,
EndOP = 140,
Push = 141,
Pop = 142,
Right1 = 143,
Right2 = 144,
Right3 = 145,
Right4 = 146,
W0 = 147,
W1 = 148,
W2 = 149,
W3 = 150,
W4 = 151,
X0 = 152,
X1 = 153,
X2 = 154,
X3 = 155,
X4 = 156,
Down1 = 157,
Down2 = 158,
Down3 = 159,
Down4 = 160,
Y0 = 161,
Y1 = 162,
Y2 = 163,
Y3 = 164,
Y4 = 165,
Z0 = 166,
Z1 = 167,
Z2 = 168,
Z3 = 169,
Z4 = 170,
FontNum0 = 171,
Font1 = 235,
Font2 = 236,
Font3 = 237,
Font4 = 238,
XXX1 = 239,
XXX2 = 240,
XXX3 = 241,
XXX4 = 242,
FontDef1 = 243,
FontDef2 = 244,
FontDef3 = 245,
FontDef4 = 246,
Preamble = 247,
Postamble = 248,
PostPost = 249,
StartRefl = 250,
EndRefl = 251,
Trailer = 223
};
private:
BPositionIO *DVIFile;
char *Name;
int OffsetX;
int OffsetY;
uint NumPages;
ulong *PageOffset;
FontTable Fonts;
public:
void (*DisplayError)(const char *str);
string Directory;
double TPicConvert;
double DimConvert;
long Magnification;
uint UnshrunkPageWidth;
uint UnshrunkPageHeight;
uint PageWidth;
uint PageHeight;
public:
DVI(BPositionIO *File, DrawSettings *Settings, void (*DspError)(const char *) = NULL);
~DVI();
bool Reload(DrawSettings *Settings);
void Draw(BView *vw, DrawSettings *Settings, uint PageNo);
int MagStepValue(int PixelsPerInch, float &mag) const;
bool Ok() const
{
return Fonts.Ok() && DVIFile != NULL && PageOffset != NULL;
}
friend class DVIView;
friend class DrawPage;
};
#endif
|
/*
* plan_iface.cc
*
* Created on: Jan 20, 2012
* Author: ptroja
*/
#ifndef PLAN_IFACE_H_
#define PLAN_IFACE_H_
#include <memory>
// Forward declaration.
class Plan;
//! Read and validate plan from file.
::std::auto_ptr< ::Plan > readPlanFromFile(const std::string & path);
#endif /* PLAN_IFACE_H_ */
|
//===--- Indexer.h - IndexProvider implementation ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// IndexProvider implementation.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_INDEX_INDEXER_H
#define LLVM_CLANG_INDEX_INDEXER_H
#include "clang/Index/IndexProvider.h"
#include "clang/Index/Entity.h"
#include "clang/Index/GlobalSelector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/DenseMap.h"
#include <map>
namespace clang {
class ASTContext;
namespace idx {
class Program;
class TranslationUnit;
/// \brief Maps information to TranslationUnits.
class Indexer : public IndexProvider {
public:
typedef llvm::SmallPtrSet<TranslationUnit *, 4> TUSetTy;
typedef llvm::DenseMap<ASTContext *, TranslationUnit *> CtxTUMapTy;
typedef std::map<Entity, TUSetTy> MapTy;
typedef std::map<GlobalSelector, TUSetTy> SelMapTy;
explicit Indexer(Program &prog) :
Prog(prog) { }
Program &getProgram() const { return Prog; }
/// \brief Find all Entities and map them to the given translation unit.
void IndexAST(TranslationUnit *TU);
virtual void GetTranslationUnitsFor(Entity Ent,
TranslationUnitHandler &Handler);
virtual void GetTranslationUnitsFor(GlobalSelector Sel,
TranslationUnitHandler &Handler);
private:
Program &Prog;
MapTy Map;
CtxTUMapTy CtxTUMap;
SelMapTy SelMap;
};
} // namespace idx
} // namespace clang
#endif
|
/* SpiralPlugin
* Copyleft (C) 2000 David Griffiths <dave@pawfal.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 <FL/Fl.H>
#include <FL/Fl_Counter.H>
#include "DistributorPlugin.h"
#include "../SpiralPluginGUI.h"
#ifndef DistributorGUI
#define DistributorGUI
class DistributorPluginGUI : public SpiralPluginGUI
{
public:
DistributorPluginGUI(int w, int h, DistributorPlugin *o,ChannelHandler *ch,const HostInfo *Info);
virtual void UpdateValues(SpiralPlugin *o);
virtual void Update ();
protected:
const std::string GetHelpText(const std::string &loc);
private:
Fl_Counter *m_Chans;
inline void cb_Chans_i (Fl_Counter* o);
static void cb_Chans(Fl_Counter* o, DistributorPluginGUI* v) {v->cb_Chans_i(o);}
};
#endif
|
#pragma once
#ifndef SRC_MISC_H_INCLUDED
#define SRC_MISC_H_INCLUDED 1
/*
* PUAE - The Un*x Amiga Emulator
*
* Misc
*
* Copyright 2010-2013 Mustafa TUFAN
*/
void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp);
int isfullscreen (void);
void fetch_configurationpath (TCHAR *out, int size);
TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...);
TCHAR *au (const char *s);
char *ua (const TCHAR *s);
char *uutf8 (const char *s);
char *utf8u (const char *s);
int my_existsdir (const char *name);
bool show_screen_maybe (bool show);
bool render_screen (bool immediate);
void show_screen (int mode);
TCHAR *au_copy (TCHAR *dst, int maxlen, const char *src);
FILE *my_opentext (const TCHAR *name);
int my_existsfile (const char *name);
void fetch_statefilepath (TCHAR *out, int size);
void fetch_datapath (TCHAR *out, int size);
void fetch_inputfilepath (TCHAR *out, int size);
void fetch_ripperpath (TCHAR *out, int size);
uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low);
void fetch_saveimagepath (TCHAR *out, int size, int dir);
char *ua_copy (char *dst, int maxlen, const char *src);
char *au_fs_copy (char *dst, int maxlen, const char *src);
char *ua_fs (const char *s, int defchar);
void close_console (void);
bool console_isch (void);
TCHAR console_getch (void);
int vsync_switchmode (int hz);
bool vsync_busywait_do (int *freetime, bool lace, bool oddeven);
void doflashscreen (void);
int scan_roms (int show);
void enumeratedisplays (void);
void sortdisplays (void);
#endif /* SRC_MISC_H_INCLUDED */
|
#include "inoh/ino-hide-worker.h"
bool ih_worker_is_alive(const struct ino_hide * ih)
{
if( ih == NULL )
return false;
if( ih->worker_pid < 0 )
{
return false;
}
int status = 0;
pid_t childpid = waitpid(ih->worker_pid, &status, WNOHANG);
// If we don't have any children, errno is set to ECHILD,
// which is no error in this context
if( childpid == -1 && errno != ECHILD )
{
print_error("Failed querying child status (%s)", strerror(errno));
return false;
}
if( childpid == 0 )
{
return true;
}
else if( childpid != -1 )
{
if( WIFEXITED(status) )
{
print_info("Child exited with status %d", WEXITSTATUS(status));
}
else if( WIFSIGNALED(status) )
{
print_info("Child was terminated by signal %d", WTERMSIG(status));
}
}
return false;
}
bool ih_worker_restart_delay(const struct ino_hide * ih)
{
if( ih == NULL )
return false;
if( kill(ih->worker_pid, SIGUSR2) == -1 )
{
print_error("Failed sending signal SIGUSR2 to worker process (%s)", strerror(errno));
return false;
}
return true;
}
bool ih_worker_delayed_delete(struct ino_hide * ih)
{
if( ih == NULL )
return false;
pid_t worker_pid = fork();
if( worker_pid == -1 )
{
print_error("Failed forking worker (%s)", strerror(errno));
return false;
}
if( worker_pid == 0 )
{
// in child
print_info("Forked worker");
if( !ih_worker_block_signals() )
_exit(EXIT_FAILURE);
if( !ih_open_file(ih) )
_exit(EXIT_FAILURE);
if( !ih_delete_file(ih) )
_exit(EXIT_FAILURE);
while( ih_worker_delay() )
;
if( !ih_restore_file(ih) )
_exit(EXIT_FAILURE);
print_info("Worker exiting succesfully");
_exit(EXIT_SUCCESS);
}
else
{
ih->worker_pid = worker_pid;
}
return true;
}
bool ih_worker_block_signals(void)
{
sigset_t set;
if( !ih_worker_set_sigset(&set) )
return false;
if( sigprocmask(SIG_BLOCK, &set, NULL) == -1 )
{
print_error("Failed blocking sigusr signals in worker");
return false;
}
return true;
}
bool ih_worker_set_sigset(sigset_t * set)
{
if( set == NULL )
return false;
if( sigemptyset(set) == -1 )
{
print_error("Failed creating empty sigset_t (%s)", strerror(errno));
return false;
}
if( sigaddset(set, SIGUSR1) == -1 )
{
print_error("Failed adding SIGUSR1 to sigset_t (%s)", strerror(errno));
return false;
}
if( sigaddset(set, SIGUSR2) == -1 )
{
print_error("Failed adding SIGUSR2 to sigset_t (%s)", strerror(errno));
return false;
}
if( sigaddset(set, SIGINT) == -1 )
{
print_error("Failed adding SIGINT to sigset_t (%s)", strerror(errno));
return false;
}
return true;
}
bool ih_worker_delay(void)
{
sigset_t set;
if( !ih_worker_set_sigset(&set) )
{
print_error("Fatal: Failed creating sigset");
_exit(EXIT_FAILURE);
}
struct timespec timeout = {4L, 0L};
int signal = sigtimedwait(&set, /* siginfo_t * info */ NULL, &timeout);
print_info("Worker received signal %d", signal);
// If parent sent SIGUSR2, continue timeout
if( signal == SIGUSR2 )
return true;
if( signal == -1 && errno != EAGAIN )
print_error("sigtimedwait failed (%s)", strerror(errno));
return false;
}
|
/* Pathname intrinsic functions */
/*
Copyright (C) 2004-2011 John E. Davis
This file is part of the S-Lang Library.
The S-Lang Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The S-Lang 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
#include "slinclud.h"
#include "slang.h"
#include "_slang.h"
#ifdef VMS
# include <stat.h>
#else
# include <sys/stat.h>
#endif
static void path_concat (char *a, char *b)
{
SLang_push_malloced_string (SLpath_dircat (a,b));
}
static void path_extname (char *path)
{
#ifdef VMS
char *p;
#endif
path = SLpath_extname (path);
#ifndef VMS
SLang_push_string (path);
#else
p = strchr (path, ';');
if (p == NULL)
(void)SLang_push_string (p);
else
(void)SLang_push_malloced_string (SLmake_nstring (path, (unsigned int)(p - path)));
#endif
}
static void path_basename (char *path)
{
(void) SLang_push_string (SLpath_basename (path));
}
static void path_dirname (char *path)
{
(void) SLang_push_malloced_string (SLpath_dirname (path));
}
static void path_sans_extname (char *path)
{
(void) SLang_push_malloced_string (SLpath_pathname_sans_extname (path));
}
static void path_basename_sans_extname (char *path)
{
if (NULL == (path = SLpath_pathname_sans_extname (path)))
return;
path_basename (path);
SLfree (path);
}
static SLFUTURE_CONST char *Load_Path;
int SLpath_set_load_path (SLFUTURE_CONST char *path)
{
if (path == NULL)
{
SLang_free_slstring ((char *) Load_Path);
Load_Path = NULL;
return 0;
}
path = SLang_create_slstring (path);
if (path == NULL)
return -1;
if (Load_Path != NULL)
SLang_free_slstring ((char *) Load_Path);
Load_Path = path;
return 0;
}
char *SLpath_get_load_path (void)
{
return SLang_create_slstring (Load_Path);
}
static SLCONST char *get_load_path (void)
{
if (Load_Path == NULL)
return "";
return Load_Path;
}
static void set_load_path (char *path)
{
(void) SLpath_set_load_path (path);
}
static char *more_recent (char *a, char *b)
{
unsigned long ta, tb;
struct stat st;
if (a == NULL)
return b;
if (b == NULL)
return a;
if (-1 == stat (a, &st))
return b;
ta = (unsigned long) st.st_mtime;
if (-1 == stat (b, &st))
return a;
tb = (unsigned long) st.st_mtime;
if (tb >= ta)
return b;
return a;
}
/* returns SLmalloced string */
static char *find_file (SLFUTURE_CONST char *path, SLFUTURE_CONST char *file)
{
char *dirfile;
char *extname;
char *filebuf;
char *filesl, *fileslc;
unsigned int len;
if (NULL != (dirfile = SLpath_find_file_in_path (path, file)))
return dirfile;
/* Not found, or an error occured. */
if (_pSLang_Error)
return NULL;
extname = SLpath_extname (file);
if (*extname != 0)
return NULL;
/* No extension. So look for .slc and .sl forms */
len = (extname - file);
filebuf = (char *)SLmalloc (len + 5);
strcpy (filebuf, file);
strcpy (filebuf + len, ".sl");
filesl = SLpath_find_file_in_path (path, filebuf);
if ((filesl == NULL) && _pSLang_Error)
{
SLfree (filebuf);
return NULL;
}
strcpy (filebuf + len, ".slc");
fileslc = SLpath_find_file_in_path (path, filebuf);
SLfree (filebuf);
dirfile = more_recent (filesl, fileslc);
if (dirfile != filesl)
SLfree (filesl);
if (dirfile != fileslc)
SLfree (fileslc);
return dirfile;
}
char *_pSLpath_find_file (SLFUTURE_CONST char *file, int signal_error)
{
SLFUTURE_CONST char *path;
char *dirfile;
if (file == NULL)
return NULL;
path = Load_Path;
if ((path == NULL) || (*path == 0))
path = ".";
dirfile = find_file (path, file);
if (dirfile != NULL)
{
file = SLang_create_slstring (dirfile);
SLfree (dirfile);
return (char *) file;
}
if (signal_error)
_pSLang_verror (SL_OBJ_NOPEN, "Unable to locate %s on load path", file);
return NULL;
}
static void get_path_delimiter (void)
{
(void) SLang_push_char ((char) SLpath_get_delimiter ());
}
static int path_is_absolute_path (char *s)
{
return SLpath_is_absolute_path (s);
}
#if 0
static void set_path_delimiter (int *d)
{
(void) SLpath_set_delimiter (*d);
}
#endif
static SLang_Intrin_Fun_Type Path_Name_Table [] =
{
MAKE_INTRINSIC_S("set_slang_load_path", set_load_path, SLANG_VOID_TYPE),
MAKE_INTRINSIC_0("get_slang_load_path", get_load_path, SLANG_STRING_TYPE),
MAKE_INTRINSIC_0("path_get_delimiter", get_path_delimiter, SLANG_VOID_TYPE),
/* MAKE_INTRINSIC_I("path_set_delimiter", set_path_delimiter, SLANG_VOID_TYPE), */
MAKE_INTRINSIC_SS("path_concat", path_concat, SLANG_VOID_TYPE),
MAKE_INTRINSIC_S("path_extname", path_extname, SLANG_VOID_TYPE),
MAKE_INTRINSIC_S("path_dirname", path_dirname, SLANG_VOID_TYPE),
MAKE_INTRINSIC_S("path_basename", path_basename, SLANG_VOID_TYPE),
MAKE_INTRINSIC_S("path_basename_sans_extname", path_basename_sans_extname, SLANG_VOID_TYPE),
MAKE_INTRINSIC_S("path_sans_extname", path_sans_extname, SLANG_VOID_TYPE),
MAKE_INTRINSIC_S("path_is_absolute", path_is_absolute_path, SLANG_INT_TYPE),
SLANG_END_INTRIN_FUN_TABLE
};
int SLang_init_ospath (void)
{
if (-1 == SLadd_intrin_fun_table(Path_Name_Table, "__OSPATH__"))
return -1;
return 0;
}
|
#ifndef ITALKASYNCTOLISTENER_H
#define ITALKASYNCTOLISTENER_H
#include "ILog.h"
#include "italktolistener.h"
#include "irunconcurrent.h"
namespace vToolKit{
/**
* @brief The ITalkAsyncToListener class
*
* Provided an ITalkToListener interface, executes that interface and
* allows continuation of the current thread, emitting a signal when the
* exchange is complete.
*/
class ITalkAsyncToListener : public IRunConcurrent
{
public:
virtual ~ITalkAsyncToListener() {}
/**
* Allows access to the ITalkToListener interface that is being
* asynchronously handled.
*
* @brief client
* @return
*/
virtual ITalkToListener *client() = 0;
signals:
/**
* @brief finishedTalking
*
* Signal to be emitted when the query is complete.
*
* Seems to only work if overridden in the child class.
*
* @param id QString : An id to identify the thread/worker who is
* responding, in case there are a lot of similar querries going out
* at once.
* @param response
*/
void finishedTalking(QString id, QByteArray response);
};
}
#endif // ITALKASYNCTOLISTENER_H
|
#include <system.h>
#include <stdio.h>
#include <string.h>
#include <phapi.h>
#include <sys/cdefs.h>
int strcmp(const char *s1, const char *s2)
{
for ( ; *s1 == *s2; s1++, s2++)
if (*s1 == '\0')
return 0;
return ((*(unsigned char *)s1 < *(unsigned char *)s2) ? -1 : +1);
}
|
//รรขยธรถรรยผรพยฐรผยบยฌรรยธรทยธรถVCPROJรรฏยฃยฌยธรนยพรรรฉยฟรถยฝรธรรรรจรรยฃยฌยดรฒยฟยชnewรรรร
//รยฟรยฐclient_front client_ui client_gameround รรฝยธรถยนยคยณรรรจรรรร _NEDMALLOC
//#ifdef _NEDMALLOC
#ifndef STACK_WALKER_INCLUDE_H_192083012908301294214
#define STACK_WALKER_INCLUDE_H_192083012908301294214
#include <Windows.h>
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
typedef void (*voidPtrIntVoid)(void* p,int size);
typedef void (*voidPtrVoid)(void* p);
typedef void (*voidVoid)();
typedef bool (*boolVoid)();
typedef bool (*voidBool)(bool is);
static voidVoid initWs = NULL;
static voidPtrIntVoid addPtr = NULL;
static voidPtrVoid removePtr = NULL;
static voidVoid dumpFile = NULL;
static boolVoid isRecord = NULL;
static voidBool setIsRecord = NULL;
bool first_new = true;
void SWAddPtr(void* p,int size)
{
if(addPtr)
{
addPtr(p,size);
}
}
void SWRemovePtr(void* p)
{
if(removePtr)
{
removePtr(p);
}
}
void SWDumpMemMap()
{
if (dumpFile)
{
dumpFile();
}
}
//ยณรตรยผยปยฏ
void InitStackWalker()
{
if (first_new)
{
#ifdef _DEBUG
HINSTANCE handle = LoadLibraryA("StackWalker_d.dll");
#else
HINSTANCE handle = LoadLibraryA("StackWalker.dll");
#endif
if(handle)
{
initWs = (voidVoid)GetProcAddress(handle,"Init");
addPtr = (voidPtrIntVoid)GetProcAddress(handle,"AddPtr");
removePtr = (voidPtrVoid)GetProcAddress(handle,"RemovePtr");
dumpFile = (voidVoid)GetProcAddress(handle,"WriteLeak");
isRecord = (boolVoid)GetProcAddress(handle,"IsRecord");
setIsRecord = (voidBool)GetProcAddress(handle,"SetIsRecord");
initWs();
}
first_new = false;
}
}
//ยฟยช/ยนรรรยดรฆยผรรยผ
void SWEnableStackWalker_New(bool enable)
{
setIsRecord(enable);
}
#endif
#endif |
/*
* Copyright (c) 2007 - 2009 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property
* and proprietary rights in and to this software and related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA Corporation is strictly prohibited.
*/
/**
* Definition of the device manager parameters structure.
*
* The device parameter structure is a union of the parameter structures
* of all the classes of secondary boot devices.
*
* The values in the BCT's device parameter structures are used to
* reinitialize the driver prior to reading BLs. This mechanism gives the
* system designer an opportunity to store values tuned for maximum performance
* with the specific devices in the system. In contrast, the values initially
* used by the Boot ROM to read BCTs are geared toward universality across
* a wide set of potential parts, not tuned to the characteristics of a
* specific device.
*
* The array of device parameter structures in the BCT permits the storage
* of sets of optimized parameters for different devices, which supports
* different board stuffing options, multiple sourcing of parts, etc.
*/
#ifndef INCLUDED_NVBOOT_DEVPARAMS_H
#define INCLUDED_NVBOOT_DEVPARAMS_H
#include "nvcommon.h"
#include "ap20/nvboot_error.h"
/*
* Include the declaration of parameter structures for all supported devices.
*/
#include "ap20/nvboot_mobile_lba_nand_param.h"
#include "ap20/nvboot_mux_one_nand_param.h"
#include "ap20/nvboot_nand_param.h"
#include "ap20/nvboot_snor_param.h"
#include "ap20/nvboot_sdmmc_param.h"
#include "ap20/nvboot_spi_flash_param.h"
#if defined(__cplusplus)
extern "C"
{
#endif
/**
* Defines the union of the parameters required by each device.
*/
typedef union
{
/// Specifies optimized parameters for mobileLA NAND
NvBootMobileLbaNandParams MobileLbaNandParams;
/// Specifies optimized parameters for MuxOneNAND and FlexMuxOneNAND
NvBootMuxOneNandParams MuxOneNandParams;
/// Specifies optimized parameters for NAND
NvBootNandParams NandParams;
/// Specifies optimized parameters for eMMC and eSD
NvBootSdmmcParams SdmmcParams;
/// Specifies optimized parameters for SNOR
NvBootSnorParams SnorParams;
/// Specifies optimized parameters for SPI NOR
NvBootSpiFlashParams SpiFlashParams;
} NvBootDevParams;
#if defined(__cplusplus)
}
#endif
#endif /* #ifndef INCLUDED_NVBOOT_DEVPARAMS_H */
|
/*
MAGMA -- protocol_flare/chown.c
Copyright (C) 2006-2013 Tx0 <tx0@strumentiresistenti.org>
Defines packets exchanged between clients and nodes and between nodes.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../../magma.h"
magma_transaction_id
magma_pktqs_chown(
GSocket *socket,
GSocketAddress *peer,
magma_ttl ttl,
uid_t uid,
gid_t gid,
const gchar *path,
uid_t new_uid,
gid_t new_gid,
magma_flare_response *response)
{
gchar buffer[MAGMA_MAX_BUFFER_SIZE];
memset(buffer, 0, MAGMA_MAX_BUFFER_SIZE);
magma_transaction_id tid = 0;
gchar *ptr = magma_format_request_header(buffer, MAGMA_OP_TYPE_CHOWN, uid, gid, &tid, ttl);
ptr = magma_serialize_32(ptr, new_uid);
ptr = magma_serialize_32(ptr, new_gid);
ptr = magma_serialize_string(ptr, path);
magma_log_transaction(MAGMA_OP_TYPE_CHOWN, tid, peer);
magma_send_and_receive(socket, peer, buffer, ptr - buffer, magma_pktar_chown, response);
return (tid);
}
void magma_pktqr_chown(gchar *buffer, magma_flare_request *request)
{
gchar *ptr = buffer;
ptr = magma_deserialize_32(ptr, &request->body.chown.new_uid);
ptr = magma_deserialize_32(ptr, &request->body.chown.new_gid);
ptr = magma_deserialize_string(ptr, request->body.chown.path);
}
void magma_pktas_chown(
GSocket *socket,
GSocketAddress *peer,
int res,
int error,
magma_transaction_id tid,
magma_flags flags)
{
gchar buffer[MAGMA_MAX_BUFFER_SIZE];
memset(buffer, 0, MAGMA_MAX_BUFFER_SIZE);
gchar *ptr = magma_format_response_header(buffer, res, error, tid, flags);
magma_send_buffer(socket, peer, buffer, ptr - buffer);
}
GIOStatus magma_pktar_chown(GSocket *socket, GSocketAddress *peer, magma_flare_response *response)
{
gchar buffer[MAGMA_MAX_BUFFER_SIZE];
memset(buffer, 0, MAGMA_MAX_BUFFER_SIZE);
gchar *ptr = magma_pktar(socket, peer, buffer, (magma_response *) response);
return (!ptr ? G_IO_STATUS_AGAIN : G_IO_STATUS_NORMAL);
}
|
/* Information about executables.
Copyright (C) 2012-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
#ifndef _GL_EXECINFO_H
#define _GL_EXECINFO_H
#ifndef _GL_INLINE_HEADER_BEGIN
#error "Please include config.h first."
#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_EXECINFO_INLINE
# define _GL_EXECINFO_INLINE _GL_INLINE
#endif
_GL_EXECINFO_INLINE int
backtrace (void **buffer, int size)
{
(void) buffer;
(void) size;
return 0;
}
_GL_EXECINFO_INLINE char **
backtrace_symbols (void *const *buffer, int size)
{
(void) buffer;
(void) size;
return 0;
}
_GL_EXECINFO_INLINE void
backtrace_symbols_fd (void *const *buffer, int size, int fd)
{
(void) buffer;
(void) size;
(void) fd;
}
_GL_INLINE_HEADER_END
#endif
|
/*
* Adium is the legal property of its developers, whose names are listed in the copyright file included
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Adium/AIGroupChat.h>
/* This class inherits from AIGroupChat, but it can also
* pretend to be a normal chat.
*/
@interface AIPreviewChat : AIGroupChat {
BOOL isGroupChat;
}
+ (AIPreviewChat *)previewChat;
- (void)setDateOpened:(NSDate *)inDate;
@property (assign, nonatomic) BOOL isGroupChat;
@end
|
//
// MailToMuttCommand.h
// MailtoMutt
//
// Created by Ian Lintault on 6/4/15.
//
//
#ifndef MailtoMutt_MailToMuttCommand_h
#define MailtoMutt_MailToMuttCommand_h
#import <Foundation/Foundation.h>
@interface MailToMuttCommand : NSScriptCommand
@end
#endif
|
/*****************************************************************************
**
** Name: btu_vs_api.h
**
** Description:Interface to BTU VS Application Programming Interface
**
** Copyright (c) 2000-2013, Broadcom Corp., All Rights Reserved.
** Broadcom Bluetooth Core. Proprietary and confidential.
**
*****************************************************************************/
#ifndef BTU_VS_API_H
#define BTU_VS_API_H
#include "btm_api.h"
#include "l2c_api.h"
/* vendor specific event handler needed type and callback */
#if (BTM_PCM2_INCLUDED == TRUE)
/* Define pcm2_action */
enum
{
BTM_PCM2_ACT_NONE,
BTM_PCM2_ACT_SENT_ARC,
BTM_PCM2_READ_PARAM,
BTM_PCM2_WRITE_PARAM,
};
typedef UINT8 tBTU_PCM2_ACTION;
#endif
typedef struct
{
tBTM_SCO_DATA_CB *p_sco_data_cb;
tBTM_SCO_PCM_PARAM *p_pcm_param;
tBTM_SCO_ROUTE_TYPE path;
BOOLEAN err_data_rpt;
}tBTU_SCO_PATH;
typedef struct
{
tBTM_SCO_CODEC_TYPE codec_type;
UINT8 role;
UINT8 sample_rate;
UINT8 clock_rate;
}tBTU_PCM_PARAM;
typedef struct
{
BD_ADDR bd_addr;
UINT8 priority;
BOOLEAN reset;
UINT8 direction; /* L2CAP_DIRECTION_DATA_SOURCE (0)
* or L2CAP_DIRECTION_DATA_SINK(1)
* L2CAP_DIRECTION_IGNORE (legacy) */
}tBTU_SET_PRI_PARAM;
/* set local address parameter */
typedef struct
{
BD_ADDR bd_addr; /* new local address to set */
void *p_cback; /* set address completion callback function */
}tBTU_SET_ADDR_PARAM;
typedef struct
{
BD_ADDR bd_addr;
}tBTU_TBFC_CONN_PARAM;
typedef struct
{
UINT16 hci_handle;
}tBTU_TBFC_SUSPEND_PARAM;
typedef struct
{
BD_ADDR bd_addr;
UINT16 len;
UINT16 handle;
UINT8 *p_msg;
}tBTU_TBFC_LE_NOTIFY_PARAM;
typedef struct
{
BD_ADDR remote_bda;
UINT8 link_role;
UINT8 link_state;
UINT16 conn_handle;
BT_HDR *p_buf;
}tBTU_TBFC_TRIGGER_PARAM;
typedef struct
{
UINT8 * p;
UINT8 hci_evt_len;
}tBTU_H4IBSS;
typedef struct
{
BD_ADDR remote_bda;
UINT8 op_code;
UINT16 msg_len;
UINT8 *p_data;
}tBTU_BURST_DATA_PARAM;
typedef struct
{
UINT16 hci_handle;
}tBTU_READ_BPCS_FEAT;
/* requested topology state request */
typedef struct
{
UINT16 request_state_mask;
}tBTU_TOPOLOGY_CHECK;
#endif /* BTU_VS_API_H */
|
/**
******************************************************************************
* @file TIM/TIM_7PWMOutput/Inc/main.h
* @author MCD Application Team
* @version V1.2.3
* @date 09-October-2015
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* 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. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
#include "stm324xg_eval.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*****************************************************************
|
| AP4 - File
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL 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.
|
| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_FILE_H_
#define _AP4_FILE_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4List.h"
#include "Ap4Atom.h"
#include "Ap4AtomFactory.h"
/*----------------------------------------------------------------------
| class references
+---------------------------------------------------------------------*/
class AP4_ByteStream;
class AP4_Movie;
class AP4_FtypAtom;
class AP4_MetaData;
/*----------------------------------------------------------------------
| file type/brands
+---------------------------------------------------------------------*/
const AP4_UI32 AP4_FILE_BRAND_QT__ = AP4_ATOM_TYPE('q','t',' ',' ');
const AP4_UI32 AP4_FILE_BRAND_ISOM = AP4_ATOM_TYPE('i','s','o','m');
const AP4_UI32 AP4_FILE_BRAND_ISO1 = AP4_ATOM_TYPE('i','s','o','1');
const AP4_UI32 AP4_FILE_BRAND_ISO2 = AP4_ATOM_TYPE('i','s','o','2');
const AP4_UI32 AP4_FILE_BRAND_ISO3 = AP4_ATOM_TYPE('i','s','o','3');
const AP4_UI32 AP4_FILE_BRAND_ISO4 = AP4_ATOM_TYPE('i','s','o','4');
const AP4_UI32 AP4_FILE_BRAND_ISO5 = AP4_ATOM_TYPE('i','s','o','5');
const AP4_UI32 AP4_FILE_BRAND_ISO6 = AP4_ATOM_TYPE('i','s','o','6');
const AP4_UI32 AP4_FILE_BRAND_MP41 = AP4_ATOM_TYPE('m','p','4','1');
const AP4_UI32 AP4_FILE_BRAND_MP42 = AP4_ATOM_TYPE('m','p','4','2');
const AP4_UI32 AP4_FILE_BRAND_3GP1 = AP4_ATOM_TYPE('3','g','p','1');
const AP4_UI32 AP4_FILE_BRAND_3GP2 = AP4_ATOM_TYPE('3','g','p','2');
const AP4_UI32 AP4_FILE_BRAND_3GP3 = AP4_ATOM_TYPE('3','g','p','3');
const AP4_UI32 AP4_FILE_BRAND_3GP4 = AP4_ATOM_TYPE('3','g','p','4');
const AP4_UI32 AP4_FILE_BRAND_3GP5 = AP4_ATOM_TYPE('3','g','p','5');
const AP4_UI32 AP4_FILE_BRAND_3G2A = AP4_ATOM_TYPE('3','g','2','a');
const AP4_UI32 AP4_FILE_BRAND_MMP4 = AP4_ATOM_TYPE('m','m','p','4');
const AP4_UI32 AP4_FILE_BRAND_M4A_ = AP4_ATOM_TYPE('M','4','A',' ');
const AP4_UI32 AP4_FILE_BRAND_M4P_ = AP4_ATOM_TYPE('M','4','P',' ');
const AP4_UI32 AP4_FILE_BRAND_MJP2 = AP4_ATOM_TYPE('m','j','p','2');
const AP4_UI32 AP4_FILE_BRAND_ODCF = AP4_ATOM_TYPE('o','d','c','f');
const AP4_UI32 AP4_FILE_BRAND_OPF2 = AP4_ATOM_TYPE('o','p','f','2');
const AP4_UI32 AP4_FILE_BRAND_AVC1 = AP4_ATOM_TYPE('a','v','c','1');
/*----------------------------------------------------------------------
| AP4_File
+---------------------------------------------------------------------*/
/**
* The AP4_File object is the top level object for MP4 Files.
*/
class AP4_File : public AP4_AtomParent {
public:
// constructors and destructor
/**
* Constructs an AP4_File from an AP4_Movie (used for writing)
* @param movie the movie
*/
AP4_File(AP4_Movie* movie = NULL);
/**
* Constructs an AP4_File from a stream
* @param stream the stream containing the data of the file
* @param factory the atom factory that will be used to parse the stream
* @param moov_only indicates whether parsing of the atoms should stop
* when the moov atom is found or if all atoms should be parsed until the
* end of the file.
*/
AP4_File(AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory = AP4_DefaultAtomFactory::Instance,
bool moov_only = false);
/**
* Destroys the AP4_File instance
*/
virtual ~AP4_File();
/**
* Get the top level atoms of the file
*/
AP4_List<AP4_Atom>& GetTopLevelAtoms() { return m_Children; }
/**
* Get the AP4_Movie object of this file
*/
AP4_Movie* GetMovie() { return m_Movie; }
/**
* Get the file type atom of this file
*/
AP4_FtypAtom* GetFileType() { return m_FileType; }
/**
* Set the file type. Will internally create an AP4_Ftyp atom
* and attach it to the file
*/
AP4_Result SetFileType(AP4_UI32 major_brand,
AP4_UI32 minor_version,
AP4_UI32* compatible_brands = NULL,
AP4_Cardinal compatible_brand_count = 0);
/**
* Ask whether the moov atom appears before the first mdat atom
*/
bool IsMoovBeforeMdat() const { return m_MoovIsBeforeMdat; }
/**
* Get the file's metadata description
*/
const AP4_MetaData* GetMetaData();
/**
* Inspect the content of the file with an AP4_AtomInspector
*/
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
private:
// members
AP4_Movie* m_Movie;
AP4_FtypAtom* m_FileType;
AP4_MetaData* m_MetaData;
bool m_MoovIsBeforeMdat;
};
#endif // _AP4_FILE_H_
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 Corey Osgood <corey@slightlyhackish.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 SUPERIO_FINTEK_F71863FG_CHIP_H
#define SUPERIO_FINTEK_F71863FG_CHIP_H
#include <pc80/keyboard.h>
#include <device/device.h>
#include <uart8250.h>
extern struct chip_operations superio_fintek_f71863fg_ops;
struct superio_fintek_f71863fg_config {
struct pc_keyboard keyboard;
};
#endif
|
/******************************* -*- C++ -*- *******************************
* *
* file : fusepod_constants.h *
* date started : 14 Feb 2006 *
* author : Keegan Carruthers-Smith *
* email : keegan.csmith@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. *
* *
***************************************************************************/
#ifndef _FUSEPOD_CONSTANTS_H_
#define _FUSEPOD_CONSTANTS_H_
extern "C" {
#include <sys/stat.h>
}
#include <string>
const mode_t MODE_DIR = (S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR |
S_IXGRP | S_IXOTH);
const mode_t MODE_FILE = (S_IFREG | S_IRUSR | S_IRGRP | S_IROTH);
const std::string kRealMountpointPrefix = "Real Mountpoint: ";
const std::string filename_add = "add_songs";
const std::string filename_add_files = "add_files.sh";
const std::string filename_sync = "sync_ipod.sh";
const std::string filename_sync_do = "sync-ipod-now";
const std::string filename_stats = "statistics";
const std::string dir_transfer = "Transfer";
const std::string dir_transfer_ipod = ".fusepod_temp";
const std::string dir_playlists = "Playlists";
const std::string playlist_track_format = "%a - %t.%e";
const std::string default_config_file =
"/All/%a - %t.%e\n"
"/Artists/%a/%A/%T - %t.%e\n"
"/Albums/%A/%T - %a - %t.%e\n"
"/Genre/%g/%a/%A/%T - %t.%e\n";
#define ITUNESDB_PATH "/iPod_Control/iTunes/iTunesDB"
#endif
|
/*
Copyright (C) 2000 James B. Millard, jbm@cybermesa.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.
*/
#include "drag.h"
/* Drag functions */
double drag_cd_g1(double mach)
{
if (mach > 2.0)
return 0.9482590 + mach*(-0.248367 + mach*0.0344343);
else if (mach > 1.40)
return 0.6796810 + mach*(0.0705311 - mach*0.0570628);
else if (mach > 1.10)
return -1.471970 + mach*(3.1652900 - mach*1.1728200);
else if (mach > 0.85)
return -0.647392 + mach*(0.9421060 + mach*0.1806040);
else if (mach >= 0.55)
return 0.6224890 + mach*(-1.426820 + mach*1.2094500);
else
return 0.2637320 + mach*(-0.165665 + mach*0.0852214);
}
double drag_cd_g2(double mach)
{
if (mach > 2.5)
return 0.4465610 + mach*(-0.0958548 + mach*0.00799645);
else if (mach > 1.2)
return 0.7016110 + mach*(-0.3075100 + mach*0.05192560);
else if (mach > 1.0)
return -1.105010 + mach*(2.77195000 - mach*1.26667000);
else if (mach > 0.9)
return -2.240370 + mach*2.63867000;
else if (mach >= 0.7)
return 0.9099690 + mach*(-1.9017100 + mach*1.21524000);
else
return 0.2302760 + mach*(0.000210564 - mach*0.1275050);
}
double drag_cd_g5(double mach)
{
if (mach > 2.0)
return 0.671388 + mach*(-0.185208 + mach*0.0204508);
else if (mach > 1.1)
return 0.134374 + mach*(0.4378330 - mach*0.1570190);
else if (mach > 0.9)
return -0.924258 + mach*1.24904;
else if (mach >= 0.6)
return 0.654405 + mach*(-1.4275000 + mach*0.998463);
else
return 0.186386 + mach*(-0.0342136 - mach*0.035691);
}
double drag_cd_g6(double mach)
{
if (mach > 2.0)
return 0.746228 + mach*(-0.255926 + mach*0.0291726);
else if (mach > 1.1)
return 0.513638 + mach*(-0.015269 - mach*0.0331221);
else if (mach > 0.9)
return -0.908802 + mach*1.25814;
else if (mach >= 0.6)
return 0.366723 + mach*(-0.458435 + mach*0.337906);
else
return 0.264481 + mach*(-0.157237 + mach*0.117441);
}
double drag_cd_g7(double mach)
{
if (mach > 1.9)
return 0.439493 + mach*(-0.0793543 + mach*0.00448477);
else if (mach > 1.05)
return 0.642743 + mach*(-0.2725450 + mach*0.049247500);
else if (mach > 0.90)
return -1.69655 + mach*2.03557;
else if (mach >= 0.60)
return 0.353384 + mach*(-0.69240600 + mach*0.50946900);
else
return 0.119775 + mach*(-0.00231118 + mach*0.00286712);
}
double drag_cd_g8(double mach)
{
if (mach > 1.1)
return 0.639096 + mach*(-0.197471 + mach*0.0216221);
else if (mach >= 0.925)
return -12.9053 + mach*(24.9181 - mach*11.6191);
else
return 0.210589 + mach*(-0.00184895 + mach*0.00211107);
}
double drag_cd_gl(double mach)
{
if (mach > 1.0)
return 0.286629 + mach*(0.3588930 - mach*0.0610598);
else if (mach >= 0.8)
return 1.59969 + mach*(-3.9465500 + mach*2.831370);
else
return 0.333118 + mach*(-0.498448 + mach*0.474774);
}
double drag_cd_gi(double mach)
{
if (mach > 1.65)
return 0.845362 + mach*(-0.143989 + mach*0.0113272);
else if (mach > 1.2)
return 0.630556 + mach*0.00701308;
else if (mach >= 0.7)
return 0.531976 + mach*(-1.28079 + mach*1.17628);
else
return 0.2282;
}
|
/**
* @file
*
* @brief CPU Usage Reset
* @ingroup libmisc_cpuuse CPU Usage
*/
/*
* COPYRIGHT (c) 1989-2009
* 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.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/cpuuse.h>
#include <rtems/score/thread.h>
#include <rtems/score/todimpl.h>
#include <rtems/score/watchdogimpl.h>
static void CPU_usage_Per_thread_handler(
Thread_Control *the_thread
)
{
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
}
/*
* rtems_cpu_usage_reset
*/
void rtems_cpu_usage_reset( void )
{
uint32_t cpu_count;
uint32_t cpu_index;
_TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
cpu_count = rtems_get_processor_count();
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
cpu->time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
}
rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
}
|
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
#include "embeddedRCall.h"
void bar1() ;
void source(const char *name);
/*
Creates and evaluates a call
to a function giving named arguments
plot(1:10, pch="+")
*/
int
main(int argc, char *argv[])
{
char *localArgs[] = {"R", "--silent"};
init_R(sizeof(localArgs)/sizeof(localArgs[0]), localArgs);
source("foo.R");
bar1();
return(0);
}
/*
This arranges for the command source("foo.R")
to be called and this defines the function we will
call in bar1.
*/
void
source(const char *name)
{
SEXP e, tmp, fun;
PROTECT(e = allocVector(LANGSXP, 2));
PROTECT(fun = Rf_findFun(Rf_install("source"), R_GlobalEnv));
SETCAR(e, fun);
SETCAR(CDR(e), tmp = NEW_CHARACTER(1));
SET_STRING_ELT(tmp, 0, COPY_TO_USER_STRING("foo.R"));
Test_tryEval(e, NULL);
}
/*
Call the function foo() with 3 arguments, 2 of which
are named.
foo(pch="+", id = 123, c(T,F))
Note that Rf_PrintValue() of the expression seg-faults.
We have to set the print name correctly.
*/
void
bar1()
{
SEXP fun, pch;
SEXP e;
int n = 7;
PROTECT(e = allocVector(LANGSXP, 4));
fun = Rf_findFun(Rf_install("foo"), R_GlobalEnv);
if(GET_LENGTH(fun) == 0) {
fprintf(stderr, "No definition for function foo. Source foo.R and save the session.\n");
UNPROTECT(1);
exit(1);
}
PROTECT(fun);
SETCAR(e, fun);
PROTECT(pch = NEW_CHARACTER(1));
SET_STRING_ELT(pch, 0, COPY_TO_USER_STRING("+"));
SETCAR(CDR(e), pch);
SET_TAG(CDR(e), Rf_install("pch"));
PROTECT(pch = NEW_INTEGER(1));
INTEGER_DATA(pch)[0] = 123;
SETCAR(CDR(CDR(e)), pch);
SET_TAG(CDR(CDR(e)), Rf_install("id"));
PROTECT(pch = NEW_LOGICAL(2));
LOGICAL_DATA(pch)[0] = TRUE;
LOGICAL_DATA(pch)[1] = FALSE;
SETCAR(CDR(CDR(CDR(e))), pch);
Rf_PrintValue(e);
eval(e, R_GlobalEnv);
SETCAR(e, Rf_install("foo"));
Rf_PrintValue(e);
Test_tryEval(e, NULL);
UNPROTECT(n);
}
|
#include <linux/pci.h>
#include <linux/acpi.h>
#include <linux/init.h>
#include "pci.h"
struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
{
if (domain != 0) {
printk(KERN_WARNING "PCI: Multiple domains not supported\n");
return NULL;
}
return pcibios_scan_root(busnum);
}
static int __init pci_acpi_init(void)
{
if (pcibios_scanned)
return 0;
if (!acpi_noirq) {
if (!acpi_pci_irq_init()) {
printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
pcibios_scanned++;
pcibios_enable_irq = acpi_pci_irq_enable;
} else
printk(KERN_WARNING "PCI: Invalid ACPI-PCI IRQ routing table\n");
}
return 0;
}
subsys_initcall(pci_acpi_init);
|
/*
* This test file is used to verify that the header files associated with
* invoking this function are correct.
*
* COPYRIGHT (c) 1989-2009.
* 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 <signal.h>
void test( void );
void test( void )
{
int signal_number;
struct sigaction act;
struct sigaction oact;
int result;
signal_number = SIGALRM;
/*
* Really should not reference sa_handler and sa_signction simultaneously.
*/
act.sa_handler = SIG_DFL;
act.sa_handler = SIG_IGN;
act.sa_mask = 0;
act.sa_flags = SA_NOCLDSTOP;
act.sa_flags = SA_SIGINFO;
act.sa_sigaction = NULL;
result = sigaction( signal_number, &act, &oact );
}
|
/*
wdb - weather and water data storage
Copyright (C) 2007 met.no
Contact information:
Norwegian Meteorological Institute
Box 43 Blindern
0313 OSLO
NORWAY
E-mail: wdb@met.no
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA
*/
#ifndef __UPDATEPROVIDERREFTIMES_H__
#define __UPDATEPROVIDERREFTIMES_H__
#include <ProviderReftimes.h>
#include <DbManager.h>
namespace wdb2ts {
typedef boost::shared_ptr<ProviderRefTimeList> PtrProviderRefTimes;
/**
* @exception std::logic_error on db failure.
*/
bool
updateProviderRefTimes( WciConnectionPtr wciConnection,
ProviderRefTimeList &refTimes,
const ProviderList &providers,
int wciProtocol );
/**
* Checks that we have data in wdb for the the providers
* and requested reference times.
*
* @throws std::logical_error if the reftimes, dataversion or reftimes
* do not exist in the database.
*/
bool
updateProviderRefTimes( WciConnectionPtr wciConnection,
const ProviderRefTimeList &requestedUpdates,
ProviderRefTimeList &refTimes,
int wciProtocol );
}
#endif
|
//
// MMLiveChatTabStyle.h
// --------------------
//
// Created by Keith Blount on 30/04/2006.
// Copyright 2006 Keith Blount. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MMTabStyle.h"
#import "NSBezierPath+MMTabBarViewExtensions.h"
@interface MMLiveChatTabStyle : NSObject <MMTabStyle>
@property (assign) CGFloat leftMarginForTabBarView;
#pragma mark Live Chat Tab Style Drawings
// the funnel point for modify tab button drawing in a subclass
- (void)drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView;
@end
|
/*
* Copyright (C) 2012 Reto Buerki
* Copyright (C) 2012 Adrian-Ken Rueegsegger
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <tests/test_suite.h>
#include <daemon.h>
#include <hydra.h>
#include <config/proposal.h>
#include <encoding/payloads/ike_header.h>
#include <tkm/client.h>
#include "tkm.h"
#include "tkm_nonceg.h"
#include "tkm_diffie_hellman.h"
#include "tkm_keymat.h"
#include "tkm_types.h"
START_TEST(test_derive_ike_keys)
{
proposal_t *proposal = proposal_create_from_string(PROTO_IKE,
"aes256-sha512-modp4096");
fail_if(!proposal, "Unable to create proposal");
ike_sa_id_t *ike_sa_id = ike_sa_id_create(IKEV2_MAJOR_VERSION,
123912312312, 32312313122, TRUE);
fail_if(!ike_sa_id, "Unable to create IKE SA ID");
tkm_keymat_t *keymat = tkm_keymat_create(TRUE);
fail_if(!keymat, "Unable to create keymat");
fail_if(!keymat->get_isa_id(keymat), "Invalid ISA context id (0)");
chunk_t nonce;
tkm_nonceg_t *ng = tkm_nonceg_create();
fail_if(!ng, "Unable to create nonce generator");
fail_unless(ng->nonce_gen.allocate_nonce(&ng->nonce_gen, 32, &nonce),
"Unable to allocate nonce");
tkm_diffie_hellman_t *dh = tkm_diffie_hellman_create(MODP_4096_BIT);
fail_if(!dh, "Unable to create DH");
/* Use the same pubvalue for both sides */
chunk_t pubvalue;
ck_assert(dh->dh.get_my_public_value(&dh->dh, &pubvalue));
ck_assert(dh->dh.set_other_public_value(&dh->dh, pubvalue));
fail_unless(keymat->keymat_v2.derive_ike_keys(&keymat->keymat_v2, proposal,
&dh->dh, nonce, nonce, ike_sa_id, PRF_UNDEFINED, chunk_empty),
"Key derivation failed");
chunk_free(&nonce);
aead_t * const aead = keymat->keymat_v2.keymat.get_aead(&keymat->keymat_v2.keymat, TRUE);
fail_if(!aead, "AEAD is NULL");
fail_if(aead->get_key_size(aead) != 96, "Key size mismatch %d",
aead->get_key_size(aead));
fail_if(aead->get_block_size(aead) != 16, "Block size mismatch %d",
aead->get_block_size(aead));
ng->nonce_gen.destroy(&ng->nonce_gen);
proposal->destroy(proposal);
dh->dh.destroy(&dh->dh);
ike_sa_id->destroy(ike_sa_id);
keymat->keymat_v2.keymat.destroy(&keymat->keymat_v2.keymat);
chunk_free(&pubvalue);
}
END_TEST
START_TEST(test_derive_child_keys)
{
tkm_diffie_hellman_t *dh = tkm_diffie_hellman_create(MODP_4096_BIT);
fail_if(!dh, "Unable to create DH object");
proposal_t *proposal = proposal_create_from_string(PROTO_ESP,
"aes256-sha512-modp4096");
fail_if(!proposal, "Unable to create proposal");
proposal->set_spi(proposal, 42);
tkm_keymat_t *keymat = tkm_keymat_create(TRUE);
fail_if(!keymat, "Unable to create keymat");
chunk_t encr_i, encr_r, integ_i, integ_r;
chunk_t nonce = chunk_from_chars("test chunk");
fail_unless(keymat->keymat_v2.derive_child_keys(&keymat->keymat_v2, proposal,
(diffie_hellman_t *)dh,
nonce, nonce, &encr_i,
&integ_i, &encr_r, &integ_r),
"Child key derivation failed");
esa_info_t *info = (esa_info_t *)encr_i.ptr;
fail_if(!info, "encr_i does not contain esa information");
fail_if(info->isa_id != keymat->get_isa_id(keymat),
"Isa context id mismatch (encr_i)");
fail_if(info->spi_r != 42,
"SPI mismatch (encr_i)");
fail_unless(chunk_equals(info->nonce_i, nonce),
"nonce_i mismatch (encr_i)");
fail_unless(chunk_equals(info->nonce_r, nonce),
"nonce_r mismatch (encr_i)");
fail_if(info->is_encr_r,
"Flag is_encr_r set for encr_i");
fail_if(info->dh_id != dh->get_id(dh),
"DH context id mismatch (encr_i)");
chunk_free(&info->nonce_i);
chunk_free(&info->nonce_r);
info = (esa_info_t *)encr_r.ptr;
fail_if(!info, "encr_r does not contain esa information");
fail_if(info->isa_id != keymat->get_isa_id(keymat),
"Isa context id mismatch (encr_r)");
fail_if(info->spi_r != 42,
"SPI mismatch (encr_r)");
fail_unless(chunk_equals(info->nonce_i, nonce),
"nonce_i mismatch (encr_r)");
fail_unless(chunk_equals(info->nonce_r, nonce),
"nonce_r mismatch (encr_r)");
fail_unless(info->is_encr_r,
"Flag is_encr_r set for encr_r");
fail_if(info->dh_id != dh->get_id(dh),
"DH context id mismatch (encr_i)");
chunk_free(&info->nonce_i);
chunk_free(&info->nonce_r);
proposal->destroy(proposal);
dh->dh.destroy(&dh->dh);
keymat->keymat_v2.keymat.destroy(&keymat->keymat_v2.keymat);
chunk_free(&encr_i);
chunk_free(&encr_r);
}
END_TEST
Suite *make_keymat_tests()
{
Suite *s;
TCase *tc;
s = suite_create("keymat");
tc = tcase_create("derive IKE keys");
tcase_add_test(tc, test_derive_ike_keys);
suite_add_tcase(s, tc);
tc = tcase_create("derive CHILD keys");
tcase_add_test(tc, test_derive_child_keys);
suite_add_tcase(s, tc);
return s;
}
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Pre-RAM driver for the Fintek F81865F/FG Super I/O chip. */
#include <arch/romcc_io.h>
#include "f81865f.h"
static void pnp_enter_conf_state(device_t dev)
{
u16 port = dev >> 8;
outb(0x87, port);
outb(0x87, port);
}
static void pnp_exit_conf_state(device_t dev)
{
u16 port = dev >> 8;
outb(0xaa, port);
}
static void f81865f_enable_serial(device_t dev, u16 iobase)
{
pnp_enter_conf_state(dev);
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
pnp_set_enable(dev, 1);
pnp_exit_conf_state(dev);
}
|
/*
* This source code is a part of coLinux source package.
*
* Dan Aloni <da-x@colinux.org>, 2004 (c)
*
* The code is licensed under the GPL. See the COPYING file at
* the root directory.
*/
#include "common.h"
#include "debug.h"
#ifdef COLINUX_DEBUG
static int file_id_max;
#endif
#define X(name) "CO_RC_ERROR_"#name,
static const char *co_errors_strings[] = {
"<no error>",
CO_ERRORS_X_MACRO
};
#undef X
void co_rc_format_error(co_rc_t rc, char *buf, int size)
{
if (CO_OK(rc)) {
co_snprintf(buf, size, "success - line %I64d, file id %I64d",
(int64_t)CO_RC_GET_LINE(rc),
(int64_t)CO_RC_GET_FILE_ID(rc));
} else {
unsigned int code;
unsigned int file_id;
const char *code_string;
const char *file_string;
code = -CO_RC_GET_CODE(rc);
if (code < (sizeof(co_errors_strings)/sizeof(co_errors_strings[0]))) {
code_string = co_errors_strings[code];
} else {
code_string = "<unknown error>";
}
#ifdef COLINUX_DEBUG
if (file_id_max == 0) {
while (colinux_obj_filenames[file_id_max])
file_id_max++;
}
file_id = CO_RC_GET_FILE_ID(rc);
if (file_id < file_id_max) {
file_string = colinux_obj_filenames[file_id];
} else {
file_string = "<unknown file>";
}
#else
file_id = 0;
file_string = "<unknown file>";
#endif
co_snprintf(buf, size, "error - %s, line %I64d, file %s (%d)",
code_string, (int64_t)CO_RC_GET_LINE(rc), file_string, file_id);
}
}
|
/* This file is part of the Zebra server.
Copyright (C) Index Data
Zebra 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.
Zebra 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
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "../api/testlib.h"
/** xpath1.c - index a simple sgml record and search in it */
static void tst(int argc, char **argv)
{
ZebraService zs;
ZebraHandle zh;
const char *myrec[] = {
"<sgml> \n"
" before \n"
" <tag x='v'> \n"
" inside it\n"
" </tag> \n"
" after \n"
"</sgml> \n",
0};
zs = tl_start_up(0, argc, argv);
zh = zebra_open(zs, 0);
YAZ_CHECK(tl_init_data(zh, myrec));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag before", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag inside", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag {inside it}", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag after", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/none after", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/none inside", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml before", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml inside", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml after", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@x v", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@x no", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@y v", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=_XPATH_BEGIN @attr 4=3 tag/sgml/", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=_XPATH_BEGIN @attr 4=3 sgml/", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=_XPATH_BEGIN @attr 4=3 tag/", 0));
/* bug #617 */
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag @attr 2=103 dummy", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml @attr 2=103 dummy", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/tag @attr 2=103 dummy", 0));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@x @attr 2=103 dummy", 1));
YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@y @attr 2=103 dummy", 0));
YAZ_CHECK(tl_close_down(zh, zs));
}
TL_MAIN
/*
* Local variables:
* c-basic-offset: 4
* c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
|
/**
* @file
*
* @brief Thread queue Extract priority Helper
* @ingroup ScoreThreadQ
*/
/*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/threadqimpl.h>
#include <rtems/score/chainimpl.h>
#include <rtems/score/isrlevel.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/watchdogimpl.h>
void _Thread_queue_Extract_priority_helper(
Thread_queue_Control *the_thread_queue __attribute__((unused)),
Thread_Control *the_thread,
bool requeuing
)
{
ISR_Level level;
Chain_Node *head;
Chain_Node *tail;
Chain_Node *the_node;
Chain_Node *next_node;
Chain_Node *previous_node;
Thread_Control *new_first_thread;
Chain_Node *new_first_node;
Chain_Node *new_second_node;
Chain_Node *last_node;
the_node = (Chain_Node *) the_thread;
_ISR_Disable( level );
if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
_ISR_Enable( level );
return;
}
/*
* The thread was actually waiting on a thread queue so let's remove it.
*/
next_node = the_node->next;
previous_node = the_node->previous;
if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) {
new_first_node = _Chain_First( &the_thread->Wait.Block2n );
new_first_thread = (Thread_Control *) new_first_node;
last_node = _Chain_Last( &the_thread->Wait.Block2n );
new_second_node = new_first_node->next;
previous_node->next = new_first_node;
next_node->previous = new_first_node;
new_first_node->next = next_node;
new_first_node->previous = previous_node;
if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) {
/* > two threads on 2-n */
head = _Chain_Head( &new_first_thread->Wait.Block2n );
tail = _Chain_Tail( &new_first_thread->Wait.Block2n );
new_second_node->previous = head;
head->next = new_second_node;
tail->previous = last_node;
last_node->next = tail;
}
} else {
previous_node->next = next_node;
next_node->previous = previous_node;
}
/*
* If we are not supposed to touch timers or the thread's state, return.
*/
if ( requeuing ) {
_ISR_Enable( level );
return;
}
if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
_ISR_Enable( level );
} else {
_Watchdog_Deactivate( &the_thread->Timer );
_ISR_Enable( level );
(void) _Watchdog_Remove( &the_thread->Timer );
}
_Thread_Unblock( the_thread );
#if defined(RTEMS_MULTIPROCESSING)
if ( !_Objects_Is_local_id( the_thread->Object.id ) )
_Thread_MP_Free_proxy( the_thread );
#endif
}
|
/* interpolation/gsl_spline.h
*
* Copyright (C) 2001 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GSL_SPLINE_H__
#define __GSL_SPLINE_H__
#include <stdlib.h>
#include <gsl/gsl_interp.h>
#include "..\\WinGslDll.inl"
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* general interpolation object */
typedef struct {
gsl_interp * interp;
double * x;
double * y;
size_t size;
} gsl_spline;
WINGSLDLL_API gsl_spline *
gsl_spline_alloc(const gsl_interp_type * T, size_t size);
WINGSLDLL_API int
gsl_spline_init(gsl_spline * spline, const double xa[], const double ya[], size_t size);
WINGSLDLL_API int
gsl_spline_eval_e(const gsl_spline * spline, double x,
gsl_interp_accel * a, double * y);
WINGSLDLL_API double
gsl_spline_eval(const gsl_spline * spline, double x, gsl_interp_accel * a);
WINGSLDLL_API int
gsl_spline_eval_deriv_e(const gsl_spline * spline,
double x,
gsl_interp_accel * a,
double * y);
WINGSLDLL_API double
gsl_spline_eval_deriv(const gsl_spline * spline,
double x,
gsl_interp_accel * a);
WINGSLDLL_API int
gsl_spline_eval_deriv2_e(const gsl_spline * spline,
double x,
gsl_interp_accel * a,
double * y);
WINGSLDLL_API double
gsl_spline_eval_deriv2(const gsl_spline * spline,
double x,
gsl_interp_accel * a);
WINGSLDLL_API int
gsl_spline_eval_integ_e(const gsl_spline * spline,
double a, double b,
gsl_interp_accel * acc,
double * y);
WINGSLDLL_API double
gsl_spline_eval_integ(const gsl_spline * spline,
double a, double b,
gsl_interp_accel * acc);
WINGSLDLL_API void
gsl_spline_free(gsl_spline * spline);
__END_DECLS
#endif /* __GSL_INTERP_H__ */
|
/*
* $Id$
*
* This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
* project.
*
* Copyright (C) 1998-2012 OpenLink Software
*
* This project 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; only version 2 of the License, dated June 1991.
*
* 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
*
*/
#include "xpathp_impl.h"
#include "libutil.h"
#include "sqlnode.h"
#include "sqlpar.h"
#include "sqlpfn.h"
/*#include "sqlcmps.h"*/
#include "sqlfn.h"
#include "xml.h"
#include "xmlgen.h"
#include "xmltree.h"
#include "text.h"
#include "multibyte.h"
#include "bif_text.h"
#include "xpf.h"
/*#include "xpathp.h"*/
#ifdef __cplusplus
extern "C" {
#endif
#include "langfunc.h"
#include "xmlparser_impl.h"
#include "schema.h"
#ifdef __cplusplus
}
#endif
/*mapping schema*/
#define XS_NAME_DELIMETER '#'
#define XS_VIEW_DELIMETER '.'
#define XS_BLANC ' '
extern xml_view_t* mapping_schema_to_xml_view (schema_parsed_t * schema);
extern void xmls_proc (query_instance_t * qi, caddr_t name);
extern void mpschema_set_view_def (char *name, caddr_t tree);
extern caddr_t tables_from_mapping_schema (schema_parsed_t * schema, client_connection_t * qi_client);
caddr_t get_view_name (utf8char * fullname, char sign);
void xmlview_free (xml_view_t * xv);/*mapping schema*/
int
VXmlTree_Parse (vxml_parser_t * parser, xml_entity_t * xml_ent, caddr_t schema_name, caddr_t type_name);
#define _COMMA(text, len, fill, first) \
if (!first) \
sprintf_more (text, len, fill, ", "); \
else \
first = 0;
typedef struct foreign_key_s
{
caddr_t field;
caddr_t ref_table;
caddr_t ref_field;
} foreign_key_t;
typedef struct table_mapping_schema_s
{
caddr_t name;
dk_set_t fields;
dk_set_t fields_types;
dk_set_t keys;
dk_set_t foreign_keys;
} table_mapping_schema_t;
|
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <mach/board.h>
#include "board-lu3700.h"
#define SND(desc, num) { .name = #desc, .id = num }
static struct snd_endpoint snd_endpoints_list[] = {
#if 0
SND(HANDSET, 0),
SND(MONO_HEADSET, 2),
SND(HEADSET, 3),
SND(SPEAKER, 6),
SND(TTY_HEADSET, 8),
SND(TTY_VCO, 9),
SND(TTY_HCO, 10),
SND(BT, 12),
SND(IN_S_SADC_OUT_HANDSET, 16),
SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
SND(CURRENT, 27),
#else
SND(HANDSET, 5),
SND(HEADSET_LOOPBACK, 1),
SND(HEADSET, 2),
SND(HEADSET_STEREO, 3),
SND(SPEAKER, 0),
SND(SPEAKER_IN_CALL, 6),
SND(SPEAKER_RING, 7),
SND(HEADSET_AND_SPEAKER, 7),
SND(FM_HEADSET, 9),
SND(FM_SPEAKER, 10),
SND(BT, 12),
SND(TTY_HEADSET, 14),
SND(TTY_VCO, 15),
SND(TTY_HCO, 16),
SND(TTY_HCO_SPEAKER, 17),
SND(HANDSET_VR, 19),
SND(HEADSET_VR, 20),
SND(BT_VR, 22),
SND(VOIP_HANDSET, 23),
SND(VOIP_HEADSET, 24),
SND(VOIP_SPEAKER_IN_CALL, 26),
SND(CURRENT, 33),
#endif
};
#undef SND
static struct msm_snd_endpoints msm_device_snd_endpoints = {
.endpoints = snd_endpoints_list,
.num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
};
struct platform_device msm_device_snd = {
.name = "msm_snd",
.id = -1,
.dev = {
.platform_data = &msm_device_snd_endpoints
},
};
#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
(1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
(1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
(1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
(1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
(1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_WAV)|(1<<MSM_ADSP_CODEC_ADPCM)| \
(1<<MSM_ADSP_CODEC_YADPCM)|(1<<MSM_ADSP_CODEC_QCELP)| \
(1<<MSM_ADSP_CODEC_MP3))
#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_WAV)|(1<<MSM_ADSP_CODEC_ADPCM)| \
(1<<MSM_ADSP_CODEC_YADPCM)|(1<<MSM_ADSP_CODEC_QCELP)| \
(1<<MSM_ADSP_CODEC_MP3))
#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_WAV)|(1<<MSM_ADSP_CODEC_ADPCM)| \
(1<<MSM_ADSP_CODEC_YADPCM)|(1<<MSM_ADSP_CODEC_QCELP))
#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
static unsigned int dec_concurrency_table[] = {
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
0, 0, 0,
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC4_FORMAT),
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC4_FORMAT),
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC4_FORMAT),
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC4_FORMAT),
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC4_FORMAT),
(DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
(DEC4_FORMAT),
};
#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
.module_queueid = queueid, .module_decid = decid, \
.nr_codec_support = nr_codec}
static struct msm_adspdec_info dec_info_list[] = {
DEC_INFO("AUDPLAY0TASK", 13, 0, 11),
DEC_INFO("AUDPLAY1TASK", 14, 1, 5),
DEC_INFO("AUDPLAY2TASK", 15, 2, 5),
DEC_INFO("AUDPLAY3TASK", 16, 3, 4),
DEC_INFO("AUDPLAY4TASK", 17, 4, 1),
};
static struct msm_adspdec_database msm_device_adspdec_database = {
.num_dec = ARRAY_SIZE(dec_info_list),
.num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
ARRAY_SIZE(dec_info_list)),
.dec_concurrency_table = dec_concurrency_table,
.dec_info_list = dec_info_list,
};
struct platform_device msm_device_adspdec = {
.name = "msm_adspdec",
.id = -1,
.dev = {
.platform_data = &msm_device_adspdec_database
},
};
|
/**************************************************************************
* *
* Copyright (c) 2010 by Generalplus Technology Co., Ltd. *
* *
* This software is copyrighted by and is the property of Generalplus *
* Technology Co., Ltd. All rights are reserved by Generalplus Technology*
* Co., Ltd. This software may only be used in accordance with the *
* corresponding license agreement. Any unauthorized use, duplication, *
* distribution, or disclosure of this software is expressly forbidden. *
* *
* This Copyright notice MUST not be removed or modified without prior *
* written consent of Generalplus Technology Co., Ltd. *
* *
* Generalplus Technology Co., Ltd. reserves the right to modify this *
* software without notice. *
* *
* Generalplus Technology Co., Ltd. *
* 19, Innovation First Road, Science-Based Industrial Park, *
* Hsin-Chu, Taiwan, R.O.C. *
* *
**************************************************************************/
#ifndef _REG_SD_H_
#define _REG_SD_H_
#include <mach/hardware.h>
#include <mach/typedef.h>
#define LOGI_ADDR_SD0_REG IO2_ADDRESS(0xB0B000)
#define LOGI_ADDR_SD1_REG IO2_ADDRESS(0xB0C000)
#define LOGI_ADDR_SD2_REG IO2_ADDRESS(0xB05000)
/**************************************************************************
* D A T A T Y P E S *
**************************************************************************/
typedef struct sdReg_s {
/* volatile UINT8 regOffset[0xB0B000]; */ /* 0x92B0B000 */
/* volatile UINT8 regOffset[0xB0C000]; */ /* 0x92B0C000 */
/* volatile UINT8 regOffset[0xB05000]; */ /* 0x92B05000 */
volatile UINT32 sdDatTx; /* P_SDC0_DATTX: 0x92B0B000, P_SDC1_DATTX: 0x92B0C000, P_SDC2_DATTX: 0x92B05000 */
volatile UINT32 sdDatRx; /* P_SDC0_DATRX: 0x92B0B004, P_SDC1_DATRX: 0x92B0C004, P_SDC2_DATRX: 0x92B05004 */
volatile UINT32 sdCmd; /* P_SDC0_CMD: 0x92B0B008, P_SDC1_CMD: 0x92B0C008, P_SDC2_CMD: 0x92B05008 */
volatile UINT32 sdArg; /* P_SDC0_ARG: 0x92B0B00C, P_SDC1_ARG: 0x92B0C00C, P_SDC2_ARG: 0x92B0500C */
volatile UINT32 sdResp; /* P_SDC0_RESP: 0x92B0B010, P_SDC1_RESP: 0x92B0C010, P_SDC2_RESP: 0x92B05010 */
volatile UINT32 sdStatus; /* P_SDC0_STATUS: 0x92B0B014, P_SDC1_STATUS: 0x92B0C014, P_SDC2_STATUS: 0x92B05014 */
volatile UINT32 sdCtrl; /* P_SDC0_CTRL: 0x92B0B018, P_SDC1_CTRL: 0x92B0C018, P_SDC2_CTRL: 0x92B05018 */
volatile UINT32 sdIntEn; /* P_SDC0_INTEN: 0x92B0B01C, P_SDC1_INTEN: 0x92B0C01C, P_SDC2_INTEN: 0x92B0501C */
} sdReg_t;
#endif /* _REG_SD_H_ */
|
/*
* Copyright (C) 2005-2006 Wengo SAS
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2,
* or (at your option) any later version.
*
* This 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 dpkg; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Support for H263 in phapi
*
* @author David Ferlier <david.ferlier@wengo.fr>
*
*/
#include <avcodec.h>
#include <ortp.h>
#include <osip2/osip_mt.h>
#include <osipparser2/osip_list.h>
#include <webcam/webcam.h>
#include "phcodec.h"
#include "phapi.h"
#include "phcall.h"
#include "phmedia.h"
#include "phmstream.h"
#include "phvstream.h"
#include "phcodec-h263.h"
int h263_decode(void *ctx, const void *src, int srcsize, void *dst, int dstsize) {
ph_h263_decoder_ctx_t * h263t = (ph_h263_decoder_ctx_t *) ctx;
return phcodec_avcodec_decode(&h263t->decoder_ctx, src, srcsize,
dst, dstsize);
}
int h263_encode(void *ctx, const void *src, int srcsize, void *dst, int dstsize) {
ph_h263_encoder_ctx_t * h263t = (ph_h263_encoder_ctx_t *) ctx;
return phcodec_avcodec_encode(&h263t->encoder_ctx, src, srcsize,
dst, dstsize);
}
ph_avcodec_meta_ctx_t * _h263_meta_init(ph_avcodec_meta_ctx_t * meta, phvstream_t *s) {
meta->avcodec_encoder_id = CODEC_ID_H263;
meta->avcodec_decoder_id = CODEC_ID_H263;
meta->frame_rate = 10;
meta->frame_width = PHMEDIA_VIDEO_FRAME_WIDTH;
meta->frame_height = PHMEDIA_VIDEO_FRAME_HEIGHT;
return meta;
}
void *h263_encoder_init(void *ctx) {
phvstream_t *s = (phvstream_t *)ctx;
ph_h263_encoder_ctx_t * h263t;
h263t = (ph_h263_encoder_ctx_t *) calloc(sizeof(ph_h263_encoder_ctx_t), 1);
_h263_meta_init(&h263t->meta, s);
h263t->max_frame_len = MAX_ENC_BUFFER_SIZE;
h263t->data_enc = (uint8_t *) av_malloc (h263t->max_frame_len);
if(phcodec_avcodec_encoder_init(&h263t->encoder_ctx, &h263t->meta, s) < 0)
{
av_free(h263t->data_enc);
free(h263t);
return 0;
}
h263t->encoder_ctx.context->flags |= CODEC_FLAG_QP_RD;
h263t->encoder_ctx.context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
h263t->encoder_ctx.context->flags |= CODEC_FLAG_QSCALE;
//h263t->encoder_ctx.context->flags |= CODEC_FLAG_INPUT_PRESERVED;
//h263t->encoder_ctx.context->flags |= CODEC_FLAG_EMU_EDGE;
//h263t->encoder_ctx.context->flags |= CODEC_FLAG_PASS1;
h263t->encoder_ctx.context->mb_decision = FF_MB_DECISION_RD;
h263t->encoder_ctx.context->gop_size = 30;
h263t->encoder_ctx.context->thread_count = 1;
#define DEFAULT_RATE (16 * 8 * 1024)
h263t->encoder_ctx.context->rc_min_rate = DEFAULT_RATE;
h263t->encoder_ctx.context->rc_max_rate = DEFAULT_RATE;
h263t->encoder_ctx.context->rc_buffer_size = DEFAULT_RATE * 64;
h263t->encoder_ctx.context->bit_rate = DEFAULT_RATE;
if (avcodec_open(h263t->encoder_ctx.context,
h263t->encoder_ctx.encoder) < 0)
{
return 0;
}
return h263t;
}
void *h263_decoder_init(void *ctx) {
phvstream_t *s = (phvstream_t *)ctx;
ph_h263_decoder_ctx_t * h263t;
h263t = (ph_h263_decoder_ctx_t *) calloc(sizeof(ph_h263_decoder_ctx_t), 1);
_h263_meta_init(&h263t->meta, s);
if(phcodec_avcodec_decoder_init(&h263t->decoder_ctx, &h263t->meta) < 0)
{
free(h263t);
return 0;
}
h263t->max_frame_len = MAX_DEC_BUFFER_SIZE;
h263t->data_dec = (uint8_t *) av_malloc (h263t->max_frame_len+FF_INPUT_BUFFER_PADDING_SIZE);
memset(h263t->data_dec + h263t->max_frame_len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
h263t->buf_index = 0;
return h263t;
}
void h263_encoder_cleanup(void *ctx) {
ph_h263_encoder_ctx_t * encoder = (ph_h263_encoder_ctx_t *) ctx;
img_resample_close(encoder->encoder_ctx.res_ctx);
//avcodec_flush_buffers(encoder->encoder_ctx.context);
avcodec_close(encoder->encoder_ctx.context);
av_free(encoder->encoder_ctx.resized_pic);
av_free(encoder->encoder_ctx.sampled_frame);
av_free(encoder->data_enc);
av_free(encoder->encoder_ctx.context);
free(encoder);
}
void h263_decoder_cleanup(void *ctx) {
ph_h263_decoder_ctx_t * decoder = (ph_h263_decoder_ctx_t *) ctx;
//avcodec_flush_buffers(decoder->decoder_ctx.context);
avcodec_close(decoder->decoder_ctx.context);
av_free(decoder->data_dec);
av_free(decoder->decoder_ctx.pictureIn);
av_free(decoder->decoder_ctx.context);
free(decoder);
}
|
// Copyright (C) 2003 Dolphin 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include <map>
#include <d3d11.h>
class PIXELSHADERUID;
enum DSTALPHA_MODE;
namespace DX11
{
class PixelShaderCache
{
public:
static void Init();
static void Clear();
static void Shutdown();
static bool SetShader(DSTALPHA_MODE dstAlphaMode, u32 components); // TODO: Should be renamed to LoadShader
static bool InsertByteCode(const PIXELSHADERUID &uid, const void* bytecode, unsigned int bytecodelen);
static ID3D11PixelShader* GetActiveShader() { return last_entry->shader; }
static ID3D11Buffer* &GetConstantBuffer();
static ID3D11PixelShader* GetColorMatrixProgram(bool multisampled);
static ID3D11PixelShader* GetColorCopyProgram(bool multisampled);
static ID3D11PixelShader* GetDepthMatrixProgram(bool multisampled);
static ID3D11PixelShader* GetClearProgram();
static ID3D11PixelShader* ReinterpRGBA6ToRGB8(bool multisampled);
static ID3D11PixelShader* ReinterpRGB8ToRGBA6(bool multisampled);
static void InvalidateMSAAShaders();
private:
struct PSCacheEntry
{
ID3D11PixelShader* shader;
int frameCount;
PSCacheEntry() : shader(NULL), frameCount(0) {}
void Destroy() { SAFE_RELEASE(shader); }
};
typedef std::map<PIXELSHADERUID, PSCacheEntry> PSCache;
static PSCache PixelShaders;
static const PSCacheEntry* last_entry;
};
} // namespace DX11
|
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICEPHP_UTIL_H
#define ICEPHP_UTIL_H
#include <Config.h>
//
// Global functions.
//
extern "C"
{
ZEND_FUNCTION(Ice_stringVersion);
ZEND_FUNCTION(Ice_intVersion);
ZEND_FUNCTION(Ice_generateUUID);
ZEND_FUNCTION(Ice_currentProtocol);
ZEND_FUNCTION(Ice_currentProtocolEncoding);
ZEND_FUNCTION(Ice_currentEncoding);
ZEND_FUNCTION(Ice_protocolVersionToString);
ZEND_FUNCTION(Ice_stringToProtocolVersion);
ZEND_FUNCTION(Ice_encodingVersionToString);
ZEND_FUNCTION(Ice_stringToEncodingVersion);
}
namespace IcePHP
{
void* createWrapper(zend_class_entry*, size_t);
void* extractWrapper(zval*);
//
// Wraps a C++ pointer inside a PHP object.
//
template<typename T>
struct Wrapper
{
T* ptr;
static Wrapper<T>* create(zend_class_entry* ce)
{
Wrapper<T>* w = static_cast<Wrapper<T>*>(ecalloc(1, sizeof(Wrapper<T>) + zend_object_properties_size(ce)));
zend_object_std_init(&w->zobj, ce);
object_properties_init(&w->zobj, ce);
w->ptr = 0;
return w;
}
static Wrapper<T>* extract(zval* zv)
{
return reinterpret_cast<Wrapper<T>*>(reinterpret_cast<char *>(extractWrapper(zv)) - XtOffsetOf(Wrapper<T>, zobj));
}
static Wrapper<T>* fetch(zend_object* object)
{
return reinterpret_cast<Wrapper<T>*>(reinterpret_cast<char *>(object) - XtOffsetOf(Wrapper<T>, zobj));
}
static T value(zval* zv)
{
Wrapper<T>* w = extract(zv);
if(w)
{
return *w->ptr;
}
return 0;
}
// This must be last element in the struct
zend_object zobj;
};
zend_class_entry* idToClass(const std::string&);
zend_class_entry* nameToClass(const std::string&);
bool createIdentity(zval*, const Ice::Identity&);
bool extractIdentity(zval*, Ice::Identity&);
bool createStringMap(zval*, const std::map<std::string, std::string>&);
bool extractStringMap(zval*, std::map<std::string, std::string>&);
bool createStringArray(zval*, const Ice::StringSeq&);
bool extractStringArray(zval*, Ice::StringSeq&);
//
// Create a PHP instance of Ice_ProtocolVersion.
//
bool createProtocolVersion(zval*, const Ice::ProtocolVersion&);
//
// Create a PHP instance of Ice_EncodingVersion.
//
bool createEncodingVersion(zval*, const Ice::EncodingVersion&);
//
// Extracts the members of an encoding version.
//
bool extractEncodingVersion(zval*, Ice::EncodingVersion&);
//
// Convert the given exception into its PHP equivalent.
//
void convertException(zval*, const Ice::Exception&);
//
// Convert the exception and "throw" it.
//
void throwException(const Ice::Exception&);
//
// Convert a Zend type (e.g., IS_BOOL, etc.) to a string for use in error messages.
//
std::string zendTypeToString(int);
//
// Raise RuntimeException with the given message.
//
void runtimeError(const char*, ...);
//
// Raise InvalidArgumentException with the given message.
//
void invalidArgument(const char*, ...);
//
// Invoke a method on a PHP object. The method must not take any arguments.
//
bool invokeMethod(zval*, const std::string&);
//
// Invoke a method on a PHP object. The method must take one string argument.
//
bool invokeMethod(zval*, const std::string&, const std::string&);
//
// Check inheritance.
//
bool checkClass(zend_class_entry*, zend_class_entry*);
//
// Exception-safe efree.
//
class AutoEfree
{
public:
AutoEfree(void* p) : _p(p) {}
~AutoEfree() { efree(_p); }
private:
void* _p;
};
//
// Exception-safe zval destroy.
//
class AutoDestroy
{
public:
AutoDestroy(zval* zv) : _zv(zv) {}
~AutoDestroy() { if(_zv) zval_ptr_dtor(_zv); }
zval* release() { zval* z = _zv; _zv = 0; return z; }
private:
zval* _zv;
};
class AutoReleaseString
{
public:
AutoReleaseString(zend_string* s) : _s(s) {}
~AutoReleaseString() { if(_s) zend_string_release(_s); }
private:
zend_string* _s;
};
} // End of namespace IcePHP
#endif
|
/*
*
* Fichier "fourre-tout" contenant des fonctions utiles
*
*
* ยฉ 2015 - Guillaume Gonnet
* License GPLv2
*/
#ifndef UTILS_H
#define UTILS_H
#include "windows.h"
#include <QString>
namespace Utils {
// Convertie un LPCSTR en LPWSTR
LPWSTR ConvertLPCSTRToLPWSTR (char* pCstring);
// Convertir un LPWSTR en LPSTR
char* ConvertLPWSTRToLPSTR (LPWSTR lpwszStrIn);
// Permet de savoir si on est sur win7 ou +, ou win XP
bool IsWin7OrLater();
// Obtient le chemein dans lequel est le programme
QString getCurrentPath();
}
#endif // UTILS_H
|
/*
* Wayland Support
*
* Copyright (C) 2015 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 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.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#include "config.h"
#include "wayland/meta-wayland-tablet.h"
#include <glib.h>
#include <wayland-server.h>
#include "compositor/meta-surface-actor-wayland.h"
#include "wayland/meta-wayland-private.h"
#include "tablet-unstable-v2-server-protocol.h"
static void
unbind_resource (struct wl_resource *resource)
{
wl_list_remove (wl_resource_get_link (resource));
}
MetaWaylandTablet *
meta_wayland_tablet_new (ClutterInputDevice *device,
MetaWaylandTabletSeat *tablet_seat)
{
MetaWaylandTablet *tablet;
tablet = g_new0 (MetaWaylandTablet, 1);
wl_list_init (&tablet->resource_list);
tablet->device = device;
tablet->tablet_seat = tablet_seat;
return tablet;
}
void
meta_wayland_tablet_free (MetaWaylandTablet *tablet)
{
struct wl_resource *resource, *next;
wl_resource_for_each_safe (resource, next, &tablet->resource_list)
{
zwp_tablet_v2_send_removed (resource);
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_free (tablet);
}
static void
tablet_destroy (struct wl_client *client,
struct wl_resource *resource)
{
wl_resource_destroy (resource);
}
static const struct zwp_tablet_v2_interface tablet_interface = {
tablet_destroy
};
void
meta_wayland_tablet_notify (MetaWaylandTablet *tablet,
struct wl_resource *resource)
{
ClutterInputDevice *device = tablet->device;
const gchar *node_path, *vendor, *product;
guint vid, pid;
zwp_tablet_v2_send_name (resource, clutter_input_device_get_device_name (device));
node_path = clutter_input_device_get_device_node (device);
if (node_path)
zwp_tablet_v2_send_path (resource, node_path);
vendor = clutter_input_device_get_vendor_id (device);
product = clutter_input_device_get_product_id (device);
if (vendor && sscanf (vendor, "%x", &vid) == 1 &&
product && sscanf (product, "%x", &pid) == 1)
zwp_tablet_v2_send_id (resource, vid, pid);
zwp_tablet_v2_send_done (resource);
}
struct wl_resource *
meta_wayland_tablet_create_new_resource (MetaWaylandTablet *tablet,
struct wl_client *client,
struct wl_resource *seat_resource,
uint32_t id)
{
struct wl_resource *resource;
resource = wl_resource_create (client, &zwp_tablet_v2_interface,
wl_resource_get_version (seat_resource), id);
wl_resource_set_implementation (resource, &tablet_interface,
tablet, unbind_resource);
wl_resource_set_user_data (resource, tablet);
wl_list_insert (&tablet->resource_list, wl_resource_get_link (resource));
return resource;
}
struct wl_resource *
meta_wayland_tablet_lookup_resource (MetaWaylandTablet *tablet,
struct wl_client *client)
{
return wl_resource_find_for_client (&tablet->resource_list, client);
}
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
* Revisions copyright (C) 2005 by Gerald Van Baren
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
2800
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
2580
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
/* measured values */
{ 2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
{
/* TODO: This is identical to the discharge curve.
* Calibrate charging curve using a battery_bench log. */
2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000
};
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
#define BATTERY_SCALE_FACTOR 8275
/* full-scale ADC readout (2^10) in millivolt */
/* Returns battery voltage from ADC [millivolts] */
int _battery_voltage(void)
{
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
}
|
/* ----------------------------------------------------------------------
This is the
โโโ โโโ โโโโโโโ โโโโโโโ โโโโโโโ โโโ โโโโโโโโโโโโโโโโโโโโ
โโโ โโโโโโโโโโโ โโโโโโโโ โโโโโโโโ โโโ โโโโโโโโโโโโโโโโโโโโ
โโโ โโโโโโ โโโโโโโ โโโโโโโ โโโโโโโโโโโโ โโโ โโโโโโโโ
โโโ โโโโโโ โโโโโโ โโโโโโ โโโโโโโโโโโ โโโ โโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโโ
โโโโโโโโโโโ โโโโโโโ โโโโโโโ โโโโโโโ โโโ โโโ โโโ โโโโโโโโยฎ
DEM simulation engine, released by
DCS Computing Gmbh, Linz, Austria
http://www.dcs-computing.com, office@dcs-computing.com
LIGGGHTSยฎ is part of CFDEMยฎproject:
http://www.liggghts.com | http://www.cfdem.com
Core developer and main author:
Christoph Kloss, christoph.kloss@dcs-computing.com
LIGGGHTSยฎ is open-source, distributed under the terms of the GNU Public
License, version 2 or later. It 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. You should have
received a copy of the GNU General Public License along with LIGGGHTSยฎ.
If not, see http://www.gnu.org/licenses . See also top-level README
and LICENSE files.
LIGGGHTSยฎ and CFDEMยฎ are registered trade marks of DCS Computing GmbH,
the producer of the LIGGGHTSยฎ software and the CFDEMยฎcoupling software
See http://www.cfdem.com/terms-trademark-policy for details.
-------------------------------------------------------------------------
Contributing author and copyright for this file:
Christoph Kloss (DCS Computing GmbH, Linz, JKU Linz)
Andreas Aigner (JKU Linz)
Copyright 2012- DCS Computing GmbH, Linz
Copyright 2009-2012 JKU Linz
------------------------------------------------------------------------- */
#ifdef ATOM_CLASS
AtomStyle(sph,AtomVecSPH)
#else
#ifndef LMP_ATOM_VEC_SPH_H
#define LMP_ATOM_VEC_SPH_H
#include "atom_vec.h"
namespace LAMMPS_NS {
class AtomVecSPH : public AtomVec {
public:
AtomVecSPH(class LAMMPS *);
~AtomVecSPH() {}
void init();
void grow(int);
void grow_reset();
void copy(int, int, int);
int pack_comm(int, int *, double *, int, int *);
int pack_comm_vel(int, int *, double *, int, int *);
int pack_comm_hybrid(int, int *, double *);
void unpack_comm(int, int, double *);
void unpack_comm_vel(int, int, double *);
int unpack_comm_hybrid(int, int, double *);
int pack_reverse(int, int, double *);
void unpack_reverse(int, int *, double *);
int pack_border(int, int *, double *, int, int *);
int pack_border_vel(int, int *, double *, int, int *);
int pack_border_hybrid(int, int *, double *);
void unpack_border(int, int, double *);
void unpack_border_vel(int, int, double *);
int unpack_border_hybrid(int, int, double *);
int pack_exchange(int, double *);
int unpack_exchange(double *);
int size_restart();
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
double **x,**v,**f;
double *p,*rho,*drho,*e,*de;
double **vest;
};
}
#endif
#endif
|
//
// printk.h - Declares screen printing functions.
//
#ifndef PRINTK_H
#define PRINTK_H
void printk (const char *fmt, ...);
#endif
|
/*
* Iterator.h
*
*
* Created on: Nov 23, 2013
* Author: Martin Uhrin
*/
#ifndef ITERATOR_H
#define ITERATOR_H
// INCLUDES /////////////////////////////////////////////
#include <boost/iterator/transform_iterator.hpp>
#include "spl/utility/TransformFunctions.h"
// FORWARD DECLARATIONS ////////////////////////////////////
namespace spl {
namespace utility {
template< typename Iterator>
::boost::transform_iterator< AddressOf< typename Iterator::value_type>,
Iterator>
makeAddressOfIterator(Iterator it)
{
return ::boost::transform_iterator<
AddressOf< typename Iterator::value_type>, Iterator>(it,
AddressOf< typename Iterator::value_type>());
}
}
}
#endif /* ITERATOR_H */
|
/*
Copyright (C) 2008-2015 The Communi Project
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MESSAGEFORMATTER_H
#define MESSAGEFORMATTER_H
#include <QHash>
#include <QColor>
#include <QString>
#include <QDateTime>
#include <IrcGlobal>
#include <IrcMessage>
#include "messagedata.h"
class IrcBuffer;
class IrcUserModel;
class IrcTextFormat;
class MessageFormatter : public QObject
{
Q_OBJECT
Q_PROPERTY(IrcBuffer* buffer READ buffer WRITE setBuffer)
Q_PROPERTY(IrcTextFormat* textFormat READ textFormat WRITE setTextFormat)
public:
explicit MessageFormatter(QObject* parent = 0);
IrcBuffer* buffer() const;
void setBuffer(IrcBuffer* buffer);
IrcTextFormat* textFormat() const;
void setTextFormat(IrcTextFormat* format);
MessageData formatMessage(IrcMessage* msg);
QString formatText(const QString& text) const;
enum StyleFlag
{
None = 0x0,
Bold = 0x1,
Color = 0x2,
Dim = 0x4
};
Q_DECLARE_FLAGS(Style, StyleFlag)
QString styledText(const QString& text, Style style) const;
signals:
void formatted(const MessageData& msg);
protected:
virtual QString formatAwayMessage(IrcAwayMessage* msg);
virtual QString formatInviteMessage(IrcInviteMessage* msg);
virtual QString formatJoinMessage(IrcJoinMessage* msg);
virtual QString formatKickMessage(IrcKickMessage* msg);
virtual QString formatModeMessage(IrcModeMessage* msg);
virtual QString formatMotdMessage(IrcMotdMessage* msg);
virtual QString formatNamesMessage(IrcNamesMessage* msg);
virtual QString formatNickMessage(IrcNickMessage* msg);
virtual QString formatNoticeMessage(IrcNoticeMessage* msg);
virtual QString formatNumericMessage(IrcNumericMessage* msg);
virtual QString formatPartMessage(IrcPartMessage* msg);
virtual QString formatPongMessage(IrcPongMessage* msg);
virtual QString formatPrivateMessage(IrcPrivateMessage* msg);
virtual QString formatQuitMessage(IrcQuitMessage* msg);
virtual QString formatTopicMessage(IrcTopicMessage* msg);
virtual QString formatUnknownMessage(IrcMessage* msg);
virtual QString formatWhoisMessage(IrcWhoisMessage* msg);
virtual QString formatWhowasMessage(IrcWhowasMessage* msg);
virtual QString formatWhoReplyMessage(IrcWhoReplyMessage* msg);
virtual MessageData formatClass(const QString& format, IrcMessage* msg) const;
virtual QString formatSender(IrcMessage* msg) const;
virtual QString formatExpander(const QString& expander) const;
private slots:
void indexNames(const QStringList& names);
private:
struct Private {
IrcBuffer* buffer;
IrcUserModel* userModel;
IrcTextFormat* textFormat;
QMultiHash<QChar, QString> names;
} d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MessageFormatter::Style)
#endif // MESSAGEFORMATTER_H
|
/*
* Copyright (c) 2014, Internet Initiative Japan, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
*/
#include <asm/types.h>
#include <errno.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <fcntl.h>
static int watch(int);
static void logit(int, const char *, ...);
static void touch(void);
int daemonize = 1;
const char *touch_file = NULL;
const char *pid_file = NULL;
static void
usage(void)
{
printf("Usage: rtnotifyd [options]\n"
"\n"
"Options:\n"
"-f run foreground\n"
"-t <path> touch file if address changed\n"
"-p <path> pid file\n"
);
exit(1);
}
int
main(int argc, char *argv[])
{
int ch;
int rtsock;
struct sockaddr_nl sa;
while ((ch = getopt(argc, argv, "ft:p:h")) != -1) {
switch(ch) {
case 'f':
daemonize = 0;
break;
case 't':
touch_file = optarg;
break;
case 'p':
pid_file = optarg;
break;
case 'h':
default:
usage();
/* NOTREACHED */
}
}
if (daemonize) {
openlog("rtnotifyd", LOG_PID | LOG_NDELAY, LOG_DAEMON);
if (daemon(0, 0) < 0) {
logit(LOG_ERR, "daemon() failed: %s", strerror(errno));
exit(1);
}
}
if (pid_file) {
FILE *fp;
if ((fp = fopen(pid_file, "w")) == NULL)
logit(LOG_ERR, "cannot create pidfile: %s: %s\n",
pid_file, strerror(errno));
else {
fprintf(fp, "%lu\n", (unsigned long)getpid());
fclose(fp);
}
}
memset(&sa, 0, sizeof(sa));
sa.nl_family = AF_NETLINK;
sa.nl_groups = RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
if ((rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) < 0) {
logit(LOG_ERR, "failed to create socket: %s", strerror(errno));
return -1;
}
if (bind(rtsock, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
logit(LOG_ERR, "failed to bind socket: %s", strerror(errno));
return -1;
}
watch(rtsock);
if (pid_file)
unlink(pid_file);
return 0;
}
static int
watch(int rtsock)
{
int len;
struct nlmsghdr *nh;
char buf [4096];
struct iovec iov = {buf, sizeof(buf)};
struct sockaddr_nl nladdr;
struct msghdr msg = {
&nladdr, sizeof(nladdr), &iov, 1, NULL, 0, 0
};
logit(LOG_INFO, "waiting for netlink message");
while(1) {
len = recvmsg(rtsock, &msg, 0);
if(len < 0) {
if (errno == EINTR || errno == EAGAIN ||
errno == ENOBUFS)
continue;
logit(LOG_ERR, "recvmsg() returned error: %s(%d)\n",
strerror(errno), errno);
return -1;
} else if (len == 0) {
logit(LOG_ERR, "reached EOF");
return -1;
}
for(nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len);
nh = NLMSG_NEXT(nh, len)) {
if(nh->nlmsg_type == RTM_NEWADDR ||
nh->nlmsg_type == RTM_DELADDR) {
logit(LOG_INFO, "detect address changed");
touch();
} else {
logit(LOG_WARNING,
"unknown routing message: %d",
nh->nlmsg_type);
continue;
}
}
}
return -1;
}
static void
touch(void)
{
int fd;
if (touch_file == NULL) {
logit(LOG_WARNING, "file path is empty");
return;
}
fd = open(touch_file, O_WRONLY | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0 || close(fd))
logit(LOG_ERR, "failed to touch file: %s(%d)",
strerror(errno), errno);
}
static const char *
log_priority_string(int priority)
{
switch (priority) {
case LOG_EMERG: return "EMERG";
case LOG_ERR: return "ERROR";
case LOG_WARNING: return "WARN ";
case LOG_INFO: return "INFO ";
case LOG_DEBUG: return "DEBUG";
default: return "?????";
}
}
static void
logit(int priority, const char *msg, ...)
{
va_list ap, ap_cp;
struct tm *tm;
time_t now;
char timebuf[20];
va_start(ap, msg);
va_copy(ap_cp, ap);
if (daemonize)
vsyslog(priority, msg, ap);
else {
time(&now);
tm = localtime(&now);
strftime(timebuf, sizeof(timebuf), "%Y/%m/%d %H:%M:%S", tm);
fprintf(stderr, "%s [%u] %s ",
timebuf,
(unsigned int)getpid(),
log_priority_string(priority));
vfprintf(stderr, msg, ap);
fputc('\n', stderr);
}
va_end(ap_cp);
va_end(ap);
}
|
typedef struct _node *node;
struct _node {
char *val;
/*@null@*/ node next;
}
void node_free1 (/*@only@*/ node n)
{
free (n); /* 2 errors: must free n->next, n->val */
}
void node_free2 (/*@only@*/ node n)
{
node nn = n->next;
free (n); /* error: must free n->val */
} /* error - nn not released */
void node_free3 (/*@only@*/ node n)
{
node nn = n->next;
free (n->val);
free (n); /* okay */
if (nn != NULL) {
node_free1 (nn); /* okay (error for null) */
}
} /* okay */
|
#ifndef ASM_X86_INTERNAL_H
#warning Do not include this file directly
#else
static inline void asm_fcompp(struct assembler_state_t *state)
{
int tag1 = read_fpu_sub_tag(state->FPUTagWord, 0);
int tag2 = read_fpu_sub_tag(state->FPUTagWord, 1);
if (tag1 == FPU_TAG_EMPTY)
{
fprintf(stderr, "asm_fcom: #Stack underflow occurred\n");
write_fpu_status_exception_underflow(state->FPUStatusWord, 1);
write_fpu_status_conditioncode1(state->FPUStatusWord, 1);
return;
} else if (tag2 == FPU_TAG_EMPTY)
{
fprintf(stderr, "asm_fcom: #Stack underflow occurred\n");
write_fpu_status_exception_underflow(state->FPUStatusWord, 1);
write_fpu_status_conditioncode1(state->FPUStatusWord, 1);
return;
} else {
if ((tag1==FPU_TAG_SPECIAL)||(tag2==FPU_TAG_SPECIAL))
{
write_fpu_status_conditioncode0(state->FPUStatusWord, 1);
write_fpu_status_conditioncode2(state->FPUStatusWord, 1);
write_fpu_status_conditioncode3(state->FPUStatusWord, 1);
} else {
FPU_TYPE st0 = read_fpu_st(state, 0);
FPU_TYPE data = read_fpu_st(state, 1);
if (st0 > data)
{
write_fpu_status_conditioncode0(state->FPUStatusWord, 0);
write_fpu_status_conditioncode3(state->FPUStatusWord, 0);
} else if (st0 < data)
{
write_fpu_status_conditioncode0(state->FPUStatusWord, 1);
write_fpu_status_conditioncode3(state->FPUStatusWord, 0);
} else {
write_fpu_status_conditioncode0(state->FPUStatusWord, 0);
write_fpu_status_conditioncode3(state->FPUStatusWord, 1);
}
write_fpu_status_conditioncode2(state->FPUStatusWord, 0);
}
}
pop_fpu_sub_tag(&state->FPUTagWord);
pop_fpu_sub_tag(&state->FPUTagWord);
write_fpu_status_top(state->FPUStatusWord, (read_fpu_status_top(state->FPUStatusWord)+2));
}
#endif
|
/**
******************************************************************************
* @file usbd_storage.h
* @author MCD Application Team
* @version V1.3.1
* @date 18-August-2015
* @brief Header for usbd_storage.c file
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBD_STORAGE_H_
#define __USBD_STORAGE_H_
/* Includes ------------------------------------------------------------------*/
#include "usbd_msc.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
extern USBD_StorageTypeDef USBD_DISK_fops;
#endif /* __USBD_STORAGE_H_ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Code Aurora Forum, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OV7739_H
#define OV7739_H
#include <linux/types.h>
#include <mach/board.h>
struct reg_addr_val_pair_struct {
uint16_t reg_addr;
uint8_t reg_val;
};
enum ov7739_test_mode_t {
TEST_OFF,
TEST_1,
TEST_2,
TEST_3
};
enum ov7739_resolution_t {
QTR_SIZE,
FULL_SIZE,
INVALID_SIZE
};
enum ov7739_setting {
RES_PREVIEW,
RES_CAPTURE
};
enum ov7739_reg_update {
/* Sensor egisters that need to be updated during initialization */
REG_INIT,
/* Sensor egisters that needs periodic I2C writes */
UPDATE_PERIODIC,
/* All the sensor Registers will be updated */
UPDATE_ALL,
/* Not valid update */
UPDATE_INVALID
};
#endif
|
#ifndef __CSS_DB_MYSQL_H__
#define __CSS_DB_MYSQL_H__
#include <mysql.h>
#include "queue.h"
#include "css_db.h"
//TODO: video_file_table
#define INSERT_VIDEOFILE_QUERY "INSERT DELAYED INTO `%s`.`tbl_cs_videofile` (`dvrEquipId`, `channelNo`, `fileName`, `volumeName`, `srcPathName`, `beginTime`, `endTime`, `cssEquipId`, `playLength`, `available`) \
VALUES ('%lld', '%hd', '%s', '%s', '%s', '%s', '%s', '%d', '%lld', '%d')"
#define DELETE_VIDEOFILE_QUERY "DELETE FROM `%s`.`tbl_cs_videofile` WHERE `id`='%lld'"
#define UPDATE_VIDEOFILE_QUERY "UPDATE `%s`.`tbl_cs_videofile` SET `endTime`='%s', `playLength`='%lld', `available`='%d' WHERE `fileName`='%s'"
#define SELECT_VIDEOFILE_BY_BENGINTIME_QUERY "SELECT id,fileName FROM `%s`.`tbl_cs_videofile` WHERE `beginTime`<'%s'"
#define SELECT_VIDEOFILE_BY_BENGINTIME_AND_VOLUME_QUERY "SELECT id,fileName FROM `%s`.`tbl_cs_videofile` WHERE `beginTime`<'%s' and `volumeName`='%s'"
#define SELECT_VIDEOFILE_BY_FILENAME_QUERY "SELECT dvrEquipId,channelNo,fileName,volumeName,srcPathName,beginTime,endTime,cssEquipId,playLength,available FROM `%s`.`tbl_cs_videofile` WHERE `fileName`='%s'"
//TODO: warning_table
#define INSERT_WARNING_QUERY "INSERT INTO `%s`.`tbl_cs_warning` (`dvrEquipId`, `channelNo`, `alarmeventId`, `beginTime`, `endTime`) \
VALUES ('%lld', '%hd', '%s', '%s', '%s')"
#define DELETE_WARNING_QUERY "DELETE FROM `%s`.`tbl_cs_warning` WHERE `id`='%lld'"
#define UPDATE_WARNING_QUERY "UPDATE `%s`.`tbl_cs_warning` SET `endTime`='%s' WHERE `alarmeventId`='%s'"
#define SELECT_WARNING_BY_BENGINTIME_QUERY "SELECT id,alarmeventId FROM `%s`.`tbl_cs_warning` WHERE `beginTime`<'%s'"
#define SELECT_WARNING_BY_ALARMEVENTID_QUERY "SELECT dvrEquipId,channelNo,alarmeventId,beginTime,endTime FROM `%s`.`tbl_cs_warning` WHERE `alarmeventId`='%s'"
#define CHECK_MYSQL(s) if( s == NULL) \
{ \
printf("ERROR: mysql = NULL \n"); \
return -1; \
}
#define CHECK_RESULTS(x) if (results == NULL) \
{ \
printf("selected nothing! \n"); \
return 0; \
}
//TODO: mysql function
int connect_db_mysql(css_db_config* mydbConfig);
int close_db_mysql();
int insert_video_file_mysql(const char* dbName,tbl_videoFile* myVideoFile);
int update_video_file_mysql(const char* dbName,tbl_videoFile* myVideoFile);
int delete_video_file_by_id_mysql(const char* dbName,css_file_record_info* file_info);
int select_video_file_by_begin_time_mysql(const char* dbName,char beginTime[24],QUEUE* fileList);
int select_video_file_by_begin_time_and_volume_mysql(const char* dbName,char beginTime[24],char* volume,QUEUE* fileList);
int select_video_file_by_file_name_mysql(const char* dbName,char* fileName,css_file_record_info** myVideoFile);
int select_video_file_by_conditions_mysql(const char* dbName,css_search_conditions_t* conds,QUEUE* fileList);
int insert_warning_mysql(const char* dbName,tbl_warning* myWarning);
int update_warning_mysql(const char* dbName,tbl_warning* myWarning);
int delete_warning_by_id_mysql(const char* dbName,css_alarm_info* myAlarmRecordInfo);
int select_warning_by_begin_time_mysql(const char* dbName,char beginTime[24],QUEUE* alarmList);
int select_warning_by_alarmid_mysql(const char* dbName,char* alarmEventId,tbl_warning** myWarning);
int insert_warn_file_mysql(const char* dbName,tbl_warningFile* myWarningFile);
int delete_warn_file_by_alarmid_mysql(const char* dbName,char* alarmEventId);
int select_warn_file_by_alarmid_mysql(const char* dbName,char* alarmEventId,tbl_warningFile** myWarningFile);
#endif /* __CSS_DB_MYSQL_H__ */
|
//-----------------------------------------------------------------------------
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// ISO14443 CRC calculation code.
//-----------------------------------------------------------------------------
#include "iso14443crc.h"
static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
{
ch = (ch ^ (unsigned char) ((*lpwCrc) & 0x00FF));
ch = (ch ^ (ch << 4));
*lpwCrc = (*lpwCrc >> 8) ^ ((unsigned short) ch << 8) ^
((unsigned short) ch << 3) ^ ((unsigned short) ch >> 4);
return (*lpwCrc);
}
void ComputeCrc14443(int CrcType,
unsigned char *Data, int Length,
unsigned char *TransmitFirst,
unsigned char *TransmitSecond)
{
unsigned char chBlock;
unsigned short wCrc=CrcType;
do {
chBlock = *Data++;
UpdateCrc14443(chBlock, &wCrc);
} while (--Length);
if (CrcType == CRC_14443_B)
wCrc = ~wCrc; /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
*TransmitFirst = (unsigned char) (wCrc & 0xFF);
*TransmitSecond = (unsigned char) ((wCrc >> 8) & 0xFF);
return;
}
|
/*
* This source file is part of the ZipArc project source distribution and
* is Copyrighted 2000 - 2006 by Tadeusz Dracz (http://www.artpol-software.com/)
*
* This code may be used in compiled form in any way you desire PROVIDING
* it is not sold for profit as a stand-alone application.
*
* This file may be redistributed unmodified by any means providing it is
* not sold for profit without the authors written consent, and
* providing that this notice and the authors name and all copyright
* notices remains intact.
*
* This file is provided 'as is' with no expressed or implied warranty.
* The author accepts no liability if it causes any damage to your computer.
*
*****************************************************/
#if !defined(AFX_DlgReport_H__4CF42759_3792_4C63_9119_5A5DD5B6E979__INCLUDED_)
#define AFX_DlgReport_H__4CF42759_3792_4C63_9119_5A5DD5B6E979__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgReport.h : header file
//
#include "ResizableDialog.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgReport dialog
class CDlgReport : public CResizableDialog
{
// Construction
public:
int m_iType;
bool m_bEnableEmpty;
CDlgReport(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDlgReport)
enum { IDD = IDD_REPORT };
CString m_szReport;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgReport)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgReport)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DlgReport_H__4CF42759_3792_4C63_9119_5A5DD5B6E979__INCLUDED_)
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_
#define CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_
#include <map>
#include <set>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/process/process_handle.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/performance_monitor/event_type.h"
#include "chrome/browser/performance_monitor/process_metrics_history.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/render_process_host.h"
template <typename Type>
struct DefaultSingletonTraits;
namespace extensions {
class Extension;
}
namespace net {
class URLRequest;
}
namespace performance_monitor {
class Database;
class Event;
struct Metric;
class PerformanceMonitor : public content::NotificationObserver {
public:
struct PerformanceDataForIOThread {
PerformanceDataForIOThread();
uint64 network_bytes_read;
};
typedef std::map<base::ProcessHandle, ProcessMetricsHistory> MetricsMap;
bool SetDatabasePath(const base::FilePath& path);
bool database_logging_enabled() const { return database_logging_enabled_; }
static PerformanceMonitor* GetInstance();
void Initialize();
void StartGatherCycle();
void BytesReadOnIOThread(const net::URLRequest& request, const int bytes);
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
Database* database() { return database_.get(); }
base::FilePath database_path() { return database_path_; }
static bool initialized() { return initialized_; }
private:
friend struct DefaultSingletonTraits<PerformanceMonitor>;
friend class PerformanceMonitorBrowserTest;
FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorUncleanExitBrowserTest,
OneProfileUncleanExit);
FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorUncleanExitBrowserTest,
TwoProfileUncleanExit);
FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorBrowserTest, NetworkBytesRead);
PerformanceMonitor();
virtual ~PerformanceMonitor();
void InitOnBackgroundThread();
void FinishInit();
void InitializeDatabaseIfNeeded();
void RegisterForNotifications();
void CheckForUncleanExits();
void AddUncleanExitEventOnBackgroundThread(const std::string& profile_name);
void CheckForVersionUpdateOnBackgroundThread();
void AddEvent(scoped_ptr<Event> event);
void AddEventOnBackgroundThread(scoped_ptr<Event> event);
void AddMetricOnBackgroundThread(const Metric& metric);
void NotifyInitialized();
void DoTimedCollections();
#if !defined(OS_ANDROID)
void UpdateLiveProfiles();
void UpdateLiveProfilesHelper(
scoped_ptr<std::set<std::string> > active_profiles, std::string time);
#endif
void StoreMetricsOnBackgroundThread(
int current_update_sequence,
const PerformanceDataForIOThread& performance_data_for_io_thread);
void MarkProcessAsAlive(const base::ProcessHandle& handle,
int process_type,
int current_update_sequence);
void GatherMetricsMapOnUIThread();
void GatherMetricsMapOnIOThread(int current_update_sequence);
void AddExtensionEvent(EventType type,
const extensions::Extension* extension);
void AddRendererClosedEvent(
content::RenderProcessHost* host,
const content::RenderProcessHost::RendererClosedDetails& details);
PerformanceDataForIOThread performance_data_for_io_thread_;
base::FilePath database_path_;
scoped_ptr<Database> database_;
MetricsMap metrics_map_;
base::Time next_collection_time_;
int gather_interval_in_seconds_;
bool database_logging_enabled_;
base::DelayTimer<PerformanceMonitor> timer_;
content::NotificationRegistrar registrar_;
static bool initialized_;
bool disable_timer_autostart_for_testing_;
DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor);
};
}
#endif
|
/*
* Copyright (C) 1998,1999,2001 Ross Combs (rocombs@cs.nmsu.edu)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* 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 INCLUDED_MESSAGE_TYPES
#define INCLUDED_MESSAGE_TYPES
#ifdef MESSAGE_INTERNAL_ACCESS
#ifdef JUST_NEED_TYPES
# include "common/packet.h"
# include "connection.h"
#else
# define JUST_NEED_TYPES
# include "common/packet.h"
# include "connection.h"
# undef JUST_NEED_TYPES
#endif
#endif
typedef enum
{
message_type_adduser,
message_type_join,
message_type_part,
message_type_whisper,
message_type_talk,
message_type_broadcast,
message_type_channel,
message_type_userflags,
message_type_whisperack,
message_type_channelfull,
message_type_channeldoesnotexist,
message_type_channelrestricted,
message_type_info,
message_type_error,
message_type_emote,
message_type_uniqueid,
message_type_null
} t_message_type;
typedef struct message
#ifdef MESSAGE_INTERNAL_ACCESS
{
unsigned int num_cached;
t_packet * * packets; /* cached messages */
t_conn_class * classes; /* classes of caches messages */
unsigned int * dstflags; /* overlaid flags of cached messages */
/* ---- */
t_message_type type; /* format of message */
t_connection * src; /* originator message */
t_connection * dst; /* destination */
char const * text; /* text of message */
}
#endif
t_message;
#endif
/*****/
#ifndef JUST_NEED_TYPES
#ifndef INCLUDED_MESSAGE_PROTOS
#define INCLUDED_MESSAGE_PROTOS
#define JUST_NEED_TYPES
#include <stdio.h>
#include "connection.h"
#undef JUST_NEED_TYPES
extern char * message_format_line(t_connection const * c, char const * in);
extern t_message * message_create(t_message_type type, t_connection * src, t_connection * dst, char const * text);
extern int message_destroy(t_message * message);
extern int message_send(t_message * message, t_connection * dst);
extern int message_send_all(t_message * message);
/* the following are "shortcuts" to avoid calling message_create(), message_send(), message_destroy() */
extern int message_send_text(t_connection * dst, t_message_type type, t_connection * src, char const * text);
extern int message_send_file(t_connection * dst, FILE * fd);
#endif
#endif
|
/* $Id: a.out.h,v 1.1 2006-07-05 06:20:25 gerg Exp $ */
/*
* Copyright (C) 2004 Microtronix Datacom 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, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __NIOS2NOMMU_A_OUT_H__
#define __NIOS2NOMMU_A_OUT_H__
#define SPARC_PGSIZE 0x1000 /* Thanks to the sun4 architecture... */
#define SEGMENT_SIZE SPARC_PGSIZE /* whee... */
struct exec {
unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */
unsigned char a_toolversion:7;
unsigned char a_machtype;
unsigned short a_info;
unsigned long a_text; /* length of text, in bytes */
unsigned long a_data; /* length of data, in bytes */
unsigned long a_bss; /* length of bss, in bytes */
unsigned long a_syms; /* length of symbol table, in bytes */
unsigned long a_entry; /* where program begins */
unsigned long a_trsize;
unsigned long a_drsize;
};
#define INIT_EXEC { \
.a_dynamic = 0, \
.a_toolversion = 0, \
.a_machtype = 0, \
.a_info = 0, \
.a_text = 0, \
.a_data = 0, \
.a_bss = 0, \
.a_syms = 0, \
.a_entry = 0, \
.a_trsize = 0, \
.a_drsize = 0, \
}
/* Where in the file does the text information begin? */
#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
/* Where do the Symbols start? */
#define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \
(x).a_data + (x).a_trsize + \
(x).a_drsize)
/* Where does text segment go in memory after being loaded? */
#define N_TXTADDR(x) (((N_MAGIC(x) == ZMAGIC) && \
((x).a_entry < SPARC_PGSIZE)) ? \
0 : SPARC_PGSIZE)
/* And same for the data segment.. */
#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \
(N_TXTADDR(x) + (x).a_text) \
: (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
#define N_TRSIZE(a) ((a).a_trsize)
#define N_DRSIZE(a) ((a).a_drsize)
#define N_SYMSIZE(a) ((a).a_syms)
#ifdef __KERNEL__
#define STACK_TOP TASK_SIZE
#endif
#endif /* __NIOS2NOMMU_A_OUT_H__ */
|
//========================== Open Steamworks ================================
//
// This file is part of the Open Steamworks project. All individuals associated
// with this project do not claim ownership of the contents
//
// The code, comments, and all related files, projects, resources,
// redistributables included with this project are Copyright Valve Corporation.
// Additionally, Valve, the Valve logo, Half-Life, the Half-Life logo, the
// Lambda logo, Steam, the Steam logo, Team Fortress, the Team Fortress logo,
// Opposing Force, Day of Defeat, the Day of Defeat logo, Counter-Strike, the
// Counter-Strike logo, Source, the Source logo, and Counter-Strike Condition
// Zero are trademarks and or registered trademarks of Valve Corporation.
// All other trademarks are property of their respective owners.
//
//=============================================================================
#ifndef GAMESERVERITEM_H
#define GAMESERVERITEM_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
// Purpose: Data describing a single server
//-----------------------------------------------------------------------------
class gameserveritem_t
{
public:
gameserveritem_t();
const char* GetName() const;
void SetName( const char *pName );
public:
servernetadr_t m_NetAdr; // IP/Query Port/Connection Port for this server
int m_nPing; // current ping time in milliseconds
bool m_bHadSuccessfulResponse; // server has responded successfully in the past
bool m_bDoNotRefresh; // server is marked as not responding and should no longer be refreshed
char m_szGameDir[32]; // current game directory
char m_szMap[32]; // current map
char m_szGameDescription[64]; // game description
uint32 m_nAppID; // Steam App ID of this server
int m_nPlayers; // current number of players on the server
int m_nMaxPlayers; // Maximum players that can join this server
int m_nBotPlayers; // Number of bots (i.e simulated players) on this server
bool m_bPassword; // true if this server needs a password to join
bool m_bSecure; // Is this server protected by VAC
uint32 m_ulTimeLastPlayed; // time (in unix time) when this server was last played on (for favorite/history servers)
int m_nServerVersion; // server version as reported to Steam
private:
char m_szServerName[64]; // Game server name
// For data added after SteamMatchMaking001 add it here
public:
char m_szGameTags[128]; // the tags this server exposes
CSteamID m_steamID; // steamID of the game server - invalid if it's doesn't have one (old server, or not connected to Steam)
};
inline gameserveritem_t::gameserveritem_t()
{
m_szGameDir[0] = m_szMap[0] = m_szGameDescription[0] = m_szServerName[0] = 0;
m_bHadSuccessfulResponse = m_bDoNotRefresh = m_bPassword = m_bSecure = false;
m_nPing = m_nAppID = m_nPlayers = m_nMaxPlayers = m_nBotPlayers = m_ulTimeLastPlayed = m_nServerVersion = 0;
m_szGameTags[0] = 0;
}
inline const char* gameserveritem_t::GetName() const
{
// Use the IP address as the name if nothing is set yet.
if ( m_szServerName[0] == 0 )
return m_NetAdr.GetConnectionAddressString();
else
return m_szServerName;
}
#ifdef _S4N_
#define strncpy(...)
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
inline void gameserveritem_t::SetName( const char *pName )
{
strncpy( m_szServerName, pName, sizeof( m_szServerName ) );
m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0';
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // GAMESERVERITEM_H
|
//
// XBTPayment+PaymentsManagerAdditions.h
// xbterminal
//
// Created by Evgeniy Tka4enko on 08.07.14.
// Copyright (c) 2014 vexadev. All rights reserved.
//
#import "XBTPayment.h"
@interface XBTPayment (PaymentsManagerAdditions)
- (id)initWithDictionary:(NSDictionary *)dictionary;
- (void)updateWithCheckDictionary:(NSDictionary *)dictionary;
@end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.