text stringlengths 4 6.14k |
|---|
#ifndef GUICONSTANTS_H
#define GUICONSTANTS_H
/* Milliseconds between model updates */
static const int MODEL_UPDATE_DELAY = 250;
/* AskPassphraseDialog -- Maximum passphrase length */
static const int MAX_PASSPHRASE_SIZE = 1024;
/* AtheistCoinGUI -- Size of icons in status bar */
static const int STATUSBAR_ICONSIZE = 16;
/* Invalid field background style */
#define STYLE_INVALID "background:#FF8080"
/* Transaction list -- unconfirmed transaction */
#define COLOR_UNCONFIRMED QColor(214, 214, 214)
/* Transaction list -- negative amount */
#define COLOR_NEGATIVE QColor(255, 000, 000)
/* Transaction list -- bare address (without label) */
#define COLOR_BAREADDRESS QColor(255, 255, 255)
/* Tooltips longer than this (in characters) are converted into rich text,
so that they can be word-wrapped.
*/
static const int TOOLTIP_WRAP_THRESHOLD = 80;
/* Maximum allowed URI length */
static const int MAX_URI_LENGTH = 255;
/* QRCodeDialog -- size of exported QR Code image */
#define EXPORT_IMAGE_SIZE 256
#endif // GUICONSTANTS_H
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <IDEFoundation/IDERunnable.h>
#import "DVTXMLUnarchiving.h"
@class IDESchemeBuildableReference, NSString;
@interface IDEBuildableProductRunnable : IDERunnable <DVTXMLUnarchiving>
{
id <IDEBuildableProduct> _buildableProduct;
IDESchemeBuildableReference *_buildableReference;
}
+ (id)keyPathsForValuesAffectingBuildableProduct;
+ (id)keyPathsForValuesAffectingHasRunnablePath;
+ (id)keyPathsForValuesAffectingDisplayName;
@property(retain) IDESchemeBuildableReference *buildableReference; // @synthesize buildableReference=_buildableReference;
- (void).cxx_destruct;
- (void)dvt_encodeRelationshipsWithXMLArchiver:(id)arg1 version:(id)arg2;
- (void)dvt_encodeAttributesWithXMLArchiver:(id)arg1 version:(id)arg2;
- (void)addBuildableProductReference:(id)arg1 fromXMLUnarchiver:(id)arg2;
- (void)addBuildableReference:(id)arg1 fromXMLUnarchiver:(id)arg2;
- (void)dvt_awakeFromXMLUnarchiver:(id)arg1;
- (void)resolveBuildableFromImport;
- (void)setScheme:(id)arg1;
@property(readonly) id <IDEBuildableProduct> buildableProduct; // @synthesize buildableProduct=_buildableProduct;
- (int)runnableType;
- (id)runnableUTIType:(id *)arg1;
- (BOOL)hasRunnablePath;
- (id)pathToRunnableForBuildParameters:(id)arg1;
- (BOOL)isBlueprint;
- (id)toolTip;
- (id)bundleIdentifier;
- (id)displayName;
- (id)initFromXMLUnarchiver:(id)arg1 archiveVersion:(float)arg2;
- (id)initWithBuildableProduct:(id)arg1 scheme:(id)arg2;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
|
//
// BDVRCustomRecognitonViewController.h
// BDVRClientSample
//
// Created by Baidu on 13-9-25
// Copyright 2013 Baidu Inc. All rights reserved.
//
// 头文件
#import <UIKit/UIKit.h>
#import "BDVoiceRecognitionClient.h"
#import "A_VoiceViewController.h"
// 前向声明
@class BDVRViewController;
// @class - BDVRCustomRecognitonViewController
// @brief - 语音搜索界面的实现类
@interface BDVRCustomRecognitonViewController : UIViewController<MVoiceRecognitionClientDelegate>
{
UIImageView *_dialog;
A_VoiceViewController *clientSampleViewController;
NSTimer *_voiceLevelMeterTimer; // 获取语音音量界别定时器
}
// 属性
@property (nonatomic, retain) UIImageView *dialog;
@property (nonatomic, assign) A_VoiceViewController *clientSampleViewController;
@property (nonatomic, retain) NSTimer *voiceLevelMeterTimer;
- (void)startVoiceLevelMeterTimer;
- (void)freeVoiceLevelMeterTimerTimer;
// 方法
- (void)cancel:(id)sender;
@end // BDVRCustomRecognitonViewController
|
#ifndef _PLUGIN_H
#define _PLUGIN_H
#include "xLCB.h"
//menu identifiers
#define MENU_SEPARATOR 0
#define MENU_ABOUT 1
#define MENU_COMMENTS_EXPORT 2
#define MENU_COMMENTS_IMPORT 3
#define MENU_COMMENTS_CLEAR 4
#define MENU_LABELS_EXPORT 5
#define MENU_LABELS_IMPORT 6
#define MENU_LABELS_CLEAR 7
#define MENU_BP_EXPORT 8
#define MENU_BP_IMPORT 9
#define MENU_ABOUT_DISASM 11
#define MENU_COMMENTS_EXPORT_DISASM 12
#define MENU_COMMENTS_IMPORT_DISASM 13
#define MENU_COMMENTS_CLEAR_DISASM 14
#define MENU_LABELS_EXPORT_DISASM 15
#define MENU_LABELS_IMPORT_DISASM 16
#define MENU_LABELS_CLEAR_DISASM 17
#define MENU_BP_EXPORT_DISASM 18
#define MENU_BP_IMPORT_DISASM 19
//functions
void pluginInit(PLUG_INITSTRUCT* initStruct);
void pluginStop();
void pluginSetup();
#endif // _PLUGIN_H |
#pragma once
// The BuildingCompletion class is used to describe how far along a Build-Item is to completion.
// For example, if a city is building a battleship, and it has completed 15 turns of production, this class describes that.
// This information is useful to the AI so that it knows to continue building items which are partially completed.
class CEOSAIBuildCompletion
{
public:
CEOSAIBuildCompletion()
{
m_fPercentComplete01 = 0.0f;
m_fTimeUntilCompletion = 0.0f;
}
float GetPercentComplete(){ return m_fPercentComplete01; } // Ranges from 0.0 to 1.0
float TimeUntilCompletion(){ return m_fTimeUntilCompletion; }
CEOSAIBuildOption* GetAIBuildOption(){ return m_pAIBuildOption; }
//void AddToProductionInvested( float fProd ){ m_fProductionInvested += fProd; }
void SetProductionInvested( float fProd ){ m_fProductionInvested = fProd; }
float GetProductionInvested(){ return m_fProductionInvested; }
CEOSAIBuildOption* m_pAIBuildOption;
//CString m_strItemInProduction;
float m_fPercentComplete01;
float m_fTimeUntilCompletion;
float m_fProductionInvested;
};
|
//
// FirstRequest.h
// SUIMVVMDemo
//
// Created by yuantao on 16/4/8.
// Copyright © 2016年 lovemo. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SMKRequestProtocol.h"
#import "NSObject+SMKRequest.h"
@interface FirstRequest : NSObject<SMKRequestProtocol>
@end
|
// Copyright 2017 ibelie, Chen Jie, Joungtao. All rights reserved.
// Use of this source code is governed by The MIT License
// that can be found in the LICENSE file.
#ifndef TYPY_FIXEDPOINT_H__
#define TYPY_FIXEDPOINT_H__
#include "typy.h"
#define FIXEDPOINT FixedPoint<precision, floor>
namespace typy {
template <int precision, int floor> struct FixedPoint {
typedef FixedPoint ValueType;
enum {
FieldType = WireFormatLite::TYPE_INT32,
WireType = WireFormatLite::WIRETYPE_VARINT,
};
enum { Precision = 10 * FixedPoint<precision - 1, 0>::Precision };
int32 value;
inline operator double() const { return (double)value / FIXEDPOINT::Precision + floor; }
inline FixedPoint& operator=(const double& v) { value = (int32)((v - floor) * FIXEDPOINT::Precision); return *this; }
};
template <> struct FixedPoint<0, 0> {
enum { Precision = 1 };
};
template <int precision, int floor>
inline PyObject* GetPyObject(const FIXEDPOINT& value) {
return PyFloat_FromDouble(value);
}
template <int precision, int floor>
bool CheckAndSet(PyObject* arg, FIXEDPOINT& value, const char* err) {
if (!PyInt_Check(arg) && !PyLong_Check(arg) && !PyFloat_Check(arg)) {
FormatTypeError(arg, err);
return false;
}
CopyFrom(value, PyFloat_AsDouble(arg));
return true;
}
template <int precision, int floor>
inline void CopyFrom(FIXEDPOINT& lvalue, const double& rvalue) {
lvalue = rvalue;
}
template <int precision, int floor>
inline int Visit(const FIXEDPOINT& value, visitproc visit, void* arg) { return 0; }
template <int precision, int floor>
inline void Clear(FIXEDPOINT& value) { value.value = 0; }
template <int precision, int floor>
inline void MergeFrom(FIXEDPOINT& lvalue, const double& rvalue) {
if (rvalue != floor) { CopyFrom(lvalue, rvalue); }
}
template <int precision, int floor>
inline void ByteSize(int& total, int tagsize, const FIXEDPOINT& value) {
if (value.value != 0) { total += tagsize + WireFormatLite::Int32Size(value.value); }
}
template <int precision, int floor>
inline void Write(int field_number, const FIXEDPOINT& value, CodedOutputStream* output) {
if (value.value != 0) { WireFormatLite::WriteInt32(field_number, value.value, output); }
}
template <int precision, int floor>
inline void WriteTag(int tag, const FIXEDPOINT& value, CodedOutputStream* output) {
WireFormatLite::WriteTag(tag, WireFormatLite::WIRETYPE_VARINT, output);
}
template <int precision, int floor>
inline bool Read(FIXEDPOINT& value, CodedInputStream* input) {
return WireFormatLite::ReadPrimitive<int32,
WireFormatLite::FieldType(Type<int32>::FieldType)>(input, &value.value);
}
template <int precision, int floor>
inline PyObject* Json(FIXEDPOINT& value, bool slim) {
return (!slim || value.value != 0) ? GetPyObject(value) : NULL;
}
template <int precision, int floor>
inline bool FromJson(FIXEDPOINT& value, PyObject* json) {
return CheckAndSet(json, value, "FromJson FixedPoint error, ");
}
template <int precision, int floor>
inline void ByteSize(int& total, int tagsize, List< FIXEDPOINT >* value) {
if (value == NULL) { return; }
int data_size = 0;
for (int i = 0; i < value->size(); i++) {
data_size += WireFormatLite::Int32Size(value->Get(i).value);
}
if (data_size > 0) {
total += tagsize + WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
value->_cached_size = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total += data_size;
}
template <int precision, int floor>
inline void Write(int field_number, List< FIXEDPOINT >* value, CodedOutputStream* output) {
if (value->_cached_size > 0) {
WireFormatLite::WriteTag(field_number, WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(value->_cached_size);
}
for (int i = 0; i < value->size(); i++) {
WireFormatLite::WriteInt32NoTag(value->Get(i).value, output);
}
}
template <int precision, int floor>
inline void WriteTag(int tag, List< FIXEDPOINT >* value, CodedOutputStream* output) {
WireFormatLite::WriteTag(tag, WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
}
template <int precision, int floor>
inline bool Read(List< FIXEDPOINT >*& value, CodedInputStream* input) {
if (value == NULL) { value = new List< FIXEDPOINT >; }
FIXEDPOINT item;
if (!Read(item, input)) { return false; }
value->Add(item);
return true;
}
template <int precision, int floor>
inline bool ReadPacked(List< FIXEDPOINT >*& value, CodedInputStream* input) {
if (value == NULL) { value = new List< FIXEDPOINT >; }
uint32 length;
if (!input->ReadVarint32(&length)) return false;
CodedInputStream::Limit limit = input->PushLimit(length);
while (input->BytesUntilLimit() > 0) {
FIXEDPOINT item;
if (!Read(item, input)) { return false; }
value->Add(item);
}
input->PopLimit(limit);
return true;
}
template <int precision, int floor>
inline bool ReadRepeated(int tagsize, uint32 tag, List< FIXEDPOINT >*& value, CodedInputStream* input) {
if (value == NULL) { value = new List< FIXEDPOINT >; }
FIXEDPOINT item;
if (!Read(item, input)) { return false; }
value->Add(item);
int elements_already_reserved = value->Capacity() - value->size();
while (elements_already_reserved > 0 && input->ExpectTag(tag)) {
if (!Read(item, input)) { return false; }
value->AddAlreadyReserved(item);
elements_already_reserved--;
}
return true;
}
} // namespace typy
#endif // TYPY_FIXEDPOINT_H__
|
/*
COPYRIGHT 2012 ESRI
TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
Unpublished material - all rights reserved under the
Copyright Laws of the United States and applicable international
laws, treaties, and conventions.
For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts and Legal Services Department
380 New York Street
Redlands, California, 92373
USA
email: contracts@esri.com
*/
@class AGSLayer;
/** @file AGSDynamicLayer.h */ //Required for Globals API doc
/** @brief A base class for dynamic layers.
A base class for dynamic layers. You would typically work with concrete dynamic
layers represented by the sub-classes of this class, for instance,
@c AGSDynamicMapServiceLayer.
@define{AGSDynamicLayer.h,ArcGIS}
@agssince{1.0, 10.2}
*/
@interface AGSDynamicLayer : AGSLayer
/** The time interval in seconds that will cause the layer to auto-refresh.
If 0 or less is specified, the layer will not auto-refresh itself.
@agssince{10.1.1, 10.2}
*/
@property (nonatomic, assign) double autoRefreshInterval;
/** The brightness of the layer.
Default value is 0. Values in the range -100.0 to 100.0 are valid.
Values outside that range are ignored.
@since 10.2.3
*/
@property (nonatomic, assign) CGFloat brightness;
/** The contrast of the layer.
Default value is 0. Values in the range -100.0 to 100.0 are valid.
Values outside that range are ignored.
@since 10.2.3
*/
@property (nonatomic, assign) CGFloat contrast;
/** The gamma of the layer.
Default value is 0. Values in the range -100.0 to 100.0 are valid.
Values outside that range are ignored.
@since 10.2.3
*/
@property (nonatomic, assign) CGFloat gamma;
@end
|
#ifndef LEVELEDITOR_H
#define LEVELEDITOR_H
#include <QWidget>
#include "ui_leveleditor.h"
QT_BEGIN_NAMESPACE
class QFileSystemModel;
class QFileSystemWatcher;
class QSortFilterProxyModel;
QT_END_NAMESPACE
class Resource;
class Model;
class LevelEditor : public QWidget
{
Q_OBJECT
public:
explicit LevelEditor(QWidget *parent = 0);
~LevelEditor();
void scale(qreal f);
public Q_SLOTS:
/**
* @brief show grid if @n > 1 & @n < 50
* @param n
*/
void showGrid(int n);
private Q_SLOTS:
void on_resToolButton_clicked();
/**
* @brief onFilechanged
* - file was modified, rename, remove
*
* Note that QFileSystemWatcher stops monitoring files once they have been
* renamed or removed from disk, and directories once they have been removed
* from disk.
*/
void onFilechanged(QString file);
/**
* @brief onDirectoryChaned
* - directory or its contents is modified or removed
*/
void onDirectoryChaned(QString dir);
void on_filter_textChanged(const QString &arg1);
void on_toolClone_clicked();
void on_toolDelete_clicked();
void on_physicBoundToolButton_toggled(bool checked);
void on_gravityToolButton_toggled(bool checked);
void on_cloneToolButton_toggled(bool checked);
void on_worldSizeToolButton_toggled(bool checked);
void on_bezierToolButton_toggled(bool checked);
private:
Ui::LevelEditor *ui;
Model *m_fileModel;
QFileSystemWatcher *m_watcher;
Resource *m_resource;
QSortFilterProxyModel *m_proxyMode;
QList<QToolButton*> m_buttons;
};
#endif // LEVELEDITOR_H
|
// Copyright (c) 2011-2013 The Yescoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef TRANSACTIONDESCDIALOG_H
#define 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 // TRANSACTIONDESCDIALOG_H
|
#pragma once
#include "Madgine/resources/resourceloader.h"
#include "textureloader.h"
#include "util/directx12texture.h"
namespace Engine {
namespace Render {
struct MADGINE_DIRECTX12_EXPORT DirectX12TextureLoader : Resources::VirtualResourceLoaderImpl<DirectX12TextureLoader, DirectX12Texture, TextureLoader> {
DirectX12TextureLoader();
bool loadImpl(DirectX12Texture &tex, ResourceDataInfo &info);
void unloadImpl(DirectX12Texture &tex);
bool create(Texture &texture, TextureType type, DataFormat format/*, D3D12_BIND_FLAG bind*/) override;
virtual void setData(Texture &tex, Vector2i size, const ByteBuffer &data) override;
virtual void setSubData(Texture &tex, Vector2i offset, Vector2i size, const ByteBuffer &data) override;
};
}
}
RegisterType(Engine::Render::DirectX12TextureLoader);
|
/// \login.h
/// \brief 登录界面
/// \author 汪超
#ifndef LOGIN_H
#define LOGIN_H
#include <QMainWindow>
namespace Ui
{
class Login;
}
class Login : public QMainWindow
{
Q_OBJECT
public:
explicit Login(QWidget *parent = 0);
~Login();
private slots:
void on_loginButton_clicked();
void on_registerButton_clicked();
void on_setServerButton_clicked();
void on_cancelButton_clicked();
private:
void loadStatusFromDB();
void saveStatusToDB();
private:
Ui::Login* ui;
};
#endif // LOGIN_H
|
#ifndef EMBEDDEDHELPERLIBRARY_CIRCULAR_BUFFER_H
#define EMBEDDEDHELPERLIBRARY_CIRCULAR_BUFFER_H
namespace ehl
{
using isr_circular_buffer_size_t = unsigned int;
template <typename T, isr_circular_buffer_size_t buffer_elements>
class isr_circular_buffer
{
private:
volatile isr_circular_buffer_size_t head{0};
volatile isr_circular_buffer_size_t tail{0};
volatile T buffer[buffer_elements];
public:
struct popped_value
{
bool valid{false};
T value;
popped_value() = default;
popped_value(bool valid, T value)
: valid{valid}
, value{value}
{
}
};
isr_circular_buffer_size_t length() const;
bool push(T value);
popped_value pop();
};
template <typename T, isr_circular_buffer_size_t buffer_elements>
isr_circular_buffer_size_t isr_circular_buffer<T, buffer_elements>::length()
const
{
if (tail > head)
return (buffer_elements - tail) + head;
return head - tail;
}
template <typename T, isr_circular_buffer_size_t buffer_elements>
bool isr_circular_buffer<T, buffer_elements>::push(T value)
{
isr_circular_buffer_size_t next_head = (head + 1) % buffer_elements;
if (next_head == tail)
return false;
buffer[head] = value;
head = next_head;
return true;
}
template <typename T, isr_circular_buffer_size_t buffer_elements>
auto isr_circular_buffer<T, buffer_elements>::pop() -> popped_value
{
if (tail == head)
{
return popped_value{};
}
popped_value v{true, buffer[tail]};
tail = (tail + 1) % buffer_elements;
return v;
}
} // namespace ehl
#endif // EMBEDDEDHELPERLIBRARY_CIRCULAR_BUFFER_H
|
//
// DHAppDelegate.h
// DHSidebarViewController
//
// Created by Jay Roberts on 3/6/13.
// Copyright (c) 2013 DesignHammer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DHAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello World!\n");
printf("I turned 100 today!\n");
printf("But I am Old\n");
return 0;
}
|
//
// Created by Anastasiya Gorban on 7/31/15.
// Copyright (c) 2015 Techery. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "OSActor.h"
@interface OSActorExecutor : NSObject <OSActorHandler>
@property(nonatomic, readonly) id<OSActorHandler> actorHandler;
@property(nonatomic, readonly) NSOperationQueue *operationQueue;
- (instancetype)initWithActorHandler:(id <OSActorHandler>)actorHandler;
+ (instancetype)executorWithActorHandler:(id <OSActorHandler>)actorHandler;
@end |
//
// Created by deangeli on 5/21/17.
//
#ifndef LIBFL_VECTORUTIL_H
#define LIBFL_VECTORUTIL_H
#include "vector.h"
#define mergeVectorsSameType_macro(type, vector1, size1, vector2, size2, vector3) \
if(vector1 == NULL && vector2 == NULL){ \
vector3 = NULL; \
}\
else if(vector1 == NULL){ \
vector3 = (type*)calloc(size2,sizeof(type)); \
memmove(vector3,vector2, size2*(sizeof(type))); \
}\
else if(vector2 == NULL){\
vector3 = (type*)calloc(size1,sizeof(type));\
memmove(vector3,vector1,size1* (sizeof(type))); \
} \
else{\
vector3 = (type *) calloc(size1+size2,sizeof(vector3)); \
memmove(vector3,vector1, size1*(sizeof(type)) ); \
type* shiftedVector = vector3 + size1; \
memmove(shiftedVector,vector2, size2*(sizeof(type)) );\
}
#define appendVectorsSameType_macro(type, vector_destination, vector_source, destinationShiftIndex, sizeSource) \
if(vector_destination != NULL && vector_source != NULL){ \
type* shiftedVector = vector_destination + destinationShiftIndex;\
memmove(shiftedVector,vector_source, sizeSource*(sizeof(type)) );\
}\
#define mergeVectorsDifferentTypes_macro(type1, vector1, size1, type2, vector2, size2, type3, vector3) \
if(vector1 == NULL && vector2 == NULL){ \
vector3 = NULL; \
}\
else if(vector1 == NULL){ \
vector3 = (type3*)calloc(size2,sizeof(type3)); \
for(int i=0; i<size2; i++){\
vector3[i] = vector2[i];\
}\
}\
else if(vector2 == NULL){\
vector3 = (type3*)calloc(size1,sizeof(type3));\
for(int i=0; i<size1; i++){\
vector3[i] = vector1[i];\
}\
} \
else{\
vector3 = (type3 *) calloc(size1+size2,sizeof(type3)); \
for(int i=0; i < size1; i++){\
vector3[i] = vector1[i];\
}\
for(int i=0; i<size2; i++){\
vector3[size1+i] = vector2[i];\
}\
}
inline double * myInsertionSort(double* vector, size_t n,size_t * indecesOrdered){
double* auxVector = (double*)calloc(n,sizeof(double));
double aux;
size_t auxIndex;
for (size_t i = 0; i < n; ++i) {
auxVector[i] = vector[i];
indecesOrdered[i] = i;
for (size_t j = i; j > 0; --j) {
if(auxVector[j-1] > auxVector[j]){
aux = auxVector[j];
auxVector[j] = auxVector[j-1];
auxVector[j-1] = aux;
auxIndex = indecesOrdered[j];
indecesOrdered[j] = indecesOrdered[j-1];
indecesOrdered[j-1] = auxIndex;
}else{
break;
}
}
}
return auxVector;
}
inline double* mergeVectors(double* vector1, size_t size1, double* vector2, size_t size2){
double *mergedVector = NULL;
mergeVectorsSameType_macro( double, vector1, size1, vector2, size2, mergedVector);
return mergedVector;
}
inline void myInsertionSortInplace(double* vector, size_t n,size_t * indecesOrdered){
double aux;
size_t auxIndex;
for (size_t i = 0; i < n; ++i) {
indecesOrdered[i] = i;
for (size_t j = i; j > 0; --j) {
if(vector[j-1] > vector[j]){
aux = vector[j];
vector[j] = vector[j-1];
vector[j-1] = aux;
auxIndex = indecesOrdered[j];
indecesOrdered[j] = indecesOrdered[j-1];
indecesOrdered[j-1] = auxIndex;
}else{
break;
}
}
}
}
inline void myInsertionSortInplace(int* vector, size_t n){
int aux;
for (size_t i = 0; i < n; ++i) {
for (size_t j = i; j > 0; --j) {
if(vector[j-1] > vector[j]){
aux = vector[j];
vector[j] = vector[j-1];
vector[j-1] = aux;
}else{
break;
}
}
}
}
inline GVector* findUniquesInIntegerVector(GVector* vector,bool ordered){
GVector* uniques = createNullVector(vector->size,sizeof(int));
VECTOR_GET_ELEMENT_AS(int,uniques,0) = VECTOR_GET_ELEMENT_AS(int,vector,0);
size_t sizeUniquesVector = 1;
size_t countEquals;
for (size_t vectorIndex = 1; vectorIndex < vector->size; ++vectorIndex) {
countEquals = 0;
for (size_t uniquesVectorIndex = 0; uniquesVectorIndex < sizeUniquesVector; ++uniquesVectorIndex) {
if(VECTOR_GET_ELEMENT_AS(int,vector,vectorIndex) ==
VECTOR_GET_ELEMENT_AS(int,uniques,uniquesVectorIndex)){
countEquals++;
}
}
if(countEquals == 0){
VECTOR_GET_ELEMENT_AS(int,uniques,sizeUniquesVector) = VECTOR_GET_ELEMENT_AS(int,vector,vectorIndex);
sizeUniquesVector++;
}
}
uniques->size = sizeUniquesVector;
shrinkToFit(uniques);
if(ordered){
myInsertionSortInplace((int*)uniques->data,uniques->size);
}
return uniques;
}
#endif //LIBFL_VECTORUTIL_H
|
/*
* libdpkg - Debian packaging suite library routines
* pkg-array.h - primitives for pkg array handling
*
* Copyright © 2009 Guillem Jover <guillem@debian.org>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef LIBDPKG_PKG_ARRAY_H
#define LIBDPKG_PKG_ARRAY_H
#include <dpkg/dpkg-db.h>
#include <dpkg/pkg.h>
DPKG_BEGIN_DECLS
/**
* @defgroup pkg-array Package array primitives
* @ingroup dpkg-public
* @{
*/
/**
* Holds an array of pointers to package data.
*/
struct pkg_array {
int n_pkgs;
struct pkginfo **pkgs;
};
void pkg_array_init_from_db(struct pkg_array *a);
void pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort);
void pkg_array_destroy(struct pkg_array *a);
/** @} */
DPKG_END_DECLS
#endif /* LIBDPKG_PKG_ARRAY_H */
|
//
// MySharedViewController.h
// SUMusic
//
// Created by 万众科技 on 16/2/2.
// Copyright © 2016年 KevinSu. All rights reserved.
//
#import "BaseViewController.h"
@interface MySharedViewController : BaseViewController
@end
|
//
// Members.h
// Bage
//
// Created by Duger on 14-1-13.
// Copyright (c) 2014年 Duger. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class MemberPoints;
@interface Members : NSManagedObject
@property (nonatomic, retain) NSString * m_Jid;
@property (nonatomic, retain) NSNumber * m_Lv;
@property (nonatomic, retain) NSNumber * m_stars;
@property (nonatomic, retain) NSSet *pointList;
@end
@interface Members (CoreDataGeneratedAccessors)
- (void)addPointListObject:(MemberPoints *)value;
- (void)removePointListObject:(MemberPoints *)value;
- (void)addPointList:(NSSet *)values;
- (void)removePointList:(NSSet *)values;
@end
|
//
// UINavigationController+DragToDismiss.h
// TransitionViewController
//
// Created by ThuyenBV on 8/5/15.
// Copyright (c) 2015 ThuyenBV. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TransitionObject.h"
#import "DetectScrollPanGesture.h"
@interface UINavigationController (DragToDismiss) <UIGestureRecognizerDelegate>
@property (nonatomic, strong) TransitionObject *objTransition;
@property (strong, nonatomic) DetectScrollPanGesture *panGesture;
- (void)setUpTransition;
- (void)dismissInteraction:(BOOL)isInteraction animation:(BOOL)animated;
- (void)didPanWithGestureRecognizer:(UIPanGestureRecognizer *)panGestureRecognizer;
@end
|
/*
* FLObjcRuntime.h
* PackMule
*
* Created by Mike Fullerton on 6/29/11.
* Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton.
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
*
*/
#import "FLCoreRequired.h"
#import <objc/runtime.h>
#import "FLRuntimeInfo.h"
#define FLRuntimeGetSelectorName(__SEL__) sel_getName(__SEL__)
#define FLSelectorsAreEqual(LHS, RHS) sel_isEqual(LHS, RHS)
typedef void (^FLRuntimeClassVisitor)(FLRuntimeInfo info, BOOL* stop);
typedef void (^FLRuntimeSelectorVisitor)(FLRuntimeInfo info, BOOL* stop);
typedef void (^FLRuntimeFilterBlock)(FLRuntimeInfo info, BOOL* passed, BOOL* stop);
extern void FLSwizzleInstanceMethod(Class c, SEL originalSelector, SEL newSelector);
extern void FLSwizzleClassMethod(Class c, SEL originalSelector, SEL newSelector);
extern int FLArgumentCountForSelector(SEL selector);
// doesn't count the first two hidden arguments so a selector like this @selector(foo:) will return 1
extern int FLArgumentCountForClassSelector(Class aClass, SEL selector);
extern NSArray* FLRuntimeMethodsForClass(Class aClass, FLRuntimeFilterBlock filterOrNil);
extern void FLRuntimeVisitEachSelectorInClassAndSuperclass(Class aClass, FLRuntimeSelectorVisitor visitor); // not including NSObject
extern BOOL FLRuntimeVisitEachSelectorInClass(Class aClass, FLRuntimeSelectorVisitor visitor);
extern BOOL FLRuntimeVisitEveryClass(FLRuntimeClassVisitor visitor);
extern NSArray* FLRuntimeAllClassesMatchingFilter(FLRuntimeFilterBlock filter);
extern NSArray* FLRuntimeClassesImplementingInstanceMethod(SEL theMethod);
extern NSArray* FLRuntimeSubclassesForClass(Class theClass);
extern BOOL FLRuntimeClassHasSubclass(Class aSuperclass, Class aSubclass);
extern BOOL FLRuntimeClassRespondsToSelector(Class aClass, SEL aSelector);
extern BOOL FLClassConformsToProtocol(Class aClass, Protocol* aProtocol);
#if DEBUG
void FLRuntimeLogMethodsForClass(Class aClass);
#endif
#if EXPERIMENTAL
@interface NSObject (FLObjcRuntime)
// http://www.cocoawithlove.com/2008/03/supersequent-implementation.html
// Lookup the next implementation of the given selector after the
// default one. Returns nil if no alternate implementation is found.
- (IMP)getImplementationOf:(SEL)lookup after:(IMP)skip;
@end
#define invokeSupersequent(...) \
([self getImplementationOf:_cmd \
after:impOfCallingMethod(self, _cmd)]) \
(self, _cmd, ##__VA_ARGS__)
#define invokeSupersequentNoParameters() \
([self getImplementationOf:_cmd \
after:impOfCallingMethod(self, _cmd)]) \
(self, _cmd)
#endif |
#ifndef RANDOM_H
#define RANDOM_H
#include <stdint.h>
#include <stddef.h>
#include "sha256.h"
struct fortuna_generator {
uint8_t key[32]; // 256-bit AES key
union {
struct {
uint64_t l; // 128-bit counter
uint64_t h;
} counter;
uint8_t counter_bytes[16];
};
};
typedef struct fortuna_generator fortuna_generator_t;
struct fortuna_pool {
SHA256_CTX ctx;
uint32_t len;
};
typedef struct fortuna_pool fortuna_pool_t;
struct fortuna_prng {
fortuna_generator_t gen;
uint32_t reseeds;
fortuna_pool_t pools[32];
};
typedef struct fortuna_prng fortuna_prng_t;
void rand_init(void);
int rand_data(void* out, size_t bytes);
void rand_on_rtc(void);
void rand_on_kbd(void);
void rand_add_random_event(void* data, uint8_t length, uint8_t source, uint8_t pool);
#endif
|
/*
* The X Men, June 1996
* Copyright (c) 1996 Probe Entertainment Limited
* All Rights Reserved
*
* Authors: Phillipd, Philipy
*/
/*
* Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved.
*
* File: d3dappi.h
*
* Internal header. Part of D3DApp.
*
* D3DApp is a collection of helper functions for Direct3D applications.
* D3DApp consists of the following files:
* d3dapp.h Main D3DApp header to be included by application
* d3dappi.h Internal header
* d3dapp.c D3DApp functions seen by application.
* ddcalls.c All calls to DirectDraw objects except textures
* d3dcalls.c All calls to Direct3D objects except textures
* texture.c Texture loading and managing texture list
* misc.c Miscellaneous calls
*/
#ifndef __D3DAPPI_H__
#define __D3DAPPI_H__
/*
* INCLUDED HEADERS
*/
#define WIN32_EXTRA_LEAN
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <search.h>
#include <ddraw.h>
#include <d3d.h>
#include "d3dapp.h"
#include "d3dmacs.h"
#include "d3dmain.h"
#include "lclib.h" /* lclib is a override for standard string lib */
// ProjX 09438c20-e06a-11ce-8681-00aa006c5d58
//DEFINE_GUID(PROJX_GUID,0x09438c20,0xe06a,0x11CE,0x86,0x81,0x00,0xaa,0x00,0x6c,0x5d,0x58);
#ifdef __cplusplus
extern "C" {
#endif
#define TRILINEAR_MENU_OPTION
/*
* MACROS
*/
#undef ATTEMPT
#define ATTEMPT(x) if (!(x)) goto exit_with_error
#undef RELEASE
#define RELEASE(x) if (x) { x->lpVtbl->Release(x); x = NULL; }
#undef MAX
#define MAX(x, y) ((x) > (y)) ? (x) : (y)
#undef MIN
#define MIN(x, y) ((x) > (y)) ? (y) : (x)
#undef ZEROMEM
#define ZEROMEM(x) memset(&x, 0, sizeof(x))
/*
* GLOBAL VARIABLES
* see d3dapp.c for descriptions
*/
extern D3DAppInfo d3dappi;
extern D3DAppRenderState d3dapprs;
extern BOOL bD3DAppInitialized;
extern HRESULT LastError;
extern LPDIRECTDRAWCLIPPER lpClipper;
extern LPDIRECTDRAWPALETTE lpPalette;
extern BOOL(*D3DDeviceDestroyCallback)(LPVOID);
extern LPVOID D3DDeviceDestroyCallbackContext;
extern BOOL(*D3DDeviceCreateCallback)(int, int, LPDIRECT3DVIEWPORT*, LPVOID);
extern LPVOID D3DDeviceCreateCallbackContext;
extern BOOL bPrimaryPalettized;
extern BOOL bPaletteActivate;
extern BOOL bIgnoreWM_SIZE;
extern PALETTEENTRY ppe[256];
extern PALETTEENTRY Originalppe[256];
extern char LastErrorString[256];
extern SIZE szLastClient;
extern SIZE szBuffers;
extern int CallbackRefCount;
#ifdef __cplusplus
};
#endif
/*
* INTERNAL FUNCTION PROTOTYPES
*/
BOOL D3DAppISetRenderState(void);
BOOL D3DAppIEnumDrivers(void);
BOOL D3DAppIPickDriver(int* driver, DWORD depths);
BOOL D3DAppICreateD3D(void);
BOOL D3DAppIEnumTextureFormats(void);
BOOL D3DAppICreateZBuffer(int w, int h, int driver);
BOOL D3DAppICreateDevice(int driver);
BOOL D3DAppISetCoopLevel(HWND hwnd, BOOL bFullscreen);
BOOL D3DAppISetDisplayMode(int w, int h, int bpp);
BOOL D3DAppICheckForPalettized(void);
BOOL D3DAppIRestoreDispMode(void);
BOOL D3DAppIVerifyDriverAndMode(int* lpdriver, int* lpmode);
BOOL D3DAppIFilterDrivers(int mode);
DWORD D3DAppTotalVideoMemory(void);
DWORD D3DAppFreeVideoMemory(void);
BOOL D3DAppIEnumDisplayModes(void);
BOOL D3DAppIPickDisplayMode(int* mode, DWORD depths);
BOOL D3DAppISetDispMode(int w, int h, int bpp);
BOOL D3DAppICreateDD(DWORD flags);
BOOL D3DAppIFilterDisplayModes(int driver);
HRESULT D3DAppICreateSurface(LPDDSURFACEDESC lpDDSurfDesc,
LPDIRECTDRAWSURFACE FAR *lpDDSurface);
HRESULT D3DAppIGetSurfDesc(LPDDSURFACEDESC lpDDSurfDesc,
LPDIRECTDRAWSURFACE lpDDSurf);
BOOL D3DAppICreateBuffers(HWND hwnd, int w, int h, int bpp,BOOL bFullscreen);
BOOL D3DAppIRememberWindowsMode(void);
BOOL D3DAppIClearBuffers(void);
DWORD D3DAppIBPPToDDBD(int bpp);
void D3DAppIReleasePathList(void);
void D3DAppISetClientSize(HWND hwnd, int w,int h,BOOL bReturnFromFullscreen);
void D3DAppIGetClientWin(HWND hwnd);
void D3DAppISetDefaults(void);
BOOL D3DAppICallDeviceDestroyCallback(void);
BOOL D3DAppICallDeviceCreateCallback(int w, int h);
void D3DAppIMergeRectLists(int* dstnum, LPD3DRECT dst, int src1num,
LPD3DRECT src1, int src2num, LPD3DRECT src2);
void D3DAppICopyRectList(int* dstnum, LPD3DRECT dst, int srcnum,
LPD3DRECT src);
BOOL D3DAppIHandleWM_SIZE(LRESULT* lresult, HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
void __cdecl D3DAppISetErrorString( LPSTR fmt, ... );
void __cdecl dpf( LPSTR fmt, ... );
FILE * D3DAppIFindFile(const char *name, const char *mode);
#endif // __D3DAPPI_H__
|
#ifndef JSUTILS_H
#define JSUTILS_H
#include <string>
#include <fstream>
#include <cassert>
#include <iostream>
#include "../../google/v8/v8.h"
#include "Macros.h"
#include "PrettyPrinter.h"
class JsUtils {
public:
static void forceGarbageCollection() {
/**
* http://athile.net/library/blog/?p=1333
*/
for (unsigned int i = 0; i < 4096; ++i) {
if (v8::V8::IdleNotification())
break;
}
}
static std::string toStdString(v8::Handle<v8::String> str) {
char buffer[str->Utf8Length()];
str->WriteUtf8(buffer, str->Utf8Length());
buffer[str->Utf8Length()] = '\0';
return std::string(buffer);
}
static std::string makeSelfEvaluating(std::string &source) {
std::string leftParen("(");
leftParen.append(source);
leftParen.append(")();");
return leftParen;
}
static std::string makeEvalStatement(std::string &source) {
std::string leftParen("eval(");
leftParen.append(source);
leftParen.append(");");
return leftParen;
}
static v8::Handle<v8::Value> makeFunction(std::string &source) {
std::string final = makeEvalStatement(source);
v8::HandleScope scope;
v8::Handle<v8::String> sc = v8::String::New(final.c_str(), final.length());
v8::Handle<v8::Script> script = v8::Script::Compile(sc);
if(!script.IsEmpty()) {
return scope.Close(script->Run());
} else {
return v8::Undefined();
}
}
static bool loadSource(const char *path, std::string *source, bool ignoreFirstLine=false) {
assert(path);
assert(source);
source->clear();
std::string line;
bool firstline = ignoreFirstLine ? true : false;
std::ifstream in(path);
if(in.is_open()) {
while(in) {
std::getline(in, line);
if(firstline) {
firstline = false;
continue;
}
source->append(line);
source->append("\n");
}
} else {
return false;
}
return true;
}
};
#endif // JSUTILS_H
|
#ifndef LIBUTIL_NODE_H
#define LIBUTIL_NODE_H
#include <stdint.h>
#include <libutil/string.h>
#include <libutil/vector.h>
enum msgu_node_type {
msgnode_stream = 1,
msgnode_file = 2,
msgnode_dir = 3,
};
/*
* objects shared on a host
* nodes can be block devices, sockets or directories
* nodes can contain attribute metadata
* to indicate uptime, availability
*/
struct msgu_node {
uint32_t node_type;
uint32_t node_mode;
uint32_t node_size;
struct msgu_string node_name;
};
void msgu_node_dir_init(struct msgu_node *node, const char *name);
void msgu_node_file_init(struct msgu_node *node, const char *name, size_t size);
void msgu_node_free(struct msgu_node *node);
int msgu_node_is_dir(const struct msgu_node *node);
int msgu_node_print(char *buf, const struct msgu_node *n);
void msgu_node_list_print(char *buf, const struct msgu_vector *q);
/*
* standard functions for strings
*/
size_t msgu_node_size_frag(const void *n);
int msgu_node_read_frag(struct msgu_stream *src, struct msgu_fragment *f, void *n);
int msgu_node_write_frag(struct msgu_stream *dest, struct msgu_fragment *f, const void *n);
hash_t msgu_node_hash(const void *ns);
int msgu_node_cmp(const void *a, const void *b);
static struct msgu_type msgu_node_element = {
.memory_size = sizeof(struct msgu_node),
.serial_size = msgu_node_size_frag,
.read = msgu_node_read_frag,
.write = msgu_node_write_frag,
.hash = msgu_node_hash,
.cmp = msgu_node_cmp,
};
#endif
|
void mpiexchange(int taskid, double *c, int Mx);
void sendtomaster(int taskid, double *c);
void receivefrmworker(double *c);
|
//---------------------------------------------------------------------------
#ifndef ComPtrH
#define ComPtrH
//---------------------------------------------------------------------------
#include <objbase.h>
struct ECom: public Exception { ECom(AnsiString FunctionName, HRESULT hr); HRESULT hr; };
#define COM_CHECKED(expr) {HRESULT hr = (expr); if (!SUCCEEDED(hr)) throw ECom(#expr, hr); }
//---------------------------------------------------------------------------
//#define TRACK_REFCOUNTS
#ifdef TRACK_REFCOUNTS
#include <map>
extern std::map<IUnknown*, unsigned> RefCounts;
#endif
//
// Manage COM-pointers, much like boost::intrusive_ptr does but specially made
// for COM pointers.
//
// In short:
// - call AddRef() when a new reference is created
// - call Release() when a reference is removed
//
// Warning: only use this with pointers to IUnknown or subclasses!!
//
void TComPtrAddRef(IUnknown *p);
void TComPtrRelease(IUnknown *p);
template<class T> GUID uuidof() { return __uuidof(T); }
template<class T> class TComPtr
{
public:
//
// Constructors: construct empty object, construct from contained type pointer, construct from
// other TComPtr object
//
TComPtr(): px(0) { }
explicit TComPtr(T * p, bool DoAddRef=false): px(p)
{
#ifdef TRACK_REFCOUNTS
// Increase our idea of the reference count here because it's assumed that the pointer comes
// from something like QueryInterface() and it had already increased the real reference count.
if (p)
RefCounts[p] += 1;
#endif
if (DoAddRef)
AddRef();
}
explicit TComPtr(IUnknown * p, bool DoAddRef=false): px((T*)p)
{
#ifdef TRACK_REFCOUNTS
// Increase our idea of the reference count here because it's assumed that the pointer comes
// from something like QueryInterface() and it had already increased the real reference count.
if (p)
RefCounts[p] += 1;
#endif
if (DoAddRef)
AddRef();
}
TComPtr(REFCLSID ClassId, REFIID InterfaceId)
{
px = (T*)CoCreateInstance(ClassId, InterfaceId);
#ifdef TRACK_REFCOUNTS
if (px)
RefCounts[px] += 1;
#endif
}
explicit TComPtr(const TComPtr<T> &other): px(other.get())
{
AddRef();
}
//
// Destructor
//
~TComPtr()
{
Release();
}
//
// Assignment operators
// (Release() on old contained pointer, AddRef() on new contained pointer)
//
TComPtr & operator=(const TComPtr<T> &other)
{
if (px == other.px)
return *this;
Release();
px = other.get();
AddRef();
return *this;
}
TComPtr & operator=(T *p)
{
Release();
px = p;
AddRef();
return *this;
}
void reset()
{
Release();
px = NULL;
}
// Conversion operator to TComPtr of base class (i.e. IUnknown)
operator TComPtr<IUnknown>()
{
TComPtr<IUnknown> t;
t = (IUnknown*)px;
return t;
}
// Conversion operator to bool for use in boolean contexts (false if underlying pointer is NULL,
// true otherwise)
operator bool() { return bool(px); }
//
// Access to contained pointer
//
T * get() const { return px; }
T & operator*() const { return *px; }
T * operator->() const { return px; }
private:
T * px;
void Release()
{
if (px)
{
#ifdef TRACK_REFCOUNTS
if (RefCounts[px] == 0)
OutputDebugString("RefCount already 0!!");
#endif
((IUnknown*)px)->Release();
#ifdef TRACK_REFCOUNTS
RefCounts[px] -= 1;
#endif
}
}
void AddRef()
{
if (px)
{
((IUnknown*)px)->AddRef();
#ifdef TRACK_REFCOUNTS
RefCounts[px] += 1;
#endif
}
}
};
//
// Comparison operators
// (just compare the pointers)
//
template<class T, class U> inline bool operator==(TComPtr<T> const &a, TComPtr<U> const &b)
{
return a.get() == b.get();
}
template<class T, class U> inline bool operator!=(TComPtr<T> const &a, TComPtr<U> const &b)
{
return a.get() != b.get();
}
template<class T, class U> inline bool operator<(TComPtr<T> const &a, TComPtr<U> const &b)
{
return a.get() < b.get();
}
//---------------------------------------------------------------------------
IUnknown* CoCreateInstance(REFCLSID ClassId, REFIID InterfaceId);
IUnknown* QueryInterface(IUnknown *pIUnknown, REFIID InterfaceId);
IUnknown* QueryInterface(TComPtr<IUnknown> Unknown, REFIID InterfaceId);
#endif
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2015 The DynamicCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_POW_H
#define BITCOIN_POW_H
#include <stdint.h>
class CBlockHeader;
class CBlockIndex;
class uint256;
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock);
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
uint256 GetBlockProof(const CBlockIndex& block);
uint256 GetNBitsHashes(unsigned int nBits);
#endif // BITCOIN_POW_H
|
//
// DCMarkVisitor.h
// CuriousCaptain
//
// Created by Chen XiaoLiang on 12-10-30.
// Copyright (c) 2012年 Chen XiaoLiang. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol DCMark;
@class DCDot, DCVertex, DCStroke;
@protocol DCMarkVisitor <NSObject>
- (void)visitMark:(id<DCMark>)mark;
- (void)visitDot:(DCDot *)dot;
- (void)visitVertex:(DCVertex *)vertex;
- (void)visitStroke:(DCStroke *)stroke;
@end
|
/*
Copyright (c) 2011, Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************
* Content : Eigen bindings to Intel(R) MKL
* LLt decomposition based on LAPACKE_?potrf function.
********************************************************************************
*/
#ifndef EIGEN_LLT_MKL_H
#define EIGEN_LLT_MKL_H
#include "Eigen/src/Core/util/MKL_support.h"
#include <iostream>
namespace Eigen {
namespace internal {
template<typename Scalar> struct mkl_llt;
#define EIGEN_MKL_LLT(EIGTYPE, MKLTYPE, MKLPREFIX) \
template<> struct mkl_llt<EIGTYPE> \
{ \
template<typename MatrixType> \
static inline Index potrf(MatrixType& m, char uplo) \
{ \
lapack_int matrix_order; \
lapack_int size, lda, info, StorageOrder; \
EIGTYPE* a; \
eigen_assert(m.rows()==m.cols()); \
/* Set up parameters for ?potrf */ \
size = convert_index<lapack_int>(m.rows()); \
StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \
matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
a = &(m.coeffRef(0,0)); \
lda = convert_index<lapack_int>(m.outerStride()); \
\
info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \
info = (info==0) ? -1 : info>0 ? info-1 : size; \
return info; \
} \
}; \
template<> struct llt_inplace<EIGTYPE, Lower> \
{ \
template<typename MatrixType> \
static Index blocked(MatrixType& m) \
{ \
return mkl_llt<EIGTYPE>::potrf(m, 'L'); \
} \
template<typename MatrixType, typename VectorType> \
static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
{ return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \
}; \
template<> struct llt_inplace<EIGTYPE, Upper> \
{ \
template<typename MatrixType> \
static Index blocked(MatrixType& m) \
{ \
return mkl_llt<EIGTYPE>::potrf(m, 'U'); \
} \
template<typename MatrixType, typename VectorType> \
static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
{ \
Transpose<MatrixType> matt(mat); \
return llt_inplace<EIGTYPE, Lower>::rankUpdate(matt, vec.conjugate(), sigma); \
} \
};
EIGEN_MKL_LLT(double, double, d)
EIGEN_MKL_LLT(float, float, s)
EIGEN_MKL_LLT(dcomplex, MKL_Complex16, z)
EIGEN_MKL_LLT(scomplex, MKL_Complex8, c)
} // end namespace internal
} // end namespace Eigen
#endif // EIGEN_LLT_MKL_H
|
#ifndef ossimGeneralRasterElevationDatabase_HEADER
#define ossimGeneralRasterElevationDatabase_HEADER 1
#include <ossim/elevation/ossimElevationCellDatabase.h>
#include <ossim/base/ossimFilename.h>
#include <ossim/elevation/ossimGeneralRasterElevHandler.h>
#include <mutex>
class OSSIM_DLL ossimGeneralRasterElevationDatabase : public ossimElevationCellDatabase
{
public:
ossimGeneralRasterElevationDatabase()
:ossimElevationCellDatabase()
{
}
ossimGeneralRasterElevationDatabase(const ossimGeneralRasterElevationDatabase& rhs)
:ossimElevationCellDatabase(rhs)
{
}
virtual ~ossimGeneralRasterElevationDatabase()
{
if(m_cellHandler.valid())
{
m_cellHandler->close();
}
m_cellHandler = 0;
}
virtual ossimObject* dup() const
{
ossimGeneralRasterElevationDatabase* duped = new ossimGeneralRasterElevationDatabase;
duped->open(m_connectionString);
return duped;
}
virtual bool open(const ossimString& connectionString);
virtual bool pointHasCoverage(const ossimGpt& gpt) const;
virtual bool getAccuracyInfo(ossimElevationAccuracyInfo& /*info*/, const ossimGpt& /*gpt*/) const
{
return false;
}
/**
* METHODS: accuracyLE90(), accuracyCE90()
* Returns the vertical and horizontal accuracy (90% confidence) in the
* region of gpt:
*/
// virtual double getAccuracyLE90(const ossimGpt& /* gpt */) const
// {
// std::cout << "ossimGeneralElevationDatabase::getAccuracyLE90 \n";
// return 0.0;
// }
// virtual double getAccuracyCE90(const ossimGpt& /* gpt */) const
// {
// std::cout << "ossimGeneralElevationDatabase::getAccuracyCE90 \n";
// return 0.0;
// }
virtual double getHeightAboveMSL(const ossimGpt&);
virtual double getHeightAboveEllipsoid(const ossimGpt& gpt);
virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix = 0);
virtual bool saveState(ossimKeywordlist& kwl, const char* prefix = 0)const;
virtual ossim_uint64 createId(const ossimGpt& /* pt */)const
{
return 0;
}
virtual std::ostream& print(std::ostream& out) const;
protected:
ossimRefPtr<ossimGeneralRasterElevHandler> m_cellHandler;
bool openGeneralRasterDirectory(const ossimFilename& dir);
void createRelativePath(ossimFilename& file, const ossimGpt& gpt)const;
void createFullPath(ossimFilename& file, const ossimGpt& gpt)const
{
ossimFilename relativeFile;
createRelativePath(relativeFile, gpt);
file = ossimFilename(m_connectionString).dirCat(relativeFile);
}
ossimRefPtr<ossimElevCellHandler> createHandler(const ossimGpt& /* gpt */);
virtual ossimRefPtr<ossimElevCellHandler> createCell(const ossimGpt& /* gpt */);
TYPE_DATA
};
#endif
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_KEY_H
#define BITCOIN_KEY_H
#include <stdexcept>
#include <vector>
#include "allocators.h"
#include "serialize.h"
#include "uint256.h"
#include "hash.h"
#ifdef _WINDOWS
#include <windows.h>
#undef X509_NAME
#undef X509_EXTENSIONS
#undef X509_CERT_PAIR
#undef PKCS7_ISSUER_AND_SERIAL
#undef OCSP_REQUEST
#undef OCSP_RESPONSE
#endif // _WINDOWS
#include <openssl/ec.h> // for EC_KEY definition
// secp160k1
// const unsigned int PRIVATE_KEY_SIZE = 192;
// const unsigned int PUBLIC_KEY_SIZE = 41;
// const unsigned int SIGNATURE_SIZE = 48;
//
// secp192k1
// const unsigned int PRIVATE_KEY_SIZE = 222;
// const unsigned int PUBLIC_KEY_SIZE = 49;
// const unsigned int SIGNATURE_SIZE = 57;
//
// secp224k1
// const unsigned int PRIVATE_KEY_SIZE = 250;
// const unsigned int PUBLIC_KEY_SIZE = 57;
// const unsigned int SIGNATURE_SIZE = 66;
//
// secp256k1:
// const unsigned int PRIVATE_KEY_SIZE = 279;
// const unsigned int PUBLIC_KEY_SIZE = 65;
// const unsigned int SIGNATURE_SIZE = 72;
//
// see www.keylength.com
// script supports up to 75 for single byte push
class key_error : public std::runtime_error
{
public:
explicit key_error(const std::string& str) : std::runtime_error(str) {}
};
/** A reference to a CKey: the Hash160 of its serialized public key */
class CKeyID : public uint160
{
public:
CKeyID() : uint160(0) { }
CKeyID(const uint160 &in) : uint160(in) { }
};
/** A reference to a CScript: the Hash160 of its serialization (see script.h) */
class CScriptID : public uint160
{
public:
CScriptID() : uint160(0) { }
CScriptID(const uint160 &in) : uint160(in) { }
};
/** An encapsulated public key. */
class CPubKey {
private:
std::vector<unsigned char> vchPubKey;
friend class CKey;
public:
CPubKey() { }
CPubKey(const std::vector<unsigned char> &vchPubKeyIn) : vchPubKey(vchPubKeyIn) { }
friend bool operator==(const CPubKey &a, const CPubKey &b) { return a.vchPubKey == b.vchPubKey; }
friend bool operator!=(const CPubKey &a, const CPubKey &b) { return a.vchPubKey != b.vchPubKey; }
friend bool operator<(const CPubKey &a, const CPubKey &b) { return a.vchPubKey < b.vchPubKey; }
IMPLEMENT_SERIALIZE(
READWRITE(vchPubKey);
)
CKeyID GetID() const {
return CKeyID(Hash160(vchPubKey));
}
uint256 GetHash() const {
return Hash(vchPubKey.begin(), vchPubKey.end());
}
bool IsValid() const {
return vchPubKey.size() == 33 || vchPubKey.size() == 65;
}
bool IsCompressed() const {
return vchPubKey.size() == 33;
}
std::vector<unsigned char> Raw() const {
return vchPubKey;
}
};
// secure_allocator is defined in allocators.h
// CPrivKey is a serialized private key, with all parameters included (279 bytes)
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
// CSecret is a serialization of just the secret parameter (32 bytes)
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CSecret;
/** An encapsulated OpenSSL Elliptic Curve key (public and/or private) */
class CKey
{
protected:
EC_KEY* pkey;
bool fSet;
bool fCompressedPubKey;
void SetCompressedPubKey();
public:
void Reset();
CKey();
CKey(const CKey& b);
CKey& operator=(const CKey& b);
~CKey();
bool IsNull() const;
bool IsCompressed() const;
void MakeNewKey(bool fCompressed);
bool SetPrivKey(const CPrivKey& vchPrivKey);
bool SetSecret(const CSecret& vchSecret, bool fCompressed = false);
CSecret GetSecret(bool &fCompressed) const;
CPrivKey GetPrivKey() const;
bool SetPubKey(const CPubKey& vchPubKey);
CPubKey GetPubKey() const;
bool Sign(uint256 hash, std::vector<unsigned char>& vchSig);
// create a compact signature (65 bytes), which allows reconstructing the used public key
// The format is one header byte, followed by two times 32 bytes for the serialized r and s values.
// The header byte: 0x1B = first key with even y, 0x1C = first key with odd y,
// 0x1D = second key with even y, 0x1E = second key with odd y
bool SignCompact(uint256 hash, std::vector<unsigned char>& vchSig);
// reconstruct public key from a compact signature
// This is only slightly more CPU intensive than just verifying it.
// If this function succeeds, the recovered public key is guaranteed to be valid
// (the signature is a valid signature of the given data for that key)
bool SetCompactSignature(uint256 hash, const std::vector<unsigned char>& vchSig);
bool Verify(uint256 hash, const std::vector<unsigned char>& vchSig);
// Verify a compact signature
bool VerifyCompact(uint256 hash, const std::vector<unsigned char>& vchSig);
bool IsValid();
};
#endif
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@interface DVTFileIconCreator : NSObject
{
}
+ (BOOL)_checkIfDirty:(id)arg1;
+ (id)iconForDVTFilePath:(id)arg1 fileDataTypeHint:(id)arg2 decorated:(BOOL)arg3;
+ (id)iconForDVTFilePath:(id)arg1 fileDataTypeHint:(id)arg2;
+ (id)iconForFileType:(id)arg1;
+ (id)_iconForFileType:(id)arg1 isDirty:(BOOL)arg2 isMissing:(BOOL)arg3;
+ (id)_baseIconForFileType:(id)arg1;
+ (id)overriderImageProviderClassByUTI;
+ (id)_xcodeBundleIconForFileType:(id)arg1;
+ (id)iconWithBaseIcon:(id)arg1 badgeIcon:(id)arg2 isDirty:(BOOL)arg3;
+ (id)iconWithBaseIcon:(id)arg1 badgeIcon:(id)arg2;
+ (id)_iconWithBaseIcon:(id)arg1 badgeIcon:(id)arg2 isDirty:(BOOL)arg3 isMissing:(BOOL)arg4;
+ (void)initialize;
@end
|
//
// NotificationController.h
// NSUserNotificationCenterDelegateSample
//
// Created by Keith Smiley on 1/13/15.
// Copyright (c) 2015 keithsmiley. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NotificationController : NSObject <NSUserNotificationCenterDelegate>
- (void)presentNotification;
@end
|
#ifndef MPU_H
#define MPU_H
#include <Arduino.h>
struct s_mympu {
float ypr[3];
float gyro[3];
float accel[3];
#ifdef MPU9150
float comp[3];
#endif
float gravity;
};
extern struct s_mympu mympu;
extern bool mympu_inverted;
int8_t mympu_open(short addr,unsigned int rate,unsigned short orient);
int8_t mympu_update();
void mympu_reset_fifo();
#ifdef MPU9150
int8_t mympu_update_compass();
#endif
#endif
|
// Copyright (c) 2014 Darach Ennis < darach at gmail dot 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.
#include <stdint.h>
#include "erl_nif.h"
#include "jch.h"
static ERL_NIF_TERM jch_chash(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
uint64_t key;
uint32_t num_buckets;
unsigned int switch_len;
char algorithm[11];
int32_t chash;
if (argc != 3 ||
!enif_get_uint64(env, argv[0], &key) ||
!enif_get_uint(env, argv[1], &num_buckets) ||
!enif_get_atom_length(env, argv[2], &switch_len, ERL_NIF_LATIN1) ||
switch_len > 10 || // orig | xorshift64
!enif_get_atom(env, argv[2], algorithm, switch_len + 1, ERL_NIF_LATIN1) ||
num_buckets < 1)
{
return enif_make_badarg(env);
}
switch (*algorithm) {
case 'o': // orig
chash = _jch_chash_orig(key,num_buckets);
break;
case 'x': // xorshift64
chash = _jch_chash(key,num_buckets);
break;
default:
return enif_make_badarg(env);
}
return enif_make_int(env,chash);
}
static void init(ErlNifEnv* env)
{
}
static int on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
{
init(env);
return 0;
}
static int on_upgrade(ErlNifEnv* env, void** priv_data, void** old_priv_data, ERL_NIF_TERM load_info)
{
init(env);
return 0;
}
static void on_unload(ErlNifEnv* env, void* priv_data)
{
// nothing to clean up
}
static ErlNifFunc nif_funcs[] = {
{"ch", 3, jch_chash}
};
ERL_NIF_INIT(jch, nif_funcs, &on_load, NULL, &on_upgrade, &on_unload)
|
/// @file Hg/message_byte_order.h
///
/// An extraction of the Network to Host conversion functions.
///
/// The MIT License(MIT)
/// @copyright 2014 Paul M Watt
// ****************************************************************************
#ifndef MESSAGE_BYTE_ORDER_H_INCLUDED
#define MESSAGE_BYTE_ORDER_H_INCLUDED
// Includes *******************************************************************
#include <Hg/detail/message_byte_order_detail.h>
namespace Hg
{
// ****************************************************************************
/// Parameterized function to convert a Hg::Message to network byte-order.
///
/// @param T [typename] The Hg::basic_msg format definition of the
/// message to be converted.
/// @param from The message object to convert from.
/// Ownership of the memory that belongs to the input type will
/// be transferred to the returned instance, and the conversion
/// will occur in-place.
///
/// @return A Hg::basic_msg object using the same format and data type as the
/// input buffer will be returned. The data in the buffer will
/// be in network byte-order.
///
/// If the input format was already in network byte-order,
/// no conversion operations will be performed.
///
template< typename T >
typename T::base_type::net_t
to_network(T& from)
{
T::base_type::net_t to;
detail::convert_byte_order<T, NetByteOrder>(from, to);
return to;
}
// ****************************************************************************
/// Parameterized function to convert a Hg::Message to host byte-order.
///
/// @param T [typename] The Hg::basic_msg format definition of the
/// message to be converted.
/// @param from The message object to convert from.
/// Ownership of the memory that belongs to the input type will
/// be transferred to the returned instance, and the conversion
/// will occur in-place.
///
/// @return A Hg::basic_msg object using the same format and data type as the
/// input buffer will be returned. The data in the buffer will
/// be in host byte-order.
///
/// If the input format was already in host byte-order,
/// no conversion operations will be performed.
///
template< typename T >
typename T::base_type::host_t
to_host(T& from)
{
T::base_type::host_t to;
detail::convert_byte_order<T,HostByteOrder>(from, to);
return to;
}
// ****************************************************************************
/// Parameterized function to convert a Hg::Message to bit endian byte-order.
///
/// @param T [typename] The Hg::basic_msg format definition of the
/// message to be converted.
/// @param from The message object to convert from.
/// Ownership of the memory that belongs to the input type will
/// be transferred to the returned instance, and the conversion
/// will occur in-place.
///
/// @return A Hg::basic_msg object using the same format and data type as the
/// input buffer will be returned. The data in the buffer will
/// be in big endian byte-order.
///
/// If the input format was already in big endian byte-order,
/// no conversion operations will be performed.
///
template< typename T >
typename T::base_type::big_t
to_big_endian(T& from)
{
T::base_type::big_t to;
detail::convert_byte_order<T, BigEndian>(from, to);
return to;
}
// ****************************************************************************
/// Parameterized function to convert a Hg::Message to little endian byte-order.
///
/// @param T [typename] The Hg::basic_msg format definition of the
/// message to be converted.
/// @param from The message object to convert from.
/// Ownership of the memory that belongs to the input type will
/// be transferred to the returned instance, and the conversion
/// will occur in-place.
///
/// @return A Hg::basic_msg object using the same format and data type as the
/// input buffer will be returned. The data in the buffer will
/// be in little endian byte-order.
///
/// If the input format was already in little endian byte-order,
/// no conversion operations will be performed.
///
template< typename T >
typename T::base_type::little_t
to_little_endian(T& from)
{
T::base_type::little_t to;
detail::convert_byte_order<T, LittleEndian>(from, to);
return to;
}
} // namespace Hg
#endif
|
//
// MetalImageOrigin.h
// MetalImage
//
// Created by ericking on 10/8/2017.
// Copyright © 2017 erickingxu. All rights reserved.
//
#ifndef MetalImageOrigin_h
#define MetalImageOrigin_h
#import <AVFoundation/AVFoundation.h>
//////////////////////////////////////Core texture data struct for CPU-Processing///////////////////////////////
typedef struct _Model3DPose
{
float viewMat[ 16 ];
float projectMat[ 16 ];
} Model3DPose;
typedef struct _FaceFrameData
{
float facePoints[ 48 * 2 ]; //some like as [x0,y0,x1,y1 ...]
uint32_t facePointsCount;
bool isMouthOpen;
bool eyeBlink;
bool isHeadYaw;
bool isHeadPitch;
bool isBrowJump;
float openMouthIntensity;
Model3DPose headPose;
} FaceFrameData;
typedef struct _AttachmentDataArr
{
FaceFrameData faceItemArr[ 5 ];
uint32_t faceCount;
} AttachmentDataArr;
typedef struct _Texture_FrameData
{
uint8_t* imageData;
uint32_t width;
uint32_t height;
uint32_t widthStep;
uint32_t format;
AttachmentDataArr attachFrameDataArr; //attach some cpu data for processing
} Texture_FrameData;
#endif /* MetalImageOrigin_h */
|
/*
* Copyright (C) 2017 - 2020 FIX94
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef _ppu_h_
#define _ppu_h_
#include "common.h"
void ppuInit();
void ppuAddCycles();
FIXNES_ALWAYSINLINE void ppuCycle();
FIXNES_ALWAYSINLINE bool ppuDrawDone();
uint8_t ppuGet8(uint16_t addr);
void ppuSet8(uint16_t addr, uint8_t val);
uint8_t ppuNMI();
void ppuDumpMem();
uint16_t ppuGetCurVramAddr();
void ppuSoftReset();
void ppuReset();
void ppuSetNameTblSingleLower();
void ppuSetNameTblSingleUpper();
void ppuSetNameTblVertical();
void ppuSetNameTblHorizontal();
void ppuSetNameTbl4Screen();
void ppuSetNameTblCustom(uint16_t addrA, uint16_t addrB, uint16_t addrC, uint16_t addrD);
void ppuDrawNSFTrackNum(uint8_t cTrack, uint8_t trackTotal);
uint8_t ppuGetVRAM0(uint16_t addr);
uint8_t ppuGetVRAM1(uint16_t addr);
uint8_t ppuGetVRAM2(uint16_t addr);
uint8_t ppuGetVRAM3(uint16_t addr);
void ppuSetVRAM0(uint16_t addr, uint8_t val);
void ppuSetVRAM1(uint16_t addr, uint8_t val);
void ppuSetVRAM2(uint16_t addr, uint8_t val);
void ppuSetVRAM3(uint16_t addr, uint8_t val);
uint8_t ppuGetPALRAM(uint16_t addr);
void ppuSetPALRAM(uint16_t addr, uint8_t val);
void ppuSetPALRAMMirror(uint16_t addr, uint8_t val);
extern bool ppu4Screen;
//for initial NT set in main.c
enum {
NT_UNKNOWN = 0,
NT_HORIZONTAL,
NT_VERTICAL,
NT_4SCREEN,
};
//general defines for dots and line totals
#define DOTS 341
#define LINES_NTSC 262
#define LINES_PAL 312
#define VISIBLE_DOTS 256
#define VISIBLE_LINES 240
#ifdef DISPLAY_PPUWRITES
#define TEX_DOTS DOTS
#define TEX_LINES LINES_PAL
#elif defined(DO_4_3_ASPECT)
#define TEX_DOTS VISIBLE_DOTS*4
#define TEX_LINES VISIBLE_LINES*4
#else
#define TEX_DOTS VISIBLE_DOTS
#define TEX_LINES VISIBLE_LINES
#endif //end DISPLAY_PPUWRITES
#endif
|
// ------------------------------------------------------------------
// Open-bomber - open-source online bomberman remake
// ------------------------------------------------------------------
#pragma once
#include <string>
//////////////////////////////////////////////////////////////////////////
// map
//////////////////////////////////////////////////////////////////////////
#define TILE_SZ 32 // tile size in pixels
#define MAP_X 20 // number of columns in the map
#define MAP_Y 10 // number of rows in the map
#define WALL '0' // denotes a inpassable wall
#define WALKABLE ' ' // denotes a walkable tile in map
#define DESTRUCTIBLE '1' // denotes a destructible tile in map
class Map{
public:
Map();
~Map();
// loads a map from file
bool Load(const char* name);
// rebuilds walls & etc., to start state
void Reset();
// returns true if the cell is walkable
bool IsWalkable(int cellx, int celly);
// returns true if the cell is destructible
bool IsDestructible(int cellx, int celly);
// sets cell type
void MapSet(int cellx, int celly, char c);
// returns cell type
char Get(int cellx, int celly);
// returns starting position of player in map
int* GetPlayerPos();
// returns starting position of enemy in map
int* GetEnemyPos();
// returns the loaded map file name
std::string GetFileName(){ return mapname; }
private:
std::string mapname;
// [0] - cellx, [1] - celly
int player_pos[2];// stores starting pos - does not change
int enemy_pos[2];// stores starting pos - does not change
// map
char map_orig[MAP_X*MAP_Y]; // does not change
char map[MAP_X*MAP_Y];
}; |
//
// Created by netmind on 18. 2. 23.
//
#ifndef NETMEDIA_TIMERMGR_H
#define NETMEDIA_TIMERMGR_H
#include "UvTimer.h"
namespace uvcpp {
class TimerMgr {
public:
virtual ~TimerMgr();
uint32_t setTimeout(uint64_t start, uint64_t interval, std::function<void(uint32_t fire_handle)> lis);
void clearTimeout(uint32_t handle);
void clearAll();
static std::unique_ptr<TimerMgr> createTimerMgr();
private:
class TmTimer : public UvTimer {
private:
friend class TimerMgr;
uint32_t handle;
};
TimerMgr();
uint32_t _handleSeed;
std::list<TmTimer> _timers;
std::list<TmTimer> _dummyList;
void gotoDummy(uint32_t handle);
};
typedef std::unique_ptr<TimerMgr> upTimerMgr;
}
#endif //NETMEDIA_TIMERMANAGER_H
|
#pragma once
#include <filesystem>
#include "../BUILD_OPTIONS.h"
#include "../Platform.h"
#include "../Memory/Memory.h"
namespace AE
{
class FileSystem;
class FileStream
{
friend class FileSystem;
public:
FileStream() = delete;
FileStream( FileSystem * file_system );
FileStream( FileStream & other ) = delete;
FileStream( FileStream && other );
~FileStream();
FileStream & operator=( FileStream & other ) = delete;
FileStream & operator=( FileStream && other );
void Seek( size_t cursor_position );
size_t Tell() const;
size_t Size() const;
bool EndOfStream();
const Vector<char> & GetRawStream() const;
Vector<char> & GetEditableRawStream();
// read bytes similarly to fstream, returns the actual amount of bytes read
template<typename D>
size_t Read( D * data, size_t amount )
{
assert( ( cursor + amount * sizeof( D ) ) <= raw_stream.size() );
size_t read_amount_bytes = std::min( amount * sizeof( D ), raw_stream.size() - cursor );
std::memcpy( data, raw_stream.data() + cursor, read_amount_bytes );
cursor += read_amount_bytes;
return read_amount_bytes;
}
template<typename T>
const T & Read()
{
assert( ( cursor + sizeof( T ) ) < raw_stream.size() );
return *( (T*)( raw_stream.data() + cursor ) );
cursor += sizeof( T );
}
String ReadLine();
private:
FileSystem * p_file_system = nullptr;
Vector<char> raw_stream;
size_t cursor = 0;
};
}
|
#ifndef MTLU_LUXUTIL_H
#define MTLU_LUXUTIL_H
#include <maya/MMatrix.h>
#include <maya/MPoint.h>
#include <maya/MVector.h>
#include <vector>
void setZUp( MMatrix& matrix);
void setZUp( MMatrix& matrix, float *fm);
void setZUp( MPoint& point);
void setZUp( MVector& point);
void setZUp( MVector& point, float *pos);
void setZUp( MPoint& point, float *pos);
void setGlobalScaleMatrix(MMatrix& matrix);
#endif |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_max_square_03.c
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-03.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: max Set data to the max value for int
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: square
* GoodSink: Ensure there will not be an overflow before squaring data
* BadSink : Square data, which can lead to overflow
* Flow Variant: 03 Control flow: if(5==5) and if(5!=5)
*
* */
#include "std_testcase.h"
#include <math.h>
#ifndef OMITBAD
void CWE190_Integer_Overflow__int_max_square_03_bad()
{
int data;
/* Initialize data */
data = 0;
if(5==5)
{
/* POTENTIAL FLAW: Use the maximum value for this type */
data = INT_MAX;
}
if(5==5)
{
{
/* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */
int result = data * data;
printIntLine(result);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second 5==5 to 5!=5 */
static void goodB2G1()
{
int data;
/* Initialize data */
data = 0;
if(5==5)
{
/* POTENTIAL FLAW: Use the maximum value for this type */
data = INT_MAX;
}
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Add a check to prevent an overflow from occurring */
if (abs((long)data) <= (long)sqrt((double)INT_MAX))
{
int result = data * data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
int data;
/* Initialize data */
data = 0;
if(5==5)
{
/* POTENTIAL FLAW: Use the maximum value for this type */
data = INT_MAX;
}
if(5==5)
{
/* FIX: Add a check to prevent an overflow from occurring */
if (abs((long)data) <= (long)sqrt((double)INT_MAX))
{
int result = data * data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodG2B1() - use goodsource and badsink by changing the first 5==5 to 5!=5 */
static void goodG2B1()
{
int data;
/* Initialize data */
data = 0;
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
data = 2;
}
if(5==5)
{
{
/* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */
int result = data * data;
printIntLine(result);
}
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
int data;
/* Initialize data */
data = 0;
if(5==5)
{
/* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
data = 2;
}
if(5==5)
{
{
/* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */
int result = data * data;
printIntLine(result);
}
}
}
void CWE190_Integer_Overflow__int_max_square_03_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE190_Integer_Overflow__int_max_square_03_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE190_Integer_Overflow__int_max_square_03_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <IDEInterfaceBuilderKit/IBAbstractClassProvider.h>
@class IBTargetRuntime, NSMutableDictionary;
@interface IBSystemClassProvider : IBAbstractClassProvider
{
NSMutableDictionary *classNameToPrimaryPartialClassDescriptionMap;
NSMutableDictionary *classNameToPartialClassDescriptionsMap;
NSMutableDictionary *classNameToSubclassesMap;
IBTargetRuntime *targetRuntime;
}
+ (id)systemClassProviderForTargetRuntime:(id)arg1;
- (void).cxx_destruct;
- (void)loadSystemClassDescriptions;
- (void)loadSystemClassDescriptionsFromExtensionParameter:(id)arg1;
- (id)filePathForClassDescriptionsParameter:(id)arg1;
- (void)addPartialClassDescription:(id)arg1 fromExtensionWithIdentifier:(id)arg2;
- (void)addKnownSubclass:(id)arg1 toClassNamed:(id)arg2;
- (id)conflictingClassDescriptionsPreventingIntegrationOfClassDescriptionBecauseOfConflictingSuperClasses:(id)arg1;
- (BOOL)wouldAddingClassNamed:(id)arg1 withSuperClassNamedIntroduceACycle:(id)arg2;
- (id)lineageOfClassNamed:(id)arg1;
- (id)partialClassDescriptionsForClassNamed:(id)arg1;
- (id)collectionTypeForToManyOutlet:(id)arg1 forClassNamed:(id)arg2;
- (id)typeForNamedRelation:(id)arg1 ofRelationshipType:(long long)arg2 forClassNamed:(id)arg3;
- (id)namedRelationsOfRelationshipType:(long long)arg1 forClassNamed:(id)arg2 withLineage:(id)arg3 recursive:(BOOL)arg4;
- (id)namedRelationsOfRelationshipType:(long long)arg1 forClassNamed:(id)arg2;
- (id)namedRelationsOfRelationshipType:(long long)arg1;
- (id)classNamesForClassesWithActionsNamed:(id)arg1;
- (id)classNames;
- (id)descendantsOfClassesNamed:(id)arg1;
- (id)subclassesOfClassNamed:(id)arg1;
- (id)superclassOfClassNamed:(id)arg1;
- (BOOL)hasDescriptionOfClassNamed:(id)arg1;
- (id)partialClassDescriptionsExcludedForEncoding;
- (id)partialClassDescriptionsForEncodingClassNamed:(id)arg1;
- (id)initWithTargetRuntime:(id)arg1;
@end
|
//
// SMQuantityEvaluator.h
// UnitsKit
//
// Created by Steve Moser on 4/13/13.
// Copyright (c) 2013 Steve Moser (http://stevemoser.org)
//
// 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 <Foundation/Foundation.h>
@class SMQuantity;
@class SMDerivedUnit;
@class SMBaseUnit;
@interface SMQuantityEvaluator : NSObject
@property (nonatomic, strong) NSMutableDictionary *derivedUnitIdentifiers;
@property (nonatomic, strong) NSMutableDictionary *derivedUnitSymbols;
@property (nonatomic, strong) NSMutableDictionary *derivedUnitNames;
@property (nonatomic, strong) NSMutableDictionary *allDerivedUnits;
@property (nonatomic, strong) NSMutableDictionary *derivedUnits;
@property (nonatomic, strong) NSMutableDictionary *baseUnitIdentifiers;
@property (nonatomic, strong) NSMutableDictionary *baseUnitSymbols;
@property (nonatomic, strong) NSMutableDictionary *baseUnitNames;
@property (nonatomic, strong) NSMutableDictionary *allBaseUnits;
@property (nonatomic, strong) NSMutableDictionary *baseUnits;
@property (nonatomic, strong) NSMutableDictionary *conversions;
@property (nonatomic, strong) NSMutableDictionary *systems;
@property (nonatomic, strong) NSMutableDictionary *constants;
+ (id) sharedQuantityEvaluator;
- (SMBaseUnit *)baseUnitFromString:(NSString *)unitString;
- (SMDerivedUnit *)derivedUnitFromString:(NSString *)unitString;
- (SMBaseUnit *)baseUnitFromBaseUnitIdentifier:(NSString *)baseUnitIdentifier;
- (SMQuantity *)evaluateQuantity:(SMQuantity *)firstQuantity withQuantity:(SMQuantity *)secondQuantity usingOperator:(NSString *)operatorName;
- (SMQuantity *)convertQuantity:(SMQuantity *)sourceQuantity usingDerivedUnit:(SMDerivedUnit *)targetUnit;
@end
|
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "my_random.h"
|
#ifndef DIALOG_H
#define DIALOG_H
#include "game/gui/component.h"
#include "utils/vector.h"
#include "video/surface.h"
typedef enum dialog_style_t
{
DIALOG_STYLE_YES_NO,
DIALOG_STYLE_OK
} dialog_style;
typedef enum dialog_result_t
{
DIALOG_RESULT_CANCEL,
DIALOG_RESULT_YES_OK,
DIALOG_RESULT_NO
} dialog_result;
typedef struct component_t component;
typedef struct dialog_t dialog;
typedef void (*dialog_clicked_cb)(dialog *, dialog_result result);
typedef struct dialog_t {
int x;
int y;
char text[256];
surface background;
component *yes;
component *no;
component *ok;
int visible;
dialog_result result;
// events
void *userdata;
dialog_clicked_cb clicked;
} dialog;
void dialog_create(dialog *dlg, dialog_style style, const char *text, int x, int y);
void dialog_free(dialog *dlg);
void dialog_show(dialog *dlg, int visible);
int dialog_is_visible(dialog *dlg);
void dialog_tick(dialog *dlg);
void dialog_render(dialog *dlg);
void dialog_event(dialog *dlg, int action);
#endif // DIALOG_H
|
//
// DIRootViewController.h
// DinoKitDemo
//
// Created by xjf on 16/6/29.
// Copyright © 2016年 Dino. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DIRootViewController : UITableViewController
@end
|
// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef GUIUTIL_H
#define GUIUTIL_H
#include <QMessageBox>
#include <QObject>
#include <QString>
class QValidatedLineEdit;
class SendCoinsRecipient;
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QDateTime;
class QFont;
class QLineEdit;
class QUrl;
class QWidget;
QT_END_NAMESPACE
/** Utility functions used by the Bitcoin Qt UI.
*/
namespace GUIUtil
{
// Create human-readable string from date
QString dateTimeStr(const QDateTime &datetime);
QString dateTimeStr(qint64 nTime);
// Render Bitcoin addresses in monospace font
QFont bitcoinAddressFont();
// Set up widgets for address and amounts
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent);
void setupAmountWidget(QLineEdit *widget, QWidget *parent);
// Parse "JMAGcoin:" URI into recipient object, return true on successful parsing
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
QString formatBitcoinURI(const SendCoinsRecipient &info);
// Returns true if given address+amount meets "dust" definition
bool isDust(const QString& address, qint64 amount);
// HTML escaping for rich text controls
QString HtmlEscape(const QString& str, bool fMultiLine=false);
QString HtmlEscape(const std::string& str, bool fMultiLine=false);
/** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing
is selected.
@param[in] column Data column to extract from the model
@param[in] role Data role to extract from the model
@see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
*/
void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
void setClipboard(const QString& str);
/** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
when no suffix is provided by the user.
@param[in] parent Parent window (or 0)
@param[in] caption Window caption (or empty, for default)
@param[in] dir Starting directory (or empty, to default to documents directory)
@param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
@param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
Can be useful when choosing the save file format based on suffix.
*/
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir,
const QString &filter,
QString *selectedSuffixOut);
/** Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
@param[in] parent Parent window (or 0)
@param[in] caption Window caption (or empty, for default)
@param[in] dir Starting directory (or empty, to default to documents directory)
@param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
@param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
Can be useful when choosing the save file format based on suffix.
*/
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir,
const QString &filter,
QString *selectedSuffixOut);
/** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking.
@returns If called from the GUI thread, return a Qt::DirectConnection.
If called from another thread, return a Qt::BlockingQueuedConnection.
*/
Qt::ConnectionType blockingGUIThreadConnection();
// Determine whether a widget is hidden behind other windows
bool isObscured(QWidget *w);
// Open debug.log
void openDebugLogfile();
/** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text
representation if needed. This assures that Qt can word-wrap long tooltip messages.
Tooltips longer than the provided size threshold (in characters) are wrapped.
*/
class ToolTipToRichTextFilter : public QObject
{
Q_OBJECT
public:
explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0);
protected:
bool eventFilter(QObject *obj, QEvent *evt);
private:
int size_threshold;
};
bool GetStartOnSystemStartup();
bool SetStartOnSystemStartup(bool fAutoStart);
/** Save window size and position */
void saveWindowGeometry(const QString& strSetting, QWidget *parent);
/** Restore window size and position */
void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent);
} // namespace GUIUtil
#endif // GUIUTIL_H
|
#pragma once
#include <string>
#include <memory>
#include <rapidjson/document.h>
namespace Yorozuya
{
namespace Module
{
using ModuleVersion_t = uint32_t;
using ModuleName_t = ::std::string;
class IModule
{
public:
virtual void load() = 0;
virtual void unload() = 0;
virtual ModuleName_t get_name() = 0;
virtual void loop()
{
}
virtual void zone_start()
{
}
virtual ModuleVersion_t get_version()
{
return ATF::usVersion;
}
virtual void configure(const rapidjson::Value& nodeConfig)
{
UNREFERENCED_PARAMETER(nodeConfig);
}
};
using Module_ptr = ::std::shared_ptr<IModule>;
}
namespace ModuleApi
{
using MethodName_t = char[];
Module::IModule* CreateModule();
using CreateModule_ptr = decltype(&CreateModule);
static MethodName_t csNameCreateModule = "CreateModule";
void ReleaseModule(Module::IModule*);
using ReleaseModule_ptr = decltype(&ReleaseModule);
static MethodName_t csNameReleaseModule = "ReleaseModule";
}
}
|
//!< Author: Allan J Moore 07/ 11/ 2014
/***************************************************************************************
* Nightmare Engine, Unorthodox Game Studios *
* Copyright (C) 2014, Allan J Moore *
* All rights reserved *
* *
* See "licence.txt" included with this release for licensing information. *
***************************************************************************************/
#ifndef NE_PROPERTY
#define NE_PROPERTY
/***************************************************************************************
//!< Property.h
//!< Class Definition: neProperty
//!< Class Description: For linking a type to other types i.e. key, value pairs
***************************************************************************************/
template <class KEY, class VAL>
class neProperty{
public:
neProperty(KEY Key, VAL Val){
this->first = Key;
this->second = Val;
}
KEY first;
VAL second;
~neProperty(){}
private:
neProperty(){}
};
#endif |
#pragma once
#ifndef __GameObjectFactory__
#define __GameObjectFactory__
#include <string>
#include <map>
#include "GameObject.h"
class BaseCreator
{
public:
virtual GameObject* createGameObject() const = 0;
virtual ~BaseCreator() {}
};
class GameObjectFactory
{
std::map<std::string, BaseCreator*> m_creators;
GameObjectFactory(){}
~GameObjectFactory(){}
static GameObjectFactory* s_pInstance;
public:
static GameObjectFactory* instance()
{
if (s_pInstance == 0)
{
s_pInstance = new GameObjectFactory();
return s_pInstance;
}
return s_pInstance;
}
bool registerType(std::string typeID, BaseCreator* pCreator);
GameObject* create(std::string typeID);
};
typedef GameObjectFactory TheGameObjectFactory;
#endif //defined!(__GameObjectFactory__) |
//
// AFSessionOperation.h
//
// Created by Robert Ryan on 8/6/15.
// Copyright (c) 2015 Robert Ryan. All rights reserved.
//
#import "AsynchronousOperation.h"
@class AFHTTPSessionManager;
NS_ASSUME_NONNULL_BEGIN
@interface AFHTTPSessionOperation : AsynchronousOperation
/** The NSURLSessionTask associated with this operation
*/
@property (nonatomic, strong, readonly, nullable) NSURLSessionTask *task;
/**
Creates an `AFHTTPSessionOperation` with the specified request.
@param manager The AFURLSessionManager for the operation.
@param request The HTTP request for the request.
@param method The HTTP method (e.g. GET, POST, etc.).
@param parameter A dictionary of parameters to be added to the request. The nature of the encoding is dictated by the manager's requestSerializer setting.
@param uploadProgress A block that is called as the upload of the request body progresses.
@param downloadProgress A block that is called as the download of the server response progresses.
@param success A block object to be executed if and when the task successfully finishes.
@param failure A block object to be executed if and when the task fails.
@returns AFURLSessionOperation that can be added to a NSOperationQueue.
*/
+ (instancetype)operationWithManager:(__kindof AFHTTPSessionManager *)manager
HTTPMethod:(NSString *)method
URLString:(NSString *)URLString
parameters:(nullable id)parameters
uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress
downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
@end
NS_ASSUME_NONNULL_END |
//
// This source file is part of appleseed.
// Visit https://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2017-2018 Esteban Tovagliari, The appleseedhq Organization
//
// 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.
//
#pragma once
// appleseed.renderer headers.
#include "renderer/modeling/aov/iaovfactory.h"
// appleseed.foundation headers.
#include "foundation/utility/autoreleaseptr.h"
// appleseed.main headers.
#include "main/dllsymbol.h"
// Forward declarations.
namespace foundation { class Dictionary; }
namespace foundation { class DictionaryArray; }
namespace renderer { class AOV; }
namespace renderer { class ParamArray; }
namespace renderer
{
//
// A factory for depth AOVs.
//
class APPLESEED_DLLSYMBOL DepthAOVFactory
: public IAOVFactory
{
public:
// Delete this instance.
void release() override;
// Return a string identifying this AOV model.
const char* get_model() const override;
// Return metadata for this AOV model.
foundation::Dictionary get_model_metadata() const override;
// Return metadata for the inputs of this AOV model.
foundation::DictionaryArray get_input_metadata() const override;
// Create a new AOV instance.
foundation::auto_release_ptr<AOV> create(
const ParamArray& params) const override;
};
} // namespace renderer
|
/**************************************************************
* Copyright (c) Wuzhiyi
* Introduction to Algorithms
*
* 题目: Chapter 6
* 名称: HEAP-SORT
* 作者: Anker
* 语言: c
* 内容摘要: 堆排序
*
* 修改记录:
* 修改日期 版本号 修改人 修改内容
* ------------------------------------------------------------
* 20150708 V1.0 wuzhiyi 创建
**************************************************************/
#include <stdio.h>
#include <stdlib.h>
//array's index begins 1, not 0
#define PARENT(i) (i/2)
#define LEFT(i) (i*2)
#define RIGHT(i) (i*2+1)
#define NOTNUSEDATA -65536
void adjust_max_heap(int *datas, int length, int i);
void adjust_max_heap_recursive(int *datas, int length, int i);
void build_max_heap(int *datas, int length);
void heap_sort(int *datas, int length);
int main()
{
int i;
//array's index begin 1
int datas[11]={NOTNUSEDATA,5,3,17,10,84,19,6,22,9,35};
heap_sort(datas,10);
for (i=1; i<11; ++i)
printf("%d",datas[i]);
printf("\n");
exit(0);
}
void adjust_max_heap_recursive(int *datas, int length, int i)
{
int left,right,largest;
int temp;
left=LEFT(i); //left child
right=RIGHT(i); //right child
//find the largest value among left and right and i.
if (left<=length && datas[left]>datas[i])
largest=left;
else
largest=right;
if (right<=length && datas[right]>datas[largest])
largest=right;
//exchange i and largest
if (largest!=i)
{
temp=datas[i];
datas[i]=datas[largest];
datas[largest]=temp;
//recursive call the function, adjust form largest
adjust_max_heap(datas,length,largest);
}
}
void adjust_max_heap(int *datas, int length, int i)
{
int left,right,largest;
int temp;
while (1)
{
left=LEFT(i); //left child
right=RIGHT(i); //right child
//find the largest value among left and right and i.
if (left<=length && datas[left]>datas[i])
largest=i;
else
largest=i;
if (right<=length && datas[right]>datas[largest])
largest=right;
//exchange i and largest
if (largest!=i)
{
temp=datas[i];
datas[i]=datas[largest];
datas[largest]=temp;
i=largest;
continue;
}
else
break;
}
}
void build_max_heap(int *datas, int length)
{
int i;
//build max heap from the last parent node
for (i=length/2; i>0; i--)
adjust_max_heap(datas,length,i);
}
void heap_sort(int *datas, int length)
{
int i,temp;
//build max heap
build_max_heap(datas, length);
i=length;
//exchange the first value to the last unitl i=1
while (i>1)
{
temp=datas[i];
datas[i]=datas[1];
datas[1]=temp;
i--;
//adjust max heap, make sure the first value is the largest
adjust_max_heap(datas,i,1);
}
}
|
#include <stdio.h>
#include <limits.h>
int uadd_ok(unsigned, unsigned);
int main()
{
int x1 = UINT_MAX - 100;
int y1 = 200;
int y2 = 10;
printf("uadd_ok(UINT_MAX-100, 200) = %d\n", uadd_ok(UINT_MAX-100, 200));
printf("uadd_ok(UINT_MAX-100, 10 = %d\n", uadd_ok(UINT_MAX-100, 10));
return 0;
}
int uadd_ok(unsigned x, unsigned y)
{
return !(x > (x+y));
}
|
#include<stdio.h>
#include<stdlib.h>
int main()
{
char ch;
do {
/* code */
ch=_getch(); /*-32 77*/
if(ch==-32) /*if special arrow? */
ch=_getch(); /*read which arrow automatically*/
/* L-75 R-77 U-72 D-80*/
if(ch==75)
{
printf("Left\n");
}
if(ch==77)
{
printf("Right\n");
}
if(ch==72)
{
printf("Up\n");
}
if(ch==80)
{
printf("Down\n");
}
if(ch==13)
{
printf("Enter\n");
}
if(ch==27)
{
printf("Esc\n");
}
} while(ch!=27);
return 0;
}
|
#include <stdlib.h>
#define HB_START 1
#define HB_ACTIVE 2
#define HB_READY 3
#define HB_BOOT 4
#define HB_INIT 5
#define HB_CYCLE 30
#define MSG_RUN_STATUS 1
#define MSG_CONFIG 2
#define MSG_STATUS 3
typedef struct hbconfig hbconfig;
struct hbconfig {
volatile unsigned long time;
volatile unsigned char temp;
};
volatile unsigned char update;
volatile unsigned char status;
volatile unsigned char recv;
hbconfig config;
// Receive configuration over serial
void rcv(unsigned char);
// Send the config over serial
void send_config(void);
// Send the status over serial
void send_status(void);
// Busy loop during cooking session
void run(void);
|
// ImGui GLFW binding with OpenGL3 + shaders
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
// https://github.com/ocornut/imgui
#include <GLEW/glew.h>
struct ImDrawData;
namespace Urho3D
{
class Context;
class Texture2D;
}
Urho3D::Texture2D* ImGui_Impl_GetFontTexture();
void ImGui_Impl_RenderDrawLists(ImDrawData* draw_data);
void ImGui_Impl_Shutdown();
// Use if you want to reset your rendering device without losing ImGui state.
void ImGui_Impl_InvalidateDeviceObjects();
bool ImGui_Impl_CreateDeviceObjects(Urho3D::Context* context); |
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <IDEFoundation/IDEScriptingWrapper.h>
@interface IDEContainerItemWrapper : IDEScriptingWrapper
{
}
- (void)setProject:(id)arg1;
- (id)project;
- (void)setScriptingID:(id)arg1;
- (id)scriptingID;
- (void)setScriptingContainer:(id)arg1;
- (id)scriptingContainer;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__struct_twoIntsStruct_realloc_03.c
Label Definition File: CWE401_Memory_Leak.c.label.xml
Template File: sources-sinks-03.tmpl.c
*/
/*
* @description
* CWE: 401 Memory Leak
* BadSource: realloc Allocate data using realloc()
* GoodSource: Allocate data on the stack
* Sinks:
* GoodSink: call free() on data
* BadSink : no deallocation of data
* Flow Variant: 03 Control flow: if(5==5) and if(5!=5)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE401_Memory_Leak__struct_twoIntsStruct_realloc_03_bad()
{
struct _twoIntsStruct * data;
data = NULL;
if(5==5)
{
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (struct _twoIntsStruct *)realloc(data, 100*sizeof(struct _twoIntsStruct));
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine((twoIntsStruct *)&data[0]);
}
if(5==5)
{
/* POTENTIAL FLAW: No deallocation */
; /* empty statement needed for some flow variants */
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second 5==5 to 5!=5 */
static void goodB2G1()
{
struct _twoIntsStruct * data;
data = NULL;
if(5==5)
{
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (struct _twoIntsStruct *)realloc(data, 100*sizeof(struct _twoIntsStruct));
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine((twoIntsStruct *)&data[0]);
}
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Deallocate memory */
free(data);
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
struct _twoIntsStruct * data;
data = NULL;
if(5==5)
{
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (struct _twoIntsStruct *)realloc(data, 100*sizeof(struct _twoIntsStruct));
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine((twoIntsStruct *)&data[0]);
}
if(5==5)
{
/* FIX: Deallocate memory */
free(data);
}
}
/* goodG2B1() - use goodsource and badsink by changing the first 5==5 to 5!=5 */
static void goodG2B1()
{
struct _twoIntsStruct * data;
data = NULL;
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (struct _twoIntsStruct *)ALLOCA(100*sizeof(struct _twoIntsStruct));
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine((twoIntsStruct *)&data[0]);
}
if(5==5)
{
/* POTENTIAL FLAW: No deallocation */
; /* empty statement needed for some flow variants */
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
struct _twoIntsStruct * data;
data = NULL;
if(5==5)
{
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (struct _twoIntsStruct *)ALLOCA(100*sizeof(struct _twoIntsStruct));
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine((twoIntsStruct *)&data[0]);
}
if(5==5)
{
/* POTENTIAL FLAW: No deallocation */
; /* empty statement needed for some flow variants */
}
}
void CWE401_Memory_Leak__struct_twoIntsStruct_realloc_03_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE401_Memory_Leak__struct_twoIntsStruct_realloc_03_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE401_Memory_Leak__struct_twoIntsStruct_realloc_03_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#pragma once
// ---------------------------------------------------
// The CodeSizer Project
// Github: https://github.com/shishir993/codesizer
// Author: Shishir Bhat [http://www.shishirbhat.com]
// The MIT License (MIT)
// Copyright (c) 2014
//
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
|
// NDG_headers.h
//
// 2006/12/15
//---------------------------------------------------------
#ifndef NDG__headers_H__INCLUDED
#define NDG__headers_H__INCLUDED
#include "LOG_funcs.h"
// forward declarations
bool InitGlobalInfo();
void FreeGlobalInfo();
#ifdef WIN32
// process management routines
#include <Windows.h>
// clear {min,max} macros
#undef min
#undef max
#endif
#endif // NDG__headers_H__INCLUDED
|
// This code is part of the Super Play Library (http://www.superplay.info),
// and may only be used under the terms contained in the LICENSE file,
// included with the Super Play Library.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
#pragma once
#include "IGame.h"
#include "GameHeader.h"
NAMESPACE(SPlay)
class IDisplay;
class IInput;
class ISoundSystem;
class ResourceManager;
class System
{
friend class Platform;
friend class Sound;
public:
// Initialize
static bool initialize();
// Close
static void close();
// Run loop
static bool runLoop();
// Redraw
static void redraw();
// Seed random number .
static void seedRandomNumber(int _iSeed);
// Get a random value, will never return _iUpper
static int getRandomValue(int _iUpper);
// Get display
static IDisplay* getDisplay() {return ms_pDisplay;}
// Get game
static IGame* getGame() {return ms_pGame;}
// Get input
static IInput* getInput() {return ms_pInput;}
// Get resource manager
static ResourceManager* getResourceManager() {return ms_pResourceManager;}
// Get sound system
static ISoundSystem* getSoundSystem() {return ms_pSoundSystem;}
// Get game header
static const GameHeader& getGameHeader() {return ms_gameHeader;}
// Get updateable game header
static GameHeader& getUpdateableGameHeader() {return ms_gameHeader;}
protected:
// Display
static IDisplay* ms_pDisplay;
// Input
static IInput* ms_pInput;
// Input
static ISoundSystem* ms_pSoundSystem;
private:
// Game header
static GameHeader ms_gameHeader;
// Game
static IGame* ms_pGame;
// Resource manager
static ResourceManager* ms_pResourceManager;
};
ENDNAMESPACE
|
//
//
// 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 img_rad_INCL_
#define img_rad_INCL_
/*! \file
\brief Declarations for img::rad
*/
#include "libdat/grid.h"
#include "libmath/Partition.h"
#include "libdat/Region.h"
#include "libprob/Histogram.h"
#include <utility>
#include <array>
#include <vector>
namespace img
{
//! Radiometric processing functions
namespace rad
{
//! Histogram-equalized grid -- TODO move someplace (to libprob?)
template <typename PixType>
inline
dat::grid<PixType>
equalized
( dat::grid<PixType> const & from
, math::Partition const & part
);
//! Histograms for (all, only active) pixels within areas
template <typename PixType>
std::pair<prob::Histogram, prob::Histogram>
histogramAllActive
( std::array<dat::grid<PixType>, 3u> const & bands
, math::Partition const & intenPartition
, std::vector<dat::Area<size_t> > const & sampAreas
);
}
}
// Inline definitions
#include "libimg/rad.inl"
#endif // img_rad_INCL_
|
// JavaScriptEngine.h
#pragma once
#include <memory>
#include <Core/Reflection/Reflection.h>
#include "config.h"
namespace sge
{
struct Scene;
struct SGE_JAVASCRIPT_API JavaScriptEngine
{
SGE_REFLECTED_TYPE;
struct State;
////////////////////////
/// Constructors ///
public:
JavaScriptEngine(Scene& scene);
~JavaScriptEngine();
///////////////////
/// Methods ///
public:
void register_type(const TypeInfo& type);
void run_expression(const char* expr);
void load_script(const char* path);
//////////////////
/// Fields ///
private:
std::unique_ptr<State> _state;
};
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_console_execlp_01.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-01.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: console Read input from the console
* GoodSource: Fixed string
* Sink: execlp
* BadSink : execute command with wexeclp
* Flow Variant: 01 Baseline
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT L"cmd.exe"
#define COMMAND_ARG1 L"/c"
#define COMMAND_ARG2 L"dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH L"/bin/sh"
#define COMMAND_INT L"sh"
#define COMMAND_ARG1 L"ls"
#define COMMAND_ARG2 L"-la"
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#include <process.h>
#define EXECLP _wexeclp
#else /* NOT _WIN32 */
#define EXECLP execlp
#endif
#ifndef OMITBAD
void CWE78_OS_Command_Injection__wchar_t_console_execlp_01_bad()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
{
/* Read input from the console */
size_t dataLen = wcslen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the console */
if (fgetws(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgetws() */
dataLen = wcslen(data);
if (dataLen > 0 && data[dataLen-1] == L'\n')
{
data[dataLen-1] = L'\0';
}
}
else
{
printLine("fgetws() failed");
/* Restore NUL terminator if fgetws fails */
data[dataLen] = L'\0';
}
}
}
/* wexeclp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
/* wexeclp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
void CWE78_OS_Command_Injection__wchar_t_console_execlp_01_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE78_OS_Command_Injection__wchar_t_console_execlp_01_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_console_execlp_01_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// UIResponder+Helpers.h
// CocoaTouchHelpers
//
// Created by Maxim Khatskevich on 5/27/13.
// Copyright (c) 2013 Maxim Khatskevich. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIResponder (Helpers)
@property (readonly, nonatomic) NSURL *applicationDocumentsDirectory;
@property (readonly, nonatomic) NSUserDefaults *userDefaults;
@property (readonly, nonatomic) UIStoryboard *currentStoryboard;
@property (readonly, nonatomic) UIView *firstResponder;
@property (weak, nonatomic) UIPopoverController *currentPopover;
+ (UIPopoverController *)currentPopover;
- (void)showMem;
@end |
//
// AppDelegate.h
// WBTableViewDemo
//
// Created by Bing on 15/5/18.
// Copyright (c) 2015年 Bing. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef GEZIRA_MATRIX_H
#define GEZIRA_MATRIX_H
#include <math.h>
typedef struct {
float a, b, c, d, e, f;
} Matrix_t;
static Matrix_t
Matrix ()
{
Matrix_t M = { 1, 0, 0, 1, 0, 0 };
return M;
}
static Matrix_t
Matrix_translate (Matrix_t M, float x, float y)
{
Matrix_t M_ = { M.a, M.b, M.c, M.d,
M.a * x + M.c * y + M.e,
M.b * x + M.d * y + M.f };
return M_;
}
static Matrix_t
Matrix_rotate (Matrix_t M, float t)
{
Matrix_t M_ = { M.a * cos (t) + M.c * sin (t),
M.b * cos (t) + M.d * sin (t),
M.a * -sin (t) + M.c * cos (t),
M.b * -sin (t) + M.d * cos (t),
M.e, M.f };
return M_;
}
static Matrix_t
Matrix_scale (Matrix_t M, float sx, float sy)
{
Matrix_t M_ = { M.a * sx, M.b * sx, M.c * sy, M.d * sy, M.e, M.f };
return M_;
}
static Matrix_t
Matrix_inverse (Matrix_t M)
{
float det = M.a * M.d - M.b * M.c;
if (det == 0)
return (Matrix_t) {0, 0, 0, 0, 0, 0};
float n = 1 / det;
return (Matrix_t)
{n * M.d, -n * M.b, -n * M.c, n * M.a,
n * (M.f * M.c - M.d * M.e), -n * (M.f * M.a - M.b * M.e)};
}
#endif
|
#pragma once
#include <vector>
#include <array>
#include <SDL2\SDL.h>
#include <glm/glm.hpp>
#include "ShaderProgram.h"
#include "ScreenQuad.h"
#include "Cube.h"
#include "WireframeCube.h"
#include "CellularAutomaton.h"
#include "ColorGradient.h"
class MainWindow
{
public:
MainWindow(const int width, const int height);
~MainWindow();
MainWindow(const MainWindow&) = delete;
const MainWindow& operator=(const MainWindow&) = delete;
bool init();
void run();
private:
bool loadSettings(std::string source);
bool initGL();
bool initCUDA();
void processEvents();
void logic();
void render();
void close();
void updateViewPort(unsigned int width, unsigned height);
void updateCamera(const glm::vec3& location);
void renderAsWireframe(bool wireframe, GLfloat lineWidth = 1.0f);
GLuint initSSBO(GLuint size, const void* data, GLenum usage = GL_DYNAMIC_DRAW);
void bindSSBO(GLuint layoutLocation, const int* data = nullptr, size_t size = 0) const;
void unBindSSBO() const;
void changeRule(int ruleNumber);
CellularAutomaton* cellularAutomata;
// settings
int windowWidth;
int windowHeight;
int antialiassing;
int cubeDimension;
int initialCubeSize;
float initialCubeDensity;
glm::vec3 backgroundColor;
glm::vec3 boundingBoxColor;
float boundingBoxTransparency;
glm::vec3 wireframeBoundingBoxColor;
std::vector<ColorGradient> colorGradients;
std::vector<CellularAutomaton::Rule> rulesets;
// rendering
SDL_Window* window;
SDL_Surface* screenSurface;
SDL_GLContext glContext;
ShaderProgram* triangleShader;
ShaderProgram* lineShader;
ShaderProgram* boundingCube_shader;
GLuint ssbo;
bool cudaSupported;
// meshes
ScreenQuad* quad;
Cube* cube;
WireframeCube* wireframeCube;
Cube* boundingCube;
WireframeCube* wireframeBoundingCube;
// matrices
glm::mat4 projectionM;
glm::mat4 translateM;
glm::mat4 rotateM;
glm::mat4 scaleM;
glm::mat4 worldM;
glm::mat4 viewM;
glm::vec3 eyePos;
// event handling
bool isMouseButtonDown;
bool isMouseMoving;
glm::vec2 clickPos;
glm::vec2 motionPos;
float zoomFactor;
bool isCalculating;
bool isRunning;
int colorTheme;
Uint32 updateFrequency;
Uint32 lastUpdate;
Uint32 maxFPS;
Uint32 lastFrame;
};
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: ./analysis/common/src/java/org/tartarus/snowball/ext/LithuanianStemmer.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_OrgTartarusSnowballExtLithuanianStemmer")
#ifdef RESTRICT_OrgTartarusSnowballExtLithuanianStemmer
#define INCLUDE_ALL_OrgTartarusSnowballExtLithuanianStemmer 0
#else
#define INCLUDE_ALL_OrgTartarusSnowballExtLithuanianStemmer 1
#endif
#undef RESTRICT_OrgTartarusSnowballExtLithuanianStemmer
#if __has_feature(nullability)
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wnullability"
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#endif
#if !defined (OrgTartarusSnowballExtLithuanianStemmer_) && (INCLUDE_ALL_OrgTartarusSnowballExtLithuanianStemmer || defined(INCLUDE_OrgTartarusSnowballExtLithuanianStemmer))
#define OrgTartarusSnowballExtLithuanianStemmer_
#define RESTRICT_OrgTartarusSnowballSnowballProgram 1
#define INCLUDE_OrgTartarusSnowballSnowballProgram 1
#include "org/tartarus/snowball/SnowballProgram.h"
/*!
@brief This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.
*/
@interface OrgTartarusSnowballExtLithuanianStemmer : OrgTartarusSnowballSnowballProgram
#pragma mark Public
- (instancetype __nonnull)init;
- (jboolean)isEqual:(id)o;
- (NSUInteger)hash;
- (jboolean)stem;
@end
J2OBJC_STATIC_INIT(OrgTartarusSnowballExtLithuanianStemmer)
FOUNDATION_EXPORT void OrgTartarusSnowballExtLithuanianStemmer_init(OrgTartarusSnowballExtLithuanianStemmer *self);
FOUNDATION_EXPORT OrgTartarusSnowballExtLithuanianStemmer *new_OrgTartarusSnowballExtLithuanianStemmer_init(void) NS_RETURNS_RETAINED;
FOUNDATION_EXPORT OrgTartarusSnowballExtLithuanianStemmer *create_OrgTartarusSnowballExtLithuanianStemmer_init(void);
J2OBJC_TYPE_LITERAL_HEADER(OrgTartarusSnowballExtLithuanianStemmer)
#endif
#if __has_feature(nullability)
#pragma clang diagnostic pop
#endif
#pragma pop_macro("INCLUDE_ALL_OrgTartarusSnowballExtLithuanianStemmer")
|
/*
Deformable convolution Python module.
The original code for the convolution is largely based on that of Song Ho An.
http://www.songho.ca/dsp/convolution/convolution.html
Accessed: 14/03/2015
*/
#include <Python.h>
#include <numpy/arrayobject.h>
#include <math.h>
#define QUOTE(s) # s
#define get_double(a, i, j) *((double *) PyArray_GETPTR2(a, i, j))
#define set_double(a, i, j, value) *((double *) PyArray_GETPTR2(a, i, j)) = value;
#define get_int(a, i, j) *((int *) PyArray_GETPTR2(a, i, j))
#define set_int(a, i, j, value) *((int *) PyArray_GETPTR2(a, i, j)) = value;
void convolve(PyArrayObject* image, PyArrayObject* mask, PyArrayObject* kernel, PyObject* out)
{
int rows = (int) PyArray_DIM(image, 0);
int cols = (int) PyArray_DIM(image, 1);
npy_intp kernelSize = PyArray_DIM(kernel, 0);
int kRows = (int) kernelSize;
int kCols = (int) kernelSize;
// find center position of kernel (half of kernel size)
int kCenterX = kCols / 2;
int kCenterY = kRows / 2;
for(int i=0; i < rows; ++i) // rows
{
for(int j=0; j < cols; ++j) // columns
{
int nonzero_count = 0;
double norm_sum = 0;
for(int m=0; m < kRows; ++m) // kernel rows
{
int mm = kRows - 1 - m; // row index of flipped kernel
for(int n=0; n < kCols; ++n) // kernel columns
{
int nn = kCols - 1 - n; // column index of flipped kernel
// index of input signal, used for checking boundary
int ii = i + (m - kCenterY);
int jj = j + (n - kCenterX);
// ignore input samples which are out of bound
if(ii >= 0 && ii < rows && jj >= 0 && jj < cols )
{
double value = get_double(kernel, mm, nn);
double mask_value = get_double(mask, ii, jj);
if (mask_value > 0)
{
nonzero_count++;
norm_sum += value;
}
}
}
}
//ignore areas which are empty
if (nonzero_count == 0)
{
continue;
}
//Kernel has been deformed and is therefore no longer seperable
else
{
double value = get_double(out, i, j);
for(int m=0; m < kRows; ++m) // kernel rows
{
int mm = kRows - 1 - m; // row index of flipped kernel
for(int n=0; n < kCols; ++n) // kernel columns
{
int nn = kCols - 1 - n; // column index of flipped kernel
// index of input signal, used for checking boundary
int ii = i + (m - kCenterY);
int jj = j + (n - kCenterX);
// ignore input samples which are out of bound
if(ii >= 0 && ii < rows && jj >= 0 && jj < cols )
{
double kernel_value = get_double(kernel, mm, nn);
double mask_value = get_double(mask, ii, jj);
//normalise value by local neighbourhood
kernel_value -= norm_sum / nonzero_count;
///weight by the mask value
kernel_value *= mask_value;
//convolve with image pixel
value += get_double(image,ii,jj) * kernel_value;
}
}
}
set_double(out, i, j, value);
}
}
}
}
static PyObject* deformable_covolution(PyObject* self, PyObject* args)
{
PyArrayObject *image;
PyArrayObject *mask;
PyArrayObject *kernel;
PyObject *out_array;
/* parse the image, mask and kernel */
if (!PyArg_ParseTuple(args, "O!O!O!", &PyArray_Type, &image, &PyArray_Type, &mask, &PyArray_Type, &kernel))
return NULL;
/* construct the output array, like the input image array */
out_array = PyArray_NewLikeArray(image, NPY_ANYORDER, NULL, 0);
if (out_array == NULL)
return NULL;
PyArray_FILLWBYTE(out_array, 0);
convolve(image, mask, kernel, out_array);
Py_INCREF(out_array);
return out_array;
}
/* define functions in module */
static PyMethodDef module_methods[] =
{
{"deformable_covolution", deformable_covolution, METH_VARARGS,
"Convolve an image with a kernel and a mask. Areas outside the mask will be"
"ignored by the convolution."},
{NULL, NULL, 0, NULL}
};
/* module initialization */
PyMODINIT_FUNC initconvolve_tools(void)
{
(void) Py_InitModule("convolve_tools", module_methods);
/* IMPORTANT: this must be called */
import_array();
}
|
#include <reg52.h>
#include <stdio.h>
#include <absacc.h>
#include <intrins.h>
#include "init_serial.h"
sbit SCL_IC_CARD = P1^0;
sbit SDA_IC_CARD = P1^1;
sbit WP_IC_CARD = P1^2;
bdata char com_data;
sbit mos_bit = com_data^7;
sbit low_bit = com_data^0;
unsigned char data display_buffer[3] _at_ 0x40;
unsigned char data b_buffer[3] _at_ 0x50;
unsigned char idata a_buffer[6] _at_ 0xc5;
unsigned char (*r)();
unsigned char i;
void delay(int n) {
int i;
for (i = 0; i < n; i++);
}
void start(void) {
SDA_IC_CARD = 1;
SCL_IC_CARD = 1;
SDA_IC_CARD = 0;
SCL_IC_CARD = 0;
}
void stop(void) {
SDA_IC_CARD = 0;
SCL_IC_CARD = 1;
SDA_IC_CARD = 1;
}
void ack(void) {
SCL_IC_CARD = 1;
SCL_IC_CARD = 0;
}
void shift8(char a) {
data unsigned char i;
com_data = a;
for (i = 0; i < 8; i++) {
SDA_IC_CARD = mos_bit;
SCL_IC_CARD = 1;
SCL_IC_CARD = 0;
com_data *= 2;
}
}
unsigned char rd_24c01(char a) {
data unsigned char i, command;
SDA_IC_CARD = 1;
SCL_IC_CARD = 0;
start();
command = 0xa0;
shift8(command);
ack();
shift8(a);
ack();
start();
command = 0xa1;
shift8(command);
ack();
SDA_IC_CARD = 1;
for (i = 0; i < 8; i++) {
com_data *= 2;
SCL_IC_CARD = 1;
low_bit = SDA_IC_CARD;
SCL_IC_CARD = 0;
}
stop();
return com_data;
}
void wr_24c01(char a, char b) {
data unsigned char command;
WP_IC_CARD = 0;
_nop_();
SDA_IC_CARD = 1;
SCL_IC_CARD = 0;
start();
command = 0xa0;
shift8(command);
ack();
shift8(a);
ack();
shift8(b);
ack();
stop();
_nop_();
WP_IC_CARD = 1;
}
void action(void) {
for (i = 0; i <= 2; i++) {
wr_24c01(i, display_buffer[i]);
delay(250);
}
printf("\nData read: ");
for (i = 0; i <= 2; i++) {
b_buffer[i] = rd_24c01(i);
printf("%.2bX", b_buffer[i]);
delay(250);
}
}
int main() {
init_serial();
r = 0x13c1;
EA = 1;
EX0 = 1;
IT0 = 1;
WP_IC_CARD = 1;
printf("\n");
action();
for (; ;) {
for (i = 0; i <= 2; i++) {
a_buffer[2 * i] = (b_buffer[i] & 0xf0) >> 4;
a_buffer[2 * i + 1] = b_buffer[i] & 0xf;
}
r();
}
}
void key_int(void) interrupt 0 {
display_buffer[0]++;
action();
}
|
/*
// @(#) keepalivecfg.h
//
// License: Creative Commons CC0
// http://creativecommons.org/publicdomain/zero/1.0/legalcode
// Author: James Sainsbury
// toves@sdf.lonestar.org
//
*/
# if !defined(KEEPALIVECFG_H)
# define KEEPALIVECFG_H
# if !defined(LIBKEEPALIVE_CFG)
# define LIBKEEPALIVE_CFG "/proxy/keep.cfg"
# endif
typedef struct cfg_kl CFG_KL;
typedef struct sockaddr_in SOCKADDR;
typedef in_addr_t h_addr_t;
int cfg_init (CFG_KL** cfp, char* cfgfile);
int cfg_parameters (CFG_KL* cf, int sd, int type, __CONST_SOCKADDR_ARG sock, socklen_t len, int*, int*, int*, int*);
# endif
|
/*
** JNetLib
** Copyright (C) 2000-2001 Nullsoft, Inc.
** Author: Justin Frankel
** File: netinc.h - network includes and portability defines (used internally)
** License: see License.txt
**
** Unicode support by Jim Park -- 08/24/2007
*/
#ifndef _NETINC_H_
#define _NETINC_H_
#include <windows.h>
#include "util.h"
#define strcasecmp(x,y) stricmp(x,y)
#define ERRNO (WSAGetLastError())
#define SET_SOCK_BLOCK(s,block) { unsigned long __i=block?0:1; ioctlsocket(s,FIONBIO,&__i); }
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEWOULDBLOCK
#define memset mini_memset
#define memcpy mini_memcpy
// Jim Park: For Unicode support, we need to distinguish whether we are working on
// Unicode or ANSI.
#define strcpy lstrcpyA
#define strncpy lstrcpynA
#define strcat lstrcatA
#define strlen lstrlenA
#define malloc(x) (new char[x])
#define free(x) {delete [] x;}
typedef int socklen_t;
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif
#ifndef INADDR_ANY
#define INADDR_ANY 0
#endif
#ifndef SHUT_RDWR
#define SHUT_RDWR 2
#endif
#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif
#define PORTABLE_SOCKET SOCKET
#endif //_NETINC_H_
|
#include <stdio.h>
void main(void)
{
int i;
int a[] = { 1,-1,0, 6,5 };
printf("origin value:{");
for (i = 0; i < 5; i++) {
printf(",%d", a[i]);
}
printf("}\n");
printf("sorted value:{");
for (i = 0; i < 5; i++) {
printf(",%d", a[i]);
}
printf("}\n");
} |
/* $Id: dotprocs.h,v 1.16 2011/01/25 16:30:48 ellson Exp $ $Revision: 1.16 $ */
/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
#ifndef DOTPROCS_H
#define DOTPROCS_H
#ifdef _BEGIN_EXTERNS_
_BEGIN_EXTERNS_ /* public data */
#endif
/* tabs at 8, or you're a sorry loser */
#ifdef __cplusplus
extern "C" {
#endif
#include "aspect.h"
extern void acyclic(Agraph_t *);
extern void allocate_ranks(Agraph_t *);
extern void build_ranks(Agraph_t *, int);
extern void build_skeleton(Agraph_t *, Agraph_t *);
extern void class1(Agraph_t *);
extern void class2(Agraph_t *);
extern void decompose(Agraph_t *, int);
extern void delete_fast_edge(Agedge_t *);
extern void delete_fast_node(Agraph_t *, Agnode_t *);
extern void delete_flat_edge(Agedge_t *);
extern void dot_cleanup(graph_t * g);
extern void dot_layout(Agraph_t * g);
extern void dot_init_node_edge(graph_t * g);
extern void dot_scan_ranks(graph_t * g);
extern void expand_cluster(Agraph_t *);
extern Agedge_t *fast_edge(Agedge_t *);
extern void fast_node(Agraph_t *, Agnode_t *);
extern void fast_nodeapp(Agnode_t *, Agnode_t *);
extern Agedge_t *find_fast_edge(Agnode_t *, Agnode_t *);
extern Agedge_t *find_flat_edge(Agnode_t *, Agnode_t *);
extern void flat_edge(Agraph_t *, Agedge_t *);
extern int flat_edges(Agraph_t *);
extern void install_cluster(Agraph_t *, Agnode_t *, int, nodequeue *);
extern void install_in_rank(Agraph_t *, Agnode_t *);
extern int is_cluster(Agraph_t *);
extern void dot_compoundEdges(Agraph_t *);
extern Agedge_t *make_aux_edge(Agnode_t *, Agnode_t *, double, int);
extern void mark_clusters(Agraph_t *);
extern void mark_lowclusters(Agraph_t *);
extern int mergeable(edge_t * e, edge_t * f);
extern void merge_chain(Agraph_t *, Agedge_t *, Agedge_t *, int);
extern void merge_oneway(Agedge_t *, Agedge_t *);
extern int ncross(Agraph_t *);
extern Agedge_t *new_virtual_edge(Agnode_t *, Agnode_t *, Agedge_t *);
extern int nonconstraint_edge(Agedge_t *);
extern void other_edge(Agedge_t *);
extern void rank1(graph_t * g);
extern int portcmp(port p0, port p1);
extern int ports_eq(edge_t *, edge_t *);
extern void rec_reset_vlists(Agraph_t *);
extern void rec_save_vlists(Agraph_t *);
extern void reverse_edge(Agedge_t *);
extern void safe_other_edge(Agedge_t *);
extern void save_vlist(Agraph_t *);
extern void unmerge_oneway(Agedge_t *);
extern Agedge_t *virtual_edge(Agnode_t *, Agnode_t *, Agedge_t *);
extern Agnode_t *virtual_node(Agraph_t *);
extern void virtual_weight(Agedge_t *);
extern void zapinlist(elist *, Agedge_t *);
#if defined(_BLD_dot) && defined(_DLL)
# define extern __EXPORT__
#endif
extern void dot_concentrate(Agraph_t *);
extern void dot_mincross(Agraph_t *, int);
extern void dot_position(Agraph_t *, aspect_t*);
extern void dot_rank(Agraph_t *, aspect_t*);
extern void dot_sameports(Agraph_t *);
extern void dot_splines(Agraph_t *);
#undef extern
#ifdef _END_EXTERNS_
_END_EXTERNS_
#endif
#ifdef __cplusplus
}
#endif
#endif
|
/*
* StreamUtils.h
*
* This file is a part of LZMA compression module for NSIS.
*
* Original LZMA SDK Copyright (C) 1999-2006 Igor Pavlov
* Modifications Copyright (C) 2003-2016 Amir Szekely <kichik@netvision.net.il>
*
* Licensed under the Common Public License version 1.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licence details can be found in the file COPYING.
*
* This software is provided 'as-is', without any express or implied
* warranty.
*/
#ifndef __STREAMUTILS_H
#define __STREAMUTILS_H
#include "../IStream.h"
HRESULT ReadStream(ISequentialInStream *stream, void *data, UInt32 size, UInt32 *processedSize);
HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size, UInt32 *processedSize);
#endif
|
/**
* @file es_mpool.h
* @brief ES memory pool manager, not thread safe!
*/
#ifndef __ESO_MEMPOOL_H__
#define __ESO_MEMPOOL_H__
#include "es_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef WIN32
//#define ES_MEMPOOL_DEBUG
#endif
/*
* memory node find mode
*/
typedef enum {
ES_MFIND_SIZE,
ES_MFIND_FAST
} es_mfind_e;
typedef struct es_mpool_t es_mpool_t;
/**
* memory pool create
*/
es_mpool_t* eso_mempool_create(void);
/**
* memory pool destroy
*/
void eso_mempool_free(es_mpool_t **mpool);
/**
* get memory pool count information
*/
void eso_mempool_count(es_mpool_t *mpool,
es_size_t *user_malloc_size,
es_size_t *real_malloc_size);
/**
* dump for debug (only WIN32)
*/
void eso_mempool_dump(es_mpool_t *mpool, const char *flag);
/**
* check memory overlap for debug (only WIN32)
*/
void eso_mempool_check(es_mpool_t *mpool, const char *flag);
/**
* realloc
*/
void* eso_mprealloc(void *pold, es_size_t size);
void* eso_mprealloc_ext(void *pold, es_size_t size, es_mfind_e type);
/**
* free
*/
void eso_mpfree(void* ptr);
void eso_mpfree0(void** ptr);
#define eso_mpfree_and_nil(p) eso_mpfree0((void**)(p))
/**
* get memory node max size
*/
es_size_t eso_mpnode_size(void *ptr);
#ifdef ES_MEMPOOL_DEBUG
/**
* malloc
*/
void* eso_mpmalloc_debug(es_mpool_t *mpool, es_size_t size, const es_int8_t *file, es_int32_t line);
void* eso_mpmalloc_ext_debug(es_mpool_t *mpool, es_size_t size, es_mfind_e type, const es_int8_t *file, es_int32_t line);
/**
* calloc
*/
void* eso_mpcalloc_debug(es_mpool_t *mpool, es_size_t size, const es_int8_t *file, es_int32_t line);
void* eso_mpcalloc_ext_debug(es_mpool_t *mpool, es_size_t size, es_mfind_e type, const es_int8_t *file, es_int32_t line);
#define eso_mpmalloc(pool,n) eso_mpmalloc_debug(pool, n, (const es_int8_t*)__FILE__, __LINE__)
#define eso_mpmalloc_ext(pool,n,t) eso_mpmalloc_ext_debug(pool, n, t, (const es_int8_t*)__FILE__, __LINE__)
#define eso_mpcalloc(pool,n) eso_mpcalloc_debug(pool, n, (const es_int8_t*)__FILE__, __LINE__)
#define eso_mpcalloc_ext(pool,n,t) eso_mpcalloc_ext_debug(pool, n, t, (const es_int8_t*)__FILE__, __LINE__)
#else
/**
* malloc
*/
void* eso_mpmalloc(es_mpool_t *mpool, es_size_t size);
void* eso_mpmalloc_ext(es_mpool_t *mpool, es_size_t size, es_mfind_e type);
/**
* calloc
*/
void* eso_mpcalloc(es_mpool_t *mpool, es_size_t size);
void* eso_mpcalloc_ext(es_mpool_t *mpool, es_size_t size, es_mfind_e type);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __ESO_MEMPOOL_H__ */
|
//-----------------------------------------------------------------------------
// File: SystemViewsModel.h
//-----------------------------------------------------------------------------
// Project: Kactus2
// Author: Joni-Matti Määttä
// Date: 13.7.2012
//
// Description:
// The model to manage system views for a table view.
//-----------------------------------------------------------------------------
#ifndef SYSTEMVIEWSMODEL_H
#define SYSTEMVIEWSMODEL_H
#include <QAbstractTableModel>
#include <QSortFilterProxyModel>
#include <QSharedPointer>
class Component;
class SystemView;
//-----------------------------------------------------------------------------
//! The model to manage the system views for a table view
//-----------------------------------------------------------------------------
class SystemViewsModel : public QAbstractTableModel
{
Q_OBJECT
public:
/*! The constructor
*
* @param [in] component The component being edited.
* @param [in] parent The owner of the model
*/
SystemViewsModel(QSharedPointer<Component> component, QObject* parent);
//! The destructor
virtual ~SystemViewsModel();
/*! Get the number of rows an item contains.
*
* @param [in] parent Identifies the parent that's row count is requested.
*
* @return Number of rows the item has.
*/
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
/*! Get the number of columns the item has to be displayed.
*
* @param [in] parent Identifies the parent that's column count is requested.
*
* @return The number of columns to be displayed.
*/
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
/*! Get the item flags that defines the possible operations for the item.
*
* @param [in] index Model index that identifies the item.
*
* @return Qt::ItemFlags specify the possible operations for the item.
*/
Qt::ItemFlags flags(const QModelIndex& index) const;
/*! Get the header data for specified header.
*
* @param [in] section The section specifies the row/column number for the header.
* @param [in] orientation Specified if horizontal or vertical header is wanted.
* @param [in] role Specifies the type of the requested data.
*
* @return QVariant Contains the requested data.
*/
virtual QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
/*! Get the data for specified item.
*
* @param [in] index Specifies the item that's data is requested.
* @param [in] role The role that defines what kind of data is requested.
*
* @return QVariant Contains the data for the item.
*/
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
/*! Save the data to the model for specified item
*
* @param [in] index The model index of the item that's data is to be saved.
* @param [in] value The data that is to be saved.
* @param [in] role The role specifies what kind of data should be saved.
*
* @return True if saving happened successfully.
*/
bool setData(const QModelIndex& index, const QVariant& value,
int role = Qt::EditRole);
/*! Check if the software views model is in a valid state.
*
* @return bool True if the state is valid and writing is possible.
*/
bool isValid() const;
/*!
* Returns the supported actions of a drop.
*
* @return The drop actions supported by the model.
*/
Qt::DropActions supportedDropActions() const;
/*!
* Returns a list of supported MIME data types.
*
* @return The supported MIME types.
*/
QStringList mimeTypes() const;
/*!
* Handler for the dropped MIME data.
*
* @param [in] data The data associated to the drop.
* @param [in] action The drop action.
* @param [in] row The row beneath the drop position.
* @param [in] column The column beneath the drop position.
* @param [in] parent The parent index of the drop position.
*
* @return True, if the model could handle the data, otherwise false.
*/
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
const QModelIndex &parent);
public slots:
/*! Add a new item to the given index.
*
* @param [in] index The index identifying the position for new item.
*
*/
virtual void onAddItem(const QModelIndex& index);
/*! Remove the item in the given index.
*
* @param [in] index The index identifying the item to remove.
*
*/
virtual void onRemoveItem(const QModelIndex& index);
signals:
//! Emitted when the contents of the model changes.
void contentChanged();
/*! Emitted when a new software view is added to the model.
*
* @param [in] index The index of the added software view.
*
*/
void viewAdded(int index);
/*! Emitted when a view is removed from the model.
*
* @param [in] index The index of the software view to remove.
*
*/
void viewRemoved(int index);
private:
//! No copying
SystemViewsModel(const SystemViewsModel& other);
//! No assignment
SystemViewsModel& operator=(const SystemViewsModel& other);
//! Contains the software views to edit.
QList<QSharedPointer<SystemView> > views_;
//! The component being edited.
QSharedPointer<Component> component_;
};
#endif // SYSTEMVIEWSMODEL_H
|
#ifndef _DEF_OPENCV_INTERFACES_
#define _DEF_OPENCV_INTERFACES_
#ifdef __APPLE__
#include <opencv/cv.h>
#include <opencv/highgui.h>
#else
#include <opencv/cv.h>
#include <opencv/highgui.h>
#endif
#include <vector>
#define VIDEO_TYPE 2
#define IMAGE_TYPE 1
typedef uchar elem_t;
namespace OpenCVInterfaces
{
bool CVImageLoader(const char * file_name, cv::Mat& CV_IMAGE_MAT);
void CVImagePicChecker(const char *file_name);
void CVImageSaver(const char *file_name, cv::Mat& CV_IMAGE_MAT);
void CVImageShower(cv::Mat& CV_IMAGE_MAT, cv::Mat& CV_IMAGE_RES_MAT);
bool CVVideo2Image(const char * file_name, std::vector<cv::Mat>& CV_FRAMES_MAT, int max_frames );
bool CVImage2Video(std::vector<cv::Mat>& CV_FRAMES_RES_MAT, int max_frames);
}
bool OpenCVInterfaces::CVImageLoader(const char *file_name, cv::Mat& CV_IMAGE_MAT){
CV_IMAGE_MAT = cv::imread(file_name, CV_LOAD_IMAGE_COLOR);
if(!CV_IMAGE_MAT.data){
printf("OPENCV_ERROR: No Image Data!\n");
return false;
}
return true;
}
void OpenCVInterfaces::CVImagePicChecker(const char *file_name){
cv::Mat CV_IMAGE_MAT;
OpenCVInterfaces::CVImageLoader(file_name, CV_IMAGE_MAT);
int CV_IMAGE_CHANNELS = CV_IMAGE_MAT.channels();
int CV_IMAGE_ROWS = CV_IMAGE_MAT.rows;
int CV_IMAGE_COLS = CV_IMAGE_MAT.cols * CV_IMAGE_CHANNELS;
printf("channel number: %d\n", CV_IMAGE_CHANNELS);
printf("rows: %d cols: %d\n", CV_IMAGE_ROWS, CV_IMAGE_COLS);
printf("continuous: %d\n", CV_IMAGE_MAT.isContinuous());
if(CV_IMAGE_MAT.isContinuous()){
CV_IMAGE_COLS *= CV_IMAGE_ROWS;
CV_IMAGE_ROWS = 1;
}
printf("depth: %u CV_8U: %d\n", CV_IMAGE_MAT.depth(), CV_8U);
elem_t* p = CV_IMAGE_MAT.data;
for(int i = 0; i < CV_IMAGE_COLS * CV_IMAGE_ROWS; i++){
if(i % 3 == 0) printf("B: %5u ", p[i]);
else if(i % 3 == 1) printf("R: %5u ", p[i]);
else if(i % 3 == 2) printf("G: %5u\n", p[i]);
}
return;
}
void OpenCVInterfaces::CVImageSaver(const char *file_name, cv::Mat& CV_IMAGE_MAT){
cv::imwrite(file_name, CV_IMAGE_MAT);
printf("INFO: Image \"%s\" saved\n", file_name);
return ;
}
void OpenCVInterfaces::CVImageShower(cv::Mat& CV_IMAGE_MAT, cv::Mat& CV_IMAGE_RES_MAT){
cv::namedWindow("Display", cv::WINDOW_AUTOSIZE );
cv::imshow("original", CV_IMAGE_MAT);
cv::imshow("dehaze", CV_IMAGE_RES_MAT);
cv::waitKey(0);
return ;
}
bool OpenCVInterfaces::CVVideo2Image(const char * file_name, std::vector<cv::Mat>& CV_FRAMES_MAT, int max_frames ){
std::string video_name(file_name);
cv::VideoCapture captured_video(video_name);
if(!captured_video.isOpened()){
printf("ERROR: Failed to open a video!\n");
return false;
}
for(int i = 0; i < max_frames; i++){
cv::Mat captured_frame;
captured_video.read(captured_frame);
if(!captured_frame.empty())
CV_FRAMES_MAT.push_back(captured_frame);
//std::cout << captured_frame << std::endl;
}
captured_video.release();
return true;
}
bool OpenCVInterfaces::CVImage2Video(std::vector<cv::Mat>& CV_FRAMES_RES_MAT, int max_frames){
int numframes = max_frames;
int fourcc = CV_FOURCC('j','p','e','g');
double fps = 20;
int frameWidth = CV_FRAMES_RES_MAT[0].cols;
int frameHeight = CV_FRAMES_RES_MAT[0].rows;
cv::VideoWriter Writer;
std::string _videoTosave("out.mov");
Writer = cv::VideoWriter(_videoTosave,fourcc,fps,cv::Size(frameWidth,frameHeight), 1);
for (int i = 0; i < numframes; i ++){
Writer.write(CV_FRAMES_RES_MAT[i]);
//OpenCVInterfaces::CVImageShower(CV_FRAMES_RES_MAT[i]);
}
return true;
}
#endif
|
/*
This file is part of the KDE Libraries
Copyright (C) 2006 Tobias Koenig (tokoe@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Port to Qt4
*/
#ifndef QPAGEMODEL_H
#define QPAGEMODEL_H
#include "libneurosuite_export.h"
#include <QtCore/QAbstractItemModel>
class QPageModelPrivate;
/**
* @short A base class for a model used by QPageView.
*
* This class is an abstract base class which must be used to
* implement custom models for QPageView. Additional to the standard
* Qt::ItemDataRoles it provides the two roles
*
* @li HeaderRole
* @li WidgetRole
*
* which are used to return a header string for a page and a QWidget
* pointer to the page itself.
*
* <b>Example:</b>\n
*
* \code
* QPageView *view = new QPageView( this );
* QPageModel *model = new MyPageModel( this );
*
* view->setModel( model );
* \endcode
*
* @see QPageView
* @author Tobias Koenig <tokoe@kde.org>
*/
class NEUROSUITE_EXPORT QPageModel : public QAbstractItemModel
{
Q_OBJECT
Q_DECLARE_PRIVATE(QPageModel)
public:
/**
* Additional roles that QPageView uses.
*/
enum Role {
/**
* A string to be rendered as page header.
*/
HeaderRole = Qt::UserRole + 1,
/**
* A pointer to the page widget. This is the widget that is shown when the item is
* selected.
*
* You can make QVariant take a QWidget using
* \code
* QWidget *myWidget = new QWidget;
* QVariant v = QVariant::fromValue(myWidget);
* \endcode
*/
WidgetRole
};
/**
* Constructs a page model with the given parent.
*/
explicit QPageModel( QObject *parent = 0 );
/**
* Destroys the page model.
*/
virtual ~QPageModel();
protected:
QPageModel(QPageModelPrivate &dd, QObject *parent);
QPageModelPrivate *const d_ptr;
};
#endif
|
// ======================================================================
// Author : $Author$
// Version: $Revision$
// Date : $Date$
// Url : $URL$
// ======================================================================
// ======================================================================
// _/| __
// // o\ / ) , / /
// || ._) ----\---------__----------__-/----/__-
// //__\ \ / ' / / / / )
// )___( _(____/____(___ __/____(___/____(___/_
// ======================================================================
// ======================================================================
// Copyright: (C) 2009-2012 Gregor Cramer
// ======================================================================
// ======================================================================
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// ======================================================================
#include "db_consumer.h"
#include "db_engine_list.h"
#ifndef _db_info_consumer_included
#define _db_info_consumer_included
namespace db {
class MoveInfoSet;
class InfoConsumer : public Consumer
{
public:
InfoConsumer( format::Type srcFormat,
mstl::string const& encoding,
TagBits const& allowedTags,
bool allowExtraTags);
void sendComment(Comment const& comment);
void preparseComment(mstl::string& comment) override;
};
} // namespace db
#endif // _db_info_consumer_included
// vi:set ts=3 sw=3:
|
/**
*
*/
#ifndef __ADT7310P16S16_H
#define __ADT7310P16S16_H
#include <stdint.h>
#include <stdbool.h>
void app_setup();
void app_start();
void app_stop();
void app_set_threshold(uint16_t threshold);
void app_set_periode(uint16_t periode);
uint16_t app_get_value();
/* The user has to provide this function, which is called by the ISR */
/* Return true to exit LPM3 */
bool user_isr();
#endif // __ADT7310P16S16_H
|
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "gl_state.h"
#include "gl_resource_manager.h"
#include "video_core/debug_utils/debug_utils.h"
#include "video_core/pica.h"
#include <memory>
#include <map>
class RasterizerCacheOpenGL : NonCopyable {
public:
~RasterizerCacheOpenGL();
/// Loads a texture from 3DS memory to OpenGL and caches it (if not already cached)
void LoadAndBindTexture(OpenGLState &state, unsigned texture_unit, const Pica::DebugUtils::TextureInfo& info);
void LoadAndBindTexture(OpenGLState &state, unsigned texture_unit, const Pica::Regs::FullTextureConfig& config) {
LoadAndBindTexture(state, texture_unit, Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format));
}
/// Flush any cached resource that touches the flushed region
void NotifyFlush(PAddr addr, u32 size, bool ignore_hash = false);
/// Flush all cached OpenGL resources tracked by this cache manager
void FullFlush();
private:
struct CachedTexture {
OGLTexture texture;
GLuint width;
GLuint height;
u32 size;
u64 hash;
PAddr addr;
};
std::map<PAddr, std::unique_ptr<CachedTexture>> texture_cache;
};
|
/***************************************************************************
* file klfpreviewbuilderthread.h
* This file is part of a file that was part of the KLatexFormula Project.
* Copyright (C) 2011 by Philippe Faist
* philippe.faist at bluewin.ch
* *
* 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. *
***************************************************************************/
/* $Id: klfpreviewbuilderthread.h 603 2011-02-26 23:14:55Z phfaist $ */
#ifndef KLFPREVIEWBUILDERTHREAD_H
#define KLFPREVIEWBUILDERTHREAD_H
#include "klfbackend.h"
#include "klfdefs.h"
#include <QThread>
#include <QWaitCondition>
/**
* A helper that runs in a different thread that generates previews in real-time as user types text,
* without blocking the GUI.
*/
class KLF_EXPORT KLFPreviewBuilderThread : public QThread
{
Q_OBJECT
public:
KLFPreviewBuilderThread(QObject *parent, KLFBackend::klfInput input, KLFBackend::klfSettings settings);
virtual ~KLFPreviewBuilderThread();
void run();
signals:
void previewAvailable(const QImage& preview, bool latexerror);
public slots:
bool inputChanged(const KLFBackend::klfInput& input);
void settingsChanged(const KLFBackend::klfSettings& settings);
protected:
KLFBackend::klfInput _input;
KLFBackend::klfSettings _settings;
QMutex _mutex;
QWaitCondition _condnewinfoavail;
bool _hasnewinfo;
bool _abort;
};
#endif // KLFPREVIEWBUILDERTHREAD_H
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/IMCore.framework/Frameworks/IMDAppleServices.framework/IMDAppleServices
*/
#import <IMDAppleServices/IMDAppleServices-Structs.h>
#import <IMDAppleServices/IMDAppleIDRegistrationCenter.h>
#import <IMDAppleServices/IMDAppleSMSRegistrationCenterListener.h>
#import <IMDAppleServices/NSCopying.h>
#import <IMDAppleServices/IMDAppleEmailInterface.h>
#import <IMDAppleServices/IMDAppleSMSRegistrationCenter.h>
#import <IMDAppleServices/IMDAppleIDSRegistrationCenterListener.h>
#import <IMDAppleServices/IMDAppleServiceSession.h>
#import <IMDAppleServices/IMDAppleEmailInterfaceListener.h>
#import <IMDAppleServices/IMDAppleRegistrationKeychainManager.h>
#import <IMDAppleServices/IMDAppleIDSRegistrationCenter.h>
#import <IMDAppleServices/IMSystemMonitorListener.h>
#import <IMDAppleServices/IMDAppleIDRegistrationCenterListener.h>
#import <IMDAppleServices/IMDAppleRegistrationController.h>
#import <IMDAppleServices/IMUserNotificationListener.h>
#import <IMDAppleServices/MSSearchDelegate.h>
#import <IMDAppleServices/IMDAppleHeartbeatCenter.h>
#import <IMDAppleServices/IMDAppleRegistrationKeyManager.h>
#import <IMDAppleServices/IMDAppleRegistration.h>
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SYNC_SYNCABLE_SYNCABLE_BASE_WRITE_TRANSACTION_H_
#define SYNC_SYNCABLE_SYNCABLE_BASE_WRITE_TRANSACTION_H_
#include "sync/base/sync_export.h"
#include "sync/syncable/syncable_base_transaction.h"
namespace syncer {
namespace syncable {
class SYNC_EXPORT BaseWriteTransaction : public BaseTransaction {
public:
virtual void TrackChangesTo(const EntryKernel* entry) = 0;
protected:
BaseWriteTransaction(
const tracked_objects::Location location,
const char* name,
WriterTag writer,
Directory* directory);
virtual ~BaseWriteTransaction();
private:
DISALLOW_COPY_AND_ASSIGN(BaseWriteTransaction);
};
}
}
#endif
|
#include<stdio.h>
void main(){
char c1[30] = {'I',' ','l','o','v','e'};
char c2[10] = {'k','n','\0','o','w'};
int i,j=0;
for(i=0;i<30;i++){
if(c1[i]=='\0'){
c1[i] = c2[j];
if(c2[j]=='\0') break;
j++;
}else continue;
}
printf("%s",c1);
} |
#ifndef __SUBSCRIPTION_T__H_
#define __SUBSCRIPTION_T__H_
typedef struct subscription_t
{
void (*free) (struct subscription_t *);
int (*subscribe) (struct subscription_t *, void *issuerData,
PF_SOH_CREATE_RESPONSE_CB createRespCb);
int (*reSubscribe) (struct subscription_t *, void *issuerData,
PF_SOH_UPDATE_RESPONSE_CB updateRespCb);
int (*unsubscribe) (struct subscription_t *, void *issuerData,
PF_SOH_DELETE_RESPONSE_CB deleteRespCb);
void (*notify) (struct subscription_t *, char *content);
void (*display) (struct subscription_t *, PF_HTTP_SUBS_PRINT_CB dispFunc,
void *handle);
unsigned long id;
char idStr[BUF_SIZE_M];
char *nsclProxy;
char *targetID;
char *reqEntity;
SUBS_TYPE type;
unsigned long minTimeBtwnNotif;
bool fullInitialReport;
time_t lastSubsDate;
time_t lastNotifyDate;
SUBS_PENDING_STATE state;
char *pendingTid;
PF_HTTP_SUBS_NOTIFY_CB notifyCb;
PF_HTTP_SUBS_ERROR_CB errorCb;
void *issuerData;
struct list_head chainLink;
} subscription_t;
subscription_t *new_subscription_t(char *nsclProxy, char *targetID, char *reqEntity,
SUBS_TYPE type, unsigned long minTimeBetweenNotif, bool fullInitialReport,
PF_HTTP_SUBS_NOTIFY_CB notifyCb, PF_HTTP_SUBS_ERROR_CB pfHttpSubsErrorCb,
void *issuerData);
void subscription_t_newFree(subscription_t *This);
int subscription_t_subscribe(subscription_t *This, void *issuerData,
PF_SOH_CREATE_RESPONSE_CB createRespCb);
int subscription_t_reSubscribe(subscription_t *This, void *issuerData,
PF_SOH_UPDATE_RESPONSE_CB updateRespCb);
int subscription_t_unsubscribe(subscription_t *This, void *issuerData,
PF_SOH_DELETE_RESPONSE_CB deleteRespCb);
void subscription_t_notify(subscription_t *This, char *content);
void subscription_t_display(subscription_t *This, PF_HTTP_SUBS_PRINT_CB dispFunc,
void *handle);
#endif
|
// Copyright 2013 Mobilinkd LLC <info@mobilinkd.com>
// All rights reserved.
#ifndef MOBILINKD_VERSION_H_
#define MOBILINKD_VERSION_H_
#include <cpu/pgm.h>
#include "buildrev.h"
#define VERS_MAJOR 2
#define VERS_MINOR 0
#define VERS_PATCH 1
#define VERS_SEP .
#define VERSION_CAT_NX(MAJOR, MINOR, PATCH, BUILD) MAJOR ## . ## MINOR \
## . ## PATCH ## . ## BUILD
#define VERSION_CAT(MAJOR, MINOR, PATCH, BUILD) VERSION_CAT_NX(MAJOR, MINOR, PATCH, BUILD)
#define STRINGIFY(X) #X
#define TO_STRING(x) STRINGIFY(x)
#define MOBILINKD_VERSION_STR TO_STRING(VERSION_CAT(VERS_MAJOR, VERS_MINOR, VERS_PATCH, VERS_BUILD))
extern const char firmware_version[] PROGMEM;
extern const char hardware_version[] PROGMEM;
#endif // MOBILINKD_VERSION_H_
|
/*
File: autoset.h
Copyright (C) 2009 Christophe GRENIER <grenier@cgsecurity.org>
This software 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 the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _AUTOSET_H
#define _AUTOSET_H
#ifdef __cplusplus
extern "C" {
#endif
/*@
@ requires \valid(disk_car);
@ assigns disk_car->unit;
@*/
void autoset_unit(disk_t *disk_car);
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
#endif
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the qt3to4 porting application 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 FILEPORTER_H
#define FILEPORTER_H
#include "portingrules.h"
#include "replacetoken.h"
#include "filewriter.h"
#include "preprocessorcontrol.h"
#include <QString>
#include <QSet>
#include <QMap>
QT_BEGIN_NAMESPACE
class FilePorter
{
public:
FilePorter(PreprocessorCache &preprocessorCache);
void port(QString fileName);
QSet<QByteArray> usedQtModules();
private:
QByteArray loadFile(const QString &fileName);
QByteArray includeAnalyse(QByteArray fileContents);
TextReplacements includeDirectiveReplacements();
PreprocessorCache &preprocessorCache;
const QList<TokenReplacement*> tokenReplacementRules;
const QHash<QByteArray, QByteArray> headerReplacements;
ReplaceToken replaceToken;
Tokenizer tokenizer; //used by includeAnalyse
QSet<QByteArray> qt4HeaderNames;
QSet<QByteArray> m_usedQtModules;
};
class PreprocessReplace : public Rpp::RppTreeWalker
{
public:
PreprocessReplace(const Rpp::Source *source, const QHash<QByteArray, QByteArray> &headerReplacements);
TextReplacements getReplacements();
private:
void evaluateIncludeDirective(const Rpp::IncludeDirective *directive);
void evaluateText(const Rpp::Text *textLine);
const QHash<QByteArray, QByteArray> headerReplacements;
TextReplacements replacements;
};
class IncludeDirectiveAnalyzer : public Rpp::RppTreeWalker
{
public:
IncludeDirectiveAnalyzer(const TokenEngine::TokenContainer &fileContents);
int insertPos();
QSet<QByteArray> includedHeaders();
QSet<QByteArray> usedClasses();
private:
void evaluateIncludeDirective(const Rpp::IncludeDirective *directive);
void evaluateIfSection(const Rpp::IfSection *ifSection);
void evaluateText(const Rpp::Text *textLine);
int insertTokenIndex;
bool foundInsertPos;
bool foundQtHeader;
int ifSectionCount;
const TokenEngine::TokenContainer &fileContents;
Rpp::Source *source;
TypedPool<Rpp::Item> mempool;
QSet<QByteArray> m_includedHeaders;
QSet<QByteArray> m_usedClasses;
};
QT_END_NAMESPACE
#endif
|
#ifndef __OSA_H__
#define __OSA_H__
/*
* Created by Liu Papillon, on Sep 6, 2017.
*/
#ifndef OSA_MODULE_NAME
#error "The `OSA_MODULE_NAME` macro must be defined."
#endif
#include "osa_platforms.h"
#include "osa_primary_types.h"
#include "osa_types.h"
#include "osa_status.h"
#include "osa_definitions.h"
#include "osa_macro.h"
#include "osa_log.h"
#include "osa_string.h"
#include "osa_list.h"
#include "osa_datetime.h"
#include "osa_fs.h"
#include "osa_misc.h"
int OSA_init(void);
int OSA_deinit(void);
#endif /* __OSA_H__ */
|
/*
* Intel(R) Enclosure LED Utilities
* Copyright (C) 2009-2013 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef _SYSFS_H_INCLUDED_
#define _SYSFS_H_INCLUDED_
/**
* @brief Initializes sysfs module.
*
* This function initializes sysfs module. The function allocates memory for
* internal lists and initializes the lists. Application must call this function
* before any sysfs module function.
*
* @return STATUS_SUCCESS if successful, otherwise a valid status_t status code.
*/
status_t sysfs_init(void);
/**
* @brief Finalizes sysfs module.
*
* This function releases memory allocated for sysfs module and its components.
* Application must call this function at the very end of execution.
*
* @return The function does not return a value.
*/
void sysfs_fini(void);
/**
* @brief Resets the content of internal lists.
*
* This function releases memory allocated for elements of internal lists. The
* function does not release memory allocated for the lists itself. Use
* sysfs_fini() function instead to release memory allocated for internal lists.
*
* @return STATUS_SUCCESS if successful, otherwise a valid status_t status code.
*/
status_t sysfs_reset(void);
/**
* @brief Scans sysfs tree and populates internal lists.
*
* This function scans sysfs tree for storage controllers, block devices, RAID
* devices, container devices, slave devices and enclosure devices registered
* in the system. Only supported block and controller devices are put on a list.
*
* @return STATUS_SUCCESS if successful, otherwise a valid status_t status code.
*/
status_t sysfs_scan(void);
/**
* The function returns list of enclosure devices attached to SAS/SCSI storage
* controller(s).
*/
void *sysfs_get_enclosure_devices(void);
/**
* The function returns list of controller devices present in the system.
*/
void *sysfs_get_cntrl_devices(void);
/**
* The function checks if the given storage controller is attached to enclosure
* device(s).
*/
int sysfs_enclosure_attached_to_cntrl(const char *path);
/**
*/
status_t sysfs_block_device_scan(void **block_list);
/**
*/
#define sysfs_block_device_for_each(__action) \
__sysfs_block_device_for_each((action_t)(__action), (void *)0)
/**
*/
status_t __sysfs_block_device_for_each(action_t action, void *parm);
/**
*/
#define sysfs_block_device_first_that(__test, __parm) \
__sysfs_block_device_first_that((test_t)(__test), (void *)(__parm))
/**
*/
void *__sysfs_block_device_first_that(test_t action, void *parm);
/*
* This function checks if driver type is isci.
*/
int sysfs_isci_driver(const char *path);
#endif /* _SYSFS_H_INCLUDED_ */
|
/*
$Id$
DVBSNOOP
a dvb sniffer and mpeg2 stream analyzer tool
http://dvbsnoop.sourceforge.net/
(c) 2001-2006 Rainer.Scherg@gmx.de (rasc)
-- PS misc.
-- PES misc.
*/
#include "dvbsnoop.h"
#include "pes_misc.h"
#include "strings/dvb_str.h"
#include "misc/hexprint.h"
#include "misc/helper.h"
#include "misc/output.h"
/*
* PTS // DTS
* Len is 36 bits fixed
*/
void print_xTS_field (int v, const char *str, u_char *b, int bit_offset)
{
long long xTS_32_30;
long long xTS_29_15;
long long xTS_14_0;
long long ull;
int bo = bit_offset;
int v1 = v+1;
out_nl (v,"%s:",str);
indent (+1);
xTS_32_30 = outBit_Sx_NL (v1,"bit[32..30]: ", b, bo+0, 3);
outBit_Sx_NL (v1,"marker_bit: ", b, bo+3, 1);
xTS_29_15 = outBit_Sx_NL (v1,"bit[29..15]: ", b, bo+4, 15);
outBit_Sx_NL (v1,"marker_bit: ", b, bo+19, 1);
xTS_14_0 = outBit_Sx_NL (v1,"bit[14..0]: ", b, bo+20,15);
outBit_Sx_NL (v1,"marker_bit: ", b, bo+35, 1);
ull = (xTS_32_30<<30) + (xTS_29_15<<15) + xTS_14_0;
out (v," ==> %s: ", str);
print_timebase90kHz (v, ull);
out_NL (v);
indent (-1);
}
|
#include <linux/mm.h>
#include <linux/suspend.h>
#include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/swap.h>
#include <linux/pm.h>
#include <linux/swapops.h>
#include <linux/bootmem.h>
#include <linux/syscalls.h>
#include <linux/highmem.h>
#include <linux/time.h>
#include <linux/rbtree.h>
#include <linux/io.h>
#include "power.h"
int in_suspend __nosavedata = 0;
struct swsusp_extent {
struct rb_node node;
unsigned long start;
unsigned long end;
};
static struct rb_root swsusp_extents = RB_ROOT;
static int swsusp_extents_insert(unsigned long swap_offset)
{
struct rb_node **new = &(swsusp_extents.rb_node);
struct rb_node *parent = NULL;
struct swsusp_extent *ext;
while (*new) {
ext = container_of(*new, struct swsusp_extent, node);
parent = *new;
if (swap_offset < ext->start) {
if (swap_offset == ext->start - 1) {
ext->start--;
return 0;
}
new = &((*new)->rb_left);
} else if (swap_offset > ext->end) {
if (swap_offset == ext->end + 1) {
ext->end++;
return 0;
}
new = &((*new)->rb_right);
} else {
return -EINVAL;
}
}
ext = kzalloc(sizeof(struct swsusp_extent), GFP_KERNEL);
if (!ext)
return -ENOMEM;
ext->start = swap_offset;
ext->end = swap_offset;
rb_link_node(&ext->node, parent, new);
rb_insert_color(&ext->node, &swsusp_extents);
return 0;
}
sector_t alloc_swapdev_block(int swap)
{
unsigned long offset;
offset = swp_offset(get_swap_page_of_type(swap));
if (offset) {
if (swsusp_extents_insert(offset))
swap_free(swp_entry(swap, offset));
else
return swapdev_block(swap, offset);
}
return 0;
}
void free_all_swap_pages(int swap)
{
struct rb_node *node;
while ((node = swsusp_extents.rb_node)) {
struct swsusp_extent *ext;
unsigned long offset;
ext = container_of(node, struct swsusp_extent, node);
rb_erase(node, &swsusp_extents);
for (offset = ext->start; offset <= ext->end; offset++)
swap_free(swp_entry(swap, offset));
kfree(ext);
}
}
int swsusp_swap_in_use(void)
{
return (swsusp_extents.rb_node != NULL);
}
void swsusp_show_speed(struct timeval *start, struct timeval *stop,
unsigned nr_pages, char *msg)
{
s64 elapsed_centisecs64;
int centisecs;
int k;
int kps;
elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start);
do_div(elapsed_centisecs64, NSEC_PER_SEC / 100);
centisecs = elapsed_centisecs64;
if (centisecs == 0)
centisecs = 1;
k = nr_pages * (PAGE_SIZE / 1024);
kps = (k * 100) / centisecs;
printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n",
msg, k,
centisecs / 100, centisecs % 100,
kps / 1000, (kps % 1000) / 10);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.