text
stringlengths
4
6.14k
/* * librdkafka - Apache Kafka C library * * Copyright (c) 2012-2015 Magnus Edenhill * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #pragma once /** * Provides portable endian-swapping macros/functions. * * be64toh() * htobe64() * be32toh() * htobe32() * be16toh() * htobe16() */ #ifdef __FreeBSD__ #include <sys/endian.h> #elif defined __GLIBC__ #include <endian.h> #ifndef be64toh /* Support older glibc (<2.9) which lack be64toh */ #include <byteswap.h> #if __BYTE_ORDER == __BIG_ENDIAN #define be16toh(x) (x) #define be32toh(x) (x) #define be64toh(x) (x) #else #define be16toh(x) __bswap_16 (x) #define be32toh(x) __bswap_32 (x) #define be64toh(x) __bswap_64 (x) #endif #endif #elif defined __CYGWIN__ #include <endian.h> #elif defined __BSD__ #include <sys/endian.h> #elif defined sun #include <sys/byteorder.h> #include <sys/isa_defs.h> #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #ifdef _BIG_ENDIAN #define __BYTE_ORDER __BIG_ENDIAN #define be64toh(x) (x) #define be32toh(x) (x) #define be16toh(x) (x) #define le16toh(x) ((uint16_t)BSWAP_16(x)) #define le32toh(x) BSWAP_32(x) #define le64toh(x) BSWAP_64(x) #define htole16(x) ((uint16_t)BSWAP_16(x)) #define htole32(x) BSWAP_32(x) #define htole64(x) BSWAP_64(x) # else #define __BYTE_ORDER __LITTLE_ENDIAN #define be64toh(x) BSWAP_64(x) #define be32toh(x) ntohl(x) #define be16toh(x) ntohs(x) #define le16toh(x) (x) #define le32toh(x) (x) #define le64toh(x) (x) #define htole16(x) (x) #define htole32(x) (x) #define htole64(x) (x) #endif /* sun */ #elif defined __APPLE__ #include <sys/_endian.h> #include <libkern/OSByteOrder.h> #define __bswap_64(x) OSSwapInt64(x) #define __bswap_32(x) OSSwapInt32(x) #define __bswap_16(x) OSSwapInt16(x) #if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN #define be64toh(x) (x) #define be32toh(x) (x) #define be16toh(x) (x) #else #define be64toh(x) OSSwapInt64(x) #define be32toh(x) OSSwapInt32(x) #define be16toh(x) OSSwapInt16(x) #endif #elif defined(_MSC_VER) #include <intrin.h> #define be64toh(x) _byteswap_uint64(x) #define be32toh(x) _byteswap_ulong(x) #define be16toh(x) _byteswap_ushort(x) #elif defined _AIX /* AIX is always big endian */ #define be64toh(x) (x) #define be32toh(x) (x) #define be16toh(x) (x) #else #include <endian.h> #endif /* * On Solaris, be64toh is a function, not a macro, so there's no need to error * if it's not defined. */ #if !defined(__sun) && !defined(be64toh) #error Missing definition for be64toh #endif #ifndef be32toh #define be32toh(x) ntohl(x) #endif #ifndef be16toh #define be16toh(x) ntohs(x) #endif #ifndef htobe64 #define htobe64(x) be64toh(x) #endif #ifndef htobe32 #define htobe32(x) be32toh(x) #endif #ifndef htobe16 #define htobe16(x) be16toh(x) #endif
/** * @file range.h * * The classes to represent ranges * * @author Dahua Lin */ #ifdef _MSC_VER #pragma once #endif #ifndef LIGHTMAT_RANGE_H_ #define LIGHTMAT_RANGE_H_ #include <light_mat/common/prim_types.h> namespace lmat { template<class Derived> class IRange { public: LMAT_CRTP_REF LMAT_ENSURE_INLINE index_t get_num(index_t dim) const { return derived().get_num(dim); } LMAT_ENSURE_INLINE index_t get_offset(index_t dim, index_t i) const { return derived().get_offset(dim, i); } }; class whole : public IRange<whole> { public: LMAT_ENSURE_INLINE index_t get_num(index_t dim) const { return dim; } LMAT_ENSURE_INLINE index_t get_offset(index_t, index_t i) const { return i; } }; class range : public IRange<range> { public: LMAT_ENSURE_INLINE range(const index_t i, const index_t n) : m_begin(i), m_num(n) { } LMAT_ENSURE_INLINE index_t begin_index() const { return m_begin; } LMAT_ENSURE_INLINE index_t end_index() const { return m_begin + m_num; } LMAT_ENSURE_INLINE index_t num() const { return m_num; } LMAT_ENSURE_INLINE index_t get_num(index_t ) const { return m_num; } LMAT_ENSURE_INLINE index_t get_offset(index_t, index_t i) const { return m_begin + i; } private: const index_t m_begin; const index_t m_num; }; class step_range : public IRange<step_range> { public: LMAT_ENSURE_INLINE step_range(const index_t i, const index_t n, const index_t s) : m_begin(i), m_num(n), m_step(s) { } LMAT_ENSURE_INLINE index_t begin_index() const { return m_begin; } LMAT_ENSURE_INLINE index_t end_index() const { return m_begin + m_num * m_step; } LMAT_ENSURE_INLINE index_t num() const { return m_num; } LMAT_ENSURE_INLINE index_t step() const { return m_step; } LMAT_ENSURE_INLINE index_t get_num(index_t ) const { return m_num; } LMAT_ENSURE_INLINE index_t get_offset(index_t, index_t i) const { return m_begin + i * m_step; } private: const index_t m_begin; const index_t m_num; const index_t m_step; }; /******************************************** * * MATLAB-like colon expression * * colon(a, b) --> [a, b-1] * * e.g. colon(0, n) --> the whole range * * colon(a, s, b) --> [a, a+s, ..., b) * * Here, b is not included * ********************************************/ LMAT_ENSURE_INLINE inline range colon(index_t a, index_t b) { return range(a, b-a); } LMAT_ENSURE_INLINE inline step_range colon(index_t a, index_t s, index_t b) { index_t n = a <= b ? (s > 0 ? (b - a) / s : 0) : (s < 0 ? (a - b) / (-s) : 0); return step_range(a, n, s); } } #endif
#ifndef SOCKETLITE_SOCKET_SOURCE_H #define SOCKETLITE_SOCKET_SOURCE_H #include "SL_Socket_INET_Addr.h" #include "SL_Socket_Runner.h" class SOCKETLITE_API SL_Socket_Source { public: SL_Socket_Source() : get_msglen_proc_(get_msglen_int16_host) , set_msglen_proc_(set_msglen_int16_host) , socket_handler_(NULL) , socket_runner_(NULL) , recvbuffer_size_(4096) , msgbuffer_size_(4096) , msglen_bytes_(2) , msg_byteorder_(0) , is_add_runner_(true) , is_free_self_handler_(false) { } virtual ~SL_Socket_Source() { } virtual SL_Socket_INET_Addr* get_local_addr() { return NULL; } //SL_TcpClientµÄÌØ¶¨º¯Êý virtual int send(const char *buf, int len, int flag) { return 0; } virtual int recv(char *buf, int len, int flag) { return 0; } virtual bool get_connected() { return false; } virtual bool get_autoconnect() { return false; } virtual int connect() { return -1; } virtual int disconnect(SL_Socket_Handler *socket_handler) { return -1; } inline SL_Socket_Handler* get_socket_handler() { return socket_handler_; } inline SL_Socket_Runner* get_socket_runner() { return socket_runner_; } inline uint get_recvbuffer_size() const { return recvbuffer_size_; } inline uint get_msgbuffer_size() const { return msgbuffer_size_; } inline uint8 get_msglen_bytes() const { return msglen_bytes_; } inline uint8 get_msg_byteorder() const { return msg_byteorder_; } inline bool get_add_runner() const { return is_add_runner_; } static int get_msglen_int8(const char *msg, int len) { return *msg; } static int get_msglen_int16_host(const char *msg, int len) { return *((int16 *)msg); } static int get_msglen_int16_network(const char *msg, int len) { return ntohs(*((int16 *)msg)); } static int get_msglen_int32_host(const char *msg, int len) { return *((int32 *)msg); } static int get_msglen_int32_network(const char *msg, int len) { return ntohl(*((int32 *)msg)); } static void set_msglen_int8(char *msg, int len) { *msg = len; } static void set_msglen_int16_host(char *msg, int len) { *((int16 *)msg) = len; } static void set_msglen_int16_network(char *msg, int len) { *((int16 *)msg) = htons(len); } static void set_msglen_int32_host(char *msg, int len) { *((int32 *)msg) = len; } static void set_msglen_int32_network(char *msg, int len) { *((int32 *)msg) = htonl(len); } public: virtual SL_Socket_Handler* alloc_handler() { return NULL; } virtual void free_handler(SL_Socket_Handler *socket_handler) { return; } typedef int (*get_msglen_proc)(const char *msg, int len); typedef void (*set_msglen_proc)(char *msg, int len); get_msglen_proc get_msglen_proc_; //È¡µÃÏûÏ¢³¤¶Èº¯ÊýÖ¸Õë set_msglen_proc set_msglen_proc_; //ÉèÖÃÏûÏ¢³¤¶Èº¯ÊýÖ¸Õë protected: SL_Socket_Handler *socket_handler_; SL_Socket_Runner *socket_runner_; uint recvbuffer_size_; uint msgbuffer_size_; uint8 msglen_bytes_; //ÏûÏ¢³¤¶ÈÓòËùÕ¼×Ö½ÚÊý(Ò»°ãΪ1,2,4) uint8 msg_byteorder_; //ÏûÏ¢µÄ×Ö½Ú˳Ðò(0:host-byte,1:big endian(network-byte) 2:little endian) bool is_add_runner_; //ÐÂÁ¬½ÓÊÇ·ñ¼ÓÈëSocket_RunnerÖУ¬½øÐÐʼþ·ÖÅÉ bool is_free_self_handler_; //¿É·ñÊÍ·ÅSource±¾ÉíµÄsocket_handler_, //Èôsocket_handler_¼ÓÈëSL_Socket_SendControl_HandlerManagerʱ£¬Ó¦Îªfalse }; #endif
/* * Copyright (c) 2016, The OpenThread Authors. * 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 copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @file * @brief * This file defines the top-level functions for the OpenThread library. */ #ifndef OPENTHREAD_H_ #define OPENTHREAD_H_ #include "openthread/types.h" #include "openthread/crypto.h" #include "openthread/dataset.h" #include "openthread/instance.h" #include "openthread/ip6.h" #include "openthread/link.h" #include "openthread/message.h" #include "openthread/netdata.h" #include "openthread/tasklet.h" #include "openthread/thread.h" #ifdef __cplusplus extern "C" { #endif /** * @defgroup api API * @brief * This module includes the application programming interface to the OpenThread stack. * * @{ * * @defgroup execution Execution * @defgroup commands Commands * @defgroup config Configuration * @defgroup diags Diagnostics * @defgroup messages Message Buffers * @defgroup ip6 IPv6 * @defgroup udp UDP * @defgroup coap CoAP * * @} * */ /** * @defgroup platform Platform Abstraction * @brief * This module includes the platform abstraction used by the OpenThread stack. * * @{ * @} * */ /** * @defgroup core Core * @brief * This module includes the core OpenThread stack. * * @{ * * @defgroup core-6lowpan 6LoWPAN * @defgroup core-coap CoAP * @defgroup core-global-address Global IPv6 Address * @defgroup core-ipv6 IPv6 * @defgroup core-mac MAC * @defgroup core-mesh-forwarding Mesh Forwarding * @defgroup core-message Message * @defgroup core-mle MLE * @defgroup core-netdata Network Data * @defgroup core-netif Network Interface * @defgroup core-arp RLOC Mapping * @defgroup core-security Security * @defgroup core-tasklet Tasklet * @defgroup core-timer Timer * @defgroup core-udp UDP * @defgroup core-tcp TCP * @defgroup core-link-quality Link Quality * * @} * */ /** * Get the OpenThread version string. * * @returns A pointer to the OpenThread version. * */ OTAPI const char *OTCALL otGetVersionString(void); /** * This function converts a ThreadError enum into a string. * * @param[in] aError A ThreadError enum. * * @returns A string representation of a ThreadError. * */ OTAPI const char *OTCALL otThreadErrorToString(ThreadError aError); #ifdef __cplusplus } // extern "C" #endif #endif // OPENTHREAD_H_
/* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #include "util.h" #include <stdint.h> /* These functions are only used for testing. */ uint32_t fbi_test_next_pow2(uint32_t u32) { return next_pow2(u32); } uint64_t fbi_test_swap_uint64_t(uint64_t u64) { return fbi_swap_uint64_t(u64); } uint64_t fbi_test_htonll(uint64_t u64) { return fbi_htonll(u64); }
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: // ============================================================================= // // M113 driveline model based on ChShaft objects. // // ============================================================================= #ifndef M113_DRIVELINE_BDS_H #define M113_DRIVELINE_BDS_H #include "chrono_vehicle/tracked_vehicle/driveline/ChTrackDrivelineBDS.h" #include "chrono_models/ChApiModels.h" namespace chrono { namespace vehicle { namespace m113 { /// @addtogroup vehicle_models_m113 /// @{ /// Shafts-based driveline model for the M113 vehicle. class CH_MODELS_API M113_DrivelineBDS : public ChTrackDrivelineBDS { public: M113_DrivelineBDS(); ~M113_DrivelineBDS() {} virtual double GetDriveshaftInertia() const override { return m_driveshaft_inertia; } virtual double GetDifferentialBoxInertia() const override { return m_differentialbox_inertia; } virtual double GetConicalGearRatio() const override { return m_conicalgear_ratio; } private: // Shaft inertias static const double m_driveshaft_inertia; static const double m_differentialbox_inertia; // Gear ratio static const double m_conicalgear_ratio; }; /// @} vehicle_models_m113 } // end namespace m113 } // end namespace vehicle } // end namespace chrono #endif
/****************************************************************************** This source file is part of the Avogadro project. Copyright 2019 Kitware, Inc. This source code is released under the New BSD License, (the "License"). 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 AVOGADRO_QTPLUGINS_GIRDERREQUEST_H #define AVOGADRO_QTPLUGINS_GIRDERREQUEST_H #include <QList> #include <QNetworkRequest> #include <QPair> #include <QString> class QNetworkAccessManager; class QNetworkReply; namespace Avogadro { namespace QtPlugins { class GirderRequest : public QObject { Q_OBJECT public: GirderRequest(QNetworkAccessManager* networkManager, const QString& girderUrl, const QString& girderToken = "", QObject* parent = nullptr); // Calls the respective HTTP method on the girder url void get(); void post(const QByteArray& data); void put(const QByteArray& data); void setUrlQueries(const QList<QPair<QString, QString>>& queries) { m_urlQueries = queries; } void setHeader(QNetworkRequest::KnownHeaders header, const QVariant& value) { m_headers[header] = value; } signals: // Emitted when there is an error void error(const QString& msg, QNetworkReply* networkReply = nullptr); // Emitted when there are results void result(const QVariant& results); protected slots: void onFinished(); protected: QString m_girderUrl; QString m_girderToken; QNetworkAccessManager* m_networkManager; QList<QPair<QString, QString>> m_urlQueries; QMap<QNetworkRequest::KnownHeaders, QVariant> m_headers; }; } // namespace QtPlugins } // namespace Avogadro #endif
/***************************************************************************** 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 dlaswp * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_dlascl( int matrix_layout, char type, lapack_int kl, lapack_int ku, double cfrom, double cto, lapack_int m, lapack_int n, double* a, lapack_int lda ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dlascl", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ switch (type) { case 'G': if( LAPACKE_dge_nancheck( matrix_layout, lda, n, a, lda ) ) { return -9; } break; case 'L': // TYPE = 'L' - lower triangular matrix. if( LAPACKE_dtr_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) { return -9; } break; case 'U': // TYPE = 'U' - upper triangular matrix if( LAPACKE_dtr_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) { return -9; } break; case 'H': // TYPE = 'H' - upper Hessenberg matrix if( LAPACKE_dhs_nancheck( matrix_layout, n, a, lda ) ) { return -9; } break; case 'B': // TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL // and upper bandwidth KU and with the only the lower // half stored. if( LAPACKE_dsb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { return -9; } break; case 'Q': // TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL // and upper bandwidth KU and with the only the upper // half stored. if( LAPACKE_dsb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) { return -9; } break; case 'Z': // TYPE = 'Z' - A is a band matrix with lower bandwidth KL and upper // bandwidth KU. See DGBTRF for storage details. if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) { return -6; } break; } #endif return LAPACKE_dlascl_work( matrix_layout, type, kl, ku, cfrom, cto, m, n, a, lda ); }
void RunSetup(rle_hdr * the_hdr); void RunSkipBlankLines(int nblank, rle_hdr * the_hdr); void RunSetColor(int c, rle_hdr * the_hdr); void RunSkipPixels(int nskip, int last, int wasrun, rle_hdr * the_hdr); void RunNewScanLine(int flag, rle_hdr * the_hdr); void Runputdata(rle_pixel * buf, int n, rle_hdr * the_hdr); void Runputrun(int color, int n, int last, rle_hdr * the_hdr); void RunputEof(rle_hdr * the_hdr);
#ifndef _H5ARRAY_H #define _H5ARRAY_H #include <hdf5.h> #define TESTING(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} #define PASSED() {puts(" PASSED");fflush(stdout);} #define H5_FAILED() {puts("*FAILED*");fflush(stdout);} #define SKIPPED() {puts(" -SKIP-");fflush(stdout);} #ifdef __cplusplus extern "C" { #endif hid_t H5ARRAYmake( hid_t loc_id, const char *dset_name, const char *obversion, const int rank, const hsize_t *dims, int extdim, hid_t type_id, hsize_t *dims_chunk, void *fill_data, int compress, char *complib, int shuffle, int fletcher32, hbool_t track_times, const void *data); herr_t H5ARRAYappend_records( hid_t dataset_id, hid_t type_id, const int rank, hsize_t *dims_orig, hsize_t *dims_new, int extdim, const void *data ); herr_t H5ARRAYwrite_records( hid_t dataset_id, hid_t type_id, const int rank, hsize_t *start, hsize_t *step, hsize_t *count, const void *data ); herr_t H5ARRAYread( hid_t dataset_id, hid_t type_id, hsize_t start, hsize_t nrows, hsize_t step, int extdim, void *data ); herr_t H5ARRAYreadSlice( hid_t dataset_id, hid_t type_id, hsize_t *start, hsize_t *stop, hsize_t *step, void *data ); herr_t H5ARRAYreadIndex( hid_t dataset_id, hid_t type_id, int notequal, hsize_t *start, hsize_t *stop, hsize_t *step, void *data ); herr_t H5ARRAYget_ndims( hid_t dataset_id, int *rank ); herr_t H5ARRAYget_info( hid_t dataset_id, hid_t type_id, hsize_t *dims, hsize_t *maxdims, H5T_class_t *class_id, char *byteorder); herr_t H5ARRAYget_chunkshape( hid_t dataset_id, int rank, hsize_t *dims_chunk); herr_t H5ARRAYget_fill_value( hid_t dataset_id, hid_t type_id, int *status, void *value); #ifdef __cplusplus } #endif #endif
/* * Copyright 2009, 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 PURITAN_RAND_H #define PURITAN_RAND_H // Use a strong RNG if available. // TODO: Investigate using openssl on all platforms. #ifdef _WIN32 #include <windows.h> #include <wincrypt.h> #else typedef void* HCRYPTPROV; #endif namespace Salem { namespace Puritan { class Rand { public: unsigned y; unsigned rnd_uint(void) ; Rand(unsigned seed); double rnd_flt(void); int range(int lo, int hi); unsigned urange(unsigned lo, unsigned hi); size_t srange(size_t lo, size_t hi); const char *from_list (const char **); private: bool InitializeProvider(); HCRYPTPROV crypt_provider_; static const size_t kCacheSize = 0x1000; unsigned int cached_numbers_[kCacheSize]; long available_; }; } } #endif
/* * Copyright (C) 2008, 2009 Apple 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: * * 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 Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE 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 ImageData_h #define ImageData_h #include "IntSize.h" #include <runtime/Uint8ClampedArray.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> namespace WebCore { class ImageData : public RefCounted<ImageData> { public: static PassRefPtr<ImageData> create(const IntSize&); static PassRefPtr<ImageData> create(const IntSize&, PassRefPtr<Uint8ClampedArray>); IntSize size() const { return m_size; } int width() const { return m_size.width(); } int height() const { return m_size.height(); } Uint8ClampedArray* data() const { return m_data.get(); } private: explicit ImageData(const IntSize&); ImageData(const IntSize&, PassRefPtr<Uint8ClampedArray>); IntSize m_size; RefPtr<Uint8ClampedArray> m_data; }; } // namespace WebCore #endif // ImageData_h
/*- * Copyright (c) 2014 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * $FreeBSD$ */ #ifndef _VATPIC_H_ #define _VATPIC_H_ #include <isa/isareg.h> #define ICU_IMR_OFFSET 1 #define IO_ELCR1 0x4d0 #define IO_ELCR2 0x4d1 struct vatpic *vatpic_init(struct vm *vm); void vatpic_cleanup(struct vatpic *vatpic); int vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax); int vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax); int vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax); int vatpic_assert_irq(struct vm *vm, int irq); int vatpic_deassert_irq(struct vm *vm, int irq); int vatpic_pulse_irq(struct vm *vm, int irq); int vatpic_set_irq_trigger(struct vm *vm, int irq, enum vm_intr_trigger trigger); void vatpic_pending_intr(struct vm *vm, int *vecptr); void vatpic_intr_accepted(struct vm *vm, int vector); #endif /* _VATPIC_H_ */
/* * This software is distributed under BSD 3-clause license (see LICENSE file). * * Authors: Shashwat Lal Das, Fernando Iglesias, Yuyu Zhang, Bjoern Esser */ #ifndef _HINGELOSS_H__ #define _HINGELOSS_H__ #include <shogun/lib/config.h> #include <shogun/loss/LossFunction.h> namespace shogun { /** @brief CHingeLoss implements the hinge * loss function. */ class CHingeLoss: public CLossFunction { public: /** * Constructor */ CHingeLoss(): CLossFunction() {}; /** * Destructor */ ~CHingeLoss() {}; /** * Get loss for an example * * @param prediction prediction * @param label label * * @return loss */ float64_t loss(float64_t prediction, float64_t label); /** * Get loss for an example. The definition used for the * hinge loss computed by this method is f(x) = max(0, x). * * @param z where to evaluate the loss * * @return loss */ float64_t loss(float64_t z); /** * Get first derivative of the loss function * * @param prediction prediction * @param label label * * @return first derivative */ virtual float64_t first_derivative(float64_t prediction, float64_t label); /** * Get first derivative of the loss function * * @param z where to evaluate the derivative of the loss * * @return first derivative */ virtual float64_t first_derivative(float64_t z); /** * Get second derivative of the loss function * * @param prediction prediction * @param label label * * @return second derivative */ virtual float64_t second_derivative(float64_t prediction, float64_t label); /** * Get second derivative of the loss function * * @param z where to evaluate the second derivative of the loss * * @return second derivative */ virtual float64_t second_derivative(float64_t z); /** * Get importance aware weight update for this loss function * * @param prediction prediction * @param label label * @param eta_t learning rate at update number t * @param norm scale value * * @return update */ virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm); /** * Get square of gradient, used for adaptive learning * * @param prediction prediction * @param label label * * @return square of gradient */ virtual float64_t get_square_grad(float64_t prediction, float64_t label); /** * Return type of loss * * @return L_HINGELOSS */ virtual ELossType get_loss_type() { return L_HINGELOSS; } virtual const char* get_name() const { return "HingeLoss"; } }; } #endif
/* crypto/idea/i_ofb64.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * 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 copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include <openssl/idea.h> #include "idea_lcl.h" /* * The input and output encrypted as though 64bit ofb mode is being used. * The extra state information to record how much of the 64bit block we have * used is contained in *num; */ void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *schedule, unsigned char *ivec, int *num) { register IDEA_INT v0, v1, t; register int n = *num; register long l = length; unsigned char d[8]; register char *dp; IDEA_INT ti[2]; unsigned char *iv; int save = 0; iv = (unsigned char *)ivec; n2l(iv, v0); n2l(iv, v1); ti[0] = v0; ti[1] = v1; dp = (char *)d; l2n(v0, dp); l2n(v1, dp); while (l--) { if (n == 0) { idea_encrypt(ti, schedule); dp = (char *)d; t = ti[0]; l2n(t, dp); t = ti[1]; l2n(t, dp); save++; } *(out++) = *(in++) ^ d[n]; n = (n + 1) & 0x07; } if (save) { v0 = ti[0]; v1 = ti[1]; iv = (unsigned char *)ivec; l2n(v0, iv); l2n(v1, iv); } t = v0 = v1 = ti[0] = ti[1] = 0; *num = n; }
// // RootViewController_iPad.h // REActivityViewControllerExample // // Created by Roman Efimov on 1/24/13. // Copyright (c) 2013 Roman Efimov. All rights reserved. // #import <UIKit/UIKit.h> @interface RootViewController_iPad : UIViewController { UIPopoverController *_activityPopoverController; } @end
/**************************************************************************************** Copyright (C) 2014 Autodesk, Inc. All rights reserved. Use of this software is subject to the terms of the Autodesk license agreement provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. ****************************************************************************************/ //! \file fbxstatistics.h #ifndef _FBXSDK_FILEIO_STATISTICS_H_ #define _FBXSDK_FILEIO_STATISTICS_H_ #include <fbxsdk/fbxsdk_def.h> #include <fbxsdk/core/base/fbxarray.h> #include <fbxsdk/core/base/fbxstring.h> #include <fbxsdk/fbxsdk_nsbegin.h> /** This class is a basic class to get the quantity of items. * User processes the statistics raw data by deriving FbxStatistics class and overrides \c AddItem method. * When overriding \c AddItem method, User must store item's name and item's count by pair which means * The index of one item's name in array \c mItemName is the same as the index of this item's count in array \c mItemCount. * * \code Here is a code snippet to show how it used. * //Define my own statistics class. * class MyStatistics : public FbxStatistics * { * public: virtual bool AddItem(FbxString& pItemName, int pItemCount) { mItemName.Add( FbxSdkNew< FbxString >(pItemName) ); mItemCount.Add( pItemCount); return true; }; * }; * * FbxManager* lSdkManager = FbxManager::Create(); * FbxScene* lScene = FbxScene::Create( lSdkManager, "Scene"); * FbxNode* lNode1 = FbxNode::Create(lScene, "Node1"); * FbxNode* lNode2 = FbxNode::Create(lScene, "Node2"); * FbxNode* lNode3 = FbxNode::Create(lScene, "Node3"); * FbxNode* lNode4 = FbxNode::Create(lScene, "Node4"); * lScene.AddNode(lNode1); * lScene.AddNode(lNode2); * lScene.AddNode(lNode3); * MyStatistics lStatistics; * lStatistics.AddItem("Node_Count", lScene.GetNodeCount() ); * FbxString lItemName; * int lItemCount; * if( lStatistics.GetItemPair( 0, lItemName, lItemCount)) * { * //do something * } * \endcode * \nosubgrouping */ class FBXSDK_DLL FbxStatistics { public: /// \name Constructor and Destructor. //@{ FbxStatistics(); virtual ~FbxStatistics(); //@} //! Reset the statistics. void Reset(); //! Get the number of items. int GetNbItems() const; /** Get the statistics information by pair. * \param pNum The index of statistics data to be got. * \param pItemName Output the item's name. * \param pItemCount Output the item's count. * \return \c True if successful, \c False otherwise. */ bool GetItemPair(int pNum, FbxString& pItemName, int& pItemCount) const; /** Assignment operator. * \param pStatistics FbxStatistics assigned to this one. */ FbxStatistics& operator=(const FbxStatistics& pStatistics); protected: /** virtual function to define the process of the incoming statistics data. * \param pItemName The item's name * \param pItemCount The item's count. * \return False. */ virtual bool AddItem(FbxString& /*pItemName*/, int /*pItemCount*/) { return false; }; //! An array to store item's name. FbxArray<FbxString*> mItemName; //! An array to store item's count. FbxArray<int> mItemCount; }; #include <fbxsdk/fbxsdk_nsend.h> #endif /* _FBXSDK_FILEIO_STATISTICS_H_ */
/* An interface to write that retries after interrupts. Copyright (C) 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SAFE_WRITE #include "safe-read.c"
#ifndef __DXT_COMPRESSOR_H__ #define __DXT_COMPRESSOR_H__ /* ------------------------------------------------------------------------------------------------------------------------------------ */ // Includes #include <GL/glew.h> #include <GL/glut.h> #include <Cg/cg.h> #include <Cg/cgGL.h> /* ------------------------------------------------------------------------------------------------------------------------------------ */ // Forward decls. class FramebufferObject; class Renderbuffer; /* ------------------------------------------------------------------------------------------------------------------------------------ */ enum CompressionType { DXT1, DXT5_YCOCG, }; /* ------------------------------------------------------------------------------------------------------------------------------------ */ class DXTCompressor { public: DXTCompressor(); public: // These need to be called before using the compressor, and shutdown after using the compressor static bool Initialize(); static void Shutdown(); // Compresses input data into the desired compressed format. // The input data is assumed to be 32-bit RGBA (1 byte per channel). // outputData should be allocated to at least GetBufferSize() // This will return true if the compression is successful. static bool CompressImageData( CompressionType compressionType, const void *inputRGBA, int inputWidth, int inputHeight, void *outputData, bool bDisplayResults, bool sourceFormatIsBGRA ); static int GetBufferSize(CompressionType compressionType, int inputWidth, int inputHeight ); // Saves the compressed data into a Microsoft DDS file. static int GetDDSHeaderSize(void); static void WriteDDSHeader( CompressionType compressionType, int width, int height, int compresedDataLength, void *outputData ); static void WriteDDSMemoryFile( CompressionType compressionType, int width, int height, const void* pCompressedData, int compresedDataLength, void **outputData, int *outputLength ); // Prints out the accumulated performance of the compressor static void PrintPerformanceLog(); private: void SetShaderConstants(); void CompressInternal( bool sourceFormatIsBGRA); void DoCompression( void* ppOutputData, bool sourceFormatIsBGRA ); static bool InitOpenGL(); static bool InitCG(); static void cgErrorCallback(); static bool IsInitialized(); static void DisplayTexture( GLuint textureID, int texW, int texH ); static FramebufferObject* RequestFBO( CompressionType compressionType, int width, int height ); static void DeallocateBuffers(); private: // Image related data int m_imageWidth; int m_imageHeight; CompressionType m_compressionType; GLuint m_imageTexId; FramebufferObject* m_pCompressFbo; GLuint m_compressFboTex; // CG related data static int m_initRefCount; static CGcontext m_cgContext; static CGprofile m_cgVProfile, m_cgFProfile; static CGprogram m_compressVProg, m_compressDXT1RGBAFProg, m_compressDXT5RGBAFProg, m_compressDXT1BGRAFProg, m_compressDXT5BGRAFProg; // Used to collect stats static int m_numIterations; static int m_currentImageWidth, m_currentImageHeight; static float m_lastCompressionTime; static float m_accumulatedTime; static float m_timeRunningCompressionShader; static float m_timeCopyingPixelDataToCPU; }; #endif // __DXT_COMPRESSOR_H__
/********************************************************************** Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 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 THREAD_POOL_H #define THREAD_POOL_H #include <queue> #include <thread> #include <mutex> #include <condition_variable> #include <atomic> #include <future> #include <iostream> namespace RadeonRays { ///< An implementation of a concurrent queue ///< which is providing the means to wait until ///< elements are available or use non-blocking ///< try_pop method. ///< template <typename T> class thread_safe_queue { public: thread_safe_queue(){} ~thread_safe_queue(){} // Push element: one of the threads is going to // be woken up to process this if any void push(T const& t) { std::lock_guard<std::mutex> lock(mutex_); queue_.push(t); cv_.notify_one(); } // Push element: one of the threads is going to // be woken up to process this if any void push(T&& t) { std::lock_guard<std::mutex> lock(mutex_); queue_.push(std::move(t)); cv_.notify_one(); } // Wait until there are element to process. void wait_and_pop(T& t) { std::unique_lock<std::mutex> lock(mutex_); cv_.wait(lock, [this](){return !queue_.empty();}); t = queue_.front(); queue_.pop(); } // Try to pop element. Returns true if element has been popped, // false if there are no element in the queue bool try_pop(T& t) { std::lock_guard<std::mutex> lock(mutex_); if (queue_.empty()) return false; t = std::move(queue_.front()); queue_.pop(); return true; } size_t size() const { std::unique_lock<std::mutex> lock(mutex_); return queue_.size(); } private: mutable std::mutex mutex_; std::condition_variable cv_; std::queue<T> queue_; }; ///< Thread pool implementation which is using concurrency ///< available in the system ///< template <typename RetType> class thread_pool { public: explicit thread_pool(int sleep_time = 50) : sleep_time_(sleep_time) { done_ = false; int num_threads = std::thread::hardware_concurrency(); num_threads = num_threads == 0 ? 2 : num_threads; //#ifdef _DEBUG // std::cout << num_threads << " hardware threads available\n"; //#endif for (int i=0; i < num_threads; ++i) { threads_.push_back(std::thread(&thread_pool::run_loop, this)); } } ~thread_pool() { done_ = true; std::for_each(threads_.begin(), threads_.end(), std::mem_fun_ref(&std::thread::join)); } // Submit a new task into the pool. Future is returned in // order for caller to track the execution of the task std::future<RetType> submit(std::function<RetType()>&& f) { std::packaged_task<RetType()> task(std::move(f)); auto future = task.get_future(); work_queue_.push(std::move(task)); return future; } size_t size() const { return work_queue_.size(); } void setSleepTime(int sleep_time) { sleep_time_ = sleep_time; } private: void run_loop() { std::packaged_task<RetType()> f; while(!done_) { if (work_queue_.try_pop(f)) { f(); } else { std::this_thread::sleep_for(std::chrono::milliseconds(sleep_time_)); } } } thread_safe_queue<std::packaged_task<RetType()> > work_queue_; std::atomic_bool done_; std::vector<std::thread> threads_; int sleep_time_; }; } #endif
/* Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. Distributed by Free Software Foundation, Inc. This file is part of Ghostscript. Ghostscript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the Ghostscript General Public License for full details. Everyone is granted permission to copy, modify and redistribute Ghostscript, but only under the conditions described in the Ghostscript General Public License. A copy of this license is supposed to have been given to you along with Ghostscript so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ /* zcolor.c */ /* Color operators for GhostScript */ #include "ghost.h" #include "errors.h" #include "oper.h" #include "alloc.h" #include "store.h" #include "gsmatrix.h" /* for gs_state */ #include "gsstate.h" #include "state.h" /* Imported from util.c */ extern int num_params(P3(ref *, int, float *)); /* Imported from zgstate.c */ extern void tri_put(P2(ref *, float [3])); /* Forward declarations */ private int make_color(P1(ref *)); /* currentgscolor */ int zcurrentgscolor(register ref *op) { int code; push(1); if ( (code = make_color(op)) < 0 || (code = gs_currentgscolor(igs, op->value.pcolor)) < 0 ) pop(1); return code; } /* setgscolor */ int zsetgscolor(register ref *op) { int code; check_type(*op, t_color); if ( (code = gs_setgscolor(igs, op->value.pcolor)) < 0 ) return code; pop(1); return 0; } /* ------ Initialization procedure ------ */ void zcolor_op_init() { static op_def my_defs[] = { {"0currentgscolor", zcurrentgscolor}, {"1setgscolor", zsetgscolor}, op_def_end }; z_op_init(my_defs); } /* ------ Internal routines ------ */ /* Make a color object */ private int make_color(ref *op) { gs_color *cp = (gs_color *)alloc(1, gs_color_sizeof, "make_color"); if ( cp == 0 ) return e_VMerror; make_tv(op, t_color, pcolor, cp); return 0; }
// // DPCalendarTestViewController.h // DPCalendar // // Created by Ethan Fang on 19/12/13. // Copyright (c) 2013 Ethan Fang. All rights reserved. // #import <UIKit/UIKit.h> @interface DPCalendarTestViewController : UIViewController @end
#pragma once #include <string> struct Device { std::string family; }; struct Agent : Device { std::string major; std::string minor; std::string patch; std::string toString() const { return family + " " + toVersionString(); } std::string toVersionString() const { return (major.empty() ? "0" : major) + "." + (minor.empty() ? "0" : minor) + "." + (patch.empty() ? "0" : patch); } }; typedef Agent Os; typedef Agent Browser; struct UserAgent { Device device; Os os; Browser browser; std::string toFullString() const { return browser.toString() + "/" + os.toString(); } bool isSpider() const { return device.family == "Spider"; } }; class UserAgentParser { public: explicit UserAgentParser(const std::string& regexes_file_path); UserAgent parse(const std::string&) const; ~UserAgentParser(); private: const std::string regexes_file_path_; const void* ua_store_; };
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright 2003 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // ////////////////////////////////////////////////////////////////////////////// // // Name: AcFdUi.h // // Description: Header for global methods exported from AcFdUi module // ////////////////////////////////////////////////////////////////////////////// #pragma once #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifdef ACFD_API # define ACFDUI_PORT __declspec(dllexport) #else # define ACFDUI_PORT #endif class CAcFdUiFieldManager; // Category ids #define ACFDUI_CATEGORY_ID_ALL -1 // Verticals and other applications can use category ids starting from // this #define ACFDUI_CATID_USER_FIRST 1000 // Verticals and other applications can use field ids starting from this #define ACFDUI_FIELDID_USER_FIRST 50000 // Exported public functions // ACFDUI_PORT CAcFdUiFieldManager* AcFdUiGetFieldManager(void); ACFDUI_PORT int AcFdUiInvokeFieldDialog(AcDbField*& pNewField, BOOL bEdit, AcDbDatabase* pDb, CWnd* pParent = NULL);
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Controls\0.19.3\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Animations.IResize.h> #include <Fuse.Controls.Panel.h> #include <Fuse.IActualPlacement.h> #include <Fuse.Navigation.INavigationPanel.h> #include <Fuse.Node.h> #include <Fuse.Scripting.INameScope.h> #include <Fuse.Triggers.Actions.ICollapse.h> #include <Fuse.Triggers.Actions.IHide.h> #include <Fuse.Triggers.Actions.IShow.h> #include <Fuse.Triggers.IAddRemove-1.h> namespace g{namespace Fuse{namespace Controls{struct WrapPanel;}}} namespace g{namespace Fuse{namespace Layouts{struct WrapLayout;}}} namespace g{ namespace Fuse{ namespace Controls{ // public sealed class WrapPanel :4732 // { ::g::Fuse::Controls::Panel_type* WrapPanel_typeof(); void WrapPanel__ctor_4_fn(WrapPanel* __this); void WrapPanel__get_FlowDirection_fn(WrapPanel* __this, int* __retval); void WrapPanel__set_FlowDirection_fn(WrapPanel* __this, int* value); void WrapPanel__get_ID_fn(WrapPanel* __this, uString** __retval); void WrapPanel__set_ID_fn(WrapPanel* __this, uString* value); void WrapPanel__get_ItemHeight_fn(WrapPanel* __this, float* __retval); void WrapPanel__set_ItemHeight_fn(WrapPanel* __this, float* value); void WrapPanel__get_ItemWidth_fn(WrapPanel* __this, float* __retval); void WrapPanel__set_ItemWidth_fn(WrapPanel* __this, float* value); void WrapPanel__New2_fn(WrapPanel** __retval); void WrapPanel__get_Orientation_fn(WrapPanel* __this, int* __retval); void WrapPanel__set_Orientation_fn(WrapPanel* __this, int* value); struct WrapPanel : ::g::Fuse::Controls::Panel { uStrong< ::g::Fuse::Layouts::WrapLayout*> _wrapLayout; void ctor_4(); int FlowDirection(); void FlowDirection(int value); uString* ID(); void ID(uString* value); float ItemHeight(); void ItemHeight(float value); float ItemWidth(); void ItemWidth(float value); int Orientation(); void Orientation(int value); static WrapPanel* New2(); }; // } }}} // ::g::Fuse::Controls
// // GADDynamicHeightSearchRequest.h // GoogleMobileAds // // Copyright © 2016 Google Inc. All rights reserved. // #import <GoogleMobileAds/GADRequest.h> #import <GoogleMobileAds/GoogleMobileAdsDefines.h> NS_ASSUME_NONNULL_BEGIN /// Use to configure Custom Search Ad (CSA) ad requests. A dynamic height search banner can contain /// multiple ads and the height is set dynamically based on the ad contents. Please cross-reference /// the property sections and properties with the official reference document: /// https://developers.google.com/custom-search-ads/docs/reference GAD_SUBCLASSING_RESTRICTED @interface GADDynamicHeightSearchRequest : GADRequest #pragma mark - Page Level Parameters #pragma mark Required /// The CSA "query" parameter. @property(nonatomic, copy, nullable) NSString *query; /// The CSA "adPage" parameter. @property(nonatomic, assign) NSInteger adPage; #pragma mark Configuration Settings /// Indicates if the CSA "adTest" parameter is enabled. @property(nonatomic, assign) BOOL adTestEnabled; /// The CSA "channel" parameter. @property(nonatomic, copy, nullable) NSString *channel; /// The CSA "hl" parameter. @property(nonatomic, copy, nullable) NSString *hostLanguage; #pragma mark Layout and Styling /// The CSA "colorLocation" parameter. @property(nonatomic, copy, nullable) NSString *locationExtensionTextColor; /// The CSA "fontSizeLocation" parameter. @property(nonatomic, assign) CGFloat locationExtensionFontSize; #pragma mark Ad Extensions /// Indicates if the CSA "clickToCall" parameter is enabled. @property(nonatomic, assign) BOOL clickToCallExtensionEnabled; /// Indicates if the CSA "location" parameter is enabled. @property(nonatomic, assign) BOOL locationExtensionEnabled; /// Indicates if the CSA "plusOnes" parameter is enabled. @property(nonatomic, assign) BOOL plusOnesExtensionEnabled; /// Indicates if the CSA "sellerRatings" parameter is enabled. @property(nonatomic, assign) BOOL sellerRatingsExtensionEnabled; /// Indicates if the CSA "siteLinks" parameter is enabled. @property(nonatomic, assign) BOOL siteLinksExtensionEnabled; #pragma mark - Unit Level Parameters #pragma mark Required /// The CSA "width" parameter. @property(nonatomic, copy, nullable) NSString *CSSWidth; /// Configuration Settings /// The CSA "number" parameter. @property(nonatomic, assign) NSInteger numberOfAds; #pragma mark Font /// The CSA "fontFamily" parameter. @property(nonatomic, copy, nullable) NSString *fontFamily; /// The CSA "fontFamilyAttribution" parameter. @property(nonatomic, copy, nullable) NSString *attributionFontFamily; /// The CSA "fontSizeAnnotation" parameter. @property(nonatomic, assign) CGFloat annotationFontSize; /// The CSA "fontSizeAttribution" parameter. @property(nonatomic, assign) CGFloat attributionFontSize; /// The CSA "fontSizeDescription" parameter. @property(nonatomic, assign) CGFloat descriptionFontSize; /// The CSA "fontSizeDomainLink" parameter. @property(nonatomic, assign) CGFloat domainLinkFontSize; /// The CSA "fontSizeTitle" parameter. @property(nonatomic, assign) CGFloat titleFontSize; #pragma mark Color /// The CSA "colorAdBorder" parameter. @property(nonatomic, copy, nullable) NSString *adBorderColor; /// The CSA "colorAdSeparator" parameter. @property(nonatomic, copy, nullable) NSString *adSeparatorColor; /// The CSA "colorAnnotation" parameter. @property(nonatomic, copy, nullable) NSString *annotationTextColor; /// The CSA "colorAttribution" parameter. @property(nonatomic, copy, nullable) NSString *attributionTextColor; /// The CSA "colorBackground" parameter. @property(nonatomic, copy, nullable) NSString *backgroundColor; /// The CSA "colorBorder" parameter. @property(nonatomic, copy, nullable) NSString *borderColor; /// The CSA "colorDomainLink" parameter. @property(nonatomic, copy, nullable) NSString *domainLinkColor; /// The CSA "colorText" parameter. @property(nonatomic, copy, nullable) NSString *textColor; /// The CSA "colorTitleLink" parameter. @property(nonatomic, copy, nullable) NSString *titleLinkColor; #pragma mark General Formatting /// The CSA "adBorderSelections" parameter. @property(nonatomic, copy, nullable) NSString *adBorderCSSSelections; /// The CSA "adjustableLineHeight" parameter. @property(nonatomic, assign) CGFloat adjustableLineHeight; /// The CSA "attributionSpacingBelow" parameter. @property(nonatomic, assign) CGFloat attributionBottomSpacing; /// The CSA "borderSelections" parameter. @property(nonatomic, copy, nullable) NSString *borderCSSSelections; /// Indicates if the CSA "noTitleUnderline" parameter is enabled. @property(nonatomic, assign) BOOL titleUnderlineHidden; /// Indicates if the CSA "titleBold" parameter is enabled. @property(nonatomic, assign) BOOL boldTitleEnabled; /// The CSA "verticalSpacing" parameter. @property(nonatomic, assign) CGFloat verticalSpacing; #pragma mark Ad Extensions /// Indicates if the CSA "detailedAttribution" parameter is enabled. @property(nonatomic, assign) BOOL detailedAttributionExtensionEnabled; /// Indicates if the CSA "longerHeadlines" parameter is enabled. @property(nonatomic, assign) BOOL longerHeadlinesExtensionEnabled; /// Sets an advanced option value for a specified key. The value must be an NSString or NSNumber. - (void)setAdvancedOptionValue:(id)value forKey:(NSString *)key; @end NS_ASSUME_NONNULL_END
#import <Foundation/Foundation.h> #import "ASPObject.h" /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen * Do not edit the class manually. */ #import "ASPParagraph.h" @protocol ASPParagraphResponse @end @interface ASPParagraphResponse : ASPObject @property(nonatomic) ASPParagraph* paragraph; @property(nonatomic) NSString* code; @property(nonatomic) NSString* status; @end
# include <stdio.h> # include <stdlib.h> # include "mex.h" # include "math.h" # define ROUND(x) (floor((x)+.5f)) # define NEGMAX -1e10 # define MAX(x, y) ((x)>(y)? (x):(y)) /* Generating double vector */ float *single_vector(int n) { float *v; v = (float*) mxCalloc (n, sizeof(float)); return v; } /* Generating double matrix */ float **single_matrix(int m, int n) { float **mat; int i; mat = (float**) mxCalloc(m, sizeof(float*)); for (i=0; i<m; i++) mat[i] = single_vector(n); return mat; } /* Free matrix space */ void free_matrix(void **mat, int m, int n) { int i; for (i=0; i<m; i++) mxFree(mat[i]); mxFree(mat); } /* Compute pixel index in the vector that stores image */ int px(int x, int y, int lengthx, int lengthy) /* the image is lengthx*lengthy */ { return (x + (y-1)*lengthx - 1); } /* variables */ float **SUM1map, **SUM1mapAll, **integralMap, **averageMap, thresholdFactor; int numOrient, halfFilterSize, localHalfx, localHalfy, sizex, sizey; /* compute local normalization */ void LocalNormalize() { int x, y, here, orient, leftx, rightx, upy, lowy, k, startx[8], endx[8], starty[8], endy[8], copyx[8], copyy[8], fx, fy; float maxAverage, averageDivide; /* compute the sum over all the orientations at each pixel */ SUM1mapAll = single_matrix(sizex, sizey); for (x=0; x<sizex; x++) for (y=0; y<sizey; y++){ here = px(x+1, y+1, sizex, sizey); for (orient=0; orient<numOrient; orient++) { SUM1mapAll[x][y] += SUM1map[orient][here]; } } /* compute the integral map */ integralMap = single_matrix(sizex, sizey); integralMap[0][0] = SUM1mapAll[0][0]; for (x=1; x<sizex; x++) integralMap[x][0] = integralMap[x-1][0]+SUM1mapAll[x][0]; for (y=1; y<sizey; y++) integralMap[0][y] = integralMap[0][y-1]+SUM1mapAll[0][y]; for (x=1; x<sizex; x++) for (y=1; y<sizey; y++) integralMap[x][y] = integralMap[x][y-1]+integralMap[x-1][y]-integralMap[x-1][y-1]+SUM1mapAll[x][y]; /* compute the local average around each pixel */ averageMap = single_matrix(sizex, sizey); leftx = halfFilterSize+localHalfx; rightx = sizex-halfFilterSize-localHalfx; upy = halfFilterSize+localHalfy; lowy = sizey-halfFilterSize-localHalfy; maxAverage = NEGMAX; if ((leftx<rightx)&&(upy<lowy)) { for (x=leftx; x<rightx; x++) for (y=upy; y<lowy; y++) { averageMap[x][y] = (integralMap[x+localHalfx][y+localHalfy] - integralMap[x-localHalfx-1][y+localHalfy] - integralMap[x+localHalfx][y-localHalfy-1] + integralMap[x-localHalfx-1][y-localHalfy-1])/(2.*localHalfx+1.)/(2.*localHalfy+1.)/numOrient; if (maxAverage < averageMap[x][y]) maxAverage = averageMap[x][y]; } /* take care of the boundaries */ k = 0; /* four corners */ startx[k] = 0; endx[k] = leftx; starty[k] = 0; endy[k] = upy; copyx[k] = leftx; copyy[k] = upy; k++; startx[k] = 0; endx[k] = leftx; starty[k] = lowy; endy[k] = sizey; copyx[k] = leftx; copyy[k] = lowy-1; k++; startx[k] = rightx; endx[k] = sizex; starty[k] = 0; endy[k] = upy; copyx[k] = rightx-1; copyy[k] = upy; k++; startx[k] = rightx; endx[k] = sizex; starty[k] = lowy; endy[k] = sizey; copyx[k] = rightx-1; copyy[k] = lowy-1; k++; /* four sides */ startx[k] = 0; endx[k] = leftx; starty[k] = upy; endy[k] = lowy; copyx[k] = leftx; copyy[k] = -1; k++; startx[k] = rightx; endx[k] = sizex; starty[k] = upy; endy[k] = lowy; copyx[k] = rightx-1; copyy[k] = -1; k++; startx[k] = leftx; endx[k] = rightx; starty[k] = 0; endy[k] = upy; copyx[k] = -1; copyy[k] = upy; k++; startx[k] = leftx; endx[k] = rightx; starty[k] = lowy; endy[k] = sizey; copyx[k] = -1; copyy[k] = lowy-1; k++; /* propagate the average to the boundaries */ for (k=0; k<8; k++) for (x=startx[k]; x<endx[k]; x++) for (y=starty[k]; y<endy[k]; y++) { if (copyx[k]<0) fx = x; else fx = copyx[k]; if (copyy[k]<0) fy = y; else fy = copyy[k]; averageMap[x][y] = averageMap[fx][fy]; } /* normalize the responses by local averages */ for (x=0; x<sizex; x++) for (y=0; y<sizey; y++) { here = px(x+1, y+1, sizex, sizey); averageDivide = MAX(averageMap[x][y], maxAverage*thresholdFactor); averageDivide = 1.0/(averageDivide+1e-10); for (orient=0; orient<numOrient; orient++) SUM1map[orient][here] *= averageDivide; } } /* free intermediate matrices */ free_matrix((void**)SUM1mapAll, sizex, sizey); free_matrix((void**)integralMap, sizex, sizey); free_matrix((void**)averageMap, sizex, sizey); } /* load in variables */ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int orient, c; mxArray *f; c = 0; sizex = ROUND(mxGetScalar(prhs[c++])); sizey = ROUND(mxGetScalar(prhs[c++])); numOrient = ROUND(mxGetScalar(prhs[c++])); halfFilterSize = ROUND(mxGetScalar(prhs[c++])); localHalfx = ROUND(mxGetScalar(prhs[c++])); /* half size of the local area for averaging */ localHalfy = ROUND(mxGetScalar(prhs[c++])); SUM1map = mxCalloc(numOrient, sizeof(float*)); /* filter responses */ for (orient=0; orient<numOrient; orient++) { f = mxGetCell(prhs[c], orient); SUM1map[orient] = mxGetPr(f); } c++; thresholdFactor = mxGetScalar(prhs[c++]); LocalNormalize(); }
/* Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #if !defined _IMMINTRIN_H_INCLUDED #error "Never use <avx512vp2intersectintrin.h> directly; include <immintrin.h> instead." #endif #ifndef _AVX512VP2INTERSECTVLINTRIN_H_INCLUDED #define _AVX512VP2INTERSECTVLINTRIN_H_INCLUDED #if !defined(__AVX512VP2INTERSECT__) || !defined(__AVX512VL__) #pragma GCC push_options #pragma GCC target("avx512vp2intersect,avx512vl") #define __DISABLE_AVX512VP2INTERSECTVL__ #endif /* __AVX512VP2INTERSECTVL__ */ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_2intersect_epi32 (__m128i __A, __m128i __B, __mmask8 *__U, __mmask8 *__M) { __builtin_ia32_2intersectd128 (__U, __M, (__v4si) __A, (__v4si) __B); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm256_2intersect_epi32 (__m256i __A, __m256i __B, __mmask8 *__U, __mmask8 *__M) { __builtin_ia32_2intersectd256 (__U, __M, (__v8si) __A, (__v8si) __B); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_2intersect_epi64 (__m128i __A, __m128i __B, __mmask8 *__U, __mmask8 *__M) { __builtin_ia32_2intersectq128 (__U, __M, (__v2di) __A, (__v2di) __B); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm256_2intersect_epi64 (__m256i __A, __m256i __B, __mmask8 *__U, __mmask8 *__M) { __builtin_ia32_2intersectq256 (__U, __M, (__v4di) __A, (__v4di) __B); } #ifdef __DISABLE_AVX512VP2INTERSECTVL__ #undef __DISABLE_AVX512VP2INTERSECTVL__ #pragma GCC pop_options #endif /* __DISABLE_AVX512VP2INTERSECTVL__ */ #endif /* _AVX512VP2INTERSECTVLINTRIN_H_INCLUDED */
/* * USB support for XBOX, based on Linux kernel source * * 2003-06-21 Georg Acher (georg@acher.org) * */ #include "../usb_wrapper.h" void subsys_usb_init(void); void module_exit_usb_exit(void); extern struct pci_device_id *module_table_pci_ids; // straigth call... int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id); void usb_hcd_pci_remove (struct pci_dev *dev); void XPADInit(void); void XPADRemove(void); void XRemoteInit(void); void XRemoteRemove(void); void UsbKeyBoardInit(void); void UsbKeyBoardRemove(void); void UsbMouseInit(void); void UsbMouseRemove(void); void USBGetEvents(void); extern int (*thread_handler)(void*); int (*hub_thread_handler)(void*); extern int nousb; extern int xpad_num; struct pci_dev xx_ohci_dev={ .vendor = 0, .device = 0, .bus = NULL, .irq = 1, // currently not used... .slot_name = "OHCI", .dev = {.name = "PCI",.dma_mask=1}, .base = {0xfed00000}, .flags = {} }; /*------------------------------------------------------------------------*/ void BootStartUSB(void) { int n; nousb=0; init_wrapper(); subsys_usb_init(); hub_thread_handler=thread_handler; usb_hcd_pci_probe(&xx_ohci_dev, module_table_pci_ids); XPADInit(); XRemoteInit(); UsbKeyBoardInit(); UsbMouseInit(); for(n=0;n<200;n++) { USBGetEvents(); wait_ms(1); } } /*------------------------------------------------------------------------*/ void USBGetEvents(void) { inc_jiffies(1); do_all_timers(); hub_thread_handler(NULL); handle_irqs(-1); } /*------------------------------------------------------------------------*/ void BootStopUSB(void) { int n; XPADRemove(); XRemoteRemove(); UsbKeyBoardRemove(); UsbMouseRemove(); for(n=0;n<100;n++) { USBGetEvents(); wait_ms(1); } module_exit_usb_exit(); usb_hcd_pci_remove(&xx_ohci_dev); } /*------------------------------------------------------------------------*/
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * * This 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 software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #ifndef __WINVNC_SERVICEMODE_H__ #define __WINVNC_SERVICEMODE_H__ #include <winvnc/VNCServerWin32.h> #include <rfb_win32/Service.h> namespace winvnc { class VNCServerService : public rfb::win32::Service { public: VNCServerService(VNCServerWin32& s); DWORD serviceMain(int argc, TCHAR* argv[]); void stop(); static const TCHAR* Name; protected: VNCServerWin32& server; }; }; #endif
/* * Jailhouse, a Linux-based partitioning hypervisor * * Copyright (c) Siemens AG, 2014 * * Authors: * Jan Kiszka <jan.kiszka@siemens.com> * * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory. */ #include <asm/percpu.h> struct exception_frame; enum x86_init_sipi { X86_INIT, X86_SIPI }; void x86_send_init_sipi(unsigned int cpu_id, enum x86_init_sipi type, int sipi_vector); int x86_handle_events(struct per_cpu *cpu_data); void __attribute__((noreturn)) x86_exception_handler(struct exception_frame *frame);
/* * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. * Created by: rusty.lynch REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. Test case for assertion #4 of the sigaction system call that shows that attempting to add SIGSTOP can not be added to the signal mask for a signal handler. Steps: 1. Fork a new process 2. (parent) wait for child 3. (child) Setup a signal handler for SIGPOLL with SIGSTOP added to the signal mask 4. (child) raise SIGPOLL 5. (child, signal handler) raise SIGSTOP 5. (child) If still around then return -1 6. (parent - returning from wait) If child was stopped then return kill the child and return success, otherwise fail. */ #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/types.h> #include <unistd.h> #include "posixtest.h" void handler(int signo) { printf("About to stop child\n"); raise(SIGSTOP); printf("Child has continued\n"); exit(0); } int main() { pid_t pid; if ((pid = fork()) == 0) { /* child */ struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaddset(&act.sa_mask, SIGSTOP); if (sigaction(SIGPOLL, &act, 0) == -1) { perror("Unexpected error while attempting to " "setup test pre-conditions"); return PTS_UNRESOLVED; } if (raise(SIGPOLL) == -1) { perror("Unexpected error while attempting to " "setup test pre-conditions"); } return PTS_UNRESOLVED; } else { int s; /* parent */ if (waitpid(pid, &s, WUNTRACED) == -1) { perror("Unexpected error while setting up test " "pre-conditions"); return PTS_UNRESOLVED; } if (WIFSTOPPED(s)) { printf("Test PASSED\n"); kill(pid, SIGKILL); return PTS_PASS; } } printf("Test FAILED\n"); return PTS_FAIL; }
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2013 NVIDIA CORPORATION. All rights reserved. * Copyright 2019 NXP */ #include <common.h> #include <asm/io.h> #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> #include <dm/devres.h> #include <linux/clk-provider.h> #include <clk.h> #include <linux/err.h> #include "clk.h" #define UBOOT_DM_CLK_COMPOSITE "clk_composite" static u8 clk_composite_get_parent(struct clk *clk) { struct clk_composite *composite = to_clk_composite(clk_dev_binded(clk) ? (struct clk *)dev_get_clk_ptr(clk->dev) : clk); struct clk *mux = composite->mux; if (mux) return clk_mux_get_parent(mux); else return 0; } static int clk_composite_set_parent(struct clk *clk, struct clk *parent) { struct clk_composite *composite = to_clk_composite(clk_dev_binded(clk) ? (struct clk *)dev_get_clk_ptr(clk->dev) : clk); const struct clk_ops *mux_ops = composite->mux_ops; struct clk *mux = composite->mux; if (mux && mux_ops) return mux_ops->set_parent(mux, parent); else return -ENOTSUPP; } static unsigned long clk_composite_recalc_rate(struct clk *clk) { struct clk_composite *composite = to_clk_composite(clk_dev_binded(clk) ? (struct clk *)dev_get_clk_ptr(clk->dev) : clk); const struct clk_ops *rate_ops = composite->rate_ops; struct clk *rate = composite->rate; if (rate && rate_ops) return rate_ops->get_rate(rate); else return clk_get_parent_rate(clk); } static ulong clk_composite_set_rate(struct clk *clk, unsigned long rate) { struct clk_composite *composite = to_clk_composite(clk_dev_binded(clk) ? (struct clk *)dev_get_clk_ptr(clk->dev) : clk); const struct clk_ops *rate_ops = composite->rate_ops; struct clk *clk_rate = composite->rate; if (rate && rate_ops) return rate_ops->set_rate(clk_rate, rate); else return clk_get_rate(clk); } static int clk_composite_enable(struct clk *clk) { struct clk_composite *composite = to_clk_composite(clk_dev_binded(clk) ? (struct clk *)dev_get_clk_ptr(clk->dev) : clk); const struct clk_ops *gate_ops = composite->gate_ops; struct clk *gate = composite->gate; if (gate && gate_ops) return gate_ops->enable(gate); else return 0; } static int clk_composite_disable(struct clk *clk) { struct clk_composite *composite = to_clk_composite(clk_dev_binded(clk) ? (struct clk *)dev_get_clk_ptr(clk->dev) : clk); const struct clk_ops *gate_ops = composite->gate_ops; struct clk *gate = composite->gate; if (gate && gate_ops) return gate_ops->disable(gate); else return 0; } struct clk *clk_register_composite(struct device *dev, const char *name, const char * const *parent_names, int num_parents, struct clk *mux, const struct clk_ops *mux_ops, struct clk *rate, const struct clk_ops *rate_ops, struct clk *gate, const struct clk_ops *gate_ops, unsigned long flags) { struct clk *clk; struct clk_composite *composite; int ret; if (!num_parents || (num_parents != 1 && !mux)) return ERR_PTR(-EINVAL); composite = kzalloc(sizeof(*composite), GFP_KERNEL); if (!composite) return ERR_PTR(-ENOMEM); if (mux && mux_ops) { composite->mux = mux; composite->mux_ops = mux_ops; mux->data = (ulong)composite; } if (rate && rate_ops) { if (!rate_ops->get_rate) { clk = ERR_PTR(-EINVAL); goto err; } composite->rate = rate; composite->rate_ops = rate_ops; rate->data = (ulong)composite; } if (gate && gate_ops) { if (!gate_ops->enable || !gate_ops->disable) { clk = ERR_PTR(-EINVAL); goto err; } composite->gate = gate; composite->gate_ops = gate_ops; gate->data = (ulong)composite; } clk = &composite->clk; clk->flags = flags; ret = clk_register(clk, UBOOT_DM_CLK_COMPOSITE, name, parent_names[clk_composite_get_parent(clk)]); if (ret) { clk = ERR_PTR(ret); goto err; } if (composite->mux) composite->mux->dev = clk->dev; if (composite->rate) composite->rate->dev = clk->dev; if (composite->gate) composite->gate->dev = clk->dev; return clk; err: kfree(composite); return clk; } static const struct clk_ops clk_composite_ops = { .set_parent = clk_composite_set_parent, .get_rate = clk_composite_recalc_rate, .set_rate = clk_composite_set_rate, .enable = clk_composite_enable, .disable = clk_composite_disable, }; U_BOOT_DRIVER(clk_composite) = { .name = UBOOT_DM_CLK_COMPOSITE, .id = UCLASS_CLK, .ops = &clk_composite_ops, .flags = DM_FLAG_PRE_RELOC, };
/* arch/arm/mach-msm/include/mach/memory.h * * Copyright (C) 2007 Google, Inc. * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H /* physical offset of RAM */ #define PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) #define MAX_PHYSMEM_BITS 32 #define SECTION_SIZE_BITS 28 /* Certain configurations of MSM7x30 have multiple memory banks. * One or more of these banks can contain holes in the memory map as well. * These macros define appropriate conversion routines between the physical * and virtual address domains for supporting these configurations using * SPARSEMEM and a 3G/1G VM split. */ #if defined(CONFIG_ARCH_MSM7X30) #define EBI0_PHYS_OFFSET PHYS_OFFSET #define EBI0_PAGE_OFFSET PAGE_OFFSET #define EBI0_SIZE 0x10000000 #ifdef CONFIG_MACH_MSM8X55_VICTOR /* memory of victor is separated to three region. * first is 0x20000000 ~ 0x03e00000 * second is 0x07a00000 ~ 0x10000000 * thired is 0x20000000 ~ 0x30000000 * region of 0x10000000 ~ 0x20000000 is hole. * EBI1_PHYS_OFFSET should indicate the end of hole. * 2010-01-18, cleaneye.kim@lge.com */ #define EBI1_PHYS_OFFSET 0x20000000 #else #define EBI1_PHYS_OFFSET 0x40000000 #endif #define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE) #if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G)) #define __phys_to_virt(phys) \ ((phys) >= EBI1_PHYS_OFFSET ? \ (phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \ (phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET) #define __virt_to_phys(virt) \ ((virt) >= EBI1_PAGE_OFFSET ? \ (virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \ (virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET) #endif #endif #define HAS_ARCH_IO_REMAP_PFN_RANGE #ifndef __ASSEMBLY__ void *alloc_bootmem_aligned(unsigned long size, unsigned long alignment); void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long); void clean_caches(unsigned long, unsigned long, unsigned long); void invalidate_caches(unsigned long, unsigned long, unsigned long); int platform_physical_remove_pages(unsigned long, unsigned long); int platform_physical_active_pages(unsigned long, unsigned long); int platform_physical_low_power_pages(unsigned long, unsigned long); #ifdef CONFIG_ARCH_MSM_ARM11 void write_to_strongly_ordered_memory(void); void map_page_strongly_ordered(void); #endif #ifdef CONFIG_CACHE_L2X0 extern void l2x0_cache_sync(void); #define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0) #endif #endif #if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_SCORPIONMP #define arch_has_speculative_dfetch() 1 #endif #endif /* these correspond to values known by the modem */ #define MEMORY_DEEP_POWERDOWN 0 #define MEMORY_SELF_REFRESH 1 #define MEMORY_ACTIVE 2 #define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd" #ifndef CONFIG_ARCH_MSM7X27 #define CONSISTENT_DMA_SIZE (SZ_1M * 14) #endif
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ //#include "Mp_Precomp.h" //#include "../odm_precomp.h" #include <drv_types.h> #include "../../../hal/OUTSRC/phydm_precomp.h" #include "HalEfuseMask8812A_USB.h" /****************************************************************************** * MUSB.TXT ******************************************************************************/ u1Byte Array_MP_8812A_MUSB[] = { 0xFF, 0xF7, 0xEF, 0xDE, 0xFC, 0xFB, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x00, 0xFF, 0xFF, 0xF3, 0x0F, 0xFF, 0xF3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; u2Byte EFUSE_GetArrayLen_MP_8812A_MUSB(VOID) { return sizeof(Array_MP_8812A_MUSB)/sizeof(u1Byte); } VOID EFUSE_GetMaskArray_MP_8812A_MUSB( IN OUT pu1Byte Array ) { u2Byte len = EFUSE_GetArrayLen_MP_8812A_MUSB(), i = 0; for (i = 0; i < len; ++i) Array[i] = Array_MP_8812A_MUSB[i]; } BOOLEAN EFUSE_IsAddressMasked_MP_8812A_MUSB( IN u2Byte Offset ) { int r = Offset/16; int c = (Offset%16) / 2; int result = 0; if (c < 4) // Upper double word result = (Array_MP_8812A_MUSB[r] & (0x10 << c)); else result = (Array_MP_8812A_MUSB[r] & (0x01 << (c-4))); return (result > 0) ? 0 : 1; }
/** * MaNGOS is a full featured server for World of Warcraft, supporting * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 * * Copyright (C) 2005-2022 MaNGOS <https://getmangos.eu> * * 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 * * World of Warcraft, and all World of Warcraft or Warcraft art, images, * and lore are copyrighted by Blizzard Entertainment, Inc. */ #ifndef MANGOS_PETAI_H #define MANGOS_PETAI_H #include "CreatureAI.h" #include "ObjectGuid.h" #include "Timer.h" class Creature; class Spell; class PetAI : public CreatureAI { public: explicit PetAI(Creature* c); void MoveInLineOfSight(Unit*) override; void AttackStart(Unit*) override; void EnterEvadeMode() override; void AttackedBy(Unit*) override; bool IsVisible(Unit*) const override; void UpdateAI(const uint32) override; static int Permissible(const Creature*); private: bool _isVisible(Unit*) const; bool _needToStop(void) const; void _stopAttack(void); void UpdateAllies(); TimeTracker i_tracker; bool inCombat; GuidSet m_AllySet; uint32 m_updateAlliesTimer; }; #endif
/* * Copyright (C) 2011 Red Hat. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <zlib.h> #include <getopt.h> #include "kerncompat.h" #include "ctree.h" #include "disk-io.h" #include "print-tree.h" #include "transaction.h" #include "list.h" #include "volumes.h" #include "utils.h" #include "crc32c.h" #include "extent-cache.h" #include "find-root.h" static void usage(void) { fprintf(stderr, "Usage: find-roots [-a] [-o search_objectid] " "[ -g search_generation ] [ -l search_level ] <device>\n"); } /* * Get reliable generation and level for given root. * * We have two sources of gen/level: superblock and tree root. * superblock include the following level: * Root, chunk, log * and the following generations: * Root, chunk, uuid * Other gen/leven can only be read from its btrfs_tree_root if possible. * * Currently we only believe things from superblock. */ static void get_root_gen_and_level(u64 objectid, struct btrfs_fs_info *fs_info, u64 *ret_gen, u8 *ret_level) { struct btrfs_super_block *super = fs_info->super_copy; u64 gen = (u64)-1; u8 level = (u8)-1; switch (objectid) { case BTRFS_ROOT_TREE_OBJECTID: level = btrfs_super_root_level(super); gen = btrfs_super_generation(super); break; case BTRFS_CHUNK_TREE_OBJECTID: level = btrfs_super_chunk_root_level(super); gen = btrfs_super_chunk_root_generation(super); printf("Search for chunk root is not supported yet\n"); break; case BTRFS_TREE_LOG_OBJECTID: level = btrfs_super_log_root_level(super); gen = btrfs_super_log_root_transid(super); break; case BTRFS_UUID_TREE_OBJECTID: gen = btrfs_super_uuid_tree_generation(super); break; } if (gen != (u64)-1) { printf("Superblock thinks the generation is %llu\n", gen); if (ret_gen) *ret_gen = gen; } else { printf("Superblock doesn't contain generation info for root %llu\n", objectid); } if (level != (u8)-1) { printf("Superblock thinks the level is %u\n", level); if (ret_level) *ret_level = level; } else { printf("Superblock doesn't contain the level info for root %llu\n", objectid); } } static void print_one_result(struct cache_extent *tree_block, u8 level, u64 generation, struct btrfs_find_root_filter *filter) { int unsure = 0; if (filter->match_gen == (u64)-1 || filter->match_level == (u8)-1) unsure = 1; printf("Well block %llu(gen: %llu level: %u) seems good, ", tree_block->start, generation, level); if (unsure) printf("but we are unsure about the correct generation/level\n"); else printf("but generation/level doesn't match, want gen: %llu level: %u\n", filter->match_gen, filter->match_level); } static void print_find_root_result(struct cache_tree *result, struct btrfs_find_root_filter *filter) { struct btrfs_find_root_gen_cache *gen_cache; struct cache_extent *cache; struct cache_extent *tree_block; u64 generation = 0; u8 level = 0; for (cache = last_cache_extent(result); cache; cache = prev_cache_extent(cache)) { gen_cache = container_of(cache, struct btrfs_find_root_gen_cache, cache); level = gen_cache->highest_level; generation = cache->start; if (level == filter->match_level && generation == filter->match_gen) continue; for (tree_block = last_cache_extent(&gen_cache->eb_tree); tree_block; tree_block = prev_cache_extent(tree_block)) print_one_result(tree_block, level, generation, filter); } } int main(int argc, char **argv) { struct btrfs_root *root; struct btrfs_find_root_filter filter = {0}; struct cache_tree result; struct cache_extent *found; int ret; /* Default to search root tree */ filter.objectid = BTRFS_ROOT_TREE_OBJECTID; filter.match_gen = (u64)-1; filter.match_level = (u8)-1; while (1) { static const struct option long_options[] = { { "help", no_argument, NULL, GETOPT_VAL_HELP}, { NULL, 0, NULL, 0 } }; int c = getopt_long(argc, argv, "al:o:g:", long_options, NULL); if (c < 0) break; switch (c) { case 'a': filter.search_all = 1; break; case 'o': filter.objectid = arg_strtou64(optarg); break; case 'g': filter.generation = arg_strtou64(optarg); break; case 'l': filter.level = arg_strtou64(optarg); break; case GETOPT_VAL_HELP: default: usage(); exit(c != GETOPT_VAL_HELP); } } set_argv0(argv); argc = argc - optind; if (check_argc_min(argc, 1)) { usage(); exit(1); } root = open_ctree(argv[optind], 0, OPEN_CTREE_CHUNK_ROOT_ONLY); if (!root) { fprintf(stderr, "Open ctree failed\n"); exit(1); } cache_tree_init(&result); get_root_gen_and_level(filter.objectid, root->fs_info, &filter.match_gen, &filter.match_level); ret = btrfs_find_root_search(root, &filter, &result, &found); if (ret < 0) { fprintf(stderr, "Fail to search the tree root: %s\n", strerror(-ret)); goto out; } if (ret > 0) { printf("Found tree root at %llu gen %llu level %u\n", found->start, filter.match_gen, filter.match_level); ret = 0; } print_find_root_result(&result, &filter); out: btrfs_find_root_free(&result); close_ctree(root); return ret; }
/* * DTV tuner linux driver * * Usage: DTV tuner driver by i2c for linux * * * This software program is licensed subject to the GNU General Public License * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html * */ #ifndef _DTVD_TUNER_DRIVER_H_ #define _DTVD_TUNER_DRIVER_H_ #define D_DTVD_TUNER_CHAR_MAJOR 143 #define D_DTVD_TUNER_CHAR_MINOR 0 #define D_DTVD_TUNER_DRV_NAME "dtvtuner" int dtvd_tuner_main( void *); int dtvd_tuner_open( struct inode *, struct file * ); ssize_t dtvd_tuner_read( struct file *file, char __user *buffer, size_t count, loff_t *f_pos ); int dtvd_tuner_ioctl( struct inode *, struct file *file, unsigned int, unsigned long ); int dtvd_tuner_close( struct inode *, struct file * ); int dtvd_tuner_init_module(void); extern const struct file_operations tdtvd_tuner_fops; #endif
/* * uivideo.h * * Written by * Marco van den Heuvel <blackystardust68@yahoo.com> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #ifndef VICE_UIVIDEO_H #define VICE_UIVIDEO_H extern void ui_video_palette_settings_dialog(video_canvas_t *canvas, char *palette_enable_res, char *palette_filename_res, char *palette_filename_text); extern void ui_video_color_settings_dialog(video_canvas_t *canvas, char *gamma_res, char *tint_res, char *saturation_res, char *contrast_res, char *brightness_res); extern void ui_video_crt_settings_dialog(video_canvas_t *canvas, char *scanline_shade_res, char *blur_res, char *oddline_phase_res, char *oddline_offset_res); extern void ui_video_render_filter_settings_dialog(video_canvas_t *canvas, char *render_filter_res); #endif
/* Control flow graph analysis header file. Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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 GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ #ifndef GCC_CFGANAL_H #define GCC_CFGANAL_H /* This structure maintains an edge list vector. */ /* FIXME: Make this a vec<edge>. */ struct edge_list { int num_edges; edge *index_to_edge; }; /* Class to compute and manage control dependences on an edge-list. */ class control_dependences { public: control_dependences (); ~control_dependences (); bitmap get_edges_dependent_on (int); basic_block get_edge_src (int); basic_block get_edge_dest (int); private: void set_control_dependence_map_bit (basic_block, int); void clear_control_dependence_bitmap (basic_block); void find_control_dependence (int); vec<bitmap> control_dependence_map; vec<std::pair<int, int> > m_el; }; extern bool mark_dfs_back_edges (void); extern void find_unreachable_blocks (void); extern void verify_no_unreachable_blocks (void); struct edge_list * create_edge_list (void); void free_edge_list (struct edge_list *); void print_edge_list (FILE *, struct edge_list *); void verify_edge_list (FILE *, struct edge_list *); edge find_edge (basic_block, basic_block); int find_edge_index (struct edge_list *, basic_block, basic_block); extern void remove_fake_edges (void); extern void remove_fake_exit_edges (void); extern void add_noreturn_fake_exit_edges (void); extern void connect_infinite_loops_to_exit (void); extern int post_order_compute (int *, bool, bool); extern basic_block dfs_find_deadend (basic_block); extern void inverted_post_order_compute (vec<int> *postorder, sbitmap *start_points = 0); extern int pre_and_rev_post_order_compute_fn (struct function *, int *, int *, bool); extern int pre_and_rev_post_order_compute (int *, int *, bool); extern int rev_post_order_and_mark_dfs_back_seme (struct function *, edge, bitmap, bool, int *, vec<std::pair<int, int> > *); extern int dfs_enumerate_from (basic_block, int, bool (*)(const_basic_block, const void *), basic_block *, int, const void *); extern void compute_dominance_frontiers (class bitmap_head *); extern bitmap compute_idf (bitmap, class bitmap_head *); extern void bitmap_intersection_of_succs (sbitmap, sbitmap *, basic_block); extern void bitmap_intersection_of_preds (sbitmap, sbitmap *, basic_block); extern void bitmap_union_of_succs (sbitmap, sbitmap *, basic_block); extern void bitmap_union_of_preds (sbitmap, sbitmap *, basic_block); extern basic_block * single_pred_before_succ_order (void); extern edge single_incoming_edge_ignoring_loop_edges (basic_block, bool); extern edge single_pred_edge_ignoring_loop_edges (basic_block, bool); #endif /* GCC_CFGANAL_H */
#ifndef MAREXTRACTOR_H_ #define MAREXTRACTOR_H_ #include "AbstractMarExtractor.h" class MarExtractor : public AbstractMarExtractor { Q_OBJECT public: MarExtractor(); ~MarExtractor(); void setup(); public slots: void extract(Marsyas::realvec& dest); }; #endif /* MAREXTRACTOR_H_ */
/* This test script is part of GDB, the GNU debugger. Copyright 1999-2020 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 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/>. */ /* Test long long expression; test printing in general. * * /CLO/BUILD_ENV/Exports/cc -g +e -o long_long long_long.c * * or * * cc +e +DA2.0 -g -o long_long long_long.c */ #include <string.h> enum { MAX_BYTES = 16 }; void pack (unsigned char b[MAX_BYTES], int size, int nr) { static long long val[] = { 0x123456789abcdefLL, 01234567123456701234567LL, 12345678901234567890ULL}; volatile static int e = 1; int i; for (i = 0; i < nr; i++) { int offset; if (*(char *)&e) /* Little endian. */ offset = sizeof (long long) - size; else /* Big endian endian. */ offset = 0; memcpy (b + size * i, (char *) val + sizeof (long long) * i + offset, size); } } unsigned char b[MAX_BYTES]; unsigned char h[MAX_BYTES]; unsigned char w[MAX_BYTES]; unsigned char g[MAX_BYTES]; unsigned char c[MAX_BYTES]; unsigned char s[MAX_BYTES]; unsigned char i[MAX_BYTES]; unsigned char l[MAX_BYTES]; unsigned char ll[MAX_BYTES]; int known_types() { /* A union is used here as, hopefully it has well defined packing rules. */ struct { long long bin, oct, dec, hex; } val; memset (&val, 0, sizeof val); /* Known values, filling the full 64 bits. */ val.bin = 0x123456789abcdefLL; /* 64 bits = 16 hex digits */ val.oct = 01234567123456701234567LL; /* = 21+ octal digits */ val.dec = 12345678901234567890ULL; /* = 19+ decimal digits */ /* Stop here and look! */ val.hex = val.bin - val.dec | val.oct; return 0; } int main() { /* Pack Byte, Half, Word and Giant arrays with byte-ordered values. That way "(gdb) x" gives the same output on different architectures. */ pack (b, 1, 2); pack (h, 2, 2); pack (w, 4, 2); pack (g, 8, 2); pack (c, sizeof (char), 2); pack (s, sizeof (short), 2); pack (i, sizeof (int), 2); pack (l, sizeof (long), 2); pack (ll, sizeof (long long), 2); known_types(); return 0; }
/* * lib/kdb/kdb_ldap/ldap_tkt_policy.h * * Copyright (c) 2004-2005, Novell, 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. * * The copyright holder's name is not 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 _LDAP_POLICY_H #define _LDAP_POLICY_H 1 /* policy specific mask */ #define LDAP_POLICY_MAXTKTLIFE 0x0001 #define LDAP_POLICY_MAXRENEWLIFE 0x0002 #define LDAP_POLICY_TKTFLAGS 0x0004 #define LDAP_POLICY_COUNT 0x0008 /* policy object structure */ typedef struct _krb5_ldap_policy_params { char *policy; long mask; long maxtktlife; long maxrenewlife; long tktflags; krb5_tl_data *tl_data; }krb5_ldap_policy_params; krb5_error_code krb5_ldap_create_policy(krb5_context, krb5_ldap_policy_params *, int); krb5_error_code krb5_ldap_modify_policy(krb5_context, krb5_ldap_policy_params *, int); krb5_error_code krb5_ldap_read_policy(krb5_context, char *, krb5_ldap_policy_params **, int *); krb5_error_code krb5_ldap_delete_policy(krb5_context, char *); krb5_error_code krb5_ldap_clear_policy(krb5_context, char *); krb5_error_code krb5_ldap_list_policy(krb5_context, char *, char ***); krb5_error_code krb5_ldap_free_policy(krb5_context, krb5_ldap_policy_params *); krb5_error_code krb5_ldap_change_count(krb5_context ,char * , int); #endif
/* * This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MANGOS_BAG_H #define MANGOS_BAG_H #include "Common.h" #include "Item.h" enum InventorySlot { NULL_BAG = 0, NULL_SLOT = 255 }; // Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2 #define MAX_BAG_SIZE 36 // 2.0.12 class Bag : public Item { public: Bag(); ~Bag(); void AddToWorld() override; void RemoveFromWorld() override; bool Create(uint32 guidlow, uint32 itemid, Player const* owner) override; void StoreItem(uint8 slot, Item* pItem); void RemoveItem(uint8 slot); Item* GetItemByPos(uint8 slot) const; Item* GetItemByEntry(uint32 item) const; Item* GetItemByLimitedCategory(uint32 limitedCategory) const; uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const; uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem = nullptr) const; uint8 GetSlotByItemGUID(ObjectGuid guid) const; bool IsEmpty() const; uint32 GetFreeSlots() const; uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); } // DB operations // overwrite virtual Item::SaveToDB void SaveToDB() override; // overwrite virtual Item::LoadFromDB bool LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid = ObjectGuid()) override; // overwrite virtual Item::DeleteFromDB void DeleteFromDB() override; void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override; protected: // Bag Storage space Item* m_bagslot[MAX_BAG_SIZE]; }; inline Item* NewItemOrBag(ItemPrototype const* proto) { if (proto->InventoryType == INVTYPE_BAG) return new Bag; return new Item; } #endif
/* * vic20-midi.c - VIC20 specific MIDI (6850 UART) emulation. * * Written by * Hannu Nuotio <hannu.nuotio@tut.fi> * Marco van den Heuvel <blackystardust68@yahoo.com> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #ifndef VICE_VIC20_MIDI_H #define VICE_VIC20_MIDI_H #include "midi.h" extern int vic20_midi_resources_init(void); extern int vic20_midi_cmdline_options_init(void); /* Emulated interfaces */ enum { MIDI_MODE_MAPLIN = 0 /* Electronics - Maplin magazine */ }; struct snapshot_s; extern int vic20_midi_snapshot_read_module(struct snapshot_s *s); extern int vic20_midi_snapshot_write_module(struct snapshot_s *s); extern void vic20_midi_detach(void); #endif
/* * intel_mid_sfi.c: Intel mid sfi related fixes * * (C) Copyright 2012 Intel Corporation * Author: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 * of the License. */ #include <linux/init.h> #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/input.h> #include <linux/irq.h> #include <linux/module.h> #include <linux/notifier.h> #include <linux/gpio.h> #include <linux/gpio_keys.h> #include <asm/intel-mid.h> #include "intel_mid_sfi.h" /* Baytrail fake SFI table */ /* Baytrail OEMB table */ static struct sfi_table_oemb byt_oemb_table = { .spid = { .customer_id = CUSTOMER_INTEL, .vendor_id = VENDOR_INTEL, .platform_family_id = INTEL_BYT_TABLET, .product_line_id = INTEL_BYT_TABLET_TBD_ENG, .hardware_id = BYT_TABLET_TBD_TBD0, }, }; /* Baytrail devs table */ static struct sfi_device_table_entry byt_devs_table[] = { /*{bus_type, host_num, addr, irq, max_freq, name}*/ }; /* Baytrail gpio table */ static struct sfi_gpio_table_entry byt_gpio_table[] = { /*{cntl_name, pin_no, pin_name}*/ }; static struct sfi_table_header *get_oem_b_table(void) { struct sfi_table_header *sfi_oemb_table = NULL; sfi_oemb_table = (struct sfi_table_header *)&byt_oemb_table; return sfi_oemb_table; } static struct sfi_table_header *get_oem_0_table(void) { struct sfi_table_header *sfi_oem0_table = NULL; return sfi_oem0_table; } static struct sfi_table_header *get_devs_table(void) { struct sfi_table_simple *devs_table = NULL; struct sfi_table_header *sfi_devs_table = NULL; int tot_len = 0; if (INTEL_MID_BOARD(1, TABLET, BYT)) { tot_len = sizeof(byt_devs_table) + sizeof(struct sfi_table_header); devs_table = kzalloc(tot_len, GFP_KERNEL); if (!devs_table) { pr_err("%s(): Error in kzalloc\n", __func__); return NULL; } devs_table->header.len = tot_len; memcpy(devs_table->pentry, byt_devs_table, sizeof(byt_devs_table)); } sfi_devs_table = (struct sfi_table_header *)devs_table; return sfi_devs_table; } static struct sfi_table_header *get_gpio_table(void) { struct sfi_table_simple *gpio_table = NULL; struct sfi_table_header *sfi_gpio_table = NULL; int tot_len = 0; if (INTEL_MID_BOARD(1, TABLET, BYT)) { tot_len = sizeof(byt_gpio_table) + sizeof(struct sfi_table_header); gpio_table = kzalloc(tot_len, GFP_KERNEL); if (!gpio_table) { pr_err("%s(): Error in kzalloc\n", __func__); return NULL; } gpio_table->header.len = tot_len; memcpy(gpio_table->pentry, byt_gpio_table, sizeof(byt_gpio_table)); } sfi_gpio_table = (struct sfi_table_header *)gpio_table; return sfi_gpio_table; } /* * get_sfi_table() - Returns sfi_table matching the sig. */ static struct sfi_table_header *get_sfi_table(char *sig) { struct sfi_table_header *table = NULL; if (!strncmp(sig, SFI_SIG_OEMB, SFI_SIGNATURE_SIZE)) table = get_oem_b_table(); else if (!strncmp(sig, SFI_SIG_OEM0, SFI_SIGNATURE_SIZE)) table = get_oem_0_table(); else if (!strncmp(sig, SFI_SIG_DEVS, SFI_SIGNATURE_SIZE)) table = get_devs_table(); else if (!strncmp(sig, SFI_SIG_GPIO, SFI_SIGNATURE_SIZE)) table = get_gpio_table(); else table = NULL; return table; } /* * fix_sfi_table() - Looks for fake SFI table that matches the given * signature and runs handler() on it. */ static int fix_sfi_table(char *sig, sfi_table_handler handler) { struct sfi_table_header *table = NULL; int ret = -EINVAL; table = get_sfi_table(sig); if (!table) goto exit; ret = handler(table); exit: return ret; } /* * handle_sfi_table() - Finds the SFI table with given signature and * runs handler() on it. */ int handle_sfi_table(char *signature, char *oem_id, char *oem_table_id, sfi_table_handler handler) { int ret = -EINVAL; ret = sfi_table_parse(signature, oem_id, oem_table_id, handler); if (ret) { pr_err("Failed to parse %s SFI table\n", signature); ret = fix_sfi_table(signature, handler); } return ret; }
/* * headers of script functions of curl module * * Copyright (C) 2008 Juha Heinanen * Copyright (C) 2013 Carsten Bock, ng-voice GmbH * * This file is part of Kamailio, a free SIP server. * * Kamailio 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 * * Kamailio 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 * */ /*! * \file * \brief Kamailio curl :: script functions include file * \ingroup curl * Module: \ref curl */ #ifndef UTILS_FUNCTIONS_H #define UTILS_FUNCTIONS_H #include "../../parser/msg_parser.h" /*! Use predefined connection to run HTTP get or post */ int curl_con_query_url(struct sip_msg* _m, char *connection, char* _url, char* _result, const char *contenttype, char* _post); /* * Performs http_query and saves possible result (first body line of reply) * to pvar. */ int http_query(struct sip_msg* _m, char* _url, char* _dst, char* _post); #endif /* UTILS_FUNCTIONS_H */
/******************************************************************************** * SRS Labs CONFIDENTIAL * @Copyright 2010 by SRS Labs. * All rights reserved. * * Description: * The top level header file for using API functions and macros defined * in srs_common library * * Author: Oscar Huang * ********************************************************************************/ #ifndef __SRS_COMMON_API_H__ #define __SRS_COMMON_API_H__ #include "srs_fxp.h" #include "srs_math_api.h" #include "srs_filters_api.h" #include "srs_parametriceq_api.h" #include "srs_focus_api.h" #include "srs_misc_api.h" #ifdef __cplusplus extern "C"{ #endif /*__cplusplus*/ #ifdef __cplusplus } #endif /*__cplusplus*/ #endif /*__SRS_COMMON_API_H__*/
/***************************************************************************** * mp4.h : MP4 file input module for vlc ***************************************************************************** * Copyright (C) 2001-2004, 2010, 2014 VLC authors and VideoLAN * * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef _VLC_MP4_H #define _VLC_MP4_H 1 /***************************************************************************** * Preamble *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <vlc_common.h> #include "libmp4.h" #include "../asf/asfpacket.h" /* Contain all information about a chunk */ typedef struct { uint64_t i_offset; /* absolute position of this chunk in the file */ uint32_t i_sample_description_index; /* index for SampleEntry to use */ uint32_t i_sample_count; /* how many samples in this chunk */ uint32_t i_sample_first; /* index of the first sample in this chunk */ uint32_t i_sample; /* index of the next sample to read in this chunk */ /* now provide way to calculate pts, dts, and offset without too much memory and with fast access */ /* with this we can calculate dts/pts without waste memory */ uint64_t i_first_dts; /* DTS of the first sample */ uint64_t i_last_dts; /* DTS of the last sample */ uint32_t *p_sample_count_dts; uint32_t *p_sample_delta_dts; /* dts delta */ uint32_t *p_sample_count_pts; int32_t *p_sample_offset_pts; /* pts-dts */ uint8_t **p_sample_data; /* set when b_fragmented is true */ uint32_t *p_sample_size; /* TODO if needed add pts but quickly *add* support for edts and seeking */ } mp4_chunk_t; /* Contain all needed information for read all track with vlc */ typedef struct { unsigned int i_track_ID;/* this should be unique */ int b_ok; /* The track is usable */ int b_enable; /* is the trak enable by default */ bool b_selected; /* is the trak being played */ bool b_chapter; /* True when used for chapter only */ uint32_t i_switch_group; bool b_mac_encoding; es_format_t fmt; uint8_t rgi_chans_reordering[AOUT_CHAN_MAX]; bool b_chans_reorder; es_out_id_t *p_es; /* display size only ! */ int i_width; int i_height; float f_rotation; /* more internal data */ uint32_t i_timescale; /* time scale for this track only */ uint16_t current_qid; /* Smooth Streaming quality level ID */ /* elst */ int i_elst; /* current elst */ int64_t i_elst_time; /* current elst start time (in movie time scale)*/ MP4_Box_t *p_elst; /* elst (could be NULL) */ /* give the next sample to read, i_chunk is to find quickly where the sample is located */ uint32_t i_sample; /* next sample to read */ uint32_t i_chunk; /* chunk where next sample is stored */ /* total count of chunk and sample */ uint32_t i_chunk_count; uint32_t i_sample_count; mp4_chunk_t *chunk; /* always defined for each chunk */ mp4_chunk_t *cchunk; /* current chunk if b_fragmented is true */ /* sample size, p_sample_size defined only if i_sample_size == 0 else i_sample_size is size for all sample */ uint32_t i_sample_size; uint32_t *p_sample_size; /* XXX perhaps add file offset if take too much time to do sumations each time*/ uint32_t i_sample_first; /* i_sample_first value of the next chunk */ uint64_t i_first_dts; /* i_first_dts value of the next chunk */ MP4_Box_t *p_track; MP4_Box_t *p_stbl; /* will contain all timing information */ MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ MP4_Box_t *p_sample;/* point on actual sdsd */ bool b_drms; bool b_has_non_empty_cchunk; bool b_codec_need_restart; void *p_drms; MP4_Box_t *p_skcr; mtime_t i_time; // track scaled struct { /* for moof parsing */ MP4_Box_t *p_traf; MP4_Box_t *p_tfhd; MP4_Box_t *p_trun; uint64_t i_traf_base_offset; } context; /* ASF packets handling */ MP4_Box_t *p_asf; mtime_t i_dts_backup; mtime_t i_pts_backup; asf_track_info_t asfinfo; } mp4_track_t; typedef struct mp4_fragment_t mp4_fragment_t; struct mp4_fragment_t { uint64_t i_chunk_range_min_offset; uint64_t i_chunk_range_max_offset; struct { unsigned int i_track_ID; uint64_t i_duration; // movie scaled } *p_durations; unsigned int i_durations; MP4_Box_t *p_moox; mp4_fragment_t *p_next; }; int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample ); int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample ); int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample ); void SetupMeta( vlc_meta_t *p_meta, MP4_Box_t *p_udta ); #endif
/* decodeGains.c Copyright (C) 2011 Belledonne Communications, Grenoble, France Author : Johan Pascal This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "typedef.h" #include "codecParameters.h" #include "basicOperationsMacros.h" #include "codebooks.h" #include "utils.h" #include "decodeGains.h" /* init function */ void initDecodeGains(bcg729DecoderChannelContextStruct *decoderChannelContext) { /*init previousGainPredictionError to -14 in Q10 */ decoderChannelContext->previousGainPredictionError[0] = -14336; decoderChannelContext->previousGainPredictionError[1] = -14336; decoderChannelContext->previousGainPredictionError[2] = -14336; decoderChannelContext->previousGainPredictionError[3] = -14336; } /*****************************************************************************/ /* decodeGains : decode adaptive and fixed codebooks gains as in spec 4.1.5 */ /* parameters: */ /* -(i/o) decoderChannelContext : the channel context data */ /* -(i) GA : parameter GA: Gain Codebook Stage 1 (3 bits) */ /* -(i) GB : paremeter GB: Gain Codebook Stage 2 (4 bits) */ /* -(i) fixedCodebookVector: 40 values current fixed Codebook vector */ /* in Q1.13. */ /* -(i) frameErasureFlag : set in case of frame erasure */ /* -(i/o) adaptativeCodebookGain : input previous/output current */ /* subframe Pitch Gain in Q14 */ /* -(i/o) fixedCodebookGain : input previous/output current Fixed */ /* Codebook Gain in Q1 */ /* */ /*****************************************************************************/ void decodeGains (bcg729DecoderChannelContextStruct *decoderChannelContext, uint16_t GA, uint16_t GB, word16_t *fixedCodebookVector, uint8_t frameErasureFlag, word16_t *adaptativeCodebookGain, word16_t *fixedCodebookGain) { /* check the erasure flag */ if (frameErasureFlag != 0) { /* we have a frame erasure, proceed as described in spec 4.4.2 */ /* adaptativeCodebookGain as in eq94 */ if (*adaptativeCodebookGain < 16384) { /* last subframe gain < 1 in Q14 */ *adaptativeCodebookGain = MULT16_16_Q15(*adaptativeCodebookGain, 29491 ); /* *0.9 in Q15 */ } else { /* bound current subframe gain to 0.9 (14746 in Q14) */ *adaptativeCodebookGain = 14746; } /* fixedCodebookGain as in eq93 */ *fixedCodebookGain = MULT16_16_Q15(*fixedCodebookGain, 32113 ); /* *0.98 in Q15 */ /* And update the previousGainPredictionError according to spec 4.4.3 */ int i; word32_t currentGainPredictionError =0; for (i=0; i<4; i++) { currentGainPredictionError = ADD32(currentGainPredictionError, decoderChannelContext->previousGainPredictionError[i]); /* previousGainPredictionError in Q3.10-> Sum in Q5.10 (on 32 bits) */ } currentGainPredictionError = PSHR(currentGainPredictionError,2); /* /4 -> Q3.10 */ if (currentGainPredictionError < -10240) { /* final result is low bounded by -14, so check before doing -4 if it's over -10(-10240 in Q10) or not */ currentGainPredictionError = -14336; /* set to -14 in Q10 */ } else { /* substract 4 */ currentGainPredictionError = SUB32(currentGainPredictionError,4096); /* in Q10 */ } /* shift the array and insert the current Prediction Error */ decoderChannelContext->previousGainPredictionError[3] = decoderChannelContext->previousGainPredictionError[2]; decoderChannelContext->previousGainPredictionError[2] = decoderChannelContext->previousGainPredictionError[1]; decoderChannelContext->previousGainPredictionError[1] = decoderChannelContext->previousGainPredictionError[0]; decoderChannelContext->previousGainPredictionError[0] = (word16_t)currentGainPredictionError; return; } /* First recover the GA and GB real index from their mapping tables(spec 3.9.3) */ GA = reverseIndexMappingGA[GA]; GB = reverseIndexMappingGB[GB]; /* Compute the adaptativeCodebookGain from the tables according to eq73 in spec3.9.2 */ /* adaptativeCodebookGain = GACodebook[GA][0] + GBCodebook[GB][0] */ *adaptativeCodebookGain = ADD16(GACodebook[GA][0], GBCodebook[GB][0]); /* result in Q1.14 */ /* Fixed Codebook: MA code-gain prediction */ word32_t predictedFixedCodebookGain = MACodeGainPrediction(decoderChannelContext->previousGainPredictionError, fixedCodebookVector); /* predictedFixedCodebookGain on 32 bits in Q11.16 */ /* get fixed codebook gain correction factor(gama) from the codebooks GA and GB according to eq74 */ word16_t fixedCodebookGainCorrectionFactor = ADD16(GACodebook[GA][1], GBCodebook[GB][1]); /* result in Q3.12 (range [0.185, 5.05])*/ /* compute fixedCodebookGain according to eq74 */ *fixedCodebookGain = (word16_t)PSHR(MULT16_32_Q12(fixedCodebookGainCorrectionFactor, predictedFixedCodebookGain), 15); /* Q11.16*Q3.12 -> Q14.16, shift by 15 to get a Q14.1 which fits on 16 bits */ /* use eq72 to compute current prediction error in order to update the previousGainPredictionError array */ computeGainPredictionError(fixedCodebookGainCorrectionFactor, decoderChannelContext->previousGainPredictionError); }
// // Copyright (C) 2005 Andras Varga // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program; if not, see <http://www.gnu.org/licenses/>. // #ifndef __INET_THRUPUTMETER_H #define __INET_THRUPUTMETER_H #include "inet/common/INETDefs.h" namespace inet { /** * Measures and records network thruput */ // FIXME problem: if traffic suddenly stops, it'll show the last reading forever; // (output vector will be correct though); would need a timer to handle this situation class INET_API ThruputMeter : public cSimpleModule { protected: // config simtime_t startTime; // start time unsigned int batchSize; // number of packets in a batch simtime_t maxInterval; // max length of measurement interval (measurement ends // if either batchSize or maxInterval is reached, whichever // is reached first) // global statistics unsigned long numPackets; unsigned long numBits; // current measurement interval simtime_t intvlStartTime; simtime_t intvlLastPkTime; unsigned long intvlNumPackets; unsigned long intvlNumBits; // statistics cOutVector bitpersecVector; cOutVector pkpersecVector; protected: virtual void updateStats(simtime_t now, unsigned long bits); virtual void beginNewInterval(simtime_t now); protected: virtual void initialize() override; virtual void handleMessage(cMessage *msg) override; virtual void finish() override; }; } // namespace inet #endif // ifndef __INET_THRUPUTMETER_H
/* vim:set ft=c ts=2 sw=2 sts=2 et cindent: */ #ifndef librabbitmq_amqp_hostcheck_h #define librabbitmq_amqp_hostcheck_h /* * Copyright 1996-2014 Daniel Stenberg <daniel@haxx.se>. * Copyright 2014 Michael Steinert * * All rights reserved. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * 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 OF THIRD PARTY RIGHTS. * 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. * * Except as contained in this notice, the name of a copyright holder shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization of the * copyright holder. */ typedef enum { AMQP_HCR_NO_MATCH = 0, AMQP_HCR_MATCH = 1 } amqp_hostcheck_result; /** * Determine whether hostname matches match_pattern. * * match_pattern may include wildcards. * * Match is performed based on the rules set forth in RFC6125 section 6.4.3. * http://tools.ietf.org/html/rfc6125#section-6.4.3 * * \param match_pattern RFC6125 compliant pattern * \param hostname to match against * \returns AMQP_HCR_MATCH if its a match, AMQP_HCR_NO_MATCH otherwise. */ amqp_hostcheck_result amqp_hostcheck(const char *match_pattern, const char *hostname); #endif
/* * This file is part of Cleanflight. * * Cleanflight is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Cleanflight is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #define TARGET_BOARD_IDENTIFIER "AFF3" // AlienFlight F3. #define USE_TARGET_CONFIG #define TARGET_BUS_INIT #define REMAP_TIM17_DMA #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT #define USE_HARDWARE_REVISION_DETECTION #define HW_PIN PB2 #define USE_BRUSHED_ESC_AUTODETECT // LED's V1 #define LED0_PIN PB4 #define LED1_PIN PB5 // LED's V2 #define LED0_A PB8 #define LED1_A PB9 #define BEEPER PA5 #define USE_EXTI //#define DEBUG_MPU_DATA_READY_INTERRUPT #define USE_MPU_DATA_READY_SIGNAL // Using MPU6050 for the moment. #define USE_GYRO #define USE_GYRO_MPU6050 #define USE_GYRO_SPI_MPU6500 #define GYRO_MPU6050_ALIGN CW270_DEG #define GYRO_MPU6500_ALIGN CW270_DEG #define USE_ACC #define USE_ACC_MPU6050 #define USE_ACC_SPI_MPU6500 #define ACC_MPU6050_ALIGN CW270_DEG #define ACC_MPU6500_ALIGN CW270_DEG // No baro support. //#define USE_BARO //#define USE_BARO_MS5611 // option to use MPU9150 or MPU9250 integrated AK89xx Mag #define USE_MAG #define USE_MAG_AK8963 #define MAG_AK8963_ALIGN CW180_DEG_FLIP #define USE_VCP #define USE_UART1 // Not connected - TX (PB6) RX PB7 (AF7) #define USE_UART2 // Receiver - RX (PA3) #define USE_UART3 // Not connected - 10/RX (PB11) 11/TX (PB10) #define USE_SOFTSERIAL1 #define USE_SOFTSERIAL2 #define SERIAL_PORT_COUNT 6 #define AVOID_UART2_FOR_PWM_PPM #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_PIN PB15 // (HARDARE=0) #define UART1_TX_PIN PB6 #define UART1_RX_PIN PB7 #define UART2_TX_PIN PA2 #define UART2_RX_PIN PA3 #define UART3_TX_PIN PB10 #define UART3_RX_PIN PB11 #define USE_I2C #define USE_I2C_PULLUP #define USE_I2C_DEVICE_2 #define I2C_DEVICE (I2CDEV_2) #define I2C2_SCL PA9 #define I2C2_SDA PA10 #define USE_SPI #define USE_SPI_DEVICE_3 #define SPI3_NSS_PIN PA15 #define SPI3_SCK_PIN PB3 #define SPI3_MISO_PIN PB4 #define SPI3_MOSI_PIN PB5 #define MPU6500_CS_PIN SPI3_NSS_PIN #define MPU6500_SPI_INSTANCE SPI3 #define USE_ADC #define ADC_INSTANCE ADC2 #define VBAT_ADC_PIN PA4 #define VBAT_SCALE_DEFAULT 20 #define BINDPLUG_PIN PB12 #define DEFAULT_FEATURES FEATURE_MOTOR_STOP #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL #define SERIALRX_UART SERIAL_PORT_USART2 #define USE_SERIAL_4WAY_BLHELI_INTERFACE // IO - stm32f303cc in 48pin package #define TARGET_IO_PORTA 0xffff #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15)) #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) #define USABLE_TIMER_CHANNEL_COUNT 11 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(15) | TIM_N(17) )
/* * This file is part of Cleanflight and Betaflight. * * Cleanflight and Betaflight are free software. You can redistribute * this software and/or modify this software under the terms of the * GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. * * Cleanflight and Betaflight are distributed in the hope that they * 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 software. * * If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stdint.h> #include "pg/pg.h" #include "drivers/io_types.h" typedef struct gyroDeviceConfig_s { int8_t index; uint8_t bustype; uint8_t spiBus; ioTag_t csnTag; uint8_t i2cBus; uint8_t i2cAddress; ioTag_t extiTag; uint8_t align; // sensor_align_e } gyroDeviceConfig_t; PG_DECLARE_ARRAY(gyroDeviceConfig_t, MAX_GYRODEV_COUNT, gyroDeviceConfig);
// // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, // 2011 Free Software Foundation, Inc // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "sdl_glue.h" #include <cairo.h> #include <SDL.h> // Forward declarations namespace gnash { class Renderer; } namespace gnash { class SdlCairoGlue : public SdlGlue { public: SdlCairoGlue(); virtual ~SdlCairoGlue(); bool init(int argc, char **argv[]); Renderer* createRenderHandler( int depth); void setInvalidatedRegions(const InvalidatedRanges& ranges); bool prepDrawingArea(int width, int height, std::uint32_t sdl_flags); std::uint32_t maskFlags(std::uint32_t sdl_flags); void render(); private: cairo_surface_t *_cairo_surface; cairo_t *_cairo_handle; SDL_Surface *_sdl_surface; unsigned char *_render_image; SDL_Surface *_screen; Renderer *_renderer; }; }
/* configdir.c * * * Copyright (C) 2014 Toxic All Rights Reserved. * * This file is part of Toxic. * * Toxic 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. * * Toxic 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 Toxic. If not, see <http://www.gnu.org/licenses/>. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <string.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #ifdef _WIN32 #include <shlobj.h> #include <direct.h> #else /* WIN32 */ #include <unistd.h> #include <pwd.h> #endif /* WIN32 */ #include "configdir.h" /** * @brief Get the users config directory. * * This is without a trailing slash. * * @return The users config dir or NULL on error. */ char *get_user_config_dir(void) { char *user_config_dir; #ifdef _WIN32 #warning Please fix configdir for Win32 return NULL; #if 0 char appdata[MAX_PATH]; BOOL ok; ok = SHGetSpecialFolderPathA(NULL, appdata, CSIDL_PROFILE, TRUE); if (!ok) { return NULL; } user_config_dir = strdup(appdata); return user_config_dir; #endif #else /* WIN32 */ #ifndef NSS_BUFLEN_PASSWD #define NSS_BUFLEN_PASSWD 4096 #endif /* NSS_BUFLEN_PASSWD */ struct passwd pwd; struct passwd *pwdbuf; const char *home; char buf[NSS_BUFLEN_PASSWD]; size_t len; int rc; rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf); if (rc == 0) { home = pwd.pw_dir; } else { home = getenv("HOME"); if (home == NULL) { return NULL; } /* env variables can be tainted */ snprintf(buf, sizeof(buf), "%s", home); home = buf; } # if defined(__APPLE__) len = strlen(home) + strlen("/Library/Application Support") + 1; user_config_dir = malloc(len); if (user_config_dir == NULL) { return NULL; } snprintf(user_config_dir, len, "%s/Library/Application Support", home); # else /* __APPLE__ */ const char *tmp; if (!(tmp = getenv("XDG_CONFIG_HOME"))) { len = strlen(home) + strlen("/.config") + 1; user_config_dir = malloc(len); if (user_config_dir == NULL) { return NULL; } snprintf(user_config_dir, len, "%s/.config", home); } else { user_config_dir = strdup(tmp); } # endif /* __APPLE__ */ return user_config_dir; #undef NSS_BUFLEN_PASSWD #endif /* WIN32 */ } /* * Creates the config directory. */ int create_user_config_dir(char *path) { #ifdef _WIN32 #warning Please fix configdir for Win32 return -1; #if 0 char *fullpath = malloc(strlen(path) + strlen(CONFIGDIR) + 1); strcpy(fullpath, path); strcat(fullpath, CONFIGDIR); mkdir_err = _mkdir(fullpath); struct __stat64 buf; if (mkdir_err && (errno != EEXIST || _wstat64(fullpath, &buf) || !S_ISDIR(buf.st_mode))) { free(fullpath); return -1; } free(fullpath); #endif #else int mkdir_err; mkdir_err = mkdir(path, 0700); struct stat buf; if (mkdir_err && (errno != EEXIST || stat(path, &buf) || !S_ISDIR(buf.st_mode))) { return -1; } char *fullpath = malloc(strlen(path) + strlen(CONFIGDIR) + 1); strcpy(fullpath, path); strcat(fullpath, CONFIGDIR); mkdir_err = mkdir(fullpath, 0700); if (mkdir_err && (errno != EEXIST || stat(fullpath, &buf) || !S_ISDIR(buf.st_mode))) { free(fullpath); return -1; } free(fullpath); return 0; #endif }
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -disable-llvm-passes -Os -o - %s | FileCheck %s // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -disable-llvm-passes -Os -std=c99 -o - %s | FileCheck %s // CHECK: define signext i8 @f0(i32 %x) [[NUW:#[0-9]+]] // CHECK: define zeroext i8 @f1(i32 %x) [[NUW]] // CHECK: define void @f2(i8 signext %x) [[NUW]] // CHECK: define void @f3(i8 zeroext %x) [[NUW]] // CHECK: define signext i16 @f4(i32 %x) [[NUW]] // CHECK: define zeroext i16 @f5(i32 %x) [[NUW]] // CHECK: define void @f6(i16 signext %x) [[NUW]] // CHECK: define void @f7(i16 zeroext %x) [[NUW]] signed char f0(int x) { return x; } unsigned char f1(int x) { return x; } void f2(signed char x) { } void f3(unsigned char x) { } signed short f4(int x) { return x; } unsigned short f5(int x) { return x; } void f6(signed short x) { } void f7(unsigned short x) { } // CHECK-LABEL: define void @f8() // CHECK: [[AI:#[0-9]+]] // CHECK: { void __attribute__((always_inline)) f8(void) { } // CHECK: call void @f9_t() // CHECK: [[NR:#[0-9]+]] // CHECK: } void __attribute__((noreturn)) f9_t(void); void f9(void) { f9_t(); } // CHECK: call void @f9a() // CHECK: [[NR]] // CHECK: } _Noreturn void f9a(void); void f9b(void) { f9a(); } // FIXME: We should be setting nounwind on calls. // CHECK: call i32 @f10_t() // CHECK: [[NUW_RN:#[0-9]+]] // CHECK: { int __attribute__((const)) f10_t(void); int f10(void) { return f10_t(); } int f11(void) { exit: return f10_t(); } int f12(int arg) { return arg ? 0 : f10_t(); } // CHECK: define void @f13() [[NUW_OS_RN:#[0-9]+]] void f13(void) __attribute__((pure)) __attribute__((const)); void f13(void){} // <rdar://problem/7102668> [irgen] clang isn't setting the optsize bit on functions // CHECK-LABEL: define void @f15 // CHECK: [[NUW]] // CHECK: { void f15(void) { } // PR5254 // CHECK-LABEL: define void @f16 // CHECK: [[ALIGN:#[0-9]+]] // CHECK: { void __attribute__((force_align_arg_pointer)) f16(void) { } // PR11038 // CHECK-LABEL: define void @f18() // CHECK: [[RT:#[0-9]+]] // CHECK: { // CHECK: call void @f17() // CHECK: [[RT_CALL:#[0-9]+]] // CHECK: ret void __attribute__ ((returns_twice)) void f17(void); __attribute__ ((returns_twice)) void f18(void) { f17(); } // CHECK-LABEL: define void @f19() // CHECK: { // CHECK: call i32 @setjmp(i32* null) // CHECK: [[RT_CALL]] // CHECK: ret void typedef int jmp_buf[((9 * 2) + 3 + 16)]; int setjmp(jmp_buf); void f19(void) { setjmp(0); } // CHECK-LABEL: define void @f20() // CHECK: { // CHECK: call i32 @_setjmp(i32* null) // CHECK: [[RT_CALL]] // CHECK: ret void int _setjmp(jmp_buf); void f20(void) { _setjmp(0); } // CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} } // CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} } // CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} } // CHECK: attributes [[ALIGN]] = { nounwind optsize alignstack=16{{.*}} } // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} } // CHECK: attributes [[NR]] = { noreturn optsize } // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone } // CHECK: attributes [[RT_CALL]] = { optsize returns_twice }
/* Copyright (C) 2005-2010 Valeriy Argunov (nporep AT mail DOT ru) */ /* * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "declarations.h" #include "variant.h" #ifndef QSP_GAMEDEFINES #define QSP_GAMEDEFINES #define QSP_GAMEID QSP_FMT("QSPGAME") #define QSP_SAVEDGAMEID QSP_FMT("QSPSAVEDGAME") #define QSP_GAMEMINVER QSP_FMT("5.7.0") #define QSP_MAXINCFILES 100 #define QSP_DEFTIMERINTERVAL 500 extern QSP_CHAR *qspQstPath; extern int qspQstPathLen; extern QSP_CHAR *qspQstFullPath; extern int qspQstCRC; extern int qspCurIncLocsCount; /* External functions */ QSP_CHAR *qspGetAbsFromRelPath(QSP_CHAR *); void qspClearIncludes(QSP_BOOL); void qspNewGame(QSP_BOOL); void qspOpenQuestFromData(char *, int, QSP_CHAR *, QSP_BOOL); void qspOpenQuest(QSP_CHAR *, QSP_BOOL); int qspSaveGameStatusToString(QSP_CHAR **); void qspSaveGameStatus(QSP_CHAR *); void qspOpenGameStatusFromString(QSP_CHAR *); void qspOpenGameStatus(QSP_CHAR *); /* Statements */ QSP_BOOL qspStatementOpenQst(QSPVariant *, int, QSP_CHAR **, int); QSP_BOOL qspStatementOpenGame(QSPVariant *, int, QSP_CHAR **, int); QSP_BOOL qspStatementSaveGame(QSPVariant *, int, QSP_CHAR **, int); #endif
/* Hey EMACS -*- linux-c -*- */ /* $Id: main.c 245 2004-05-23 20:45:43Z roms $ */ /* TiEmu - Tiemu Is an EMUlator * * Copyright (c) 2000-2001, Thomas Corvazier, Romain Lievin * Copyright (c) 2001-2003, Romain Lievin * Copyright (c) 2003, Julien Blache * Copyright (c) 2004, Romain Liévin * Copyright (c) 2005, Romain Liévin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __TI68K_MEMv2__ #define __TI68K_MEMv2__ #include "stdint.h" /* Functions */ int v200_mem_init(void); uint8_t v200_get_byte(uint32_t addr); uint16_t v200_get_word(uint32_t addr); uint32_t v200_get_long(uint32_t addr); void v200_put_long(uint32_t addr, uint32_t arg); void v200_put_word(uint32_t addr, uint16_t arg); void v200_put_byte(uint32_t addr, uint8_t arg); uint8_t* v200_get_real_addr(uint32_t addr); #endif
#pragma once #include "Shared.h" #include "RrupDevice.h" #include "Models/RepositoryChangeModel.h" class REPOSITORY_EXPORT RepositoryDevice : public RrupDevice { Q_OBJECT public: explicit RepositoryDevice(const QString& address, int port = 8250, QObject* parent = 0); const QString resolveIpAddress() const; void subscribe(const QString& rundown, const QString& profile); Q_SIGNAL void connectionStateChanged(RepositoryDevice&); Q_SIGNAL void repositoryChanged(const RepositoryChangeModel&, RepositoryDevice&); protected: void sendNotification(); };
/* Copyright 2012 David Malcolm <dmalcolm@redhat.com> Copyright 2012 Red Hat, Inc. This 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 <Python.h> /* Verify that the checker detects reference-count errors on PyObject subclasses where the object is referred to via a subclass pointer, and where the subclass embeds ob_refcnt and ob_type only indirectly */ /* The checker should treat this as a PyObject subclass */ struct FooObject { PyObject_HEAD int i; }; /* The checker should treat this as a PyObject subclass also: */ struct BarObject { struct FooObject ba_head; int ba_int; char ba_char; }; void test_function(struct BarObject *self) { /* The checker ought to check the refcount of self, and complain that it erroneously gains 5 references: */ Py_INCREF(self); Py_INCREF(self); Py_INCREF(self); Py_INCREF(self); Py_INCREF(self); } /* PEP-7 Local variables: c-basic-offset: 4 indent-tabs-mode: nil End: */
/* Character set conversion. Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <iconv.h> #include <errno.h> #include <string.h> #include "c-ctype.h" #include "c-strcase.h" #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) /* Namespace cleanliness. */ #define mapping_lookup rpl_iconv_open_mapping_lookup /* The macro ICONV_FLAVOR is defined to one of these or undefined. */ #define ICONV_FLAVOR_AIX "iconv_open-aix.h" #define ICONV_FLAVOR_HPUX "iconv_open-hpux.h" #define ICONV_FLAVOR_IRIX "iconv_open-irix.h" #define ICONV_FLAVOR_OSF "iconv_open-osf.h" #define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h" #ifdef ICONV_FLAVOR # include ICONV_FLAVOR #endif iconv_t rpl_iconv_open (const char *tocode, const char *fromcode) #undef iconv_open { char fromcode_upper[32]; char tocode_upper[32]; char *fromcode_upper_end; char *tocode_upper_end; #if REPLACE_ICONV_UTF /* Special handling of conversion between UTF-8 and UTF-{16,32}{BE,LE}. Do this here, before calling the real iconv_open(), because OSF/1 5.1 iconv() to these encoding inserts a BOM, which is wrong. We do not need to handle conversion between arbitrary encodings and UTF-{16,32}{BE,LE}, because the 'striconveh' module implements two-step conversion through UTF-8. The _ICONV_* constants are chosen to be disjoint from any iconv_t returned by the system's iconv_open() functions. Recall that iconv_t is a scalar type. */ if (c_toupper (fromcode[0]) == 'U' && c_toupper (fromcode[1]) == 'T' && c_toupper (fromcode[2]) == 'F' && fromcode[3] == '-') { if (c_toupper (tocode[0]) == 'U' && c_toupper (tocode[1]) == 'T' && c_toupper (tocode[2]) == 'F' && tocode[3] == '-') { if (strcmp (fromcode + 4, "8") == 0) { if (c_strcasecmp (tocode + 4, "16BE") == 0) return _ICONV_UTF8_UTF16BE; if (c_strcasecmp (tocode + 4, "16LE") == 0) return _ICONV_UTF8_UTF16LE; if (c_strcasecmp (tocode + 4, "32BE") == 0) return _ICONV_UTF8_UTF32BE; if (c_strcasecmp (tocode + 4, "32LE") == 0) return _ICONV_UTF8_UTF32LE; } else if (strcmp (tocode + 4, "8") == 0) { if (c_strcasecmp (fromcode + 4, "16BE") == 0) return _ICONV_UTF16BE_UTF8; if (c_strcasecmp (fromcode + 4, "16LE") == 0) return _ICONV_UTF16LE_UTF8; if (c_strcasecmp (fromcode + 4, "32BE") == 0) return _ICONV_UTF32BE_UTF8; if (c_strcasecmp (fromcode + 4, "32LE") == 0) return _ICONV_UTF32LE_UTF8; } } } #endif /* Do *not* add special support for 8-bit encodings like ASCII or ISO-8859-1 here. This would lead to programs that work in some locales (such as the "C" or "en_US" locales) but do not work in East Asian locales. It is better if programmers make their programs depend on GNU libiconv (except on glibc systems), e.g. by using the AM_ICONV macro and documenting the dependency in an INSTALL or DEPENDENCIES file. */ /* Try with the original names first. This covers the case when fromcode or tocode is a lowercase encoding name that is understood by the system's iconv_open but not listed in our mappings table. */ { iconv_t cd = iconv_open (tocode, fromcode); if (cd != (iconv_t)(-1)) return cd; } /* Convert the encodings to upper case, because 1. in the arguments of iconv_open() on AIX, HP-UX, and OSF/1 the case matters, 2. it makes searching in the table faster. */ { const char *p = fromcode; char *q = fromcode_upper; while ((*q = c_toupper (*p)) != '\0') { p++; q++; if (q == &fromcode_upper[SIZEOF (fromcode_upper)]) { errno = EINVAL; return (iconv_t)(-1); } } fromcode_upper_end = q; } { const char *p = tocode; char *q = tocode_upper; while ((*q = c_toupper (*p)) != '\0') { p++; q++; if (q == &tocode_upper[SIZEOF (tocode_upper)]) { errno = EINVAL; return (iconv_t)(-1); } } tocode_upper_end = q; } #ifdef ICONV_FLAVOR /* Apply the mappings. */ { const struct mapping *m = mapping_lookup (fromcode_upper, fromcode_upper_end - fromcode_upper); fromcode = (m != NULL ? m->vendor_name : fromcode_upper); } { const struct mapping *m = mapping_lookup (tocode_upper, tocode_upper_end - tocode_upper); tocode = (m != NULL ? m->vendor_name : tocode_upper); } #else fromcode = fromcode_upper; tocode = tocode_upper; #endif return iconv_open (tocode, fromcode); }
/* This file is part of HSPlasma. * * HSPlasma 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. * * HSPlasma 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 HSPlasma. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _PY_PARTICLEAPPLICATOR_H #define _PY_PARTICLEAPPLICATOR_H #include "PyPlasma.h" PY_WRAP_PLASMA(ParticleApplicator, class plParticleApplicator); PY_WRAP_PLASMA(ParticleAngleApplicator, class plParticleAngleApplicator); PY_WRAP_PLASMA(ParticleLifeMinApplicator, class plParticleLifeMinApplicator); PY_WRAP_PLASMA(ParticleLifeMaxApplicator, class plParticleLifeMaxApplicator); PY_WRAP_PLASMA(ParticlePPSApplicator, class plParticlePPSApplicator); PY_WRAP_PLASMA(ParticleScaleMinApplicator, class plParticleScaleMinApplicator); PY_WRAP_PLASMA(ParticleScaleMaxApplicator, class plParticleScaleMaxApplicator); PY_WRAP_PLASMA(ParticleVelMinApplicator, class plParticleVelMinApplicator); PY_WRAP_PLASMA(ParticleVelMaxApplicator, class plParticleVelMaxApplicator); #endif
/********************************************************************* * Copyright 2009, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ #include "includes.h" #include "nc_iter.h" #ifdef ENABLE_JAVA #include <math.h> static int j_uid = 0; static int j_charconstant(Generator* generator, Symbol* sym, Bytebuffer* codebuf, ...) { /* Escapes and quoting will be handled in genc_write */ /* Just transfer charbuf to codebuf */ Bytebuffer* charbuf; va_list ap; vastart(ap,codebuf); charbuf = va_arg(ap, Bytebuffer*); va_end(ap); bbNull(charbuf); bbCatbuf(codebuf,charbuf); return 1; } static int j_constant(Generator* generator, Symbol* sym, NCConstant* con, Bytebuffer* buf,...) { Bytebuffer* codetmp = bbNew(); char* special = NULL; switch (con->nctype) { case NC_CHAR: if(con->value.charv == '\'') bbprintf(codetmp,"'\\''"); else bbprintf(codetmp,"'%c'",con->value.charv); break; case NC_BYTE: bbprintf(codetmp,"%hhd",con->value.int8v); break; case NC_SHORT: bbprintf(codetmp,"%hd",con->value.int16v); break; case NC_INT: bbprintf(codetmp,"%d",con->value.int32v); break; case NC_FLOAT: /* Special case for nan */ if(isnan(con->value.floatv)) bbprintf(codetmp,"Float.NaN"); else bbprintf(codetmp,"%f",con->value.floatv); break; case NC_DOUBLE: /* Special case for nan */ if(isnan(con->value.doublev)) bbprintf(codetmp,"Double.NaN"); else bbprintf(codetmp,"%lf",con->value.doublev); break; case NC_UBYTE: bbprintf(codetmp,"%hhu",con->value.uint8v); break; case NC_USHORT: bbprintf(codetmp,"%hu",con->value.uint16v); break; case NC_UINT: bbprintf(codetmp,"%uU",con->value.uint32v); break; case NC_INT64: bbprintf(codetmp,"%lldLL",con->value.int64v); break; case NC_UINT64: bbprintf(codetmp,"%lluLLU",con->value.uint64v); break; case NC_STRING: { /* handle separately */ char* escaped = escapify(con->value.stringv.stringv, '"',con->value.stringv.len); special = poolalloc(1+2+strlen(escaped)); strcpy(special,"\""); strcat(special,escaped); strcat(special,"\""); } break; default: PANIC1("ncstype: bad type code: %d",con->nctype); } if(special == NULL) bbCatbuf(buf,codetmp); else bbCat(buf,special); bbFree(codetmp); return 1; } static int j_listbegin(Generator* generator, Symbol* sym, void* liststate, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...) { if(uidp) *uidp = ++j_uid; switch (lc) { case LISTATTR: case LISTDATA: break; case LISTFIELDARRAY: case LISTVLEN: case LISTCOMPOUND: break; } return 1; } static int j_list(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...) { switch (lc) { case LISTATTR: if(count > 0) bbCat(codebuf,", "); break; case LISTDATA: bbCat(codebuf," "); break; case LISTVLEN: case LISTCOMPOUND: case LISTFIELDARRAY: break; } return 1; } static int j_listend(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...) { return 1; } static int j_vlendecl(Generator* generator, Symbol* tsym, Bytebuffer* codebuf, int uid, size_t count, ...) { return 1; } static int j_vlenstring(Generator* generator, Symbol* sym, Bytebuffer* vlenmem, int* uidp, size_t* countp,...) { if(uidp) *uidp = ++j_uid; if(countp) *countp = 0; return 1; } /* Define the single static bin data generator */ static Generator j_generator_singleton = { NULL, j_charconstant, j_constant, j_listbegin, j_list, j_listend, j_vlendecl, j_vlenstring }; Generator* j_generator = &j_generator_singleton; #endif /*ENABLE_JAVA*/
#include <clutter/clutter.h> #include <string.h> enum { COLUMN_FOO, COLUMN_BAR, N_COLUMNS }; static void print_iter (ClutterModelIter *iter, const gchar *text) { ClutterModel *model; gint i; gchar *string; model = clutter_model_iter_get_model (iter); clutter_model_iter_get (iter, COLUMN_FOO, &i, COLUMN_BAR, &string, -1); g_print ("[row:%02d]: %s: (%s: %d), (%s: %s)\n", clutter_model_iter_get_row (iter), text, clutter_model_get_column_name (model, COLUMN_FOO), i, clutter_model_get_column_name (model, COLUMN_BAR), string); g_free (string); } static gboolean foreach_func (ClutterModel *model, ClutterModelIter *iter, gpointer dummy) { gint i; gchar *string; clutter_model_iter_get (iter, COLUMN_FOO, &i, COLUMN_BAR, &string, -1); g_print ("[row:%02d]: Foreach: %d, %s\n", clutter_model_iter_get_row (iter), i, string); g_free (string); return TRUE; } static gboolean filter_func (ClutterModel *model, ClutterModelIter *iter, gpointer dummy) { gint i = 0; clutter_model_iter_get (iter, COLUMN_FOO, &i, -1); return !(i % 2); } static gint sort_func (ClutterModel *model, const GValue *a, const GValue *b, gpointer dummy) { return -1 * strcmp (g_value_get_string (a), g_value_get_string (b)); } static void on_row_changed (ClutterModel *model, ClutterModelIter *iter) { print_iter (iter, "Changed"); } static void filter_model (ClutterModel *model) { ClutterModelIter *iter; g_print ("\n* Filter function: even rows\n"); clutter_model_set_filter (model, filter_func, NULL, NULL); iter = clutter_model_get_first_iter (model); while (!clutter_model_iter_is_last (iter)) { print_iter (iter, "Filtered Forward Iteration"); iter = clutter_model_iter_next (iter); } g_object_unref (iter); g_print ("\n* Sorting function: reverse alpha\n"); clutter_model_set_sort (model, COLUMN_BAR, sort_func, NULL, NULL); g_signal_connect (model, "row-changed", G_CALLBACK (on_row_changed), NULL); iter = clutter_model_get_iter_at_row (model, 0); clutter_model_iter_set (iter, COLUMN_BAR, "Changed string of 0th row, " "automatically gets sorted", -1); g_object_unref (iter); clutter_model_foreach (model, foreach_func, NULL); g_print ("\n* Unset filter\n"); clutter_model_set_filter (model, NULL, NULL, NULL); while (clutter_model_get_n_rows (model)) clutter_model_remove (model, 0); clutter_main_quit (); } static void iterate (ClutterModel *model) { ClutterModelIter *iter; iter = clutter_model_get_first_iter (model); while (!clutter_model_iter_is_last (iter)) { print_iter (iter, "Forward Iteration"); iter = clutter_model_iter_next (iter); } g_object_unref (iter); iter = clutter_model_get_last_iter (model); do { print_iter (iter, "Reverse Iteration"); iter = clutter_model_iter_prev (iter); } while (!clutter_model_iter_is_first (iter)); print_iter (iter, "Reverse Iteration"); g_object_unref (iter); filter_model (model); } static gboolean populate_model (ClutterModel *model) { gint i; for (i = 0; i < 10; i++) { gchar *string = g_strdup_printf ("String %d", i); clutter_model_append (model, COLUMN_FOO, i, COLUMN_BAR, string, -1); g_free (string); } clutter_model_foreach (model, foreach_func, NULL); iterate (model); return FALSE; } static void on_row_added (ClutterModel *model, ClutterModelIter *iter, gpointer dummy) { gint i; gchar *string; clutter_model_iter_get (iter, COLUMN_FOO, &i, COLUMN_BAR, &string, -1); g_print ("[row:%02d]: Added: %d, %s\n", clutter_model_iter_get_row (iter), i, string); g_free (string); } static void on_row_removed (ClutterModel *model, ClutterModelIter *iter, gpointer dummy) { print_iter (iter, "Removed"); } static void on_sort_changed (ClutterModel *model) { g_print ("*** Sort Changed ***\n\n"); clutter_model_foreach (model, foreach_func, NULL); } static void on_filter_changed (ClutterModel *model) { g_print ("*** Filter Changed ***\n\n"); } int main (int argc, char *argv[]) { ClutterModel *model; clutter_init (&argc, &argv); model = clutter_list_model_new (N_COLUMNS, G_TYPE_INT, "Foo", G_TYPE_STRING, "Bar"); g_timeout_add (1000, (GSourceFunc) populate_model, model); g_signal_connect (model, "row-added", G_CALLBACK (on_row_added), NULL); g_signal_connect (model, "row-removed", G_CALLBACK (on_row_removed), NULL); g_signal_connect (model, "sort-changed", G_CALLBACK (on_sort_changed), NULL); g_signal_connect (model, "filter-changed", G_CALLBACK (on_filter_changed), NULL); clutter_main(); g_object_unref (model); return 0; }
/* XMMS2 - X Music Multiplexer System * Copyright (C) 2003-2012 XMMS2 Team * * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!! * * 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. */ #include <assert.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <glib.h> #include "xmmsc/xmmsv.h" #include "jsonism.h" #include "utils/json.h" static xmmsv_t * create_structure (int stack_offset, int is_object) { if (is_object) { return xmmsv_new_dict (); } else { return xmmsv_new_list (); } } static xmmsv_t * create_data (int type, const char *data, uint32_t len) { switch (type) { case JSON_STRING: return xmmsv_new_string (data); case JSON_INT: return xmmsv_new_int (atoi(data)); case JSON_FLOAT: return xmmsv_new_error ("Float type not supported"); case JSON_NULL: return xmmsv_new_none (); case JSON_TRUE: return xmmsv_new_int (1); case JSON_FALSE: return xmmsv_new_int (0); default: return xmmsv_new_error ("Unknown data type."); } } static int append (xmmsv_t *obj, const char *key, uint32_t key_len, xmmsv_t *value) { if (xmmsv_is_type (obj, XMMSV_TYPE_LIST)) { xmmsv_list_append (obj, value); } else if (xmmsv_is_type (obj, XMMSV_TYPE_DICT) && key) { xmmsv_dict_set (obj, key, value); } else { /* Should never be reached */ assert (0); } xmmsv_unref (value); return 0; } xmmsv_t * xmmsv_from_xson (const char *spec) { gchar *normalized; char *p; xmmsv_t *dict; normalized = g_strdup (spec); for (p = normalized; *p != '\0'; p++) { if (*p == '\'') { *p = '"'; } } dict = xmmsv_from_json (normalized); g_free (normalized); return dict; } xmmsv_t * xmmsv_from_json (const char *spec) { json_config conf = { 0, /* buffer_initial_size (0=default) */ 0, /* max_nesting (0=no limit) */ 0, /* max_data (0=no limit) */ 1, /* allow_c_comments */ 0, /* allow_yaml_comments */ NULL, /* user_calloc */ NULL /* user_realloc */ }; json_parser_dom dom; json_parser parser; xmmsv_t *value; int error; json_parser_dom_init (&dom, (json_parser_dom_create_structure) create_structure, (json_parser_dom_create_data) create_data, (json_parser_dom_append) append); json_parser_init (&parser, &conf, json_parser_dom_callback, &dom); error = json_parser_string (&parser, spec, strlen (spec), NULL); if (error != 0) { switch (error) { case JSON_ERROR_BAD_CHAR: fprintf (stderr, "Failed to parse due to bad character!\n"); break; case JSON_ERROR_UNEXPECTED_CHAR: fprintf (stderr, "Failed to parse due to unexpected character!\n"); break; case JSON_ERROR_NO_MEMORY: fprintf (stderr, "Failed to parse (%d)!\n", error); break; } return NULL; } assert (dom.root_structure != NULL); assert (dom.stack_offset == 0); value = (xmmsv_t *) dom.root_structure; json_parser_dom_free (&dom); json_parser_free (&parser); return value; }
/* -*-c++-*- libcoin - Copyright (C) 2012 Michael Gronager * * libcoin 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 * any later version. * * libcoin 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 libcoin. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITCOIN_ASSET_H_ #define _BITCOIN_ASSET_H_ #include <coin/Export.h> #include <coin/Transaction.h> //typedef std::pair<uint256, unsigned int> Coin; typedef std::set<Coin> Coins; class AssetSyncronizer { public: typedef std::set<Coin> Coins; virtual void getCreditCoins(uint160 btc, Coins& coins) = 0; virtual void getDebitCoins(uint160 btc, Coins& coins) = 0; virtual void getCoins(uint160 btc, Coins& coins) = 0; virtual void getTransaction(const Coin& coin, Transaction&) = 0; }; class Asset; class COIN_EXPORT Asset : public KeyStore { public: // typedef Coin Coin; typedef std::map<uint256, Transaction> TxCache; typedef std::set<uint256> TxSet; typedef std::map<uint160, CKey> KeyMap; private: KeyMap _keymap; TxCache _tx_cache; Coins _coins; public: Asset() {} void addAddress(uint160 hash160) { _keymap[hash160]; } bool addKey(const CKey& key) { _keymap[toPubKeyHash(key.GetPubKey())] = key; return true; } std::set<uint160> getAddresses(); virtual bool AddKey(const CKey& key); virtual bool HaveKey(const ChainAddress &address) const; virtual bool GetKey(const ChainAddress &address, CKey& keyOut) const; // we might need to override these as well... Depending how well we want to support having only keys with pub/160 part // virtual bool GetPubKey(const ChainAddress &address, std::vector<unsigned char>& vchPubKeyOut) const // virtual std::vector<unsigned char> GenerateNewKey(); const Transaction& getTx(uint256 hash) const; uint160 getAddress(const Output& out) const; void remote_sync(); void syncronize(AssetSyncronizer& sync, bool all_transactions = false); const Coins& getCoins() { return _coins; } bool isSpendable(Coin coin) const; const int64 value(Coin coin) const; struct CompValue { const Asset& _asset; CompValue(const Asset& asset) : _asset(asset) {} bool operator() (Coin a, Coin b) { return (_asset.value(a) < _asset.value(b)); } }; int64 balance(); int64 spendable_balance(); typedef std::pair<uint160, int64> Payment; Transaction generateTx(std::set<Payment> payments, uint160 changeaddr = 0); Transaction generateTx(uint160 to, int64 amount, uint160 change = 0); }; #endif
/* *+ * Name: * palDtp2s * Purpose: * Tangent plane to spherical coordinates * Language: * Starlink ANSI C * Type of Module: * Library routine * Invocation: * palDtp2s( double xi, double eta, double raz, double decz, * double *ra, double *dec); * Arguments: * xi = double (Given) * First rectangular coordinate on tangent plane (radians) * eta = double (Given) * Second rectangular coordinate on tangent plane (radians) * raz = double (Given) * RA spherical coordinate of tangent point (radians) * decz = double (Given) * Dec spherical coordinate of tangent point (radians) * ra = double * (Returned) * RA spherical coordinate of point to be projected (radians) * dec = double * (Returned) * Dec spherical coordinate of point to be projected (radians) * Description: * Transform tangent plane coordinates into spherical. * Authors: * PTW: Pat Wallace (STFC) * TIMJ: Tim Jenness (JAC, Hawaii) * {enter_new_authors_here} * History: * 2012-02-08 (TIMJ): * Initial version with documentation taken from Fortran SLA * Adapted with permission from the Fortran SLALIB library. * {enter_further_changes_here} * Copyright: * Copyright (C) 1995 Rutherford Appleton Laboratory * Copyright (C) 2012 Science and Technology Facilities Council. * All Rights Reserved. * Licence: * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * License along with this program. If not, see * <http://www.gnu.org/licenses/>. * Bugs: * {note_any_bugs_here} *- */ #include "pal.h" #include "pal1sofa.h" #include <math.h> void palDtp2s ( double xi, double eta, double raz, double decz, double *ra, double *dec ) { double cdecz; double denom; double sdecz; double d; sdecz = sin(decz); cdecz = cos(decz); denom = cdecz - eta * sdecz; d = atan2(xi, denom) + raz; *ra = eraAnp(d); *dec = atan2(sdecz + eta * cdecz, sqrt(xi * xi + denom * denom)); return; }
// // YHPContactViewController.h // 03-小马哥通讯录(登录界面) // // Created by yhp on 16/4/10. // Copyright © 2016年 YouHuaPei. All rights reserved. // #import <UIKit/UIKit.h> @interface YHPContactViewController : UITableViewController @end
#ifndef QPID_STORE_MSCLFS_MESSAGELOG_H #define QPID_STORE_MSCLFS_MESSAGELOG_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. * */ #include <boost/intrusive_ptr.hpp> #include <qpid/broker/PersistableMessage.h> #include <qpid/broker/RecoveryManager.h> #include <qpid/sys/IntegerTypes.h> #include <qpid/store/StorageProvider.h> #include "Log.h" namespace qpid { namespace store { namespace ms_clfs { /** * @class MessageLog * * Represents a CLFS-housed message log. */ class MessageLog : public Log { protected: // Message log needs to have a no-op first record written in the log // to ensure that no real message gets an ID 0. virtual void initialize(); public: // Inherited and reimplemented from Log. Figure the minimum marshalling // buffer size needed for the records this class writes. virtual uint32_t marshallingBufferSize(); // Add the specified message to the log; Return the persistence Id. uint64_t add(const boost::intrusive_ptr<qpid::broker::PersistableMessage>& msg); // Write a Delete entry for messageId. If newFirstId is not 0, it is now // the earliest valid message in the log, so move the tail up to it. void deleteMessage(uint64_t messageId, uint64_t newFirstId); // Load part or all of a message's content from previously stored // log record(s). void loadContent(uint64_t messageId, std::string& data, uint64_t offset, uint32_t length); // Enqueue and dequeue operations track messages' transit across // queues; each operation may be associated with a transaction. If // the transactionId is 0 the operation is not associated with a // transaction. void recordEnqueue (uint64_t messageId, uint64_t queueId, uint64_t transactionId); void recordDequeue (uint64_t messageId, uint64_t queueId, uint64_t transactionId); // Recover the messages and their queueing records from the log. // @param recoverer Recovery manager used to recreate broker objects from // encoded framing buffers recovered from the log. // @param messageMap This method fills in the map of id -> ptr of // recovered messages. // @param messageOps This method fills in the map of msg id -> // vector of operations involving the message that were // recovered from the log. It is the caller's // responsibility to sort the operations out and // ascertain which operations should be acted on. The // order of operations in the vector is as they were // read in order from the log. typedef enum { RECOVERED_ENQUEUE = 1, RECOVERED_DEQUEUE } RecoveredOpType; struct RecoveredMsgOp { RecoveredOpType op; uint64_t queueId; uint64_t txnId; RecoveredMsgOp(RecoveredOpType o, const uint64_t& q, const uint64_t& t) : op(o), queueId(q), txnId(t) {} }; void recover(qpid::broker::RecoveryManager& recoverer, qpid::store::MessageMap& messageMap, std::map<uint64_t, std::vector<RecoveredMsgOp> >& messageOps); }; }}} // namespace qpid::store::ms_clfs #endif /* QPID_STORE_MSCLFS_MESSAGELOG_H */
#ifndef SEAFILE_CLIENT_UI_ACCOUNT_VIEW_H #define SEAFILE_CLIENT_UI_ACCOUNT_VIEW_H #include <QWidget> #include "ui_account-view.h" class Account; class QAction; class QMenu; class ApiError; /* * The account information area, right below the header */ class AccountView : public QWidget, public Ui::AccountView { Q_OBJECT public: AccountView(QWidget *parent=0); public slots: void onAccountChanged(); void showAddAccountDialog(); void deleteAccount(); void editAccountSettings(); void onAccountItemClicked(); private slots: void updateAvatar(); void toggleAccount(); void reloginAccount(const Account &account); void onLogoutDeviceRequestSuccess(); void onLogoutDeviceRequestFailed(const ApiError& error); void onGetRepoTokensSuccess(); void onGetRepoTokensFailed(const ApiError& error); void visitServerInBrowser(const QString& link); private: Q_DISABLE_COPY(AccountView) QAction *makeAccountAction(const Account& account); void updateAccountInfoDisplay(); bool eventFilter(QObject *obj, QEvent *event); void getRepoTokenWhenRelogin(const Account& account); // Account operations QAction *add_account_action_; QAction *account_settings_action_; QMenu *account_menu_; }; #endif // SEAFILE_CLIENT_UI_ACCOUNT_VIEW_H
/****************************************************************************** * Copyright 2017 The Apollo 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. *****************************************************************************/ /** * @file */ #pragma once #include <memory> #include <vector> #include "cyber/cyber.h" #include "modules/drivers/proto/sensor_image.pb.h" #include "CivetServer.h" /** * @namespace apollo::dreamview * @brief apollo::dreamview */ namespace apollo { namespace dreamview { /** * @class ImageHandler * * @brief The ImageHandler, built on top of CivetHandler, converts the received * ROS image message to an image stream, wrapped by MJPEG Streaming Protocol. */ class ImageHandler : public CivetHandler { public: // The scale used to resize images sent to frontend static constexpr double kImageScale = 0.2; ImageHandler(); bool handleGet(CivetServer *server, struct mg_connection *conn); private: template <typename SensorMsgsImage> void OnImage(const std::shared_ptr<SensorMsgsImage> &image); void OnImageFront(const std::shared_ptr<apollo::drivers::Image> &image); void OnImageShort( const std::shared_ptr<apollo::drivers::CompressedImage> &image); std::vector<uint8_t> send_buffer_; std::atomic<int> requests_; // mutex lock and condition variable to protect the received image std::mutex mutex_; std::condition_variable cvar_; std::unique_ptr<cyber::Node> node_; }; } // namespace dreamview } // namespace apollo
#ifndef _IPXE_PNG_H #define _IPXE_PNG_H /** @file * * Portable Network Graphics (PNG) format * */ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include <stdint.h> #include <byteswap.h> #include <ipxe/image.h> /** A PNG file signature */ struct png_signature { /** Signature bytes */ uint8_t bytes[8]; } __attribute__ (( packed )); /** PNG file signature */ #define PNG_SIGNATURE { { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' } } /** A PNG chunk header */ struct png_chunk_header { /** Length of the chunk (excluding header and footer) */ uint32_t len; /** Chunk type */ uint32_t type; } __attribute__ (( packed )); /** A PNG chunk footer */ struct png_chunk_footer { /** CRC */ uint32_t crc; } __attribute__ (( packed )); /** PNG chunk type property bits */ enum png_chunk_type_bits { /** Chunk is ancillary */ PNG_CHUNK_ANCILLARY = 0x20000000UL, /** Chunk is private */ PNG_CHUNK_PRIVATE = 0x00200000UL, /** Reserved */ PNG_CHUNK_RESERVED = 0x00002000UL, /** Chunk is safe to copy */ PNG_CHUNK_SAFE = 0x00000020UL, }; /** * Canonicalise PNG chunk type * * @v type Raw chunk type * @ret type Canonicalised chunk type (excluding property bits) */ static inline __attribute__ (( always_inline )) uint32_t png_canonical_type ( uint32_t type ) { return ( type & ~( htonl ( PNG_CHUNK_ANCILLARY | PNG_CHUNK_PRIVATE | PNG_CHUNK_RESERVED | PNG_CHUNK_SAFE ) ) ); } /** * Define a canonical PNG chunk type * * @v first First letter (in upper case) * @v second Second letter (in upper case) * @v third Third letter (in upper case) * @v fourth Fourth letter (in upper case) * @ret type Canonical chunk type */ #define PNG_TYPE( first, second, third, fourth ) \ ( ( (first) << 24 ) | ( (second) << 16 ) | ( (third) << 8 ) | (fourth) ) /** PNG image header chunk type */ #define PNG_TYPE_IHDR PNG_TYPE ( 'I', 'H', 'D', 'R' ) /** A PNG image header */ struct png_image_header { /** Width */ uint32_t width; /** Height */ uint32_t height; /** Bit depth */ uint8_t depth; /** Colour type */ uint8_t colour_type; /** Compression method */ uint8_t compression; /** Filter method */ uint8_t filter; /** Interlace method */ uint8_t interlace; } __attribute__ (( packed )); /** PNG colour type bits */ enum png_colour_type { /** Palette is used */ PNG_COLOUR_TYPE_PALETTE = 0x01, /** RGB colour is used */ PNG_COLOUR_TYPE_RGB = 0x02, /** Alpha channel is used */ PNG_COLOUR_TYPE_ALPHA = 0x04, }; /** PNG colour type mask */ #define PNG_COLOUR_TYPE_MASK 0x07 /** PNG compression methods */ enum png_compression_method { /** DEFLATE compression with 32kB sliding window */ PNG_COMPRESSION_DEFLATE = 0x00, /** First unknown compression method */ PNG_COMPRESSION_UNKNOWN = 0x01, }; /** PNG filter methods */ enum png_filter_method { /** Adaptive filtering with five basic types */ PNG_FILTER_BASIC = 0x00, /** First unknown filter method */ PNG_FILTER_UNKNOWN = 0x01, }; /** PNG interlace methods */ enum png_interlace_method { /** No interlacing */ PNG_INTERLACE_NONE = 0x00, /** Adam7 interlacing */ PNG_INTERLACE_ADAM7 = 0x01, /** First unknown interlace method */ PNG_INTERLACE_UNKNOWN = 0x02, }; /** PNG palette chunk type */ #define PNG_TYPE_PLTE PNG_TYPE ( 'P', 'L', 'T', 'E' ) /** A PNG palette entry */ struct png_palette_entry { /** Red */ uint8_t red; /** Green */ uint8_t green; /** Blue */ uint8_t blue; } __attribute__ (( packed )); /** A PNG palette chunk */ struct png_palette { /** Palette entries */ struct png_palette_entry entries[0]; } __attribute__ (( packed )); /** Maximum number of PNG palette entries */ #define PNG_PALETTE_COUNT 256 /** PNG image data chunk type */ #define PNG_TYPE_IDAT PNG_TYPE ( 'I', 'D', 'A', 'T' ) /** PNG basic filter types */ enum png_basic_filter_type { /** No filtering */ PNG_FILTER_BASIC_NONE = 0, /** Left byte used as predictor */ PNG_FILTER_BASIC_SUB = 1, /** Above byte used as predictor */ PNG_FILTER_BASIC_UP = 2, /** Above and left bytes used as predictors */ PNG_FILTER_BASIC_AVERAGE = 3, /** Paeth filter */ PNG_FILTER_BASIC_PAETH = 4, }; /** PNG image end chunk type */ #define PNG_TYPE_IEND PNG_TYPE ( 'I', 'E', 'N', 'D' ) extern struct image_type png_image_type __image_type ( PROBE_NORMAL ); #endif /* _IPXE_PNG_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. */ #pragma once #include <stdbool.h> #include <jansson.h> struct jwt { json_t *raw; const char *iss; const char *sub; json_t *aud; double exp; double nbf; double iat; const char *jti; int cdniv; const char *cdnicrit; const char *cdniip; const char *cdniuc; int cdniets; int cdnistt; int cdnistd; }; struct jwt *parse_jwt(json_t *raw); void jwt_delete(struct jwt *jwt); bool jwt_validate(struct jwt *jwt); bool jwt_check_aud(json_t *aud, const char *id); bool jwt_check_uri(const char *cdniuc, const char *uri); struct _cjose_jwk_int; char *renew(struct jwt *jwt, const char *iss, struct _cjose_jwk_int *jwk, const char *alg, const char *package, const char *uri, size_t uri_ct);
/* Copyright 2019 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_LITE_DELEGATES_GPU_METAL_DELEGATE_INTERNAL_H_ #define TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_INTERNAL_H_ #import <Metal/Metal.h> #include <functional> struct TfLiteDelegate; // Binds Metal buffer to an input or an output tensor in the initialized // delegate. Bound buffer should have sufficient storage to accommodate all // elements of a tensor. For quantized model, the buffer is bound to internal // dequantized float32 tensor. // Returns non-zero on success, or zero otherwise. // // *** Must be called *after* `Interpreter::ModifyGraphWithDelegate`. *** bool TFLGpuDelegateBindMetalBufferToTensor(TfLiteDelegate* delegate, int tensor_index, id<MTLBuffer> metal_buffer); // Binds user-defined MTLCommandBuffer. The delegate puts all GPU tasks // into this buffer instead of the internal command buffer. bool TFLGpuDelegateSetCommandBuffer(TfLiteDelegate* delegate, id<MTLCommandBuffer> command_buffer); #endif // TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_INTERNAL_H_
/* SPDX-License-Identifier: BSD-2-Clause */ /* * Copyright (c) 2014, STMicroelectronics International N.V. */ #ifndef TEE_MISC_H #define TEE_MISC_H #include <types_ext.h> /* * Macro to derive hex string buffer size from binary buffer size & the * reverse */ #define TEE_B2HS_HSBUF_SIZE(x) ((x) * 2 + 1) #define TEE_HS2B_BBUF_SIZE(x) ((x + 1) >> 1) /* * binary to hex string buffer * Returns the number of data bytes written to the hex string */ uint32_t tee_b2hs(uint8_t *b, uint8_t *hs, uint32_t blen, uint32_t hslen); /* * hex string to binary buffer * Returns the number of data bytes written to the bin buffer */ uint32_t tee_hs2b(uint8_t *hs, uint8_t *b, uint32_t hslen, uint32_t blen); /* * Is buffer 'b' inside/outside/overlapping area 'a'? * * core_is_buffer_inside() - return true if buffer is inside memory area * core_is_buffer_outside() - return true if buffer is outside area * core_is_buffer_intersect() - return true if buffer overlaps area * * Warning: core_is_buffer_inside(x,x,x,x)==false does NOT mean * core_is_buffer_outside(x,x,x,x)==true. * * Arguments use by each of these routines: * @b - buffer start address (handled has an unsigned offset) * @bl - length (in bytes) of the target buffer * @a - memory area start address (handled has an unsigned offset) * @al - memory area length (in byte) */ #define core_is_buffer_inside(b, bl, a, al) \ _core_is_buffer_inside((vaddr_t)(b), (size_t)(bl), \ (vaddr_t)(a), (size_t)(al)) #define core_is_buffer_outside(b, bl, a, al) \ _core_is_buffer_outside((vaddr_t)(b), (size_t)(bl), \ (vaddr_t)(a), (size_t)(al)) #define core_is_buffer_intersect(b, bl, a, al) \ _core_is_buffer_intersect((vaddr_t)(b), (size_t)(bl), \ (vaddr_t)(a), (size_t)(al)) bool _core_is_buffer_inside(vaddr_t b, size_t bl, vaddr_t a, size_t al); bool _core_is_buffer_outside(vaddr_t b, size_t bl, vaddr_t a, size_t al); bool _core_is_buffer_intersect(vaddr_t b, size_t bl, vaddr_t a, size_t al); #endif /* TEE_MISC_H */
/* * Copyright (c) 2020, The OpenThread Authors. * 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 copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @file * @brief * This file defines the link metrics interface for OpenThread platform radio drivers. * * APIs defined in this module could be used by a platform to implement Enhanced-ACK Based Probing feature * (Probing Subject side) in its radio driver. * */ #ifndef OPENTHREAD_UTILS_LINK_METRICS_H #define OPENTHREAD_UTILS_LINK_METRICS_H #include <openthread/link_metrics.h> #include "mac_frame.h" #ifdef __cplusplus extern "C" { #endif /** * This method initializes the Link Metrics util module. * * @param[in] aNoiseFloor The noise floor used by Link Metrics. It should be set to the platform's * noise floor (measured noise floor, receiver sensitivity or a constant). * */ void otLinkMetricsInit(int8_t aNoiseFloor); /** * This method sets/clears Enhanced-ACK Based Probing for a specific Initiator. * * This method can start/stop Enhanced-ACK Based Probing for a neighbor that has the address @p aShortAddress and * @p aExtAddress. Once the Probing is started, the device would record the Link Metrics data of link layer frames * sent from that neighbor and include the data into header IE in Enhanced-ACK sent to that neighbor. * * @param[in] aShortAddress The short address of the Initiator. * @param[in] aExtAddress A pointer to the extended address of the Initiator. * @param[in] aLinkMetrics Flags specifying what metrics to query (Pdu Count would be omitted). When * @p aLinkMetrics is eqaul to `0`, this method clears the Initiator. * * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `nullptr`. * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. * */ otError otLinkMetricsConfigureEnhAckProbing(otShortAddress aShortAddress, const otExtAddress *aExtAddress, otLinkMetrics aLinkMetrics); /** * This method generates the Link Metrics data (assessed for the acknowledged frame) bytes that would be included in * Vendor-Specific IE. * * This method first checks what Link Metrics are specified by the Initiator indicated by @p aMacAddress. And then * write the values to @p aData. * * @param[in] aMacAddress The Mac address of the Initiator. * @param[in] aLqi LQI value of the acknowledged frame. * @param[in] aRssi RSSI value of the acknowledged frame. * @param[out] aData A pointer to the buffer where the data would be written to. The caller should make * sure that the size of the buffer is not less than the size of Link Metrics data * configured before. * * @returns The size of data read. Would be `0` if the Initiator is not found or @p aData is invalid. * */ uint8_t otLinkMetricsEnhAckGenData(const otMacAddress *aMacAddress, uint8_t aLqi, int8_t aRssi, uint8_t *aData); /** * This method returns the data length of Enhanced-ACK Based Probing for a specific Initiator. * * @param[in] aMacAddress The Mac address of the Initiator. * * @returns The size of data. `0` if it's not configured for the Initiator. * */ uint8_t otLinkMetricsEnhAckGetDataLen(const otMacAddress *aMacAddress); #ifdef __cplusplus } // extern "C" #endif #endif // OPENTHREAD_UTILS_LINK_METRICS_H
/* ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #ifndef _PPC_THREAD_STRUCT_H #define _PPC_THREAD_STRUCT_H // architecture specific thread info struct arch_thread { addr_t sp; // current stack pointer }; struct arch_proc { // nothing here }; #endif
/*! @par Revision history: - 06.02.2001, c - 05.03.2003, adopted from rcfem2 */ #ifndef _FMFIELD_H_ #define _FMFIELD_H_ #include "common.h" BEGIN_C_DECLS #define MachEps 1e-16 /*! @par Revision history: - 06.02.2001, c - 27.04.2001 - 31.03.2003 */ typedef struct FMField { int32 nCell; int32 nLev; int32 nRow; int32 nCol; float64 *val0; float64 *val; int32 nAlloc; int32 cellSize; int32 offset; int32 nColFull; } FMField; /*! FMField cell pointer manipulation. @par Revision history: - 27.04.2001, c - 30.04.2001 - 11.07.2002 */ #define FMF_PtrFirst( obj ) ((obj)->val0) #define FMF_PtrCurrent( obj ) ((obj)->val) #define FMF_PtrCell( obj, n ) ((obj)->val0 + (n) * (obj)->cellSize) #define FMF_PtrCellX1( obj, n ) ((obj)->nCell > 1 \ ? (obj)->val0 + (n) * (obj)->cellSize : (obj)->val0) #define FMF_SetFirst( obj ) ((obj)->val = (obj)->val0) #define FMF_SetCell( obj, n ) ((obj)->val = (obj)->val0 + (n) * (obj)->cellSize) #define FMF_SetCellX1( obj, n ) do {\ if ((obj)->nCell > 1) ((obj)->val = (obj)->val0 + (n) * (obj)->cellSize); \ } while (0) #define FMF_SetCellNext( obj ) ((obj)->val += (obj)->cellSize) /*! Access to row @ir of level @a il of FMField @a obj. @par Revision history: - 22.04.2001, c */ #define FMF_PtrRowOfLevel( obj, il, ir ) ((obj)->val + \ (obj)->nCol * ((obj)->nRow * (il) + (ir))) /*! Access to level @a il of FMField @a obj. @par Revision history: - 22.04.2001, c */ #define FMF_PtrLevel( obj, il ) ((obj)->val + \ (obj)->nCol * (obj)->nRow * (il)) int32 fmf_alloc( FMField *obj, int32 nCell, int32 nLev, int32 nRow, int32 nCol ); int32 fmf_createAlloc( FMField **p_obj, int32 nCell, int32 nLev, int32 nRow, int32 nCol ); int32 fmf_createAllocInit( FMField **p_obj, int32 nCell, int32 nLev, int32 nRow, int32 nCol, float64 *val ); int32 fmf_createAllocCopy( FMField **p_obj, FMField *obj ); int32 fmf_free( FMField *obj ); int32 fmf_freeDestroy( FMField **p_obj ); int32 fmf_pretend( FMField *obj, int32 nCell, int32 nLev, int32 nRow, int32 nCol, float64 *data ); int32 fmf_pretend_nc( FMField *obj, int32 nCell, int32 nLev, int32 nRow, int32 nCol, float64 *data ); int32 fmfr_pretend( FMField *obj, int32 nLev, int32 nRow, int32 nCol, float64 *data, int32 offset, int32 nColFull ); int32 fmf_set_qp(FMField *qp_obj, int32 iqp, FMField *obj); int32 fmf_getDim( FMField *obj, int32 *p_nCell, int32 *p_nLev, int32 *p_nRow, int32 *p_nCol ); int32 fmf_fillC( FMField *obj, float64 val ); int32 fmfr_fillC( FMField *obj, float64 val ); int32 fmfc_fillC( FMField *obj, float64 val ); int32 fmfc_fill( FMField *obj, float64 *val ); int32 fmf_mulC( FMField *obj, float64 val ); int32 fmfc_mulC( FMField *obj, float64 val ); int32 fmf_mul( FMField *obj, float64 *val ); int32 fmf_mulAC( FMField *objR, FMField *objA, float64 val ); int32 fmf_mulATC( FMField *objR, FMField *objA, float64 val ); int32 fmf_mulAF( FMField *objR, FMField *objA, float64 *val ); int32 fmf_mulATF( FMField *objR, FMField *objA, float64 *val ); int32 fmf_mulAB_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulAB_n1( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulAB_1n( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulATB_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulATB_1n( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulABT_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulATBT_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_mulATBT_1n( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_addAB_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_subAB_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmfc_addAB_nn( FMField *objR, FMField *objA, FMField *objB ); int32 fmf_averageCACB( FMField *objR, float64 c1, FMField *objA, float64 c2, FMField *objB ); int32 fmfc_averageCACB( FMField *objR, float64 c1, FMField *objA, float64 c2, FMField *objB ); int32 fmfc_normalize( FMField *objR, FMField *objA ); int32 fmf_addAmulF( FMField *objR, FMField *objA, float64 *val ); int32 fmfc_addAmulF( FMField *objR, FMField *objA, float64 *val ); int32 fmf_copyAmulC( FMField *objR, FMField *objA, float64 val ); int32 fmfc_copyAmulF( FMField *objR, FMField *objA, float64 *val ); int32 fmfr_addA_blockNC( FMField *objR, FMField *objA, int32 row, int32 col ); int32 fmfr_addAT_blockNC( FMField *objR, FMField *objA, int32 row, int32 col ); int32 fmf_sumLevelsMulF( FMField *objR, FMField *objA, float64 *val ); int32 fmf_sumLevelsTMulF( FMField *objR, FMField *objA, float64 *val ); int32 fmfr_sumLevelsMulF( FMField *objR, FMField *objA, float64 *val ); int32 fmfr_sumLevelsTMulF( FMField *objR, FMField *objA, float64 *val ); int32 fmf_copy( FMField *objR, FMField *objA ); int32 fmfr_copy( FMField *objR, FMField *objA ); int32 fmfc_copy( FMField *objR, FMField *objA ); int32 fmf_print( FMField *obj, FILE *file, int32 mode ); int32 fmfr_print( FMField *obj, FILE *file, int32 mode ); int32 fmf_save( FMField *obj, const char *fileName, int32 mode ); int32 fmfr_save( FMField *obj, const char *fileName, int32 mode ); int32 fmfc_save( FMField *obj, const char *fileName, int32 mode ); int32 fmf_gMtx2VecDUL3x3( FMField *objR, FMField *objA ); int32 fmf_gMtx2VecDLU3x3( FMField *objR, FMField *objA ); END_C_DECLS #endif /* Header */
#include "FLA_f2c.h" #ifdef __cplusplus extern "C" { #endif shortint h_mod(short *a, short *b) { return( *a % *b); } integer i_mod(integer *a, integer *b) { return( *a % *b); } double r_mod(real *x, real *y) { double quotient; if( (quotient = (double)*x / *y) >= 0) quotient = floor(quotient); else quotient = -floor(-quotient); return(*x - (*y) * quotient ); } double d_mod(doublereal *x, doublereal *y) { double quotient; if( (quotient = *x / *y) >= 0) quotient = floor(quotient); else quotient = -floor(-quotient); return(*x - (*y) * quotient ); } #ifdef __cplusplus } #endif
/* $OpenBSD: ech_err.c,v 1.6 2017/01/29 17:49:23 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 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. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* NOTE: this file was auto generated by the mkerr.pl script: any changes * made to it will be overwritten when the script next updates this file, * only reason strings will be preserved. */ #include <stdio.h> #include <openssl/opensslconf.h> #include <openssl/err.h> #include <openssl/ecdh.h> /* BEGIN ERROR CODES */ #ifndef OPENSSL_NO_ERR #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ECDH,func,0) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ECDH,0,reason) static ERR_STRING_DATA ECDH_str_functs[]= { {ERR_FUNC(0xfff), "CRYPTO_internal"}, {0, NULL} }; static ERR_STRING_DATA ECDH_str_reasons[]= { {ERR_REASON(ECDH_R_KDF_FAILED) , "KDF failed"}, {ERR_REASON(ECDH_R_KEY_TRUNCATION), "key would be truncated"}, {ERR_REASON(ECDH_R_NON_FIPS_METHOD) , "non fips method"}, {ERR_REASON(ECDH_R_NO_PRIVATE_VALUE) , "no private value"}, {ERR_REASON(ECDH_R_POINT_ARITHMETIC_FAILURE), "point arithmetic failure"}, {0, NULL} }; #endif void ERR_load_ECDH_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_func_error_string(ECDH_str_functs[0].error) == NULL) { ERR_load_strings(0, ECDH_str_functs); ERR_load_strings(0, ECDH_str_reasons); } #endif }
#include <stdlib.h> struct list_elem_t { void *data; struct list_elem_t *next; }; struct list_t { struct list_elem_t *head; }; struct S { struct list_t *components; struct list_t *properties; }; void *list_pop(struct list_t *lst) { if(!lst->head) return NULL; struct list_elem_t *elem = lst->head; void *elt = elem->data; lst->head = lst->head->next; free(elem); return elt; } void list_push(struct list_t *lst, void *comp) { struct list_elem_t *e = malloc(sizeof(struct list_elem_t)); e->next = lst->head; lst->head = e; lst->head->data = comp; } void add_component(struct S *s, void *comp) { list_push(s->components, comp); } void free_S(struct S *s) { void *item; while((item = list_pop(s->components))) free(item); free(s); }
/***************************************************************************** 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 sgtrfs * Author: Intel Corporation * Generated November 2015 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_sgtrfs( int matrix_layout, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, const float* dlf, const float* df, const float* duf, const float* du2, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ) { lapack_int info = 0; lapack_int* iwork = NULL; float* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sgtrfs", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_sge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) { return -13; } if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -6; } if( LAPACKE_s_nancheck( n, df, 1 ) ) { return -9; } if( LAPACKE_s_nancheck( n-1, dl, 1 ) ) { return -5; } if( LAPACKE_s_nancheck( n-1, dlf, 1 ) ) { return -8; } if( LAPACKE_s_nancheck( n-1, du, 1 ) ) { return -7; } if( LAPACKE_s_nancheck( n-2, du2, 1 ) ) { return -11; } if( LAPACKE_s_nancheck( n-1, duf, 1 ) ) { return -10; } if( LAPACKE_sge_nancheck( matrix_layout, n, nrhs, x, ldx ) ) { return -15; } } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,3*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_sgtrfs_work( matrix_layout, trans, n, nrhs, dl, d, du, dlf, df, duf, du2, ipiv, b, ldb, x, ldx, ferr, berr, work, iwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sgtrfs", info ); } return info; }
/***************************************************************************** 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 middle-level C interface to LAPACK function dlange * Author: Intel Corporation * Generated June 2017 *****************************************************************************/ #include "lapacke_utils.h" double LAPACKE_dlange_work( int matrix_layout, char norm, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* work ) { lapack_int info = 0; double res = 0.; char norm_lapack; if( matrix_layout == LAPACK_COL_MAJOR ) { /* Call LAPACK function */ res = LAPACK_dlange( &norm, &m, &n, a, &lda, work ); } else if( matrix_layout == LAPACK_ROW_MAJOR ) { double* work_lapack = NULL; /* Check leading dimension(s) */ if( lda < n ) { info = -6; LAPACKE_xerbla( "LAPACKE_dlange_work", info ); return info; } if( LAPACKE_lsame( norm, '1' ) || LAPACKE_lsame( norm, 'o' ) ) { norm_lapack = 'i'; } else if( LAPACKE_lsame( norm, 'i' ) ) { norm_lapack = '1'; } else { norm_lapack = norm; } /* Allocate memory for work array(s) */ if( LAPACKE_lsame( norm_lapack, 'i' ) ) { work_lapack = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) ); if( work_lapack == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } } /* Call LAPACK function */ res = LAPACK_dlange( &norm_lapack, &n, &m, a, &lda, work_lapack ); /* Release memory and exit */ if( work_lapack ) { LAPACKE_free( work_lapack ); } exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dlange_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_dlange_work", info ); } return res; }
// Copyright 2014 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 GridPositionsResolver_h #define GridPositionsResolver_h #include "core/style/GridPosition.h" #include "wtf/Allocator.h" namespace blink { struct GridSpan; class LayoutBox; class ComputedStyle; enum GridPositionSide { ColumnStartSide, ColumnEndSide, RowStartSide, RowEndSide }; enum GridTrackSizingDirection { ForColumns, ForRows }; // This is a utility class with all the code related to grid items positions resolution. class GridPositionsResolver { DISALLOW_NEW(); public: static size_t explicitGridColumnCount(const ComputedStyle&); static size_t explicitGridRowCount(const ComputedStyle&); static bool isValidNamedLineOrArea(const String& lineName, const ComputedStyle&, GridPositionSide); static GridPositionSide initialPositionSide(GridTrackSizingDirection); static GridPositionSide finalPositionSide(GridTrackSizingDirection); static size_t spanSizeForAutoPlacedItem(const ComputedStyle&, const LayoutBox&, GridTrackSizingDirection); static GridSpan resolveGridPositionsFromStyle(const ComputedStyle&, const LayoutBox&, GridTrackSizingDirection); }; } // namespace blink #endif // GridPositionsResolver_h
/* Copyright (C) 2014, The University of Texas at Austin This file is part of libflame and is available under the 3-Clause BSD license, which can be found in the LICENSE file at the top-level directory, or at http://opensource.org/licenses/BSD-3-Clause */ #include "FLAME.h" FLA_Error FLA_Eig_gest_nu_unb_var2( FLA_Obj A, FLA_Obj Y, FLA_Obj B ) { FLA_Obj ATL, ATR, A00, a01, A02, ABL, ABR, a10t, alpha11, a12t, A20, a21, A22; FLA_Obj BTL, BTR, B00, b01, B02, BBL, BBR, b10t, beta11, b12t, B20, b21, B22; FLA_Obj yL, yR, y10t, psi11, y12t; FLA_Obj y12t_t, y12t_b; FLA_Part_2x2( A, &ATL, &ATR, &ABL, &ABR, 0, 0, FLA_TL ); FLA_Part_2x2( B, &BTL, &BTR, &BBL, &BBR, 0, 0, FLA_TL ); FLA_Part_1x2( Y, &yL, &yR, 0, FLA_LEFT ); while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){ FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02, /* ************* */ /* ************************** */ &a10t, /**/ &alpha11, &a12t, ABL, /**/ ABR, &A20, /**/ &a21, &A22, 1, 1, FLA_BR ); FLA_Repart_2x2_to_3x3( BTL, /**/ BTR, &B00, /**/ &b01, &B02, /* ************* */ /* ************************* */ &b10t, /**/ &beta11, &b12t, BBL, /**/ BBR, &B20, /**/ &b21, &B22, 1, 1, FLA_BR ); FLA_Repart_1x2_to_1x3( yL, /**/ yR, &y10t, /**/ &psi11, &y12t, 1, FLA_RIGHT ); /*------------------------------------------------------------*/ FLA_Part_2x1( y12t, &y12t_t, &y12t_b, 1, FLA_TOP ); // a01 = a01 * beta11; FLA_Scal_external( beta11, a01 ); // a01 = a01 + A02 * b12t'; FLA_Gemvc_external( FLA_NO_TRANSPOSE, FLA_CONJUGATE, FLA_ONE, A02, b12t, FLA_ONE, a01 ); // y12t = b12t * A22; // y12t^T = A22^T * b12t^T; FLA_Hemvc_external( FLA_UPPER_TRIANGULAR, FLA_CONJUGATE, FLA_ONE, A22, b12t, FLA_ZERO, y12t_t ); // a12t = beta11 * a12t; FLA_Scal_external( beta11, a12t ); // a12t = a12t + 1/2 * y12t; FLA_Axpy_external( FLA_ONE_HALF, y12t_t, a12t ); // alpha11 = conj(beta11) * alpha11 * beta11; // = beta11 * alpha11 * beta11; FLA_Scal_external( beta11, alpha11 ); FLA_Scal_external( beta11, alpha11 ); // alpha11 = alpha11 + a12t * b12t' + b12t * a12t'; FLA_Dot2cs_external( FLA_CONJUGATE, FLA_ONE, a12t, b12t, FLA_ONE, alpha11 ); // a12t = a12t + 1/2 * y12t; FLA_Axpy_external( FLA_ONE_HALF, y12t_t, a12t ); /*------------------------------------------------------------*/ FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02, a10t, alpha11, /**/ a12t, /* ************** */ /* ************************ */ &ABL, /**/ &ABR, A20, a21, /**/ A22, FLA_TL ); FLA_Cont_with_3x3_to_2x2( &BTL, /**/ &BTR, B00, b01, /**/ B02, b10t, beta11, /**/ b12t, /* ************** */ /* *********************** */ &BBL, /**/ &BBR, B20, b21, /**/ B22, FLA_TL ); FLA_Cont_with_1x3_to_1x2( &yL, /**/ &yR, y10t, psi11, /**/ y12t, FLA_LEFT ); } return FLA_SUCCESS; }
/*- * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * The full GNU General Public License is included in this distribution * in the file called LICENSE.GPL. * * BSD LICENSE * * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. * * $FreeBSD$ */ #ifndef _SAT_H_ #define _SAT_H_ /** * @file * @brief This file contains constants and constructs defined in the SCSI * to ATA Translation (SAT) T10 standard. For more information please * refer to www.t10.org. */ /** * @name SAT_PROTOCOLS * * These constants indicate the various protocol values that can be supported * in a SAT translator. */ /*@{*/ #define SAT_PROTOCOL_ATA_HARD_RESET 0 #define SAT_PROTOCOL_SOFT_RESET 1 #define SAT_PROTOCOL_NON_DATA 3 #define SAT_PROTOCOL_PIO_DATA_IN 4 #define SAT_PROTOCOL_PIO_DATA_OUT 5 #define SAT_PROTOCOL_DMA 6 #define SAT_PROTOCOL_DMA_QUEUED 7 #define SAT_PROTOCOL_DEVICE_DIAGNOSTIC 8 #define SAT_PROTOCOL_DEVICE_RESET 9 #define SAT_PROTOCOL_UDMA_DATA_IN 10 #define SAT_PROTOCOL_UDMA_DATA_OUT 11 #define SAT_PROTOCOL_FPDMA 12 #define SAT_PROTOCOL_RETURN_RESPONSE_INFO 15 #define SAT_PROTOCOL_PACKET 0x10 #define SAT_PROTOCOL_PACKET_NON_DATA (SAT_PROTOCOL_PACKET | 0x0) #define SAT_PROTOCOL_PACKET_DMA_DATA_IN (SAT_PROTOCOL_PACKET | 0x1) #define SAT_PROTOCOL_PACKET_DMA_DATA_OUT (SAT_PROTOCOL_PACKET | 0x2) #define SAT_PROTOCOL_PACKET_PIO_DATA_IN (SAT_PROTOCOL_PACKET | 0x3) #define SAT_PROTOCOL_PACKET_PIO_DATA_OUT (SAT_PROTOCOL_PACKET | 0x4) /*@}*/ #endif // _SAT_H_
/*========================================================================= Library : Image Registration Toolkit (IRTK) Module : $Id$ Copyright : Imperial College, Department of Computing Visual Information Processing (VIP), 2008 onwards Date : $Date$ Version : $Revision$ Changes : $Author$ Copyright (c) 1999-2014 and onwards, Imperial College London All rights reserved. See LICENSE for details =========================================================================*/ #ifndef _IRTKNONLOCALMEDIANFILTER_H #define _IRTKNONLOCALMEDIANFILTER_H #include <irtkImageToImage.h> /** * Class for non local median filter of images * * This class defines and implements the non local median filter of images. * Follwing Y. Li and S. Osher. A new median formula with applications to PDE * based denoising. Commun. Math. Sci., 7(3):741–753, 2009. * The non local weight is a Gaussian function of 4D distance where intensity is * considered as the fourth dimension */ template <class VoxelType> class irtkNonLocalMedianFilter : public irtkImageToImage<VoxelType> { protected: /// Sigma (standard deviation of Gaussian kernel) int _Sigma; /// Second input, i.e. the scale image irtkGenericImage<irtkGreyPixel> *_input2; /// Third input, i.e. occlusion irtkGenericImage<irtkRealPixel> *_input3; /// Fourth input, i.e. constrain irtkGenericImage<VoxelType> *_input4; irtkGenericImage<VoxelType> *_edge; float *_localweight; float *_localneighbor; float _dx; float _dy; float _dz; float _ds; float _Lambda; /// Initialize the filter virtual void Initialize(); /// Finalize the filter virtual void Finalize(); virtual double EvaluateWeight(const double &); /** Run This method is protected and should only * be called from within public member function Run(). */ virtual double Run(int, int, int, int); /// Returns whether the filter requires buffering virtual bool RequiresBuffering(); /// Returns the name of the class virtual const char *NameOfClass(); public: /// Constructor to remvoe the non-local term /// only supply the size argument /// otherwise an non-local weight will be cauculated using input1 /// i.e. second argument irtkNonLocalMedianFilter(int,irtkGenericImage<irtkGreyPixel>* = NULL, irtkGenericImage<irtkRealPixel>* = NULL,irtkGenericImage<VoxelType>* = NULL); /// Destructor ~irtkNonLocalMedianFilter(); /// Run virtual void Run(); /// Set displacement SetMacro(input2, irtkGenericImage<irtkGreyPixel>*); /// Set occlusion SetMacro(input3, irtkGenericImage<irtkRealPixel>*); /// Set constrain SetMacro(input4, irtkGenericImage<VoxelType>*); /// Set sigma SetMacro(Sigma, int); /// Set sigma SetMacro(Lambda, float); }; template <class VoxelType> inline double irtkNonLocalMedianFilter<VoxelType>::EvaluateWeight(const double &distancev) { return exp(- distancev / (_Sigma*_Sigma/2.0)); } #endif
/* arch/arm/mach-msm/include/mach/msm_fb.h * * Internal shared definitions for various MSM framebuffer parts. * * Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _MSM_FB_H_ #define _MSM_FB_H_ #include <linux/device.h> struct mddi_info; #define MSM_MDP_OUT_IF_FMT_RGB565 0 #define MSM_MDP_OUT_IF_FMT_RGB666 1 struct msm_fb_data { int xres; int yres; int width; int height; unsigned output_format; }; struct msmfb_callback { void (*func)(struct msmfb_callback *); }; enum { MSM_MDDI_PMDH_INTERFACE = 0, MSM_MDDI_EMDH_INTERFACE, MSM_EBI2_INTERFACE, MSM_LCDC_INTERFACE, MSM_MDP_NUM_INTERFACES = MSM_LCDC_INTERFACE + 1, }; #define MSMFB_CAP_PARTIAL_UPDATES (1 << 0) struct msm_panel_data { int (*suspend)(struct msm_panel_data *); int (*resume)(struct msm_panel_data *); int (*blank)(struct msm_panel_data *); int (*unblank)(struct msm_panel_data *); void (*wait_vsync)(struct msm_panel_data *); void (*request_vsync)(struct msm_panel_data *, struct msmfb_callback *); void (*clear_vsync)(struct msm_panel_data *); unsigned interface_type; struct msm_fb_data *fb_data; uint32_t caps; }; struct msm_mddi_client_data { void (*suspend)(struct msm_mddi_client_data *); void (*resume)(struct msm_mddi_client_data *); void (*activate_link)(struct msm_mddi_client_data *); void (*remote_write)(struct msm_mddi_client_data *, uint32_t val, uint32_t reg); uint32_t (*remote_read)(struct msm_mddi_client_data *, uint32_t reg); void (*auto_hibernate)(struct msm_mddi_client_data *, int); void *private_client_data; struct resource *fb_resource; unsigned interface_type; }; struct msm_mddi_platform_data { unsigned int clk_rate; void (*power_client)(struct msm_mddi_client_data *, int on); void (*fixup)(uint16_t *mfr_name, uint16_t *product_id); int vsync_irq; struct resource *fb_resource; int num_clients; struct { unsigned product_id; char *name; unsigned id; void *client_data; unsigned int clk_rate; } client_platform_data[]; }; struct msm_lcdc_timing { unsigned int clk_rate; unsigned int hsync_pulse_width; unsigned int hsync_back_porch; unsigned int hsync_front_porch; unsigned int hsync_skew; unsigned int vsync_pulse_width; unsigned int vsync_back_porch; unsigned int vsync_front_porch; unsigned int vsync_act_low:1; unsigned int hsync_act_low:1; unsigned int den_act_low:1; }; struct msm_lcdc_panel_ops { int (*init)(struct msm_lcdc_panel_ops *); int (*uninit)(struct msm_lcdc_panel_ops *); int (*blank)(struct msm_lcdc_panel_ops *); int (*unblank)(struct msm_lcdc_panel_ops *); }; struct msm_lcdc_platform_data { struct msm_lcdc_panel_ops *panel_ops; struct msm_lcdc_timing *timing; int fb_id; struct msm_fb_data *fb_data; struct resource *fb_resource; }; struct mdp_blit_req; struct fb_info; struct mdp_device { struct device dev; void (*dma)(struct mdp_device *mdp, uint32_t addr, uint32_t stride, uint32_t w, uint32_t h, uint32_t x, uint32_t y, struct msmfb_callback *callback, int interface); void (*dma_wait)(struct mdp_device *mdp, int interface); int (*blit)(struct mdp_device *mdp, struct fb_info *fb, struct mdp_blit_req *req); void (*set_grp_disp)(struct mdp_device *mdp, uint32_t disp_id); int (*check_output_format)(struct mdp_device *mdp, int bpp); int (*set_output_format)(struct mdp_device *mdp, int bpp); }; struct class_interface; int register_mdp_client(struct class_interface *class_intf); struct msm_mddi_bridge_platform_data { int (*init)(struct msm_mddi_bridge_platform_data *, struct msm_mddi_client_data *); int (*uninit)(struct msm_mddi_bridge_platform_data *, struct msm_mddi_client_data *); int (*blank)(struct msm_mddi_bridge_platform_data *, struct msm_mddi_client_data *); int (*unblank)(struct msm_mddi_bridge_platform_data *, struct msm_mddi_client_data *); struct msm_fb_data fb_data; uint32_t panel_caps; }; struct mdp_v4l2_req; int msm_fb_v4l2_enable(struct mdp_overlay *req, bool enable, void **par); int msm_fb_v4l2_update(void *par, unsigned long srcp0_addr, unsigned long srcp0_size, unsigned long srcp1_addr, unsigned long srcp1_size, unsigned long srcp2_addr, unsigned long srcp2_size); #endif
// // Evergreen.h // Evergreen // // Created by Nils Fischer on 30.09.14. // Copyright (c) 2014 viWiD Webdesign & iOS Development. All rights reserved. // @import Foundation; //! Project version number for Evergreen. FOUNDATION_EXPORT double EvergreenVersionNumber; //! Project version string for Evergreen. FOUNDATION_EXPORT const unsigned char EvergreenVersionString[];
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 2003-2013, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ #ifndef __FONTTABLECACHE_H #define __FONTTABLECACHE_H #include "layout/LETypes.h" U_NAMESPACE_USE struct FontTableCacheEntry; class FontTableCache { public: FontTableCache(); virtual ~FontTableCache(); const void *find(LETag tableTag, size_t &length) const; protected: virtual const void *readFontTable(LETag tableTag, size_t &length) const = 0; virtual void freeFontTable(const void *table) const; private: void add(LETag tableTag, const void *table, size_t length); FontTableCacheEntry *fTableCache; le_int32 fTableCacheCurr; le_int32 fTableCacheSize; }; #endif
#ifndef UTIL_CONTEXT_H_ #define UTIL_CONTEXT_H_ namespace util { class Context { private: // no copying allowed Context(const Context& other); const Context& operator=(const Context& other); protected: virtual void Finish(int r) = 0; public: Context() {} virtual ~Context() { } virtual void Complete(int r) { Finish(r); delete this; } }; } #endif
// // UIControl+SHControlEventBlock.h // Example // // Created by Seivan Heidari on 5/16/13. // Copyright (c) 2013 Seivan Heidari. All rights reserved. // #pragma mark - #pragma mark Block Defs typedef void (^SHBarButtonItemBlock)(UIBarButtonItem * sender); @interface UIBarButtonItem (SHBarButtonItemBlocks) #pragma mark - #pragma mark Init +(instancetype)SH_barButtonItemWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem withBlock:(SHBarButtonItemBlock)theBlock; +(instancetype)SH_barButtonItemWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style withBlock:(SHBarButtonItemBlock)theBlock; +(instancetype)SH_barButtonItemWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style withBlock:(SHBarButtonItemBlock)theBlock; #pragma mark - #pragma mark Add -(void)SH_addBlock:(SHBarButtonItemBlock)theBlock; #pragma mark - #pragma mark Remove -(void)SH_removeBlock:(SHBarButtonItemBlock)theBlock; -(void)SH_removeAllBlocks; #pragma mark - #pragma mark Properties #pragma mark - #pragma mark Getters @property(nonatomic,readonly) NSSet * SH_blocks; @end
// // TLYMenuTableViewController.h // TLYShyNavBarDemo // // Created by Mazyad Alabduljaleel on 10/8/15. // Copyright © 2015 Telly, Inc. All rights reserved. // #import <UIKit/UIKit.h> @interface TLYMenuTableViewController : UITableViewController @end
/************************************************************ * <bsn.cl fy=2013 v=epl> * * Copyright 2013, 2014 Big Switch Networks, Inc. * * Licensed under the Eclipse Public License, Version 1.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.eclipse.org/legal/epl-v10.html * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the * License. * * </bsn.cl> ************************************************************ * * * ***********************************************************/ #ifndef __ORC_INT_H__ #define __ORC_INT_H__ #include <orc/orc_config.h> #endif /* __ORC_INT_H__ */
/* * Copyright (C) 2004,2014 Robin Gareus <robin@gareus.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h> #include <sys/select.h> /* select() sleeps _at most_ a given time. * (compared to usleep() or nanosleep() which sleep at least a given time) */ static void select_sleep (uint64_t usec) { if (usec <= 10) return; fd_set fd; int max_fd=0; struct timeval tv; tv.tv_sec = usec / 1000000; tv.tv_usec = usec % 1000000; FD_ZERO (&fd); select (max_fd, &fd, NULL, NULL, &tv); // on Linux, tv reflects the actual time slept. }
/* * lib/fddi.c This file contains an implementation of the "FDDI" * support functions. * * Version: $Id: fddi.c,v 1.7 2000/03/05 11:26:02 philip Exp $ * * Author: Lawrence V. Stefani, <stefani@lkg.dec.com> * * 1998-07-01 - Arnaldo Carvalho de Melo <acme@conectiva.com.br> GNU gettext * * 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. */ #include "config.h" #include <features.h> #if HAVE_HWFDDI #include <sys/types.h> #include <sys/socket.h> #include <net/if_arp.h> #ifndef ARPHRD_FDDI #error "No FDDI Support in your current Kernelsource Tree." #error "Disable HW Type FDDI" #endif #if __GLIBC__ >= 2 #include <netinet/if_fddi.h> #else #include <linux/if_fddi.h> #endif #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <ctype.h> #include <string.h> #include <unistd.h> #include "net-support.h" #include "pathnames.h" #include "intl.h" #include "util.h" extern struct hwtype fddi_hwtype; /* Display an FDDI address in readable format. */ static const char *pr_fddi(const char *ptr) { static char buff[64]; snprintf(buff, sizeof(buff), "%02X-%02X-%02X-%02X-%02X-%02X", (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) ); return (buff); } #ifdef DEBUG #define _DEBUG 1 #else #define _DEBUG 0 #endif /* Input an FDDI address and convert to binary. */ static int in_fddi(char *bufp, struct sockaddr *sap) { char *ptr; char c, *orig; int i, val; sap->sa_family = fddi_hwtype.type; ptr = sap->sa_data; i = 0; orig = bufp; while ((*bufp != '\0') && (i < FDDI_K_ALEN)) { val = 0; c = *bufp++; if (isdigit(c)) val = c - '0'; else if (c >= 'a' && c <= 'f') val = c - 'a' + 10; else if (c >= 'A' && c <= 'F') val = c - 'A' + 10; else { if (_DEBUG) fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig); errno = EINVAL; return (-1); } val <<= 4; c = *bufp++; if (isdigit(c)) val |= c - '0'; else if (c >= 'a' && c <= 'f') val |= c - 'a' + 10; else if (c >= 'A' && c <= 'F') val |= c - 'A' + 10; else { if (_DEBUG) fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig); errno = EINVAL; return (-1); } *ptr++ = (unsigned char) (val & 0377); i++; /* We might get a semicolon here - not required. */ if (*bufp == ':') { if (_DEBUG && i == FDDI_K_ALEN) fprintf(stderr, _("in_fddi(%s): trailing : ignored!\n"), orig); bufp++; } } /* That's it. Any trailing junk? */ if (_DEBUG && (i == FDDI_K_ALEN) && (*bufp != '\0')) { fprintf(stderr, _("in_fddi(%s): trailing junk!\n"), orig); errno = EINVAL; return (-1); } if (_DEBUG) fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data)); return (0); } struct hwtype fddi_hwtype = { "fddi", NULL, /*"Fiber Distributed Data Interface (FDDI)", */ ARPHRD_FDDI, FDDI_K_ALEN, pr_fddi, in_fddi, NULL }; #endif /* HAVE_HWFDDI */
/* * This file is part of the OregonCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OREGON_GRIDSTATES_H #define OREGON_GRIDSTATES_H #include "Map.h" #include "Object.h" class GridState { public: virtual ~GridState() { }; virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0; }; class InvalidState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const override; }; class ActiveState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const override; }; class IdleState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const override; }; class RemovalState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const override; }; #endif
#ifndef _SEPOL_H_ #define _SEPOL_H_ #include <stddef.h> #include <stdio.h> #ifdef __cplusplus extern "C" { #endif #include <sepol/user_record.h> #include <sepol/context_record.h> #include <sepol/iface_record.h> #include <sepol/ibpkey_record.h> #include <sepol/ibendport_record.h> #include <sepol/port_record.h> #include <sepol/boolean_record.h> #include <sepol/node_record.h> #include <sepol/booleans.h> #include <sepol/interfaces.h> #include <sepol/ibpkeys.h> #include <sepol/ibendports.h> #include <sepol/ports.h> #include <sepol/nodes.h> #include <sepol/users.h> #include <sepol/handle.h> #include <sepol/debug.h> #include <sepol/policydb.h> #include <sepol/module.h> #include <sepol/context.h> /* Set internal policydb from a file for subsequent service calls. */ extern int sepol_set_policydb_from_file(FILE * fp); #ifdef __cplusplus } #endif #endif