text
stringlengths
4
6.14k
#include <stdc.h> #include <malloc.h> #include <pool.h> #include <ktest.h> typedef enum { PALLOC_TEST_REGULAR, /* regular test */ PALLOC_TEST_CORRUPTION, /* memory corruption */ PALLOC_TEST_DOUBLEFREE, /* double free */ } palloc_test_t; static void int_ctor(void *buf) { int *num = buf; *num = 0; } static int test_pool_alloc(palloc_test_t flag) { pool_t test; kmem_pool_t *mp = KMEM_POOL("test", 1, 2); kmem_init(mp); int size = 64; pool_init(&test, size, int_ctor, NULL); for (int n = 1; n < 100; n++) { void **item = kmalloc(mp, sizeof(void *) * n, 0); for (int i = 0; i < n; i++) item[i] = pool_alloc(&test, 0); if (flag == PALLOC_TEST_CORRUPTION) { /* WARNING! Following line of code causes memory corruption! */ memset(item[0], 0, 100); } for (int i = 0; i < n; i++) pool_free(&test, item[i]); if (flag == PALLOC_TEST_DOUBLEFREE) { /* WARNING! This will obviously crash kernel due to double free! */ pool_free(&test, item[n / 2]); } kfree(mp, item); } pool_destroy(&test); #if 0 /* WARNING! This will obviously crash the program due to double free, * uncomment at your own risk! */ pool_destroy(&test); #endif kmem_destroy(mp); return KTEST_SUCCESS; } static int test_pool_alloc_regular(void) { return test_pool_alloc(PALLOC_TEST_REGULAR); } static int test_pool_alloc_corruption(void) { return test_pool_alloc(PALLOC_TEST_CORRUPTION); } static int test_pool_alloc_doublefree(void) { return test_pool_alloc(PALLOC_TEST_DOUBLEFREE); } KTEST_ADD(pool_alloc_regular, test_pool_alloc_regular, 0); KTEST_ADD(pool_alloc_corruption, test_pool_alloc_corruption, KTEST_FLAG_BROKEN); KTEST_ADD(pool_alloc_doublefree, test_pool_alloc_doublefree, KTEST_FLAG_BROKEN);
#ifndef ELFTYPES_H #define ELFTYPES_H /** \file ElfTypes.h * \brief This file contains the elf format support structures */ #define PACKED __attribute__((packed)) // Internal elf info typedef struct { char e_ident[4]; char e_class; char endianness; char version; char osAbi; char pad[8]; short e_type; short e_machine; int e_version; int e_entry; int e_phoff; int e_shoff; int e_flags; short e_ehsize; short e_phentsize; short e_phnum; short e_shentsize; short e_shnum; short e_shstrndx; } Elf32_Ehdr; #define EM_SPARC 2 // Sun SPARC #define EM_386 3 // Intel 80386 or higher #define EM_68K 4 // Motorola 68000 #define EM_MIPS 8 // MIPS #define EM_PA_RISC 15 // HP PA-RISC #define EM_SPARC32PLUS 18 // Sun SPARC 32+ #define EM_PPC 20 // PowerPC #define EM_X86_64 62 #define EM_ST20 0xa8 // ST20 (made up... there is no official value?) #define ET_DYN 3 // Elf type (dynamic library) enum ElfRelocKind { R_386_32 = 1, R_386_PC32 = 2, R_386_GOT32 = 3, R_386_PLT32 = 4, R_386_COPY = 5, R_386_GLOB_DAT = 6, R_386_JUMP_SLOT = 7, R_386_RELATIVE = 8, R_386_GOTOFF = 9, R_386_GOTPC = 10 }; #define R_SPARC_NONE 0 #define R_SPARC_8 1 #define R_SPARC_16 2 #define R_SPARC_32 3 #define R_SPARC_DISP8 4 #define R_SPARC_DISP16 5 #define R_SPARC_DISP32 6 #define R_SPARC_WDISP30 7 #define R_SPARC_WDISP22 8 #define R_SPARC_HI22 9 #define R_SPARC_22 10 #define R_SPARC_13 11 #define R_SPARC_LO10 12 #define R_SPARC_GOT10 13 #define R_SPARC_GOT13 14 #define R_SPARC_GOT22 15 #define R_SPARC_PC10 16 #define R_SPARC_PC22 17 #define R_SPARC_WPLT30 18 #define R_SPARC_COPY 19 #define R_SPARC_GLOB_DAT 20 #define R_SPARC_JMP_SLOT 21 #define R_SPARC_RELATIVE 22 #define R_SPARC_UA32 23 #define R_SPARC_PLT32 24 #define R_SPARC_HIPLT22 25 #define R_SPARC_LOPLT10 26 #define R_SPARC_PCPLT32 27 #define R_SPARC_PCPLT22 28 #define R_SPARC_PCPLT10 29 #define R_SPARC_10 30 #define R_SPARC_11 31 #define R_SPARC_64 32 #define R_SPARC_OLO10 33 #define R_SPARC_HH22 34 #define R_SPARC_HM10 35 #define R_SPARC_LM22 36 #define R_SPARC_PC_HH22 37 #define R_SPARC_PC_HM10 38 #define R_SPARC_PC_LM22 39 #define R_SPARC_WDISP16 40 #define R_SPARC_WDISP19 41 #define R_SPARC_GLOB_JMP 42 #define R_SPARC_7 43 #define R_SPARC_5 44 #define R_SPARC_6 45 #define R_SPARC_DISP64 46 #define R_SPARC_PLT64 47 #define R_SPARC_HIX22 48 #define R_SPARC_LOX10 49 #define R_SPARC_H44 50 #define R_SPARC_M44 51 #define R_SPARC_L44 52 #define R_SPARC_REGISTER 53 #define R_SPARC_UA64 54 #define R_SPARC_UA16 55 // Program header struct Elf32_Phdr { int p_type; /* entry type */ int p_offset; /* file offset */ int p_vaddr; /* virtual address */ int p_paddr; /* physical address */ int p_filesz; /* file size */ int p_memsz; /* memory size */ int p_flags; /* entry flags */ int p_align; /* memory/file alignment */ }; // Section header struct Elf32_Shdr { int sh_name; int sh_type; int sh_flags; int sh_addr; int sh_offset; int sh_size; int sh_link; int sh_info; int sh_addralign; int sh_entsize; }; #define SHF_WRITE 1 // Writeable #define SHF_ALLOC 2 // Consumes memory in exe #define SHF_EXECINSTR 4 // Executable enum ElfSectionTypes { SHT_NULL = 0, SHT_PROGBITS = 1, SHT_SYMTAB = 2, // Symbol table SHT_RELA = 4, // Relocation table (with addend, e.g. RISC) SHT_NOBITS = 8, // Bss SHT_REL = 9, // Relocation table (no addend) SHT_DYNSYM = 11 // Dynamic symbol table }; struct Elf32_Sym { int st_name; unsigned st_value; int st_size; unsigned char st_info; unsigned char st_other; short st_shndx; } PACKED; struct Elf32_Rel { unsigned r_offset; int r_info; }; struct Elf32_Rela { unsigned r_offset; int r_info; int r_addend; }; #define ELF32_R_SYM(info) ((info) >> 8) #define ELF32_ST_BIND(i) ((ElfSymBinding)((i) >> 4)) #define ELF32_ST_TYPE(i) ((ElfSymType)((i)&0xf)) #define ELF32_ST_INFO(b, t) (((b) << 4) + ((t)&0xf)) #define ELF32_ST_VISIBILITY(o) ((ElfSymVisibility)((o)&0x3)) enum ElfSymType { STT_NOTYPE = 0, // Symbol table type: none STT_OBJECT = 1, STT_FUNC = 2, // Symbol table type: function STT_SECTION = 3, STT_FILE = 4, STT_COMMON = 5 }; enum ElfSymBinding { STB_LOCAL = 0, STB_GLOBAL = 1, STB_WEAK = 2 }; enum ElfSymVisibility { STV_DEFAULT = 0, STV_INTERNAL = 1, STV_HIDDEN = 2, STV_PROTECTED = 3 }; typedef struct { short d_tag; /* how to interpret value */ union { int d_val; int d_ptr; int d_off; } d_un; } Elf32_Dyn; // Tag values #define DT_NULL 0 // Last entry in list #define DT_STRTAB 5 // String table #define DT_NEEDED 1 // A needed link-type object #define E_REL 1 // Relocatable file type #endif // ELFTYPES_H
/* This file is part of the YAZ toolkit. * Copyright (C) Index Data * See the file LICENSE for details. */ /** * \file timing.c * \brief Timing utilities */ #if HAVE_CONFIG_H #include <config.h> #endif #ifdef WIN32 #include <windows.h> #endif #include <stdlib.h> #if HAVE_SYS_TIMES_H #include <sys/times.h> #endif #if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> #include <yaz/xmalloc.h> #include <yaz/timing.h> struct yaz_timing { #if HAVE_SYS_TIMES_H struct tms tms1, tms2; #endif #if HAVE_SYS_TIME_H struct timeval start_time, end_time; #else #ifdef WIN32 LONGLONG start_time, end_time; LONGLONG start_time_sys, start_time_user; LONGLONG end_time_sys, end_time_user; #endif #endif double real_sec, user_sec, sys_sec; }; yaz_timing_t yaz_timing_create(void) { yaz_timing_t t = (yaz_timing_t) xmalloc(sizeof(*t)); yaz_timing_start(t); return t; } #ifdef WIN32 static void get_process_time(ULONGLONG *lp_user, ULONGLONG *lp_sys) { FILETIME create_t, exit_t, sys_t, user_t; ULARGE_INTEGER li; GetProcessTimes(GetCurrentProcess(), &create_t, &exit_t, &sys_t, &user_t); li.LowPart = user_t.dwLowDateTime; li.HighPart = user_t.dwHighDateTime; *lp_user = li.QuadPart; li.LowPart = sys_t.dwLowDateTime; li.HighPart = sys_t.dwHighDateTime; *lp_sys = li.QuadPart; } static void get_date_as_largeinteger(LONGLONG *lp) { FILETIME f; ULARGE_INTEGER li; GetSystemTimeAsFileTime(&f); li.LowPart = f.dwLowDateTime; li.HighPart = f.dwHighDateTime; *lp = li.QuadPart; } #endif void yaz_timing_start(yaz_timing_t t) { #if HAVE_SYS_TIMES_H times(&t->tms1); t->user_sec = 0.0; t->sys_sec = 0.0; #else t->user_sec = -1.0; t->sys_sec = -1.0; #endif t->real_sec = -1.0; #if HAVE_SYS_TIME_H gettimeofday(&t->start_time, 0); t->real_sec = 0.0; #else #ifdef WIN32 t->real_sec = 0.0; t->user_sec = 0.0; t->sys_sec = 0.0; get_date_as_largeinteger(&t->start_time); get_process_time(&t->start_time_user, &t->start_time_sys); #endif #endif } void yaz_timing_stop(yaz_timing_t t) { #if HAVE_SYS_TIMES_H times(&t->tms2); t->user_sec = (double) (t->tms2.tms_utime - t->tms1.tms_utime)/100; t->sys_sec = (double) (t->tms2.tms_stime - t->tms1.tms_stime)/100; #endif #if HAVE_SYS_TIME_H gettimeofday(&t->end_time, 0); t->real_sec = ((t->end_time.tv_sec - t->start_time.tv_sec) * 1000000.0 + t->end_time.tv_usec - t->start_time.tv_usec) / 1000000; #else #ifdef WIN32 get_date_as_largeinteger(&t->end_time); t->real_sec = (t->end_time - t->start_time) / 10000000.0; get_process_time(&t->end_time_user, &t->end_time_sys); t->user_sec = (t->end_time_user - t->start_time_user) / 10000000.0; t->sys_sec = (t->end_time_sys - t->start_time_sys) / 10000000.0; #endif #endif } double yaz_timing_get_real(yaz_timing_t t) { return t->real_sec; } double yaz_timing_get_user(yaz_timing_t t) { return t->user_sec; } double yaz_timing_get_sys(yaz_timing_t t) { return t->sys_sec; } void yaz_timing_destroy(yaz_timing_t *tp) { if (*tp) { xfree(*tp); *tp = 0; } } /* * Local variables: * c-basic-offset: 4 * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab */
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __itkLocalVariationImageFilter_h #define __itkLocalVariationImageFilter_h #include "itkImageToImageFilter.h" #include "itkImage.h" namespace itk { template<class TPixelType> class SquaredEuclideanMetric { public: static double Calc(TPixelType p); }; /** \class LocalVariationImageFilter * \brief Calculates the local variation in each pixel * * Reference: Tony F. Chan et al., The digital TV filter and nonlinear denoising * * \sa Image * \sa Neighborhood * \sa NeighborhoodOperator * \sa NeighborhoodIterator * * \ingroup IntensityImageFilters */ template <class TInputImage, class TOutputImage> class LocalVariationImageFilter : public ImageToImageFilter< TInputImage, TOutputImage > { public: /** Extract dimension from input and output image. */ itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); /** Convenient typedefs for simplifying declarations. */ typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; /** Standard class typedefs. */ typedef LocalVariationImageFilter Self; typedef ImageToImageFilter< InputImageType, OutputImageType> Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(LocalVariationImageFilter, ImageToImageFilter); /** Image typedef support. */ typedef typename InputImageType::PixelType InputPixelType; typedef typename OutputImageType::PixelType OutputPixelType; typedef typename InputImageType::RegionType InputImageRegionType; typedef typename OutputImageType::RegionType OutputImageRegionType; typedef typename InputImageType::SizeType InputSizeType; /** MedianImageFilter needs a larger input requested region than * the output requested region. As such, MedianImageFilter needs * to provide an implementation for GenerateInputRequestedRegion() * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError); protected: LocalVariationImageFilter(); virtual ~LocalVariationImageFilter() {} void PrintSelf(std::ostream& os, Indent indent) const; /** MedianImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() * routine which is called for each processing thread. The output * image data is allocated automatically by the superclass prior to * calling ThreadedGenerateData(). ThreadedGenerateData can only * write to the portion of the output image specified by the * parameter "outputRegionForThread" * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ); private: LocalVariationImageFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkLocalVariationImageFilter.txx" #endif #endif //LocalVariationImageFilter
/* * Written by J.T. Conklin <jtc@NetBSD.org>. * Public domain. */ #if 0 #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: l64a.c,v 1.13 2003/07/26 19:24:54 salo Exp $"); #endif /* not lint */ #endif #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <stdlib.h> #define ADOT 46 /* ASCII '.' */ #define ASLASH ADOT + 1 /* ASCII '/' */ #define A0 48 /* ASCII '0' */ #define AA 65 /* ASCII 'A' */ #define Aa 97 /* ASCII 'a' */ char * l64a(long value) { static char buf[8]; (void)l64a_r(value, buf, sizeof(buf)); return (buf); } int l64a_r(long value, char *buffer, int buflen) { long v; int digit; v = value & (long)0xffffffff; for (; v != 0 && buflen > 1; buffer++, buflen--) { digit = v & 0x3f; if (digit < 2) *buffer = digit + ADOT; else if (digit < 12) *buffer = digit + A0 - 2; else if (digit < 38) *buffer = digit + AA - 12; else *buffer = digit + Aa - 38; v >>= 6; } return (v == 0 ? 0 : -1); }
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/tinderbox/XR-Trunk/WINNT_5.2_Depend/mozilla/dom/public/idl/xul/nsIDOMXULImageElement.idl */ #ifndef __gen_nsIDOMXULImageElement_h__ #define __gen_nsIDOMXULImageElement_h__ #ifndef __gen_nsIDOMElement_h__ #include "nsIDOMElement.h" #endif #ifndef __gen_nsIDOMXULElement_h__ #include "nsIDOMXULElement.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif /* starting interface: nsIDOMXULImageElement */ #define NS_IDOMXULIMAGEELEMENT_IID_STR "f73f4d77-a6fb-4ab5-b41e-15045a0cc6ff" #define NS_IDOMXULIMAGEELEMENT_IID \ {0xf73f4d77, 0xa6fb, 0x4ab5, \ { 0xb4, 0x1e, 0x15, 0x04, 0x5a, 0x0c, 0xc6, 0xff }} class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMXULImageElement : public nsIDOMXULElement { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMXULIMAGEELEMENT_IID) /* attribute DOMString src; */ NS_SCRIPTABLE NS_IMETHOD GetSrc(nsAString & aSrc) = 0; NS_SCRIPTABLE NS_IMETHOD SetSrc(const nsAString & aSrc) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMXULImageElement, NS_IDOMXULIMAGEELEMENT_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSIDOMXULIMAGEELEMENT \ NS_SCRIPTABLE NS_IMETHOD GetSrc(nsAString & aSrc); \ NS_SCRIPTABLE NS_IMETHOD SetSrc(const nsAString & aSrc); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSIDOMXULIMAGEELEMENT(_to) \ NS_SCRIPTABLE NS_IMETHOD GetSrc(nsAString & aSrc) { return _to GetSrc(aSrc); } \ NS_SCRIPTABLE NS_IMETHOD SetSrc(const nsAString & aSrc) { return _to SetSrc(aSrc); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSIDOMXULIMAGEELEMENT(_to) \ NS_SCRIPTABLE NS_IMETHOD GetSrc(nsAString & aSrc) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSrc(aSrc); } \ NS_SCRIPTABLE NS_IMETHOD SetSrc(const nsAString & aSrc) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetSrc(aSrc); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsDOMXULImageElement : public nsIDOMXULImageElement { public: NS_DECL_ISUPPORTS NS_DECL_NSIDOMXULIMAGEELEMENT nsDOMXULImageElement(); private: ~nsDOMXULImageElement(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsDOMXULImageElement, nsIDOMXULImageElement) nsDOMXULImageElement::nsDOMXULImageElement() { /* member initializers and constructor code */ } nsDOMXULImageElement::~nsDOMXULImageElement() { /* destructor code */ } /* attribute DOMString src; */ NS_IMETHODIMP nsDOMXULImageElement::GetSrc(nsAString & aSrc) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsDOMXULImageElement::SetSrc(const nsAString & aSrc) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIDOMXULImageElement_h__ */
/* crypto/evp/m_mdc2.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include <stdio.h> #include "cryptlib.h" #include "evp_locl.h" #ifndef OPENSSL_NO_MDC2 # include <openssl/evp.h> # include <openssl/objects.h> # include <openssl/x509.h> # include <openssl/mdc2.h> # include <openssl/rsa.h> static int init(EVP_MD_CTX *ctx) { return MDC2_Init(ctx->md_data); } static int update(EVP_MD_CTX *ctx, const void *data, size_t count) { return MDC2_Update(ctx->md_data, data, count); } static int final(EVP_MD_CTX *ctx, unsigned char *md) { return MDC2_Final(md, ctx->md_data); } static const EVP_MD mdc2_md = { NID_mdc2, NID_mdc2WithRSA, MDC2_DIGEST_LENGTH, 0, init, update, final, NULL, NULL, EVP_PKEY_RSA_ASN1_OCTET_STRING_method, MDC2_BLOCK, sizeof(EVP_MD *) + sizeof(MDC2_CTX), }; const EVP_MD *EVP_mdc2(void) { return (&mdc2_md); } #endif
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban // ============================================================================= // // Semi-trailing arm suspension constructed with data from file. // // ============================================================================= #ifndef SEMITRAILINGARM_H #define SEMITRAILINGARM_H #include "chrono_vehicle/ChApiVehicle.h" #include "chrono_vehicle/wheeled_vehicle/suspension/ChSemiTrailingArm.h" #include "chrono_thirdparty/rapidjson/document.h" namespace chrono { namespace vehicle { /// @addtogroup vehicle_wheeled_suspension /// @{ /// Semi-trailing arm suspension constructed with data from file. class CH_VEHICLE_API SemiTrailingArm : public ChSemiTrailingArm { public: SemiTrailingArm(const std::string& filename); SemiTrailingArm(const rapidjson::Document& d); ~SemiTrailingArm(); virtual double getSpindleMass() const override { return m_spindleMass; } virtual double getArmMass() const override { return m_armMass; } virtual double getSpindleRadius() const override { return m_spindleRadius; } virtual double getSpindleWidth() const override { return m_spindleWidth; } virtual double getArmRadius() const override { return m_armRadius; } virtual const ChVector<>& getSpindleInertia() const override { return m_spindleInertia; } virtual const ChVector<>& getArmInertia() const override { return m_armInertia; } virtual double getAxleInertia() const override { return m_axleInertia; } virtual double getSpringRestLength() const override { return m_springRestLength; } virtual ChLinkSpringCB::ForceFunctor* getSpringForceFunctor() const override { return m_springForceCB; } virtual ChLinkSpringCB::ForceFunctor* getShockForceFunctor() const override { return m_shockForceCB; } private: virtual const ChVector<> getLocation(PointId which) override { return m_points[which]; } virtual void Create(const rapidjson::Document& d) override; ChLinkSpringCB::ForceFunctor* m_springForceCB; ChLinkSpringCB::ForceFunctor* m_shockForceCB; ChVector<> m_points[NUM_POINTS]; double m_spindleMass; double m_armMass; double m_spindleRadius; double m_spindleWidth; double m_armRadius; ChVector<> m_spindleInertia; ChVector<> m_armInertia; double m_axleInertia; double m_springRestLength; }; /// @} vehicle_wheeled_suspension } // end namespace vehicle } // end namespace chrono #endif
/* * Copyright (c) 2014, 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. * */ #pragma once #include "proxygen/lib/services/Acceptor.h" #include "proxygen/lib/services/ConnectionCounter.h" #include <list> #include <memory> #include <thrift/lib/cpp/async/TAsyncServerSocket.h> namespace proxygen { class Service; class RequestWorker; /** * ServiceWorker contains all of the per-thread information for a Service. * * ServiceWorker contains a pointer back to the single global Service. * It contains a list of ProxyAcceptor objects for this worker thread, * one per VIP. * * ServiceWorker fits into the Proxygen object hierarchy as follows: * * - Service: one instance (globally across the entire program) * - ServiceWorker: one instance per thread * - ServiceAcceptor: one instance per VIP per thread */ class ServiceWorker { public: ServiceWorker(Service* service, RequestWorker* worker) : service_(service), worker_(worker) { } virtual ~ServiceWorker() {} Service* getService() const { return service_; } void addServiceAcceptor(std::unique_ptr<Acceptor> acceptor) { acceptors_.emplace_back(std::move(acceptor)); } RequestWorker* getRequestWorker() const { return worker_; } const std::list<std::unique_ptr<Acceptor>>& getAcceptors() { return acceptors_; } // Flush any thread-local stats that the service is tracking virtual void flushStats() { } // Destruct all the acceptors void clearAcceptors() { acceptors_.clear(); } IConnectionCounter* getConnectionCounter() { return &connectionCounter_; } virtual void forceStop() {} protected: SimpleConnectionCounter connectionCounter_; private: // Forbidden copy constructor and assignment operator ServiceWorker(ServiceWorker const &) = delete; ServiceWorker& operator=(ServiceWorker const &) = delete; /** * The global Service object. */ Service* service_; /** * The RequestWorker that is actually responsible for running the EventBase * loop in this thread. */ RequestWorker* worker_; /** * A list of the Acceptor objects specific to this worker thread, one * Acceptor per VIP. */ std::list<std::unique_ptr<Acceptor>> acceptors_; }; } // proxygen
#ifndef _MATMULC_ #define _MATMULC_ void MatMulC(int, int, double *, double *, double *); void MatMulCopt(int, int, double *, double *, double *); #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkOutputStream.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkOutputStream - Wraps a binary output stream with a VTK interface. // .SECTION Description // vtkOutputStream provides a VTK-style interface wrapping around a // standard output stream. The access methods are virtual so that // subclasses can transparently provide encoding of the output. Data // lengths for Write calls refer to the length of the data in memory. // The actual length in the stream may differ for subclasses that // implement an encoding scheme. #ifndef vtkOutputStream_h #define vtkOutputStream_h #include "vtkIOCoreModule.h" // For export macro #include "vtkObject.h" class VTKIOCORE_EXPORT vtkOutputStream : public vtkObject { public: vtkTypeMacro(vtkOutputStream,vtkObject); static vtkOutputStream *New(); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Get/Set the real output stream. vtkSetMacro(Stream, ostream*); vtkGetMacro(Stream, ostream*); // Description: // Called after the stream position has been set by the caller, but // before any Write calls. The stream position should not be // adjusted by the caller until after an EndWriting call. virtual int StartWriting(); // Description: // Write output data of the given length. virtual int Write(void const* data, size_t length); // Description: // Called after all desired calls to Write have been made. After // this call, the caller is free to change the position of the // stream. Additional writes should not be done until after another // call to StartWriting. virtual int EndWriting(); protected: vtkOutputStream(); ~vtkOutputStream(); // The real output stream. ostream* Stream; int WriteStream(const char* data, size_t length); private: vtkOutputStream(const vtkOutputStream&) VTK_DELETE_FUNCTION; void operator=(const vtkOutputStream&) VTK_DELETE_FUNCTION; }; #endif
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _QMITKAstrosticksModelParametersWidget_H_INCLUDED #define _QMITKAstrosticksModelParametersWidget_H_INCLUDED //QT headers #include <QWidget> #include <QString> #include "ui_QmitkAstrosticksModelParametersWidgetControls.h" #include <org_mitk_gui_qt_diffusionimaging_fiberfox_Export.h> /** @brief */ class DIFFUSIONIMAGING_FIBERFOX_EXPORT QmitkAstrosticksModelParametersWidget : public QWidget { //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: static const std::string VIEW_ID; QmitkAstrosticksModelParametersWidget (QWidget* parent = nullptr, Qt::WindowFlags f = nullptr); virtual ~QmitkAstrosticksModelParametersWidget(); virtual void CreateQtPartControl(QWidget *parent); void SetT1(double t1){ m_Controls->m_T1box->setValue(t1); } void SetT2(double t2){ m_Controls->m_T2box->setValue(t2); } void SetD(double d){ m_Controls->m_D1box->setValue(d); } void SetRandomizeSticks(bool r){ m_Controls->m_RandomCheck->setChecked(r); } double GetD(){ return m_Controls->m_D1box->value(); } unsigned int GetT2(){ return m_Controls->m_T2box->value(); } unsigned int GetT1(){ return m_Controls->m_T1box->value(); } bool GetRandomizeSticks(){ return m_Controls->m_RandomCheck->isChecked(); } public slots: protected: // member variables Ui::QmitkAstrosticksModelParametersWidgetControls* m_Controls; private: }; #endif // _QMITKAstrosticksModelParametersWidget_H_INCLUDED
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE114_Process_Control__w32_char_relativePath_61a.c Label Definition File: CWE114_Process_Control__w32.label.xml Template File: sources-sink-61a.tmpl.c */ /* * @description * CWE: 114 Process Control * BadSource: relativePath Hard code the relative pathname to the library * GoodSource: Hard code the full pathname to the library * Sinks: * BadSink : Load a dynamic link library * Flow Variant: 61 Data flow: data returned from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #include <windows.h> #ifndef OMITBAD /* bad function declaration */ char * CWE114_Process_Control__w32_char_relativePath_61b_badSource(char * data); void CWE114_Process_Control__w32_char_relativePath_61_bad() { char * data; char dataBuffer[100] = ""; data = dataBuffer; data = CWE114_Process_Control__w32_char_relativePath_61b_badSource(data); { HMODULE hModule; /* POTENTIAL FLAW: If the path to the library is not specified, an attacker may be able to * replace his own file with the intended library */ hModule = LoadLibraryA(data); if (hModule != NULL) { FreeLibrary(hModule); printLine("Library loaded and freed successfully"); } else { printLine("Unable to load library"); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ char * CWE114_Process_Control__w32_char_relativePath_61b_goodG2BSource(char * data); static void goodG2B() { char * data; char dataBuffer[100] = ""; data = dataBuffer; data = CWE114_Process_Control__w32_char_relativePath_61b_goodG2BSource(data); { HMODULE hModule; /* POTENTIAL FLAW: If the path to the library is not specified, an attacker may be able to * replace his own file with the intended library */ hModule = LoadLibraryA(data); if (hModule != NULL) { FreeLibrary(hModule); printLine("Library loaded and freed successfully"); } else { printLine("Unable to load library"); } } } void CWE114_Process_Control__w32_char_relativePath_61_good() { goodG2B(); } #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()..."); CWE114_Process_Control__w32_char_relativePath_61_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE114_Process_Control__w32_char_relativePath_61_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // // Thread-safe (provides internal synchronization) #ifndef STORAGE_LEVELDB_DB_TABLE_CACHE_H_ #define STORAGE_LEVELDB_DB_TABLE_CACHE_H_ #include <map> #include <string> #include <stdint.h> #include "db/dbformat.h" #include "leveldb/cache.h" #include "leveldb/table.h" #include "port/port.h" namespace leveldb { class Env; class TableCache { public: TableCache(size_t byte_size); ~TableCache(); // Return an iterator for the specified file number (the corresponding // file length must be exactly "file_size" bytes). If "tableptr" is // non-NULL, also sets "*tableptr" to point to the Table object // underlying the returned iterator, or NULL if no Table object underlies // the returned iterator. The returned "*tableptr" object is owned by // the cache and should not be deleted, and is valid for as long as the // returned iterator is live. Iterator* NewIterator(const ReadOptions& options, const std::string& dbname, uint64_t file_number, uint64_t file_size, Table** tableptr = NULL); // Specify key range of iterator [smallest, largest]. There are some // out-of-range keys in table file after tablet merging and splitting. Iterator* NewIterator(const ReadOptions& options, const std::string& dbname, uint64_t file_number, uint64_t file_size, const Slice& smallest, const Slice& largest, Table** tableptr = NULL); // If a seek to internal key "k" in specified file finds an entry, // call (*handle_result)(arg, found_key, found_value). Status Get(const ReadOptions& options, const std::string& dbname, uint64_t file_number, uint64_t file_size, const Slice& k, void* arg, void (*handle_result)(void*, const Slice&, const Slice&)); // Evict any entry for the specified file number void Evict(const std::string& dbname, uint64_t file_number); // Returns hit rate double HitRate(bool force_clear) { return cache_->HitRate(force_clear); } // Returns table entries size_t TableEntries() { return cache_->Entries(); } // Returns memory usage of opened table's index block size_t ByteSize() { return cache_->TotalCharge(); } private: static constexpr int shard_lock_cnt_ = 512; size_t GetIndex(uint64_t file_number) { return std::hash<uint64_t>()(file_number) % shard_lock_cnt_; } Cache* cache_; struct Waiter { port::CondVar cv; int wait_num; Status status; bool done; Waiter(port::Mutex* mu) : cv(mu), wait_num(0), done(false) {} }; typedef std::map<std::string, Waiter*> WaitFileList; port::Mutex mu_[shard_lock_cnt_]; WaitFileList wait_files_[shard_lock_cnt_]; Status FindTable(const std::string& dbname, const Options* options, uint64_t file_number, uint64_t file_size, Cache::Handle**); }; } // namespace leveldb #endif // STORAGE_LEVELDB_DB_TABLE_CACHE_H_
// 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_SNAPSHOTS_SNAPSHOT_BROWSER_AGENT_H_ #define IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_BROWSER_AGENT_H_ #import <Foundation/Foundation.h> #include "base/macros.h" #import "ios/chrome/browser/main/browser_observer.h" #import "ios/chrome/browser/main/browser_user_data.h" #import "ios/chrome/browser/web_state_list/web_state_list_observer.h" @class SnapshotCache; // Associates a SnapshotCache to a Browser. class SnapshotBrowserAgent : BrowserObserver, public WebStateListObserver, public BrowserUserData<SnapshotBrowserAgent> { public: SnapshotBrowserAgent(); ~SnapshotBrowserAgent() override; SnapshotBrowserAgent(const SnapshotBrowserAgent&) = delete; SnapshotBrowserAgent& operator=(const SnapshotBrowserAgent&) = delete; // Set a session identification string that will be used to locate the // snapshots directory. Setting this more than once on the same agent is // probably a programming error. void SetSessionID(NSString* session_identifier); // Maintains the snapshots storage including purging unused images and // performing any necessary migrations. void PerformStorageMaintenance(); // Permanently removes all snapshots. void RemoveAllSnapshots(); SnapshotCache* snapshot_cache() { return snapshot_cache_; } private: explicit SnapshotBrowserAgent(Browser* browser); friend class BrowserUserData<SnapshotBrowserAgent>; BROWSER_USER_DATA_KEY_DECL(); // BrowserObserver methods void BrowserDestroyed(Browser* browser) override; // WebStateListObserver methods void WebStateInsertedAt(WebStateList* web_state_list, web::WebState* web_state, int index, bool activating) override; void WebStateReplacedAt(WebStateList* web_state_list, web::WebState* old_web_state, web::WebState* new_web_state, int index) override; void WebStateDetachedAt(WebStateList* web_state_list, web::WebState* web_state, int index) override; void WillBeginBatchOperation(WebStateList* web_state_list) override; void BatchOperationEnded(WebStateList* web_state_list) override; // Migrates the snapshot storage if a folder exists in the old snapshots // storage location. void MigrateStorageIfNecessary(); // Purges the snapshots folder of unused snapshots. void PurgeUnusedSnapshots(); // Returns the Tab IDs of all the WebStates in the Browser. NSSet<NSString*>* GetTabIDs(); __strong SnapshotCache* snapshot_cache_; Browser* browser_ = nullptr; }; #endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_BROWSER_AGENT_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__int_rand_multiply_01.c Label Definition File: CWE191_Integer_Underflow__int.label.xml Template File: sources-sinks-01.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: rand Set data to result of rand(), which may be zero * GoodSource: Set data to a small, non-zero number (negative two) * Sinks: multiply * GoodSink: Ensure there will not be an underflow before multiplying data by 2 * BadSink : If data is negative, multiply by 2, which can cause an underflow * Flow Variant: 01 Baseline * * */ #include "std_testcase.h" #ifndef OMITBAD void CWE191_Integer_Underflow__int_rand_multiply_01_bad() { int data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Set data to a random value */ data = RAND32(); if(data < 0) /* ensure we won't have an overflow */ { /* POTENTIAL FLAW: if (data * 2) < INT_MIN, this will underflow */ int result = data * 2; printIntLine(result); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { int data; /* Initialize data */ data = 0; /* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */ data = -2; if(data < 0) /* ensure we won't have an overflow */ { /* POTENTIAL FLAW: if (data * 2) < INT_MIN, this will underflow */ int result = data * 2; printIntLine(result); } } /* goodB2G uses the BadSource with the GoodSink */ static void goodB2G() { int data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Set data to a random value */ data = RAND32(); if(data < 0) /* ensure we won't have an overflow */ { /* FIX: Add a check to prevent an underflow from occurring */ if (data > (INT_MIN/2)) { int result = data * 2; printIntLine(result); } else { printLine("data value is too small to perform multiplication."); } } } void CWE191_Integer_Underflow__int_rand_multiply_01_good() { goodG2B(); goodB2G(); } #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_rand_multiply_01_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE191_Integer_Underflow__int_rand_multiply_01_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkAffineRepresentation.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkAffineRepresentation - abstract class for representing affine transformation widgets // .SECTION Description // This class defines an API for affine transformation widget // representations. These representations interact with vtkAffineWidget. The // basic functionality of the affine representation is to maintain a // transformation matrix. // // This class may be subclassed so that alternative representations can // be created. The class defines an API and a default implementation that // the vtkAffineWidget interacts with to render itself in the scene. // .SECTION Caveats // The separation of the widget event handling and representation enables // users and developers to create new appearances for the widget. It also // facilitates parallel processing, where the client application handles // events, and remote representations of the widget are slaves to the // client (and do not handle events). // .SECTION See Also // vtkAffineWidget vtkWidgetRepresentation vtkAbstractWidget #ifndef vtkAffineRepresentation_h #define vtkAffineRepresentation_h #include "vtkInteractionWidgetsModule.h" // For export macro #include "vtkWidgetRepresentation.h" class vtkTransform; class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation : public vtkWidgetRepresentation { public: // Description: // Standard methods for instances of this class. vtkTypeMacro(vtkAffineRepresentation,vtkWidgetRepresentation); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Retrieve a linear transform characterizing the affine transformation // generated by this widget. This method copies its internal transform into // the transform provided. The transform is relative to the initial placement // of the representation (i.e., when PlaceWidget() is invoked). virtual void GetTransform(vtkTransform *t) = 0; // Description: // The tolerance representing the distance to the widget (in pixels) // in which the cursor is considered near enough to the widget to // be active. vtkSetClampMacro(Tolerance,int,1,100); vtkGetMacro(Tolerance,int); //BTX // Enums define the state of the representation relative to the mouse pointer // position. Used by ComputeInteractionState() to communicate with the // widget. enum _InteractionState { Outside=0, Rotate, Translate, TranslateX, TranslateY, ScaleWEdge, ScaleEEdge, ScaleNEdge, ScaleSEdge, ScaleNE, ScaleSW, ScaleNW, ScaleSE, ShearEEdge, ShearWEdge, ShearNEdge, ShearSEdge, MoveOriginX, MoveOriginY, MoveOrigin }; //ETX // Description: // Methods to make this class properly act like a vtkWidgetRepresentation. virtual void ShallowCopy(vtkProp *prop); protected: vtkAffineRepresentation(); ~vtkAffineRepresentation(); // The tolerance for selecting different parts of the widget. int Tolerance; // The internal transformation matrix vtkTransform *Transform; private: vtkAffineRepresentation(const vtkAffineRepresentation&); //Not implemented void operator=(const vtkAffineRepresentation&); //Not implemented }; #endif
#pragma once namespace dragon_li { namespace util { template< typename SizeType > class CtaOutputAssignment { public: SizeType *devOutputOffset; CtaOutputAssignment() : devOutputOffset(NULL) {} int setup(SizeType startOffset) { cudaError_t retVal; if(retVal = cudaMalloc(&devOutputOffset, sizeof(SizeType))) { errorCuda(retVal); return -1; } if(retVal = cudaMemcpy(devOutputOffset, &startOffset, sizeof(SizeType), cudaMemcpyHostToDevice)) { errorCuda(retVal); return -1; } return 0; } int reset() { cudaError_t retVal; SizeType outputOffset = 0; if(retVal = cudaMemcpy(devOutputOffset, &outputOffset, sizeof(SizeType), cudaMemcpyHostToDevice)) { errorCuda(retVal); return -1; } return 0; } int getGlobalSize(SizeType &globalSize) { cudaError_t retVal; if(retVal = cudaMemcpy(&globalSize, devOutputOffset, sizeof(SizeType), cudaMemcpyDeviceToHost)) { errorCuda(retVal); return -1; } return 0; } __device__ SizeType getCtaOutputAssignment(SizeType outputCount) { return atomicAdd(devOutputOffset, outputCount); } __device__ SizeType getGlobalSize() { return *devOutputOffset; } }; } }
/* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * Copyright (C) 2011 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: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef DatabaseContext_h #define DatabaseContext_h #include "core/dom/ActiveDOMObject.h" #include "modules/webdatabase/DatabaseDetails.h" #include "wtf/Assertions.h" #include "wtf/ThreadSafeRefCounted.h" namespace WebCore { class Database; class DatabaseBackendContext; class DatabaseTaskSynchronizer; class DatabaseThread; class ScriptExecutionContext; class DatabaseContext : public ThreadSafeRefCounted<DatabaseContext>, ActiveDOMObject { public: virtual ~DatabaseContext(); // For life-cycle management (inherited from ActiveDOMObject): virtual void contextDestroyed(); virtual void stop(); PassRefPtr<DatabaseBackendContext> backend(); DatabaseThread* databaseThread(); void setHasOpenDatabases() { m_hasOpenDatabases = true; } bool hasOpenDatabases() { return m_hasOpenDatabases; } // When the database cleanup is done, cleanupSync will be signalled. bool stopDatabases(DatabaseTaskSynchronizer*); bool allowDatabaseAccess() const; private: explicit DatabaseContext(ScriptExecutionContext*); void stopDatabases() { stopDatabases(0); } RefPtr<DatabaseThread> m_databaseThread; bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed. bool m_isRegistered; bool m_hasRequestedTermination; friend class DatabaseBackendContext; friend class DatabaseManager; }; } // namespace WebCore #endif // DatabaseContext_h
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <Foundation/Foundation.h> #import <FBSimulatorControl/FBFramebufferSurface.h> @class FBDiagnostic; @class FBFramebufferFrameGenerator; @class FBFramebufferSurface; @protocol FBSimulatorEventSink; NS_ASSUME_NONNULL_BEGIN /** Provides access to an Image Representation of a Simulator's Framebuffer. */ @interface FBSimulatorImage : NSObject #pragma mark Initializers /** Creates a new FBSimulatorImage instance using a Frame Generator. @param filePath the File Path to write to. @param frameGenerator the Frame Generator to register with. @param eventSink the Event Sink to report Image Logs to. @return a new FBSimulatorImage instance. */ + (instancetype)imageWithFilePath:(NSString *)filePath frameGenerator:(FBFramebufferFrameGenerator *)frameGenerator eventSink:(id<FBSimulatorEventSink>)eventSink; /** Creates a new FBSimulatorImage instance using a Surface. @param filePath the File Path to write to. @param surface the surface to obtain frames from. @param eventSink the Event Sink to report Image Logs to. @return a new FBSimulatorImage instance. */ + (instancetype)imageWithFilePath:(NSString *)filePath surface:(FBFramebufferSurface *)surface eventSink:(id<FBSimulatorEventSink>)eventSink; #pragma mark Public Methods /** The Latest Image from the Framebuffer. This will return an autorelease Image, so it should be retained by the caller. */ - (nullable CGImageRef)image; /** Get a JPEG encoded representation of the Image. @param error an error out for any error that occurs. @return the data if successful, nil otherwise. */ - (nullable NSData *)jpegImageDataWithError:(NSError **)error; /** Get a PNG encoded representation of the Image. @param error an error out for any error that occurs. @return the data if successful, nil otherwise. */ - (nullable NSData *)pngImageDataWithError:(NSError **)error; @end NS_ASSUME_NONNULL_END
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2013, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above // copyright notice, this list of conditions and the following // disclaimer. // // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided with // the distribution. // // * Neither the name of Image Engine Design nor the names of // any other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #ifndef GAFFER_TRANSFORM2DPLUG_H #define GAFFER_TRANSFORM2DPLUG_H #include "Gaffer/CompoundNumericPlug.h" namespace Gaffer { class Transform2DPlug : public CompoundPlug { public : Transform2DPlug( const std::string &name = defaultName<Transform2DPlug>(), Direction direction=In, unsigned flags = Default ); virtual ~Transform2DPlug(); IE_CORE_DECLARERUNTIMETYPEDEXTENSION( Gaffer::Transform2DPlug, Transform2DPlugTypeId, CompoundPlug ); virtual bool acceptsChild( const GraphComponent *potentialChild ) const; virtual PlugPtr createCounterpart( const std::string &name, Direction direction ) const; V2fPlug *pivotPlug(); const V2fPlug *pivotPlug() const; V2fPlug *translatePlug(); const V2fPlug *translatePlug() const; FloatPlug *rotatePlug(); const FloatPlug *rotatePlug() const; V2fPlug *scalePlug(); const V2fPlug *scalePlug() const; Imath::M33f matrix() const; private : static size_t g_firstPlugIndex; }; IE_CORE_DECLAREPTR( Transform2DPlug ); typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, Transform2DPlug> > Transform2DPlugIterator; typedef FilteredChildIterator<PlugPredicate<Plug::In, Transform2DPlug> > InputTransform2DPlugIterator; typedef FilteredChildIterator<PlugPredicate<Plug::Out, Transform2DPlug> > OutputTransform2DPlugIterator; typedef FilteredRecursiveChildIterator<PlugPredicate<Gaffer::Plug::Invalid, Transform2DPlug>, PlugPredicate<> > RecursiveTransform2DPlugPlugIterator; typedef FilteredRecursiveChildIterator<PlugPredicate<Gaffer::Plug::In, Transform2DPlug>, PlugPredicate<> > RecursiveInputTransform2DPlugPlugIterator; typedef FilteredRecursiveChildIterator<PlugPredicate<Gaffer::Plug::Out, Transform2DPlug>, PlugPredicate<> > RecursiveOutputTransform2DPlugPlugIterator; } // namespace Gaffer #endif // GAFFER_TRANSFORM2DPLUG_H
/*------------------------------------------------------------------------- * * relation.h * Generic relation related routines. * * * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/relation.h * *------------------------------------------------------------------------- */ #ifndef ACCESS_RELATION_H #define ACCESS_RELATION_H #include "nodes/primnodes.h" #include "storage/lockdefs.h" #include "utils/relcache.h" extern Relation relation_open(Oid relationId, LOCKMODE lockmode); extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode); extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode); extern Relation relation_openrv_extended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok); extern void relation_close(Relation relation, LOCKMODE lockmode); #endif /* ACCESS_RELATION_H */
/* ----------------------------------------------------------------------------- * * Module : C support for Graphics.Rendering.OpenGL.Raw.GetProcAddress.hs * Copyright : (c) Sven Panne 2009 * License : BSD-style (see the file LICENSE) * * Maintainer : sven.panne@aedion.de * Stability : stable * Portability : portable * * -------------------------------------------------------------------------- */ #if defined(USE_WGLGETPROCADDRESS) #define WIN32_LEAN_AND_MEAN #include <windows.h> static void* getProcAddress(const char *name) { static int firstTime = 1; static HMODULE handle = NULL; if (firstTime) { firstTime = 0; handle = LoadLibrary(TEXT("opengl32")); } return handle ? GetProcAddress(handle, name) : NULL; } void* hs_OpenGLRaw_getProcAddress(const char *name) { void *apiEntry = wglGetProcAddress(name); /* Sometimes core API entries are not returned via wglGetProcAddress, so we fall back to GetProcAddress in these cases. */ return (apiEntry == NULL) ? getProcAddress(name) : apiEntry; } /* -------------------------------------------------------------------------- */ #elif defined(USE_NSADDRESSOFSYMBOL) #include <mach-o/dyld.h> #include <stdlib.h> #include <string.h> void* hs_OpenGLRaw_getProcAddress(const char *name) { NSSymbol symbol; /* Prepend a '_' for the Unix C symbol mangling convention */ char* symbolName = (char*)malloc(strlen(name) + 2); if (!symbolName) { return NULL; } symbolName[0] = '_'; strcpy(symbolName + 1, name); if (!NSIsSymbolNameDefined(symbolName)) { free(symbolName); return NULL; } symbol = NSLookupAndBindSymbol(symbolName); free(symbolName); if (!symbol) { return NULL; } return NSAddressOfSymbol(symbol); } /* -------------------------------------------------------------------------- */ #elif defined(USE_DLSYM) #include <stdlib.h> #include <dlfcn.h> /* Do not depend on <GL/gl.h> */ typedef unsigned char GLubyte; /* Do not depend on <GL/glx.h> */ typedef void (*genericFunctionPointer)(void); typedef genericFunctionPointer (*PFNGLXGETPROCADDRESSARB)(const GLubyte *); static const char* gpaNames[] = { "glXGetProcAddress", "glXGetProcAddressARB", "glXGetProcAddressEXT", "_glXGetProcAddress", "_glXGetProcAddressARB", "_glXGetProcAddressEXT" }; void* hs_OpenGLRaw_getProcAddress(const char *name) { static int firstTime = 1; static void *handle = NULL; static void *gpa = NULL; if (firstTime) { firstTime = 0; /* Get a handle for our executable. */ handle = dlopen(NULL, RTLD_LAZY); /* If fail this early, there's not much we can do about it. */ if (!handle) { return NULL; } { /* Let's see if our platform supports a glXGetProcAddress() variant. */ int numNames = (int)(sizeof(gpaNames) / sizeof(gpaNames[0])); int i; for (i = 0; (!gpa) && (i < numNames); ++i) { gpa = dlsym(handle, gpaNames[i]); } } } if (gpa) { /* Fine, we seem to have some kind of glXGetProcAddress(), so use it. */ return ((PFNGLXGETPROCADDRESSARB)gpa)(name); } else if (handle) { /* Fallback to dlsym() if we have no glXGetProcAddress(), although we then ignore the fact that OpenGL entry points could be context dependent. */ return dlsym(handle, name); } else { return NULL; } } /* -------------------------------------------------------------------------- */ #elif defined(USE_GLXGETPROCADDRESS) /* Do not depend on <GL/gl.h> */ typedef unsigned char GLubyte; /* Do not depend on <GL/glx.h> */ typedef void (*genericFunctionPointer)(void); extern genericFunctionPointer glXGetProcAddressARB(const GLubyte *); void* hs_OpenGLRaw_getProcAddress(const char *name) { return glXGetProcAddressARB((const GLubyte*)name); } /* -------------------------------------------------------------------------- */ #else #error "Don't know how to retrieve OpenGL extension entries" #endif
#ifndef THC_GENERIC_FILE #define THC_GENERIC_FILE "generic/THCTensorMathReduce.h" #else THC_API void THCTensor_(sum)(THCState *state, THCTensor *self, THCTensor *src, long dim); THC_API void THCTensor_(prod)(THCState *state, THCTensor *self, THCTensor *src, long dim); THC_API accreal THCTensor_(sumall)(THCState *state, THCTensor *self); THC_API accreal THCTensor_(prodall)(THCState *state, THCTensor *self); THC_API void THCTensor_(min)(THCState *state, THCTensor *values, THCudaLongTensor *indices, THCTensor *src, long dim); THC_API void THCTensor_(max)(THCState *state, THCTensor *values, THCudaLongTensor *indices, THCTensor *src, long dim); THC_API real THCTensor_(minall)(THCState *state, THCTensor *self); THC_API real THCTensor_(maxall)(THCState *state, THCTensor *self); #endif
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas 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 University of Texas 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. */ #include "blis.h" // // Define BLAS-to-BLIS interfaces. // #undef GENTFUNCCO #define GENTFUNCCO( ftype, ftype_r, ch, chr, blasname, blisname ) \ \ void PASTEF77(ch,blasname)( \ f77_char* side, \ f77_char* uploa, \ f77_int* m, \ f77_int* n, \ ftype* alpha, \ ftype* a, f77_int* lda, \ ftype* b, f77_int* ldb, \ ftype* beta, \ ftype* c, f77_int* ldc \ ) \ { \ side_t blis_side; \ uplo_t blis_uploa; \ dim_t m0, n0; \ inc_t rs_a, cs_a; \ inc_t rs_b, cs_b; \ inc_t rs_c, cs_c; \ err_t init_result; \ \ /* Initialize BLIS (if it is not already initialized). */ \ bli_init_safe( &init_result ); \ \ /* Perform BLAS parameter checking. */ \ PASTEBLACHK(blasname)( MKSTR(ch), \ MKSTR(blasname), \ side, \ uploa, \ m, \ n, \ lda, \ ldb, \ ldc ); \ \ /* Map BLAS chars to their corresponding BLIS enumerated type value. */ \ bli_param_map_netlib_to_blis_side( *side, &blis_side ); \ bli_param_map_netlib_to_blis_uplo( *uploa, &blis_uploa ); \ \ /* Convert/typecast negative values of m and n to zero. */ \ bli_convert_blas_dim1( *m, m0 ); \ bli_convert_blas_dim1( *n, n0 ); \ \ /* Set the row and column strides of the matrix operands. */ \ rs_a = 1; \ cs_a = *lda; \ rs_b = 1; \ cs_b = *ldb; \ rs_c = 1; \ cs_c = *ldc; \ \ /* Call BLIS interface. */ \ PASTEMAC(ch,blisname)( blis_side, \ blis_uploa, \ BLIS_NO_CONJUGATE, \ BLIS_NO_TRANSPOSE, \ m0, \ n0, \ alpha, \ a, rs_a, cs_a, \ b, rs_b, cs_b, \ beta, \ c, rs_c, cs_c ); \ \ /* Finalize BLIS (if it was initialized above). */ \ bli_finalize_safe( init_result ); \ } #ifdef BLIS_ENABLE_BLAS2BLIS INSERT_GENTFUNCCO_BLAS( hemm, hemm ) #endif
/* * Order-1, 3D 7 point stencil with variable coefficients * Adapted from PLUTO and Pochoir test bench * * Tareq Malas */ #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #ifdef LIKWID_PERFMON #include <likwid.h> #endif #include "print_utils.h" #define TESTS 2 #define MAX(a,b) ((a) > (b) ? a : b) #define MIN(a,b) ((a) < (b) ? a : b) /* Subtract the `struct timeval' values X and Y, * storing the result in RESULT. * * Return 1 if the difference is negative, otherwise 0. */ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } if (x->tv_usec - y->tv_usec > 1000000) { int nsec = (x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; } /* Compute the time remaining to wait. * tv_usec is certainly positive. */ result->tv_sec = x->tv_sec - y->tv_sec; result->tv_usec = x->tv_usec - y->tv_usec; /* Return 1 if result is negative. */ return x->tv_sec < y->tv_sec; } int main(int argc, char *argv[]) { int t, i, j, k, m, test; int Nx, Ny, Nz, Nt; if (argc > 3) { Nx = atoi(argv[1])+2; Ny = atoi(argv[2])+2; Nz = atoi(argv[3])+2; } if (argc > 4) Nt = atoi(argv[4]); // allocate the arrays double ****A = (double ****) malloc(sizeof(double***)*2); for(m=0; m<2;m++){ A[m] = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ A[m][i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ A[m][i][j] = (double*) malloc(sizeof(double)*Nx); } } } double ****coef = (double ****) malloc(sizeof(double***)*7); for(m=0; m<7;m++){ coef[m] = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ coef[m][i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ coef[m][i][j] = (double*) malloc(sizeof(double)*Nx); } } } // tile size information, including extra element to decide the list length int *tile_size = (int*) malloc(sizeof(int)); tile_size[0] = -1; // The list is modified here before source-to-source transformations tile_size = (int*) realloc((void *)tile_size, sizeof(int)*5); tile_size[0] = 8; tile_size[1] = 8; tile_size[2] = 32; tile_size[3] = 64; tile_size[4] = -1; // for timekeeping int ts_return = -1; struct timeval start, end, result; double tdiff = 0.0, min_tdiff=1.e100; const int BASE = 1024; // initialize variables // srand(42); for (i = 1; i < Nz; i++) { for (j = 1; j < Ny; j++) { for (k = 1; k < Nx; k++) { A[0][i][j][k] = 1.0 * (rand() % BASE); } } } for (m=0; m<7; m++) { for (i=1; i<Nz; i++) { for (j=1; j<Ny; j++) { for (k=1; k<Nx; k++) { coef[m][i][j][k] = 1.0 * (rand() % BASE); } } } } #ifdef LIKWID_PERFMON LIKWID_MARKER_INIT; #pragma omp parallel { LIKWID_MARKER_THREADINIT; #pragma omp barrier LIKWID_MARKER_START("calc"); } #endif int num_threads = 1; #if defined(_OPENMP) num_threads = omp_get_max_threads(); #endif for(test=0; test<TESTS; test++){ gettimeofday(&start, 0); // serial execution - Addition: 6 && Multiplication: 2 #pragma scop for (t = 0; t < Nt-1; t++) { for (i = 1; i < Nz-1; i++) { for (j = 1; j < Ny-1; j++) { for (k = 1; k < Nx-1; k++) { A[(t+1)%2][i][j][k] = coef[0][i][j][k] * A[t%2][i ][j ][k ] + coef[1][i][j][k] * A[t%2][i-1][j ][k ] + coef[2][i][j][k] * A[t%2][i ][j-1][k ] + coef[3][i][j][k] * A[t%2][i ][j ][k-1] + coef[4][i][j][k] * A[t%2][i+1][j ][k ] + coef[5][i][j][k] * A[t%2][i ][j+1][k ] + coef[6][i][j][k] * A[t%2][i ][j ][k+1]; } } } } #pragma endscop gettimeofday(&end, 0); ts_return = timeval_subtract(&result, &end, &start); tdiff = (double) (result.tv_sec + result.tv_usec * 1.0e-6); min_tdiff = min(min_tdiff, tdiff); printf("Rank 0 TEST# %d time: %f\n", test, tdiff); } PRINT_RESULTS(1, "variable no-symmetry") #ifdef LIKWID_PERFMON #pragma omp parallel { LIKWID_MARKER_STOP("calc"); } LIKWID_MARKER_CLOSE; #endif // Free allocated arrays for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(A[0][i][j]); free(A[1][i][j]); } free(A[0][i]); free(A[1][i]); } free(A[0]); free(A[1]); for(m=0; m<7;m++){ for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(coef[m][i][j]); } free(coef[m][i]); } free(coef[m]); } return 0; }
#ifndef CONSTS_H #define CONSTS_H const unsigned int NUM_ELEMENTS = 110; // Energy Group Structures: /// The Group Struct Types /** This enum just contains codes for each different groups structure used * in FEINDs various parsers */ enum GSType{ VITAMIN_J, /**< 175 group Vitamin - J structure, used by EAF (fendl) */ IEAF, /**< 275 group structure for IEAF data */ CINDER_NEUTRON, /**< 63 group Cinder neutron energy group structure */ CINDER_GAMMA /**< 25 group Cinder gamma energy group structure */ }; /// FEIND format identifiers /** A single identifier exists to correspond to each parser. */ enum FEINDFormat { DECAY_ENDF_6 = 0, /**< ENDF VI decay format */ EAF_4_1 = 1, /**< EAF 4.1 format for cross-sections */ CINDER = 2, /**< The CINDER data format, which contains decay data, * cross sections and fission yields. */ ENDF_IEAF = 3 /**< The ENDF VI format for cross-sections */ }; /// FEIND error identifiers /** These are error codes for each type of exception that can be thrown when * FEIND runs. These error codes are used as return values when programs run, * and will eventually be used to proived "exception handling" in fortran. */ enum FEINDErrorType { /// Error code for an unknown, or not built in error type. FEIND_UNKNOWN_ERROR, /// Error code for unknown formats /** Usually encountered if a user specifies a format type that FEIND does * not understand. Corresponds to the ExFormat exception type. */ FEIND_FORMAT_ERROR, /// Error code for unknown decay modes /** Usually encoutered when a parser is loading decay data, and asks * FEIND to add a certain decay mode to the RamLib. Corresponds to the * ExDecayMode exception type. */ FEIND_DECAYMODE_ERROR, /// Error code for problems opening files /** Usually encountered when the parser attempts to open a file that does * not exist. Corresponds to the ExFileOpen exception type. */ FEIND_FILEOPEN_ERROR, /// Error code for invalid options sent to parsers. /** This error type is used when programs send invalid arguments to the * parsers. Corresponds with the ExInvalidOption exception type. */ FEIND_INVALIDOPTION_ERROR, /// Error code for operations performed on XSec's of different sizes. /** Corresponds to the ExXsecSize exception type. */ FEIND_XSECSIZE_ERROR, /// Error code for operations performed on empty cross-sections. /** Users must initialize the XSec object to something before it can be * used. Corresponds to the ExEmptyXSec exception type. */ FEIND_EMPTYXSEC_ERROR }; /// Types of decay energies enum DecayEnergyType { HEAVY_PARTICLES = 0, /**< Heavy particles include alphas, protons... */ LIGHT_PARTICLES = 1, /**< Electrions, positrons... */ EM_RADIATION = 3 /**< Gammas, x-rays... */ }; /// Types of decay modes enum DecayModeType { // ***** DECAY MODES ***** UNKNOWN = 0, GAMMA_DECAY = 1, /// Constant to represent beta decay. BETA_DECAY = 2, /// Constant to represent electron capture. ELECTRON_CAPTURE = 3, /// Constant to represent an isomeric transition /** Basically the same as gamma decay. */ ISOMERIC_TRANSITION = 4, /// Constant to represent alpha decay. ALPHA_DECAY = 5, /// Constant to represent neutron emission. /** Not the same as delayed neutron emission. */ NEUTRON_EMISSION = 6, /// Constant to represent spontaneous fission. /** Spontaneous fission will be supported by the Fission set of classes. */ SPONTANEOUS_FISSION = 7, /// Constant to represent proton emission. PROTON_EMISSION = 8, /// Constant to represent beta decay, followed by a neutron emission. /** This is delayed neutron emission. */ BETA_NEUTRON_EMIT = 9, /// Constant to represent beta decay, followed by an alpha emission. BETA_ALPHA_EMIT = 10, /// Constant to represent positron decay, followed by an alpha emission. POSITRON_ALPHA_EMIT = 11, /// Constant to represent positron decay, followed by proton emission. POSITRON_PROTON_EMIT = 12, /// Constant to represent simultaneous isomeric transitions and alpha decay IT_ALPHA_EMIT = 13 }; /** \name Common particle KZA's * These constants simply represent Kzas for commonly used particles. They * can be used to make code more readable. */ //@{ const unsigned int PROTON = 10010; const unsigned int NEUTRON = 10; const unsigned int DEUTERON = 10020; const unsigned int TRITON = 10030; const unsigned int HELIUM3 = 20030; // Helium 4 and Alpha have the same value! // So they may be used interchangably... const unsigned int HELIUM4 = 20040; const unsigned int ALPHA = 20040; //@} // The Following particles are considered special...ie no Kza: const unsigned int GAMMA = 1; const unsigned int BETA = 2; const unsigned int ELECTRON = 3; const unsigned int XRAY = 4; const unsigned int SF_FRAGMENTS = 5; const unsigned int POSITRON = 6; const unsigned int FISSION_DAUGHTER = 7; // *************************** /// Types of Fission Yields: enum FissionType { NO_FISSION, FISSION_FAST, FISSION_THERMAL, FISSION_HOT, FISSION_SF }; /// Cross-section identifiers enum XSecType { TOTAL_CS = 1, NEUTRON_FISSION_CS = 2, CHARGED_CS = 3 }; #endif
/*- * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel@roe.ch> * 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 unmodified, 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/socket.h> #include <sys/selinfo.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/module.h> #include <sys/bus.h> #include <machine/bus.h> #include <machine/resource.h> #include <sys/rman.h> #include <dev/cmx/cmxvar.h> #include <dev/pccard/pccardvar.h> #include <dev/pccard/pccard_cis.h> #include "pccarddevs.h" static const struct pccard_product cmx_pccard_products[] = { PCMCIA_CARD(OMNIKEY, CM4040), { NULL } }; /* * Probe for the card. */ static int cmx_pccard_probe(device_t dev) { const struct pccard_product *pp; if ((pp = pccard_product_lookup(dev, cmx_pccard_products, sizeof(cmx_pccard_products[0]), NULL)) != NULL) { if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); return 0; } return EIO; } /* * Attach to the pccard, and call bus independant attach and * resource allocation routines. */ static int cmx_pccard_attach(device_t dev) { int rv = 0; cmx_init_softc(dev); if ((rv = cmx_alloc_resources(dev)) != 0) { device_printf(dev, "cmx_alloc_resources() failed!\n"); cmx_release_resources(dev); return rv; } if ((rv = cmx_attach(dev)) != 0) { device_printf(dev, "cmx_attach() failed!\n"); cmx_release_resources(dev); return rv; } device_printf(dev, "attached\n"); return 0; } static device_method_t cmx_pccard_methods[] = { DEVMETHOD(device_probe, cmx_pccard_probe), DEVMETHOD(device_attach, cmx_pccard_attach), DEVMETHOD(device_detach, cmx_detach), { 0, 0 } }; static driver_t cmx_pccard_driver = { "cmx", cmx_pccard_methods, sizeof(struct cmx_softc), }; DRIVER_MODULE(cmx, pccard, cmx_pccard_driver, cmx_devclass, 0, 0);
// 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 NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ #pragma once #include <string> #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "net/base/completion_callback.h" #include "net/base/host_port_pair.h" #include "net/base/net_log.h" #include "net/http/http_auth_controller.h" #include "net/http/http_request_headers.h" #include "net/http/http_request_info.h" #include "net/http/http_response_info.h" #include "net/http/proxy_client_socket.h" #include "net/socket/ssl_client_socket.h" class GURL; namespace net { class AddressList; class ClientSocketHandle; class GrowableIOBuffer; class HttpAuthCache; class HttpStream; class HttpStreamParser; class IOBuffer; class HttpProxyClientSocket : public ProxyClientSocket { public: // Takes ownership of |transport_socket|, which should already be connected // by the time Connect() is called. If tunnel is true then on Connect() // this socket will establish an Http tunnel. HttpProxyClientSocket(ClientSocketHandle* transport_socket, const GURL& request_url, const std::string& user_agent, const HostPortPair& endpoint, const HostPortPair& proxy_server, HttpAuthCache* http_auth_cache, HttpAuthHandlerFactory* http_auth_handler_factory, bool tunnel, bool using_spdy, SSLClientSocket::NextProto protocol_negotiated, bool is_https_proxy); // On destruction Disconnect() is called. virtual ~HttpProxyClientSocket(); // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then // credentials should be added to the HttpAuthController before calling // RestartWithAuth. int RestartWithAuth(const CompletionCallback& callback); const scoped_refptr<HttpAuthController>& auth_controller() { return auth_; } bool using_spdy() { return using_spdy_; } SSLClientSocket::NextProto protocol_negotiated() { return protocol_negotiated_; } // ProxyClientSocket implementation. virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE; virtual HttpStream* CreateConnectResponseStream() OVERRIDE; // StreamSocket implementation. virtual int Connect(const CompletionCallback& callback) OVERRIDE; virtual void Disconnect() OVERRIDE; virtual bool IsConnected() const OVERRIDE; virtual bool IsConnectedAndIdle() const OVERRIDE; virtual const BoundNetLog& NetLog() const OVERRIDE; virtual void SetSubresourceSpeculation() OVERRIDE; virtual void SetOmniboxSpeculation() OVERRIDE; virtual bool WasEverUsed() const OVERRIDE; virtual bool UsingTCPFastOpen() const OVERRIDE; virtual int64 NumBytesRead() const OVERRIDE; virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback) OVERRIDE; virtual int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback) OVERRIDE; virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; virtual bool SetSendBufferSize(int32 size) OVERRIDE; virtual int GetPeerAddress(AddressList* address) const OVERRIDE; virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; private: enum State { STATE_NONE, STATE_GENERATE_AUTH_TOKEN, STATE_GENERATE_AUTH_TOKEN_COMPLETE, STATE_SEND_REQUEST, STATE_SEND_REQUEST_COMPLETE, STATE_READ_HEADERS, STATE_READ_HEADERS_COMPLETE, STATE_DRAIN_BODY, STATE_DRAIN_BODY_COMPLETE, STATE_TCP_RESTART, STATE_TCP_RESTART_COMPLETE, STATE_DONE, }; // The size in bytes of the buffer we use to drain the response body that // we want to throw away. The response body is typically a small error // page just a few hundred bytes long. static const int kDrainBodyBufferSize = 1024; int PrepareForAuthRestart(); int DidDrainBodyForAuthRestart(bool keep_alive); int HandleAuthChallenge(); void LogBlockedTunnelResponse(int response_code) const; void DoCallback(int result); void OnIOComplete(int result); int DoLoop(int last_io_result); int DoGenerateAuthToken(); int DoGenerateAuthTokenComplete(int result); int DoSendRequest(); int DoSendRequestComplete(int result); int DoReadHeaders(); int DoReadHeadersComplete(int result); int DoDrainBody(); int DoDrainBodyComplete(int result); int DoTCPRestart(); int DoTCPRestartComplete(int result); CompletionCallback io_callback_; State next_state_; // Stores the callback to the layer above, called on completing Connect(). CompletionCallback user_callback_; HttpRequestInfo request_; HttpResponseInfo response_; scoped_refptr<GrowableIOBuffer> parser_buf_; scoped_ptr<HttpStreamParser> http_stream_parser_; scoped_refptr<IOBuffer> drain_buf_; // Stores the underlying socket. scoped_ptr<ClientSocketHandle> transport_; // The hostname and port of the endpoint. This is not necessarily the one // specified by the URL, due to Alternate-Protocol or fixed testing ports. const HostPortPair endpoint_; scoped_refptr<HttpAuthController> auth_; const bool tunnel_; // If true, then the connection to the proxy is a SPDY connection. const bool using_spdy_; // Protocol negotiated with the server. SSLClientSocket::NextProto protocol_negotiated_; // If true, then SSL is used to communicate with this proxy const bool is_https_proxy_; std::string request_line_; HttpRequestHeaders request_headers_; const BoundNetLog net_log_; DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); }; } // namespace net #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_
/*============================================================================= pamenlarge =============================================================================== By Bryan Henderson 2004.09.26. Contributed to the public domain by its author. =============================================================================*/ #include "pam.h" #include "mallocvar.h" struct cmdlineInfo { /* All the information the user supplied in the command line, in a form easy for the program to use. */ const char *inputFilespec; unsigned int scaleFactor; }; static void parseCommandLine(int argc, char ** const argv, struct cmdlineInfo * const cmdlineP) { /*---------------------------------------------------------------------------- Note that the file spec array we return is stored in the storage that was passed to us as the argv array. -----------------------------------------------------------------------------*/ if (argc-1 < 1) pm_error("You must specify at least one argument: The scale factor"); else { cmdlineP->scaleFactor = atoi(argv[1]); if (cmdlineP->scaleFactor < 1) pm_error("Scale factor must be an integer at least 1. " "You specified '%s'", argv[1]); if (argc-1 >= 2) cmdlineP->inputFilespec = argv[2]; else cmdlineP->inputFilespec = "-"; } } static void makeOutputRowMap(tuple ** const outTupleRowP, struct pam * const outpamP, struct pam * const inpamP, tuple * const inTuplerow) { /*---------------------------------------------------------------------------- Create a tuple *outTupleRowP which is actually a row of pointers into inTupleRow[], so as to map input pixels to output pixels by stretching. -----------------------------------------------------------------------------*/ tuple * newtuplerow; int col; MALLOCARRAY_NOFAIL(newtuplerow, outpamP->width); for (col = 0 ; col < inpamP->width; ++col) { unsigned int const scaleFactor = outpamP->width / inpamP->width; unsigned int subcol; for (subcol = 0; subcol < scaleFactor; ++subcol) newtuplerow[col * scaleFactor + subcol] = inTuplerow[col]; } *outTupleRowP = newtuplerow; } int main(int argc, char * argv[]) { struct cmdlineInfo cmdline; FILE * ifP; struct pam inpam; struct pam outpam; tuple * tuplerow; tuple * newtuplerow; int row; pnm_init(&argc, argv); parseCommandLine(argc, argv, &cmdline); ifP = pm_openr(cmdline.inputFilespec); pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type)); outpam = inpam; outpam.file = stdout; outpam.width = inpam.width * cmdline.scaleFactor; outpam.height = inpam.height * cmdline.scaleFactor; pnm_writepaminit(&outpam); tuplerow = pnm_allocpamrow(&inpam); makeOutputRowMap(&newtuplerow, &outpam, &inpam, tuplerow); for (row = 0; row < inpam.height; ++row) { pnm_readpamrow(&inpam, tuplerow); pnm_writepamrowmult(&outpam, newtuplerow, cmdline.scaleFactor); } free(newtuplerow); pnm_freepamrow(tuplerow); pm_close(ifP); pm_close(stdout); return 0; }
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // http://code.google.com/p/protobuf/ // // 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. // Author: kenton@google.com (Kenton Varda) // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. #ifndef GOOGLE_PROTOBUF_COMPILER_CXX_MESSAGE_FIELD_H__ #define GOOGLE_PROTOBUF_COMPILER_CXX_MESSAGE_FIELD_H__ #include <map> #include <string> #include <google/protobuf/compiler/cxx24x/cxx_field.h> namespace google { namespace protobuf { namespace compiler { namespace cxx { class MessageFieldGenerator : public FieldGenerator { public: explicit MessageFieldGenerator(const FieldDescriptor* descriptor); ~MessageFieldGenerator(); // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizes(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; private: const FieldDescriptor* descriptor_; map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); }; class RepeatedMessageFieldGenerator : public FieldGenerator { public: explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor); ~RepeatedMessageFieldGenerator(); // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizes(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; private: const FieldDescriptor* descriptor_; map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); }; } // namespace cxx } // namespace compiler } // namespace protobuf } // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_CXX_MESSAGE_FIELD_H__
/* 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. */ /// ///@file Semaphore ///@breif Basic semaphore primitive /// ///@author Steve Parker /// Department of Computer Science /// University of Utah ///@date June 1997 /// #ifndef Core_Thread_Semaphore_h #define Core_Thread_Semaphore_h #include <Core/Thread/Legacy/share.h> namespace SCIRun { class Semaphore_private; /************************************** @class Semaphore KEYWORDS Thread @detials Counting semaphore synchronization primitive. A semaphore provides atomic access to a special counter. The <i>up</i> method is used to increment the counter, and the <i>down</i> method is used to decrement the counter. If a thread tries to decrement the counter when the counter is zero, that thread will be blocked until another thread calls the <i>up</i> method. ****************************************/ class SCISHARE Semaphore { public: ////////// /// Create the semaphore, and setup the initial <i>count.name</i> /// should be a static string which describes the primitive for /// debugging purposes. Semaphore(const char* name, int count); ////////// /// Destroy the semaphore ~Semaphore(); ////////// /// Increment the semaphore count, unblocking up to <i>count</i> /// threads that may be blocked in the <i>down</i> method. void up(int count=1); ////////// /// Decrement the semaphore count by <i>count</i>. If the /// count is zero, this thread will be blocked until another /// thread calls the <i>up</i> method. The order in which /// threads will be unblocked is not defined, but implementors /// should give preference to those threads that have waited /// the longest. void down(int count=1); ////////// /// Attempt to decrement the semaphore count by one, but will /// never block. If the count was zero, <i>tryDown</i> will /// return false. Otherwise, <i>tryDown</i> will return true. bool tryDown(); private: Semaphore_private* priv_; const char* name_; // Cannot copy them Semaphore(const Semaphore&); Semaphore& operator=(const Semaphore&); }; } // End namespace SCIRun #endif
#pragma once #include <inttypes.h> #ifdef QUICKSAND_WINDOWS_BUILD #define PI32 "d" #define PI64 "lld" #define PU32 "u" #define PU64 "llu" #else #define PI32 PRId32 #define PI64 PRId64 #define PU32 PRIu32 #define PU64 PRIu64 #endif
/**************************************************************************** ** libmatroska : parse Matroska files, see http://www.matroska.org/ ** ** <file/class description> ** ** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. ** ** This file is part of libmatroska. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.** ** Contact license@matroska.org if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ /*! \file \version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \author Steve Lhomme <robux4 @ users.sf.net> */ #ifndef LIBMATROSKA_CUES_H #define LIBMATROSKA_CUES_H #include <vector> #include "matroska/KaxTypes.h" #include "ebml/EbmlMaster.h" #include "matroska/KaxBlock.h" using namespace LIBEBML_NAMESPACE; START_LIBMATROSKA_NAMESPACE class KaxCuePoint; DECLARE_MKX_MASTER(KaxCues) public: ~KaxCues(); //bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated bool AddBlockBlob(const KaxBlockBlob & BlockReference); /*! \brief Indicate that the position for this Block is set */ void PositionSet(const KaxBlockGroup & BlockReference); void PositionSet(const KaxBlockBlob & BlockReference); /*! \brief override to sort by timecode/track */ filepos_t Render(IOCallback & output, bool bSaveDefault = false) { Sort(); return EbmlMaster::Render(output, bSaveDefault); } uint64 GetTimecodePosition(uint64 aTimecode) const; const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const; void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { mGlobalTimecodeScale = aGlobalTimecodeScale; bGlobalTimecodeScaleIsSet = true; } uint64 GlobalTimecodeScale() const { assert(bGlobalTimecodeScaleIsSet); return mGlobalTimecodeScale; } protected: std::vector<const KaxBlockBlob *> myTempReferences; bool bGlobalTimecodeScaleIsSet; uint64 mGlobalTimecodeScale; }; END_LIBMATROSKA_NAMESPACE #endif // LIBMATROSKA_CUES_H
/*============================================================================ This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic Package, Release 3c, by John R. Hauser. Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================*/ #include <stdbool.h> #include <stdint.h> #include "platform.h" #include "internals.h" #include "specialize.h" #include "softfloat.h" bool f64_eq( float64_t a, float64_t b ) { union ui64_f64 uA; uint_fast64_t uiA; union ui64_f64 uB; uint_fast64_t uiB; uA.f = a; uiA = uA.ui; uB.f = b; uiB = uB.ui; if ( isNaNF64UI( uiA ) || isNaNF64UI( uiB ) ) { if ( softfloat_isSigNaNF64UI( uiA ) || softfloat_isSigNaNF64UI( uiB ) ) { softfloat_raiseFlags( softfloat_flag_invalid ); } return false; } return (uiA == uiB) || ! ((uiA | uiB) & UINT64_C( 0x7FFFFFFFFFFFFFFF )); }
/* * OPCODE - Optimized Collision Detection * http://www.codercorner.com/Opcode.htm * * Copyright (c) 2001-2008 Pierre Terdiman, pierre@codercorner.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Main file for Opcode.dll. * \file Opcode.h * \author Pierre Terdiman * \date March, 20, 2001 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Include Guard #ifndef __OPCODE_H__ #define __OPCODE_H__ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Compilation messages #if defined(OPCODE_EXPORTS) #pragma message("Compiling OPCODE") #elif !defined(OPCODE_EXPORTS) #pragma message("Using OPCODE") /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Automatic linking #ifndef BAN_OPCODE_AUTOLINK #ifdef _DEBUG #pragma comment(lib, "Opcode_D.lib") #else #pragma comment(lib, "Opcode.lib") #endif #endif #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Preprocessor #ifndef ICE_NO_DLL #ifdef OPCODE_EXPORTS #define OPCODE_API __declspec(dllexport) #else #define OPCODE_API __declspec(dllimport) #endif #else #define OPCODE_API #endif #include "OPC_IceHook.h" namespace Opcode { // Bulk-of-the-work #include "OPC_Settings.h" #include "OPC_Common.h" #include "OPC_MeshInterface.h" // Builders #include "OPC_TreeBuilders.h" // Trees #include "OPC_AABBTree.h" #include "OPC_OptimizedTree.h" // Models #include "OPC_BaseModel.h" #include "OPC_Model.h" #include "OPC_HybridModel.h" // Colliders #include "OPC_Collider.h" #include "OPC_VolumeCollider.h" #include "OPC_TreeCollider.h" #include "OPC_RayCollider.h" #include "OPC_SphereCollider.h" #include "OPC_OBBCollider.h" #include "OPC_AABBCollider.h" #include "OPC_LSSCollider.h" #include "OPC_PlanesCollider.h" // Usages #include "OPC_Picking.h" // Sweep-and-prune #include "OPC_BoxPruning.h" #include "OPC_SweepAndPrune.h" #include "OPC_ArraySAP.h" FUNCTION OPCODE_API bool InitOpcode(); FUNCTION OPCODE_API bool CloseOpcode(); } #endif // __OPCODE_H__
#pragma once #include "XBoxController.h" #include "GameComponent.h" #include <OVR.h> #include <OVR_CAPI_GL.h> #include "FBO.h" namespace BGE { class RiftController : public GameComponent { public: RiftController(void); ~RiftController(void); std::shared_ptr<BGE::XBoxController> xboxController; void Update(float timeDelta); bool Initialise(); void DrawToRift(); void Cleanup(); void Connect(); // Rift specific stuff! ovrHmd hmd; OVR::Sizei renderTargetSize; GLuint texture; GLuint frameBuffer; GLuint renderBuffer; ovrEyeRenderDesc eyeRenderDesc[2]; ovrFovPort eyeFov[2]; ovrRecti eyeRenderViewport[2]; ovrGLTexture eyeTexture[2]; void AccumulateInputs(); }; }
// ---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- #ifndef MicrosoftAzureMobile_MicrosoftAzureMobile_h #define MicrosoftAzureMobile_MicrosoftAzureMobile_h #import "MSBlockDefinitions.h" #import "MSClient.h" #import "MSCoreDataStore.h" #import "MSDateOffset.h" #import "MSError.h" #import "MSFilter.h" #if TARGET_OS_IPHONE #import "MSLoginController.h" #endif #import "MSPullSettings.h" #import "MSPush.h" #import "MSQuery.h" #import "MSQueryResult.h" #import "MSSyncContext.h" #import "MSSyncContextReadResult.h" #import "MSSyncTable.h" #import "MSTable.h" #import "MSTableOperation.h" #import "MSTableOperationError.h" #import "MSUser.h" #define MicrosoftAzureMobileSdkMajorVersion 3 #define MicrosoftAzureMobileSdkMinorVersion 0 #define MicrosoftAzureMobileSdkBuildVersion 0 #endif
#ifndef __CC_EXTENSION_CCSTORE_PRODUCT_H_ #define __CC_EXTENSION_CCSTORE_PRODUCT_H_ #include "cocos2dx_extensions.h" #include "cocos2d.h" NS_CC_EXT_BEGIN #pragma mark - #pragma mark CCStoreProduct class CCStoreProduct : public cocos2d::CCObject { public: static CCStoreProduct* productWithId(const char* productIdentifier, const char* localizedTitle, const char* localizedDescription, float price, const char* priceLocale); const std::string& getProductIdentifier(void) { return m_productIdentifier; } const std::string& getLocalizedTitle(void) { return m_localizedTitle; } const std::string& getLocalizedDescription(void) { return m_localizedDescription; } float getPrice(void) { return m_price; } const std::string& getPriceLocale(void) { return m_priceLocale; } private: CCStoreProduct(void) {} bool initWithId(const char* productIdentifier, const char* localizedTitle, const char* localizedDescription, float price, const char* priceLocale); std::string m_productIdentifier; std::string m_localizedTitle; std::string m_localizedDescription; float m_price; std::string m_priceLocale; }; NS_CC_EXT_END #endif // __CC_EXTENSION_CCSTORE_PRODUCT_H_
/** Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0 or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import <Foundation/Foundation.h> #import "AWSMobileAnalyticsSerializable.h" @interface AWSMobileAnalyticsJSONSerializer : NSObject<AWSMobileAnalyticsSerializer> - (NSData *) writeObject:(id) theObject; - (NSData *) writeArray:(NSArray *) theArray; - (NSDictionary *) readObject:(NSData *) theData; - (NSArray *) readArray:(NSData *) theData; @end
// // RKSetHeadingCommand.h // RobotKit // // Created by Mike DePhillips on 11/27/12. // Copyright 2011 Orbotix Inc. All rights reserved. // /*! @file */ #import <Foundation/Foundation.h> #import <Robotkit/RKDeviceCommand.h> /*! * @brief Class to encapsulate a set heading command and it's parameters. * * Class that encapsulates a calibrate command used to set the 0° heading. * Thus, if you send a Set Heading command with parameter 0, then whichever way Sphero * is facing is now 0 degrees. * * Also, calling this command with Stabilizatoin off, also adjusts Sphero's idea of roll, * pitch, and yaw. The orientation will now be 0,0,0 when the this command is called. * * @sa RKSetHeadingResponse * @sa RKBackLEDOutputCommand * @sa RKRollCommand */ @interface RKSetHeadingCommand : RKDeviceCommand { @private float heading; } /*! * The angle that will be added to the current heading when setting * the new 0° point. The value is in degrees. */ @property ( nonatomic, readonly ) float heading; /*! * Convenience method for sending the command through RKDeviceMessenger. * @param heading Typically this should be 0.0, but setting it will add to the current heading * when setting the new 0° point. The value is in degrees. */ + (void) sendCommandWithHeading:(float) heading; /*! * Initializer for a RKSetHeadingCommand object. * @param heading Typically this should be 0.0, but setting it will add to the current heading * when setting the new 0° point. The value is in degrees. * @return The initialized object. */ - (id) initWithHeading:(float) heading; @end
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include <string.h> #undef bcopy void * bcopy(const void *a, void *b, size_t len) { return memmove(b, a, len); }
// This file was generated based on 'C:\ProgramData\Uno\Packages\Android\0.19.1\Android\Fallbacks\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Android.android.view.animation.Animation.h> #include <Android.Base.Wrappers.IJWrapper.h> #include <Uno.IDisposable.h> namespace g{namespace Android{namespace Fallbacks{struct Android_android_view_animation_Animation;}}} namespace g{ namespace Android{ namespace Fallbacks{ // public sealed extern class Android_android_view_animation_Animation :10094 // { ::g::Android::java::lang::Object_type* Android_android_view_animation_Animation_typeof(); struct Android_android_view_animation_Animation : ::g::Android::android::view::animation::Animation { }; // } }}} // ::g::Android::Fallbacks
/* * PKCS #10 * (C) 1999-2007 Jack Lloyd * * Distributed under the terms of the Botan license */ #ifndef BOTAN_PKCS10_H__ #define BOTAN_PKCS10_H__ #include <botan/x509_obj.h> #include <botan/x509_dn.h> #include <botan/pkcs8.h> #include <botan/datastor.h> #include <vector> namespace Botan { /** * PKCS #10 Certificate Request. */ class BOTAN_DLL PKCS10_Request : public X509_Object { public: /** * Get the subject public key. * @return subject public key */ Public_Key* subject_public_key() const; /** * Get the raw DER encoded public key. * @return raw DER encoded public key */ MemoryVector<byte> raw_public_key() const; /** * Get the subject DN. * @return subject DN */ X509_DN subject_dn() const; /** * Get the subject alternative name. * @return subject alternative name. */ AlternativeName subject_alt_name() const; /** * Get the key constraints for the key associated with this * PKCS#10 object. * @return key constraints */ Key_Constraints constraints() const; /** * Get the extendend key constraints (if any). * @return extended key constraints */ std::vector<OID> ex_constraints() const; /** * Find out whether this is a CA request. * @result true if it is a CA request, false otherwise. */ bool is_CA() const; /** * Return the constraint on the path length defined * in the BasicConstraints extension. * @return path limit */ u32bit path_limit() const; /** * Get the challenge password for this request * @return challenge password for this request */ std::string challenge_password() const; /** * Create a PKCS#10 Request from a data source. * @param source the data source providing the DER encoded request */ PKCS10_Request(DataSource& source); /** * Create a PKCS#10 Request from a file. * @param filename the name of the file containing the DER or PEM * encoded request file */ PKCS10_Request(const std::string& filename); private: void force_decode(); void handle_attribute(const Attribute&); Data_Store info; }; } #endif
/* * SYSCALL_DEFINE1(setfsuid, uid_t, uid) */ #include "sanitise.h" struct syscall syscall_setfsuid = { .name = "setfsuid", .num_args = 1, .arg1name = "uid", .group = GROUP_VFS, };
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Copyright (C) 2007 John Crispin <blogic@openwrt.org> */ #include <linux/kernel.h> #include <linux/pm.h> #include <linux/io.h> #include <asm/reboot.h> #include <asm/system.h> #include <asm/ifxmips/ifxmips.h> static void ifxmips_machine_restart(char *command) { printk(KERN_NOTICE "System restart\n"); local_irq_disable(); ifxmips_w32(ifxmips_r32(IFXMIPS_RCU_RST) | IFXMIPS_RCU_RST_ALL, IFXMIPS_RCU_RST); for (;;) ; } static void ifxmips_machine_halt(void) { printk(KERN_NOTICE "System halted.\n"); local_irq_disable(); for (;;) ; } static void ifxmips_machine_power_off(void) { printk(KERN_NOTICE "Please turn off the power now.\n"); local_irq_disable(); for (;;) ; } void ifxmips_reboot_setup(void) { _machine_restart = ifxmips_machine_restart; _machine_halt = ifxmips_machine_halt; pm_power_off = ifxmips_machine_power_off; }
/* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * 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. */ #pragma once #if ENABLE(VIDEO_TRACK) #include "ContextDestructionObserver.h" #include "FloatPoint.h" #include "TextTrack.h" namespace WebCore { class HTMLDivElement; class VTTCueBox; class VTTScanner; class VTTRegion final : public RefCounted<VTTRegion>, public ContextDestructionObserver { public: static Ref<VTTRegion> create(ScriptExecutionContext& context) { return adoptRef(*new VTTRegion(context)); } virtual ~VTTRegion(); TextTrack* track() const { return m_track; } void setTrack(TextTrack*); const String& id() const { return m_id; } void setId(const String&); double width() const { return m_width; } ExceptionOr<void> setWidth(double); int height() const { return m_heightInLines; } ExceptionOr<void> setHeight(int); double regionAnchorX() const { return m_regionAnchor.x(); } ExceptionOr<void> setRegionAnchorX(double); double regionAnchorY() const { return m_regionAnchor.y(); } ExceptionOr<void> setRegionAnchorY(double); double viewportAnchorX() const { return m_viewportAnchor.x(); } ExceptionOr<void> setViewportAnchorX(double); double viewportAnchorY() const { return m_viewportAnchor.y(); } ExceptionOr<void> setViewportAnchorY(double); const AtomicString& scroll() const; ExceptionOr<void> setScroll(const AtomicString&); void updateParametersFromRegion(const VTTRegion&); const String& regionSettings() const { return m_settings; } void setRegionSettings(const String&); bool isScrollingRegion() { return m_scroll; } HTMLDivElement& getDisplayTree(); void appendTextTrackCueBox(Ref<VTTCueBox>&&); void displayLastTextTrackCueBox(); void willRemoveTextTrackCueBox(VTTCueBox*); private: VTTRegion(ScriptExecutionContext&); void prepareRegionDisplayTree(); // The timer is needed to continue processing when cue scrolling ended. void startTimer(); void stopTimer(); void scrollTimerFired(); enum RegionSetting { None, Id, Width, Height, RegionAnchor, ViewportAnchor, Scroll }; RegionSetting scanSettingName(VTTScanner&); void parseSettingValue(RegionSetting, VTTScanner&); static const AtomicString& textTrackCueContainerShadowPseudoId(); static const AtomicString& textTrackCueContainerScrollingClass(); static const AtomicString& textTrackRegionShadowPseudoId(); String m_id; String m_settings; double m_width { 100 }; unsigned m_heightInLines { 3 }; FloatPoint m_regionAnchor { 0, 100 }; FloatPoint m_viewportAnchor { 0, 100 }; bool m_scroll { false }; // The cue container is the container that is scrolled up to obtain the // effect of scrolling cues when this is enabled for the regions. RefPtr<HTMLDivElement> m_cueContainer; RefPtr<HTMLDivElement> m_regionDisplayTree; // The member variable track can be a raw pointer as it will never // reference a destroyed TextTrack, as this member variable // is cleared in the TextTrack destructor and it is generally // set/reset within the addRegion and removeRegion methods. TextTrack* m_track { nullptr }; // Keep track of the current numeric value of the css "top" property. double m_currentTop { 0 }; // The timer is used to display the next cue line after the current one has // been displayed. It's main use is for scrolling regions and it triggers as // soon as the animation for rolling out one line has finished, but // currently it is used also for non-scrolling regions to use a single // code path. Timer m_scrollTimer; }; } // namespace WebCore #endif
/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed short/char values. Limitations: none. PR: PR13221. Originator: <andreast@gcc.gnu.org> 20031129 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" signed short test_func_fn(signed char a1, signed short a2, signed char a3, signed short a4) { signed short result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif, void *rval, void **avals, void *data) { signed char a1, a3; signed short a2, a4; a1 = *(signed char *)avals[0]; a2 = *(signed short *)avals[1]; a3 = *(signed char *)avals[2]; a4 = *(signed short *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef signed short (*test_type)(signed char, signed short, signed char, signed short); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; signed char a, c; signed short b, d, res_closure; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif a = 1; b = 32765; c = 127; d = -128; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = &ffi_type_sshort; cl_arg_types[2] = &ffi_type_schar; cl_arg_types[3] = &ffi_type_sshort; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sshort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 32765 127 -128: 32765" } */ printf("res: %d\n", res_call); /* { dg-output "\nres: 32765" } */ CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); res_closure = (*((test_type)pcl))(1, 32765, 127, -128); /* { dg-output "\n1 32765 127 -128: 32765" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32765" } */ exit(0); }
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2019-2020 PHYTEC Messtechnik GmbH * Author: Teresa Remmet <t.remmet@phytec.de> */ #include <common.h> #include <asm/arch/sys_proto.h> #include <asm/io.h> #include <asm/mach-imx/boot_mode.h> #include <env.h> #include <miiphy.h> DECLARE_GLOBAL_DATA_PTR; static int setup_fec(void) { struct iomuxc_gpr_base_regs *gpr = (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; /* Use 125M anatop REF_CLK1 for ENET1, not from external */ clrsetbits_le32(&gpr->gpr[1], 0x2000, 0); return 0; } int board_init(void) { setup_fec(); return 0; } int board_mmc_get_env_dev(int devno) { return devno; } int board_late_init(void) { switch (get_boot_device()) { case SD2_BOOT: env_set_ulong("mmcdev", 1); break; case MMC3_BOOT: env_set_ulong("mmcdev", 2); break; default: break; } return 0; }
/********************************************************************** * * * Voreen - The Volume Rendering Engine * * * * Created between 2005 and 2012 by The Voreen Team * * as listed in CREDITS.TXT <http://www.voreen.org> * * * * This file is part of the Voreen software package. Voreen is free * * software: you can redistribute it and/or modify it under the terms * * of the GNU General Public License version 2 as published by the * * Free Software Foundation. * * * * Voreen 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 * * in the file "LICENSE.txt" along with this program. * * If not, see <http://www.gnu.org/licenses/>. * * * * The authors reserve all rights not expressly granted herein. For * * non-commercial academic use see the license exception specified in * * the file "LICENSE-academic.txt". To get information about * * commercial licensing please contact the authors. * * * **********************************************************************/ #ifndef VRN_TARGETTOTEXTURE_H #define VRN_TARGETTOTEXTURE_H #include "voreen/core/processors/renderprocessor.h" #include "tgt/texture.h" namespace voreen { class TargetToTexture : public RenderProcessor { public: TargetToTexture(); std::string getClassName() const { return "TargetToTexture"; } std::string getCategory() const { return "Image Processing"; } CodeState getCodeState() const { return CODE_STATE_EXPERIMENTAL; } Processor* create() const { return new TargetToTexture; } protected: void process(); RenderPort inport_; GenericPort<tgt::Texture> outport_; }; } // namespace #endif // VRN_TARGETTOTEXTURE_H
/* * LG Optimus Black (P970) codename sniper config * * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H #include <asm/arch/cpu.h> #include <asm/arch/omap.h> /* * CPU */ #define CONFIG_SYS_CACHELINE_SIZE 64 #define CONFIG_ARM_ARCH_CP15_ERRATA #define CONFIG_ARM_ERRATA_454179 #define CONFIG_ARM_ERRATA_430973 #define CONFIG_ARM_ERRATA_621766 /* * Platform */ #define CONFIG_OMAP #define CONFIG_OMAP_COMMON /* * Board */ #define CONFIG_MISC_INIT_R /* * Clocks */ #define CONFIG_SYS_TIMERBASE OMAP34XX_GPT2 #define CONFIG_SYS_PTV 2 #define V_NS16550_CLK 48000000 #define V_OSCK 26000000 #define V_SCLK (V_OSCK >> 1) /* * DRAM */ #define CONFIG_SDRC #define CONFIG_NR_DRAM_BANKS 2 #define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 #define PHYS_SDRAM_2 OMAP34XX_SDRC_CS1 /* * Memory */ #define CONFIG_SYS_TEXT_BASE 0x80100000 #define CONFIG_SYS_SDRAM_BASE OMAP34XX_SDRC_CS0 #define CONFIG_SYS_INIT_RAM_ADDR 0x4020F800 #define CONFIG_SYS_INIT_RAM_SIZE 0x800 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ CONFIG_SYS_INIT_RAM_SIZE - \ GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_MALLOC_LEN (1024 * 1024 + CONFIG_ENV_SIZE) /* * GPIO */ #define CONFIG_OMAP_GPIO #define CONFIG_OMAP3_GPIO_2 #define CONFIG_OMAP3_GPIO_3 #define CONFIG_OMAP3_GPIO_4 #define CONFIG_OMAP3_GPIO_5 #define CONFIG_OMAP3_GPIO_6 /* * I2C */ #define CONFIG_SYS_I2C #define CONFIG_SYS_OMAP24_I2C_SPEED 400000 #define CONFIG_SYS_OMAP24_I2C_SLAVE 1 #define CONFIG_SYS_I2C_OMAP34XX #define CONFIG_I2C_MULTI_BUS #define CONFIG_CMD_I2C /* * Flash */ #define CONFIG_SYS_NO_FLASH /* * MMC */ #define CONFIG_GENERIC_MMC #define CONFIG_MMC #define CONFIG_OMAP_HSMMC #define CONFIG_CMD_MMC /* * Power */ #define CONFIG_TWL4030_POWER /* * Input */ #define CONFIG_TWL4030_INPUT /* * Partitions */ #define CONFIG_PARTITION_UUIDS #define CONFIG_DOS_PARTITION #define CONFIG_EFI_PARTITION #define CONFIG_CMD_PART /* * Filesystems */ #define CONFIG_CMD_FS_GENERIC #define CONFIG_CMD_EXT2 #define CONFIG_CMD_EXT4 #define CONFIG_CMD_FAT /* * SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x40200000 #define CONFIG_SPL_MAX_SIZE (54 * 1024) #define CONFIG_SPL_BSS_START_ADDR 0x80000000 #define CONFIG_SPL_BSS_MAX_SIZE (512 * 1024) #define CONFIG_SYS_SPL_MALLOC_START 0x80208000 #define CONFIG_SYS_SPL_MALLOC_SIZE (1024 * 1024) #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds" #define CONFIG_SPL_BOARD_INIT #define CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_LIBCOMMON_SUPPORT #define CONFIG_SPL_LIBDISK_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT #define CONFIG_SPL_POWER_SUPPORT #define CONFIG_SPL_GPIO_SUPPORT #define CONFIG_SPL_I2C_SUPPORT #define CONFIG_SPL_MMC_SUPPORT #define CONFIG_SPL_FAT_SUPPORT #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 2 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" /* * Console */ #define CONFIG_SYS_CONSOLE_IS_IN_ENV #define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_LONGHELP #define CONFIG_SYS_HUSH_PARSER #define CONFIG_SYS_MAXARGS 16 #define CONFIG_SYS_CBSIZE 512 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) \ + 16) /* * Serial */ #ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE (-4) #endif #define CONFIG_SYS_NS16550_CLK V_NS16550_CLK #define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 #define CONFIG_CONS_INDEX 3 #define CONFIG_SERIAL3 3 #define CONFIG_BAUDRATE 115200 #define CONFIG_SYS_BAUDRATE_TABLE { 4800, 9600, 19200, 38400, 57600, \ 115200 } /* * USB gadget */ #define CONFIG_USB_MUSB_PIO_ONLY #define CONFIG_USB_MUSB_OMAP2PLUS #define CONFIG_TWL4030_USB #define CONFIG_USB_GADGET #define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_USB_GADGET_VBUS_DRAW 0 /* * Download */ #define CONFIG_USB_GADGET_DOWNLOAD #define CONFIG_G_DNL_VENDOR_NUM 0x0451 #define CONFIG_G_DNL_PRODUCT_NUM 0xd022 #define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" /* * Fastboot */ #define CONFIG_USB_FUNCTION_FASTBOOT #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR #define CONFIG_FASTBOOT_BUF_SIZE 0x2000000 #define CONFIG_FASTBOOT_FLASH #define CONFIG_FASTBOOT_FLASH_MMC_DEV 0 #define CONFIG_CMD_FASTBOOT /* * Environment */ #define CONFIG_ENV_SIZE (128 * 1024) #define CONFIG_ENV_IS_NOWHERE #define CONFIG_ENV_OVERWRITE #define CONFIG_EXTRA_ENV_SETTINGS \ "kernel_addr_r=0x82000000\0" \ "boot_mmc_dev=0\0" \ "kernel_mmc_part=3\0" \ "recovery_mmc_part=4\0" \ "bootargs=console=ttyO2 vram=5M,0x9FA00000 omapfb.vram=0:5M\0" /* * ATAGs / Device Tree */ #define CONFIG_OF_LIBFDT #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_CMDLINE_TAG #define CONFIG_INITRD_TAG #define CONFIG_REVISION_TAG #define CONFIG_SERIAL_TAG /* * Boot */ #define CONFIG_SYS_LOAD_ADDR 0x82000000 #define CONFIG_BOOTDELAY 1 #define CONFIG_ANDROID_BOOT_IMAGE #define CONFIG_BOOTCOMMAND \ "setenv boot_mmc_part ${kernel_mmc_part}; " \ "if test reboot-${reboot-mode} = reboot-r; then " \ "echo recovery; setenv boot_mmc_part ${recovery_mmc_part}; fi; " \ "if test reboot-${reboot-mode} = reboot-b; then " \ "echo fastboot; fastboot 0; fi; " \ "part start mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_start; " \ "part size mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_size; " \ "mmc dev ${boot_mmc_dev}; " \ "mmc read ${kernel_addr_r} ${boot_mmc_start} ${boot_mmc_size} && " \ "bootm ${kernel_addr_r};" /* * Defaults */ #include <config_defaults.h> #endif
/***************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * $Id: lib556.c,v 1.4 2008-09-20 04:26:57 yangtse Exp $ */ #include "test.h" #include "memdebug.h" int test(char *URL) { CURLcode res; CURL *curl; if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } if ((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); res = curl_easy_perform(curl); if(!res) { /* we are connected, now get a HTTP document the raw way */ const char *request = "GET /556 HTTP/1.2\r\n" "Host: ninja\r\n\r\n"; size_t iolen; char buf[1024]; res = curl_easy_send(curl, request, strlen(request), &iolen); if(!res) { /* we assume that sending always work */ int total=0; do { /* busy-read like crazy */ res = curl_easy_recv(curl, buf, 1024, &iolen); if(iolen) /* send received stuff to stdout */ write(STDOUT_FILENO, buf, iolen); total += iolen; } while(((res == CURLE_OK) || (res == CURLE_AGAIN)) && (total < 129)); } } curl_easy_cleanup(curl); curl_global_cleanup(); return (int)res; }
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include "utils.h" #include "pixman-inlines.h" /* A trivial reference implementation for * 'bilinear_pad_repeat_get_scanline_bounds' */ static void bilinear_pad_repeat_get_scanline_bounds_ref (int32_t source_image_width, pixman_fixed_t vx_, pixman_fixed_t unit_x, int32_t * left_pad, int32_t * left_tz, int32_t * width, int32_t * right_tz, int32_t * right_pad) { int w = *width; int64_t vx = vx_; *left_pad = 0; *left_tz = 0; *width = 0; *right_tz = 0; *right_pad = 0; while (--w >= 0) { if (vx < 0) { if (vx + pixman_fixed_1 < 0) *left_pad += 1; else *left_tz += 1; } else if (vx + pixman_fixed_1 >= pixman_int_to_fixed (source_image_width)) { if (vx >= pixman_int_to_fixed (source_image_width)) *right_pad += 1; else *right_tz += 1; } else { *width += 1; } vx += unit_x; } } int main (void) { int i; for (i = 0; i < 10000; i++) { int32_t left_pad1, left_tz1, width1, right_tz1, right_pad1; int32_t left_pad2, left_tz2, width2, right_tz2, right_pad2; pixman_fixed_t vx = lcg_rand_N(10000 << 16) - (3000 << 16); int32_t width = lcg_rand_N(10000); int32_t source_image_width = lcg_rand_N(10000) + 1; pixman_fixed_t unit_x = lcg_rand_N(10 << 16) + 1; width1 = width2 = width; bilinear_pad_repeat_get_scanline_bounds_ref (source_image_width, vx, unit_x, &left_pad1, &left_tz1, &width1, &right_tz1, &right_pad1); bilinear_pad_repeat_get_scanline_bounds (source_image_width, vx, unit_x, &left_pad2, &left_tz2, &width2, &right_tz2, &right_pad2); assert (left_pad1 == left_pad2); assert (left_tz1 == left_tz2); assert (width1 == width2); assert (right_tz1 == right_tz2); assert (right_pad1 == right_pad2); } return 0; }
/* * (C) Copyright IBM Corp. 2004, 2005 * Copyright (c) 2005, Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Author(s): * Carl McAdams <carlmc@us.ibm.com> * Wang Jing <jing.j.wang@intel.com> * * Spec: HPI-B.01.01 * Function: saHpiRdrGet * Description: * Call saHpiRdrGet passing SAHPI_LAST_ENTRY as EntryId. * Expected return: SA_ERR_HPI_INVALID_PARAMS. * Line: P75-25:P75-26 */ #include <stdio.h> #include "saf_test.h" int Test_Resource(SaHpiSessionIdT session_id, SaHpiRptEntryT rpt_entry, callback2_t func) { SaHpiResourceIdT resource_id = rpt_entry.ResourceId; SaHpiEntryIdT next_rdr; SaErrorT val; SaHpiRdrT rdr; int ret = SAF_TEST_UNKNOWN; if ((rpt_entry.ResourceCapabilities & SAHPI_CAPABILITY_RDR)) { val = saHpiRdrGet(session_id, resource_id, SAHPI_LAST_ENTRY, &next_rdr, &rdr); if (val != SA_ERR_HPI_INVALID_PARAMS) { e_print(saHpiRdrGet, SA_ERR_HPI_INVALID_PARAMS, val); ret = SAF_TEST_FAIL; } else { ret = SAF_TEST_PASS; } } else ret = SAF_TEST_NOTSUPPORT; return ret; } int main() { int ret = SAF_TEST_UNKNOWN; ret = process_all_domains(Test_Resource, NULL, NULL); return ret; }
/* * This file Copyright (C) Mnemosyne LLC * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * $Id$ */ #ifndef DETAILS_DIALOG_H #define DETAILS_DIALOG_H #include <QDialog> #include <QString> #include <QMap> #include <QSet> #include <QTimer> #include <QWidgetList> #include "prefs.h" class FileTreeView; class QTreeView; class QComboBox; class QCheckBox; class QDoubleSpinBox; class QLabel; class QRadioButton; class QSpinBox; class QTextBrowser; class QTreeWidget; class QTreeWidgetItem; class Session; class Torrent; class TorrentModel; class TrackerDelegate; class TrackerModel; class TrackerModelFilter; class Details: public QDialog { Q_OBJECT private: void getNewData( ); private slots: void onTorrentChanged( ); void onTimer( ); public: Details( Session&, Prefs&, TorrentModel&, QWidget * parent = 0 ); ~Details( ); void setIds( const QSet<int>& ids ); private: QWidget * createPeersTab( ); QWidget * createTrackerTab( ); QWidget * createInfoTab( ); QWidget * createFilesTab( ); QWidget * createOptionsTab( ); private: QIcon getStockIcon( const QString& freedesktop_name, int fallback ); QString timeToStringRounded( int seconds ); QString trimToDesiredWidth( const QString& str ); void enableWhenChecked( QCheckBox *, QWidget * ); private: Session& mySession; Prefs& myPrefs; TorrentModel& myModel; QSet<int> myIds; QTimer myTimer; bool myChangedTorrents; bool myHavePendingRefresh; QLabel * myStateLabel; QLabel * myHaveLabel; QLabel * myAvailabilityLabel; QLabel * myDownloadedLabel; QLabel * myUploadedLabel; QLabel * myErrorLabel; QLabel * myRunTimeLabel; QLabel * myETALabel; QLabel * myLastActivityLabel; QCheckBox * mySessionLimitCheck; QCheckBox * mySingleDownCheck; QCheckBox * mySingleUpCheck; QCheckBox * myShowTrackerScrapesCheck; QCheckBox * myShowBackupTrackersCheck; QPushButton * myAddTrackerButton; QPushButton * myEditTrackerButton; QPushButton * myRemoveTrackerButton; QSpinBox * mySingleDownSpin; QSpinBox * mySingleUpSpin; QComboBox * myRatioCombo; QDoubleSpinBox * myRatioSpin; QComboBox * myIdleCombo; QSpinBox * myIdleSpin; QSpinBox * myPeerLimitSpin; QComboBox * myBandwidthPriorityCombo; QLabel * mySizeLabel; QLabel * myHashLabel; QLabel * myPrivacyLabel; QLabel * myOriginLabel; QLabel * myLocationLabel; QTextBrowser * myCommentBrowser; QLabel * myTrackerLabel; QLabel * myScrapeTimePrevLabel; QLabel * myScrapeTimeNextLabel; QLabel * myScrapeResponseLabel; QLabel * myAnnounceTimePrevLabel; QLabel * myAnnounceTimeNextLabel; QLabel * myAnnounceResponseLabel; QLabel * myAnnounceManualLabel; TrackerModel * myTrackerModel; TrackerModelFilter * myTrackerFilter; TrackerDelegate * myTrackerDelegate; QTreeView * myTrackerView; //QMap<QString,QTreeWidgetItem*> myTrackerTiers; //QMap<QString,QTreeWidgetItem*> myTrackerItems; QTreeWidget * myPeerTree; QMap<QString,QTreeWidgetItem*> myPeers; QWidgetList myWidgets; FileTreeView * myFileTreeView; private slots: void refreshPref( int key ); void onBandwidthPriorityChanged( int ); void onFilePriorityChanged( const QSet<int>& fileIndices, int ); void onFileWantedChanged( const QSet<int>& fileIndices, bool ); void onHonorsSessionLimitsToggled( bool ); void onDownloadLimitedToggled( bool ); void onSpinBoxEditingFinished( ); void onUploadLimitedToggled( bool ); void onRatioModeChanged( int ); void onIdleModeChanged( int ); void onShowTrackerScrapesToggled( bool ); void onShowBackupTrackersToggled( bool ); void onTrackerSelectionChanged( ); void onAddTrackerClicked( ); void onEditTrackerClicked( ); void onRemoveTrackerClicked( ); void refresh( ); }; #endif
#pragma once /* * Copyright (C) 2005-2013 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "IDirectory.h" namespace XFILE { class CHTTPDirectory : public IDirectory { public: CHTTPDirectory(void); virtual ~CHTTPDirectory(void); virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items); virtual bool Exists(const char* strPath); virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const { return DIR_CACHE_ONCE; }; private: }; }
#ifndef CELL_H #define CELL_H #include <QTableWidgetItem> class Cell : public QTableWidgetItem { public: Cell(); QTableWidgetItem *clone() const; void setData(int role, const QVariant &value); QVariant data(int role) const; void setFormula(const QString &formula); QString formula() const; void setDirty(); private: QVariant value() const; QVariant evalExpression(const QString &str, int &pos) const; QVariant evalTerm(const QString &str, int &pos) const; QVariant evalFactor(const QString &str, int &pos) const; mutable QVariant cachedValue; mutable bool cacheIsDirty; }; #endif
/* * Copyright (C) 2009 RobotCub Consortium, European Commission FP6 Project IST-004370 * Authors: Vadim Tikhanoff & Ajay Mishra * email: vadim.tikhanoff@iit.it * website: www.robotcub.org * Permission is granted to copy, distribute, and/or modify this program * under the terms of the GNU General Public License, version 2 or any * later version published by the Free Software Foundation. * * A copy of the license can be found at * http://www.robotcub.org/icub/license/gpl.txt * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details */ void segFixatedRegion( double*, double*, int, int, int, int, unsigned char*);
/*************************************************************************** cunixsocket.h - UNIX domain socket ------------------- begin : Pi okt 3 2003 copyright : (C) 2003-2009 by Tomas Mecir email : kmuddy@kmuddy.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef CUNIXSOCKET_H #define CUNIXSOCKET_H #include <qobject.h> #include <sys/un.h> class QSocketNotifier; class cRunningScript; class cVariableList; /** This class implements a UNIX domain socket, together with variable manipulation. Everything is done automatically, so the program can just create it and forget it (it just needs to delete it when no longer needed, of course). *@author Tomas Mecir */ class cUnixSocket : public QObject { Q_OBJECT public: cUnixSocket (int _sess, cRunningScript *rs); ~cUnixSocket (); const QString &getName (); protected slots: void readData (int id); void writeData (int id); protected: void processRequest (const QString &type, const QString &data); void sendResult (const QString &result); struct sockaddr_un sa; int sess; cRunningScript *script; /** file name */ QString name; /** things that are to be read/written */ QString readCache, writeCache; /** socket descriptors */ int id, id2; bool connected; /** necessary notifiers */ QSocketNotifier *readnotifier, *writenotifier; /** variable list*/ cVariableList *varlist; }; #endif
/* * (C) Copyright 2009 * jung hyun kim, Nexell Co, <jhkim@nexell.co.kr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/delay.h> #include <linux/hardirq.h> #include <linux/clk.h> #include <linux/platform_device.h> #include <mach/platform.h> #include <mach/devices.h> #include <mach/soc.h> #define RET_ASSERT(_expr_) { \ if (!(_expr_)) { \ printk(KERN_ERR "%s(%d) : %s %s \n", \ __func__, __LINE__, "ASSERT", #_expr_); \ return; \ } \ } static DEFINE_SPINLOCK(lock); void nxp_soc_peri_reset_enter(int id) { unsigned long flags; U32 RSTIndex = id; pr_debug("%s: id=%d\n", __func__, id); RET_ASSERT(RESET_ID_VIP0 >= RSTIndex); if (RESET_ID_CPU1 == RSTIndex || RESET_ID_CPU2 == RSTIndex || RESET_ID_CPU3 == RSTIndex || RESET_ID_DREX == RSTIndex || RESET_ID_DREX_A == RSTIndex || RESET_ID_DREX_C == RSTIndex) { printk("Invalid reset id %d ...\n", RSTIndex); return; } spin_lock_irqsave(&lock, flags); NX_RSTCON_SetBaseAddress((void*)IO_ADDRESS(NX_RSTCON_GetPhysicalAddress())); NX_RSTCON_SetRST(RSTIndex, RSTCON_ASSERT); spin_unlock_irqrestore(&lock, flags); } EXPORT_SYMBOL_GPL(nxp_soc_peri_reset_enter); void nxp_soc_peri_reset_exit(int id) { unsigned long flags; U32 RSTIndex = id; pr_debug("%s: id=%d\n", __func__, id); RET_ASSERT(RESET_ID_VIP0 >= RSTIndex); if (RESET_ID_CPU1 == RSTIndex || RESET_ID_CPU2 == RSTIndex || RESET_ID_CPU3 == RSTIndex || RESET_ID_DREX == RSTIndex || RESET_ID_DREX_A == RSTIndex || RESET_ID_DREX_C == RSTIndex) { printk("Invalid reset id %d ...\n", RSTIndex); return; } spin_lock_irqsave(&lock, flags); NX_RSTCON_SetBaseAddress((void*)IO_ADDRESS(NX_RSTCON_GetPhysicalAddress())); NX_RSTCON_SetRST(RSTIndex, RSTCON_NEGATE); spin_unlock_irqrestore(&lock, flags); } EXPORT_SYMBOL_GPL(nxp_soc_peri_reset_exit); void nxp_soc_peri_reset_set(int id) { unsigned long flags; U32 RSTIndex = id; pr_debug("%s: id=%d\n", __func__, id); RET_ASSERT(RESET_ID_VIP0 >= RSTIndex); if (RESET_ID_CPU1 == RSTIndex || RESET_ID_CPU2 == RSTIndex || RESET_ID_CPU3 == RSTIndex || RESET_ID_DREX == RSTIndex || RESET_ID_DREX_A == RSTIndex || RESET_ID_DREX_C == RSTIndex) { printk("Invalid reset id %d ...\n", RSTIndex); return; } spin_lock_irqsave(&lock, flags); NX_RSTCON_SetBaseAddress((void*)IO_ADDRESS(NX_RSTCON_GetPhysicalAddress())); NX_RSTCON_SetRST(RSTIndex, RSTCON_ASSERT); mdelay(1); NX_RSTCON_SetRST(RSTIndex, RSTCON_NEGATE); spin_unlock_irqrestore(&lock, flags); } EXPORT_SYMBOL_GPL(nxp_soc_peri_reset_set); int nxp_soc_peri_reset_status(int id) { unsigned long flags; U32 RSTIndex = id; int power = 0; pr_debug("%s: id=%d\n", __func__, id); RET_ASSERT_VAL(RESET_ID_VIP0 >= RSTIndex, -EINVAL); spin_lock_irqsave(&lock, flags); NX_RSTCON_SetBaseAddress((void*)IO_ADDRESS(NX_RSTCON_GetPhysicalAddress())); power = NX_RSTCON_GetRST(RSTIndex) ? 1 : 0; spin_unlock_irqrestore(&lock, flags); return power; } EXPORT_SYMBOL_GPL(nxp_soc_peri_reset_status); void nxp_soc_rsc_enter(int id) { nxp_soc_peri_reset_enter(id); } EXPORT_SYMBOL_GPL(nxp_soc_rsc_enter); void nxp_soc_rsc_exit(int id) { nxp_soc_peri_reset_exit(id); } EXPORT_SYMBOL_GPL(nxp_soc_rsc_exit);
/* linux/arch/arm/plat-s5p64xx/include/plat/media.h * * Copyright 2009 Samsung Electronics * Jinsung Yang <jsgood.yang@samsung.com> * http://samsungsemi.com/ * * Samsung Media device descriptions * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _S3C_MEDIA_H #define _S3C_MEDIA_H #include <linux/types.h> #define S3C_MDEV_POST 0 #define S3C_MDEV_MAX 1 struct s3c_media_device { int id; const char *name; size_t memsize; dma_addr_t paddr; }; extern dma_addr_t s3c_get_media_memory(int dev_id); extern size_t s3c_get_media_memsize(int dev_id); #endif
/** * This file is a part of Esperanza, an XMMS2 Client. * * Copyright (C) 2005-2007 XMMS2 Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include "page.h" #include "ui_gui.h" #ifndef _GUI_H_ #define _GUI_H_ class GuiPage : public Page, public Ui::content { public: GuiPage(QWidget *parent = NULL); void saveSettings(); public slots: void showEvent(QShowEvent *ev); }; #endif
/* Samba Unix/Linux SMB client library net time command Copyright (C) 2001 Andrew Tridgell (tridge@samba.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" #include "utils/net.h" /* return the time on a server. This does not require any authentication */ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone) { struct nmb_name calling, called; time_t ret = 0; struct cli_state *cli = NULL; cli = cli_initialise(NULL); if (!cli) goto done; if (!cli_connect(cli, host, ip)) { fprintf(stderr,"Can't contact server\n"); goto done; } make_nmb_name(&calling, global_myname(), 0x0); if (host) { make_nmb_name(&called, host, 0x20); } else { make_nmb_name(&called, "*SMBSERVER", 0x20); } if (!cli_session_request(cli, &calling, &called)) { fprintf(stderr,"Session request failed\n"); goto done; } if (!cli_negprot(cli)) { fprintf(stderr,"Protocol negotiation failed\n"); goto done; } ret = cli->servertime; if (zone) *zone = cli->serverzone; done: if (cli) cli_shutdown(cli); return ret; } /* find the servers time on the opt_host host */ static time_t nettime(int *zone) { return cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, zone); } /* return a time as a string ready to be passed to /bin/date */ static char *systime(time_t t) { static fstring s; struct tm *tm; tm = localtime(&t); fstr_sprintf(s, "%02d%02d%02d%02d%04d.%02d", tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_year + 1900, tm->tm_sec); return s; } int net_time_usage(int argc, const char **argv) { d_printf( "net time\n\tdisplays time on a server\n\n"\ "net time system\n\tdisplays time on a server in a format ready for /bin/date\n\n"\ "net time set\n\truns /bin/date with the time from the server\n\n"\ "net time zone\n\tdisplays the timezone in hours from GMT on the remote computer\n\n"\ "\n"); net_common_flags_usage(argc, argv); return -1; } /* try to set the system clock using /bin/date */ static int net_time_set(int argc, const char **argv) { time_t t = nettime(NULL); char *cmd; if (t == 0) return -1; /* yes, I know this is cheesy. Use "net time system" if you want to roll your own. I'm putting this in as it works on a large number of systems and the user has a choice in whether its used or not */ asprintf(&cmd, "/bin/date %s", systime(t)); system(cmd); free(cmd); return 0; } /* display the time on a remote box in a format ready for /bin/date */ static int net_time_system(int argc, const char **argv) { time_t t = nettime(NULL); if (t == 0) return -1; printf("%s\n", systime(t)); return 0; } /* display the time on a remote box in a format ready for /bin/date */ static int net_time_zone(int argc, const char **argv) { int zone = 0; int hours, mins; char zsign; time_t t; t = nettime(&zone); if (t == 0) return -1; zsign = (zone > 0) ? '-' : '+'; if (zone < 0) zone = -zone; zone /= 60; hours = zone / 60; mins = zone % 60; printf("%c%02d%02d\n", zsign, hours, mins); return 0; } /* display or set the time on a host */ int net_time(int argc, const char **argv) { time_t t; struct functable func[] = { {"SYSTEM", net_time_system}, {"SET", net_time_set}, {"ZONE", net_time_zone}, {NULL, NULL} }; if (!opt_host && !opt_have_ip && !find_master_ip(opt_target_workgroup, &opt_dest_ip)) { d_printf("Could not locate a time server. Try "\ "specifying a target host.\n"); net_time_usage(argc,argv); return -1; } if (argc != 0) { return net_run_function(argc, argv, func, net_time_usage); } /* default - print the time */ t = cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, NULL); if (t == 0) return -1; d_printf("%s", ctime(&t)); return 0; }
#ifndef NAUTILUS_CONTAINER_MAX_WIDTH_H #define NAUTILUS_CONTAINER_MAX_WIDTH_H #include <glib.h> #include <gtk/gtk.h> G_BEGIN_DECLS #define NAUTILUS_TYPE_CONTAINER_MAX_WIDTH (nautilus_container_max_width_get_type()) G_DECLARE_FINAL_TYPE (NautilusContainerMaxWidth, nautilus_container_max_width, NAUTILUS, CONTAINER_MAX_WIDTH, GtkBin) NautilusContainerMaxWidth *nautilus_container_max_width_new (void); void nautilus_container_max_width_set_max_width (NautilusContainerMaxWidth *self, guint max_width); guint nautilus_container_max_width_get_max_width (NautilusContainerMaxWidth *self); G_END_DECLS #endif /* NAUTILUS_CONTAINER_MAX_WIDTH_H */
#include <linux/types.h> #include <mach/mt_pm_ldo.h> #include <cust_alsps.h> #include <mach/upmu_common.h> static struct alsps_hw cust_alsps_hw = { .i2c_num = 1, .polling_mode_ps = 0, /* not work, define in epl8882.c */ .polling_mode_als = 0, /* not work, define in epl8882.c */ .power_id = MT65XX_POWER_NONE, /* LDO is not used */ .power_vol = VOL_DEFAULT, /* LDO is not used */ .i2c_addr = {0x82, 0x48, 0x78, 0x00}, .als_level = {20, 45, 70, 90, 150, 300, 500, 700, 1150, 2250, 4500, 8000, 15000, 30000, 50000}, .als_value = {10, 30, 60, 80, 100, 200, 400, 600, 800, 1500, 3000, 6000, 10000, 20000, 40000, 60000}, .ps_threshold_low = 3500, .ps_threshold_high = 5000, .als_threshold_low = 1000, .als_threshold_high = 1500, }; struct alsps_hw *get_cust_alsps_hw(void) { return &cust_alsps_hw; }
/* Definitions for ARM running Linux-based GNU systems using ELF with old binutils. Copyright (C) 1999 Free Software Foundation, Inc. Contributed by Philip Blundell <Philip.Blundell@pobox.com> This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Unfortunately, owing to various historical accidents, version 2.9.4 and newer of GNU binutils are not quite compatible with the old (2.9.1-based) toolset. This tells linux-elf.h to generate specs appropriate for the older versions. */ #define SUBTARGET_OLD_LINKER
/* * This file is part of the coreboot project. * * Copyright (C) 2007 Advanced Micro Devices, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdint.h> #include <stdlib.h> #include <spd.h> #include <device/pci_def.h> #include <arch/io.h> #include <device/pnp_def.h> #include <arch/romcc_io.h> #include <arch/hlt.h> #include <console/console.h> #include <lib.h> #include "cpu/x86/bist.h" #include "cpu/x86/msr.h" #include <cpu/amd/lxdef.h> #include "southbridge/amd/cs5536/cs5536.h" #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) /* The ALIX1.C has no SMBus; the setup is hard-wired. */ static void cs5536_enable_smbus(void) { } #include "southbridge/amd/cs5536/early_setup.c" #include "superio/winbond/w83627hf/early_serial.c" /* The part is a Hynix hy5du121622ctp-d43. * * HY 5D U 12 16 2 2 C <blank> T <blank> P D43 * Hynix * DDR SDRAM (5D) * VDD 2.5 VDDQ 2.5 (U) * 512M 8K REFRESH (12) * x16 (16) * 4banks (2) * SSTL_2 (2) * 4th GEN die (C) * Normal Power Consumption (<blank> ) * TSOP (T) * Single Die (<blank>) * Lead Free (P) * DDR400 3-3-3 (D43) */ /* SPD array */ static const u8 spdbytes[] = { [SPD_ACCEPTABLE_CAS_LATENCIES] = 0x10, [SPD_BANK_DENSITY] = 0x40, [SPD_DEVICE_ATTRIBUTES_GENERAL] = 0xff, [SPD_MEMORY_TYPE] = 7, [SPD_MIN_CYCLE_TIME_AT_CAS_MAX] = 10, /* A guess for the tRAC value */ [SPD_MODULE_ATTRIBUTES] = 0xff, /* FIXME later when we figure out. */ [SPD_NUM_BANKS_PER_SDRAM] = 4, [SPD_PRIMARY_SDRAM_WIDTH] = 8, [SPD_NUM_DIMM_BANKS] = 1, /* ALIX1.C is 1 bank. */ [SPD_NUM_COLUMNS] = 0xa, [SPD_NUM_ROWS] = 3, [SPD_REFRESH] = 0x3a, [SPD_SDRAM_CYCLE_TIME_2ND] = 60, [SPD_SDRAM_CYCLE_TIME_3RD] = 75, [SPD_tRAS] = 40, [SPD_tRCD] = 15, [SPD_tRFC] = 70, [SPD_tRP] = 15, [SPD_tRRD] = 10, }; static u8 spd_read_byte(u8 device, u8 address) { print_debug("spd_read_byte dev "); print_debug_hex8(device); if (device != DIMM0) { print_debug(" returns 0xff\n"); return 0xff; } print_debug(" addr "); print_debug_hex8(address); print_debug(" returns "); print_debug_hex8(spdbytes[address]); print_debug("\n"); return spdbytes[address]; } #define ManualConf 0 /* Do automatic strapped PLL config */ #define PLLMSRhi 0x00001490 /* Manual settings for the PLL */ #define PLLMSRlo 0x02000030 #include "northbridge/amd/lx/raminit.h" #include "northbridge/amd/lx/pll_reset.c" #include "northbridge/amd/lx/raminit.c" #include "lib/generic_sdram.c" #include "cpu/amd/model_lx/cpureginit.c" #include "cpu/amd/model_lx/syspreinit.c" #include "cpu/amd/model_lx/msrinit.c" void main(unsigned long bist) { static const struct mem_controller memctrl[] = { {.channel0 = {DIMM0}}, }; SystemPreInit(); msr_init(); cs5536_early_setup(); /* NOTE: Must do this AFTER cs5536_early_setup()! * It is counting on some early MSR setup for the CS5536. */ cs5536_disable_internal_uart(); w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); console_init(); /* Halt if there was a built in self test failure */ report_bist_failure(bist); pll_reset(ManualConf); cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED); sdram_initialize(1, memctrl); /* Switch from Cache as RAM to real RAM. * * There are two ways we could think about this. * * 1. If we are using the romstage.inc ROMCC way, the stack is * going to be re-setup in the code following this code. Just * wbinvd the stack to clear the cache tags. We don't care * where the stack used to be. * * 2. This file is built as a normal .c -> .o and linked in * etc. The stack might be used to return etc. That means we * care about what is in the stack. If we are smart we set * the CAR stack to the same location as the rest of * coreboot. If that is the case we can just do a wbinvd. * The stack will be written into real RAM that is now setup * and we continue like nothing happened. If the stack is * located somewhere other than where LB would like it, you * need to write some code to do a copy from cache to RAM * * We use method 1 on Norwich and on this board too. */ post_code(0x02); print_err("POST 02\n"); __asm__("wbinvd\n"); print_err("Past wbinvd\n"); /* We are finding the return does not work on this board. Explicitly * call the label that is after the call to us. This is gross, but * sometimes at this level it is the only way out. */ void done_cache_as_ram_main(void); done_cache_as_ram_main(); }
/* SPDX-License-Identifier: GPL-2.0-only */ #include <device/azalia_device.h> const u32 cim_verb_data[] = { /* Realtek, ALC293 */ 0x10ec0293, /* Vendor ID */ 0x155851a1, /* Subsystem ID */ 12, /* Number of entries */ AZALIA_SUBVENDOR(0, 0x155851a1), AZALIA_PIN_CFG(0, 0x12, 0x90a60130), AZALIA_PIN_CFG(0, 0x13, 0x40000000), AZALIA_PIN_CFG(0, 0x14, 0x90170110), AZALIA_PIN_CFG(0, 0x15, 0x02211020), AZALIA_PIN_CFG(0, 0x16, 0x411111f0), AZALIA_PIN_CFG(0, 0x18, 0x411111f0), AZALIA_PIN_CFG(0, 0x19, 0x411111f0), AZALIA_PIN_CFG(0, 0x1a, 0x411111f0), AZALIA_PIN_CFG(0, 0x1b, 0x411111f0), AZALIA_PIN_CFG(0, 0x1d, 0x40738205), AZALIA_PIN_CFG(0, 0x1e, 0x411111f0), }; const u32 pc_beep_verbs[] = {}; AZALIA_ARRAY_SIZES;
#ifndef __ASM_MIPS_FCNTL_H #define __ASM_MIPS_FCNTL_H /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ #define O_ACCMODE 0x0003 #define O_RDONLY 0x0000 #define O_WRONLY 0x0001 #define O_RDWR 0x0002 #define O_APPEND 0x0008 #define O_SYNC 0x0010 #define O_NONBLOCK 0x0080 #define O_CREAT 0x0100 /* not fcntl */ #define O_TRUNC 0x0200 /* not fcntl */ #define O_EXCL 0x0400 /* not fcntl */ #define O_NOCTTY 0x0800 /* not fcntl */ #define FASYNC 0x1000 /* fcntl, for BSD compatibility */ #define O_NDELAY O_NONBLOCK #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ #define F_SETFD 2 /* set f_flags */ #define F_GETFL 3 /* more flags (cloexec) */ #define F_SETFL 4 #define F_GETLK 14 #define F_SETLK 6 #define F_SETLKW 7 #define F_SETOWN 24 /* for sockets. */ #define F_GETOWN 23 /* for sockets. */ /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ /* for posix fcntl() and lockf() */ #define F_RDLCK 0 #define F_WRLCK 1 #define F_UNLCK 2 /* for old implementation of bsd flock () */ #define F_EXLCK 4 /* or 3 */ #define F_SHLCK 8 /* or 4 */ /* operations for bsd flock(), also used by the kernel implementation */ #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ #define LOCK_NB 4 /* or'd with one of the above to prevent XXXXXXXXXXXXXXXXXX blocking */ #define LOCK_UN 8 /* remove lock */ #ifdef __KERNEL__ #define F_POSIX 1 #define F_FLOCK 2 #define F_BROKEN 4 /* broken flock() emulation */ #endif /* __KERNEL__ */ typedef struct flock { short l_type; short l_whence; off_t l_start; off_t l_len; long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */ pid_t l_pid; long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */ } flock_t; #endif /* __ASM_MIPS_FCNTL_H */
// Copyright (C) 2009,2010,2011,2012 GlavSoft LLC. // All rights reserved. // //------------------------------------------------------------------------- // This file is part of the TightVNC software. Please visit our Web site: // // http://www.tightvnc.com/ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. //------------------------------------------------------------------------- // #ifndef _TVN_SERVER_LISTENER_H_ #define _TVN_SERVER_LISTENER_H_ /** * Listener of TightVNC server (TvnServer class) events. */ class TvnServerListener { public: /** * Destructor, does nothing. */ virtual ~TvnServerListener(); /** * Slot of TvnServer shutdown signal (generated in TvnServer::shutdown() method). */ virtual void onTvnServerShutdown() = 0; }; #endif
/* * arch/arm/mach-orion5x/rd88f6183-ap-ge-setup.c * * Marvell Orion-1-90 AP GE Reference Design Setup * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #include <linux/gpio.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/pci.h> #include <linux/irq.h> #include <linux/mtd/physmap.h> #include <linux/mv643xx_eth.h> #include <linux/spi/spi.h> #include <linux/spi/orion_spi.h> #include <linux/spi/flash.h> #include <linux/ethtool.h> #include <net/dsa.h> #include <asm/mach-types.h> #include <asm/leds.h> #include <asm/mach/arch.h> #include <asm/mach/pci.h> #include <mach/orion5x.h> #include "common.h" static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = { .phy_addr = -1, .speed = SPEED_1000, .duplex = DUPLEX_FULL, }; static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = { .port_names[0] = "lan1", .port_names[1] = "lan2", .port_names[2] = "lan3", .port_names[3] = "lan4", .port_names[4] = "wan", .port_names[5] = "cpu", }; static struct dsa_platform_data rd88f6183ap_ge_switch_plat_data = { .nr_chips = 1, .chip = &rd88f6183ap_ge_switch_chip_data, }; static struct mtd_partition rd88f6183ap_ge_partitions[] = { { .name = "kernel", .offset = 0x00000000, .size = 0x00200000, }, { .name = "rootfs", .offset = 0x00200000, .size = 0x00500000, }, { .name = "nvram", .offset = 0x00700000, .size = 0x00080000, }, }; static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = { .type = "m25p64", .nr_parts = ARRAY_SIZE(rd88f6183ap_ge_partitions), .parts = rd88f6183ap_ge_partitions, }; static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = { { .modalias = "m25p80", .platform_data = &rd88f6183ap_ge_spi_slave_data, .irq = NO_IRQ, .max_speed_hz = 20000000, .bus_num = 0, .chip_select = 0, }, }; static void __init rd88f6183ap_ge_init(void) { /* * Setup basic Orion functions. Need to be called early. */ orion5x_init(); /* * Configure peripherals. */ orion5x_ehci0_init(); orion5x_eth_init(&rd88f6183ap_ge_eth_data); orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data, gpio_to_irq(3)); spi_register_board_info(rd88f6183ap_ge_spi_slave_info, ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info)); orion5x_spi_init(); orion5x_uart0_init(); } static struct hw_pci rd88f6183ap_ge_pci __initdata = { .nr_controllers = 2, .setup = orion5x_pci_sys_setup, .scan = orion5x_pci_sys_scan_bus, .map_irq = orion5x_pci_map_irq, }; static int __init rd88f6183ap_ge_pci_init(void) { if (machine_is_rd88f6183ap_ge()) { orion5x_pci_disable(); pci_common_init(&rd88f6183ap_ge_pci); } return 0; } subsys_initcall(rd88f6183ap_ge_pci_init); MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design") /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */ .atag_offset = 0x100, .init_machine = rd88f6183ap_ge_init, .map_io = orion5x_map_io, .init_early = orion5x_init_early, .init_irq = orion5x_init_irq, .timer = &orion5x_timer, .fixup = tag_fixup_mem32, .restart = orion5x_restart, MACHINE_END
/* $NetBSD: rent.c,v 1.6 2003/08/07 09:37:29 agc Exp $ */ /* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)rent.c 8.1 (Berkeley) 5/31/93"; #else __RCSID("$NetBSD: rent.c,v 1.6 2003/08/07 09:37:29 agc Exp $"); #endif #endif /* not lint */ #include "monop.ext" /* * This routine has the player pay rent */ void rent(sqp) SQUARE *sqp; { int rnt = 0; PROP *pp; PLAY *plp; plp = &play[sqp->owner]; printf("Owned by %s\n", plp->name); if (sqp->desc->morg) { lucky("The thing is mortgaged. "); return; } switch (sqp->type) { case PRPTY: pp = sqp->desc; if (pp->monop) if (pp->houses == 0) printf("rent is %d\n", rnt=pp->rent[0] * 2); else if (pp->houses < 5) printf("with %d houses, rent is %d\n", pp->houses, rnt=pp->rent[pp->houses]); else printf("with a hotel, rent is %d\n", rnt=pp->rent[pp->houses]); else printf("rent is %d\n", rnt = pp->rent[0]); break; case RR: rnt = 25; rnt <<= (plp->num_rr - 1); if (spec) rnt <<= 1; printf("rent is %d\n", rnt); break; case UTIL: rnt = roll(2, 6); if (plp->num_util == 2 || spec) { printf("rent is 10 * roll (%d) = %d\n", rnt, rnt * 10); rnt *= 10; } else { printf("rent is 4 * roll (%d) = %d\n", rnt, rnt * 4); rnt *= 4; } break; } cur_p->money -= rnt; plp->money += rnt; }
/* * Copyright (C) 2003,2004 Colin Walters <walters@verbum.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The Rhythmbox authors hereby grant permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer * and Rhythmbox. This permission is above and beyond the permissions granted * by the GPL license by which Rhythmbox is covered. If you modify this code * you may extend this exception to your version of the code, but you are not * obligated to do so. If you do not wish to do so, delete this exception * statement from your version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __RB_PLAYLIST_MANAGER_H #define __RB_PLAYLIST_MANAGER_H #include <sources/rb-source.h> #include <sources/rb-display-page-model.h> #include <sources/rb-display-page-tree.h> #include <shell/rb-shell.h> #include <rhythmdb/rhythmdb.h> G_BEGIN_DECLS #define RB_TYPE_PLAYLIST_MANAGER (rb_playlist_manager_get_type ()) #define RB_PLAYLIST_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_PLAYLIST_MANAGER, RBPlaylistManager)) #define RB_PLAYLIST_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_PLAYLIST_MANAGER, RBPlaylistManagerClass)) #define RB_IS_PLAYLIST_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_PLAYLIST_MANAGER)) #define RB_IS_PLAYLIST_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_PLAYLIST_MANAGER)) #define RB_PLAYLIST_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_PLAYLIST_MANAGER, RBPlaylistManagerClass)) typedef enum { RB_PLAYLIST_MANAGER_ERROR_PARSE, RB_PLAYLIST_MANAGER_ERROR_PLAYLIST_EXISTS, RB_PLAYLIST_MANAGER_ERROR_PLAYLIST_NOT_FOUND } RBPlaylistManagerError; #define RB_PLAYLIST_MANAGER_ERROR rb_playlist_manager_error_quark () GQuark rb_playlist_manager_error_quark (void); typedef struct _RBPlaylistManager RBPlaylistManager; typedef struct _RBPlaylistManagerClass RBPlaylistManagerClass; typedef struct RBPlaylistManagerPrivate RBPlaylistManagerPrivate; struct _RBPlaylistManager { GObject parent; RBPlaylistManagerPrivate *priv; }; struct _RBPlaylistManagerClass { GObjectClass parent_class; /* signals */ void (*playlist_added) (RBPlaylistManager *manager, RBSource *source); void (*playlist_created) (RBPlaylistManager *manager, RBSource *source); void (*load_start) (RBPlaylistManager *manager); void (*load_finish) (RBPlaylistManager *manager); }; typedef enum { RB_PLAYLIST_EXPORT_TYPE_UNKNOWN, RB_PLAYLIST_EXPORT_TYPE_M3U, RB_PLAYLIST_EXPORT_TYPE_PLS, RB_PLAYLIST_EXPORT_TYPE_XSPF, } RBPlaylistExportType; GType rb_playlist_manager_get_type (void); RBPlaylistManager * rb_playlist_manager_new (RBShell *shell, const char *playlists_file); void rb_playlist_manager_shutdown (RBPlaylistManager *mgr); gboolean rb_playlist_manager_parse_file (RBPlaylistManager *mgr, const char *uri, GError **error); void rb_playlist_manager_load_playlists (RBPlaylistManager *mgr); gboolean rb_playlist_manager_save_playlists (RBPlaylistManager *mgr, gboolean force); RBSource * rb_playlist_manager_new_playlist (RBPlaylistManager *mgr, const char *suggested_name, gboolean automatic); RBSource * rb_playlist_manager_new_playlist_from_selection_data (RBPlaylistManager *mgr, GtkSelectionData *data); GList * rb_playlist_manager_get_playlists (RBPlaylistManager *mgr); gboolean rb_playlist_manager_get_playlist_names (RBPlaylistManager *mgr, gchar ***playlists, GError **error); gboolean rb_playlist_manager_create_static_playlist (RBPlaylistManager *mgr, const gchar *name, GError **error); gboolean rb_playlist_manager_delete_playlist (RBPlaylistManager *mgr, const gchar *name, GError **error); gboolean rb_playlist_manager_add_to_playlist (RBPlaylistManager *mgr, const gchar *name, const gchar *uri, GError **error); gboolean rb_playlist_manager_remove_from_playlist (RBPlaylistManager *mgr, const gchar *name, const gchar *uri, GError **error); gboolean rb_playlist_manager_export_playlist (RBPlaylistManager *mgr, const gchar *name, const gchar *uri, gboolean m3u_format, GError **error); void rb_playlist_manager_save_playlist_file (RBPlaylistManager *mgr, RBSource *source); G_END_DECLS #endif /* __RB_PLAYLIST_MANAGER_H */
/* * steghide 0.5.1 - a steganography program * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef SH_ENCMODE_H #define SH_ENCMODE_H #include <string> class EncryptionMode { public: /// number of bits needed to code the mode static const unsigned int IRep_size = 3 ; /// integer representation of encryption mode enum IRep { ECB = 0, CBC = 1, OFB = 2, CFB = 3, NOFB = 4, NCFB = 5, CTR = 6, STREAM = 7 } ; /** * construct a new EncryptionMode object setting Value to ECB **/ EncryptionMode (void) ; EncryptionMode (IRep irep) ; /** * construct a new EncryptionMode object from a std::string representation * \param srep a valid(!) std::string representation **/ EncryptionMode (std::string srep) ; void setValue (IRep irep) ; std::string getStringRep (void) const ; IRep getIntegerRep (void) const ; bool operator== (const EncryptionMode& mode) const { return (Value == mode.Value) ; } ; static bool isValidStringRep (std::string srep) ; static bool isValidIntegerRep (unsigned int irep) ; static std::string translate (IRep irep) ; static IRep translate (std::string srep) ; private: static const unsigned int NumValues = 8 ; IRep Value ; typedef struct struct_Translation { IRep irep ; char* srep ; } Translation ; static const Translation Translations[] ; } ; #endif // ndef SH_ENCMODE_H
#ifndef _ASMARM_BUG_H #define _ASMARM_BUG_H #include <linux/linkage.h> #include <linux/types.h> #include <asm/opcodes.h> #ifdef CONFIG_BUG /* * Use a suitable undefined instruction to use for ARM/Thumb2 bug handling. * We need to be careful not to conflict with those used by other modules and * the register_undef_hook() system. */ #ifdef CONFIG_THUMB2_KERNEL #define BUG_INSTR_VALUE 0xde02 #define BUG_INSTR(__value) __inst_thumb16(__value) #else #define BUG_INSTR_VALUE 0xe7f001f2 #define BUG_INSTR(__value) __inst_arm(__value) #endif // ARM10C 20131005 // ARM10C 20150711 #define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE) // ARM10C 20150711 #define _BUG(file, line, value) __BUG(file, line, value) #ifdef CONFIG_DEBUG_BUGVERBOSE // CONFIG_DEBUG_BUGVERBOSE=y /* * The extra indirection is to ensure that the __FILE__ string comes through * OK. Many version of gcc do not support the asm %c parameter which would be * preferable to this unpleasantness. We use mergeable string sections to * avoid multiple copies of the string appearing in the kernel image. */ // ARM10C 20131005 // ARM10C 20150711 #define __BUG(__file, __line, __value) \ do { \ asm volatile("1:\t" BUG_INSTR(__value) "\n" \ ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ "2:\t.asciz " #__file "\n" \ ".popsection\n" \ ".pushsection __bug_table,\"a\"\n" \ "3:\t.word 1b, 2b\n" \ "\t.hword " #__line ", 0\n" \ ".popsection"); \ unreachable(); \ } while (0) #else /* not CONFIG_DEBUG_BUGVERBOSE */ #define __BUG(__file, __line, __value) \ do { \ asm volatile(BUG_INSTR(__value) "\n"); \ unreachable(); \ } while (0) #endif /* CONFIG_DEBUG_BUGVERBOSE */ #define HAVE_ARCH_BUG #endif /* CONFIG_BUG */ #include <asm-generic/bug.h> struct pt_regs; void die(const char *msg, struct pt_regs *regs, int err); struct siginfo; void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, unsigned long err, unsigned long trap); #ifdef CONFIG_ARM_LPAE #define FAULT_CODE_ALIGNMENT 33 #define FAULT_CODE_DEBUG 34 #else #define FAULT_CODE_ALIGNMENT 1 #define FAULT_CODE_DEBUG 2 #endif void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *), int sig, int code, const char *name); void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *), int sig, int code, const char *name); extern asmlinkage void c_backtrace(unsigned long fp, int pmode); struct mm_struct; extern void show_pte(struct mm_struct *mm, unsigned long addr); extern void __show_regs(struct pt_regs *); #endif
/* * I2C bus driver for ADT7316/7/8 ADT7516/7/9 digital temperature * sensor, ADC and DAC * * Copyright 2010 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #include <linux/device.h> #include <linux/kernel.h> #include <linux/i2c.h> #include <linux/interrupt.h> #include "adt7316.h" /* * adt7316 register access by I2C */ static int adt7316_i2c_read(void *client, u8 reg, u8 *data) { struct i2c_client *cl = client; int ret = 0; ret = i2c_smbus_write_byte(cl, reg); if (ret < 0) { dev_err(&cl->dev, "I2C fail to select reg\n"); return ret; } ret = i2c_smbus_read_byte(client); if (ret < 0) { dev_err(&cl->dev, "I2C read error\n"); return ret; } return 0; } static int adt7316_i2c_write(void *client, u8 reg, u8 data) { struct i2c_client *cl = client; int ret = 0; ret = i2c_smbus_write_byte_data(cl, reg, data); if (ret < 0) dev_err(&cl->dev, "I2C write error\n"); return ret; } static int adt7316_i2c_multi_read(void *client, u8 reg, u8 count, u8 *data) { struct i2c_client *cl = client; int i, ret = 0; if (count > ADT7316_REG_MAX_ADDR) count = ADT7316_REG_MAX_ADDR; for (i = 0; i < count; i++) { ret = adt7316_i2c_read(cl, reg, &data[i]); if (ret < 0) { dev_err(&cl->dev, "I2C multi read error\n"); return ret; } } return 0; } static int adt7316_i2c_multi_write(void *client, u8 reg, u8 count, u8 *data) { struct i2c_client *cl = client; int i, ret = 0; if (count > ADT7316_REG_MAX_ADDR) count = ADT7316_REG_MAX_ADDR; for (i = 0; i < count; i++) { ret = adt7316_i2c_write(cl, reg, data[i]); if (ret < 0) { dev_err(&cl->dev, "I2C multi write error\n"); return ret; } } return 0; } /* * device probe and remove */ static int __devinit adt7316_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct adt7316_bus bus = { .client = client, .irq = client->irq, .irq_flags = IRQF_TRIGGER_LOW, .read = adt7316_i2c_read, .write = adt7316_i2c_write, .multi_read = adt7316_i2c_multi_read, .multi_write = adt7316_i2c_multi_write, }; return adt7316_probe(&client->dev, &bus, id->name); } static int __devexit adt7316_i2c_remove(struct i2c_client *client) { return adt7316_remove(&client->dev); } static const struct i2c_device_id adt7316_i2c_id[] = { { "adt7316", 0 }, { "adt7317", 0 }, { "adt7318", 0 }, { "adt7516", 0 }, { "adt7517", 0 }, { "adt7519", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id); #ifdef CONFIG_PM static int adt7316_i2c_suspend(struct i2c_client *client, pm_message_t message) { return adt7316_disable(&client->dev); } static int adt7316_i2c_resume(struct i2c_client *client) { return adt7316_enable(&client->dev); } #else # define adt7316_i2c_suspend NULL # define adt7316_i2c_resume NULL #endif static struct i2c_driver adt7316_driver = { .driver = { .name = "adt7316", .owner = THIS_MODULE, }, .probe = adt7316_i2c_probe, .remove = __devexit_p(adt7316_i2c_remove), .suspend = adt7316_i2c_suspend, .resume = adt7316_i2c_resume, .id_table = adt7316_i2c_id, }; module_i2c_driver(adt7316_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("I2C bus driver for Analog Devices ADT7316/7/9 and" "ADT7516/7/8 digital temperature sensor, ADC and DAC"); MODULE_LICENSE("GPL v2");
/* * Copyright (C) 2004-2012 Freescale Semiconductor, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ASM_ARCH_MXC_COMMON_H__ #define __ASM_ARCH_MXC_COMMON_H__ struct fec_platform_data; struct platform_device; struct clk; extern char *gp_reg_id; extern void mx1_map_io(void); extern void mx21_map_io(void); extern void mx25_map_io(void); extern void mx27_map_io(void); extern void mx31_map_io(void); extern void mx35_map_io(void); extern void mx50_map_io(void); extern void mx51_map_io(void); extern void mx53_map_io(void); extern void mx6_map_io(void); extern void mxc91231_map_io(void); extern void imx1_init_early(void); extern void imx21_init_early(void); extern void imx25_init_early(void); extern void imx27_init_early(void); extern void imx31_init_early(void); extern void imx35_init_early(void); extern void imx50_init_early(void); extern void imx51_init_early(void); extern void imx53_init_early(void); extern void mxc91231_init_early(void); extern void mxc_init_irq(void __iomem *); extern void tzic_init_irq(void __iomem *); extern void mx1_init_irq(void); extern void mx21_init_irq(void); extern void mx25_init_irq(void); extern void mx27_init_irq(void); extern void mx31_init_irq(void); extern void mx35_init_irq(void); extern void mx50_init_irq(void); extern void mx51_init_irq(void); extern void mx53_init_irq(void); extern void mx6_init_irq(void); extern void mxc91231_init_irq(void); extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); extern int mx1_clocks_init(unsigned long fref); extern int mx21_clocks_init(unsigned long lref, unsigned long fref); extern int mx25_clocks_init(void); extern int mx27_clocks_init(unsigned long fref); extern int mx31_clocks_init(unsigned long fref); extern int mx35_clocks_init(void); extern int mx51_clocks_init(unsigned long ckil, unsigned long osc, unsigned long ckih1, unsigned long ckih2); extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, unsigned long ckih1, unsigned long ckih2); extern int mx50_clocks_init(unsigned long ckil, unsigned long osc, unsigned long ckih1); extern int mx6_clocks_init(unsigned long ckil, unsigned long osc, unsigned long ckih1, unsigned long ckih2); extern void imx6_init_fec(struct fec_platform_data fec_data); extern int mxc91231_clocks_init(unsigned long fref); extern int mxc_register_gpios(void); extern int mxc_register_device(struct platform_device *pdev, void *data); extern void mxc_set_cpu_type(unsigned int type); extern void mxc_arch_reset_init(void __iomem *); extern void mxc91231_power_off(void); extern void mxc91231_arch_reset(int, const char *); extern void mxc91231_prepare_idle(void); extern void mx51_efikamx_reset(void); extern int mx53_revision(void); extern int mx50_revision(void); extern int mx53_display_revision(void); extern unsigned long mx6_timer_rate(void); extern int mxs_reset_block(void __iomem *); extern void early_console_setup(unsigned long base, struct clk *clk); extern void mx6_cpu_regulator_init(void); extern int mx6q_sabreauto_init_pfuze100(u32 int_gpio); extern int mx6q_sabresd_init_pfuze100(u32 int_gpio); #endif
/* $Id: st.c,v 1.9 2009/11/22 15:36:27 rhabarber1848 Exp $ DVBSNOOP a dvb sniffer and mpeg2 stream analyzer tool http://dvbsnoop.sourceforge.net/ (c) 2001-2006 Rainer.Scherg@gmx.de (rasc) -- ST section (stuffing) */ #include "dvbsnoop.h" #include "st.h" #include "strings/dvb_str.h" #include "misc/output.h" #include "misc/hexprint.h" /* -- ST section (stuffing) -- ETSI EN 300 468 5.2.8 */ void section_ST (u_char *b, int len) { typedef struct _ST { u_int table_id; u_int section_syntax_indicator; u_int reserved_1; u_int reserved_2; u_int section_length; // N databytes } ST; ST s; s.table_id = b[0]; s.section_syntax_indicator = getBits (b, 0, 8, 1); s.reserved_1 = getBits (b, 0, 9, 1); s.reserved_2 = getBits (b, 0, 10, 2); s.section_length = getBits (b, 0, 12, 12); out_nl (3,"ST-decoding...."); out_S2B_NL (3,"Table_ID: ",s.table_id, dvbstrTableID (s.table_id)); if (s.table_id != 0x72) { out_nl (3,"wrong Table ID"); return; } out_SB_NL (3,"section_syntax_indicator: ",s.section_syntax_indicator); out_SB_NL (6,"reserved_1: ",s.reserved_1); out_SB_NL (6,"reserved_2: ",s.reserved_2); out_SW_NL (5,"Section_length: ",s.section_length); b += 3; print_databytes (3,"Section data:", b, s.section_length); }
/* * Hydrogen * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net] * * http://www.hydrogen-music.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY, without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SMF_EVENT_H #define SMF_EVENT_H #include <vector> #include <hydrogen/object.h> namespace H2Core { class SMFBuffer : public H2Core::Object { H2_OBJECT public: std::vector<char> getBuffer() { return m_buffer; } void writeByte( short int nByte ); void writeWord( int nVal ); void writeDWord( long nVal ); void writeString( const QString& sMsg ); void writeVarLen( long nVal ); std::vector<char> m_buffer; SMFBuffer(); }; enum SMFEventType { NOTE_OFF = 128, NOTE_ON = 144 }; enum SMFMetaEventType { SEQUENCE_NUMBER = 0, TEXT_EVENT, COPYRIGHT_NOTICE, TRACK_NAME, INSTRUMENT_NAME, LYRIC, MARKER, CUE_POINT, END_OF_TRACK = 0x2f, SET_TEMPO = 0x51, TIME_SIGNATURE = 0x58, KEY_SIGNATURE }; class SMFBase { public: virtual ~SMFBase() {} virtual std::vector<char> getBuffer() = 0; }; class SMFEvent : public SMFBase, public H2Core::Object { H2_OBJECT public: SMFEvent( const char* sEventName, unsigned nTicks ); virtual ~SMFEvent(); int m_nTicks; int m_nDeltaTime; }; class SMFTrackNameMetaEvent : public SMFEvent { H2_OBJECT public: SMFTrackNameMetaEvent( const QString& sTrackName, unsigned nDeltaTime ); virtual std::vector<char> getBuffer(); private: QString m_sTrackName; }; class SMFNoteOnEvent : public SMFEvent { H2_OBJECT public: SMFNoteOnEvent( unsigned nTicks, int nChannel, int nPitch, int nVelocity ); virtual std::vector<char> getBuffer(); protected: unsigned m_nChannel; unsigned m_nPitch; unsigned m_nVelocity; }; class SMFNoteOffEvent : public SMFEvent { H2_OBJECT public: SMFNoteOffEvent( unsigned nTicks, int nChannel, int nPitch, int nVelocity ); virtual std::vector<char> getBuffer(); protected: unsigned m_nChannel; unsigned m_nPitch; unsigned m_nVelocity; }; }; #endif
#ifndef COMMANDS_H #define COMMANDS_H /** \cond docNever */ #include <QUndoCommand> #include "xbytearray.h" /*! CharCommand is a class to prived undo/redo functionality in QHexEdit. A QUndoCommand represents a single editing action on a document. CharCommand is responsable for manipulations on single chars. It can insert. replace and remove characters. A manipulation stores allways to actions 1. redo (or do) action 2. undo action. CharCommand also supports command compression via mergeWidht(). This allows the user to execute a undo command contation e.g. 3 steps in a single command. If you for example insert a new byt "34" this means for the editor doing 3 steps: insert a "00", replace it with "03" and the replace it with "34". These 3 steps are combined into a single step, insert a "34". */ class CharCommand : public QUndoCommand { public: enum { Id = 1234 }; enum Cmd {insert, remove, replace}; CharCommand(XByteArray * xData, Cmd cmd, int charPos, char newChar, QUndoCommand *parent=0); void undo(); void redo(); bool mergeWith(const QUndoCommand *command); int id() const { return Id; } private: XByteArray * _xData; int _charPos; bool _wasChanged; char _newChar; char _oldChar; Cmd _cmd; }; /*! ArrayCommand provides undo/redo functionality for handling binary strings. It can undo/redo insert, replace and remove binary strins (QByteArrays). */ class ArrayCommand : public QUndoCommand { public: enum Cmd {insert, remove, replace}; ArrayCommand(XByteArray * xData, Cmd cmd, int baPos, QByteArray newBa=QByteArray(), int len=0, QUndoCommand *parent=0); void undo(); void redo(); private: Cmd _cmd; XByteArray * _xData; int _baPos; int _len; QByteArray _wasChanged; QByteArray _newBa; QByteArray _oldBa; }; /** \endcond docNever */ #endif // COMMANDS_H
/* Test of opening a file stream. Copyright (C) 2007-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <stdio.h> #include "signature.h" SIGNATURE_CHECK (freopen, FILE *, (char const *, char const *, FILE *)); #include <errno.h> #include <unistd.h> #include "macros.h" int main () { const char *filename = "test-freopen.txt"; ASSERT (freopen ("/dev/null", "r", stdin) != NULL); #if 0 /* freopen (NULL, ...) is unsupported on most platforms. */ /* Test that freopen() sets errno if someone else closes the stream fd behind the back of stdio. */ { FILE *fp = fopen (filename, "w+"); ASSERT (fp != NULL); ASSERT (close (fileno (fp)) == 0); errno = 0; ASSERT (freopen (NULL, "r", fp) == NULL); perror("freopen"); ASSERT (errno == EBADF); fclose (fp); } /* Test that freopen() sets errno if the stream was constructed with an invalid file descriptor. */ { FILE *fp = fdopen (-1, "w+"); if (fp != NULL) { errno = 0; ASSERT (freopen (NULL, "r", fp) == NULL); ASSERT (errno == EBADF); fclose (fp); } } { FILE *fp; close (99); fp = fdopen (99, "w+"); if (fp != NULL) { errno = 0; ASSERT (freopen (NULL, "r", fp) == NULL); ASSERT (errno == EBADF); fclose (fp); } } #endif /* Clean up. */ unlink (filename); return 0; }
/* * * Copyright (c) 2008 by Christian Dietrich <stettberger@dokucode.de> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * For more information on the GPL, please go to: * http://www.gnu.org/copyleft/gpl.html */ #ifndef YPORT_NET_H #define YPORT_NET_H void yport_net_init(void); void yport_net_main(void); #endif /* YPORT_NET_H */
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "CellInfo-LCR-r8-ext.h" static asn_TYPE_member_t asn_MBR_CellInfo_LCR_r8_ext_1[] = { { ATF_POINTER, 1, offsetof(struct CellInfo_LCR_r8_ext, cellSelectionReselectionInfo), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_CellSelectReselectInfoMC_RSCP, 0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */ 0, "cellSelectionReselectionInfo" }, }; static int asn_MAP_CellInfo_LCR_r8_ext_oms_1[] = { 0 }; static ber_tlv_tag_t asn_DEF_CellInfo_LCR_r8_ext_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_TYPE_tag2member_t asn_MAP_CellInfo_LCR_r8_ext_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* cellSelectionReselectionInfo at 13119 */ }; static asn_SEQUENCE_specifics_t asn_SPC_CellInfo_LCR_r8_ext_specs_1 = { sizeof(struct CellInfo_LCR_r8_ext), offsetof(struct CellInfo_LCR_r8_ext, _asn_ctx), asn_MAP_CellInfo_LCR_r8_ext_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_CellInfo_LCR_r8_ext_oms_1, /* Optional members */ 1, 0, /* Root/Additions */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_CellInfo_LCR_r8_ext = { "CellInfo-LCR-r8-ext", "CellInfo-LCR-r8-ext", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CellInfo_LCR_r8_ext_tags_1, sizeof(asn_DEF_CellInfo_LCR_r8_ext_tags_1) /sizeof(asn_DEF_CellInfo_LCR_r8_ext_tags_1[0]), /* 1 */ asn_DEF_CellInfo_LCR_r8_ext_tags_1, /* Same as above */ sizeof(asn_DEF_CellInfo_LCR_r8_ext_tags_1) /sizeof(asn_DEF_CellInfo_LCR_r8_ext_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_CellInfo_LCR_r8_ext_1, 1, /* Elements count */ &asn_SPC_CellInfo_LCR_r8_ext_specs_1 /* Additional specs */ };
#include "readline.h" #include <stddef.h> #include "unistd/read.h" extern void *memmove(void *dest, const void *src, __SIZE_TYPE__ n); extern char* memchr(char* buf, int c, __SIZE_TYPE__ n); const char* _readline(int fd, struct rdline_buffer* buf) { if (buf->next != 0) { memmove(buf->buffer, buf->buffer + buf->next, buf->usage - buf->next); buf->usage -= buf->next; buf->next = 0; } int eof = 0; while (1) { if (buf->usage > 0) { char* p = (char*) memchr(buf->buffer, '\n', buf->usage); if (p) { *p = '\0'; buf->next = p + 1 - buf->buffer; return buf->buffer; } else if (eof) { buf->buffer[buf->usage] = '\0'; // this is OK, because we never fully fill the buffer buf->usage = 0; return buf->buffer; } } else if (eof) return NULL; int count = sys_read_nocancel(fd, buf->buffer + buf->usage, sizeof(buf->buffer) - buf->usage - 1); if (count < 0) return NULL; else if (count == 0) eof = 1; buf->usage += count; } } void _readline_init(struct rdline_buffer* buf) { buf->usage = 0; buf->next = 0; }
#ifndef DEF_BLAST_PARSER_H #define DEF_BLAST_PARSER_H /** * \file blastParser.h * \author Lukas Habegger (lukas.habegger@yale.edu) */ /** * BlastQuery. */ typedef struct { char* qName; Array entries; // of type BlastEntry } BlastQuery; /** * BlastEntry. */ typedef struct { char* tName; double percentIdentity; int alignmentLength; int misMatches; int gapOpenings; int qStart; int qEnd; int tStart; int tEnd; double evalue; double bitScore; } BlastEntry; extern void blastParser_initFromFile (char* fileName); extern void blastParser_initFromPipe (char* command); extern void blastParser_deInit (void); extern BlastQuery* blastParser_nextQuery (void); #endif
#ifndef UI_MUTUAL_H #define UI_MUTUAL_H #include "objects_def.h" #include "device.h" void ui_dev_descr_format(char *buf, int bufsize, DC_Dev *dev); #endif // UI_MUTUAL_H
#ifndef TESTSUITE_H #define TESTSUITE_H #include<iostream> #include<ctime> static clock_t start_time; static clock_t end_time; #define TIME_STARTS() \ start_time = clock(); #define TIME_UP() \ end_time = clock();\ std::cout << "TIME USED: ";\ std::cout << (double)(end_time-start_time)/CLOCKS_PER_SEC*1000;\ std::cout << " ms" << std::endl; #define ASSERT(x) \ std::cout << "ASSERTION: " << "["#x << "]" ; \ if(x)\ {\ std::cout << " SUCCESS!" << std::endl;\ }\ else\ {\ std::cout << " FAIL![*****]" << std::endl;\ } #define ASSERT_EQUAL(a,b) \ std::cout << "ASSERTION: " << "["#a<<" =="<<" "#b<<"]";\ if((a)==(b))\ {\ std::cout << " SUCCESS!" << std::endl;\ }\ else\ {\ std::cout << " FAIL![*****]" << std::endl;\ } #endif // TESTSUITE_H
/* * Copyright (c) 2012-2013 Etnaviv Project * * 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, sub license, * 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 NON-INFRINGEMENT. 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. */ /** Kernel ABI definition file for Etna **/ #ifndef H_GCABI #define H_GCABI //#define GCABI_USER_SIGNAL_HAS_TYPE //#define GCABI_CONTEXT_HAS_PHYSICAL #define GCABI_HAS_MINOR_FEATURES_2 #define GCABI_HAS_MINOR_FEATURES_3 // One of these must be set: //#define GCABI_HAS_CONTEXT #define GCABI_HAS_STATE_DELTAS // Interface structure has hardware type (core id) #define GCABI_HAS_HARDWARE_TYPE // Chip identity has pixelPipes, instructionCount, numConstants, bufferSize #define GCABI_CHIPIDENTITY_EXT // Chip identity has varyings and layout style #define GCABI_CHIPIDENTITY_VARYINGS #define GCABI_UINT64_POINTERS /* IOCTL structure for userspace driver*/ typedef struct { unsigned long long *in_buf; unsigned long long in_buf_size; unsigned long long *out_buf; unsigned long long out_buf_size; } vivante_ioctl_data_t; #include "gc_hal_base.h" #include "gc_hal.h" #include "gc_hal_driver.h" #include "gc_hal_kernel_buffer.h" #include "gc_hal_types.h" #endif
/* * H.265 video codec. * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de> * * This file is part of libde265. * * libde265 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. * * libde265 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 libde265. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DE265_VPS_H #define DE265_VPS_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifdef HAVE_STDBOOL_H #include <stdbool.h> #endif #include "libde265/bitstream.h" #include "libde265/de265.h" #define MAX_TEMPORAL_SUBLAYERS 8 struct profile_data { // --- profile --- char sub_layer_profile_present_flag; char sub_layer_profile_space; char sub_layer_tier_flag; char sub_layer_profile_idc; char sub_layer_profile_compatibility_flag[32]; char sub_layer_progressive_source_flag; char sub_layer_interlaced_source_flag; char sub_layer_non_packed_constraint_flag; char sub_layer_frame_only_constraint_flag; // --- level --- char sub_layer_level_present_flag; int sub_layer_level_idc; }; struct profile_tier_level { int general_profile_space; int general_tier_flag; int general_profile_idc; char general_profile_compatibility_flag[32]; char general_progressive_source_flag; char general_interlaced_source_flag; char general_non_packed_constraint_flag; char general_frame_only_constraint_flag; int general_level_idc; struct profile_data profile[MAX_TEMPORAL_SUBLAYERS]; }; void read_profile_tier_level(bitreader* reader, struct profile_tier_level* hdr, int max_sub_layers); void dump_profile_tier_level(const struct profile_tier_level* hdr, int max_sub_layers, FILE* fh); /* struct bit_rate_pic_rate_info { char bit_rate_info_present_flag[8]; char pic_rate_info_present_flag[8]; int avg_bit_rate[8]; int max_bit_rate[8]; char constant_pic_rate_idc[8]; int avg_pic_rate[8]; }; void read_bit_rate_pic_rate_info(bitreader* reader, struct bit_rate_pic_rate_info* hdr, int TempLevelLow, int TempLevelHigh); void dump_bit_rate_pic_rate_info(struct bit_rate_pic_rate_info* hdr, int TempLevelLow, int TempLevelHigh); */ typedef struct { int vps_max_dec_pic_buffering; int vps_max_num_reorder_pics; int vps_max_latency_increase; } layer_data; typedef struct { int video_parameter_set_id; int vps_max_layers; int vps_max_sub_layers; int vps_temporal_id_nesting_flag; struct profile_tier_level profile_tier_level; //struct bit_rate_pic_rate_info bit_rate_pic_rate_info; int vps_sub_layer_ordering_info_present_flag; layer_data layer[MAX_TEMPORAL_SUBLAYERS]; uint8_t vps_max_layer_id; int vps_num_layer_sets; char layer_id_included_flag[1024][64]; char vps_timing_info_present_flag; uint32_t vps_num_units_in_tick; uint32_t vps_time_scale; char vps_poc_proportional_to_timing_flag; int vps_num_ticks_poc_diff_one; int vps_num_hrd_parameters; uint16_t hrd_layer_set_idx[1024]; char cprms_present_flag[1024]; // hrd_parameters(cprms_present_flag[i], vps_max_sub_layers-1) char vps_extension_flag; } video_parameter_set; de265_error read_vps(struct decoder_context* ctx, bitreader* reader, video_parameter_set* vps); void dump_vps(video_parameter_set*, int fd); #endif
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM nsIDOMNSHTMLFormControlList.idl */ #ifndef __gen_nsIDOMNSHTMLFormControlList_h__ #define __gen_nsIDOMNSHTMLFormControlList_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif /* starting interface: nsIDOMNSHTMLFormControlList */ #define NS_IDOMNSHTMLFORMCONTROLLIST_IID_STR "a6cf911a-15b3-11d2-932e-00805f8add32" #define NS_IDOMNSHTMLFORMCONTROLLIST_IID \ {0xa6cf911a, 0x15b3, 0x11d2, \ { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }} class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMNSHTMLFormControlList : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMNSHTMLFORMCONTROLLIST_IID) /* nsISupports namedItem (in DOMString name); */ NS_SCRIPTABLE NS_IMETHOD NamedItem(const nsAString & name, nsISupports **_retval NS_OUTPARAM) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMNSHTMLFormControlList, NS_IDOMNSHTMLFORMCONTROLLIST_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSIDOMNSHTMLFORMCONTROLLIST \ NS_SCRIPTABLE NS_IMETHOD NamedItem(const nsAString & name, nsISupports **_retval NS_OUTPARAM); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSIDOMNSHTMLFORMCONTROLLIST(_to) \ NS_SCRIPTABLE NS_IMETHOD NamedItem(const nsAString & name, nsISupports **_retval NS_OUTPARAM) { return _to NamedItem(name, _retval); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSIDOMNSHTMLFORMCONTROLLIST(_to) \ NS_SCRIPTABLE NS_IMETHOD NamedItem(const nsAString & name, nsISupports **_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->NamedItem(name, _retval); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsDOMNSHTMLFormControlList : public nsIDOMNSHTMLFormControlList { public: NS_DECL_ISUPPORTS NS_DECL_NSIDOMNSHTMLFORMCONTROLLIST nsDOMNSHTMLFormControlList(); private: ~nsDOMNSHTMLFormControlList(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsDOMNSHTMLFormControlList, nsIDOMNSHTMLFormControlList) nsDOMNSHTMLFormControlList::nsDOMNSHTMLFormControlList() { /* member initializers and constructor code */ } nsDOMNSHTMLFormControlList::~nsDOMNSHTMLFormControlList() { /* destructor code */ } /* nsISupports namedItem (in DOMString name); */ NS_IMETHODIMP nsDOMNSHTMLFormControlList::NamedItem(const nsAString & name, nsISupports **_retval NS_OUTPARAM) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIDOMNSHTMLFormControlList_h__ */
#ifndef _DDSENTITYMGR_ #define _DDSENTITYMGR_ #include "ccpp_dds_dcps.h" #include "CheckStatus.h" using namespace DDS; class DDSEntityManager { /* Generic DDS entities */ DomainParticipantFactory_var dpf; DomainParticipant_var participant; Topic_var topic; Publisher_var publisher; Subscriber_var subscriber; DataWriter_var writer; DataReader_var reader; /* QosPolicy holders */ TopicQos reliable_topic_qos; TopicQos setting_topic_qos; PublisherQos pub_qos; DataWriterQos dw_qos; SubscriberQos sub_qos; DataReaderQos dr_qos; DomainId_t domain; InstanceHandle_t userHandle; ReturnCode_t status; DDS::String_var partition; DDS::String_var typeName; public: void createParticipant(const char *partitiontName); void deleteParticipant(); void registerType(TypeSupport *ts); void createTopic(char *topicName); void deleteTopic(); void createPublisher(); void deletePublisher(); void createWriter(DDS::Long strength); void deleteWriter(DDS::DataWriter_ptr dataWriter); void createSubscriber(); void deleteSubscriber(); void createReader(); void deleteReader(DDS::DataReader_ptr dataReader); DataReader_ptr getReader(); DataWriter_ptr getWriter(); Publisher_ptr getPublisher(); Subscriber_ptr getSubscriber(); Topic_ptr getTopic(); DomainParticipant_ptr getParticipant(); ~DDSEntityManager(); }; #endif
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "NidentifyAbort.h" int NidentifyAbort_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1 && value <= 128)) { /* Constraint check succeeded */ return 0; } else { _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NidentifyAbort_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void NidentifyAbort_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NidentifyAbort_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NidentifyAbort_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NidentifyAbort_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NidentifyAbort_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NidentifyAbort_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NidentifyAbort_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NidentifyAbort_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NidentifyAbort_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NidentifyAbort_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t asn_PER_type_NidentifyAbort_constr_1 = { { APC_CONSTRAINED, 7, 7, 1, 128 } /* (1..128) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_NidentifyAbort_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NidentifyAbort = { "NidentifyAbort", "NidentifyAbort", NidentifyAbort_free, NidentifyAbort_print, NidentifyAbort_constraint, NidentifyAbort_decode_ber, NidentifyAbort_encode_der, NidentifyAbort_decode_xer, NidentifyAbort_encode_xer, NidentifyAbort_decode_uper, NidentifyAbort_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NidentifyAbort_tags_1, sizeof(asn_DEF_NidentifyAbort_tags_1) /sizeof(asn_DEF_NidentifyAbort_tags_1[0]), /* 1 */ asn_DEF_NidentifyAbort_tags_1, /* Same as above */ sizeof(asn_DEF_NidentifyAbort_tags_1) /sizeof(asn_DEF_NidentifyAbort_tags_1[0]), /* 1 */ &asn_PER_type_NidentifyAbort_constr_1, 0, 0, /* No members */ 0 /* No specifics */ };
/* pmrfc3164.h * These are the definitions for the RFC3164 parser module. * * File begun on 2009-11-04 by RGerhards * * Copyright 2009 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * * 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 * -or- * see COPYING.ASL20 in the source distribution * * 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 PMRFC3164_H_INCLUDED #define PMRFC3164_H_INCLUDED 1 /* prototypes */ rsRetVal modInitpmrfc3164(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()), modInfo_t*); #endif /* #ifndef PMRFC3164_H_INCLUDED */ /* vi:set ai: */
/* * Copyright (C) 2014 Martin Willi * Copyright (C) 2014 revosec AG * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /** * @defgroup connmark connmark * @ingroup cplugins * * @defgroup connmark_plugin connmark_plugin * @{ @ingroup connmark */ #ifndef CONNMARK_PLUGIN_H_ #define CONNMARK_PLUGIN_H_ #include <plugins/plugin.h> typedef struct connmark_plugin_t connmark_plugin_t; /** * Plugin using marks to select return path SA based on conntrack. */ struct connmark_plugin_t { /** * implements plugin interface */ plugin_t plugin; }; #endif /** CONNMARK_PLUGIN_H_ @}*/
/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2015 - Daniel De Matteis * * RetroArch 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch 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 RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef RARCH_VIDEO_THREAD_H__ #define RARCH_VIDEO_THREAD_H__ #include "../driver.h" #include "../general.h" #include <boolean.h> #include <rthreads/rthreads.h> #include "font_driver.h" enum thread_cmd { CMD_NONE = 0, CMD_INIT, CMD_SET_SHADER, CMD_FREE, CMD_ALIVE, /* Blocking alive check. Used when paused. */ CMD_SET_VIEWPORT, CMD_SET_ROTATION, CMD_READ_VIEWPORT, #ifdef HAVE_OVERLAY CMD_OVERLAY_ENABLE, CMD_OVERLAY_LOAD, CMD_OVERLAY_TEX_GEOM, CMD_OVERLAY_VERTEX_GEOM, CMD_OVERLAY_FULL_SCREEN, #endif CMD_POKE_SET_VIDEO_MODE, CMD_POKE_SET_FILTERING, CMD_POKE_GET_VIDEO_OUTPUT_SIZE, CMD_POKE_GET_VIDEO_OUTPUT_PREV, CMD_POKE_GET_VIDEO_OUTPUT_NEXT, #ifdef HAVE_FBO CMD_POKE_SET_FBO_STATE, CMD_POKE_GET_FBO_STATE, #endif CMD_POKE_SET_ASPECT_RATIO, CMD_POKE_SET_OSD_MSG, CMD_FONT_INIT, CMD_CUSTOM_COMMAND, CMD_DUMMY = INT_MAX }; typedef struct { enum thread_cmd type; union { bool b; int i; float f; const char *str; void *v; struct { enum rarch_shader_type type; const char *path; } set_shader; struct { unsigned width; unsigned height; bool force_full; bool allow_rotate; } set_viewport; struct { unsigned index; float x, y, w, h; } rect; struct { const struct texture_image *data; unsigned num; } image; struct { unsigned width; unsigned height; } output; struct { unsigned width; unsigned height; bool fullscreen; } new_mode; struct { unsigned index; bool smooth; } filtering; struct { char msg[PATH_MAX_LENGTH]; struct font_params params; } osd_message; struct { int (*method)(void*); void* data; int return_value; } custom_command; struct { bool (*method)(const void **font_driver, void **font_handle, void *video_data, const char *font_path, float font_size, enum font_driver_render_api api); const void **font_driver; void **font_handle; void *video_data; const char *font_path; float font_size; bool return_value; enum font_driver_render_api api; } font_init; } data; } thread_packet_t; typedef struct thread_video { slock_t *lock; scond_t *cond_cmd; scond_t *cond_thread; sthread_t *thread; video_info_t info; const video_driver_t *driver; #ifdef HAVE_OVERLAY const video_overlay_interface_t *overlay; #endif const video_poke_interface_t *poke; void *driver_data; const input_driver_t **input; void **input_data; #if defined(HAVE_MENU) struct { void *frame; size_t frame_cap; unsigned width; unsigned height; float alpha; bool frame_updated; bool rgb32; bool enable; bool full_screen; } texture; #endif bool apply_state_changes; bool alive; bool focus; bool suppress_screensaver; bool has_windowed; bool nonblock; retro_time_t last_time; unsigned hit_count; unsigned miss_count; float *alpha_mod; unsigned alpha_mods; bool alpha_update; slock_t *alpha_lock; /* void (*send_cmd_func)(struct thread_video *, enum thread_cmd); */ /* void (*wait_reply_func)(struct thread_video *, enum thread_cmd); */ void (*send_and_wait)(struct thread_video *, thread_packet_t*); enum thread_cmd send_cmd; enum thread_cmd reply_cmd; thread_packet_t cmd_data; struct video_viewport vp; struct video_viewport read_vp; /* Last viewport reported to caller. */ struct { slock_t *lock; uint8_t *buffer; unsigned width; unsigned height; unsigned pitch; bool updated; bool within_thread; uint64_t count; char msg[PATH_MAX_LENGTH]; } frame; video_driver_t video_thread; } thread_video_t; /** * rarch_threaded_video_init: * @out_driver : Output video driver * @out_data : Output video data * @input : Input input driver * @input_data : Input input data * @driver : Input Video driver * @info : Video info handle. * * Creates, initializes and starts a video driver in a new thread. * Access to video driver will be mediated through this driver. * * Returns: true (1) if successful, otherwise false (0). **/ bool rarch_threaded_video_init( const video_driver_t **out_driver, void **out_data, const input_driver_t **input, void **input_data, const video_driver_t *driver, const video_info_t *info); /** * rarch_threaded_video_get_ptr: * @drv : Found driver. * * Gets the underlying video driver associated with the * threaded video wrapper. Sets @drv to the found * video driver. * * Returns: Video driver data of the video driver associated * with the threaded wrapper (if successful). If not successful, * NULL. **/ void *rarch_threaded_video_get_ptr(const video_driver_t **drv); #endif
// Copyright (C) by Ashton Mason. See LICENSE.txt for licensing information. #ifndef THERON_YIELDSTRATEGY_H #define THERON_YIELDSTRATEGY_H /** \file YieldStrategy.h Defines the YieldStrategy enumerated type. */ namespace Theron { /** \brief Enumerates the available worker thread yield strategies. Each \ref Theron::Framework contains a pool of worker threads that are used to execute the actors hosted in the framework. The worker threads service a queue, processing actors that have received messages and executing their registered message handlers. When constructing a Framework, a \ref Theron::Framework::Parameters object may be provided with parameters that control the structure and behavior of the the framework's internal threadpool. This enum defines the available values of the \ref Theron::Framework::Parameters::mYieldStrategy "mYieldStrategy" member of the Parameters structure. The mYieldStrategy member defines the strategy that the worker threads use to avoid \em busy \em waiting on the work queue. The available strategies have different performance characteristics, and are best suited to different kinds of applications. The default strategy, \ref YIELD_STRATEGY_POLITE, causes the threads to go to sleep for a short period when they fail to find work on the work queue. Going to sleep frees up the processor during quiet periods and so gives other threads on the system a chance to be executed. The downside is that if a message arrives after a period of inactivity then it may only be processed when one or more threads awake, leading to some small latency. The more aggressive strategies cause the threads to yield to other threads, or simply spin, without going to sleep. These strategies typically have lower worst-case latency. However the reduced latency is at the expense of increased CPU usage, increased power consumption, and potentially lower throughput. When choosing a yield strategy it pays to consider how important immediate responsiveness is to your application: in most applications a latency of a few milliseconds is not significant, and the default strategy is a reasonable choice. */ enum YieldStrategy { YIELD_STRATEGY_BLOCKING, ///< Threads wait on locks and condition variables. YIELD_STRATEGY_POLITE, ///< Threads go to sleep when not in use. YIELD_STRATEGY_STRONG, ///< Threads yield to other threads but don't go to sleep. YIELD_STRATEGY_AGGRESSIVE ///< Threads never sleep or yield to other threads. }; } // namespace Theron #endif // THERON_YIELDSTRATEGY_H
/* Test file for mpfr_acos. Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by the AriC and Caramel projects, INRIA. This file is part of the GNU MPFR Library. The GNU MPFR Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The GNU MPFR Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdio.h> #include <stdlib.h> #include "mpfr-test.h" #define TEST_FUNCTION mpfr_acos #include "tgeneric.c" static void special (void) { mpfr_t x, y; int inex1, inex2; mpfr_init2 (x, 32); mpfr_init2 (y, 32); mpfr_set_str_binary (x, "0.10001000001001011000100001E-6"); mpfr_acos (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "1.10001111111111110001110110001"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_acos (1)\n"); exit (1); } mpfr_set_str_binary (x, "-0.01101011110111100111010011001011"); mpfr_acos (y, x, MPFR_RNDZ); mpfr_set_str_binary (x, "10.0000000101111000011101000101"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_acos (2)\n"); mpfr_print_binary (y); printf ("\n"); exit (1); } mpfr_set_prec (x, 2); mpfr_set_ui (x, 0, MPFR_RNDN); inex1 = mpfr_acos (x, x, MPFR_RNDN); /* Pi/2 */ inex2 = mpfr_const_pi (x, MPFR_RNDN); if (inex1 != inex2) { printf ("Error in mpfr_acos (3) for prec=2\n"); exit (1); } mpfr_clear (y); mpfr_clear (x); } static void special_overflow (void) { mpfr_t x, y; mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); set_emin (-125); set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101100100000000000110100E0"); mpfr_acos (y, x, MPFR_RNDN); if (mpfr_cmp_str (y, "0.110011010100101111000100111010111011010000001001E0", 2, MPFR_RNDN)) { printf("Special Overflow error.\n"); mpfr_dump (y); exit (1); } mpfr_clear (y); mpfr_clear (x); set_emin (emin); set_emax (emax); } int main (void) { mpfr_t x, y; int r; tests_start_mpfr (); special_overflow (); special (); mpfr_init (x); mpfr_init (y); MPFR_SET_NAN(x); mpfr_acos (y, x, MPFR_RNDN); if (mpfr_nan_p(y) == 0) { printf ("Error: acos(NaN) != NaN\n"); exit (1); } mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_acos (y, x, MPFR_RNDN); if (mpfr_nan_p(y) == 0) { printf ("Error: acos(2) != NaN\n"); exit (1); } mpfr_set_si (x, -2, MPFR_RNDN); mpfr_acos (y, x, MPFR_RNDN); if (mpfr_nan_p(y) == 0) { printf ("Error: acos(-2) != NaN\n"); exit (1); } /* acos (1) = 0 */ mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_acos (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: acos(1) != +0.0\n"); exit (1); } /* acos (0) = Pi/2 */ for (r = 0; r < MPFR_RND_MAX; r++) { mpfr_set_ui (x, 0, MPFR_RNDN); /* exact */ mpfr_acos (y, x, (mpfr_rnd_t) r); mpfr_const_pi (x, (mpfr_rnd_t) r); mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */ if (mpfr_cmp (x, y)) { printf ("Error: acos(0) != Pi/2 for rnd=%s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r)); exit (1); } } /* acos (-1) = Pi */ for (r = 0; r < MPFR_RND_MAX; r++) { mpfr_set_si (x, -1, MPFR_RNDN); /* exact */ mpfr_acos (y, x, (mpfr_rnd_t) r); mpfr_const_pi (x, (mpfr_rnd_t) r); if (mpfr_cmp (x, y)) { printf ("Error: acos(1) != Pi for rnd=%s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r)); exit (1); } } test_generic (2, 100, 7); mpfr_clear (x); mpfr_clear (y); data_check ("data/acos", mpfr_acos, "mpfr_acos"); bad_cases (mpfr_acos, mpfr_cos, "mpfr_acos", 0, -40, 2, 4, 128, 800, 30); tests_end_mpfr (); return 0; }
#ifndef _EXTENSIONS_H_ #define _EXTENSIONS_H_ #include <glib-object.h> #include <telepathy-glib/channel.h> #include "tests/lib/glib/extensions/_gen/enums.h" #include "tests/lib/glib/extensions/_gen/svc-channel.h" #include "tests/lib/glib/extensions/_gen/svc-misc.h" G_BEGIN_DECLS #include "tests/lib/glib/extensions/_gen/gtypes.h" #include "tests/lib/glib/extensions/_gen/interfaces.h" G_END_DECLS #endif
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** **************************************************************************/ #ifndef QMLJSPREVIEWRUNNER_H #define QMLJSPREVIEWRUNNER_H #include <QtCore/QObject> #include <projectexplorer/applicationlauncher.h> namespace QmlJSEditor { namespace Internal { class QmlJSPreviewRunner : public QObject { Q_OBJECT public: explicit QmlJSPreviewRunner(QObject *parent = 0); bool isReady() const; void run(const QString &filename); signals: public slots: private: QString m_qmlViewerDefaultPath; ProjectExplorer::ApplicationLauncher m_applicationLauncher; }; } // namespace Internal } // namespace QmlJSEditor #endif // QMLJSPREVIEWRUNNER_H
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and 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. ** ****************************************************************************/ #ifndef UNCONFIGUREDPROJECTPANEL_H #define UNCONFIGUREDPROJECTPANEL_H #include "iprojectproperties.h" #include <QString> QT_FORWARD_DECLARE_CLASS(QPushButton) namespace ProjectExplorer { class Kit; class TargetSetupPage; namespace Internal { class UnconfiguredProjectPanel : public IProjectPanelFactory { Q_OBJECT public: UnconfiguredProjectPanel(); virtual QString id() const; virtual QString displayName() const; int priority() const; virtual bool supports(Project *project); virtual PropertiesPanel *createPanel(Project *project); }; class TargetSetupPageWrapper : public QWidget { Q_OBJECT public: TargetSetupPageWrapper(Project *project); protected: void keyReleaseEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event); private slots: void done(); void cancel(); void kitUpdated(ProjectExplorer::Kit *k); void updateNoteText(); void completeChanged(); private: Project *m_project; TargetSetupPage *m_targetSetupPage; QPushButton *m_configureButton; QPushButton *m_cancelButton; }; } // namespace Internal } // namespace ProjectExplorer #endif // UNCONFIGUREDPROJECTPANEL_H