text
stringlengths
4
6.14k
/**************************************************************************** ** $Id: qt/examples/dclock/dclock.h 2.3.10 edited 2005-01-24 $ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #ifndef DCLOCK_H #define DCLOCK_H #include <qlcdnumber.h> class DigitalClock : public QLCDNumber // digital clock widget { Q_OBJECT public: DigitalClock( QWidget *parent=0, const char *name=0 ); protected: // event handlers void timerEvent( QTimerEvent * ); void mousePressEvent( QMouseEvent * ); private slots: // internal slots void stopDate(); void showTime(); private: // internal data void showDate(); bool showingColon; int normalTimer; int showDateTimer; }; #endif // DCLOCK_H
/** * This file is part of the "libstx" project * Copyright (c) 2014 Paul Asmuth, Google Inc. * * libstx is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License v3.0. You should have received a * copy of the GNU General Public License along with this program. If not, see * <http://www.gnu.org/licenses/>. */ #ifndef _STX_BASE_INTERNAMP_H #define _STX_BASE_INTERNAMP_H #include <mutex> #include "stx/stdtypes.h" namespace stx { class InternMap { public: static const constexpr uint32_t kMagic = 0x17234205; void* internString(const String& str); String getString(const void* interned); protected: struct InternedStringHeader { uint32_t magic; size_t size; }; std::mutex intern_map_mutex_; HashMap<String, void*> intern_map_; }; } // namespace stx #endif
/**************************************************************************** ** ** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com> ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include "sourcecodestream.h" #include <QString> namespace Nim { class NimLexer { public: enum State { Default = -1, MultiLineString = 0, MultiLineComment = 1 }; struct TokenType { enum Type { Keyword = 0, Identifier, Comment, Documentation, StringLiteral, MultiLineStringLiteral, Operator, Number, EndOfText }; }; struct Token { Token() : begin(0) , length(0) , type(TokenType::EndOfText) {} Token(int b, int l, TokenType::Type t) : begin(b), length(l), type(t) {} int begin; int length; TokenType::Type type; }; NimLexer(const QChar *text, int length, State state = State::Default ); Token next(); State state() const { return m_state; } private: Token onDefaultState(); Token onMultiLineStringState(); Token onMultiLineCommentState(); bool isSkipChar(); bool isOperator(); Token readOperator(); bool matchCommentStart(); Token readComment(); bool matchMultiLineCommentStart(); bool matchMultiLineCommentEnd(); Token readMultiLineComment(bool moveForward); bool matchDocumentationStart(); Token readDocumentation(); bool matchNumber(); Token readNumber(); bool matchIdentifierOrKeywordStart(); Token readIdentifierOrKeyword(); bool matchStringLiteralStart(); Token readStringLiteral(); bool matchMultiLineStringLiteralStart(); Token readMultiLineStringLiteral(bool moveForward = true); State m_state; SourceCodeStream m_stream; }; }
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU" * found in "/home/einstein/openairinterface5g/openair-cn/S1AP/MESSAGES/ASN1/R10.5/S1AP-PDU.asn" * `asn1c -gen-PER` */ #ifndef _S1ap_InitialContextSetupResponse_H_ #define _S1ap_InitialContextSetupResponse_H_ #include <asn_application.h> /* Including external dependencies */ #include <asn_SEQUENCE_OF.h> #include <constr_SEQUENCE_OF.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct S1ap_IE; /* S1ap-InitialContextSetupResponse */ typedef struct S1ap_InitialContextSetupResponse { struct S1ap_InitialContextSetupResponse__s1ap_InitialContextSetupResponse_ies { A_SEQUENCE_OF(struct S1ap_IE) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } s1ap_InitialContextSetupResponse_ies; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } S1ap_InitialContextSetupResponse_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_S1ap_InitialContextSetupResponse; #ifdef __cplusplus } #endif /* Referred external types */ #include "S1ap-IE.h" #endif /* _S1ap_InitialContextSetupResponse_H_ */ #include <asn_internal.h>
// Copyright (C) 2008-2012 Garth N. Wells // // This file is part of DOLFIN. // // DOLFIN is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // DOLFIN 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 DOLFIN. If not, see <http://www.gnu.org/licenses/>. // // Modified by Anders Logg, 2008-2009. // // First added: 2008-11-28 // Last changed: 2011-03-25 // // Modified by Anders Logg, 2008-2009. // Modified by Kent-Andre Mardal, 2011. #ifndef __LOCAL_MESH_VALUE_COLLECTION_H #define __LOCAL_MESH_VALUE_COLLECTION_H #include <map> #include <utility> #include <vector> #include <dolfin/common/MPI.h> #include <dolfin/log/log.h> namespace dolfin { template <typename T> class MeshValueCollection; /// This class stores mesh data on a local processor corresponding /// to a portion of a MeshValueCollection. template <typename T> class LocalMeshValueCollection { public: /// Create local mesh data for given LocalMeshValueCollection LocalMeshValueCollection(const MeshValueCollection<T>& values, std::size_t dim); /// Destructor ~LocalMeshValueCollection() {} /// Return dimension of cell entity std::size_t dim () const { return _dim; } /// Return data const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T> >& values() const { return _values; } private: // Topological dimension const std::size_t _dim; // MeshValueCollection values (cell_index, local_index), value)) std::vector<std::pair<std::pair<std::size_t, std::size_t>, T> > _values; // MPI communicator MPI_Comm _mpi_comm; }; //--------------------------------------------------------------------------- // Implementation of LocalMeshValueCollection //--------------------------------------------------------------------------- template <typename T> LocalMeshValueCollection<T>::LocalMeshValueCollection(const MeshValueCollection<T>& values, std::size_t dim) : _dim(dim), _mpi_comm(MPI_COMM_WORLD) { // Prepare data std::vector<std::vector<std::size_t> > send_indices; std::vector<std::vector<T> > send_v; // Extract data on main process and split among processes if (MPI::is_broadcaster(_mpi_comm)) { // Get number of processes const std::size_t num_processes = MPI::size(_mpi_comm); send_indices.resize(num_processes); send_v.resize(num_processes); const std::map<std::pair<std::size_t, std::size_t>, T>& vals = values.values(); for (std::size_t p = 0; p < num_processes; p++) { const std::pair<std::size_t, std::size_t> local_range = MPI::local_range(_mpi_comm, p, vals.size()); typename std::map<std::pair<std::size_t, std::size_t>, T>::const_iterator it = vals.begin(); std::advance(it, local_range.first); for (std::size_t i = local_range.first; i < local_range.second; ++i) { send_indices[p].push_back(it->first.first); send_indices[p].push_back(it->first.second); send_v[p].push_back(it->second); std::advance(it, 1); } } } // Scatter data std::vector<std::size_t> indices; std::vector<T> v; MPI::scatter(_mpi_comm, send_indices, indices); MPI::scatter(_mpi_comm, send_v, v); dolfin_assert(2*v.size() == indices.size()); // Unpack for (std::size_t i = 0; i < v.size(); ++i) { const std::size_t cell_index = indices[2*i]; const std::size_t local_entity_index = indices[2*i + 1]; const T value = v[i]; _values.push_back(std::make_pair(std::make_pair(cell_index, local_entity_index), value)); } } //--------------------------------------------------------------------------- } #endif
/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop 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. It 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. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once #include "media/media_audio.h" #include "media/media_audio_loader.h" extern "C" { #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include <libavutil/opt.h> #include <libswresample/swresample.h> } // extern "C" #include <AL/al.h> class AbstractFFMpegLoader : public AudioPlayerLoader { public: AbstractFFMpegLoader(const FileLocation &file, const QByteArray &data) : AudioPlayerLoader(file, data) { } bool open(qint64 &position) override; TimeMs duration() override { return len; } int32 frequency() override { return freq; } ~AbstractFFMpegLoader(); protected: int32 freq = Media::Player::kDefaultFrequency; TimeMs len = 0; uchar *ioBuffer = nullptr; AVIOContext *ioContext = nullptr; AVFormatContext *fmtContext = nullptr; AVCodec *codec = nullptr; int32 streamId = 0; bool _opened = false; private: static int _read_data(void *opaque, uint8_t *buf, int buf_size); static int64_t _seek_data(void *opaque, int64_t offset, int whence); static int _read_file(void *opaque, uint8_t *buf, int buf_size); static int64_t _seek_file(void *opaque, int64_t offset, int whence); }; class FFMpegLoader : public AbstractFFMpegLoader { public: FFMpegLoader(const FileLocation &file, const QByteArray &data); bool open(qint64 &position) override; int32 format() override { return fmt; } ReadResult readMore(QByteArray &result, int64 &samplesAdded) override; ~FFMpegLoader(); protected: int32 sampleSize = 2 * sizeof(uint16); private: ReadResult readFromReadyFrame(QByteArray &result, int64 &samplesAdded); int32 fmt = AL_FORMAT_STEREO16; int32 srcRate = Media::Player::kDefaultFrequency; int32 dstRate = Media::Player::kDefaultFrequency; int32 maxResampleSamples = 1024; uint8_t **dstSamplesData = nullptr; AVCodecContext *codecContext = nullptr; AVPacket avpkt; AVSampleFormat inputFormat; AVFrame *frame = nullptr; SwrContext *swrContext = nullptr; };
/************************************************************************ * include/queue.h * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.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. * 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. * ************************************************************************/ #ifndef __INCLUDE_QUEUE_H #define __INCLUDE_QUEUE_H #ifndef FAR #define FAR #endif /************************************************************************ * Included Files ************************************************************************/ #include <sys/types.h> /************************************************************************ * Pre-processor Definitions ************************************************************************/ #define sq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0) #define dq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0) #define sq_next(p) ((p)->flink) #define dq_next(p) ((p)->flink) #define dq_prev(p) ((p)->blink) #define sq_empty(q) ((q)->head == NULL) #define dq_empty(q) ((q)->head == NULL) #define sq_peek(q) ((q)->head) #define dq_peek(q) ((q)->head) /************************************************************************ * Global Type Declarations ************************************************************************/ struct sq_entry_s { FAR struct sq_entry_s *flink; }; typedef struct sq_entry_s sq_entry_t; struct dq_entry_s { FAR struct dq_entry_s *flink; FAR struct dq_entry_s *blink; }; typedef struct dq_entry_s dq_entry_t; struct sq_queue_s { FAR sq_entry_t *head; FAR sq_entry_t *tail; }; typedef struct sq_queue_s sq_queue_t; struct dq_queue_s { FAR dq_entry_t *head; FAR dq_entry_t *tail; }; typedef struct dq_queue_s dq_queue_t; /************************************************************************ * Global Function Prototypes ************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" extern "C" { #else #define EXTERN extern #endif EXTERN void sq_addfirst(FAR sq_entry_t *node, sq_queue_t *queue); EXTERN void dq_addfirst(FAR dq_entry_t *node, dq_queue_t *queue); EXTERN void sq_addlast(FAR sq_entry_t *node, sq_queue_t *queue); EXTERN void dq_addlast(FAR dq_entry_t *node, dq_queue_t *queue); EXTERN void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node, sq_queue_t *queue); EXTERN void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node, dq_queue_t *queue); EXTERN void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node, dq_queue_t *queue); EXTERN FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, sq_queue_t *queue); EXTERN void sq_rem(FAR sq_entry_t *node, sq_queue_t *queue); EXTERN void dq_rem(FAR dq_entry_t *node, dq_queue_t *queue); EXTERN FAR sq_entry_t *sq_remlast(sq_queue_t *queue); EXTERN FAR dq_entry_t *dq_remlast(dq_queue_t *queue); EXTERN FAR sq_entry_t *sq_remfirst(sq_queue_t *queue); EXTERN FAR dq_entry_t *dq_remfirst(dq_queue_t *queue); #undef EXTERN #ifdef __cplusplus } #endif #endif /* __INCLUDE_QUEUE_H_ */
/* ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4) ** ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik, ** Universitaet Karlsruhe, Germany ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie ** Universitaet Wuppertal, Germany ** ** 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 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* CVS $Id: l_coth.c,v 1.21 2014/01/30 17:24:09 cxsc Exp $ */ /****************************************************************/ /* */ /* Filename : l_coth.c */ /* */ /* Entries : multiprecision l_coth(a) */ /* multiprecision a; */ /* */ /* Arguments : a = argument of standard function */ /* */ /* Description : Hyperbolic cotangent function */ /* */ /****************************************************************/ #ifndef ALL_IN_ONE #ifdef AIX #include "/u/p88c/runtime/o_defs.h" #else #include "o_defs.h" #endif #define local #endif #ifdef LINT_ARGS local multiprecision l_coth(multiprecision a) #else local multiprecision l_coth(a) multiprecision a; #endif { multiprecision res; a_intg rc; E_TPUSH("l_coth") l_init(&res); if (res==NULL) e_trap(ALLOCATION,2,E_TMSG,65); else if ((rc = Lcoth(a,res))!=0) { e_trap(INV_ARG,2,E_TMLT+E_TEXT(7),&a,E_TINT+E_TEXT(16),&rc); (void)b_bclr(res); } if (a->f) l_free(&a); E_TPOPP("l_coth") return(res); }
/** * @file tournament.h * @author Juan José Escobar Pérez * @date 28/06/2015 * @brief Header file that defines functions for the realization of the tournament (selection of individuals) * */ #ifndef TOURNAMENT_H #define TOURNAMENT_H /********************************* Methods ********************************/ /** * @brief Competition between randomly selected individuals. The best individuals are stored in the pool * @param pool Position of the selected individuals for the crossover * @param poolSize Number of selected individuals for the crossover * @param tourSize Number of individuals competing in the tournament * @param populationSize The size of the population */ void fillPool(int *pool, const int poolSize, const int tourSize, const int populationSize); #endif
/* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test for CJK encoding. Copyright (C) 2001-2002, 2005-2007, 2009-2013 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "streq.h" static int is_cjk_encoding (const char *encoding) { if (0 /* Legacy Japanese encodings */ || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0) /* Legacy Chinese encodings */ || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0) || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0) || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0) /* Legacy Korean encodings */ || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0) || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0)) return 1; return 0; }
/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file bswap.h * byte swapping routines */ #ifndef AVUTIL_X86_BSWAP_H #define AVUTIL_X86_BSWAP_H #include <stdint.h> #include "config.h" #include "libavutil/common.h" #define bswap_16 bswap_16 static av_always_inline av_const uint16_t bswap_16(uint16_t x) { __asm__("rorw $8, %0" : "+r"(x)); return x; } #define bswap_32 bswap_32 static av_always_inline av_const uint32_t bswap_32(uint32_t x) { #ifdef HAVE_BSWAP __asm__("bswap %0" : "+r" (x)); #else __asm__("rorw $8, %w0 \n\t" "rorl $16, %0 \n\t" "rorw $8, %w0" : "+r"(x)); #endif return x; } #ifdef ARCH_X86_64 #define bswap_64 bswap_64 static inline uint64_t av_const bswap_64(uint64_t x) { __asm__("bswap %0": "=r" (x) : "0" (x)); return x; } #endif #endif /* AVUTIL_X86_BSWAP_H */
/* * Copyright 2014 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL // DO NOT USE -- FOR INTERNAL TESTING ONLY #ifndef sk_types_DEFINED #define sk_types_DEFINED #include <stdint.h> #include <stddef.h> #ifdef __cplusplus #define SK_C_PLUS_PLUS_BEGIN_GUARD extern "C" { #define SK_C_PLUS_PLUS_END_GUARD } #else #include <stdbool.h> #define SK_C_PLUS_PLUS_BEGIN_GUARD #define SK_C_PLUS_PLUS_END_GUARD #endif #if !defined(SK_API) #if defined(SKIA_DLL) #if defined(_MSC_VER) #if SKIA_IMPLEMENTATION #define SK_API __declspec(dllexport) #else #define SK_API __declspec(dllimport) #endif #else #define SK_API __attribute__((visibility("default"))) #endif #else #define SK_API #endif #endif /////////////////////////////////////////////////////////////////////////////////////// SK_C_PLUS_PLUS_BEGIN_GUARD typedef uint32_t sk_color_t; /* This macro assumes all arguments are >=0 and <=255. */ #define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define sk_color_get_a(c) (((c) >> 24) & 0xFF) #define sk_color_get_r(c) (((c) >> 16) & 0xFF) #define sk_color_get_g(c) (((c) >> 8) & 0xFF) #define sk_color_get_b(c) (((c) >> 0) & 0xFF) typedef enum { UNKNOWN_SK_COLORTYPE, RGBA_8888_SK_COLORTYPE, BGRA_8888_SK_COLORTYPE, ALPHA_8_SK_COLORTYPE, } sk_colortype_t; typedef enum { OPAQUE_SK_ALPHATYPE, PREMUL_SK_ALPHATYPE, UNPREMUL_SK_ALPHATYPE, } sk_alphatype_t; typedef enum { INTERSECT_SK_CLIPTYPE, DIFFERENCE_SK_CLIPTYPE, } sk_cliptype_t; typedef enum { UNKNOWN_SK_PIXELGEOMETRY, RGB_H_SK_PIXELGEOMETRY, BGR_H_SK_PIXELGEOMETRY, RGB_V_SK_PIXELGEOMETRY, BGR_V_SK_PIXELGEOMETRY, } sk_pixelgeometry_t; /** Return the default sk_colortype_t; this is operating-system dependent. */ SK_API sk_colortype_t sk_colortype_get_default_8888(); typedef struct { int32_t width; int32_t height; sk_colortype_t colorType; sk_alphatype_t alphaType; } sk_imageinfo_t; typedef struct { sk_pixelgeometry_t pixelGeometry; } sk_surfaceprops_t; typedef struct { float x; float y; } sk_point_t; typedef struct { int32_t left; int32_t top; int32_t right; int32_t bottom; } sk_irect_t; typedef struct { float left; float top; float right; float bottom; } sk_rect_t; typedef struct { float mat[9]; } sk_matrix_t; /** A sk_canvas_t encapsulates all of the state about drawing into a destination This includes a reference to the destination itself, and a stack of matrix/clip values. */ typedef struct sk_canvas_t sk_canvas_t; /** A sk_data_ holds an immutable data buffer. */ typedef struct sk_data_t sk_data_t; /** A sk_image_t is an abstraction for drawing a rectagle of pixels. The content of the image is always immutable, though the actual storage may change, if for example that image can be re-created via encoded data or other means. */ typedef struct sk_image_t sk_image_t; /** A sk_maskfilter_t is an object that perform transformations on an alpha-channel mask before drawing it; it may be installed into a sk_paint_t. Each time a primitive is drawn, it is first scan-converted into a alpha mask, which os handed to the maskfilter, which may create a new mask is to render into the destination. */ typedef struct sk_maskfilter_t sk_maskfilter_t; /** A sk_paint_t holds the style and color information about how to draw geometries, text and bitmaps. */ typedef struct sk_paint_t sk_paint_t; /** A sk_path_t encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. */ typedef struct sk_path_t sk_path_t; /** A sk_picture_t holds recorded canvas drawing commands to be played back at a later time. */ typedef struct sk_picture_t sk_picture_t; /** A sk_picture_recorder_t holds a sk_canvas_t that records commands to create a sk_picture_t. */ typedef struct sk_picture_recorder_t sk_picture_recorder_t; /** A sk_shader_t specifies the source color(s) for what is being drawn. If a paint has no shader, then the paint's color is used. If the paint has a shader, then the shader's color(s) are use instead, but they are modulated by the paint's alpha. */ typedef struct sk_shader_t sk_shader_t; /** A sk_surface_t holds the destination for drawing to a canvas. For raster drawing, the destination is an array of pixels in memory. For GPU drawing, the destination is a texture or a framebuffer. */ typedef struct sk_surface_t sk_surface_t; typedef enum { CLEAR_SK_XFERMODE_MODE, SRC_SK_XFERMODE_MODE, DST_SK_XFERMODE_MODE, SRCOVER_SK_XFERMODE_MODE, DSTOVER_SK_XFERMODE_MODE, SRCIN_SK_XFERMODE_MODE, DSTIN_SK_XFERMODE_MODE, SRCOUT_SK_XFERMODE_MODE, DSTOUT_SK_XFERMODE_MODE, SRCATOP_SK_XFERMODE_MODE, DSTATOP_SK_XFERMODE_MODE, XOR_SK_XFERMODE_MODE, PLUS_SK_XFERMODE_MODE, MODULATE_SK_XFERMODE_MODE, SCREEN_SK_XFERMODE_MODE, OVERLAY_SK_XFERMODE_MODE, DARKEN_SK_XFERMODE_MODE, LIGHTEN_SK_XFERMODE_MODE, COLORDODGE_SK_XFERMODE_MODE, COLORBURN_SK_XFERMODE_MODE, HARDLIGHT_SK_XFERMODE_MODE, SOFTLIGHT_SK_XFERMODE_MODE, DIFFERENCE_SK_XFERMODE_MODE, EXCLUSION_SK_XFERMODE_MODE, MULTIPLY_SK_XFERMODE_MODE, HUE_SK_XFERMODE_MODE, SATURATION_SK_XFERMODE_MODE, COLOR_SK_XFERMODE_MODE, LUMINOSITY_SK_XFERMODE_MODE, } sk_xfermode_mode_t; ////////////////////////////////////////////////////////////////////////////////////////// SK_C_PLUS_PLUS_END_GUARD #endif
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is the Netscape Portable Runtime (NSPR). * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1999-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * File: pipepong.c * * Description: * This test runs in conjunction with the pipeping test. * The pipeping test creates two pipes and redirects the * stdin and stdout of this test to the pipes. Then the * pipeping test writes "ping" to this test and this test * writes "pong" back. Note that this test does not depend * on NSPR at all. To run this pair of tests, just invoke * pipeping. * * Tested areas: process creation, pipes, file descriptor * inheritance, standard I/O redirection. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #define NUM_ITERATIONS 10 int main(int argc, char **argv) { char buf[1024]; size_t nBytes; int idx; for (idx = 0; idx < NUM_ITERATIONS; idx++) { memset(buf, 0, sizeof(buf)); nBytes = fread(buf, 1, 5, stdin); fprintf(stderr, "pong process: received \"%s\"\n", buf); if (nBytes != 5) { fprintf(stderr, "pong process: expected 5 bytes but got %d bytes\n", nBytes); exit(1); } if (strcmp(buf, "ping") != 0) { fprintf(stderr, "pong process: expected \"ping\" but got \"%s\"\n", buf); exit(1); } strcpy(buf, "pong"); fprintf(stderr, "pong process: sending \"%s\"\n", buf); nBytes = fwrite(buf, 1, 5, stdout); if (nBytes != 5) { fprintf(stderr, "pong process: fwrite failed\n"); exit(1); } fflush(stdout); } return 0; }
#include "mupdf/fitz.h" static int file_printf(fz_output *out, const char *fmt, va_list ap) { FILE *file = (FILE *)out->opaque; return vfprintf(file, fmt, ap); } static int file_write(fz_output *out, const void *buffer, int count) { FILE *file = (FILE *)out->opaque; return fwrite(buffer, 1, count, file); } static void file_close(fz_output *out) { FILE *file = (FILE *)out->opaque; fclose(file); } fz_output * fz_new_output_with_file(fz_context *ctx, FILE *file) { fz_output *out = fz_malloc_struct(ctx, fz_output); out->ctx = ctx; out->opaque = file; out->printf = file_printf; out->write = file_write; out->close = NULL; return out; } fz_output * fz_new_output_to_filename(fz_context *ctx, const char *filename) { fz_output *out = NULL; FILE *file = fopen(filename, "wb"); if (!file) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot open file '%s': %s", filename, strerror(errno)); fz_var(ctx); fz_try(ctx) { out = fz_malloc_struct(ctx, fz_output); out->ctx = ctx; out->opaque = file; out->printf = file_printf; out->write = file_write; out->close = file_close; } fz_catch(ctx) { fclose(file); fz_rethrow(ctx); } return out; } void fz_close_output(fz_output *out) { if (!out) return; if (out->close) out->close(out); fz_free(out->ctx, out); } int fz_printf(fz_output *out, const char *fmt, ...) { int ret; va_list ap; if (!out) return 0; va_start(ap, fmt); ret = out->printf(out, fmt, ap); va_end(ap); return ret; } int fz_write(fz_output *out, const void *data, int len) { if (!out) return 0; return out->write(out, data, len); } void fz_putc(fz_output *out, char c) { if (out) (void)out->write(out, &c, 1); } int fz_puts(fz_output *out, const char *str) { if (!out) return 0; return out->write(out, str, strlen(str)); } static int buffer_printf(fz_output *out, const char *fmt, va_list list) { fz_buffer *buffer = (fz_buffer *)out->opaque; return fz_buffer_vprintf(out->ctx, buffer, fmt, list); } static int buffer_write(fz_output *out, const void *data, int len) { fz_buffer *buffer = (fz_buffer *)out->opaque; fz_write_buffer(out->ctx, buffer, (unsigned char *)data, len); return len; } fz_output * fz_new_output_with_buffer(fz_context *ctx, fz_buffer *buf) { fz_output *out = fz_malloc_struct(ctx, fz_output); out->ctx = ctx; out->opaque = buf; out->printf = buffer_printf; out->write = buffer_write; out->close = NULL; return out; }
/* * Copyright 2010-2012 Fabric Engine Inc. All rights reserved. */ #ifndef _FABRIC_CG_EXPR_VALUE_H #define _FABRIC_CG_EXPR_VALUE_H #include <Fabric/Core/CG/ExprType.h> #include <Fabric/Core/CG/Context.h> namespace llvm { class Value; }; namespace Fabric { namespace CG { class BasicBlockBuilder; class ExprValue { public: ExprValue( RC::Handle<Context> const &context ); ExprValue( ExprType const &type, RC::Handle<Context> const &context, llvm::Value *value ); ExprValue( RC::ConstHandle<Adapter> const &adapter, Usage usage, RC::Handle<Context> const &context, llvm::Value *value ); ExprValue( ExprValue const &that ); ExprValue &operator =( ExprValue const &that ); bool isValid() const; operator bool() const; bool operator !() const; ExprType const &getExprType() const; std::string const &getTypeUserName() const; std::string const &getTypeCodeName() const; RC::ConstHandle<Adapter> getAdapter() const; RC::ConstHandle<RT::Desc> getDesc() const; RC::ConstHandle<RT::Impl> getImpl() const; Usage getUsage() const; llvm::Value *getValue() const; ExprValue &castTo( BasicBlockBuilder &basicBlockBuilder, ExprType const &exprType ); ExprValue &castTo( BasicBlockBuilder &basicBlockBuilder, RC::ConstHandle<Adapter> const &adapter ); ExprValue &castTo( BasicBlockBuilder &basicBlockBuilder, Usage usage ); void llvmDispose( BasicBlockBuilder &basicBlockBuilder ); std::string desc() const; private: ExprType m_exprType; RC::Handle<Context> m_context; llvm::Value *m_value; }; } } #endif //_FABRIC_CG_EXPR_VALUE_H
// -*- C++ -*- // Module: Log4CPLUS // File: pointer.h // Created: 6/2001 // Author: Tad E. Smith // // // Copyright 2001-2015 Tad E. Smith // // 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. // // Note: Some of this code uses ideas from "More Effective C++" by Scott // Myers, Addison Wesley Longmain, Inc., (c) 1996, Chapter 29, pp. 183-213 // /** @file */ #ifndef LOG4CPLUS_HELPERS_POINTERS_HEADER_ #define LOG4CPLUS_HELPERS_POINTERS_HEADER_ #include <log4cplus/config.hxx> #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) #pragma once #endif #include <log4cplus/thread/syncprims.h> #include <algorithm> #include <cassert> #if ! defined (LOG4CPLUS_SINGLE_THREADED) \ && defined (LOG4CPLUS_HAVE_CXX11_ATOMICS) #include <atomic> #endif namespace log4cplus { namespace helpers { /****************************************************************************** * Class SharedObject (from pp. 204-205) * ******************************************************************************/ class LOG4CPLUS_EXPORT SharedObject { public: void addReference() const; void removeReference() const; protected: // Ctor SharedObject() : access_mutex() , count(0) { } SharedObject(const SharedObject&) : access_mutex() , count(0) { } // Dtor virtual ~SharedObject(); // Operators SharedObject& operator=(const SharedObject&) { return *this; } public: thread::Mutex access_mutex; private: #if defined (LOG4CPLUS_SINGLE_THREADED) typedef unsigned count_type; #elif defined (LOG4CPLUS_HAVE_CXX11_ATOMICS) typedef std::atomic<unsigned> count_type; #elif defined (_WIN32) || defined (__CYGWIN__) typedef long count_type; #else typedef unsigned count_type; #endif mutable count_type count; }; /****************************************************************************** * Template Class SharedObjectPtr (from pp. 203, 206) * ******************************************************************************/ template<class T> class SharedObjectPtr { public: // Ctor explicit SharedObjectPtr(T* realPtr = 0) : pointee(realPtr) { addref (); } SharedObjectPtr(const SharedObjectPtr& rhs) : pointee(rhs.pointee) { addref (); } #if defined (LOG4CPLUS_HAVE_RVALUE_REFS) SharedObjectPtr(SharedObjectPtr && rhs) : pointee (std::move (rhs.pointee)) { rhs.pointee = 0; } SharedObjectPtr & operator = (SharedObjectPtr && rhs) { rhs.swap (*this); return *this; } #endif // Dtor ~SharedObjectPtr() { if (pointee) pointee->removeReference(); } // Operators bool operator==(const SharedObjectPtr& rhs) const { return (pointee == rhs.pointee); } bool operator!=(const SharedObjectPtr& rhs) const { return (pointee != rhs.pointee); } bool operator==(const T* rhs) const { return (pointee == rhs); } bool operator!=(const T* rhs) const { return (pointee != rhs); } T* operator->() const {assert (pointee); return pointee; } T& operator*() const {assert (pointee); return *pointee; } SharedObjectPtr& operator=(const SharedObjectPtr& rhs) { return this->operator = (rhs.pointee); } SharedObjectPtr& operator=(T* rhs) { SharedObjectPtr<T> (rhs).swap (*this); return *this; } // Methods T* get() const { return pointee; } void swap (SharedObjectPtr & other) throw () { std::swap (pointee, other.pointee); } typedef T * (SharedObjectPtr:: * unspec_bool_type) () const; operator unspec_bool_type () const { return pointee ? &SharedObjectPtr::get : 0; } bool operator ! () const { return ! pointee; } private: // Methods void addref() const { if (pointee) pointee->addReference(); } // Data T* pointee; }; //! Boost `intrusive_ptr` helpers. //! @{ inline void intrusive_ptr_add_ref (SharedObject const * so) { so->addReference(); } inline void intrusive_ptr_release (SharedObject const * so) { so->removeReference(); } //! @} } // end namespace helpers } // end namespace log4cplus #endif // LOG4CPLUS_HELPERS_POINTERS_HEADER_
#pragma once #include "../TKernel" #include "../TKBRep" #include "../TKG2d" #include "../TKG3d" #include "../TKGeomAlgo" #include "../TKGeomBase" #include "../TKMath" #include "../TKMesh" #include "../TKService" #include "../TKTopAlgo" #include "../TKV3d"
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. #ifndef Patternist_Atomizer_H #define Patternist_Atomizer_H #include "qitem_p.h" #include "qsinglecontainer_p.h" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE namespace QPatternist { /** * @short Performs atomization. Effectively, it is an implementation * of the <tt>fn:data()</tt> function. * * @see <a href="http://www.w3.org/TR/xpath-functions/#func-data">XQuery 1.0 and XPath * 2.0 Functions and Operators, 2.4 fn:data</a> * @see <a href="http://www.w3.org/TR/xpath20/#id-atomization">XML * Path Language (XPath) 2.0, 2.4.2 Atomization</a> * @author Frans Englich <frans.englich@nokia.com> * @ingroup Patternist_expressions */ class Atomizer : public SingleContainer { public: Atomizer(const Expression::Ptr &operand); virtual Item evaluateSingleton(const DynamicContext::Ptr &) const; virtual Item::Iterator::Ptr evaluateSequence(const DynamicContext::Ptr &) const; virtual SequenceType::Ptr staticType() const; virtual SequenceType::List expectedOperandTypes() const; virtual const SourceLocationReflection *actualReflection() const; /** * Makes an early compression, by returning the result of * the type checked operand, if the operand has the static type * xs:anyAtomicType(no atomization needed). */ virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType); inline Item::Iterator::Ptr mapToSequence(const Item &item, const DynamicContext::Ptr &context) const; virtual ExpressionVisitorResult::Ptr accept(const ExpressionVisitor::Ptr &visitor) const; private: typedef QExplicitlySharedDataPointer<const Atomizer> ConstPtr; }; } QT_END_NAMESPACE QT_END_HEADER #endif
#include <cgreen/cgreen.h> #include <stdbool.h> #include "xml_reporter.h" Describe(XML_reporter); BeforeEach(XML_reporter) {} AfterEach(XML_reporter) {} Ensure(XML_reporter, reports_a_test_that_passes) { assert_that(1 == 1); } Ensure(XML_reporter, reports_a_test_that_fails) { fail_test("A failure"); } TestSuite *create_test_group() { TestSuite *suite = create_named_test_suite("A Group"); add_test_with_context(suite, XML_reporter, reports_a_test_that_passes); add_test_with_context(suite, XML_reporter, reports_a_test_that_fails); return suite; } int main(int argc, char **argv) { TestSuite *suite = create_named_test_suite("Top Level"); add_suite(suite, create_test_group()); return run_test_suite(suite, create_xml_reporter()); }
/*************************************************************************** * Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2008 * * * * This file is part of the FreeCAD CAx development system. * * * * 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., 59 Temple Place, * * Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************/ #ifndef PART_PART2DOBJECT_H #define PART_PART2DOBJECT_H #include <App/PropertyStandard.h> #include <Base/Axis.h> #include "PartFeature.h" #include "AttachExtension.h" class TopoDS_Face; namespace Part { class Geometry; /** 2D Shape * This is a specialiced version of the PartShape for use with * flat (2D) geometry. The Z direction has always to be 0. * The position and orientation of the Plane this 2D geometry is * referenced is defined by the Placement property. It also * has a link to a supporting Face which defines the position * in space where it is located. If the support is changed the * static methode positionBySupport() is used to calculate a * new position for the Part2DObject. * This object can be used stand alone or for constraint * geometry as its descend Sketcher::SketchObject . */ class PartExport Part2DObject : public Part::Feature, public Part::AttachExtension { PROPERTY_HEADER_WITH_EXTENSIONS(Part::Part2DObject); public: Part2DObject(); virtual void transformPlacement(const Base::Placement &transform); /// returns the number of construction lines (to be used as axes) virtual int getAxisCount(void) const; /// retrieves an axis iterating through the construction lines of the sketch (indices start at 0) virtual Base::Axis getAxis(int axId) const; /// verify and accept the assigned geometry virtual void acceptGeometry(); /** calculate the points where a curve with index GeoId should be trimmed * with respect to the rest of the curves contained in the list geomlist * and a picked point. The outputs intersect1 and intersect2 specify the * tightest boundaries for trimming around the picked point and the * indexes GeoId1 and GeoId2 specify the corresponding curves that intersect * the curve GeoId. */ static bool seekTrimPoints(const std::vector<Geometry *> &geomlist, int GeoId, const Base::Vector3d &point, int &GeoId1, Base::Vector3d &intersect1, int &GeoId2, Base::Vector3d &intersect2); static const int H_Axis; static const int V_Axis; static const int N_Axis; /** @name methods overide Feature */ //@{ /// recalculate the Feature App::DocumentObjectExecReturn *execute(void); /// returns the type name of the ViewProvider const char* getViewProviderName(void) const { return "PartGui::ViewProvider2DObject"; } //@} void Restore(Base::XMLReader &reader); }; typedef App::FeaturePythonT<Part2DObject> Part2DObjectPython; } //namespace Part #endif // PART_PART2DOBJECT_H
/////////////////////////////////////////////////////////////////////////////// // Name: wx/msw/rcdefs.h // Purpose: Fallback for the generated rcdefs.h under the lib directory // Author: Mike Wetherell // Copyright: (c) 2005 Mike Wetherell // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_RCDEFS_H #define _WX_RCDEFS_H #ifdef __GNUC__ // We must be using windres which uses gcc as its preprocessor. We do need // to generate the manifest then as gcc doesn't do it automatically and we // can define the architecture macro on our own as all the usual symbols // are available (unlike with Microsoft RC.EXE which doesn't predefine // anything useful at all). #ifndef wxUSE_RC_MANIFEST #define wxUSE_RC_MANIFEST 1 #endif #if defined __i386__ #ifndef WX_CPU_X86 #define WX_CPU_X86 #endif #elif defined __x86_64__ #ifndef WX_CPU_AMD64 #define WX_CPU_AMD64 #endif #elif defined __ia64__ #ifndef WX_CPU_IA64 #define WX_CPU_IA64 #endif #endif #endif // Don't do anything here for the other compilers, in particular don't define // WX_CPU_X86 here as we used to do. If people define wxUSE_RC_MANIFEST, they // must also define the architecture constant correctly. #endif
// ----------------------------------------------------------------------------------------- // <copyright file="targetver.h" company="Microsoft"> // Copyright 2013 Microsoft Corporation // // 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. // </copyright> // ----------------------------------------------------------------------------------------- #pragma once // Including SDKDDKVer.h defines the highest available Windows platform. // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. #ifdef _WIN32 #include <SDKDDKVer.h> #endif
// See LICENSE for license details. //************************************************************************** // Double-precision sparse matrix-vector multiplication benchmark //-------------------------------------------------------------------------- #include "util.h" //-------------------------------------------------------------------------- // Input/Reference Data #include "dataset1.h" void spmv(int r, const double* val, const int* idx, const double* x, const int* ptr, double* y) { for (int i = 0; i < r; i++) { int k; double yi0 = 0, yi1 = 0, yi2 = 0, yi3 = 0; for (k = ptr[i]; k < ptr[i+1]-3; k+=4) { yi0 += val[k+0]*x[idx[k+0]]; yi1 += val[k+1]*x[idx[k+1]]; yi2 += val[k+2]*x[idx[k+2]]; yi3 += val[k+3]*x[idx[k+3]]; } for ( ; k < ptr[i+1]; k++) { yi0 += val[k]*x[idx[k]]; } y[i] = (yi0+yi1)+(yi2+yi3); } } //-------------------------------------------------------------------------- // Main int main( int argc, char* argv[] ) { double y[R]; #if PREALLOCATE spmv(R, val, idx, x, ptr, y); #endif setStats(1); spmv(R, val, idx, x, ptr, y); setStats(0); return verifyDouble(R, y, verify_data); }
#ifndef _IPXE_GDBUDP_H #define _IPXE_GDBUDP_H /** @file * * GDB remote debugging over UDP * */ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); struct sockaddr_in; struct gdb_transport; /** * Set up the UDP transport with network address * * @name network device name * @addr IP address and UDP listen port, may be NULL and fields may be zero * @ret transport suitable for starting the GDB stub or NULL on error */ struct gdb_transport *gdbudp_configure ( const char *name, struct sockaddr_in *addr ); #endif /* _IPXE_GDBUDP_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 GUAC_SSH_PIPE_H #define GUAC_SSH_PIPE_H #include "config.h" #include <guacamole/user.h> /** * The name reserved for the inbound pipe stream which forces the terminal * emulator's STDIN to be received from the pipe. */ #define GUAC_SSH_STDIN_PIPE_NAME "STDIN" /** * Handles an incoming stream from a Guacamole "pipe" instruction. If the pipe * is named "STDIN", the the contents of the pipe stream are redirected to * STDIN of the terminal emulator for as long as the pipe is open. */ guac_user_pipe_handler guac_ssh_pipe_handler; #endif
#ifndef CLibrary_h #define CLibrary_h typedef struct __attribute__((__objc_bridge__(Object))) CObject *CObjectRef; #endif
//===-- runtime/unit-map.h --------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // Maps Fortran unit numbers to their ExternalFileUnit instances. // A simple hash table with forward-linked chains per bucket. #ifndef FORTRAN_RUNTIME_UNIT_MAP_H_ #define FORTRAN_RUNTIME_UNIT_MAP_H_ #include "lock.h" #include "memory.h" #include "unit.h" #include <cstdlib> namespace Fortran::runtime::io { class UnitMap { public: ExternalFileUnit *LookUp(int n) { CriticalSection critical{lock_}; return Find(n); } ExternalFileUnit &LookUpOrCreate( int n, const Terminator &terminator, bool &wasExtant) { CriticalSection critical{lock_}; auto *p{Find(n)}; wasExtant = p != nullptr; return p ? *p : Create(n, terminator); } // Unit look-up by name is needed for INQUIRE(FILE="...") ExternalFileUnit *LookUp(const char *path) { CriticalSection critical{lock_}; return Find(path); } ExternalFileUnit &NewUnit(const Terminator &terminator) { CriticalSection critical{lock_}; return Create(nextNewUnit_--, terminator); } // To prevent races, the unit is removed from the map if it exists, // and put on the closing_ list until DestroyClosed() is called. ExternalFileUnit *LookUpForClose(int); void DestroyClosed(ExternalFileUnit &); void CloseAll(IoErrorHandler &); void FlushAll(IoErrorHandler &); private: struct Chain { explicit Chain(int n) : unit{n} {} ExternalFileUnit unit; OwningPtr<Chain> next{nullptr}; }; static constexpr int buckets_{1031}; // must be prime int Hash(int n) { return std::abs(n) % buckets_; } ExternalFileUnit *Find(int n) { Chain *previous{nullptr}; int hash{Hash(n)}; for (Chain *p{bucket_[hash].get()}; p; previous = p, p = p->next.get()) { if (p->unit.unitNumber() == n) { if (previous) { // Move found unit to front of chain for quicker lookup next time previous->next.swap(p->next); // now p->next.get() == p bucket_[hash].swap(p->next); // now bucket_[hash].get() == p } return &p->unit; } } return nullptr; } ExternalFileUnit *Find(const char *path); ExternalFileUnit &Create(int, const Terminator &); Lock lock_; OwningPtr<Chain> bucket_[buckets_]{}; // all owned by *this int nextNewUnit_{-1000}; // see 12.5.6.12 in Fortran 2018 OwningPtr<Chain> closing_{nullptr}; // units during CLOSE statement }; } // namespace Fortran::runtime::io #endif // FORTRAN_RUNTIME_UNIT_MAP_H_
#ifndef REAL_HEADERS #include "cpalien-headers.h" #else #include <stdio.h> #include <stdlib.h> #endif int do_an_allocation() { int *a = malloc(sizeof(int)); int *b = a; *a = 4; return b; } int main(int argc, char* argv[]){ int *ptr = do_an_allocation(); free(ptr); return 0; }
// // PDFView.h // // Created by Nigel Barber on 15/10/2011. // Copyright 2011 Mindbrix Limited. All rights reserved. // #import <UIKit/UIKit.h> @interface PDFView : UIView { } @property( nonatomic, assign ) int page; @property( nonatomic, strong ) NSString *resourceName; @property( nonatomic, strong ) NSURL *resourceURL; @property( nonatomic, strong ) NSData *resourceData; +(CGRect) mediaRect:(NSString *)resourceName; +(CGRect) mediaRectForURL:(NSURL *)resourceURL; +(CGRect) mediaRectForURL:(NSURL *)resourceURL atPage:(int)page; +(CGRect) mediaRectForData:(NSData *)data atPage:(int)page; +(int) pageCountForURL:(NSURL *)resourceURL; +(NSURL *)resourceURLForName:(NSString *)resourceName; +(void)renderIntoContext:(CGContextRef)ctx url:(NSURL *)resourceURL data:(NSData *)resourceData size:(CGSize)size page:(int)page; @end
/* l_37_6.t: Translation limits larger than Standard / 6. */ #include "defs.h" main( void) { int nest; fputs( "started\n", stderr); /* 37.6L: Parenthesized expression. */ #ifndef X3F #if \ (0x00 + (0x01 - (0x02 + (0x03 - (0x04 + (0x05 - (0x06 + (0x07 - \ (0x08 + (0x09 - (0x0A + (0x0B - (0x0C + (0x0D - (0x0E + (0x0F - \ (0x10 + (0x11 - (0x12 + (0x13 - (0x14 + (0x15 - (0x16 + (0x17 - \ (0x18 + (0x19 - (0x1A + (0x1B - (0x1C + (0x1D - (0x1E + (0x1F - \ (0x20 + (0x21 - (0x22 + (0x23 - (0x24 + (0x25 - (0x26 + (0x27 - \ (0x28 + (0x29 - (0x2A + (0x2B - (0x2C + (0x2D - (0x2E + (0x2F - \ (0x30 + (0x31 - (0x32 + (0x33 - (0x34 + (0x35 - (0x36 + (0x37 - \ (0x38 + (0x39 - (0x3A + (0x3B - (0x3C + (0x3D - (0x3E + (0x3F - \ (0x40 + (0x41 - (0x42 + (0x43 - (0x44 + (0x45 - (0x46 + (0x47 - \ (0x48 + (0x49 - (0x4A + (0x4B - (0x4C + (0x4D - (0x4E + (0x4F - \ (0x50 + (0x51 - (0x52 + (0x53 - (0x54 + (0x55 - (0x56 + (0x57 - \ (0x58 + (0x59 - (0x5A + (0x5B - (0x5C + (0x5D - (0x5E + (0x5F - \ (0x60 + (0x61 - (0x62 + (0x63 - (0x64 + (0x65 - (0x66 + (0x67 - \ (0x68 + (0x69 - (0x6A + (0x6B - (0x6C + (0x6D - (0x6E + (0x6F - \ (0x70 + (0x71 - (0x72 + (0x73 - (0x74 + (0x75 - (0x76 + (0x77 - \ (0x78 + (0x79 - (0x7A + (0x7B - (0x7C + (0x7D - (0x7E + 0x7F) \ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\ )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) \ == -0x80 nest = 127; #endif assert( nest == 127); #ifndef X7F #if \ (0x00 + (0x01 - (0x02 + (0x03 - (0x04 + (0x05 - (0x06 + (0x07 - \ (0x08 + (0x09 - (0x0A + (0x0B - (0x0C + (0x0D - (0x0E + (0x0F - \ (0x10 + (0x11 - (0x12 + (0x13 - (0x14 + (0x15 - (0x16 + (0x17 - \ (0x18 + (0x19 - (0x1A + (0x1B - (0x1C + (0x1D - (0x1E + (0x1F - \ (0x20 + (0x21 - (0x22 + (0x23 - (0x24 + (0x25 - (0x26 + (0x27 - \ (0x28 + (0x29 - (0x2A + (0x2B - (0x2C + (0x2D - (0x2E + (0x2F - \ (0x30 + (0x31 - (0x32 + (0x33 - (0x34 + (0x35 - (0x36 + (0x37 - \ (0x38 + (0x39 - (0x3A + (0x3B - (0x3C + (0x3D - (0x3E + (0x3F - \ (0x40 + (0x41 - (0x42 + (0x43 - (0x44 + (0x45 - (0x46 + (0x47 - \ (0x48 + (0x49 - (0x4A + (0x4B - (0x4C + (0x4D - (0x4E + (0x4F - \ (0x50 + (0x51 - (0x52 + (0x53 - (0x54 + (0x55 - (0x56 + (0x57 - \ (0x58 + (0x59 - (0x5A + (0x5B - (0x5C + (0x5D - (0x5E + (0x5F - \ (0x60 + (0x61 - (0x62 + (0x63 - (0x64 + (0x65 - (0x66 + (0x67 - \ (0x68 + (0x69 - (0x6A + (0x6B - (0x6C + (0x6D - (0x6E + (0x6F - \ (0x70 + (0x71 - (0x72 + (0x73 - (0x74 + (0x75 - (0x76 + (0x77 - \ (0x78 + (0x79 - (0x7A + (0x7B - (0x7C + (0x7D - (0x7E + (0x7F - \ (0x80 + (0x81 - (0x82 + (0x83 - (0x84 + (0x85 - (0x86 + (0x87 - \ (0x88 + (0x89 - (0x8A + (0x8B - (0x8C + (0x8D - (0x8E + (0x8F - \ (0x90 + (0x91 - (0x92 + (0x93 - (0x94 + (0x95 - (0x96 + (0x97 - \ (0x98 + (0x99 - (0x9A + (0x9B - (0x9C + (0x9D - (0x9E + (0x9F - \ (0xA0 + (0xA1 - (0xA2 + (0xA3 - (0xA4 + (0xA5 - (0xA6 + (0xA7 - \ (0xA8 + (0xA9 - (0xAA + (0xAB - (0xAC + (0xAD - (0xAE + (0xAF - \ (0xB0 + (0xB1 - (0xB2 + (0xB3 - (0xB4 + (0xB5 - (0xB6 + (0xB7 - \ (0xB8 + (0xB9 - (0xBA + (0xBB - (0xBC + (0xBD - (0xBE + (0xBF - \ (0xC0 + (0xC1 - (0xC2 + (0xC3 - (0xC4 + (0xC5 - (0xC6 + (0xC7 - \ (0xC8 + (0xC9 - (0xCA + (0xCB - (0xCC + (0xCD - (0xCE + (0xCF - \ (0xD0 + (0xD1 - (0xD2 + (0xD3 - (0xD4 + (0xD5 - (0xD6 + (0xD7 - \ (0xD8 + (0xD9 - (0xDA + (0xDB - (0xDC + (0xDD - (0xDE + (0xDF - \ (0xE0 + (0xE1 - (0xE2 + (0xE3 - (0xE4 + (0xE5 - (0xE6 + (0xE7 - \ (0xE8 + (0xE9 - (0xEA + (0xEB - (0xEC + (0xED - (0xEE + (0xEF - \ (0xF0 + (0xF1 - (0xF2 + (0xF3 - (0xF4 + (0xF5 - (0xF6 + (0xF7 - \ (0xF8 + (0xF9 - (0xFA + (0xFB - (0xFC + (0xFD - (0xFE + 0xFF) \ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\ )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) \ == -0x100 nest = 255; #endif assert( nest == 255); #endif #endif fputs( "success\n", stderr); return 0; }
/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file config_downloader.h * @author mike * @date 2000-03-19 */ #ifndef CONFIG_DOWNLOADER_H #define CONFIG_DOWNLOADER_H #include "pandabase.h" #include "notifyCategoryProxy.h" #include "dconfig.h" #include "configVariableInt.h" #include "configVariableDouble.h" #include "configVariableBool.h" #include "configVariableString.h" #include "configVariableFilename.h" #include "configVariableList.h" ConfigureDecl(config_downloader, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS); NotifyCategoryDecl(downloader, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS); extern ConfigVariableInt downloader_byte_rate; extern ConfigVariableBool download_throttle; extern ConfigVariableDouble downloader_frequency; extern ConfigVariableInt downloader_timeout; extern ConfigVariableInt downloader_timeout_retries; extern ConfigVariableDouble decompressor_step_time; extern ConfigVariableDouble extractor_step_time; extern ConfigVariableInt patcher_buffer_size; extern ConfigVariableBool http_proxy_tunnel; extern ConfigVariableDouble http_connect_timeout; extern ConfigVariableDouble http_timeout; extern ConfigVariableInt http_skip_body_size; extern ConfigVariableDouble http_idle_timeout; extern ConfigVariableInt http_max_connect_count; extern EXPCL_PANDAEXPRESS ConfigVariableInt tcp_header_size; extern EXPCL_PANDAEXPRESS ConfigVariableBool support_ipv6; extern EXPCL_PANDAEXPRESS void init_libdownloader(); #endif
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #ifndef INCLUDE_sys_git_repository_h__ #define INCLUDE_sys_git_repository_h__ /** * @file git2/sys/repository.h * @brief Git repository custom implementation routines * @defgroup git_backend Git custom backend APIs * @ingroup Git * @{ */ GIT_BEGIN_DECL /** * Create a new repository with neither backends nor config object * * Note that this is only useful if you wish to associate the repository * with a non-filesystem-backed object database and config store. * * @param out The blank repository * @return 0 on success, or an error code */ GIT_EXTERN(int) git_repository_new(git_repository **out); /** * Reset all the internal state in a repository. * * This will free all the mapped memory and internal objects * of the repository and leave it in a "blank" state. * * There's no need to call this function directly unless you're * trying to aggressively cleanup the repo before its * deallocation. `git_repository_free` already performs this operation * before deallocation the repo. */ GIT_EXTERN(void) git_repository__cleanup(git_repository *repo); /** * Update the filesystem config settings for an open repository * * When a repository is initialized, config values are set based on the * properties of the filesystem that the repository is on, such as * "core.ignorecase", "core.filemode", "core.symlinks", etc. If the * repository is moved to a new filesystem, these properties may no * longer be correct and API calls may not behave as expected. This * call reruns the phase of repository initialization that sets those * properties to compensate for the current filesystem of the repo. * * @param repo A repository object * @param recurse_submodules Should submodules be updated recursively * @returrn 0 on success, < 0 on error */ GIT_EXTERN(int) git_repository_reinit_filesystem( git_repository *repo, int recurse_submodules); /** * Set the configuration file for this repository * * This configuration file will be used for all configuration * queries involving this repository. * * The repository will keep a reference to the config file; * the user must still free the config after setting it * to the repository, or it will leak. * * @param repo A repository object * @param config A Config object */ GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *config); /** * Set the Object Database for this repository * * The ODB will be used for all object-related operations * involving this repository. * * The repository will keep a reference to the ODB; the user * must still free the ODB object after setting it to the * repository, or it will leak. * * @param repo A repository object * @param odb An ODB object */ GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb); /** * Set the Reference Database Backend for this repository * * The refdb will be used for all reference related operations * involving this repository. * * The repository will keep a reference to the refdb; the user * must still free the refdb object after setting it to the * repository, or it will leak. * * @param repo A repository object * @param refdb An refdb object */ GIT_EXTERN(void) git_repository_set_refdb(git_repository *repo, git_refdb *refdb); /** * Set the index file for this repository * * This index will be used for all index-related operations * involving this repository. * * The repository will keep a reference to the index file; * the user must still free the index after setting it * to the repository, or it will leak. * * @param repo A repository object * @param index An index object */ GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index); /** * Set a repository to be bare. * * Clear the working directory and set core.bare to true. You may also * want to call `git_repository_set_index(repo, NULL)` since a bare repo * typically does not have an index, but this function will not do that * for you. * * @param repo Repo to make bare * @return 0 on success, <0 on failure */ GIT_EXTERN(int) git_repository_set_bare(git_repository *repo); /** @} */ GIT_END_DECL #endif
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 1997-2015, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* */ #ifndef NFRULE_H #define NFRULE_H #include "unicode/rbnf.h" #if U_HAVE_RBNF #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/unistr.h" U_NAMESPACE_BEGIN class FieldPosition; class Formattable; class NFRuleList; class NFRuleSet; class NFSubstitution; class ParsePosition; class PluralFormat; class RuleBasedNumberFormat; class UnicodeString; class NFRule : public UMemory { public: enum ERuleType { kNoBase = 0, kNegativeNumberRule = -1, kImproperFractionRule = -2, kProperFractionRule = -3, kDefaultRule = -4, kInfinityRule = -5, kNaNRule = -6, kOtherRule = -7 }; static void makeRules(UnicodeString& definition, NFRuleSet* ruleSet, const NFRule* predecessor, const RuleBasedNumberFormat* rbnf, NFRuleList& ruleList, UErrorCode& status); NFRule(const RuleBasedNumberFormat* rbnf, const UnicodeString &ruleText, UErrorCode &status); ~NFRule(); UBool operator==(const NFRule& rhs) const; UBool operator!=(const NFRule& rhs) const { return !operator==(rhs); } ERuleType getType() const { return (ERuleType)(baseValue <= kNoBase ? (ERuleType)baseValue : kOtherRule); } void setType(ERuleType ruleType) { baseValue = (int32_t)ruleType; } int64_t getBaseValue() const { return baseValue; } void setBaseValue(int64_t value, UErrorCode& status); UChar getDecimalPoint() const { return decimalPoint; } int64_t getDivisor() const; void doFormat(int64_t number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const; void doFormat(double number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const; UBool doParse(const UnicodeString& text, ParsePosition& pos, UBool isFractional, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const; UBool shouldRollBack(int64_t number) const; void _appendRuleText(UnicodeString& result) const; int32_t findTextLenient(const UnicodeString& str, const UnicodeString& key, int32_t startingAt, int32_t* resultCount) const; void setDecimalFormatSymbols(const DecimalFormatSymbols &newSymbols, UErrorCode& status); private: void parseRuleDescriptor(UnicodeString& descriptor, UErrorCode& status); void extractSubstitutions(const NFRuleSet* ruleSet, const UnicodeString &ruleText, const NFRule* predecessor, UErrorCode& status); NFSubstitution* extractSubstitution(const NFRuleSet* ruleSet, const NFRule* predecessor, UErrorCode& status); int16_t expectedExponent() const; int32_t indexOfAnyRulePrefix() const; double matchToDelimiter(const UnicodeString& text, int32_t startPos, double baseValue, const UnicodeString& delimiter, ParsePosition& pp, const NFSubstitution* sub, uint32_t nonNumericalExecutedRuleMask, double upperBound) const; void stripPrefix(UnicodeString& text, const UnicodeString& prefix, ParsePosition& pp) const; int32_t prefixLength(const UnicodeString& str, const UnicodeString& prefix, UErrorCode& status) const; UBool allIgnorable(const UnicodeString& str, UErrorCode& status) const; int32_t findText(const UnicodeString& str, const UnicodeString& key, int32_t startingAt, int32_t* resultCount) const; private: int64_t baseValue; int32_t radix; int16_t exponent; UChar decimalPoint; UnicodeString fRuleText; NFSubstitution* sub1; NFSubstitution* sub2; const RuleBasedNumberFormat* formatter; const PluralFormat* rulePatternFormat; NFRule(const NFRule &other); // forbid copying of this class NFRule &operator=(const NFRule &other); // forbid copying of this class }; U_NAMESPACE_END /* U_HAVE_RBNF */ #endif // NFRULE_H #endif
//===------------------------ __refstring ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_REFSTRING_H #define _LIBCPP_REFSTRING_H #include <__config> #include <stdexcept> #include <cstddef> #include <cstring> #ifdef __APPLE__ #include <dlfcn.h> #include <mach-o/dyld.h> #endif #include "atomic_support.h" _LIBCPP_BEGIN_NAMESPACE_STD namespace __refstring_imp { namespace { typedef int count_t; struct _Rep_base { std::size_t len; std::size_t cap; count_t count; }; inline _Rep_base* rep_from_data(const char *data_) noexcept { char *data = const_cast<char *>(data_); return reinterpret_cast<_Rep_base *>(data - sizeof(_Rep_base)); } inline char * data_from_rep(_Rep_base *rep) noexcept { char *data = reinterpret_cast<char *>(rep); return data + sizeof(*rep); } #if defined(__APPLE__) inline const char* compute_gcc_empty_string_storage() _NOEXCEPT { void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD); if (handle == nullptr) return nullptr; void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE"); if (sym == nullptr) return nullptr; return data_from_rep(reinterpret_cast<_Rep_base *>(sym)); } inline const char* get_gcc_empty_string_storage() _NOEXCEPT { static const char* p = compute_gcc_empty_string_storage(); return p; } #endif }} // namespace __refstring_imp using namespace __refstring_imp; inline __libcpp_refstring::__libcpp_refstring(const char* msg) { std::size_t len = strlen(msg); _Rep_base* rep = static_cast<_Rep_base *>(::operator new(sizeof(*rep) + len + 1)); rep->len = len; rep->cap = len; rep->count = 0; char *data = data_from_rep(rep); std::memcpy(data, msg, len + 1); __imp_ = data; } inline __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring &s) _NOEXCEPT : __imp_(s.__imp_) { if (__uses_refcount()) __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1); } inline __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) _NOEXCEPT { bool adjust_old_count = __uses_refcount(); struct _Rep_base *old_rep = rep_from_data(__imp_); __imp_ = s.__imp_; if (__uses_refcount()) __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1); if (adjust_old_count) { if (__libcpp_atomic_add(&old_rep->count, count_t(-1)) < 0) { ::operator delete(old_rep); } } return *this; } inline __libcpp_refstring::~__libcpp_refstring() { if (__uses_refcount()) { _Rep_base* rep = rep_from_data(__imp_); if (__libcpp_atomic_add(&rep->count, count_t(-1)) < 0) { ::operator delete(rep); } } } inline bool __libcpp_refstring::__uses_refcount() const { #ifdef __APPLE__ return __imp_ != get_gcc_empty_string_storage(); #else return true; #endif } _LIBCPP_END_NAMESPACE_STD #endif //_LIBCPP_REFSTRING_H
#ifndef _FOUNDATION_H_ #define _FOUNDATION_H_ #include "CommonAlembic.h" #include <xsi_application.h> #include <xsi_argument.h> #include <xsi_camera.h> #include <xsi_cluster.h> #include <xsi_clusterproperty.h> #include <xsi_comapihandler.h> #include <xsi_command.h> #include <xsi_context.h> #include <xsi_controlpoint.h> #include <xsi_customoperator.h> #include <xsi_customproperty.h> #include <xsi_dataarray.h> #include <xsi_dataarray2D.h> #include <xsi_doublearray.h> #include <xsi_expression.h> #include <xsi_facet.h> #include <xsi_factory.h> #include <xsi_geometry.h> #include <xsi_geometryaccessor.h> #include <xsi_hairprimitive.h> #include <xsi_iceattribute.h> #include <xsi_iceattributedataarray.h> #include <xsi_iceattributedataarray2D.h> #include <xsi_icecompoundnode.h> #include <xsi_icenode.h> #include <xsi_icenodedef.h> #include <xsi_icenodeinputport.h> #include <xsi_icetree.h> #include <xsi_inputport.h> #include <xsi_kinematics.h> #include <xsi_kinematicstate.h> #include <xsi_knot.h> #include <xsi_material.h> #include <xsi_materiallibrary.h> #include <xsi_math.h> #include <xsi_menu.h> #include <xsi_model.h> #include <xsi_null.h> #include <xsi_nurbscurve.h> #include <xsi_nurbscurvelist.h> #include <xsi_nurbssurface.h> #include <xsi_nurbssurfacemesh.h> #include <xsi_operator.h> #include <xsi_operatorcontext.h> #include <xsi_outputport.h> #include <xsi_parameter.h> #include <xsi_pass.h> #include <xsi_plugin.h> #include <xsi_pluginregistrar.h> #include <xsi_point.h> #include <xsi_polygonface.h> #include <xsi_polygonmesh.h> #include <xsi_ppgeventcontext.h> #include <xsi_ppgitem.h> #include <xsi_ppglayout.h> #include <xsi_primitive.h> #include <xsi_progressbar.h> #include <xsi_project.h> #include <xsi_property.h> #include <xsi_ref.h> #include <xsi_renderhairaccessor.h> #include <xsi_sample.h> #include <xsi_scene.h> #include <xsi_selection.h> #include <xsi_shape.h> #include <xsi_shapekey.h> #include <xsi_status.h> #include <xsi_time.h> #include <xsi_uitoolkit.h> #include <xsi_utils.h> #include <xsi_value.h> #include <xsi_vertex.h> #include <xsi_x3dobject.h> #include "AlembicArchiveStorage.h" #include "Utility.h" #endif // _FOUNDATION_H_
/***************************************************************************** Copyright (c) 2014, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function dlapmt * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_dlapmt( int matrix_layout, lapack_logical forwrd, lapack_int m, lapack_int n, double* x, lapack_int ldx, lapack_int* k ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dlapmt", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_dge_nancheck( matrix_layout, m, n, x, ldx ) ) { return -5; } } #endif return LAPACKE_dlapmt_work( matrix_layout, forwrd, m, n, x, ldx, k ); }
/** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2015 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ #ifndef XENIA_CPU_STACK_WALKER_H_ #define XENIA_CPU_STACK_WALKER_H_ #include <memory> #include <string> #include "xenia/base/x64_context.h" #include "xenia/cpu/function.h" namespace xe { namespace cpu { namespace backend { class CodeCache; } // namespace backend } // namespace cpu } // namespace xe namespace xe { namespace cpu { struct StackFrame { enum class Type { // Host frame, likely in kernel or emulator code. kHost, // Guest frame, somewhere in PPC code. kGuest, }; Type type; // Always valid, indicating the address in a backend-defined range. uint64_t host_pc; // Only valid for kGuest frames, indicating the PPC address. uint32_t guest_pc; union { // Contains symbol information for kHost frames. struct { // TODO(benvanik): better name, displacement, etc. uint64_t address; char name[256]; } host_symbol; // Contains symbol information for kGuest frames. struct { Function* function; } guest_symbol; }; }; class StackWalker { public: // Creates a stack walker. Only one should exist within a process. static std::unique_ptr<StackWalker> Create(backend::CodeCache* code_cache); // Dumps all thread stacks to the log. void Dump(); // Captures up to the given number of stack frames from the current thread. // Use ResolveStackTrace to populate additional information. // Returns the number of frames captured, or 0 if an error occurred. // Optionally provides a hash value for the stack that can be used for // deduping. virtual size_t CaptureStackTrace(uint64_t* frame_host_pcs, size_t frame_offset, size_t frame_count, uint64_t* out_stack_hash = nullptr) = 0; // Captures up to the given number of stack frames from the given thread, // referenced by native thread handle. The thread must be suspended. // This does not populate any information other than host_pc. // Use ResolveStackTrace to populate additional information. // Returns the number of frames captured, or 0 if an error occurred. // Optionally provides a hash value for the stack that can be used for // deduping. virtual size_t CaptureStackTrace(void* thread_handle, uint64_t* frame_host_pcs, size_t frame_offset, size_t frame_count, const X64Context* in_host_context, X64Context* out_host_context, uint64_t* out_stack_hash = nullptr) = 0; // Resolves symbol information for the given stack frames. // Each frame provided must have host_pc set, and all other fields will be // populated. virtual bool ResolveStack(uint64_t* frame_host_pcs, StackFrame* frames, size_t frame_count) = 0; }; } // namespace cpu } // namespace xe #endif // XENIA_CPU_STACK_WALKER_H_
// // SKFontWell.h // Skim // // Created by Christiaan Hofman on 4/13/08. /* This software is Copyright (c) 2008-2015 Christiaan Hofman. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Christiaan Hofman nor the names of any 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. */ #import <Cocoa/Cocoa.h> @interface SKFontWell : NSButton { id target; SEL action; NSMutableDictionary *bindingInfo; } @property (nonatomic) BOOL isActive; @property (nonatomic, copy) NSString *fontName; @property (nonatomic) CGFloat fontSize; @property (nonatomic, copy) NSColor *textColor; @property (nonatomic) BOOL hasTextColor; - (void)activate; - (void)deactivate; - (void)changeFontFromFontManager:(id)sender; - (void)changeAttributesFromFontManager:(id)sender; @end @interface SKFontWellCell : NSButtonCell { NSColor *textColor; BOOL hasTextColor; } @property (nonatomic, copy) NSColor *textColor; @property (nonatomic) BOOL hasTextColor; @end
/* * Copyright (c) 2009 David Conrad <lessen42@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdint.h> #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" #include "libavcodec/avcodec.h" #include "libavcodec/vp3dsp.h" void ff_vp3_idct_put_mmx(uint8_t *dest, ptrdiff_t stride, int16_t *block); void ff_vp3_idct_add_mmx(uint8_t *dest, ptrdiff_t stride, int16_t *block); void ff_vp3_idct_put_sse2(uint8_t *dest, ptrdiff_t stride, int16_t *block); void ff_vp3_idct_add_sse2(uint8_t *dest, ptrdiff_t stride, int16_t *block); void ff_vp3_idct_dc_add_mmxext(uint8_t *dest, ptrdiff_t stride, int16_t *block); void ff_vp3_v_loop_filter_mmxext(uint8_t *src, ptrdiff_t stride, int *bounding_values); void ff_vp3_h_loop_filter_mmxext(uint8_t *src, ptrdiff_t stride, int *bounding_values); void ff_put_vp_no_rnd_pixels8_l2_mmx(uint8_t *dst, const uint8_t *a, const uint8_t *b, ptrdiff_t stride, int h); av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_MMX(cpu_flags)) { c->put_no_rnd_pixels_l2 = ff_put_vp_no_rnd_pixels8_l2_mmx; #if ARCH_X86_32 c->idct_put = ff_vp3_idct_put_mmx; c->idct_add = ff_vp3_idct_add_mmx; #endif } if (EXTERNAL_MMXEXT(cpu_flags)) { c->idct_dc_add = ff_vp3_idct_dc_add_mmxext; if (!(flags & AV_CODEC_FLAG_BITEXACT)) { c->v_loop_filter = c->v_loop_filter_unaligned = ff_vp3_v_loop_filter_mmxext; c->h_loop_filter = c->v_loop_filter_unaligned = ff_vp3_h_loop_filter_mmxext; } } if (EXTERNAL_SSE2(cpu_flags)) { c->idct_put = ff_vp3_idct_put_sse2; c->idct_add = ff_vp3_idct_add_sse2; } }
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include <berryQtWorkbenchAdvisor.h> /** * \brief A WorkbenchAdvisor class for the custom viewer plug-in. * * This WorkbenchAdvisor class for the custom viewer plug-in adds and sets a Qt-Stylesheet * file to the berry::QtStyleManager during the initialization phase for customization purpose. */ // //! [WorkbenchAdvisorDecl] class CustomViewerWorkbenchAdvisor : public berry::QtWorkbenchAdvisor // //! [WorkbenchAdvisorDecl] { public: /** * Holds the ID-String of the initial window perspective. */ static const std::string DEFAULT_PERSPECTIVE_ID; berry::WorkbenchWindowAdvisor* CreateWorkbenchWindowAdvisor(berry::IWorkbenchWindowConfigurer::Pointer); ~CustomViewerWorkbenchAdvisor(); /** * Gets the style manager (berry::IQtStyleManager), adds and initializes a Qt-Stylesheet-File (.qss). */ void Initialize(berry::IWorkbenchConfigurer::Pointer); /** * Returns the ID-String of the initial window perspective. */ std::string GetInitialWindowPerspectiveId(); private: QScopedPointer<berry::WorkbenchWindowAdvisor> wwAdvisor; };
#ifndef org_apache_lucene_search_grouping_AbstractFirstPassGroupingCollector_H #define org_apache_lucene_search_grouping_AbstractFirstPassGroupingCollector_H #include "org/apache/lucene/search/Collector.h" namespace org { namespace apache { namespace lucene { namespace index { class AtomicReaderContext; } namespace search { class Sort; class Scorer; namespace grouping { class SearchGroup; } } } } } namespace java { namespace lang { class Class; } namespace util { class Collection; } namespace io { class IOException; } } template<class T> class JArray; namespace org { namespace apache { namespace lucene { namespace search { namespace grouping { class AbstractFirstPassGroupingCollector : public ::org::apache::lucene::search::Collector { public: enum { mid_init$_d50ac7b4, mid_acceptsDocsOutOfOrder_54c6a16a, mid_collect_39c7bd3c, mid_getTopGroups_1d16f88d, mid_setNextReader_a6f59947, mid_setScorer_8be0880c, mid_getDocGroupValue_29be6a55, mid_copyDocGroupValue_537d5bdf, max_mid }; static ::java::lang::Class *class$; static jmethodID *mids$; static bool live$; static jclass initializeClass(bool); explicit AbstractFirstPassGroupingCollector(jobject obj) : ::org::apache::lucene::search::Collector(obj) { if (obj != NULL) env->getClass(initializeClass); } AbstractFirstPassGroupingCollector(const AbstractFirstPassGroupingCollector& obj) : ::org::apache::lucene::search::Collector(obj) {} AbstractFirstPassGroupingCollector(const ::org::apache::lucene::search::Sort &, jint); jboolean acceptsDocsOutOfOrder() const; void collect(jint) const; ::java::util::Collection getTopGroups(jint, jboolean) const; void setNextReader(const ::org::apache::lucene::index::AtomicReaderContext &) const; void setScorer(const ::org::apache::lucene::search::Scorer &) const; }; } } } } } #include <Python.h> namespace org { namespace apache { namespace lucene { namespace search { namespace grouping { extern PyTypeObject PY_TYPE(AbstractFirstPassGroupingCollector); class t_AbstractFirstPassGroupingCollector { public: PyObject_HEAD AbstractFirstPassGroupingCollector object; PyTypeObject *parameters[1]; static PyTypeObject **parameters_(t_AbstractFirstPassGroupingCollector *self) { return (PyTypeObject **) &(self->parameters); } static PyObject *wrap_Object(const AbstractFirstPassGroupingCollector&); static PyObject *wrap_jobject(const jobject&); static PyObject *wrap_Object(const AbstractFirstPassGroupingCollector&, PyTypeObject *); static PyObject *wrap_jobject(const jobject&, PyTypeObject *); static void install(PyObject *module); static void initialize(PyObject *module); }; } } } } } #endif
/* W3C Sample Code Library libwww Dynamic Memory Handlers ! Dynamic Memory Handlers ! */ /* ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. */ /* This module defines any memory handler to be used by libwww for allocating and de-allocating dynamic memory. As dynamic memory may be a scarce resource, it is required that an application can handle memory exhaustion gracefully. This module provides an interface that covers the following situations: o Handling of allocation, reallocation and de-allocation of dynamic memory o Recovering from temporary lack of available memory o Panic handling in case a new allocation fails Note: The Library core provides a default set of memory handlers for allocating and de-allocating dynamic memory. In order to maintain a reasonable performance, they are not registered dynamically but assigned using C style macros. Hence, it is not possible to swap memory handler at run time but this was considered to be a reasonable trade-off. This module is implemented by HTMemory.c, and it is a part of the W3C Sample Code Library. */ #ifndef HTMEMORY_H #define HTMEMORY_H #include "HTUtils.h" /* . Allocation, Reallocation and De-allocation . The Library provides a default set of methods for handling dynamic memory. They are very basic and essentially identical to the C style malloc, calloc, realloc, and free: */ extern void* HTMemory_malloc(size_t size); extern void* HTMemory_calloc(size_t count, size_t size); extern void* HTMemory_realloc(void * ptr, size_t size); extern void HTMemory_free(void* ptr); /* ( Memory Macros ) The methods above are not referred directly in the Library. Instead we use a set of C style macros. If you don't wany any memory management beyond normal malloc and alloc then you can just use that instead of the HTMemory_* function. You can of course also provide your own methods as well. */ #define HT_MALLOC(size) HTMemory_malloc((size)) #define HT_CALLOC(count, size) HTMemory_calloc((count), (size)) #define HT_REALLOC(ptr, size) HTMemory_realloc((ptr), (size)) #define HT_FREE(pointer) {HTMemory_free((pointer));((pointer))=NULL;} /* . Memory Freer Functions . The dynamic memory freer functions are typically functions that are capable of freeing large chunks of memory. In case a new allocation fails, the allocation method looks for any registered freer functions to call. There can be multiple freer functions and after each call, the allocation method tries again to allocate the desired amount of dynamic memory. The freer functions are called in reverse order meaning that the last one registered gets called first. That way, it is easy to add temporary freer functions which then are guaranteed to be called first if a methods fails. ( Add a Freer Function ) You can add a freer function by using the following method. The Library may itself register a set of free functions during initialization. If the application does not register any freer functions then the Library looks how it can free internal memory. The freer function is passed the total number of bytes requested by the allocation. */ typedef void HTMemoryCallback(size_t size); extern BOOL HTMemoryCall_add (HTMemoryCallback * cbf); /* ( Delete a Freer Function ) Freer functions can be deleted at any time in which case they are not called anymore. */ extern BOOL HTMemoryCall_delete (HTMemoryCallback * cbf); extern BOOL HTMemoryCall_deleteAll (void); /* . Panic Handling . If the freer functions are not capable of de-allocation enough memory then the application must have an organized way of closing down. This is done using the panic handler. In the libwww, each allocation is tested and HT_OUTOFMEM is called if a NULL was returned. HT_OUTOFMEM is a macro which by default calls HTMemory_outofmem() but of course can point to any method. The default handler calls an exit function defined by the application in a call to HTMemory_setExit(). If the application has not defined an exit function, HTMemory_outofmem() prints an error message and calls exit(1). */ typedef void HTMemory_exitCallback(char *name, char *file, unsigned long line); extern void HTMemory_setExit(HTMemory_exitCallback * pExit); extern HTMemory_exitCallback * HTMemory_exit(void); /* ( Call the Exit Handler ) If an allocation fails then this function is called. If the application has registered its own panic handler then this is called directly from this function. Otherwise, the default behavior is to write a small message to stderr and then exit. */ #define outofmem(file, name) HT_OUTOFMEM(name) #define HT_OUTOFMEM(name) HTMemory_outofmem((name), __FILE__, __LINE__) extern void HTMemory_outofmem(char * name, char * file, unsigned long line); /* */ #endif /* HTMEMORY_H */ /* @(#) $Id: HTMemory.html,v 2.12 1998/05/14 02:10:45 frystyk Exp $ */
/* * Copyright 2019 Google * * 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/LICENSE2.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 "FirebaseAuth/Sources/Backend/FIRAuthRPCRequest.h" #import "FirebaseAuth/Sources/Backend/FIRIdentityToolkitRequest.h" NS_ASSUME_NONNULL_BEGIN @interface FIRWithdrawMFARequest : FIRIdentityToolkitRequest <FIRAuthRPCRequest> @property(nonatomic, copy, readonly, nullable) NSString *IDToken; @property(nonatomic, copy, readonly, nullable) NSString *MFAEnrollmentID; - (nullable instancetype)initWithIDToken:(NSString *)IDToken MFAEnrollmentID:(NSString *)MFAEnrollmentID requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration; @end NS_ASSUME_NONNULL_END
#include <sys/types.h> #include <libproc.h> #include <mach/mach.h> #include <mach/mach_vm.h> #include "mach_exc.h" #include "exc.h" #ifdef mig_external mig_external #else extern #endif /* mig_external */ boolean_t exc_server( mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); #ifdef mig_external mig_external #else extern #endif /* mig_external */ boolean_t mach_exc_server( mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); kern_return_t acquire_mach_task(int, mach_port_name_t*, mach_port_t*, mach_port_t*, mach_port_t*); char * find_executable(int pid); kern_return_t get_threads(task_t task, void *); int thread_count(task_t task); mach_port_t mach_port_wait(mach_port_t); kern_return_t raise_exception(mach_port_t, mach_port_t, mach_port_t, exception_type_t);
/*************************************************************************/ /* audio_stream_ogg_vorbis.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2019 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 AUDIO_STREAM_STB_VORBIS_H #define AUDIO_STREAM_STB_VORBIS_H #include "core/io/resource_loader.h" #include "servers/audio/audio_stream.h" #include "thirdparty/misc/stb_vorbis.h" class AudioStreamOGGVorbis; class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled { GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled) stb_vorbis *ogg_stream; stb_vorbis_alloc ogg_alloc; uint32_t frames_mixed; bool active; int loops; friend class AudioStreamOGGVorbis; Ref<AudioStreamOGGVorbis> vorbis_stream; protected: virtual void _mix_internal(AudioFrame *p_buffer, int p_frames); virtual float get_stream_sampling_rate(); public: virtual void start(float p_from_pos = 0.0); virtual void stop(); virtual bool is_playing() const; virtual int get_loop_count() const; //times it looped virtual float get_playback_position() const; virtual void seek(float p_time); AudioStreamPlaybackOGGVorbis() {} ~AudioStreamPlaybackOGGVorbis(); }; class AudioStreamOGGVorbis : public AudioStream { GDCLASS(AudioStreamOGGVorbis, AudioStream) OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged RES_BASE_EXTENSION("oggstr"); friend class AudioStreamPlaybackOGGVorbis; void *data; uint32_t data_len; int decode_mem_size; float sample_rate; int channels; float length; bool loop; float loop_offset; void clear_data(); protected: static void _bind_methods(); public: void set_loop(bool p_enable); bool has_loop() const; void set_loop_offset(float p_seconds); float get_loop_offset() const; virtual Ref<AudioStreamPlayback> instance_playback(); virtual String get_stream_name() const; void set_data(const PoolVector<uint8_t> &p_data); PoolVector<uint8_t> get_data() const; virtual float get_length() const; //if supported, otherwise return 0 AudioStreamOGGVorbis(); virtual ~AudioStreamOGGVorbis(); }; #endif
#ifndef POPUPWIDGET_H #define POPUPWIDGET_H #include <QDialog> namespace Ui { class PopupWidget; } class PopupWidget : public QDialog { Q_OBJECT public: explicit PopupWidget(QWidget *parent = 0); ~PopupWidget(); void showText(QString info); protected slots: void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event); private slots: void on_pushButton_clicked(); private: int iXdeffarace = -1; int iYdeffarance = -1; bool b_mousePressed; private: Ui::PopupWidget *ui; }; #endif // POPUPWIDGET_H
/** @file DXE MM Ready To Lock protocol introduced in the PI 1.5 specification. Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _DXE_MM_READY_TO_LOCK_H_ #define _DXE_MM_READY_TO_LOCK_H_ #define EFI_DXE_MM_READY_TO_LOCK_PROTOCOL_GUID \ { \ 0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e } \ } extern EFI_GUID gEfiDxeMmReadyToLockProtocolGuid; #endif
/* * kexec-ppc.c - kexec for the PowerPC * Copyright (C) 2004, 2005 Albert Herranz * * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ #include <stddef.h> #include <stdio.h> #include <errno.h> #include <stdint.h> #include <string.h> #include <getopt.h> #include "../../kexec.h" #include "../../kexec-syscall.h" #include "kexec-ppc.h" #include <arch/options.h> #include "config.h" #define MAX_MEMORY_RANGES 64 static struct memory_range memory_range[MAX_MEMORY_RANGES]; /* Return a sorted list of memory ranges. */ int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long kexec_flags) { #ifdef WITH_GAMECUBE int memory_ranges = 0; /* RAM - lowmem used by DOLs - framebuffer */ memory_range[memory_ranges].start = 0x00003000; memory_range[memory_ranges].end = 0x0174bfff; memory_range[memory_ranges].type = RANGE_RAM; memory_ranges++; *range = memory_range; *ranges = memory_ranges; return 0; #else fprintf(stderr, "%s(): Unsupported platform\n", __func__); return -1; #endif } struct file_type file_type[] = { {"elf-ppc", elf_ppc_probe, elf_ppc_load, elf_ppc_usage}, {"dol-ppc", dol_ppc_probe, dol_ppc_load, dol_ppc_usage}, }; int file_types = sizeof(file_type) / sizeof(file_type[0]); void arch_usage(void) { } int arch_process_options(int argc, char **argv) { static const struct option options[] = { KEXEC_ARCH_OPTIONS { 0, 0, NULL, 0 }, }; static const char short_options[] = KEXEC_ARCH_OPT_STR; int opt; opterr = 0; /* Don't complain about unrecognized options here */ while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { switch(opt) { default: break; } } /* Reset getopt for the next pass; called in other source modules */ opterr = 1; optind = 1; return 0; } const struct arch_map_entry arches[] = { /* For compatibility with older patches * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_PPC here. */ { "ppc", KEXEC_ARCH_DEFAULT }, { 0 }, }; int arch_compat_trampoline(struct kexec_info *info) { return 0; } void arch_update_purgatory(struct kexec_info *info) { } int is_crashkernel_mem_reserved(void) { return 0; /* kdump is not supported on this platform (yet) */ }
/* Public domain. */ #include <stdlib.h> #include "alloc.h" #include "error.h" #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */ #define SPACE 2048 /* must be multiple of ALIGNMENT */ typedef union { char irrelevant[ALIGNMENT]; double d; } aligned; static aligned realspace[SPACE / ALIGNMENT]; #define space ((char *) realspace) static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */ /*@null@*//*@out@*/char *alloc(n) unsigned int n; { char *x; n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */ if (n <= avail) { avail -= n; return space + avail; } x = malloc(n); if (!x) errno = error_nomem; return x; } void alloc_free(x) char *x; { if (x >= space) if (x < space + SPACE) return; /* XXX: assuming that pointers are flat */ free(x); }
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ /* * This file is based on WME Lite. * http://dead-code.org/redir.php?target=wmelite * Copyright (c) 2011 Jan Nedoma */ #ifndef WINTERMUTE_BASE_SOUND_H #define WINTERMUTE_BASE_SOUND_H #include "engines/wintermute/base/base.h" #include "engines/wintermute/dctypes.h" // Added by ClassView #include "engines/wintermute/persistent.h" #include "audio/mixer.h" namespace Wintermute { class BaseSoundBuffer; class BaseSound : public BaseClass { public: bool setPan(float pan); int getVolume(); int getVolumePercent(); bool setVolumePercent(int percent); bool setVolume(int volume); bool setPrivateVolume(int volume); bool setLoopStart(uint32 pos); uint32 getPositionTime(); bool setPositionTime(uint32 time); bool isPlaying(); bool isPaused(); DECLARE_PERSISTENT(BaseSound, BaseClass) bool resume(); bool pause(bool freezePaused = false); bool stop(); bool play(bool looping = false); uint32 getLength(); const char *getFilename() { return _soundFilename.c_str(); } bool setSoundSimple(); bool setSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); BaseSound(BaseGame *inGame); virtual ~BaseSound(); bool applyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0); private: Common::String _soundFilename; bool _soundStreamed; Audio::Mixer::SoundType _soundType; int32 _soundPrivateVolume; uint32 _soundLoopStart; uint32 _soundPosition; bool _soundPlaying; bool _soundLooping; bool _soundPaused; bool _soundFreezePaused; TSFXType _sFXType; float _sFXParam1; float _sFXParam2; float _sFXParam3; float _sFXParam4; BaseSoundBuffer *_sound; }; } // end of namespace Wintermute #endif
/*---------------------------------------------------------------------- PuReMD - Purdue ReaxFF Molecular Dynamics Program Copyright (2010) Purdue University Hasan Metin Aktulga, hmaktulga@lbl.gov Joseph Fogarty, jcfogart@mail.usf.edu Sagar Pandit, pandit@usf.edu Ananth Y Grama, ayg@cs.purdue.edu Please cite the related publication: H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama, "Parallel Reactive Molecular Dynamics: Numerical Methods and Algorithmic Techniques", Parallel Computing, in press. 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: <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------*/ #ifndef __VECTOR_H_ #define __VECTOR_H_ #include "reaxc_types.h" void rvec_Copy( rvec, rvec ); void rvec_Scale( rvec, double, rvec ); void rvec_Add( rvec, rvec ); void rvec_ScaledAdd( rvec, double, rvec ); void rvec_ScaledSum( rvec, double, rvec, double, rvec ); double rvec_Dot( rvec, rvec ); void rvec_iMultiply( rvec, ivec, rvec ); void rvec_Cross( rvec, rvec, rvec ); double rvec_Norm_Sqr( rvec ); double rvec_Norm( rvec ); void rvec_MakeZero( rvec ); void rvec_Random( rvec ); void rtensor_MakeZero( rtensor ); void rtensor_MatVec( rvec, rtensor, rvec ); void ivec_MakeZero( ivec ); void ivec_Copy( ivec, ivec ); void ivec_Scale( ivec, double, ivec ); void ivec_Sum( ivec, ivec, ivec ); #endif
/* Public partial symbol table definitions. Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PSYMTAB_H #define PSYMTAB_H /* A bcache for partial symbols. */ struct psymbol_bcache; extern struct psymbol_bcache *psymbol_bcache_init (void); extern void psymbol_bcache_free (struct psymbol_bcache *); extern struct bcache *psymbol_bcache_get_bcache (struct psymbol_bcache *); void expand_partial_symbol_names (int (*fun) (const char *, void *), void *data); void map_partial_symbol_filenames (void (*) (const char *, const char *, void *), void *); extern const struct quick_symbol_functions psym_functions; extern const struct quick_symbol_functions dwarf2_gdb_index_functions; /* Ensure that the partial symbols for OBJFILE have been loaded. If VERBOSE is non-zero, then this will print a message when symbols are loaded. This function always returns its argument, as a convenience. */ extern struct objfile *require_partial_symbols (struct objfile *objfile, int verbose); #endif /* PSYMTAB_H */
#include <endian.h> #include <stdlib.h> int abs(int i) { return i>=0?i:-i; } #if __WORDSIZE == 32 long labs(long i) __attribute__((alias("abs"))); #endif
#ifndef XMLDOCUMENT_H_ #define XMLDOCUMENT_H_ #include "core/XMLElement.h" #include <string> class XMLDocument { public: virtual ~XMLDocument(); /** create a XMLDocument * @return A pointer the XMLDocument representing the parsed file */ static XMLDocument* parse_file(const std::string& fileName); /** Return the root node. * @return A pointer to the root node if it exists, NULL otherwise. */ XMLElement* getRootNode() const; private: // hide the c'tor to create instances of this object only with parse_file XMLDocument(xmlDocPtr doc); xmlDocPtr xmlDocument; xmlNodePtr xmlRootNode; struct Initializer { Initializer(); }; static Initializer init; }; #endif /*XMLDOCUMENT_H_*/
/* This file is part of the libdepixelize project Copyright (C) 2013 Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com> GNU Lesser General Public License Usage 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. 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/>. GNU General Public License Usage Alternatively, this library may be used 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. You should have received a copy of the GNU General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. 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. */ #ifndef LIBDEPIXELIZE_TRACER_SPLINES_H #define LIBDEPIXELIZE_TRACER_SPLINES_H #include <2geom/pathvector.h> #include <glib.h> namespace Tracer { template<typename T, bool adjust_splines = true> class SimplifiedVoronoi; template<typename T> class HomogeneousSplines; class Splines { public: struct Path { /** * It may be benefited from C++11 move references. */ Geom::PathVector pathVector; guint8 rgba[4]; }; typedef std::vector<Path>::iterator iterator; typedef std::vector<Path>::const_iterator const_iterator; Splines() /* = default */ {} template<typename T, bool adjust_splines> Splines(const SimplifiedVoronoi<T, adjust_splines> &simplifiedVoronoi); /** * There are two levels of optimization. The first level only removes * redundant points of colinear points. The second level uses the * Kopf-Lischinski optimization. The first level is always enabled. * The second level is enabled using \p optimize. */ template<typename T> Splines(const HomogeneousSplines<T> &homogeneousSplines, bool optimize, int nthreads); // Iterators iterator begin() { return _paths.begin(); } const_iterator begin() const { return _paths.begin(); } iterator end() { return _paths.end(); } const_iterator end() const { return _paths.end(); } int width() const { return _width; } int height() const { return _height; } private: std::vector<Path> _paths; int _width; int _height; }; } // namespace Tracer #endif // LIBDEPIXELIZE_TRACER_SPLINES_H /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
/* * Soft: Keepalived is a failover program for the LVS project * <www.linuxvirtualserver.org>. It monitor & manipulate * a loadbalanced server pool using multi-layer checks. * * Part: TCP checker. * * Author: Alexandre Cassen, <acassen@linux-vs.org> * * 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. * * 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. * * Copyright (C) 2001-2011 Alexandre Cassen, <acassen@linux-vs.org> */ #include "check_tcp.h" #include "check_api.h" #include "memory.h" #include "ipwrapper.h" #include "layer4.h" #include "logger.h" #include "smtp.h" #include "utils.h" #include "parser.h" int tcp_connect_thread(thread_t *); /* Configuration stream handling */ void free_tcp_check(void *data) { tcp_checker_t *tcp_chk = CHECKER_DATA(data); FREE(tcp_chk); FREE(data); } void dump_tcp_check(void *data) { tcp_checker_t *tcp_chk = CHECKER_DATA(data); log_message(LOG_INFO, " Keepalive method = TCP_CHECK"); log_message(LOG_INFO, " Connection port = %d", ntohs(inet_sockaddrport(&tcp_chk->dst))); if (tcp_chk->bindto.ss_family) log_message(LOG_INFO, " Bind to = %s", inet_sockaddrtos(&tcp_chk->bindto)); log_message(LOG_INFO, " Connection timeout = %d", tcp_chk->connection_to/TIMER_HZ); } void tcp_check_handler(vector strvec) { tcp_checker_t *tcp_chk = (tcp_checker_t *) MALLOC(sizeof (tcp_checker_t)); /* queue new checker */ checker_set_dst(&tcp_chk->dst); queue_checker(free_tcp_check, dump_tcp_check, tcp_connect_thread, tcp_chk); } void connect_port_handler(vector strvec) { tcp_checker_t *tcp_chk = CHECKER_GET(); checker_set_dst_port(&tcp_chk->dst, htons(CHECKER_VALUE_INT(strvec))); } void bind_handler(vector strvec) { tcp_checker_t *tcp_chk = CHECKER_GET(); inet_stosockaddr(VECTOR_SLOT(strvec, 1), 0, &tcp_chk->bindto); } void connect_timeout_handler(vector strvec) { tcp_checker_t *tcp_chk = CHECKER_GET(); tcp_chk->connection_to = CHECKER_VALUE_INT(strvec) * TIMER_HZ; } void install_tcp_check_keyword(void) { install_keyword("TCP_CHECK", &tcp_check_handler); install_sublevel(); install_keyword("connect_port", &connect_port_handler); install_keyword("bindto", &bind_handler); install_keyword("connect_timeout", &connect_timeout_handler); install_sublevel_end(); } int tcp_check_thread(thread_t * thread) { checker_t *checker; tcp_checker_t *tcp_check; int status; checker = THREAD_ARG(thread); tcp_check = CHECKER_ARG(checker); status = tcp_socket_state(thread->u.fd, thread, tcp_check_thread); /* If status = connect_success, TCP connection to remote host is established. * Otherwise we have a real connection error or connection timeout. */ if (status == connect_success) { close(thread->u.fd); if (!svr_checker_up(checker->id, checker->rs)) { log_message(LOG_INFO, "TCP connection to [%s]:%d success." , inet_sockaddrtos(&tcp_check->dst) , ntohs(inet_sockaddrport(&tcp_check->dst))); smtp_alert(checker->rs, NULL, NULL, "UP", "=> TCP CHECK succeed on service <="); update_svr_checker_state(UP, checker->id , checker->vs , checker->rs); } } else { if (svr_checker_up(checker->id, checker->rs)) { log_message(LOG_INFO, "TCP connection to [%s]:%d failed !!!" , inet_sockaddrtos(&tcp_check->dst) , ntohs(inet_sockaddrport(&tcp_check->dst))); smtp_alert(checker->rs, NULL, NULL, "DOWN", "=> TCP CHECK failed on service <="); update_svr_checker_state(DOWN, checker->id , checker->vs , checker->rs); } } /* Register next timer checker */ if (status != connect_in_progress) thread_add_timer(thread->master, tcp_connect_thread, checker, checker->vs->delay_loop); return 0; } int tcp_connect_thread(thread_t * thread) { checker_t *checker = THREAD_ARG(thread); tcp_checker_t *tcp_check = CHECKER_ARG(checker); int fd; int status; /* * Register a new checker thread & return * if checker is disabled */ if (!CHECKER_ENABLED(checker)) { thread_add_timer(thread->master, tcp_connect_thread, checker, checker->vs->delay_loop); return 0; } if ((fd = socket(tcp_check->dst.ss_family, SOCK_STREAM, IPPROTO_TCP)) == -1) { DBG("TCP connect fail to create socket."); return 0; } status = tcp_bind_connect(fd, &tcp_check->dst, &tcp_check->bindto); if (status == connect_error) { thread_add_timer(thread->master, tcp_connect_thread, checker, checker->vs->delay_loop); return 0; } /* handle tcp connection status & register check worker thread */ tcp_connection_state(fd, status, thread, tcp_check_thread, tcp_check->connection_to); return 0; }
// -*- C++ -*- /** * \file Bidi.h * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author Dekel Tsur * * Full author contact details are available in file CREDITS. */ #ifndef BIDI_H #define BIDI_H #include "support/types.h" #include <vector> namespace lyx { class Buffer; class Cursor; class Paragraph; class Row; class Font; /// bidi stuff class Bidi { public: /// bool isBoundary(Buffer const &, Paragraph const & par, pos_type pos) const; /// bool isBoundary(Buffer const &, Paragraph const & par, pos_type pos, Font const & font) const; /// pos_type log2vis(pos_type pos) const; /** Maps positions in the logical string to positions * in visual string. */ pos_type vis2log(pos_type pos) const; /// pos_type level(pos_type pos) const; /// bool inRange(pos_type pos) const; /// same_direction? bool same_direction() const; /// void computeTables(Paragraph const & par, Buffer const &, Row const & row); private: /// bool same_direction_; /// std::vector<pos_type> log2vis_list_; /** Maps positions in the visual string to positions * in logical string. */ std::vector<pos_type> vis2log_list_; /// std::vector<pos_type> levels_; /// pos_type start_; /// pos_type end_; }; /// Should interpretation of the arrow keys be reversed? bool reverseDirectionNeeded(Cursor const & cur); /// Is current paragraph in RTL mode? bool isWithinRtlParagraph(Cursor const & cur); } // namespace lyx #endif // BIDI_H
#include "tools.h" static gboolean opt_force; static GOptionEntry entries[] = { //{ "force", 'f', 0, G_OPTION_ARG_NONE, &opt_force, "Overwrite files", NULL }, { NULL } }; int main(int ac, char* av[]) { gc_error_free GError *local_err = NULL; mega_session* s; tool_init(&ac, &av, "- move files on the remote filesystem at mega.co.nz", entries); if (ac < 3) { g_printerr("ERROR: You must specify both source path(s) and destination path"); return 1; } s = tool_start_session(); if (!s) return 1; gboolean rename = FALSE; gc_free gchar* dest = tool_convert_filename(av[ac - 1], FALSE); // check destination path mega_node* destination = mega_session_stat(s, dest); if (destination) { if (destination->type == MEGA_NODE_FILE) { gc_free gchar* path = mega_node_get_path_dup(destination); g_printerr("Destination file already exists: %s", path); goto err; } if (!mega_node_is_writable(s, destination) || destination->type == MEGA_NODE_NETWORK || destination->type == MEGA_NODE_CONTACT) { gc_free gchar* path = mega_node_get_path_dup(destination); g_printerr("You can't move files into: %s", path); goto err; } } else { rename = TRUE; gc_free gchar* parent_path = g_path_get_dirname(dest); destination = mega_session_stat(s, parent_path); if (!destination) { g_printerr("Destination directory doesn't exist: %s", parent_path); goto err; } if (destination->type == MEGA_NODE_FILE) { gc_free gchar* path = mega_node_get_path_dup(destination); g_printerr("Destination is not directory: %s", path); goto err; } if (!mega_node_is_writable(s, destination) || destination->type == MEGA_NODE_NETWORK || destination->type == MEGA_NODE_CONTACT) { gc_free gchar* path = mega_node_get_path_dup(destination); g_printerr("You can't move files into: %s", path); goto err; } } if (rename && ac > 3) { g_printerr("You can't use multiple source paths when renaming file or directory"); goto err; } // enumerate source paths gint i; for (i = 1; i < ac - 1; i++) { gc_free gchar* path = tool_convert_filename(av[i], FALSE); mega_node* n = mega_session_stat(s, path); if (!n) { g_printerr("Source file doesn't exists: %s", path); goto err; } if (n->type != MEGA_NODE_FILE && n->type != MEGA_NODE_FOLDER) { g_printerr("Source is not movable: %s", path); goto err; } // check destination gc_free gchar* n_path = mega_node_get_path_dup(n); gc_free gchar* destination_path = mega_node_get_path_dup(destination); gc_free gchar* basename = g_path_get_basename(n_path); gc_free gchar* tmp = g_strconcat(destination_path, "/", basename, NULL); // check destination path mega_node* dn = mega_session_stat(s, tmp); if (dn) { gc_free gchar* dn_path = mega_node_get_path_dup(dn); g_printerr("Destination file already exists: %s", dn_path); goto err; } // perform move //if (!mega_session_mkdir(s, path, &local_err)) //{ //g_printerr("ERROR: Can't create directory %s: %s\n", path, local_err->message); //g_clear_error(&local_err); //} g_print("mv %s %s/%s\n", n_path, destination_path, tmp); } mega_session_save(s, NULL); tool_fini(s); return 0; err: tool_fini(s); return 1; }
/* * compression handling for cbfstool * * Copyright (C) 2009 coresystems GmbH * written by Patrick Georgi <patrick.georgi@coresystems.de> * * Adapted from code * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>, released * under identical license terms * * 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 */ #include <string.h> #include <stdio.h> #include "common.h" static int lzma_compress(char *in, int in_len, char *out, int *out_len) { return do_lzma_compress(in, in_len, out, out_len); } static int none_compress(char *in, int in_len, char *out, int *out_len) { memcpy(out, in, in_len); *out_len = in_len; return 0; } comp_func_ptr compression_function(comp_algo algo) { comp_func_ptr compress; switch (algo) { case CBFS_COMPRESS_NONE: compress = none_compress; break; case CBFS_COMPRESS_LZMA: compress = lzma_compress; break; default: ERROR("Unknown compression algorithm %d!\n", algo); return NULL; } return compress; }
#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> #define ERRORS 57 const char *err[57] = { "Success", "Operation not permitted", "No such file or directory", "No such process", "Interrupted system call", "I/O error", "No such device or address", "Arg list too long", "Exec format error", "Bad file number", "No child processes", "Try again", "Out of memory", "Permission denied", "Bad address", "Block device required", "Device or resource busy", "File exists", "Cross-device link", "No such device", "Not a directory", "Is a directory", "Invalid argument", "File table overflow", "Too many open files", "Not a typewriter", "Text file busy", "File too large", "No space left on device", "Illegal seek", "Read-only file system", "Too many links", "Broken pipe", "Math argument out of domain of efunc", "Math result not representable", "Lock table full", "Directory is not empty", "File name too long", "Address family not supported", "Operation already in progress", "Address not available", "Invalid system call number", "Protocol family not supported", "Operation not supported on transport endpoint", "Connection reset by peer", "Network is down", "Message too long", "Connection timed out", "Connection refused", "No route to host", "Host is down", "Network is unreachable", "Transport endpoint is not connected", "Operation is in progress", "Cannot send after transport endpoint shutdown", "Socket is already connected", "No destination address specified" }; static uint8_t buf[16384]; int main(int argc, char *argv[]) { int base = 2 * ERRORS + 2; uint8_t *bp = buf + 2; int swizzle = 0; int i; if (argc > 1 && strcmp(argv[1], "-X") == 0) swizzle = 1; buf[0] = ERRORS; buf[1] = 0; for (i = 0; i < ERRORS; i++) { int len = strlen(err[i]) + 1; if (swizzle) { *bp++ = base >> 8; *bp++ = base & 0xFF; } else { *bp++ = base & 0xFF; *bp++ = base >> 8; } memcpy(buf + base, err[i], len); base += len; } write(1, buf, base); return 0; }
/******************************************************* Copyright (C) 2016 Guan Lisheng (guanlisheng@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 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 ********************************************************/ #pragma once #include "budget.h" #include "budgetcategorysummary.h" #include "budgetingperf.h" #include "cashflow.h" #include "categexp.h" #include "categovertimeperf.h" #include "htmlbuilder.h" #include "incexpenses.h" #include "mmDateRange.h" #include "myusage.h" #include "payee.h" #include "reportbase.h" #include "summary.h" #include "summarystocks.h" #include "transactions.h" #include "forecast.h"
#ifndef ASTROCADE_H #define ASTROCADE_H #define MAX_ASTROCADE_CHIPS 2 /* max number of emulated chips */ struct astrocade_interface { int num; /* total number of sound chips in the machine */ int baseclock; /* astrocade clock rate */ int volume[MAX_ASTROCADE_CHIPS]; /* master volume */ }; int astrocade_sh_start(const struct MachineSound *msound); void astrocade_sh_stop(void); void astrocade_sh_update(void); WRITE_HANDLER( astrocade_sound1_w ); WRITE_HANDLER( astrocade_sound2_w ); #endif
/* * Command line handling of dmidecode * This file is part of the dmidecode project. * * Copyright (C) 2005-2008 Jean Delvare <khali@linux-fr.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ struct string_keyword { const char *keyword; u8 type; u8 offset; }; struct opt { const char *devmem; unsigned int flags; u8 *type; const struct string_keyword *string; char *dumpfile; }; extern struct opt opt; #define FLAG_VERSION (1 << 0) #define FLAG_HELP (1 << 1) #define FLAG_DUMP (1 << 2) #define FLAG_QUIET (1 << 3) #define FLAG_DUMP_BIN (1 << 4) #define FLAG_FROM_DUMP (1 << 5) int parse_command_line(int argc, char * const argv[]); void print_help(void);
/* Multiple versions of modff. Copyright (C) 2013-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/>. */ #include <math.h> #include "init-arch.h" extern __typeof (__modff) __modff_ppc32 attribute_hidden; extern __typeof (__modff) __modff_power5plus attribute_hidden; libc_ifunc (__modff, (hwcap & PPC_FEATURE_POWER5_PLUS) ? __modff_power5plus : __modff_ppc32); weak_alias (__modff, modff)
/** ****************************************************************************** * @file stm32f10x_dbgmcu.h * @author MCD Application Team * @version V3.1.2 * @date 09/28/2009 * @brief This file contains all the functions prototypes for the DBGMCU * firmware library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_DBGMCU_H #define __STM32F10x_DBGMCU_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup STM32F10x_StdPeriph_Driver * @{ */ /** @addtogroup DBGMCU * @{ */ /** @defgroup DBGMCU_Exported_Types * @{ */ /** * @} */ /** @defgroup DBGMCU_Exported_Constants * @{ */ #define DBGMCU_SLEEP ((uint32_t)0x00000001) #define DBGMCU_STOP ((uint32_t)0x00000002) #define DBGMCU_STANDBY ((uint32_t)0x00000004) #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFC000F8) == 0x00) && ((PERIPH) != 0x00)) /** * @} */ /** @defgroup DBGMCU_Exported_Macros * @{ */ /** * @} */ /** @defgroup DBGMCU_Exported_Functions * @{ */ uint32_t DBGMCU_GetREVID(void); uint32_t DBGMCU_GetDEVID(void); void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); #ifdef __cplusplus } #endif #endif /* __STM32F10x_DBGMCU_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
/* 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 <http://www.gnu.org/licenses/>. */ #ifndef Process_H #define Process_H #include "memory/Allocator.h" #include "util/Linker.h" Linker_require("util/events/libuv/Process.c"); #include <stdint.h> typedef void (* Process_OnExitCallback)(int64_t exit_status, int term_signal); /** * Spawn a new process. * * @param binaryPath the path to the file to execute. * @param args a list of strings representing the arguments to the command followed by NULL. * @param base the event base. * @param alloc an allocator. The process to be killed when it is freed. * @param callback a function to be called when the spawn process exits. * @return 0 if all went well, -1 if forking fails. */ int Process_spawn(char* binaryPath, char** args, struct EventBase* base, struct Allocator* alloc, Process_OnExitCallback callback); /** * Get the path to the binary of the current process. * * @param alloc an allocator. * @return the binary path to the process or null if there was a failure. */ char* Process_getPath(struct Allocator* alloc); #endif
// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com> // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_SVD3X3_SSE_H #define IGL_SVD3X3_SSE_H #include "igl_inline.h" #include <Eigen/Dense> namespace igl { // Super fast 3x3 SVD according to http://pages.cs.wisc.edu/~sifakis/project_pages/svd.html // This is SSE version of svd3x3 (see svd3x3.h) which works on 4 matrices at a time // These four matrices are simply stacked in columns, the rest is the same as for svd3x3 // // Inputs: // A 12 by 3 stack of 3x3 matrices // Outputs: // U 12x3 left singular vectors stacked // S 12x1 singular values stacked // V 12x3 right singular vectors stacked // // Known bugs: this will not work correctly for double precision. template<typename T> IGL_INLINE void svd3x3_sse( const Eigen::Matrix<T, 3*4, 3>& A, Eigen::Matrix<T, 3*4, 3> &U, Eigen::Matrix<T, 3*4, 1> &S, Eigen::Matrix<T, 3*4, 3>&V); } #ifndef IGL_STATIC_LIBRARY # include "svd3x3_sse.cpp" #endif #endif
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2013 - Raw Material Software Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ #ifndef JUCE_DRAGGABLE3DORIENTATION_H_INCLUDED #define JUCE_DRAGGABLE3DORIENTATION_H_INCLUDED //============================================================================== /** Stores a 3D orientation, which can be rotated by dragging with the mouse. */ class Draggable3DOrientation { public: typedef Vector3D<GLfloat> VectorType; typedef Quaternion<GLfloat> QuaternionType; /** Creates a Draggable3DOrientation, initially set up to be aligned along the X axis. */ Draggable3DOrientation (float objectRadius = 0.5f) noexcept : radius (jmax (0.1f, objectRadius)), quaternion (VectorType::xAxis(), 0) { } /** Creates a Draggable3DOrientation from a user-supplied quaternion. */ Draggable3DOrientation (const Quaternion<GLfloat>& quaternionToUse, float objectRadius = 0.5f) noexcept : radius (jmax (0.1f, objectRadius)), quaternion (quaternionToUse) { } /** Resets the orientation, specifying the axis to align it along. */ void reset (const VectorType& axis) noexcept { quaternion = QuaternionType (axis, 0); } /** Sets the viewport area within which mouse-drag positions will occur. You'll need to set this rectangle before calling mouseDown. The centre of the rectangle is assumed to be the centre of the object that will be rotated, and the size of the rectangle will be used to scale the object radius - see setRadius(). */ void setViewport (const Rectangle<int>& newArea) noexcept { area = newArea; } /** Sets the size of the rotated object, as a proportion of the viewport's size. @see setViewport */ void setRadius (float newRadius) noexcept { radius = jmax (0.1f, newRadius); } /** Begins a mouse-drag operation. You must call this before any calls to mouseDrag(). The position that is supplied will be treated as being relative to the centre of the rectangle passed to setViewport(). */ template <typename Type> void mouseDown (Point<Type> mousePos) noexcept { lastMouse = mousePosToProportion (mousePos.toFloat()); } /** Continues a mouse-drag operation. After calling mouseDown() to begin a drag sequence, you can call this method to continue it. */ template <typename Type> void mouseDrag (Point<Type> mousePos) noexcept { const VectorType oldPos (projectOnSphere (lastMouse)); lastMouse = mousePosToProportion (mousePos.toFloat()); const VectorType newPos (projectOnSphere (lastMouse)); quaternion *= rotationFromMove (oldPos, newPos); } /** Returns the matrix that should be used to apply the current orientation. @see applyToOpenGLMatrix */ Matrix3D<GLfloat> getRotationMatrix() const noexcept { return quaternion.getRotationMatrix(); } /** Provides direct access to the quaternion. */ QuaternionType& getQuaternion() noexcept { return quaternion; } private: Rectangle<int> area; float radius; QuaternionType quaternion; Point<float> lastMouse; Point<float> mousePosToProportion (const Point<float> mousePos) const noexcept { const int scale = (jmin (area.getWidth(), area.getHeight()) / 2); // You must call setViewport() to give this object a valid window size before // calling any of the mouse input methods! jassert (scale > 0); return Point<float> ((mousePos.x - area.getCentreX()) / scale, (area.getCentreY() - mousePos.y) / scale); } VectorType projectOnSphere (const Point<float> pos) const noexcept { const GLfloat radiusSquared = radius * radius; const GLfloat xySquared = pos.x * pos.x + pos.y * pos.y; return VectorType (pos.x, pos.y, xySquared < radiusSquared * 0.5f ? std::sqrt (radiusSquared - xySquared) : (radiusSquared / (2.0f * std::sqrt (xySquared)))); } QuaternionType rotationFromMove (const VectorType& from, const VectorType& to) const noexcept { VectorType rotationAxis (to ^ from); if (rotationAxis.lengthIsBelowEpsilon()) rotationAxis = VectorType::xAxis(); const GLfloat d = jlimit (-1.0f, 1.0f, (from - to).length() / (2.0f * radius)); return QuaternionType::fromAngle (2.0f * std::asin (d), rotationAxis); } }; #endif // JUCE_DRAGGABLE3DORIENTATION_H_INCLUDED
#include "f2c.h" #ifdef KR_headers extern double exp(), cos(), sin(); VOID c_exp(r, z) complex *r, *z; #else #undef abs #include "math.h" void c_exp(complex *r, complex *z) #endif { double expx; expx = exp(z->r); r->r = expx * cos(z->i); r->i = expx * sin(z->i); }
/*========================================================================= * * 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 GDCMNETWORKSTATEID_H #define GDCMNETWORKSTATEID_H namespace gdcm { namespace network { /** * Each network connection will be in a particular state at any given time. * Those states have IDs as described in the standard ps3.8-2009, roughly 1-13. * This enumeration lists those states. The actual ULState class will contain more information * about transitions to other states. * * name and date: 16 sept 2010 mmr */ enum EStateID { eStaDoesNotExist = 0, eSta1Idle = 1, eSta2Open = 2, eSta3WaitLocalAssoc = 4, eSta4LocalAssocDone = 8, eSta5WaitRemoteAssoc = 16, eSta6TransferReady = 32, eSta7WaitRelease = 64, eSta8WaitLocalRelease = 128, eSta9ReleaseCollisionRqLocal = 256, eSta10ReleaseCollisionAc = 512, eSta11ReleaseCollisionRq = 1024, eSta12ReleaseCollisionAcLocal = 2048, eSta13AwaitingClose = 4096 }; const int cMaxStateID = 13; //the transition table is built on state indices //this function will produce the index from the power-of-two EStateID inline int GetStateIndex(EStateID inState){ switch (inState){ case eStaDoesNotExist: default: return -1; case eSta1Idle: return 0; case eSta2Open: return 1; case eSta3WaitLocalAssoc: return 2; case eSta4LocalAssocDone: return 3; case eSta5WaitRemoteAssoc: return 4; case eSta6TransferReady: return 5; case eSta7WaitRelease: return 6; case eSta8WaitLocalRelease: return 7; case eSta9ReleaseCollisionRqLocal: return 8; case eSta10ReleaseCollisionAc: return 9; case eSta11ReleaseCollisionRq: return 10; case eSta12ReleaseCollisionAcLocal: return 11; case eSta13AwaitingClose: return 12; } } } } #endif //GDCMNETWORKSTATEID_H
/** @addtogroup pwr_file * * @author @htmlonly &copy; @endhtmlonly 2012 Karl Palsson <karlp@tweak.net.au> */ /* * This file is part of the libopencm3 project. * * Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au> * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. */ /**@{*/ #include <libopencm3/stm32/pwr.h> #include <libopencm3/stm32/rcc.h> void pwr_set_vos_scale(enum pwr_vos_scale scale) { /* You are not allowed to write zeros here, don't try and optimize! */ uint32_t reg = PWR_CR; reg &= ~(PWR_CR_VOS_MASK); switch (scale) { case PWR_SCALE1: reg |= PWR_CR_VOS_RANGE1; break; case PWR_SCALE2: reg |= PWR_CR_VOS_RANGE2; break; case PWR_SCALE3: reg |= PWR_CR_VOS_RANGE3; break; } PWR_CR = reg; } /**@}*/
#pragma once #include "NotificationBase.h" class CNotificationPushsafer : public CNotificationBase { public: CNotificationPushsafer(); ~CNotificationPushsafer() override = default; bool IsConfigured() override; protected: bool SendMessageImplementation(uint64_t Idx, const std::string &Name, const std::string &Subject, const std::string &Text, const std::string &ExtraData, int Priority, const std::string &Sound, bool bFromNotification) override; private: std::string _apikey; std::string _apiuser; };
/* * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) * From ASN.1 module "RRLP-Components" * found in "../rrlp-components.asn" */ #ifndef _AcquisElement_H_ #define _AcquisElement_H_ #include <asn_application.h> /* Including external dependencies */ #include "SatelliteID.h" #include <NativeInteger.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct AddionalDopplerFields; struct AddionalAngleFields; /* AcquisElement */ typedef struct AcquisElement { SatelliteID_t svid; long doppler0; struct AddionalDopplerFields *addionalDoppler /* OPTIONAL */; long codePhase; long intCodePhase; long gpsBitNumber; long codePhaseSearchWindow; struct AddionalAngleFields *addionalAngle /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } AcquisElement_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_AcquisElement; #ifdef __cplusplus } #endif /* Referred external types */ #include "AddionalDopplerFields.h" #include "AddionalAngleFields.h" #endif /* _AcquisElement_H_ */ #include <asn_internal.h>
/* Copyright (C) 2012-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/>. */ #include <sys/poll.h> int __ppoll_chk (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const __sigset_t *ss, __SIZE_TYPE__ fdslen) { if (fdslen / sizeof (*fds) < nfds) __chk_fail (); return ppoll (fds, nfds, timeout, ss); }
#include "filemq_classes.h" int main (int argc, char *argv []) { if (argc < 2) { puts ("usage: filemq_server publish-from"); return 0; } zactor_t *server = zactor_new (fmq_server, "filemq_server"); //zstr_send (server, "VERBOSE"); zstr_sendx (server, "PUBLISH", argv [1], "/", NULL); zstr_sendx (server, "BIND", "tcp://*:5670", NULL); while (!zsys_interrupted) zclock_sleep (1000); puts ("interrupted"); zactor_destroy (&server); return 0; }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/core/Core_EXPORTS.h> namespace Aws { namespace Monitoring { class MonitoringInterface; /** * Factory to create monitoring instance. */ class AWS_CORE_API MonitoringFactory { public: virtual ~MonitoringFactory() = default; virtual Aws::UniquePtr<MonitoringInterface> CreateMonitoringInstance() const = 0; }; } // namespace Monitoring } // namespace Aws
/* crypto/camellia/camellia.h -*- mode:C; c-file-style: "eay" -*- */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. 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. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED 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 OpenSSL PROJECT OR * ITS 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 HEADER_CAMELLIA_H #define HEADER_CAMELLIA_H #include <CoreBitcoin/openssl/opensslconf.h> #ifdef OPENSSL_NO_CAMELLIA #error CAMELLIA is disabled. #endif #include <stddef.h> #define CAMELLIA_ENCRYPT 1 #define CAMELLIA_DECRYPT 0 /* Because array size can't be a const in C, the following two are macros. Both sizes are in bytes. */ #ifdef __cplusplus extern "C" { #endif /* This should be a hidden type, but EVP requires that the size be known */ #define CAMELLIA_BLOCK_SIZE 16 #define CAMELLIA_TABLE_BYTE_LEN 272 #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match with WORD */ struct camellia_key_st { union { double d; /* ensures 64-bit align */ KEY_TABLE_TYPE rd_key; } u; int grand_rounds; }; typedef struct camellia_key_st CAMELLIA_KEY; #ifdef OPENSSL_FIPS int private_Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key); #endif int Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key); void Camellia_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); void Camellia_decrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key, const int enc); void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, const int enc); void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num); void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char ivec[CAMELLIA_BLOCK_SIZE], unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], unsigned int *num); #ifdef __cplusplus } #endif #endif /* !HEADER_Camellia_H */
/* * Copyright © 2012 Red Hat 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, see <http://www.gnu.org/licenses/>. * * Authors: Alexander Larsson <alexl@gnome.org> */ #ifndef __GTK_CSS_ENUM_VALUE_PRIVATE_H__ #define __GTK_CSS_ENUM_VALUE_PRIVATE_H__ #include "gtkenums.h" #include "gtkcssparserprivate.h" #include "gtkcsstypesprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS GtkCssValue * _gtk_css_border_style_value_new (GtkBorderStyle border_style); GtkCssValue * _gtk_css_border_style_value_try_parse (GtkCssParser *parser); GtkBorderStyle _gtk_css_border_style_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_font_size_value_new (GtkCssFontSize size); GtkCssValue * _gtk_css_font_size_value_try_parse (GtkCssParser *parser); GtkCssFontSize _gtk_css_font_size_value_get (const GtkCssValue *value); double _gtk_css_font_size_get_default (GtkStyleProviderPrivate *provider); GtkCssValue * _gtk_css_font_style_value_new (PangoStyle style); GtkCssValue * _gtk_css_font_style_value_try_parse (GtkCssParser *parser); PangoStyle _gtk_css_font_style_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_font_variant_value_new (PangoVariant variant); GtkCssValue * _gtk_css_font_variant_value_try_parse (GtkCssParser *parser); PangoVariant _gtk_css_font_variant_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_font_weight_value_new (PangoWeight weight); GtkCssValue * _gtk_css_font_weight_value_try_parse (GtkCssParser *parser); PangoWeight _gtk_css_font_weight_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_area_value_new (GtkCssArea area); GtkCssValue * _gtk_css_area_value_try_parse (GtkCssParser *parser); GtkCssArea _gtk_css_area_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_direction_value_new (GtkCssDirection direction); GtkCssValue * _gtk_css_direction_value_try_parse (GtkCssParser *parser); GtkCssDirection _gtk_css_direction_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_play_state_value_new (GtkCssPlayState play_state); GtkCssValue * _gtk_css_play_state_value_try_parse (GtkCssParser *parser); GtkCssPlayState _gtk_css_play_state_value_get (const GtkCssValue *value); GtkCssValue * _gtk_css_fill_mode_value_new (GtkCssFillMode fill_mode); GtkCssValue * _gtk_css_fill_mode_value_try_parse (GtkCssParser *parser); GtkCssFillMode _gtk_css_fill_mode_value_get (const GtkCssValue *value); G_END_DECLS #endif /* __GTK_CSS_ENUM_VALUE_PRIVATE_H__ */
/* * Copyright (C) 2007-2009 Nokia Corporation. * * Author: Felipe Contreras <felipe.contreras@nokia.com> * * 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 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef GSTOMX_FILEREADERSRC_H #define GSTOMX_FILEREADERSRC_H #include <gst/gst.h> G_BEGIN_DECLS #define GST_OMX_FILEREADERSRC(obj) (GstOmxFilereaderSrc *) (obj) #define GST_OMX_FILEREADERSRC_TYPE (gst_omx_filereadersrc_get_type ()) typedef struct GstOmxFilereaderSrc GstOmxFilereaderSrc; typedef struct GstOmxFilereaderSrcClass GstOmxFilereaderSrcClass; #include "gstomx_base_src.h" struct GstOmxFilereaderSrc { GstOmxBaseSrc omx_base; char *file_name; /**< The input file name. */ }; struct GstOmxFilereaderSrcClass { GstOmxBaseSrcClass parent_class; }; GType gst_omx_filereadersrc_get_type (void); G_END_DECLS #endif /* GSTOMX_FILEREADERSRC_H */
/*************************************************************************\ * Copyright (C) Michael Kerrisk, 2014. * * * * This program is free software. You may use, modify, and redistribute it * * under the terms of the GNU Affero General Public License as published * * by the Free Software Foundation, either version 3 or (at your option) * * any later version. This program is distributed without any warranty. * * See the file COPYING.agpl-v3 for details. * \*************************************************************************/ /* Listing 9-1 */ /* idshow.c Display all user and group identifiers associated with a process. Note: This program uses Linux-specific calls and the Linux-specific file-system user and group IDs. */ #define _GNU_SOURCE #include <unistd.h> #include <sys/fsuid.h> #include <limits.h> #include "ugid_functions.h" /* userNameFromId() & groupNameFromId() */ #include "tlpi_hdr.h" #define SG_SIZE (NGROUPS_MAX + 1) int main(int argc, char *argv[]) { uid_t ruid, euid, suid, fsuid; gid_t rgid, egid, sgid, fsgid; gid_t suppGroups[SG_SIZE]; int numGroups, j; char *p; if (getresuid(&ruid, &euid, &suid) == -1) errExit("getresuid"); if (getresgid(&rgid, &egid, &sgid) == -1) errExit("getresgid"); /* Attempts to change the file-system IDs are always ignored for unprivileged processes, but even so, the following calls return the current file-system IDs */ fsuid = setfsuid(0); fsgid = setfsgid(0); printf("UID: "); p = userNameFromId(ruid); printf("real=%s (%ld); ", (p == NULL) ? "???" : p, (long) ruid); p = userNameFromId(euid); printf("eff=%s (%ld); ", (p == NULL) ? "???" : p, (long) euid); p = userNameFromId(suid); printf("saved=%s (%ld); ", (p == NULL) ? "???" : p, (long) suid); p = userNameFromId(fsuid); printf("fs=%s (%ld); ", (p == NULL) ? "???" : p, (long) fsuid); printf("\n"); printf("GID: "); p = groupNameFromId(rgid); printf("real=%s (%ld); ", (p == NULL) ? "???" : p, (long) rgid); p = groupNameFromId(egid); printf("eff=%s (%ld); ", (p == NULL) ? "???" : p, (long) egid); p = groupNameFromId(sgid); printf("saved=%s (%ld); ", (p == NULL) ? "???" : p, (long) sgid); p = groupNameFromId(fsgid); printf("fs=%s (%ld); ", (p == NULL) ? "???" : p, (long) fsgid); printf("\n"); numGroups = getgroups(SG_SIZE, suppGroups); if (numGroups == -1) errExit("getgroups"); printf("Supplementary groups (%d): ", numGroups); for (j = 0; j < numGroups; j++) { p = groupNameFromId(suppGroups[j]); printf("%s (%ld) ", (p == NULL) ? "???" : p, (long) suppGroups[j]); } printf("\n"); exit(EXIT_SUCCESS); }
/** AsmReadCr2 function Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "BaseLibInternals.h" UINTN EFIAPI AsmReadCr2 ( VOID ) { __asm { mov eax, cr2 } }
/* * Copyright (C) 2020, Huada Semiconductor Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2020-10-30 CDT first version */ #include <rthw.h> #include <rtthread.h> #include "board.h" /** * @addtogroup HC32 */ /*@{*/ /******************************************************************************* * Function Name : Peripheral_WE * Description : MCU Peripheral registers write unprotected. * Input : None * Output : None * Return : None *******************************************************************************/ void Peripheral_WE(void) { /* Unlock GPIO register: PSPCR, PCCR, PINAER, PCRxy, PFSRxy */ GPIO_Unlock(); /* Unlock PWC register: FCG0 */ PWC_FCG0_Unlock(); /* Unlock PWC, CLK, PVD registers, @ref PWC_REG_Write_Unlock_Code for details */ PWC_Unlock(PWC_UNLOCK_CODE_0 | PWC_UNLOCK_CODE_1); /* Unlock SRAM register: WTCR */ SRAM_WTCR_Unlock(); /* Unlock SRAM register: CKCR */ // SRAM_CKCR_Unlock(); /* Unlock all EFM registers */ EFM_Unlock(); /* Unlock EFM register: FWMC */ // EFM_FWMC_Unlock(); /* Unlock EFM OTP write protect registers */ // EFM_OTP_WP_Unlock(); } /******************************************************************************* * Function Name : Peripheral_WP * Description : MCU Peripheral registers write protected. * Input : None * Output : None * Return : None *******************************************************************************/ void Peripheral_WP(void) { /* Lock GPIO register: PSPCR, PCCR, PINAER, PCRxy, PFSRxy */ GPIO_Lock(); /* Lock PWC register: FCG0 */ // PWC_FCG0_Lock(); /* Lock PWC, CLK, PVD registers, @ref PWC_REG_Write_Unlock_Code for details */ PWC_Lock(PWC_UNLOCK_CODE_0 | PWC_UNLOCK_CODE_1); /* Lock SRAM register: WTCR */ // SRAM_WTCR_Lock(); /* Lock SRAM register: CKCR */ // SRAM_CKCR_Lock(); /* Lock all EFM registers */ // EFM_Lock(); /* Lock EFM OTP write protect registers */ // EFM_OTP_WP_Lock(); /* Lock EFM register: FWMC */ // EFM_FWMC_Lock(); } /** * @brief BSP clock initialize. * Set board system clock to PLLH@240MHz * @param None * @retval None */ void rt_hw_board_clock_init(void) { stc_clk_pllh_init_t stcPLLHInit; CLK_ClkDiv(CLK_CATE_ALL, \ (CLK_PCLK0_DIV1 | CLK_PCLK1_DIV2 | CLK_PCLK2_DIV4 | \ CLK_PCLK3_DIV4 | CLK_PCLK4_DIV2 | CLK_EXCLK_DIV2 | \ CLK_HCLK_DIV1)); (void)CLK_PLLHStrucInit(&stcPLLHInit); /* VCO = (8/1)*120 = 960MHz*/ stcPLLHInit.u8PLLState = CLK_PLLH_ON; stcPLLHInit.PLLCFGR = 0UL; stcPLLHInit.PLLCFGR_f.PLLM = 1UL - 1UL; stcPLLHInit.PLLCFGR_f.PLLN = 120UL - 1UL; stcPLLHInit.PLLCFGR_f.PLLP = 4UL - 1UL; stcPLLHInit.PLLCFGR_f.PLLQ = 4UL - 1UL; stcPLLHInit.PLLCFGR_f.PLLR = 4UL - 1UL; stcPLLHInit.PLLCFGR_f.PLLSRC = CLK_PLLSRC_XTAL; (void)CLK_PLLHInit(&stcPLLHInit); /* Highspeed SRAM set to 1 Read/Write wait cycle */ SRAM_SetWaitCycle(SRAM_SRAMH, SRAM_WAIT_CYCLE_1, SRAM_WAIT_CYCLE_1); /* SRAM1_2_3_4_backup set to 2 Read/Write wait cycle */ SRAM_SetWaitCycle((SRAM_SRAM123 | SRAM_SRAM4 | SRAM_SRAMB), SRAM_WAIT_CYCLE_2, SRAM_WAIT_CYCLE_2); /* 0-wait @ 40MHz */ EFM_SetWaitCycle(EFM_WAIT_CYCLE_5); /* 4 cycles for 200 ~ 250MHz */ GPIO_SetReadWaitCycle(GPIO_READ_WAIT_4); CLK_SetSysClkSrc(CLK_SYSCLKSOURCE_PLLH); } /******************************************************************************* * Function Name : SysTick_Configuration * Description : Configures the SysTick for OS tick. * Input : None * Output : None * Return : None *******************************************************************************/ void SysTick_Configuration(void) { stc_clk_freq_t stcClkFreq; rt_uint32_t cnts; CLK_GetClockFreq(&stcClkFreq); cnts = (rt_uint32_t)stcClkFreq.hclkFreq / RT_TICK_PER_SECOND; SysTick_Config(cnts); } /** * This is the timer interrupt service routine. * */ void SysTick_Handler(void) { /* enter interrupt */ rt_interrupt_enter(); rt_tick_increase(); /* leave interrupt */ rt_interrupt_leave(); } /** * This function will initialize HC32 board. */ void rt_hw_board_init() { /* Unlock the protected registers. */ Peripheral_WE(); /* Configure the System clock */ rt_hw_board_clock_init(); /* Configure the SysTick */ SysTick_Configuration(); #ifdef RT_USING_HEAP rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); #endif #ifdef RT_USING_COMPONENTS_INIT rt_components_board_init(); #endif #ifdef RT_USING_CONSOLE rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif } void rt_hw_us_delay(rt_uint32_t us) { uint32_t start, now, delta, reload, us_tick; start = SysTick->VAL; reload = SysTick->LOAD; us_tick = SystemCoreClock / 1000000UL; do{ now = SysTick->VAL; delta = start > now ? start - now : reload + start - now; } while(delta < us_tick * us); } /*@}*/
/** @file Virtio Block Device specific type and macro definitions corresponding to the virtio-0.9.5 specification. Copyright (C) 2012, Red Hat, Inc. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _VIRTIO_BLK_H_ #define _VIRTIO_BLK_H_ #include <IndustryStandard/Virtio.h> // // virtio-0.9.5, Appendix D: Block Device // #pragma pack(1) typedef struct { UINT8 PhysicalBlockExp; // # of logical blocks per physical block (log2) UINT8 AlignmentOffset; // offset of first aligned logical block UINT16 MinIoSize; // suggested minimum I/O size in blocks UINT32 OptIoSize; // optimal (suggested maximum) I/O size in blocks } VIRTIO_BLK_TOPOLOGY; typedef struct { UINT64 Capacity; UINT32 SizeMax; UINT32 SegMax; UINT16 Cylinders; UINT8 Heads; UINT8 Sectors; UINT32 BlkSize; VIRTIO_BLK_TOPOLOGY Topology; } VIRTIO_BLK_CONFIG; #pragma pack() #define OFFSET_OF_VBLK(Field) OFFSET_OF (VIRTIO_BLK_CONFIG, Field) #define SIZE_OF_VBLK(Field) (sizeof ((VIRTIO_BLK_CONFIG *) 0)->Field) #define VIRTIO_BLK_F_BARRIER BIT0 #define VIRTIO_BLK_F_SIZE_MAX BIT1 #define VIRTIO_BLK_F_SEG_MAX BIT2 #define VIRTIO_BLK_F_GEOMETRY BIT4 #define VIRTIO_BLK_F_RO BIT5 #define VIRTIO_BLK_F_BLK_SIZE BIT6 // treated as "logical block size" in // practice; actual host side // implementation negotiates "optimal" // block size separately, via // VIRTIO_BLK_F_TOPOLOGY #define VIRTIO_BLK_F_SCSI BIT7 #define VIRTIO_BLK_F_FLUSH BIT9 // identical to "write cache enabled" #define VIRTIO_BLK_F_TOPOLOGY BIT10 // information on optimal I/O alignment // // We keep the status byte separate from the rest of the virtio-blk request // header. See description of historical scattering at the end of Appendix D: // we're going to put the status byte in a separate VRING_DESC. // #pragma pack(1) typedef struct { UINT32 Type; UINT32 IoPrio; UINT64 Sector; } VIRTIO_BLK_REQ; #pragma pack() #define VIRTIO_BLK_T_IN 0x00000000 #define VIRTIO_BLK_T_OUT 0x00000001 #define VIRTIO_BLK_T_SCSI_CMD 0x00000002 #define VIRTIO_BLK_T_SCSI_CMD_OUT 0x00000003 #define VIRTIO_BLK_T_FLUSH 0x00000004 #define VIRTIO_BLK_T_FLUSH_OUT 0x00000005 #define VIRTIO_BLK_T_BARRIER BIT31 #define VIRTIO_BLK_S_OK 0x00 #define VIRTIO_BLK_S_IOERR 0x01 #define VIRTIO_BLK_S_UNSUPP 0x02 #endif // _VIRTIO_BLK_H_
/** @file Declarations for TCP. Copyright (c) 2012, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tcp.h 8.1 (Berkeley) 6/10/93 NetBSD: tcp.h,v 1.28 2007/12/25 18:33:47 perry Exp */ #ifndef _NETINET_TCP_H_ #define _NETINET_TCP_H_ #include <sys/featuretest.h> typedef u_int32_t tcp_seq; /* Flag definitions for tcphdr.th_flags */ #define TH_FIN 0x01 #define TH_SYN 0x02 #define TH_RST 0x04 #define TH_PUSH 0x08 #define TH_ACK 0x10 #define TH_URG 0x20 #define TH_ECE 0x40 #define TH_CWR 0x80 #pragma pack(1) /* * TCP header. * Per RFC 793, September, 1981. * Updated by RFC 3168, September, 2001. */ struct tcphdr { u_int16_t th_sport; /* source port */ u_int16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #if BYTE_ORDER == LITTLE_ENDIAN /*LINTED non-portable bitfields*/ u_int8_t th_x2:4, /* (unused) */ th_off:4; /* data offset */ #endif #if BYTE_ORDER == BIG_ENDIAN /*LINTED non-portable bitfields*/ u_int8_t th_off:4, /* data offset */ th_x2:4; /* (unused) */ #endif u_int8_t th_flags; u_int16_t th_win; /* window */ u_int16_t th_sum; /* checksum */ u_int16_t th_urp; /* urgent pointer */ }; #pragma pack() #define TCPOPT_EOL 0 #define TCPOPT_NOP 1 #define TCPOPT_MAXSEG 2 #define TCPOLEN_MAXSEG 4 #define TCPOPT_WINDOW 3 #define TCPOLEN_WINDOW 3 #define TCPOPT_SACK_PERMITTED 4 /* Experimental */ #define TCPOLEN_SACK_PERMITTED 2 #define TCPOPT_SACK 5 /* Experimental */ #define TCPOPT_TIMESTAMP 8 #define TCPOLEN_TIMESTAMP 10 #define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ #define TCPOPT_TSTAMP_HDR \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) #define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */ #define TCPOLEN_SIGNATURE 18 #define TCPOLEN_SIGLEN (TCPOLEN_SIGNATURE+2) /* padding */ #define MAX_TCPOPTLEN 40 /* max # bytes that go in options */ /* Default maximum segment size for TCP. * This is defined by RFC 1112 Sec 4.2.2.6. */ #define TCP_MSS 536 #define TCP_MINMSS 216 #define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ #define TCP_MAX_WINSHIFT 14 /* maximum window shift */ #define TCP_MAXBURST 4 /* maximum segments in a burst */ /* User-settable options (used with setsockopt). */ #define TCP_NODELAY 1 /* don't delay send to coalesce packets */ #define TCP_MAXSEG 2 /* set maximum segment size */ #define TCP_KEEPIDLE 3 #ifdef notyet #define TCP_NOPUSH 4 /* reserved for FreeBSD compat */ #endif #define TCP_KEEPINTVL 5 #define TCP_KEEPCNT 6 #define TCP_KEEPINIT 7 #ifdef notyet #define TCP_NOOPT 8 /* reserved for FreeBSD compat */ #endif #define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */ #define TCP_CONGCTL 0x20 /* selected congestion control */ #endif /* !_NETINET_TCP_H_ */
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMMON_RUNTIME_GPU_GPU_DEBUG_ALLOCATOR_H_ #define TENSORFLOW_COMMON_RUNTIME_GPU_GPU_DEBUG_ALLOCATOR_H_ #include <memory> #include <string> #include <unordered_map> #include "tensorflow/core/common_runtime/gpu/gpu_id.h" #include "tensorflow/core/common_runtime/visitable_allocator.h" #include "tensorflow/core/platform/macros.h" #include "tensorflow/core/platform/stream_executor.h" #include "tensorflow/core/platform/types.h" namespace tensorflow { // An allocator that wraps a GPU allocator and adds debugging // functionality that verifies that users do not write outside their // allocated memory. class GPUDebugAllocator : public VisitableAllocator { public: explicit GPUDebugAllocator(VisitableAllocator* allocator, CudaGpuId cuda_gpu_id); ~GPUDebugAllocator() override; string Name() override { return "gpu_debug"; } void* AllocateRaw(size_t alignment, size_t num_bytes) override; void DeallocateRaw(void* ptr) override; void AddAllocVisitor(Visitor visitor) override; void AddFreeVisitor(Visitor visitor) override; bool TracksAllocationSizes() override; size_t RequestedSize(void* ptr) override; size_t AllocatedSize(void* ptr) override; int64 AllocationId(void* ptr) override; void GetStats(AllocatorStats* stats) override; // For testing. bool CheckHeader(void* ptr); bool CheckFooter(void* ptr); private: VisitableAllocator* base_allocator_ = nullptr; // owned perftools::gputools::StreamExecutor* stream_exec_; // Not owned. TF_DISALLOW_COPY_AND_ASSIGN(GPUDebugAllocator); }; // An allocator that wraps a GPU allocator and resets the memory on // allocation and free to 'NaN', helping to identify cases where the // user forgets to initialize the memory. class GPUNanResetAllocator : public VisitableAllocator { public: explicit GPUNanResetAllocator(VisitableAllocator* allocator, CudaGpuId cuda_gpu_id); ~GPUNanResetAllocator() override; string Name() override { return "gpu_nan_reset"; } void* AllocateRaw(size_t alignment, size_t num_bytes) override; void DeallocateRaw(void* ptr) override; void AddAllocVisitor(Visitor visitor) override; void AddFreeVisitor(Visitor visitor) override; size_t RequestedSize(void* ptr) override; size_t AllocatedSize(void* ptr) override; void GetStats(AllocatorStats* stats) override; private: VisitableAllocator* base_allocator_ = nullptr; // owned perftools::gputools::StreamExecutor* stream_exec_; // Not owned. TF_DISALLOW_COPY_AND_ASSIGN(GPUNanResetAllocator); }; } // namespace tensorflow #endif // TENSORFLOW_COMMON_RUNTIME_GPU_GPU_DEBUG_ALLOCATOR_H_
/** @file AsmWriteDr1 function Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ /** Writes a value to Debug Register 1 (DR1). Writes and returns a new value to DR1. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Value The value to write to Dr1. @return The value written to Debug Register 1 (DR1). **/ UINTN EFIAPI AsmWriteDr1 ( IN UINTN Value ) { _asm { mov eax, Value mov dr1, eax } }
/* ========================================================================== */ /* === UMFPACK_col_to_triplet =============================================== */ /* ========================================================================== */ /* -------------------------------------------------------------------------- */ /* Copyright (c) 2005-2012 by Timothy A. Davis, http://www.suitesparse.com. */ /* All Rights Reserved. See ../Doc/License for License. */ /* -------------------------------------------------------------------------- */ /* User callable. Converts a column-oriented input matrix to triplet form by constructing the column indices Tj from the column pointers Ap. The matrix may be singular. See umfpack_col_to_triplet.h for details. */ #include "umf_internal.h" GLOBAL Int UMFPACK_col_to_triplet ( Int n_col, const Int Ap [ ], Int Tj [ ] ) { /* ---------------------------------------------------------------------- */ /* local variables */ /* ---------------------------------------------------------------------- */ Int nz, j, p, p1, p2, length ; /* ---------------------------------------------------------------------- */ /* construct the column indices */ /* ---------------------------------------------------------------------- */ if (!Ap || !Tj) { return (UMFPACK_ERROR_argument_missing) ; } if (n_col <= 0) { return (UMFPACK_ERROR_n_nonpositive) ; } if (Ap [0] != 0) { return (UMFPACK_ERROR_invalid_matrix) ; } nz = Ap [n_col] ; if (nz < 0) { return (UMFPACK_ERROR_invalid_matrix) ; } for (j = 0 ; j < n_col ; j++) { p1 = Ap [j] ; p2 = Ap [j+1] ; length = p2 - p1 ; if (length < 0 || p2 > nz) { return (UMFPACK_ERROR_invalid_matrix) ; } for (p = p1 ; p < p2 ; p++) { Tj [p] = j ; } } return (UMFPACK_OK) ; }
/* * Copyright (c) 2013 The WebRTC 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 in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_RTC_VIDEO_CAPTURE_OBJC_H_ #define WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_RTC_VIDEO_CAPTURE_OBJC_H_ #import <Foundation/Foundation.h> #ifdef WEBRTC_IOS #import <UIKit/UIKit.h> #endif #include "webrtc/modules/video_capture/objc/video_capture.h" // The following class listens to a notification with name: // 'StatusBarOrientationDidChange'. // This notification must be posted in order for the capturer to reflect the // orientation change in video w.r.t. the application orientation. @interface RTCVideoCaptureIosObjC : NSObject<AVCaptureVideoDataOutputSampleBufferDelegate> @property webrtc::VideoRotation frameRotation; // custom initializer. Instance of VideoCaptureIos is needed // for callback purposes. // default init methods have been overridden to return nil. - (id)initWithOwner:(webrtc::videocapturemodule::VideoCaptureIos*)owner; - (BOOL)setCaptureDeviceByUniqueId:(NSString*)uniqueId; - (BOOL)startCaptureWithCapability: (const webrtc::VideoCaptureCapability&)capability; - (BOOL)stopCapture; @end #endif // WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_RTC_VIDEO_CAPTURE_OBJC_H_
/* * aeatk.c * * Created on: May 7, 2014 * Author: sjr */ #include <arpa/inet.h> #include <netinet/in.h> #include <sys/types.h> #include <sys/socket.h> /** * This function is called by the timerThread at the end of updating runsolvers internal * time measure and will send a message to the port on the local machine. * * Written by Stephen Ramage */ void writeCPUTimeToSocket(double cpuTime) { static char* portstr = getenv("AEATK_PORT"); static int noMessageDisplay = 0; if (portstr == NULL) { if (noMessageDisplay == 0) { noMessageDisplay++; printf( "[AEATK] No environment variable \"AEATK_PORT\" detected not sending updates\n\n"); } return; } //Safely convert port to int int port = strtol(portstr, NULL, 10); if (port < 1024 || port > 65535) { //Invalid port, probably nothing if (noMessageDisplay == 0) { noMessageDisplay++; printf( "[AEATK] Invalid port set in \"AEATK_PORT\" must be in [1024, 65535]\n\n"); } return; } static struct sockaddr_in servaddr; static double updateFreqDbl = 1; static int lastUpdate = -1; static int sockfd = -1; static char* updateFreq = getenv("AEATK_CPU_TIME_FREQUENCY"); if (sockfd == -1) { sockfd = socket(AF_INET, SOCK_DGRAM, 0); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = inet_addr("127.0.0.1"); servaddr.sin_port = htons(port); } if (updateFreq != NULL) { //Runsolver won't actually call this function faster than every 2 seconds //But we set it to 1 second anyway updateFreqDbl = strtod(updateFreq, NULL); if (updateFreqDbl < 1) { updateFreqDbl = 1; } } if ((time(NULL) - lastUpdate) > updateFreqDbl) { lastUpdate = time(NULL); static char buf[100]; int length = sprintf(buf, "%f\n", cpuTime); //Not sure if MSG_DONTWAIT flag is appropriate but it didn't seem to matter when I tried a few times if (noMessageDisplay >= 2) { noMessageDisplay++; printf( "[AEATK] Sending CPUTime updates to 127.0.0.1 on port %d every %.3f seconds, last time %.3f \n\n", port, updateFreqDbl, cpuTime); } sendto(sockfd, buf, length, 0, (struct sockaddr*) &servaddr, sizeof(servaddr)); return; } return; } void updateCores() { char* set_affinity = getenv("AEATK_SET_TASK_AFFINITY"); if ((set_affinity == NULL) || strcmp(set_affinity, "1") != 0) { printf( "[AEATK] No environment variable \"AEATK_SET_TASK_AFFINITY\" detected, cores will be treated normally\n\n"); return; } char* taskstr = getenv("AEATK_CONCURRENT_TASK_ID"); if (taskstr == NULL) { printf( "[AEATK] No environment variable \"AEATK_CONCURRENT_TASK_ID\" detected, cores are treated normally\n\n"); return; } unsigned int taskid = strtoul(taskstr, NULL, 10); printf( "[AEATK] This version of runsolver restricts subprocesses to only one core when \"AEATK_CONCURRENT_TASK_ID\" is set.\n"); vector<unsigned short int> cores2; getAllocatedCoresByProcessorOrder(cores2); if (taskid >= cores2.size()) { cout << "[AEATK] taskid: " << taskid << " is greater than the number of cores we have available cores: " << cores2.size() << " affinity: "; printAllocatedCores(cout, cores2); cout << " something is wrong, exiting" << endl; exit(1); } vector<unsigned short int> cores; cores.push_back(cores2[taskid]); cpu_set_t mask = affinityMask(cores); if (sched_setaffinity(0, sizeof(cpu_set_t), &mask) != 0) { perror("sched_setaffinity failed: "); cout << "[AEATK] Couldn't set affinity " << endl; exit(1); } return; }
/* * * Copyright 2015, 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. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef GRPC_CORE_LIB_IOMGR_IOMGR_H #define GRPC_CORE_LIB_IOMGR_IOMGR_H #include <grpc/impl/codegen/exec_ctx_fwd.h> #include "src/core/lib/iomgr/port.h" /** Initializes the iomgr. */ void grpc_iomgr_init(void); /** Starts any background threads for iomgr. */ void grpc_iomgr_start(void); /** Signals the intention to shutdown the iomgr. Expects to be able to flush * exec_ctx. */ void grpc_iomgr_shutdown(grpc_exec_ctx *exec_ctx); #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_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 CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ #include "base/memory/raw_ptr.h" #include "base/observer_list.h" #include "components/bookmarks/browser/base_bookmark_model_observer.h" #include "content/public/browser/reload_type.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" class BookmarkTabHelperObserver; namespace bookmarks { struct BookmarkNodeData; } namespace content { class WebContents; } // Per-tab class to manage bookmarks. class BookmarkTabHelper : public bookmarks::BaseBookmarkModelObserver, public content::WebContentsObserver, public content::WebContentsUserData<BookmarkTabHelper> { public: // Interface for forwarding bookmark drag and drop to extenstions. class BookmarkDrag { public: virtual void OnDragEnter(const bookmarks::BookmarkNodeData& data) = 0; virtual void OnDragOver(const bookmarks::BookmarkNodeData& data) = 0; virtual void OnDragLeave(const bookmarks::BookmarkNodeData& data) = 0; virtual void OnDrop(const bookmarks::BookmarkNodeData& data) = 0; protected: virtual ~BookmarkDrag() {} }; BookmarkTabHelper(const BookmarkTabHelper&) = delete; BookmarkTabHelper& operator=(const BookmarkTabHelper&) = delete; ~BookmarkTabHelper() override; // It is up to callers to call set_bookmark_drag_delegate(NULL) when // |bookmark_drag| is deleted since this class does not take ownership of // |bookmark_drag|. void set_bookmark_drag_delegate(BookmarkDrag* bookmark_drag) { bookmark_drag_ = bookmark_drag; } BookmarkDrag* bookmark_drag_delegate() { return bookmark_drag_; } bool is_starred() const { return is_starred_; } bool ShouldShowBookmarkBar() const; void AddObserver(BookmarkTabHelperObserver* observer); void RemoveObserver(BookmarkTabHelperObserver* observer); bool HasObserver(BookmarkTabHelperObserver* observer) const; private: friend class content::WebContentsUserData<BookmarkTabHelper>; explicit BookmarkTabHelper(content::WebContents* web_contents); // Updates the starred state from the BookmarkModel. If the state has changed, // the delegate is notified. void UpdateStarredStateForCurrentURL(); // Overridden from bookmarks::BaseBookmarkModelObserver: void BookmarkModelChanged() override; void BookmarkModelLoaded(bookmarks::BookmarkModel* model, bool ids_reassigned) override; void BookmarkNodeAdded(bookmarks::BookmarkModel* model, const bookmarks::BookmarkNode* parent, size_t index) override; void BookmarkNodeRemoved(bookmarks::BookmarkModel* model, const bookmarks::BookmarkNode* parent, size_t old_index, const bookmarks::BookmarkNode* node, const std::set<GURL>& removed_urls) override; void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, const std::set<GURL>& removed_urls) override; void BookmarkNodeChanged(bookmarks::BookmarkModel* model, const bookmarks::BookmarkNode* node) override; // Overridden from content::WebContentsObserver: void DidStartNavigation( content::NavigationHandle* navigation_handle) override; void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; // Whether the current URL is starred. bool is_starred_; raw_ptr<bookmarks::BookmarkModel> bookmark_model_; // A list of observers notified when when the url starred changed. base::ObserverList<BookmarkTabHelperObserver>::Unchecked observers_; // The BookmarkDrag is used to forward bookmark drag and drop events to // extensions. raw_ptr<BookmarkDrag> bookmark_drag_; WEB_CONTENTS_USER_DATA_KEY_DECL(); }; #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2016, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above // copyright notice, this list of conditions and the following // disclaimer. // // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided with // the distribution. // // * Neither the name of John Haddon nor the names of // any other contributors to this software 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. // ////////////////////////////////////////////////////////////////////////// #ifndef GAFFERAPPLESEED_APPLESEEDSHADERADAPTOR_H #define GAFFERAPPLESEED_APPLESEEDSHADERADAPTOR_H #include "GafferAppleseed/Export.h" #include "GafferAppleseed/TypeIds.h" #include "GafferScene/SceneProcessor.h" namespace GafferAppleseed { class GAFFERAPPLESEED_API AppleseedShaderAdaptor : public GafferScene::SceneProcessor { public : AppleseedShaderAdaptor( const std::string &name=defaultName<AppleseedShaderAdaptor>() ); GAFFER_NODE_DECLARE_TYPE( GafferAppleseed::AppleseedShaderAdaptor, AppleseedShaderAdaptorTypeId, GafferScene::SceneProcessor ); void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const override; protected : void hashAttributes( const ScenePath &path, const Gaffer::Context *context, const GafferScene::ScenePlug *parent, IECore::MurmurHash &h ) const override; IECore::ConstCompoundObjectPtr computeAttributes( const ScenePath &path, const Gaffer::Context *context, const GafferScene::ScenePlug *parent ) const override; }; IE_CORE_DECLAREPTR( AppleseedShaderAdaptor ) } // namespace GafferAppleseed #endif // GAFFERAPPLESEED_APPLESEEDSHADERADAPTOR_H
//===- FuzzerUtil.h - Internal header for the Fuzzer Utils ------*- C++ -* ===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // Util functions. //===----------------------------------------------------------------------===// #ifndef LLVM_FUZZER_UTIL_H #define LLVM_FUZZER_UTIL_H #include "FuzzerBuiltins.h" #include "FuzzerBuiltinsMsvc.h" #include "FuzzerCommand.h" #include "FuzzerDefs.h" namespace fuzzer { void PrintHexArray(const Unit &U, const char *PrintAfter = ""); void PrintHexArray(const uint8_t *Data, size_t Size, const char *PrintAfter = ""); void PrintASCII(const uint8_t *Data, size_t Size, const char *PrintAfter = ""); void PrintASCII(const Unit &U, const char *PrintAfter = ""); // Changes U to contain only ASCII (isprint+isspace) characters. // Returns true iff U has been changed. bool ToASCII(uint8_t *Data, size_t Size); bool IsASCII(const Unit &U); bool IsASCII(const uint8_t *Data, size_t Size); std::string Base64(const Unit &U); void PrintPC(const char *SymbolizedFMT, const char *FallbackFMT, uintptr_t PC); std::string DescribePC(const char *SymbolizedFMT, uintptr_t PC); void PrintStackTrace(); void PrintMemoryProfile(); unsigned NumberOfCpuCores(); // Platform specific functions. void SetSignalHandler(const FuzzingOptions& Options); void SleepSeconds(int Seconds); unsigned long GetPid(); size_t GetPeakRSSMb(); int ExecuteCommand(const Command &Cmd); bool ExecuteCommand(const Command &Cmd, std::string *CmdOutput); // Fuchsia does not have popen/pclose. FILE *OpenProcessPipe(const char *Command, const char *Mode); int CloseProcessPipe(FILE *F); const void *SearchMemory(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); std::string CloneArgsWithoutX(const Vector<std::string> &Args, const char *X1, const char *X2); inline std::string CloneArgsWithoutX(const Vector<std::string> &Args, const char *X) { return CloneArgsWithoutX(Args, X, X); } inline std::pair<std::string, std::string> SplitBefore(std::string X, std::string S) { auto Pos = S.find(X); if (Pos == std::string::npos) return std::make_pair(S, ""); return std::make_pair(S.substr(0, Pos), S.substr(Pos)); } void DiscardOutput(int Fd); std::string DisassembleCmd(const std::string &FileName); std::string SearchRegexCmd(const std::string &Regex); size_t SimpleFastHash(const uint8_t *Data, size_t Size); inline uint32_t Log(uint32_t X) { return 32 - Clz(X) - 1; } inline size_t PageSize() { return 4096; } inline uint8_t *RoundUpByPage(uint8_t *P) { uintptr_t X = reinterpret_cast<uintptr_t>(P); size_t Mask = PageSize() - 1; X = (X + Mask) & ~Mask; return reinterpret_cast<uint8_t *>(X); } inline uint8_t *RoundDownByPage(uint8_t *P) { uintptr_t X = reinterpret_cast<uintptr_t>(P); size_t Mask = PageSize() - 1; X = X & ~Mask; return reinterpret_cast<uint8_t *>(X); } } // namespace fuzzer #endif // LLVM_FUZZER_UTIL_H
// Copyright 2015 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 DEVICE_VR_TEST_FAKE_VR_DEVICE_PROVIDER_H_ #define DEVICE_VR_TEST_FAKE_VR_DEVICE_PROVIDER_H_ #include <vector> #include "device/vr/public/cpp/vr_device_provider.h" #include "device/vr/vr_device_base.h" #include "device/vr/vr_export.h" #include "mojo/public/cpp/bindings/pending_remote.h" namespace device { // TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT. class DEVICE_VR_EXPORT FakeVRDeviceProvider : public VRDeviceProvider { public: FakeVRDeviceProvider(); FakeVRDeviceProvider(const FakeVRDeviceProvider&) = delete; FakeVRDeviceProvider& operator=(const FakeVRDeviceProvider&) = delete; ~FakeVRDeviceProvider() override; // Adds devices to the provider with the given device, which will be // returned when GetDevices is queried. void AddDevice(std::unique_ptr<VRDeviceBase> device); void RemoveDevice(mojom::XRDeviceId device_id); void Initialize(VRDeviceProviderClient* client) override; bool Initialized() override; private: std::vector<std::unique_ptr<VRDeviceBase>> devices_; bool initialized_; VRDeviceProviderClient* client_ = nullptr; }; } // namespace device #endif // DEVICE_VR_TEST_FAKE_VR_DEVICE_PROVIDER_H_
// // UIViewController+JDSideMenu.h // JDSideMenu // // Created by Markus Emrich on 11.11.13. // Copyright (c) 2013 Markus Emrich. All rights reserved. // #import "JDSideMenu.h" @interface UIViewController (JDSideMenu) - (JDSideMenu*)sideMenuController; @end
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-support/simd-kcvi.h" #include "../common/t1sv_16.c"
#include <stdio.h> int is_prime(int numb) { int counter, true_false=0; for ( counter = numb - 1; counter > 2; counter-- ) if( numb % counter == 0 ) true_false++; if(numb < 1) return -1; else if(true_false > 0) return 0; else return 1; } int main() { int number; scanf ( "%d", &number ); printf( "%d", is_prime(number) ); return 0; }
#ifdef __OBJC__ #import <UIKit/UIKit.h> #endif #import "AFNetworking.h" #import "AFURLConnectionOperation.h" #import "AFHTTPRequestOperation.h" #import "AFHTTPRequestOperationManager.h" #import "AFHTTPSessionManager.h" #import "AFURLSessionManager.h" #import "AFNetworkReachabilityManager.h" #import "AFSecurityPolicy.h" #import "AFURLRequestSerialization.h" #import "AFURLResponseSerialization.h" #import "AFNetworkActivityIndicatorManager.h" #import "UIActivityIndicatorView+AFNetworking.h" #import "UIAlertView+AFNetworking.h" #import "UIButton+AFNetworking.h" #import "UIImage+AFNetworking.h" #import "UIImageView+AFNetworking.h" #import "UIKit+AFNetworking.h" #import "UIProgressView+AFNetworking.h" #import "UIRefreshControl+AFNetworking.h" #import "UIWebView+AFNetworking.h" FOUNDATION_EXPORT double AFNetworkingVersionNumber; FOUNDATION_EXPORT const unsigned char AFNetworkingVersionString[];
// // LOTLayerContainer.h // Lottie // // Created by brandon_withrow on 7/18/17. // Copyright © 2017 Airbnb. All rights reserved. // #import "LOTPlatformCompat.h" #import "LOTLayer.h" #import "LOTLayerGroup.h" #import "LOTKeypath.h" #import "LOTValueDelegate.h" @class LOTValueCallback; @interface LOTLayerContainer : CALayer - (instancetype _Nonnull)initWithModel:(LOTLayer * _Nullable)layer inLayerGroup:(LOTLayerGroup * _Nullable)layerGroup; @property (nonatomic, readonly, strong, nullable) NSString *layerName; @property (nonatomic, nullable) NSNumber *currentFrame; @property (nonatomic, readonly, nonnull) NSNumber *timeStretchFactor; @property (nonatomic, assign) CGRect viewportBounds; @property (nonatomic, readonly, nonnull) CALayer *wrapperLayer; @property (nonatomic, readonly, nonnull) NSDictionary *valueInterpolators; - (void)displayWithFrame:(NSNumber * _Nonnull)frame; - (void)displayWithFrame:(NSNumber * _Nonnull)frame forceUpdate:(BOOL)forceUpdate; - (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath; - (void)setValueDelegate:(id<LOTValueDelegate> _Nonnull)delegate forKeypath:(LOTKeypath * _Nonnull)keypath; @end
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef KSPACE_CLASS KSpaceStyle(pppm/stagger,PPPMStagger) #else #ifndef LMP_PPPM_STAGGER_H #define LMP_PPPM_STAGGER_H #include "pppm.h" namespace LAMMPS_NS { class PPPMStagger : public PPPM { public: PPPMStagger(class LAMMPS *, int, char **); virtual ~PPPMStagger(); virtual void init(); virtual void compute(int, int); virtual int timing_1d(int, double &); virtual int timing_3d(int, double &); protected: int nstagger; double stagger; double **gf_b2; virtual double compute_qopt(); double compute_qopt_ad(); virtual void compute_gf_denom(); virtual void compute_gf_ik(); virtual void compute_gf_ad(); virtual void particle_map(); virtual void make_rho(); virtual void fieldforce_ik(); virtual void fieldforce_ad(); virtual void fieldforce_peratom(); inline double gf_denom2(const double &x, const double &y, const double &z) const { double sx,sy,sz; double x2 = x*x; double y2 = y*y; double z2 = z*z; double xl = x; double yl = y; double zl = z; sx = sy = sz = 0.0; for (int l = 0; l < order; l++) { sx += gf_b2[order][l]*xl; sy += gf_b2[order][l]*yl; sz += gf_b2[order][l]*zl; xl *= x2; yl *= y2; zl *= z2; } double s = sx*sy*sz; return s*s; }; }; } #endif #endif /* ERROR/WARNING messages: E: Illegal ... command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: Cannot (yet) use kspace_style pppm/stagger with triclinic systems This feature is not yet supported. E: Out of range atoms - cannot compute PPPM One or more atoms are attempting to map their charge to a PPPM grid point that is not owned by a processor. This is likely for one of two reasons, both of them bad. First, it may mean that an atom near the boundary of a processor's sub-domain has moved more than 1/2 the "neighbor skin distance"_neighbor.html without neighbor lists being rebuilt and atoms being migrated to new processors. This also means you may be missing pairwise interactions that need to be computed. The solution is to change the re-neighboring criteria via the "neigh_modify"_neigh_modify command. The safest settings are "delay 0 every 1 check yes". Second, it may mean that an atom has moved far outside a processor's sub-domain or even the entire simulation box. This indicates bad physics, e.g. due to highly overlapping atoms, too large a timestep, etc. */