text stringlengths 4 6.14k |
|---|
/**
* Copyright (c) 2015-present, Facebook, 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.
*/
#import <UIKit/UIKit.h>
extern float const kFlipTransitionDuration;
extern int const kFlipTransitionType;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic) bool shouldRotate;
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UIViewController *mainViewController;
@property (nonatomic, strong) UIViewController *appViewController;
@end
|
/*************************************************************************/
/* rasterizer_canvas_gles3.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* 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 RASTERIZERCANVASGLES3_H
#define RASTERIZERCANVASGLES3_H
#include "rasterizer_storage_gles3.h"
#include "servers/visual/rasterizer.h"
#include "shaders/canvas_shadow.glsl.gen.h"
class RasterizerSceneGLES3;
class RasterizerCanvasGLES3 : public RasterizerCanvas {
public:
struct CanvasItemUBO {
float projection_matrix[16];
float time;
};
RasterizerSceneGLES3 *scene_render;
struct Data {
GLuint canvas_quad_vertices;
GLuint canvas_quad_array;
GLuint polygon_buffer;
GLuint polygon_buffer_quad_arrays[4];
GLuint polygon_buffer_pointer_array;
GLuint polygon_index_buffer;
GLuint particle_quad_vertices;
GLuint particle_quad_array;
uint32_t polygon_buffer_size;
} data;
struct State {
CanvasItemUBO canvas_item_ubo_data;
GLuint canvas_item_ubo;
bool canvas_texscreen_used;
CanvasShaderGLES3 canvas_shader;
CanvasShadowShaderGLES3 canvas_shadow_shader;
bool using_texture_rect;
bool using_ninepatch;
RID current_tex;
RID current_normal;
RasterizerStorageGLES3::Texture *current_tex_ptr;
Transform vp;
Color canvas_item_modulate;
Transform2D extra_matrix;
Transform2D final_transform;
} state;
RasterizerStorageGLES3 *storage;
struct LightInternal : public RID_Data {
struct UBOData {
float light_matrix[16];
float local_matrix[16];
float shadow_matrix[16];
float color[4];
float shadow_color[4];
float light_pos[2];
float shadowpixel_size;
float shadow_gradient;
float light_height;
float light_outside_alpha;
float shadow_distance_mult;
} ubo_data;
GLuint ubo;
};
RID_Owner<LightInternal> light_internal_owner;
virtual RID light_internal_create();
virtual void light_internal_update(RID p_rid, Light *p_light);
virtual void light_internal_free(RID p_rid);
virtual void canvas_begin();
virtual void canvas_end();
_FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable, bool p_ninepatch = false);
_FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map);
_FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs);
_FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);
_FORCE_INLINE_ void _draw_generic(GLuint p_primitive, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);
_FORCE_INLINE_ void _canvas_item_render_commands(Item *p_item, Item *current_clip, bool &reclip);
_FORCE_INLINE_ void _copy_texscreen(const Rect2 &p_rect);
virtual void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light);
virtual void canvas_debug_viewport_shadows(Light *p_lights_with_shadow);
virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache);
virtual void reset_canvas();
void draw_generic_textured_rect(const Rect2 &p_rect, const Rect2 &p_src);
void initialize();
void finalize();
RasterizerCanvasGLES3();
};
#endif // RASTERIZERCANVASGLES3_H
|
#ifndef org_tartarus_snowball_ext_KpStemmer_H
#define org_tartarus_snowball_ext_KpStemmer_H
#include "org/tartarus/snowball/SnowballProgram.h"
namespace java {
namespace lang {
class Object;
class Class;
}
}
template<class T> class JArray;
namespace org {
namespace tartarus {
namespace snowball {
namespace ext {
class KpStemmer : public ::org::tartarus::snowball::SnowballProgram {
public:
enum {
mid_init$_54c6a166,
mid_equals_290588e2,
mid_hashCode_54c6a179,
mid_stem_54c6a16a,
max_mid
};
static ::java::lang::Class *class$;
static jmethodID *mids$;
static bool live$;
static jclass initializeClass(bool);
explicit KpStemmer(jobject obj) : ::org::tartarus::snowball::SnowballProgram(obj) {
if (obj != NULL)
env->getClass(initializeClass);
}
KpStemmer(const KpStemmer& obj) : ::org::tartarus::snowball::SnowballProgram(obj) {}
KpStemmer();
jboolean equals(const ::java::lang::Object &) const;
jint hashCode() const;
jboolean stem() const;
};
}
}
}
}
#include <Python.h>
namespace org {
namespace tartarus {
namespace snowball {
namespace ext {
extern PyTypeObject PY_TYPE(KpStemmer);
class t_KpStemmer {
public:
PyObject_HEAD
KpStemmer object;
static PyObject *wrap_Object(const KpStemmer&);
static PyObject *wrap_jobject(const jobject&);
static void install(PyObject *module);
static void initialize(PyObject *module);
};
}
}
}
}
#endif
|
#define __SYSCALL_LL_E(x) \
((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
static inline long __syscall0(long n)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3");
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "=r"(r3)
:: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
return r3;
}
static inline long __syscall1(long n, long a)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3") = a;
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "+r"(r3)
:: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
return r3;
}
static inline long __syscall2(long n, long a, long b)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3") = a;
register long r4 __asm__("r4") = b;
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "+r"(r3), "+r"(r4)
:: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
return r3;
}
static inline long __syscall3(long n, long a, long b, long c)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3") = a;
register long r4 __asm__("r4") = b;
register long r5 __asm__("r5") = c;
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
:: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
return r3;
}
static inline long __syscall4(long n, long a, long b, long c, long d)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3") = a;
register long r4 __asm__("r4") = b;
register long r5 __asm__("r5") = c;
register long r6 __asm__("r6") = d;
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
:: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");
return r3;
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3") = a;
register long r4 __asm__("r4") = b;
register long r5 __asm__("r5") = c;
register long r6 __asm__("r6") = d;
register long r7 __asm__("r7") = e;
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
:: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");
return r3;
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
register long r0 __asm__("r0") = n;
register long r3 __asm__("r3") = a;
register long r4 __asm__("r4") = b;
register long r5 __asm__("r5") = c;
register long r6 __asm__("r6") = d;
register long r7 __asm__("r7") = e;
register long r8 __asm__("r8") = f;
__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
:: "memory", "cr0", "r9", "r10", "r11", "r12");
return r3;
}
#define SYSCALL_FADVISE_6_ARG
#define SO_RCVTIMEO_OLD 18
#define SO_SNDTIMEO_OLD 19
|
/************************************************************
* <bsn.cl fy=2014 v=epl>
*
* Copyright 2014 Big Switch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
*
* 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.
*
* </bsn.cl>
************************************************************
*
*
*
********************************************************//**
*
* orc Doxygen Header
*
***********************************************************/
#ifndef __ORC_DOX_H__
#define __ORC_DOX_H__
/**
* @defgroup orc orc - orc Description
*
The documentation overview for this module should go here.
*
* @{
*
* @defgroup orc-orc Public Interface
* @defgroup orc-config Compile Time Configuration
* @defgroup orc-porting Porting Macros
*
* @}
*
*/
#endif /* __ORC_DOX_H__ */
|
/* This file is part of the KDE project
Copyright (C) 2003, 2006 Jarosław Staniek <staniek@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KEXIDB_ROWEDITBUFFER_H
#define KEXIDB_ROWEDITBUFFER_H
#include <QMap>
#include "field.h"
#include "queryschema.h"
namespace KexiDB
{
/*! @short provides data for single edited database row
KexiDB::RowEditBuffer provides data for single edited row,
needed to perform update at the database backend.
Its advantage over pasing e.g. KexiDB::FieldList object is that
EditBuffer contains only changed values.
EditBuffer offers two modes: db-aware and not-db-aware.
Db-aware buffer addresses a field using references to QueryColumnInfo object,
while not-db-aware buffer addresses a field using its name.
Example usage of not-db-aware buffer:
<code>
QuerySchema *query = .....
EditBuffer buf;
buf.insert("name", "Joe");
buf.insert("surname", "Black");
buf.at("name"); //returns "Joe"
buf.at("surname"); //returns "Black"
buf.at(query->field("surname")); //returns "Black" too
// Now you can use buf to add or edit records using
// KexiDB::Connection::updateRow(), KexiDB::Connection::insertRow()
</code>
Example usage of db-aware buffer:
<code>
QuerySchema *query = .....
QueryColumnInfo *ci1 = ....... //e.g. can be obtained from QueryScehma::fieldsExpanded()
QueryColumnInfo *ci2 = .......
EditBuffer buf;
buf.insert(*ci1, "Joe");
buf.insert(*ci2, "Black");
buf.at(*ci1); //returns "Joe"
buf.at(*ci2); //returns "Black"
// Now you can use buf to add or edit records using
// KexiDB::Connection::updateRow(), KexiDB::Connection::insertRow()
</code>
You can use QMap::clear() to clear buffer contents,
QMap::isEmpty() to see if buffer is empty.
For more, see QMap documentation.
Notes: added fields should come from the same (common) QuerySchema object.
However, this isn't checked at QValue& EditBuffer::operator[]( const Field& f ) level.
*/
class CALLIGRADB_EXPORT RowEditBuffer
{
public:
typedef QMap<QString, QVariant> SimpleMap;
typedef QMap<QueryColumnInfo*, QVariant> DBMap;
explicit RowEditBuffer(bool dbAwareBuffer);
~RowEditBuffer();
inline bool isDBAware() const {
return m_dbBuffer != 0;
}
void clear();
bool isEmpty() const;
//! Inserts value \a val for db-aware buffer's column \a ci
inline void insert(QueryColumnInfo& ci, QVariant &val) {
if (m_dbBuffer) {
m_dbBuffer->insert(&ci, val);
m_defaultValuesDbBuffer->remove(&ci);
}
}
//! Inserts value \a val for not-db-aware buffer's column \a fname
inline void insert(const QString& fname, QVariant &val) {
if (m_simpleBuffer) m_simpleBuffer->insert(fname, val);
}
//! Removes value from db-aware buffer's column \a ci
void removeAt(QueryColumnInfo& ci);
//! Removes value from not-db-aware buffer's column \a fname
void removeAt(Field& f);
//! Removes value from not-db-aware buffer's column \a fname
void removeAt(const QString& fname);
/*! Useful only for db-aware buffer. \return value for column \a ci
If there is no value assigned for the buffer, this method tries to remember and return
default value obtained from \a ci if \a useDefaultValueIfPossible is true.
Note that if the column is declared as unique (especially: primary key),
default value will not be used. */
const QVariant* at(QueryColumnInfo& ci, bool useDefaultValueIfPossible = true) const;
//! Useful only for not-db-aware buffer. \return value for field \a f
const QVariant* at(Field& f) const;
//! Useful only for not-db-aware buffer. \return value for field \a fname
const QVariant* at(const QString& fname) const;
//! Useful only for db-aware buffer: \return true if the value available as
//! at( ci ) is obtained from column's default value
inline bool hasDefaultValueAt(QueryColumnInfo& ci) const {
return m_defaultValuesDbBuffer->contains(&ci) && (*m_defaultValuesDbBuffer)[ &ci ];
}
inline const SimpleMap simpleBuffer() {
return *m_simpleBuffer;
}
inline const DBMap dbBuffer() {
return *m_dbBuffer;
}
//! For debugging purposes
void debug();
protected:
SimpleMap *m_simpleBuffer;
SimpleMap::ConstIterator *m_simpleBufferIt;
DBMap *m_dbBuffer;
DBMap::Iterator *m_dbBufferIt;
QMap<QueryColumnInfo*, bool> *m_defaultValuesDbBuffer;
QMap<QueryColumnInfo*, bool>::ConstIterator *m_defaultValuesDbBufferIt;
};
} //namespace KexiDB
#endif
|
/*
* This source code is part of
*
* G R O M A C S
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2009, The GROMACS Development Team
*
* Gromacs is a library for molecular simulation and trajectory analysis,
* written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
* a full list of developers and information, check out http://www.gromacs.org
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
* As a special exception, you may use this file as part of a free software
* library without restriction. Specifically, if other files instantiate
* templates or use macros or inline functions from this file, or you compile
* this file and link it with other files to produce an executable, this
* file does not by itself cause the resulting executable to be covered by
* the GNU Lesser General Public License.
*
* In plain-speak: do not worry about classes/macros/templates either - only
* changes to the library have to be LGPL, not an application linking with it.
*
* To help fund GROMACS development, we humbly ask that you cite
* the papers people have written on it - you can find them on the website!
*/
#ifndef _NBKERNEL223_F77S_H_
#define _NBKERNEL223_F77S_H_
/*! \file nb_kernel223_f77_single.h
* \brief Nonbonded kernel 223 (RF Coul + Bham, TIP4p)
*
* \internal
*/
#include "types/simple.h"
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif
/*! \brief Nonbonded kernel 223 with forces.
*
* <b>Coulomb interaction:</b> Reaction-Field <br>
* <b>VdW interaction:</b> Buckingham <br>
* <b>Water optimization:</b> TIP4p - other atoms <br>
* <b>Forces calculated:</b> Yes <br>
*
* \note All level1 and level2 nonbonded kernels use the same
* call sequence. Parameters are documented in nb_kernel_f77_single.h
*/
void
nb_kernel223_f77_single
(int * nri, int iinr[],
int jindex[], int jjnr[],
int shift[], real shiftvec[],
real fshift[], int gid[],
real pos[], real faction[],
real charge[], real * facel,
real * krf, real * crf,
real Vc[], int type[],
int * ntype, real vdwparam[],
real Vvdw[], real * tabscale,
real VFtab[], real invsqrta[],
real dvda[], real * gbtabscale,
real GBtab[], int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
real work[]);
/*! \brief Nonbonded kernel 223 without forces.
*
* <b>Coulomb interaction:</b> Reaction-Field <br>
* <b>VdW interaction:</b> Buckingham <br>
* <b>Water optimization:</b> TIP4p - other atoms <br>
* <b>Forces calculated:</b> No <br>
*
* \note All level1 and level2 nonbonded kernels use the same
* call sequence. Parameters are documented in nb_kernel_f77_single.h
*/
void
nb_kernel223nf_f77_single
(int * nri, int iinr[],
int jindex[], int jjnr[],
int shift[], real shiftvec[],
real fshift[], int gid[],
real pos[], real faction[],
real charge[], real * facel,
real * krf, real * crf,
real Vc[], int type[],
int * ntype, real vdwparam[],
real Vvdw[], real * tabscale,
real VFtab[], real invsqrta[],
real dvda[], real * gbtabscale,
real GBtab[], int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
real work[]);
#ifdef __cplusplus
}
#endif
#endif /* _NBKERNEL223_F77S_H_ */
|
/*
* Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
* Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2013-2014 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __ardour_buffer_h__
#define __ardour_buffer_h__
#include <stddef.h>
#include <boost/utility.hpp>
#include "ardour/libardour_visibility.h"
#include "ardour/types.h"
#include "ardour/data_type.h"
namespace ARDOUR {
/** A buffer of recordable/playable data.
*
* This is a datatype-agnostic base class for all buffers (there are no
* methods to actually access the data). This provides a way for code that
* doesn't care about the data type to still deal with buffers (which is
* why the base class can't be a template).
*
* To actually read/write buffer contents, use the appropriate derived class.
*/
class LIBARDOUR_API Buffer : public boost::noncopyable
{
public:
virtual ~Buffer() {}
/** Factory function */
static Buffer* create(DataType type, size_t capacity);
/** Maximum capacity of buffer. */
size_t capacity() const { return _capacity; }
/** Type of this buffer.
* Based on this you can static cast a Buffer* to the desired type. */
DataType type() const { return _type; }
bool silent() const { return _silent; }
/** Reallocate the buffer used internally to handle at least @a size_t units of data.
*
* The buffer is not silent after this operation. the @a capacity argument
* passed to the constructor must have been non-zero.
*/
virtual void resize (size_t) = 0;
/** Clear (eg zero, or empty) buffer */
virtual void silence (samplecnt_t len, samplecnt_t offset = 0) = 0;
/** Clear the entire buffer */
virtual void clear() { silence(_capacity, 0); }
virtual void read_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) = 0;
virtual void merge_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) = 0;
protected:
Buffer(DataType type)
: _type(type), _capacity(0), _silent (true)
{}
DataType _type;
pframes_t _capacity;
bool _silent;
};
} // namespace ARDOUR
#endif // __ardour_buffer_h__
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* cpuinfo - show information about MIPS CPU
*
* Copyright (C) 2011 Antony Pavlov <antonynpavlov@gmail.com>
*/
#include <common.h>
#include <command.h>
#include <asm/mipsregs.h>
#include <asm/cpu-info.h>
static char *way_string[] = { NULL, "direct mapped", "2-way",
"3-way", "4-way", "5-way", "6-way", "7-way", "8-way"
};
static int do_cpuinfo(int argc, char *argv[])
{
unsigned int icache_size, dcache_size, scache_size;
struct cpuinfo_mips *c = ¤t_cpu_data;
printk(KERN_INFO "CPU revision is: %08x (%s)\n",
current_cpu_data.processor_id, __cpu_name);
icache_size = c->icache.sets * c->icache.ways * c->icache.linesz;
dcache_size = c->dcache.sets * c->dcache.ways * c->dcache.linesz;
printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
icache_size >> 10,
c->icache.flags & MIPS_CACHE_VTAG ? "VIVT" : "VIPT",
way_string[c->icache.ways], c->icache.linesz);
printk("Primary data cache %ldkB, %s, %s, %s, linesize %d bytes\n",
dcache_size >> 10, way_string[c->dcache.ways],
(c->dcache.flags & MIPS_CACHE_PINDEX) ? "PIPT" : "VIPT",
(c->dcache.flags & MIPS_CACHE_ALIASES) ?
"cache aliases" : "no aliases",
c->dcache.linesz);
if (c->scache.flags & MIPS_CACHE_NOT_PRESENT)
return 0;
scache_size = c->scache.sets * c->scache.ways * c->scache.linesz;
printk("Secondary data cache %ldkB, %s, %s, %s, linesize %d bytes\n",
scache_size >> 10, way_string[c->scache.ways],
(c->scache.flags & MIPS_CACHE_PINDEX) ? "PIPT" : "VIPT",
(c->scache.flags & MIPS_CACHE_ALIASES) ?
"cache aliases" : "no aliases",
c->scache.linesz);
return 0;
}
BAREBOX_CMD_START(cpuinfo)
.cmd = do_cpuinfo,
BAREBOX_CMD_DESC("show CPU information")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_END
|
/*
* Copyright 2009 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "wbemcli.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wmiutils_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wmiutils);
typedef struct status_code
{
IWbemStatusCodeText IWbemStatusCodeText_iface;
LONG refs;
} status_code;
static inline status_code *impl_from_IWbemStatusCodeText( IWbemStatusCodeText *iface )
{
return CONTAINING_RECORD(iface, status_code, IWbemStatusCodeText_iface);
}
static ULONG WINAPI status_code_AddRef(
IWbemStatusCodeText *iface )
{
status_code *status_code = impl_from_IWbemStatusCodeText( iface );
return InterlockedIncrement( &status_code->refs );
}
static ULONG WINAPI status_code_Release(
IWbemStatusCodeText *iface )
{
status_code *status_code = impl_from_IWbemStatusCodeText( iface );
LONG refs = InterlockedDecrement( &status_code->refs );
if (!refs)
{
TRACE("destroying %p\n", status_code);
heap_free( status_code );
}
return refs;
}
static HRESULT WINAPI status_code_QueryInterface(
IWbemStatusCodeText *iface,
REFIID riid,
void **ppvObject )
{
status_code *This = impl_from_IWbemStatusCodeText( iface );
TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
if ( IsEqualGUID( riid, &IID_IWbemStatusCodeText ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = iface;
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IWbemStatusCodeText_AddRef( iface );
return S_OK;
}
static HRESULT WINAPI status_code_GetErrorCodeText(
IWbemStatusCodeText *iface,
HRESULT res,
LCID lcid,
LONG flags,
BSTR *text )
{
static const WCHAR fmt[] =
{'E','r','r','o','r',' ','c','o','d','e',':',' ','0','x','%','0','8','x',0};
WCHAR msg[32];
FIXME("%p, 0x%08x, 0x%04x, 0x%08x, %p\n", iface, res, lcid, flags, text);
sprintfW(msg, fmt, res);
*text = SysAllocString(msg);
return WBEM_S_NO_ERROR;
}
static HRESULT WINAPI status_code_GetFacilityCodeText(
IWbemStatusCodeText *iface,
HRESULT res,
LCID lcid,
LONG flags,
BSTR *text )
{
static const WCHAR fmt[] =
{'F','a','c','i','l','i','t','y',' ','c','o','d','e',':',' ','0','x','%','0','8','x',0};
WCHAR msg[32];
FIXME("%p, 0x%08x, 0x%04x, 0x%08x, %p\n", iface, res, lcid, flags, text);
sprintfW(msg, fmt, res);
*text = SysAllocString(msg);
return WBEM_S_NO_ERROR;
}
static const struct IWbemStatusCodeTextVtbl status_code_vtbl =
{
status_code_QueryInterface,
status_code_AddRef,
status_code_Release,
status_code_GetErrorCodeText,
status_code_GetFacilityCodeText
};
HRESULT WbemStatusCodeText_create( LPVOID *ppObj )
{
status_code *sc;
TRACE("(%p)\n", ppObj);
if (!(sc = heap_alloc( sizeof(*sc) ))) return E_OUTOFMEMORY;
sc->IWbemStatusCodeText_iface.lpVtbl = &status_code_vtbl;
sc->refs = 1;
*ppObj = &sc->IWbemStatusCodeText_iface;
TRACE("returning iface %p\n", *ppObj);
return S_OK;
}
|
/*
* kref.c - library routines for handling generic reference counted objects
*
* Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2004 IBM Corp.
*
* based on lib/kobject.c which was:
* Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>
*
* This file is released under the GPLv2.
*
*/
#include <lwk/kref.h>
#include <arch/bug.h>
#include <arch/system.h>
/**
* kref_set - initialize object and set refcount to requested number.
* @kref: object in question.
* @num: initial reference counter
*/
void kref_set(struct kref *kref, int num)
{
atomic_set(&kref->refcount, num);
smp_mb();
}
/**
* kref_init - initialize object.
* @kref: object in question.
*/
void kref_init(struct kref *kref)
{
kref_set(kref, 1);
}
/**
* kref_get - increment refcount for object.
* @kref: object.
*/
void kref_get(struct kref *kref)
{
WARN_ON(!atomic_read(&kref->refcount));
atomic_inc(&kref->refcount);
smp_mb__after_atomic_inc();
}
/**
* kref_put - decrement refcount for object.
* @kref: object.
* @release: pointer to the function that will clean up the object when the
* last reference to the object is released.
* This pointer is required, and it is not acceptable to pass kfree
* in as this function.
*
* Decrement the refcount, and if 0, call release().
* Return 1 if the object was removed, otherwise return 0. Beware, if this
* function returns 0, you still can not count on the kref from remaining in
* memory. Only use the return value if you want to see if the kref is now
* gone, not present.
*/
int kref_put(struct kref *kref, void (*release)(struct kref *kref))
{
WARN_ON(release == NULL);
//WARN_ON(release == (void (*)(struct kref *))kfree);
if (atomic_dec_and_test(&kref->refcount)) {
release(kref);
return 1;
}
return 0;
}
|
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <polarssl/ctr_drbg.h>
#include <polarssl/entropy.h>
#include <polarssl/net.h>
#include <polarssl/ssl.h>
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
#define NET_SSL_MAXINSTANCES 4
#define SSLID_VALID(x) (x >= 0 && x < NET_SSL_MAXINSTANCES && CWII_IPC_HLE_Device_net_ssl::_SSL[x].active)
enum ssl_err_t
{
SSL_OK = 0,
SSL_ERR_FAILED = -1,
SSL_ERR_RAGAIN = -2,
SSL_ERR_WAGAIN = -3,
SSL_ERR_SYSCALL = -5,
SSL_ERR_ZERO = -6, // read or write returned 0
SSL_ERR_CAGAIN = -7, // BIO not connected
SSL_ERR_ID = -8, // invalid SSL id
SSL_ERR_VCOMMONNAME = -9, // verify failed: common name
SSL_ERR_VROOTCA = -10, // verify failed: root ca
SSL_ERR_VCHAIN = -11, // verify failed: certificate chain
SSL_ERR_VDATE = -12, // verify failed: date invalid
SSL_ERR_SERVER_CERT = -13, // certificate cert invalid
};
enum SSL_IOCTL
{
IOCTLV_NET_SSL_NEW = 0x01,
IOCTLV_NET_SSL_CONNECT = 0x02,
IOCTLV_NET_SSL_DOHANDSHAKE = 0x03,
IOCTLV_NET_SSL_READ = 0x04,
IOCTLV_NET_SSL_WRITE = 0x05,
IOCTLV_NET_SSL_SHUTDOWN = 0x06,
IOCTLV_NET_SSL_SETCLIENTCERT = 0x07,
IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT = 0x08,
IOCTLV_NET_SSL_REMOVECLIENTCERT = 0x09,
IOCTLV_NET_SSL_SETROOTCA = 0x0A,
IOCTLV_NET_SSL_SETROOTCADEFAULT = 0x0B,
IOCTLV_NET_SSL_DOHANDSHAKEEX = 0x0C,
IOCTLV_NET_SSL_SETBUILTINROOTCA = 0x0D,
IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = 0x0E,
IOCTLV_NET_SSL_DISABLEVERIFYOPTIONFORDEBUG = 0x0F,
IOCTLV_NET_SSL_DEBUGGETVERSION = 0x14,
IOCTLV_NET_SSL_DEBUGGETTIME = 0x15,
};
struct WII_SSL
{
ssl_context ctx;
ssl_session session;
entropy_context entropy;
ctr_drbg_context ctr_drbg;
x509_crt cacert;
x509_crt clicert;
pk_context pk;
int sockfd;
std::string hostname;
bool active;
};
class CWII_IPC_HLE_Device_net_ssl : public IWII_IPC_HLE_Device
{
public:
CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_net_ssl();
virtual IPCCommandResult Open(u32 _CommandAddress, u32 _Mode) override;
virtual IPCCommandResult Close(u32 _CommandAddress, bool _bForce) override;
virtual IPCCommandResult IOCtl(u32 _CommandAddress) override;
virtual IPCCommandResult IOCtlV(u32 _CommandAddress) override;
int getSSLFreeID();
static WII_SSL _SSL[NET_SSL_MAXINSTANCES];
};
|
/**
* @file
*
* @brief LM32 CPU Assembly File
*
* Very loose template for an include file for the cpu_asm.? file
* if it is implemented as a ".S" file (preprocessed by cpp) instead
* of a ".s" file (preprocessed by gm4 or gasp).
*/
/*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
*/
#ifndef _RTEMS_SCORE_CPU_ASM_H
#define _RTEMS_SCORE_CPU_ASM_H
/* pull in the generated offsets */
/*
#include <rtems/score/offsets.h>
*/
/*
* Hardware General Registers
*/
/* put something here */
/*
* Hardware Floating Point Registers
*/
/* put something here */
/*
* Hardware Control Registers
*/
/* put something here */
/*
* Calling Convention
*/
/* put something here */
/*
* Temporary registers
*/
/* put something here */
/*
* Floating Point Registers - SW Conventions
*/
/* put something here */
/*
* Temporary floating point registers
*/
/* put something here */
#endif
/* end of file */
|
#include "ieclass.h"
#include "../../../../../shared/entitiesdef.h"
class EntityClassScannerUFO: public EntityClassScanner
{
private:
EntityClass* initFromDefinition (const entityDef_t *definition);
void parseFlags (EntityClass *e, const char **text);
void parseAttribute (EntityClass *e, const entityKeyDef_t *keydef);
const std::string getFilename () const;
public:
void scanFile (EntityClassCollector& collector);
};
|
/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* 64 bit Linux for S/390 only has rt signals, thus we do not even want to try
falling back to the old style signals as the default Linux handler does. */
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <sysdep.h>
#include <sys/syscall.h>
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. This is the definition. */
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
int
__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
return INLINE_SYSCALL (rt_sigaction, 4, sig, act, oact, _NSIG / 8);
}
libc_hidden_def (__libc_sigaction)
#include <nptl/sigaction.c>
|
/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
// ColoredButton.h : header file
//
#ifndef COLOREDBUTTON_H
#define COLOREDBUTTON_H 1
/////////////////////////////////////////////////////////////////////////////
// CColoredButton window
class CColoredButton : public CButton
{
// Construction
public:
enum PickerType {
PT_CUSTOM = 0,
PT_MFC,
};
CColoredButton();
// Attributes
public:
COLOR m_colColor;
COLOR m_colLastColor;
UBYTE m_ubComponents[2][4];
BOOL m_bMixedColor;
enum PickerType m_ptPickerType;
CWnd *m_pwndParentDialog;
RECT m_rectButton;
PIX m_dx;
PIX m_dy;
INDEX m_iColorIndex;
INDEX m_iComponentIndex;
CPoint m_ptStarting;
CPoint m_ptCenter;
// Operations
public:
void SetColor(COLOR clrNew);
inline void SetDialogPtr(CWnd *pwndParentDialog){ m_pwndParentDialog = pwndParentDialog;};
inline void SetMixedColor(void){ m_bMixedColor = TRUE;};
inline void SetPickerType( enum PickerType ptPickerType) { m_ptPickerType = ptPickerType;};
inline COLOR GetColor(void) { return m_colColor;};
inline BOOL IsColorValid(void) { return !m_bMixedColor;};
void SetOverButtonInfo( CPoint point);
void ColorToComponents(void);
int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CColoredButton)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CColoredButton();
// Generated message map functions
protected:
//{{AFX_MSG(CColoredButton)
afx_msg void OnClicked();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnCopyColor();
afx_msg void OnPasteColor();
afx_msg void OnNumericAlpha();
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnKillFocus(CWnd* pNewWnd);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
#endif // COLOREDBUTTON_H
|
/*
* MUSB OTG driver debug defines
*
* Copyright 2005 Mentor Graphics Corporation
* Copyright (C) 2005-2006 by Texas Instruments
* Copyright (C) 2006-2007 Nokia Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* THIS SOFTWARE IS PROVIDED "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 AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __MUSB_LINUX_DEBUG_H__
#define __MUSB_LINUX_DEBUG_H__
#define WARNING(fmt, args...) pr_debug("%s %d: " fmt, __func__, __LINE__, ## args)
#define INFO(fmt, args...) pr_debug("%s %d: " fmt, __func__, __LINE__, ## args)
#define ERR(fmt, args...) pr_err("%s %d: " fmt, __func__, __LINE__, ## args)
#ifdef CONFIG_DEBUG_FS
int musb_init_debugfs(struct musb *musb);
void musb_exit_debugfs(struct musb *musb);
#else
static inline int musb_init_debugfs(struct musb *musb)
{
return 0;
}
static inline void musb_exit_debugfs(struct musb *musb)
{
}
#endif
#ifdef CONFIG_U3_PHY_SMT_LOOP_BACK_SUPPORT
extern bool u3_loop_back_test(void);
#endif
#endif /*__MUSB_LINUX_DEBUG_H__ */
|
/* in_cksum.h
* Declaration of Internet checksum routine.
*
* $Id$
*/
#ifndef __IN_CKSUM_H__
#define __IN_CKSUM_H__
#include "ws_symbol_export.h"
typedef struct {
const guint8 *ptr;
int len;
} vec_t;
WS_DLL_PUBLIC int in_cksum(const vec_t *vec, int veclen);
guint16 in_cksum_shouldbe(guint16 sum, guint16 computed_sum);
#endif /* __IN_CKSUM_H__ */
|
#ifndef SRC_JS_STREAM_H_
#define SRC_JS_STREAM_H_
#include "async-wrap.h"
#include "env.h"
#include "stream_base.h"
#include "v8.h"
namespace node {
class JSStream : public StreamBase, public AsyncWrap {
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
~JSStream();
void* Cast() override;
bool IsAlive() override;
bool IsClosing() override;
int ReadStart() override;
int ReadStop() override;
int DoShutdown(ShutdownWrap* req_wrap) override;
int DoWrite(WriteWrap* w,
uv_buf_t* bufs,
size_t count,
uv_stream_t* send_handle) override;
size_t self_size() const override { return sizeof(*this); }
protected:
JSStream(Environment* env, v8::Local<v8::Object> obj, AsyncWrap* parent);
AsyncWrap* GetAsyncWrap() override;
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
static void DoAlloc(const v8::FunctionCallbackInfo<v8::Value>& args);
static void DoRead(const v8::FunctionCallbackInfo<v8::Value>& args);
static void DoAfterWrite(const v8::FunctionCallbackInfo<v8::Value>& args);
static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args);
static void EmitEOF(const v8::FunctionCallbackInfo<v8::Value>& args);
template <class Wrap>
static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args);
};
} // namespace node
#endif // SRC_JS_STREAM_H_
|
/*
*************************************************************************************
* Linux
* USB Device Controller Driver
*
* (c) Copyright 2006-2010, All winners Co,Ld.
* All Rights Reserved
*
* File Name : sw_usb_config.h
*
* Author : javen
*
* Description :
*
* History :
* <author> <time> <version > <desc>
* javen 2011-4-14 1.0 create this file
*
*************************************************************************************
*/
#ifndef __SW_USB_CONFIG_H__
#define __SW_USB_CONFIG_H__
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include "sw_usb_typedef.h"
#include "sw_usb_debug.h"
#include "sun3i_usb_bsp.h"
#include "sun3i_sys_reg.h"
#include <mach/sys_config.h>
#include "sw_usb_board.h"
#include "sw_udc.h"
#include "sw_hcd.h"
#endif //__SW_USB_CONFIG_H__
|
/* common register includes used in multiple modules
* Copyright (C) 2005-2008 Red Hat Inc.
* Copyright (C) 2005 Intel Corporation.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
* Public License (GPL); either version 2, or (at your option) any
* later version.
*/
#ifndef _REGS_H_ /* -*- linux-c -*- */
#define _REGS_H_
#if defined (STAPCONF_X86_UNIREGS) && (defined (__x86_64__) || defined (__i386__))
#define REG_IP(regs) regs->ip
#define REG_SP(regs) regs->sp
#define REG_FP(regs) regs->bp
#elif defined (__x86_64__)
#define REG_IP(regs) regs->rip
#define REG_SP(regs) regs->rsp
#elif defined (__i386__)
#define REG_IP(regs) regs->eip
#define REG_SP(regs) regs->esp
#define REG_FP(regs) regs->ebp
#elif defined (__ia64__)
#define REG_IP(regs) ((regs)->cr_iip +ia64_psr(regs)->ri)
#define REG_SP(regs) ((regs)->r12)
#define SET_REG_IP(regs, x) \
(((regs)->cr_iip = (x) & ~3UL), (ia64_psr(regs)->ri = (x) & 3UL))
#elif defined (__powerpc__)
#define REG_IP(regs) regs->nip
#define REG_SP(regs) regs->gpr[1]
#define REG_LINK(regs) regs->link
#elif defined (__aarch64__)
#define REG_IP(regs) regs->pc
#define REG_SP(regs) regs->sp
#define REG_LINK(regs) regs->regs[30]
#elif defined (__arm__)
#define REG_IP(regs) regs->ARM_pc
#define REG_SP(regs) regs->ARM_sp
#define REG_LINK(regs) regs->ARM_lr
#elif defined (__s390__) || defined (__s390x__)
#ifndef __s390x__
#define PSW_ADDR_AMODE 0x80000000UL
#define PSW_ADDR_INSN 0x7FFFFFFFUL
#else /* __s390x__ */
#define PSW_ADDR_AMODE 0x0000000000000000UL
#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
#endif /* __s390x__ */
#define REG_IP(regs) (((regs)->psw.addr) & PSW_ADDR_INSN)
#define REG_SP(regs) (regs)->gprs[15]
#define SET_REG_IP(regs,x) (regs)->psw.addr = (x) | PSW_ADDR_AMODE
#else
#error "Unimplemented architecture"
#endif
#ifndef SET_REG_IP
#define SET_REG_IP(regs, x) REG_IP(regs) = x
#endif
static void _stp_print_regs(struct pt_regs * regs);
#endif /* _REGS_H_ */
|
/****************************************************************************
* px4/sensors/test_gpio.c
*
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
* Lorenz Meier <lm@inf.ethz.ch>
*
* 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 NuttX 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <px4_config.h>
#include <px4_defines.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <string.h>
#include <arch/board/board.h>
#include "tests.h"
#include <math.h>
#include <float.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: test_led
****************************************************************************/
int test_uart_baudchange(int argc, char *argv[])
{
int uart2_nwrite = 0;
/* assuming NuttShell is on UART1 (/dev/ttyS0) */
int uart2 = open("/dev/ttyS1", O_RDWR | O_NONBLOCK | O_NOCTTY); //
if (uart2 < 0) {
printf("ERROR opening UART2, aborting..\n");
return uart2;
}
struct termios uart2_config;
struct termios uart2_config_original;
int termios_state = 0;
int ret;
#define UART_BAUDRATE_RUNTIME_CONF
#ifdef UART_BAUDRATE_RUNTIME_CONF
if ((termios_state = tcgetattr(uart2, &uart2_config)) < 0) {
printf("ERROR getting termios config for UART2: %d\n", termios_state);
ret = termios_state;
goto cleanup;
}
memcpy(&uart2_config_original, &uart2_config, sizeof(struct termios));
/* Set baud rate */
if (cfsetispeed(&uart2_config, B9600) < 0 || cfsetospeed(&uart2_config, B9600) < 0) {
printf("ERROR setting termios config for UART2: %d\n", termios_state);
ret = ERROR;
goto cleanup;
}
if ((termios_state = tcsetattr(uart2, TCSANOW, &uart2_config)) < 0) {
printf("ERROR setting termios config for UART2\n");
ret = termios_state;
goto cleanup;
}
/* Set back to original settings */
if ((termios_state = tcsetattr(uart2, TCSANOW, &uart2_config_original)) < 0) {
printf("ERROR setting termios config for UART2\n");
ret = termios_state;
goto cleanup;
}
#endif
uint8_t sample_uart2[] = {'U', 'A', 'R', 'T', '2', ' ', '#', 0, '\n'};
int i, r;
for (i = 0; i < 100; i++) {
/* uart2 -> */
r = write(uart2, sample_uart2, sizeof(sample_uart2));
if (r > 0) {
uart2_nwrite += r;
}
}
close(uart2);
printf("uart2_nwrite %d\n", uart2_nwrite);
return OK;
cleanup:
close(uart2);
return ret;
}
|
/**
* Copyright (C) 2010 Ubixum, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/
#include <autovector.h>
void usbreset_isr() __interrupt {}
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/luadefs/CLuaWaterDefs.h
* PURPOSE: Lua function definitions class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#pragma once
#include "CLuaDefs.h"
class CLuaWaterDefs : public CLuaDefs
{
public:
static void LoadFunctions ( void );
static void AddClass ( lua_State* luaVM );
LUA_DECLARE ( CreateWater );
LUA_DECLARE ( SetWaterLevel );
LUA_DECLARE ( ResetWaterLevel );
LUA_DECLARE ( GetWaterVertexPosition );
LUA_DECLARE ( SetWaterVertexPosition );
LUA_DECLARE ( GetWaterColor );
LUA_DECLARE ( SetWaterColor );
LUA_DECLARE ( ResetWaterColor );
}; |
#ifndef REPLAY_H
#define REPLAY_H
/*
* replay.h
*
* Copyright (c) 2010-2015 Institute for System Programming
* of the Russian Academy of Sciences.
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*
*/
#include "qapi-types.h"
/* replay clock kinds */
enum ReplayClockKind {
/* host_clock */
REPLAY_CLOCK_HOST,
/* virtual_rt_clock */
REPLAY_CLOCK_VIRTUAL_RT,
REPLAY_CLOCK_COUNT
};
typedef enum ReplayClockKind ReplayClockKind;
/* IDs of the checkpoints */
enum ReplayCheckpoint {
CHECKPOINT_CLOCK_WARP_START,
CHECKPOINT_CLOCK_WARP_ACCOUNT,
CHECKPOINT_RESET_REQUESTED,
CHECKPOINT_SUSPEND_REQUESTED,
CHECKPOINT_CLOCK_VIRTUAL,
CHECKPOINT_CLOCK_HOST,
CHECKPOINT_CLOCK_VIRTUAL_RT,
CHECKPOINT_INIT,
CHECKPOINT_RESET,
CHECKPOINT_COUNT
};
typedef enum ReplayCheckpoint ReplayCheckpoint;
extern ReplayMode replay_mode;
/* Replay process control functions */
/*! Enables recording or saving event log with specified parameters */
void replay_configure(struct QemuOpts *opts);
/*! Initializes timers used for snapshotting and enables events recording */
void replay_start(void);
/*! Closes replay log file and frees other resources. */
void replay_finish(void);
/*! Adds replay blocker with the specified error description */
void replay_add_blocker(Error *reason);
/* Processing the instructions */
/*! Returns number of executed instructions. */
uint64_t replay_get_current_step(void);
/*! Returns number of instructions to execute in replay mode. */
int replay_get_instructions(void);
/*! Updates instructions counter in replay mode. */
void replay_account_executed_instructions(void);
/* Interrupts and exceptions */
/*! Called by exception handler to write or read
exception processing events. */
bool replay_exception(void);
/*! Used to determine that exception is pending.
Does not proceed to the next event in the log. */
bool replay_has_exception(void);
/*! Called by interrupt handlers to write or read
interrupt processing events.
\return true if interrupt should be processed */
bool replay_interrupt(void);
/*! Tries to read interrupt event from the file.
Returns true, when interrupt request is pending */
bool replay_has_interrupt(void);
/* Processing clocks and other time sources */
/*! Save the specified clock */
int64_t replay_save_clock(ReplayClockKind kind, int64_t clock);
/*! Read the specified clock from the log or return cached data */
int64_t replay_read_clock(ReplayClockKind kind);
/*! Saves or reads the clock depending on the current replay mode. */
#define REPLAY_CLOCK(clock, value) \
(replay_mode == REPLAY_MODE_PLAY ? replay_read_clock((clock)) \
: replay_mode == REPLAY_MODE_RECORD \
? replay_save_clock((clock), (value)) \
: (value))
/* Events */
/*! Called when qemu shutdown is requested. */
void replay_shutdown_request(void);
/*! Should be called at check points in the execution.
These check points are skipped, if they were not met.
Saves checkpoint in the SAVE mode and validates in the PLAY mode.
Returns 0 in PLAY mode if checkpoint was not found.
Returns 1 in all other cases. */
bool replay_checkpoint(ReplayCheckpoint checkpoint);
/* Asynchronous events queue */
/*! Disables storing events in the queue */
void replay_disable_events(void);
/*! Enables storing events in the queue */
void replay_enable_events(void);
/*! Returns true when saving events is enabled */
bool replay_events_enabled(void);
/*! Adds bottom half event to the queue */
void replay_bh_schedule_event(QEMUBH *bh);
/*! Adds input event to the queue */
void replay_input_event(QemuConsole *src, InputEvent *evt);
/*! Adds input sync event to the queue */
void replay_input_sync_event(void);
/*! Adds block layer event to the queue */
void replay_block_event(QEMUBH *bh, uint64_t id);
/*! Returns ID for the next block event */
uint64_t blkreplay_next_id(void);
/* Character device */
/*! Registers char driver to save it's events */
void replay_register_char_driver(struct CharDriverState *chr);
/*! Saves write to char device event to the log */
void replay_chr_be_write(struct CharDriverState *s, uint8_t *buf, int len);
/*! Writes char write return value to the replay log. */
void replay_char_write_event_save(int res, int offset);
/*! Reads char write return value from the replay log. */
void replay_char_write_event_load(int *res, int *offset);
/*! Reads information about read_all character event. */
int replay_char_read_all_load(uint8_t *buf);
/*! Writes character read_all error code into the replay log. */
void replay_char_read_all_save_error(int res);
/*! Writes character read_all execution result into the replay log. */
void replay_char_read_all_save_buf(uint8_t *buf, int offset);
#endif
|
#pragma once
#include "AP_HAL_Linux.h"
#include "RCInput.h"
#include <signal.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <assert.h>
#include <queue>
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BH
#define RCIN_RPI_CHN_NUM 8
#else
#define RCIN_RPI_CHN_NUM 1
#endif
namespace Linux {
enum state_t{
RCIN_RPI_INITIAL_STATE = -1,
RCIN_RPI_ZERO_STATE = 0,
RCIN_RPI_ONE_STATE = 1
};
//Memory table structure
typedef struct {
void **virt_pages;
void **phys_pages;
uint32_t page_count;
} memory_table_t;
//DMA control block structure
typedef struct {
uint32_t info, src, dst, length,
stride, next, pad[2];
} dma_cb_t;
class Memory_table {
// Allow RCInput_RPI access to private members of Memory_table
friend class RCInput_RPI;
private:
void** _virt_pages;
void** _phys_pages;
uint32_t _page_count;
public:
Memory_table();
Memory_table(uint32_t, int);
~Memory_table();
//Get virtual address from the corresponding physical address from memory_table.
void* get_virt_addr(const uint32_t phys_addr) const;
// This function returns physical address with help of pointer, which is offset from the beginning of the buffer.
void* get_page(void **pages, const uint32_t addr) const;
// This function returns offset from the beginning of the buffer using (virtual) address in 'pages' and memory_table.
uint32_t get_offset(void **pages, const uint32_t addr) const;
//How many bytes are available for reading in circle buffer?
uint32_t bytes_available(const uint32_t read_addr, const uint32_t write_addr) const;
uint32_t get_page_count() const;
};
class RCInput_RPI : public RCInput
{
public:
void init() override;
void _timer_tick(void) override;
RCInput_RPI();
~RCInput_RPI();
private:
//Physical adresses of peripherals. Are different on different Raspberries.
uint32_t dma_base;
uint32_t clk_base;
uint32_t pcm_base;
//registers
static volatile uint32_t *pcm_reg;
static volatile uint32_t *clk_reg;
static volatile uint32_t *dma_reg;
Memory_table *circle_buffer;
Memory_table *con_blocks;
uint64_t curr_tick;
uint32_t curr_tick_inc;
uint32_t curr_pointer;
uint32_t curr_channel;
struct RcChannel {
RcChannel() :
prev_tick(0), delta_time(0),
width_s0(0), width_s1(0),
curr_signal(0), last_signal(0),
enable_pin(0), state(RCIN_RPI_INITIAL_STATE)
{}
uint64_t prev_tick;
uint64_t delta_time;
uint16_t width_s0;
uint16_t width_s1;
uint8_t curr_signal;
uint8_t last_signal;
state_t state;
AP_HAL::DigitalSource *enable_pin;
} rc_channels[RCIN_RPI_CHN_NUM];
bool _initialized = false;
int _version =0;
void init_dma_cb(dma_cb_t** cbp, uint32_t mode, uint32_t source, uint32_t dest, uint32_t length, uint32_t stride, uint32_t next_cb);
void* map_peripheral(uint32_t base, uint32_t len);
void init_registers();
void init_ctrl_data();
void init_PCM();
void init_DMA();
void init_buffer();
static void stop_dma();
static void termination_handler(int signum);
void set_sigaction();
void set_physical_addresses();
void teardown() override;
};
}
|
/*
* crc.c
*
* Copyright (C) Aaron Holtzman - May 1999
*
* This file is part of ac3dec, a free Dolby AC-3 stream decoder.
*
* ac3dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* ac3dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
static const uint16_t crc_lut[256] =
{
0x0000,0x8005,0x800f,0x000a,0x801b,0x001e,0x0014,0x8011,
0x8033,0x0036,0x003c,0x8039,0x0028,0x802d,0x8027,0x0022,
0x8063,0x0066,0x006c,0x8069,0x0078,0x807d,0x8077,0x0072,
0x0050,0x8055,0x805f,0x005a,0x804b,0x004e,0x0044,0x8041,
0x80c3,0x00c6,0x00cc,0x80c9,0x00d8,0x80dd,0x80d7,0x00d2,
0x00f0,0x80f5,0x80ff,0x00fa,0x80eb,0x00ee,0x00e4,0x80e1,
0x00a0,0x80a5,0x80af,0x00aa,0x80bb,0x00be,0x00b4,0x80b1,
0x8093,0x0096,0x009c,0x8099,0x0088,0x808d,0x8087,0x0082,
0x8183,0x0186,0x018c,0x8189,0x0198,0x819d,0x8197,0x0192,
0x01b0,0x81b5,0x81bf,0x01ba,0x81ab,0x01ae,0x01a4,0x81a1,
0x01e0,0x81e5,0x81ef,0x01ea,0x81fb,0x01fe,0x01f4,0x81f1,
0x81d3,0x01d6,0x01dc,0x81d9,0x01c8,0x81cd,0x81c7,0x01c2,
0x0140,0x8145,0x814f,0x014a,0x815b,0x015e,0x0154,0x8151,
0x8173,0x0176,0x017c,0x8179,0x0168,0x816d,0x8167,0x0162,
0x8123,0x0126,0x012c,0x8129,0x0138,0x813d,0x8137,0x0132,
0x0110,0x8115,0x811f,0x011a,0x810b,0x010e,0x0104,0x8101,
0x8303,0x0306,0x030c,0x8309,0x0318,0x831d,0x8317,0x0312,
0x0330,0x8335,0x833f,0x033a,0x832b,0x032e,0x0324,0x8321,
0x0360,0x8365,0x836f,0x036a,0x837b,0x037e,0x0374,0x8371,
0x8353,0x0356,0x035c,0x8359,0x0348,0x834d,0x8347,0x0342,
0x03c0,0x83c5,0x83cf,0x03ca,0x83db,0x03de,0x03d4,0x83d1,
0x83f3,0x03f6,0x03fc,0x83f9,0x03e8,0x83ed,0x83e7,0x03e2,
0x83a3,0x03a6,0x03ac,0x83a9,0x03b8,0x83bd,0x83b7,0x03b2,
0x0390,0x8395,0x839f,0x039a,0x838b,0x038e,0x0384,0x8381,
0x0280,0x8285,0x828f,0x028a,0x829b,0x029e,0x0294,0x8291,
0x82b3,0x02b6,0x02bc,0x82b9,0x02a8,0x82ad,0x82a7,0x02a2,
0x82e3,0x02e6,0x02ec,0x82e9,0x02f8,0x82fd,0x82f7,0x02f2,
0x02d0,0x82d5,0x82df,0x02da,0x82cb,0x02ce,0x02c4,0x82c1,
0x8243,0x0246,0x024c,0x8249,0x0258,0x825d,0x8257,0x0252,
0x0270,0x8275,0x827f,0x027a,0x826b,0x026e,0x0264,0x8261,
0x0220,0x8225,0x822f,0x022a,0x823b,0x023e,0x0234,0x8231,
0x8213,0x0216,0x021c,0x8219,0x0208,0x820d,0x8207,0x0202
};
uint16_t crc16_block(uint8_t *data,uint32_t num_bytes)
{
uint32_t i;
uint16_t state=0;
for(i=0;i<num_bytes;i++)
state = crc_lut[data[i] ^ (state>>8)] ^ (state<<8);
return state;
}
|
/*********************************************************************
* SEGGER MICROCONTROLLER SYSTEME GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996-2014 SEGGER Microcontroller Systeme GmbH *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
----------------------------------------------------------------------
File : SEGGER_RTT_Conf.h
Date : 17 Dec 2014
Purpose : Implementation of SEGGER real-time terminal which allows
real-time terminal communication on targets which support
debugger memory accesses while the CPU is running.
---------------------------END-OF-HEADER------------------------------
*/
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (2) // Max. number of up-buffers (T->H) available on this target (Default: 2)
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (2) // Max. number of down-buffers (H->T) available on this target (Default: 2)
#define BUFFER_SIZE_UP (10 * 1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
#define BUFFER_SIZE_DOWN (32) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
//
// Target is not allowed to perform other RTT operations while string still has not been stored completely.
// Otherwise we would probably end up with a mixed string in the buffer.
// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
//
#define SEGGER_RTT_LOCK()
#define SEGGER_RTT_UNLOCK()
//
// Define SEGGER_RTT_IN_RAM as 1
// when using RTT in RAM targets (init and data section both in RAM).
// This prevents the host to falsly identify the RTT Callback Structure
// in the init segment as the used Callback Structure.
//
// When defined as 1,
// the first call to an RTT function will modify the ID of the RTT Callback Structure.
// To speed up identifying on the host,
// especially when RTT functions are not called at the beginning of execution,
// SEGGER_RTT_Init() should be called at the start of the application.
//
#define SEGGER_RTT_IN_RAM (0)
/*************************** End of file ****************************/
|
// Stub implementation of ngx_cycle for testing the buffer cache
#ifndef _NGX_CYCLE_H_INCLUDED_
#define _NGX_CYCLE_H_INCLUDED_
typedef struct ngx_shm_zone_s ngx_shm_zone_t;
#include <ngx_core.h>
typedef ngx_int_t (*ngx_shm_zone_init_pt) (ngx_shm_zone_t *zone, void *data);
struct ngx_shm_zone_s {
void *data;
ngx_shm_t shm;
ngx_shm_zone_init_pt init;
void *tag;
};
extern volatile ngx_cycle_t *ngx_cycle;
struct ngx_cycle_s {
ngx_pool_t *pool;
ngx_log_t *log;
ngx_log_t new_log;
};
ngx_shm_zone_t *ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag);
#endif /* _NGX_CYCLE_H_INCLUDED_ */
|
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013-2016 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "grn_db.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SCAN_ACCESSOR (0x01)
#define SCAN_PUSH (0x02)
#define SCAN_POP (0x04)
#define SCAN_PRE_CONST (0x08)
typedef enum {
SCAN_START = 0,
SCAN_VAR,
SCAN_COL1,
SCAN_COL2,
SCAN_CONST
} scan_stat;
typedef struct _grn_scan_info scan_info;
typedef grn_bool (*grn_scan_info_each_arg_callback)(grn_ctx *ctx, grn_obj *obj, void *user_data);
void grn_expr_init_from_env(void);
scan_info **grn_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
grn_operator op, grn_bool record_exist);
scan_info *grn_scan_info_open(grn_ctx *ctx, int start);
void grn_scan_info_close(grn_ctx *ctx, scan_info *si);
void grn_scan_info_put_index(grn_ctx *ctx, scan_info *si, grn_obj *index,
uint32_t sid, int32_t weight,
grn_obj *scorer,
grn_obj *scorer_args_expr,
uint32_t scorer_args_expr_offset);
scan_info **grn_scan_info_put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip,
grn_operator op, int start);
int grn_scan_info_get_flags(scan_info *si);
void grn_scan_info_set_flags(scan_info *si, int flags);
grn_operator grn_scan_info_get_logical_op(scan_info *si);
void grn_scan_info_set_logical_op(scan_info *si, grn_operator logical_op);
grn_operator grn_scan_info_get_op(scan_info *si);
void grn_scan_info_set_op(scan_info *si, grn_operator op);
void grn_scan_info_set_end(scan_info *si, uint32_t end);
void grn_scan_info_set_query(scan_info *si, grn_obj *query);
int grn_scan_info_get_max_interval(scan_info *si);
void grn_scan_info_set_max_interval(scan_info *si, int max_interval);
int grn_scan_info_get_similarity_threshold(scan_info *si);
void grn_scan_info_set_similarity_threshold(scan_info *si, int similarity_threshold);
grn_bool grn_scan_info_push_arg(scan_info *si, grn_obj *arg);
grn_obj *grn_scan_info_get_arg(grn_ctx *ctx, scan_info *si, int i);
int grn_scan_info_get_start_position(scan_info *si);
void grn_scan_info_set_start_position(scan_info *si, int start);
void grn_scan_info_reset_position(scan_info *si);
int32_t grn_expr_code_get_weight(grn_ctx *ctx, grn_expr_code *ec, uint32_t *offset);
grn_rc grn_expr_code_inspect_indented(grn_ctx *ctx,
grn_obj *buffer,
grn_expr_code *code,
const char *indent);
void grn_p_expr_code(grn_ctx *ctx, grn_expr_code *code);
grn_obj *grn_expr_alloc_const(grn_ctx *ctx, grn_obj *expr);
#ifdef __cplusplus
}
#endif
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2016 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef LIBMESH_UNSTEADY_SOLVER_H
#define LIBMESH_UNSTEADY_SOLVER_H
// Local includes
#include "libmesh/auto_ptr.h"
#include "libmesh/libmesh_common.h"
#include "libmesh/numeric_vector.h"
#include "libmesh/time_solver.h"
// C++ includes
namespace libMesh
{
/**
* This is a generic class that defines a solver to handle
* time integration of DifferentiableSystems.
*
* A user can define a solver for unsteady problems by deriving
* from this class and implementing certain functions.
*
* This class is part of the new DifferentiableSystem framework,
* which is still experimental. Users of this framework should
* beware of bugs and future API changes.
*
* \author Roy H. Stogner
* \date 2008
*/
class UnsteadySolver : public TimeSolver
{
public:
/**
* Constructor. Requires a reference to the system
* to be solved.
*/
explicit
UnsteadySolver (sys_type & s);
/**
* Destructor.
*/
virtual ~UnsteadySolver ();
/**
* The initialization function. This method is used to
* initialize internal data structures before a simulation begins.
*/
virtual void init () libmesh_override;
/**
* The data initialization function. This method is used to
* initialize internal data structures after the underlying System
* has been initialized
*/
virtual void init_data () libmesh_override;
/**
* The reinitialization function. This method is used to
* resize internal data vectors after a mesh change.
*/
virtual void reinit () libmesh_override;
/**
* This method solves for the solution at the next timestep.
* Usually we will only need to solve one (non)linear system per timestep,
* but more complex subclasses may override this.
*/
virtual void solve () libmesh_override;
/**
* This method advances the solution to the next timestep, after a
* solve() has been performed. Often this will be done after every
* UnsteadySolver::solve(), but adaptive mesh refinement and/or adaptive
* time step selection may require some solve() steps to be repeated.
*/
virtual void advance_timestep () libmesh_override;
/**
* This method advances the adjoint solution to the previous
* timestep, after an adjoint_solve() has been performed. This will
* be done before every UnsteadySolver::adjoint_solve().
*/
virtual void adjoint_advance_timestep () libmesh_override;
/**
* This method retrieves all the stored solutions at the current
* system.time
*/
virtual void retrieve_timestep () libmesh_override;
/**
* This method should return the expected convergence order of the
* (non-local) error of the time discretization scheme - e.g. 2 for the
* O(deltat^2) Crank-Nicholson, or 1 for the O(deltat) Backward Euler.
*
* Useful for adaptive timestepping schemes.
*/
virtual Real error_order () const = 0;
/**
* Returns the maximum order of time derivatives for which the
* UnsteadySolver subclass is capable of handling. E.g. EulerSolver
* will have time_order = 1 and NewmarkSolver will have time_order = 2
*/
virtual unsigned int time_order () const = 0;
/**
* @returns the old nonlinear solution for the specified global
* DOF.
*/
Number old_nonlinear_solution (const dof_id_type global_dof_number) const;
/**
* Serial vector of _system.get_vector("_old_nonlinear_solution")
*/
UniquePtr<NumericVector<Number> > old_local_nonlinear_solution;
/**
* Computes the size of ||u^{n+1} - u^{n}|| in some norm.
*
* Note that, while you can always call this function, its
* result may or may not be very meaningful. For example, if
* you call this function right after calling advance_timestep()
* then you'll get a result of zero since old_nonlinear_solution
* is set equal to nonlinear_solution in this function.
*/
virtual Real du(const SystemNorm & norm) const libmesh_override;
/**
* This is not a steady-state solver.
*/
virtual bool is_steady() const libmesh_override { return false; }
protected:
/**
* A bool that will be true the first time solve() is called,
* and false thereafter
*/
bool first_solve;
/**
* A bool that will be true the first time adjoint_advance_timestep() is called,
* (when the primal solution is to be used to set adjoint boundary conditions) and false thereafter
*/
bool first_adjoint_step;
};
} // namespace libMesh
#endif // LIBMESH_UNSTEADY_SOLVER_H
|
/* ********************************************************************** */
/* pk_meetjoin.h: Meet and join operations */
/* ********************************************************************** */
/* This file is part of the APRON Library, released under LGPL license. Please
read the COPYING file packaged in the distribution */
#ifndef _PK_MEETJOIN_H_
#define _PK_MEETJOIN_H_
#include "pk_config.h"
#include "pk.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ********************************************************************** */
/* I. Meet/Join */
/* ********************************************************************** */
/* In all the following functions, for the structure poly_t:
- If meet is true, standard meaning of everything
- If meet is false,
- matrices C and F, satC and satF have been exchanged,
- nbeq and nbline have been exchanged
- in status, nothing has changed
*/
/* Meet/Join of a polyhedronwith an array of constraints/generators.
The polyhedron is supposed:
- to have constraints,
- if lazy is false, to be minimized, and to have satC
- possible emptiness not detected,
Matrix of constraints is supposed:
- to be sorted
- to be canonical too.
Return true if exception
*/
bool poly_meet_matrix(bool meet, bool lazy,
ap_manager_t* man,
pk_t* po,
pk_t* pa, matrix_t* mat);
void poly_meet_itv_lincons_array(bool lazy,
ap_manager_t* man,
pk_t* po, pk_t* pa,
itv_lincons_array_t* array);
void poly_meet(bool meet,
bool lazy,
ap_manager_t* man,
pk_t* po, pk_t* pa, pk_t* pb);
#ifdef __cplusplus
}
#endif
#endif
|
/**
* @file
*
* @brief Public APIs for the I2C EEPROM Slave driver.
*/
/*
* Copyright (c) 2017 BayLibre, SAS
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DRIVERS_I2C_SLAVE_EEPROM_H_
#define ZEPHYR_INCLUDE_DRIVERS_I2C_SLAVE_EEPROM_H_
/**
* @brief I2C EEPROM Slave Driver API
* @defgroup i2c_eeprom_slave_api I2C EEPROM Slave Driver API
* @ingroup io_interfaces
* @{
*/
/**
* @brief Program memory of the virtual EEPROM
*
* @param dev Pointer to the device structure for the driver instance.
* @param eeprom_data Pointer of data to program into the virtual eeprom memory
* @param length Length of data to program into the virtual eeprom memory
*
* @retval 0 If successful.
* @retval -EINVAL Invalid data size
*/
int eeprom_slave_program(struct device *dev, u8_t *eeprom_data,
unsigned int length);
/**
* @brief Read single byte of virtual EEPROM memory
*
* @param dev Pointer to the device structure for the driver instance.
* @param eeprom_data Pointer of byte where to store the virtual eeprom memory
* @param offset Offset into EEPROM memory where to read the byte
*
* @retval 0 If successful.
* @retval -EINVAL Invalid data pointer or offset
*/
int eeprom_slave_read(struct device *dev, u8_t *eeprom_data,
unsigned int offset);
/**
* @}
*/
#endif /* ZEPHYR_INCLUDE_DRIVERS_I2C_SLAVE_EEPROM_H_ */
|
//
// ConnectSDK.h
// Connect SDK
//
// Created by Andrew Longstaff on 9/6/13.
// Copyright (c) 2014 LG Electronics.
//
// 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.
//
#import <Foundation/Foundation.h>
#import "DiscoveryManager.h"
#import "DiscoveryManagerDelegate.h"
#import "DiscoveryProviderDelegate.h"
#import "ConnectableDevice.h"
#import "ConnectableDeviceDelegate.h"
#import "DevicePicker.h"
#import "DevicePickerDelegate.h"
#import "ServiceAsyncCommand.h"
#import "ServiceCommand.h"
#import "ServiceCommandDelegate.h"
#import "ServiceSubscription.h"
#import "CapabilityFilter.h"
#import "ExternalInputControl.h"
#import "KeyControl.h"
#import "TextInputControl.h"
#import "Launcher.h"
#import "MediaControl.h"
#import "MediaPlayer.h"
#import "MouseControl.h"
#import "PowerControl.h"
#import "ToastControl.h"
#import "TVControl.h"
#import "VolumeControl.h"
#import "WebAppLauncher.h"
#import "AppInfo.h"
#import "ChannelInfo.h"
#import "ExternalInputInfo.h"
#import "ImageInfo.h"
#import "MediaInfo.h"
#import "TextInputStatusInfo.h"
#import "ProgramInfo.h"
#import "LaunchSession.h"
#import "WebAppSession.h"
@interface ConnectSDK : NSObject
@end
|
/*
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
/* A simple helper for the perl function OpenSSL::Test::openssl_versions */
int main(void)
{
printf("Build version: %s\n", OPENSSL_FULL_VERSION_STR);
printf("Library version: %s\n",
OpenSSL_version(OPENSSL_FULL_VERSION_STRING));
return 0;
}
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 __itkVanHerkGilWermanUtilities_h
#define __itkVanHerkGilWermanUtilities_h
#include <list>
#include "itkSharedMorphologyUtilities.h"
namespace itk
{
/**
* \class VanHerkGilWermanUtilities
* \brief functionality in common for anchor openings/closings and
* erosions/dilation
*
* \ingroup ITK-MathematicalMorphology
*/
template< class PixelType, class TFunction >
void FillReverseExt(std::vector<PixelType> & pixbuffer,
std::vector<PixelType> & rExtBuffer,
const unsigned int KernLen, unsigned len);
template< class PixelType, class TFunction >
void FillForwardExt(std::vector<PixelType> & pixbuffer,
std::vector<PixelType> & fExtBuffer,
const unsigned int KernLen, unsigned len);
template< class TImage, class TBres, class TFunction, class TLine >
void DoFace(typename TImage::ConstPointer input,
typename TImage::Pointer output,
typename TImage::PixelType border,
TLine line,
const typename TBres::OffsetArray LineOffsets,
const unsigned int KernLen,
std::vector<typename TImage::PixelType> & pixbuffer,
std::vector<typename TImage::PixelType> & fExtBuffer,
std::vector<typename TImage::PixelType> & rExtBuffer,
const typename TImage::RegionType AllImage,
const typename TImage::RegionType face);
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkVanHerkGilWermanUtilities.txx"
#endif
#endif
|
/*
* Copyright 2010-2012 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.
*/
/**
* L B Cookie Stickiness Policy
*/
@interface ElasticLoadBalancingLBCookieStickinessPolicy:NSObject
{
NSString *policyName;
NSNumber *cookieExpirationPeriod;
}
/**
* The name for the policy being created. The name must be unique within
* the set of policies for this LoadBalancer.
*/
@property (nonatomic, retain) NSString *policyName;
/**
* The time period in seconds after which the cookie should be considered
* stale. Not specifying this parameter indicates that the stickiness
* session will last for the duration of the browser session.
*/
@property (nonatomic, retain) NSNumber *cookieExpirationPeriod;
/**
* Default constructor for a new LBCookieStickinessPolicy object. Callers should use the
* property methods to initialize this object after creating it.
*/
-(id)init;
/**
* Constructs a new LBCookieStickinessPolicy object.
* Callers should use properties to initialize any additional object members.
*
* @param thePolicyName The name for the policy being created. The name
* must be unique within the set of policies for this LoadBalancer.
* @param theCookieExpirationPeriod The time period in seconds after
* which the cookie should be considered stale. Not specifying this
* parameter indicates that the stickiness session will last for the
* duration of the browser session.
*/
-(id)initWithPolicyName:(NSString *)thePolicyName andCookieExpirationPeriod:(NSNumber *)theCookieExpirationPeriod;
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*/
-(NSString *)description;
@end
|
static GstCheckABIStruct list[] = {
{"GstAllocationParams", sizeof (GstAllocationParams), 32},
{"GstAllocator", sizeof (GstAllocator), 100},
{"GstAllocatorClass", sizeof (GstAllocatorClass), 116},
{"GstBinClass", sizeof (GstBinClass), 292},
{"GstBin", sizeof (GstBin), 232},
{"GstBuffer", sizeof (GstBuffer), 80},
{"GstBufferPoolAcquireParams", sizeof (GstBufferPoolAcquireParams), 40},
{"GstBufferPool", sizeof (GstBufferPool), 80},
{"GstBufferPoolClass", sizeof (GstBufferPoolClass), 144},
{"GstBusClass", sizeof (GstBusClass), 116},
{"GstBus", sizeof (GstBus), 76},
{"GstCaps", sizeof (GstCaps), 36},
{"GstClockClass", sizeof (GstClockClass), 132},
{"GstClockEntry", sizeof (GstClockEntry), 68},
{"GstClock", sizeof (GstClock), 76},
{"GstControlBinding", sizeof (GstControlBinding), 88},
{"GstControlBindingClass", sizeof (GstControlBindingClass), 124},
{"GstControlSource", sizeof (GstControlSource), 80},
{"GstControlSourceClass", sizeof (GstControlSourceClass), 108},
{"GstDebugCategory", sizeof (GstDebugCategory), 16},
{"GstElementClass", sizeof (GstElementClass), 248},
{"GstElement", sizeof (GstElement), 172},
{"GstEvent", sizeof (GstEvent), 52},
{"GstFormatDefinition", sizeof (GstFormatDefinition), 16},
{"GstGhostPadClass", sizeof (GstGhostPadClass), 136},
{"GstGhostPad", sizeof (GstGhostPad), 296},
{"GstIterator", sizeof (GstIterator), 60},
{"GstMemory", sizeof (GstMemory), 60},
{"GstMapInfo", sizeof (GstMapInfo), 52},
{"GstMessage", sizeof (GstMessage), 76},
{"GstMeta", sizeof (GstMeta), 8},
{"GstMetaTransformCopy", sizeof (GstMetaTransformCopy), 12},
{"GstMiniObject", sizeof (GstMiniObject), 36},
{"GstObjectClass", sizeof (GstObjectClass), 92},
{"GstObject", sizeof (GstObject), 56},
{"GstPadClass", sizeof (GstPadClass), 116},
{"GstPad", sizeof (GstPad), 288},
{"GstPadProbeInfo", sizeof (GstPadProbeInfo), 40},
{"GstPadTemplateClass", sizeof (GstPadTemplateClass), 112},
{"GstPadTemplate", sizeof (GstPadTemplate), 88},
{"GstParamSpecFraction", sizeof (GstParamSpecFraction), 64},
{"GstPipelineClass", sizeof (GstPipelineClass), 308},
{"GstPipeline", sizeof (GstPipeline), 272},
{"GstPluginDesc", sizeof (GstPluginDesc), 60},
{"GstProxyPadClass", sizeof (GstProxyPadClass), 120},
{"GstProxyPad", sizeof (GstProxyPad), 292},
{"GstQuery", sizeof (GstQuery), 40},
{"GstRegistryClass", sizeof (GstRegistryClass), 92},
{"GstRegistry", sizeof (GstRegistry), 60},
{"GstSegment", sizeof (GstSegment), 96},
{"GstStaticCaps", sizeof (GstStaticCaps), 24},
{"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 36},
{"GstStructure", sizeof (GstStructure), 8},
{"GstSystemClockClass", sizeof (GstSystemClockClass), 148},
{"GstSystemClock", sizeof (GstSystemClock), 96},
{"GstTagList", sizeof (GstTagList), 36},
{"GstTaskClass", sizeof (GstTaskClass), 112},
{"GstTask", sizeof (GstTask), 116},
{"GstTaskPoolClass", sizeof (GstTaskPoolClass), 124},
{"GstTaskPool", sizeof (GstTaskPool), 76},
{"GstTimedValue", sizeof (GstTimedValue), 16},
{"GstTypeFind", sizeof (GstTypeFind), 32},
{"GstValueTable", sizeof (GstValueTable), 32},
{NULL, 0, 0}
};
|
/* coio_c_evbuffer.h: partial implemention of evbuffer in libevent-1.4.13
*
* This BSD-licensed code was originally copied from buffer.c in
* libevent-1.4.13.
*/
struct coio_evbuffer {
u_char *buffer;
u_char *orig_buffer;
size_t misalign;
size_t totallen;
size_t off;
void (*cb)(struct coio_evbuffer *, size_t, size_t, void *);
void *cbarg;
};
struct coio_evbuffer *coio_evbuffer_new(void);
void coio_evbuffer_free(struct coio_evbuffer *);
int coio_evbuffer_expand(struct coio_evbuffer *, size_t);
int coio_evbuffer_add(struct coio_evbuffer *, const void *, size_t);
void coio_evbuffer_drain(struct coio_evbuffer *, size_t);
/* Original evbuffer code
* Copyright (c) 2002, 2003 Niels Provos <provos@citi.umich.edu>
* 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
struct coio_evbuffer *
coio_evbuffer_new(void)
{
struct coio_evbuffer *buffer;
buffer = calloc(1, sizeof(struct coio_evbuffer));
return (buffer);
}
void
coio_evbuffer_free(struct coio_evbuffer *buffer)
{
if (buffer->orig_buffer != NULL)
free(buffer->orig_buffer);
free(buffer);
}
/** This function is not part of original libevent evbuffer */
inline void
coio_evbuffer_reset(struct coio_evbuffer *buffer)
{
if (buffer->orig_buffer != NULL)
free(buffer->orig_buffer);
memset(buffer, '\0', sizeof(*buffer));
}
/* Adds data to an event buffer */
static void
coio_evbuffer_align(struct coio_evbuffer *buf)
{
memmove(buf->orig_buffer, buf->buffer, buf->off);
buf->buffer = buf->orig_buffer;
buf->misalign = 0;
}
/* Expands the available space in the event buffer to at least datlen */
int
coio_evbuffer_expand(struct coio_evbuffer *buf, size_t datlen)
{
size_t need = buf->misalign + buf->off + datlen;
/* If we can fit all the data, then we don't have to do anything */
if (buf->totallen >= need)
return (0);
/*
* If the misalignment fulfills our data needs, we just force an
* alignment to happen. Afterwards, we have enough space.
*/
if (buf->misalign >= datlen) {
coio_evbuffer_align(buf);
} else {
void *newbuf;
size_t length = buf->totallen;
if (length < 256)
length = 256;
while (length < need)
length <<= 1;
if (buf->orig_buffer != buf->buffer)
coio_evbuffer_align(buf);
if ((newbuf = realloc(buf->buffer, length)) == NULL)
return (-1);
buf->orig_buffer = buf->buffer = newbuf;
buf->totallen = length;
}
return (0);
}
int
coio_evbuffer_add(struct coio_evbuffer *buf, const void *data, size_t datlen)
{
size_t need = buf->misalign + buf->off + datlen;
size_t oldoff = buf->off;
if (buf->totallen < need) {
if (coio_evbuffer_expand(buf, datlen) == -1)
return (-1);
}
memcpy(buf->buffer + buf->off, data, datlen);
buf->off += datlen;
if (datlen && buf->cb != NULL)
(*buf->cb)(buf, oldoff, buf->off, buf->cbarg);
return (0);
}
void
coio_evbuffer_drain(struct coio_evbuffer *buf, size_t len)
{
size_t oldoff = buf->off;
if (len >= buf->off) {
buf->off = 0;
buf->buffer = buf->orig_buffer;
buf->misalign = 0;
goto done;
}
buf->buffer += len;
buf->misalign += len;
buf->off -= len;
done:
/* Tell someone about changes in this buffer */
if (buf->off != oldoff && buf->cb != NULL)
(*buf->cb)(buf, oldoff, buf->off, buf->cbarg);
}
|
//========================================================================
//
// FontInfo.h
//
// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005-2008, 2010, 2011 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
// Copyright (C) 2009 Pino Toscano <pino@kde.org>
// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================
//========================================================================
//
// Based on code from pdffonts.cc
//
// Copyright 2001-2007 Glyph & Cog, LLC
//
//========================================================================
#ifndef FONT_INFO_H
#define FONT_INFO_H
#include "Object.h"
#include "goo/gtypes.h"
#include "goo/GooList.h"
class GfxFont;
class PDFDoc;
class FontInfo {
public:
enum Type {
unknown,
Type1,
Type1C,
Type1COT,
Type3,
TrueType,
TrueTypeOT,
CIDType0,
CIDType0C,
CIDType0COT,
CIDTrueType,
CIDTrueTypeOT
};
// Constructor.
FontInfo(GfxFont *fontA, PDFDoc *doc);
// Copy constructor
FontInfo(FontInfo& f);
// Destructor.
~FontInfo();
GooString *getName() { return name; };
GooString *getSubstituteName() { return substituteName; };
GooString *getFile() { return file; };
GooString *getEncoding() { return encoding; };
Type getType() { return type; };
GBool getEmbedded() { return emb; };
GBool getSubset() { return subset; };
GBool getToUnicode() { return hasToUnicode; };
Ref getRef() { return fontRef; };
Ref getEmbRef() { return embRef; };
private:
GooString *name;
GooString *substituteName;
GooString *file;
GooString *encoding;
Type type;
GBool emb;
GBool subset;
GBool hasToUnicode;
Ref fontRef;
Ref embRef;
};
class FontInfoScanner {
public:
// Constructor.
FontInfoScanner(PDFDoc *doc, int firstPage = 0);
// Destructor.
~FontInfoScanner();
GooList *scan(int nPages);
private:
PDFDoc *doc;
int currentPage;
std::set<int> fonts;
std::set<int> visitedObjects;
void scanFonts(Dict *resDict, GooList *fontsList);
};
#endif
|
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SpeechRecognition_h
#define SpeechRecognition_h
#include "bindings/core/v8/ActiveScriptWrappable.h"
#include "core/dom/ActiveDOMObject.h"
#include "modules/EventTargetModules.h"
#include "modules/ModulesExport.h"
#include "modules/speech/SpeechGrammarList.h"
#include "modules/speech/SpeechRecognitionResult.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebPrivatePtr.h"
#include "wtf/Compiler.h"
#include "wtf/text/WTFString.h"
namespace blink {
class ExceptionState;
class ExecutionContext;
class MediaStreamTrack;
class Page;
class SpeechRecognitionController;
class SpeechRecognitionError;
class MODULES_EXPORT SpeechRecognition final : public EventTargetWithInlineData, public ActiveScriptWrappable, public ActiveDOMObject {
USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition);
DEFINE_WRAPPERTYPEINFO();
public:
static SpeechRecognition* create(ExecutionContext*);
~SpeechRecognition() override;
// SpeechRecognition.idl implemementation.
// Attributes.
SpeechGrammarList* grammars() { return m_grammars; }
void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; }
String lang() { return m_lang; }
void setLang(const String& lang) { m_lang = lang; }
bool continuous() { return m_continuous; }
void setContinuous(bool continuous) { m_continuous = continuous; }
bool interimResults() { return m_interimResults; }
void setInterimResults(bool interimResults) { m_interimResults = interimResults; }
unsigned maxAlternatives() { return m_maxAlternatives; }
void setMaxAlternatives(unsigned maxAlternatives) { m_maxAlternatives = maxAlternatives; }
MediaStreamTrack* audioTrack() { return m_audioTrack; }
void setAudioTrack(MediaStreamTrack* audioTrack) { m_audioTrack = audioTrack; }
// Callable by the user.
void start(ExceptionState&);
void stopFunction();
void abort();
// Called by the SpeechRecognitionClient.
void didStartAudio();
void didStartSound();
void didStartSpeech();
void didEndSpeech();
void didEndSound();
void didEndAudio();
void didReceiveResults(const HeapVector<Member<SpeechRecognitionResult>>& newFinalResults, const HeapVector<Member<SpeechRecognitionResult>>& currentInterimResults);
void didReceiveNoMatch(SpeechRecognitionResult*);
void didReceiveError(SpeechRecognitionError*);
void didStart();
void didEnd();
// EventTarget.
const AtomicString& interfaceName() const override;
ExecutionContext* getExecutionContext() const override;
// ActiveScriptWrappable.
bool hasPendingActivity() const final;
// ActiveDOMObject
void contextDestroyed() override;
DEFINE_ATTRIBUTE_EVENT_LISTENER(audiostart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(soundstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(speechstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(speechend);
DEFINE_ATTRIBUTE_EVENT_LISTENER(soundend);
DEFINE_ATTRIBUTE_EVENT_LISTENER(audioend);
DEFINE_ATTRIBUTE_EVENT_LISTENER(result);
DEFINE_ATTRIBUTE_EVENT_LISTENER(nomatch);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
DEFINE_ATTRIBUTE_EVENT_LISTENER(start);
DEFINE_ATTRIBUTE_EVENT_LISTENER(end);
DECLARE_VIRTUAL_TRACE();
private:
SpeechRecognition(Page*, ExecutionContext*);
Member<SpeechGrammarList> m_grammars;
Member<MediaStreamTrack> m_audioTrack;
String m_lang;
bool m_continuous;
bool m_interimResults;
unsigned long m_maxAlternatives;
Member<SpeechRecognitionController> m_controller;
bool m_started;
bool m_stopping;
HeapVector<Member<SpeechRecognitionResult>> m_finalResults;
};
} // namespace blink
#endif // SpeechRecognition_h
|
/*
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef UTF16TextIterator_h
#define UTF16TextIterator_h
#include "platform/PlatformExport.h"
#include "wtf/text/WTFString.h"
#include "wtf/unicode/CharacterNames.h"
namespace blink {
class PLATFORM_EXPORT UTF16TextIterator {
public:
// The passed in UChar pointer starts at 'offset'. The iterator operates on the range [offset, endOffset].
// 'length' denotes the maximum length of the UChar array, which might exceed 'endOffset'.
UTF16TextIterator(const UChar*, int length);
// FIXME: The offset/endOffset fields are only used by the SimpleShaper,
// remove once HarfBuzz is used for all text.
UTF16TextIterator(const UChar*, int offset, int endOffset, int length);
inline bool consume(UChar32& character)
{
if (m_offset >= m_endOffset)
return false;
character = *m_characters;
m_currentGlyphLength = 1;
if (character < hiraganaLetterSmallACharacter || consumeSlowCase(character)) {
if (U_GET_GC_MASK(character) & U_GC_M_MASK)
consumeMultipleUChar();
return true;
}
return false;
}
void advance()
{
m_characters += m_currentGlyphLength;
m_offset += m_currentGlyphLength;
}
int offset() const { return m_offset; }
const UChar* characters() const { return m_characters; }
const UChar* glyphEnd() const { return m_characters + m_currentGlyphLength; }
// FIXME: Only used by SimpleShaper, should be removed once the SimpleShaper
// is removed.
unsigned glyphLength() const { return m_currentGlyphLength; }
private:
bool consumeSlowCase(UChar32&);
void consumeMultipleUChar();
UChar32 normalizeVoicingMarks();
const UChar* m_characters;
const UChar* m_charactersEnd;
int m_offset;
int m_endOffset;
unsigned m_currentGlyphLength;
};
}
#endif
|
/*
* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
* Copyright (C) 2005 Eric Seidel <eric@webkit.org>
* Copyright (C) 2010 Dirk Schulze <krit@webkit.org>
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGFEImage_h
#define SVGFEImage_h
#include "core/dom/TreeScope.h"
#include "core/svg/SVGPreserveAspectRatio.h"
#include "platform/graphics/filters/FilterEffect.h"
namespace blink {
class Image;
class LayoutObject;
class FEImage final : public FilterEffect {
public:
static PassRefPtrWillBeRawPtr<FEImage> createWithImage(Filter*, PassRefPtr<Image>, PassRefPtrWillBeRawPtr<SVGPreserveAspectRatio>);
static PassRefPtrWillBeRawPtr<FEImage> createWithIRIReference(Filter*, TreeScope&, const String&, PassRefPtrWillBeRawPtr<SVGPreserveAspectRatio>);
FloatRect determineAbsolutePaintRect(const FloatRect& requestedRect) override;
FilterEffectType filterEffectType() const override { return FilterEffectTypeImage; }
// feImage does not perform color interpolation of any kind, so doesn't
// depend on the value of color-interpolation-filters.
void setOperatingColorSpace(ColorSpace) override { }
TextStream& externalRepresentation(TextStream&, int indention) const override;
PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) override;
DECLARE_VIRTUAL_TRACE();
private:
~FEImage() override {}
FEImage(Filter*, PassRefPtr<Image>, PassRefPtrWillBeRawPtr<SVGPreserveAspectRatio>);
FEImage(Filter*, TreeScope&, const String&, PassRefPtrWillBeRawPtr<SVGPreserveAspectRatio>);
LayoutObject* referencedLayoutObject() const;
PassRefPtr<SkImageFilter> createImageFilterForLayoutObject(LayoutObject&, SkiaImageFilterBuilder*);
RefPtr<Image> m_image;
// m_treeScope will never be a dangling reference. See https://bugs.webkit.org/show_bug.cgi?id=99243
RawPtrWillBeMember<TreeScope> m_treeScope;
String m_href;
RefPtrWillBeMember<SVGPreserveAspectRatio> m_preserveAspectRatio;
};
} // namespace blink
#endif // SVGFEImage_h
|
/*
* Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef XPathNodeSet_h
#define XPathNodeSet_h
#include "core/dom/Node.h"
#include "wtf/Forward.h"
#include "wtf/Vector.h"
namespace blink {
namespace XPath {
class NodeSet final : public GarbageCollected<NodeSet> {
public:
static NodeSet* create() { return new NodeSet; }
static NodeSet* create(const NodeSet&);
DEFINE_INLINE_TRACE() { visitor->trace(m_nodes); }
size_t size() const { return m_nodes.size(); }
bool isEmpty() const { return !m_nodes.size(); }
Node* operator[](unsigned i) const { return m_nodes.at(i).get(); }
void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(newCapacity); }
void clear() { m_nodes.clear(); }
void swap(NodeSet& other) { std::swap(m_isSorted, other.m_isSorted); std::swap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint); m_nodes.swap(other.m_nodes); }
// NodeSet itself does not verify that nodes in it are unique.
void append(Node* node) { m_nodes.append(node); }
void append(const NodeSet& nodeSet) { m_nodes.appendVector(nodeSet.m_nodes); }
// Returns the set's first node in document order, or 0 if the set is empty.
Node* firstNode() const;
// Returns 0 if the set is empty.
Node* anyNode() const;
// NodeSet itself doesn't check if it contains nodes in document order - the
// caller should tell it if it does not.
void markSorted(bool isSorted) { m_isSorted = isSorted; }
bool isSorted() const { return m_isSorted || m_nodes.size() < 2; }
void sort() const;
// No node in the set is ancestor of another. Unlike m_isSorted, this is
// assumed to be false, unless the caller sets it to true.
void markSubtreesDisjoint(bool disjoint) { m_subtreesAreDisjoint = disjoint; }
bool subtreesAreDisjoint() const { return m_subtreesAreDisjoint || m_nodes.size() < 2; }
void reverse();
private:
NodeSet() : m_isSorted(true), m_subtreesAreDisjoint(false) { }
void traversalSort() const;
bool m_isSorted;
bool m_subtreesAreDisjoint;
HeapVector<Member<Node>> m_nodes;
};
} // namespace XPath
} // namespace blink
#endif // XPathNodeSet_h
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_CUSTOM_HANDLERS_PROTOCOL_HANDLER_H_
#define COMPONENTS_CUSTOM_HANDLERS_PROTOCOL_HANDLER_H_
#include <memory>
#include <string>
#include "base/time/time.h"
#include "base/values.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/security/protocol_handler_security_level.h"
#include "url/gurl.h"
namespace custom_handlers {
// A single tuple of (protocol, url, last_modified) that indicates how URLs
// of the given protocol should be rewritten to be handled.
// The |last_modified| field is used to correctly perform deletion
// of protocol handlers based on time ranges.
class ProtocolHandler {
public:
static ProtocolHandler CreateProtocolHandler(
const std::string& protocol,
const GURL& url,
blink::ProtocolHandlerSecurityLevel security_level =
blink::ProtocolHandlerSecurityLevel::kStrict);
ProtocolHandler(const std::string& protocol,
const GURL& url,
base::Time last_modified,
blink::ProtocolHandlerSecurityLevel security_level);
static ProtocolHandler CreateWebAppProtocolHandler(
const std::string& protocol,
const GURL& url,
const std::string& app_id);
ProtocolHandler(const std::string& protocol,
const GURL& url,
const std::string& app_id,
base::Time last_modified,
blink::ProtocolHandlerSecurityLevel security_level);
ProtocolHandler(const ProtocolHandler& other);
~ProtocolHandler();
// Creates a ProtocolHandler with fields from the dictionary. Returns an
// empty ProtocolHandler if the input is invalid.
static ProtocolHandler CreateProtocolHandler(const base::Value::Dict& value);
// Returns true if the dictionary value has all the necessary fields to
// define a ProtocolHandler.
static bool IsValidDict(const base::Value::Dict& value);
// Return true if the protocol handler meets security constraints.
bool IsValid() const;
// Returns true if this handler's url has the same origin as the given one.
bool IsSameOrigin(const ProtocolHandler& handler) const;
// Canonical empty ProtocolHandler.
static const ProtocolHandler& EmptyProtocolHandler();
// Interpolates the given URL into the URL template of this handler.
GURL TranslateUrl(const GURL& url) const;
// Returns true if the handlers are considered equivalent when determining
// if both handlers can be registered, or if a handler has previously been
// ignored.
bool IsEquivalent(const ProtocolHandler& other) const;
// Encodes this protocol handler as a DictionaryValue.
base::Value::Dict Encode() const;
// Returns a friendly name for |protocol| if one is available, otherwise
// this function returns |protocol|.
static std::u16string GetProtocolDisplayName(const std::string& protocol);
// Returns a friendly name for |this.protocol_| if one is available, otherwise
// this function returns |this.protocol_|.
std::u16string GetProtocolDisplayName() const;
const std::string& protocol() const { return protocol_; }
const GURL& url() const { return url_; }
const absl::optional<std::string>& web_app_id() const { return web_app_id_; }
const base::Time& last_modified() const { return last_modified_; }
bool IsEmpty() const { return protocol_.empty(); }
#if !defined(NDEBUG)
// Returns a string representation suitable for use in debugging.
std::string ToString() const;
#endif
bool operator==(const ProtocolHandler& other) const;
bool operator<(const ProtocolHandler& other) const;
private:
ProtocolHandler();
std::string protocol_;
GURL url_;
absl::optional<std::string> web_app_id_;
base::Time last_modified_;
blink::ProtocolHandlerSecurityLevel security_level_;
};
} // namespace custom_handlers
#endif // COMPONENTS_CUSTOM_HANDLERS_PROTOCOL_HANDLER_H_
|
/*
* This file is part of the JPNavigationController package.
* (c) NewPan <13246884282@163.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Click https://github.com/newyjp
* or http://www.jianshu.com/users/e2f2d779c022/latest_articles to contact me.
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIView (ScreenCapture)
/**
* Capture current view generate a image.
*
* @return a image of current view.
*/
- (UIImage *)jp_captureCurrentView;
@end
NS_ASSUME_NONNULL_END
|
/* Generated automatically. DO NOT EDIT! */
#define SIMD_HEADER "simd-support/simd-avx2-128.h"
#include "../common/q1bv_2.c"
|
/****************************************************************************
Copyright (c) 2014 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __TestCpp__UIWidgetAddNodeTest_Editor__
#define __TestCpp__UIWidgetAddNodeTest_Editor__
#include "../UIScene_Editor.h"
class UIWidgetAddNodeTest_Editor : public UIScene_Editor
{
public:
UIWidgetAddNodeTest_Editor();
~UIWidgetAddNodeTest_Editor();
bool init();
virtual void switchLoadMethod(Ref* pSender);
void configureGUIScene();
protected:
UI_SCENE_EDITOR_CREATE_FUNC(UIWidgetAddNodeTest_Editor)
};
#endif /* defined(__TestCpp__UIWidgetAddNodeTest_Editor__) */
|
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// XSDK
// Copyright (c) 2015 Schneider Electric
//
// Use, modification, and distribution is subject to the Boost Software License,
// Version 1.0 (See accompanying file LICENSE).
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#ifndef __AVKit_Utils_h
#define __AVKit_Utils_h
#include "XSDK/Types.h"
#include "XSDK/XSharedLib.h"
#include <climits>
namespace AVKit
{
// Adjusts requestedWidth X requestedHeight to maintain aspect ratio of streamWidth X streamHeight.
X_API void AspectCorrectDimensions( uint16_t streamWidth, uint16_t streamHeight,
uint16_t requestedWidth, uint16_t requestedHeight,
uint16_t& destWidth, uint16_t& destHeight );
X_API double QToD( int num, int den );
X_API void DToQ( double val, int& num, int& den, int max = INT_MAX );
}
#endif
|
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GTK_MISC_H__
#define __GTK_MISC_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_MISC (gtk_misc_get_type ())
#define GTK_MISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MISC, GtkMisc))
#define GTK_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MISC, GtkMiscClass))
#define GTK_IS_MISC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MISC))
#define GTK_IS_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MISC))
#define GTK_MISC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MISC, GtkMiscClass))
typedef struct _GtkMisc GtkMisc;
typedef struct _GtkMiscPrivate GtkMiscPrivate;
typedef struct _GtkMiscClass GtkMiscClass;
struct _GtkMisc
{
GtkWidget widget;
/*< private >*/
GtkMiscPrivate *priv;
};
struct _GtkMiscClass
{
GtkWidgetClass parent_class;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GDK_AVAILABLE_IN_ALL
GType gtk_misc_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gtk_misc_set_alignment (GtkMisc *misc,
gfloat xalign,
gfloat yalign);
GDK_AVAILABLE_IN_ALL
void gtk_misc_get_alignment (GtkMisc *misc,
gfloat *xalign,
gfloat *yalign);
GDK_AVAILABLE_IN_ALL
void gtk_misc_set_padding (GtkMisc *misc,
gint xpad,
gint ypad);
GDK_AVAILABLE_IN_ALL
void gtk_misc_get_padding (GtkMisc *misc,
gint *xpad,
gint *ypad);
void _gtk_misc_get_padding_and_border (GtkMisc *misc,
GtkBorder *border);
G_END_DECLS
#endif /* __GTK_MISC_H__ */
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "IDEGroup.h"
@class DVTDocumentLocation, DVTFileDataType, NSImage, NSString;
@interface IDEGroup (IDEKitGroupPropertyAdditions)
+ (id)keyPathsForValuesAffectingNavigableItem_name;
@property(readonly) DVTDocumentLocation *navigableItem_contentDocumentLocation;
@property(readonly) DVTFileDataType *navigableItem_documentType;
@property(readonly) NSImage *navigableItem_image;
@property(readonly) NSString *navigableItem_name;
@end
|
#ifndef _MAIN_H // If we haven't included this file
#define _MAIN_H // Set a flag saying we included it
#include <vector> // Include the STL vector class information
#include <iostream> // Include the standard C++ file
#include <string> // Include this for the string class
#include <windows.h> // We need to include windows.h for win32 calls
#include <mmsystem.h> // This is included for when we use PlaySound()
#include "bitmap.h" // Include the bitmap function prototypes first
#include "resource.h" // Include our resource file for our menu
using namespace std; // We are using the standard namespace for C++
#include "Map.h" // Include our map information for our variables
#include "Player.h" // Include the player information
#include "CFmod.h" // Include our Fmod engine code
#include "Menu.h" // Include our menu class info
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
#include "ActionKeys.h" // Include the action keys class (CAction)
// Let's make our action keys object global
extern CAction g_ActionKeys;
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
const int kScreenWidth = 640; // We want our screen width 800 pixels
const int kScreenHeight = 480; // We want our screen height 600 pixels
const int kMenuOffset = 16; // The pixel offset for the menu bar
// Create an externed map class variable for handling our maps
extern CMap g_Map;
// Allow other files to access the player's data by creating a global externed player object
extern CPlayer g_Player;
// Here we extern our global music and menu object
extern CFmod g_Music;
extern CMenu g_Menu;
extern HWND g_hWnd; // This is the handle for the window
extern HINSTANCE g_hInstance; // This holds our window hInstance
// Create a double buffer class variable for both our windows
extern CBuffer g_Buffer;
// Create an extern to our global variable that stores our current cursor position
extern POINT g_cursorPos;
// This is our simple class that stores the information about user input
class CInput
{
public:
// These are our simple GET functions to check for input
int IsLeftMousePressed() { return GetAsyncKeyState(VK_LBUTTON) & 0x8000; }
int IsRightMousePressed() { return GetAsyncKeyState(VK_RBUTTON) & 0x8000; }
int IsKeyDown(int keyCode) { return GetAsyncKeyState(keyCode) & 0x8000; }
// This checks for window messages and returns a -1 for the quit message
int HandleWindowsMessages();
};
// We extern the global input object after we defined the class
extern CInput g_Input;
// The function prototype for our WndProc (The function that handles all the windows messages)
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
// This function is our call back window procedure for our tool bar window
LRESULT CALLBACK WndProcPopup(HWND, UINT, WPARAM, LPARAM);
// This initializes our main application specific data
void Init(HWND hWnd);
// This handles the input from the user
void HandleGameInput();
// This controls our main program loop
WPARAM MainLoop();
// This frees memory and quits the program
void DeInit();
#endif
////////////////////////////////////////////////////////////////////
//
// *Quick Notes*
//
// We added the header file for our action keys class/data and also
// an extern to the global g_ActionKeys object.
//
//
// Ben Humphrey (DigiBen)
// Game Programmer
// DigiBen@GameTutorials.com
// Co-Web Host of www.GameTutorials.com
//
// © 2000-2005 GameTutorials
|
//******************************************************************************
//
// Copyright (c) Microsoft. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once
#import <stdint.h>
#import <limits.h>
#import <cstddef>
#ifndef _MAX_PATH
#define _MAX_PATH PATH_MAX
#endif
#ifndef MAX_PATH
#define MAX_PATH PATH_MAX
#endif
#ifndef _MAX_FNAME
#define _MAX_FNAME NAME_MAX
#endif
#ifndef DWORD
#define DWORD uint32_t
#endif
#if defined(__BIG_ENDIAN__)
#define WCHAR_ENCODING NSUTF32BigEndianStringEncoding
#elif defined(__LITTLE_ENDIAN__)
#define WCHAR_ENCODING NSUTF32LittleEndianStringEncoding
#endif
long InterlockedExchange(long volatile* Target, long Value);
long _InterlockedExchange(long volatile* Target, long Value);
long InterlockedIncrement(long volatile* Addend);
long InterlockedDecrement(long volatile* Addend);
void Sleep(DWORD dwMilliseconds);
bool SetCurrentDirectoryW(const wchar_t* lpPathName);
DWORD GetCurrentDirectoryW(DWORD nBufferLength, wchar_t* lpBuffer);
DWORD GetCurrentProcessId(void);
char* _getcwd(char* buf, size_t size);
char* _strdup(const char* s); |
/* -*- C++ -*- */
//=============================================================================
/**
* @file config-win32-msvc-9.h
*
* $Id: config-win32-msvc-9.h 91285 2010-08-05 08:29:30Z johnnyw $
*
* @brief Microsoft Visual C++ 9.0 configuration file.
*
* This file is the ACE configuration file for Microsoft Visual C++ version 9.
*
* @note Do not include this file directly, include config-win32.h instead.
*/
//=============================================================================
#ifndef ACE_CONFIG_WIN32_MSVC_9_H
#define ACE_CONFIG_WIN32_MSVC_9_H
#include /**/ "ace/pre.h"
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
#ifndef ACE_WIN32_VC9
# define ACE_WIN32_VC9
#endif
// Visual C++ 9.0 (.NET) deprecated the old iostreams
#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY)
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#endif
#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#endif
// Windows' timeval is non-conformant (defined in terms of long instead of
// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value
// even when compiling a 32-bit application. Therefore, ace/Time_Value
// needs to rearrange a few things for this compiler. See Time_Value.h
// for complete details.
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_TIME_T_LONG_MISMATCH
#endif
#define ACE_HAS_ITOA
#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
#define ACE_ITOA_EQUIVALENT ::_itoa
#define ACE_STRCASECMP_EQUIVALENT ::_stricmp
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
#if defined (ACE_HAS_WINCE)
# define ACE_FILENO_EQUIVALENT ::_fileno
#else
# define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X)))
#endif
// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will.
# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601)
# define ACE_HAS_SIG_ATOMIC_T
# endif /* !Win CE 6.0 or less */
#define ACE_LACKS_STRPTIME
// Evaluate this with a WinCE build; maybe things have improved since VC8.
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_INTRIN_H
# define ACE_HAS_INTRINSIC_INTERLOCKED
#endif
#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501)
# define ACE_HAS_INTRINSIC_BYTESWAP
#endif
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_STRRECVFD
#define ACE_HAS_CPLUSPLUS_HEADERS
#define ACE_HAS_TEMPLATE_TYPEDEFS
#define ACE_TEMPLATES_REQUIRE_SOURCE
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
#define ACE_HAS_TLI_PROTOTYPES
// Platform support linebuffered streaming is broken
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
// Platform has its Standard C++ library in the namespace std
# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
// ace/iostream.h does not work with the standard cpp library (yet).
# if !defined (ACE_USES_OLD_IOSTREAMS)
# define ACE_LACKS_ACE_IOSTREAM
# endif /* ! ACE_USES_OLD_IOSTREAMS */
// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory.
#define ACE_NEW_THROWS_EXCEPTIONS
#define ACE_HAS_NEW_NOTHROW
#else
// iostream header lacks ipfx (), isfx (), etc., declarations
# define ACE_LACKS_IOSTREAM_FX
#endif
// There are too many instances of this warning to fix it right now.
// Maybe in the future.
// Disable warning of using Microsoft Extension.
# pragma warning(disable:4231)
// 'class1' : inherits 'class2::member' via dominance
#pragma warning(disable:4250)
// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT.
#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT)
# define ACE_HAS_TR24731_2005_CRT
#endif
// On CE w/o MFC config-WinCE.h needs to declare a placement new. This
// triggers a warning that there's no placement delete, which can be ignored.
#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC)
# pragma warning(disable:4291)
#endif
// A template can not be exported. Only an instantiation may be exported.
#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to
// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC.
# define ACE_NEEDS_FUNC_DEFINITIONS
// Windows Vista and Windows Server 2008 and newer do have native condition
// variables
#if defined (WIN32_WINNT) && (WIN32_WINNT >= 0x0600)
# define ACE_HAS_WTHREADS_CONDITION_VARIABLE
# undef ACE_LACKS_COND_T
#endif
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MSVC_9_H */
|
#ifndef _KSPLICE_PATCH_H
#define _KSPLICE_PATCH_H
#define KSPLICE_OPTION_ASSUME_RODATA 0
#define KSPLICE_OPTION_MATCH_DATA_EARLY 1
struct ksplice_option {
int type;
const void *target;
} __attribute__((packed));
#ifdef __KERNEL__
#include <linux/gfp.h>
#include <linux/stringify.h>
#ifndef __used
#define __used __attribute_used__
#endif
#define ksplice_call_int(name, fn) \
static typeof(int (*)(void)) __ksplice_##name##_##fn __used \
__attribute__((__section__(".ksplice_call_" #name))) = fn
#define ksplice_call_void(name, fn) \
static typeof(void (*)(void)) __ksplice_##name##_##fn __used \
__attribute__((__section__(".ksplice_call_" #name))) = fn
#define ksplice_pre_apply(fn) ksplice_call_int(pre_apply, fn)
#define ksplice_check_apply(fn) ksplice_call_int(check_apply, fn)
#define ksplice_apply(fn) ksplice_call_void(apply, fn)
#define ksplice_post_apply(fn) ksplice_call_void(post_apply, fn)
#define ksplice_fail_apply(fn) ksplice_call_void(fail_apply, fn)
#define ksplice_pre_reverse(fn) ksplice_call_int(pre_reverse, fn)
#define ksplice_check_reverse(fn) ksplice_call_int(check_reverse, fn)
#define ksplice_reverse(fn) ksplice_call_void(reverse, fn)
#define ksplice_post_reverse(fn) ksplice_call_void(post_reverse, fn)
#define ksplice_fail_reverse(fn) ksplice_call_void(fail_reverse, fn)
#define ksplice_assume_rodata(obj) \
ksplice_option(KSPLICE_OPTION_ASSUME_RODATA, obj)
#define ksplice_match_data_early(obj) \
ksplice_option(KSPLICE_OPTION_MATCH_DATA_EARLY, obj)
#if BITS_PER_LONG == 32
#define KSPLICE_PTR ".long"
#elif BITS_PER_LONG == 64
#define KSPLICE_PTR ".quad"
#endif /* BITS_PER_LONG */
#define ksplice_option(num, obj) \
__asm__(".pushsection \".ksplice_options\", \"a\"\n" \
"\t.long " __stringify(num) "\n" \
"\t" KSPLICE_PTR " " #obj "\n" \
".popsection")
int init_shadow_field_type(int *shadow_key, typeof(GFP_KERNEL) gfp_flags);
void *init_shadow_field(int *shadow_key, void *obj, int size,
typeof(GFP_KERNEL) gfp_flags);
void cleanup_shadow_field(int *shadow_key, void *obj);
void *get_shadow_field(int *shadow_key, void *obj);
void cleanup_shadow_field_type(int *shadow_key);
#define __DEFINE_SHADOW_FIELD(base_type, field_type, gfp_flags, \
init_field_type_fn, init_field_fn, get_field_fn, \
make_field_fn, cleanup_field_fn, \
cleanup_field_type_fn, shadow_key, init_field) \
static int shadow_key = 0; \
int init_field_type_fn(void) \
{ \
return init_shadow_field_type(&shadow_key, gfp_flags); \
} \
field_type *init_field_fn(base_type *obj, typeof(GFP_KERNEL) flags) \
{ \
field_type *data = init_shadow_field(&shadow_key, (void *)obj, \
sizeof(*data), flags); \
if (data != NULL) \
init_field(data); \
return data; \
} \
void cleanup_field_fn(base_type *obj) \
{ \
cleanup_shadow_field(&shadow_key, obj); \
} \
field_type *get_field_fn(base_type *obj) \
{ \
return get_shadow_field(&shadow_key, obj); \
} \
field_type *make_field_fn(base_type *obj, typeof(GFP_KERNEL) flags) \
{ \
void *data = get_shadow_field(&shadow_key, (void *)obj); \
if (data == NULL) \
data = init_field_fn(obj, flags); \
return data; \
} \
void cleanup_field_type_fn(void) \
{ \
return cleanup_shadow_field_type(&shadow_key); \
} \
struct eat_trailing_semicolon
#define DEFINE_SHADOW_FIELD(base_type, field_type, gfp_flags, name, init_field) \
__DEFINE_SHADOW_FIELD(base_type, field_type, gfp_flags, \
init_##name##_shadows, init_##name##_shadow, \
get_##name##_shadow, make_##name##_shadow, \
cleanup_##name##_shadow, cleanup_##name##_shadows,\
shadow_key_##name, init_field); \
ksplice_check_apply(init_##name##_shadows); \
ksplice_post_reverse(cleanup_##name##_shadows); \
ksplice_fail_apply(cleanup_##name##_shadows)
#define __DECLARE_SHADOW_FIELD(base_type, field_type, init_field_type_fn, \
init_field_fn, get_field_fn, make_field_fn, \
cleanup_field_fn, cleanup_field_type_fn) \
int init_field_type_fn(void); \
field_type *init_field_fn(base_type *obj, typeof(GFP_KERNEL) flags); \
void cleanup_field_fn(base_type *obj); \
field_type *get_field_fn(base_type *obj); \
field_type *make_field_fn(base_type *obj, typeof(GFP_KERNEL) flags); \
void cleanup_field_type_fn(void)
#define DECLARE_SHADOW_FIELD(base_type, field_type, name) \
__DECLARE_SHADOW_FIELD(base_type, field_type, init_##name##_shadows, \
init_##name##_shadow, get_##name##_shadow, \
make_##name##_shadow, cleanup_##name##_shadow, \
cleanup_##name##_shadows)
#endif /* __KERNEL__ */
#endif /* _KSPLICE_PATCH_H */
|
#ifndef OREGON_CONSOLE_H
#define OREGON_CONSOLE_H
#include "Common.h"
#include "Policies/Singleton.h"
#include <curses.h>
typedef WINDOW Window;
class Master;
class UnixDebugger;
class Console
{
public:
Console();
~Console();
protected:
friend class World;
friend class Master;
friend class Log;
friend class UnixDebugger;
friend void LoadSQLUpdates();
void Initialize();
/* Start-up Loading Stuff */
void SetLoading(bool show, const char* caption = "Initializing");
void SetLoadingLabel(const char* label, bool br = true);
void FatalError(const char* msg);
/* Main Loops */
void MainLoop();
void RunCommandLoop();
void RunLogViewLoop();
void DrawLogo();
bool IsEnabled() const
{
return m_IamEnabled;
}
void Beep()
{
beep();
}
class CliRunnable : public ACE_Based::Runnable
{
public:
void run();
};
void Restore();
private:
void SetTitle(const char* title)
{
#if PLATFORM == PLATFORM_WINDOWS
SetConsoleTitle("OregonCore");
#elif PLATFORM == PLATFORM_UNIX
printf("\033]0;%s\007", title);
fflush(stdout);
#endif
}
void Refresh();
int GetChar();
void DrawLoading();
void UpdateLog();
Window* MakeWindow(int h, int w, int y, int x);
void ResizeWindow(Window* win, int h, int w, int y, int x);
void DestroyWindow(Window* win);
std::set<Window*> m_windows;
bool m_IamEnabled;
typedef std::list<std::string> History;
#if PLATFORM == PLATFORM_WINDOWS
typedef HANDLE PipeType;
#else
typedef int PipeType;
#endif
History m_cmdHistory;
PipeType m_loggerFd;
Window* m_logoWindow;
Window* m_loadWindow;
Window* m_logViewer;
Window* m_cmdOutput;
};
#define sConsole Oregon::Singleton<Console>::Instance()
#endif
|
/*
* platform_bq24192.h: bq24192 platform data header file
*
* (C) Copyright 2008 Intel Corporation
* Author:
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*/
#ifndef _PLATFORM_BQ24192_H_
#define _PLATFORM_BQ24192_H_
extern void *bq24192_platform_data(void *info) __attribute__((weak));
#endif
|
/* ----------------------------------------------------------------------
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
Christoph Kloss, christoph.kloss@cfdem.com
Copyright 2009-2012 JKU Linz
Copyright 2012- DCS Computing GmbH, Linz
LIGGGHTS is based on LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
This software is distributed under the GNU General Public License.
See the README file in the top-level directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author for SPH:
Andreas Aigner (CD Lab Particulate Flow Modelling, JKU)
andreas.aigner@jku.at
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(wall/region/sph,FixWallRegionSph)
#else
#ifndef LMP_FIX_WALL_REGION_SPH_H
#define LMP_FIX_WALL_REGION_SPH_H
#include "fix_sph.h"
namespace LAMMPS_NS {
class FixWallRegionSph : public FixSph {
public:
FixWallRegionSph(class LAMMPS *, int, char **);
~FixWallRegionSph() {}
int setmask();
void init();
void setup(int);
void min_setup(int);
void post_force(int);
void post_force_respa(int, int, int);
void min_post_force(int);
double compute_scalar();
double compute_vector(int);
private:
template <int> void post_force_eval(int);
double repulsivSph(double);
double selfInfluenceForce(int, double, double, double);
int iregion;
double cutoff;
int eflag;
double ewall[4],ewall_all[4];
int nlevels_respa;
double dt;
double eng,fwall;
double r0,D; // coefficient for repulsivsph
};
}
#endif
#endif
|
#ifndef _DBG_AF_PARAM_H_
#define _DBG_AF_PARAM_H_
// --- AF debug info ---
#define AF_DEBUG_TAG_SIZE 1030
typedef struct
{
AAA_DEBUG_TAG_T Tag[AF_DEBUG_TAG_SIZE];
} AF_DEBUG_INFO_T;
typedef enum
{
IDX = 0, // search idx
POS, // lens position
VLU, // focus value
MINL, // idx for min FV in inf side
MAX, // idx for max FV
MINR, // idx for min FV in macro side
FIN_3P, // finish: Peak found from 3 points
FIN_ICL, // finish: Incline case
FIN_BND, // finish: Full search case
BEST_POS, // lens target position from curve fitting
FOCUS_POS, // focused lens position
LV, // light value
FAIL, // can not find peak
FAIL_BND, // can not find peak (boundary)
MAIN_THRES, // main threshold percent
SUB_THRES, // sub threshold percent
THRES_OFFSET, // spot threshold offset
MATRIX_THRES_OFFSET, // matrix threshold offset
THRES_VLU_MAIN, // main threshold value
STATE, // AF state
AFMODE, // 1: AFS, 2: AFC, 3: Macro, 4: Inf, 5: MF, 6: Cal, 7: Fullscan
METER_MENU, // 1: Spot, 2: Matrix
METER_REAL, // real meter
WIN_X, // AF window location - left
WIN_Y, // AF window location - top
WIN_W, // AF window location - width
WIN_H, // AF window location - height
AFTIME, // AF process time
FD_STATUS, // 0: no face, 1: face detected
SCAN_START, // fullscan start position
SCAN_STEP, // fullscan step interval
SCAN_NUM,
STEP_L, // lnfinity boundary in AF table
STEP_H, // macro boundary in AF table
AF_AREA_PERCENT_W, // AF window width vs image width percetage
AF_AREA_PERCENT_H, // AF window height vs image height percetage
FOCUSED_IDX_NEAREST, // nearest focused window idx
FOCUSED_IDX, // focused window idx
FOCUSED_IDX_FARTHEST, // farthest focused window idx
DOF, // DOF
VERSION, // version
ZOOM_W, // image width after zoom
ZOOM_H, // image higght after zoom
ZOOM_X, // image left,top position after zoom
ZOOM_Y, // image left,top position after zoom
FIRST_FV, // first focus value for scene change compare
CHANGE_FV, // scene change focus value
HW_TH, // af hardware threshold
FV_DC, // DC focus value
MIN_TH, // minimum threshold
ZSD, // is ZSD mode
ZSD_FIN_BND, // peak found in ZSD mode
ZSD_FAIL, // peak not found in ZSD mode
ZSD_MONO_VLU, // monotous focus value in ZSD mode
AE_STABLE, // is AE stable
ISO, // ISO value
GSUM, // G sum value
XCURR, // 2D interpolation Xcurr
ZCURR, // 2D interpolation Zcurr
X0, // 2D interpolation X0
X1, // 2D interpolation X1
Z0, // 2D interpolation Z0
Z1, // 2D interpolation Z1
Y00, // 2D interpolation Y00
Y01, // 2D interpolation Y01
Y10, // 2D interpolation Y10
Y11, // 2D interpolation Y11
FIRST_GS, // first gsum value for scene change compare
CHANGE_GS, // scene change gsum value
POST_COMP_OFFSET, // posture compensation offset
OVER_PATH_LENGTH
} AF_DEBUG_TAG_T;
#endif // _DBG_AF_PARAM_H_
|
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2018 Microsemi Corporation
*/
#include <common.h>
#include <image.h>
#include <init.h>
#include <log.h>
#include <asm/io.h>
#include <asm/addrspace.h>
#include <asm/types.h>
#include <spi.h>
#include <led.h>
#include <wait_bit.h>
#include <miiphy.h>
#include <linux/bitops.h>
DECLARE_GLOBAL_DATA_PTR;
enum {
BOARD_TYPE_PCB120 = 0xAABBCC00,
BOARD_TYPE_PCB123,
};
void mscc_switch_reset(bool enter)
{
/* Nasty workaround to avoid GPIO19 (DDR!) being reset */
mscc_gpio_set_alternate(19, 2);
debug("applying SwC reset\n");
writel(ICPU_RESET_CORE_RST_PROTECT, BASE_CFG + ICPU_RESET);
writel(PERF_SOFT_RST_SOFT_CHIP_RST, BASE_DEVCPU_GCB + PERF_SOFT_RST);
if (wait_for_bit_le32(BASE_DEVCPU_GCB + PERF_SOFT_RST,
PERF_SOFT_RST_SOFT_CHIP_RST, false, 5000, false))
pr_err("Tiemout while waiting for switch reset\n");
/*
* Reset GPIO19 mode back as regular GPIO, output, high (DDR
* not reset) (Order is important)
*/
setbits_le32(BASE_DEVCPU_GCB + PERF_GPIO_OE, BIT(19));
writel(BIT(19), BASE_DEVCPU_GCB + PERF_GPIO_OUT_SET);
mscc_gpio_set_alternate(19, 0);
}
int board_phy_config(struct phy_device *phydev)
{
if (gd->board_type == BOARD_TYPE_PCB123)
return 0;
phy_write(phydev, 0, 31, 0x10);
phy_write(phydev, 0, 18, 0x80F0);
while (phy_read(phydev, 0, 18) & 0x8000)
;
phy_write(phydev, 0, 31, 0);
return 0;
}
void board_debug_uart_init(void)
{
/* too early for the pinctrl driver, so configure the UART pins here */
mscc_gpio_set_alternate(6, 1);
mscc_gpio_set_alternate(7, 1);
}
int board_early_init_r(void)
{
/* Prepare SPI controller to be used in master mode */
writel(0, BASE_CFG + ICPU_SW_MODE);
clrsetbits_le32(BASE_CFG + ICPU_GENERAL_CTRL,
ICPU_GENERAL_CTRL_IF_SI_OWNER_M,
ICPU_GENERAL_CTRL_IF_SI_OWNER(2));
/* Address of boot parameters */
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE;
/* LED setup */
if (IS_ENABLED(CONFIG_LED))
led_default_state();
return 0;
}
static void do_board_detect(void)
{
u16 dummy = 0;
/* Enable MIIM */
mscc_gpio_set_alternate(14, 1);
mscc_gpio_set_alternate(15, 1);
if (mscc_phy_rd(1, 0, 0, &dummy) == 0)
gd->board_type = BOARD_TYPE_PCB120;
else
gd->board_type = BOARD_TYPE_PCB123;
}
#if defined(CONFIG_MULTI_DTB_FIT)
int board_fit_config_name_match(const char *name)
{
if (gd->board_type == BOARD_TYPE_PCB120 &&
strcmp(name, "ocelot_pcb120") == 0)
return 0;
if (gd->board_type == BOARD_TYPE_PCB123 &&
strcmp(name, "ocelot_pcb123") == 0)
return 0;
return -1;
}
#endif
#if defined(CONFIG_DTB_RESELECT)
int embedded_dtb_select(void)
{
do_board_detect();
fdtdec_setup();
return 0;
}
#endif
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018 Marek Vasut <marex@denx.de>
*
* Altera SoCFPGA EMAC extras
*/
#include <common.h>
#include <asm/io.h>
#include <dm.h>
#include <clk.h>
#include <phy.h>
#include <regmap.h>
#include <reset.h>
#include <syscon.h>
#include "designware.h"
#include <dm/device_compat.h>
#include <linux/err.h>
#include <asm/arch/system_manager.h>
struct dwmac_socfpga_platdata {
struct dw_eth_pdata dw_eth_pdata;
void *phy_intf;
u32 reg_shift;
};
static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
{
struct dwmac_socfpga_platdata *pdata = dev_get_platdata(dev);
struct regmap *regmap;
struct ofnode_phandle_args args;
void *range;
int ret;
ret = dev_read_phandle_with_args(dev, "altr,sysmgr-syscon", NULL,
2, 0, &args);
if (ret) {
dev_err(dev, "Failed to get syscon: %d\n", ret);
return ret;
}
if (args.args_count != 2) {
dev_err(dev, "Invalid number of syscon args\n");
return -EINVAL;
}
regmap = syscon_node_to_regmap(args.node);
if (IS_ERR(regmap)) {
ret = PTR_ERR(regmap);
dev_err(dev, "Failed to get regmap: %d\n", ret);
return ret;
}
range = regmap_get_range(regmap, 0);
if (!range) {
dev_err(dev, "Failed to get regmap range\n");
return -ENOMEM;
}
pdata->phy_intf = range + args.args[0];
pdata->reg_shift = args.args[1];
return designware_eth_ofdata_to_platdata(dev);
}
static int dwmac_socfpga_probe(struct udevice *dev)
{
struct dwmac_socfpga_platdata *pdata = dev_get_platdata(dev);
struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata;
struct reset_ctl_bulk reset_bulk;
int ret;
u32 modereg;
u32 modemask;
switch (edata->phy_interface) {
case PHY_INTERFACE_MODE_MII:
case PHY_INTERFACE_MODE_GMII:
modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
break;
case PHY_INTERFACE_MODE_RMII:
modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII;
break;
case PHY_INTERFACE_MODE_RGMII:
modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII;
break;
default:
dev_err(dev, "Unsupported PHY mode\n");
return -EINVAL;
}
ret = reset_get_bulk(dev, &reset_bulk);
if (ret) {
dev_err(dev, "Failed to get reset: %d\n", ret);
return ret;
}
reset_assert_bulk(&reset_bulk);
modemask = SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << pdata->reg_shift;
clrsetbits_le32(pdata->phy_intf, modemask,
modereg << pdata->reg_shift);
reset_release_bulk(&reset_bulk);
return designware_eth_probe(dev);
}
static const struct udevice_id dwmac_socfpga_ids[] = {
{ .compatible = "altr,socfpga-stmmac" },
{ }
};
U_BOOT_DRIVER(dwmac_socfpga) = {
.name = "dwmac_socfpga",
.id = UCLASS_ETH,
.of_match = dwmac_socfpga_ids,
.ofdata_to_platdata = dwmac_socfpga_ofdata_to_platdata,
.probe = dwmac_socfpga_probe,
.ops = &designware_eth_ops,
.priv_auto_alloc_size = sizeof(struct dw_eth_dev),
.platdata_auto_alloc_size = sizeof(struct dwmac_socfpga_platdata),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
|
/****************************************************************************
* Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved.
* Copyright (C) 2011-2013 Sourcefire, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
* published by the Free Software Foundation. You may not use, modify or
* distribute this program under any other version of the GNU General
* Public License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
****************************************************************************
* Provides convenience functions.
*
* 6/11/2011 - Initial implementation ... Hui Cao <hcao@sourcefire.com>
*
****************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "reputation_utils.h"
#include <stdio.h>
#include <limits.h>
#define MAX_ADDR_LINE_LENGTH 8192
/********************************************************************
* Function: Reputation_IsEmptyStr()
*
* Checks if string is NULL, empty or just spaces.
* String must be 0 terminated.
*
* Arguments:
* char * - string to check
*
* Returns:
* 1 if string is NULL, empty or just spaces
* 0 otherwise
*
********************************************************************/
int Reputation_IsEmptyStr(char *str)
{
char *end;
if (str == NULL)
return 1;
end = str + strlen(str);
while ((str < end) && isspace((int)*str))
str++;
if (str == end)
return 1;
return 0;
}
/********************************************************************
* Function: numLinesInFile()
*
* Number of lines in the file
*
* Arguments:
* fname: file name
*
* Returns:
* uint32_t number of lines
*
********************************************************************/
int numLinesInFile(char *fname)
{
FILE *fp;
uint32_t numlines = 0;
char buf[MAX_ADDR_LINE_LENGTH];
fp = fopen(fname, "rb");
if (NULL == fp)
return 0;
while((fgets(buf, MAX_ADDR_LINE_LENGTH, fp)) != NULL)
{
if (buf[0] != '#')
{
numlines++;
if (numlines == INT_MAX)
{
fclose(fp);
return INT_MAX;
}
}
}
fclose(fp);
return numlines;
}
|
/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
Based on work contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#include <assert.h>
#include <errno.h>
#include <endian.h>
#include <unistd.h>
#include <sysdep-cancel.h>
#include <sys/syscall.h>
static ssize_t
do_pread (int fd, void *buf, size_t count, off_t offset)
{
assert (sizeof (offset) == 4);
return INLINE_SYSCALL (pread64, __ALIGNMENT_COUNT (5, 6), fd,
buf, count, __ALIGNMENT_ARG
__LONG_LONG_PAIR (offset >> 31, offset));
}
ssize_t
__libc_pread (fd, buf, count, offset)
int fd;
void *buf;
size_t count;
off_t offset;
{
if (SINGLE_THREAD_P)
return do_pread (fd, buf, count, offset);
int oldtype = LIBC_CANCEL_ASYNC ();
ssize_t result = do_pread (fd, buf, count, offset);
LIBC_CANCEL_RESET (oldtype);
return result;
}
strong_alias (__libc_pread, __pread)
weak_alias (__libc_pread, pread)
|
/*
Copyright (C) 1994, 1995, 1996 Free Software Foundation
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, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
#include "io_S.h"
#include <fcntl.h>
/* Implement io_readable as described in <hurd/io.defs>. */
kern_return_t
diskfs_S_io_readable (struct protid *cred,
mach_msg_type_number_t *amount)
{
struct node *np;
if (!cred)
return EOPNOTSUPP;
if (!(cred->po->openstat & O_READ))
return EINVAL;
np = cred->po->np;
pthread_mutex_lock (&np->lock);
iohelp_get_conch (&np->conch);
if (np->dn_stat.st_size > cred->po->filepointer)
*amount = np->dn_stat.st_size - cred->po->filepointer;
else
*amount = 0;
pthread_mutex_unlock (&np->lock);
return 0;
}
|
//# ExternalLockSync.h: Class to hold table lock data
//# Copyright (C) 1997,1998
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
#ifndef TABLES_EXTERNALLOCKSYNC_H
#define TABLES_EXTERNALLOCKSYNC_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/tables/Tables/TableLockData.h>
#include <casacore/tables/Tables/TableSyncData.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
// <summary>
// Class to hold table lock data.
// </summary>
// <use visibility=local>
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tTable" demos="">
// </reviewed>
// <prerequisite>
// <li> class <linkto class=Table>TableLock</linkto>
// </prerequisite>
// <synopsis>
// This class keeps the <src>LockFile</src> object used to do the
// actual locking/unlocking.
// It also keeps the synchronization information.
// </synopsis>
// <motivation>
// Encapsulate Table locking data.
// </motivation>
class ExternalLockSync
{
public:
// Construct from the given TableLock object.
ExternalLockSync (const TableLock& lockOptions);
~ExternalLockSync();
// Create the <src>LockFile</src> object and acquire a read or write
// lock when permanent locking is in effect.
// It throws an exception when acquiring the lock failed.
void makeLock (const String& tableName, Bool create, FileLocker::LockType);
// Acquire a read or write lock (when needed).
// Nattempts==0 indicates that it has to wait until the lock is acquired.
// Nattempts>0 indicates that it gives up acquiring the lock when
// nattempts have been done (with 1 second intervals).
// It throws an exception when acquire failed while it had to wait.
// It returns a false status when acquiring the lock failed
// while it does not have to wait.
// <br>When a lock is successfully acquired, the number of rows
// (see function nrrow() below) is reset as a result of
// synchronizing the access to the table.
Bool acquire (FileLocker::LockType = FileLocker::Write, uInt nattempts = 0);
// Get the current number of rows in this object.
uInt nrow() const;
// Release the lock and synchronize the table access.
// When autolocking is in effect, the lock is only released when
// the inspection-interval (see class
// <linkto class=TableLockData>TableLockData</linkto>) has expired.
// It does nothing when permanent locking is used.
// It throws an exception when the release failed.
void release (uInt nrrow);
// Check if the table has a read or write lock, thus if the table can
// be read or written safely.
Bool hasLock (FileLocker::LockType) const;
private:
// Copy constructor is forbidden.
ExternalLockSync (const ExternalLockSync& that);
// Assignment is forbidden.
ExternalLockSync& operator= (const ExternalLockSync& that);
// The callback function when releasing a lock.
static MemoryIO* releaseCallBack (void* lockSyncObject, Bool always);
// The member function executing the callback functionality.
MemoryIO* doReleaseCallBack (Bool always);
//# Define the lock and sync data objects.
TableLockData itsLock;
TableSyncData itsSync;
uInt itsNrrow;
};
inline Bool ExternalLockSync::hasLock (FileLocker::LockType type) const
{
return itsLock.hasLock (type);
}
inline void ExternalLockSync::release (uInt nrrow)
{
itsNrrow = nrrow;
itsLock.release();
}
inline MemoryIO* ExternalLockSync::doReleaseCallBack (Bool)
{
itsSync.write (itsNrrow);
return &(itsSync.memoryIO());
}
inline uInt ExternalLockSync::nrow() const
{
return itsNrrow;
}
} //# NAMESPACE CASACORE - END
#endif
|
/****************************************************************************
* Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved.
* Copyright (C) 2008-2013 Sourcefire, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
* published by the Free Software Foundation. You may not use, modify or
* distribute this program under any other version of the GNU General
* Public License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
****************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include "util.h"
#include "sfActionQueue.h"
#include "mempool.h"
tSfActionQueueId sfActionQueueInit(
int queueLength
)
{
tSfActionQueue *queue = SnortAlloc(sizeof(tSfActionQueue));
if (queue)
{
if (mempool_init(&queue->mempool,
queueLength, sizeof(tSfActionNode)) != 0)
{
FatalError("%s(%d) Could not initialize action queue memory pool.\n",
__FILE__, __LINE__);
}
}
return queue;
}
int sfActionQueueAdd(
tSfActionQueueId actionQ,
void (*callback)(void *),
void *data
)
{
MemBucket *bucket = mempool_alloc(&actionQ->mempool);
if (bucket != NULL)
{
tSfActionNode *node = bucket->data;
node->callback = callback;
node->data = data;
//Using used_list in mempool for tracking allocated MemBucket
return 0;
}
return -1;
}
void sfActionQueueExecAll(
tSfActionQueueId actionQ
)
{
//drain
while (mempool_numUsedBucket(&actionQ->mempool))
{
sfActionQueueExec(actionQ);
}
}
void sfActionQueueExec(
tSfActionQueueId actionQ
)
{
MemBucket *firstUsedBucket = mempool_oldestUsedBucket(&actionQ->mempool);
if (firstUsedBucket)
{
tSfActionNode *node = (tSfActionNode *)firstUsedBucket->data;
(node->callback)(node->data);
mempool_free(&actionQ->mempool, firstUsedBucket);
}
}
/**Destroys action queue. All memory allocated by the actionQueue module is
* freed. Since the queued actions are not executed, any memory freed in the action
* will be lost. User should do a execAll if there is a potential memory leak
* or the actions must be completed.
*/
void sfActionQueueDestroy(
tSfActionQueueId actionQ
)
{
mempool_destroy(&actionQ->mempool);
free(actionQ);
}
|
/*
* This file is part of Cleanflight.
*
* Cleanflight 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.
*
* Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
//#define SCHEDULER_DEBUG
#define TASK_PERIOD_HZ(hz) (1000000 / (hz))
#define TASK_PERIOD_MS(ms) ((ms) * 1000)
#define TASK_PERIOD_US(us) (us)
typedef enum {
TASK_PRIORITY_IDLE = 0, // Disables dynamic scheduling, task is executed only if no other task is active this cycle
TASK_PRIORITY_LOW = 1,
TASK_PRIORITY_MEDIUM = 3,
TASK_PRIORITY_HIGH = 5,
TASK_PRIORITY_REALTIME = 6,
TASK_PRIORITY_MAX = 255
} cfTaskPriority_e;
#define TASK_SELF -1
typedef struct {
const char * taskName;
bool isEnabled;
uint32_t desiredPeriod;
uint8_t staticPriority;
uint32_t maxExecutionTime;
uint32_t totalExecutionTime;
uint32_t averageExecutionTime;
uint32_t latestDeltaTime;
} cfTaskInfo_t;
typedef struct {
/* Configuration */
const char * taskName;
bool (*checkFunc)(uint32_t currentDeltaTime);
void (*taskFunc)(void);
uint32_t desiredPeriod; // target period of execution
const uint8_t staticPriority; // dynamicPriority grows in steps of this size, shouldn't be zero
/* Scheduling */
uint16_t dynamicPriority; // measurement of how old task was last executed, used to avoid task starvation
uint16_t taskAgeCycles;
uint32_t lastExecutedAt; // last time of invocation
uint32_t lastSignaledAt; // time of invocation event for event-driven tasks
/* Statistics */
uint32_t averageExecutionTime; // Moving average over 6 samples, used to calculate guard interval
uint32_t taskLatestDeltaTime; //
#ifndef SKIP_TASK_STATISTICS
uint32_t maxExecutionTime;
uint32_t totalExecutionTime; // total time consumed by task since boot
#endif
} cfTask_t;
extern uint16_t averageSystemLoadPercent;
extern cfTask_t* taskQueueArray[];
extern const uint32_t taskQueueArraySize;
extern const uint32_t taskCount;
extern cfTask_t cfTasks[];
void getTaskInfo(const int taskId, cfTaskInfo_t *taskInfo);
void rescheduleTask(const int taskId, uint32_t newPeriodMicros);
void setTaskEnabled(const int taskId, bool newEnabledState);
uint32_t getTaskDeltaTime(const int taskId);
void schedulerInit(void);
void scheduler(void);
#define isSystemOverloaded() (averageSystemLoadPercent > 100)
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Mar 24 2016 13:14:34).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
// #import <UIKit/_UISettings.h>
#import <ControlCenterUI/CCUIControlCenterSettingsSectionSettings.h>
#import <ControlCenterUI/CCUIControlCenterShortcutSectionSettings.h>
@interface CCUIControlCenterSettings : NSObject
{
BOOL _useNewBounce;
CGFloat _backgroundDarkening;
CCUIControlCenterSettingsSectionSettings *_settingsSectionSettings;
CCUIControlCenterShortcutSectionSettings *_shortcutSectionSettings;
CGFloat _oldBounceFriction;
CGFloat _bounceDensityFactor;
CGFloat _bounceResistance;
CGFloat _minVelocity;
CGFloat _maxVelocity;
CGFloat _attachmentThreshold;
CGFloat _attachmentFrequencyAbove;
CGFloat _attachmentFrequencyBelow;
CGFloat _attachmentVelocityDamping;
CGFloat _attachmentMinDamping;
CGFloat _attachmentMaxDamping;
}
+ (id)settingsControllerModule;
@property CGFloat attachmentMaxDamping; // @synthesize attachmentMaxDamping=_attachmentMaxDamping;
@property CGFloat attachmentMinDamping; // @synthesize attachmentMinDamping=_attachmentMinDamping;
@property CGFloat attachmentVelocityDamping; // @synthesize attachmentVelocityDamping=_attachmentVelocityDamping;
@property CGFloat attachmentFrequencyBelow; // @synthesize attachmentFrequencyBelow=_attachmentFrequencyBelow;
@property CGFloat attachmentFrequencyAbove; // @synthesize attachmentFrequencyAbove=_attachmentFrequencyAbove;
@property CGFloat attachmentThreshold; // @synthesize attachmentThreshold=_attachmentThreshold;
@property CGFloat maxVelocity; // @synthesize maxVelocity=_maxVelocity;
@property CGFloat minVelocity; // @synthesize minVelocity=_minVelocity;
@property CGFloat bounceResistance; // @synthesize bounceResistance=_bounceResistance;
@property CGFloat bounceDensityFactor; // @synthesize bounceDensityFactor=_bounceDensityFactor;
@property CGFloat oldBounceFriction; // @synthesize oldBounceFriction=_oldBounceFriction;
@property BOOL useNewBounce; // @synthesize useNewBounce=_useNewBounce;
@property(retain) CCUIControlCenterShortcutSectionSettings *shortcutSectionSettings; // @synthesize shortcutSectionSettings=_shortcutSectionSettings;
@property(retain) CCUIControlCenterSettingsSectionSettings *settingsSectionSettings; // @synthesize settingsSectionSettings=_settingsSectionSettings;
@property CGFloat backgroundDarkening; // @synthesize backgroundDarkening=_backgroundDarkening;
// - (void).cxx_destruct;
- (void)setDefaultValues;
@end
|
/**
* @file bandscope_update.c
* @brief Bandscope Update files.
* @author John Melton, G0ORX/N6LYT, Doxygen Comments Dave Larsen, KV0S
* @version 0.1
* @date 2009-04-11
*/
/* Copyright (C)
* 2009 - John Melton, G0ORX/N6LYT, Doxygen Comments Dave Larsen, KV0S
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <gtk/gtk.h>
#include "main.h"
#include "dttsp.h"
#include "bandscope.h"
#include "bandscope_update.h"
int updatingBandscope;
int bandscopeUpdatesPerSecond=BANDSCOPE_UPDATES_PER_SECOND;
gint bandscopeUpdate(gpointer data);
void bandscopeUpdateSamples();
unsigned char bandscopeBuffer[BANDSCOPE_BUFFER_SIZE*2];
float bandscopeSamples[BANDSCOPE_BUFFER_SIZE];
gint bandscopeTimerId;
/* --------------------------------------------------------------------------*/
/**
* @brief New bandscope update.
*/
void newBandscopeUpdate() {
bandscopeTimerId=gtk_timeout_add(1000/bandscopeUpdatesPerSecond,bandscopeUpdate,NULL);
}
/* --------------------------------------------------------------------------*/
/**
* @brief Stop the bandscope update.
*/
void stopBandscopeUpdate() {
gtk_timeout_remove(bandscopeTimerId);
}
/* --------------------------------------------------------------------------*/
/**
* @brief Bandscope update
*
* @param data
*
* @return
*/
gint bandscopeUpdate(gpointer data) {
getSpectrumSamples((char*)bandscopeBuffer);
bandscopeUpdateSamples();
return TRUE;
}
/* --------------------------------------------------------------------------*/
/**
* @brief Bandscope Sample update.
*/
void bandscopeUpdateSamples() {
int i;
short s;
for(i=0;i<BANDSCOPE_BUFFER_SIZE;i++) {
s=(bandscopeBuffer[i*2]<<8)+bandscopeBuffer[(i*2)+1];
bandscopeSamples[i]=(float)s/32767.0f; // get into range -1..+1
}
updateBandscope(bandscopeSamples);
}
|
/* (C) Copyright 2007 Stijn van Dongen
*
* This file is part of MCL. You can redistribute and/or modify MCL under the
* terms of the GNU General Public License; either version 3 of the License or
* (at your option) any later version. You should have received a copy of the
* GPL along with MCL, in the file COPYING.
*/
#ifndef clm_close_h__
#define clm_close_h__
#include "util/opt.h"
#include "util/types.h"
mcxDispHook* mcxDispHookClose
( void
) ;
#endif
|
/* -*- c++ -*- */
/*
* Copyright 2009,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef INCLUDED_PFB_DECIMATOR_CCF_IMPL_H
#define INCLUDED_PFB_DECIMATOR_CCF_IMPL_H
#include <gnuradio/filter/pfb_decimator_ccf.h>
#include <gnuradio/filter/polyphase_filterbank.h>
#include <gnuradio/thread/thread.h>
#include <volk/volk_alloc.hh>
namespace gr {
namespace filter {
class FILTER_API pfb_decimator_ccf_impl : public pfb_decimator_ccf,
kernel::polyphase_filterbank
{
private:
bool d_updated;
unsigned int d_rate;
unsigned int d_chan;
bool d_use_fft_rotator;
bool d_use_fft_filters;
std::vector<gr_complex> d_rotator;
volk::vector<gr_complex> d_tmp; // used for fft filters
gr::thread::mutex d_mutex; // mutex to protect set/work access
inline int work_fir_exp(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
inline int work_fir_fft(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
inline int work_fft_exp(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
inline int work_fft_fft(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
public:
pfb_decimator_ccf_impl(unsigned int decim,
const std::vector<float>& taps,
unsigned int channel,
bool use_fft_rotator = true,
bool use_fft_filters = true);
// No copy because d_tmp.
pfb_decimator_ccf_impl(const pfb_decimator_ccf_impl&) = delete;
pfb_decimator_ccf_impl& operator=(const pfb_decimator_ccf_impl&) = delete;
void set_taps(const std::vector<float>& taps) override;
void print_taps() override;
std::vector<std::vector<float>> taps() const override;
void set_channel(const unsigned int channel) override;
// Overload to create/destroy d_tmp based on max_noutput_items.
bool start() override;
bool stop() override;
int work(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items) override;
};
} /* namespace filter */
} /* namespace gr */
#endif /* INCLUDED_PFB_DECIMATOR_CCF_IMPL_H */
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef BUILDPROGRESS_H
#define BUILDPROGRESS_H
#include "taskwindow.h"
#include <QPointer>
#include <QWidget>
#include <QLabel>
namespace ProjectExplorer {
namespace Internal {
class BuildProgress : public QWidget
{
Q_OBJECT
public:
BuildProgress(TaskWindow *taskWindow);
private slots:
void updateState();
private:
QLabel *m_errorIcon;
QLabel *m_warningIcon;
QLabel *m_errorLabel;
QLabel *m_warningLabel;
QPointer<TaskWindow> m_taskWindow;
};
} // namespace Internal
} // namespace ProjectExplorer
#endif // BUILDPROGRESS_H
|
/* Copyright (C) 2006 Imperial College London and others.
Please see the AUTHORS file in the main source directory for a full list
of copyright holders.
Dr Gerard J Gorman
Applied Modelling and Computation Group
Department of Earth Science and Engineering
Imperial College London
g.gorman@imperial.ac.uk
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/
#ifndef H_ELEMENTS
#define H_ELEMENTS
#include "confdefs.h"
#ifdef HAVE_MPI
#include <mpi.h>
#endif
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iostream>
#include "samtypes.h"
// **********************************
// ELEMENTS:*************************
// Element class
#define ELM_DEFAULT 0
#define ELM_HALO 0x2
#define ELM_SURFACE 0x4
#define ELM_VOLUME 0x8
#define ELM_MNO 0x10 // minimum node owner (ie. managed element)
class Element{
public:
Element();
Element(const Element& element); // Copy constructor
~Element();
// Overloaded operators.
friend std::ostream &operator<<(std::ostream& out, const Element& in);
Element &operator=(const Element& in);
bool operator==(const Element& in) const;
bool operator!=(const Element& in) const;
bool operator<(const Element& in) const;
// Member functions.
void append_field(const std::vector<int>&);
void append_field(const std::vector<samfloat_t>&);
void append_field(const int*, const size_t);
void append_field(const samfloat_t*, const size_t);
void set_eid(const eid_t);
eid_t get_eid() const;
void set_flags(const unsigned char flags);
unsigned char get_flags() const;
void set_enlist(const std::vector<unn_t>&);
void set_MFenlist(const std::vector<unn_t>&);
const std::vector<unn_t>& get_enlist() const;
const std::vector<unn_t>& get_MFenlist() const;
unsigned get_size_enlist() const;
unsigned get_size_MFenlist() const;
void set_ifields(const std::vector<int>&);
void set_fields(const std::vector<samfloat_t>&);
const std::vector<int>& get_ifields() const;
const std::vector<samfloat_t>& get_fields() const;
size_t get_size_ifields() const;
size_t get_size_fields() const;
void pack(char *buffer, int& bsize, int& offset) const;
void unpack(char *buffer, int& bsize, int& offset);
unsigned pack_size() const;
private:
eid_t eid; // element id number.
unsigned char flags; // states: {ELM_DEFAULT, ELM_CHECK, ELM_DELETE} */
std::vector<unn_t> nodes; // the element-node list.
std::vector<unn_t> MFnodes; // Stores the varies mixed-formulation elements aligned with this element.
// All integer variables associated with this element. This will
// include region id information for example.
std::vector<int> ifields;
// All real variables associated with this element. NOTE: in the
// case of discontinious methods, information regarding field values
// would be included here.
std::vector<samfloat_t> fields;
};
#endif
|
/*
*
* Copyright 2015 gRPC authors.
*
* 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 GRPC_CORE_TSI_TRANSPORT_SECURITY_H
#define GRPC_CORE_TSI_TRANSPORT_SECURITY_H
#include <stdbool.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/tsi/transport_security_interface.h"
#ifdef __cplusplus
extern "C" {
#endif
extern grpc_tracer_flag tsi_tracing_enabled;
/* Base for tsi_frame_protector implementations.
See transport_security_interface.h for documentation. */
typedef struct {
tsi_result (*protect)(tsi_frame_protector *self,
const unsigned char *unprotected_bytes,
size_t *unprotected_bytes_size,
unsigned char *protected_output_frames,
size_t *protected_output_frames_size);
tsi_result (*protect_flush)(tsi_frame_protector *self,
unsigned char *protected_output_frames,
size_t *protected_output_frames_size,
size_t *still_pending_size);
tsi_result (*unprotect)(tsi_frame_protector *self,
const unsigned char *protected_frames_bytes,
size_t *protected_frames_bytes_size,
unsigned char *unprotected_bytes,
size_t *unprotected_bytes_size);
void (*destroy)(tsi_frame_protector *self);
} tsi_frame_protector_vtable;
struct tsi_frame_protector {
const tsi_frame_protector_vtable *vtable;
};
/* Base for tsi_handshaker implementations.
See transport_security_interface.h for documentation. */
typedef struct {
tsi_result (*get_bytes_to_send_to_peer)(tsi_handshaker *self,
unsigned char *bytes,
size_t *bytes_size);
tsi_result (*process_bytes_from_peer)(tsi_handshaker *self,
const unsigned char *bytes,
size_t *bytes_size);
tsi_result (*get_result)(tsi_handshaker *self);
tsi_result (*extract_peer)(tsi_handshaker *self, tsi_peer *peer);
tsi_result (*create_frame_protector)(tsi_handshaker *self,
size_t *max_protected_frame_size,
tsi_frame_protector **protector);
void (*destroy)(tsi_handshaker *self);
tsi_result (*next)(tsi_handshaker *self, const unsigned char *received_bytes,
size_t received_bytes_size,
const unsigned char **bytes_to_send,
size_t *bytes_to_send_size,
tsi_handshaker_result **handshaker_result,
tsi_handshaker_on_next_done_cb cb, void *user_data);
} tsi_handshaker_vtable;
struct tsi_handshaker {
const tsi_handshaker_vtable *vtable;
bool frame_protector_created;
bool handshaker_result_created;
};
/* Base for tsi_handshaker_result implementations.
See transport_security_interface.h for documentation.
The exec_ctx parameter in create_zero_copy_grpc_protector is supposed to be
of type grpc_exec_ctx*, but we're using void* instead to avoid making the TSI
API depend on grpc. The create_zero_copy_grpc_protector() method is only used
in grpc, where we do need the exec_ctx passed through, but the API still
needs to compile in other applications, where grpc_exec_ctx is not defined.
*/
typedef struct {
tsi_result (*extract_peer)(const tsi_handshaker_result *self, tsi_peer *peer);
tsi_result (*create_zero_copy_grpc_protector)(
void *exec_ctx, const tsi_handshaker_result *self,
size_t *max_output_protected_frame_size,
tsi_zero_copy_grpc_protector **protector);
tsi_result (*create_frame_protector)(const tsi_handshaker_result *self,
size_t *max_output_protected_frame_size,
tsi_frame_protector **protector);
tsi_result (*get_unused_bytes)(const tsi_handshaker_result *self,
const unsigned char **bytes,
size_t *bytes_size);
void (*destroy)(tsi_handshaker_result *self);
} tsi_handshaker_result_vtable;
struct tsi_handshaker_result {
const tsi_handshaker_result_vtable *vtable;
};
/* Peer and property construction/destruction functions. */
tsi_result tsi_construct_peer(size_t property_count, tsi_peer *peer);
tsi_peer_property tsi_init_peer_property(void);
void tsi_peer_property_destruct(tsi_peer_property *property);
tsi_result tsi_construct_string_peer_property(const char *name,
const char *value,
size_t value_length,
tsi_peer_property *property);
tsi_result tsi_construct_allocated_string_peer_property(
const char *name, size_t value_length, tsi_peer_property *property);
tsi_result tsi_construct_string_peer_property_from_cstring(
const char *name, const char *value, tsi_peer_property *property);
/* Utils. */
char *tsi_strdup(const char *src); /* Sadly, no strdup in C89. */
#ifdef __cplusplus
}
#endif
#endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_H */
|
/*
* Copyright (c) 2016 Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
* integrated circuit in a product or a software update for such product, must reproduce
* the above copyright notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific prior
* written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary or object form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H
#include "cmsis.h"
#include "nrf_gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
PIN_INPUT,
PIN_OUTPUT
} PinDirection;
#define PORT_SHIFT 3
///> define macro producing for example Px_y = NRF_GPIO_PIN_MAP(x, y)
#define PinDef(port_num, pin_num) P##port_num##_##pin_num = NRF_GPIO_PIN_MAP(port_num, pin_num)
typedef enum {
PinDef(0 , 0), // P0_0 = 0...
PinDef(0 , 1),
PinDef(0 , 2),
PinDef(0 , 3),
PinDef(0 , 4),
PinDef(0 , 5),
PinDef(0 , 6),
PinDef(0 , 7),
PinDef(0 , 8),
PinDef(0 , 9),
PinDef(0 , 10),
PinDef(0 , 11),
PinDef(0 , 12),
PinDef(0 , 13),
PinDef(0 , 14),
PinDef(0 , 15),
PinDef(0 , 16),
PinDef(0 , 17),
PinDef(0 , 18),
PinDef(0 , 19),
PinDef(0 , 20),
PinDef(0 , 21),
PinDef(0 , 22),
PinDef(0 , 23),
PinDef(0 , 24),
PinDef(0 , 25),
PinDef(0 , 26),
PinDef(0 , 27),
PinDef(0 , 28),
PinDef(0 , 29),
PinDef(0 , 30),
PinDef(0 , 31),
PinDef(1 , 0), //P1_1 = 32...
PinDef(1 , 1),
PinDef(1 , 2),
PinDef(1 , 3),
PinDef(1 , 4),
PinDef(1 , 5),
PinDef(1 , 6),
PinDef(1 , 7),
PinDef(1 , 8),
PinDef(1 , 9),
PinDef(1 , 10),
PinDef(1 , 11),
PinDef(1 , 12),
PinDef(1 , 13),
PinDef(1 , 14),
PinDef(1 , 15),
// Port0
p0 = P0_0,
p1 = P0_1,
p2 = P0_2,
p3 = P0_3,
p4 = P0_4,
p5 = P0_5,
p6 = P0_6,
p7 = P0_7,
p8 = P0_8,
p9 = P0_9,
p10 = P0_10,
p11 = P0_11,
p12 = P0_12,
p13 = P0_13,
p14 = P0_14,
p15 = P0_15,
p16 = P0_16,
p17 = P0_17,
p18 = P0_18,
p19 = P0_19,
p20 = P0_20,
p21 = P0_21,
p22 = P0_22,
p23 = P0_23,
p24 = P0_24,
p25 = P0_25,
p26 = P0_26,
p27 = P0_27,
p28 = P0_28,
p29 = P0_29,
p30 = P0_30,
p31 = P0_31,
// Port1
p32 = P1_0,
p33 = P1_1,
p34 = P1_2,
p35 = P1_3,
p36 = P1_4,
p37 = P1_5,
p38 = P1_6,
p39 = P1_7,
p40 = P1_8,
p41 = P1_9,
p42 = P1_10,
p43 = P1_11,
p44 = P1_12,
p45 = P1_13,
p46 = P1_14,
p47 = P1_15,
LED1 = p13,
LED2 = p14,
LED3 = p15,
LED4 = p16,
BUTTON1 = p11,
BUTTON2 = p12,
BUTTON3 = p24,
BUTTON4 = p25,
RX_PIN_NUMBER = p8,
TX_PIN_NUMBER = p6,
CTS_PIN_NUMBER = p7,
RTS_PIN_NUMBER = p5,
// mBed interface Pins
USBTX = TX_PIN_NUMBER,
USBRX = RX_PIN_NUMBER,
STDIO_UART_TX = TX_PIN_NUMBER,
STDIO_UART_RX = RX_PIN_NUMBER,
STDIO_UART_CTS = CTS_PIN_NUMBER,
STDIO_UART_RTS = RTS_PIN_NUMBER,
SPI_PSELMOSI0 = P1_13,
SPI_PSELMISO0 = P1_14,
SPI_PSELSS0 = P1_12,
SPI_PSELSCK0 = P1_15,
SPI_PSELMOSI1 = P1_2,
SPI_PSELMISO1 = P1_3,
SPI_PSELSS1 = P1_1,
SPI_PSELSCK1 = P1_4,
SPIS_PSELMOSI = P1_2,
SPIS_PSELMISO = P1_3,
SPIS_PSELSS = P1_1,
SPIS_PSELSCK = P1_4,
I2C_SDA0 = p26,
I2C_SCL0 = p27,
D0 = P1_1,
D1 = P1_2,
D2 = P1_3,
D3 = P1_4,
D4 = P1_5,
D5 = P1_6,
D6 = P1_7,
D7 = P1_8,
D8 = P1_10,
D9 = P1_11,
D10 = P1_12,
D11 = P1_13,
D12 = P1_14,
D13 = P1_15,
D14 = p26,
D15 = p27,
A0 = p3,
A1 = p4,
A2 = p28,
A3 = p29,
A4 = p30,
A5 = p31,
/**** QSPI pins ****/
QSPI1_IO0 = P0_20,
QSPI1_IO1 = P0_21,
QSPI1_IO2 = P0_22,
QSPI1_IO3 = P0_23,
QSPI1_SCK = P0_19,
QSPI1_CSN = P0_17,
/**** QSPI FLASH pins ****/
QSPI_FLASH1_IO0 = QSPI1_IO0,
QSPI_FLASH1_IO1 = QSPI1_IO1,
QSPI_FLASH1_IO2 = QSPI1_IO2,
QSPI_FLASH1_IO3 = QSPI1_IO3,
QSPI_FLASH1_SCK = QSPI1_SCK,
QSPI_FLASH1_CSN = QSPI1_CSN,
// Not connected
NC = (int)0xFFFFFFFF
} PinName;
typedef enum {
PullNone = 0,
PullDown = 1,
PullUp = 3,
PullDefault = PullUp
} PinMode;
#ifdef __cplusplus
}
#endif
#endif
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* 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.txt
*
* 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 itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter_h
#define itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter_h
#include "itkEdgeDecimationQuadEdgeMeshFilter.h"
namespace itk
{
/**
* \class SquaredEdgeLengthDecimationQuadEdgeMeshFilter
* \brief
* \ingroup ITKQuadEdgeMeshFiltering
*/
template <typename TInput, typename TOutput, typename TCriterion>
class ITK_TEMPLATE_EXPORT SquaredEdgeLengthDecimationQuadEdgeMeshFilter
: public EdgeDecimationQuadEdgeMeshFilter<TInput, TOutput, TCriterion>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(SquaredEdgeLengthDecimationQuadEdgeMeshFilter);
using Self = SquaredEdgeLengthDecimationQuadEdgeMeshFilter;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
using Superclass = EdgeDecimationQuadEdgeMeshFilter<TInput, TOutput, TCriterion>;
/** Run-time type information (and related methods). */
itkTypeMacro(SquaredEdgeLengthDecimationQuadEdgeMeshFilter, EdgeDecimationQuadEdgeMeshFilter);
/** New macro for creation of through a Smart Pointer */
itkNewMacro(Self);
using InputMeshType = TInput;
using InputMeshPointer = typename InputMeshType::Pointer;
using OutputMeshType = TOutput;
using OutputMeshPointer = typename OutputMeshType::Pointer;
using OutputPointIdentifier = typename OutputMeshType::PointIdentifier;
using OutputPointType = typename OutputMeshType::PointType;
using OutputQEType = typename OutputMeshType::QEType;
using OutputEdgeCellType = typename OutputMeshType::EdgeCellType;
using OutputCellsContainerIterator = typename OutputMeshType::CellsContainerIterator;
using CriterionType = TCriterion;
using MeasureType = typename CriterionType::MeasureType;
using typename Superclass::PriorityType;
using typename Superclass::PriorityQueueItemType;
using typename Superclass::PriorityQueueType;
using typename Superclass::PriorityQueuePointer;
using typename Superclass::QueueMapType;
using typename Superclass::QueueMapIterator;
using typename Superclass::OperatorType;
using typename Superclass::OperatorPointer;
protected:
SquaredEdgeLengthDecimationQuadEdgeMeshFilter();
~SquaredEdgeLengthDecimationQuadEdgeMeshFilter() override = default;
// keep the start of this documentation text on very first comment line,
// it prevents a Doxygen bug
/** Compute the measure value for iEdge.
*
* \param[in] iEdge
* \return measure value, here the squared edge length
*/
MeasureType
MeasureEdge(OutputQEType * iEdge) override
{
OutputPointIdentifier id_org = iEdge->GetOrigin();
OutputPointIdentifier id_dest = iEdge->GetDestination();
OutputPointType org = this->m_OutputMesh->GetPoint(id_org);
OutputPointType dest = this->m_OutputMesh->GetPoint(id_dest);
return static_cast<MeasureType>(org.SquaredEuclideanDistanceTo(dest));
}
// keep the start of this documentation text on very first comment line,
// it prevents a Doxygen bug
/** Calculate the position of the remaining vertex from collapsing iEdge.
*
* \param[in] iEdge
* \return the optimal point location
*/
OutputPointType
Relocate(OutputQEType * iEdge) override;
};
} // namespace itk
#include "itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter.hxx"
#endif
|
//
// NSUserDefaults+TFEasyCoder.h
// TFEasyCoder
//
// Created by ztf on 16/10/26.
// Copyright © 2016年 ztf. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "TFEasyCoderConst.h"
typedef void(^NSUserDefaultsEasyCoderBlock) (NSUserDefaults * ins);
@interface NSUserDefaults (TFEasyCoder)
+( NSUserDefaults *)easyCoder:(NSUserDefaultsEasyCoderBlock)block;
-(NSUserDefaults *)easyCoder:(NSUserDefaultsEasyCoderBlock)block;
//superclass pros NSObject
-(NSUserDefaults *(^)(NSArray * accessibilityElements))set_accessibilityElements;
-(NSUserDefaults *(^)(NSArray * accessibilityCustomActions))set_accessibilityCustomActions;
-(NSUserDefaults *(^)(BOOL isAccessibilityElement))set_isAccessibilityElement;
-(NSUserDefaults *(^)(NSString * accessibilityLabel))set_accessibilityLabel;
-(NSUserDefaults *(^)(NSString * accessibilityHint))set_accessibilityHint;
-(NSUserDefaults *(^)(NSString * accessibilityValue))set_accessibilityValue;
-(NSUserDefaults *(^)(unsigned long long accessibilityTraits))set_accessibilityTraits;
-(NSUserDefaults *(^)(UIBezierPath * accessibilityPath))set_accessibilityPath;
-(NSUserDefaults *(^)(CGPoint accessibilityActivationPoint))set_accessibilityActivationPoint;
-(NSUserDefaults *(^)(NSString * accessibilityLanguage))set_accessibilityLanguage;
-(NSUserDefaults *(^)(BOOL accessibilityElementsHidden))set_accessibilityElementsHidden;
-(NSUserDefaults *(^)(BOOL accessibilityViewIsModal))set_accessibilityViewIsModal;
-(NSUserDefaults *(^)(BOOL shouldGroupAccessibilityChildren))set_shouldGroupAccessibilityChildren;
-(NSUserDefaults *(^)(long long accessibilityNavigationStyle))set_accessibilityNavigationStyle;
-(NSUserDefaults *(^)(id value,NSString *key))set_ValueKey;
@end |
/*
*
* Copyright 2015 gRPC authors.
*
* 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 GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
#define GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
/*
Low level TCP "bottom half" implementation, for use by transports built on
top of a TCP connection.
Note that this file does not (yet) include APIs for creating the socket in
the first place.
All calls passing slice transfer ownership of a slice refcount unless
otherwise specified.
*/
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/socket_windows.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Create a tcp endpoint given a winsock handle.
* Takes ownership of the handle.
*/
grpc_endpoint* grpc_tcp_create(grpc_exec_ctx* exec_ctx, grpc_winsocket* socket,
grpc_channel_args* channel_args,
const char* peer_string);
grpc_error* grpc_tcp_prepare_socket(SOCKET sock);
#ifdef __cplusplus
}
#endif
#endif
#endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */
|
/*
* 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 __SYSINIT_H__
#define __SYSINIT_H__
#include <assert.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SYSINIT_ASSERT_ACTIVE()
#define SYSINIT_PANIC_ASSERT(rc) assert(rc);
#ifdef __cplusplus
}
#endif
#endif /* __SYSINIT_H__ */
|
/**
* Copyright 2014-2015 MongoDB, Inc.
*
* 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 __MONGODB_DRIVER_WRITERESULT_H__
#define __MONGODB_DRIVER_WRITERESULT_H__
namespace HPHP {
extern const StaticString s_MongoDriverWriteResult_className;
class MongoDBDriverWriteResultData
{
public:
static Class* s_class;
static const StaticString s_className;
/* properties go here */
mongoc_client_t *m_client;
uint32_t m_server_id;
mongoc_write_concern_t *m_write_concern;
static Class* getClass();
void sweep() {
/* do nothing */
}
~MongoDBDriverWriteResultData() {
sweep();
};
};
Object HHVM_METHOD(MongoDBDriverWriteResult, getServer);
bool HHVM_METHOD(MongoDBDriverWriteResult, isAcknowledged);
Object hippo_write_result_init(bson_t *reply, bson_error_t *error, mongoc_client_t *client, int server_id, int success, const mongoc_write_concern_t *write_concern);
}
#endif
|
#ifndef JEMALLOC_INTERNAL_BIN_INFO_H
#define JEMALLOC_INTERNAL_BIN_INFO_H
#include "jemalloc/internal/bitmap.h"
/*
* Read-only information associated with each element of arena_t's bins array
* is stored separately, partly to reduce memory usage (only one copy, rather
* than one per arena), but mainly to avoid false cacheline sharing.
*
* Each slab has the following layout:
*
* /--------------------\
* | region 0 |
* |--------------------|
* | region 1 |
* |--------------------|
* | ... |
* | ... |
* | ... |
* |--------------------|
* | region nregs-1 |
* \--------------------/
*/
typedef struct bin_info_s bin_info_t;
struct bin_info_s {
/* Size of regions in a slab for this bin's size class. */
size_t reg_size;
/* Total size of a slab for this bin's size class. */
size_t slab_size;
/* Total number of regions in a slab for this bin's size class. */
uint32_t nregs;
/* Number of sharded bins in each arena for this size class. */
uint32_t n_shards;
/*
* Metadata used to manipulate bitmaps for slabs associated with this
* bin.
*/
bitmap_info_t bitmap_info;
};
extern bin_info_t bin_infos[SC_NBINS];
void bin_info_boot(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]);
#endif /* JEMALLOC_INTERNAL_BIN_INFO_H */
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_PERF_H_
#define CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_PERF_H_
#include <string>
namespace base {
class DictionaryValue;
}
namespace test {
// These functions takes parsed data (on one peer connection) from the
// peerConnectionDataStore object that is backing webrtc-internals and prints
// metrics they consider interesting using testing/perf/perf_test.h primitives.
// The idea is to put as many webrtc-related metrics as possible into the
// dashboard and thereby track it for regressions.
//
// These functions expect to run under googletest and will use EXPECT_ and
// ASSERT_ macros to signal failure. They take as argument one peer connection's
// stats data and a |modifier| to append to each result bucket. For instance, if
// the modifier is '_oneway', the rtt stat will be logged as goog_rtt in
// the video_tx_oneway bucket.
// If |video_codec| is a non-empty string, the codec name is appended last for
// video metrics, e.g. 'video_tx_oneway_VP9'.
void PrintBweForVideoMetrics(const base::DictionaryValue& pc_dict,
const std::string& modifier,
const std::string& video_codec);
void PrintMetricsForAllStreams(const base::DictionaryValue& pc_dict,
const std::string& modifier,
const std::string& video_codec);
void PrintMetricsForSendStreams(const base::DictionaryValue& pc_dict,
const std::string& modifier,
const std::string& video_codec);
void PrintMetricsForRecvStreams(const base::DictionaryValue& pc_dict,
const std::string& modifier,
const std::string& video_codec);
} // namespace test
#endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_PERF_H_
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_MIPS_INSTRUCTION_CODES_MIPS_H_
#define V8_COMPILER_MIPS_INSTRUCTION_CODES_MIPS_H_
namespace v8 {
namespace internal {
namespace compiler {
// MIPS-specific opcodes that specify which assembly sequence to emit.
// Most opcodes specify a single instruction.
#define TARGET_ARCH_OPCODE_LIST(V) \
V(MipsAdd) \
V(MipsAddOvf) \
V(MipsSub) \
V(MipsSubOvf) \
V(MipsMul) \
V(MipsMulHigh) \
V(MipsMulHighU) \
V(MipsDiv) \
V(MipsDivU) \
V(MipsMod) \
V(MipsModU) \
V(MipsAnd) \
V(MipsOr) \
V(MipsXor) \
V(MipsShl) \
V(MipsShr) \
V(MipsSar) \
V(MipsRor) \
V(MipsMov) \
V(MipsTst) \
V(MipsCmp) \
V(MipsCmpD) \
V(MipsAddD) \
V(MipsSubD) \
V(MipsMulD) \
V(MipsDivD) \
V(MipsModD) \
V(MipsSqrtD) \
V(MipsFloat64Floor) \
V(MipsFloat64Ceil) \
V(MipsFloat64RoundTruncate) \
V(MipsCvtSD) \
V(MipsCvtDS) \
V(MipsTruncWD) \
V(MipsTruncUwD) \
V(MipsCvtDW) \
V(MipsCvtDUw) \
V(MipsLb) \
V(MipsLbu) \
V(MipsSb) \
V(MipsLh) \
V(MipsLhu) \
V(MipsSh) \
V(MipsLw) \
V(MipsSw) \
V(MipsLwc1) \
V(MipsSwc1) \
V(MipsLdc1) \
V(MipsSdc1) \
V(MipsPush) \
V(MipsStoreToStackSlot) \
V(MipsStackClaim) \
V(MipsStoreWriteBarrier)
// Addressing modes represent the "shape" of inputs to an instruction.
// Many instructions support multiple addressing modes. Addressing modes
// are encoded into the InstructionCode of the instruction and tell the
// code generator after register allocation which assembler method to call.
//
// We use the following local notation for addressing modes:
//
// R = register
// O = register or stack slot
// D = double register
// I = immediate (handle, external, int32)
// MRI = [register + immediate]
// MRR = [register + register]
// TODO(plind): Add the new r6 address modes.
#define TARGET_ADDRESSING_MODE_LIST(V) \
V(MRI) /* [%r0 + K] */ \
V(MRR) /* [%r0 + %r1] */
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_MIPS_INSTRUCTION_CODES_MIPS_H_
|
/*
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KeyframeList_h
#define KeyframeList_h
#include "core/CSSPropertyNames.h"
#include "core/style/StyleInheritedData.h"
#include "wtf/HashSet.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
#include "wtf/text/AtomicString.h"
namespace blink {
class LayoutObject;
class ComputedStyle;
class KeyframeValue {
public:
KeyframeValue(double key, PassRefPtr<ComputedStyle> style)
: m_key(key)
, m_style(style)
{
}
void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
const HashSet<CSSPropertyID>& properties() const { return m_properties; }
double key() const { return m_key; }
void setKey(double key) { m_key = key; }
const ComputedStyle* style() const { return m_style.get(); }
void setStyle(PassRefPtr<ComputedStyle> style) { m_style = style; }
private:
double m_key;
HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe.
RefPtr<ComputedStyle> m_style;
};
class KeyframeList {
public:
KeyframeList(LayoutObject&, const AtomicString& animationName)
: m_animationName(animationName)
{
insert(KeyframeValue(0, nullptr));
insert(KeyframeValue(1, nullptr));
}
~KeyframeList();
const AtomicString& animationName() const { return m_animationName; }
void insert(const KeyframeValue&);
void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
HashSet<CSSPropertyID>::const_iterator beginProperties() const { return m_properties.begin(); }
HashSet<CSSPropertyID>::const_iterator endProperties() const { return m_properties.end(); }
void clear();
bool isEmpty() const { return m_keyframes.isEmpty(); }
size_t size() const { return m_keyframes.size(); }
const KeyframeValue& operator[](size_t index) const { return m_keyframes[index]; }
private:
AtomicString m_animationName;
Vector<KeyframeValue> m_keyframes; // Kept sorted by key.
HashSet<CSSPropertyID> m_properties; // The properties being animated.
};
} // namespace blink
#endif // KeyframeList_h
|
/*
* 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.
*/
#import <Foundation/Foundation.h>
@protocol WXDiffable <NSObject>
- (BOOL)isEqualToWXObject:(id<WXDiffable>)object;
@end
@interface WXDiffUpdateIndex : NSObject
@property (nonatomic, assign, readonly) NSUInteger oldIndex;
@property (nonatomic, assign, readonly) NSUInteger newIndex;
@end
@interface WXDiffResult : NSObject
@property (nonatomic, strong, readonly) NSIndexSet *inserts;
@property (nonatomic, strong, readonly) NSIndexSet *deletes;
@property (nonatomic, strong, readonly) NSArray<WXDiffUpdateIndex *> *updates;
- (BOOL)hasChanges;
@end
@interface WXDiffUtil : NSObject
+ (WXDiffResult *)diffWithMinimumDistance:(NSArray<id<WXDiffable>> *)newArray oldArray:(NSArray<id<WXDiffable>> *)oldArray;
@end
|
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_DISK
/* Output raw audio data to a file. */
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#include "SDL_rwops.h"
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
#include "SDL_diskaudio.h"
#include "SDL_log.h"
/* !!! FIXME: these should be SDL hints, not environment variables. */
/* environment variables and defaults. */
#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE"
#define DISKDEFAULT_OUTFILE "sdlaudio.raw"
#define DISKENVR_INFILE "SDL_DISKAUDIOFILEIN"
#define DISKDEFAULT_INFILE "sdlaudio-in.raw"
#define DISKENVR_IODELAY "SDL_DISKAUDIODELAY"
/* This function waits until it is possible to write a full sound buffer */
static void
DISKAUDIO_WaitDevice(_THIS)
{
SDL_Delay(this->hidden->io_delay);
}
static void
DISKAUDIO_PlayDevice(_THIS)
{
const size_t written = SDL_RWwrite(this->hidden->io,
this->hidden->mixbuf,
1, this->spec.size);
/* If we couldn't write, assume fatal error for now */
if (written != this->spec.size) {
SDL_OpenedAudioDeviceDisconnected(this);
}
#ifdef DEBUG_AUDIO
fprintf(stderr, "Wrote %d bytes of audio data\n", written);
#endif
}
static Uint8 *
DISKAUDIO_GetDeviceBuf(_THIS)
{
return (this->hidden->mixbuf);
}
static int
DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
{
struct SDL_PrivateAudioData *h = this->hidden;
const int origbuflen = buflen;
SDL_Delay(h->io_delay);
if (h->io) {
const size_t br = SDL_RWread(h->io, buffer, 1, buflen);
buflen -= (int) br;
buffer = ((Uint8 *) buffer) + br;
if (buflen > 0) { /* EOF (or error, but whatever). */
SDL_RWclose(h->io);
h->io = NULL;
}
}
/* if we ran out of file, just write silence. */
SDL_memset(buffer, this->spec.silence, buflen);
return origbuflen;
}
static void
DISKAUDIO_FlushCapture(_THIS)
{
/* no op...we don't advance the file pointer or anything. */
}
static void
DISKAUDIO_CloseDevice(_THIS)
{
if (this->hidden->io != NULL) {
SDL_RWclose(this->hidden->io);
}
SDL_free(this->hidden->mixbuf);
SDL_free(this->hidden);
}
static const char *
get_filename(const int iscapture, const char *devname)
{
if (devname == NULL) {
devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE);
if (devname == NULL) {
devname = iscapture ? DISKDEFAULT_INFILE : DISKDEFAULT_OUTFILE;
}
}
return devname;
}
static int
DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
{
/* handle != NULL means "user specified the placeholder name on the fake detected device list" */
const char *fname = get_filename(iscapture, handle ? NULL : devname);
const char *envr = SDL_getenv(DISKENVR_IODELAY);
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
SDL_zerop(this->hidden);
if (envr != NULL) {
this->hidden->io_delay = SDL_atoi(envr);
} else {
this->hidden->io_delay = ((this->spec.samples * 1000) / this->spec.freq);
}
/* Open the audio device */
this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb");
if (this->hidden->io == NULL) {
return -1;
}
/* Allocate mixing buffer */
if (!iscapture) {
this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size);
if (this->hidden->mixbuf == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
}
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO,
"You are using the SDL disk i/o audio driver!\n");
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO,
" %s file [%s].\n", iscapture ? "Reading from" : "Writing to",
fname);
/* We're ready to rock and roll. :-) */
return 0;
}
static void
DISKAUDIO_DetectDevices(void)
{
SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) 0x1);
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, (void *) 0x2);
}
static int
DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
impl->OpenDevice = DISKAUDIO_OpenDevice;
impl->WaitDevice = DISKAUDIO_WaitDevice;
impl->PlayDevice = DISKAUDIO_PlayDevice;
impl->GetDeviceBuf = DISKAUDIO_GetDeviceBuf;
impl->CaptureFromDevice = DISKAUDIO_CaptureFromDevice;
impl->FlushCapture = DISKAUDIO_FlushCapture;
impl->CloseDevice = DISKAUDIO_CloseDevice;
impl->DetectDevices = DISKAUDIO_DetectDevices;
impl->AllowsArbitraryDeviceNames = 1;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
}
AudioBootStrap DISKAUDIO_bootstrap = {
"disk", "direct-to-disk audio", DISKAUDIO_Init, 1
};
#endif /* SDL_AUDIO_DRIVER_DISK */
/* vi: set ts=4 sw=4 expandtab: */
|
/**
* Copyright (c) 2018 Anup Patel.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* @file arch_smp.h
* @author Anup Patel (anup@brainfault.org)
* @brief arch specific SMP defines
*/
#ifndef __ARCH_SMP_H__
#define __ARCH_SMP_H__
#include <arm_plat.h>
#define ARCH_SMP_SPIN_ADDR (V2M_SYS_FLAGS)
#endif
|
/*
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef __APE_ACTMON_H
#define __APE_ACTMON_H
#include <linux/spinlock.h>
enum actmon_type {
ACTMON_LOAD_SAMPLER,
ACTMON_FREQ_SAMPLER,
};
enum actmon_state {
ACTMON_UNINITIALIZED = -1,
ACTMON_OFF = 0,
ACTMON_ON = 1,
ACTMON_SUSPENDED = 2,
};
/* Units:
* - frequency in kHz
* - coefficients, and thresholds in %
* - sampling period in ms
* - window in sample periods (value = setting + 1)
*/
struct actmon_dev {
u32 reg;
int irq;
struct device *device;
const char *dev_id;
const char *con_id;
const char *clk_name;
struct clk *clk;
unsigned long max_freq;
unsigned long target_freq;
unsigned long cur_freq;
unsigned long suspend_freq;
unsigned long avg_actv_freq;
unsigned long avg_band_freq;
unsigned int avg_sustain_coef;
u32 avg_count;
unsigned long boost_freq;
unsigned long boost_freq_step;
unsigned int boost_up_coef;
unsigned int boost_down_coef;
unsigned int boost_up_threshold;
unsigned int boost_down_threshold;
u8 up_wmark_window;
u8 down_wmark_window;
u8 avg_window_log2;
u32 count_weight;
enum actmon_type type;
enum actmon_state state;
enum actmon_state saved_state;
spinlock_t lock;
};
struct actmon {
struct clk *clk;
unsigned long freq;
unsigned long sampling_period;
struct notifier_block clk_rc_nb;
void __iomem *base;
};
int ape_actmon_init(struct platform_device *pdev);
int ape_actmon_exit(struct platform_device *pdev);
void actmon_rate_change(unsigned long freq);
#endif
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2012 Samsung Electronics
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Register map for Exynos5 FIMD */
#ifndef CPU_SAMSUNG_EXYNOS5250_FIMD_H
#define CPU_SAMSUNG_EXYNOS5250_FIMD_H
/* FIMD register map */
struct exynos5_fimd {
/* This is an incomplete list. Add registers as and when required */
unsigned int vidcon0;
unsigned char res1[0x1c];
unsigned int wincon0;
unsigned int wincon1;
unsigned int wincon2;
unsigned int wincon3;
unsigned int wincon4;
unsigned int shadowcon;
unsigned char res2[0x8];
unsigned int vidosd0a;
unsigned int vidosd0b;
unsigned int vidosd0c;
unsigned char res3[0x54];
unsigned int vidw00add0b0;
unsigned char res4[0x2c];
unsigned int vidw00add1b0;
unsigned char res5[0x2c];
unsigned int vidw00add2;
unsigned char res6[0x3c];
unsigned int w1keycon0;
unsigned int w1keycon1;
unsigned int w2keycon0;
unsigned int w2keycon1;
unsigned int w3keycon0;
unsigned int w3keycon1;
unsigned int w4keycon0;
unsigned int w4keycon1;
unsigned char res7[0x20];
unsigned int win0map;
unsigned char res8[0xdc];
unsigned int blendcon;
unsigned char res9[0x18];
unsigned int dpclkcon;
};
#define W0_SHADOW_PROTECT (0x1 << 10)
#define COMPKEY_F 0xffffff
#define ENVID_F_ON (0x1 << 0)
#define ENVID_ON (0x1 << 1)
#define CLKVAL_F 0xb
#define CLKVAL_F_OFFSET 6
/*
* Structure containing display panel specific data for FIMD
*/
struct exynos5_fimd_panel {
unsigned int is_dp:1; /* Display Panel interface is eDP */
unsigned int is_mipi:1; /* Display Panel interface is MIPI */
unsigned int fixvclk:2; /* VCLK hold scheme at data underflow */
/*
* Polarity of the VCLK active edge
* 0-falling
* 1-rising
*/
unsigned int ivclk:1;
unsigned int clkval_f; /* Divider to create pixel clock */
unsigned int upper_margin; /* Vertical Backporch */
unsigned int lower_margin; /* Vertical frontporch */
unsigned int vsync; /* Vertical Sync Pulse Width */
unsigned int left_margin; /* Horizontal Backporch */
unsigned int right_margin; /* Horizontal Frontporch */
unsigned int hsync; /* Horizontal Sync Pulse Width */
unsigned int xres; /* X Resolution */
unsigned int yres; /* Y Resolution */
};
/* LCDIF Register Map */
struct exynos5_disp_ctrl {
unsigned int vidout_con;
unsigned int vidcon1;
unsigned char res1[0x8];
unsigned int vidtcon0;
unsigned int vidtcon1;
unsigned int vidtcon2;
unsigned int vidtcon3;
unsigned char res2[0x184];
unsigned int trigcon;
};
#define VCLK_RISING_EDGE (1 << 7)
#define VCLK_RUNNING (1 << 9)
#define CHANNEL0_EN (1 << 0)
#define VSYNC_PULSE_WIDTH_VAL 0x3
#define VSYNC_PULSE_WIDTH_OFFSET 0
#define V_FRONT_PORCH_VAL 0x3
#define V_FRONT_PORCH_OFFSET 8
#define V_BACK_PORCH_VAL 0x3
#define V_BACK_PORCH_OFFSET 16
#define HSYNC_PULSE_WIDTH_VAL 0x3
#define HSYNC_PULSE_WIDTH_OFFSET 0
#define H_FRONT_PORCH_VAL 0x3
#define H_FRONT_PORCH_OFFSET 8
#define H_BACK_PORCH_VAL 0x3
#define H_BACK_PORCH_OFFSET 16
#define HOZVAL_OFFSET 0
#define LINEVAL_OFFSET 11
#define BPPMODE_F_RGB_16BIT_565 0x5
#define BPPMODE_F_OFFSET 2
#define ENWIN_F_ENABLE (1 << 0)
#define HALF_WORD_SWAP_EN (1 << 16)
#define OSD_RIGHTBOTX_F_OFFSET 11
#define OSD_RIGHTBOTY_F_OFFSET 0
#endif
|
/*
* smb_charger.c
*
* Copyright (C) 2011 Samsung Electronics
* SangYoung Son <hello.son@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __SMB_CHARGER_H_
#define __SMB_CHARGER_H_
struct smb_charger_callbacks {
void (*set_charging_state) (struct smb_charger_callbacks *ptr,
int cable_status);
int (*get_status_reg) (struct smb_charger_callbacks *prt);
};
struct smb_charger_data {
void (*register_callbacks)(struct smb_charger_callbacks *ptr);
void (*unregister_callbacks)(void);
void (*set_charge)(int state);
int enable;
int stat;
int ta_nconnected;
int hw_revision;
};
#endif
|
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2015 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/mseventqueue.h"
#include <signal.h>
static int active = 1;
/*handler called when pressing C-c*/
static void stop_handler(int signum){
active--;
if (active<0) {
ms_error("Brutal exit (%d)\n", active);
exit(-1);
}
}
static void usage(const char *prog){
fprintf(stderr, "Usage:\n%s play <mkv file> <dest_ip> <dest_port>\n"
"%s record <mkv file> local_port\n", prog, prog);
exit(-1);
}
typedef enum {
PLAY_MODE,
RECORD_MODE,
INVALID_MODE
}Mode;
/*the payload type number we're using here in the RTP packets sent and received*/
const int payload_type_number = 114;
/*callback function in which we are notified of end of file when playing an mkvfile to rtp*/
static void on_end_of_play(void *user_data, MSFilter *player, unsigned int event_id, void *event_arg){
switch(event_id){
case MS_PLAYER_EOF:
fprintf(stdout, "End of file reached.\n");
/*make the program exit*/
active = 0;
break;
}
}
/*
* This small program starts a video stream to either
* - read an H264 video track from mkv file and stream it out with RTP to specified destination
* - receive H264 RTP packets on a local port and record them into an mkv file
*/
int main(int argc, char *argv[]){
const char *command;
const char *file;
const char *ip;
int port;
VideoStream *stream;
RtpProfile *profile;
PayloadType *pt;
Mode mode = INVALID_MODE;
int local_port = 7778;
MSMediaStreamIO io = MS_MEDIA_STREAM_IO_INITIALIZER;
int err;
/*parse command line arguments*/
if (argc<4) usage(argv[0]);
command = argv[1];
if (strcasecmp(command,"play")==0) mode = PLAY_MODE;
else if (strcasecmp(command, "record")==0) mode = RECORD_MODE;
else usage(argv[0]);
file = argv[2];
if (mode == PLAY_MODE){
ip = argv[3];
if (argc<5) usage(argv[0]);
port = atoi(argv[4]);
}else{
local_port = atoi(argv[3]);
ip = "127.0.0.1"; port = 9990; /*dummy destination address, we won't send anything here anyway*/
}
/*set a signal handler to interrupt the program cleanly*/
signal(SIGINT,stop_handler);
/*initialize mediastreamer2*/
ms_init();
/*create the video stream */
stream = video_stream_new(local_port, local_port+1, FALSE);
/*define its local input and outputs with the MSMediaStreamIO structure*/
if (mode == PLAY_MODE){
io.input.type = MSResourceFile;
io.input.file = file; /*the file we want to stream out via rtp*/
io.output.type = MSResourceFile;
io.output.file = NULL; /*we don't set a record file in PLAY_MODE, we just want the received video stream to be ignored, if something is received*/
}else{
io.input.type = MSResourceFile;
io.input.file = NULL; /*We don't want to send anything via RTP in RECORD_MODE*/
io.output.type = MSResourceFile;
io.output.file = file; /*The file to which we want to record the received video stream*/
}
/*define the RTP profile to use: in this case we just want to use H264 codec*/
profile = rtp_profile_new("My RTP profile");
pt = payload_type_clone(&payload_type_h264);
rtp_profile_set_payload(profile, payload_type_number, pt); /*we assign H264 to payload type number payload_type_number*/
media_stream_set_target_network_bitrate(&stream->ms, 500000); /*set a target IP bitrate in bits/second */
/*By default, the VideoStream will show up a display window where the received video is played, with a local preview as well.
* If you don't need this, assign (void*)-1 as window id, which explicitely disable the display feature.*/
/*video_stream_set_native_window_id(stream, (void*)-1);*/
/*start the video stream, given the RtpProfile and "io" definition */
err = video_stream_start_from_io(stream, profile, ip, port, ip, port+1, payload_type_number, &io);
if (err !=0 ){
fprintf(stderr,"Could not start video stream.");
goto end;
}
/*Register an event handler on the player to be notified of end of file*/
ms_filter_add_notify_callback(stream->source, on_end_of_play, NULL, FALSE);
/*program's main loop*/
while (active){
/*handle video stream background activity. This is non blocking*/
video_stream_iterate(stream);
/*process event callbacks*/
ms_event_queue_pump(ms_factory_get_event_queue(ms_factory_get_fallback()));
ms_usleep(50000); /*pause 50ms to avoid busy loop*/
}
end:
/*stop and destroy the video stream object*/
if (stream) video_stream_stop(stream);
/*free the RTP profile and payload type inside*/
if (profile) rtp_profile_destroy(profile);
return err;
}
|
/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
* 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <string.h>
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(initial dst) + strlen(src); if retval >= siz,
* truncation occurred.
*/
size_t strlcat(dst, src, siz)
char *dst;
const char *src;
size_t siz;
{
register char *d = dst;
register const char *s = src;
register size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (*d != '\0' && n-- != 0)
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}
|
/****************************************************************************
** libmatroska : parse Matroska files, see http://www.matroska.org/
**
** <file/class description>
**
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
**
** This file is part of libmatroska.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**
** See http://www.gnu.org/licenses/lgpl-2.1.html for LGPL licensing information.**
** Contact license@matroska.org if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/*!
\file
\version \$Id: KaxTypes.h,v 1.4 2004/04/14 23:26:17 robux4 Exp $
*/
#ifndef LIBMATROSKA_TYPES_H
#define LIBMATROSKA_TYPES_H
#include "matroska/KaxConfig.h"
#include "ebml/EbmlTypes.h"
#include "matroska/c/libmatroska_t.h"
START_LIBMATROSKA_NAMESPACE
enum LacingType {
LACING_NONE = 0,
LACING_XIPH,
LACING_FIXED,
LACING_EBML,
LACING_AUTO
};
enum BlockBlobType {
BLOCK_BLOB_NO_SIMPLE = 0,
BLOCK_BLOB_SIMPLE_AUTO,
BLOCK_BLOB_ALWAYS_SIMPLE,
};
END_LIBMATROSKA_NAMESPACE
#endif // LIBMATROSKA_TYPES_H
|
#define CONFIG_IOSTAT 1
|
#ifndef _LINUX_IPC_H
#define _LINUX_IPC_H
#include <linux/types.h>
#define IPC_PRIVATE ((__kernel_key_t) 0)
/* Obsolete, used only for backwards compatibility and libc5 compiles */
struct ipc_perm
{
__kernel_key_t key;
__kernel_uid_t uid;
__kernel_gid_t gid;
__kernel_uid_t cuid;
__kernel_gid_t cgid;
__kernel_mode_t mode;
unsigned short seq;
};
/* Include the definition of ipc64_perm */
#include <asm/ipcbuf.h>
/* resource get request flags */
#define IPC_CREAT 00001000 /* create if key is nonexistent */
#define IPC_EXCL 00002000 /* fail if key exists */
#define IPC_NOWAIT 00004000 /* return error on wait */
/* these fields are used by the DIPC package so the kernel as standard
should avoid using them if possible */
#define IPC_DIPC 00010000 /* make it distributed */
#define IPC_OWN 00020000 /* this machine is the DIPC owner */
/*
* Control commands used with semctl, msgctl and shmctl
* see also specific commands in sem.h, msg.h and shm.h
*/
#define IPC_RMID 0 /* remove resource */
#define IPC_SET 1 /* set ipc_perm options */
#define IPC_STAT 2 /* get ipc_perm options */
#define IPC_INFO 3 /* see ipcs */
/*
* Version flags for semctl, msgctl, and shmctl commands
* These are passed as bitflags or-ed with the actual command
*/
#define IPC_OLD 0 /* Old version (no 32-bit UID support on many
architectures) */
#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
message sizes, etc. */
/*
* These are used to wrap system calls.
*
* See architecture code for ugly details..
*/
struct ipc_kludge {
struct msgbuf __user *msgp;
long msgtyp;
};
#define SEMOP 1
#define SEMGET 2
#define SEMCTL 3
#define SEMTIMEDOP 4
#define MSGSND 11
#define MSGRCV 12
#define MSGGET 13
#define MSGCTL 14
#define SHMAT 21
#define SHMDT 22
#define SHMGET 23
#define SHMCTL 24
/* Used by the DIPC package, try and avoid reusing it */
#define DIPC 25
#define IPCCALL(version,op) ((version)<<16 | (op))
#ifdef __KERNEL__
#include <linux/spinlock.h>
#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
/* used by in-kernel data structures */
struct kern_ipc_perm
{
spinlock_t lock;
int deleted;
int id;
key_t key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
umode_t mode;
unsigned long seq;
void *security;
};
#endif /* __KERNEL__ */
#endif /* _LINUX_IPC_H */
|
/*
* radacct.h
*
* RADIUS protocol accounting module for GNU Gatekeeper.
*
* Copyright (c) 2003, Quarcom FHU, Michal Zygmuntowicz
*
* This work is published under the GNU Public License (GPL)
* see file COPYING for details.
* We also explicitely grant the right to link this code
* with the OpenH323 library.
*
* $Log: radacct.h,v $
* Revision 1.13 2006/04/14 13:56:19 willamowius
* call failover code merged
*
* Revision 1.1.1.1 2005/11/21 20:20:00 willamowius
*
*
* Revision 1.4 2005/11/15 19:52:56 jan
* Michal v1 (works, but on in routed, not proxy mode)
*
* Revision 1.12 2004/11/15 23:57:42 zvision
* Ability to choose between the original and the rewritten dialed number
*
* Revision 1.11 2004/11/10 18:30:41 zvision
* Ability to customize timestamp strings
*
* Revision 1.10 2004/07/26 12:19:41 zvision
* New faster Radius implementation, thanks to Pavel Pavlov for ideas!
*
* Revision 1.9.2.1 2004/07/07 23:11:07 zvision
* Faster and more elegant handling of Cisco VSA
*
* Revision 1.9 2004/06/25 13:33:19 zvision
* Better Username, Calling-Station-Id and Called-Station-Id handling.
* New SetupUnreg option in Gatekeeper::Auth section.
*
* Revision 1.8 2004/04/17 11:43:43 zvision
* Auth/acct API changes.
* Header file usage more consistent.
*
* Revision 1.7 2004/03/17 00:00:38 zvision
* Conditional compilation to allow to control RADIUS on Windows just by setting HA_RADIUS macro
*
* Revision 1.6 2003/10/31 00:01:25 zvision
* Improved accounting modules stacking control, optimized radacct/radauth a bit
*
* Revision 1.5 2003/10/08 12:40:48 zvision
* Realtime accounting updates added
*
* Revision 1.4 2003/09/29 16:11:44 zvision
* Added cvs Id keyword to header #define macro
*
* Revision 1.3 2003/09/14 21:10:34 zvision
* Changes due to accounting API redesign.
*
* Revision 1.2 2003/09/12 16:31:16 zvision
* Accounting initially added to the 2.2 branch
*
* Revision 1.1.2.3 2003/07/31 22:58:48 zvision
* Added Framed-IP-Address attribute and improved h323-disconnect-cause handling
*
* Revision 1.1.2.2 2003/07/03 15:30:40 zvision
* Added cvs Log keyword
*
*/
#if HAS_RADIUS
#ifndef __RADACCT_H
#define __RADACCT_H "@(#) $Id: radacct.h,v 1.13 2006/04/14 13:56:19 willamowius Exp $"
#include "RasTbl.h"
#include "gkacct.h"
class RadiusClient;
class RadiusPDU;
/** Accounting logger for RADIUS protocol. It sends
accounting call start/stop/update and NAS on/off events
to a remote RADIUS server.
*/
class RadAcct : public GkAcctLogger
{
public:
enum Constants
{
/// events recognized by this module
RadAcctEvents = AcctStart | AcctStop | AcctUpdate | AcctOn | AcctOff,
CiscoVendorId = 9
};
/** Create GkAcctLogger for RADIUS protocol
*/
RadAcct(
/// name from Gatekeeper::Acct section
const char* moduleName,
/// config section name to be used with an instance of this module,
/// pass NULL to use a default section (named "moduleName")
const char* cfgSecName = NULL
);
/// Destroy the accounting logger
virtual ~RadAcct();
/// overriden from GkAcctLogger
virtual Status Log(
AcctEvent evt,
const callptr& call
);
protected:
/** Called before Accounting-Request PDU is send.
Can be used to introduce additional attributes etc.
@return
True to proceed, false to fail and not send this pdu.
*/
virtual bool OnSendPDU(
RadiusPDU& pdu, /// PDU to be sent
AcctEvent evt, /// accounting event being processed
const callptr& call /// call associated with this request (if any)
);
/** Called after Accounting-Response PDU is received.
Can be used to check for some additional attributes etc.
@return
True to accept the response, false to return failure for this event.
*/
virtual bool OnReceivedPDU(
RadiusPDU& pdu, /// PDU received from RADIUS server
AcctEvent evt, /// accounting event being processed
const callptr& call /// call associated with this response (if any)
);
private:
RadAcct();
/* No copy constructor allowed */
RadAcct(const RadAcct&);
/* No operator= allowed */
RadAcct& operator=(const RadAcct&);
private:
/// if true Cisco VSAs are appended to the RADIUS packets
bool m_appendCiscoAttributes;
/// NAS (GK) identifier
PString m_nasIdentifier;
/// NAS IP address (local interface for RADIUS client)
PIPSocket::Address m_nasIpAddress;
/// Fixed value for User-Name attribute in outgoing requests
PString m_fixedUsername;
/// timestamp formatting string
PString m_timestampFormat;
/// RADIUS protocol client class associated with this authenticator
RadiusClient* m_radiusClient;
/// false to use rewritten number, true to use the original one for Called-Station-Id
bool m_useDialedNumber;
/// radius attributes that do not change - x4 performance boost
RadiusAttr m_attrNasIdentifier;
RadiusAttr m_attrH323GwId;
RadiusAttr m_attrH323CallOrigin;
RadiusAttr m_attrH323CallType;
};
#endif /* __RADACCT_H */
#endif /* HAS_RADIUS */
|
/* $Id: parport.h,v 1.11 2001/05/11 07:54:24 davem Exp $
* parport.h: sparc64 specific parport initialization and dma.
*
* Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
*/
#ifndef _ASM_SPARC64_PARPORT_H
#define _ASM_SPARC64_PARPORT_H 1
#include <asm/ebus.h>
#include <asm/ns87303.h>
#include <asm/of_device.h>
#include <asm/prom.h>
#define PARPORT_PC_MAX_PORTS PARPORT_MAX
/*
* While sparc64 doesn't have an ISA DMA API, we provide something that looks
* close enough to make parport_pc happy
*/
#define HAS_DMA
static DEFINE_SPINLOCK(dma_spin_lock);
#define claim_dma_lock() \
({ unsigned long flags; \
spin_lock_irqsave(&dma_spin_lock, flags); \
flags; \
})
#define release_dma_lock(__flags) \
spin_unlock_irqrestore(&dma_spin_lock, __flags);
static struct sparc_ebus_info {
struct ebus_dma_info info;
unsigned int addr;
unsigned int count;
int lock;
struct parport *port;
} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS);
static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
{
if (dmanr >= PARPORT_PC_MAX_PORTS)
return -EINVAL;
if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0)
return -EBUSY;
return 0;
}
static __inline__ void free_dma(unsigned int dmanr)
{
if (dmanr >= PARPORT_PC_MAX_PORTS) {
printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
return;
}
if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) {
printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
return;
}
}
static __inline__ void enable_dma(unsigned int dmanr)
{
ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info,
sparc_ebus_dmas[dmanr].addr,
sparc_ebus_dmas[dmanr].count))
BUG();
}
static __inline__ void disable_dma(unsigned int dmanr)
{
ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0);
}
static __inline__ void clear_dma_ff(unsigned int dmanr)
{
/* nothing */
}
static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
{
ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE));
}
static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int addr)
{
sparc_ebus_dmas[dmanr].addr = addr;
}
static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
{
sparc_ebus_dmas[dmanr].count = count;
}
static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
{
return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
}
static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match)
{
unsigned long base = op->resource[0].start;
unsigned long config = op->resource[1].start;
unsigned long d_base = op->resource[2].start;
unsigned long d_len;
struct device_node *parent;
struct parport *p;
int slot, err;
parent = op->node->parent;
if (!strcmp(parent->name, "dma")) {
p = parport_pc_probe_port(base, base + 0x400,
op->irqs[0], PARPORT_DMA_NOFIFO,
op->dev.parent->parent);
if (!p)
return -ENOMEM;
dev_set_drvdata(&op->dev, p);
return 0;
}
for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) {
if (!test_and_set_bit(slot, dma_slot_map))
break;
}
err = -ENODEV;
if (slot >= PARPORT_PC_MAX_PORTS)
goto out_err;
spin_lock_init(&sparc_ebus_dmas[slot].info.lock);
d_len = (op->resource[2].end - d_base) + 1UL;
sparc_ebus_dmas[slot].info.regs =
of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA");
if (!sparc_ebus_dmas[slot].info.regs)
goto out_clear_map;
sparc_ebus_dmas[slot].info.flags = 0;
sparc_ebus_dmas[slot].info.callback = NULL;
sparc_ebus_dmas[slot].info.client_cookie = NULL;
sparc_ebus_dmas[slot].info.irq = 0xdeadbeef;
strcpy(sparc_ebus_dmas[slot].info.name, "parport");
if (ebus_dma_register(&sparc_ebus_dmas[slot].info))
goto out_unmap_regs;
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1);
/* Configure IRQ to Push Pull, Level Low */
/* Enable ECP, set bit 2 of the CTR first */
outb(0x04, base + 0x02);
ns87303_modify(config, PCR,
PCR_EPP_ENABLE |
PCR_IRQ_ODRAIN,
PCR_ECP_ENABLE |
PCR_ECP_CLK_ENA |
PCR_IRQ_POLAR);
/* CTR bit 5 controls direction of port */
ns87303_modify(config, PTR,
0, PTR_LPT_REG_DIR);
p = parport_pc_probe_port(base, base + 0x400,
op->irqs[0],
slot,
op->dev.parent);
err = -ENOMEM;
if (!p)
goto out_disable_irq;
dev_set_drvdata(&op->dev, p);
return 0;
out_disable_irq:
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
out_unmap_regs:
of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len);
out_clear_map:
clear_bit(slot, dma_slot_map);
out_err:
return err;
}
static int __devexit ecpp_remove(struct of_device *op)
{
struct parport *p = dev_get_drvdata(&op->dev);
int slot = p->dma;
parport_pc_unregister_port(p);
if (slot != PARPORT_DMA_NOFIFO) {
unsigned long d_base = op->resource[2].start;
unsigned long d_len;
d_len = (op->resource[2].end - d_base) + 1UL;
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
of_iounmap(&op->resource[2],
sparc_ebus_dmas[slot].info.regs,
d_len);
clear_bit(slot, dma_slot_map);
}
return 0;
}
static struct of_device_id ecpp_match[] = {
{
.name = "ecpp",
},
{
.name = "parallel",
.compatible = "ecpp",
},
{
.name = "parallel",
.compatible = "ns87317-ecpp",
},
{},
};
static struct of_platform_driver ecpp_driver = {
.name = "ecpp",
.match_table = ecpp_match,
.probe = ecpp_probe,
.remove = __devexit_p(ecpp_remove),
};
static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
{
of_register_driver(&ecpp_driver, &of_bus_type);
return 0;
}
#endif /* !(_ASM_SPARC64_PARPORT_H */
|
/* vim: set expandtab ts=4 sw=4: */
/*
* You may redistribute this program 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 <https://www.gnu.org/licenses/>.
*/
#ifndef BencMessageReader_H
#define BencMessageReader_H
#include "benc/Dict.h"
#include "exception/Except.h"
#include "memory/Allocator.h"
#include "wire/Message.h"
#include "util/Linker.h"
Linker_require("benc/serialization/standard/BencMessageReader.c");
Dict* BencMessageReader_read(struct Message* msg, struct Allocator* alloc, struct Except* eh);
char* BencMessageReader_readNoExcept(struct Message* msg, struct Allocator* alloc, Dict** outPtr);
#endif
|
/*
* Copyright (C) 2015 Eistec AB
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup drivers_adt7310 ADT7310 SPI temperature sensor
* @ingroup drivers_sensors
* @brief Driver for the Analog Devices ADT7310 temperature sensor.
*
* ## Description
*
* The ADT7310 is a high accuracy digital temperature sensor
* in a narrow SOIC package. It contains a band gap temperature
* reference and a 13-bit ADC to monitor and digitize the
* temperature to a 0.0625°C resolution. The ADC resolution,
* by default, is set to 13 bits (0.0625 °C). This can be changed
* to 16 bits (0.0078 °C) by setting Bit 7 in the configuration
* register (Register Address 0x01).
* The ADT7310 is guaranteed to operate over supply voltages from
* 2.7 V to 5.5 V. Operating at 3.3 V, the average supply current is
* typically 210 μA. The ADT7310 has a shutdown mode that
* powers down the device and offers a shutdown current of
* typically 2 μA. The ADT7310 is rated for operation over the
* −55°C to +150°C temperature range.
*
* ## Usage
*
* See `tests/driver_adt7310` for an example application using this driver.
*
* ## Caveats
*
* This driver is currently missing support for a number of hardware features:
*
* - Interrupt and compare pins are not handled
* - There is no public API for setting the temperature alarm levels
* - Device SPI reset is not implemented (drive MISO high from the master while clocking SCK)
*
* @{
*
* @file
* @brief Interface definition for the ADT7310 sensor driver.
*
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
*/
#ifndef ADT7310_H
#define ADT7310_H
#include <stdint.h>
#include <stdbool.h>
#include "periph/spi.h"
#include "periph/gpio.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Device descriptor for ADT7310 sensors.
*/
typedef struct {
spi_t spi; /**< SPI bus the sensor is connected to */
spi_clk_t clk; /**< SPI bus clock speed */
gpio_t cs; /**< CS pin GPIO handle */
bool initialized; /**< sensor status, true if sensor is initialized */
bool high_res; /**< Sensor resolution, true if configured to 16 bit resolution */
} adt7310_t;
/** @name ADT7310 configuration bits */
/** @{ */
#define ADT7310_CONF_FAULT_QUEUE_MASK (0x03)
#define ADT7310_CONF_FAULT_QUEUE_SHIFT (0)
#define ADT7310_CONF_FAULT_QUEUE(x) (((x) << ADT7310_CONF_FAULT_QUEUE_SHIFT) & ADT7310_CONF_FAULT_QUEUE_MASK)
#define ADT7310_CONF_CT_POL_MASK (0x04)
#define ADT7310_CONF_CT_POL_SHIFT (2)
#define ADT7310_CONF_CT_POL(x) (((x) << ADT7310_CONF_CT_POL_SHIFT) & ADT7310_CONF_CT_POL_MASK)
#define ADT7310_CONF_INT_POL_MASK (0x08)
#define ADT7310_CONF_INT_POL_SHIFT (3)
#define ADT7310_CONF_INT_POL(x) (((x) << ADT7310_CONF_INT_POL_SHIFT) & ADT7310_CONF_INT_POL_MASK)
#define ADT7310_CONF_INTCT_MODE_MASK (0x10)
#define ADT7310_CONF_INTCT_MODE_SHIFT (4)
#define ADT7310_CONF_INTCT_MODE(x) (((x) << ADT7310_CONF_INTCT_MODE_SHIFT) & ADT7310_CONF_INTCT_MODE_MASK)
#define ADT7310_CONF_OPERATION_MODE_MASK (0x60)
#define ADT7310_CONF_OPERATION_MODE_SHIFT (5)
#define ADT7310_CONF_OPERATION_MODE(x) (((x) << ADT7310_CONF_OPERATION_MODE_SHIFT) & ADT7310_CONF_OPERATION_MODE_MASK)
#define ADT7310_CONF_RESOLUTION_MASK (0x80)
#define ADT7310_CONF_RESOLUTION_SHIFT (7)
#define ADT7310_CONF_RESOLUTION(x) (((x) << ADT7310_CONF_RESOLUTION_SHIFT) & ADT7310_CONF_RESOLUTION_MASK)
/** @brief Continuous operation mode */
#define ADT7310_MODE_CONTINUOUS (ADT7310_CONF_OPERATION_MODE(0))
/** @brief One shot */
#define ADT7310_MODE_ONE_SHOT (ADT7310_CONF_OPERATION_MODE(1))
/** @brief 1 sample per second */
#define ADT7310_MODE_1SPS (ADT7310_CONF_OPERATION_MODE(2))
/** @brief Shut down (powersave) */
#define ADT7310_MODE_SHUTDOWN (ADT7310_CONF_OPERATION_MODE(3))
/** @} */
/**
* @brief Set configuration register of an ADT7310 sensor
*
* @param[in] dev pointer to sensor device descriptor
* @param[in] config configuration byte, see macros in adt7310.h
*
* @return 0 on success
* @return -1 on error
*/
int adt7310_set_config(adt7310_t *dev, uint8_t config);
/**
* @brief Initialize the ADT7310 sensor driver.
*
* @note The SPI bus is expected to have been initialized when adt7310_init is called.
*
* @param[in] dev pointer to sensor device descriptor
* @param[in] spi SPI bus the sensor is connected to
* @param[in] clk SPI bus speed
* @param[in] cs GPIO pin the chip select signal is connected to
*
* @return 0 on success
* @return <0 on error
*/
int adt7310_init(adt7310_t *dev, spi_t spi, spi_clk_t clk, gpio_t cs);
/**
* @brief Read raw temperature register value
*
* @note The three least-significant bits of the value register are used for
* flags if the sensor is configured for 13 bit mode.
*
* @param[in] dev pointer to sensor device descriptor
*
* @return raw sensor value on success
* @return INT16_MIN on error
*/
int16_t adt7310_read_raw(adt7310_t *dev);
/**
* @brief Read temperature value from sensor and convert to milli-degrees Celsius.
*
* Divide the returned value by 1000 to get integer degrees.
*
* @param[in] dev pointer to sensor device descriptor
*
* @return temperature in milli-degrees Celsius
* @return INT32_MIN on errors
*/
int32_t adt7310_read(adt7310_t *dev);
/**
* @brief Read temperature value from sensor and convert to degrees Celsius.
*
* @param[in] dev pointer to sensor device descriptor
*
* @return floating point representation of temperature in degrees Celsius
* @return NaN on errors
*/
float adt7310_read_float(adt7310_t *dev);
#ifdef __cplusplus
}
#endif
#endif /* ADT7310_H */
/** @} */
|
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
#ifndef INSMOMENTUMNOBCBCTRACTIONFORM_H
#define INSMOMENTUMNOBCBCTRACTIONFORM_H
#include "INSMomentumNoBCBCBase.h"
// Forward Declarations
class INSMomentumNoBCBCTractionForm;
template<>
InputParameters validParams<INSMomentumNoBCBCTractionForm>();
/**
* This class implements the "No BC" boundary condition based on the
* "traction" form of the viscous stress tensor.
*/
class INSMomentumNoBCBCTractionForm : public INSMomentumNoBCBCBase
{
public:
INSMomentumNoBCBCTractionForm(const InputParameters & parameters);
virtual ~INSMomentumNoBCBCTractionForm(){}
protected:
virtual Real computeQpResidual();
virtual Real computeQpJacobian();
virtual Real computeQpOffDiagJacobian(unsigned jvar);
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.