text
stringlengths
4
6.14k
/* SPDX-License-Identifier: BSD-3-Clause */ #ifndef MAIN_H #define MAIN_H #include <tss2/tss2_esys.h> #include <stdbool.h> #include "tool_rc.h" #include "tpm2_options.h" #include "tpm2_tool_output.h" /** * An optional interface for tools to specify what options they support. * They are concatenated with main's options and passed to getopt_long. * @param opts * The callee can choose to set *opts to a tpm_options pointer allocated * via tpm2_options_new(). Setting *opts to NULL is not an error, and * Indicates that no options are specified by the tool. * * @return * True on success, false on error. */ typedef bool (*tpm2_tool_onstart_t)(tpm2_options **opts); /** * This is the main interface for tools, after tcti and sapi/esapi initialization * are performed. * @param ectx * The system/esapi api context. * @param flags * Flags that tools may wish to respect. * @return * A tool_rc indicating status. */ typedef tool_rc (*tpm2_tool_onrun_t)(ESYS_CONTEXT *ectx, tpm2_option_flags flags); /** * Called after tpm2_tool_onrun() is invoked. ESAPI context is still valid during this call. * @param ectx * The system/esapi api context. * @return * A tool_rc indicating status. */ typedef tool_rc (*tpm2_tool_onstop_t)(ESYS_CONTEXT *ectx); /** * Called when the tool is exiting, useful for cleanup. */ typedef void (*tpm2_tool_onexit_t)(void); typedef struct { const char * name; tpm2_tool_onstart_t onstart; tpm2_tool_onrun_t onrun; tpm2_tool_onstop_t onstop; tpm2_tool_onexit_t onexit; } tpm2_tool; void tpm2_tool_register(const tpm2_tool * tool); #define TPM2_TOOL_REGISTER(tool_name,tool_onstart,tool_onrun,tool_onstop,tool_onexit) \ static const tpm2_tool tool = { \ .name = tool_name, \ .onstart = tool_onstart, \ .onrun = tool_onrun, \ .onstop = tool_onstop, \ .onexit = tool_onexit, \ }; \ static void \ __attribute__((__constructor__)) \ __attribute__((__used__)) \ _tpm2_tool_init(void) \ { \ tpm2_tool_register(&tool); \ } #endif /* MAIN_H */
/* * 2007 – 2013 Copyright Northwestern University * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details. */ #ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CCOLL_ED_Text #define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CCOLL_ED_Text #include "type_iso.CANY.h" namespace AIMXML { namespace iso { class CCOLL_ED_Text : public ::AIMXML::iso::CANY { public: AIMXML_EXPORT CCOLL_ED_Text(xercesc::DOMNode* const& init); AIMXML_EXPORT CCOLL_ED_Text(CCOLL_ED_Text const& init); void operator=(CCOLL_ED_Text const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CCOLL_ED_Text); } AIMXML_EXPORT void SetXsiType(); }; } // namespace iso } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CCOLL_ED_Text
/* Generated by re2c */ #line 1 "unicode_group_Zl.u--encoding-policy(ignore).re" #include <stdio.h> #define YYCTYPE unsigned int bool scan(const YYCTYPE * start, const YYCTYPE * const limit) { __attribute__((unused)) const YYCTYPE * YYMARKER; // silence compiler warnings when YYMARKER is not used # define YYCURSOR start Zl: #line 13 "<stdout>" { YYCTYPE yych; yych = *YYCURSOR; if (yych == 0x00002028) goto yy4; ++YYCURSOR; #line 13 "unicode_group_Zl.u--encoding-policy(ignore).re" { return YYCURSOR == limit; } #line 22 "<stdout>" yy4: ++YYCURSOR; #line 12 "unicode_group_Zl.u--encoding-policy(ignore).re" { goto Zl; } #line 27 "<stdout>" } #line 14 "unicode_group_Zl.u--encoding-policy(ignore).re" } static const unsigned int chars_Zl [] = {0x2028,0x2028, 0x0,0x0}; static unsigned int encode_utf32 (const unsigned int * ranges, unsigned int ranges_count, unsigned int * s) { unsigned int * const s_start = s; for (unsigned int i = 0; i < ranges_count; i += 2) for (unsigned int j = ranges[i]; j <= ranges[i + 1]; ++j) *s++ = j; return s - s_start; } int main () { YYCTYPE * buffer_Zl = new YYCTYPE [2]; unsigned int buffer_len = encode_utf32 (chars_Zl, sizeof (chars_Zl) / sizeof (unsigned int), buffer_Zl); if (!scan (reinterpret_cast<const YYCTYPE *> (buffer_Zl), reinterpret_cast<const YYCTYPE *> (buffer_Zl + buffer_len))) printf("test 'Zl' failed\n"); delete [] buffer_Zl; return 0; }
#ifndef RESEED_H #define RESEED_H #include <iostream> #include <string> #include <vector> #include <map> #include <cryptopp/osrng.h> #include <cryptopp/rsa.h> #include <boost/asio.hpp> #include "Identity.h" #include "aes.h" namespace i2p { namespace data { class Reseeder { typedef Tag<512> PublicKey; public: Reseeder(); ~Reseeder(); bool reseedNow(); // depreacted int ReseedNowSU3 (); void LoadCertificates (); private: void LoadCertificate (const std::string& filename); std::string LoadCertificate (CryptoPP::ByteQueue& queue); // returns issuer's name int ReseedFromSU3 (const std::string& host, bool https = false); int ProcessSU3File (const char * filename); int ProcessSU3Stream (std::istream& s); bool FindZipDataDescriptor (std::istream& s); std::string HttpsRequest (const std::string& address); private: std::map<std::string, PublicKey> m_SigningKeys; }; class TlsCipher { public: virtual ~TlsCipher () {}; virtual void CalculateMAC (uint8_t type, const uint8_t * buf, size_t len, uint8_t * mac) = 0; virtual size_t Encrypt (const uint8_t * in, size_t len, const uint8_t * mac, uint8_t * out) = 0; virtual size_t Decrypt (uint8_t * buf, size_t len) = 0; virtual size_t GetIVSize () const { return 0; }; // override for AES }; class TlsSession { public: TlsSession (const std::string& host, int port); ~TlsSession (); void Send (const uint8_t * buf, size_t len); bool Receive (std::ostream& rs); bool IsEstablished () const { return m_IsEstablished; }; private: void Handshake (); void SendHandshakeMsg (uint8_t handshakeType, uint8_t * data, size_t len); void SendFinishedMsg (); CryptoPP::RSA::PublicKey ExtractPublicKey (const uint8_t * certificate, size_t len); void PRF (const uint8_t * secret, const char * label, const uint8_t * random, size_t randomLen, size_t len, uint8_t * buf); private: bool m_IsEstablished; boost::asio::ip::tcp::iostream m_Site; CryptoPP::SHA256 m_FinishedHash; uint8_t m_MasterSecret[64]; // actual size is 48, but must be multiple of 32 TlsCipher * m_Cipher; }; } } #endif
/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * 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 acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: src/sys/libkern/iordi3.c,v 1.5 1999/08/28 00:46:32 peter Exp $ */ #include "quad.h" /* * Return a | b, in quad. */ quad_t __iordi3(a, b) quad_t a, b; { union uu aa, bb; aa.q = a; bb.q = b; aa.ul[0] |= bb.ul[0]; aa.ul[1] |= bb.ul[1]; return (aa.q); }
// Copyright 2021 The Cobalt 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 COBALT_LOADER_IMAGE_FAILURE_IMAGE_DECODER_H_ #define COBALT_LOADER_IMAGE_FAILURE_IMAGE_DECODER_H_ #include <memory> #include <string> #include "base/compiler_specific.h" #include "cobalt/loader/image/image.h" #include "cobalt/loader/image/image_data_decoder.h" namespace cobalt { namespace loader { namespace image { // This class always signals a decoding error rather than decoding. It can // be used for imitating the normal image decoders without doing any // decoding works. class FailureImageDecoder : public ImageDataDecoder { public: explicit FailureImageDecoder(render_tree::ResourceProvider* resource_provider, const base::DebuggerHooks& debugger_hooks) : ImageDataDecoder(resource_provider, debugger_hooks) {} // From ImageDataDecoder std::string GetTypeString() const override { return "FailureImageDecoder"; } private: // From ImageDataDecoder size_t DecodeChunkInternal(const uint8* data, size_t input_byte) override { set_state(kError); return input_byte; } scoped_refptr<Image> FinishInternal() override { // Indicate the failure of decoding works. return nullptr; } }; } // namespace image } // namespace loader } // namespace cobalt #endif // COBALT_LOADER_IMAGE_FAILURE_IMAGE_DECODER_H_
/* * SafeStack.h * * This file is part of the "XieXie-Compiler" (Copyright (c) 2014 by Lukas Hermanns) * See "LICENSE.txt" for license information. */ #ifndef __XX_SAFE_STACK_H__ #define __XX_SAFE_STACK_H__ #include "CompilerMessage.h" #include "StringModifier.h" #include <stack> #include <exception> //! Wrapper class for "std::stack" for exception safe "pop" and "top" functions. template <typename T> class SafeStack { public: void Push(const T& value) { container_.push(value); } void Push(T&& value) { container_.push(std::forward<T>(value)); } void Pop() { AssertNotEmpty(__FUNCTION__); container_.pop(); } const T& Top() const { AssertNotEmpty(__FUNCTION__); return container_.top(); } T& Top() { AssertNotEmpty(__FUNCTION__); return container_.top(); } bool Empty() const { return container_.empty(); } typename std::stack<T>::size_type Size() const { return container_.size(); } private: void AssertNotEmpty(const char* procName) const { if (container_.empty()) { throw InternalError( SyntaxAnalyzer::SourceArea::ignore, "invalid access to empty stack (" + ToStr(procName) + ")" ); } } std::stack<T> container_; }; #endif // ================================================================================
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_WM_RESIZE_SHADOW_H_ #define ASH_WM_RESIZE_SHADOW_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" namespace aura { class Window; } namespace gfx { class Rect; } namespace ui { class Layer; } namespace wm { class ImageGrid; } namespace ash { namespace internal { // A class to render the resize edge effect when the user moves their mouse // over a sizing edge. This is just a visual effect; the actual resize is // handled by the EventFilter. class ResizeShadow { public: ResizeShadow(); ~ResizeShadow(); // Initializes the resize effect layers for a given |window|. void Init(aura::Window* window); // Shows resize effects for one or more edges based on a |hit_test| code, such // as HTRIGHT or HTBOTTOMRIGHT. void ShowForHitTest(int hit_test); // Hides all resize effects. void Hide(); // Updates the effect positions based on the |bounds| of the window. void Layout(const gfx::Rect& bounds); int GetLastHitTestForTest() const { return last_hit_test_; } private: // Images for the shadow effect. scoped_ptr< ::wm::ImageGrid> image_grid_; // Hit test value from last call to ShowForHitTest(). Used to prevent // repeatedly triggering the same animations for the same hit. int last_hit_test_; DISALLOW_COPY_AND_ASSIGN(ResizeShadow); }; } // namespace internal } // namespace ash #endif // ASH_WM_RESIZE_SHADOW_H_
/*! @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; int32 stride; } 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_SetFirst( obj ) ((obj)->val = (obj)->val0) #define FMF_SetCell( obj, n ) ((obj)->val = (obj)->val0 + (n) * (obj)->cellSize) #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 fmfr_pretend( FMField *obj, int32 nLev, int32 nRow, int32 nCol, float64 *data, int32 offset, int32 nColFull ); 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_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_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 */
/*****************************************************************-*-c-*-*\ * * * * ##### * Copyright (c) 2000 Giovanni Squillero * * ###### * http://staff.polito.it/giovanni.squillero/ * * ### \ * giovanni.squillero@polito.it * * ##G c\ * * * # _\ * This code is licensed under a BSD license. * * | _/ * See <https://github.com/squillero/fenice> for details * * * * \*************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <limits.h> #include <memory.h> #include <stdarg.h> #include <stddef.h> #include <string.h> #include <time.h> #include <unistd.h> #ifndef __LINUX__ #include <stdarg.h> #endif #include <sys/types.h> #include <sys/time.h> #include "Fenice.h" #include "Simulation.h" #include "Faults.h" /* * INTERNAL PROTOS */ /****************************************************************************/ /* V A R I A B L E S */ /****************************************************************************/ FF_BUFFER *_fenice_internal_FreeBufferList; int _fenice_internal_AllocatedBuffers; /****************************************************************************/ /* F U N C T I O N S */ /****************************************************************************/ void AllocateBuffers(int num) { char *_FunctionName = "AllocateBuffers"; int t; FF_BUFFER *B = NULL; for (t = 0; t < num; ++t) { CheckTrue(Malloc(B, sizeof(FF_BUFFER))); B->next = _fenice_internal_FreeBufferList; _fenice_internal_FreeBufferList = B; B = NULL; } _fenice_internal_AllocatedBuffers += num; } void ReleaseBuffers(void) { FF_BUFFER *B1, *B2; for (B2 = NULL, B1 = _fenice_internal_FreeBufferList; B1; B2 = B1, B1 = B1->next) Free(B2); Free(B2); _fenice_internal_AllocatedBuffers = 0; _fenice_internal_FreeBufferList = NULL; } void DropBufferChain(FF_BUFFER * ptr) { register FF_BUFFER *last; for (last = ptr; last->next; last = last->next); last->next = _fenice_internal_FreeBufferList; _fenice_internal_FreeBufferList = ptr; } FF_BUFFER *funcTakeBuffer(void) { char *_FunctionName = "BUFFER"; register FF_BUFFER *buf; if (!_fenice_internal_FreeBufferList) { CheckTrue(Malloc(_fenice_internal_FreeBufferList, sizeof(FF_BUFFER))); ++_fenice_internal_AllocatedBuffers; } buf = _fenice_internal_FreeBufferList; _fenice_internal_FreeBufferList = buf->next; buf->next = NULL; return buf; } int GetAllocatedBuffers(void) { return _fenice_internal_AllocatedBuffers; }
/** Copyright 2009-2017 National Technology and Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA-0003525, the U.S. Government retains certain rights in this software. Sandia National Laboratories is a multimission laboratory managed and operated by National Technology and Engineering Solutions of Sandia, LLC., a wholly owned subsidiary of Honeywell International, Inc., for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-NA0003525. Copyright (c) 2009-2017, NTESS 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 Sandia 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. Questions? Contact sst-macro-help@sandia.gov */ #ifndef SSTMAC_SOFTWARE_LIBRARIES_MPI_MPIMESSAGE_H_INCLUDED #define SSTMAC_SOFTWARE_LIBRARIES_MPI_MPIMESSAGE_H_INCLUDED #include <sstmac/common/sstmac_config.h> #include <sumi-mpi/mpi_status.h> #include <sumi-mpi/mpi_types/mpi_type.h> #include <sumi-mpi/mpi_integers.h> #include <sstmac/software/process/task_id.h> #include <sstmac/software/process/app_id.h> #include <sstmac/software/process/operating_system_fwd.h> #include <sumi-mpi/mpi_protocol/mpi_protocol_fwd.h> #include <sumi/message.h> namespace sumi { /** * A specialization of networkdata that contains envelope information * relevant to MPI messaging. */ class mpi_message final : public sumi::message { ImplementSerializable(mpi_message) public: typedef sprockit::refcount_ptr<mpi_message> ptr; typedef sprockit::refcount_ptr<const mpi_message> const_ptr; typedef uint64_t id; typedef enum { null_content, data, header, eager_payload, completion_ack, fake } content_type_t; void recompute_bytes(); public: mpi_message(int src, int dst, int count, MPI_Datatype type, int type_packed_size, int tag, MPI_Comm commid, int seqnum, mpi_message::id msgid, mpi_protocol* protocol); mpi_message(){} std::string to_string() const override; static const char* str(content_type_t content_type); ~mpi_message() throw (); sumi::message* clone() const override; void serialize_order(serializer& ser) override; long payload_bytes() const { return count_ * type_packed_size_; } mpi_protocol* protocol() const; void put_on_wire(); void set_protocol(mpi_protocol* protocol); void payload_to_completion_ack(); int count() const { return count_; } bool is_payload() const { switch (content_type_){ case eager_payload: case data: return true; default: return false; } } /// Access the type label associted with this mesage. MPI_Datatype type() const { return type_; } int type_packed_size() const { return type_packed_size_; } /// Access the tag associated with this message. int tag() const { return tag_; } /// Access the id of the communicator that owns this message. MPI_Comm comm() const { return commid_; } /// Access the sequence number for this message. int seqnum() const { return seqnum_; } int src_rank() const { return src_rank_; } void set_src_rank(int rank) { src_rank_ = rank; } int dst_rank() const { return dst_rank_; } void set_dst_rank(int rank) { dst_rank_ = rank; } mpi_message::id unique_int() const { return msgid_; } content_type_t content_type() const { return content_type_; } void set_content_type(content_type_t ty) { content_type_ = ty; recompute_bytes(); } void build_status(MPI_Status* stat) const; void set_in_flight(bool flag){ in_flight_ = flag; } bool in_flight() const { return in_flight_; } void set_already_buffered(bool flag){ already_buffered_ = flag; } protected: void clone_into(mpi_message* cln) const; void buffer_send() override; protected: int src_rank_; int dst_rank_; int count_; MPI_Datatype type_; int type_packed_size_; int tag_; MPI_Comm commid_; int seqnum_; mpi_message::id msgid_; content_type_t content_type_; int protocol_; bool in_flight_; bool already_buffered_; }; } #endif
// Copyright (c) 2013, Maria Teresa Lazaro Grañon // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright notice, this // list of conditions and the following disclaimer in the documentation and/or // other materials provided with the distribution. // // Neither the name of the 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. #ifndef _MR_GRAPH_SLAM_H_ #define _MR_GRAPH_SLAM_H_ #include "slam/graph_slam.h" #include "msg_factory.h" #include "condensed_graph/condensed_graph_buffer.h" #include "mr_closure_buffer.h" struct StampedRobotMessage{ OptimizableGraph::Vertex* refVertex; //Current vertex when the msg was received RobotMessage* msg; }; class MRGraphSLAM : public GraphSLAM { public: MRGraphSLAM(); void setIdRobot(int idRobot); void setInterRobotClosureParams(double maxScoreMR_, int minInliersMR_, int windowMRLoopClosure_); inline void setDetectRobotInRange(bool detectRobotInRange_){detectRobotInRange = detectRobotInRange_;} void addInterRobotData(StampedRobotMessage vmsg); void findInterRobotConstraints(); ComboMessage* constructComboMessage(); CondensedGraphMessage* constructCondensedGraphMessage(int idRobotTo); GraphMessage* constructGraphMessage(int idRobotTo); RobotMessage* createMsgfromCharArray(const char* buffer, size_t size); protected: CondensedGraphBuffer condensedGraphs; MRClosureBuffer interRobotClosures; //Contains already matched vertices + edges MRClosureBuffer interRobotVertices; //Contains non-matched vertices double maxScoreMR; int minInliersMR; int windowMRLoopClosure; bool detectRobotInRange; MessageFactory *factory; void addInterRobotData(GraphMessage* gmsg); void addInterRobotData(CondensedGraphMessage* cmsg); void addInterRobotData(ComboMessage* cmsg, OptimizableGraph::Vertex* refVertex); void checkInterRobotClosures(); void updateInterRobotClosures(); VertexArrayMessage* constructVertexArrayMessage(OptimizableGraph::VertexIDMap& vertices); EdgeArrayMessage* constructEdgeArrayMessage(OptimizableGraph::EdgeSet& edges); }; #endif
// Copyright (c) 2017 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 QUICHE_COMMON_PLATFORM_API_QUICHE_LOGGING_H_ #define QUICHE_COMMON_PLATFORM_API_QUICHE_LOGGING_H_ #include "quiche_platform_impl/quiche_logging_impl.h" // Please note following QUICHE_LOG are platform dependent: // INFO severity can be degraded (to VLOG(1) or DVLOG(1)). // Some platforms may not support QUICHE_LOG_FIRST_N or QUICHE_LOG_EVERY_N_SEC, // and they would simply be translated to LOG. #define QUICHE_DVLOG(verbose_level) QUICHE_DVLOG_IMPL(verbose_level) #define QUICHE_DVLOG_IF(verbose_level, condition) \ QUICHE_DVLOG_IF_IMPL(verbose_level, condition) #define QUICHE_DLOG(severity) QUICHE_DLOG_IMPL(severity) #define QUICHE_DLOG_IF(severity, condition) \ QUICHE_DLOG_IF_IMPL(severity, condition) #define QUICHE_VLOG(verbose_level) QUICHE_VLOG_IMPL(verbose_level) #define QUICHE_LOG(severity) QUICHE_LOG_IMPL(severity) #define QUICHE_LOG_FIRST_N(severity, n) QUICHE_LOG_FIRST_N_IMPL(severity, n) #define QUICHE_LOG_EVERY_N_SEC(severity, seconds) \ QUICHE_LOG_EVERY_N_SEC_IMPL(severity, seconds) #define QUICHE_LOG_IF(severity, condition) \ QUICHE_LOG_IF_IMPL(severity, condition) #define QUICHE_PREDICT_FALSE(x) QUICHE_PREDICT_FALSE_IMPL(x) #define QUICHE_PREDICT_TRUE(x) QUICHE_PREDICT_TRUE_IMPL(x) // This is a noop in release build. #define QUICHE_NOTREACHED() QUICHE_NOTREACHED_IMPL() #define QUICHE_PLOG(severity) QUICHE_PLOG_IMPL(severity) #define QUICHE_DLOG_INFO_IS_ON() QUICHE_DLOG_INFO_IS_ON_IMPL() #define QUICHE_LOG_INFO_IS_ON() QUICHE_LOG_INFO_IS_ON_IMPL() #define QUICHE_LOG_WARNING_IS_ON() QUICHE_LOG_WARNING_IS_ON_IMPL() #define QUICHE_LOG_ERROR_IS_ON() QUICHE_LOG_ERROR_IS_ON_IMPL() #define QUICHE_CHECK(condition) QUICHE_CHECK_IMPL(condition) #define QUICHE_CHECK_OK(condition) QUICHE_CHECK_OK_IMPL(condition) #define QUICHE_CHECK_EQ(val1, val2) QUICHE_CHECK_EQ_IMPL(val1, val2) #define QUICHE_CHECK_NE(val1, val2) QUICHE_CHECK_NE_IMPL(val1, val2) #define QUICHE_CHECK_LE(val1, val2) QUICHE_CHECK_LE_IMPL(val1, val2) #define QUICHE_CHECK_LT(val1, val2) QUICHE_CHECK_LT_IMPL(val1, val2) #define QUICHE_CHECK_GE(val1, val2) QUICHE_CHECK_GE_IMPL(val1, val2) #define QUICHE_CHECK_GT(val1, val2) QUICHE_CHECK_GT_IMPL(val1, val2) #define QUICHE_DCHECK(condition) QUICHE_DCHECK_IMPL(condition) #define QUICHE_DCHECK_EQ(val1, val2) QUICHE_DCHECK_EQ_IMPL(val1, val2) #define QUICHE_DCHECK_NE(val1, val2) QUICHE_DCHECK_NE_IMPL(val1, val2) #define QUICHE_DCHECK_LE(val1, val2) QUICHE_DCHECK_LE_IMPL(val1, val2) #define QUICHE_DCHECK_LT(val1, val2) QUICHE_DCHECK_LT_IMPL(val1, val2) #define QUICHE_DCHECK_GE(val1, val2) QUICHE_DCHECK_GE_IMPL(val1, val2) #define QUICHE_DCHECK_GT(val1, val2) QUICHE_DCHECK_GT_IMPL(val1, val2) #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_LOGGING_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_IMPL_H__ #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_IMPL_H__ #include "chrome/browser/sync/glue/data_type_manager.h" #include <list> #include <map> #include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "base/time.h" #include "chrome/browser/sync/glue/backend_data_type_configurer.h" #include "chrome/browser/sync/glue/model_association_manager.h" class FailedDatatypesHandler; namespace syncer { class DataTypeDebugInfoListener; template <typename T> class WeakHandle; } namespace browser_sync { class DataTypeController; class DataTypeManagerObserver; class DataTypeManagerImpl : public DataTypeManager, public ModelAssociationResultProcessor { public: DataTypeManagerImpl( const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& debug_info_listener, BackendDataTypeConfigurer* configurer, const DataTypeController::TypeMap* controllers, DataTypeManagerObserver* observer, const FailedDatatypesHandler* failed_datatypes_handler); virtual ~DataTypeManagerImpl(); // DataTypeManager interface. virtual void Configure(TypeSet desired_types, syncer::ConfigureReason reason) OVERRIDE; // Needed only for backend migration. virtual void PurgeForMigration( TypeSet undesired_types, syncer::ConfigureReason reason) OVERRIDE; virtual void Stop() OVERRIDE; virtual State state() const OVERRIDE; // |ModelAssociationResultProcessor| implementation. virtual void OnModelAssociationDone( const DataTypeManager::ConfigureResult& result) OVERRIDE; virtual void OnTypesLoaded() OVERRIDE; // Used by unit tests. TODO(sync) : This would go away if we made // this class be able to do Dependency injection. crbug.com/129212. ModelAssociationManager* GetModelAssociationManagerForTesting() { return &model_association_manager_; } private: // Stops all data types. void FinishStop(); void Abort(ConfigureStatus status, const syncer::SyncError& error); // If there's a pending reconfigure, processes it and returns true. // Otherwise, returns false. bool ProcessReconfigure(); void Restart(syncer::ConfigureReason reason); void DownloadReady(syncer::ModelTypeSet first_sync_types, syncer::ModelTypeSet failed_configuration_types); // Notification from the SBH that download failed due to a transient // error and it will be retried. void OnDownloadRetry(); void NotifyStart(); void NotifyDone(const ConfigureResult& result); void SetBlockedAndNotify(); // Add to |configure_time_delta_| the time since we last called // Restart(). void AddToConfigureTime(); void ConfigureImpl(TypeSet desired_types, syncer::ConfigureReason reason); BackendDataTypeConfigurer::DataTypeConfigStateMap BuildDataTypeConfigStateMap() const; BackendDataTypeConfigurer* configurer_; // Map of all data type controllers that are available for sync. // This list is determined at startup by various command line flags. const DataTypeController::TypeMap* controllers_; State state_; std::map<syncer::ModelType, int> start_order_; TypeSet last_requested_types_; // Whether an attempt to reconfigure was made while we were busy configuring. // The |last_requested_types_| will reflect the newest set of requested types. bool needs_reconfigure_; // The reason for the last reconfigure attempt. Note: this will be set to a // valid value only when |needs_reconfigure_| is set. syncer::ConfigureReason last_configure_reason_; base::WeakPtrFactory<DataTypeManagerImpl> weak_ptr_factory_; // The last time Restart() was called. base::Time last_restart_time_; // The accumulated time spent between calls to Restart() and going // to the DONE/BLOCKED state. base::TimeDelta configure_time_delta_; // Collects the list of errors resulting from failing to start a type. This // would eventually be sent to the listeners after all the types have // been given a chance to start. std::list<syncer::SyncError> failed_datatypes_info_; ModelAssociationManager model_association_manager_; // DataTypeManager must have only one observer -- the ProfileSyncService that // created it and manages its lifetime. DataTypeManagerObserver* const observer_; // For querying failed data types (having unrecoverable error) when // configuring backend. const FailedDatatypesHandler* failed_datatypes_handler_; DISALLOW_COPY_AND_ASSIGN(DataTypeManagerImpl); }; } // namespace browser_sync #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_IMPL_H__
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67b.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE129.label.xml Template File: sources-sinks-67b.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: rand Set data to result of rand(), which may be zero * GoodSource: Larger than zero but less than 10 * Sinks: * GoodSink: Ensure the array index is valid * BadSink : Improperly check the array index by not checking the upper bound * Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files * * */ #include "std_testcase.h" typedef struct _CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67_structType { int structFirst; } CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67_structType; #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67b_badSink(CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67_structType myStruct) { int data = myStruct.structFirst; { int i; int * buffer = (int *)malloc(10 * sizeof(int)); if (buffer == NULL) {exit(-1);} /* initialize buffer */ for (i = 0; i < 10; i++) { buffer[i] = 0; } /* POTENTIAL FLAW: Attempt to write to an index of the array that is above the upper bound * This code does check to see if the array index is negative */ if (data >= 0) { buffer[data] = 1; /* Print the array values */ for(i = 0; i < 10; i++) { printIntLine(buffer[i]); } } else { printLine("ERROR: Array index is negative."); } free(buffer); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67b_goodG2BSink(CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67_structType myStruct) { int data = myStruct.structFirst; { int i; int * buffer = (int *)malloc(10 * sizeof(int)); if (buffer == NULL) {exit(-1);} /* initialize buffer */ for (i = 0; i < 10; i++) { buffer[i] = 0; } /* POTENTIAL FLAW: Attempt to write to an index of the array that is above the upper bound * This code does check to see if the array index is negative */ if (data >= 0) { buffer[data] = 1; /* Print the array values */ for(i = 0; i < 10; i++) { printIntLine(buffer[i]); } } else { printLine("ERROR: Array index is negative."); } free(buffer); } } /* goodB2G uses the BadSource with the GoodSink */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67b_goodB2GSink(CWE122_Heap_Based_Buffer_Overflow__c_CWE129_rand_67_structType myStruct) { int data = myStruct.structFirst; { int i; int * buffer = (int *)malloc(10 * sizeof(int)); if (buffer == NULL) {exit(-1);} /* initialize buffer */ for (i = 0; i < 10; i++) { buffer[i] = 0; } /* FIX: Properly validate the array index and prevent a buffer overflow */ if (data >= 0 && data < (10)) { buffer[data] = 1; /* Print the array values */ for(i = 0; i < 10; i++) { printIntLine(buffer[i]); } } else { printLine("ERROR: Array index is out-of-bounds"); } free(buffer); } } #endif /* OMITGOOD */
/** * PaddleRocketProjectile.h * * Copyright (c) 2014, Callum Hay * All rights reserved. * * Redistribution and use of the Biff! Bam!! Blammo!?! code or any derivative * works are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of its contributors may not be used to endorse or promote products * derived from this software without specific prior written permission. * 4. Redistributions may not be sold, nor may they be used in a commercial * product or activity 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 CALLUM HAY 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 __PADDLEROCKETPROJECTILE_H__ #define __PADDLEROCKETPROJECTILE_H__ #include "RocketProjectile.h" /** * Projectile for the rocket shot from the player paddle when the player acquires a rocket paddle item. */ class PaddleRocketProjectile : public RocketProjectile { public: static const float DEFAULT_ROCKET_DMG; static const float PADDLEROCKET_HEIGHT_DEFAULT; static const float PADDLEROCKET_WIDTH_DEFAULT; PaddleRocketProjectile(const Point2D& spawnLoc, const Vector2D& rocketVelDir, float width, float height); ~PaddleRocketProjectile(); ProjectileType GetType() const { return Projectile::PaddleRocketBulletProjectile; } float GetDamage() const { // Obtain the size relative to the the normal size of the rocket (1.0) this rocket // is currently - used to determine how much it will destroy. return (this->GetWidth() / PADDLEROCKET_WIDTH_DEFAULT) * DEFAULT_ROCKET_DMG; } float GetVisualScaleFactor() const { return this->GetWidth() / this->GetDefaultWidth(); } float GetAccelerationMagnitude() const { return 2.0f; } float GetRotationAccelerationMagnitude() const { return 60.0f; } float GetMaxVelocityMagnitude() const { return 20.0f; } float GetMaxRotationVelocityMagnitude() const { return 400.0f; } float GetDefaultHeight() const { return PADDLEROCKET_HEIGHT_DEFAULT; } float GetDefaultWidth() const { return PADDLEROCKET_WIDTH_DEFAULT; } }; #endif // __PADDLEROCKETPROJECTILE_H__
/* $NetBSD: netif_news.c,v 1.2 1999/12/23 06:52:31 tsubai Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * 4. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Gordon W. Ross * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * The Sun PROM has a fairly general set of network drivers, * so it is easiest to just replace the netif module with * this adaptation to the PROM network interface. */ #include <sys/param.h> #include <sys/socket.h> #include <net/if.h> #include <net/if_ether.h> #include <netinet/in.h> #include <netinet/in_systm.h> #include <lib/libsa/stand.h> #include <lib/libsa/net.h> #include <lib/libsa/netif.h> #include <lib/libkern/libkern.h> #include <machine/apcall.h> #include <promdev.h> static struct netif netif_prom; #ifdef NETIF_DEBUG int netif_debug; #endif struct iodesc sockets[SOPEN_MAX]; struct iodesc * socktodesc(sock) int sock; { if (sock != 0) { return(NULL); } return (sockets); } int netif_open(machdep_hint) void *machdep_hint; { struct romdev *pd = machdep_hint; struct iodesc *io; /* find a free socket */ io = sockets; if (io->io_netif) { #ifdef DEBUG printf("netif_open: device busy\n"); #endif errno = ENFILE; return (-1); } bzero(io, sizeof(*io)); netif_prom.nif_devdata = pd; io->io_netif = &netif_prom; /* Put our ethernet address in io->myea */ prom_getether(pd, io->myea); return(0); } int netif_close(fd) int fd; { struct iodesc *io; struct netif *ni; if (fd != 0) { errno = EBADF; return(-1); } io = &sockets[fd]; ni = io->io_netif; if (ni != NULL) { ni->nif_devdata = NULL; io->io_netif = NULL; } return(0); } /* * Send a packet. The ether header is already there. * Return the length sent (or -1 on error). */ ssize_t netif_put(desc, pkt, len) struct iodesc *desc; void *pkt; size_t len; { struct romdev *pd; ssize_t rv; size_t sendlen; pd = (struct romdev *)desc->io_netif->nif_devdata; #ifdef NETIF_DEBUG if (netif_debug) { struct ether_header *eh; printf("netif_put: desc=0x%x pkt=0x%x len=%d\n", desc, pkt, len); eh = pkt; printf("dst: %s ", ether_sprintf(eh->ether_dhost)); printf("src: %s ", ether_sprintf(eh->ether_shost)); printf("type: 0x%x\n", eh->ether_type & 0xFFFF); } #endif sendlen = len; if (sendlen < 60) { sendlen = 60; #ifdef NETIF_DEBUG printf("netif_put: length padded to %d\n", sendlen); #endif } rv = apcall_write(pd->fd, pkt, sendlen); #ifdef NETIF_DEBUG if (netif_debug) printf("netif_put: xmit returned %d\n", rv); #endif return rv; } /* * Receive a packet, including the ether header. * Return the total length received (or -1 on error). */ ssize_t netif_get(desc, pkt, maxlen, timo) struct iodesc *desc; void *pkt; size_t maxlen; time_t timo; { struct romdev *pd; int tick0; ssize_t len; pd = (struct romdev *)desc->io_netif->nif_devdata; #ifdef NETIF_DEBUG if (netif_debug) printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n", pkt, maxlen, timo); #endif tick0 = getsecs(); do { len = apcall_read(pd->fd, pkt, maxlen); } while ((len == 0) && ((getsecs() - tick0) < timo)); #ifdef NETIF_DEBUG if (netif_debug) printf("netif_get: received len=%d\n", len); #endif if (len < 12) return -1; #ifdef NETIF_DEBUG if (netif_debug) { struct ether_header *eh = pkt; printf("dst: %s ", ether_sprintf(eh->ether_dhost)); printf("src: %s ", ether_sprintf(eh->ether_shost)); printf("type: 0x%x\n", eh->ether_type & 0xFFFF); } #endif return len; } int prom_getether(pd, ea) struct romdev *pd; u_char *ea; { if (apcall_ioctl(pd->fd, APIOCGIFHWADDR, ea)); return -1; #ifdef BOOT_DEBUG printf("hardware address %s\n", ether_sprintf(ea)); #endif return 0; } time_t getsecs() { u_int t[2]; apcall_gettimeofday(t); /* time = t[0](s) + t[1](ns) */ return t[0]; }
#pragma once int ptr_cmp(const void *a, const void *b);
/* * Copyright (c) 2013 Chun-Ying Huang * * This file is part of Smart Beholder (SB). * * SB is free software; you can redistribute it and/or modify it * under the terms of the 3-clause BSD License as published by the * Free Software Foundation: http://directory.fsf.org/wiki/License:BSD_3Clause * * SB 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. * * You should have received a copy of the 3-clause BSD License along with SB; * if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /** * @file * Define video sources: header files */ #ifndef __ISOURCE_H__ #define __ISOURCE_H__ #include <pthread.h> #include "core-common.h" #include "core-avcodec.h" #include "dpipe.h" /** Define the default width of the max resolution * (can be tuned by configuration). * Note: Apple MBP 13" retina is 2560x1600 */ #define VIDEO_SOURCE_DEF_MAXWIDTH 2560 /** Define the default height of the max resolution * (can be tuned by configuration). * Note: Apple MBP 13" retina is 2560x1600 */ #define VIDEO_SOURCE_DEF_MAXHEIGHT 1600 /** Define the maximum number of video planes */ #define VIDEO_SOURCE_MAX_STRIDE 4 /** Define the maximum number of video sources. This value must be at least 1 */ #define VIDEO_SOURCE_CHANNEL_MAX 2 /** Define the default video source pipe name format */ #define VIDEO_SOURCE_PIPEFORMAT "video-%d" /** Define the default video source pipe pool size (frames in the pipe) */ #define VIDEO_SOURCE_POOLSIZE 8 /** * Data structure to store a video frame in RGBA or YUV420 format. */ typedef struct vsource_frame_s { int channel; /**< The channel id for the video frame */ long long imgpts; /**< Captured time stamp * (or presentatin timestamp). * This is actually a sequence number of * captured video frame. */ AVPixelFormat pixelformat;/**< pixel format, currently support * RGBA, BGRA, or YUV420P * Note: current use values defined in ffmpeg */ int linesize[VIDEO_SOURCE_MAX_STRIDE]; /**< strides * for each video plane (YUV420P only). */ int realwidth; /**< Actual width of the video frame */ int realheight; /**< Actual height of the video frame */ int realstride; /**< stride for RGBA and BGRA video frame */ int realsize; /**< Total size of the video frame data */ struct timeval timestamp; /**< Captured timestamp */ // internal data - should not change after initialized int maxstride; /**< */ int imgbufsize; /**< Allocated video frame buffer size */ unsigned char *imgbuf; /**< Pointer to the video frame buffer */ unsigned char *imgbuf_internal; /**< Internal pointer * for buffer allocation. * This is used to ensure that \a imgbuf * is started at an aligned address * XXX: NOT USED NOW. */ int alignment; /**< \a imgbuf alignment value. * \a imgbuf = \a imgbuf_internal + \a alignment. * XXX: NOT USED NOW. */ } vsource_frame_t; /** * Data structure to setup a video configuration. */ typedef struct vsource_config_s { int curr_width; /**< Current video width */ int curr_height; /**< Current video height */ int curr_stride; /**< Current video stride: * should be the value of height * 4, * because the captured video should be * in RGBA or BGRA format */ } vsource_config_t; /** * Data structure to store a video source pipe name. */ typedef struct pipename_s { struct pipename_s *next;/**< Pointer to next pipename */ char name[1]; /**< Name of the pape. * Length is variable, so must be the last field. */ } pipename_t; /** * Data structure to define a video source. */ typedef struct vsource_s { int channel; /**< Channel Id of the video source */ pipename_t *pipename; /**< Pipeline name of the video source, e.g, video-%d */ // max int max_width; /**< Maximum video frame width */ int max_height; /**< Maximum video frame height */ int max_stride; /**< Maximum video frame stride: should be at least max_height * 4 */ // curr int curr_width; /**< Current video frame width */ int curr_height; /**< Current video frame height */ int curr_stride; /**< Current video frame stride: should be at least curr_stride * 4 */ // output int out_width; /**< Video output width */ int out_height; /**< Video output height */ int out_stride; /**< Video output stride: should be at least out_height * 4 */ // } vsource_t; EXPORT vsource_frame_t * vsource_frame_init(int channel, vsource_frame_t *frame); EXPORT void vsource_frame_release(vsource_frame_t *frame); EXPORT void vsource_dup_frame(vsource_frame_t *src, vsource_frame_t *dst); EXPORT int vsource_embed_colorcode_init(int RGBmode); EXPORT void vsource_embed_colorcode_reset(); EXPORT void vsource_embed_colorcode_inc(vsource_frame_t *frame); EXPORT void vsource_embed_colorcode(vsource_frame_t *frame, unsigned int value); EXPORT int video_source_channels(); EXPORT vsource_t * video_source(int channel); EXPORT const char *video_source_add_pipename(int channel, const char *pipename); EXPORT const char *video_source_get_pipename(int channel); // EXPORT int video_source_max_width(int channel); EXPORT int video_source_max_height(int channel); EXPORT int video_source_max_stride(int channel); EXPORT int video_source_curr_width(int channel); EXPORT int video_source_curr_height(int channel); EXPORT int video_source_curr_stride(int channel); EXPORT int video_source_out_width(int channel); EXPORT int video_source_out_height(int channel); EXPORT int video_source_out_stride(int channel); EXPORT int video_source_mem_size(int channel); EXPORT int video_source_setup_ex(vsource_config_t *config, int nConfig); EXPORT int video_source_setup(int curr_width, int curr_height, int curr_stride); #endif
/* $NetBSD: core_netbsd.c,v 1.2 2001/12/10 01:52:26 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. * Copyright (c) 1991, 1993 The Regents of the University of California. * Copyright (c) 1988 University of Utah. * * All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department. * * 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 acknowledgement: * This product includes software developed by Charles D. Cranor, * Washington University, the University of California, Berkeley and * its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: Utah $Hdr: vm_unix.c 1.1 89/11/07$ * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93 * from: NetBSD: uvm_unix.c,v 1.25 2001/11/10 07:37:01 lukem Exp */ /* * core_netbsd.c: Support for the historic NetBSD core file format. */ #include <sys/cdefs.h> __KERNEL_RCSID(0, "$NetBSD: core_netbsd.c,v 1.2 2001/12/10 01:52:26 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> #include <sys/vnode.h> #include <sys/core.h> #include <uvm/uvm_extern.h> struct coredump_state { struct core core; off_t offset; }; int coredump_writesegs_netbsd(struct proc *, struct vnode *, struct ucred *, struct uvm_coredump_state *); int coredump_netbsd(struct proc *p, struct vnode *vp, struct ucred *cred) { struct coredump_state cs; struct vmspace *vm = p->p_vmspace; int error; cs.core.c_midmag = 0; strncpy(cs.core.c_name, p->p_comm, MAXCOMLEN); cs.core.c_nseg = 0; cs.core.c_signo = p->p_sigctx.ps_sig; cs.core.c_ucode = p->p_sigctx.ps_code; cs.core.c_cpusize = 0; cs.core.c_tsize = (u_long)ctob(vm->vm_tsize); cs.core.c_dsize = (u_long)ctob(vm->vm_dsize); cs.core.c_ssize = (u_long)round_page(ctob(vm->vm_ssize)); error = cpu_coredump(p, vp, cred, &cs.core); if (error) return (error); #if 0 /* * XXX * It would be nice if we at least dumped the signal state (and made it * available at run time to the debugger, as well), but this code * hasn't actually had any effect for a long time, since we don't dump * the user area. For now, it's dead. */ memcpy(&p->p_addr->u_kproc.kp_proc, p, sizeof(struct proc)); fill_eproc(p, &p->p_addr->u_kproc.kp_eproc); #endif cs.offset = cs.core.c_hdrsize + cs.core.c_seghdrsize + cs.core.c_cpusize; error = uvm_coredump_walkmap(p, vp, cred, coredump_writesegs_netbsd, &cs); if (error) return (error); /* Now write out the core header. */ error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cs.core, (int)cs.core.c_hdrsize, (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p); return (error); } int coredump_writesegs_netbsd(struct proc *p, struct vnode *vp, struct ucred *cred, struct uvm_coredump_state *us) { struct coredump_state *cs = us->cookie; struct coreseg cseg; int flag, error; if (us->flags & UVM_COREDUMP_NODUMP) return (0); if (us->flags & UVM_COREDUMP_STACK) flag = CORE_STACK; else flag = CORE_DATA; /* * Set up a new core file segment. */ CORE_SETMAGIC(cseg, CORESEGMAGIC, CORE_GETMID(cs->core), flag); cseg.c_addr = us->start; cseg.c_size = us->end - us->start; error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, cs->core.c_seghdrsize, cs->offset, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p); if (error) return (error); cs->offset += cs->core.c_seghdrsize; error = vn_rdwr(UIO_WRITE, vp, (caddr_t) us->start, (int) cseg.c_size, cs->offset, UIO_USERSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p); if (error) return (error); cs->offset += cseg.c_size; cs->core.c_nseg++; return (0); }
/* Program : Movie FileName : structures.h Author : Written By L.Hudson. */ #ifndef _STRUCTURES_ #define _STRUCTURES_ struct Search_Range { double St,Sz,Scl,Stp,Val,Max; }; struct Info { int Global, Simplex, Powell; int View, HKLOutput, Combine, Replex; int Least_Sq, Corr, Scoring, Cryst; int Myo, Actin, CPro, Titin; int No_Fils, Fourier_Diff,Reflections,BBone; int Observed, Weighting, Anneal, N_Strnds; int A_Iter, Num_Reps, NoCheck, Scale_Data; int ccp13, Tropomyosin, OneShot, BogusData; int Pivot_Myosin, Avs, DCad; int Pdb, Torus, Iterations, BrookeHaven; int NoPerts; double CWeight,Twst, Max_Angle,Min_Angle; double U_Cl, Tot_Rep,Scale[2],CutOff; double A_Temp, DTemp,Resolution,BogusDataRes; char Status_File[100],Intensity_File[100]; char Output_File[100]; FILE *Output; }; struct C_Protein { int Tot_Mol,Tot_SubU,Pivot_Type,Pivot; double Sph_Sz,Den, Repeat,Dom_Sep; double *RX, *RY,*RZ; double *X, *Y, *Z; struct Search_Range Tilt,Azi,Rad; struct Search_Range Pivot_Tilt,Pivot_Slew; struct Search_Range Weight,Axial; }; struct Titin { int Tot_Mol,Tot_SubU; double Sph_Sz,Den, Repeat; double *RX, *RY,*RZ; double *X, *Y, *Z; struct Search_Range Azi,Rad,Weight; }; struct Myosin { int N_Pts,A_Sz,N_Hds,N_Crwns,Piv_Point; int *Sequence; double Crwn_Twst,Repeat,Rep_Level; double *RX,*RY,*RZ; double *X, *Y, *Z; double *X_C,*Y_C,*Z_C; double *Radial,*Azi; struct Search_Range *Slew,*Tilt,*Rot,*PRad,*PAxial,*PAzi; struct Search_Range **PSlew,**PTilt,**PRot; struct Search_Range Lat,Rad,Hd_Sp,Hd_An; struct Search_Range Piv_Tilt1,Piv_Slew1,Piv_Rot1; struct Search_Range Piv_Tilt2,Piv_Slew2,Piv_Rot2; double Raster,Sph_Sz; char S1_Head_File[100],**Amino_Acid,**Chain,**Param,**Type; }; struct Tropomyosin { int Tot_SubU,N_Fil; double Z_Pert,Phi,Rad; double Repeat,Sph_Sz; double *RX, *RY, *RZ; double *X, *Y, *Z; struct Search_Range Weight; }; struct Actin { int Tot_SubU,Tot_Dom,N_Fil; double Azi_Pert,Z_Pert,Repeat,Sph_Sz[5]; double Dom_Phi[5],Dom_Z[5],Dom_Rad[5]; double *RX, *RY, *RZ; double *X, *Y, *Z; struct Search_Range Weight; }; struct BackBone { int N_Pts,Model; struct Search_Range Azi; double Rad,Repeat,Sph_Sz; double *RX, *RY, *RZ; double *X, *Y, *Z; double *X_C,*Y_C,*Z_C; char BackBone_File[100]; }; struct Intensity { int N_Ref,NM_Ref; int l_max,h_max,k_max; int R_max,MRD,MSD,MMRD; int **Mul,**h_i,**k_i,**l_i; int Max_Bessels; double ***Bessel; double *CCOR, *OCOR, *MOCOR, *MCCOR; double *MCORSD,*CORSD,**OI, **CI; double **SD, **CSD; int **Bes_Orders, **Bes_Contrib, Bes_Num; float ***FD_Cal,***FD_Cal_Ph,***FD_Obs; double R_Fac, MR_Fac,Cor, MCor; double C_Fac, MC_Fac; }; struct Constant { double const Pi,Two_Pi,Root_t,Root_tq,DTR; }; typedef struct { double bump; int counter1; int counter2; double tor_exit; int scalar1; int scalar2; double shrink_hit; double shrink_trial; double tor_hole; } Torus_Input; typedef union { double dfun; float ffun; int ifun; } Function_Type; #endif
/* * * Copyright 2015-2016, 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. * */ #include <grpc/support/port_platform.h> #ifdef GPR_POSIX_SOCKET #include "src/core/iomgr/resolve_address.h" #include "src/core/iomgr/sockaddr.h" #include <string.h> #include <sys/types.h> #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> #include "src/core/iomgr/executor.h" #include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/sockaddr_utils.h" #include "src/core/iomgr/unix_sockets_posix.h" #include "src/core/support/block_annotate.h" #include "src/core/support/string.h" typedef struct { char *name; char *default_port; grpc_resolve_cb cb; grpc_closure request_closure; void *arg; } request; static grpc_resolved_addresses *blocking_resolve_address_impl( const char *name, const char *default_port) { struct addrinfo hints; struct addrinfo *result = NULL, *resp; char *host; char *port; int s; size_t i; grpc_resolved_addresses *addrs = NULL; if (name[0] == 'u' && name[1] == 'n' && name[2] == 'i' && name[3] == 'x' && name[4] == ':' && name[5] != 0) { return grpc_resolve_unix_domain_address(name + 5); } /* parse name, splitting it into host and port parts */ gpr_split_host_port(name, &host, &port); if (host == NULL) { gpr_log(GPR_ERROR, "unparseable host:port: '%s'", name); goto done; } if (port == NULL) { if (default_port == NULL) { gpr_log(GPR_ERROR, "no port in name '%s'", name); goto done; } port = gpr_strdup(default_port); } /* Call getaddrinfo */ memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* ipv4 or ipv6 */ hints.ai_socktype = SOCK_STREAM; /* stream socket */ hints.ai_flags = AI_PASSIVE; /* for wildcard IP address */ GRPC_SCHEDULING_START_BLOCKING_REGION; s = getaddrinfo(host, port, &hints, &result); GRPC_SCHEDULING_END_BLOCKING_REGION; if (s != 0) { /* Retry if well-known service name is recognized */ char *svc[][2] = {{"http", "80"}, {"https", "443"}}; for (i = 0; i < GPR_ARRAY_SIZE(svc); i++) { if (strcmp(port, svc[i][0]) == 0) { GRPC_SCHEDULING_START_BLOCKING_REGION; s = getaddrinfo(host, svc[i][1], &hints, &result); GRPC_SCHEDULING_END_BLOCKING_REGION; break; } } } if (s != 0) { gpr_log(GPR_ERROR, "getaddrinfo: %s", gai_strerror(s)); goto done; } /* Success path: set addrs non-NULL, fill it in */ addrs = gpr_malloc(sizeof(grpc_resolved_addresses)); addrs->naddrs = 0; for (resp = result; resp != NULL; resp = resp->ai_next) { addrs->naddrs++; } addrs->addrs = gpr_malloc(sizeof(grpc_resolved_address) * addrs->naddrs); i = 0; for (resp = result; resp != NULL; resp = resp->ai_next) { memcpy(&addrs->addrs[i].addr, resp->ai_addr, resp->ai_addrlen); addrs->addrs[i].len = resp->ai_addrlen; i++; } done: gpr_free(host); gpr_free(port); if (result) { freeaddrinfo(result); } return addrs; } grpc_resolved_addresses *(*grpc_blocking_resolve_address)( const char *name, const char *default_port) = blocking_resolve_address_impl; /* Callback to be passed to grpc_executor to asynch-ify * grpc_blocking_resolve_address */ static void do_request_thread(grpc_exec_ctx *exec_ctx, void *rp, bool success) { request *r = rp; grpc_resolved_addresses *resolved = grpc_blocking_resolve_address(r->name, r->default_port); void *arg = r->arg; grpc_resolve_cb cb = r->cb; gpr_free(r->name); gpr_free(r->default_port); cb(exec_ctx, arg, resolved); gpr_free(r); } void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) { gpr_free(addrs->addrs); gpr_free(addrs); } void grpc_resolve_address(const char *name, const char *default_port, grpc_resolve_cb cb, void *arg) { request *r = gpr_malloc(sizeof(request)); grpc_closure_init(&r->request_closure, do_request_thread, r); r->name = gpr_strdup(name); r->default_port = gpr_strdup(default_port); r->cb = cb; r->arg = arg; grpc_executor_enqueue(&r->request_closure, 1); } #endif
/* Copyright (c) 2014, Prithvi Raj Narendra * 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. */ /** * @addtogroup clocks-init * @{ * * @file * This file contains the implementation for HF and LF clock initialization and de-initialization * @author * Prithvi */ #include "clock-init.h" #include "nrf51.h" #include "nrf51_bitfields.h" #include "nrf51_deprecated.h" void lfclk_init(void) { if(!(NRF_CLOCK->LFCLKSTAT & CLOCK_LFCLKSTAT_STATE_Running)){ NRF_CLOCK->LFCLKSRC = (SRC_LFCLK << CLOCK_LFCLKSRC_SRC_Pos); NRF_CLOCK->INTENSET = CLOCK_INTENSET_LFCLKSTARTED_Msk; // Enable wake-up on event SCB->SCR |= SCB_SCR_SEVONPEND_Msk; NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; NRF_CLOCK->TASKS_LFCLKSTART = 1; /* Wait for the external oscillator to start up. */ while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0){ __WFE(); } /* Clear the event and the pending interrupt */ NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; NVIC_ClearPendingIRQ(POWER_CLOCK_IRQn); NRF_CLOCK->INTENSET = 0; } } void lfclk_deinit(void) { NRF_CLOCK->TASKS_LFCLKSTOP = 1; } void hfclk_xtal_init(void) { /* Check if 16 MHz crystal oscillator is already running. */ if (!(NRF_CLOCK->HFCLKSTAT & CLOCK_HFCLKSTAT_SRC_Xtal)){ NRF_CLOCK->INTENSET = CLOCK_INTENSET_HFCLKSTARTED_Msk; // Enable wake-up on event SCB->SCR |= SCB_SCR_SEVONPEND_Msk; NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; NRF_CLOCK->TASKS_HFCLKSTART = 1; /* Wait for the external oscillator to start up. */ while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0){ __WFE(); } /* Clear the event and the pending interrupt */ NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; NVIC_ClearPendingIRQ(POWER_CLOCK_IRQn); NRF_CLOCK->INTENSET = 0; } } void hfclk_xtal_deinit(void) { NRF_CLOCK->TASKS_HFCLKSTOP = 1; } /** * @} */
#ifndef STATE_H #define STATE_H #include <cstdint> enum class STATE : std::uint8_t { ERROR = 0, COMMAND, FIGHTING, MOVING, DEAD, QUIT }; #endif // STATE_H
/* $OpenBSD: cpio.h,v 1.2 1997/09/21 10:45:27 niklas Exp $ */ /* $NetBSD: cpio.h,v 1.1 1996/02/05 22:34:11 jtc Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by J.T. Conklin. * * 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 acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _CPIO_H_ #define _CPIO_H_ #define C_IRUSR 0000400 #define C_IWUSR 0000200 #define C_IXUSR 0000100 #define C_IRGRP 0000040 #define C_IWGRP 0000020 #define C_IXGRP 0000010 #define C_IROTH 0000004 #define C_IWOTH 0000002 #define C_IXOTH 0000001 #define C_ISUID 0004000 #define C_ISGID 0002000 #define C_ISVTX 0001000 #define C_ISDIR 0040000 #define C_ISFIFO 0010000 #define C_ISREG 0100000 #define C_ISBLK 0060000 #define C_ISCHR 0020000 #define C_ISCTG 0110000 #define C_ISLNK 0120000 #define C_ISSOCK 0140000 #define MAGIC "070707" #endif /* _CPIO_H_ */
/* --COPYRIGHT--,BSD * Copyright (c) 2014, Texas Instruments Incorporated * 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 Texas Instruments Incorporated 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. * --/COPYRIGHT--*/ //******************************************************************************* //! This program generates two PWM outputs on P2.0,P2.1 using //! Timer1_A configured for up mode. The value in CCR0, 512-1, defines the PWM //! period and the values in CCR1 and CCR2 the PWM duty cycles. Using ~1.045MHz //! SMCLK as TACLK, the timer period is ~500us with a 75% duty cycle on P2.2 //! and 25% on P2.3. //! ACLK = n/a, SMCLK = MCLK = TACLK = default DCO ~1.045MHz. //! //! Tested On: MSP430F5529 //! ------------------- //! /|\| | //! | | | //! --|RST | //! | | //! | P2.0/TA1.1|--> CCR1 - 75% PWM //! | P2.1/TA1.2|--> CCR2 - 25% PWM //! //! This example uses the following peripherals and I/O signals. You must //! review these and change as needed for your own board: //! - Timer peripheral //! - GPIO Port peripheral //! //! This example uses the following interrupt handlers. To use this example //! in your own application you must add these interrupt handlers to your //! vector table. //! - NONE //! //***************************************************************************** #include "driverlib.h" #define TIMER_PERIOD 511 #define DUTY_CYCLE1 384 #define DUTY_CYCLE2 128 void main(void) { //Stop WDT WDT_A_hold(WDT_A_BASE); //P2.0 and P2.1 output //P2.0 and P2.1 options select GPIO_setAsPeripheralModuleFunctionOutputPin( GPIO_PORT_P2, GPIO_PIN0 + GPIO_PIN1 ); //Start timer TIMER_A_configureUpMode( TIMER_A1_BASE, TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, TIMER_PERIOD, TIMER_A_TAIE_INTERRUPT_DISABLE, TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE, TIMER_A_DO_CLEAR ); TIMER_A_startCounter( TIMER_A1_BASE, TIMER_A_UP_MODE ); //Initialize compare mode to generate PWM1 TIMER_A_initCompare(TIMER_A1_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE, TIMER_A_OUTPUTMODE_RESET_SET, DUTY_CYCLE1 ); //Initialize compare mode to generate PWM2 TIMER_A_initCompare(TIMER_A1_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, TIMER_A_OUTPUTMODE_RESET_SET, DUTY_CYCLE2 ); //Enter LPM0 __bis_SR_register(LPM0_bits); //For debugger __no_operation(); }
/* $OpenBSD: ieeefp.h,v 1.3 1997/11/30 06:10:31 gene Exp $ */ /* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:07 jtc Exp $ */ #ifndef _MAC68K_IEEEFP_H_ #define _MAC68K_IEEEFP_H_ #include <m68k/ieeefp.h> #endif /* _MAC68K_IEEEFP_H_ */
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ #pragma once #if defined(ENABLE_GPU) #include "base/callback.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_message.h" #include "ui/gfx/gl/gl_surface.h" #include "ui/gfx/size.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/surface/transport_dib.h" class GpuChannelManager; class GpuCommandBufferStub; struct GpuHostMsg_AcceleratedSurfaceNew_Params; struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; struct GpuHostMsg_AcceleratedSurfaceRelease_Params; namespace gfx { class GLSurface; } namespace gpu { class GpuScheduler; namespace gles2 { class GLES2Decoder; } } // The GPU process is agnostic as to how it displays results. On some platforms // it renders directly to window. On others it renders offscreen and transports // the results to the browser process to display. This file provides a simple // framework for making the offscreen path seem more like the onscreen path. // // The ImageTransportSurface class defines an simple interface for events that // should be responded to. The factory returns an offscreen surface that looks // a lot like an onscreen surface to the GPU process. // // The ImageTransportSurfaceHelper provides some glue to the outside world: // making sure outside events reach the ImageTransportSurface and // allowing the ImageTransportSurface to send events to the outside world. class ImageTransportSurface { public: ImageTransportSurface(); virtual ~ImageTransportSurface(); virtual void OnNewSurfaceACK( uint64 surface_id, TransportDIB::Handle surface_handle) = 0; virtual void OnBuffersSwappedACK() = 0; virtual void OnPostSubBufferACK() = 0; virtual void OnResizeViewACK() = 0; virtual void OnResize(gfx::Size size) = 0; // Creates the appropriate surface depending on the GL implementation. static scoped_refptr<gfx::GLSurface> CreateSurface(GpuChannelManager* manager, GpuCommandBufferStub* stub, gfx::PluginWindowHandle handle); private: DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); }; class ImageTransportHelper : public IPC::Channel::Listener { public: // Takes weak pointers to objects that outlive the helper. ImageTransportHelper(ImageTransportSurface* surface, GpuChannelManager* manager, GpuCommandBufferStub* stub, gfx::PluginWindowHandle handle); virtual ~ImageTransportHelper(); bool Initialize(); void Destroy(); // IPC::Channel::Listener implementation: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Helper send functions. Caller fills in the surface specific params // like size and surface id. The helper fills in the rest. void SendAcceleratedSurfaceNew( GpuHostMsg_AcceleratedSurfaceNew_Params params); void SendAcceleratedSurfaceBuffersSwapped( GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); void SendAcceleratedSurfacePostSubBuffer( GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); void SendAcceleratedSurfaceRelease( GpuHostMsg_AcceleratedSurfaceRelease_Params params); void SendResizeView(const gfx::Size& size); // Whether or not we should execute more commands. void SetScheduled(bool is_scheduled); void DeferToFence(base::Closure task); // Make the surface's context current. bool MakeCurrent(); private: gpu::GpuScheduler* Scheduler(); gpu::gles2::GLES2Decoder* Decoder(); // IPC::Message handlers. void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); void OnBuffersSwappedACK(); void OnPostSubBufferACK(); void OnResizeViewACK(); // Backbuffer resize callback. void Resize(gfx::Size size); // Set the default swap interval on the surface. void SetSwapInterval(); // Weak pointers that point to objects that outlive this helper. ImageTransportSurface* surface_; GpuChannelManager* manager_; base::WeakPtr<GpuCommandBufferStub> stub_; int32 route_id_; gfx::PluginWindowHandle handle_; DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); }; // An implementation of ImageTransportSurface that implements GLSurface through // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. class PassThroughImageTransportSurface : public gfx::GLSurfaceAdapter, public ImageTransportSurface { public: PassThroughImageTransportSurface(GpuChannelManager* manager, GpuCommandBufferStub* stub, gfx::GLSurface* surface); virtual ~PassThroughImageTransportSurface(); // GLSurface implementation. virtual bool Initialize() OVERRIDE; virtual void Destroy() OVERRIDE; virtual bool SwapBuffers() OVERRIDE; virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; // ImageTransportSurface implementation. virtual void OnNewSurfaceACK( uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; virtual void OnBuffersSwappedACK() OVERRIDE; virtual void OnPostSubBufferACK() OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size) OVERRIDE; private: scoped_ptr<ImageTransportHelper> helper_; gfx::Size new_size_; DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); }; #endif // defined(ENABLE_GPU) #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_ #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_ #include "base/compiler_specific.h" #include "base/macros.h" #include "content/public/browser/document_user_data.h" #include "url/gurl.h" namespace content { class RenderFrameHost; } namespace extensions { // Used to track the loading state of RenderFrameHost instances in a given tab // currently known to the webNavigation API. It is mainly used to track in which // frames an error occurred so no further events for this frame are being sent. // TODO(carlscab): DocumentState seems like a better name as this track per // document state. class FrameNavigationState : public content::DocumentUserData<FrameNavigationState> { public: FrameNavigationState(const FrameNavigationState&) = delete; FrameNavigationState& operator=(const FrameNavigationState&) = delete; ~FrameNavigationState() override; // True if in general webNavigation events may be sent for the given URL. static bool IsValidUrl(const GURL& url); // True if navigation events for the this frame can be sent. bool CanSendEvents() const; // Starts to track a document load to |url|. void StartTrackingDocumentLoad(const GURL& url, bool is_same_document, bool is_from_back_forward_cache, bool is_error_page); // Returns the URL corresponding to a tracked |frame_host|. // TODO(dcheng): Why is this needed? Can't this information be extracted from // RenderFrameHost? GURL GetUrl() const; // Marks this frame as in an error state, i.e. the onErrorOccurred event was // fired for it, and no further events should be sent for it. void SetErrorOccurredInFrame(); // True if this frame is marked as being in an error state. bool GetErrorOccurredInFrame() const; // Marks this frame as having finished its last document load, i.e. the // onCompleted event was fired for this frame. void SetDocumentLoadCompleted(); // True if this frame is currently not loading a document. bool GetDocumentLoadCompleted() const; // Marks this frame as having finished parsing. void SetParsingFinished(); // True if |frame_host| has finished parsing. bool GetParsingFinished() const; #ifdef UNIT_TEST static void set_allow_extension_scheme(bool allow_extension_scheme) { allow_extension_scheme_ = allow_extension_scheme; } #endif private: friend class content::DocumentUserData<FrameNavigationState>; DOCUMENT_USER_DATA_KEY_DECL(); explicit FrameNavigationState(content::RenderFrameHost*); bool error_occurred_ = false; // True if an error has occurred in this frame. bool is_loading_ = false; // True if there is a document load going on. bool is_parsing_ = false; // True if the frame is still parsing. GURL url_; // URL of this frame. // If true, also allow events from chrome-extension:// URLs. static bool allow_extension_scheme_; }; } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_
/***************************************************************************** Copyright (c) 2011, 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 zheev * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_zheev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* w, lapack_complex_double* work, lapack_int lwork, double* rwork ) { lapack_int info = 0; if( matrix_order == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_zheev( &jobz, &uplo, &n, a, &lda, w, work, &lwork, rwork, &info ); if( info < 0 ) { info = info - 1; } } else if( matrix_order == LAPACK_ROW_MAJOR ) { lapack_int lda_t = MAX(1,n); lapack_complex_double* a_t = NULL; /* Check leading dimension(s) */ if( lda < n ) { info = -6; LAPACKE_xerbla( "LAPACKE_zheev_work", info ); return info; } /* Query optimal working array(s) size if requested */ if( lwork == -1 ) { LAPACK_zheev( &jobz, &uplo, &n, a, &lda_t, w, work, &lwork, rwork, &info ); return (info < 0) ? (info - 1) : info; } /* Allocate memory for temporary array(s) */ a_t = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) ); if( a_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; } /* Transpose input matrices */ LAPACKE_zge_trans( matrix_order, n, n, a, lda, a_t, lda_t ); /* Call LAPACK function and adjust info */ LAPACK_zheev( &jobz, &uplo, &n, a_t, &lda_t, w, work, &lwork, rwork, &info ); if( info < 0 ) { info = info - 1; } /* Transpose output matrices */ LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda ); /* Release memory and exit */ LAPACKE_free( a_t ); exit_level_0: if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zheev_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_zheev_work", info ); } return info; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__int_min_predec_02.c Label Definition File: CWE191_Integer_Underflow__int.label.xml Template File: sources-sinks-02.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: min Set data to the minimum value for int * GoodSource: Set data to a small, non-zero number (negative two) * Sinks: decrement * GoodSink: Ensure there will not be an underflow before decrementing data * BadSink : Decrement data, which can cause an Underflow * Flow Variant: 02 Control flow: if(1) and if(0) * * */ #include "std_testcase.h" #ifndef OMITBAD void CWE191_Integer_Underflow__int_min_predec_02_bad() { int data; /* Initialize data */ data = 0; if(1) { /* POTENTIAL FLAW: Use the minimum value for this type */ data = INT_MIN; } if(1) { { /* POTENTIAL FLAW: Decrementing data could cause an underflow */ --data; int result = data; printIntLine(result); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G1() - use badsource and goodsink by changing the second 1 to 0 */ static void goodB2G1() { int data; /* Initialize data */ data = 0; if(1) { /* POTENTIAL FLAW: Use the minimum value for this type */ data = INT_MIN; } if(0) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { --data; int result = data; printIntLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */ static void goodB2G2() { int data; /* Initialize data */ data = 0; if(1) { /* POTENTIAL FLAW: Use the minimum value for this type */ data = INT_MIN; } if(1) { /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { --data; int result = data; printIntLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } } /* goodG2B1() - use goodsource and badsink by changing the first 1 to 0 */ static void goodG2B1() { int data; /* Initialize data */ data = 0; if(0) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */ data = -2; } if(1) { { /* POTENTIAL FLAW: Decrementing data could cause an underflow */ --data; int result = data; printIntLine(result); } } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */ static void goodG2B2() { int data; /* Initialize data */ data = 0; if(1) { /* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */ data = -2; } if(1) { { /* POTENTIAL FLAW: Decrementing data could cause an underflow */ --data; int result = data; printIntLine(result); } } } void CWE191_Integer_Underflow__int_min_predec_02_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE191_Integer_Underflow__int_min_predec_02_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE191_Integer_Underflow__int_min_predec_02_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright (c) 2011 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 CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ #define CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ #pragma once #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "content/public/browser/download_manager_delegate.h" struct DownloadStateInfo; namespace content { class DownloadManager; } class CefDownloadManagerDelegate : public content::DownloadManagerDelegate, public base::RefCountedThreadSafe<CefDownloadManagerDelegate> { public: CefDownloadManagerDelegate(); void SetDownloadManager(content::DownloadManager* manager); // DownloadManagerDelegate methods. virtual content::DownloadId GetNextId() OVERRIDE; virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; virtual void ChooseDownloadPath(content::WebContents* web_contents, const FilePath& suggested_path, int32 download_id) OVERRIDE; private: friend class base::RefCountedThreadSafe<CefDownloadManagerDelegate>; virtual ~CefDownloadManagerDelegate(); void GenerateFilename(int32 download_id, DownloadStateInfo state, const FilePath& generated_name); void RestartDownload(int32 download_id, DownloadStateInfo state); content::DownloadManager* download_manager_; DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate); }; #endif // CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_UI_DEVTOOLS_UI_ELEMENT_H_ #define COMPONENTS_UI_DEVTOOLS_UI_ELEMENT_H_ #include <memory> #include <string> #include <utility> #include <vector> #include "components/ui_devtools/DOM.h" #include "components/ui_devtools/devtools_export.h" #include "ui/base/interaction/element_identifier.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/native_widget_types.h" namespace ui_devtools { class UIElementDelegate; // UIElement type. enum UIElementType { WINDOW, WIDGET, VIEW, ROOT, FRAMESINK, SURFACE }; class UI_DEVTOOLS_EXPORT UIElement { public: struct UI_DEVTOOLS_EXPORT UIProperty { UIProperty(std::string name, std::string value) : name_(name), value_(value) {} std::string name_; std::string value_; }; struct UI_DEVTOOLS_EXPORT ClassProperties { ClassProperties(std::string name, std::vector<UIProperty> properties); ClassProperties(const ClassProperties& copy); ~ClassProperties(); std::string class_name_; std::vector<UIProperty> properties_; }; struct UI_DEVTOOLS_EXPORT Source { Source(std::string path, int line); std::string path_; int line_; }; using UIElements = std::vector<UIElement*>; UIElement(const UIElement&) = delete; UIElement& operator=(const UIElement&) = delete; virtual ~UIElement(); // resets node ids to 0 so that they are reusable static void ResetNodeId(); int node_id() const { return node_id_; } std::string GetTypeName() const; UIElement* parent() const { return parent_; } void set_parent(UIElement* parent) { parent_ = parent; } UIElementDelegate* delegate() const { return delegate_; } UIElementType type() const { return type_; } const UIElements& children() const { return children_; } bool is_updating() const { return is_updating_; } void set_is_updating(bool is_updating) { is_updating_ = is_updating; } void set_owns_children(bool owns_children) { owns_children_ = owns_children; } int GetBaseStylesheetId() const { return base_stylesheet_id_; } void SetBaseStylesheetId(int id) { base_stylesheet_id_ = id; } // Gets/sets whether the element has sent its stylesheet header to the // frontend. bool header_sent() const { return header_sent_; } void set_header_sent() { header_sent_ = true; } using ElementCompare = bool (*)(const UIElement*, const UIElement*); // Inserts |child| in front of |before|. If |before| is null, it is inserted // at the end. Parent takes ownership of the added child. void AddChild(UIElement* child, UIElement* before = nullptr); // Inserts |child| according to a custom ordering function. |notify_delegate| // calls OnUIElementAdded(), which creates the subtree of UIElements at // |child|, and the corresponding DOM nodes. void AddOrderedChild(UIElement* child, ElementCompare compare, bool notify_delegate = true); // Removes all elements from |children_|. Caller is responsible for destroying // children. void ClearChildren(); // Removes |child| out of |children_| without destroying |child|. The caller // is responsible for destroying |child|. |notify_delegate| calls // OnUIElementRemoved(), which destroys the DOM node for |child|. void RemoveChild(UIElement* child, bool notify_delegate = true); // Moves |child| to position |index| in |children_|. void ReorderChild(UIElement* child, int index); template <class T> int FindUIElementIdForBackendElement(T* element) const; // Returns properties grouped by the class they are from. virtual std::vector<ClassProperties> GetCustomPropertiesForMatchedStyle() const; virtual void GetBounds(gfx::Rect* bounds) const = 0; virtual void SetBounds(const gfx::Rect& bounds) = 0; virtual void GetVisible(bool* visible) const = 0; virtual void SetVisible(bool visible) = 0; // Set this element's property values according to |text|. // |text| is the string passed in through StyleDeclarationEdit::text from // the frontend. virtual bool SetPropertiesFromString(const std::string& text); // If element exists, returns its associated native window and its screen // bounds. Otherwise, returns null and empty bounds. virtual std::pair<gfx::NativeWindow, gfx::Rect> GetNodeWindowAndScreenBounds() const = 0; // Returns a list of interleaved keys and values of attributes to be displayed // on the element in the dev tools hierarchy view. virtual std::vector<std::string> GetAttributes() const = 0; template <typename BackingT, typename T> static BackingT* GetBackingElement(const UIElement* element) { return T::From(element); } // Called from PageAgent to repaint Views for Debug Bounds Rectangles virtual void PaintRect() const {} // Called in the constructor to initialize the element's sources. virtual void InitSources() {} // Get the sources for the element. std::vector<Source> GetSources(); // Whether the Element Identifier matches the backing UI element. // This is used to locate a UIElement by Element Identifier set // on the browser side and different than node_id(). virtual bool FindMatchByElementID(const ui::ElementIdentifier& identifier); virtual bool DispatchMouseEvent(protocol::DOM::MouseEvent* event); virtual bool DispatchKeyEvent(protocol::DOM::KeyEvent* event); protected: UIElement(const UIElementType type, UIElementDelegate* delegate, UIElement* parent); void AddSource(std::string path, int line); private: const int node_id_; const UIElementType type_; UIElements children_; UIElement* parent_; UIElementDelegate* delegate_; bool is_updating_ = false; bool owns_children_ = true; int base_stylesheet_id_; bool header_sent_ = false; std::vector<Source> sources_; }; } // namespace ui_devtools #endif // COMPONENTS_UI_DEVTOOLS_UI_ELEMENT_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_ #define CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_ #include <string> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "chrome/browser/api/prefs/pref_member.h" #include "net/url_request/http_user_agent_settings.h" class PrefService; // An implementation of |HttpUserAgentSettings| that provides HTTP headers // Accept-Language and Accept-Charset values that track Pref settings and uses // |content::GetUserAgent| to provide the HTTP User-Agent header value. class ChromeHttpUserAgentSettings : public net::HttpUserAgentSettings { public: // Must be called on the UI thread. explicit ChromeHttpUserAgentSettings(PrefService* prefs); // Must be called on the IO thread. virtual ~ChromeHttpUserAgentSettings(); void CleanupOnUIThread(); // net::HttpUserAgentSettings implementation virtual std::string GetAcceptLanguage() const OVERRIDE; virtual std::string GetAcceptCharset() const OVERRIDE; virtual std::string GetUserAgent(const GURL& url) const OVERRIDE; private: StringPrefMember pref_accept_language_; StringPrefMember pref_accept_charset_; // Avoid re-processing by caching the last value from the preferences and the // last result of processing via net::HttpUtil::GenerateAccept*Header(). mutable std::string last_pref_accept_language_; mutable std::string last_http_accept_language_; mutable std::string last_pref_accept_charset_; mutable std::string last_http_accept_charset_; DISALLOW_COPY_AND_ASSIGN(ChromeHttpUserAgentSettings); }; #endif // CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_
/* * Copyright (c) 2016, 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 "mcrouter/lib/McOperationTraits.h" #include "mcrouter/lib/network/ThriftMessageTraits.h" #include "mcrouter/lib/OperationTraits.h" #include "mcrouter/lib/RequestLoggerContext.h" #include "mcrouter/McrouterFiberContext.h" #include "mcrouter/proxy.h" #include "mcrouter/stats.h" namespace facebook { namespace memcache { namespace mcrouter { #define REQUEST_CLASS_STATS(proxy, OP, SUFFIX, reqClass) \ do { \ if (reqClass.isNormal()) { \ stat_incr(proxy.stats, cmd_ ## OP ## _ ## SUFFIX ## _stat, 1); \ stat_incr(proxy.stats, cmd_ ## OP ## _ ## SUFFIX ## _count_stat, 1); \ } \ stat_incr(proxy.stats, cmd_ ## OP ## _ ## SUFFIX ## _all_stat, 1); \ stat_incr(proxy.stats, cmd_ ## OP ## _ ## SUFFIX ## _all_count_stat, 1); \ } while(0) namespace detail { template <class Request> inline void logOutlier(proxy_t& proxy, GetLikeT<Request> = 0) { REQUEST_CLASS_STATS(proxy, get, outlier, fiber_local::getRequestClass()); } template <class Request> inline void logOutlier(proxy_t& proxy, UpdateLikeT<Request> = 0) { REQUEST_CLASS_STATS(proxy, set, outlier, fiber_local::getRequestClass()); } template <class Request> inline void logOutlier(proxy_t& proxy, DeleteLikeT<Request> = 0) { REQUEST_CLASS_STATS(proxy, delete, outlier, fiber_local::getRequestClass()); } template <class Request> inline void logOutlier(proxy_t& proxy, OtherThanT<Request, GetLike<>, UpdateLike<>, DeleteLike<>> = 0) { REQUEST_CLASS_STATS(proxy, other, outlier, fiber_local::getRequestClass()); } template <class Request> inline void logRequestClass(proxy_t& proxy) { auto reqClass = fiber_local::getRequestClass(); auto operation = Request::OpType::mc_op; switch (operation) { case mc_op_get: REQUEST_CLASS_STATS(proxy, get, out, reqClass); break; case mc_op_metaget: REQUEST_CLASS_STATS(proxy, meta, out, reqClass); break; case mc_op_add: REQUEST_CLASS_STATS(proxy, add, out, reqClass); break; case mc_op_cas: REQUEST_CLASS_STATS(proxy, cas, out, reqClass); break; case mc_op_gets: REQUEST_CLASS_STATS(proxy, gets, out, reqClass); break; case mc_op_replace: REQUEST_CLASS_STATS(proxy, replace, out, reqClass); break; case mc_op_set: REQUEST_CLASS_STATS(proxy, set, out, reqClass); break; case mc_op_incr: REQUEST_CLASS_STATS(proxy, incr, out, reqClass); break; case mc_op_decr: REQUEST_CLASS_STATS(proxy, decr, out, reqClass); break; case mc_op_delete: REQUEST_CLASS_STATS(proxy, delete, out, reqClass); break; case mc_op_lease_set: REQUEST_CLASS_STATS(proxy, lease_set, out, reqClass); break; case mc_op_lease_get: REQUEST_CLASS_STATS(proxy, lease_get, out, reqClass); break; default: REQUEST_CLASS_STATS(proxy, other, out, reqClass); break; } } } // detail template <class Request> void ProxyRequestLogger::log(const RequestLoggerContext& loggerContext) { const auto durationUs = loggerContext.endTimeUs - loggerContext.startTimeUs; bool isOutlier = proxy_->getRouterOptions().logging_rtt_outlier_threshold_us > 0 && durationUs >= proxy_->getRouterOptions().logging_rtt_outlier_threshold_us; logError(loggerContext.replyResult); detail::logRequestClass<Request>(*proxy_); proxy_->durationUs.insertSample(durationUs); if (isOutlier) { detail::logOutlier<Request>(*proxy_); } } }}} // facebook::memcache::mcrouter
/** * Copyright 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the license found in the * LICENSE-examples file in the root directory of this source tree. */ #include <stdlib.h> // malloc, free, exit, atoi #include <stdio.h> // fprintf, perror, feof, fopen, etc. #include <string.h> // strlen, memset, strcat #define ZSTD_STATIC_LINKING_ONLY #include <zstd.h> // presumes zstd library is installed #include "zstd_seekable.h" static void* malloc_orDie(size_t size) { void* const buff = malloc(size); if (buff) return buff; /* error */ perror("malloc:"); exit(1); } static FILE* fopen_orDie(const char *filename, const char *instruction) { FILE* const inFile = fopen(filename, instruction); if (inFile) return inFile; /* error */ perror(filename); exit(3); } static size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file) { size_t const readSize = fread(buffer, 1, sizeToRead, file); if (readSize == sizeToRead) return readSize; /* good */ if (feof(file)) return readSize; /* good, reached end of file */ /* error */ perror("fread"); exit(4); } static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) { size_t const writtenSize = fwrite(buffer, 1, sizeToWrite, file); if (writtenSize == sizeToWrite) return sizeToWrite; /* good */ /* error */ perror("fwrite"); exit(5); } static size_t fclose_orDie(FILE* file) { if (!fclose(file)) return 0; /* error */ perror("fclose"); exit(6); } static void compressFile_orDie(const char* fname, const char* outName, int cLevel, unsigned frameSize) { FILE* const fin = fopen_orDie(fname, "rb"); FILE* const fout = fopen_orDie(outName, "wb"); size_t const buffInSize = ZSTD_CStreamInSize(); /* can always read one full block */ void* const buffIn = malloc_orDie(buffInSize); size_t const buffOutSize = ZSTD_CStreamOutSize(); /* can always flush a full block */ void* const buffOut = malloc_orDie(buffOutSize); ZSTD_seekable_CStream* const cstream = ZSTD_seekable_createCStream(); if (cstream==NULL) { fprintf(stderr, "ZSTD_seekable_createCStream() error \n"); exit(10); } size_t const initResult = ZSTD_seekable_initCStream(cstream, cLevel, 1, frameSize); if (ZSTD_isError(initResult)) { fprintf(stderr, "ZSTD_seekable_initCStream() error : %s \n", ZSTD_getErrorName(initResult)); exit(11); } size_t read, toRead = buffInSize; while( (read = fread_orDie(buffIn, toRead, fin)) ) { ZSTD_inBuffer input = { buffIn, read, 0 }; while (input.pos < input.size) { ZSTD_outBuffer output = { buffOut, buffOutSize, 0 }; toRead = ZSTD_seekable_compressStream(cstream, &output , &input); /* toRead is guaranteed to be <= ZSTD_CStreamInSize() */ if (ZSTD_isError(toRead)) { fprintf(stderr, "ZSTD_seekable_compressStream() error : %s \n", ZSTD_getErrorName(toRead)); exit(12); } if (toRead > buffInSize) toRead = buffInSize; /* Safely handle case when `buffInSize` is manually changed to a value < ZSTD_CStreamInSize()*/ fwrite_orDie(buffOut, output.pos, fout); } } while (1) { ZSTD_outBuffer output = { buffOut, buffOutSize, 0 }; size_t const remainingToFlush = ZSTD_seekable_endStream(cstream, &output); /* close stream */ if (ZSTD_isError(remainingToFlush)) { fprintf(stderr, "ZSTD_seekable_endStream() error : %s \n", ZSTD_getErrorName(remainingToFlush)); exit(13); } fwrite_orDie(buffOut, output.pos, fout); if (!remainingToFlush) break; } ZSTD_seekable_freeCStream(cstream); fclose_orDie(fout); fclose_orDie(fin); free(buffIn); free(buffOut); } static const char* createOutFilename_orDie(const char* filename) { size_t const inL = strlen(filename); size_t const outL = inL + 5; void* outSpace = malloc_orDie(outL); memset(outSpace, 0, outL); strcat(outSpace, filename); strcat(outSpace, ".zst"); return (const char*)outSpace; } int main(int argc, const char** argv) { const char* const exeName = argv[0]; if (argc!=3) { printf("wrong arguments\n"); printf("usage:\n"); printf("%s FILE FRAME_SIZE\n", exeName); return 1; } { const char* const inFileName = argv[1]; unsigned const frameSize = (unsigned)atoi(argv[2]); const char* const outFileName = createOutFilename_orDie(inFileName); compressFile_orDie(inFileName, outFileName, 5, frameSize); } return 0; }
/* Copyright (c) 2008-2013, Northwestern University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the Northwestern University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CHIST_INT_NonNeg #define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CHIST_INT_NonNeg #include "type_iso.CLIST_INT_NonNeg.h" namespace AIMXML { namespace iso { class CHIST_INT_NonNeg : public ::AIMXML::iso::CLIST_INT_NonNeg { public: AIMXML_EXPORT CHIST_INT_NonNeg(xercesc::DOMNode* const& init); AIMXML_EXPORT CHIST_INT_NonNeg(CHIST_INT_NonNeg const& init); void operator=(CHIST_INT_NonNeg const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CHIST_INT_NonNeg); } AIMXML_EXPORT void SetXsiType(); }; } // namespace iso } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CHIST_INT_NonNeg
// Copyright 2020 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 IOS_CHROME_BROWSER_UI_SETTINGS_PRIVACY_COOKIES_CONSUMER_H_ #define IOS_CHROME_BROWSER_UI_SETTINGS_PRIVACY_COOKIES_CONSUMER_H_ #import "ios/chrome/browser/ui/list_model/list_model.h" typedef NS_ENUM(NSInteger, CookiesSettingType) { SettingTypeAllowCookies, SettingTypeBlockThirdPartyCookiesIncognito, SettingTypeBlockThirdPartyCookies, SettingTypeBlockAllCookies, }; @class TableViewItem; // A consumer for Cookies settings changes. @protocol PrivacyCookiesConsumer // Called when a cookie setting option was selected. - (void)cookiesSettingsOptionSelected:(CookiesSettingType)settingType; @end #endif // IOS_CHROME_BROWSER_UI_SETTINGS_PRIVACY_COOKIES_CONSUMER_H_
// -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef TEST_LIBCXX_FUZZER_TEST_H #define TEST_LIBCXX_FUZZER_TEST_H #include <cstddef> #include <cassert> #include "../../../fuzzing/fuzzing.h" #include "../../../fuzzing/fuzzing.cpp" const char* TestCaseSetOne[] = {"", "s", "bac", "bacasf" "lkajseravea", "adsfkajdsfjkas;lnc441324513,34535r34525234", "b*c", "ba?sf" "lka*ea", "adsf*kas;lnc441[0-9]1r34525234"}; using FuzzerFuncType = int(const uint8_t*, size_t); template <size_t NumCases> inline void RunFuzzingTest(FuzzerFuncType *to_test, const char* (&test_cases)[NumCases]) { for (const char* TC : test_cases) { const size_t size = std::strlen(TC); const uint8_t* data = (const uint8_t*)TC; int result = to_test(data, size); assert(result == 0); } } #define FUZZER_TEST(FuncName) \ int main() { \ RunFuzzingTest(FuncName, TestCaseSetOne); \ } \ extern int require_semi #endif // TEST_LIBCXX_FUZZER_TEST_H
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ #define COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ #include <stdint.h> #include <memory> #include "base/macros.h" #include "base/process/process.h" #include "base/run_loop.h" #include "components/nacl/common/nacl_types.h" #include "content/public/common/sandboxed_process_launcher_delegate.h" #include "ipc/ipc_listener.h" #include "services/service_manager/sandbox/sandbox_type.h" namespace IPC { class Channel; } // The BrokerThread class represents the thread that handles the messages from // the browser process and starts NaCl loader processes. class NaClBrokerListener : public content::SandboxedProcessLauncherDelegate, public IPC::Listener { public: NaClBrokerListener(); ~NaClBrokerListener() override; void Listen(); // content::SandboxedProcessLauncherDelegate implementation: service_manager::SandboxType GetSandboxType() override; // IPC::Listener implementation. void OnChannelConnected(int32_t peer_pid) override; bool OnMessageReceived(const IPC::Message& msg) override; void OnChannelError() override; private: void OnLaunchLoaderThroughBroker( int launch_id, mojo::MessagePipeHandle service_request_pipe); void OnLaunchDebugExceptionHandler(int32_t pid, base::ProcessHandle process_handle, const std::string& startup_info); void OnStopBroker(); base::RunLoop run_loop_; base::Process browser_process_; std::unique_ptr<IPC::Channel> channel_; DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener); }; #endif // COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_
// Copyright 2014 The Chromium Authors. All rights reserved. // Inspired by Chromium video capture interface // Simplified and stripped from internal base code #ifndef S3D_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_FACTORY_H #define S3D_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_FACTORY_H #include "video_capture_device_factory.h" namespace s3d { class FileVideoCaptureDeviceFactory : public VideoCaptureDeviceFactory { public: explicit FileVideoCaptureDeviceFactory() = default; std::unique_ptr<VideoCaptureDevice> CreateDevice( const VideoCaptureDeviceDescriptor& deviceDescriptor) const override; }; } // namespace s3d #endif // S3D_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_FACTORY_H
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_TASK_MANAGER_PROVIDERS_WEB_CONTENTS_TAB_CONTENTS_TAG_H_ #define CHROME_BROWSER_TASK_MANAGER_PROVIDERS_WEB_CONTENTS_TAB_CONTENTS_TAG_H_ #include "base/macros.h" #include "chrome/browser/task_manager/providers/web_contents/tab_contents_task.h" #include "chrome/browser/task_manager/providers/web_contents/web_contents_tag.h" namespace task_manager { // Defines a concrete UserData type for WebContents owned by the TabStripModel. class TabContentsTag : public WebContentsTag { public: ~TabContentsTag() override; // task_manager::WebContentsTag: TabContentsTask* CreateTask(WebContentsTaskProvider*) const override; private: friend class WebContentsTags; explicit TabContentsTag(content::WebContents* web_contents); DISALLOW_COPY_AND_ASSIGN(TabContentsTag); }; } // namespace task_manager #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_WEB_CONTENTS_TAB_CONTENTS_TAG_H_
#pragma once #include <avr-halib/avr/portmap.h> namespace avr_halib { namespace drivers { /**\brief namespace containing drivers for robbyboard specific features**/ namespace robby { /** \brief Driver for the power source of the ADC sensors of the EOS robbyboard * \tparam RobbyADCPowerPortMap The Port Map to access the adc power pins on the robby board. * \tparam useOldRobbyBoard Declares the type of Robbyboard, that is used * * This class provides power supply control for ADC sensors on the EOS robbyboard. **/ template<typename PM, bool useOldRobbyBoard> class SensorPowerControl { private: /**\brief Make PortMap accessible for driver users**/ typedef PM PortMap; public: /** \brief Constructor * * Configures ports and deactivates the power source of all sensors **/ SensorPowerControl() { UsePortmap(sps, PM); sps.outPort.setDdr(0xFF); sps.outPort.setPort(0xFF); SyncPortmap(sps); } public: /** \brief activate all power supplies **/ void setActive() { UsePortmap(sps, PM); sps.outPort.setPort(0x00); SyncPortmap(sps); } /** \brief activate one power supply * \param i the number of the power supply **/ void setActive(uint8_t i) { UsePortmap(sps, PM); uint8_t port=sps.outPort.getPort(); sps.outPort.setPort(~(0x1<<i)&port); SyncPortmap(sps); } /** \brief deactivate all power supplies **/ void setInactive() { UsePortmap(sps, PM); sps.outPort.setPort(0xFF); SyncPortmap(sps); } /** \brief activate one power supply * \param i the number of the power supply **/ void setInactive(uint8_t i) { UsePortmap(sps, PM); uint8_t port=sps.outPort.getPort(); sps.outPort.setPort((0x1<<i)|port); SyncPortmap(sps); } }; template<typename PM> class SensorPowerControl<PM, false> { public: SensorPowerControl(){} void setActive(){} void setActive(uint8_t i){} void setInactive(){} void setInactive(uint8_t i){} }; } } }
// 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_GENERATION_FRAME_HELPER_H_ #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_GENERATION_FRAME_HELPER_H_ #include <string> #include <vector> #include "components/autofill/core/common/signatures.h" #include "url/gurl.h" namespace autofill { class FormStructure; } namespace password_manager { class PasswordManagerClient; class PasswordManagerDriver; // Per-frame helper for password generation. Will enable this feature only if // // - Password manager is enabled // - Password sync is enabled // // This class is used to determine what forms we should offer to generate // passwords for and manages the popup which is created if the user chooses to // generate a password. class PasswordGenerationFrameHelper { public: PasswordGenerationFrameHelper(PasswordManagerClient* client, PasswordManagerDriver* driver); PasswordGenerationFrameHelper(const PasswordGenerationFrameHelper&) = delete; PasswordGenerationFrameHelper& operator=( const PasswordGenerationFrameHelper&) = delete; virtual ~PasswordGenerationFrameHelper(); // Instructs the PasswordRequirementsService to fetch requirements for // |origin|. This needs to be called to enable domain-wide password // requirements overrides. void PrefetchSpec(const GURL& origin); // Stores password requirements received from the autofill server for the // |forms| and fetches domain-wide requirements. void ProcessPasswordRequirements( const std::vector<autofill::FormStructure*>& forms); // Determines current state of password generation // |log_debug_data| determines whether log entries are sent to the // autofill::SavePasswordProgressLogger. bool IsGenerationEnabled(bool log_debug_data) const; // Returns a randomly generated password that should (but is not guaranteed // to) match the requirements of the site. // |last_committed_url| refers to the main frame URL and may impact the // password generation rules that are imposed by the site. // |form_signature| and |field_signature| identify the field for which a // password shall be generated. // |max_length| refers to the maximum allowed length according to the site and // may be 0 if unset. // // Virtual for testing // // TODO(crbug.com/855595): Add a stub for this class to facilitate testing. virtual std::u16string GeneratePassword( const GURL& last_committed_url, autofill::FormSignature form_signature, autofill::FieldSignature field_signature, uint32_t max_length); private: friend class PasswordGenerationFrameHelperTest; // The PasswordManagerClient instance associated with this instance. Must // outlive this instance. PasswordManagerClient* client_; // The PasswordManagerDriver instance associated with this instance. Must // outlive this instance. PasswordManagerDriver* driver_; }; } // namespace password_manager #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_GENERATION_FRAME_HELPER_H_
// 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. // Functions used internally by filename_util, and filename_util_icu. #ifndef NET_BASE_FILENAME_UTIL_INTERNAL_H_ #define NET_BASE_FILENAME_UTIL_INTERNAL_H_ #include <string> #include "base/files/file_path.h" #include "base/strings/string16.h" class GURL; namespace net { using ReplaceIllegalCharactersFunction = void (*)(base::FilePath::StringType* file_name, char replace_char); void SanitizeGeneratedFileName(base::FilePath::StringType* filename, bool replace_trailing); bool IsShellIntegratedExtension(const base::FilePath::StringType& extension); void EnsureSafeExtension(const std::string& mime_type, bool ignore_extension, base::FilePath* file_name); bool FilePathToString16(const base::FilePath& path, base::string16* converted); // Similar to GetSuggestedFilename(), but takes a function to replace illegal // characters. If |should_replace_extension| is true, the file extension // extracted from a URL will always be considered unreliable and the file // extension will be determined by |mime_type|. base::string16 GetSuggestedFilenameImpl( const GURL& url, const std::string& content_disposition, const std::string& referrer_charset, const std::string& suggested_name, const std::string& mime_type, const std::string& default_name, bool should_replace_extension, ReplaceIllegalCharactersFunction replace_illegal_characters_function); // Similar to GenerateFileName(), but takes a function to replace illegal // characters. If |should_replace_extension| is true, the file extension // extracted from a URL will always be considered unreliable and the file // extension will be determined by |mime_type|. base::FilePath GenerateFileNameImpl( const GURL& url, const std::string& content_disposition, const std::string& referrer_charset, const std::string& suggested_name, const std::string& mime_type, const std::string& default_name, bool should_replace_extension, ReplaceIllegalCharactersFunction replace_illegal_characters_function); } // namespace net #endif // NET_BASE_FILENAME_UTIL_INTERNAL_H_
/* * Copyright (c) 2010, Anima Games, Benjamin Karaban, Laurent Schneider, * Jérémie Comarmond, Didier Colin. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of the 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 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 RENDERER_IRENDERTARGET_H_ #define RENDERER_IRENDERTARGET_H_ #include <Gfx/IShader.h> namespace Renderer { LM_ENUM_7(ERenderTargetBuffer, RT_LIGHT_BUFFER, // Buffer RGBA principal RT_REFLECTION_BUFFER, RT_REFRACTION_BUFFER, // Sert aussi pour le bloom RT_GLOW0_BUFFER, // Buffers RGBA taille identique buffer principal RT_GLOW_HALF_BUFFER, RT_GLOW1_BUFFER, // Buffers RGBA au 16ième de la taille du buffer principal (1/4 * 1/4) RT_GLOW2_BUFFER); class LM_API_SM2 IRenderTarget { public: virtual ~IRenderTarget() {}; virtual void begin() = 0; virtual void end() = 0; virtual String getStats() = 0; virtual void updateRefractionBuffer(bool forceUpdate = false) = 0; virtual void bind(ERenderTargetBuffer buffer) = 0; virtual Ptr<Gfx::IShaderResourceView> getShaderTextureView(ERenderTargetBuffer buffer) = 0; virtual int32 getViewportWidth(ERenderTargetBuffer buffer) const = 0; virtual int32 getViewportHeight(ERenderTargetBuffer buffer) const = 0; }; } #endif /* IRENDERTARGET_H_ */
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_BASE_LAYOUT_H_ #define UI_BASE_LAYOUT_H_ #include <vector> #include "build/build_config.h" #include "ui/base/ui_export.h" #include "ui/gfx/native_widget_types.h" namespace ui { enum DisplayLayout { // The typical layout for e.g. Windows, Mac and Linux. LAYOUT_DESKTOP, // Layout optimized for touch. Used e.g. for Windows 8 Metro mode. LAYOUT_TOUCH, }; // Returns the display layout that should be used. This could be used // e.g. to tweak hard-coded padding that's layout specific, or choose // the .pak file of theme resources to load. // WARNING: this is deprecated and will be nuked as soon as aura is the default // on windows. UI_EXPORT DisplayLayout GetDisplayLayout(); // Supported UI scale factors for the platform. This is used as an index // into the array |kScaleFactorScales| which maps the enum value to a float. // SCALE_FACTOR_NONE is used for density independent resources such as // string, html/js files or an image that can be used for any scale factors // (such as wallpapers). enum ScaleFactor { SCALE_FACTOR_NONE = 0, SCALE_FACTOR_100P, SCALE_FACTOR_125P, SCALE_FACTOR_133P, SCALE_FACTOR_140P, SCALE_FACTOR_150P, SCALE_FACTOR_180P, SCALE_FACTOR_200P, NUM_SCALE_FACTORS // This always appears last. }; // Changes the value of GetSupportedScaleFactors() to |scale_factors|. // Use ScopedSetSupportedScaleFactors for unit tests as not to affect the // state of other tests. UI_EXPORT void SetSupportedScaleFactors( const std::vector<ScaleFactor>& scale_factors); // Returns a vector with the scale factors which are supported by this // platform, in ascending order. UI_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors(); // Returns the float scale value for |scale_factor|. UI_EXPORT float GetImageScale(ScaleFactor scale_factor); // Returns the supported ScaleFactor which most closely matches |scale|. // Converting from float to ScaleFactor is inefficient and should be done as // little as possible. // TODO(oshima): Make ScaleFactor a class and remove this. UI_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); // Returns the ScaleFactor used by |view|. UI_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view); // Returns true if |scale_factor| is supported by this platform. UI_EXPORT bool IsScaleFactorSupported(ScaleFactor scale_factor); // Returns the scale factor closest to |scale| from the full list of factors. // Note that it does NOT rely on the list of supported scale factors. // Finding the closest match is inefficient and shouldn't be done frequently. UI_EXPORT ScaleFactor FindClosestScaleFactorUnsafe(float scale); namespace test { // Class which changes the value of GetSupportedScaleFactors() to // |new_scale_factors| for the duration of its lifetime. class UI_EXPORT ScopedSetSupportedScaleFactors { public: explicit ScopedSetSupportedScaleFactors( const std::vector<ui::ScaleFactor>& new_scale_factors); ~ScopedSetSupportedScaleFactors(); private: std::vector<ui::ScaleFactor>* original_scale_factors_; DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); }; } // namespace test } // namespace ui #endif // UI_BASE_LAYOUT_H_
/* File header */ #include "adt_comparison.h" /* C Standard Library headers. */ #include "dag_platform.h" //#include <inttypes.h> #include <string.h> /* Standard comparison functions */ comparison_t inline adt_ptr_compare(AdtPtr first, AdtPtr second) { if ((uintptr_t) first > (uintptr_t) second) { return kComparisonFirstIsBigger; } else if ((uintptr_t) first < (uintptr_t) second) { return kComparisonFirstIsSmaller; } return kComparisonEqual; } comparison_t inline adt_string_compare(const char* first, const char* second) { int result = strcmp((char*) first, (char*) second); if (result > 0) { return kComparisonFirstIsBigger; } else if (result < 0) { return kComparisonFirstIsSmaller; } return kComparisonEqual; }
/* * 2007 – 2013 Copyright Northwestern University * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details. */ #pragma once #ifndef _AIMLib_ReferencedDicomObject_Class_ #define _AIMLib_ReferencedDicomObject_Class_ #include <vector> namespace aim_lib { class AIMLIB_API ReferencedDicomObject { public: ReferencedDicomObject(void); ReferencedDicomObject(const ReferencedDicomObject& refDicomObject); virtual ~ReferencedDicomObject(void); ReferencedDicomObject& operator=(const ReferencedDicomObject& refDicomObject); // need to have it here; otherwise the auto_ptr template will break the build because of the const in the copy constructor ReferencedDicomObject* Clone() const; const iso_21090::CD& GetModality() const; const iso_21090::II& GetSopInstanceUid() const; void SetModality(const iso_21090::CD& newVal); void SetSopInstanceUid(const iso_21090::II& newVal); protected: iso_21090::CD _modality; iso_21090::II _sopInstanceUid; }; typedef std::vector<ReferencedDicomObject> ReferencedDicomObjectVector; } #endif // _AIMLib_ReferencedDicomObject_Class_
// // rsp/cpu.h: RSP processor container. // // CEN64: Cycle-Accurate Nintendo 64 Simulator. // Copyright (C) 2014, Tyler J. Stachecki. // // This file is subject to the terms and conditions defined in // 'LICENSE', which is part of this source code package. // #ifndef __rsp_cpu_h__ #define __rsp_cpu_h__ #include "common.h" #include "os/dynarec.h" #include "rsp/cp2.h" #include "rsp/pipeline.h" enum rsp_register { RSP_REGISTER_R0, RSP_REGISTER_AT, RSP_REGISTER_V0, RSP_REGISTER_V1, RSP_REGISTER_A0, RSP_REGISTER_A1, RSP_REGISTER_A2, RSP_REGISTER_A3, RSP_REGISTER_T0, RSP_REGISTER_T1, RSP_REGISTER_T2, RSP_REGISTER_T3, RSP_REGISTER_T4, RSP_REGISTER_R5, RSP_REGISTER_T6, RSP_REGISTER_T7, RSP_REGISTER_S0, RSP_REGISTER_S1, RSP_REGISTER_S2, RSP_REGISTER_S3, RSP_REGISTER_S4, RSP_REGISTER_S5, RSP_REGISTER_S6, RSP_REGISTER_S7, RSP_REGISTER_T8, RSP_REGISTER_T9, RSP_REGISTER_K0, RSP_REGISTER_K1, RSP_REGISTER_GP, RSP_REGISTER_SP, RSP_REGISTER_FP, RSP_REGISTER_RA, // CP0 registers. RSP_REGISTER_CP0_0, RSP_REGISTER_CP0_1, RSP_REGISTER_CP0_2, RSP_REGISTER_CP0_3, RSP_REGISTER_CP0_4, RSP_REGISTER_CP0_5, RSP_REGISTER_CP0_6, RSP_REGISTER_CP0_7, // Miscellanious registers. NUM_RSP_REGISTERS }; enum sp_register { #define X(reg) reg, #include "rsp/registers.md" #undef X NUM_SP_REGISTERS, SP_REGISTER_OFFSET = RSP_REGISTER_CP0_0 }; #ifdef DEBUG_MMIO_REGISTER_ACCESS extern const char *sp_register_mnemonics[NUM_SP_REGISTERS]; #endif struct rsp { struct bus_controller *bus; struct rsp_pipeline pipeline; struct rsp_cp2 cp2; uint32_t regs[NUM_RSP_REGISTERS]; uint8_t mem[0x2000]; // Instead of redecoding the instructions (there's only 256 words) // every cycle, we maintain a 256-word decoded instruction cache. struct rsp_opcode opcode_cache[0x1000 / 4]; // TODO: Only for IA32/x86_64 SSE2; sloppy? struct dynarec_slab vload_dynarec; struct dynarec_slab vstore_dynarec; }; cen64_cold int rsp_init(struct rsp *rsp, struct bus_controller *bus); cen64_cold void rsp_late_init(struct rsp *rsp); cen64_cold void rsp_destroy(struct rsp *rsp); cen64_flatten cen64_hot void rsp_cycle(struct rsp *rsp); #endif
#ifndef FILEMANAGEMENT_H #define FILEMANAGEMENT_H #include <string> #include <windows.h> #include <commdlg.h> #include <ShlObj.h> using namespace std; string openfilename(char *filter, HWND owner) { OPENFILENAMEA ofn; char fileName[MAX_PATH] = ""; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = owner; ofn.lpstrFilter = filter; ofn.lpstrFile = fileName; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.lpstrDefExt = ""; string fileNameStr; if ( GetOpenFileNameA(&ofn) ) fileNameStr = fileName; return fileNameStr; } string savefilename(char *filter, HWND owner) { OPENFILENAMEA ofn; char fileName[MAX_PATH] = ""; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = owner; ofn.lpstrFile = fileName; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = "Agile (*.agl)\0*.agl\0"; ofn.lpstrTitle = "Save File As"; ofn.Flags = OFN_HIDEREADONLY; ofn.lpstrDefExt = "txt"; string fileNameStr; if ( GetSaveFileNameA(&ofn) ) fileNameStr = fileName; return fileNameStr; } string openFolder() { BROWSEINFO bi; ZeroMemory(&bi, sizeof(bi)); TCHAR szDisplayName[MAX_PATH]; szDisplayName[0] = ' '; bi.hwndOwner = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = szDisplayName; bi.lpszTitle = "Please select a folder for storing received files :"; bi.ulFlags = BIF_RETURNONLYFSDIRS; bi.lParam = NULL; bi.iImage = 0; LPITEMIDLIST pidl = SHBrowseForFolder(&bi); TCHAR szPathName[MAX_PATH]; if (NULL != pidl) { BOOL bRet = SHGetPathFromIDList(pidl,szPathName); if(FALSE == bRet) return ""; } return szPathName; } #endif
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ #include <vector> #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/supports_user_data.h" #include "components/autofill/core/browser/webdata/autofill_webdata.h" #include "components/autofill/core/common/form_field_data.h" #include "components/webdata/common/web_data_results.h" #include "components/webdata/common/web_data_service_base.h" #include "components/webdata/common/web_data_service_consumer.h" #include "components/webdata/common/web_database.h" class WebDatabaseService; namespace base { class MessageLoopProxy; } namespace content { class BrowserContext; } namespace autofill { class AutofillChange; class AutofillProfile; class AutofillWebDataBackend; class AutofillWebDataBackendImpl; class AutofillWebDataServiceObserverOnDBThread; class AutofillWebDataServiceObserverOnUIThread; class CreditCard; // API for Autofill web data. class AutofillWebDataService : public AutofillWebData, public WebDataServiceBase { public: AutofillWebDataService(scoped_refptr<base::MessageLoopProxy> ui_thread, scoped_refptr<base::MessageLoopProxy> db_thread); AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, scoped_refptr<base::MessageLoopProxy> ui_thread, scoped_refptr<base::MessageLoopProxy> db_thread, const ProfileErrorCallback& callback); // Retrieve an AutofillWebDataService for the given context. // Can return NULL in some contexts. static scoped_refptr<AutofillWebDataService> FromBrowserContext( content::BrowserContext* context); // WebDataServiceBase implementation. virtual void ShutdownOnUIThread() OVERRIDE; // AutofillWebData implementation. virtual void AddFormFields( const std::vector<FormFieldData>& fields) OVERRIDE; virtual WebDataServiceBase::Handle GetFormValuesForElementName( const base::string16& name, const base::string16& prefix, int limit, WebDataServiceConsumer* consumer) OVERRIDE; virtual WebDataServiceBase::Handle HasFormElements( WebDataServiceConsumer* consumer) OVERRIDE; virtual void RemoveFormElementsAddedBetween( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; virtual void RemoveFormValueForElementName( const base::string16& name, const base::string16& value) OVERRIDE; virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE; virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE; virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE; virtual WebDataServiceBase::Handle GetAutofillProfiles( WebDataServiceConsumer* consumer) OVERRIDE; virtual void AddCreditCard(const CreditCard& credit_card) OVERRIDE; virtual void UpdateCreditCard(const CreditCard& credit_card) OVERRIDE; virtual void RemoveCreditCard(const std::string& guid) OVERRIDE; virtual WebDataServiceBase::Handle GetCreditCards( WebDataServiceConsumer* consumer) OVERRIDE; virtual void RemoveAutofillDataModifiedBetween( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; virtual void RemoveOriginURLsModifiedBetween( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer); void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer); // Returns a SupportsUserData objects that may be used to store data // owned by the DB thread on this object. Should be called only from // the DB thread, and will be destroyed on the DB thread soon after // |ShutdownOnUIThread()| is called. base::SupportsUserData* GetDBUserData(); // Takes a callback which will be called on the DB thread with a pointer to an // |AutofillWebdataBackend|. This backend can be used to access or update the // WebDatabase directly on the DB thread. void GetAutofillBackend( const base::Callback<void(AutofillWebDataBackend*)>& callback); protected: virtual ~AutofillWebDataService(); virtual void NotifyAutofillMultipleChangedOnUIThread(); base::WeakPtr<AutofillWebDataService> AsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } private: ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; // The MessageLoopProxy that this class uses as its UI thread. scoped_refptr<base::MessageLoopProxy> ui_thread_; // The MessageLoopProxy that this class uses as its DB thread. scoped_refptr<base::MessageLoopProxy> db_thread_; // This factory is used on the UI thread. All vended weak pointers are // invalidated in ShutdownOnUIThread(). base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); }; } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_
//===-- LinuxSignals.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_LinuxSignals_H_ #define liblldb_LinuxSignals_H_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Target/UnixSignals.h" namespace lldb_private { /// Linux specific set of Unix signals. class LinuxSignals : public UnixSignals { public: LinuxSignals(); private: void Reset() override; }; } // namespace lldb_private #endif // liblldb_LinuxSignals_H_
/** @file * Daemonization & pidfile handling. */ /* * Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ * * Permission to use, copy, modify, and/or 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" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _USUAL_DAEMON_H_ #define _USUAL_DAEMON_H_ #include <usual/base.h> /** * Read a pid from pidfile and send a signal to it. */ bool signal_pidfile(const char *pidfile, int sig); /** * Daemonize process and write pidfile. */ void daemonize(const char *pidfile, bool go_background); #endif
/*- * Copyright 2016 Michal Meloun <mmel@FreeBSD.org> * 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 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 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. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> #include <dev/fdt/simplebus.h> #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_bus_subr.h> struct ofw_clkbus_softc { struct simplebus_softc simplebus_sc; }; static int ofw_clkbus_probe(device_t dev) { const char *name; name = ofw_bus_get_name(dev); if (name == NULL || strcmp(name, "clocks") != 0) return (ENXIO); device_set_desc(dev, "OFW clocks bus"); return (BUS_PROBE_GENERIC); } static int ofw_clkbus_attach(device_t dev) { struct ofw_clkbus_softc *sc; phandle_t node, child; device_t cdev; sc = device_get_softc(dev); node = ofw_bus_get_node(dev); simplebus_init(dev, node); for (child = OF_child(node); child > 0; child = OF_peer(child)) { cdev = simplebus_add_device(dev, child, 0, NULL, -1, NULL); if (cdev != NULL) device_probe_and_attach(cdev); } return (bus_generic_attach(dev)); } static device_method_t ofw_clkbus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ofw_clkbus_probe), DEVMETHOD(device_attach, ofw_clkbus_attach), DEVMETHOD_END }; DEFINE_CLASS_1(ofw_clkbus, ofw_clkbus_driver, ofw_clkbus_methods, sizeof(struct ofw_clkbus_softc), simplebus_driver); static devclass_t ofw_clkbus_devclass; EARLY_DRIVER_MODULE(ofw_clkbus, simplebus, ofw_clkbus_driver, ofw_clkbus_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(ofw_clkbus, 1);
/* $OpenBSD: tls_peer.c,v 1.3 2015/09/11 13:22:39 beck Exp $ */ /* * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> * Copyright (c) 2015 Bob Beck <beck@openbsd.org> * * 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" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "tls_compat.h" #ifdef USUAL_LIBSSL_FOR_TLS #include <stdio.h> #include <openssl/x509.h> #include "tls_internal.h" const char * tls_peer_cert_hash(struct tls *ctx) { if (ctx->conninfo) return (ctx->conninfo->hash); return NULL; } const char * tls_peer_cert_issuer(struct tls *ctx) { if (ctx->conninfo) return (ctx->conninfo->issuer); return NULL; } const char * tls_peer_cert_subject(struct tls *ctx) { if (ctx->conninfo) return (ctx->conninfo->subject); return NULL; } int tls_peer_cert_provided(struct tls *ctx) { return (ctx->ssl_peer_cert != NULL); } int tls_peer_cert_contains_name(struct tls *ctx, const char *name) { if (ctx->ssl_peer_cert == NULL) return (0); return (tls_check_name(ctx, ctx->ssl_peer_cert, name) == 0); } #endif /* USUAL_LIBSSL_FOR_TLS */
/* Auto generated file: with makeref.py . Docs go in src/ *.doc . */ #define DOC_PYGAMECOLOR "Color(name) -> Color\nColor(r, g, b, a) -> Color\nColor(rgbvalue) -> Color\npygame object for color representations" #define DOC_COLORR "r -> int\nGets or sets the red value of the Color." #define DOC_COLORG "g -> int\nGets or sets the green value of the Color." #define DOC_COLORB "b -> int\nGets or sets the blue value of the Color." #define DOC_COLORA "a -> int\nGets or sets the alpha value of the Color." #define DOC_COLORCMY "cmy -> tuple\nGets or sets the CMY representation of the Color." #define DOC_COLORHSVA "hsva -> tuple\nGets or sets the HSVA representation of the Color." #define DOC_COLORHSLA "hsla -> tuple\nGets or sets the HSLA representation of the Color." #define DOC_COLORI1I2I3 "i1i2i3 -> tuple\nGets or sets the I1I2I3 representation of the Color." #define DOC_COLORNORMALIZE "normalize() -> tuple\nReturns the normalized RGBA values of the Color." #define DOC_COLORCORRECTGAMMA "correct_gamma (gamma) -> Color\nApplies a certain gamma value to the Color." #define DOC_COLORSETLENGTH "set_length(len) -> None\nSet the number of elements in the Color to 1,2,3, or 4." /* Docs in a comment... slightly easier to read. */ /* pygame.Color Color(name) -> Color Color(r, g, b, a) -> Color Color(rgbvalue) -> Color pygame object for color representations pygame.Color.r r -> int Gets or sets the red value of the Color. pygame.Color.g g -> int Gets or sets the green value of the Color. pygame.Color.b b -> int Gets or sets the blue value of the Color. pygame.Color.a a -> int Gets or sets the alpha value of the Color. pygame.Color.cmy cmy -> tuple Gets or sets the CMY representation of the Color. pygame.Color.hsva hsva -> tuple Gets or sets the HSVA representation of the Color. pygame.Color.hsla hsla -> tuple Gets or sets the HSLA representation of the Color. pygame.Color.i1i2i3 i1i2i3 -> tuple Gets or sets the I1I2I3 representation of the Color. pygame.Color.normalize normalize() -> tuple Returns the normalized RGBA values of the Color. pygame.Color.correct_gamma correct_gamma (gamma) -> Color Applies a certain gamma value to the Color. pygame.Color.set_length set_length(len) -> None Set the number of elements in the Color to 1,2,3, or 4. */
/* * Configuration for Xilinx ZynqMP Flash utility * * (C) Copyright 2018 Xilinx, Inc. * Michal Simek <michal.simek@xilinx.com> * Siva Durga Prasad Paladugu <sivadur@xilinx.com> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_ZYNQMP_MINI_H #define __CONFIG_ZYNQMP_MINI_H #define CONFIG_SYS_MEMTEST_SCRATCH 0xfffc0000 #include <configs/xilinx_zynqmp.h> /* Undef unneeded configs */ #undef CONFIG_EXTRA_ENV_SETTINGS #undef CONFIG_SYS_MALLOC_LEN #undef CONFIG_ENV_SIZE #undef CONFIG_ZLIB #undef CONFIG_GZIP #undef CONFIG_CMD_ENV #undef CONFIG_MP #undef CONFIG_SYS_INIT_SP_ADDR #undef CONFIG_MTD_DEVICE #undef CONFIG_BOOTM_NETBSD #undef CONFIG_BOOTM_VXWORKS #undef CONFIG_BOOTM_LINUX #undef CONFIG_BOARD_LATE_INIT /* BOOTP options */ #undef CONFIG_BOOTP_BOOTFILESIZE #undef CONFIG_BOOTP_MAY_FAIL #undef CONFIG_CMD_UNZIP #undef CONFIG_NR_DRAM_BANKS #endif /* __CONFIG_ZYNQMP_MINI_H */
#ifndef LRT_BARE_ARCH_ASSERT_H #define LRT_BARE_ARCH_ASSERT_H /* * Copyright (C) 2011 by Project SESA, Boston University * * 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. */ #define LRT_Assert(cond) \ ({ \ if (!(cond)) { \ if (stdout) \ printf("Assertion failed: at %s, line %d\n", __FILE__, __LINE__); \ while(1) ; \ } \ }) #endif
/**************************************************************************** * * * PrimeSense Sensor 5.x Alpha * * Copyright (C) 2011 PrimeSense Ltd. * * * * This file is part of PrimeSense Sensor. * * * * PrimeSense Sensor 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. * * * * PrimeSense Sensor 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 PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.* * * ****************************************************************************/ #ifndef _XNV_LABELED_OBJECT_H_ #define _XNV_LABELED_OBJECT_H_ //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include "XnVRealObject.h" #include "XnVLabelMatrix.h" //--------------------------------------------------------------------------- // Types //--------------------------------------------------------------------------- /** * This is a real object that holds a label matrix with it. In effect, it creates a mask over the depth map * and allows categorization of it using labels. * As a Real Object, the LabeledObject holds a label (actually, as a XnVObject) and a pointer to XnVDepthMap. */ class XN_EE_FW_API XnVLabeledObject : public XnVRealObject { public: XnVLabeledObject() : XnVRealObject(NULL) {} const XnVLabelMatrix* GetLabelMatrix() const {return m_pLM;} void SetLabelMatrix(XnVLabelMatrix* pLM) {m_pLM = pLM;} virtual XnDepthPixel GetAt(XnUInt32 nPos) const { if (((XnVObject::XnVLabel*)m_pLM->Data())[nPos] == m_nID) return m_pdmDepthMap->Data()[nPos]; return m_pdmDepthMap->GetNoSampleValue(); } protected: XnVLabelMatrix* m_pLM; }; #endif // _XNV_LABELED_OBJECT_H_
/*! \copyright (c) RDO-Team, 2011 \file utils/stack.h \author Урусов Андрей (rdo@rk9.bmstu.ru) \date 12.02.2010 \brief \indent 4T */ #ifndef _RDO_COMMON_STACK_H_ #define _RDO_COMMON_STACK_H_ // ----------------------------------------------------------------------- INCLUDES #include <list> // ----------------------------------------------------------------------- SYNOPSIS #include "utils/src/common/rdocommon.h" // -------------------------------------------------------------------------------- namespace rdo { template<class T> class stack { public: void push(const T& item); void pop(); bool empty() const; std::size_t size() const; const T& top() const; T& top(); private: typedef std::list<T> Container; Container m_container; }; } // namespace rdo #include "utils/src/stuff/stack-inl.h" #endif // _RDO_COMMON_STACK_H_
#ifndef _LOCALE_IMPL_H #define _LOCALE_IMPL_H #include <locale.h> #include <stdlib.h> #include "libc.h" #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT) #include "pthread_impl.h" #endif #define LOCALE_NAME_MAX 23 struct __locale_map { const void *map; size_t map_size; char name[LOCALE_NAME_MAX+1]; const struct __locale_map *next; }; #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT) extern hidden volatile int __locale_lock[1]; #endif extern hidden const struct __locale_map __c_dot_utf8; extern hidden const struct __locale_struct __c_locale; extern hidden const struct __locale_struct __c_dot_utf8_locale; hidden const struct __locale_map *__get_locale(int, const char *); hidden const char *__mo_lookup(const void *, size_t, const char *); hidden const char *__lctrans(const char *, const struct __locale_map *); hidden const char *__lctrans_cur(const char *); hidden const char *__lctrans_impl(const char *, const struct __locale_map *); hidden int __loc_is_allocated(locale_t); hidden char *__gettextdomain(void); #define LOC_MAP_FAILED ((const struct __locale_map *)-1) #define LCTRANS(msg, lc, loc) __lctrans(msg, (loc)->cat[(lc)]) #define LCTRANS_CUR(msg) __lctrans_cur(msg) #define C_LOCALE ((locale_t)&__c_locale) #define UTF8_LOCALE ((locale_t)&__c_dot_utf8_locale) #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT) #define CURRENT_LOCALE (__pthread_self()->locale) #define CURRENT_UTF8 (!!__pthread_self()->locale->cat[LC_CTYPE]) #else // If we haven't set up the current_local field yet, do so. Then return an // lvalue for the current_locale field. #define CURRENT_LOCALE \ (*({ \ if (!libc.current_locale) { \ libc.current_locale = &libc.global_locale; \ } \ &libc.current_locale; \ })) #define CURRENT_UTF8 (!!libc.global_locale.cat[LC_CTYPE]) #endif #undef MB_CUR_MAX #define MB_CUR_MAX (CURRENT_UTF8 ? 4 : 1) #endif
/* gmo2msg.c - create X/Open message source file for libelf. Copyright (C) 1996 - 2002 Michael Riepe <michael@stud.uni-hannover.de> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef lint static const char rcsid[] = "@(#) $Id: gmo2msg.c,v 1.6 2002/12/14 17:43:13 michael Exp $"; #endif /* lint */ #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdio.h> #include <libintl.h> #define DOMAIN "libelf" static const char *msgs[] = { #define __err__(a,b) b, #include <errors.h> #undef __err__ }; int main(int argc, char **argv) { char buf[1024], *lang, *progname, *s; unsigned i; if (*argv && (progname = strrchr(argv[0], '/'))) { progname++; } else if (!(progname = *argv)) { progname = "gmo2msg"; } if (!(lang = getenv("LANGUAGE")) && !(lang = getenv("LC_ALL")) && !(lang = getenv("LC_MESSAGES")) && !(lang = getenv("LANG"))) { fprintf(stderr, "LANG variable not set.\n"); exit(1); } /* * Fool gettext... */ getcwd(buf, sizeof(buf)); bindtextdomain(DOMAIN, buf); sprintf(buf, "%s.gmo", lang); unlink(DOMAIN ".mo"); symlink(buf, DOMAIN ".mo"); unlink("LC_MESSAGES"); symlink(".", "LC_MESSAGES"); unlink(lang); symlink(".", lang); printf("$set 1 Automatically created from %s by %s\n", buf, progname); /* * Get translated messages. * Assume that messages contain printable ASCII characters ONLY. * That means no tabs, linefeeds etc. */ textdomain(DOMAIN); if ((s = gettext("")) && (s = strdup(s))) { s = strtok(s, "\n"); while (s) { printf("$ %s\n", s); s = strtok(NULL, "\n"); } } for (i = 0; i < sizeof(msgs)/sizeof(*msgs); i++) { s = gettext(msgs[i]); if (s != msgs[i] && strcmp(s, msgs[i])) { printf("$ \n$ Original message: %s\n", msgs[i]); printf("%u %s\n", i + 1, s); } } /* * Cleanup. */ unlink(DOMAIN ".mo"); unlink("LC_MESSAGES"); unlink(lang); exit(0); }
// Copyright (c) 2011-2013 The Octocoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_SENDCOINSDIALOG_H #define BITCOIN_QT_SENDCOINSDIALOG_H #include "walletmodel.h" #include <QDialog> #include <QString> class ClientModel; class OptionsModel; class SendCoinsEntry; class SendCoinsRecipient; namespace Ui { class SendCoinsDialog; } QT_BEGIN_NAMESPACE class QUrl; QT_END_NAMESPACE /** Dialog for sending bitcoins */ class SendCoinsDialog : public QDialog { Q_OBJECT public: explicit SendCoinsDialog(QWidget *parent = 0); ~SendCoinsDialog(); void setClientModel(ClientModel *clientModel); void setModel(WalletModel *model); /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). */ QWidget *setupTabChain(QWidget *prev); void setAddress(const QString &address); void pasteEntry(const SendCoinsRecipient &rv); bool handlePaymentRequest(const SendCoinsRecipient &recipient); public slots: void clear(); void reject(); void accept(); SendCoinsEntry *addEntry(); void updateTabsAndLabels(); void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance); private: Ui::SendCoinsDialog *ui; ClientModel *clientModel; WalletModel *model; bool fNewRecipientAllowed; bool fFeeMinimized; // Process WalletModel::SendCoinsReturn and generate a pair consisting // of a message and message flags for use in emit message(). // Additional parameter msgArg can be used via .arg(msgArg). void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString()); void minimizeFeeSection(bool fMinimize); void updateFeeMinimizedLabel(); private slots: void on_sendButton_clicked(); void on_buttonChooseFee_clicked(); void on_buttonMinimizeFee_clicked(); void removeEntry(SendCoinsEntry* entry); void updateDisplayUnit(); void coinControlFeatureChanged(bool); void coinControlButtonClicked(); void coinControlChangeChecked(int); void coinControlChangeEdited(const QString &); void coinControlUpdateLabels(); void coinControlClipboardQuantity(); void coinControlClipboardAmount(); void coinControlClipboardFee(); void coinControlClipboardAfterFee(); void coinControlClipboardBytes(); void coinControlClipboardPriority(); void coinControlClipboardLowOutput(); void coinControlClipboardChange(); void setMinimumFee(); void updateFeeSectionControls(); void updateMinFeeLabel(); void updateSmartFeeLabel(); void updateGlobalFeeVariables(); signals: // Fired when a message should be reported to the user void message(const QString &title, const QString &message, unsigned int style); }; #endif // BITCOIN_QT_SENDCOINSDIALOG_H
virtual void onFrontConnected() {}; virtual void onFrontDisconnected(int reqid) {}; virtual void onRspAuthenticate(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspUserLogin(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspUserPasswordUpdate(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspErrorOrderInsert(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspOrderAction(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspErrorExerciseOrderInsert(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspExerciseOrderAction(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspErrorLockInsert(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspForQuoteInsert(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspErrorCombActionInsert(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQueryMaxOrderVolume(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQueryLockVolume(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQueryExerciseVolume(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryPosition(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryTradingAccount(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryOrder(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryTrade(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryExercise(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryLock(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryCombAction(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryPositionCombineDetail(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryInstrument(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryCoveredShort(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryExerciseAssign(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspTransfer(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryTransfer(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQueryBankBalance(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQueryBankAccount(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQueryBillContent(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspBillConfirm(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryMargin(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryCommission(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryPositionDetail(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryExchangeRate(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQrySysConfig(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRspQryDepthMarketData(const dict &data, const dict &error, int reqid, bool last) {}; virtual void onRtnTrade(const dict &data) {}; virtual void onRtnOrder(const dict &data) {}; virtual void onRtnExercise(const dict &data) {}; virtual void onRtnCombAction(const dict &data) {}; virtual void onRtnLock(const dict &data) {};
// // TestHelpers.h // SocializeAPIClient // // Created by Nate Griswold on 3/5/13. // Copyright (c) 2013 Socialize. All rights reserved. // #import <OCMock/OCMock.h> #define REPLACE_PROPERTY(partial, getter, mock, setter, variable) \ do { \ [[[partial stub] andReturnFromBlock:^id{ return mock; }] getter]; \ [[[partial stub] andDo1:^(id value) { \ variable = value;\ }] setter:OCMOCK_ANY]; \ } while (0);
// Copyright (c) 2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UTIL_MACROS_H #define BITCOIN_UTIL_MACROS_H #define PASTE(x, y) x##y #define PASTE2(x, y) PASTE(x, y) #endif // BITCOIN_UTIL_MACROS_H
#pragma once #include "ofMain.h" #include "angleLengthLine.h" class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed (int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); ofPolyline line; angleLengthLine angleLine; vector < angleLengthLine > alines; };
/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2020 Scientific Computing and Imaging Institute, University of Utah. 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 MODULES_DATAIO_READ_MATRIX_H #define MODULES_DATAIO_READ_MATRIX_H #include <Core/Datatypes/DatatypeFwd.h> #include <Core/Algorithms/Base/AlgorithmBase.h> #include <Modules/DataIO/GenericReader.h> #include <Modules/DataIO/share.h> namespace SCIRun { namespace Modules { namespace DataIO { class SCISHARE ReadMatrix : public GenericReader<Core::Datatypes::MatrixHandle, MatrixPortTag> { public: typedef GenericReader<Core::Datatypes::MatrixHandle, MatrixPortTag> my_base; ReadMatrix(); void execute() override; bool useCustomImporter(const std::string& filename) const override; bool call_importer(const std::string& filename, Core::Datatypes::MatrixHandle& handle) override; OUTPUT_PORT(0, Matrix, Matrix); static std::string fileTypeList(); MODULE_TRAITS_AND_INFO(ModuleFlags::ModuleHasUIAndAlgorithm) protected: std::string defaultFileTypeName() const override; }; }}} #endif
void ExecFifo(char *command,int cooked);
// // UIColor+EXtension.h // 项目基础框架 // // Created by 羊谦 on 16/7/6. // Copyright © 2016年 NetEase-yangqian. All rights reserved. // #import <UIKit/UIKit.h> @interface UIColor (EXtension) + (UIColor *)colorWithHexString:(NSString *)hex; + (UIColor *)colorWithHexString:(NSString *)hex alpha:(CGFloat)alpha; - (NSString *)hexStringIgnoreAlpha; @end
/* * A lock-free single-producer circular queue implementation modeled after the * more elaborate C++ version from Faustino Frechilla available at: * http://www.codeproject.com/Articles/153898/Yet-another-implementation-of-a-lock-free-circular */ #include <linux/slab.h> #include "circ_queue.h" circ_queue * init_circ_queue(int len) { int i; circ_queue * q; q = kzalloc(sizeof(circ_queue), GFP_KERNEL); if (q == NULL) { printk(KERN_ERR "Not enough memory to allocate circ_queue"); return NULL; } atomic_set(&q->writeIndex, 0); atomic_set(&q->readIndex, 0); q->len = len; q->vals = (unsigned int**) kzalloc(len*sizeof(unsigned int*), GFP_KERNEL); if (q->vals == NULL) { printk(KERN_ERR "Not enough memory to allocate circ_queue array"); return NULL; } for (i = 0; i < len; i++) { q->vals[i] = (unsigned int*) kzalloc(2*sizeof(unsigned int), GFP_KERNEL); if (q->vals[i] == NULL) { printk(KERN_ERR "Not enough memory to allocate circ_queue array position"); return NULL; } } return q; } /** * Internal function to help count. Returns the queue size normalized position. */ unsigned int queue_count_to_index(unsigned int count, unsigned int len) { return (count % len); } int push_circ_queue(circ_queue * q, unsigned int val1, unsigned int val2) { unsigned int currReadIndex; unsigned int currWriteIndex; currWriteIndex = atomic_read(&q->writeIndex); currReadIndex = atomic_read(&q->readIndex); if (queue_count_to_index(currWriteIndex+1, q->len) == queue_count_to_index(currReadIndex, q->len)) { // The queue is full return 1; } // Save the data into the queue q->vals[queue_count_to_index(currWriteIndex, q->len)][0] = val1; q->vals[queue_count_to_index(currWriteIndex, q->len)][1] = val2; // Increment atomically write index. Now a consumer thread can read // the piece of data that was just stored. atomic_inc(&q->writeIndex); return 0; } int pop_circ_queue(circ_queue * q, unsigned int * val1, unsigned int * val2) { unsigned int currReadIndex; unsigned int currMaxReadIndex; do { currReadIndex = atomic_read(&q->readIndex); currMaxReadIndex = atomic_read(&q->writeIndex); if (queue_count_to_index(currReadIndex, q->len) == queue_count_to_index(currMaxReadIndex, q->len)) { // The queue is empty or a producer thread has allocate space in the queue // but is waiting to commit the data into it return 1; } // Retrieve the data from the queue *val1 = q->vals[queue_count_to_index(currReadIndex, q->len)][0]; *val2 = q->vals[queue_count_to_index(currReadIndex, q->len)][1]; // Try to perfrom now the CAS operation on the read index. If we succeed // label & val already contain what q->readIndex pointed to before we // increased it. if (atomic_cmpxchg(&q->readIndex, currReadIndex, currReadIndex+1) == currReadIndex) { // The lable & val were retrieved from the queue. Note that the // data inside the label or value arrays are not deleted. return 0; } // Failed to retrieve the elements off the queue. Someone else must // have read the element stored at countToIndex(currReadIndex) // before we could perform the CAS operation. } while(1); // keep looping to try again! return 1; } void free_circ_queue(circ_queue * q) { int i; if (q == NULL) return; for (i = 0; i < q->len; i++) { kfree(q->vals[i]); } kfree(q->vals); kfree(q); }
/** * Clever programming language * Copyright (c) Clever Team * * This file is distributed under the MIT license. See LICENSE for details. */ #ifndef CLEVER_STD_UNICODE_H #define CLEVER_STD_UNICODE_H #include "core/module.h" #include "unicode/uclean.h" namespace clever { namespace modules { namespace std { /// Standard Unicode Module class UnicodeModule : public Module { public: UnicodeModule() : Module("std.unicode") { } ~UnicodeModule() { u_cleanup(); } CLEVER_MODULE_VIRTUAL_METHODS_DECLARATION; private: DISALLOW_COPY_AND_ASSIGN(UnicodeModule); }; }}} // clever::modules::std #endif // CLEVER_STD_UNICODE_H
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; int main(int argc , char *argv[] ) { unsigned long input[1] ; unsigned long output[1] ; int randomFuns_i5 ; unsigned long randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 4242424242UL) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%lu\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } } void RandomFunc(unsigned long input[1] , unsigned long output[1] ) { unsigned long state[1] ; unsigned long local1 ; unsigned short copy11 ; { state[0UL] = (input[0UL] + 51238316UL) + 274866410UL; local1 = 0UL; while (local1 < 1UL) { copy11 = *((unsigned short *)(& state[local1]) + 0); *((unsigned short *)(& state[local1]) + 0) = *((unsigned short *)(& state[local1]) + 3); *((unsigned short *)(& state[local1]) + 3) = copy11; local1 += 2UL; } local1 = 0UL; while (local1 < 1UL) { state[0UL] = state[local1] - state[0UL]; state[local1] += state[local1]; local1 ++; } output[0UL] = state[0UL] + 745879451UL; } } void megaInit(void) { { } }
// // DateSelectViewController.h // M7MotionSample // // Created by Zushi Tatsuya on 2013/09/22. // Copyright (c) 2013年 cyan-stivy.net. All rights reserved. // #import <UIKit/UIKit.h> @interface DateSelectViewController : UITableViewController @property (nonatomic, strong, readonly) NSDate *fromDate; @property (nonatomic, strong, readonly) NSDate *toDate; @end
/* * Copyright (C) 2003 Mike Melanson * Copyright (C) 2003 Dr. Tim Ferguson * * This file is part of Libav. * * Libav 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. * * Libav 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 Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_ROQVIDEO_H #define AVCODEC_ROQVIDEO_H #include "libavutil/lfg.h" #include "avcodec.h" #include "bytestream.h" #include "dsputil.h" typedef struct { unsigned char y[4]; unsigned char u, v; } roq_cell; typedef struct { int idx[4]; } roq_qcell; typedef struct { int d[2]; } motion_vect; struct RoqTempData; typedef struct RoqContext { AVCodecContext *avctx; DSPContext dsp; AVFrame frames[2]; AVFrame *last_frame; AVFrame *current_frame; int first_frame; roq_cell cb2x2[256]; roq_qcell cb4x4[256]; GetByteContext gb; int width, height; /* Encoder only data */ AVLFG randctx; uint64_t lambda; motion_vect *this_motion4; motion_vect *last_motion4; motion_vect *this_motion8; motion_vect *last_motion8; unsigned int framesSinceKeyframe; AVFrame *frame_to_enc; uint8_t *out_buf; struct RoqTempData *tmpData; } RoqContext; #define RoQ_INFO 0x1001 #define RoQ_QUAD_CODEBOOK 0x1002 #define RoQ_QUAD_VQ 0x1011 #define RoQ_SOUND_MONO 0x1020 #define RoQ_SOUND_STEREO 0x1021 #define RoQ_ID_MOT 0x00 #define RoQ_ID_FCC 0x01 #define RoQ_ID_SLD 0x02 #define RoQ_ID_CCC 0x03 void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell); void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell); void ff_apply_motion_4x4(RoqContext *ri, int x, int y, int deltax, int deltay); void ff_apply_motion_8x8(RoqContext *ri, int x, int y, int deltax, int deltay); #endif /* AVCODEC_ROQVIDEO_H */
// // NSURL+Query.h // NSURL+Query // // Created by Jon Crooke on 10/12/2013. // Copyright (c) 2013 Jonathan Crooke. All rights reserved. // #import <Foundation/Foundation.h> @interface NSString (ASURLQuery) /** * @return If the receiver is a valid URL query component, returns * components as key/value pairs. If couldn't split into *any* pairs, * returns nil. */ @property (nonatomic, readonly) NSDictionary *as_URLQueryDictionary; @end
#include "stdlib.h" #include "stdio.h" #include "/home/lillian/work/install_fpdebug/valgrind-3.7.0/fpdebug/fpdebug.h" #include <gsl/gsl_sf.h> int main(int argc, const char * argv[]) { unsigned long int hexdouble; int a; a = atoi(argv[1]); double b; sscanf(argv[2], "%lX", &hexdouble); b = *(double*)(&hexdouble); double result = gsl_sf_psi_n(a, b); //printf("%.15f\n", result); VALGRIND_PRINT_ERROR("result", &result); return 0; }
// // ColorfulWoodCategories.h // ColorfulWoodCategories // // Created by 大新 on 2017/2/17. // Copyright © 2017年 ColorfulWood. All rights reserved. // #import <UIKit/UIKit.h> FOUNDATION_EXPORT double ColorfulWoodCategoriesVersionNumber; FOUNDATION_EXPORT const unsigned char ColorfulWoodCategoriesVersionString[]; #import "UIViewController+ColorfulWoodAddtional.h" #import "UIImage+ColorfulWoodAddtional.h" #import "UINavigationItem+ColorfulWoodMargin.h" #import "NSString+ColorfulWoodRegex.h" #import "UIColor+Hex.h" #import "NSDictionary+BmobCheckResult.h" #import "NSString+ColorfulWoodSize.h"
// // CCCollectionViewDelegate.h // CCCollectionView // // Created by zysun on 14-3-16. // // #ifndef CCCollectionView_CCCollectionViewDelegate_h #define CCCollectionView_CCCollectionViewDelegate_h #include "GUI/CCScrollView/CCScrollView.h" class CollectionViewCell; class CollectionView; /** * brief 定义集合视图样式和行为的协议 */ class CollectionViewDelegate: public cocos2d::extension::ScrollViewDelegate { public: /** * brief 单元格被点击要执行的方法 * * @param collection 被点击的集合视图 * @param cell 被点击的单元格 */ virtual void collectionCellTouched(CollectionView* collection, CollectionViewCell* cell) = 0; /** * brief 单元格刚被点击时要执行的方法 * * @param collection 被点击的集合视图 * @param cell 被点击的单元格 */ virtual void collectionCellHighlight(CollectionView* collection, CollectionViewCell* cell){}; /** * brief 手指即将离开单元格时要执行的方法 * * @param collection 要离开的集合视图 * @param cell 要离开的单元格 */ virtual void collectionCellUnhighlight(CollectionView* collection, CollectionViewCell* cell){}; //和单元格样式相关的应该在delegate中写,而不应该在dataSource中写。 //dataSource定义的都是和数据层相关的接口 /** * brief 设定单元格的尺寸,默认返回{0,0} * * @param collection 要设定的集合视图 * @param idx 要设定的单元格下标 * * @return 设定的尺寸 */ virtual cocos2d::Size collectionCellSizeForIndex(CollectionView* collection, ssize_t idx){ return cellSizeForCollection(collection); }; /** * brief 为集合视图中所有的单元格设定尺寸 * * @param collection 要设定的集合视图 * * @return 设定的尺寸 */ virtual cocos2d::Size cellSizeForCollection(CollectionView* collection) { return cocos2d::Size::ZERO; }; /** * brief 最左侧单元格和左边界的间距 * * @param collection 要设置的集合视图 * * @return 设定的间距 */ virtual float leftSideSpaceForCollection(CollectionView* collection){return 0;} /** * brief 最上层单元格和上边界的间距 * * @param collection 要设置的集合视图 * * @return 设定的间距 */ virtual float upSideSpaceForCollection(CollectionView* collection){return 0;} /** * brief 单元格即将进入重用队列 * * @param collection 集合视图 * @param cell 即将进入重用队列的单元格 */ virtual void collectionCellWillRecycle(CollectionView* collection, CollectionViewCell* cell){}; }; #endif
// Copyright (c) 2015-2018 The Machinecoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef MACHINECOIN_REVERSELOCK_H #define MACHINECOIN_REVERSELOCK_H /** * An RAII-style reverse lock. Unlocks on construction and locks on destruction. */ template<typename Lock> class reverse_lock { public: explicit reverse_lock(Lock& _lock) : lock(_lock) { _lock.unlock(); _lock.swap(templock); } ~reverse_lock() { templock.lock(); templock.swap(lock); } private: reverse_lock(reverse_lock const&); reverse_lock& operator=(reverse_lock const&); Lock& lock; Lock templock; }; #endif // MACHINECOIN_REVERSELOCK_H
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2012-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UI_INTERFACE_H #define BITCOIN_UI_INTERFACE_H #include <functional> #include <memory> #include <stdint.h> #include <string> class CBlockIndex; namespace boost { namespace signals2 { class connection; } } // namespace boost /** General change type (added, updated, removed). */ enum ChangeType { CT_NEW, CT_UPDATED, CT_DELETED }; /** Signals for UI communication. */ class CClientUIInterface { public: /** Flags for CClientUIInterface::ThreadSafeMessageBox */ enum MessageBoxFlags { ICON_INFORMATION = 0, ICON_WARNING = (1U << 0), ICON_ERROR = (1U << 1), /** * Mask of all available icons in CClientUIInterface::MessageBoxFlags * This needs to be updated, when icons are changed there! */ ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR), /** These values are taken from qmessagebox.h "enum StandardButton" to be directly usable */ BTN_OK = 0x00000400U, // QMessageBox::Ok BTN_YES = 0x00004000U, // QMessageBox::Yes BTN_NO = 0x00010000U, // QMessageBox::No BTN_ABORT = 0x00040000U, // QMessageBox::Abort BTN_RETRY = 0x00080000U, // QMessageBox::Retry BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore BTN_CLOSE = 0x00200000U, // QMessageBox::Close BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel BTN_DISCARD = 0x00800000U, // QMessageBox::Discard BTN_HELP = 0x01000000U, // QMessageBox::Help BTN_APPLY = 0x02000000U, // QMessageBox::Apply BTN_RESET = 0x04000000U, // QMessageBox::Reset /** * Mask of all available buttons in CClientUIInterface::MessageBoxFlags * This needs to be updated, when buttons are changed there! */ BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE | BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET), /** Force blocking, modal message box dialog (not just OS notification) */ MODAL = 0x10000000U, /** Do not prepend error/warning prefix */ MSG_NOPREFIX = 0x20000000U, /** Do not print contents of message to debug log */ SECURE = 0x40000000U, /** Predefined combinations for certain default usage cases */ MSG_INFORMATION = ICON_INFORMATION, MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL), MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL) }; #define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, ...) \ rtype signal_name(__VA_ARGS__); \ using signal_name##Sig = rtype(__VA_ARGS__); \ boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn); /** Show message box. */ ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string& message, const std::string& caption, unsigned int style); /** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */ ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style); /** Progress message during initialization. */ ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message); /** Number of network connections changed. */ ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections); /** Network activity state changed. */ ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive); /** * Status bar alerts changed. */ ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, ); /** * Show progress e.g. for verifychain. * resume_possible indicates shutting down now will result in the current progress action resuming upon restart. */ ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible); /** New block has been accepted */ ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*); /** Best header has changed */ ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, bool, const CBlockIndex*); /** Banlist did change. */ ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void); }; /** Show warning message **/ void InitWarning(const std::string& str); /** Show error message **/ bool InitError(const std::string& str); extern CClientUIInterface uiInterface; #endif // BITCOIN_UI_INTERFACE_H
/* * Copyright © 2007,2014 Intel Corporation * * 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 (including the next * paragraph) 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. * * Authors: * Eric Anholt <eric@anholt.net> * Daniel Vetter <daniel.vetter@ffwll.ch> * */ #ifndef IOCTL_WRAPPERS_H #define IOCTL_WRAPPERS_H #include <stdint.h> #include <stdbool.h> #include <intel_bufmgr.h> #include <i915_drm.h> /* libdrm interfacing */ drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd, const char *name, uint32_t handle); /* ioctl_wrappers.c: * * ioctl wrappers and similar stuff for bare metal testing */ void gem_get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle); void gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride); int __gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride); void gem_set_caching(int fd, uint32_t handle, uint32_t caching); uint32_t gem_get_caching(int fd, uint32_t handle); uint32_t gem_flink(int fd, uint32_t handle); uint32_t gem_open(int fd, uint32_t name); void gem_close(int fd, uint32_t handle); void gem_write(int fd, uint32_t handle, uint32_t offset, const void *buf, uint32_t length); void gem_read(int fd, uint32_t handle, uint32_t offset, void *buf, uint32_t length); void gem_set_domain(int fd, uint32_t handle, uint32_t read_domains, uint32_t write_domain); void gem_sync(int fd, uint32_t handle); uint32_t __gem_create(int fd, int size); uint32_t gem_create(int fd, int size); void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf); void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot); void *gem_mmap__cpu(int fd, uint32_t handle, int offset, int size, int prot); bool gem_mmap__has_wc(int fd); void *gem_mmap__wc(int fd, uint32_t handle, int offset, int size, int prot); #define igt_require_mmap_wc(x) igt_require(gem_mmap__has_wc(x)) /** * gem_mmap: * * This is a simple convenience alias to gem_mmap__gtt() */ #define gem_mmap gem_mmap__gtt int gem_madvise(int fd, uint32_t handle, int state); uint32_t gem_context_create(int fd); void gem_sw_finish(int fd, uint32_t handle); bool gem_bo_busy(int fd, uint32_t handle); /* feature test helpers */ bool gem_has_llc(int fd); int gem_get_num_rings(int fd); bool gem_has_enable_ring(int fd,int param); bool gem_has_bsd(int fd); bool gem_has_blt(int fd); bool gem_has_vebox(int fd); bool gem_has_bsd2(int fd); bool gem_uses_aliasing_ppgtt(int fd); int gem_available_fences(int fd); uint64_t gem_available_aperture_size(int fd); uint64_t gem_aperture_size(int fd); uint64_t gem_mappable_aperture_size(void); /* check functions which auto-skip tests by calling igt_skip() */ void gem_require_caching(int fd); void gem_require_ring(int fd, int ring_id); /* prime */ int prime_handle_to_fd(int fd, uint32_t handle); uint32_t prime_fd_to_handle(int fd, int dma_buf_fd); off_t prime_get_size(int dma_buf_fd); struct local_i915_gem_context_param { uint32_t context; uint32_t size; uint64_t param; #define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1 uint64_t value; }; int gem_context_has_param(int fd, uint64_t param); int gem_context_get_param(int fd, struct local_i915_gem_context_param *p); int gem_context_set_param(int fd, struct local_i915_gem_context_param *p); #endif /* IOCTL_WRAPPERS_H */
/* * Copyright 2008-2012 NVIDIA Corporation. All rights reserved. * * NOTICE TO USER: * * This source code is subject to NVIDIA ownership rights under U.S. and * international Copyright laws. Users and possessors of this source code * are hereby granted a nonexclusive, royalty-free license to use this code * in individual and commercial software. * * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOURCE CODE. * * U.S. Government End Users. This source code is a "commercial item" as * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of * "commercial computer software" and "commercial computer software * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) * and is provided to the U.S. Government only as a commercial end item. * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the * source code with only those rights set forth herein. * * Any use of this source code in individual and commercial software must * include, in the user documentation and internal comments to the code, * the above Disclaimer and U.S. Government End Users Notice. */ #ifndef GXL_RENDERER_MESH_H #define GXL_RENDERER_MESH_H #include <RendererConfig.h> #if defined(RENDERER_ENABLE_LIBGXM) #include <RendererMesh.h> #include "GXMRenderer.h" namespace SampleRenderer { class GXMRendererMesh : public RendererMesh { public: GXMRendererMesh(GXMRenderer &renderer, const RendererMeshDesc &desc); virtual ~GXMRendererMesh(void); virtual bool willRender() const; public: virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat) const; virtual void renderVertices(PxU32 numVertices) const; virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; virtual void renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const; private: void operator=(const GXMRendererMesh &){} void InitVertexRenderer(); private: GXMRenderer &m_renderer; void* mRendererIndexBuffer; mutable PxU16 mCurrentRendererIndexBufferSize; PxU16 mMaxVerts; SceUID mRendererIndexBufferUid; }; } // namespace SampleRenderer #endif // #if defined(RENDERER_ENABLE_LIBGXM) #endif
#include <stdio.h> int _write(int file, char *ptr, int len) { int i; if(file == 1) { for(i = 0; i < len; i++) fputc(ptr[i], stdout); } else if(file == 2) { for(i = 0; i < len; i++) fputc(ptr[i], stderr); } return len; }
/* Copyright (c) 2013, Kamil Jaworski, Polidea All rights reserved. mailto: kamil.jaworski@gmail.com Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Polidea 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 KAMIL JAWORSKI, POLIDEA ''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 KAMIL JAWORSKI, POLIDEA BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Foundation/Foundation.h> typedef NS_ENUM(NSInteger, PLAtomType){ // [[ stringData ]] PLAtomTypeEndOfInput, // nil PLAtomTypeError, // error message PLAtomTypePlus, // '+' PLAtomTypeMinus, // '-' PLAtomTypeAsterisk, // '*' PLAtomTypeFloatingPointNumber, // number as string (f.e. '23.45', '23', '56.') PLAtomTypeRelationEqual, // '==' PLAtomTypeRelationLessOrEqual, // '<=' PLAtomTypeRelationGreaterOrEqual, // '>=' PLAtomTypeIdentifier, // identifier as string (f.e. 'myControl') PLAtomTypeDot, // '.' PLAtomTypeWhitespace // read whitespaces (f.e. ' ') }; @interface PLAttributeConstraintVisualFormatAtom : NSObject @property(nonatomic, readonly) PLAtomType atomType; @property(nonatomic, readonly) NSString *stringData; @property(nonatomic, readonly) NSUInteger startIndex; + (NSString *)atomNameForAtomType:(PLAtomType)type; - (id)initWithAtomType:(PLAtomType)atomType stringData:(NSString *)stringData startIndex:(NSUInteger)startIndex; + (id)atomWithType:(PLAtomType)atomType stringData:(NSString *)stringData startIndex:(NSUInteger)startIndex; @end
// This file was generated based on 'C:\ProgramData\Uno\Packages\FuseCore\0.19.3\Input\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Input.PointerEventArgs.h> namespace g{namespace Fuse{namespace Input{struct CustomPointerEventArgs;}}} namespace g{namespace Fuse{struct Node;}} namespace g{ namespace Fuse{ namespace Input{ // public abstract class CustomPointerEventArgs :750 // { uType* CustomPointerEventArgs_typeof(); void CustomPointerEventArgs__ctor_3_fn(CustomPointerEventArgs* __this, ::g::Fuse::Input::PointerEventArgs* args, ::g::Fuse::Node* node); struct CustomPointerEventArgs : ::g::Fuse::Input::PointerEventArgs { void ctor_3(::g::Fuse::Input::PointerEventArgs* args, ::g::Fuse::Node* node); }; // } }}} // ::g::Fuse::Input
#ifdef HAVE_CONFIG_H #include "../ext_config.h" #endif #include <php.h> #include "../php_ext.h" #include "../ext.h" #include <Zend/zend_operators.h> #include <Zend/zend_exceptions.h> #include <Zend/zend_interfaces.h> #include "kernel/main.h" #include "kernel/memory.h" #include "kernel/array.h" #include "kernel/object.h" ZEPHIR_INIT_CLASS(Stub_ArrayIterator) { ZEPHIR_REGISTER_CLASS(Stub, ArrayIterator, stub, arrayiterator, stub_arrayiterator_method_entry, 0); zend_declare_property_long(stub_arrayiterator_ce, SL("position"), 0, ZEND_ACC_PROTECTED); zend_declare_property_null(stub_arrayiterator_ce, SL("test"), ZEND_ACC_PROTECTED); zend_class_implements(stub_arrayiterator_ce, 1, zend_ce_iterator); return SUCCESS; } PHP_METHOD(Stub_ArrayIterator, __construct) { zval _1, _2; zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "one"); zephir_array_fast_append(&_0, &_1); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "two"); zephir_array_fast_append(&_0, &_1); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "three"); zephir_array_fast_append(&_0, &_1); zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); ZEPHIR_INIT_ZVAL_NREF(_2); ZVAL_LONG(&_2, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("position"), &_2); ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayIterator, rewind) { zval _0; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZEPHIR_INIT_ZVAL_NREF(_0); ZVAL_LONG(&_0, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("position"), &_0); } PHP_METHOD(Stub_ArrayIterator, current) { zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); ZEPHIR_OBS_VAR(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("position"), PH_NOISY_CC); zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "stub/arrayiterator.zep", 25); RETURN_CTOR(&_1); } PHP_METHOD(Stub_ArrayIterator, key) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "position"); } PHP_METHOD(Stub_ArrayIterator, next) { zval *this_ptr = getThis(); RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); } PHP_METHOD(Stub_ArrayIterator, valid) { zval _0, _1; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("position"), PH_NOISY_CC | PH_READONLY); RETURN_BOOL(zephir_array_isset(&_0, &_1)); }
/* strtoimax( const char *, char * *, int ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. */ #include <limits.h> #include <inttypes.h> #ifndef REGTEST #include <stddef.h> intmax_t strtoimax( const char * _PDCLIB_restrict nptr, char ** _PDCLIB_restrict endptr, int base ) { intmax_t rc; char sign = '+'; const char * p = _PDCLIB_strtox_prelim( nptr, &sign, &base ); if ( base < 2 || base > 36 ) return 0; if ( sign == '+' ) { rc = (intmax_t)_PDCLIB_strtox_main( &p, (unsigned)base, (uintmax_t)INTMAX_MAX, (uintmax_t)( INTMAX_MAX / base ), (int)( INTMAX_MAX % base ), &sign ); } else { rc = (intmax_t)_PDCLIB_strtox_main( &p, (unsigned)base, (uintmax_t)INTMAX_MIN, (uintmax_t)( INTMAX_MIN / -base ), (int)( -( INTMAX_MIN % base ) ), &sign ); } if ( endptr != NULL ) *endptr = ( p != NULL ) ? (char *) p : (char *) nptr; return ( sign == '+' ) ? rc : -rc; } #endif #ifdef TEST #include "_PDCLIB_test.h" #include <errno.h> int main( void ) { char * endptr; /* this, to base 36, overflows even a 256 bit integer */ char overflow[] = "-ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ_"; /* tricky border case */ char tricky[] = "+0xz"; errno = 0; /* basic functionality */ TESTCASE( strtoimax( "123", NULL, 10 ) == 123 ); /* proper detecting of default base 10 */ TESTCASE( strtoimax( "456", NULL, 0 ) == 456 ); /* proper functioning to smaller base */ TESTCASE( strtoimax( "14", NULL, 8 ) == 12 ); /* proper autodetecting of octal */ TESTCASE( strtoimax( "016", NULL, 0 ) == 14 ); /* proper autodetecting of hexadecimal, lowercase 'x' */ TESTCASE( strtoimax( "0xFF", NULL, 0 ) == 255 ); /* proper autodetecting of hexadecimal, uppercase 'X' */ TESTCASE( strtoimax( "0Xa1", NULL, 0 ) == 161 ); /* proper handling of border case: 0x followed by non-hexdigit */ TESTCASE( strtoimax( tricky, &endptr, 0 ) == 0 ); TESTCASE( endptr == tricky + 2 ); /* proper handling of border case: 0 followed by non-octdigit */ TESTCASE( strtoimax( tricky, &endptr, 8 ) == 0 ); TESTCASE( endptr == tricky + 2 ); /* errno should still be 0 */ TESTCASE( errno == 0 ); /* overflowing subject sequence must still return proper endptr */ TESTCASE( strtoimax( overflow, &endptr, 36 ) == INTMAX_MIN ); TESTCASE( errno == ERANGE ); TESTCASE( ( endptr - overflow ) == 53 ); /* same for positive */ errno = 0; TESTCASE( strtoimax( overflow + 1, &endptr, 36 ) == INTMAX_MAX ); TESTCASE( errno == ERANGE ); TESTCASE( ( endptr - overflow ) == 53 ); /* testing skipping of leading whitespace */ TESTCASE( strtoimax( " \n\v\t\f789", NULL, 0 ) == 789 ); /* testing conversion failure */ TESTCASE( strtoimax( overflow, &endptr, 10 ) == 0 ); TESTCASE( endptr == overflow ); endptr = NULL; TESTCASE( strtoimax( overflow, &endptr, 0 ) == 0 ); TESTCASE( endptr == overflow ); /* These tests assume two-complement, but conversion should work for */ /* one-complement and signed magnitude just as well. Anyone having a */ /* platform to test this on? */ errno = 0; #if INTMAX_MAX >> 62 == 1 /* testing "odd" overflow, i.e. base is not a power of two */ TESTCASE( strtoimax( "9223372036854775807", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "9223372036854775808", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == ERANGE ); errno = 0; TESTCASE( strtoimax( "-9223372036854775807", NULL, 0 ) == (INTMAX_MIN + 1) ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-9223372036854775808", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-9223372036854775809", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == ERANGE ); /* testing "even" overflow, i.e. base is power of two */ errno = 0; TESTCASE( strtoimax( "0x7fffffffffffffff", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "0x8000000000000000", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == ERANGE ); errno = 0; TESTCASE( strtoimax( "-0x7fffffffffffffff", NULL, 0 ) == (INTMAX_MIN + 1) ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-0x8000000000000000", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-0x8000000000000001", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == ERANGE ); #elif LLONG_MAX >> 126 == 1 /* testing "odd" overflow, i.e. base is not a power of two */ TESTCASE( strtoimax( "170141183460469231731687303715884105728", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "170141183460469231731687303715884105729", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == ERANGE ); errno = 0; TESTCASE( strtoimax( "-170141183460469231731687303715884105728", NULL, 0 ) == (INTMAX_MIN + 1) ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-170141183460469231731687303715884105729", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-170141183460469231731687303715884105730", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == ERANGE ); /* testing "even" overflow, i.e. base is power of two */ errno = 0; TESTCASE( strtoimax( "0x7fffffffffffffffffffffffffffffff", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "0x80000000000000000000000000000000", NULL, 0 ) == INTMAX_MAX ); TESTCASE( errno == ERANGE ); errno = 0; TESTCASE( strtoimax( "-0x7fffffffffffffffffffffffffffffff", NULL, 0 ) == (INTMAX_MIN + 1) ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-0x80000000000000000000000000000000", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == 0 ); TESTCASE( strtoimax( "-0x80000000000000000000000000000001", NULL, 0 ) == INTMAX_MIN ); TESTCASE( errno == ERANGE ); #else #error Unsupported width of 'intmax_t' (neither 64 nor 128 bit). #endif return TEST_RESULTS; } #endif
/** * \file * * \brief Version file of SAM4 Bootloader application for ATMEL PRIME * Service Node * * Copyright (c) 2014 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ /** * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> */ #define PRBO_VERSION "ATMBOOTSAM400000000000"
/////////////////////////////////////////////////////////////////////////////// // // mSIGNA // // rawtxdialog.h // // Copyright (c) 2013-2014 Eric Lombrozo // Copyright (c) 2011-2016 Ciphrex Corp. // // Distributed under the MIT software license, see the accompanying // file LICENSE or http://www.opensource.org/licenses/mit-license.php. // #pragma once class QTextEdit; #include <QDialog> #include <CoinQ/CoinQ_typedefs.h> class RawTxDialog : public QDialog { Q_OBJECT public: RawTxDialog(const QString& prompt, QWidget* parent = NULL); bytes_t getRawTx() const; void setRawTx(const bytes_t& rawTx); private: QTextEdit* rawTxEdit; };
/*! @file VersionInfo.h VersionInfo class * */ #ifndef VERSIONINFO_H #define VERSIONINFO_H #include "eirBase_global.h" #include <QDate> #include <QString> #include "Property.h" #define SETVERSION() setVersion(VersionInfo(VER_MAJOR, VER_MINOR, \ VER_BRANCH, VER_RELEASE, \ VER_STRING, VER_COPYRIGHT, \ VER_ORGNAME, VER_APPNAME)) // stupid preprocessor tricks follow #define DEFSTRING2(PDEF) #PDEF #define DEFSTRING(DEF) DEFSTRING2(DEF) #define VERSIONINFO_PROPERTIES(TND) \ TND(QString, String, QString()) \ TND(QString, OrgName, QString()) \ TND(QString, AppName, QString()) \ TND(QString, Copyright, QString()) \ TND(quint8, Major, 0) \ TND(quint8, Minor, 0) \ TND(quint8, Branch, 0) \ TND(quint8, Release, 0) \ class EIRBASESHARED_EXPORT VersionInfo { DECLARE_PROPERTIES(VERSIONINFO_PROPERTIES); public: VersionInfo(void); VersionInfo(const unsigned char major, const unsigned char minor, const unsigned char branch, const unsigned char release, const QString & string, const QString & copyright, const QString & orgname, const QString & appname); bool isNull(void) const; void setVersion(const QString & string); void addNotice(const QString & string); void setDateTime(const QString & string); QString toString(const bool withHex=false) const; QString dottedString(void) const; quint32 toDWord(void) const; QString notice(void) const; QStringList noticeList(void) const; QString dateTimeString(void) const; void check(quint32 key) const; private: QString noti_s; QString dt_s; }; #endif // VERSIONINFO_H
// Copyright (c) 2011-2015 The Bitcoin Core developers // Copyright (c) 2015-2017 The Bitcoin Unlimited developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_PEERTABLEMODEL_H #define BITCOIN_QT_PEERTABLEMODEL_H #include "main.h" // For CNodeStateStats #include "net.h" #include <QAbstractTableModel> #include <QStringList> class ClientModel; class PeerTablePriv; QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE struct CNodeCombinedStats { CNodeStats nodeStats; CNodeStateStats nodeStateStats; bool fNodeStateStatsAvailable; }; class NodeLessThan { public: NodeLessThan(int nColumn, Qt::SortOrder fOrder) : column(nColumn), order(fOrder) {} bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const; private: int column; Qt::SortOrder order; }; /** Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call. Used by the rpc console UI. */ class PeerTableModel : public QAbstractTableModel { Q_OBJECT public: explicit PeerTableModel(ClientModel *parent = 0); ~PeerTableModel(); const CNodeCombinedStats *getNodeStats(int idx); int getRowByNodeId(NodeId nodeid); void startAutoRefresh(); void stopAutoRefresh(); enum ColumnIndex { Address = 0, Subversion = 1, Ping = 2 }; /** @name Methods overridden from QAbstractTableModel @{*/ int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column, const QModelIndex &parent) const; Qt::ItemFlags flags(const QModelIndex &index) const; void sort(int column, Qt::SortOrder order); /*@}*/ public Q_SLOTS: void refresh(); private: ClientModel *clientModel; QStringList columns; std::unique_ptr<PeerTablePriv> priv; QTimer *timer; }; #endif // BITCOIN_QT_PEERTABLEMODEL_H
/***************************************************************************/ /* */ /* t1load.h */ /* */ /* Type 1 font loader (specification). */ /* */ /* Copyright 1996-2001, 2002, 2004, 2006, 2007 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef __T1LOAD_H__ #define __T1LOAD_H__ #include "ft2build.h" #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_MULTIPLE_MASTERS_H #include "t1parse.h" FT_BEGIN_HEADER typedef struct T1_Loader_ { T1_ParserRec parser; /* parser used to read the stream */ FT_Int num_chars; /* number of characters in encoding */ PS_TableRec encoding_table; /* PS_Table used to store the */ /* encoding character names */ FT_Int num_glyphs; PS_TableRec glyph_names; PS_TableRec charstrings; PS_TableRec swap_table; /* For moving .notdef glyph to index 0. */ FT_Int num_subrs; PS_TableRec subrs; FT_Bool fontdata; FT_UInt keywords_encountered; /* T1_LOADER_ENCOUNTERED_XXX */ } T1_LoaderRec, *T1_Loader; /* treatment of some keywords differs depending on whether */ /* they precede or follow certain other keywords */ #define T1_PRIVATE ( 1 << 0 ) #define T1_FONTDIR_AFTER_PRIVATE ( 1 << 1 ) FT_LOCAL( FT_Error ) T1_Open_Face( T1_Face face ); #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT FT_LOCAL( FT_Error ) T1_Get_Multi_Master( T1_Face face, FT_Multi_Master* master ); FT_LOCAL_DEF( FT_Error ) T1_Get_MM_Var( T1_Face face, FT_MM_Var* *master ); FT_LOCAL( FT_Error ) T1_Set_MM_Blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) T1_Set_MM_Design( T1_Face face, FT_UInt num_coords, FT_Long* coords ); FT_LOCAL_DEF( FT_Error ) T1_Set_Var_Design( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( void ) T1_Done_Blend( T1_Face face ); #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ FT_END_HEADER #endif /* __T1LOAD_H__ */ /* END */
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ /***************************************************************************** * name: be_aas_main.h * * desc: AAS * * $Archive: /source/code/botlib/be_aas_main.h $ * *****************************************************************************/ #ifdef AASINTERN extern aas_t aasworld; //AAS error message void QDECL AAS_Error(char* fmt, ...); //set AAS initialized void AAS_SetInitialized(void); //setup AAS with the given number of entities and clients int AAS_Setup(void); //shutdown AAS void AAS_Shutdown(void); //start a new map int AAS_LoadMap(const char* mapname); //start a new time frame int AAS_StartFrame(float time); #endif //AASINTERN //returns true if AAS is initialized int AAS_Initialized(void); //returns true if the AAS file is loaded int AAS_Loaded(void); //returns the model name from the given index char* AAS_ModelFromIndex(int index); //returns the index from the given model name int AAS_IndexFromModel(char* modelname); //returns the current time float AAS_Time(void); // void AAS_ProjectPointOntoVector(vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj);
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the qt3to4 porting application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef CODEMODELWALKER_H #define CODEMODELWALKER_H #include "codemodel.h" QT_BEGIN_NAMESPACE class CodeModelWalker { public: virtual ~CodeModelWalker(){}; virtual void parseScope(CodeModel::Scope *scope); virtual void parseClassScope(CodeModel::ClassScope *){}; virtual void parseNamespaceScope(CodeModel::NamespaceScope *){}; virtual void parseBlockScope(CodeModel::BlockScope *){}; virtual void parseType(CodeModel::Type *type); virtual void parseEnumType(CodeModel::EnumType *){}; virtual void parseClassType(CodeModel::ClassType *){}; virtual void parseUnknownType(CodeModel::UnknownType *){}; virtual void parseBuiltinType(CodeModel::BuiltinType *){}; virtual void parsePointerType(CodeModel::PointerType *){}; virtual void parseReferenceType(CodeModel::ReferenceType *){}; virtual void parseGenericType(CodeModel::GenericType *){}; virtual void parseAliasType(CodeModel::AliasType *){}; virtual void parseMember(CodeModel::Member *member); virtual void parseFunctionMember(CodeModel::FunctionMember *); virtual void parseVariableMember(CodeModel::VariableMember *){}; virtual void parseUsingDeclarationMember(CodeModel::UsingDeclarationMember *){}; virtual void parseTypeMember(CodeModel::TypeMember *){}; virtual void parseArgument(CodeModel::Argument *){}; virtual void parseNameUse(CodeModel::NameUse *){}; }; QT_END_NAMESPACE #endif
/* Multi Timer v3.4 http://matthewtole.com/pebble/multi-timer/ ---------------------- The MIT License (MIT) Copyright © 2013 - 2015 Matthew Tole 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. -------------------- src/windows/win-main.h */ #include <pebble.h> void win_main_init(void); void win_main_show(void);
#include "reader.h" #include <stdlib.h> #include <stdio.h> #include <math.h> int calcPieceWise(); double calcArraySize(); int getVoltage0Reading(); const int PIECEWISE_ARR_SZ[] = {1, 20, 60, 120, 250, 300, 500, 800, 1200, 2100}; const int PIECEWISE_POT[] = {0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4100}; int getArraySize() { int reading = getVoltage0Reading(); int arraySz = calcArraySize(reading); return arraySz; } int getVoltage0Reading() { // Open file FILE *f = fopen(A2D_FILE_VOLTAGE0, "r"); if (!f) { printf("ERROR: Unable to open voltage input file. Cape loaded?\n"); printf("try: echo BB-ADC > /sys/devices/platform/bone_capemgr/slots\n"); exit(-1); } // Get reading int a2dReading = 0; int itemsRead = fscanf(f, "%d", &a2dReading); if (itemsRead <= 0) { printf("ERROR: Unable to read values from voltage input file.\n"); exit(-1); } // Close file fclose(f); return a2dReading; } int calcPieceWise(int value, int max, int min) { double a = (double) PIECEWISE_POT[min]; double b = (double) PIECEWISE_POT[max]; double m = (double) PIECEWISE_ARR_SZ[min]; double n = (double) PIECEWISE_ARR_SZ[max]; double s = (double) value; return (int) floor(((s - a) / (b - a)) * (n - m) + m); } double calcArraySize(int value) { int max = PIECEWISE_SZ - 1; int mid = floor(max / 2); int min = 0; int found = 1; while (found) { int potVal = PIECEWISE_POT[mid]; if (value < potVal) { // lower half max = mid; mid = floor((max - min) / 2) + min; } else if (value > potVal) { // upper half min = mid; mid = floor((max - mid) / 2) + mid; } else { // exactly the potVal max = mid; } // find 2 adjacent points int difference = max - min; if (difference == 1) { found = 0; } // ...work } return calcPieceWise(value, max, min); }
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ /***************************************************************************** * name: be_aas_reach.h * * desc: AAS * * $Archive: /source/code/botlib/be_aas_reach.h $ * *****************************************************************************/ #ifdef AASINTERN //initialize calculating the reachabilities void AAS_InitReachability(void); //continue calculating the reachabilities int AAS_ContinueInitReachability(float time); // int AAS_BestReachableLinkArea(aas_link_t* areas); #endif //AASINTERN //returns true if the are has reachabilities to other areas int AAS_AreaReachability(int areanum); //returns the best reachable area and goal origin for a bounding box at the given origin int AAS_BestReachableArea(vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalorigin); //returns the best jumppad area from which the bbox at origin is reachable int AAS_BestReachableFromJumpPadArea(vec3_t origin, vec3_t mins, vec3_t maxs); //returns the next reachability using the given model int AAS_NextModelReachability(int num, int modelnum); //returns the total area of the ground faces of the given area float AAS_AreaGroundFaceArea(int areanum); //returns true if the area is crouch only int AAS_AreaCrouch(int areanum); //returns true if a player can swim in this area int AAS_AreaSwim(int areanum); //returns true if the area is filled with a liquid int AAS_AreaLiquid(int areanum); //returns true if the area contains lava int AAS_AreaLava(int areanum); //returns true if the area contains slime int AAS_AreaSlime(int areanum); //returns true if the area has one or more ground faces int AAS_AreaGrounded(int areanum); //returns true if the area has one or more ladder faces int AAS_AreaLadder(int areanum); //returns true if the area is a jump pad int AAS_AreaJumpPad(int areanum); //returns true if the area is donotenter int AAS_AreaDoNotEnter(int areanum);
/************************************************************************* * Copyright (c) 1999, 2009 IBM. * * All rights reserved. This program and the accompanying materials * * are made available under the terms of the Eclipse Public License v1.0 * * which accompanies this distribution, and is available at * * http://www.eclipse.org/legal/epl-v10.html * * * * Contributors: * * IBM - initial API and implementation * ************************************************************************/ union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */ unsigned short int *array; /* array for GETALL, SETALL */ struct seminfo *__buf; /* buffer for IPC_INFO */ };