text
stringlengths 4
6.14k
|
|---|
#ifndef __TEV_H__
#define __TEV_H__
#include <stdint.h>
#include <stdbool.h>
#include "queue.h"
#include "heap-inl.h"
#include "tev_conf.h"
#define TEV_ASSERT_NOT_NULL(x) do { \
if (NULL == (x)) { \
abort(); \
} \
} while (0)
typedef enum {
TEV_HANDLE_TYPE_TIMER = 0,
TEV_HANDLE_TYPE_IDLE,
TEV_HANDLE_TYPE_ASYNC
} tev_handle_type_t;
#define TEV_HANDLE_FIELDS \
void *data; \
tev_loop_t *loop; \
QUEUE handle_queue[2]; \
QUEUE active_queue[2]; \
QUEUE close_queue[2]; \
tev_handle_type_t handle_type; \
int is_cancel; \
tev_close_cb close_cb;
#define TEV_HANDLE_TIMER_FIELDS \
struct heap_node heap_node; \
uint64_t time; \
uint64_t repeat; \
tev_timer_cb cb;
#define TEV_HANDLE_IDLE_FILEDS \
QUEUE idle_queue[2]; \
tev_idle_cb cb;
#define TEV_HANDLE_ASYNC_FILEDS \
tev_async_cb cb;
typedef struct tev_handle_s tev_handle_t;
typedef struct tev_timer_s tev_timer_t;
typedef struct tev_io_s tev_io_t;
typedef struct tev_idle_s tev_idle_t;
typedef struct tev_async_s tev_async_t;
typedef void (*tev_handle_cb)(tev_handle_t *);
typedef void (*tev_timer_cb)(tev_timer_t *);
typedef void (*tev_io_cb)(tev_io_t *);
typedef void (*tev_idle_cb)(tev_idle_t *);
typedef void (*tev_async_cb)(tev_async_t *);
typedef void (*tev_close_cb)(tev_handle_t* handle);
typedef struct {
void *(*malloc)(size_t);
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} tev_heap_fn_t;
typedef struct {
struct heap timer_heap;
QUEUE handle_queue[2];
QUEUE idle_queue[2];
QUEUE active_queue[2];
QUEUE close_queue[2];
int is_cancel;
tev_heap_fn_t heap_fn;
uint64_t time;
void *mutex_handle;
void *event_handle;
} tev_loop_t;
struct tev_timer_s {
TEV_HANDLE_FIELDS
TEV_HANDLE_TIMER_FIELDS
};
struct tev_handle_s {
TEV_HANDLE_FIELDS
};
struct tev_io_s {
TEV_HANDLE_FIELDS
};
struct tev_idle_s {
TEV_HANDLE_FIELDS
TEV_HANDLE_IDLE_FILEDS
};
struct tev_async_s {
TEV_HANDLE_FIELDS
TEV_HANDLE_ASYNC_FILEDS
};
/* private APIS */
int
tev__handle_init(tev_loop_t *loop, tev_handle_t *handle);
/* APIS */
tev_loop_t *
tev_loop_create(tev_heap_fn_t *p);
tev_loop_t *
tev_default_loop(void);
void
tev_loop_delete(tev_loop_t *loop);
/* core */
int
tev_run(tev_loop_t *loop);
void
tev_cleanup(tev_loop_t *loop);
void
tev_close(tev_handle_t* handle, tev_close_cb close_cb);
void
tev_update_time(tev_loop_t *loop);
/* timer */
int
tev_timer_init(tev_loop_t *loop, tev_timer_t *handle);
int
tev_timer_start(tev_timer_t *handle,
tev_timer_cb cb,
uint64_t time,
uint64_t repeat);
int
tev__timer_stop(tev_timer_t *handle);
/* idle */
int
tev_idle_init(tev_loop_t *loop, tev_idle_t *handle);
int
tev_idle_start(tev_idle_t *handle, tev_idle_cb cb);
int
tev__idle_stop(tev_idle_t *handle);
/* async */
int
tev_async_init(tev_loop_t *loop, tev_async_t *handle, tev_async_cb cb);
int
tev_async_send(tev_async_t *handle);
bool
tev_async_prepared(tev_async_t *handle);
void
tev__async_close(tev_async_t *handle);
#endif
|
//
// OrderRefundViewController.h
// YuWa
//
// Created by double on 17/3/29.
// Copyright © 2017年 Shanghai DuRui Information Technology Company. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderRefundViewController : UIViewController
@end
|
//
// GameAudioManager.h
// YakitoriGameV2
//
// Created by Tsai Zhen Ling on 4/9/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface GameAudioManager : NSObject <AVAudioPlayerDelegate>
@property (nonatomic, readwrite) float gameVolume;
+ (GameAudioManager *)sharedInstance;
- (AVAudioPlayer *)loadSoundWithPath:(NSString *)path type:(NSString *)type;
- (void)playPlaySound;
- (void)playExitSound;
- (void)playCategorySound;
- (void)playCheerSound;
- (void)playBooSound;
- (void)playNavSound;
- (void)playHintSound;
- (void)playBackgroundMusic;
- (void)stopBackgroundMusic;
@end
|
//
// BQViewController.h
// BQLibrary
//
// Created by CHAU WING WAI on 07/05/2015.
// Copyright (c) 2015 CHAU WING WAI. All rights reserved.
//
@import UIKit;
@interface BQViewController : UIViewController
@end
|
#include "stm32f0xx_ll_bus.h"
#include "stm32f0xx_ll_gpio.h"
#include "stm32f0xx_ll_rcc.h"
#include "stm32f0xx_ll_system.h"
#include "stm32f0xx_ll_spi.h"
static void led_config(void)
{
/*
* Setting clock
*/
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
/*
* Setting LED pins
*/
LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_9, LL_GPIO_MODE_OUTPUT);
LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_8, LL_GPIO_MODE_OUTPUT);
return;
}
static void spi_config(void)
{
/*
* Init GPIO
*/
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
//SPI_MOSI
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_7, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetAFPin_0_7(GPIOA, LL_GPIO_PIN_7, LL_GPIO_AF_0);
LL_GPIO_SetPinSpeed(GPIOA, LL_GPIO_PIN_7, LL_GPIO_SPEED_FREQ_HIGH);
//SPI_MISO
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_6, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetAFPin_0_7(GPIOA, LL_GPIO_PIN_6, LL_GPIO_AF_0);
//SPI_SCK
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_5, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetAFPin_0_7(GPIOA, LL_GPIO_PIN_5, LL_GPIO_AF_0);
LL_GPIO_SetPinSpeed(GPIOA, LL_GPIO_PIN_5, LL_GPIO_SPEED_FREQ_HIGH);
//SPI_CS
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_4, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetAFPin_0_7(GPIOA, LL_GPIO_PIN_4, LL_GPIO_AF_0);
LL_GPIO_SetPinSpeed(GPIOA, LL_GPIO_PIN_4, LL_GPIO_SPEED_FREQ_HIGH);
/*
* Init SPI
*/
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SPI1);
LL_SPI_SetMode(SPI1, LL_SPI_MODE_MASTER);
LL_SPI_SetBaudRatePrescaler(SPI1, LL_SPI_BAUDRATEPRESCALER_DIV8);
LL_SPI_SetTransferBitOrder(SPI1, LL_SPI_MSB_FIRST);
LL_SPI_SetDataWidth(SPI1, LL_SPI_DATAWIDTH_8BIT);
LL_SPI_SetNSSMode(SPI1, LL_SPI_NSS_HARD_OUTPUT);
LL_SPI_EnableNSSPulseMgt(SPI1);
LL_SPI_Enable(SPI1);
return;
}
/**
* System Clock Configuration
* The system Clock is configured as follow :
* System Clock source = PLL (HSI/2)
* SYSCLK(Hz) = 48000000
* HCLK(Hz) = 48000000
* AHB Prescaler = 1
* APB1 Prescaler = 1
* HSI Frequency(Hz) = 8000000
* PLLMUL = 12
* Flash Latency(WS) = 1
*/
static void rcc_config() {
/* Set FLASH latency */
LL_FLASH_SetLatency(LL_FLASH_LATENCY_1);
/* Enable HSI and wait for activation*/
LL_RCC_HSI_Enable();
while (LL_RCC_HSI_IsReady() != 1);
/* Main PLL configuration and activation */
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI_DIV_2,
LL_RCC_PLL_MUL_12);
LL_RCC_PLL_Enable();
while (LL_RCC_PLL_IsReady() != 1);
/* Sysclk activation on the main PLL */
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL);
/* Set APB1 prescaler */
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
/* Set systick to 1ms */
SysTick_Config(48000000/1000);
/* Update CMSIS variable (which can be updated also
* through SystemCoreClockUpdate function) */
SystemCoreClock = 48000000;
}
void HardFault_Handler(void)
{
LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_9);
while (1);
}
static inline void sendSPI(uint8_t value)
{
LL_SPI_TransmitData8(SPI1, value);
while (!LL_SPI_IsActiveFlag_TXE(SPI1));
return;
}
static inline uint8_t recvSPI()
{
uint8_t byte;
while (!LL_SPI_IsActiveFlag_RXNE(SPI1))
byte = LL_SPI_ReceiveData8(SPI1);
return byte;
}
int main(void)
{
uint8_t byte = 0x00;
rcc_config();
led_config();
spi_config();
while (1) {
byte = recvSPI();
sendSPI(byte);
}
return 0;
}
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@interface XCElementDebugging : NSObject
{
}
+ (void)applicationDidFinishLaunching:(id)arg1;
+ (void)_setupDebuggingMenu;
+ (void)_displayWindowInfo:(id)arg1;
+ (void)_recursivelyDisplayElementViewsIn:(id)arg1;
+ (void)_generateDebuggingLayoutForWindow:(id)arg1;
+ (id)_createInnerViewForWindow:(id)arg1;
+ (void)_generateDebuggingLayoutFor:(struct NSObject *)arg1;
+ (id)_createInnerView:(struct NSObject *)arg1;
@end
|
//
// RBPlayerView.h
// Pods
//
// Created by Ribs on 16/8/22.
//
//
#import <UIKit/UIKit.h>
#import "RBPlayerViewMask.h"
#import "RBPlayerContainerView.h"
#import "RBPlayerControlButton.h"
extern NSString *const RBPlayerViewWillOrientationChangeNotificationName;
extern NSString *const RBPlayerViewDidChangedOrientationNotificationName;
extern NSString *const RBPlayerViewTapControlButtoneNotificationName;
extern NSString *const RBPlayerViewWillChangeOrientationKey;
extern NSString *const RBPlayerViewWillChangeFromOrientationKey;
@class RBCorePlayer;
@class RBPlayerView;
@protocol RBPlayerViewDelegate <NSObject>
@optional
- (BOOL)playerView:(RBPlayerView *)playerView willOrientationChange:(UIInterfaceOrientation)orientation;
- (void)playerView:(RBPlayerView *)playerView didChangedOrientation:(UIInterfaceOrientation)orientation fromOrientation:(UIInterfaceOrientation)fromOrientation;
- (BOOL)playerView:(RBPlayerView *)playerView willAddMask:(RBPlayerViewMask *)mask animated:(BOOL)animated;
- (BOOL)playerView:(RBPlayerView *)playerView willRemoveMask:(RBPlayerViewMask *)mask animated:(BOOL)animated;
- (BOOL)playerView:(RBPlayerView *)playerView willTapControlButton:(RBPlayerControlButton *)controlButton;
@end
@interface RBPlayerView : UIView
@property (nonatomic, weak) id<RBPlayerViewDelegate> delegate;
@property (nonatomic, weak, readonly) RBCorePlayer *currentPlayer;
@property (nonatomic) BOOL autoChangedOrientation;
@property (nonatomic) BOOL autoFullScreen;
@property (nonatomic) BOOL ignoreScreenSystemLock;
@property (nonatomic) UIInterfaceOrientationMask supportedOrientations;
@property (nonatomic, readonly) UIInterfaceOrientation visibleInterfaceOrientation;
@property (nonatomic, readonly) BOOL isFullScreen;
@property (nonatomic, strong, readonly) RBPlayerContainerView *containerView;
@property (nonatomic, strong, readonly) NSArray<RBPlayerViewMask *> *masks;
- (instancetype)initWithPlayer:(RBCorePlayer *)player;
- (void)addMask:(RBPlayerViewMask *)mask animated:(BOOL)animated;
- (void)removeMask:(RBPlayerViewMask *)mask animated:(BOOL)animated;
- (BOOL)containsMask:(RBPlayerViewMask *)mask;
- (NSArray<RBPlayerViewMask *> *)findMaskWithClass:(Class)maskClass;
- (void)lockAutoRemove:(BOOL)lock withMask:(RBPlayerViewMask *)mask;
- (void)performOrientationChange:(UIInterfaceOrientation)orientation animated:(BOOL)animated;
@end
|
//
// INDANCSDictionarySerialization.h
// INDANCSMac
//
// Created by Indragie Karunaratne on 12/15/2013.
// Copyright (c) 2013 Indragie Karunaratne. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* Protocol for serializing and deserializing objects from dictionaries.
*/
@protocol INDANCSDictionarySerialization <NSObject>
@required
- (id)initWithDictionary:(NSDictionary *)dictionary;
- (NSDictionary *)dictionaryValue;
@end
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_LOGGER_H_INCLUDED__
#define __I_LOGGER_H_INCLUDED__
#include "IReferenceCounted.h"
namespace ue
{
//! Possible log levels.
//! When used has filter ELL_DEBUG means => log everything and ELL_NONE means => log (nearly) nothing.
//! When used to print logging information ELL_DEBUG will have lowest priority while ELL_NONE
//! messages are never filtered and always printed.
enum ELOG_LEVEL
{
//! Used for printing information helpful in debugging
ELL_DEBUG,
//! Useful information to print. For example hardware infos or something started/stopped.
ELL_INFORMATION,
//! Warnings that something isn't as expected and can cause oddities
ELL_WARNING,
//! Something did go wrong.
ELL_ERROR,
//! Logs with ELL_NONE will never be filtered.
//! And used as filter it will remove all logging except ELL_NONE messages.
ELL_NONE
};
//! Interface for logging messages, warnings and errors
class ILogger : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~ILogger() {}
//! Returns the current set log level.
virtual ELOG_LEVEL getLogLevel() const = 0;
//! Sets a new log level.
/** With this value, texts which are sent to the logger are filtered
out. For example setting this value to ELL_WARNING, only warnings and
errors are printed out. Setting it to ELL_INFORMATION, which is the
default setting, warnings, errors and informational texts are printed
out.
\param ll: new log level filter value. */
virtual void setLogLevel(ELOG_LEVEL ll) = 0;
//! Prints out a text into the log
/** \param text: Text to print out.
\param ll: Log level of the text. If the text is an error, set
it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
independent on what level filter is set, use ELL_NONE. */
virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
/** \param text: Text to print out.
\param hint: Additional info. This string is added after a " :" to the
string.
\param ll: Log level of the text. If the text is an error, set
it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
independent on what level filter is set, use ELL_NONE. */
virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
/** \param text: Text to print out.
\param hint: Additional info. This string is added after a " :" to the
string.
\param ll: Log level of the text. If the text is an error, set
it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
independent on what level filter is set, use ELL_NONE. */
virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
/** \param text: Text to print out.
\param ll: Log level of the text. If the text is an error, set
it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
independent on what level filter is set, use ELL_NONE. */
virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
};
} // end namespace
#endif
|
//
// Created by byter on 2/26/18.
//
#ifndef THREE_PPQ_POINTS_H
#define THREE_PPQ_POINTS_H
#include <QVector3D>
#include <QList>
#include <threepp/quick/scene/Scene.h>
#include <threepp/objects/Points.h>
namespace three {
namespace quick {
class Points : public ThreeQObject
{
Q_OBJECT
Q_PROPERTY(float size READ size WRITE setSize NOTIFY sizeChanged)
Q_PROPERTY(bool sizeAttenuation READ sizeAttenuation WRITE setSizeAttenuation NOTIFY sizeAttenuationChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
protected:
three::Points::Ptr _points;
attribute::growing_t<float, math::Vector3> _positions;
float _size = 1.0f;
bool _sizeAttenuation = true;
QColor _color;
three::Object3D::Ptr _create() override
{
_points = three::Points::make(
BufferGeometry::make(_positions),
PointsMaterial::make(Color(_color.redF(), _color.greenF(), _color.blueF())));
return _points;
}
public:
Points(QObject *parent = nullptr) : ThreeQObject(parent)
{
_positions = attribute::growing<float, math::Vector3>();
}
const QColor &color()const {return _color;}
void setColor(const QColor &color)
{
if(_color != color) {
_color = color;
if(_points) _points->pointsMaterial()->color = Color(color.redF(), color.greenF(), color.blueF());
emit colorChanged();
}
}
float size() const {return _size;}
void setSize(float size) {
if(_size != size) {
_size = size;
if(_points) _points->pointsMaterial()->size = _size;
emit sizeChanged();
}
}
bool sizeAttenuation() const {return _sizeAttenuation;}
void setSizeAttenuation(bool sizeAttenuation) {
if(_sizeAttenuation != sizeAttenuation) {
_sizeAttenuation = sizeAttenuation;
if(_points) _points->pointsMaterial()->sizeAttenuation = _sizeAttenuation;
emit sizeAttenuationChanged();
}
}
Q_INVOKABLE void addPoint(QVector3D point)
{
_positions->next() = math::Vector3(point.x(), point.y(), point.z());
}
signals:
void colorChanged();
void sizeChanged();
void sizeAttenuationChanged();
};
}
}
#endif //THREE_PPQ_POINTS_H
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSTextStorage.h"
@interface NSTextStorage (UIKitUndoExtensions)
- (id)_undoRedoAttributedSubstringFromRange:(struct _NSRange)arg1;
- (void)_undoRedoTextOperation:(id)arg1;
@end
|
/**
* @fileoverview Copyright (c) 2017-18, Stefano Gualandi,
* via Ferrata, 1, I-27100, Pavia, Italy
*
* @author stefano.gualandi@gmail.com (Stefano Gualandi)
*
*/
#pragma once
#include "DOT_BasicTypes.h"
#include <fstream>
#include <sstream>
namespace DOT {
/**
* @brief Two dimensional histogram
*/
class Histogram2D {
public:
// Std c'tor
Histogram2D(const std::string& filename) {
readFromFile(filename);
}
// Rule of five?
// ...
// Parse from file
void readFromFile(const std::string& filename) {
std::ifstream in_file(filename);
if (!in_file) {
fprintf(stdout, "FATAL ERROR: Cannot open file %s.\n", filename.c_str());
exit(EXIT_FAILURE);
}
// Read first line
auto read_row = [&](size_t i) {
size_t j = 0;
std::string line;
std::getline(in_file, line);
std::stringstream lineStream(line);
std::string cell;
while (std::getline(lineStream, cell, ',')) {
data.push_back(stoll(cell));
++j;
}
return j;
};
// Read first row, and return row length
n = read_row(0);
for (size_t i = 1; i < n; ++i)
read_row(i);
// Use as few memory as possible
data.shrink_to_fit();
in_file.close();
}
// Get an elelment. Index data as a matrix
int64_t get(size_t x, size_t y) const {
return data[x * n + y];
};
// Get dimension of histogram
size_t getN() const {
return n;
}
// Dump file to stdout
void dump() const {
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j < n; ++j)
fprintf(stdout, "%ld ", get(i, j));
fprintf(stdout, "\n");
}
}
// Sum over all bins
int64_t computeTotalWeight() const {
int64_t t = 0;
for (int64_t v : data)
t += v;
return t;
}
private:
size_t n; // Histogram of size n*n
std::vector<int64_t> data; // Histogram data a single array (contiguos in memory)
};
} // End namespace
|
//
// ViewController.h
// AAPullToRefreshDemo
//
// Created by hyde on 2013/12/08.
// Copyright (c) 2013年 r-plus. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController <UIScrollViewDelegate>
@end
|
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "github_scmlinks.h"
github_scmlinks_t *github_scmlinks_create(
link_t *self,
char *_class
) {
github_scmlinks_t *github_scmlinks_local_var = malloc(sizeof(github_scmlinks_t));
if (!github_scmlinks_local_var) {
return NULL;
}
github_scmlinks_local_var->self = self;
github_scmlinks_local_var->_class = _class;
return github_scmlinks_local_var;
}
void github_scmlinks_free(github_scmlinks_t *github_scmlinks) {
if(NULL == github_scmlinks){
return ;
}
listEntry_t *listEntry;
if (github_scmlinks->self) {
link_free(github_scmlinks->self);
github_scmlinks->self = NULL;
}
if (github_scmlinks->_class) {
free(github_scmlinks->_class);
github_scmlinks->_class = NULL;
}
free(github_scmlinks);
}
cJSON *github_scmlinks_convertToJSON(github_scmlinks_t *github_scmlinks) {
cJSON *item = cJSON_CreateObject();
// github_scmlinks->self
if(github_scmlinks->self) {
cJSON *self_local_JSON = link_convertToJSON(github_scmlinks->self);
if(self_local_JSON == NULL) {
goto fail; //model
}
cJSON_AddItemToObject(item, "self", self_local_JSON);
if(item->child == NULL) {
goto fail;
}
}
// github_scmlinks->_class
if(github_scmlinks->_class) {
if(cJSON_AddStringToObject(item, "_class", github_scmlinks->_class) == NULL) {
goto fail; //String
}
}
return item;
fail:
if (item) {
cJSON_Delete(item);
}
return NULL;
}
github_scmlinks_t *github_scmlinks_parseFromJSON(cJSON *github_scmlinksJSON){
github_scmlinks_t *github_scmlinks_local_var = NULL;
// define the local variable for github_scmlinks->self
link_t *self_local_nonprim = NULL;
// github_scmlinks->self
cJSON *self = cJSON_GetObjectItemCaseSensitive(github_scmlinksJSON, "self");
if (self) {
self_local_nonprim = link_parseFromJSON(self); //nonprimitive
}
// github_scmlinks->_class
cJSON *_class = cJSON_GetObjectItemCaseSensitive(github_scmlinksJSON, "_class");
if (_class) {
if(!cJSON_IsString(_class))
{
goto end; //String
}
}
github_scmlinks_local_var = github_scmlinks_create (
self ? self_local_nonprim : NULL,
_class ? strdup(_class->valuestring) : NULL
);
return github_scmlinks_local_var;
end:
if (self_local_nonprim) {
link_free(self_local_nonprim);
self_local_nonprim = NULL;
}
return NULL;
}
|
//
// Created by oleg on 08.01.18.
//
#ifndef EVOLUTION_CLUSTERING_H
#define EVOLUTION_CLUSTERING_H
#include "GeneticAlgorithm/GAFwd.h"
#include "Species/Species.h"
LIST_TYPE(SpeciesPtr) Clustering_Template(
World* world,
LIST_TYPE(EntityPtr) new_entities,
double eps,
size_t min_pts,
LIST_TYPE(SpeciesPtr) (*clustering)(World* world,
LIST_TYPE(EntityPtr) new_entities,
double eps, size_t min_pts,
LIST_TYPE(EntityPtr) noise_entities));
LIST_TYPE(SpeciesPtr) Clustering_OPTICS(World* world,
LIST_TYPE(EntityPtr) new_entities,
double eps,
size_t min_pts);
#endif //EVOLUTION_CLUSTERING_H
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <Foundation/NSKeyValueFastMutableOrderedSet.h>
@class NSKeyValueGetter;
// Not exported
@interface NSKeyValueFastMutableOrderedSet2 : NSKeyValueFastMutableOrderedSet
{
NSKeyValueGetter *_valueGetter;
}
+ (CDStruct_7c9a8e9f *)_proxyNonGCPoolPointer;
- (id)objectsAtIndexes:(id)arg1;
- (id)objectAtIndex:(unsigned long long)arg1;
- (unsigned long long)indexOfObject:(id)arg1;
- (void)getObjects:(id *)arg1 range:(struct _NSRange)arg2;
- (unsigned long long)count;
- (id)_nonNilOrderedSetValueWithSelector:(SEL)arg1;
- (void)_proxyNonGCFinalize;
- (id)_proxyInitWithContainer:(id)arg1 getter:(id)arg2;
@end
|
//
// MSData.h
// Example
//
// Created by Ricky on 14-1-4.
// Copyright (c) 2014年 Monospace Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MSData : NSObject
{
}
+(NSMutableArray *)initWithData;
+(NSMutableArray *)initWithDataSection:(int)sections withStartDate:(NSDate *)startDate;
- (void)addEventToSection:(int)section
withEventRemoteID:(NSNumber *)remoteID
withStartDate:(NSDate *) startDate
withTitle:(NSString *)title
withLocation:(NSString *)location
withTimeToBeDecided:(NSNumber *)timeToBeDecided
withDateToBeDecided:(NSNumber *)date;
@end
|
//
// ScottRefreshView.h
// QQLive
//
// Created by Scott_Mr on 2016/11/25.
// Copyright © 2016年 Scott. All rights reserved.
//
#import <MJRefresh/MJRefresh.h>
@interface ScottRefreshView : MJRefreshGifHeader
@end
|
//
// RWPickFlavor.h
// RWPickFlavor
//
// Created by Ziyang Tan on 7/29/15.
// Copyright (c) 2015 Ziyang Tan. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for RWPickFlavor.
FOUNDATION_EXPORT double RWPickFlavorVersionNumber;
//! Project version string for RWPickFlavor.
FOUNDATION_EXPORT const unsigned char RWPickFlavorVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <RWPickFlavor/PublicHeader.h>
|
#pragma once
#include <GL/glew.h>
#include "defs.h"
#include "visualizer/pixelformat.h"
#define CALL_GL_API(func)\
func; \
{\
GLenum __gl_err__ = ::glGetError();\
if (__gl_err__ != GL_NO_ERROR) { AT_PRINTF("GL Error[%x](%s[%d])\n", __gl_err__, __FILE__, __LINE__); AT_ASSERT(false); }\
}
namespace aten {
inline void getGLPixelFormat(
PixelFormat fmt,
GLenum& glfmt,
GLenum& gltype,
GLenum& glinternal)
{
static GLenum glpixelfmt[] = {
GL_RGBA,
GL_RGBA,
GL_RGBA,
};
static GLenum glpixeltype[] = {
GL_UNSIGNED_BYTE,
GL_FLOAT,
GL_HALF_FLOAT,
};
static GLenum glpixelinternal[] = {
GL_RGBA,
GL_RGBA32F,
GL_RGBA16F,
};
int idx = static_cast<int>(fmt);
glinternal = glpixelinternal[idx];
glfmt = glpixelfmt[idx];
gltype = glpixeltype[idx];
}
}
|
#include "SanUSB1X.h"
#include "lcd.h"
unsigned int i;
unsigned char buffer1[20];
unsigned char sino[8]= {0x04,0x0E,0x0E,0x0E,0x1F,0x00,0x04,0x00};
//#pragma interrupt interrupcao
void interrupt interrupcao(){}
void main(void) {
clock_int_4MHz();
habilita_canal_AD(AN0);
lcd_ini();
//Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
tempo_ms(100);
CGRAM_SanUSB(1,sino);//CGRAM_build(monta posicao do caractere especial,vetor do desenho);
tempo_ms(300);
Lcd_Chr(1, 2, 1); //Lcd_Chr(linha, coluna, posicao do caractere especial);
tempo_ms(500);
lcd_escreve(1, 3, "Microcontrol");
tempo_ms(500);
lcd_escreve(2, 1, "Converte");
tempo_ms(500);
while(1)
{
i= le_AD10bits(0);
inverte_saida(pin_b7);inverte_saida(pin_d7);
sprintf(buffer1,"%d ",i);
lcd_escreve2(2, 12, buffer1); //com buffer
tempo_ms(300);
//printf("a ");
}
}
|
#pragma once
#include "BuildStatusReporter.h"
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <string>
#include <chrono>
class ProgramOptions
{
public: // Construction/Destruction.
ProgramOptions(int argc, char* argv[]);
~ProgramOptions();
private: // Non-copyable.
ProgramOptions(const ProgramOptions&) = delete;
ProgramOptions& operator=(const ProgramOptions&) = delete;
public: // Methods.
void printHelp() const;
auto isHelpRequested() const -> bool;
auto getReporterName() const -> std::string;
auto getReporter() const -> BuildStatusReporter&;
auto getStatusUris() const -> std::vector<std::string>;
auto getPollingPeriod() -> std::chrono::seconds;
private: // Helpers.
void initReporter(int argc, char* argv[]);
private: // Data.
boost::program_options::variables_map varsMap_;
boost::program_options::options_description optionsDesc_;
};
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "IDEIndexGeniusResultsFinder.h"
@interface IDEDMGeniusResultsFinder : IDEIndexGeniusResultsFinder
{
}
+ (Class)editorDocumentClass;
- (id)locationsFromSymbol:(id)arg1;
- (id)geniusResultsFromLocations:(id)arg1;
- (id)uniqueGeniusLocations:(id)arg1 originalDocumentLocation:(id)arg2;
- (id)geniusCategoryIdentifier;
@end
|
#pragma once
#include "Include.h"
#include "ButtonBase.h"
namespace CellularNetworkDemonstration {
class MenuSystemClose :public ButtonBase {
public:
MenuSystemClose(SDL_Renderer *renderer)
:ButtonBase(renderer, 45, 20) {
SDL_Texture* origTarget = SDL_GetRenderTarget(m_pRenderer);
Uint8 r, g, b, a;
SDL_GetRenderDrawColor(m_pRenderer, &r, &g, &b, &a);
m_pCloseIcon = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 11, 10);
SDL_SetTextureBlendMode(m_pCloseIcon, SDL_BLENDMODE_BLEND);
SDL_SetRenderTarget(m_pRenderer, m_pCloseIcon);
SDL_SetRenderDrawColor(m_pRenderer, 255, 255, 255, 0);
SDL_RenderClear(m_pRenderer);
SDL_SetRenderDrawColor(m_pRenderer, 255, 255, 255, 255);
SDL_RenderDrawLine(renderer, 0, 0, 9, 9);
SDL_RenderDrawLine(renderer, 1, 0, 10, 9);
SDL_RenderDrawLine(renderer, 9, 0, 0, 9);
SDL_RenderDrawLine(renderer, 10, 0, 1, 9);
SDL_RenderPresent(m_pRenderer);
m_pCloseIconPosition = new SDL_Rect{ 17, 5, 11, 10 };
// »Ö¸´äÖȾÆ÷״̬
SDL_SetRenderTarget(m_pRenderer, origTarget);
SDL_SetRenderDrawColor(m_pRenderer, r, g, b, a);
}
~MenuSystemClose() {
// ÇåÀí×ÓÔªËØºÍ×ÊÔ´
if (m_pCloseIcon) {
SDL_DestroyTexture(m_pCloseIcon);
}
DELETE_IF_EXIST(m_pCloseIconPosition)
}
private:
SDL_Texture *m_pCloseIcon;
SDL_Rect *m_pCloseIconPosition;
// »æÖƽçÃæÔªËØ
virtual void doRender() {
SDL_SetRenderDrawColor(m_pRenderer, 250, 30, 30, getRenderAlpha());
SDL_RenderClear(m_pRenderer);
SDL_RenderCopy(m_pRenderer, m_pCloseIcon, nullptr,m_pCloseIconPosition);
}
// ±³¾°»ìºÏ¶¯»
int getRenderAlpha() {
const static int IN_DURATION = 200 / 100;//Divided by 100 percents
const static int OUT_DURATION = 400 / 100;//Divided by 100 percents
static int percent = 0;
static int lastTick = 0;
static int currentTick;
currentTick = SDL_GetTicks();
int alpha, delta;
switch (m_pState) {
case BUTTON_STATE_NORMAL:
delta = ( currentTick - lastTick ) / OUT_DURATION;
percent -= delta;
if (percent < 0) {
percent = 0;
}
// »º¶¯ÇúÏßÉèÖÃΪÕýÏÒ
alpha = 120 + SDL_static_cast(int, ( 220 - 120 ) * SDL_sin(percent / 100.0));
break;
case BUTTON_STATE_HOVER:
delta = ( currentTick - lastTick ) / IN_DURATION;
percent += delta;
if (percent > 100) {
percent = 100;
}
// »º¶¯ÇúÏßÉèÖÃΪÕýÏÒ
alpha = 120 + SDL_static_cast(int, ( 220 - 120 ) * SDL_sin(percent / 100.0));
break;
case BUTTON_STATE_DOWN:
alpha = 255;
break;
default:
break;
}
lastTick = currentTick;
return alpha;
}
virtual void doAction() {
SDL_Event* quit = new SDL_Event;
quit->quit.type = SDL_QUIT;
SDL_PushEvent(quit);
}
};
}
|
#ifndef EVALUATOR_H_
#define EVALUATOR_H_
class Expression;
class AstBinOp;
class AstUnOp;
class AstExpressionList;
struct lni_object;
#include "SymbolTable.h"
class Evaluator {
private:
SymbolTable sym_tab;
int c;
public:
Evaluator();
Expression* eval(Expression* e);
Expression* eval_binop(AstBinOp* b);
Expression* eval_unop(AstUnOp* b);
Expression* eval_expression_list(AstExpressionList* l);
lni_object* convert_expression_to_lni_object(Expression* e);
Expression* convert_lni_object_to_expression(lni_object* l);
};
#endif /* EVALUATOR_H_ */
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved.
// no include guard on purpose!
#define SAMPLE_PROFILE_DECLARE_AG_PERFMON_EVENT_INFO_H
/**
* This header expects the macro:
* PX_PROFILE_EVENT_DEFINITION_HEADER to be defined to a string which is included
* in order to produce the enum and event id lists.
*
* This header needs to be of the form:
*
DEFINE_EVENT( eventname )
*/
#include "physxprofilesdk/PxProfileCompileTimeEventFilter.h"
#include "physxprofilesdk/PxProfileEventNames.h"
//Event id enumeration
#define DEFINE_EVENT( name ) name,
struct AgPerfmonEventIds
{
enum Enum
{
UnknownEvent = 0,
#include AG_PERFMON_EVENT_DEFINITION_HEADER
};
};
#undef DEFINE_EVENT
#undef SAMPLE_PROFILE_DECLARE_AG_PERFMON_EVENT_INFO_H
|
//
// Created by Tobias Sundstrand on 2014-03-24.
//
#import <Foundation/Foundation.h>
@interface TSExpandingArray : NSObject <NSFastEnumeration>
- (NSUInteger)count;
- (id)initWithSize:(NSUInteger)size;
- (id)objectAtIndex:(NSUInteger)idx;
- (id)initWithSize:(NSUInteger)size fillOutClass:(Class)class;
- (instancetype)initWithArray:(NSArray *)array;
+ (instancetype)arrayWithSize:(NSUInteger)size;
+ (instancetype)arrayWithSize:(NSUInteger)size fillOutClass:(Class)class;
- (void)setObject:(id)obj atIndex:(NSUInteger)idx;
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
- (NSArray *)allObjects;
- (void)removeAllObjects;
- (void)removeObjectAtIndex:(NSUInteger)index;
@end
|
#ifndef MK_SERIAL_TX_H_
#define MK_SERIAL_TX_H_
#include <inttypes.h>
enum MKTxBits {
MK_TX_VERSION = 1<<0,
};
enum MKStream {
MK_STREAM_NONE = 0,
MK_STREAM_DEBUG,
};
// =============================================================================
// Public functions:
// This function sends data that has been requested.
void SendPendingMKSerial(void);
// -----------------------------------------------------------------------------
// This function starts the specified data stream at the specified period. Note
// that this stream has to be renewed periodically by resending the request. If
// no renewing request is received, then the stream will time out after a while.
// Also note that the stream output period will be quantized to the main control
// frequency.
void SetMKDataStream(enum MKStream mk_stream, uint32_t period_10ms);
// -----------------------------------------------------------------------------
// This function sets a one-time request for data.
void SetMKTxRequest(enum MKTxBits);
#endif // MK_SERIAL_TX_H_
|
/*
* ZSUMMER License
* -----------
*
* ZSUMMER is licensed under the terms of the MIT license reproduced below.
* This means that ZSUMMER is free software and can be used for both academic
* and commercial purposes at absolutely no cost.
*
*
* ===============================================================================
*
* Copyright (C) 2014-2016 YaweiZhang <yawei.zhang@foxmail.com>.
*
* 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.
*
* ===============================================================================
*
* (end of COPYRIGHT)
*/
#pragma once
#ifndef _ANY_H_
#define _ANY_H_
#include <map>
#include <vector>
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#ifndef WIN32
#include <sys/stat.h>
#else
#include <direct.h>
#endif
//store type enum
enum AnyType : short
{
GT_DataComment,
GT_DataEnum,
GT_DataArray,
GT_DataMap,
GT_DataConstValue,
GT_DataPacket,
};
//tag
enum MemberTag : short
{
MT_NORMAL,
MT_DB_KEY,
MT_DB_UNI,
MT_DB_IDX,
MT_DB_AUTO,
MT_DB_IGNORE,
MT_DB_BLOB,
};
//comment
struct DataComment
{
std::string _desc;
};
//array type
struct DataArray
{
std::string _type;
std::string _arrayName;
std::string _desc;
};
//dict type
struct DataMap
{
std::string _typeKey;
std::string _typeValue;
std::string _mapName;
std::string _desc;
};
//const type
struct DataConstValue
{
std::string _type;
std::string _name;
std::string _value;
std::string _desc;
};
//include file name, without suffix
struct DataEnum
{
std::string _type;
std::string _name;
std::string _desc;
std::vector<DataConstValue> _members;
};
//struct type
struct DataStruct
{
std::string _name;
std::string _desc;
std::string _store;
bool _hadLog4z = false;
struct DataMember
{
std::string _type;
std::string _name;
std::string _desc;
short _tag; //MemberTag
};
std::vector<DataMember> _members;
};
//proto type
struct DataPacket
{
DataConstValue _const;
DataStruct _struct;
};
//general store type
struct AnyData
{
AnyType _type;
DataComment _comment;
DataConstValue _const;
DataEnum _enum;
DataArray _array;
DataMap _map;
DataPacket _proto;
};
#endif
|
//
// LogoLayer.h
// Air Hockey
//
// Created by Jianjun on 2/3/14.
//
//
#ifndef __Air_Hockey__LogoLayer__
#define __Air_Hockey__LogoLayer__
#include "cocos2d.h"
class LogoLayer: public cocos2d::Layer {
public:
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// implement the "static create()" method manually
CREATE_FUNC(LogoLayer);
virtual bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event);
};
#endif /* defined(__Air_Hockey__LogoLayer__) */
|
#include <stdio.h>
void exact_square(int);
int main() {
int n=0;
scanf("%d",&n);
exact_square(n);
return 0;
}
void exact_square(int n){
int i=0, result=0;
for( i=0 ; i<n ; i++ ) {
if( i*i==n ){
result=1;
break;
}
}
if( result==1 ) {
printf("\n 1");
printf("\n %d=%d^2", n, i);
}
if( result==0 ) {
printf("\n 0");
printf("\n This number does not have an exact root");
}
printf("\n");
}
|
//
//
// MIT License
//
// Copyright (c) 2017 Stellacore Corporation.
//
// 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 ro_SpinPQ_INCL_
#define ro_SpinPQ_INCL_
/*! \file
\brief Declarations for ro::SpinPQ
*/
#include "libga/ga.h"
#include "libga/spin.h"
#include "libro/PairRel.h"
#include "libro/ro.h"
#include <array>
#include <string>
#include <sstream>
namespace ro
{
/*! \brief Spinor pair representing RO formulation from Horn.
\par Example
\dontinclude testro/uSpinPQ.cpp
\skip ExampleStart
\until ExampleEnd
*/
class SpinPQ
{
std::pair<ga::Spinor, ga::Spinor> thePQ;
private: // static methods
//! Create in accordance with explicit defintion
static
std::pair<ga::Spinor, ga::Spinor>
pairPQ
( ga::BiVector const & phi
, ga::BiVector const & theta
, ga::BiVector const & basePlane
);
//! Forward and optionally negated values
inline
static
std::pair<ga::Spinor, ga::Spinor>
permForward
( std::pair<ga::Spinor, ga::Spinor> const & aPQ
, double const & multA = 1. //!< E.g. +1. or -1.
, double const & multB = 1. //!< E.g. +1. or -1.
);
//! Reversed and optionally negated values
inline
static
std::pair<ga::Spinor, ga::Spinor>
permReverse
( std::pair<ga::Spinor, ga::Spinor> const & aPQ
, double const & multA = 1. //!< E.g. +1. or -1.
, double const & multB = 1. //!< E.g. +1. or -1.
);
public: // static methods
//! Construct per definition
static
SpinPQ
from
( ga::BiVector const & phi
, ga::BiVector const & theta
, ga::BiVector const & basePlane = ga::E12
);
//! Construct from an aribtrary pair of orientations
static
SpinPQ
from
( std::pair<ga::Rigid, ga::Rigid> const & oriPair
);
public: // methods
//! default null constructor
SpinPQ
() = default;
//! Value ctor
explicit
SpinPQ
( std::pair<ga::Spinor, ga::Spinor> const & pairPQ
);
//! Construct from arbitrary relative orientation
explicit
SpinPQ
( ro::Pair const & anyRO
);
//! Evaluate triple product
double
tripleProductGap
( std::pair<ga::Vector, ga::Vector> const & uvPair
) const;
//! True if instance is valid
bool
isValid
() const;
//! Number of unqiue permutations
static constexpr size_t theNumPerms{ 4u };
//! Solutions in combination (combinations of +/- and reversals)
SpinPQ const &
operator[]
( size_t const & ndx
) const
{
static std::array<SpinPQ, theNumPerms> const perms
{{ SpinPQ(permForward(thePQ, 1., 1.)) // 0 *
, SpinPQ(permForward(thePQ, 1., -1.)) // 1 *
// , SpinPQ(permForward(thePQ, -1., 1.)) // == 1
// , SpinPQ(permForward(thePQ, -1., -1.)) // == 0
, SpinPQ(permReverse(thePQ, 1., 1.)) // 4 *
, SpinPQ(permReverse(thePQ, 1., -1.)) // 5 *
// , SpinPQ(permReverse(thePQ, -1., 1.)) // == 5
// , SpinPQ(permReverse(thePQ, -1., -1.)) // == 4
}};
assert(ndx < perms.size());
return perms[ndx];
}
//! Expression of current values as dependent relative orientation.
OriPair
pair
() const;
//! Descriptive information about this instance.
std::string
infoString
( std::string const & title = std::string()
, std::string const & fmt = std::string("%9.6f")
) const;
}; // SpinPQ
} // ro
// Inline definitions
#include "libro/SpinPQ.inl"
#endif // ro_SpinPQ_INCL_
|
// Copyright (c) 2011-2013 The GreenCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef GREENCOIN_QT_TRANSACTIONDESCDIALOG_H
#define GREENCOIN_QT_TRANSACTIONDESCDIALOG_H
#include <QDialog>
namespace Ui {
class TransactionDescDialog;
}
QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
/** Dialog showing transaction details. */
class TransactionDescDialog : public QDialog
{
Q_OBJECT
public:
explicit TransactionDescDialog(const QModelIndex &idx, QWidget *parent = 0);
~TransactionDescDialog();
private:
Ui::TransactionDescDialog *ui;
};
#endif // GREENCOIN_QT_TRANSACTIONDESCDIALOG_H
|
//
// ChongZhiViewController.h
// Ocean
//
// Created by 爱海洋 on 15/5/29.
// Copyright (c) 2015年 xyzx5u. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ChongZhiViewController : UIViewController
@end
|
#include "../termo.h"
#include "taplib.h"
int
main (int argc, char *argv[])
{
termo_t *tk;
termo_sym_t sym;
const char *end;
plan_tests (10);
tk = termo_new_abstract ("vt100", NULL, 0);
sym = termo_keyname2sym (tk, "Space");
is_int (sym, TERMO_SYM_SPACE, "keyname2sym Space");
sym = termo_keyname2sym (tk, "SomeUnknownKey");
is_int (sym, TERMO_SYM_UNKNOWN, "keyname2sym SomeUnknownKey");
end = termo_lookup_keyname (tk, "Up", &sym);
ok (!!end, "termo_get_keyname Up returns non-NULL");
is_str (end, "", "termo_get_keyname Up return points at endofstring");
is_int (sym, TERMO_SYM_UP, "termo_get_keyname Up yields Up symbol");
end = termo_lookup_keyname (tk, "DownMore", &sym);
ok (!!end, "termo_get_keyname DownMore returns non-NULL");
is_str (end, "More", "termo_get_keyname DownMore return points at More");
is_int (sym, TERMO_SYM_DOWN,
"termo_get_keyname DownMore yields Down symbol");
end = termo_lookup_keyname (tk, "SomeUnknownKey", &sym);
ok (!end, "termo_get_keyname SomeUnknownKey returns NULL");
is_str (termo_get_keyname (tk, TERMO_SYM_SPACE), "Space",
"get_keyname SPACE");
termo_destroy (tk);
return exit_status ();
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_51b.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE129.label.xml
Template File: sources-sinks-51b.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: large Large index value that is greater than 10-1
* GoodSource: Larger than zero but less than 10
* Sinks:
* GoodSink: Ensure the array index is valid
* BadSink : Improperly check the array index by not checking the upper bound
* Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_51b_badSink(int data)
{
{
int i;
int * buffer = (int *)malloc(10 * sizeof(int));
/* initialize buffer */
for (i = 0; i < 10; i++)
{
buffer[i] = 0;
}
/* POTENTIAL FLAW: Attempt to write to an index of the array that is above the upper bound
* This code does check to see if the array index is negative */
if (data >= 0)
{
buffer[data] = 1;
/* Print the array values */
for(i = 0; i < 10; i++)
{
printIntLine(buffer[i]);
}
}
else
{
printLine("ERROR: Array index is negative.");
}
free(buffer);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_51b_goodG2BSink(int data)
{
{
int i;
int * buffer = (int *)malloc(10 * sizeof(int));
/* initialize buffer */
for (i = 0; i < 10; i++)
{
buffer[i] = 0;
}
/* POTENTIAL FLAW: Attempt to write to an index of the array that is above the upper bound
* This code does check to see if the array index is negative */
if (data >= 0)
{
buffer[data] = 1;
/* Print the array values */
for(i = 0; i < 10; i++)
{
printIntLine(buffer[i]);
}
}
else
{
printLine("ERROR: Array index is negative.");
}
free(buffer);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_51b_goodB2GSink(int data)
{
{
int i;
int * buffer = (int *)malloc(10 * sizeof(int));
/* initialize buffer */
for (i = 0; i < 10; i++)
{
buffer[i] = 0;
}
/* FIX: Properly validate the array index and prevent a buffer overflow */
if (data >= 0 && data < (10))
{
buffer[data] = 1;
/* Print the array values */
for(i = 0; i < 10; i++)
{
printIntLine(buffer[i]);
}
}
else
{
printLine("ERROR: Array index is out-of-bounds");
}
free(buffer);
}
}
#endif /* OMITGOOD */
|
////////////////////////////////////////////////////////////////////
// 2 Dimensional Vector Mathematix Library //
// Part of Games Math library //
// Authors: KindarConrath //
////////////////////////////////////////////////////////////////////
#ifndef VECTOR2D_H
#define VECTOR2D_H
#include <iostream>
class Vector2D
{
public:
Vector2D();
Vector2D(const Vector2D& cpy);
Vector2D(double x, double y);
Vector2D operator=(Vector2D v2);
Vector2D operator+(Vector2D v2);
Vector2D operator-(Vector2D v2);
Vector2D operator*(double scl);
double dot(Vector2D v2);
bool operator==(Vector2D v2);
double magnitude();
Vector2D normalize(); //trying to decide if it should normalize THIS vector or JUST return a normalized vector.
double &operator()( int ); //retuns lvaule
double operator()( int ) const; //returns rvalue
private:
double x, y;
};
std::ostream& operator<<(std::ostream& out, Vector2D v2); //global operator overloading
#endif // !VECTOR2D_H
|
#pragma once
#include "VertexInfo.h"
#include "ParameterBlock.h"
#include <EtCore/Content/Asset.h>
#include <EtCore/Util/LinkerUtils.h>
namespace et { namespace render {
class TextureData;
} namespace pl {
class EditableShaderAsset;
} }
namespace et {
namespace render {
//---------------------------------
// ShaderData
//
// Shader that can be used to draw things on the GPU - contains information about it's uniforms
//
class ShaderData final
{
// definitions
//---------------------
friend class ShaderAsset;
friend class pl::EditableShaderAsset;
public:
typedef std::pair<T_AttribLoc, AttributeDescriptor> T_AttributeLocation;
// Construct destruct
//---------------------
ShaderData() = default;
ShaderData(T_ShaderLoc const program);
~ShaderData();
// accessors
//---------------------
T_ShaderLoc const GetProgram() const { return m_ShaderProgram; }
std::vector<T_AttributeLocation> const& GetAttributes() const { return m_Attributes; }
std::vector<render::UniformParam> const& GetUniformLayout() const { return m_UniformLayout; }
std::vector<core::HashString> const& GetUniformIds() const { return m_UniformIds; }
render::T_ConstParameterBlock GetCurrentUniforms() const { return m_CurrentUniforms; }
// functionliaty
//---------------------
render::T_ParameterBlock CopyParameterBlock(render::T_ConstParameterBlock const source) const;
void UploadParameterBlock(render::T_ConstParameterBlock const block) const;
template<typename TDataType>
bool Upload(T_Hash const uniform, TDataType const& data, bool const reportWarnings = true) const;
template<>
bool Upload<TextureData const*>(T_Hash const uniform, TextureData const* const& textureData, bool const reportWarnings) const;
// Data
///////
private:
T_ShaderLoc m_ShaderProgram;
// attribute data
//----------------
std::vector<T_AttributeLocation> m_Attributes;
// uniform data
//--------------
// loose uniforms
std::vector<render::UniformParam> m_UniformLayout;
std::vector<core::HashString> m_UniformIds;
render::T_ParameterBlock m_CurrentUniforms = nullptr;
size_t m_UniformDataSize = 0u;
// within blocks
std::vector<core::HashString> m_UniformBlocks; // addressed by their indices
};
//---------------------------------
// ShaderAsset
//
// Loadable Shader Data
//
class ShaderAsset final : public core::Asset<ShaderData, false>
{
// definitions
//-------------
RTTR_ENABLE(core::Asset<ShaderData, false>)
DECLARE_FORCED_LINKING()
public:
static std::string const s_MainExtension;
static std::string const s_GeoExtension;
static std::string const s_FragExtension;
static T_ShaderLoc CompileShader(std::string const& shaderSourceStr, E_ShaderType const type);
static T_ShaderLoc LinkShader(std::string const& vert, std::string const& geo, std::string const& frag, I_GraphicsContextApi* const api);
static void InitUniforms(ShaderData* const data);
static void GetAttributes(T_ShaderLoc const shaderProgram, std::vector<ShaderData::T_AttributeLocation>& attributes);
// Construct destruct
//---------------------
ShaderAsset() : core::Asset<ShaderData, false>() {}
virtual ~ShaderAsset() = default;
// Asset overrides
//---------------------
bool LoadFromMemory(std::vector<uint8> const& data) override;
};
} // namespace render
} // namespace et
#include "Shader.inl"
|
//
// The MIT License (MIT)
//
// Copyright (c) 2017 Snips
//
// 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.
//
#import <UIKit/UIKit.h>
//! Project version number for Postal.
FOUNDATION_EXPORT double PostalVersionNumber;
//! Project version string for Postal.
FOUNDATION_EXPORT const unsigned char PostalVersionString[];
|
#ifndef ASSETDATABASE_H
#define ASSETDATABASE_H
#include "../../common.h"
#include "asset.h"
#include <unordered_map>
#include <typeinfo>
#include <typeindex>
#include <vector>
#include <thread>
#include <mutex>
class AssetDatabase
{
public:
static AssetDatabase * GetInstance();
template <class T>
T* LoadAsset(const std::string& id)
{
T * t = FindAsset<T>(id);
if(t != nullptr)
return t;
t = new T();
t->LoadFromFilename(id);
assetMap[typeid(T)][id] = t;
return t;
}
// For parameters
template <class T, class P>
T* LoadAsset(const std::string& id, const P& p)
{
T * t = FindAsset<T>(id);
if (t != nullptr)
return t;
t = new T();
t->LoadFromFilename(id, p);
assetMap[typeid(T)][id] = t;
return t;
}
template<class T>
T * FindAsset(std::string id)
{
std::unordered_map<std::string, Asset*>& idMap = assetMap[typeid(T)];
auto value = idMap.find(id);
if(value != idMap.end())
return dynamic_cast<T*>(value->second);
return nullptr;
}
void Update();
~AssetDatabase();
private:
static AssetDatabase * instance;
static bool deleted;
std::unordered_map<std::type_index, std::unordered_map<std::string, Asset*>> assetMap;
std::vector<Asset*> assetsToReload;
std::thread updateThread;
std::mutex reloadMutex;
AssetDatabase();
void WatchAssets();
};
#endif // ASSETDATABASE_H
|
#include "mobile_client.h"
static bool mobile_ready;
static SummaryMessageHandler *summary_msg_handler;
static void handle_received(DictionaryIterator *iter, void *ctx) {
if (!mobile_ready) {
Tuple *ready = dict_find(iter, MESSAGE_KEY_MobileReady);
if (ready) {
mobile_ready = true;
APP_LOG(APP_LOG_LEVEL_INFO, "Client connected.");
}
} else {
Tuple *summary_payload = dict_find(iter, MESSAGE_KEY_Summary);
if (summary_payload) summary_msg_handler(summary_payload);
}
}
static void request_summary(void) {
DictionaryIterator *msg;
AppMessageResult result = app_message_outbox_begin(&msg);
if (result == APP_MSG_OK) {
dict_write_cstring(msg, MESSAGE_KEY_Summary, NORMAL_SUMMARY);
}
result = app_message_outbox_send();
}
static void init(SummaryMessageHandler *summary_msg_hl) {
summary_msg_handler = summary_msg_hl;
app_message_register_inbox_received(handle_received);
app_message_open(app_message_inbox_size_maximum(),
app_message_outbox_size_maximum());
}
struct _MobileClient MobileClient = {
.init = init,
.request_summary = request_summary
};
|
/*
* GccApplication1.c
*
* Created: 08-07-2015 12:08:05
* Author: ROHIT
*/
#include <avr/io.h>
#include <util/delay.h>
unsigned char buffer[11];
unsigned char bufferi[11];
void ADC_init(void);
int ADC_read(uint8_t ch);
unsigned int cmd(unsigned int cd)
{
PORTD=cd;
PORTC=(0<<PC0)|(0<<PC1)|(1<<PC2);
PORTC=(0<<PC0)|(0<<PC1)|(0<<PC2);
return ;
}
unsigned int dat(unsigned int dt)
{
PORTD=dt;
PORTC=(1<<PC0)|(0<<PC1)|(1<<PC2);
PORTC=(1<<PC0)|(0<<PC1)|(0<<PC2);
return ;
}
main(void)
{
int value1=0,value2=0;
int i,j=0;
DDRA=0x00;
DDRB=0xFF;
DDRC=0xFF;
DDRD=0xFF;
cmd(0x38);
_delay_ms(100);
cmd(0x01);
_delay_ms(100);
cmd(0x0E);
_delay_ms(100);
cmd(0x06);
_delay_ms(100);
ADC_init();
while(1)
{
value1=ADC_read(0);
value2=ADC_read(1);
sprintf(buffer,"VALUE1:%d",value1);
while(i<11)
{
dat(buffer[i]);
i++;
_delay_ms(1);
}
i=0;
cmd(0xC0);
sprintf(bufferi,"VALUE2:%d",value2);
while(j<11)
{
dat(bufferi[j]);
j++;
_delay_ms(1);
}
_delay_ms(500);
cmd(0x01);
j=0;
if(value1>650 && value2>650)
{
PORTB=0b11111111;
}
if(value1>650 && value2<650)
{
PORTB=0b00001111;
}
if(value1<650 && value2>650)
{
PORTB=0b11110000;
}
if(value1<650 && value2<650)
{
PORTB=0b00000000;
}
}
}
void ADC_init(void)
{
ADMUX = (1<<REFS0);
ADCSRA = (1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);
}
int ADC_read(uint8_t ch)
{
ADC=0;
ch= ch&0b00000111;
ADMUX = ADMUX & 0b11100000;
ADMUX |= ch;
ADCSRA |=(1<<ADSC);
while(!(ADCSRA&(1<<ADIF)));
ADCSRA |= (1<<ADIF);
return(ADC);
}
|
/********************************************************************************
** Form generated from reading UI file 'mainwindow.ui'
**
** Created by: Qt User Interface Compiler version 5.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QGraphicsView>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QWidget *centralWidget;
QGridLayout *gridLayout;
QGraphicsView *graphicsView;
QHBoxLayout *horizontalLayout;
QPushButton *pushButton;
QPushButton *pushButton_2;
QPushButton *pushButton_3;
QMenuBar *menuBar;
QToolBar *mainToolBar;
QStatusBar *statusBar;
QToolBar *toolBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QStringLiteral("MainWindow"));
MainWindow->resize(557, 473);
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName(QStringLiteral("centralWidget"));
gridLayout = new QGridLayout(centralWidget);
gridLayout->setSpacing(6);
gridLayout->setContentsMargins(11, 11, 11, 11);
gridLayout->setObjectName(QStringLiteral("gridLayout"));
graphicsView = new QGraphicsView(centralWidget);
graphicsView->setObjectName(QStringLiteral("graphicsView"));
graphicsView->setMinimumSize(QSize(450, 350));
graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
gridLayout->addWidget(graphicsView, 0, 0, 1, 1);
horizontalLayout = new QHBoxLayout();
horizontalLayout->setSpacing(6);
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
pushButton = new QPushButton(centralWidget);
pushButton->setObjectName(QStringLiteral("pushButton"));
pushButton->setMaximumSize(QSize(200, 16777215));
horizontalLayout->addWidget(pushButton);
pushButton_2 = new QPushButton(centralWidget);
pushButton_2->setObjectName(QStringLiteral("pushButton_2"));
pushButton_2->setMaximumSize(QSize(200, 16777215));
horizontalLayout->addWidget(pushButton_2);
pushButton_3 = new QPushButton(centralWidget);
pushButton_3->setObjectName(QStringLiteral("pushButton_3"));
pushButton_3->setMaximumSize(QSize(200, 16777215));
horizontalLayout->addWidget(pushButton_3);
gridLayout->addLayout(horizontalLayout, 1, 0, 1, 1);
MainWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 557, 19));
MainWindow->setMenuBar(menuBar);
mainToolBar = new QToolBar(MainWindow);
mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QStringLiteral("statusBar"));
MainWindow->setStatusBar(statusBar);
toolBar = new QToolBar(MainWindow);
toolBar->setObjectName(QStringLiteral("toolBar"));
MainWindow->addToolBar(Qt::TopToolBarArea, toolBar);
retranslateUi(MainWindow);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
pushButton->setText(QApplication::translate("MainWindow", "Jogar", 0));
pushButton_2->setText(QApplication::translate("MainWindow", "Help", 0));
pushButton_3->setText(QApplication::translate("MainWindow", "quit", 0));
toolBar->setWindowTitle(QApplication::translate("MainWindow", "toolBar", 0));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H
|
/*:ts=8*/
/*****************************************************************************
* FIDOGATE --- Gateway UNIX Mail/News <-> FTN NetMail/EchoMail
*
*
* Function for handling FTN addresses
*
*****************************************************************************
* Copyright (C) 1990-2002
* _____ _____
* | |___ | Martin Junius <mj@fidogate.org>
* | | | | | | Radiumstr. 18
* |_|_|_|@home| D-51069 Koeln, Germany
*
* This file is part of FIDOGATE.
*
* FIDOGATE 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.
*
* FIDOGATE 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 FIDOGATE; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "fidogate.h"
/*
* Initialize FTNAddr
*/
void ftnaddr_init(FTNAddr * ftn)
{
ftn->name[0] = 0;
node_clear(&ftn->node);
}
/*
* Invalidate FTNAddr
*/
void ftnaddr_invalid(FTNAddr * ftn)
{
ftn->name[0] = 0;
node_invalid(&ftn->node);
}
/*
* Parse string, return FTNAddr
*
* Formats:
* User Name @ Z:N/F.P
* User Name (address = 0:0/0.0)
* User Name @ Z:N/F.P@DOMAIN
* (User Name @ DOMAIN#Z:N/F.P NOT YET IMPLEMENTED)
*/
FTNAddr ftnaddr_parse(char *s)
{
FTNAddr ftn;
char *d;
/* Delimiter is first '@' */
d = strchr(s, '@');
if (!d)
d = s + strlen(s);
/* Copy user name */
str_copy_range(ftn.name, sizeof(ftn.name), s, d);
strip_space(ftn.name);
/* Parse address */
if (*d == '@')
d++;
while (*d && is_space(*d))
d++;
if (*d) {
if (asc_to_node(d, &ftn.node, FALSE) == ERROR)
node_invalid(&ftn.node);
} else
node_clear(&ftn.node);
return ftn;
}
/*
* Output FTNAddr
*/
char *s_ftnaddr_print(FTNAddr * ftn)
{
return s_printf("%s @ %s", ftn->name, s_znfp_print(&ftn->node, FALSE));
}
#ifdef TEST /****************************************************************/
int main(int argc, char *argv[])
{
FTNAddr ftn;
/* Init configuration */
cf_initialize();
cf_read_config_file(DEFAULT_CONFIG_MAIN);
if (argc != 2) {
fprintf(stderr, "usage: ftnaddr 'user name @ Z:N/F.P'\n");
exit(1);
}
ftn = ftnaddr_parse(argv[1]);
printf("FTNAddr: %s\n", s_ftnaddr_print(&ftn));
tmps_freeall();
exit(0);
return 0;
}
#endif /**TEST***************************************************************/
|
/*
*** GlyphData Variable and Array
*** src/parser/glyphdata.h
Copyright T. Youngs 2007-2016
This file is part of Aten.
Aten is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Aten 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 Aten. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ATEN_GLYPHDATAVARIABLE_H
#define ATEN_GLYPHDATAVARIABLE_H
#include "parser/pvariable.h"
#include "parser/accessor.h"
ATEN_BEGIN_NAMESPACE
// Forward Declarations (Aten)
class GlyphData;
// Glyph Data Variable
class GlyphDataVariable : public PointerVariable
{
public:
// Constructor / Destructor
GlyphDataVariable(GlyphData* g = NULL, bool constant = false);
~GlyphDataVariable();
/*
* Access Data
*/
public:
// Accessor list
enum Accessors { Atom_Ptr, AtomData, Colour, Vector, nAccessors };
// Function list
enum Functions { DummyFunction, nFunctions };
// Search variable access list for provided accessor
StepNode* findAccessor(QString name, TreeNode* arrayIndex, TreeNode* argList = NULL);
// Static function to search accessors
static StepNode* accessorSearch(QString name, TreeNode* arrayIndex, TreeNode* argList = NULL);
// Retrieve desired value
static bool retrieveAccessor(int i, ReturnValue& rv, bool hasArrayIndex, int arrayIndex = -1);
// Set desired value
static bool setAccessor(int i, ReturnValue& sourcerv, ReturnValue& newValue, bool hasArrayIndex, int arrayIndex = -1);
// Perform desired function
static bool performFunction(int i, ReturnValue& rv, TreeNode* node);
// Accessor data
static Accessor accessorData[nAccessors];
// Function Accessor data
static FunctionAccessor functionData[nFunctions];
};
// Glyph Data Array Variable
class GlyphDataArrayVariable : public PointerArrayVariable
{
public:
// Constructor / Destructor
GlyphDataArrayVariable(TreeNode* sizeexpr, bool constant = false);
/*
* Inherited Virtuals
*/
public:
// Search variable access list for provided accessor
StepNode* findAccessor(QString name, TreeNode* arrayIndex, TreeNode* argList = NULL);
};
ATEN_END_NAMESPACE
#endif
|
#pragma once
#include "ogr_spatialref.h"
#include "ogr_srs_api.h"
enum GeoSystems{
GS_UTM,
GS_EPSG28992,
GS_EPSG4326,
GS_EPSG3857,
GS_MERCATOR,
};
class CGeoLoc
{
//attributes
public:
double m_xOffset;
double m_yOffset;
double m_orientation;
GeoSystems m_geoSystem;
double m_geoX;
double m_geoY;
double m_geoZ;
int m_geoZone;
int m_geoNorth;
private:
OGRSpatialReference m_offsetMercator;
OGRSpatialReference m_spatialRef;
public:
CGeoLoc(GeoSystems sys, double x, double y, double z, double or, int zone = 0, bool north = true);
CGeoLoc(void) {};
~CGeoLoc(void);
void ChangeSystem(GeoSystems sys);
void SetOffset(CGeoLoc *orgpos);
void ConvertDeltaToLatLon(int nr, double *x, double *y);
// void ChangePos(CGeoLoc *orgpos);
};
|
/*
* Copyright (C) 2005-2011 MaNGOS <http://www.getmangos.com/>
* Copyright (C) 2008-2011 WCloud <http://www.wcloudcore.org/>
* Copyright (C) 2010-2011 Project WCloud <http://www.projectwcloud.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
*/
#ifndef MPQFILE_H
#define MPQFILE_H
#include "headers.h"
class MPQFile
{
protected:
HANDLE handle;
bool eof;
char *buffer;
int pointer;
int size;
// disable copying
MPQFile(const MPQFile &f) {}
void operator=(const MPQFile &f) {}
public:
MPQFile(const char* filename, HANDLE handle); // filenames are not case sensitive
~MPQFile() { close(); }
size_t read(void* dest, size_t bytes);
size_t getSize() { return size; }
size_t getPos() { return pointer; }
char* getBuffer() { return buffer; }
char* getPointer() { return buffer + pointer; }
bool isEof() { return eof; }
void seek(int offset);
void seekRelative(int offset);
void close();
};
#endif
|
/*
* Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef MAILCOMMON_FILTERACTIONREDIRECT_H
#define MAILCOMMON_FILTERACTIONREDIRECT_H
#include "filteractionwithaddress.h"
namespace MailCommon {
//=============================================================================
// FilterActionRedirect - redirect to
// Redirect message to another user
//=============================================================================
class FilterActionRedirect: public FilterActionWithAddress
{
Q_OBJECT
public:
explicit FilterActionRedirect( QObject *parent = 0 );
ReturnCode process( ItemContext &context, bool applyOnOutbound ) const;
SearchRule::RequiredPart requiredPart() const;
static FilterAction* newAction();
QString sieveCode() const;
};
}
#endif
|
/* -*- c-file-style: "stroustrup"; indent-tabs-mode: nil; -*- */
#ifndef __HID_INTERN_H_INCLUDED__
#define __HID_INTERN_H_INCLUDED__
/* data for Input/Output/Feature */
#define IOF_CONSTANT (1<<0) /* 0: Data */
#define IOF_VARIABLE (1<<1) /* 0: Array */
#define IOF_RELATIVE (1<<2) /* 0: Absolute */
#define IOF_WRAP (1<<3) /* 0: No Wrap */
#define IOF_NONLINEAR (1<<4) /* 0: Linear */
#define IOF_NOPREFERRED (1<<5) /* 0: Preferred */
#define IOF_NULLSTATE (1<<6) /* 0: No Null position */
/* data for Output/Feature */
#define OF_VOLATIVE (1<<7) /* 0: Non Volatile */
#define OF_BUFFERED_BYTES (1<<8) /* 0: Bit Field */
/* data for Collection */
#define C_PHYSICAL 0x00
#define C_APPLICATION 0x01
#define C_LOGICAL 0x02
#define C_REPORT 0x03
#define C_NAMED_ARRAY 0x04
#define C_USAGE_SWITCH 0x05
#define C_USAGE_MODIFIER 0x06
#define _SIZE(size) (size == 4 ? 3 : size)
#define _ITEM(bTag, bType, bSize) (((bTag&15)<<4) | (bType<<2) | _SIZE(bSize))
#define _ITEM_MAIN(bTag, bSize) _ITEM(bTag, 0, bSize)
#define _ITEM_GLOBAL(bTag, bSize) _ITEM(bTag, 1, bSize)
#define _ITEM_LOCAL(bTag, bSize) _ITEM(bTag, 2, bSize)
/* Main Items */
#define M_INPUT(s) _ITEM_MAIN(8, s)
#define M_OUTPUT(s) _ITEM_MAIN(9, s)
#define M_FEATURE(s) _ITEM_MAIN(11, s)
#define M_COLLECTION(s) _ITEM_MAIN(10, s)
#define M_END_COLLECTION(s) _ITEM_MAIN(12, s)
/* Global Items */
#define G_USAGE_PAGE(s) _ITEM_GLOBAL(0, s)
#define G_LOGICAL_MINIMUM(s) _ITEM_GLOBAL(1, s)
#define G_LOGICAL_MAXIMUM(s) _ITEM_GLOBAL(2, s)
#define G_PHYSICAL_MINIMUM(s) _ITEM_GLOBAL(3, s)
#define G_PHYSICAL_MAXIMUM(s) _ITEM_GLOBAL(4, s)
#define G_UNIT_EXPONENT(s) _ITEM_GLOBAL(5, s)
#define G_UNIT(s) _ITEM_GLOBAL(6, s)
#define G_REPORT_SIZE(s) _ITEM_GLOBAL(7, s)
#define G_REPORT_ID(s) _ITEM_GLOBAL(8, s)
#define G_REPORT_COUNT(s) _ITEM_GLOBAL(9, s)
#define G_PUSH(s) _ITEM_GLOBAL(10, s)
#define G_POP(s) _ITEM_GLOBAL(11, s)
/* Local Items */
#define L_USAGE(s) _ITEM_LOCAL(0, s)
#define L_USAGE_MINIMUM(s) _ITEM_LOCAL(1, s)
#define L_USAGE_MAXIMUM(s) _ITEM_LOCAL(2, s)
#define L_DESIGNATOR_INDEX(s) _ITEM_LOCAL(3, s)
#define L_DESIGNATOR_MINIMUM(s) _ITEM_LOCAL(4, s)
#define L_DESIGNATOR_MAXIMUM(s) _ITEM_LOCAL(5, s)
#define L_STRING_INDEX(s) _ITEM_LOCAL(7, s)
#define L_STRING_MINIMUM(s) _ITEM_LOCAL(8, s)
#define L_STRING_MAXIMUM(s) _ITEM_LOCAL(9, s)
#define L_DELIMITER(s) _ITEM_LOCAL(10, s)
#endif
|
#include <stic.h>
#include <string.h>
#include "../../src/engine/cmds.h"
extern cmds_conf_t cmds_conf;
cmd_info_t user_cmd_info;
TEST(empty_ok)
{
const char cmd[] = "";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd);
assert_int_equal(0, len);
}
TEST(one_word_ok)
{
const char cmd[] = "a";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd);
assert_int_equal(1, len);
}
TEST(two_words_ok)
{
const char cmd[] = "b a";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd + 2);
assert_int_equal(1, len);
}
TEST(trailing_spaces_ok)
{
const char cmd[] = "a ";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd);
assert_int_equal(1, len);
}
TEST(single_quotes_ok)
{
const char cmd[] = "b 'hello'";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd + 3);
assert_int_equal(7, len);
}
TEST(double_quotes_ok)
{
const char cmd[] = "b \"hi\"";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd + 2);
assert_int_equal(4, len);
}
TEST(ending_space_ok)
{
const char cmd[] = "b a\\ ";
size_t len;
const char *last;
last = get_last_argument(cmd, &len);
assert_true(last == cmd + 2);
assert_int_equal(3, len);
}
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 : */
|
/**************************************************************************
Copyright (c) 2004-2014, Cray Inc. (See LICENSE file for more details)
**************************************************************************/
#ifndef _chpl_comm_locales_h_
#define _chpl_comm_locales_h_
#include "chpltypes.h"
//
// Returns the default number of locales to use for this comm layer if
// the user does not specify a number. For most comm layers, this
// should probably print a helpful error and exit rather than
// defaulting to anything. For comm layer "none" a default of 1
// locale makes sense which is why this routine exists. If the
// routine returns a value, that value needs to be consistent across
// multiple calls to the routine.
//
int64_t chpl_comm_default_num_locales(void);
//
// This routine allows a comm layer to screen the number of locales to
// be used. In particular, if a number exceeding some sort of maximum
// was provided, an error should be reported.
//
void chpl_comm_verify_num_locales(int64_t proposedNumLocales);
#endif
|
#define DRIVER_VERSION "SVN r201"
|
/*
Copyright (C) 2008 Paul Davis
Author: Sakari Bergen
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_export_format_manager_h__
#define __ardour_export_format_manager_h__
#include <list>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <sigc++/signal.h>
#include <sigc++/trackable.h>
#include <ardour/export_formats.h>
using std::string;
namespace ARDOUR
{
class ExportFormat;
class ExportFormatCompatibility;
class ExportFormatSpecification;
class AnyTime;
class ExportFormatManager : public sigc::trackable
{
public:
typedef boost::shared_ptr<ExportFormatCompatibility> CompatPtr;
typedef boost::weak_ptr<ExportFormatCompatibility> WeakCompatPtr;
typedef std::list<CompatPtr> CompatList;
typedef boost::shared_ptr<ExportFormat> FormatPtr;
typedef boost::weak_ptr<ExportFormat> WeakFormatPtr;
typedef std::list<FormatPtr> FormatList;
typedef HasSampleFormat::SampleFormatPtr SampleFormatPtr;
typedef HasSampleFormat::SampleFormatList SampleFormatList;
typedef HasSampleFormat::WeakSampleFormatPtr WeakSampleFormatPtr;
typedef HasSampleFormat::DitherTypePtr DitherTypePtr;
typedef HasSampleFormat::WeakDitherTypePtr WeakDitherTypePtr;
typedef boost::shared_ptr<ExportFormatSpecification> SpecPtr;
typedef boost::shared_ptr<ExportFormatBase> FormatBasePtr;
/* Quality states */
class QualityState : public ExportFormatBase::SelectableCompatible {
public:
QualityState (ExportFormatBase::Quality quality, Glib::ustring name) :
quality (quality) { set_name (name); }
ExportFormatBase::Quality quality;
};
typedef boost::shared_ptr<QualityState> QualityPtr;
typedef boost::weak_ptr<QualityState> WeakQualityPtr;
typedef std::list<QualityPtr> QualityList;
/* Sample rate states */
class SampleRateState : public ExportFormatBase::SelectableCompatible {
public:
SampleRateState (ExportFormatBase::SampleRate rate, Glib::ustring name) :
rate (rate) { set_name (name); }
ExportFormatBase::SampleRate rate;
};
typedef boost::shared_ptr<SampleRateState> SampleRatePtr;
typedef boost::weak_ptr<SampleRateState> WeakSampleRatePtr;
typedef std::list<SampleRatePtr> SampleRateList;
public:
explicit ExportFormatManager (SpecPtr specification);
~ExportFormatManager ();
/* Signals */
sigc::signal<void, bool> CompleteChanged;
/* Access to lists */
CompatList const & get_compatibilities () { return compatibilities; }
QualityList const & get_qualities () { return qualities; }
FormatList const & get_formats () { return formats; }
SampleRateList const & get_sample_rates () { return sample_rates; }
/* Non interactive selections */
void set_name (Glib::ustring name);
void select_src_quality (ExportFormatBase::SRCQuality value);
void select_trim_beginning (bool value);
void select_silence_beginning (AnyTime const & time);
void select_trim_end (bool value);
void select_silence_end (AnyTime const & time);
void select_normalize (bool value);
void select_normalize_target (float value);
void select_tagging (bool tag);
private:
void init_compatibilities ();
void init_qualities ();
void init_formats ();
void init_sample_rates ();
void add_compatibility (CompatPtr ptr);
void add_quality (QualityPtr ptr);
void add_format (FormatPtr ptr);
void add_sample_rate (SampleRatePtr ptr);
/* Connected to signals */
void change_compatibility_selection (bool select, WeakCompatPtr const & compat);
void change_quality_selection (bool select, WeakQualityPtr const & quality);
void change_format_selection (bool select, WeakFormatPtr const & format);
void change_sample_rate_selection (bool select, WeakSampleRatePtr const & rate);
void change_sample_format_selection (bool select, WeakSampleFormatPtr const & format);
void change_dither_type_selection (bool select, WeakDitherTypePtr const & type);
/* Do actual selection */
void select_compatibility (WeakCompatPtr const & compat);
void select_quality (QualityPtr const & quality);
void select_format (FormatPtr const & format);
void select_sample_rate (SampleRatePtr const & rate);
void select_sample_format (SampleFormatPtr const & format);
void select_dither_type (DitherTypePtr const & type);
bool pending_selection_change;
void selection_changed ();
/* Formats and compatibilities */
QualityPtr get_selected_quality ();
FormatPtr get_selected_format ();
SampleRatePtr get_selected_sample_rate ();
SampleFormatPtr get_selected_sample_format ();
FormatBasePtr get_compatibility_intersection ();
FormatBasePtr universal_set;
SpecPtr current_selection;
CompatList compatibilities;
QualityList qualities;
FormatList formats;
SampleRateList sample_rates;
};
} // namespace ARDOUR
#endif /* __ardour_export_format_manager_h__ */
|
/**********************************************************************
* Author: Cavium, Inc.
*
* Contact: support@cavium.com
* Please include "LiquidIO" in the subject.
*
* Copyright (c) 2003-2015 Cavium, Inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, Version 2, as
* published by the Free Software Foundation.
*
* This file is distributed in the hope that it will be useful, but
* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
* NONINFRINGEMENT. See the GNU General Public License for more
* details.
*
* This file may also be available under a different license from Cavium.
* Contact Cavium, Inc. for more information
**********************************************************************/
/*! \file octeon_main.h
* \brief Host Driver: This file is included by all host driver source files
* to include common definitions.
*/
#ifndef _OCTEON_MAIN_H_
#define _OCTEON_MAIN_H_
#if BITS_PER_LONG == 32
#define CVM_CAST64(v) ((long long)(v))
#elif BITS_PER_LONG == 64
#define CVM_CAST64(v) ((long long)(long)(v))
#else
#error "Unknown system architecture"
#endif
#define DRV_NAME "LiquidIO"
/**
* \brief determines if a given console has debug enabled.
* @param console console to check
* @returns 1 = enabled. 0 otherwise
*/
int octeon_console_debug_enabled(u32 console);
/* BQL-related functions */
void octeon_report_sent_bytes_to_bql(void *buf, int reqtype);
void octeon_update_tx_completion_counters(void *buf, int reqtype,
unsigned int *pkts_compl,
unsigned int *bytes_compl);
void octeon_report_tx_completion_to_bql(void *txq, unsigned int pkts_compl,
unsigned int bytes_compl);
/** Swap 8B blocks */
static inline void octeon_swap_8B_data(u64 *data, u32 blocks)
{
while (blocks) {
cpu_to_be64s(data);
blocks--;
data++;
}
}
/**
* \brief unmaps a PCI BAR
* @param oct Pointer to Octeon device
* @param baridx bar index
*/
static inline void octeon_unmap_pci_barx(struct octeon_device *oct, int baridx)
{
dev_dbg(&oct->pci_dev->dev, "Freeing PCI mapped regions for Bar%d\n",
baridx);
if (oct->mmio[baridx].done)
iounmap(oct->mmio[baridx].hw_addr);
if (oct->mmio[baridx].start)
pci_release_region(oct->pci_dev, baridx * 2);
}
/**
* \brief maps a PCI BAR
* @param oct Pointer to Octeon device
* @param baridx bar index
* @param max_map_len maximum length of mapped memory
*/
static inline int octeon_map_pci_barx(struct octeon_device *oct,
int baridx, int max_map_len)
{
u32 mapped_len = 0;
if (pci_request_region(oct->pci_dev, baridx * 2, DRV_NAME)) {
dev_err(&oct->pci_dev->dev, "pci_request_region failed for bar %d\n",
baridx);
return 1;
}
oct->mmio[baridx].start = pci_resource_start(oct->pci_dev, baridx * 2);
oct->mmio[baridx].len = pci_resource_len(oct->pci_dev, baridx * 2);
mapped_len = oct->mmio[baridx].len;
if (!mapped_len)
return 1;
if (max_map_len && (mapped_len > max_map_len))
mapped_len = max_map_len;
oct->mmio[baridx].hw_addr =
ioremap(oct->mmio[baridx].start, mapped_len);
oct->mmio[baridx].mapped_len = mapped_len;
dev_dbg(&oct->pci_dev->dev, "BAR%d start: 0x%llx mapped %u of %u bytes\n",
baridx, oct->mmio[baridx].start, mapped_len,
oct->mmio[baridx].len);
if (!oct->mmio[baridx].hw_addr) {
dev_err(&oct->pci_dev->dev, "error ioremap for bar %d\n",
baridx);
return 1;
}
oct->mmio[baridx].done = 1;
return 0;
}
static inline void *
cnnic_numa_alloc_aligned_dma(u32 size,
u32 *alloc_size,
size_t *orig_ptr,
int numa_node)
{
int retries = 0;
void *ptr = NULL;
#define OCTEON_MAX_ALLOC_RETRIES 1
do {
struct page *page = NULL;
page = alloc_pages_node(numa_node,
GFP_KERNEL,
get_order(size));
if (!page)
page = alloc_pages(GFP_KERNEL,
get_order(size));
ptr = (void *)page_address(page);
if ((unsigned long)ptr & 0x07) {
__free_pages(page, get_order(size));
ptr = NULL;
/* Increment the size required if the first
* attempt failed.
*/
if (!retries)
size += 7;
}
retries++;
} while ((retries <= OCTEON_MAX_ALLOC_RETRIES) && !ptr);
*alloc_size = size;
*orig_ptr = (unsigned long)ptr;
if ((unsigned long)ptr & 0x07)
ptr = (void *)(((unsigned long)ptr + 7) & ~(7UL));
return ptr;
}
#define cnnic_free_aligned_dma(pci_dev, ptr, size, orig_ptr, dma_addr) \
free_pages(orig_ptr, get_order(size))
static inline void
sleep_cond(wait_queue_head_t *wait_queue, int *condition)
{
wait_queue_t we;
init_waitqueue_entry(&we, current);
add_wait_queue(wait_queue, &we);
while (!(ACCESS_ONCE(*condition))) {
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current))
goto out;
schedule();
}
out:
set_current_state(TASK_RUNNING);
remove_wait_queue(wait_queue, &we);
}
static inline void
sleep_atomic_cond(wait_queue_head_t *waitq, atomic_t *pcond)
{
wait_queue_t we;
init_waitqueue_entry(&we, current);
add_wait_queue(waitq, &we);
while (!atomic_read(pcond)) {
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current))
goto out;
schedule();
}
out:
set_current_state(TASK_RUNNING);
remove_wait_queue(waitq, &we);
}
/* Gives up the CPU for a timeout period.
* Check that the condition is not true before we go to sleep for a
* timeout period.
*/
static inline void
sleep_timeout_cond(wait_queue_head_t *wait_queue,
int *condition,
int timeout)
{
wait_queue_t we;
init_waitqueue_entry(&we, current);
add_wait_queue(wait_queue, &we);
set_current_state(TASK_INTERRUPTIBLE);
if (!(*condition))
schedule_timeout(timeout);
set_current_state(TASK_RUNNING);
remove_wait_queue(wait_queue, &we);
}
#ifndef ROUNDUP4
#define ROUNDUP4(val) (((val) + 3) & 0xfffffffc)
#endif
#ifndef ROUNDUP8
#define ROUNDUP8(val) (((val) + 7) & 0xfffffff8)
#endif
#ifndef ROUNDUP16
#define ROUNDUP16(val) (((val) + 15) & 0xfffffff0)
#endif
#ifndef ROUNDUP128
#define ROUNDUP128(val) (((val) + 127) & 0xffffff80)
#endif
#endif /* _OCTEON_MAIN_H_ */
|
/* Author: G. Jungman
*/
#include <config.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_qrng.h>
#include <gsl/gsl_test.h>
void test_sobol(void)
{
int status = 0;
double v[3];
/* int i; */
/* test in dimension 2 */
gsl_qrng * g = gsl_qrng_alloc(gsl_qrng_sobol, 2);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.25 || v[1] != 0.75 );
gsl_qrng_get(g, v);
status += ( v[0] != 0.375 || v[1] != 0.375 );
gsl_qrng_free(g);
gsl_test (status, "Sobol d=2");
status = 0;
/* test in dimension 3 */
g = gsl_qrng_alloc(gsl_qrng_sobol, 3);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.25 || v[1] != 0.75 || v[2] != 0.25 );
gsl_qrng_get(g, v);
status += ( v[0] != 0.375 || v[1] != 0.375 || v[2] != 0.625 );
gsl_test (status, "Sobol d=3");
status = 0;
gsl_qrng_init(g);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.25 || v[1] != 0.75 || v[2] != 0.25 );
gsl_qrng_get(g, v);
status += ( v[0] != 0.375 || v[1] != 0.375 || v[2] != 0.625 );
gsl_qrng_free(g);
gsl_test (status, "Sobol d=3 (reinitialized)");
}
void test_nied2(void)
{
int status = 0;
double v[3];
/* int i; */
/* test in dimension 2 */
gsl_qrng * g = gsl_qrng_alloc(gsl_qrng_niederreiter_2, 2);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.75 || v[1] != 0.25 );
gsl_qrng_get(g, v);
status += ( v[0] != 0.25 || v[1] != 0.75 );
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.625 || v[1] != 0.125 );
gsl_qrng_free(g);
gsl_test (status, "Niederreiter d=2");
status = 0;
/* test in dimension 3 */
g = gsl_qrng_alloc(gsl_qrng_niederreiter_2, 3);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.75 || v[1] != 0.25 || v[2] != 0.3125 );
gsl_qrng_get(g, v);
status += ( v[0] != 0.25 || v[1] != 0.75 || v[2] != 0.5625 );
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.625 || v[1] != 0.125 || v[2] != 0.6875 );
gsl_test (status, "Niederreiter d=3");
status = 0;
gsl_qrng_init(g);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.75 || v[1] != 0.25 || v[2] != 0.3125 );
gsl_qrng_get(g, v);
status += ( v[0] != 0.25 || v[1] != 0.75 || v[2] != 0.5625 );
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
gsl_qrng_get(g, v);
status += ( v[0] != 0.625 || v[1] != 0.125 || v[2] != 0.6875 );
gsl_qrng_free(g);
gsl_test (status, "Niederreiter d=3 (reinitialized)");
}
int main()
{
gsl_ieee_env_setup ();
test_sobol();
test_nied2();
exit (gsl_test_summary ());
}
|
/*=============================================================================
LibPlot2D
Copyright Kerry R. Loux 2011-2016
This code is licensed under the GPLv2 License
(http://opensource.org/licenses/GPL-2.0).
=============================================================================*/
// File: textInputDialog.h
// Date: 5/20/2013
// Auth: K. Loux
// Desc: Dialog box similar to ::wxGetTextFromUser() but allows
// differentiation between canceling and returning an empty string.
#ifndef TEXT_INPUT_DIALOG_H_
#define TEXT_INPUT_DIALOG_H_
// wxWidgets headers
#include <wx/dialog.h>
namespace LibPlot2D
{
/// Dialog box similar to wxGetTextFromUser(), but allows differentiation
/// between canceling and returning an empty string.
class TextInputDialog : public wxDialog
{
public:
/// Constructor.
///
/// \param message Text to display.
/// \param title Text to display in title bar.
/// \param defaultText Initial value of string in input text box.
/// \param parent Pointer to window that owns this.
TextInputDialog(const wxString &message, const wxString &title,
const wxString &defaultText, wxWindow *parent);
~TextInputDialog() = default;
/// Gets the contents of the input text box.
/// \returns The contents of the input text box.
wxString GetText() const { return mText->GetValue(); }
private:
wxTextCtrl *mText;
void CreateControls(const wxString &message, const wxString &defaultText);
};
}// namespace LibPlot2D
#endif// TEXT_INPUT_DIALOG_H_
|
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
typedef struct NameValue NV;
struct NameValue
{
NV *next;
char *name;
char *value;
};
struct Link
{
char *url;
NV *namevaluelist;
};
extern char * stristr(char * pszSource, const char * pcszSearchconst);
extern void formlink(char *url,struct Link *inputlink);
extern char * parse_html(char *page,struct Link *readlink);
extern char * comparelink(struct Link *inputlink,struct Link *readlink);
extern void freelink(NV *current);
|
// -*- mode: c++; c-basic-offset: 4; c-basic-style: bsd; -*-
/*
* This program is free software; you can redistribute it and/or
* modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 3.0 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* This file is part of the Open-HMI Tester,
* http://openhmitester.sourceforge.net
*
*/
#ifndef PRELOADCONTROLLER_H
#define PRELOADCONTROLLER_H
#include <LibPreload_global.h>
#include <preloadingcontrol.h>
#include <comm.h>
#include <controlsignaling.h>
#include <eventconsumer.h>
#include <eventexecutor.h>
#include <QObject>
class LIBPRELOADSHARED_EXPORT PreloadController : public QObject
{
Q_OBJECT
public:
//process state
typedef enum
{
STOP,
RECORD,
PLAY,
PAUSE_PLAY,
PAUSE_RECORD
} ProcessState;
///process state
ProcessState state() const;
public:
PreloadController(PreloadingControl*pc, EventConsumer *ec, EventExecutor *ex);
~PreloadController();
///init method
bool initialize();
public slots:
//input method (comm signal handle)
void handleReceivedTestItem (DataModel::TestItem*);
//input method (control signaling)
void handleReceivedControl (Control::ControlTestItem*);
signals:
//output method (signal to comm)
void sendTestItem(const DataModel::TestItem&);
private:
///
///processes control
///
void capture_start();
void capture_pause();
void capture_stop();
void execution_start();
void execution_pause();
void execution_stop();
ProcessState state_;
private:
Comm* _comm;
EventConsumer* _ev_consumer;
EventExecutor* _ev_executor;
};
#endif // PRELOADCONTROLLER_H
|
/*********************************************************************
* webcam_server *
* *
* (c) 2002 Donn Morrison donn@donn.dyndns.org *
* *
* code used from Gerd Knorr's xawtv (libng) *
* - and - *
* Cory Lueninghoener's gqcam *
* *
* waits for connections from a viewer and sends *
* jpeg encoded captures as a live video feed *
* *
*********************************************************************/
#ifndef _CAMERA_H_INCLUDED_
#define _CAMERA_H_INCLUDED_
int open_cam(struct caminfo *cam, char *devfile);
int close_cam(struct caminfo *cam);
int set_cam_info(struct caminfo *cam);
void get_cam_info(struct caminfo *cam);
struct image *get_cam_image(struct caminfo *cam);
#endif
|
#ifndef __SETTINGS_DIALOG_H__
#define __SETTINGS_DIALOG_H__
////////////////////////////////////////////////////////////////////////////////
//
// Class Name : KFI::CSettingsDialog
// Author : Craig Drummond
// Project : K Font Installer
// Creation Date : 10/05/2005
// Version : $Revision$ $Date$
//
////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
////////////////////////////////////////////////////////////////////////////////
// (C) Craig Drummond, 2005
////////////////////////////////////////////////////////////////////////////////
#include <kdialogbase.h>
class QCheckBox;
namespace KFI
{
class CSettingsDialog : public KDialogBase
{
public:
CSettingsDialog(QWidget *parent);
private slots:
void slotOk();
private:
QCheckBox *itsDoX,
*itsDoGs;
};
}
#endif
|
#ifndef PLAYLISTMODEL_H
#define PLAYLISTMODEL_H
#include <QAbstractListModel>
#include <QAudioDecoder>
#include <QAudioDeviceInfo>
#include <QDebug>
#include <QUrl>
class song {
public:
explicit song(QUrl path, QString title, QString author);
QString getauthor() const;
QString gettitle() const;
QUrl getpath() const;
void setauthor(QString author);
void settitle(QString title);
private:
QString m_author, m_title;
QUrl m_path;
};
class playListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit playListModel(QObject *parent = 0);
int currentIndex() const;
int rowCount(const QModelIndex & parent = QModelIndex()) const;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
Q_INVOKABLE int randomIndex();
Q_INVOKABLE QString getcurrentTitle() const;
Q_INVOKABLE QUrl getcurrentPath() const;
Q_INVOKABLE void add(QList<QUrl> paths);
Q_INVOKABLE void move(int from, int to);
Q_INVOKABLE void remove(int first, int last);
Q_INVOKABLE void setCurrentTitle(QString title);
Q_INVOKABLE void setCurrentAuthor(QString author);
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
void setCurrentIndex(const int & i);
enum songRole {
pathRole = Qt::UserRole + 1,
titleRole,
authorRole,
};
signals:
void currentIndexChanged();
public slots:
private:
QHash<int, QByteArray> roleNames() const;
void addSong(QUrl path, QString title, QString author);
int m_currentIndex;
QList<song> playListData;
};
#endif // PLAYLISTMODEL_H
|
/*
* Copyright (C) Christian Kaiser
*
* 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef OS_H_
#define OS_H_
#include <QWidget>
class QPixmap;
class QPoint;
class QString;
class QUrl;
class QGraphicsEffect;
class QIcon;
#if defined(Q_OS_LINUX)
typedef unsigned long XID;
typedef XID Window;
#endif
namespace os {
// Returns the cursor pixmap in Windows
QPair<QPixmap, QPoint> cursor();
// A QTimeLine based effect for a slot (TODO: look at the new effect classes)
void effect(QObject *target, const char *slot, int frames, int duration = 400, const char *cleanup = 0);
// Returns the current users's Documents/My Documents folder
QString getDocumentsPath();
// Returns the pixmap of the given window id.
QPixmap grabWindow(WId winId);
// Set the target window as the foreground window (Windows only)
void setForegroundWindow(QWidget *window);
// Adds lightscreen to the startup list in Windows & Linux (KDE, Gnome and Xfce for now).
void setStartup(bool startup, bool hide);
// Creates a new QGraphicsDropShadowEffect to apply to widgets.
QGraphicsEffect *shadow(const QColor &color = Qt::black, int blurRadius = 6, int offset = 1);
// Returns a QIcon for the given icon name (taking into account color schemes and whatnot).
QIcon icon(const QString &name, QColor backgroundColor = QColor());
// X11-specific functions for the Window Picker
#if defined(Q_OS_LINUX)
Window findRealWindow(Window w, int depth = 0);
Window windowUnderCursor(bool includeDecorations = true);
#endif
}
// qAsConst backport
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
namespace QtPrivate {
template <typename T> struct QAddConst { typedef const T Type; };
}
// this adds const to non-const objects (like std::as_const)
template <typename T>
Q_DECL_CONSTEXPR typename QtPrivate::QAddConst<T>::Type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
// prevent rvalue arguments:
template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif
#endif /*OS_H_*/
|
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_FFMPEGVIDDEC_H__
#define __GST_FFMPEGVIDDEC_H__
G_BEGIN_DECLS
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideodecoder.h>
#include <libavcodec/avcodec.h>
typedef struct _GstFFMpegVidDec GstFFMpegVidDec;
struct _GstFFMpegVidDec
{
GstVideoDecoder parent;
GstVideoCodecState *input_state;
GstVideoCodecState *output_state;
/* decoding */
AVCodecContext *context;
AVFrame *picture;
gint stride[AV_NUM_DATA_POINTERS];
gboolean opened;
/* current output pictures */
enum PixelFormat pic_pix_fmt;
gint pic_width;
gint pic_height;
gint pic_par_n;
gint pic_par_d;
gint pic_interlaced;
/* current context */
gint ctx_ticks;
gint ctx_time_d;
gint ctx_time_n;
GstBuffer *palette;
guint8 *padded;
guint padded_size;
gboolean current_dr; /* if direct rendering is enabled */
/* some properties */
enum AVDiscard skip_frame;
gint lowres;
gboolean direct_rendering;
gboolean debug_mv;
int max_threads;
gboolean output_corrupt;
gboolean is_realvideo;
GstCaps *last_caps;
};
typedef struct _GstFFMpegVidDecClass GstFFMpegVidDecClass;
struct _GstFFMpegVidDecClass
{
GstVideoDecoderClass parent_class;
AVCodec *in_plugin;
};
#define GST_TYPE_FFMPEGDEC \
(gst_ffmpegviddec_get_type())
#define GST_FFMPEGDEC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegVidDec))
#define GST_FFMPEGVIDDEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegVidDecClass))
#define GST_IS_FFMPEGDEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
#define GST_IS_FFMPEGVIDDEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
G_END_DECLS
#endif
|
/*
* Copyright (C) 2010 Gautier Hattenberger
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/** @file sonar_adc.h
* @brief simple driver to deal with one sonar sensor on ADC
*/
#ifndef SONAR_ADC_H
#define SONAR_ADC_H
#include "std.h"
struct SonarAdc
{
uint16_t meas; ///< Raw ADC value
uint16_t offset; ///< Sonar offset in ADC units
float distance; ///< Distance measured in meters
};
extern struct SonarAdc sonar_adc;
extern void sonar_adc_init(void);
extern void sonar_adc_read(void);
#endif
|
// 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_AUTOFILL_AUTOFILL_IE_TOOLBAR_IMPORT_WIN_H_
#define CHROME_BROWSER_AUTOFILL_AUTOFILL_IE_TOOLBAR_IMPORT_WIN_H_
class PersonalDataManager;
bool ImportAutofillDataWin(PersonalDataManager* pdm);
#endif
|
// Copyright (c) 1999
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); 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 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: https://github.com/CGAL/cgal/blob/releases/CGAL-4.14.1/Kernel_23/include/CGAL/Triangle_2.h $
// $Id: Triangle_2.h 0698f79 %aI Sébastien Loriot
// SPDX-License-Identifier: LGPL-3.0+
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_TRIANGLE_2_H
#define CGAL_TRIANGLE_2_H
#include <CGAL/assertions.h>
#include <boost/type_traits/is_same.hpp>
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
template <class R_>
class Triangle_2 : public R_::Kernel_base::Triangle_2
{
typedef typename R_::Point_2 Point_2;
typedef typename R_::Aff_transformation_2 Aff_transformation_2;
typedef typename R_::Kernel_base::Triangle_2 RTriangle_2;
typedef Triangle_2 Self;
CGAL_static_assertion((boost::is_same<Self, typename R_::Triangle_2>::value));
public:
typedef Dimension_tag<2> Ambient_dimension;
typedef Dimension_tag<2> Feature_dimension;
typedef RTriangle_2 Rep;
const Rep& rep() const
{
return *this;
}
Rep& rep()
{
return *this;
}
typedef R_ R;
typedef typename R::FT FT;
Triangle_2() {}
Triangle_2(const RTriangle_2& t)
: RTriangle_2(t) {}
Triangle_2(const Point_2 &p, const Point_2 &q, const Point_2 &r)
: RTriangle_2(typename R::Construct_triangle_2()(Return_base_tag(), p,q,r)) {}
FT
area() const
{
return R().compute_area_2_object()(vertex(0), vertex(1), vertex(2));
}
typename R::Orientation
orientation() const
{
return R().orientation_2_object()(vertex(0), vertex(1), vertex(2));
}
typename R::Bounded_side
bounded_side(const Point_2 &p) const
{
return R().bounded_side_2_object()(*this,p);
}
typename R::Oriented_side
oriented_side(const Point_2 &p) const
{
return R().oriented_side_2_object()(*this,p);
}
typename R::Boolean
operator==(const Triangle_2 &t) const
{
return R().equal_2_object()(*this,t);
}
typename R::Boolean
operator!=(const Triangle_2 &t) const
{
return !(*this == t);
}
typename cpp11::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type
vertex(int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename cpp11::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type
operator[](int i) const
{
return vertex(i);
}
typename R::Boolean
has_on_bounded_side(const Point_2 &p) const
{
return bounded_side(p) == ON_BOUNDED_SIDE;
}
typename R::Boolean
has_on_unbounded_side(const Point_2 &p) const
{
return bounded_side(p) == ON_UNBOUNDED_SIDE;
}
typename R::Boolean
has_on_boundary(const Point_2 &p) const
{
return bounded_side(p) == ON_BOUNDARY;
}
typename R::Boolean
has_on_negative_side(const Point_2 &p) const
{
return oriented_side(p) == ON_NEGATIVE_SIDE;
}
typename R::Boolean
has_on_positive_side(const Point_2 &p) const
{
return oriented_side(p) == ON_POSITIVE_SIDE;
}
typename R::Boolean
is_degenerate() const
{
return R().collinear_2_object()(vertex(0), vertex(1), vertex(2));
}
Bbox_2
bbox() const
{
return R().construct_bbox_2_object()(*this);
}
Triangle_2
opposite() const
{
return R().construct_opposite_triangle_2_object()(*this);
}
Triangle_2
transform(const Aff_transformation_2 &t) const
{
return Triangle_2(t.transform(vertex(0)),
t.transform(vertex(1)),
t.transform(vertex(2)));
}
};
template < class R >
std::ostream &
operator<<(std::ostream &os, const Triangle_2<R> &t)
{
switch(get_mode(os)) {
case IO::ASCII :
return os << t[0] << ' ' << t[1] << ' ' << t[2];
case IO::BINARY :
return os << t[0] << t[1] << t[2];
default:
return os<< "Triangle_2(" << t[0] << ", "
<< t[1] << ", " << t[2] <<")";
}
}
template < class R >
std::istream &
operator>>(std::istream &is, Triangle_2<R> &t)
{
typename R::Point_2 p, q, r;
is >> p >> q >> r;
if (is)
t = Triangle_2<R>(p, q, r);
return is;
}
} //namespace CGAL
#endif // CGAL_TRIANGLE_2_H
|
/*
* Copyright (c) Bull S.A. 2007 All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* History:
* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
#define VERSNUM 1
//Set number of test call
int maxIter;
double average(double *tbl)
{
//Return average of values in tbl
int i;
double rslt = 0;
for (i = 0; i < maxIter; i++)
{
rslt += tbl[i];
}
rslt = rslt / maxIter;
return rslt;
}
double mini(double *tbl)
{
//Return minimal of values in tbl
int i;
double rslt = tbl[0];
for (i = 0; i < maxIter; i++)
{
if (rslt > tbl[i])
rslt = tbl[i];
}
return rslt;
}
double maxi(double *tbl)
{
//Return maximal of values in tbl
int i;
double rslt = tbl[0];
for (i = 0; i < maxIter; i++)
{
if (rslt < tbl[i])
rslt = tbl[i];
}
return rslt;
}
int main(int argn, char *argc[])
{
//Program parameters : argc[1] : HostName or Host IP
// argc[2] : Server Program Number
// argc[3] : Number of test call
// other arguments depend on test case
//run_mode can switch into stand alone program or program launch by shell script
//1 : stand alone, debug mode, more screen information
//0 : launch by shell script as test case, only one printf -> result status
int run_mode = 0;
int test_status = 0; //Default test result set to FAILED
int i;
double *resultTbl;
struct timeval tv1,tv2;
struct timezone tz;
long long diff;
double rslt;
int sock = 600;
SVCXPRT *svcr = NULL;
//Test initialisation
maxIter = atoi(argc[3]);
resultTbl = (double *)malloc(maxIter * sizeof(double));
sock = socket(AF_UNIX, SOCK_DGRAM, IPPROTO_TCP);
//Call tested function several times
for (i = 0; i < maxIter; i++)
{
//Tic
gettimeofday(&tv1, &tz);
//Call function
svcr = svctcp_create(sock, 0, 0);
//Toc
gettimeofday(&tv2, &tz);
//Add function execution time (toc-tic)
diff = (tv2.tv_sec-tv1.tv_sec) * 1000000L + (tv2.tv_usec-tv1.tv_usec);
rslt = (double)diff / 1000;
if (svcr != NULL)
{
resultTbl[i] = rslt;
}
else
{
test_status = 1;
}
if (run_mode)
{
fprintf(stderr, "lf time = %lf usecn\n", resultTbl[i]);
}
}
//This last printf gives the result status to the tests suite
//normally should be 0: test has passed or 1: test has failed
printf("%d\n", test_status);
printf("%lf %d\n", average(resultTbl), maxIter);
printf("%lf\n", mini(resultTbl));
printf("%lf\n", maxi(resultTbl));
return test_status;
}
|
#pragma once
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <nschimme@gmail.com> (Jahara)
#include <cstdint>
#include "../global/utils.h"
#include "../mapdata/ExitDirection.h"
enum class NODISCARD DirectSunlightEnum : uint32_t {
UNKNOWN = 0,
SAW_DIRECT_SUN = 1,
SAW_NO_DIRECT_SUN = 2,
};
NODISCARD constexpr inline auto toUint(const DirectSunlightEnum val) noexcept
{
using U = uint32_t;
static_assert(std::is_same_v<U, std::underlying_type_t<DirectSunlightEnum>>);
return static_cast<U>(val);
}
NODISCARD inline constexpr DirectSunlightEnum operator&(const DirectSunlightEnum lhs,
const DirectSunlightEnum rhs)
{
return static_cast<DirectSunlightEnum>(toUint(lhs) & toUint(rhs));
}
static constexpr const auto SAW_ANY_DIRECT_SUNLIGHT = 0b10101010101u;
static constexpr const auto CONNECTED_ROOM_FLAGS_VALID = 1u << 14;
static constexpr const auto CONNECTED_ROOM_FLAGS_TROLL_MODE = 1u << 15;
// every other bit for all 6 directions.
static_assert(SAW_ANY_DIRECT_SUNLIGHT == ((1u << (2 * 6)) - 1u) / 3u);
static_assert(utils::isPowerOfTwo(CONNECTED_ROOM_FLAGS_VALID));
static_assert(CONNECTED_ROOM_FLAGS_VALID > SAW_ANY_DIRECT_SUNLIGHT);
class NODISCARD ConnectedRoomFlagsType final
{
private:
uint32_t m_flags = 0;
public:
ConnectedRoomFlagsType() = default;
public:
NODISCARD bool operator==(const ConnectedRoomFlagsType rhs) const
{
return m_flags == rhs.m_flags;
}
NODISCARD bool operator!=(const ConnectedRoomFlagsType rhs) const
{
return m_flags != rhs.m_flags;
}
public:
NODISCARD bool isValid() const { return (m_flags & CONNECTED_ROOM_FLAGS_VALID) != 0u; }
void setValid() { m_flags |= CONNECTED_ROOM_FLAGS_VALID; }
public:
NODISCARD bool hasAnyDirectSunlight() const
{
return (m_flags & SAW_ANY_DIRECT_SUNLIGHT) != 0u;
}
public:
NODISCARD bool isTrollMode() const { return (m_flags & CONNECTED_ROOM_FLAGS_TROLL_MODE) != 0u; }
void setTrollMode() { m_flags |= CONNECTED_ROOM_FLAGS_TROLL_MODE; }
public:
void reset() { *this = ConnectedRoomFlagsType(); }
private:
static constexpr const auto MASK = static_cast<std::underlying_type_t<DirectSunlightEnum>>(
toUint(DirectSunlightEnum::SAW_DIRECT_SUN) | toUint(DirectSunlightEnum::SAW_NO_DIRECT_SUN));
NODISCARD static int getShift(const ExitDirEnum dir) { return static_cast<int>(dir) * 2; }
NODISCARD DirectSunlightEnum getDirectSunlight(const ExitDirEnum dir) const
{
const auto shift = getShift(dir);
return static_cast<DirectSunlightEnum>((m_flags >> shift) & MASK);
}
public:
void setDirectSunlight(const ExitDirEnum dir, const DirectSunlightEnum light)
{
const auto shift = getShift(dir);
m_flags &= ~(MASK << shift);
m_flags |= (toUint(light) & MASK) << shift;
}
NODISCARD bool hasNoDirectSunlight(const ExitDirEnum dir) const
{
return getDirectSunlight(dir) == DirectSunlightEnum::SAW_NO_DIRECT_SUN;
}
NODISCARD bool hasDirectSunlight(const ExitDirEnum dir) const
{
return getDirectSunlight(dir) == DirectSunlightEnum::SAW_DIRECT_SUN;
}
};
|
/**********************************************************************************
This file is part of the game 'KTron'
Copyright (C) 1998-2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
Copyright (C) 2005 Benjamin C. Meyer <ben at meyerhome dot net>
Copyright (C) 2008-2009 Stas Verberkt <legolas at legolasweb dot nl>
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 RENDERER_H
#define RENDERER_H
#include "playfield.h"
#include <QPainter>
#include <QString>
#include <QSize>
class QPixmap;
class RendererPrivate;
class Renderer {
private:
Renderer();
Renderer(const Renderer &);
~Renderer();
public:
static Renderer *self();
bool loadTheme(const QString &);
void boardResized(int width, int height, int partWidth, int partHeight);
int calculateOffsetX(int x);
int calculateOffsetY(int y);
QPixmap getPart(QString partName);
QPixmap getPartOfSize(QString partName, QSize &partSize);
QPixmap background();
QPixmap messageBox(QString &message);
void resetPlayField();
void drawPart(QPainter & painter, int x, int y, QString svgName);
void updatePlayField(PlayField &playfield);
QPixmap *getPlayField();
QPixmap pixmapFromCache(RendererPrivate *p, const QString &svgName, const QSize &size);
private:
RendererPrivate *p;
};
#endif // RENDERER_H
|
/*
* lifi-spectrum-error-model.h
*
* Created on: 2014年4月10日
* Author: pp
*/
#ifndef LIFI_SPECTRUM_ERROR_MODEL_H_
#define LIFI_SPECTRUM_ERROR_MODEL_H_
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/spectrum-value.h"
#include "ns3/spectrum-signal-parameters.h"
namespace ns3 {
class LifiSpectrumErrorModel: public Object {
public:
LifiSpectrumErrorModel();
virtual ~LifiSpectrumErrorModel();
static TypeId GetTypeId();
void StartRx (Ptr<const PacketBurst> p);
void EvaluateChunk (const SpectrumValue& sinr, Time duration);
bool IsRxCorrect ();
private:
uint32_t m_bytes;
uint32_t m_deliverableBytes;
};
} /* namespace ns3 */
#endif /* LIFI_SPECTRUM_ERROR_MODEL_H_ */
|
/****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
#ifndef SPLATRENDERERPLUGIN_H
#define SPLATRENDERERPLUGIN_H
#include <QObject>
#include <common//interfaces.h>
#include <wrap/gl/splatting_apss/splatrenderer.h>
class QGLFramebufferObject;
class SplatRendererPlugin : public QObject, public MeshRenderInterface
{
Q_OBJECT
Q_INTERFACES(MeshRenderInterface)
SplatRenderer<CMeshO> splat_renderer;
QList <QAction *> actionList;
public:
SplatRendererPlugin();
QList<QAction *> actions ()
{
if(actionList.isEmpty()) initActionList();
return actionList;
}
void initActionList();
bool isSupported() {return splat_renderer.isSupported();}
void Init(QAction *a, MeshDocument &m, RenderMode &rm, QGLWidget *gla);
void Render(QAction *a, MeshDocument &m, RenderMode &rm, QGLWidget *gla);
void Finalize(QAction * /*mode*/, MeshDocument */*m*/, GLArea * /*parent*/) ;
};
#endif
|
/***************************************************************************
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#if !defined(SMARTDIALOGWIDGET__H)
#define SMARTDIALOGWIDGET__H
#include "ui_smartdialogwidgetbase.h"
class QStyledItemDelegate;
class QPoint;
/** Central widget in the SmartDialogWidget
@author Volker Lanz <vl@fidra.de>
*/
class SmartDialogWidget : public QWidget, public Ui::SmartDialogWidgetBase
{
Q_OBJECT
public:
SmartDialogWidget(QWidget* parent);
~SmartDialogWidget();
public:
QLabel& statusText() { Q_ASSERT(m_LabelSmartStatusText); return *m_LabelSmartStatusText; }
QLabel& statusIcon() { Q_ASSERT(m_LabelSmartStatusIcon); return *m_LabelSmartStatusIcon; }
QLabel& modelName() { Q_ASSERT(m_LabelSmartModelName); return *m_LabelSmartModelName; }
QLabel& firmware() { Q_ASSERT(m_LabelSmartFirmware); return *m_LabelSmartFirmware; }
QLabel& serialNumber() { Q_ASSERT(m_LabelSmartSerialNumber); return *m_LabelSmartSerialNumber; }
QLabel& temperature() { Q_ASSERT(m_LabelSmartTemperature); return *m_LabelSmartTemperature; }
QLabel& badSectors() { Q_ASSERT(m_LabelSmartBadSectors); return *m_LabelSmartBadSectors; }
QLabel& poweredOn() { Q_ASSERT(m_LabelSmartPoweredOn); return *m_LabelSmartPoweredOn; }
QLabel& powerCycles() { Q_ASSERT(m_LabelSmartPowerCycles); return *m_LabelSmartPowerCycles; }
QLabel& selfTests() { Q_ASSERT(m_LabelSmartSelfTests); return *m_LabelSmartSelfTests; }
QLabel& overallAssessment() { Q_ASSERT(m_LabelSmartOverallAssessment); return *m_LabelSmartOverallAssessment; }
QTreeWidget& treeSmartAttributes() { Q_ASSERT(m_TreeSmartAttributes); return *m_TreeSmartAttributes; }
const QTreeWidget& treeSmartAttributes() const { Q_ASSERT(m_TreeSmartAttributes); return *m_TreeSmartAttributes; }
protected:
void setupConnections();
void loadConfig();
void saveConfig() const;
protected Q_SLOTS:
void onHeaderContextMenu(const QPoint& p);
private:
QStyledItemDelegate* m_SmartAttrDelegate;
};
#endif
|
/* packet-rgmp.c
* Routines for IGMP/RGMP packet disassembly
* Copyright 2006 Jaap Keuter
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*/
/*
Based on RFC3488
This is a setup for RGMP dissection, a simple protocol bolted on IGMP.
The trick is to have IGMP dissector call this function (which by itself is not
registered as dissector). IGAP and other do the same.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <glib.h>
#include <epan/packet.h>
#include <epan/strutil.h>
#include "packet-igmp.h"
#include "packet-rgmp.h"
static int proto_rgmp = -1;
static int hf_type = -1;
static int hf_checksum = -1;
static int hf_checksum_bad = -1;
static int hf_maddr = -1;
static int ett_rgmp = -1;
static const value_string rgmp_types[] = {
{IGMP_RGMP_LEAVE, "Leave"},
{IGMP_RGMP_JOIN, "Join"},
{IGMP_RGMP_BYE, "Bye"},
{IGMP_RGMP_HELLO, "Hello"},
{0, NULL}
};
/* This function is only called from the IGMP dissector */
int
dissect_rgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
{
proto_tree *tree;
proto_item *item;
guint8 type;
if (!proto_is_protocol_enabled(find_protocol_by_id(proto_rgmp))) {
/* we are not enabled, skip entire packet to be nice
to the igmp layer. (so clicking on IGMP will display the data)
*/
return offset + tvb_length_remaining(tvb, offset);
}
item = proto_tree_add_item(parent_tree, proto_rgmp, tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_rgmp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RGMP");
col_clear(pinfo->cinfo, COL_INFO);
type = tvb_get_guint8(tvb, offset);
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(type, rgmp_types, "Unknown Type: 0x%02x"));
}
proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);
offset += 1;
/* reserved */
offset += 1;
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);
offset += 2;
proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, FALSE);
offset += 4;
return offset;
}
void
proto_register_rgmp(void)
{
static hf_register_info hf[] = {
{ &hf_type,
{ "Type", "rgmp.type", FT_UINT8, BASE_HEX,
VALS(rgmp_types), 0, "RGMP Packet Type", HFILL }
},
{ &hf_checksum,
{ "Checksum", "rgmp.checksum", FT_UINT16, BASE_HEX,
NULL, 0, NULL, HFILL }
},
{ &hf_checksum_bad,
{ "Bad Checksum", "rgmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_maddr,
{ "Multicast group address", "rgmp.maddr", FT_IPv4, BASE_NONE,
NULL, 0, NULL, HFILL }
}
};
static gint *ett[] = {
&ett_rgmp
};
proto_rgmp = proto_register_protocol
("Router-port Group Management Protocol", "RGMP", "rgmp");
proto_register_field_array(proto_rgmp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
|
/**
@file G3D/constants.h
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@created 2009-05-20
@edited 2010-05-20
*/
#ifndef G3D_constants_h
#define G3D_constants_h
#include "G3D/platform.h"
#include "G3D/enumclass.h"
#include "G3D/Any.h"
namespace G3D {
/** These are defined to have the same value as the equivalent OpenGL
constant. */
class PrimitiveType {
public:
enum Value {
POINTS = 0x0000,
LINES = 0x0001,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
TRIANGLE_STRIP = 0x0005,
TRIANGLE_FAN = 0x0006,
QUADS = 0x0007,
QUAD_STRIP = 0x0008,
PATCHES = 0x000E
};
private:
static const char* toString(int i, Value& v);
Value value;
public:
G3D_DECLARE_ENUM_CLASS_METHODS(PrimitiveType);
};
/** Values for UniversalSurface::GPUGeom::refractionHint. */
class RefractionQuality {
public:
enum Value {
/** No refraction; a translucent object will appear as if it had the same index of refraction
as the surrounding medium and objects will be undistorted in the background. */
NONE = 0,
/** Use a static environment map (cube or paraboloid) for computing transmissivity.*/
STATIC_ENV = 25,
/** Use a dynamically rendered 2D environment map; distort the background. This looks good for many scenes
but avoids the cost of rendering a cube map for DYNAMIC_ENV. */
DYNAMIC_FLAT = 50,
/** Use a dynamically rendered 2D environment map that is re-captured per transparent object. This works well
for transparent objects that are separated by a significant camera space z distance but overlap in screen space.*/
DYNAMIC_FLAT_MULTILAYER = 55,
/** Render a dynamic environment map */
DYNAMIC_ENV = 75,
/** Use the best method available, ideally true ray tracing. */
BEST = 100
};
private:
static const char* toString(int i, Value& v);
Value value;
public:
G3D_DECLARE_ENUM_CLASS_METHODS(RefractionQuality);
};
/** Values for UniversalSurface::GPUGeom::mirrorHint. */
class MirrorQuality {
public:
enum Value {
/** Reflections are black */
NONE = 0,
/** Use a static environment map. This is what most games use */
STATIC_ENV = 25,
/** Planar reflection, typically for water or glass windows. This assumes that the mirror is flat;
it is distinct from RefractionQuality::DYNAMIC_FLAT, which assumes the <i>background</i> is flat.*/
DYNAMIC_PLANAR = 50,
/** Render a dynamic environment map. */
DYNAMIC_ENV = 75,
/** Use the best method available, ideally true ray tracing. */
BEST = 100
};
private:
static const char* toString(int i, Value& v);
Value value;
public:
G3D_DECLARE_ENUM_CLASS_METHODS(MirrorQuality);
};
} // namespace G3D
G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::PrimitiveType)
G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::RefractionQuality)
G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::MirrorQuality)
#endif
|
#include <stic.h>
#include <unistd.h> /* chdir() symlink() */
#include <stdlib.h> /* remove() */
#include <string.h> /* strcpy() */
#include "../../src/menus/menus.h"
static int not_windows(void);
TEST(can_navigate_to_broken_symlink, IF(not_windows))
{
strcpy(lwin.curr_dir, ".");
assert_success(chdir(SANDBOX_PATH));
/* symlink() is not available on Windows, but other code is fine. */
#ifndef _WIN32
assert_success(symlink("/wrong/path", "broken-link"));
#endif
/* Were trying to open broken link, which will fail, but the parsing part
* should succeed. */
assert_success(goto_selected_file(&lwin, SANDBOX_PATH "/broken-link:", 1));
assert_success(remove("broken-link"));
}
static int
not_windows(void)
{
#ifdef _WIN32
return 0;
#else
return 1;
#endif
}
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 filetype=c : */
|
/*
* INETPEER - A storage for permanent information about peers
*
* Authors: Andrey V. Savochkin <saw@msu.ru>
*/
#ifndef _NET_INETPEER_H
#define _NET_INETPEER_H
#include <linux/types.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/spinlock.h>
<<<<<<< HEAD
#include <linux/rtnetlink.h>
#include <net/ipv6.h>
#include <asm/atomic.h>
struct inetpeer_addr_base {
union {
__be32 a4;
__be32 a6[4];
};
};
struct inetpeer_addr {
struct inetpeer_addr_base addr;
__u16 family;
};
struct inet_peer {
/* group together avl_left,avl_right,v4daddr to speedup lookups */
struct inet_peer __rcu *avl_left, *avl_right;
struct inetpeer_addr daddr;
=======
#include <asm/atomic.h>
struct inet_peer {
/* group together avl_left,avl_right,v4daddr to speedup lookups */
struct inet_peer *avl_left, *avl_right;
__be32 v4daddr; /* peer's address */
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
__u32 avl_height;
struct list_head unused;
__u32 dtime; /* the time of last use of not
* referenced entries */
atomic_t refcnt;
<<<<<<< HEAD
/*
* Once inet_peer is queued for deletion (refcnt == -1), following fields
* are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp, metrics
* We can share memory with rcu_head to help keep inet_peer small.
*/
union {
struct {
atomic_t rid; /* Frag reception counter */
atomic_t ip_id_count; /* IP ID for the next packet */
__u32 tcp_ts;
__u32 tcp_ts_stamp;
u32 metrics[RTAX_MAX];
u32 rate_tokens; /* rate limiting for ICMP */
unsigned long rate_last;
unsigned long pmtu_expires;
u32 pmtu_orig;
u32 pmtu_learned;
struct inetpeer_addr_base redirect_learned;
};
struct rcu_head rcu;
};
=======
atomic_t rid; /* Frag reception counter */
atomic_t ip_id_count; /* IP ID for the next packet */
__u32 tcp_ts;
__u32 tcp_ts_stamp;
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
};
void inet_initpeers(void) __init;
<<<<<<< HEAD
#define INETPEER_METRICS_NEW (~(u32) 0)
static inline bool inet_metrics_new(const struct inet_peer *p)
{
return p->metrics[RTAX_LOCK-1] == INETPEER_METRICS_NEW;
}
/* can be called with or without local BH being disabled */
struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create);
static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
{
struct inetpeer_addr daddr;
daddr.addr.a4 = v4daddr;
daddr.family = AF_INET;
return inet_getpeer(&daddr, create);
}
static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create)
{
struct inetpeer_addr daddr;
ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr);
daddr.family = AF_INET6;
return inet_getpeer(&daddr, create);
}
/* can be called from BH context or outside */
extern void inet_putpeer(struct inet_peer *p);
extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
/*
* temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
* tcp_ts_stamp if no refcount is taken on inet_peer
*/
static inline void inet_peer_refcheck(const struct inet_peer *p)
{
WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
}
=======
/* can be called with or without local BH being disabled */
struct inet_peer *inet_getpeer(__be32 daddr, int create);
/* can be called from BH context or outside */
extern void inet_putpeer(struct inet_peer *p);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
/* can be called with or without local BH being disabled */
static inline __u16 inet_getid(struct inet_peer *p, int more)
{
more++;
<<<<<<< HEAD
inet_peer_refcheck(p);
=======
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
return atomic_add_return(more, &p->ip_id_count) - more;
}
#endif /* _NET_INETPEER_H */
|
/****************************************************************************
**
** 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 MYSORTFILTERPROXYMODEL_H
#define MYSORTFILTERPROXYMODEL_H
#include <QDate>
#include <QSortFilterProxyModel>
//! [0]
class MySortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
MySortFilterProxyModel(QObject *parent = 0);
QDate filterMinimumDate() const { return minDate; }
void setFilterMinimumDate(const QDate &date);
QDate filterMaximumDate() const { return maxDate; }
void setFilterMaximumDate(const QDate &date);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
private:
bool dateInRange(const QDate &date) const;
QDate minDate;
QDate maxDate;
};
//! [0]
#endif
|
/*
SleepLib Fisher & Paykel Icon Loader Implementation
Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL
Copyright: (c)2012 Mark Watkins
*/
#ifndef ICON_LOADER_H
#define ICON_LOADER_H
#include <QMultiMap>
#include "SleepLib/machine.h"
#include "SleepLib/machine_loader.h"
#include "SleepLib/profiles.h"
//********************************************************************************************
/// IMPORTANT!!!
//********************************************************************************************
// Please INCREMENT the following value when making changes to this loaders implementation.
//
const int fpicon_data_version=2;
//
//********************************************************************************************
/*! \class FPIcon
\brief F&P Icon customized machine object
*/
class FPIcon:public CPAP
{
public:
FPIcon(Profile *p,MachineID id=0);
virtual ~FPIcon();
};
const int fpicon_load_buffer_size=1024*1024;
const QString fpicon_class_name=STR_MACH_FPIcon;
/*! \class FPIconLoader
\brief Loader for Fisher & Paykel Icon data
This is only relatively recent addition and still needs more work
*/
class FPIconLoader : public MachineLoader
{
public:
FPIconLoader();
virtual ~FPIconLoader();
//! \brief Scans path for F&P Icon data signature, and Loads any new data
virtual int Open(QString & path,Profile *profile);
int OpenMachine(Machine *mach, QString & path, Profile * profile);
bool OpenSummary(Machine *mach, QString path, Profile * profile);
bool OpenDetail(Machine *mach, QString path, Profile * profile);
bool OpenFLW(Machine * mach,QString filename, Profile * profile);
//! \brief Returns SleepLib database version of this F&P Icon loader
virtual int Version() { return fpicon_data_version; }
//! \brief Returns the machine class name of this CPAP machine, "FPIcon"
virtual const QString & ClassName() { return fpicon_class_name; }
//! \brief Creates a machine object, indexed by serial number
Machine *CreateMachine(QString serial,Profile *profile);
//! \brief Registers this MachineLoader with the master list, so F&P Icon data can load
static void Register();
protected:
QString last;
QHash<QString,Machine *> MachList;
QMap<SessionID, Session *> Sessions;
QMultiMap<QDate,Session *> SessDate;
QMap<int,QList<EventList *> > FLWMapFlow;
QMap<int,QList<EventList *> > FLWMapLeak;
QMap<int,QList<EventList *> > FLWMapPres;
QMap<int,QList<qint64> > FLWDuration;
QMap<int,QList<qint64> > FLWTS;
QMap<int,QDate> FLWDate;
unsigned char * m_buffer;
};
#endif // ICON_LOADER_H
|
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* 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
* \brief Реализация SystemGuard
* \author Pavel Vainerman
*/
//--------------------------------------------------------------------------------
#ifndef SystemGuard_H_
#define SystemGuard_H_
//--------------------------------------------------------------------------------
#include <omniORB4/CORBA.h>
#include <omnithread.h>
#include "UniSetTypes.h"
#include "PassiveTimer.h"
#include "ThreadCreator.h"
#include "ObjectsActivator.h"
//--------------------------------------------------------------------------------
/*! \class SystemGuard
* Предназначен для слежения за исправностью работы процессов. А так же отслеживает наличие
* связи c узлами и обновляет эту информацию в ListOfNodes.
*/
class SystemGuard:
public ObjectsActivator
{
public:
SystemGuard(UniSetTypes::ObjectId id);
SystemGuard();
~SystemGuard();
virtual void run( bool thread=false );
virtual void stop();
virtual void oaDestroy(int signo=0);
virtual UniSetTypes::SimpleInfo* getInfo();
virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("SystemGuard"); }
protected:
void execute();
virtual void sigterm( int signo );
virtual bool pingNode();
virtual void updateNodeInfo(const UniSetTypes::NodeInfo& newinf){};
virtual void watchDogTime();
virtual void dumpStateInfo();
virtual void autostart();
private:
void init();
// ObjectsActivator* act;
// CORBA::ORB_var orb;
PassiveTimer wdogt;
PassiveTimer rit;
PassiveTimer dumpt;
// PassiveTimer strt;
friend class ThreadCreator<SystemGuard>;
ThreadCreator<SystemGuard> *thr;
bool active;
int expid;
// omni_mutex omutex;
// omni_condition ocond;
UniSetTypes::uniset_mutex actMutex;
};
//--------------------------------------------------------------------------------
#endif
|
/*
Copyright 2011 Kurt Hindenburg <kurt.hindenburg@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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor appro-
ved by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
#ifndef GENERALSETTINGS_H
#define GENERALSETTINGS_H
#include "ui_GeneralSettings.h"
namespace Konsole {
class GeneralSettings : public QWidget, private Ui::GeneralSettings
{
Q_OBJECT
public:
explicit GeneralSettings(QWidget *aParent = nullptr);
~GeneralSettings() override;
public Q_SLOTS:
void slotEnableAllMessages();
};
}
#endif
|
#ifndef __DISP_DISPLAY_H__
#define __DISP_DISPLAY_H__
#include "disp_display_i.h"
#include "disp_layer.h"
#include "disp_scaler.h"
#include "disp_video.h"
#define IMAGE_USED 0x00000004
#define IMAGE_USED_MASK (~(IMAGE_USED))
#define YUV_CH_USED 0x00000010
#define YUV_CH_USED_MASK (~(YUV_CH_USED))
#define HWC_USED 0x00000040
#define HWC_USED_MASK (~(HWC_USED))
#define LCDC_TCON0_USED 0x00000080
#define LCDC_TCON0_USED_MASK (~(LCDC_TCON0_USED))
#define LCDC_TCON1_USED 0x00000100
#define LCDC_TCON1_USED_MASK (~(LCDC_TCON1_USED))
#define SCALER_USED 0x00000200
#define SCALER_USED_MASK (~(SCALER_USED))
#define LCD_ON 0x00010000
#define LCD_OFF (~(LCD_ON))
#define TV_ON 0x00020000
#define TV_OFF (~(TV_ON))
#define HDMI_ON 0x00040000
#define HDMI_OFF (~(HDMI_ON))
#define VGA_ON 0x00080000
#define VGA_OFF (~(VGA_ON))
#define VIDEO_PLL0_USED 0x00100000
#define VIDEO_PLL0_USED_MASK (~(VIDEO_PLL0_USED))
#define VIDEO_PLL1_USED 0x00200000
#define VIDEO_PLL1_USED_MASK (~(VIDEO_PLL1_USED))
#define IMAGE_OUTPUT_LCDC 0x00000001
#define IMAGE_OUTPUT_SCALER 0x00000002
#define IMAGE_OUTPUT_LCDC_AND_SCALER 0x00000003
#define DE_FLICKER_USED 0x01000000
#define DE_FLICKER_USED_MASK (~(DE_FLICKER_USED))
#define DE_FLICKER_REQUIRED 0x02000000
#define DE_FLICKER_REQUIRED_MASK (~(DE_FLICKER_REQUIRED))
typedef struct
{
__bool lcd_used;
__bool lcd_bl_en_used;
user_gpio_set_t lcd_bl_en;
__bool lcd_power_used;
user_gpio_set_t lcd_power;
__bool lcd_pwm_used;
user_gpio_set_t lcd_pwm;
__bool lcd_gpio_used[4];
user_gpio_set_t lcd_gpio[4];
__bool lcd_io_used[28];
user_gpio_set_t lcd_io[28];
}__disp_lcd_cfg_t;
typedef struct
{
__u32 status; /*display engine,lcd,tv,vga,hdmi status*/
__u32 lcdc_status;//tcon0 used, tcon1 used
__bool have_cfg_reg;
__u32 cache_flag;
__u32 cfg_cnt;
__u32 screen_width;
__u32 screen_height;
__disp_color_t bk_color;
__disp_colorkey_t color_key;
__u32 bright;
__u32 contrast;
__u32 saturation;
__bool enhance_en;
__u32 max_layers;
__layer_man_t layer_manage[4];
__bool bout_yuv;
__u32 de_flicker_status;
__u32 image_output_type;//see macro definition IMAGE_OUTPUT_XXX above, it can be lcd only /lcd+scaler/ scaler only
__u32 out_scaler_index;
__u32 hdmi_index;//0: internal hdmi; 1:external hdmi(if exit)
__bool b_out_interlace;
__disp_output_type_t output_type;//sw status
__disp_vga_mode_t vga_mode;
__disp_tv_mode_t tv_mode;
__disp_tv_mode_t hdmi_mode;
__disp_tv_dac_source dac_source[4];
__s32 (*LCD_CPUIF_XY_Swap)(__s32 mode);
void (*LCD_CPUIF_ISR)(void);
__u32 pll_use_status; //lcdc0/lcdc1 using which video pll(0 or 1)
__u32 lcd_bright;
__disp_color_range_t out_color_range;
__disp_lcd_cfg_t lcd_cfg;
__hdle gpio_hdl[4];
}__disp_screen_t;
typedef struct
{
__bool enable;
__u32 freq;
__u32 pre_scal;
__u32 active_state;
__u32 duty_ns;
__u32 period_ns;
__u32 entire_cycle;
__u32 active_cycle;
}__disp_pwm_t;
typedef struct
{
__disp_bsp_init_para init_para;//para from driver
__disp_screen_t screen[2];
__disp_scaler_t scaler[2];
__disp_pwm_t pwm[2];
}__disp_dev_t;
extern __disp_dev_t gdisp;
#endif
|
//
// OctopusBeast.h
// Octopus
//
// Created by K3A on 5/20/12.
// Copyright (c) 2012 K3A. All rights reserved.
//
#import <UIKit/UIKit.h>
#include "octopuscore/OctopusDaemon/octopus.h"
#include <vector>
#define MAX_SUGGS 12
#define PREF_FILE "/var/mobile/Library/Preferences/me.k3a.OctopusKeyboard.plist"
#define UIKeyboardTypeTwitter 9
#define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
struct sLine
{
float x1;
float x2; // must be higher than x1
int y;
sLine(float _x1, float _x2, int _y)
{
x1 = _x1; x2 = _x2; y = _y;
}
bool CollidesWith(const sLine& ln)const
{
return y == ln.y && ( (ln.x1 > x1 && ln.x1 < x2) || (x1 > ln.x1 && x1 < ln.x2) );
}
};
typedef std::vector<sLine> LineVector;
void OLog(int level, const char* format, ...);
void OErr(const char* format, ...);
@interface OctopusBeast : UIView {
NSString* _inputMode;
BOOL _rightToLeft;
NSMutableString* _input;
NSString* _prevWord;
NSMutableSet* _keysDrawn;
NSMutableString* _suggs[MAX_SUGGS];
sSuggestions _suggs_struct;
bool _isCorrection[MAX_SUGGS];
unsigned _numSuggs;
BOOL _capitalizeWord;
BOOL _serverOK;
int _swipeLength;
bool _autocapitalization;
BOOL _enabled;
BOOL _downPlural;
BOOL _abovekeys;
BOOL _isPad;
int _minChars;
BOOL _longPressed;
LineVector _lines;
BOOL hasPendingChanges;
BOOL processingUpdate;
UIColor* _textColor;
UIColor* _outlineColor;
}
@property (nonatomic,retain) id keyplane;
@property (nonatomic,copy) id input;
@property (nonatomic,retain) UITextInputTraits* traits;
+(OctopusBeast*)inst;
-(void)applyPrefs;
-(void)printKeyplane;
-(int)swipeLength;
-(BOOL)pluralOnSwipeDown;
-(BOOL)canComplete;
-(BOOL)shouldCapitalize;
-(void)releaseCompletionEngine;
-(void)initCompletionEngine;
-(void)setInputMode:(NSString*)inpM;
-(void)updateSuggestions;
-(void)inputAdd:(NSString*)str;
-(void)inputSet:(NSString*)str;
-(void)inputBackspace;
-(void)inputClear;
-(void)inputClearWord;
-(void)setContext:(NSString*)ctx word:(NSString*)word offset:(int)offset;
-(int)suggestionIndexForKey:(NSString*)k;
-(NSString*)suggestionForKey:(NSString*)k isCorrection:(BOOL*)corr;
-(void)acceptWord:(NSString*)w;
-(NSString*)acceptWordFromSuggestionKey:(NSString *)k;
-(NSString*)inputMode;
-(NSString*)inputString;
// long press (variation keys)
-(void)longPress;
-(void)resetLongPress;
-(BOOL)isLongPressed;
// color management
-(UIColor*)colorForText;
-(UIColor*)colorForOutline;
@end
#include <sys/time.h>
inline unsigned GetTimestampMsec()
{
timeval time;
gettimeofday(&time, NULL);
unsigned elapsed_seconds = time.tv_sec;
unsigned elapsed_useconds = time.tv_usec;
return elapsed_seconds * 1000 + elapsed_useconds/1000;
}
inline BOOL isPad() {
#ifdef UI_USER_INTERFACE_IDIOM
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#else
return NO;
#endif
}
|
#ifndef CATCHMENTPOLYGON_H
#define CATCHMENTPOLYGON_H
#include <QDialog>
namespace Ui {
class CatchmentPolygon;
}
class CatchmentPolygon : public QDialog
{
Q_OBJECT
public:
explicit CatchmentPolygon(QWidget *parent = 0);
~CatchmentPolygon();
QString LogsString;
QStringList ProjectIOStringList;
private slots:
void on_pushButtonCatchmentGrids_clicked();
void on_pushButtonCatchmentPolygon_clicked();
void on_pushButtonRun_clicked();
void on_pushButtonClose_clicked();
void on_pushButtonHelp_clicked();
void pushButtonSetFocus();
private:
Ui::CatchmentPolygon *ui;
};
#endif // CATCHMENTPOLYGON_H
|
/** @file fail.h
*
* Interface to class signaling failure of operation. Considered obsolete
* somewhat obsolete (most of this can be replaced by exceptions). */
/*
* GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
*
* 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 GINAC_FAIL_H
#define GINAC_FAIL_H
#include "basic.h"
#include "archive.h"
namespace GiNaC {
class fail : public basic
{
GINAC_DECLARE_REGISTERED_CLASS(fail, basic)
// functions overriding virtual functions from base classes
protected:
unsigned return_type() const { return return_types::noncommutative_composite; };
// non-virtual functions in this class
protected:
void do_print(const print_context & c, unsigned level) const;
};
GINAC_DECLARE_UNARCHIVER(fail);
} // namespace GiNaC
#endif // ndef GINAC_FAIL_H
|
/* * ScreenCloud - An easy to use screenshot sharing application
* Copyright (C) 2016 Olav Sortland Thoresen <olav.s.th@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.
*/
#ifndef SELECTIONOVERLAY_H
#define SELECTIONOVERLAY_H
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QPixmap>
#include <QWidget>
#include <QPainter>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QRubberBand>
#include <QGraphicsRectItem>
#include <utils/log.h>
#include <QApplication>
#include <QDesktopWidget>
#include <QMessageBox>
#include <QScreen>
#define MOUSE_OVER_LEFT 0x0
#define MOUSE_OVER_RIGHT 0x1
#define MOUSE_OVER_TOP 0x2
#define MOUSE_OVER_BOTTOM 0x3
#define MOUSE_OVER_INSIDE 0x4
#define MOUSE_OVER_TOPLEFT 0x5
#define MOUSE_OVER_TOPRIGHT 0x6
#define MOUSE_OVER_BOTTOMLEFT 0x7
#define MOUSE_OVER_BOTTOMRIGHT 0x8
#define MOUSE_OUT 0x9
class SelectionOverlay : public QWidget
{
Q_OBJECT
public:
explicit SelectionOverlay(QWidget *parent = 0);
virtual ~SelectionOverlay();
void checkIfRubberBandOutOfBounds();
int checkMouseOverRubberBand(QPoint& mousePos);
void resetRubberBand();
void updateScreenshot();
void drawOverlay(QPainter *painter, const QColor &color);
void drawRubberband(QPainter* painter, const QRect& rect, const QColor& color, int lineSize);
void drawHandles(QPainter* painter, const QRect& rect, const QColor& color, int lineSize, int handleSize);
void drawHelpText(QPainter *painter, const QColor &bgColor, const QColor &textColor);
void moveToScreen(int screenNumber);
protected:
void showEvent(QShowEvent *e);
void hideEvent(QHideEvent *e);
void paintEvent(QPaintEvent* pe);
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void keyReleaseEvent(QKeyEvent *event);
private:
void resizeLeft(QPoint& mousePos, QRect& rbGeometryBeforeResize);
void resizeTop(QPoint& mousePos, QRect& rbGeometryBeforeResize);
void resizeRight(QPoint& mousePos, QRect& rbGeometryBeforeResize);
void resizeBottom(QPoint& mousePos, QRect& rbGeometryBeforeResize);
Q_SIGNALS:
void selectionDone(QRect& area, QPixmap& screenshot, QString uploaderShortname);
void selectionCanceled();
void currentScreenChanged(int newScreenNumber);
private:
//Cursors
const static Qt::CursorShape crossShape = Qt::CrossCursor;
const static Qt::CursorShape openHandShape = Qt::OpenHandCursor;
const static Qt::CursorShape closedHandShape = Qt::ClosedHandCursor;
const static Qt::CursorShape verticalShape = Qt::SizeVerCursor;
const static Qt::CursorShape horizontalShape = Qt::SizeHorCursor;
const static Qt::CursorShape leftDiagonalShape = Qt::SizeFDiagCursor;
const static Qt::CursorShape rightDiagonalShape = Qt::SizeBDiagCursor;
QPixmap screenshot;
QRect selection, selectionBeforeDrag;
QPoint selRectStart, selRectEnd;
bool drawingRubberBand, movingRubberBand, resizingRubberBand, startedDrawingRubberBand;
int resizingFrom;
int rbDistX, rbDistY;
int currentScreenNumber;
public Q_SLOTS:
};
#endif // SELECTIONOVERLAY_H
|
/*
* Copyright (c) 2003, 2006 Matteo Frigo
* Copyright (c) 2003, 2006 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Sat Jul 1 14:59:08 EDT 2006 */
#include "codelet-dft.h"
#ifdef HAVE_FMA
/* Generated by: ../../../genfft/gen_twiddle_c -fma -reorder-insns -schedule-for-pipeline -simd -compact -variables 4 -pipeline-latency 8 -n 4 -name t1bv_4 -include t1b.h -sign 1 */
/*
* This function contains 11 FP additions, 8 FP multiplications,
* (or, 9 additions, 6 multiplications, 2 fused multiply/add),
* 13 stack variables, and 8 memory accesses
*/
/*
* Generator Id's :
* $Id: algsimp.ml,v 1.9 2006-02-12 23:34:12 athena Exp $
* $Id: fft.ml,v 1.4 2006-01-05 03:04:27 stevenj Exp $
* $Id: gen_twiddle_c.ml,v 1.14 2006-02-12 23:34:12 athena Exp $
*/
#include "t1b.h"
static const R *t1bv_4(R *ri, R *ii, const R *W, stride ios, INT m, INT dist)
{
INT i;
R *x;
x = ii;
for (i = m; i > 0; i = i - VL, x = x + (VL * dist), W = W + (TWVL * 6), MAKE_VOLATILE_STRIDE(ios)) {
V T1, T7, T2, T5, T8, T3, T6;
T1 = LD(&(x[0]), dist, &(x[0]));
T7 = LD(&(x[WS(ios, 3)]), dist, &(x[WS(ios, 1)]));
T2 = LD(&(x[WS(ios, 2)]), dist, &(x[0]));
T5 = LD(&(x[WS(ios, 1)]), dist, &(x[WS(ios, 1)]));
T8 = BYTW(&(W[TWVL * 4]), T7);
T3 = BYTW(&(W[TWVL * 2]), T2);
T6 = BYTW(&(W[0]), T5);
{
V Ta, T4, Tb, T9;
Ta = VADD(T1, T3);
T4 = VSUB(T1, T3);
Tb = VADD(T6, T8);
T9 = VSUB(T6, T8);
ST(&(x[0]), VADD(Ta, Tb), dist, &(x[0]));
ST(&(x[WS(ios, 2)]), VSUB(Ta, Tb), dist, &(x[0]));
ST(&(x[WS(ios, 1)]), VFMAI(T9, T4), dist, &(x[WS(ios, 1)]));
ST(&(x[WS(ios, 3)]), VFNMSI(T9, T4), dist, &(x[WS(ios, 1)]));
}
}
return W;
}
static const tw_instr twinstr[] = {
VTW(1),
VTW(2),
VTW(3),
{TW_NEXT, VL, 0}
};
static const ct_desc desc = { 4, "t1bv_4", twinstr, &GENUS, {9, 6, 2, 0}, 0, 0, 0 };
void X(codelet_t1bv_4) (planner *p) {
X(kdft_dit_register) (p, t1bv_4, &desc);
}
#else /* HAVE_FMA */
/* Generated by: ../../../genfft/gen_twiddle_c -simd -compact -variables 4 -pipeline-latency 8 -n 4 -name t1bv_4 -include t1b.h -sign 1 */
/*
* This function contains 11 FP additions, 6 FP multiplications,
* (or, 11 additions, 6 multiplications, 0 fused multiply/add),
* 13 stack variables, and 8 memory accesses
*/
/*
* Generator Id's :
* $Id: algsimp.ml,v 1.9 2006-02-12 23:34:12 athena Exp $
* $Id: fft.ml,v 1.4 2006-01-05 03:04:27 stevenj Exp $
* $Id: gen_twiddle_c.ml,v 1.14 2006-02-12 23:34:12 athena Exp $
*/
#include "t1b.h"
static const R *t1bv_4(R *ri, R *ii, const R *W, stride ios, INT m, INT dist)
{
INT i;
R *x;
x = ii;
for (i = m; i > 0; i = i - VL, x = x + (VL * dist), W = W + (TWVL * 6), MAKE_VOLATILE_STRIDE(ios)) {
V T1, T8, T3, T6, T7, T2, T5;
T1 = LD(&(x[0]), dist, &(x[0]));
T7 = LD(&(x[WS(ios, 3)]), dist, &(x[WS(ios, 1)]));
T8 = BYTW(&(W[TWVL * 4]), T7);
T2 = LD(&(x[WS(ios, 2)]), dist, &(x[0]));
T3 = BYTW(&(W[TWVL * 2]), T2);
T5 = LD(&(x[WS(ios, 1)]), dist, &(x[WS(ios, 1)]));
T6 = BYTW(&(W[0]), T5);
{
V T4, T9, Ta, Tb;
T4 = VSUB(T1, T3);
T9 = VBYI(VSUB(T6, T8));
ST(&(x[WS(ios, 3)]), VSUB(T4, T9), dist, &(x[WS(ios, 1)]));
ST(&(x[WS(ios, 1)]), VADD(T4, T9), dist, &(x[WS(ios, 1)]));
Ta = VADD(T1, T3);
Tb = VADD(T6, T8);
ST(&(x[WS(ios, 2)]), VSUB(Ta, Tb), dist, &(x[0]));
ST(&(x[0]), VADD(Ta, Tb), dist, &(x[0]));
}
}
return W;
}
static const tw_instr twinstr[] = {
VTW(1),
VTW(2),
VTW(3),
{TW_NEXT, VL, 0}
};
static const ct_desc desc = { 4, "t1bv_4", twinstr, &GENUS, {11, 6, 0, 0}, 0, 0, 0 };
void X(codelet_t1bv_4) (planner *p) {
X(kdft_dit_register) (p, t1bv_4, &desc);
}
#endif /* HAVE_FMA */
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/Message.framework/Message
*/
#import <Message/MFMailMimePart.h>
#import <Message/XXUnknownSuperclass.h>
@interface MFMailMimePart : XXUnknownSuperclass {
}
+ (BOOL)isRecognizedClassForContent:(id)content; // 0x1cb05
+ (Class)attachmentClass; // 0x1cb75
- (id)decodeTextRichtext; // 0x776e9
- (id)decodeTextEnriched; // 0x777e9
- (id)decodeTextHtml; // 0x77a21
- (id)htmlContentToOffset:(unsigned)offset resultOffset:(unsigned *)offset2 downloadIfNecessary:(BOOL)necessary; // 0x778e9
- (id)htmlContentToOffset:(unsigned)offset resultOffset:(unsigned *)offset2; // 0x77919
- (id)htmlContent; // 0x7793d
- (id)decodeTextPlain; // 0x1b59d
- (id)decodeTextCalendar; // 0x77961
- (id)decodeMultipartAppledouble; // 0x77971
- (id)fileWrapperForcingDownload:(BOOL)download; // 0x1d1a5
- (id)fileWrapperForDecodedObject:(id)decodedObject withFileData:(id *)fileData; // 0x77ba1
- (void)configureFileWrapper:(id)wrapper; // 0x1cb91
- (void)storeData:(id)data inMessage:(id)message isComplete:(BOOL)complete; // 0x779ad
- (BOOL)_shouldContinueDecodingProcess; // 0x779e5
- (id)contentToOffset:(unsigned)offset resultOffset:(unsigned *)offset2 downloadIfNecessary:(BOOL)necessary asHTML:(BOOL)html isComplete:(BOOL *)complete; // 0x1b2b5
@end
@interface MFMailMimePart (DecodeMessage)
- (id)decodeMessageDelivery_status; // 0x7a309
- (id)decodeMessageRfc822; // 0x7a319
- (id)decodeMessagePartial; // 0x7a461
- (id)decodeMessageExternal_body; // 0x7a4d5
@end
|
/*
* The ManaPlus Client
* Copyright (C) 2012-2013 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UTILS_STRINGVECTOR_H
#define UTILS_STRINGVECTOR_H
#include <string>
#include <vector>
typedef std::vector<std::string> StringVect;
typedef StringVect::iterator StringVectIter;
typedef StringVect::const_iterator StringVectCIter;
#endif // UTILS_STRINGVECTOR_H
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2009 Myles Watson <mylesgw@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; 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.
*/
/* This file is for "nuisance prototypes" that have no other home. */
#ifndef __LIB_H__
#define __LIB_H__
#include <stdint.h>
#include <types.h>
/* Defined in src/lib/lzma.c. Returns decompressed size or 0 on error. */
size_t ulzma(const void *src, void *dst);
size_t ulzman(const void *src, size_t srcn, void *dst, size_t dstn);
/* Defined in src/lib/ramtest.c */
void ram_check(unsigned long start, unsigned long stop);
int ram_check_nodie(unsigned long start, unsigned long stop);
int ram_check_noprint_nodie(unsigned long start, unsigned long stop);
void quick_ram_check(void);
/* Defined in primitive_memtest.c */
int primitive_memtest(uintptr_t base, uintptr_t size);
/* Defined in src/lib/stack.c */
int checkstack(void *top_of_stack, int core);
/*
* Defined in src/lib/hexdump.c
* Use the Linux command "xxd" for matching output. xxd is found in package
* https://packages.debian.org/jessie/amd64/vim-common/filelist
*/
void hexdump(const void *memory, size_t length);
void hexdump32(char LEVEL, const void *d, size_t len);
/*
* hexstrtobin - Turn a string of ASCII hex characters into binary
*
* @str: String of hex characters to parse
* @buf: Buffer to store the resulting bytes into
* @len: Maximum length of buffer to fill
*
* Defined in src/lib/hexstrtobin.c
* Ignores non-hex characters in the string.
* Returns the number of bytes that have been put in the buffer.
*/
size_t hexstrtobin(const char *str, uint8_t *buf, size_t len);
#if !defined(__ROMCC__)
/* Count Leading Zeroes: clz(0) == 32, clz(0xf) == 28, clz(1 << 31) == 0 */
static inline int clz(u32 x) { return x ? __builtin_clz(x) : sizeof(x) * 8; }
/* Integer binary logarithm (rounding down): log2(0) == -1, log2(5) == 2 */
static inline int log2(u32 x) { return sizeof(x) * 8 - clz(x) - 1; }
/* Find First Set: __ffs(1) == 0, __ffs(0) == -1, __ffs(1<<31) == 31 */
static inline int __ffs(u32 x) { return log2(x & (u32)(-(s32)x)); }
#endif
/* Integer binary logarithm (rounding up): log2_ceil(0) == -1, log2(5) == 3 */
static inline int log2_ceil(u32 x) { return (x == 0) ? -1 : log2(x * 2 - 1); }
#endif /* __LIB_H__ */
|
/*
maths.c
Bygfoot Football Manager -- a small and simple GTK2-based
football management game.
http://bygfoot.sourceforge.net
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "maths.h"
#include "misc.h"
#include "variables.h"
/**
Generate a Gauss-distributed (pseudo)random number.
"By Box and Muller, and recommended by Knuth".
@return A Gauss-distributed random number.
*/
gdouble
math_gaussrand(void)
{
static gdouble V1, V2, S;
static gint phase = 0;
gdouble X;
if(phase == 0) {
do {
gdouble U1 = g_rand_double(rand_generator);
gdouble U2 = g_rand_double(rand_generator);
V1 = 2 * U1 - 1;
V2 = 2 * U2 - 1;
S = V1 * V1 + V2 * V2;
} while(S >= 1 || S == 0);
X = V1 * sqrt(-2 * log(S) / S);
} else
X = V2 * sqrt(-2 * log(S) / S);
phase = 1 - phase;
return X;
}
/**
Generate a Gauss-distributed random number within given boundaries
using math_gaussrand().
Expectation value of the distribution is (upper + lower) / 2,
the variance is so that the number is between the boundaries with probability
99,7 %. If the number isn't between the boundaries, we cut off.
@param lower Lower cutoff boundary.
@param upper Upper cutoff boundary.
@return A Gauss-distributed number
*/
gdouble
math_gauss_dist(gdouble lower, gdouble upper)
{
gdouble result;
result = (upper - lower) / 6 * math_gaussrand()
+ (upper + lower) / 2;
if(result < lower)
result = lower;
if(result > upper)
result = upper;
return result;
}
/**
Get a certain part of an integer number.
If 'place' is between 1 and 9, the 'place'th digit beginning
from the right is returned, e.g. if the number = 1234 and
place = 2, the function returns 3.
If 'place' is between 10 and 19, say 10 + x, the first
'x' digits are returned, e.g. number = 8765 and place = 12 leads to
return value 87.
If 'place' is between 20 and 29, say 20 + x, the last
'x' digits are returned, e.g. number = 4869 and place = 22
leads to return value 69.
@param value The number which gets scrutinized.
@param place The number telling the function which part of 'value' to return.
@return A part of the integer 'value'.
*/
gint
math_get_place(gint value, gint place)
{
if(place < 10)
return (value % (gint)powf(10, place) -
value % (gint)powf(10, place - 1)) /
(gint)powf(10, place - 1);
else if(place < 20)
{
while(value >= (gint)powf(10, place % 10))
value = (value - value % 10) / 10;
return value;
}
return value % (gint)powf(10, place % 10);
}
/**
Round an integer with given precision.
If places > 0, round with precision 'places', e.g.
number = 124566 and places = 2 leads to return value
124600.
If places < 0, precision is length of 'number' minus
'places', e.g. number = 654987 and places = -2 leads to return
value 65000.
@param number The number to be rounded.
@param places The precision.
@return The rounded integer.
*/
gint
math_round_integer(gint number, gint places)
{
gint length = 0;
gfloat copy = (gfloat)number;
if(places > 0)
return (gint)rint( (gfloat)number / powf(10, places) ) *
powf(10, places);
while(copy >= 1)
{
copy /= 10;
length++;
}
return (gint)rint( (gfloat)number / powf(10, length + places) ) *
powf(10, length + places);
}
/** Generate a permutation of integers and write it to 'array'.
@param array The integer array we store the permutation in.
It must have size at least end - start - 1.
@param start The integer to start with.
@param end The integer to end with. */
void
math_generate_permutation(gint *array, gint start, gint end)
{
gint i;
for(i = start; i < end + 1; i++)
array[i - start] = i;
for(i=0;i<end - start;i++)
misc_swap_int(&array[i], &array[math_rndi(i, end - start)]);
}
/** This function tells us how many teams from 'number' teams
have to be left away to obtain a power of 2. */
gint
math_get_bye_len(gint number)
{
gint i;
for(i=0;i<20;i++)
if((gint)powf(2, i) >= number)
break;
return (gint)powf(2, i) - number;
}
/** Return the sum of the integers in the array.
@param array The integer array.
@param max The size of the array.
@return The sum of all the integers in the array. */
gint
math_sum_int_array(const gint *array, gint max)
{
gint i, sum = 0;
for(i=0;i<max;i++)
sum += array[i];
return sum;
}
|
/*
C-Dogs SDL
A port of the legendary (and fun) action/arcade cdogs.
Copyright (c) 2016-2017, 2019 Cong Xu
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "particle.h"
typedef struct
{
const ParticleClass *p;
struct vec2 offset;
float minSpeed;
float maxSpeed;
int minDZ;
int maxDZ;
double minRotation;
double maxRotation;
int ticksPerEmit;
int counter;
} Emitter;
void EmitterInit(
Emitter *em, const ParticleClass *p, const struct vec2 offset,
const float minSpeed, const float maxSpeed,
const int minDZ, const int maxDZ,
const double minRotation, const double maxRotation,
const int ticksPerEmit);
void EmitterStart(Emitter *em, const AddParticle *data);
void EmitterUpdate(Emitter *em, const AddParticle *data, const int ticks);
|
/*
ZynAddSubFX - a software synthesizer
Phaser.h - Phaser effect
Copyright (C) 2002-2005 Nasca Octavian Paul
Author: Nasca Octavian Paul
Modified for rakarrack by Josep Andreu
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License
as published by the Free Software Foundation.
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.
You should have received a copy of the GNU General Public License (version 2)
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PHASER_H
#define PHASER_H
#include "global.h"
#include "EffectLFO.h"
class Phaser
{
public:
Phaser (float * efxoutl_, float * efxoutr_, double sample_rate);
~Phaser ();
void out (float * smpsl, float * smpsr, uint32_t period);
void setpreset (int npreset);
void changepar (int npar, int value);
int getpar (int npar);
void cleanup ();
int Ppreset;
float outvolume;
float *efxoutl;
float *efxoutr;
uint32_t PERIOD;
EffectLFO *lfo; //Phaser modulator
private:
void setvolume (int Pvolume);
void setpanning (int Ppanning);
void setdepth (int Pdepth);
void setfb (int Pfb);
void setlrcross (int Plrcross);
void setstages (int Pstages);
void setphase (int Pphase);
//Parametrii Phaser
int Pvolume;
int Ppanning;
int Pdepth; //the depth of the Phaser
int Pfb; //feedback
int Plrcross; //feedback
int Pstages;
int Poutsub; //if I wish to substract the output instead of the adding it
int Pphase;
//Control Parametrii
//Valorile interne
float panning, fb, depth, lrcross, fbl, fbr, phase;
float *oldl, *oldr;
float oldlgain, oldrgain;
class FPreset *Fpre;
};
#endif
|
/**
* \addtogroup uip6
* @{
*/
/*
* Copyright (c) 2013, Swedish Institute of Computer Science.
* 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.
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
*
*
*/
/**
* \file
* IPv6 Neighbor cache (link-layer/IPv6 address mapping)
* \author Mathilde Durvy <mdurvy@cisco.com>
* \author Julien Abeille <jabeille@cisco.com>
* \author Simon Duquennoy <simonduq@sics.se>
*
*/
#ifndef __UIP_DS6_NEIGHBOR_H__
#define __UIP_DS6_NEIGHBOR_H__
#include "net/uip.h"
#include "net/nbr-table.h"
#include "sys/stimer.h"
#include "net/uip-ds6.h"
#include "net/nbr-table.h"
#if UIP_CONF_IPV6_QUEUE_PKT
#include "net/uip-packetqueue.h"
#endif /*UIP_CONF_QUEUE_PKT */
/*--------------------------------------------------*/
/** \brief Possible states for the nbr cache entries */
#define NBR_INCOMPLETE 0
#define NBR_REACHABLE 1
#define NBR_STALE 2
#define NBR_DELAY 3
#define NBR_PROBE 4
NBR_TABLE_DECLARE(ds6_neighbors);
/** \brief An entry in the nbr cache */
typedef struct uip_ds6_nbr {
uip_ipaddr_t ipaddr;
struct stimer reachable;
struct stimer sendns;
uint8_t nscount;
uint8_t isrouter;
uint8_t state;
#if UIP_CONF_IPV6_QUEUE_PKT
struct uip_packetqueue_handle packethandle;
#define UIP_DS6_NBR_PACKET_LIFETIME CLOCK_SECOND * 4
#endif /*UIP_CONF_QUEUE_PKT */
} uip_ds6_nbr_t;
void uip_ds6_neighbors_init(void);
/** \brief Neighbor Cache basic routines */
uip_ds6_nbr_t *uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr,
uint8_t isrouter, uint8_t state);
void uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr);
uip_lladdr_t *uip_ds6_nbr_get_ll(uip_ds6_nbr_t *nbr);
uip_ipaddr_t *uip_ds6_nbr_get_ipaddr(uip_ds6_nbr_t *nbr);
uip_ds6_nbr_t *uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr);
uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr);
uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(uip_lladdr_t *lladdr);
uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr);
void uip_ds6_link_neighbor_callback(int status, int numtx);
void uip_ds6_neighbor_periodic(void);
int uip_ds6_nbr_num(void);
/**
* \brief
* This searches inside the neighbor table for the neighbor that is about to
* expire the next.
*
* \return
* A reference to the neighbor about to expire the next or NULL if
* table is empty.
*/
uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void);
#endif /* __UIP_DS6_NEIGHBOR_H__ */
|
/// @file CasdaUploadApp.h
///
/// @copyright (c) 2015 CSIRO
/// Australia Telescope National Facility (ATNF)
/// Commonwealth Scientific and Industrial Research Organisation (CSIRO)
/// PO Box 76, Epping NSW 1710, Australia
/// atnf-enquiries@csiro.au
///
/// This file is part of the ASKAP software distribution.
///
/// The ASKAP software distribution is free software: you can redistribute it
/// and/or modify it under the terms of the GNU General Public License as
/// published by the Free Software Foundation; either version 2 of the License,
/// or (at your option) any later version.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with this program; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// @author Ben Humphreys <ben.humphreys@csiro.au>
#ifndef ASKAP_CP_PIPELINETASKS_CASDAUPLOADAPP_H
#define ASKAP_CP_PIPELINETASKS_CASDAUPLOADAPP_H
// System includes
#include <vector>
#include <string>
// ASKAPsoft includes
#include "askap/Application.h"
#include "xercesc/dom/DOM.hpp" // Includes all DOM
#include "boost/filesystem.hpp"
// Local package includes
#include "casdaupload/IdentityElement.h"
#include "casdaupload/ObservationElement.h"
#include "casdaupload/ImageElement.h"
#include "casdaupload/CatalogElement.h"
#include "casdaupload/MeasurementSetElement.h"
#include "casdaupload/EvaluationReportElement.h"
namespace askap {
namespace cp {
namespace pipelinetasks {
/// @brief Main application implementation for the CASDA upload utility.
/// The CASDA upload utility prepares artifacts for submission to the CSIRO
/// ASKAP Science Data Archive (CASDA)
class CasdaUploadApp : public askap::Application {
public:
/// Run the application
virtual int run(int argc, char* argv[]);
private:
/// Create the metadata file
static void generateMetadataFile(const boost::filesystem::path& file,
const IdentityElement& identity,
const ObservationElement& obs,
const std::vector<ImageElement>& images,
const std::vector<CatalogElement>& catalogs,
const std::vector<MeasurementSetElement>& ms,
const std::vector<EvaluationReportElement>& reports);
/// Copy artifacts in the "elements" vector to the given output directory.
/// During the copy process a checksum is created for the file.
template <typename T>
static void copyAndChecksumElements(const std::vector<T>& elements,
const boost::filesystem::path& outdir);
template <typename T>
static void appendElementCollection(const std::vector<T>& elements,
const std::string& tag,
xercesc::DOMElement* root);
template <typename T>
std::vector<T> buildArtifactElements(const std::string& key,
bool hasProject = true) const;
};
}
}
}
#endif
|
/* simplelist.c
* High level routines for dealing with text files (read-only) with an item per line.
*
* Ziproxy - the HTTP acceleration proxy
* This code is under the following conditions:
*
* ---------------------------------------------------------------------
* Copyright (c)2005-2012 Daniel Mealha Cabrita
*
* 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
* ---------------------------------------------------------------------
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "txtfiletools.h"
#include "strtables.h"
#include "simplelist.h"
/* loads text file into memory and return struct to be used for queries
returns NULL if unable to load file or create structure */
t_st_strtable *slist_create (const char* given_filename)
{
char *filedata;
int filedata_len;
t_st_strtable *slist_table;
int linelen;
char *curpos;
if ((filedata = load_textfile_to_memory (given_filename)) != NULL) {
filedata_len = strlen (filedata);
fix_linebreaks_qp (filedata, filedata_len, filedata);
remove_junk_data (filedata, filedata);
if ((slist_table = st_create ()) != NULL) {
curpos = filedata;
while ((linelen = get_line_len (curpos))) {
if (*(curpos + linelen - 1) == '\n')
*(curpos + linelen - 1) = '\0';
if (strchr (curpos, '*') == NULL)
st_insert_nometa (slist_table, curpos);
else
st_insert (slist_table, curpos);
curpos += linelen;
}
/* finished, return */
free (filedata);
return (slist_table);
}
free (filedata);
}
return (NULL);
}
void slist_destroy (t_st_strtable *slist_table)
{
st_destroy (slist_table);
}
/* if string is present in the list, returns !=0
otherwise returns 0.
this function makes pattern-mathing (based on '*') */
int slist_check_if_matches (t_st_strtable *slist_table, const char *strdata)
{
return (st_check_if_matches (slist_table, strdata));
}
|
/*
* Copyright (c) 2006 Konstantin Shishkov
* Copyright (c) 2007 Loren Merritt
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* huffman tree builder and VLC generator
*/
#include "avcodec.h"
#include "get_bits.h"
#include "huffman.h"
/* symbol for Huffman tree node */
#define HNODE -1
typedef struct {
uint64_t val;
int name;
} HeapElem;
static void heap_sift(HeapElem *h, int root, int size)
{
while (root * 2 + 1 < size) {
int child = root * 2 + 1;
if (child < size - 1 && h[child].val > h[child+1].val)
child++;
if (h[root].val > h[child].val) {
FFSWAP(HeapElem, h[root], h[child]);
root = child;
} else
break;
}
}
void ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats)
{
HeapElem h[256];
int up[2*256];
int len[2*256];
int offset, i, next;
int size = 256;
for (offset = 1; ; offset <<= 1) {
for (i=0; i < size; i++) {
h[i].name = i;
h[i].val = (stats[i] << 8) + offset;
}
for (i = size / 2 - 1; i >= 0; i--)
heap_sift(h, i, size);
for (next = size; next < size * 2 - 1; next++) {
// merge the two smallest entries, and put it back in the heap
uint64_t min1v = h[0].val;
up[h[0].name] = next;
h[0].val = INT64_MAX;
heap_sift(h, 0, size);
up[h[0].name] = next;
h[0].name = next;
h[0].val += min1v;
heap_sift(h, 0, size);
}
len[2 * size - 2] = 0;
for (i = 2 * size - 3; i >= size; i--)
len[i] = len[up[i]] + 1;
for (i = 0; i < size; i++) {
dst[i] = len[up[i]] + 1;
if (dst[i] >= 32) break;
}
if (i==size) break;
}
}
static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
Node *nodes, int node,
uint32_t pfx, int pl, int *pos, int no_zero_count)
{
int s;
s = nodes[node].sym;
if (s != HNODE || (no_zero_count && !nodes[node].count)) {
bits[*pos] = pfx;
lens[*pos] = pl;
xlat[*pos] = s;
(*pos)++;
} else {
pfx <<= 1;
pl++;
get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0, pfx, pl,
pos, no_zero_count);
pfx |= 1;
get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0 + 1, pfx, pl,
pos, no_zero_count);
}
}
static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
{
int no_zero_count = !(flags & FF_HUFFMAN_FLAG_ZERO_COUNT);
uint32_t bits[256];
int16_t lens[256];
uint8_t xlat[256];
int pos = 0;
get_tree_codes(bits, lens, xlat, nodes, head, 0, 0,
&pos, no_zero_count);
return ff_init_vlc_sparse(vlc, 9, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
}
/**
* nodes size must be 2*nb_codes
* first nb_codes nodes.count must be set
*/
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
Node *nodes, HuffCmp cmp, int flags)
{
int i, j;
int cur_node;
int64_t sum = 0;
for (i = 0; i < nb_codes; i++) {
nodes[i].sym = i;
nodes[i].n0 = -2;
sum += nodes[i].count;
}
if (sum >> 31) {
av_log(avctx, AV_LOG_ERROR,
"Too high symbol frequencies. "
"Tree construction is not possible\n");
return -1;
}
qsort(nodes, nb_codes, sizeof(Node), cmp);
cur_node = nb_codes;
nodes[nb_codes*2-1].count = 0;
for (i = 0; i < nb_codes * 2 - 1; i += 2) {
nodes[cur_node].sym = HNODE;
nodes[cur_node].count = nodes[i].count + nodes[i + 1].count;
nodes[cur_node].n0 = i;
for (j = cur_node; j > 0; j--) {
if (nodes[j].count > nodes[j - 1].count ||
(nodes[j].count == nodes[j - 1].count &&
(!(flags & FF_HUFFMAN_FLAG_HNODE_FIRST) ||
nodes[j].n0 == j - 1 || nodes[j].n0 == j - 2 ||
(nodes[j].sym!=HNODE && nodes[j-1].sym!=HNODE))))
break;
FFSWAP(Node, nodes[j], nodes[j - 1]);
}
cur_node++;
}
if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error building tree\n");
return -1;
}
return 0;
}
|
#include <stdio.h>
#include <string.h>
void swap(char *a, char *b){
char temp;
temp = *a;
*a = *b;
*b = temp;
return;
}
void permute(char arr[], int i, int n){
int j, x, y;
if(i == n - 1){
printf("%s\n", arr);
return;
}
else{
for(j = i ; j < n ; j++){
for(x = i, y = j ; x != y ; x++)
swap(arr+x, arr+y);
permute(arr, i+1, n);
for(x = i, y = j ; x != y ; y--)
swap(arr+x, arr+y);
}
return;
}
}
int main(){
char arr[10];
int i, n, x, y;
scanf("%s", arr);
i = 0;
n = strlen(arr);
for(x = n-1 ; x > 0 ; x--){
for(y = 0 ; y < x ; y++){
if(arr[y] > arr[y+1])
swap(arr+y, arr+y+1);
}
}
permute(arr, i, n);
return 0;
}
|
#ifndef DECORATORCHOCOLATE_H
#define DECORATORCHOCOLATE_H
#include "idecorator.h"
class DecoratorChocolate : public IDecorator
{
public:
DecoratorChocolate(IProduct *product = 0, double price = 0.8);
virtual double price();
};
#endif // DECORATORCHOCOLATE_H
|
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*/
/*
* Basic test that mq_open() returns a valid message descriptor.
* Test by calling mq_open() and then verifying that that descriptor can
* be used to call mq_send().
*/
#include <stdio.h>
#include <mqueue.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include "posixtest.h"
#define NAMESIZE 50
#define MSGSTR "0123456789"
int main()
{
char qname[NAMESIZE];
const char *msgptr = MSGSTR;
mqd_t queue;
int failure=0;
sprintf(qname, "/mq_open_1-1_%d", getpid());
queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL);
if (queue == (mqd_t)-1) {
perror("mq_open() did not return success");
printf("Test FAILED\n");
return PTS_FAIL;
}
if (mq_send(queue, msgptr, strlen(msgptr), 1) != 0) {
perror("mq_send() did not return success");
failure=1;
}
mq_close(queue);
mq_unlink(qname);
if (failure==1) {
printf("Test FAILED\n");
return PTS_FAIL;
}
printf("Test PASSED\n");
return PTS_PASS;
}
|
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*
* pthread_barrier_wait()
*
* The pthread_barrier_wait() function shall synchronize participating threads
* at the barrier referenced by barrier. The calling thread shall block
* until the required number of threads have called pthread_barrier_wait()
* specifying the barrier.
*
* Steps:
* 1. Main initialize barrier with count 2
* 2. Main create a child thread
* 3. Child thread call pthread_barrier_wait(), should block
* 4. Main call pthread_barrier_wait(), child and main should all return
* from pthread_barrier_wait()
*/
#define _XOPEN_SOURCE 600
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include "posixtest.h"
static pthread_barrier_t barrier;
static int thread_state;
#define NOT_CREATED_THREAD 1
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
static void* fn_chld(void *arg)
{
int rc = 0;
thread_state = ENTERED_THREAD;
printf("child: barrier wait\n");
rc = pthread_barrier_wait(&barrier);
if (rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf("Test FAILED: child: pthread_barrier_wait() got unexpected "
"return code : %d\n" , rc);
exit(PTS_FAIL);
}
else if (rc == PTHREAD_BARRIER_SERIAL_THREAD)
{
printf("child: get PTHREAD_BARRIER_SERIAL_THREAD\n");
}
thread_state = EXITING_THREAD;
pthread_exit(0);
return NULL;
}
void sig_handler()
{
printf("Interrupted by SIGALRM\n");
printf("Test FAILED: main blocked on barrier wait\n");
exit(PTS_FAIL);
}
int main()
{
int cnt = 0;
int rc;
pthread_t child_thread;
struct sigaction act;
/* Set up main thread to handle SIGALRM */
act.sa_flags = 0;
act.sa_handler = sig_handler;
sigfillset(&act.sa_mask);
sigaction(SIGALRM, &act, 0);
printf("Initialize barrier with count = 2\n");
if (pthread_barrier_init(&barrier, NULL, 2) != 0)
{
printf("main: Error at pthread_barrier_init()\n");
return PTS_UNRESOLVED;
}
printf("main: create child thread\n");
thread_state = NOT_CREATED_THREAD;
if (pthread_create(&child_thread, NULL, fn_chld, NULL) != 0)
{
printf("main: Error at pthread_create()\n");
return PTS_UNRESOLVED;
}
/* Expect the child to block*/
cnt = 0;
do{
sleep(1);
}while (thread_state !=EXITING_THREAD && cnt++ < 2);
if (thread_state == EXITING_THREAD)
{
/* child thread did not block */
printf("Test FAILED: child thread did not block on "
"pthread_barrier_wait()\n");
exit(PTS_FAIL);
}
else if (thread_state != ENTERED_THREAD)
{
printf("Unexpected thread state: %d\n", thread_state);
exit(PTS_UNRESOLVED);
}
printf("main: call barrier wait\n");
/* we should not block here, but just in case we do */
alarm(2);
rc = pthread_barrier_wait(&barrier);
if (rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf("Test FAILED: main: pthread_barrier_wait() get unexpected "
"return code : %d\n" , rc);
exit(PTS_FAIL);
}
else if (rc == PTHREAD_BARRIER_SERIAL_THREAD)
{
printf("main: got PTHREAD_BARRIER_SERIAL_THREAD\n");
}
/* We expected the child returned from barrier wait */
cnt = 1;
do{
sleep(1);
}while (thread_state != EXITING_THREAD && cnt++ < 3);
if (thread_state == ENTERED_THREAD)
{
printf("Test FAILED: child thread still blocked on "
"barrier wait\n");
return PTS_FAIL;
}
else if (thread_state != EXITING_THREAD)
{
printf("main: Unexpected thread state: %d\n", thread_state);
return PTS_UNRESOLVED;
}
if (pthread_join(child_thread, NULL) != 0)
{
printf("main: Error at pthread_join()\n");
exit(PTS_UNRESOLVED);
}
if (pthread_barrier_destroy(&barrier) != 0)
{
printf("Error at pthread_barrier_destroy()");
return PTS_UNRESOLVED;
}
printf("Test PASSED\n");
return PTS_PASS;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.