hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
125ba7546529ee640eb636e4f56b548367a4482d | 2,121 | h | C | Project/InputManager.h | SimplyJpk/Empty-SDL2-GL-Project | c4bcd4d16e73cd29a440f8af3fb1116cb77da198 | [
"MIT"
] | null | null | null | Project/InputManager.h | SimplyJpk/Empty-SDL2-GL-Project | c4bcd4d16e73cd29a440f8af3fb1116cb77da198 | [
"MIT"
] | null | null | null | Project/InputManager.h | SimplyJpk/Empty-SDL2-GL-Project | c4bcd4d16e73cd29a440f8af3fb1116cb77da198 | [
"MIT"
] | null | null | null | #pragma once
#include "SDL.h"
#include "Vec2.h"
#include <backends/imgui_impl_sdl.h>
#include <algorithm>
#include <vector>
#include "InputKeyCodes.h"
//TODO Implement an event system? Would be nice to call events from here
class InputManager
{
public:
static InputManager* Instance();
void Update();
bool IsAnyKeyDown();
bool IsMovementKeysDown();
// Mouse
// Pressed this frame
bool GetMouseDown(short button);
// Released this frame
bool GetMouseUp(short button);
// State of mouse button (Down/Up)
bool GetMouseButton(short button) const;
// Keyboard
// If the key is being pressed during this frame. (First, or ongoing)
bool IsKeyHeld(KeyCode key_code);
// Pressed this frame
bool GetKeyDown(KeyCode key_code);
// Released this frame
bool GetKeyUp(KeyCode key_code);
// State of key (Down/Up)
bool GetKeyButton(KeyCode key_code) const;
// Helper Methods
int MouseX() const { return mouse_x_; }
int MouseY() const { return mouse_y_; }
IVec2 MousePosition() const { return mouse_pos_; }
void operator=(InputManager const&) const { }
bool IsShuttingDown() { return GetKeyDown(KeyCode::Escape); };
protected:
static inline bool IsValidKey(KeyCode& key_code);
private:
InputManager();
InputManager(InputManager const&) { }
static InputManager* instance_;
const Uint8* keyboard_ = nullptr;
uint32_t mouse_ = 0;
int mouse_x_ = 0, mouse_y_ = 0;
IVec2 mouse_pos_ = IVec2::Zero();
IVec2 mouse_scroll_ = IVec2::Zero();
bool is_movement_down_ = false;
bool is_any_key_down_ = false;
bool is_key_held_[keycode_max_value]{ false };
bool is_key_down_[keycode_max_value]{ false };
bool is_key_up_[keycode_max_value]{ false };
bool is_mouse_down_[MouseClickTypeCount]{ false };
bool is_mouse_up_[MouseClickTypeCount]{ false };
std::vector<int> movement_keys_ = {
static_cast<int>(KeyCode::W),
static_cast<int>(KeyCode::A),
static_cast<int>(KeyCode::S),
static_cast<int>(KeyCode::D),
static_cast<int>(KeyCode::Q),
static_cast<int>(KeyCode::E)
};
};
| 25.865854 | 72 | 0.694484 |
583823865d6dd24d838864b98dcff36be7069b12 | 487 | h | C | AOCLib/src/FStreamReader.h | tux2nicolae/AOC | 4d8d7733b079e9609ec6d718d1a05f2d1cf727e7 | [
"MIT"
] | 1 | 2018-12-21T09:19:07.000Z | 2018-12-21T09:19:07.000Z | AOCLib/src/FStreamReader.h | tux2nicolae/AOC | 4d8d7733b079e9609ec6d718d1a05f2d1cf727e7 | [
"MIT"
] | null | null | null | AOCLib/src/FStreamReader.h | tux2nicolae/AOC | 4d8d7733b079e9609ec6d718d1a05f2d1cf727e7 | [
"MIT"
] | 1 | 2018-12-20T12:38:05.000Z | 2018-12-20T12:38:05.000Z | #pragma once
/**
* Advent of code 2018
* @author : Nicolae Telechi
*/
class FStreamReader
{
public:
/**
* Input stream
*/
FStreamReader(ifstream & aIn);
vector<int> ReadVector();
vector<string> ReadVectorOfWords();
vector<vector<int>> ReadMatrix();
vector<vector<int>> ReadMatrixOfDigits();
vector<vector<string>> ReadMatrixOfWords();
private:
ifstream & mFileStream;
vector<int> ReadLineAsVectorOfDigits();
vector<string> ReadLineAsVectorOfWords();
};
| 17.392857 | 45 | 0.698152 |
55c458a892bffdcf6f3b5f0a05a9e02a848d6599 | 3,848 | h | C | LibCarla/source/carla/trafficmanager/MotionPlannerStage.h | youngsend/carla | c918f4b73b6b845dc66ccf3ffe3f011e800607ec | [
"MIT"
] | 1 | 2020-03-28T20:47:07.000Z | 2020-03-28T20:47:07.000Z | LibCarla/source/carla/trafficmanager/MotionPlannerStage.h | davidgfb/carla | c918f4b73b6b845dc66ccf3ffe3f011e800607ec | [
"MIT"
] | null | null | null | LibCarla/source/carla/trafficmanager/MotionPlannerStage.h | davidgfb/carla | c918f4b73b6b845dc66ccf3ffe3f011e800607ec | [
"MIT"
] | null | null | null | // Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#pragma once
#include <chrono>
#include <unordered_map>
#include <vector>
#include "carla/client/Vehicle.h"
#include "carla/geom/Math.h"
#include "carla/rpc/Actor.h"
#include "carla/trafficmanager/MessengerAndDataTypes.h"
#include "carla/trafficmanager/Parameters.h"
#include "carla/trafficmanager/PIDController.h"
#include "carla/trafficmanager/PipelineStage.h"
namespace carla {
namespace traffic_manager {
namespace chr = std::chrono;
namespace cc = carla::client;
using Actor = carla::SharedPtr<cc::Actor>;
using ActorId = carla::rpc::ActorId;
/// The class is responsible for aggregating information from various stages
/// like the localization stage, traffic light stage, collision detection
/// stage and actuation signals from the PID controller and makes decisions
/// on how to move the vehicle to follow it's trajectory safely.
class MotionPlannerStage : public PipelineStage {
private:
/// Selection key to switch between the output frames.
bool frame_selector;
/// Pointers to data frames to be shared with the batch control stage
std::shared_ptr<PlannerToControlFrame> control_frame_a;
std::shared_ptr<PlannerToControlFrame> control_frame_b;
/// Pointers to data frames received from various stages.
std::shared_ptr<LocalizationToPlannerFrame> localization_frame;
std::shared_ptr<CollisionToPlannerFrame> collision_frame;
std::shared_ptr<TrafficLightToPlannerFrame> traffic_light_frame;
/// Pointers to messenger objects connecting to various stages.
std::shared_ptr<LocalizationToPlannerMessenger> localization_messenger;
std::shared_ptr<CollisionToPlannerMessenger> collision_messenger;
std::shared_ptr<TrafficLightToPlannerMessenger> traffic_light_messenger;
std::shared_ptr<PlannerToControlMessenger> control_messenger;
/// Map to store states for integral and differential components
/// of the PID controller for every vehicle
std::unordered_map<ActorId, StateEntry> pid_state_map;
/// Run time parameterization object.
Parameters ¶meters;
/// Configuration parameters for the PID controller.
std::vector<float> urban_longitudinal_parameters;
std::vector<float> highway_longitudinal_parameters;
std::vector<float> urban_lateral_parameters;
std::vector<float> highway_lateral_parameters;
std::vector<float> longitudinal_parameters;
std::vector<float> lateral_parameters;
/// Controller object.
PIDController controller;
/// Number of vehicles registered with the traffic manager.
uint64_t number_of_vehicles;
/// Reference to Carla's debug helper object.
cc::DebugHelper &debug_helper;
public:
MotionPlannerStage(
std::string stage_name,
std::shared_ptr<LocalizationToPlannerMessenger> localization_messenger,
std::shared_ptr<CollisionToPlannerMessenger> collision_messenger,
std::shared_ptr<TrafficLightToPlannerMessenger> traffic_light_messenger,
std::shared_ptr<PlannerToControlMessenger> control_messenger,
Parameters ¶meters,
std::vector<float> longitudinal_parameters,
std::vector<float> highway_longitudinal_parameters,
std::vector<float> lateral_parameters,
std::vector<float> highway_lateral_parameters,
cc::DebugHelper &debug_helper);
~MotionPlannerStage();
void DataReceiver() override;
void Action() override;
void DataSender() override;
void DrawPIDValues(const boost::shared_ptr<cc::Vehicle> vehicle, const float throttle, const float brake);
};
} // namespace traffic_manager
} // namespace carla
| 37.72549 | 110 | 0.755977 |
21f4f9b9c9ed03812294a16ed2777bd55d4f7335 | 14,076 | h | C | PROX/FOUNDATION/SPARSE/SPARSE/include/sparse_block.h | diku-dk/PROX | c6be72cc253ff75589a1cac28e4e91e788376900 | [
"MIT"
] | 2 | 2019-11-27T09:44:45.000Z | 2020-01-13T00:24:21.000Z | PROX/FOUNDATION/SPARSE/SPARSE/include/sparse_block.h | erleben/matchstick | 1cfdc32b95437bbb0063ded391c34c9ee9b9583b | [
"MIT"
] | null | null | null | PROX/FOUNDATION/SPARSE/SPARSE/include/sparse_block.h | erleben/matchstick | 1cfdc32b95437bbb0063ded391c34c9ee9b9583b | [
"MIT"
] | null | null | null | #ifndef SPARSE_BLOCK_H
#define SPARSE_BLOCK_H
#include <sparse_block_algebra.h>
#include <algorithm> // for std::fill, std::copy, std::equal
#include <cassert>
namespace sparse
{
namespace detail
{
template <typename B>
class BlockAccessor
{
public:
typedef B block_type;
typedef typename B::data_container_type data_container_type;
static data_container_type& data(block_type& src)
{
return src.m_data;
}
static data_container_type const& data(block_type const& src)
{
return src.m_data;
}
static void copy(block_type const& orig, block_type& src)
{
src.copy_(orig);
}
};
} // namespace detail
/**
* Generic Dense Block type.
* To integrate with CUDA, it is necessary that the only members are
* C-convertible data so that an array of blocks may be copied directly
* to device memory as an array of C-convertible data.
*
* @tparam M The number of rows in the block.
* @tparam N The number of columns in the block.
* @tparam T The value type of the entries in the block. Usually float or double.
*/
template <size_t M, size_t N, typename T>
class Block
{
public:
typedef Block<M,N,T> block_type;
typedef T value_type;
typedef T& reference;
typedef T const& const_reference;
typedef T* pointer;
typedef T const* const_pointer;
typedef T* iterator;
typedef T const* const_iterator;
typedef detail::BlockAccessor<block_type> accessor;
protected:
typedef T * data_container_type;
private:
friend class detail::BlockAccessor<block_type>;
protected:
value_type m_data[M*N];
protected:
void fast_copy(block_type const& orig)
{
// 2009-06-30 Kenny: Why not make sure that ADL works?
// 2009-06-30 Kenny: Why do not this->size() and this->m_data?
std::copy(orig.m_data, orig.m_data + size(), m_data);
}
public:
Block() {}
Block(const_reference v) { *this = v; }
Block(block_type const& orig) { fast_copy(orig); }
~Block() { }
block_type& operator=(block_type const& rhs)
{
if (&rhs != this)
{
fast_copy(rhs);
}
return *this;
}
block_type& operator=(const_reference rhs)
{
// 2009-06-30 Kenny: Why not make sure that ADL works?
// 2009-06-30 Kenny: Why do not this->size() and this->m_data?
std::fill(m_data, m_data + size(), rhs);
return *this;
}
bool operator==(block_type const& rhs) const
{
// 2009-06-30 Kenny: Why not make sure that ADL works?
// 2009-06-30 Kenny: Why do not this->begin() and this->end()?
return std::equal(begin(), end(), rhs.begin());
}
// 2009-06-30 Kenny: Why do not this->operator==(...)?
bool operator!=(block_type const& rhs) const { return !operator==(rhs); }
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
value_type& operator[](size_t const i)
{
// 2009-06-30 Kenny: Why do not this->size()?
assert(i < size() || !"i was too large");
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data[i];
}
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
value_type const& operator[](size_t const i) const
{
// 2009-06-30 Kenny: Why do not this->size()?
assert(i < size() || !"i was too large");
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data[i];
}
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
value_type& operator()(size_t const i, size_t const j)
{
// 2009-06-30 Kenny: Why do not this->nrows() and this->ncols()?
assert(((i < nrows()) && (j < ncols())) || !"i or j were too large");
// 2009-06-30 Kenny: Why do not this->m_data and this->ncols()?
return m_data[i*ncols()+j];
}
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
value_type const& operator()(size_t const i, size_t const j) const
{
// 2009-06-30 Kenny: Why do not this->nrows() and this->ncols()?
assert(((i < nrows()) && (j < ncols())) || !"i or j were too large");
// 2009-06-30 Kenny: Why do not this->m_data and this->ncols()?
return m_data[i*ncols()+j];
}
void clear_data()
{
size_t const size = M*N;
//#pragma unroll
for( size_t i = 0u; i < size; ++i )
{
m_data[i] = 0; // 2010-04-03 Kenny: Use proper value traits
}
}
// 2009-06-30 Kenny: Why not use this->m_data and this->size()?
iterator begin() { return m_data; }
iterator end() { return m_data+size(); }
const_iterator begin() const { return m_data; }
const_iterator end() const { return m_data+size(); }
// 2009-06-30 Kenny: Maybe this should be emum typedefs to avoid runtime overhead?
static size_t nrows() { return M; }
// 2009-06-30 Kenny: Maybe this should be emum typedefs to avoid runtime overhead?
static size_t ncols() { return N; }
// 2009-06-30 Kenny: Maybe this should be emum typedefs to avoid runtime overhead?
// 2009-06-30 Kenny: Is M*N done at compile time or run-time?
static size_t size() { return M*N; }
public:
static Block<M,M,T> identity()
{
Block<M,M,T> B;
B.clear_data();
assert(M==N || "Not a square matrix");
for(size_t i = 0; i < M; ++i)
{
B(i,i) = 1;
}
return B;
}
static Block<M,M,T> make_diag(T const & d)
{
Block<M,M,T> B;
B.clear_data();
assert(M==N || "Not a square matrix");
for(size_t i = 0; i < M; ++i)
{
B(i,i) = d;
}
return B;
}
};
/**
* Specialization for a Column Block Type.
*
* @tparam M The number of rows in the column block.
* @tparam T The value type of the entries in the block, usually float or double.
*/
template <size_t M, typename T>
class Block<M,1,T>
{
public:
typedef Block<M,1,T> block_type;
typedef T value_type;
typedef T& reference;
typedef T const& const_reference;
typedef T* pointer;
typedef T const* const_pointer;
typedef T* iterator;
typedef T const* const_iterator;
protected:
typedef T* data_container_type;
private:
friend class detail::BlockAccessor<block_type>;
protected:
value_type m_data[M];
protected:
void fast_copy(block_type const& orig)
{
// 2009-06-30 Kenny: Why not make sure that ADL works?
// 2009-06-30 Kenny: Why do not this->size() and this->m_data?
std::copy(orig.m_data, orig.m_data + size(), m_data);
}
public:
Block(){}
Block(value_type const& v) { *this = v; }
Block(block_type const& orig) { fast_copy(orig); }
~Block() { }
block_type& operator=(block_type const& rhs)
{
if (&rhs != this)
{
fast_copy(rhs);
}
return *this;
}
block_type& operator=(value_type const& rhs)
{
// 2009-06-30 Kenny: Why not make sure that ADL works?
// 2009-06-30 Kenny: Why do not this->size() and this->m_data?
std::fill(m_data, m_data + size(), rhs);
return *this;
}
// 2009-06-30 Kenny: Why not make sure that ADL works?
// 2009-06-30 Kenny: Why do not this->begin() and this->end()?
bool operator==(block_type const& rhs) const { return std::equal(begin(), end(), rhs.begin()); }
bool operator!=(block_type const& rhs) const { return !operator==(rhs); }
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
value_type& operator[](size_t const i)
{
// 2009-06-30 Kenny: Why do not this->size()?
assert(i < size() || !"i was too large");
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data[i];
}
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
value_type const& operator[](size_t const i) const
{
// 2009-06-30 Kenny: Why do not this->size()?
assert(i < size() || !"i was too large");
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data[i];
}
// 2009-06-30 Kenny: Documentation needed. Not obvious when to use square brackets (raw linear access to data) and when to use rounded parentheses (matrix indices).
// 2009-06-30 Kenny: Why do not this->operator[]()?
value_type& operator()(size_t const i) { return operator[](i); }
value_type const& operator()(size_t const i) const { return operator[](i); }
/*clear data in block*/
void clear_data()
{
//#pragma unroll
for( size_t i = 0; i < M; ++i )
{
m_data[i] = 0; // 2010-04-03 Kenny: use proper value traits
}
}
// 2009-06-30 Kenny: Why do not this->m_data and this->size()?
iterator begin() { return m_data; }
const_iterator begin() const { return m_data; }
iterator end() { return m_data+size(); }
const_iterator end() const { return m_data+size(); }
// 2009-06-30 Kenny: Maybe this should be emum typedefs to avoid runtime overhead?
static size_t nrows() { return M; }
static size_t ncols() { return 1; }
static size_t size() { return M; }
public:
static Block<3,1,T> i()
{
Block<3,1,T> B;
B.clear_data();
B[0] = 1.0;
return B;
}
static Block<3,1,T> j()
{
Block<3,1,T> B;
B.clear_data();
B[1] = 1.0;
return B;
}
static Block<3,1,T> k()
{
Block<3,1,T> B;
B.clear_data();
B[2] = 1.0;
return B;
}
static Block<3,1,T> make(T const & i, T const & j, T const & k)
{
Block<3,1,T> B;
B[0] = i;
B[1] = j;
B[2] = k;
return B;
}
};
/**
* Specialization for a Scalar Block Type.
*/
template <typename T>
class Block<1,1,T>
{
public:
typedef Block<1,1,T> block_type;
typedef T value_type;
typedef T& reference;
typedef T const& const_reference;
typedef T* pointer;
typedef T const* const_pointer;
typedef T* iterator;
typedef T const* const_iterator;
protected:
typedef T data_container_type;
private:
friend class detail::BlockAccessor<block_type>;
protected:
value_type m_data;
public:
Block(){ }
Block(value_type const& v)
: m_data(v)
{ }
Block(block_type const& orig)
: m_data(orig.m_data)
{ }
~Block(){}
// 2009-06-30 Kenny: Why do not this->m_data?
operator value_type() { return m_data; }
block_type& operator=(value_type const& rhs)
{
// 2009-06-30 Kenny: Why do not this->m_data?
m_data = rhs;
return *this;
}
// 2009-06-30 Kenny: Why do not this->m_data?
bool operator==(block_type const& rhs) const { return m_data == rhs.m_data; }
bool operator==(value_type const& rhs) const { return m_data == rhs; }
// 2009-06-30 Kenny: Why do not this->operator==()?
bool operator!=(value_type const& rhs) const { return !operator==(rhs); }
value_type& operator[](size_t const i)
{
assert((i == 0) || !"i was nonzero" );
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data;
}
value_type const& operator[](size_t const i) const
{
assert((i == 0) || !"i was nonzero");
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data;
}
value_type& operator()(size_t const i, size_t const j)
{
assert(((i == 0) && (j == 0)) || !"i or j were nonzero" );
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data;
}
value_type const& operator()(size_t const i, size_t const j) const
{
assert(((i == 0) && (j == 0)) || ! "i or j were nonzero");
// 2009-06-30 Kenny: Why do not this->m_data?
return m_data;
}
/*clear data in block*/
void clear_data()
{
m_data = 0;
}
// 2009-06-30 Kenny: Why do not this->m_data?
iterator begin() { return &m_data; }
const_iterator begin() const { return &m_data; }
// 2009-06-30 Kenny: Why do not this->m_data and this->size()?
iterator end() { return &m_data+size(); }
const_iterator end() const { return &m_data+size(); }
// 2009-06-30 Kenny: Maybe this should be emum typedefs to avoid runtime overhead?
static size_t nrows() { return 1; }
static size_t ncols() { return 1; }
static size_t size() { return 1; }
};
} // namespace sparse
// SPARSE_BLOCK_H
#endif
| 28.551724 | 172 | 0.559463 |
0e87fea7af952acb15a24904329ffd2719ea36b9 | 277 | h | C | input.h | tflovorn/ctetra | 1a788d6c36d4a0773d4a2fca4d23a8e4d1fd87a1 | [
"MIT"
] | null | null | null | input.h | tflovorn/ctetra | 1a788d6c36d4a0773d4a2fca4d23a8e4d1fd87a1 | [
"MIT"
] | 1 | 2016-11-19T22:44:14.000Z | 2016-11-30T15:23:35.000Z | input.h | tflovorn/ctetra | 1a788d6c36d4a0773d4a2fca4d23a8e4d1fd87a1 | [
"MIT"
] | null | null | null | #ifndef CTETRA_INPUT_H
#define CTETRA_INPUT_H
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
typedef void (*InputFn)(double k[3], gsl_vector *values);
typedef void (*UEInputFn)(double k[3], gsl_vector *evalues, gsl_matrix_complex *evecs);
#endif // CTETRA_INPUT_H
| 23.083333 | 87 | 0.761733 |
8a432fcee8c5a1ca98adf4832a959d939eb5acd9 | 33,232 | c | C | test/suites/ctype/test_isbdigit.c | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | test/suites/ctype/test_isbdigit.c | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | test/suites/ctype/test_isbdigit.c | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
#include "ctype_test.h"
void t_isbdigit_0x00()
{
Assert(isbdigit(0) == 0 ,"isbdigit should be 0 for 0x00");
}
void t_isbdigit_0x01()
{
Assert(isbdigit(1) == 0 ,"isbdigit should be 0 for 0x01");
}
void t_isbdigit_0x02()
{
Assert(isbdigit(2) == 0 ,"isbdigit should be 0 for 0x02");
}
void t_isbdigit_0x03()
{
Assert(isbdigit(3) == 0 ,"isbdigit should be 0 for 0x03");
}
void t_isbdigit_0x04()
{
Assert(isbdigit(4) == 0 ,"isbdigit should be 0 for 0x04");
}
void t_isbdigit_0x05()
{
Assert(isbdigit(5) == 0 ,"isbdigit should be 0 for 0x05");
}
void t_isbdigit_0x06()
{
Assert(isbdigit(6) == 0 ,"isbdigit should be 0 for 0x06");
}
void t_isbdigit_0x07()
{
Assert(isbdigit(7) == 0 ,"isbdigit should be 0 for 0x07");
}
void t_isbdigit_0x08()
{
Assert(isbdigit(8) == 0 ,"isbdigit should be 0 for 0x08");
}
void t_isbdigit_0x09()
{
Assert(isbdigit(9) == 0 ,"isbdigit should be 0 for 0x09");
}
void t_isbdigit_0x0a()
{
Assert(isbdigit(10) == 0 ,"isbdigit should be 0 for 0x0a");
}
void t_isbdigit_0x0b()
{
Assert(isbdigit(11) == 0 ,"isbdigit should be 0 for 0x0b");
}
void t_isbdigit_0x0c()
{
Assert(isbdigit(12) == 0 ,"isbdigit should be 0 for 0x0c");
}
void t_isbdigit_0x0d()
{
Assert(isbdigit(13) == 0 ,"isbdigit should be 0 for 0x0d");
}
void t_isbdigit_0x0e()
{
Assert(isbdigit(14) == 0 ,"isbdigit should be 0 for 0x0e");
}
void t_isbdigit_0x0f()
{
Assert(isbdigit(15) == 0 ,"isbdigit should be 0 for 0x0f");
}
void t_isbdigit_0x10()
{
Assert(isbdigit(16) == 0 ,"isbdigit should be 0 for 0x10");
}
void t_isbdigit_0x11()
{
Assert(isbdigit(17) == 0 ,"isbdigit should be 0 for 0x11");
}
void t_isbdigit_0x12()
{
Assert(isbdigit(18) == 0 ,"isbdigit should be 0 for 0x12");
}
void t_isbdigit_0x13()
{
Assert(isbdigit(19) == 0 ,"isbdigit should be 0 for 0x13");
}
void t_isbdigit_0x14()
{
Assert(isbdigit(20) == 0 ,"isbdigit should be 0 for 0x14");
}
void t_isbdigit_0x15()
{
Assert(isbdigit(21) == 0 ,"isbdigit should be 0 for 0x15");
}
void t_isbdigit_0x16()
{
Assert(isbdigit(22) == 0 ,"isbdigit should be 0 for 0x16");
}
void t_isbdigit_0x17()
{
Assert(isbdigit(23) == 0 ,"isbdigit should be 0 for 0x17");
}
void t_isbdigit_0x18()
{
Assert(isbdigit(24) == 0 ,"isbdigit should be 0 for 0x18");
}
void t_isbdigit_0x19()
{
Assert(isbdigit(25) == 0 ,"isbdigit should be 0 for 0x19");
}
void t_isbdigit_0x1a()
{
Assert(isbdigit(26) == 0 ,"isbdigit should be 0 for 0x1a");
}
void t_isbdigit_0x1b()
{
Assert(isbdigit(27) == 0 ,"isbdigit should be 0 for 0x1b");
}
void t_isbdigit_0x1c()
{
Assert(isbdigit(28) == 0 ,"isbdigit should be 0 for 0x1c");
}
void t_isbdigit_0x1d()
{
Assert(isbdigit(29) == 0 ,"isbdigit should be 0 for 0x1d");
}
void t_isbdigit_0x1e()
{
Assert(isbdigit(30) == 0 ,"isbdigit should be 0 for 0x1e");
}
void t_isbdigit_0x1f()
{
Assert(isbdigit(31) == 0 ,"isbdigit should be 0 for 0x1f");
}
void t_isbdigit_0x20()
{
Assert(isbdigit(32) == 0 ,"isbdigit should be 0 for ");
}
void t_isbdigit_0x21()
{
Assert(isbdigit(33) == 0 ,"isbdigit should be 0 for !");
}
void t_isbdigit_0x22()
{
Assert(isbdigit(34) == 0 ,"isbdigit should be 0 for 0x22");
}
void t_isbdigit_0x23()
{
Assert(isbdigit(35) == 0 ,"isbdigit should be 0 for #");
}
void t_isbdigit_0x24()
{
Assert(isbdigit(36) == 0 ,"isbdigit should be 0 for $");
}
void t_isbdigit_0x25()
{
Assert(isbdigit(37) == 0 ,"isbdigit should be 0 for %");
}
void t_isbdigit_0x26()
{
Assert(isbdigit(38) == 0 ,"isbdigit should be 0 for &");
}
void t_isbdigit_0x27()
{
Assert(isbdigit(39) == 0 ,"isbdigit should be 0 for '");
}
void t_isbdigit_0x28()
{
Assert(isbdigit(40) == 0 ,"isbdigit should be 0 for (");
}
void t_isbdigit_0x29()
{
Assert(isbdigit(41) == 0 ,"isbdigit should be 0 for )");
}
void t_isbdigit_0x2a()
{
Assert(isbdigit(42) == 0 ,"isbdigit should be 0 for *");
}
void t_isbdigit_0x2b()
{
Assert(isbdigit(43) == 0 ,"isbdigit should be 0 for +");
}
void t_isbdigit_0x2c()
{
Assert(isbdigit(44) == 0 ,"isbdigit should be 0 for ,");
}
void t_isbdigit_0x2d()
{
Assert(isbdigit(45) == 0 ,"isbdigit should be 0 for -");
}
void t_isbdigit_0x2e()
{
Assert(isbdigit(46) == 0 ,"isbdigit should be 0 for .");
}
void t_isbdigit_0x2f()
{
Assert(isbdigit(47) == 0 ,"isbdigit should be 0 for /");
}
void t_isbdigit_0x30()
{
Assert(isbdigit(48) ,"isbdigit should be 1 for 0");
}
void t_isbdigit_0x31()
{
Assert(isbdigit(49) ,"isbdigit should be 1 for 1");
}
void t_isbdigit_0x32()
{
Assert(isbdigit(50) == 0 ,"isbdigit should be 0 for 2");
}
void t_isbdigit_0x33()
{
Assert(isbdigit(51) == 0,"isbdigit should be 0 for 3");
}
void t_isbdigit_0x34()
{
Assert(isbdigit(52) == 0,"isbdigit should be 0 for 4");
}
void t_isbdigit_0x35()
{
Assert(isbdigit(53) == 0,"isbdigit should be 0 for 5");
}
void t_isbdigit_0x36()
{
Assert(isbdigit(54) == 0,"isbdigit should be 0 for 6");
}
void t_isbdigit_0x37()
{
Assert(isbdigit(55) == 0,"isbdigit should be 0 for 7");
}
void t_isbdigit_0x38()
{
Assert(isbdigit(56) == 0,"isbdigit should be 0 for 8");
}
void t_isbdigit_0x39()
{
Assert(isbdigit(57) == 0,"isbdigit should be 0 for 9");
}
void t_isbdigit_0x3a()
{
Assert(isbdigit(58) == 0 ,"isbdigit should be 0 for :");
}
void t_isbdigit_0x3b()
{
Assert(isbdigit(59) == 0 ,"isbdigit should be 0 for ;");
}
void t_isbdigit_0x3c()
{
Assert(isbdigit(60) == 0 ,"isbdigit should be 0 for <");
}
void t_isbdigit_0x3d()
{
Assert(isbdigit(61) == 0 ,"isbdigit should be 0 for =");
}
void t_isbdigit_0x3e()
{
Assert(isbdigit(62) == 0 ,"isbdigit should be 0 for >");
}
void t_isbdigit_0x3f()
{
Assert(isbdigit(63) == 0 ,"isbdigit should be 0 for ?");
}
void t_isbdigit_0x40()
{
Assert(isbdigit(64) == 0 ,"isbdigit should be 0 for @");
}
void t_isbdigit_0x41()
{
Assert(isbdigit(65) == 0 ,"isbdigit should be 0 for A");
}
void t_isbdigit_0x42()
{
Assert(isbdigit(66) == 0 ,"isbdigit should be 0 for B");
}
void t_isbdigit_0x43()
{
Assert(isbdigit(67) == 0 ,"isbdigit should be 0 for C");
}
void t_isbdigit_0x44()
{
Assert(isbdigit(68) == 0 ,"isbdigit should be 0 for D");
}
void t_isbdigit_0x45()
{
Assert(isbdigit(69) == 0 ,"isbdigit should be 0 for E");
}
void t_isbdigit_0x46()
{
Assert(isbdigit(70) == 0 ,"isbdigit should be 0 for F");
}
void t_isbdigit_0x47()
{
Assert(isbdigit(71) == 0 ,"isbdigit should be 0 for G");
}
void t_isbdigit_0x48()
{
Assert(isbdigit(72) == 0 ,"isbdigit should be 0 for H");
}
void t_isbdigit_0x49()
{
Assert(isbdigit(73) == 0 ,"isbdigit should be 0 for I");
}
void t_isbdigit_0x4a()
{
Assert(isbdigit(74) == 0 ,"isbdigit should be 0 for J");
}
void t_isbdigit_0x4b()
{
Assert(isbdigit(75) == 0 ,"isbdigit should be 0 for K");
}
void t_isbdigit_0x4c()
{
Assert(isbdigit(76) == 0 ,"isbdigit should be 0 for L");
}
void t_isbdigit_0x4d()
{
Assert(isbdigit(77) == 0 ,"isbdigit should be 0 for M");
}
void t_isbdigit_0x4e()
{
Assert(isbdigit(78) == 0 ,"isbdigit should be 0 for N");
}
void t_isbdigit_0x4f()
{
Assert(isbdigit(79) == 0 ,"isbdigit should be 0 for O");
}
void t_isbdigit_0x50()
{
Assert(isbdigit(80) == 0 ,"isbdigit should be 0 for P");
}
void t_isbdigit_0x51()
{
Assert(isbdigit(81) == 0 ,"isbdigit should be 0 for Q");
}
void t_isbdigit_0x52()
{
Assert(isbdigit(82) == 0 ,"isbdigit should be 0 for R");
}
void t_isbdigit_0x53()
{
Assert(isbdigit(83) == 0 ,"isbdigit should be 0 for S");
}
void t_isbdigit_0x54()
{
Assert(isbdigit(84) == 0 ,"isbdigit should be 0 for T");
}
void t_isbdigit_0x55()
{
Assert(isbdigit(85) == 0 ,"isbdigit should be 0 for U");
}
void t_isbdigit_0x56()
{
Assert(isbdigit(86) == 0 ,"isbdigit should be 0 for V");
}
void t_isbdigit_0x57()
{
Assert(isbdigit(87) == 0 ,"isbdigit should be 0 for W");
}
void t_isbdigit_0x58()
{
Assert(isbdigit(88) == 0 ,"isbdigit should be 0 for X");
}
void t_isbdigit_0x59()
{
Assert(isbdigit(89) == 0 ,"isbdigit should be 0 for Y");
}
void t_isbdigit_0x5a()
{
Assert(isbdigit(90) == 0 ,"isbdigit should be 0 for Z");
}
void t_isbdigit_0x5b()
{
Assert(isbdigit(91) == 0 ,"isbdigit should be 0 for [");
}
void t_isbdigit_0x5c()
{
Assert(isbdigit(92) == 0 ,"isbdigit should be 0 for 0x5c");
}
void t_isbdigit_0x5d()
{
Assert(isbdigit(93) == 0 ,"isbdigit should be 0 for ]");
}
void t_isbdigit_0x5e()
{
Assert(isbdigit(94) == 0 ,"isbdigit should be 0 for ^");
}
void t_isbdigit_0x5f()
{
Assert(isbdigit(95) == 0 ,"isbdigit should be 0 for _");
}
void t_isbdigit_0x60()
{
Assert(isbdigit(96) == 0 ,"isbdigit should be 0 for `");
}
void t_isbdigit_0x61()
{
Assert(isbdigit(97) == 0 ,"isbdigit should be 0 for a");
}
void t_isbdigit_0x62()
{
Assert(isbdigit(98) == 0 ,"isbdigit should be 0 for b");
}
void t_isbdigit_0x63()
{
Assert(isbdigit(99) == 0 ,"isbdigit should be 0 for c");
}
void t_isbdigit_0x64()
{
Assert(isbdigit(100) == 0 ,"isbdigit should be 0 for d");
}
void t_isbdigit_0x65()
{
Assert(isbdigit(101) == 0 ,"isbdigit should be 0 for e");
}
void t_isbdigit_0x66()
{
Assert(isbdigit(102) == 0 ,"isbdigit should be 0 for f");
}
void t_isbdigit_0x67()
{
Assert(isbdigit(103) == 0 ,"isbdigit should be 0 for g");
}
void t_isbdigit_0x68()
{
Assert(isbdigit(104) == 0 ,"isbdigit should be 0 for h");
}
void t_isbdigit_0x69()
{
Assert(isbdigit(105) == 0 ,"isbdigit should be 0 for i");
}
void t_isbdigit_0x6a()
{
Assert(isbdigit(106) == 0 ,"isbdigit should be 0 for j");
}
void t_isbdigit_0x6b()
{
Assert(isbdigit(107) == 0 ,"isbdigit should be 0 for k");
}
void t_isbdigit_0x6c()
{
Assert(isbdigit(108) == 0 ,"isbdigit should be 0 for l");
}
void t_isbdigit_0x6d()
{
Assert(isbdigit(109) == 0 ,"isbdigit should be 0 for m");
}
void t_isbdigit_0x6e()
{
Assert(isbdigit(110) == 0 ,"isbdigit should be 0 for n");
}
void t_isbdigit_0x6f()
{
Assert(isbdigit(111) == 0 ,"isbdigit should be 0 for o");
}
void t_isbdigit_0x70()
{
Assert(isbdigit(112) == 0 ,"isbdigit should be 0 for p");
}
void t_isbdigit_0x71()
{
Assert(isbdigit(113) == 0 ,"isbdigit should be 0 for q");
}
void t_isbdigit_0x72()
{
Assert(isbdigit(114) == 0 ,"isbdigit should be 0 for r");
}
void t_isbdigit_0x73()
{
Assert(isbdigit(115) == 0 ,"isbdigit should be 0 for s");
}
void t_isbdigit_0x74()
{
Assert(isbdigit(116) == 0 ,"isbdigit should be 0 for t");
}
void t_isbdigit_0x75()
{
Assert(isbdigit(117) == 0 ,"isbdigit should be 0 for u");
}
void t_isbdigit_0x76()
{
Assert(isbdigit(118) == 0 ,"isbdigit should be 0 for v");
}
void t_isbdigit_0x77()
{
Assert(isbdigit(119) == 0 ,"isbdigit should be 0 for w");
}
void t_isbdigit_0x78()
{
Assert(isbdigit(120) == 0 ,"isbdigit should be 0 for x");
}
void t_isbdigit_0x79()
{
Assert(isbdigit(121) == 0 ,"isbdigit should be 0 for y");
}
void t_isbdigit_0x7a()
{
Assert(isbdigit(122) == 0 ,"isbdigit should be 0 for z");
}
void t_isbdigit_0x7b()
{
Assert(isbdigit(123) == 0 ,"isbdigit should be 0 for {");
}
void t_isbdigit_0x7c()
{
Assert(isbdigit(124) == 0 ,"isbdigit should be 0 for |");
}
void t_isbdigit_0x7d()
{
Assert(isbdigit(125) == 0 ,"isbdigit should be 0 for }");
}
void t_isbdigit_0x7e()
{
Assert(isbdigit(126) == 0 ,"isbdigit should be 0 for ~");
}
void t_isbdigit_0x7f()
{
Assert(isbdigit(127) == 0 ,"isbdigit should be 0 for 0x7f");
}
void t_isbdigit_0x80()
{
Assert(isbdigit(128) == 0 ,"isbdigit should be 0 for 0x80");
}
void t_isbdigit_0x81()
{
Assert(isbdigit(129) == 0 ,"isbdigit should be 0 for 0x81");
}
void t_isbdigit_0x82()
{
Assert(isbdigit(130) == 0 ,"isbdigit should be 0 for 0x82");
}
void t_isbdigit_0x83()
{
Assert(isbdigit(131) == 0 ,"isbdigit should be 0 for 0x83");
}
void t_isbdigit_0x84()
{
Assert(isbdigit(132) == 0 ,"isbdigit should be 0 for 0x84");
}
void t_isbdigit_0x85()
{
Assert(isbdigit(133) == 0 ,"isbdigit should be 0 for 0x85");
}
void t_isbdigit_0x86()
{
Assert(isbdigit(134) == 0 ,"isbdigit should be 0 for 0x86");
}
void t_isbdigit_0x87()
{
Assert(isbdigit(135) == 0 ,"isbdigit should be 0 for 0x87");
}
void t_isbdigit_0x88()
{
Assert(isbdigit(136) == 0 ,"isbdigit should be 0 for 0x88");
}
void t_isbdigit_0x89()
{
Assert(isbdigit(137) == 0 ,"isbdigit should be 0 for 0x89");
}
void t_isbdigit_0x8a()
{
Assert(isbdigit(138) == 0 ,"isbdigit should be 0 for 0x8a");
}
void t_isbdigit_0x8b()
{
Assert(isbdigit(139) == 0 ,"isbdigit should be 0 for 0x8b");
}
void t_isbdigit_0x8c()
{
Assert(isbdigit(140) == 0 ,"isbdigit should be 0 for 0x8c");
}
void t_isbdigit_0x8d()
{
Assert(isbdigit(141) == 0 ,"isbdigit should be 0 for 0x8d");
}
void t_isbdigit_0x8e()
{
Assert(isbdigit(142) == 0 ,"isbdigit should be 0 for 0x8e");
}
void t_isbdigit_0x8f()
{
Assert(isbdigit(143) == 0 ,"isbdigit should be 0 for 0x8f");
}
void t_isbdigit_0x90()
{
Assert(isbdigit(144) == 0 ,"isbdigit should be 0 for 0x90");
}
void t_isbdigit_0x91()
{
Assert(isbdigit(145) == 0 ,"isbdigit should be 0 for 0x91");
}
void t_isbdigit_0x92()
{
Assert(isbdigit(146) == 0 ,"isbdigit should be 0 for 0x92");
}
void t_isbdigit_0x93()
{
Assert(isbdigit(147) == 0 ,"isbdigit should be 0 for 0x93");
}
void t_isbdigit_0x94()
{
Assert(isbdigit(148) == 0 ,"isbdigit should be 0 for 0x94");
}
void t_isbdigit_0x95()
{
Assert(isbdigit(149) == 0 ,"isbdigit should be 0 for 0x95");
}
void t_isbdigit_0x96()
{
Assert(isbdigit(150) == 0 ,"isbdigit should be 0 for 0x96");
}
void t_isbdigit_0x97()
{
Assert(isbdigit(151) == 0 ,"isbdigit should be 0 for 0x97");
}
void t_isbdigit_0x98()
{
Assert(isbdigit(152) == 0 ,"isbdigit should be 0 for 0x98");
}
void t_isbdigit_0x99()
{
Assert(isbdigit(153) == 0 ,"isbdigit should be 0 for 0x99");
}
void t_isbdigit_0x9a()
{
Assert(isbdigit(154) == 0 ,"isbdigit should be 0 for 0x9a");
}
void t_isbdigit_0x9b()
{
Assert(isbdigit(155) == 0 ,"isbdigit should be 0 for 0x9b");
}
void t_isbdigit_0x9c()
{
Assert(isbdigit(156) == 0 ,"isbdigit should be 0 for 0x9c");
}
void t_isbdigit_0x9d()
{
Assert(isbdigit(157) == 0 ,"isbdigit should be 0 for 0x9d");
}
void t_isbdigit_0x9e()
{
Assert(isbdigit(158) == 0 ,"isbdigit should be 0 for 0x9e");
}
void t_isbdigit_0x9f()
{
Assert(isbdigit(159) == 0 ,"isbdigit should be 0 for 0x9f");
}
void t_isbdigit_0xa0()
{
Assert(isbdigit(160) == 0 ,"isbdigit should be 0 for 0xa0");
}
void t_isbdigit_0xa1()
{
Assert(isbdigit(161) == 0 ,"isbdigit should be 0 for 0xa1");
}
void t_isbdigit_0xa2()
{
Assert(isbdigit(162) == 0 ,"isbdigit should be 0 for 0xa2");
}
void t_isbdigit_0xa3()
{
Assert(isbdigit(163) == 0 ,"isbdigit should be 0 for 0xa3");
}
void t_isbdigit_0xa4()
{
Assert(isbdigit(164) == 0 ,"isbdigit should be 0 for 0xa4");
}
void t_isbdigit_0xa5()
{
Assert(isbdigit(165) == 0 ,"isbdigit should be 0 for 0xa5");
}
void t_isbdigit_0xa6()
{
Assert(isbdigit(166) == 0 ,"isbdigit should be 0 for 0xa6");
}
void t_isbdigit_0xa7()
{
Assert(isbdigit(167) == 0 ,"isbdigit should be 0 for 0xa7");
}
void t_isbdigit_0xa8()
{
Assert(isbdigit(168) == 0 ,"isbdigit should be 0 for 0xa8");
}
void t_isbdigit_0xa9()
{
Assert(isbdigit(169) == 0 ,"isbdigit should be 0 for 0xa9");
}
void t_isbdigit_0xaa()
{
Assert(isbdigit(170) == 0 ,"isbdigit should be 0 for 0xaa");
}
void t_isbdigit_0xab()
{
Assert(isbdigit(171) == 0 ,"isbdigit should be 0 for 0xab");
}
void t_isbdigit_0xac()
{
Assert(isbdigit(172) == 0 ,"isbdigit should be 0 for 0xac");
}
void t_isbdigit_0xad()
{
Assert(isbdigit(173) == 0 ,"isbdigit should be 0 for 0xad");
}
void t_isbdigit_0xae()
{
Assert(isbdigit(174) == 0 ,"isbdigit should be 0 for 0xae");
}
void t_isbdigit_0xaf()
{
Assert(isbdigit(175) == 0 ,"isbdigit should be 0 for 0xaf");
}
void t_isbdigit_0xb0()
{
Assert(isbdigit(176) == 0 ,"isbdigit should be 0 for 0xb0");
}
void t_isbdigit_0xb1()
{
Assert(isbdigit(177) == 0 ,"isbdigit should be 0 for 0xb1");
}
void t_isbdigit_0xb2()
{
Assert(isbdigit(178) == 0 ,"isbdigit should be 0 for 0xb2");
}
void t_isbdigit_0xb3()
{
Assert(isbdigit(179) == 0 ,"isbdigit should be 0 for 0xb3");
}
void t_isbdigit_0xb4()
{
Assert(isbdigit(180) == 0 ,"isbdigit should be 0 for 0xb4");
}
void t_isbdigit_0xb5()
{
Assert(isbdigit(181) == 0 ,"isbdigit should be 0 for 0xb5");
}
void t_isbdigit_0xb6()
{
Assert(isbdigit(182) == 0 ,"isbdigit should be 0 for 0xb6");
}
void t_isbdigit_0xb7()
{
Assert(isbdigit(183) == 0 ,"isbdigit should be 0 for 0xb7");
}
void t_isbdigit_0xb8()
{
Assert(isbdigit(184) == 0 ,"isbdigit should be 0 for 0xb8");
}
void t_isbdigit_0xb9()
{
Assert(isbdigit(185) == 0 ,"isbdigit should be 0 for 0xb9");
}
void t_isbdigit_0xba()
{
Assert(isbdigit(186) == 0 ,"isbdigit should be 0 for 0xba");
}
void t_isbdigit_0xbb()
{
Assert(isbdigit(187) == 0 ,"isbdigit should be 0 for 0xbb");
}
void t_isbdigit_0xbc()
{
Assert(isbdigit(188) == 0 ,"isbdigit should be 0 for 0xbc");
}
void t_isbdigit_0xbd()
{
Assert(isbdigit(189) == 0 ,"isbdigit should be 0 for 0xbd");
}
void t_isbdigit_0xbe()
{
Assert(isbdigit(190) == 0 ,"isbdigit should be 0 for 0xbe");
}
void t_isbdigit_0xbf()
{
Assert(isbdigit(191) == 0 ,"isbdigit should be 0 for 0xbf");
}
void t_isbdigit_0xc0()
{
Assert(isbdigit(192) == 0 ,"isbdigit should be 0 for 0xc0");
}
void t_isbdigit_0xc1()
{
Assert(isbdigit(193) == 0 ,"isbdigit should be 0 for 0xc1");
}
void t_isbdigit_0xc2()
{
Assert(isbdigit(194) == 0 ,"isbdigit should be 0 for 0xc2");
}
void t_isbdigit_0xc3()
{
Assert(isbdigit(195) == 0 ,"isbdigit should be 0 for 0xc3");
}
void t_isbdigit_0xc4()
{
Assert(isbdigit(196) == 0 ,"isbdigit should be 0 for 0xc4");
}
void t_isbdigit_0xc5()
{
Assert(isbdigit(197) == 0 ,"isbdigit should be 0 for 0xc5");
}
void t_isbdigit_0xc6()
{
Assert(isbdigit(198) == 0 ,"isbdigit should be 0 for 0xc6");
}
void t_isbdigit_0xc7()
{
Assert(isbdigit(199) == 0 ,"isbdigit should be 0 for 0xc7");
}
void t_isbdigit_0xc8()
{
Assert(isbdigit(200) == 0 ,"isbdigit should be 0 for 0xc8");
}
void t_isbdigit_0xc9()
{
Assert(isbdigit(201) == 0 ,"isbdigit should be 0 for 0xc9");
}
void t_isbdigit_0xca()
{
Assert(isbdigit(202) == 0 ,"isbdigit should be 0 for 0xca");
}
void t_isbdigit_0xcb()
{
Assert(isbdigit(203) == 0 ,"isbdigit should be 0 for 0xcb");
}
void t_isbdigit_0xcc()
{
Assert(isbdigit(204) == 0 ,"isbdigit should be 0 for 0xcc");
}
void t_isbdigit_0xcd()
{
Assert(isbdigit(205) == 0 ,"isbdigit should be 0 for 0xcd");
}
void t_isbdigit_0xce()
{
Assert(isbdigit(206) == 0 ,"isbdigit should be 0 for 0xce");
}
void t_isbdigit_0xcf()
{
Assert(isbdigit(207) == 0 ,"isbdigit should be 0 for 0xcf");
}
void t_isbdigit_0xd0()
{
Assert(isbdigit(208) == 0 ,"isbdigit should be 0 for 0xd0");
}
void t_isbdigit_0xd1()
{
Assert(isbdigit(209) == 0 ,"isbdigit should be 0 for 0xd1");
}
void t_isbdigit_0xd2()
{
Assert(isbdigit(210) == 0 ,"isbdigit should be 0 for 0xd2");
}
void t_isbdigit_0xd3()
{
Assert(isbdigit(211) == 0 ,"isbdigit should be 0 for 0xd3");
}
void t_isbdigit_0xd4()
{
Assert(isbdigit(212) == 0 ,"isbdigit should be 0 for 0xd4");
}
void t_isbdigit_0xd5()
{
Assert(isbdigit(213) == 0 ,"isbdigit should be 0 for 0xd5");
}
void t_isbdigit_0xd6()
{
Assert(isbdigit(214) == 0 ,"isbdigit should be 0 for 0xd6");
}
void t_isbdigit_0xd7()
{
Assert(isbdigit(215) == 0 ,"isbdigit should be 0 for 0xd7");
}
void t_isbdigit_0xd8()
{
Assert(isbdigit(216) == 0 ,"isbdigit should be 0 for 0xd8");
}
void t_isbdigit_0xd9()
{
Assert(isbdigit(217) == 0 ,"isbdigit should be 0 for 0xd9");
}
void t_isbdigit_0xda()
{
Assert(isbdigit(218) == 0 ,"isbdigit should be 0 for 0xda");
}
void t_isbdigit_0xdb()
{
Assert(isbdigit(219) == 0 ,"isbdigit should be 0 for 0xdb");
}
void t_isbdigit_0xdc()
{
Assert(isbdigit(220) == 0 ,"isbdigit should be 0 for 0xdc");
}
void t_isbdigit_0xdd()
{
Assert(isbdigit(221) == 0 ,"isbdigit should be 0 for 0xdd");
}
void t_isbdigit_0xde()
{
Assert(isbdigit(222) == 0 ,"isbdigit should be 0 for 0xde");
}
void t_isbdigit_0xdf()
{
Assert(isbdigit(223) == 0 ,"isbdigit should be 0 for 0xdf");
}
void t_isbdigit_0xe0()
{
Assert(isbdigit(224) == 0 ,"isbdigit should be 0 for 0xe0");
}
void t_isbdigit_0xe1()
{
Assert(isbdigit(225) == 0 ,"isbdigit should be 0 for 0xe1");
}
void t_isbdigit_0xe2()
{
Assert(isbdigit(226) == 0 ,"isbdigit should be 0 for 0xe2");
}
void t_isbdigit_0xe3()
{
Assert(isbdigit(227) == 0 ,"isbdigit should be 0 for 0xe3");
}
void t_isbdigit_0xe4()
{
Assert(isbdigit(228) == 0 ,"isbdigit should be 0 for 0xe4");
}
void t_isbdigit_0xe5()
{
Assert(isbdigit(229) == 0 ,"isbdigit should be 0 for 0xe5");
}
void t_isbdigit_0xe6()
{
Assert(isbdigit(230) == 0 ,"isbdigit should be 0 for 0xe6");
}
void t_isbdigit_0xe7()
{
Assert(isbdigit(231) == 0 ,"isbdigit should be 0 for 0xe7");
}
void t_isbdigit_0xe8()
{
Assert(isbdigit(232) == 0 ,"isbdigit should be 0 for 0xe8");
}
void t_isbdigit_0xe9()
{
Assert(isbdigit(233) == 0 ,"isbdigit should be 0 for 0xe9");
}
void t_isbdigit_0xea()
{
Assert(isbdigit(234) == 0 ,"isbdigit should be 0 for 0xea");
}
void t_isbdigit_0xeb()
{
Assert(isbdigit(235) == 0 ,"isbdigit should be 0 for 0xeb");
}
void t_isbdigit_0xec()
{
Assert(isbdigit(236) == 0 ,"isbdigit should be 0 for 0xec");
}
void t_isbdigit_0xed()
{
Assert(isbdigit(237) == 0 ,"isbdigit should be 0 for 0xed");
}
void t_isbdigit_0xee()
{
Assert(isbdigit(238) == 0 ,"isbdigit should be 0 for 0xee");
}
void t_isbdigit_0xef()
{
Assert(isbdigit(239) == 0 ,"isbdigit should be 0 for 0xef");
}
void t_isbdigit_0xf0()
{
Assert(isbdigit(240) == 0 ,"isbdigit should be 0 for 0xf0");
}
void t_isbdigit_0xf1()
{
Assert(isbdigit(241) == 0 ,"isbdigit should be 0 for 0xf1");
}
void t_isbdigit_0xf2()
{
Assert(isbdigit(242) == 0 ,"isbdigit should be 0 for 0xf2");
}
void t_isbdigit_0xf3()
{
Assert(isbdigit(243) == 0 ,"isbdigit should be 0 for 0xf3");
}
void t_isbdigit_0xf4()
{
Assert(isbdigit(244) == 0 ,"isbdigit should be 0 for 0xf4");
}
void t_isbdigit_0xf5()
{
Assert(isbdigit(245) == 0 ,"isbdigit should be 0 for 0xf5");
}
void t_isbdigit_0xf6()
{
Assert(isbdigit(246) == 0 ,"isbdigit should be 0 for 0xf6");
}
void t_isbdigit_0xf7()
{
Assert(isbdigit(247) == 0 ,"isbdigit should be 0 for 0xf7");
}
void t_isbdigit_0xf8()
{
Assert(isbdigit(248) == 0 ,"isbdigit should be 0 for 0xf8");
}
void t_isbdigit_0xf9()
{
Assert(isbdigit(249) == 0 ,"isbdigit should be 0 for 0xf9");
}
void t_isbdigit_0xfa()
{
Assert(isbdigit(250) == 0 ,"isbdigit should be 0 for 0xfa");
}
void t_isbdigit_0xfb()
{
Assert(isbdigit(251) == 0 ,"isbdigit should be 0 for 0xfb");
}
void t_isbdigit_0xfc()
{
Assert(isbdigit(252) == 0 ,"isbdigit should be 0 for 0xfc");
}
void t_isbdigit_0xfd()
{
Assert(isbdigit(253) == 0 ,"isbdigit should be 0 for 0xfd");
}
void t_isbdigit_0xfe()
{
Assert(isbdigit(254) == 0 ,"isbdigit should be 0 for 0xfe");
}
void t_isbdigit_0xff()
{
Assert(isbdigit(255) == 0 ,"isbdigit should be 0 for 0xff");
}
int test_isbdigit()
{
suite_setup("isbdigit");
suite_add_test(t_isbdigit_0x00);
suite_add_test(t_isbdigit_0x01);
suite_add_test(t_isbdigit_0x02);
suite_add_test(t_isbdigit_0x03);
suite_add_test(t_isbdigit_0x04);
suite_add_test(t_isbdigit_0x05);
suite_add_test(t_isbdigit_0x06);
suite_add_test(t_isbdigit_0x07);
suite_add_test(t_isbdigit_0x08);
suite_add_test(t_isbdigit_0x09);
suite_add_test(t_isbdigit_0x0a);
suite_add_test(t_isbdigit_0x0b);
suite_add_test(t_isbdigit_0x0c);
suite_add_test(t_isbdigit_0x0d);
suite_add_test(t_isbdigit_0x0e);
suite_add_test(t_isbdigit_0x0f);
suite_add_test(t_isbdigit_0x10);
suite_add_test(t_isbdigit_0x11);
suite_add_test(t_isbdigit_0x12);
suite_add_test(t_isbdigit_0x13);
suite_add_test(t_isbdigit_0x14);
suite_add_test(t_isbdigit_0x15);
suite_add_test(t_isbdigit_0x16);
suite_add_test(t_isbdigit_0x17);
suite_add_test(t_isbdigit_0x18);
suite_add_test(t_isbdigit_0x19);
suite_add_test(t_isbdigit_0x1a);
suite_add_test(t_isbdigit_0x1b);
suite_add_test(t_isbdigit_0x1c);
suite_add_test(t_isbdigit_0x1d);
suite_add_test(t_isbdigit_0x1e);
suite_add_test(t_isbdigit_0x1f);
suite_add_test(t_isbdigit_0x20);
suite_add_test(t_isbdigit_0x21);
suite_add_test(t_isbdigit_0x22);
suite_add_test(t_isbdigit_0x23);
suite_add_test(t_isbdigit_0x24);
suite_add_test(t_isbdigit_0x25);
suite_add_test(t_isbdigit_0x26);
suite_add_test(t_isbdigit_0x27);
suite_add_test(t_isbdigit_0x28);
suite_add_test(t_isbdigit_0x29);
suite_add_test(t_isbdigit_0x2a);
suite_add_test(t_isbdigit_0x2b);
suite_add_test(t_isbdigit_0x2c);
suite_add_test(t_isbdigit_0x2d);
suite_add_test(t_isbdigit_0x2e);
suite_add_test(t_isbdigit_0x2f);
suite_add_test(t_isbdigit_0x30);
suite_add_test(t_isbdigit_0x31);
suite_add_test(t_isbdigit_0x32);
suite_add_test(t_isbdigit_0x33);
suite_add_test(t_isbdigit_0x34);
suite_add_test(t_isbdigit_0x35);
suite_add_test(t_isbdigit_0x36);
suite_add_test(t_isbdigit_0x37);
suite_add_test(t_isbdigit_0x38);
suite_add_test(t_isbdigit_0x39);
suite_add_test(t_isbdigit_0x3a);
suite_add_test(t_isbdigit_0x3b);
suite_add_test(t_isbdigit_0x3c);
suite_add_test(t_isbdigit_0x3d);
suite_add_test(t_isbdigit_0x3e);
suite_add_test(t_isbdigit_0x3f);
suite_add_test(t_isbdigit_0x40);
suite_add_test(t_isbdigit_0x41);
suite_add_test(t_isbdigit_0x42);
suite_add_test(t_isbdigit_0x43);
suite_add_test(t_isbdigit_0x44);
suite_add_test(t_isbdigit_0x45);
suite_add_test(t_isbdigit_0x46);
suite_add_test(t_isbdigit_0x47);
suite_add_test(t_isbdigit_0x48);
suite_add_test(t_isbdigit_0x49);
suite_add_test(t_isbdigit_0x4a);
suite_add_test(t_isbdigit_0x4b);
suite_add_test(t_isbdigit_0x4c);
suite_add_test(t_isbdigit_0x4d);
suite_add_test(t_isbdigit_0x4e);
suite_add_test(t_isbdigit_0x4f);
suite_add_test(t_isbdigit_0x50);
suite_add_test(t_isbdigit_0x51);
suite_add_test(t_isbdigit_0x52);
suite_add_test(t_isbdigit_0x53);
suite_add_test(t_isbdigit_0x54);
suite_add_test(t_isbdigit_0x55);
suite_add_test(t_isbdigit_0x56);
suite_add_test(t_isbdigit_0x57);
suite_add_test(t_isbdigit_0x58);
suite_add_test(t_isbdigit_0x59);
suite_add_test(t_isbdigit_0x5a);
suite_add_test(t_isbdigit_0x5b);
suite_add_test(t_isbdigit_0x5c);
suite_add_test(t_isbdigit_0x5d);
suite_add_test(t_isbdigit_0x5e);
suite_add_test(t_isbdigit_0x5f);
suite_add_test(t_isbdigit_0x60);
suite_add_test(t_isbdigit_0x61);
suite_add_test(t_isbdigit_0x62);
suite_add_test(t_isbdigit_0x63);
suite_add_test(t_isbdigit_0x64);
suite_add_test(t_isbdigit_0x65);
suite_add_test(t_isbdigit_0x66);
suite_add_test(t_isbdigit_0x67);
suite_add_test(t_isbdigit_0x68);
suite_add_test(t_isbdigit_0x69);
suite_add_test(t_isbdigit_0x6a);
suite_add_test(t_isbdigit_0x6b);
suite_add_test(t_isbdigit_0x6c);
suite_add_test(t_isbdigit_0x6d);
suite_add_test(t_isbdigit_0x6e);
suite_add_test(t_isbdigit_0x6f);
suite_add_test(t_isbdigit_0x70);
suite_add_test(t_isbdigit_0x71);
suite_add_test(t_isbdigit_0x72);
suite_add_test(t_isbdigit_0x73);
suite_add_test(t_isbdigit_0x74);
suite_add_test(t_isbdigit_0x75);
suite_add_test(t_isbdigit_0x76);
suite_add_test(t_isbdigit_0x77);
suite_add_test(t_isbdigit_0x78);
suite_add_test(t_isbdigit_0x79);
suite_add_test(t_isbdigit_0x7a);
suite_add_test(t_isbdigit_0x7b);
suite_add_test(t_isbdigit_0x7c);
suite_add_test(t_isbdigit_0x7d);
suite_add_test(t_isbdigit_0x7e);
suite_add_test(t_isbdigit_0x7f);
suite_add_test(t_isbdigit_0x80);
suite_add_test(t_isbdigit_0x81);
suite_add_test(t_isbdigit_0x82);
suite_add_test(t_isbdigit_0x83);
suite_add_test(t_isbdigit_0x84);
suite_add_test(t_isbdigit_0x85);
suite_add_test(t_isbdigit_0x86);
suite_add_test(t_isbdigit_0x87);
suite_add_test(t_isbdigit_0x88);
suite_add_test(t_isbdigit_0x89);
suite_add_test(t_isbdigit_0x8a);
suite_add_test(t_isbdigit_0x8b);
suite_add_test(t_isbdigit_0x8c);
suite_add_test(t_isbdigit_0x8d);
suite_add_test(t_isbdigit_0x8e);
suite_add_test(t_isbdigit_0x8f);
suite_add_test(t_isbdigit_0x90);
suite_add_test(t_isbdigit_0x91);
suite_add_test(t_isbdigit_0x92);
suite_add_test(t_isbdigit_0x93);
suite_add_test(t_isbdigit_0x94);
suite_add_test(t_isbdigit_0x95);
suite_add_test(t_isbdigit_0x96);
suite_add_test(t_isbdigit_0x97);
suite_add_test(t_isbdigit_0x98);
suite_add_test(t_isbdigit_0x99);
suite_add_test(t_isbdigit_0x9a);
suite_add_test(t_isbdigit_0x9b);
suite_add_test(t_isbdigit_0x9c);
suite_add_test(t_isbdigit_0x9d);
suite_add_test(t_isbdigit_0x9e);
suite_add_test(t_isbdigit_0x9f);
suite_add_test(t_isbdigit_0xa0);
suite_add_test(t_isbdigit_0xa1);
suite_add_test(t_isbdigit_0xa2);
suite_add_test(t_isbdigit_0xa3);
suite_add_test(t_isbdigit_0xa4);
suite_add_test(t_isbdigit_0xa5);
suite_add_test(t_isbdigit_0xa6);
suite_add_test(t_isbdigit_0xa7);
suite_add_test(t_isbdigit_0xa8);
suite_add_test(t_isbdigit_0xa9);
suite_add_test(t_isbdigit_0xaa);
suite_add_test(t_isbdigit_0xab);
suite_add_test(t_isbdigit_0xac);
suite_add_test(t_isbdigit_0xad);
suite_add_test(t_isbdigit_0xae);
suite_add_test(t_isbdigit_0xaf);
suite_add_test(t_isbdigit_0xb0);
suite_add_test(t_isbdigit_0xb1);
suite_add_test(t_isbdigit_0xb2);
suite_add_test(t_isbdigit_0xb3);
suite_add_test(t_isbdigit_0xb4);
suite_add_test(t_isbdigit_0xb5);
suite_add_test(t_isbdigit_0xb6);
suite_add_test(t_isbdigit_0xb7);
suite_add_test(t_isbdigit_0xb8);
suite_add_test(t_isbdigit_0xb9);
suite_add_test(t_isbdigit_0xba);
suite_add_test(t_isbdigit_0xbb);
suite_add_test(t_isbdigit_0xbc);
suite_add_test(t_isbdigit_0xbd);
suite_add_test(t_isbdigit_0xbe);
suite_add_test(t_isbdigit_0xbf);
suite_add_test(t_isbdigit_0xc0);
suite_add_test(t_isbdigit_0xc1);
suite_add_test(t_isbdigit_0xc2);
suite_add_test(t_isbdigit_0xc3);
suite_add_test(t_isbdigit_0xc4);
suite_add_test(t_isbdigit_0xc5);
suite_add_test(t_isbdigit_0xc6);
suite_add_test(t_isbdigit_0xc7);
suite_add_test(t_isbdigit_0xc8);
suite_add_test(t_isbdigit_0xc9);
suite_add_test(t_isbdigit_0xca);
suite_add_test(t_isbdigit_0xcb);
suite_add_test(t_isbdigit_0xcc);
suite_add_test(t_isbdigit_0xcd);
suite_add_test(t_isbdigit_0xce);
suite_add_test(t_isbdigit_0xcf);
suite_add_test(t_isbdigit_0xd0);
suite_add_test(t_isbdigit_0xd1);
suite_add_test(t_isbdigit_0xd2);
suite_add_test(t_isbdigit_0xd3);
suite_add_test(t_isbdigit_0xd4);
suite_add_test(t_isbdigit_0xd5);
suite_add_test(t_isbdigit_0xd6);
suite_add_test(t_isbdigit_0xd7);
suite_add_test(t_isbdigit_0xd8);
suite_add_test(t_isbdigit_0xd9);
suite_add_test(t_isbdigit_0xda);
suite_add_test(t_isbdigit_0xdb);
suite_add_test(t_isbdigit_0xdc);
suite_add_test(t_isbdigit_0xdd);
suite_add_test(t_isbdigit_0xde);
suite_add_test(t_isbdigit_0xdf);
suite_add_test(t_isbdigit_0xe0);
suite_add_test(t_isbdigit_0xe1);
suite_add_test(t_isbdigit_0xe2);
suite_add_test(t_isbdigit_0xe3);
suite_add_test(t_isbdigit_0xe4);
suite_add_test(t_isbdigit_0xe5);
suite_add_test(t_isbdigit_0xe6);
suite_add_test(t_isbdigit_0xe7);
suite_add_test(t_isbdigit_0xe8);
suite_add_test(t_isbdigit_0xe9);
suite_add_test(t_isbdigit_0xea);
suite_add_test(t_isbdigit_0xeb);
suite_add_test(t_isbdigit_0xec);
suite_add_test(t_isbdigit_0xed);
suite_add_test(t_isbdigit_0xee);
suite_add_test(t_isbdigit_0xef);
suite_add_test(t_isbdigit_0xf0);
suite_add_test(t_isbdigit_0xf1);
suite_add_test(t_isbdigit_0xf2);
suite_add_test(t_isbdigit_0xf3);
suite_add_test(t_isbdigit_0xf4);
suite_add_test(t_isbdigit_0xf5);
suite_add_test(t_isbdigit_0xf6);
suite_add_test(t_isbdigit_0xf7);
suite_add_test(t_isbdigit_0xf8);
suite_add_test(t_isbdigit_0xf9);
suite_add_test(t_isbdigit_0xfa);
suite_add_test(t_isbdigit_0xfb);
suite_add_test(t_isbdigit_0xfc);
suite_add_test(t_isbdigit_0xfd);
suite_add_test(t_isbdigit_0xfe);
suite_add_test(t_isbdigit_0xff);
return suite_run();
}
| 21.495472 | 65 | 0.682685 |
e027fef372552eb4647f00b4b355d97248cc8c7a | 512 | h | C | src/http.h | kalamay/crux | 9a7c5f2ff337a6af005cd3979a254b6606bb9637 | [
"BSD-2-Clause"
] | null | null | null | src/http.h | kalamay/crux | 9a7c5f2ff337a6af005cd3979a254b6606bb9637 | [
"BSD-2-Clause"
] | null | null | null | src/http.h | kalamay/crux | 9a7c5f2ff337a6af005cd3979a254b6606bb9637 | [
"BSD-2-Clause"
] | null | null | null | #include "../include/crux/http.h"
#include "../include/crux/hashmap.h"
#include "../include/crux/vec.h"
#include "../include/crux/seed.h"
#include "buf.h"
struct xhttp_vec
{
XVEC(struct xhttp_field);
};
struct xhttp_map
{
XHASHMAP(xhttp_tab, struct xhttp_vec, 2);
struct xbuf buf;
union xseed seed;
};
XLOCAL int
xhttp_map_init(struct xhttp_map *map);
XLOCAL void
xhttp_map_final(struct xhttp_map *map);
XLOCAL int
xhttp_map_put(struct xhttp_map *map, const struct xbuf *src, struct xhttp_field fld);
| 17.655172 | 85 | 0.738281 |
a3611f6c294b3794b067d0a374c9b36364e87329 | 7,458 | h | C | tests/ut/TestApiHookBase.h | elsonLee/emock | abbf60971601c366e19a7ca64321a0b0602d51e8 | [
"Apache-2.0"
] | 72 | 2018-01-26T11:19:32.000Z | 2022-02-06T02:38:38.000Z | tests/ut/TestApiHookBase.h | ez8-co/mockcpp | 625c204c91fa12ce20962c67ff02132625b646d1 | [
"Apache-2.0"
] | 18 | 2019-03-11T08:47:17.000Z | 2022-03-08T10:58:07.000Z | tests/ut/TestApiHookBase.h | ez8-co/mockcpp | 625c204c91fa12ce20962c67ff02132625b646d1 | [
"Apache-2.0"
] | 27 | 2018-04-03T08:31:14.000Z | 2022-03-16T13:01:09.000Z | /***
emock is a cross-platform easy-to-use C++ Mock Framework based on mockcpp.
Copyright [2017] [ez8.co] [orca <orca.zhang@yahoo.com>]
This library is released under the Apache License, Version 2.0.
Please see LICENSE file or visit https://github.com/ez8-co/emock for details.
mockcpp is a generic C/C++ mock framework.
Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
<Chen Guodong: sinojelly@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 <testngpp/testngpp.hpp>
#include <emock/emock.hpp>
USING_EMOCK_NS
USING_TESTNGPP_NS
void vfunc0()
{
}
int func0()
{
return 0;
}
void vfunc1(int a)
{
}
int func1(int a)
{
return 0;
}
double ffunc1(double a)
{
return a;
}
int func2(int a, int b)
{
return 0;
}
double ffunc2(int a, double b)
{
return b;
}
int func3(int a, int b, int c)
{
return 0;
}
int func4(int a, int b, int c, int d)
{
return 0;
}
int func5(int a, int b, int c, int d, int e)
{
return 0;
}
int func6(int a, int b, int c, int d, int e, int f)
{
return 0;
}
int func7(int a, int b, int c, int d, int e, int f, int g)
{
return 0;
}
int func8(int a, int b, int c, int d, int e, int f, int g, int h)
{
return 0;
}
int func9(int a, int b, int c, int d, int e, int f, int g, int h, int i)
{
return 0;
}
int func10(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
return 0;
}
int func11(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k)
{
return 0;
}
int func12(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l)
{
return 0;
}
FIXTURE(ApiHookBase)
{
int a; //TODO: static const cause linux .so load failure.
int b;
int c;
int d;
int e;
int f;
int g;
int h;
int i;
int j;
int k;
int l;
int ret;
SETUP()
{
a = 1;
b = 2;
c = 3;
d = 4;
e = 5;
f = 6;
g = 7;
h = 8;
i = 9;
j = 10;
k = 11;
l = 12;
ret = 10;
}
TEARDOWN()
{
GlobalMockObject::verify();
}
TEST(can mock C function with no return and no parameter)
{
EMOCK(vfunc0)
.expects(once());
vfunc0();
}
TEST(can mock C function with return and no parameter)
{
EMOCK(func0)
.expects(once())
.will(returnValue(ret));
ASSERT_EQ(ret, func0());
}
TEST(can mock C function with no return and one parameter)
{
EMOCK(vfunc1)
.expects(once())
.with(eq(a));
vfunc1(a);
}
TEST(can mock C function with 1 parameter (int) & return (int))
{
EMOCK(func1)
.expects(once())
.with(eq(a))
.will(returnValue(ret));
ASSERT_EQ(ret, func1(a));
}
TEST(can mock c function with 1 parameter (double) & return (double))
{
EMOCK(ffunc1)
.expects(once())
.with(eq((double)1.0))
.will(returnValue((double)1.0));
ASSERT_EQ((double)1.0, ffunc1((double)1.0));
}
TEST(can mock C function with return and two parameters)
{
EMOCK(func2)
.expects(once())
.with(eq(a), eq(b))
.will(returnValue(ret));
ASSERT_EQ(ret, func2(a, b));
}
TEST(can mock c function with 2 parameter2 (double) & return (double))
{
EMOCK(ffunc2)
.expects(once())
.with(eq((int)2), eq((double)1.1))
.will(returnValue((double)1.9));
ASSERT_EQ((double)1.9, ffunc2(2, 1.1));
}
TEST(can mock C function with return and 3 parameters)
{
EMOCK(func3)
.expects(once())
.with(eq(a), eq(b), eq(c))
.will(returnValue(ret));
ASSERT_EQ(ret, func3(a, b, c));
}
TEST(can mock C function with return and 4 parameters)
{
EMOCK(func4)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d))
.will(returnValue(ret));
ASSERT_EQ(ret, func4(a, b, c, d));
}
TEST(can mock C function with return and 5 parameters)
{
EMOCK(func5)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e))
.will(returnValue(ret));
ASSERT_EQ(ret, func5(a, b, c, d, e));
}
TEST(can mock C function with return and 6 parameters)
{
EMOCK(func6)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f))
.will(returnValue(ret));
ASSERT_EQ(ret, func6(a, b, c, d, e, f));
}
TEST(can mock C function with return and 7 parameters)
{
EMOCK(func7)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f), eq(g))
.will(returnValue(ret));
ASSERT_EQ(ret, func7(a, b, c, d, e, f, g));
}
TEST(can mock C function with return and 8 parameters)
{
EMOCK(func8)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f), eq(g), eq(h))
.will(returnValue(ret));
ASSERT_EQ(ret, func8(a, b, c, d, e, f, g, h));
}
TEST(can mock C function with return and 9 parameters)
{
EMOCK(func9)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f), eq(g), eq(h), eq(i))
.will(returnValue(ret));
ASSERT_EQ(ret, func9(a, b, c, d, e, f, g, h, i));
}
TEST(can mock C function with return and 10 parameters)
{
EMOCK(func10)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f), eq(g), eq(h), eq(i), eq(j))
.will(returnValue(ret));
ASSERT_EQ(ret, func10(a, b, c, d, e, f, g, h, i, j));
}
TEST(can mock C function with return and 11 parameters)
{
EMOCK(func11)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f), eq(g), eq(h), eq(i), eq(j), eq(k))
.will(returnValue(ret));
ASSERT_EQ(ret, func11(a, b, c, d, e, f, g, h, i, j, k));
}
TEST(can mock C function with return and 12 parameters)
{
EMOCK(func12)
.expects(once())
.with(eq(a), eq(b), eq(c), eq(d), eq(e), eq(f), eq(g), eq(h), eq(i), eq(j), eq(k), eq(l))
.will(returnValue(ret));
ASSERT_EQ(ret, func12(a, b, c, d, e, f, g, h, i, j, k, l));
}
};
| 23.018519 | 102 | 0.503754 |
ed029962ca11738a143fb92e029084d31a60d560 | 852 | h | C | lab4/lib/include/timer.h | Artis24106/osc2022 | 3c219026138fc9b9bc9199e0207074a38e0f8d29 | [
"MIT"
] | null | null | null | lab4/lib/include/timer.h | Artis24106/osc2022 | 3c219026138fc9b9bc9199e0207074a38e0f8d29 | [
"MIT"
] | null | null | null | lab4/lib/include/timer.h | Artis24106/osc2022 | 3c219026138fc9b9bc9199e0207074a38e0f8d29 | [
"MIT"
] | null | null | null | #ifndef __TIMER_H__
#define __TIMER_H__
#include "list.h"
#include "malloc.h"
#include "printf.h"
#include "regs.h"
#include "string.h"
#define CORE0_TIMER_IRQ_CTRL 0x40000040
typedef struct timer_event {
struct list_head node;
void* callback;
char* args;
uint64_t tval; // timer value
} timer_event_t;
void enable_core_timer();
void disable_core_timer();
void core_timer_handler();
void core_timer_callback();
void timer_list_init();
uint64_t get_absolute_time(uint64_t offset);
void add_timer(void* callback, char* args, uint64_t timeout);
void show_timer_list();
void sleep(uint64_t timeout);
void show_msg_callback(char* args);
void show_time_callback(char* args);
void set_relative_timeout(uint64_t timeout); // relative -> cntp_tval_el0
void set_absolute_timeout(uint64_t timeout); // absoulute -> cntp_cval_el0
#endif | 23.027027 | 75 | 0.769953 |
e8f9515d8730686244f73402a9cd7c0d6d205aea | 4,548 | c | C | mlib/src/x11/x11_pixbuf.c | hanya/aobook-haiku | ffe2a900528ade0bb9da300c2c32478d135472fd | [
"BSD-3-Clause"
] | 1 | 2017-10-28T11:00:52.000Z | 2017-10-28T11:00:52.000Z | mlib/src/x11/x11_pixbuf.c | hanya/aobook-haiku | ffe2a900528ade0bb9da300c2c32478d135472fd | [
"BSD-3-Clause"
] | null | null | null | mlib/src/x11/x11_pixbuf.c | hanya/aobook-haiku | ffe2a900528ade0bb9da300c2c32478d135472fd | [
"BSD-3-Clause"
] | null | null | null | /*$
Copyright (c) 2014-2017, Azel
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 the <organization> 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 <COPYRIGHT HOLDER> 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.
$*/
/*****************************************
* <X11> mPixbuf
*****************************************/
#include <stdlib.h>
#define MINC_X11_UTIL
#define MINC_X11_XSHM
#include "mSysX11.h"
#include "mPixbuf.h"
#include "mPixbuf_pv.h"
#include "mWindowDef.h"
#ifdef HAVE_XEXT_XSHM
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
//-------------------------
typedef struct
{
mPixbuf b;
mPixbufPrivate p;
XImage *ximg;
#ifdef HAVE_XEXT_XSHM
XShmSegmentInfo xshminfo;
#endif
}__mPixbufX11;
#define _PIXBUF(p) ((__mPixbufX11 *)(p))
//-------------------------
/** 構造体確保 */
mPixbuf *__mPixbufAlloc(void)
{
return (mPixbuf *)mMalloc(sizeof(__mPixbufX11), TRUE);
}
/** イメージ解放 */
void __mPixbufFree(mPixbuf *p)
{
__mPixbufX11 *px11 = (__mPixbufX11 *)p;
#ifdef HAVE_XEXT_XSHM
if(px11->xshminfo.shmaddr)
{
XShmDetach(XDISP, &px11->xshminfo);
XDestroyImage(px11->ximg);
shmdt(px11->xshminfo.shmaddr);
px11->ximg = NULL;
px11->xshminfo.shmaddr = NULL;
}
#endif
if(px11->ximg)
{
XDestroyImage(px11->ximg);
px11->ximg = NULL;
}
p->buf = p->buftop = NULL;
}
/** イメージ作成 */
int __mPixbufCreate(mPixbuf *p,int w,int h)
{
__mPixbufX11 *px11;
XImage *ximg = NULL;
__mPixbufFree(p);
px11 = _PIXBUF(p);
//作成 (XShm)
#ifdef HAVE_XEXT_XSHM
if(MAPP_SYS->fSupport & MX11_SUPPORT_XSHM)
{
ximg = XShmCreateImage(XDISP, CopyFromParent,
MAPP->depth, ZPixmap, NULL, &px11->xshminfo, w, h);
if(ximg)
{
px11->xshminfo.shmid = shmget(IPC_PRIVATE, ximg->bytes_per_line * h, IPC_CREAT | 0777);
if(px11->xshminfo.shmid < 0)
{
XDestroyImage(ximg);
ximg = NULL;
}
else
{
px11->xshminfo.shmaddr = ximg->data = (char *)shmat(px11->xshminfo.shmid, 0, 0);
px11->xshminfo.readOnly = 0;
XShmAttach(XDISP, &px11->xshminfo);
}
}
}
if(!ximg) px11->xshminfo.shmaddr = NULL;
#endif
//作成 (通常)
if(!ximg)
{
//XImage
ximg = XCreateImage(XDISP, CopyFromParent,
MAPP->depth, ZPixmap, 0, NULL, w, h, 32, 0);
if(!ximg) return -1;
/* イメージバッファ確保
* [!] XDestroyImage() で free() を使って解放されるので、
* 通常の malloc() を使う。*/
ximg->data = (char *)malloc(ximg->bytes_per_line * h);
if(!ximg->data)
{
XDestroyImage(ximg);
return -1;
}
}
//情報
px11->ximg = ximg;
p->w = w;
p->h = h;
p->bpp = (ximg->bits_per_pixel + 7) >> 3;
p->pitch = p->pitch_dir = ximg->bytes_per_line;
p->buf = p->buftop = (unsigned char *)ximg->data;
return 0;
}
/** ウィンドウに転送 */
void mPixbufRenderWindow(mPixbuf *p,mWindow *win,mBox *box)
{
#ifdef HAVE_XEXT_XSHM
if(_PIXBUF(p)->xshminfo.shmaddr)
{
XShmPutImage(XDISP, WINDOW_XID(win), MAPP_SYS->gc_def,
_PIXBUF(p)->ximg,
box->x, box->y, box->x, box->y, box->w, box->h, False);
}
else
{
XPutImage(XDISP, WINDOW_XID(win), MAPP_SYS->gc_def,
_PIXBUF(p)->ximg,
box->x, box->y, box->x, box->y, box->w, box->h);
}
#else
XPutImage(XDISP, WINDOW_XID(win), MAPP_SYS->gc_def,
_PIXBUF(p)->ximg,
box->x, box->y, box->x, box->y, box->w, box->h);
#endif
}
| 21.45283 | 90 | 0.66095 |
3337a95f9ce050d418d742b8c63c505425c994a1 | 786 | h | C | adt/pointer/adtpointer.h | Noctino52/Grafy-To-Go | 1edf6bc4e393724e0963471da909fa740acacaa1 | [
"Apache-2.0"
] | null | null | null | adt/pointer/adtpointer.h | Noctino52/Grafy-To-Go | 1edf6bc4e393724e0963471da909fa740acacaa1 | [
"Apache-2.0"
] | null | null | null | adt/pointer/adtpointer.h | Noctino52/Grafy-To-Go | 1edf6bc4e393724e0963471da909fa740acacaa1 | [
"Apache-2.0"
] | null | null | null | #ifndef NODE_H
#define NODE_H
/* ************************************************************************** */
#include "../bst/bst.h"
#include "../adt.h"
/* ************************************************************************** */
/* ************************************************************************** */
DataType* ConstructVoidDataType();
void DestructVoidDataType(DataType*);
/* ************************************************************************** */
void* CreateVoid();
void DestructVoid(void* var);
void* GetValueVoid(void* var);
void* SetValueVoid(void* var,void* dato);
void RandomValueVoid(void* var);
void ReadFromKeyBoardVoid(void* var);
void WriteToMonitorVoid(void* var);
void* CloneVoid(void* var);
uint CompareVoid(void* var1, void* var2);
#endif
| 27.103448 | 80 | 0.436387 |
77443d9461185f3dcd02bfa1d004d7896498b242 | 3,807 | h | C | aws-cpp-sdk-machinelearning/include/aws/machinelearning/model/UpdateBatchPredictionResult.h | ambasta/aws-sdk-cpp | c81192e00b572b76d175d84dff77185bd17ae1ac | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-machinelearning/include/aws/machinelearning/model/UpdateBatchPredictionResult.h | ambasta/aws-sdk-cpp | c81192e00b572b76d175d84dff77185bd17ae1ac | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-machinelearning/include/aws/machinelearning/model/UpdateBatchPredictionResult.h | ambasta/aws-sdk-cpp | c81192e00b572b76d175d84dff77185bd17ae1ac | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/machinelearning/MachineLearning_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace MachineLearning
{
namespace Model
{
/**
* <p>Represents the output of an <code>UpdateBatchPrediction</code> operation.</p>
* <p>You can see the updated content by using the <code>GetBatchPrediction</code>
* operation.</p>
*/
class AWS_MACHINELEARNING_API UpdateBatchPredictionResult
{
public:
UpdateBatchPredictionResult();
UpdateBatchPredictionResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
UpdateBatchPredictionResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline const Aws::String& GetBatchPredictionId() const{ return m_batchPredictionId; }
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline void SetBatchPredictionId(const Aws::String& value) { m_batchPredictionId = value; }
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline void SetBatchPredictionId(Aws::String&& value) { m_batchPredictionId = value; }
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline void SetBatchPredictionId(const char* value) { m_batchPredictionId.assign(value); }
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline UpdateBatchPredictionResult& WithBatchPredictionId(const Aws::String& value) { SetBatchPredictionId(value); return *this;}
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline UpdateBatchPredictionResult& WithBatchPredictionId(Aws::String&& value) { SetBatchPredictionId(value); return *this;}
/**
* <p>The ID assigned to the <code>BatchPrediction</code> during creation. This
* value should be identical to the value of the <code>BatchPredictionId</code> in
* the request.</p>
*/
inline UpdateBatchPredictionResult& WithBatchPredictionId(const char* value) { SetBatchPredictionId(value); return *this;}
private:
Aws::String m_batchPredictionId;
};
} // namespace Model
} // namespace MachineLearning
} // namespace Aws
| 36.961165 | 133 | 0.714736 |
9875a819dfa145b977c4f57efcc3f63268443c03 | 1,038 | c | C | Material/NumericalReceipe/NR_C301/legacy/nr2/C_211/examples/xsphbes.c | pragneshrana/NumericalOptimization | 28ea55840ed95262bc39c0896acee9e54cc375c2 | [
"MIT"
] | null | null | null | Material/NumericalReceipe/NR_C301/legacy/nr2/C_211/examples/xsphbes.c | pragneshrana/NumericalOptimization | 28ea55840ed95262bc39c0896acee9e54cc375c2 | [
"MIT"
] | null | null | null | Material/NumericalReceipe/NR_C301/legacy/nr2/C_211/examples/xsphbes.c | pragneshrana/NumericalOptimization | 28ea55840ed95262bc39c0896acee9e54cc375c2 | [
"MIT"
] | null | null | null |
/* Driver for routine rj */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NRANSI
#include "nr.h"
#include "nrutil.h"
#define MAXSTR 80
int main(void)
{
char txt[MAXSTR];
int i,n,nval;
float sj,sy,sjp,syp,x,xsj,xsy,xsjp,xsyp;
FILE *fp;
if ((fp = fopen("fncval.dat","r")) == NULL)
nrerror("Data file fncval.dat not found\n");
fgets(txt,MAXSTR,fp);
while (strncmp(txt,"Spherical Bessel Functions",26)) {
fgets(txt,MAXSTR,fp);
if (feof(fp)) nrerror("Data not found in fncval.dat\n");
}
fscanf(fp,"%d %*s",&nval);
printf("\n%s\n",txt);
for (i=1;i<=nval;i++) {
fscanf(fp,"%d %f %f %f %f %f",&n,&x,&sj,&sy,&sjp,&syp);
printf("%5s %4s\n%14s %16s %17s %16s\n%14s %16s %17s %16s\n",
"n","x","sj","sy","sjp","syp","xsj","xsy","xsjp","xsyp");
sphbes(n,x,&xsj,&xsy,&xsjp,&xsyp);
printf("%5d %5.2f\n\t%16.6e %16.6e %16.6e %16.6e\n",n,x,sj,sy,sjp,syp);
printf("\t%16.6e %16.6e %16.6e %16.6e\n",xsj,xsy,xsjp,xsyp);
}
fclose(fp);
return 0;
}
#undef NRANSI
| 25.317073 | 74 | 0.578035 |
decdaf50494874161223a24144a9b3bfec4e5a1f | 548 | h | C | mame/src/mame/includes/atarig42.h | nitrologic/emu | be2c9b72d81c3aea85ad4fd18fa4f731b31f338a | [
"Unlicense"
] | null | null | null | mame/src/mame/includes/atarig42.h | nitrologic/emu | be2c9b72d81c3aea85ad4fd18fa4f731b31f338a | [
"Unlicense"
] | null | null | null | mame/src/mame/includes/atarig42.h | nitrologic/emu | be2c9b72d81c3aea85ad4fd18fa4f731b31f338a | [
"Unlicense"
] | null | null | null | /*************************************************************************
Atari G42 hardware
*************************************************************************/
/*----------- defined in video/atarig42.c -----------*/
extern UINT16 atarig42_playfield_base;
extern UINT16 atarig42_motion_object_base;
extern UINT16 atarig42_motion_object_mask;
VIDEO_START( atarig42 );
VIDEO_UPDATE( atarig42 );
WRITE16_HANDLER( atarig42_mo_control_w );
void atarig42_scanline_update(const device_config *screen, int scanline);
| 27.4 | 75 | 0.529197 |
895ffc170176b3dbe5fcd9e916e157c2666a5571 | 1,215 | h | C | targets/TARGET_SIMULATOR/cmsis.h | geowor01/mbed-os | 97239731fac78ed2e871fe77794c491e796a4ad8 | [
"Apache-2.0"
] | null | null | null | targets/TARGET_SIMULATOR/cmsis.h | geowor01/mbed-os | 97239731fac78ed2e871fe77794c491e796a4ad8 | [
"Apache-2.0"
] | null | null | null | targets/TARGET_SIMULATOR/cmsis.h | geowor01/mbed-os | 97239731fac78ed2e871fe77794c491e796a4ad8 | [
"Apache-2.0"
] | 3 | 2020-04-24T15:54:43.000Z | 2022-03-31T06:55:16.000Z | /*
* PackageLicenseDeclared: Apache-2.0
* Copyright (c) 2015 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CMSIS_H
#define MBED_CMSIS_H
#include <stdint.h>
void NVIC_SystemReset ();
void __enable_irq ();
void __disable_irq ();
int __get_PRIMASK ();
void __CLREX ();
uint8_t __LDREXB (volatile uint8_t *ptr);
uint16_t __LDREXH (volatile uint16_t *ptr);
uint32_t __LDREXW (volatile uint32_t *ptr);
uint32_t __get_IPSR (void);
uint32_t __STREXB (uint8_t value, volatile uint8_t *addr);
uint32_t __STREXH (uint16_t value, volatile uint16_t *addr);
uint32_t __STREXW (uint32_t value, volatile uint32_t *addr);
void __WFI();
void __WFE();
void __DSB();
#endif
| 22.5 | 75 | 0.742387 |
81840982b573919f2240c0a1a2ae81c7c975ef7e | 1,602 | h | C | PrivateFrameworks/PassKitCore/PKFieldProperties.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/PassKitCore/PKFieldProperties.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/PassKitCore/PKFieldProperties.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
#import "NSSecureCoding.h"
@class NSArray, NSError;
@interface PKFieldProperties : NSObject <NSSecureCoding>
{
BOOL _shouldIgnore;
BOOL _authenticationRequired;
unsigned long long _technology;
long long _terminalType;
long long _valueAddedServiceMode;
NSArray *_TCIs;
NSArray *_merchantIdentifiers;
NSError *_error;
}
+ (BOOL)supportsSecureCoding;
+ (id)fieldPropertiesForFieldNotification:(id)arg1;
@property(copy, nonatomic) NSError *error; // @synthesize error=_error;
@property(copy, nonatomic) NSArray *merchantIdentifiers; // @synthesize merchantIdentifiers=_merchantIdentifiers;
@property(copy, nonatomic) NSArray *TCIs; // @synthesize TCIs=_TCIs;
@property(nonatomic) BOOL authenticationRequired; // @synthesize authenticationRequired=_authenticationRequired;
@property(nonatomic) BOOL shouldIgnore; // @synthesize shouldIgnore=_shouldIgnore;
@property(readonly, nonatomic) long long valueAddedServiceMode; // @synthesize valueAddedServiceMode=_valueAddedServiceMode;
@property(readonly, nonatomic) long long terminalType; // @synthesize terminalType=_terminalType;
@property(readonly, nonatomic) unsigned long long technology; // @synthesize technology=_technology;
- (void).cxx_destruct;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)description;
- (id)initWithTechnology:(unsigned long long)arg1 terminalType:(long long)arg2 valueAddedServiceMode:(long long)arg3;
@end
| 37.255814 | 124 | 0.774032 |
e6a1dcf8701dc53394c7b87257eee43c766595ac | 8,274 | h | C | PWGLF/NUCLEX/Nuclei/DeltaMasses/AliAnalysisNucleiMass.h | maroozm/AliPhysics | 22ec256928cfdf8f800e05bfc1a6e124d90b6eaf | [
"BSD-3-Clause"
] | 114 | 2017-03-03T09:12:23.000Z | 2022-03-03T20:29:42.000Z | PWGLF/NUCLEX/Nuclei/DeltaMasses/AliAnalysisNucleiMass.h | maroozm/AliPhysics | 22ec256928cfdf8f800e05bfc1a6e124d90b6eaf | [
"BSD-3-Clause"
] | 19,637 | 2017-01-16T12:34:41.000Z | 2022-03-31T22:02:40.000Z | PWGLF/NUCLEX/Nuclei/DeltaMasses/AliAnalysisNucleiMass.h | maroozm/AliPhysics | 22ec256928cfdf8f800e05bfc1a6e124d90b6eaf | [
"BSD-3-Clause"
] | 1,021 | 2016-07-14T22:41:16.000Z | 2022-03-31T05:15:51.000Z | #ifndef ALIANALYSISNUCLEIMASS_H
#define ALIANALYSISNUCLEIMASS_H
// ROOT includes
#include <TList.h>
// AliRoot includes
#include <AliAnalysisTaskSE.h>
#include <AliPIDResponse.h>
class AliAODEvent;
class AliESDEvent;
class AliVEvent;
class TH2F;
class TH2D;
class TH1F;
class TF1;
class TF2;
class TH2D;
class TGraph;
class AliESDtrackCuts;
class TProfile;
class TFile;
class TObject;
class AliAnalysisNucleiMass : public AliAnalysisTaskSE {
public:
AliAnalysisNucleiMass();
AliAnalysisNucleiMass(const char *name);
virtual ~AliAnalysisNucleiMass();
virtual void UserCreateOutputObjects();
virtual void UserExec(Option_t *option);
virtual void Terminate(Option_t *);
//Cuts on the events
void SetCentrality(Double_t CentMin=0., Double_t CentMax=100.) {Centrality[0]=CentMin; Centrality[1]=CentMax;};
//Cuts on the tracks
void SetFilterBit(Int_t TestFilterBit=16) {FilterBit=TestFilterBit;}
//geometrical cuts
void SetEtaLimit(Double_t etaMin=-0.8, Double_t etaMax=0.8) {EtaLimit[0]=etaMin;EtaLimit[1]=etaMax;}
void SetDCACut(Double_t DCAxyCUT=0.1, Double_t DCAzCUT=1000.0) {DCAxyCut=DCAxyCUT; DCAzCut=DCAzCUT;}
//other cuts
void SetNsigmaTPCCut(Double_t nSigmaTpcCut=2) {NsigmaTpcCut=nSigmaTpcCut;}
void SetNminTPCcluster(Int_t nMinTPCcluster=0) {NminTpcCluster=nMinTPCcluster;}
void SetTrdCut(Int_t kTRDcut=0) {iTrdCut=kTRDcut;}
//Settings
void SetisSignalCheck(Int_t IsSignalCheck=2) {kSignalCheck=IsSignalCheck;}
void SetMtofMethod(Int_t iMtofMethod=1) {iMtof=iMtofMethod;}
void SetPvtxNucleiCorrection(Int_t kMomVtxCorr=1) {kPvtxCorr=kMomVtxCorr;}
//void SetiTriggerSel(Int_t ItriggerSel=-99) {iTriggerSel=ItriggerSel;}
private:
AliAnalysisNucleiMass(const AliAnalysisNucleiMass &old);
AliAnalysisNucleiMass& operator=(const AliAnalysisNucleiMass &source);
static const Int_t nbin=46; // Number of pt bins in Tof Mass distributions
static const Int_t nBconf=2; // Number of Magnetic field configuration (B++ and B--)
static const Int_t nPart=9; // Number of particle type: e,mu,pi,K...
static const Int_t nSpec=18; // Number of particle species: particles: e+,e-,mu+,mu-,...
//Variables settings with public methods:
Double_t Centrality[2]; // Centrality bin (min and max)
Int_t FilterBit; // Filter Bit to be used
Double_t EtaLimit[2]; // Eta windows in analysis
Double_t DCAxyCut; // Cut on DCA-xy
Double_t DCAzCut; // Cut on DCA-z
Double_t NsigmaTpcCut; // number of sigma Tpc Cut
Int_t NminTpcCluster; // Number of minimum TPC clusters
Int_t iTrdCut; // iTrdCut==0-> No TRD cut; iTrdCut==1-> Yes TRD cut: yes TRD; iTrdCut==2->Yes TRD cut: no TRD;
Int_t kSignalCheck; // kSignalCheck==1->Fill all plots ; kSignalCheck==0->Fill only TH1 ; kSignalCheck==2-> Fill TH1 and some TH2 usefull in analysis
Int_t iMtof; // iMtof==1->m~pVtx ; iMtof==2->m~pExp ; iMtof==4->m~<p> (same correction for particle and antiparticle) ;
Int_t kPvtxCorr; // kPvtxCorr==1->Momentum at the primary vertex for (anti)nuclei is rescaled ; kPvtxCorr==0->no correction
//other:
Int_t iBconf; //! If Magnetic Field configuration is down or up
Bool_t kTOF; //! kTOFout and kTIME required
static const Int_t iTriggerSel=-99; // -99->no trigger required ; 0-> if kMB ; 16-> if kCentral ; 17-> if kSemiCentral ; -2 -> No MB, No Central and No SemiCentral
AliAODEvent* fAOD; //! AOD object
AliESDEvent* fESD; //! ESD object
AliVEvent* fEvent; //! general object
AliPIDResponse *fPIDResponse; //! pointer to PID response
TList *fList[nBconf]; //! lists for slot
TH1I *htriggerbits[nBconf][2]; //! Trigger bits distribution
TH1F *htemp[nBconf]; //! Temp. plot: avoid a problem with the merge of the output when a TList is empty (of the opposite magnetic field configuration)
TH1F *hCentrality[nBconf][2]; //! Centrality of the selected and analyzed events
TH1F *hZvertex[nBconf][2]; //! z-vertex distribution before and after the cuts on the event
TH1F *hEta[nBconf]; //! Eta distribution of the tracks
TH1F *hPhi[nBconf]; //! Phi particle distribution
TH2F *fEtaPhi[nBconf]; //! Phi vs Eta particle distribution
TH1F *hNTpcCluster[nBconf]; //! # of the TPC clusters after the track cuts
TH1F *hNTrdSlices[nBconf]; //! Number of the TRD slices after the track cuts
//TPC info:
TH2F *fdEdxVSp[nBconf][2]; //! dedx vs pTpc
TProfile *hDeDxExp[nBconf][9]; //! TPC spline used
TH2F *fNsigmaTpc[nBconf][18]; //! NsigmaTPC vs. pTpc
TH2F *fNsigmaTpc_kTOF[nBconf][18]; //! NsigmaTPC vs. pt when kTOF is required
//TOF info:
TH2F *fBetaTofVSp[nBconf][2]; //! beta vs pVtx
TProfile *hBetaExp[nBconf][9]; //! TOF expected beta
TH2F *fNsigmaTof[nBconf][9]; //! NsigmaTOF vs. pT
//TPC and TOF conbined
TH2F *fM2vsP_NoTpcCut[nBconf][1][2]; //! M2 vs. P
TH2F *fM2vsP[nBconf][1][18]; //! M2 vs. P with NsigmaTpcCut for each particle species
TH2F *fM2vsZ[nBconf][2]; //! M2 vs. Z
//DCA distributions
TH1D *hDCAxy[nBconf][18][nbin]; //! DCAxy distribution with NsigmaTpcCut for each particle species, in p bins
TH1D *hDCAz[nBconf][18][nbin]; //! DCAz distribution with NsigmaTpcCut for each particle species, in p bins
//TH2F *h2DCA[nBconf][18][nbin]; //! DCAxy vs DCAz with NsigmaTpcCut for each particle species, in p bins
TH2F *h2DCAap[nBconf][18]; //! DCAxy vs DCAz with NsigmaTpcCut for each particle species
//TOF mass distributions
TH1D *hM2CutDCAxy[nBconf][18][nbin]; //! Tof m2 distribution with NsigmaTpcCut
//...
TH2F *fPmeanVsBetaGamma[nBconf][18]; //! <p>/p vs beta*gamma for pi,K,p
TProfile *prPmeanVsBetaGamma[nBconf][18]; //! <p>/p vs beta*gamma for pi,K,p (profile)
//Parameterizations:
TF2 *fPvtxTrueVsReco[4]; //! TF1 pVtx_True vs pVtx_Reco calculated with MC for d,t,He3,He4
TProfile *prPvtxTrueVsReco[nBconf][4]; //! TProfile pVtx_True vs pVtx_Reco calculated with MC for d,t,He3,He4
TF1 *fPmeanVsBGcorr[14]; //! <p>/p as a function of beta*gamma for pi,K,p,d,t,He3,He4
TProfile *prPmeanVsBGcorr[nBconf][14]; //! <p>/p vs beta*gamma for pi,K,p,d,t,He3,He4 as calculated from the parameterizations
//------------------------------Methods----------------------------------------
void MomVertexCorrection(Double_t p, Double_t *pC, Double_t eta, Int_t FlagPid);
void FillDCAdist(Double_t DCAxy, Double_t DCAz, Double_t charge, Int_t FlagPid, Int_t stdFlagPid[9], Double_t *pC);
void GetMassFromPvertex(Double_t beta, Double_t p, Double_t &M2);
void GetZTpc(Double_t dedx, Double_t pTPC, Double_t M2, Double_t &Z2);
void GetMassFromPvertexCorrected(Double_t beta, Double_t *pC, Double_t *Mass2);
void GetMassFromExpTimes(Double_t beta, Double_t *IntTimes, Double_t *Mass2);
void GetPmeanVsBetaGamma(Double_t *IntTimes, Double_t *pVtx, Int_t FlagPid, Int_t FlagPidTof, Double_t charge);
void GetMassFromMeanMom(Double_t beta, Double_t *IntTimes, Double_t *pVtx, Double_t eta, Double_t charge, Double_t *Mass2, Int_t FlagPid, Int_t FlagPidTof);
void SetPvtxCorrections();
void SetPmeanCorrections();
ClassDef(AliAnalysisNucleiMass, 4);
};
#endif
| 52.037736 | 185 | 0.620135 |
32be7d01c860990d84b065949ed4d31bf3e3b15e | 6,099 | h | C | Engine/source/sfx/sfxParameter.h | vbillet/Torque3D | ece8823599424ea675e5f79d9bcb44e42cba8cae | [
"MIT"
] | 2,113 | 2015-01-01T11:23:01.000Z | 2022-03-28T04:51:46.000Z | Engine/source/sfx/sfxParameter.h | vbillet/Torque3D | ece8823599424ea675e5f79d9bcb44e42cba8cae | [
"MIT"
] | 948 | 2015-01-02T01:50:00.000Z | 2022-02-27T05:56:40.000Z | Engine/source/sfx/sfxParameter.h | vbillet/Torque3D | ece8823599424ea675e5f79d9bcb44e42cba8cae | [
"MIT"
] | 944 | 2015-01-01T09:33:53.000Z | 2022-03-15T22:23:03.000Z | //-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef _SFXPARAMETER_H_
#define _SFXPARAMETER_H_
#ifndef _SIMOBJECT_H_
#include "console/simObject.h"
#endif
#ifndef _SFXCOMMON_H_
#include "sfx/sfxCommon.h"
#endif
#ifndef _TSIGNAL_H_
#include "core/util/tSignal.h"
#endif
#ifndef _MPOINT2_H_
#include "math/mPoint2.h"
#endif
/// Enumeration of events triggered by SFXParameters.
enum SFXParameterEvent
{
/// The parameter value has changed.
SFXParameterEvent_ValueChanged,
/// The parameter is about to be deleted.
SFXParameterEvent_Deleted,
};
/// Parameter for interactive audio.
///
/// Parameters are tied to sound sources and will signal value changes so that
/// sound sources may react.
///
/// All parameters are global. The name of a parameter is its internal object name.
///
/// Like sources, parameters are exclusively client-side.
///
class SFXParameter : public SimObject
{
public:
typedef SimObject Parent;
typedef Signal< void( SFXParameter* parameter, SFXParameterEvent event ) > EventSignal;
protected:
/// The current value.
F32 mValue;
/// The min/max range of the parameter's value. Both inclusive.
Point2F mRange;
/// The channel being controlled by this parameter.
SFXChannel mChannel;
/// Value assigned to the parameter on creation and reset.
F32 mDefaultValue;
/// Help text.
String mDescription;
/// The signal used to notify attached sources of parameter events.
EventSignal mEventSignal;
/// @name Callbacks
/// @{
DECLARE_CALLBACK( void, onUpdate, () );
/// @}
static bool _setValue( void *object, const char *index, const char *data );
static bool _setRange( void *object, const char *index, const char *data );
static bool _setChannel( void *object, const char *index, const char *data );
static bool _setDefaultValue( void *object, const char *index, const char *data );
public:
SFXParameter();
~SFXParameter();
/// Look up a parameter by the given name.
static SFXParameter* find( StringTableEntry name );
/// Update the parameter's value. The default implementation will invoke a script
/// 'onUpdate' method if it is defined and do nothing otherwise.
virtual void update();
/// Reset the parameter's value to its default.
void reset();
/// Return the current value of this parameter.
F32 getValue() const { return mValue; }
/// Set the parameter's current value. Will be clamped against the parameter's valid
/// value range. If a value change occurs, a SFXParameterEvent_ValueChange event
/// is fired.
void setValue( F32 value );
/// Return the default value of this parameter. This is the value the parameter
/// will be set to when it is added to the system.
F32 getDefaultValue() const { return mDefaultValue; }
/// Set the default value of this parameter. This is the value the parameter
/// is set to when it is added to the system.
void setDefaultValue( F32 value );
/// Return the range of valid values that this parameter may take.
const Point2F& getRange() const { return mRange; }
/// Set the valid range for the value of this parameter. Note that both min
/// and max are inclusive.
void setRange( const Point2F& range );
/// Set the valid range for the value of this parameter. Note that both min
/// and max are inclusive.
void setRange( F32 minValue, F32 maxValue ) { setRange( Point2F( minValue, maxValue ) ); }
/// Return the parameter channel that is being affected by this parameter.
SFXChannel getChannel() const { return mChannel; }
/// Set the parameter channel that is being affected by this parameter.
void setChannel( SFXChannel channel );
/// Return the description text supplied for this parameter. This is used to help
/// identify the purpose of a parameter.
const String& getDescription() const { return mDescription; }
/// Set the description text for this parameter. This may be used to help identify
/// the purpose of a parameter.
void setDescription( const String& str ) { mDescription = str; }
/// Return the event signal for this parameter.
EventSignal& getEventSignal() { return mEventSignal; }
// SimObject.
virtual bool onAdd();
virtual void onRemove();
static void initPersistFields();
DECLARE_CONOBJECT( SFXParameter );
DECLARE_CATEGORY( "SFX" );
DECLARE_DESCRIPTION( "" );
};
#endif // !_SFXPARAMETER_H_
| 35.459302 | 96 | 0.651582 |
114cd08fd6b24dda0d9d3b01dd2c9d59b5b118f5 | 443 | h | C | templates/BluecadetApp/src/bluecadet/_TBOX_PREFIX_Settings.h | bluecadet/Cinder-BluecadetViews | d6ff2fecfbfd5399dfd375170083c9230a0e0d6b | [
"MIT"
] | 10 | 2017-10-23T15:27:50.000Z | 2021-02-03T03:28:27.000Z | templates/BluecadetApp/src/bluecadet/_TBOX_PREFIX_Settings.h | bluecadet/Cinder-BluecadetViews | d6ff2fecfbfd5399dfd375170083c9230a0e0d6b | [
"MIT"
] | 40 | 2017-10-20T13:56:08.000Z | 2021-10-01T15:39:37.000Z | templates/BluecadetApp/src/bluecadet/_TBOX_PREFIX_Settings.h | bluecadet/Cinder-BluecadetViews | d6ff2fecfbfd5399dfd375170083c9230a0e0d6b | [
"MIT"
] | 3 | 2018-07-16T16:34:37.000Z | 2020-05-07T02:49:37.000Z | #pragma once
#include "bluecadet/core/SettingsManager.h"
namespace bluecadet {
typedef std::shared_ptr<class _TBOX_PREFIX_Settings> _TBOX_PREFIX_SettingsRef;
class _TBOX_PREFIX_Settings : public bluecadet::core::SettingsManager {
public:
static _TBOX_PREFIX_SettingsRef get() {
static auto instance = std::make_shared<_TBOX_PREFIX_Settings>();
return instance;
}
void mapFields() override;
protected:
};
} // namespace bluecadet | 20.136364 | 78 | 0.785553 |
9bd83d012b59bdc8efde90bb604613f92c790f01 | 1,080 | h | C | ios/RemoteUserManager.h | qiongyue/react-native-aliyun-rtc | d1ca6781c3ef49823d54df77c4c692067f825fa8 | [
"Apache-1.1"
] | 1 | 2021-04-10T08:18:41.000Z | 2021-04-10T08:18:41.000Z | ios/RemoteUserManager.h | qiongyue/react-native-aliyun-rtc | d1ca6781c3ef49823d54df77c4c692067f825fa8 | [
"Apache-1.1"
] | null | null | null | ios/RemoteUserManager.h | qiongyue/react-native-aliyun-rtc | d1ca6781c3ef49823d54df77c4c692067f825fa8 | [
"Apache-1.1"
] | null | null | null | //
// RemoteUserManager.h
// AliyunRtc
//
// Created by Jason Law on 2020/8/12.
// Copyright © 2020 Facebook. All rights reserved.
//
#ifndef RemoteUserManager_h
#define RemoteUserManager_h
#import <Foundation/Foundation.h>
#import <AliRTCSdk/AliRtcEngine.h>
#import "RemoteUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface RemoteUserManager : NSObject
/**
@brief 实例
@return 实例
*/
+ (instancetype)shareManager;
/**
@brief 更新用户视频流
@param uid 用户ID
@param track 视频流
*/
- (void)updateRemoteUser:(NSString *)uid forTrack:(AliRtcVideoTrack)track;
/**
@brief 获取用户camera renderview
@param uid 用户ID
@return renderview
*/
- (AliRenderView *)cameraView:(NSString *)uid;
/**
@brief 获取用户screen renderview
@param uid 用户ID
@return renderview
*/
- (AliRenderView *)screenView:(NSString *)uid;
/**
@brief 获取所有在线用户
@return 所有在线用户
*/
- (NSArray *)allOnlineUsers;
/**
@brief 远端用户下线
@param uid 用户ID
*/
- (void)remoteUserOffLine:(NSString *)uid;
/**
@brief 移除房间所有用户
*/
- (void)removeAllUser;
@end
NS_ASSUME_NONNULL_END
#endif /* RemoteUserManager_h */
| 13.846154 | 74 | 0.707407 |
da92243646456cbb8bcf8b48f69378a49244d3db | 6,220 | h | C | Utils/Foundation/NSDate/NSDate+WWTHelper.h | lyimin/WWTKit | 2afe2583b31f34a0d7e02aa2aea0a6837a646c6f | [
"MIT"
] | null | null | null | Utils/Foundation/NSDate/NSDate+WWTHelper.h | lyimin/WWTKit | 2afe2583b31f34a0d7e02aa2aea0a6837a646c6f | [
"MIT"
] | null | null | null | Utils/Foundation/NSDate/NSDate+WWTHelper.h | lyimin/WWTKit | 2afe2583b31f34a0d7e02aa2aea0a6837a646c6f | [
"MIT"
] | null | null | null | //
// NSDate+WWTHelper.h
// WWTKit
//
// Created by EamonLiang on 2019/4/14.
// Copyright © 2019 wewave Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
//------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------
//MARK: >> Format
//------------------------------------------------------------------------
typedef NSString* WWTDateHelperFormat;
// "20160520" --> 2016.05.20
extern WWTDateHelperFormat const WWTDateHelperFormat_YYYYMMDD;
// "1530" --> 15:30
extern WWTDateHelperFormat const WWTDateHelperFormat_HHmm;
// "201605201530" --> 2016.05.20 15:30
extern WWTDateHelperFormat const WWTDateHelperFormat_YYYYMMDDHHmm;
// "20160520153013" --> 2016.05.20 15:30:13
extern WWTDateHelperFormat const WWTDateHelperFormat_YYYYMMDDHHmmss;
//MARK: >> Seconds
//------------------------------------------------------------------------
extern const NSTimeInterval WWTDASecond;
extern const NSTimeInterval WWTDAMinute;
extern const NSTimeInterval WWTDAHour;
extern const NSTimeInterval WWTDADay;
extern const NSTimeInterval WWTDAWeek;
extern const NSTimeInterval WWTDAYear;
//------------------------------------------------------------------------
#pragma mark - Interface (NSDate + WWTHelper)
//------------------------------------------------------------------------
@interface NSDate (WWTHelper)
//------------------------------------------------------------------------
#pragma mark - Calendar
//------------------------------------------------------------------------
/**
构建日历, identifier:Gregorian local: 'en_US'
@return NSCalendar
*/
+ (NSCalendar *)calendar;
//------------------------------------------------------------------------
#pragma mark - Date
//------------------------------------------------------------------------
/**
根据年月日构建00:00时间
*/
+ (NSDate *)dateInYear:(int)year month:(int)month day:(int)day;
/**
根据年与日时分秒构建时间
*/
+ (NSDate *)dateInYear:(int)year month:(int)month day:(int)day
hour:(int)hour min:(int)min sec:(int)sec;
+ (NSDate *)dateWithJSONIntValueWithNSDictionary:(NSDictionary*)dict withKey:(NSString*)key;
+ (NSDate *)dateWithJSONDoubleValueWithNSDictionary:(NSDictionary *)dict withKey:(NSString *)key;
//------------------------------------------------------------------------
#pragma mark - Offset
//------------------------------------------------------------------------
- (NSDate *)dateByYearOffset:(int)offset; // 返回年偏移后时间
- (NSDate *)dateByMonthOffset:(int)offset; // 返回月偏移后时间
- (NSDate *)dateByDayOffset:(int)offset; // 返回日偏移后时间
- (NSDate *)yesterday; // 偏移到下一天
- (NSDate *)tomorrow; // 偏移到前一天
- (NSDate *)lastYear; // 偏移到下一年
- (NSDate *)nextYear; // 偏移到上一年
- (NSDate *)lastMonth; // 偏移到上一月
- (NSDate *)nextMonth; // 偏移到下一月
- (NSDate *)lastWeek; // 偏移到上一周
- (NSDate *)nextWeek; // 偏移到下一周
- (NSDate *)beginningOfDay; // 偏移到00:00
- (NSDate *)endingOfDay; // 偏移到23:59
- (NSDate *)beginningOfWeek; // 偏移到本周第一天(周日)00:00
- (NSDate *)endingOfWeek; // 偏移到本周最后一天(周六)23:59
- (NSDate *)beginningOfMonth; // 偏移到本月第一天00:00
- (NSDate *)endingOfMonth; // 偏移到本月最后一天23:59
//------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------
- (int)year; // 年
- (int)month; // 月
- (int)day; // 日
- (int)hour; // 时
- (int)minute; // 分
- (int)dayOfWeek; // 0:周日 1:周一 ... 6:周六
//------------------------------------------------------------------------
#pragma mark - Compare Utils
//------------------------------------------------------------------------
/**
返回时间的天数偏移值.
@param date NSDate
@return offset
*/
- (int)dayOffsetWithDate:(NSDate *)date;
/**
是否比date早
@param date NSDate
@return BOOL
*/
- (BOOL)isEarlierThan:(NSDate *)date;
/**
是否比date晚
@param date NSDate
@return BOOL
*/
- (BOOL)isLaterThan:(NSDate *)date;
/*!
* 判断date是否在 start_time与end_time两字符串描述的时间内(24小时制, 包含边界)
*
* @param start_time 开始时间 string 格式"HH:mm:ss" 例如:"23:12:23"
* @param end_time 结束时间 string 格式"HH:mm:ss" 例如:"05:11:11"
*
* @return 是否在区间内(包含边界)
*/
- (BOOL)isBetween:(NSString *)start_time to:(NSString *)end_time;
/*!
* 判断两个date是否处于同一天
*
* @param date second date
*
* @return BOOL
*/
- (BOOL)isCloseTo:(NSDate *)date;
/*!
* 判断两个date是否间隔在n秒内
*
* @param date second date
* @param nSeconds Time Interval
*
* @return BOOL
*/
- (BOOL)isCloseTo:(NSDate *)date within:(NSTimeInterval) nSeconds;
//------------------------------------------------------------------------
#pragma mark - Date Utils
//------------------------------------------------------------------------
/**
根据时间字符串和时间格式字符串, 创建NSDate.
@param str 时间字符串
@param format 时间格式字符串
@return NSDate
*/
+ (NSDate *)dateWithString:(NSString *)str inFormat:(NSString *)format;
/**
根据时间字符串, 创建NSDate.
格式为: @"08:05"
@param str 时间字符串 NSString
@return NSDate
*/
+ (NSDate *)timeDateWithString:(NSString *)str;
/**
根据时间字符串, 创建NSDate.
格式为: @"08:05"
如果传入时间已过, 则返回下一次时间
@param str 时间字符串 NSString
@return NSDate
*/
+ (NSDate *)nextTimeDateWithString:(NSString *)str;
//------------------------------------------------------------------------
#pragma mark - String Utils
//------------------------------------------------------------------------
/**
* 时间格式字符串
*
* @param format NSString
*
* @return NSString
*/
- (NSString *)dateStringWithFormat:(NSString *)format;
/**
* 本地时间格式字符串. 例如在国内地区, 会返回"周三"等字符串.
*
* @param format NSString
*
* @return NSString
*/
- (NSString *)l10nDateStringWithFormat:(NSString *)format;
/**
国际时间格式字符串. 在所有读取, 都会返回"Sun"等字符串.
@param format NSString
@return NSString
*/
- (NSString *)i18nDateStringWithFormat:(NSString *)format;
//------------------------------------------------------------------------
#pragma mark - array util
//------------------------------------------------------------------------
/*
* 获取两个日期直接的NSDate(包含start,不包含end)
*/
+ (NSArray *)getDatesInBetween:(NSDate *)startDate to:(NSDate *)endDate;
@end
| 25.080645 | 97 | 0.49373 |
fb040b8f414cbaeb85c62e6280ca16743b39a8b8 | 1,675 | h | C | BH/DataSysteam.h | Redx93/BH | 0b3eaf31cbb043ae0f7809e811ad7aa953b9d369 | [
"MIT"
] | null | null | null | BH/DataSysteam.h | Redx93/BH | 0b3eaf31cbb043ae0f7809e811ad7aa953b9d369 | [
"MIT"
] | null | null | null | BH/DataSysteam.h | Redx93/BH | 0b3eaf31cbb043ae0f7809e811ad7aa953b9d369 | [
"MIT"
] | null | null | null | #pragma once
#include <iostream>
#include <string>
#include <vector>
#include "SaveSysteam.h"
struct Item
{
int index;
std::string name;
Item() :index(0) { }
~Item() { }
Item(int index) : index(index)
{
this->index = index;
load();
}
Item(const Item& other)
{
this->name = other.name;
this->index = other.index;
}
void SetName(std::string name)
{
this->name = name;
}
std::string GetName()
{
return name;
}
void Save()
{
SaveSysteam* ss = SaveSysteam::GetInstance();
std::string key = "Item" + std::to_string(index) + "Name";
ss->Set(key, name);
}
void load()
{
SaveSysteam* ss = SaveSysteam::GetInstance();
std::string key = "Item" + std::to_string(index) + "Name";
name = ss->GetString(key);
}
};
struct Inventory
{
std::vector<Item> items;
Inventory()
{
load();
}
Inventory(const Inventory& other)
{
this->items = other.items;
}
Item* GetItem(std::string name)
{
for (auto item : items)
{
if (item.GetName() == name)
{
return &item;
}
}
}
void AddItem(Item& item)
{
bool found = false;
for (size_t i = 0; i < items.size() &&!found; i++)
{
if (items[i].name == item.name)
{
found = true;
}
}
if (!found)
{
this->items.push_back(item);
}
}
void Save()
{
SaveSysteam* ss = SaveSysteam::GetInstance();
int numberOfItems = items.size();
ss->Set("ItemSize", numberOfItems);
for (auto item : items)
{
item.Save();
}
}
void load()
{
SaveSysteam* ss = SaveSysteam::GetInstance();
int numberOfItems = ss->GetInteger("ItemSize");
for (size_t i = 0; i < numberOfItems; i++)
{
items.push_back(Item(i));
}
}
};
struct PlayerPref
{
}; | 15.952381 | 60 | 0.595224 |
ee16e159a8ebf0b78cc45918a3e6ee9c9b58f8f8 | 802 | h | C | LDAPConnectionManager.h | cyberdork33/LDAPWrapper | d545e8fd13f2d68e7b5228a21b95e6abbcee21c0 | [
"MIT"
] | null | null | null | LDAPConnectionManager.h | cyberdork33/LDAPWrapper | d545e8fd13f2d68e7b5228a21b95e6abbcee21c0 | [
"MIT"
] | null | null | null | LDAPConnectionManager.h | cyberdork33/LDAPWrapper | d545e8fd13f2d68e7b5228a21b95e6abbcee21c0 | [
"MIT"
] | null | null | null | //
// LDAPConnectionManager.h
// CertificateFinder
//
// Created by cyberdork33@gmail.com on 5/14/12.
//
#import <Foundation/Foundation.h>
#import <ldap.h>
@interface LDAPConnectionManager : NSObject
// Error Handling
@property BOOL errorEncountered;
@property (readonly) NSString *lastLDAPError;
- (void)clearError;
// Convienience Initializers
- (LDAPConnectionManager *)initWithhost:(NSString *)host;
- (LDAPConnectionManager *)initWithhost:(NSString *)host port:(NSInteger)port;
- (NSInteger)bindLDAPServer:(NSString *)host port:(NSInteger)port;
// Returns NSArray of LDAPEntry objects
- (NSArray *)searchLDAPBase:(NSString *)baseDN
timeout:(NSInteger)searchTime
filter:(NSString *)filter
attributes:(NSArray *)attributes;
@end
| 24.30303 | 78 | 0.708229 |
870eef6cebeb073d791e8ba29990589c2f1db6ac | 9,262 | h | C | src/xma/include/app/xmascaler.h | subhransu-xilinx/XRT | 78f40abb9dcd10b2e8904c9a4f2d5fb69825de5e | [
"Apache-2.0"
] | null | null | null | src/xma/include/app/xmascaler.h | subhransu-xilinx/XRT | 78f40abb9dcd10b2e8904c9a4f2d5fb69825de5e | [
"Apache-2.0"
] | null | null | null | src/xma/include/app/xmascaler.h | subhransu-xilinx/XRT | 78f40abb9dcd10b2e8904c9a4f2d5fb69825de5e | [
"Apache-2.0"
] | 1 | 2020-03-28T05:50:59.000Z | 2020-03-28T05:50:59.000Z | /*
* Copyright (C) 2018, Xilinx Inc - All rights reserved
* Xilinx SDAccel Media Accelerator API
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. A copy of the
* License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
#ifndef _XMAAPP_SCALER_H_
#define _XMAAPP_SCALER_H_
#include "app/xmabuffers.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* DOC:
* The Xilinx media scaler API is comprised of two distinct interfaces:
* one interface for an external framework such as FFmpeg or a proprietary
* multi-media framework and the plugin interface used by Xilinx
* accelerator developers. This section illustrates both interfaces
* starting with the external framework view and moving on to the plugin
* developers view.
*
* The external interface to the Xilinx video scaler is comprised of the
* following functions:
*
* 1. xma_scaler_session_create()
* 2. xma_scaler_session_destroy()
* 3. xma_scaler_session_send_frame()
* 4. xma_scaler_session_recv_frame_list()
*
* A media framework (such as FFmpeg) is responsible for creating a scaler
* session. The scaler session contains state information used by the
* scaler plugin to manage the hardware associated with a Xilinx accelerator
* device. Prior to creating a scaler session the media framework is
* responsible for initializing the XMA using the function
* @ref xma_initialize(). The initialize function should be called by the
* media framework early in the framework initialization to ensure that all
* resources have been configured. Ideally, the @ref xma_initialize()
* function should be called from the main() function of the media framework
* in order to guarantee it is only called once.
*
*/
/**
* enum XmaScalerType - Specific type of scaler to request
*/
typedef enum XmaScalerType
{
XMA_BICUBIC_SCALER_TYPE = 1, /**< 1 */
XMA_BILINEAR_SCALER_TYPE, /**< 2 */
XMA_POLYPHASE_SCALER_TYPE /**< 3 */
} XmaScalerType;
/**
* struct XmaScalerInOutProperties - Properties which shall be used to specify configuration
* of kernel input or output as applicable
*/
typedef struct XmaScalerInOutProperties
{
XmaFormatType format; /**< ID specifying fourcc format */
int32_t bits_per_pixel; /**< bits per pixel for primary plane */
int32_t width; /**< width of primary plane */
int32_t height; /**< height of primary plane */
/** framerate data structure specifying frame rate per second */
XmaFraction framerate;
int32_t stride; /**< stride of primary plane */
int32_t filter_idx; /**< tbd */
int32_t coeffLoad; /**< 0-AutoGen 1-Default 2-FromFile */
char coeffFile[1024]; /**< Coeff file name when coeffLoad is set to 2 */
} XmaScalerInOutProperties;
/**
* struct XmaScalerFilterProperties - Filter coefficients to be used by kernel
*/
typedef struct XmaScalerFilterProperties
{
int16_t h_coeff0[64][12]; /**< horizontal coefficients 1 */
int16_t h_coeff1[64][12]; /**< horizontal coefficients 2 */
int16_t h_coeff2[64][12]; /**< horizontal coefficients 3 */
int16_t h_coeff3[64][12]; /**< horizontal coefficients 4 */
int16_t v_coeff0[64][12]; /**< vertical coefficients 1 */
int16_t v_coeff1[64][12]; /**< vertical coefficients 2 */
int16_t v_coeff2[64][12]; /**< vertical coefficients 3 */
int16_t v_coeff3[64][12]; /**< vertical coefficients 4 */
} XmaScalerFilterProperties;
/* Forward declaration */
typedef struct XmaSession XmaSession;
typedef struct XmaScalerSession XmaScalerSession;
/**
* struct XmaScalerProperties - Properties structure used to request filter type and
* vendor as well as the manner in which it should be inialized by the plugin
*/
typedef struct XmaScalerProperties
{
/** specific filter function requested */
XmaScalerType hwscaler_type;
/** downstream kernel receiving data from this filter */
XmaSession *destination;
/** maximum number of scaled outputs */
uint32_t max_dest_cnt;
/** specific vendor filter originated from */
char hwvendor_string[MAX_VENDOR_NAME];
/** number of actual scaled outputs */
int32_t num_outputs;
/** application-specified filter coefficients */
XmaScalerFilterProperties filter_coefficients;
/** input properties */
XmaScalerInOutProperties input;
/** output properties array */
XmaScalerInOutProperties output[MAX_SCALER_OUTPUTS];
/** array of kernel-specific custom initialization parameters */
XmaParameter *params;
/** count of custom parameters for port */
uint32_t param_cnt;
int32_t dev_index;
int32_t cu_index;
int32_t ddr_bank_index;//Used for allocating device buffers. Used only if valid index is provide (>= 0); value of -1 imples that XMA should select automatically and then XMA will set it with bank index used automatically
int32_t channel_id;
char *plugin_lib;
int32_t reserved[4];
} XmaScalerProperties;
/**
* xma_scaler_default_filter_coeff_set() - This helper function sets the default horizontal and vertical
* filter coefficients for a polyphase filter bank.
*
* @props: Pointer to a XmaScalerFilterProperties structure that
* will contain the filter coefficients.
*
*/
void xma_scaler_default_filter_coeff_set(XmaScalerFilterProperties *props);
/**
* xma_scaler_session_create() - This function creates a scaler session and must be called prior to
* scaling a frame. A session reserves hardware resources for the
* duration of a video stream. The number of sessions allowed depends on
* a number of factors that include: resolution, frame rate, bit depth,
* and the capabilities of the hardware accelerator.
*
* @props Pointer to a XmaScalerProperties structure that
* contains the key configuration properties needed for
* finding available hardware resource.
*
* RETURN: Not NULL on success
*
* NULL on failure
*
* Note: session create & destroy are thread safe APIs
*/
XmaScalerSession*
xma_scaler_session_create(XmaScalerProperties *props);
/**
* xma_scaler_session_destroy() - This function destroys an scaler session that was previously created
* with the xma_scaler_session_create() function.
*
* @session: Pointer to XmaScalerSession created with
* xma_scaler_session_create
*
* RETURN: XMA_SUCCESS on success
*
* XMA_ERROR on failure.
*
* Note: session create & destroy are thread safe APIs
*/
int32_t
xma_scaler_session_destroy(XmaScalerSession *session);
/**
* xma_scaler_session_send_frame() - This function invokes plugin->send_frame fucntion
* assigned to this session which handles sending data to the hardware scaler.
*
* This function sends a frame to the hardware scaler. If a frame
* buffer is not available, the plugin function should block.
*
* @session: Pointer to session created by xma_scaler_sesssion_create
* @frame: Pointer to a frame to be scaled. If the scaler is
* buffering input, then an XmaFrame with a NULL data buffer
* pointer to the first data buffer must be sent to flush the filter and
* to indicate that no more data will be sent:
* XmaFrame.data[0].buffer = NULL
* The application must then check for XMA_FLUSH_AGAIN for each such call
* when flushing the last few frames. When XMA_EOS is returned, no new
* data may be collected from the scaler.
*
* RETURN: XMA_SUCCESS on success and the scaler is ready to
* produce output
*
* XMA_SEND_MORE_DATA if the scaler is buffering input frames
*
* XMA_FLUSH_AGAIN when flushing scaler with a null frame
*
* XMA_EOS when the scaler has been flushed of all residual frames
*
* XMA_ERROR on error
*/
int32_t
xma_scaler_session_send_frame(XmaScalerSession *session,
XmaFrame *frame);
/**
* xma_scaler_session_recv_frame_list() - This function invokes plugin->recv_frame_list
* assigned to this session which handles obtaining list of output frames from the hardware encoder.
* This function is called after
* calling the function xma_scaler_session_send_frame. If a data buffer is
* not ready to be returned, the plugin function should blocks.
*
* @session: Pointer to session created by xma_scaler_sesssion_create
* @frame_list: Pointer to a list of XmaFrame structures
*
* RETURN: XMA_SUCCESS on success
*
* XMA_ERROR on error
*/
int32_t
xma_scaler_session_recv_frame_list(XmaScalerSession *session,
XmaFrame **frame_list);
#ifdef __cplusplus
}
#endif
#endif
| 38.591667 | 232 | 0.707623 |
7c81a14952b3a3992996041acc8a5a392f4cc920 | 1,937 | h | C | Socket.h | Upd4ting/CLib | 91b6be60678d5c3bb779237492144a225f1f5f33 | [
"MIT"
] | null | null | null | Socket.h | Upd4ting/CLib | 91b6be60678d5c3bb779237492144a225f1f5f33 | [
"MIT"
] | null | null | null | Socket.h | Upd4ting/CLib | 91b6be60678d5c3bb779237492144a225f1f5f33 | [
"MIT"
] | null | null | null | #pragma once
#include <string.h>
#include <stdio.h>
#include <stdlib.h> /* pour exit */
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <errno.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <signal.h>
#include <functional>
#include <vector>
#include <utility>
#include "Logger.h"
#define END_OF_CONNECTION "END_OF_CONNECTION"
#define DENY_OF_CONNECTION "DENY_OF_CONNECTION"
#define CLOSE_END_CONNECTION 0
#define CLOSE_DENY_CONNECTION 1
#define CLOSE_ERROR_CONNECTION 2
enum IPType { UNICAST, MULTICAST };
class Socket;
typedef std::function<void(int)> CLOSELISTENER;
typedef std::function<void(Socket*)> MESSAGELISTENER;
class Socket
{
protected:
int hSocket;
struct sockaddr_in address;
Logger *logger;
CLOSELISTENER clistener;
MESSAGELISTENER mlistener;
bool running;
// Fermer le socket avec un message d'erreur
// Retourne true si pas d'erreur
bool stop(std::string message);
// Constructeur par défaut
Socket(Logger *l);
// Constructeur avec paramètre
// Pour initiliaser un socket qui est déjà créer
// On a juste besoin d'encapsuler ses informations
Socket(int hS, struct sockaddr_in a, Logger *l);
// Constructeur de copie
Socket(const Socket& so);
public:
// Destructeur
virtual ~Socket();
// Initialiser la socket
virtual void init(std::string data, int port, IPType type) = 0;
virtual void onStart(bool wait) = 0;
virtual void onStop(bool eoc) = 0;
// On démarre la socket
void start(bool wait = false);
// Fermer la socket
// Retourne true si pas d'erreur
bool stop(bool eoc = true);
// Ajoute un message listener
void setMessageListener(MESSAGELISTENER listener);
// Ajoute un close listener
void setCloseListener(CLOSELISTENER listener);
// Getter & Setter
int getHSocket() const;
const struct sockaddr_in* getAddress() const;
bool isConnected() const;
}; | 22.011364 | 64 | 0.738255 |
dc323db09c6d6f0ac31bec8df04f9dcb48c3a86f | 5,580 | c | C | Laboratoires/Lab3/server-uni-udp.c | MonsieurBedard/420-0SV-SW | f753b0e0a11d416dbde04d852c260424c3a58a24 | [
"MIT"
] | null | null | null | Laboratoires/Lab3/server-uni-udp.c | MonsieurBedard/420-0SV-SW | f753b0e0a11d416dbde04d852c260424c3a58a24 | [
"MIT"
] | null | null | null | Laboratoires/Lab3/server-uni-udp.c | MonsieurBedard/420-0SV-SW | f753b0e0a11d416dbde04d852c260424c3a58a24 | [
"MIT"
] | null | null | null | /*****************************************************************
Module d'utilisation d'un socket UDP sur Unix
Stevens Gagnon
Departement Informatique
College Shawinigan
******************************************************************/
#define MAX_BUFFER 100
// --- Parametres specifique au serveur
#define ADR_LISTEN "INADDR_ANY" // "INADDR_ANY" ou "192.168.2.2"
#define PORT_NET 33000 /* Port sur lequel le serveur attend */
// --- Messages
#define MESSAGE "[ MESSAGE ]" // no colors
#define MESSAGE_TEST "[ \x1b[35mTEST\x1b[0m ]" // magenta
#define MESSAGE_ERROR "[ \x1b[31mERROR\x1b[0m ]" // red
#define MESSAGE_WARNING "[ \x1b[33mWARNING\x1b[0m ]" // yellow
#define MESSAGE_OK "[ \x1b[32mOK\x1b[0m ]" // green
#define MESSAGE_INFO "[ \x1b[34mINFO\x1b[0m ]" // blue
// --- Includes
#include <time.h>
#include "Progress.h"
#include "sg_udp.h"
// --- Main
int main(int argc, char *argv[])
{
// Setup server
int serveur;
serveur = setup_udp_serveur(ADR_LISTEN, PORT_NET);
if (serveur != -1)
{
// Greeting
printf(" _____ __ \n");
printf(" / ___/___ ______ _____ _____ __ ______/ /___ \n");
printf(" \\__ \\/ _ \\/ ___/ | / / _ \\/ ___/ / / / / __ / __ \\ \n");
printf(" ___/ / __/ / | |/ / __/ / / /_/ / /_/ / /_/ / \n");
printf("/____/\\___/_/ |___/\\___/_/ \\__,_/\\__,_/ .___/ \n");
printf(" /_/ \n");
printf("-------------------------------------------------------\n\n");
// Operation variables
int state = 0;
int step = 0;
int quit = 0;
time_t timerBegin;
// File variables
FILE *pFile = NULL;
long lFile = 0;
long offset = 0;
char fileName[20];
// Server variables
unsigned long id;
int lg_rx, lg_out, lg_tx;
socklen_t paq_lg;
struct sockaddr_in client;
char buffer[MAX_BUFFER + 1],
buffer_in[MAX_BUFFER + 1],
buffer_out[MAX_BUFFER + 1];
// Initiation
struct Progress *pro = newProgress();
//initProgress(pro);
paq_lg = sizeof(struct sockaddr_in); // Retourne la longueur de la boite PAS DU CONTENU.
do
{
switch (state)
{
case 0: // Waiting for a file request
printf("Waiting for client...\n");
if ((lg_rx = recvfrom(serveur, buffer, MAX_BUFFER, 0, (struct sockaddr *)&client, &paq_lg)) < 0)
{
perror(MESSAGE_ERROR " recvfrom");
exit(EXIT_FAILURE);
}
else
{
printf("-----------------------------------------------\n\n");
printf("New client: ");
prt_sockaddr_in(client);
id = socket2id(client);
buffer[lg_rx] = 0;
sscanf(buffer, "%s\0", fileName);
printf("File: %s\n", fileName);
state = 1;
}
break;
case 1: // Sending the file length + init the file
pFile = fopen(fileName, "rb");
// Get length of file
fseek(pFile, 0, SEEK_END); // Jump to the end of the file
lFile = ftell(pFile); // Get the current byte offset in the file
rewind(pFile); // Jump back to the beginning of the file
// Display length of file
pro->p_end = lFile;
printf("Size of file: %ld\n\n", lFile);
// Sending length to client
sprintf(buffer, "%ld\0", lFile);
lg_out = strlen(buffer);
if ((lg_tx = sendto(serveur, buffer, lg_out, 0, (struct sockaddr *)&client, paq_lg)) < 0)
{
perror("\n" MESSAGE_ERROR " sendto");
exit(EXIT_FAILURE);
}
else
{
// Waiting for confirmation of reception
if ((lg_rx = recvfrom(serveur, buffer, MAX_BUFFER, 0, (struct sockaddr *)&client, &paq_lg)) < 0)
{
perror(MESSAGE_ERROR " recvfrom");
exit(EXIT_FAILURE);
}
else
{
// Moving to next state
state = 2;
}
}
break;
case 2: // Sending the file to the client
// Timing start
timerBegin = time(NULL);
while (ftell(pFile) < lFile)
{
// Read 100 bytes
bzero(buffer, MAX_BUFFER); // place de 0 (nul) dans chaque case de la boite.
offset = ftell(pFile);
if (fread(buffer, MAX_BUFFER, 1, pFile) == 1)
{
// If buffer full, lg_out = MAX_BUFFER
lg_out = MAX_BUFFER;
}
else
{
// lg_out = offset to end of file
lg_out = lFile - offset;
}
// Send Buffer
if ((lg_tx = sendto(serveur, buffer, lg_out, 0, (struct sockaddr *)&client, paq_lg)) < 0)
{
perror("\n" MESSAGE_ERROR " sendto");
exit(EXIT_FAILURE);
}
// Get confirmation
bzero(buffer, MAX_BUFFER);
if ((lg_rx = recvfrom(serveur, buffer, MAX_BUFFER, 0, (struct sockaddr *)&client, &paq_lg)) < 0)
{
perror("\n" MESSAGE_ERROR " recvfrom");
exit(EXIT_FAILURE);
}
// Send an empty packet at the end
if (ftell(pFile) == lFile)
{
bzero(buffer, MAX_BUFFER);
lg_out = 0;
if ((lg_tx = sendto(serveur, buffer, lg_out, 0, (struct sockaddr *)&client, paq_lg)) < 0)
{
perror(MESSAGE_ERROR " sendto");
exit(EXIT_FAILURE);
}
}
// Update to progress bar
pro->p_current = ftell(pFile);
updateProgress(pro);
}
printf("\n");
// Timing end
int time_spent = (int)(difftime(time(NULL), timerBegin));
printf("Approximated execution time = %d s\n", time_spent);
fclose(pFile);
state = 3;
break;
case 3: // Close the server
close(serveur);
quit = 1;
break;
default: // Just in case
return -1;
break;
}
} while (!quit);
}
else
{
printf(MESSAGE_ERROR " Server");
}
return 0;
}
| 24.910714 | 101 | 0.546774 |
dc55ef7626ab207285665cb86d6e77761010e93b | 63,486 | c | C | testdata/csmith/289.c | Konstantin8105/c2go-rating | edba6b8aa1ce2a69a17b076596764fec656cb2f9 | [
"MIT"
] | null | null | null | testdata/csmith/289.c | Konstantin8105/c2go-rating | edba6b8aa1ce2a69a17b076596764fec656cb2f9 | [
"MIT"
] | null | null | null | testdata/csmith/289.c | Konstantin8105/c2go-rating | edba6b8aa1ce2a69a17b076596764fec656cb2f9 | [
"MIT"
] | null | null | null | /*
* This is a RANDOMLY GENERATED PROGRAM.
*
* Generator: csmith 2.2.0
* Git version: dcef523
* Options: (none)
* Seed: 2568542696
*/
#include "csmith.h"
static long __undefined;
/* --- Struct/Union Declarations --- */
union U0 {
volatile signed f0 : 2;
uint16_t f1;
int16_t f2;
const uint32_t f3;
int64_t f4;
};
/* --- GLOBAL VARIABLES --- */
static volatile int32_t g_7 = 0x8999D94BL;/* VOLATILE GLOBAL g_7 */
static int32_t g_8 = 0L;
static volatile int32_t g_12 = 0x5440874BL;/* VOLATILE GLOBAL g_12 */
static int32_t g_13 = 0xD4A55F07L;
static uint8_t g_29 = 0UL;
static uint16_t g_52 = 6UL;
static uint16_t g_61 = 65526UL;
static volatile union U0 g_66 = {1L};/* VOLATILE GLOBAL g_66 */
static int32_t g_85 = 0xE7B2E1D8L;
static uint32_t g_103 = 6UL;
static uint16_t g_125 = 65530UL;
static volatile int32_t g_133 = 0x2C377822L;/* VOLATILE GLOBAL g_133 */
static volatile int32_t * volatile g_132 = &g_133;/* VOLATILE GLOBAL g_132 */
static volatile int32_t * volatile *g_131 = &g_132;
static int32_t g_167 = 0x73671048L;
static int64_t g_177 = 4L;
static int32_t *g_183 = (void*)0;
static int8_t g_188[8][1] = {{0x1DL},{0x08L},{0x1DL},{0x08L},{0x1DL},{0x08L},{0x1DL},{0x08L}};
static volatile int64_t g_225 = 5L;/* VOLATILE GLOBAL g_225 */
static volatile int64_t * volatile g_224[1] = {&g_225};
static volatile int64_t * volatile *g_223 = &g_224[0];
static int16_t g_231 = 5L;
static int32_t g_233[8] = {9L,0x60F77C65L,9L,9L,0x60F77C65L,9L,9L,0x60F77C65L};
static uint64_t g_267 = 0xBE9AB393D07945E1LL;
static int8_t *g_321 = (void*)0;
static union U0 g_345 = {0xB561B192L};/* VOLATILE GLOBAL g_345 */
static uint32_t g_376 = 0xBB295AFFL;
static uint64_t g_416 = 0xC4278F18D7C328C4LL;
static uint32_t *g_419 = &g_103;
static uint32_t **g_418 = &g_419;
static uint32_t ** volatile *g_417 = &g_418;
static volatile int32_t g_466 = 1L;/* VOLATILE GLOBAL g_466 */
static volatile int32_t *g_465 = &g_466;
static volatile int32_t **g_464 = &g_465;
static union U0 g_469 = {-2L};/* VOLATILE GLOBAL g_469 */
static union U0 g_515[5] = {{1L},{1L},{1L},{1L},{1L}};
static uint64_t g_603 = 0x4654585D67A78EF3LL;
static volatile union U0 g_608 = {3L};/* VOLATILE GLOBAL g_608 */
static int64_t ***g_618 = (void*)0;
static int64_t ***g_623 = (void*)0;
static union U0 g_663 = {1L};/* VOLATILE GLOBAL g_663 */
static union U0 g_681 = {0x548A0079L};/* VOLATILE GLOBAL g_681 */
static union U0 g_769 = {0x8BF3E684L};/* VOLATILE GLOBAL g_769 */
static union U0 *g_768 = &g_769;
static int32_t g_774 = 9L;
static union U0 g_810[6][1][7] = {{{{0x361692D0L},{0x80F66EA4L},{0x6F11BCAEL},{0x361692D0L},{0x248001D5L},{0x1C4FED9CL},{0x80F66EA4L}}},{{{0x2171B486L},{0xD62A2B51L},{0x93FC291BL},{0x23FF94ACL},{0x93FC291BL},{0xD62A2B51L},{0x2171B486L}}},{{{0xD62A2B51L},{0x80F66EA4L},{-1L},{0x93FC291BL},{0x2171B486L},{0xD62A2B51L},{0x93FC291BL}}},{{{0x361692D0L},{0x248001D5L},{0x1C4FED9CL},{-5L},{-5L},{0x23FF94ACL},{0xD62A2B51L}}},{{{-5L},{0x01460B31L},{1L},{0x723B05B0L},{0x01460B31L},{0x1C4FED9CL},{0xD62A2B51L}}},{{{0xB030D819L},{-5L},{0x1C4FED9CL},{0xB030D819L},{0xD62A2B51L},{0xB030D819L},{0x1C4FED9CL}}}};
static const uint32_t *g_844 = &g_103;
static const uint32_t **g_843 = &g_844;
static const uint32_t ***g_842 = &g_843;
static int32_t g_849[7][1] = {{3L},{3L},{3L},{3L},{3L},{3L},{3L}};
static uint32_t ***g_872 = &g_418;
static int32_t * volatile g_919 = &g_774;/* VOLATILE GLOBAL g_919 */
static uint32_t * const * const *g_933 = (void*)0;
static uint32_t * const * const **g_932[9][10][2] = {{{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0}},{{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{(void*)0,&g_933}},{{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{(void*)0,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{(void*)0,(void*)0},{&g_933,&g_933}},{{&g_933,&g_933},{(void*)0,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{(void*)0,&g_933},{&g_933,&g_933},{&g_933,(void*)0}},{{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933}},{{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933}},{{(void*)0,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{(void*)0,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{(void*)0,(void*)0}},{{&g_933,&g_933},{&g_933,&g_933},{(void*)0,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{(void*)0,&g_933},{&g_933,&g_933}},{{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,&g_933},{&g_933,(void*)0},{&g_933,&g_933},{&g_933,&g_933}}};
static volatile union U0 g_983 = {0x72F524A2L};/* VOLATILE GLOBAL g_983 */
static int8_t g_1070[4][10] = {{(-1L),0x3AL,(-2L),0x3AL,(-1L),0x32L,0x32L,(-1L),0x3AL,(-2L)},{0xD5L,0xD5L,(-2L),(-1L),0x05L,(-1L),(-2L),0xD5L,0xD5L,(-2L)},{0x3AL,(-1L),0x32L,0x32L,(-1L),0x3AL,(-2L),0x3AL,(-1L),0x32L},{(-1L),0xD5L,(-1L),0x32L,(-2L),(-2L),0x32L,(-1L),0xD5L,(-1L)}};
static int32_t ** const volatile g_1090[3] = {&g_183,&g_183,&g_183};
static int32_t ** volatile g_1093 = &g_183;/* VOLATILE GLOBAL g_1093 */
static uint32_t g_1110 = 4294967289UL;
static union U0 g_1116[8][10][1] = {{{{8L}},{{-1L}},{{-5L}},{{-3L}},{{-8L}},{{0xCAB4E1BBL}},{{-1L}},{{0xCAB4E1BBL}},{{-8L}},{{-3L}}},{{{-5L}},{{-1L}},{{8L}},{{0x6BFD13F9L}},{{0x51E16265L}},{{0L}},{{-1L}},{{0L}},{{-1L}},{{-1L}}},{{{0L}},{{-1L}},{{0L}},{{0x51E16265L}},{{0x6BFD13F9L}},{{8L}},{{-1L}},{{-5L}},{{-3L}},{{-8L}}},{{{0xCAB4E1BBL}},{{-1L}},{{0xCAB4E1BBL}},{{-8L}},{{-3L}},{{-5L}},{{-1L}},{{8L}},{{0x6BFD13F9L}},{{0x51E16265L}}},{{{0L}},{{-1L}},{{0L}},{{-1L}},{{-1L}},{{0L}},{{-1L}},{{0L}},{{0x51E16265L}},{{0x6BFD13F9L}}},{{{8L}},{{-1L}},{{-5L}},{{-3L}},{{-8L}},{{0xCAB4E1BBL}},{{-1L}},{{0xCAB4E1BBL}},{{-8L}},{{-3L}}},{{{-5L}},{{-1L}},{{8L}},{{0x6BFD13F9L}},{{0x51E16265L}},{{0L}},{{-1L}},{{0L}},{{-1L}},{{-1L}}},{{{0L}},{{-1L}},{{0L}},{{0x51E16265L}},{{0x6BFD13F9L}},{{8L}},{{-1L}},{{-5L}},{{-3L}},{{-8L}}}};
static uint32_t ****g_1146 = &g_872;
static uint32_t *****g_1145 = &g_1146;
static const uint32_t ****g_1151 = &g_842;
static const uint32_t *****g_1150 = &g_1151;
static const union U0 g_1166[9] = {{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL},{0xBCCE96CFL}};
static volatile union U0 g_1193[7] = {{-1L},{1L},{1L},{-1L},{1L},{1L},{-1L}};
static union U0 g_1213 = {-1L};/* VOLATILE GLOBAL g_1213 */
static volatile int64_t * volatile **g_1226 = (void*)0;
static volatile int64_t * volatile ***g_1225 = &g_1226;
static volatile int64_t * volatile ****g_1224 = &g_1225;
static union U0 g_1268[2][9][9] = {{{{0x9E1C4659L},{0x8DD633BEL},{0x833F7798L},{8L},{0x03EDA5E1L},{-1L},{0x5E283898L},{-1L},{-1L}},{{0x688C5212L},{0x87B510FDL},{-2L},{-7L},{0x568FFC9BL},{-7L},{0x5E283898L},{-7L},{0xBB8ED630L}},{{0x5AC6D1F2L},{-4L},{-1L},{0x53486797L},{-1L},{0xAF2F5841L},{0x5117F0FCL},{0x0E37588CL},{-5L}},{{-3L},{0x27ECB6E8L},{0x87B510FDL},{-1L},{0xA2A5034EL},{9L},{0xA2A5034EL},{-1L},{0x87B510FDL}},{{1L},{0x0E37588CL},{0x8DD633BEL},{0x5117F0FCL},{6L},{6L},{0x87B510FDL},{-9L},{-7L}},{{0x9BE6DC7EL},{0x39C5C0ECL},{0x5E283898L},{0x5AC6D1F2L},{0xC7E3E36DL},{0xBB8ED630L},{1L},{0xF2C9CB93L},{-3L}},{{0x27ECB6E8L},{-7L},{0x8DD633BEL},{-1L},{-8L},{0x23DC6596L},{-1L},{0xDCD37698L},{0x1B363F4CL}},{{4L},{0x8A26ED4AL},{0xAF2F5841L},{0x4EAB465CL},{-2L},{-9L},{6L},{0xBB8ED630L},{0x5AC6D1F2L}},{{-3L},{-5L},{0x568FFC9BL},{0x23DC6596L},{0xBB8ED630L},{0xAF2F5841L},{0x39C5C0ECL},{0x0589C58CL},{6L}}},{{{0xBB8ED630L},{-7L},{1L},{0x9E1C4659L},{1L},{-5L},{0x9BE6DC7EL},{0x0589C58CL},{9L}},{{-1L},{-9L},{-1L},{0xF2C9CB93L},{-3L},{0xDCD37698L},{-1L},{0xBB8ED630L},{0x9E1C4659L}},{{0xAF2F5841L},{6L},{-5L},{1L},{0xDCD37698L},{0x688C5212L},{0x688C5212L},{0xDCD37698L},{1L}},{{-8L},{-1L},{-8L},{0x9BE6DC7EL},{-7L},{1L},{0L},{0xF2C9CB93L},{-6L}},{{-10L},{-1L},{0x0589C58CL},{-1L},{-1L},{6L},{0xA2A5034EL},{-9L},{0L}},{{0x9279772DL},{0x5AC6D1F2L},{0x87B510FDL},{0x9BE6DC7EL},{0x23DC6596L},{0xC7E3E36DL},{0xBDBD4C74L},{8L},{-9L}},{{0x03EDA5E1L},{-2L},{-3L},{1L},{0xA2A5034EL},{-7L},{0xD28B311FL},{0x688C5212L},{-1L}},{{0x4EAB465CL},{0L},{1L},{0xF2C9CB93L},{0x9BE6DC7EL},{9L},{-4L},{-9L},{1L}},{{-3L},{-10L},{1L},{0x9E1C4659L},{-7L},{0x9279772DL},{-8L},{4L},{1L}}}};
static const int32_t *g_1272 = &g_167;
static const int32_t ** volatile g_1271[2] = {&g_1272,&g_1272};
static const int32_t ** volatile g_1273 = &g_1272;/* VOLATILE GLOBAL g_1273 */
static uint64_t *g_1297 = &g_416;
static volatile union U0 g_1298 = {6L};/* VOLATILE GLOBAL g_1298 */
static const int32_t g_1305 = 2L;
static const int32_t g_1307 = 0xDCF88CDEL;
static const int32_t *g_1336 = &g_8;
static const int32_t ** volatile g_1335 = &g_1336;/* VOLATILE GLOBAL g_1335 */
/* --- FORWARD DECLARATIONS --- */
static int32_t func_1(void);
static int32_t func_2(uint32_t p_3);
static uint64_t func_14(uint32_t p_15, int32_t * p_16, int8_t p_17, int32_t * p_18, uint8_t p_19);
static uint32_t func_22(uint8_t p_23);
static int8_t func_34(uint64_t p_35, const int32_t * p_36, const int32_t p_37);
static int16_t func_41(int32_t * p_42, const uint16_t p_43, uint8_t p_44);
static int32_t * func_45(uint16_t p_46, uint16_t p_47, int32_t p_48, uint16_t p_49, uint32_t p_50);
static int8_t func_67(int32_t * p_68, int32_t * const * p_69);
static uint16_t * func_74(uint32_t p_75, int32_t p_76, uint32_t p_77, const int16_t p_78, int32_t p_79);
static int32_t * func_97(uint16_t p_98, uint32_t p_99, int32_t ** p_100);
/* --- FUNCTIONS --- */
/* ------------------------------------------ */
/*
* reads : g_132 g_133 g_131 g_1298 g_849 g_768 g_769 g_125 g_177 g_603 g_1224 g_1225 g_464 g_465 g_419 g_769.f0 g_1070 g_167 g_1150 g_1151 g_842 g_843 g_844 g_103 g_1297 g_416 g_1335
* writes: g_8 g_13 g_133 g_1297 g_849 g_103 g_1268.f1 g_167 g_1272 g_1336
*/
static int32_t func_1(void)
{ /* block id: 0 */
uint8_t l_1337 = 0UL;
(**g_131) = func_2((safe_unary_minus_func_uint32_t_u(0x801FC3EEL)));
return l_1337;
}
/* ------------------------------------------ */
/*
* reads : g_132 g_133 g_131 g_1298 g_849 g_768 g_769 g_125 g_177 g_603 g_1224 g_1225 g_464 g_465 g_419 g_769.f0 g_1070 g_167 g_1150 g_1151 g_842 g_843 g_844 g_103 g_1297 g_416 g_1335
* writes: g_8 g_13 g_133 g_1297 g_849 g_103 g_1268.f1 g_167 g_1272 g_1336
*/
static int32_t func_2(uint32_t p_3)
{ /* block id: 1 */
int8_t l_28[5];
int32_t l_1039 = 1L;
int32_t l_1040 = (-1L);
int32_t l_1041[5][9][3] = {{{1L,1L,0x68CC162FL},{(-8L),0x68CC162FL,0x68CC162FL},{0x68CC162FL,2L,0xCD2B61FFL},{(-8L),2L,(-8L)},{1L,0x68CC162FL,0xCD2B61FFL},{1L,1L,0x68CC162FL},{(-8L),0x68CC162FL,0x68CC162FL},{0x68CC162FL,2L,0xCD2B61FFL},{(-8L),2L,(-8L)}},{{1L,0x68CC162FL,0xCD2B61FFL},{1L,1L,0x68CC162FL},{(-8L),0x68CC162FL,0x68CC162FL},{0x68CC162FL,2L,0xCD2B61FFL},{(-8L),2L,(-8L)},{1L,0x68CC162FL,0xCD2B61FFL},{1L,1L,0x68CC162FL},{(-8L),0x68CC162FL,0x68CC162FL},{0x68CC162FL,2L,0xCD2B61FFL}},{{(-8L),2L,(-8L)},{1L,0x68CC162FL,0xCD2B61FFL},{1L,1L,0x68CC162FL},{(-8L),(-8L),(-8L)},{(-8L),1L,2L},{0xCD2B61FFL,1L,0xCD2B61FFL},{0x68CC162FL,(-8L),2L},{0x68CC162FL,0x68CC162FL,(-8L)},{0xCD2B61FFL,(-8L),(-8L)}},{{(-8L),1L,2L},{0xCD2B61FFL,1L,0xCD2B61FFL},{0x68CC162FL,(-8L),2L},{0x68CC162FL,0x68CC162FL,(-8L)},{0xCD2B61FFL,(-8L),(-8L)},{(-8L),1L,2L},{0xCD2B61FFL,1L,0xCD2B61FFL},{0x68CC162FL,(-8L),2L},{0x68CC162FL,0x68CC162FL,(-8L)}},{{0xCD2B61FFL,(-8L),(-8L)},{(-8L),1L,2L},{0xCD2B61FFL,1L,0xCD2B61FFL},{0x68CC162FL,(-8L),2L},{0x68CC162FL,0x68CC162FL,(-8L)},{0xCD2B61FFL,(-8L),(-8L)},{(-8L),1L,2L},{0xCD2B61FFL,1L,0xCD2B61FFL},{0x68CC162FL,(-8L),2L}}};
int32_t l_1045 = 0xA45F0A35L;
int64_t *** const *l_1057 = &g_618;
int64_t *l_1062 = &g_177;
uint8_t l_1071 = 0x58L;
const uint32_t ****l_1148[8][10] = {{(void*)0,&g_842,&g_842,&g_842,(void*)0,&g_842,&g_842,&g_842,(void*)0,&g_842},{(void*)0,&g_842,(void*)0,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842},{&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842},{&g_842,&g_842,(void*)0,&g_842,&g_842,&g_842,(void*)0,&g_842,&g_842,&g_842},{(void*)0,(void*)0,&g_842,&g_842,&g_842,(void*)0,(void*)0,&g_842,&g_842,&g_842},{&g_842,(void*)0,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842,&g_842},{&g_842,(void*)0,(void*)0,&g_842,&g_842,&g_842,(void*)0,&g_842,&g_842,&g_842},{&g_842,(void*)0,&g_842,(void*)0,(void*)0,&g_842,(void*)0,(void*)0,&g_842,(void*)0}};
const uint32_t *****l_1147 = &l_1148[2][3];
uint32_t **l_1157 = &g_419;
uint64_t **l_1223 = (void*)0;
uint8_t l_1291 = 246UL;
const int32_t **l_1334 = &g_1272;
int i, j, k;
for (i = 0; i < 5; i++)
l_28[i] = (-9L);
for (p_3 = 19; (p_3 == 15); p_3 = safe_sub_func_uint16_t_u_u(p_3, 9))
{ /* block id: 4 */
int16_t l_57 = 0x1807L;
int32_t l_58[7] = {0xB3395CC9L,0xB3395CC9L,0xB3395CC9L,0xB3395CC9L,0xB3395CC9L,0xB3395CC9L,0xB3395CC9L};
int64_t l_240 = (-1L);
int32_t *l_602 = &g_13;
uint32_t l_1046 = 4294967290UL;
int64_t **l_1063 = &l_1062;
int64_t *l_1065[9][3][1] = {{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}},{{&l_240},{&l_240},{&l_240}}};
int64_t **l_1064 = &l_1065[7][2][0];
int64_t *l_1067 = (void*)0;
int64_t **l_1066 = &l_1067;
int8_t *l_1068 = &g_188[3][0];
int8_t *l_1069 = &g_1070[2][2];
int8_t l_1072 = 8L;
int64_t ****l_1073 = &g_623;
uint32_t l_1104 = 8UL;
uint64_t l_1133 = 0UL;
uint32_t *****l_1164 = &g_1146;
int32_t *l_1183 = (void*)0;
const int32_t *l_1229 = &g_167;
uint32_t l_1279[2];
int i, j, k;
for (i = 0; i < 2; i++)
l_1279[i] = 0x277C9C2CL;
for (g_8 = 0; (g_8 != 15); g_8++)
{ /* block id: 7 */
int16_t l_11[8][3][1] = {{{0x58F9L},{0x4DBBL},{0x58F9L}},{{8L},{0x4DBBL},{0L}},{{0xCE96L},{0x25B0L},{0x4DBBL}},{{9L},{0x25B0L},{9L}},{{0x4DBBL},{0x25B0L},{0xCE96L}},{{0xCE96L},{0x25B0L},{0x4DBBL}},{{9L},{0x25B0L},{9L}},{{0x4DBBL},{0x25B0L},{0xCE96L}}};
int32_t *l_239[8] = {&g_233[1],&g_85,&g_85,&g_233[1],&g_85,&g_85,&g_233[1],&g_85};
int64_t l_246 = 0x84B9C5F8BC2CC7AFLL;
const int32_t *l_247 = &g_8;
int64_t l_1042 = (-3L);
int i, j, k;
for (g_13 = 0; (g_13 >= 0); g_13 -= 1)
{ /* block id: 10 */
uint16_t *l_51 = &g_52;
uint16_t *l_59 = (void*)0;
uint16_t *l_60 = &g_61;
int32_t **l_238[2][3] = {{&g_183,&g_183,&g_183},{&g_183,&g_183,&g_183}};
int8_t *l_245 = &g_188[3][0];
int32_t l_289 = 0x77F44A9BL;
int64_t l_1043 = 0x7228DF719E9AD617LL;
int16_t l_1044 = 0xAFDEL;
int i, j;
}
}
}
for (p_3 = 0; (p_3 != 4); p_3 = safe_add_func_int32_t_s_s(p_3, 5))
{ /* block id: 474 */
int32_t l_1288[4][6] = {{0L,0L,0xF6E08DA6L,0L,0L,0L},{0x17D96A5FL,0L,0L,0x17D96A5FL,0xB40CE8B7L,0x17D96A5FL},{0x17D96A5FL,0xB40CE8B7L,0x17D96A5FL,0L,0L,0x17D96A5FL},{0L,0L,0L,0xF6E08DA6L,0L,0L}};
const uint32_t ** const *l_1301[7];
const uint32_t ** const **l_1300[9] = {&l_1301[3],&l_1301[3],&l_1301[3],&l_1301[3],&l_1301[3],&l_1301[3],&l_1301[3],&l_1301[3],&l_1301[3]};
uint16_t l_1302 = 65535UL;
const int32_t *l_1306 = &g_1307;
const int8_t l_1324 = 0x91L;
uint16_t **l_1327 = (void*)0;
int i, j;
for (i = 0; i < 7; i++)
l_1301[i] = &g_843;
if ((*g_132))
{ /* block id: 475 */
uint32_t l_1294[5] = {0xA3048314L,0xA3048314L,0xA3048314L,0xA3048314L,0xA3048314L};
uint32_t *** const *l_1295 = &g_872;
uint32_t *** const **l_1296 = &l_1295;
int32_t *l_1299 = &g_849[3][0];
int i;
(**g_131) = (safe_add_func_int8_t_s_s(0xA9L, (safe_mul_func_int8_t_s_s(l_1288[2][2], 0x40L))));
(**g_131) = ((safe_add_func_uint32_t_u_u(p_3, (((((((l_1291 , (((0x25B3L >= (safe_mod_func_uint32_t_u_u((l_1294[4] > (((*l_1296) = l_1295) != (((*l_1299) ^= ((g_1297 = &g_267) != (g_1298 , (void*)0))) , ((*g_768) , l_1300[7])))), 3UL))) <= l_1294[4]) < 0x99E51C81CB05CC9ALL)) ^ g_125) != p_3) != l_1294[2]) | g_177) < g_603) & p_3))) != l_1302);
return (**g_131);
}
else
{ /* block id: 482 */
const int32_t *l_1304 = &g_1305;
const int32_t **l_1303 = &l_1304;
int32_t *l_1319 = &g_13;
uint16_t *l_1323 = &g_1268[0][1][3].f1;
int32_t l_1325 = 1L;
int32_t *l_1326 = &g_167;
(*l_1326) ^= ((((*g_419) = (((void*)0 != (*g_1224)) < ((*g_464) == (l_1306 = ((*l_1303) = &g_849[5][0]))))) == ((safe_sub_func_int16_t_s_s((((safe_add_func_int8_t_s_s(((safe_div_func_uint32_t_u_u((+((safe_lshift_func_int8_t_s_u((~((safe_unary_minus_func_uint32_t_u((((((*l_1319) = l_28[3]) , 9UL) & ((safe_rshift_func_uint16_t_u_u(((*l_1323) = (~(l_1288[2][2] & l_1045))), (l_1302 ^ 0xB2EEDE3DL))) || 0xBA4BB36006D543A6LL)) != p_3))) & p_3)), 7)) > l_1324)), 0x49BFBE15L)) && l_1288[2][2]), l_1325)) < l_1302) || p_3), g_769.f0)) & g_1070[0][6])) , l_1288[2][2]);
l_1288[0][0] &= ((*l_1326) = p_3);
}
l_1327 = l_1327;
}
(*g_1335) = ((*l_1334) = (l_28[2] , ((safe_mul_func_int16_t_s_s((((safe_mul_func_int8_t_s_s(((5L == (*****g_1150)) ^ (safe_unary_minus_func_uint8_t_u(2UL))), l_1045)) < ((void*)0 != &l_1057)) ^ (~((*g_1297) >= ((l_1071 == 0x920218B8L) >= l_1041[0][4][0])))), 4UL)) , &l_1041[0][4][0])));
return (**g_131);
}
/* ------------------------------------------ */
/*
* reads : g_608 g_603 g_61
* writes: g_618 g_623 g_603 g_233 g_183
*/
static uint64_t func_14(uint32_t p_15, int32_t * p_16, int8_t p_17, int32_t * p_18, uint8_t p_19)
{ /* block id: 219 */
const uint32_t *l_606[7];
const uint32_t **l_605 = &l_606[2];
const uint32_t ***l_604 = &l_605;
int32_t l_607 = 0x1E7EFF91L;
int32_t **l_609 = &g_183;
int64_t *l_616 = (void*)0;
int64_t **l_615 = &l_616;
int64_t ***l_614 = &l_615;
int64_t ****l_617[9][10] = {{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0}};
int64_t ***l_622 = &l_615;
const int64_t l_624[2][2][9] = {{{0x13CC2DEC57822DB1LL,0x90A153BC88BFE7BDLL,8L,8L,0x90A153BC88BFE7BDLL,0x13CC2DEC57822DB1LL,0L,0x90A153BC88BFE7BDLL,0L},{(-1L),0L,0x44D2C27210B4DAB2LL,0x44D2C27210B4DAB2LL,0L,(-1L),(-3L),0L,(-3L)}},{{0x13CC2DEC57822DB1LL,0x90A153BC88BFE7BDLL,8L,8L,0x90A153BC88BFE7BDLL,0x13CC2DEC57822DB1LL,0L,0x90A153BC88BFE7BDLL,0L},{(-1L),0L,0x44D2C27210B4DAB2LL,0x44D2C27210B4DAB2LL,0x44D2C27210B4DAB2LL,0x82A0A6571AFBA164LL,1L,0x44D2C27210B4DAB2LL,1L}}};
uint64_t *l_625 = &g_603;
int32_t *l_626 = &g_233[6];
int16_t *l_631 = (void*)0;
int8_t l_636 = 0x74L;
int16_t l_644 = 0xEE57L;
uint32_t l_647 = 0x73AC1E6FL;
union U0 *l_680 = &g_681;
int8_t **l_704 = &g_321;
uint8_t l_720 = 0x33L;
int32_t l_727 = 0x5C95E7A7L;
int32_t l_729 = (-7L);
int32_t l_730 = 0x6E6CBF87L;
int32_t l_731 = 1L;
int32_t l_733 = 0x1175030CL;
int32_t l_734 = 7L;
int32_t l_735 = (-1L);
int32_t l_736 = (-1L);
int32_t l_738[2];
union U0 *l_809 = &g_810[2][0][3];
int i, j, k;
for (i = 0; i < 7; i++)
l_606[i] = &g_103;
for (i = 0; i < 2; i++)
l_738[i] = 0xEDD759CCL;
(*l_626) = (((*l_625) = (((void*)0 == l_604) <= (((l_607 > ((g_608 , &g_132) != l_609)) && (safe_mul_func_uint8_t_u_u((4L || ((g_618 = l_614) == (g_623 = ((safe_div_func_int32_t_s_s(((~p_17) && (-9L)), 1L)) , l_622)))), l_624[0][1][3]))) , 8L))) != 0x4661D7D39FCB48F1LL);
(*l_609) = p_18;
for (g_603 = (-10); (g_603 != 1); g_603 = safe_add_func_int64_t_s_s(g_603, 2))
{ /* block id: 228 */
int64_t l_654 = (-4L);
uint16_t l_669 = 5UL;
const int16_t l_690[4][3][1] = {{{(-10L)},{0xBBF3L},{(-10L)}},{{0xBBF3L},{(-10L)},{0xBBF3L}},{{(-10L)},{0xBBF3L},{(-10L)}},{{0xBBF3L},{(-10L)},{0xBBF3L}}};
int32_t l_725[7][5][6] = {{{(-2L),(-6L),0x805354F4L,(-4L),1L,(-2L)},{0x037C4C76L,0xE6350A33L,0L,0x02AC4ACEL,0xD0251063L,0x4471C11EL},{8L,0xCC4EE727L,0xD0251063L,1L,0x60BACAB8L,1L},{0L,0x956ADABFL,1L,0xA2F0B874L,2L,0xFB13A689L},{0xA405B12BL,0xD0251063L,0xAC1D1783L,0x805354F4L,0x9CE284FCL,(-5L)}},{{(-2L),0x37F2BB46L,0x02AC4ACEL,0x5A3CFD4EL,(-1L),0x9F23441FL},{(-4L),1L,0x74B36EA9L,0xFB13A689L,0xFB13A689L,0x74B36EA9L},{0x231DA2A1L,0x231DA2A1L,0x37F2BB46L,0x3284590BL,0xB38936C8L,8L},{0x43DDE1C2L,0x956ADABFL,0L,0x301CE74BL,0x7129BBD2L,0x37F2BB46L},{(-6L),0x43DDE1C2L,0L,0L,0x231DA2A1L,8L}},{{0xA99D34D6L,0L,0x37F2BB46L,0L,1L,0x74B36EA9L},{0L,1L,0x74B36EA9L,0x60BACAB8L,0xDF977407L,0x9F23441FL},{0x11777CCAL,(-1L),0x02AC4ACEL,0xE25A1610L,0xDE1BC1FEL,(-5L)},{0xDE1BC1FEL,0L,0xAC1D1783L,0x0A3C57D5L,(-1L),0xFB13A689L},{0x77DC637BL,2L,1L,0L,0L,1L}},{{(-1L),0x60BACAB8L,0xD0251063L,(-2L),(-9L),0x4471C11EL},{0x0ABEB540L,1L,0L,2L,0x43DDE1C2L,(-2L)},{0x231DA2A1L,0xD48D925AL,0x805354F4L,(-1L),0xDE1BC1FEL,(-6L)},{0x805354F4L,(-5L),3L,0xAC1D1783L,(-7L),(-1L)},{0x940E899CL,(-6L),0x36A6CE80L,0x805354F4L,(-1L),0x940E899CL}},{{0x037C4C76L,0L,0xDE1BC1FEL,1L,(-2L),0x4471C11EL},{0x07C66BFCL,(-1L),1L,0xB38936C8L,0x60BACAB8L,0xC1913867L},{8L,0x9CE284FCL,0xB38936C8L,0xA2F0B874L,0xB38936C8L,0x9CE284FCL},{0xDF977407L,(-2L),0xAC1D1783L,0x36A6CE80L,0x956ADABFL,0xDE1BC1FEL},{0x940E899CL,0x37F2BB46L,0xA2F0B874L,0x2A60463DL,(-6L),0xF682C8EDL}},{{(-4L),0x37F2BB46L,0x8E54D1B6L,1L,0x956ADABFL,0x74B36EA9L},{1L,(-2L),0xA99D34D6L,2L,0xB38936C8L,0x07C66BFCL},{0xCC4EE727L,0x9CE284FCL,0x59EE3DA5L,0x301CE74BL,0x60BACAB8L,0x77DC637BL},{(-1L),(-1L),0L,(-4L),(-2L),0x74B36EA9L},{0xDF977407L,0x74B36EA9L,(-7L),0xA99D34D6L,0x60BACAB8L,0x3165EE85L}},{{0x046A8C86L,0x466BBE49L,(-2L),0L,0x9CE284FCL,3L},{0xAC1D1783L,0x940E899CL,0x36A6CE80L,0xC1913867L,0xA99D34D6L,0x046A8C86L},{0x37F2BB46L,0xD0251063L,1L,1L,(-2L),0xB38936C8L},{0x037C4C76L,0xD48D925AL,(-1L),(-5L),0x0E7ED87EL,0x07C66BFCL},{6L,0xC1913867L,(-1L),1L,0x805354F4L,0x60BACAB8L}}};
union U0 *l_767 = &g_515[1];
int64_t ****l_790 = &g_623;
uint32_t ***l_868 = &g_418;
uint16_t l_904 = 0x9B02L;
uint32_t **l_905 = (void*)0;
int8_t ** const l_911 = &g_321;
uint64_t **l_1033 = &l_625;
uint64_t **l_1037 = &l_625;
uint32_t *l_1038 = &g_103;
int i, j, k;
}
return g_61;
}
/* ------------------------------------------ */
/*
* reads : g_167 g_133 g_52 g_183 g_177 g_188 g_231 g_321 g_8 g_29 g_13 g_132 g_131 g_233 g_345 g_85 g_61 g_223 g_224 g_225 g_103 g_125 g_416 g_417 g_418 g_419 g_66.f0 g_464 g_267 g_469.f1 g_7 g_465 g_515 g_345.f2 g_376
* writes: g_167 g_321 g_103 g_233 g_85 g_133 g_183 g_177 g_61 g_345.f2 g_376 g_416 g_29 g_267 g_345.f4 g_469.f1 g_125 g_52 g_132 g_188 g_231
*/
static uint32_t func_22(uint8_t p_23)
{ /* block id: 102 */
uint32_t l_296[9][6][4] = {{{18446744073709551615UL,0UL,18446744073709551615UL,0x5629B9E9L},{0xED499C85L,18446744073709551608UL,0x08C51EAAL,18446744073709551608UL},{0x67B80CB6L,1UL,18446744073709551615UL,18446744073709551608UL},{18446744073709551615UL,18446744073709551608UL,18446744073709551607UL,0x5629B9E9L},{0xBE05BE54L,0UL,0x08C51EAAL,0x07FDC041L},{0xBE05BE54L,1UL,18446744073709551607UL,0UL}},{{18446744073709551615UL,0x07FDC041L,18446744073709551615UL,0x5629B9E9L},{0x67B80CB6L,0x07FDC041L,0x08C51EAAL,0UL},{0xED499C85L,1UL,18446744073709551615UL,0x07FDC041L},{18446744073709551615UL,0UL,18446744073709551615UL,0x5629B9E9L},{0xED499C85L,18446744073709551608UL,0x08C51EAAL,18446744073709551608UL},{0x67B80CB6L,1UL,18446744073709551615UL,18446744073709551608UL}},{{18446744073709551615UL,18446744073709551608UL,18446744073709551607UL,0x5629B9E9L},{0xBE05BE54L,0UL,0x08C51EAAL,0x07FDC041L},{0xBE05BE54L,1UL,18446744073709551607UL,0UL},{18446744073709551615UL,0x07FDC041L,18446744073709551615UL,0x5629B9E9L},{0x67B80CB6L,0x07FDC041L,0x08C51EAAL,0UL},{0xED499C85L,1UL,18446744073709551615UL,0x07FDC041L}},{{18446744073709551615UL,0UL,18446744073709551615UL,0x5629B9E9L},{0xED499C85L,18446744073709551608UL,0x08C51EAAL,18446744073709551608UL},{0x67B80CB6L,1UL,18446744073709551615UL,18446744073709551608UL},{18446744073709551615UL,18446744073709551608UL,18446744073709551607UL,0x5629B9E9L},{0xBE05BE54L,0UL,0x08C51EAAL,0x07FDC041L},{0xBE05BE54L,1UL,18446744073709551607UL,0UL}},{{18446744073709551615UL,0x07FDC041L,18446744073709551615UL,0x5629B9E9L},{0x67B80CB6L,0x07FDC041L,0x08C51EAAL,0UL},{0xED499C85L,1UL,18446744073709551615UL,0x07FDC041L},{18446744073709551615UL,0UL,18446744073709551615UL,0x5629B9E9L},{0xED499C85L,18446744073709551608UL,0x08C51EAAL,18446744073709551608UL},{0x67B80CB6L,1UL,18446744073709551615UL,18446744073709551608UL}},{{18446744073709551615UL,18446744073709551608UL,18446744073709551607UL,0x5629B9E9L},{0xBE05BE54L,0UL,0x08C51EAAL,0x07FDC041L},{0xBE05BE54L,1UL,18446744073709551607UL,0UL},{18446744073709551615UL,0x07FDC041L,18446744073709551615UL,0x5629B9E9L},{0x67B80CB6L,0x07FDC041L,0x08C51EAAL,0UL},{0xED499C85L,1UL,18446744073709551615UL,0x07FDC041L}},{{18446744073709551615UL,0UL,18446744073709551615UL,0x5629B9E9L},{0xED499C85L,18446744073709551608UL,0x08C51EAAL,18446744073709551608UL},{0x67B80CB6L,1UL,1UL,0x5629B9E9L},{1UL,0x5629B9E9L,18446744073709551615UL,0xEDE82F0FL},{18446744073709551615UL,0UL,0xBE05BE54L,1UL},{18446744073709551615UL,18446744073709551606UL,18446744073709551615UL,0UL}},{{1UL,1UL,1UL,0xEDE82F0FL},{18446744073709551607UL,1UL,0xBE05BE54L,0UL},{18446744073709551615UL,18446744073709551606UL,0x08C51EAAL,1UL},{1UL,0UL,0x08C51EAAL,0xEDE82F0FL},{18446744073709551615UL,0x5629B9E9L,0xBE05BE54L,0x5629B9E9L},{18446744073709551607UL,18446744073709551606UL,1UL,0x5629B9E9L}},{{1UL,0x5629B9E9L,18446744073709551615UL,0xEDE82F0FL},{18446744073709551615UL,0UL,0xBE05BE54L,1UL},{18446744073709551615UL,18446744073709551606UL,18446744073709551615UL,0UL},{1UL,1UL,1UL,0xEDE82F0FL},{18446744073709551607UL,1UL,0xBE05BE54L,0UL},{18446744073709551615UL,18446744073709551606UL,0x08C51EAAL,1UL}}};
int32_t l_301 = 0x076C89BEL;
int32_t *l_310 = (void*)0;
int8_t **l_346 = (void*)0;
uint8_t l_400 = 255UL;
int32_t l_432[3];
uint16_t l_507 = 4UL;
uint32_t l_570 = 1UL;
uint32_t l_594[2];
const uint8_t l_600[8] = {0x9DL,0xBAL,0x9DL,0xBAL,0x9DL,0xBAL,0x9DL,0xBAL};
int i, j, k;
for (i = 0; i < 3; i++)
l_432[i] = (-1L);
for (i = 0; i < 2; i++)
l_594[i] = 4294967295UL;
for (g_167 = (-6); (g_167 > 23); g_167 = safe_add_func_int8_t_s_s(g_167, 4))
{ /* block id: 105 */
int32_t *l_292 = &g_85;
int32_t *l_293 = &g_233[6];
int32_t *l_294 = (void*)0;
int32_t *l_295 = &g_233[6];
int32_t **l_311 = (void*)0;
int32_t **l_312 = &l_310;
int8_t **l_317 = (void*)0;
int8_t **l_318 = (void*)0;
int8_t *l_320 = &g_188[3][0];
int8_t **l_319[4];
const int64_t * const l_324 = &g_177;
uint32_t *l_347 = &g_103;
int64_t *l_348 = &g_177;
uint32_t l_349[10] = {9UL,18446744073709551610UL,0xD0582092L,18446744073709551610UL,9UL,9UL,18446744073709551610UL,0xD0582092L,18446744073709551610UL,9UL};
int i;
for (i = 0; i < 4; i++)
l_319[i] = &l_320;
l_296[6][1][3]++;
g_183 = func_45(((((9L == g_133) & ((*l_292) = ((*l_295) = ((l_301 = (safe_sub_func_int8_t_s_s(g_52, 249UL))) , (safe_mod_func_uint32_t_u_u(((safe_mul_func_int8_t_s_s(((safe_mod_func_uint64_t_u_u(((safe_add_func_uint64_t_u_u(((((*l_312) = l_310) == g_183) <= 0x6CFA103EE57E1535LL), (safe_sub_func_int64_t_s_s(((safe_mul_func_int16_t_s_s(((((g_321 = &g_188[2][0]) != ((g_103 = (safe_div_func_int8_t_s_s((((&g_177 == l_324) < 7L) , p_23), (-1L)))) , &g_188[1][0])) | 0x250765B23B538690LL) != g_177), g_188[6][0])) , g_231), (-7L))))) <= g_188[3][0]), 6UL)) , (*g_321)), l_296[6][1][2])) > 0L), 0x1339926BL)))))) && g_52) < g_8), g_29, p_23, p_23, g_13);
l_349[7] |= ((safe_mul_func_int64_t_s_s(0x83EAFCF35AF17E0BLL, ((safe_rshift_func_uint16_t_u_s(((*l_293) >= (safe_lshift_func_uint16_t_u_u((l_301 <= (((safe_mul_func_uint16_t_u_u(0xCE14L, (safe_div_func_uint64_t_u_u((((safe_mod_func_uint32_t_u_u((((*l_348) ^= (~(!(safe_mod_func_uint32_t_u_u(((*l_347) = (safe_div_func_int32_t_s_s(((*l_292) = ((g_52 , p_23) , (safe_mul_func_int16_t_s_s(((0x95C3L | ((g_345 , l_346) == (void*)0)) == g_233[6]), g_167)))), 0x0A20FC24L))), 5L))))) , g_177), 5UL)) && (-3L)) && g_231), p_23)))) ^ (*l_295)) > 0x4AE886E2DF8891E8LL)), 4))), 12)) < 3UL))) , (*l_292));
}
for (g_61 = 1; (g_61 <= 7); g_61 += 1)
{ /* block id: 121 */
int32_t l_378 = 0x0B9359FEL;
int32_t l_431 = 0x6B767B89L;
int32_t l_433 = 0xA6920E21L;
int32_t l_434 = (-1L);
int32_t **l_463 = (void*)0;
uint16_t l_477 = 1UL;
uint32_t *** const l_494 = &g_418;
uint64_t *l_566 = &g_267;
int32_t l_591 = 1L;
int32_t l_593 = (-1L);
int32_t *l_598 = (void*)0;
uint64_t l_601 = 0x54CD0C41B48068CCLL;
int i;
if (g_233[g_61])
{ /* block id: 122 */
int32_t l_374 = 0xA37F8D69L;
int16_t *l_375 = &g_345.f2;
int8_t *l_377[6][2] = {{&g_188[2][0],&g_188[3][0]},{&g_188[3][0],&g_188[2][0]},{&g_188[3][0],&g_188[3][0]},{&g_188[2][0],&g_188[3][0]},{&g_188[3][0],&g_188[2][0]},{&g_188[3][0],&g_188[3][0]}};
int32_t **l_404[9][2][7] = {{{&g_183,&g_183,(void*)0,&g_183,&g_183,(void*)0,&g_183},{&g_183,&g_183,&g_183,&g_183,&g_183,&g_183,&g_183}},{{&g_183,&g_183,&g_183,(void*)0,&g_183,&g_183,&g_183},{&g_183,&g_183,&g_183,&g_183,&g_183,&g_183,&g_183}},{{(void*)0,&g_183,&g_183,&g_183,&g_183,(void*)0,&g_183},{(void*)0,(void*)0,(void*)0,&g_183,&g_183,&g_183,&g_183}},{{&g_183,&g_183,&g_183,&g_183,&g_183,(void*)0,(void*)0},{&g_183,&g_183,&g_183,(void*)0,&g_183,&g_183,(void*)0}},{{(void*)0,(void*)0,&g_183,&g_183,(void*)0,(void*)0,&g_183},{(void*)0,&g_183,&g_183,&g_183,(void*)0,&g_183,&g_183}},{{&g_183,(void*)0,(void*)0,(void*)0,&g_183,(void*)0,(void*)0},{&g_183,&g_183,&g_183,&g_183,&g_183,&g_183,(void*)0}},{{&g_183,(void*)0,&g_183,&g_183,(void*)0,&g_183,&g_183},{&g_183,&g_183,&g_183,&g_183,&g_183,&g_183,&g_183}},{{&g_183,(void*)0,&g_183,&g_183,&g_183,&g_183,&g_183},{&g_183,(void*)0,(void*)0,&g_183,&g_183,(void*)0,(void*)0}},{{&g_183,&g_183,(void*)0,&g_183,&g_183,(void*)0,&g_183},{&g_183,&g_183,(void*)0,&g_183,(void*)0,&g_183,(void*)0}}};
int i, j, k;
if (((**g_223) >= ((((((safe_mul_func_int16_t_s_s((safe_lshift_func_int8_t_s_u((g_233[g_61] = (g_376 = ((l_301 = (safe_add_func_int32_t_s_s(((!65535UL) , ((((safe_div_func_int16_t_s_s(((*l_375) = (((+p_23) , (safe_sub_func_int8_t_s_s(((safe_sub_func_int64_t_s_s((safe_mul_func_int16_t_s_s(((((-5L) < ((safe_mul_func_uint8_t_u_u((((safe_div_func_uint64_t_u_u(g_103, 9L)) || g_85) , (((safe_rshift_func_int8_t_s_s((safe_lshift_func_uint8_t_u_u(((l_301 && g_8) || g_233[g_61]), 0)), 6)) , l_374) , 0x99L)), p_23)) != 18446744073709551615UL)) | 0x07E7360DF409EA00LL) > g_233[g_61]), l_296[6][1][3])), 0x34024CB0C6D8FC74LL)) & (-7L)), 0xBCL))) == g_29)), p_23)) <= p_23) != 9UL) & g_177)), 0x2BF8CB43L))) && l_301))), g_188[0][0])), l_378)) || l_296[1][4][2]) , (void*)0) == &g_267) & 7L) < l_296[6][1][3])))
{ /* block id: 127 */
uint8_t l_399[6];
int i;
for (i = 0; i < 6; i++)
l_399[i] = 8UL;
(**g_131) ^= (safe_add_func_int8_t_s_s((+(((1UL & (((0x02L | p_23) , (safe_lshift_func_uint16_t_u_u(((safe_mod_func_int64_t_s_s((!0x35L), p_23)) != p_23), (safe_add_func_uint64_t_u_u(((safe_add_func_uint64_t_u_u((safe_sub_func_int8_t_s_s((g_125 == (safe_lshift_func_int16_t_s_u(((*l_375) = (safe_mod_func_int64_t_s_s((((18446744073709551607UL < (p_23 , 0x922EA5CE5B989AAFLL)) ^ p_23) != 0xEC12L), l_374))), g_233[3]))), l_399[5])), p_23)) == p_23), l_400))))) <= 254UL)) <= g_8) & l_399[5])), p_23));
}
else
{ /* block id: 130 */
uint32_t l_420 = 4294967288UL;
int32_t l_435 = (-9L);
for (l_374 = 0; (l_374 <= 3); l_374 += 1)
{ /* block id: 133 */
const int32_t l_403 = 0x127DB236L;
int32_t l_408[1];
int i;
for (i = 0; i < 1; i++)
l_408[i] = 2L;
if ((p_23 , ((&g_183 == ((safe_lshift_func_int16_t_s_s(g_133, (l_403 , 0xA008L))) , l_404[4][1][6])) | (1UL >= (((((+(l_408[0] |= l_403)) && (((((safe_mul_func_uint8_t_u_u((safe_mul_func_int16_t_s_s(((((safe_mod_func_uint64_t_u_u((!(p_23 || g_416)), p_23)) , g_417) == (void*)0) == p_23), l_378)), l_403)) <= l_378) <= p_23) , 0UL) & g_177)) == g_29) && l_420) > 0x07E1L)))))
{ /* block id: 135 */
uint32_t l_436[4][5][5] = {{{0xA1B3EB41L,0UL,0x27A8972BL,0UL,0xA1B3EB41L},{4294967287UL,0xF356C055L,0xF356C055L,4294967287UL,0x8CAB490EL},{0x99EE653AL,0UL,0x99EE653AL,1UL,0x99EE653AL},{4294967287UL,4294967287UL,1UL,0xF356C055L,0x8CAB490EL},{0xA1B3EB41L,1UL,0x27A8972BL,1UL,0xA1B3EB41L}},{{0x8CAB490EL,0xF356C055L,1UL,4294967287UL,4294967287UL},{0x99EE653AL,1UL,0x99EE653AL,0UL,0x99EE653AL},{0x8CAB490EL,4294967287UL,0xF356C055L,0xF356C055L,4294967287UL},{0xA1B3EB41L,0UL,0x27A8972BL,0UL,0xA1B3EB41L},{4294967287UL,0xF356C055L,0xF356C055L,4294967287UL,0x8CAB490EL}},{{0x99EE653AL,0UL,0x99EE653AL,1UL,0x99EE653AL},{4294967287UL,4294967287UL,1UL,0xF356C055L,0x8CAB490EL},{0xA1B3EB41L,1UL,0x27A8972BL,1UL,0xA1B3EB41L},{0x8CAB490EL,0xF356C055L,1UL,4294967287UL,4294967287UL},{0x99EE653AL,1UL,0x99EE653AL,0UL,0x99EE653AL}},{{0x8CAB490EL,4294967287UL,0xF356C055L,0xF356C055L,4294967287UL},{0xA1B3EB41L,0UL,0x27A8972BL,0UL,0xA1B3EB41L},{4294967287UL,0xF356C055L,0xF356C055L,4294967287UL,0x8CAB490EL},{0x99EE653AL,0UL,0x99EE653AL,1UL,0x99EE653AL},{4294967287UL,4294967287UL,1UL,0xF356C055L,0x8CAB490EL}}};
int i, j, k;
if (p_23)
break;
l_408[0] |= ((**g_131) >= (safe_add_func_int64_t_s_s(p_23, (0x8D6CL | (safe_mod_func_uint8_t_u_u(p_23, (safe_rshift_func_uint16_t_u_u((p_23 < (safe_mod_func_int32_t_s_s(0x13D3453FL, ((**g_418)++)))), 13))))))));
l_436[3][4][1]--;
}
else
{ /* block id: 140 */
uint64_t *l_441[6] = {(void*)0,(void*)0,&g_267,(void*)0,(void*)0,&g_267};
uint8_t *l_453 = &g_29;
int32_t l_460 = 0xA52725B3L;
int32_t l_467 = 0xC8D591B4L;
int i;
l_467 ^= ((0UL < (safe_lshift_func_uint8_t_u_s(((l_432[2] = g_66.f0) < (safe_sub_func_int8_t_s_s((l_434 = (!(((g_125 || ((safe_rshift_func_int8_t_s_u((safe_mod_func_uint64_t_u_u((safe_div_func_uint64_t_u_u((++g_416), g_188[2][0])), l_433)), 3)) <= (((((*l_453) = 252UL) == ((safe_div_func_int64_t_s_s((((safe_rshift_func_uint16_t_u_s(((*g_419) <= ((((safe_mul_func_uint8_t_u_u((l_460 != (l_435 &= ((safe_add_func_int64_t_s_s((-1L), 0x854F1E06719EA2F4LL)) && l_420))), p_23)) & l_420) < 0x73AF1AFBL) <= 0xD1L)), 3)) < p_23) >= 0UL), p_23)) , (-5L))) , 7L) | g_188[7][0]))) , l_463) != g_464))), g_231))), p_23))) | p_23);
return (***g_417);
}
for (g_267 = 0; (g_267 <= 3); g_267 += 1)
{ /* block id: 151 */
union U0 *l_468 = &g_469;
int i, j, k;
l_468 = (l_296[l_374][g_267][g_267] , &g_345);
if (p_23)
break;
}
(**g_131) = (((((&g_52 == (void*)0) || (0x0DL != ((~((safe_mul_func_uint8_t_u_u((safe_mod_func_uint32_t_u_u((*g_419), (((l_477 || ((safe_add_func_uint8_t_u_u((safe_add_func_int32_t_s_s((((safe_sub_func_int64_t_s_s((((1UL & 0x3987274B98C5EABFLL) , (l_435 = (l_433 = (p_23 || ((**g_223) <= g_177))))) >= p_23), g_233[g_61])) , 0x14C4D434L) , p_23), l_420)), 0x12L)) | l_420)) <= g_231) & 6UL))), l_420)) || 0x65L)) ^ p_23))) || g_125) , (-1L)) | l_420);
for (g_345.f4 = 0; (g_345.f4 > 20); ++g_345.f4)
{ /* block id: 160 */
return (*g_419);
}
}
return l_432[2];
}
l_432[2] &= (safe_mul_func_int8_t_s_s(0x12L, (((safe_sub_func_int16_t_s_s(((safe_div_func_int32_t_s_s((g_167 = (safe_lshift_func_int8_t_s_s(g_267, g_416))), ((((*g_132) ^ p_23) , 1L) ^ ((l_378 = p_23) , ((((void*)0 != l_494) & p_23) || p_23))))) , (-9L)), 0UL)) , 0x5B04E45F982F0DBELL) > p_23)));
}
else
{ /* block id: 169 */
int32_t **l_495 = &g_183;
int32_t * const l_505 = (void*)0;
int32_t l_532 = 5L;
for (g_469.f1 = 0; (g_469.f1 <= 0); g_469.f1 += 1)
{ /* block id: 172 */
int32_t *l_506 = (void*)0;
uint8_t *l_508 = &g_29;
int i, j;
(*l_495) = func_97(g_188[(g_469.f1 + 7)][g_469.f1], ((*g_419) = l_432[2]), l_495);
(*g_183) = (safe_add_func_uint8_t_u_u(((*l_508) = (((p_23 , g_7) == (safe_rshift_func_int16_t_s_s(0xDAD0L, (safe_mul_func_int8_t_s_s((safe_mul_func_int8_t_s_s(((safe_unary_minus_func_uint64_t_u(p_23)) == l_400), (((p_23 , l_505) == (void*)0) < ((((*g_464) == l_506) , p_23) >= (**l_495))))), 1L))))) , l_507)), (-3L)));
for (g_167 = 0; (g_167 <= 3); g_167 += 1)
{ /* block id: 179 */
uint16_t *l_531 = &g_125;
int i, j, k;
(*g_183) ^= ((((safe_sub_func_int8_t_s_s(l_296[g_61][g_469.f1][g_167], ((safe_mod_func_int64_t_s_s(l_296[(g_469.f1 + 4)][(g_167 + 1)][g_167], (((g_515[0] , (!(-3L))) < ((+p_23) < (((safe_rshift_func_int16_t_s_s((((*l_531) = (((safe_mod_func_uint64_t_u_u((safe_rshift_func_int8_t_s_s((safe_add_func_uint16_t_u_u((((safe_rshift_func_int8_t_s_u(0L, (!p_23))) > (safe_div_func_uint16_t_u_u((4L | g_8), l_296[(g_469.f1 + 4)][(g_167 + 1)][g_167]))) == 0L), 0x2E25L)), l_296[g_61][g_469.f1][g_167])), g_233[3])) <= p_23) , g_233[6])) , (-6L)), l_532)) | p_23) < (-9L)))) & g_52))) && 0x72D1F8BF4BCD085BLL))) >= l_296[(g_469.f1 + 4)][(g_167 + 1)][g_167]) , &l_532) == (void*)0);
}
for (g_52 = 0; (g_52 <= 7); g_52 += 1)
{ /* block id: 185 */
(*g_131) = (*g_131);
if (p_23)
break;
(*g_131) = (*g_131);
}
}
}
for (g_345.f2 = 0; (g_345.f2 <= 3); g_345.f2 += 1)
{ /* block id: 194 */
int8_t l_535 = 1L;
int8_t *l_536 = (void*)0;
int8_t *l_537 = &g_188[3][0];
uint8_t l_568 = 0x34L;
uint32_t l_572 = 0x2A4E8ABCL;
int32_t l_584 = (-4L);
int32_t l_586 = (-1L);
int32_t l_589 = (-1L);
int32_t l_590 = 0x04BFDDC9L;
int32_t l_592 = 0x2FFEEB47L;
if ((safe_div_func_int8_t_s_s(((*l_537) ^= l_535), p_23)))
{ /* block id: 196 */
int32_t l_540[8] = {0x30A02638L,0x30A02638L,0x30A02638L,0x30A02638L,0x30A02638L,0x30A02638L,0x30A02638L,0x30A02638L};
uint32_t **l_555 = &g_419;
uint64_t **l_567 = &l_566;
uint16_t *l_569[2];
int16_t *l_571 = (void*)0;
int32_t *l_579 = &l_433;
int32_t *l_580 = &g_85;
int32_t *l_581 = &l_540[1];
int32_t *l_582 = &l_432[2];
int32_t *l_583 = &g_233[g_61];
int32_t *l_585 = &g_233[g_61];
int32_t *l_587 = &g_233[4];
int32_t *l_588[7][8] = {{&l_586,(void*)0,&l_586,&l_586,(void*)0,&l_586,&l_586,(void*)0},{(void*)0,&l_586,&l_586,(void*)0,&l_586,&l_586,(void*)0,&l_586},{(void*)0,(void*)0,&g_8,(void*)0,(void*)0,&g_8,(void*)0,(void*)0},{&l_586,(void*)0,&l_586,&l_586,(void*)0,&l_586,&l_586,(void*)0},{(void*)0,&l_586,&l_586,(void*)0,&l_586,&l_586,(void*)0,&l_586},{(void*)0,(void*)0,&g_8,(void*)0,(void*)0,&g_8,(void*)0,(void*)0},{&l_586,&l_586,&g_8,&g_8,&l_586,&g_8,&g_8,&l_586}};
int i, j;
for (i = 0; i < 2; i++)
l_569[i] = &l_477;
if (p_23)
break;
(*g_131) = (((g_231 = (safe_mul_func_uint16_t_u_u(l_540[3], ((safe_sub_func_uint32_t_u_u(((((safe_div_func_int8_t_s_s((safe_lshift_func_uint16_t_u_s(l_540[3], 11)), (((safe_lshift_func_uint8_t_u_s((safe_lshift_func_uint8_t_u_s(l_535, 0)), 0)) || (((safe_lshift_func_uint8_t_u_u(((l_555 != l_555) || (((((*g_132) >= 0L) != (safe_sub_func_int32_t_s_s((safe_rshift_func_uint16_t_u_s((l_570 = (safe_mod_func_int32_t_s_s(((safe_lshift_func_uint16_t_u_s(((((((*l_567) = l_566) != (void*)0) , (*g_419)) == l_568) <= p_23), 2)) >= 4L), l_535))), 7)), p_23))) >= p_23) == 0x4A5FECDD40C54AD1LL)), l_378)) , p_23) , p_23)) , g_188[3][0]))) , p_23) || 0x02L) < 0x2D2EL), l_540[3])) == p_23)))) >= g_103) , (void*)0);
(*l_579) = (l_572 && (0x4C014865928F16A8LL > (safe_lshift_func_uint8_t_u_s(((safe_add_func_uint32_t_u_u(((safe_sub_func_uint64_t_u_u(((&g_416 != &g_416) , ((&g_224[0] != (void*)0) | (p_23 > (-1L)))), (((void*)0 == &g_183) == l_568))) < p_23), p_23)) , g_376), 4))));
++l_594[0];
}
else
{ /* block id: 204 */
for (l_586 = 0; (l_586 <= 3); l_586 += 1)
{ /* block id: 207 */
int32_t **l_597 = &g_183;
volatile int32_t **l_599[1][4][10] = {{{&g_465,&g_465,(void*)0,(void*)0,(void*)0,&g_465,&g_465,&g_465,&g_465,(void*)0},{&g_465,(void*)0,(void*)0,&g_465,&g_465,&g_465,(void*)0,&g_465,&g_465,&g_465},{&g_465,&g_465,&g_465,&g_465,&g_465,(void*)0,(void*)0,(void*)0,&g_465,&g_465},{&g_465,&g_465,&g_465,&g_465,&g_465,&g_465,&g_465,(void*)0,&g_465,&g_465}}};
int i, j, k;
l_598 = ((*l_597) = (void*)0);
l_599[0][0][3] = &g_465;
l_432[0] = l_296[(g_345.f2 + 3)][g_345.f2][l_586];
}
(**g_131) ^= l_600[2];
}
return l_601;
}
}
return p_23;
}
/* ------------------------------------------ */
/*
* reads : g_8 g_177 g_225 g_125 g_233 g_267 g_52 g_131 g_132
* writes: g_177 g_231 g_267 g_133
*/
static int8_t func_34(uint64_t p_35, const int32_t * p_36, const int32_t p_37)
{ /* block id: 95 */
int64_t *l_250[1][6][3] = {{{&g_177,&g_177,&g_177},{(void*)0,(void*)0,(void*)0},{&g_177,&g_177,&g_177},{(void*)0,(void*)0,(void*)0},{&g_177,&g_177,&g_177},{(void*)0,(void*)0,(void*)0}}};
int32_t l_262 = (-1L);
int16_t *l_265 = &g_231;
uint64_t *l_266 = &g_267;
int32_t *l_268 = &g_233[6];
int32_t *l_269 = &g_233[1];
int32_t *l_270 = (void*)0;
int32_t l_271 = 0x56B58E44L;
int32_t *l_272 = (void*)0;
int32_t l_273 = 0xB70EFD0CL;
int32_t *l_274 = &l_262;
int32_t l_275 = (-1L);
int32_t *l_276 = (void*)0;
int32_t *l_277 = &g_167;
int32_t l_278 = 0xE576FCFDL;
int32_t *l_279 = &l_278;
int32_t *l_280 = &l_275;
int32_t *l_281 = &g_85;
int32_t *l_282 = &g_233[3];
int32_t *l_283 = &l_262;
int32_t *l_284 = &g_167;
int32_t *l_285[6] = {(void*)0,&l_262,(void*)0,(void*)0,&l_262,(void*)0};
uint8_t l_286 = 0x19L;
int i, j, k;
(**g_131) = (((safe_sub_func_uint64_t_u_u(g_8, p_35)) , ((g_177 |= (p_37 >= 0x268F25B8A72973F1LL)) <= (((*l_266) &= (safe_unary_minus_func_int64_t_s((safe_sub_func_int16_t_s_s(((*l_265) = (safe_mod_func_uint32_t_u_u(((g_225 == (safe_rshift_func_uint16_t_u_s((safe_mul_func_int8_t_s_s((safe_lshift_func_int16_t_s_s((l_262 == (((g_125 <= ((((safe_rshift_func_uint16_t_u_u(l_262, 2)) & ((void*)0 != &l_250[0][1][1])) <= l_262) < l_262)) , (-3L)) && p_35)), 3)), 0x34L)), 9))) && p_37), l_262))), g_233[6]))))) <= (-10L)))) < g_52);
++l_286;
return g_8;
}
/* ------------------------------------------ */
/*
* reads : g_177 g_233
* writes: g_177 g_233 g_183
*/
static int16_t func_41(int32_t * p_42, const uint16_t p_43, uint8_t p_44)
{ /* block id: 86 */
int32_t *l_243 = &g_13;
for (g_177 = (-14); (g_177 > 19); ++g_177)
{ /* block id: 89 */
int32_t **l_244 = &g_183;
(*p_42) = (*p_42);
(*l_244) = l_243;
}
return p_43;
}
/* ------------------------------------------ */
/*
* reads : g_132 g_133 g_131
* writes: g_133
*/
static int32_t * func_45(uint16_t p_46, uint16_t p_47, int32_t p_48, uint16_t p_49, uint32_t p_50)
{ /* block id: 15 */
uint16_t l_62[9];
int32_t * const l_71 = &g_8;
int32_t * const *l_70 = &l_71;
int32_t l_237 = 0xBA409152L;
int i;
for (i = 0; i < 9; i++)
l_62[i] = 0x3964L;
for (p_47 = 0; (p_47 <= 8); p_47 += 1)
{ /* block id: 18 */
int32_t * const l_63 = (void*)0;
int32_t *l_65[9][1][4] = {{{&g_13,&g_8,(void*)0,&g_8}},{{&g_13,&g_13,&g_8,(void*)0}},{{&g_8,&g_13,&g_13,&g_8}},{{&g_13,&g_8,&g_13,&g_13}},{{&g_13,&g_13,&g_13,&g_8}},{{&g_8,&g_13,&g_8,&g_8}},{{&g_13,&g_13,(void*)0,&g_13}},{{&g_13,&g_8,(void*)0,&g_8}},{{&g_13,&g_13,&g_8,(void*)0}}};
int32_t **l_64 = &l_65[2][0][2];
const uint16_t *l_236 = (void*)0;
int i, j, k;
(*l_64) = l_63;
}
(**g_131) = (*g_132);
return &g_233[6];
}
/* ------------------------------------------ */
/*
* reads : g_7
* writes:
*/
static int8_t func_67(int32_t * p_68, int32_t * const * p_69)
{ /* block id: 20 */
return g_7;
}
/* ------------------------------------------ */
/*
* reads : g_8 g_85 g_103 g_52 g_61 g_125 g_131 g_13 g_167 g_177 g_183 g_188 g_223
* writes: g_85 g_61 g_103 g_125 g_167 g_177 g_183 g_231 g_233
*/
static uint16_t * func_74(uint32_t p_75, int32_t p_76, uint32_t p_77, const int16_t p_78, int32_t p_79)
{ /* block id: 22 */
int32_t l_90 = (-8L);
int32_t **l_134 = (void*)0;
int32_t l_179 = 0x8ECCF47AL;
const int64_t *l_194 = (void*)0;
uint32_t *l_212 = &g_103;
uint32_t **l_211 = &l_212;
uint16_t *l_235 = (void*)0;
for (p_75 = (-4); (p_75 < 17); ++p_75)
{ /* block id: 25 */
int32_t *l_84[9][7][1] = {{{&g_13},{&g_8},{&g_13},{&g_8},{&g_13},{&g_85},{&g_8}},{{&g_8},{&g_85},{&g_13},{&g_85},{&g_85},{&g_8},{(void*)0}},{{&g_8},{&g_13},{&g_8},{&g_13},{&g_13},{&g_8},{&g_13}},{{&g_8},{(void*)0},{&g_8},{&g_85},{&g_85},{&g_13},{&g_85}},{{&g_8},{&g_8},{&g_85},{&g_13},{&g_8},{&g_13},{&g_8}},{{&g_13},{&g_85},{&g_8},{&g_8},{&g_85},{&g_13},{&g_85}},{{&g_85},{&g_8},{(void*)0},{&g_8},{&g_13},{&g_8},{&g_13}},{{&g_13},{&g_8},{&g_13},{&g_8},{(void*)0},{&g_8},{&g_85}},{{&g_85},{&g_13},{&g_85},{&g_8},{&g_8},{&g_85},{&g_13}}};
uint32_t l_164[3][4] = {{0x350B5FE4L,0x350B5FE4L,0x350B5FE4L,0x350B5FE4L},{0x350B5FE4L,0x350B5FE4L,0x350B5FE4L,0x350B5FE4L},{0x350B5FE4L,0x350B5FE4L,0x350B5FE4L,0x350B5FE4L}};
int16_t l_234[7][7][2] = {{{(-1L),0L},{(-10L),(-1L)},{(-10L),0L},{(-1L),(-10L)},{0L,0xADF1L},{(-1L),(-1L)},{7L,(-1L)}},{{(-1L),0xADF1L},{(-1L),0xE0D8L},{7L,(-1L)},{0xE0D8L,0xADF1L},{0xE0D8L,(-1L)},{7L,0xE0D8L},{(-1L),0xADF1L}},{{(-1L),(-1L)},{7L,(-1L)},{(-1L),0xADF1L},{(-1L),0xE0D8L},{7L,(-1L)},{0xE0D8L,0xADF1L},{0xE0D8L,(-1L)}},{{7L,0xE0D8L},{(-1L),0xADF1L},{(-1L),(-1L)},{7L,(-1L)},{(-1L),0xADF1L},{(-1L),0xE0D8L},{7L,(-1L)}},{{0xE0D8L,0xADF1L},{0xE0D8L,(-1L)},{7L,0xE0D8L},{(-1L),0xADF1L},{(-1L),(-1L)},{7L,(-1L)},{(-1L),0xADF1L}},{{(-1L),0xE0D8L},{7L,(-1L)},{0xE0D8L,0xADF1L},{0xE0D8L,(-1L)},{7L,0xE0D8L},{(-1L),0xADF1L},{(-1L),(-1L)}},{{7L,(-1L)},{(-1L),0xADF1L},{(-1L),0xE0D8L},{7L,(-1L)},{0xE0D8L,0xADF1L},{0xE0D8L,(-1L)},{7L,0xE0D8L}}};
int i, j, k;
g_85 ^= g_8;
if (g_8)
continue;
for (g_61 = 0; (g_61 >= 36); g_61 = safe_add_func_int16_t_s_s(g_61, 6))
{ /* block id: 30 */
uint32_t l_101[4][5] = {{0xB10F657DL,2UL,2UL,0xB10F657DL,18446744073709551614UL},{18446744073709551615UL,0x2577C8A6L,0x2577C8A6L,18446744073709551615UL,0x8D9E2CD2L},{0xB10F657DL,2UL,2UL,0xB10F657DL,18446744073709551614UL},{18446744073709551615UL,0x2577C8A6L,0x2577C8A6L,18446744073709551615UL,0x8D9E2CD2L}};
uint32_t *l_102[7] = {&g_103,&g_103,&g_103,&g_103,&g_103,&g_103,&g_103};
int32_t **l_106 = &l_84[2][5][0];
uint16_t *l_130 = (void*)0;
int32_t l_189 = 0xE7F336F0L;
uint32_t ***l_213 = &l_211;
int64_t *l_222 = &g_177;
int64_t **l_221 = &l_222;
int64_t ***l_220 = &l_221;
int16_t *l_230 = &g_231;
uint8_t *l_232[1][3];
int i, j;
for (i = 0; i < 1; i++)
{
for (j = 0; j < 3; j++)
l_232[i][j] = (void*)0;
}
if (((safe_lshift_func_uint8_t_u_u(l_90, 1)) == (safe_rshift_func_uint8_t_u_u((safe_rshift_func_int16_t_s_s(0L, (safe_add_func_int32_t_s_s((((*l_106) = func_97(l_101[2][2], (g_103++), l_106)) != (void*)0), (g_52 && (((g_61 <= ((((((((safe_lshift_func_int8_t_s_u((g_52 , p_79), g_52)) , 0xE55DFC96L) , (void*)0) == l_130) , g_131) == l_134) & 0x0CL) ^ l_90)) & 0xBCBDL) && p_78)))))), g_8))))
{ /* block id: 40 */
int32_t l_163 = 0x058BBDFDL;
int32_t *l_165 = &l_90;
int32_t l_166 = 0x2F119E39L;
g_167 &= (safe_mod_func_int8_t_s_s(((p_77 , ((*l_165) = ((safe_add_func_int64_t_s_s((((safe_add_func_int16_t_s_s((safe_mod_func_uint16_t_u_u((((safe_mul_func_int8_t_s_s((((safe_add_func_uint32_t_u_u((safe_rshift_func_uint16_t_u_s((&g_85 != &p_79), g_103)), p_79)) >= ((safe_mod_func_int8_t_s_s(((safe_mul_func_int8_t_s_s(g_103, (l_163 = (((!(g_13 <= (0L || (safe_rshift_func_uint16_t_u_u((~((((safe_div_func_int32_t_s_s(((((safe_mod_func_int64_t_s_s((&p_75 != &p_77), g_85)) | p_75) , p_77) , p_79), 0xED364FFCL)) < 0x377FA4877AA3FF9CLL) , 2UL) != g_13)), l_163))))) && 0UL) && (-1L))))) > g_52), 0xE8L)) , p_77)) >= g_103), g_103)) || g_103) && p_75), l_164[2][1])), 65535UL)) < g_61) == g_61), g_8)) , (-1L)))) , p_75), l_166));
p_79 ^= p_76;
}
else
{ /* block id: 45 */
int64_t *l_176 = &g_177;
int32_t l_178 = (-8L);
int32_t l_208 = 0xF5BDECA5L;
if (((safe_rshift_func_uint8_t_u_u(g_61, ((((p_79 == 0x6D4F0C11142F3EDFLL) < p_76) <= 1L) && ((*l_176) ^= (safe_lshift_func_int8_t_s_s((&p_77 != ((g_13 >= g_61) , ((g_103 = (safe_add_func_int64_t_s_s((((safe_lshift_func_uint8_t_u_u(((void*)0 != &g_103), 3)) > p_78) <= 0L), g_61))) , &p_75))), g_85)))))) , 0x3B5EBD51L))
{ /* block id: 48 */
uint16_t l_180 = 0UL;
++l_180;
g_85 ^= (g_177 ^ (g_177 & 0xB23C0CBE003A25DFLL));
g_183 = (*l_106);
}
else
{ /* block id: 52 */
int32_t **l_184 = &l_84[3][5][0];
for (l_179 = 0; (l_179 >= 0); l_179 -= 1)
{ /* block id: 55 */
int8_t *l_187[1];
const int64_t **l_195 = &l_194;
int i, j, k;
for (i = 0; i < 1; i++)
l_187[i] = &g_188[3][0];
l_84[(l_179 + 6)][(l_179 + 1)][l_179] = func_97(l_164[(l_179 + 2)][(l_179 + 3)], g_177, l_184);
(*l_106) = ((((((((p_79 ^ (l_189 = (g_183 != &l_90))) == (((safe_rshift_func_int8_t_s_s(g_8, 5)) , ((safe_mod_func_uint16_t_u_u((&g_177 != ((*l_195) = l_194)), (safe_div_func_uint64_t_u_u(((((g_8 <= p_76) > (p_78 ^ p_78)) <= g_103) , l_178), 8UL)))) >= 1UL)) || l_178)) & g_8) != g_188[4][0]) >= 0UL) , 0xB76923BBL) != l_178) , &p_79);
}
l_208 = (((safe_rshift_func_int16_t_s_s((safe_sub_func_uint64_t_u_u((((safe_add_func_uint16_t_u_u(g_167, p_79)) != p_76) , (safe_mod_func_uint16_t_u_u((l_178 = ((safe_lshift_func_uint16_t_u_u((g_167 , (g_8 , ((l_102[1] != (void*)0) ^ p_77))), 12)) == 0xB1C82E662C939D4BLL)), g_85))), (-1L))), p_79)) & p_78) ^ p_77);
}
p_79 ^= 0xC46033E3L;
l_179 = p_77;
for (g_85 = 1; (g_85 >= (-7)); g_85 = safe_sub_func_uint64_t_u_u(g_85, 9))
{ /* block id: 68 */
(*l_106) = (p_75 , &p_79);
}
}
(*l_213) = l_211;
g_85 |= (((safe_div_func_uint16_t_u_u((g_52 != ((g_233[6] = ((safe_add_func_int16_t_s_s(((*l_230) = (((0xC18CA032275AA4ACLL | ((void*)0 == l_106)) , (safe_div_func_int8_t_s_s((((*l_220) = (void*)0) == g_223), p_78))) , (safe_lshift_func_uint8_t_u_s((safe_sub_func_int64_t_s_s(((p_79 < (g_125 > g_103)) == p_75), p_75)), 5)))), g_61)) , 5UL)) || g_61)), 1UL)) ^ l_234[0][6][0]) & 0xB4C5L);
}
}
return l_235;
}
/* ------------------------------------------ */
/*
* reads : g_52 g_85 g_61 g_125 g_103
* writes: g_125 g_85
*/
static int32_t * func_97(uint16_t p_98, uint32_t p_99, int32_t ** p_100)
{ /* block id: 32 */
uint32_t l_107 = 6UL;
uint32_t *l_119[7] = {&g_103,&g_103,&g_103,&g_103,&g_103,&g_103,&g_103};
int32_t l_120 = 0xA7E6D091L;
int32_t l_123 = 0xDEC7D611L;
uint16_t *l_124 = &g_125;
int32_t l_126 = 0x08C46E72L;
int32_t *l_127 = &g_85;
int i;
(*l_127) = ((l_107 , l_107) != (((safe_add_func_uint32_t_u_u(((l_126 ^= (((*l_124) ^= ((safe_mod_func_uint8_t_u_u((safe_sub_func_uint16_t_u_u((safe_sub_func_int16_t_s_s((safe_lshift_func_int8_t_s_u(0x8EL, (l_123 = (((l_120 = ((safe_unary_minus_func_int16_t_s((l_119[6] == &p_99))) , 0xD33F623BA0E38899LL)) && (((void*)0 != &p_99) < ((safe_add_func_uint16_t_u_u((l_120 >= g_52), 0x1335L)) >= (-2L)))) , 0x0BL)))), g_85)), 0xBDFEL)), g_61)) ^ 0x6699CBFF9F6C9230LL)) > l_107)) == g_103), l_107)) , 0xFDFBL) == (-4L)));
return &g_85;
}
/* ---------------------------------------- */
int main (int argc, char* argv[])
{
int i, j, k;
int print_hash_value = 0;
if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
platform_main_begin();
crc32_gentab();
func_1();
transparent_crc(g_7, "g_7", print_hash_value);
transparent_crc(g_8, "g_8", print_hash_value);
transparent_crc(g_12, "g_12", print_hash_value);
transparent_crc(g_13, "g_13", print_hash_value);
transparent_crc(g_29, "g_29", print_hash_value);
transparent_crc(g_52, "g_52", print_hash_value);
transparent_crc(g_61, "g_61", print_hash_value);
transparent_crc(g_66.f0, "g_66.f0", print_hash_value);
transparent_crc(g_85, "g_85", print_hash_value);
transparent_crc(g_103, "g_103", print_hash_value);
transparent_crc(g_125, "g_125", print_hash_value);
transparent_crc(g_133, "g_133", print_hash_value);
transparent_crc(g_167, "g_167", print_hash_value);
transparent_crc(g_177, "g_177", print_hash_value);
for (i = 0; i < 8; i++)
{
for (j = 0; j < 1; j++)
{
transparent_crc(g_188[i][j], "g_188[i][j]", print_hash_value);
if (print_hash_value) printf("index = [%d][%d]\n", i, j);
}
}
transparent_crc(g_225, "g_225", print_hash_value);
transparent_crc(g_231, "g_231", print_hash_value);
for (i = 0; i < 8; i++)
{
transparent_crc(g_233[i], "g_233[i]", print_hash_value);
if (print_hash_value) printf("index = [%d]\n", i);
}
transparent_crc(g_267, "g_267", print_hash_value);
transparent_crc(g_345.f0, "g_345.f0", print_hash_value);
transparent_crc(g_376, "g_376", print_hash_value);
transparent_crc(g_416, "g_416", print_hash_value);
transparent_crc(g_466, "g_466", print_hash_value);
transparent_crc(g_469.f0, "g_469.f0", print_hash_value);
for (i = 0; i < 5; i++)
{
transparent_crc(g_515[i].f0, "g_515[i].f0", print_hash_value);
if (print_hash_value) printf("index = [%d]\n", i);
}
transparent_crc(g_603, "g_603", print_hash_value);
transparent_crc(g_608.f0, "g_608.f0", print_hash_value);
transparent_crc(g_663.f0, "g_663.f0", print_hash_value);
transparent_crc(g_681.f0, "g_681.f0", print_hash_value);
transparent_crc(g_769.f0, "g_769.f0", print_hash_value);
transparent_crc(g_774, "g_774", print_hash_value);
for (i = 0; i < 6; i++)
{
for (j = 0; j < 1; j++)
{
for (k = 0; k < 7; k++)
{
transparent_crc(g_810[i][j][k].f0, "g_810[i][j][k].f0", print_hash_value);
if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
}
}
}
for (i = 0; i < 7; i++)
{
for (j = 0; j < 1; j++)
{
transparent_crc(g_849[i][j], "g_849[i][j]", print_hash_value);
if (print_hash_value) printf("index = [%d][%d]\n", i, j);
}
}
transparent_crc(g_983.f0, "g_983.f0", print_hash_value);
for (i = 0; i < 4; i++)
{
for (j = 0; j < 10; j++)
{
transparent_crc(g_1070[i][j], "g_1070[i][j]", print_hash_value);
if (print_hash_value) printf("index = [%d][%d]\n", i, j);
}
}
transparent_crc(g_1110, "g_1110", print_hash_value);
for (i = 0; i < 8; i++)
{
for (j = 0; j < 10; j++)
{
for (k = 0; k < 1; k++)
{
transparent_crc(g_1116[i][j][k].f0, "g_1116[i][j][k].f0", print_hash_value);
if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
}
}
}
for (i = 0; i < 9; i++)
{
transparent_crc(g_1166[i].f0, "g_1166[i].f0", print_hash_value);
if (print_hash_value) printf("index = [%d]\n", i);
}
for (i = 0; i < 7; i++)
{
transparent_crc(g_1193[i].f0, "g_1193[i].f0", print_hash_value);
if (print_hash_value) printf("index = [%d]\n", i);
}
transparent_crc(g_1213.f0, "g_1213.f0", print_hash_value);
transparent_crc(g_1298.f0, "g_1298.f0", print_hash_value);
transparent_crc(g_1305, "g_1305", print_hash_value);
transparent_crc(g_1307, "g_1307", print_hash_value);
platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return 0;
}
/************************ statistics *************************
XXX max struct depth: 0
breakdown:
depth: 0, occurrence: 305
XXX total union variables: 11
XXX non-zero bitfields defined in structs: 1
XXX zero bitfields defined in structs: 0
XXX const bitfields defined in structs: 0
XXX volatile bitfields defined in structs: 1
XXX structs with bitfields in the program: 23
breakdown:
indirect level: 0, occurrence: 11
indirect level: 1, occurrence: 11
indirect level: 2, occurrence: 1
XXX full-bitfields structs in the program: 0
breakdown:
XXX times a bitfields struct's address is taken: 15
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 15
XXX times a single bitfield on LHS: 0
XXX times a single bitfield on RHS: 12
XXX max expression depth: 40
breakdown:
depth: 1, occurrence: 96
depth: 2, occurrence: 26
depth: 3, occurrence: 3
depth: 4, occurrence: 1
depth: 5, occurrence: 1
depth: 9, occurrence: 1
depth: 14, occurrence: 1
depth: 15, occurrence: 1
depth: 16, occurrence: 2
depth: 17, occurrence: 1
depth: 18, occurrence: 1
depth: 19, occurrence: 1
depth: 22, occurrence: 1
depth: 23, occurrence: 2
depth: 24, occurrence: 2
depth: 25, occurrence: 1
depth: 26, occurrence: 3
depth: 27, occurrence: 1
depth: 28, occurrence: 2
depth: 34, occurrence: 1
depth: 36, occurrence: 1
depth: 38, occurrence: 2
depth: 40, occurrence: 1
XXX total number of pointers: 313
XXX times a variable address is taken: 562
XXX times a pointer is dereferenced on RHS: 108
breakdown:
depth: 1, occurrence: 68
depth: 2, occurrence: 28
depth: 3, occurrence: 10
depth: 4, occurrence: 1
depth: 5, occurrence: 1
XXX times a pointer is dereferenced on LHS: 143
breakdown:
depth: 1, occurrence: 127
depth: 2, occurrence: 15
depth: 3, occurrence: 1
XXX times a pointer is compared with null: 28
XXX times a pointer is compared with address of another variable: 11
XXX times a pointer is compared with another pointer: 14
XXX times a pointer is qualified to be dereferenced: 2635
XXX max dereference level: 5
breakdown:
level: 0, occurrence: 0
level: 1, occurrence: 520
level: 2, occurrence: 154
level: 3, occurrence: 26
level: 4, occurrence: 7
level: 5, occurrence: 1
XXX number of pointers point to pointers: 129
XXX number of pointers point to scalars: 173
XXX number of pointers point to structs: 0
XXX percent of pointers has null in alias set: 24.6
XXX average alias set size: 1.28
XXX times a non-volatile is read: 996
XXX times a non-volatile is write: 427
XXX times a volatile is read: 71
XXX times read thru a pointer: 36
XXX times a volatile is write: 32
XXX times written thru a pointer: 26
XXX times a volatile is available for access: 1.7e+03
XXX percentage of non-volatile access: 93.3
XXX forward jumps: 0
XXX backward jumps: 3
XXX stmts: 100
XXX max block depth: 5
breakdown:
depth: 0, occurrence: 26
depth: 1, occurrence: 14
depth: 2, occurrence: 14
depth: 3, occurrence: 19
depth: 4, occurrence: 17
depth: 5, occurrence: 10
XXX percentage a fresh-made variable is used: 19.7
XXX percentage an existing variable is used: 80.3
FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
********************* end of statistics **********************/
| 66.338558 | 3,143 | 0.602542 |
bceed1013c5cbc47ed1c8a7b2b16aca08cff22cc | 8,625 | h | C | readonly/mavlink_message/src/mavlink1.0/sensesoar/mavlink_msg_llc_out.h | KerryWu16/src | bed672dc1732cd6af1752bb54ab0abde015bb93a | [
"MIT"
] | 2 | 2017-12-17T11:07:56.000Z | 2021-08-19T09:35:11.000Z | readonly/mavlink_message/src/mavlink1.0/sensesoar/mavlink_msg_llc_out.h | KerryWu16/src | bed672dc1732cd6af1752bb54ab0abde015bb93a | [
"MIT"
] | null | null | null | readonly/mavlink_message/src/mavlink1.0/sensesoar/mavlink_msg_llc_out.h | KerryWu16/src | bed672dc1732cd6af1752bb54ab0abde015bb93a | [
"MIT"
] | 1 | 2021-08-19T07:41:48.000Z | 2021-08-19T07:41:48.000Z | // MESSAGE LLC_OUT PACKING
#define MAVLINK_MSG_ID_LLC_OUT 186
typedef struct __mavlink_llc_out_t
{
int16_t servoOut[4]; ///<
int16_t MotorOut[2]; ///<
} mavlink_llc_out_t;
#define MAVLINK_MSG_ID_LLC_OUT_LEN 12
#define MAVLINK_MSG_ID_186_LEN 12
#define MAVLINK_MSG_ID_LLC_OUT_CRC 5
#define MAVLINK_MSG_ID_186_CRC 5
#define MAVLINK_MSG_LLC_OUT_FIELD_SERVOOUT_LEN 4
#define MAVLINK_MSG_LLC_OUT_FIELD_MOTOROUT_LEN 2
#define MAVLINK_MESSAGE_INFO_LLC_OUT { \
"LLC_OUT", \
2, \
{ { "servoOut", NULL, MAVLINK_TYPE_INT16_T, 4, 0, offsetof(mavlink_llc_out_t, servoOut) }, \
{ "MotorOut", NULL, MAVLINK_TYPE_INT16_T, 2, 8, offsetof(mavlink_llc_out_t, MotorOut) }, \
} \
}
/**
* @brief Pack a llc_out message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param servoOut
* @param MotorOut
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_llc_out_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
const int16_t *servoOut, const int16_t *MotorOut)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_LLC_OUT_LEN];
_mav_put_int16_t_array(buf, 0, servoOut, 4);
_mav_put_int16_t_array(buf, 8, MotorOut, 2);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LLC_OUT_LEN);
#else
mavlink_llc_out_t packet;
mav_array_memcpy(packet.servoOut, servoOut, sizeof(int16_t)*4);
mav_array_memcpy(packet.MotorOut, MotorOut, sizeof(int16_t)*2);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_LLC_OUT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LLC_OUT_LEN, MAVLINK_MSG_ID_LLC_OUT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
}
/**
* @brief Pack a llc_out message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param servoOut
* @param MotorOut
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_llc_out_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
const int16_t *servoOut,const int16_t *MotorOut)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_LLC_OUT_LEN];
_mav_put_int16_t_array(buf, 0, servoOut, 4);
_mav_put_int16_t_array(buf, 8, MotorOut, 2);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LLC_OUT_LEN);
#else
mavlink_llc_out_t packet;
mav_array_memcpy(packet.servoOut, servoOut, sizeof(int16_t)*4);
mav_array_memcpy(packet.MotorOut, MotorOut, sizeof(int16_t)*2);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_LLC_OUT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LLC_OUT_LEN, MAVLINK_MSG_ID_LLC_OUT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
}
/**
* @brief Encode a llc_out struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param llc_out C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_llc_out_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_llc_out_t* llc_out)
{
return mavlink_msg_llc_out_pack(system_id, component_id, msg, llc_out->servoOut, llc_out->MotorOut);
}
/**
* @brief Encode a llc_out struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param llc_out C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_llc_out_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_llc_out_t* llc_out)
{
return mavlink_msg_llc_out_pack_chan(system_id, component_id, chan, msg, llc_out->servoOut, llc_out->MotorOut);
}
/**
* @brief Send a llc_out message
* @param chan MAVLink channel to send the message
*
* @param servoOut
* @param MotorOut
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_llc_out_send(mavlink_channel_t chan, const int16_t *servoOut, const int16_t *MotorOut)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_LLC_OUT_LEN];
_mav_put_int16_t_array(buf, 0, servoOut, 4);
_mav_put_int16_t_array(buf, 8, MotorOut, 2);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, buf, MAVLINK_MSG_ID_LLC_OUT_LEN, MAVLINK_MSG_ID_LLC_OUT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, buf, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
#else
mavlink_llc_out_t packet;
mav_array_memcpy(packet.servoOut, servoOut, sizeof(int16_t)*4);
mav_array_memcpy(packet.MotorOut, MotorOut, sizeof(int16_t)*2);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, (const char *)&packet, MAVLINK_MSG_ID_LLC_OUT_LEN, MAVLINK_MSG_ID_LLC_OUT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, (const char *)&packet, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_LLC_OUT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_llc_out_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const int16_t *servoOut, const int16_t *MotorOut)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_int16_t_array(buf, 0, servoOut, 4);
_mav_put_int16_t_array(buf, 8, MotorOut, 2);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, buf, MAVLINK_MSG_ID_LLC_OUT_LEN, MAVLINK_MSG_ID_LLC_OUT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, buf, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
#else
mavlink_llc_out_t *packet = (mavlink_llc_out_t *)msgbuf;
mav_array_memcpy(packet->servoOut, servoOut, sizeof(int16_t)*4);
mav_array_memcpy(packet->MotorOut, MotorOut, sizeof(int16_t)*2);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, (const char *)packet, MAVLINK_MSG_ID_LLC_OUT_LEN, MAVLINK_MSG_ID_LLC_OUT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, (const char *)packet, MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE LLC_OUT UNPACKING
/**
* @brief Get field servoOut from llc_out message
*
* @return
*/
static inline uint16_t mavlink_msg_llc_out_get_servoOut(const mavlink_message_t* msg, int16_t *servoOut)
{
return _MAV_RETURN_int16_t_array(msg, servoOut, 4, 0);
}
/**
* @brief Get field MotorOut from llc_out message
*
* @return
*/
static inline uint16_t mavlink_msg_llc_out_get_MotorOut(const mavlink_message_t* msg, int16_t *MotorOut)
{
return _MAV_RETURN_int16_t_array(msg, MotorOut, 2, 8);
}
/**
* @brief Decode a llc_out message into a struct
*
* @param msg The message to decode
* @param llc_out C-struct to decode the message contents into
*/
static inline void mavlink_msg_llc_out_decode(const mavlink_message_t* msg, mavlink_llc_out_t* llc_out)
{
#if MAVLINK_NEED_BYTE_SWAP
mavlink_msg_llc_out_get_servoOut(msg, llc_out->servoOut);
mavlink_msg_llc_out_get_MotorOut(msg, llc_out->MotorOut);
#else
memcpy(llc_out, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_LLC_OUT_LEN);
#endif
}
| 33.823529 | 167 | 0.756986 |
f45e6eaff2e8a8986f952239778f36450edc0282 | 386 | h | C | CDDStoreDemo/CDDStoreDemo/Classes/Details(商品详情)/View/CollectionView/Main/服务Cell/DCDetailServicetCell.h | laodaobazi/CDDStore | 319d08c4c04d1a938b23304bcadd5c4c159306d9 | [
"Apache-2.0"
] | 832 | 2017-03-21T07:14:53.000Z | 2022-02-16T08:56:04.000Z | CDDStoreDemo/CDDStoreDemo/Classes/Details(商品详情)/View/CollectionView/Main/服务Cell/DCDetailServicetCell.h | LiuQiang11/CDDStore | 319d08c4c04d1a938b23304bcadd5c4c159306d9 | [
"Apache-2.0"
] | 22 | 2017-07-20T09:45:37.000Z | 2020-06-30T06:01:11.000Z | CDDStoreDemo/CDDStoreDemo/Classes/Details(商品详情)/View/CollectionView/Main/服务Cell/DCDetailServicetCell.h | LiuQiang11/CDDStore | 319d08c4c04d1a938b23304bcadd5c4c159306d9 | [
"Apache-2.0"
] | 270 | 2017-03-29T13:24:40.000Z | 2021-11-12T07:58:48.000Z | //
// DCDetailServicetCell.h
// CDDMall
//
// Created by apple on 2017/6/25.
// Copyright © 2017年 RocketsChen. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DCLIRLButton.h"
@interface DCDetailServicetCell : UICollectionViewCell
/* 服务按钮 */
@property (strong , nonatomic)DCLIRLButton *serviceButton;
/* 服务标题 */
@property (strong , nonatomic)UILabel *serviceLabel;
@end
| 19.3 | 58 | 0.722798 |
bc4b2c4af8358a1f65901af2f075e8e2031d7317 | 472 | c | C | A02/repeat.c | MagdalenMcCulloch/assignments | 3a8f518411a29ee4a4c2073b8d58bed0377ee5d8 | [
"MIT"
] | null | null | null | A02/repeat.c | MagdalenMcCulloch/assignments | 3a8f518411a29ee4a4c2073b8d58bed0377ee5d8 | [
"MIT"
] | null | null | null | A02/repeat.c | MagdalenMcCulloch/assignments | 3a8f518411a29ee4a4c2073b8d58bed0377ee5d8 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char *s; // char pointer array for the string entered
// should n be dynamic???
int n;
// the entered string can be at most 32 chars long
s = malloc(sizeof(char)*32);
printf("Enter a word: ");
scanf("%s",s);
printf("Enter a count: ");
scanf("%d",&n);
//prints the string n times
for(int i =0; i <n; i++){
printf("%s",s);
}
printf("\n");
free(s);
return 0;
}
| 18.153846 | 55 | 0.574153 |
90c9deace8953f96704d135784ffe378aea41aef | 25,695 | c | C | proc.c | gilichiko/osasm2 | 36ba061a584e64a3e2d981180edf5794800afbd6 | [
"MIT-0"
] | null | null | null | proc.c | gilichiko/osasm2 | 36ba061a584e64a3e2d981180edf5794800afbd6 | [
"MIT-0"
] | null | null | null | proc.c | gilichiko/osasm2 | 36ba061a584e64a3e2d981180edf5794800afbd6 | [
"MIT-0"
] | null | null | null | #include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "x86.h"
#include "proc.h"
#include "spinlock.h"
//3.1 sturct mutex and states
enum mutex_state {
mutex_free, mutex_locked
};
struct mutex {
struct spinlock lock;
int mutex_id;
int mutex_index;
enum mutex_state state;
int curr_pid;
int curr_tid;
int in_use;
};
struct {
struct spinlock lock;
struct proc proc[NPROC];
} ptable;
//mutex's list
struct {
struct spinlock lock;
int nextmid;
struct mutex mutexs[MAX_MUTEXES];
} mutex_list;
static struct proc *initproc;
int nextpid = 1;
extern void forkret(void);
extern void trapret(void);
static void wakeup1(void *chan);
void
pinit(void) {
initlock(&ptable.lock, "ptable"); //initalizing ptable
initlock(&mutex_list.lock, "mutex_list");
for (int i = 0; i < MAX_MUTEXES; ++i) {
struct mutex *m = &mutex_list.mutexs[i];
m->state = mutex_free;
m->in_use = 0;
m->mutex_index = i;
initlock(&(m->lock), "mutex_" + i);
}
}
// Must be called with interrupts disabled
int
cpuid() {
return mycpu() - cpus;
}
// Must be called with interrupts disabled to avoid the caller being
// rescheduled between reading lapicid and running through the loop.
struct cpu *
mycpu(void) {
int apicid, i;
if (readeflags() & FL_IF)
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return &cpus[i];
}
panic("unknown apicid\n");
}
// Disable interrupts so that we are not rescheduled
// while reading proc from the cpu structure
struct proc *
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
c = mycpu();
p = c->proc;
popcli();
return p;
}
struct thread *
mythread(void) {
struct cpu *c;
struct thread *thread;
pushcli();
c = mycpu();
thread = c->currthread;
popcli();
return thread;
}
//PAGEBREAK: 32
// Look in the process table for an UNUSED proc.
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc *
allocproc(void) {
struct proc *p;
struct thread *t;
char *sp;
acquire(&ptable.lock);
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if (p->state == UNUSED)
goto found;
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
release(&ptable.lock);
t = (struct thread *) p->threads;
// Allocate kernel stack.
if ((t->kstack = kalloc()) == 0) {
p->state = UNUSED;
return 0;
}
sp = t->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *t->tf;
t->tf = (struct trapframe *) sp;
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint *) sp = (uint) trapret;
sp -= sizeof *t->context;
t->context = (struct context *) sp;
memset(t->context, 0, sizeof *t->context);
t->context->eip = (uint) forkret;
p->nexttid = 1;
p->state = USED;
return p;
}
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void) {
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
initproc = p;
struct thread t = p->threads[0];
if ((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int) _binary_initcode_size);
p->sz = PGSIZE;
memset(t.tf, 0, sizeof(*t.tf));
t.tf->cs = (SEG_UCODE << 3) | DPL_USER;
t.tf->ds = (SEG_UDATA << 3) | DPL_USER;
t.tf->es = t.tf->ds;
t.tf->ss = t.tf->ds;
t.tf->eflags = FL_IF;
t.tf->esp = PGSIZE;
t.tf->eip = 0; // beginning of initcode.S
safestrcpy(p->name, "initcode", sizeof(p->name));
p->cwd = namei("/");
// this assignment to p->state lets other cores
// run this process. the acquire forces the above
// writes to be visible, and the lock is also needed
// because the assignment might not be atomic.
acquire(&ptable.lock);
t.state = threadRUNNABLE;
p->threads[0] = t;
release(&ptable.lock);
}
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n) {
uint sz;
struct proc *curproc = myproc();
sz = curproc->sz;
if (n > 0) {
if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
} else if (n < 0) {
if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
}
curproc->sz = sz;
switchuvm(curproc);
return 0;
}
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void) {
int i, pid;
struct proc *np;
struct thread *currthread = mythread();
struct proc *curproc = myproc();
// Allocate process.
if ((np = allocproc()) == 0) {
return -1;
}
struct thread *nt = &np->threads[0];
// Copy process state from proc.
if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) {
kfree(nt->kstack);
nt->kstack = 0;
np->state = UNUSED;
nt->state = threadUNUSED;
return -1;
}
np->sz = curproc->sz;
np->parent = curproc;
*nt->tf = *currthread->tf;
// Clear %eax so that fork returns 0 in the child.
nt->tf->eax = 0;
for (i = 0; i < NOFILE; i++)
if (curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
pid = np->pid;
acquire(&ptable.lock);
np->state = USED;
nt->state = threadRUNNABLE;
release(&ptable.lock);
return pid;
}
void deallocate_process_mutexes(struct proc *p) {
acquire(&mutex_list.lock);
for (int i = 0; i < MAX_MUTEXES; ++i) {
struct mutex *m = &mutex_list.mutexs[i];
acquire(&m->lock);
if (m->in_use == 1 && p->pid == m->curr_pid) {
m->in_use = 0;
m->mutex_index = -1;
m->state = mutex_free;
m->curr_pid = -1;
m->curr_tid = -1;
m->mutex_id = -1;
}
release(&m->lock);
}
release(&mutex_list.lock);
}
void unlock_thread_mutexes(struct proc *p, struct thread *t) {
acquire(&mutex_list.lock);
for (int i = 0; i < MAX_MUTEXES; ++i) {
struct mutex *m = &mutex_list.mutexs[i];
acquire(&m->lock);
if (m->in_use == 1 && p->pid == m->curr_pid && t->tid == m->curr_tid && m->state == mutex_locked) {
m->state = mutex_free;
}
release(&m->lock);
}
release(&mutex_list.lock);
}
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void) {
acquire(&ptable.lock);
struct proc *curproc = myproc();
struct proc *p;
struct thread *t;
int fd;
if (curproc == initproc) {
panic("init exiting");
}
struct thread *curthread = mythread();
curthread->state = threadZOMBIE;
curproc->killed = 1;
// check if there's another thread with runnable / running process
int exist_running_thread = 0;
for (t = curproc->threads; t < &curproc->threads[NTHREAD]; t++) {
// TODO: check if need sleeping
if (t->state != threadUNUSED && t->state != threadZOMBIE) {
exist_running_thread = 1;
}
}
if (!exist_running_thread) {
release(&ptable.lock);
// Close all open files.
for (fd = 0; fd < NOFILE; fd++) {
if (curproc->ofile[fd]) {
fileclose(curproc->ofile[fd]);
curproc->ofile[fd] = 0;
}
}
begin_op();
iput(curproc->cwd);
end_op();
curproc->cwd = 0;
deallocate_process_mutexes(myproc());
acquire(&ptable.lock);
// Parent might be sleeping in wait().
wakeup1(curproc->parent);
// Pass abandoned children to init.
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
if (p->parent == curproc) {
p->parent = initproc;
if (p->state == ZOMBIE)
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
curproc->state = ZOMBIE;
curthread->state = threadZOMBIE;
}
wakeup1(curthread);
sched();
panic("zombie exit");
}
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void) {
struct proc *p;
int havekids, pid;
struct proc *curproc = myproc();
//fixme mybe should use- struct thread *currthread=mythread();
struct thread *t;
acquire(&ptable.lock);
for (;;) {
// Scan through table looking for exited children.
havekids = 0;
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
if (p->parent != curproc) {
continue;
}
havekids = 1;
if (p->state == ZOMBIE) {
// Found one.
// we should free all the threads
for (t = p->threads; t < &p->threads[NTHREAD]; t++) {
if (t->state != threadUNUSED) {
kfree(t->kstack);
t->tid = -1;
t->context = 0;
t->tf = 0;
t->chan = 0;
t->kstack = 0;
t->state = threadUNUSED;
t->killed = 0;
}
}
pid = p->pid;
freevm(p->pgdir);
p->pid = 0;
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
return pid;
}
}
// No point waiting if we don't have any children.
if (!havekids || curproc->killed) {
release(&ptable.lock);
return -1;
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
//todo sleep for thread? for all threads
}
}
int is_runnable_thread_exist(struct proc *p) {
struct thread *t;
int position = 0;
for (t = p->threads; t < &p->threads[NTHREAD]; t++) {
if (t->state == threadRUNNABLE) {
return position;
}
position++;
}
return -1;
}
//PAGEBREAK: 42
// Per-CPU process scheduler.
// Each CPU calls scheduler() after setting itself up.
// Scheduler never returns. It loops, doing:
// - choose a process to run
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void) {
struct proc *p;
struct cpu *c = mycpu();
c->proc = 0;
for (;;) {
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
if (p->state != USED)
continue;
int thread_position = is_runnable_thread_exist(p);
if (thread_position == -1)
continue;
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
struct thread *t = &p->threads[thread_position];
c->currthread = t;
switchuvm(p);
t->state = threadRUNNING;
swtch(&(c->scheduler), t->context);
switchkvm();
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
c->currthread = 0;
}
release(&ptable.lock);
}
}
// Enter scheduler. Must hold only ptable.lock
// and have changed proc->state. Saves and restores
// intena because intena is a property of this
// kernel thread, not this CPU. It should
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void) {
int intena;
struct thread *t = mythread();
if (!holding(&ptable.lock))
panic("sched ptable.lock");
if (mycpu()->ncli != 1)
panic("sched locks");
if (t->state == threadRUNNING)
panic("sched running");
if (readeflags() & FL_IF)
panic("sched interruptible");
intena = mycpu()->intena;
swtch(&t->context, mycpu()->scheduler);
mycpu()->intena = intena;
}
// Give up the CPU for one scheduling round.
void
yield(void) {
acquire(&ptable.lock); //DOC: yieldlock
mythread()->state = threadRUNNABLE;
sched();
release(&ptable.lock);
}
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void) {
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
iinit(ROOTDEV);
initlog(ROOTDEV);
}
// Return to "caller", actually trapret (see allocproc).
}
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk) {
struct thread *t = mythread();
if (t == 0)
panic("sleep");
if (lk == 0)
panic("sleep without lk");
// Must acquire ptable.lock in order to
// change p->state and then call sched.
// Once we hold ptable.lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup runs with ptable.lock locked),
// so it's okay to release lk.
if (lk != &ptable.lock) { //DOC: sleeplock0
acquire(&ptable.lock); //DOC: sleeplock1
release(lk);
}
// Go to sleep.
t->chan = chan;
t->state = threadSLEEPING;
sched();
// Tidy up.
t->chan = 0;
// Reacquire original lock.
if (lk != &ptable.lock) { //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
}
}
int next_tid_to_join() {
acquire(&ptable.lock);
struct thread *curthread = mythread();
struct proc *curproc = myproc();
struct thread *t;
for (t = curproc->threads; t < &curproc->threads[NTHREAD]; t++) {
if (t->tid != curthread->tid && t->state != threadUNUSED) {
release(&ptable.lock);
return t->tid;
}
}
release(&ptable.lock);
return -1;
}
void kill_other_threads() {
acquire(&ptable.lock);
struct thread *curthread = mythread();
struct proc *curproc = myproc();
struct thread *t;
for (t = curproc->threads; t < &curproc->threads[NTHREAD]; t++) {
if (t->tid != curthread->tid) {
t->killed = 1;
}
if (t->state == threadSLEEPING) {
t->state = threadRUNNABLE;
}
}
release(&ptable.lock);
int next_tid;
while ((next_tid = next_tid_to_join()) != -1) {
kthread_join(next_tid);
}
}
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan) {
struct proc *p;
struct thread *t;
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
for (t = p->threads; t < &p->threads[NTHREAD]; t++) {
if (t->state == threadSLEEPING && t->chan == chan)
t->state = threadRUNNABLE;
}
}
}
// Wake up all processes sleeping on chan.
void
wakeup(void *chan) {
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
}
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid) {
struct proc *p;
struct thread *t;
acquire(&ptable.lock);
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
if (p->pid == pid) {
p->killed = 1;
// Wake process from sleep if necessary.
for (t = p->threads; t < &p->threads[NTHREAD]; t++) {
if (t->state == threadSLEEPING)
t->state = threadRUNNABLE;
}
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
return -1;
}
//PAGEBREAK: 36
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void) {
static char *states[] = {
[USED] "used",
[UNUSED] "unused",
[EMBRYO] "embryo",
// [SLEEPING] "sleep ",
// [RUNNABLE] "runble",
// [RUNNING] "run ",
[ZOMBIE] "zombie"
};
int i;
struct proc *p;
struct thread *t;
char *state;
uint pc[10];
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
if (p->state == UNUSED)
continue;
if (p->state >= 0 && p->state < NELEM(states) && states[p->state])
state = states[p->state];
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
for (t = p->threads; t < &p->threads[NTHREAD]; t++) {
if (t->state == threadSLEEPING) {
getcallerpcs((uint *) t->context->ebp + 2, pc);
for (i = 0; i < 10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
}
cprintf("\n");
}
}
/**
* Threads
*/
int get_next_free_thread(struct proc *p) {
struct thread *t;
int position = 0;
for (t = p->threads; t < &p->threads[NTHREAD]; t++) {
if (t->state == threadUNUSED) {
return position;
}
position++;
}
return -1;
}
int kthread_create(void (*start_func)(), void *stack) {
acquire(&ptable.lock);
struct proc *p = myproc();
int free_thread_position = get_next_free_thread(p);
if (free_thread_position == -1) {
release(&ptable.lock);
return -1;
}
struct thread *t = &p->threads[free_thread_position];
t->tid = p->nexttid++;
if ((t->kstack = kalloc()) == 0) {
release(&ptable.lock);
return -1;
}
char *sp;
sp = t->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *t->tf;
t->tf = (struct trapframe *) sp;
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint *) sp = (uint) trapret;
sp -= sizeof *t->context;
t->context = (struct context *) sp;
memset(t->context, 0, sizeof *t->context);
t->context->eip = (uint) forkret;
*t->tf = *mythread()->tf;
t->tf->eip = (uint) start_func;
t->tf->esp = ((uint) stack);
t->state = threadRUNNABLE;
release(&ptable.lock);
return t->tid;
}
int kthread_id(void) {
return mythread()->tid;
}
void kthread_exit(void) {
acquire(&ptable.lock);
struct proc *curproc = myproc();
struct thread *curthread = mythread();
struct thread *t;
unlock_thread_mutexes(curproc, curthread);
int exist_running_thread = 0;
for (t = curproc->threads; t < &curproc->threads[NTHREAD]; t++) {
if (t->state != threadUNUSED && t->state != threadZOMBIE && t->tid != curthread->tid) {
exist_running_thread = 1;
}
}
if (exist_running_thread) {
curthread->state = threadZOMBIE;
wakeup1(curthread);
sched();
} else {
release(&ptable.lock);
exit();
}
}
int kthread_join(int thread_id) {
if (thread_id < 0)
return -1;
acquire(&ptable.lock);
struct proc *curproc = myproc();
struct thread *t;
struct thread *request_thread;
int tid_exists = 0;
for (t = curproc->threads; t < &curproc->threads[NTHREAD]; t++) {
if (t->tid == thread_id) {
tid_exists = 1;
request_thread = t;
if (t->state == threadZOMBIE) {
t->state = threadUNUSED;
t->killed = 0;
t->tid = -1;
kfree(t->kstack);
t->kstack = 0;
request_thread->chan = 0;
request_thread->tf = 0;
request_thread->context = 0;
release(&ptable.lock);
return 0;
}
}
}
if (!tid_exists) {
release(&ptable.lock);
return -1;
}
// if arrived to this line, it indicates that thread exist but still running and we shall wait.
sleep(request_thread, &ptable.lock);
request_thread->state = threadUNUSED;
request_thread->killed = 0;
kfree(request_thread->kstack);
request_thread->tid = -1;
request_thread->kstack = 0;
request_thread->chan = 0;
request_thread->tf = 0;
request_thread->context = 0;
release(&ptable.lock);
return 0;
}
int next_mid(int for_index) {
int ret;
acquire(&mutex_list.lock);
ret = mutex_list.nextmid++;
release(&mutex_list.lock);
return ret;
}
int is_availble_for_dealloc_mutex(int needed_mutex_id) {
acquire(&mutex_list.lock);
for (int i = 0; i < MAX_MUTEXES; ++i) {
acquire(&mutex_list.mutexs[i].lock);
if (mutex_list.mutexs[i].mutex_id == needed_mutex_id) {
if (mutex_list.mutexs[i].in_use != 1 || mutex_list.mutexs[i].state == mutex_locked) {
release(&mutex_list.lock);
release(&mutex_list.mutexs[i].lock);
return -1;
} else {
/*if (mutex_list.mutexs[i].curr_pid != myproc()->pid ||
mutex_list.mutexs[i].curr_tid != mythread()->tid) {
release(&mutex_list.lock);
release(&mutex_list.mutexs[i].lock);
return -1;
}*/
release(&mutex_list.lock);
return i;
}
}
release(&mutex_list.mutexs[i].lock);
}
release(&mutex_list.lock);
return -1;
}
int next_availble_mutex() {
acquire(&mutex_list.lock);
for (int i = 0; i < MAX_MUTEXES; ++i) {
acquire(&mutex_list.mutexs[i].lock);
if (mutex_list.mutexs[i].in_use == 0) {
release(&mutex_list.lock);
return i;
}
release(&mutex_list.mutexs[i].lock);
}
release(&mutex_list.lock);
return -1;
}
//3.1 mutex functions
int kthread_mutex_alloc() {
int this_mutex_index = next_availble_mutex();
if (this_mutex_index == -1) return -1;
else {
struct mutex *m = &mutex_list.mutexs[this_mutex_index];
m->in_use = 1;
m->mutex_index = this_mutex_index;
m->state = mutex_free;
m->curr_pid = myproc()->pid;
m->curr_tid = mythread()->tid;
m->mutex_id = next_mid(this_mutex_index);
release(&m->lock);
return m->mutex_id;
}
}
int kthread_mutex_dealloc(int mutex_id) {
int this_mutex_index = is_availble_for_dealloc_mutex(mutex_id);
if (this_mutex_index == -1) return -1;
else {
struct mutex *m = &mutex_list.mutexs[this_mutex_index];
m->in_use = 0;
m->mutex_index = -1;
m->state = mutex_free;
m->curr_pid = -1;
m->curr_tid = -1;
m->mutex_id = -1;
release(&m->lock);
return 0;
}
}
void
acquiremutex(struct mutex *lk) {
while (lk->state == mutex_locked) {
sleep(lk, &lk->lock);
}
acquire(&ptable.lock);
lk->state = mutex_locked;
lk->curr_pid = myproc()->pid;
lk->curr_tid = mythread()->tid;
release(&ptable.lock);
}
void
releasemutex(struct mutex *lk) {
lk->state = mutex_free;
lk->curr_pid = 0;
lk->curr_tid = 0;
wakeup(lk);
}
int kthread_mutex_lock(int needed_mutex_id) {
acquire(&mutex_list.lock);
for (int i = 0; i < MAX_MUTEXES; ++i) {
acquire(&mutex_list.mutexs[i].lock);
if (mutex_list.mutexs[i].mutex_id == needed_mutex_id) {
release(&mutex_list.lock);
acquiremutex(&mutex_list.mutexs[i]);
// we're holding the mutex
release(&mutex_list.mutexs[i].lock);
return needed_mutex_id;
}
release(&mutex_list.mutexs[i].lock);
}
release(&mutex_list.lock);
return -1;
}
int kthread_mutex_unlock(int needed_mutex_id) {
acquire(&mutex_list.lock);
for (int i = 0; i < MAX_MUTEXES; ++i) {
struct mutex *m = &mutex_list.mutexs[i];
acquire(&m->lock);
if (m->mutex_id == needed_mutex_id) {
if (mythread()->tid == m->curr_tid && myproc()->pid == m->curr_pid) {
release(&mutex_list.lock);
releasemutex(m);
// we're holding the mutex
release(&m->lock);
return needed_mutex_id;
}
}
release(&m->lock);
}
release(&mutex_list.lock);
return -1;
}
| 25.720721 | 107 | 0.546098 |
55282967cba40f9cd2da44da1d913abb6eb8015b | 1,335 | h | C | KChatViewController/Message.h | KalpeshTalkar/ChatApplicationTemplate | 11623ec22acd8367d9795ff638a6a119fcd72c5e | [
"MIT"
] | 1 | 2019-02-15T09:58:48.000Z | 2019-02-15T09:58:48.000Z | KChatViewController/Message.h | KalpeshTalkar/ChatApplicationTemplate | 11623ec22acd8367d9795ff638a6a119fcd72c5e | [
"MIT"
] | null | null | null | KChatViewController/Message.h | KalpeshTalkar/ChatApplicationTemplate | 11623ec22acd8367d9795ff638a6a119fcd72c5e | [
"MIT"
] | null | null | null | //
// KMessage.h
// KChatViewController
//
// Created by Kalpesh Talkar on 26/12/15.
// Copyright © 2015 Kalpesh Talkar. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// Default Image
#define DefaultImage @"default_message_image"
// Dictionary Keys
#define Message_Sender_Id @"senderId"
#define Message_Sender_Name @"senderName"
#define Message_Body @"messageBody"
#define Message_Image_Url @"imageUrl"
#define Message_Date @"messageDate"
// Message Type
typedef NS_ENUM(NSInteger, MessageType) {
MessageTypeText,
MessageTypeImage,
MessageTypeImageWithText,
MessageTypeVideo,
MessageTypeAudio
};
// Message Status
typedef NS_ENUM(NSInteger, MessageState) {
MessageStatePending,
MessageStateFailed,
MessageStateSent
};
@interface Message : NSObject
@property (strong, nonatomic) NSString *senderId;
@property (strong, nonatomic) NSString *senderName;
@property (strong, nonatomic) NSString *messageBody;
@property (strong, nonatomic) NSString *imageUrl;
@property (strong, nonatomic) UIImage *image;
@property (strong, nonatomic) NSDate *messageDate;
@property (assign, nonatomic) MessageType *messageType;
@property (assign, nonatomic) MessageState *messageState;
- (instancetype)init;
- (instancetype)initWithDictionary:(NSDictionary *)rawMessage;
@end
| 25.188679 | 62 | 0.764794 |
51a735350e25406829f5724078ee6b8a20728eb3 | 201 | h | C | include/processor.h | jedhelmers/CppND-System-Monitor_alt | 72c0dc7e1febfdd763684a6207efd544832ba075 | [
"MIT"
] | null | null | null | include/processor.h | jedhelmers/CppND-System-Monitor_alt | 72c0dc7e1febfdd763684a6207efd544832ba075 | [
"MIT"
] | null | null | null | include/processor.h | jedhelmers/CppND-System-Monitor_alt | 72c0dc7e1febfdd763684a6207efd544832ba075 | [
"MIT"
] | null | null | null | #ifndef PROCESSOR_H
#define PROCESSOR_H
#include "linux_parser.h"
class Processor {
public:
float Utilization();
private:
long prev_active_jiffies_{0};
long prev_total_jiffies_{0};
};
#endif | 14.357143 | 31 | 0.751244 |
4e85b2ce9dd068f976b55ecb949462fb1f3993b3 | 575 | c | C | wk2/palindrome.c | ad-t/UNSWCOMP2521-TutorialCode | e917a0e76e5941132dcb88c13a2b21468d72f6ce | [
"MIT"
] | 1 | 2019-02-25T23:25:53.000Z | 2019-02-25T23:25:53.000Z | wk2/palindrome.c | ad-t/UNSWCOMP2521-TutorialCode | e917a0e76e5941132dcb88c13a2b21468d72f6ce | [
"MIT"
] | null | null | null | wk2/palindrome.c | ad-t/UNSWCOMP2521-TutorialCode | e917a0e76e5941132dcb88c13a2b21468d72f6ce | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
int main (int argc, char * argv[]) {
char *possiblePalindrome = argv[1];
size_t length = strlen(possiblePalindrome);
unsigned int i = 0;
unsigned int j = length - 1;
unsigned int success = TRUE;
while (i < length / 2) {
if (possiblePalindrome[i] != possiblePalindrome[j]) {
success = FALSE;
break;
}
i++;
j--;
}
if (success == TRUE) {
printf("Palindrome!\n");
} else {
printf("Not a palindrome.\n");
}
return EXIT_SUCCESS;
}
| 19.827586 | 57 | 0.605217 |
059a5886f24db32ce318ff0ecbd375eebb60c3a3 | 508 | h | C | cc/env/CCENV.h | tangzhe7/cpp | cd0c8ef29beb1c5a1ab874390862e122b7b11d16 | [
"Apache-2.0"
] | null | null | null | cc/env/CCENV.h | tangzhe7/cpp | cd0c8ef29beb1c5a1ab874390862e122b7b11d16 | [
"Apache-2.0"
] | null | null | null | cc/env/CCENV.h | tangzhe7/cpp | cd0c8ef29beb1c5a1ab874390862e122b7b11d16 | [
"Apache-2.0"
] | null | null | null | #ifndef CCENV_H
#define CCENV_H
#ifdef __GUNC__
//gunc
#define GUNC
#define CC_NULL nullptr
#define CC_INT32 int
#define U_CC_INT32 unsigned int
#elif __clang__
//Clang
#define CLANG
#define CC_NULL nullptr
#define CC_INT32 int
#define U_CC_INT32 unsigned int
#else
#define UNKONW
#define CC_NULL nullptr
#define CC_INT32 int
#define U_CC_INT32 unsigned int
#endif
#endif
/**
* 检测编译
*
*
*
*/ | 18.142857 | 33 | 0.598425 |
059c80b513b384558490ab181642d53c5e024439 | 2,444 | h | C | src/Modules/Graphics/Graphics/Render/Cmd/RenderCmdList.h | sssr33/LuaModules | 357a8c9445a237f2c98685000f6c7da668ea0e72 | [
"MIT"
] | null | null | null | src/Modules/Graphics/Graphics/Render/Cmd/RenderCmdList.h | sssr33/LuaModules | 357a8c9445a237f2c98685000f6c7da668ea0e72 | [
"MIT"
] | null | null | null | src/Modules/Graphics/Graphics/Render/Cmd/RenderCmdList.h | sssr33/LuaModules | 357a8c9445a237f2c98685000f6c7da668ea0e72 | [
"MIT"
] | null | null | null | #pragma once
//#include "ClearScreenCmd.h"
//#include "RenderRectCmd.h"
//
//#include <vector>
//#include <array>
//
//class RenderCmdList {
// enum class CmdMemInfoType : size_t {
// ClearScreen,
// RenderRect,
//
// Count
// };
//public:
// RenderCmdList();
//
// void Clear();
//
// void Add(ClearScreenCmd cmd);
// void Add(RenderRectCmd cmd);
//
// void Test();
//
//private:
// struct RenderCmdIdx {
// CmdMemInfoType type;
// size_t idx;
// };
//
// struct CmdMemInfo {
// size_t stride;
// IRenderCmd *memory;
//
// IRenderCmd *operator[](const size_t i) {
// uint8_t *memTmp = (uint8_t *)this->memory;
// memTmp += i * this->stride;
// return (IRenderCmd *)memTmp;
// }
// };
//
// template<class T>
// class CmdMem {
// public:
// CmdMem()
// : type(CmdMemInfoType::Count)
// , cmdRenderList(nullptr)
// {}
//
// CmdMem(
// CmdMemInfoType type,
// std::vector<RenderCmdIdx> *cmdRenderList)
// : type(type)
// , cmdRenderList(cmdRenderList)
// {}
//
// CmdMemInfo GetMemInfo() {
// CmdMemInfo memInfo;
//
// memInfo.stride = sizeof T;
// memInfo.memory = this->cmd.data();
//
// return memInfo;
// }
//
// T &operator[](const size_t i) {
// return this->cmd[i];
// }
//
// size_t GetCmdMemInfoTypeIdx() const {
// return (size_t)this->type;
// }
//
// void clear() {
// this->cmd.clear();
// }
//
// void push_back(const T &v) {
// this->AddRenderCmdIdx();
// this->cmd.push_back(v);
// }
//
// void push_back(T &&v) {
// this->AddRenderCmdIdx();
// this->cmd.push_back(std::move(v));
// }
//
// private:
// CmdMemInfoType type;
// std::vector<RenderCmdIdx> *cmdRenderList;
// std::vector<T> cmd;
//
// void AddRenderCmdIdx() {
// RenderCmdIdx idx;
//
// idx.type = this->type;
// idx.idx = this->cmd.size();
//
// cmdRenderList->push_back(std::move(idx));
// }
// };
//
// std::vector<RenderCmdIdx> cmdRenderList;
//
// CmdMem<ClearScreenCmd> cmdClearScreen;
// CmdMem<RenderRectCmd> cmdRenderRect;
//}; | 22.841121 | 56 | 0.48527 |
bf583440b85056d7a34492d0a4e565cfedb2230a | 4,431 | h | C | src/system/SystemFaultInjection.h | lanyuwen/openweave-core | fbed1743a7b62657f5d310b98909c59474a6404d | [
"Apache-2.0"
] | null | null | null | src/system/SystemFaultInjection.h | lanyuwen/openweave-core | fbed1743a7b62657f5d310b98909c59474a6404d | [
"Apache-2.0"
] | null | null | null | src/system/SystemFaultInjection.h | lanyuwen/openweave-core | fbed1743a7b62657f5d310b98909c59474a6404d | [
"Apache-2.0"
] | 1 | 2020-11-04T06:58:12.000Z | 2020-11-04T06:58:12.000Z | /*
*
* Copyright (c) 2016-2017 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* Header file for the fault-injection utilities for Weave System Layer.
*/
#ifndef SYSTEMFAULTINJECTION_H
#define SYSTEMFAULTINJECTION_H
#include <nlfaultinjection.hpp>
#include <SystemLayer/SystemConfig.h>
#include <Weave/Support/NLDLLUtil.h>
namespace nl {
namespace Weave {
namespace System {
namespace FaultInjection {
using ::nl::FaultInjection::Manager;
/**
* @brief Fault injection points
*
* @details
* Each point in the code at which a fault can be injected
* is identified by a member of this enum.
*/
typedef enum
{
kFault_PacketBufferNew, /**< Fail the allocation of a PacketBuffer */
kFault_TimeoutImmediate, /**< Override the timeout value of a timer being started with 0 */
kFault_AsyncEvent, /**< Inject asynchronous events; when the fault is enabled, it expects
one integer argument, which is passed to application to signal the event
to be injected; @see WEAVE_SYSTEM_FAULT_INJECT_ASYNC_EVENT */
kFault_NumberOfFaultIdentifiers,
} Id;
NL_DLL_EXPORT Manager& GetManager(void);
/**
* Callback to the application that returns how many asynchronous events the application could
* inject at the time of the call.
*
* @return The number of events
*/
typedef int32_t (*GetNumEventsAvailableCb)(void);
/**
* Callback to the application to inject the asynchronous event specified by argument.
*
* @param[in] aEventIndex An index (0 to the value returned by GetNumEventsAvailableCb -1)
* that identifies the event to be injected.
*/
typedef void (*InjectAsyncEventCb)(int32_t aEventIndex);
/**
* Store the GetNumEventsAvailableCb and InjectAsyncEventCb callbacks used by
* @see WEAVE_SYSTEM_FAULT_INJECT_ASYNC_EVENT
*
* @param[in] aGetNumEventsAvailable A GetNumEventsAvailableCb
* @param[in] aInjectAsyncEvent An InjectAsyncEventCb
*
*/
NL_DLL_EXPORT void SetAsyncEventCallbacks(GetNumEventsAvailableCb aGetNumEventsAvailable, InjectAsyncEventCb aInjectAsyncEvent);
/**
* @see WEAVE_SYSTEM_FAULT_INJECT_ASYNC_EVENT
*/
NL_DLL_EXPORT void InjectAsyncEvent(void);
} // namespace FaultInjection
} // namespace System
} // namespace Weave
} // namespace nl
#if WEAVE_SYSTEM_CONFIG_TEST
/**
* Execute the statements included if the System fault is
* to be injected.
*
* @param[in] aFaultID A System fault-injection id
* @param[in] aStatements Statements to be executed if the fault is enabled.
*/
#define WEAVE_SYSTEM_FAULT_INJECT(aFaultId, aStatement) \
nlFAULT_INJECT(::nl::Weave::System::FaultInjection::GetManager(), aFaultId, aStatement)
/**
* This macro implements the injection of asynchronous events.
*
* It polls the application by calling the GetNumEventsAvailableCb callback
* to know if there are asynchronous events that can be injected.
* If there are any, it instances kFault_AsyncEvent.
* If the fault is to be injected, the code injected calls the InjectAsyncEventCb
* callback passing the integer argument stored in the fault Record.
* If the fault is not configured (and therefore no arguments are stored in the Record)
* the macro stores the return value of GetNumEventsAvailableCb into the Records arguments,
* so that the application can log it from a callback installed into the fault.
*/
#define WEAVE_SYSTEM_FAULT_INJECT_ASYNC_EVENT() \
do { \
nl::Weave::System::FaultInjection::InjectAsyncEvent(); \
} while (0)
#else // !WEAVE_SYSTEM_CONFIG_TEST
#define WEAVE_SYSTEM_FAULT_INJECT(aFaultId, aStatement)
#define WEAVE_SYSTEM_FAULT_INJECT_ASYNC_EVENT()
#endif // !WEAVE_SYSTEM_CONFIG_TEST
#endif // SYSTEMFAULTINJECTION_H
| 32.822222 | 128 | 0.723087 |
be2f238ef5c7632c667c0d4466b018f9df6bff62 | 277 | h | C | Roguelike/Wall.h | DawidCieslik/Roguelike-2D | 09bc43de1fa670fc6ad5ff6e226b611f7afa2b83 | [
"MIT"
] | null | null | null | Roguelike/Wall.h | DawidCieslik/Roguelike-2D | 09bc43de1fa670fc6ad5ff6e226b611f7afa2b83 | [
"MIT"
] | null | null | null | Roguelike/Wall.h | DawidCieslik/Roguelike-2D | 09bc43de1fa670fc6ad5ff6e226b611f7afa2b83 | [
"MIT"
] | null | null | null | #pragma once
#include "Tile.h"
class Wall : public Tile
{
std::string texture_filename;
public:
Wall(int x, int y, char symbol);
void collision_up(Unit* object);
void collision_down(Unit* object);
void collision_left(Unit* object);
void collision_right(Unit* object);
}; | 21.307692 | 36 | 0.740072 |
9c4f2d111b5a4165f51f5d90b57e186db1580d17 | 904 | h | C | usr/src/compat/bhyve/amd64/machine/smp.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/compat/bhyve/amd64/machine/smp.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/compat/bhyve/amd64/machine/smp.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2013 Pluribus Networks Inc.
* Copyright 2018 Joyent, Inc.
*/
#ifndef _COMPAT_FREEBSD_AMD64_MACHINE_SMP_H_
#define _COMPAT_FREEBSD_AMD64_MACHINE_SMP_H_
#ifdef _KERNEL
/*
* APIC-related functions are replaced with native calls rather than shims
* which attempt to replicate the FreeBSD interfaces. This is empty, but will
* remain present to appease sources which wish to include the path.
*/
#endif /* _KERNEL */
#endif /* _COMPAT_FREEBSD_AMD64_MACHINE_SMP_H_ */
| 29.16129 | 78 | 0.75 |
a4440a2ddcbe71ae9144761a9d015e5cc34145c5 | 371 | h | C | class-timetable/NightClassTableViewCell.h | pupboss/class-timetable | 2ba6f70be6e65f0253a24fab4d4e232df6b2aaea | [
"MIT",
"Unlicense"
] | 75 | 2015-04-24T19:13:21.000Z | 2021-07-22T01:51:27.000Z | class-timetable/NightClassTableViewCell.h | jetleesg/Class-Timetable | 2ba6f70be6e65f0253a24fab4d4e232df6b2aaea | [
"MIT",
"Unlicense"
] | null | null | null | class-timetable/NightClassTableViewCell.h | jetleesg/Class-Timetable | 2ba6f70be6e65f0253a24fab4d4e232df6b2aaea | [
"MIT",
"Unlicense"
] | 34 | 2015-04-24T20:32:58.000Z | 2020-08-25T05:32:21.000Z | //
// NightClassTableViewCell.h
// eduadmin
//
// Created by Li Jie on 4/18/15.
// Copyright (c) 2015 PUPBOSS. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NightClassTableViewCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *courseLable;
@property (strong, nonatomic) NSString *course;
+ (instancetype)newNightClassCell;
@end
| 18.55 | 60 | 0.735849 |
4ac669d5db4cf9d55146b9ea35fb0d33fada2f81 | 7,179 | c | C | new/libr/bin/p/bin_sfc.c | benbenwt/lisa_docker | 0b851223dbaecef9b27c418eae05890fea752d49 | [
"Apache-2.0"
] | null | null | null | new/libr/bin/p/bin_sfc.c | benbenwt/lisa_docker | 0b851223dbaecef9b27c418eae05890fea752d49 | [
"Apache-2.0"
] | 1 | 2021-12-17T00:14:27.000Z | 2021-12-17T00:14:27.000Z | new/libr/bin/p/bin_sfc.c | benbenwt/lisa_docker | 0b851223dbaecef9b27c418eae05890fea752d49 | [
"Apache-2.0"
] | null | null | null | /* radare - LGPL3 - 2017-2019 - usrshare */
#include <r_bin.h>
#include <r_lib.h>
#include "sfc/sfc_specs.h"
#include <r_endian.h>
static bool check_buffer(RBuffer *b) {
ut16 cksum1, cksum2;
ut64 length = r_buf_size (b);
// FIXME: this was commented out because it always evaluates to false.
// Need to be fixed by someone with SFC knowledge
// if ((length & 0x8000) == 0x200) {
// buf_hdr += 0x200;
// }
if (length < 0x8000) {
return false;
}
//determine if ROM is headered, and add a 0x200 gap if so.
cksum1 = r_buf_read_le16_at (b, 0x7fdc);
cksum2 = r_buf_read_le16_at (b, 0x7fde);
if (cksum1 == (ut16)~cksum2) {
return true;
}
if (length < 0xffee) {
return false;
}
cksum1 = r_buf_read_le16_at (b, 0xffdc);
cksum2 = r_buf_read_le16_at (b, 0xffde);
return (cksum1 == (ut16)~cksum2);
}
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *b, ut64 loadaddr, Sdb *sdb){
return check_buffer (b);
}
static RBinInfo* info(RBinFile *bf) {
sfc_int_hdr sfchdr = {{0}};
RBinInfo *ret = NULL;
int hdroffset = 0;
#if THIS_IS_ALWAYS_FALSE_WTF
if ((bf->size & 0x8000) == 0x200) {
hdroffset = 0x200;
}
#endif
int reat = r_buf_read_at (bf->buf, 0x7FC0 + hdroffset,
(ut8*)&sfchdr, SFC_HDR_SIZE);
if (reat != SFC_HDR_SIZE) {
eprintf ("Unable to read SFC/SNES header\n");
return NULL;
}
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 0) ){
// if the fixed 0x33 byte or the LoROM indication are not found, then let's try interpreting the ROM as HiROM
reat = r_buf_read_at (bf->buf, 0xFFC0 + hdroffset, (ut8*)&sfchdr, SFC_HDR_SIZE);
if (reat != SFC_HDR_SIZE) {
eprintf ("Unable to read SFC/SNES header\n");
return NULL;
}
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 1) ) {
eprintf ("Cannot determine if this is a LoROM or HiROM file\n");
return NULL;
}
}
if (!(ret = R_NEW0 (RBinInfo))) {
return NULL;
}
ret->file = strdup (bf->file);
ret->type = strdup ("ROM");
ret->machine = strdup ("Super NES / Super Famicom");
ret->os = strdup ("snes");
ret->arch = strdup ("snes");
ret->bits = 16;
ret->has_va = 1;
return ret;
}
static void addrom(RList *ret, const char *name, int i, ut64 paddr, ut64 vaddr, ut32 size) {
RBinSection *ptr = R_NEW0 (RBinSection);
if (!ptr) {
return;
}
ptr->name = r_str_newf ("%s_%02x", name, i);
ptr->paddr = paddr;
ptr->vaddr = vaddr;
ptr->size = ptr->vsize = size;
ptr->perm = R_PERM_RX;
ptr->add = true;
r_list_append (ret, ptr);
}
#if 0
static void addsym(RList *ret, const char *name, ut64 addr, ut32 size) {
RBinSymbol *ptr = R_NEW0 (RBinSymbol);
if (!ptr) {
return;
}
ptr->name = strdup (r_str_get (name));
ptr->paddr = ptr->vaddr = addr;
ptr->size = size;
ptr->ordinal = 0;
r_list_append (ret, ptr);
}
#endif
static RList* symbols(RBinFile *bf) {
return NULL;
}
static RList* sections(RBinFile *bf) {
RList *ret = NULL;
// RBinSection *ptr = NULL;
int hdroffset = 0;
bool is_hirom = false;
int i = 0; //0x8000-long bank number for loops
#if THIS_IS_ALWAYS_FALSE_WTF
if ((bf->size & 0x8000) == 0x200) {
hdroffset = 0x200;
}
#endif
sfc_int_hdr sfchdr = {{0}};
int reat = r_buf_read_at (bf->buf, 0x7FC0 + hdroffset, (ut8*)&sfchdr, SFC_HDR_SIZE);
if (reat != SFC_HDR_SIZE) {
eprintf ("Unable to read SFC/SNES header\n");
return NULL;
}
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 0) ){
// if the fixed 0x33 byte or the LoROM indication are not found, then let's try interpreting the ROM as HiROM
reat = r_buf_read_at (bf->buf, 0xFFC0 + hdroffset, (ut8*)&sfchdr, SFC_HDR_SIZE);
if (reat != SFC_HDR_SIZE) {
eprintf ("Unable to read SFC/SNES header\n");
return NULL;
}
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 1) ) {
eprintf ("Cannot determine if this is a LoROM or HiROM file\n");
return NULL;
}
is_hirom = true;
}
if (!(ret = r_list_new ())) {
return NULL;
}
if (is_hirom) {
for (i = 0; i < ((bf->size - hdroffset) / 0x8000) ; i++) {
// XXX check integer overflow here
addrom (ret, "ROM",i,hdroffset + i * 0x8000, 0x400000 + (i * 0x8000), 0x8000);
if (i % 2) {
addrom(ret, "ROM_MIRROR", i, hdroffset + i * 0x8000,(i * 0x8000), 0x8000);
}
}
} else {
for (i=0; i < ((bf->size - hdroffset)/ 0x8000) ; i++) {
addrom(ret,"ROM",i,hdroffset + i*0x8000,0x8000 + (i*0x10000), 0x8000);
}
}
return ret;
}
static RList *mem (RBinFile *bf) {
RList *ret;
RBinMem *m;
RBinMem *m_bak;
if (!(ret = r_list_new ())) {
return NULL;
}
ret->free = free;
if (!(m = R_NEW0 (RBinMem))) {
r_list_free (ret);
return NULL;
}
m->name = strdup ("LOWRAM");
m->addr = LOWRAM_START_ADDRESS;
m->size = LOWRAM_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
if (!(m = R_NEW0 (RBinMem))) {
return ret;
}
m->mirrors = r_list_new ();
m->name = strdup ("LOWRAM_MIRROR");
m->addr = LOWRAM_MIRROR_START_ADDRESS;
m->size = LOWRAM_MIRROR_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (m->mirrors, m);
m_bak = m;
if (!(m = R_NEW0 (RBinMem))) {
r_list_free (m_bak->mirrors);
return ret;
}
m->name = strdup ("HIRAM");
m->addr = HIRAM_START_ADDRESS;
m->size = HIRAM_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
if (!(m = R_NEW0 (RBinMem))) {
return ret;
}
m->name = strdup ("EXTRAM");
m->addr = EXTRAM_START_ADDRESS;
m->size = EXTRAM_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
if (!(m = R_NEW0 (RBinMem))) {
return ret;
}
m->name = strdup ("PPU1_REG");
m->addr = PPU1_REG_ADDRESS;
m->size = PPU1_REG_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
if (!(m = R_NEW0 (RBinMem))) {
r_list_free (ret);
return NULL;
}
m->name = strdup ("DSP_REG");
m->addr = DSP_REG_ADDRESS;
m->size = DSP_REG_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
if (!(m = R_NEW0 (RBinMem))) {
r_list_free (ret);
return NULL;
}
m->name = strdup ("OLDJOY_REG");
m->addr = OLDJOY_REG_ADDRESS;
m->size = OLDJOY_REG_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
if (!(m = R_NEW0 (RBinMem))) {
r_list_free (ret);
return NULL;
}
m->name = strdup ("PPU2_REG");
m->addr = PPU2_REG_ADDRESS;
m->size = PPU2_REG_SIZE;
m->perms = r_str_rwx ("rwx");
r_list_append (ret, m);
return ret;
}
static RList* entries(RBinFile *bf) { //Should be 3 offsets pointed by NMI, RESET, IRQ after mapping && default = 1st CHR
RList *ret;
if (!(ret = r_list_new ())) {
return NULL;
}
/*
RBinAddr *ptr = NULL;
if (!(ptr = R_NEW0 (RBinAddr))) {
return ret;
}
ptr->paddr = INES_HDR_SIZE;
ptr->vaddr = ROM_START_ADDRESS;
r_list_append (ret, ptr);
*/
return ret;
}
RBinPlugin r_bin_plugin_sfc = {
.name = "sfc",
.desc = "Super NES / Super Famicom ROM file",
.license = "LGPL3",
.load_buffer = &load_buffer,
.check_buffer = &check_buffer,
.entries = &entries,
.sections = sections,
.symbols = &symbols,
.info = &info,
.mem = &mem,
};
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {
.type = R_LIB_TYPE_BIN,
.data = &r_bin_plugin_sfc,
.version = R2_VERSION
};
#endif
| 24.335593 | 121 | 0.637136 |
28b850f63de53e7e792934bd791b789076da7654 | 669 | c | C | src/bin/tests/main.c | dzwdz/pansy-fork | f46f3faf50a8dca67c5402995bd3b8406fc3410b | [
"MIT"
] | 3 | 2021-04-17T18:36:41.000Z | 2022-01-02T21:03:52.000Z | src/bin/tests/main.c | dzwdz/pansy-fork | f46f3faf50a8dca67c5402995bd3b8406fc3410b | [
"MIT"
] | 1 | 2021-05-09T18:27:43.000Z | 2021-05-09T18:27:43.000Z | src/bin/tests/main.c | dzwdz/pansy-fork | f46f3faf50a8dca67c5402995bd3b8406fc3410b | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdbool.h>
// malloc.c
void test_malloc();
// printf.c
void test_sprintf();
// string.c
void test_string();
// test runners are supposed to return true on success, false on failure
struct test_runner {
char *name;
void (*fun)();
};
struct test_runner runners[] = {
{"malloc", &test_malloc},
{"sprintf", &test_sprintf},
{"string", &test_string},
{NULL, NULL}
};
int main() {
struct test_runner *current = runners;
while (current->name != NULL) {
printf(" running %s...\n", current->name);
(*current->fun)();
current++;
}
puts("all tests passed!");
return 0;
}
| 16.725 | 72 | 0.590433 |
93dbbe189b091429d20d8e37670827cf9b522099 | 227 | h | C | QMOpenApiDemo/QMOpenApiDemo/VC/PlaylistViewController.h | wszcug/WSZSDKTest | a73e7c32d8308f29f1a77a4f78d3bef3b11cfe81 | [
"MIT"
] | null | null | null | QMOpenApiDemo/QMOpenApiDemo/VC/PlaylistViewController.h | wszcug/WSZSDKTest | a73e7c32d8308f29f1a77a4f78d3bef3b11cfe81 | [
"MIT"
] | null | null | null | QMOpenApiDemo/QMOpenApiDemo/VC/PlaylistViewController.h | wszcug/WSZSDKTest | a73e7c32d8308f29f1a77a4f78d3bef3b11cfe81 | [
"MIT"
] | 1 | 2022-03-29T02:34:00.000Z | 2022-03-29T02:34:00.000Z | //
// PlaylistViewController.h
// QMOpenApiDemo
//
// Created by maczhou on 2021/10/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface PlaylistViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
| 13.352941 | 52 | 0.762115 |
13bfbf43154076ca12efb197793ed1b8eb817976 | 460 | h | C | AliyunIdentityPlatform.framework/Headers/AliyunIdentityVerifyMode.h | aliyun/aliyun_identity_platform | ba5abf82d963633cf9cab87ab95d5a3b3e074a48 | [
"MIT"
] | 1 | 2022-01-14T09:29:40.000Z | 2022-01-14T09:29:40.000Z | AliyunIdentityPlatform.framework/Headers/AliyunIdentityVerifyMode.h | aliyun/aliyun_identity_platform | ba5abf82d963633cf9cab87ab95d5a3b3e074a48 | [
"MIT"
] | 1 | 2022-01-27T05:57:35.000Z | 2022-01-27T05:57:35.000Z | AliyunIdentityPlatform.framework/Headers/AliyunIdentityVerifyMode.h | aliyun/aliyun_identity_platform | ba5abf82d963633cf9cab87ab95d5a3b3e074a48 | [
"MIT"
] | null | null | null | //
// AliyunIdentityVerifyMode.h
// AliyunIdentityPlatform
//
// Created by nansong.zxc on 2020/7/24.
// Copyright © 2020 aliyun.com. All rights reserved.
//
#ifndef AliyunIdentityVerifyMode_h
#define AliyunIdentityVerifyMode_h
/* 识别类型 */
typedef NS_ENUM(NSInteger,AliyunIdentityMode){
/** 身份证OCR识别模式 */
AliyunIdentityModeIdCardOCR = 0,
/**银行卡OCR识别模式*/
AliyunIdentityModeBankCardOCR = 1
};
#endif /* AliyunIdentityVerifyMode_h */
| 20.909091 | 53 | 0.721739 |
066a35e9126ce6eafe8b48c0bb1858b50e10f5ec | 508 | h | C | include/instructions/extIS.h | Benji377/Z80Emu | cc0d12a267e16e1c03c7cc8ef35b70ef9b582e54 | [
"Apache-2.0"
] | 1 | 2021-05-25T08:18:14.000Z | 2021-05-25T08:18:14.000Z | include/instructions/extIS.h | Benji377/Z80Emu | cc0d12a267e16e1c03c7cc8ef35b70ef9b582e54 | [
"Apache-2.0"
] | 7 | 2021-01-11T09:24:16.000Z | 2021-05-25T16:04:19.000Z | include/instructions/extIS.h | Benji377/Z80Emu | cc0d12a267e16e1c03c7cc8ef35b70ef9b582e54 | [
"Apache-2.0"
] | 2 | 2021-01-19T14:53:55.000Z | 2021-05-25T08:23:27.000Z | #ifndef __EXT_IS_H__
#define __EXT_IS_H__
class ExtIS;
#include "log.h"
#include "z80emu.h"
#include "z80emuinstruction.h"
class ExtIS{
public:
ExtIS(Z80*);
~ExtIS();
void fetch(Z80EmuInstrucion&);
void exec(Z80EmuInstrucion);
private:
Z80* z;
void p_fillArrays();
uint8_t* _opBytes;
uint8_t* _opCycles;
};
#endif | 18.142857 | 61 | 0.466535 |
7f6dd52f76390a109bcedff13b2ab3da0fcb2c73 | 7,357 | c | C | pyscf/lib/gto/fill_r_3c.c | umamibeef/pyscf | 1263d54b02914caf4476a3ed9a2de5e0c848954c | [
"Apache-2.0"
] | 501 | 2018-12-06T23:48:17.000Z | 2022-03-31T11:53:18.000Z | pyscf/lib/gto/fill_r_3c.c | fabijan5/pyscf | 09834c8f5a4f5320cdde29d285b6ccd89b3263e0 | [
"Apache-2.0"
] | 710 | 2018-11-26T22:04:52.000Z | 2022-03-30T03:53:12.000Z | pyscf/lib/gto/fill_r_3c.c | fabijan5/pyscf | 09834c8f5a4f5320cdde29d285b6ccd89b3263e0 | [
"Apache-2.0"
] | 273 | 2018-11-26T10:10:24.000Z | 2022-03-30T12:25:28.000Z | /* Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*
* Author: Qiming Sun <osirpt.sun@gmail.com>
*/
#include <stdlib.h>
#include <stdio.h>
#include <complex.h>
#include "config.h"
#include "cint.h"
#include "gto/gto.h"
/*
* out[naoi,naoj,naok,comp] in F-order
*/
void GTOr3c_fill_s1(int (*intor)(), double complex *out, double complex *buf,
int comp, int ish, int jsh,
int *shls_slice, int *ao_loc, CINTOpt *cintopt,
int *atm, int natm, int *bas, int nbas, double *env)
{
const int ish0 = shls_slice[0];
const int ish1 = shls_slice[1];
const int jsh0 = shls_slice[2];
const int jsh1 = shls_slice[3];
const int ksh0 = shls_slice[4];
const int ksh1 = shls_slice[5];
const size_t naoi = ao_loc[ish1] - ao_loc[ish0];
const size_t naoj = ao_loc[jsh1] - ao_loc[jsh0];
const size_t naok = ao_loc[ksh1] - ao_loc[ksh0];
const size_t nij = naoi * naoj;
const int dims[] = {naoi, naoj, naok};
ish += ish0;
jsh += jsh0;
const int ip = ao_loc[ish] - ao_loc[ish0];
const int jp = ao_loc[jsh] - ao_loc[jsh0];
out += jp * naoi + ip;
int ksh, k0;
int shls[3];
shls[0] = ish;
shls[1] = jsh;
for (ksh = ksh0; ksh < ksh1; ksh++) {
shls[2] = ksh;
k0 = ao_loc[ksh ] - ao_loc[ksh0];
(*intor)(out+k0*nij, dims, shls, atm, natm, bas, nbas, env, cintopt, buf);
}
}
static void zcopy_s2_igtj(double complex *out, double complex *in, int comp,
int ip, int nij, int nijk, int di, int dj, int dk)
{
const size_t dij = di * dj;
const size_t ip1 = ip + 1;
int i, j, k, ic;
double complex *pout, *pin;
for (ic = 0; ic < comp; ic++) {
for (k = 0; k < dk; k++) {
pout = out + k * nij;
pin = in + k * dij;
for (i = 0; i < di; i++) {
for (j = 0; j < dj; j++) {
pout[j] = pin[j*di+i];
}
pout += ip1 + i;
}
}
out += nijk;
in += dij * dk;
}
}
static void zcopy_s2_ieqj(double complex *out, double complex *in, int comp,
int ip, int nij, int nijk, int di, int dj, int dk)
{
const size_t dij = di * dj;
const size_t ip1 = ip + 1;
int i, j, k, ic;
double complex *pout, *pin;
for (ic = 0; ic < comp; ic++) {
for (k = 0; k < dk; k++) {
pout = out + k * nij;
pin = in + k * dij;
for (i = 0; i < di; i++) {
for (j = 0; j <= i; j++) {
pout[j] = pin[j*di+i];
}
pout += ip1 + i;
}
}
out += nijk;
in += dij * dk;
}
}
/*
* out[comp,naok,nij] in C-order
* nij = i1*(i1+1)/2 - i0*(i0+1)/2
* [ \ ]
* [**** ]
* [***** ]
* [*****. ] <= . may not be filled, if jsh-upper-bound < ish-upper-bound
* [ \]
*/
void GTOr3c_fill_s2ij(int (*intor)(), double complex *out, double complex *buf,
int comp, int ish, int jsh,
int *shls_slice, int *ao_loc, CINTOpt *cintopt,
int *atm, int natm, int *bas, int nbas, double *env)
{
const int ish0 = shls_slice[0];
const int ish1 = shls_slice[1];
const int jsh0 = shls_slice[2];
ish += ish0;
jsh += jsh0;
const int ip = ao_loc[ish];
const int jp = ao_loc[jsh] - ao_loc[jsh0];
if (ip < jp) {
return;
}
const int ksh0 = shls_slice[4];
const int ksh1 = shls_slice[5];
const int i0 = ao_loc[ish0];
const int i1 = ao_loc[ish1];
const size_t naok = ao_loc[ksh1] - ao_loc[ksh0];
const size_t off = i0 * (i0 + 1) / 2;
const size_t nij = i1 * (i1 + 1) / 2 - off;
const size_t nijk = nij * naok;
const int di = ao_loc[ish+1] - ao_loc[ish];
const int dj = ao_loc[jsh+1] - ao_loc[jsh];
out += ip * (ip + 1) / 2 - off + jp;
int ksh, dk, k0;
int shls[3];
dk = GTOmax_shell_dim(ao_loc, shls_slice, 3);
double *cache = (double *)(buf + di * dj * dk * comp);
shls[0] = ish;
shls[1] = jsh;
for (ksh = ksh0; ksh < ksh1; ksh++) {
shls[2] = ksh;
dk = ao_loc[ksh+1] - ao_loc[ksh];
k0 = ao_loc[ksh ] - ao_loc[ksh0];
(*intor)(buf, NULL, shls, atm, natm, bas, nbas, env, cintopt, cache);
if (ip != jp) {
zcopy_s2_igtj(out+k0*nij, buf, comp, ip, nij, nijk, di, dj, dk);
} else {
zcopy_s2_ieqj(out+k0*nij, buf, comp, ip, nij, nijk, di, dj, dk);
}
}
}
void GTOr3c_fill_s2jk(int (*intor)(), double complex *out, double complex *buf,
int comp, int ish, int jsh,
int *shls_slice, int *ao_loc, CINTOpt *cintopt,
int *atm, int natm, int *bas, int nbas, double *env)
{
fprintf(stderr, "GTOr3c_fill_s2jk not implemented\n");
exit(1);
}
void GTOr3c_drv(int (*intor)(), void (*fill)(), double complex *eri, int comp,
int *shls_slice, int *ao_loc, CINTOpt *cintopt,
int *atm, int natm, int *bas, int nbas, double *env)
{
const int ish0 = shls_slice[0];
const int ish1 = shls_slice[1];
const int jsh0 = shls_slice[2];
const int jsh1 = shls_slice[3];
const int nish = ish1 - ish0;
const int njsh = jsh1 - jsh0;
const int di = GTOmax_shell_dim(ao_loc, shls_slice, 3);
const int cache_size = GTOmax_cache_size(intor, shls_slice, 3,
atm, natm, bas, nbas, env);
#pragma omp parallel
{
int ish, jsh, ij;
double complex *buf = malloc(sizeof(double complex) *
(di*di*di*comp + cache_size/2));
#pragma omp for schedule(dynamic)
for (ij = 0; ij < nish*njsh; ij++) {
ish = ij / njsh;
jsh = ij % njsh;
(*fill)(intor, eri, buf, comp, ish, jsh, shls_slice, ao_loc,
cintopt, atm, natm, bas, nbas, env);
}
free(buf);
}
}
| 35.713592 | 90 | 0.47465 |
82f19d3c272b2f122b439a12231a52be44e74825 | 293 | h | C | Melrose.framework/Headers/VideoPlayerViewController.h | tapReplay/tRMelrose | af9ca6632bb51ddb2c94af09114345b64297c7a3 | [
"MIT"
] | null | null | null | Melrose.framework/Headers/VideoPlayerViewController.h | tapReplay/tRMelrose | af9ca6632bb51ddb2c94af09114345b64297c7a3 | [
"MIT"
] | null | null | null | Melrose.framework/Headers/VideoPlayerViewController.h | tapReplay/tRMelrose | af9ca6632bb51ddb2c94af09114345b64297c7a3 | [
"MIT"
] | null | null | null | //
// VideoPlayerViewController.h
//
// Created by Savalas Colbert on 7/3/16.
// Copyright © 2016 bumpTrack. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Video.h"
@interface VideoPlayerViewController : UIViewController
@property (nonatomic, strong) Video * thisVideo;
@end
| 20.928571 | 55 | 0.726962 |
d0e80ad526845fee261c60bfe31b4fd1fa277ac5 | 5,285 | c | C | openeuler-kernel/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | Ddnirvana/test-CI | dd7a0a71281075e8ab300bddbab4a9fa039958f0 | [
"MulanPSL-1.0"
] | 31 | 2021-04-27T08:50:40.000Z | 2022-03-01T02:26:21.000Z | openeuler-kernel/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | Ddnirvana/test-CI | dd7a0a71281075e8ab300bddbab4a9fa039958f0 | [
"MulanPSL-1.0"
] | 13 | 2021-07-10T04:36:17.000Z | 2022-03-03T10:50:05.000Z | openeuler-kernel/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | Ddnirvana/test-CI | dd7a0a71281075e8ab300bddbab4a9fa039958f0 | [
"MulanPSL-1.0"
] | 12 | 2021-04-06T02:23:10.000Z | 2022-02-28T11:43:19.000Z | /*
* Copyright 2015 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial busions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs <bskeggs@redhat.com>
*/
#define gm200_i2c_aux(p) container_of((p), struct gm200_i2c_aux, base)
#include "aux.h"
struct gm200_i2c_aux {
struct nvkm_i2c_aux base;
int ch;
};
static void
gm200_i2c_aux_fini(struct gm200_i2c_aux *aux)
{
struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00710000, 0x00000000);
}
static int
gm200_i2c_aux_init(struct gm200_i2c_aux *aux)
{
struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
const u32 unksel = 1; /* nfi which to use, or if it matters.. */
const u32 ureq = unksel ? 0x00100000 : 0x00200000;
const u32 urep = unksel ? 0x01000000 : 0x02000000;
u32 ctrl, timeout;
/* wait up to 1ms for any previous transaction to be done... */
timeout = 1000;
do {
ctrl = nvkm_rd32(device, 0x00d954 + (aux->ch * 0x50));
udelay(1);
if (!timeout--) {
AUX_ERR(&aux->base, "begin idle timeout %08x", ctrl);
return -EBUSY;
}
} while (ctrl & 0x07010000);
/* set some magic, and wait up to 1ms for it to appear */
nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00700000, ureq);
timeout = 1000;
do {
ctrl = nvkm_rd32(device, 0x00d954 + (aux->ch * 0x50));
udelay(1);
if (!timeout--) {
AUX_ERR(&aux->base, "magic wait %08x", ctrl);
gm200_i2c_aux_fini(aux);
return -EBUSY;
}
} while ((ctrl & 0x07000000) != urep);
return 0;
}
static int
gm200_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
u8 type, u32 addr, u8 *data, u8 *size)
{
struct gm200_i2c_aux *aux = gm200_i2c_aux(obj);
struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
const u32 base = aux->ch * 0x50;
u32 ctrl, stat, timeout, retries = 0;
u32 xbuf[4] = {};
int ret, i;
AUX_TRACE(&aux->base, "%d: %08x %d", type, addr, *size);
ret = gm200_i2c_aux_init(aux);
if (ret < 0)
goto out;
stat = nvkm_rd32(device, 0x00d958 + base);
if (!(stat & 0x10000000)) {
AUX_TRACE(&aux->base, "sink not detected");
ret = -ENXIO;
goto out;
}
if (!(type & 1)) {
memcpy(xbuf, data, *size);
for (i = 0; i < 16; i += 4) {
AUX_TRACE(&aux->base, "wr %08x", xbuf[i / 4]);
nvkm_wr32(device, 0x00d930 + base + i, xbuf[i / 4]);
}
}
ctrl = nvkm_rd32(device, 0x00d954 + base);
ctrl &= ~0x0001f1ff;
ctrl |= type << 12;
ctrl |= (*size ? (*size - 1) : 0x00000100);
nvkm_wr32(device, 0x00d950 + base, addr);
/* (maybe) retry transaction a number of times on failure... */
do {
/* reset, and delay a while if this is a retry */
nvkm_wr32(device, 0x00d954 + base, 0x80000000 | ctrl);
nvkm_wr32(device, 0x00d954 + base, 0x00000000 | ctrl);
if (retries)
udelay(400);
/* transaction request, wait up to 2ms for it to complete */
nvkm_wr32(device, 0x00d954 + base, 0x00010000 | ctrl);
timeout = 2000;
do {
ctrl = nvkm_rd32(device, 0x00d954 + base);
udelay(1);
if (!timeout--) {
AUX_ERR(&aux->base, "timeout %08x", ctrl);
ret = -EIO;
goto out;
}
} while (ctrl & 0x00010000);
ret = 0;
/* read status, and check if transaction completed ok */
stat = nvkm_mask(device, 0x00d958 + base, 0, 0);
if ((stat & 0x000f0000) == 0x00080000 ||
(stat & 0x000f0000) == 0x00020000)
ret = 1;
if ((stat & 0x00000100))
ret = -ETIMEDOUT;
if ((stat & 0x00000e00))
ret = -EIO;
AUX_TRACE(&aux->base, "%02d %08x %08x", retries, ctrl, stat);
} while (ret && retry && retries++ < 32);
if (type & 1) {
for (i = 0; i < 16; i += 4) {
xbuf[i / 4] = nvkm_rd32(device, 0x00d940 + base + i);
AUX_TRACE(&aux->base, "rd %08x", xbuf[i / 4]);
}
memcpy(data, xbuf, *size);
*size = stat & 0x0000001f;
}
out:
gm200_i2c_aux_fini(aux);
return ret < 0 ? ret : (stat & 0x000f0000) >> 16;
}
static const struct nvkm_i2c_aux_func
gm200_i2c_aux_func = {
.address_only = true,
.xfer = gm200_i2c_aux_xfer,
};
int
gm200_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive,
struct nvkm_i2c_aux **paux)
{
struct gm200_i2c_aux *aux;
if (!(aux = kzalloc(sizeof(*aux), GFP_KERNEL)))
return -ENOMEM;
*paux = &aux->base;
nvkm_i2c_aux_ctor(&gm200_i2c_aux_func, pad, index, &aux->base);
aux->ch = drive;
aux->base.intr = 1 << aux->ch;
return 0;
}
| 28.722826 | 77 | 0.664144 |
aaef8930b315fc8a1f31218364986856539d1957 | 263 | h | C | MixedErrorLog/Classes/ObjcErrorLog.h | cweymann/MixedErrorLog-Demo | c04577ed6d41839db12fa602f8e32682bb418210 | [
"MIT"
] | 1 | 2021-04-29T06:50:37.000Z | 2021-04-29T06:50:37.000Z | MixedErrorLog/Classes/ObjcErrorLog.h | cweymann/MixedErrorLog-Demo | c04577ed6d41839db12fa602f8e32682bb418210 | [
"MIT"
] | null | null | null | MixedErrorLog/Classes/ObjcErrorLog.h | cweymann/MixedErrorLog-Demo | c04577ed6d41839db12fa602f8e32682bb418210 | [
"MIT"
] | 1 | 2021-04-29T06:50:41.000Z | 2021-04-29T06:50:41.000Z | //
// ObjcErrorLog.h
//
// Created by Claus Weymann on 23.07.19.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ObjcErrorLog : NSObject
+(void)error:(NSString*)message;
+(void)xerror:(NSString*)message;
@end
NS_ASSUME_NONNULL_END
| 13.842105 | 41 | 0.737643 |
65d72f757fec8ef82c81efda6f362fe452b3f967 | 53,590 | h | C | include/gui/xcb/mip_xcb_window.h | LoTek2/MIP2 | d77c103f5b30e974dbac22ac0eaadb9204aaf144 | [
"MIT"
] | 5 | 2022-01-05T16:51:38.000Z | 2022-02-07T15:14:38.000Z | include/gui/xcb/mip_xcb_window.h | LoTek2/MIP2 | d77c103f5b30e974dbac22ac0eaadb9204aaf144 | [
"MIT"
] | null | null | null | include/gui/xcb/mip_xcb_window.h | LoTek2/MIP2 | d77c103f5b30e974dbac22ac0eaadb9204aaf144 | [
"MIT"
] | 1 | 2022-03-11T21:00:22.000Z | 2022-03-11T21:00:22.000Z | #ifndef mip_xcb_window_included
#define mip_xcb_window_included
//----------------------------------------------------------------------
/*
TODO:
invalidate: send user/client message somehow, with rect and widget,
so we can optimize redrawing.. draw only from widget and downwards
(skipping opaque widgets that fill the entire update rect), so we
don't have to draw everything from the window/background and up..
*/
//----------------------------------------------------------------------
#include "mip.h"
#include "base/system/mip_time.h"
#include "base/types/mip_color.h"
#include "gui/mip_drawable.h"
//#include "gui/mip_widget.h"
#include "gui/xcb/mip_xcb.h"
#include "gui/xcb/mip_xcb_utils.h"
#ifdef MIP_USE_CAIRO
#include "gui/cairo/mip_cairo.h"
#endif
#include "gui/mip_drawable.h"
#include "gui/base/mip_base_window.h"
//#include "gui/xcb/mip_xcb.h"
//#include "gui/xcb/mip_xcb_utils.h"
// pid_t _mip_xcb_event_thread_pid = 0;
// pid_t _mip_xcb_event_thread_tid = 0;
//----------------------------------------------------------------------
class MIP_XcbWindow
: public MIP_BaseWindow
, public MIP_Drawable {
//------------------------------
protected:
//------------------------------
int32_t MWindowWidth = 0;
int32_t MWindowHeight = 0;
//------------------------------
private:
//------------------------------
xcb_connection_t* MConnection = nullptr;
xcb_screen_t* MScreen = nullptr;
uint32_t MScreenNum = 0;
uint32_t MScreenWidth = 0;
uint32_t MScreenHeight = 0;
uint32_t MScreenDepth = 0;
xcb_window_t MScreenWindow = XCB_NONE;
xcb_drawable_t MScreenDrawable = XCB_NONE;
xcb_gcontext_t MScreenGC = XCB_NONE;
xcb_visualid_t MScreenVisual = XCB_NONE;
xcb_colormap_t MScreenColormap = XCB_NONE;
xcb_window_t MWindow = XCB_NONE;
//xcb_window_t MWindowParent = XCB_NONE;
int32_t MWindowXpos = 0;
int32_t MWindowYpos = 0;
// int32_t MWindowWidth = 0;
// int32_t MWindowHeight = 0;
bool MWindowMapped = false;
bool MWindowExposed = false;
//bool MWindowIsMoving = false;
//bool MWindowIsResizing = false;
//bool MWindowIsPainting = false;
xcb_atom_t MWMProtocolsAtom = XCB_NONE; // KWantQuitEvents
xcb_atom_t MWMDeleteWindowAtom = XCB_NONE; // KWantQuitEvents
char* MExposeEventBuffer[32] = {0};
char* MClientMessageEventBuffer[32] = {0};
xcb_expose_event_t* MExposeEvent = (xcb_expose_event_t*)MExposeEventBuffer;
xcb_client_message_event_t* MClientMessageEvent = (xcb_client_message_event_t*)MClientMessageEventBuffer;
xcb_pixmap_t MEmptyPixmap = XCB_NONE;
xcb_cursor_t MHiddenCursor = XCB_NONE;
xcb_cursor_t MWindowCursor = XCB_NONE;
bool MCursorHidden = false;
xcb_key_symbols_t* MKeySyms = nullptr;
// pthread_t MTimerThread = 0;
// bool MTimerThreadActive = false;
// int32_t MTimerSleep = 20; // 20 ms = 50 hz
pthread_t MEventThread = 0;
bool MEventThreadActive = false;
bool MQuitEventLoop = false;
//bool MUseEventThread = false;
bool MEmbedded = false;
// bool MFillBackground = false;//true;
// MIP_Color MBackgroundColor = MIP_Color(0.5);
#ifdef MIP_USE_CAIRO
cairo_surface_t* MCairoSurface = nullptr;
cairo_device_t* MCairoDevice = nullptr;
#endif
//------------------------------
private:
//------------------------------
/*
cursors = (
('X_cursor', 0),
('arrow', 2),
('based_arrow_down', 4),
('based_arrow_up', 6),
('boat', 8),
('bogosity', 10),
('bottom_left_corner', 12),
('bottom_right_corner', 14),
('bottom_side', 16),
('bottom_tee', 18),
('box_spiral', 20),
('center_ptr', 22),
('circle', 24),
('clock', 26),
('coffee_mug', 28),
('cross', 30),
('cross_reverse', 32),
('crosshair', 34),
('diamond_cross', 36),
('dot', 38),
('dotbox', 40),
('double_arrow', 42),
('draft_large', 44),
('draft_small', 46),
('draped_box', 48),
('exchange', 50),
('fleur', 52),
('gobbler', 54),
('gumby', 56),
('hand1', 58),
('hand2', 60),
('heart', 62),
('icon', 64),
('iron_cross', 66),
('left_ptr', 68),
('left_side', 70),
('left_tee', 72),
('leftbutton', 74),
('ll_angle', 76),
('lr_angle', 78),
('man', 80),
('middlebutton', 82),
('mouse', 84),
('pencil', 86),
('pirate', 88),
('plus', 90),
('question_arrow', 92),
('right_ptr', 94),
('right_side', 96),
('right_tee', 98),
('rightbutton', 100),
('rtl_logo', 102),
('sailboat', 104),
('sb_down_arrow', 106),
('sb_h_double_arrow', 108),
('sb_left_arrow', 110),
('sb_right_arrow', 112),
('sb_up_arrow', 114),
('sb_v_double_arrow', 116),
('shuttle', 118),
('sizing', 120),
('spider', 122),
('spraycan', 124),
('star', 126),
('target', 128),
('tcross', 130),
('top_left_arrow', 132),
('top_left_corner', 134),
('top_right_corner', 136),
('top_side', 138),
('top_tee', 140),
('trek', 142),
('ul_angle', 144),
('umbrella', 146),
('ur_angle', 148),
('watch', 150),
('xterm', 152)
)
*/
const char* MIP_XCB_WM_CURSORS[20] = {
"left_ptr", // 0 MIP_CURSOR_DEFAULT
"left_ptr", // MIP_CURSOR_ARROW
"sb_up_arrow", // MIP_CURSOR_ARROWUP
"sb_down_arrow", // MIP_CURSOR_ARROWDOWN
"sb_left_arrow", // MIP_CURSOR_ARROWLEFT
"sb_right_arrow", // MIP_CURSOR_ARROWRIGHT
"sb_v_double_arrow", // MIP_CURSOR_ARROWUPDOWN
"sb_h_double_arrow", // MIP_CURSOR_ARROWLEFTRIGHT
"bottom_left_corner", // MIP_CURSOR_ARROWDIAGLEFT
"bottom_right_corner", // MIP_CURSOR_ARROWDIAGRIGHT
"fleur", // MIP_CURSOR_MOVE
"watch", // MIP_CURSOR_WAIT
"clock", // MIP_CURSOR_ARROWWAIT
"hand2", // MIP_CURSOR_HAND
"hand1", // MIP_CURSOR_FINGER
"crosshair", // MIP_CURSOR_CROSS
"pencil", // MIP_CURSOR_PENCIL
"plus", // MIP_CURSOR_PLUS
"question_arrow", // MIP_CURSOR_QUESTION
"xterm" // MIP_CURSOR_IBEAM
};
//------------------------------
public:
//------------------------------
MIP_XcbWindow(uint32_t AWidth, uint32_t AHeight, bool AEmbedded)
: MIP_BaseWindow(AWidth,AHeight) {
MName = "MIP_XcbWindow";
MEmbedded = AEmbedded;// ? true : false;
connect();
initGC();
createWindow(AWidth,AHeight,AEmbedded);
initMouseCursor();
initKeyboard();
initThreads();
xcb_flush(MConnection);
#ifdef MIP_USE_CAIRO
MCairoSurface = cairo_xcb_surface_create(
MConnection,
MWindow,
mip_xcb_find_visual(MConnection,MScreenVisual),
MWindowWidth,
MWindowHeight
);
MCairoDevice = cairo_device_reference(cairo_surface_get_device(MCairoSurface));
#endif
}
//----------
virtual ~MIP_XcbWindow() {
cleanupThreads();
#ifdef MIP_USE_CAIRO
cairo_surface_destroy(MCairoSurface);
cairo_device_finish(MCairoDevice);
cairo_device_destroy(MCairoDevice);
#endif
cleanupKeyboard();
cleanupMouseCursor();
destroyWindow();
cleanupGC();
disconnect();
}
//------------------------------
public:
//------------------------------
// void setFillBackground(bool f=true) { MFillBackground = f; }
// void setBackgroundColor(MIP_Color c) { MBackgroundColor = c; }
xcb_screen_t* getXcbScreen() { return MScreen; }
//------------------------------
public: // drawable
//------------------------------
bool isWindow() final { return true; }
bool isDrawable() final { return true; }
uint32_t getWidth() final { return MWindowWidth; }
uint32_t getHeight() final { return MWindowHeight; }
uint32_t getDepth() final { return MScreenDepth; }
xcb_window_t getXcbWindow() final { return MWindow; }
xcb_drawable_t getXcbDrawable() final { return MWindow; }
xcb_connection_t* getXcbConnection() final { return MConnection; }
xcb_visualid_t getXcbVisual() final { return MScreenVisual; }
#ifdef MIP_USE_CAIRO
bool isCairo() final { return true; }
cairo_surface_t* getCairoSurface() final { return MCairoSurface; }
// cairo_surface_t* createCairoSurface() final {
// cairo_surface_t* surface = cairo_xcb_surface_create(
// MConnection,
// MWindow,
// mip_xcb_find_visual(MConnection,MScreenVisual),
// MWindowWidth,
// MWindowHeight
// );
// return surface;
// }
#endif
//------------------------------
private:
//------------------------------
void connect() {
int screen_num;
MConnection = xcb_connect(nullptr,&screen_num);
xcb_screen_iterator_t iter;
iter = xcb_setup_roots_iterator(xcb_get_setup(MConnection));
for (; iter.rem; --screen_num, xcb_screen_next(&iter)) {
if (screen_num == 0) {
MScreen = iter.data;
break;
}
}
MScreenNum = screen_num;
MScreenWidth = MScreen->width_in_pixels;
MScreenHeight = MScreen->height_in_pixels;
MScreenDepth = MScreen->root_depth;
MScreenWindow = MScreen->root;
MScreenColormap = MScreen->default_colormap;
MScreenVisual = MScreen->root_visual;
MScreenDrawable = MScreen->root;
//MScreenGC = xcb_generate_id(MConnection);
}
//----------
void disconnect() {
//xcb_free_gc(MConnection,MScreenGC);
xcb_disconnect(MConnection);
}
//----------
void initGC() {
MScreenGC = xcb_generate_id(MConnection);
xcb_drawable_t draw = MScreen->root;
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
uint32_t values[2];
values[0] = MScreen->black_pixel;
values[1] = MScreen->white_pixel;
xcb_create_gc(MConnection, MScreenGC, draw, mask, values);
}
//----------
void cleanupGC() {
xcb_free_gc(MConnection,MScreenGC);
}
//----------
void createWindow(uint32_t AWidth, uint32_t AHeight, bool AEmbedded) {
uint32_t event_mask =
XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_KEY_RELEASE |
XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW |
XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_EXPOSURE |
//XCB_EVENT_MASK_RESIZE_REDIRECT |
XCB_EVENT_MASK_STRUCTURE_NOTIFY;
uint32_t window_mask =
XCB_CW_BACK_PIXMAP |
XCB_CW_BORDER_PIXEL |
XCB_CW_EVENT_MASK |
XCB_CW_COLORMAP;
uint32_t window_mask_values[4] = {
XCB_NONE,
0,
event_mask,
MScreen->default_colormap
};
MWindow = xcb_generate_id(MConnection);
xcb_create_window(
MConnection, // connection
XCB_COPY_FROM_PARENT, // depth (same as root)
MWindow, // window Id
MScreen->root,//MWindowParent, // parent window
0, 0, // x, y
AWidth, AHeight, // width, height
0, // border_width
XCB_WINDOW_CLASS_INPUT_OUTPUT, // class
MScreen->root_visual, // visual
window_mask,
window_mask_values
);
if (AEmbedded) {
//reparent(AParent);
removeDecorations();
}
else {
//setWindowTitle(ATitle);
wantDeleteWindowEvent();
}
MWindowXpos = 0;
MWindowYpos = 0;
MWindowWidth = AWidth;
MWindowHeight = AHeight;
}
//----------
void destroyWindow() {
xcb_destroy_window(MConnection,MWindow);
}
//----------
/*
const uint32_t values[] ={true,};
xcb_change_window_attributes (connection, window, XCB_CW_OVERRIDE_REDIRECT, values);
*/
//void changeWindowAttributes(uint32_t value_mask, const uint32_t* value_list) {
// xcb_void_cookie_t res = xcb_change_window_attributes(MConnection,MWindow,value_mask,value_list);
//}
//----------
void initMouseCursor() {
MEmptyPixmap = xcb_generate_id(MConnection);
MHiddenCursor = xcb_generate_id(MConnection);
xcb_create_pixmap(
MConnection,
1,
MEmptyPixmap,
MWindow,
1,
1
);
xcb_create_cursor(
MConnection,
MHiddenCursor,
MEmptyPixmap,
MEmptyPixmap,
0, 0, 0, // fore color
0, 0, 0, // back color
0, 0 // x,y
);
}
//----------
void cleanupMouseCursor() {
xcb_free_pixmap(MConnection, MEmptyPixmap);
xcb_free_cursor(MConnection,MHiddenCursor);
if (MWindowCursor != XCB_NONE) xcb_free_cursor(MConnection,MWindowCursor);
}
//----------
void initKeyboard() {
MKeySyms = xcb_key_symbols_alloc(MConnection);
}
//----------
void cleanupKeyboard() {
xcb_key_symbols_free(MKeySyms);
}
//----------
void initThreads() {
//MTimerThread = 0;
//MTimerThreadActive = false;
//MTimerSleep = 30;
//#ifndef MIP_XCB_NO_EVENT_THREAD
MEventThread = 0;
MEventThreadActive = false;
//#endif
}
//----------
void cleanupThreads() {
//if (MTimerThreadActive) stopTimer();
//#ifndef MIP_XCB_NO_EVENT_THREAD
if (MEventThreadActive) stopEventThread();
//#endif
}
static const unsigned long MWM_HINTS_FUNCTIONS = 1 << 0;
static const unsigned long MWM_HINTS_DECORATIONS = 1 << 1;
//static const unsigned long MWM_DECOR_ALL = 1 << 0;
static const unsigned long MWM_DECOR_BORDER = 1 << 1;
static const unsigned long MWM_DECOR_RESIZEH = 1 << 2;
static const unsigned long MWM_DECOR_TITLE = 1 << 3;
static const unsigned long MWM_DECOR_MENU = 1 << 4;
static const unsigned long MWM_DECOR_MINIMIZE = 1 << 5;
static const unsigned long MWM_DECOR_MAXIMIZE = 1 << 6;
//static const unsigned long MWM_FUNC_ALL = 1 << 0;
static const unsigned long MWM_FUNC_RESIZE = 1 << 1;
static const unsigned long MWM_FUNC_MOVE = 1 << 2;
static const unsigned long MWM_FUNC_MINIMIZE = 1 << 3;
static const unsigned long MWM_FUNC_MAXIMIZE = 1 << 4;
static const unsigned long MWM_FUNC_CLOSE = 1 << 5;
struct WMHints {
uint32_t flags;
uint32_t functions;
uint32_t decorations;
int32_t inputMode;
uint32_t state;
};
//----------
void removeDecorations() {
xcb_atom_t prop = mip_xcb_get_intern_atom(MConnection,"_MOTIF_WM_HINTS");
if (prop) {
WMHints hints;
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = 0;
const unsigned char* ptr = (const unsigned char*)(&hints);
xcb_change_property(
MConnection,
XCB_PROP_MODE_REPLACE,
MWindow,
prop, // hintsAtomReply->atom,
prop, // XCB_ATOM_WM_HINTS,
32,
5, // PROP_MOTIF_WM_HINTS_ELEMENTS
ptr
);
}
}
//----------
void wantDeleteWindowEvent() {
xcb_intern_atom_cookie_t protocol_cookie = xcb_intern_atom_unchecked(MConnection, 1, 12, "WM_PROTOCOLS");
xcb_intern_atom_cookie_t close_cookie = xcb_intern_atom_unchecked(MConnection, 0, 16, "WM_DELETE_WINDOW");
xcb_intern_atom_reply_t* protocol_reply = xcb_intern_atom_reply(MConnection, protocol_cookie, 0);
xcb_intern_atom_reply_t* close_reply = xcb_intern_atom_reply(MConnection, close_cookie, 0);
MWMProtocolsAtom = protocol_reply->atom;
MWMDeleteWindowAtom = close_reply->atom;
//xcb_change_property(MConnection, XCB_PROP_MODE_REPLACE, MWindow, protocol_reply->atom, 4, 32, 1, &MDeleteWindowAtom);
xcb_change_property(MConnection, XCB_PROP_MODE_REPLACE, MWindow, MWMProtocolsAtom, 4, 32, 1, &MWMDeleteWindowAtom);
//xcb_flush(MConnection);
free(protocol_reply); // note malloc'ed ??
free(close_reply);
}
//----------
/*
xcb_wait_for_event() doesn't flush
have we flushed already?
when we create the window?
when we open it?
*/
void waitForMapNotify() {
xcb_flush(MConnection);
while (1) {
xcb_generic_event_t* event;
event = xcb_wait_for_event(MConnection);
uint8_t e = event->response_type & ~0x80;
free(event); // not malloc'ed
if (e == XCB_MAP_NOTIFY) break;
}
}
//----------
void startEventThread() {
MEventThreadActive = true;
pthread_create(&MEventThread,nullptr,xcb_event_thread_proc,this);
}
//----------
void stopEventThread() {
void* ret;
MEventThreadActive = false;
//sendEvent(MIP_THREAD_ID_KILL,0);
sendClientMessage(MIP_THREAD_ID_KILL,0);
pthread_join(MEventThread,&ret);
}
//----------
void quitEventLoop() {
MQuitEventLoop = true;
}
//----------
uint32_t remapButton(uint32_t AButton, uint32_t AState) {
//XCB_Print("xcb: remapButton AButton %i AState %i\n",AButton,AState);
//MIP_Print("remapButton AButton %i AState %i\n",AButton,AState);
uint32_t b = AButton;
return b;
}
//----------
// https://github.com/etale-cohomology/xcb/blob/master/loop.c
uint32_t remapKey(uint32_t AKey, uint32_t AState) {
//XCB_Print("xcb: remapKey AKey %i AState %i\n",AKey,AState);
//uint32_t k = AKey;
int col = 0;
xcb_keysym_t keysym = xcb_key_symbols_get_keysym(MKeySyms,AKey,col);
//xcb_keycode_t* keycode = xcb_key_symbols_get_keycode(MKeySyms,keysym);
//MIP_Print("AKey %i AState %i keysym %i keycode %i\n",AKey,AState,keysym,keycode[0]);
//free(keycode);
return keysym;
}
//----------
uint32_t remapState(uint32_t AState) {
//XCB_Print("xcb: remapState AState %i\n",AState);
uint32_t s = MIP_KEY_NONE;
if (AState & XCB_MOD_MASK_SHIFT) s += MIP_KEY_SHIFT;
if (AState & XCB_MOD_MASK_LOCK) s += MIP_KEY_CAPS;
if (AState & XCB_MOD_MASK_CONTROL) s += MIP_KEY_CTRL;
if (AState & XCB_MOD_MASK_1) s += MIP_KEY_ALT;
if (AState & XCB_MOD_MASK_5) s += MIP_KEY_ALTGR;
//if (AState & XCB_MOD_MASK_1) MIP_Print("1\n");
//if (AState & XCB_MOD_MASK_2) MIP_Print("2\n");
//if (AState & XCB_MOD_MASK_3) MIP_Print("3\n");
//if (AState & XCB_MOD_MASK_4) MIP_Print("4\n");
//if (AState & XCB_MOD_MASK_5) MIP_Print("5\n");
return s;
}
//----------
void freeXcbCursor(void) {
if (MWindowCursor != XCB_NONE) {
xcb_free_cursor(MConnection,MWindowCursor);
MWindowCursor = XCB_NONE;
//xcb_flush(MConnection);
}
}
//----------
void setXcbCursor(xcb_cursor_t ACursor) {
uint32_t mask;
uint32_t values;
mask = XCB_CW_CURSOR;
values = ACursor;
xcb_change_window_attributes(MConnection,MWindow,mask,&values);
// without xcb_flush, the mouse cursor wasn't updating properly (standalone)..
xcb_flush(MConnection);
}
//----------
void setWMCursor(uint32_t ACursor) {
xcb_cursor_context_t *ctx;
if (xcb_cursor_context_new(MConnection, MScreen, &ctx) >= 0) {
const char* name = MIP_XCB_WM_CURSORS[ACursor];
xcb_cursor_t cursor = xcb_cursor_load_cursor(ctx, name);
if (cursor != XCB_CURSOR_NONE) {
xcb_change_window_attributes(MConnection, MWindow, XCB_CW_CURSOR, &cursor);
}
}
xcb_cursor_context_free(ctx);
xcb_flush(MConnection);
}
//------------------------------
private:
//------------------------------
void eventHandler(xcb_generic_event_t* AEvent) {
switch (AEvent->response_type & ~0x80) {
//----------
case XCB_MAP_NOTIFY: {
//xcb_map_notify_event_t* map_notify = (xcb_map_notify_event_t*)AEvent;
MWindowMapped = true;
//on_window_open();
break;
}
//----------
case XCB_UNMAP_NOTIFY: {
//xcb_unmap_notify_event_t* unmap_notify = (xcb_unmap_notify_event_t*)AEvent;
MWindowMapped = false;
//on_window_close();
break;
}
//----------
case XCB_CONFIGURE_NOTIFY: {
xcb_configure_notify_event_t* configure_notify = (xcb_configure_notify_event_t*)AEvent;
int32_t x = configure_notify->x;
int32_t y = configure_notify->y;
int32_t w = configure_notify->width;
int32_t h = configure_notify->height;
//MIP_Print("XCB_CONFIGURE_NOTIFY. event_x:%i event_y:%i width:%i height:%i\n",x,y,w,h);
//MIP_Print("%i,%i\n",w,h);
// use last event only..
//while (XCheckTypedWindowEvent(mDisplay, ev->xconfigure.window, ConfigureNotify, ev))
//{
// w = ev->xconfigure.width;
// h = ev->xconfigure.height;
//}
if ((x != MWindowXpos) || (y != MWindowYpos)) {
//if (MWindowIsMoving) { MIP_Print("ouch! we're already moving\n"); }
//MWindowIsMoving = true;
MWindowXpos = x;
MWindowYpos = y;
on_window_move(x,y);
//MWindowIsMoving = false;
}
if ((w != MWindowWidth) || (h != MWindowHeight)) {
//if (MWindowIsResizing) { MIP_Print("ouch! we're already resizing\n"); }
//MWindowIsResizing = true;
MWindowWidth = w;
MWindowHeight = h;
on_window_resize(w,h);
//MWindowIsResizing = false;
}
break;
}
//----------
case XCB_EXPOSE: {
MWindowExposed = true;
MIP_FRect r;
xcb_expose_event_t* expose = (xcb_expose_event_t *)AEvent;
r.x = expose->x;
r.y = expose->y;
r.w = expose->width;
r.h = expose->height;
//MIP_FRect RECT = MIP_FRect(x,y,w,h);
//MIP_Print("XCB_EXPOSE_NOTIFY. event_x:%i event_y:%i width:%i height:%i\n",x,y,w,h);
// https://cairographics.org/cookbook/xcbsurface.c/
// Avoid extra redraws by checking if this is the last expose event in the sequence
//if (expose->count != 0) break;
//while(expose->count != 0) {
// xcb_generic_event_t* e2 = xcb_wait_for_event(MConnection);
// xcb_expose_event_t* ex2 = (xcb_expose_event_t *)e2;
// r.combine( MIP_FRect( ex2->x, ex2->y, ex2->width, ex2->height ) );
//}
if ((r.w < 1) || (r.h < 1)) {
}
else {
//if (MWindowIsPainting) { MIP_Print("ouch! we're already painting\n"); }
//MWindowIsPainting = true;
beginPaint();
paint(r.x,r.y,r.w,r.h);
endPaint();
//MWindowIsPainting = false;
}
break;
}
//----------
//s = AEvent->xkey.state;
//XLookupString(&AEvent->xkey, c, 1, &keysym, NULL);
//k = remapKey(keysym);
/*
// wrapper to get xcb keysymbol from keycode
static xcb_keysym_t xcb_get_keysym(xcb_keycode_t keycode) {
xcb_key_symbols_t *keysyms;
if (!(keysyms = xcb_key_symbols_alloc(conn))) return 0;
xcb_keysym_t keysym = xcb_key_symbols_get_keysym(keysyms, keycode, 0);
xcb_key_symbols_free(keysyms);
return keysym;
}
*/
case XCB_KEY_PRESS: {
xcb_key_press_event_t* key_press = (xcb_key_press_event_t*)AEvent;
uint32_t k = remapKey( key_press->detail, key_press->state );
uint32_t s = remapState( key_press->state );
uint32_t ts = key_press->time;
//int32_t x = key_press->event_x;
//int32_t y = key_press->event_y;
on_window_keyPress(k,s,ts);
break;
}
//----------
case XCB_KEY_RELEASE: {
xcb_key_release_event_t* key_release = (xcb_key_release_event_t*)AEvent;
uint32_t k = remapKey( key_release->detail, key_release->state );
uint32_t s = remapState( key_release->state );
uint32_t ts = key_release->time;
//int32_t x = key_release->event_x;
//int32_t y = key_release->event_y;
on_window_keyRelease(k,s,ts);
break;
}
//----------
case XCB_BUTTON_PRESS: {
xcb_button_press_event_t* button_press = (xcb_button_press_event_t*)AEvent;
uint32_t b = remapButton( button_press->detail, button_press->state );
uint32_t s = remapState( button_press->state );
int32_t x = button_press->event_x;
int32_t y = button_press->event_y;
uint32_t ts = button_press->time;
on_window_mouseClick(x,y,b,s,ts);
break;
}
//----------
case XCB_BUTTON_RELEASE: {
xcb_button_release_event_t* button_release = (xcb_button_release_event_t*)AEvent;
uint32_t b = remapButton( button_release->detail, button_release->state );
uint32_t s = remapState( button_release->state );
int32_t x = button_release->event_x;
int32_t y = button_release->event_y;
uint32_t ts = button_release->time;
on_window_mouseRelease(x,y,b,s,ts);
break;
}
//----------
case XCB_MOTION_NOTIFY: {
xcb_motion_notify_event_t* motion_notify = (xcb_motion_notify_event_t*)AEvent;
//uint32_t b = motion_notify->detail;
uint32_t s = remapState( motion_notify->state );
int32_t x = motion_notify->event_x;
int32_t y = motion_notify->event_y;
uint32_t ts = motion_notify->time;
//MIP_Print("XCB_MOTION_NOTIFY. state:%i event_x:%i event_y:%i time:%i\n",s,x,y,ts);
on_window_mouseMove(x,y,s,ts);
break;
}
//----------
case XCB_ENTER_NOTIFY: {
//#ifdef MIP_DEBUG_XCB
xcb_enter_notify_event_t* enter_notify = (xcb_enter_notify_event_t*)AEvent;
//uint32_t t = enter_notify->time;
//uint32_t m = enter_notify->mode;
//uint32_t s = enter_notify->state;
int32_t x = enter_notify->event_x;
int32_t y = enter_notify->event_y;
uint32_t ts = enter_notify->time;
//MIP_Print("XCB_ENTER_NOTIFY. event_x:%i event_y:%i time:%i\n",x,y,ts);
//#endif
on_window_mouseEnter(x,y,ts);
break;
}
case XCB_LEAVE_NOTIFY: {
//#ifdef MIP_DEBUG_XCB
xcb_leave_notify_event_t* leave_notify = (xcb_leave_notify_event_t*)AEvent;
//uint32_t t = leave_notify->time;
//uint32_t m = leave_notify->mode;
//uint32_t s = leave_notify->state;
int32_t x = leave_notify->event_x;
int32_t y = leave_notify->event_y;
uint32_t ts = leave_notify->time;
//xcb_window_t parent = leave_notify->event;
//MIP_Print("XCB_LEAVE_NOTIFY. event_x:%i event_y:%i time:%i\n",x,y,ts);
//#endif
on_window_mouseLeave(x,y,ts);
break;
}
//----------
case XCB_CLIENT_MESSAGE: {
xcb_client_message_event_t* client_message = (xcb_client_message_event_t*)AEvent;
//xcb_atom_t type = client_message->type;
uint32_t data = client_message->data.data32[0];
switch(data) {
case MIP_THREAD_ID_TIMER:
on_window_timer();
break;
case MIP_THREAD_ID_IDLE:
if (MWindowMapped && MWindowExposed) {
on_window_idle();
}
break;
default:
on_window_clientMessage(data,nullptr);
break;
}
break;
}
//----------
//case XCB_PROPERTY_NOTIFY: {
// xcb_property_notify_event_t* property_notify = (xcb_property_notify_event_t*)AEvent;
// xcb_atom_t a = property_notify->atom;
////xcb_timestamp_t t = property_notify->time;
////uint32_t s = property_notify->state;
// char buffer1[256];
// char* name = buffer1;
// bool ok1 = getAtomName(a,&name);
// char buffer2[256];
// char* property = buffer2;
// xcb_atom_t type = XCB_ATOM;
// switch (a) {
// case XCB_ATOM_WM_NAME:
// type = XCB_ATOM_STRING;
// break;
// }
// bool ok2 = getAtomProperty(a,type,&property);
// XCB_Print("XCB_PROPERTY_NOTIFY (%i) %s %s\n",a,ok1 ? name : "---", ok2 ? property : "---" );
// break;
//}
//----------
//case XCB_FOCUS_IN: {
// xcb_focus_in_event_t* focus_in = (xcb_focus_in_event_t*)AEvent;
// XCB_Print("XCB_FOCUS_IN\n");
// //on_window_focus(true);
// break;
//}
//case XCB_FOCUS_OUT: {
// xcb_focus_out_event_t* focus_out = (xcb_focus_out_event_t*)AEvent;
// XCB_Print("XCB_FOCUS_OUT\n");
// //on_window_focus(false);
// break;
//}
//case XCB_KEYMAP_NOTIFY: {
// xcb_keymap_notify_event_t* keymap_notify = (xcb_keymap_notify_event_t*)AEvent;
// XCB_Print("XCB_KEYMAP_NOTIFY\n");
// break;
//}
//case XCB_GRAPHICS_EXPOSURE: {
// xcb_graphics_exposure_event_t *graphics_exposure = (xcb_graphics_exposure_event_t *)AEvent;
// XCB_Print("XCB_GRAPHICS_EXPOSURE\n");
// break;
//}
//case XCB_NO_EXPOSURE: {
// xcb_no_exposure_event_t *no_exposure = (xcb_no_exposure_event_t *)AEvent;
// XCB_Print("XCB_NO_EXPOSURE\n");
// break;
//}
//case XCB_VISIBILITY_NOTIFY: {
// xcb_visibility_notify_event_t *visibility_notify = (xcb_visibility_notify_event_t *)AEvent;
// XCB_Print("XCB_VISIBILITY_NOTIFY\n");
// break;
//}
//case XCB_CREATE_NOTIFY: {
// xcb_create_notify_event_t* create_notify = (xcb_create_notify_event_t*)AEvent;
// XCB_Print("XCB_CREATE_NOTIFY\n");
// break;
//}
//case XCB_DESTROY_NOTIFY: {
// xcb_destroy_notify_event_t* destroy_notify = (xcb_destroy_notify_event_t*)AEvent;
// XCB_Print("XCB_DESTROY_NOTIFY\n");
// break;
//}
//case XCB_MAP_REQUEST: {
// xcb_map_request_event_t* map_request = (xcb_map_request_event_t*)AEvent;
// XCB_Print("XCB_MAP_REQUEST\n");
// break;
//}
//case XCB_REPARENT_NOTIFY: {
// //xcb_reparent_notify_event_t* reparent_notify = (xcb_reparent_notify_event_t*)AEvent;
// XCB_Print("XCB_REPARENT_NOTIFY\n");
// break;
//}
//case XCB_CONFIGURE_REQUEST: {
// xcb_configure_request_event_t* configure_request = (xcb_configure_request_event_t*)AEvent;
// XCB_Print("XCB_CONFIGURE_REQUEST\n");
// break;
//}
//case XCB_GRAVITY_NOTIFY: {
// xcb_gravity_notify_event_t* gravity_notify = (xcb_gravity_notify_event_t*)AEvent;
// XCB_Print("XCB_GRAVITY_NOTIFY\n");
// break;
//}
//case XCB_RESIZE_REQUEST: {
// //xcb_resize_request_event_t* resize_request = (xcb_resize_request_event_t*)AEvent;
// MIP_Print("XCB_RESIZE_REQUEST\n");
// break;
//}
//case XCB_CIRCULATE_NOTIFY: {
// xcb_circulate_notify_event_t* circulate_notify = (xcb_circulate_notify_event_t*)AEvent;
// XCB_Print("XCB_CIRCULATE_NOTIFY\n");
// break;
//}
//case XCB_CIRCULATE_REQUEST: {
// xcb_circulate_request_event_t* circulate_request = (xcb_circulate_request_event_t*)AEvent;
// XCB_Print("XCB_CIRCULATE_REQUEST\n");
// break;
//}
//case XCB_SELECTION_CLEAR: {
// xcb_selection_clear_event_t* selection_clear = (xcb_selection_clear_event_t*)AEvent;
// XCB_Print("XCB_SELECTION_CLEAR\n");
// break;
//}
//case XCB_SELECTION_REQUEST: {
// xcb_selection_request_event_t* selection_request = (xcb_selection_request_event_t*)AEvent;
// XCB_Print("XCB_SELECTION_REQUEST\n");
// break;
//}
//case XCB_SELECTION_NOTIFY: {
// xcb_selection_notify_event_t* selection_notify = (xcb_selection_notify_event_t*)AEvent;
// XCB_Print("XCB_SELECTION_NOTIFY\n");
// break;
//}
//case XCB_COLORMAP_NOTIFY: {
// xcb_colormap_notify_event_t* colormap_notify = (xcb_colormap_notify_event_t*)AEvent;
// XCB_Print("XCB_COLORMAP_NOTIFY\n");
// break;
//}
//case XCB_MAPPING_NOTIFY: {
// xcb_mapping_notify_event_t* mapping_notify = (xcb_mapping_notify_event_t*)AEvent;
// XCB_Print("XCB_MAPPING_NOTIFY\n");
// break;
//}
//default: {
// XCB_Print("unhandled xcb event: %i\n",event->response_type);
// break;
//}
} // switch event type
}
//------------------------------
private:
//------------------------------
static
void* xcb_event_thread_proc(void* AWindow) {
//_mip_xcb_event_thread_pid = getpid();
//_mip_xcb_event_thread_tid = getpid();
MIP_XcbWindow* window = (MIP_XcbWindow*)AWindow;
if (window) {
xcb_connection_t* connection = window->MConnection;
xcb_flush(connection);
while (window->MEventThreadActive) {
xcb_generic_event_t* event = xcb_wait_for_event(connection);
if (event) {
//uint32_t e = event->response_type & ~0x80;
//if (e == XCB_CLIENT_MESSAGE) {
// xcb_client_message_event_t* client_message = (xcb_client_message_event_t*)event;
// xcb_atom_t type = client_message->type;
// uint32_t data = client_message->data.data32[0];
// KPrint("XCB_CLIENT_MESSAGE: type %i data %i\n",type,data);
//}
window->eventHandler(event);
free(event); // not MALLOC'ed
}
}
}
return nullptr;
}
//----------
// static
// void* xcb_timer_thread_proc(void* AWindow) {
// MIP_XcbWindow* window = (MIP_XcbWindow*)AWindow;
// if (window) {
// xcb_connection_t* connection = window->MConnection;
// xcb_flush(connection); // so we're sure all messages have been sent before entering loop
// while (window->MTimerThreadActive) {
// //window->on_window_timer();
// window->sendEvent(MIP_THREAD_ID_TIMER,0);
// MIP_Sleep(window->MTimerSleep); // ???
// }
// }
// return nullptr;
// }
//------------------------------
public:
//------------------------------
void setWindowPos(uint32_t AXpos, uint32_t AYpos) override {
//MWindowXpos = AXpos;
//MWindowYpos = AYpos;
uint32_t values[] = { AXpos, AYpos };
xcb_configure_window(MConnection,MWindow,XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,values);
xcb_flush(MConnection);
}
//----------
void setWindowSize(uint32_t AWidth, uint32_t AHeight) override {
//MWindowWidth = AWidth;
//MWindowHeight = AHeight;
uint32_t values[] = { AWidth, AHeight };
//MIP_Print("> calling xcb_configure_window %i,%i\n",AWidth,AHeight);
xcb_configure_window(MConnection,MWindow,XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,values);
xcb_flush(MConnection);
}
//----------
void setWindowTitle(const char* ATitle) override {
xcb_change_property(
MConnection,
XCB_PROP_MODE_REPLACE,
MWindow,
XCB_ATOM_WM_NAME,
XCB_ATOM_STRING,
8,
strlen(ATitle),
ATitle
);
xcb_flush(MConnection);
}
//------------------------------
//
//------------------------------
void open() override {
//MIP_PRINT;
xcb_map_window(MConnection,MWindow);
#ifdef MIP_XCB_WAIT_FOR_MAPNOTIFY
waitForMapNotify();
#endif
if (MEmbedded) startEventThread();
//xcb_flush(MConnection);
setMouseCursor(MIP_CURSOR_DEFAULT);
xcb_flush(MConnection);
//on_window_open(MWindowWidth,MWindowHeight);
}
//----------
void close() override {
//on_window_close();
if (MEmbedded) stopEventThread();
xcb_unmap_window(MConnection,MWindow);
xcb_flush(MConnection);
}
//----------
void eventLoop() override {
MQuitEventLoop = false;
xcb_flush(MConnection);
xcb_generic_event_t* event;// = xcb_wait_for_event(MConnection);
while ((event = xcb_wait_for_event(MConnection))) {
uint32_t e = event->response_type & ~0x80;
// if (e == XCB_CLIENT_MESSAGE) {
// xcb_client_message_event_t* client_message = (xcb_client_message_event_t*)event;
// xcb_atom_t type = client_message->type;
// uint32_t data = client_message->data.data32[0];
// if (type == MWMProtocolsAtom) {
// if (data == MWMDeleteWindowAtom) {
// free(event); // not malloc'ed
// //MQuitEventLoop = true;
// return; //break;
// }
// }
// } // client
switch (e) {
//case XCB_EXPOSE:
// MIP_Print("expose\n");
// xcb_send_event(MConnection,false,AChild,XCB_EXPOSE,event);
// break;
//case XCB_CONFIGURE_NOTIFY:
// MIP_Print("configure_notify\n");
// break;
case XCB_CLIENT_MESSAGE:
if (e == XCB_CLIENT_MESSAGE) {
xcb_client_message_event_t* client_message = (xcb_client_message_event_t*)event;
xcb_atom_t type = client_message->type;
uint32_t data = client_message->data.data32[0];
if (type == MWMProtocolsAtom) {
if (data == MWMDeleteWindowAtom) {
free(event); // not malloc'ed
//MQuitEventLoop = true;
//break;
return;
}
}
} // client
break;
};
eventHandler(event);
free(event);
if (MQuitEventLoop) break;
} // while event
}
//----------
// https://specifications.freedesktop.org/xembed-spec/0.5/ar01s06.html
/*
static int trapped_error_code = 0;
static int (*old_error_handler) (Display *, XErrorEvent *);
static int error_handler(Display *display, XErrorEvent *error) {
trapped_error_code = error->error_code;
return 0;
}
void trap_errors(void) {
trapped_error_code = 0;
old_error_handler = XSetErrorHandler(error_handler);
}
int untrap_errors(void) {
XSetErrorHandler(old_error_handler);
return trapped_error_code;
}
void handle_event(Display* dpy, XEvent* ev) {
if (ev->type == KeyPress || ev->type==KeyRelease) {
ev->xkey.window = client;
trap_errors();
XSendEvent( dpy, client, False, NoEventMask, ev );
XSync( dpy, False );
if (untrap_errors()) {
// Handle failure
}
return;
}
// ...
}
void send_xembed_message(Display* dpy, Window w, long message, long detail, long data1, long data2) {
XEvent ev;
memset(&ev, 0, sizeof(ev));
ev.xclient.type = ClientMessage;
ev.xclient.window = w;
ev.xclient.message_type = XInternAtom( dpy, "_XEMBED", False );
ev.xclient.format = 32;
ev.xclient.data.l[0] = x_time;
ev.xclient.data.l[1] = message;
ev.xclient.data.l[2] = detail;
ev.xclient.data.l[3] = data1;
ev.xclient.data.l[4] = data2;
trap_errors();
XSendEvent(dpy, w, False, NoEventMask, &ev);
XSync(dpy, False);
if (untrap_errors()) {
// Handle failure
}
}
*/
// void parentEventLoop(intptr_t AChild) override {
// MQuitEventLoop = false;
// xcb_flush(MConnection);
// xcb_generic_event_t* event;// = xcb_wait_for_event(MConnection);
// while ((event = xcb_wait_for_event(MConnection))) {
// xcb_send_event(MConnection,false /*propagate*/,AChild, XCB_EVENT_MASK_NO_EVENT /*event_mask*/, (const char*)event );
// xcb_flush(MConnection);
// }
// }
//----------
void reparent(uint32_t AParent) override {
//MWindowParent = (intptr_t)AParent;
//xcb_reparent_window(MConnection,MWindow,MWindowParent,0,0);
xcb_reparent_window(MConnection,MWindow,AParent,0,0);
xcb_flush(MConnection);
}
//----------
// void startTimer(uint32_t ms) override {
// MTimerSleep = ms;
// MTimerThreadActive = true;
// pthread_create(&MTimerThread,nullptr,xcb_timer_thread_proc,this);
// }
//----------
// void stopTimer(void) override {
// void* ret;
// MTimerThreadActive = false;
// pthread_join(MTimerThread,&ret);
// }
//----------
//MWindowCursor = XCreateFontCursor(MDisplay, mip_xlib_cursors[ACursor]);
//XDefineCursor(MDisplay,MWindow,MWindowCursor);
void setMouseCursor(uint32_t ACursor) override {
//if (!MCursorHidden) {
// freeXcbCursor();
// MWindowCursor = mip_xcb_create_font_cursor(MConnection, xcb_cursors[ACursor] );
// setXcbCursor(MWindowCursor);
//}
setWMCursor(ACursor);
}
//----------
void setMouseCursorPos(int32_t AXpos, int32_t AYpos) override {
xcb_warp_pointer(MConnection,XCB_NONE,MWindow,0,0,0,0,AXpos,AYpos);
xcb_flush(MConnection);
}
//----------
void hideMouseCursor(void) override {
if (!MCursorHidden) {
setXcbCursor(MHiddenCursor);
MCursorHidden = true;
}
}
//----------
void showMouseCursor(void) override {
if (MCursorHidden) {
setXcbCursor(MWindowCursor);
MCursorHidden = false;
}
}
//----------
/*
xcb_grab_pointer:
Actively grabs control of the pointer. Further pointer events are reported
only to the grabbing client. Overrides any active pointer grab by this
client.
*/
void grabMouseCursor(void) override {
int32_t event_mask =
XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_FOCUS_CHANGE |
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW;
xcb_grab_pointer(
MConnection,
0, // owner_events
MWindow, /*rootWindow,*/ // grab_window
event_mask, // event_mask
XCB_GRAB_MODE_ASYNC, // pointer_mode
XCB_GRAB_MODE_ASYNC, // keyboard_mode
XCB_NONE, /*rootWindow,*/ // confine_to
XCB_NONE, // cursor
XCB_CURRENT_TIME // timestamp
);
xcb_flush(MConnection);
}
//----------
void releaseMouseCursor(void) override {
xcb_ungrab_pointer(MConnection,XCB_CURRENT_TIME);
xcb_flush(MConnection);
}
//----------
void beginPaint() override {
}
//----------
void paint(int32_t AXpos, int32_t AYpos, int32_t AWidth, int32_t AHeight) override {
//MIP_Print("x %i y %i w %i h %i\n",AXpos,AYpos,AWidth,AHeight);
//on_paint(MWindowPainter,ARect);
// if (MFillBackground) {
// fill(AXpos,AYpos,AWidth,AHeight,MBackgroundColor);
// }
on_window_paint(AXpos,AYpos,AWidth,AHeight);
}
//----------
void endPaint() override {
xcb_flush(MConnection);
}
//----------
void invalidate(int32_t AXpos, int32_t AYpos, int32_t AWidth, int32_t AHeight) override {
//MIP_Print("xcb: invalidate %i %i %i %i\n",AXpos,AYpos,AWidth,AHeight);
memset(MExposeEventBuffer,0,sizeof(MExposeEventBuffer));
MExposeEvent->window = MWindow;
MExposeEvent->response_type = XCB_EXPOSE;
MExposeEvent->x = AXpos;
MExposeEvent->y = AYpos;
MExposeEvent->width = AWidth;
MExposeEvent->height = AHeight;
xcb_send_event(
MConnection,
false,
MWindow,
XCB_EVENT_MASK_EXPOSURE,
(char*)MExposeEvent
);
xcb_flush(MConnection);
}
//----------
/*
https://www.x.org/releases/X11R7.7/doc/man/man3/xcb_send_event.3.xhtml#heading8
https://stackoverflow.com/questions/40533318/xcb-custom-message-to-event-loop
*/
//void sendEvent(uint32_t AData, uint32_t AType) override {
void sendClientMessage(uint32_t AData, uint32_t AType) override {
memset(MClientMessageEventBuffer,0,sizeof(MClientMessageEventBuffer));
MClientMessageEvent->window = MWindow;
MClientMessageEvent->response_type = XCB_CLIENT_MESSAGE;
MClientMessageEvent->format = 32; // didn't work without this
MClientMessageEvent->type = AType;
MClientMessageEvent->data.data32[0] = AData;
xcb_send_event(
MConnection,
false,
MWindow,
XCB_EVENT_MASK_NO_EVENT,
(char*)MClientMessageEvent
);
xcb_flush(MConnection);
}
//----------
void flush(void) override {
xcb_flush(MConnection);
}
//----------
void sync(void) override {
xcb_aux_sync(MConnection);
}
//------------------------------
public:
//------------------------------
uint32_t xcb_color(MIP_Color AColor) {
uint8_t r = AColor.r * 255.0f;
uint8_t g = AColor.g * 255.0f;
uint8_t b = AColor.b * 255.0f;
uint8_t a = AColor.a * 255.0f;
uint32_t color = (a << 24) + (r << 16) + (g << 8) + b;
return color;
}
//------------------------------
public:
//------------------------------
void fill(MIP_Color AColor) override {
fill(0,0,MWindowWidth,MWindowHeight,AColor);
}
//----------
void fill(int32_t AXpos, int32_t AYpos, int32_t AWidth, int32_t AHeight, MIP_Color AColor) override {
// set color
uint32_t mask = XCB_GC_FOREGROUND;
uint32_t values[1];
values[0] = xcb_color(AColor);
xcb_change_gc(MConnection,MScreenGC,mask,values);
// fill rectangle
xcb_rectangle_t rectangles[] = {{
(int16_t)AXpos, //0,
(int16_t)AYpos, //0,
(uint16_t)AWidth, //MWindowWidth,
(uint16_t)AHeight, //MWindowHeight
}};
xcb_poly_fill_rectangle(MConnection,MWindow,MScreenGC,1,rectangles);
xcb_flush(MConnection);
}
//----------
void blit(int32_t ADstX, int32_t ADstY, MIP_Drawable* ASource) override {
if (ASource->isImage()) {
xcb_image_put(
MConnection, // xcb_connection_t * conn,
MWindow, // xcb_drawable_t draw,
MScreenGC, // xcb_gcontext_t gc,
ASource->getXcbImage(), // xcb_image_t * image,
ADstX, // int16_t x,
ADstY, // int16_t y,
0 // uint8_t left_pad
);
xcb_flush(MConnection);
}
else if (ASource->isSurface()) {
xcb_copy_area(
MConnection, // Pointer to the xcb_connection_t structure
ASource->getXcbDrawable(), // The Drawable we want to paste
MWindow, // The Drawable on which we copy the previous Drawable
MScreenGC, // A Graphic Context
0, // Top left x coordinate of the region we want to copy
0, // Top left y coordinate of the region we want to copy
ADstX, // Top left x coordinate of the region where we want to copy
ADstY, // Top left y coordinate of the region where we want to copy
ASource->getWidth(), // Width of the region we want to copy
ASource->getHeight() // Height of the region we want to copy
);
xcb_flush(MConnection);
}
//else {
// MIP_Trace("unknown ADrawable for blit()\n");
//}
}
void blit(int32_t ADstX, int32_t ADstY, MIP_Drawable* ASource, int32_t ASrcX, int32_t ASrcY, int32_t ASrcW, int32_t ASrcH) override {
if (ASource->isImage()) {
mip_xcb_put_image(
MConnection,
MWindow,
MScreenGC,
ASrcW,
ASrcH,
ADstX,
ADstY,
MScreenDepth,//ASource->getDepth(),
ASource->getStride(),
ASource->getBitmap()->getPixelPtr(ASrcX,ASrcY)//getBuffer()
);
xcb_flush(MConnection);
}
else if (ASource->isSurface()) {
xcb_copy_area(
MConnection, // Pointer to the xcb_connection_t structure
ASource->getXcbDrawable(), // The Drawable we want to paste
MWindow, // The Drawable on which we copy the previous Drawable
MScreenGC, // A Graphic Context
ASrcX, // Top left x coordinate of the region we want to copy
ASrcY, // Top left y coordinate of the region we want to copy
ADstX, // Top left x coordinate of the region where we want to copy
ADstY, // Top left y coordinate of the region where we want to copy
ASrcW, // Width of the region we want to copy
ASrcH // Height of the region we want to copy
);
xcb_flush(MConnection);
}
//else {
// MIP_Trace("unknown ADrawable for blit()\n");
//}
}
//------------------------------
public:
//------------------------------
/*
typedef struct {
uint8_t response_type;
uint8_t depth; // depth of the window
uint16_t sequence;
uint32_t length;
xcb_window_t root; // Id of the root window
int16_t x; // X coordinate of the window's location
int16_t y; // Y coordinate of the window's location
uint16_t width; // Width of the window
uint16_t height; // Height of the window
uint16_t border_width; // Width of the window's border
} xcb_get_geometry_reply_t;
xcb_get_geometry_cookie_t xcb_get_geometry(xcb_connection_t* c, xcb_drawable_t drawable);
xcb_get_geometry_reply_t *xcb_get_geometry_reply(xcb_connection_t* c, xcb_get_geometry_cookie_t cookie, xcb_generic_error_t** e);
*/
//xcb_get_geometry_reply_t* getGeometry() {
// xcb_get_geometry_cookie_t cookie = xcb_get_geometry(MConnection,MWindow/*MDrawable*/);
// xcb_get_geometry_reply_t* reply = xcb_get_geometry_reply(MConnection,cookie,nullptr);
// return reply;
// //free(reply);
//}
//----------
/*
typedef struct {
uint8_t response_type;
uint8_t pad0;
uint16_t sequence;
uint32_t length;
xcb_window_t root;
xcb_window_t parent; // Id of the parent window
uint16_t children_len;
uint8_t pad1[14];
} xcb_query_tree_reply_t;
xcb_query_tree_cookie_t xcb_query_tree(xcb_connection_t* c, xcb_window_t window);
xcb_query_tree_reply_t *xcb_query_tree_reply(xcb_connection_t* c, xcb_query_tree_cookie_t cookie, xcb_generic_error_t** e);
*/
xcb_window_t getXcbParent() {
xcb_query_tree_cookie_t cookie = xcb_query_tree(MConnection,MWindow);
xcb_query_tree_reply_t* reply = xcb_query_tree_reply(MConnection,cookie,nullptr);
xcb_window_t parent = reply->parent;
free(reply);
return parent;
}
//----------
// Displays the root, parent and children of the specified window.
/*
void my_example() {
xcb_query_tree_cookie_t cookie = xcb_query_tree(MConnection,MWindow);
xcb_query_tree_reply_t* reply;
if ((reply = xcb_query_tree_reply(MConnection,cookie,nullptr))) {
//printf("root = 0x%08x\n", reply->root);
//printf("parent = 0x%08x\n", reply->parent);
xcb_window_t *children = xcb_query_tree_children(reply);
for (int i = 0; i < xcb_query_tree_children_length(reply); i++) {
//printf("child window = 0x%08x\n", children[i]);
}
free(reply);
}
}
*/
uint32_t getXcbChildCount() {
xcb_query_tree_cookie_t cookie = xcb_query_tree(MConnection,MWindow);
xcb_query_tree_reply_t* reply;
if ((reply = xcb_query_tree_reply(MConnection,cookie,nullptr))) {
int num_children = xcb_query_tree_children_length(reply);
free(reply);
return num_children;
}
return 0;
}
uint32_t getXcbChild(uint32_t AIndex) {
xcb_query_tree_cookie_t cookie = xcb_query_tree(MConnection,MWindow);
xcb_query_tree_reply_t* reply;
if ((reply = xcb_query_tree_reply(MConnection,cookie,nullptr))) {
xcb_window_t *children = xcb_query_tree_children(reply);
xcb_window_t child = children[AIndex];
free(reply);
return child;
}
return 0;
}
};
//--------
//----------------------------------------------------------------------
#endif
| 31.266044 | 135 | 0.580705 |
6544130f5b245c68c581286c8350013a6c014d32 | 534 | h | C | common/include/DebugLevelLogger.h | stfc-aeg/odin-data | 6c6353a11e0b813fc9db866ba610649dbbec95da | [
"Apache-2.0"
] | 7 | 2018-06-12T15:48:52.000Z | 2021-06-01T03:50:42.000Z | common/include/DebugLevelLogger.h | stfc-aeg/odin-data | 6c6353a11e0b813fc9db866ba610649dbbec95da | [
"Apache-2.0"
] | 211 | 2017-05-18T13:38:02.000Z | 2022-03-03T11:05:47.000Z | common/include/DebugLevelLogger.h | dls-controls/odin-data | ddbfb90d361d0b397fcfd30df4a749faaa8c84d6 | [
"Apache-2.0"
] | 8 | 2017-05-15T08:05:05.000Z | 2022-03-13T18:31:41.000Z | /*
* DebugLevelLogger.h
*
* Created on: Mar 3, 2015
* Author: tcn
*/
#ifndef INCLUDE_DEBUGLEVELLOGGER_H_
#define INCLUDE_DEBUGLEVELLOGGER_H_
#include <log4cxx/logger.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
typedef unsigned int DebugLevel;
extern DebugLevel debug_level;
void set_debug_level(DebugLevel level);
#define LOG4CXX_DEBUG_LEVEL(level, logger, message) { \
if (LOG4CXX_UNLIKELY(level <= debug_level)) {\
LOG4CXX_DEBUG(logger, message); }}
#endif /* INCLUDE_DEBUGLEVELLOGGER_H_ */
| 21.36 | 55 | 0.754682 |
04e86e180fb82b7ebbee9a6f26d479c2e134ef5e | 1,764 | h | C | distributed/include/worker.h | jangmys/pbb | b53111ff3016cbf6885e99537ff80528e602bff6 | [
"BSD-3-Clause"
] | 1 | 2022-03-22T17:14:21.000Z | 2022-03-22T17:14:21.000Z | distributed/include/worker.h | jangmys/pbb | b53111ff3016cbf6885e99537ff80528e602bff6 | [
"BSD-3-Clause"
] | null | null | null | distributed/include/worker.h | jangmys/pbb | b53111ff3016cbf6885e99537ff80528e602bff6 | [
"BSD-3-Clause"
] | null | null | null | #ifndef WORKER_H
#define WORKER_H
#include <atomic>
#include <memory>
class pbab;
class communicator;
class matrix_controller;
class work;
class fact_work;
class solution;
class gpubb;
class worker {
// private:
public:
pbab * pbb;
int size;
int M;
std::unique_ptr<communicator> comm;
matrix_controller * mc;
gpubb * gbb;
std::shared_ptr<fact_work> work_buf;
std::shared_ptr<work> dwrk;
// fact_work * work_buf;
// solution * best_buf;
solution * local_sol;
unsigned int sol_ind_begin;
unsigned int sol_ind_end;
unsigned int max_sol_ind;
int *solutions;
pthread_mutex_t mutex_solutions;
worker(pbab * _pbb);
~worker();
int best;
void tryLaunchCommBest();
void tryLaunchCommWork();
virtual void getSolutions() = 0;
virtual void getIntervals() = 0;
virtual void updateWorkUnit() = 0;
virtual bool doWork() = 0;
virtual void interrupt() = 0;
pthread_barrier_t barrier;
pthread_mutex_t mutex_inst;
pthread_mutex_t mutex_end;
pthread_mutex_t mutex_wunit;
pthread_mutex_t mutex_best;
pthread_mutex_t mutex_updateAvail;
pthread_cond_t cond_updateApplied;
pthread_mutex_t mutex_trigger;
pthread_cond_t cond_trigger;
volatile bool shareWithMaster;
volatile bool end;
volatile bool trigger;
volatile bool updateAvailable;
volatile bool sendRequest;
volatile bool sendRequestReady;
volatile bool newBest;
bool foundNewBest();
void setNewBest(bool _v);
void wait_for_trigger(bool& check, bool& best);
void wait_for_update_complete();
bool checkEnd();
bool checkUpdate();
bool commIsReady();
void reset();
void run();
};
#endif // ifndef WORKER_H
| 19.384615 | 51 | 0.689909 |
b7b5de9012aaa6d8026221221f92fc206bece5c0 | 3,595 | h | C | tools/AgentMonitor/resource.h | lvbaocheng/CC | 3febe5ce2804ef681a0d7d2f0011c3f92f2552d6 | [
"Apache-2.0"
] | 4 | 2020-05-14T02:37:06.000Z | 2021-12-08T07:54:13.000Z | tools/AgentMonitor/resource.h | lvbaocheng/CC | 3febe5ce2804ef681a0d7d2f0011c3f92f2552d6 | [
"Apache-2.0"
] | 1 | 2019-06-21T09:52:18.000Z | 2019-06-21T09:52:18.000Z | tools/AgentMonitor/resource.h | lvbaocheng/CC | 3febe5ce2804ef681a0d7d2f0011c3f92f2552d6 | [
"Apache-2.0"
] | 22 | 2018-07-11T06:30:39.000Z | 2021-11-12T16:16:14.000Z | //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by AgentMonitor.rc
//
#define IDD_ABOUTBOX 100
#define IDP_OLE_INIT_FAILED 100
#define IDD_MAINFORMVIEW 103
#define IDD_AGENTDETAILFORMVIEW 104
#define IDD_SYSINFOFORMVIEW 106
#define IDD_QUEUEDETAILFORMVIEW 107
#define IDD_PRIVQUEUEDIALOG 108
#define IDR_MAINFRAME 128
#define IDR_AgentMonitorTYPE 129
#define IDR_MENU_AGENT_OPERATION 131
#define IDD_DIALOG_OPTIONS 132
#define IDD_DIALOG_CONFIRM 133
#define IDC_CCAGENTBARCTRL1 1000
#define IDC_CHECK1 1001
#define IDC_CHECK_IDLE 1001
#define IDC_CHECK_SIP_INTERGRATE 1001
#define IDC_CHECK2 1002
#define IDC_CHECK_BUSY 1002
#define IDC_CHECK3 1003
#define IDC_CHECK_REST 1003
#define IDC_CHECK4 1004
#define IDC_CHECK_TALKING 1004
#define IDC_CHECK_TALKING_PROGRESS 1005
#define IDC_LIST2 1006
#define IDC_EDIT_MAINIP 1007
#define IDC_CHECK_MONITOR 1007
#define IDC_EDIT_SLAVEIP 1008
#define IDC_CHECK_OTHER 1008
#define IDC_STATIC_TOTAL_AGENTS 1008
#define IDC_EDIT_AGENTPASS 1009
#define IDC_STATIC_TOTAL_CALLS 1009
#define IDC_EDIT_PORT 1010
#define IDC_STATIC_IVR_CALLS 1010
#define IDC_EDIT_AGENTID 1011
#define IDC_STATIC_AGENT_CALLS 1011
#define IDC_EDIT_AGENTNUM 1012
#define IDC_STATIC_QUEUE_CALLS 1012
#define IDC_EDIT_SKILL 1013
#define IDC_STATIC_PRIV_QUEUE_CALLS 1013
#define IDC_EDIT_ATAG 1014
#define IDC_STATIC_ALL 1014
#define IDC_EDIT_TIMEOUT 1015
#define IDC_EDIT_CTAG 1016
#define IDC_EDIT_SIPIP 1017
#define IDC_EDIT_SIPPORT 1018
#define IDC_EDIT_SIPPASS 1019
#define IDC_EDIT_SIPNUM 1020
#define IDC_EDIT_MAINIP_SKILL_LIST 1021
#define IDC_LIST1 1022
#define IDC_LIST3 1023
#define IDC_BUTTON_ADD 1024
#define IDC_BUTTON_DEL 1025
#define IDC_BUTTON_FORCE_SIGNOUT_ALL 1025
#define IDC_BUTTON_UP 1026
#define IDC_STATIC_AGENTS_TITLE 1026
#define IDC_BUTTON_DOWN 1027
#define IDC_STATIC_QUEUE_STATUS 1027
#define IDC_STATIC_PRIV_QUEUE 1028
#define IDC_EDIT1 1029
#define ID_32771 32771
#define ID_32774 32774
#define ID_MENU_AGENT_SIGNOUT 32784
#define ID_MENU_AGENT_MONITOR 32787
#define ID_MENU_AGENT_STOP_MONITOR 32788
#define ID_MENU_AGENT_INSERT 32789
#define ID_MENU_AGENT_STOP_INSERT 32790
#define ID_MENU_AGENT_INSERT_MONITOR_CONVERT 32791
#define ID_MENU_AGENT_BREAK 32792
#define ID_MENU_UNINIT 32793
#define ID_MENU_OPTIONS 32794
#define ID_MENU_AGENT_SET_BUSY 32795
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 32796
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_SYMED_VALUE 109
#endif
#endif
| 41.321839 | 50 | 0.622253 |
ec7d9fbbe498fc0ea86ccfd64a0abdcded94766a | 294 | h | C | HeyLoading/QXGradientLabel.h | zhangzhaopds/heyfoxTest | f9accba429274fea93f18ee4d577110552277319 | [
"MIT"
] | null | null | null | HeyLoading/QXGradientLabel.h | zhangzhaopds/heyfoxTest | f9accba429274fea93f18ee4d577110552277319 | [
"MIT"
] | null | null | null | HeyLoading/QXGradientLabel.h | zhangzhaopds/heyfoxTest | f9accba429274fea93f18ee4d577110552277319 | [
"MIT"
] | null | null | null | //
// QXGradientLabel.h
// Loading_demo
//
// Created by 张昭 on 24/02/2018.
// Copyright © 2018 heyfox. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface QXGradientLabel : UILabel
@property (nonatomic, copy) NSString *message;
@property (nonatomic, assign) float progress;
@end
| 17.294118 | 49 | 0.707483 |
0c4113c57b7a29058dd72aef0e64a44b5e111110 | 374 | h | C | library/netliba/v6/udp_debug.h | avant1/catboost | 36e301b4167e3fe371f254474b1561a8acc3851d | [
"Apache-2.0"
] | null | null | null | library/netliba/v6/udp_debug.h | avant1/catboost | 36e301b4167e3fe371f254474b1561a8acc3851d | [
"Apache-2.0"
] | null | null | null | library/netliba/v6/udp_debug.h | avant1/catboost | 36e301b4167e3fe371f254474b1561a8acc3851d | [
"Apache-2.0"
] | null | null | null | #pragma once
namespace NNetliba
{
struct TRequesterPendingDataStats
{
int InpCount, OutCount;
ui64 InpDataSize, OutDataSize;
TRequesterPendingDataStats() { memset(this, 0, sizeof(*this)); }
};
struct TRequesterQueueStats
{
int ReqCount, RespCount;
ui64 ReqQueueSize, RespQueueSize;
TRequesterQueueStats() { memset(this, 0, sizeof(*this)); }
};
}
| 17.809524 | 68 | 0.713904 |
4d11f6eeb943db5ecafa4cc95981a7f6cea651e5 | 1,890 | h | C | external/libtorch/libtorch/include/torch/csrc/jit/script/schema_matching.h | yngtodd/metaltorch | 823a2e56526c34d8687992ed4feae992e79ebbac | [
"MIT"
] | 15 | 2019-08-10T02:36:38.000Z | 2021-07-14T13:45:32.000Z | external/libtorch/libtorch/include/torch/csrc/jit/script/schema_matching.h | yngtodd/metaltorch | 823a2e56526c34d8687992ed4feae992e79ebbac | [
"MIT"
] | 7 | 2019-10-21T03:08:51.000Z | 2022-03-11T23:54:28.000Z | external/libtorch/libtorch/include/torch/csrc/jit/script/schema_matching.h | yngtodd/metaltorch | 823a2e56526c34d8687992ed4feae992e79ebbac | [
"MIT"
] | 5 | 2019-09-27T02:41:40.000Z | 2021-11-05T20:40:49.000Z | #pragma once
#include <torch/csrc/WindowsTorchApiMacro.h>
#include <torch/csrc/jit/ir.h>
#include <torch/csrc/jit/named_value.h>
#include <ATen/core/function_schema.h>
namespace torch {
namespace jit {
namespace script {
// try to match a list if inputs and keyword 'attributes' to this schema,
// if it works return the flat list of positional inputs to the call
// if it returns nullopt, then failure_messages contains a good error report
// set convert_tensor_to_num to true if ImplicitTensorToNums should be inserted
// to match the schema
struct MatchedSchema {
std::vector<Value*> inputs;
std::vector<TypePtr> return_types;
c10::OptNameList return_field_names;
};
TORCH_API c10::optional<MatchedSchema> tryMatchSchema(
const ::c10::FunctionSchema& schema,
const SourceRange& loc,
Graph& graph,
c10::optional<NamedValue> self,
at::ArrayRef<NamedValue> inputs,
at::ArrayRef<NamedValue> attributes,
std::ostream& failure_messages,
bool allow_conversions);
TORCH_API Value* emitBuiltinCall(
const SourceRange& loc,
Graph& graph,
Symbol name,
const c10::optional<NamedValue>& self,
at::ArrayRef<NamedValue> inputs,
at::ArrayRef<NamedValue> attributes,
// if true, emitBuiltinCall will throw an exception if this builtin does not
// exist, otherwise it will return nullptr if the builtin is not found.
bool required);
TORCH_API c10::optional<size_t> findInputWithName(
const std::string& name,
at::ArrayRef<NamedValue> kwargs);
// applies implict conversion from value trying to turn it into type
// concrete_type it succeeds if the return_value->isSubclassOf(concrete_type)
TORCH_API Value* tryConvertToType(
const SourceRange& loc,
Graph& graph,
const TypePtr& concrete_type,
Value* value,
bool allow_conversions);
} // namespace script
} // namespace jit
} // namespace torch
| 30.983607 | 80 | 0.741799 |
d6f14a48f7c7f01a3c1e2d7dcdfc13349aa80160 | 9,904 | c | C | release/src-rt-6.x.4708/router/samba3/source4/heimdal/lib/gssapi/krb5/external.c | zaion520/ATtomato | 4d48bb79f8d147f89a568cf18da9e0edc41f93fb | [
"FSFAP"
] | 2 | 2019-01-13T09:19:10.000Z | 2019-02-15T01:21:02.000Z | release/src-rt-6.x.4708/router/samba3/source4/heimdal/lib/gssapi/krb5/external.c | zaion520/ATtomato | 4d48bb79f8d147f89a568cf18da9e0edc41f93fb | [
"FSFAP"
] | null | null | null | release/src-rt-6.x.4708/router/samba3/source4/heimdal/lib/gssapi/krb5/external.c | zaion520/ATtomato | 4d48bb79f8d147f89a568cf18da9e0edc41f93fb | [
"FSFAP"
] | 2 | 2020-03-08T01:58:25.000Z | 2020-12-20T10:34:54.000Z | /*
* Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "gsskrb5_locl.h"
#include <gssapi_mech.h>
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
* "\x01\x02\x01\x01"},
* corresponding to an object-identifier value of
* {iso(1) member-body(2) United States(840) mit(113554)
* infosys(1) gssapi(2) generic(1) user_name(1)}. The constant
* GSS_C_NT_USER_NAME should be initialized to point
* to that gss_OID_desc.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_user_name_oid_desc =
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")};
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
* "\x01\x02\x01\x02"},
* corresponding to an object-identifier value of
* {iso(1) member-body(2) United States(840) mit(113554)
* infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
* The constant GSS_C_NT_MACHINE_UID_NAME should be
* initialized to point to that gss_OID_desc.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_machine_uid_name_oid_desc =
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")};
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
* "\x01\x02\x01\x03"},
* corresponding to an object-identifier value of
* {iso(1) member-body(2) United States(840) mit(113554)
* infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
* The constant GSS_C_NT_STRING_UID_NAME should be
* initialized to point to that gss_OID_desc.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_string_uid_name_oid_desc =
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")};
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
* corresponding to an object-identifier value of
* {iso(1) org(3) dod(6) internet(1) security(5)
* nametypes(6) gss-host-based-services(2)). The constant
* GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
* to that gss_OID_desc. This is a deprecated OID value, and
* implementations wishing to support hostbased-service names
* should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
* defined below, to identify such names;
* GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
* for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
* parameter, but should not be emitted by GSS-API
* implementations
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_x_oid_desc =
{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")};
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
* "\x01\x02\x01\x04"}, corresponding to an
* object-identifier value of {iso(1) member-body(2)
* Unites States(840) mit(113554) infosys(1) gssapi(2)
* generic(1) service_name(4)}. The constant
* GSS_C_NT_HOSTBASED_SERVICE should be initialized
* to point to that gss_OID_desc.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_oid_desc =
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")};
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {6, (void *)"\x2b\x06\01\x05\x06\x03"},
* corresponding to an object identifier value of
* {1(iso), 3(org), 6(dod), 1(internet), 5(security),
* 6(nametypes), 3(gss-anonymous-name)}. The constant
* and GSS_C_NT_ANONYMOUS should be initialized to point
* to that gss_OID_desc.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_anonymous_oid_desc =
{6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")};
/*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value
* {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
* corresponding to an object-identifier value of
* {1(iso), 3(org), 6(dod), 1(internet), 5(security),
* 6(nametypes), 4(gss-api-exported-name)}. The constant
* GSS_C_NT_EXPORT_NAME should be initialized to point
* to that gss_OID_desc.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_export_name_oid_desc =
{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") };
/*
* This name form shall be represented by the Object Identifier {iso(1)
* member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
* krb5(2) krb5_name(1)}. The recommended symbolic name for this type
* is "GSS_KRB5_NT_PRINCIPAL_NAME".
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc =
{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") };
/*
* draft-ietf-cat-iakerb-09, IAKERB:
* The mechanism ID for IAKERB proxy GSS-API Kerberos, in accordance
* with the mechanism proposed by SPNEGO [7] for negotiating protocol
* variations, is: {iso(1) org(3) dod(6) internet(1) security(5)
* mechanisms(5) iakerb(10) iakerbProxyProtocol(1)}. The proposed
* mechanism ID for IAKERB minimum messages GSS-API Kerberos, in
* accordance with the mechanism proposed by SPNEGO for negotiating
* protocol variations, is: {iso(1) org(3) dod(6) internet(1)
* security(5) mechanisms(5) iakerb(10)
* iakerbMinimumMessagesProtocol(2)}.
*/
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_proxy_mechanism_oid_desc =
{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x01")};
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_min_msg_mechanism_oid_desc =
{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") };
/*
* Context for krb5 calls.
*/
static gss_mo_desc krb5_mo[] = {
{
GSS_C_MA_SASL_MECH_NAME,
GSS_MO_MA,
"SASL mech name",
"GS2-KRB5",
_gss_mo_get_ctx_as_string,
NULL
},
{
GSS_C_MA_MECH_NAME,
GSS_MO_MA,
"Mechanism name",
"KRB5",
_gss_mo_get_ctx_as_string,
NULL
},
{
GSS_C_MA_MECH_DESCRIPTION,
GSS_MO_MA,
"Mechanism description",
"Heimdal Kerberos 5 mech",
_gss_mo_get_ctx_as_string,
NULL
},
{
GSS_C_MA_MECH_CONCRETE,
GSS_MO_MA
},
{
GSS_C_MA_ITOK_FRAMED,
GSS_MO_MA
},
{
GSS_C_MA_AUTH_INIT,
GSS_MO_MA
},
{
GSS_C_MA_AUTH_TARG,
GSS_MO_MA
},
{
GSS_C_MA_AUTH_INIT_ANON,
GSS_MO_MA
},
{
GSS_C_MA_DELEG_CRED,
GSS_MO_MA
},
{
GSS_C_MA_INTEG_PROT,
GSS_MO_MA
},
{
GSS_C_MA_CONF_PROT,
GSS_MO_MA
},
{
GSS_C_MA_MIC,
GSS_MO_MA
},
{
GSS_C_MA_WRAP,
GSS_MO_MA
},
{
GSS_C_MA_PROT_READY,
GSS_MO_MA
},
{
GSS_C_MA_REPLAY_DET,
GSS_MO_MA
},
{
GSS_C_MA_OOS_DET,
GSS_MO_MA
},
{
GSS_C_MA_CBINDINGS,
GSS_MO_MA
},
{
GSS_C_MA_PFS,
GSS_MO_MA
},
{
GSS_C_MA_CTX_TRANS,
GSS_MO_MA
}
};
/*
*
*/
static gssapi_mech_interface_desc krb5_mech = {
GMI_VERSION,
"kerberos 5",
{9, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" },
0,
_gsskrb5_acquire_cred,
_gsskrb5_release_cred,
_gsskrb5_init_sec_context,
_gsskrb5_accept_sec_context,
_gsskrb5_process_context_token,
_gsskrb5_delete_sec_context,
_gsskrb5_context_time,
_gsskrb5_get_mic,
_gsskrb5_verify_mic,
_gsskrb5_wrap,
_gsskrb5_unwrap,
_gsskrb5_display_status,
_gsskrb5_indicate_mechs,
_gsskrb5_compare_name,
_gsskrb5_display_name,
_gsskrb5_import_name,
_gsskrb5_export_name,
_gsskrb5_release_name,
_gsskrb5_inquire_cred,
_gsskrb5_inquire_context,
_gsskrb5_wrap_size_limit,
_gsskrb5_add_cred,
_gsskrb5_inquire_cred_by_mech,
_gsskrb5_export_sec_context,
_gsskrb5_import_sec_context,
_gsskrb5_inquire_names_for_mech,
_gsskrb5_inquire_mechs_for_name,
_gsskrb5_canonicalize_name,
_gsskrb5_duplicate_name,
_gsskrb5_inquire_sec_context_by_oid,
_gsskrb5_inquire_cred_by_oid,
_gsskrb5_set_sec_context_option,
_gsskrb5_set_cred_option,
_gsskrb5_pseudo_random,
_gk_wrap_iov,
_gk_unwrap_iov,
_gk_wrap_iov_length,
_gsskrb5_store_cred,
_gsskrb5_export_cred,
_gsskrb5_import_cred,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
krb5_mo,
sizeof(krb5_mo) / sizeof(krb5_mo[0])
};
gssapi_mech_interface
__gss_krb5_initialize(void)
{
return &krb5_mech;
}
| 29.652695 | 77 | 0.724758 |
eaca7c0e6c4f4c00cab6d93bcf9620e33623b7ee | 3,909 | h | C | src/mame/audio/leland.h | Robbbert/messui | 49b756e2140d8831bc81335298ee8c5471045e79 | [
"BSD-3-Clause"
] | 26 | 2015-03-31T06:25:51.000Z | 2021-12-14T09:29:04.000Z | src/mame/audio/leland.h | Robbbert/messui | 49b756e2140d8831bc81335298ee8c5471045e79 | [
"BSD-3-Clause"
] | null | null | null | src/mame/audio/leland.h | Robbbert/messui | 49b756e2140d8831bc81335298ee8c5471045e79 | [
"BSD-3-Clause"
] | 10 | 2015-03-27T05:45:51.000Z | 2022-02-04T06:57:36.000Z | // license:BSD-3-Clause
// copyright-holders:Aaron Giles
/*************************************************************************
Cinemat/Leland driver
*************************************************************************/
#ifndef MAME_AUDIO_LELAND_H
#define MAME_AUDIO_LELAND_H
#pragma once
#include "cpu/i86/i186.h"
#include "machine/gen_latch.h"
#include "machine/pit8253.h"
#include "sound/dac.h"
#include "sound/ymopm.h"
class leland_80186_sound_device : public device_t
{
public:
leland_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
template<class T> void set_master_cpu_tag(T &&tag) { m_master.set_tag(std::forward<T>(tag)); }
void peripheral_ctrl(offs_t offset, u16 data);
void leland_80186_control_w(u8 data);
void ataxx_80186_control_w(u8 data);
u16 peripheral_r(offs_t offset, u16 mem_mask = ~0);
void peripheral_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void command_lo_w(u8 data);
void command_hi_w(u8 data);
u8 response_r();
void dac_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void ataxx_dac_control(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_WRITE_LINE_MEMBER(i80186_tmr0_w);
DECLARE_WRITE_LINE_MEMBER(i80186_tmr1_w);
DECLARE_WRITE_LINE_MEMBER(pit0_2_w);
DECLARE_WRITE_LINE_MEMBER(pit1_0_w);
DECLARE_WRITE_LINE_MEMBER(pit1_1_w);
DECLARE_WRITE_LINE_MEMBER(pit1_2_w);
protected:
leland_80186_sound_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
int m_type;
enum {
TYPE_LELAND,
TYPE_REDLINE,
TYPE_ATAXX,
TYPE_WSF
};
required_device<generic_latch_16_device> m_soundlatch;
optional_device_array<dac_byte_interface, 8> m_dac;
optional_device<dac_word_interface> m_dac9;
optional_device_array<dac_8bit_binary_weighted_device, 8> m_dacvol;
optional_device_array<pit8254_device, 3> m_pit;
optional_device<i80186_cpu_device> m_audiocpu;
optional_device<ym2151_device> m_ymsnd;
void ataxx_80186_map_io(address_map &map);
void leland_80186_map_io(address_map &map);
void leland_80186_map_program(address_map &map);
private:
void delayed_response_r(void *ptr, int param);
void set_clock_line(int which, int state) { m_clock_active = state ? (m_clock_active | (1<<which)) : (m_clock_active & ~(1<<which)); }
// internal state
u16 m_peripheral;
u8 m_last_control;
u8 m_clock_active;
u8 m_clock_tick;
u16 m_sound_command;
u16 m_sound_response;
u32 m_ext_start;
u32 m_ext_stop;
u8 m_ext_active;
required_device<cpu_device> m_master;
optional_region_ptr<u8> m_ext_base;
};
class redline_80186_sound_device : public leland_80186_sound_device
{
public:
redline_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
void redline_dac_w(offs_t offset, u16 data);
protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
void redline_80186_map_io(address_map &map);
};
class ataxx_80186_sound_device : public leland_80186_sound_device
{
public:
ataxx_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
};
class wsf_80186_sound_device : public leland_80186_sound_device
{
public:
wsf_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
};
DECLARE_DEVICE_TYPE(LELAND_80186, leland_80186_sound_device)
DECLARE_DEVICE_TYPE(REDLINE_80186, redline_80186_sound_device)
DECLARE_DEVICE_TYPE(ATAXX_80186, ataxx_80186_sound_device)
DECLARE_DEVICE_TYPE(WSF_80186, wsf_80186_sound_device)
#endif // MAME_AUDIO_LELAND_H
| 29.390977 | 135 | 0.771553 |
26aabd8f1f9f9388c0d591f70040eb9dd9121cf1 | 331 | h | C | SSYDictionaryEntry.h | jerrykrinock/ClassesObjC | b680efaf27c0a20440fc47b4fdc320a9903b5f2a | [
"Apache-2.0"
] | 15 | 2015-01-03T20:52:46.000Z | 2020-08-18T13:16:40.000Z | SSYDictionaryEntry.h | jerrykrinock/ClassesObjC | b680efaf27c0a20440fc47b4fdc320a9903b5f2a | [
"Apache-2.0"
] | 1 | 2015-08-30T19:52:41.000Z | 2015-08-30T20:18:29.000Z | SSYDictionaryEntry.h | jerrykrinock/ClassesObjC | b680efaf27c0a20440fc47b4fdc320a9903b5f2a | [
"Apache-2.0"
] | 1 | 2019-07-08T06:18:02.000Z | 2019-07-08T06:18:02.000Z | #import <Cocoa/Cocoa.h>
@interface SSYDictionaryEntry : NSObject {
NSMutableDictionary* _parent ;
id _key ;
id _value ;
}
@end
// Transforms a dictionary into an array of SSDictionaryEntrys
// Reverse transforms an array of SSDictionaryEntrys into a dictionary
@interface DicToReadableValuesArray : NSValueTransformer
@end
| 19.470588 | 70 | 0.785498 |
bb316eae5a485c3555b5ffb034bfb04e6b11dabd | 424 | h | C | LibLsp/lsp/lsTextDocumentIdentifier.h | supakorn-ras/LspCpp | 9f2718378f36c731e8f60b123fd9b74835f5e315 | [
"MIT"
] | 30 | 2019-12-21T07:17:42.000Z | 2022-03-24T03:50:38.000Z | LibLsp/lsp/lsTextDocumentIdentifier.h | supakorn-ras/LspCpp | 9f2718378f36c731e8f60b123fd9b74835f5e315 | [
"MIT"
] | 15 | 2020-07-28T01:55:10.000Z | 2021-12-14T08:57:28.000Z | LibLsp/lsp/lsTextDocumentIdentifier.h | supakorn-ras/LspCpp | 9f2718378f36c731e8f60b123fd9b74835f5e315 | [
"MIT"
] | 9 | 2020-08-10T03:38:56.000Z | 2021-12-13T09:59:32.000Z | #pragma once
#include "LibLsp/JsonRpc/serializer.h"
#include "lsDocumentUri.h"
//Text documents are identified using a URI.On the protocol level,
//URIs are passed as strings.The corresponding JSON structure looks like this:
struct lsTextDocumentIdentifier {
/**
* The text document's URI.
*/
lsDocumentUri uri;
MAKE_SWAP_METHOD(lsTextDocumentIdentifier, uri)
};
MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri) | 30.285714 | 78 | 0.785377 |
180d6c762c5b17bf0e9672855c0ee5e9a3b42dec | 11,222 | c | C | drivers/sdhci_mmc/mmc.c | intel/efiwrapper | 95f032976feead1d9702959af1e5925629b63f67 | [
"BSD-2-Clause"
] | 22 | 2018-02-22T12:32:21.000Z | 2020-09-16T14:09:20.000Z | drivers/sdhci_mmc/mmc.c | MrDominique/efiwrapper | 95f032976feead1d9702959af1e5925629b63f67 | [
"BSD-2-Clause"
] | 2 | 2019-05-18T08:52:10.000Z | 2020-09-17T15:49:06.000Z | drivers/sdhci_mmc/mmc.c | MrDominique/efiwrapper | 95f032976feead1d9702959af1e5925629b63f67 | [
"BSD-2-Clause"
] | 11 | 2018-03-04T20:09:31.000Z | 2022-01-17T08:16:09.000Z | /******************************************************************************
*
* INTEL CONFIDENTIAL
*
* Copyright (c) 1999-2013 Intel Corporation All Rights Reserved.
*
* The source code contained or described herein and all documents related to
* the source code (Material) are owned by Intel Corporation or its suppliers
* or licensors. Title to the Material remains with Intel Corporation or its
* suppliers and licensors. The Material contains trade secrets and proprietary
* and confidential information of Intel or its suppliers and licensors. The
* Material is protected by worldwide copyright and trade secret laws and
* treaty provisions. No part of the Material may be used, copied, reproduced,
* modified, published, uploaded, posted, transmitted, distributed, or
* disclosed in any way without Intel's prior express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by Intel in writing.
*
******************************************************************************/
#include <stdbool.h>
#include <kconfig.h>
#include <libpayload.h>
#include <pci.h>
#include <ewlog.h>
#include <hwconfig.h>
#include "sdhci_mmc/mmc.h"
#include "sdhci_mmc/sdhci.h"
#include "sdhci_mmc/sdhci-internal.h"
#if defined (PLATFORM_KABYLAKE) || defined (PLATFORM_ICELAKE)
#define NO_HS400
#endif
/*
** Global instance of the eMMC card
*/
struct mmc card;
static int __mmc_send_cmd(struct cmd *c)
{
struct mmc *m = &card;
m->host->send_cmd(m, c);
#if MMC_DEBUG
ewdbg("=== DEBUG CMD %d args %x ==== ", c->index, c->args);
ewdbg("SDHCI_INT_ENABLE %x", sdhci_read16(m->host, SDHCI_INT_ENABLE));
ewdbg("SDHCI_TRANSFER_MODE %x", sdhci_read16(m->host, SDHCI_TRANSFER_MODE));
ewdbg("SDHCI_CMD_REG %x", sdhci_read16(m->host, SDHCI_CMD_REG));
ewdbg("SDHCI_BLOCK_SIZE %x", sdhci_read16(m->host, SDHCI_BLOCK_SIZE));
ewdbg("SDHCI_DMA_ADDR %x", sdhci_read32(m->host, SDHCI_DMA_ADDR));
ewdbg("SDHCI_HOST_CTRL %x", sdhci_read8(m->host, SDHCI_HOST_CTRL));
ewdbg("SDHCI_POWER_CONTROL %x", sdhci_read8(m->host, SDHCI_POWER_CONTROL));
ewdbg("SDHCI_CLOCK_CONTROL %x", sdhci_read16(m->host, SDHCI_CLOCK_CONTROL));
ewdbg("SDHCI_ARGUMENT %x", sdhci_read32(m->host, SDHCI_ARGUMENT));
ewdbg("SDHCI_BLOCK_CNT %x", sdhci_read16(m->host, SDHCI_BLOCK_CNT));
ewdbg("SDHCI_INT_STATUS %x", sdhci_read16(m->host, SDHCI_INT_STATUS));
#endif
return m->host->wait_cmd_done(m, c);
}
int mmc_send_cmd(struct cmd *c)
{
struct mmc *m = &card;
m->host->send_cmd(m, c);
#if MMC_DEBUG
ewdbg("==== DEBUG CMD %d args %x ===== ", c->index, c->args);
ewdbg("SDHCI_INT_ENABLE %x", sdhci_read16(m->host, SDHCI_INT_ENABLE));
ewdbg("SDHCI_TRANSFER_MODE %x", sdhci_read16(m->host, SDHCI_TRANSFER_MODE));
ewdbg("SDHCI_CMD_REG %x", sdhci_read16(m->host, SDHCI_CMD_REG));
ewdbg("SDHCI_BLOCK_SIZE %x", sdhci_read16(m->host, SDHCI_BLOCK_SIZE));
ewdbg("SDHCI_DMA_ADDR %x", sdhci_read32(m->host, SDHCI_DMA_ADDR));
ewdbg("SDHCI_HOST_CTRL %x", sdhci_read8(m->host, SDHCI_HOST_CTRL));
ewdbg("SDHCI_POWER_CONTROL %x", sdhci_read8(m->host, SDHCI_POWER_CONTROL));
ewdbg("SDHCI_CLOCK_CONTROL %x", sdhci_read16(m->host, SDHCI_CLOCK_CONTROL));
ewdbg("SDHCI_ARGUMENT %x", sdhci_read32(m->host, SDHCI_ARGUMENT));
ewdbg("SDHCI_BLOCK_CNT %x", sdhci_read16(m->host, SDHCI_BLOCK_CNT));
#endif
return 0;
}
uint64_t mmc_read_count(void) {
struct mmc *m = &card;
return (m->ext_csd[EXT_CSD_SEC_COUNT + 0] << 0 |
m->ext_csd[EXT_CSD_SEC_COUNT + 1] << 8 |
m->ext_csd[EXT_CSD_SEC_COUNT + 2] << 16 |
m->ext_csd[EXT_CSD_SEC_COUNT + 3] << 24);
}
/* ------------------------------------------------------------------------ */
/*
** Print salient properties read from the eMMC CID and EXT_CSD registers
** (protocol version, device capacity, boot partition settings etc.)
*/
#if DEBUG_MESSAGES
static void
emmc_show_hwinfo(struct mmc *m)
{
// Device density, EXT_CSD.SEC_COUNT [215:212]
uint64_t sec_count;
char *uhs_timing[6] = {"SDR12", "SDR25", "SDR50", "HS200", "DDR50", "HS400"};
sec_count = mmc_read_count() >> 11;
// eMMC device revision, derived from EXT_CSD_REF[192]
unsigned ext_csd_rev = m->ext_csd[192];
const char *rev = (ext_csd_rev == 5) ? "4.41" :
(ext_csd_rev == 6) ? "4.51" :
(ext_csd_rev == 7) ? "5.1" : "?";
// Device firmware revision, CID.PRV
unsigned cid_prv = m->cid[6-1];
// Manufacuring date, CID.MDT
unsigned cid_mdt = m->cid[1-1];
ewdbg("MMC driver: %dMB, boot %x/%x [%s %s FW %x.%x %x %d/%d]",
(unsigned int)sec_count,
m->ext_csd[179], // EXT_CSD.PARTITION_CONFIG
m->ext_csd[177], // EXT_CSD.BOOT_BUS_CONDITION
rev, uhs_timing[m->uhs_timing],
cid_prv >> 4, cid_prv & 0xf,
m->cid[2-1], // CID.PSN, product serial number
cid_mdt >> 4, (cid_mdt & 0xf) + 13);
}
#endif
int mmc_wait_cmd_done(struct cmd *c)
{
struct mmc *m = &card;
return m->host->wait_cmd_done(m, c);
}
static void mmc_reset()
{
struct cmd c;
c.index = CMD_RESET;
c.args = 0x0;
c.flags = CMDF_NO_RESPONSE;
c.resp_len = 0;
__mmc_send_cmd(&c);
}
/* ------------------------------------------------------------------------ */
/*
** eMMC: cmd API
*/
static int mmc_send_cmd1()
{
struct cmd c;
unsigned busy = 1;
uint64_t start = timer_us(0);
c.index = CMD_GET_OP;
c.flags = 0;
c.resp_len = 32;
c.args = OCR_VDD_18 | OCR_CCS;
while (busy)
{
if (timer_us(start) > 2000 * 1000)
return 1;
if (__mmc_send_cmd(&c) != 0)
return 1;
busy = !(c.resp[0] & OCR_BUSY);
}
return 0;
}
static int mmc_get_cid(struct mmc *m)
{
struct cmd c;
int err;
c.index = CMD_ALL_SEND_CID;
c.resp_len = 128;
c.args = 0;
c.flags = 0;
err = __mmc_send_cmd(&c);
if (err)
{
ewerr("Error %s() failed ", __func__);
return err;
}
memcpy(m->cid, c.resp, sizeof(m->cid));
return 0;
}
static void mmc_card_select(struct mmc *m)
{
struct cmd c;
c.index = CMD_SELECT_CARD;
c.args = m->rca << 16;
c.resp_len = 32;
c.flags = 0;
__mmc_send_cmd(&c);
}
static void mmc_set_rca(struct mmc *m)
{
struct cmd c;
m->rca = RCA_MMC;
c.index = CMD_SEND_RCA;
c.args = m->rca << 16;
c.resp_len = 32;
c.flags = 0;
__mmc_send_cmd(&c);
}
static int mmc_read_ext_csd(struct mmc *m)
{
struct cmd c;
c.index = CMD_GET_EXT_CSD;
c.addr = (uintptr_t) m->ext_csd;
c.flags = CMDF_DATA_XFER | CMDF_RD_XFER | CMDF_USE_DMA;
c.resp_len = 32;
c.nblock = 1;
c.args = 0;
return __mmc_send_cmd(&c);
}
int mmc_update_ext_csd()
{
struct mmc *m = &card;
return mmc_read_ext_csd(m);
}
int
mmc_switch(struct mmc *m, uint8_t index, uint8_t value)
{
struct cmd c;
uint8_t state;
uint64_t start = timer_us(0);
c.args = (MMC_SWITCH_MODE_WRITE_BYTE << 24)
| (index << 16)
| (value << 8);
c.resp_len = 32;
c.index = CMD_SWITCH;
c.flags = 0;
c.retry = 5;
if (__mmc_send_cmd(&c) != 0)
return 1;
mdelay(1);
/*
** After Switch command the card can be still in
** Programming state. Wait for it to become ready.
*/
c.resp_len = 32;
c.index = CMD_GET_STATE;
c.flags = 0;
c.args = m->rca << 16;
c.retry = 5;
do
{
if (timer_us(start) > 100 * 1000)
return 1;
if (__mmc_send_cmd(&c) != 0)
return 1;
if (c.resp [0] & 0x80) /* Switch Error */
return 1;
state = (c.resp [0] >> 9) & 0xf;
} while (state == 7); /* 7 = Programming State */
return 0;
}
int mmc_cid(uint8_t cid[16])
{
struct mmc *m = &card;
memcpy(cid, m->cid, sizeof(m->cid));
return 0;
}
static int mmc_card_hs200(struct mmc *m)
{
return (((m->host->caps2 & SDHCI_CAPS2_HS200) == SDHCI_CAPS2_HS200)
&& (m->ext_csd[EXT_CSD_DEVICE_TYPE] & CARD_TYPE_HS200));
}
#ifndef NO_HS400
static int mmc_card_hs400(struct mmc *m)
{
return ((m->host->caps2 & SDHCI_SUPPORT_HS400)
&& (m->ext_csd[EXT_CSD_DEVICE_TYPE] & CARD_TYPE_HS400));
}
#endif
int mmc_enable_hs200(struct mmc *m)
{
unsigned err = 0;
err = mmc_switch(m, EXT_CSD_BUS_WIDTH, MMC_BUS_WIDTH_8);
if (err)
{
ewerr("%s() BUS_WIDTH 8", __func__);
return err;
}
err = mmc_switch(m, EXT_CSD_HS_TIMING, EXT_CSD_HS200_ENABLE);
if (err)
{
ewerr("%s() HS_TIMING HS200", __func__);
return err;
}
m->freq = 200000;
m->bus_width = 8;
m->uhs_timing = SDHCI_UHS_HS200;
m->host->set_mode(m);
return 0;
}
#ifndef NO_HS400
/*
** Select HS400 mode - see JEDEC84-B51 standard
** Mode selection assumes HS400 is already enabled
*/
static int mmc_hs200_to_hs400(struct mmc *m)
{
unsigned err = 0;
/*
** 7. Set the HS_TIMING [185] to 0x1 and clk <= 52 Mhz
*/
m->freq = 50000;
m->uhs_timing = SDHCI_UHS_SDR50;
m->host->set_mode(m);
err = mmc_switch(m, EXT_CSD_HS_TIMING, EXT_CSD_HS_ENABLE);
if (err)
{
return err;
}
/*
** 8. Set BUS_WIDTH [183] to 0x06 to select the dual data rate x8 bus mode
*/
err = mmc_switch(m, EXT_CSD_BUS_WIDTH, MMC_BUS_WIDTH_8_DDR);
if (err)
{
return err;
}
/*
** 9. Set HS_TIMING [185] to 0x3 to select HS400
*/
err = mmc_switch(m, EXT_CSD_HS_TIMING, EXT_CSD_HS400_ENABLE);
if (err)
{
return err;
}
m->freq = 200000;
m->bus_width = 8;
m->uhs_timing = SDHCI_UHS_HS400;
m->host->set_mode(m);
return 0;
}
/*
** Enable HS400: Restore HS200 if fails
*/
int mmc_enable_hs400(struct mmc *m)
{
int err = 0;
err = mmc_hs200_to_hs400(m);
return err;
}
#endif
/*
** Main function for initializing SD/eMMC card.
*/
int mmc_init_card(pcidev_t dev)
{
struct mmc *m = &card;
int err;
if (m->init)
return 0;
/*
** SD card init may fail due to some residuous
** eMMC initialization (e.g from tuning).
** Make sure we start with a clean structure.
*/
memset((void *)m, 0, sizeof(struct mmc));
struct sdhci *host = sdhci_find_controller(dev);
if (! host)
{
ewerr("Error SDHCI host controller not found");
return 1;
}
m->host = host;
host->init_controller(host);
mmc_reset();
/*
** There are two ways of differentiating between an SD or eMMC card.
** CMD1 is illegal (timeout response) for SD card thus card is
** eMMC. Same applies for eMMC and CMD8.
** For fastboot sake assume card is eMMC.
*/
err = mmc_send_cmd1();
if (err) {
ewerr("Error MMC host controller not found");
return 1;
}
m->card_type = CARD_TYPE_MMC;
mmc_get_cid(m);
mmc_set_rca(m);
mmc_card_select(m);
// MMC
err = mmc_read_ext_csd(m);
if (err) {
ewerr(" MMC read ext csd failure");
return err;
}
if (mmc_card_hs200(m)) {
err = mmc_enable_hs200(m);
if (err) {
ewerr("MMC host hs200 enabling failure");
return err;
}
if(host->execute_tuning != NULL)
host->execute_tuning(m);
#ifndef NO_HS400
if (mmc_card_hs400(m)) {
err = mmc_enable_hs400(m);
if (err) {
ewerr("MMC host hs400 enabling failure");
return err;
}
ewdbg("MMC host hs400 enabled");
} else
#endif
ewdbg("MMC host hs200 enabled");
}
else {
ewerr("MMC host hs200 not supported");
return 1;
}
#if DEBUG_MESSAGES
emmc_show_hwinfo(m);
#endif
m->init = 1;
return 0;
}
| 22.399202 | 80 | 0.650864 |
184cdb291eea0467acb53abbaa57d317dd5fa7b1 | 5,208 | h | C | dp/third-party/hyperscan/src/parser/position.h | jtravee/neuvector | a88b9363108fc5c412be3007c3d4fb700d18decc | [
"Apache-2.0"
] | 2,868 | 2017-10-26T02:25:23.000Z | 2022-03-31T23:24:16.000Z | src/parser/position.h | kuangxiaohong/phytium-hyperscan | ae1932734859906278dba623b77f99bba1010d5c | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 270 | 2017-10-30T19:53:54.000Z | 2022-03-30T22:03:17.000Z | src/parser/position.h | kuangxiaohong/phytium-hyperscan | ae1932734859906278dba623b77f99bba1010d5c | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 403 | 2017-11-02T01:18:22.000Z | 2022-03-14T08:46:20.000Z | /*
* Copyright (c) 2015, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/** \file
* \brief Per-position flags used during Glushkov construction, PositionInfo class.
*/
#ifndef PARSER_POSITION_H
#define PARSER_POSITION_H
#include "ue2common.h"
#include <set>
namespace ue2 {
#define POS_FLAG_NOFLOAT (1 << 0) //!< don't wire to start-dotstar
#define POS_FLAG_MUST_FLOAT (1 << 1) //!< don't wire solely to start
#define POS_FLAG_FIDDLE_ACCEPT (1 << 2) //!< add a dot with an offset adjustment when wiring to accept
#define POS_FLAG_ASSERT_WORD_TO_NONWORD (1 << 3) //!< epsilon for word to nonword transition
#define POS_FLAG_ASSERT_NONWORD_TO_WORD (1 << 4) //!< epsilon for nonword to word transition
#define POS_FLAG_ASSERT_WORD_TO_WORD (1 << 5) //!< epsilon for word to word transition
#define POS_FLAG_ASSERT_NONWORD_TO_NONWORD (1 << 6) //!< epsilon for nonword to nonword transition
/** vertex created by cloning startDs, not considered part of the match.
* mirrors POS_FLAG_FIDDLE_ACCEPT */
#define POS_FLAG_VIRTUAL_START (1 << 7)
/** multi-line ^ does not match \\n at end of buffer. As a result, we must never
* wire the \\n from ^ to eod */
#define POS_FLAG_MULTILINE_START (1 << 8)
#define POS_FLAG_ASSERT_WORD_TO_NONWORD_UCP (1 << 9)
#define POS_FLAG_ASSERT_NONWORD_TO_WORD_UCP (1 << 10)
#define POS_FLAG_ASSERT_WORD_TO_WORD_UCP (1 << 11)
#define POS_FLAG_ASSERT_NONWORD_TO_NONWORD_UCP (1 << 12)
#define POS_FLAG_ASSERT_NONWORD_TO_ANY (POS_FLAG_ASSERT_NONWORD_TO_NONWORD \
| POS_FLAG_ASSERT_NONWORD_TO_WORD)
#define POS_FLAG_ASSERT_WORD_TO_ANY (POS_FLAG_ASSERT_WORD_TO_NONWORD \
| POS_FLAG_ASSERT_WORD_TO_WORD)
#define POS_FLAG_ASSERT_ANY_TO_NONWORD (POS_FLAG_ASSERT_NONWORD_TO_NONWORD \
| POS_FLAG_ASSERT_WORD_TO_NONWORD)
#define POS_FLAG_ASSERT_ANY_TO_WORD (POS_FLAG_ASSERT_NONWORD_TO_WORD \
| POS_FLAG_ASSERT_WORD_TO_WORD)
#define POS_FLAG_ASSERT_NONWORD_TO_ANY_UCP \
(POS_FLAG_ASSERT_NONWORD_TO_NONWORD_UCP \
| POS_FLAG_ASSERT_NONWORD_TO_WORD_UCP)
#define POS_FLAG_ASSERT_WORD_TO_ANY_UCP (POS_FLAG_ASSERT_WORD_TO_NONWORD_UCP \
| POS_FLAG_ASSERT_WORD_TO_WORD_UCP)
#define POS_FLAG_ASSERT_ANY_TO_NONWORD_UCP \
(POS_FLAG_ASSERT_NONWORD_TO_NONWORD_UCP \
| POS_FLAG_ASSERT_WORD_TO_NONWORD_UCP)
#define POS_FLAG_ASSERT_ANY_TO_WORD_UCP (POS_FLAG_ASSERT_WORD_TO_WORD_UCP \
| POS_FLAG_ASSERT_NONWORD_TO_WORD_UCP)
#define UCP_ASSERT_FLAGS (POS_FLAG_ASSERT_WORD_TO_ANY_UCP \
| POS_FLAG_ASSERT_NONWORD_TO_ANY_UCP)
#define NON_UCP_ASSERT_FLAGS (POS_FLAG_ASSERT_WORD_TO_ANY \
| POS_FLAG_ASSERT_NONWORD_TO_ANY)
/** do not wire to accept or other pos; may still wire to eod, etc if
* instructed */
#define POS_FLAG_ONLY_ENDS (1 << 23)
#define POS_FLAG_WIRE_EOD (1 << 24) /**< wire to accept eod */
#define POS_FLAG_WIRE_NL_EOD (1 << 25) /**< wire to nl before accept eod */
#define POS_FLAG_WIRE_NL_ACCEPT (1 << 26) /**< wire to nl before accept */
#define POS_FLAG_NO_NL_EOD (1 << 27) /**< disallow nl before accept eod */
#define POS_FLAG_NO_NL_ACCEPT (1 << 28) /**< disallow nl before accept */
/** \brief Parse and Glushkov construction use only. State number within the
* NFA as it is being constructed. */
typedef u32 Position;
} // namespace ue2
#endif // PARSER_POSITION_H
| 48.222222 | 115 | 0.703917 |
17552e22219c46de2e5645a3605e746b189ac1da | 40,210 | c | C | rl.c | Eidonko/Art | ef8c434c6a0dd11dbaa695387515d3697e196874 | [
"MIT"
] | null | null | null | rl.c | Eidonko/Art | ef8c434c6a0dd11dbaa695387515d3697e196874 | [
"MIT"
] | null | null | null | rl.c | Eidonko/Art | ef8c434c6a0dd11dbaa695387515d3697e196874 | [
"MIT"
] | null | null | null |
# line 2 "rl.y"
/*
*
* File: rl.y
*
* Description: parser of the RL language
*
* Language: yacc
*
* By Eidon@tutanota.com
*/
#define VERSION "v1.2 2018-06-14"
#define EFTOS_ENV "EFTOS_HOME"
#define EFTOS_SRC ".eftosrc"
#define EFTOS_OUT ".eftosrcode"
/* input and output file names */
char *ifname, *ofname;
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include "rl.h"
int i, goto_pc;
extern int list[], card_list, lines;
int default_action;
char verbose, debug;
FILE *f; /* output file pointer */
typedef struct { int role; int id; } ident_t;
#include "rcode.c"
# line 40 "rl.y"
typedef union {
int integer;
ident_t id;
struct { char name[64];
int rcode;
} string;
int status;
} YYSTYPE;
# define ROLE 257
# define NUMBER 258
# define GID 259
# define NID 260
# define TID 261
# define IF 262
# define ELSE 263
# define ELIF 264
# define FI 265
# define THEN 266
# define DEF 267
# define DA 268
# define KILL 269
# define RESTART 270
# define START 271
# define REBOOT 272
# define WARN 273
# define AND 274
# define OR 275
# define NOT 276
# define KILLED 277
# define REBOOTING 278
# define RESTARTED 279
# define PRESENT 280
# define ISOLATED 281
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern int yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
YYSTYPE yylval, yyval;
typedef int yytabelem;
#include <stdio.h>
# define YYERRCODE 256
yytabelem yyexca[] ={
-1, 1,
0, -1,
262, 23,
-2, 0,
-1, 10,
264, 27,
-2, 26,
-1, 20,
265, 31,
-2, 32,
-1, 69,
265, 34,
-2, 23,
-1, 99,
262, 23,
-2, 25,
-1, 100,
262, 23,
-2, 29,
-1, 101,
264, 27,
-2, 26,
};
# define YYNPROD 60
# define YYLAST 267
yytabelem yyact[]={
43, 73, 64, 96, 54, 27, 28, 82, 4, 68,
38, 31, 94, 95, 93, 92, 90, 91, 88, 89,
87, 56, 57, 58, 39, 22, 36, 34, 18, 35,
33, 2, 20, 61, 69, 40, 32, 55, 24, 25,
19, 62, 41, 15, 26, 14, 13, 12, 74, 75,
7, 72, 50, 30, 101, 23, 81, 21, 71, 11,
37, 29, 10, 17, 16, 6, 5, 3, 1, 42,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 51, 0, 0, 59, 60, 67, 0,
63, 0, 0, 0, 0, 65, 66, 0, 70, 0,
0, 0, 0, 0, 0, 0, 0, 0, 83, 84,
0, 0, 0, 0, 85, 86, 97, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98, 0, 99, 100, 102, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 52, 53, 52, 53, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 44, 45, 46, 47,
49, 48, 52, 53, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
76, 78, 80, 79, 77, 8, 9 };
yytabelem yypact[]={
-225, -2, 37, -1000, -1000, 36, 35, 33, -230, -21,
-1000, -237, -1000, -1000, -1000, -1000, -6, -22, -1, -264,
-1000, -253, -55, -227, -231, -228, -232, -1000, -1000, -255,
-239, -56, -40, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-40, -89, -238, -40, -40, -1000, -1000, -1000, -1000, -1000,
31, -91, -40, -40, 31, -1000, -1000, -1000, -1000, -32,
-1000, -1000, -1000, -1000, 31, -1000, -1000, -1000, -1000, -9,
-1000, -259, -1000, -1000, 31, 31, -238, -238, -241, -244,
-247, -263, 31, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, 31, -1000, -1000, -9,
-9, -1000, -1000 };
yytabelem yypgo[]={
0, 69, 37, 68, 67, 66, 65, 48, 64, 63,
33, 42, 62, 32, 61, 60, 59, 58, 34, 57,
56, 54, 53, 52, 51, 49 };
yytabelem yyr1[]={
0, 3, 3, 3, 4, 4, 4, 4, 5, 5,
8, 8, 9, 6, 6, 10, 10, 11, 11, 11,
11, 11, 7, 16, 17, 12, 13, 19, 20, 21,
13, 14, 22, 23, 14, 15, 1, 1, 1, 1,
1, 2, 2, 2, 18, 18, 24, 24, 24, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25 };
yytabelem yyr2[]={
0, 0, 4, 5, 2, 4, 5, 4, 9, 9,
3, 7, 7, 7, 7, 2, 2, 5, 6, 7,
7, 5, 9, 1, 1, 21, 0, 1, 1, 1,
24, 0, 1, 1, 11, 3, 2, 2, 2, 2,
2, 2, 2, 2, 0, 4, 2, 4, 4, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
yytabelem yychk[]={
-1000, -3, 256, -4, 10, -5, -6, -7, 267, 268,
-12, -16, 10, 10, 10, 10, -8, -9, 258, 61,
-13, -19, 262, 61, 44, 61, 45, 269, 270, -14,
-22, 264, 91, 257, 258, 257, 258, -15, 265, 263,
91, -11, -1, 40, 276, 277, 278, 279, 281, 280,
-23, -11, 274, 275, 93, -2, 259, 260, 261, -11,
-11, -10, 10, 59, 93, -11, -11, -10, 41, -18,
-10, -17, -24, 10, -7, -25, 269, 273, 270, 272,
271, -20, 266, -10, -10, -2, -2, 261, 259, 260,
260, 261, 259, 261, 259, 260, 266, -10, -10, -18,
-18, -21, -13 };
yytabelem yydef[]={
1, -2, 0, 2, 4, 0, 0, 0, 0, 0,
-2, 0, 3, 5, 6, 7, 0, 0, 10, 0,
-2, 0, 0, 0, 0, 0, 0, 13, 14, 0,
0, 0, 0, 8, 11, 9, 12, 22, 35, 33,
0, 0, 0, 0, 0, 36, 37, 38, 39, 40,
0, 0, 0, 0, 0, 17, 41, 42, 43, 0,
21, 44, 15, 16, 0, 19, 20, 24, 18, -2,
28, 0, 45, 46, 0, 0, 0, 0, 0, 0,
0, 0, 0, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 0, 44, 44, -2,
-2, -2, 30 };
typedef struct { char *t_name; int t_val; } yytoktype;
#ifndef YYDEBUG
# define YYDEBUG 0 /* don't allow debugging */
#endif
#if YYDEBUG
char * yyreds[] =
{
"-no such reduction-",
"rlstats : /* empty */",
"rlstats : rlstats rlstat",
"rlstats : error '\\n'",
"rlstat : '\\n'",
"rlstat : definition '\\n'",
"rlstat : default_action '\\n'",
"rlstat : if_then_else '\\n'",
"definition : DEF list '=' ROLE",
"definition : DEF interval '=' ROLE",
"list : NUMBER",
"list : list ',' NUMBER",
"interval : NUMBER '-' NUMBER",
"default_action : DA '=' KILL",
"default_action : DA '=' RESTART",
"sep : '\\n'",
"sep : ';'",
"expr : status id",
"expr : '(' expr ')'",
"expr : expr AND expr",
"expr : expr OR expr",
"expr : NOT expr",
"if_then_else : if elif else fi",
"if : /* empty */",
"if : IF '[' expr ']' sep",
"if : IF '[' expr ']' sep THEN sep actions",
"elif : /* empty */",
"elif : /* empty */",
"elif : ELIF '[' expr ']' sep",
"elif : ELIF '[' expr ']' sep THEN sep actions",
"elif : ELIF '[' expr ']' sep THEN sep actions elif",
"else : /* empty */",
"else : /* empty */",
"else : ELSE",
"else : ELSE sep actions",
"fi : FI",
"status : KILLED",
"status : REBOOTING",
"status : RESTARTED",
"status : ISOLATED",
"status : PRESENT",
"id : GID",
"id : NID",
"id : TID",
"actions : /* empty */",
"actions : actions action",
"action : '\\n'",
"action : if_then_else sep",
"action : recovery_action sep",
"recovery_action : KILL id",
"recovery_action : WARN id",
"recovery_action : RESTART TID",
"recovery_action : RESTART GID",
"recovery_action : RESTART NID",
"recovery_action : REBOOT NID",
"recovery_action : REBOOT TID",
"recovery_action : REBOOT GID",
"recovery_action : START TID",
"recovery_action : START GID",
"recovery_action : START NID",
};
yytoktype yytoks[] =
{
"ROLE", 257,
"NUMBER", 258,
"GID", 259,
"NID", 260,
"TID", 261,
"IF", 262,
"ELSE", 263,
"ELIF", 264,
"FI", 265,
"THEN", 266,
"DEF", 267,
"DA", 268,
"KILL", 269,
"RESTART", 270,
"START", 271,
"REBOOT", 272,
"WARN", 273,
"AND", 274,
"OR", 275,
"NOT", 276,
"KILLED", 277,
"REBOOTING", 278,
"RESTARTED", 279,
"PRESENT", 280,
"ISOLATED", 281,
"'\\n'", 10,
"'='", 61,
"','", 44,
"'-'", 45,
"';'", 59,
"'('", 40,
"')'", 41,
"'['", 91,
"']'", 93,
"-unknown-", -1 /* ends search */
};
#endif /* YYDEBUG */
/* @(#)27 1.7.1.3 src/bos/usr/ccs/bin/yacc/yaccpar, cmdlang, bos411, 9432B411a 8/10/94 14:01:53 */
/*
* COMPONENT_NAME: (CMDLANG) Language Utilities
*
* FUNCTIONS: yyparse
* ORIGINS: 3
*/
/*
** Skeleton parser driver for yacc output
*/
/*
** yacc user known macros and defines
*/
#ifdef YYSPLIT
# define YYERROR return(-2)
#else
# define YYERROR goto yyerrlab
#endif
#ifdef YACC_MSG
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#include <nl_types.h>
nl_catd yyusercatd;
#endif
#define YYACCEPT return(0)
#define YYABORT return(1)
#ifndef YACC_MSG
#define YYBACKUP( newtoken, newvalue )\
{\
if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
{\
yyerror( "syntax error - cannot backup" );\
YYERROR;\
}\
yychar = newtoken;\
yystate = *yyps;\
yylval = newvalue;\
goto yynewstate;\
}
#else
#define YYBACKUP( newtoken, newvalue )\
{\
if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
{\
yyusercatd=catopen("yacc_user.cat", NL_CAT_LOCALE);\
yyerror(catgets(yyusercatd,1,1,"syntax error - cannot backup" ));\
YYERROR;\
}\
yychar = newtoken;\
yystate = *yyps;\
yylval = newvalue;\
goto yynewstate;\
}
#endif
#define YYRECOVERING() (!!yyerrflag)
#ifndef YYDEBUG
# define YYDEBUG 1 /* make debugging available */
#endif
/*
** user known globals
*/
int yydebug; /* set to 1 to get debugging */
/*
** driver internal defines
*/
#define YYFLAG (-1000)
#ifdef YYSPLIT
# define YYSCODE { \
extern int (*_yyf[])(); \
register int yyret; \
if (_yyf[yytmp]) \
if ((yyret=(*_yyf[yytmp])()) == -2) \
goto yyerrlab; \
else if (yyret>=0) return(yyret); \
}
#endif
/*
** global variables used by the parser
*/
YYSTYPE yyv[ YYMAXDEPTH ]; /* value stack */
int yys[ YYMAXDEPTH ]; /* state stack */
YYSTYPE *yypv; /* top of value stack */
YYSTYPE *yypvt; /* top of value stack for $vars */
int *yyps; /* top of state stack */
int yystate; /* current state */
int yytmp; /* extra var (lasts between blocks) */
int yynerrs; /* number of errors */
int yyerrflag; /* error recovery flag */
int yychar; /* current input token number */
#ifdef __cplusplus
#ifdef _CPP_IOSTREAMS
#include <iostream.h>
extern void yyerror (char *); /* error message routine -- iostream version */
#else
#include <stdio.h>
extern "C" void yyerror (char *); /* error message routine -- stdio version */
#endif /* _CPP_IOSTREAMS */
extern "C" int yylex(void); /* return the next token */
#endif /* __cplusplus */
/*
** yyparse - return 0 if worked, 1 if syntax error not recovered from
*/
#ifdef __cplusplus
extern "C"
#endif /* __cplusplus */
int
yyparse()
{
/*
** Initialize externals - yyparse may be called more than once
*/
yypv = &yyv[-1];
yyps = &yys[-1];
yystate = 0;
yytmp = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = -1;
#ifdef YACC_MSG
yyusercatd=catopen("yacc_user.cat", NL_CAT_LOCALE);
#endif
goto yystack;
{
register YYSTYPE *yy_pv; /* top of value stack */
register int *yy_ps; /* top of state stack */
register int yy_state; /* current state */
register int yy_n; /* internal state number info */
/*
** get globals into registers.
** branch to here only if YYBACKUP was called.
*/
yynewstate:
yy_pv = yypv;
yy_ps = yyps;
yy_state = yystate;
goto yy_newstate;
/*
** get globals into registers.
** either we just started, or we just finished a reduction
*/
yystack:
yy_pv = yypv;
yy_ps = yyps;
yy_state = yystate;
/*
** top of for (;;) loop while no reductions done
*/
yy_stack:
/*
** put a state and value onto the stacks
*/
#if YYDEBUG
/*
** if debugging, look up token value in list of value vs.
** name pairs. 0 and negative (-1) are special values.
** Note: linear search is used since time is not a real
** consideration while debugging.
*/
if ( yydebug )
{
register int yy_i;
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "State " << yy_state << " token ";
if ( yychar == 0 )
cout << "end-of-file" << endl;
else if ( yychar < 0 )
cout << "-none-" << endl;
#else
printf( "State %d, token ", yy_state );
if ( yychar == 0 )
printf( "end-of-file\n" );
else if ( yychar < 0 )
printf( "-none-\n" );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
else
{
for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val == yychar )
break;
}
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << yytoks[yy_i].t_name << endl;
#else
printf( "%s\n", yytoks[yy_i].t_name );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
}
}
#endif /* YYDEBUG */
if ( ++yy_ps >= &yys[ YYMAXDEPTH ] ) /* room on stack? */
{
#ifndef YACC_MSG
yyerror( "yacc stack overflow" );
#else
yyerror(catgets(yyusercatd,1,2,"yacc stack overflow" ));
#endif
YYABORT;
}
*yy_ps = yy_state;
*++yy_pv = yyval;
/*
** we have a new state - find out what to do
*/
yy_newstate:
if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
goto yydefault; /* simple state */
#if YYDEBUG
/*
** if debugging, need to mark whether new token grabbed
*/
yytmp = yychar < 0;
#endif
if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
yychar = 0; /* reached EOF */
#if YYDEBUG
if ( yydebug && yytmp )
{
register int yy_i;
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "Received token " << endl;
if ( yychar == 0 )
cout << "end-of-file" << endl;
else if ( yychar < 0 )
cout << "-none-" << endl;
#else
printf( "Received token " );
if ( yychar == 0 )
printf( "end-of-file\n" );
else if ( yychar < 0 )
printf( "-none-\n" );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
else
{
for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val == yychar )
break;
}
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << yytoks[yy_i].t_name << endl;
#else
printf( "%s\n", yytoks[yy_i].t_name );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
}
}
#endif /* YYDEBUG */
if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
goto yydefault;
if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/
{
yychar = -1;
yyval = yylval;
yy_state = yy_n;
if ( yyerrflag > 0 )
yyerrflag--;
goto yy_stack;
}
yydefault:
if ( ( yy_n = yydef[ yy_state ] ) == -2 )
{
#if YYDEBUG
yytmp = yychar < 0;
#endif
if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
yychar = 0; /* reached EOF */
#if YYDEBUG
if ( yydebug && yytmp )
{
register int yy_i;
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "Received token " << endl;
if ( yychar == 0 )
cout << "end-of-file" << endl;
else if ( yychar < 0 )
cout << "-none-" << endl;
#else
printf( "Received token " );
if ( yychar == 0 )
printf( "end-of-file\n" );
else if ( yychar < 0 )
printf( "-none-\n" );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
else
{
for ( yy_i = 0;
yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val
== yychar )
{
break;
}
}
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << yytoks[yy_i].t_name << endl;
#else
printf( "%s\n", yytoks[yy_i].t_name );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
}
}
#endif /* YYDEBUG */
/*
** look through exception table
*/
{
register int *yyxi = yyexca;
while ( ( *yyxi != -1 ) ||
( yyxi[1] != yy_state ) )
{
yyxi += 2;
}
while ( ( *(yyxi += 2) >= 0 ) &&
( *yyxi != yychar ) )
;
if ( ( yy_n = yyxi[1] ) < 0 )
YYACCEPT;
}
}
/*
** check for syntax error
*/
if ( yy_n == 0 ) /* have an error */
{
/* no worry about speed here! */
switch ( yyerrflag )
{
case 0: /* new error */
#ifndef YACC_MSG
yyerror( "syntax error" );
#else
yyerror(catgets(yyusercatd,1,3,"syntax error" ));
#endif
goto skip_init;
yyerrlab:
/*
** get globals into registers.
** we have a user generated syntax type error
*/
yy_pv = yypv;
yy_ps = yyps;
yy_state = yystate;
yynerrs++;
skip_init:
case 1:
case 2: /* incompletely recovered error */
/* try again... */
yyerrflag = 3;
/*
** find state where "error" is a legal
** shift action
*/
while ( yy_ps >= yys )
{
yy_n = yypact[ *yy_ps ] + YYERRCODE;
if ( yy_n >= 0 && yy_n < YYLAST &&
yychk[yyact[yy_n]] == YYERRCODE) {
/*
** simulate shift of "error"
*/
yy_state = yyact[ yy_n ];
goto yy_stack;
}
/*
** current state has no shift on
** "error", pop stack
*/
#if YYDEBUG
if ( yydebug )
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "Error recovery pops state "
<< (*yy_ps)
<< ", uncovers state "
<< yy_ps[-1] << endl;
#else
# define _POP_ "Error recovery pops state %d, uncovers state %d\n"
printf( _POP_, *yy_ps,
yy_ps[-1] );
# undef _POP_
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
#endif
yy_ps--;
yy_pv--;
}
/*
** there is no state on stack with "error" as
** a valid shift. give up.
*/
YYABORT;
case 3: /* no shift yet; eat a token */
#if YYDEBUG
/*
** if debugging, look up token in list of
** pairs. 0 and negative shouldn't occur,
** but since timing doesn't matter when
** debugging, it doesn't hurt to leave the
** tests here.
*/
if ( yydebug )
{
register int yy_i;
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "Error recovery discards ";
if ( yychar == 0 )
cout << "token end-of-file" << endl;
else if ( yychar < 0 )
cout << "token -none-" << endl;
#else
printf( "Error recovery discards " );
if ( yychar == 0 )
printf( "token end-of-file\n" );
else if ( yychar < 0 )
printf( "token -none-\n" );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
else
{
for ( yy_i = 0;
yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val
== yychar )
{
break;
}
}
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "token " <<
yytoks[yy_i].t_name <<
endl;
#else
printf( "token %s\n",
yytoks[yy_i].t_name );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
}
}
#endif /* YYDEBUG */
if ( yychar == 0 ) /* reached EOF. quit */
YYABORT;
yychar = -1;
goto yy_newstate;
}
}/* end if ( yy_n == 0 ) */
/*
** reduction by production yy_n
** put stack tops, etc. so things right after switch
*/
#if YYDEBUG
/*
** if debugging, print the string that is the user's
** specification of the reduction which is just about
** to be done.
*/
if ( yydebug )
#if defined(__cplusplus) && defined(_CPP_IOSTREAMS)
cout << "Reduce by (" << yy_n << ") \"" <<
yyreds[ yy_n ] << "\"\n";
#else
printf( "Reduce by (%d) \"%s\"\n",
yy_n, yyreds[ yy_n ] );
#endif /* defined(__cplusplus) && defined(_CPP_IOSTREAMS) */
#endif
yytmp = yy_n; /* value to switch over */
yypvt = yy_pv; /* $vars top of value stack */
/*
** Look in goto table for next state
** Sorry about using yy_state here as temporary
** register variable, but why not, if it works...
** If yyr2[ yy_n ] doesn't have the low order bit
** set, then there is no action to be done for
** this reduction. So, no saving & unsaving of
** registers done. The only difference between the
** code just after the if and the body of the if is
** the goto yy_stack in the body. This way the test
** can be made before the choice of what to do is needed.
*/
{
/* length of production doubled with extra bit */
register int yy_len = yyr2[ yy_n ];
if ( !( yy_len & 01 ) )
{
yy_len >>= 1;
yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
*( yy_ps -= yy_len ) + 1;
if ( yy_state >= YYLAST ||
yychk[ yy_state =
yyact[ yy_state ] ] != -yy_n )
{
yy_state = yyact[ yypgo[ yy_n ] ];
}
goto yy_stack;
}
yy_len >>= 1;
yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
*( yy_ps -= yy_len ) + 1;
if ( yy_state >= YYLAST ||
yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
{
yy_state = yyact[ yypgo[ yy_n ] ];
}
}
/* save until reenter driver code */
yystate = yy_state;
yyps = yy_ps;
yypv = yy_pv;
}
/*
** code supplied by user is placed in this switch
*/
switch(yytmp){
case 3:
# line 68 "rl.y"
{
fprintf(stderr, "\tLine %d: syntax error.\n", lines);
} /*NOTREACHED*/ break;
case 6:
# line 76 "rl.y"
{
printf("\tDefault action is %s\n",
(default_action==KILL)? "killing":"restarting");
} /*NOTREACHED*/ break;
case 8:
# line 84 "rl.y"
{
for (i=0; i<card_list; i++)
{
rcode_set_role((char) list[i], yypvt[-0].string.rcode);
}
} /*NOTREACHED*/ break;
case 9:
# line 92 "rl.y"
{ int i;
for (i=list[0]; i<=list[1]; i++)
{
rcode_set_role((char) i, yypvt[-0].string.rcode);
}
} /*NOTREACHED*/ break;
case 10:
# line 101 "rl.y"
{
list[card_list++] = yypvt[-0].integer;
} /*NOTREACHED*/ break;
case 11:
# line 106 "rl.y"
{
list[card_list++] = yypvt[-0].integer;
} /*NOTREACHED*/ break;
case 12:
# line 112 "rl.y"
{
list[card_list++] = yypvt[-2].integer;
list[card_list++] = yypvt[-0].integer;
} /*NOTREACHED*/ break;
case 13:
# line 119 "rl.y"
{
default_action = KILL;
rcode_set_defaction(R_DA_IS_KILL);
} /*NOTREACHED*/ break;
case 14:
# line 125 "rl.y"
{
default_action = RESTART;
rcode_set_defaction(R_DA_IS_RESTART);
} /*NOTREACHED*/ break;
case 17:
# line 136 "rl.y"
{
if (debug)
printf("\t\t +expr(pc==%d)\n", pc);
rcode_status (yypvt[-1].status, yypvt[-0].id);
if (debug)
printf("\t\t -expr(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 19:
# line 147 "rl.y"
{
if (debug)
printf("\t\t +exprAND(pc==%d)\n", pc);
rcode_boolean (R_AND);
if (debug)
printf("\t\t -exprAND(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 20:
# line 157 "rl.y"
{
if (debug)
printf("\t\t +exprOR(pc==%d)\n", pc);
rcode_boolean (R_OR);
if (debug)
printf("\t\t -exprOR(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 21:
# line 167 "rl.y"
{
if (debug)
printf("\t\t +exprNOT(pc==%d)\n", pc);
rcode_boolean (R_NOT);
if (debug)
printf("\t\t -exprNOT(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 22:
# line 179 "rl.y"
{
printf("\tif-then-else: ok\n");
} /*NOTREACHED*/ break;
case 23:
# line 184 "rl.y"
{
if (debug)
printf("\t if starts...(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 24:
# line 189 "rl.y"
{
if (debug)
printf("\t\t +if expr(pc==%d)\n", pc);
rcode_if();
if (debug)
printf("\t\t -if expr(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 25:
# line 199 "rl.y"
{
if (debug)
printf("\t\t then actions(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 27:
# line 206 "rl.y"
{
if (debug)
printf("\t\t elif starts...(pc==%d)\n", pc);
goto_pc = rcode_goto(0);
} /*NOTREACHED*/ break;
case 28:
# line 213 "rl.y"
{
if (debug)
printf("\t\t +elif expr(pc==%d)\n", pc);
rcode_elif(goto_pc);
if (debug)
printf("\t\t -elif expr(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 29:
# line 223 "rl.y"
{
if (debug)
printf("\t\t then actions(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 32:
# line 231 "rl.y"
{
if (debug)
printf("\t\t else starts...(pc==%d)\n", pc);
goto_pc = rcode_goto(0);
} /*NOTREACHED*/ break;
case 33:
# line 237 "rl.y"
{
if (debug)
printf("\t\t +else starts...(pc==%d)\n", pc);
rcode_else(goto_pc);
if (debug)
printf("\t\t -else starts...(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 34:
# line 247 "rl.y"
{
if (debug)
printf("\t\t actions(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 35:
# line 254 "rl.y"
{
if (debug)
printf("\t\t +fi(pc==%d)\n", pc);
rcode_fi();
if (debug)
printf("\t\t -fi(pc==%d)\n", pc);
} /*NOTREACHED*/ break;
case 49:
# line 283 "rl.y"
{
if (debug)
printf("adding recovery action: kill %d %d\n", yypvt[-0].id.role, yypvt[-0].id.id);
rcode_raction(R_KILL, yypvt[-0].id.role, yypvt[-0].id.id);
} /*NOTREACHED*/ break;
case 50:
# line 289 "rl.y"
{
if (debug)
printf("adding recovery action: warn %d %d\n", yypvt[-0].id.role, yypvt[-0].id.id);
rcode_raction(R_WARN, yypvt[-0].id.role, yypvt[-0].id.id);
} /*NOTREACHED*/ break;
case 51:
# line 295 "rl.y"
{
if (debug)
printf("adding recovery action: restart %d %d\n", yypvt[-0].id.role, yypvt[-0].id.id);
rcode_raction(R_RESTART, yypvt[-0].id.role, yypvt[-0].id.id);
} /*NOTREACHED*/ break;
case 52:
# line 301 "rl.y"
{
if (debug)
printf("adding recovery action: restart %d %d\n", yypvt[-0].id.role, yypvt[-0].id.id);
rcode_raction(R_RESTART, yypvt[-0].id.role, yypvt[-0].id.id);
} /*NOTREACHED*/ break;
case 53:
# line 307 "rl.y"
{
fprintf(stderr, "\tLine %d: semantical error.\n", lines);
yyerror("Can't restart nodes");
} /*NOTREACHED*/ break;
case 54:
# line 312 "rl.y"
{
if (debug)
printf("adding recovery action: reboot %d %d\n", yypvt[-0].id.role, yypvt[-0].id.id);
rcode_raction(R_REBOOT, yypvt[-0].id.role, yypvt[-0].id.id);
} /*NOTREACHED*/ break;
case 55:
# line 318 "rl.y"
{
fprintf(stderr, "\tLine %d: semantical error.\n", lines);
yyerror("Can't reboot threads");
} /*NOTREACHED*/ break;
case 56:
# line 323 "rl.y"
{
fprintf(stderr, "\tLine %d: semantical error.\n", lines);
yyerror("Can't reboot groups");
} /*NOTREACHED*/ break;
case 57:
# line 328 "rl.y"
{
if (debug)
printf("adding recovery action: start %d %d\n", yypvt[-0].id.role, yypvt[-0].id.id);
rcode_raction(R_KILL, yypvt[-0].id.role, yypvt[-0].id.id);
} /*NOTREACHED*/ break;
case 58:
# line 334 "rl.y"
{
fprintf(stderr, "\tLine %d: semantical error.\n", lines);
yyerror("Can't start groups");
} /*NOTREACHED*/ break;
case 59:
# line 339 "rl.y"
{
fprintf(stderr, "\tLine %d: semantical error.\n", lines);
yyerror("Can't start nodes");
} /*NOTREACHED*/ break;
}
goto yystack; /* reset registers in driver code */
}
# line 345 "rl.y"
#include "lex.yy.c"
main(int argc, char *argv[])
{
char filename[255];
char *path;
int fd;
clock_t t1, t2;
void options(void);
extern FILE *f; /* output file pointer */
ifname = EFTOS_SRC;
ofname = EFTOS_OUT;
fprintf(stderr, "RL translator, %s, by Eidon@tutanota.com.\n", VERSION);
for (i=1; i<argc; i++)
if (argv[i][0] == '-')
switch (argv[i][1])
{
case 'i': ifname = argv[++i];
break;
case 'o': ofname = argv[++i];
break;
case 'v': verbose= 1;
break;
case 'd': debug= 1;
break;
default : fprintf(stderr, "Invalid option.\n");
options();
exit(1);
}
else
{
fprintf(stderr, "Invalid option --- aborting.\n");
options();
exit(1);
}
fd = open(ifname,O_RDONLY);
if(fd<0)
{
fprintf(stderr, "Couldn't open file %s", ifname);
if( (path = getenv(EFTOS_ENV)) )
{
sprintf(filename, "%s/%s", path, ifname);
ifname = filename;
if ( (fd = open(filename, O_RDONLY)) < 0 )
{
fprintf(stderr, " nor file %s --- exiting.\n", filename);
exit(1);
}
fprintf(stderr, ". Switching...\n");
}
else
{
fprintf(stderr, " --- exiting.\n");
exit(1);
}
}
dup2(fd,0);
f = fopen(ofname, "wb");
if (f==NULL)
{
fprintf(stderr, "Couldn't open %s for writing --- exiting.\n", ofname);
exit(1);
}
fprintf(stderr, "Parsing file %s...\n", ifname);
t1 = clock();
yyparse();
rcode_stop();
rflush();
t2 = clock();
fprintf(stderr, "...done (%d lines in %lf CPU secs", lines,
(double)(t2-t1)/CLOCKS_PER_SEC);
if (t2-t1 != 0)
fprintf(stderr, ", or %.3lf lines per CPU sec.)\n",
(double) lines * CLOCKS_PER_SEC / (t2-t1));
else
fprintf(stderr, ".)\n");
}
void options()
{
fprintf(stderr, "Valid options are\n");
fprintf(stderr, " -i <filename> : set input to <filename>\n");
fprintf(stderr, " -o <filename> : set output to <filename>\n");
fprintf(stderr, " -v : set verbose mode\n");
}
int ident2int(ident_t who)
{
return who.role + who.id;
}
ident_t int2ident(int n)
{
ident_t i;
if (! (ID_GROUP < ID_NODE && ID_NODE < ID_THREAD) )
{
fprintf(stderr, "Inconsistency on [GNT]_OFFSET's\n");
}
if (n >= ID_GROUP && n<ID_NODE)
{
i.role = ID_GROUP;
i.id = n - ID_GROUP;
return i;
}
if (n >= ID_NODE && n < ID_THREAD)
{
i.role = ID_NODE;
i.id = n - ID_NODE;
return i;
}
i.role = ID_THREAD;
i.id = n - ID_THREAD;
return i;
}
| 32.585089 | 121 | 0.394976 |
a57ae222ebd037a5e2b292b1b2c78c5b9f15f9e6 | 3,403 | c | C | firmware/fx2.c | auscompgeek/litex-buildenv | fc388fffa6e8ebd0c6483186c914177d7c69e7e6 | [
"BSD-2-Clause"
] | 198 | 2018-01-17T05:39:54.000Z | 2022-03-15T08:59:16.000Z | firmware/fx2.c | auscompgeek/litex-buildenv | fc388fffa6e8ebd0c6483186c914177d7c69e7e6 | [
"BSD-2-Clause"
] | 610 | 2017-12-31T01:32:32.000Z | 2022-03-19T22:07:28.000Z | firmware/fx2.c | auscompgeek/litex-buildenv | fc388fffa6e8ebd0c6483186c914177d7c69e7e6 | [
"BSD-2-Clause"
] | 85 | 2018-01-13T05:51:38.000Z | 2022-02-11T18:54:14.000Z | #include "fx2.h"
#include "asm.h"
#include "stdio_wrap.h"
#ifdef CSR_OPSIS_I2C_FX2_RESET_OUT_ADDR
#define FX2_HACK_SLAVE_ADDRESS 0x40
#define FX2_HACK_SHIFT_REG_FULL 1
#define FX2_HACK_SHIFT_REG_EMPTY 2
#define FX2_HACK_STATUS_READY 0
#include "fx2_fw_usbjtag.c"
#ifdef ENCODER_BASE
#include "fx2_fw_hdmi2usb.c"
#endif
enum fx2_fw_version fx2_fw_active;
static unsigned next_read_addr;
static unsigned end_addr;
static inline uint8_t fx2_fw_get_value(unsigned addr) {
uint8_t r = 0xff;
if (addr <= end_addr) {
switch(fx2_fw_active) {
case FX2FW_USBJTAG:
r = fx2_mbfw_usbjtag.bytes[addr];
break;
#ifdef ENCODER_BASE
case FX2FW_HDMI2USB:
r = fx2_mbfw_hdmi2usb.bytes[addr];
break;
#endif
}
} else {
wprintf("fx2: Read from invalid address %02X (end: %02X)\n", addr, end_addr);
}
return r;
}
// FIXME: These should be in microseconds and scaled based on CPU frequency or
// something.
#define FX2_REPORT_PERIOD (1 << 20)
#define FX2_WAIT_PERIOD FX2_REPORT_PERIOD*5
#define FX2_RESET_PERIOD (1 << 16)
static void fx2_load_init(void)
{
next_read_addr = 0;
switch(fx2_fw_active) {
case FX2FW_USBJTAG:
end_addr = FX2_MBFW_USBJTAG_END;
break;
#ifdef ENCODER_BASE
case FX2FW_HDMI2USB:
end_addr = FX2_MBFW_HDMI2USB_END;
break;
#endif
}
opsis_i2c_fx2_hack_slave_addr_write(FX2_HACK_SLAVE_ADDRESS);
opsis_i2c_fx2_hack_shift_reg_write(fx2_fw_get_value(0));
opsis_i2c_fx2_hack_status_write(FX2_HACK_STATUS_READY);
}
static void fx2_load(void)
{
fx2_load_init();
wprintf("fx2: Waiting for FX2 to load firmware.\n");
uint64_t i = 0;
while((i < FX2_WAIT_PERIOD)) {
i++;
if (fx2_service(false)) {
i = 0;
if (next_read_addr == 0) {
break;
}
} else if ((i % FX2_REPORT_PERIOD) == 0) {
wprintf("fx2: Waiting at %02X (end: %02X)\n", next_read_addr, end_addr);
}
}
if (i > 0) {
wprintf("fx2: Timeout loading!\n");
} else {
wprintf("fx2: Booted.\n");
}
}
bool fx2_service(bool verbose)
{
unsigned char status = opsis_i2c_fx2_hack_status_read();
if(status == FX2_HACK_SHIFT_REG_EMPTY) { // there's been a master READ
if (verbose) {
wprintf("fx2: read %02X (end: %02X)\n", next_read_addr, end_addr);
}
if (next_read_addr < end_addr) {
// Load next value into the system
opsis_i2c_fx2_hack_shift_reg_write(fx2_fw_get_value(next_read_addr+1));
opsis_i2c_fx2_hack_status_write(FX2_HACK_STATUS_READY);
next_read_addr++;
} else {
wprintf("fx2: Finished loading firmware.\n");
fx2_load_init();
}
return true;
} else if (status != 0) {
wprintf("fx2: Bad status %02X\n", status);
}
return false;
}
void fx2_reboot(enum fx2_fw_version fw)
{
OPSIS_I2C_ACTIVE(OPSIS_I2C_FX2HACK);
unsigned int i;
fx2_fw_active = fw;
wprintf("fx2: Turning off.\n");
opsis_i2c_fx2_reset_out_write(1);
for(i=0;i<FX2_RESET_PERIOD;i++) NOP;
opsis_i2c_fx2_reset_out_write(0);
wprintf("fx2: Turning on.\n");
fx2_load();
}
void fx2_debug(void) {
wprintf("Possible FX2 Firmware:\n");
wprintf(" [%s] usbjtag (%02X) (IXO USB JTAG Mode)\n", fx2_fw_active == FX2FW_USBJTAG ? "*" : " ", (unsigned int)FX2_MBFW_USBJTAG_END);
#ifdef ENCODER_BASE
wprintf(" [%s] hdmi2usb (%02X) (HDMI2USB Video Capture Mode)\n", fx2_fw_active == FX2FW_HDMI2USB ? "*" : " ", (unsigned int)FX2_MBFW_HDMI2USB_END);
#endif
}
void fx2_init(void)
{
#ifdef ENCODER_BASE
fx2_reboot(FX2FW_HDMI2USB);
#else
fx2_reboot(FX2FW_USBJTAG);
#endif
}
#endif
| 23.308219 | 148 | 0.723185 |
023a5bc93b45e17955d693378fc05969820531a7 | 2,687 | h | C | BizSwaggerClient/Classes/SwaggerClient/Api/SWGSupplychainApi.h | yidixue/objc-client | 6b1963c0e85e5d2ae5f6026821d1e1caba089416 | [
"MIT"
] | null | null | null | BizSwaggerClient/Classes/SwaggerClient/Api/SWGSupplychainApi.h | yidixue/objc-client | 6b1963c0e85e5d2ae5f6026821d1e1caba089416 | [
"MIT"
] | null | null | null | BizSwaggerClient/Classes/SwaggerClient/Api/SWGSupplychainApi.h | yidixue/objc-client | 6b1963c0e85e5d2ae5f6026821d1e1caba089416 | [
"MIT"
] | null | null | null | #import <Foundation/Foundation.h>
#import "SWGCompanyClueApiResponse.h"
#import "SWGPhoneClueApiResponse.h"
#import "SWGSupplychainApiResponse.h"
#import "SWGApi.h"
/**
* 领商-对外开放服务API
* 提供领商对外开放服务所有Restful接口
*
* OpenAPI spec version: 1.0.0
* Contact: ys@ibizplus.cn
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
@interface SWGSupplychainApi: NSObject <SWGApi>
extern NSString* kSWGSupplychainApiErrorDomain;
extern NSInteger kSWGSupplychainApiMissingParamErrorCode;
-(instancetype) initWithApiClient:(SWGApiClient *)apiClient NS_DESIGNATED_INITIALIZER;
/// 查询线索详情
///
///
/// @param companyId 公司ID
/// @param loginToken 登录令牌 (optional)
///
/// code:200 message:"successful operation",
/// code:401 message:"Unauthorized",
/// code:403 message:"Forbidden",
/// code:404 message:"Not Found"
///
/// @return SWGSupplychainApiResponse*
-(NSURLSessionTask*) getClueDetailUsingGETWithCompanyId: (NSString*) companyId
loginToken: (NSString*) loginToken
completionHandler: (void (^)(SWGSupplychainApiResponse* output, NSError* error)) handler;
/// 查询客户线索
///
///
/// @param companyId 公司ID
/// @param loginToken 登录令牌 (optional)
///
/// code:200 message:"successful operation",
/// code:401 message:"Unauthorized",
/// code:403 message:"Forbidden",
/// code:404 message:"Not Found"
///
/// @return SWGCompanyClueApiResponse*
-(NSURLSessionTask*) getCustomerCluesUsingGETWithCompanyId: (NSString*) companyId
loginToken: (NSString*) loginToken
completionHandler: (void (^)(SWGCompanyClueApiResponse* output, NSError* error)) handler;
/// 查询电话线索
///
///
/// @param companyId 公司ID
/// @param loginToken 登录令牌 (optional)
///
/// code:200 message:"successful operation",
/// code:401 message:"Unauthorized",
/// code:403 message:"Forbidden",
/// code:404 message:"Not Found"
///
/// @return SWGPhoneClueApiResponse*
-(NSURLSessionTask*) getPhoneCluesUsingGETWithCompanyId: (NSString*) companyId
loginToken: (NSString*) loginToken
completionHandler: (void (^)(SWGPhoneClueApiResponse* output, NSError* error)) handler;
/// 查询供应商线索
///
///
/// @param companyId 公司ID
/// @param loginToken 登录令牌 (optional)
///
/// code:200 message:"successful operation",
/// code:401 message:"Unauthorized",
/// code:403 message:"Forbidden",
/// code:404 message:"Not Found"
///
/// @return SWGCompanyClueApiResponse*
-(NSURLSessionTask*) getSupplierCluesUsingGETWithCompanyId: (NSString*) companyId
loginToken: (NSString*) loginToken
completionHandler: (void (^)(SWGCompanyClueApiResponse* output, NSError* error)) handler;
@end
| 27.418367 | 93 | 0.728694 |
8b046223c7987ac25549c3f2e480472997ba9478 | 4,171 | c | C | QMK_Files/eek/keymaps/ledtest/keymap.c | MangoIV/eek_doc | ee05095c604aa1e3b5a03b49860bcb5f050f8c50 | [
"MIT"
] | 5 | 2020-12-19T01:41:36.000Z | 2021-11-22T14:58:45.000Z | QMK_Files/eek/keymaps/ledtest/keymap.c | Klackygears/eek_case | 25e54fd43a136a6be60bc6f724a86bf9bb666df9 | [
"MIT"
] | 1 | 2020-12-19T16:54:56.000Z | 2020-12-19T16:54:56.000Z | QMK_Files/eek/keymaps/ledtest/keymap.c | Klackygears/eek_case | 25e54fd43a136a6be60bc6f724a86bf9bb666df9 | [
"MIT"
] | 2 | 2020-12-08T04:43:38.000Z | 2020-12-19T12:58:09.000Z | /* Copyright 2020 klackygears
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum layer_names {
_QUERTY,
_LOWER,
_RAISE,
_ADJUST
};
enum custom_keycodes {
RGBRST = SAFE_RANGE
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
*
* ,----------------------------------. ,------------------------------------------------------------------------------.
* | Q | W | E | R | T | | RGB reset|Hue increase|Saturation increase|Brightness increase|Speed increase|
* |------+------+------+------+------| |----------+------------+-------------------+-------------------+--------------|
* | A | S | D | F | G | | RGB Mode |Hue decrease|Saturation decrease|Brightness decrease|Speed decrease|
* |------+------+------+------+------| |----------+------------+-------------------+-------------------+--------------|
* | Z | X | C | V | B | |RGB Toggle| M | , | . | / |
* `-------------+------+------+------| |----------+------------+-------------------+----------------------------------'
* | Ctrl | LOWER| Space| | BckSpc | RAISE | Shift |
* `--------------------' `-------------------------------------------'
*
*/
[_QUERTY] = LAYOUT_split_3x5_3(
KC_Q, KC_W, KC_E, KC_R, KC_T, RGBRST, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI,
KC_A, KC_S, KC_D, KC_F, KC_G, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD,
KC_Z, KC_X, KC_C, KC_V, KC_B, RGB_TOG, KC_M, KC_COMM, KC_DOT, KC_SLSH,
KC_LCTL, MO(_LOWER), KC_SPC, KC_BSPC, MO(_RAISE), OSM(MOD_LSFT)
),
[_LOWER] = LAYOUT_split_3x5_3(
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
KC_ESC, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR,
KC_CAPS, KC_TILD, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_DQT,
_______, _______, _______, KC_ENT, _______, KC_DEL
),
[_RAISE] = LAYOUT_split_3x5_3(
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_TAB, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC,
KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, _______, _______, _______, _______, KC_BSLS, KC_QUOT,
_______, _______, _______, _______, _______, _______
),
[_ADJUST] = LAYOUT_split_3x5_3(
RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, RGB_TOG, _______, KC_F9, KC_F10, KC_F11, KC_F12,
RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, _______, _______, KC_F5, KC_F6, KC_F7, KC_F8,
_______, _______, _______, _______, _______, RESET, KC_F1, KC_F2, KC_F3, KC_F4,
_______, _______, _______, _______, _______, _______
),
};
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case RGBRST:
#ifdef RGBLIGHT_ENABLE
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
}
#endif
break;
}
return true;
}
| 44.849462 | 130 | 0.512347 |
a097754089540c98c5ac33decfcbb9558c778e15 | 3,920 | h | C | PrivateFrameworks/ManagedConfiguration.framework/MCEmailAccountPayload.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 36 | 2016-04-20T04:19:04.000Z | 2018-10-08T04:12:25.000Z | PrivateFrameworks/ManagedConfiguration.framework/MCEmailAccountPayload.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | null | null | null | PrivateFrameworks/ManagedConfiguration.framework/MCEmailAccountPayload.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 10 | 2016-06-16T02:40:44.000Z | 2019-01-15T03:31:45.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration
*/
@interface MCEmailAccountPayload : MCEmailAccountPayloadBase {
NSString * _emailAccountDescription;
NSString * _emailAccountName;
NSString * _emailAccountType;
NSString * _emailAddress;
NSString * _incomingMailServerAuthentication;
NSString * _incomingMailServerHostname;
NSString * _incomingMailServerIMAPPathPrefix;
NSNumber * _incomingMailServerPortNumber;
bool _incomingMailServerUseSSL;
NSNumber * _incomingMailServerUseSSLNum;
NSString * _incomingMailServerUsername;
NSString * _incomingPassword;
NSString * _outgoingMailServerAuthentication;
NSString * _outgoingMailServerHostname;
NSNumber * _outgoingMailServerPortNumber;
bool _outgoingMailServerUseSSL;
NSNumber * _outgoingMailServerUseSSLNum;
NSString * _outgoingMailServerUsername;
NSString * _outgoingPassword;
bool _outgoingPasswordSameAsIncomingPassword;
NSNumber * _outgoingPasswordSameAsIncomingPasswordNum;
}
@property (nonatomic, readonly, retain) NSString *emailAccountDescription;
@property (nonatomic, readonly, retain) NSString *emailAccountName;
@property (nonatomic, readonly, retain) NSString *emailAccountType;
@property (nonatomic, readonly, retain) NSString *emailAddress;
@property (nonatomic, readonly, retain) NSString *incomingMailServerAuthentication;
@property (nonatomic, readonly, retain) NSString *incomingMailServerHostname;
@property (nonatomic, readonly, retain) NSString *incomingMailServerIMAPPathPrefix;
@property (nonatomic, readonly, retain) NSNumber *incomingMailServerPortNumber;
@property (nonatomic, readonly) bool incomingMailServerUseSSL;
@property (nonatomic, readonly) NSNumber *incomingMailServerUseSSLNum;
@property (nonatomic, readonly, retain) NSString *incomingMailServerUsername;
@property (nonatomic, readonly, retain) NSString *incomingPassword;
@property (nonatomic, readonly, retain) NSString *outgoingMailServerAuthentication;
@property (nonatomic, readonly, retain) NSString *outgoingMailServerHostname;
@property (nonatomic, readonly, retain) NSNumber *outgoingMailServerPortNumber;
@property (nonatomic, readonly) bool outgoingMailServerUseSSL;
@property (nonatomic, readonly) NSNumber *outgoingMailServerUseSSLNum;
@property (nonatomic, readonly, retain) NSString *outgoingMailServerUsername;
@property (nonatomic, readonly, retain) NSString *outgoingPassword;
@property (nonatomic, readonly) bool outgoingPasswordSameAsIncomingPassword;
@property (nonatomic, readonly) NSNumber *outgoingPasswordSameAsIncomingPasswordNum;
+ (id)localizedPluralForm;
+ (id)localizedSingularForm;
+ (id)profileNameFromAccountTag:(id)arg1;
+ (id)typeStrings;
- (void).cxx_destruct;
- (id)_authenticationTypeLocalizedString:(id)arg1;
- (id)_emailAccountTypeLocalizedString;
- (bool)containsSensitiveUserInformation;
- (id)description;
- (id)emailAccountDescription;
- (id)emailAccountName;
- (id)emailAccountType;
- (id)emailAddress;
- (id)incomingMailServerAuthentication;
- (id)incomingMailServerHostname;
- (id)incomingMailServerIMAPPathPrefix;
- (id)incomingMailServerPortNumber;
- (bool)incomingMailServerUseSSL;
- (id)incomingMailServerUseSSLNum;
- (id)incomingMailServerUsername;
- (id)incomingPassword;
- (id)initWithDictionary:(id)arg1 profile:(id)arg2 outError:(id*)arg3;
- (id)outgoingMailServerAuthentication;
- (id)outgoingMailServerHostname;
- (id)outgoingMailServerPortNumber;
- (bool)outgoingMailServerUseSSL;
- (id)outgoingMailServerUseSSLNum;
- (id)outgoingMailServerUsername;
- (id)outgoingPassword;
- (bool)outgoingPasswordSameAsIncomingPassword;
- (id)outgoingPasswordSameAsIncomingPasswordNum;
- (id)payloadDescriptionKeyValueSections;
- (id)stubDictionary;
- (id)subtitle1Description;
- (id)subtitle1Label;
- (id)subtitle2Description;
- (id)subtitle2Label;
- (id)title;
@end
| 42.608696 | 95 | 0.813776 |
48c850256aad9cb933d87f4cb1b4328e67c42df2 | 18,920 | c | C | Xport64_Demo/src/scenes/level00/level00.c | Wade-Tyhon/Xport64_Demo | 7109779459da536dc5661afe620c978f7fb09f77 | [
"MIT"
] | null | null | null | Xport64_Demo/src/scenes/level00/level00.c | Wade-Tyhon/Xport64_Demo | 7109779459da536dc5661afe620c978f7fb09f77 | [
"MIT"
] | null | null | null | Xport64_Demo/src/scenes/level00/level00.c | Wade-Tyhon/Xport64_Demo | 7109779459da536dc5661afe620c978f7fb09f77 | [
"MIT"
] | null | null | null | //#include "levelDefs.h"
#include "common.h"
#include "objectDefs.h"
#include "level00.h"
#include "collisionDefs.h"
#include "lvl00_scn00_defs.h"
#include "lvl00_scn01_defs.h"
// extern void newLevelObject_PolyList(u8 animFrame);
// extern void newLevelObject_transp_PolyList(u8 animFrame);
// extern void newLevelObject_lightShaft_PolyList(u8 animFrame);
/*--------------------------------------------------------------------------*/
/*-----------------------------CAVE1 SCENE------------------------------*/
/*--------------------------------------------------------------------------*/
EnvObject lvl00_tile_floor;
EnvObject lvl00_tile_floor_flip;
EnvObject lvl00_red_matte_carpet;
EnvObject lvl00_wall_divider;
EnvObject lvl00_wall_divider_reflect;
EnvObject lvl00_wall_back;
EnvObject lvl00_wall_front;
EnvObject lvl00_large_pillars;
EnvObject lvl00_wall_sides;
EnvObject lvl00_art_pedistal;
EnvObject lvl00_art_pedistal_reflect;
EnvObject lvl00_art_pedistal2;
EnvObject lvl00_art_pedistal_reflect2;
EnvObject lvl00_art_pedistal3;
EnvObject lvl00_art_pedistal_reflect3;
EnvObject lvl00_art_pedistal4;
EnvObject lvl00_art_pedistal_reflect4;
//EnvObject lvl00_wall_back_reflect;
//EnvObject lvl00_wall_divider_flip;
EnvObject lvl00_texture_vtxcolor;
EnvObject lvl00_texture_shaded;
EnvObject lvl00_texture_transp;
EnvObject lvl100_texture_edgetransp;
EnvObject lvl00_prim_shaded;
EnvObject lvl00_prim_vtxcolor;
EnvObject lvl00_light_shaft;
EnvObject lvl00_16bRGBA_32x32;
EnvObject lvl00_16bRGBA_32x64;
EnvObject lvl00_vtx_animate;
EnvObject lvl00_prs_animate_1;
EnvObject lvl00_prs_animate_2;
EnvObject lvl00_prs_animate_3;
int currentObjFrame = 0;
int counterFrame = 0;
//This is the lighting
Lights2 debug_lighting = gdSPDefLights2( 100, 100, 60, // amb col
//side reflect light
255, 255, 255, // col 1
0, 0, 90, // dir 1
//ground reflect light
10, 20, 25, // col 2
45, 0, -90 // dir 2
);
Lights2 debug_lighting_2 = gdSPDefLights2( 75, 75, 45, // amb col
//side reflect light
255, 255, 255, // col 1
0, 45, 65, // dir 1
//ground reflect light
10, 20, 25, // col 2
45, 0, -90 // dir 2
);
/*--------------------------------------------------------------------------*/
/*-----------------------------COURTYARD SCENE------------------------------*/
/*--------------------------------------------------------------------------*/
SceneManager scene_Courtyard;
//TO DO NOTE: Set up "Material" types in blender for exporting different materials to call different combiner modes
//update scene / level managers to include triggers and lighting information
//update collision and re-export with less triangles and cut into smaller segments
// //TO DO NOTE: Set up collision to store in each scene...
// void set_collision_scenes(); //set up array of pointers that contain colliders for determining region
// void set_collision_sectors();
// void init_lvl00_Cave1();
// TriggerBox env01_courtyard_geom_trigger00 =
// {
// -2675, -462, -284, 2511, 689, 997, 0 //courtyard scene collision
// };
// TriggerBox env01_courtyard_geom_trigger01 =
// {
// -1024, -3785, -285, 1024,-302,997, 0 //courtyard scene collision
// };
// TriggerBox lvl00_courtyard_geom_triggers[2] =
// {
// {-2675, -462, -284, 2511, 689, 997, 0}, //courtyard scene collision
// {-1024, -3785, -285, 1024,-302,997, 0} //courtyard scene collision
// };
// SectorTrigger lvl00_CourtyardSectorTrig[3] = {
// //NOTE ON USE: { (sector)isActive, (sector)trigBox }
// //Sectors in Courtyard scene: courtyard entrance, courtyard main, courtyard exit
// //-----Sector00: Courtyard Entrance-----
// { 0, &lvl00_courtyard_col_wall01_TrigBox }, //----lvl00SectorTrig[0] Courtyard Entrance----
// { 0, &lvl00_courtyard_col_wall02_TrigBox }, //----lvl00SectorTrig[0] Courtyard Entrance----
// { 0, &lvl00_courtyard_col_wall03_TrigBox } //----lvl00SectorTrig[0] Courtyard Entrance----
// //-----Sector01: Courtyard Main -----
// //{ 0, 1, &lvl00_courtyard_col_wall01_TrigBox } //----lvl00SectorTrig[0] Courtyard Main----
// };
// SceneTrigger lvl00_SceneTrig[1] = {
// //NOTE ON USE: { (scene)isActive, (scene)trigBox, sectorCount(in scene), sectorTrig(in scene) }
// //Scenes in level: courtyard, landing zone
// //-----Scene [0]: Courtyard-----
// {0, lvl00_courtyard_geom_triggers, 3, lvl00_CourtyardSectorTrig}, //scene00----lvl00SceneTrig[0] Courtyard----
// //-----Scene [1]: Landing Zone -----
// //{0, &lvl00_courtyard_col_wall01_TrigBox, 1, lvl00SectorTrig} //----lvl00SceneTrig[1] LandingZone----
// };
// LevelTrigger lvl00Triggers[] = {
// //NOTE ON USE: { (level)isActive, (level)trigBox, sceneCount(in level), SceneTrigArray(in level) }
// //-----Level [0]: Courtyard-----
// 0, &lvl00_courtyard_col_wall01_TrigBox, 1, lvl00_SceneTrig
// };
//Initiate Courtyard Environment
void init_lvl00_Courtyard()
{
SetVector3(&lvl00_tile_floor.obj.pos, 0,0,0);
SetVector3(&lvl00_tile_floor.obj.rot, 0,0,0);
SetVector3(&lvl00_tile_floor.obj.scl, 1,1,1);
SetAnimator(&lvl00_tile_floor.animator, &Tile_Floor_PolyList, 0,0);
SetVector3(&lvl00_red_matte_carpet.obj.pos, 0,0,1);
SetVector3(&lvl00_red_matte_carpet.obj.rot, 0,0,0);
SetVector3(&lvl00_red_matte_carpet.obj.scl, 1,1,1);
SetAnimator(&lvl00_red_matte_carpet.animator, &MatteRedCarpet_PolyList, 0,0);
//>-- Object 1 Demonstration: START --------------------------------------Primitive Color with Vertex Shading -------------------------------------------------
SetVector3(&lvl00_art_pedistal.obj.pos, -800,300,-2);
SetVector3(&lvl00_art_pedistal.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal.animator, &Xport64_Art_Pedistal_PolyList, 0,0);
SetVector3(&lvl00_art_pedistal_reflect.obj.pos, -800,300,-2);
SetVector3(&lvl00_art_pedistal_reflect.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal_reflect.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal_reflect.animator, &Xport64_Art_Pedistal_Reflection_PolyList, 0,0);
SetVector3(&lvl00_prim_shaded.obj.pos, -800,300, 75);
SetVector3(&lvl00_prim_shaded.obj.rot, 0,0,0);
SetVector3(&lvl00_prim_shaded.obj.scl, 1,1,1);
SetAnimator(&lvl00_prim_shaded.animator, &newLevelObject_PrimShaded_PolyList, 0,0);
//>-- Object 1 Demonstration: END -------------------------------------- Primitive Color with Vertex Shading -------------------------------------------------
//>-- Object 2 Demonstration: START --------------------------------------Primitive Color Unlit (Emissive) -------------------------------------------------
SetVector3(&lvl00_art_pedistal2.obj.pos, -580,300,-2);
SetVector3(&lvl00_art_pedistal2.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal2.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal2.animator, &Xport64_Art_Pedistal_PolyList, 0,0);
SetVector3(&lvl00_art_pedistal_reflect2.obj.pos, -580,300,-2);
SetVector3(&lvl00_art_pedistal_reflect2.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal_reflect2.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal_reflect2.animator, &Xport64_Art_Pedistal_Reflection_PolyList, 0,0);
SetVector3(&lvl00_prim_vtxcolor.obj.pos, -580,300,75);
SetVector3(&lvl00_prim_vtxcolor.obj.rot, 0,0,0);
SetVector3(&lvl00_prim_vtxcolor.obj.scl, 1,1,1);
SetAnimator(&lvl00_prim_vtxcolor.animator, &newLevelObject_prim_uv_PolyList, 0,0);
//>-- Object 2 Demonstration: END --------------------------------------Primitive Color Unlit (Emissive) -------------------------------------------------
//>-- Object 3 Demonstration: START -------------------------------------- Textured with Vertex Shading -------------------------------------------------
SetVector3(&lvl00_art_pedistal3.obj.pos, 800,300,-2);
SetVector3(&lvl00_art_pedistal3.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal3.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal3.animator, &Xport64_Art_Pedistal_PolyList, 0,0);
SetVector3(&lvl00_art_pedistal_reflect3.obj.pos, 800,300,-2);
SetVector3(&lvl00_art_pedistal_reflect3.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal_reflect3.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal_reflect3.animator, &Xport64_Art_Pedistal_Reflection_PolyList, 0,0);
SetVector3(&lvl00_texture_vtxcolor.obj.pos, 800,300, 75);
SetVector3(&lvl00_texture_vtxcolor.obj.rot, 0,0,0);
SetVector3(&lvl00_texture_vtxcolor.obj.scl, 1,1,1);
SetAnimator(&lvl00_texture_vtxcolor.animator, &newLevelObject_PolyList, 0,0);
//>-- Object 3 Demonstration: END -------------------------------------- Textured with Vertex Shading -------------------------------------------------
//>-- Object 4 Demonstration: START -------------------------------------- Textured w/ VTX Colors -------------------------------------------------
SetVector3(&lvl00_art_pedistal4.obj.pos, 580,300,-2);
SetVector3(&lvl00_art_pedistal4.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal4.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal4.animator, &Xport64_Art_Pedistal_PolyList, 0,0);
SetVector3(&lvl00_art_pedistal_reflect4.obj.pos, 580,300,-2);
SetVector3(&lvl00_art_pedistal_reflect4.obj.rot, 0,0,0);
SetVector3(&lvl00_art_pedistal_reflect4.obj.scl, 1,1,1);
SetAnimator(&lvl00_art_pedistal_reflect4.animator, &Xport64_Art_Pedistal_Reflection_PolyList, 0,0);
SetVector3(&lvl00_texture_shaded.obj.pos, 580,300,75);
SetVector3(&lvl00_texture_shaded.obj.rot, 0,0,0);
SetVector3(&lvl00_texture_shaded.obj.scl, 1,1,1);
SetAnimator(&lvl00_texture_shaded.animator, &newLevelObject_normals_PolyList, 0,0);
//>-- Object 2 Demonstration: END -------------------------------------- Textured w/ VTX Colors -------------------------------------------------
SetVector3(&lvl00_wall_divider.obj.pos, 0,0,0);
SetVector3(&lvl00_wall_divider.obj.rot, 0,0,0);
SetVector3(&lvl00_wall_divider.obj.scl, 1,1,1);
SetAnimator(&lvl00_wall_divider.animator, &testpillar_PolyList, 0,0);
SetVector3(&lvl00_wall_divider_reflect.obj.pos, 0,0,0);
SetVector3(&lvl00_wall_divider_reflect.obj.rot, 0,0,0);
SetVector3(&lvl00_wall_divider_reflect.obj.scl, 1,1,1);
SetAnimator(&lvl00_wall_divider_reflect.animator, &testpillar_reflect_PolyList, 0,0);
SetVector3(&lvl00_wall_back.obj.pos, 0,0,0);
SetVector3(&lvl00_wall_back.obj.rot, 0,0,0);
SetVector3(&lvl00_wall_back.obj.scl, 1,1,1);
SetAnimator(&lvl00_wall_back.animator, &DebugRoom_Wall_PolyList, 0,0);
SetVector3(&lvl00_wall_front.obj.pos, 0,0,0);
SetVector3(&lvl00_wall_front.obj.rot, 0,0,0);
SetVector3(&lvl00_wall_front.obj.scl, 1,1,1);
SetAnimator(&lvl00_wall_front.animator, &DebugRoom_Front_Wall_PolyList, 0,0);
SetVector3(&lvl00_large_pillars.obj.pos, 0,0,0);
SetVector3(&lvl00_large_pillars.obj.rot, 0,0,0);
SetVector3(&lvl00_large_pillars.obj.scl, 1,1,1);
SetAnimator(&lvl00_large_pillars.animator, &LargePillars_PolyList, 0,0);
SetVector3(&lvl00_wall_sides.obj.pos, 0,0,0);
SetVector3(&lvl00_wall_sides.obj.rot, 0,0,0);
SetVector3(&lvl00_wall_sides.obj.scl, 1,1,1);
SetAnimator(&lvl00_wall_sides.animator, &DebugRoom_Side_Walls_PolyList, 0,0);
SetVector3(&lvl00_16bRGBA_32x32.obj.pos, -210,-400,120);
SetVector3(&lvl00_16bRGBA_32x32.obj.rot, 0,0,0);
SetVector3(&lvl00_16bRGBA_32x32.obj.scl, 1,1,1);
SetAnimator(&lvl00_16bRGBA_32x32.animator, &TextureSample_16bRGBA_32x32_PolyList, 0,0);
SetVector3(&lvl00_16bRGBA_32x64.obj.pos, 210,-400,120);
SetVector3(&lvl00_16bRGBA_32x64.obj.rot, 0,0,0);
SetVector3(&lvl00_16bRGBA_32x64.obj.scl, 1,1,1);
SetAnimator(&lvl00_16bRGBA_32x64.animator, &TextureSample_16bRGBA_32x64_PolyList, 0,0);
SetVector3(&lvl00_light_shaft.obj.pos, 0,240,0);
SetVector3(&lvl00_light_shaft.obj.rot, 0,0,0);
SetVector3(&lvl00_light_shaft.obj.scl, 1,1,1);
SetAnimator(&lvl00_light_shaft.animator, &newLevelObject_lightShaft_PolyList, 0,0);
SetVector3(&lvl00_texture_transp.obj.pos, 690,-360,150);
SetVector3(&lvl00_texture_transp.obj.rot, 0,0,180);
SetVector3(&lvl00_texture_transp.obj.scl, 1,1,1);
SetAnimator(&lvl00_texture_transp.animator, &newLevelObject_transp_PolyList, 0,0);
SetVector3(&lvl100_texture_edgetransp.obj.pos, 690,-360,75);
SetVector3(&lvl100_texture_edgetransp.obj.rot, 0,0,180);
SetVector3(&lvl100_texture_edgetransp.obj.scl, 1,1,1);
SetAnimator(&lvl100_texture_edgetransp.animator, &newLevelObject_edgeTransp_PolyList, 0,0);
SetVector3(&lvl00_vtx_animate.obj.pos, -690,-250,2);
SetVector3(&lvl00_vtx_animate.obj.rot, 0,0,0);
SetVector3(&lvl00_vtx_animate.obj.scl, 1,1,1);
SetAnimator(&lvl00_vtx_animate.animator, &exportAnimation_Vtx_DL_PolyList, 0 ,currentObjFrame);
SetVector3(&lvl00_prs_animate_1.obj.pos, -120,120,0);
SetAnimator(&lvl00_prs_animate_1.animator, &exportAnimation_Pos_Rot_Scl_1_PolyList, 0 ,currentObjFrame);
SetAnimator(&lvl00_prs_animate_2.animator, &exportAnimation_Pos_Rot_Scl_2_PolyList, 0 ,currentObjFrame);
SetAnimator(&lvl00_prs_animate_3.animator, &exportAnimation_Pos_Rot_Scl_3_PolyList, 0 ,currentObjFrame);
}
int localAnimationTimer = 0;
void update_lvl00_DemoScene()
{
int globalAnimationTimer = 0;
int animFrameDifference = 0; //in the event of extreme slowdown, check how much time has elapsed
globalAnimationTimer = GetFPS_30(); //animation playback at 30 fps gives the best, most consistent performance
if (globalAnimationTimer != localAnimationTimer)
{
animFrameDifference = globalAnimationTimer-localAnimationTimer;
localAnimationTimer = globalAnimationTimer;
if(currentObjFrame <= 30)
currentObjFrame += animFrameDifference;
else
{
currentObjFrame = 0;
}
}
}
void render_lvl00_Courtyard()
{
int level = 0;
int scene = 0;
int sector = 0;
//NOTE ----- Draw non-transparent objects first
//>-- Environment: START ------------------------------------------ Non-Transparent walls, floor, pillars, etc -------------------------------------------------
//RenderEnvObj(&lvl00_tile_floor_flip);
TEXTURE_FOG_VTXCOL(glistp, 50, 45, 40, 255,965,1010);
gDPSetColorDither( glistp++, G_CD_BAYER );
gDPSetAlphaDither( glistp++, G_CD_BAYER );
RenderEnvObj(&lvl00_wall_divider);
RenderEnvObj(&lvl00_art_pedistal);
RenderEnvObj(&lvl00_art_pedistal2);
RenderEnvObj(&lvl00_art_pedistal3);
RenderEnvObj(&lvl00_art_pedistal4);
RenderEnvObj(&lvl00_wall_back);
RenderEnvObj(&lvl00_large_pillars);
RenderEnvObj(&lvl00_wall_front);
RenderEnvObj(&lvl00_wall_sides);
//>-- Environment: END ------------------------------------------ Non-Transparent walls, floor, pillars, etc -------------------------------------------------
//>-- GFX Demonstration: START ------------------------------------------ Non-Transparent "Artwork" in the scene to demonstrate GFX effects -------------------------------------------------
RenderEnvObj(&lvl00_texture_vtxcolor);
RenderEnvObj(&lvl00_prim_vtxcolor);
RenderEnvObj(&lvl00_16bRGBA_32x64);
RenderEnvObj(&lvl00_16bRGBA_32x32);
TEXTURE_FOG_VTXCOL(glistp, 195, 160, 100, 0,925,800);
RenderEnvObj(&lvl00_red_matte_carpet);
TEXTURE_FOG_LIGHT(glistp, 42,26,40,255,800,980);
gSPSetLights2(glistp++, debug_lighting);
RenderEnvObj(&lvl00_texture_shaded);
RenderEnvObj(&lvl00_prim_shaded);
// gSPSetLights2(glistp++, debug_lighting_2);
RenderEnvObj(&lvl00_vtx_animate);
// RenderEnvObj(&lvl00_prs_animate_1);
//// RenderEnvObj(&lvl00_prs_animate_2);
// RenderEnvObj(&lvl00_prs_animate_3);
//>-- GFX Demonstration: END ------------------------------------------ Non-Transparent "Artwork" in the scene to demonstrate GFX effects -------------------------------------------------
}
void render_lvl00_transparent()
{
//NOTE ----- Draw edge transparency second
//>-- 1b Cut-out Objects: START --------------------------------------Render 1b alpha objects after solid objects -------------------------------------------------
TEXTURE_FOG_LIGHT(glistp, 42,26,40,255,800,980);
gDPSetColorDither( glistp++, G_CD_BAYER );
gDPSetAlphaDither( glistp++, G_CD_BAYER );
RenderEnvObj(&lvl100_texture_edgetransp);
//>-- 1b Cut-out Objects: END --------------------------------------Render 1b alpha objects after solid objects -------------------------------------------------
//>-- Translucent Objects: START --------------------------------------Render Translucent objects after 1b cut-out transparency objects -------------------------------------------------
TEXTURE_FOG_VTXCOL(glistp, 75, 75, 75, 0,1010,980);
//Render the "reflected" objects first since the transparent tile floor is "between" the camera and the reflection
RenderEnvObj(&lvl00_wall_divider_reflect);
TEXTURE_FOG_VTXCOL(glistp, 175, 175, 170, 175,970,990);
RenderEnvObj(&lvl00_art_pedistal_reflect);
RenderEnvObj(&lvl00_art_pedistal_reflect2);
RenderEnvObj(&lvl00_art_pedistal_reflect3);
RenderEnvObj(&lvl00_art_pedistal_reflect4);
TEXTURE_FOG_VTXCOL(glistp, 255, 255, 255, 255,950,992);
gDPSetColorDither( glistp++, G_CD_BAYER );
gDPSetAlphaDither( glistp++, G_CD_BAYER );
RenderEnvObj(&lvl00_texture_transp);
//RenderEnvObj(&lvl00_light_shaft);
RenderEnvObj(&lvl00_tile_floor);
//>-- Translucent Objects: END --------------------------------------Render Translucent objects after 1b cut-out transparency objects -------------------------------------------------
}
//NOTE ABOUT USAGE: 'collision_scenes' Scenes within a region would be such as the courtyard scene or the landing zone scene.
//This will be a series of medium sized TriggerBox objects to determine the scenes that the player is near
//Used to determine what display lists to render in the current scene.
//Used to narrow down what collision might be checked
void lvl00_collision_scenes()
{
}
void lvl00_collision_walls()
{
}
| 40 | 190 | 0.635729 |
3e575e1c008e5cc4cafe5e4dff4e7d453da9b313 | 1,437 | h | C | PhysicsTools/IsolationUtils/interface/PtIsolationAlgo.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-24T19:10:26.000Z | 2019-02-19T11:45:32.000Z | PhysicsTools/IsolationUtils/interface/PtIsolationAlgo.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-23T13:40:24.000Z | 2019-12-05T21:16:03.000Z | PhysicsTools/IsolationUtils/interface/PtIsolationAlgo.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 5 | 2018-08-21T16:37:52.000Z | 2020-01-09T13:33:17.000Z | #ifndef IsolationUtils_PtIsolationAlgo_h
#define IsolationUtils_PtIsolationAlgo_h
/* \class PtIsolationAlgo<T, C>
*
* \author Francesco Fabozzi, INFN
*/
#include "DataFormats/Math/interface/deltaR.h"
template <typename T, typename C>
class PtIsolationAlgo {
public:
typedef double value_type;
PtIsolationAlgo() { }
PtIsolationAlgo( double dRMin, double dRMax, double dzMax,
double d0Max, double ptMin ) :
dRMin_( dRMin ), dRMax_( dRMax ), dzMax_( dzMax ),
d0Max_( d0Max ), ptMin_( ptMin ) { }
double operator()(const T &, const C &) const;
private:
double dRMin_, dRMax_, dzMax_, d0Max_, ptMin_;
};
template <typename T, typename C>
double PtIsolationAlgo<T, C>::operator()(const T & cand, const C & elements) const {
double ptSum = 0;
double candVz = cand.vz();
double candEta = cand.eta();
double candPhi = cand.phi();
for( typename C::const_iterator elem = elements.begin(); elem != elements.end(); ++ elem ) {
double elemPt = elem->pt();
if ( elemPt < ptMin_ ) continue;
double elemVx = elem->vx();
double elemVy = elem->vy();
double elemD0 = sqrt( elemVx * elemVx + elemVy * elemVy );
if ( elemD0 > d0Max_ ) continue;
double dz = fabs( elem->vz() - candVz );
if ( dz > dzMax_ ) continue;
double dR = deltaR( elem->eta(), elem->phi(), candEta, candPhi );
if ( (dR > dRMax_) || (dR < dRMin_) ) continue;
ptSum += elemPt;
}
return ptSum;
}
#endif
| 30.574468 | 94 | 0.656924 |
851d48d3752e4dfe773e68d261984527138fc66f | 2,610 | h | C | hw/drivers/adc/adc_ads1015/include/adc_ads1015/adc_ads1015.h | loligo/loligo-mynewt | de274042aafdb4ae195e550b77faecb8b4d293fb | [
"Apache-2.0"
] | null | null | null | hw/drivers/adc/adc_ads1015/include/adc_ads1015/adc_ads1015.h | loligo/loligo-mynewt | de274042aafdb4ae195e550b77faecb8b4d293fb | [
"Apache-2.0"
] | 2 | 2018-08-21T13:02:33.000Z | 2018-09-05T01:04:57.000Z | hw/drivers/adc/adc_ads1015/include/adc_ads1015/adc_ads1015.h | lohmega/lohmega-mynewt | de274042aafdb4ae195e550b77faecb8b4d293fb | [
"Apache-2.0"
] | 1 | 2018-06-20T11:02:20.000Z | 2018-06-20T11:02:20.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef __ADC_ADS1015_H__
#define __ADC_ADS1015_H__
#include <adc/adc.h>
/*=========================================================================
CONVERSION DELAY (in mS)
-----------------------------------------------------------------------*/
#define ADS1015_CONVERSIONDELAY (1)
#define ADS1115_CONVERSIONDELAY (8)
/*=========================================================================*/
#define ADS1015_REG_CONFIG_PGA_6_144V (0x0000) // +/-6.144V range = Gain 2/3
#define ADS1015_REG_CONFIG_PGA_4_096V (0x0200) // +/-4.096V range = Gain 1
#define ADS1015_REG_CONFIG_PGA_2_048V (0x0400) // +/-2.048V range = Gain 2 (default)
#define ADS1015_REG_CONFIG_PGA_1_024V (0x0600) // +/-1.024V range = Gain 4
#define ADS1015_REG_CONFIG_PGA_0_512V (0x0800) // +/-0.512V range = Gain 8
#define ADS1015_REG_CONFIG_PGA_0_256V (0x0A00) // +/-0.256V range = Gain 16
struct os_mutex;
typedef enum
{
GAIN_TWOTHIRDS = ADS1015_REG_CONFIG_PGA_6_144V,
GAIN_ONE = ADS1015_REG_CONFIG_PGA_4_096V,
GAIN_TWO = ADS1015_REG_CONFIG_PGA_2_048V,
GAIN_FOUR = ADS1015_REG_CONFIG_PGA_1_024V,
GAIN_EIGHT = ADS1015_REG_CONFIG_PGA_0_512V,
GAIN_SIXTEEN = ADS1015_REG_CONFIG_PGA_0_256V
} ads_gain_t;
#define ADS1015_ADC_DEV_CFG_DEFAULT {.conversion_delay = ADS1115_CONVERSIONDELAY,\
.bit_shift = 4,\
.gain = GAIN_ONE}
struct ads1015_adc_dev_cfg {
uint8_t i2c_num;
uint8_t i2c_addr;
struct os_mutex *i2c_mutex;
uint8_t conversion_delay;
uint8_t bit_shift;
ads_gain_t gain;
};
#ifdef __cplusplus
extern "C" {
#endif
int ads1015_adc_dev_init(struct os_dev *, void *);
int ads1015_adc_hwtest(struct adc_dev *);
#ifdef __cplusplus
}
#endif
#endif /* __ADC_H__ */
| 33.896104 | 87 | 0.659387 |
8b9b3e97ea6af724a674adf8969cf9a9041db9a1 | 1,955 | h | C | ogsr_engine/xrGame/Mincer.h | stepa2/OGSR-Engine | 32a23aa30506684be1267d9c4fc272350cd167c5 | [
"Apache-2.0"
] | 3 | 2019-09-10T13:37:08.000Z | 2021-05-18T14:53:29.000Z | ogsr_engine/xrGame/Mincer.h | stepa2/OGSR-Engine | 32a23aa30506684be1267d9c4fc272350cd167c5 | [
"Apache-2.0"
] | null | null | null | ogsr_engine/xrGame/Mincer.h | stepa2/OGSR-Engine | 32a23aa30506684be1267d9c4fc272350cd167c5 | [
"Apache-2.0"
] | 2 | 2020-06-26T11:50:59.000Z | 2020-12-30T11:07:31.000Z | /////////////////////////////////////////////////////
// Аномальная зона: "мясорубка"
// При попадании живого объекта в зону происходит
// электрический разряд
// Зона восстанавливает заряд через определенное время
// (через m_dwPeriod заряжается с 0 до m_fMaxPower)
//
/////////////////////////////////////////////////////
#pragma once
#include "gravizone.h"
#include "telewhirlwind.h"
#include "PhysicsShellHolder.h"
#include "script_export_space.h"
#include "PHDestroyable.h"
class CMincer :
public CBaseGraviZone,
public CPHDestroyableNotificator
{
private:
typedef CBaseGraviZone inherited;
CTeleWhirlwind m_telekinetics;
shared_str m_torn_particles;
ref_sound m_tearing_sound;
float m_fActorBlowoutRadiusPercent;
float m_fArtefactSpawnProbabilityTorn; // bak
public:
virtual CTelekinesis &Telekinesis () {return m_telekinetics;}
public:
CMincer ();
virtual ~CMincer ();
// virtual void SwitchZoneState (EZoneState new_state);
virtual void OnStateSwitch (EZoneState new_state);
virtual BOOL feel_touch_contact (CObject* O);
virtual void feel_touch_new (CObject* O);
virtual void Load (LPCSTR section);
virtual bool BlowoutState ();
virtual void AffectPullDead (CPhysicsShellHolder* GO,const Fvector& throw_in_dir,float dist){}
virtual void AffectPullAlife (CEntityAlive* EA,const Fvector& throw_in_dir,float dist);
virtual void AffectThrow (SZoneObjectInfo* O, CPhysicsShellHolder* GO,const Fvector& throw_in_dir,float dist);
virtual void ThrowInCenter (Fvector& C);
virtual BOOL net_Spawn (CSE_Abstract* DC);
virtual void net_Destroy ();
virtual void Center (Fvector& C) const;
virtual void NotificateDestroy (CPHDestroyableNotificate *dn);
virtual float BlowoutRadiusPercent (CPhysicsShellHolder* GO);
DECLARE_SCRIPT_REGISTER_FUNCTION
};
add_to_type_list(CMincer)
#undef script_type_list
#define script_type_list save_type_list(CMincer) | 35.545455 | 115 | 0.726343 |
eb63aa85f4ab1f0eb63aa37412ecb32f3704423b | 870 | h | C | Convoy Caravan Code parts/UIElements/TableView Cells/Notification Cells/FriendRequestLoaderTableViewCell.h | Priba91/Meeting | 5a653455b85be9c6125f64351c802e4a7495a55c | [
"MIT"
] | null | null | null | Convoy Caravan Code parts/UIElements/TableView Cells/Notification Cells/FriendRequestLoaderTableViewCell.h | Priba91/Meeting | 5a653455b85be9c6125f64351c802e4a7495a55c | [
"MIT"
] | null | null | null | Convoy Caravan Code parts/UIElements/TableView Cells/Notification Cells/FriendRequestLoaderTableViewCell.h | Priba91/Meeting | 5a653455b85be9c6125f64351c802e4a7495a55c | [
"MIT"
] | null | null | null | //
// FriendRequestLoaderTableViewCell.h
// Convoy Caravan
//
// Created by Priba on 3/4/19.
// Copyright © 2019 Priba. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "NotificationModel.h"
#import "UserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface FriendRequestLoaderTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *userProfileImageView;
@property (weak, nonatomic) IBOutlet UIImageView *notificationIconImageView;
@property (weak, nonatomic) IBOutlet UILabel *userNameLbl;
@property (weak, nonatomic) IBOutlet UILabel *messageLbl;
@property (weak, nonatomic) IBOutlet UILabel *timeLbl;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spiner;
- (void)populateCellWith:(NotificationModel*)notification andMessage:(NSString*)message;
- (void)populateCellWith:(UserModel*)user;
@end
NS_ASSUME_NONNULL_END
| 26.363636 | 88 | 0.789655 |
3a13e88fc1d566f8d3a4bfbd19659fa2c9d63518 | 14,221 | h | C | gpac-0.7.1/applications/osmo4_w32/resource.h | xu5343/ffmpegtoolkit_CentOS7 | 974496c709a1c8c69034e46ae5ce7101cf03716f | [
"Apache-2.0"
] | null | null | null | gpac-0.7.1/applications/osmo4_w32/resource.h | xu5343/ffmpegtoolkit_CentOS7 | 974496c709a1c8c69034e46ae5ce7101cf03716f | [
"Apache-2.0"
] | null | null | null | gpac-0.7.1/applications/osmo4_w32/resource.h | xu5343/ffmpegtoolkit_CentOS7 | 974496c709a1c8c69034e46ae5ce7101cf03716f | [
"Apache-2.0"
] | 1 | 2021-04-15T18:27:37.000Z | 2021-04-15T18:27:37.000Z | //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Osmo4.rc
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDR_GPACTYPE 129
#define IDD_CONTROL 132
#define IDI_PLAY 141
#define IDI_STOP 142
#define IDI_PAUSE 143
#define IDI_MESSAGE 144
#define IDI_ERR 145
#define IDD_OPTIONS 152
#define IDD_OPT_GEN 154
#define IDD_OPT_RENDER 155
#define IDD_OPT_AUDIO 157
#define IDD_OPT_VIDEO 158
#define IDD_OPT_HTTP 159
#define IDD_OPT_FONT 161
#define IDD_OPT_SYSTEMS 162
#define IDD_OPT_STREAM 164
#define IDD_PROPERTIES 166
#define IDD_OPT_DECODER 167
#define IDD_OPT_RENDER2D 168
#define IDD_OPT_RENDER3D 169
#define IDR_MAINTOOLS 170
#define ID_MAINSLIDER 171
#define IDD_SLIDERS 173
#define IDD_NAVBAR 176
#define IDD_PLAYLIST 177
#define IDR_PLAYLIST 178
#define IDD_OPT_FILETYPES 179
#define IDR_MENUPL 182
#define IDD_PASSWD 188
#define IDR_MAINACCEL 190
#define IDC_FILES_MIMES 1000
#define IDC_FILES_PLUG 1001
#define ID_AUDIO_VOL 1002
#define IDC_TXT_SITE 1003
#define IDC_EDIT_USER 1004
#define IDC_EDIT_PASSWORD 1005
#define IDC_PLAY 1006
#define IDC_STOP 1007
#define IDC_COMBOURL 1008
#define IDC_BROWSE 1009
#define IDC_BUTGO 1010
#define IDC_SPIN_OPT 1011
#define IDC_OPT_SET_NAME 1012
#define IDC_LANG 1013
#define IDC_LOOP 1014
#define IDC_AUTOSTART 1015
#define IDC_FILEASSOC 1016
#define IDC_NO_CONSOLE 1017
#define IDC_BIFS_RATE 1018
#define IDC_DEC_THREAD 1019
#define IDC_DIRECTRENDER 1020
#define IDC_HWMEMORY 1021
#define IDC_BIFSDROP 1023
#define IDC_SPIN_AUDIO 1024
#define IDC_EDIT_AUDIO 1025
#define IDC_FORCE_AUDIO 1026
#define IDC_SPIN_FPS 1027
#define IDC_AUDIO_FPS 1028
#define IDC_AUDIO_MULTICH 1029
#define IDC_GD_LIST 1031
#define IDC_FAST_RENDER 1032
#define IDC_FORCE_DURATION 1033
#define IDC_YUV 1034
#define IDC_AUDIO_RESYNC 1035
#define IDC_AUDIO_NOTIFS 1036
#define IDC_STOPATEND 1037
#define IDC_CLEAN_CACHE 1038
#define IDC_RESTART_CACHE 1039
#define IDC_NOTIFY_PROG 1040
#define IDC_BROWSE_CACHE 1041
#define IDC_LOOKFORSUB 1042
#define IDD_OPT_MCACHE 1043
#define IDC_DRIVER_LIST 1044
#define IDC_AA_LIST 1045
#define IDC_ZOOM_SCALABLE 1046
#define IDD_OPENFILE 1047
#define IDC_SINGLE_INSTANCE 1048
#define IDC_VIDEO_LIST 1049
#define IDC_FONT_LIST 1050
#define IDC_BROWSE_FONT 1051
#define IDC_USE_FONT 1052
#define IDC_SAVEOPT 1053
#define IDC_PORT 1054
#define IDC_RTSP 1055
#define IDC_TIMEOUT 1056
#define IDC_BUFFER 1057
#define IDC_REBUFFER_LEN 1058
#define IDC_REBUFFER 1059
#define IDC_ODTREE 1060
#define IDC_VIEWSG 1061
#define IDC_FORCE_SIZE 1062
#define IDC_USE_RENDER3D 1063
#define IDC_ODINFO 1064
#define IDC_WORLD 1065
#define IDC_GOGPAC 1066
#define IDC_GOOSMO4 1067
#define IDC_DUMP_XMT 1068
#define IDC_OBJECT_TIME 1069
#define IDC_FORMAT_YUV 1070
#define IDC_DRAW_BOUNDS 1071
#define IDC_REORDER 1072
#define IDC_TEXTURE_MODE 1073
#define IDC_SWITCH_RES 1074
#define IDC_AUDEC_LIST 1075
#define IDC_VIDEC_LIST 1076
#define IDC_ASSOCIATE 1077
#define IDC_RASTER_OUTLINE 1078
#define IDC_EMUL_POW2 1079
#define IDC_DISABLE_POLY_AA 1080
#define IDC_WIRE_NONE 1081
#define IDC_WIRE_ONLY 1082
#define IDC_WIRE_BOTH 1083
#define IDC_DISABLE_TX_RECT 1084
#define IDC_BITMAP_USE_PIXEL 1085
#define IDC_TEXTURE_TEXT 1086
#define IDC_SLIDER 1087
#define ID_SLIDER 1088
#define IDC_SELECT 1089
#define IDC_NO_BACKCULL 1090
#define IDC_FILES_EXT 1091
#define IDC_VIEWSEL 1094
#define IDC_ADDRESS 1096
#define IDC_DUMTXT 1097
#define IDC_FILELIST 1109
#define IDC_BROWSE_MCACHE 1110
#define IDC_MCACHE_OVERWRITE 1111
#define IDC_MCACHE_USENAME 1112
#define IDC_BASEPRES 1113
#define ID_FILE_EXIT 1114
#define ID_H_ABOUT 1115
#define ID_PLAYLIST_LOOP 1116
#define ID_OPEN_FILE 1117
#define ID_VIEW_CONTROL 1118
#define ID_VIEW_ORIGINAL 1119
#define ID_VIEW_FULLSCREEN 1120
#define ID_AR_KEEP 1121
#define IDC_DRAW_NORMALS 1122
#define IDC_BACK_CULL 1123
#define IDC_DRAW_MODE 1124
#define ID_SHORTCUTS 1125
#define ID_FILE_RESTART 1126
#define ID_OPT_QUALITY 1127
#define ID_FILE_PROP 1128
#define ID_FILE_STEP 1129
#define IDD_CONFIGURE 1130
#define ID_VIEW_SCALABLE 1131
#define ID_OPEN_URL 1132
#define ID_FILE_RELOAD 1133
#define ID_FILE_PLAY 1134
#define ID_NAVIGATE_NONE 1135
#define ID_NAVIGATE_WALK 1136
#define ID_NAVIGATE_FLY 1137
#define ID_NAVIGATE_EXAM 1138
#define ID_NAVIGATE_PAN 1139
#define ID_NAVIGATE_SLIDE 1140
#define ID_NAVIGATE_GAME 1141
#define ID_AR_FILL 1142
#define ID_AR_43 1143
#define ID_AR_169 1144
#define ID_FILE_MIGRATE 1145
#define ID_NAV_RESET 1151
#define ID_FILE_STOP 1152
#define ID_FILE_PREV 1155
#define ID_FILE_NEXT 1156
#define ID_FILE_PROPS 1157
#define ID_SWITCH_RENDER 1158
#define ID_RELOAD_TERMINAL 1159
#define ID_VIEW_PLAYLIST 1160
#define ID_NAVIGATE_ORBIT 1161
#define ID_COLLIDE_NONE 1162
#define ID_COLLIDE_REG 1163
#define ID_COLLIDE_DISP 1164
#define ID_GRAVITY 1165
#define ID_HEADLIGHT 1166
#define ID_NAV_INFO 1167
#define ID_NAV_PREV 1168
#define ID_NAV_NEXT 1169
#define ID_CLEAR_NAV 1170
#define ID_TIMER 1171
#define ID_FPS 1172
#define ID_VIEWPORT_EMPTY 1173
#define ID_PL_REM_ALL 1174
#define ID_PL_REM_DEAD 1175
#define ID_PL_ADD_DIR_REC 1176
#define ID_PL_ADD_FILE 1177
#define ID_PL_REM_FILE 1178
#define ID_PL_OPEN 1179
#define ID_PL_SAVE 1180
#define ID_PL_UP 1181
#define ID_PL_DOWN 1182
#define ID_VIEW_PL 1183
#define ID_PL_ADD_DIR 1184
#define ID_PL_ADD_URL 1185
#define ID_PL_PLAY 1186
#define ID_PL_SEL_REV 1187
#define ID_PL_SORT_TITLE 1188
#define ID_PL_SORT_FILE 1189
#define ID_PL_SORT_DUR 1190
#define ID_PL_SORT_REV 1191
#define ID_PL_RANDOM 1192
#define ID_ADD_SUBTITLE 1193
#define ID_NAVIGATE_VR 1194
#define ID_REC_ENABLE 1195
#define ID_REC_STOP 1196
#define ID_REC_ABORT 1197
#define ID_AUDIO_EMPTY 1198
#define ID_VIDEO_EMPTY 1199
#define ID_SUBS_EMPTY 1200
#define ID_VIEW_CPU 1201
#define IDC_SAX_PROGRESSIVE 1202
#define IDC_SAX_DELAY 1203
#define IDC_HTTP_PROXY 1204
#define IDC_HTTP_USE_PROXY 1205
#define IDC_LOG_LEVEL 1210
#define IDC_TOOL_CORE 1211
#define IDC_TOOL_CODING 1212
#define IDC_TOOL_CONTAINER 1213
#define IDC_TOOL_NET 1214
#define IDC_TOOL_RTP 1215
#define IDC_TOOL_AUTHOR 1216
#define IDC_TOOL_CODEC 1217
#define IDC_TOOL_PARSER 1218
#define IDC_TOOL_MEDIA 1219
#define IDC_TOOL_SCENE 1220
#define IDC_TOOL_SCRIPT 1221
#define IDC_TOOL_COMPOSE 1222
#define IDC_TOOL_RENDER 1223
#define IDC_TOOL_MMIO 1224
#define IDC_TOOL_SYNC 1225
#define IDD_OPT_LOGS 1226
#define ID_VP_0 1300
#define ID_VP_1 1301
#define ID_VP_2 1302
#define ID_VP_3 1303
#define ID_VP_4 1304
#define ID_VP_5 1305
#define ID_VP_6 1306
#define ID_VP_7 1307
#define ID_VP_8 1308
#define ID_VP_9 1309
#define ID_VP_10 1310
#define ID_VP_11 1311
#define ID_VP_12 1312
#define ID_VP_13 1313
#define ID_VP_14 1314
#define ID_VP_15 1315
#define ID_VP_16 1316
#define ID_VP_17 1317
#define ID_VP_18 1318
#define ID_VP_19 1319
#define ID_NAV_PREV_0 1320
#define ID_NAV_PREV_1 1321
#define ID_NAV_PREV_2 1322
#define ID_NAV_PREV_3 1323
#define ID_NAV_PREV_4 1324
#define ID_NAV_PREV_5 1325
#define ID_NAV_PREV_6 1326
#define ID_NAV_PREV_7 1327
#define ID_NAV_PREV_8 1328
#define ID_NAV_PREV_9 1329
#define ID_NAV_NEXT_0 1330
#define ID_NAV_NEXT_1 1331
#define ID_NAV_NEXT_2 1332
#define ID_NAV_NEXT_3 1333
#define ID_NAV_NEXT_4 1334
#define ID_NAV_NEXT_5 1335
#define ID_NAV_NEXT_6 1336
#define ID_NAV_NEXT_7 1337
#define ID_NAV_NEXT_8 1338
#define ID_NAV_NEXT_9 1339
#define ID_SELOBJ_0 1340
#define ID_SELOBJ_1 1341
#define ID_SELOBJ_2 1342
#define ID_SELOBJ_3 1343
#define ID_SELOBJ_4 1344
#define ID_SELOBJ_5 1345
#define ID_SELOBJ_6 1346
#define ID_SELOBJ_7 1347
#define ID_SELOBJ_8 1348
#define ID_SELOBJ_9 1349
#define ID_SELOBJ_10 1350
#define ID_SELOBJ_11 1351
#define ID_SELOBJ_12 1352
#define ID_SELOBJ_13 1353
#define ID_SELOBJ_14 1354
#define ID_SELOBJ_15 1355
#define ID_SELOBJ_16 1356
#define ID_SELOBJ_17 1357
#define ID_SELOBJ_18 1358
#define ID_SELOBJ_19 1359
#define ID_SELOBJ_20 1360
#define ID_SELOBJ_21 1361
#define ID_SELOBJ_22 1362
#define ID_SELOBJ_23 1363
#define ID_SELOBJ_24 1364
#define ID_SELOBJ_25 1365
#define ID_SELOBJ_26 1366
#define ID_SELOBJ_27 1367
#define ID_SELOBJ_28 1368
#define ID_SELOBJ_29 1369
#define ID_SETCHAP_FIRST 2000
#define ID_SETCHAP_LAST 2200
#define ID_FILE_COPY 32961
#define ID_FILE_PASTE 32962
#define ID_CONFIG_RELOAD 32963
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 192
#define _APS_NEXT_COMMAND_VALUE 32981
#define _APS_NEXT_CONTROL_VALUE 1131
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
| 43.891975 | 47 | 0.508544 |
36116d9e9f5584b260313b005ec05a96a902978b | 166 | h | C | Include/BigNumber/BigNumberDebug.h | vikvych/hierarchy_base | fa2cfed8ca1ffe82b5665d4a615bd205849ae609 | [
"MIT"
] | null | null | null | Include/BigNumber/BigNumberDebug.h | vikvych/hierarchy_base | fa2cfed8ca1ffe82b5665d4a615bd205849ae609 | [
"MIT"
] | null | null | null | Include/BigNumber/BigNumberDebug.h | vikvych/hierarchy_base | fa2cfed8ca1ffe82b5665d4a615bd205849ae609 | [
"MIT"
] | null | null | null | #ifndef HIERARCHY_BIG_NUMBER_DEBUG_H
#define HIERARCHY_BIG_NUMBER_DEBUG_H
#include "BigNumberT.h"
void BigNumberDebug(char *Prefix, BigNumberT *BigNumber);
#endif
| 18.444444 | 57 | 0.831325 |
3636d6ead5faaa1bcc66408d6af3597f2a92d7d8 | 16,239 | c | C | z2/part1/jm/random/454178192.c | kozakusek/ipp-2020-testy | 09aa008fa53d159672cc7cbf969a6b237e15a7b8 | [
"MIT"
] | 1 | 2020-04-16T12:13:47.000Z | 2020-04-16T12:13:47.000Z | z2/part1/jm/random/454178192.c | kozakusek/ipp-2020-testy | 09aa008fa53d159672cc7cbf969a6b237e15a7b8 | [
"MIT"
] | 18 | 2020-03-06T17:50:15.000Z | 2020-05-19T14:58:30.000Z | z2/part1/jm/random/454178192.c | kozakusek/ipp-2020-testy | 09aa008fa53d159672cc7cbf969a6b237e15a7b8 | [
"MIT"
] | 18 | 2020-03-06T17:45:13.000Z | 2020-06-09T19:18:31.000Z | #include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "gamma.h"
#include <stdbool.h>
#include <string.h>
int main() {
/*
scenario: test_random_actions
uuid: 454178192
*/
/*
random actions, total chaos
*/
gamma_t* board = gamma_new(8, 11, 8, 15);
assert( board != NULL );
assert( gamma_move(board, 1, 3, 7) == 1 );
assert( gamma_move(board, 2, 2, 3) == 1 );
assert( gamma_golden_possible(board, 2) == 1 );
assert( gamma_move(board, 3, 5, 3) == 1 );
assert( gamma_move(board, 3, 6, 10) == 1 );
assert( gamma_move(board, 4, 10, 4) == 0 );
assert( gamma_golden_possible(board, 4) == 1 );
assert( gamma_move(board, 5, 2, 4) == 1 );
assert( gamma_move(board, 6, 3, 7) == 0 );
char* board655294736 = gamma_board(board);
assert( board655294736 != NULL );
assert( strcmp(board655294736,
"......3.\n"
"........\n"
"........\n"
"...1....\n"
"........\n"
"........\n"
"..5.....\n"
"..2..3..\n"
"........\n"
"........\n"
"........\n") == 0);
free(board655294736);
board655294736 = NULL;
assert( gamma_move(board, 7, 3, 0) == 1 );
assert( gamma_move(board, 7, 2, 9) == 1 );
char* board904098398 = gamma_board(board);
assert( board904098398 != NULL );
assert( strcmp(board904098398,
"......3.\n"
"..7.....\n"
"........\n"
"...1....\n"
"........\n"
"........\n"
"..5.....\n"
"..2..3..\n"
"........\n"
"........\n"
"...7....\n") == 0);
free(board904098398);
board904098398 = NULL;
assert( gamma_move(board, 8, 10, 5) == 0 );
assert( gamma_move(board, 8, 7, 4) == 1 );
assert( gamma_golden_move(board, 8, 4, 2) == 0 );
assert( gamma_free_fields(board, 1) == 80 );
assert( gamma_move(board, 2, 7, 9) == 1 );
assert( gamma_move(board, 2, 0, 3) == 1 );
assert( gamma_move(board, 3, 3, 8) == 1 );
assert( gamma_free_fields(board, 3) == 77 );
assert( gamma_move(board, 4, 1, 3) == 1 );
assert( gamma_move(board, 5, 1, 2) == 1 );
assert( gamma_move(board, 5, 5, 1) == 1 );
assert( gamma_move(board, 6, 10, 0) == 0 );
assert( gamma_move(board, 6, 7, 3) == 1 );
assert( gamma_move(board, 7, 7, 0) == 1 );
assert( gamma_move(board, 8, 1, 4) == 1 );
assert( gamma_move(board, 1, 2, 8) == 1 );
assert( gamma_golden_possible(board, 1) == 1 );
assert( gamma_move(board, 2, 9, 0) == 0 );
assert( gamma_busy_fields(board, 2) == 3 );
assert( gamma_move(board, 3, 7, 4) == 0 );
assert( gamma_move(board, 4, 5, 6) == 1 );
assert( gamma_move(board, 5, 2, 2) == 1 );
assert( gamma_golden_possible(board, 5) == 1 );
assert( gamma_move(board, 6, 4, 3) == 1 );
assert( gamma_move(board, 7, 4, 3) == 0 );
assert( gamma_golden_possible(board, 7) == 1 );
assert( gamma_move(board, 8, 2, 5) == 1 );
assert( gamma_free_fields(board, 8) == 66 );
assert( gamma_move(board, 1, 5, 7) == 1 );
assert( gamma_busy_fields(board, 1) == 3 );
assert( gamma_move(board, 2, 1, 7) == 1 );
assert( gamma_busy_fields(board, 2) == 4 );
assert( gamma_free_fields(board, 2) == 64 );
assert( gamma_move(board, 4, 7, 6) == 1 );
assert( gamma_move(board, 5, 10, 7) == 0 );
assert( gamma_move(board, 5, 3, 0) == 0 );
assert( gamma_move(board, 6, 4, 3) == 0 );
assert( gamma_move(board, 6, 5, 5) == 1 );
char* board113690675 = gamma_board(board);
assert( board113690675 != NULL );
assert( strcmp(board113690675,
"......3.\n"
"..7....2\n"
"..13....\n"
".2.1.1..\n"
".....4.4\n"
"..8..6..\n"
".85....8\n"
"242.63.6\n"
".55.....\n"
".....5..\n"
"...7...7\n") == 0);
free(board113690675);
board113690675 = NULL;
assert( gamma_move(board, 8, 6, 9) == 1 );
assert( gamma_move(board, 8, 3, 4) == 1 );
assert( gamma_golden_possible(board, 8) == 1 );
assert( gamma_move(board, 1, 7, 4) == 0 );
assert( gamma_move(board, 2, 7, 1) == 1 );
assert( gamma_free_fields(board, 3) == 59 );
assert( gamma_move(board, 4, 4, 9) == 1 );
assert( gamma_move(board, 4, 1, 7) == 0 );
assert( gamma_golden_possible(board, 4) == 1 );
assert( gamma_move(board, 6, 7, 2) == 1 );
char* board606412760 = gamma_board(board);
assert( board606412760 != NULL );
assert( strcmp(board606412760,
"......3.\n"
"..7.4.82\n"
"..13....\n"
".2.1.1..\n"
".....4.4\n"
"..8..6..\n"
".858...8\n"
"242.63.6\n"
".55....6\n"
".....5.2\n"
"...7...7\n") == 0);
free(board606412760);
board606412760 = NULL;
assert( gamma_move(board, 7, 0, 2) == 1 );
assert( gamma_move(board, 7, 4, 9) == 0 );
assert( gamma_move(board, 8, 4, 9) == 0 );
assert( gamma_free_fields(board, 8) == 56 );
assert( gamma_move(board, 1, 4, 0) == 1 );
assert( gamma_move(board, 2, 7, 2) == 0 );
assert( gamma_move(board, 2, 1, 0) == 1 );
assert( gamma_move(board, 3, 3, 3) == 1 );
assert( gamma_move(board, 4, 4, 6) == 1 );
assert( gamma_move(board, 5, 1, 8) == 1 );
assert( gamma_move(board, 6, 4, 6) == 0 );
assert( gamma_move(board, 7, 7, 3) == 0 );
assert( gamma_move(board, 8, 0, 2) == 0 );
assert( gamma_move(board, 8, 4, 6) == 0 );
assert( gamma_move(board, 1, 1, 3) == 0 );
assert( gamma_move(board, 1, 3, 8) == 0 );
assert( gamma_move(board, 2, 6, 2) == 1 );
assert( gamma_move(board, 2, 0, 8) == 1 );
assert( gamma_move(board, 3, 5, 2) == 1 );
assert( gamma_busy_fields(board, 3) == 5 );
assert( gamma_golden_possible(board, 3) == 1 );
assert( gamma_move(board, 4, 5, 4) == 1 );
assert( gamma_move(board, 4, 6, 5) == 1 );
assert( gamma_move(board, 5, 2, 3) == 0 );
assert( gamma_move(board, 5, 2, 9) == 0 );
assert( gamma_move(board, 6, 0, 0) == 1 );
assert( gamma_move(board, 7, 2, 3) == 0 );
assert( gamma_move(board, 7, 7, 8) == 1 );
assert( gamma_move(board, 8, 7, 2) == 0 );
assert( gamma_move(board, 8, 2, 8) == 0 );
assert( gamma_move(board, 1, 5, 0) == 1 );
assert( gamma_move(board, 1, 5, 6) == 0 );
assert( gamma_move(board, 2, 3, 8) == 0 );
assert( gamma_move(board, 3, 1, 1) == 1 );
assert( gamma_busy_fields(board, 3) == 6 );
assert( gamma_move(board, 4, 10, 7) == 0 );
char* board961104581 = gamma_board(board);
assert( board961104581 != NULL );
assert( strcmp(board961104581,
"......3.\n"
"..7.4.82\n"
"2513...7\n"
".2.1.1..\n"
"....44.4\n"
"..8..64.\n"
".858.4.8\n"
"242363.6\n"
"755..326\n"
".3...5.2\n"
"62.711.7\n") == 0);
free(board961104581);
board961104581 = NULL;
assert( gamma_move(board, 5, 5, 3) == 0 );
assert( gamma_move(board, 5, 4, 0) == 0 );
assert( gamma_move(board, 6, 1, 9) == 1 );
assert( gamma_move(board, 6, 2, 9) == 0 );
assert( gamma_free_fields(board, 6) == 41 );
assert( gamma_move(board, 7, 5, 1) == 0 );
assert( gamma_move(board, 7, 1, 1) == 0 );
assert( gamma_busy_fields(board, 7) == 5 );
assert( gamma_move(board, 8, 0, 6) == 1 );
assert( gamma_move(board, 1, 6, 2) == 0 );
assert( gamma_move(board, 2, 7, 6) == 0 );
assert( gamma_move(board, 2, 3, 4) == 0 );
assert( gamma_free_fields(board, 2) == 40 );
assert( gamma_move(board, 3, 7, 2) == 0 );
assert( gamma_move(board, 3, 5, 6) == 0 );
assert( gamma_golden_possible(board, 3) == 1 );
assert( gamma_move(board, 4, 3, 9) == 1 );
assert( gamma_move(board, 4, 6, 0) == 1 );
assert( gamma_move(board, 5, 5, 3) == 0 );
assert( gamma_move(board, 5, 7, 4) == 0 );
assert( gamma_move(board, 6, 0, 2) == 0 );
assert( gamma_move(board, 7, 4, 0) == 0 );
assert( gamma_move(board, 7, 7, 1) == 0 );
assert( gamma_move(board, 8, 5, 1) == 0 );
assert( gamma_move(board, 1, 7, 0) == 0 );
assert( gamma_free_fields(board, 1) == 38 );
assert( gamma_move(board, 2, 1, 7) == 0 );
assert( gamma_move(board, 3, 7, 3) == 0 );
assert( gamma_busy_fields(board, 4) == 9 );
assert( gamma_move(board, 5, 3, 6) == 1 );
assert( gamma_free_fields(board, 5) == 37 );
assert( gamma_golden_possible(board, 5) == 1 );
assert( gamma_move(board, 6, 1, 0) == 0 );
assert( gamma_move(board, 6, 5, 5) == 0 );
assert( gamma_move(board, 7, 5, 3) == 0 );
assert( gamma_move(board, 8, 6, 10) == 0 );
assert( gamma_move(board, 1, 6, 1) == 1 );
assert( gamma_move(board, 1, 2, 10) == 1 );
assert( gamma_busy_fields(board, 1) == 7 );
assert( gamma_move(board, 2, 1, 4) == 0 );
assert( gamma_move(board, 2, 1, 6) == 1 );
assert( gamma_golden_move(board, 2, 5, 3) == 1 );
assert( gamma_move(board, 3, 5, 3) == 0 );
assert( gamma_move(board, 3, 6, 1) == 0 );
assert( gamma_move(board, 4, 4, 3) == 0 );
assert( gamma_move(board, 5, 4, 0) == 0 );
assert( gamma_busy_fields(board, 5) == 6 );
char* board389249130 = gamma_board(board);
assert( board389249130 != NULL );
assert( strcmp(board389249130,
"..1...3.\n"
".6744.82\n"
"2513...7\n"
".2.1.1..\n"
"82.544.4\n"
"..8..64.\n"
".858.4.8\n"
"242362.6\n"
"755..326\n"
".3...512\n"
"62.71147\n") == 0);
free(board389249130);
board389249130 = NULL;
assert( gamma_move(board, 6, 10, 3) == 0 );
assert( gamma_move(board, 6, 5, 9) == 1 );
assert( gamma_move(board, 7, 7, 1) == 0 );
assert( gamma_golden_move(board, 7, 10, 2) == 0 );
assert( gamma_move(board, 8, 0, 4) == 1 );
assert( gamma_move(board, 1, 6, 1) == 0 );
assert( gamma_move(board, 1, 2, 2) == 0 );
assert( gamma_move(board, 2, 7, 4) == 0 );
assert( gamma_move(board, 2, 6, 1) == 0 );
assert( gamma_move(board, 3, 8, 4) == 0 );
assert( gamma_move(board, 3, 3, 6) == 0 );
assert( gamma_move(board, 4, 5, 1) == 0 );
assert( gamma_move(board, 4, 3, 6) == 0 );
assert( gamma_move(board, 5, 1, 0) == 0 );
assert( gamma_move(board, 5, 1, 2) == 0 );
assert( gamma_move(board, 6, 6, 6) == 1 );
assert( gamma_move(board, 7, 6, 10) == 0 );
assert( gamma_move(board, 8, 7, 2) == 0 );
assert( gamma_move(board, 8, 1, 7) == 0 );
assert( gamma_busy_fields(board, 8) == 7 );
assert( gamma_move(board, 1, 7, 7) == 1 );
assert( gamma_move(board, 1, 4, 1) == 1 );
assert( gamma_busy_fields(board, 1) == 9 );
assert( gamma_move(board, 2, 7, 8) == 0 );
assert( gamma_move(board, 2, 2, 7) == 1 );
assert( gamma_move(board, 3, 3, 4) == 0 );
assert( gamma_free_fields(board, 3) == 28 );
assert( gamma_move(board, 4, 7, 6) == 0 );
assert( gamma_move(board, 4, 7, 3) == 0 );
assert( gamma_move(board, 5, 7, 6) == 0 );
assert( gamma_move(board, 6, 5, 3) == 0 );
assert( gamma_move(board, 6, 3, 3) == 0 );
assert( gamma_busy_fields(board, 6) == 8 );
assert( gamma_move(board, 7, 7, 9) == 0 );
assert( gamma_move(board, 1, 1, 7) == 0 );
assert( gamma_move(board, 2, 10, 0) == 0 );
assert( gamma_move(board, 3, 4, 4) == 1 );
assert( gamma_move(board, 3, 5, 10) == 1 );
assert( gamma_free_fields(board, 3) == 26 );
assert( gamma_golden_possible(board, 3) == 1 );
assert( gamma_move(board, 4, 2, 3) == 0 );
assert( gamma_move(board, 4, 2, 4) == 0 );
assert( gamma_move(board, 5, 3, 6) == 0 );
assert( gamma_move(board, 6, 4, 6) == 0 );
assert( gamma_move(board, 6, 4, 7) == 1 );
assert( gamma_golden_possible(board, 6) == 1 );
assert( gamma_move(board, 7, 5, 6) == 0 );
assert( gamma_busy_fields(board, 7) == 5 );
assert( gamma_move(board, 8, 8, 5) == 0 );
assert( gamma_move(board, 1, 4, 0) == 0 );
assert( gamma_move(board, 2, 6, 2) == 0 );
assert( gamma_move(board, 3, 1, 0) == 0 );
assert( gamma_move(board, 3, 1, 4) == 0 );
assert( gamma_move(board, 4, 5, 4) == 0 );
assert( gamma_move(board, 4, 1, 5) == 1 );
assert( gamma_golden_possible(board, 4) == 1 );
assert( gamma_move(board, 5, 3, 4) == 0 );
assert( gamma_move(board, 5, 5, 1) == 0 );
assert( gamma_move(board, 6, 7, 7) == 0 );
assert( gamma_busy_fields(board, 6) == 9 );
assert( gamma_free_fields(board, 6) == 24 );
char* board148084998 = gamma_board(board);
assert( board148084998 != NULL );
assert( strcmp(board148084998,
"..1..33.\n"
".6744682\n"
"2513...7\n"
".22161.1\n"
"82.54464\n"
".48..64.\n"
"885834.8\n"
"242362.6\n"
"755..326\n"
".3..1512\n"
"62.71147\n") == 0);
free(board148084998);
board148084998 = NULL;
assert( gamma_move(board, 7, 7, 0) == 0 );
assert( gamma_move(board, 7, 0, 3) == 0 );
assert( gamma_move(board, 8, 0, 10) == 1 );
assert( gamma_move(board, 8, 3, 4) == 0 );
assert( gamma_move(board, 1, 2, 4) == 0 );
assert( gamma_move(board, 2, 5, 7) == 0 );
assert( gamma_move(board, 3, 3, 6) == 0 );
assert( gamma_move(board, 4, 10, 7) == 0 );
assert( gamma_move(board, 4, 6, 6) == 0 );
assert( gamma_move(board, 5, 3, 5) == 1 );
assert( gamma_move(board, 5, 6, 9) == 0 );
assert( gamma_golden_possible(board, 5) == 1 );
assert( gamma_move(board, 6, 1, 0) == 0 );
assert( gamma_move(board, 7, 6, 2) == 0 );
assert( gamma_golden_move(board, 7, 1, 6) == 1 );
assert( gamma_move(board, 8, 1, 2) == 0 );
assert( gamma_free_fields(board, 8) == 22 );
assert( gamma_move(board, 1, 6, 2) == 0 );
assert( gamma_move(board, 1, 0, 0) == 0 );
assert( gamma_move(board, 2, 8, 4) == 0 );
assert( gamma_free_fields(board, 2) == 22 );
assert( gamma_move(board, 3, 4, 6) == 0 );
assert( gamma_move(board, 4, 1, 3) == 0 );
assert( gamma_free_fields(board, 4) == 22 );
assert( gamma_golden_move(board, 4, 3, 3) == 1 );
assert( gamma_move(board, 5, 10, 7) == 0 );
assert( gamma_move(board, 5, 2, 9) == 0 );
assert( gamma_move(board, 6, 1, 0) == 0 );
assert( gamma_move(board, 7, 8, 6) == 0 );
assert( gamma_move(board, 7, 6, 10) == 0 );
assert( gamma_move(board, 8, 5, 4) == 0 );
assert( gamma_move(board, 8, 7, 9) == 0 );
assert( gamma_busy_fields(board, 8) == 8 );
assert( gamma_move(board, 2, 4, 3) == 0 );
assert( gamma_move(board, 3, 5, 7) == 0 );
assert( gamma_move(board, 3, 1, 4) == 0 );
assert( gamma_move(board, 4, 7, 0) == 0 );
assert( gamma_golden_possible(board, 4) == 0 );
assert( gamma_move(board, 5, 5, 5) == 0 );
assert( gamma_golden_move(board, 5, 3, 3) == 1 );
assert( gamma_move(board, 6, 5, 0) == 0 );
assert( gamma_move(board, 7, 1, 1) == 0 );
assert( gamma_move(board, 8, 5, 0) == 0 );
assert( gamma_move(board, 2, 2, 6) == 1 );
assert( gamma_move(board, 3, 7, 0) == 0 );
assert( gamma_move(board, 4, 1, 4) == 0 );
assert( gamma_move(board, 5, 5, 4) == 0 );
assert( gamma_golden_possible(board, 5) == 0 );
char* board495051468 = gamma_board(board);
assert( board495051468 != NULL );
assert( strcmp(board495051468,
"8.1..33.\n"
".6744682\n"
"2513...7\n"
".22161.1\n"
"87254464\n"
".485.64.\n"
"885834.8\n"
"242562.6\n"
"755..326\n"
".3..1512\n"
"62.71147\n") == 0);
free(board495051468);
board495051468 = NULL;
assert( gamma_move(board, 6, 10, 3) == 0 );
char* board310207006 = gamma_board(board);
assert( board310207006 != NULL );
assert( strcmp(board310207006,
"8.1..33.\n"
".6744682\n"
"2513...7\n"
".22161.1\n"
"87254464\n"
".485.64.\n"
"885834.8\n"
"242562.6\n"
"755..326\n"
".3..1512\n"
"62.71147\n") == 0);
free(board310207006);
board310207006 = NULL;
assert( gamma_move(board, 8, 10, 4) == 0 );
assert( gamma_move(board, 1, 7, 3) == 0 );
assert( gamma_move(board, 2, 5, 6) == 0 );
assert( gamma_move(board, 2, 7, 4) == 0 );
assert( gamma_move(board, 3, 2, 3) == 0 );
assert( gamma_move(board, 3, 2, 8) == 0 );
assert( gamma_move(board, 4, 1, 2) == 0 );
assert( gamma_move(board, 4, 6, 8) == 1 );
assert( gamma_move(board, 5, 5, 0) == 0 );
assert( gamma_busy_fields(board, 5) == 8 );
assert( gamma_move(board, 6, 10, 7) == 0 );
assert( gamma_move(board, 6, 0, 10) == 0 );
assert( gamma_move(board, 7, 10, 7) == 0 );
assert( gamma_move(board, 7, 7, 4) == 0 );
assert( gamma_move(board, 8, 4, 7) == 0 );
assert( gamma_move(board, 8, 7, 4) == 0 );
assert( gamma_move(board, 1, 8, 5) == 0 );
assert( gamma_free_fields(board, 2) == 20 );
assert( gamma_move(board, 3, 10, 3) == 0 );
assert( gamma_golden_move(board, 3, 2, 0) == 0 );
assert( gamma_move(board, 4, 9, 0) == 0 );
assert( gamma_move(board, 5, 10, 4) == 0 );
assert( gamma_golden_possible(board, 5) == 0 );
assert( gamma_move(board, 6, 10, 1) == 0 );
assert( gamma_move(board, 6, 2, 8) == 0 );
assert( gamma_free_fields(board, 6) == 20 );
assert( gamma_move(board, 7, 7, 10) == 1 );
assert( gamma_move(board, 7, 3, 0) == 0 );
assert( gamma_move(board, 8, 2, 4) == 0 );
assert( gamma_move(board, 8, 7, 10) == 0 );
char* board212457816 = gamma_board(board);
assert( board212457816 != NULL );
assert( strcmp(board212457816,
"8.1..337\n"
".6744682\n"
"2513..47\n"
".22161.1\n"
"87254464\n"
".485.64.\n"
"885834.8\n"
"242562.6\n"
"755..326\n"
".3..1512\n"
"62.71147\n") == 0);
free(board212457816);
board212457816 = NULL;
assert( gamma_move(board, 2, 4, 1) == 0 );
assert( gamma_move(board, 2, 2, 1) == 1 );
assert( gamma_move(board, 3, 10, 4) == 0 );
assert( gamma_move(board, 3, 0, 3) == 0 );
assert( gamma_move(board, 4, 0, 3) == 0 );
assert( gamma_free_fields(board, 4) == 18 );
assert( gamma_move(board, 5, 7, 0) == 0 );
assert( gamma_free_fields(board, 5) == 18 );
assert( gamma_move(board, 6, 1, 10) == 1 );
assert( gamma_move(board, 8, 7, 10) == 0 );
assert( gamma_move(board, 8, 0, 5) == 1 );
gamma_delete(board);
return 0;
}
| 32.348606 | 50 | 0.60016 |
d4e842845d47e2c3febf79e6486b01e61c42a800 | 51,343 | c | C | testsuite/EXP_5/test959.c | ishiura-compiler/CF3 | 0718aa176d0303a4ea8a46bd6c794997cbb8fabb | [
"MIT"
] | 34 | 2017-07-04T14:16:12.000Z | 2021-04-22T21:04:43.000Z | testsuite/EXP_5/test959.c | ishiura-compiler/CF3 | 0718aa176d0303a4ea8a46bd6c794997cbb8fabb | [
"MIT"
] | 1 | 2017-07-06T03:43:44.000Z | 2017-07-06T03:43:44.000Z | testsuite/EXP_5/test959.c | ishiura-compiler/CF3 | 0718aa176d0303a4ea8a46bd6c794997cbb8fabb | [
"MIT"
] | 6 | 2017-07-04T16:30:42.000Z | 2019-10-16T05:37:29.000Z |
/*
CF3
Copyright (c) 2015 ishiura-lab.
Released under the MIT license.
https://github.com/ishiura-compiler/CF3/MIT-LICENSE.md
*/
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
#include"test1.h"
volatile int16_t x4 = INT16_MIN;
int16_t x6 = 0;
int64_t x8 = -62362692501357LL;
int64_t x9 = INT64_MIN;
volatile int32_t t2 = 54778;
int8_t x29 = INT8_MAX;
int64_t x31 = -813321218591285LL;
volatile int32_t t7 = 224416764;
int8_t x35 = INT8_MIN;
volatile int32_t t8 = 0;
int32_t x37 = -60412;
volatile uint32_t x38 = 421053U;
int16_t x40 = 342;
uint8_t x42 = 1U;
static int32_t t10 = 34;
uint16_t x48 = UINT16_MAX;
uint64_t x50 = 5410797984LLU;
uint16_t x54 = 81U;
int32_t x55 = INT32_MAX;
int32_t t14 = -1;
static uint8_t x64 = UINT8_MAX;
volatile int32_t t16 = -477299;
volatile int64_t x70 = -1LL;
volatile int32_t x80 = INT32_MIN;
static int32_t x86 = 200;
int32_t t22 = 216;
static volatile int32_t t23 = -58610;
volatile int32_t x97 = -1;
uint16_t x108 = 106U;
static volatile int64_t x111 = INT64_MAX;
volatile int32_t t27 = -218698243;
static volatile int32_t t29 = -852965837;
int8_t x129 = 0;
static int64_t x132 = -58621LL;
static int64_t x135 = -1LL;
int32_t x138 = -1;
static uint16_t x142 = UINT16_MAX;
int64_t x146 = INT64_MIN;
int16_t x153 = 0;
uint16_t x155 = 431U;
int16_t x156 = 96;
int16_t x157 = INT16_MIN;
int16_t x159 = 452;
int32_t t39 = -503;
int64_t x161 = -1LL;
static uint32_t x163 = 129108943U;
int32_t x172 = INT32_MIN;
int32_t x186 = INT32_MAX;
volatile int32_t t46 = 2061480;
int64_t x193 = INT64_MIN;
int32_t x198 = -1;
int32_t x202 = 97116974;
volatile int32_t t50 = -60156;
int32_t x214 = -6;
int64_t x216 = 19436099765669641LL;
int32_t t53 = 416;
volatile int16_t x218 = INT16_MIN;
int32_t x220 = INT32_MIN;
int32_t x225 = 7378;
int32_t x231 = -2;
uint16_t x234 = 6592U;
uint8_t x237 = UINT8_MAX;
uint16_t x239 = UINT16_MAX;
static int16_t x240 = INT16_MAX;
int32_t t59 = 24741750;
uint32_t x245 = 2603933U;
uint8_t x249 = UINT8_MAX;
static int8_t x252 = 0;
int32_t t62 = 807009;
int32_t x256 = INT32_MIN;
int16_t x258 = -3180;
int16_t x259 = 10673;
int16_t x260 = -1;
int64_t x265 = INT64_MIN;
uint8_t x271 = 1U;
static volatile int32_t x276 = INT32_MIN;
int32_t x278 = INT32_MIN;
static volatile uint8_t x282 = UINT8_MAX;
uint64_t x289 = UINT64_MAX;
volatile uint16_t x294 = UINT16_MAX;
int64_t x301 = INT64_MAX;
static int32_t t76 = 5785;
volatile uint8_t x309 = UINT8_MAX;
uint8_t x312 = 14U;
uint64_t x317 = 69407LLU;
int16_t x318 = 2083;
uint8_t x322 = UINT8_MAX;
static volatile int64_t x331 = INT64_MAX;
int64_t x332 = -1216325LL;
int32_t x334 = INT32_MIN;
uint64_t x338 = 1890206746127959LLU;
uint32_t x341 = 568539902U;
uint64_t x349 = 118089780444872752LLU;
static int16_t x350 = -1;
int64_t x351 = 1LL;
volatile int32_t t87 = 1526;
static uint64_t x353 = 251LLU;
volatile uint64_t x355 = UINT64_MAX;
int64_t x359 = -1LL;
int16_t x369 = 14;
static volatile uint32_t x370 = UINT32_MAX;
int64_t x373 = -478LL;
uint8_t x376 = 12U;
volatile int32_t t93 = 1170808;
uint32_t x378 = 81399120U;
volatile uint8_t x379 = 2U;
int16_t x384 = INT16_MAX;
int16_t x388 = INT16_MIN;
volatile int16_t x390 = -1;
volatile uint8_t x391 = 2U;
volatile uint32_t x395 = UINT32_MAX;
int16_t x399 = -1;
volatile uint8_t x400 = UINT8_MAX;
static int32_t t103 = 8;
volatile uint8_t x419 = UINT8_MAX;
int8_t x420 = -1;
uint16_t x421 = UINT16_MAX;
static volatile int64_t x423 = -3584564459469LL;
uint16_t x430 = UINT16_MAX;
int16_t x432 = INT16_MIN;
int8_t x434 = -1;
int64_t x437 = INT64_MIN;
static int8_t x439 = -1;
uint16_t x441 = 4153U;
volatile int32_t t110 = -938898;
int64_t x447 = INT64_MIN;
int64_t x448 = -65795335011816LL;
int32_t x462 = INT32_MIN;
static uint8_t x464 = UINT8_MAX;
static uint16_t x465 = 62U;
int64_t x470 = 470688600053198LL;
int32_t x483 = 1;
int16_t x484 = -269;
volatile int32_t t120 = -318;
static volatile int64_t x486 = -1LL;
int32_t t121 = 399153;
uint16_t x492 = UINT16_MAX;
volatile uint64_t x495 = 313414786629481567LLU;
int32_t x496 = INT32_MAX;
volatile int32_t t123 = 15297;
static volatile uint16_t x498 = 6U;
int16_t x499 = 3255;
static int64_t x502 = INT64_MAX;
volatile int8_t x504 = -1;
uint16_t x505 = 112U;
int64_t x508 = -15619LL;
int64_t x510 = 38037LL;
int64_t x514 = INT64_MAX;
int32_t t129 = 977;
uint32_t x527 = UINT32_MAX;
uint32_t x532 = UINT32_MAX;
volatile int32_t t134 = 0;
int64_t x549 = INT64_MIN;
volatile int8_t x551 = 1;
int64_t x553 = INT64_MAX;
int32_t x555 = INT32_MIN;
int32_t t138 = 892;
static int32_t x557 = 120915;
static int64_t x558 = -1LL;
uint64_t x561 = UINT64_MAX;
static uint8_t x563 = 2U;
volatile int32_t t140 = 71;
static uint8_t x565 = 2U;
int64_t x566 = 73951LL;
int32_t t141 = 45;
uint8_t x575 = 14U;
int16_t x589 = -1;
int8_t x592 = -1;
int8_t x593 = 3;
int64_t x595 = INT64_MAX;
volatile int32_t t149 = -16088025;
uint64_t x609 = 24812547632721LLU;
int8_t x610 = -1;
uint64_t x612 = 1LLU;
static int16_t x614 = 1;
uint8_t x641 = UINT8_MAX;
int32_t x642 = -1;
static int32_t x644 = INT32_MAX;
int16_t x659 = 15;
int32_t x660 = -1;
volatile int32_t t162 = 1711462;
volatile int16_t x669 = INT16_MIN;
volatile int32_t t165 = -10514;
int16_t x677 = -50;
int16_t x680 = INT16_MIN;
int16_t x682 = INT16_MAX;
int32_t x696 = INT32_MIN;
static int32_t t171 = 119874;
static volatile int64_t x700 = INT64_MAX;
volatile int16_t x703 = INT16_MAX;
static int32_t x705 = 48070496;
int32_t t174 = 1;
int8_t x710 = -3;
volatile int64_t x713 = INT64_MIN;
int64_t x721 = INT64_MIN;
uint64_t x723 = UINT64_MAX;
int32_t t179 = 5529;
int16_t x736 = 3;
static int32_t x740 = INT32_MIN;
uint8_t x742 = 1U;
uint16_t x749 = UINT16_MAX;
static volatile uint64_t x754 = 153521023756LLU;
int64_t x758 = INT64_MAX;
volatile int32_t t187 = 555845;
static int16_t x770 = INT16_MIN;
volatile int32_t t190 = -6174;
volatile int32_t t192 = 12;
int64_t x789 = INT64_MIN;
uint64_t x791 = 1559519LLU;
uint8_t x794 = UINT8_MAX;
int32_t t194 = 2012;
volatile int16_t x798 = 0;
static uint16_t x803 = 9087U;
uint32_t x808 = UINT32_MAX;
void f0(void) {
int64_t x1 = -1LL;
static int8_t x2 = -1;
int64_t x3 = -1LL;
static int32_t t0 = -2454;
t0 = (x1!=((x2%x3)|x4));
if (t0 != 1) { NG(); } else { ; }
}
void f1(void) {
volatile uint32_t x5 = 14U;
int8_t x7 = INT8_MAX;
volatile int32_t t1 = 90152;
t1 = (x5!=((x6%x7)|x8));
if (t1 != 1) { NG(); } else { ; }
}
void f2(void) {
int32_t x10 = INT32_MIN;
uint32_t x11 = 1623U;
int8_t x12 = 2;
t2 = (x9!=((x10%x11)|x12));
if (t2 != 1) { NG(); } else { ; }
}
void f3(void) {
static volatile uint16_t x13 = 158U;
int8_t x14 = INT8_MAX;
static uint16_t x15 = UINT16_MAX;
int8_t x16 = INT8_MIN;
int32_t t3 = -108199;
t3 = (x13!=((x14%x15)|x16));
if (t3 != 1) { NG(); } else { ; }
}
void f4(void) {
int16_t x17 = 13021;
uint32_t x18 = 17669U;
uint16_t x19 = 1060U;
volatile int16_t x20 = INT16_MAX;
static int32_t t4 = -31303271;
t4 = (x17!=((x18%x19)|x20));
if (t4 != 1) { NG(); } else { ; }
}
void f5(void) {
volatile int16_t x21 = INT16_MIN;
int16_t x22 = INT16_MIN;
int8_t x23 = INT8_MAX;
static int16_t x24 = -1;
int32_t t5 = -1;
t5 = (x21!=((x22%x23)|x24));
if (t5 != 1) { NG(); } else { ; }
}
void f6(void) {
uint8_t x25 = UINT8_MAX;
static int64_t x26 = -2503146446265003LL;
uint64_t x27 = 59528070LLU;
static int32_t x28 = -6723;
int32_t t6 = -113743741;
t6 = (x25!=((x26%x27)|x28));
if (t6 != 1) { NG(); } else { ; }
}
void f7(void) {
uint32_t x30 = 1723871U;
uint32_t x32 = 52U;
t7 = (x29!=((x30%x31)|x32));
if (t7 != 1) { NG(); } else { ; }
}
void f8(void) {
volatile uint16_t x33 = 6U;
int64_t x34 = 9910337559772391LL;
int32_t x36 = 91;
t8 = (x33!=((x34%x35)|x36));
if (t8 != 1) { NG(); } else { ; }
}
void f9(void) {
volatile uint16_t x39 = UINT16_MAX;
int32_t t9 = -160;
t9 = (x37!=((x38%x39)|x40));
if (t9 != 1) { NG(); } else { ; }
}
void f10(void) {
uint32_t x41 = 1U;
int8_t x43 = -41;
static int32_t x44 = -1;
t10 = (x41!=((x42%x43)|x44));
if (t10 != 1) { NG(); } else { ; }
}
void f11(void) {
volatile uint8_t x45 = 108U;
uint8_t x46 = 37U;
int8_t x47 = 1;
int32_t t11 = -10119646;
t11 = (x45!=((x46%x47)|x48));
if (t11 != 1) { NG(); } else { ; }
}
void f12(void) {
int32_t x49 = INT32_MAX;
static int32_t x51 = INT32_MIN;
int32_t x52 = -297255;
int32_t t12 = 15;
t12 = (x49!=((x50%x51)|x52));
if (t12 != 1) { NG(); } else { ; }
}
void f13(void) {
int16_t x53 = 0;
volatile int8_t x56 = INT8_MIN;
static int32_t t13 = 19172;
t13 = (x53!=((x54%x55)|x56));
if (t13 != 1) { NG(); } else { ; }
}
void f14(void) {
static volatile int8_t x57 = -1;
static int8_t x58 = 20;
volatile int64_t x59 = 111016837LL;
uint64_t x60 = 272149376313228261LLU;
t14 = (x57!=((x58%x59)|x60));
if (t14 != 1) { NG(); } else { ; }
}
void f15(void) {
int8_t x61 = INT8_MIN;
int32_t x62 = INT32_MAX;
volatile int32_t x63 = INT32_MIN;
int32_t t15 = -1;
t15 = (x61!=((x62%x63)|x64));
if (t15 != 1) { NG(); } else { ; }
}
void f16(void) {
int64_t x65 = INT64_MIN;
int8_t x66 = -1;
static int8_t x67 = -1;
int64_t x68 = 8LL;
t16 = (x65!=((x66%x67)|x68));
if (t16 != 1) { NG(); } else { ; }
}
void f17(void) {
int8_t x69 = -7;
static int16_t x71 = INT16_MAX;
uint64_t x72 = UINT64_MAX;
int32_t t17 = 3;
t17 = (x69!=((x70%x71)|x72));
if (t17 != 1) { NG(); } else { ; }
}
void f18(void) {
int64_t x73 = 25981LL;
int32_t x74 = INT32_MAX;
int32_t x75 = 3692804;
volatile int64_t x76 = -1LL;
int32_t t18 = 1277837;
t18 = (x73!=((x74%x75)|x76));
if (t18 != 1) { NG(); } else { ; }
}
void f19(void) {
uint64_t x77 = UINT64_MAX;
static uint8_t x78 = 21U;
uint64_t x79 = 13684172LLU;
int32_t t19 = 5909294;
t19 = (x77!=((x78%x79)|x80));
if (t19 != 1) { NG(); } else { ; }
}
void f20(void) {
int8_t x81 = INT8_MIN;
int64_t x82 = INT64_MAX;
uint32_t x83 = UINT32_MAX;
static int8_t x84 = 5;
int32_t t20 = 79305;
t20 = (x81!=((x82%x83)|x84));
if (t20 != 1) { NG(); } else { ; }
}
void f21(void) {
volatile int64_t x85 = INT64_MIN;
uint32_t x87 = 15U;
volatile int16_t x88 = INT16_MAX;
int32_t t21 = -15997218;
t21 = (x85!=((x86%x87)|x88));
if (t21 != 1) { NG(); } else { ; }
}
void f22(void) {
int32_t x89 = INT32_MAX;
int16_t x90 = INT16_MAX;
int8_t x91 = -1;
int64_t x92 = INT64_MAX;
t22 = (x89!=((x90%x91)|x92));
if (t22 != 1) { NG(); } else { ; }
}
void f23(void) {
int64_t x93 = INT64_MIN;
int64_t x94 = INT64_MIN;
int32_t x95 = 948783947;
int32_t x96 = 3;
t23 = (x93!=((x94%x95)|x96));
if (t23 != 1) { NG(); } else { ; }
}
void f24(void) {
int8_t x98 = INT8_MIN;
int8_t x99 = INT8_MIN;
uint32_t x100 = 164364U;
int32_t t24 = -3405;
t24 = (x97!=((x98%x99)|x100));
if (t24 != 1) { NG(); } else { ; }
}
void f25(void) {
static int16_t x101 = 4165;
static uint32_t x102 = UINT32_MAX;
static volatile int16_t x103 = INT16_MIN;
volatile uint32_t x104 = 0U;
int32_t t25 = -774450;
t25 = (x101!=((x102%x103)|x104));
if (t25 != 1) { NG(); } else { ; }
}
void f26(void) {
int32_t x105 = -1;
static int32_t x106 = -1;
static int32_t x107 = INT32_MAX;
int32_t t26 = -14845;
t26 = (x105!=((x106%x107)|x108));
if (t26 != 0) { NG(); } else { ; }
}
void f27(void) {
static int64_t x109 = -1LL;
int64_t x110 = -3600849776LL;
int8_t x112 = INT8_MIN;
t27 = (x109!=((x110%x111)|x112));
if (t27 != 1) { NG(); } else { ; }
}
void f28(void) {
static int64_t x113 = INT64_MIN;
static uint64_t x114 = 128LLU;
int64_t x115 = -121482898021458749LL;
uint8_t x116 = 1U;
static volatile int32_t t28 = 6200;
t28 = (x113!=((x114%x115)|x116));
if (t28 != 1) { NG(); } else { ; }
}
void f29(void) {
int8_t x117 = INT8_MIN;
volatile int32_t x118 = INT32_MIN;
int32_t x119 = INT32_MIN;
uint8_t x120 = 0U;
t29 = (x117!=((x118%x119)|x120));
if (t29 != 1) { NG(); } else { ; }
}
void f30(void) {
static int16_t x121 = INT16_MIN;
int8_t x122 = -1;
static uint16_t x123 = 28U;
int32_t x124 = -79688439;
volatile int32_t t30 = 0;
t30 = (x121!=((x122%x123)|x124));
if (t30 != 1) { NG(); } else { ; }
}
void f31(void) {
int16_t x125 = INT16_MAX;
int16_t x126 = INT16_MIN;
int8_t x127 = INT8_MIN;
volatile uint32_t x128 = 2322U;
volatile int32_t t31 = 173;
t31 = (x125!=((x126%x127)|x128));
if (t31 != 1) { NG(); } else { ; }
}
void f32(void) {
uint32_t x130 = 4362U;
static uint16_t x131 = 6429U;
static volatile int32_t t32 = -20;
t32 = (x129!=((x130%x131)|x132));
if (t32 != 1) { NG(); } else { ; }
}
void f33(void) {
int64_t x133 = INT64_MIN;
static int16_t x134 = -1;
uint32_t x136 = UINT32_MAX;
int32_t t33 = -146077;
t33 = (x133!=((x134%x135)|x136));
if (t33 != 1) { NG(); } else { ; }
}
void f34(void) {
static int32_t x137 = INT32_MIN;
int16_t x139 = -1;
volatile int8_t x140 = -32;
int32_t t34 = -6653465;
t34 = (x137!=((x138%x139)|x140));
if (t34 != 1) { NG(); } else { ; }
}
void f35(void) {
volatile uint16_t x141 = 7U;
int8_t x143 = INT8_MIN;
int16_t x144 = INT16_MIN;
volatile int32_t t35 = 3;
t35 = (x141!=((x142%x143)|x144));
if (t35 != 1) { NG(); } else { ; }
}
void f36(void) {
uint8_t x145 = UINT8_MAX;
static int8_t x147 = INT8_MIN;
uint16_t x148 = UINT16_MAX;
int32_t t36 = -1;
t36 = (x145!=((x146%x147)|x148));
if (t36 != 1) { NG(); } else { ; }
}
void f37(void) {
int64_t x149 = INT64_MAX;
uint64_t x150 = UINT64_MAX;
uint64_t x151 = UINT64_MAX;
volatile int8_t x152 = INT8_MAX;
static int32_t t37 = -5;
t37 = (x149!=((x150%x151)|x152));
if (t37 != 1) { NG(); } else { ; }
}
void f38(void) {
static uint8_t x154 = UINT8_MAX;
volatile int32_t t38 = -2878;
t38 = (x153!=((x154%x155)|x156));
if (t38 != 1) { NG(); } else { ; }
}
void f39(void) {
int64_t x158 = -610LL;
static uint32_t x160 = 219U;
t39 = (x157!=((x158%x159)|x160));
if (t39 != 1) { NG(); } else { ; }
}
void f40(void) {
uint64_t x162 = UINT64_MAX;
uint64_t x164 = UINT64_MAX;
int32_t t40 = -5;
t40 = (x161!=((x162%x163)|x164));
if (t40 != 0) { NG(); } else { ; }
}
void f41(void) {
volatile uint64_t x165 = UINT64_MAX;
int16_t x166 = -1;
volatile int16_t x167 = INT16_MIN;
uint16_t x168 = 1495U;
int32_t t41 = 14986950;
t41 = (x165!=((x166%x167)|x168));
if (t41 != 0) { NG(); } else { ; }
}
void f42(void) {
static uint64_t x169 = UINT64_MAX;
volatile uint32_t x170 = 59364045U;
int16_t x171 = INT16_MIN;
volatile int32_t t42 = 7849;
t42 = (x169!=((x170%x171)|x172));
if (t42 != 1) { NG(); } else { ; }
}
void f43(void) {
int64_t x173 = 18962858801024088LL;
uint64_t x174 = 406922032689994LLU;
int16_t x175 = INT16_MIN;
int32_t x176 = INT32_MIN;
static volatile int32_t t43 = 1520895;
t43 = (x173!=((x174%x175)|x176));
if (t43 != 1) { NG(); } else { ; }
}
void f44(void) {
volatile int8_t x177 = 4;
int64_t x178 = -4776353471LL;
uint8_t x179 = UINT8_MAX;
int16_t x180 = -1;
volatile int32_t t44 = -2666224;
t44 = (x177!=((x178%x179)|x180));
if (t44 != 1) { NG(); } else { ; }
}
void f45(void) {
int32_t x181 = INT32_MIN;
static int8_t x182 = INT8_MAX;
int32_t x183 = -1084;
uint16_t x184 = 2U;
static int32_t t45 = 129;
t45 = (x181!=((x182%x183)|x184));
if (t45 != 1) { NG(); } else { ; }
}
void f46(void) {
static uint16_t x185 = 0U;
int8_t x187 = 59;
volatile int16_t x188 = -41;
t46 = (x185!=((x186%x187)|x188));
if (t46 != 1) { NG(); } else { ; }
}
void f47(void) {
static int8_t x189 = INT8_MIN;
static int64_t x190 = INT64_MIN;
int16_t x191 = INT16_MIN;
int64_t x192 = INT64_MIN;
volatile int32_t t47 = -199495476;
t47 = (x189!=((x190%x191)|x192));
if (t47 != 1) { NG(); } else { ; }
}
void f48(void) {
int32_t x194 = 145481935;
int8_t x195 = -1;
int32_t x196 = INT32_MIN;
volatile int32_t t48 = 48771;
t48 = (x193!=((x194%x195)|x196));
if (t48 != 1) { NG(); } else { ; }
}
void f49(void) {
uint32_t x197 = UINT32_MAX;
int8_t x199 = INT8_MIN;
int8_t x200 = 57;
volatile int32_t t49 = 1009196;
t49 = (x197!=((x198%x199)|x200));
if (t49 != 0) { NG(); } else { ; }
}
void f50(void) {
volatile int8_t x201 = INT8_MIN;
static uint8_t x203 = 1U;
uint32_t x204 = 672308718U;
t50 = (x201!=((x202%x203)|x204));
if (t50 != 1) { NG(); } else { ; }
}
void f51(void) {
int64_t x205 = -311529179699770LL;
uint8_t x206 = 116U;
static int32_t x207 = INT32_MIN;
uint64_t x208 = 9359LLU;
int32_t t51 = 853119089;
t51 = (x205!=((x206%x207)|x208));
if (t51 != 1) { NG(); } else { ; }
}
void f52(void) {
int64_t x209 = 408651761587766141LL;
volatile int64_t x210 = INT64_MAX;
static int32_t x211 = -1;
static uint32_t x212 = 2982469U;
static volatile int32_t t52 = -3650248;
t52 = (x209!=((x210%x211)|x212));
if (t52 != 1) { NG(); } else { ; }
}
void f53(void) {
uint8_t x213 = UINT8_MAX;
uint32_t x215 = 202689130U;
t53 = (x213!=((x214%x215)|x216));
if (t53 != 1) { NG(); } else { ; }
}
void f54(void) {
uint16_t x217 = UINT16_MAX;
uint64_t x219 = 33893838319557LLU;
int32_t t54 = -3;
t54 = (x217!=((x218%x219)|x220));
if (t54 != 1) { NG(); } else { ; }
}
void f55(void) {
int32_t x221 = -1;
uint16_t x222 = 1117U;
int8_t x223 = INT8_MIN;
int64_t x224 = -9354908215251651LL;
int32_t t55 = -1587166;
t55 = (x221!=((x222%x223)|x224));
if (t55 != 1) { NG(); } else { ; }
}
void f56(void) {
int8_t x226 = 3;
uint64_t x227 = UINT64_MAX;
uint32_t x228 = 86102417U;
int32_t t56 = -1982703;
t56 = (x225!=((x226%x227)|x228));
if (t56 != 1) { NG(); } else { ; }
}
void f57(void) {
uint8_t x229 = 7U;
static int32_t x230 = 252;
int32_t x232 = -1;
volatile int32_t t57 = 0;
t57 = (x229!=((x230%x231)|x232));
if (t57 != 1) { NG(); } else { ; }
}
void f58(void) {
volatile int64_t x233 = INT64_MIN;
static int32_t x235 = 424794;
uint16_t x236 = 728U;
int32_t t58 = -49261310;
t58 = (x233!=((x234%x235)|x236));
if (t58 != 1) { NG(); } else { ; }
}
void f59(void) {
int8_t x238 = INT8_MAX;
t59 = (x237!=((x238%x239)|x240));
if (t59 != 1) { NG(); } else { ; }
}
void f60(void) {
int8_t x241 = INT8_MAX;
static uint8_t x242 = 1U;
uint16_t x243 = 14175U;
int8_t x244 = 0;
int32_t t60 = -4206;
t60 = (x241!=((x242%x243)|x244));
if (t60 != 1) { NG(); } else { ; }
}
void f61(void) {
int16_t x246 = INT16_MIN;
volatile int16_t x247 = 10;
int32_t x248 = -1762686;
volatile int32_t t61 = -633478823;
t61 = (x245!=((x246%x247)|x248));
if (t61 != 1) { NG(); } else { ; }
}
void f62(void) {
int32_t x250 = INT32_MIN;
uint8_t x251 = 2U;
t62 = (x249!=((x250%x251)|x252));
if (t62 != 1) { NG(); } else { ; }
}
void f63(void) {
int32_t x253 = INT32_MIN;
static volatile int64_t x254 = -1LL;
uint8_t x255 = 14U;
volatile int32_t t63 = -105;
t63 = (x253!=((x254%x255)|x256));
if (t63 != 1) { NG(); } else { ; }
}
void f64(void) {
uint64_t x257 = UINT64_MAX;
int32_t t64 = -411327658;
t64 = (x257!=((x258%x259)|x260));
if (t64 != 0) { NG(); } else { ; }
}
void f65(void) {
int32_t x261 = 2;
int64_t x262 = INT64_MIN;
int32_t x263 = INT32_MAX;
int16_t x264 = INT16_MIN;
volatile int32_t t65 = -946;
t65 = (x261!=((x262%x263)|x264));
if (t65 != 1) { NG(); } else { ; }
}
void f66(void) {
uint64_t x266 = 12891470325649LLU;
int64_t x267 = -1LL;
int8_t x268 = INT8_MAX;
int32_t t66 = -33280940;
t66 = (x265!=((x266%x267)|x268));
if (t66 != 1) { NG(); } else { ; }
}
void f67(void) {
static uint32_t x269 = 4562U;
static int16_t x270 = 974;
int64_t x272 = INT64_MIN;
volatile int32_t t67 = -266263;
t67 = (x269!=((x270%x271)|x272));
if (t67 != 1) { NG(); } else { ; }
}
void f68(void) {
int16_t x273 = -9936;
uint16_t x274 = 0U;
int16_t x275 = INT16_MAX;
int32_t t68 = 74069;
t68 = (x273!=((x274%x275)|x276));
if (t68 != 1) { NG(); } else { ; }
}
void f69(void) {
int32_t x277 = -255;
int16_t x279 = 4;
static volatile uint64_t x280 = 20LLU;
volatile int32_t t69 = 23307;
t69 = (x277!=((x278%x279)|x280));
if (t69 != 1) { NG(); } else { ; }
}
void f70(void) {
int64_t x281 = -10633LL;
int64_t x283 = INT64_MIN;
volatile uint16_t x284 = 13U;
static volatile int32_t t70 = 226892019;
t70 = (x281!=((x282%x283)|x284));
if (t70 != 1) { NG(); } else { ; }
}
void f71(void) {
int16_t x285 = INT16_MAX;
static uint32_t x286 = 2171U;
int32_t x287 = -691;
volatile int64_t x288 = INT64_MIN;
int32_t t71 = -485702;
t71 = (x285!=((x286%x287)|x288));
if (t71 != 1) { NG(); } else { ; }
}
void f72(void) {
static int16_t x290 = INT16_MAX;
uint32_t x291 = 29069173U;
static uint32_t x292 = UINT32_MAX;
volatile int32_t t72 = -14549;
t72 = (x289!=((x290%x291)|x292));
if (t72 != 1) { NG(); } else { ; }
}
void f73(void) {
int8_t x293 = -1;
int8_t x295 = -1;
static uint8_t x296 = 8U;
volatile int32_t t73 = 129;
t73 = (x293!=((x294%x295)|x296));
if (t73 != 1) { NG(); } else { ; }
}
void f74(void) {
uint64_t x297 = UINT64_MAX;
int64_t x298 = -237167358485594754LL;
uint32_t x299 = 254U;
int64_t x300 = 3938332044382LL;
int32_t t74 = -809477732;
t74 = (x297!=((x298%x299)|x300));
if (t74 != 1) { NG(); } else { ; }
}
void f75(void) {
static int32_t x302 = INT32_MAX;
uint32_t x303 = UINT32_MAX;
volatile int16_t x304 = -1;
int32_t t75 = -176903945;
t75 = (x301!=((x302%x303)|x304));
if (t75 != 1) { NG(); } else { ; }
}
void f76(void) {
int16_t x305 = 732;
uint64_t x306 = 454520782393LLU;
int8_t x307 = INT8_MIN;
int16_t x308 = INT16_MAX;
t76 = (x305!=((x306%x307)|x308));
if (t76 != 1) { NG(); } else { ; }
}
void f77(void) {
static uint16_t x310 = 28U;
uint16_t x311 = 11362U;
static volatile int32_t t77 = -10;
t77 = (x309!=((x310%x311)|x312));
if (t77 != 1) { NG(); } else { ; }
}
void f78(void) {
int8_t x313 = -1;
uint16_t x314 = 1564U;
int16_t x315 = -1;
uint8_t x316 = 6U;
int32_t t78 = -5;
t78 = (x313!=((x314%x315)|x316));
if (t78 != 1) { NG(); } else { ; }
}
void f79(void) {
int8_t x319 = 5;
int16_t x320 = INT16_MIN;
static int32_t t79 = -47;
t79 = (x317!=((x318%x319)|x320));
if (t79 != 1) { NG(); } else { ; }
}
void f80(void) {
int8_t x321 = INT8_MIN;
uint16_t x323 = UINT16_MAX;
int64_t x324 = INT64_MIN;
int32_t t80 = -28795;
t80 = (x321!=((x322%x323)|x324));
if (t80 != 1) { NG(); } else { ; }
}
void f81(void) {
static uint16_t x325 = UINT16_MAX;
static int64_t x326 = INT64_MIN;
uint64_t x327 = UINT64_MAX;
uint16_t x328 = 264U;
static volatile int32_t t81 = 2397;
t81 = (x325!=((x326%x327)|x328));
if (t81 != 1) { NG(); } else { ; }
}
void f82(void) {
static uint8_t x329 = 11U;
int64_t x330 = -1LL;
volatile int32_t t82 = 413516992;
t82 = (x329!=((x330%x331)|x332));
if (t82 != 1) { NG(); } else { ; }
}
void f83(void) {
uint64_t x333 = 2191597651008925LLU;
int8_t x335 = INT8_MAX;
int8_t x336 = 56;
volatile int32_t t83 = 207;
t83 = (x333!=((x334%x335)|x336));
if (t83 != 1) { NG(); } else { ; }
}
void f84(void) {
volatile int16_t x337 = 6;
volatile uint8_t x339 = 36U;
uint8_t x340 = 50U;
static int32_t t84 = 3;
t84 = (x337!=((x338%x339)|x340));
if (t84 != 1) { NG(); } else { ; }
}
void f85(void) {
int8_t x342 = INT8_MIN;
static int64_t x343 = INT64_MIN;
int8_t x344 = INT8_MAX;
volatile int32_t t85 = 25957;
t85 = (x341!=((x342%x343)|x344));
if (t85 != 1) { NG(); } else { ; }
}
void f86(void) {
uint16_t x345 = 1U;
uint8_t x346 = 31U;
int8_t x347 = -3;
static int8_t x348 = INT8_MIN;
int32_t t86 = -124469;
t86 = (x345!=((x346%x347)|x348));
if (t86 != 1) { NG(); } else { ; }
}
void f87(void) {
int32_t x352 = INT32_MAX;
t87 = (x349!=((x350%x351)|x352));
if (t87 != 1) { NG(); } else { ; }
}
void f88(void) {
int16_t x354 = INT16_MIN;
static int16_t x356 = 715;
volatile int32_t t88 = 239;
t88 = (x353!=((x354%x355)|x356));
if (t88 != 1) { NG(); } else { ; }
}
void f89(void) {
volatile int32_t x357 = INT32_MIN;
int8_t x358 = -1;
int8_t x360 = -3;
static volatile int32_t t89 = -3274;
t89 = (x357!=((x358%x359)|x360));
if (t89 != 1) { NG(); } else { ; }
}
void f90(void) {
uint8_t x361 = 27U;
static uint32_t x362 = UINT32_MAX;
uint64_t x363 = UINT64_MAX;
volatile uint32_t x364 = 725147U;
volatile int32_t t90 = 201;
t90 = (x361!=((x362%x363)|x364));
if (t90 != 1) { NG(); } else { ; }
}
void f91(void) {
uint32_t x365 = 9439U;
uint8_t x366 = UINT8_MAX;
int32_t x367 = -16381;
int8_t x368 = -1;
int32_t t91 = -5801636;
t91 = (x365!=((x366%x367)|x368));
if (t91 != 1) { NG(); } else { ; }
}
void f92(void) {
static uint32_t x371 = 14U;
int8_t x372 = INT8_MIN;
static volatile int32_t t92 = -79984;
t92 = (x369!=((x370%x371)|x372));
if (t92 != 1) { NG(); } else { ; }
}
void f93(void) {
int8_t x374 = INT8_MAX;
int64_t x375 = INT64_MIN;
t93 = (x373!=((x374%x375)|x376));
if (t93 != 1) { NG(); } else { ; }
}
void f94(void) {
int16_t x377 = 1;
int32_t x380 = -1;
static volatile int32_t t94 = 121882410;
t94 = (x377!=((x378%x379)|x380));
if (t94 != 1) { NG(); } else { ; }
}
void f95(void) {
volatile int64_t x381 = -851130LL;
uint16_t x382 = 26U;
int32_t x383 = -224134;
int32_t t95 = -3067424;
t95 = (x381!=((x382%x383)|x384));
if (t95 != 1) { NG(); } else { ; }
}
void f96(void) {
volatile int32_t x385 = 0;
int8_t x386 = INT8_MIN;
volatile int32_t x387 = INT32_MIN;
static int32_t t96 = 1;
t96 = (x385!=((x386%x387)|x388));
if (t96 != 1) { NG(); } else { ; }
}
void f97(void) {
volatile int8_t x389 = -1;
int32_t x392 = INT32_MIN;
volatile int32_t t97 = 0;
t97 = (x389!=((x390%x391)|x392));
if (t97 != 0) { NG(); } else { ; }
}
void f98(void) {
int16_t x393 = INT16_MIN;
volatile uint64_t x394 = 1504295LLU;
int32_t x396 = -82;
int32_t t98 = -27;
t98 = (x393!=((x394%x395)|x396));
if (t98 != 1) { NG(); } else { ; }
}
void f99(void) {
int16_t x397 = INT16_MAX;
volatile uint8_t x398 = UINT8_MAX;
volatile int32_t t99 = -55;
t99 = (x397!=((x398%x399)|x400));
if (t99 != 1) { NG(); } else { ; }
}
void f100(void) {
static int64_t x401 = INT64_MAX;
uint64_t x402 = UINT64_MAX;
uint64_t x403 = 3025977579296LLU;
uint16_t x404 = 5867U;
int32_t t100 = 1;
t100 = (x401!=((x402%x403)|x404));
if (t100 != 1) { NG(); } else { ; }
}
void f101(void) {
uint64_t x405 = UINT64_MAX;
int64_t x406 = 59904667LL;
int8_t x407 = INT8_MAX;
int16_t x408 = INT16_MIN;
volatile int32_t t101 = 5;
t101 = (x405!=((x406%x407)|x408));
if (t101 != 1) { NG(); } else { ; }
}
void f102(void) {
uint16_t x409 = 11629U;
volatile uint64_t x410 = UINT64_MAX;
volatile int8_t x411 = INT8_MIN;
static int32_t x412 = INT32_MIN;
static int32_t t102 = -3;
t102 = (x409!=((x410%x411)|x412));
if (t102 != 1) { NG(); } else { ; }
}
void f103(void) {
uint8_t x413 = 0U;
int8_t x414 = INT8_MAX;
uint32_t x415 = 5U;
volatile int32_t x416 = -6514210;
t103 = (x413!=((x414%x415)|x416));
if (t103 != 1) { NG(); } else { ; }
}
void f104(void) {
int16_t x417 = INT16_MIN;
int32_t x418 = 1;
volatile int32_t t104 = -47;
t104 = (x417!=((x418%x419)|x420));
if (t104 != 1) { NG(); } else { ; }
}
void f105(void) {
int16_t x422 = INT16_MAX;
int8_t x424 = INT8_MIN;
volatile int32_t t105 = 426;
t105 = (x421!=((x422%x423)|x424));
if (t105 != 1) { NG(); } else { ; }
}
void f106(void) {
int64_t x425 = -440676677LL;
int8_t x426 = INT8_MIN;
int32_t x427 = -66651764;
int32_t x428 = 1191;
volatile int32_t t106 = -1134;
t106 = (x425!=((x426%x427)|x428));
if (t106 != 1) { NG(); } else { ; }
}
void f107(void) {
volatile uint32_t x429 = 114068291U;
static uint32_t x431 = UINT32_MAX;
volatile int32_t t107 = -7231;
t107 = (x429!=((x430%x431)|x432));
if (t107 != 1) { NG(); } else { ; }
}
void f108(void) {
int16_t x433 = -7844;
static uint16_t x435 = UINT16_MAX;
int32_t x436 = 231;
int32_t t108 = -1;
t108 = (x433!=((x434%x435)|x436));
if (t108 != 1) { NG(); } else { ; }
}
void f109(void) {
int16_t x438 = -1841;
static uint64_t x440 = 2698693875LLU;
static int32_t t109 = -15;
t109 = (x437!=((x438%x439)|x440));
if (t109 != 1) { NG(); } else { ; }
}
void f110(void) {
int32_t x442 = -1;
volatile uint32_t x443 = 215226390U;
volatile int16_t x444 = 167;
t110 = (x441!=((x442%x443)|x444));
if (t110 != 1) { NG(); } else { ; }
}
void f111(void) {
uint32_t x445 = 16U;
uint64_t x446 = 3311198070707864058LLU;
int32_t t111 = 508699784;
t111 = (x445!=((x446%x447)|x448));
if (t111 != 1) { NG(); } else { ; }
}
void f112(void) {
static int32_t x449 = INT32_MAX;
int32_t x450 = -12;
int64_t x451 = INT64_MIN;
int16_t x452 = -63;
static volatile int32_t t112 = -6893111;
t112 = (x449!=((x450%x451)|x452));
if (t112 != 1) { NG(); } else { ; }
}
void f113(void) {
uint8_t x453 = 1U;
int32_t x454 = -1;
uint64_t x455 = UINT64_MAX;
int16_t x456 = INT16_MIN;
volatile int32_t t113 = 160;
t113 = (x453!=((x454%x455)|x456));
if (t113 != 1) { NG(); } else { ; }
}
void f114(void) {
volatile int32_t x457 = INT32_MIN;
static int16_t x458 = 5717;
int8_t x459 = -1;
static volatile int8_t x460 = 2;
volatile int32_t t114 = 3493;
t114 = (x457!=((x458%x459)|x460));
if (t114 != 1) { NG(); } else { ; }
}
void f115(void) {
int16_t x461 = INT16_MIN;
static int32_t x463 = INT32_MIN;
int32_t t115 = 542654;
t115 = (x461!=((x462%x463)|x464));
if (t115 != 1) { NG(); } else { ; }
}
void f116(void) {
static uint16_t x466 = 94U;
uint64_t x467 = 170402815448LLU;
int8_t x468 = -9;
int32_t t116 = 5;
t116 = (x465!=((x466%x467)|x468));
if (t116 != 1) { NG(); } else { ; }
}
void f117(void) {
int64_t x469 = -430804267055370LL;
uint16_t x471 = UINT16_MAX;
volatile uint16_t x472 = 4579U;
int32_t t117 = 128;
t117 = (x469!=((x470%x471)|x472));
if (t117 != 1) { NG(); } else { ; }
}
void f118(void) {
volatile int16_t x473 = -1;
static int64_t x474 = INT64_MIN;
uint64_t x475 = 26256854619000620LLU;
int16_t x476 = -1;
int32_t t118 = 2832262;
t118 = (x473!=((x474%x475)|x476));
if (t118 != 0) { NG(); } else { ; }
}
void f119(void) {
uint32_t x477 = 8824U;
uint64_t x478 = 1256728781351LLU;
int16_t x479 = 5455;
int16_t x480 = -1;
static volatile int32_t t119 = 3019;
t119 = (x477!=((x478%x479)|x480));
if (t119 != 1) { NG(); } else { ; }
}
void f120(void) {
static uint8_t x481 = UINT8_MAX;
uint32_t x482 = 2U;
t120 = (x481!=((x482%x483)|x484));
if (t120 != 1) { NG(); } else { ; }
}
void f121(void) {
volatile int16_t x485 = 0;
volatile uint8_t x487 = 4U;
static uint16_t x488 = 61U;
t121 = (x485!=((x486%x487)|x488));
if (t121 != 1) { NG(); } else { ; }
}
void f122(void) {
static int16_t x489 = -3;
int8_t x490 = INT8_MIN;
int64_t x491 = INT64_MIN;
volatile int32_t t122 = -1345;
t122 = (x489!=((x490%x491)|x492));
if (t122 != 1) { NG(); } else { ; }
}
void f123(void) {
volatile uint64_t x493 = 150900LLU;
int16_t x494 = INT16_MAX;
t123 = (x493!=((x494%x495)|x496));
if (t123 != 1) { NG(); } else { ; }
}
void f124(void) {
uint64_t x497 = 381964812LLU;
int32_t x500 = 1;
volatile int32_t t124 = -185810458;
t124 = (x497!=((x498%x499)|x500));
if (t124 != 1) { NG(); } else { ; }
}
void f125(void) {
uint8_t x501 = 1U;
int16_t x503 = INT16_MIN;
static int32_t t125 = 1024977615;
t125 = (x501!=((x502%x503)|x504));
if (t125 != 1) { NG(); } else { ; }
}
void f126(void) {
uint32_t x506 = 28U;
int32_t x507 = INT32_MAX;
volatile int32_t t126 = -5;
t126 = (x505!=((x506%x507)|x508));
if (t126 != 1) { NG(); } else { ; }
}
void f127(void) {
int8_t x509 = 13;
int64_t x511 = INT64_MIN;
static uint8_t x512 = 0U;
int32_t t127 = 0;
t127 = (x509!=((x510%x511)|x512));
if (t127 != 1) { NG(); } else { ; }
}
void f128(void) {
int32_t x513 = INT32_MIN;
int32_t x515 = INT32_MAX;
volatile uint8_t x516 = 16U;
int32_t t128 = -12;
t128 = (x513!=((x514%x515)|x516));
if (t128 != 1) { NG(); } else { ; }
}
void f129(void) {
uint8_t x517 = 15U;
int64_t x518 = -1LL;
uint8_t x519 = 18U;
static int8_t x520 = INT8_MIN;
t129 = (x517!=((x518%x519)|x520));
if (t129 != 1) { NG(); } else { ; }
}
void f130(void) {
static uint8_t x521 = UINT8_MAX;
int16_t x522 = -2014;
int64_t x523 = INT64_MIN;
int8_t x524 = 1;
volatile int32_t t130 = -1055672119;
t130 = (x521!=((x522%x523)|x524));
if (t130 != 1) { NG(); } else { ; }
}
void f131(void) {
static uint64_t x525 = 573387480779993163LLU;
volatile int8_t x526 = -17;
uint64_t x528 = 186849439991057LLU;
int32_t t131 = -116564;
t131 = (x525!=((x526%x527)|x528));
if (t131 != 1) { NG(); } else { ; }
}
void f132(void) {
int8_t x529 = 59;
uint64_t x530 = UINT64_MAX;
static int64_t x531 = INT64_MAX;
int32_t t132 = -244368;
t132 = (x529!=((x530%x531)|x532));
if (t132 != 1) { NG(); } else { ; }
}
void f133(void) {
static volatile int8_t x533 = -6;
int32_t x534 = -1;
int8_t x535 = INT8_MIN;
uint32_t x536 = UINT32_MAX;
static int32_t t133 = -3439981;
t133 = (x533!=((x534%x535)|x536));
if (t133 != 1) { NG(); } else { ; }
}
void f134(void) {
int64_t x537 = 16LL;
volatile int64_t x538 = 812411LL;
volatile int32_t x539 = INT32_MIN;
int8_t x540 = INT8_MIN;
t134 = (x537!=((x538%x539)|x540));
if (t134 != 1) { NG(); } else { ; }
}
void f135(void) {
static volatile int8_t x541 = INT8_MIN;
static int8_t x542 = 1;
int8_t x543 = 33;
uint8_t x544 = UINT8_MAX;
int32_t t135 = -15;
t135 = (x541!=((x542%x543)|x544));
if (t135 != 1) { NG(); } else { ; }
}
void f136(void) {
volatile int32_t x545 = INT32_MAX;
volatile int16_t x546 = INT16_MIN;
int16_t x547 = -4;
int64_t x548 = INT64_MIN;
int32_t t136 = -5;
t136 = (x545!=((x546%x547)|x548));
if (t136 != 1) { NG(); } else { ; }
}
void f137(void) {
int32_t x550 = -9863107;
int64_t x552 = -1LL;
int32_t t137 = 2977;
t137 = (x549!=((x550%x551)|x552));
if (t137 != 1) { NG(); } else { ; }
}
void f138(void) {
uint8_t x554 = 28U;
int32_t x556 = 18271;
t138 = (x553!=((x554%x555)|x556));
if (t138 != 1) { NG(); } else { ; }
}
void f139(void) {
int16_t x559 = -7590;
volatile int16_t x560 = -1;
volatile int32_t t139 = -26230;
t139 = (x557!=((x558%x559)|x560));
if (t139 != 1) { NG(); } else { ; }
}
void f140(void) {
int16_t x562 = 227;
uint16_t x564 = 1562U;
t140 = (x561!=((x562%x563)|x564));
if (t140 != 1) { NG(); } else { ; }
}
void f141(void) {
int16_t x567 = -10427;
static int64_t x568 = 27LL;
t141 = (x565!=((x566%x567)|x568));
if (t141 != 1) { NG(); } else { ; }
}
void f142(void) {
uint16_t x569 = 9549U;
int32_t x570 = INT32_MIN;
uint16_t x571 = 18680U;
volatile int64_t x572 = -42078609627LL;
volatile int32_t t142 = -1290219;
t142 = (x569!=((x570%x571)|x572));
if (t142 != 1) { NG(); } else { ; }
}
void f143(void) {
volatile int32_t x573 = INT32_MAX;
static int8_t x574 = -11;
int64_t x576 = -55046486497651144LL;
int32_t t143 = 16351718;
t143 = (x573!=((x574%x575)|x576));
if (t143 != 1) { NG(); } else { ; }
}
void f144(void) {
static uint16_t x577 = 0U;
static uint32_t x578 = UINT32_MAX;
uint8_t x579 = 1U;
uint64_t x580 = 1150967272700376512LLU;
int32_t t144 = -15298;
t144 = (x577!=((x578%x579)|x580));
if (t144 != 1) { NG(); } else { ; }
}
void f145(void) {
int16_t x581 = 1;
int8_t x582 = INT8_MAX;
static int16_t x583 = -1;
uint8_t x584 = UINT8_MAX;
int32_t t145 = 620;
t145 = (x581!=((x582%x583)|x584));
if (t145 != 1) { NG(); } else { ; }
}
void f146(void) {
int16_t x585 = 75;
int64_t x586 = -8127LL;
int32_t x587 = INT32_MIN;
uint16_t x588 = UINT16_MAX;
int32_t t146 = -3637856;
t146 = (x585!=((x586%x587)|x588));
if (t146 != 1) { NG(); } else { ; }
}
void f147(void) {
static int16_t x590 = 243;
int64_t x591 = INT64_MAX;
int32_t t147 = 959642;
t147 = (x589!=((x590%x591)|x592));
if (t147 != 0) { NG(); } else { ; }
}
void f148(void) {
int32_t x594 = -1;
volatile uint16_t x596 = 17U;
int32_t t148 = -6620;
t148 = (x593!=((x594%x595)|x596));
if (t148 != 1) { NG(); } else { ; }
}
void f149(void) {
int8_t x597 = 5;
static int16_t x598 = INT16_MIN;
int64_t x599 = 3593LL;
int64_t x600 = INT64_MIN;
t149 = (x597!=((x598%x599)|x600));
if (t149 != 1) { NG(); } else { ; }
}
void f150(void) {
static int16_t x605 = INT16_MIN;
volatile int32_t x606 = INT32_MIN;
int16_t x607 = INT16_MAX;
volatile int64_t x608 = INT64_MAX;
int32_t t150 = -122460;
t150 = (x605!=((x606%x607)|x608));
if (t150 != 1) { NG(); } else { ; }
}
void f151(void) {
uint16_t x611 = UINT16_MAX;
static volatile int32_t t151 = 0;
t151 = (x609!=((x610%x611)|x612));
if (t151 != 1) { NG(); } else { ; }
}
void f152(void) {
uint8_t x613 = 7U;
int64_t x615 = 3931637663900LL;
int32_t x616 = INT32_MAX;
int32_t t152 = 34420203;
t152 = (x613!=((x614%x615)|x616));
if (t152 != 1) { NG(); } else { ; }
}
void f153(void) {
int64_t x617 = INT64_MIN;
static int16_t x618 = -1;
int8_t x619 = -1;
volatile int64_t x620 = INT64_MAX;
int32_t t153 = 3216169;
t153 = (x617!=((x618%x619)|x620));
if (t153 != 1) { NG(); } else { ; }
}
void f154(void) {
static int64_t x625 = INT64_MIN;
uint64_t x626 = UINT64_MAX;
int16_t x627 = INT16_MIN;
int8_t x628 = -1;
static volatile int32_t t154 = 315070;
t154 = (x625!=((x626%x627)|x628));
if (t154 != 1) { NG(); } else { ; }
}
void f155(void) {
int32_t x629 = -1;
static volatile int8_t x630 = 22;
uint8_t x631 = UINT8_MAX;
int8_t x632 = INT8_MIN;
int32_t t155 = 9689780;
t155 = (x629!=((x630%x631)|x632));
if (t155 != 1) { NG(); } else { ; }
}
void f156(void) {
uint64_t x633 = UINT64_MAX;
volatile int32_t x634 = -1;
volatile int16_t x635 = -2559;
int32_t x636 = INT32_MIN;
static int32_t t156 = -5237734;
t156 = (x633!=((x634%x635)|x636));
if (t156 != 0) { NG(); } else { ; }
}
void f157(void) {
int8_t x637 = -2;
uint64_t x638 = 1318LLU;
static int8_t x639 = INT8_MAX;
int64_t x640 = -29655620745LL;
int32_t t157 = -26066008;
t157 = (x637!=((x638%x639)|x640));
if (t157 != 1) { NG(); } else { ; }
}
void f158(void) {
volatile int32_t x643 = INT32_MIN;
int32_t t158 = 30118;
t158 = (x641!=((x642%x643)|x644));
if (t158 != 1) { NG(); } else { ; }
}
void f159(void) {
volatile uint16_t x645 = 7U;
uint32_t x646 = 23081302U;
int8_t x647 = INT8_MIN;
int64_t x648 = INT64_MIN;
int32_t t159 = 4102638;
t159 = (x645!=((x646%x647)|x648));
if (t159 != 1) { NG(); } else { ; }
}
void f160(void) {
uint32_t x649 = UINT32_MAX;
uint8_t x650 = UINT8_MAX;
int16_t x651 = -28;
int8_t x652 = 6;
volatile int32_t t160 = -2213;
t160 = (x649!=((x650%x651)|x652));
if (t160 != 1) { NG(); } else { ; }
}
void f161(void) {
int16_t x653 = INT16_MIN;
static volatile int8_t x654 = INT8_MIN;
int64_t x655 = INT64_MIN;
uint16_t x656 = 14798U;
int32_t t161 = -5;
t161 = (x653!=((x654%x655)|x656));
if (t161 != 1) { NG(); } else { ; }
}
void f162(void) {
volatile uint8_t x657 = 77U;
int16_t x658 = INT16_MIN;
t162 = (x657!=((x658%x659)|x660));
if (t162 != 1) { NG(); } else { ; }
}
void f163(void) {
static int64_t x661 = INT64_MIN;
int32_t x662 = INT32_MIN;
static int8_t x663 = INT8_MIN;
uint64_t x664 = UINT64_MAX;
volatile int32_t t163 = 445550;
t163 = (x661!=((x662%x663)|x664));
if (t163 != 1) { NG(); } else { ; }
}
void f164(void) {
int8_t x665 = INT8_MIN;
int32_t x666 = -1015;
static int64_t x667 = 1369115947020LL;
int64_t x668 = INT64_MIN;
int32_t t164 = 92392373;
t164 = (x665!=((x666%x667)|x668));
if (t164 != 1) { NG(); } else { ; }
}
void f165(void) {
volatile uint64_t x670 = 513758LLU;
uint64_t x671 = UINT64_MAX;
static volatile int8_t x672 = INT8_MIN;
t165 = (x669!=((x670%x671)|x672));
if (t165 != 1) { NG(); } else { ; }
}
void f166(void) {
int8_t x673 = INT8_MIN;
volatile uint8_t x674 = UINT8_MAX;
static int64_t x675 = 117087LL;
uint8_t x676 = UINT8_MAX;
volatile int32_t t166 = 2776433;
t166 = (x673!=((x674%x675)|x676));
if (t166 != 1) { NG(); } else { ; }
}
void f167(void) {
uint8_t x678 = 1U;
uint64_t x679 = UINT64_MAX;
volatile int32_t t167 = 31335745;
t167 = (x677!=((x678%x679)|x680));
if (t167 != 1) { NG(); } else { ; }
}
void f168(void) {
uint16_t x681 = UINT16_MAX;
int64_t x683 = -1LL;
int8_t x684 = INT8_MAX;
volatile int32_t t168 = 66;
t168 = (x681!=((x682%x683)|x684));
if (t168 != 1) { NG(); } else { ; }
}
void f169(void) {
volatile uint64_t x685 = 86339LLU;
int64_t x686 = INT64_MIN;
int16_t x687 = 8366;
uint8_t x688 = 113U;
volatile int32_t t169 = -2;
t169 = (x685!=((x686%x687)|x688));
if (t169 != 1) { NG(); } else { ; }
}
void f170(void) {
uint8_t x689 = 30U;
int16_t x690 = INT16_MIN;
int16_t x691 = -1;
uint16_t x692 = 19210U;
int32_t t170 = -188;
t170 = (x689!=((x690%x691)|x692));
if (t170 != 1) { NG(); } else { ; }
}
void f171(void) {
static uint64_t x693 = UINT64_MAX;
int8_t x694 = INT8_MAX;
int8_t x695 = INT8_MAX;
t171 = (x693!=((x694%x695)|x696));
if (t171 != 1) { NG(); } else { ; }
}
void f172(void) {
static int64_t x697 = -1LL;
volatile int32_t x698 = -1;
int16_t x699 = INT16_MAX;
volatile int32_t t172 = -27770082;
t172 = (x697!=((x698%x699)|x700));
if (t172 != 0) { NG(); } else { ; }
}
void f173(void) {
int8_t x701 = -1;
uint16_t x702 = 2620U;
int32_t x704 = 101;
volatile int32_t t173 = 3444299;
t173 = (x701!=((x702%x703)|x704));
if (t173 != 1) { NG(); } else { ; }
}
void f174(void) {
volatile int8_t x706 = -1;
int64_t x707 = INT64_MAX;
int8_t x708 = INT8_MIN;
t174 = (x705!=((x706%x707)|x708));
if (t174 != 1) { NG(); } else { ; }
}
void f175(void) {
volatile uint16_t x709 = 32013U;
uint64_t x711 = 646300919703LLU;
static uint8_t x712 = 0U;
int32_t t175 = 8612;
t175 = (x709!=((x710%x711)|x712));
if (t175 != 1) { NG(); } else { ; }
}
void f176(void) {
int8_t x714 = 56;
static int16_t x715 = -1;
uint64_t x716 = UINT64_MAX;
static volatile int32_t t176 = -845065;
t176 = (x713!=((x714%x715)|x716));
if (t176 != 1) { NG(); } else { ; }
}
void f177(void) {
static int16_t x717 = INT16_MIN;
static volatile int8_t x718 = INT8_MIN;
uint8_t x719 = 21U;
int64_t x720 = 2259249181007534960LL;
int32_t t177 = 300;
t177 = (x717!=((x718%x719)|x720));
if (t177 != 1) { NG(); } else { ; }
}
void f178(void) {
uint16_t x722 = 1889U;
int16_t x724 = 8;
volatile int32_t t178 = -3367744;
t178 = (x721!=((x722%x723)|x724));
if (t178 != 1) { NG(); } else { ; }
}
void f179(void) {
int8_t x725 = INT8_MIN;
int32_t x726 = -3;
volatile int16_t x727 = -1;
uint8_t x728 = 0U;
t179 = (x725!=((x726%x727)|x728));
if (t179 != 1) { NG(); } else { ; }
}
void f180(void) {
int8_t x729 = INT8_MIN;
int64_t x730 = -1LL;
uint32_t x731 = 1346U;
int8_t x732 = INT8_MIN;
static volatile int32_t t180 = 97512;
t180 = (x729!=((x730%x731)|x732));
if (t180 != 1) { NG(); } else { ; }
}
void f181(void) {
static int64_t x733 = -1LL;
static uint64_t x734 = 354128192827178LLU;
static int16_t x735 = INT16_MIN;
static volatile int32_t t181 = -204;
t181 = (x733!=((x734%x735)|x736));
if (t181 != 1) { NG(); } else { ; }
}
void f182(void) {
volatile uint8_t x737 = 55U;
int8_t x738 = INT8_MIN;
int16_t x739 = -117;
volatile int32_t t182 = 9;
t182 = (x737!=((x738%x739)|x740));
if (t182 != 1) { NG(); } else { ; }
}
void f183(void) {
volatile uint8_t x741 = UINT8_MAX;
volatile uint8_t x743 = UINT8_MAX;
int64_t x744 = INT64_MIN;
int32_t t183 = 23898328;
t183 = (x741!=((x742%x743)|x744));
if (t183 != 1) { NG(); } else { ; }
}
void f184(void) {
static volatile int8_t x750 = -1;
int8_t x751 = INT8_MAX;
uint16_t x752 = 31U;
static int32_t t184 = 135849;
t184 = (x749!=((x750%x751)|x752));
if (t184 != 1) { NG(); } else { ; }
}
void f185(void) {
static volatile int64_t x753 = INT64_MAX;
int32_t x755 = INT32_MIN;
static int16_t x756 = -1;
volatile int32_t t185 = -37699206;
t185 = (x753!=((x754%x755)|x756));
if (t185 != 1) { NG(); } else { ; }
}
void f186(void) {
uint32_t x757 = 0U;
int64_t x759 = -58037226843560579LL;
volatile int64_t x760 = -31947773LL;
static volatile int32_t t186 = 878;
t186 = (x757!=((x758%x759)|x760));
if (t186 != 1) { NG(); } else { ; }
}
void f187(void) {
int32_t x761 = INT32_MIN;
static uint32_t x762 = 44630767U;
uint32_t x763 = 182563U;
uint64_t x764 = 4325110493811822LLU;
t187 = (x761!=((x762%x763)|x764));
if (t187 != 1) { NG(); } else { ; }
}
void f188(void) {
static int32_t x765 = 2751;
int64_t x766 = -1LL;
int8_t x767 = INT8_MIN;
uint8_t x768 = 113U;
volatile int32_t t188 = 7;
t188 = (x765!=((x766%x767)|x768));
if (t188 != 1) { NG(); } else { ; }
}
void f189(void) {
uint64_t x769 = UINT64_MAX;
static uint16_t x771 = 35U;
volatile uint32_t x772 = UINT32_MAX;
volatile int32_t t189 = -395653550;
t189 = (x769!=((x770%x771)|x772));
if (t189 != 1) { NG(); } else { ; }
}
void f190(void) {
int8_t x777 = INT8_MIN;
int8_t x778 = -1;
uint8_t x779 = UINT8_MAX;
int32_t x780 = INT32_MAX;
t190 = (x777!=((x778%x779)|x780));
if (t190 != 1) { NG(); } else { ; }
}
void f191(void) {
int16_t x781 = -1;
int32_t x782 = -1;
static int16_t x783 = 1530;
volatile int64_t x784 = 622079475945735269LL;
static int32_t t191 = -4254765;
t191 = (x781!=((x782%x783)|x784));
if (t191 != 0) { NG(); } else { ; }
}
void f192(void) {
int32_t x785 = INT32_MAX;
int64_t x786 = INT64_MAX;
uint16_t x787 = 527U;
uint16_t x788 = 112U;
t192 = (x785!=((x786%x787)|x788));
if (t192 != 1) { NG(); } else { ; }
}
void f193(void) {
int32_t x790 = INT32_MIN;
volatile uint32_t x792 = 59U;
volatile int32_t t193 = -7;
t193 = (x789!=((x790%x791)|x792));
if (t193 != 1) { NG(); } else { ; }
}
void f194(void) {
int64_t x793 = -1LL;
static int8_t x795 = INT8_MIN;
int32_t x796 = INT32_MIN;
t194 = (x793!=((x794%x795)|x796));
if (t194 != 1) { NG(); } else { ; }
}
void f195(void) {
volatile int16_t x797 = INT16_MIN;
int64_t x799 = INT64_MAX;
volatile int16_t x800 = 193;
volatile int32_t t195 = -6954;
t195 = (x797!=((x798%x799)|x800));
if (t195 != 1) { NG(); } else { ; }
}
void f196(void) {
uint16_t x801 = 9U;
int16_t x802 = 12;
volatile int16_t x804 = 0;
volatile int32_t t196 = -4610;
t196 = (x801!=((x802%x803)|x804));
if (t196 != 1) { NG(); } else { ; }
}
void f197(void) {
int16_t x805 = -942;
volatile int32_t x806 = 1932;
int32_t x807 = -1;
volatile int32_t t197 = 414841;
t197 = (x805!=((x806%x807)|x808));
if (t197 != 1) { NG(); } else { ; }
}
void f198(void) {
int32_t x809 = 2;
static volatile uint8_t x810 = UINT8_MAX;
uint32_t x811 = UINT32_MAX;
int64_t x812 = -1LL;
volatile int32_t t198 = 96619226;
t198 = (x809!=((x810%x811)|x812));
if (t198 != 1) { NG(); } else { ; }
}
void f199(void) {
uint64_t x813 = 13LLU;
uint64_t x814 = 208682787336318934LLU;
int16_t x815 = INT16_MAX;
int8_t x816 = -1;
static int32_t t199 = 22919680;
t199 = (x813!=((x814%x815)|x816));
if (t199 != 1) { NG(); } else { ; }
}
int main(void) {
f0();
f1();
f2();
f3();
f4();
f5();
f6();
f7();
f8();
f9();
f10();
f11();
f12();
f13();
f14();
f15();
f16();
f17();
f18();
f19();
f20();
f21();
f22();
f23();
f24();
f25();
f26();
f27();
f28();
f29();
f30();
f31();
f32();
f33();
f34();
f35();
f36();
f37();
f38();
f39();
f40();
f41();
f42();
f43();
f44();
f45();
f46();
f47();
f48();
f49();
f50();
f51();
f52();
f53();
f54();
f55();
f56();
f57();
f58();
f59();
f60();
f61();
f62();
f63();
f64();
f65();
f66();
f67();
f68();
f69();
f70();
f71();
f72();
f73();
f74();
f75();
f76();
f77();
f78();
f79();
f80();
f81();
f82();
f83();
f84();
f85();
f86();
f87();
f88();
f89();
f90();
f91();
f92();
f93();
f94();
f95();
f96();
f97();
f98();
f99();
f100();
f101();
f102();
f103();
f104();
f105();
f106();
f107();
f108();
f109();
f110();
f111();
f112();
f113();
f114();
f115();
f116();
f117();
f118();
f119();
f120();
f121();
f122();
f123();
f124();
f125();
f126();
f127();
f128();
f129();
f130();
f131();
f132();
f133();
f134();
f135();
f136();
f137();
f138();
f139();
f140();
f141();
f142();
f143();
f144();
f145();
f146();
f147();
f148();
f149();
f150();
f151();
f152();
f153();
f154();
f155();
f156();
f157();
f158();
f159();
f160();
f161();
f162();
f163();
f164();
f165();
f166();
f167();
f168();
f169();
f170();
f171();
f172();
f173();
f174();
f175();
f176();
f177();
f178();
f179();
f180();
f181();
f182();
f183();
f184();
f185();
f186();
f187();
f188();
f189();
f190();
f191();
f192();
f193();
f194();
f195();
f196();
f197();
f198();
f199();
return 0;
}
| 18.180949 | 54 | 0.576242 |
a829286dffaed2822cb4dee091acb86127d68eda | 2,603 | h | C | src/rocksdb2/include/rocksdb/iterator.h | yinchengtsinghua/RippleCPPChinese | a32a38a374547bdc5eb0fddcd657f45048aaad6a | [
"BSL-1.0"
] | 5 | 2019-01-23T04:36:03.000Z | 2020-02-04T07:10:39.000Z | src/rocksdb2/include/rocksdb/iterator.h | yinchengtsinghua/RippleCPPChinese | a32a38a374547bdc5eb0fddcd657f45048aaad6a | [
"BSL-1.0"
] | null | null | null | src/rocksdb2/include/rocksdb/iterator.h | yinchengtsinghua/RippleCPPChinese | a32a38a374547bdc5eb0fddcd657f45048aaad6a | [
"BSL-1.0"
] | 2 | 2019-05-14T07:26:59.000Z | 2020-06-15T07:25:01.000Z |
//此源码被清华学神尹成大魔王专业翻译分析并修改
//尹成QQ77025077
//尹成微信18510341407
//尹成所在QQ群721929980
//尹成邮箱 yinc13@mails.tsinghua.edu.cn
//尹成毕业于清华大学,微软区块链领域全球最有价值专家
//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
//版权所有(c)2011至今,Facebook,Inc.保留所有权利。
//此源代码在两个gplv2下都获得了许可(在
//复制根目录中的文件)和Apache2.0许可证
//(在根目录的license.apache文件中找到)。
//版权所有(c)2011 LevelDB作者。版权所有。
//此源代码的使用受可以
//在许可证文件中找到。有关参与者的名称,请参阅作者文件。
//
//迭代器从源中生成一个键/值对序列。
//下面的类定义接口。多个实现
//由本图书馆提供。特别是,提供了迭代器
//访问表或数据库的内容。
//
//多个线程可以在迭代器上调用const方法,而不需要
//外部同步,但如果任何线程可以调用
//非常量方法,访问同一迭代器的所有线程都必须使用
//外部同步。
#ifndef STORAGE_ROCKSDB_INCLUDE_ITERATOR_H_
#define STORAGE_ROCKSDB_INCLUDE_ITERATOR_H_
#include <string>
#include "rocksdb/cleanable.h"
#include "rocksdb/slice.h"
#include "rocksdb/status.h"
namespace rocksdb {
class Iterator : public Cleanable {
public:
Iterator() {}
virtual ~Iterator() {}
//迭代器要么定位在键/值对上,要么
//无效。如果迭代器有效,则此方法返回true。
virtual bool Valid() const = 0;
//在震源中的第一个键处定位。迭代器有效()
//调用iff后,源不为空。
virtual void SeekToFirst() = 0;
//定位在源中的最后一个键。迭代器是
//在此调用之后,如果源不是空的,则返回valid()。
virtual void SeekToLast() = 0;
//在源中的第一个键处定位,该键位于或超过目标
//在调用源包含的iff之后,迭代器是有效的()。
//到达或超过目标的条目。
virtual void Seek(const Slice& target) = 0;
//在源中最后一个键的位置
//在调用源包含的iff之后,迭代器是有效的()。
//到达目标或在目标之前的条目。
virtual void SeekForPrev(const Slice& target) {}
//移动到源中的下一个条目。在此调用之后,valid()是
//如果迭代器未定位在源中的最后一个条目,则返回true。
//要求:有效()
virtual void Next() = 0;
//移动到源中的上一个条目。在此调用之后,valid()是
//如果迭代器未定位在源中的第一个条目,则返回true。
//要求:有效()
virtual void Prev() = 0;
//返回当前条目的键。的基础存储
//返回的切片仅在下一次修改
//迭代器。
//要求:有效()
virtual Slice key() const = 0;
//返回当前条目的值。的基础存储
//返回的切片仅在下一次修改
//迭代器。
//要求:!()启动()
virtual Slice value() const = 0;
//如果发生错误,请返回。否则返回OK状态。
//如果请求非阻塞IO,而此操作不能
//如果不做一些IO就满意了,那么这将返回status::incomplete()。
virtual Status status() const = 0;
//如果支持,请更新迭代器以表示最新状态。这个
//迭代器将在调用后失效。不支持如果
//创建迭代器时提供readoptions.snapshot。
virtual Status Refresh() {
return Status::NotSupported("Refresh() is not supported");
}
//属性“rocksdb.iterator.is key pinned”:
//如果返回“1”,则表示key()返回的切片有效。
//只要迭代器没有被删除。
//如果
//-使用readoptions::pin_data=true创建的迭代器
//-数据库表是用创建的
//blockBasedTableOptions::使用_delta_encoding=false。
//属性“rocksdb.iterator.super version number”:
//迭代器使用的LSM版本。与db属性的格式相同
//kCurrentSuperVersionNumber(当前超版本号)。有关详细信息,请参阅其注释。
virtual Status GetProperty(std::string prop_name, std::string* prop);
private:
//不允许复制
Iterator(const Iterator&);
void operator=(const Iterator&);
};
//返回一个空的迭代器(不产生任何结果)。
extern Iterator* NewEmptyIterator();
//返回具有指定状态的空迭代器。
extern Iterator* NewErrorIterator(const Status& status);
} //命名空间rocksdb
#endif //存储块包括迭代器
| 20.824 | 71 | 0.741452 |
a866dd76e5248e81238f809954ea923fb432520c | 1,417 | c | C | expect/generic/exp_main_exp.c | crazy-max/expect-nt | 63986978ccd301f996bf0bbab4ae4e1e372e7a62 | [
"TCL"
] | 5 | 2019-06-22T08:11:47.000Z | 2022-03-10T13:11:07.000Z | expect/generic/exp_main_exp.c | crazy-max/expect-nt | 63986978ccd301f996bf0bbab4ae4e1e372e7a62 | [
"TCL"
] | null | null | null | expect/generic/exp_main_exp.c | crazy-max/expect-nt | 63986978ccd301f996bf0bbab4ae4e1e372e7a62 | [
"TCL"
] | 3 | 2019-06-22T08:11:48.000Z | 2022-03-10T13:11:08.000Z | /* main.c - main() and some logging routines for expect
Written by: Don Libes, NIST, 2/6/90
Design and implementation of this program was paid for by U.S. tax
dollars. Therefore it is public domain. However, the author and NIST
would appreciate credit if this program or parts of it are used.
*/
#ifdef __WIN32__
/*
* We are going to import a couple of data elements from expect52.dll
* We need this defined here so that we import the data properly.
*/
#define EXPECTIMP __declspec(dllimport)
#else
#define EXPECTIMP
#endif
#include "exp_port.h"
#include <stdio.h>
#include <stdlib.h>
#include "tcl.h"
#include "expect_tcl.h"
int
main(argc, argv)
int argc;
char *argv[];
{
int rc = 0;
Tcl_Interp *interp = Tcl_CreateInterp();
if (Tcl_Init(interp) == TCL_ERROR) {
fprintf(stderr,"Tcl_Init failed: %s\n",interp->result);
exit(1);
}
if (Expect_Init(interp) == TCL_ERROR) {
fprintf(stderr,"Expect_Init failed: %s\n",interp->result);
exit(1);
}
exp_parse_argv(interp,argc,argv);
/* become interactive if requested or "nothing to do" */
if (exp_interactive)
(void) exp_interpreter(interp);
else if (exp_cmdfile)
rc = exp_interpret_cmdfile(interp,exp_cmdfile);
else if (exp_cmdfilename)
rc = exp_interpret_cmdfilename(interp,exp_cmdfilename);
/* assert(exp_cmdlinecmds != 0) */
exp_exit(interp,rc);
/*NOTREACHED*/
return 0; /* Needed only to prevent compiler warning. */
}
| 23.229508 | 70 | 0.716302 |
dc91be4f93de18e34903a16a0764f10201ae8040 | 847 | c | C | sampleApp/onlyEpicsSrc/esample2.c | epics-modules/gtest | b09686557ffc72deb274b64a520038e8ce0d11f7 | [
"BSD-3-Clause",
"MIT"
] | 3 | 2020-06-23T17:12:21.000Z | 2021-09-07T11:23:41.000Z | sampleApp/mixdGtestEpicsSrc/esample2.c | epics-modules/gtest | b09686557ffc72deb274b64a520038e8ce0d11f7 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2020-08-04T16:20:07.000Z | 2020-08-05T21:43:07.000Z | sampleApp/mixdGtestEpicsSrc/esample2.c | epics-modules/gtest | b09686557ffc72deb274b64a520038e8ce0d11f7 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2020-04-16T10:48:23.000Z | 2020-04-16T10:48:23.000Z | /*************************************************************************\
* Copyright (c) 2020 ITER Organization.
* This module is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author: Ralph Lange <ralph.lange@gmx.de>
*/
/* Simple integer tests */
#include <epicsUnitTest.h>
#include <testMain.h>
const int valRight = 5;
const int valWrong = 3;
const short valAlsoWrong = 2;
const int expected = 5;
MAIN(integerCompareTest)
{
testPlan(3);
testOk((expected == valRight), "expected equals valRight");
testOk((expected != valWrong), "expected does not equal valWrong");
testOk((expected != valAlsoWrong), "expected does not equal valAlsoWrong");
return testDone();
}
| 28.233333 | 79 | 0.585596 |
defbdf41255bb317c8077f5f3433bf66710aab7a | 1,627 | h | C | apiwzem/RootWzem.h | mpsitech/wzem-WhizniumSBE-Engine-Monitor | 0d9a204660bfad57f25dbd641fd86713986f32f1 | [
"MIT"
] | null | null | null | apiwzem/RootWzem.h | mpsitech/wzem-WhizniumSBE-Engine-Monitor | 0d9a204660bfad57f25dbd641fd86713986f32f1 | [
"MIT"
] | null | null | null | apiwzem/RootWzem.h | mpsitech/wzem-WhizniumSBE-Engine-Monitor | 0d9a204660bfad57f25dbd641fd86713986f32f1 | [
"MIT"
] | null | null | null | /**
* \file RootWzem.h
* API code for job RootWzem (declarations)
* \copyright (C) 2016-2020 MPSI Technologies GmbH
* \author Alexander Wirthmueller (auto-generation)
* \date created: 6 Dec 2020
*/
// IP header --- ABOVE
#ifndef ROOTWZEM_H
#define ROOTWZEM_H
#include "ApiWzem_blks.h"
#define DpchAppRootWzemLogin RootWzem::DpchAppLogin
#define DpchEngRootWzemData RootWzem::DpchEngData
/**
* RootWzem
*/
namespace RootWzem {
/**
* DpchAppLogin (full: DpchAppRootWzemLogin)
*/
class DpchAppLogin : public DpchAppWzem {
public:
static const Sbecore::uint SCRJREF = 1;
static const Sbecore::uint USERNAME = 2;
static const Sbecore::uint PASSWORD = 3;
static const Sbecore::uint M2MNOTREG = 4;
static const Sbecore::uint CHKSUSPSESS = 5;
static const Sbecore::uint ALL = 6;
public:
DpchAppLogin(const std::string& scrJref = "", const std::string& username = "", const std::string& password = "", const bool m2mNotReg = false, const bool chksuspsess = false, const std::set<Sbecore::uint>& mask = {NONE});
public:
std::string username;
std::string password;
bool m2mNotReg;
bool chksuspsess;
public:
std::string getSrefsMask();
void writeXML(xmlTextWriter* wr);
};
/**
* DpchEngData (full: DpchEngRootWzemData)
*/
class DpchEngData : public DpchEngWzem {
public:
static const Sbecore::uint SCRJREF = 1;
static const Sbecore::uint FEEDFENSSPS = 2;
public:
DpchEngData();
public:
Sbecore::Feed feedFEnsSps;
public:
std::string getSrefsMask();
void readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false);
};
};
#endif
| 21.986486 | 224 | 0.706822 |
8973a0900b245b60b786e00dc8550d7e90278257 | 134 | h | C | trabalho4/lista4/lista4.07/sets_ab.h | wilsoncalisto/exercicios_em_c | 847095128275d9f8185b64446abbff4fb8802e42 | [
"MIT"
] | null | null | null | trabalho4/lista4/lista4.07/sets_ab.h | wilsoncalisto/exercicios_em_c | 847095128275d9f8185b64446abbff4fb8802e42 | [
"MIT"
] | null | null | null | trabalho4/lista4/lista4.07/sets_ab.h | wilsoncalisto/exercicios_em_c | 847095128275d9f8185b64446abbff4fb8802e42 | [
"MIT"
] | null | null | null | int *set_a(int n);
int *set_b(int m);
int a_contains_b(int *a, int n, int *b, int m);
int ab_equals_ba(int *a, int n, int *b, int m);
| 26.8 | 47 | 0.641791 |
8e48ab40d1055ef7cfba723b9533e3e6b73f4f27 | 4,052 | c | C | src/rtlib/dev_file_encod_open.c | ktan2020/fbc | 6cd5f799593875c7212ce3109bdf7e759fb95524 | [
"MIT"
] | 1 | 2021-01-23T04:11:09.000Z | 2021-01-23T04:11:09.000Z | src/rtlib/dev_file_encod_open.c | ktan2020/fbc | 6cd5f799593875c7212ce3109bdf7e759fb95524 | [
"MIT"
] | null | null | null | src/rtlib/dev_file_encod_open.c | ktan2020/fbc | 6cd5f799593875c7212ce3109bdf7e759fb95524 | [
"MIT"
] | null | null | null | /* UTF-encoded file devices open */
#include "fb.h"
static FB_FILE_HOOKS hooks_dev_file = {
fb_DevFileEof,
fb_DevFileClose,
fb_DevFileSeek,
fb_DevFileTell,
fb_DevFileReadEncod,
fb_DevFileReadEncodWstr,
fb_DevFileWriteEncod,
fb_DevFileWriteEncodWstr,
fb_DevFileLock,
fb_DevFileUnlock,
fb_DevFileReadLineEncod,
fb_DevFileReadLineEncodWstr,
NULL,
fb_DevFileFlush
};
static int hCheckBOM( FB_FILE *handle )
{
int res, bom = 0;
FILE *fp = (FILE *)handle->opaque;
if( handle->mode == FB_FILE_MODE_APPEND )
fseek( fp, 0, SEEK_SET );
switch( handle->encod )
{
case FB_FILE_ENCOD_UTF8:
if( fread( &bom, 3, 1, fp ) != 1 )
return 0;
res = (bom == 0x00BFBBEF);
break;
case FB_FILE_ENCOD_UTF16:
if( fread( &bom, sizeof( UTF_16 ), 1, fp ) != 1 )
return 0;
/* !!!FIXME!!! only litle-endian supported */
res = (bom == 0x0000FEFF);
break;
case FB_FILE_ENCOD_UTF32:
if( fread( &bom, sizeof( UTF_32 ), 1, fp ) != 1 )
return 0;
/* !!!FIXME!!! only litle-endian supported */
res = (bom == 0x0000FEFF);
break;
default:
res = 0;
}
if( handle->mode == FB_FILE_MODE_APPEND )
fseek( fp, 0, SEEK_END );
return res;
}
static int hWriteBOM( FB_FILE *handle )
{
int bom;
FILE *fp = (FILE *)handle->opaque;
switch( handle->encod )
{
case FB_FILE_ENCOD_UTF8:
bom = 0x00BFBBEF;
if( fwrite( &bom, 3, 1, fp ) != 1 )
return 0;
break;
case FB_FILE_ENCOD_UTF16:
/* !!!FIXME!!! only litle-endian supported */
bom = 0x0000FEFF;
if( fwrite( &bom, sizeof( UTF_16 ), 1, fp ) != 1 )
return 0;
break;
case FB_FILE_ENCOD_UTF32:
/* !!!FIXME!!! only litle-endian supported */
bom = 0x0000FEFF;
if( fwrite( &bom, sizeof( UTF_32 ), 1, fp ) != 1 )
return 0;
break;
default:
return 0;
}
return 1;
}
int fb_DevFileOpenEncod
(
FB_FILE *handle,
const char *filename,
size_t fname_len
)
{
FILE *fp = NULL;
char *openmask;
char *fname;
FB_LOCK();
fname = (char*) alloca(fname_len + 1);
memcpy(fname, filename, fname_len);
fname[fname_len] = 0;
/* Convert directory separators to whatever the current platform supports */
fb_hConvertPath( fname );
handle->hooks = &hooks_dev_file;
openmask = NULL;
switch( handle->mode )
{
case FB_FILE_MODE_APPEND:
/* will create the file if it doesn't exist */
openmask = "ab";
break;
case FB_FILE_MODE_INPUT:
/* will fail if file doesn't exist */
openmask = "rb";
break;
case FB_FILE_MODE_OUTPUT:
/* will create the file if it doesn't exist */
openmask = "wb";
break;
default:
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_ILLEGALFUNCTIONCALL );
}
/* try opening */
if( (fp = fopen( fname, openmask )) == NULL )
{
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_FILENOTFOUND );
}
fb_hSetFileBufSize( fp );
handle->opaque = fp;
if ( handle->access == FB_FILE_ACCESS_ANY)
handle->access = FB_FILE_ACCESS_READWRITE;
/* handle BOM */
switch( handle->mode )
{
case FB_FILE_MODE_APPEND:
case FB_FILE_MODE_INPUT:
if( !hCheckBOM( handle ) )
{
fclose( fp );
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_FILENOTFOUND );
}
break;
case FB_FILE_MODE_OUTPUT:
if( !hWriteBOM( handle ) )
{
fclose( fp );
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_FILENOTFOUND );
}
}
/* calc file size */
handle->size = fb_DevFileGetSize( fp, handle->mode, handle->encod, TRUE );
if( handle->size == -1 )
{
fclose( fp );
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_ILLEGALFUNCTIONCALL );
}
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_OK );
}
| 20.779487 | 80 | 0.580948 |
8e71eb3408a69e8365acc33f10ebfb725dd1bbfd | 1,126 | h | C | PrivateFrameworks/OfficeImport.framework/PBSlideBase.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 36 | 2016-04-20T04:19:04.000Z | 2018-10-08T04:12:25.000Z | PrivateFrameworks/OfficeImport.framework/PBSlideBase.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | null | null | null | PrivateFrameworks/OfficeImport.framework/PBSlideBase.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 10 | 2016-06-16T02:40:44.000Z | 2019-01-15T03:31:45.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport
*/
@interface PBSlideBase : NSObject
+ (unsigned long long)authorIdForName:(id)arg1 state:(id)arg2;
+ (unsigned char)mapDirection:(id)arg1;
+ (void)mapSlideNumberPlaceholder:(id)arg1 tgtSlideBase:(id)arg2 state:(id)arg3;
+ (id)newOptions:(long long)arg1 transType:(int)arg2;
+ (id)nonPlaceholderDrawablesAmongDrawables:(id)arg1;
+ (void)parseSlideShowInfo:(struct PptSSSlideInfoAtom { int (**x1)(); unsigned short x2; struct EshHeader { int x_3_1_1; unsigned int x_3_1_2; short x_3_1_3; unsigned short x_3_1_4; unsigned char x_3_1_5; } x3; int (**x4)(); int x5; bool x6; int x7; int x8; unsigned char x9; int x10; unsigned short x11; int x12; }*)arg1 slideBase:(id)arg2 state:(id)arg3;
+ (int)parseTransType:(int)arg1 direction:(long long)arg2;
+ (bool)readColorScheme:(id)arg1 colorScheme:(id)arg2 colorMap:(id)arg3 state:(id)arg4;
+ (void)readComments:(id)arg1 slide:(id)arg2 state:(id)arg3;
+ (void)readDrawingGroup:(id)arg1 slide:(id)arg2 state:(id)arg3;
+ (bool)slideFollowsMasterBackground:(id)arg1;
@end
| 56.3 | 356 | 0.757549 |
c247438ed9e219151300680ad0106a18d9313746 | 460 | h | C | 081226_camera_param_PF/UniformGen.h | ntthuy11/CameraParameterTrackingUsingParticleFilter | b707101ae69b0da6be17811d44cd4d3727dcf0b1 | [
"MIT"
] | 1 | 2020-03-21T21:39:46.000Z | 2020-03-21T21:39:46.000Z | 080611_track_using_hough/UniformGen.h | ntthuy11/RectangularObjectTrackingBasedOnHoughTransform | 6312eb23bfc6822a673311f44cbfe86ae1735963 | [
"MIT"
] | null | null | null | 080611_track_using_hough/UniformGen.h | ntthuy11/RectangularObjectTrackingBasedOnHoughTransform | 6312eb23bfc6822a673311f44cbfe86ae1735963 | [
"MIT"
] | null | null | null | #pragma once
class CUniformGen
{
public:
double r_seed;
public:
CUniformGen(double seed=1.0);
virtual ~CUniformGen(void);
void setSeed(double seed);
double rnd();
};
class CGaussianGen
{
public:
CUniformGen uniGen;
double mean;
double sigma;
double t;
public:
CGaussianGen();
CGaussianGen(double seed, double m, double s);
virtual ~CGaussianGen(void);
void setSeed(double seed, double m, double s);
double rnd();
};
| 16.428571 | 48 | 0.682609 |
3298fc449c831bd85c91e7c3f7b28ee8b1db7df4 | 343 | c | C | HDU/1407/10909366_AC_436ms_1832kB.c | BakaErii/ACM_Collection | d368b15c7f1c84472424d5e61e5ebc667f589025 | [
"WTFPL"
] | null | null | null | HDU/1407/10909366_AC_436ms_1832kB.c | BakaErii/ACM_Collection | d368b15c7f1c84472424d5e61e5ebc667f589025 | [
"WTFPL"
] | null | null | null | HDU/1407/10909366_AC_436ms_1832kB.c | BakaErii/ACM_Collection | d368b15c7f1c84472424d5e61e5ebc667f589025 | [
"WTFPL"
] | null | null | null | #include <stdio.h>
int main(void) {
int x, y, z, num, i, j, k;
while (scanf("%d", &num) != EOF) {
for (x = 1; x < 101; x++)
{
for (y = 1; y < 101; y++)
{
for (z = 1; z < 101; z++) {
if (x * x + y * y + z * z == num)
{
printf("%d %d %d\n", x, y, z );
goto End;
}
}
}
}
End:;
}
return 0;
} | 15.590909 | 38 | 0.361516 |
32bc826e5849128e324675f4928883baa30ddefc | 76,786 | c | C | src/vm.c | blade-lang/blade | 08016ad1319ac13baec4ab68b6a2db716ec4fb87 | [
"MIT"
] | 46 | 2021-07-16T07:49:07.000Z | 2022-03-22T21:15:58.000Z | src/vm.c | blade-lang/blade | 08016ad1319ac13baec4ab68b6a2db716ec4fb87 | [
"MIT"
] | 32 | 2021-08-30T12:24:36.000Z | 2022-03-07T18:08:57.000Z | src/vm.c | blade-lang/blade | 08016ad1319ac13baec4ab68b6a2db716ec4fb87 | [
"MIT"
] | 13 | 2021-08-30T14:29:08.000Z | 2022-03-31T14:20:04.000Z | #include "vm.h"
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "memory.h"
#include "module.h"
#include "native.h"
#include "object.h"
#include "bytes.h"
#include "blade_dict.h"
#include "blade_file.h"
#include "blade_list.h"
#include "blade_string.h"
#include "blade_range.h"
#include "util.h"
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
// for debugging...
#include "debug.h"
#define ERR_CANT_ASSIGN_EMPTY "empty cannot be assigned."
static inline void reset_stack(b_vm *vm) {
vm->stack_top = vm->stack;
vm->frame_count = 0;
vm->open_up_values = NULL;
}
static b_value get_stack_trace(b_vm *vm) {
char *trace = (char *) calloc(1, sizeof(char));
if (trace != NULL) {
for (int i = 0; i < vm->frame_count; i++) {
b_call_frame *frame = &vm->frames[i];
b_obj_func *function = frame->closure->function;
// -1 because the IP is sitting on the next instruction to be executed
size_t instruction = frame->ip - function->blob.code - 1;
int line = function->blob.lines[instruction];
const char *trace_start = " File: %s, Line: %d, In: ";
size_t trace_start_length = snprintf(NULL, 0, trace_start, function->module->file, line);
char *trace_part = (char *) calloc(trace_start_length + 1, sizeof(char));
if (trace_part != NULL) {
sprintf(trace_part, trace_start, function->module->file, line);
trace_part[(int) trace_start_length] = '\0';
}
if (function->name == NULL) {
trace_part = append_strings(
trace_part, i < vm->frame_count - 1 ? "<script>\n" : "<script>");
} else {
trace_part = append_strings(trace_part, function->name->chars);
trace_part = append_strings(trace_part, i < vm->frame_count - 1 ? "()\n" : "()");
}
trace = append_strings(trace, trace_part);
free(trace_part);
}
return OBJ_VAL(take_string(vm, trace, (int) strlen(trace)));
}
return OBJ_VAL(copy_string(vm, "", 0));
}
bool propagate_exception(b_vm *vm) {
b_obj_instance *exception = AS_INSTANCE(peek(vm, 0));
while (vm->frame_count > 0) {
b_call_frame *frame = &vm->frames[vm->frame_count - 1];
for (int i = frame->handlers_count; i > 0; i--) {
b_exception_frame handler = frame->handlers[i - 1];
b_obj_func *function = frame->closure->function;
if (handler.address != 0 && is_instance_of(exception->klass, handler.klass->name->chars)) {
frame->ip = &function->blob.code[handler.address];
return true;
} else if (handler.finally_address != 0) {
push(vm, TRUE_VAL); // continue propagating once the finally block completes
frame->ip = &function->blob.code[handler.finally_address];
return true;
}
}
vm->frame_count--;
}
fflush(stdout); // flush out anything on stdout first
b_value message, trace;
fprintf(stderr, "Unhandled %s: ", exception->klass->name->chars);
if (table_get(&exception->properties, STRING_L_VAL("message", 7), &message)) {
fprintf(stderr, "%s\n", value_to_string(vm, message));
} else {
fprintf(stderr, "\n");
}
if (table_get(&exception->properties, STRING_L_VAL("stacktrace", 10), &trace)) {
fprintf(stderr, " StackTrace:\n%s\n", value_to_string(vm, trace));
}
return false;
}
bool push_exception_handler(b_vm *vm, b_obj_class *type, int address, int finally_address) {
b_call_frame *frame = &vm->frames[vm->frame_count - 1];
if (frame->handlers_count == MAX_EXCEPTION_HANDLERS) {
_runtime_error(vm, "too many nested exception handlers in one function");
return false;
}
frame->handlers[frame->handlers_count].address = address;
frame->handlers[frame->handlers_count].finally_address = finally_address;
frame->handlers[frame->handlers_count].klass = type;
frame->handlers_count++;
return true;
}
bool throw_exception(b_vm *vm, const char *format, ...) {
va_list args;
va_start(args, format);
char *message = NULL;
int length = vasprintf(&message, format, args);
va_end(args);
b_obj_instance *instance = create_exception(vm, take_string(vm, message, length));
push(vm, OBJ_VAL(instance));
b_value stacktrace = get_stack_trace(vm);
table_set(vm, &instance->properties, STRING_L_VAL("stacktrace", 10), stacktrace);
return propagate_exception(vm);
}
static void initialize_exceptions(b_vm *vm, b_obj_module *module) {
b_obj_string *class_name = copy_string(vm, "Exception", 9);
b_obj_class *klass = new_class(vm, class_name);
b_obj_func *function = new_function(vm, module, TYPE_METHOD);
function->arity = 1;
function->is_variadic = false;
// g_loc 0
write_blob(vm, &function->blob, OP_GET_LOCAL, 0);
write_blob(vm, &function->blob, (0 >> 8) & 0xff, 0);
write_blob(vm, &function->blob, 0 & 0xff, 0);
// g_loc 1
write_blob(vm, &function->blob, OP_GET_LOCAL, 0);
write_blob(vm, &function->blob, (1 >> 8) & 0xff, 0);
write_blob(vm, &function->blob, 1 & 0xff, 0);
int message_const = add_constant(vm, &function->blob, OBJ_VAL(copy_string(vm, "message", 7)));
// s_prop 1
write_blob(vm, &function->blob, OP_SET_PROPERTY, 0);
write_blob(vm, &function->blob, (message_const >> 8) & 0xff, 0);
write_blob(vm, &function->blob, message_const & 0xff, 0);
// pop
write_blob(vm, &function->blob, OP_POP, 0);
// g_loc 0
write_blob(vm, &function->blob, OP_GET_LOCAL, 0);
write_blob(vm, &function->blob, (0 >> 8) & 0xff, 0);
write_blob(vm, &function->blob, 0 & 0xff, 0);
// ret
write_blob(vm, &function->blob, OP_RETURN, 0);
push(vm, OBJ_VAL(function));
b_obj_closure *closure = new_closure(vm, function);
pop(vm);
// set class constructor
table_set(vm, &klass->methods, OBJ_VAL(class_name), OBJ_VAL(closure));
klass->initializer = OBJ_VAL(closure);
// set class properties
table_set(vm, &klass->properties, STRING_L_VAL("message", 7), NIL_VAL);
table_set(vm, &klass->properties, STRING_L_VAL("stacktrace", 10), NIL_VAL);
table_set(vm, &vm->globals, OBJ_VAL(class_name), OBJ_VAL(klass));
vm->exception_class = klass;
}
inline b_obj_instance *create_exception(b_vm *vm, b_obj_string *message) {
b_obj_instance *instance = new_instance(vm, vm->exception_class);
push(vm, OBJ_VAL(instance));
table_set(vm, &instance->properties, GC_L_STRING("message", 7), OBJ_VAL(message));
pop(vm);
return instance;
}
void _runtime_error(b_vm *vm, const char *format, ...) {
fflush(stdout); // flush out anything on stdout first
b_call_frame *frame = &vm->frames[vm->frame_count - 1];
b_obj_func *function = frame->closure->function;
size_t instruction = frame->ip - function->blob.code - 1;
int line = function->blob.lines[instruction];
fprintf(stderr, "RuntimeError:\n");
fprintf(stderr, " File: %s, Line: %d\n Message: ", function->module->file, line);
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
fputs("\n", stderr);
if (vm->frame_count > 1) {
fprintf(stderr, "StackTrace:\n");
for (int i = vm->frame_count - 1; i >= 0; i--) {
frame = &vm->frames[i];
function = frame->closure->function;
// -1 because the IP is sitting on the next instruction to be executed
instruction = frame->ip - function->blob.code - 1;
fprintf(stderr, " File: %s, Line: %d, In: ", function->module->file, function->blob.lines[instruction]);
if (function->name == NULL) {
fprintf(stderr, "<script>\n");
} else {
fprintf(stderr, "%s()\n", function->name->chars);
}
}
}
reset_stack(vm);
}
inline void push(b_vm *vm, b_value value) {
*vm->stack_top = value;
vm->stack_top++;
}
inline b_value pop(b_vm *vm) {
vm->stack_top--;
return *vm->stack_top;
}
inline b_value pop_n(b_vm *vm, int n) {
vm->stack_top -= n;
return *vm->stack_top;
}
inline b_value peek(b_vm *vm, int distance) { return vm->stack_top[-1 - distance]; }
static inline void define_native(b_vm *vm, const char *name, b_native_fn function) {
push(vm, OBJ_VAL(copy_string(vm, name, (int) strlen(name))));
push(vm, OBJ_VAL(new_native(vm, function, name)));
table_set(vm, &vm->globals, vm->stack[0], vm->stack[1]);
pop_n(vm, 2);
}
void define_native_method(b_vm *vm, b_table *table, const char *name,
b_native_fn function) {
push(vm, OBJ_VAL(copy_string(vm, name, (int) strlen(name))));
push(vm, OBJ_VAL(new_native(vm, function, name)));
table_set(vm, table, vm->stack[0], vm->stack[1]);
pop_n(vm, 2);
}
static void init_builtin_functions(b_vm *vm) {
DEFINE_NATIVE(abs);
DEFINE_NATIVE(bin);
DEFINE_NATIVE(bytes);
DEFINE_NATIVE(chr);
DEFINE_NATIVE(delprop);
DEFINE_NATIVE(file);
DEFINE_NATIVE(getprop);
DEFINE_NATIVE(hasprop);
DEFINE_NATIVE(hex);
DEFINE_NATIVE(id);
DEFINE_NATIVE(int);
DEFINE_NATIVE(is_bool);
DEFINE_NATIVE(is_callable);
DEFINE_NATIVE(is_class);
DEFINE_NATIVE(is_dict);
DEFINE_NATIVE(is_function);
DEFINE_NATIVE(is_instance);
DEFINE_NATIVE(is_int);
DEFINE_NATIVE(is_list);
DEFINE_NATIVE(is_number);
DEFINE_NATIVE(is_object);
DEFINE_NATIVE(is_string);
DEFINE_NATIVE(is_bytes);
DEFINE_NATIVE(is_file);
DEFINE_NATIVE(is_iterable);
DEFINE_NATIVE(instance_of);
DEFINE_NATIVE(max);
DEFINE_NATIVE(microtime);
DEFINE_NATIVE(min);
DEFINE_NATIVE(oct);
DEFINE_NATIVE(ord);
DEFINE_NATIVE(print);
DEFINE_NATIVE(rand);
DEFINE_NATIVE(setprop);
DEFINE_NATIVE(sum);
DEFINE_NATIVE(time);
DEFINE_NATIVE(to_bool);
DEFINE_NATIVE(to_dict);
DEFINE_NATIVE(to_int);
DEFINE_NATIVE(to_list);
DEFINE_NATIVE(to_number);
DEFINE_NATIVE(to_string);
DEFINE_NATIVE(typeof);
}
static void init_builtin_methods(b_vm *vm) {
#define DEFINE_STRING_METHOD(name) DEFINE_METHOD(string, name)
#define DEFINE_LIST_METHOD(name) DEFINE_METHOD(list, name)
#define DEFINE_DICT_METHOD(name) DEFINE_METHOD(dict, name)
#define DEFINE_FILE_METHOD(name) DEFINE_METHOD(file, name)
#define DEFINE_BYTES_METHOD(name) DEFINE_METHOD(bytes, name)
#define DEFINE_RANGE_METHOD(name) DEFINE_METHOD(range, name)
// string methods
DEFINE_STRING_METHOD(length);
DEFINE_STRING_METHOD(upper);
DEFINE_STRING_METHOD(lower);
DEFINE_STRING_METHOD(is_alpha);
DEFINE_STRING_METHOD(is_alnum);
DEFINE_STRING_METHOD(is_number);
DEFINE_STRING_METHOD(is_lower);
DEFINE_STRING_METHOD(is_upper);
DEFINE_STRING_METHOD(is_space);
DEFINE_STRING_METHOD(trim);
DEFINE_STRING_METHOD(ltrim);
DEFINE_STRING_METHOD(rtrim);
DEFINE_STRING_METHOD(join);
DEFINE_STRING_METHOD(split);
DEFINE_STRING_METHOD(index_of);
DEFINE_STRING_METHOD(starts_with);
DEFINE_STRING_METHOD(ends_with);
DEFINE_STRING_METHOD(count);
DEFINE_STRING_METHOD(to_number);
DEFINE_STRING_METHOD(to_list);
DEFINE_STRING_METHOD(to_bytes);
DEFINE_STRING_METHOD(lpad);
DEFINE_STRING_METHOD(rpad);
DEFINE_STRING_METHOD(match);
DEFINE_STRING_METHOD(matches);
DEFINE_STRING_METHOD(replace);
define_native_method(vm, &vm->methods_string, "@iter", native_method_string__iter__);
define_native_method(vm, &vm->methods_string, "@itern", native_method_string__itern__);
// list methods
DEFINE_LIST_METHOD(length);
DEFINE_LIST_METHOD(append);
DEFINE_LIST_METHOD(clear);
DEFINE_LIST_METHOD(clone);
DEFINE_LIST_METHOD(count);
DEFINE_LIST_METHOD(extend);
DEFINE_LIST_METHOD(index_of);
DEFINE_LIST_METHOD(insert);
DEFINE_LIST_METHOD(pop);
DEFINE_LIST_METHOD(shift);
DEFINE_LIST_METHOD(remove_at);
DEFINE_LIST_METHOD(remove);
DEFINE_LIST_METHOD(reverse);
DEFINE_LIST_METHOD(sort);
DEFINE_LIST_METHOD(contains);
DEFINE_LIST_METHOD(delete);
DEFINE_LIST_METHOD(first);
DEFINE_LIST_METHOD(last);
DEFINE_LIST_METHOD(is_empty);
DEFINE_LIST_METHOD(take);
DEFINE_LIST_METHOD(get);
DEFINE_LIST_METHOD(compact);
DEFINE_LIST_METHOD(unique);
DEFINE_LIST_METHOD(zip);
DEFINE_LIST_METHOD(to_dict);
define_native_method(vm, &vm->methods_list, "@iter", native_method_list__iter__);
define_native_method(vm, &vm->methods_list, "@itern", native_method_list__itern__);
// dictionary methods
DEFINE_DICT_METHOD(length);
DEFINE_DICT_METHOD(add);
DEFINE_DICT_METHOD(set);
DEFINE_DICT_METHOD(clear);
DEFINE_DICT_METHOD(clone);
DEFINE_DICT_METHOD(compact);
DEFINE_DICT_METHOD(contains);
DEFINE_DICT_METHOD(extend);
DEFINE_DICT_METHOD(get);
DEFINE_DICT_METHOD(keys);
DEFINE_DICT_METHOD(values);
DEFINE_DICT_METHOD(remove);
DEFINE_DICT_METHOD(is_empty);
DEFINE_DICT_METHOD(find_key);
DEFINE_DICT_METHOD(to_list);
define_native_method(vm, &vm->methods_dict, "@iter", native_method_dict__iter__);
define_native_method(vm, &vm->methods_dict, "@itern", native_method_dict__itern__);
// file methods
DEFINE_FILE_METHOD(exists);
DEFINE_FILE_METHOD(close);
DEFINE_FILE_METHOD(open);
DEFINE_FILE_METHOD(read);
DEFINE_FILE_METHOD(write);
DEFINE_FILE_METHOD(number);
DEFINE_FILE_METHOD(is_tty);
DEFINE_FILE_METHOD(is_open);
DEFINE_FILE_METHOD(is_closed);
DEFINE_FILE_METHOD(flush);
DEFINE_FILE_METHOD(stats);
DEFINE_FILE_METHOD(symlink);
DEFINE_FILE_METHOD(delete);
DEFINE_FILE_METHOD(rename);
DEFINE_FILE_METHOD(path);
DEFINE_FILE_METHOD(abs_path);
DEFINE_FILE_METHOD(copy);
DEFINE_FILE_METHOD(truncate);
DEFINE_FILE_METHOD(chmod);
DEFINE_FILE_METHOD(set_times);
DEFINE_FILE_METHOD(seek);
DEFINE_FILE_METHOD(tell);
DEFINE_FILE_METHOD(mode);
DEFINE_FILE_METHOD(name);
// bytes
DEFINE_BYTES_METHOD(length);
DEFINE_BYTES_METHOD(append);
DEFINE_BYTES_METHOD(clone);
DEFINE_BYTES_METHOD(extend);
DEFINE_BYTES_METHOD(pop);
DEFINE_BYTES_METHOD(remove);
DEFINE_BYTES_METHOD(reverse);
DEFINE_BYTES_METHOD(first);
DEFINE_BYTES_METHOD(last);
DEFINE_BYTES_METHOD(get);
DEFINE_BYTES_METHOD(is_alpha);
DEFINE_BYTES_METHOD(is_alnum);
DEFINE_BYTES_METHOD(is_number);
DEFINE_BYTES_METHOD(is_lower);
DEFINE_BYTES_METHOD(is_upper);
DEFINE_BYTES_METHOD(is_space);
DEFINE_BYTES_METHOD(to_list);
DEFINE_BYTES_METHOD(to_string);
define_native_method(vm, &vm->methods_bytes, "@iter", native_method_bytes__iter__);
define_native_method(vm, &vm->methods_bytes, "@itern", native_method_bytes__itern__);
// range
DEFINE_RANGE_METHOD(lower);
DEFINE_RANGE_METHOD(upper);
define_native_method(vm, &vm->methods_range, "@iter", native_method_range__iter__);
define_native_method(vm, &vm->methods_range, "@itern", native_method_range__itern__);
#undef DEFINE_STRING_METHOD
#undef DEFINE_LIST_METHOD
#undef DEFINE_DICT_METHOD
#undef DEFINE_FILE_METHOD
#undef DEFINE_BYTES_METHOD
#undef DEFINE_RANGE_METHOD
}
void init_vm(b_vm *vm) {
reset_stack(vm);
vm->compiler = NULL;
vm->objects = NULL;
vm->exception_class = NULL;
vm->bytes_allocated = 0;
vm->gc_protected = 0;
vm->next_gc = DEFAULT_GC_START; // default is 1mb. Can be modified via the -g flag.
vm->is_repl = false;
vm->mark_value = true;
vm->should_debug_stack = false;
vm->should_print_bytecode = false;
vm->gray_count = 0;
vm->gray_capacity = 0;
vm->gray_stack = NULL;
vm->std_args = NULL;
vm->std_args_count = 0;
init_table(&vm->modules);
init_table(&vm->strings);
init_table(&vm->globals);
// object methods tables
init_table(&vm->methods_string);
init_table(&vm->methods_list);
init_table(&vm->methods_dict);
init_table(&vm->methods_file);
init_table(&vm->methods_bytes);
init_table(&vm->methods_range);
init_builtin_functions(vm);
init_builtin_methods(vm);
}
void free_vm(b_vm *vm) {
//@TODO: Fix segfault from enabling this...
// free_objects(vm);
free_table(vm, &vm->strings);
free_table(vm, &vm->globals);
// since object in module can exist in globals
// it must come after
clean_free_table(vm, &vm->modules);
free_table(vm, &vm->methods_string);
free_table(vm, &vm->methods_list);
free_table(vm, &vm->methods_dict);
free_table(vm, &vm->methods_file);
free_table(vm, &vm->methods_bytes);
}
static bool call(b_vm *vm, b_obj_closure *closure, int arg_count) {
// fill empty parameters if not variadic
for (; !closure->function->is_variadic && arg_count < closure->function->arity; arg_count++) {
push(vm, NIL_VAL);
}
// handle variadic arguments...
if (closure->function->is_variadic && arg_count >= closure->function->arity - 1) {
int va_args_start = arg_count - closure->function->arity;
b_obj_list *args_list = new_list(vm);
for (int i = va_args_start; i >= 0; i--) {
write_value_arr(vm, &args_list->items, peek(vm, i));
}
arg_count -= va_args_start;
pop_n(vm, va_args_start + 1);
push(vm, OBJ_VAL(args_list));
}
if (arg_count != closure->function->arity) {
pop_n(vm, arg_count);
if (closure->function->is_variadic) {
return throw_exception(vm, "expected at least %d arguments but got %d",
closure->function->arity - 1, arg_count);
} else {
return throw_exception(vm, "expected %d arguments but got %d",
closure->function->arity, arg_count);
}
}
if (vm->frame_count == FRAMES_MAX) {
pop_n(vm, arg_count);
return throw_exception(vm, "stack overflow");
}
b_call_frame *frame = &vm->frames[vm->frame_count++];
frame->closure = closure;
frame->ip = closure->function->blob.code;
frame->slots = vm->stack_top - arg_count - 1;
return true;
}
static inline bool call_native_method(b_vm *vm, b_obj_native *native, int arg_count) {
if (native->function(vm, arg_count, vm->stack_top - arg_count)) {
CLEAR_GC();
vm->stack_top -= arg_count;
return true;
} else {
CLEAR_GC();
bool overridden = AS_BOOL(vm->stack_top[-arg_count - 1]);
if (!overridden) {
vm->stack_top -= arg_count + 1;
}
return overridden;
}
return true;
}
static bool call_value(b_vm *vm, b_value callee, int arg_count) {
if (IS_OBJ(callee)) {
switch (OBJ_TYPE(callee)) {
case OBJ_BOUND_METHOD: {
b_obj_bound *bound = AS_BOUND(callee);
vm->stack_top[-arg_count - 1] = bound->receiver;
return call(vm, bound->method, arg_count);
}
case OBJ_CLASS: {
b_obj_class *klass = AS_CLASS(callee);
vm->stack_top[-arg_count - 1] = OBJ_VAL(new_instance(vm, klass));
if (!IS_EMPTY(klass->initializer)) {
call(vm, AS_CLOSURE(klass->initializer), arg_count);
} else if (arg_count != 0) {
return throw_exception(vm, "%s constructor expects 0 arguments, %d given",
klass->name->chars, arg_count);
}
return true;
}
case OBJ_CLOSURE: {
return call(vm, AS_CLOSURE(callee), arg_count);
}
case OBJ_NATIVE: {
return call_native_method(vm, AS_NATIVE(callee), arg_count);
}
default: // non callable
break;
}
}
return throw_exception(vm, "only functions and classes can be called");
}
static inline b_func_type get_method_type(b_value method) {
switch (OBJ_TYPE(method)) {
case OBJ_NATIVE: return AS_NATIVE(method)->type;
case OBJ_CLOSURE: return AS_CLOSURE(method)->function->type;
default: return TYPE_FUNCTION;
}
}
inline bool invoke_from_class(b_vm *vm, b_obj_class *klass, b_obj_string *name,
int arg_count) {
b_value method;
if (table_get(&klass->methods, OBJ_VAL(name), &method)) {
if (get_method_type(method) == TYPE_PRIVATE) {
return throw_exception(vm, "cannot call private method '%s' from instance of %s",
name->chars, klass->name->chars);
}
return call_value(vm, method, arg_count);
}
return throw_exception(vm, "undefined method '%s' in %s", name->chars, klass->name->chars);
}
static bool invoke_self(b_vm *vm, b_obj_string *name, int arg_count) {
b_value receiver = peek(vm, arg_count);
b_value value;
if (IS_INSTANCE(receiver)) {
b_obj_instance *instance = AS_INSTANCE(receiver);
if (table_get(&instance->klass->methods, OBJ_VAL(name), &value)) {
return call_value(vm, value, arg_count);
}
if (table_get(&instance->properties, OBJ_VAL(name), &value)) {
vm->stack_top[-arg_count - 1] = value;
return call_value(vm, value, arg_count);
}
} else if (IS_CLASS(receiver)) {
if (table_get(&AS_CLASS(receiver)->methods, OBJ_VAL(name), &value)) {
if (get_method_type(value) == TYPE_STATIC) {
return call_value(vm, value, arg_count);
}
return throw_exception(vm, "cannot call non-static method %s() on non instance", name->chars);
}
}
return throw_exception(vm, "cannot call method %s on object of type %s",
name->chars, value_type(receiver));
}
static bool invoke(b_vm *vm, b_obj_string *name, int arg_count) {
b_value receiver = peek(vm, arg_count);
b_value value;
if (!IS_OBJ(receiver)) {
// @TODO: have methods for non objects as well.
return throw_exception(vm, "non-object %s has no method", value_type(receiver));
} else {
switch (AS_OBJ(receiver)->type) {
case OBJ_MODULE: {
b_obj_module *module = AS_MODULE(receiver);
if (table_get(&module->values, OBJ_VAL(name), &value)) {
if (name->length > 0 && name->chars[0] == '_') {
return throw_exception(vm, "cannot call private module method '%s'", name->chars);
}
return call_value(vm, value, arg_count);
}
return throw_exception(vm, "module %s does not define class or method %s()", module->name, name->chars);
break;
}
case OBJ_CLASS: {
if (table_get(&AS_CLASS(receiver)->methods, OBJ_VAL(name), &value)) {
if (get_method_type(value) == TYPE_PRIVATE) {
return throw_exception(vm, "cannot call private method %s() on %s",
name->chars, AS_CLASS(receiver)->name->chars);
}
return call_value(vm, value, arg_count);
} else if (table_get(&AS_CLASS(receiver)->static_properties, OBJ_VAL(name), &value)) {
return call_value(vm, value, arg_count);
}
return throw_exception(vm, "unknown method %s() in class %s", name->chars, AS_CLASS(receiver)->name->chars);
}
case OBJ_INSTANCE: {
b_obj_instance *instance = AS_INSTANCE(receiver);
if (table_get(&instance->properties, OBJ_VAL(name), &value)) {
vm->stack_top[-arg_count - 1] = value;
return call_value(vm, value, arg_count);
}
return invoke_from_class(vm, instance->klass, name, arg_count);
}
case OBJ_STRING: {
if (table_get(&vm->methods_string, OBJ_VAL(name), &value)) {
return call_native_method(vm, AS_NATIVE(value), arg_count);
}
return throw_exception(vm, "String has no method %s()", name->chars);
}
case OBJ_LIST: {
if (table_get(&vm->methods_list, OBJ_VAL(name), &value)) {
return call_native_method(vm, AS_NATIVE(value), arg_count);
}
return throw_exception(vm, "List has no method %s()", name->chars);
}
case OBJ_RANGE: {
if (table_get(&vm->methods_range, OBJ_VAL(name), &value)) {
return call_native_method(vm, AS_NATIVE(value), arg_count);
}
return throw_exception(vm, "Range has no method %s()", name->chars);
}
case OBJ_DICT: {
if (table_get(&vm->methods_dict, OBJ_VAL(name), &value)) {
return call_native_method(vm, AS_NATIVE(value), arg_count);
}
return throw_exception(vm, "Dict has no method %s()", name->chars);
}
case OBJ_FILE: {
if (table_get(&vm->methods_file, OBJ_VAL(name), &value)) {
return call_native_method(vm, AS_NATIVE(value), arg_count);
}
return throw_exception(vm, "File has no method %s()", name->chars);
}
case OBJ_BYTES: {
if (table_get(&vm->methods_bytes, OBJ_VAL(name), &value)) {
return call_native_method(vm, AS_NATIVE(value), arg_count);
}
return throw_exception(vm, "Bytes has no method %s()", name->chars);
}
default: {
return throw_exception(vm, "cannot call method %s on object of type %s",
name->chars, value_type(receiver));
}
}
}
}
static inline bool bind_method(b_vm *vm, b_obj_class *klass, b_obj_string *name) {
b_value method;
if (table_get(&klass->methods, OBJ_VAL(name), &method)) {
if (get_method_type(method) == TYPE_PRIVATE) {
return throw_exception(vm, "cannot get private property '%s' from instance", name->chars);
}
b_obj_bound *bound = new_bound_method(vm, peek(vm, 0), AS_CLOSURE(method));
pop(vm);
push(vm, OBJ_VAL(bound));
return true;
}
return throw_exception(vm, "undefined property '%s'", name->chars);
}
static b_obj_up_value *capture_up_value(b_vm *vm, b_value *local) {
b_obj_up_value *prev_up_value = NULL;
b_obj_up_value *up_value = vm->open_up_values;
while (up_value != NULL && up_value->location > local) {
prev_up_value = up_value;
up_value = up_value->next;
}
if (up_value != NULL && up_value->location == local)
return up_value;
b_obj_up_value *created_up_value = new_up_value(vm, local);
created_up_value->next = up_value;
if (prev_up_value == NULL) {
vm->open_up_values = created_up_value;
} else {
prev_up_value->next = created_up_value;
}
return created_up_value;
}
static inline void close_up_values(b_vm *vm, const b_value *last) {
while (vm->open_up_values != NULL && vm->open_up_values->location >= last) {
b_obj_up_value *up_value = vm->open_up_values;
up_value->closed = *up_value->location;
up_value->location = &up_value->closed;
vm->open_up_values = up_value->next;
}
}
static inline void define_method(b_vm *vm, b_obj_string *name) {
b_value method = peek(vm, 0);
b_obj_class *klass = AS_CLASS(peek(vm, 1));
table_set(vm, &klass->methods, OBJ_VAL(name), method);
if (get_method_type(method) == TYPE_INITIALIZER) {
klass->initializer = method;
}
pop(vm);
}
static inline void define_property(b_vm *vm, b_obj_string *name, bool is_static) {
b_value property = peek(vm, 0);
b_obj_class *klass = AS_CLASS(peek(vm, 1));
if (!is_static) {
table_set(vm, &klass->properties, OBJ_VAL(name), property);
} else {
table_set(vm, &klass->static_properties, OBJ_VAL(name), property);
}
pop(vm);
}
inline bool is_false(b_value value) {
if (IS_BOOL(value))
return IS_BOOL(value) && !AS_BOOL(value);
if (IS_NIL(value) || IS_EMPTY(value))
return true;
// -1 is the number equivalent of false in Blade
if (IS_NUMBER(value))
return AS_NUMBER(value) < 0;
// Non-empty strings are true, empty strings are false.
if (IS_STRING(value))
return AS_STRING(value)->length < 1;
// Non-empty lists are true, empty lists are false.
if (IS_LIST(value))
return AS_LIST(value)->items.count == 0;
// Non-empty dicts are true, empty dicts are false.
if (IS_DICT(value))
return AS_DICT(value)->names.count == 0;
// All classes are true
// All closures are true
// All bound methods are true
// All functions are in themselves true if you do not account for what they
// return.
return false;
}
bool is_instance_of(b_obj_class *klass1, char *klass2_name) {
while (klass1 != NULL) {
if ((int) strlen(klass2_name) == klass1->name->length
&& memcmp(klass1->name->chars, klass2_name, klass1->name->length) == 0) {
return true;
}
klass1 = klass1->superclass;
}
return false;
}
inline void dict_add_entry(b_vm *vm, b_obj_dict *dict, b_value key, b_value value) {
write_value_arr(vm, &dict->names, key);
table_set(vm, &dict->items, key, value);
}
inline bool dict_get_entry(b_obj_dict *dict, b_value key, b_value *value) {
/* // this will be easier to search than the entire tables
// if the key doesn't exist.
if (dict->names.count < (int)sizeof(uint8_t)) {
int i;
bool found = false;
for (i = 0; i < dict->names.count; i++) {
if (values_equal(dict->names.values[i], key)) {
found = true;
break;
}
}
if (!found)
return false;
} */
return table_get(&dict->items, key, value);
}
inline bool dict_set_entry(b_vm *vm, b_obj_dict *dict, b_value key, b_value value) {
#if defined(USE_NAN_BOXING) && USE_NAN_BOXING
bool found = false;
for (int i = 0; i < dict->names.count; i++) {
if (values_equal(dict->names.values[i], key))
found = true;
}
if (!found)
write_value_arr(vm, &dict->names, key); // add key if it doesn't exist.
#else
b_value temp_value;
if (!table_get(&dict->items, key, &temp_value)) {
write_value_arr(vm, &dict->names, key); // add key if it doesn't exist.
}
#endif
return table_set(vm, &dict->items, key, value);
}
static b_obj_string *multiply_string(b_vm *vm, b_obj_string *str, double number) {
int times = (int) number;
if (times <= 0) // 'str' * 0 == '', 'str' * -1 == ''
return copy_string(vm, "", 0);
else if (times == 1) // 'str' * 1 == 'str'
return str;
int total_length = str->length * times;
char *result = ALLOCATE(char, (size_t) total_length + 1);
for (int i = 0; i < times; i++) {
memcpy(result + (str->length * i), str->chars, str->length);
}
result[total_length] = '\0';
return take_string(vm, result, total_length);
}
static b_obj_list *add_list(b_vm *vm, b_obj_list *a, b_obj_list *b) {
b_obj_list *list = new_list(vm);
push(vm, OBJ_VAL(list));
for (int i = 0; i < a->items.count; i++) {
write_value_arr(vm, &list->items, a->items.values[i]);
}
for (int i = 0; i < b->items.count; i++) {
write_value_arr(vm, &list->items, b->items.values[i]);
}
pop(vm);
return list;
}
static inline b_obj_bytes *add_bytes(b_vm *vm, b_obj_bytes *a, b_obj_bytes *b) {
b_obj_bytes *bytes = new_bytes(vm, a->bytes.count + b->bytes.count);
memcpy(bytes->bytes.bytes, a->bytes.bytes, a->bytes.count);
memcpy(bytes->bytes.bytes + a->bytes.count, b->bytes.bytes, b->bytes.count);
return bytes;
}
static inline b_obj_list *multiply_list(b_vm *vm, b_obj_list *a, b_obj_list *new_list, int times) {
for (int i = 0; i < times; i++) {
for (int j = 0; j < a->items.count; j++) {
write_value_arr(vm, &new_list->items, a->items.values[j]);
}
}
return new_list;
}
static bool dict_get_index(b_vm *vm, b_obj_dict *dict, bool will_assign) {
b_value index = peek(vm, 0);
b_value result;
if (dict_get_entry(dict, index, &result)) {
if (!will_assign) {
pop_n(vm, 2); // we can safely get rid of the index from the stack
}
push(vm, result);
return true;
}
pop_n(vm, 1);
return throw_exception(vm, "invalid index %s", value_to_string(vm, index));
}
static bool string_get_index(b_vm *vm, b_obj_string *string, bool will_assign) {
b_value lower = peek(vm, 0);
if (!IS_NUMBER(lower)) {
pop_n(vm, 1);
return throw_exception(vm, "strings are numerically indexed");
}
int index = AS_NUMBER(lower);
int real_index = index;
if (index < 0)
index = string->utf8_length + index;
if (index < string->utf8_length && index >= 0) {
int start = index, end = index + 1;
utf8slice(string->chars, &start, &end);
if (!will_assign) {
// we can safely get rid of the index from the stack
pop_n(vm, 2); // +1 for the string itself
}
push(vm, STRING_L_VAL(string->chars + start, (int) (end - start)));
return true;
} else {
pop_n(vm, 1);
return throw_exception(vm, "string index %d out of range", real_index);
}
}
static bool string_get_ranged_index(b_vm *vm, b_obj_string *string, bool will_assign) {
b_value upper = peek(vm, 0);
b_value lower = peek(vm, 1);
if (!(IS_NIL(lower) || IS_NUMBER(lower)) || !(IS_NUMBER(upper) || IS_NIL(upper))) {
pop_n(vm, 2);
return throw_exception(vm, "string are numerically indexed");
}
int lower_index = IS_NUMBER(lower) ? AS_NUMBER(lower) : 0;
int upper_index = IS_NIL(upper) ? string->utf8_length : AS_NUMBER(upper);
if (lower_index < 0 ||
(upper_index < 0 && ((string->utf8_length + upper_index) < 0))) {
// always return an empty string...
if (!will_assign) {
pop_n(vm, 3); // +1 for the string itself
}
push(vm, STRING_L_VAL("", 0));
return true;
}
if (upper_index < 0)
upper_index = string->utf8_length + upper_index;
if (upper_index > string->utf8_length)
upper_index = string->utf8_length;
int start = lower_index, end = upper_index;
utf8slice(string->chars, &start, &end);
if (!will_assign) {
pop_n(vm, 3); // +1 for the string itself
}
push(vm, STRING_L_VAL(string->chars + start, (int) (end - start)));
return true;
}
static bool bytes_get_index(b_vm *vm, b_obj_bytes *bytes, bool will_assign) {
b_value lower = peek(vm, 0);
if (!IS_NUMBER(lower)) {
pop_n(vm, 1);
return throw_exception(vm, "bytes are numerically indexed");
}
int index = AS_NUMBER(lower);
int real_index = index;
if (index < 0)
index = bytes->bytes.count + index;
if (index < bytes->bytes.count && index >= 0) {
if (!will_assign) {
// we can safely get rid of the index from the stack
pop_n(vm, 2); // +1 for the bytes itself
}
push(vm, NUMBER_VAL((int) bytes->bytes.bytes[index]));
return true;
} else {
pop_n(vm, 1);
return throw_exception(vm, "bytes index %d out of range", real_index);
}
}
static bool bytes_get_ranged_index(b_vm *vm, b_obj_bytes *bytes, bool will_assign) {
b_value upper = peek(vm, 0);
b_value lower = peek(vm, 1);
if (!(IS_NIL(lower) || IS_NUMBER(lower)) || !(IS_NUMBER(upper) || IS_NIL(upper))) {
pop_n(vm, 2);
return throw_exception(vm, "bytes are numerically indexed");
}
int lower_index = IS_NUMBER(lower) ? AS_NUMBER(lower) : 0;
int upper_index = IS_NIL(upper) ? bytes->bytes.count : AS_NUMBER(upper);
if (lower_index < 0 ||
(upper_index < 0 && ((bytes->bytes.count + upper_index) < 0))) {
// always return an empty bytes...
if (!will_assign) {
pop_n(vm, 3); // +1 for the bytes itself
}
push(vm, OBJ_VAL(new_bytes(vm, 0)));
return true;
}
if (upper_index < 0)
upper_index = bytes->bytes.count + upper_index;
if (upper_index > bytes->bytes.count)
upper_index = bytes->bytes.count;
if (!will_assign) {
pop_n(vm, 3); // +1 for the list itself
}
push(vm, OBJ_VAL(copy_bytes(vm, bytes->bytes.bytes + lower_index,
upper_index - lower_index)));
return true;
}
static bool list_get_index(b_vm *vm, b_obj_list *list, bool will_assign) {
b_value lower = peek(vm, 0);
if (!IS_NUMBER(lower)) {
pop_n(vm, 1);
return throw_exception(vm, "list are numerically indexed");
}
int index = AS_NUMBER(lower);
int real_index = index;
if (index < 0)
index = list->items.count + index;
if (index < list->items.count && index >= 0) {
if (!will_assign) {
// we can safely get rid of the index from the stack
pop_n(vm, 2); // +1 for the list itself
}
push(vm, list->items.values[index]);
return true;
} else {
pop_n(vm, 1);
return throw_exception(vm, "list index %d out of range", real_index);
}
}
static bool list_get_ranged_index(b_vm *vm, b_obj_list *list, bool will_assign) {
b_value upper = peek(vm, 0);
b_value lower = peek(vm, 1);
if (!(IS_NIL(lower) || IS_NUMBER(lower)) || !(IS_NUMBER(upper) || IS_NIL(upper))) {
pop_n(vm, 2);
return throw_exception(vm, "list are numerically indexed");
}
int lower_index = IS_NUMBER(lower) ? AS_NUMBER(lower) : 0;
int upper_index = IS_NIL(upper) ? list->items.count : AS_NUMBER(upper);
if (lower_index < 0 ||
(upper_index < 0 && ((list->items.count + upper_index) < 0))) {
// always return an empty list...
if (!will_assign) {
pop_n(vm, 3); // +1 for the list itself
}
push(vm, OBJ_VAL(new_list(vm)));
return true;
}
if (upper_index < 0)
upper_index = list->items.count + upper_index;
if (upper_index > list->items.count)
upper_index = list->items.count;
b_obj_list *n_list = new_list(vm);
for (int i = lower_index; i < upper_index; i++) {
write_value_arr(vm, &n_list->items, list->items.values[i]);
}
if (!will_assign) {
pop_n(vm, 3); // +1 for the list itself
}
push(vm, OBJ_VAL(n_list));
return true;
}
static inline void dict_set_index(b_vm *vm, b_obj_dict *dict, b_value index, b_value value) {
dict_set_entry(vm, dict, index, value);
pop_n(vm, 3); // pop the value, index and dict out
// leave the value on the stack for consumption
// e.g. variable = dict[index] = 10
push(vm, value);
}
static bool list_set_index(b_vm *vm, b_obj_list *list, b_value index, b_value value) {
if (!IS_NUMBER(index)) {
pop_n(vm, 3); // pop the value, index and list out
return throw_exception(vm, "list are numerically indexed");
}
int _position = AS_NUMBER(index);
int position = _position < 0 ? list->items.count + _position : _position;
if (position < list->items.count && position > -(list->items.count)) {
list->items.values[position] = value;
pop_n(vm, 3); // pop the value, index and list out
// leave the value on the stack for consumption
// e.g. variable = list[index] = 10
push(vm, value);
return true;
}
pop_n(vm, 3); // pop the value, index and list out
return throw_exception(vm, "lists index %d out of range", _position);
}
static bool bytes_set_index(b_vm *vm, b_obj_bytes *bytes, b_value index, b_value value) {
if (!IS_NUMBER(index)) {
pop_n(vm, 3); // pop the value, index and bytes out
return throw_exception(vm, "bytes are numerically indexed");
} else if (!IS_NUMBER(value) || AS_NUMBER(value) < 0 || AS_NUMBER(value) > 255) {
pop_n(vm, 3); // pop the value, index and bytes out
return throw_exception(vm, "invalid byte. bytes are numbers between 0 and 255.");
}
int _position = AS_NUMBER(index);
int byte = AS_NUMBER(value);
int position = _position < 0 ? bytes->bytes.count + _position : _position;
if (position < bytes->bytes.count && position > -(bytes->bytes.count)) {
bytes->bytes.bytes[position] = (unsigned char) byte;
pop_n(vm, 3); // pop the value, index and bytes out
// leave the value on the stack for consumption
// e.g. variable = bytes[index] = 10
push(vm, value);
return true;
}
pop_n(vm, 3); // pop the value, index and bytes out
return throw_exception(vm, "bytes index %d out of range", _position);
}
static bool concatenate(b_vm *vm) {
b_value _b = peek(vm, 0);
b_value _a = peek(vm, 1);
if (IS_NIL(_a)) {
pop_n(vm, 2);
push(vm, _b);
} else if (IS_NIL(_b)) {
pop(vm);
} else if (IS_NUMBER(_a)) {
double a = AS_NUMBER(_a);
char num_str[27]; // + 1 for null terminator
int num_length = sprintf(num_str, NUMBER_FORMAT, a);
b_obj_string *b = AS_STRING(_b);
int length = num_length + b->length;
char *chars = ALLOCATE(char, (size_t) length + 1);
memcpy(chars, num_str, num_length);
memcpy(chars + num_length, b->chars, b->length);
chars[length] = '\0';
b_obj_string *result = take_string(vm, chars, length);
result->utf8_length = num_length + b->utf8_length;
pop_n(vm, 2);
push(vm, OBJ_VAL(result));
} else if (IS_NUMBER(_b)) {
b_obj_string *a = AS_STRING(_a);
double b = AS_NUMBER(_b);
char num_str[27]; // + 1 for null terminator
int num_length = sprintf(num_str, NUMBER_FORMAT, b);
int length = num_length + a->length;
char *chars = ALLOCATE(char, (size_t) length + 1);
memcpy(chars, a->chars, a->length);
memcpy(chars + a->length, num_str, num_length);
chars[length] = '\0';
b_obj_string *result = take_string(vm, chars, length);
result->utf8_length = num_length + a->utf8_length;
pop_n(vm, 2);
push(vm, OBJ_VAL(result));
} else if (IS_STRING(_a) && IS_STRING(_b)) {
b_obj_string *b = AS_STRING(_b);
b_obj_string *a = AS_STRING(_a);
int length = a->length + b->length;
char *chars = ALLOCATE(char, (size_t) length + 1);
memcpy(chars, a->chars, a->length);
memcpy(chars + a->length, b->chars, b->length);
chars[length] = '\0';
b_obj_string *result = take_string(vm, chars, length);
result->utf8_length = a->utf8_length + b->utf8_length;
pop_n(vm, 2);
push(vm, OBJ_VAL(result));
} else {
return false;
}
return true;
}
static inline int floor_div(double a, double b) {
int d = (int) a / (int) b;
return d - ((d * b == a) & ((a < 0) ^ (b < 0)));
}
b_ptr_result run(b_vm *vm) {
b_call_frame *frame = &vm->frames[vm->frame_count - 1];
#define READ_BYTE() (*frame->ip++)
#define READ_SHORT() \
(frame->ip += 2, (uint16_t)((frame->ip[-2] << 8) | frame->ip[-1]))
#define READ_CONSTANT() \
(frame->closure->function->blob.constants.values[READ_SHORT()])
#define READ_STRING() (AS_STRING(READ_CONSTANT()))
#define BINARY_OP(type, op) \
do { \
if ((!IS_NUMBER(peek(vm, 0)) && !IS_BOOL(peek(vm, 0))) || \
(!IS_NUMBER(peek(vm, 1)) && !IS_BOOL(peek(vm, 1)))) { \
runtime_error("unsupported operand %s for %s and %s", #op, \
value_type(peek(vm, 0)), value_type(peek(vm, 1))); \
break; \
} \
b_value _b = pop(vm); \
double b = IS_BOOL(_b) ? (AS_BOOL(_b) ? 1 : 0) : AS_NUMBER(_b); \
b_value _a = pop(vm); \
double a = IS_BOOL(_a) ? (AS_BOOL(_a) ? 1 : 0) : AS_NUMBER(_a); \
push(vm, type(a op b)); \
} while (false)
#define BINARY_BIT_OP(type, op) \
do { \
if ((!IS_NUMBER(peek(vm, 0)) && !IS_BOOL(peek(vm, 0))) || \
(!IS_NUMBER(peek(vm, 1)) && !IS_BOOL(peek(vm, 1)))) { \
runtime_error("unsupported operand %s for %s and %s", #op, \
value_type(peek(vm, 0)), value_type(peek(vm, 1))); \
break; \
} \
int b = AS_NUMBER(pop(vm)); \
int a = AS_NUMBER(pop(vm)); \
push(vm, type((double)(a op b))); \
} while (false)
#define BINARY_MOD_OP(type, op) \
do { \
if ((!IS_NUMBER(peek(vm, 0)) && !IS_BOOL(peek(vm, 0))) || \
(!IS_NUMBER(peek(vm, 1)) && !IS_BOOL(peek(vm, 1)))) { \
runtime_error("unsupported operand %s for %s and %s", #op, \
value_type(peek(vm, 0)), value_type(peek(vm, 1))); \
break; \
} \
b_value _b = pop(vm); \
double b = IS_BOOL(_b) ? (AS_BOOL(_b) ? 1 : 0) : AS_NUMBER(_b); \
b_value _a = pop(vm); \
double a = IS_BOOL(_a) ? (AS_BOOL(_a) ? 1 : 0) : AS_NUMBER(_a); \
push(vm, type(op(a, b))); \
} while (false)
for (;;) {
// try...finally... (i.e. try without a catch but a finally
// but whose try body raises an exception)
// can cause us to go into an invalid mode where frame count == 0
// to fix this, we need to exit with an appropriate mode here.
if (vm->frame_count == 0) {
return PTR_RUNTIME_ERR;
}
if (vm->should_debug_stack) {
printf(" ");
for (b_value *slot = vm->stack; slot < vm->stack_top; slot++) {
printf("[ ");
print_value(*slot);
printf(" ]");
}
printf("\n");
disassemble_instruction(
&frame->closure->function->blob,
(int) (frame->ip - frame->closure->function->blob.code));
}
uint8_t instruction;
switch (instruction = READ_BYTE()) {
case OP_CONSTANT: {
b_value constant = READ_CONSTANT();
push(vm, constant);
break;
}
case OP_ADD: {
if (IS_STRING(peek(vm, 0)) || IS_STRING(peek(vm, 1))) {
if (!concatenate(vm)) {
runtime_error("unsupported operand + for %s and %s", value_type(peek(vm, 0)), value_type(peek(vm, 1)));
break;
}
} else if (IS_LIST(peek(vm, 0)) && IS_LIST(peek(vm, 1))) {
b_value result =
OBJ_VAL(add_list(vm, AS_LIST(peek(vm, 1)), AS_LIST(peek(vm, 0))));
pop_n(vm, 2);
push(vm, result);
} else if (IS_BYTES(peek(vm, 0)) && IS_BYTES(peek(vm, 1))) {
b_value result = OBJ_VAL(
add_bytes(vm, AS_BYTES(peek(vm, 1)), AS_BYTES(peek(vm, 0))));
pop_n(vm, 2);
push(vm, result);
} else {
BINARY_OP(NUMBER_VAL, +);
}
break;
}
case OP_SUBTRACT: {
BINARY_OP(NUMBER_VAL, -);
break;
}
case OP_MULTIPLY: {
if (IS_STRING(peek(vm, 1)) && IS_NUMBER(peek(vm, 0))) {
double number = AS_NUMBER(peek(vm, 0));
b_obj_string *string = AS_STRING(peek(vm, 1));
b_value result = OBJ_VAL(multiply_string(vm, string, number));
pop_n(vm, 2);
push(vm, result);
break;
} else if (IS_LIST(peek(vm, 1)) && IS_NUMBER(peek(vm, 0))) {
int number = (int) AS_NUMBER(pop(vm));
b_obj_list *list = AS_LIST(peek(vm, 0));
b_obj_list *n_list = new_list(vm);
push(vm, OBJ_VAL(n_list));
b_value result = OBJ_VAL(multiply_list(vm, list, n_list, number));
pop_n(vm, 2);
push(vm, result);
break;
}
BINARY_OP(NUMBER_VAL, *);
break;
}
case OP_DIVIDE: {
BINARY_OP(NUMBER_VAL, /);
break;
}
case OP_REMINDER: {
BINARY_MOD_OP(NUMBER_VAL, fmod);
break;
}
case OP_POW: {
BINARY_MOD_OP(NUMBER_VAL, pow);
break;
}
case OP_F_DIVIDE: {
BINARY_MOD_OP(NUMBER_VAL, floor_div);
break;
}
case OP_NEGATE: {
if (!IS_NUMBER(peek(vm, 0))) {
runtime_error("operator - not defined for object of type %s", value_type(peek(vm, 0)));
break;
}
push(vm, NUMBER_VAL(-AS_NUMBER(pop(vm))));
break;
}
case OP_BIT_NOT: {
if (!IS_NUMBER(peek(vm, 0))) {
runtime_error("operator ~ not defined for object of type %s", value_type(peek(vm, 0)));
break;
}
push(vm, INTEGER_VAL(~((int) AS_NUMBER(pop(vm)))));
break;
}
case OP_AND: {
BINARY_BIT_OP(NUMBER_VAL, &);
break;
}
case OP_OR: {
BINARY_BIT_OP(NUMBER_VAL, |);
break;
}
case OP_XOR: {
BINARY_BIT_OP(NUMBER_VAL, ^);
break;
}
case OP_LSHIFT: {
BINARY_BIT_OP(NUMBER_VAL, <<);
break;
}
case OP_RSHIFT: {
BINARY_BIT_OP(NUMBER_VAL, >>);
break;
}
case OP_ONE: {
push(vm, NUMBER_VAL(1));
break;
}
// comparisons
case OP_EQUAL: {
b_value b = pop(vm);
b_value a = pop(vm);
push(vm, BOOL_VAL(values_equal(a, b)));
break;
}
case OP_GREATER: {
BINARY_OP(BOOL_VAL, >);
break;
}
case OP_LESS: {
BINARY_OP(BOOL_VAL, <);
break;
}
case OP_NOT:
push(vm, BOOL_VAL(is_false(pop(vm))));
break;
case OP_NIL:
push(vm, NIL_VAL);
break;
case OP_EMPTY:
push(vm, EMPTY_VAL);
break;
case OP_TRUE:
push(vm, BOOL_VAL(true));
break;
case OP_FALSE:
push(vm, BOOL_VAL(false));
break;
case OP_JUMP: {
uint16_t offset = READ_SHORT();
frame->ip += offset;
break;
}
case OP_JUMP_IF_FALSE: {
uint16_t offset = READ_SHORT();
if (is_false(peek(vm, 0))) {
frame->ip += offset;
}
break;
}
case OP_LOOP: {
uint16_t offset = READ_SHORT();
frame->ip -= offset;
break;
}
case OP_ECHO: {
b_value val = peek(vm, 0);
if (vm->is_repl) {
echo_value(val);
} else {
print_value(val);
}
if(!IS_EMPTY(val)) {
printf("\n");
}
pop(vm);
break;
}
case OP_STRINGIFY: {
if (!IS_STRING(peek(vm, 0)) && !IS_NIL(peek(vm, 0))) {
char *value = value_to_string(vm, pop(vm));
if ((int) strlen(value) != 0) {
push(vm, OBJ_VAL(take_string(vm, value, (int) strlen(value))));
} else {
push(vm, NIL_VAL);
}
}
break;
}
case OP_DUP: {
push(vm, peek(vm, 0));
break;
}
case OP_POP: {
pop(vm);
break;
}
case OP_POP_N: {
pop_n(vm, READ_SHORT());
break;
}
case OP_CLOSE_UP_VALUE: {
close_up_values(vm, vm->stack_top - 1);
pop(vm);
break;
}
case OP_DEFINE_GLOBAL: {
b_obj_string *name = READ_STRING();
if(IS_EMPTY(peek(vm, 0))) {
runtime_error(ERR_CANT_ASSIGN_EMPTY);
break;
}
table_set(vm, &frame->closure->function->module->values, OBJ_VAL(name), peek(vm, 0));
pop(vm);
#if defined(DEBUG_TABLE) && DEBUG_TABLE
table_print(&vm->globals);
#endif
break;
}
case OP_GET_GLOBAL: {
b_obj_string *name = READ_STRING();
b_value value;
if (!table_get(&frame->closure->function->module->values, OBJ_VAL(name), &value)) {
if (!table_get(&vm->globals, OBJ_VAL(name), &value)) {
runtime_error("'%s' is undefined in this scope", name->chars);
break;
}
}
push(vm, value);
break;
}
case OP_SET_GLOBAL: {
if(IS_EMPTY(peek(vm, 0))) {
runtime_error(ERR_CANT_ASSIGN_EMPTY);
break;
}
b_obj_string *name = READ_STRING();
b_table *table = &frame->closure->function->module->values;
if (table_set(vm, table, OBJ_VAL(name), peek(vm, 0))) {
table_delete(table, OBJ_VAL(name));
runtime_error("%s is undefined in this scope", name->chars);
break;
}
break;
}
case OP_GET_LOCAL: {
uint16_t slot = READ_SHORT();
push(vm, frame->slots[slot]);
break;
}
case OP_SET_LOCAL: {
uint16_t slot = READ_SHORT();
if(IS_EMPTY(peek(vm, 0))) {
runtime_error(ERR_CANT_ASSIGN_EMPTY);
break;
}
frame->slots[slot] = peek(vm, 0);
break;
}
case OP_GET_PROPERTY: {
b_obj_string *name = READ_STRING();
if (IS_OBJ(peek(vm, 0))) {
b_value value;
switch (AS_OBJ(peek(vm, 0))->type) {
case OBJ_MODULE: {
b_obj_module *module = AS_MODULE(peek(vm, 0));
if (table_get(&module->values, OBJ_VAL(name), &value)) {
if (name->length > 0 && name->chars[0] == '_') {
runtime_error("cannot get private module property '%s'", name->chars);
break;
}
pop(vm); // pop the list...
push(vm, value);
break;
}
runtime_error("%s module does not define '%s'", module->name, name->chars);
break;
}
case OBJ_CLASS: {
if (table_get(&AS_CLASS(peek(vm, 0))->methods, OBJ_VAL(name), &value)) {
if (get_method_type(value) == TYPE_STATIC) {
if (name->length > 0 && name->chars[0] == '_') {
runtime_error("cannot call private property '%s' of class %s",
name->chars, AS_CLASS(peek(vm, 0))->name->chars);
break;
}
pop(vm); // pop the class...
push(vm, value);
break;
}
} else if (table_get(&AS_CLASS(peek(vm, 0))->static_properties, OBJ_VAL(name), &value)) {
if (name->length > 0 && name->chars[0] == '_') {
runtime_error("cannot call private property '%s' of class %s",
name->chars, AS_CLASS(peek(vm, 0))->name->chars);
break;
}
pop(vm); // pop the class...
push(vm, value);
break;
}
runtime_error("class %s does not have a static property or method named '%s'",
AS_CLASS(peek(vm, 0))->name->chars, name->chars);
break;
}
case OBJ_INSTANCE: {
b_obj_instance *instance = AS_INSTANCE(peek(vm, 0));
if (table_get(&instance->properties, OBJ_VAL(name), &value)) {
if (name->length > 0 && name->chars[0] == '_') {
runtime_error("cannot call private property '%s' from instance of %s",
name->chars, instance->klass->name->chars);
break;
}
pop(vm); // pop the instance...
push(vm, value);
break;
}
if (name->length > 0 && name->chars[0] == '_') {
runtime_error("cannot bind private property '%s' to instance of %s",
name->chars, instance->klass->name->chars);
break;
}
if (!bind_method(vm, instance->klass, name)) {
EXIT_VM();
} else {
break;
}
runtime_error("instance of class %s does not have a property or method named '%s'",
AS_INSTANCE(peek(vm, 0))->klass->name->chars, name->chars);
break;
}
case OBJ_STRING: {
if (table_get(&vm->methods_string, OBJ_VAL(name), &value)) {
pop(vm); // pop the list...
push(vm, value);
break;
}
runtime_error("class String has no named property '%s'", name->chars);
break;
}
case OBJ_LIST: {
if (table_get(&vm->methods_list, OBJ_VAL(name), &value)) {
pop(vm); // pop the list...
push(vm, value);
break;
}
runtime_error("class List has no named property '%s'", name->chars);
break;
}
case OBJ_RANGE: {
if (table_get(&vm->methods_range, OBJ_VAL(name), &value)) {
pop(vm); // pop the list...
push(vm, value);
break;
}
runtime_error("class Range has no named property '%s'", name->chars);
break;
}
case OBJ_DICT: {
if (table_get(&AS_DICT(peek(vm, 0))->items, OBJ_VAL(name), &value) ||
table_get(&vm->methods_dict, OBJ_VAL(name), &value)) {
pop(vm); // pop the dictionary...
push(vm, value);
break;
}
runtime_error("unknown key or class Dict property '%s'", name->chars);
break;
}
case OBJ_BYTES: {
if (table_get(&vm->methods_bytes, OBJ_VAL(name), &value)) {
pop(vm); // pop the list...
push(vm, value);
break;
}
runtime_error("class Bytes has no named property '%s'", name->chars);
break;
}
case OBJ_FILE: {
if (table_get(&vm->methods_file, OBJ_VAL(name), &value)) {
pop(vm); // pop the list...
push(vm, value);
break;
}
runtime_error("class File has no named property '%s'", name->chars);
break;
}
default: {
runtime_error("object of type %s does not carry properties", value_type(peek(vm, 0)));
break;
}
}
} else {
runtime_error("non-object type %s does not have properties", value_type(peek(vm, 0)));
break;
}
break;
}
case OP_GET_SELF_PROPERTY: {
b_obj_string *name = READ_STRING();
b_value value;
if (IS_INSTANCE(peek(vm, 0))) {
b_obj_instance *instance = AS_INSTANCE(peek(vm, 0));
if (table_get(&instance->properties, OBJ_VAL(name), &value)) {
pop(vm); // pop the instance...
push(vm, value);
break;
}
if (!bind_method(vm, instance->klass, name)) {
EXIT_VM();
} else {
break;
}
runtime_error("instance of class %s does not have a property or method named '%s'",
AS_INSTANCE(peek(vm, 0))->klass->name->chars, name->chars);
break;
} else if (IS_CLASS(peek(vm, 0))) {
b_obj_class *klass = AS_CLASS(peek(vm, 0));
if (table_get(&klass->methods, OBJ_VAL(name), &value)) {
if (get_method_type(value) == TYPE_STATIC) {
pop(vm); // pop the class...
push(vm, value);
break;
}
} else if (table_get(&klass->static_properties, OBJ_VAL(name), &value)) {
pop(vm); // pop the class...
push(vm, value);
break;
}
runtime_error("class %s does not have a static property or method named '%s'",
klass->name->chars, name->chars);
break;
} else if (IS_MODULE(peek(vm, 0))) {
b_obj_module *module = AS_MODULE(peek(vm, 0));
if (table_get(&module->values, OBJ_VAL(name), &value)) {
pop(vm); // pop the class...
push(vm, value);
break;
}
runtime_error("module %s does not define '%s'", module->name, name->chars);
break;
}
runtime_error("non-object type %s does not have properties", value_type(peek(vm, 0)));
break;
}
case OP_SET_PROPERTY: {
if (!IS_INSTANCE(peek(vm, 1)) && !IS_DICT(peek(vm, 1))) {
runtime_error("object of type %s can not carry properties", value_type(peek(vm, 1)));
break;
} else if(IS_EMPTY(peek(vm, 0))) {
runtime_error(ERR_CANT_ASSIGN_EMPTY);
break;
}
b_obj_string *name = READ_STRING();
if (IS_INSTANCE(peek(vm, 1))) {
b_obj_instance *instance = AS_INSTANCE(peek(vm, 1));
table_set(vm, &instance->properties, OBJ_VAL(name), peek(vm, 0));
b_value value = pop(vm);
pop(vm); // removing the instance object
push(vm, value);
} else {
b_obj_dict *dict = AS_DICT(peek(vm, 1));
dict_set_entry(vm, dict, OBJ_VAL(name), peek(vm, 0));
b_value value = pop(vm);
pop(vm); // removing the dictionary object
push(vm, value);
}
break;
}
case OP_CLOSURE: {
b_obj_func *function = AS_FUNCTION(READ_CONSTANT());
b_obj_closure *closure = new_closure(vm, function);
push(vm, OBJ_VAL(closure));
for (int i = 0; i < closure->up_value_count; i++) {
uint8_t is_local = READ_BYTE();
int index = READ_SHORT();
if (is_local) {
closure->up_values[i] = capture_up_value(vm, frame->slots + index);
} else {
closure->up_values[i] =
((b_obj_closure *) frame->closure)->up_values[index];
}
}
break;
}
case OP_GET_UP_VALUE: {
int index = READ_SHORT();
push(vm, *((b_obj_closure *) frame->closure)->up_values[index]->location);
break;
}
case OP_SET_UP_VALUE: {
int index = READ_SHORT();
if(IS_EMPTY(peek(vm, 0))) {
runtime_error(ERR_CANT_ASSIGN_EMPTY);
break;
}
*((b_obj_closure *) frame->closure)->up_values[index]->location =
peek(vm, 0);
break;
}
case OP_CALL: {
int arg_count = READ_BYTE();
if (!call_value(vm, peek(vm, arg_count), arg_count)) {
EXIT_VM();
}
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_INVOKE: {
b_obj_string *method = READ_STRING();
int arg_count = READ_BYTE();
if (!invoke(vm, method, arg_count)) {
EXIT_VM();
}
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_INVOKE_SELF: {
b_obj_string *method = READ_STRING();
int arg_count = READ_BYTE();
if (!invoke_self(vm, method, arg_count)) {
EXIT_VM();
}
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_CLASS: {
b_obj_string *name = READ_STRING();
push(vm, OBJ_VAL(new_class(vm, name)));
break;
}
case OP_METHOD: {
b_obj_string *name = READ_STRING();
define_method(vm, name);
break;
}
case OP_CLASS_PROPERTY: {
b_obj_string *name = READ_STRING();
int is_static = READ_BYTE();
define_property(vm, name, is_static == 1);
break;
}
case OP_INHERIT: {
if (!IS_CLASS(peek(vm, 1))) {
runtime_error("cannot inherit from non-class object");
break;
}
b_obj_class *superclass = AS_CLASS(peek(vm, 1));
b_obj_class *subclass = AS_CLASS(peek(vm, 0));
table_add_all(vm, &superclass->properties, &subclass->properties);
table_add_all(vm, &superclass->methods, &subclass->methods);
subclass->superclass = superclass;
pop(vm); // pop the subclass
break;
}
case OP_GET_SUPER: {
b_obj_string *name = READ_STRING();
b_obj_class *klass = AS_CLASS(peek(vm, 0));
if (!bind_method(vm, klass->superclass, name)) {
EXIT_VM();
}
break;
}
case OP_SUPER_INVOKE: {
b_obj_string *method = READ_STRING();
int arg_count = READ_BYTE();
b_obj_class *klass = AS_CLASS(pop(vm));
if (!invoke_from_class(vm, klass, method, arg_count)) {
EXIT_VM();
}
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_SUPER_INVOKE_SELF: {
int arg_count = READ_BYTE();
b_obj_class *klass = AS_CLASS(pop(vm));
if (!invoke_from_class(vm, klass, klass->name, arg_count)) {
EXIT_VM();
}
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_LIST: {
int count = READ_SHORT();
b_obj_list *list = new_list(vm);
vm->stack_top[-count - 1] = OBJ_VAL(list);
for (int i = count - 1; i >= 0; i--) {
write_list(vm, list, peek(vm, i));
}
pop_n(vm, count);
break;
}
case OP_RANGE: {
b_value _upper = peek(vm, 0), _lower = peek(vm, 1);
if (!IS_NUMBER(_upper) || !IS_NUMBER(_lower)) {
runtime_error("invalid range boundaries");
break;
}
double lower = AS_NUMBER(_lower), upper = AS_NUMBER(_upper);
pop_n(vm, 2);
push(vm, OBJ_VAL(new_range(vm, lower, upper)));
break;
}
case OP_DICT: {
int count = READ_SHORT() * 2; // 1 for key, 1 for value
b_obj_dict *dict = new_dict(vm);
vm->stack_top[-count - 1] = OBJ_VAL(dict);
for (int i = 0; i < count; i += 2) {
b_value name = vm->stack_top[-count + i];
if(!IS_STRING(name) && !IS_NUMBER(name) && !IS_BOOL(name)) {
runtime_error("dictionary key must be one of string, number or boolean");
}
b_value value = vm->stack_top[-count + i + 1];
dict_add_entry(vm, dict, name, value);
}
pop_n(vm, count);
break;
}
case OP_GET_RANGED_INDEX: {
uint8_t will_assign = READ_BYTE();
bool is_gotten = true;
if (IS_OBJ(peek(vm, 2))) {
switch (AS_OBJ(peek(vm, 2))->type) {
case OBJ_STRING: {
if (!string_get_ranged_index(vm, AS_STRING(peek(vm, 2)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
case OBJ_LIST: {
if (!list_get_ranged_index(vm, AS_LIST(peek(vm, 2)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
case OBJ_BYTES: {
if (!bytes_get_ranged_index(vm, AS_BYTES(peek(vm, 2)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
default: {
is_gotten = false;
break;
}
}
} else {
is_gotten = false;
}
if (!is_gotten) {
runtime_error("cannot range index object of type %s", value_type(peek(vm, 2)));
}
break;
}
case OP_GET_INDEX: {
uint8_t will_assign = READ_BYTE();
bool is_gotten = true;
if (IS_OBJ(peek(vm, 1))) {
switch (AS_OBJ(peek(vm, 1))->type) {
case OBJ_STRING: {
if (!string_get_index(vm, AS_STRING(peek(vm, 1)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
case OBJ_LIST: {
if (!list_get_index(vm, AS_LIST(peek(vm, 1)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
case OBJ_DICT: {
if (!dict_get_index(vm, AS_DICT(peek(vm, 1)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
case OBJ_BYTES: {
if (!bytes_get_index(vm, AS_BYTES(peek(vm, 1)), will_assign == (uint8_t) 1)) {
EXIT_VM();
}
break;
}
default: {
is_gotten = false;
break;
}
}
} else {
is_gotten = false;
}
if (!is_gotten) {
runtime_error("cannot index object of type %s", value_type(peek(vm, 1)));
}
break;
}
case OP_SET_INDEX: {
bool is_set = true;
if (IS_OBJ(peek(vm, 2))) {
b_value value = peek(vm, 0);
b_value index = peek(vm, 1);
if(IS_EMPTY(value)) {
runtime_error(ERR_CANT_ASSIGN_EMPTY);
break;
}
switch (AS_OBJ(peek(vm, 2))->type) {
case OBJ_LIST: {
if (!list_set_index(vm, AS_LIST(peek(vm, 2)), index, value)) {
EXIT_VM();
}
break;
}
case OBJ_STRING: {
runtime_error("strings do not support object assignment");
break;
}
case OBJ_DICT: {
dict_set_index(vm, AS_DICT(peek(vm, 2)), index, value);
break;
}
case OBJ_BYTES: {
if (!bytes_set_index(vm, AS_BYTES(peek(vm, 2)), index, value)) {
EXIT_VM();
}
break;
}
default: {
is_set = false;
break;
}
}
} else {
is_set = false;
}
if (!is_set) {
runtime_error("type of %s is not a valid iterable", value_type(peek(vm, 3)));
}
break;
/*if (!IS_LIST(peek(vm, 3)) && !IS_DICT(peek(vm, 3)) &&
!IS_BYTES(peek(vm, 3))) {
if (!IS_STRING(peek(vm, 3))) {
runtime_error("type of %s is not a valid iterable", value_type(peek(vm, 3)));
} else {
runtime_error("strings do not support object assignment");
}
break;
}
b_value value = peek(vm, 0);
b_value index = peek(vm, 2); // since peek 1 will be nil
if (IS_LIST(peek(vm, 3))) {
if (!list_set_index(vm, AS_LIST(peek(vm, 3)), index, value)) {
EXIT_VM();
}
} else if (IS_BYTES(peek(vm, 3))) {
if (!bytes_set_index(vm, AS_BYTES(peek(vm, 3)), index, value)) {
EXIT_VM();
}
} else if (IS_DICT(peek(vm, 3))) {
dict_set_index(vm, AS_DICT(peek(vm, 3)), index, value);
break;
}
break;*/
}
case OP_RETURN: {
b_value result = pop(vm);
close_up_values(vm, frame->slots);
vm->frame_count--;
if (vm->frame_count == 0) {
pop(vm);
return PTR_OK;
}
vm->stack_top = frame->slots;
push(vm, result);
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_CALL_IMPORT: {
b_obj_closure *closure = AS_CLOSURE(READ_CONSTANT());
add_module(vm, closure->function->module);
call(vm, closure, 0);
frame = &vm->frames[vm->frame_count - 1];
break;
}
case OP_NATIVE_MODULE: {
b_obj_string *module_name = READ_STRING();
b_value value;
if (table_get(&vm->modules, OBJ_VAL(module_name), &value)) {
b_obj_module *module = AS_MODULE(value);
if(module->preloader != NULL) {
((b_module_loader)module->preloader)(vm);
}
module->imported = true;
table_set(vm, &frame->closure->function->module->values, OBJ_VAL(module_name), value);
break;
}
runtime_error("module '%s' not found", module_name->chars);
break;
}
case OP_SELECT_IMPORT: {
b_obj_string *module_name = READ_STRING();
b_obj_func *function = AS_CLOSURE(peek(vm, 0))->function;
b_value value;
if (table_get(&function->module->values, OBJ_VAL(module_name), &value)) {
table_set(vm, &frame->closure->function->module->values, OBJ_VAL(module_name), value);
} else {
runtime_error("module %s does not define '%s'", function->module->name, module_name->chars);
}
break;
}
case OP_SELECT_NATIVE_IMPORT: {
b_obj_string *module_name = AS_STRING(peek(vm, 0));
b_obj_string *value_name = READ_STRING();
b_value mod;
if (table_get(&vm->modules, OBJ_VAL(module_name), &mod)) {
b_obj_module *module = AS_MODULE(mod);
b_value value;
if (table_get(&module->values, OBJ_VAL(value_name), &value)) {
table_set(vm, &frame->closure->function->module->values, OBJ_VAL(value_name), value);
} else {
runtime_error("module %s does not define '%s'", module->name, value_name->chars);
}
} else{
runtime_error("module '%s' not found", module_name->chars);
}
break;
}
case OP_IMPORT_ALL: {
table_add_all(vm, &AS_CLOSURE(peek(vm, 0))->function->module->values, &frame->closure->function->module->values);
break;
}
case OP_IMPORT_ALL_NATIVE: {
b_obj_string *name = AS_STRING(peek(vm, 0));
b_value mod;
if (table_get(&vm->modules, OBJ_VAL(name), &mod)) {
table_add_all(vm, &AS_MODULE(mod)->values, &frame->closure->function->module->values);
}
break;
}
case OP_EJECT_IMPORT: {
b_obj_func *function = AS_CLOSURE(READ_CONSTANT())->function;
table_delete(&frame->closure->function->module->values,
OBJ_VAL(copy_string(vm, function->module->name, (int) strlen(function->module->name))));
break;
}
case OP_EJECT_NATIVE_IMPORT: {
b_value mod;
b_obj_string *name = READ_STRING();
if (table_get(&vm->modules, OBJ_VAL(name), &mod)) {
table_add_all(vm, &AS_MODULE(mod)->values, &frame->closure->function->module->values);
table_delete(&frame->closure->function->module->values, OBJ_VAL(name));
}
break;
}
case OP_ASSERT: {
b_value message = pop(vm);
b_value expression = pop(vm);
if (is_false(expression)) {
if (!IS_NIL(message)) {
throw_exception(vm, "AssertionError: %s", value_to_string(vm, message));
} else {
throw_exception(vm, "AssertionError");
}
}
break;
}
case OP_DIE: {
if (!IS_INSTANCE(peek(vm, 0)) ||
!is_instance_of(AS_INSTANCE(peek(vm, 0))->klass,
vm->exception_class->name->chars)) {
runtime_error("instance of Exception expected");
break;
}
b_value stacktrace = get_stack_trace(vm);
b_obj_instance *instance = AS_INSTANCE(peek(vm, 0));
table_set(vm, &instance->properties, STRING_L_VAL("stacktrace", 10), stacktrace);
if (propagate_exception(vm)) {
frame = &vm->frames[vm->frame_count - 1];
break;
}
EXIT_VM();
}
case OP_TRY: {
b_obj_string *type = READ_STRING();
uint16_t address = READ_SHORT();
uint16_t finally_address = READ_SHORT();
if (address != 0) {
b_value value;
if (!table_get(&vm->globals, OBJ_VAL(type), &value) || !IS_CLASS(value)) {
runtime_error("object of type '%s' is not an exception", type->chars);
break;
}
push_exception_handler(vm, AS_CLASS(value), address, finally_address);
} else {
push_exception_handler(vm, NULL, address, finally_address);
}
break;
}
case OP_POP_TRY: {
frame->handlers_count--;
break;
}
case OP_PUBLISH_TRY: {
frame->handlers_count--;
if (!propagate_exception(vm)) {
frame = &vm->frames[vm->frame_count - 1];
break;
}
EXIT_VM();
}
case OP_SWITCH: {
b_obj_switch *sw = AS_SWITCH(READ_CONSTANT());
b_value expr = peek(vm, 0);
// push(vm, OBJ_VAL(sw));
b_value value;
if (table_get(&sw->table, expr, &value)) {
frame->ip += (int) AS_NUMBER(value);
} else if (sw->default_jump != -1) {
frame->ip += sw->default_jump;
} else {
frame->ip += sw->exit_jump;
}
pop(vm);
break;
}
case OP_CHOICE: {
b_value _else = peek(vm, 0);
b_value _then = peek(vm, 1);
b_value _condition = peek(vm, 2);
pop_n(vm, 3);
if (!is_false(_condition)) {
push(vm, _then);
} else {
push(vm, _else);
}
break;
}
default:
break;
}
}
#undef READ_BYTE
#undef READ_SHORT
#undef READ_CONSTANT
#undef READ_LCONSTANT
#undef READ_STRING
#undef READ_LSTRING
#undef BINARY_OP
#undef BINARY_MOD_OP
}
b_ptr_result interpret(b_vm *vm, b_obj_module *module, const char *source) {
b_blob blob;
init_blob(&blob);
initialize_exceptions(vm, module);
b_obj_func *function = compile(vm, module, source, &blob);
if (vm->should_print_bytecode) {
return PTR_OK;
}
if (function == NULL) {
free_blob(vm, &blob);
return PTR_COMPILE_ERR;
}
push(vm, OBJ_VAL(function));
b_obj_closure *closure = new_closure(vm, function);
pop(vm);
push(vm, OBJ_VAL(closure));
call(vm, closure, 0);
b_ptr_result result = run(vm);
return result;
}
#undef ERR_CANT_ASSIGN_EMPTY
| 31.315661 | 121 | 0.57616 |
61f554e9248f70393cec08b1d9fb9b1adf9cf0ea | 1,364 | h | C | xcache/xcache_quic.h | MirrorZ/picoquic | 9ab5f2608d6033ae5e51bc56ecffa4e0caafb605 | [
"MIT"
] | null | null | null | xcache/xcache_quic.h | MirrorZ/picoquic | 9ab5f2608d6033ae5e51bc56ecffa4e0caafb605 | [
"MIT"
] | null | null | null | xcache/xcache_quic.h | MirrorZ/picoquic | 9ab5f2608d6033ae5e51bc56ecffa4e0caafb605 | [
"MIT"
] | 2 | 2019-11-19T19:59:01.000Z | 2021-07-23T20:03:41.000Z | #ifndef _XCACHE_QUIC_H_
#define _XCACHE_QUIC_H_
// QUIC includes
extern "C" {
#include "picoquic.h"
#include "picosocks.h"
#include "util.h"
#include <sys/types.h>
#include <ifaddrs.h>
#include <stdio.h>
};
// C++ standard includes
#include <string>
#include <memory>
#define SERVER_CERT_FILE "certs/cert.pem"
#define SERVER_KEY_FILE "certs/key.pem"
#define LOGFILENAME "xcache.log"
using PicoquicPtr = std::unique_ptr<picoquic_quic_t,
decltype(&picoquic_free)>;
using FilePtr = std::unique_ptr<FILE, decltype(&fclose)>;
class XcacheQUIC {
public:
XcacheQUIC(picoquic_stream_data_cb_fn callback);
void updateTime();
int64_t nextWakeDelay(int64_t delay_max);
int incomingPacket(uint8_t* bytes, uint32_t packet_length,
struct sockaddr* addr_from, struct sockaddr* addr_to,
int if_index_to, unsigned char received_ecn);
uint64_t currentTime();
picoquic_cnx_t* firstConnection();
picoquic_stateless_packet_t* dequeueStatelessPacket();
picoquic_cnx_t* earliestConnection();
private:
void init();
std::string serverCertFile();
std::string serverKeyFile();
std::string inputPath(std::string filename);
std::string server_key_file;
std::string server_cert_file;
PicoquicPtr server = PicoquicPtr(nullptr, &picoquic_free);
FilePtr logfile = FilePtr(nullptr, &fclose);
uint64_t current_time;
};
#endif //_XCACHE_QUIC_H_
| 25.735849 | 60 | 0.758798 |
50966fa0d02a7c90249bb30f5b184f0b7aa78f20 | 742 | h | C | System/Library/PrivateFrameworks/UIKitCore.framework/UIDebuggingInformationValueTableViewCell.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 12 | 2019-06-02T02:42:41.000Z | 2021-04-13T07:22:20.000Z | System/Library/PrivateFrameworks/UIKitCore.framework/UIDebuggingInformationValueTableViewCell.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/UIKitCore.framework/UIDebuggingInformationValueTableViewCell.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 3 | 2019-06-11T02:46:10.000Z | 2019-12-21T14:58:16.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Saturday, June 1, 2019 at 6:53:43 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <UIKitCore/UITableViewCell.h>
@class UIView;
@interface UIDebuggingInformationValueTableViewCell : UITableViewCell {
UIView* _valueView;
}
@property (nonatomic,retain) UIView * valueView; //@synthesize valueView=_valueView - In the implementation block
-(id)initWithStyle:(long long)arg1 reuseIdentifier:(id)arg2 ;
-(void)setValueView:(UIView *)arg1 ;
-(UIView *)valueView;
@end
| 29.68 | 126 | 0.757412 |
dd9122ca4d71dda32fedc2addb73d64cc5b173a4 | 2,994 | c | C | firmware/components/drivers_real_time_clocks/test/test_DS3231.c | kaiote/OpenHAP | ada812f8451b3463e355a62f3f5bb31ed226630b | [
"MIT"
] | null | null | null | firmware/components/drivers_real_time_clocks/test/test_DS3231.c | kaiote/OpenHAP | ada812f8451b3463e355a62f3f5bb31ed226630b | [
"MIT"
] | null | null | null | firmware/components/drivers_real_time_clocks/test/test_DS3231.c | kaiote/OpenHAP | ada812f8451b3463e355a62f3f5bb31ed226630b | [
"MIT"
] | null | null | null | #include "unity.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "DS3231.h"
#include "esp_err.h"
#include "esp_log.h"
#define TAG "DS3231-TEST"
#define DS3231_ADDR 0x68
#define I2C_MASTER_SCL_IO 19
#define I2C_MASTER_SDA_IO 21
#define I2C_MASTER_NUM I2C_NUM_0
#define I2C_MASTER_FREQ_HZ 100000
// setup datetime: 2016-10-09 13:50:10
struct tm time_info;
DS3231 DS3231_inst;
esp_err_t setup_i2c(i2c_port_t port, int frequency, gpio_num_t sda_gpio, gpio_pullup_t sda_pullup_state, gpio_num_t scl_gpio, gpio_pullup_t scl_pullup_state)
{
int i2c_master_port = port;
i2c_config_t conf =
{
.mode = I2C_MODE_MASTER,
.sda_io_num = sda_gpio,
.sda_pullup_en = sda_pullup_state,
.scl_io_num = scl_gpio,
.scl_pullup_en = scl_pullup_state,
.master.clk_speed = frequency
};
esp_err_t ret = i2c_param_config(i2c_master_port, &conf);
if (ret != ESP_OK)
{
return ret;
}
ret = i2c_driver_install(i2c_master_port, conf.mode, 0, 0, 0);
return ret;
}
esp_err_t setupRTC(DS3231 *DS3231_inst, SemaphoreHandle_t *bus_mutex)
{
*bus_mutex = xSemaphoreCreateMutex();
esp_err_t ret = ds3231_init(DS3231_inst, DS3231_ADDR, I2C_MASTER_NUM, bus_mutex);
if(ret != ESP_OK)
{
ESP_LOGE(TAG, "Could not set up ds3231 RTC!");
return ret;
}
//Fill in your unix time here
setenv("TZ", "EAT-3", 1);
time_t now = 1555425481;
localtime_r(&now, &time_info);
while (ds3231_set_time(DS3231_inst, &time_info) != ESP_OK)
{
ESP_LOGI(TAG, "Could not set time\n");
vTaskDelay(250 / portTICK_PERIOD_MS);
}
return ret;
}
TEST_CASE("DS3231", "DS3231")
{
char strftime_buf[64];
esp_err_t ret;
SemaphoreHandle_t i2c_bus_mutex = NULL;
ret = setup_i2c(I2C_MASTER_NUM, I2C_MASTER_FREQ_HZ, I2C_MASTER_SDA_IO, GPIO_PULLUP_DISABLE, I2C_MASTER_SCL_IO, GPIO_PULLUP_DISABLE);
if (ret == ESP_OK)
{
ESP_LOGE(TAG, "Could not setup I2C");
/*Do something*/
}
ret = setupRTC(&DS3231_inst, &i2c_bus_mutex);
if (ret != ESP_OK)
{
ESP_LOGE(TAG, "Could not setup RTC");
/*Do something*/
}
while (1)
{
float temp;
vTaskDelay(250 / portTICK_PERIOD_MS);
if (ds3231_get_temp_float(&DS3231_inst, &temp) != ESP_OK)
{
ESP_LOGE(TAG, "Could not get temperature");
continue;
}
if (ds3231_get_time(&DS3231_inst, &time_info) != ESP_OK)
{
ESP_LOGE(TAG, "Could not get time");
continue;
}
ESP_LOGI(TAG, "%04d-%02d-%02d %02d:%02d:%02d, %.2f deg Cel\n", time_info.tm_year, time_info.tm_mon + 1,
time_info.tm_mday, time_info.tm_hour, time_info.tm_min, time_info.tm_sec, temp);
strftime(strftime_buf, sizeof(strftime_buf), "%c", &time_info);
ESP_LOGI(TAG, "The current date/time is: %s", strftime_buf);
}
}
| 25.810345 | 157 | 0.640615 |
20f7cba6f374dfa236ccac9d499d1964d1f3cc79 | 2,820 | h | C | pink/include/redis_parser.h | kernelai/pinktest | 51a5f2afd4c3f71ba03660f50099a0c2267b8c10 | [
"BSD-3-Clause"
] | 264 | 2016-07-03T05:45:31.000Z | 2022-03-25T03:05:45.000Z | pink/include/redis_parser.h | kernelai/pinktest | 51a5f2afd4c3f71ba03660f50099a0c2267b8c10 | [
"BSD-3-Clause"
] | 16 | 2016-10-13T04:08:36.000Z | 2018-01-05T02:41:42.000Z | third/pink/pink/include/redis_parser.h | kxtry/pika | 476a7cf1ae5d5518a744e5933ada59b8fd765f6e | [
"MIT"
] | 132 | 2016-08-13T15:18:31.000Z | 2022-03-26T12:54:43.000Z | // Copyright (c) 2015-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#ifndef PINK_INCLUDE_REDIS_PARSER_H_
#define PINK_INCLUDE_REDIS_PARSER_H_
#include "pink/include/pink_define.h"
#include <vector>
#define REDIS_PARSER_REQUEST 1
#define REDIS_PARSER_RESPONSE 2
namespace pink {
class RedisParser;
typedef std::vector<std::string> RedisCmdArgsType;
typedef int (*RedisParserDataCb) (RedisParser*, const RedisCmdArgsType&);
typedef int (*RedisParserMultiDataCb) (RedisParser*, const std::vector<RedisCmdArgsType>&);
typedef int (*RedisParserCb) (RedisParser*);
typedef int RedisParserType;
enum RedisParserStatus {
kRedisParserNone = 0,
kRedisParserInitDone = 1,
kRedisParserHalf = 2,
kRedisParserDone = 3,
kRedisParserError = 4,
};
enum RedisParserError {
kRedisParserOk = 0,
kRedisParserInitError = 1,
kRedisParserFullError = 2, // input overwhelm internal buffer
kRedisParserProtoError = 3,
kRedisParserDealError = 4,
kRedisParserCompleteError = 5,
};
struct RedisParserSettings {
RedisParserDataCb DealMessage;
RedisParserMultiDataCb Complete;
RedisParserSettings() {
DealMessage = NULL;
Complete = NULL;
}
};
class RedisParser {
public:
RedisParser();
RedisParserStatus RedisParserInit(RedisParserType type, const RedisParserSettings& settings);
RedisParserStatus ProcessInputBuffer(const char* input_buf, int length, int* parsed_len);
long get_bulk_len() {
return bulk_len_;
}
RedisParserError get_error_code() {
return error_code_;
}
void *data; /* A pointer to get hook to the "connection" or "socket" object */
private:
// for DEBUG
void PrintCurrentStatus();
void CacheHalfArgv();
int FindNextSeparators();
int GetNextNum(int pos, long* value);
RedisParserStatus ProcessInlineBuffer();
RedisParserStatus ProcessMultibulkBuffer();
RedisParserStatus ProcessRequestBuffer();
RedisParserStatus ProcessResponseBuffer();
void SetParserStatus(RedisParserStatus status, RedisParserError error = kRedisParserOk);
void ResetRedisParser();
void ResetCommandStatus();
RedisParserSettings parser_settings_;
RedisParserStatus status_code_;
RedisParserError error_code_;
int redis_type_; // REDIS_REQ_INLINE or REDIS_REQ_MULTIBULK
long multibulk_len_;
long bulk_len_;
std::string half_argv_;
int redis_parser_type_; // REDIS_PARSER_REQUEST or REDIS_PARSER_RESPONSE
RedisCmdArgsType argv_;
std::vector<RedisCmdArgsType> argvs_;
int cur_pos_;
const char* input_buf_;
std::string input_str_;
int length_;
};
} // namespace pink
#endif // PINK_INCLUDE_REDIS_PARSER_H_
| 27.378641 | 95 | 0.771631 |
deb6873385c62c834e52ac7222fd8370cfeeb423 | 9,864 | h | C | CBaseEntity.h | san1a/Karma-CS-GO-Hack | be6578d39b36d4ba6d3bc060b4b5076c98d4d34c | [
"MIT"
] | 20 | 2016-11-14T05:52:53.000Z | 2020-01-20T20:47:11.000Z | CBaseEntity.h | yashine59fr/Karma-CS-GO-Hack | be6578d39b36d4ba6d3bc060b4b5076c98d4d34c | [
"MIT"
] | 2 | 2018-05-06T12:41:44.000Z | 2022-02-08T10:38:11.000Z | CBaseEntity.h | san1a/Karma-CS-GO-Hack | be6578d39b36d4ba6d3bc060b4b5076c98d4d34c | [
"MIT"
] | 11 | 2016-11-26T04:14:16.000Z | 2020-01-20T20:47:14.000Z | #pragma once
#pragma once
enum MoveType_t
{
MOVETYPE_NONE = 0,
MOVETYPE_ISOMETRIC,
MOVETYPE_WALK,
MOVETYPE_STEP,
MOVETYPE_FLY,
MOVETYPE_FLYGRAVITY,
MOVETYPE_VPHYSICS,
MOVETYPE_PUSH,
MOVETYPE_NOCLIP,
MOVETYPE_LADDER,
MOVETYPE_OBSERVER,
MOVETYPE_CUSTOM,
MOVETYPE_LAST = MOVETYPE_CUSTOM,
MOVETYPE_MAX_BITS = 4
};
class CBaseCombatWeapon;
class CBaseEntity
{
public:
char __pad[0x64];
int index;
int GetHealth();
int GetTeam();
int GetFlags();
int GetTickBase();
int GetShotsFired();
int GetMoveType();
int GetModelIndex();
int GetHitboxSet();
int GetUserID();
int GetArmor();
int GetCollisionGroup();
int PhysicsSolidMaskForEntity();
int GetOwner();
int GetGlowIndex();
bool GetAlive();
int GetIndex();
bool GetDormant();
bool GetImmune();
bool IsEnemy();
bool IsVisible(int bone);
bool IsEntireVisible();
bool m_visible;
bool IsBroken();
bool HasHelmet();
bool IsFlashed();
bool IsTargetingLocal();
float GetFlashDuration();
float GetBombTimer();
QAngle GetViewPunch();
QAngle GetPunch();
QAngle GetEyeAngles();
Vector GetOrigin();
Vector GetEyePosition();
Vector GetBonePosition(int iBone);
bool SetupBones(matrix3x4_t *pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime);
Vector GetVelocity();
Vector GetPredicted(Vector p0);
ICollideable* GetCollideable();
player_info_t GetPlayerInfo();
model_t* GetModel();
std::string GetName();
std::string GetSteamID();
std::string GetLastPlace();
int& GetXUIDLow();
int& GetXUIDHigh();
CBaseCombatWeapon* GetWeapon();
ClientClass* GetClientClass();
bool IsScoped();
};
/*
struct WeaponInfo_t
{
float m_flArmorRatio;
float m_flPenetration;
float m_iDamage;
float m_flRange;
float m_flRangeModifier;
};
*/
class CHudTexture
{
public:
char type[64]; //0x0000
char subtype[64]; //0x0040
char unknowndata00[2]; //0x0080
char charinFont; //0x0082
char unknowndata01[1]; //0x0083
};//Size=0x00AC
/*
class WeaponInfo_t
{
public:
char m_cPrintName[32]; //0x0000
uint8_t pad_0x0020[0x158]; //0x0020
int32_t m_iBucket; //0x0178
int32_t m_iBucketPosition; //0x017C
int32_t m_iClipSize; //0x0180
int32_t m_iDefaultClip1; //0x0184
int32_t m_iDefaultClip2; //0x0188
uint8_t pad_0x018C[0x4]; //0x018C
int32_t m_iWeight; //0x0190
int32_t m_iRumble; //0x0194
uint8_t pad_0x0198[0x78]; //0x0198
char m_cUnknownString[80]; //0x0210
char m_cSingleShot[80]; //0x0260
uint8_t pad_0x02B0[0x140]; //0x02B0
char m_cReload[80]; //0x03F0
uint8_t pad_0x0440[0x330]; //0x0440
CHudTexture* m_pHUDWeaponIcon; //0x0770
CHudTexture* m_pHUDWeaponIconSmall; //0x0774
CHudTexture* m_pHUDWeaponAmmoIncon; //0x0778
uint8_t pad_0x077C[0x28]; //0x077C
bool m_bIsFullAuto; //0x07A4
uint8_t pad_0x07A5[0x3]; //0x07A5
float m_flHeatPerShot; //0x07A8
int32_t m_iWeaponPrice; //0x07AC "in game price"
float m_flArmorRatio; //0x07B0 "armor ratio"
float m_flMaxPlayerSpeed; //0x07B4 "max player speed"
float m_flMaxPlayerSpeedAlt; //0x07B8 "max player speed alt"
float m_flCrosshairMinDistance; //0x07BC "crosshair min distance"
float m_flCrosshairDeltaDistance; //0x07C0 "crosshair delta distance"
float m_flPenetration; //0x07C4 "penetration"
int32_t m_iDamage; //0x07C8 "damage"
float m_flRange; //0x07CC "range"
float m_flRangeModifier; //0x07D0 "range modifier"
int32_t m_iBullets; //0x07D4 "bullets"
float m_flCycleTime; //0x07D8 "cycletime"
float m_flCycleTimeAlt; //0x07DC "cycletime alt"
uint8_t pad_0x07E0[0x19C]; //0x07E0
float m_flTracerFrequency; //0x097C "tracer frequency"
float m_flSpread; //0x0980 "spread"
float m_flSpreadAlt; //0x0984 "spread alt"
float m_flInaccuracyCrouch; //0x0988 "inaccuracy crouch"
float m_flInaccuracyCrouchAlt; //0x098C "inaccuracy crouch alt"
float m_flInaccuracyStand; //0x0990 "inaccuracy stand"
float m_flInaccuracyStandAlt; //0x0994 "inaccuracy stand alt"
float m_flInaccuracyJump; //0x0998 "inaccuracy jump"
float m_flInaccuracyJumpAlt; //0x099C "inaccuracy jump alt"
float m_flInaccuracyLand; //0x09A0 "inaccuracy land"
float m_flInaccuracyLandAlt; //0x09A4 "inaccuracy land alt"
float m_flInaccuracyLadder; //0x09A8 "inaccuracy ladder"
float m_flInaccuracyLadderAlt; //0x09AC "inaccuracy ladder alt"
float m_flInaccuracyFire; //0x09B0 "inaccuracy fire"
float m_flInaccuracyFireAlt; //0x09B4 "inaccuracy fire alt"
float m_flInaccuracyMove; //0x09B8 "inaccuracy move"
float m_flInaccuracyMoveAlt; //0x09BC "inaccuracy move alt"
float m_flStandRecoveryTime; //0x09C0 "recovery time stand"
float m_flCrouchRecoveryTime; //0x09C4 "recovery time crouch"
float m_flInaccuracyReload; //0x09C8 "inaccuracy reload"
uint8_t pad_0x09CC[0x4]; //0x09CC
float m_flRecoilAngle; //0x09D0 "recoil angle"
float m_flRecoilAngleAlt; //0x09D4 "recoil angle alt"
float m_flRecoilAngleVariance; //0x09D8 "recoil angle variance"
float m_flRecoilAngleVarianceAlt; //0x09DC "recoil angle variance alt"
float m_flRecoilMagnitude; //0x09E0 "recoil magnitude"
float m_flRecoilMagnitudeAlt; //0x09E4 "recoil magnitude alt"
float m_flRecoilMagnitudeVariance; //0x09E8 "recoil magnitude variance"
float m_flRecoilMagnitudeVarianceAlt; //0x09EC "recoil magnitude variance alt"
int32_t m_iRecoilSeed; //0x09F0 "recoil seed"
float m_flFlinchVelocityModifierLarge; //0x09F4 "flinch velocity modifier large"
float m_flFlinchVelocityModifierSmall; //0x09F8 "flinch velocity modifier small"
float m_flTimeToIdle; //0x09FC "time to idle"
float m_flIdleInterval; //0x0A00 "idle interval"
uint8_t pad_0x0A04[0x400]; //0x0A04
int32_t m_iZoomLevels; //0x0E04 "zoom levels"
uint8_t pad_0x0E08[0x4]; //0x0E08
int32_t m_iZoomFoV1; //0x0E0C "zoom fov 1"
int32_t m_iZoomFoV2; //0x0E10 "zoom fov 2"
float m_flZoomTime0; //0x0E14 "zoom time 0"
float m_flZoomTime1; //0x0E18 "zoom time 1"
float m_flZoomTime2; //0x0E1C "zoom time 2"
uint8_t m_bHideViewModelZoomed; //0x0E20 "hide view model zoomed"
uint8_t pad_0x0E21[0xA7]; //0x0E21
bool m_bCanUseWithShield; //0x0EC8 "shield view model"
uint8_t pad_0x0EC9[0x17B]; //0x0EC9
};
*/
class WeaponInfo_t
{
public:
char _0x0000[4];
BYTE m_bParsedScript; //0x0004
BYTE m_bLoadedHudElements; //0x0005
BYTE m_szClassName; //0x0006
char _0x0007[1961];
__int32 m_iAmmoType; //0x07B0
char _0x07B4[12];
CHudTexture* m_pHudTexture_WeaponSilenced; //0x07C0
CHudTexture* m_pHudTexture_Weapon; //0x07C4
CHudTexture* m_pHudTexture_Ammo; //0x07C8
char _0x07CC[4];
CHudTexture* m_pHudTexture_Crosshair; //0x07D0
char _0x07D4[20];
__int32 m_iWeaponType; //0x07E8
__int32 m_iTeam; //0x07EC
__int32 m_iWeaponId; //0x07F0
BYTE m_bFullAuto; //0x07F4
char _0x07F5[3];
float m_flHeatPerShot; //0x07F8
__int32 m_iWeaponPrice; //0x07FC
float m_flArmorRatio; //0x0800
float m_flMaxPlayerSpeed; //0x0804
float m_flMaxPlayerSpeedAlt; //0x0808
__int32 m_iCrosshairMinDistance; //0x080C
__int32 m_iCrosshairDeltaDistance; //0x0810
float m_flPenetration; //0x0814
__int32 m_iDamage; //0x0818
float m_flRange; //0x081C
float m_flRangeModifier; //0x0820
__int32 m_iBullets; //0x0824
float m_flCycleTime; //0x0828
float m_flCycleTimeAlt; //0x082C
char _0x0830[416];
float m_flSpread; //0x09D0
float m_flSpreadAlt; //0x09D4
float m_flInaccuracyCrouch; //0x09D8
float m_flInaccuracyCrouchAlt; //0x09DC
float m_flInaccuracyStand; //0x09E0
float m_flInaccuracyStandAlt; //0x09E4
float m_flInaccuracyJump; //0x09E8
float m_flInaccuracyJumpAlt; //0x09EC
float m_flInaccuracyLand; //0x09F0
float m_flInaccuracyLandAlt; //0x09F4
float m_flInaccuracyLadder; //0x09F8
float m_flInaccuracyLadderAlt; //0x09FC
float m_flInaccuracyFire; //0x0A00
float m_flInaccuracyFireAlt; //0x0A04
float m_flInaccuracyMove; //0x0A08
float m_flInaccuracyMoveAlt; //0x0A0C
float m_flRecoveryTimeStand; //0x0A10
float m_flRecoveryTimeCrouch; //0x0A14
float m_flInaccuracyReload; //0x0A18
float m_flInaccuracyAltSwitch; //0x0A1C
float m_flRecoilAngle; //0x0A20
float m_flRecoilAngleAlt; //0x0A24
float m_flRecoilAngleVariance; //0x0A28
float m_flRecoilAngleVarianceAlt; //0x0A2C
float m_flRecoilMagnitude; //0x0A30
float m_flRecoilMagnitudeAlt; //0x0A34
float m_flRecoilMagnitudeVariance; //0x0A38
float m_flRecoilMagnitudeVarianceAlt; //0x0A3C
__int32 m_iRecoilSeed; //0x0A40
float m_flFlinchVelocityModifierLarge; //0x0A44
float m_flFlinchVelocityModifierSmall; //0x0A48
float m_flTimeToIdle; //0x0A4C
float m_flIdleInterval; //0x0A50 // 0x0828
};
class CBaseCombatWeapon
{
public:
char __pad[0x64];
int index;
model_t* GetModel();
Vector GetOrigin();
int& GetWeaponID();
float& GetNextPrimaryAttack();
float& GetAccuracyPenalty();
int& GetXUIDLow();
int& GetXUIDHigh();
int& GetEntityQuality();
int& GetAccountID();
int& GetItemIDHigh();
int& GetItemDefinitionIndex();
int& GetFallbackPaintKit();
int& GetFallbackStatTrak();
float& GetFallbackWear();
int GetModelIndex();
bool IsEmpty();
bool IsReloading();
bool GetOwner();
void UpdateAccuracyPenalty();
float GetWeaponSpread();
float GetWeaponCone();
WeaponInfo_t* GetCSWpnData();
bool IsGun();
std::string GetWeaponName();
int GetWeaponType();
bool IsScopedWeapon();
};
enum WEAPONCLASS
{
WEPCLASS_INVALID,
WEPCLASS_RIFLE,
WEPCLASS_PISTOL,
WEPCLASS_SHOTGUN,
WEPCLASS_SNIPER,
WEPCLASS_SMG,
WEPCLASS_MACHINEGUN,
WEPCLASS_KNIFE,
}; | 32.989967 | 99 | 0.727088 |
2d98750fd8d8a144b20566a249e275080d0d72fc | 1,837 | h | C | src/comb_sort.h | danesh-d/do-sort | 0664c41a366dd6161c64dc793f510f0fb66dd25a | [
"Apache-2.0"
] | null | null | null | src/comb_sort.h | danesh-d/do-sort | 0664c41a366dd6161c64dc793f510f0fb66dd25a | [
"Apache-2.0"
] | null | null | null | src/comb_sort.h | danesh-d/do-sort | 0664c41a366dd6161c64dc793f510f0fb66dd25a | [
"Apache-2.0"
] | null | null | null | #ifndef COMB_SORT_H
#define COMB_SORT_H
#include "do_sort.h"
using namespace std;
namespace do_sort {
// --- Heap sort.
template <class T>
class comb_sort : public sort<T> {
private:
float shrinkFactor;
int nextGap(int gap) {
gap = (int)(gap / shrinkFactor);
return gap < 1 ? 1 : gap;
}
protected:
void specific_do_sort() {
LL n = sort<T>::size();
if (n <= 1) {
return;
}
LL gap = n;
bool swapped = true;
// Loop over the input data until the gap is not equal to one and at
// at least one swap has been done during the last traverse.
while (gap != 1 || swapped) {
gap = nextGap(gap);
swapped = false;
// Sort the data within the current gap.
for (LL i = 0; i < n - gap; ++i) {
if (sort<T>::asc) {
if (sort<T>::v[i] > sort<T>::v[i + gap]) {
swap(sort<T>::v[i], sort<T>::v[i + gap]);
swapped = true;
}
} else {
if (sort<T>::v[i] < sort<T>::v[i + gap]) {
swap(sort<T>::v[i], sort<T>::v[i + gap]);
swapped = true;
}
}
}
}
}
public:
comb_sort() {
// This sorting algorithm is in fact an improvement to Bubble sort where
// inversions are removed one by one. In this algorithm a gap is used
// which is more than 1 (unlike Bubble sort with gap of size 1) so at
// each swap more then one inversion is removed. The gap size is reduced
// in each iteration by factor of 1.3 which is proven to be the best
// constant.
shrinkFactor = 1.3;
}
virtual ~comb_sort() {
}
};
}
#endif /* COMB_SORT_H */
| 25.164384 | 80 | 0.495373 |
eec36607b49e265f776e665775c8995395135fc0 | 2,153 | c | C | embedded/itm-etm/stlink-trace/Examples/Keil-simple/main.c | sniperkit/snk.fork.snippets | a1fef02a4eb62d659656b7f1105161338058b617 | [
"Unlicense"
] | null | null | null | embedded/itm-etm/stlink-trace/Examples/Keil-simple/main.c | sniperkit/snk.fork.snippets | a1fef02a4eb62d659656b7f1105161338058b617 | [
"Unlicense"
] | null | null | null | embedded/itm-etm/stlink-trace/Examples/Keil-simple/main.c | sniperkit/snk.fork.snippets | a1fef02a4eb62d659656b7f1105161338058b617 | [
"Unlicense"
] | null | null | null | #include <stdio.h>
#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
volatile uint32_t msTicks; /* counts 1ms timeTicks */
volatile uint32_t msDelayCount;
/*----------------------------------------------------------------------------
SysTick_Handler
*----------------------------------------------------------------------------*/
void SysTick_Handler(void) {
msTicks++;
if (msDelayCount > 0) msDelayCount--;
}
#define ITM_PORT *(volatile unsigned *)0xE0000000
static void msDelay(uint32_t ms) {
msDelayCount = ms;
while (msDelayCount > 0);
}
void GPIO_Configuration()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE);
// LED1 -> PB0 , LED2 -> PB1 , LED3 -> PB14 , LED4 -> PB15
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
void SendMsgViaITM(char* msg)
{
int pos = 0;
char ch;
while (msg[pos] != '\0') {
ch = msg[pos++];
while (ITM_PORT == 0); // Wait while Fifo full
ITM->PORT[0].u8 = ch;
}
}
int main(void)
{
long i = 0;
char buffer[100];
// configure and enable the SystTick interrupt
SysTick->LOAD = 0x000000C8*((8000000UL/8)/1000)-1; // set reload register
SysTick->CTRL = 0x00000006; // set clock source and Interrupt
SysTick->VAL = 0; // clear the counter
SysTick->CTRL |= ((unsigned long)0x00000001); // enable the counter
GPIO_Configuration(); // configure the IO pins for the LEDs
while (1) {
GPIO_SetBits(GPIOB , GPIO_Pin_0);
sprintf(&buffer[0], "Switched the LED on. Counter: %d\n", i);
SendMsgViaITM(buffer);
// msDelay(1);
GPIO_ResetBits(GPIOB , GPIO_Pin_0);
sprintf(&buffer[0], "Switched the LED off. Counter: %d\n", i);
SendMsgViaITM(buffer);
// msDelay(1);
i++;
}
}
| 27.253165 | 92 | 0.576405 |
7c52b7defd875368d2068d7ae8d3783a89880771 | 1,985 | h | C | gstreamer_tests/basic_tutorial/Gst/Pipeline.h | ermig1979/mmosbs | e009644c3e8294435e7909fc0b58372b6bb23a03 | [
"MIT"
] | 29 | 2019-03-12T04:34:34.000Z | 2020-04-21T19:02:30.000Z | gstreamer_tests/basic_tutorial/Gst/Pipeline.h | ermig1979/Examples | 729cfc82a28d3390314fab338d637549018ef6e1 | [
"MIT"
] | null | null | null | gstreamer_tests/basic_tutorial/Gst/Pipeline.h | ermig1979/Examples | 729cfc82a28d3390314fab338d637549018ef6e1 | [
"MIT"
] | 4 | 2020-08-25T04:32:17.000Z | 2021-12-18T09:47:51.000Z | #pragma once
#include "Common.h"
namespace Gst
{
class Pipeline
{
public:
Pipeline()
: _pipeline(NULL)
, _playing(false)
{
}
bool InitFromFile(const String& path)
{
String description = "playbin uri=file:///" + path;
_pipeline = gst_parse_launch(description.c_str(), NULL);
if (_pipeline == NULL)
{
std::cout << "Can't init pipline by file '" << path << "' !" << std::endl;
return false;
}
return true;
}
bool InitNew(const String& name)
{
_pipeline = gst_pipeline_new(name.c_str());
if (_pipeline == NULL)
{
std::cout << "Can't init new pipeline '" << name << "' !" << std::endl;
return false;
}
return true;
}
~Pipeline()
{
if (_pipeline)
{
if (_playing)
{
GstStateChangeReturn state = gst_element_set_state(_pipeline, GST_STATE_NULL);
if (state == GST_STATE_CHANGE_FAILURE)
std::cout << "Can't stop pipeline!" << std::endl;
}
gst_object_unref(_pipeline);
}
}
bool Play()
{
GstStateChangeReturn state = gst_element_set_state(_pipeline, GST_STATE_PLAYING);
if (state == GST_STATE_CHANGE_FAILURE)
{
std::cout << "Can't play pipeline!" << std::endl;
_playing = false;
}
else
_playing = true;
return _playing;
}
GstElement* Handler()
{
return _pipeline;
}
private:
GstElement* _pipeline;
bool _playing;
};
}
| 26.118421 | 99 | 0.426196 |
4073e3d26ca5cde9554c15b0106af2d84bd603b0 | 8,672 | h | C | src/game/Editor/Editor_Callback_Prototypes.h | FluffyQuack/ja2-stracciatella | 59781890986dc5360ed4b148b83836c029121d5f | [
"BSD-Source-Code"
] | 346 | 2016-02-16T11:17:25.000Z | 2022-03-28T18:18:14.000Z | src/game/Editor/Editor_Callback_Prototypes.h | FluffyQuack/ja2-stracciatella | 59781890986dc5360ed4b148b83836c029121d5f | [
"BSD-Source-Code"
] | 1,119 | 2016-02-14T23:19:56.000Z | 2022-03-31T21:57:58.000Z | src/game/Editor/Editor_Callback_Prototypes.h | FluffyQuack/ja2-stracciatella | 59781890986dc5360ed4b148b83836c029121d5f | [
"BSD-Source-Code"
] | 90 | 2016-02-17T22:17:11.000Z | 2022-03-12T11:59:56.000Z | #ifndef __EDITOR_CALLBACK_PROTOTYPES_H
#define __EDITOR_CALLBACK_PROTOTYPES_H
#include "Button_System.h"
// Editor Tabs
void TaskTerrainCallback(GUI_BUTTON *btn,INT32 reason);
void TaskBuildingCallback(GUI_BUTTON *btn,INT32 reason);
void TaskItemsCallback(GUI_BUTTON *btn,INT32 reason);
void TaskMercsCallback(GUI_BUTTON *btn,INT32 reason);
void TaskMapInfoCallback(GUI_BUTTON *btn,INT32 reason);
void TaskOptionsCallback(GUI_BUTTON *btn,INT32 reason);
// Options Tab Callbacks
void BtnLoadCallback(GUI_BUTTON *btn,INT32 reason);
void BtnSaveCallback(GUI_BUTTON *btn,INT32 reason);
void BtnCancelCallback(GUI_BUTTON *btn,INT32 reason);
void BtnQuitCallback( GUI_BUTTON *btn, INT32 reason );
void BtnNewMapCallback(GUI_BUTTON *btn,INT32 reason);
void BtnNewBasementCallback( GUI_BUTTON *btn, INT32 reason );
void BtnNewCavesCallback( GUI_BUTTON *btn, INT32 reason );
void BtnChangeTilesetCallback(GUI_BUTTON *btn,INT32 reason);
// Mercs Tab Callbacks
void MercsTogglePlayers( GUI_BUTTON *btn, INT32 reason );
void MercsToggleEnemies( GUI_BUTTON *btn, INT32 reason );
void MercsToggleCreatures( GUI_BUTTON *btn, INT32 reason );
void MercsToggleRebels( GUI_BUTTON *btn, INT32 reason );
void MercsToggleCivilians( GUI_BUTTON *btn, INT32 reason );
void MercsPlayerTeamCallback(GUI_BUTTON *btn,INT32 reason);
void MercsEnemyTeamCallback(GUI_BUTTON *btn,INT32 reason);
void MercsCreatureTeamCallback(GUI_BUTTON *btn,INT32 reason);
void MercsRebelTeamCallback(GUI_BUTTON *btn,INT32 reason);
void MercsCivilianTeamCallback(GUI_BUTTON *btn,INT32 reason);
void MercsDetailedPlacementCallback( GUI_BUTTON *btn, INT32 reason );
void MercsPriorityExistanceCallback( GUI_BUTTON *btn, INT32 reason );
void MercsHasKeysCallback( GUI_BUTTON *btn, INT32 reason );
void MercsNextCallback( GUI_BUTTON *btn, INT32 reason );
void MercsDeleteCallback( GUI_BUTTON *btn, INT32 reason );
void MercsGeneralModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsAttributesModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsInventoryModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsAppearanceModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsProfileModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetEnemyColorCodeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetOrdersCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetAttitudeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsDirectionSetCallback( GUI_BUTTON *btn, INT32 reason );
void MercsFindSelectedMercCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetRelativeEquipmentCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetRelativeAttributesCallback( GUI_BUTTON *btn, INT32 reason );
void MercsToggleColorModeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetColorsCallback( GUI_BUTTON *btn, INT32 reason );
void MercsSetBodyTypeCallback( GUI_BUTTON *btn, INT32 reason );
void MercsInventorySlotCallback( GUI_BUTTON *btn, INT32 reason );
void MouseMovedInMercRegion( MOUSE_REGION *reg, INT32 reason );
void MouseClickedInMercRegion( MOUSE_REGION *reg, INT32 reason );
void MercsCivilianGroupCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleAction1Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleAction2Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleAction3Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleAction4Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData1ACallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData1BCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData2ACallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData2BCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData3ACallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData3BCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData4ACallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleData4BCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleClearCallback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleToggleVariance1Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleToggleVariance2Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleToggleVariance3Callback( GUI_BUTTON *btn, INT32 reason );
void MercsScheduleToggleVariance4Callback( GUI_BUTTON *btn, INT32 reason );
// Terrain Tab Callbacks
void BtnLandRaiseCallback(GUI_BUTTON *btn,INT32 reason);
void BtnLandLowerCallback(GUI_BUTTON *btn,INT32 reason);
void BtnIncBrushDensityCallback(GUI_BUTTON *btn,INT32 reason);
void BtnDecBrushDensityCallback(GUI_BUTTON *btn,INT32 reason);
void BtnFgGrndCallback(GUI_BUTTON *btn,INT32 reason);
void BtnBkGrndCallback(GUI_BUTTON *btn,INT32 reason);
void BtnObjectCallback(GUI_BUTTON *btn,INT32 reason);
void BtnBanksCallback(GUI_BUTTON *btn,INT32 reason);
void BtnRoadsCallback(GUI_BUTTON *btn,INT32 reason);
void BtnDebrisCallback(GUI_BUTTON *btn,INT32 reason);
void BtnBrushCallback(GUI_BUTTON *btn,INT32 reason);
void BtnObject1Callback(GUI_BUTTON *btn,INT32 reason);
void BtnObject2Callback(GUI_BUTTON *btn,INT32 reason);
void BtnFillCallback(GUI_BUTTON *btn,INT32 reason);
void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason);
// Items Tab Callbacks
void ItemsWeaponsCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsAmmoCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsEquipment1Callback(GUI_BUTTON *btn,INT32 reason);
void ItemsEquipment2Callback(GUI_BUTTON *btn,INT32 reason);
void ItemsEquipment3Callback(GUI_BUTTON *btn,INT32 reason);
void ItemsTriggersCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsKeysCallback(GUI_BUTTON *btn, INT32 reason);
void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason);
void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason);
void MouseMovedInItemsRegion(MOUSE_REGION *reg, INT32 reason);
void MouseClickedInItemsRegion(MOUSE_REGION *reg, INT32 reason);
// MapInfo Callbacks
void BtnFakeLightCallback(GUI_BUTTON *btn,INT32 reason);
void MapInfoPrimeTimeRadioCallback( GUI_BUTTON *btn, INT32 reason );
void MapInfoNightTimeRadioCallback( GUI_BUTTON *btn, INT32 reason );
void MapInfo24HourTimeRadioCallback( GUI_BUTTON *btn, INT32 reason );
void BtnDrawLightsCallback(GUI_BUTTON *btn,INT32 reason);
void MapInfoDrawExitGridCallback( GUI_BUTTON *btn, INT32 reason );
void MapInfoEntryPointsCallback( GUI_BUTTON *btn, INT32 reason );
void MapInfoNormalRadioCallback( GUI_BUTTON *btn, INT32 reason );
void MapInfoBasementRadioCallback( GUI_BUTTON *btn, INT32 reason );
void MapInfoCavesRadioCallback( GUI_BUTTON *btn, INT32 reason );
// Building callbacks
void BuildingWallCallback( GUI_BUTTON *btn, INT32 reason );
void BuildingDoorCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingWindowCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingRoofCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingCrackWallCallback( GUI_BUTTON *btn, INT32 reason );
void BuildingFurnitureCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingDecalCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingFloorCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingToiletCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingSmartWallCallback( GUI_BUTTON *btn, INT32 reason );
void BuildingSmartDoorCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingSmartWindowCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingSmartCrackWallCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingDoorKeyCallback(GUI_BUTTON *btn, INT32 reason );
void BuildingNewRoomCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingNewRoofCallback(GUI_BUTTON *btn, INT32 reason );
void BuildingSawRoomCallback( GUI_BUTTON *btn, INT32 reason );
void BuildingKillBuildingCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingCopyBuildingCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingMoveBuildingCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingCaveDrawingCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingDrawRoomNumCallback(GUI_BUTTON *btn, INT32 reason);
void BuildingEraseRoomNumCallback( GUI_BUTTON *btn, INT32 reason );
void BuildingToggleRoofViewCallback(GUI_BUTTON *btn,INT32 reason);
void BuildingToggleWallViewCallback(GUI_BUTTON *btn,INT32 reason);
void BuildingToggleInfoViewCallback(GUI_BUTTON *btn,INT32 reason);
// ItemStats Callbacks
void ItemStatsToggleHideCallback( GUI_BUTTON *btn, INT32 reason );
void ItemStatsDeleteCallback( GUI_BUTTON *btn, INT32 reason );
// Various Callbacks
void BtnUndoCallback(GUI_BUTTON *btn,INT32 reason);
void BtnEraseCallback(GUI_BUTTON *btn,INT32 reason);
#endif
| 55.235669 | 75 | 0.82726 |
0b6c98b7ec5cffb7e90aa35eb530525f89c12f35 | 503 | h | C | Tinier Raytracer/src/Geometry/Plane.h | BenCKB/Raytracer | d75ca92cb6593c675d906c249c14efbe24e6cf44 | [
"MIT"
] | null | null | null | Tinier Raytracer/src/Geometry/Plane.h | BenCKB/Raytracer | d75ca92cb6593c675d906c249c14efbe24e6cf44 | [
"MIT"
] | null | null | null | Tinier Raytracer/src/Geometry/Plane.h | BenCKB/Raytracer | d75ca92cb6593c675d906c249c14efbe24e6cf44 | [
"MIT"
] | null | null | null | #pragma once
#include "BaseObject.h"
class Plane : public BaseObject {
public:
Vector3 m_origin;
Vector3 m_normal;
Plane(Vector3 origin, Vector3 normal) {
m_origin = origin;
m_normal = normal;
}
bool intersect(Ray* ray, float& t) {
float RdotN = dot(ray->direction, m_normal);
if (abs(RdotN) > 0.0000001f) {
Vector3 l = m_origin - ray->origin;
t = dot(l, m_normal) / RdotN;
return t >= 0;
}
return false;
}
Vector3 normal(Vector3 intersection) {
return m_normal;
}
}; | 17.964286 | 46 | 0.664016 |
3cb64a5f4477dd4a31a3de693d2679c3b4e8849e | 20,643 | h | C | clientd3d/resource.h | Darkman-M59/Meridian59_115 | 671b7ebe9fa2b1f40c8bd453652d596042291b90 | [
"FSFAP"
] | 1 | 2021-05-19T02:13:59.000Z | 2021-05-19T02:13:59.000Z | clientd3d/resource.h | siwithaneye/Meridian59 | 9dc8df728d41ba354c9b11574484da5b3e013a87 | [
"FSFAP"
] | null | null | null | clientd3d/resource.h | siwithaneye/Meridian59 | 9dc8df728d41ba354c9b11574484da5b3e013a87 | [
"FSFAP"
] | null | null | null | //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by client.rc
//
#define IDS_CANTINITSOCKET 1
#define IDS_CANTWRITE 2
#define IDS_COMERROR 3
#define IDOK2 3
#define IDS_MESSAGETOOLONG 4
#define IDCANCEL2 4
#define IDS_READOVERFLOW 5
#define IDS_NOHOSTNAME 6
#define IDS_NOPORTNUM 7
#define IDS_UNKNOWNRESOURCE 8
#define IDS_ONEINSTANCE 8
#define IDS_NOSERVERNUM 8
#define IDS_MISSINGRESOURCE 9
#define IDS_NOROOMFILE 10
#define IDS_ERRORRESOURCE 11
#define IDS_DUPRESOURCE 12
#define IDS_SOCKETOPEN 13
#define IDS_LOSTSERVER 14
#define IDS_SOCKETMESSAGE 15
#define IDS_DOWNLOADALL 17
#define IDS_CONFIGMENUEXE 18
#define IDS_CANTDELETEFILE 19
#define IDS_CANTWRITEFILE 20
#define IDS_UPLOADMSG 21
#define IDS_NOCONFIGMENUEXE 21
#define IDS_VERSIONERROR 23
#define IDS_CONNECTERROR 24
#define IDS_BADLOGIN 25
#define IDS_NOTIMERS 26
#define IDS_ACCOUNTUSED 27
#define IDS_SYSTEMDOWN 28
#define IDS_TOOMANYLOGINS 29
#define IDS_TIMEOUT 30
#define IDS_CANTRENAME 31
#define IDS_NOGAME 32
#define IDS_NOCREDITS 33
#define IDS_PASSWDMATCH 34
#define IDS_PASSWDLENGTH 35
#define IDS_PASSWDOK 36
#define IDS_PASSWDNOTOK 37
#define IDS_ABORTTRANSFER 38
#define IDS_ANNOTATIONSFULL 39
#define IDS_UNKNOWN 41
#define IDS_EMPTY 42
#define IDS_CRCERROR 44
#define IDS_GOTOFFER 45
#define IDS_WAITRESPONSE 46
#define IDS_QUIT 49
#define IDS_INVENTORY 50
#define IDS_LOGOFF 51
#define IDS_INUSE 52
#define IDS_MENUGAME 53
#define IDS_EXEFILTER 53
#define IDS_AGELESS 53
#define IDS_GETCLIENT 54
#define IDS_PASSWORDNOTCHANGED 54
#define IDS_GETRSC 55
#define IDS_UPLOAD 56
#define IDS_CHPASSWD 57
#define IDS_ADMIN 58
#define IDS_REGISTER 59
#define IDS_ADMINNOTE 60
#define IDS_HELP 61
#define IDS_MENULOGOFF 62
#define IDS_PASSWORDCHANGED 63
#define IDS_ADDRESS 64
#define IDS_PHONENUM 65
#define IDS_NAME 66
#define IDS_NOREGISTER 67
#define IDS_CHARNAME 68
#define IDS_UNPACKING 69
#define IDS_RETRIEVING 69
#define IDS_UNPACKINGPERCENT 70
#define IDS_CONNECTING 70
#define IDS_DOWNLOADING 71
#define IDS_GETTARGET 72
#define IDS_GET 73
#define IDS_LOOK 74
#define IDS_DROP 75
#define IDS_PUT1 76
#define IDS_PUT2 77
#define IDS_USE 78
#define IDS_UNUSE 79
#define IDS_ATTACK 80
#define IDS_OFFERTO 81
#define IDS_OFFERITEMS 82
#define IDS_APPLY 83
#define IDS_ACTIVATE 84
#define IDS_HTTPKEY 85
#define IDS_HELPFILE 86
#define IDS_BADCOMMAND 87
#define IDS_DECOMPRESSING 90
#define IDS_APPNAME 91
#define IDS_INIFILE 92
#define IDS_YES 93
#define IDS_NO 94
#define IDS_BUYFROM 95
#define IDS_CANTUPDATE 97
#define IDS_NEEDNEWVERSION 98
#define IDS_CANTMOVE 99
#define IDS_LONGCMDLINE 100
#define IDI_ICON 101
#define IDR_MAINMENU 102
#define IDD_PORTDLG 103
#define IDS_CANTMAKEDIR 103
#define IDC_ADMIN1 103
#define IDD_FTPERROR 103
#define IDC_ADMIN2 104
#define IDB_BACKGROUND 105
#define IDS_NORSCS 105
#define IDD_ITEMLISTSINGLE 106
#define IDS_CANTDELETE 106
#define IDD_SAY 107
#define IDS_CANTUNPACK 107
#define IDD_ITEMLISTMULTIPLE 108
#define IDS_TOOFEWCOLORS 108
#define IDS_BADLENGTH 109
#define IDD_DESC 110
#define IDS_NOCHARACTERS 110
#define IDS_TRANSMITERROR 111
#define IDS_CANTUNCOMPRESS 112
#define IDS_BADTEMPFILE 113
#define IDS_BADPERMISSION 114
#define IDS_BADMEM 115
#define IDD_COMM 116
#define IDS_BADARCHIVE 116
#define IDD_SETTINGS 116
#define IDD_COLOR 117
#define IDS_DISKFULL 117
#define IDD_OFFERSEND 118
#define IDS_BADARCHIVE2 118
#define IDD_LOGIN 119
#define IDS_MISSINGARCHIVE 119
#define IDD_ABOUT 120
#define IDS_UNKNOWNERROR 120
#define IDD_MAINMENU 121
#define IDS_GUEST 121
#define IDD_DOWNLOAD 122
#define IDS_GUESTFULL 122
#define IDD_PASSWORD 123
#define IDC_TARGETCURSOR 125
#define IDD_TIMEOUT 126
#define IDD_REGISTER 127
#define IDD_ADMINNOTE 128
#define IDS_NOSELLERS 128
#define IDS_NOOFFERERS 129
#define IDS_NOBROWSER 130
#define IDI_CLOCK 134
#define IDS_CANTFINDFILE 134
#define IDI_FORM 135
#define IDS_FTPFAILED 135
#define IDS_MISSINGFILE 136
#define IDB_INTRO 137
#define IDS_DEARCHIVEERROR 139
#define IDS_CANTINIT 141
#define IDS_NOCONNECTION 142
#define IDS_BADCALLBACK 143
#define IDS_CANTOPENFTPFILE 144
#define IDS_CANTWRITELOCALFILE 145
#define IDI_PHONE 146
#define IDS_CANTREADFTPFILE 146
#define IDI_OFFER 147
#define IDS_LATENCY0 147
#define IDD_MSGBOX 148
#define IDS_LATENCY1 148
#define IDS_LATENCY2 149
#define IDS_LATENCY3 150
#define IDS_LATENCY4 151
#define IDS_LATENCY5 152
#define IDS_LATENCY6 153
#define IDC_DROPCURSOR 154
#define IDS_LATENCY7 154
#define IDC_GETCURSOR 155
#define IDD_WHO 155
#define IDS_LATENCY8 155
#define IDC_CROSSCURSOR 156
#define IDC_INSIDECURSOR 157
#define IDS_LATENCYMETRIC 157
#define IDD_SERVERNUM 158
#define IDD_ANNOTATE 159
#define IDS_LAGBOXSUBNAME 159
#define IDB_ANNOTATE 160
#define IDS_LAGBOXURL 160
#define IDB_MAPBKGND 161
#define IDS_LAGBOXDESC 161
#define IDB_ABOUT 162
#define IDS_PROFANITYREMOVED 162
#define IDB_IMAGELIST 163
#define IDS_PROFANITYWARNING 163
#define IDB_BLUEWHO 164
#define IDS_HOMEPAGEURL 164
#define IDD_GUEST 166
#define IDA_DOWNLOAD 170
#define IDB_VIEWTREAT_TOPLEFT 171
#define IDB_VIEWTREAT_TOPRIGHT 172
#define IDB_VIEWTREAT_BOTTOMLEFT 173
#define IDB_VIEWTREAT_BOTTOMRIGHT 174
#define IDB_VIEWTREAT_TOPLEFT_HILIGHT 175
#define IDB_VIEWTREAT_TOPRIGHT_HILIGHT 176
#define IDB_VIEWTREAT_BOTTOMLEFT_HILIGHT 177
#define IDB_VIEWTREAT_BOTTOMRIGHT_HILIGHT 178
#define IDS_TARGETNOTVISIBLEFORATTACK 179
#define IDS_DEPOSIT_ITEMS 180
#define IDD_ASKDOWNLOAD 181
#define IDS_SERVICE_SUCCESS 181
#define IDD_CUSTOMER_SERVICE 182
#define IDS_SERVICE_FAILURE 182
#define ID_OPTIONS_LOGOUTTIMER 184
#define ID_OPTIONS_LOGOUTTIMER185 185
#define ID_CONFIGMENU 186
#define IDS_CANTSENDREQUEST 187
#define IDS_CANTGETFILESIZE 188
#define IDC_PORTNUM 1000
#define IDC_HOST 1001
#define IDC_ITEMLIST 1002
#define IDC_INSIDE 1003
#define IDC_SAYBOX 1004
#define IDC_FTPMESSAGE 1004
#define IDC_ACTIVATE 1004
#define IDC_MAINTEXT 1005
#define IDC_ALL 1008
#define IDC_DIALBUTTON 1009
#define IDC_DESCBOX 1010
#define IDC_DESCNAME 1011
#define IDC_DESCBITMAP 1012
#define IDC_DESCFIXED 1013
#define IDD_OFFERRECEIVE 1014
#define IDD_YELL 1015
#define IDC_NEXTMSG 1016
#define IDD_AMOUNT 1016
#define IDD_BUY 1017
#define IDC_DELETEMSG 1018
#define IDD_UPLOAD 1018
#define IDD_ITEMLISTSORTED 1018
#define IDD_ITEMLISTSIMPLE 1019
#define IDD_DESCPLAYER 1019
#define IDC_MAIN 1020
#define IDD_DOWNLOADAD 1020
#define IDC_BAUD9600 1023
#define IDC_BAUD19200 1024
#define IDC_BAUD2400 1025
#define IDC_PARITYNONE 1026
#define IDC_PARITYEVEN 1027
#define IDC_PARITYODD 1028
#define IDC_INITSTR 1033
#define IDC_BAUD38400 1034
#define IDC_NUMBER 1035
#define IDC_COM1 1036
#define IDC_COM2 1037
#define IDC_COM3 1038
#define IDC_COM4 1039
#define IDC_ITEMFIND 1042
#define IDC_TOOLBUTTON 1043
#define IDC_FOREGROUND 1044
#define IDC_BACKGROUND 1045
#define IDC_TEXTINPUT 1046
#define IDC_SAMPLETEXT 1047
#define IDC_OFFERSEND 1049
#define IDC_OFFERRECEIVE 1050
#define IDC_OFFEREDIT 1051
#define IDC_SETITEMS 1054
#define IDC_MESSAGE 1055
#define IDC_LOOKLABEL 1056
#define IDC_SAYLIST 1057
#define IDC_BUTTONGAME 1058
#define IDC_BUTTONROOM 1059
#define IDC_BUTTONGROUP 1060
#define IDC_MESSAGENUM 1063
#define IDC_AMOUNTBOX 1068
#define IDC_FRAME 1072
#define IDC_COSTLIST 1073
#define IDC_COST 1074
#define IDC_SELLER 1075
#define IDC_USERNAME 1076
#define IDC_QUANLIST 1076
#define IDC_PASSWORD 1077
#define IDC_HANGUP 1079
#define IDC_OK 1080
#define IDC_MAINLIST 1081
#define IDC_GUEST 1081
#define IDC_HOMEPAGE 1082
#define IDC_CREDITS 1083
#define IDC_SCREENSIZE 1085
#define IDC_FILESIZE 1087
#define IDC_BYTES 1088
#define IDC_PERCENT 1089
#define IDC_SPEED 1090
#define IDC_ERRORS 1092
#define IDC_COMMENT 1093
#define IDC_FILENAME 1095
#define IDC_OLDPASSWD 1096
#define IDC_NEWPASSWD1 1097
#define IDC_NEWPASSWD2 1098
#define IDC_TIMEOUTENABLE 1099
#define IDC_TIMEOUTMINUTES 1100
#define IDC_NAME 1101
#define IDC_ADDRESS1 1102
#define IDC_ADDRESS2 1103
#define IDC_ADDRESS3 1104
#define IDC_PHONE 1105
#define IDC_NOTEEDIT 1106
#define IDC_CHARLIST 1107
#define IDC_RESET 1109
#define IDC_CHARNAME 1111
#define IDC_TERMINALMODE 1112
#define IDC_ATTEMPTS 1114
#define IDC_LIST1 1115
#define IDC_USERLIST 1115
#define IDC_SUBJECT 1117
#define IDC_TIMEOUT 1117
#define IDC_EDIT 1117
#define IDC_SERVERNAME 1119
#define IDC_GROUPNAME 1121
#define IDC_REDIAL 1122
#define IDC_TEXT 1128
#define IDC_MSGBOXICON 1129
#define IDC_NETWORK 1130
#define IDC_GRAPH 1133
#define IDC_AUTOCONNECT 1134
#define IDC_TOOLTIP 1135
#define IDC_FILEGRAPH 1136
#define IDC_UNUSE 1137
#define IDC_DROP 1138
#define IDC_USE 1139
#define IDC_GET 1140
#define IDC_BROADCAST 1140
#define IDC_IGNOREALL 1141
#define IDC_APPLY 1141
#define IDC_DRAWNAMES 1143
#define IDC_SCROLLLOCK 1145
#define IDC_PAIN 1146
#define IDC_TOOLTIPS 1147
#define IDC_INVNUM 1148
#define IDC_SERVERNUM 1150
#define IDC_MUSIC 1150
#define IDC_SOUNDFX 1151
#define IDC_NUMPLAYERS 1152
#define IDC_LOOPSOUNDS 1152
#define IDC_SAFETY 1153
#define IDC_GUILD 1154
#define IDC_RANDSOUNDS 1154
#define IDC_BROWSER 1155
#define IDC_AGE 1155
#define IDC_URL 1156
#define IDC_URLBUTTON 1157
#define IDC_URLLABEL 1158
#define IDC_ADMIN 1159
#define IDC_ANNOTATE 1160
#define IDC_DELETE 1161
#define IDC_FIND 1162
#define IDC_BOUNCE 1163
#define IDC_AGELABEL 1164
#define IDC_PROFANESETTINGS 1164
#define IDC_TOOLBAR 1165
#define IDD_WITHDRAWAL 1165
#define ID_DESCNAME 1166
#define IDC_SCROLL 1167
#define IDC_SPECIAL1 1168
#define IDC_SPECIAL2 1169
#define IDC_GUESTBAR 1170
#define IDC_ANIMATE1 1171
#define IDC_AGELABEL2 1172
#define IDC_PROFANE 1173
#define IDC_RADIO1 1174
#define IDC_RADIO2 1175
#define IDC_EDIT1 1176
#define IDC_BUTTON1 1177
#define IDC_BUTTON2 1178
#define IDC_CHECK1 1179
#define IDC_TARGETHALO1 1180
#define IDC_TARGETHALO2 1181
#define IDC_SPIN1 1181
#define IDC_TARGETHALO3 1182
#define IDC_NEXT 1182
#define IDC_PREV 1183
#define IDC_SPARKS 1184
#define IDC_BTN_DEMO 1189
#define IDC_ASK_DOWNLOAD_REASON 1191
#define IDC_UPDATE 1192
#define IDC_SIZE_UPDATE 1193
#define IDC_TIME_UPDATE_566 1194
#define IDC_TIME_UPDATE_288 1195
#define IDC_NEW_TO_MERIDIAN_59 1196
#define IDC_VALE 1197
#define IDC_REVELATIONS 1198
#define IDC_DRAWMAP 1198
#define IDC_ORIGINAL 1199
#define IDC_COLORCODES 1199
#define IDC_STATIC1 1199
#define IDC_CAPTION 1200
#define IDC_RICHEDIT1 1201
#define IDC_MAP_ANNOTATIONS 1202
#define IDC_SOUND_VOLUME 1205
#define IDC_MUSIC_VOLUME 1206
#define IDC_SOUND_VOLUME2 1207
#define ID_GAME_EXIT 3002
#define ID_FONT_MAIL 3014
#define ID_FONT_LIST 3015
#define ID_FONT_GAMETEXT 3016
#define ID_FONT_TITLES 3017
#define ID_FONT_STATISTICS 3019
#define ID_FONT_MAINBUTTONS 3020
#define ID_OPTIONS_SAVEEXIT 3021
#define ID_COLOR_MAIN 3024
#define ID_COLOR_DEFAULTS 3025
#define ID_FONT_DEFAULTS 3026
#define ID_COLOR_LISTSEL 3027
#define ID_COLOR_MAIL 3028
#define ID_OPTIONS_SAVENOW 3029
#define ID_COLOR_HIGHLIGHT 3030
#define ID_COLOR_TEXT 3032
#define ID_OPTIONS_SOUND 3033
#define ID_OPTIONS_MUSIC 3034
#define ID_COLOR_DIALOG 3035
#define ID_HELP_CONTENTS 3036
#define ID_HELP_ABOUT 3037
#define ID_FONT_MENU 3038
#define ID_COLOR_EDIT 3039
#define ID_COLOR_LIST 3042
#define ID_FONT_INPUT 3043
#define ID_FONT_RMTITLE 3044
#define ID_COLOR_ROOMTITLE 3045
#define ID_COLOR_STATS 3047
#define ID_FONT_INVENTORY 3049
#define ID_FONT_LABELS 3049
#define ID_COLOR_INVENTORY 3050
#define ID_COLOR_INVNUM 3050
#define ID_COLOR_INVENTORYSEL 3051
#define ID_OPTIONS_TIMEOUT 3052
#define ID_OPTIONS_AREA 3057
#define ID_GAME_SETTINGS 3060
#define ID_GAME_CONNECT 3061
#define ID_GAME_DISCONNECT 3062
#define ID_OPTIONS_ANIMATION 3064
#define ID_COLOR_BAR1 3500
#define ID_COLOR_BAR2 3501
#define ID_COLOR_BAR3 3502
#define ID_OPTIONS_DRAWNAMES 3503
#define ID_COLOR_SYSMSG 3504
#define ID_COLOR_BAR4 3505
#define ID_GAME_PASSWORD 3506
#define ID_GAME_PRINTMAP 3507
#define ID_OPTIONS_FONT_MAP_TITLE 3508
#define ID_OPTIONS_FONT_MAP_LABEL 3509
#define ID_OPTIONS_FONT_MAP_TEXT 3510
#define ID_HELP_REQUEST_CS 3511
#define IDM_DRAW_MAP 3512
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 187
#define _APS_NEXT_COMMAND_VALUE 3513
#define _APS_NEXT_CONTROL_VALUE 1206
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
| 44.585313 | 48 | 0.502979 |
5698dafc9d492759f42a0c60288ac876ca57ec67 | 577 | h | C | Diablo/src/effects.h | Chronimal/devilution | a7ef09e1403771f0b27d9fa1c7e5f04e8a26f9e8 | [
"Unlicense"
] | null | null | null | Diablo/src/effects.h | Chronimal/devilution | a7ef09e1403771f0b27d9fa1c7e5f04e8a26f9e8 | [
"Unlicense"
] | null | null | null | Diablo/src/effects.h | Chronimal/devilution | a7ef09e1403771f0b27d9fa1c7e5f04e8a26f9e8 | [
"Unlicense"
] | null | null | null | /**
* @file effects.h
*
* Interface of functions for loading and playing sounds.
*/
#ifndef __EFFECTS_H__
#define __EFFECTS_H__
extern int sfxdelay;
extern int sfxdnum;
BOOL effect_is_playing(int nSFX);
void stream_stop();
void InitMonsterSND(int monst);
void FreeMonsterSnd();
void PlayEffect(int i, int mode);
void PlaySFX(int psfx);
void PlaySfxLoc(int psfx, int x, int y);
void sound_stop();
void sound_update();
void effects_cleanup_sfx();
void sound_init();
void ui_sound_init();
void __stdcall effects_play_sound(const char* snd_file);
#endif /* __EFFECTS_H__ */
| 21.37037 | 57 | 0.759099 |
484e430d23c42cebf915c1bff7681065158a83cc | 4,875 | c | C | headers/clang_wmmintrin.c | mikhailramalho/reduce | 10be1bac0d1537d2edcb89baf8fbcf8fb42ff2b9 | [
"MIT"
] | 1 | 2018-07-05T17:40:34.000Z | 2018-07-05T17:40:34.000Z | headers/clang_wmmintrin.c | mikhailramalho/reduce | 10be1bac0d1537d2edcb89baf8fbcf8fb42ff2b9 | [
"MIT"
] | null | null | null | headers/clang_wmmintrin.c | mikhailramalho/reduce | 10be1bac0d1537d2edcb89baf8fbcf8fb42ff2b9 | [
"MIT"
] | null | null | null | char clang_wmmintrin_buf [] = {
47,42,61,61,61,45,45,45,45,32,119,109,109,105,110,116,
114,105,110,46,104,32,45,32,65,69,83,32,105,110,116,114,
105,110,115,105,99,115,32,45,45,45,45,45,45,45,45,45,
45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
45,45,45,45,45,45,45,45,45,45,45,61,61,61,10,32,
42,10,32,42,32,80,101,114,109,105,115,115,105,111,110,32,
105,115,32,104,101,114,101,98,121,32,103,114,97,110,116,101,
100,44,32,102,114,101,101,32,111,102,32,99,104,97,114,103,
101,44,32,116,111,32,97,110,121,32,112,101,114,115,111,110,
32,111,98,116,97,105,110,105,110,103,32,97,32,99,111,112,
121,10,32,42,32,111,102,32,116,104,105,115,32,115,111,102,
116,119,97,114,101,32,97,110,100,32,97,115,115,111,99,105,
97,116,101,100,32,100,111,99,117,109,101,110,116,97,116,105,
111,110,32,102,105,108,101,115,32,40,116,104,101,32,34,83,
111,102,116,119,97,114,101,34,41,44,32,116,111,32,100,101,
97,108,10,32,42,32,105,110,32,116,104,101,32,83,111,102,
116,119,97,114,101,32,119,105,116,104,111,117,116,32,114,101,
115,116,114,105,99,116,105,111,110,44,32,105,110,99,108,117,
100,105,110,103,32,119,105,116,104,111,117,116,32,108,105,109,
105,116,97,116,105,111,110,32,116,104,101,32,114,105,103,104,
116,115,10,32,42,32,116,111,32,117,115,101,44,32,99,111,
112,121,44,32,109,111,100,105,102,121,44,32,109,101,114,103,
101,44,32,112,117,98,108,105,115,104,44,32,100,105,115,116,
114,105,98,117,116,101,44,32,115,117,98,108,105,99,101,110,
115,101,44,32,97,110,100,47,111,114,32,115,101,108,108,10,
32,42,32,99,111,112,105,101,115,32,111,102,32,116,104,101,
32,83,111,102,116,119,97,114,101,44,32,97,110,100,32,116,
111,32,112,101,114,109,105,116,32,112,101,114,115,111,110,115,
32,116,111,32,119,104,111,109,32,116,104,101,32,83,111,102,
116,119,97,114,101,32,105,115,10,32,42,32,102,117,114,110,
105,115,104,101,100,32,116,111,32,100,111,32,115,111,44,32,
115,117,98,106,101,99,116,32,116,111,32,116,104,101,32,102,
111,108,108,111,119,105,110,103,32,99,111,110,100,105,116,105,
111,110,115,58,10,32,42,10,32,42,32,84,104,101,32,97,
98,111,118,101,32,99,111,112,121,114,105,103,104,116,32,110,
111,116,105,99,101,32,97,110,100,32,116,104,105,115,32,112,
101,114,109,105,115,115,105,111,110,32,110,111,116,105,99,101,
32,115,104,97,108,108,32,98,101,32,105,110,99,108,117,100,
101,100,32,105,110,10,32,42,32,97,108,108,32,99,111,112,
105,101,115,32,111,114,32,115,117,98,115,116,97,110,116,105,
97,108,32,112,111,114,116,105,111,110,115,32,111,102,32,116,
104,101,32,83,111,102,116,119,97,114,101,46,10,32,42,10,
32,42,32,84,72,69,32,83,79,70,84,87,65,82,69,32,
73,83,32,80,82,79,86,73,68,69,68,32,34,65,83,32,
73,83,34,44,32,87,73,84,72,79,85,84,32,87,65,82,
82,65,78,84,89,32,79,70,32,65,78,89,32,75,73,78,
68,44,32,69,88,80,82,69,83,83,32,79,82,10,32,42,
32,73,77,80,76,73,69,68,44,32,73,78,67,76,85,68,
73,78,71,32,66,85,84,32,78,79,84,32,76,73,77,73,
84,69,68,32,84,79,32,84,72,69,32,87,65,82,82,65,
78,84,73,69,83,32,79,70,32,77,69,82,67,72,65,78,
84,65,66,73,76,73,84,89,44,10,32,42,32,70,73,84,
78,69,83,83,32,70,79,82,32,65,32,80,65,82,84,73,
67,85,76,65,82,32,80,85,82,80,79,83,69,32,65,78,
68,32,78,79,78,73,78,70,82,73,78,71,69,77,69,78,
84,46,32,73,78,32,78,79,32,69,86,69,78,84,32,83,
72,65,76,76,32,84,72,69,10,32,42,32,65,85,84,72,
79,82,83,32,79,82,32,67,79,80,89,82,73,71,72,84,
32,72,79,76,68,69,82,83,32,66,69,32,76,73,65,66,
76,69,32,70,79,82,32,65,78,89,32,67,76,65,73,77,
44,32,68,65,77,65,71,69,83,32,79,82,32,79,84,72,
69,82,10,32,42,32,76,73,65,66,73,76,73,84,89,44,
32,87,72,69,84,72,69,82,32,73,78,32,65,78,32,65,
67,84,73,79,78,32,79,70,32,67,79,78,84,82,65,67,
84,44,32,84,79,82,84,32,79,82,32,79,84,72,69,82,
87,73,83,69,44,32,65,82,73,83,73,78,71,32,70,82,
79,77,44,10,32,42,32,79,85,84,32,79,70,32,79,82,
32,73,78,32,67,79,78,78,69,67,84,73,79,78,32,87,
73,84,72,32,84,72,69,32,83,79,70,84,87,65,82,69,
32,79,82,32,84,72,69,32,85,83,69,32,79,82,32,79,
84,72,69,82,32,68,69,65,76,73,78,71,83,32,73,78,
10,32,42,32,84,72,69,32,83,79,70,84,87,65,82,69,
46,10,32,42,10,32,42,61,61,61,45,45,45,45,45,45,
45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
45,61,61,61,10,32,42,47,10,10,35,105,102,110,100,101,
102,32,95,87,77,77,73,78,84,82,73,78,95,72,10,35,
100,101,102,105,110,101,32,95,87,77,77,73,78,84,82,73,
78,95,72,10,10,35,105,110,99,108,117,100,101,32,60,101,
109,109,105,110,116,114,105,110,46,104,62,10,10,35,105,110,
99,108,117,100,101,32,60,95,95,119,109,109,105,110,116,114,
105,110,95,97,101,115,46,104,62,10,10,35,105,110,99,108,
117,100,101,32,60,95,95,119,109,109,105,110,116,114,105,110,
95,112,99,108,109,117,108,46,104,62,10,10,35,101,110,100,
105,102,32,47,42,32,95,87,77,77,73,78,84,82,73,78,
95,72,32,42,47,10,
};
unsigned int clang_wmmintrin_buf_size = sizeof(clang_wmmintrin_buf);
| 52.419355 | 68 | 0.690667 |
ad884c135314d76cb766d2022d615662ea27428d | 2,684 | h | C | tools/testing/selftests/arm64/signal/testcases/testcases.h | CPU-Code/-Linux_kernel | 44dc3358bc640197528f5b10dbed0fd3717af65b | [
"AFL-3.0"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | src/linux/tools/testing/selftests/arm64/signal/testcases/testcases.h | lukedsmalley/oo-kernel-hacking | 57161ae3e8a780a72b475b3c27fec8deef83b8e1 | [
"MIT"
] | 13 | 2021-07-10T04:36:17.000Z | 2022-03-03T10:50:05.000Z | src/linux/tools/testing/selftests/arm64/signal/testcases/testcases.h | lukedsmalley/oo-kernel-hacking | 57161ae3e8a780a72b475b3c27fec8deef83b8e1 | [
"MIT"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | /* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2019 ARM Limited */
#ifndef __TESTCASES_H__
#define __TESTCASES_H__
#include <stddef.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <ucontext.h>
#include <signal.h>
/* Architecture specific sigframe definitions */
#include <asm/sigcontext.h>
#define FPSIMD_CTX (1 << 0)
#define SVE_CTX (1 << 1)
#define EXTRA_CTX (1 << 2)
#define KSFT_BAD_MAGIC 0xdeadbeef
#define HDR_SZ \
sizeof(struct _aarch64_ctx)
#define GET_SF_RESV_HEAD(sf) \
(struct _aarch64_ctx *)(&(sf).uc.uc_mcontext.__reserved)
#define GET_SF_RESV_SIZE(sf) \
sizeof((sf).uc.uc_mcontext.__reserved)
#define GET_UCP_RESV_SIZE(ucp) \
sizeof((ucp)->uc_mcontext.__reserved)
#define ASSERT_BAD_CONTEXT(uc) do { \
char *err = NULL; \
if (!validate_reserved((uc), GET_UCP_RESV_SIZE((uc)), &err)) { \
if (err) \
fprintf(stderr, \
"Using badly built context - ERR: %s\n",\
err); \
} else { \
abort(); \
} \
} while (0)
#define ASSERT_GOOD_CONTEXT(uc) do { \
char *err = NULL; \
if (!validate_reserved((uc), GET_UCP_RESV_SIZE((uc)), &err)) { \
if (err) \
fprintf(stderr, \
"Detected BAD context - ERR: %s\n", err);\
abort(); \
} else { \
fprintf(stderr, "uc context validated.\n"); \
} \
} while (0)
/*
* A simple record-walker for __reserved area: it walks through assuming
* only to find a proper struct __aarch64_ctx header descriptor.
*
* Instead it makes no assumptions on the content and ordering of the
* records, any needed bounds checking must be enforced by the caller
* if wanted: this way can be used by caller on any maliciously built bad
* contexts.
*
* head->size accounts both for payload and header _aarch64_ctx size !
*/
#define GET_RESV_NEXT_HEAD(h) \
(struct _aarch64_ctx *)((char *)(h) + (h)->size)
struct fake_sigframe {
siginfo_t info;
ucontext_t uc;
};
bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err);
bool validate_extra_context(struct extra_context *extra, char **err);
struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic,
size_t resv_sz, size_t *offset);
static inline struct _aarch64_ctx *get_terminator(struct _aarch64_ctx *head,
size_t resv_sz,
size_t *offset)
{
return get_header(head, 0, resv_sz, offset);
}
static inline void write_terminator_record(struct _aarch64_ctx *tail)
{
if (tail) {
tail->magic = 0;
tail->size = 0;
}
}
struct _aarch64_ctx *get_starting_head(struct _aarch64_ctx *shead,
size_t need_sz, size_t resv_sz,
size_t *offset);
#endif
| 25.561905 | 76 | 0.674739 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.