text
stringlengths 4
6.14k
|
|---|
/* This file is part of the KDE project
* Copyright (C) 2010 Carlos Licea <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MSOOXMLDRAWINGTABLESTYLEREADER_H
#define MSOOXMLDRAWINGTABLESTYLEREADER_H
#include <MsooXmlCommonReader.h>
#include <MsooXmlThemesReader.h>
class KOdfGenericStyles;
#include <QtGui/QPen>
#include <QtCore/QString>
/**
* The following classes deal with the table styles part, specifically
* we deal with the elements that start at the a:tblStyleLst §20.1.4.2.27,
* you can find its part definition at Table Styles Part §14.2.9
*/
namespace MSOOXML
{
class MSOOXML_EXPORT Border {
public:
Border();
~Border();
enum Side {
NoSide,
Bottom,
Left,
Right,
// TopLeftToBottomRight,
Top,
// TopRightToBottomLeft
};
Side side() const;
void setSide(Side side);
QColor color() const;
void setColor(const QColor& color);
QString odfBorderName() const;
enum Style {
None,
Solid,
Dashed,
Dotted,
DashDot,
DashDotDot
};
void setStyle(Style style);
Style style() const;
QString odfStyleName() const;
void setWidth(qreal width);
qreal width() const;
QString odfStyleProperties() const;
private:
QColor m_color;
Side m_side;
qreal m_width;
Style m_style;
};
class MSOOXML_EXPORT TableStyleProperties
{
public:
TableStyleProperties();
~TableStyleProperties();
enum Type {
NoType,
FirstRow,
FirstCol,
LastCol,
LastRow,
NeCell,
NwCell,
SeCell,
SwCell,
Band1Horizontal,
Band2Horizontal,
Band1Vertical,
Band2Vertical,
WholeTbl
};
Type type() const;
void setType(Type type);
Border borderForSide(Border::Side side) const;
void addBorder(Border border);
/**
* @brief Save the style, note that the type of the style depends on the type
* of this styleProperties
* @return the name of the saved style
*/
QString saveStyle(KOdfGenericStyles& styles);
static Type typeFromString(const QString& string);
static QString stringFromType(Type type);
private:
//TODO see if we can take care of InsideH InsideV and how
QMap<Border::Side, Border> m_borders;
Type m_type;
};
class MSOOXML_EXPORT TableStyle
{
public:
TableStyle();
~TableStyle();
QString id() const;
void setId(const QString& id);
TableStyleProperties propertiesForType(TableStyleProperties::Type type) const;
void addProperties(TableStyleProperties properties);
private:
QString m_id;
//TODO handle the table background stored in the element TblBg
QMap<TableStyleProperties::Type, TableStyleProperties> m_properties;
};
class MSOOXML_EXPORT TableStyleList
{
public:
TableStyleList();
~TableStyleList();
TableStyle tableStyle(const QString& id) const;
void insertStyle(QString id, MSOOXML::TableStyle style);
private:
QMap<QString, TableStyle> m_styles;
};
class MsooXmlImport;
class MSOOXML_EXPORT MsooXmlDrawingTableStyleContext : public MSOOXML::MsooXmlReaderContext
{
public:
MsooXmlDrawingTableStyleContext(MSOOXML::MsooXmlImport* _import, const QString& _path, const QString& _file, MSOOXML::DrawingMLTheme* _themes, MSOOXML::TableStyleList* _styleList);
virtual ~MsooXmlDrawingTableStyleContext();
TableStyleList* styleList;
//Those members are used by some methods included
MsooXmlImport* import;
QString path;
QString file;
MSOOXML::DrawingMLTheme* themes;
};
class MSOOXML_EXPORT MsooXmlDrawingTableStyleReader : public MsooXmlCommonReader
{
public:
MsooXmlDrawingTableStyleReader(KoOdfWriters* writers);
virtual ~MsooXmlDrawingTableStyleReader();
virtual KoFilter::ConversionStatus read(MsooXmlReaderContext* context = 0);
protected:
KoFilter::ConversionStatus read_tblStyleLst();
KoFilter::ConversionStatus read_tblStyle();
KoFilter::ConversionStatus read_wholeTbl();
KoFilter::ConversionStatus read_tcStyle();
KoFilter::ConversionStatus read_tcTxStyle();
KoFilter::ConversionStatus read_bottom();
KoFilter::ConversionStatus read_left();
KoFilter::ConversionStatus read_right();
KoFilter::ConversionStatus read_top();
// KoFilter::ConversionStatus read_insideV();
// KoFilter::ConversionStatus read_insideH();
// KoFilter::ConversionStatus read_tl2br();
// KoFilter::ConversionStatus read_tr2bl();
KoFilter::ConversionStatus read_tcBdr();
//get read_ln and friends, it's a shame I have to get a lot of crap alongside
#include <MsooXmlCommonReaderMethods.h>
#include <MsooXmlCommonReaderDrawingMLMethods.h>
private:
MsooXmlDrawingTableStyleContext* m_context;
TableStyleProperties m_currentStyleProperties;
TableStyle m_currentStyle;
};
}
#endif // MSOOXMLDRAWINGTABLESTYLEREADER_H
|
/* This file is part of the KDE project
* Copyright (C) 2009 Elvis Stansvik <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KTABLEFORMAT_H
#define KTABLEFORMAT_H
#include "kodftext_export.h"
#include <QSharedDataPointer>
#include <QMap>
class KTableFormatPrivate;
class QVariant;
class QString;
class QBrush;
/**
* The KTableFormat class describes a format for a table component such
* as a row or a column. It is the base class for KoTableColumnFormat and
* KoTableRowFormat.
*
* It is not a style, but a format. Very much like the implicitly shared
* QTextFormat in Qt.
*
* \sa KoTableColumnFormat, KoTableRowFormat
*/
class KODFTEXT_EXPORT KTableFormat
{
public:
/// Creates a new format of type \c InvalidFormat.
KTableFormat();
/// Creates a format with the same attributes as \a rhs.
KTableFormat(const KTableFormat &rhs);
/// Assigns \a rhs to this format and returns a reference to this format.
KTableFormat& operator=(const KTableFormat &rhs);
/// Destroys this format.
~KTableFormat();
/// Get property \a propertyId as a QVariant.
QVariant property(int propertyId) const;
/// Set property \a propertyId to \a value.
void setProperty(int propertyId, const QVariant &value);
/// Clear property \a propertyId.
void clearProperty(int propertyId);
/// Returns true if this format has property \a propertyId, otherwise false.
bool hasProperty(int propertyId) const;
/// Returns a map with all properties of this format.
QMap<int, QVariant> properties() const;
/// Get bool property \a propertyId.
bool boolProperty(int propertyId) const;
/// Get int property \a propertyId.
int intProperty(int propertyId) const;
/// Get double property \a propertyId.
qreal doubleProperty(int propertyId) const;
/// Get string property \a propertyId.
QString stringProperty(int propertyId) const;
/// Get brush property \a propertyId.
QBrush brushProperty(int propertyId) const;
private:
QSharedDataPointer<KTableFormatPrivate> d; // Shared data pointer.
};
#endif // KOTABLEFORMAT_H
|
// This file was generated based on /usr/local/share/uno/Packages/Fuse.Storage/1.3.1/ApplicationDir.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Object.h>
namespace g{namespace Fuse{namespace Storage{struct ApplicationDir__WriteClosure;}}}
namespace g{
namespace Fuse{
namespace Storage{
// private sealed class ApplicationDir.WriteClosure :91
// {
uType* ApplicationDir__WriteClosure_typeof();
void ApplicationDir__WriteClosure__ctor__fn(ApplicationDir__WriteClosure* __this, uString* filename, uString* value);
void ApplicationDir__WriteClosure__Invoke_fn(ApplicationDir__WriteClosure* __this, bool* __retval);
void ApplicationDir__WriteClosure__New1_fn(uString* filename, uString* value, ApplicationDir__WriteClosure** __retval);
struct ApplicationDir__WriteClosure : uObject
{
uStrong<uString*> _filename;
uStrong<uString*> _value;
void ctor_(uString* filename, uString* value);
bool Invoke();
static ApplicationDir__WriteClosure* New1(uString* filename, uString* value);
};
// }
}}} // ::g::Fuse::Storage
|
#ifndef JME_RpcHandler_h__
#define JME_RpcHandler_h__
#include <string>
#include <map>
#include "boost/shared_ptr.hpp"
#include "boost/function.hpp"
#include "google/protobuf/message.h"
#include "log/JME_GLog.h"
using namespace std;
namespace JMEngine
{
namespace rpc
{
class RpcHandlerInterface
{
public:
typedef boost::shared_ptr<RpcHandlerInterface> RpcHandlerInterfacePtr;
//rpc´¦Àíº¯Êýº¯Êý ¸ºÔð·ÖÅä ·µ»ØMessage, rpc·þÎñ²à¸ºÔðÊÍ·ÅMessage
typedef boost::function<google::protobuf::Message*(const string& params)> RpcHandler;
public:
static RpcHandlerInterface::RpcHandlerInterfacePtr create();
static void regRpcHandler(const char* method, RpcHandler handler);
static google::protobuf::Message* execRpcHandler(const string& method, const string& params);
private:
static map<string, RpcHandlerInterface::RpcHandler>& getRpcHandler();
};
}
}
#endif // JME_RpcHandler_h__
|
////////////////////////////////////////////////////////////////////////////////
// Filename: TrackingCameraScript.h
////////////////////////////////////////////////////////////////////////////////
#pragma once
//////////////
// INCLUDES //
//////////////
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "Script.h"
#include "Camera.h"
#include "Transform.h"
////////////////
// NAMESPACES //
////////////////
using namespace dg;
class TrackingCameraScript : public Script {
public:
TrackingCameraScript(SceneObject* target, float distanceToTarget = 20.0f)
: Script("TrackingCameraScript") {
m_Target = target;
m_Camera = Camera::ActiveCamera();
m_DistanceToTarget = distanceToTarget;
}
virtual void OnActivate() {
m_TargetTransform = GetComponentType(m_Target, Transform);
}
virtual void Update() {
vec3 newPosition = m_TargetTransform->GetPosition();
newPosition.z -= m_DistanceToTarget;
newPosition.y += 5.0f;
m_Camera->SetPosition(newPosition);
}
private:
SceneObject* m_Target;
Transform* m_TargetTransform;
Camera* m_Camera;
float m_DistanceToTarget;
};
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2015 Leslie Zhai <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <glib.h>
#include <glib/gstdio.h>
int main(int argc, char *argv[])
{
char *path = argv[1];
struct stat buf;
if (lstat(path, &buf) == -1) {
printf("ERROR: failed to get %s lstat\n", path);
return 0;
}
switch (buf.st_mode & S_IFMT) {
case S_IFDIR:
printf("DEBUG: line %d %s is directory\n", __LINE__, path);
break;
case S_IFLNK:
printf("DEBUG: line %d %s is symbolic link\n", __LINE__, path);
break;
case S_IFREG:
printf("DEBUG: line %d %s is regular file\n", __LINE__, path);
break;
default:
break;
}
if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK))
printf("DEBUG: line %d %s is symbolic link\n", __LINE__, path);
return 0;
}
|
//# ShapeletCoherence.h: Spatial coherence function of a source modelled as a
//# shapelet basis expansion.
//#
//# Copyright (C) 2008
//# ASTRON (Netherlands Institute for Radio Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
//#
//# This file is part of the LOFAR software suite.
//# The LOFAR software suite is free software: you can redistribute it and/or
//# modify it under the terms of the GNU General Public License as published
//# by the Free Software Foundation, either version 3 of the License, or
//# (at your option) any later version.
//#
//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
//#
//# $Id: ShapeletCoherence.h 14789 2010-01-13 12:39:15Z zwieten $
#ifndef LOFAR_BBSKERNEL_EXPR_SHAPELETCOHERENCE_H
#define LOFAR_BBSKERNEL_EXPR_SHAPELETCOHERENCE_H
// \file
// Spatial coherence function of a source modelled as a shapelet basis
// expansion.
#include <BBSKernel/Expr/BasicExpr.h>
#include <Common/lofar_complex.h>
#include <casacore/casa/Arrays.h>
namespace LOFAR
{
namespace BBS
{
// \addtogroup Expr
// @{
class ShapeletCoherence: public BasicTernaryExpr<Vector<4>, Vector<3>,
Vector<3>, JonesMatrix>
{
public:
typedef shared_ptr<ShapeletCoherence> Ptr;
typedef shared_ptr<const ShapeletCoherence> ConstPtr;
ShapeletCoherence(const Expr<Vector<4> >::ConstPtr stokes, double scaleI,
const casacore::Array<double> &coeffI,
const Expr<Vector<3> >::ConstPtr &uvwA,
const Expr<Vector<3> >::ConstPtr &uvwB);
protected:
virtual const JonesMatrix::View evaluateImpl(const Grid &grid,
const Vector<4>::View &stokes, const Vector<3>::View &uvwA,
const Vector<3>::View &uvwB) const;
virtual const JonesMatrix::View evaluateImplI(const Grid &grid,
const Vector<4>::View &stokes, double scaleI,
const casacore::Array<double> &coeffI, const Vector<3>::View &uvwA,
const Vector<3>::View &uvwB) const;
double itsShapeletScaleI_;
casacore::Array<double> itsShapeletCoeffI_;
};
// @}
} // namespace BBS
} // namespace LOFAR
#endif
|
//
// CreditsViewController.h
// P5P
//
// Created by CNPP on 25.2.2011.
// Copyright Beat Raess 2011. All rights reserved.
//
// This file is part of P5P.
//
// P5P is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// P5P 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 P5P. If not, see www.gnu.org/licenses/.
#import <UIKit/UIKit.h>
#import "CellLink.h"
// Sections
enum {
SectionCreditsReferences,
SectionCreditsFrameworks,
SectionCreditsComponents,
SectionCreditsAssets
} P5PCreditsSections;
/**
* Credit.
*/
@interface Credit : NSObject {
}
// Properties
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *meta;
@property (nonatomic, retain) NSString *url;
// Initializer
- (id)initWithName:(NSString*)n meta:(NSString*)m url:(NSString*)u;
@end
/**
* CreditsViewController.
*/
@interface CreditsViewController : UITableViewController <CellLinkDelegate> {
// data
NSMutableArray *references;
NSMutableArray *frameworks;
NSMutableArray *components;
NSMutableArray *assets;
}
@end
|
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <QObject>
#include <qsettings.h>
class Configuration
{
public:
Configuration();
QString Hostname;
QString Username;
QString AutoLogin;
QString SaveDir;
int ConcurrentDownloads;
bool UseSSL;
QSettings *settings;
void Load();
void Save();
};
#endif // CONFIGURATION_H
|
#include <includes.h>
#include <utils.h>
#include <methnum.h>
#include "s_param.h"
#include "integral.h"
double Ivac ( Param * P , double m )
{
double m2 = m*m ;
double LE = sqrt ( m2 + P->L2 );
return 0.5 * ONE_OVER_8PI_2 * ( P->L * LE * ( m2 + 2*P->L ) + m2*m2 * log ( m/(P->L + LE) ) ) ;
}
double dm_Ivac ( Param * P , double m )
{
double m2 = m*m ;
double LE = sqrt ( m2 + P->L2 );
return m * ONE_OVER_4PI_2 * ( P->L * LE + m2 * log ( m/(P->L + LE) ) );
}
double dm2_Ivac ( Param * P , double m )
{
double m2 = m*m ;
double LE = sqrt ( m2 + P->L2 );
return ONE_OVER_4PI_2 * ( P->L*(3*m2 + P->L2)/LE + 3*m2 * log ( m / (P->L + LE) ) ) ;
}
double dm3_Ivac ( Param * P , double m )
{
double m2 = m*m ;
double LE2 = m2 + P->L2 ;
double LE = sqrt( LE2 );
return 3 * m * ONE_OVER_2PI_2 * ( P->L*( 3*m2 + 4*P->L2 )/(3*LE2*LE) + log ( m / (P->L + LE) ) );
}
double Imed ( Param * P , double m , double T , double mu )
{
double m2 = m*m ;
double b = 1./T ;
double integ ( double p )
{
double p2 = p*p ;
double E2 = p2 + m2 ;
double E = sqrt ( E2 );
double x = -(E - mu) * b ;
double y = -(E + mu) * b ;
double a = log ( 1 + exp ( x ) ) ;
double b = log ( 1 + exp ( y ) ) ;
return p2 * ( a + b );
}
double I = ONE_OVER_2PI_2 * integ_dp ( integ , 0. , P->L , cutoff );
return I ;
}
double dm_Imed ( Param * P , double m , double T , double mu )
{
double m2 = m*m ;
double b = 1./T ;
double integ ( double p )
{
double p2 = p*p ;
double E2 = p2 + m2 ;
double E = sqrt ( E2 );
double x = (E - mu) * b ;
double y = (E + mu) * b ;
double ex = exp ( x ) ;
double ey = exp ( y );
double f = 1. / ( 1 + ex );
double fb = 1. / ( 1 + ey );
return p2 * ( - f - fb ) / E ;
}
double I = integ_dp ( integ , 0. , P->L , cutoff );
return m * I ;
}
double dT_Imed ( Param * P , double m , double T , double mu )
{
}
double dmu_Imed ( Param * P , double m , double T , double mu );
/* double dm2_Imed ( Param * P , double m , double T , double mu ); */
/* double dmT_Imed ( Param * P , double m , double T , double mu ); */
/* double dmmu_Imed ( Param * P , double m , double T , double mu ); */
/* double dT2_Imed ( Param * P , double m , double T , double mu ); */
/* double dTmu_Imed ( Param * P , double m , double T , double mu ); */
/* double dmu2_Imed ( Param * P , double m , double T , double mu ); */
|
#ifndef RESIDUAL_H
#define RESIDUAL_H
#include "base.h"
#include "peak_detection.h"
#include "partial_tracking.h"
#include "synthesis.h"
extern "C" {
#include "sms.h"
}
using namespace std;
namespace simpl
{
// ---------------------------------------------------------------------------
// Residual
//
// Calculate a residual signal
// ---------------------------------------------------------------------------
class Residual {
protected:
int _frame_size;
int _hop_size;
int _sampling_rate;
Frames _frames;
void clear();
public:
Residual();
~Residual();
virtual void reset();
int frame_size();
virtual void frame_size(int new_frame_size);
int hop_size();
virtual void hop_size(int new_hop_size);
int sampling_rate();
void sampling_rate(int new_sampling_rate);
virtual void residual_frame(Frame* frame);
virtual void find_residual(int synth_size, sample* synth,
int original_size, sample* original,
int residual_size, sample* residual);
virtual void synth_frame(Frame* frame);
virtual Frames synth(Frames& frames);
virtual Frames synth(int original_size, sample* original);
};
// ---------------------------------------------------------------------------
// SMSResidual
// ---------------------------------------------------------------------------
class SMSResidual : public Residual {
private:
SMSResidualParams _residual_params;
SMSPeakDetection _pd;
SMSPartialTracking _pt;
SMSSynthesis _synth;
public:
SMSResidual();
~SMSResidual();
void reset();
void frame_size(int new_frame_size);
void hop_size(int new_hop_size);
int num_stochastic_coeffs();
void num_stochastic_coeffs(int new_num_stochastic_coeffs);
void residual_frame(Frame* frame);
void synth_frame(Frame* frame);
};
} // end of namespace Simpl
#endif
|
//
// ECCardView.h
// Beacon
//
// Created by 段昊宇 on 2017/5/29.
// Copyright © 2017年 Echo. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CCDraggableCardView.h"
#import "ECReturningVideo.h"
@interface ECCardView : CCDraggableCardView
- (void)initialData:(ECReturningVideo *)video;
- (void)addLiked;
- (void)delLiked;
@end
|
/*
* RenderRasterize_Shader.h
* Created by Clemens Unterkofler on 1/20/09.
* for Aleph One
*
* http://www.gnu.org/licenses/gpl.html
*/
#ifndef _RENDERRASTERIZE_SHADER__H
#define _RENDERRASTERIZE_SHADER__H
#include "cseries.h"
#include "map.h"
#include "RenderRasterize.h"
#include "OGL_FBO.h"
#include "OGL_Textures.h"
#include "Rasterizer_Shader.h"
#include <memory>
class Blur;
class RenderRasterize_Shader : public RenderRasterizerClass {
std::unique_ptr<Blur> blur;
Rasterizer_Shader_Class *RasPtr;
int objectCount;
world_distance objectY;
float weaponFlare;
float selfLuminosity;
long_vector2d leftmost_clip, rightmost_clip;
protected:
virtual void render_node(sorted_node_data *node, bool SeeThruLiquids, RenderStep renderStep);
virtual void store_endpoint(endpoint_data *endpoint, long_vector2d& p);
virtual void render_node_floor_or_ceiling(
clipping_window_data *window, polygon_data *polygon, horizontal_surface_data *surface,
bool void_present, bool ceil, RenderStep renderStep);
virtual void render_node_side(
clipping_window_data *window, vertical_surface_data *surface,
bool void_present, RenderStep renderStep);
virtual void render_node_object(render_object_data *object, bool other_side_of_media, RenderStep renderStep);
virtual void clip_to_window(clipping_window_data *win);
virtual void _render_node_object_helper(render_object_data *object, RenderStep renderStep);
public:
RenderRasterize_Shader();
~RenderRasterize_Shader();
virtual void setupGL(Rasterizer_Shader_Class& Rasterizer);
virtual void render_tree(void);
TextureManager setupWallTexture(const shape_descriptor& Texture, short transferMode, float pulsate, float wobble, float intensity, float offset, RenderStep renderStep);
TextureManager setupSpriteTexture(const rectangle_definition& rect, short type, float offset, RenderStep renderStep);
};
#endif
|
#pragma once
#ifndef HPTT_PARAM_PARAMETER_TRANS_H_
#define HPTT_PARAM_PARAMETER_TRANS_H_
#include <array>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <hptt/types.h>
#include <hptt/tensor.h>
#include <hptt/arch/compat.h>
#include <hptt/util/util_trans.h>
#include <hptt/kernels/kernel_trans.h>
namespace hptt {
template <typename FloatType,
TensorUInt ORDER>
class TensorMergedWrapper : public TensorWrapper<FloatType, ORDER> {
public:
TensorMergedWrapper() = delete;
TensorMergedWrapper(const TensorWrapper<FloatType, ORDER> &tensor,
const std::unordered_set<TensorUInt> &merge_set);
HPTT_INL FloatType &operator[](const TensorIdx * RESTRICT indices);
HPTT_INL const FloatType &operator[](
const TensorIdx * RESTRICT indices) const;
HPTT_INL FloatType &operator[](TensorIdx **indices);
HPTT_INL const FloatType &operator[](const TensorIdx **indices) const;
private:
TensorUInt begin_order_idx_, merged_order_;
TensorUInt merge_idx_(const std::unordered_set<TensorUInt> &merge_set);
};
template <typename TensorType,
bool UPDATE_OUT>
struct ParamTrans {
// Type alias and constant values
using Float = typename TensorType::Float;
using Deduced = DeducedFloatType<Float>;
using KernelPack = KernelPackTrans<Float, UPDATE_OUT>;
static constexpr auto ORDER = TensorType::TENSOR_ORDER;
ParamTrans(const TensorType &input_tensor, TensorType &output_tensor,
const std::array<TensorUInt, ORDER> &perm, const Deduced alpha,
const Deduced beta);
HPTT_INL bool is_common_leading() const;
HPTT_INL void set_coef(const Deduced alpha, const Deduced beta);
HPTT_INL const KernelPack &get_kernel() const;
void set_lin_wrapper_loop(const TensorUInt size_kn_inld,
const TensorUInt size_kn_outld);
void set_sca_wrapper_loop(const TensorUInt size_kn_in_inld,
const TensorUInt size_kn_in_outld, const TensorUInt size_kn_out_inld,
const TensorUInt size_kn_out_outld);
void reset_data(const Float *data_in, Float *data_out);
private:
TensorUInt merge_idx_(const TensorType &input_tensor,
const TensorType &output_tensor,
const std::array<TensorUInt, ORDER> &perm);
// They need to be initialized before merging
std::unordered_set<TensorUInt> input_merge_set_, output_merge_set_;
KernelPackTrans<Float, UPDATE_OUT> kn_;
public:
std::array<TensorUInt, ORDER> perm;
Deduced alpha, beta;
TensorIdx stride_in_inld, stride_in_outld, stride_out_inld, stride_out_outld;
TensorUInt begin_order_idx;
const TensorUInt merged_order;
// Put the merged tensors here, they must be initialized after merging
TensorMergedWrapper<Float, ORDER> input_tensor, output_tensor;
};
/*
* Import implementation
*/
#include "parameter_trans.tcc"
}
#endif // HPTT_PARAM_PARAMETER_TRANS_H_
|
#pragma once
#include <vector>
#include <boost/thread.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/bind.hpp>
#include <boost/version.hpp>
#include <boost/function.hpp>
#include <boost/interprocess/detail/atomic.hpp>
#if (BOOST_VERSION < 104800)
using boost::interprocess::detail::atomic_inc32;
#else
using boost::interprocess::ipcdetail::atomic_inc32;
#endif
/*
* TODO:
*
* - Better documentation of API
* - deleting of ended thread:local memory
* - by mean of Done function
* - by DelThread
* - Pause/Resume function
* - use a barrier instead of a crappy sleep
* - should this code move at the end of each blocks ?
*/
namespace scheduling
{
class Scheduler;
class Thread;
class Range;
class Thread
{
public:
virtual void Init() {}
virtual void End() {}
virtual ~Thread() {};
friend class Scheduler;
friend class Range;
private:
static void Body(Thread* thread, Scheduler *scheduler);
boost::thread thread;
bool active;
};
typedef boost::function<void(Range *range)> TaskType;
class Scheduler
{
public:
Scheduler(unsigned step);
~Scheduler();
void Launch(TaskType task, unsigned b_min, unsigned b_max, unsigned force_step=0);
void Pause();
void Resume();
void Stop();
void Done();
void AddThread(Thread *thread);
void DelThread();
unsigned ThreadCount() const
{
return threads.size();
}
void FreeThreadLocalStorage();
friend class Thread;
friend class Range;
private:
enum {PAUSED, RUNNING} state;
TaskType GetTask();
bool EndTask(Thread* thread);
std::vector<Thread*> threads;
std::vector<Thread*> threads_finished;
TaskType current_task;
boost::mutex mutex;
boost::condition_variable condition;
unsigned counter;
unsigned start;
unsigned end;
unsigned current;
unsigned step;
unsigned default_step;
};
class Range
{
public:
unsigned begin()
{
return atomic_init();
}
unsigned end()
{
return ~0u;
}
unsigned next()
{
if(++current < max)
return current;
// handle pause
while (scheduler->state == Scheduler::PAUSED)
{
boost::this_thread::sleep(boost::posix_time::seconds(1));
}
return atomic_init();
}
// public for thread local data access
Thread *thread;
friend class Thread;
private:
unsigned atomic_init()
{
if(!thread->active)
return end();
unsigned new_value = scheduler->step * atomic_inc32(&scheduler->current);
if(new_value < scheduler->end)
{
max = std::min(scheduler->end, new_value + scheduler->step);
current = new_value;
return new_value;
}
return end();
}
Range(Scheduler *sched, Thread *thread_data);
unsigned current;
unsigned max;
Scheduler *scheduler;
};
}
|
/*
* Copyright (c) 2014-2016 Alex Spataru <[email protected]>
*
* This file is part of the QSimpleUpdater library, which is released under
* the DBAD license, you can read a copy of it below:
*
* DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING,
* DISTRIBUTION AND MODIFICATION:
*
* Do whatever you like with the original work, just don't be a dick.
* Being a dick includes - but is not limited to - the following instances:
*
* 1a. Outright copyright infringement - Don't just copy this and change the
* name.
* 1b. Selling the unmodified original with no work done what-so-ever, that's
* REALLY being a dick.
* 1c. Modifying the original work to contain hidden harmful content.
* That would make you a PROPER dick.
*
* If you become rich through modifications, related works/services, or
* supporting the original work, share the love.
* Only a dick would make loads off this work and not buy the original works
* creator(s) a pint.
*
* Code is provided with no warranty. Using somebody else's code and bitching
* when it goes wrong makes you a DONKEY dick.
* Fix the problem yourself. A non-dick would submit the fix back.
*/
#ifndef _QSIMPLEUPDATER_MAIN_H
#define _QSIMPLEUPDATER_MAIN_H
#include <QUrl>
#include <QList>
#include <QObject>
#if defined (QSU_SHARED)
#define QSU_DECL Q_DECL_EXPORT
#elif defined (QSU_IMPORT)
#define QSU_DECL Q_DECL_IMPORT
#else
#define QSU_DECL
#endif
class Updater;
/**
* \brief Manages the updater instances
*
* The \c QSimpleUpdater class manages the updater system and allows for
* parallel application modules to check for updates and download them.
*
* The behavior of each updater can be regulated by specifying the update
* definitions URL (from where we download the individual update definitions)
* and defining the desired options by calling the individual "setter"
* functions (e.g. \c setNotifyOnUpdate()).
*
* The \c QSimpleUpdater also implements an integrated downloader.
* If you need to use a custom install procedure/code, just create a function
* that is called when the \c downloadFinished() signal is emitted to
* implement your own install procedures.
*
* By default, the downloader will try to open the file as if you opened it
* from a file manager or a web browser (with the "file:*" url).
*/
class QSU_DECL QSimpleUpdater : public QObject
{
Q_OBJECT
signals:
void checkingFinished (const QString& url);
void appcastDownloaded (const QString& url, const QByteArray& data);
void downloadFinished (const QString& url, const QString& filepath);
void installerOpened();
void updateDeclined();
public:
static QSimpleUpdater* getInstance();
bool usesCustomAppcast (const QString& url) const;
bool getNotifyOnUpdate (const QString& url) const;
bool getNotifyOnFinish (const QString& url) const;
bool getUpdateAvailable (const QString& url) const;
bool getDownloaderEnabled (const QString& url) const;
bool usesCustomInstallProcedures (const QString& url) const;
QString getOpenUrl (const QString& url) const;
QString getChangelog (const QString& url) const;
QString getModuleName (const QString& url) const;
QString getDownloadUrl (const QString& url) const;
QString getPlatformKey (const QString& url) const;
QString getLatestVersion (const QString& url) const;
QString getModuleVersion (const QString& url) const;
public slots:
void checkForUpdates (const QString& url);
void setModuleName (const QString& url, const QString& name);
void setNotifyOnUpdate (const QString& url, const bool notify);
void setNotifyOnFinish (const QString& url, const bool notify);
void setPlatformKey (const QString& url, const QString& platform);
void setModuleVersion (const QString& url, const QString& version);
void setDownloaderEnabled (const QString& url, const bool enabled);
void setUseCustomAppcast (const QString& url, const bool customAppcast);
void setUseCustomInstallProcedures (const QString& url, const bool custom);
protected:
~QSimpleUpdater();
private:
Updater* getUpdater (const QString& url) const;
};
#endif
|
#include <stdio.h>
#include "aeb.h"
#include <string.h>
#include <math.h>
int main() {
Aeb * raiz, *esq, * dir;
Aeb * arvore;
double r;
char s[127];
/*arvore = criaRaiz('*');
esq = criaFolha(10.0);
dir = criaFolha(7.0);
conectaNodos(arvore, esq, dir);
raiz = criaRaiz('+');
dir = criaFolha(8.0);
conectaNodos(raiz, arvore, dir);
printf("Resultado: %g\n", resolveExpressao(raiz));*/
printf("\nExpressão: ");
scanf("%s",s);
arvore = criaArvore(s);
printf("Expressão após conversão: ");
mostraArvore(arvore);
puts("");
r=resolveExpressao(arvore);
printf("\nO resultado é= %g\n",r);
}
|
static inline struct pthread *__pthread_self()
{
struct pthread *self;
__asm__ ("mov %%fs:0,%0" : "=r" (self) );
return self;
}
#define TP_ADJ(p) (p)
#define MC_PC gregs[REG_RIP]
|
#ifndef __MACROS_H__
#define __MACROS_H__
#include "config.h"
#define __KERNELNAME__ "code0"
/*
* This file is automatically included before the first line of any
* source file, using gcc's -imacro command line option. Only macro
* definitions will be extracted.
*/
#define INC_ARCH(x) <l4/arch/__ARCH__/x>
#define INC_SUBARCH(x) <l4/arch/__ARCH__/__SUBARCH__/x>
#define INC_CPU(x) <l4/arch/__ARCH__/__SUBARCH__/__CPU__/x>
#define INC_PLAT(x) <l4/platform/__PLATFORM__/x>
#define INC_API(x) <l4/api/x>
#define INC_GLUE(x) <l4/glue/__ARCH__/x>
#define __initdata SECTION(".init.data")
/*
* FIXME: Remove __CPP__
* This is defined in kernel linker.lds.in,
* find some better way.
*/
#if !defined(__CPP__)
/* use this to place code/data in a certain section */
#define SECTION(x) __attribute__((section(x)))
#define ALIGN(x) __attribute__((aligned (x)))
#endif
/* Functions for critical path optimizations */
#if (__GNUC__ >= 3)
#define unlikely(x) __builtin_expect((x), false)
#define likely(x) __builtin_expect((x), true)
#define likelyval(x,val) __builtin_expect((x), (val))
#else /* __GNUC__ < 3 */
#define likely(x) (x)
#define unlikely(x) (x)
#define likelyval(x,val) (x)
#endif /* __GNUC__ < 3 */
/* This guard is needed because tests use host C library and NULL is defined */
#ifndef NULL
#define NULL 0
#endif
/* Convenience functions for memory sizes. */
#define SZ_1K 1024
#define SZ_2K 2048
#define SZ_4K 0x1000
#define SZ_16K 0x4000
#define SZ_32K 0x8000
#define SZ_64K 0x10000
#define SZ_1MB 0x100000
#define SZ_2MB 0x200000
#define SZ_4MB (4*SZ_1MB)
#define SZ_8MB (8*SZ_1MB)
#define SZ_16MB (16*SZ_1MB)
#define SZ_1K_BITS 10
#define SZ_4K_BITS 12
#define SZ_16K_BITS 14
#define SZ_1MB_BITS 20
/* Per-cpu variables */
#if defined CONFIG_SMP
#define DECLARE_PERCPU(type, name) \
type name[CONFIG_NCPU]
#define per_cpu(val) (val)[smp_get_cpuid()]
#define per_cpu_byid(val, cpu) (val)[(cpu)]
#else /* Not CONFIG_SMP */
#define DECLARE_PERCPU(type, name) \
type name
#define per_cpu(val) (val)
#define per_cpu_byid(val, cpu) val
#endif /* End of Not CONFIG_SMP */
#ifndef __ASSEMBLY__
#include <stddef.h> /* offsetof macro, defined in the `standard' way. */
#endif
#define container_of(ptr, struct_type, field) \
({ \
const typeof(((struct_type *)0)->field) *field_ptr = (ptr); \
(struct_type *)((char *)field_ptr - offsetof(struct_type, field)); \
})
/* Prefetching is noop for now */
#define prefetch(x) x
#if !defined(__KERNEL__)
#define printk printf
#endif
/* Converts an int-sized field offset in a struct into a bit offset in a word */
#define FIELD_TO_BIT(type, field) (1 << (offsetof(type, field) >> 2))
/* Functions who may either return a pointer or an error code can use these: */
#define PTR_ERR(x) ((void *)(x))
/* checks up to -1000, the rest might be valid pointers!!! E.g. 0xE0000000 */
// #define IS_ERR(x) ((((int)(x)) < 0) && (((int)(x) > -1000)))
#if !defined(__ASSEMBLY__)
#define IS_ERR(x) is_err((int)(x))
static inline int is_err(int x)
{
return x < 0 && x > -0x1000;
}
#endif
/* TEST: Is this type of printk well tested? */
#define BUG() {do { \
printk("BUG in file: %s function: %s line: %d\n", \
__FILE__, __FUNCTION__, __LINE__); \
} while(0); \
while(1);}
#define BUG_ON(x) {if (x) BUG();}
#define WARN_ON(x) {if (x) printk("%s, %s, %s: Warning something is off here.\n", __FILE__, __FUNCTION__, __LINE__); }
#define BUG_ON_MSG(msg, x) do { \
printk(msg); \
BUG_ON(x) \
} while(0)
#define BUG_MSG(msg...) do { \
printk(msg); \
BUG(); \
} while(0)
#endif /* __MACROS_H__ */
|
// This file was generated based on /usr/local/share/uno/Packages/Fuse.Controls.Navigation/1.3.1/Transition.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Int.h>
namespace g{
namespace Fuse{
namespace Triggers{
// public enum TransitionMode :181
uEnumType* TransitionMode_typeof();
}}} // ::g::Fuse::Triggers
|
#include <unistd.h>
#include <sys/stat.h>
int remove(const char *pathname) {
struct stat buf;
stat(pathname, &buf);
if (S_ISDIR(buf.st_mode)) {
return rmdir(pathname);
} else {
return unlink(pathname);
}
}
|
/*!
* \file in_memory_configuration.h
* \brief A ConfigurationInterface for testing purposes.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
* This implementation accepts configuration parameters upon instantiation and
* it is intended to be used in unit testing.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_IN_MEMORY_CONFIGURATION_H_
#define GNSS_SDR_IN_MEMORY_CONFIGURATION_H_
#include <map>
#include <memory>
#include <string>
#include "configuration_interface.h"
class StringConverter;
/*!
* \brief This class is an implementation of the interface ConfigurationInterface.
*
* This implementation accepts configuration parameters upon instantiation and
* it is intended to be used in unit testing.
*/
class InMemoryConfiguration : public ConfigurationInterface
{
public:
InMemoryConfiguration();
virtual ~InMemoryConfiguration();
std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value);
long property(std::string property_name, long default_value);
int property(std::string property_name, int default_value);
unsigned int property(std::string property_name, unsigned int default_value);
float property(std::string property_name, float default_value);
double property(std::string property_name, double default_value);
void set_property(std::string property_name, std::string value);
bool is_present(std::string property_name);
private:
std::map<std::string, std::string> properties_;
std::unique_ptr<StringConverter> converter_;
};
#endif /*GNSS_SDR_IN_MEMORY_CONFIGURATION_H_*/
|
/**
******************************************************************************
* @file BSP/Inc/main.h
* @author MCD Application Team
* @version V1.2.6
* @date 06-May-2016
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stdio.h"
#include "stm32f429i_discovery.h"
#include "stm32f429i_discovery_ts.h"
#include "stm32f429i_discovery_io.h"
#include "stm32f429i_discovery_lcd.h"
#include "stm32f429i_discovery_gyroscope.h"
#ifdef EE_M24LR64
#include "stm32f429i_discovery_eeprom.h"
#endif /*EE_M24LR64*/
/* Exported types ------------------------------------------------------------*/
typedef struct
{
void (*DemoFunc)(void);
uint8_t DemoName[50];
uint32_t DemoIndex;
}BSP_DemoTypedef;
extern const unsigned char stlogo[];
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
#define COUNT_OF_EXAMPLE(x) (sizeof(x)/sizeof(BSP_DemoTypedef))
/* Exported functions ------------------------------------------------------- */
void Joystick_demo (void);
void Touchscreen_demo (void);
void LCD_demo (void);
void MEMS_demo (void);
void Log_demo(void);
#ifdef EE_M24LR64
void EEPROM_demo (void);
#endif /*EE_M24LR64*/
void SD_demo (void);
void Touchscreen_Calibration (void);
uint16_t Calibration_GetX(uint16_t x);
uint16_t Calibration_GetY(uint16_t y);
uint8_t IsCalibrationDone(void);
uint8_t CheckForUserInput(void);
void Toggle_Leds(void);
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
Copyright (C) 2004 Jacquelin POTIER <[email protected]>
Dynamic aspect ratio code Copyright (C) 2004 Jacquelin POTIER <[email protected]>
originally based from APISpy32 v2.1 from Yariv Kaplan @ WWW.INTERNALS.COM
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.
*/
//-----------------------------------------------------------------------------
// Object: exported structs (needed for overriding api)
//-----------------------------------------------------------------------------
#pragma once
#include <windows.h>
#include "registers.h"
// assume that structs share between WinAPIOverride and the FakeAPI dll
// will have the same alignment
#pragma pack(push)
#pragma pack(4)
typedef struct tagPrePostApiCallHookInfos
{
PBYTE Rbp;
PBYTE ReturnAddress;
HMODULE CallingModuleHandle;
BOOL OverridingModulesFiltersSuccessfullyChecked;
}PRE_POST_API_CALL_HOOK_INFOS,*PPRE_POST_API_CALL_HOOK_INFOS;
#pragma pack(pop)
#ifdef _WIN64
// StackParameters : adjusted stack parameters (no shadow for x64, only parameters passed through stack)
typedef BOOL (__stdcall *pfPreApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,XMM_REGISTERS* pBeforeCallXmmRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop pre api call chain functions
// StackParameters : adjusted stack parameters (no shadow for x64, only parameters passed through stack)
typedef BOOL (__stdcall *pfPostApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,XMM_REGISTERS* pBeforeCallXmmRegisters,REGISTERS* pAfterCallRegisters,XMM_REGISTERS* pAfterCallXmmRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop calling post api call chain functions
#else
typedef BOOL (__stdcall *pfPreApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop pre api call chain functions
typedef BOOL (__stdcall *pfPostApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,REGISTERS* pAfterCallRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop calling post api call chain functions
#endif
typedef BOOL (__stdcall *pfCOMObjectCreationCallBack)(CLSID* pClsid,IID* pIid,PVOID pInterface,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos);// return FALSE to stop calling post api call chain functions
typedef BOOL (__stdcall *pfCOMObjectDeletionCallBack)(CLSID* pClsid,PVOID pIUnknownInterface,PVOID pInterfaceReturnedAtObjectCreation,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos);// return FALSE to stop calling post api call chain functions
|
/*
* $Id: channel_manager.h 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CHANNEL_MANAGER_H_
# define CHANNEL_MANAGER_H_
#include <time.h>
#include "query_parser.h"
#include "cachemodel_manager.h"
#include "auxtrans_manager.h"
/** maximum length of channel identifier*/
#define MAX_LENOFCID 30
/** Channel parameters*/
typedef struct channel_param{
cachemodel_param_t *cachemodel; /**< reference pointer to the cache model*/
char cid[MAX_LENOFCID]; /**< channel identifier*/
cnew_transport_t aux; /**< auxiliary transport*/
/* - a record of the client's capabilities and preferences to the extent that the server queues requests*/
time_t start_tm; /**< starting time*/
struct channel_param *next; /**< pointer to the next channel*/
} channel_param_t;
/** Channel list parameters*/
typedef struct channellist_param{
channel_param_t *first; /**< first channel pointer of the list*/
channel_param_t *last; /**< last channel pointer of the list*/
} channellist_param_t;
/**
* generate a channel list
*
* @return pointer to the generated channel list
*/
channellist_param_t * gene_channellist(void);
/**
* generate a channel under the channel list
*
* @param[in] query_param query parameters
* @param[in] auxtrans auxiliary transport
* @param[in] cachemodel reference cachemodel
* @param[in] channellist channel list pointer
* @return pointer to the generated channel
*/
channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxtrans, cachemodel_param_t *cachemodel, channellist_param_t *channellist);
/**
* set channel variable parameters
*
* @param[in] query_param query parameters
* @param[in,out] channel pointer to the modifying channel
*/
void set_channel_variable_param( query_param_t query_param, channel_param_t *channel);
/**
* delete a channel
*
* @param[in] channel address of the deleting channel pointer
* @param[in,out] channellist channel list pointer
*/
void delete_channel( channel_param_t **channel, channellist_param_t *channellist);
/**
* delete channel list
*
* @param[in,out] channellist address of the channel list pointer
*/
void delete_channellist( channellist_param_t **channellist);
/**
* print all channel parameters
*
* @param[in] channellist channel list pointer
*/
void print_allchannel( channellist_param_t *channellist);
/**
* search a channel by channel ID
*
* @param[in] cid channel identifier
* @param[in] channellist channel list pointer
* @return found channel pointer
*/
channel_param_t * search_channel( char cid[], channellist_param_t *channellist);
#endif /* !CHANNEL_MANAGER_H_ */
|
#ifndef PLANG_TOKENIZER
#define PLANG_TOKENIZER
#include <map>
#include <vector>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
class PlangTokenizer {
// Input buffer
std::string m_input;
// Current possition in input buffer
std::size_t m_input_pos;
// Currently read element from input
int m_ch;
// Counterss
int m_input_line; // Which line it is in the source code (0, 1,2,3...)
int m_input_column; // Which column it is in the source code (0, 1,2,3...)
// Simple input + counters initializer
void input_init() {
m_input.clear();
m_input_pos = 0;
// Counters
m_input_line = 0;
m_input_column = 0;
}
public:
// Return counter with current line
int get_line() {
return m_input_line;
}
// Return counter with current column
int get_column() {
return m_input_column;
}
// Returns nth line of input
std::string get_line_str(const int line) {
std::string::iterator b = m_input.begin();
std::string::iterator e = m_input.end();
for (int i = 0 ; i < line ; ++i) {
b = std::find(b, e, '\n');
}
return std::string(b, std::find(b, e, '\n'));
}
// Token values
struct TokenValue {
std::string s;
int i;
float f;
} m_token_value;
// Token types outputed by tokenizer
struct Token {
enum {
// Language values
END = -1, // EOF!
ID = -2,
INT = -3,
FLT = -4,
STR = -5,
// Language keywords
RETURN = -100,
IF = -200,
ELSE = -201,
AS = -202,
};
}; // Last read token
// Mapping between keyword and token
std::map<std::string, int> m_keyword_token_map = {
{"return", Token::RETURN},
{"if", Token::IF},
{"else", Token::ELSE},
{"as", Token::AS},
};
// Load all characters from input
void load_input(const char *input, int size) {
input_init();
m_input = std::string(input, input + size);
}
// Load from string input
void load_input(const char *input) {
input_init();
m_input = std::string(input);
}
// Return next element of input buffer
int get_next_consume() {
if (m_input_pos == m_input.size())
return Token::END;
return m_input[m_input_pos++];
}
// Get next element from the input and store it
// in m_ch temporary value buffer to use after call
int get_next() {
m_ch = get_next_consume();
// Collect some counter statistics
m_input_column++;
if (m_ch == '\n') {
m_input_column = 0;
m_input_line++;
}
return m_ch;
}
// Sneak-peak next token
int get_next_preview() {
if (m_input_pos == m_input.size())
return Token::END;
return m_input[m_input_pos];
}
// like isalpha checks if c is in set of allowed
// identifier charset
int isidchar(int c) {
return std::isalpha(c) || std::isdigit(c) || c == '_';
}
// Parse input and get next token
int get_token_val() {
while (std::isspace(get_next())) {
// Skipping all whitespaces
}
if (m_ch == Token::END)
return Token::END;
if (std::isalpha(m_ch)) {
// ID: alphanumeric
// KEYWORD: alphanumeric
m_token_value.s = m_ch;
while (isidchar(get_next_preview())) {
m_token_value.s += get_next();
}
// If identifier is a keyword return keyword token
if (m_keyword_token_map.find(m_token_value.s) != m_keyword_token_map.end()) {
return m_keyword_token_map.at(m_token_value.s);
}
// Generic identifier
return Token::ID;
} else if (std::isdigit(m_ch)) {
// INT: plain integer
m_token_value.s = m_ch;
while (std::isdigit(get_next_preview())) {
m_token_value.s += get_next();
}
m_token_value.i = std::atoi(m_token_value.s.c_str());
return Token::INT;
}
// Return read character
m_token_value.s = m_ch;
return m_ch;
}
// Get next token and saves int vaue in the buffer
int get_token() {
return get_token_val();
}
const TokenValue& get_token_value() {
return m_token_value;
}
};
#endif
|
#ifndef Func_seq_H
#define Func_seq_H
#include "Procedure.h"
#include <string>
namespace RevLanguage {
/**
* @brief Function that creates a numerical sequence.
*
* This function is the equivalent to the 'R' function seq().
* The function creates a numerical sequence from the specified value
* to the specified value incremented by a specified value:
*
* a <- seq(from=1,to=10,by=2)
*
* Which gives:
* {1,3,5,7,9}
*
* This function is very similar to the range function except that
* it has a user specified increment (or decrement).
*
*
*
* @copyright Copyright 2009-
* @author The RevBayes Development Core Team (Sebastian Hoehna)
* @since Version 1.0, 2014-06-19
*
*/
template <typename valType>
class Func_seq : public Procedure {
public:
Func_seq();
// Basic utility functions
Func_seq* clone(void) const; //!< Clone the object
static const std::string& getClassType(void); //!< Get Rev type
static const TypeSpec& getClassTypeSpec(void); //!< Get class type spec
std::string getFunctionName(void) const; //!< Get the primary name of the function in Rev
const TypeSpec& getTypeSpec(void) const; //!< Get language type of the object
// Regular functions
const ArgumentRules& getArgumentRules(void) const; //!< Get argument rules
const TypeSpec& getReturnType(void) const; //!< Get type of return value
RevPtr<RevVariable> execute(void); //!< Execute function
protected:
};
}
#include "ArgumentRule.h"
#include "Ellipsis.h"
#include "RbUtil.h"
#include "TypedDagNode.h"
#include "TypeSpec.h"
template <typename valType>
RevLanguage::Func_seq<valType>::Func_seq() : Procedure() {
}
/* Clone object */
template <typename valType>
RevLanguage::Func_seq<valType>* RevLanguage::Func_seq<valType>::clone( void ) const {
return new Func_seq( *this );
}
/** Execute function: We rely on getValue and overloaded push_back to provide functionality */
template <typename valType>
RevLanguage::RevPtr<RevLanguage::RevVariable> RevLanguage::Func_seq<valType>::execute( void )
{
typename valType::valueType from = static_cast<const valType &>( args[0].getVariable()->getRevObject() ).getValue();
typename valType::valueType to = static_cast<const valType &>( args[1].getVariable()->getRevObject() ).getValue();
typename valType::valueType by = static_cast<const valType &>( args[2].getVariable()->getRevObject() ).getValue();
typename valType::valueType val = from;
// typename valType::valueType eps = valType::EPSILON;
typename valType::valueType eps = std::numeric_limits<typename valType::valueType>::epsilon();
ModelVector<valType> *seq = new ModelVector<valType>();
// while ( (val >= from && val <= to) || (val <= from && val >= to) )
while ( ((val - from) >= -eps && (val - to) <= eps) || ((val - from) <= eps && (val - to) >= -eps) )
{
seq->push_back( valType( val ) );
val += by;
}
return new RevVariable( seq );
}
/** Get argument rules */
template <typename valType>
const RevLanguage::ArgumentRules& RevLanguage::Func_seq<valType>::getArgumentRules( void ) const
{
static ArgumentRules argumentRules = ArgumentRules();
static bool rules_set = false;
if ( !rules_set )
{
argumentRules.push_back( new ArgumentRule( "from", valType::getClassTypeSpec(), "The first value of the sequence.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
argumentRules.push_back( new ArgumentRule( "to" , valType::getClassTypeSpec(), "The last value of the sequence.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
argumentRules.push_back( new ArgumentRule( "by" , valType::getClassTypeSpec(), "The step-size between value.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
rules_set = true;
}
return argumentRules;
}
/** Get Rev type of object */
template <typename valType>
const std::string& RevLanguage::Func_seq<valType>::getClassType(void)
{
static std::string rev_type = "Func_seq<" + valType::getClassType() + ">";
return rev_type;
}
/** Get class type spec describing type of object */
template <typename valType>
const RevLanguage::TypeSpec& RevLanguage::Func_seq<valType>::getClassTypeSpec(void)
{
static TypeSpec rev_type_spec = TypeSpec( getClassType(), new TypeSpec( Function::getClassTypeSpec() ) );
return rev_type_spec;
}
/**
* Get the primary Rev name for this function.
*/
template <typename valType>
std::string RevLanguage::Func_seq<valType>::getFunctionName( void ) const
{
// create a name variable that is the same for all instance of this class
std::string f_name = "seq";
return f_name;
}
/** Get type spec */
template <typename valType>
const RevLanguage::TypeSpec& RevLanguage::Func_seq<valType>::getTypeSpec( void ) const
{
static TypeSpec type_spec = getClassTypeSpec();
return type_spec;
}
/** Get return type */
template <typename valType>
const RevLanguage::TypeSpec& RevLanguage::Func_seq<valType>::getReturnType( void ) const {
return ModelVector<valType>::getClassTypeSpec();
}
#endif
|
/*
**
** This file is part of BananaCam.
**
** BananaCam is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** BananaCam 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 BananaCam. If not, see <http://www.gnu.org/licenses/>.
**
*/
#include "camera_control.h"
void error_func (GPContext *context, const char *format, va_list args, void *data) {
context = context;
data = data;
fprintf(stderr, "*** Contexterror ***\n");
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
}
void message_func (GPContext *context, const char *format, va_list args, void *data) {
context = context;
data = data;
vprintf(format, args);
printf("\n");
}
void signal_handler(int sig)
{
printf("Signal ==> %i\n", sig);
}
void signal_inib()
{
struct sigaction act;
int i;
act.sa_handler = signal_handler;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
i = 1;
while (i < 32)
{
if (i != 11)
sigaction(i, &act, NULL);
i++;
}
}
int init(t_cam *c)
{
c->liveview = 0;
c->liveview_fps = 30;
c->liveview_fps_time = 1000000 / 30;
pthread_mutex_init(&c->liveview_mutex, NULL);
pthread_cond_init(&c->liveview_condvar, NULL);
c->folder_path = strdup("/tmp/");
c->camera_value_list = NULL;
gp_context_set_error_func(c->context, (GPContextErrorFunc)error_func, NULL);
gp_context_set_message_func(c->context, (GPContextMessageFunc)message_func, NULL);
gp_camera_new(&c->camera);
c->context = gp_context_new();
printf("Camera Init\n");
c->ret = gp_camera_init(c->camera, c->context);
if (c->ret != GP_OK) {
printf("gp_camera_init: %d\n", c->ret);
return (GP_ERROR);
}
/* get_initial_camera_values(t_cam *c); */
return (GP_OK);
}
void generic_exec(t_cam *c, char *command, char **param)
{
char *msg = NULL;
if (command && strncmp(command, "get_", 4) == 0)
{
command = &command[4];
get_config(command, c);
return;
}
if (param)
{
if (param[0])
set_config(command, param[0], c);
}
else
{
asprintf(&msg, "bad parameters for %s", command);
creat_and_send_message(BAD_PARAMETERS, NULL, NULL, msg, c);
}
}
int exec_command(t_cam *c, char *command, char **param)
{
t_func *tmp = NULL;
int flag = 0;
if (strcmp(command, "liveview") != 0 && c->liveview == 1)
{
printf("enter inside here\n");
c->liveview = 0;
flag = 1;
sleep(1);
}
tmp = c->first_func_ptr;
while (tmp != NULL)
{
if (strcmp(command, tmp->name) == 0)
{
tmp->func_ptr(c, param);
break;
}
tmp = tmp->next;
}
if (tmp == NULL)
generic_exec(c, command, param);
if (flag == 1)
liveview(c, NULL);
return (0);
}
void add_func_ptr_list(t_cam *c, char *name, int (*func_ptr)(t_cam *c, char **param))
{
t_func *tmp;
if (c->first_func_ptr == NULL)
{
c->first_func_ptr = malloc(sizeof(*c->first_func_ptr));
tmp = c->first_func_ptr;
tmp->next = NULL;
tmp->func_ptr = func_ptr;
tmp->name = strdup(name);
c->first_func_ptr = tmp;
}
else
{
tmp = c->first_func_ptr;
while (tmp->next != NULL)
tmp = tmp->next;
tmp->next = malloc(sizeof(*tmp->next));
tmp = tmp->next;
tmp->next = NULL;
tmp->func_ptr = func_ptr;
tmp->name = strdup(name);
}
}
int main(int ac, char **av)
{
t_cam *c;
ac = ac;
av = av;
#ifdef __APPLE__
//pthread_t thread;
printf("Killing PTPCamera process\n");
system("killall PTPCamera");
//pthread_create(&thread, NULL, initUSBDetect, (void *)c);
#endif
signal_inib();
c = malloc(sizeof(*c));
c->first_func_ptr = NULL;
init(c);
get_all_widget_and_choices(c);
add_func_ptr_list(c, "capture", trigger_capture);
add_func_ptr_list(c, "liveview", liveview);
add_func_ptr_list(c, "auto_focus", auto_focus);
add_func_ptr_list(c, "liveviewfps", liveviewfps);
add_func_ptr_list(c, "get_liveviewfps", get_liveviewfps);
add_func_ptr_list(c, "defaultpath", set_default_folder_path);
add_func_ptr_list(c, "get_defaultpath", get_default_folder_path);
pthread_create(&c->liveview_thread, NULL, liveview_launcher, (void*)c);
init_comm(c, UNIX_SOCKET_PATH);
gp_camera_exit(c->camera, c->context);
return (0);
}
|
/*
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free
Software Foundation, Inc.
This file is part of GNU Inetutils.
GNU Inetutils is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
GNU Inetutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see `http://www.gnu.org/licenses/'. */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <config.h>
#if defined AUTHENTICATION || defined ENCRYPTION
# include <unistd.h>
# include <sys/types.h>
# include <arpa/telnet.h>
# include <libtelnet/encrypt.h>
# include <libtelnet/misc.h>
# include "general.h"
# include "ring.h"
# include "externs.h"
# include "defines.h"
# include "types.h"
int
net_write (unsigned char *str, int len)
{
if (NETROOM () > len)
{
ring_supply_data (&netoring, str, len);
if (str[0] == IAC && str[1] == SE)
printsub ('>', &str[2], len - 2);
return (len);
}
return (0);
}
void
net_encrypt ()
{
# ifdef ENCRYPTION
if (encrypt_output)
ring_encrypt (&netoring, encrypt_output);
else
ring_clearto (&netoring);
# endif /* ENCRYPTION */
}
int
telnet_spin ()
{
return (-1);
}
char *
telnet_getenv (char *val)
{
return ((char *) env_getvalue (val));
}
char *
telnet_gets (char *prompt, char *result, int length, int echo)
{
# if !HAVE_DECL_GETPASS
extern char *getpass ();
# endif
extern int globalmode;
int om = globalmode;
char *res;
TerminalNewMode (-1);
if (echo)
{
printf ("%s", prompt);
res = fgets (result, length, stdin);
}
else
{
res = getpass (prompt);
if (res)
{
strncpy (result, res, length);
memset (res, 0, strlen (res));
res = result;
}
}
TerminalNewMode (om);
return (res);
}
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
|
/* This file is part of the 'orilib' software. */
/* Copyright (C) 2007-2009, 2012 Romain Quey */
/* see the COPYING file in the top-level directory.*/
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef OL_DIS_DEP_H
#define OL_DIS_DEP_H
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<float.h>
#define isNaN(x) ((x) != (x))
#include"ut.h"
#include"../ol_set.h"
#endif /* OL_DIS_DEP_H */
#ifdef __cplusplus
}
#endif
|
/*
* (C) 2003-2006 Gabest
* (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <d3dx9shader.h>
class CPixelShaderCompiler
{
typedef HRESULT(WINAPI* D3DXCompileShaderPtr)(
LPCSTR pSrcData,
UINT SrcDataLen,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPCSTR pFunctionName,
LPCSTR pProfile,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs,
LPD3DXCONSTANTTABLE* ppConstantTable);
typedef HRESULT(WINAPI* D3DXDisassembleShaderPtr)(
CONST DWORD* pShader,
bool EnableColorCode,
LPCSTR pComments,
LPD3DXBUFFER* ppDisassembly);
D3DXCompileShaderPtr m_pD3DXCompileShader;
D3DXDisassembleShaderPtr m_pD3DXDisassembleShader;
CComPtr<IDirect3DDevice9> m_pD3DDev;
public:
CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStaySilent = false);
virtual ~CPixelShaderCompiler();
HRESULT CompileShader(
LPCSTR pSrcData,
LPCSTR pFunctionName,
LPCSTR pProfile,
DWORD Flags,
IDirect3DPixelShader9** ppPixelShader,
CString* disasm = nullptr,
CString* errmsg = nullptr);
};
|
/*
** ###################################################################
** This code is generated by the Device Initialization Tool.
** It is overwritten during code generation.
** USER MODIFICATION ARE NOT PRESERVED IN THIS FILE.
**
** Project : s08qe128
** Processor : MCF51QE128CLK
** Version : Bean 01.001, Driver 01.03, CPU db: 3.00.000
** Datasheet : MCF51QE128RM Rev. 1.0 Draft F
** Date/Time : 06/03/2009, 10:04 a.m.
** Abstract :
** This module contains device initialization code
** for selected on-chip peripherals.
** Contents :
** Function "MCU_init" initializes selected peripherals
**
** (c) Copyright UNIS, spol. s r.o. 1997-2006
** UNIS, spol s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : [email protected]
** ###################################################################
*/
#include "derivative.h"
#define MCU_XTAL_CLK 8192000
#define MCU_REF_CLK_DIVIDER 256
#define MCU_REF_CLK (MCU_XTAL_CLK/MCU_REF_CLK_DIVIDER)
#define MCU_FLL_OUT (MCU_REF_CLK*1536)
#define MCU_BUSCLK (MCU_FLL_OUT/2)
#define RTI_TICK 1 /* Real Time Interrupt [ms] */
#define RTI_MS(x) (x/RTI_TICK) /* Tick Base to ms */
#define reset_now() asm( "HALT" )
void mcu_init( unsigned char tick_ms );
unsigned long get_ts( void );
|
/**********************************************************************
** smepowercad
** Copyright (C) 2015 Smart Micro Engineering GmbH
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#ifndef CAD_HEATCOOL_RADIATORVALVE_H
#define CAD_HEATCOOL_RADIATORVALVE_H
#include "caditem.h"
#include "items/cad_basic_box.h"
class CAD_HeatCool_RadiatorValve : public CADitem
{
public:
CAD_HeatCool_RadiatorValve();
virtual ~CAD_HeatCool_RadiatorValve();
virtual QList<CADitemTypes::ItemType> flangable_items(int flangeIndex);
virtual QImage wizardImage();
virtual QString iconPath();
virtual QString domain();
virtual QString description();
virtual void calculate();
virtual void processWizardInput();
virtual QMatrix4x4 rotationOfFlange(quint8 num);
// virtual void paint(GLWidget* glwidget);
// QOpenGLBuffer arrayBufVertices;
// QOpenGLBuffer indexBufFaces;
// QOpenGLBuffer indexBufLines;
qreal a, a2, l, l2, b;
CAD_basic_box *radiator;
};
#endif // CAD_HEATCOOL_RADIATORVALVE_H
|
// BOINC Sentinels.
// https://projects.romwnet.org/boincsentinels
// Copyright (C) 2009-2014 Rom Walton
//
// BOINC Sentinels is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC Sentinels is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC Sentinels. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _NOTIFICATIONMANAGER_H_
#define _NOTIFICATIONMANAGER_H_
class CNotificationManager: public wxObject
{
DECLARE_NO_COPY_CLASS(CNotificationManager)
public:
CNotificationManager();
virtual ~CNotificationManager();
bool IsRead(CBSLNotification& bslNotification);
bool IsDeleted(CBSLNotification& bslNotification);
bool MarkRead(CBSLNotification& bslNotification, bool bValue);
bool MarkDeleted(CBSLNotification& bslNotification, bool bValue);
private:
wxString DeterminePath(CBSLNotification& bslNotification);
bool GetConfigValue(wxString strSubComponent, wxString strValueName, long dwDefaultValue, long* pdwValue);
bool SetConfigValue(wxString strSubComponent, wxString strValueName, long dwValue);
};
#endif
|
// -*- C++ -*-
//
// generated by wxGlade 0.7.2
//
// Example for compiling a single file project under Linux using g++:
// g++ MyApp.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp
//
// Example for compiling a multi file project under Linux using g++:
// g++ main.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp Dialog1.cpp Frame1.cpp
//
#ifndef DIALOGEVTCMDCHANGELEVEL_H
#define DIALOGEVTCMDCHANGELEVEL_H
#include <wx/wx.h>
#include <wx/image.h>
#include <wx/intl.h>
#ifndef APP_CATALOG
#define APP_CATALOG "appEditor" // replace with the appropriate catalog name
#endif
// begin wxGlade: ::dependencies
#include <wx/spinctrl.h>
// end wxGlade
// begin wxGlade: ::extracode
// end wxGlade
class DialogEvtCmdChangeLevel: public wxDialog {
public:
// begin wxGlade: DialogEvtCmdChangeLevel::ids
// end wxGlade
DialogEvtCmdChangeLevel(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE);
private:
// begin wxGlade: DialogEvtCmdChangeLevel::methods
void set_properties();
void do_layout();
// end wxGlade
protected:
// begin wxGlade: DialogEvtCmdChangeLevel::attributes
wxRadioButton* rbtnTargetParty;
wxRadioButton* rbtnTargetFixed;
wxChoice* chTargetFixed;
wxRadioButton* rbtnTargetVariable;
wxTextCtrl* tcTargetVariable;
wxButton* btnTargetVariable;
wxRadioBox* rbOperation;
wxRadioButton* rbtnOperandConstant;
wxSpinCtrl* spinOperandConstant;
wxRadioButton* rbtnOperandVariable;
wxTextCtrl* tcOperandVariable;
wxButton* btnOperandVariable;
wxCheckBox* chbShowMessage;
wxButton* btnOK;
wxButton* btnCancel;
wxButton* btnHelp;
// end wxGlade
}; // wxGlade: end class
#endif // DIALOGEVTCMDCHANGELEVEL_H
|
/* DreamChess
**
** DreamChess is the legal property of its developers, whose names are too
** numerous to list here. Please refer to the AUTHORS.txt file distributed
** with this source distribution.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GAMEGUI_SIGNAL_H
#define GAMEGUI_SIGNAL_H
#include <gamegui/queue.h>
#include <gamegui/system.h>
typedef int gg_signal_t;
gg_signal_t gg_signal_lookup(gg_class_id class, char *name);
int gg_signal_register(gg_class_id class, char *name);
void gg_signal_init(void);
void gg_signal_exit(void);
#endif
|
/*
* Multi2Sim
* Copyright (C) 2012 Rafael Ubal ([email protected])
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include <lib/mhandle/mhandle.h>
#include <lib/util/debug.h>
#include <lib/util/linked-list.h>
#include "opencl-repo.h"
#include "opencl-command-queue.h"
#include "opencl-context.h"
#include "opencl-device.h"
#include "opencl-event.h"
#include "opencl-kernel.h"
#include "opencl-mem.h"
#include "opencl-platform.h"
#include "opencl-program.h"
#include "opencl-sampler.h"
struct si_opencl_repo_t
{
struct linked_list_t *object_list;
};
struct si_opencl_repo_t *si_opencl_repo_create(void)
{
struct si_opencl_repo_t *repo;
/* Initialize */
repo = xcalloc(1, sizeof(struct si_opencl_repo_t));
repo->object_list = linked_list_create();
/* Return */
return repo;
}
void si_opencl_repo_free(struct si_opencl_repo_t *repo)
{
linked_list_free(repo->object_list);
free(repo);
}
void si_opencl_repo_add_object(struct si_opencl_repo_t *repo,
void *object)
{
struct linked_list_t *object_list = repo->object_list;
/* Check that object does not exist */
linked_list_find(object_list, object);
if (!object_list->error_code)
fatal("%s: object already exists", __FUNCTION__);
/* Insert */
linked_list_add(object_list, object);
}
void si_opencl_repo_remove_object(struct si_opencl_repo_t *repo,
void *object)
{
struct linked_list_t *object_list = repo->object_list;
/* Check that object exists */
linked_list_find(object_list, object);
if (object_list->error_code)
fatal("%s: object does not exist", __FUNCTION__);
/* Remove */
linked_list_remove(object_list);
}
/* Look for an object in the repository. The first field of every OpenCL object
* is its identifier. */
void *si_opencl_repo_get_object(struct si_opencl_repo_t *repo,
enum si_opencl_object_type_t type, unsigned int object_id)
{
struct linked_list_t *object_list = repo->object_list;
void *object;
unsigned int current_object_id;
/* Upper 16-bits represent the type of the object */
if (object_id >> 16 != type)
fatal("%s: requested OpenCL object of incorrect type",
__FUNCTION__);
/* Search object */
LINKED_LIST_FOR_EACH(object_list)
{
object = linked_list_get(object_list);
assert(object);
current_object_id = * (unsigned int *) object;
if (current_object_id == object_id)
return object;
}
/* Not found */
fatal("%s: requested OpenCL does not exist (id=0x%x)",
__FUNCTION__, object_id);
return NULL;
}
/* Get the oldest created OpenCL object of the specified type */
void *si_opencl_repo_get_object_of_type(struct si_opencl_repo_t *repo,
enum si_opencl_object_type_t type)
{
struct linked_list_t *object_list = repo->object_list;
void *object;
unsigned int object_id;
/* Find object. Upper 16-bits of identifier contain its type. */
LINKED_LIST_FOR_EACH(object_list)
{
object = linked_list_get(object_list);
assert(object);
object_id = * (unsigned int *) object;
if (object_id >> 16 == type)
return object;
}
/* No object found */
return NULL;
}
/* Assignment of OpenCL object identifiers
* An identifier is a 32-bit value, whose 16 most significant bits represent the
* object type, while the 16 least significant bits represent a unique object ID. */
unsigned int si_opencl_repo_new_object_id(struct si_opencl_repo_t *repo,
enum si_opencl_object_type_t type)
{
static unsigned int si_opencl_object_id_counter;
unsigned int object_id;
object_id = (type << 16) | si_opencl_object_id_counter;
si_opencl_object_id_counter++;
if (si_opencl_object_id_counter > 0xffff)
fatal("%s: limit of OpenCL objects exceeded\n", __FUNCTION__);
return object_id;
}
void si_opencl_repo_free_all_objects(struct si_opencl_repo_t *repo)
{
void *object;
/* Platforms */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_platform)))
si_opencl_platform_free((struct si_opencl_platform_t *) object);
/* Devices */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_device)))
si_opencl_device_free((struct si_opencl_device_t *) object);
/* Contexts */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_context)))
si_opencl_context_free((struct si_opencl_context_t *) object);
/* Command queues */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_command_queue)))
si_opencl_command_queue_free((struct si_opencl_command_queue_t *) object);
/* Programs */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_program)))
si_opencl_program_free((struct si_opencl_program_t *) object);
/* Kernels */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_kernel)))
si_opencl_kernel_free((struct si_opencl_kernel_t *) object);
/* Mems */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_mem)))
si_opencl_mem_free((struct si_opencl_mem_t *) object);
/* Events */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_event)))
si_opencl_event_free((struct si_opencl_event_t *) object);
/* Samplers */
while ((object = si_opencl_repo_get_object_of_type(repo, si_opencl_object_sampler)))
si_opencl_sampler_free((struct si_opencl_sampler_t *) object);
/* Any object left */
if (linked_list_count(repo->object_list))
panic("%s: not all objects were freed", __FUNCTION__);
}
|
#include <shlobj.h>
HRESULT CreateDataObject(FORMATETC *,STGMEDIUM *,IDataObject **,int);
|
/*
* FuchsTracker.c Copyright (C) 1999 Sylvain "Asle" Chipaux
*
* Depacks Fuchs Tracker modules
*
* Modified in 2006,2007,2014 by Claudio Matsuoka
*/
#include <string.h>
#include <stdlib.h>
#include "prowiz.h"
static int depack_fuchs(HIO_HANDLE *in, FILE *out)
{
uint8 *tmp;
uint8 max_pat;
/*int ssize;*/
uint8 data[1080];
unsigned smp_len[16];
unsigned loop_start[16];
unsigned pat_size;
unsigned i;
memset(smp_len, 0, 16 * 4);
memset(loop_start, 0, 16 * 4);
memset(data, 0, 1080);
hio_read(data, 1, 10, in); /* read/write title */
/*ssize =*/ hio_read32b(in); /* read all sample data size */
/* read/write sample sizes */
for (i = 0; i < 16; i++) {
smp_len[i] = hio_read16b(in);
data[42 + i * 30] = smp_len[i] >> 9;
data[43 + i * 30] = smp_len[i] >> 1;
}
/* read/write volumes */
for (i = 0; i < 16; i++) {
data[45 + i * 30] = hio_read16b(in);
}
/* read/write loop start */
for (i = 0; i < 16; i++) {
loop_start[i] = hio_read16b(in);
data[46 + i * 30] = loop_start[i] >> 1;
}
/* write replen */
for (i = 0; i < 16; i++) {
int loop_size;
loop_size = smp_len[i] - loop_start[i];
if (loop_size == 0 || loop_start[i] == 0) {
data[49 + i * 30] = 1;
} else {
data[48 + i * 30] = loop_size >> 9;
data[49 + i * 30] = loop_size >> 1;
}
}
/* fill replens up to 31st sample wiz $0001 */
for (i = 16; i < 31; i++) {
data[49 + i * 30] = 1;
}
/* that's it for the samples ! */
/* now, the pattern list */
/* read number of pattern to play */
data[950] = hio_read16b(in);
data[951] = 0x7f;
/* read/write pattern list */
for (max_pat = i = 0; i < 40; i++) {
uint8 pat = hio_read16b(in);
data[952 + i] = pat;
if (pat > max_pat) {
max_pat = pat;
}
}
/* write ptk's ID */
if (fwrite(data, 1, 1080, out) != 1080) {
return -1;
}
write32b(out, PW_MOD_MAGIC);
/* now, the pattern data */
/* bypass the "SONG" ID */
hio_read32b(in);
/* read pattern data size */
pat_size = hio_read32b(in);
/* Sanity check */
if (pat_size <= 0 || pat_size > 0x20000)
return -1;
/* read pattern data */
tmp = (uint8 *)malloc(pat_size);
if (hio_read(tmp, 1, pat_size, in) != pat_size) {
free(tmp);
return -1;
}
/* convert shits */
for (i = 0; i < pat_size; i += 4) {
/* convert fx C arg back to hex value */
if ((tmp[i + 2] & 0x0f) == 0x0c) {
int x = tmp[i + 3];
tmp[i + 3] = 10 * (x >> 4) + (x & 0xf);
}
}
/* write pattern data */
fwrite(tmp, pat_size, 1, out);
free(tmp);
/* read/write sample data */
hio_read32b(in); /* bypass "INST" Id */
for (i = 0; i < 16; i++) {
if (smp_len[i] != 0)
pw_move_data(out, in, smp_len[i]);
}
return 0;
}
static int test_fuchs (uint8 *data, char *t, int s)
{
int i;
int ssize, hdr_ssize;
#if 0
/* test #1 */
if (i < 192) {
Test = BAD;
return;
}
start = i - 192;
#endif
if (readmem32b(data + 192) != 0x534f4e47) /* SONG */
return -1;
/* all sample size */
hdr_ssize = readmem32b(data + 10);
if (hdr_ssize <= 2 || hdr_ssize >= 65535 * 16)
return -1;
/* samples descriptions */
ssize = 0;
for (i = 0; i < 16; i++) {
uint8 *d = data + i * 2;
int len = readmem16b(d + 14);
int start = readmem16b(d + 78);
/* volumes */
if (d[46] > 0x40)
return -1;
if (len < start)
return -1;
ssize += len;
}
if (ssize <= 2 || ssize > hdr_ssize)
return -1;
/* get highest pattern number in pattern list */
/*max_pat = 0;*/
for (i = 0; i < 40; i++) {
int pat = data[i * 2 + 113];
if (pat > 40)
return -1;
/*if (pat > max_pat)
max_pat = pat;*/
}
#if 0
/* input file not long enough ? */
max_pat++;
max_pat *= 1024;
PW_REQUEST_DATA (s, k + 200);
#endif
pw_read_title(NULL, t, 0);
return 0;
}
const struct pw_format pw_fchs = {
"Fuchs Tracker",
test_fuchs,
depack_fuchs
};
|
/**
* This file is part of RagEmu.
* http://ragemu.org - https://github.com/RagEmu/Renewal
*
* Copyright (C) 2016 RagEmu Dev Team
* Copyright (C) 2012-2015 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* RagEmu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMON_MD5CALC_H
#define COMMON_MD5CALC_H
#include "common/ragemu.h"
/** @file
* md5 calculation algorithm.
*
* The source code referred to the following URL.
* http://www.geocities.co.jp/SiliconValley-Oakland/8878/lab17/lab17.html
*/
/// The md5 interface
struct md5_interface {
/**
* Hashes a string, returning the hash in string format.
*
* @param[in] string The source string (NUL terminated).
* @param[out] output Output buffer (at least 33 bytes available).
*/
void (*string) (const char *string, char *output);
/**
* Hashes a string, returning the buffer in binary format.
*
* @param[in] string The source string.
* @param[out] output Output buffer (at least 16 bytes available).
*/
void (*binary) (const uint8 *buf, const int buf_size, uint8 *output);
/**
* Generates a random salt.
*
* @param[in] len The desired salt length.
* @param[out] output The output buffer (at least len bytes available).
*/
void (*salt) (int len, char *output);
};
#ifdef RAGEMU_CORE
void md5_defaults(void);
#endif // RAGEMU_CORE
HPShared struct md5_interface *md5; ///< Pointer to the md5 interface.
#endif /* COMMON_MD5CALC_H */
|
enum MessageType
{
TYPE_CHAT_MESSAGE = 2000
};
enum PropertyType
{
PR_CHAT_NICK = 3000,
PR_CHAT_TEXT
};
|
/**************************************************************************
* Karlyriceditor - a lyrics editor and CD+G / video export for Karaoke *
* songs. *
* Copyright (C) 2009-2013 George Yunaev, [email protected] *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#ifndef BACKGROUND_H
#define BACKGROUND_H
#include <QImage>
#include "ffmpegvideodecoder.h"
class Background
{
public:
Background();
virtual ~Background();
// Actual draw function to implement. Should return time when the next
// doDraw() should be called - for example, for videos it should only
// be called when it is time to show the next frame; for static images
// it should not be called at all. If 0 is returned, doDraw() will be called
// again the next update. If -1 is returned, doDraw() will never be called
// again, and the cached image will be used.
virtual qint64 doDraw( QImage& image, qint64 timing ) = 0;
// This function is called if timing went backward (user seek back), in which
// case it will be called before doDraw() with a new time. Video players, for
// example, may use it to seek back to zero. Default implementation does nothing.
virtual void reset();
// Should return true if the event was created successfully
virtual bool isValid() const = 0;
};
class BackgroundImage : public Background
{
public:
BackgroundImage( const QString& filename );
bool isValid() const;
qint64 doDraw( QImage& image, qint64 timing );
private:
QImage m_image;
};
class BackgroundVideo : public Background
{
public:
BackgroundVideo( const QString& arg );
bool isValid() const;
qint64 doDraw( QImage& image, qint64 timing );
private:
FFMpegVideoDecoder m_videoDecoder;
bool m_valid;
};
#endif // BACKGROUND_H
|
/**
******************************************************************************
* @file I2C/I2C_TwoBoards_ComPolling/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.2.7
* @date 17-February-2017
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx_it.h"
/** @addtogroup STM32F4xx_HAL_Examples
* @{
*/
/** @addtogroup I2C_TwoBoards_ComPolling
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* I2C handler declared in "main.c" file */
extern I2C_HandleTypeDef hi2c;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
HAL_IncTick();
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
#ifndef __CLOCK_ROM_H__
#define __CLOCK_ROM_H__
#define ROM_ALARM0_DAY_MASK 0
#define ROM_ALARM0_HOUR 1
#define ROM_ALARM0_MIN 2
#define ROM_ALARM0_DUR 3
#define ROM_ALARM1_ENABLE 4
#define ROM_TIME_IS12 10
#define ROM_BEEPER_MUSIC_INDEX 11
#define ROM_BEEPER_ENABLE 12
#define ROM_POWERSAVE_TO 13
#define ROM_REMOTE_ONOFF 14
#define ROM_AUTO_LIGHT_ONOFF 15
#define ROM_FUSE_HG_ONOFF 20
#define ROM_FUSE_MPU 21
#define ROM_FUSE_THERMO_HI 22
#define ROM_FUSE_THERMO_LO 23
#define ROM_FUSE_REMOTE_ONOFF 24
#define ROM_FUSE_PASSWORD 25
// 6字节是password
#define ROM_LT_TIMER_YEAR 40
#define ROM_LT_TIMER_MONTH 41
#define ROM_LT_TIMER_DATE 42
#define ROM_LT_TIMER_HOUR 43
#define ROM_LT_TIMER_MIN 44
#define ROM_LT_TIMER_SEC 45
#define ROM_RADIO_FREQ_HI 50
#define ROM_RADIO_FREQ_LO 51
#define ROM_RADIO_VOLUME 52
#define ROM_RADIO_HLSI 53
#define ROM_RADIO_MS 54
#define ROM_RADIO_BL 55
#define ROM_RADIO_HCC 56
#define ROM_RADIO_SNC 57
#define ROM_RADIO_DTC 58
unsigned char rom_read(unsigned char addr);
void rom_write(unsigned char addr, unsigned char val);
void rom_initialize(void);
bit rom_is_factory_reset(void);
#endif
|
/*
Copyright (C) 2010 Erik Hjortsberg <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SERIALTASK_H_
#define SERIALTASK_H_
#include "TemplateNamedTask.h"
#include <vector>
namespace Ember
{
namespace Tasks
{
/**
* @author Erik Hjortsberg <[email protected]>
* @brief A task which wraps two or more other tasks, which will be executed in order.
* This is useful if you want to make sure that a certain task is executed after another task.
*/
class SerialTask: public TemplateNamedTask<SerialTask>
{
public:
typedef std::vector<ITask*> TaskStore;
/**
* @brief Ctor.
* @param subTasks The tasks to execute, in order.
*/
SerialTask(const TaskStore& subTasks);
/**
* @brief Ctor.
* This is a convenience constructor which allows you to specify the tasks directly without having to first create a vector instance.
* @param firstTask The first task to execute.
* @param secondTask The second task to execute.
* @param thirdTask The third task to execute.
* @param firstTask The fourth task to execute.
*/
SerialTask(ITask* firstTask, ITask* secondTask, ITask* thirdTask = 0, ITask* fourthTask = 0);
virtual ~SerialTask();
virtual void executeTaskInBackgroundThread(TaskExecutionContext& context);
private:
TaskStore mSubTasks;
};
}
}
#endif /* SERIALTASK_H_ */
|
/*****************************************************************/
/* Source Of Evil Engine */
/* */
/* Copyright (C) 2000-2001 Andreas Zahnleiter GreenByte Studios */
/* */
/*****************************************************************/
/* Dynamic object list */
class C4ObjectLink
{
public:
C4Object *Obj;
C4ObjectLink *Prev,*Next;
};
class C4ObjectList
{
public:
C4ObjectList();
~C4ObjectList();
public:
C4ObjectLink *First,*Last;
int Mass;
char *szEnumerated;
public:
void SortByCategory();
void Default();
void Clear();
void Sort();
void Enumerate();
void Denumerate();
void Copy(C4ObjectList &rList);
void Draw(C4FacetEx &cgo);
void DrawList(C4Facet &cgo, int iSelection=-1, DWORD dwCategory=C4D_All);
void DrawIDList(C4Facet &cgo, int iSelection, C4DefList &rDefs, DWORD dwCategory, C4RegionList *pRegions=NULL, int iRegionCom=COM_None, BOOL fDrawOneCounts=TRUE);
void DrawSelectMark(C4FacetEx &cgo);
void CloseMenus();
void UpdateFaces();
void SyncClearance();
void ResetAudibility();
void UpdateTransferZones();
void SetOCF();
void GetIDList(C4IDList &rList, DWORD dwCategory=C4D_All);
void ClearInfo(C4ObjectInfo *pInfo);
void PutSolidMasks();
void RemoveSolidMasks(BOOL fCauseInstability=TRUE);
BOOL Add(C4Object *nObj, BOOL fSorted=TRUE);
BOOL Remove(C4Object *pObj);
BOOL Save(const char *szFilename, BOOL fSaveGame);
BOOL Save(C4Group &hGroup, BOOL fSaveGame);
BOOL AssignInfo();
BOOL ValidateOwners();
BOOL WriteNameList(char *szTarget, C4DefList &rDefs, DWORD dwCategory=C4D_All);
BOOL IsClear();
BOOL ReadEnumerated(const char *szSource);
BOOL DenumerateRead();
BOOL Write(char *szTarget);
int Load(C4Group &hGroup);
int ObjectNumber(C4Object *pObj);
int ClearPointers(C4Object *pObj);
int ObjectCount(C4ID id=C4ID_None, DWORD dwCategory=C4D_All);
int MassCount();
int ListIDCount(DWORD dwCategory);
C4Object* Denumerated(C4Object *pObj);
C4Object* Enumerated(C4Object *pObj);
C4Object* ObjectPointer(int iNumber);
C4Object* GetObject(int Index=0);
C4Object* Find(C4ID id, int iOwner=ANY_OWNER);
C4Object* FindOther(C4ID id, int iOwner=ANY_OWNER);
C4ObjectLink* GetLink(C4Object *pObj);
C4ID GetListID(DWORD dwCategory, int Index);
protected:
void InsertLink(C4ObjectLink *pLink, C4ObjectLink *pAfter);
void RemoveLink(C4ObjectLink *pLnk);
};
|
#ifndef __ASSIGN_SPRITES_H
#define __ASSIGN_SPRITES_H
void AssignSprites(void);
#endif
|
/**
* @file gensvm_debug.c
* @author G.J.J. van den Burg
* @date 2016-05-01
* @brief Functions facilitating debugging
*
* @details
* Defines functions useful for debugging matrices.
*
* @copyright
Copyright 2016, G.J.J. van den Burg.
This file is part of GenSVM.
GenSVM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GenSVM 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 GenSVM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gensvm_debug.h"
/**
* @brief Print a dense matrix
*
* @details
* Debug function to print a matrix
*
* @param[in] M matrix
* @param[in] rows number of rows of M
* @param[in] cols number of columns of M
*/
void gensvm_print_matrix(double *M, long rows, long cols)
{
long i, j;
for (i=0; i<rows; i++) {
for (j=0; j<cols; j++) {
if (j > 0)
note(" ");
note("%+6.6f", matrix_get(M, cols, i, j));
}
note("\n");
}
note("\n");
}
/**
* @brief Print a sparse matrix
*
* @details
* Debug function to print a GenSparse sparse matrix
*
* @param[in] A a GenSparse matrix to print
*
*/
void gensvm_print_sparse(struct GenSparse *A)
{
long i;
// print matrix dimensions
note("Sparse Matrix:\n");
note("\tnnz = %li, rows = %li, cols = %li\n", A->nnz, A->n_row,
A->n_col);
// print nonzero values
note("\tvalues = [ ");
for (i=0; i<A->nnz; i++) {
if (i != 0) note(", ");
note("%f", A->values[i]);
}
note(" ]\n");
// print row indices
note("\tIA = [ ");
for (i=0; i<A->n_row+1; i++) {
if (i != 0) note(", ");
note("%i", A->ia[i]);
}
note(" ]\n");
// print column indices
note("\tJA = [ ");
for (i=0; i<A->nnz; i++) {
if (i != 0) note(", ");
note("%i", A->ja[i]);
}
note(" ]\n");
}
|
/* Report an error and exit.
Copyright (C) 2017-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
/* Borrowed from coreutils. */
#ifndef DIE_H
# define DIE_H
# include <error.h>
# include <stdbool.h>
# include <verify.h>
/* Like 'error (STATUS, ...)', except STATUS must be a nonzero constant.
This may pacify the compiler or help it generate better code. */
# define die(status, ...) \
verify_expr (status, (error (status, __VA_ARGS__), assume (false)))
#endif /* DIE_H */
|
/*
===========================================================================
Shadow of Dust GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Shadow of Dust GPL Source Code ("Shadow of Dust Source Code").
Shadow of Dust Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Shadow of Dust Source Code 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 Shadow of Dust Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Shadow of Dust Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Shadow of Dust Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#pragma once
// DialogAFView dialog
class DialogAFView : public CDialog {
DECLARE_DYNAMIC(DialogAFView)
public:
DialogAFView(CWnd* pParent = NULL); // standard constructor
virtual ~DialogAFView();
enum { IDD = IDD_DIALOG_AF_VIEW };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const;
afx_msg BOOL OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult );
afx_msg void OnBnClickedCheckViewBodies();
afx_msg void OnBnClickedCheckViewBodynames();
afx_msg void OnBnClickedCheckViewBodyMass();
afx_msg void OnBnClickedCheckViewTotalMass();
afx_msg void OnBnClickedCheckViewInertiatensor();
afx_msg void OnBnClickedCheckViewVelocity();
afx_msg void OnBnClickedCheckViewConstraints();
afx_msg void OnBnClickedCheckViewConstraintnames();
afx_msg void OnBnClickedCheckViewPrimaryonly();
afx_msg void OnBnClickedCheckViewLimits();
afx_msg void OnBnClickedCheckViewConstrainedBodies();
afx_msg void OnBnClickedCheckViewTrees();
afx_msg void OnBnClickedCheckMd5Skeleton();
afx_msg void OnBnClickedCheckMd5Skeletononly();
afx_msg void OnBnClickedCheckLinesDepthtest();
afx_msg void OnBnClickedCheckLinesUsearrows();
afx_msg void OnBnClickedCheckPhysicsNofriction();
afx_msg void OnBnClickedCheckPhysicsNolimits();
afx_msg void OnBnClickedCheckPhysicsNogravity();
afx_msg void OnBnClickedCheckPhysicsNoselfcollision();
afx_msg void OnBnClickedCheckPhysicsTiming();
afx_msg void OnBnClickedCheckPhysicsDragEntities();
afx_msg void OnBnClickedCheckPhysicsShowDragSelection();
DECLARE_MESSAGE_MAP()
private:
//{{AFX_DATA(DialogAFView)
BOOL m_showBodies;
BOOL m_showBodyNames;
BOOL m_showMass;
BOOL m_showTotalMass;
BOOL m_showInertia;
BOOL m_showVelocity;
BOOL m_showConstraints;
BOOL m_showConstraintNames;
BOOL m_showPrimaryOnly;
BOOL m_showLimits;
BOOL m_showConstrainedBodies;
BOOL m_showTrees;
BOOL m_showSkeleton;
BOOL m_showSkeletonOnly;
BOOL m_debugLineDepthTest;
BOOL m_debugLineUseArrows;
BOOL m_noFriction;
BOOL m_noLimits;
BOOL m_noGravity;
BOOL m_noSelfCollision;
BOOL m_showTimings;
BOOL m_dragEntity;
BOOL m_dragShowSelection;
//}}AFX_DATA
float m_gravity;
static toolTip_t toolTips[];
};
|
/*
* Copyright (C) 2007-2009 Daniel Prevost <[email protected]>
*
* This file is part of Photon (photonsoftware.org).
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 or version 3 as published by the
* Free Software Foundation and appearing in the file COPYING.GPL2 and
* COPYING.GPL3 included in the packaging of this software.
*
* Licensees holding a valid Photon Commercial license can use this file
* in accordance with the terms of their license.
*
* This software 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.
*/
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
#include "Nucleus/Hash.h"
#include "Nucleus/Tests/Hash/HashTest.h"
const bool expectedToPass = true;
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
int main()
{
psonSessionContext context;
psonHash* pHash;
enum psoErrors errcode;
char* key1 = "My Key 1";
char* key2 = "My Key 2";
char* data1 = "My Data 1";
char* data2 = "My Data 2";
psonHashItem * pHashItem;
pHash = initHashTest( expectedToPass, &context );
errcode = psonHashInit( pHash, g_memObjOffset, 100, &context );
if ( errcode != PSO_OK ) {
ERROR_EXIT( expectedToPass, &context.errorHandler, ; );
}
errcode = psonHashInsert( pHash,
(unsigned char*)key1,
strlen(key1),
data1,
strlen(data1),
&pHashItem,
&context );
if ( errcode != PSO_OK ) {
ERROR_EXIT( expectedToPass, &context.errorHandler, ; );
}
/* A duplicate - not allowed */
errcode = psonHashInsert( pHash,
(unsigned char*)key1,
strlen(key1),
data2,
strlen(data2),
&pHashItem,
&context );
if ( errcode != PSO_ITEM_ALREADY_PRESENT ) {
ERROR_EXIT( expectedToPass, NULL, ; );
}
errcode = psonHashInsert( pHash,
(unsigned char*)key2,
strlen(key2),
data1,
strlen(data1),
&pHashItem,
&context );
if ( errcode != PSO_OK ) {
ERROR_EXIT( expectedToPass, &context.errorHandler, ; );
}
return 0;
}
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
#ifndef LIGHTNET_SUBSAMPLE_MODULE_H
#define LIGHTNET_SUBSAMPLE_MODULE_H
#include "module.h"
using namespace std;
using FeatureMap = vector<vector<Neuron*>>;
FeatureMap* matrifyNeurons(vector<Neuron*>& v, int sizex, int sizey) {
FeatureMap *fmap = new FeatureMap();
fmap->resize(sizex);
int z = 0;
for(unsigned int x = 0; x < fmap->size(); x++) {
fmap->at(x).resize(sizey);
for(unsigned int y = 0; y < fmap->at(x).size(); y++) {
fmap->at(x).at(y) = v.at(z);
z++;
}
}
return fmap;
}
class SubsampleModule : public Module {
private:
int inputSize;
double lowerWeightLimit,upperWeightLimit;
int sizex, sizey, numFeatures, featureSize;
vector<FeatureMap*> featureMaps;
public:
SubsampleModule(int numFeatures, int sizex, int sizey) {
this->sizex = sizex;
this->sizey = sizey;
this->featureSize = sizex*sizey;
this->numFeatures = numFeatures;
for(int n = 0; n < featureSize*numFeatures/pow(2,2); n++) {
neurons.push_back(new Neuron(0.25, 0.25));
}
for(int f = 0; f < numFeatures; f++) {
vector<Neuron*> v(neurons.begin()+(f*floor(sizex/2.0)*floor(sizey/2.0)),neurons.begin()+((f+1)*floor(sizex/2.0)*floor(sizey/2.0)));
featureMaps.push_back(matrifyNeurons(v,floor(sizex/2.0),floor(sizey/2.0)));
}
}
void connect(Module* prev) {
int z = 0;
for(int f = 0; f < numFeatures; f++) {
vector<Neuron*> v(prev->getNeurons().begin()+(f*sizex*sizey),prev->getNeurons().begin()+((f+1)*sizex*sizey));
FeatureMap* fmap = matrifyNeurons(v,sizex,sizey);
for(int fx = 0; fx < featureMaps[f]->size(); fx++) {
for(int fy = 0; fy < featureMaps[f]->at(0).size(); fy++) {
for(int ix = fx*2; ix < fx*2 + 2; ix++) {
for(int iy = fy*2; iy < fy*2 + 2; iy++) {
//cout << f << " connecting " << fx << "," << fy << " to " << ix << "," << iy << endl;
featureMaps[f]->at(fx).at(fy)->connect(fmap->at(ix).at(iy),new Weight());
}
}
}
}
}
//cout << "size " << neurons.size() << endl;
}
void gradientDescent(double learningRate) {}
};
#endif
|
/*
Copyright (C) 2013 Edwin Velds
This file is part of Polka 2.
Polka 2 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Polka 2 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 Polka 2. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _POLKA_BITMAPCANVAS_H_
#define _POLKA_BITMAPCANVAS_H_
#include "Object.h"
#include "ObjectManager.h"
#include "icons/sketch.c"
#include <glibmm/i18n.h>
#include <cairomm/surface.h>
namespace Polka {
/*
class Palette;
class BitmapCanvas : public Polka::Object
{
public:
BitmapCanvas( int depth );
~BitmapCanvas();
enum Type { BP2, BP4, BP6, BRGB332, BRGB555 };
int width() const;
int height() const;
const Palette *getPalette( unsigned int slot = 0 ) const;
Cairo::RefPtr<Cairo::ImageSurface> getImage() const;
void setPalette( const Palette& palette, unsigned int slot = 0 );
protected:
virtual void doUpdate();
private:
Cairo::RefPtr<Cairo::ImageSurface> m_Image;
std::vector<char*> m_Data;
std::vector<const Palette *> m_Palettes;
};
class Bitmap16CanvasFactory : public ObjectManager::ObjectFactory
{
public:
BitmapCanvasFactory()
: ObjectManager::ObjectFactory( _("16 Color Canvas"),
_("Sketch canvasses"), 20,
"BMP16CANVAS", "BITMAPCANVASEDIT",
"PAL1,PAL2,PALG9K",
sketch ) {}
Object *create() const { return new BitmapCanvas( BitmapCanvas::BP4 ); }
};
*/
} // namespace Polka
#endif // _POLKA_BITMAPCANVAS_H_
|
/*
avr_libs
Copyright (C) 2014 Edward Sargsyan
avr_libs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
avr_libs 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 avr_libs. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SD_CMD_H
#define SD_SD_CMD_H
/* CMD0: response R1 */
#define SD_CMD_GO_IDLE_STATE 0x00
/* CMD1: response R1 */
#define SD_CMD_SEND_OP_COND 0x01
/* CMD8: response R7 */
#define SD_CMD_SEND_IF_COND 0x08
/* CMD9: response R1 */
#define SD_CMD_SEND_CSD 0x09
/* CMD10: response R1 */
#define SD_CMD_SEND_CID 0x0a
/* CMD12: response R1 */
#define SD_CMD_STOP_TRANSMISSION 0x0c
/* CMD13: response R2 */
#define SD_CMD_SEND_STATUS 0x0d
/* CMD16: arg0[31:0]: block length, response R1 */
#define SD_CMD_SET_BLOCKLEN 0x10
/* CMD17: arg0[31:0]: data address, response R1 */
#define SD_CMD_READ_SINGLE_BLOCK 0x11
/* CMD18: arg0[31:0]: data address, response R1 */
#define SD_CMD_READ_MULTIPLE_BLOCK 0x12
/* CMD24: arg0[31:0]: data address, response R1 */
#define SD_CMD_WRITE_SINGLE_BLOCK 0x18
/* CMD25: arg0[31:0]: data address, response R1 */
#define SD_CMD_WRITE_MULTIPLE_BLOCK 0x19
/* CMD27: response R1 */
#define SD_CMD_PROGRAM_CSD 0x1b
/* CMD28: arg0[31:0]: data address, response R1b */
#define SD_CMD_SET_WRITE_PROT 0x1c
/* CMD29: arg0[31:0]: data address, response R1b */
#define SD_CMD_CLR_WRITE_PROT 0x1d
/* CMD30: arg0[31:0]: write protect data address, response R1 */
#define SD_CMD_SEND_WRITE_PROT 0x1e
/* CMD32: arg0[31:0]: data address, response R1 */
#define SD_CMD_TAG_SECTOR_START 0x20
/* CMD33: arg0[31:0]: data address, response R1 */
#define SD_CMD_TAG_SECTOR_END 0x21
/* CMD34: arg0[31:0]: data address, response R1 */
#define SD_CMD_UNTAG_SECTOR 0x22
/* CMD35: arg0[31:0]: data address, response R1 */
#define SD_CMD_TAG_ERASE_GROUP_START 0x23
/* CMD36: arg0[31:0]: data address, response R1 */
#define SD_CMD_TAG_ERASE_GROUP_END 0x24
/* CMD37: arg0[31:0]: data address, response R1 */
#define SD_CMD_UNTAG_ERASE_GROUP 0x25
/* CMD38: arg0[31:0]: stuff bits, response R1b */
#define SD_CMD_ERASE 0x26
/* ACMD41: arg0[31:0]: OCR contents, response R1 */
#define SD_CMD_GET_OCR 0x29
/* CMD42: arg0[31:0]: stuff bits, response R1b */
#define SD_CMD_LOCK_UNLOCK 0x2a
/* CMD55: arg0[31:0]: stuff bits, response R1 */
#define SD_CMD_APP 0x37
/* CMD58: arg0[31:0]: stuff bits, response R3 */
#define SD_CMD_READ_OCR 0x3a
/* CMD59: arg0[31:1]: stuff bits, arg0[0:0]: crc option, response R1 */
#define SD_CMD_CRC_ON_OFF 0x3b
/* command responses */
/* R1: size 1 byte */
#define SD_R1_IDLE_STATE 0
#define SD_R1_ERASE_RESET 1
#define SD_R1_ILLEGAL_COMMAND 2
#define SD_R1_COM_CRC_ERR 3
#define SD_R1_ERASE_SEQ_ERR 4
#define SD_R1_ADDR_ERR 5
#define SD_R1_PARAM_ERR 6
/* R1b: equals R1, additional busy bytes */
/* R2: size 2 bytes */
#define SD_R2_CARD_LOCKED 0
#define SD_R2_WP_ERASE_SKIP 1
#define SD_R2_ERR 2
#define SD_R2_CARD_ERR 3
#define SD_R2_CARD_ECC_FAIL 4
#define SD_R2_WP_VIOLATION 5
#define SD_R2_INVAL_ERASE 6
#define SD_R2_OUT_OF_RANGE 7
#define SD_R2_CSD_OVERWRITE 7
#define SD_R2_IDLE_STATE ( SD_R1_IDLE_STATE + 8)
#define SD_R2_ERASE_RESET ( SD_R1_ERASE_RESET + 8)
#define SD_R2_ILLEGAL_COMMAND ( SD_R1_ILLEGAL_COMMAND + 8)
#define SD_R2_COM_CRC_ERR ( SD_R1_COM_CRC_ERR + 8)
#define SD_R2_ERASE_SEQ_ERR ( SD_R1_ERASE_SEQ_ERR + 8)
#define SD_R2_ADDR_ERR ( SD_R1_ADDR_ERR + 8)
#define SD_R2_PARAM_ERR ( SD_R1_PARAM_ERR + 8)
/* R3: size 5 bytes */
#define SD_R3_OCR_MASK (0xffffffffUL)
#define SD_R3_IDLE_STATE ( SD_R1_IDLE_STATE + 32)
#define SD_R3_ERASE_RESET ( SD_R1_ERASE_RESET + 32)
#define SD_R3_ILLEGAL_COMMAND ( SD_R1_ILLEGAL_COMMAND + 32)
#define SD_R3_COM_CRC_ERR ( SD_R1_COM_CRC_ERR + 32)
#define SD_R3_ERASE_SEQ_ERR ( SD_R1_ERASE_SEQ_ERR + 32)
#define SD_R3_ADDR_ERR ( SD_R1_ADDR_ERR + 32)
#define SD_R3_PARAM_ERR ( SD_R1_PARAM_ERR + 32)
/* Data Response: size 1 byte */
#define SD_DR_STATUS_MASK 0x0e
#define SD_DR_STATUS_ACCEPTED 0x05
#define SD_DR_STATUS_CRC_ERR 0x0a
#define SD_DR_STATUS_WRITE_ERR 0x0c
#endif // SD_CMD_H
|
#ifndef VIDDEF_H
#define VIDDEF_H
#include <QObject>
// FFmpeg is a pure C project, so to use the libraries within your C++ application you need
// to explicitly state that you are using a C library by using extern "C"."
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libswscale/swscale.h>
#include <libavutil/avstring.h>
#include <libavutil/time.h>
#include <libavutil/mem.h>
#include <libavutil/pixfmt.h>
}
#include <cmath>
#define MAX_VIDEOQ_SIZE (5 * 256 * 1024)
#define AV_SYNC_THRESHOLD 0.01
#define AV_NOSYNC_THRESHOLD 10.0
#define VIDEO_PICTURE_QUEUE_SIZE 1
// YUV_Overlay is similar to SDL_Overlay
// A SDL_Overlay is similar to a SDL_Surface except it stores a YUV overlay.
// Possible format:
#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */
#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V */
#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 */
#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 */
#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 */
typedef struct Overlay {
quint32 format;
int w, h;
int planes;
quint16 *pitches;
quint8 **pixels;
quint32 hw_overlay:1;
} YUV_Overlay;
typedef struct PacketQueue {
AVPacketList *first_pkt, *last_pkt;
int nb_packets;
int size;
} PacketQueue;
typedef struct VideoPicture {
YUV_Overlay *bmp;
int width, height; /* source height & width */
int allocated;
double pts;
} VideoPicture;
typedef struct VideoState {
AVFormatContext *pFormatCtx;
int videoStream;
double frame_timer;
double frame_last_pts;
double frame_last_delay;
double video_clock; ///<pts of last decoded frame / predicted pts of next decoded frame
AVStream *video_st;
PacketQueue videoq;
VideoPicture pictq[VIDEO_PICTURE_QUEUE_SIZE];
int pictq_size, pictq_rindex, pictq_windex;
int quit;
AVIOContext *io_context;
struct SwsContext *sws_ctx;
} VideoState;
#endif // VIDDEF_H
|
/**
* Copyright (C) 2008 Happy Fish / YuQing
*
* FastDFS may be copied only under the terms of the GNU General
* Public License V3, which may be found in the FastDFS source kit.
* Please visit the FastDFS Home Page http://www.csource.org/ for more detail.
**/
//tracker_nio.h
#ifndef _TRACKER_NIO_H
#define _TRACKER_NIO_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fast_task_queue.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* ÿ¸öÏ̵߳ĹܵÀpipe_fds[0]µÄREADʼþµÄ»Øµ÷º¯Êý
* ÿ´Î¶Áȡһ¸öint±äÁ¿£¬ÊÇн¨Á¢Á¬½ÓµÄsocketÃèÊö·û£¬Ö®ºó¼ÓÈëµ½IOʼþ¼¯ºÏ
* °´Í¨µÀ·Ö·¢µ½ÏàÓ¦¹¤×÷Ïß³ÌÖеȴý¿É¶Áʼþ´¥·¢ºóµ÷ÓÃclient_sock_readº¯Êý½øÐд¦Àí
*/
void recv_notify_read(int sock, short event, void *arg);
/* ½«·¢Ëͱ¨ÎĵÄʼþ¼ÓÈëµ½IOʼþ¼¯ºÏÖÐ */
int send_add_event(struct fast_task_info *pTask);
/* ÈÎÎñ½áÊøºóµÄÇåÀíº¯Êý */
void task_finish_clean_up(struct fast_task_info *pTask);
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Copyright (C) 2018 Olzhas Rakhimov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/// @file
/// Text alignment common conventions.
#pragma once
#include <Qt>
namespace scram::gui {
/// Default alignment of numerical values in tables.
const int ALIGN_NUMBER_IN_TABLE = Qt::AlignRight | Qt::AlignVCenter;
} // namespace scram::gui
|
/* File: deref.h
** Author(s): Jiyang Xu, Terrance Swift, Kostis Sagonas
** Contact: [email protected]
**
** Copyright (C) The Research Foundation of SUNY, 1986, 1993-1998
** Copyright (C) ECRC, Germany, 1990
**
** XSB 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.
**
** XSB 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 XSB; if not, write to the Free Software Foundation,
** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** $Id: deref.h,v 1.13 2010-08-19 15:03:36 spyrosh Exp $
**
*/
#ifndef __DEREF_H__
#define __DEREF_H__
/* TLS: Bao changed these derefs to handle attributed variables, since
* a reference chain can, in principle, have a chain of var pointers
* followed by a chain of attv pointers, ending in a free variable.
* Actually, the code here is somewhat more general, and allows more
* intermixture of attv and var pointers. So I may be wrong or the
* code may be a little more general than it needs to be.
*
* XSB_Deref(op) is the same as XSB_CptrDeref(op) except that
* XSB_CptrDeref(op) performs an explicit cast of op to a CPtr. */
#define XSB_Deref(op) XSB_Deref2(op,break)
/* XSB_Deref2 is changed to consider attributed variables */
#define XSB_Deref2(op, stat) { \
while (isref(op)) { \
if (op == follow(op)) \
stat; \
op = follow(op); \
} \
while (isattv(op)) { \
if (cell((CPtr) dec_addr(op)) == dec_addr(op)) \
break; /* end of an attv */ \
else { \
op = cell((CPtr) dec_addr(op)); \
while (isref(op)) { \
if (op == follow(op)) \
stat; \
op = follow(op); \
} \
} \
} \
}
#define XSB_CptrDeref(op) { \
while (isref(op)) { \
if (op == (CPtr) cell(op)) break; \
op = (CPtr) cell(op); \
} \
while (isattv(op)) { \
if (cell((CPtr) dec_addr(op)) == dec_addr(op)) \
break; \
else { \
op = (CPtr) cell((CPtr) dec_addr(op)); \
while (isref(op)) { \
if (op == (CPtr) cell(op)) break; \
op = (CPtr) cell(op); \
} \
} \
} \
}
#define printderef(op) while (isref(op) && op > 0) { \
if (op==follow(op)) \
break; \
op=follow(op); }
#endif /* __DEREF_H__ */
|
/* gbp-flatpak-runner.h
*
* Copyright 2016-2019 Christian Hergert <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <libide-foundry.h>
G_BEGIN_DECLS
#define GBP_TYPE_FLATPAK_RUNNER (gbp_flatpak_runner_get_type())
G_DECLARE_FINAL_TYPE (GbpFlatpakRunner, gbp_flatpak_runner, GBP, FLATPAK_RUNNER, IdeRunner)
GbpFlatpakRunner *gbp_flatpak_runner_new (IdeContext *context,
const gchar *build_path,
IdeBuildTarget *build_target,
const gchar *manifest_command);
G_END_DECLS
|
/*
bricks.h -- bricks module;
Copyright (C) 2015, 2016 Bruno Félix Rezende Ribeiro <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MININIM_BRICKS_H
#define MININIM_BRICKS_H
/* dungeon vga */
#define DV_BRICKS_00 "data/bricks/dv-00.png"
#define DV_BRICKS_01 "data/bricks/dv-01.png"
#define DV_BRICKS_02 "data/bricks/dv-02.png"
#define DV_BRICKS_03 "data/bricks/dv-03.png"
/* palace vga */
#define PV_BRICKS_00 "data/bricks/pv-00.png"
#define PV_BRICKS_01 "data/bricks/pv-01.png"
void load_bricks (void);
void unload_bricks (void);
void draw_bricks_00 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
void draw_bricks_01 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
void draw_bricks_02 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
void draw_bricks_03 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
#endif /* MININIM_BRICKS_H */
|
/***************************************************************************
* matrix_statistics.h:
*
* TODO: add doc
*
* Written by Anthony Lomax
* ALomax Scientific www.alomax.net
*
* modified: 2010.12.16
***************************************************************************/
#define CONFIDENCE_LEVEL 68.0 // 68% confidence level used throughout
// 2D ellipse
typedef struct {
double az1, len1; // semi-minor axis km
double len2; // semi-major axis km
} Ellipse2D;
#define DELTA_CHI_SQR_68_2 2.30 // value for 68% conf (see Num Rec, 2nd ed, sec 15.6, table)
// 3D ellipsoid
typedef struct {
double az1, dip1, len1; // semi-minor axis km
double az2, dip2, len2; // semi-intermediate axis km
double len3; // semi-major axis km
double az3, dip3; // 20150601 AJL - semi-major axis az and dip added to support conversion to QuakeML Tait-Bryan representation
} Ellipsoid3D;
#define DELTA_CHI_SQR_68_3 3.53 // value for 68% conf (see Num Rec, 2nd ed, sec 15.6, table)
char *get_matrix_statistics_error_mesage();
Vect3D CalcExpectationSamples(float*, int);
Vect3D CalcExpectationSamplesWeighted(float* fdata, int nSamples);
Vect3D CalcExpectationSamplesGlobal(float* fdata, int nSamples, double xReference);
Vect3D CalcExpectationSamplesGlobalWeighted(float* fdata, int nSamples, double xReference);
Mtrx3D CalcCovarianceSamplesRect(float* fdata, int nSamples, Vect3D* pexpect);
Mtrx3D CalcCovarianceSamplesGlobal(float* fdata, int nSamples, Vect3D* pexpect);
Mtrx3D CalcCovarianceSamplesGlobalWeighted(float* fdata, int nSamples, Vect3D* pexpect);
Ellipsoid3D CalcErrorEllipsoid(Mtrx3D *, double);
Ellipse2D CalcHorizontalErrorEllipse(Mtrx3D *pcov, double del_chi_2);
void ellipsiod2Axes(Ellipsoid3D *, Vect3D *, Vect3D *, Vect3D *);
void nllEllipsiod2XMLConfidenceEllipsoid(Ellipsoid3D *pellipsoid,
double* psemiMajorAxisLength, double* pmajorAxisPlunge, double* pmajorAxisAzimuth,
double* psemiIntermediateAxisLength, double* pintermediateAxisPlunge, double* pintermediateAxisAzimuth,
double* psemiMinorAxisLength);
int nllEllipsiod2QMLConfidenceEllipsoid(Ellipsoid3D *pellipsoid,
double* psemiMajorAxisLength,
double* psemiMinorAxisLength,
double* psemiIntermediateAxisLength,
double* pmajorAxisAzimuth,
double* pmajorAxisPlunge,
double* pmajorAxisRotation);
|
/*
-----------------------------------------------------------------------------------------------
This source file is part of the Particle Universe product.
Copyright (c) 2010 Henry van Merode
Usage of this program is licensed under the terms of the Particle Universe Commercial License.
You can find a copy of the Commercial License in the Particle Universe package.
-----------------------------------------------------------------------------------------------
*/
#ifndef __PU_LOGMANAGER_H__
#define __PU_LOGMANAGER_H__
#include "OgreLogManager.h"
namespace ParticleUniverse
{
// If the Ogre renderer is replaced by another renderer, the type below must be re-implemented.
typedef Ogre::LogManager LogManager;
}
#endif
|
/*
* LazyListView
* Copyright (C) 2015 Romeo Calota <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAZYLISTVIEW_H
#define LAZYLISTVIEW_H
#include <QQuickItem>
#include <QQmlComponent>
#include <QScopedPointer>
#include <QSharedPointer>
class QQuickFlickable;
class ItemPool;
class LazyListView : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(int orientation READ getOrientation WRITE setOrientation NOTIFY orientationChanged)
Q_PROPERTY(QQmlComponent * delegate READ getDelegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(QObject * model READ getModel WRITE setModel NOTIFY modelChanged)
public:
LazyListView();
~LazyListView();
public:
int getOrientation() const;
void setOrientation(int orientation);
QQmlComponent * getDelegate() const;
void setDelegate(QQmlComponent *delegate);
QObject *getModel() const;
void setModel(QObject *model);
signals:
void orientationChanged();
void delegateChanged();
void modelChanged();
private:
void createListItems(QQmlComponent *component);
void rearangeListItems();
private:
QScopedPointer<QQuickFlickable> m_flickable;
int m_cacheSize;
QScopedPointer<ItemPool> m_itemPool;
QObject *m_model; // This limits model types... can't be an int for instance
QList<QQuickItem *> m_visibleItems; // Maybe as a LinkedList this would be more efficient?
QQmlComponent *m_delegate;
};
#endif // LAZYLISTVIEW_H
|
//==========================================================================
//
// include/sys/ioctl.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
/* $OpenBSD: ioctl.h,v 1.3 1996/03/03 12:11:50 niklas Exp $ */
/* $NetBSD: ioctl.h,v 1.20 1996/01/30 18:21:47 thorpej Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ioctl.h 8.6 (Berkeley) 3/28/94
*/
#ifndef _SYS_IOCTL_H_
#define _SYS_IOCTL_H_
#ifndef __ECOS
#include <sys/ttycom.h>
/*
* Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ
* and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
* nonwithstanding).
*/
struct ttysize {
unsigned short ts_lines;
unsigned short ts_cols;
unsigned short ts_xxx;
unsigned short ts_yyy;
};
#define TIOCGSIZE TIOCGWINSZ
#define TIOCSSIZE TIOCSWINSZ
#endif
#include <sys/ioccom.h>
#ifndef __ECOS
#include <sys/dkio.h>
#include <sys/filio.h>
#endif
#include <sys/sockio.h>
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
int ioctl __P((int, unsigned long, ...));
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_SYS_IOCTL_H_ */
/*
* Keep outside _SYS_IOCTL_H_
* Compatability with old terminal driver
*
* Source level -> #define USE_OLD_TTY
* Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
*/
#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD)
#include <sys/ioctl_compat.h>
#endif
|
// Sound file format definition -- A. Amiruddin -- 25/12/2016
// REVISION HISTORY
// None
//=================================================================================================
// Copyright (C) 2016 Afeeq Amiruddin
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=================================================================================================
#ifndef RIKA_VOICEPACK_FORMAT_H_INCLUDED
#define RIKA_VOICEPACK_FORMAT_H_INCLUDED
//*************************************************************************************************
// Change this according to your sound file's format
const char* pszSoundFileFormat = ".wav";
//*************************************************************************************************
#endif // RIKA_VOICEPACK_FORMAT_H_INCLUDED
|
#include "config.h"
#include "hardware.h"
#include "data.h"
#include "instruction.h"
#include "rung.h"
#include "plclib.h"
#include "project.h"
int project_task(plc_t p)
{ //
/**************start editing here***************************/
BYTE one, two, three;
one = resolve(p, BOOL_DI, 1);
two = fe(p, BOOL_DI, 2);
three = re(p, BOOL_DI, 3);
/* contact(p,BOOL_DQ,1,one);
contact(p,BOOL_DQ,2,two);
contact(p,BOOL_DQ,3,three); */
if (one)
set(p, BOOL_TIMER, 0);
if (three)
reset(p, BOOL_TIMER, 0);
if (two)
down_timer(p, 0);
return 0;
/***************end of editable portion***********************/
}
int project_init()
{
/*********************same here******************************/
return 0;
}
|
#include<stdio.h>
#include<big_integer.h>
#include<string.h>
#include<time.h>
#include"gen_lib.h"
int main(int argc,char** argv)
{
if(argc<3)
{
printf("usage %s <length> <num> \n",argv[0]);
exit(-1);
}
FILE* bash=fopen("bash.dat","w+");
FILE* python=fopen("py.dat","w+");
int length=atoi(argv[1]);
int num=atoi(argv[2]);
srand(time(NULL));
set_exe_name("");
gen_cmp(bash,python,length,num);
fwrite("\nquit\n",1,strlen("\nquit"),bash);
fclose(bash);
fclose(python);
return 0;
}
|
/* Zik2ctl
* Copyright (C) 2015 Aurélien Zanelli <[email protected]>
*
* Zik2ctl is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zik2ctl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Zik2ctl. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ZIK_API_H
#define ZIK_API_H
/* Audio */
#define ZIK_API_AUDIO_EQUALIZER_ENABLED_PATH "/api/audio/equalizer/enabled"
#define ZIK_API_AUDIO_NOISE_PATH "/api/audio/noise"
#define ZIK_API_AUDIO_NOISE_CONTROL_PATH "/api/audio/noise_control"
#define ZIK_API_AUDIO_NOISE_CONTROL_ENABLED_PATH "/api/audio/noise_control/enabled"
#define ZIK_API_AUDIO_NOISE_CONTROL_AUTO_NC_PATH "/api/audio/noise_control/auto_nc"
#define ZIK_API_AUDIO_NOISE_CONTROL_PHONE_MODE_PATH "/api/audio/noise_control/phone_mode"
#define ZIK_API_AUDIO_PRESET_BYPASS_PATH "/api/audio/preset/bypass"
#define ZIK_API_AUDIO_PRESET_CURRENT_PATH "/api/audio/preset/current"
#define ZIK_API_AUDIO_SMART_AUDIO_TUNE_PATH "/api/audio/smart_audio_tune"
#define ZIK_API_AUDIO_SOUND_EFFECT_PATH "/api/audio/sound_effect"
#define ZIK_API_AUDIO_SOUND_EFFECT_ENABLED_PATH "/api/audio/sound_effect/enabled"
#define ZIK_API_AUDIO_SOUND_EFFECT_ROOM_SIZE_PATH "/api/audio/sound_effect/room_size"
#define ZIK_API_AUDIO_SOUND_EFFECT_ANGLE_PATH "/api/audio/sound_effect/angle"
#define ZIK_API_AUDIO_SOURCE_PATH "/api/audio/source"
#define ZIK_API_AUDIO_THUMB_EQUALIZER_VALUE_PATH "/api/audio/thumb_equalizer/value"
#define ZIK_API_AUDIO_TRACK_METADATA_PATH "/api/audio/track/metadata"
#define ZIK_API_AUDIO_VOLUME_PATH "/api/audio/volume"
/* Bluetooth */
#define ZIK_API_BLUETOOTH_FRIENDLY_NAME_PATH "/api/bluetooth/friendlyname"
/* Software */
#define ZIK_API_SOFTWARE_VERSION_PATH "/api/software/version"
#define ZIK_API_SOFTWARE_TTS_PATH "/api/software/tts"
/* System */
#define ZIK_API_SYSTEM_ANC_PHONE_MODE_ENABLED_PATH "/api/system/anc_phone_mode/enabled"
#define ZIK_API_SYSTEM_AUTO_CONNECTION_ENABLED_PATH "/api/system/auto_connection/enabled"
#define ZIK_API_SYSTEM_BATTERY_PATH "/api/system/battery"
#define ZIK_API_SYSTEM_BATTERY_FORECAST_PATH "/api/system/battery/forecast"
#define ZIK_API_SYSTEM_COLOR_PATH "/api/system/color"
#define ZIK_API_SYSTEM_DEVICE_TYPE_PATH "/api/system/device_type"
#define ZIK_API_SYSTEM_FLIGHT_MODE_PATH "/api/flight_mode"
#define ZIK_API_SYSTEM_HEAD_DETECTION_ENABLED_PATH "/api/system/head_detection/enabled"
#define ZIK_API_SYSTEM_PI_PATH "/api/system/pi"
#define ZIK_API_SYSTEM_AUTO_POWER_OFF_PATH "/api/system/auto_power_off"
/* Other */
#define ZIK_API_FLIGHT_MODE_PATH "/api/flight_mode"
#endif
|
//
// AppDelegate.h
// Pedigree
//
// Created by user on 12.09.13.
// Copyright (c) 2013 user. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* $Revision: 2299 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $
***************************************************************/
/** \file
* \brief Declaration of class SplitHeuristic.
*
* \author Andrea Wagner
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* Copyright (C). All rights reserved.
* See README.txt in the root directory of the OGDF installation for details.
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* 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.
*
* \par
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* \see http://www.gnu.org/copyleft/gpl.html
***************************************************************/
#ifdef _MSC_VER
#pragma once
#endif
#ifndef OGDF_SPLIT_HEURISTIC_H
#define OGDF_SPLIT_HEURISTIC_H
#include <ogdf/basic/EdgeArray.h>
#include <ogdf/layered/CrossingsMatrix.h>
#include <ogdf/simultaneous/TwoLayerCrossMinSimDraw.h>
namespace ogdf {
//! The split heuristic for 2-layer crossing minimization.
class OGDF_EXPORT SplitHeuristic : public TwoLayerCrossMinSimDraw
{
public:
//! Initializes crossing minimization for hierarchy \a H.
void init (const Hierarchy &H);
//! Calls the split heuristic for level \a L.
void call (Level &L);
//! Calls the median heuristic for level \a L (simultaneous drawing).
void call (Level &L, const EdgeArray<unsigned int> *edgeSubGraph);
//! Does some clean-up after calls.
void cleanup ();
private:
CrossingsMatrix *m_cm;
Array<node> buffer;
void recCall(Level&, int low, int high);
};
}// end namespace ogdf
#endif
|
/*
Simple DirectMedia Layer
Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_clipboard.h
*
* Include file for SDL clipboard handling
*/
#ifndef _SDL_clipboard_h
#define _SDL_clipboard_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Function prototypes */
/**
* \brief Put UTF-8 text into the clipboard
*
* \sa SDL_GetClipboardText()
*/
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
/**
* \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
*
* \sa SDL_SetClipboardText()
*/
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
/**
* \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
*
* \sa SDL_GetClipboardText()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_clipboard_h */
/* vi: set ts=4 sw=4 expandtab: */
|
/*
* Copyright (C) 2015 Bailey Forrest <[email protected]>
*
* This file is part of CCC.
*
* CCC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CCC 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 CCC. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Interface for compliation manager
*/
#ifndef _MANAGER_H_
#define _MANAGER_H_
#include "ast/ast.h"
#include "ir/ir.h"
#include "lex/lex.h"
#include "lex/symtab.h"
#include "util/status.h"
/**
* Compilation manager structure. Manages data structures necessary for compiles
*/
typedef struct manager_t {
vec_t tokens;
symtab_t symtab;
lexer_t lexer;
token_man_t token_man;
fmark_man_t mark_man;
trans_unit_t *ast;
ir_trans_unit_t *ir;
bool parse_destroyed;
} manager_t;
/**
* Initialize a compilation mananger
*
* @param manager The compilation mananger to initialize
*/
void man_init(manager_t *manager);
/**
* Destroy a compilation mananger
*
* @param manager The compilation mananger to destroy
*/
void man_destroy(manager_t *manager);
/**
* Destroy a compilation mananger parsing data structures
*
* Calling this is optional because destructor destroys these. May be used to
* reduce memory usage however.
*
* @param manager The compilation mananger to destroy ast
*/
void man_destroy_parse(manager_t *manager);
/**
* Destroy a compilation mananger's ir
*
* Calling this is optional because destructor destroys ir. May be used to
* reduce memory usage however.
*
* @param manager The compilation mananger to destroy ir
*/
void man_destroy_ir(manager_t *manager);
status_t man_lex(manager_t *manager, char *filepath);
/**
* Parse a translation unit from a compilation manager.
*
* The manager's preprocessor must be set up first
*
* @param manager The compilation mananger to parse
* @param filepath Path to file to parse
* @param ast The parsed ast
* @return CCC_OK on success, error code on error.
*/
status_t man_parse(manager_t *manager, trans_unit_t **ast);
/**
* Parse an expression from a compilation manager.
*
* The manager's preprocessor must be set up first
*
* @param manager The compilation mananger to parse
* @param expr The parsed expression
* @return CCC_OK on success, error code on error.
*/
status_t man_parse_expr(manager_t *manager, expr_t **expr);
/**
* Translate the ast in a manager
*
* The manager must have a vaild ast from man_parse
*
* @param manager The compilation mananger to use
* @return Returns the ir tree
*/
ir_trans_unit_t *man_translate(manager_t *manager);
/**
* Print the tokens from a compilation manager
*
* The manager's preprocessor must be set up first
*
* @param manager The compilation mananger to use
* @return CCC_OK on success, error code on error.
*/
status_t man_dump_tokens(manager_t *manager);
#endif /* _MANAGER_H_ */
|
/*
Copyright (C) 2012 Statoil ASA, Norway.
The file 'config_content_node.h' is part of ERT - Ensemble based Reservoir Tool.
ERT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __CONFIG_CONTENT_NODE_H__
#define __CONFIG_CONTENT_NODE_H__
#ifdef __cplusplus
define extern "C" {
#endif
#include <ert/util/hash.h>
#include <ert/config/config_schema_item.h>
#include <ert/config/config_path_elm.h>
typedef struct config_content_node_struct config_content_node_type;
config_content_node_type * config_content_node_alloc( const config_schema_item_type * schema , const config_path_elm_type * cwd);
void config_content_node_add_value(config_content_node_type * node , const char * value);
void config_content_node_set(config_content_node_type * node , const stringlist_type * token_list);
char * config_content_node_alloc_joined_string(const config_content_node_type * node, const char * sep);
void config_content_node_free(config_content_node_type * node);
void config_content_node_free__(void * arg);
const char * config_content_node_get_full_string( config_content_node_type * node , const char * sep );
const char * config_content_node_iget(const config_content_node_type * node , int index);
bool config_content_node_iget_as_bool(const config_content_node_type * node , int index);
int config_content_node_iget_as_int(const config_content_node_type * node , int index);
double config_content_node_iget_as_double(const config_content_node_type * node , int index);
const char * config_content_node_iget_as_path(config_content_node_type * node , int index);
const char * config_content_node_iget_as_abspath( config_content_node_type * node , int index);
const char * config_content_node_iget_as_relpath( config_content_node_type * node , int index);
const stringlist_type * config_content_node_get_stringlist( const config_content_node_type * node );
const char * config_content_node_safe_iget(const config_content_node_type * node , int index);
int config_content_node_get_size( const config_content_node_type * node );
const char * config_content_node_get_kw( const config_content_node_type * node );
void config_content_node_assert_key_value( const config_content_node_type * node );
const config_path_elm_type * config_content_node_get_path_elm( const config_content_node_type * node );
void config_content_node_init_opt_hash( const config_content_node_type * node , hash_type * opt_hash , int elm_offset);
void config_content_node_fprintf( const config_content_node_type * node , FILE * stream );
#ifdef __cplusplus
}
#endif
#endif
|
/*
* File: Queue.h
* Author: Sileno Brito
*
* Created on 2 de Setembro de 2013, 11:27
*/
#ifndef QUEUE_H
#define QUEUE_H
#include <ext/struct/Node.h>
#include <ext/struct/List.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct list queue;
struct EngineQueue {
queue * (*createEmpty)(int(*cmp)(void *a, void *b), char *(*toString)(void *a), void (*destroy)(void *a));
int (*add)(queue *list, void *data);
int (*edit)(queue *list, void *oldElement, void *newElement);
int (*del)(queue *list);
void (*walk)(queue *list, void (*fnct)(void *data, void *extra), void *extra);
void * (*search)(queue *list, void *data);
char * (*toString)(queue *list);
void ** (*toArray)(queue *list, int * count);
void (*fromArray)(queue *list, void **, int count);
void (*destroy)(queue *list);
} Queue;
void initQueue();
#ifdef __cplusplus
}
#endif
#endif /* QUEUE_H */
|
/*
*
* Mouse driver
*
*/
#include <kernel/system.h>
#include <kernel/logging.h>
#include <kernel/pipe.h>
#include <kernel/module.h>
#include <kernel/mouse.h>
#include <kernel/args.h>
static uint8_t mouse_cycle = 0;
static uint8_t mouse_byte[4];
#define PACKETS_IN_PIPE 1024
#define DISCARD_POINT 32
#define MOUSE_IRQ 12
#define MOUSE_PORT 0x60
#define MOUSE_STATUS 0x64
#define MOUSE_ABIT 0x02
#define MOUSE_BBIT 0x01
#define MOUSE_WRITE 0xD4
#define MOUSE_F_BIT 0x20
#define MOUSE_V_BIT 0x08
#define MOUSE_DEFAULT 0
#define MOUSE_SCROLLWHEEL 1
#define MOUSE_BUTTONS 2
static int8_t mouse_mode = MOUSE_DEFAULT;
static fs_node_t * mouse_pipe;
void (*ps2_mouse_alternate)(void) = NULL;
static void mouse_wait(uint8_t a_type) {
uint32_t timeout = 100000;
if (!a_type) {
while (--timeout) {
if ((inportb(MOUSE_STATUS) & MOUSE_BBIT) == 1) {
return;
}
}
debug_print(INFO, "mouse timeout");
return;
} else {
while (--timeout) {
if (!((inportb(MOUSE_STATUS) & MOUSE_ABIT))) {
return;
}
}
debug_print(INFO, "mouse timeout");
return;
}
}
static void mouse_write(uint8_t write) {
mouse_wait(1);
outportb(MOUSE_STATUS, MOUSE_WRITE);
mouse_wait(1);
outportb(MOUSE_PORT, write);
}
static uint8_t mouse_read(void) {
mouse_wait(0);
char t = inportb(MOUSE_PORT);
return t;
}
static int mouse_handler(struct regs *r) {
uint8_t status = inportb(MOUSE_STATUS);
while ((status & MOUSE_BBIT) && (status & MOUSE_F_BIT)) {
if (ps2_mouse_alternate) {
ps2_mouse_alternate();
break;
}
int8_t mouse_in = inportb(MOUSE_PORT);
switch (mouse_cycle) {
case 0:
mouse_byte[0] = mouse_in;
if (!(mouse_in & MOUSE_V_BIT)) break;
++mouse_cycle;
break;
case 1:
mouse_byte[1] = mouse_in;
++mouse_cycle;
break;
case 2:
mouse_byte[2] = mouse_in;
if (mouse_mode == MOUSE_SCROLLWHEEL || mouse_mode == MOUSE_BUTTONS) {
++mouse_cycle;
break;
}
goto finish_packet;
case 3:
mouse_byte[3] = mouse_in;
goto finish_packet;
}
goto read_next;
finish_packet:
mouse_cycle = 0;
/* We now have a full mouse packet ready to use */
mouse_device_packet_t packet;
packet.magic = MOUSE_MAGIC;
int x = mouse_byte[1];
int y = mouse_byte[2];
if (x && mouse_byte[0] & (1 << 4)) {
/* Sign bit */
x = x - 0x100;
}
if (y && mouse_byte[0] & (1 << 5)) {
/* Sign bit */
y = y - 0x100;
}
if (mouse_byte[0] & (1 << 6) || mouse_byte[0] & (1 << 7)) {
/* Overflow */
x = 0;
y = 0;
}
packet.x_difference = x;
packet.y_difference = y;
packet.buttons = 0;
if (mouse_byte[0] & 0x01) {
packet.buttons |= LEFT_CLICK;
}
if (mouse_byte[0] & 0x02) {
packet.buttons |= RIGHT_CLICK;
}
if (mouse_byte[0] & 0x04) {
packet.buttons |= MIDDLE_CLICK;
}
if (mouse_mode == MOUSE_SCROLLWHEEL && mouse_byte[3]) {
if ((int8_t)mouse_byte[3] > 0) {
packet.buttons |= MOUSE_SCROLL_DOWN;
} else if ((int8_t)mouse_byte[3] < 0) {
packet.buttons |= MOUSE_SCROLL_UP;
}
}
mouse_device_packet_t bitbucket;
while (pipe_size(mouse_pipe) > (int)(DISCARD_POINT * sizeof(packet))) {
read_fs(mouse_pipe, 0, sizeof(packet), (uint8_t *)&bitbucket);
}
write_fs(mouse_pipe, 0, sizeof(packet), (uint8_t *)&packet);
read_next:
break;
}
irq_ack(MOUSE_IRQ);
return 1;
}
static int ioctl_mouse(fs_node_t * node, int request, void * argp) {
if (request == 1) {
mouse_cycle = 0;
return 0;
}
return -1;
}
static int mouse_install(void) {
debug_print(NOTICE, "Initializing PS/2 mouse interface");
uint8_t status, result;
IRQ_OFF;
while ((inportb(0x64) & 1)) {
inportb(0x60);
}
mouse_pipe = make_pipe(sizeof(mouse_device_packet_t) * PACKETS_IN_PIPE);
mouse_wait(1);
outportb(MOUSE_STATUS, 0xA8);
mouse_read();
mouse_wait(1);
outportb(MOUSE_STATUS, 0x20);
mouse_wait(0);
status = inportb(0x60) | 3;
mouse_wait(1);
outportb(MOUSE_STATUS, 0x60);
mouse_wait(1);
outportb(MOUSE_PORT, status);
mouse_write(0xF6);
mouse_read();
mouse_write(0xF4);
mouse_read();
/* Try to enable scroll wheel (but not buttons) */
if (!args_present("nomousescroll")) {
mouse_write(0xF2);
mouse_read();
result = mouse_read();
mouse_write(0xF3);
mouse_read();
mouse_write(200);
mouse_read();
mouse_write(0xF3);
mouse_read();
mouse_write(100);
mouse_read();
mouse_write(0xF3);
mouse_read();
mouse_write(80);
mouse_read();
mouse_write(0xF2);
mouse_read();
result = mouse_read();
if (result == 3) {
mouse_mode = MOUSE_SCROLLWHEEL;
}
}
/* keyboard scancode set */
mouse_wait(1);
outportb(MOUSE_PORT, 0xF0);
mouse_wait(1);
outportb(MOUSE_PORT, 0x02);
mouse_wait(1);
mouse_read();
irq_install_handler(MOUSE_IRQ, mouse_handler, "ps2 mouse");
IRQ_RES;
uint8_t tmp = inportb(0x61);
outportb(0x61, tmp | 0x80);
outportb(0x61, tmp & 0x7F);
inportb(MOUSE_PORT);
while ((inportb(0x64) & 1)) {
inportb(0x60);
}
mouse_pipe->flags = FS_CHARDEVICE;
mouse_pipe->ioctl = ioctl_mouse;
vfs_mount("/dev/mouse", mouse_pipe);
return 0;
}
static int mouse_uninstall(void) {
/* TODO */
return 0;
}
MODULE_DEF(ps2mouse, mouse_install, mouse_uninstall);
|
/* Project 16 Source Code~
* Copyright (C) 2012-2021 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
*
* This file is part of Project 16.
*
* Project 16 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Project 16 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>, or
* write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef __16_SPRI__
#define __16_SPRI__
//#include "src/lib/16_vrs.h"
#include "src/lib/16_vl.h"
//#include <hw/cpu/cpu.h>
//#include <hw/dos/dos.h>
#include <hw/vga/vrl.h>
#include "src/lib/16_ca.h"
#include "src/lib/scroll16.h"
/*
struct vrs_container{
// Size of a .vrs lob in memory
// minus header
dword data_size;
union{
byte far *buffer;
struct vrs_header far *vrs_hdr;
};
// Array of corresponding vrl line offsets
vrl1_vgax_offset_t **vrl_line_offsets;
};
*//*
struct vrl_container{
// Size of a .vrl blob in memory
// minus header
dword data_size;
union{
byte far *buffer;
struct vrl1_vgax_header far *vrl_header;
};
// Pointer to a corresponding vrl line offsets struct
vrl1_vgax_offset_t *line_offsets;
};
*/
/* Read .vrs file into memory
* In:
* + char *filename - name of the file to load
* + struct vrs_container *vrs_cont - pointer to the vrs_container
* to load the file into
* Out:
* + int - 0 on succes, 1 on failure
*/
void VRS_ReadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar);
void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar);
void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar);
void VRS_ReadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar);
void VRS_LoadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar);
void VRS_OpenVRL(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar);
/* Seek and return a specified .vrl blob from .vrs blob in memory
* In:
* + struct vrs_container *vrs_cont - pointer to the vrs_container
* with a loaded .vrs file
* + uint16_t id - id of the vrl to retrive
* + struct vrl_container * vrl_cont - pointer to vrl_container to load to
* Out:
* int - operation status
* to the requested .vrl blob
*/
int get_vrl_by_id(struct vrs_container far *vrs_cont, uint16_t id, struct vrl_container *vrl_cont);
void DrawVRL (unsigned int x,unsigned int y,struct vrl1_vgax_header *hdr,vrl1_vgax_offset_t *lineoffs/*array hdr->width long*/,unsigned char *data,unsigned int datasz);
//moved to 16_tdef.h
// struct sprite
// {
// // VRS container from which we will extract animation and image data
// struct vrs_container *spritesheet;
// // Container for a vrl sprite
// struct vrl_container *sprite_vrl_cont;
// // Current sprite id
// int curr_spri_id;
// // Index of a current sprite in an animation sequence
// int curr_anim_spri;
// // Current animation sequence
// struct vrs_animation_list_entry_t *curr_anim_list;
// // Index of current animation in relevant VRS offsets table
// int curr_anim;
// // Delay in time units untill we should change sprite
// int delay;
// // Position of sprite on screen
// int x, y;
// };
/* Retrive current animation name of sprite
* In:
* + struct sprite *spri - sprite to retrive current animation sequence name from
* Out:
* + char* - animation sequence name
*/
char* get_curr_anim_name(struct sprite *spri);
/* Change sprite's current animation to the one given by id
* In:
* struct sprite *spri - sprite to manipulate on
* int id - id of a new animation sequence of th sprite
* Out:
* int - 0 on success, -1 on error
*/
int set_anim_by_id(struct sprite *spri, int anim_id);
/* Animate sprite, triggering any events and changing indices if necessary
* NB: if you want to change animation sequence after a specific sprite is shown, you should call animate_spri first
* In:
* + struct sprite *spri - sprite to animate
*/
void animate_spri(entity_t *enti, video_t *video);
void print_anim_ids(struct sprite *spri);
#endif
|
#include "defs.h"
#include "fdefs.h"
#include <stdlib.h>
void
gasify(job)
char *job;
{
char command[MAXCOMM] ;
char g_type[MAXCOMM] ;
double temp_y ;
double temp_slope ;
double rho_shock ;
double temp_shock ;
double gas_frac ;
double rhobar ;
double metal ;
double rho ;
int i,j ;
int old_nsph ;
struct dark_particle *dp ;
/* Gas particles are created from dark matter particles.
* Masses are gas_frac * masses of dm particles
* dm particle masses are multiplied by (1-gas_frac).
* Temperatures are set to t=temp_y*(rho/rhobar)^temp_slope,
* or to t=temp_shock if rho/rhobar>rho_shock.
*/
if (!boxes_loaded[0]){
printf("<sorry, no boxes are loaded, %s>\n",title) ;
}
else {
if (sscanf(job,"%s %lf %lf %lf %lf %lf %lf %lf %s",command,&gas_frac,
&rhobar,&temp_y,&temp_slope,&rho_shock,&temp_shock,
&metal,g_type) == 8) {
calc_density(&box0_smx, 1, 0, 0);
header.nbodies += boxlist[0].ndark ;
old_nsph = header.nsph ;
header.nsph += boxlist[0].ndark ;
if(header.nsph != 0) {
gas_particles = (struct gas_particle *) realloc(gas_particles,
header.nsph*sizeof(*gas_particles));
if(gas_particles == NULL) {
printf("<sorry, no memory for gas particles, %s>\n",title) ;
return ;
}
mark_gas = (short *)realloc(mark_gas,header.nsph*sizeof(*mark_gas));
if(mark_gas == NULL) {
printf("<sorry, no memory for gas particle markers, %s>\n",
title) ;
return ;
}
for (i = old_nsph; i < header.nsph; i++) mark_gas[i] = 0;
}
else
gas_particles = NULL;
for (i = 0 ;i < boxlist[0].ndark ;i++) {
dp = boxlist[0].dp[i] ;
gas_particles[i+old_nsph].mass = gas_frac*(dp->mass) ;
dp->mass = (1. - gas_frac)*(dp->mass) ;
for(j = 0; j < header.ndim; j++){
gas_particles[i+old_nsph].pos[j] = dp->pos[j] ;
gas_particles[i+old_nsph].vel[j] = dp->vel[j] ;
}
gas_particles[i+old_nsph].rho =
gas_frac*(box0_smx->kd->p[i].fDensity);
gas_particles[i+old_nsph].temp = temp_y*
pow((gas_particles[i+old_nsph].rho/rhobar),temp_slope) ;
if (gas_particles[i+old_nsph].rho > rhobar*rho_shock) {
gas_particles[i+old_nsph].temp = temp_shock ;
}
gas_particles[i+old_nsph].hsmooth =
sqrt(box0_smx->kd->p[i].fBall2)/2.0;
gas_particles[i+old_nsph].metals = metal ;
gas_particles[i+old_nsph].phi = dp->phi ;
}
if(box0_smx) {
kdFinish(box0_smx->kd);
smFinish(box0_smx);
box0_smx = NULL;
}
boxes_loaded[0] = NO ;
unload_all() ;
active_box = 0 ;
binary_loaded = LOADED ;
current_project = NO ;
current_color = NO ;
divv_loaded = NO ;
hneutral_loaded = NO ;
meanmwt_loaded = NO ;
xray_loaded = NO ;
dudt_loaded = NO ;
starform_loaded = NO ;
}
else if (sscanf(job,"%s %lf %lf %lf %lf %lf %lf %lf %s",command,
&gas_frac,&rhobar,&temp_y,&temp_slope,&rho_shock,
&temp_shock,&metal,g_type) == 9) {
if (strcmp(g_type,"destroy") != 0 && strcmp(g_type,"d") != 0){
printf("<sorry, %s is not a gasify type, %s",g_type,title) ;
return;
}
calc_density(&box0_smx, 1, 0, 0);
printf("<warning, destroying original dark and gas particles, %s>\n",
title) ;
header.nbodies -= header.nsph ;
header.nsph = boxlist[0].ndark ;
header.ndark = 0 ;
if(header.nsph != 0) {
dark_particles = (struct dark_particle *) realloc(dark_particles,
header.nsph*sizeof(*gas_particles));
if(dark_particles == NULL) {
printf("<sorry, no memory for gas particles, %s>\n",title) ;
return ;
}
gas_particles = (struct gas_particle *)dark_particles ;
free(mark_dark) ;
if(header.nsph != 0)
mark_gas = (short *)calloc(header.nsph, sizeof(*mark_gas));
if(mark_gas == NULL && header.nsph != 0) {
printf("<sorry, no memory for gas particle markers, %s>\n",
title) ;
return ;
}
for (i = 0; i < header.nsph; i++) mark_gas[i] = 0;
}
else
gas_particles = NULL;
for (i = boxlist[0].ndark - 1 ;i >= 0 ;i--) {
dp = boxlist[0].dp[i] ;
gas_particles[i].phi = dp->phi ;
gas_particles[i].metals = metal ;
gas_particles[i].hsmooth = sqrt(box0_smx->kd->p[i].fBall2)/2.0;
rho = gas_frac*(box0_smx->kd->p[i].fDensity);
gas_particles[i].temp = temp_y*pow((rho/rhobar),temp_slope) ;
if (rho > rhobar*rho_shock) {
gas_particles[i].temp = temp_shock ;
}
gas_particles[i].rho = rho ;
for(j = header.ndim - 1; j >= 0; j--){
gas_particles[i+old_nsph].vel[j] = dp->vel[j] ;
}
for(j = header.ndim - 1; j >= 0; j--){
gas_particles[i+old_nsph].pos[j] = dp->pos[j] ;
}
gas_particles[i].mass = gas_frac*(dp->mass) ;
}
if(box0_smx) {
kdFinish(box0_smx->kd);
smFinish(box0_smx);
box0_smx = NULL;
}
dark_particles = NULL;
boxes_loaded[0] = NO ;
unload_all() ;
active_box = 0 ;
binary_loaded = LOADED ;
current_project = NO ;
current_color = NO ;
divv_loaded = NO ;
hneutral_loaded = NO ;
meanmwt_loaded = NO ;
xray_loaded = NO ;
starform_loaded = NO ;
dudt_loaded = NO ;
}
else {
input_error(command) ;
}
}
}
|
/*Hoi André,
Na iets meer gedachten hierover zou ik de interface een tikkeltje willen aanpassen, om iets meer aan te sluiten bij de DPPP-filosofie. Ik ben het aan het implementeren, kan zijn dat het niet afkomt tijdens de vlucht. Ik stuur m'n idee nu vast zodat jij niet onnodig werk zit te doen.
Stel dat jouw klasse DDESolver heet, dan zou de constructor de parset mee krijgen:*/
class MultiDirSolver {
public:
MultiDirSolver(const Parset& parset, HDF5bestand*);
init(size_t nants, size_t ndir, size_t nchan);
// TODO this should receive weights!
// Float per vis or per pol x vis?
process(vector<DComplex*> data, vector<float*> data, vector<vector<DComplex* > > mdata);
// -- eventuele opruimacties (bijvoorbeeld wegschrijven van de data)
finish();
// -- hier kun je wat op het scherm dumpen aan statistieken
showCounts();
};
|
/*
* Parameters.h
*
* Created on: 31/01/2017
* Author: Lucas Teske
*/
#ifndef SRC_PARAMETERS_H_
#define SRC_PARAMETERS_H_
#define Q(x) #x
#define QUOTE(x) Q(x)
// These are the parameters used by the demodulator. Change with care.
// GOES HRIT Settings
#define HRIT_CENTER_FREQUENCY 1694100000
#define HRIT_SYMBOL_RATE 927000
#define HRIT_RRC_ALPHA 0.3f
// GOES LRIT Settings
#define LRIT_CENTER_FREQUENCY 1691000000
#define LRIT_SYMBOL_RATE 293883
#define LRIT_RRC_ALPHA 0.5f
// Loop Settings
#define LOOP_ORDER 2
#define RRC_TAPS 63
#define PLL_ALPHA 0.001f
#define CLOCK_ALPHA 0.0037f
#define CLOCK_MU 0.5f
#define CLOCK_OMEGA_LIMIT 0.005f
#define CLOCK_GAIN_OMEGA (CLOCK_ALPHA * CLOCK_ALPHA) / 4.0f
#define AGC_RATE 0.01f
#define AGC_REFERENCE 0.5f
#define AGC_GAIN 1.f
#define AGC_MAX_GAIN 4000
#define AIRSPY_MINI_DEFAULT_SAMPLERATE 3000000
#define AIRSPY_R2_DEFAULT_SAMPLERATE 2500000
#define DEFAULT_SAMPLE_RATE AIRSPY_MINI_DEFAULT_SAMPLERATE
#define DEFAULT_DECIMATION 1
#define DEFAULT_DEVICE_NUMBER 0
#define DEFAULT_DECODER_ADDRESS "127.0.0.1"
#define DEFAULT_DECODER_PORT 5000
#define DEFAULT_LNA_GAIN 5
#define DEFAULT_VGA_GAIN 5
#define DEFAULT_MIX_GAIN 5
#define DEFAULT_BIAST 0
// FIFO Size in Samples
// 1024 * 1024 samples is about 4Mb of ram.
// This should be more than enough
#define FIFO_SIZE (1024 * 1024)
// Config parameters
#define CFG_SYMBOL_RATE "symbolRate"
#define CFG_FREQUENCY "frequency"
#define CFG_RRC_ALPHA "rrcAlpha"
#define CFG_MODE "mode"
#define CFG_SAMPLE_RATE "sampleRate"
#define CFG_DECIMATION "decimation"
#define CFG_AGC "agcEnabled"
#define CFG_MIXER_GAIN "mixerGain"
#define CFG_LNA_GAIN "lnaGain"
#define CFG_VGA_GAIN "vgaGain"
#define CFG_DEVICE_TYPE "deviceType"
#define CFG_FILENAME "filename"
#define CFG_CONSTELLATION "sendConstellation"
#define CFG_PLL_ALPHA "pllAlpha"
#define CFG_DECODER_ADDRESS "decoderAddress"
#define CFG_DECODER_PORT "decoderPort"
#define CFG_DEVICE_NUM "deviceNumber"
#define CFG_SPYSERVER_HOST "spyserverHost"
#define CFG_SPYSERVER_PORT "spyserverPort"
#define CFG_BIAST "biast"
// Compilation parameters
#ifndef MAJOR_VERSION
#define MAJOR_VERSION unk
#endif
#ifndef MINOR_VERSION
#define MINOR_VERSION unk
#endif
#ifndef MAINT_VERSION
#define MAINT_VERSION unk
#endif
#ifndef GIT_SHA1
#define GIT_SHA1 unk
#endif
#endif /* SRC_PARAMETERS_H_ */
|
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fap.h>
#define EXIT_SUCCESS 0
char *readstdin(void);
int main()
{
char* input;
unsigned int input_len;
fap_packet_t* packet;
char fap_error_output[1024];
fap_init();
/* Get packet to parse from stdin */
input = readstdin();
input_len = strlen(input);
/* Process the packet. */
packet = fap_parseaprs(input, input_len, 0);
if ( packet->error_code ) {
fap_explain_error(*packet->error_code, fap_error_output);
printf("Failed to parse packet (%s): %s\n",
input, fap_error_output);
} else if ( packet->src_callsign ) {
printf("Got packet from %s.\n", packet->src_callsign);
}
fap_free(packet);
fap_cleanup();
return EXIT_SUCCESS;
}
char *readstdin(void)
{
#define BUF_SIZE 1024
char buffer[BUF_SIZE];
size_t contentSize = 1; /* includes NULL */
/* Preallocate space. We could just allocate one char here,
but that wouldn't be efficient. */
char *content = malloc(sizeof(char) * BUF_SIZE);
if(content == NULL) {
perror("Failed to allocate content");
exit(1);
}
content[0] = '\0'; /* null-terminated */
while(fgets(buffer, BUF_SIZE, stdin)) {
char *old = content;
contentSize += strlen(buffer);
content = realloc(content, contentSize);
if(content == NULL) {
perror("Failed to reallocate content");
free(old);
exit(2);
}
strcat(content, buffer);
}
if(ferror(stdin)) {
free(content);
perror("Error reading from stdin.");
exit(3);
}
return(content);
}
|
/*
Copyright (C) 2013 Nils Weiss, Patrick Bruenn.
This file is part of Wifly_Light.
Wifly_Light is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Wifly_Light 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 Wifly_Light. If not, see <http://www.gnu.org/licenses/>. */
#ifndef __WyLight__ScriptManager__
#define __WyLight__ScriptManager__
#include "Script.h"
#include "WiflyControlException.h"
#include <string>
#include <vector>
namespace WyLight
{
class ScriptManager {
const std::string m_Path;
std::vector<std::string> m_ScriptFiles;
static bool hasScriptFileExtension(const std::string& filename);
public:
static const std::string EXTENSION;
ScriptManager(const std::string& path);
~ScriptManager(void);
Script getScript(size_t index) const;
const std::string& getScriptName(size_t index) const;
size_t numScripts() const;
};
} /* namespace WyLight */
#endif /* #ifndef __WyLight__ScriptManager__ */
|
//////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014, Jonathan Balzer
//
// All rights reserved.
//
// This file is part of the R4R library.
//
// The R4R library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The R4R library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the R4R library. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////////
#ifndef R4RPRECOND_H_
#define R4RPRECOND_H_
#include "sarray.h"
#include "darray.h"
namespace R4R {
/*! \brief preconditioning of iterative linear solvers
*
*
*/
template<class Matrix,typename T>
class CPreconditioner {
public:
//! Performs preconditioning.
virtual void Solve(CDenseArray<T>& x, const CDenseArray<T>& y) const { x = y; }
protected:
};
/*! \brief successive over-relaxation preconditioner
*
*
*/
template<class Matrix,typename T>
class CSSORPreconditioner: public CPreconditioner<Matrix,T> {
public:
//! Constructor.
CSSORPreconditioner(Matrix& A, T omega, bool lower = true);
//! \copydoc CPreconditioner::Solve(Vector& x, Vector& y)
void Solve(CDenseArray<T>& x, const CDenseArray<T>& y) const;
protected:
T m_omega; //!< relaxation parameter
CSparseLowerTriangularArray<T> m_L; //!< lower-triangular part of #m_A (or transpose of #m_U)
CSparseDiagonalArray<T> m_D; //!< diagonal of #m_A
CSparseUpperTriangularArray<T> m_U; //!< upper-triangular part of #m_A (or transpose of #m_L)
};
/*! \brief Jacobi preconditioner
*
*
*/
template<class Matrix,typename T>
class CJacobiPreconditioner:public CPreconditioner<Matrix,T> {
public:
//! Constructor.
CJacobiPreconditioner(Matrix& A);
//! \copydoc CPreconditioner::Solve(Vector& x, Vector& y)
void Solve(CDenseArray<T>& x, const CDenseArray<T>& y) const;
protected:
CSparseDiagonalArray<T> m_D; //!< diagonal of #m_A
};
}
#endif /* PRECOND_H_ */
|
/* Copyright (C) 2014-2022 FastoGT. All right 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 FastoGT. 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.
*/
#pragma once
#if defined(HAVE_PTHREAD)
#include <pthread.h>
#include <sys/types.h>
#elif defined(OS_WIN)
#include <windows.h>
#endif
#include <common/macros.h>
#include <common/system_info/types.h>
#include <common/types.h>
namespace common {
namespace threads {
typedef void (*closure_type)();
typedef void*(routine_signature)(void*);
#if defined(HAVE_PTHREAD)
typedef pid_t platform_thread_id_t;
typedef pthread_key_t platform_tls_t;
typedef pthread_t platform_handle_t;
#else
typedef DWORD platform_thread_id_t;
typedef DWORD platform_tls_t;
typedef HANDLE platform_handle_t;
#endif
extern const platform_handle_t invalid_handle;
extern const platform_thread_id_t invalid_tid;
// Used to operate on threads.
class PlatformThreadHandle {
public:
PlatformThreadHandle() : handle_(invalid_handle), thread_id_(invalid_tid) {}
PlatformThreadHandle(platform_handle_t handle, platform_thread_id_t id) : handle_(handle), thread_id_(id) {}
bool EqualsHandle(const PlatformThreadHandle& other) const;
platform_thread_id_t GetTid() const { return thread_id_; }
platform_handle_t GetPlatformHandle() const { return handle_; }
bool Equals(const PlatformThreadHandle& handle) const {
return EqualsHandle(handle) && thread_id_ == handle.thread_id_;
}
private:
friend class PlatformThread;
platform_handle_t handle_;
platform_thread_id_t thread_id_;
};
PlatformThreadHandle invalid_thread_handle();
PlatformThreadHandle current_thread_handle();
inline bool operator==(const PlatformThreadHandle& left, const PlatformThreadHandle& right) {
return left.Equals(right);
}
inline bool operator!=(const PlatformThreadHandle& left, const PlatformThreadHandle& right) {
return !(left == right);
}
enum ThreadPriority {
PRIORITY_IDLE = -1,
PRIORITY_NORMAL = 0,
PRIORITY_ABOVE_NORMAL = 1,
PRIORITY_HIGH = 2,
};
class PlatformThread {
public:
static bool Create(PlatformThreadHandle* thread_handle,
routine_signature routine,
void* arg,
ThreadPriority priority);
static bool Join(PlatformThreadHandle* thread_handle, void** thread_return);
static void SetAffinity(PlatformThreadHandle* thread_handle, lcpu_count_t lCpuCount);
static platform_handle_t GetCurrentHandle();
static platform_thread_id_t GetCurrentId();
static bool InitTlsKey(platform_tls_t* key);
static bool ReleaseTlsKey(platform_tls_t key);
static void* GetTlsDataByKey(platform_tls_t key);
static bool SetTlsDataByKey(platform_tls_t key, void* data);
static void Sleep(time64_t milliseconds);
};
} // namespace threads
} // namespace common
|
#include <thread.h>
#include <processor.h>
#include <interrupt.h>
#include <printk.h>
_Atomic long long min_time = 0;
static struct thread *__select_thread(struct processor *proc)
{
/* throw the old process back on the queue */
spinlock_acquire(&proc->schedlock);
if(current_thread->flags & THREAD_DEAD)
current_thread->flags |= THREAD_GONE;
if(likely(proc->running->state == THREADSTATE_RUNNING && proc->running != &proc->idle_thread)) {
if(likely(!(atomic_fetch_or(&proc->running->flags, THREAD_ONQUEUE) & THREAD_ONQUEUE))) {
assert(proc->running == current_thread && !(current_thread->flags & THREAD_DEAD));
priqueue_insert(&proc->runqueue, &proc->running->runqueue_node, proc->running, thread_current_priority(proc->running));
}
}
struct thread *thread = priqueue_pop(&proc->runqueue);
if(unlikely(!thread))
thread = &proc->idle_thread;
else {
thread->flags &= ~THREAD_ONQUEUE;
}
if(((thread->flags & THREAD_UNINTER) && thread->state != THREADSTATE_RUNNING) || thread->flags & THREAD_DEAD) {
thread = &proc->idle_thread;
}
/* this is a weird edge case (that should probably get fixed up, TODO):
* if a thread exits and another thread unblocks that exiting thread (for
* example, it gets a signal), then the thread may be added to the runqueue
* during its exiting. Threads that are exiting don't "remove" themselves from
* the runqueue because that happens in the scheduler above, so they could be
* in the runqueue in an unrunnable state. Then, another thread creates a new
* thread and the slab allocator returns the recently exited thread. The flags
* are cleared and the scheduler is then free to run that "new" thread...with the
* old state. Thus allowing the thread to reach the unreachable part of thread_exit.
*
* So, if a thread's state is INIT, then don't run it. Wait until the creating thread
* sets it to runable. */
if(unlikely(thread->state == THREADSTATE_INIT)) {
thread = &proc->idle_thread;
}
proc->running = thread;
spinlock_release(&proc->schedlock);
return thread;
}
static void _check_signals(struct thread *thread)
{
spinlock_acquire(&thread->signal_lock);
if(!sigisemptyset(&thread->pending_signals)) {
for(int i = 1; i < _NSIG; i++) {
if(sigismember(&thread->pending_signals, i)) {
sigdelset(&thread->pending_signals, i);
thread->signal = i;
if(!(thread->flags & THREAD_UNINTER)) {
thread->state = THREADSTATE_RUNNING;
thread->processor->running = thread;
}
break;
}
}
}
spinlock_release(&thread->signal_lock);
}
static void __do_schedule(int save_preempt)
{
int old = arch_interrupt_set(0);
struct processor *curproc = processor_get_current();
struct workqueue *wq = &curproc->workqueue;
int preempt_old = curproc->preempt_disable - 1 /* -1 for the handle of curproc we hold */;
assert(preempt_old >= 0);
if(!save_preempt && curproc->preempt_disable > 1) {
processor_release(curproc);
arch_interrupt_set(old);
return;
} else {
curproc->preempt_disable = 1;
}
#if CONFIG_DEBUG
//assert(current_thread->held_spinlocks == 0);
#endif
_check_signals(current_thread);
struct thread *next = __select_thread(curproc);
processor_release(curproc);
current_thread->flags &= ~THREAD_RESCHEDULE;
if(next != current_thread) {
//printk(":%d: %ld -> %ld\n", curproc->id, current_thread->tid, next->tid);
arch_thread_context_switch(current_thread, next);
_check_signals(current_thread);
}
if(save_preempt) {
/* we're playing fast-and-loose here with references. We know that we'll be
* fine since we've disabled interrupts, so we can technically drop the reference
* to curproc before we get here... uhg */
curproc->preempt_disable = preempt_old;
}
arch_interrupt_set(old);
/* threads have to do some kernel work! */
if(!save_preempt && !workqueue_empty(wq)) {
workqueue_execute(wq);
}
}
void schedule()
{
__do_schedule(1);
}
void preempt()
{
__do_schedule(0);
}
|
#ifdef PARSER_H
#define PARSER_H
int parse(char *content, long fsize, int argsc, char *args[]);
#endif
|
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Sonic Visualiser
An audio file viewer and annotation editor.
Centre for Digital Music, Queen Mary, University of London.
This file copyright 2008 QMUL.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#ifndef _MODEL_DATA_TABLE_MODEL_H_
#define _MODEL_DATA_TABLE_MODEL_H_
#include <QAbstractItemModel>
#include <vector>
#include "PraalineCore/Base/BaseTypes.h"
class TabularModel;
class UndoableCommand;
class ModelDataTableModel : public QAbstractItemModel
{
Q_OBJECT
public:
ModelDataTableModel(TabularModel *m);
virtual ~ModelDataTableModel();
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
bool insertRow(int row, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, const QModelIndex &parent = QModelIndex());
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QModelIndex getModelIndexForFrame(sv_frame_t frame) const;
sv_frame_t getFrameForModelIndex(const QModelIndex &) const;
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
QModelIndex findText(QString text) const;
void setCurrentRow(int row);
int getCurrentRow() const;
signals:
void frameSelected(int);
void addCommand(UndoableCommand *);
void currentChanged(const QModelIndex &);
void modelRemoved();
protected slots:
void modelChanged();
void modelChangedWithin(sv_frame_t, sv_frame_t);
void modelAboutToBeDeleted();
protected:
TabularModel *m_model;
int m_sortColumn;
Qt::SortOrder m_sortOrdering;
int m_currentRow;
typedef std::vector<int> RowList;
mutable RowList m_sort;
mutable RowList m_rsort;
int getSorted(int row) const;
int getUnsorted(int row) const;
void resort() const;
void resortNumeric() const;
void resortAlphabetical() const;
void clearSort();
};
#endif
|
/*
* Leaktrack, a Memory Leack Tracker.
* Copyright (C) 2002-2008 Aymerick Jehanne <[email protected]>
*
* 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
*
* GPL v2: http://www.gnu.org/licenses/gpl.txt
*
* Contact: [email protected]
* Home: http://libwbxml.aymerick.com
*/
/**
* @file lt_log.h
* @ingroup leaktrack
*
* @brief Log Functions
*
* @note Code adapted from Kannel project (http://www.kannel.org/)
*/
#ifndef LEAKTRACK_LOG_H
#define LEAKTRACK_LOG_H
/**
* @brief Open the log file
* @param filename The logfile name
*/
LT_DECLARE(void) lt_log_open_file(char *filename);
/**
* @brief Logging function
* @param e If different from 0, try to resolve a system error
* @param fmt The log text (in printf style)
*/
LT_DECLARE_NONSTD(void) lt_log(int e, const char *fmt, ...);
/**
* @brief Close the log file
*/
LT_DECLARE(void) lt_log_close_file(void);
#endif
|
/* classes: h_files */
#ifndef SCM_HASHTAB_H
#define SCM_HASHTAB_H
/* Copyright (C) 1995,1996,1999,2000,2001, 2003, 2004, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "libguile/__scm.h"
#define SCM_HASHTABLE_P(x) (SCM_HAS_TYP7 (x, scm_tc7_hashtable))
#define SCM_VALIDATE_HASHTABLE(pos, arg) \
SCM_MAKE_VALIDATE_MSG (pos, arg, HASHTABLE_P, "hash-table")
#define SCM_HASHTABLE_VECTOR(h) SCM_CELL_OBJECT_1 (h)
#define SCM_SET_HASHTABLE_VECTOR(x, v) SCM_SET_CELL_OBJECT_1 ((x), (v))
#define SCM_HASHTABLE(x) ((scm_t_hashtable *) SCM_CELL_WORD_2 (x))
#define SCM_HASHTABLE_N_ITEMS(x) (SCM_HASHTABLE (x)->n_items)
#define SCM_SET_HASHTABLE_N_ITEMS(x, n) (SCM_HASHTABLE (x)->n_items = n)
#define SCM_HASHTABLE_INCREMENT(x) (SCM_HASHTABLE_N_ITEMS(x)++)
#define SCM_HASHTABLE_DECREMENT(x) (SCM_HASHTABLE_N_ITEMS(x)--)
#define SCM_HASHTABLE_UPPER(x) (SCM_HASHTABLE (x)->upper)
#define SCM_HASHTABLE_LOWER(x) (SCM_HASHTABLE (x)->lower)
#define SCM_HASHTABLE_N_BUCKETS(h) \
SCM_SIMPLE_VECTOR_LENGTH (SCM_HASHTABLE_VECTOR (h))
#define SCM_HASHTABLE_BUCKET(h, i) \
SCM_SIMPLE_VECTOR_REF (SCM_HASHTABLE_VECTOR (h), i)
#define SCM_SET_HASHTABLE_BUCKET(h, i, x) \
SCM_SIMPLE_VECTOR_SET (SCM_HASHTABLE_VECTOR (h), i, x)
/* Function that computes a hash of OBJ modulo MAX. */
typedef unsigned long (*scm_t_hash_fn) (SCM obj, unsigned long max,
void *closure);
/* Function that returns the value associated with OBJ in ALIST according to
some equality predicate. */
typedef SCM (*scm_t_assoc_fn) (SCM obj, SCM alist, void *closure);
/* Function to fold over the entries of a hash table. */
typedef SCM (*scm_t_hash_fold_fn) (void *closure, SCM key, SCM value,
SCM result);
/* Function to iterate over the handles (key-value pairs) of a hash
table. */
typedef SCM (*scm_t_hash_handle_fn) (void *closure, SCM handle);
typedef struct scm_t_hashtable {
unsigned long n_items; /* number of items in table */
unsigned long lower; /* when to shrink */
unsigned long upper; /* when to grow */
int size_index; /* index into hashtable_size */
int min_size_index; /* minimum size_index */
scm_t_hash_fn hash_fn; /* for rehashing after a GC. */
} scm_t_hashtable;
SCM_API SCM scm_vector_to_hash_table (SCM vector);
SCM_API SCM scm_c_make_hash_table (unsigned long k);
SCM_API SCM scm_make_hash_table (SCM n);
SCM_API SCM scm_hash_table_p (SCM h);
SCM_INTERNAL void scm_i_rehash (SCM table, scm_t_hash_fn hash_fn,
void *closure, const char *func_name);
SCM_API SCM scm_hash_fn_get_handle (SCM table, SCM obj,
scm_t_hash_fn hash_fn,
scm_t_assoc_fn assoc_fn,
void *closure);
SCM_API SCM scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init,
scm_t_hash_fn hash_fn,
scm_t_assoc_fn assoc_fn,
void *closure);
SCM_API SCM scm_hash_fn_ref (SCM table, SCM obj, SCM dflt,
scm_t_hash_fn hash_fn,
scm_t_assoc_fn assoc_fn,
void *closure);
SCM_API SCM scm_hash_fn_set_x (SCM table, SCM obj, SCM val,
scm_t_hash_fn hash_fn,
scm_t_assoc_fn assoc_fn,
void *closure);
SCM_API SCM scm_hash_fn_remove_x (SCM table, SCM obj,
scm_t_hash_fn hash_fn,
scm_t_assoc_fn assoc_fn,
void *closure);
SCM_API SCM scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
SCM init, SCM table);
SCM_API void scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn,
void *closure, SCM table);
SCM_API SCM scm_hash_clear_x (SCM table);
SCM_API SCM scm_hashq_get_handle (SCM table, SCM obj);
SCM_API SCM scm_hashq_create_handle_x (SCM table, SCM obj, SCM init);
SCM_API SCM scm_hashq_ref (SCM table, SCM obj, SCM dflt);
SCM_API SCM scm_hashq_set_x (SCM table, SCM obj, SCM val);
SCM_API SCM scm_hashq_remove_x (SCM table, SCM obj);
SCM_API SCM scm_hashv_get_handle (SCM table, SCM obj);
SCM_API SCM scm_hashv_create_handle_x (SCM table, SCM obj, SCM init);
SCM_API SCM scm_hashv_ref (SCM table, SCM obj, SCM dflt);
SCM_API SCM scm_hashv_set_x (SCM table, SCM obj, SCM val);
SCM_API SCM scm_hashv_remove_x (SCM table, SCM obj);
SCM_API SCM scm_hash_get_handle (SCM table, SCM obj);
SCM_API SCM scm_hash_create_handle_x (SCM table, SCM obj, SCM init);
SCM_API SCM scm_hash_ref (SCM table, SCM obj, SCM dflt);
SCM_API SCM scm_hash_set_x (SCM table, SCM obj, SCM val);
SCM_API SCM scm_hash_remove_x (SCM table, SCM obj);
SCM_API SCM scm_hashx_get_handle (SCM hash, SCM assoc, SCM table, SCM obj);
SCM_API SCM scm_hashx_create_handle_x (SCM hash, SCM assoc, SCM table, SCM obj, SCM init);
SCM_API SCM scm_hashx_ref (SCM hash, SCM assoc, SCM table, SCM obj, SCM dflt);
SCM_API SCM scm_hashx_set_x (SCM hash, SCM assoc, SCM table, SCM obj, SCM val);
SCM_API SCM scm_hashx_remove_x (SCM hash, SCM assoc, SCM table, SCM obj);
SCM_API SCM scm_hash_fold (SCM proc, SCM init, SCM hash);
SCM_API SCM scm_hash_for_each (SCM proc, SCM hash);
SCM_API SCM scm_hash_for_each_handle (SCM proc, SCM hash);
SCM_API SCM scm_hash_map_to_list (SCM proc, SCM hash);
SCM_INTERNAL void scm_i_hashtable_print (SCM exp, SCM port, scm_print_state *pstate);
SCM_INTERNAL void scm_init_hashtab (void);
#endif /* SCM_HASHTAB_H */
/*
Local Variables:
c-file-style: "gnu"
End:
*/
|
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaDefines.h"
#include <QString>
//==================================================================================================
///
//==================================================================================================
class RicWellPathFractureReportItem
{
public:
RicWellPathFractureReportItem( const QString& wellPathNameForExport,
const QString& fractureName,
const QString& fractureTemplateName,
double measuredDepth );
void setData( double trans, size_t connCount, double area );
void setWidthAndConductivity( double width, double conductivity );
void setHeightAndHalfLength( double height, double halfLength );
void setAreaWeightedPermeability( double permeability );
void setUnitSystem( RiaDefines::EclipseUnitSystem unitSystem );
void setPressureDepletionParameters( bool performPressureDepletionScaling,
const QString& timeStepString,
const QString& wbhpString,
double userWBHP,
double actualWBHP,
double minPressureDrop,
double maxPressureDrop );
QString wellPathNameForExport() const;
QString fractureName() const;
QString fractureTemplateName() const;
RiaDefines::EclipseUnitSystem unitSystem() const;
double transmissibility() const;
size_t connectionCount() const;
double fcd() const;
double area() const;
double kfwf() const;
double kf() const;
double wf() const;
double xf() const;
double h() const;
double km() const;
double kmxf() const;
bool performPressureDepletionScaling() const;
QString pressureDepletionTimeStepString() const;
QString pressureDepletionWBHPString() const;
double pressureDepletionUserWBHP() const;
double pressureDepletionActualWBHP() const;
double pressureDepletionMinPressureDrop() const;
double pressureDepletionMaxPressureDrop() const;
bool operator<( const RicWellPathFractureReportItem& other ) const;
private:
RiaDefines::EclipseUnitSystem m_unitSystem;
QString m_wellPathNameForExport;
QString m_wellPathFracture;
QString m_wellPathFractureTemplate;
double m_mesuredDepth;
double m_transmissibility;
size_t m_connectionCount;
double m_area;
double m_kfwf;
double m_kf;
double m_wf;
double m_xf;
double m_h;
double m_km;
bool m_performPressureDepletionScaling;
QString m_pressureDepletionTimeStepString;
QString m_pressureDepletionWBHPString;
double m_pressureDepletionUserWBHP;
double m_pressureDepletionActualWBHP;
double m_pressureDepletionMinPressureDrop;
double m_pressureDepletionMaxPressureDrop;
};
|
/* WebROaR - Ruby Application Server - http://webroar.in/
* Copyright (C) 2009 Goonj LLC
*
* This file is part of WebROaR.
*
* WebROaR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebROaR 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 WebROaR. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WR_ACCESS_LOG_H_
#define WR_ACCESS_LOG_H_
#define WR_ACCESS_LOG_FILE "/var/log/webroar/access.log"
#define WR_REQ_USER_AGENT "HTTP_USER_AGENT"
#define WR_REQ_REFERER "HTTP_REFERER"
#include <wr_request.h>
int wr_access_log(wr_req_t*);
#endif /*WR_ACCESS_LOG_H_*/
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[5];
atomic_int atom_1_r1_1;
atomic_int atom_1_r13_0;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v3_r3 = v2_r1 ^ v2_r1;
int v6_r4 = atomic_load_explicit(&vars[2+v3_r3], memory_order_seq_cst);
int v7_r6 = v6_r4 ^ v6_r4;
int v8_r6 = v7_r6 + 1;
atomic_store_explicit(&vars[3], v8_r6, memory_order_seq_cst);
int v10_r8 = atomic_load_explicit(&vars[3], memory_order_seq_cst);
int v11_cmpeq = (v10_r8 == v10_r8);
if (v11_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
atomic_store_explicit(&vars[4], 1, memory_order_seq_cst);
int v13_r11 = atomic_load_explicit(&vars[4], memory_order_seq_cst);
int v14_r12 = v13_r11 ^ v13_r11;
int v17_r13 = atomic_load_explicit(&vars[0+v14_r12], memory_order_seq_cst);
int v21 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v21, memory_order_seq_cst);
int v22 = (v17_r13 == 0);
atomic_store_explicit(&atom_1_r13_0, v22, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[3], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[0], 0);
atomic_init(&vars[4], 0);
atomic_init(&vars[1], 0);
atomic_init(&atom_1_r1_1, 0);
atomic_init(&atom_1_r13_0, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v18 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v19 = atomic_load_explicit(&atom_1_r13_0, memory_order_seq_cst);
int v20_conj = v18 & v19;
if (v20_conj == 1) assert(0);
return 0;
}
|
#include "CAN.h"
#include "led.h"
#include "delay.h"
#include "usart.h"
//////////////////////////////////////////////////////////////////////////////////
//±¾³ÌÐòÖ»¹©Ñ§Ï°Ê¹Óã¬Î´¾×÷ÕßÐí¿É£¬²»µÃÓÃÓÚÆäËüÈκÎÓÃ;
//ALIENTEKÕ½½¢STM32¿ª·¢°å
//CANÇý¶¯ ´úÂë
//ÕýµãÔ×Ó@ALIENTEK
//¼¼ÊõÂÛ̳:www.openedv.com
//ÐÞ¸ÄÈÕÆÚ:2012/9/11
//°æ±¾£ºV1.0
//°æÈ¨ËùÓУ¬µÁ°æ±Ø¾¿¡£
//Copyright(C) ¹ãÖÝÊÐÐÇÒíµç×ӿƼ¼ÓÐÏÞ¹«Ë¾ 2009-2019
//All rights reserved
//////////////////////////////////////////////////////////////////////////////////
//CAN³õʼ»¯
//tsjw:ÖØÐÂͬ²½ÌøÔ¾Ê±¼äµ¥Ôª.·¶Î§:1~3; CAN_SJW_1tq CAN_SJW_2tq CAN_SJW_3tq CAN_SJW_4tq
//tbs2:ʱ¼ä¶Î2µÄʱ¼äµ¥Ôª.·¶Î§:1~8;
//tbs1:ʱ¼ä¶Î1µÄʱ¼äµ¥Ôª.·¶Î§:1~16; CAN_BS1_1tq ~CAN_BS1_16tq
//brp :²¨ÌØÂÊ·ÖÆµÆ÷.·¶Î§:1~1024;(ʵ¼ÊÒª¼Ó1,Ò²¾ÍÊÇ1~1024) tq=(brp)*tpclk1
//×¢ÒâÒÔÉϲÎÊýÈκÎÒ»¸ö¶¼²»ÄÜÉèΪ0,·ñÔò»áÂÒ.
//²¨ÌØÂÊ=Fpclk1/((tsjw+tbs1+tbs2)*brp);
//mode:0,ÆÕͨģʽ;1,»Ø»·Ä£Ê½;
//Fpclk1µÄʱÖÓÔÚ³õʼ»¯µÄʱºòÉèÖÃΪ36M,Èç¹ûÉèÖÃCAN_Normal_Init(1,8,7,5,1);
//Ôò²¨ÌØÂÊΪ:36M/((1+8+7)*5)=450Kbps
//·µ»ØÖµ:0,³õʼ»¯OK;
// ÆäËû,³õʼ»¯Ê§°Ü;
u8 CAN_Mode_Init(u8 tsjw,u8 tbs2,u8 tbs1,u16 brp,u8 mode)
{
GPIO_InitTypeDef GPIO_InitStructure;
CAN_InitTypeDef CAN_InitStructure;
CAN_FilterInitTypeDef CAN_FilterInitStructure;
#if CAN_RX0_INT_ENABLE
NVIC_InitTypeDef NVIC_InitStructure;
#endif
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//ʹÄÜPORTAʱÖÓ
RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN2, ENABLE);//ʹÄÜCAN2ʱÖÓ
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //¸´ÓÃÍÆÍì
GPIO_Init(GPIOB, &GPIO_InitStructure); //³õʼ»¯IO
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;//ÉÏÀÊäÈë
GPIO_Init(GPIOB, &GPIO_InitStructure);//³õʼ»¯IO
//CANµ¥ÔªÉèÖÃ
CAN_InitStructure.CAN_TTCM=DISABLE; //·Çʱ¼ä´¥·¢Í¨ÐÅģʽ //
CAN_InitStructure.CAN_ABOM=DISABLE; //Èí¼þ×Ô¶¯ÀëÏß¹ÜÀí //
CAN_InitStructure.CAN_AWUM=DISABLE; //˯Ãßģʽͨ¹ýÈí¼þ»½ÐÑ(Çå³ýCAN->MCRµÄSLEEPλ)//
CAN_InitStructure.CAN_NART=ENABLE; //½ûÖ¹±¨ÎÄ×Ô¶¯´«ËÍ //
CAN_InitStructure.CAN_RFLM=DISABLE; //±¨ÎIJ»Ëø¶¨,еĸ²¸Ç¾ÉµÄ //
CAN_InitStructure.CAN_TXFP=DISABLE; //ÓÅÏȼ¶Óɱ¨Îıêʶ·û¾ö¶¨ //
CAN_InitStructure.CAN_Mode= mode; //ģʽÉèÖ㺠mode:0,ÆÕͨģʽ;1,»Ø»·Ä£Ê½; //
//ÉèÖò¨ÌØÂÊ
CAN_InitStructure.CAN_SJW=tsjw; //ÖØÐÂͬ²½ÌøÔ¾¿í¶È(Tsjw)Ϊtsjw+1¸öʱ¼äµ¥Î» CAN_SJW_1tq CAN_SJW_2tq CAN_SJW_3tq CAN_SJW_4tq
CAN_InitStructure.CAN_BS1=tbs1; //Tbs1=tbs1+1¸öʱ¼äµ¥Î»CAN_BS1_1tq ~CAN_BS1_16tq
CAN_InitStructure.CAN_BS2=tbs2;//Tbs2=tbs2+1¸öʱ¼äµ¥Î»CAN_BS2_1tq ~ CAN_BS2_8tq
CAN_InitStructure.CAN_Prescaler=brp; //·ÖƵϵÊý(Fdiv)Ϊbrp+1 //
CAN_Init(CAN2, &CAN_InitStructure); // ³õʼ»¯CAN1
CAN_FilterInitStructure.CAN_FilterNumber=0; //¹ýÂËÆ÷0
CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdMask;
CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit; //32λ
CAN_FilterInitStructure.CAN_FilterIdHigh=0x0000;////32λID
CAN_FilterInitStructure.CAN_FilterIdLow=0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh=0x0000;//32λMASK
CAN_FilterInitStructure.CAN_FilterMaskIdLow=0x0000;
CAN_FilterInitStructure.CAN_FilterFIFOAssignment=CAN_Filter_FIFO0;//¹ýÂËÆ÷0¹ØÁªµ½FIFO0
CAN_FilterInitStructure.CAN_FilterActivation=ENABLE; //¼¤»î¹ýÂËÆ÷0
CAN_FilterInit(&CAN_FilterInitStructure);//Â˲¨Æ÷³õʼ»¯
return 0;
}
//can·¢ËÍÒ»×éÊý¾Ý(¹Ì¶¨¸ñʽ:IDΪ0X12,±ê×¼Ö¡,Êý¾ÝÖ¡)
//len:Êý¾Ý³¤¶È(×î´óΪ8)
//msg:Êý¾ÝÖ¸Õë,×î´óΪ8¸ö×Ö½Ú.
//·µ»ØÖµ:0,³É¹¦;
// ÆäËû,ʧ°Ü;
u8 Can_Send_Msg(u8* msg,u8 len)
{
u8 mbox;
u16 i=0;
CanTxMsg TxMessage;
TxMessage.StdId=0x12; // ±ê×¼±êʶ·ûΪ0
TxMessage.ExtId=0x12; // ÉèÖÃÀ©Õ¹±êʾ·û£¨29룩
TxMessage.IDE=0; // ʹÓÃÀ©Õ¹±êʶ·û
TxMessage.RTR=0; // ÏûÏ¢ÀàÐÍΪÊý¾ÝÖ¡£¬Ò»Ö¡8λ
TxMessage.DLC=len; // ·¢ËÍÁ½Ö¡ÐÅÏ¢
for(i=0;i<len;i++)
TxMessage.Data[i]=msg[i]; // µÚÒ»Ö¡ÐÅÏ¢
mbox= CAN_Transmit(CAN2, &TxMessage);
i=0;
while((CAN_TransmitStatus(CAN2, mbox)==CAN_TxStatus_Failed)&&(i<0XFFF))i++; //µÈ´ý·¢ËͽáÊø
if(i>=0XFFF)return 1;
return 0;
}
//can¿Ú½ÓÊÕÊý¾Ý²éѯ
//buf:Êý¾Ý»º´æÇø;
//·µ»ØÖµ:0,ÎÞÊý¾Ý±»ÊÕµ½;
// ÆäËû,½ÓÊÕµÄÊý¾Ý³¤¶È;
u8 Can_Receive_Msg(u8 *buf)
{
u32 i;
CanRxMsg RxMessage;
if( CAN_MessagePending(CAN2,CAN_FIFO0)==0)return 0; //ûÓнÓÊÕµ½Êý¾Ý,Ö±½ÓÍ˳ö
CAN_Receive(CAN2, CAN_FIFO0, &RxMessage);//¶ÁÈ¡Êý¾Ý
for(i=0;i<8;i++)
buf[i]=RxMessage.Data[i];
return RxMessage.DLC;
}
|
/*
Liquid War 6 is a unique multiplayer wargame.
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Christian Mauduit <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Liquid War 6 homepage : http://www.gnu.org/software/liquidwar6/
Contact author : [email protected]
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include <CUnit/CUnit.h>
#include "mat.h"
int
main (int argc, const char *argv[])
{
int ret = 0;
lw6sys_context_t *sys_context = NULL;
int mode = 0;
LW6SYS_MAIN_BEGIN (sys_context);
lw6sys_log_clear (sys_context, NULL);
mode = lw6sys_arg_test_mode (sys_context, argc, argv);
if (CU_initialize_registry () == CUE_SUCCESS)
{
if (lw6mat_test_register (sys_context, mode))
{
ret = lw6mat_test_run (sys_context, mode);
}
CU_cleanup_registry ();
}
LW6SYS_TEST_OUTPUT;
LW6SYS_MAIN_END (sys_context);
return (!ret);
}
|
#include <stdio.h>
#include <stdlib.h>
//#include <elf.h>
#define ELF_MAGIC 16
//#define MEM_ALLOC_H(ptr) ptr = (FILE *) malloc (sizeof(myElf32_Ehdr));
//#define MEM_ALLOC_S(ptr) ptr = (FILE *) malloc (sizeof(myElf32_Shdr));
#define VALIDATE(ptr) if (!(ptr)) {\
fprintf(stdout, "%s", "Returned NULL\n");\
exit(1);\
}
typedef unsigned short int myElf32_Half;
typedef unsigned int myElf32_Word;
typedef struct {
unsigned char magic_num[ELF_MAGIC];
myElf32_Half elfh_type;
myElf32_Half elfh_machine;
myElf32_Word elfh_version;
myElf32_Word elfh_entry;
myElf32_Word elfh_phoff;
myElf32_Word elfh_shoff;
myElf32_Word elfh_flags;
myElf32_Half elfh_ehsize;
myElf32_Half elfh_phentsize;
myElf32_Half elfh_phnum;
myElf32_Half elfh_shentsize;
myElf32_Half elfh_shnum;
myElf32_Half elfh_shstrndx;
} myElf32_Ehdr;
typedef struct {
myElf32_Word sech_name;
myElf32_Word sech_type;
myElf32_Word sech_flags;
myElf32_Word sech_addr;
myElf32_Word sech_offset;
myElf32_Word sech_size;
myElf32_Word sech_link;
myElf32_Word sech_info;
myElf32_Word sech_addralign;
myElf32_Word sech_entsize;
} myElf32_Shdr;
|
// simplewall
// Copyright (c) 2016-2021 Henry++
#pragma once
#include "routine.h"
#include <winsock2.h>
#include <ws2ipdef.h>
#include <ws2tcpip.h>
#include <windns.h>
#include <mstcpip.h>
#include <iphlpapi.h>
#include <aclapi.h>
#include <dbt.h>
#include <fwpmu.h>
#include <mmsystem.h>
#include <netfw.h>
#include <shlguid.h>
#include <shobjidl.h>
#include <softpub.h>
#include <subauth.h>
#include <mscat.h>
#include "app.h"
#include "rapp.h"
#include "main.h"
#include "resource.h"
DECLSPEC_SELECTANY STATIC_DATA config = {0};
DECLSPEC_SELECTANY PROFILE_DATA profile_info = {0};
DECLSPEC_SELECTANY PR_HASHTABLE apps_table = NULL;
DECLSPEC_SELECTANY PR_LIST rules_list = NULL;
DECLSPEC_SELECTANY PR_HASHTABLE rules_config = NULL;
DECLSPEC_SELECTANY PR_HASHTABLE log_table = NULL;
DECLSPEC_SELECTANY PR_HASHTABLE cache_information = NULL;
DECLSPEC_SELECTANY PR_HASHTABLE cache_resolution = NULL;
DECLSPEC_SELECTANY PR_HASHTABLE colors_table = NULL;
DECLSPEC_SELECTANY PR_ARRAY filter_ids = NULL;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_apps = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_apply = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_rules = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_rules_config = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_loglist = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_profile = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_transaction = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_cache_information = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_QUEUED_LOCK lock_cache_resolution = PR_QUEUED_LOCK_INIT;
DECLSPEC_SELECTANY R_WORKQUEUE file_queue = {0};
DECLSPEC_SELECTANY R_WORKQUEUE log_queue = {0};
DECLSPEC_SELECTANY R_WORKQUEUE resolver_queue = {0};
DECLSPEC_SELECTANY R_WORKQUEUE resolve_notify_queue = {0};
DECLSPEC_SELECTANY R_WORKQUEUE wfp_queue = {0};
DECLSPEC_SELECTANY R_FREE_LIST context_free_list = {0};
DECLSPEC_SELECTANY R_FREE_LIST listview_free_list = {0};
// timers array
DECLSPEC_SELECTANY const LONG64 timer_array[] =
{
2 * 60,
5 * 60,
10 * 60,
30 * 60,
1 * 3600,
2 * 3600,
4 * 3600,
6 * 3600
};
// dropped events callback subscription (win7+)
#ifndef FWP_DIRECTION_IN
#define FWP_DIRECTION_IN 0x00003900L
#endif
#ifndef FWP_DIRECTION_OUT
#define FWP_DIRECTION_OUT 0x00003901L
#endif
#include "controls.h"
#include "db.h"
#include "editor.h"
#include "helper.h"
#include "icons.h"
#include "listview.h"
#include "log.h"
#include "messages.h"
#include "network.h"
#include "notifications.h"
#include "packages.h"
#include "profile.h"
#include "search.h"
#include "security.h"
#include "timer.h"
#include "wfp.h"
|
/********************************************************************************
** Form generated from reading UI file 'addECGDialog.ui'
**
** Created by: Qt User Interface Compiler version 5.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_ADDECGDIALOG_H
#define UI_ADDECGDIALOG_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QDialog>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_Dialog
{
public:
QWidget *layoutWidget;
QHBoxLayout *hboxLayout;
QSpacerItem *horizontalSpacer_2;
QPushButton *okButton;
QSpacerItem *horizontalSpacer;
QPushButton *cancelButton;
QSpacerItem *horizontalSpacer_3;
QLabel *headLabel;
QLabel *nameLabel;
QCheckBox *checkBox;
QLabel *ECGlabel;
QComboBox *ECGBox;
QLineEdit *nameEdit;
void setupUi(QDialog *Dialog)
{
if (Dialog->objectName().isEmpty())
Dialog->setObjectName(QStringLiteral("Dialog"));
Dialog->resize(393, 233);
layoutWidget = new QWidget(Dialog);
layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
layoutWidget->setGeometry(QRect(20, 180, 351, 33));
hboxLayout = new QHBoxLayout(layoutWidget);
hboxLayout->setSpacing(6);
hboxLayout->setObjectName(QStringLiteral("hboxLayout"));
hboxLayout->setContentsMargins(0, 0, 0, 0);
horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addItem(horizontalSpacer_2);
okButton = new QPushButton(layoutWidget);
okButton->setObjectName(QStringLiteral("okButton"));
hboxLayout->addWidget(okButton);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addItem(horizontalSpacer);
cancelButton = new QPushButton(layoutWidget);
cancelButton->setObjectName(QStringLiteral("cancelButton"));
hboxLayout->addWidget(cancelButton);
horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addItem(horizontalSpacer_3);
headLabel = new QLabel(Dialog);
headLabel->setObjectName(QStringLiteral("headLabel"));
headLabel->setGeometry(QRect(20, 20, 331, 16));
QFont font;
font.setPointSize(10);
font.setBold(true);
font.setWeight(75);
headLabel->setFont(font);
nameLabel = new QLabel(Dialog);
nameLabel->setObjectName(QStringLiteral("nameLabel"));
nameLabel->setGeometry(QRect(20, 70, 47, 13));
QFont font1;
font1.setBold(true);
font1.setWeight(75);
nameLabel->setFont(font1);
checkBox = new QCheckBox(Dialog);
checkBox->setObjectName(QStringLiteral("checkBox"));
checkBox->setGeometry(QRect(20, 110, 231, 17));
checkBox->setFont(font1);
ECGlabel = new QLabel(Dialog);
ECGlabel->setObjectName(QStringLiteral("ECGlabel"));
ECGlabel->setGeometry(QRect(20, 140, 81, 16));
ECGlabel->setFont(font1);
ECGBox = new QComboBox(Dialog);
ECGBox->setObjectName(QStringLiteral("ECGBox"));
ECGBox->setGeometry(QRect(100, 140, 271, 22));
ECGBox->setInsertPolicy(QComboBox::InsertAlphabetically);
nameEdit = new QLineEdit(Dialog);
nameEdit->setObjectName(QStringLiteral("nameEdit"));
nameEdit->setGeometry(QRect(100, 70, 271, 20));
headLabel->raise();
nameLabel->raise();
checkBox->raise();
ECGlabel->raise();
ECGBox->raise();
nameEdit->raise();
layoutWidget->raise();
retranslateUi(Dialog);
QObject::connect(okButton, SIGNAL(clicked()), Dialog, SLOT(accept()));
QObject::connect(cancelButton, SIGNAL(clicked()), Dialog, SLOT(reject()));
QMetaObject::connectSlotsByName(Dialog);
} // setupUi
void retranslateUi(QDialog *Dialog)
{
Dialog->setWindowTitle(QApplication::translate("Dialog", "Add ECG Rhythm", 0));
okButton->setText(QApplication::translate("Dialog", "OK", 0));
cancelButton->setText(QApplication::translate("Dialog", "Cancel", 0));
headLabel->setText(QApplication::translate("Dialog", "Create a New ECG Rhythm", 0));
#ifndef QT_NO_TOOLTIP
nameLabel->setToolTip(QApplication::translate("Dialog", "The Name of the new ECG Rhythm", 0));
#endif // QT_NO_TOOLTIP
nameLabel->setText(QApplication::translate("Dialog", "Name", 0));
checkBox->setText(QApplication::translate("Dialog", "Copy parameters?", 0));
#ifndef QT_NO_TOOLTIP
ECGlabel->setToolTip(QApplication::translate("Dialog", "The set of predeefined rhythms", 0));
#endif // QT_NO_TOOLTIP
ECGlabel->setText(QApplication::translate("Dialog", "ECG Rythms", 0));
} // retranslateUi
};
namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_ADDECGDIALOG_H
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[5];
atomic_int atom_1_r1_1;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v3_r3 = v2_r1 ^ v2_r1;
int v6_r4 = atomic_load_explicit(&vars[2+v3_r3], memory_order_seq_cst);
int v7_r6 = v6_r4 ^ v6_r4;
atomic_store_explicit(&vars[3+v7_r6], 1, memory_order_seq_cst);
int v9_r9 = atomic_load_explicit(&vars[3], memory_order_seq_cst);
int v10_r10 = v9_r9 ^ v9_r9;
atomic_store_explicit(&vars[4+v10_r10], 1, memory_order_seq_cst);
int v12_r13 = atomic_load_explicit(&vars[4], memory_order_seq_cst);
int v13_cmpeq = (v12_r13 == v12_r13);
if (v13_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
int v18 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v18, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[3], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[0], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[4], 0);
atomic_init(&atom_1_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v14 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v15 = (v14 == 2);
int v16 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v17_conj = v15 & v16;
if (v17_conj == 1) assert(0);
return 0;
}
|
#ifndef __BACKTRACE_H__
#define __BACKTRACE_H__
#include <stdint.h>
void __backtrace(uintptr_t rbp, uintptr_t stack_begin, uintptr_t stack_end);
uintptr_t stack_begin(void);
uintptr_t stack_end(void);
void backtrace(void);
#endif /*__BACKTRACE_H__*/
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[3];
atomic_int atom_0_r3_2;
atomic_int atom_1_r1_1;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 2, memory_order_seq_cst);
int v2_r3 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v3_r4 = v2_r3 ^ v2_r3;
atomic_store_explicit(&vars[1+v3_r4], 1, memory_order_seq_cst);
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
int v14 = (v2_r3 == 2);
atomic_store_explicit(&atom_0_r3_2, v14, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v5_r1 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v6_r3 = v5_r1 ^ v5_r1;
int v7_r3 = v6_r3 + 1;
atomic_store_explicit(&vars[0], v7_r3, memory_order_seq_cst);
int v15 = (v5_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v15, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[0], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[1], 0);
atomic_init(&atom_0_r3_2, 0);
atomic_init(&atom_1_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v8 = atomic_load_explicit(&atom_0_r3_2, memory_order_seq_cst);
int v9 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v10 = (v9 == 2);
int v11 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v12_conj = v10 & v11;
int v13_conj = v8 & v12_conj;
if (v13_conj == 1) assert(0);
return 0;
}
|
/* Dylan Secreast
* [email protected]
* CIS 415 Project 0
* This is my own work except for the base
* code that was provided by Prof. Sventek
*/
#ifndef _DATE_H_INCLUDED_
#define _DATE_H_INCLUDED_
typedef struct date Date;
/*
* date_create creates a Date structure from `datestr`
* `datestr' is expected to be of the form "dd/mm/yyyy"
* returns pointer to Date structure if successful,
* NULL if not (syntax error)
*/
Date *date_create(char *datestr);
/*
* date_duplicate creates a duplicate of `d'
* returns pointer to new Date structure if successful,
* NULL if not (memory allocation failure)
*/
Date *date_duplicate(Date *d);
/*
* date_compare compares two dates, returning <0, 0, >0 if
* date1<date2, date1==date2, date1>date2, respectively
*/
int date_compare(Date *date1, Date *date2);
/*
* date_destroy returns any storage associated with `d' to the system
*/
void date_destroy(Date *d);
#endif /* _DATE_H_INCLUDED_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.