text stringlengths 4 6.14k |
|---|
// This file is part of Chess0, a computer chess program based on Winglet chess
// by Stef Luijten.
//
// Copyright (C) 2022 Claudio M. Camacho
//
// Chess0 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.
//
// Chess0 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
// @file book.h
//
// This file contains the structures to hold an opening book database for the
// chess engine.
#ifndef _BOOK_H_
#define _BOOK_H_
#include <unordered_map>
using namespace std;
// Book functionality
void initBook();
string getReplyTo(string);
// Dictionary containing the database with the openings. We use unordered_map
// because it is the fastest STL data structure for this purpose.
extern unordered_map<string, string> book;
#endif // _BOOK_H_
|
/*
* Copyright (C) 2012 Yee Young Han <websearch@naver.com> (http://blog.naver.com/websearch)
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _STATS_SIP_METHOD_H_
#define _STATS_SIP_METHOD_H_
#include "SipParserDefine.h"
#include "SipMessage.h"
#include <map>
typedef std::map< std::string, uint64_t > STATS_SIP_METHOD_MAP;
/**
* @ingroup KSipServerLogAnalysis
* @brief SIP ¸Þ¼Òµåº° Åë°è ÀúÀå Ŭ·¡½º
*/
class CStatsSipMethod
{
public:
CStatsSipMethod();
~CStatsSipMethod();
void AddSipMessage( CSipMessage * pclsMessage );
void AddSipMethod( const char * pszMethod );
void SaveFile( const char * pszDate );
STATS_SIP_METHOD_MAP * GetMap();
private:
STATS_SIP_METHOD_MAP m_clsMap;
};
extern CStatsSipMethod gclsStatsSipMethod;
#endif
|
/*
Liam - DIY Robot Lawn Mower
MPU-9150 Motion Sensor Library
======================
Licensed under GPLv3
======================
*/
#ifndef _MS9150_H_
#define _MS9150_H_
#include "MotionSensor.h"
#include <Wire.h> // For Compass
#include <I2Cdev.h>
#include <MPU9150.h>
class MS9150 : public MOTIONSENSOR{
public:
virtual boolean initialize();
virtual void updateHeading();
virtual int getHeading();
virtual void setNewTargetHeading();
virtual int headingVsTarget();
virtual int getTiltAngle();
private:
MPU9150 sensor;
};
#endif /* _MS9150_H_ */
|
#include <stdio.h>
int main(int argc, char *argv[]){
int i=0;
int *p=&i;
while(1){
i++;
p++;
printf("%d:%d\n",i,*p);
}
return 0;
}
|
/*********************************************************************
*
* Software License Agreement (BSD License)
*
* Copyright (c) 2008, 2013, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * 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 Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED 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.
*
* Author: Eitan Marder-Eppstein
* David V. Lu!!
*********************************************************************/
#ifndef COSTMAP_2D_VOXEL_LAYER_H_
#define COSTMAP_2D_VOXEL_LAYER_H_
#include <ros/ros.h>
#include <costmap_2d/layer.h>
#include <costmap_2d/layered_costmap.h>
#include <costmap_2d/observation_buffer.h>
#include <costmap_2d/VoxelGrid.h>
#include <nav_msgs/OccupancyGrid.h>
#include <sensor_msgs/LaserScan.h>
#include <laser_geometry/laser_geometry.h>
#include <sensor_msgs/PointCloud.h>
#include <sensor_msgs/PointCloud2.h>
#include <sensor_msgs/point_cloud_conversion.h>
#include <tf/message_filter.h>
#include <message_filters/subscriber.h>
#include <dynamic_reconfigure/server.h>
#include <costmap_2d/VoxelPluginConfig.h>
#include <costmap_2d/obstacle_layer.h>
#include <voxel_grid/voxel_grid.h>
namespace costmap_2d
{
class VoxelLayer : public ObstacleLayer
{
public:
VoxelLayer() :
voxel_grid_(0, 0, 0)
{
costmap_ = NULL; // this is the unsigned char* member of parent class's parent class Costmap2D.
}
virtual ~VoxelLayer();
virtual void onInitialize();
virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, double* max_x,
double* max_y);
void updateOrigin(double new_origin_x, double new_origin_y);
bool isDiscretized()
{
return true;
}
virtual void matchSize();
virtual void reset();
protected:
virtual void setupDynamicReconfigure(ros::NodeHandle& nh);
virtual void resetMaps();
private:
void reconfigureCB(costmap_2d::VoxelPluginConfig &config, uint32_t level);
void clearNonLethal(double wx, double wy, double w_size_x, double w_size_y, bool clear_no_info);
virtual void raytraceFreespace(const costmap_2d::Observation& clearing_observation, double* min_x, double* min_y,
double* max_x, double* max_y);
dynamic_reconfigure::Server<costmap_2d::VoxelPluginConfig> *voxel_dsrv_;
bool publish_voxel_;
ros::Publisher voxel_pub_;
voxel_grid::VoxelGrid voxel_grid_;
double z_resolution_, origin_z_;
unsigned int unknown_threshold_, mark_threshold_, size_z_;
ros::Publisher clearing_endpoints_pub_;
sensor_msgs::PointCloud clearing_endpoints_;
inline bool worldToMap3DFloat(double wx, double wy, double wz, double& mx, double& my, double& mz)
{
if (wx < origin_x_ || wy < origin_y_ || wz < origin_z_)
return false;
mx = ((wx - origin_x_) / resolution_);
my = ((wy - origin_y_) / resolution_);
mz = ((wz - origin_z_) / z_resolution_);
if (mx < size_x_ && my < size_y_ && mz < size_z_)
return true;
return false;
}
inline bool worldToMap3D(double wx, double wy, double wz, unsigned int& mx, unsigned int& my, unsigned int& mz)
{
if (wx < origin_x_ || wy < origin_y_ || wz < origin_z_)
return false;
mx = (int)((wx - origin_x_) / resolution_);
my = (int)((wy - origin_y_) / resolution_);
mz = (int)((wz - origin_z_) / z_resolution_);
if (mx < size_x_ && my < size_y_ && mz < size_z_)
return true;
return false;
}
inline void mapToWorld3D(unsigned int mx, unsigned int my, unsigned int mz, double& wx, double& wy, double& wz)
{
//returns the center point of the cell
wx = origin_x_ + (mx + 0.5) * resolution_;
wy = origin_y_ + (my + 0.5) * resolution_;
wz = origin_z_ + (mz + 0.5) * z_resolution_;
}
inline double dist(double x0, double y0, double z0, double x1, double y1, double z1)
{
return sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) + (z1 - z0) * (z1 - z0));
}
};
} // namespace costmap_2d
#endif // COSTMAP_2D_VOXEL_LAYER_H_
|
/*
* Copyright (c) 2019 Analog Devices Inc.
*
* This file is part of Scopy
* (see http://www.github.com/analogdevicesinc/scopy).
*
* 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 PLOTPICKERWRAPPER_H
#define PLOTPICKERWRAPPER_H
#include<qwt_plot_picker.h>
#include<QPoint>
#include<QPointF>
#include<qwt_axis_id.h>
#include<QWidget>
class PlotPickerWrapper : public QwtPlotPicker
{
public:
PlotPickerWrapper(QwtAxisId xAxis, QwtAxisId yAxis, QWidget *);
QPointF pointCoordinates(const QPoint& pos) const;
private:
};
#endif // PLOTPICKERWRAPPER_H
|
#ifndef VELOCITY_STATE_H_
#define VELOCITY_STATE_H_
#include "bcm_host.h"
#include "interface/vcos/vcos.h"
#include "interface/mmal/mmal.h"
#include "interface/mmal/mmal_logging.h"
#include "interface/mmal/mmal_buffer.h"
#include "interface/mmal/util/mmal_util.h"
#include "interface/mmal/util/mmal_util_params.h"
#include "interface/mmal/util/mmal_default_components.h"
#include "interface/mmal/util/mmal_connection.h"
#include "RaspiCamControl.h"
/** Structure containing all state information for the current run
*/
typedef struct VELOCITY_STATE_T
{
bool running; /// still running
int camera_version; /// version of camera
char *identifier; /// identifier for this camera ie. cam1 or cam2
char *url; /// Url for posting data
bool post_frames;
int camera_position;
RASPICAM_CAMERA_PARAMETERS camera_parameters; /// Camera setup parameters
MMAL_COMPONENT_T *camera_component; /// Pointer to the camera component
MMAL_POOL_T *camera_pool; /// Pointer to the pool of buffers used by camera video port
} VELOCITY_STATE;
void velocity_state_default(VELOCITY_STATE *state);
#define CAMERA_VERSION_13 0
#define CAMERA_VERSION_21 1
typedef struct
{
int version;
int sensor_mode;
int framerate;
// 1. Capture size
int capture_width;
int capture_height;
// 2. Region of interest (crop)
int roi_left;
int roi_top;
int roi_width;
int roi_height;
// 3. Rotate
int rotate;
// 4. Resize
int final_width;
int final_height;
} CAMERA_VERSION_PROPERTIES;
static CAMERA_VERSION_PROPERTIES camera_version_properties[] =
{
{ CAMERA_VERSION_13, 7, 90, // Camera mode, framerate
320, 480, // capture width, height
0, 0, 320, 480, // region of interest
0, // rotate
320, 480 }, // final width height
{ CAMERA_VERSION_21, 6, 90, // Camera mode, framerate
1280, 660, // capture width, height
130, 0, 1020, 660, // region of interest
90, // rotate
320, 480 } // final width height
};
CAMERA_VERSION_PROPERTIES camera_version(int camera_version);
#endif |
/*
* Copyright © 2010 Lubosz Sarnecki
* Config.h
*
* Created on: Dec 20, 2010
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "Common/Singleton.h"
#include "XmlReader.h"
#include <string>
#include <vector>
#include <QDomElement>
#include <QFile>
using std::string;
using std::vector;
template <typename T>
class ConfigOption {
public:
ConfigOption(const string& name, const vector <T> &optionVec)
:name(name), optionVec(optionVec) {}
ConfigOption(const string& name, const T &option)
:name(name) {
optionVec.push_back(option);
}
virtual ~ConfigOption() {}
string name;
vector <T> optionVec;
};
class Config : public Singleton<Config>, public XmlReader {
public:
Config();
virtual ~Config();
void addString(const string &name, const string &option);
void appendOption(const QDomElement & optionNode);
template<typename T> vector<T> getValues(const string & name, const vector<ConfigOption<T>* > & config);
template<typename T> void setValues(const string & name, const vector<T> & values);
template<typename T> T value(const string & name);
template<typename T> vector<T> values(const string & name);
// template<typename T> vector<T> splitValues(QString values);
vector<ConfigOption<bool>* > bools;
vector<ConfigOption<int>* > ints;
vector<ConfigOption<string>* > strings;
vector<ConfigOption<float>* > floats;
QStringList getGLVersion();
void createConfigFile(QFile *file);
string getMediaPrefix();
bool isEnabled(string value);
};
#endif
|
#include "split70.h"
#include "debug.h"
#include "action_layer.h"
|
#pragma once
#include <stdint.h>
void load_turnoff(void);
void load_setduty(uint16_t duty);
void load_init(void);
|
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "ConversationViewLayout.h"
#import "OWSAudioAttachmentPlayer.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, OWSMessageCellType) {
OWSMessageCellType_TextMessage,
OWSMessageCellType_OversizeTextMessage,
OWSMessageCellType_StillImage,
OWSMessageCellType_AnimatedImage,
OWSMessageCellType_Audio,
OWSMessageCellType_Video,
OWSMessageCellType_GenericAttachment,
OWSMessageCellType_DownloadingAttachment,
// Treat invalid messages as empty text messages.
OWSMessageCellType_Unknown = OWSMessageCellType_TextMessage,
};
NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
#pragma mark -
@class ConversationViewCell;
@class DisplayableText;
@class OWSAudioMessageView;
@class TSAttachmentPointer;
@class TSAttachmentStream;
@class TSInteraction;
// This is a ViewModel for cells in the conversation view.
//
// The lifetime of this class is the lifetime of that cell
// in the load window of the conversation view.
//
// Critically, this class implements ConversationViewLayoutItem
// and does caching of the cell's size.
@interface ConversationViewItem : NSObject <ConversationViewLayoutItem, OWSAudioAttachmentPlayerDelegate>
@property (nonatomic, readonly) TSInteraction *interaction;
@property (nonatomic, readonly) BOOL isGroupThread;
@property (nonatomic) BOOL shouldShowDate;
@property (nonatomic) BOOL shouldHideRecipientStatus;
@property (nonatomic) NSInteger row;
// During updates, we sometimes need the previous row index
// (before this update) of this item.
//
// If NSNotFound, this view item was just created in the
// previous update.
@property (nonatomic) NSInteger previousRow;
//@property (nonatomic, weak) ConversationViewCell *lastCell;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithTSInteraction:(TSInteraction *)interaction isGroupThread:(BOOL)isGroupThread;
- (ConversationViewCell *)dequeueCellForCollectionView:(UICollectionView *)collectionView
indexPath:(NSIndexPath *)indexPath;
- (void)replaceInteraction:(TSInteraction *)interaction;
- (void)clearCachedLayoutState;
#pragma mark - Audio Playback
@property (nonatomic, weak) OWSAudioMessageView *lastAudioMessageView;
@property (nonatomic, nullable) NSNumber *audioDurationSeconds;
- (CGFloat)audioProgressSeconds;
#pragma mark - View State Caching
// These methods only apply to text & attachment messages.
- (OWSMessageCellType)messageCellType;
- (nullable DisplayableText *)displayableText;
- (nullable TSAttachmentStream *)attachmentStream;
- (nullable TSAttachmentPointer *)attachmentPointer;
- (CGSize)contentSize;
// We don't want to try to load the media for this item (if any)
// if a load has previously failed.
@property (nonatomic) BOOL didCellMediaFailToLoad;
#pragma mark - UIMenuController
- (NSArray<UIMenuItem *> *)menuControllerItems;
- (BOOL)canPerformAction:(SEL)action;
- (void)copyAction;
- (void)shareAction;
- (void)saveAction;
- (void)deleteAction;
- (SEL)metadataActionSelector;
@end
NS_ASSUME_NONNULL_END
|
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
main(int argc, char **argv) {
int i, n = 20, a[n], suma=0, sumalocal, id = 0;
omp_lock_t c; // creamos el cerrojo
omp_init_lock(&c); // inicializamos el cerrojo (por defecto a unlock)
if(argc < 2) {
fprintf(stderr,"\nFalta iteraciones\n");
exit(-1);
}
n = atoi(argv[1]);
if (n>20)
n=20;
for (i=0; i<n; i++)
a[i] = i;
#pragma omp parallel private(sumalocal) shared(id)
{
sumalocal=0;
#pragma omp for schedule(static)
for (i=0; i<n; i++)
{
sumalocal += a[i];
printf(" thread %d suma de a[%d]=%d sumalocal=%d \n", omp_get_thread_num(),i,a[i],sumalocal);
}
omp_set_lock(&c); // bloqueamos el cerrojo
suma += sumalocal;
omp_unset_lock(&c); // desbloqueamos el cerrrojo
}
printf("Fuera de 'parallel' suma=%d\n",suma); return(0);
}
|
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _CONFIG_RENEWAL_H_
#define _CONFIG_RENEWAL_H_
//quick option to disable all renewal option, used by ./configure
//#define PRERE
#ifndef PRERE
/**
* rAthena configuration file (http://rathena.org)
* For detailed guidance on these check http://rathena.org/wiki/SRC/config/
**/
/**
* @INFO: This file holds general-purpose renewal settings, for class-specific ones check /src/config/classes folder
**/
/// Game renewal server mode
/// (disable by commenting the line)
///
/// Leave this line to enable renewal specific support such as renewal formulas
//#define RENEWAL
/// Renewal cast time
/// (disable by commenting the line)
///
/// Leave this line to enable renewal casting time algorithms and enable fixed cast bonuses.
/// See also default_fixed_castrate in conf/battle/skill.conf for default fixed cast time (default is 20%).
/// Cast time is altered be 2 portion, Variable Cast Time (VCT) and Fixed Cast Time (FCT).
/// By default FCT is 20% of VCT (some skills aren't)
/// - VCT is decreased by DEX * 2 + INT.
/// - FCT is NOT reduced by stats, reduced by equips or buffs.
/// Example:
/// On a skill whos cast time is 10s, only 8s may be reduced. the other 2s are part of a FCT
#define RENEWAL_CAST
/// Renewal drop rate algorithms
/// (disable by commenting the line)
///
/// Leave this line to enable renewal item drop rate algorithms
/// While enabled a special modified based on the difference between the player and monster level is applied
/// Based on the http://irowiki.org/wiki/Drop_System#Level_Factor table
//#define RENEWAL_DROP
/// Renewal exp rate algorithms
/// (disable by commenting the line)
///
/// Leave this line to enable renewal item exp rate algorithms
/// While enabled a special modified based on the difference between the player and monster level is applied
//#define RENEWAL_EXP
/// Renewal level modifier on damage
/// (disable by commenting the line)
///
// Leave this line to enable renewal base level modifier on skill damage (selected skills only)
//#define RENEWAL_LVDMG
/// Renewal ASPD [malufett]
/// (disable by commenting the line)
///
/// Leave this line to enable renewal ASPD
/// - shield penalty is applied
/// - AGI has a greater factor in ASPD increase
/// - there is a change in how skills/items give ASPD
/// - some skill/item ASPD bonuses won't stack
//#define RENEWAL_ASPD
/// Renewal stat calculations
/// (disable by commenting the line)
///
/// Leave this line to enable renewal calculation for increasing status/parameter points
//#define RENEWAL_STAT
#endif
#endif // _CONFIG_RENEWAL_H_
|
/*************************************************************************
> File Name: is_kernel_thread.c
> Author: gatieme
> Created Time: Fri 20 May 2016 03:26:47 PM CST
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int run_command(char *command, char *result)
{
FILE *fstream = NULL;
char buff[81];
if((fstream = popen(command, "r")) == NULL)
{
perror("execute command failed : ");
return -1;
}
memset(buff, 0, sizeof(buff));
while(fgets(buff, sizeof(buff), fstream) != NULL)
{
//printf("%s\n",buff);
strcat(result, buff);
}
pclose(fstream);
return 0;
}
int is_kernel_thread(int pid)
{
char command[81];
char pname[81];
memset(command, 0, 81);
memset(pname, 0, 81);
sprintf(command, "ps -p %d -o command=", pid);
run_command(command, pname);
printf("process PID : %d, command : %s\n", pid, pname);
if(pname[0] == '[')
{
printf("process %d is a kernel thread\n", pid);
return 1;
}
else if(pname[0] != '\0')
{
printf("process %d is a user process\n", pid);
return 0;
}
else
{
printf("no such process %d\n", pid);
}
}
/*
* get the process ID of the parent of the process which you give
*
* ps -p ${pid:-$$} -o ppid=
*
* example, ps -p 1 -o ppid=
* */
int getppid(int pid)
{
}
/*
* get the command of the process which you give
*
* ps -p ${pid:-$$} -o command=
*
* example, ps -p 1 -o command=
* */
int getcommand(int pid, char *result)
{
char command[81];
memset(command, 0, 81);
sprintf(command, "ps -p %d -o command=", pid);
run_command(command, result);
printf("result : %s", result);
}
int test_popen(void)
{
FILE *fstream = NULL;
char buff[1024];
memset(buff, 0, sizeof(buff));
if((fstream = popen("ls -al","r")) == NULL)
{
perror("execute command failed : ");
return -1;
}
while(fgets(buff, sizeof(buff), fstream) != NULL)
{
printf("%s\n",buff);
}
pclose(fstream);
return 0;
}
int main(int argc, char *argv[])
{
if(argc != 2)
{
printf("usage %s pid\n", argv[0]);
exit(-1);
}
is_kernel_thread(atoi(argv[1]));
}
|
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "grid.h"
#define HISTORY_SUFFIX ".sudoku_history"
static char *
create_history_file_name (void)
{
int rv;
const char *HOME;
char *buffer;
HOME = getenv ("HOME");
if (NULL == HOME)
{
fprintf (stderr, "HOME environment variable is not set; history file is disabled\n");
return NULL;
}
rv = asprintf (&buffer, "%s/%s", HOME, HISTORY_SUFFIX);
if (rv < 0)
{
fprintf (stderr, "%s: asprintf failed when creating history file name\n", __FUNCTION__);
return NULL;
}
return buffer;
}
int
main (void)
{
int rv;
grid *g;
bool done;
char *history_file;
history_file = create_history_file_name ();
if (NULL != history_file)
{
rv = read_history (history_file);
if ((0 != rv) && (ENOENT != rv))
fprintf (stderr, "failed to read history file (%s) - %s\n", history_file, strerror (rv));
}
grid_create (&g);
done = false;
do
{
char *line;
bool run_solve = false;
line = readline ("> ");
if (NULL == line)
{
printf ("\n");
done = true;
continue;
}
if ('\0' == line[0])
{
run_solve = true;
}
else
{
int row, column, value;
add_history (line);
if (3 == sscanf (line, "s %d %d %d", &row, &column, &value))
{
grid_add_given_value (g, row, column, value);
run_solve = true;
}
else if (3 == sscanf (line, "x %d %d %d", &row, &column, &value))
{
grid_add_given_exclusion (g, row, column, value);
run_solve = true;
}
else if (('g' == line[0]) && (' ' == line[1]) && (83 == strlen (line)))
{
int i;
grid_clear (g);
for (i = 0; i < 81; i++)
{
char c = line[i + 2];
if ((c >= '1') && (c <= '9'))
grid_add_given_value_at_index (g, i, (value_t) (c - '1' + 1));
}
run_solve = true;
}
else
{
printf ("syntax error\n");
}
}
free (line);
if (run_solve)
{
grid_solve (g);
if (grid_is_consistent (g))
{
grid_pretty_print (g);
}
else
{
printf ("inconsistent\n");
}
}
}
while (!done);
if (NULL != history_file)
{
rv = write_history (history_file);
if (0 != rv)
fprintf (stderr, "failed to write history file (%s) - %s\n", history_file, strerror (rv));
#if USE_VALGRIND
free (history_file);
#endif
}
#if USE_VALGRIND
grid_destroy (g);
rl_clear_history ();
#endif
return EXIT_SUCCESS;
}
|
#pragma once
#include "_CONSTANTS.h"
#define STR(x) #x
#ifdef _LOCKING_ENABLED
#ifdef _LOCK_TRACE
#define LOCK(x) TRACE("Locking ["#x"]");x->lock();
#define UNLOCK(x) TRACE("Unlocking ["#x"]");x->unlock();
#define LOCK_WRITE(x) TRACE("WRITE Locking ["#x"]");x->lock();
#define UNLOCK_WRITE(x) TRACE("WRITE Unlocking ["#x"]");x->unlock();
#else
#define LOCK(x) x->lock();
#define UNLOCK(x) x->unlock();
#define LOCK_WRITE(x) x->lock_write();
#define UNLOCK_WRITE(x) x->unlock_write();
#endif
#else
#define LOCK(x)
#define UNLOCK(x)
#endif
#ifndef RELEASE
#define RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
#endif
#ifndef ARNE_RELEASE
#define ARNE_RELEASE(p) { if (p) { p->release(); delete p; (p)=NULL; } }
#endif
#define DECLARE_MEMBER_SET(type, name) \
virtual inline void set##name(##type value) { this->m_##name = value; }
#define DECLARE_MEMBER_GET(type, name) \
virtual inline type get##name() { return this->m_##name; }
#define DECLARE_MEMBER_PRIVATE(type, name) \
type m_##name;
#define DECLARE_MEMBER(type, name) \
public: \
DECLARE_MEMBER_SET(type, name) \
DECLARE_MEMBER_GET(type, name) \
protected: \
DECLARE_MEMBER_PRIVATE(type, name)
#define DECLARE_GET_FLAG_MEMBER(type, name) \
public: \
type name##() { return this->m_##name; } \
protected: \
DECLARE_MEMBER_PRIVATE(type, name)
#define DECLARE_GET_MEMBER(type, name) \
public: \
DECLARE_MEMBER_GET(type, name) \
protected: \
DECLARE_MEMBER_PRIVATE(type, name)
#define DECLARE_SET_MEMBER(type, name) \
public: \
DECLARE_MEMBER_SET(type, name) \
protected: \
DECLARE_MEMBER_PRIVATE(type, name)
#define DECLARE_INTERFACE_MEMBER_SET(type, name) \
virtual void set##name(##type value) = 0;
#define DECLARE_INTERFACE_MEMBER_GET(type, name) \
virtual type get##name() = 0;
#define DECLARE_INTERFACE_MEMBER(type, name) \
public: \
DECLARE_INTERFACE_MEMBER_SET(type, name) \
DECLARE_INTERFACE_MEMBER_GET(type, name)
#define DECLARE_INTERFACE_GET_MEMBER(type, name) \
public: \
DECLARE_INTERFACE_MEMBER_GET(type, name)
#define RPC_FUNCTION(name) class name## : public IRpcFunction { \
public: \
name##() : m_Name(STR(name)) {} \
~##name(){ } \
acre::Result call(IServer *vServer, IMessage *vMessage)
#define CREATE_ITERATOR(type, name, from) \
type name = from; \
type##::iterator iter_##name;
#define DO_ITERATOR(type,name,from) \
CREATE_ITERATOR(type,name,from) \
for (iter_##name = name##.begin(); \
iter_##name != name##.end(); \
iter_##name++ )
#define WAIT_IF_VALID(handle, wait) if (handle != INVALID_HANDLE_VALUE) { \
WaitForSingleObject(handle, wait); \
}
|
/*
Playdar - music content resolver
Copyright (C) 2009 Richard Jones
Copyright (C) 2009 Last.fm Ltd.
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 __MYAPPLICATION_H__
#define __MYAPPLICATION_H__
//#include <boost/asio.hpp>
//#include <boost/program_options.hpp>
//#include <boost/thread.hpp>
#include <string>
#include <boost/function.hpp>
#include "playdar/config.hpp"
#include "playdar/types.h"
#define VERSION "0.1.0"
//:::
//#include "playdar/playdar_request_handler.h"
//namespace moost{ namespace http{ class server; } } // fwd
namespace playdar {
class Resolver;
class playdar_request_handler;
/*
* Container for all application-level settings,
* and various important resources like the library
* and resolver
*
*/
class MyApplication
{
public:
MyApplication(Config c);
~MyApplication();
Resolver * resolver();
Config * conf()
{
return &m_config;
}
// RANDOM UTILITY FUNCTIONS TOSSED IN HERE FOR NOW:
// swap the http://DOMAIN:PORT bit at the start of a URI
std::string http_swap_base(const std::string& orig, const std::string& newbase)
{
if(orig.at(0) == '/') return newbase + orig;
size_t slash = orig.find_first_of('/', 8); // https:// is at least 8 in
if(std::string::npos == slash) return orig; // WTF?
return newbase + orig.substr(slash);
}
// functor that terminates http server:
void set_http_stopper(boost::function<void()> f) { m_stop_http=f; }
void shutdown(int sig = -1);
private:
boost::function<void()> m_stop_http;
Config m_config;
Resolver * m_resolver;
};
}
#endif
|
/*
* ROX-Filer, filer for the ROX desktop project
* Copyright (C) 2006, Thomas Leonard and others (see changelog for details).
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* session.c - XSMP client support */
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <X11/SM/SMlib.h>
#include <pwd.h>
#include "global.h"
#include "filer.h"
#include "main.h"
#include "pinboard.h"
#include "panel.h"
#include "sc.h"
#include "session.h"
#define ROX_FILER_URI "http://rox.sourceforge.net/2005/interfaces/ROX-Filer"
static gboolean use_0launch;
gboolean session_auto_respawn = FALSE; /* If we were started as 'rox -S' */
static void save_state(SmClient *client)
{
FilerWindow *filer_window;
Panel *panel;
Pinboard *pinboard = current_pinboard;
GList *list;
GPtrArray *restart_cmd = g_ptr_array_new();
SmPropValue *program;
gchar *types[] = { "-t", "-B", "-l", "-r" };
gint i, nvals;
if (use_0launch)
{
g_ptr_array_add(restart_cmd, "0launch");
g_ptr_array_add(restart_cmd, ROX_FILER_URI);
}
else
{
sc_get_prop_value(client, SmProgram, &program, &nvals);
g_ptr_array_add(restart_cmd, program->value);
}
g_ptr_array_add(restart_cmd, "-c");
g_ptr_array_add(restart_cmd, client->id);
for (list = all_filer_windows; list; list = list->next)
{
filer_window = (FilerWindow *)list->data;
gdk_window_set_role(filer_window->window->window,
filer_window->sym_path);
g_ptr_array_add(restart_cmd, "-d");
g_ptr_array_add(restart_cmd, filer_window->sym_path);
}
if (session_auto_respawn)
{
for(i = 0; i < PANEL_NUMBER_OF_SIDES; i++)
{
panel = current_panel[i];
if(!panel)
continue;
g_ptr_array_add(restart_cmd, types[panel->side]);
g_ptr_array_add(restart_cmd, panel->name);
}
if (pinboard)
{
g_ptr_array_add(restart_cmd, "-p");
g_ptr_array_add(restart_cmd, (gchar *) pinboard_get_name());
}
}
else
{
g_ptr_array_add(restart_cmd, "-S");
}
sc_set_list_of_array_prop(client, SmRestartCommand,
(const gchar **) restart_cmd->pdata, restart_cmd->len);
g_ptr_array_free(restart_cmd, TRUE);
}
/* Callbacks for various SM messages */
static gboolean save_yourself(SmClient *client)
{
save_state(client);
return TRUE;
}
static void die(SmClient *client)
{
gtk_main_quit();
}
void session_init(const gchar *client_id)
{
SmClient *client;
struct passwd *pw;
gchar *bin_path;
gchar *clone_cmd[3];
gchar *zerolaunch;
if (!sc_session_up())
return;
pw = getpwuid(euid);
zerolaunch = g_find_program_in_path("0launch");
use_0launch = (zerolaunch != NULL);
g_free(zerolaunch);
if (use_0launch)
{
bin_path = "0launch";
clone_cmd[0] = bin_path;
clone_cmd[1] = ROX_FILER_URI,
clone_cmd[2] = "-n";
}
else
{
bin_path = g_strconcat(app_dir, "/AppRun", NULL);
clone_cmd[0] = bin_path;
clone_cmd[1] = "-n";
clone_cmd[2] = NULL;
}
client = sc_new(client_id);
if (!sc_connect(client))
{
sc_destroy(client);
return;
}
sc_set_array_prop(client, SmProgram, bin_path);
sc_set_array_prop(client, SmUserID, pw->pw_name);
sc_set_list_of_array_prop(client, SmCloneCommand,
(const gchar **) clone_cmd,
clone_cmd[2] == NULL ? 2 : 3);
sc_set_card_prop(client, SmRestartStyleHint,
session_auto_respawn ? SmRestartImmediately : SmRestartIfRunning);
client->save_yourself_fn = &save_yourself;
client->shutdown_cancelled_fn = NULL;
client->save_complete_fn = NULL;
client->die_fn = ¨
}
|
#pragma once
#include <Wt/WContainerwidget>
#include <Wt/WLabel>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include "AppData.h"
#include "Route.h"
using namespace Wt;
enum class RouteAction { ADD, DEL };
class RouteForm : public Route, public WContainerWidget {
private:
WLabel* label;
WLineEdit* edit;
WPushButton* buttonPi;
WPushButton* buttonChuangtseuVpn;
WPushButton* buttonCrous;
WText* text;
public:
RouteForm(WContainerWidget *parent = 0);
~RouteForm();
private:
void buttonPiClicked() { buttonAction(PI); }
void buttonCrousClicked() { buttonAction(CROUS); }
void buttonChuangtseuVpnClicked() { buttonAction(VPN); }
void buttonAction(KnownGatewaysEnum toGateway);
};
|
//
// TuneUtils.h
// Tune
//
// Created by Pavel Yurchenko on 7/24/12.
// Copyright (c) 2012 Scopic Software. All rights reserved.
//
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <MobileCoreServices/UTType.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <UIKit/UIKit.h>
#import <sys/xattr.h>
#import <dlfcn.h>
#import <objc/runtime.h>
#import "TuneReachability.h"
@interface TuneUtils : NSObject
FOUNDATION_EXPORT const float TUNE_IOS_VERSION_501; // float equivalent of 5.0.1
+ (NSString*)generateFBCookieIdString;
+ (NSString *)getUUID;
+ (NSString *)bundleId;
+ (NSDate *)installDate;
+ (BOOL)isNetworkReachable;
+ (NetworkStatus)networkReachabilityStatus;
+ (NSString*)getStringForKey:(NSString*)key fromPasteBoard:(NSString *)pasteBoardName;
+ (id)userDefaultValueforKey:(NSString *)key;
+ (void)setUserDefaultValue:(id)value forKey:(NSString* )key;
+ (void)synchronizeUserDefaults;
+ (BOOL)checkJailBreak;
+ (NSInteger)daysBetweenDate:(NSDate*)fromDateTime andDate:(NSDate*)toDateTime;
+ (float)numericiOSVersion:(NSString *)iOSVersion;
+ (float)numericiOSSystemVersion;
+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
+ (NSString *)jsonSerialize:(id)object;
+ (NSString *)parseXmlString:(NSString *)strXml forTag:(NSString *)tag;
+ (NSString *)hashMd5:(NSString *)input;
+ (NSString *)hashSha1:(NSString *)input;
+ (NSString *)hashSha256:(NSString *)input;
#if TESTING
+ (void)overrideNetworkReachability:(NSString *)reachable;
#endif
/*!
Appends the key, value pair to the query string if the url-encoded value is non-nil.
<code>&key=value</code>
@param value value to be url-encoded and appended to the query string
@param key key to be appended to the query string
@param params query string to which the key-value pair has to be appended
*/
+ (void)addUrlQueryParamValue:(id)value
forKey:(NSString*)key
queryParams:(NSMutableString*)params;
/*!
Converts input object to equivalent string representation for use as value of a url query param.
Returns stringValue for NSNumber*, timeIntervalSince1970 stringValue for NSDate*, and url-encoded string for NSString*, nil otherwise.
*/
+ (NSString *)urlEncodeQueryParamValue:(id)value;
#pragma mark -
+ (NSData *)tuneDataFromBase64String:(NSString *)aString;
+ (NSString *)tuneBase64EncodedStringFromData:(NSData *)data;
#pragma mark -
+ (CGSize)screenSize;
+ (CGRect)screenBoundsForStatusBarOrientation;
@end
|
/*Copyright (C) 2014 Wayne Mogg All rights reserved.
This file may be used either under the terms of:
1. The GNU General Public License version 3 or higher, as published by
the Free Software Foundation, or
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef point3D_h
#define point3D_h
/*+
________________________________________________________________________
Author: Wayne Mogg
Date: January 2014
________________________________________________________________________
-*/
namespace wmGeom
{
template <class T>
class Point3D
{
public:
Point3D(T xx=0,T yy=0, T zz=0);
template <class TT>
Point3D<T>& setFrom(const Point3D<TT>&);
template <class TT>
inline void setXYZ(TT xx,TT yy, TT zz);
inline void setXYZ(T xx,T yy, T zz);
inline Point3D<T>& zero();
inline Point3D<T> operator-();
inline bool operator==(const Point3D<T>&) const;
inline bool operator!=(const Point3D<T>&) const;
inline Point3D<T>& operator+=(T dist);
inline Point3D<T>& operator*=(T factor);
inline Point3D<T>& operator/=(T den);
inline Point3D<T>& operator+=(const Point3D<T>&);
inline Point3D<T>& operator-=(const Point3D<T>&);
inline Point3D<T> operator+(const Point3D<T>&) const;
inline Point3D<T> operator-(const Point3D<T>&) const;
inline Point3D<T> operator*(const T factor) const;
inline Point3D<T> operator/(const T den) const;
inline bool isDefined() const;
inline double abs() const;
inline T sqAbs() const;
inline double distTo(const Point3D<T>&) const;
inline T sqDistTo(const Point3D<T>&) const;
inline T dot(const Point3D<T>&) const;
static Point3D<T> udf() { return Point3D<T>(mUdf(T),mUdf(T)); }
T x;
T y;
T z;
};
template <class T> inline
Point3D<T>::Point3D ( T xx , T yy , T zz )
: x(xx), y(yy), z(zz)
{}
template <class T> template <class TT> inline
Point3D<T>& Point3D<T>::setFrom( const Point3D<TT>& a )
{ x=a.x; y=a.y; z=a.z; return *this;}
template <class T> inline
void Point3D<T>::setXYZ( T xx, T yy, T zz )
{ x = xx ; y = yy; z=zz; }
template <class T> template <class TT> inline
void Point3D<T>::setXYZ( TT xx, TT yy, TT zz )
{ x = (T)xx; y = (T)yy; z = (T)zz; }
template <class T> inline
Point3D<T>& Point3D<T>::zero()
{ x = y = z = 0; return *this; }
template <class T> inline
Point3D<T> Point3D<T>::operator -()
{ return Point3D<T>( -x, -y, -z ); }
template <class T> inline
bool Point3D<T>::operator ==( const Point3D<T>& p ) const
{ return p.x == x && p.y == y && p.z == z; }
template <class T> inline
bool Point3D<T>::operator !=( const Point3D<T>& p ) const
{ return !(*this==p); }
template <class T> inline
Point3D<T>& Point3D<T>::operator+=( T dist )
{ x += dist; y += dist; z += dist; return *this; }
template <class T> inline
Point3D<T>& Point3D<T>::operator*=( T factor )
{ x *= factor; y *= factor; z *= factor; return *this; }
template <class T> inline
Point3D<T>& Point3D<T>::operator/=( T den )
{ x /= den; y /= den; z /= den; return *this; }
template <class T> inline
Point3D<T>& Point3D<T>::operator +=( const Point3D<T>& p )
{ x += p.x; y += p.y; z += p.z; return *this; }
template <class T> inline
Point3D<T>& Point3D<T>::operator -=( const Point3D<T>& p )
{ x -= p.x; y -= p.y; z -= p.z; return *this; }
template <class T> inline
Point3D<T> Point3D<T>::operator +( const Point3D<T>& p ) const
{ return Point3D<T>(x+p.x,y+p.y,z+p.z); }
template <class T> inline
Point3D<T> Point3D<T>::operator -( const Point3D<T>& p ) const
{ return Point3D<T>(x-p.x,y-p.y,z-p.z); }
template <class T> inline
Point3D<T> Point3D<T>::operator *( const T factor ) const
{ return Point3D<T>(factor*x,factor*y,factor*z); }
template <class T> inline
Point3D<T> Point3D<T>::operator /( const T den ) const
{ return Point3D<T>(x/den,y/den,z/den); }
template <class T> inline
bool Point3D<T>::isDefined() const
{ return !mIsUdf(x) && !mIsUdf(y) && !mIsUdf(z); }
template <class T> inline
double Point3D<T>::abs() const
{ return ::Math::Sqrt( (double)sqAbs() ); }
template <class T> inline
T Point3D<T>::sqAbs() const
{ return x*x + y*y + z*z; }
template <class T> inline
double Point3D<T>::distTo( const Point3D<T>& pt ) const
{ return ::Math::Sqrt( (double)sqDistTo(pt) ); }
template <class T> inline
T Point3D<T>::sqDistTo( const Point3D<T>& pt ) const
{
const T xdiff = x-pt.x;
const T ydiff = y-pt.y;
const T zdiff = z-pt.z;
return xdiff*xdiff + ydiff*ydiff + zdiff*zdiff;
}
template <class T> inline
T Point3D<T>::dot( const Point3D<T>& pt ) const
{
return x*pt.x + y*pt.y + z*pt.z;
}
}
#endif
|
//========================================================================
// This software is free: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3,
// as published by the Free Software Foundation.
//
// 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. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// Version 3 in the file COPYING that came with this distribution.
// If not, see <http://www.gnu.org/licenses/>.
//========================================================================
/*!
\file field_default_constants.h
\brief Definition of field dimensions
\author Stefan Zickler / Tim Laue, (C) 2009
*/
//========================================================================
#ifndef FIELD_DEFAULT_CONSTANTS_H
#define FIELD_DEFAULT_CONSTANTS_H
namespace FieldConstantsRoboCup2009 {
static const int line_width = 10;
static const int field_length=6050;
static const int field_width=4050;
static const int boundary_width=250;
static const int referee_width=425;
static const int goal_width=700;
static const int goal_depth=180;
static const int goal_wall_width=20;
static const int center_circle_radius=500;
static const int defense_radius=500;
static const int defense_stretch=350;
static const int free_kick_from_defense_dist=200;
static const int penalty_spot_from_field_line_dist=450;
static const int penalty_line_from_spot_dist=400;
}
namespace FieldConstantsRoboCupSPL2012 {
static const int line_width = 50;
static const int field_length=6000;
static const int field_width=4000;
static const int boundary_width=700;
static const int referee_width=700; // ???
static const int goal_width=1400;
static const int goal_depth=400;
static const int goal_wall_width=100;
static const int center_circle_radius=600;
static const int defense_radius=600; // ???
static const int defense_stretch=1000; // ???
static const int free_kick_from_defense_dist=200; // ??
static const int penalty_spot_from_field_line_dist=1800;
static const int penalty_line_from_spot_dist=1200; // ??
}
#endif // FIELD_H
|
#include <verifier-builtins.h>
#include <stdlib.h>
struct node {
struct node *next;
int value;
};
struct list {
struct node *slist;
struct list *next;
};
static void inspect_before(struct list *shape)
{
// we should get a list of sub-lists of length exactly one
___SL_ASSERT(shape);
for (; shape->next; shape = shape->next) {
___SL_ASSERT(shape);
___SL_ASSERT(shape->next);
___SL_ASSERT(shape->slist);
___SL_ASSERT(shape->slist->next == NULL);
}
// check the last node separately to make the exercising more fun
___SL_ASSERT(shape);
___SL_ASSERT(shape->next == NULL);
___SL_ASSERT(shape->slist);
___SL_ASSERT(shape->slist->next == NULL);
}
static void inspect_after(struct list *shape)
{
// we should get exactly one node at the top level and one nested list
___SL_ASSERT(shape);
___SL_ASSERT(shape->next == NULL);
___SL_ASSERT(shape->slist != NULL);
// the nested list should be zero terminated (iterator back by one node)
struct node *pos;
for (pos = shape->slist; pos->next; pos = pos->next);
___SL_ASSERT(!pos->next);
}
static void merge_single_node(struct node ***ppdst,
struct node **psrc)
{
// pick up the current item and jump to the next one
struct node *node = *psrc;
*psrc = node->next;
node->next = NULL;
// insert the item into dst and move cursor
**ppdst = node;
*ppdst = &node->next;
}
static void merge_pair(struct node **pdst,
struct node *sub1,
struct node *sub2)
{
// merge two sorted sub-lists into one
while (sub1 || sub2) {
if (!sub2 || (sub1 && sub1->value < sub2->value))
merge_single_node(&pdst, &sub1);
else
merge_single_node(&pdst, &sub2);
}
}
static struct list* seq_sort_core(struct list *data)
{
struct list *dst = NULL;
while (data) {
struct list *next = data->next;
if (!next) {
// take any odd/even padding as it is
data->next = dst;
dst = data;
break;
}
// take the current sub-list and the next one and merge them into one
merge_pair(&data->slist, data->slist, next->slist);
data->next = dst;
dst = data;
// free the just processed sub-list and jump to the next pair
data = next->next;
free(next);
}
return dst;
}
void seq_sort(struct list **ptr_to_seq)
{
struct list *tmp = *ptr_to_seq;
#ifndef HAVE_ADVANCED_VAR_KILLER
*ptr_to_seq = NULL;
#endif
// do O(log N) iterations
while (tmp->next)
tmp = seq_sort_core(tmp);
*ptr_to_seq = tmp;
}
int main()
{
struct list *seq = NULL;
while (___sl_get_nondet_int()) {
struct node *node = malloc(sizeof *node);
if (!node)
abort();
node->next = NULL;
node->value = ___sl_get_nondet_int();
struct list *item = malloc(sizeof *item);
if (!item)
abort();
item->slist = node;
item->next = seq;
seq = item;
}
if (!seq)
return EXIT_SUCCESS;
inspect_before(seq);
seq_sort(&seq);
inspect_after(seq);
struct node *node = seq->slist;
free(seq);
while (node) {
struct node *snext = node->next;
free(node);
node = snext;
}
return EXIT_SUCCESS;
}
/**
* @file test-0207.c
*
* @brief var killer benchmark (merge of test-0168 and test-0177)
*
* @attention
* This description is automatically imported from tests/predator-regre/README.
* Any changes made to this comment will be thrown away on the next import.
*/
|
/* mock_malloc.c - debug wrapper for malloc
*
* Copyright (C) 2014 Charles Lehner
* This file is part of ll.
*
* ll 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.
*
* ll is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mock_malloc.h"
#include <stdlib.h>
void my_free(void *ptr)
{
free_calls++;
free(ptr);
}
void *my_malloc(size_t size)
{
malloc_calls++;
return malloc(size);
}
|
// A class representing a random closed knot.
//
// Copyright © 1997-2009 Jens Kilian
//
// This file is part of XamhainII.
//
// XamhainII 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.
//
// XamhainII 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 XamhainII. If not, see <http://www.gnu.org/licenses/>.
#ifndef CLOSEDKNOT_H
#define CLOSEDKNOT_H
#include <OpenGL/gl.h>
class KnotStyle;
#include "Position.h"
#include "RectangularKnot.h"
class ClosedKnot : public RectangularKnot
{
typedef RectangularKnot inherited;
public:
ClosedKnot(const KnotStyle &knotStyle,
int windowWidth, int windowHeight);
virtual ~ClosedKnot(void);
private:
ClosedKnot(const ClosedKnot &orig);
ClosedKnot &operator =(ClosedKnot &orig);
virtual void
draw(Position where, GLfloat angle) const;
};
#endif // CLOSEDKNOT_H
|
/*
* Copyright 2010-2020 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom 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.
*
* OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENXCOM_RULEMAPSCRIPT_H
#define OPENXCOM_RULEMAPSCRIPT_H
#include <map>
//#include <string>
#include <vector>
#include <SDL/SDL_video.h>
#include <yaml-cpp/yaml.h>
namespace OpenXcom
{
struct MCDReplacement
{
int
dataSet,
entry;
};
struct TunnelData
{
int level;
std::map<std::string, MCDReplacement> replacements;
///
const MCDReplacement* getMcdReplacement(const std::string& type)
{
if (replacements.find(type) != replacements.end())
return &replacements[type];
return nullptr;
}
};
enum MapScriptDirective
{
MSD_UNDEFINED = -1, // -1
MSD_ADDBLOCK, // 0
MSD_ADDLINE, // 1
MSD_ADDCRAFT, // 2
MSD_ADDUFO, // 3
MSD_DIGTUNNEL, // 4
MSD_FILLAREA, // 5
MSD_CHECKBLOCK, // 6
MSD_REMOVE, // 7
MSD_RESIZE // 8
};
enum MapDirection
{
MD_NONE, // 0
MD_VERTICAL, // 1
MD_HORIZONTAL, // 2
MD_BOTH // 3
};
class MapBlock;
class RuleTerrain;
/**
* A class for handling battlefield designs.
*/
class RuleMapScript
{
private:
size_t _id;
int
_sizeX,
_sizeY,
_sizeZ,
_percent,
_iterations,
_frequency;
TunnelData* _tunnelData;
MapDirection _direction;
MapScriptDirective _type;
std::string _ufoType;
std::vector<int>
_blocks,
_blocksTest,
_freqs,
_freqsTest,
_groups,
_groupsTest,
_limit,
_limitTest,
_prereqs;
std::vector<SDL_Rect*> _rects;
/// Randomly generates a group from the array.
int getGroup();
/// Randomly generates a block number from the array.
int getBlock();
public:
/// Constructs a RuleMapScript.
RuleMapScript();
/// Destructs the RuleMapScript.
~RuleMapScript();
/// Loads information from a ruleset-file.
void load(const YAML::Node& node);
/// Initializes all the variables and stuff for a RuleMapScript directive.
void init();
/// Gets what type of directive this is.
MapScriptDirective getType() const
{ return _type; };
/// Gets the rects, describing the areas this directive applies to.
const std::vector<SDL_Rect*>* getRects() const
{ return &_rects; };
/// Gets the X size for this directive.
int getSizeX() const
{ return _sizeX; };
/// Gets the Y size for this directive.
int getSizeY() const
{ return _sizeY; };
/// Gets the Z size for this directive.
int getSizeZ() const
{ return _sizeZ; };
/// Get the chances of this directive executing.
int getPercent() const
{ return _percent; };
/// Gets the ID of this directive.
size_t getId() const
{ return _id; };
/// Gets how many times this directive repeats (1 repeat means 2 executions)
int getIterations() const
{ return _iterations; };
/// Gets what conditions apply to this directive.
const std::vector<int>* getPrereqs() const
{ return &_prereqs; };
/// Gets the groups-vector for iteration.
const std::vector<int>* getGroups() const
{ return &_groups; };
/// Gets the blocks-vector for iteration.
const std::vector<int>* getBlocks() const
{ return &_blocks; };
/// Gets the direction this directive goes (for lines and tunnels).
MapDirection getDirection() const
{ return _direction; };
/// Gets the MCD-replacement-data for tunnel-replacements.
TunnelData* getTunnelData() const
{ return _tunnelData; };
/// Gets a MapBlock from an array of either groups or blocks.
MapBlock* getNextBlock(const RuleTerrain* const terrainRule);
/// Gets the ufo-type for the ADD-UFO directive.
const std::string& getUfoType() const;
};
}
#endif
|
/*
* Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat 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.
*
* WeeChat 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 WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_UTF8_H
#define WEECHAT_UTF8_H 1
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <wchar.h>
extern int local_utf8;
extern void utf8_init ();
extern int utf8_has_8bits (const char *string);
extern int utf8_is_valid (const char *string, char **error);
extern void utf8_normalize (char *string, char replacement);
extern char *utf8_prev_char (const char *string_start, const char *string);
extern char *utf8_next_char (const char *string);
extern int utf8_char_int (const char *string);
extern void utf8_int_string (unsigned int unicode_value, char *string);
extern wint_t utf8_wide_char (const char *string);
extern int utf8_char_size (const char *string);
extern int utf8_strlen (const char *string);
extern int utf8_strnlen (const char *string, int bytes);
extern int utf8_strlen_screen (const char *string);
extern int utf8_charcmp (const char *string1, const char *string2);
extern int utf8_charcasecmp (const char *string1, const char *string2);
extern int utf8_charcasecmp_range (const char *string1, const char *string2,
int range);
extern int utf8_char_size_screen (const char *string);
extern char *utf8_add_offset (const char *string, int offset);
extern int utf8_real_pos (const char *string, int pos);
extern int utf8_pos (const char *string, int real_pos);
extern char *utf8_strndup (const char *string, int length);
#endif /* WEECHAT_UTF8_H */
|
/*
* BitMeterOS
* http://codebox.org.uk/bitmeterOS
*
* Copyright (c) 2011 Rob Dawson
*
* Licensed under the GNU General Public License
* http://www.gnu.org/licenses/gpl.txt
*
* This file is part of BitMeterOS.
*
* BitMeterOS 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.
*
* BitMeterOS 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 BitMeterOS. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include "client.h"
#include "bmws.h"
#include "common.h"
#define NO_TS -1
/*
Handles '/sync' requests received by the web server.
*/
void processSyncRequest(SOCKET fd, struct Request* req){
time_t ts = (time_t) getValueNumForName("ts", req->params, NO_TS);
if (ts == NO_TS){
// We need a 'ts' parameter
writeHeadersServerError(fd, "processSyncRequest ts param missing/invalid: %s", getValueForName("ts", req->params, NULL));
} else {
writeHeadersOk(fd, SYNC_CONTENT_TYPE, TRUE);
struct Data* results = getSyncValues(ts);
struct Data* thisResult = results;
while(thisResult != NULL){
writeSyncData(fd, thisResult);
thisResult = thisResult->next;
}
freeData(results);
}
}
|
/**
@file input_pentas.h
@brief prototype declarations for reading penta inputs
*/
#ifndef INPUT_PENTAS_H
#define INPUT_PENTAS_H
/**
@fn int penta_contractions( struct tetra_info *pentas , size_t *npentas , struct inputs *INPUT , const size_t nprops , const GLU_bool first_pass )
@brief read the input file to get the pentaquark contractions
@param pentas :: pentaquark contraction map
@param npentas :: number of pentaquark contractions
@param INPUT :: input file data
@param nprops :: number of propagators listed in the input file
@param first_pass :: is this the first pass of reading the input file?
*/
int
penta_contractions( struct penta_info *pentas ,
size_t *npentas ,
struct inputs *INPUT ,
const size_t nprops ,
const GLU_bool first_pass ) ;
#endif
|
/* 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 v12_r9 = atomic_load_explicit(&vars[3], memory_order_seq_cst);
int v13_r10 = v12_r9 ^ v12_r9;
int v16_r11 = atomic_load_explicit(&vars[4+v13_r10], memory_order_seq_cst);
int v17_cmpeq = (v16_r11 == v16_r11);
if (v17_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
int v19_r13 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v23 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v23, memory_order_seq_cst);
int v24 = (v19_r13 == 0);
atomic_store_explicit(&atom_1_r13_0, v24, 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[4], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[0], 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 v20 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v21 = atomic_load_explicit(&atom_1_r13_0, memory_order_seq_cst);
int v22_conj = v20 & v21;
if (v22_conj == 1) assert(0);
return 0;
}
|
#ifndef CT_EDGEATTRIBUTESNORMAL_H
#define CT_EDGEATTRIBUTESNORMAL_H
#include "ct_itemdrawable/abstract/ct_abstractedgeattributes.h"
#include "ct_attributes/ct_attributesnormal.h"
class PLUGINSHAREDSHARED_EXPORT CT_EdgeAttributesNormal : public CT_AbstractEdgeAttributes, public CT_AttributesNormal
{
Q_OBJECT
CT_TYPE_IMPL_MACRO(CT_EdgeAttributesNormal, CT_AbstractEdgeAttributes, Edge normal attributes)
public:
CT_EdgeAttributesNormal();
CT_EdgeAttributesNormal(const CT_OutAbstractSingularItemModel *model,
const CT_AbstractResult *result,
CT_ECIR pcir);
CT_EdgeAttributesNormal(const CT_OutAbstractSingularItemModel *model,
const CT_AbstractResult *result,
CT_ECIR pcir,
CT_AbstractNormalCloud *nc);
CT_EdgeAttributesNormal(const QString &modelName,
const CT_AbstractResult *result,
CT_ECIR pcir);
CT_EdgeAttributesNormal(const QString &modelName,
const CT_AbstractResult *result,
CT_ECIR pcir,
CT_AbstractNormalCloud *nc);
size_t attributesSize() const { return CT_AttributesNormal::attributesSize(); }
CT_AbstractItemDrawable* copy(const CT_OutAbstractItemModel *model, const CT_AbstractResult *result, CT_ResultCopyModeList copyModeList);
};
#endif // CT_EDGEATTRIBUTESNORMAL_H
|
#ifndef TTY_H
#define TTY_H
#include "system.h"
typedef struct color {
uint8_t r;
uint8_t g;
uint8_t b;
} color_t;
void tty_init(uintptr_t framebuffer_addr, uint8_t framebuffer_bpp, uint32_t framebuffer_width, uint32_t framebuffer_height, uint32_t framebuffer_pitch, uint8_t framebuffer_type);
void tty_clear();
void tty_putc(char c);
uint8_t tty_get_cursor_x();
uint8_t tty_get_cursor_y();
void tty_set_cursor_x(uint8_t _x);
void tty_set_cursor_y(uint8_t _y);
// Foreground color
void tty_set_foreground_color(color_t _fg);
color_t tty_get_foreground_color();
// Background color
void tty_set_background_color(color_t _bg);
color_t tty_get_background_color();
#endif
|
#pragma once
#include <cstddef>
#include <string>
#include <list>
#include "../util/str.h"
namespace goofy::gopher::request
{
class Request
{
public:
Request(const char* selector, size_t len);
std::string selector() const;
std::list<util::StrRef> query() const;
std::string as_path() const;
std::string url() const;
const std::string raw_body;
const bool is_url;
private:
const char separator;
const size_t first;
};
}
|
/*
* Copyright (C) 2015 Stuart Howarth <showarth@marxoft.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MKTRACK_H
#define MKTRACK_H
#include <QObject>
#include <QUrl>
class MKTrack : public QObject
{
Q_OBJECT
Q_PROPERTY(QString artist READ artist NOTIFY artistChanged)
Q_PROPERTY(QString artistId READ artistId NOTIFY artistIdChanged)
Q_PROPERTY(QString date READ date NOTIFY dateChanged)
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
Q_PROPERTY(bool downloadable READ isDownloadable NOTIFY downloadableChanged)
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
Q_PROPERTY(QString durationString READ durationString NOTIFY durationChanged)
Q_PROPERTY(QString format READ format NOTIFY formatChanged)
Q_PROPERTY(QString genre READ genre NOTIFY genreChanged)
Q_PROPERTY(QString id READ id NOTIFY idChanged)
Q_PROPERTY(QUrl largeThumbnailUrl READ largeThumbnailUrl NOTIFY largeThumbnailUrlChanged)
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl NOTIFY thumbnailUrlChanged)
Q_PROPERTY(qint64 playCount READ playCount NOTIFY playCountChanged)
Q_PROPERTY(QString service READ service NOTIFY serviceChanged)
Q_PROPERTY(qint64 size READ size NOTIFY sizeChanged)
Q_PROPERTY(QString sizeString READ sizeString NOTIFY sizeChanged)
Q_PROPERTY(QUrl streamUrl READ streamUrl NOTIFY streamUrlChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
public:
explicit MKTrack(QObject *parent = 0);
explicit MKTrack(const MKTrack *track, QObject *parent = 0);
QString artist() const;
QString artistId() const;
QString date() const;
QString description() const;
bool isDownloadable() const;
qint64 duration() const;
QString durationString() const;
QString format() const;
QString genre() const;
QString id() const;
QUrl largeThumbnailUrl() const;
QUrl thumbnailUrl() const;
qint64 playCount() const;
QString service() const;
qint64 size() const;
QString sizeString() const;
QUrl streamUrl() const;
QString title() const;
QUrl url() const;
Q_INVOKABLE virtual void loadTrack(MKTrack *track);
public Q_SLOTS:
virtual void played();
protected:
void setArtist(const QString &a);
void setArtistId(const QString &i);
void setDate(const QString &d);
void setDescription(const QString &d);
void setDownloadable(bool d);
void setDuration(qint64 d);
void setDurationString(const QString &s);
void setFormat(const QString &f);
void setGenre(const QString &g);
void setId(const QString &id);
void setLargeThumbnailUrl(const QUrl &u);
void setThumbnailUrl(const QUrl &u);
void setPlayCount(qint64 c);
void setService(const QString &s);
void setSize(qint64 s);
void setSizeString(const QString &s);
void setStreamUrl(const QUrl &u);
void setTitle(const QString &t);
void setUrl(const QUrl &u);
Q_SIGNALS:
void artistChanged();
void artistIdChanged();
void changed();
void dateChanged();
void descriptionChanged();
void downloadableChanged();
void durationChanged();
void formatChanged();
void genreChanged();
void idChanged();
void largeThumbnailUrlChanged();
void thumbnailUrlChanged();
void playCountChanged();
void serviceChanged();
void sizeChanged();
void streamUrlChanged();
void titleChanged();
void urlChanged();
private:
QString m_artist;
QString m_artistId;
QString m_date;
QString m_description;
bool m_downloadable;
qint64 m_duration;
QString m_durationString;
QString m_format;
QString m_genre;
QString m_id;
QUrl m_largeThumbnailUrl;
QUrl m_thumbnailUrl;
qint64 m_playCount;
QString m_service;
qint64 m_size;
QString m_sizeString;
QUrl m_streamUrl;
QString m_title;
QUrl m_url;
friend class AudioPlayer;
friend class AudioPlayerMetaData;
};
#endif // MKTRACK_H
|
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
*
* 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 PROCESSINDICATOR_H
#define PROCESSINDICATOR_H
#include <glib.h>
#define PROGRESSINDICATOR_HOOKLIST "progressindicator_hooklist"
typedef struct _ProgressData ProgressData;
typedef enum {
PROGRESS_COMMAND_START,
PROGRESS_COMMAND_SET_PERCENTAGE,
PROGRESS_COMMAND_STOP,
} ProgressCommand;
typedef enum {
PROGRESS_TYPE_NETWORK,
} ProgressType;
struct _ProgressData {
ProgressCommand cmd;
ProgressType type;
gfloat value;
};
void progressindicator_start(ProgressType type);
void progressindicator_set_percentage(ProgressType type, gfloat percent);
void progressindicator_stop(ProgressType type);
#endif /* PROCESSINDICATOR_H */
|
#ifndef OBSERVER_H_
#define OBSERVER_H_
#include <cstdio>
#include <string>
#include <list>
using namespace std;
// ¹Û²ìÕßģʽ£¨observer£©£ºÈöà¸ö¹Û²ìÕß¶ÔÏóͬʱ
// ¼àÌýͬһ¸öÖ÷Ìâ¶ÔÏ󣬵±Ö÷Ìâ¶ÔÏó״̬·¢Éú±ä»¯Ê±£¬
// Äܹ»Í¨ÖªËùÓеĹ۲ìÕß
// ¹Û²ìÕß
class Observer
{
public:
virtual void Update() = 0;
};
// ֪ͨÕß
class Subject
{
public:
virtual void Attach(Observer* o) = 0;
virtual void Detach(Observer* o) = 0;
virtual void Notify() = 0;
};
class ConcreteSub : public Subject
{
private:
list<Observer*> l_observer_;
string status_;
public:
void Attach(Observer* o)
{
l_observer_.push_back(o);
}
void Detach(Observer* o)
{
l_observer_.remove(o);
}
void Notify()
{
list<Observer*>::iterator it = l_observer_.begin();
for (; it != l_observer_.end(); it++)
{
(dynamic_cast<Observer*>(*it))->Update();
}
}
void SetState(const char* s)
{
status_ = s;
}
string GetState()
{
return status_;
}
};
class ConcreteObserver : public Observer
{
private:
ConcreteSub* sub_;
string name_;
string status_;
public:
void Update()
{
status_ = sub_->GetState();
printf("%s",sub_->GetState().c_str());
}
ConcreteObserver(const char* name) : name_(name){}
void SetSub(ConcreteSub* sub)
{
sub_ = sub;
}
ConcreteSub* GetSub()
{
return sub_;
}
};
#endif
|
#ifndef _PYTHONQTSTDDECORATORS_H
#define _PYTHONQTSTDDECORATORS_H
/*
*
* Copyright (C) 2010 MeVis Medical Solutions AG All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact information: MeVis Medical Solutions AG, Universitaetsallee 29,
* 28359 Bremen, Germany or:
*
* http://www.mevis.de
*
*/
//----------------------------------------------------------------------------------
/*!
// \file PythonQtStdDecorators.h
// \author Florian Link
// \author Last changed by $Author: florian $
// \date 2007-04
*/
//----------------------------------------------------------------------------------
#include "PythonQtPythonInclude.h"
#include "PythonQtSystem.h"
#include <QObject>
#include <QVariantList>
#include <QTextDocument>
#include <QColor>
#include <QDateTime>
#include <QDate>
#include <QTime>
class PYTHONQT_EXPORT PythonQtStdDecorators : public QObject
{
Q_OBJECT
public slots:
bool connect(QObject* sender, const QByteArray& signal, PyObject* callable);
bool connect(QObject* sender, const QByteArray& signal, QObject* receiver, const QByteArray& slot);
bool disconnect(QObject* sender, const QByteArray& signal, PyObject* callable);
bool disconnect(QObject* sender, const QByteArray& signal, QObject* receiver, const QByteArray& slot);
QObject* parent(QObject* o);
void setParent(QObject* o, QObject* parent);
const QObjectList* children(QObject* o);
QObject* findChild(QObject* parent, PyObject* type, const QString& name = QString());
QList<QObject*> findChildren(QObject* parent, PyObject* type, const QString& name= QString());
QList<QObject*> findChildren(QObject* parent, PyObject* type, const QRegExp& regExp);
bool setProperty(QObject* o, const char* name, const QVariant& value);
QVariant property(QObject* o, const char* name);
double static_Qt_qAbs(double a) { return qAbs(a); }
double static_Qt_qBound(double a,double b,double c) { return qBound(a,b,c); }
void static_Qt_qDebug(const QByteArray& msg) { qDebug("%s", msg.constData()); }
// TODO: multi arg qDebug...
void static_Qt_qWarning(const QByteArray& msg) { qWarning("%s", msg.constData()); }
// TODO: multi arg qWarning...
void static_Qt_qCritical(const QByteArray& msg) { qCritical("%s", msg.constData()); }
// TODO: multi arg qCritical...
void static_Qt_qFatal(const QByteArray& msg) { qFatal("%s", msg.constData()); }
// TODO: multi arg qFatal...
bool static_Qt_qFuzzyCompare(double a, double b) { return qFuzzyCompare(a, b); }
double static_Qt_qMax(double a, double b) { return qMax(a, b); }
double static_Qt_qMin(double a, double b) { return qMin(a, b); }
int static_Qt_qRound(double a) { return qRound(a); }
qint64 static_Qt_qRound64(double a) { return qRound64(a); }
const char* static_Qt_qVersion() { return qVersion(); }
int static_Qt_qrand() { return qrand(); }
void static_Qt_qsrand(uint a) { qsrand(a); }
QString tr(QObject* obj, const QByteArray& text, const QByteArray& ambig = QByteArray(), int n = -1);
QByteArray static_Qt_SIGNAL(const QByteArray& s) { return QByteArray("2") + s; }
QByteArray static_Qt_SLOT(const QByteArray& s) { return QByteArray("1") + s; }
private:
QObject* findChild(QObject* parent, const char* typeName, const QMetaObject* meta, const QString& name);
int findChildren(QObject* parent, const char* typeName, const QMetaObject* meta, const QString& name, QList<QObject*>& list);
int findChildren(QObject* parent, const char* typeName, const QMetaObject* meta, const QRegExp& regExp, QList<QObject*>& list);
};
#endif
|
/* gb-devhelp-search-result.c
*
* Copyright (C) 2015 Christian Hergert <christian@hergert.me>
*
* 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/>.
*/
#include <glib/gi18n.h>
#include "gb-devhelp-search-result.h"
struct _GbDevhelpSearchResult
{
IdeSearchResult parent_instance;
gchar *uri;
};
enum
{
PROP_0,
PROP_URI,
LAST_PROP
};
G_DEFINE_TYPE (GbDevhelpSearchResult, gb_devhelp_search_result, IDE_TYPE_SEARCH_RESULT)
static GParamSpec *gParamSpecs [LAST_PROP];
static void
gb_devhelp_search_result_finalize (GObject *object)
{
GbDevhelpSearchResult *self = (GbDevhelpSearchResult *)object;
g_clear_pointer (&self->uri, g_free);
G_OBJECT_CLASS (gb_devhelp_search_result_parent_class)->finalize (object);
}
static void
gb_devhelp_search_result_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GbDevhelpSearchResult *self = GB_DEVHELP_SEARCH_RESULT (object);
switch (prop_id)
{
case PROP_URI:
g_value_set_string (value, self->uri);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
gb_devhelp_search_result_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GbDevhelpSearchResult *self = GB_DEVHELP_SEARCH_RESULT (object);
switch (prop_id)
{
case PROP_URI:
self->uri = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
gb_devhelp_search_result_class_init (GbDevhelpSearchResultClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gb_devhelp_search_result_finalize;
object_class->get_property = gb_devhelp_search_result_get_property;
object_class->set_property = gb_devhelp_search_result_set_property;
gParamSpecs [PROP_URI] =
g_param_spec_string ("uri",
_("URI"),
_("The URI to the Devhelp document."),
NULL,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
}
static void
gb_devhelp_search_result_init (GbDevhelpSearchResult *result)
{
}
|
//============== IV:Multiplayer - https://github.com/Neproify/ivmultiplayer ==============
//
// File: Commands.h
// Project: Client.Core
// Author(s): jenksta
// License: See LICENSE in root directory
//
//==============================================================================
// TODO: CDefaultCommands
#pragma once
void RegisterCommands();
|
#include <stdlib.h>
#include "string.h"
#include "element.h"
#include "debug.h"
void f_add(element_t* a, element_t* b) {
f_addr(a,b,a);
}
void f_mult(element_t* a, element_t* b) {
f_multr(a,b,a);
}
void f_add_inv(element_t* a) {
f_add_invr(a,a);
}
void f_mult_inv(element_t* a) {
f_mult_invr(a,a);
}
void f_add_id(element_t* a) {
f_add_idr(a);
}
void f_mult_id(element_t* a) {
f_mult_idr(a);
}
void f_rand(element_t *a) {
f_randr(a);
}
void f_sub(element_t* a, element_t* b) {
f_subr(a,b,a);
}
void f_div(element_t* a, element_t* b) {
f_divr(a,b,a);
}
void f_addr(element_t* a, element_t* b, element_t* result) {
a->field->add(a,b,result);
}
void f_multr(element_t* a, element_t* b, element_t* result) {
a->field->mult(a,b,result);
}
void f_add_invr(element_t* a, element_t* result) {
a->field->addinv(a,result);
}
void f_mult_invr(element_t* a, element_t* result) {
a->field->multinv(a,result);
}
void f_add_idr(element_t* result) {
result->field->addid(result);
}
void f_mult_idr(element_t* result) {
result->field->multid(result);
}
void f_randr(element_t* result) {
result->field->randelement(result);
}
void f_subr(element_t* a, element_t* b, element_t* result) {
element_t* invb = malloc(a->size);
assign(invb, b);
f_add_invr(b,invb);
f_addr(a,invb,result);
free(invb);
}
void f_divr(element_t* a, element_t* b, element_t* result) {
element_t* invb = malloc(a->size);
assign(invb, b);
f_mult_invr(b,invb);
f_multr(a,invb,result);
free(invb);
}
int f_sizeof(element_t* a) {
return a->size;
}
void assign(element_t* a, element_t* b) {
memcpy((void*) a, (void*) b, b->size);
}
|
#include "ppm.h"
#include "mallocvar.h"
/*
* Yep, it's a very simple algorithm, but it was something I wanted to have
* available.
*/
struct colorToGrayEntry {
pixel color;
gray gray;
int frequency;
};
/*
* BUG: This number was chosen pretty arbitrarily. The program is * probably
* only useful for a very small numbers of colors - and that's * not only
* because of the O(n) search that's used. The idea lends * itself primarily
* to low color (read: simple, machine generated) images.
*/
#define MAXCOLORS 255
static gray
newGrayValue(pixel *pix, struct colorToGrayEntry *colorToGrayMap, int colors) {
int color;
/*
* Allowing this to be O(n), since the program is intended for small
* n. Later, perhaps sort by color (r, then g, then b) and bsearch.
*/
for (color = 0; color < colors; color++) {
if (PPM_EQUAL(*pix, colorToGrayMap[color].color))
return colorToGrayMap[color].gray;
}
pm_error("This should never happen - contact the maintainer");
return (-1);
}
#ifndef LITERAL_FN_DEF_MATCH
static qsort_comparison_fn cmpColorToGrayEntryByIntensity;
#endif
static int
cmpColorToGrayEntryByIntensity(const void * const a,
const void * const b) {
const struct colorToGrayEntry * const entry1P = a;
const struct colorToGrayEntry * const entry2P = b;
return entry1P->gray - entry2P->gray;
}
#ifndef LITERAL_FN_DEF_MATCH
static qsort_comparison_fn cmpColorToGrayEntryByFrequency;
#endif
static int
cmpColorToGrayEntryByFrequency(const void * const a,
const void * const b) {
const struct colorToGrayEntry * const entry1P = a;
const struct colorToGrayEntry * const entry2P = b;
return entry1P->frequency - entry2P->frequency;
}
int
main(int argc, char *argv[]) {
FILE *ifp;
int col, cols, row, rows, color, colors, argn;
int frequency;
pixval maxval;
pixel **pixels;
pixel *pP;
colorhist_vector hist;
gray *grayrow;
gray *gP;
struct colorToGrayEntry *colorToGrayMap;
ppm_init(&argc, argv);
argn = 1;
/* Default is to sort colors by intensity */
frequency = 0;
while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') {
if (pm_keymatch(argv[argn], "-frequency", 2))
frequency = 1;
else if (pm_keymatch(argv[argn], "-intensity", 2))
frequency = 0;
else
pm_usage( "[-frequency|-intensity] [ppmfile]" );
++argn;
}
if (argn < argc) {
ifp = pm_openr(argv[argn]);
++argn;
} else
ifp = stdin;
pixels = ppm_readppm(ifp, &cols, &rows, &maxval);
pm_close(ifp);
/* all done with the input file - it's entirely in memory */
/*
* Compute a histogram of the colors in the input. This is good for
* both frequency, and indirectly the intensity, of a color.
*/
hist = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colors);
if (hist == (colorhist_vector) 0)
/*
* BUG: This perhaps should use an exponential backoff, in
* the number of colors, until success - cf pnmcolormap's
* approach. The results are then more what's expected, but
* not necessarily very useful.
*/
pm_error("Too many colors - Try reducing with pnmquant");
/* copy the colors into another structure for sorting */
MALLOCARRAY(colorToGrayMap, colors);
for (color = 0; color < colors; color++) {
colorToGrayMap[color].color = hist[color].color;
colorToGrayMap[color].frequency = hist[color].value;
/*
* This next is derivable, of course, but it's far faster to
* store it precomputed. This can be skipped, when sorting
* by frequency - but again, for a small number of colors
* it's a small matter.
*/
colorToGrayMap[color].gray = ppm_luminosity(hist[color].color);
}
/*
* sort by intensity - sorting by frequency (in the histogram) is
* worth considering as a future addition.
*/
if (frequency)
qsort(colorToGrayMap, colors, sizeof(struct colorToGrayEntry),
&cmpColorToGrayEntryByFrequency);
else
qsort(colorToGrayMap, colors, sizeof(struct colorToGrayEntry),
&cmpColorToGrayEntryByIntensity);
/*
* create mapping between the n colors in input, to n evenly spaced
* grayscale intensities. This is done by overwriting the neatly
* formed gray values corresponding to the input-colors, with a new
* set of evenly spaced gray values. Since maxval can be changed on
* a lark, we just use gray levels 0..colors-1, and adjust maxval
* accordingly
*/
maxval = colors - 1;
for (color = 0; color < colors; color++)
colorToGrayMap[color].gray = color;
/* write pgm file, mapping colors to intensities */
pgm_writepgminit(stdout, cols, rows, maxval, 0);
grayrow = pgm_allocrow(cols);
for (row = 0; row < rows; row++) {
for (col = 0, pP = pixels[row], gP = grayrow; col < cols;
col++, pP++, gP++)
*gP = newGrayValue(pP, colorToGrayMap, colors);
pgm_writepgmrow(stdout, grayrow, cols, maxval, 0);
}
pm_close(stdout);
exit(0);
}
|
/*
This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
Smoothie 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.
Smoothie 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 Smoothie. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ZPROBE_H_
#define ZPROBE_H_
#include "Module.h"
#include "Pin.h"
#include <vector>
// defined here as they are used in multiple files
#define zprobe_checksum CHECKSUM("zprobe")
#define leveling_strategy_checksum CHECKSUM("leveling-strategy")
class StepperMotor;
class Gcode;
class StreamOutput;
class LevelingStrategy;
class ZProbe: public Module
{
public:
ZProbe() : invert_override(false) {};
virtual ~ZProbe() {};
void on_module_loaded();
void on_gcode_received(void *argument);
bool run_probe(float& mm, float feedrate, float max_dist= -1, bool reverse= false);
bool run_probe_return(float& mm, float feedrate, float max_dist= -1, bool reverse= false);
bool doProbeAt(float &mm, float x, float y);
void coordinated_move(float x, float y, float z, float feedrate, bool relative=false);
void home();
bool getProbeStatus() { return this->pin.get(); }
float getSlowFeedrate() const { return slow_feedrate; }
float getFastFeedrate() const { return fast_feedrate; }
float getProbeHeight() const { return probe_height; }
float getMaxZ() const { return max_z; }
private:
void config_load();
void probe_XYZ(Gcode *gc);
uint32_t read_probe(uint32_t dummy);
float slow_feedrate;
float fast_feedrate;
float return_feedrate;
float probe_height;
float max_z;
float dwell_before_probing;
Pin pin;
std::vector<LevelingStrategy*> strategies;
uint16_t debounce_ms, debounce;
volatile struct {
bool is_delta:1;
bool is_rdelta:1;
bool probing:1;
bool reverse_z:1;
bool invert_override:1;
volatile bool probe_detected:1;
};
};
#endif /* ZPROBE_H_ */
|
/*
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef INSTANCE_H
#define INSTANCE_H
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "instance-glue.h"
#pragma GCC diagnostic warning "-Wignored-qualifiers"
#pragma GCC diagnostic warning "-Wunused-parameter"
#include <dbus-c++/dbus.h>
class Instance
: public org::sflphone::SFLphone::Instance_adaptor,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
private:
int count;
public:
Instance (DBus::Connection& connection);
static const char* SERVER_PATH;
void Register (const int32_t& pid, const std::string& name);
void Unregister (const int32_t& pid);
int32_t getRegistrationCount (void);
};
#endif//INSTANCE_H
|
#ifdef _HAVE_ALSA_
/*
* alsabackend.c
* ALSA sequencer MIDI backend.
*
* for Denemo, a gtk+ frontend to GNU Lilypond
* Copyright (C) 2011 Dominic Sacré
*
* 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.
*/
#include "audio/alsabackend.h"
#include "audio/midi.h"
#include <alsa/asoundlib.h>
#include <glib.h>
static char const *ALSA_SEQ_CLIENT_NAME = "denemo";
static int const PLAYBACK_INTERVAL = 5000;
static snd_seq_t *seq;
static int in_port_id;
static int out_port_id;
static snd_midi_event_t *parser;
static GThread *process_thread;
static GCond *process_cond;
static gboolean quit_thread = FALSE;
static gboolean reset = FALSE;
static double playback_start_time;
static gpointer
process_thread_func (gpointer data)
{
GMutex *mutex = g_mutex_new ();
gint64 end_time;
g_mutex_lock (mutex);
for (;;)
{
end_time = g_get_monotonic_time () + (PLAYBACK_INTERVAL * G_TIME_SPAN_SECOND)/1000000;
g_cond_wait_until (process_cond, mutex, end_time);
if (g_atomic_int_get (&quit_thread))
{
break;
}
snd_seq_event_t *pev;
while (snd_seq_event_input (seq, &pev) >= 0)
{
unsigned char buffer[3];
snd_midi_event_reset_decode (parser);
if (snd_midi_event_decode (parser, buffer, sizeof (buffer), pev) > 0)
{
input_midi_event (MIDI_BACKEND, 0, buffer);
}
}
GTimeVal tv;
g_get_current_time (&tv);
double now = (double) tv.tv_sec + tv.tv_usec / 1000000.0;
double playback_time = now - playback_start_time;
unsigned char event_data[3];
size_t event_length;
double event_time;
double until_time = playback_time + PLAYBACK_INTERVAL / 1000000.0;
if (reset)
{
int n;
for (n = 0; n < 16; ++n)
{
snd_seq_event_t ev;
snd_seq_ev_set_controller (&ev, n, 123, 0);
snd_seq_ev_set_subs (&ev);
snd_seq_ev_set_direct (&ev);
snd_seq_ev_set_source (&ev, out_port_id);
snd_seq_event_output_direct (seq, &ev);
}
reset = FALSE;
}
while (read_event_from_queue (MIDI_BACKEND, event_data, &event_length, &event_time, until_time))
{
snd_seq_event_t ev;
snd_midi_event_reset_encode (parser);
snd_midi_event_encode (parser, event_data, event_length, &ev);
snd_seq_ev_set_subs (&ev);
snd_seq_ev_set_direct (&ev);
snd_seq_ev_set_source (&ev, out_port_id);
snd_seq_event_output_direct (seq, &ev);
}
if (is_playing ())
{
update_playback_time (TIMEBASE_PRIO_MIDI, playback_time);
}
}
g_mutex_free (mutex);
return NULL;
}
static int
alsa_seq_initialize (DenemoPrefs * config)
{
g_message ("Initializing ALSA sequencer MIDI backend");
// create sequencer client
if (snd_seq_open (&seq, "hw", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK) < 0)
{
g_warning ("error opening alsa sequencer");
return -1;
}
snd_seq_set_client_name (seq, ALSA_SEQ_CLIENT_NAME);
// create input port
in_port_id = snd_seq_create_simple_port (seq, "midi_in", SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_TYPE_APPLICATION);
if (in_port_id < 0)
{
g_warning ("error creating sequencer output port");
return -1;
}
// create output port
out_port_id = snd_seq_create_simple_port (seq, "midi_out", SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ, SND_SEQ_PORT_TYPE_APPLICATION);
if (in_port_id < 0)
{
g_warning ("error creating sequencer output port");
return -1;
}
// initialize MIDI event parser
if (snd_midi_event_new (12, &parser))
{
g_warning ("error initializing MIDI event parser");
return -1;
}
snd_midi_event_init (parser);
snd_midi_event_no_status (parser, 1);
process_cond = g_cond_new ();
process_thread = g_thread_try_new ("ALSA process", process_thread_func, NULL, NULL);
return 0;
}
static int
alsa_seq_destroy ()
{
g_message ("Destroying ALSA sequencer MIDI backend");
g_atomic_int_set (&quit_thread, TRUE);
g_cond_signal (process_cond);
g_thread_join (process_thread);
g_cond_free (process_cond);
snd_midi_event_free (parser);
snd_seq_delete_port (seq, in_port_id);
snd_seq_delete_port (seq, out_port_id);
snd_seq_close (seq);
return 0;
}
static int
alsa_seq_reconfigure (DenemoPrefs * config)
{
alsa_seq_destroy ();
return alsa_seq_initialize (config);
}
static int
alsa_seq_start_playing ()
{
GTimeVal tv;
g_get_current_time (&tv);
playback_start_time = (double) tv.tv_sec + tv.tv_usec / 1000000.0;
playback_start_time -= get_playback_time ();
return 0;
}
static int
alsa_seq_stop_playing ()
{
reset = TRUE;
return 0;
}
static int
alsa_seq_panic ()
{
reset = TRUE;
return 0;
}
backend_t alsa_seq_midi_backend = {
alsa_seq_initialize,
alsa_seq_destroy,
alsa_seq_reconfigure,
alsa_seq_start_playing,
alsa_seq_stop_playing,
alsa_seq_panic,
};
#endif //_HAVE_ALSA_
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-IEs"
* found in "../support/ngap-r16.1.0/38413-g10.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _NGAP_EUTRA_CGI_H_
#define _NGAP_EUTRA_CGI_H_
#include <asn_application.h>
/* Including external dependencies */
#include "NGAP_PLMNIdentity.h"
#include "NGAP_EUTRACellIdentity.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct NGAP_ProtocolExtensionContainer;
/* NGAP_EUTRA-CGI */
typedef struct NGAP_EUTRA_CGI {
NGAP_PLMNIdentity_t pLMNIdentity;
NGAP_EUTRACellIdentity_t eUTRACellIdentity;
struct NGAP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} NGAP_EUTRA_CGI_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_NGAP_EUTRA_CGI;
extern asn_SEQUENCE_specifics_t asn_SPC_NGAP_EUTRA_CGI_specs_1;
extern asn_TYPE_member_t asn_MBR_NGAP_EUTRA_CGI_1[3];
#ifdef __cplusplus
}
#endif
#endif /* _NGAP_EUTRA_CGI_H_ */
#include <asn_internal.h>
|
#ifndef VERSION_H
#define VERSION_H
#include "network.h"
static char * version="V2.0.2";
static char * checkUpdateURL="https://pc.ehaut.cn/download/checkupdate.json";
int checkVersion(QStringList &list,network *n);
#endif // VERSION_H
|
#ifndef __MY_LUA_H__
#define __MY_LUA_H__
#include <swilib.h>
#include "lua.h"
#define lua_boxpointer(L,u) \
(*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
void (*exit_func)(lua_State *L, void *user_data);
void *user_data;
void *next;
void *prev;
}atexit_list;
typedef struct
{
void (*abort)(int status);
char keep_alive;
char *s_folder;
char *s_name;
char *script;
char *plugin_dir;
char is_aborting;
int is_lock;
atexit_list *atexitl;
void (*RunInLuaProc)(void *func, void *ud);
}m_lua_State;
typedef struct
{
CSM_RAM csm;
int gui_id;
}LUA_MAIN_CSM;
typedef struct
{
GUI gui;
lua_State *L;
int ref[6];
int id;
char closing;
}LUA_MAIN_GUI;
typedef struct
{
char curentPen[5];
char curentBrus[5];
int curentFont;
int curentTextAttribyte;
WSHDR *lua_ws;
size_t lua_ws_AllocatedSize;
}_lua_draw_engine;
static __inline__ m_lua_State * mluaState(lua_State *L)
{
lua_getglobal(L, "__MLS__");
void* point = lua_unboxpointer(L, -1);
lua_pop(L, 1);
return (m_lua_State*)point;
}
static inline void lua_lock_exit(lua_State *L)
{
mluaState(L)->is_lock ++;
}
static inline void lua_unlock_exit(lua_State *L)
{
mluaState(L)->is_lock --;
}
int docall(lua_State *L, int narg, int clear);
int traceback(lua_State *L);
int report(lua_State *L, int status);
void l_message(const char *pname, const char *msg);
#ifdef __cplusplus
}
#endif
#endif
|
//Created by KVClassFactory on Sat Oct 3 14:18:09 2009
//Author: John Frankland,,,
#ifndef __KVINDRADETECTOR_H
#define __KVINDRADETECTOR_H
#include "KVDetector.h"
#include "KVINDRATelescope.h"
/**
\class KVINDRADetector
\ingroup INDRAGeometry
\brief Base class for detectors of INDRA array
*/
class KVINDRADetector : public KVDetector {
protected:
// for silicon and ionisation chamber detectors
// factors for converting between GG and PG coder values
Double_t fGGtoPG_0; //GG-PG conversion factor: offset
Double_t fGGtoPG_1; //GG-PGconversion factor: slope
KVINDRADetector* fChIo;//!pointer to ionisation chamber in group associated to this detector
KVINDRADetector* FindChIo();
Int_t NumeroCodeur; //Numero du codeur (QDC pour les ChIo/Si)
public:
KVINDRADetector()
: fGGtoPG_0(0), fGGtoPG_1(1. / 15.), fChIo(nullptr),
NumeroCodeur(0)
{
SetKVDetectorFiredACQParameterListFormatString();
}
virtual ~KVINDRADetector() {}
KVINDRADetector(const Char_t* type, const Float_t thick = 0.0)
: KVDetector(type, thick), fGGtoPG_0(0), fGGtoPG_1(1. / 15.),
fChIo(nullptr), NumeroCodeur(0)
{
SetKVDetectorFiredACQParameterListFormatString();
}
KVINDRATelescope* GetTelescope() const
{
// Return pointer to telescope containing this detector
return (KVINDRATelescope*)GetParentStructure("TELESCOPE");
}
virtual void SetSegment(UShort_t)
{
// Overrides KVDetector method.
// 'Segmentation' of INDRA detectors is defined in ctor of dedicated
// detector classes
}
void SetType(const Char_t* t)
{
// Detector types for INDRA are uppercase
TString T(t);
T.ToUpper();
KVDetector::SetType(T);
}
const Char_t* GetArrayName();
UInt_t GetRingNumber() const
{
if (GetTelescope()) return GetTelescope()->GetRingNumber();
// if no telescope, deduce from name
KVString name(GetName());
name.Begin("_");
KVString type = name.Next(kTRUE);
KVString index = name.Next(kTRUE);
if (type == "SILI" || type == "SI75") return index.Atoi();
return index.Atoi() / 100;
}
UInt_t GetModuleNumber() const
{
if (GetTelescope()) return GetTelescope()->GetNumber();
// if no telescope, deduce from name
KVString name(GetName());
name.Begin("_");
KVString type = name.Next(kTRUE);
KVString index = name.Next(kTRUE);
if (type == "SILI" || type == "SI75") return 0; //no idea
return index.Atoi() % 100;
}
void AddACQParamType(const Char_t* type);
virtual KVACQParam* GetACQParam(const Char_t* /*type*/) const;
Double_t GetPGfromGG(Double_t GG = -1);
Double_t GetGGfromPG(Double_t PG = -1);
void GetGGtoPGConversionFactors(Double_t* par)
{
// fill array par[2] with values of offset and slope parameters
// of linear conversion from GG to PG coder values.
// par[0] = offset = fGGtoPG_0
// par[1] = slope = fGGtoPG_1
par[0] = fGGtoPG_0;
par[1] = fGGtoPG_1;
};
void SetGGtoPGConversionFactors(Double_t alpha, Double_t beta)
{
// set parameters of linear conversion from GG to PG coder values
// (silicon and ionisation chamber detectors)
// alpha = offset, beta = slope
// PG = alpha + beta*(GG - GG_0) + PG_0
// where GG_0 and PG_0 are respectively GG and PG pedestals
fGGtoPG_0 = alpha;
fGGtoPG_1 = beta;
};
KVINDRADetector* GetChIo() const
{
return (fChIo ? fChIo : const_cast<KVINDRADetector*>(this)->FindChIo());
}
virtual Float_t GetPG() const
{
return GetACQData("PG");
}
virtual Float_t GetGG() const
{
return GetACQData("GG");
}
virtual Float_t GetR() const
{
return GetACQData("R");
}
virtual Float_t GetL() const
{
return GetACQData("L");
}
UShort_t GetMT() const
{
return GetACQParam("T")->GetCoderData();
}
void SetNumeroCodeur(Int_t numero);
Int_t GetNumeroCodeur();
void SetThickness(Double_t thick);
ClassDef(KVINDRADetector, 2) //Detectors of INDRA array
};
#endif
|
//
// ActiveRowColumn.h
// YokoTableLab
//
// Created by 倪 李俊 on 15/2/26.
// Copyright (c) 2015年 com.sinri. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ActiveRowColumn : UIView
@property UIColor * presetBGColor;
@property UILabel * textLabel;
@end
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MENU_INPUT_H
#define _MENU_INPUT_H
#include <retro_common_api.h>
#include "../input/input_driver.h"
#include "../input/input_keyboard.h"
RETRO_BEGIN_DECLS
enum menu_action
{
MENU_ACTION_NOOP = 0,
MENU_ACTION_UP,
MENU_ACTION_DOWN,
MENU_ACTION_LEFT,
MENU_ACTION_RIGHT,
MENU_ACTION_OK,
MENU_ACTION_SEARCH,
MENU_ACTION_SCAN,
MENU_ACTION_CANCEL,
MENU_ACTION_INFO,
MENU_ACTION_SELECT,
MENU_ACTION_START,
MENU_ACTION_SCROLL_DOWN,
MENU_ACTION_SCROLL_UP,
MENU_ACTION_TOGGLE,
MENU_ACTION_POINTER_MOVED,
MENU_ACTION_POINTER_PRESSED
};
enum menu_input_pointer_state
{
MENU_POINTER_X_AXIS = 0,
MENU_POINTER_Y_AXIS,
MENU_POINTER_DELTA_X_AXIS,
MENU_POINTER_DELTA_Y_AXIS,
MENU_POINTER_PRESSED
};
enum menu_input_mouse_state
{
MENU_MOUSE_X_AXIS = 0,
MENU_MOUSE_Y_AXIS,
MENU_MOUSE_LEFT_BUTTON,
MENU_MOUSE_RIGHT_BUTTON,
MENU_MOUSE_WHEEL_UP,
MENU_MOUSE_WHEEL_DOWN,
MENU_MOUSE_HORIZ_WHEEL_UP,
MENU_MOUSE_HORIZ_WHEEL_DOWN
};
enum menu_input_ctl_state
{
MENU_INPUT_CTL_NONE = 0,
MENU_INPUT_CTL_MOUSE_PTR,
MENU_INPUT_CTL_POINTER_PTR,
MENU_INPUT_CTL_POINTER_ACCEL_READ,
MENU_INPUT_CTL_POINTER_ACCEL_WRITE,
MENU_INPUT_CTL_IS_POINTER_DRAGGED,
MENU_INPUT_CTL_SET_POINTER_DRAGGED,
MENU_INPUT_CTL_UNSET_POINTER_DRAGGED,
MENU_INPUT_CTL_DEINIT
};
typedef struct menu_input
{
struct
{
unsigned ptr;
} mouse;
struct
{
int16_t x;
int16_t y;
int16_t dx;
int16_t dy;
float accel;
bool pressed[2];
bool back;
unsigned ptr;
} pointer;
} menu_input_t;
typedef struct menu_input_ctx_hitbox
{
int32_t x1;
int32_t x2;
int32_t y1;
int32_t y2;
} menu_input_ctx_hitbox_t;
void menu_input_post_iterate(int *ret, unsigned action);
int16_t menu_input_pointer_state(enum menu_input_pointer_state state);
int16_t menu_input_mouse_state(enum menu_input_mouse_state state);
bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox);
bool menu_input_ctl(enum menu_input_ctl_state state, void *data);
menu_input_t *menu_input_get_ptr(void);
RETRO_END_DECLS
#endif
|
#ifndef _ROADSTRIP_H
#define _ROADSTRIP_H
#include "roadpatch.h"
#include "aabb_space_partitioning.h"
#include "optional.h"
class ROADSTRIP
{
public:
ROADSTRIP() : closed(false) {}
bool ReadFrom(std::istream & openfile, std::ostream & error_output);
bool Collide(
const MATHVECTOR <float, 3> & origin,
const MATHVECTOR <float, 3> & direction,
const float seglen,
int & patch_id,
MATHVECTOR <float, 3> & outtri,
const BEZIER * & colpatch,
MATHVECTOR <float, 3> & normal) const;
void Reverse();
const std::vector<ROADPATCH> & GetPatches() const {return patches;}
std::vector<ROADPATCH> & GetPatches() {return patches;}
void CreateRacingLine(
SCENENODE & parentnode,
std::tr1::shared_ptr<TEXTURE> racingline_texture);
bool GetClosed() const
{
return closed;
}
///either returns a const BEZIER * to the roadpatch at the given (positive or negative) offset from the supplied bezier (looping around if necessary) or does not return a value if the bezier is not found in this roadstrip.
optional <const BEZIER *> FindBezierAtOffset(const BEZIER * bezier, int offset=0) const;
private:
std::vector<ROADPATCH> patches;
AABB_SPACE_PARTITIONING_NODE <unsigned> aabb_part;
bool closed;
void GenerateSpacePartitioning();
};
#endif // _ROADSTRIP_H
|
/* ---------------------------------------------------------------------------
** Author: Martin Geier
** converttable.h is part of OniboConverter2.
**
** OniboConverter2 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 CONVERTTABLE_H_
#define CONVERTTABLE_H_
#include <list>
#include <string>
#include "../CppExtension/hashmap.h"
namespace Xml {
template<class Options>
class ConvertTable {
public:
ConvertTable(){};
virtual ~ConvertTable(){};
bool getOptionsFromList(const std::list<std::string>& list, Options& opt){
bool exist = false;
opt = listToOptions.get(list, exist);
return exist;
}
std::list<std::string> getListFromOptions(const Options& options){
return optionsToList.get(options);
}
void add(const std::list<std::string>& list, const Options& options){
listToOptions.set(list, options);
optionsToList.set(options, list);
}
private:
CppExtension::HashMap<Options, std::list<std::string> > optionsToList;
CppExtension::HashMap<std::list<std::string>, Options> listToOptions;
};
} /* namespace Xml */
#endif /* CONVERTTABLE_H_ */
|
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h>
#include <Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h>
#include <Swiften/EventLoop/EventLoop.h>
namespace Swift {
class BonjourQuerier;
class BonjourBrowseQuery : public DNSSDBrowseQuery, public BonjourQuery {
public:
BonjourBrowseQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : BonjourQuery(q, eventLoop) {
DNSServiceErrorType result = DNSServiceBrowse(
&sdRef, 0, 0, "_presence._tcp", 0,
&BonjourBrowseQuery::handleServiceDiscoveredStatic, this);
if (result != kDNSServiceErr_NoError) {
sdRef = NULL;
}
}
void startBrowsing() {
if (!sdRef) {
eventLoop->postEvent(boost::bind(boost::ref(onError)), shared_from_this());
}
else {
run();
}
}
void stopBrowsing() {
finish();
}
private:
static void handleServiceDiscoveredStatic(DNSServiceRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *name, const char *type, const char *domain, void *context) {
static_cast<BonjourBrowseQuery*>(context)->handleServiceDiscovered(flags, interfaceIndex, errorCode, name, type, domain);
}
void handleServiceDiscovered(DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *name, const char *type, const char *domain) {
if (errorCode != kDNSServiceErr_NoError) {
eventLoop->postEvent(boost::bind(boost::ref(onError)), shared_from_this());
}
else {
//std::cout << "Discovered service: name:" << name << " domain:" << domain << " type: " << type << std::endl;
DNSSDServiceID service(name, domain, type, interfaceIndex);
if (flags & kDNSServiceFlagsAdd) {
eventLoop->postEvent(boost::bind(boost::ref(onServiceAdded), service), shared_from_this());
}
else {
eventLoop->postEvent(boost::bind(boost::ref(onServiceRemoved), service), shared_from_this());
}
}
}
};
}
|
/*
* Copyright Droids Corporation, Microb Technology, Eirbot (2005)
*
* 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
*
* Revision : $Id: scheduler_config.h,v 1.1 2008-12-26 13:08:29 zer0 Exp $
*
*/
#ifndef _SCHEDULER_CONFIG_H_
#define _SCHEDULER_CONFIG_H_
#define _SCHEDULER_CONFIG_VERSION_ 4
/** maximum number of allocated events */
#define SCHEDULER_NB_MAX_EVENT 7
#define SCHEDULER_UNIT_FLOAT 512.0
#define SCHEDULER_UNIT 512L
/** number of allowed imbricated scheduler interrupts. The maximum
* should be SCHEDULER_NB_MAX_EVENT since we never need to imbricate
* more than once per event. If it is less, it can avoid to browse the
* event table, events are delayed (we loose precision) but it takes
* less CPU */
#define SCHEDULER_NB_STACKING_MAX SCHEDULER_NB_MAX_EVENT
/** define it for debug infos (not recommended, because very slow on
* an AVR, it uses printf in an interrupt). It can be useful if
* prescaler is very high, making the timer interrupt period very
* long in comparison to printf() */
/* #define SCHEDULER_DEBUG */
#endif // _SCHEDULER_CONFIG_H_
|
/* Copyright 2014 the SumatraPDF project authors (see AUTHORS file).
License: GPLv3 */
typedef struct fz_context_s fz_context;
typedef struct fz_image_s fz_image;
typedef struct pdf_document_s pdf_document;
class PdfCreator {
fz_context *ctx;
pdf_document *doc;
public:
PdfCreator();
~PdfCreator();
bool AddImagePage(fz_image *image, float imgDpi=0);
bool AddImagePage(HBITMAP hbmp, SizeI size, float imgDpi=0);
bool AddImagePage(Gdiplus::Bitmap *bmp, float imgDpi=0);
// recommended for JPEG and JP2 images (don't need to be recompressed)
bool AddImagePage(const char *data, size_t len, float imgDpi=0);
bool SetProperty(DocumentProperty prop, const WCHAR *value);
bool CopyProperties(BaseEngine *engine);
bool SaveToFile(const WCHAR *filePath);
// this name is included in all saved PDF files
static void SetProducerName(const WCHAR *name);
// creates a simple PDF with all pages rendered as a single image
static bool RenderToFile(const WCHAR *pdfFileName, BaseEngine *engine, int dpi=150);
};
|
/**
* Copyright (c) 2017 - 2017, Nordic Semiconductor ASA
*
* 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, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, 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 Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**@file
*
* @defgroup ant_sdk_app_connectivity_main main.c
* @{
* @ingroup ant_sdk_app_connectivity
*
* @brief BLE Connectivity application.
*/
#include <stdbool.h>
#include "nrf_sdm.h"
#include "nrf_soc.h"
#include "app_error.h"
#include "app_scheduler.h"
#include "softdevice_handler.h"
#include "ser_hal_transport.h"
#include "ser_conn_handlers.h"
#include "boards.h"
#include "nrf_gpio.h"
#define NRF_LOG_MODULE_NAME "CONN"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "ser_phy_debug_comm.h"
/**@brief Main function of the connectivity application. */
int main(void)
{
uint32_t err_code = NRF_SUCCESS;
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_INFO("ANT connectivity started\r\n");
#if ( defined(SER_PHY_HCI_DEBUG_ENABLE) || defined(SER_PHY_DEBUG_APP_ENABLE))
debug_init(NULL);
#endif
/* Force constant latency mode to control SPI slave timing */
NRF_POWER->TASKS_CONSTLAT = 1;
/* Initialize scheduler queue. */
APP_SCHED_INIT(SER_CONN_SCHED_MAX_EVENT_DATA_SIZE, SER_CONN_SCHED_QUEUE_SIZE);
/* Initialize SoftDevice.
* SoftDevice Event IRQ is not scheduled but immediately copies ANT events to the application
* scheduler queue */
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
APP_ERROR_CHECK(err_code);
/* Subscribe for ANT events. */
err_code = softdevice_ant_evt_handler_set(ser_conn_ant_event_handle);
APP_ERROR_CHECK(err_code);
/* Open serialization HAL Transport layer and subscribe for HAL Transport events. */
err_code = ser_hal_transport_open(ser_conn_hal_transport_event_handle);
APP_ERROR_CHECK(err_code);
/* Enter main loop. */
for (;;)
{
/* Process SoftDevice events. */
app_sched_execute();
if (softdevice_handler_is_suspended())
{
// Resume pulling new events if queue utilization drops below 50%.
if (app_sched_queue_space_get() > (SER_CONN_SCHED_QUEUE_SIZE >> 1))
{
softdevice_handler_resume();
}
}
/* Process received packets.
* We can NOT add received packets as events to the application scheduler queue because
* received packets have to be processed before SoftDevice events but the scheduler queue
* does not have priorities. */
err_code = ser_conn_rx_process();
APP_ERROR_CHECK(err_code);
nrf_gpio_cfg_output(18);
nrf_gpio_pin_set(18);
(void)NRF_LOG_PROCESS();
/* Sleep waiting for an application event. */
err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
}
}
/** @} */
|
// File_Bzip2 - Info for PCM files
// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
//
// 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
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Information about Bzip2 files
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef MediaInfo_File_Bzip2H
#define MediaInfo_File_Bzip2H
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/File__Analyze.h"
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Class File_Bzip2
//***************************************************************************
class File_Bzip2 : public File__Analyze
{
protected :
//Buffer - File header
bool FileHeader_Begin();
//Buffer - Global
void Read_Buffer_Continue ();
};
} //NameSpace
#endif
|
/*
* gtr-plugins-engine.h
* This file is part of gtr
*
* Copyright (C) 2002-2005 - Paolo Maggi
* Copyright (C) 2010 - Steve Frécinaux
*
* 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.
*/
/*
* Modified by the gtr Team, 2002-2005. See the AUTHORS file for a
* list of people on the gtr Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
#ifndef __GTR_PLUGINS_ENGINE_H__
#define __GTR_PLUGINS_ENGINE_H__
#include <glib.h>
#include <libpeas/peas-engine.h>
G_BEGIN_DECLS
#define GTR_TYPE_PLUGINS_ENGINE (gtr_plugins_engine_get_type ())
#define GTR_PLUGINS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTR_TYPE_PLUGINS_ENGINE, GtrPluginsEngine))
#define GTR_PLUGINS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTR_TYPE_PLUGINS_ENGINE, GtrPluginsEngineClass))
#define GTR_IS_PLUGINS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTR_TYPE_PLUGINS_ENGINE))
#define GTR_IS_PLUGINS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTR_TYPE_PLUGINS_ENGINE))
#define GTR_PLUGINS_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTR_TYPE_PLUGINS_ENGINE, GtrPluginsEngineClass))
typedef struct _GtrPluginsEngine GtrPluginsEngine;
typedef struct _GtrPluginsEnginePrivate GtrPluginsEnginePrivate;
struct _GtrPluginsEngine
{
PeasEngine parent;
GtrPluginsEnginePrivate *priv;
};
typedef struct _GtrPluginsEngineClass GtrPluginsEngineClass;
struct _GtrPluginsEngineClass
{
PeasEngineClass parent_class;
};
GType gtr_plugins_engine_get_type (void) G_GNUC_CONST;
GtrPluginsEngine *gtr_plugins_engine_get_default (void);
G_END_DECLS
#endif /* __GTR_PLUGINS_ENGINE_H__ */
/* ex:ts=8:noet: */
|
int main() {
int j;
int k;
int n;
assume( (j==n) && (k==n) && (n>0));
while(j>0 && n>0) {
j--;k--;
}
assert( (k == 0));
return 0;
} |
/************************************* open_iA ************************************ *
* ********** A tool for visual analysis and processing of 3D CT images ********** *
* *********************************************************************************** *
* Copyright (C) 2016-2021 C. Heinzl, M. Reiter, A. Reh, W. Li, M. Arikan, Ar. & Al. *
* Amirkhanov, J. Weissenböck, B. Fröhler, M. Schiwarth, P. Weinberger *
* *********************************************************************************** *
* 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/ *
* *********************************************************************************** *
* Contact: FH OÖ Forschungs & Entwicklungs GmbH, Campus Wels, CT-Gruppe, *
* Stelzhamerstraße 23, 4600 Wels / Austria, Email: c.heinzl@fh-wels.at *
* ************************************************************************************/
#pragma once
class iABarycentricTriangle;
class iABCoord
{
public:
iABCoord(double alpha, double beta);
iABCoord() : iABCoord((double)1 / (double)3, (double)1 / (double)3)
{}
iABCoord(iABarycentricTriangle triangle, double x, double y);
double getAlpha() const;
double getBeta() const;
double getGamma() const;
bool isInside() const;
double operator[] (int x)
{
switch (x)
{
case 0: return getAlpha();
case 1: return getBeta();
case 2: return getGamma();
default: return 0;
}
}
bool operator== (const iABCoord that)
{
return getAlpha() == that.getAlpha() && getBeta() == that.getBeta();
}
bool operator!= (const iABCoord that)
{
return getAlpha() != that.getAlpha() || getBeta() != that.getBeta();
}
private:
double m_alpha;
double m_beta;
};
|
/*
Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
Governed by the TrueCrypt License 3.0 the full text of which is contained in
the file License.txt included in TrueCrypt binary and source code distribution
packages.
*/
#ifndef GST_HEADER_Platform_Serializable
#define GST_HEADER_Platform_Serializable
#include <stdexcept>
#include "PlatformBase.h"
#include "ForEach.h"
#include "Serializer.h"
#include "SerializerFactory.h"
namespace GostCrypt
{
class Serializable
{
public:
virtual ~Serializable () { }
virtual void Deserialize (shared_ptr <Stream> stream) = 0;
static string DeserializeHeader (shared_ptr <Stream> stream);
static Serializable *DeserializeNew (shared_ptr <Stream> stream);
template <class T>
static shared_ptr <T> DeserializeNew (shared_ptr <Stream> stream)
{
shared_ptr <T> p (dynamic_cast <T *> (DeserializeNew (stream)));
if (!p)
throw std::runtime_error (SRC_POS);
return p;
}
template <class T>
static void DeserializeList (shared_ptr <Stream> stream, list < shared_ptr <T> > &dataList)
{
if (DeserializeHeader (stream) != string ("list<") + SerializerFactory::GetName (typeid (T)) + ">")
throw std::runtime_error (SRC_POS);
Serializer sr (stream);
uint64 listSize;
sr.Deserialize ("ListSize", listSize);
for (size_t i = 0; i < listSize; i++)
{
shared_ptr <T> p (dynamic_cast <T *> (DeserializeNew (stream)));
if (!p)
throw std::runtime_error (SRC_POS);
dataList.push_back (p);
}
}
virtual void Serialize (shared_ptr <Stream> stream) const;
template <class T>
static void SerializeList (shared_ptr <Stream> stream, const list < shared_ptr <T> > &dataList)
{
Serializer sr (stream);
SerializeHeader (sr, string ("list<") + SerializerFactory::GetName (typeid (T)) + ">");
sr.Serialize ("ListSize", (uint64) dataList.size());
foreach_ref (const T &item, dataList)
item.Serialize (stream);
}
static void SerializeHeader (Serializer &serializer, const string &name);
protected:
Serializable () { }
};
}
#define GST_SERIALIZABLE(TYPE) \
static Serializable *GetNewSerializable () { return new TYPE(); } \
virtual void Deserialize (shared_ptr <Stream> stream); \
virtual void Serialize (shared_ptr <Stream> stream) const
#endif // GST_HEADER_Platform_Serializable
|
#include<iostream>
#include<stdlib.h>
#include<iomanip>
#include<math.h>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<string>
#include<stack>
#include<map>
#include<limits.h>
using namespace std;
#define ERROR -1
void getCutMax(int*, int, int);
void vector_man();
int getLongestArray(vector<int> nums);
/*
Çó×î´ó×ÓÊýÁеĺͣ¬¸ÃËã·¨¸´ÔÓ¶ÈΪnlogn
*/
vector<int> maxSubSum(vector<int> &nums, int left, int right);
/*
Ö¸ÕëʹÓÃÏê½â
*/
void recall();
/*
ʹÓö¯Ì¬¹æ»®¼ÆËã×î´ó×ÓÊýÁÐ
*/
int dpGetMaxSubSum(vector<int> nums);
void graph_test();
void getMatrix(int n);
void bigEndianPut(FILE *file);
int transferBiCharToAsi(vector<int> biCharSet);
vector<int> transferAsiToBiChar(int asi);
void bigEndianGet(FILE *bFile);
|
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee 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.
*
* RawTherapee 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 RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RAWIMAGE_H
#define __RAWIMAGE_H
#include <ctime>
#include <glibmm.h>
#include "dcraw.h"
namespace rtengine {
struct badPix
{
int x;
int y;
badPix( int xc, int yc ):x(xc),y(yc){}
};
class PixelsMap{
int w; // line width in base_t units
int h; // height
typedef unsigned long base_t;
static const size_t base_t_size=sizeof(base_t);
base_t *pm;
public:
PixelsMap(int width, int height )
:h(height){
w = (width+base_t_size-1) /base_t_size;
pm = new base_t [h * w ];
memset(pm,0,h * w *base_t_size );
}
~PixelsMap(){
delete [] pm;
}
int width() const { return w; }
int height() const { return h; }
// if a pixel is set returns true
bool get(int x, int y)
{
return (pm[y*w+ x/(base_t_size*8) ] & (base_t)1<<(x%(base_t_size*8)) )!=0;
}
// set a pixel
void set(int x, int y)
{
pm[y*w+ x/(base_t_size*8) ] |= (base_t)1<<(x%(base_t_size*8)) ;
}
// set pixels from a list
int set( std::list<badPix> &bp)
{
int totSet=0;
for(std::list<badPix>::iterator iter = bp.begin(); iter != bp.end(); iter++,totSet++)
set( iter->x,iter->y);
return totSet;
}
void clear(){
memset(pm,0,h * w *base_t_size );
}
// return 0 if at least one pixel in the word(base_t) is set, otherwise return the number of pixels to skip to the next word base_t
int skipIfZero(int x, int y){
return pm[y*w+ x/(base_t_size*8) ]==0 ? base_t_size*8 -x%(base_t_size*8):0;
}
};
class RawImage: public DCraw
{
public:
RawImage( const Glib::ustring name );
~RawImage();
int loadRaw (bool loadData=true, bool closeFile=true);
int get_colorsCoeff( float *pre_mul, float *scale_mul, float *cblack );
void set_prefilters(){
if (isBayer() && get_colors() == 3) {
prefilters = filters;
filters &= ~((filters & 0x55555555) << 1);
}
}
dcrawImage_t get_image() { return image; }
unsigned short** compress_image(); // revert to compressed pixels format and release image data
unsigned short** data; // holds pixel values, data[i][j] corresponds to the ith row and jth column
unsigned prefilters; // original filters saved ( used for 4 color processing )
protected:
Glib::ustring filename; // complete filename
int rotate_deg; // 0,90,180,270 degree of rotation: info taken by dcraw from exif
char* profile_data; // Embedded ICC color profile
unsigned short* allocation; // pointer to allocated memory
public:
std::string get_filename() const { return filename;}
int get_width() const { return width; }
int get_height() const { return height; }
int get_FujiWidth() const { return fuji_width; }
bool isBayer() const { return filters!=0; }
unsigned get_filters() const { return filters; }
int get_colors() const { return colors;}
int get_black() const { return black;}
int get_cblack(int i) const {return cblack[i];}
int get_white() const { return maximum;}
unsigned short get_whiteSample( int r, int c ) const { return white[r][c];}
double get_ISOspeed() const {return iso_speed;}
double get_shutter() const {return shutter; }
double get_aperture() const {return aperture; }
time_t get_timestamp() const { return timestamp;}
int get_rotateDegree() const { return rotate_deg;}
const std::string get_maker() const { return std::string(make); }
const std::string get_model() const { return std::string(model); }
float get_cam_mul(int c )const {return cam_mul[c];}
float get_pre_mul(int c )const {return pre_mul[c];}
float get_rgb_cam( int r, int c) const { return rgb_cam[r][c];}
int get_exifBase() const {return exif_base; }
int get_ciffBase() const {return ciff_base; }
int get_ciffLen() const {return ciff_len; }
int get_profileLen() const {return profile_length;}
char* get_profile() const { return profile_data;}
IMFILE *get_file() { return ifp; }
bool is_supportedThumb() const ;
int get_thumbOffset(){ return int(thumb_offset);}
int get_thumbWidth(){ return int(thumb_width);}
int get_thumbHeight(){ return int(thumb_height);}
int get_thumbBPS(){ return thumb_load_raw ? 16 : 8; }
bool get_thumbSwap() const;
unsigned get_thumbLength(){ return thumb_length;}
public:
// dcraw functions
void scale_colors(){ DCraw::scale_colors(); }
void pre_interpolate() { DCraw::pre_interpolate(); }
public:
bool ISRED (unsigned row, unsigned col) const { return ((filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==0);}
bool ISGREEN(unsigned row, unsigned col) const { return ((filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==1);}
bool ISBLUE (unsigned row, unsigned col) const { return ((filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==2);}
unsigned FC (unsigned row, unsigned col) const { return (filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3); }
};
}
#endif // __RAWIMAGE_H
|
/**
Generated Main Source File
Company:
Microchip Technology Inc.
File Name:
main.c
Summary:
This is the main file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
Description:
This header file provides implementations for driver APIs for all modules selected in the GUI.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.45
Device : PIC18F46K20
Driver Version : 2.00
The generated drivers are tested against the following:
Compiler : XC8 1.35
MPLAB : MPLAB X 3.40
*/
/*
(c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
software and any derivatives exclusively with Microchip products.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
TERMS.
*/
#include "mcc_generated_files/mcc.h"
/*
Main application
*/
void main(void)
{
// Initialize the device
SYSTEM_Initialize();
// If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts
// If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global and Peripheral Interrupts
// Use the following macros to:
// Enable high priority global interrupts
//INTERRUPT_GlobalInterruptHighEnable();
// Enable low priority global interrupts.
//INTERRUPT_GlobalInterruptLowEnable();
// Disable high priority global interrupts
//INTERRUPT_GlobalInterruptHighDisable();
// Disable low priority global interrupts.
//INTERRUPT_GlobalInterruptLowDisable();
// Enable the Global Interrupts
//INTERRUPT_GlobalInterruptEnable();
// Disable the Global Interrupts
//INTERRUPT_GlobalInterruptDisable();
// Enable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptEnable();
// Disable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptDisable();
while (1)
{
// Add your application code
}
}
/**
End of File
*/ |
//
// Copyright (C) 2018- David Hedbor <neotron@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 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/>.
//
#include "EventCollectCargo.h"
namespace Journal {
EventCollectCargo::EventCollectCargo(const QJsonObject &obj, const JFile *file)
: Event(obj, file, CollectCargo) {
}
}
#pragma once
|
/**
* Copyright 2015 Mikael Forsberg
*
* This file is part of Dracula Super Goat Hunter.
*
* Dracula Super Goat Hunter 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.
*
* Dracula Super Goat Hunter 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 Dracula Super Goat Hunter. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _HAVE_GOAT_H
#define _HAVE_GOAT_H
#include "SDL.h"
#include "main.h"
typedef struct
{
float speed_x, speed_y;
int ground, nextthink, animframe, animtime, scared;
Controls controls;
SDL_Rect rect;
SDL_Rect spriterect;
} Goat;
void goatfn(void* goat, int frameDelta);
Goat* goat_create(int x, int y);
void goat_make_scared(void* _goat);
#else
#endif
|
#include "../../../../../src/client/qwaylanddisplay_p.h"
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <folly/Executor.h>
#include <folly/io/async/EventBase.h>
#include <rsocket/RSocket.h>
#include <mutex>
#include "FlipperConnectionManager.h"
#include "FlipperInitConfig.h"
#include "FlipperState.h"
namespace facebook {
namespace flipper {
class ConnectionEvents;
class ConnectionContextStore;
class FlipperRSocketResponder;
rsocket::Payload toRSocketPayload(folly::dynamic data);
class FlipperConnectionManagerImpl : public FlipperConnectionManager {
friend ConnectionEvents;
public:
FlipperConnectionManagerImpl(
FlipperInitConfig config,
std::shared_ptr<FlipperState> state,
std::shared_ptr<ConnectionContextStore> contextStore);
~FlipperConnectionManagerImpl();
void start() override;
void stop() override;
bool isOpen() const override;
void setCallbacks(Callbacks* callbacks) override;
void sendMessage(const folly::dynamic& message) override;
void onMessageReceived(
const folly::dynamic& message,
std::unique_ptr<FlipperResponder> responder) override;
void reconnect();
void setCertificateProvider(
const std::shared_ptr<FlipperCertificateProvider> provider) override;
std::shared_ptr<FlipperCertificateProvider> getCertificateProvider() override;
private:
bool isOpen_ = false;
bool isStarted_ = false;
std::shared_ptr<FlipperCertificateProvider> certProvider_ = nullptr;
Callbacks* callbacks_;
DeviceData deviceData_;
std::shared_ptr<FlipperState> flipperState_;
int insecurePort;
int securePort;
folly::EventBase* flipperEventBase_;
folly::EventBase* connectionEventBase_;
std::unique_ptr<rsocket::RSocketClient> client_;
bool connectionIsTrusted_;
int failedConnectionAttempts_ = 0;
std::shared_ptr<ConnectionContextStore> contextStore_;
void startSync();
bool doCertificateExchange();
bool connectSecurely();
bool isCertificateExchangeNeeded();
void requestSignedCertFromFlipper();
bool isRunningInOwnThread();
void sendLegacyCertificateRequest(folly::dynamic message);
std::string getDeviceId();
};
} // namespace flipper
} // namespace facebook
|
/**
* \file test_common.h
* \ingroup Test
*
* \brief Production code.
*/
/* -------------------------- Development history -------------------------- */
/*
* 2015.10.24 LeFr v2.4.05 Initial version
*/
/* -------------------------------- Authors -------------------------------- */
/*
* LeFr Leandro Francucci lf@vortexmakes.com
*/
/* --------------------------------- Notes --------------------------------- */
/* --------------------------------- Module -------------------------------- */
#ifndef __TEST_COMMON_H__
#define __TEST_COMMON_H__
/* ----------------------------- Include files ----------------------------- */
/* ---------------------- External C language linkage ---------------------- */
#ifdef __cplusplus
extern "C" {
#endif
/* --------------------------------- Macros -------------------------------- */
/* -------------------------------- Constants ------------------------------ */
/* ------------------------------- Data types ------------------------------ */
/* -------------------------- External variables --------------------------- */
/* -------------------------- Function prototypes -------------------------- */
void common_test_setup( void );
void common_tear_down( void );
/* -------------------- External C language linkage end -------------------- */
#ifdef __cplusplus
}
#endif
/* ------------------------------ Module end ------------------------------- */
#endif
|
/* -*- c++ -*- */
/*
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
*
* GNU Radio 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.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_OSMOSDR_SNK_C_H
#define INCLUDED_OSMOSDR_SNK_C_H
#include <gr_hier_block2.h>
class osmosdr_snk_c;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef boost::shared_ptr<osmosdr_snk_c> osmosdr_snk_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of osmosdr_snk_c.
*
* To avoid accidental use of raw pointers, osmosdr_snk_c's
* constructor is private. osmosdr_make_snk_c is the public
* interface for creating new instances.
*/
osmosdr_snk_c_sptr osmosdr_make_snk_c (const std::string & args = "");
/*!
* \brief Takes a stream of complex samples.
* \ingroup block
*
* This uses the preferred technique: subclassing gr_hier_block2.
*/
class osmosdr_snk_c :
public gr_hier_block2
{
private:
// The friend declaration allows osmosdr_make_snk_c to
// access the private constructor.
friend osmosdr_snk_c_sptr osmosdr_make_snk_c (const std::string & args);
/*!
* \brief Takes a stream of complex samples.
*/
osmosdr_snk_c (const std::string & args); // private constructor
public:
~osmosdr_snk_c (); // public destructor
};
#endif /* INCLUDED_OSMOSDR_SNK_C_H */
|
#include "test_utils.h"
#include <stdlib.h>
#include <stdarg.h>
char* cheap_sprintf(const char* fmt, ...) {
#define BUFFSZ 127
static char buff[BUFFSZ + 1];
va_list ap;
va_start(ap, fmt);
vsnprintf(buff, BUFFSZ, fmt, ap);
va_end(ap);
return buff;
}
char* strapp2(const char* s1, const char* s2) {
return cheap_sprintf("%s%s", s1, s2);
}
char* strapp3(const char* s1, const char* s2, const char* s3) {
return cheap_sprintf("%s%s%s", s1, s2, s3);
}
char* string_of_size(int base, uintptr_t size) {
uintptr_t _1K;
uintptr_t _1M;
uintptr_t _1G;
if(base == 2) {
_1K = 1 << 10;
_1M = 1 << 20;
_1G = 1 << 30;
}
else if(base == 10) {
_1K = 1000;
_1M = 1000000;
_1G = 1000000000;
}
else {
abort();
}
char* suffix = "";
float coeff = 0;
if(size < _1K) {
coeff = size;
suffix = "";
}
else if(size < _1M) {
coeff = (float)size / (float)_1K;
suffix = "K";
}
else if(size < _1G) {
coeff = (float)size / (float)_1M;
suffix = "M";
}
else {
coeff = (float)size / (float)_1G;
suffix = "G";
}
return cheap_sprintf("%.1f%s base-%d", coeff, suffix, base);
}
|
/*
ClipGrab³
Copyright (C) Philipp Schmieder
http://clipgrab.de
feedback [at] clipgrab [dot] de
This file is part of ClipGrab.
ClipGrab 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.
ClipGrab 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 ClipGrab. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef video_tudou_H
#define video_tudou_H
#include "video.h"
class video_tudou : public video
{
Q_OBJECT
public:
video_tudou();
video* createNewInstance();
virtual void parseVideo(QString xml);
};
#endif // video_tudou_H
|
/*
* Driver for the Conexant CX25821 PCIe bridge
*
* Copyright (C) 2009 Conexant Systems Inc.
* Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
* Based on Steven Toth <stoth@linuxtv.org> cx23885 driver
*
* 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 CX25821_VIDEO_H_
#define CX25821_VIDEO_H_
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kmod.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <asm/div64.h>
#include "cx25821.h"
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#define VIDEO_DEBUG 0
#define dprintk(level, fmt, arg...) \
do { \
if (VIDEO_DEBUG >= level) \
printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \
} while (0)
#define FORMAT_FLAGS_PACKED 0x01
extern void cx25821_video_wakeup(struct cx25821_dev *dev,
struct cx25821_dmaqueue *q, u32 count);
extern int cx25821_start_video_dma(struct cx25821_dev *dev,
struct cx25821_dmaqueue *q,
struct cx25821_buffer *buf,
const struct sram_channel *channel);
extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status);
extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num);
extern int cx25821_video_register(struct cx25821_dev *dev);
#endif
|
/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "GameAction.h"
// There is also the BannerSetColourAction that sets primary colour but this action takes banner index rather than x, y, z,
// direction
enum class BannerSetStyleType : uint8_t
{
PrimaryColour,
TextColour,
NoEntry,
Count
};
class BannerSetStyleAction final : public GameActionBase<GameCommand::SetBannerStyle>
{
private:
BannerSetStyleType _type{ BannerSetStyleType::Count };
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
uint8_t _parameter{};
public:
BannerSetStyleAction() = default;
BannerSetStyleAction(BannerSetStyleType type, BannerIndex bannerIndex, uint8_t parameter);
void AcceptParameters(GameActionParameterVisitor& visitor) override;
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
GameActions::Result Query() const override;
GameActions::Result Execute() const override;
};
|
#ifndef LAB5_PURITY_H
#define LAB5_PURITY_H
#include "EvaluationMeasure.h"
class Purity : public EvaluationMeasure {
public:
Purity(const std::vector<Cluster> &clusters, size_t pointsDimension) : EvaluationMeasure(clusters,
pointsDimension) {}
double calculate() const;
};
#endif //LAB5_PURITY_H
|
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2014) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO 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.
//
// OVITO 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 __OVITO_LOAD_IMAGE_FILE_DIALOG_H
#define __OVITO_LOAD_IMAGE_FILE_DIALOG_H
#include <gui/GUI.h>
#include <core/rendering/FrameBuffer.h>
#include "HistoryFileDialog.h"
namespace Ovito { OVITO_BEGIN_INLINE_NAMESPACE(Gui) OVITO_BEGIN_INLINE_NAMESPACE(Dialogs)
/**
* \brief This file chooser dialog lets the user select an image file from disk.
*/
class OVITO_GUI_EXPORT LoadImageFileDialog : public HistoryFileDialog
{
Q_OBJECT
public:
/// \brief Constructs the dialog window.
LoadImageFileDialog(QWidget* parent = nullptr, const QString& caption = QString(), const ImageInfo& imageInfo = ImageInfo());
/// \brief Returns the file info after the dialog has been closed with "OK".
const ImageInfo& imageInfo() const { return _imageInfo; }
private Q_SLOTS:
/// This is called when the user has pressed the OK button of the dialog box.
void onFileSelected(const QString& file);
private:
ImageInfo _imageInfo;
};
OVITO_END_INLINE_NAMESPACE
OVITO_END_INLINE_NAMESPACE
} // End of namespace
#endif // __OVITO_LOAD_IMAGE_FILE_DIALOG_H
|
/*
Copyright (C) Cfengine AS
This file is part of Cfengine 3 - written and maintained by Cfengine AS.
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 3.
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
To the extent this program is licensed as part of the Enterprise
versions of Cfengine, the applicable Commerical Open Source License
(COSL) may apply to this file if you as a licensee so wish it. See
included file COSL.txt.
*/
#ifndef CFENGINE_CF_EXECD_RUNNER_H
#define CFENGINE_CF_EXECD_RUNNER_H
typedef struct
{
bool scheduled_run;
char *exec_command;
char *mail_server;
char *mail_from_address;
char *mail_to_address;
int mail_max_lines;
/*
* Host information.
* Might change during policy reload, so copy is retained in each worker.
*/
char *fq_name;
char *ip_address;
} ExecConfig;
void LocalExec(const ExecConfig *config);
#endif
|
/*
* Beautiful Capi generates beautiful C API wrappers for your C++ classes
* Copyright (C) 2015 Petr Petrovich Petrov
*
* This file is part of Beautiful Capi.
*
* Beautiful Capi 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.
*
* Beautiful Capi 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 Beautiful Capi. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*
* WARNING: This file was automatically generated by Beautiful Capi!
* Do not edit this file! Please edit the source API description.
*/
#ifndef EXAMPLE_POSITION4D_DOUBLE_DECLARATION_INCLUDED
#define EXAMPLE_POSITION4D_DOUBLE_DECLARATION_INCLUDED
#include "ExampleCapi.h"
#include "ExampleFwd.h"
#include "Example/PositiondoubleDecl.h"
#ifdef __cplusplus
namespace Example {
template<>
class Position4D<double> : public Example::Position<double>
{
public:
inline Position4D();
inline double GetW() const;
inline void SetW(double x);
inline Position4D(const Position4D<double>& other);
#ifdef EXAMPLE_CPP_COMPILER_HAS_RVALUE_REFERENCES
inline Position4D(Position4D<double>&& other);
#endif /* EXAMPLE_CPP_COMPILER_HAS_RVALUE_REFERENCES */
enum ECreateFromRawPointer { force_creating_from_raw_pointer };
inline Position4D(ECreateFromRawPointer, void *object_pointer, bool copy_object);
inline ~Position4D();
inline Position4D<double>& operator=(const Position4D<double>& other);
#ifdef EXAMPLE_CPP_COMPILER_HAS_RVALUE_REFERENCES
inline Position4D<double>& operator=(Position4D<double>&& other);
#endif /* EXAMPLE_CPP_COMPILER_HAS_RVALUE_REFERENCES */
static inline Position4D<double> Null();
inline bool IsNull() const;
inline bool IsNotNull() const;
inline bool operator!() const;
inline void* Detach();
inline void* GetRawPointer() const;
protected:
inline void SetObject(void* object_pointer);
void* mObject;
};
}
#endif /* __cplusplus */
#endif /* EXAMPLE_POSITION4D_DOUBLE_DECLARATION_INCLUDED */
|
/////////////////////////////////////////////////////////////////////////////
//
// CValueWithGradient.h
//
// June, 2005
//
/////////////////////////////////////////////////////////////////////////////
#ifndef MATH_CValueWithGradient_Declared
#define MATH_CValueWithGradient_Declared
#include <vector>
#include <iosfwd>
class CValueWithGradient
{
public: ///////////////////////////////////////////////////////////////////
double Value;
std::vector<double> vGradient;
public: ///////////////////////////////////////////////////////////////////
CValueWithGradient(int Size): vGradient(Size) {}
operator double() const {return Value;}
};
const CValueWithGradient &operator+=(CValueWithGradient &vgL,
const CValueWithGradient &vgR);
const CValueWithGradient &operator-=(CValueWithGradient &vgL,
const CValueWithGradient &vgR);
const CValueWithGradient &operator*=(CValueWithGradient &vgL,
const CValueWithGradient &vgR);
const CValueWithGradient &operator/=(CValueWithGradient &vgL,
const CValueWithGradient &vgR);
CValueWithGradient operator+(const CValueWithGradient &vgA,
const CValueWithGradient &vgB);
CValueWithGradient operator-(const CValueWithGradient &vgA,
const CValueWithGradient &vgB);
CValueWithGradient operator*(const CValueWithGradient &vgA,
const CValueWithGradient &vgB);
CValueWithGradient operator/(const CValueWithGradient &vgA,
const CValueWithGradient &vgB);
std::ostream &operator<<(std::ostream &out, const CValueWithGradient &vg);
#endif
|
/*
* This code is (c) 2012 Johannes Thoma
*
* This file 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 file 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 file. If not, see <http://www.gnu.org/licenses/>.
*
* You can download original source from https://github.com/johannesthoma/mmap_allocator.git
*/
#ifndef _MMAP_FILE_POOL_H
#define _MMAP_FILE_POOL_H
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string>
#include <map>
#include "mmap_access_mode.h"
namespace mmap_allocator_namespace {
class mmap_file_identifier {
public:
mmap_file_identifier();
mmap_file_identifier(const mmap_file_identifier &other);
mmap_file_identifier(std::string fname, enum access_mode access_mode);
bool operator==(const mmap_file_identifier &other) const;
bool operator<(const mmap_file_identifier &other) const;
private:
enum access_mode access_mode;
dev_t device;
ino_t inode;
};
class mmapped_file {
public:
mmapped_file():
fd(-1),
memory_area(NULL),
size_mapped(0),
offset_mapped(0),
reference_count(0)
{ }
void *get_memory_area(void)
{
return memory_area;
}
void remmap_file_for_read();
void* open_and_mmap_file(std::string fname, enum access_mode access_mode, off_t offset, size_t length, bool map_whole_file, bool allow_remap);
bool munmap_and_close_file(void);
private:
friend class mmap_file_pool;
int fd;
void *memory_area;
size_t size_mapped;
off_t offset_mapped;
int reference_count;
};
typedef std::map<mmap_file_identifier, mmapped_file> mmapped_file_map_t;
typedef std::pair<mmap_file_identifier, mmapped_file> mmapped_file_pair_t;
/* Singleton */
class mmap_file_pool {
public:
mmap_file_pool():
the_map()
{ }
void *mmap_file(std::string fname, enum access_mode access_mode, off_t offset, size_t length, bool map_whole_file, bool allow_remap);
void munmap_file(std::string fname, enum access_mode access_mode, off_t offset, size_t length);
private:
mmapped_file_map_t the_map;
};
extern mmap_file_pool the_pool;
}
#endif
|
/*
* Register definitions for Micrel KSZ8995MA
*/
/* Chip ID Registers */
#define ID0 0x00 /* 7-0 family id */
#define ID1 0x01 /* 7-4 chip id, 3-1 revision id, 0 start switch */
/* Global Control Registers */
#define GC0 0x02
#define GC1 0x03 /* 2 aging enable, 1 fast age enable */
#define GC2 0x04 /* 6 broadcast storm protection, 1 legal max packet size check disable */
#define GC3 0x05 /* 7 VLAN enable, 1 tag mask, 0, sniff mode */
#define GC4 0x06 /* 3 null VID replacement */
#define GC5 0x07 /* broadcast storm protection rate */
#define GC9 0x0b /* 1 LED mode, 0 special TPID */
/* Port 1 Control Registers */
#define P1C0 0x10 /* 7 broadacast storm protection, 5 802.1p priority, 4 port based priority */
/* 2 tag insertion, 1 tag removal, 0 priority enable */
#define P1C1 0x11 /* 4-0 port VLAN membership */
#define P1C2 0x12 /* 6 ingress VLAN filtering, 5 discard non-PVID, 2 txen, 1 rxen, 0 learnen */
#define P1C3 0x13 /* default tag[15:8] */
#define P1C4 0x14 /* default tag[7:0] */
#define P1C5 0x15 /* tx high priority rate LSB */
#define P1C6 0x16 /* tx low priority rate LSB */
#define P1C7 0x17 /* tx priority rate MSB */
#define P1C8 0x18 /* rx high priority rate LSB */
#define P1C9 0x19 /* rx low priority rate LSB */
#define P1C10 0x1a /* rx priority rate MSB */
#define P1C11 0x1b /* priority... */
#define P1C12 0x1c /* 7 auto negotiation, 6 force speed, 5 force duplex, 4-0 advertise... */
#define P1C13 0x1d /* 7 LED, 3 power down, 2 disable auto mdi-x, 1 force mdi */
#define P1C14 0x1f
/* Port 2 Control Registers */
#define P2C0 0x20
#define P2C1 0x21
#define P2C2 0x22
#define P2C3 0x23
#define P2C4 0x24
#define P2C5 0x25
#define P2C6 0x26
#define P2C7 0x27
#define P2C8 0x28
#define P2C9 0x29
#define P2C10 0x2a
#define P2C11 0x2b
#define P2C12 0x2c
#define P2C13 0x2d
#define P2C14 0x2f
/* Port 3 Control Registers */
#define P3C0 0x30
#define P3C1 0x31
#define P3C2 0x32
#define P3C3 0x33
#define P3C4 0x34
#define P3C5 0x35
#define P3C6 0x36
#define P3C7 0x37
#define P3C8 0x38
#define P3C9 0x39
#define P3C10 0x3a
#define P3C11 0x3b
#define P3C12 0x3c
#define P3C13 0x3d
#define P3C14 0x3f
/* Port 4 Control Registers */
#define P4C0 0x40
#define P4C1 0x41
#define P4C2 0x42
#define P4C3 0x43
#define P4C4 0x44
#define P4C5 0x45
#define P4C6 0x46
#define P4C7 0x47
#define P4C8 0x48
#define P4C9 0x49
#define P4C10 0x4a
#define P4C11 0x4b
#define P4C12 0x4c
#define P4C13 0x4d
#define P4C14 0x4f
/* Port 5 Control Registers */
#define P5C0 0x50
#define P5C1 0x51
#define P5C2 0x52
#define P5C3 0x53
#define P5C4 0x54
#define P5C5 0x55
#define P5C6 0x56
#define P5C7 0x57
#define P5C8 0x58
#define P5C9 0x59
#define P5C10 0x5a
#define P5C11 0x5b
#define P5C12 0x5c
#define P5C13 0x5d
#define P5C14 0x5f
/* Port 1 Status Registers */
#define P1S0 0x1e /* 7 mdi-x status, 6 AN done, 6 link good, 4-0 partner flow control */
/* Port 2 Status Registers */
#define P2S0 0x2e
/* Port 3 Status Registers */
#define P3S0 0x3e
/* Port 4 Status Registers */
#define P4S0 0x4e
/* Port 5 Status Registers */
#define P5S0 0x5e
/* TOS Priority Control Registers */
/* MAC Address Registers */
#define MACA0 0x68 /* MAC[47-40] */
#define MACA1 0x69 /* MAC[39-32] */
#define MACA2 0x6a /* MAC[31-24] */
#define MACA3 0x6b /* MAC[23-16] */
#define MACA4 0x6c /* MAC[15-8] */
#define MACA5 0x6d /* MAC[7-0] */
/* Indirect Access Control Registers */
#define IAC0 0x6e /* 4 read/write cycle, 3-2 table select, 1-0 addr MSB */
/* tables: 00 static mac, 01 VLAN, 10 dynamic address, 11 MIB counters */
#define IAC1 0x6f /* addr LSB */
#define IAC_RD (0x1 << 4) /* read cycle */
#define IAC_WR (0x0 << 4) /* write cycle */
#define IAC_SM (0x0 << 2) /* static MAC table */
#define IAC_VLAN (0x1 << 2) /* VLAN table */
#define IAC_DM (0x2 << 2) /* dynamic MAC table */
#define IAC_MIB (0x3 << 2) /* MIB table */
/* Indirect Data Registers */
#define IDR8 0x70 /* data [68-64] */
#define IDR7 0x71 /* data [63-56] */
#define IDR6 0x72 /* data [55-48] */
#define IDR5 0x73 /* data [47-40] */
#define IDR4 0x74 /* data [39-32] */
#define IDR3 0x75 /* data [31-24] */
#define IDR2 0x76 /* data [23-16] */
#define IDR1 0x77 /* data [15-8] */
#define IDR0 0x78 /* data [7-0] */
|
#ifndef DIALOGADDAMV_H
#define DIALOGADDAMV_H
#include <QDialog>
#include <QAbstractButton>
#include <QLineEdit>
#include <QSqlQueryModel>
#include <QStringListModel>
namespace Ui {
class DialogAddAmv;
}
/*! \~russian
* \brief Класс диалога добавления AMV
*
* Диалог добавления и/или редактирования AMV записей.
* \todo Делает слишком много. В планах, разбиение задач
* чтобы у диалога осталась только задача редактирования.
*
*
*
*/
class DialogAddAmv : public QDialog
{
Q_OBJECT
private:
Ui::DialogAddAmv *ui;
QSqlQueryModel* model;
bool _isEditRole;
unsigned long long _recordId;
QString _oldCover;
QStringListModel _tags;
QLineEdit* LineEdit_OrigTitle;
QLineEdit* LineEdit_Director;
QLineEdit* LineEdit_PostScoring;
void initTags();
void initOptionalFields();
void setDataInField();
public:
explicit DialogAddAmv(QWidget *parent, unsigned long long id);
explicit DialogAddAmv(QWidget *parent);
~DialogAddAmv();
private slots:
void on_BtnBox_clicked(QAbstractButton *button);
void on_BtnBox_accepted();
void on_BtnBox_rejected();
void on_toolButton_clicked();
bool insert_Amv();
void btnBox_reset();
void on_LineEdit_Dir_textChanged(const QString &value);
void on_SpinBox_Year_valueChanged(int value);
};
#endif // DIALOGADDAMV_H
|
// Plugin.h: API for plugin and methods for modules manager
//------------------------------------------------------------------------------
// Copyright (c) 2016 Anatoly madRat L. Berenblit
//------------------------------------------------------------------------------
// 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 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#define PLGAPI_VERSION 1
#define PLGAPI_ENTRYPOINT "module"
#define PLGPREFIX "fvp_"
#define PLGAPI_PRIORITY_HIGH (-5)
#define PLGAPI_PRIORITY_NORMAL (0)
#define PLGAPI_PRIORITY_LOW (5)
#include "MultipageImage.h"
namespace plugin
{
typedef bool (*FnInit)();
typedef void (*FnDone)();
typedef const char* (*FnDesc)();
typedef MultipageImage* (*FnLoad)(const char *filename);
typedef const char* (*FnPattern)();
struct Info
{
const char *name;
int version;
int priority;
FnInit init;
FnDone done;
FnDesc desc;
FnPattern pattern;
FnLoad load;
};
#ifndef FLVIEWER_PLUGIN
void init(const char* dirname);
void release();
typedef bool (*FnEnumerate)(const Info* info, void *data);
void apply(FnEnumerate fn, void* data = NULL);
#endif
};
#ifdef FLVIEWER_PLUGIN
extern "C" plugin::Info module;
#endif
#endif //#ifndef __PLUGIN_H__
|
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <QDebug>
#include <QCoreApplication>
#include <iostream>
#include <QtCrypto>
#include <QObject>
#include <QFile>
#include <QDir>
#include <QList>
#include <QString>
class Parameters : public QObject
{
Q_OBJECT
public:
explicit Parameters(QObject *parent = 0);
QString getDbLocation() const{return m_dbLocation;}
QList<QString> getMusicLibraryLocations() const{return m_musicLibraryLocations;}
QString getRSAKeyLocation() const{return m_RSAKeyLocation;}
QCA::SecureArray getRSAPassphrase() const{return m_RSAPassphrase;}
private:
void _parseConfigFile();
void _singleDashArgument(QString const& argument);
void _doubleDashArgument(QString const& argument);
void _printVersionAndQuit() const;
QFile m_configFile;
QString m_dbLocation;
QList<QString> m_musicLibraryLocations;
QString m_RSAKeyLocation;
QCA::SecureArray m_RSAPassphrase;
};
#endif // PARAMETERS_H
|
/*
* This file is part of Model2X.
*
* Model2X 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.
*
* Model2X 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 Model2X. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2011 Ernst Moritz Hahn (emh@cs.uni-saarland.de)
*/
#ifndef VALUE_COMPUTE_H
#define VALUE_COMPUTE_H
#include <vector>
#include <tr1/unordered_map>
namespace prismparser {
class Expr;
}
namespace rational {
class RationalFunction;
}
namespace model2x {
class ValueCompute {
public:
typedef unsigned entry_t;
typedef std::vector<int> state_t;
ValueCompute();
~ValueCompute();
void setStateVariables(const std::vector<prismparser::Expr> &);
entry_t addEntry(const prismparser::Expr &);
void compute(const entry_t, const state_t &, rational::RationalFunction &) const;
private:
typedef std::tr1::unordered_map<std::string, unsigned> ParamNumbersMap;
typedef std::vector<unsigned> ProgramInsts;
typedef std::vector<void *> ProgramParams;
typedef std::vector<prismparser::Expr> StateVariables;
const StateVariables *stateVariables;
ParamNumbersMap *paramNumbers;
std::vector<ProgramInsts> programInsts;
std::vector<ProgramParams> programParams;
void expr2program(const prismparser::Expr &, ProgramInsts &, ProgramParams &);
void fold(rational::RationalFunction &, const rational::RationalFunction, const unsigned) const;
};
}
#endif
|
/*
* video-render.h - Implementation of framebuffer to physical screen copy
*
* Written by
* John Selck <graham@cruise.de>
* Andreas Boose <viceteam@t-online.de>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#ifndef VICE_VIDEORENDER_H
#define VICE_VIDEORENDER_H
#include "types.h"
#include "video.h"
#include "viewport.h"
struct video_render_config_s;
struct video_canvas_s;
typedef void (*render_pal_ntsc_func_t)(video_render_config_t *, uint8_t *, uint8_t *,
int, int, int, int,
int, int, int, int,
int,
unsigned int, unsigned int);
typedef void (*render_rgbi_func_t)(video_render_config_t *, uint8_t *, uint8_t *,
int, int, int, int,
int, int, int, int,
unsigned int, unsigned int);
typedef void (*render_crt_mono_func_t)(video_render_config_t *, uint8_t *, uint8_t *,
int, int, int, int,
int, int, int, int,
unsigned int, unsigned int);
extern void video_render_main(struct video_render_config_s *config, uint8_t *src,
uint8_t *trg, int width, int height,
int xs, int ys, int xt, int yt,
int pitchs, int pitcht,
viewport_t *viewport);
extern void video_render_update_palette(struct video_canvas_s *canvas);
extern void video_render_palntscfunc_set(render_pal_ntsc_func_t func);
extern void video_render_crtmonofunc_set(render_crt_mono_func_t func);
extern void video_render_rgbifunc_set(render_rgbi_func_t func);
/* Default render functions */
extern void video_render_pal_ntsc_main(video_render_config_t *config,
uint8_t *src, uint8_t *trg,
int width, int height, int xs, int ys, int xt,
int yt, int pitchs, int pitcht,
int crt_type,
unsigned int viewport_first_line, unsigned int viewport_last_line);
extern void video_render_rgbi_main(video_render_config_t *config,
uint8_t *src, uint8_t *trg,
int width, int height, int xs, int ys, int xt,
int yt, int pitchs, int pitcht,
unsigned int viewport_first_line, unsigned int viewport_last_line);
extern void video_render_crt_mono_main(video_render_config_t *config,
uint8_t *src, uint8_t *trg,
int width, int height, int xs, int ys, int xt,
int yt, int pitchs, int pitcht,
unsigned int viewport_first_line, unsigned int viewport_last_line);
#endif
|
/*
* common/xscreen.c - common X screen management
*
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <X11/extensions/Xinerama.h>
#include "common/xscreen.h"
/** Return the Xinerama screen number where the coordinates belongs to
* \param disp Display ref
* \param x x coordinate of the window
* \param y y coordinate of the window
* \return screen number or DefaultScreen of disp on no match
*/
int
screen_get_bycoord(ScreensInfo *si, int screen, int x, int y)
{
int i;
/* don't waste our time */
if(!si->xinerama_is_active)
return screen;
for(i = 0; i < si->nscreen; i++)
if((x < 0 || (x >= si->geometry[i].x && x < si->geometry[i].x + si->geometry[i].width))
&& (y < 0 || (y >= si->geometry[i].y && y < si->geometry[i].y + si->geometry[i].height)))
return i;
return screen;
}
static inline area_t
screen_xsitoarea(XineramaScreenInfo si)
{
area_t a;
a.x = si.x_org;
a.y = si.y_org;
a.width = si.width;
a.height = si.height;
a.next = a.prev = NULL;
return a;
}
void
screensinfo_delete(ScreensInfo **si)
{
p_delete(&(*si)->geometry);
p_delete(si);
}
ScreensInfo *
screensinfo_new(Display *disp)
{
ScreensInfo *si;
XineramaScreenInfo *xsi;
int xinerama_screen_number, screen, screen_to_test;
Bool drop;
si = p_new(ScreensInfo, 1);
if((si->xinerama_is_active = XineramaIsActive(disp)))
{
xsi = XineramaQueryScreens(disp, &xinerama_screen_number);
si->geometry = p_new(area_t, xinerama_screen_number);
si->nscreen = 0;
/* now check if screens overlaps (same x,y): if so, we take only the biggest one */
for(screen = 0; screen < xinerama_screen_number; screen++)
{
drop = False;
for(screen_to_test = 0; screen_to_test < si->nscreen; screen_to_test++)
if(xsi[screen].x_org == si->geometry[screen_to_test].x
&& xsi[screen].y_org == si->geometry[screen_to_test].y)
{
/* we already have a screen for this area, just check if
* it's not bigger and drop it */
drop = True;
si->geometry[screen_to_test].width =
MAX(xsi[screen].width, xsi[screen_to_test].width);
si->geometry[screen_to_test].height =
MAX(xsi[screen].height, xsi[screen_to_test].height);
}
if(!drop)
si->geometry[si->nscreen++] = screen_xsitoarea(xsi[screen]);
}
/* realloc smaller if xinerama_screen_number != screen registered */
if(xinerama_screen_number != si->nscreen)
{
area_t *newgeometry = p_new(area_t, si->nscreen);
memcpy(newgeometry, si->geometry, si->nscreen * sizeof(area_t));
p_delete(&si->geometry);
si->geometry = newgeometry;
}
XFree(xsi);
}
else
{
si->nscreen = ScreenCount(disp);
si->geometry = p_new(area_t, si->nscreen);
for(screen = 0; screen < si->nscreen; screen++)
{
si->geometry[screen].x = 0;
si->geometry[screen].y = 0;
si->geometry[screen].width = DisplayWidth(disp, screen);
si->geometry[screen].height = DisplayHeight(disp, screen);
}
}
return si;
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
void main( void )
{
int &nut;
int &talker;
&talker = 0;
}
void talk( void )
{
freeze(1);
freeze(¤t_sprite);
&nut = sp_dir(1, -1);
if (&talker == 0)
{
say_stop("`3Hi, we are the giant ducks of Koka Isle.", ¤t_sprite);
wait(250);
say_stop("`3Who are you?", ¤t_sprite);
wait(500);
sp_dir(1, 2);
wait(1000);
sp_dir(1, &nut);
wait(250);
say_stop("Uh, I'm Dink.", 1);
wait(250);
say_stop("`3Hello Dink.", ¤t_sprite);
}
unfreeze(1);
unfreeze(¤t_sprite);
}
void hit( void )
{
freeze(¤t_sprite);
say_stop("`3Quack. No!!", ¤t_sprite);
unfreeze(¤t_sprite);
}
void die ( void )
{
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 6);
}
|
/*
* DisServiceScheduler.h
*
* This file is part of the IHMC DisService Library/Component
* Copyright (c) 2006-2016 IHMC.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 (GPLv3) as published by the Free Software Foundation.
*
* U.S. Government agencies and organizations may redistribute
* and/or modify this program under terms equivalent to
* "Government Purpose Rights" as defined by DFARS
* 252.227-7014(a)(12) (February 2014).
*
* Alternative licenses that allow for use within commercial products may be
* available. Contact Niranjan Suri at IHMC (nsuri@ihmc.us) for details.
*/
#ifndef INCL_DISSERVICE_SCHEDULER_H
#define INCL_DISSERVICE_SCHEDULER_H
#if defined (USE_SCHEDULER)
#include "DisServiceMsg.h"
#include "NLFLib.h"
#include "PtrLList.h"
namespace NOMADSUtil
{
class Mutex;
}
namespace IHMC_ACI
{
class DisseminationService;
class DisServiceMsg;
class DisServiceScheduler
{
public:
static const int _DATA_MESSAGES_TO_SEND;
static const uint8 _DEFAULT_PRIORITY;
DisServiceScheduler(DisseminationService * pDisService);
virtual ~DisServiceScheduler();
int enqueueMessage(DisServiceMsg * pMessage, const char * pszPurpose);
int sendMessages(void);
private:
struct MsgWrap
{
public:
MsgWrap(DisServiceMsg * pMessage, uint8 priority, const char * pszPurpose, int64 timeStamp);
virtual ~MsgWrap();
void setMessage(DisServiceMsg * pMessage);
void setPriority(uint8 priority);
void setTimeStamp(int64 timeStamp);
void setPurpose(const char * pszPurpose);
DisServiceMsg * getMessage(void);
uint8 getPriority(void);
int64 getTimeStamp(void);
const char * getPurpose(void);
bool operator > (MsgWrap &msgToMatch);
bool operator < (MsgWrap &msgToMatch);
bool operator == (MsgWrap &msgToMatch);
private:
int64 _timeStamp;
uint8 _priority;
char * _pszPurpose;
DisServiceMsg * _pMessage;
};
DisseminationService * _pDisService;
NOMADSUtil::PtrLList<MsgWrap> * _pOutgoingDataQueue;
NOMADSUtil::PtrLList<MsgWrap> * _pOutgoingCtrlQueue;
int16 _dataQueueCount;
int16 _ctrlQueueCount;
NOMADSUtil::Mutex _m;
};
inline DisServiceScheduler::MsgWrap::MsgWrap(DisServiceMsg * pMessage, uint8 priority, const char * pszPurpose, int64 timeStamp)
{
_timeStamp = timeStamp;
_priority = priority;
_pMessage = pMessage;
if(pszPurpose == NULL) {
_pszPurpose = NULL;
return;
}
_pszPurpose = NOMADSUtil::strDup (pszPurpose);
}
inline DisServiceScheduler::MsgWrap::~MsgWrap()
{
// do not delete the message
_pMessage = NULL;
free(_pszPurpose);
}
inline void DisServiceScheduler::MsgWrap::setMessage(DisServiceMsg * pMessage)
{
_pMessage = pMessage;
}
inline void DisServiceScheduler::MsgWrap::setPriority(uint8 priority)
{
_priority = priority;
}
inline void DisServiceScheduler::MsgWrap::setTimeStamp(int64 timeStamp)
{
_timeStamp = timeStamp;
}
inline void DisServiceScheduler::MsgWrap::setPurpose(const char * pszPurpose)
{
if(pszPurpose == NULL) {
_pszPurpose = NULL;
return;
}
if(_pszPurpose != NULL) {
free(_pszPurpose);
}
_pszPurpose = NOMADSUtil::strDup (pszPurpose);
}
inline DisServiceMsg * DisServiceScheduler::MsgWrap::getMessage(void)
{
return _pMessage;
}
inline uint8 DisServiceScheduler::MsgWrap::getPriority(void)
{
return _priority;
}
inline int64 DisServiceScheduler::MsgWrap::getTimeStamp(void)
{
return _timeStamp;
}
inline const char * DisServiceScheduler::MsgWrap::getPurpose(void)
{
return _pszPurpose;
}
inline bool DisServiceScheduler::MsgWrap::operator > (MsgWrap &msgToMatch)
{
/*if(_priority > msgToMatch._priority) {
return true;
}
if(_priority < msgToMatch._priority) {
return false;
}
if(_timeStamp >= msgToMatch._timeStamp) {
return true;
}*/
return !(operator <(msgToMatch));
}
inline bool DisServiceScheduler::MsgWrap::operator < (MsgWrap &msgToMatch)
{
if (_priority != msgToMatch._priority) {
return (_priority < msgToMatch._priority);
}
return (_timeStamp < msgToMatch._timeStamp);
/*if(_priority > msgToMatch._priority) return false;
if(_priority < msgToMatch._priority) return true;
if(_timeStamp >= msgToMatch._timeStamp) return false;*/
}
inline bool DisServiceScheduler::MsgWrap::operator == (MsgWrap &msgToMatch)
{
if((_priority == msgToMatch._priority) && (_timeStamp == msgToMatch._timeStamp)) {
return true;
}
return false;
}
}
#endif
#endif // INCL_DISSERVICE_SCHEDULER_H
|
#include "uartcomm.h"
void uart_init(unsigned int ubrr) {
UBRR0H = (unsigned char) (0xf & (ubrr >> 8));
UBRR0L = (unsigned char) (0xff & ubrr);
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
UCSR0C = 3 << UCSZ0;
}
void put_char(char data) {
while (!(UCSR0A & (1 << UDRE0)));
UDR0 = data;
}
void put_string(char *str) {
while (*str) put_char(*str++);
}
char get_char(void) {
while (!(UCSR0A & (1 << RXC0)));
return UDR0;
}
|
/**
* || ____ _ __
* +------+ / __ )(_) /_______________ _____ ___
* | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
* +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
* || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
*
* Crazyflie control firmware
*
* Copyright (C) 2011-2020 Bitcraze AB
*
* 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, in version 3.
*
* 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/>.
*
* collision_avoidance.h - Collision avoidance for multiple Crazyflies.
* Uses the buffered Voronoi collision avoidance algorithm:
*
* Zhou, Dingjiang, et al. "Fast, on-line collision avoidance for dynamic
* vehicles using buffered Voronoi cells." IEEE Robotics and Automation
* Letters 2.2 (2017): 1047-1054.
*
* Original author: James A. Preiss, University of Southern California, 2020.
*/
#ifndef __COLLISION_AVOIDANCE_H__
#define __COLLISION_AVOIDANCE_H__
#include "math3d.h"
#include "stabilizer_types.h"
// Algorithm parameters. They can be changed online by the user,
// but the algorithm will never mutate them.
typedef struct collision_avoidance_params_s
{
// The Crazyflie's boundary for collision checking is a tall ellipsoid.
// This accounts for the downwash effect: Due to the fast-moving stream of
// air produced by the rotors, the safe distance to pass underneath another
// rotorcraft is much further than the safe distance to pass to the side.
struct vec ellipsoidRadii;
// The minimal and maximal corners of the bounding box in which we fly.
// These are applied to the Crazyflie's center point only;
// the ellipsoid collision volume is ignored.
struct vec bboxMin;
struct vec bboxMax;
// The BVC algorithm will ensure that we stay within our Voronoi cell
// for this duration. Higher values lead to more conservative behavior.
float horizonSecs;
// Maximum speed (meters/second) we will command. This is currently enforced
// loosely with an infinity-norm box, so be conservative.
float maxSpeed;
// If the velocity ray from our position (in velocity mode) or the segment
// connecting our current position to goal position (in position mode)
// intersects a cell wall, and the intersection is within this distance,
// activate the "sidestep" heuristic and move to the right to avoid deadlock
// situations.
float sidestepThreshold;
// If peer localization measurements are older than this, ignore them.
// If negative, never ignore.
int maxPeerLocAgeMillis;
// Tolerance for projecting position vectors into our Voronoi cell.
// Units are roughly Euclidean distance in meters, but not exactly.
float voronoiProjectionTolerance;
// Max number of iterations for projecting into our Voronoi cell.
// Using Dykstra's algorithm.
int voronoiProjectionMaxIters;
} collision_avoidance_params_t;
// Mutable state of the algorithm.
typedef struct collision_avoidance_state_s
{
// In case our Voronoi cell becomes empty, due to e.g. a disturbance, we will
// attempt to stop and stay in place. To avoid self-compounding drift , we
// must keep track of a fixed position value rather than using the current
// state as a setpoint.
struct vec lastFeasibleSetPosition;
} collision_avoidance_state_t;
// Main computational routine. Mutates the setpoint such that the new setpoint
// respects the buffered Voronoi cell constraint.
//
// To facilitate compiling and testing on a PC, we take neighbor positions via
// array instead of having the implementation call peer_localization.h functions
// directly. On the other hand, we wish to use the minimum possible amount of
// memory. Therefore, we allow the input and workspace arrays to overlap. If
// otherPositions == workspace, this function will still work correctly, but it
// will overwrite the contents of otherPositions.
//
// Args:
// params: Algorithm parameters.
// collisionState: Algorithm mutable state.
// nOthers: Number of other Crazyflies in array arguments.
// otherPositons: [nOthers * 3] array of positions (meters).
// workspace: Space of no less than 7 * (nOthers + 6) floats. Used for
// temporary storage during computation. This can be the same address as
// otherPositions - otherPositions is copied into workspace immediately.
// setpoint: Setpoint from commander that will be mutated.
// sensorData: Not currently used, but kept for API similarity with sitAw.
// state: Current state estimate.
//
void collisionAvoidanceUpdateSetpointCore(
collision_avoidance_params_t const *params,
collision_avoidance_state_t *collisionState,
int nOthers,
float const *otherPositions,
float *workspace,
setpoint_t *setpoint, sensorData_t const *sensorData, state_t const *state);
// For ease of use, in a firmware build we include this wrapper that handles
// the interaction with peer_localization and gets all parameter values via the
// param system.
#ifdef CRAZYFLIE_FW
void collisionAvoidanceInit(void);
bool collisionAvoidanceTest(void);
// Wrapper that uses the peer localization system to construct the input arrays
// for collisionAvoidanceUpdateSetpointCore.
void collisionAvoidanceUpdateSetpoint(
setpoint_t *setpoint, sensorData_t const *sensorData, state_t const *state, uint32_t tick);
#endif // CRAZYFLIE_FW defined
#endif //__COLLISION_AVOIDANCE_H__
|
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_VERSION_H
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 46
#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
LIBAVCODEC_VERSION_MICRO)
#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
LIBAVCODEC_VERSION_MICRO)
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
/**
* Those FF_API_* defines are not part of public API.
* They may change, break or disappear at any time.
*/
#ifndef FF_API_PALETTE_CONTROL
#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_SAMPLE_FMT
#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_AUDIOCONVERT
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_ANTIALIAS_ALGO
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_REQUEST_CHANNELS
#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OPT_H
#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_THREAD_INIT
#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_FF_PICT_TYPES
#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_FLAC_GLOBAL_OPTS
#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_GET_PIX_FMT_NAME
#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_ALLOC_CONTEXT
#define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AVCODEC_OPEN
#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_DRC_SCALE
#define FF_API_DRC_SCALE (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_ER
#define FF_API_ER (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AVCODEC_INIT
#define FF_API_AVCODEC_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_X264_GLOBAL_OPTS
#define FF_API_X264_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_MPEGVIDEO_GLOBAL_OPTS
#define FF_API_MPEGVIDEO_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_LAME_GLOBAL_OPTS
#define FF_API_LAME_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_SNOW_GLOBAL_OPTS
#define FF_API_SNOW_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_MJPEG_GLOBAL_OPTS
#define FF_API_MJPEG_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_GET_ALPHA_INFO
#define FF_API_GET_ALPHA_INFO (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_PARSE_FRAME
#define FF_API_PARSE_FRAME (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_INTERNAL_CONTEXT
#define FF_API_INTERNAL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_TIFFENC_COMPLEVEL
#define FF_API_TIFFENC_COMPLEVEL (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_DATA_POINTERS
#define FF_API_DATA_POINTERS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_DECODE_AUDIO
#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_TIMECODE
#define FF_API_OLD_TIMECODE (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AVFRAME_AGE
#define FF_API_AVFRAME_AGE (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#endif /* AVCODEC_VERSION_H */
|
/**
* @file qq_process.h
*
* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _QQ_PROCESS_H
#define _QQ_PROCESS_H
#include <glib.h>
#include "connection.h"
#include "qq.h"
enum {
QQ_CMD_CLASS_NONE = 0,
QQ_CMD_CLASS_UPDATE_ALL,
QQ_CMD_CLASS_UPDATE_ONLINE,
QQ_CMD_CLASS_UPDATE_BUDDY,
QQ_CMD_CLASS_UPDATE_ROOM
};
guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
guint8 *rcved, gint rcved_len, guint32 update_class, guintptr ship_value);
void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
guint8 *rcved, gint rcved_len, guint32 update_class, guintptr ship_value);
void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq,
guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len,
guint32 update_class, guintptr ship_value);
void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len);
void qq_update_all(PurpleConnection *gc, guint16 cmd);
void qq_update_online(PurpleConnection *gc, guint16 cmd);
void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id);
void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id);
#endif
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=78:
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NumberObject_h___
#define NumberObject_h___
#include "jsnum.h"
namespace js {
class NumberObject : public JSObject
{
/* Stores this Number object's [[PrimitiveValue]]. */
static const unsigned PRIMITIVE_VALUE_SLOT = 0;
public:
static const unsigned RESERVED_SLOTS = 1;
/*
* Creates a new Number object boxing the given number. The object's
* [[Prototype]] is determined from context.
*/
static inline NumberObject *create(JSContext *cx, double d);
/*
* Identical to create(), but uses |proto| as [[Prototype]]. This method
* must not be used to create |Number.prototype|.
*/
static inline NumberObject *createWithProto(JSContext *cx, double d, JSObject &proto);
double unbox() const {
return getFixedSlot(PRIMITIVE_VALUE_SLOT).toNumber();
}
private:
inline void setPrimitiveValue(double d) {
setFixedSlot(PRIMITIVE_VALUE_SLOT, NumberValue(d));
}
/* For access to init, as Number.prototype is special. */
friend JSObject *
::js_InitNumberClass(JSContext *cx, JSObject *global);
};
} // namespace js
#endif /* NumberObject_h__ */
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "cpr_stdio.h"
#include "cpr_string.h"
#include "CSFLog.h"
/**
* @def LOG_MAX
*
* Constant represents the maximum allowed length for a message
*/
#define LOG_MAX 1024
/**
* @addtogroup DebugAPIs The CPR Logging Abstractions
* @ingroup CPR
* @brief The CPR Debug/Logging APIs
*
* @{
*/
/**
* Debug message
*
* @param _format format string
* @param ... variable arg list
*
* @return Return code from vsnprintf
*
* @pre (_format not_eq NULL)
*/
int
buginf (const char *_format, ...)
{
char fmt_buf[LOG_MAX + 1];
va_list ap;
int rc;
va_start(ap, _format);
rc = vsnprintf(fmt_buf, LOG_MAX, _format, ap);
va_end(ap);
if (rc <= 0) {
return rc;
}
CSFLogDebug("cpr", "%s", fmt_buf);
return rc;
}
/**
* Debug message that can be larger than #LOG_MAX
*
* @param str - a fixed constant string
*
* @return zero(0)
*
* @pre (str not_eq NULL)
*/
int
buginf_msg (const char *str)
{
char buf[LOG_MAX + 1];
const char *p;
int16_t len;
// terminate buffer
buf[LOG_MAX] = NUL;
len = (int16_t) strlen(str);
if (len > LOG_MAX) {
p = str;
do {
memcpy(buf, p, LOG_MAX);
p += LOG_MAX;
len -= LOG_MAX;
printf("%s",buf);
} while (len > LOG_MAX);
if (len)
{
CSFLogDebug("cpr", "%s", (char *) p);
}
}
else
{
CSFLogDebug("cpr", "%s", (char *) str);
}
return 0;
}
/**
* Error message
*
* @param _format format string
* @param ... variable arg list
*
* @return Return code from vsnprintf
*
* @pre (_format not_eq NULL)
*/
void
err_msg (const char *_format, ...)
{
char fmt_buf[LOG_MAX + 1];
va_list ap;
int rc;
va_start(ap, _format);
rc = vsnprintf(fmt_buf, LOG_MAX, _format, ap);
va_end(ap);
if (rc <= 0) {
return;
}
CSFLogError("cpr", "%s", fmt_buf);
}
/**
* Notice message
*
* @param _format format string
* @param ... variable arg list
*
* @return Return code from vsnprintf
*
* @pre (_format not_eq NULL)
*/
void
notice_msg (const char *_format, ...)
{
char fmt_buf[LOG_MAX + 1];
va_list ap;
int rc;
va_start(ap, _format);
rc = vsnprintf(fmt_buf, LOG_MAX, _format, ap);
va_end(ap);
if (rc <= 0) {
return;
}
CSFLogInfo("cpr", "%s", fmt_buf);
}
|
// This file is generated by tools/gen_operators.pl. CHANGES WILL BE OVERWRITTEN
/* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef LIBSIMDPP_SIMDPP_CORE_F_DIV_OPERATOR_H
#define LIBSIMDPP_SIMDPP_CORE_F_DIV_OPERATOR_H
#ifndef LIBSIMDPP_SIMD_H
#error "This file must be included through simd.h"
#endif
#include <simdpp/types.h>
#include <simdpp/detail/insn/f_div.h>
#include <simdpp/core/detail/scalar_arg_impl.h>
namespace simdpp {
#ifndef SIMDPP_DOXYGEN
namespace SIMDPP_ARCH_NAMESPACE {
#endif
/** Divides the values of two vectors.
@code
r0 = a0 / b0
...
rN = aN / bN
@endcode
@icost{NEON, 6}
@icost{ALTIVEC, 10}
@par 256-bit version:
@icost{SSE2-SSE4.1, 2}
@icost{NEON, 12}
@icost{ALTIVEC, 19}
*/
template<unsigned N, class E1, class E2> SIMDPP_INL
float32<N, float32<N>> operator/(const float32<N,E1>& a, const float32<N,E2>& b)
{
return detail::insn::i_div(a.eval(), b.eval());
}
SIMDPP_SCALAR_ARG_IMPL_VEC(operator/, float32, float32)
/** Divides the values of two vectors
@code
r0 = a0 / b0
...
rN = aN / bN
@endcode
@par 128-bit version:
@novec{NEON, ALTIVEC}
@par 256-bit version:
@icost{SSE2-SSE4.1, 2}
@novec{NEON, ALTIVEC}
*/
template<unsigned N, class E1, class E2> SIMDPP_INL
float64<N, float64<N>> operator/(const float64<N,E1>& a, const float64<N,E2>& b)
{
return detail::insn::i_div(a.eval(), b.eval());
}
SIMDPP_SCALAR_ARG_IMPL_VEC(operator/, float64, float64)
#ifndef SIMDPP_DOXYGEN
} // namespace SIMDPP_ARCH_NAMESPACE
#endif
} // namespace simdpp
#endif
|
/* This code is subject to the terms of the Mozilla Public License, v.2.0. http://mozilla.org/MPL/2.0/. */
#pragma once
#include "storage/IWriter.h"
#include <string>
class MockStoreWriter : public IWriter
{
public:
MockStoreWriter();
bool good() const;
unsigned long long position() const;
int write(const char* buffer, unsigned length);
bool flush();
bool close();
IReader* reader() const;
static std::string calls();
public:
unsigned long long _position = 0;
std::string _reader;
};
|
#include "../Image.h"
#include "IndexTaker.h"
namespace Img{
namespace Manipulation{
class ClickIndexTaker : public IndexTaker {
private:
Image _data;
public:
ClickIndexTaker(const Image& data);
virtual void updateCoords(int row, int column);
};
}
}
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef jit_mips32_LIR_mips32_h
#define jit_mips32_LIR_mips32_h
namespace js {
namespace jit {
class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1>
{
MIRType type_;
public:
LIR_HEADER(BoxFloatingPoint);
LBoxFloatingPoint(const LAllocation& in, const LDefinition& temp, MIRType type)
: type_(type)
{
setOperand(0, in);
setTemp(0, temp);
}
MIRType type() const {
return type_;
}
const char* extraName() const {
return StringFromMIRType(type_);
}
};
class LUnbox : public LInstructionHelper<1, 2, 0>
{
public:
LIR_HEADER(Unbox);
MUnbox* mir() const {
return mir_->toUnbox();
}
const LAllocation* payload() {
return getOperand(0);
}
const LAllocation* type() {
return getOperand(1);
}
const char* extraName() const {
return StringFromMIRType(mir()->type());
}
};
class LUnboxFloatingPoint : public LInstructionHelper<1, 2, 0>
{
MIRType type_;
public:
LIR_HEADER(UnboxFloatingPoint);
static const size_t Input = 0;
LUnboxFloatingPoint(const LBoxAllocation& input, MIRType type)
: type_(type)
{
setBoxOperand(Input, input);
}
MUnbox* mir() const {
return mir_->toUnbox();
}
MIRType type() const {
return type_;
}
const char* extraName() const {
return StringFromMIRType(type_);
}
};
class LDivOrModI64 : public LCallInstructionHelper<INT64_PIECES, INT64_PIECES*2, 0>
{
public:
LIR_HEADER(DivOrModI64)
static const size_t Lhs = 0;
static const size_t Rhs = INT64_PIECES;
LDivOrModI64(const LInt64Allocation& lhs, const LInt64Allocation& rhs)
{
setInt64Operand(Lhs, lhs);
setInt64Operand(Rhs, rhs);
}
MBinaryArithInstruction* mir() const {
MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
return static_cast<MBinaryArithInstruction*>(mir_);
}
bool canBeDivideByZero() const {
if (mir_->isMod())
return mir_->toMod()->canBeDivideByZero();
return mir_->toDiv()->canBeDivideByZero();
}
bool canBeNegativeOverflow() const {
if (mir_->isMod())
return mir_->toMod()->canBeNegativeDividend();
return mir_->toDiv()->canBeNegativeOverflow();
}
wasm::TrapOffset trapOffset() const {
MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
if (mir_->isMod())
return mir_->toMod()->trapOffset();
return mir_->toDiv()->trapOffset();
}
};
class LUDivOrModI64 : public LCallInstructionHelper<INT64_PIECES, INT64_PIECES*2, 0>
{
public:
LIR_HEADER(UDivOrModI64)
static const size_t Lhs = 0;
static const size_t Rhs = INT64_PIECES;
LUDivOrModI64(const LInt64Allocation& lhs, const LInt64Allocation& rhs)
{
setInt64Operand(Lhs, lhs);
setInt64Operand(Rhs, rhs);
}
MBinaryArithInstruction* mir() const {
MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
return static_cast<MBinaryArithInstruction*>(mir_);
}
bool canBeDivideByZero() const {
if (mir_->isMod())
return mir_->toMod()->canBeDivideByZero();
return mir_->toDiv()->canBeDivideByZero();
}
bool canBeNegativeOverflow() const {
if (mir_->isMod())
return mir_->toMod()->canBeNegativeDividend();
return mir_->toDiv()->canBeNegativeOverflow();
}
wasm::TrapOffset trapOffset() const {
MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
if (mir_->isMod())
return mir_->toMod()->trapOffset();
return mir_->toDiv()->trapOffset();
}
};
class LWasmTruncateToInt64 : public LCallInstructionHelper<INT64_PIECES, 1, 0>
{
public:
LIR_HEADER(WasmTruncateToInt64);
explicit LWasmTruncateToInt64(const LAllocation& in)
{
setOperand(0, in);
}
MWasmTruncateToInt64* mir() const {
return mir_->toWasmTruncateToInt64();
}
};
} // namespace jit
} // namespace js
#endif /* jit_mips32_LIR_mips32_h */
|
/*
This file is part of the MinSG library extension SkeletalAnimation.
Copyright (C) 2011-2012 Lukas Kopecki
This library is subject to the terms of the Mozilla Public License, v. 2.0.
You should have received a copy of the MPL along with this library; see the
file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifdef MINSG_EXT_SKELETAL_ANIMATION
#ifndef PADrend_AbstractPose_h
#define PADrend_AbstractPose_h
#include <string>
#include <deque>
#include <Geometry/Vec3.h>
#include <Geometry/Matrix4x4.h>
namespace MinSG {
class AbstractJoint;
}
namespace MinSG {
/*
* @Brief entry point for animation data.
*
* Animation data is described by keyframes, timeline and interpolation type.
* - Keyframe is a 4x4 matrix describing the joint position at a given time.
* - Timeline the relative times for each keyframe.
* - Interpolationtype describing the interpolation type between each keyframe.
*
* Keyframe size and timeline size have to be the same. If no interpolationtype is
* given a linear interpolation will be used.
*
*/
class AbstractPose
{
private:
mutable AbstractJoint *node;
protected:
mutable std::deque<Geometry::Matrix4x4> keyframes;
std::deque<double> timeline;
std::deque<uint32_t> interpolationTypes;
uint32_t currentInterpolationType;
int status;
double startTime;
uint32_t maxPoseCount;
/*
* Do all initializatoin here.
*/
virtual void init(std::deque<double> _values, std::deque<double> _timeline, std::deque<uint32_t> _interpolationTypes, double _startTime) = 0;
public:
/****************************************************************
* enumeration representing the current playback state.
****************************************************************/
enum poseStatus { STOPPED, RUNNING};
/****************************************************************
* Interpolation types
* - Linear, linear interpolation using slices between keyframes
* - Constant, jumps after the middle to the target keyframe
* - Bezier, Currently not implemented. Should smoothly interpolate
* using bezier curves.
****************************************************************/
static const uint32_t LINEAR = 0;
static const uint32_t CONSTANT = 1;
static const uint32_t BEZIER = 2;
MINSGAPI AbstractPose(AbstractJoint *joint);
virtual ~AbstractPose(){ };
/****************************************************************
* value access.
****************************************************************/
virtual void setValues(std::deque<double> _values, std::deque<double> _timeline, std::deque<uint32_t> _interpolationTypes) = 0;
virtual void setValues(std::deque<Geometry::Matrix4x4> _values, std::deque<double> _timeline, std::deque<uint32_t> _interpolationTypes) = 0;
virtual void addValue(Geometry::Matrix4x4 _value, double _timeline, uint32_t _interpolationType, uint32_t _index) = 0;
virtual void removeValue(uint32_t _index) = 0;
virtual void update(double timeSec) = 0;
virtual void restart() = 0;
virtual AbstractPose* split(uint32_t start, uint32_t end) = 0;
uint32_t getSize() { return static_cast<uint32_t>(timeline.size()); }
std::deque<double> &getTimeline() { return timeline; }
MINSGAPI bool setTimeline(std::deque<double> _timeline, bool relative=true);
std::deque<uint32_t> *getInterpolationTypes() { return &interpolationTypes; }
uint32_t getMaxPoseCount() { return maxPoseCount; }
/****************************************************************
* play access.
****************************************************************/
MINSGAPI void play();
MINSGAPI void stop();
void setStartTime(double _startTime) { startTime = _startTime; }
double getStartTime() { return startTime; }
double getMinTime() const { return timeline.front(); }
double getMaxTime() const { return timeline.back(); }
double getDuration() const { return timeline.back() - timeline.front(); }
/****************************************************************
* Joint connection.
****************************************************************/
virtual void bindToJoint(AbstractJoint *_node);
AbstractJoint *getBindetJoint() const { return node; }
int getStatus() { return status; }
std::deque<Geometry::Matrix4x4> & getKeyframes() { return keyframes; }
/****************************************************************
* ---|> State
****************************************************************/
virtual AbstractPose *clone() const = 0;
};
}
#endif
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.