text
stringlengths
4
6.14k
/* Copyright 2014-2016 Samsung Electronics Co., Ltd. * Copyright 2015-2016 University of Szeged. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ecma-alloc.h" #include "ecma-conversion.h" #include "ecma-helpers.h" #include "ecma-number-arithmetic.h" #include "ecma-objects.h" #include "ecma-try-catch-macro.h" #include "opcodes.h" #include "jrt-libc-includes.h" /** \addtogroup vm Virtual machine * @{ * * \addtogroup vm_opcodes Opcodes * @{ */ /** * Perform ECMA number arithmetic operation. * * The algorithm of the operation is following: * leftNum = ToNumber (leftValue); * rightNum = ToNumber (rightValue); * result = leftNum ArithmeticOp rightNum; * * @return ecma value * Returned value must be freed with ecma_free_value */ ecma_value_t do_number_arithmetic (number_arithmetic_op op, /**< number arithmetic operation */ ecma_value_t left_value, /**< left value */ ecma_value_t right_value) /**< right value */ { ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ECMA_OP_TO_NUMBER_TRY_CATCH (num_left, left_value, ret_value); ECMA_OP_TO_NUMBER_TRY_CATCH (num_right, right_value, ret_value); ecma_number_t result = ECMA_NUMBER_ZERO; switch (op) { case NUMBER_ARITHMETIC_SUBSTRACTION: { result = ecma_number_substract (num_left, num_right); break; } case NUMBER_ARITHMETIC_MULTIPLICATION: { result = ecma_number_multiply (num_left, num_right); break; } case NUMBER_ARITHMETIC_DIVISION: { result = ecma_number_divide (num_left, num_right); break; } case NUMBER_ARITHMETIC_REMAINDER: { result = ecma_op_number_remainder (num_left, num_right); break; } } ret_value = ecma_make_number_value (result); ECMA_OP_TO_NUMBER_FINALIZE (num_right); ECMA_OP_TO_NUMBER_FINALIZE (num_left); return ret_value; } /* do_number_arithmetic */ /** * 'Addition' opcode handler. * * See also: ECMA-262 v5, 11.6.1 * * @return ecma value * Returned value must be freed with ecma_free_value */ ecma_value_t opfunc_addition (ecma_value_t left_value, /**< left value */ ecma_value_t right_value) /**< right value */ { bool free_left_value = false; bool free_right_value = false; if (ecma_is_value_object (left_value)) { ecma_object_t *obj_p = ecma_get_object_from_value (left_value); left_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_NO); free_left_value = true; if (ECMA_IS_VALUE_ERROR (left_value)) { return left_value; } } if (ecma_is_value_object (right_value)) { ecma_object_t *obj_p = ecma_get_object_from_value (right_value); right_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_NO); free_right_value = true; if (ECMA_IS_VALUE_ERROR (right_value)) { if (free_left_value) { ecma_free_value (left_value); } return right_value; } } ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); if (ecma_is_value_string (left_value) || ecma_is_value_string (right_value)) { ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (left_value), ret_value); ECMA_TRY_CATCH (str_right_value, ecma_op_to_string (right_value), ret_value); ecma_string_t *string1_p = ecma_get_string_from_value (str_left_value); ecma_string_t *string2_p = ecma_get_string_from_value (str_right_value); ecma_string_t *concat_str_p = ecma_concat_ecma_strings (string1_p, string2_p); ret_value = ecma_make_string_value (concat_str_p); ECMA_FINALIZE (str_right_value); ECMA_FINALIZE (str_left_value); } else { ECMA_OP_TO_NUMBER_TRY_CATCH (num_left, left_value, ret_value); ECMA_OP_TO_NUMBER_TRY_CATCH (num_right, right_value, ret_value); ret_value = ecma_make_number_value (ecma_number_add (num_left, num_right)); ECMA_OP_TO_NUMBER_FINALIZE (num_right); ECMA_OP_TO_NUMBER_FINALIZE (num_left); } if (free_left_value) { ecma_free_value (left_value); } if (free_right_value) { ecma_free_value (right_value); } return ret_value; } /* opfunc_addition */ /** * 'Unary "+"' opcode handler. * * See also: ECMA-262 v5, 11.4, 11.4.6 * * @return ecma value * Returned value must be freed with ecma_free_value */ ecma_value_t opfunc_unary_plus (ecma_value_t left_value) /**< left value */ { ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ECMA_OP_TO_NUMBER_TRY_CATCH (num_var_value, left_value, ret_value); ret_value = ecma_make_number_value (num_var_value); ECMA_OP_TO_NUMBER_FINALIZE (num_var_value); return ret_value; } /* opfunc_unary_plus */ /** * 'Unary "-"' opcode handler. * * See also: ECMA-262 v5, 11.4, 11.4.7 * * @return ecma value * Returned value must be freed with ecma_free_value */ ecma_value_t opfunc_unary_minus (ecma_value_t left_value) /**< left value */ { ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ECMA_OP_TO_NUMBER_TRY_CATCH (num_var_value, left_value, ret_value); ret_value = ecma_make_number_value (ecma_number_negate (num_var_value)); ECMA_OP_TO_NUMBER_FINALIZE (num_var_value); return ret_value; } /* opfunc_unary_minus */ /** * @} * @} */
/* $NetBSD: atomic_and_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 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 "atomic_op_namespace.h" #include <sys/atomic.h> uint16_t fetch_and_and_2(volatile uint16_t *, uint16_t, ...) asm("__sync_fetch_and_and_2"); uint16_t fetch_and_and_2(volatile uint16_t *addr, uint16_t val, ...) { uint16_t old, new; do { old = *addr; new = old & val; } while (atomic_cas_16(addr, old, new) != old); return old; } __strong_alias(__atomic_fetch_and_2,__sync_fetch_and_and_2)
/* Copyright 2007-2015 QReal Research Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "qrtext/lua/ast/expression.h" namespace qrtext { namespace lua { namespace ast { /// Represents Lua string literal. class QRTEXT_EXPORT String : public Expression { public: /// Constructor. /// @param string - value of a literal (without quotes). String(const QString &string) : mString(string) { } /// Returns value of a string (without quotes). const QString &string() const { return mString; } private: void accept(core::AstVisitorInterface &visitor) const override { static_cast<LuaAstVisitorInterface *>(&visitor)->visit(*this); } QString mString; }; } } }
// // ETSCalendar.h // ETSMobile // // Created by Jean-Philippe Martin on 2014-03-31. // Copyright (c) 2014 ApplETS. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @interface ETSCalendar : NSManagedObject @property (nonatomic, retain) NSString * course; @property (nonatomic, retain) NSDate * end; @property (nonatomic, retain) NSString * id; @property (nonatomic, retain) NSString * room; @property (nonatomic, retain) NSDate * start; @property (nonatomic, retain) NSString * summary; @property (nonatomic, retain) NSString * title; @property (nonatomic, retain) NSString * session; - (NSDate *)day; - (nonnull NSDictionary<NSString*, id> *)dictionary; @end
/*========================================================================= Library: TubeTK Copyright 2010 Kitware Inc. 28 Corporate Drive, Clifton Park, NY, 12065, USA. All rights reserved. Licensed under the Apache License, Version 2.0 ( the "License" ); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =========================================================================*/ #ifndef __itktubeEnhanceContrastUsingPriorImageFilter_h #define __itktubeEnhanceContrastUsingPriorImageFilter_h #include <itkArray.h> #include <itkImageToImageFilter.h> #include <itktubeContrastCostFunction.h> #include <itkNormalVariateGenerator.h> #include <itkOnePlusOneEvolutionaryOptimizer.h> #include <itkFRPROptimizer.h> #include <itkImageRegionIterator.h> namespace itk { namespace tube { /** \class EnhanceContrastUsingPriorImageFilter */ template< class TPixel, unsigned int VDimension > class EnhanceContrastUsingPriorImageFilter : public ImageToImageFilter< Image< TPixel, VDimension >, Image< TPixel, VDimension > > { public: /** Standard class typedefs. */ typedef Image< TPixel, VDimension > ImageType; typedef EnhanceContrastUsingPriorImageFilter Self; typedef ImageToImageFilter< ImageType, ImageType > 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( EnhanceContrastUsingPriorImageFilter, ImageToImageFilter ); /** Some convenient typedefs. */ typedef itk::tube::ContrastCostFunction< TPixel, VDimension > ContrastCostFunctionType; typedef itk::OnePlusOneEvolutionaryOptimizer InitialOptimizerType; typedef itk::FRPROptimizer OptimizerType; typedef itk::ImageRegionIterator< ImageType > ImageIteratorType; /** Set/Get input Mask Image */ itkSetObjectMacro( InputMaskImage, ImageType ); itkGetModifiableObjectMacro( InputMaskImage, ImageType ); /** Set/Get Object Scale */ itkSetMacro( ObjectScale, float ); itkGetMacro( ObjectScale, float ); /** Set/Get Background Scale */ itkSetMacro( BackgroundScale, float ); itkGetMacro( BackgroundScale, float ); /** Set/Get Mask Object Value */ itkSetMacro( MaskObjectValue, int ); itkGetMacro( MaskObjectValue, int ); /** Set/Get Mask Background Value */ itkSetMacro( MaskBackgroundValue, int ); itkGetMacro( MaskBackgroundValue, int ); /** Set/Get Optimization Iterations */ itkSetMacro( OptimizationIterations, int ); itkGetMacro( OptimizationIterations, int ); /** Set/Get Optimization Seed */ itkSetMacro( OptimizationSeed, int ); itkGetMacro( OptimizationSeed, int ); protected: EnhanceContrastUsingPriorImageFilter( void ); virtual ~EnhanceContrastUsingPriorImageFilter( void ) {} void PrintSelf( std::ostream& os, Indent indent ) const override; virtual void GenerateData( void ) override; private: //purposely not implemented EnhanceContrastUsingPriorImageFilter( const Self& ); //purposely not implemented void operator=( const Self& ); typename ImageType::Pointer m_InputMaskImage; float m_ObjectScale; float m_BackgroundScale; int m_MaskObjectValue; int m_MaskBackgroundValue; int m_OptimizationIterations; int m_OptimizationSeed; }; // End class EnhanceContrastUsingPriorImageFilter } // End namespace tube } // End namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itktubeEnhanceContrastUsingPriorImageFilter.hxx" #endif #endif // End !defined( __itktubeEnhanceContrastUsingPriorImageFilter_h )
// Copyright 2019 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __AES_H__ #define __AES_H__ #include "common.h" #define CTRL_CTR_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #define CTRL_ENABLE 1 #define CTRL_ENCRYPT 1 #define CTRL_NO_SOFT_RESET 0 /* * Use this structure to avoid alignment problems with input and output * pointers. */ struct AES_access_helper { uint32_t udata; } __packed; /* * AES configuration settings */ enum AES_cipher_mode { AES_CIPHER_MODE_ECB = 0, AES_CIPHER_MODE_CTR = 1, AES_CIPHER_MODE_CBC = 2, AES_CIPHER_MODE_GCM = 3 }; enum AES_encrypt_mode { AES_DECRYPT_MODE = 0, AES_ENCRYPT_MODE = 1 }; /* * AES implementation, based on a hardware AES block. */ #define AES256_BLOCK_CIPHER_KEY_SIZE 32 #define AES128_BLOCK_CIPHER_KEY_SIZE 16 int fips_aes_init(const uint8_t *key, uint32_t key_len, const uint8_t *iv, enum AES_cipher_mode c_mode, enum AES_encrypt_mode e_mode); int fips_aes_block(const uint8_t *in, uint8_t *out); #endif // __AES_H__
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ #define CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ #include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/string16.h" #include "chrome/browser/profiles/profile_metrics.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "ui/gfx/image/image.h" class AvatarMenuModelObserver; class Browser; class Profile; class ProfileInfoInterface; // This class is the model for the menu-like interface that appears when the // avatar icon is clicked in the browser window frame. This class will notify // its observer when the backend data changes, and the controller/view for this // model should forward actions back to it in response to user events. class AvatarMenuModel : public content::NotificationObserver { public: // Represents an item in the menu. struct Item { Item(size_t model_index, const gfx::Image& icon); ~Item(); // The icon to be displayed next to the item. gfx::Image icon; // Whether or not the current browser is using this profile. bool active; // The name of this profile. string16 name; // A string representing the sync state of the profile. string16 sync_state; // Whether or not the current profile is signed in. If true, |sync_state| is // expected to be the email of the signed in user. bool signed_in; // Whether or not the current profile requires sign-in before use. bool signin_required; // The index in the |profile_cache| that this Item represents. size_t model_index; }; // Constructor. |observer| can be NULL. |browser| can be NULL and a new one // will be created if an action requires it. AvatarMenuModel(ProfileInfoInterface* profile_cache, AvatarMenuModelObserver* observer, Browser* browser); virtual ~AvatarMenuModel(); // Actions performed by the view that the controller forwards back to the // model: // Opens a Browser with the specified profile in response to the user // selecting an item. If |always_create| is true then a new window is created // even if a window for that profile already exists. void SwitchToProfile(size_t index, bool always_create); // Opens the profile settings in response to clicking the edit button next to // an item. void EditProfile(size_t index); // Creates a new profile. void AddNewProfile(ProfileMetrics::ProfileAdd type); // Gets the path associated with the profile at |index|. base::FilePath GetProfilePath(size_t index); // Gets the number of profiles. size_t GetNumberOfItems(); // Returns the index of the active profile. size_t GetActiveProfileIndex(); // Gets the an Item at a specified index. const Item& GetItemAt(size_t index); // Returns true if the add profile link should be shown. bool ShouldShowAddNewProfileLink() const; // This model is also used for the always-present Mac system menubar. As the // last active browser changes, the model needs to update accordingly. void set_browser(Browser* browser) { browser_ = browser; } // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; // True if avatar menu should be displayed. static bool ShouldShowAvatarMenu(); // Start the sign-out process for this profile. // Parameter |logout_override| alows changing the destination URL for the // sign-out process and return value (the WebContents executing the sign-out) // are for testing; pass NULL for normal use. content::WebContents* BeginSignOut(const char* logout_override); private: // Rebuilds the menu from the cache and notifies the |observer_|. void RebuildMenu(); // Clears the list of items, deleting each. void ClearMenu(); // The cache that provides the profile information. Weak. ProfileInfoInterface* profile_info_; // The observer of this model, which is notified of changes. Weak. AvatarMenuModelObserver* observer_; // Browser in which this avatar menu resides. Weak. Browser* browser_; // List of built "menu items." std::vector<Item*> items_; // Listens for notifications from the ProfileInfoCache. content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(AvatarMenuModel); }; #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_CUDNN_CONV_ALGORITHM_PICKER_H_ #define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_CUDNN_CONV_ALGORITHM_PICKER_H_ #include "absl/time/time.h" #include "absl/types/optional.h" #include "tensorflow/compiler/xla/service/compiler.h" #include "tensorflow/compiler/xla/service/device_memory_allocator.h" #include "tensorflow/compiler/xla/service/gpu/cudnn_conv_runner.h" #include "tensorflow/compiler/xla/service/hlo_instructions.h" #include "tensorflow/compiler/xla/service/hlo_module.h" #include "tensorflow/compiler/xla/service/hlo_pass_interface.h" #include "tensorflow/core/platform/stream_executor_no_cuda.h" namespace xla { namespace gpu { // Modifies CustomCalls to cudnn convolutions, choosing the best algorithm for // each and adding explicit scratch space to the CustomCalls. class CudnnConvAlgorithmPicker : public HloModulePass { public: // If the `allocator` parameter is not null, we will use it to allocate temp // memory while timing the various convolution algorithms. If it's null, // we'll use the default allocator on the StreamExecutor. CudnnConvAlgorithmPicker(se::StreamExecutor* stream_exec, DeviceMemoryAllocator* allocator, Compiler* compiler) : stream_exec_(stream_exec), allocator_(allocator), compiler_(compiler) {} absl::string_view name() const override { return "cudnn-conv-algorithm-picker"; } StatusOr<bool> Run(HloModule* module) override; private: struct AutotuneResult { int64 algorithm; bool tensor_ops_enabled; int64 scratch_bytes; absl::Duration runtime; }; StatusOr<bool> RunOnComputation(HloComputation* computation); StatusOr<bool> RunOnInstruction(HloInstruction* instr); StatusOr<AutotuneResult> PickBestAlgorithm( const HloCustomCallInstruction* instr); se::StreamExecutor* stream_exec_; // never null DeviceMemoryAllocator* allocator_; // may be null Compiler* compiler_; }; } // namespace gpu } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_CUDNN_CONV_ALGORITHM_PICKER_H_
/* * File: rtwtypes.h * * MATLAB Coder version : 2.6 * C/C++ source code generated on : 28-Aug-2015 10:33:25 */ #ifndef __RTWTYPES_H__ #define __RTWTYPES_H__ #ifndef __TMWTYPES__ #define __TMWTYPES__ /*=======================================================================* * Target hardware information * Device type: Generic->MATLAB Host Computer * Number of bits: char: 8 short: 16 int: 32 * long: 32 long long: 64 * native word size: 32 * Byte ordering: LittleEndian * Signed integer division rounds to: Zero * Shift right on a signed integer as arithmetic shift: on *=======================================================================*/ /*=======================================================================* * Fixed width word size data types: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * * real32_T, real64_T - 32 and 64 bit floating point numbers * *=======================================================================*/ typedef signed char int8_T; typedef unsigned char uint8_T; typedef short int16_T; typedef unsigned short uint16_T; typedef int int32_T; typedef unsigned int uint32_T; typedef long long int64_T; typedef unsigned long long uint64_T; typedef float real32_T; typedef double real64_T; /*===========================================================================* * Generic type definitions: real_T, time_T, boolean_T, int_T, uint_T, * * ulong_T, ulonglong_T, char_T and byte_T. * *===========================================================================*/ typedef double real_T; typedef double time_T; typedef unsigned char boolean_T; typedef int int_T; typedef unsigned int uint_T; typedef unsigned long ulong_T; typedef unsigned long long ulonglong_T; typedef char char_T; typedef char_T byte_T; /*===========================================================================* * Complex number type definitions * *===========================================================================*/ #define CREAL_T typedef struct { real32_T re; real32_T im; } creal32_T; typedef struct { real64_T re; real64_T im; } creal64_T; typedef struct { real_T re; real_T im; } creal_T; typedef struct { int8_T re; int8_T im; } cint8_T; typedef struct { uint8_T re; uint8_T im; } cuint8_T; typedef struct { int16_T re; int16_T im; } cint16_T; typedef struct { uint16_T re; uint16_T im; } cuint16_T; typedef struct { int32_T re; int32_T im; } cint32_T; typedef struct { uint32_T re; uint32_T im; } cuint32_T; typedef struct { int64_T re; int64_T im; } cint64_T; typedef struct { uint64_T re; uint64_T im; } cuint64_T; /*=======================================================================* * Min and Max: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * *=======================================================================*/ #define MAX_int8_T ((int8_T)(127)) #define MIN_int8_T ((int8_T)(-128)) #define MAX_uint8_T ((uint8_T)(255)) #define MIN_uint8_T ((uint8_T)(0)) #define MAX_int16_T ((int16_T)(32767)) #define MIN_int16_T ((int16_T)(-32768)) #define MAX_uint16_T ((uint16_T)(65535)) #define MIN_uint16_T ((uint16_T)(0)) #define MAX_int32_T ((int32_T)(2147483647)) #define MIN_int32_T ((int32_T)(-2147483647-1)) #define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) #define MIN_uint32_T ((uint32_T)(0)) #define MAX_int64_T ((int64_T)(9223372036854775807LL)) #define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) #define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) #define MIN_uint64_T ((uint64_T)(0ULL)) /* Logical type definitions */ #if !defined(__cplusplus) && !defined(__true_false_are_keywords) # ifndef false # define false (0U) # endif # ifndef true # define true (1U) # endif #endif /* * Maximum length of a MATLAB identifier (function/variable) * including the null-termination character. Referenced by * rt_logging.c and rt_matrx.c. */ #define TMW_NAME_LENGTH_MAX 64 #endif #endif /* * File trailer for rtwtypes.h * * [EOF] */
/* This file is part of the VRender library. Copyright (C) 2005 Cyril Soler (Cyril.Soler@imag.fr) Version 1.0.0, released on June 27, 2005. http://artis.imag.fr/Members/Cyril.Soler/VRender VRender 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. VRender 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 VRender; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /**************************************************************************** Copyright (C) 2002-2011 Gilles Debunne. All rights reserved. This file is part of the QGLViewer library version 2.3.10. http://www.libqglviewer.com - contact@libqglviewer.com This file may be used under the terms of the GNU General Public License versions 2.0 or 3.0 as published by the Free Software Foundation and appearing in the LICENSE file included in the packaging of this file. In addition, as a special exception, Gilles Debunne gives you certain additional rights, described in the file GPL_EXCEPTION in this package. libQGLViewer uses dual licensing. Commercial/proprietary software must purchase a libQGLViewer Commercial License. This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *****************************************************************************/ #ifndef _VRENDER_H_ #define _VRENDER_H_ #include "../config.h" #if QT_VERSION >= 0x040000 # include <QTextStream> # include <QString> #else # include <qtextstream.h> # include <qstring.h> #endif #include "../qglviewer.h" namespace vrender { class VRenderParams ; typedef void (*RenderCB)(void *) ; typedef void (*ProgressFunction)(float,const QString&) ; void VectorialRender(RenderCB DrawFunc, void *callback_params, VRenderParams& render_params) ; class VRenderParams { public: VRenderParams() ; ~VRenderParams() ; enum VRenderSortMethod { NoSorting, BSPSort, TopologicalSort, AdvancedTopologicalSort }; enum VRenderFormat { EPS, PS, XFIG, SVG }; enum VRenderOption { CullHiddenFaces = 0x1, OptimizeBackFaceCulling = 0x4, RenderBlackAndWhite = 0x8, AddBackground = 0x10, TightenBoundingBox = 0x20 } ; int sortMethod() { return _sortMethod; } void setSortMethod(VRenderParams::VRenderSortMethod s) { _sortMethod = s ; } int format() { return _format; } void setFormat(VRenderFormat f) { _format = f; } const QString filename() { return _filename ; } void setFilename(const QString& filename) ; void setOption(VRenderOption,bool) ; bool isEnabled(VRenderOption) ; void setProgressFunction(ProgressFunction pf) { _progress_function = pf ; } private: int _error; VRenderSortMethod _sortMethod; VRenderFormat _format ; ProgressFunction _progress_function ; unsigned int _options; // _DrawMode; _ClearBG; _TightenBB; QString _filename; friend void VectorialRender( RenderCB render_callback, void *callback_params, VRenderParams& vparams); friend class ParserGL ; friend class Exporter ; friend class BSPSortMethod ; friend class VisibilityOptimizer ; friend class TopologicalSortMethod ; friend class TopologicalSortUtils ; int& error() { return _error ; } int& size() { static int size=1000000; return size ; } void progress(float,const QString&) ; }; } #endif
/** @file GUID is for MTC variable. Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __MTC_VENDOR_GUID_H__ #define __MTC_VENDOR_GUID_H__ // // Vendor GUID of the variable for the high part of monotonic counter (UINT32). // #define MTC_VENDOR_GUID \ { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } } // // Name of the variable for the high part of monotonic counter // #define MTC_VARIABLE_NAME L"MTC" extern EFI_GUID gMtcVendorGuid; #endif
// // MyScrollView.h // MITMObjectSample // // Created by Георгий Малюков on 23.08.15. // Copyright (c) 2015 Georgiy Malyukov. All rights reserved. // #import <UIKit/UIKit.h> @interface MyScrollView : UIScrollView { } @end
/** * Appcelerator Kroll - licensed under the Apache Public License 2 * see LICENSE in the root folder for details on the license. * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved. */ #ifndef _APPLICATION_BINDING_H_ #define _APPLICATION_BINDING_H_ #include <kroll/kroll.h> #include <map> #include <vector> #include <string> namespace kroll { class ApplicationBinding : public KAccessorObject { public: ApplicationBinding(SharedApplication application, bool current = false); private: SharedApplication application; bool current; void _GetID(const ValueList& args, KValueRef value); void _GetGUID(const ValueList& args, KValueRef value); void _GetName(const ValueList& args, KValueRef result); void _GetVersion(const ValueList& args, KValueRef value); void _GetPath(const ValueList& args, KValueRef value); void _GetExecutablePath(const ValueList& args, KValueRef value); void _GetResourcesPath(const ValueList& args, KValueRef value); void _GetDataPath(const ValueList& args, KValueRef value); void _GetManifestPath(const ValueList& args, KValueRef value); void _GetManifest(const ValueList& args, KValueRef value); void _GetProperties(const ValueList& args, KValueRef value); void _IsCurrent(const ValueList& args, KValueRef value); void _GetPID(const ValueList& args, KValueRef value); void _GetArguments(const ValueList& args, KValueRef value); void _HasArgument(const ValueList& args, KValueRef value); void _GetArgumentValue(const ValueList& args, KValueRef value); void _GetDependencies(const ValueList& args, KValueRef value); void _ResolveDependencies(const ValueList& args, KValueRef value); void _GetComponents(const ValueList& args, KValueRef value); void _GetModules(const ValueList& args, KValueRef value); void _GetRuntime(const ValueList& args, KValueRef value); void _GetAvailableComponents(const ValueList& args, KValueRef value); void _GetAvailableModules(const ValueList& args, KValueRef value); void _GetAvailableRuntimes(const ValueList& args, KValueRef value); void _GetBundledComponents(const ValueList& args, KValueRef value); void _GetBundledModules(const ValueList& args, KValueRef value); void _GetBundledRuntimes(const ValueList& args, KValueRef value); }; } #endif
/* * ModSecurity, http://www.modsecurity.org/ * Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. * */ #include <string> #include <memory> #include "modsecurity/actions/action.h" #ifndef SRC_ACTIONS_NO_AUDIT_LOG_H_ #define SRC_ACTIONS_NO_AUDIT_LOG_H_ #ifdef __cplusplus class Transaction; namespace modsecurity { class Transaction; namespace actions { class NoAuditLog : public Action { public: explicit NoAuditLog(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } bool evaluate(RuleWithActions *rule, Transaction *transaction, std::shared_ptr<RuleMessage> rm) override; }; } // namespace actions } // namespace modsecurity #endif #endif // SRC_ACTIONS_NO_AUDIT_LOG_H_
#ifndef __XN_PRIME_CLIENT_PROPS_H__ #define __XN_PRIME_CLIENT_PROPS_H__ #include <PrimeSense.h> enum { /**** Device properties ****/ /* XnDetailedVersion, get only */ LINK_PROP_FW_VERSION = 0x12000001, // "FWVersion" /* Int, get only */ LINK_PROP_VERSIONS_INFO_COUNT = 0x12000002, // "VersionsInfoCount" /* General - array - XnComponentVersion * count elements, get only */ LINK_PROP_VERSIONS_INFO = 0x12000003, // "VersionsInfo" /* Int - 0 means off, 1 means on. */ LINK_PROP_EMITTER_ACTIVE = 0x12000008, // "EmitterActive" /* String. Set only */ LINK_PROP_PRESET_FILE = 0x1200000a, // "PresetFile" /* Get only */ LINK_PROP_BOOT_STATUS = 0x1200000b, /* Int - system specific units */ LINK_PROP_PROJECTOR_POWER = 0x1200000c, /**** Device commands ****/ /* XnCommandGetFwStreams */ LINK_COMMAND_GET_FW_STREAM_LIST = 0x1200F001, /* XnCommandCreateStream */ LINK_COMMAND_CREATE_FW_STREAM = 0x1200F002, /* XnCommandDestroyStream */ LINK_COMMAND_DESTROY_FW_STREAM = 0x1200F003, /* XnCommandStartStream */ LINK_COMMAND_START_FW_STREAM = 0x1200F004, /* XnCommandStopStream */ LINK_COMMAND_STOP_FW_STREAM = 0x1200F005, /* XnCommandGetFwStreamVideoModeList */ LINK_COMMAND_GET_FW_STREAM_VIDEO_MODE_LIST = 0x1200F006, /* XnCommandSetFwStreamVideoMode */ LINK_COMMAND_SET_FW_STREAM_VIDEO_MODE = 0x1200F007, /* XnCommandGetFwStreamVideoMode */ LINK_COMMAND_GET_FW_STREAM_VIDEO_MODE = 0x1200F008, /* XnCommandSetProjectorPulse */ LINK_COMMAND_SET_PROJECTOR_PULSE = 0x1200F009, /* No args */ LINK_COMMAND_DISABLE_PROJECTOR_PULSE = 0x1200F00a, /**** Stream properties ****/ /* Int. 1 - Shifts 9.3, 2 - Grayscale16, 3 - YUV422, 4 - Bayer8 */ LINK_PROP_PIXEL_FORMAT = 0x12001001, // "PixelFormat" /* Int. 0 - None, 1 - 8z, 2 - 16z, 3 - 24z, 4 - 6-bit, 5 - 10-bit, 6 - 11-bit, 7 - 12-bit */ LINK_PROP_COMPRESSION = 0x12001002, // "Compression" /**** Depth Stream properties ****/ /* Real, get only */ LINK_PROP_DEPTH_SCALE = 0x1200000b, // "DepthScale" /* Int, get only */ LINK_PROP_MAX_SHIFT = 0x12002001, // "MaxShift" /* Int, get only */ LINK_PROP_ZERO_PLANE_DISTANCE = 0x12002002, // "ZPD" /* Int, get only */ LINK_PROP_CONST_SHIFT = 0x12002003, // "ConstShift" /* Int, get only */ LINK_PROP_PARAM_COEFF = 0x12002004, // "ParamCoeff" /* Int, get only */ LINK_PROP_SHIFT_SCALE = 0x12002005, // "ShiftScale" /* Real, get only */ LINK_PROP_ZERO_PLANE_PIXEL_SIZE = 0x12002006, // "ZPPS" /* Real, get only */ LINK_PROP_ZERO_PLANE_OUTPUT_PIXEL_SIZE = 0x12002007, // "ZPOPS" /* Real, get only */ LINK_PROP_EMITTER_DEPTH_CMOS_DISTANCE = 0x12002008, // "LDDIS" /* General - array - MaxShift * XnDepthPixel elements, get only */ LINK_PROP_SHIFT_TO_DEPTH_TABLE = 0x12002009, // "S2D" /* General - array - MaxDepth * uint16_t elements, get only */ LINK_PROP_DEPTH_TO_SHIFT_TABLE = 0x1200200a, // "D2S" }; typedef enum XnFileZone { XN_ZONE_FACTORY = 0x0000, XN_ZONE_UPDATE = 0x0001, } XnFileZone; typedef enum XnBootErrorCode { XN_BOOT_OK = 0x0000, XN_BOOT_BAD_CRC = 0x0001, XN_BOOT_UPLOAD_IN_PROGRESS = 0x0002, XN_BOOT_FW_LOAD_FAILED = 0x0003, } XnBootErrorCode; typedef enum XnFwStreamType { XN_FW_STREAM_TYPE_COLOR = 0x0001, XN_FW_STREAM_TYPE_IR = 0x0002, XN_FW_STREAM_TYPE_SHIFTS = 0x0003, XN_FW_STREAM_TYPE_AUDIO = 0x0004, XN_FW_STREAM_TYPE_DY = 0x0005, XN_FW_STREAM_TYPE_LOG = 0x0008, } XnFwStreamType; typedef enum XnFwPixelFormat { XN_FW_PIXEL_FORMAT_NONE = 0x0000, XN_FW_PIXEL_FORMAT_SHIFTS_9_3 = 0x0001, XN_FW_PIXEL_FORMAT_GRAYSCALE16 = 0x0002, XN_FW_PIXEL_FORMAT_YUV422 = 0x0003, XN_FW_PIXEL_FORMAT_BAYER8 = 0x0004, } XnFwPixelFormat; typedef enum XnFwCompressionType { XN_FW_COMPRESSION_NONE = 0x0000, XN_FW_COMPRESSION_8Z = 0x0001, XN_FW_COMPRESSION_16Z = 0x0002, XN_FW_COMPRESSION_24Z = 0x0003, XN_FW_COMPRESSION_6_BIT_PACKED = 0x0004, XN_FW_COMPRESSION_10_BIT_PACKED = 0x0005, XN_FW_COMPRESSION_11_BIT_PACKED = 0x0006, XN_FW_COMPRESSION_12_BIT_PACKED = 0x0007, } XnFwCompressionType; #pragma pack (push, 1) #define XN_MAX_VERSION_MODIFIER_LENGTH 16 typedef struct XnDetailedVersion { uint8_t m_nMajor; uint8_t m_nMinor; uint16_t m_nMaintenance; uint32_t m_nBuild; char m_strModifier[XN_MAX_VERSION_MODIFIER_LENGTH]; } XnDetailedVersion; typedef struct XnBootStatus { XnFileZone zone; XnBootErrorCode errorCode; } XnBootStatus; typedef struct XnFwStreamInfo { XnFwStreamType type; char creationInfo[80]; } XnFwStreamInfo; typedef struct XnFwStreamVideoMode { uint32_t m_nXRes; uint32_t m_nYRes; uint32_t m_nFPS; XnFwPixelFormat m_nPixelFormat; XnFwCompressionType m_nCompression; } XnFwStreamVideoMode; typedef struct XnCommandGetFwStreamList { uint32_t count; // in: number of allocated elements in streams array. out: number of written elements in the array XnFwStreamInfo* streams; } XnCommandGetFwStreamList; typedef struct XnCommandCreateStream { XnFwStreamType type; const char* creationInfo; uint32_t id; // out } XnCommandCreateStream; typedef struct XnCommandDestroyStream { uint32_t id; } XnCommandDestroyStream; typedef struct XnCommandStartStream { uint32_t id; } XnCommandStartStream; typedef struct XnCommandStopStream { uint32_t id; } XnCommandStopStream; typedef struct XnCommandGetFwStreamVideoModeList { int streamId; uint32_t count; // in: number of allocated elements in videoModes array. out: number of written elements in the array XnFwStreamVideoMode* videoModes; } XnCommandGetFwStreamVideoModeList; typedef struct XnCommandSetFwStreamVideoMode { int streamId; XnFwStreamVideoMode videoMode; } XnCommandSetFwStreamVideoMode; typedef struct XnCommandGetFwStreamVideoMode { int streamId; XnFwStreamVideoMode videoMode; // out } XnCommandGetFwStreamVideoMode; typedef struct XnCommandSetProjectorPulse { int delay; int width; int frames; } XnCommandSetProjectorPulse; #pragma pack (pop) #endif //__XN_PRIME_CLIENT_PROPS_H__
/********************************************************************** * * stopword.c * * Author: Stephen V. Rice * * Copyright 1996 The Board of Regents of the Nevada System of Higher * Education, on behalf, of the University of Nevada, Las Vegas, * Information Science Research Institute * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * **********************************************************************/ #include "stopword.h" #include "table.h" #include "word.h" BEGIN_ENTRY(Stopword) END_ENTRY(Stopword); BEGIN_TABLE_OF(Stopword, Stopwordlist) END_TABLE(Stopwordtable); static Stopwordtable stopwordtable; static Boolean initialized = False; static Textopt textopt = { False, False, 0, True, True, True }; static Text text; static Wordlist wordlist; static char *default_stopword[] = { "a", "about", "after", "all", "also", "an", "and", "any", "are", "as", "at", "back", "be", "because", "been", "but", "by", "can", "could", "did", "do", "does", "down", "each", "first", "for", "from", "get", "good", "had", "has", "have", "he", "her", "him", "his", "how", "i", "if", "in", "into", "is", "it", "its", "just", "know", "like", "little", "long", "made", "make", "man", "many", "may", "me", "more", "most", "my", "new", "no", "not", "now", "of", "on", "one", "only", "or", "other", "our", "out", "over", "said", "same", "see", "she", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "to", "too", "two", "up", "us", "used", "very", "was", "way", "we", "were", "what", "when", "where", "which", "who", "why", "will", "with", "woman", "would", "you", "your" }; /**********************************************************************/ static void save_stopword(key) char *key; { Stopword *stopword; stopword = table_lookup(&stopwordtable, key); if (stopword) error_string("duplicate stopword", key, Continue); else { stopword = NEW(Stopword); stopword->key = key; table_insert(&stopwordtable, stopword); } } /**********************************************************************/ void init_stopwords(filename) char *filename; { Word *word; short i; if (initialized) error("stopwords already initialized", Exit); if (filename) { read_text(&text, filename, &textopt); find_words(&wordlist, &text); list_empty(&text, free); for (word = wordlist.first; word; word = word->next) save_stopword(word->string); } else for (i = 0; i < sizeof(default_stopword) / sizeof(char *); i++) save_stopword(default_stopword[i]); initialized = True; } /**********************************************************************/ Boolean is_stopword(string) unsigned char *string; { if (!initialized) error("stopwords not initialized", Exit); return(table_lookup(&stopwordtable, string) ? True : False); }
/* $NetBSD: bcm2835_spireg.h,v 1.1 2013/01/05 20:31:23 jakllsch Exp $ */ /* * Copyright (c) 2012 Jonathan A. Kollasch * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _BROADCOM_BCM2835_SPIREG_H_ #define _BROADCOM_BCM2835_SPIREG_H_ #include <sys/cdefs.h> #define __BIT32(x) ((uint32_t)__BIT(x)) #define __BITS32(x, y) ((uint32_t)__BITS((x), (y))) #define SPI_CS 0x000 #define SPI_CS_CS __BITS32(1,0) #define SPI_CS_CPHA __BIT32(2) #define SPI_CS_CPOL __BIT32(3) #define SPI_CS_CLEAR_TX __BIT32(4) #define SPI_CS_CLEAR_RX __BIT32(5) #define SPI_CS_CSPOL __BIT32(6) #define SPI_CS_TA __BIT32(7) #define SPI_CS_DMAEN __BIT32(8) #define SPI_CS_INTD __BIT32(9) #define SPI_CS_INTR __BIT32(10) #define SPI_CS_ADCS __BIT32(11) #define SPI_CS_REN __BIT32(12) #define SPI_CS_LEN __BIT32(13) #define SPI_CS_LMONO __BIT32(14) #define SPI_CS_TE_EN __BIT32(15) #define SPI_CS_DONE __BIT32(16) #define SPI_CS_RXD __BIT32(17) #define SPI_CS_TXD __BIT32(18) #define SPI_CS_RXR __BIT32(19) #define SPI_CS_RXF __BIT32(20) #define SPI_CS_CSPOL0 __BIT32(21) #define SPI_CS_CSPOL1 __BIT32(22) #define SPI_CS_CSPOL2 __BIT32(23) #define SPI_CS_DMA_LEN __BIT32(24) #define SPI_CS_LEN_LONG __BIT32(25) #define SPI_FIFO 0x004 #define SPI_CLK 0x008 #define SPI_CLK_CDIV __BITS32(15,0) #define SPI_DLEN 0x00c #define SPI_LTOH 0x010 #define SPI_DC 0x014 #endif /* _BROADCOM_BCM2835_SPIREG_H_ */
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* * This file create an DFG_GraphvizDrawPass which helps to draw a data flow * graph's structure using graphviz. */ #pragma once #include <fstream> #include <string> #include "paddle/fluid/inference/analysis/analysis_pass.h" #include "paddle/fluid/inference/analysis/dot.h" namespace paddle { namespace inference { namespace analysis { /* * Output a dot file and write to some place. */ class DFG_GraphvizDrawPass : public DataFlowGraphPass { public: struct Config { Config(const std::string &dir, const std::string &id, bool display_deleted_node = false) : dir(dir), id(id), display_deleted_node(display_deleted_node) {} // The directory to store the .dot or .png files. const std::string dir; // The identifier for this dot file. const std::string id; // Whether to display deleted nodes, default false. const bool display_deleted_node; }; explicit DFG_GraphvizDrawPass(const Config &config) : config_(config) {} bool Initialize(Argument *argument) override { return true; } void Run(DataFlowGraph *graph) override; bool Finalize() override { return true; } std::string repr() const override { return "DFG graphviz drawer"; } std::string description() const override { return "Debug a DFG by draw with graphviz"; } protected: // A counter to add a number prefix to the debugger image output so that they // will sort in the triggered order. static int counter_; // Path of the dot file to output. std::string GenDotPath() const { return config_.dir + "/" + std::to_string(counter_++) + "-graph_" + config_.id + ".dot"; } virtual std::string Draw(DataFlowGraph *graph); Config config_; }; } // namespace analysis } // namespace inference } // namespace paddle
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WebKit_h #define WebKit_h #include "../platform/Platform.h" #include <v8.h> namespace blink { // Initialize the entire Blink (wtf, platform, core, modules and web). // If you just need wtf and platform, use Platform::initialize instead. // // Must be called on the thread that will be the main thread before // using any other public APIs. The provided Platform; must be // non-null and must remain valid until the current thread calls shutdown. BLINK_EXPORT void initialize(Platform*); // Get the V8 Isolate for the main thread. // initialize must have been called first. BLINK_EXPORT v8::Isolate* mainThreadIsolate(); // Once shutdown, the Platform passed to initialize will no longer // be accessed. No other WebKit objects should be in use when this function is // called. Any background threads created by WebKit are promised to be // terminated by the time this function returns. BLINK_EXPORT void shutdown(); // Alters the rendering of content to conform to a fixed set of rules. BLINK_EXPORT void setLayoutTestMode(bool); BLINK_EXPORT bool layoutTestMode(); // Enables or disables the use of the mock theme for layout tests. This function // must be called only if setLayoutTestMode(true). BLINK_EXPORT void setMockThemeEnabledForTest(bool); // Alters the rendering of fonts for layout tests. BLINK_EXPORT void setFontAntialiasingEnabledForTest(bool); BLINK_EXPORT bool fontAntialiasingEnabledForTest(); // Forces the use of the complex text path for layout tests. BLINK_EXPORT void setAlwaysUseComplexTextForTest(bool); BLINK_EXPORT bool alwaysUseComplexTextForTest(); // Purge the plugin list cache. If |reloadPages| is true, any pages // containing plugins will be reloaded after refreshing the plugin list. BLINK_EXPORT void resetPluginCache(bool reloadPages = false); // The embedder should call this periodically in an attempt to balance overall // performance and memory usage. BLINK_EXPORT void decommitFreeableMemory(); // Send memory pressure notification to worker thread isolate. BLINK_EXPORT void MemoryPressureNotificationToWorkerThreadIsolates( v8::MemoryPressureLevel); // Set the RAIL performance mode on all worker thread isolates. BLINK_EXPORT void setRAILModeOnWorkerThreadIsolates(v8::RAILMode); } // namespace blink #endif
#ifndef Z3_H #define Z3_H #include "../SMT.h" #include <memory> #include <vector> #include <z3++.h> namespace SMT { using namespace z3; // class Z3Expr { // std::shared_ptr<> // } class Z3Solver : public SMTFactory<expr, expr> { public: static inline const std::string solver_name() { return "Z3"; }; Z3Solver(); ~Z3Solver(); // sort createBoolType() override; // sort createBVType(int size) override; expr createVar2(const std::string name, int size) override; expr createBoolVar(const std::string name) override; expr createBVVar(const std::string name, int size) override; expr createBVConst(int value, int size) override; expr createBoolConst(int value) override; expr createTrue() override; expr createFalse() override; expr createOrExpr(expr lhs, expr rhs) override; expr createAndExpr(expr lhs, expr rhs) override; expr createNotExpr(expr _expr) override; expr createCondExpr(expr cond, expr choice1, expr choice2) override; expr createEqExpr(expr lhs, expr rhs) override; expr createGtExpr(expr lhs, expr rhs) override; expr createGEqExpr(expr lhs, expr rhs) override; expr createLtExpr(expr lhs, expr rhs) override; expr createLEqExpr(expr lhs, expr rhs) override; expr createImplExpr(expr lhs, expr rhs) override; expr createBitSet(expr container, unsigned int ith, expr value) override; expr createDistinct(std::list<expr> exprs) override; expr joinExprsWithAnd(std::list<expr>& exprs) override; expr joinExprsWithOr(std::list<expr>& exprs) override; void assertLater(expr e) override; void assertNow(expr e) override; SMTResult solve() override; void printModel() override; void loadToSolver() override; void clean() override; void deep_clean() override; void printExpr(expr e) override; void printContext() override; void printContext(std::string filename) override; // void push() override; // void pop() override; private: z3::context context; z3::solver solver; }; } #endif
/*- * Copyright 1998 Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby * granted, provided that both the above copyright notice and this * permission notice appear in all copies, that both the above * copyright notice and this permission notice appear in all * supporting documentation, and that the name of M.I.T. not be used * in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. M.I.T. makes * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: soc2013/dpl/head/sys/i386/include/nexusvar.h 177200 2008-03-13 20:39:04Z jhb $ */ #ifndef _MACHINE_NEXUSVAR_H_ #define _MACHINE_NEXUSVAR_H_ struct nexus_device { struct resource_list nx_resources; }; DECLARE_CLASS(nexus_driver); extern struct rman irq_rman, drq_rman, port_rman, mem_rman; void nexus_init_resources(void); #endif /* !_MACHINE_NEXUSVAR_H_ */
/* See LICENSE file for copyright and license details. */ #define ENV_SUPATH "/bin" #define ENV_PATH "/bin" #define PW_CIPHER "$6$" /* SHA-512 */ #undef UTMP_PATH #define UTMP_PATH "/var/run/utmp" #undef BTMP_PATH #define BTMP_PATH "/var/log/btmp" #undef WTMP_PATH #define WTMP_PATH "/var/log/wtmp"
/* * Copyright (c) 2013, Jay Elliott * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef IMG_ERROR_H_ #define IMG_ERROR_H_ /* maximum length of error messages */ #define IMG_ERROR_LEN 256 /* * set the current error message. * This function can be called with NULL * to unset the error. */ void img_set_error_msg(const char* msg, ...); /* get the current error message. Will return NULL if there is no error */ const char* img_get_error_msg(void); #endif
#include "cran.h" void Rprintf2(FILE * stream, const char *format, ...) { va_list(ap); va_start(ap, format); Rprintf(format, ap); va_end(ap); }
#ifndef _ACMIVIEW_H_ #define _ACMIVIEW_H_ #include "f4thread.h" #include "f4vu.h" #include "AcmiCam.h" #include "Graphics\Include\Tex.h" //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// #define EXTERNAL 0 #define CHASE 1 #define SATELLITE 8 #define REPLAY 9 #define FREE 10 #define STARTPOS 15 //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// class SimBaseClass; class RViewPoint; class RenderOTW; class ImageBuffer; class Render2D; class DrawableObject; class SimObjectType; class C_Window; class ACMITape; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// typedef struct DBLIST { void * node; /* pointer to node data */ void * user; /* pointer to user data */ struct DBLIST * next; /* next list node */ struct DBLIST * prev; /* prev list node */ } DBLIST; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// typedef struct { int listboxId; int menuId; char name[40]; } ACMIEntityUIMap; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// class ACMIView { public: // Constructors. ACMIView(); // Destructor. ~ACMIView(); // Access. ACMITape *Tape(); RViewPoint* Viewpoint(); void ToggleScreenShot(); // An array of sim entity pointers. ACMIEntityUIMap *_entityUIMappings; // display toggles void ToggleLabel(int doIDTags); void ToggleHeading(int val); void ToggleAirSpeed(int val); void ToggleAltitude(int val); void ToggleTurnRate(int val); void ToggleTurnRadius(int val); void ToggleWireFrame(int val); void TogglePoles(int val); void ToggleLockLines(int val); void Togglelockrange(int val);//me123 void InitGraphics(C_Window *win); int ExitGraphics(); void Exec(); void Draw(); void GetObjectName(SimBaseClass* theObject, char *tmpStr); // BING - 4/15/98 void SetObjectName(SimBaseClass* theObject, char *tmpStr); void InitUIVector(); void SetUIVector(Tpoint *tVect); void VectorTranslate(Tpoint *tVector); void VectorToVectorTranslation(Tpoint *tVector, Tpoint *offSetV); // List box functions. char *SetListBoxID(int objectNum, long listID); long ListBoxID(int objectNum, long filter); // Camera selection. void IncrementCameraObject(int inc); void SetCameraObject(int theObject); int CameraObject(); void IncrementTrackingObject(int inc); void SetTrackingObject(int theObject); int TrackingObject(); // More camera selection. void SelectCamera(long camSel); void SwitchCameraObject(long cameraObject); void SwitchTrackingObject(long cameraObject); // Load and unload a tape BOOL LoadTape(char *fname, BOOL reload); void UnloadTape(BOOL reload); BOOL TapeHasLoaded( void ) { return _tapeHasLoaded; }; // panner/camera control functions void SetPannerXYZ( float x, float y, float z ); void SetPannerAzEl( float az, float el ); void ResetPanner( void ); void UpdateViewPosRot( void ); void ToggleTracking( void ) { _tracking ^= 1; }; public: int _initialGraphicsLoad; int IsFinished() { return _drawingFinished; }; char _fileName[MAX_PATH]; int _cameraState; RViewPoint *_viewPoint; RenderOTW *_renderer; Texture wireTexture; HWND _win; // currentCam is the object we're attached to // currentEntityCam is the object we're tracking int _currentCam; int _currentEntityCam; float _objectScale; int _drawing; int _drawingFinished; int _isReady; int _tapeHasLoaded; int _doWeather; int _takeScreenShot; SimBaseClass *_platform; ACMITape *_tape; // camera view controls float _pannerX; float _pannerY; float _pannerZ; float _pannerAz; float _pannerEl; float _chaseX; float _chaseY; float _chaseZ; BOOL _tracking; float _camYaw; float _camPitch; float _camRoll; float _camRange; int _doWireFrame; int _doLockLine; // view position and rotation of camera Trotation _camRot; Tpoint _camPos; Tpoint _camWorldPos; // Initialize, used by constructor and destructor. void Init(); // Setup functions. Allocate and initialize data. void SetupEntityUIMappings(); // Misc functions. void DrawIDTags(); void ShowVersionString(); // Other random functions. void StopGraphicsLoop(); void InsertObjectIntoDrawList(SimBaseClass*); // Take a screen shot. void TakeScreenShot(); }; #include "acmvwinl.cpp" extern ACMIView ACMIDriver; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// #endif // _ACMIVIEW_H_
/* * THE NEW CHRONOTEXT TOOLKIT: https://github.com/arielm/new-chronotext-toolkit * COPYRIGHT (C) 2012-2015, ARIEL MALKA ALL RIGHTS RESERVED. * * THE FOLLOWING SOURCE-CODE IS DISTRIBUTED UNDER THE SIMPLIFIED BSD LICENSE: * https://github.com/arielm/new-chronotext-toolkit/blob/master/LICENSE.md */ #pragma once #include "cinder/Cinder.h" #if !defined(CINDER_ANDROID) # error UNSUPPORTED PLATFORM #endif // --- #include "chronotext/cinder/CinderDelegateBase.h" #include "chronotext/android/cinder/JNI.h" #include <boost/asio.hpp> #include <android/sensor.h> namespace chr { class CinderDelegate : public CinderDelegateBase { public: /* * INVOKED ON THE MAIN-THREAD * * RENDERER'S THREAD IS NOT AVAILABLE (EITHER NOT CREATED YET, OR ALREADY DESTROYED) */ bool performInit(JNIEnv *env, jobject androidContext, jobject androidDisplay, const ci::Vec2i &displaySize, float displayDensity); void performUninit(JNIEnv *env); /* * INVOKED ON THE RENDERER'S THREAD * * GL-CONTEXT IS VALID */ void performSetup(JNIEnv *env, const ci::Vec2i &size); void performShutdown(JNIEnv *env); void performResize(const ci::Vec2i &size); void performUpdate(); void performDraw(); void addTouch(int index, float x, float y); void updateTouch(int index, float x, float y); void removeTouch(int index, float x, float y); void messageFromBridge(int what, const std::string &body = "") final; void sendMessageToBridge(int what, const std::string &body = "") final; void handleEvent(int eventId) final; void performAction(int actionId) final; void enableAccelerometer( float updateFrequency = 30, float filterFactor = 0.1f) final; void disableAccelerometer() final; ci::JsonTree jsonQuery(const char *methodName) final; protected: int updateCount = 0; std::shared_ptr<boost::asio::io_service> io; std::shared_ptr<boost::asio::io_service::work> ioWork; ASensorManager *sensorManager; const ASensor *accelerometerSensor; ASensorEventQueue *sensorEventQueue; void startIOService(); void stopIOService(); void createSensorEventQueue(); void destroySensorEventQueue(); void pollSensorEvents(); void handleAcceleration(ASensorEvent event); int getDisplayRotation(); }; }
/* * Copyright (c) 1997 - 1999, Marek Michałkiewicz * Copyright (c) 2001 - 2005, Tomasz Kłoczko * Copyright (c) 2008 , Nicolas François * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the copyright holders or contributors may not 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 * HOLDERS 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 <config.h> #ifdef USE_PAM #ident "$Id$" /* * Change the user's password using PAM. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include "defines.h" #include "pam_defs.h" #include "prototypes.h" void do_pam_passwd (const char *user, bool silent, bool change_expired) { pam_handle_t *pamh = NULL; int flags = 0, ret; if (silent) flags |= PAM_SILENT; if (change_expired) flags |= PAM_CHANGE_EXPIRED_AUTHTOK; ret = pam_start ("passwd", user, &conv, &pamh); if (ret != PAM_SUCCESS) { fprintf (stderr, _("passwd: pam_start() failed, error %d\n"), ret); exit (10); /* XXX */ } ret = pam_chauthtok (pamh, flags); if (ret != PAM_SUCCESS) { fprintf (stderr, _("passwd: %s\n"), pam_strerror (pamh, ret)); fputs (_("passwd: password unchanged\n"), stderr); pam_end (pamh, ret); exit (10); /* XXX */ } fputs (_("passwd: password updated successfully\n"), stderr); (void) pam_end (pamh, PAM_SUCCESS); } #else /* !USE_PAM */ extern int errno; /* warning: ANSI C forbids an empty source file */ #endif /* !USE_PAM */
/************************************************************************************ * Copyright (c) 2006, University of Kansas - Hybridthreads Group * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the University of Kansas nor the name of the * Hybridthreads Group 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. ************************************************************************************/ /** \internal * \file commands.h * \brief This file contains the declaration of the commands that * can be issued to the timer subsystem * * \author Wesley Peck <peckw@ittc.ku.edu>\n * Ed Komp <komp@ittc.ku.edu> * * This file contains the declaration of the commands which can be issued * the the hardware timers. This includes the ability to start timers, stop * timers, load delta values and others. */ #ifndef _HYBRID_THREADS_TIMER_COMMANDS_H_ #define _HYBRID_THREADS_TIMER_COMMANDS_H_ #include <config.h> #include <util/rops.h> #define HT_TIMER_GLB_LO 0x00 #define HT_TIMER_GLB_HI 0x04 #define HT_TIMER0_CMD 0x08 #define HT_TIMER0_CMDSET 0x0C #define HT_TIMER0_CMDCLR 0x10 #define HT_TIMER0_DELTA 0x14 #define HT_TIMER0_DATA 0x18 #define HT_TIMER0_DELAY 0x1C #define HT_TIMER0_VALUE 0x20 #define HT_TIMER0_INTR_COUNT 0x48 #define HT_TIMER1_CMD 0x24 #define HT_TIMER1_CMDSET 0x28 #define HT_TIMER1_CMDCLR 0x2C #define HT_TIMER1_DELTA 0x30 #define HT_TIMER1_DATA 0x34 #define HT_TIMER1_DELAY 0x38 #define HT_TIMER1_VALUE 0x3C #define HT_TIMER1_INTR_COUNT 0x4C #define HT_DECISION_REG 0x40 #define HT_DECISION_DELAY 0x44 #define HT_TIMER_CMD_RUN 0x01 #define HT_TIMER_CMD_LOAD 0x02 #define HT_TIMER_CMD_ENABLE 0x04 #define HT_TIMER_CMD_PERIODIC 0x08 #define timer_get_command(t) read_reg( TIMER_BASEADDR + \ HT_TIMER##t##_CMD ) #define timer_set_command(t,v) write_reg( TIMER_BASEADDR + \ HT_TIMER##t##_CMDSET, \ (Huint)(v) ) #define timer_clr_command(t,v) write_reg( TIMER_BASEADDR + \ HT_TIMER##t##_CMDCLR, \ (Huint)(v) ) #define timer_get_delta(t) read_reg( TIMER_BASEADDR + \ HT_TIMER##t##_DELTA ) #define timer_set_delta(t,v) write_reg( TIMER_BASEADDR + \ HT_TIMER##t##_DELTA, \ (Huint)(v) ) #define timer_get_data(t) read_reg( TIMER_BASEADDR + \ HT_TIMER##t##_DATA ) #define timer_set_data(t,v) write_reg( TIMER_BASEADDR + \ HT_TIMER##t##_DATA, \ (Huint)(v) ) #define timer_get_intr_count(t) read_reg( TIMER_BASEADDR + \ HT_TIMER##t##_INTR_COUNT ) #define timer_reset_intr_count(t) write_reg( TIMER_BASEADDR + \ HT_TIMER##t##_INTR_COUNT, \ 0x00000001 ) #define timer_get_delay(t) read_reg( TIMER_BASEADDR + \ HT_TIMER##t##_DELAY ) #define timer_get_value(t) read_reg( TIMER_BASEADDR + \ HT_TIMER##t##_VALUE ) #define timer_decision_set(v) write_reg( TIMER_BASEADDR + \ HT_DECISION_REG, \ v ); #define timer_decision_get() read_reg( TIMER_BASEADDR + \ HT_DECISION_REG ); #define timer_decision_delay() read_reg( TIMER_BASEADDR + \ HT_DECISION_DELAY ); #define timer_get_globallo() read_reg( TIMER_BASEADDR + \ HT_TIMER_GLB_LO ) #define timer_get_globalhi() read_reg( TIMER_BASEADDR + \ HT_TIMER_GLB_HI ) #endif
#ifndef _t_sync_message_ #define _t_sync_message_ #include <stdio.h> enum messageT {REQ_PUB, REQ_SD }; #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkImageMagnitude.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 vtkImageMagnitude - Colapses components with magnitude function.. // .SECTION Description // vtkImageMagnitude takes the magnitude of the components. #ifndef vtkImageMagnitude_h #define vtkImageMagnitude_h #include "vtkImagingMathModule.h" // For export macro #include "vtkThreadedImageAlgorithm.h" class VTKIMAGINGMATH_EXPORT vtkImageMagnitude : public vtkThreadedImageAlgorithm { public: static vtkImageMagnitude *New(); vtkTypeMacro(vtkImageMagnitude,vtkThreadedImageAlgorithm); protected: vtkImageMagnitude(); ~vtkImageMagnitude() {} virtual int RequestInformation (vtkInformation *, vtkInformationVector**, vtkInformationVector *); void ThreadedExecute (vtkImageData *inData, vtkImageData *outData, int outExt[6], int id); private: vtkImageMagnitude(const vtkImageMagnitude&) VTK_DELETE_FUNCTION; void operator=(const vtkImageMagnitude&) VTK_DELETE_FUNCTION; }; #endif // VTK-HeaderTest-Exclude: vtkImageMagnitude.h
/***************************************************************************** * CVS File Information : * $RCSfile$ * Author: patmiller $ * Date: 2007/06/11 14:12:54 $ * Revision: 1.2 $ ****************************************************************************/ /***********************************************************************************************/ /* FILE ************************** _MPI_Utility.c ***********************************/ /***********************************************************************************************/ /* Author : Lisa Alano June 26 2002 */ /* Copyright (c) 2002 University of California Regents */ /***********************************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "mpi.h" void _MPI_safeFree(void* buffer,char* message) { _MPI_COVERAGE(); if ( buffer ) free(buffer); } /*=============================================================================================*/ void *_MPI_safeMalloc(int size, char* message) { void *temp; _MPI_COVERAGE(); temp = malloc(size+128); /* HACK: Padding */ _MPI_checkMemAlloc(temp,message); memset(temp,0,size); return temp; } /*=============================================================================================*/ void _MPI_checkMemAlloc (void* array, char* message) { _MPI_COVERAGE(); if (array == (void*) NULL) { _MPI_COVERAGE(); fprintf(stderr, "Cannot allocate: %s\n", message); fflush(stderr); MPI_Abort(MPI_COMM_WORLD, -1); } } /*=============================================================================================*/ void *_MPI_safeRealloc(void* oldBuffer, int size, char* message) { _MPI_COVERAGE(); oldBuffer = realloc (oldBuffer, size); _MPI_checkMemAlloc(oldBuffer, message); /* memset(oldBuffer+oldsize????,0,size); */ return oldBuffer; } /*=============================================================================================*/ int _MPI_checkIntP (int *pt) { _MPI_COVERAGE(); if (pt == NULL) return _MPI_NOT_OK; return MPI_SUCCESS; } /*=============================================================================================*/
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__char_environment_printf_18.c Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-18.tmpl.c */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: environment Read input from an environment variable * GoodSource: Copy a fixed string into data * Sinks: printf * GoodSink: printf with "%s" as the first argument and data as the second * BadSink : printf with only data as an argument * Flow Variant: 18 Control flow: goto statements * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #ifndef OMITBAD void CWE134_Uncontrolled_Format_String__char_environment_printf_18_bad() { char * data; char dataBuffer[100] = ""; data = dataBuffer; goto source; source: { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 100-dataLen-1); } } goto sink; sink: /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ printf(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G() - use badsource and goodsink by reversing the blocks on the second goto statement */ static void goodB2G() { char * data; char dataBuffer[100] = ""; data = dataBuffer; goto source; source: { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 100-dataLen-1); } } goto sink; sink: /* FIX: Specify the format disallowing a format string vulnerability */ printf("%s\n", data); } /* goodG2B() - use goodsource and badsink by reversing the blocks on the first goto statement */ static void goodG2B() { char * data; char dataBuffer[100] = ""; data = dataBuffer; goto source; source: /* FIX: Use a fixed string that does not contain a format specifier */ strcpy(data, "fixedstringtest"); goto sink; sink: /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ printf(data); } void CWE134_Uncontrolled_Format_String__char_environment_printf_18_good() { goodB2G(); 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()..."); CWE134_Uncontrolled_Format_String__char_environment_printf_18_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE134_Uncontrolled_Format_String__char_environment_printf_18_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__char_declare_memcpy_52c.c Label Definition File: CWE126_Buffer_Overread.stack.label.xml Template File: sources-sink-52c.tmpl.c */ /* * @description * CWE: 126 Buffer Over-read * BadSource: Set data pointer to a small buffer * GoodSource: Set data pointer to a large buffer * Sink: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include "std_testcase.h" #include <wchar.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE126_Buffer_Overread__char_declare_memcpy_52c_badSink(char * data) { { char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: using memcpy with the length of the dest where data * could be smaller than dest causing buffer overread */ memcpy(dest, data, strlen(dest)*sizeof(char)); dest[100-1] = '\0'; printLine(dest); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE126_Buffer_Overread__char_declare_memcpy_52c_goodG2BSink(char * data) { { char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: using memcpy with the length of the dest where data * could be smaller than dest causing buffer overread */ memcpy(dest, data, strlen(dest)*sizeof(char)); dest[100-1] = '\0'; printLine(dest); } } #endif /* OMITGOOD */
/* ----------------------------------------------------------------------------- * * (c) The University of Glasgow 2006-2008 * * OS-specific memory management * * ---------------------------------------------------------------------------*/ #ifndef SM_OSMEM_H #define SM_OSMEM_H #include "BeginPrivate.h" void osMemInit(void); void *osGetMBlocks(uint32_t n); void osFreeMBlocks(void *addr, uint32_t n); void osReleaseFreeMemory(void); void osFreeAllMBlocks(void); size_t getPageSize (void); StgWord64 getPhysicalMemorySize (void); void setExecutable (void *p, W_ len, rtsBool exec); rtsBool osNumaAvailable(void); uint32_t osNumaNodes(void); StgWord osNumaMask(void); void osBindMBlocksToNode(void *addr, StgWord size, uint32_t node); INLINE_HEADER size_t roundDownToPage (size_t x) { size_t size = getPageSize(); return (x & ~(size - 1)); } INLINE_HEADER size_t roundUpToPage (size_t x) { size_t size = getPageSize(); return ((x + size - 1) & ~(size - 1)); } #ifdef USE_LARGE_ADDRESS_SPACE /* If "large address space" is enabled, we allocate memory in two steps: first we request some address space, and then we request some memory in it. This allows us to ask for much more address space that we will ever need, which keeps everything nice and consecutive. */ // Reserve the large address space blob of the given size, and return the // address that the OS has chosen for it. It is not safe to access the memory // pointed to by the return value, until that memory is committed using // osCommitMemory(). // // The value pointed to by len will be filled by the caller with an upper // bound on the amount of memory to reserve. On return this will be set // to the amount of memory actually reserved. // // This function is called once when the block allocator is initialized. void *osReserveHeapMemory(W_ *len); // Commit (allocate memory for) a piece of address space, which must // be within the previously reserved space After this call, it is safe // to access @p up to @len bytes. // // There is no guarantee on the contents of the memory pointed to by // @p, in particular it must not be assumed to contain all zeros. void osCommitMemory(void *p, W_ len); // Decommit (release backing memory for) a piece of address space, // which must be within the previously reserve space and must have // been previously committed After this call, it is again unsafe to // access @p (up to @len bytes), but there is no guarantee that the // memory will be released to the system (as far as eg. RSS statistics // from top are concerned). void osDecommitMemory(void *p, W_ len); // Release the address space previously obtained and undo the effects of // osReserveHeapMemory // // This function is called once, when the block allocator is deinitialized // before the program terminates. void osReleaseHeapMemory(void); #endif #include "EndPrivate.h" #endif /* SM_OSMEM_H */
// Copyright 2010 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ // Constant folding. namespace sawzall { class ConstantFoldingVisitor : public NodeVisitor { public: ConstantFoldingVisitor(Proc* proc) : proc_(proc) { } protected: // May be used in contexts which have different mechanisms // for reporting warnings. So the client must provide this method. virtual void Warning(const FileLine* fileline, const char* fmt, ...) = 0; // For most nodes just visit the child nodes. virtual void DoNode(Node* x) { x->VisitChildren(this); } // Do not look inside functions. virtual void DoFunction(Function* x) { } virtual Expr* VisitBinary(Binary* x); virtual Expr* VisitCall(Call* x); virtual Expr* VisitConversion(Conversion* x); virtual Expr* VisitDollar(Dollar* x); virtual Expr* VisitRuntimeGuard(RuntimeGuard* x); virtual Expr* VisitIndex(Index* x); virtual Expr* VisitNew(New* x); virtual Expr* VisitSlice(Slice* x); // Regex is folded by the code generators // Saw is not practical to fold // Selector is not, but could be, folded when applied to a Composite // Variable and TempVariable are not foldable, but see SubstitutionVisitor private: Proc* proc_; }; // In addition to standard constant folding, // encapsulates optimizations we can do at parse-time for expression // referencing static variables. class StaticVarFoldingVisitor : public ConstantFoldingVisitor { public: StaticVarFoldingVisitor(Proc* proc) : ConstantFoldingVisitor(proc) {} private: virtual void Warning(const FileLine* fileline, const char* fmt, ...) {} virtual Expr* VisitVariable(Variable* x); }; } // namespace sawzall
/* Copyright (c) 2016, Apple Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. No license is granted to the trademarks of the copyright holders even if such marks are included in this software. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <CareKit/CareKit.h> @interface OCKInsightsTableViewHeaderView : UIView @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *subtitle; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53c.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_src.label.xml Template File: sources-sink-53c.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: cpy * BadSink : Copy data to string using wcscpy * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD /* bad function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53d_badSink(wchar_t * data); void CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53c_badSink(wchar_t * data) { CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53d_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53d_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53c_goodG2BSink(wchar_t * data) { CWE122_Heap_Based_Buffer_Overflow__c_src_wchar_t_cpy_53d_goodG2BSink(data); } #endif /* OMITGOOD */
#ifndef __MORDOR_HTTP_OAUTH_H__ #define __MORDOR_HTTP_OAUTH_H__ // Copyright (c) 2009 - Mozy, Inc. #include "broker.h" namespace Mordor { namespace HTTP { namespace OAuth { std::pair<std::string, std::string> getTemporaryCredentials(RequestBroker::ptr requestBroker, const URI &uri, const std::string &method, const std::string &signatureMethod, const std::pair<std::string, std::string> &clientCredentials, const URI &callbackUri = URI()); std::pair<std::string, std::string> getTokenCredentials(RequestBroker::ptr requestBroker, const URI &uri, const std::string &method, const std::string &signatureMethod, const std::pair<std::string, std::string> &clientCredentials, const std::pair<std::string, std::string> &temporaryCredentials, const std::string &verifier); void authorize(Request &nextRequest, const std::string &signatureMethod, const std::pair<std::string, std::string> &clientCredentials, const std::pair<std::string, std::string> &tokenCredentials, const std::string &realm = std::string(), const std::string &scheme = std::string()); // Helpers for setting up an OAuth request template <class T> void nonceAndTimestamp(T &oauthParameters); // oauthParameters should *not* be empty; instead if oauth params are in the // POST body or in the querystring, those fields should be empty instead template <class T> std::string generateSignature(const URI &uri, const std::string &method, const std::string &clientSecret, const std::string &tokenSecret, const T &oauthParameters, const URI::QueryString &postParameters = URI::QueryString()); template <class T> void sign(const URI &uri, const std::string &method, const std::string &signatureMethod, const std::string &clientSecret, const std::string &tokenSecret, T &oauthParameters, const URI::QueryString &postParameters = URI::QueryString()); template <class T> bool validate(const URI &uri, const std::string &method, const std::string &clientSecret, const std::string &tokenSecret, const T &oauthParameters, const URI::QueryString &postParameters = URI::QueryString()); std::pair<std::string, std::string> extractCredentials(std::shared_ptr<ClientRequest> request); class RequestBroker : public RequestBrokerFilter { public: RequestBroker(HTTP::RequestBroker::ptr parent, std::function<bool (const URI &, std::shared_ptr<ClientRequest> /* priorRequest = ClientRequest::ptr() */, std::string & /* signatureMethod */, std::pair<std::string, std::string> & /* clientCredentials */, std::pair<std::string, std::string> & /* tokenCredentials */, std::string & /* realm */, size_t /* attempts */)> getCredentialsDg) : RequestBrokerFilter(parent), m_getCredentialsDg(getCredentialsDg) {} std::shared_ptr<ClientRequest> request(Request &requestHeaders, bool forceNewConnection = false, std::function<void (std::shared_ptr<ClientRequest>)> bodyDg = NULL); private: std::function<bool (const URI &, std::shared_ptr<ClientRequest>, std::string &, std::pair<std::string, std::string> &, std::pair<std::string, std::string> &, std::string &, size_t)> m_getCredentialsDg; }; }}} #endif
/* Copyright (c) 2015, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <odp.h> #include "odp_cunit_common.h" #include "cpumask.h" #include "mask_common.h" /* default worker parameter to get all that may be available */ #define ALL_AVAILABLE 0 void cpumask_test_odp_cpumask_def_control(void) { unsigned num; unsigned mask_count; unsigned max_cpus = mask_capacity(); odp_cpumask_t mask; num = odp_cpumask_default_control(&mask, ALL_AVAILABLE); mask_count = odp_cpumask_count(&mask); CU_ASSERT(mask_count == num); CU_ASSERT(num > 0); CU_ASSERT(num <= max_cpus); } void cpumask_test_odp_cpumask_def_worker(void) { unsigned num; unsigned mask_count; unsigned max_cpus = mask_capacity(); odp_cpumask_t mask; num = odp_cpumask_default_worker(&mask, ALL_AVAILABLE); mask_count = odp_cpumask_count(&mask); CU_ASSERT(mask_count == num); CU_ASSERT(num > 0); CU_ASSERT(num <= max_cpus); } void cpumask_test_odp_cpumask_def(void) { unsigned mask_count; unsigned num_worker; unsigned num_control; unsigned max_cpus = mask_capacity(); unsigned available_cpus = odp_cpu_count(); unsigned requested_cpus; odp_cpumask_t mask; CU_ASSERT(available_cpus <= max_cpus); if (available_cpus > 1) requested_cpus = available_cpus - 1; else requested_cpus = available_cpus; num_worker = odp_cpumask_default_worker(&mask, requested_cpus); mask_count = odp_cpumask_count(&mask); CU_ASSERT(mask_count == num_worker); num_control = odp_cpumask_default_control(&mask, 1); mask_count = odp_cpumask_count(&mask); CU_ASSERT(mask_count == num_control); CU_ASSERT(num_control == 1); CU_ASSERT(num_worker <= available_cpus); CU_ASSERT(num_worker > 0); } odp_testinfo_t cpumask_suite[] = { ODP_TEST_INFO(cpumask_test_odp_cpumask_to_from_str), ODP_TEST_INFO(cpumask_test_odp_cpumask_equal), ODP_TEST_INFO(cpumask_test_odp_cpumask_zero), ODP_TEST_INFO(cpumask_test_odp_cpumask_set), ODP_TEST_INFO(cpumask_test_odp_cpumask_clr), ODP_TEST_INFO(cpumask_test_odp_cpumask_isset), ODP_TEST_INFO(cpumask_test_odp_cpumask_count), ODP_TEST_INFO(cpumask_test_odp_cpumask_and), ODP_TEST_INFO(cpumask_test_odp_cpumask_or), ODP_TEST_INFO(cpumask_test_odp_cpumask_xor), ODP_TEST_INFO(cpumask_test_odp_cpumask_copy), ODP_TEST_INFO(cpumask_test_odp_cpumask_first), ODP_TEST_INFO(cpumask_test_odp_cpumask_last), ODP_TEST_INFO(cpumask_test_odp_cpumask_next), ODP_TEST_INFO(cpumask_test_odp_cpumask_setall), ODP_TEST_INFO(cpumask_test_odp_cpumask_def_control), ODP_TEST_INFO(cpumask_test_odp_cpumask_def_worker), ODP_TEST_INFO(cpumask_test_odp_cpumask_def), ODP_TEST_INFO_NULL, }; odp_suiteinfo_t cpumask_suites[] = { {"Cpumask", NULL, NULL, cpumask_suite}, ODP_SUITE_INFO_NULL, }; int cpumask_main(void) { int ret = odp_cunit_register(cpumask_suites); if (ret == 0) ret = odp_cunit_run(); return ret; }
// $Id: Surge.h,v 1.8 2003/10/07 21:45:11 idgay Exp $ /* tab:4 * "Copyright (c) 2000-2003 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice, the following * two paragraphs and the author appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." * * Copyright (c) 2002-2003 Intel Corporation * All rights reserved. * * This file is distributed under the terms in the attached INTEL-LICENSE * file. If you do not find these files, copies can be found by writing to * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, * 94704. Attention: Intel License Inquiry. */ int INITIAL_TIMER_RATE = 2048; int FOCUS_TIMER_RATE = 1000; int FOCUS_NOTME_TIMER_RATE = 1000; enum { SURGE_TYPE_SENSORREADING = 0, SURGE_TYPE_ROOTBEACON = 1, SURGE_TYPE_SETRATE = 2, SURGE_TYPE_SLEEP = 3, SURGE_TYPE_WAKEUP = 4, SURGE_TYPE_FOCUS = 5, SURGE_TYPE_UNFOCUS = 6 }; typedef struct SurgeMsg { uint8_t type; uint16_t reading; uint16_t parentaddr; } __attribute__ ((packed)) SurgeMsg; enum { AM_SURGEMSG = 17 };
// // Copyright (C) 2015-2021 Virgil Security Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // (1) Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // (2) Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in // the documentation and/or other materials provided with the // distribution. // // (3) Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com> // #import <Foundation/Foundation.h> /** Represents key entry for VSSKeyStorage. */ NS_SWIFT_NAME(KeyEntry) @interface VSSKeyEntry : NSObject /** Factory method which allocates and initalizes VSSKeyEntry instance. @param name NSString with key entry name @param value Key raw value @param meta NSDictionary with any meta data @return allocated and initialized VSSCreateCardRequest instance */ + (VSSKeyEntry * __nonnull)keyEntryWithName:(NSString * __nonnull)name value:(NSData * __nonnull)value meta:(NSDictionary<NSString *, NSString *> * __nullable)meta; /** Factory method which allocates and initalizes VSSKeyEntry instance. @param name NSString with key entry name @param value Key raw value @return allocated and initialized VSSKeyEntry instance */ + (VSSKeyEntry * __nonnull)keyEntryWithName:(NSString * __nonnull)name value:(NSData * __nonnull)value; /** NSString with key entry name */ @property (nonatomic, readonly, copy) NSString * __nonnull name; /** Key raw value */ @property (nonatomic, readonly, copy) NSData * __nonnull value; /** NSDictionary with any meta data */ @property (nonatomic, readonly, copy) NSDictionary<NSString *, NSString *> * __nullable meta; /** Unavailable no-argument initializer inherited from NSObject. */ - (instancetype __nonnull)init NS_UNAVAILABLE; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__char_declare_memcpy_64a.c Label Definition File: CWE126_Buffer_Overread.stack.label.xml Template File: sources-sink-64a.tmpl.c */ /* * @description * CWE: 126 Buffer Over-read * BadSource: Set data pointer to a small buffer * GoodSource: Set data pointer to a large buffer * Sinks: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE126_Buffer_Overread__char_declare_memcpy_64b_badSink(void * dataVoidPtr); void CWE126_Buffer_Overread__char_declare_memcpy_64_bad() { char * data; char dataBadBuffer[50]; char dataGoodBuffer[100]; memset(dataBadBuffer, 'A', 50-1); /* fill with 'A's */ dataBadBuffer[50-1] = '\0'; /* null terminate */ memset(dataGoodBuffer, 'A', 100-1); /* fill with 'A's */ dataGoodBuffer[100-1] = '\0'; /* null terminate */ /* FLAW: Set data pointer to a small buffer */ data = dataBadBuffer; CWE126_Buffer_Overread__char_declare_memcpy_64b_badSink(&data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE126_Buffer_Overread__char_declare_memcpy_64b_goodG2BSink(void * dataVoidPtr); static void goodG2B() { char * data; char dataBadBuffer[50]; char dataGoodBuffer[100]; memset(dataBadBuffer, 'A', 50-1); /* fill with 'A's */ dataBadBuffer[50-1] = '\0'; /* null terminate */ memset(dataGoodBuffer, 'A', 100-1); /* fill with 'A's */ dataGoodBuffer[100-1] = '\0'; /* null terminate */ /* FIX: Set data pointer to a large buffer */ data = dataGoodBuffer; CWE126_Buffer_Overread__char_declare_memcpy_64b_goodG2BSink(&data); } void CWE126_Buffer_Overread__char_declare_memcpy_64_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()..."); CWE126_Buffer_Overread__char_declare_memcpy_64_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE126_Buffer_Overread__char_declare_memcpy_64_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__unsigned_int_min_sub_64a.c Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-64a.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: min Set data to the min value for unsigned int * GoodSource: Set data to a small, non-zero number (negative two) * Sinks: sub * GoodSink: Ensure there will not be an underflow before subtracting 1 from data * BadSink : Subtract 1 from data, which can cause an Underflow * Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files * * */ #include "std_testcase.h" #ifndef OMITBAD /* bad function declaration */ void CWE191_Integer_Underflow__unsigned_int_min_sub_64b_badSink(void * dataVoidPtr); void CWE191_Integer_Underflow__unsigned_int_min_sub_64_bad() { unsigned int data; data = 0; /* POTENTIAL FLAW: Use the minimum size of the data type */ data = 0; CWE191_Integer_Underflow__unsigned_int_min_sub_64b_badSink(&data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE191_Integer_Underflow__unsigned_int_min_sub_64b_goodG2BSink(void * dataVoidPtr); static void goodG2B() { unsigned int data; data = 0; /* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */ data = -2; CWE191_Integer_Underflow__unsigned_int_min_sub_64b_goodG2BSink(&data); } /* goodB2G uses the BadSource with the GoodSink */ void CWE191_Integer_Underflow__unsigned_int_min_sub_64b_goodB2GSink(void * dataVoidPtr); static void goodB2G() { unsigned int data; data = 0; /* POTENTIAL FLAW: Use the minimum size of the data type */ data = 0; CWE191_Integer_Underflow__unsigned_int_min_sub_64b_goodB2GSink(&data); } void CWE191_Integer_Underflow__unsigned_int_min_sub_64_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__unsigned_int_min_sub_64_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE191_Integer_Underflow__unsigned_int_min_sub_64_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2015, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above // copyright notice, this list of conditions and the following // disclaimer. // // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided with // the distribution. // // * Neither the name of John Haddon nor the names of // any other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #ifndef GAFFERIMAGE_IMAGEMETADATA_H #define GAFFERIMAGE_IMAGEMETADATA_H #include "Gaffer/CompoundDataPlug.h" #include "GafferImage/MetadataProcessor.h" namespace GafferImage { class ImageMetadata : public MetadataProcessor { public : ImageMetadata( const std::string &name=defaultName<ImageMetadata>() ); virtual ~ImageMetadata(); IE_CORE_DECLARERUNTIMETYPEDEXTENSION( GafferImage::ImageMetadata, ImageMetadataTypeId, MetadataProcessor ); Gaffer::CompoundDataPlug *metadataPlug(); const Gaffer::CompoundDataPlug *metadataPlug() const; virtual void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const; protected : virtual void hashProcessedMetadata( const Gaffer::Context *context, IECore::MurmurHash &h ) const; virtual IECore::ConstCompoundObjectPtr computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundObject *inputMetadata ) const; private : static size_t g_firstPlugIndex; }; IE_CORE_DECLAREPTR( ImageMetadata ); } // namespace GafferImage #endif // GAFFERIMAGE_IMAGEMETADATA_H
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef QTHANDLENEWAPPINSTANCE_H #define QTHANDLENEWAPPINSTANCE_H #include <QString> class QtSingleApplication; bool createTemporaryDir(QString &path); QString handleNewAppInstance(QtSingleApplication *singleApp, int argc, char **argv, const QString &newInstanceArg); #endif // QTHANDLENEWAPPINSTANCE_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_53d.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE131.label.xml Template File: sources-sink-53d.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Allocate memory without using sizeof(int) * GoodSource: Allocate memory using sizeof(int) * Sink: memcpy * BadSink : Copy array to data using memcpy() * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_53d_badSink(int * data) { { int source[10] = {0}; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ memcpy(data, source, 10*sizeof(int)); printIntLine(data[0]); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_53d_goodG2BSink(int * data) { { int source[10] = {0}; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ memcpy(data, source, 10*sizeof(int)); printIntLine(data[0]); } } #endif /* OMITGOOD */
/* 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. */ void bli_trsv_basic_check( obj_t* alpha, obj_t* a, obj_t* x ); void bli_trsv_check( obj_t* alpha, obj_t* a, obj_t* x ); void bli_trsv_int_check( obj_t* alpha, obj_t* a, obj_t* x, trsv_t* cntl );
#import <UIKit/UIKit.h> #import "NTLNCacheCleaner.h" @class NTLNBrowserViewController; @class NTLNFriendsViewController; @class NTLNMentionsViewController; @class NTLNSentsViewController; @class NTLNUnreadsViewController; @class NTLNSettingViewController; @class NTLNFavoriteViewController; @class NTLNDirectMessageViewController; @interface NTLNAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate, NTLNCacheCleanerDelegate> { UIWindow *window; UITabBarController *tabBarController; NTLNFriendsViewController *friendsViewController; NTLNMentionsViewController *replysViewController; NTLNSentsViewController *sentsViewController; NTLNUnreadsViewController *unreadsViewController; NTLNSettingViewController *settingViewController; NTLNFavoriteViewController *favoriteViewController; NTLNDirectMessageViewController *directMessageViewController; BOOL applicationActive; } @property (nonatomic, retain) UIWindow *window; @property (nonatomic, retain) UITabBarController *tabBarController; @property (readonly) BOOL applicationActive; - (BOOL)isInMoreTab:(UIViewController*)vc; - (void)presentTwitterAccountSettingView; - (void)resetAllTimelinesAndCache; @end
/*========================================================================= Program: Visualization Toolkit Module: vtkOpenGLPolyDataMapper2D.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 vtkOpenGLPolyDataMapper2D - 2D PolyData support for OpenGL // .SECTION Description // vtkOpenGLPolyDataMapper2D provides 2D PolyData annotation support for // vtk under OpenGL. Normally the user should use vtkPolyDataMapper2D // which in turn will use this class. // .SECTION See Also // vtkPolyDataMapper2D #ifndef vtkOpenGLPolyDataMapper2D_h #define vtkOpenGLPolyDataMapper2D_h #include "vtkRenderingOpenGL2Module.h" // For export macro #include "vtkPolyDataMapper2D.h" #include "vtkglVBOHelper.h" // used for ivars class vtkRenderer; class vtkPoints; namespace vtkgl {class CellBO; } class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper2D : public vtkPolyDataMapper2D { public: vtkTypeMacro(vtkOpenGLPolyDataMapper2D, vtkPolyDataMapper2D); static vtkOpenGLPolyDataMapper2D *New(); virtual void PrintSelf(ostream& os, vtkIndent indent); // Description: // Actually draw the poly data. void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor); // Description: // Release any graphics resources that are being consumed by this mapper. // The parameter window could be used to determine which graphic // resources to release. void ReleaseGraphicsResources(vtkWindow *); protected: vtkOpenGLPolyDataMapper2D(); ~vtkOpenGLPolyDataMapper2D(); // Description: // Does the shader source need to be recomputed virtual bool GetNeedToRebuildShader(vtkgl::CellBO &cellBO, vtkViewport *ren, vtkActor2D *act); // Description: // Build the shader source code virtual void BuildShader(std::string &VertexCode, std::string &fragmentCode, std::string &geometryCode, vtkViewport *ren, vtkActor2D *act); // Description: // Determine what shader to use and compile/link it virtual void UpdateShader(vtkgl::CellBO &cellBO, vtkViewport *viewport, vtkActor2D *act); // Description: // Set the shader parameteres related to the mapper/input data, called by UpdateShader virtual void SetMapperShaderParameters(vtkgl::CellBO &cellBO, vtkViewport *ren, vtkActor2D *act); // Description: // Set the shader parameteres related to the Camera void SetCameraShaderParameters(vtkgl::CellBO &cellBO, vtkViewport *viewport, vtkActor2D *act); // Description: // Set the shader parameteres related to the property void SetPropertyShaderParameters(vtkgl::CellBO &cellBO, vtkViewport *viewport, vtkActor2D *act); // Description: // Update the scene when necessary. void UpdateVBO(vtkActor2D *act, vtkViewport *viewport); // The VBO and its layout. vtkgl::BufferObject VBO; vtkgl::VBOLayout Layout; // Structures for the various cell types we render. vtkgl::CellBO Points; vtkgl::CellBO Lines; vtkgl::CellBO Tris; vtkgl::CellBO TriStrips; vtkTimeStamp VBOUpdateTime; // When was the VBO updated? vtkPoints *TransformedPoints; private: vtkOpenGLPolyDataMapper2D(const vtkOpenGLPolyDataMapper2D&); // Not implemented. void operator=(const vtkOpenGLPolyDataMapper2D&); // Not implemented. }; #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_ #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_ #include "third_party/skia/include/core/SkColor.h" #include "ui/views/view.h" #include "ui/views/animation/bounds_animator.h" #include "ui/views/animation/bounds_animator_observer.h" class LocationBarView; namespace views { class NativeViewHost; } // LocationBarContainer contains the LocationBarView. Under aura it directly // contains the LocationBarView, on windows an intermediary widget is used. The // intermediary widget is used so that LocationBarContainer can be placed on top // of other native views (such as web content). // LocationBarContainer is positioned by ToolbarView, but it is a child of // BrowserView. This is used when on the NTP. class LocationBarContainer : public views::View, public views::BoundsAnimatorObserver { public: // Creates a new LocationBarContainer as a child of |parent|. LocationBarContainer(views::View* parent, bool instant_extended_api_enabled); virtual ~LocationBarContainer(); // Sets whether the LocationBarContainer is in the toolbar. void SetInToolbar(bool in_toolbar); void SetLocationBarView(LocationBarView* view); // Stacks this view at the top. More specifically stacks the layer (aura) // or widget (windows) at the top of the stack. Used to ensure this is over // web contents. void StackAtTop(); // Animates to the specified position. void AnimateTo(const gfx::Rect& bounds); // Returns true if animating. bool IsAnimating() const; // Returns the target bounds if animating, or the actual bounds if not // animating. gfx::Rect GetTargetBounds(); // views::View overrides: virtual std::string GetClassName() const OVERRIDE; virtual gfx::Size GetPreferredSize() OVERRIDE; virtual bool SkipDefaultKeyEventProcessing( const views::KeyEvent& event) OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // views::BoundsAnimatorObserver overrides: virtual void OnBoundsAnimatorProgressed( views::BoundsAnimator* animator) OVERRIDE {} virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; protected: virtual void OnFocus() OVERRIDE; private: // Sets up platform specific state. void PlatformInit(); // Returns the background color. static SkColor GetBackgroundColor(); // Returns animation duration in milliseconds. static int GetAnimationDuration(); // Used to animate this view. views::BoundsAnimator animator_; // Parent the LocationBarView is added to. views::View* view_parent_; LocationBarView* location_bar_view_; views::NativeViewHost* native_view_host_; bool in_toolbar_; DISALLOW_COPY_AND_ASSIGN(LocationBarContainer); }; #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_
/* Copyright (c) 2015, Apple Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. No license is granted to the trademarks of the copyright holders even if such marks are included in this software. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <ResearchKit/ResearchKit_Private.h> #import "ORKConsentSection.h" NS_ASSUME_NONNULL_BEGIN NSURL *__nullable ORKMovieURLForConsentSectionType(ORKConsentSectionType type); UIImage *__nullable ORKImageForConsentSectionType(ORKConsentSectionType type); NS_ASSUME_NONNULL_END
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */ /* Various macros used here and there */ #define MAKELONG(a,b) ((a) | ((b) << 16)) #define HIWORD(d) ((d) >> 16) #define LOWORD(d) ((d) & 0xffff) #define BYTES(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24)) /* Valid channel types for channel_open() */ #define CH_IN BYTES('T', 'C', 'L', 'O') #define CH_OUT BYTES('R', 'P', 'C', 'I') /* RPC constants */ #define RPC_BUF_SIZE 6134 /* max size of RPC request */ #define RPC_HDR_SIZE 10 /* RPC HGFS header size */ /* RPC macros. These NEED NOT be portable. VMware only does x86(-64) anyway. */ /* ..all this because ACK can't pack structures :( */ #define RPC_NEXT8 *(((u8_t*)(++rpc_ptr))-1) /* get/set next byte */ #define RPC_NEXT16 *(((u16_t*)(rpc_ptr+=2))-1) /* get/set next short */ #define RPC_NEXT32 *(((u32_t*)(rpc_ptr+=4))-1) /* get/set next long */ #define RPC_LEN (rpc_ptr - rpc_buf) /* request length thus far */ #define RPC_ADVANCE(n) rpc_ptr += n /* skip n bytes in buffer */ #define RPC_PTR (rpc_ptr) /* pointer to next data */ #define RPC_RESET rpc_ptr = rpc_buf /* start at beginning */ #define RPC_REQUEST(r) \ RPC_RESET; \ RPC_NEXT8 = 'f'; \ RPC_NEXT8 = ' '; \ RPC_NEXT32 = 0; \ RPC_NEXT32 = r; /* start a RPC request */ /* HGFS requests */ enum { HGFS_REQ_OPEN, HGFS_REQ_READ, HGFS_REQ_WRITE, HGFS_REQ_CLOSE, HGFS_REQ_OPENDIR, HGFS_REQ_READDIR, HGFS_REQ_CLOSEDIR, HGFS_REQ_GETATTR, HGFS_REQ_SETATTR, HGFS_REQ_MKDIR, HGFS_REQ_UNLINK, HGFS_REQ_RMDIR, HGFS_REQ_RENAME, HGFS_REQ_QUERYVOL }; /* HGFS open types */ enum { HGFS_OPEN_TYPE_O, HGFS_OPEN_TYPE_OT, HGFS_OPEN_TYPE_CO, HGFS_OPEN_TYPE_C, HGFS_OPEN_TYPE_COT }; /* HGFS mode/perms conversion macros */ #define HGFS_MODE_TO_PERM(m) (((m) & S_IRWXU) >> 6) #define HGFS_PERM_TO_MODE(p) (((p) << 6) & S_IRWXU)
// -*- c++ -*- /* * Copyright (c) 2010-2012, Jim Bosch * All rights reserved. * * ndarray is distributed under a simple BSD-like license; * see the LICENSE file that should be present in the root * of the source distribution, or alternately available at: * https://github.com/ndarray/ndarray */ #ifndef NDARRAY_EIGEN_BP_EigenView_h_INCLUDED #define NDARRAY_EIGEN_BP_EigenView_h_INCLUDED #include "boost/numpy.hpp" #include "ndarray/bp/Array.h" #include "ndarray/eigen.h" namespace ndarray { template <typename T, int N, int C, typename XprKind_, int Rows_, int Cols_> class ToBoostPython< EigenView<T,N,C,XprKind_,Rows_,Cols_> > { public: typedef boost::numpy::ndarray result_type; static boost::numpy::ndarray apply(EigenView<T,N,C,XprKind_,Rows_,Cols_> const & input) { boost::numpy::ndarray result = ToBoostPython< Array<T,N,C> >::apply(input.shallow()); if (Rows_ == 1 || Cols_ == 1) return result.squeeze(); return result; } }; template <typename T, int N, int C, typename XprKind_, int Rows_, int Cols_> class FromBoostPython< EigenView<T,N,C,XprKind_,Rows_,Cols_> > { public: BOOST_STATIC_ASSERT( N == 1 || N == 2 ); BOOST_STATIC_ASSERT( N != 1 || Rows_ == 1 || Cols_ == 1 ); explicit FromBoostPython(boost::python::object const & input) : _impl(input) {} bool convertible() { try { boost::numpy::ndarray array = boost::python::extract<boost::numpy::ndarray>(_impl.input); if (N == 2) { if (Rows_ == 1) { array = array.reshape(boost::python::make_tuple(1, -1)); } else if (Cols_ == 1) { array = array.reshape(boost::python::make_tuple(-1, 1)); } if (Rows_ != Eigen::Dynamic && array.shape(0) != Rows_) return false; if (Cols_ != Eigen::Dynamic && array.shape(1) != Cols_) return false; } else if (N == 1) { array = array.squeeze(); int requiredSize = Rows_ * Cols_; if (requiredSize != Eigen::Dynamic && array.shape(0) != requiredSize) return false; } _impl.input = array; if (!_impl.convertible()) return false; } catch (boost::python::error_already_set) { boost::python::handle_exception(); PyErr_Clear(); return false; } return true; } EigenView<T,N,C,XprKind_,Rows_,Cols_> operator()() { return EigenView<T,N,C,XprKind_,Rows_,Cols_>(_impl()); } private: FromBoostPython< Array<T,N,C> > _impl; }; } // namespace ndarray #endif // !NDARRAY_EIGEN_BP_EigenView_h_INCLUDED
#ifndef __GETPASS_H #define __GETPASS_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * * $Id: getpass.h,v 1.4 2009-05-18 12:25:45 yangtse Exp $ ***************************************************************************/ #ifndef HAVE_GETPASS_R /* If there's a system-provided function named like this, we trust it is also found in one of the standard headers. */ /* * Returning NULL will abort the continued operation! */ char* getpass_r(const char *prompt, char* buffer, size_t buflen ); #endif #endif
/* * This file Copyright (C) Mnemosyne LLC * * This file is licensed by the GPL version 2. Works owned by the * Transmission project are granted a special exemption to clause 2 (b) * so that the bulk of its code can remain under the MIT license. * This exemption does not extend to derived works not owned by * the Transmission project. * * $Id$ */ #ifndef __TRANSMISSION__ #error only libtransmission should #include this header. #endif #ifndef TR_CACHE_H #define TR_CACHE_H struct evbuffer; typedef struct tr_cache tr_cache; /*** **** ***/ tr_cache * tr_cacheNew (int64_t max_bytes); void tr_cacheFree (tr_cache *); /*** **** ***/ int tr_cacheSetLimit (tr_cache * cache, int64_t max_bytes); int64_t tr_cacheGetLimit (const tr_cache *); int tr_cacheWriteBlock (tr_cache * cache, tr_torrent * torrent, tr_piece_index_t piece, uint32_t offset, uint32_t len, struct evbuffer * writeme); int tr_cacheReadBlock (tr_cache * cache, tr_torrent * torrent, tr_piece_index_t piece, uint32_t offset, uint32_t len, uint8_t * setme); int tr_cachePrefetchBlock (tr_cache * cache, tr_torrent * torrent, tr_piece_index_t piece, uint32_t offset, uint32_t len); /*** **** ***/ int tr_cacheFlushDone (tr_cache * cache); int tr_cacheFlushTorrent (tr_cache * cache, tr_torrent * torrent); int tr_cacheFlushFile (tr_cache * cache, tr_torrent * torrent, tr_file_index_t file); #endif
// // NUIViewRenderer.h // NUIDemo // // Created by Tom Benner on 11/24/12. // Copyright (c) 2012 Tom Benner. All rights reserved. // #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> #import "NUISettings.h" @interface NUIViewRenderer : NSObject + (void)render:(UIView*)view withClass:(NSString*)className; + (void)renderBorderAndCorner:(UIView*)view withClass:(NSString*)className; + (void)renderShadow:(UIView*)view withClass:(NSString*)className; + (void)renderSize:(UIView*)view withClass:(NSString*)className; + (BOOL)hasShadowProperties:(UIView*)view withClass:(NSString*)className; @end
#include <lib.h> #define stat _stat #include <sys/stat.h> #include <string.h> PUBLIC int stat(name, buffer) _CONST char *name; struct stat *buffer; { message m; m.m1_i1 = strlen(name) + 1; m.m1_p1 = (char *) name; m.m1_p2 = (char *) buffer; return(_syscall(FS, STAT, &m)); }
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Controls\0.18.8\Graphics\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Controls.Circle.h> #include <Fuse.Controls.Graphics.ShapeVisual-1.h> #include <Fuse.Scripting.INameScope.h> namespace g{namespace Fuse{namespace Controls{namespace Graphics{struct CircleVisual;}}}} namespace g{namespace Fuse{namespace Drawing{struct Brush;}}} namespace g{namespace Fuse{namespace Drawing{struct Stroke;}}} namespace g{namespace Fuse{struct DrawContext;}} namespace g{namespace Fuse{struct HitTestContext;}} namespace g{ namespace Fuse{ namespace Controls{ namespace Graphics{ // public sealed class CircleVisual :740 // { ::g::Fuse::Controls::Graphics::ShapeVisual_type* CircleVisual_typeof(); void CircleVisual__ctor_4_fn(CircleVisual* __this); void CircleVisual__get_Circle_fn(CircleVisual* __this, ::g::Fuse::Controls::Circle** __retval); void CircleVisual__DrawFill_fn(CircleVisual* __this, ::g::Fuse::DrawContext* dc, ::g::Fuse::Drawing::Brush* fill); void CircleVisual__DrawStroke_fn(CircleVisual* __this, ::g::Fuse::DrawContext* dc, ::g::Fuse::Drawing::Stroke* stroke); void CircleVisual__New1_fn(CircleVisual** __retval); void CircleVisual__OnHitTest_fn(CircleVisual* __this, ::g::Fuse::HitTestContext* htc); struct CircleVisual : ::g::Fuse::Controls::Graphics::ShapeVisual { void ctor_4(); ::g::Fuse::Controls::Circle* Circle(); static CircleVisual* New1(); }; // } }}}} // ::g::Fuse::Controls::Graphics
/* * This file is part of the coreboot project. * * Copyright (C) 2010 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 as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef RS780_CHIP_H #define RS780_CHIP_H /* Member variables are defined in devicetree.cb. */ struct southbridge_amd_rs780_config { u8 gppsb_configuration; /* The configuration of General Purpose Port, A/B/C/D/E. */ u8 gpp_configuration; /* The configuration of General Purpose Port, C/D. */ u16 port_enable; /* Which port is enabled? GFX(2,3), GPP(4,5,6,7) */ u8 gfx_dev2_dev3; /* for GFX Core initialization REFCLK_SEL */ u8 gfx_dual_slot; /* Is it dual graphics slots */ u8 gfx_lane_reversal; /* Single/Dual slot lan reversal */ u8 gfx_tmds; /* whether support TMDS? */ u8 gfx_compliance; /* whether support compliance? */ u8 gfx_reconfiguration; /* Dynamic Link Width Control */ u8 gfx_link_width; /* Desired width of lane 2 */ u8 gfx_pcie_config; /* GFX PCIE Modes */ u8 gfx_ddi_config; /* GFX DDI Modes */ }; #endif /* RS780_CHIP_H */
/* * optionstree.h - Soft-coded options structure header * Copyright (C) 2006 Kevin Smith * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #ifndef OPTIONSTREE_H #define OPTIONSTREE_H #include "varianttree.h" /** * \class OptionsTree * \brief Dynamic hierachical options structure * OptionsTree allows the dynamic creation of options (of type QVariant) * and will save and load these to/from xml. */ class OptionsTree : public QObject { Q_OBJECT public: OptionsTree(QObject *parent = nullptr); ~OptionsTree(); QVariant getOption(const QString &name, const QVariant &defaultValue = QVariant::Invalid) const; inline QVariant getOption(const char *name, const QVariant &defaultValue = QVariant::Invalid) const { return getOption(QString(QString::fromLatin1(name)), defaultValue); } // Warning: when inserting Map/Hash be very careful with keys. They are going to become xml element names. // full set of supported types can be found in VariantTree::variantToElement() void setOption(const QString &name, const QVariant &value); bool isInternalNode(const QString &node) const; void setComment(const QString &name, const QString &comment); QString getComment(const QString &name) const; QStringList allOptionNames() const; QStringList getChildOptionNames(const QString & = QString(""), bool direct = false, bool internal_nodes = false) const; bool removeOption(const QString &name, bool internal_nodes = false); static bool isValidName(const QString &name); // Map helpers QString mapLookup(const QString &basename, const QVariant &key) const; QString mapPut(const QString &basename, const QVariant &key); void mapPut(const QString &basename, const QVariant &key, const QString &node, const QVariant &value); QVariant mapGet(const QString &basename, const QVariant &key, const QString &node) const; QVariant mapGet(const QString &basename, const QVariant &key, const QString &node, const QVariant &def) const; QVariantList mapKeyList(const QString &basename, bool sortedByNumbers = false) const; bool saveOptions(const QString &fileName, const QString &configName, const QString &configNS, const QString &configVersion, bool streamWriter = false) const; bool loadOptions(const QString &fileName, const QString &configName, const QString &configNS = "", const QString &configVersion = "", bool streamReader = false); bool loadOptions(const QDomElement &name, const QString &configName, const QString &configNS = "", const QString &configVersion = ""); static bool exists(QString fileName); signals: void optionChanged(const QString &option); void optionAboutToBeInserted(const QString &option); void optionInserted(const QString &option); void optionAboutToBeRemoved(const QString &option); void optionRemoved(const QString &option); private: VariantTree tree_; friend class OptionsTreeReader; friend class OptionsTreeWriter; }; #endif // OPTIONSTREE_H
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. Test that the function: struct tm *gmtime(const time_t *); is declared. */ #include <time.h> typedef struct tm *(*gmtime_test) (const time_t *); static int dummyfcn(void) { gmtime_test dummyvar; dummyvar = gmtime; return 0; }
/* This file is part of Warzone 2100. Copyright (C) 1999-2004 Eidos Interactive Copyright (C) 2005-2015 Warzone 2100 Project Warzone 2100 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. Warzone 2100 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 Warzone 2100; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _netlog_h #define _netlog_h #include "lib/framework/frame.h" #include "netplay.h" bool NETstartLogging(); bool NETstopLogging(); WZ_DECL_NONNULL(1) bool NETlogEntry(const char *str, UDWORD a, UDWORD b); void NETlogPacket(uint8_t type, uint32_t size, bool received); #endif // _netlog_h
#pragma once #include "stdafx.h" #include "GLHelpers.h" #include "../Common/TextGlyphs.h" namespace gl { class text_writer { private: gl::glsl::program m_program; gl::glsl::shader m_vs; gl::glsl::shader m_fs; gl::vao m_vao; gl::buffer m_text_buffer; gl::buffer m_scale_offsets_buffer; std::unordered_map<u8, std::pair<u32, u32>> m_offsets; bool initialized = false; bool enabled = false; void init_program() { std::string vs = { "#version 420\n" "#extension GL_ARB_shader_draw_parameters: enable\n" "layout(location=0) in vec2 pos;\n" "uniform vec2 offsets[255];\n" "uniform vec2 scale;\n" "\n" "void main()\n" "{\n" " vec2 offset = offsets[gl_DrawIDARB];\n" " gl_Position = vec4(pos, 0., 1.);\n" " gl_Position.xy = gl_Position.xy * scale + offset;\n" "}\n" }; std::string fs = { "#version 420\n" "layout(location=0) out vec4 col0;\n" "uniform vec4 draw_color;\n" "\n" "void main()\n" "{\n" " col0 = draw_color;\n" "}\n" }; m_fs.create(gl::glsl::shader::type::fragment); m_fs.source(fs); m_fs.compile(); m_vs.create(gl::glsl::shader::type::vertex); m_vs.source(vs); m_vs.compile(); m_program.create(); m_program.attach(m_vs); m_program.attach(m_fs); m_program.make(); } void load_program(float scale_x, float scale_y, float *offsets, int nb_offsets, color4f color) { float scale[] = { scale_x, scale_y }; m_program.use(); m_program.uniforms["draw_color"] = color; glProgramUniform2fv(m_program.id(), m_program.uniforms["offsets"].location(), nb_offsets, offsets); glProgramUniform2fv(m_program.id(), m_program.uniforms["scale"].location(), 1, scale); } public: text_writer() {} ~text_writer(){} void init() { //Check for ARB_shader_draw_parameters //While it is possible to draw text without full multidraw support, issuing separate draw calls per character is not effecient int ext_count; glGetIntegerv(GL_NUM_EXTENSIONS, &ext_count); for (int i = 0; i < ext_count; i++) { const char *ext = (const char*)glGetStringi(GL_EXTENSIONS, i); if (std::string(ext) == "GL_ARB_shader_draw_parameters") { enabled = true; break; } } if (!enabled) { LOG_ERROR(RSX, "Debug overlay could not start because ARB_shader_draw_parameters is not supported by your GPU"); return; } m_text_buffer.create(); m_scale_offsets_buffer.create(); GlyphManager glyph_source; auto points = glyph_source.generate_point_map(); const u32 buffer_size = points.size() * sizeof(GlyphManager::glyph_point); m_text_buffer.data(buffer_size, points.data()); m_offsets = glyph_source.get_glyph_offsets(); m_scale_offsets_buffer.data(512 * 4 * sizeof(float)); //Init VAO int old_vao; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao); m_vao.create(); m_vao.bind(); //This is saved as part of the bound VAO's state m_vao.array_buffer = m_text_buffer; glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_FLOAT, false, sizeof(GlyphManager::glyph_point), 0); glBindVertexArray(old_vao); init_program(); initialized = true; } void print_text(int x, int y, int target_w, int target_h, const std::string &text, color4f color = { 0.3f, 1.f, 0.3f, 1.f }) { if (!enabled) return; verify(HERE), initialized; std::vector<GLint> offsets; std::vector<GLsizei> counts; std::vector<float> shader_offsets; char *s = const_cast<char *>(text.c_str()); //Y is in raster coordinates: convert to bottom-left origin y = (target_h - y - 16); //Compress [0, w] and [0, h] into range [-1, 1] float scale_x = 2.f / target_w; float scale_y = 2.f / target_h; float base_offset = 0.f; shader_offsets.reserve(text.length() * 2); while (*s) { u8 offset = (u8)*s; bool to_draw = false; //Can be false for space or unsupported characters auto o = m_offsets.find(offset); if (o != m_offsets.end()) { if (o->second.second > 0) { to_draw = true; offsets.push_back(o->second.first); counts.push_back(o->second.second); } } if (to_draw) { //Generate a scale_offset pair for this entry float offset_x = scale_x * (x + base_offset); offset_x -= 1.f; float offset_y = scale_y * y; offset_y -= 1.f; shader_offsets.push_back(offset_x); shader_offsets.push_back(offset_y); } base_offset += 9.f; s++; } //TODO: Add drop shadow if deemed necessary for visibility int old_vao; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao); load_program(scale_x, scale_y, shader_offsets.data(), counts.size(), color); m_vao.bind(); glMultiDrawArrays(GL_POINTS, offsets.data(), counts.data(), counts.size()); glBindVertexArray(old_vao); } void close() { if (initialized) { m_scale_offsets_buffer.remove(); m_text_buffer.remove(); m_vao.remove(); m_program.remove(); m_fs.remove(); m_vs.remove(); initialized = false; } } }; }
/* * arch/powerpc/platforms/embedded6xx/flipper-pic.h * * Nintendo GameCube/Wii interrupt controller support. * Copyright (C) 2004-2009 The GameCube Linux Team * Copyright (C) 2007,2008,2009 Albert Herranz * * 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 __FLIPPER_PIC_H #define __FLIPPER_PIC_H #define FLIPPER_NR_IRQS 32 /* * Each interrupt has a corresponding bit in both * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers. * * Enabling/disabling an interrupt line involves asserting/clearing * the corresponding bit in IMR. ACK'ing a request simply involves * asserting the corresponding bit in ICR. */ #define FLIPPER_ICR 0x00 #define FLIPPER_ICR_RSS (1<<16) /* reset switch state */ #define FLIPPER_IMR 0x04 #define FLIPPER_RESET 0x24 unsigned int flipper_pic_get_irq(void); void __init flipper_pic_probe(void); void flipper_quiesce(void); void flipper_platform_reset(void); int flipper_is_reset_button_pressed(void); #endif
/* support for ap->rresolv missing */ /* Modifications: 1998-07-01 - Arnaldo Carvalho de Melo - GNU gettext instead of catgets, snprintf instead of sprintf */ #include "config.h" #if HAVE_AFIPX #include <asm/types.h> #include <sys/types.h> #include <sys/socket.h> #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) #include <netipx/ipx.h> #else #include "ipx.h" #endif #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <ctype.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #include "version.h" #include "net-support.h" #include "pathnames.h" #include "intl.h" #include "util.h" /* UGLY */ int IPX_rprint(int options) { /* int ext = options & FLAG_EXT; */ int numeric = options & FLAG_NUM_HOST; char buff[1024]; char net[128], router_net[128]; char router_node[128]; int num; FILE *fp; const struct aftype *ap; struct sockaddr_storage sas; fp = fopen(_PATH_PROCNET_IPX_ROUTE1, "r"); if (!fp) { fp = fopen(_PATH_PROCNET_IPX_ROUTE2, "r"); } if (!fp) { perror(NULL); printf(_("IPX routing not in file %s or %s found.\n"), _PATH_PROCNET_IPX_ROUTE1, _PATH_PROCNET_IPX_ROUTE2); return 1; } if ((ap = get_afntype(AF_IPX)) == NULL) { EINTERN("lib/ipx_rt.c", "AF_IPX missing"); return (-1); } printf(_("Kernel IPX routing table\n")); /* xxx */ printf(_("Destination Router Net Router Node\n")); if (fgets(buff, 1023, fp)) /* eat line */; while (fgets(buff, 1023, fp)) { num = sscanf(buff, "%s %s %s", net, router_net, router_node); if (num < 3) continue; /* Fetch and resolve the Destination */ (void) ap->input(1, net, &sas); safe_strncpy(net, ap->sprint(&sas, numeric), sizeof(net)); /* Fetch and resolve the Router Net */ (void) ap->input(1, router_net, &sas); safe_strncpy(router_net, ap->sprint(&sas, numeric), sizeof(router_net)); /* Fetch and resolve the Router Node */ (void) ap->input(2, router_node, &sas); safe_strncpy(router_node, ap->sprint(&sas, numeric), sizeof(router_node)); printf("%-25s %-25s %-25s\n", net, router_net, router_node); } (void) fclose(fp); return (0); } #endif /* HAVE_AFIPX */
#ifndef __DEFINES_H__ #define __DEFINES_H__ #endif
/***************************************************************************** * * 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 * * $Id: cpu.c 585 2006-01-16 09:48:55Z picard $ * * The Core Pocket Media Player * Copyright (c) 2004-2005 Gabor Kovacs * ****************************************************************************/ #include "../common.h" #include "cpu.h" #ifdef ARM extern int STDCALL CheckARM5E(); extern int STDCALL CheckARMXScale(); #endif #ifndef SH3 extern void STDCALL GetCpuId(int,uint32_t*); #if defined(TARGET_SYMBIAN) && !defined(ARM) #define GetCpuId(a,b) #endif static NOINLINE void SafeGetCpuId(int Id, uint32_t* p) { memset(p,0,4*sizeof(uint32_t)); TRY_BEGIN { bool_t Mode = KernelMode(1); GetCpuId(Id,p); KernelMode(Mode); } TRY_END } #endif int CPUCaps() { cpudetect p; CPUDetect(&p); return p.Caps; } void CPUDetect(cpudetect* p) { int Caps = 0; uint32_t CpuId[4]; memset(p,0,sizeof(cpudetect)); #ifdef ARM p->Arch = T("ARM"); SafeGetCpuId(0,CpuId); if (CpuId[0]) { p->ICache = 512 << ((CpuId[1] >> 6) & 7); p->DCache = 512 << ((CpuId[1] >> 18) & 7); } else { #if !defined(TARGET_PALMOS) && !defined(TARGET_SYMBIAN) // when need to detect cpu features somehow // (only works if we can catch cpu exceptions) TRY_BEGIN { if (CheckARM5E()) { int XScale; Caps |= CAPS_ARM_5E; XScale = CheckARMXScale(); if (XScale) { p->ICache = p->DCache = 32768; Caps |= CAPS_ARM_XSCALE; if (XScale > 1) Caps |= CAPS_ARM_WMMX; } } } TRY_END #endif } if ((CpuId[0] & 0xFF000000) == 0x54000000) //TI { p->Vendor = T("TI"); Caps |= CAPS_ARM_GENERAL; switch ((CpuId[0] >> 4) & 0xFFF) { case 0x915: p->Model = T("915T"); break; case 0x925: p->Model = T("925T"); break; case 0x926: p->Model = T("926T"); Caps |= CAPS_ARM_5E; break; } } else if ((CpuId[0] & 0xFF000000) == 0x41000000) //arm { Caps |= CAPS_ARM_GENERAL; switch ((CpuId[0] >> 4) & 0xFFF) { case 0x920: p->Model = T("920T"); break; case 0x922: p->Model = T("922T"); break; case 0x926: p->Model = T("926E"); Caps |= CAPS_ARM_5E; break; case 0x940: p->Model = T("940T"); break; case 0x946: p->Model = T("946E"); Caps |= CAPS_ARM_5E; break; case 0xA22: p->Model = T("1020E"); Caps |= CAPS_ARM_5E; break; } } else if ((CpuId[0] & 0xFF000000) == 0x69000000) //intel { p->Vendor = T("Intel"); if ((CpuId[0] & 0xFF0000) == 0x050000) //intel arm5e Caps |= CAPS_ARM_5E|CAPS_ARM_XSCALE; if (((CpuId[0] >> 4) & 0xFFF) == 0xB11) { p->Model = T("SA1110"); } else { switch ((CpuId[0] >> 13) & 7) { case 0x2: Caps |= CAPS_ARM_WMMX; break; } switch ((CpuId[0] >> 4) & 31) { case 0x10: p->Model = T("PXA25x/26x"); break; case 0x11: p->Model = T("PXA27x"); break; case 0x12: p->Model = T("PXA210"); break; case 0x9: p->Model = T("PXA31x"); break; } } } #elif defined(MIPS) SafeGetCpuId(0,CpuId); p->Arch = T("MIPS"); if (((CpuId[0] >> 8) & 255) == 0x0c) { if ((CpuId[0] & 0xF0) == 0x50) { Caps |= CAPS_MIPS_VR4110; p->Model = T("VR411X"); } else { Caps |= CAPS_MIPS_VR4120; if ((CpuId[0] & 0xF0) == 0x80) p->Model = T("VR413X"); else p->Model = T("VR412X"); } } #elif defined(SH3) CpuId[0] = 0; // avoid warning Caps = CpuId[0]; p->Arch = T("SH3"); #elif defined(_M_IX86) p->Arch = T("x86"); SafeGetCpuId(0,CpuId); if (CpuId[1] == 0x756e6547 && CpuId[3] == 0x49656e69 && CpuId[2] == 0x6c65746e) { p->Vendor = T("Intel"); Intel: SafeGetCpuId(1,CpuId); if (CpuId[3] & 0x00800000) { Caps |= CAPS_X86_MMX; if (CpuId[3] & 0x02000000) Caps |= CAPS_X86_MMX2 | CAPS_X86_SSE; if (CpuId[3] & 0x04000000) Caps |= CAPS_X86_SSE2; } } else if (CpuId[1] == 0x68747541 && CpuId[3] == 0x69746e65 && CpuId[2] == 0x444d4163) { p->Vendor = T("AMD"); SafeGetCpuId(0x80000000,CpuId); if (CpuId[0] < 0x80000001) goto Intel; SafeGetCpuId(0x80000001,CpuId); if (CpuId[3] & 0x00800000) { Caps |= CAPS_X86_MMX; if (CpuId[3] & 0x80000000) Caps |= CAPS_X86_3DNOW; if (CpuId[3] & 0x00400000) Caps |= CAPS_X86_MMX2; } } else if (CpuId[1] == 0x746e6543 && CpuId[3] == 0x48727561 && CpuId[2] == 0x736c7561) { p->Vendor = T("VIA C3"); SafeGetCpuId(0x80000000,CpuId); if (CpuId[0] < 0x80000001) goto Intel; SafeGetCpuId(0x80000001,CpuId); if (CpuId[3] & (1<<31)) Caps |= CAPS_X86_3DNOW; if (CpuId[3] & (1<<23)) Caps |= CAPS_X86_MMX; if (CpuId[3] & (1<<24)) Caps |= CAPS_X86_MMX2; } else if (CpuId[1] == 0x69727943 && CpuId[3] == 0x736e4978 && CpuId[2] == 0x64616574) { p->Vendor = T("Cyrix"); if (CpuId[0] != 2) goto Intel; SafeGetCpuId(0x80000001,CpuId); if (CpuId[3] & 0x00800000) { Caps |= CAPS_X86_MMX; if (CpuId[3] & 0x01000000) Caps |= CAPS_X86_MMX2; } } #endif p->Caps = Caps; }
/* $Id: os_linux_kernel.h 369517 2012-07-01 17:28:57Z file $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.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 __PJ_COMPAT_OS_LINUX_KERNEL_H__ #define __PJ_COMPAT_OS_LINUX_KERNEL_H__ /** * @file os_linux.h * @brief Describes Linux operating system specifics. */ #define PJ_OS_NAME "linux-module" #define PJ_HAS_ARPA_INET_H 0 #define PJ_HAS_ASSERT_H 0 #define PJ_HAS_CTYPE_H 0 #define PJ_HAS_ERRNO_H 0 #define PJ_HAS_LINUX_SOCKET_H 1 #define PJ_HAS_MALLOC_H 0 #define PJ_HAS_NETDB_H 0 #define PJ_HAS_NETINET_IN_H 0 #define PJ_HAS_SETJMP_H 0 #define PJ_HAS_STDARG_H 1 #define PJ_HAS_STDDEF_H 0 #define PJ_HAS_STDIO_H 0 #define PJ_HAS_STDLIB_H 0 #define PJ_HAS_STRING_H 0 #define PJ_HAS_SYS_IOCTL_H 0 #define PJ_HAS_SYS_SELECT_H 0 #define PJ_HAS_SYS_SOCKET_H 0 #define PJ_HAS_SYS_TIME_H 0 #define PJ_HAS_SYS_TIMEB_H 0 #define PJ_HAS_SYS_TYPES_H 0 #define PJ_HAS_TIME_H 0 #define PJ_HAS_UNISTD_H 0 #define PJ_HAS_MSWSOCK_H 0 #define PJ_HAS_WINSOCK_H 0 #define PJ_HAS_WINSOCK2_H 0 #define PJ_SOCK_HAS_INET_ATON 0 /* Set 1 if native sockaddr_in has sin_len member. * Default: 0 */ #define PJ_SOCKADDR_HAS_LEN 0 /* When this macro is set, getsockopt(SOL_SOCKET, SO_ERROR) will return * the status of non-blocking connect() operation. */ #define PJ_HAS_SO_ERROR 1 /** * If this macro is set, it tells select I/O Queue that select() needs to * be given correct value of nfds (i.e. largest fd + 1). This requires * select ioqueue to re-scan the descriptors on each registration and * unregistration. * If this macro is not set, then ioqueue will always give FD_SETSIZE for * nfds argument when calling select(). * * Default: 0 */ #define PJ_SELECT_NEEDS_NFDS 0 /* Is errno a good way to retrieve OS errors? * (probably no for linux kernel) * If you answer no here, you'll need to tell pjlib how to get OS * error (a compile error will tell you exactly where) */ #define PJ_HAS_ERRNO_VAR 0 /* This value specifies the value set in errno by the OS when a non-blocking * socket recv() can not return immediate daata. */ #define PJ_BLOCKING_ERROR_VAL EAGAIN /* This value specifies the value set in errno by the OS when a non-blocking * socket connect() can not get connected immediately. */ #define PJ_BLOCKING_CONNECT_ERROR_VAL EINPROGRESS #ifndef PJ_HAS_THREADS # define PJ_HAS_THREADS (1) #endif /* * Declare __FD_SETSIZE now before including <linux*>. */ #define __FD_SETSIZE PJ_IOQUEUE_MAX_HANDLES #define NULL ((void*)0) #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ #define __PJ_EXPORT_SYMBOL(a) EXPORT_SYMBOL(a); /* * Override features. */ #define PJ_HAS_FLOATING_POINT 0 #define PJ_HAS_MALLOC 0 #define PJ_HAS_SEMAPHORE 0 #define PJ_HAS_EVENT_OBJ 0 #define PJ_HAS_HIGH_RES_TIMER 1 #ifndef PJ_OS_HAS_CHECK_STACK # define PJ_OS_HAS_CHECK_STACK 0 #endif #define PJ_TERM_HAS_COLOR 0 #define PJ_NATIVE_STRING_IS_UNICODE 0 #define PJ_ATOMIC_VALUE_TYPE int #define PJ_THREAD_DESC_SIZE 128 /* If 1, use Read/Write mutex emulation for platforms that don't support it */ #define PJ_EMULATE_RWMUTEX 0 /* If 1, pj_thread_create() should enforce the stack size when creating * threads. * Default: 0 (let OS decide the thread's stack size). */ #define PJ_THREAD_SET_STACK_SIZE 0 /* If 1, pj_thread_create() should allocate stack from the pool supplied. * Default: 0 (let OS allocate memory for thread's stack). */ #define PJ_THREAD_ALLOCATE_STACK 0 #endif /* __PJ_COMPAT_OS_LINUX_KERNEL_H__ */
/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef __STORAGE_TEST_H__ #define __STORAGE_TEST_H__ #include <commonlib/sd_mmc_ctrlr.h> #include <device/device.h> #include <device/pci.h> #include <timer.h> #ifdef __SIMPLE_DEVICE__ uint32_t storage_test_init(pci_devfn_t dev, uint32_t *previous_bar, uint16_t *previous_command); void storage_test(uint32_t bar, int full_initialization); void storage_test_complete(pci_devfn_t dev, uint32_t previous_bar, uint16_t previous_command); #else uint32_t storage_test_init(struct device *dev, uint32_t *previous_bar, uint16_t *previous_command); void storage_test(uint32_t bar, int full_initialization); void storage_test_complete(struct device *dev, uint32_t previous_bar, uint16_t previous_command); #endif /* Logging support */ struct log_entry { struct mono_time time; struct mmc_command cmd; int cmd_issued; int ret; uint32_t response_entries; uint32_t response[4]; }; #define LOG_ENTRIES 256 #endif /* __STORAGE_TEST_H__ */
/* Copyright (C) 2013-2016, The Regents of The University of Michigan. All rights reserved. This software was developed in the APRIL Robotics Lab under the direction of Edwin Olson, ebolson@umich.edu. This software may be available under alternative licensing terms; contact the address above. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the Regents of The University of Michigan. */ #ifndef _MATHUTIL_H #define _MATHUTIL_H #include <math.h> #include <float.h> #include <stdlib.h> #include <stdint.h> #include <assert.h> #include <string.h> // memcpy #ifdef __cplusplus //extern "C" { #endif #if defined(_MSC_VER) #define inline __inline #endif #ifndef M_TWOPI # define M_TWOPI 6.2831853071795862319959 /* 2*pi */ #endif #ifndef M_PI # define M_PI 3.141592653589793238462643383279502884196 #endif #define to_radians(x) ( (x) * (M_PI / 180.0 )) #define to_degrees(x) ( (x) * (180.0 / M_PI )) #ifndef max #define max(A, B) (A < B ? B : A) #endif #ifndef min #define min(A, B) (A < B ? A : B) #endif /* DEPRECATE, threshold meaningless without context. static inline int dequals(double a, double b) { double thresh = 1e-9; return (fabs(a-b) < thresh); } */ static inline int dequals_mag(double a, double b, double thresh) { return (fabs(a-b) < thresh); } static inline int isq(int v) { return v*v; } static inline float fsq(float v) { return v*v; } static inline double sq(double v) { return v*v; } static inline double sgn(double v) { return (v>=0) ? 1 : -1; } // random number between [0, 1) static inline float randf() { return ((float) rand()) / (RAND_MAX + 1.0f); } static inline float signed_randf() { return randf()*2 - 1; } // return a random integer between [0, bound) static inline int irand(int bound) { int v = (int) (randf()*bound); if (v == bound) return (bound-1); //assert(v >= 0); //assert(v < bound); return v; } /** Map vin to [0, 2*PI) **/ static inline double mod2pi_positive(double vin) { return vin - M_TWOPI * floor(vin / M_TWOPI); } /** Map vin to [-PI, PI) **/ static inline double mod2pi(double vin) { return mod2pi_positive(vin + M_PI) - M_PI; } /** Return vin such that it is within PI degrees of ref **/ static inline double mod2pi_ref(double ref, double vin) { return ref + mod2pi(vin - ref); } /** Map vin to [0, 360) **/ static inline double mod360_positive(double vin) { return vin - 360 * floor(vin / 360); } /** Map vin to [-180, 180) **/ static inline double mod360(double vin) { return mod360_positive(vin + 180) - 180; } static inline int theta_to_int(double theta, int max) { theta = mod2pi_ref(M_PI, theta); int v = (int) (theta / M_TWOPI * max); if (v == max) v = 0; assert (v >= 0 && v < max); return v; } static inline int imin(int a, int b) { return (a < b) ? a : b; } static inline int imax(int a, int b) { return (a > b) ? a : b; } static inline int64_t imin64(int64_t a, int64_t b) { return (a < b) ? a : b; } static inline int64_t imax64(int64_t a, int64_t b) { return (a > b) ? a : b; } static inline int iclamp(int v, int minv, int maxv) { return imax(minv, imin(v, maxv)); } static inline double dclamp(double a, double min, double max) { if (a < min) return min; if (a > max) return max; return a; } static inline int fltcmp (float f1, float f2) { float epsilon = f1-f2; if (epsilon < 0.0) return -1; else if (epsilon > 0.0) return 1; else return 0; } static inline int dblcmp (double d1, double d2) { double epsilon = d1-d2; if (epsilon < 0.0) return -1; else if (epsilon > 0.0) return 1; else return 0; } #ifdef __cplusplus //} #endif #endif
/* Hash tables for the CPP library. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Per Bothner, 1994. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ #include "config.h" #include "system.h" #include "cpplib.h" #include "internal.h" static cpp_hashnode *alloc_node (hash_table *); /* Return an identifier node for hashtable.c. Used by cpplib except when integrated with the C front ends. */ static cpp_hashnode * alloc_node (hash_table *table) { cpp_hashnode *node; node = obstack_alloc (&table->pfile->hash_ob, sizeof (cpp_hashnode)); memset (node, 0, sizeof (cpp_hashnode)); return node; } /* Set up the identifier hash table. Use TABLE if non-null, otherwise create our own. */ void _cpp_init_hashtable (cpp_reader *pfile, hash_table *table) { struct spec_nodes *s; if (table == NULL) { pfile->our_hashtable = 1; table = ht_create (13); /* 8K (=2^13) entries. */ table->alloc_node = (hashnode (*) (hash_table *)) alloc_node; _obstack_begin (&pfile->hash_ob, 0, 0, (void *(*) (long)) xmalloc, (void (*) (void *)) free); } table->pfile = pfile; pfile->hash_table = table; /* Now we can initialize things that use the hash table. */ _cpp_init_directives (pfile); _cpp_init_internal_pragmas (pfile); s = &pfile->spec_nodes; s->n_defined = cpp_lookup (pfile, DSC("defined")); s->n_true = cpp_lookup (pfile, DSC("true")); s->n_false = cpp_lookup (pfile, DSC("false")); s->n__VA_ARGS__ = cpp_lookup (pfile, DSC("__VA_ARGS__")); s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC; } /* Tear down the identifier hash table. */ void _cpp_destroy_hashtable (cpp_reader *pfile) { if (pfile->our_hashtable) { ht_destroy (pfile->hash_table); obstack_free (&pfile->hash_ob, 0); } } /* Returns the hash entry for the STR of length LEN, creating one if necessary. */ cpp_hashnode * cpp_lookup (cpp_reader *pfile, const unsigned char *str, unsigned int len) { /* ht_lookup cannot return NULL. */ return CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_ALLOC)); } /* Determine whether the str STR, of length LEN, is a defined macro. */ int cpp_defined (cpp_reader *pfile, const unsigned char *str, int len) { cpp_hashnode *node; node = CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_NO_INSERT)); /* If it's of type NT_MACRO, it cannot be poisoned. */ return node && node->type == NT_MACRO; } /* For all nodes in the hashtable, callback CB with parameters PFILE, the node, and V. */ void cpp_forall_identifiers (cpp_reader *pfile, cpp_cb cb, void *v) { /* We don't need a proxy since the hash table's identifier comes first in cpp_hashnode. */ ht_forall (pfile->hash_table, (ht_cb) cb, v); }
/* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once /*** This file is part of systemd. Copyright 2016 Lennart Poettering systemd 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. systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include "macro.h" typedef struct LoopDevice LoopDevice; /* Some helpers for setting up loopback block devices */ struct LoopDevice { int fd; int nr; char *node; bool relinquished; }; int loop_device_make(int fd, int open_flags, LoopDevice **ret); int loop_device_make_by_path(const char *path, int open_flags, LoopDevice **ret); LoopDevice* loop_device_unref(LoopDevice *d); DEFINE_TRIVIAL_CLEANUP_FUNC(LoopDevice*, loop_device_unref); void loop_device_relinquish(LoopDevice *d);
/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef _DRAMC_SOC_H_ #define _DRAMC_SOC_H_ enum { CHANNEL_A = 0, CHANNEL_B, CHANNEL_NUM }; enum { GW_PARAM_COARSE = 0, GW_PARAM_FINE, GW_PARAM_NUM }; enum { DUAL_RANKS = 2, CATRAINING_NUM = 10 }; enum { DQ_DATA_WIDTH = 32, DQS_BIT_NUMBER = 8, DQS_NUMBER = (DQ_DATA_WIDTH / DQS_BIT_NUMBER) }; #endif /* _DRAMC_COMMON_H_ */
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test that if value.it_value = 0, the timer is disarmed. Test by * disarming a currently armed timer. * * For this test, signal SIGTOTEST will be used, clock CLOCK_REALTIME * will be used. */ #include <time.h> #include <signal.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include "posixtest.h" #define SIGTOTEST SIGALRM #define TIMEREXPIRE 3 static void handler(int signo PTS_ATTRIBUTE_UNUSED) { printf("Incorrectly in signal handler\n"); printf("Test FAILED\n"); exit(PTS_FAIL); } int main(void) { struct sigevent ev; struct sigaction act; timer_t tid; struct itimerspec its; struct timespec ts; ev.sigev_notify = SIGEV_SIGNAL; ev.sigev_signo = SIGTOTEST; act.sa_handler = handler; act.sa_flags = 0; if (sigemptyset(&act.sa_mask) == -1) { perror("Error calling sigemptyset\n"); return PTS_UNRESOLVED; } if (sigaction(SIGTOTEST, &act, 0) == -1) { perror("Error calling sigaction\n"); return PTS_UNRESOLVED; } if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { perror("timer_create() did not return success\n"); return PTS_UNRESOLVED; } /* * First set timer to TIMEREXPIRE */ its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; its.it_value.tv_sec = TIMEREXPIRE; its.it_value.tv_nsec = 0; if (timer_settime(tid, 0, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } /* * Second, set value.it_value = 0 */ its.it_value.tv_sec = 0; its.it_value.tv_nsec = 0; if (timer_settime(tid, 0, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } /* * Ensure sleep for TIMEREXPIRE seconds not interrupted */ ts.tv_sec = TIMEREXPIRE; ts.tv_nsec = 0; if (nanosleep(&ts, NULL) == -1) { printf("nanosleep() interrupted\n"); printf("Test FAILED\n"); return PTS_FAIL; } printf("Test PASSED\n"); return PTS_PASS; }
/* * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright 2003 PathScale, Inc. * Derived from include/asm-i386/pgtable.h * Licensed under the GPL */ #ifndef __UM_PGTABLE_2LEVEL_H #define __UM_PGTABLE_2LEVEL_H #include <asm-generic/pgtable-nopmd.h> /* PGDIR_SHIFT determines what a third-level page table entry can map */ #define PGDIR_SHIFT 22 #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) /* * entries per page directory level: the i386 is two-level, so * we don't really have any PMD directory physically. */ #define PTRS_PER_PTE 1024 #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) #define PTRS_PER_PGD 1024 #define FIRST_USER_ADDRESS 0 #define pte_ERROR(e) \ printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), \ pte_val(e)) #define pgd_ERROR(e) \ printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), \ pgd_val(e)) static inline int pgd_newpage(pgd_t pgd) { return 0; } static inline void pgd_mkuptodate(pgd_t pgd) { } #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) #define pte_pfn(x) phys_to_pfn(pte_val(x)) #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) #define pmd_page_vaddr(pmd) \ ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) /* * Bits 0 through 3 are taken */ #define PTE_FILE_MAX_BITS 28 #define pte_to_pgoff(pte) (pte_val(pte) >> 4) #define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE }) #endif
/***************************************************************************** * File: 3dCamera.h * * © 1989 Mark M. Owen. All rights reserved. *****************************************************************************/ #ifndef _3d_ #include "3d.h" #endif #ifndef _Camera_ #define _Camera_ /* Horizontal angles of view for 35mm Camera Lens equivalence * when used on a 640x480 screen. A 35mm film frame has an * aspect ratio of 0.666É whereas the 640x480 screen is 0.75. * For example: using the Lens40mm selection below will cause * 46¡ of a circle centered about the viewer to span the width * of a 640x480 pixel screen. Lens specifications vary, but * often include horizontal, vertical and diagonal field of * view specifications. This implementation considers only the * horizontal specification. */ #define Lens15mm Int2Fix( 105 ) #define Lens20mm Int2Fix( 83 ) #define Lens30mm Int2Fix( 62 ) #define Lens40mm Int2Fix( 46 ) #define Lens50mm Int2Fix( 40 ) #define Lens60mm Int2Fix( 33 ) #define Lens70mm Int2Fix( 29 ) #define Lens80mm Int2Fix( 26 ) #define Lens90mm Int2Fix( 23 ) #define Lens100mm Int2Fix( 20 ) #define Lens150mm Int2Fix( 15 ) #define Lens200mm Int2Fix( 10 ) #define Lens500mm Int2Fix( 4 ) #define Lens1000mm Int2Fix( 2 ) #define AimCamera3d(fx,fy,fz,tx,ty,tz,vAngle)\ { Point3d from,to;\ \ SetPt3d(&from,(fx), (fy),(fz));\ SetPt3d(&to,(tx), (ty),(tz) );\ AimCamera(from,to,(vAngle),0.000);\ } #if XVT_CC_PROTO void AimCamera (Point3d, Point3d, Fixed, Fixed); #else void AimCamera (); #endif #endif
/*************************************************************************** * * * copyright : (C) 2007 The University of Toronto * * netterfield@astro.utoronto.ca * * * * 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 BUILTINRELATIONS_H #define BUILTINRELATIONS_H #include "kstmath_export.h" namespace Kst { namespace Builtins { KSTMATH_EXPORT void initRelations(); } } #endif // vim: ts=2 sw=2 et
/* * \brief Utility for synchronizing the access of interface methods * \author Norman Feske * \date 2013-05-16 */ #ifndef _INCLUDE__BASE__SYNCED_INTERFACE_H_ #define _INCLUDE__BASE__SYNCED_INTERFACE_H_ /* Genode includes */ #include <base/lock.h> namespace Genode { template <typename, typename LOCK = Genode::Lock> class Synced_interface; } /* * Utility for synchronizing the access of interface methods * * The 'Synced_interface' utility makes the serialization of interface * method calls easy. The 'Synced_interface' is a functor that takes a lock * and a pointer to an interface as arguments. When called, the functor * returns a smart pointer to the interface. When this smart pointer gets * dereferenced, the smart pointer takes care of acquiring and releasing * the lock while the interface method is executed. */ template <typename IF, typename LOCK> class Genode::Synced_interface { public: class Guard { private: LOCK &_lock; IF *_interface; Guard(LOCK &lock, IF *interface) : _lock(lock), _interface(interface) { _lock.lock(); } friend class Synced_interface; public: ~Guard() { _lock.unlock(); } IF *operator -> () { return _interface; } }; private: LOCK &_lock; IF *_interface; public: Synced_interface(LOCK &lock, IF *interface) : _lock(lock), _interface(interface) { } Guard operator () () { return Guard(_lock, _interface); } Guard operator () () const { return Guard(_lock, _interface); } }; #endif /* _INCLUDE__BASE__SYNCED_INTERFACE_H_ */
#ifndef NEWLANGUAGESERVERDLG_H #define NEWLANGUAGESERVERDLG_H #include "UI.h" #include "LanguageServerEntry.h" #include <wx/arrstr.h> class LanguageServerPage; class NewLanguageServerDlg : public NewLanguageServerDlgBase { LanguageServerPage* m_page = nullptr; public: NewLanguageServerDlg(wxWindow* parent); virtual ~NewLanguageServerDlg(); LanguageServerEntry GetData() const; protected: virtual void OnOKUI(wxUpdateUIEvent& event); }; #endif // NEWLANGUAGESERVERDLG_H
/* * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. * Created by: rusty.lynch REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. Test case for assertion #3 of the sigaction system call that shows calling sigaction with a null act argument does not change the signal handler. Steps: 1. Initialize global variable to indicate handler has not been called 2. Set the signal handler for SIGCONT to handler 3. Call sigaction with a null act 4. raise SIGCONT 5. Verify handler was called. */ #include <signal.h> #include <stdio.h> #include "posixtest.h" static volatile int handler_called; static void handler(int signo PTS_ATTRIBUTE_UNUSED) { handler_called = 1; } int main(void) { struct sigaction act; struct sigaction oact; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); if (sigaction(SIGCONT, &act, 0) == -1) { perror("Unexpected error while attempting to setup test " "pre-conditions"); return PTS_UNRESOLVED; } if (sigaction(SIGCONT, 0, &oact) == -1) { perror("Unexpected error while attempting to setup test " "pre-conditions"); return PTS_UNRESOLVED; } if (raise(SIGCONT) == -1) { perror("Unexpected error while attempting to setup test " "pre-conditions"); return PTS_UNRESOLVED; } if (handler_called) { printf("Test PASSED\n"); return PTS_PASS; } printf("Test FAILED\n"); return PTS_FAIL; }
/* $Id: vboxext.h $ */ /** @file * * VBox extension to Wine D3D * * Copyright (C) 2011-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ #ifndef ___VBOXEXT_H__ #define ___VBOXEXT_H__ #ifdef VBOX_WINE_WITHOUT_LIBWINE # include <windows.h> #endif #include <iprt/list.h> HRESULT VBoxExtCheckInit(); HRESULT VBoxExtCheckTerm(); #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) # ifndef VBOX_WITH_WDDM /* Windows destroys HDC created by a given thread when the thread is terminated * this leads to a mess-up in Wine & Chromium code in some situations, e.g. * D3D device is created in one thread, then the thread is terminated, * then device is started to be used in another thread */ HDC VBoxExtGetDC(HWND hWnd); int VBoxExtReleaseDC(HWND hWnd, HDC hDC); # endif /* We need to do a VBoxTlsRefRelease for the current thread context on thread exit to avoid memory leaking * Calling VBoxTlsRefRelease may result in a call to context dtor callback, which is supposed to be run under wined3d lock. * We can not acquire a wined3d lock in DllMain since this would result in a lock order violation, which may result in a deadlock. * In other words, wined3d may internally call Win32 API functions which result in a DLL lock acquisition while holding wined3d lock. * So lock order should always be "wined3d lock" -> "dll lock". * To avoid possible deadlocks we make an asynchronous call to a worker thread to make a context release from there. */ struct wined3d_context; void VBoxExtReleaseContextAsync(struct wined3d_context *context); #endif /* API for creating & destroying windows */ HRESULT VBoxExtWndDestroy(HWND hWnd, HDC hDC); HRESULT VBoxExtWndCreate(DWORD width, DWORD height, HWND *phWnd, HDC *phDC); /* hashmap */ typedef DECLCALLBACK(uint32_t) FNVBOXEXT_HASHMAP_HASH(void *pvKey); typedef FNVBOXEXT_HASHMAP_HASH *PFNVBOXEXT_HASHMAP_HASH; typedef DECLCALLBACK(bool) FNVBOXEXT_HASHMAP_EQUAL(void *pvKey1, void *pvKey2); typedef FNVBOXEXT_HASHMAP_EQUAL *PFNVBOXEXT_HASHMAP_EQUAL; struct VBOXEXT_HASHMAP; struct VBOXEXT_HASHMAP_ENTRY; typedef DECLCALLBACK(bool) FNVBOXEXT_HASHMAP_VISITOR(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor); typedef FNVBOXEXT_HASHMAP_VISITOR *PFNVBOXEXT_HASHMAP_VISITOR; typedef struct VBOXEXT_HASHMAP_ENTRY { RTLISTNODE ListNode; void *pvKey; uint32_t u32Hash; } VBOXEXT_HASHMAP_ENTRY, *PVBOXEXT_HASHMAP_ENTRY; typedef struct VBOXEXT_HASHMAP_BUCKET { RTLISTNODE EntryList; } VBOXEXT_HASHMAP_BUCKET, *PVBOXEXT_HASHMAP_BUCKET; #define VBOXEXT_HASHMAP_NUM_BUCKETS 29 typedef struct VBOXEXT_HASHMAP { PFNVBOXEXT_HASHMAP_HASH pfnHash; PFNVBOXEXT_HASHMAP_EQUAL pfnEqual; uint32_t cEntries; VBOXEXT_HASHMAP_BUCKET aBuckets[VBOXEXT_HASHMAP_NUM_BUCKETS]; } VBOXEXT_HASHMAP, *PVBOXEXT_HASHMAP; void VBoxExtHashInit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_HASH pfnHash, PFNVBOXEXT_HASHMAP_EQUAL pfnEqual); PVBOXEXT_HASHMAP_ENTRY VBoxExtHashPut(PVBOXEXT_HASHMAP pMap, void *pvKey, PVBOXEXT_HASHMAP_ENTRY pEntry); PVBOXEXT_HASHMAP_ENTRY VBoxExtHashGet(PVBOXEXT_HASHMAP pMap, void *pvKey); PVBOXEXT_HASHMAP_ENTRY VBoxExtHashRemove(PVBOXEXT_HASHMAP pMap, void *pvKey); void* VBoxExtHashRemoveEntry(PVBOXEXT_HASHMAP pMap, PVBOXEXT_HASHMAP_ENTRY pEntry); void VBoxExtHashVisit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor); void VBoxExtHashCleanup(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor); DECLINLINE(uint32_t) VBoxExtHashSize(PVBOXEXT_HASHMAP pMap) { return pMap->cEntries; } DECLINLINE(void*) VBoxExtHashEntryKey(PVBOXEXT_HASHMAP_ENTRY pEntry) { return pEntry->pvKey; } struct VBOXEXT_HASHCACHE_ENTRY; typedef DECLCALLBACK(void) FNVBOXEXT_HASHCACHE_CLEANUP_ENTRY(void *pvKey, struct VBOXEXT_HASHCACHE_ENTRY *pEntry); typedef FNVBOXEXT_HASHCACHE_CLEANUP_ENTRY *PFNVBOXEXT_HASHCACHE_CLEANUP_ENTRY; typedef struct VBOXEXT_HASHCACHE_ENTRY { VBOXEXT_HASHMAP_ENTRY MapEntry; uint32_t u32Usage; } VBOXEXT_HASHCACHE_ENTRY, *PVBOXEXT_HASHCACHE_ENTRY; typedef struct VBOXEXT_HASHCACHE { VBOXEXT_HASHMAP Map; uint32_t cMaxElements; PFNVBOXEXT_HASHCACHE_CLEANUP_ENTRY pfnCleanupEntry; } VBOXEXT_HASHCACHE, *PVBOXEXT_HASHCACHE; #define VBOXEXT_HASHCACHE_FROM_MAP(_pMap) RT_FROM_MEMBER((_pMap), VBOXEXT_HASHCACHE, Map) #define VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(_pEntry) RT_FROM_MEMBER((_pEntry), VBOXEXT_HASHCACHE_ENTRY, MapEntry) DECLINLINE(void) VBoxExtCacheInit(PVBOXEXT_HASHCACHE pCache, uint32_t cMaxElements, PFNVBOXEXT_HASHMAP_HASH pfnHash, PFNVBOXEXT_HASHMAP_EQUAL pfnEqual, PFNVBOXEXT_HASHCACHE_CLEANUP_ENTRY pfnCleanupEntry) { VBoxExtHashInit(&pCache->Map, pfnHash, pfnEqual); pCache->cMaxElements = cMaxElements; pCache->pfnCleanupEntry = pfnCleanupEntry; } DECLINLINE(PVBOXEXT_HASHCACHE_ENTRY) VBoxExtCacheGet(PVBOXEXT_HASHCACHE pCache, void *pvKey) { PVBOXEXT_HASHMAP_ENTRY pEntry = VBoxExtHashRemove(&pCache->Map, pvKey); return VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(pEntry); } DECLINLINE(void) VBoxExtCachePut(PVBOXEXT_HASHCACHE pCache, void *pvKey, PVBOXEXT_HASHCACHE_ENTRY pEntry) { PVBOXEXT_HASHMAP_ENTRY pOldEntry = VBoxExtHashPut(&pCache->Map, pvKey, &pEntry->MapEntry); PVBOXEXT_HASHCACHE_ENTRY pOld; if (!pOldEntry) return; pOld = VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(pOldEntry); if (pOld != pEntry) pCache->pfnCleanupEntry(pvKey, pOld); } void VBoxExtCacheCleanup(PVBOXEXT_HASHCACHE pCache); DECLINLINE(void) VBoxExtCacheTerm(PVBOXEXT_HASHCACHE pCache) { VBoxExtCacheCleanup(pCache); } #endif /* #ifndef ___VBOXEXT_H__*/
/* * Xylon DRM driver plane header * * Copyright (C) 2014 Xylon d.o.o. * Author: Davor Joja <davor.joja@logicbricks.com> * * Based on Xilinx DRM plane header. * Copyright (C) 2013 Xilinx, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _XYLON_DRM_PLANE_H_ #define _XYLON_DRM_PLANE_H_ enum xylon_drm_plane_op_id { XYLON_DRM_PLANE_OP_ID_BACKGROUND_COLOR, XYLON_DRM_PLANE_OP_ID_COLOR_TRANSPARENCY, XYLON_DRM_PLANE_OP_ID_INTERLACE, XYLON_DRM_PLANE_OP_ID_TRANSPARENCY, XYLON_DRM_PLANE_OP_ID_TRANSPARENT_COLOR }; struct xylon_drm_plane_op { enum xylon_drm_plane_op_id id; u32 param; }; struct xylon_drm_plane_manager; void xylon_drm_plane_dpms(struct drm_plane *base_plane, int dpms); int xylon_drm_plane_fb_set(struct drm_plane *base_plane, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, u32 src_x, u32 src_y, u32 src_w, u32 src_h); void xylon_drm_plane_commit(struct drm_plane *base_plane); void xylon_drm_plane_destroy(struct drm_plane *base_plane); struct drm_plane * xylon_drm_plane_create(struct xylon_drm_plane_manager *manager, unsigned int possible_crtcs, bool priv, int priv_id); void xylon_drm_plane_destroy_all(struct xylon_drm_plane_manager *manager); int xylon_drm_plane_create_all(struct xylon_drm_plane_manager *manager, unsigned int possible_crtcs); bool xylon_drm_plane_check_format(struct xylon_drm_plane_manager *manager, u32 format); unsigned int xylon_drm_plane_get_bits_per_pixel(struct drm_plane *base_plane); int xylon_drm_plane_op(struct drm_plane *base_plane, struct xylon_drm_plane_op *op); struct xylon_drm_plane_manager * xylon_drm_plane_probe_manager(struct drm_device *dev, struct xylon_cvc *cvc); void xylon_drm_plane_remove_manager(struct xylon_drm_plane_manager *manager); #endif /* _XYLON_DRM_PLANE_H_ */
#ifndef COLOURS_H_ #define COLOURS_H_ #include "colours_external.h" extern int Colours_table[256]; typedef enum { COLOURS_PRESET_STANDARD, COLOURS_PRESET_DEEPBLACK, COLOURS_PRESET_VIBRANT, COLOURS_PRESET_CUSTOM, /* Number of "normal" (not including CUSTOM) values in enumerator */ COLOURS_PRESET_SIZE = COLOURS_PRESET_CUSTOM } Colours_preset_t; /* Contains controls for palette adjustment. These controls are available for NTSC and PAL palettes. */ typedef struct Colours_setup_t { double hue; /* TV tint control */ double saturation; double contrast; double brightness; double gamma; /* Delay between phases of two consecutive chromas, in degrees. Corresponds to the color adjustment potentiometer on the bottom of Atari computers. */ double color_delay; int black_level; /* 0..255. ITU-R Recommendation BT.601 advises it to be 16. */ int white_level; /* 0..255. ITU-R Recommendation BT.601 advises it to be 235. */ } Colours_setup_t; /* Limits for the adjustable values. */ #define COLOURS_HUE_MIN -1.0 #define COLOURS_HUE_MAX 1.0 #define COLOURS_SATURATION_MIN -1.0 #define COLOURS_SATURATION_MAX 1.0 #define COLOURS_CONTRAST_MIN -2.0 #define COLOURS_CONTRAST_MAX 2.0 #define COLOURS_BRIGHTNESS_MIN -2.0 #define COLOURS_BRIGHTNESS_MAX 2.0 #define COLOURS_GAMMA_MIN 1.0 #define COLOURS_GAMMA_MAX 3.5 #define COLOURS_DELAY_MIN 10 #define COLOURS_DELAY_MAX 50 /* Pointer to the current palette setup. Depending on the current TV system, it points to the NTSC setup, or the PAL setup. (See COLOURS_NTSC_setup and COLOURS_PAL_setup.) */ extern Colours_setup_t *Colours_setup; #define Colours_GetR(x) ((UBYTE) (Colours_table[x] >> 16)) #define Colours_GetG(x) ((UBYTE) (Colours_table[x] >> 8)) #define Colours_GetB(x) ((UBYTE) Colours_table[x]) /* Packs R, G, B into palette COLORTABLE_PTR for colour number I. */ void Colours_SetRGB(int i, int r, int g, int b, int *colortable_ptr); /* Called when the TV system changes, it updates the current palette accordingly. */ void Colours_SetVideoSystem(int mode); /* Updates the current palette - should be called after changing palette setup or loading/unloading an external palette. */ void Colours_Update(void); /* Restores default setup for the current palette (NTSC or PAL one). Colours_Update should be called afterwards to apply changes. */ void Colours_RestoreDefaults(void); /* Save the current colours, including adjustments, to a palette file. Returns TRUE on success or FALSE on error. */ int Colours_Save(const char *filename); /* Pointer to an externally-loaded palette. Depending on the current TV system, it points to the external NTSC or PAL palette - they can be loaded independently. (See COLOURS_NTSC_external and COLOURS_PAL_external.) */ extern COLOURS_EXTERNAL_t *Colours_external; /* Initialise variables before loading from config file. */ void Colours_PreInitialise(void); /* Read/write to configuration file. */ int Colours_ReadConfig(char *option, char *ptr); void Colours_WriteConfig(FILE *fp); /* Colours initialisation and processing of command-line arguments. */ int Colours_Initialise(int *argc, char *argv[]); /* Functions for setting and getting the color preset. PRESET cannot equal COLOURS_PRESET_CUSTOM. */ void Colours_SetPreset(Colours_preset_t preset); Colours_preset_t Colours_GetPreset(void); /* Convert given R, G and B values to corresponding Y, U, V values (all in the 0.0 - 1.0 range). */ void Colours_RGB2YUV(double r, double g, double b, double *y, double *u, double *v); /* Convert given Y, U and V values to corresponding R, G, B values (all in the 0.0 - 1.0 range). */ void Colours_YUV2RGB(double y, double u, double v, double *r, double *g, double *b); /* Converts a gamma-adjusted color value c (0 <= c <= 1) into linear value. */ double Colours_Gamma2Linear(double c, double gamma_adj); /* Converts a linear color value c (0 <= c <= 1) into sRGB gamma-corrected value. */ double Colours_Linear2sRGB(double c); #endif /* COLOURS_H_ */
/* * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include <JavaScriptCore/JavaScript.h> #include <wtf/Optional.h> #include <wtf/RefCounted.h> namespace WTR { class JSWrappable : public RefCounted<JSWrappable> { public: virtual ~JSWrappable() { } virtual JSClassRef wrapperClass() = 0; }; inline JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, std::optional<bool> value) { return value ? JSValueMakeBoolean(context, value.value()) : JSValueMakeNull(context); } inline std::optional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value) { return JSValueIsUndefined(context, value) || JSValueIsNull(context, value) ? std::nullopt : std::optional<bool>(JSValueToBoolean(context, value)); } inline JSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull) { return stringOrNull ? JSValueMakeString(context, stringOrNull) : JSValueMakeNull(context); } } // namespace WTR
/*++ linux/drivers/media/video/wmt_v4l2/sensors/flash/flash_eup2471.c Copyright (c) 2013 WonderMedia Technologies, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 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/>. WonderMedia Technologies, Inc. 10F, 529, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C. --*/ /* wmt.camera.flash <flash>:<en>:<flen> * wmt.camera.flash eup2471:3:2 */ #include <linux/gpio.h> #include <mach/wmt_env.h> #include "../cmos-subdev.h" #include "../../wmt-vid.h" #include "flash.h" struct eup2471_struct { int gpio_en; int gpio_flen; }; static struct eup2471_struct *eup; #define EUP2471_I2CADDR 0x37 /* * TODO register flash as a subdev */ static int flash_dev_set_mode(int mode) { if (!eup) return -EINVAL; switch (mode) { case FLASH_MODE_OFF: gpio_direction_output(eup->gpio_en, 0); gpio_direction_output(eup->gpio_flen, 0); break; case FLASH_MODE_ON: gpio_direction_output(eup->gpio_en, 1); gpio_direction_output(eup->gpio_flen, 0); msleep(1); wmt_vid_i2c_write(EUP2471_I2CADDR, 0x00, 0x00); wmt_vid_i2c_write(EUP2471_I2CADDR, 0x01, 0x33); break; case FLASH_MODE_STROBE: gpio_direction_output(eup->gpio_en, 1); gpio_direction_output(eup->gpio_flen, 1); msleep(1); gpio_direction_output(eup->gpio_flen, 0); break; case FLASH_MODE_TORCH: gpio_direction_output(2, 0); gpio_direction_output(3, 1); msleep(1); break; default: return -EINVAL; } return 0; } static int parse_charger_param(void) { char *dev_name = "eup2471"; char *env = "wmt.camera.flash"; char s[64]; size_t l = sizeof(s); int gpio_en, gpio_flen; int rc; if (wmt_getsyspara(env, s, &l)) { pr_err("read %s fail!\n", env); return -EINVAL; } if (strncmp(s, dev_name, strlen(dev_name))) { return -EINVAL; } rc = sscanf(s, "eup2471:%d:%d", &gpio_en, &gpio_flen); if (rc < 2) { pr_err("bad uboot env: %s\n", env); return -EINVAL; } rc = gpio_request(gpio_en, "flash eup2471 en"); if (rc) { pr_err("flash en gpio(%d) request failed\n", gpio_en); return rc; } rc = gpio_request(gpio_flen, "flash eup2471 flen"); if (rc) { pr_err("flash flen gpio(%d) request failed\n", gpio_flen); gpio_free(gpio_en); return rc; } eup = kzalloc(sizeof(*eup), GFP_KERNEL); if (!eup) return -ENOMEM; eup->gpio_en = gpio_en; eup->gpio_flen = gpio_flen; printk("flash eup2471 register ok: en %d, flen %d\n", eup->gpio_en, eup->gpio_flen); return 0; } static int flash_dev_init(void) { if (eup) return -EINVAL; return parse_charger_param(); } static void flash_dev_exit(void) { if (eup) { gpio_free(eup->gpio_en); gpio_free(eup->gpio_flen); kfree(eup); eup = NULL; } } struct flash_dev flash_dev_eup2471 = { .name = "eup2471", .init = flash_dev_init, .set_mode = flash_dev_set_mode, .exit = flash_dev_exit, };
/* * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OV5693_H__ #define __OV5693_H__ #include <media/nvc.h> #include <media/nvc_image.h> #define OV5693_IOCTL_SET_MODE _IOW('o', 1, struct ov5693_mode) #define OV5693_IOCTL_SET_FRAME_LENGTH _IOW('o', 2, __u32) #define OV5693_IOCTL_SET_COARSE_TIME _IOW('o', 3, __u32) #define OV5693_IOCTL_SET_GAIN _IOW('o', 4, __u16) #define OV5693_IOCTL_GET_STATUS _IOR('o', 5, __u8) #define OV5693_IOCTL_SET_BINNING _IOW('o', 6, __u8) #define OV5693_IOCTL_TEST_PATTERN _IOW('o', 7, \ enum ov5693_test_pattern) #define OV5693_IOCTL_SET_GROUP_HOLD _IOW('o', 8, struct ov5693_ae) /* IOCTL to set the operating mode of camera. * This can be either stereo , leftOnly or rightOnly */ #define OV5693_IOCTL_SET_CAMERA_MODE _IOW('o', 10, __u32) #define OV5693_IOCTL_SYNC_SENSORS _IOW('o', 11, __u32) #define OV5693_IOCTL_GET_FUSEID _IOR('o', 12, struct ov5693_fuseid) struct ov5693_mode { int res_x; int res_y; int fps; __u32 frame_length; __u32 coarse_time; __u16 gain; }; struct ov5693_ae { __u32 frame_length; __u8 frame_length_enable; __u32 coarse_time; __u8 coarse_time_enable; __s32 gain; __u8 gain_enable; }; struct ov5693_fuseid { __u32 size; __u8 id[16]; }; /* See notes in the nvc.h file on the GPIO usage */ enum ov5693_gpio_type { OV5693_GPIO_TYPE_PWRDN = 0, }; struct ov5693_power_rail { struct regulator *dvdd; struct regulator *avdd; struct regulator *dovdd; }; struct ov5693_platform_data { unsigned cfg; unsigned num; const char *dev_name; unsigned gpio_count; /* see nvc.h GPIO notes */ struct nvc_gpio_pdata *gpio; /* see nvc.h GPIO notes */ unsigned lens_focal_length; /* / _INT2FLOAT_DIVISOR */ unsigned lens_max_aperture; /* / _INT2FLOAT_DIVISOR */ unsigned lens_fnumber; /* / _INT2FLOAT_DIVISOR */ unsigned lens_view_angle_h; /* / _INT2FLOAT_DIVISOR */ unsigned lens_view_angle_v; /* / _INT2FLOAT_DIVISOR */ int (*probe_clock)(unsigned long); int (*power_on)(struct ov5693_power_rail *); int (*power_off)(struct ov5693_power_rail *); }; #endif /* __OV5693_H__ */
/* * This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MANGOSSERVER_MOVESPLINEINIT_H #define MANGOSSERVER_MOVESPLINEINIT_H #include "Movement/MoveSplineInitArgs.h" #include "MotionGenerators/PathFinder.h" class Unit; namespace Movement { /* Initializes and launches spline movement */ class MoveSplineInit { public: explicit MoveSplineInit(Unit& m); /* Final pass of initialization that launches spline movement. * @return duration - estimated travel time */ int32 Launch(); /* Stop any creature movement */ void Stop(bool forceSend = false); /* Adds final facing animation * sets unit's facing to specified point/angle after all path done * you can have only one final facing: previous will be overriden */ void SetFacing(float angle); void SetFacing(Vector3 const& spot); void SetFacing(const Unit* target); /* Initializes movement by path * @param path - array of points, shouldn't be empty * @param pointId - Id of fisrt point of the path. Example: when third path point will be done it will notify that pointId + 3 done */ void MovebyPath(const PointsArray& controls, int32 path_offset = 0); /* Initializes simple A to B mition, A is current unit's position, B is destination */ void MoveTo(const Vector3& dest, bool generatePath = false, bool forceDestination = false); void MoveTo(float x, float y, float z, bool generatePath = false, bool forceDestination = false); /* Sets Id of fisrt point of the path. When N-th path point will be done ILisener will notify that pointId + N done * Needed for waypoint movement where path splitten into parts */ void SetFirstPointId(int32 pointId) { args.path_Idx_offset = pointId; } /* Enables CatmullRom spline interpolation mode, enables flying animation. Disabled by default */ void SetFly(); /* Enables walk mode. Disabled by default */ void SetWalk(bool enable); /* Makes movement cyclic. Disabled by default */ void SetCyclic(); /* Enables falling mode. Disabled by default */ void SetFall(); /* Sets the velocity (in case you want to have custom movement velocity) * if no set, speed will be selected based on unit's speeds and current movement mode * Has no effect if falling mode enabled * velocity shouldn't be negative */ void SetVelocity(float vel); PointsArray& Path() { return args.path; } protected: MoveSplineInitArgs args; Unit& unit; }; inline void MoveSplineInit::SetFly() { args.flags.flying = true;} inline void MoveSplineInit::SetWalk(bool enable) { args.flags.runmode = !enable;} inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;} inline void MoveSplineInit::SetFall() { args.flags.falling = true;} inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel;} inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset) { args.path_Idx_offset = path_offset; args.path.assign(controls.begin(), controls.end()); } inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination) { Vector3 v(x, y, z); MoveTo(v, generatePath, forceDestination); } inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination) { if (generatePath) { PathFinder path(&unit); path.calculate(dest.x, dest.y, dest.z, forceDestination); MovebyPath(path.getPath()); } else { args.path_Idx_offset = 0; args.path.resize(2); args.path[1] = dest; } } inline void MoveSplineInit::SetFacing(Vector3 const& spot) { args.facing.f.x = spot.x; args.facing.f.y = spot.y; args.facing.f.z = spot.z; args.flags.EnableFacingPoint(); } } #endif // MANGOSSERVER_MOVESPLINEINIT_H
/*************************************************************************** * * LanScsiProtocol.h * * LanScsiProtocol definitions * * Copyright (c) 2003 XiMeta, Inc. All rights reserved. * **************************************************************************/ #ifndef _LANSCSIPROTOCOL_H_ #define _LANSCSIPROTOCOL_H_ #include "cdb.h" #ifdef KERNEL #include "LanScsiSocket.h" #endif #define MAX_NR_OF_TARGETS_PER_DEVICE 16 #define PACKET_COMMAND_SIZE 12 typedef struct _PNP_MESSAGE { unsigned char ucType; unsigned char ucVersion; } PNP_MESSAGE, *PPNP_MESSAGE; typedef struct _TARGET_DATA { bool bPresent; uint8_t NRRWHost; uint8_t NRROHost; uint64_t TargetData; uint32_t DiskArrayType; // IDE Info. bool bLBA; bool bLBA48; bool bPacket; bool bDMA; uint8_t SelectedTransferMode; bool bCable80; uint64_t SectorCount; uint32_t SectorSize; uint32_t configuration; uint32_t status; char model[42]; char firmware[10]; char serialNumber[22]; uint32_t MaxRequestBytes; } TARGET_DATA, *PTARGET_DATA; struct LanScsiSession { #ifdef KERNEL xi_socket_t DevSo; #else int DevSo; #endif char Password[8]; uint8_t ui8HWType; uint8_t ui8HWVersion; uint16_t ui16Revision; int32_t HPID; int16_t RPID; uint32_t Tag; uint32_t SessionPhase; uint32_t CHAP_C; uint32_t MaxRequestBlocks; uint16_t HeaderEncryptAlgo; uint16_t DataEncryptAlgo; uint32_t NumberOfTargets; }; #define HW_VERSION_1_0 0 #define HW_VERSION_1_1 1 #define HW_VERSION_2_0 2 // // NDAS hardware version 2.0 revisions // #define LANSCSIIDE_VER20_REV_1G_ORIGINAL 0x0000 #define LANSCSIIDE_VER20_REV_100M 0x0018 #define LANSCSIIDE_VER20_REV_1G 0x0010 #define LOGIN_TYPE_NORMAL 0x00 #define LOGIN_TYPE_DISCOVERY 0xFF #define DISCOVERY_USER 0x00000000 #define FIRST_TARGET_RO_USER 0x00000001 #define FIRST_TARGET_RW_USER 0x00010001 #define ALL_TARGET_RO_USER 0x00007fff #define ALL_TARGET_RW_USER 0x7fff7fff #define SUPER_USER 0xffffffff #define MAX_REQUEST_SIZE 1500 #define DISK_BLOCK_SIZE 512 #define DISK_CACHE_SIZE_BY_BLOCK_SIZE (64 * 1024 * 1024 / DISK_BLOCK_SIZE) // 64MB #define MAX_REQUEST_BLOCKS_GIGA_CHIP_BUG 108 // 54KB /*************************************************************************** * * Function prototypes * **************************************************************************/ #ifdef __cplusplus extern "C" { #endif // __cplusplus extern int Login(struct LanScsiSession *Session, uint8_t LoginType, uint32_t UserID, char *Key); extern int Logout(struct LanScsiSession *Session); extern int TextTargetList(struct LanScsiSession *Session, int *NRTarget, TARGET_DATA *PerTarget); extern int GetDiskInfo(struct LanScsiSession *Session, uint32_t TargetID, TARGET_DATA *TargetData); extern int IdeCommand(struct LanScsiSession *Session, int32_t TargetId, TARGET_DATA *TargetData, int64_t LUN, uint8_t Command, int64_t Location, int16_t SectorCount, int8_t Feature, char * pData, uint32_t BufferLength, uint8_t *pResult, PCDBd pCdb, uint8_t DataTransferDirection ); #ifdef __cplusplus } #endif // __cplusplus #endif /* _LANSCSIPROTOCOL_H_ */
/* New version of run front end support for simulators. Copyright (C) 1997, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <signal.h> #include "sim-main.h" #include "bfd.h" #ifdef HAVE_ENVIRON extern char **environ; #endif #ifdef HAVE_UNISTD_H /* For chdir. */ #include <unistd.h> #endif static void usage (void); extern host_callback default_callback; static char *myname; static SIM_DESC sd; static RETSIGTYPE cntrl_c (int sig) { if (! sim_stop (sd)) { fprintf (stderr, "Quit!\n"); exit (1); } } int main (int argc, char **argv) { char *name; char **prog_argv = NULL; struct bfd *prog_bfd; enum sim_stop reason; int sigrc = 0; int single_step = 0; RETSIGTYPE (*prev_sigint) (); myname = argv[0] + strlen (argv[0]); while (myname > argv[0] && myname[-1] != '/') --myname; /* INTERNAL: When MYNAME is `step', single step the simulator instead of allowing it to run free. The sole purpose of this HACK is to allow the sim_resume interface's step argument to be tested without having to build/run gdb. */ if (strlen (myname) > 4 && strcmp (myname - 4, "step") == 0) { single_step = 1; } /* Create an instance of the simulator. */ default_callback.init (&default_callback); sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, NULL, argv); if (sd == 0) exit (1); if (STATE_MAGIC (sd) != SIM_MAGIC_NUMBER) { fprintf (stderr, "Internal error - bad magic number in simulator struct\n"); abort (); } /* We can't set the endianness in the callback structure until sim_config is called, which happens in sim_open. */ default_callback.target_endian = (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE); /* Was there a program to run? */ prog_argv = STATE_PROG_ARGV (sd); prog_bfd = STATE_PROG_BFD (sd); if (prog_argv == NULL || *prog_argv == NULL) usage (); name = *prog_argv; /* For simulators that don't open prog during sim_open() */ if (prog_bfd == NULL) { prog_bfd = bfd_openr (name, 0); if (prog_bfd == NULL) { fprintf (stderr, "%s: can't open \"%s\": %s\n", myname, name, bfd_errmsg (bfd_get_error ())); exit (1); } if (!bfd_check_format (prog_bfd, bfd_object)) { fprintf (stderr, "%s: \"%s\" is not an object file: %s\n", myname, name, bfd_errmsg (bfd_get_error ())); exit (1); } } if (STATE_VERBOSE_P (sd)) printf ("%s %s\n", myname, name); /* Load the program into the simulator. */ if (sim_load (sd, name, prog_bfd, 0) == SIM_RC_FAIL) exit (1); /* Prepare the program for execution. */ #ifdef HAVE_ENVIRON sim_create_inferior (sd, prog_bfd, prog_argv, environ); #else sim_create_inferior (sd, prog_bfd, prog_argv, NULL); #endif /* To accommodate relative file paths, chdir to sysroot now. We mustn't do this until BFD has opened the program, else we wouldn't find the executable if it has a relative file path. */ if (simulator_sysroot[0] != '\0' && chdir (simulator_sysroot) < 0) { fprintf (stderr, "%s: can't change directory to \"%s\"\n", myname, simulator_sysroot); exit (1); } /* Run/Step the program. */ if (single_step) { do { prev_sigint = signal (SIGINT, cntrl_c); sim_resume (sd, 1/*step*/, 0); signal (SIGINT, prev_sigint); sim_stop_reason (sd, &reason, &sigrc); if ((reason == sim_stopped) && (sigrc == sim_signal_to_host (sd, SIM_SIGINT))) break; /* exit on control-C */ } /* remain on breakpoint or signals in oe mode*/ while (((reason == sim_signalled) && (sigrc == sim_signal_to_host (sd, SIM_SIGTRAP))) || ((reason == sim_stopped) && (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT))); } else { do { #if defined (HAVE_SIGACTION) && defined (SA_RESTART) struct sigaction sa, osa; sa.sa_handler = cntrl_c; sigemptyset (&sa.sa_mask); sa.sa_flags = 0; sigaction (SIGINT, &sa, &osa); prev_sigint = osa.sa_handler; #else prev_sigint = signal (SIGINT, cntrl_c); #endif sim_resume (sd, 0, sigrc); signal (SIGINT, prev_sigint); sim_stop_reason (sd, &reason, &sigrc); if ((reason == sim_stopped) && (sigrc == sim_signal_to_host (sd, SIM_SIGINT))) break; /* exit on control-C */ /* remain on signals in oe mode */ } while ((reason == sim_stopped) && (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)); } /* Print any stats the simulator collected. */ if (STATE_VERBOSE_P (sd)) sim_info (sd, 0); /* Shutdown the simulator. */ sim_close (sd, 0); /* If reason is sim_exited, then sigrc holds the exit code which we want to return. If reason is sim_stopped or sim_signalled, then sigrc holds the signal that the simulator received; we want to return that to indicate failure. */ /* Why did we stop? */ switch (reason) { case sim_signalled: case sim_stopped: if (sigrc != 0) fprintf (stderr, "program stopped with signal %d.\n", sigrc); break; case sim_exited: break; default: fprintf (stderr, "program in undefined state (%d:%d)\n", reason, sigrc); break; } return sigrc; } static void usage () { fprintf (stderr, "Usage: %s [options] program [program args]\n", myname); fprintf (stderr, "Run `%s --help' for full list of options.\n", myname); exit (1); }
/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> /* Close a stream. */ int __fcloseall () { /* Close all streams. */ register FILE *f; for (f = __stdio_head; f != NULL; f = f->__next) if (__validfp(f)) (void) fclose(f); return 0; } weak_alias (__fcloseall, fcloseall)
/* * Copyright (c) 2012 The Linux Foundation. All rights reserved.* */ #ifndef _NSS_REG_H_ #define _NSS_REG_H_ #define IPQ806X_NSS_TCM_PHYS (0x39000000) #define MSM_NSS_TCM_BASE (0xFB700000) /* 128K */ #define MSM_NSS_FPB_BASE (0xFB720000) /* 4K */ #define MSM_UBI32_0_CSM_BASE (0xFB721000) /* 4K */ #define MSM_UBI32_1_CSM_BASE (0xFB722000) /* 4K */ #define NSS_RESET_ADDR (0x40000000) #define NSS_REGS_CORE_ID_OFFSET 0x0000 #define NSS_REGS_RESET_CTRL_OFFSET 0x0004 #define NSS_REGS_CORE_BAR_OFFSET 0x0008 #define NSS_REGS_CORE_AMC_OFFSET 0x000c #define NSS_REGS_CORE_BOOT_ADDR_OFFSET 0x0010 #define NSS_REGS_C2C_INTR_STATUS_OFFSET 0x0014 #define NSS_REGS_C2C_INTR_SET_OFFSET 0x0018 #define NSS_REGS_C2C_INTR_CLR_OFFSET 0x001c #define NSS_REGS_N2H_INTR_STATUS_OFFSET 0x0020 #define NSS_REGS_N2H_INTR_SET_OFFSET 0x0024 #define NSS_REGS_N2H_INTR_CLR_OFFSET 0x0028 #define NSS_REGS_N2H_INTR_MASK_OFFSET 0x002c #define NSS_REGS_N2H_INTR_MASK_SET_OFFSET 0x0030 #define NSS_REGS_N2H_INTR_MASK_CLR_OFFSET 0x0034 #define NSS_REGS_CORE_INT_STAT0_TYPE_OFFSET 0x0038 #define NSS_REGS_CORE_INT_STAT1_TYPE_OFFSET 0x003c #define NSS_REGS_CORE_INT_STAT2_TYPE_OFFSET 0x0040 #define NSS_REGS_CORE_INT_STAT3_TYPE_OFFSET 0x0044 #define NSS_REGS_CORE_IFETCH_RANGE_OFFSET 0x0048 /* * Defines for N2H interrupts */ #define NSS_REGS_N2H_INTR_STATUS_EMPTY_BUFFER_QUEUE 0x0001 #define NSS_REGS_N2H_INTR_STATUS_DATA_COMMAND_QUEUE 0x0002 #define NSS_REGS_N2H_INTR_STATUS_EMPTY_BUFFERS_SOS 0x0400 #define NSS_REGS_N2H_INTR_STATUS_TX_UNBLOCKED 0x0800 /* * Defines for H2N interrupts */ #define NSS_REGS_H2N_INTR_STATUS_EMPTY_BUFFER_QUEUE 0x0001 #define NSS_REGS_H2N_INTR_STATUS_DATA_COMMAND_QUEUE 0x0002 #define NSS_REGS_H2N_INTR_STATUS_RESET 0x0400 /** Unused */ #define NSS_REGS_H2N_INTR_STATUS_TX_UNBLOCKED 0x0800 #endif /* _NSS_REG_H_ */
/* SPDX-License-Identifier: GPL-2.0-only */ #include <baseboard/variants.h> #include <bootblock_common.h> #include <ec/ec.h> #include <soc/gpio.h> void bootblock_mainboard_early_init(void) { const struct pad_config *pads; size_t num; pads = mainboard_early_bootblock_gpio_table(&num); gpio_configure_pads(pads, num); }; void bootblock_mainboard_init(void) { const struct pad_config *pads, *override_pads; size_t num, override_num; /* * Perform EC init before configuring GPIOs. This is because variant * might talk to the EC to get board id and hence it will require EC * init to have already performed. */ mainboard_ec_init(); pads = variant_early_gpio_table(&num); override_pads = variant_early_override_gpio_table(&override_num); gpio_configure_pads_with_override(pads, num, override_pads, override_num); }
#ifndef ___TXWIDESCREENWRAPPER_H__ #define ___TXWIDESCREENWRAPPER_H__ #include <string> #ifdef ANDROID int tx_swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...); bool wccmp(const wchar_t* w1, const wchar_t* w2); #define BUF_SIZE 2048 class tx_wstring { public: tx_wstring() {} tx_wstring(const wchar_t * wstr); tx_wstring(const tx_wstring & other); void assign(const wchar_t * wstr); void assign(const tx_wstring & wstr); void append(const tx_wstring & wstr); tx_wstring & operator=(const tx_wstring & other); tx_wstring & operator+=(const tx_wstring & other); tx_wstring & operator+=(const wchar_t * wstr); tx_wstring operator+(const tx_wstring & wstr); tx_wstring operator+(const wchar_t * wstr); const wchar_t * c_str() const; bool empty() const; int compare(const wchar_t * wstr); private: std::wstring _wstring; std::string _astring; char cbuf[BUF_SIZE]; wchar_t wbuf[BUF_SIZE]; }; class dummyWString { public: dummyWString(const char * _str); const wchar_t * c_str() const { return _wstr.c_str(); } private: std::wstring _wstr; }; #define wst(A) dummyWString(A).c_str() #else #define tx_wstring std::wstring #define tx_swprintf swprintf #define wst(A) L##A #define wccmp(A, B) A[0] == B[0] #endif // ANDROID #endif // ___TXWIDESCREENWRAPPER_H__
/** * @file * @brief This file contains exported structure for NAND * * OMAP's General Purpose Memory Controller (GPMC) has a NAND controller * embedded. this file provides the platform data structure required to * hook on to it. * * (C) Copyright 2008 * Texas Instruments, <www.ti.com> * Nishanth Menon <x0nishan@ti.com> * * Originally from Linux kernel: * http://linux.omap.com/pub/kernel/3430zoom/linux-ldp-v1.3.tar.gz * include/asm-arm/arch-omap/nand.h * * Copyright (C) 2006 Micron Technology Inc. * Author: Shahrom Sharif-Kashani * * 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 __ASM_OMAP_NAND_GPMC_H #define __ASM_OMAP_NAND_GPMC_H #include <linux/mtd/mtd.h> #include <linux/mtd/nand.h> #include <linux/mtd/nand_ecc.h> enum gpmc_ecc_mode { OMAP_ECC_SOFT, OMAP_ECC_HAMMING_CODE_HW_ROMCODE, OMAP_ECC_BCH4_CODE_HW, OMAP_ECC_BCH8_CODE_HW, OMAP_ECC_BCH8_CODE_HW_ROMCODE, }; /** omap nand platform data structure */ struct gpmc_nand_platform_data { /** Chip select you want to use */ int cs; struct mtd_partition *parts; int nr_parts; /** If there are any special setups you'd want to do */ int (*nand_setup) (struct gpmc_nand_platform_data *); /** ecc mode to use */ enum gpmc_ecc_mode ecc_mode; /** setup any special options */ unsigned int options; /** set up device access as 8,16 as per GPMC config */ char device_width; /** Set this to WAITx+1, so GPMC WAIT0 will be 1 and so on. */ char wait_mon_pin; /* if you like a custom oob use this. */ struct nand_ecclayout *oob; /** gpmc config for nand */ struct gpmc_config *nand_cfg; }; int omap_add_gpmc_nand_device(struct gpmc_nand_platform_data *pdata); extern struct gpmc_config omap3_nand_cfg; extern struct gpmc_config omap4_nand_cfg; #endif /* __ASM_OMAP_NAND_GPMC_H */
/* * util.h * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License Version 2 as * published by the Free Software Foundation. You may not use, modify or * distribute this program under any other version of the GNU General * Public License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. * Copyright (C) 2005-2013 Sourcefire, Inc. * */ #ifndef __HI_UTIL_XMALLOC_H__ #define __HI_UTIL_XMALLOC_H__ #ifdef WIN32 #define snprintf _snprintf #else #include <sys/types.h> #endif void *xmalloc(size_t byteSize); char *xstrdup(const char *str); void xshowmem(void); void xfree( void * ); #endif
/***************************************************************************** * Copyright (c) 2014-2018 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ #pragma once #include <memory> #include <string> #include <openrct2/common.h> struct SDL_Window; namespace OpenRCT2 { interface IContext; interface IPlatformEnvironment; namespace Ui { struct FileDialogDesc; class InGameConsole; interface IUiContext; interface IPlatformUiContext { virtual ~IPlatformUiContext() = default; virtual void SetWindowIcon(SDL_Window * window) abstract; virtual bool IsSteamOverlayAttached() abstract; virtual void ShowMessageBox(SDL_Window * window, const std::string &message) abstract; virtual std::string ShowFileDialog(SDL_Window * window, const FileDialogDesc &desc) abstract; virtual std::string ShowDirectoryDialog(SDL_Window * window, const std::string &title) abstract; }; std::unique_ptr<IUiContext> CreateUiContext(const std::shared_ptr<IPlatformEnvironment>& env); IPlatformUiContext * CreatePlatformUiContext(); InGameConsole& GetInGameConsole(); } // namespace Ui } // namespace OpenRCT2
/* vim: set ts=8 et sw=4 sta ai cin: */ /* * @author Paulo Pizarro <paulo.pizarro@gmail.com> * @author Tiago Katcipis <tiagokatcipis@gmail.com> * * This file is part of Luasofia. * * Luasofia 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. * * Luasofia 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 Luasofia. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __LUASOFIA_SU_TIMER_H__ #define __LUASOFIA_SU_TIMER_H__ #include <sofia-sip/su_wait.h> int luasofia_su_timer_register_meta(lua_State *L); int luasofia_su_timer_create(lua_State *L); #endif //__LUASOFIA_SU_TIMER_H_
/* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * gimpoperationlighten_onlymode.h * Copyright (C) 2008 Michael Natterer <mitch@gimp.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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __GIMP_OPERATION_LIGHTEN_ONLY_MODE_H__ #define __GIMP_OPERATION_LIGHTEN_ONLY_MODE_H__ #include "gimpoperationpointlayermode.h" #define GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE (gimp_operation_lighten_only_mode_get_type ()) #define GIMP_OPERATION_LIGHTEN_ONLY_MODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE, GimpOperationLightenOnlyMode)) #define GIMP_OPERATION_LIGHTEN_ONLY_MODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE, GimpOperationLightenOnlyModeClass)) #define GIMP_IS_OPERATION_LIGHTEN_ONLY_MODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE)) #define GIMP_IS_OPERATION_LIGHTEN_ONLY_MODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE)) #define GIMP_OPERATION_LIGHTEN_ONLY_MODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE, GimpOperationLightenOnlyModeClass)) typedef struct _GimpOperationLightenOnlyMode GimpOperationLightenOnlyMode; typedef struct _GimpOperationLightenOnlyModeClass GimpOperationLightenOnlyModeClass; struct _GimpOperationLightenOnlyMode { GimpOperationPointLayerMode parent_instance; }; struct _GimpOperationLightenOnlyModeClass { GimpOperationPointLayerModeClass parent_class; }; GType gimp_operation_lighten_only_mode_get_type (void) G_GNUC_CONST; gboolean gimp_operation_lighten_only_mode_process_pixels (gfloat *in, gfloat *layer, gfloat *mask, gfloat *out, gfloat opacity, glong samples, const GeglRectangle *roi, gint level); #endif /* __GIMP_OPERATION_LIGHTEN_ONLY_MODE_H__ */
/* * (C) 2003-2006 Gabest * (C) 2006-2014 see Authors.txt * * This file is part of MPC-HC. * * MPC-HC 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. * * MPC-HC 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/>. * */ #pragma once #include <atlcoll.h> #include "StatusLabel.h" class CMainFrame; // CPlayerInfoBar class CPlayerInfoBar : public CDialogBar { DECLARE_DYNAMIC(CPlayerInfoBar) private: CMainFrame* m_pMainFrame; CAutoPtrArray<CStatusLabel> m_label; CAutoPtrArray<CStatusLabel> m_info; CToolTipCtrl m_tooltip; void Relayout(); public: CPlayerInfoBar(CMainFrame* pMainFrame); virtual ~CPlayerInfoBar(); BOOL Create(CWnd* pParentWnd); void SetLine(CString label, CString info); void GetLine(CString label, CString& info); void RemoveLine(CString label); void RemoveAllLines(); protected: virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); virtual BOOL PreTranslateMessage(MSG* pMsg); public: afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnSize(UINT nType, int cx, int cy); DECLARE_MESSAGE_MAP() afx_msg void OnLButtonDown(UINT nFlags, CPoint point); };
/* * Copyright (C) 2004 Michael Niedermayer <michaelni@gmx.at> * * This file is part of MPlayer. * * MPlayer 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. * * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <inttypes.h> #include "mp_msg.h" #include "cpudetect.h" #include "img_format.h" #include "mp_image.h" #include "vf.h" #include "libvo/fastmemcpy.h" #include "libavcodec/avcodec.h" #include "libavutil/eval.h" struct vf_priv_s { char eq[200]; int8_t *qp; int8_t lut[257]; int qp_stride; }; static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ int h= (height+15)>>4; int i; vf->priv->qp_stride= (width+15)>>4; vf->priv->qp= av_malloc(vf->priv->qp_stride*h*sizeof(int8_t)); for(i=-129; i<128; i++){ double const_values[]={ M_PI, M_E, i != -129, i, 0 }; static const char *const_names[]={ "PI", "E", "known", "qp", NULL }; double temp_val; int res; res= av_expr_parse_and_eval(&temp_val, vf->priv->eq, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL); if (res < 0){ mp_msg(MSGT_VFILTER, MSGL_ERR, "qp: Error evaluating \"%s\" \n", vf->priv->eq); return 0; } vf->priv->lut[i+129]= lrintf(temp_val); } return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change // ok, we can do pp in-place (or pp disabled): vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; mpi->width=vf->dmpi->width; if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; mpi->stride[1]=vf->dmpi->stride[1]; mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; int x,y; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, mpi->w,mpi->h); } dmpi= vf->dmpi; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); if(mpi->flags&MP_IMGFLAG_PLANAR){ memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); } } vf_clone_mpi_attributes(dmpi, mpi); dmpi->qscale = vf->priv->qp; dmpi->qstride= vf->priv->qp_stride; if(mpi->qscale){ for(y=0; y<((dmpi->h+15)>>4); y++){ for(x=0; x<vf->priv->qp_stride; x++){ dmpi->qscale[x + dmpi->qstride*y]= vf->priv->lut[ 129 + ((int8_t)mpi->qscale[x + mpi->qstride*y]) ]; } } }else{ int qp= vf->priv->lut[0]; for(y=0; y<((dmpi->h+15)>>4); y++){ for(x=0; x<vf->priv->qp_stride; x++){ dmpi->qscale[x + dmpi->qstride*y]= qp; } } } return vf_next_put_image(vf,dmpi, pts); } static void uninit(struct vf_instance *vf){ if(!vf->priv) return; av_free(vf->priv->qp); vf->priv->qp= NULL; av_free(vf->priv); vf->priv=NULL; } //===========================================================================// static int vf_open(vf_instance_t *vf, char *args){ vf->config=config; vf->put_image=put_image; vf->get_image=get_image; vf->uninit=uninit; vf->priv=av_malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); // avcodec_init(); if (args) strncpy(vf->priv->eq, args, 199); return 1; } const vf_info_t vf_info_qp = { "QP changer", "qp", "Michael Niedermayer", "", vf_open, NULL };