text
stringlengths
4
6.14k
/* * Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef BINARYTREE_H #define BINARYTREE_H #include "declarations.h" #include <framework/util/databuffer.h> enum { BINARYTREE_ESCAPE_CHAR = 0xFD, BINARYTREE_NODE_START = 0xFE, BINARYTREE_NODE_END = 0xFF }; class BinaryTree : public stdext::shared_object { public: BinaryTree(const FileStreamPtr& fin); ~BinaryTree(); void seek(uint pos); void skip(uint len); uint tell() { return m_pos; } uint size() { unserialize(); return m_buffer.size(); } uint8 getU8(); uint16 getU16(); uint32 getU32(); uint64 getU64(); std::string getString(uint16 len = 0); Point getPoint(); BinaryTreeVec getChildren(); bool canRead() { unserialize(); return m_pos < m_buffer.size(); } private: void unserialize(); void skipNodes(); FileStreamPtr m_fin; DataBuffer<uint8> m_buffer; uint m_pos; uint m_startPos; }; class OutputBinaryTree : public stdext::shared_object { public: OutputBinaryTree(const FileStreamPtr& finish); void addU8(uint8 v); void addU16(uint16 v); void addU32(uint32 v); void addString(const std::string& v); void addPos(uint16 x, uint16 y, uint8 z); void addPoint(const Point& point); void startNode(uint8 node); void endNode(); private: FileStreamPtr m_fin; protected: void write(const uint8* data, size_t size); }; #endif
// This code is licensed under the MIT License (MIT). // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. // // Adapted from DescriptorHeap.h in Microsoft's Miniengine sample // https://github.com/Microsoft/DirectX-Graphics-Samples // #pragma once namespace Kodiak { class DeviceManager; // This is an unbounded resource descriptor allocator. It is intended to provide space for CPU-visible resource descriptors // as resources are created. For those that need to be made shader-visible, they will need to be copied to a UserDescriptorHeap // or a DynamicDescriptorHeap. class DescriptorAllocator { public: DescriptorAllocator(D3D12_DESCRIPTOR_HEAP_TYPE type) : m_type(type), m_currentHeap(nullptr) {} D3D12_CPU_DESCRIPTOR_HANDLE Allocate(DeviceManager* deviceManager, uint32_t Count); static void DestroyAll(); protected: static ID3D12DescriptorHeap* RequestNewHeap(DeviceManager* deviceManager, D3D12_DESCRIPTOR_HEAP_TYPE type); protected: static const uint32_t s_numDescriptorsPerHeap{ 256 }; static std::mutex s_allocationMutex; static std::vector<Microsoft::WRL::ComPtr<ID3D12DescriptorHeap>> s_descriptorHeapPool; D3D12_DESCRIPTOR_HEAP_TYPE m_type; ID3D12DescriptorHeap* m_currentHeap{ nullptr }; D3D12_CPU_DESCRIPTOR_HANDLE m_currentHandle; uint32_t m_descriptorSize{ 0 }; uint32_t m_remainingFreeHandles{ s_numDescriptorsPerHeap }; }; class DescriptorHandle { public: DescriptorHandle() { m_cpuHandle.ptr = ~0ull; m_gpuHandle.ptr = ~0ull; } DescriptorHandle(D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle) : m_cpuHandle(cpuHandle) { m_gpuHandle.ptr = ~0ull; } DescriptorHandle(D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle, D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle) : m_cpuHandle(cpuHandle) , m_gpuHandle(gpuHandle) { } DescriptorHandle operator+(int32_t offsetScaledByDescriptorSize) const { DescriptorHandle ret = *this; ret += offsetScaledByDescriptorSize; return ret; } void operator+=(int32_t offsetScaledByDescriptorSize) { if (m_cpuHandle.ptr != ~0ull) { m_cpuHandle.ptr += offsetScaledByDescriptorSize; } if (m_gpuHandle.ptr != ~0ull) { m_gpuHandle.ptr += offsetScaledByDescriptorSize; } } D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle() const { return m_cpuHandle; } D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle() const { return m_gpuHandle; } bool IsNull() const { return m_cpuHandle.ptr == ~0ull; } bool IsShaderVisible() const { return m_gpuHandle.ptr != ~0ull; } private: D3D12_CPU_DESCRIPTOR_HANDLE m_cpuHandle; D3D12_GPU_DESCRIPTOR_HANDLE m_gpuHandle; }; } // namespace Kodiak
//---------------------------------------------------------------------------- // error.h // // error reporting for pathed // // Copyright (C) 2011 Neil Butterworth //---------------------------------------------------------------------------- #ifndef INC_PATHED_ERROR_H #define INC_PATHED_ERROR_H #include <windows.h> #include <exception> #include <string> //---------------------------------------------------------------------------- // We throw these kind of exceptions //---------------------------------------------------------------------------- class Error : public std::exception { public: Error( const std::string & msg ) : mMsg( msg ) {} ~Error() throw() {} const char *what() const throw() { return mMsg.c_str(); } private: std::string mMsg; }; //---------------------------------------------------------------------------- // Get last Windows error as string - code copied from MSDN examples. //---------------------------------------------------------------------------- inline std::string LastWinError() { char * lpMsgBuf; ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ); std::string msg ( lpMsgBuf ); ::LocalFree( lpMsgBuf ); return msg; } #endif
// // GRJson.h // Pods // // Created by Grant Robinson on 4/17/17. // // #import <Foundation/Foundation.h> @protocol GRJsonDelegate <NSObject> @required - (void) json_null; - (void) json_bool:(BOOL)boolVal; - (void) json_number:(const unsigned char *)numberVal length:(unsigned long)len; - (void) json_string:(NSString *)strVal; - (void) json_object_begin; - (void) json_object_key:(NSString *)key; - (void) json_object_end; - (void) json_array_begin; - (void) json_array_end; @end @interface GRJson : NSObject - (instancetype) initWithData:(NSData *)data delegate:(id<GRJsonDelegate>)delegate; @property (nonatomic, strong) NSData *data; @property (nonatomic, weak) id<GRJsonDelegate> delegate; - (BOOL) parse:(NSError *__autoreleasing *)error; @end
/**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2011 Zynga Inc. Copyright (c) 2013-2014 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CC_FILEUTILS_APPLE_H__ #define __CC_FILEUTILS_APPLE_H__ #include "CCFileUtils.h" #include <string> #include <vector> #include "base/CCPlatformMacros.h" #include "2d/ccTypes.h" NS_CC_BEGIN /** * @addtogroup platform * @{ */ //! @brief Helper class to handle file operations class CC_DLL FileUtilsApple : public FileUtils { public: /* override funtions */ virtual std::string getWritablePath() const override; virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) override; virtual ValueMap getValueMapFromFile(const std::string& filename) override; virtual bool writeToFile(ValueMap& dict, const std::string& fullPath) override; virtual ValueVector getValueVectorFromFile(const std::string& filename) override; private: virtual bool isFileExistInternal(const std::string& filePath) const override; }; // end of platform group /// @} NS_CC_END #endif // __CC_FILEUTILS_APPLE_H__
#pragma once #include <vector> #include <iostream> //#include <limits> //#include <complex> #include <Eigen/Dense> #include <Eigen/StdVector> namespace bezier { /** Specifies the coordinate dimension */ enum Dimension { /** 2d coordinates \f$(x, y)\f$ */ k2d = 2, /** 3d coordinates \f$(x, y, z)\f$ */ k3d }; using Eigen::Dynamic; template <typename Point> bool IsSegmentDataValid(const std::vector<Point>& points, size_t order, const size_t segment_id); template <typename RealScalar> Eigen::Matrix<RealScalar, Dynamic, Dynamic> GetTangentCoefficients(const size_t degree); template <typename RealScalar> Eigen::Matrix<RealScalar, Dynamic, Dynamic> GetSecondDerivativeCoefficients(const size_t degree); template <typename RealScalar> Eigen::Matrix<RealScalar, Dynamic, Dynamic> GetPowerCoefficients(const size_t degree); template <typename RealScalar> Eigen::DiagonalMatrix<RealScalar, Dynamic> GetBinomialCoefficients(const size_t degree); template<typename RealScalar> std::vector<RealScalar> ConvertCoefficientLayoutToKC(const std::vector<RealScalar>& coefficients, const size_t degree, const size_t dimension); template<typename RealScalar> int SolveQuadratic(const std::vector<RealScalar>& coefficients, std::vector<RealScalar>& solutions); template<typename RealScalar> RealScalar SolveLinear(const std::vector<RealScalar>& coefficients); template <typename Point> bool IsSegmentDataValid(const std::vector<Point>& points, const size_t order, const size_t segment_id) { const size_t num_segments = points.size() / order; return (num_segments > 0 && segment_id < num_segments); } template <typename RealScalar> Eigen::Matrix<RealScalar, Dynamic, Dynamic> GetTangentCoefficients(const size_t degree) { Eigen::Matrix<RealScalar, Dynamic, Dynamic> basis; basis.resize(degree, degree); Eigen::DiagonalMatrix<RealScalar, Dynamic> coefficients; coefficients.resize(degree); for (size_t i = 0; i < degree; ++i) { coefficients.diagonal()[i] = static_cast<RealScalar>(i + 1); } basis = coefficients; basis.rowwise().reverseInPlace(); return basis; } template <typename RealScalar> Eigen::Matrix<RealScalar, Dynamic, Dynamic> GetSecondDerivativeCoefficients(const size_t degree) { const size_t matrix_size = degree - 1; Eigen::Matrix<RealScalar, Dynamic, Dynamic> basis; basis.resize(matrix_size, matrix_size); Eigen::DiagonalMatrix<RealScalar, Dynamic> coefficients; coefficients.resize(matrix_size); for (size_t i = 0; i < degree - 1; ++i) { coefficients.diagonal()[i] = static_cast<RealScalar>((degree - i) * (degree - (i + 1))); } basis = coefficients; basis.rowwise().reverseInPlace(); return basis; } template <typename RealScalar> Eigen::Matrix<RealScalar, Dynamic, Dynamic> GetPowerCoefficients(const size_t degree) { const size_t order = degree + 1; Eigen::Matrix<RealScalar, Dynamic, Dynamic> coefficients; coefficients.resize(order, order); coefficients = GetBinomialCoefficients<RealScalar>(degree); for (size_t i = 1; i < order; ++i) { for (size_t j = 0; j < order - i; ++j) { RealScalar element = -(coefficients(i + j, j + 1) / i * (j + 1)); coefficients(i + j, j) = element; } } return coefficients; } template<typename RealScalar> Eigen::DiagonalMatrix<RealScalar, Dynamic> GetBinomialCoefficients(const size_t degree) { const size_t order = degree + 1; Eigen::DiagonalMatrix<RealScalar, Dynamic> coefficients; coefficients.resize(order); coefficients.diagonal()[0] = 1; for (size_t i = 0; i < degree; ++i) { coefficients.diagonal()[i + 1] = coefficients.diagonal()[i] * (degree - i) / (i + 1); } return coefficients; } template<typename RealScalar> std::vector<RealScalar> ConvertCoefficientLayoutToKC(const std::vector<RealScalar>& coefficients, const size_t degree, const size_t dimension) { std::vector<RealScalar> sorted; const size_t order = degree + 1; const size_t segment_size = (degree + 1) * dimension; if (coefficients.size() % segment_size != 0) { return sorted; } for (size_t i = 0; i < coefficients.size() / segment_size; ++i) { Eigen::Matrix<RealScalar, Dynamic, Dynamic> segment_coefficients; segment_coefficients.resize(order, dimension); for (size_t j = 0; j < segment_size / dimension; ++j) { for (size_t k = 0; k < dimension; ++k) { segment_coefficients(j, k) = coefficients[(i * segment_size) + (j * dimension) + k]; } } for (size_t p = 0; p < dimension; ++p) { for (size_t q = 0; q < order; ++q) { sorted.push_back(segment_coefficients(q, p)); } } } return sorted; } template<typename RealScalar> int SolveQuadratic(const std::vector<RealScalar>& coefficients, std::vector<RealScalar>& solutions) { if (coefficients.size() != 3) { return 1; } RealScalar a = coefficients[0]; RealScalar b = coefficients[1]; RealScalar c = coefficients[2]; RealScalar square_root = std::sqrt(b * b - 4 * a * c); RealScalar t = (-b + square_root) / (2 * a); solutions.push_back(t); t = (-b - square_root) / (2 * a); solutions.push_back(t); return 0; } template<typename RealScalar> RealScalar SolveLinear(const std::vector<RealScalar>& coefficients) { RealScalar a = coefficients[0]; RealScalar b = coefficients[1]; RealScalar t = -b / a; return t; } } // end namespace bezier
/*BHEADER********************************************************************** * (c) 1997 The Regents of the University of California * * See the file COPYRIGHT_and_DISCLAIMER for a complete copyright * notice, contact person, and disclaimer. * * $Revision: 21217 $ *********************************************************************EHEADER*/ /****************************************************************************** * * Header file for doing timing * *****************************************************************************/ #ifndef HYPRE_TIMING_HEADER #define HYPRE_TIMING_HEADER #include <stdlib.h> #include <stdio.h> #include <string.h> #ifdef __cplusplus extern "C" { #endif /*-------------------------------------------------------------------------- * Prototypes for low-level timing routines *--------------------------------------------------------------------------*/ /* timer.c */ double time_getWallclockSeconds( void ); double time_getCPUSeconds( void ); double time_get_wallclock_seconds_( void ); double time_get_cpu_seconds_( void ); /*-------------------------------------------------------------------------- * With timing off *--------------------------------------------------------------------------*/ #ifndef HYPRE_TIMING #define hypre_InitializeTiming(name) 0 #define hypre_IncFLOPCount(inc) #define hypre_BeginTiming(i) #define hypre_EndTiming(i) #define hypre_PrintTiming(heading, comm) #define hypre_FinalizeTiming(index) /*-------------------------------------------------------------------------- * With timing on *--------------------------------------------------------------------------*/ #else /*------------------------------------------------------- * Global timing structure *-------------------------------------------------------*/ typedef struct { double *wall_time; double *cpu_time; double *flops; char **name; int *state; /* boolean flag to allow for recursive timing */ int *num_regs; /* count of how many times a name is registered */ int num_names; int size; double wall_count; double CPU_count; double FLOP_count; } hypre_TimingType; #ifdef HYPRE_TIMING_GLOBALS hypre_TimingType *hypre_global_timing = NULL; #else extern hypre_TimingType *hypre_global_timing; #endif /*------------------------------------------------------- * Accessor functions *-------------------------------------------------------*/ #ifndef HYPRE_USE_PTHREADS #define hypre_TimingWallTime(i) (hypre_global_timing -> wall_time[(i)]) #define hypre_TimingCPUTime(i) (hypre_global_timing -> cpu_time[(i)]) #define hypre_TimingFLOPS(i) (hypre_global_timing -> flops[(i)]) #define hypre_TimingName(i) (hypre_global_timing -> name[(i)]) #define hypre_TimingState(i) (hypre_global_timing -> state[(i)]) #define hypre_TimingNumRegs(i) (hypre_global_timing -> num_regs[(i)]) #define hypre_TimingWallCount (hypre_global_timing -> wall_count) #define hypre_TimingCPUCount (hypre_global_timing -> CPU_count) #define hypre_TimingFLOPCount (hypre_global_timing -> FLOP_count) #else #define hypre_TimingWallTime(i) (hypre_global_timing[threadid].wall_time[(i)]) #define hypre_TimingCPUTime(i) (hypre_global_timing[threadid].cpu_time[(i)]) #define hypre_TimingFLOPS(i) (hypre_global_timing[threadid].flops[(i)]) #define hypre_TimingName(i) (hypre_global_timing[threadid].name[(i)]) #define hypre_TimingState(i) (hypre_global_timing[threadid].state[(i)]) #define hypre_TimingNumRegs(i) (hypre_global_timing[threadid].num_regs[(i)]) #define hypre_TimingWallCount (hypre_global_timing[threadid].wall_count) #define hypre_TimingCPUCount (hypre_global_timing[threadid].CPU_count) #define hypre_TimingFLOPCount (hypre_global_timing[threadid].FLOP_count) #define hypre_TimingAllFLOPS (hypre_global_timing[hypre_NumThreads].FLOP_count) #endif /*------------------------------------------------------- * Prototypes *-------------------------------------------------------*/ /* timing.c */ int hypre_InitializeTiming( char *name ); int hypre_FinalizeTiming( int time_index ); int hypre_IncFLOPCount( int inc ); int hypre_BeginTiming( int time_index ); int hypre_EndTiming( int time_index ); int hypre_ClearTiming( void ); int hypre_PrintTiming( char *heading , MPI_Comm comm ); #endif #ifdef __cplusplus } #endif #endif
/* * This file is part of the µOS++ distribution. * (https://github.com/micro-os-plus) * Copyright (c) 2015 Liviu Ionescu. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef CMSIS_PLUS_POSIX_IO_REDEFINITIONS_H_ #define CMSIS_PLUS_POSIX_IO_REDEFINITIONS_H_ // These definitions might be useful in some tests, to check // if both prefixed and not prefixed names are ok. #define __posix_accept accept #define __posix_bind bind #define __posix_chdir chdir #define __posix_chmod chmod #define __posix_chown chown #define __posix_clock clock #define __posix_close close #define __posix_closedir closedir #define __posix_connect connect #define __posix_execve execve #define __posix_fcntl fcntl #define __posix_fork fork #define __posix_fstat fstat #define __posix_ftruncate ftruncate #define __posix_fsync fsync #define __posix_getcwd getcwd #define __posix_getpeername getpeername #define __posix_getpid getpid #define __posix_getsockname getsockname #define __posix_getsockopt getsockopt #define __posix_gettimeofday gettimeofday #define __posix_ioctl ioctl #define __posix_isatty isatty #define __posix_kill kill #define __posix_link link #define __posix_listen listen #define __posix_lseek lseek #define __posix_mkdir mkdir #define __posix_open open #define __posix_opendir opendir #define __posix_raise raise #define __posix_read read #define __posix_readdir readdir #define __posix_readdir_r readdir_r #define __posix_readlink readlink #define __posix_recv recv #define __posix_recvfrom recvfrom #define __posix_recvmsg recvmsg #define __posix_rename rename #define __posix_rewinddir rewinddir #define __posix_rmdir rmdir #define __posix_select select #define __posix_send send #define __posix_sendmsg sendmsg #define __posix_sendto sendto #define __posix_setsockopt setsockopt #define __posix_shutdown shutdown #define __posix_sockatmark sockatmark #define __posix_socket socket #define __posix_socketpair socketpair #define __posix_stat stat #define __posix_symlink symlink #define __posix_sync sync #define __posix_system system #define __posix_times times #define __posix_truncate truncate #define __posix_unlink unlink #define __posix_utime utime #define __posix_wait wait #define __posix_write write #define __posix_writev writev #endif /* CMSIS_PLUS_POSIX_IO_REDEFINITIONS_H_ */
#ifndef _framesetting_h_ #define _framesetting_h_ #include <string> #include <vector> using namespace std; #include "absxmlsetting.h" class FrameSetting : public BasXmlSetting { public: FrameSetting(); ~FrameSetting(); bool loadFrame(int &start,int &end,std::string &prefix,std::string &postfix,float &frametime,int &loop,float &scale); bool firstFrame(std::string &name); void getIntsBeginWith(const std::string &key,std::vector<int> &ints); void getKeysBeginWith(const std::string &key,std::vector<std::string> &values); void getValuesBeginWith(const std::string &key,std::vector<std::string> &values); private: }; #endif
/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkGpuBlurUtils_DEFINED # define SkGpuBlurUtils_DEFINED # if SK_SUPPORT_GPU # include "src/gpu/GrRenderTargetContext.h" # include "src/gpu/effects/GrTextureDomain.h" class GrContext; class GrTexture; struct SkRect; namespace SkGpuBlurUtils { /** * Applies a 2D Gaussian blur to a given texture. The blurred result is returned * as a renderTargetContext in case the caller wishes to draw into the result. * * The 'proxyOffset' is kept separate form 'srcBounds' because they exist in different * coordinate spaces. 'srcBounds' exists in the content space of the special image, and * 'proxyOffset' maps from the content space to the proxy's space. * * Note: one of sigmaX and sigmaY should be non-zero! * @param context The GPU context * @param srcProxy The source to be blurred. * @param srcColorType The colorType of srcProxy * @param srcAlphaType The alphaType of srcProxy * @param proxyOffset The offset from the top-left corner to valid texels in 'srcProxy', which should come from the subset of the owning SkSpecialImage. * @param colorSpace Color space of the source (used for the renderTargetContext result, * too). * @param dstBounds The destination bounds, relative to the source texture. * @param srcBounds The source bounds, relative to the source texture's offset. No pixels * will be sampled outside of this rectangle. * @param sigmaX The blur's standard deviation in X. * @param sigmaY The blur's standard deviation in Y. * @param mode The mode to handle samples outside bounds. * @param fit backing fit for the returned render target context * @return The renderTargetContext containing the blurred result. */ std::unique_ptr<GrRenderTargetContext> GaussianBlur(GrRecordingContext* context, sk_sp<GrTextureProxy> srcProxy, GrColorType srcColorType, SkAlphaType srcAlphaType, const SkIPoint& proxyOffset, sk_sp<SkColorSpace> colorSpace, const SkIRect& dstBounds, const SkIRect& srcBounds, float sigmaX, float sigmaY, GrTextureDomain::Mode mode, SkBackingFit fit = SkBackingFit::kApprox); } # endif #endif
#ifdef __OBJC__ #import <UIKit/UIKit.h> #endif FOUNDATION_EXPORT double Pods_DTImageScrollViewDemoVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_DTImageScrollViewDemoVersionString[];
// // MainExamplesViewController.h // MercadoPagoSDKExamplesObjectiveC // // Created by Maria cristina rodriguez on 1/7/16. // Copyright © 2016 MercadoPago. All rights reserved. // #import <UIKit/UIKit.h> @interface MainExamplesViewController : UITableViewController <PXLazyInitProtocol, PXLifeCycleProtocol, PXTrackerListener> @property MercadoPagoCheckoutBuilder *checkoutBuilder; @property PXCheckoutPreference *pref; @property PXPaymentConfiguration *paymentConfig; +(void)setPaymentDataCallback; @end
int reqAuthenticate(const dict &req, int reqid); int reqUserLogin(const dict &req, int reqid); int reqUserLogout(const dict &req, int reqid); int reqUserPasswordUpdate(const dict &req, int reqid); int reqTradingAccountPasswordUpdate(const dict &req, int reqid); int reqUserLogin2(const dict &req, int reqid); int reqUserPasswordUpdate2(const dict &req, int reqid); int reqOrderInsert(const dict &req, int reqid); int reqParkedOrderInsert(const dict &req, int reqid); int reqParkedOrderAction(const dict &req, int reqid); int reqOrderAction(const dict &req, int reqid); int reqQueryMaxOrderVolume(const dict &req, int reqid); int reqSettlementInfoConfirm(const dict &req, int reqid); int reqRemoveParkedOrder(const dict &req, int reqid); int reqRemoveParkedOrderAction(const dict &req, int reqid); int reqExecOrderInsert(const dict &req, int reqid); int reqExecOrderAction(const dict &req, int reqid); int reqForQuoteInsert(const dict &req, int reqid); int reqQuoteInsert(const dict &req, int reqid); int reqQuoteAction(const dict &req, int reqid); int reqBatchOrderAction(const dict &req, int reqid); int reqOptionSelfCloseInsert(const dict &req, int reqid); int reqOptionSelfCloseAction(const dict &req, int reqid); int reqCombActionInsert(const dict &req, int reqid); int reqQryOrder(const dict &req, int reqid); int reqQryTrade(const dict &req, int reqid); int reqQryInvestorPosition(const dict &req, int reqid); int reqQryTradingAccount(const dict &req, int reqid); int reqQryInvestor(const dict &req, int reqid); int reqQryTradingCode(const dict &req, int reqid); int reqQryInstrumentMarginRate(const dict &req, int reqid); int reqQryInstrumentCommissionRate(const dict &req, int reqid); int reqQryExchange(const dict &req, int reqid); int reqQryProduct(const dict &req, int reqid); int reqQryInstrument(const dict &req, int reqid); int reqQryDepthMarketData(const dict &req, int reqid); int reqQrySettlementInfo(const dict &req, int reqid); int reqQryTransferBank(const dict &req, int reqid); int reqQryInvestorPositionDetail(const dict &req, int reqid); int reqQryNotice(const dict &req, int reqid); int reqQrySettlementInfoConfirm(const dict &req, int reqid); int reqQryInvestorPositionCombineDetail(const dict &req, int reqid); int reqQryCFMMCTradingAccountKey(const dict &req, int reqid); int reqQryEWarrantOffset(const dict &req, int reqid); int reqQryInvestorProductGroupMargin(const dict &req, int reqid); int reqQryExchangeMarginRate(const dict &req, int reqid); int reqQryExchangeMarginRateAdjust(const dict &req, int reqid); int reqQryExchangeRate(const dict &req, int reqid); int reqQrySecAgentACIDMap(const dict &req, int reqid); int reqQryProductExchRate(const dict &req, int reqid); int reqQryProductGroup(const dict &req, int reqid); int reqQryMMInstrumentCommissionRate(const dict &req, int reqid); int reqQryMMOptionInstrCommRate(const dict &req, int reqid); int reqQryInstrumentOrderCommRate(const dict &req, int reqid); int reqQrySecAgentTradingAccount(const dict &req, int reqid); int reqQrySecAgentCheckMode(const dict &req, int reqid); int reqQryOptionInstrTradeCost(const dict &req, int reqid); int reqQryOptionInstrCommRate(const dict &req, int reqid); int reqQryExecOrder(const dict &req, int reqid); int reqQryForQuote(const dict &req, int reqid); int reqQryQuote(const dict &req, int reqid); int reqQryOptionSelfClose(const dict &req, int reqid); int reqQryInvestUnit(const dict &req, int reqid); int reqQryCombInstrumentGuard(const dict &req, int reqid); int reqQryCombAction(const dict &req, int reqid); int reqQryTransferSerial(const dict &req, int reqid); int reqQryAccountregister(const dict &req, int reqid); int reqQryContractBank(const dict &req, int reqid); int reqQryParkedOrder(const dict &req, int reqid); int reqQryParkedOrderAction(const dict &req, int reqid); int reqQryTradingNotice(const dict &req, int reqid); int reqQryBrokerTradingParams(const dict &req, int reqid); int reqQryBrokerTradingAlgos(const dict &req, int reqid); int reqQueryCFMMCTradingAccountToken(const dict &req, int reqid); int reqFromBankToFutureByFuture(const dict &req, int reqid); int reqFromFutureToBankByFuture(const dict &req, int reqid); int reqQueryBankAccountMoneyByFuture(const dict &req, int reqid);
/* Copyright (c) 2020-2022 hors<horsicq@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef XNE_H #define XNE_H #include "xmsdos.h" #include "xne_def.h" class XNE : public XMSDOS { Q_OBJECT public: enum TYPE { TYPE_UNKNOWN=0, TYPE_EXE, TYPE_DLL, TYPE_DRIVER // TODO Check More }; explicit XNE(QIODevice *pDevice=nullptr,bool bIsImage=false,qint64 nModuleAddress=-1); virtual bool isValid(); static bool isValid(QIODevice *pDevice,bool bIsImage=false,qint64 nModuleAddress=-1); static MODE getMode(QIODevice *pDevice,bool bIsImage=false,qint64 nModuleAddress=-1); qint64 getImageOS2HeaderOffset(); qint64 getImageOS2HeaderSize(); XNE_DEF::IMAGE_OS2_HEADER getImageOS2Header(); quint16 getImageOS2Header_magic(); quint8 getImageOS2Header_ver(); quint8 getImageOS2Header_rev(); quint16 getImageOS2Header_enttab(); quint16 getImageOS2Header_cbenttab(); quint32 getImageOS2Header_crc(); quint16 getImageOS2Header_flags(); quint16 getImageOS2Header_autodata(); quint16 getImageOS2Header_heap(); quint16 getImageOS2Header_stack(); quint32 getImageOS2Header_csip(); quint32 getImageOS2Header_sssp(); quint16 getImageOS2Header_cseg(); quint16 getImageOS2Header_cmod(); quint16 getImageOS2Header_cbnrestab(); quint16 getImageOS2Header_segtab(); quint16 getImageOS2Header_rsrctab(); quint16 getImageOS2Header_restab(); quint16 getImageOS2Header_modtab(); quint16 getImageOS2Header_imptab(); quint32 getImageOS2Header_nrestab(); quint16 getImageOS2Header_cmovent(); quint16 getImageOS2Header_align(); quint16 getImageOS2Header_cres(); quint8 getImageOS2Header_exetyp(); quint8 getImageOS2Header_flagsothers(); quint16 getImageOS2Header_pretthunks(); quint16 getImageOS2Header_psegrefbytes(); quint16 getImageOS2Header_swaparea(); quint16 getImageOS2Header_expver(); void setImageOS2Header_magic(quint16 nValue); void setImageOS2Header_ver(quint8 nValue); void setImageOS2Header_rev(quint8 nValue); void setImageOS2Header_enttab(quint16 nValue); void setImageOS2Header_cbenttab(quint16 nValue); void setImageOS2Header_crc(quint32 nValue); void setImageOS2Header_flags(quint16 nValue); void setImageOS2Header_autodata(quint16 nValue); void setImageOS2Header_heap(quint16 nValue); void setImageOS2Header_stack(quint16 nValue); void setImageOS2Header_csip(quint32 nValue); void setImageOS2Header_sssp(quint32 nValue); void setImageOS2Header_cseg(quint16 nValue); void setImageOS2Header_cmod(quint16 nValue); void setImageOS2Header_cbnrestab(quint16 nValue); void setImageOS2Header_segtab(quint16 nValue); void setImageOS2Header_rsrctab(quint16 nValue); void setImageOS2Header_restab(quint16 nValue); void setImageOS2Header_modtab(quint16 nValue); void setImageOS2Header_imptab(quint16 nValue); void setImageOS2Header_nrestab(quint32 nValue); void setImageOS2Header_cmovent(quint16 nValue); void setImageOS2Header_align(quint16 nValue); void setImageOS2Header_cres(quint16 nValue); void setImageOS2Header_exetyp(quint8 nValue); void setImageOS2Header_flagsothers(quint8 nValue); void setImageOS2Header_pretthunks(quint16 nValue); void setImageOS2Header_psegrefbytes(quint16 nValue); void setImageOS2Header_swaparea(quint16 nValue); void setImageOS2Header_expver(quint16 nValue); qint64 getEntryTableOffset(); qint64 getEntryTableSize(); qint64 getSegmentTableOffset(); qint64 getResourceTableOffset(); qint64 getResidentNameTableOffset(); qint64 getModuleReferenceTableOffset(); qint64 getImportedNamesTableOffset(); qint64 getNotResindentNameTableOffset(); QList<XNE_DEF::NE_SEGMENT> getSegmentList(); XNE_DEF::NE_SEGMENT _read_NE_SEGMENT(qint64 nOffset); static QMap<quint64,QString> getImageNEMagics(); static QMap<quint64,QString> getImageNEMagicsS(); static QMap<quint64,QString> getImageNEFlagsS(); static QMap<quint64,QString> getImageNEExetypesS(); static QMap<quint64,QString> getImageNEFlagsothersS(); static QMap<quint64,QString> getImageSegmentTypesS(); qint64 getModuleAddress(); virtual _MEMORY_MAP getMemoryMap(); virtual MODE getMode(); virtual QString getArch(); virtual bool isBigEndian(); virtual FT getFileType(); virtual qint32 getType(); virtual OSINFO getOsInfo(); virtual QString typeIdToString(qint32 nType); }; #endif // XNE_H
#include <pthread.h> #include <stdio.h> #include <stdlib.h> // compile by gcc -o syc_m syc_m.c -pthread // ./syc_m int MAX = 10; int count = 1; pthread_mutex_t mutex; void print_star(int i) { int j; pthread_mutex_lock(&mutex); for (j = 1; j <= i; j++) { printf("*"); } // printf(" %d", i); printf("\n"); pthread_mutex_unlock(&mutex); //printf(" %d\n", i); } void *even(void *arg) { //printf("This is even thread()\n"); while (count <= MAX) if (count % 2 == 0) { print_star(count++); printf("This is even thread()\n"); // printf(" even: %d\n", count); // count++; //printf(" even: %d\n", count++); } pthread_exit(0); } void *odd(void *arg) { //printf("This is odd thread()\n"); while (count < MAX) if (count % 2 == 1) { print_star(count++); printf("This is odd thread()\n"); // printf(" odd: %d\n", count); // count++; // printf(" odd: %d\n", count++); } pthread_exit(0); } int main() { pthread_t t1; pthread_t t0; pthread_mutex_init(&mutex, 0); pthread_create(&t1, 0, &odd, NULL); pthread_create(&t0, 0, &even, NULL); pthread_join(t1, 0); pthread_join(t0, 0); pthread_mutex_destroy(&mutex); return 0; }
//================================================================================================= /*! // \file blaze/math/expressions/MultExpr.h // \brief Header file for the MultExpr base class // // Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development 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 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 _BLAZE_MATH_EXPRESSIONS_MULTEXPR_H_ #define _BLAZE_MATH_EXPRESSIONS_MULTEXPR_H_ //************************************************************************************************* // Includes //************************************************************************************************* #include <blaze/math/expressions/Expression.h> namespace blaze { //================================================================================================= // // CLASS DEFINITION // //================================================================================================= //************************************************************************************************* /*!\brief Base class for all multiplication expression templates. // \ingroup math // // The MultExpr class serves as a tag for all expression templates that implement mathematical // multiplications. All classes, that represent a mathematical multiplication (element-wise // vector multiplications, matrix/vector multiplications, vector/matrix multiplications and // matrix/matrix multiplications) and that are used within the expression template environment // of the Blaze library have to derive publicly from this class in order to qualify as // multiplication expression template. Only in case a class is derived publicly from the // MultExpr base class, the IsMultExpr type trait recognizes the class as valid multiplication // expression template. */ template< typename T > // Base type of the expression struct MultExpr : public Expression<T> {}; //************************************************************************************************* } // namespace blaze #endif
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #pragma once #include <vector> #include <map> #include <sstream> #include <string> #include "ifcpp/model/GlobalDefines.h" #include "ifcpp/model/BasicTypes.h" #include "ifcpp/model/BuildingObject.h" #include "IfcFeatureElementAddition.h" class IFCQUERY_EXPORT IfcProjectionElementTypeEnum; //ENTITY class IFCQUERY_EXPORT IfcProjectionElement : public IfcFeatureElementAddition { public: IfcProjectionElement() = default; IfcProjectionElement( int id ); virtual shared_ptr<BuildingObject> getDeepCopy( BuildingCopyOptions& options ); virtual void getStepLine( std::stringstream& stream ) const; virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const; virtual void readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map ); virtual void setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self ); virtual size_t getNumAttributes() { return 9; } virtual void getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const; virtual void getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const; virtual void unlinkFromInverseCounterparts(); virtual const char* className() const { return "IfcProjectionElement"; } virtual const std::wstring toString() const; // IfcRoot ----------------------------------------------------------- // attributes: // shared_ptr<IfcGloballyUniqueId> m_GlobalId; // shared_ptr<IfcOwnerHistory> m_OwnerHistory; //optional // shared_ptr<IfcLabel> m_Name; //optional // shared_ptr<IfcText> m_Description; //optional // IfcObjectDefinition ----------------------------------------------------------- // inverse attributes: // std::vector<weak_ptr<IfcRelAssigns> > m_HasAssignments_inverse; // std::vector<weak_ptr<IfcRelNests> > m_Nests_inverse; // std::vector<weak_ptr<IfcRelNests> > m_IsNestedBy_inverse; // std::vector<weak_ptr<IfcRelDeclares> > m_HasContext_inverse; // std::vector<weak_ptr<IfcRelAggregates> > m_IsDecomposedBy_inverse; // std::vector<weak_ptr<IfcRelAggregates> > m_Decomposes_inverse; // std::vector<weak_ptr<IfcRelAssociates> > m_HasAssociations_inverse; // IfcObject ----------------------------------------------------------- // attributes: // shared_ptr<IfcLabel> m_ObjectType; //optional // inverse attributes: // std::vector<weak_ptr<IfcRelDefinesByObject> > m_IsDeclaredBy_inverse; // std::vector<weak_ptr<IfcRelDefinesByObject> > m_Declares_inverse; // std::vector<weak_ptr<IfcRelDefinesByType> > m_IsTypedBy_inverse; // std::vector<weak_ptr<IfcRelDefinesByProperties> > m_IsDefinedBy_inverse; // IfcProduct ----------------------------------------------------------- // attributes: // shared_ptr<IfcObjectPlacement> m_ObjectPlacement; //optional // shared_ptr<IfcProductRepresentation> m_Representation; //optional // inverse attributes: // std::vector<weak_ptr<IfcRelAssignsToProduct> > m_ReferencedBy_inverse; // IfcElement ----------------------------------------------------------- // attributes: // shared_ptr<IfcIdentifier> m_Tag; //optional // inverse attributes: // std::vector<weak_ptr<IfcRelFillsElement> > m_FillsVoids_inverse; // std::vector<weak_ptr<IfcRelConnectsElements> > m_ConnectedTo_inverse; // std::vector<weak_ptr<IfcRelInterferesElements> > m_IsInterferedByElements_inverse; // std::vector<weak_ptr<IfcRelInterferesElements> > m_InterferesElements_inverse; // std::vector<weak_ptr<IfcRelProjectsElement> > m_HasProjections_inverse; // std::vector<weak_ptr<IfcRelReferencedInSpatialStructure> > m_ReferencedInStructures_inverse; // std::vector<weak_ptr<IfcRelVoidsElement> > m_HasOpenings_inverse; // std::vector<weak_ptr<IfcRelConnectsWithRealizingElements> > m_IsConnectionRealization_inverse; // std::vector<weak_ptr<IfcRelSpaceBoundary> > m_ProvidesBoundaries_inverse; // std::vector<weak_ptr<IfcRelConnectsElements> > m_ConnectedFrom_inverse; // std::vector<weak_ptr<IfcRelContainedInSpatialStructure> > m_ContainedInStructure_inverse; // std::vector<weak_ptr<IfcRelCoversBldgElements> > m_HasCoverings_inverse; // IfcFeatureElement ----------------------------------------------------------- // IfcFeatureElementAddition ----------------------------------------------------------- // inverse attributes: // weak_ptr<IfcRelProjectsElement> m_ProjectsElements_inverse; // IfcProjectionElement ----------------------------------------------------------- // attributes: shared_ptr<IfcProjectionElementTypeEnum> m_PredefinedType; //optional };
#ifndef GPU_DEF #define GPU_DEF #define SHORT_NAN 32767 #define SHORT_MAX 32766 #define GL_INTEROP // Caution!! Need to clear ComputeCache if uncommented struct TsdfParams { float resolution[3]; float volume[3]; float mu; }; #ifdef _GPU_ #define NUM_BANKS 16 #define LOG_NUM_BANKS 4 #define CONFLICT_FREE_OFFSET(n) ((n) >> NUM_BANKS + (n) >> (2 * LOG_NUM_BANKS)) // m is column wise, i.e m[0] is column 0, m[1] column 1, etc. bool _isnan3(float3 v) { return isnan(v.x) || isnan(v.y) || isnan(v.z); } bool _isnan4(float4 v) { return isnan(v.x) || isnan(v.y) || isnan(v.z) || isnan(v.w); } bool _isnan2(float2 v) { return isnan(v.x) || isnan(v.y); } // short between -32767 and 32767 void pack_tsdf(float val, float weight, __global short2* tsdf, int idx) { //tsdf[idx].x = convert_short(val * convert_float(SHORT_MAX)); //tsdf[idx].y = convert_short(weight)-SHORT_MAX; short2 res = {convert_short(val * convert_float(SHORT_MAX)), convert_short(weight)-SHORT_MAX}; tsdf[idx] = res; } float2 unpack_tsdf(short2 tsdf) { float2 res = {convert_float(tsdf.x) / convert_float(SHORT_MAX), convert_float(tsdf.y)+convert_float(SHORT_MAX)}; return res; } float4 mul( float4 m[4], float4 v ) { float4 res = { m[0].x*v.x + m[1].x*v.y + m[2].x*v.z + m[3].x*v.w, m[0].y*v.x + m[1].y*v.y + m[2].y*v.z + m[3].y*v.w, m[0].z*v.x + m[1].z*v.y + m[2].z*v.z + m[3].z*v.w, m[0].w*v.x + m[1].w*v.y + m[2].w*v.z + m[3].w*v.w }; return res; } float3 mul_homogenize( float4 m[4], float3 v ) { float3 res = { m[0].x*v.x + m[1].x*v.y + m[2].x*v.z + m[3].x*1.0f, m[0].y*v.x + m[1].y*v.y + m[2].y*v.z + m[3].y*1.0f, m[0].z*v.x + m[1].z*v.y + m[2].z*v.z + m[3].z*1.0f }; return res; } float4 getVoxelGlobal( float voxel_x, float voxel_y, float voxel_z, float3 cellsize ) { float4 voxel = {(voxel_x + 0.5f) * cellsize.x, (voxel_y + 0.5f) * cellsize.y, (voxel_z + 0.5f) * cellsize.z, 1.0f }; return voxel; } bool isNull(float3 v) { return v.x == 0 && v.y == 0 && v.z == 0; } // bool isNull(float4 v) // { // return v.x == 0 && v.y == 0 && v.z == 0 && v.z == 0; // } #endif #endif
#pragma once #include "unittest.h" #include <iostream> #include <vector> class PairSum : public UnitTest { public: typedef std::vector<int> IntVec; /*! * \brief hasPairSum Checks to see if there are any two integers that sum to the given value. * Assumes input vector is sorted. * \param vec The vector of numbers which could form pairs. * \param querySum The value of the sum. * \return true If there is such a pair */ bool hasPairSum(IntVec &vec, int querySum); /*! * \brief hasThreeSum Checks to see if there are any three integers in the array that sum to the given value. * Assumes input vector is sorted (O(n log n). * \param vec The vector of numbers which could form triples. * \param querySum The value of the sum. * \return true If there is such a pair */ bool hasThreeSum(IntVec &vec, int querySum); //WARNING: Does not work // This was an attempt to solve the open problem for a n log n 3 sum search using a combination of the pair sum algorithm and binary search bool hasThreeSumFast(IntVec &vec, int querySum); size_t binarySearch(IntVec &values, int searchValue, size_t firstIndex, size_t lastIndex, int &closest, size_t &closestIdx); virtual TestResult test() override; ; };
/** * Example implementation of the dialog choice UI pattern. */ #include "dialog_choice_window.h" #include "xadow.h" static Window *s_diag_window; static TextLayer *s_label_layer; static BitmapLayer *s_icon_layer; static ActionBarLayer *s_action_bar_layer; static uint8_t resp_buffer[3]; static SmartstrapAttribute *s_attr_bat_chg; static GBitmap *s_icon_bitmap, *s_tick_bitmap, *s_cross_bitmap; static void up_click_handler(ClickRecognizerRef recognizer, void *context) { Window *win = context; SmartstrapAttribute *s_attr_bat_chg = (SmartstrapAttribute *)window_get_user_data(win); SmartstrapResult result; if (!smartstrap_service_is_available(smartstrap_attribute_get_service_id(s_attr_bat_chg))) { APP_LOG(APP_LOG_LEVEL_DEBUG, "s_attr_bat_chg is not available"); dialog_choice_window_pop(); return; } uint8_t *buffer = NULL; size_t length = 0; result = smartstrap_attribute_begin_write(s_attr_bat_chg, &buffer, &length); if (result != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "Write of s_attr_bat_chg failed with result %d", result); return; } uint8_t enable = 1; memcpy(buffer, &enable, 1); result = smartstrap_attribute_end_write(s_attr_bat_chg, sizeof(enable), false); if (result != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "Write of s_attr_bat_chg failed with result %d", result); return; } APP_LOG(APP_LOG_LEVEL_DEBUG, "set enable charge"); } static void down_click_handler(ClickRecognizerRef recognizer, void *context) { Window *win = context; SmartstrapAttribute *s_attr_bat_chg = (SmartstrapAttribute *)window_get_user_data(win); SmartstrapResult result; if (!smartstrap_service_is_available(smartstrap_attribute_get_service_id(s_attr_bat_chg))) { APP_LOG(APP_LOG_LEVEL_DEBUG, "s_attr_bat_chg is not available"); dialog_choice_window_pop(); return; } uint8_t *buffer = NULL; size_t length = 0; result = smartstrap_attribute_begin_write(s_attr_bat_chg, &buffer, &length); if (result != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "Write of s_attr_bat_chg failed with result %d", result); return; } uint8_t enable = 0; memcpy(buffer, &enable, 1); result = smartstrap_attribute_end_write(s_attr_bat_chg, sizeof(enable), false); if (result != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "Write of s_attr_bat_chg failed with result %d", result); return; } APP_LOG(APP_LOG_LEVEL_DEBUG, "set disable charge"); } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); } static void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); s_icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CHARGE); GRect bitmap_bounds = gbitmap_get_bounds(s_icon_bitmap); s_icon_layer = bitmap_layer_create(GRect((bounds.size.w / 2) - (bitmap_bounds.size.w / 2) - (ACTION_BAR_WIDTH / 2), 10, bitmap_bounds.size.w, bitmap_bounds.size.h)); bitmap_layer_set_bitmap(s_icon_layer, s_icon_bitmap); bitmap_layer_set_compositing_mode(s_icon_layer, GCompOpSet); layer_add_child(window_layer, bitmap_layer_get_layer(s_icon_layer)); s_label_layer = text_layer_create(GRect(10, 10 + bitmap_bounds.size.h + 5, 124 - ACTION_BAR_WIDTH, bounds.size.h - (10 + bitmap_bounds.size.h + 15))); text_layer_set_text(s_label_layer, DIALOG_CHOICE_WINDOW_MESSAGE); text_layer_set_background_color(s_label_layer, GColorClear); text_layer_set_text_alignment(s_label_layer, GTextAlignmentCenter); text_layer_set_font(s_label_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); layer_add_child(window_layer, text_layer_get_layer(s_label_layer)); s_tick_bitmap = gbitmap_create_with_resource(RESOURCE_ID_TICK); s_cross_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CROSS); s_action_bar_layer = action_bar_layer_create(); action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_UP, s_tick_bitmap); action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_DOWN, s_cross_bitmap); action_bar_layer_add_to_window(s_action_bar_layer, window); action_bar_layer_set_context(s_action_bar_layer, window); action_bar_layer_set_click_config_provider(s_action_bar_layer, click_config_provider); } static void window_unload(Window *window) { text_layer_destroy(s_label_layer); action_bar_layer_destroy(s_action_bar_layer); bitmap_layer_destroy(s_icon_layer); gbitmap_destroy(s_icon_bitmap); gbitmap_destroy(s_tick_bitmap); gbitmap_destroy(s_cross_bitmap); window_destroy(window); s_diag_window = NULL; } void dialog_choice_window_push(SmartstrapAttribute *attr) { if (!s_diag_window) { s_diag_window = window_create(); window_set_user_data(s_diag_window, attr); window_set_background_color(s_diag_window, GColorWhite); window_set_window_handlers(s_diag_window, (WindowHandlers){ .load = window_load, .unload = window_unload, }); } window_stack_push(s_diag_window, true); } void dialog_choice_window_pop() { if (s_diag_window) { window_stack_remove(s_diag_window, true); } }
/*=== buffer: ptr-is-NULL=0, sz=1024 buffer buffer: ptr-is-NULL=-1, sz=0 buffer buffer: ptr-is-NULL=0, sz=1024 buffer buffer: ptr-is-NULL=-1, sz=0 buffer rc=0, result=undefined rc=1, result=TypeError: not buffer rc=1, result=TypeError: not buffer rc=1, result=TypeError: not buffer ===*/ int test_1(duk_context *ctx) { void *ptr; size_t sz; int i; duk_set_top(ctx, 0); duk_push_fixed_buffer(ctx, 1024); duk_push_fixed_buffer(ctx, 0); duk_push_dynamic_buffer(ctx, 1024); duk_push_dynamic_buffer(ctx, 0); for (i = 0; i < 4; i++) { sz = (size_t) 0xdeadbeef; ptr = duk_require_buffer(ctx, i, &sz); printf("buffer: ptr-is-NULL=%d, sz=%d\n", (sz == 0 ? -1 : (ptr == NULL ? 1 : 0)), (int) sz); sz = (size_t) 0xdeadbeef; ptr = duk_require_buffer(ctx, i, NULL); printf("buffer\n"); } return 0; } int test_2(duk_context *ctx) { void *ptr; size_t sz; duk_set_top(ctx, 0); duk_push_null(ctx); sz = (size_t) 0xdeadbeef; ptr = duk_require_buffer(ctx, 0, &sz); printf("buffer ok: %p\n", ptr); /* ok to print, should not be reached */ return 0; } int test_3(duk_context *ctx) { void *ptr; size_t sz; duk_set_top(ctx, 0); sz = (size_t) 0xdeadbeef; ptr = duk_require_buffer(ctx, 0, &sz); printf("buffer ok: %p\n", ptr); /* ok to print, should not be reached */ return 0; } int test_4(duk_context *ctx) { void *ptr; size_t sz; duk_set_top(ctx, 0); sz = (size_t) 0xdeadbeef; ptr = duk_require_buffer(ctx, DUK_INVALID_INDEX, &sz); printf("buffer ok: %p\n", ptr); /* ok to print, should not be reached */ return 0; } void test(duk_context *ctx) { int rc; rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX); printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1)); duk_pop(ctx); rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX); printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1)); duk_pop(ctx); rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX); printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1)); duk_pop(ctx); rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX); printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1)); duk_pop(ctx); }
#include "common.h" #define BUFFSIZE 4096 int main(void) { int n; char buf[BUFFSIZE]; while ((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0) { if (write(STDOUT_FILENO, buf, n) != n) { err_sys("write error"); } } if (n < 0) { err_sys("read error"); } exit(0); }
#include "../Internal.h" #include <sys/types.h> #include <sys/wait.h> #include <Lumino/Base/ElapsedTimer.h> #include <Lumino/IO/Process.h> #if defined(LN_OS_MAC) #include <crt_externs.h> #define environ (*_NSGetEnviron()) #else extern char **environ; #endif LN_NAMESPACE_BEGIN namespace detail { //============================================================================== // ProcessImpl //============================================================================== class ProcessImpl { public: ProcessImpl(); ~ProcessImpl(); void Start(const ProcessStartInfo& startInfo, ProcessStartResult* outResult); bool WaitForExit(int timeoutMSec); ProcessStatus GetState(); int GetExitCode(); void TryGetExitCode(); void Dispose(); private: pid_t m_pid; //InternalPipeStream* m_stdinPipeStream; //InternalPipeStream* m_stdoutPipeStream; //InternalPipeStream* m_stderrPipeStream; int m_exitCode; bool m_crashed; bool m_disposed; }; //------------------------------------------------------------------------------ ProcessImpl::ProcessImpl() : m_pid(0) { } //------------------------------------------------------------------------------ ProcessImpl::~ProcessImpl() { } //------------------------------------------------------------------------------ void ProcessImpl::Start(const ProcessStartInfo& startInfo, ProcessStartResult* outResult) { pid_t pid = fork(); if (pid == 0) { // 子プロセス側はこの if に入る StringA utf8Path; utf8Path.AssignCStr(startInfo.program.c_str()); StringA utf8Args = startInfo.args.ToStringA(); List<StringA> argList = utf8Args.Split(" "); char** argv = new char *[argList.GetCount() + 2]; argv[0] = ::strdup(utf8Path.c_str()); // 書き込み可能なポインタを渡さなければならないので strdup for (int i = 0; i < argList.GetCount(); ++i) { argv[i + 1] = ::strdup(argList[i].c_str()); } argv[argList.GetCount() + 1] = NULL; execve(argv[0], argv, environ); // ここには execve が失敗したときだけ来る。 } else { // 親プロセス側 } } //------------------------------------------------------------------------------ bool ProcessImpl::WaitForExit(int timeoutMSec) { ElapsedTimer timer; bool exit = false; do { int status; pid_t pid = waitpid(m_pid, &status, WNOHANG); // WNOHANG: 状態変化が起こった子プロセスがない場合にすぐに復帰する。 LN_THROW(pid >= 0, IOException); if (pid == 0) { // 状態変化していなかった。実行中。 } else { if (WIFEXITED(status)) { // 子プロセスが正常終了の場合 m_exitCode = WEXITSTATUS(status); //子プロセスの終了コード exit = true; } else { // 子プロセスが異常終了の場合 } } Thread::Sleep(1); } while(timeoutMSec == -1 || timer.GetElapsedTime() < timeoutMSec); if (exit) { // いろいろ閉じる Dispose(); } else { // タイムアウトした } return true; } //------------------------------------------------------------------------------ ProcessStatus ProcessImpl::GetState() { LN_NOTIMPLEMENTED(); return ProcessStatus::Finished; } //------------------------------------------------------------------------------ int ProcessImpl::GetExitCode() { return m_exitCode; } //------------------------------------------------------------------------------ void ProcessImpl::TryGetExitCode() { } //------------------------------------------------------------------------------ void ProcessImpl::Dispose() { if (!m_disposed) { m_disposed = true; } } } // namespace detail #if 0 //============================================================================= // Process //============================================================================= //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void Process::Start(const PathName& program, const String& args) {} //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- bool Process::WaitForExit(int timeoutMSec) { } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- ProcessStatus Process::GetState() { // ※ http://linuxjm.osdn.jp/html/LDP_man-pages/man2/wait.2.html には wait を実行しないとゾンビ状態になる、とあるが、 // mono のソースを見る限りだと waitpid でも大丈夫なようだ。(TODO: 要動作確認) // wait は終了処理で実行しておく。 int status; pid_t pid = waitpid(m_pid, &status, WNOHANG); // WNOHANG: 状態変化が起こった子プロセスがない場合にすぐに復帰する。 if (pid == 0) { // 状態変化していなかった。実行中。 return ProcessStatus::Running; } // 正常終了 if (WIFEXITED(status)) { // 終了コード m_exitCode = WEXITSTATUS(status); return ProcessStatus::Finished; } // 異常終了 else { return ProcessStatus::Crashed; } //waitid } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void Process::TryGetExitCode() { //GetState(); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void Process::Dispose() { if (!m_disposed) { m_disposed = true; } } //#endif #endif LN_NAMESPACE_END
// // FMKImageMarkerLayer.h // FMMapKit // // Created by FengMap on 15/6/2. // Copyright (c) 2015年 FengMap. All rights reserved. // #import "FMKLayer.h" @class FMKImageMarker; /** 自定义图层 地图图片标注层节点,用于添加地图的图片标注 同一楼层可添加多个图片层 使用"addLayer:" 获取方式 FMKMap getImageLayerByGroupID: */ @interface FMKImageLayer : FMKLayer /** * 初始化图片标注物图层,由用户创建 * * @param groupID 楼层ID * * @return 图片层对象 */ - (instancetype)initWithGroupID:(NSString *)groupID; ///图层所在楼层的ID @property (nonatomic,readonly) NSString* groupID; /** * 添加图片标注物 * * @param imageMarker 图片标注对象 */ - (void)addMarker:(FMKImageMarker *)imageMarker; /** * 根据tag获取图片标注物 * * @param tag 图片唯一标识,该标识由用户自定义 * * @return 图片标注对象 */ - (FMKImageMarker *)imageMarkerWithTag:(NSInteger)tag; /** * 删除指定tag的标注物 * * @param imageMarker 图片标注对象 */ - (void)removeMarker:(FMKImageMarker *)imageMarker; /** * 移除所有标注物 */ - (void)removeAll; @end
// // FORGestureTrack.h // FORGestureTrackDisplayDemo // // Created by Daniel on 31/05/2017. // Copyright © 2017 Daniel. All rights reserved. // #import "FORTrackGesture.h" @interface UIWindow (tracking) - (void)startTracking; - (void)endTracking; @end
/* Copyright (c) 2016-2019 Xavier Leclercq and the wxCharts contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Part of this file were copied from the Chart.js project (http://chartjs.org/) and translated into C++. The files of the Chart.js project have the following copyright and license. Copyright (c) 2013-2017 Nick Downie Released under the MIT license https://github.com/nnnick/Chart.js/blob/master/LICENSE.md */ /// @file #ifndef _WX_CHARTS_WXMATH2DPLOTCTRL_H_ #define _WX_CHARTS_WXMATH2DPLOTCTRL_H #include "wxchartctrl.h" #include "wxmath2dplot.h" #include <wx/menu.h> /// A control that displays a math2d plot. /// \ingroup chartclasses class wxMath2DPlotCtrl : public wxChartCtrl { public: /// Constructs a wxMath2DPlotCtrl control. /// @param parent Pointer to a parent window. /// @param id Control identifier. If wxID_ANY, will automatically /// create an identifier. /// @param data The data that will be used to initialize the chart. /// @param pos Control position. wxDefaultPosition indicates that /// wxWidgets should generate a default position for the control. /// @param size Control size. wxDefaultSize indicates that wxWidgets /// should generate a default size for the window. If no suitable /// size can be found, the window will be sized to 20x20 pixels /// so that the window is visible but obviously not correctly sized. /// @param style Control style. For generic window styles, please /// see wxWindow. wxMath2DPlotCtrl(wxWindow *parent, wxWindowID id, const wxMath2DPlotData &data, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0); wxMath2DPlotCtrl(wxWindow *parent, wxWindowID id, const wxMath2DPlotData &data, wxSharedPtr<wxMath2DPlotOptions> &options, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0); bool UpdateData(std::size_t index,const wxVector<wxPoint2DDouble> &points); bool AddData(std::size_t index,const wxVector<wxPoint2DDouble> &points); bool RemoveDataset(std::size_t index); void AddDataset(const wxMath2DPlotDataset::ptr &newset); const wxChartsGridOptions& GetGridOptions() const; void SetGridOptions(const wxChartsGridOptions& opt); const wxMath2DPlotOptions& GetChartOptions() const; void SetChartOptions(const wxMath2DPlotOptions& opt); void SetChartType(std::size_t index,const wxChartType &type); private: virtual wxMath2DPlot& GetChart(); void CreateContextMenu(); void Update(); private: wxMath2DPlot m_math2dPlot; wxMenu m_contextMenu; wxMenu *m_subMenu; int m_posX; int m_posY; }; #endif
// // GPKGPropertiesExtensionTest.h // geopackage-iosTests // // Created by Brian Osborn on 7/24/18. // Copyright © 2018 NGA. All rights reserved. // #import "GPKGCreateGeoPackageTestCase.h" @interface GPKGPropertiesExtensionTest : GPKGCreateGeoPackageTestCase @end
#pragma once #include <iostream> #include "Hypodermic/ILoggerSink.h" namespace Hypodermic { class ConsoleLoggerSink : public ILoggerSink { public: void append(LogLevels::LogLevel logLevel, const std::string& message) override { if (logLevel == LogLevels::Off) return; (logLevel == LogLevels::Error ? std::cerr : std::cout) << toString(logLevel) << " || " << message << std::endl; } }; } // namespace Hypodermic
#if !defined(LIQUID_BLOCK_H) #define LIQUID_BLOCK_H #include "document_body.h" #include "vm_assembler_pool.h" typedef struct block_body { bool compiled; VALUE obj; union { struct { document_body_entry_t document_body_entry; VALUE nodelist; } compiled; struct { VALUE parse_context; vm_assembler_pool_t *vm_assembler_pool; bool blank; unsigned int render_score; vm_assembler_t *code; } intermediate; } as; } block_body_t; void liquid_define_block_body(void); static inline uint8_t *block_body_instructions_ptr(block_body_header_t *body) { return ((uint8_t *)body) + body->instructions_offset; } #endif
/* ============================================================================== Copyright (C) 2016 Jacob Sologub Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ============================================================================== */ #pragma once #import <UIKit/UIKit.h> @interface UIViewController (FFKit) #ifdef FFKIT_USE_ASPECTS /** Sets a block that will be invoked after this view controller's viewWillAppear: method is invoked. @see UIViewController#viewWillAppear: */ - (void) setViewWillAppearBlock: (void (^) (BOOL animated)) block; /** Sets a block that will be invoked after this view controller's viewDidAppear: method is invoked. @see UIViewController#viewDidAppear: */ - (void) setViewDidAppearBlock: (void (^) (BOOL animated)) block; /** Sets a block that will be invoked after this view controller's viewWillDisappear: method is invoked. @see UIViewController#viewWillDisappear: */ - (void) setViewWillDisappearBlock: (void (^) (BOOL animated)) block; /** Sets a block that will be invoked after this view controller's viewDidDisappear: method is invoked. @see UIViewController#viewDidDisappear: */ - (void) setViewDidDisappearBlock: (void (^) (BOOL animated)) block; #endif //============================================================================== /** Searches the controller's child view controllers for a UIViewController of a specified class. */ - (UIViewController*) childViewControllerOfClassType: (Class) classType; /** Searches the controller's child view controllers for a UIViewController of a specified class. */ - (UIViewController*) childViewControllerOfClassType: (Class) classType searchRecursively: (BOOL) searchRecursively; /** Returns the controller's top-level view controller. @see UIViewController#presentedViewController */ - (UIViewController*) toplevelViewController; @end
#pragma once #include <anax/Component.hpp> #include <anax/Entity.hpp> struct BulletComponent :anax::Component { float lifeRemaining = 5.f; int dmg; anax::Entity owner; };
#ifndef BATCHEXTENSION_H #define BATCHEXTENSION_H namespace batchextension { void initBatch(const char *key); } #endif
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus #error This header can only be compiled as C++. #endif #ifndef BITCOIN_PROTOCOL_H #define BITCOIN_PROTOCOL_H #include "netbase.h" #include "serialize.h" #include "uint256.h" #include "version.h" #include <stdint.h> #include <string> #define MESSAGE_START_SIZE 4 /** Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */ class CMessageHeader { public: CMessageHeader(); CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn); std::string GetCommand() const; bool IsValid() const; ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(FLATDATA(pchMessageStart)); READWRITE(FLATDATA(pchCommand)); READWRITE(nMessageSize); READWRITE(nChecksum); } // TODO: make private (improves encapsulation) public: enum { COMMAND_SIZE = 12, MESSAGE_SIZE_SIZE = sizeof(int), CHECKSUM_SIZE = sizeof(int), MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE, CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE, HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; unsigned int nMessageSize; unsigned int nChecksum; }; /** nServices flags */ enum { NODE_NETWORK = (1 << 0), // NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections. // Bitcoin Core nodes used to support this by default, without advertising this bit, // but no longer do as of protocol version 70011 (= NO_BLOOM_VERSION) NODE_BLOOM = (1 << 2), // Bits 24-31 are reserved for temporary experiments. Just pick a bit that // isn't getting used, or one not being used much, and notify the // bitcoin-development mailing list. Remember that service bits are just // unauthenticated advertisements, so your code must be robust against // collisions and other cases where nodes may be advertising a service they // do not actually support. Other service bits should be allocated via the // BIP process. }; /** A CService with information about it as peer */ class CAddress : public CService { public: CAddress(); explicit CAddress(CService ipIn, uint64_t nServicesIn = NODE_NETWORK); void Init(); ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { if (ser_action.ForRead()) Init(); if (nType & SER_DISK) READWRITE(nVersion); if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); READWRITE(nServices); READWRITE(*(CService*)this); } // TODO: make private (improves encapsulation) public: uint64_t nServices; // disk and network only unsigned int nTime; // memory only int64_t nLastTry; }; /** inv message data */ class CInv { public: CInv(); CInv(int typeIn, const uint256& hashIn); CInv(const std::string& strType, const uint256& hashIn); ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(type); READWRITE(hash); } friend bool operator<(const CInv& a, const CInv& b); bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; // TODO: make private (improves encapsulation) public: int type; uint256 hash; }; enum { MSG_TX = 1, MSG_BLOCK, // Nodes may always request a MSG_FILTERED_BLOCK in a getdata, however, // MSG_FILTERED_BLOCK should not appear in any invs except as a part of getdata. MSG_FILTERED_BLOCK, MSG_TXLOCK_REQUEST, MSG_TXLOCK_VOTE, MSG_SPORK, MSG_SERVICENODE_WINNER, MSG_SERVICENODE_SCANNING_ERROR, MSG_BUDGET_VOTE, MSG_BUDGET_PROPOSAL, MSG_BUDGET_FINALIZED, MSG_BUDGET_FINALIZED_VOTE, MSG_SERVICENODE_QUORUM, MSG_SERVICENODE_ANNOUNCE, MSG_SERVICENODE_PING, MSG_DSTX }; #endif // BITCOIN_PROTOCOL_H
/** * @file PrintableButton.h * @brief Contains PrintableButton class declaration * @author Khalin Yevhen * @version 0.0.1 * @date 07.09.17 */ #pragma once #include "..\khalin03\Button.h" #include <StorageInterface.h> #include "..\khalin01\Printable.h" #include <string> /** * @brief It's just a printable version of Button class. * * Instances of this class are able to be printed into file and be represented in the string. * @author Khalin Yevhen */ class PrintableButton : public Button, public MStorageInterface, public Printable { public: PrintableButton(ButtonForm form); PrintableButton(); virtual ~PrintableButton(); // inherited method virtual std::string toString(); // inherited method virtual void OnStore(std::ostream& aStream); // inherited method virtual void OnLoad(std::istream& aStream); }; typedef PrintableButton PButton;
#pragma once #include "RenderInfo.h" class MeshObject; class DefaultObjcetRenderInfo final : public RenderInfo { public: float m_specularPower = 100.0f; int m_celShaded = 0; void updatePerObjectBuffers(const DrawData&, const MeshObject&) override; void updatePerFrameBuffers(const DrawData&) override; ~DefaultObjcetRenderInfo() { release(); } };
//===------ polly/SCEVAffinator.h - Create isl expressions from SCEVs -----===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Create a polyhedral description for a SCEV value. // //===----------------------------------------------------------------------===// #ifndef POLLY_SCEV_AFFINATOR_H #define POLLY_SCEV_AFFINATOR_H #include "llvm/ADT/DenseMap.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "isl/ctx.h" struct isl_ctx; struct isl_map; struct isl_basic_map; struct isl_id; struct isl_set; struct isl_union_set; struct isl_union_map; struct isl_space; struct isl_ast_build; struct isl_constraint; struct isl_pw_aff; struct isl_schedule; namespace llvm { class Region; class BasicBlock; class DataLayout; class ScalarEvolution; } // namespace llvm namespace polly { class Scop; class ScopStmt; /// The result type of the SCEVAffinator. /// /// The first element of the pair is the isl representation of the SCEV, the /// second is the domain under which it is __invalid__. typedef std::pair<isl_pw_aff *, isl_set *> PWACtx; /// Translate a SCEV to an isl_pw_aff and the domain on which it is invalid. struct SCEVAffinator : public llvm::SCEVVisitor<SCEVAffinator, PWACtx> { public: SCEVAffinator(Scop *S, llvm::LoopInfo &LI); ~SCEVAffinator(); /// Translate a SCEV to an isl_pw_aff. /// /// @param E he expression that is translated. /// @param BB The block in which @p E is executed. /// /// @returns The isl representation of the SCEV @p E in @p Domain. __isl_give PWACtx getPwAff(const llvm::SCEV *E, llvm::BasicBlock *BB = nullptr); /// Take the asumption that @p PWAC is non-negative. void takeNonNegativeAssumption(PWACtx &PWAC); /// Interpret the PWA in @p PWAC as an unsigned value. void interpretAsUnsigned(__isl_keep PWACtx &PWAC, unsigned Width); /// Check an <nsw> AddRec for the loop @p L is cached. bool hasNSWAddRecForLoop(llvm::Loop *L) const; private: /// Key to identify cached expressions. using CacheKey = std::pair<const llvm::SCEV *, llvm::BasicBlock *>; /// Map to remembered cached expressions. llvm::DenseMap<CacheKey, PWACtx> CachedExpressions; Scop *S; isl_ctx *Ctx; unsigned NumIterators; llvm::ScalarEvolution &SE; llvm::LoopInfo &LI; llvm::BasicBlock *BB; /// Target data for element size computing. const llvm::DataLayout &TD; /// Return the loop for the current block if any. llvm::Loop *getScope(); /// Return a PWACtx for @p PWA that is always valid. __isl_give PWACtx getPWACtxFromPWA(__isl_take isl_pw_aff *PWA); /// Compute the non-wrapping version of @p PWA for type @p ExprType. /// /// @param PWA The piece-wise affine function that might wrap. /// @param Type The type of the SCEV that was translated to @p PWA. /// /// @returns The expr @p PWA modulo the size constraints of @p ExprType. __isl_give isl_pw_aff *addModuloSemantic(__isl_take isl_pw_aff *PWA, llvm::Type *ExprType) const; /// If @p Expr might cause an integer wrap record an assumption. /// /// @param Expr The SCEV expression that might wrap. /// @param PWAC The isl representation of @p Expr with the invalid domain. /// /// @returns The isl representation @p PWAC with a posisbly adjusted domain. __isl_give PWACtx checkForWrapping(const llvm::SCEV *Expr, PWACtx PWAC) const; /// Whether to track the value of this expression precisely, rather than /// assuming it won't wrap. bool computeModuloForExpr(const llvm::SCEV *Expr); __isl_give PWACtx visit(const llvm::SCEV *E); __isl_give PWACtx visitConstant(const llvm::SCEVConstant *E); __isl_give PWACtx visitTruncateExpr(const llvm::SCEVTruncateExpr *E); __isl_give PWACtx visitZeroExtendExpr(const llvm::SCEVZeroExtendExpr *E); __isl_give PWACtx visitSignExtendExpr(const llvm::SCEVSignExtendExpr *E); __isl_give PWACtx visitAddExpr(const llvm::SCEVAddExpr *E); __isl_give PWACtx visitMulExpr(const llvm::SCEVMulExpr *E); __isl_give PWACtx visitUDivExpr(const llvm::SCEVUDivExpr *E); __isl_give PWACtx visitAddRecExpr(const llvm::SCEVAddRecExpr *E); __isl_give PWACtx visitSMaxExpr(const llvm::SCEVSMaxExpr *E); __isl_give PWACtx visitUMaxExpr(const llvm::SCEVUMaxExpr *E); __isl_give PWACtx visitUnknown(const llvm::SCEVUnknown *E); __isl_give PWACtx visitSDivInstruction(llvm::Instruction *SDiv); __isl_give PWACtx visitSRemInstruction(llvm::Instruction *SRem); friend struct llvm::SCEVVisitor<SCEVAffinator, PWACtx>; }; } // namespace polly #endif
//------------------------------------------------------------------------------ // <copyright project="BEmu_cpp" file="headers/ReferenceDataRequest/ReferenceElementErrorInfo.h" company="Jordan Robinson"> // Copyright (c) 2013 Jordan Robinson. All rights reserved. // // The use of this software is governed by the Microsoft Public License // which is included with this distribution. // </copyright> //------------------------------------------------------------------------------ #pragma once #include "BloombergTypes/ElementPtr.h" namespace BEmu { class Name; namespace ReferenceDataRequest { class ReferenceElementString; class ReferenceElementInt; class ReferenceElementErrorInfo : public ElementPtr { private: boost::shared_ptr<ReferenceElementString> _source, _category, _message, _subCategory; boost::shared_ptr<ReferenceElementInt> _code; public: ReferenceElementErrorInfo(); ~ReferenceElementErrorInfo(); virtual Name name() const; virtual size_t numValues() const; virtual size_t numElements() const; virtual SchemaElementDefinition elementDefinition() const; virtual bool isNull() const; virtual bool isArray() const; virtual bool isComplexType() const; virtual const char* getElementAsString(const char* name) const; virtual int getElementAsInt32(const char* name) const; virtual boost::shared_ptr<ElementPtr> getElement(const char* name) const; virtual bool hasElement(const char* name, bool excludeNullElements = false) const; virtual std::ostream& print(std::ostream& stream, int level = 0, int spacesPerLevel = 4) const; }; } }
#pragma once namespace PhysX { namespace Apex { ref class ApexSdk; public ref class Interface : IDisposable { public: /// <summary>Raised before any disposing is performed.</summary> virtual event EventHandler^ OnDisposing; /// <summary>Raised once all disposing is performed.</summary> virtual event EventHandler^ OnDisposed; private: NxParameterized::Interface* _interface; internal: Interface(NxParameterized::Interface* i, ApexSdk^ owner); public: ~Interface(); protected: !Interface(); public: property bool Disposed { virtual bool get(); } public: void InitalizeToDefaults(); array<int>^ Checksum(int bits); // property String^ ClassName { String^ get(); void set(String^ value); } property String^ Name { String^ get(); void set(String^ value); } property int Version { int get(); } property int NumberOfParameters { int get(); } internal: property NxParameterized::Interface* UnmanagedPointer { NxParameterized::Interface* get(); } }; }; };
// // ModeTwo.h // Haydn_NWS_2014_FINAL // // Created by Bernardo Santos Schorr on 3/8/14. // // #pragma once #include "ofMain.h" #include "fft.h" #include "FFTOctaveAnalyzer.h" #include "ParticleOrbit.h" #include "movingBackground.h" class ModeTwo { public: void setup( vector<MovingBackground> &bkgListTwo ); void update(FFTOctaveAnalyzer _FFTanalyzer, ofVec3f _accel); void draw(); vector<ParticleOrbit>pList; float multiplier; int width, height; ofFbo fbo; };
//===================================================================== // Copyright 2012-2016 (c), Advanced Micro Devices, Inc. All rights reserved. // /// \author AMD Developer Tools Team /// \file /// //===================================================================== #ifndef _ACL_API_TYPES_0_8_H_ #define _ACL_API_TYPES_0_8_H_ #include "aclDefs.h" #include <stdint.h> #include <stddef.h> // Typedefs that always point to the most recent versions of the objects. typedef struct _acl_md_arg_type_0_8 aclArgData; typedef struct _acl_md_printf_fmt_0_8 aclPrintfFmt; typedef struct _acl_metadata_0_8 aclMetadata; typedef struct _acl_device_caps_rec_0_8 aclDevCaps; typedef struct _acl_target_info_rec_0_8 aclTargetInfo; typedef struct _acl_bif_rec_0_8_1 aclBinary; typedef struct _acl_binary_opts_rec_0_8_1 aclBinaryOptions; typedef struct _acl_compiler_rec_0_8_1 aclCompiler; typedef struct _acl_compiler_opts_rec_0_8_1 aclCompilerOptions; typedef struct _acl_options_0_8* aclOptions; // Opaque pointer to amd::Options typedef struct _acl_binary_0_8* aclBIF; // Opaque pointer to bifbase typedef struct _acl_common_loader_rec_0_8 aclCommonLoader; typedef struct _acl_cl_loader_rec_0_8 aclCLLoader; typedef struct _acl_sc_loader_rec_0_8 aclSCLoader; typedef struct _acl_fe_loader_rec_0_8 aclFELoader; typedef struct _acl_link_loader_rec_0_8 aclLinkLoader; typedef struct _acl_opt_loader_rec_0_8 aclOptLoader; typedef struct _acl_cg_loader_rec_0_8 aclCGLoader; typedef struct _acl_be_loader_rec_0_8 aclBELoader; typedef struct _acl_llvm_module_0_8* aclModule; // Opaque pointer to llvm::Module typedef struct _acl_llvm_context_0_8* aclContext; // Opaque pointer to llvm::Context typedef struct _acl_loader_data_0_8* aclLoaderData; // Opaque pointer to loader data #include "aclEnums.h" // Typedefs for enumerations typedef enum _acl_error_enum_0_8 acl_error; typedef enum _comp_device_caps_enum_0_8 compDeviceCaps; typedef enum _comp_opt_settings_enum_0_8 compOptSettings; typedef enum _acl_dev_type_enum_0_8 aclDevType; typedef enum _acl_cl_version_enum_0_8 aclCLVersion; typedef enum _acl_type_enum_0_8 aclType; typedef enum _rt_query_types_enum_0_8 aclQueryType; typedef enum _rt_gpu_caps_enum_0_8 aclGPUCaps; typedef enum _rt_gpu_resource_enum_0_8 aclGPUResource; typedef enum _rt_gpu_mem_sizes_enum_0_8 aclGPUMemSizes; typedef enum _acl_arg_type_enum_0_8 aclArgType; typedef enum _acl_data_type_enum_0_8 aclArgDataType; typedef enum _acl_memory_type_enum_0_8 aclMemoryType; typedef enum _acl_access_type_enum_0_8 aclAccessType; typedef enum _bif_version_enum_0_8 aclBIFVersion; typedef enum _bif_platform_enum_0_8 aclPlatform; typedef enum _bif_sections_enum_0_8 aclSections; typedef enum _acl_loader_type_enum_0_8 aclLoaderType; #include "aclFunctors.h" // Typedefs for function pointers typedef aclLogFunction_0_8 aclLogFunction; typedef InsertSec_0_8 InsertSec; typedef RemoveSec_0_8 RemoveSec; typedef ExtractSec_0_8 ExtractSec; typedef InsertSym_0_8 InsertSym; typedef RemoveSym_0_8 RemoveSym; typedef ExtractSym_0_8 ExtractSym; typedef QueryInfo_0_8 QueryInfo; typedef Compile_0_8 Compile; typedef Link_0_8 Link; typedef AddDbgArg_0_8 AddDbgArg; typedef RemoveDbgArg_0_8 RemoveDbgArg; typedef CompLog_0_8 CompLog; typedef RetrieveType_0_8 RetrieveType; typedef SetType_0_8 SetType; typedef ConvertType_0_8 ConvertType; typedef Disassemble_0_8 Disassemble; typedef GetDevBinary_0_8 GetDevBinary; typedef LoaderInit_0_8 LoaderInit; typedef LoaderFini_0_8 LoaderFini; typedef FEToIR_0_8 FEToIR; typedef SourceToISA_0_8 SourceToISA; typedef IRPhase_0_8 IRPhase; typedef LinkPhase_0_8 LinkPhase; typedef CGPhase_0_8 CGPhase; typedef DisasmISA_0_8 DisasmISA; typedef AllocFunc_0_8 AllocFunc; typedef FreeFunc_0_8 FreeFunc; #include "aclStructs.h" #endif // _CL_API_TYPES_0_8_H_
// // BNRItem.h // C2_RandomItems // // Created by user on 15/5/19. // Copyright (c) 2015年 Potter. All rights reserved. // #import <Foundation/Foundation.h> @interface BNRItem : NSObject //{ // NSString *_itemName; // NSString *_serialNumber; // int _valueInDollars; // NSDate *_dateCreated; //} +(instancetype)randomItem; //BNRItem类的指定初始化方法 -(instancetype)initWithItemName:(NSString *)name valueInDollars:(int)value serialNumber:(NSString *)sNumber; -(instancetype)initWithItemName:(NSString *)name; @property (nonatomic,copy)NSString *itemName; @property (nonatomic,copy)NSString *serialNumber; @property (nonatomic)int valueInDollars; @property (nonatomic,readonly,strong)NSDate *dateCreated; //_itemName //-(void)setItemName:(NSString *)str; //-(NSString *)itemName; // //-(void)setSerialNumber:(NSString *)str; //-(NSString *)serialNumber; // //-(void)setValueInDollars:(int)v; //-(int)valueInDollars; // //-(NSDate *)dateCreated; @end
/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Dirk Mueller (mueller@kde.org) * Copyright (C) 2004-2016 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #pragma once #include "CachedHTMLCollection.h" #include "HTMLOptionElement.h" #include "HTMLSelectElement.h" namespace WebCore { class HTMLOptionsCollection final : public CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType> { public: using Base = CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType>; static Ref<HTMLOptionsCollection> create(HTMLSelectElement&, CollectionType); HTMLSelectElement& selectElement() { return downcast<HTMLSelectElement>(ownerNode()); } const HTMLSelectElement& selectElement() const { return downcast<HTMLSelectElement>(ownerNode()); } HTMLOptionElement* item(unsigned offset) const final; HTMLOptionElement* namedItem(const AtomicString& name) const final; ExceptionOr<void> setItem(unsigned index, HTMLOptionElement*); using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>; using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>; WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const std::optional<HTMLElementOrInt>& before); WEBCORE_EXPORT void remove(int index); WEBCORE_EXPORT int selectedIndex() const; WEBCORE_EXPORT void setSelectedIndex(int); WEBCORE_EXPORT ExceptionOr<void> setLength(unsigned); // For CachedHTMLCollection. bool elementMatches(Element&) const; private: explicit HTMLOptionsCollection(HTMLSelectElement&); }; inline HTMLOptionElement* HTMLOptionsCollection::item(unsigned offset) const { return downcast<HTMLOptionElement>(Base::item(offset)); } inline HTMLOptionElement* HTMLOptionsCollection::namedItem(const AtomicString& name) const { return downcast<HTMLOptionElement>(Base::namedItem(name)); } inline ExceptionOr<void> HTMLOptionsCollection::setItem(unsigned index, HTMLOptionElement* optionElement) { return selectElement().setItem(index, optionElement); } inline bool HTMLOptionsCollection::elementMatches(Element& element) const { if (!element.hasTagName(HTMLNames::optionTag)) return false; if (element.parentNode() == &selectElement()) return true; ASSERT(element.parentNode()); return element.parentNode()->hasTagName(HTMLNames::optgroupTag) && element.parentNode()->parentNode() == &selectElement(); } } // namespace WebCore SPECIALIZE_TYPE_TRAITS_HTMLCOLLECTION(HTMLOptionsCollection, SelectOptions)
#ifndef __MSA_rules_ye_WORLD2D__ #define __MSA_rules_ye_WORLD2D__ #include "..\_MSA_DDraw\MSA_DDraw.h" #include "MSA_sprite.h" #define MAX_SPRITE_COUNT 512 class MSA_WORLD2D // SPRITE LINKED LIST MANAGMENT { private: friend class MSA_SPRITE; MSA_DDRAW *TheDDraw; MSA_SPRITE *spr; short SpriteCount; void Init(); void Destroy(); public: MSA_WORLD2D(); MSA_WORLD2D(MSA_DDRAW *tTheDDraw); ~MSA_WORLD2D(); void WriteText(int x,int y,LPCTSTR lpString); void PutPixel(int x,int y,int c); MSA_SPRITE* AddSprite(LPCSTR szBitmap); MSA_SPRITE* AddSprite(MSA_SPRITE* ss=NULL); void DeleteAllSprites(); // int RemoveSPRITE(short i); MSA_SPRITE* Sprite(short i); void Clear(int Color=0); void Update(); void Render(); }; #endif // __MSA_rules_ye_MSA_WORLD2D__
#ifndef FULL_DICT_UTIL_H_GUARD #define FULL_DICT_UTIL_H_GUARD #include <stddef.h> typedef struct MemoryMap { int file_descriptor; size_t length; char *buffer; } MemoryMap; size_t ceil_div(size_t x, size_t y); char* file_to_buffer(char *filename); #endif
// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #ifndef NV_NSFOUNDATION_NSBASICTEMPLATES_H #define NV_NSFOUNDATION_NSBASICTEMPLATES_H #include "Ns.h" namespace nvidia { namespace shdfnd { template <typename A> struct Equal { bool operator()(const A& a, const A& b) const { return a == b; } }; template <typename A> struct Less { bool operator()(const A& a, const A& b) const { return a < b; } }; template <typename A> struct Greater { bool operator()(const A& a, const A& b) const { return a > b; } }; template <class F, class S> class Pair { public: F first; S second; Pair() : first(F()), second(S()) { } Pair(const F& f, const S& s) : first(f), second(s) { } Pair(const Pair& p) : first(p.first), second(p.second) { } // CN - fix for /.../NsBasicTemplates.h(61) : warning C4512: 'nvidia::shdfnd::Pair<F,S>' : assignment operator could // not be generated Pair& operator=(const Pair& p) { first = p.first; second = p.second; return *this; } bool operator==(const Pair& p) const { return first == p.first && second == p.second; } bool operator<(const Pair& p) const { if(first < p.first) return true; else return !(p.first < first) && (second < p.second); } }; template <unsigned int A> struct LogTwo { static const unsigned int value = LogTwo<(A >> 1)>::value + 1; }; template <> struct LogTwo<1> { static const unsigned int value = 0; }; template <typename T> struct UnConst { typedef T Type; }; template <typename T> struct UnConst<const T> { typedef T Type; }; template <typename T> T pointerOffset(void* p, ptrdiff_t offset) { return reinterpret_cast<T>(reinterpret_cast<char*>(p) + offset); } template <typename T> T pointerOffset(const void* p, ptrdiff_t offset) { return reinterpret_cast<T>(reinterpret_cast<const char*>(p) + offset); } template <class T> NV_CUDA_CALLABLE NV_INLINE void swap(T& x, T& y) { const T tmp = x; x = y; y = tmp; } } // namespace shdfnd } // namespace nvidia #endif // #ifndef NV_NSFOUNDATION_NSBASICTEMPLATES_H
/* myrootkit.c: fill in the blanks to write your first rootkit! */ #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/unistd.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Your name here"); // syscall_table perm addr in the kernel unsigned long *syscall_table = (unsigned long *) 0x//Address here!; // save the original write here asmlinkage long (*original_write)(unsigned int, const char __user *, size_t); // the hijacked write asmlinkage long new_write(unsigned int fd, const char __user *buf, size_t count) { printk(KERN_ALERT "pwnd\n"); // YOUR CODE HERE! // what should we return? } // install the kmod static int init(void) { printk(KERN_ALERT "Entering the kernel\n"); // disable write protection, flip bit write_cr0 (read_cr0 () & (~ 0x10000)); // YOUR CODE HERE! // hint: you do the hook here // enable write protection, flip bit write_cr0 (read_cr0 () | 0x10000); return 0; } // rm the kmod static void exit(void) { write_cr0 (read_cr0 () & (~ 0x10000)); // YOUR CODE HERE! // hint: you unhook here write_cr0 (read_cr0 () | 0x10000); printk(KERN_ALERT "MODULE EXIT\n"); } module_init(init); module_exit(exit);
// // NAppDelegate.h // NEvent // // Created by CocoaPods on 04/18/2015. // Copyright (c) 2014 Naithar. All rights reserved. // #import <UIKit/UIKit.h> @interface NAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// Copyright Hansol Park (anav96@naver.com, mooming.go@gmail.com). All rights reserved. #ifndef __ComponentSystem_h__ #define __ComponentSystem_h__ #include "ComponentState.h" #include "Debug.h" #include "Vector.h" #include "String.h" #include <algorithm> namespace HE { template <typename Component> class ComponentSystem { using CompoList = Vector<Component>; private: String name; CompoList initList; CompoList updateList; CompoList swapUpdateList; CompoList sleepList; CompoList transitionList; public: inline ComponentSystem(const char* name) : name(name) , initList() , updateList() , swapUpdateList() , sleepList() , transitionList() { } inline operator bool() const { return !initList.empty() || !updateList.empty() || !sleepList.empty(); } inline const char* GetName() const { return name.ToCharArray(); } template <typename ... Types> inline Component& Create(Types&& ... args) { initList.emplace_back(std::forward<Types>(args) ...); auto& compo = initList.back(); compo.SetState(ComponentState::BORN); return compo; } void Update(const float deltaTime) { ProcessInit(); ProcessUpdate(deltaTime); ProcessTransition(); } private: inline void ProcessInit() { for (auto& compo : initList) { compo.Init(); compo.SetState(ComponentState::ALIVE); compo.OnEnable(); updateList.push_back(std::move(compo)); } initList.clear(); } inline void ProcessUpdate(const float deltaTime) { for (auto& compo : updateList) { compo.Update(deltaTime); if (!compo.IsEnabled()) { transitionList.push_back(std::move(compo)); } else { swapUpdateList.push_back(std::move(compo)); } } std::swap(updateList, swapUpdateList); swapUpdateList.clear(); } inline void ProcessTransition() { for (auto& compo : transitionList) { switch (compo.GetState()) { case ComponentState::ALIVE: compo.OnEnable(); updateList.push_back(std::move(compo)); break; case ComponentState::SLEEP: compo.OnDisable(); sleepList.push_back(std::move(compo)); break; case ComponentState::DEAD: compo.SetState(ComponentState::SLEEP); compo.OnDisable(); compo.SetState(ComponentState::DEAD); compo.Release(); break; default: AssertMessage(false , "Unexpected component state %d on processing transition.\n" , compo.GetState()); break; } } transitionList.clear(); } }; } #ifdef __UNIT_TEST__ #include "TestCase.h" namespace HE { class ComponentSystemTest : public TestCase { public: ComponentSystemTest() : TestCase("ComponentSystemTest") {} protected: virtual bool DoTest() override; }; } #endif //__UNIT_TEST__ #endif //__ComponentSystem_h__
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.13.2\Source\Uno\Collections\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #ifndef __APP_UNO_COLLECTIONS_DICTIONARY2_VALUE_COLLECTION__FUSE_NAVIGATION_NA_14A77DCE_H__ #define __APP_UNO_COLLECTIONS_DICTIONARY2_VALUE_COLLECTION__FUSE_NAVIGATION_NA_14A77DCE_H__ #include <app/Uno.Object.h> #include <Uno.h> namespace app { namespace Fuse { namespace Gestures { namespace Internal { struct EdgeSwiper; } } } } namespace app { namespace Uno { namespace Collections { struct Dictionary__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper; } } } namespace app { namespace Uno { namespace Collections { struct Dictionary2_ValueCollection_Enumerator__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper; } } } namespace app { namespace Uno { namespace Collections { struct Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper; struct Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__uType : ::uClassType { }; Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__uType* Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__typeof(); void Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper___ObjInit(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this, ::app::Uno::Collections::Dictionary__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* source); int Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__get_Count(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this); ::app::Uno::Collections::Dictionary2_ValueCollection_Enumerator__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__GetEnumerator(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this); Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__New_1(::uStatic* __this, ::app::Uno::Collections::Dictionary__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* source); void Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__Uno_Collections_ICollection_Add(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this, ::app::Fuse::Gestures::Internal::EdgeSwiper* item); void Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__Uno_Collections_ICollection_Clear(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this); bool Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__Uno_Collections_ICollection_Contains(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this, ::app::Fuse::Gestures::Internal::EdgeSwiper* item); bool Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__Uno_Collections_ICollection_Remove(Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* __this, ::app::Fuse::Gestures::Internal::EdgeSwiper* item); struct Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper : ::uObject { ::uStrong< ::app::Uno::Collections::Dictionary__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper*> _source; void _ObjInit(::app::Uno::Collections::Dictionary__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper* source) { Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper___ObjInit(this, source); } int Count() { return Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__get_Count(this); } ::app::Uno::Collections::Dictionary2_ValueCollection_Enumerator__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper GetEnumerator(); }; }}} #include <app/Uno.Collections.Dictionary2_ValueCollection_Enumerator__Fuse_Na-1b16e10e.h> namespace app { namespace Uno { namespace Collections { inline ::app::Uno::Collections::Dictionary2_ValueCollection_Enumerator__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper::GetEnumerator() { return Dictionary2_ValueCollection__Fuse_Navigation_NavigationEdge__Fuse_Gestures_Internal_EdgeSwiper__GetEnumerator(this); } }}} #endif
// // defines.h // // // Created by Samuco on 19/04/2015. // // #ifndef _defines_h #define _defines_h // Rendering flags #define SHADOW_MAP_SIZE 1024 #define RENDER_SWAT_REFLECTION #define RENDER_SENV_REFLECTION // Force hardware acceleration #define RENDER_PIPELINE #define RENDER_GPU #ifdef RENDER_PIPELINE //#define RENDER_CORE_32 #endif //#define GL_VALIDATE // Render using vertex array objects (if false, use arrays or vbos) #define RENDER_VAO #define RENDER_VBO // Use standard VAOS (non APPLE) #ifdef RENDER_CORE_32 #define RENDER_VAO #define RENDER_VBO #define RENDER_VAO_NORMAL #endif // Don't remember what this does //#define RENDER_FAST // Render as fast as possible // Definitions #ifdef _WIN32 #define _WINDOWS 1 #elif _WIN64 #define _WINDOWS 1 #endif #include <stdio.h> #include <stdint.h> #include "tags/ZZTHaloScenarioTag.h" #include "tags/ZZTHaloObjectTag.h" #include "ProtonMap.h" // Custom includes #ifdef _WINDOWS #define _USE_MATH_DEFINES #include "glew/GL/glew.h" #define RENDER_VAO_NORMAL #elif __APPLE__ #include <OpenGL/gl3.h> #include <OpenGL/glu.h> #include <GLUT/glut.h> #endif #ifdef RENDER_FAST #define BITS_PER_PIXEL 16.0 #define DEPTH_SIZE 16.0 #else #define BITS_PER_PIXEL 32.0 #define DEPTH_SIZE 32.0 #endif #define MAX_SCENARIO_OBJECTS 100000 #define ShaderCount 11 #define ShaderStart 0 typedef enum { shader_NULL = 0, shader_SENV = 1, shader_SCHI = 2, shader_SGLA = 3, shader_SWAT = 4, shader_SCEX = 5, shader_SOSO = 6, shader_DEFF = 7, shader_SSAO = 8, shader_BLUR = 9, shader_SENV_REFLECT = 10 } ShaderType; #define ShaderEnd 6 int NextHighestPowerOf2(int n); #define Reflections 2 typedef enum { reflection_z = 0, reflection_sky = 1, } Reflection; // Camera typedef struct { float fogr, fogg, fogb; float fogdist, fogcut, foglegacy; float perspective[16]; float modelview[16]; float position[3]; float rotation[3]; float camera[3]; } shader_options; // VBO #define INDEX_BUFFER 0 #define POS_VB 1 #define NORMAL_VB 2 #define TEXCOORD_VB 3 #define LIGHT_VB 4 #define BINORMAL_VB 5 #define TANGENT_VB 6 #define texCoord_buffer 1 #define texCoord_buffer_light 3 #define normals_buffer 2 #define binormals_buffer 5 #define tangents_buffer 6 // Functions void errorCheck(); #endif
#ifndef CUSTOMWINDOW_H #define CUSTOMWINDOW_H #include "DWindow.h" #include <TextControl.h> class CustomWindow : public DWindow { public: CustomWindow(void); void MessageReceived(BMessage *msg); private: void MakeNumberBox(BTextControl *box); void CheckValues(void); BTextControl *fWidth, *fHeight, *fMines; }; #endif
/* * FreeRTOS Kernel V10.2.0 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ #include "FreeRTOSConfig.h" #define portCONTEXT_SIZE 132 #define portEPC_STACK_LOCATION 124 #define portSTATUS_STACK_LOCATION 128 /******************************************************************/ .macro portSAVE_CONTEXT /* Make room for the context. First save the current status so it can be manipulated, and the cause and EPC registers so their original values are captured. */ mfc0 k0, _CP0_CAUSE addiu sp, sp, -portCONTEXT_SIZE mfc0 k1, _CP0_STATUS /* Also save s6 and s5 so they can be used. Any nesting interrupts should maintain the values of these registers across the ISR. */ sw s6, 44(sp) sw s5, 40(sp) sw k1, portSTATUS_STACK_LOCATION(sp) /* Prepare to enable interrupts above the current priority. */ srl k0, k0, 0xa ins k1, k0, 10, 6 ins k1, zero, 1, 4 /* s5 is used as the frame pointer. */ add s5, zero, sp /* Check the nesting count value. */ la k0, uxInterruptNesting lw s6, (k0) /* If the nesting count is 0 then swap to the the system stack, otherwise the system stack is already being used. */ bne s6, zero, 1f nop /* Swap to the system stack. */ la sp, xISRStackTop lw sp, (sp) /* Increment and save the nesting count. */ 1: addiu s6, s6, 1 sw s6, 0(k0) /* s6 holds the EPC value, this is saved after interrupts are re-enabled. */ mfc0 s6, _CP0_EPC /* Re-enable interrupts. */ mtc0 k1, _CP0_STATUS /* Save the context into the space just created. s6 is saved again here as it now contains the EPC value. No other s registers need be saved. */ sw ra, 120(s5) sw s8, 116(s5) sw t9, 112(s5) sw t8, 108(s5) sw t7, 104(s5) sw t6, 100(s5) sw t5, 96(s5) sw t4, 92(s5) sw t3, 88(s5) sw t2, 84(s5) sw t1, 80(s5) sw t0, 76(s5) sw a3, 72(s5) sw a2, 68(s5) sw a1, 64(s5) sw a0, 60(s5) sw v1, 56(s5) sw v0, 52(s5) sw s6, portEPC_STACK_LOCATION(s5) sw $1, 16(s5) /* s6 is used as a scratch register. */ mfhi s6 sw s6, 12(s5) mflo s6 sw s6, 8(s5) /* Update the task stack pointer value if nesting is zero. */ la s6, uxInterruptNesting lw s6, (s6) addiu s6, s6, -1 bne s6, zero, 1f nop /* Save the stack pointer. */ la s6, uxSavedTaskStackPointer sw s5, (s6) 1: .endm /******************************************************************/ .macro portRESTORE_CONTEXT /* Restore the stack pointer from the TCB. This is only done if the nesting count is 1. */ la s6, uxInterruptNesting lw s6, (s6) addiu s6, s6, -1 bne s6, zero, 1f nop la s6, uxSavedTaskStackPointer lw s5, (s6) /* Restore the context. */ 1: lw s6, 8(s5) mtlo s6 lw s6, 12(s5) mthi s6 lw $1, 16(s5) /* s6 is loaded as it was used as a scratch register and therefore saved as part of the interrupt context. */ lw s6, 44(s5) lw v0, 52(s5) lw v1, 56(s5) lw a0, 60(s5) lw a1, 64(s5) lw a2, 68(s5) lw a3, 72(s5) lw t0, 76(s5) lw t1, 80(s5) lw t2, 84(s5) lw t3, 88(s5) lw t4, 92(s5) lw t5, 96(s5) lw t6, 100(s5) lw t7, 104(s5) lw t8, 108(s5) lw t9, 112(s5) lw s8, 116(s5) lw ra, 120(s5) /* Protect access to the k registers, and others. */ di ehb /* Decrement the nesting count. */ la k0, uxInterruptNesting lw k1, (k0) addiu k1, k1, -1 sw k1, 0(k0) lw k0, portSTATUS_STACK_LOCATION(s5) lw k1, portEPC_STACK_LOCATION(s5) /* Leave the stack in its original state. First load sp from s5, then restore s5 from the stack. */ add sp, zero, s5 lw s5, 40(sp) addiu sp, sp, portCONTEXT_SIZE mtc0 k0, _CP0_STATUS mtc0 k1, _CP0_EPC ehb eret nop .endm
// // UIDevice+WTRequestCenter.h // WTRequestCenter // // Created by songwt on 14-8-12. // Copyright (c) Mike song(mailto:275712575@qq.com). All rights reserved. // site:https://github.com/swtlovewtt/WTRequestCenter // install // git clone https://github.com/swtlovewtt/WTRequestCenter @import UIKit; @interface UIDevice (WTRequestCenter) //UUID 唯一标示符 /*! 唯一标示符 注意:如果程序被删除了,然后在安装,这个数值会改变。 如果想要永久保证这个数字不变,需要使用Keychain来保存这个字符串 */ +(NSString*)WTUUID; /*! 系统版本 */ +(CGFloat)systemVersion; /*! 设备类型 */ +(NSString *)getDeviceType; @end
#include <stdio.h> #include "engine/game.c" int main(int argc, char** argv) { printf("hello world\n"); return 0; }
// // SJCheckButton.h // vesta // // Created by Florent Segouin on 15/12/14. // Copyright (c) 2014 utt. All rights reserved. // #import <UIKit/UIKit.h> @interface SJCheckButton : UIButton @property (nonatomic, getter = isEmphasized) BOOL emphasized; @end
//******************************************************************* // // License: See top level LICENSE.txt file. // // Author: David Burken // // Description: // // Contains class definition for JpegWriter. // //******************************************************************* // $Id: ossimJpegWriter.h 16597 2010-02-12 15:10:53Z dburken $ #ifndef ossimJpegWriter_HEADER #define ossimJpegWriter_HEADER #include <ossim/imaging/ossimImageFileWriter.h> #include <ossim/base/ossimKeywordlist.h> //******************************************************************* // CLASS: ossimJpegWriterFactory //******************************************************************* class OSSIMDLLEXPORT ossimJpegWriter : public ossimImageFileWriter { public: /** default constructor */ ossimJpegWriter(); /** * void getImageTypeList(std::vector<ossimString>& imageTypeList)const * * Appends this writer image types to list "imageTypeList". * * This writer only has one type "jpeg". * * @param imageTypeList stl::vector<ossimString> list to append to. */ virtual void getImageTypeList(std::vector<ossimString>& imageTypeList)const; /** * Sets the jpeg compression quality. * * @param quality Compression quality. (valid range is 1 to 100) */ virtual void setQuality(ossim_int32 quality); virtual bool isOpen()const; virtual bool open(); virtual void close(); /** * saves the state of the object. */ virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const; /** * Method to the load (recreate) the state of an object from a keyword * list. Return true if ok or false on error. */ virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0); /** * Will set the property whose name matches the argument * "property->getName()". * * @param property Object containing property to set. */ virtual void setProperty(ossimRefPtr<ossimProperty> property); /** * @param name Name of property to return. * * @returns A pointer to a property object which matches "name". */ virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const; /** * Pushes this's names onto the list of property names. * * @param propertyNames array to add this's property names to. */ virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const; /** * Returns a 3-letter extension from the image type descriptor * (theOutputImageType) that can be used for image file extensions. * * @param imageType string representing image type. * * @return the 3-letter string extension. */ virtual ossimString getExtension() const; bool hasImageType(const ossimString& imageType) const; protected: /** virtual destructor */ virtual ~ossimJpegWriter(); private: virtual bool writeFile(); ossim_int32 theQuality; FILE* theOutputFilePtr; TYPE_DATA }; #endif /* #ifndef ossimJpegWriter_HEADER */
// // AppDelegate.h // storyboard-plus-xib // // Created by Ian Donaldson on 25/08/2014. // // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#ifndef AI #define AI #include <stdlib.h> #include <time.h> int generateDecision() { /* A random number generator to pick the opponents moves */ int randomDigit; randomDigit = (rand() % 5); return randomDigit; } #endif
extern int merge_min( int32_t *X, /* [nX] */ uint32_t nX, int32_t *Y, /* [nY] */ uint32_t nY, int32_t *Z, /* [nZ] */ uint32_t nZ, uint32_t *ptr_num_in_Z );
// Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle // // See the LICENSE.txt file for license information. Please report all // issues on https://gitlab.onelab.info/gmsh/gmsh/issues. #ifndef GMSH_FACE_H #define GMSH_FACE_H #include "GFace.h" class Surface; class gmshFace : public GFace { protected: Surface *s; bool buildSTLTriangulation(bool force); public: gmshFace(GModel *m, Surface *face); virtual ~gmshFace() {} Range<double> parBounds(int i) const; void setModelEdges(std::list<GEdge *> &); using GFace::point; virtual GPoint point(double par1, double par2) const; virtual GPoint closestPoint(const SPoint3 &queryPoint, const double initialGuess[2]) const; virtual bool containsPoint(const SPoint3 &pt) const; virtual double getMetricEigenvalue(const SPoint2 &); virtual SVector3 normal(const SPoint2 &param) const; virtual Pair<SVector3, SVector3> firstDer(const SPoint2 &param) const; virtual void secondDer(const SPoint2 &, SVector3 &, SVector3 &, SVector3 &) const; virtual GEntity::GeomType geomType() const; ModelType getNativeType() const { return GmshModel; } void *getNativePtr() const { return s; } virtual SPoint2 parFromPoint(const SPoint3 &, bool onSurface = true) const; virtual void resetMeshAttributes(); void resetNativePtr(Surface *_s); bool degenerate(int dim) const; }; #endif
#pragma once #include <glm/glm.hpp> /** * \brief Represents a 3d plane. */ class CPlane { public: CPlane(); CPlane(const glm::vec3& v1, const glm::vec3& v2, const glm::vec3& v3); ~CPlane(); // Ordering of points defines normal vector // Clockwise/Counterclockwise ordering rule is used to calculate normal vector void set3Points(const glm::vec3& v1, const glm::vec3& v2, const glm::vec3& v3); void setNormalAndPoint(const glm::vec3& normal, const glm::vec3& point); void setCoefficients(const glm::vec4& v); void setCoefficients(float a, float b, float c, float d); /** * \brief Calculates the shortest, signed distance from the plane to the point. */ float distance(const glm::vec3& point) const; private: glm::vec3 m_normal = glm::vec3(0.f, 1.f, 0.f); /**< Stores the plane normal. */ float m_d = 0.f; /**< Represents the regular euclidean distance from the origin. */ };
#ifndef PARAMLISTSELEC_H #define PARAMLISTSELEC_H #include "paramcombobox.h" class ParamListSelec : public ParamComboBox { public: ParamListSelec(QWidget* parent); virtual ~ParamListSelec(); }; #endif // PARAMLISTSELEC_H
#pragma once #include "xi/ext/configure.h" #include "xi/core/sleep_queue.h" #include "xi/core/worker_queue.h" namespace xi { namespace core { namespace v2 { class netpoller; class shared_queue; class scheduler; class execution_budget; class worker final { public: struct config { usize netpoll_max; usize scheduler_dequeue_max; usize loop_budget_allocation; usize max_loop_budget_allocation; usize isolation_budget_allocation; usize nr_spins_before_idle; struct { nanoseconds upper_bound_ready_queue; nanoseconds upper_bound_fast_queue; } timer_bounds; }; static config DEFAULT_CONFIG; private: own< resumable > _current_task; mut< netpoller > _netpoller; mut< shared_queue > _scheduler_queue; mut< scheduler > _scheduler; u64 _index; config _config; worker_queue _port_queue; worker_queue _ready_queue; local_sleep_queue _local_sleep_queue; public: worker(mut< netpoller > n, mut< shared_queue > cq, mut< scheduler > s, u64 i, config c = DEFAULT_CONFIG); public: void run(); void sleep_current(nanoseconds); void await_readable(i32 fd); void await_writable(i32 fd); u64 index() const; mut< worker_queue > port_queue(); mut< worker_queue > ready_queue(); private: void _block_resumable_on_sleep(own< resumable >, nanoseconds); void _run_task_from_queue(mut< worker_queue >, mut< execution_budget >); }; inline void worker::sleep_current(nanoseconds ns) { assert(is_valid(_current_task)); _current_task->yield(resumable::blocked::sleep{ns}); } inline void worker::await_readable(i32 fd) { assert(is_valid(_current_task)); _current_task->yield( resumable::blocked::port{fd, resumable::blocked::port::READ}); } inline void worker::await_writable(i32 fd) { assert(is_valid(_current_task)); _current_task->yield( resumable::blocked::port{fd, resumable::blocked::port::WRITE}); } inline u64 worker::index() const { return _index; } inline mut< worker_queue > worker::port_queue() { return edit(_port_queue); } inline mut< worker_queue > worker::ready_queue() { return edit(_ready_queue); } // assigned by scheduler extern thread_local mut< worker > LOCAL_WORKER; } } }
// // AppDelegate.h // TableViewDemo // // Created by Doncho Minkov on 1/22/16. // Copyright © 2016 Doncho Minkov. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#ifndef DECAFPARSER_BPARSER_H #define DECAFPARSER_BPARSER_H #include "parser.h" #include "parser_decaf.hpp" #include "ast.h" class BParser : public Parser { public: BParser( FILE* file, bool debug_lexer, bool debug_parser ) : Parser(file, debug_lexer, debug_parser) { extern FILE* yyin; yyin = file_; } virtual int parse() override { extern bool yy_flex_debug; yy::parser_decaf parser(*this); yy_flex_debug = debug_lexer_; parser.set_debug_level( debug_parser_ ); int res = parser.parse(); return res; } virtual std::string get_name() const override { return "Bison"; } }; #endif //DECAFPARSER_BPARSER_H
#ifdef BOARD_BUTTON_PIN volatile bool g_buttonPressed = false; volatile uint32_t g_buttonPressTime = -1; void button_action(void) { BlynkState::set(MODE_RESET_CONFIG); } ICACHE_RAM_ATTR void button_change(void) { #if BOARD_BUTTON_ACTIVE_LOW bool buttonState = !digitalRead(BOARD_BUTTON_PIN); #else bool buttonState = digitalRead(BOARD_BUTTON_PIN); #endif if (buttonState && !g_buttonPressed) { g_buttonPressTime = millis(); g_buttonPressed = true; DEBUG_PRINT("Hold the button for 10 seconds to reset configuration..."); } else if (!buttonState && g_buttonPressed) { g_buttonPressed = false; uint32_t buttonHoldTime = millis() - g_buttonPressTime; if (buttonHoldTime >= BUTTON_HOLD_TIME_ACTION) { button_action(); } else if (buttonHoldTime >= BUTTON_PRESS_TIME_ACTION) { // User action } g_buttonPressTime = -1; } } void button_init() { #if BOARD_BUTTON_ACTIVE_LOW pinMode(BOARD_BUTTON_PIN, INPUT_PULLUP); #else pinMode(BOARD_BUTTON_PIN, INPUT); #endif attachInterrupt(BOARD_BUTTON_PIN, button_change, CHANGE); } #else #define g_buttonPressed false #define g_buttonPressTime 0 void button_init() {} #endif
// // UIColor+RandomColor.h // general-code // // Created by John Bender on 1/23/13. // // #import <UIKit/UIKit.h> @interface UIColor (RandomColor) +(UIColor*) randomColor; +(UIColor*) randomColorWithAlpha:(CGFloat)alpha; @end
#include "platform_file_utils.h" FileData get_asset_data(const char* relative_path); void release_asset_data(const FileData* file_data);
// Generated by xsd compiler for ios/objective-c // DO NOT CHANGE! #import <Foundation/Foundation.h> extern NSString *const CheckSumMethod_NONE; extern NSString *const CheckSumMethod_MODULO_10;
// // UIView+printSubviews.h // RYTSketchView // // Created by Ryan on 21/6/15. // // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface UIView (PrintSubviews) - (void)printSubviewsWithIndentation:(int)indentation; @end
// This file is distributed under the MIT license. // See the LICENSE file for details. #pragma once #ifndef VSNRAY_GL_BVH_OUTLINE_RENDERER_H #define VSNRAY_GL_BVH_OUTLINE_RENDERER_H 1 #include <memory> #include <vector> #include <visionaray/math/matrix.h> #include <visionaray/bvh.h> namespace visionaray { namespace gl { //------------------------------------------------------------------------------------------------- // OpenGL BVH outline renderer // Call init() and destroy() with a valid OpenGL context! // class bvh_outline_renderer { public: //------------------------------------------------------------------------- // Configuration // enum display_filter { Full = 0, // display the whole BVH Leaves, // display only leave nodes // Level // display only nodes at a certain level }; struct display_config { display_config() : filter(Full) // , level(-1) { } display_filter filter; // int level ; }; public: bvh_outline_renderer(); ~bvh_outline_renderer(); // Render BVH outlines void frame(mat4 const& view, mat4 const& proj) const; // Call init() with a valid OpenGL context! template <typename BVH> bool init(BVH const& b, display_config config = display_config()) { std::vector<float> vertices; auto func = [&](typename BVH::node_type const& n) { auto box = n.get_bounds(); auto ilist = { box.min.x, box.min.y, box.min.z, box.max.x, box.min.y, box.min.z, box.max.x, box.min.y, box.min.z, box.max.x, box.max.y, box.min.z, box.max.x, box.max.y, box.min.z, box.min.x, box.max.y, box.min.z, box.min.x, box.max.y, box.min.z, box.min.x, box.min.y, box.min.z, box.min.x, box.min.y, box.max.z, box.max.x, box.min.y, box.max.z, box.max.x, box.min.y, box.max.z, box.max.x, box.max.y, box.max.z, box.max.x, box.max.y, box.max.z, box.min.x, box.max.y, box.max.z, box.min.x, box.max.y, box.max.z, box.min.x, box.min.y, box.max.z, box.min.x, box.min.y, box.min.z, box.min.x, box.min.y, box.max.z, box.max.x, box.min.y, box.min.z, box.max.x, box.min.y, box.max.z, box.max.x, box.max.y, box.min.z, box.max.x, box.max.y, box.max.z, box.min.x, box.max.y, box.min.z, box.min.x, box.max.y, box.max.z }; vertices.insert(vertices.end(), ilist.begin(), ilist.end()); }; if (config.filter == Full) { traverse_depth_first(b, func); } else if (config.filter == Leaves) { traverse_leaves(b, func); } num_vertices_ = vertices.size() / 3; return init_gl(vertices.data(), vertices.size() * sizeof(float)); } // Call destroy() while OpenGL context is still valid! void destroy(); private: struct impl; std::unique_ptr<impl> const impl_; size_t num_vertices_ = 0; // Init shaders and vbo from pointer to vertices. Buffer size in bytes! bool init_gl(float const* data, size_t size); }; } // gl } // visionaray #endif // VSNRAY_GL_BVH_OUTLINE_RENDERER_H
/** @file SystemInterface.h @author Philip Abbet Declaration of the class 'Athena::GUI::SystemInterface' */ #ifndef _ATHENA_GUI_SYSTEMINTERFACE_H_ #define _ATHENA_GUI_SYSTEMINTERFACE_H_ #include <Athena-GUI/Prerequisites.h> #include <Athena-Core/Utils/Timer.h> #include <Rocket/Core/SystemInterface.h> namespace Athena { namespace GUI { //---------------------------------------------------------------------------------------- /// @brief System Interface implementation for libRocket /// /// This class provides interfaces for Time and Logging. //---------------------------------------------------------------------------------------- class ATHENA_GUI_SYMBOL SystemInterface: public Rocket::Core::SystemInterface { //_____ Construction / Destruction __________ public: //------------------------------------------------------------------------------------ /// @brief Constructor //------------------------------------------------------------------------------------ SystemInterface(); //------------------------------------------------------------------------------------ /// @brief Destructor //------------------------------------------------------------------------------------ virtual ~SystemInterface(); //_____ Implementation of the libRocket's System Interface API __________ public: //------------------------------------------------------------------------------------ /// @brief Get the number of seconds elapsed since the start of the application /// /// @return Elapsed time, in seconds //------------------------------------------------------------------------------------ virtual float GetElapsedTime(); //------------------------------------------------------------------------------------ /// @brief Log the specified message /// /// @param[in] type Type of log message, ERROR, WARNING, etc /// @param[in] message Message to log /// @return True to continue execution, false to break into the debugger //------------------------------------------------------------------------------------ virtual bool LogMessage(Rocket::Core::Log::Type type, const Rocket::Core::String& message); //_____ Attributes __________ protected: Athena::Utils::Timer m_timer; }; } } #endif
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <SimulatorKit/FoundationXPCProtocolProxyable-Protocol.h> @protocol SimDisplayResizeableRenderable <FoundationXPCProtocolProxyable> - (void)didChangeOptimizedDisplaySize:(struct CGSize)arg1; - (void)didChangeDisplaySize:(struct CGSize)arg1; @end
#include <errno.h> #include <grp.h> #include <string.h> #include "user.h" int cm_user_get_group(struct passwd *pw, char **group) { errno = 0; struct group *g = getgrgid(pw->pw_gid); if(g == NULL) { return CM_ERR_NOGRP; } strncpy(*group, g->gr_name, strlen(g->gr_name)); return 0; }
// // UIButton+CZAddition.h // // Created by 刘凡 on 16/5/17. // Copyright © 2016年 itcast. All rights reserved. // #import <UIKit/UIKit.h> @interface UIButton (CZAddition) /** 创建文本按钮 @param title 标题文字 @param fontSize 字体大小 @param normalColor 默认颜色 @param highlightedColor 高亮颜色 @return UIButton */ + (instancetype __nonnull)cz_textButton:(NSString * __nullable)title fontSize:(CGFloat)fontSize normalColor:(UIColor * __nullable)normalColor highlightedColor:(UIColor * __nullable)highlightedColor; /** 创建文本按钮 @param title 标题文字 @param fontSize 字体大小 @param normalColor 默认颜色 @param highlightedColor 高亮颜色 @param backgroundImageName 背景图像名称 @return UIButton */ + (instancetype __nonnull)cz_textButton:(NSString * __nullable)title fontSize:(CGFloat)fontSize normalColor:(UIColor * __nullable)normalColor highlightedColor:(UIColor * __nullable)highlightedColor backgroundImageName:(NSString * __nullable)backgroundImageName; /** 创建图像按钮 @param imageName 图像名称 @param backgroundImageName 背景图像名称 @return UIButton */ + (instancetype __nonnull)cz_imageButton:(NSString * __nullable)imageName backgroundImageName:(NSString * __nullable)backgroundImageName; @end
/** * DeepDetect * Copyright (c) 2014-2016 Emmanuel Benazera * Author: Emmanuel Benazera <beniz@droidnik.fr> * * This file is part of deepdetect. * * deepdetect 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. * * deepdetect 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 deepdetect. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NET_CAFFE_H #define NET_CAFFE_H #include "net_generator.h" #include "caffe/caffe.hpp" namespace dd { using caffe::Caffe; using caffe::Net; using caffe::Blob; using caffe::Datum; class CaffeCommon { public: static caffe::LayerParameter* add_layer(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const std::string &name="", const std::string &type="", const std::string &label=""); static std::string set_activation(const APIData &ad_mllib); }; template <class TInputCaffe> class NetInputCaffe: public NetInput<TInputCaffe> { public: NetInputCaffe(caffe::NetParameter *net_params, caffe::NetParameter *dnet_params) :NetInput<TInputCaffe>(),_net_params(net_params),_dnet_params(dnet_params) { _net_params->set_name("net"); _dnet_params->set_name("dnet"); } ~NetInputCaffe() {} void configure_inputs(const APIData &ad_mllib, const TInputCaffe &inputc); void add_embed(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const int &input_dim, const int &num_output); caffe::NetParameter *_net_params; caffe::NetParameter *_dnet_params; }; class NetLayersCaffe: public NetLayers { public: NetLayersCaffe(caffe::NetParameter *net_params, caffe::NetParameter *dnet_params) :NetLayers(),_net_params(net_params),_dnet_params(dnet_params) {} //void add_basic_block() {} void configure_net(const APIData &ad) { (void)ad; } // common layers void add_fc(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const int &num_output); void add_sparse_fc(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const int &num_output); void add_conv(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const int &num_output, const int &kernel_size, const int &pad, const int &stride, const int &kernel_w=0, const int &kernel_h=0, const int &pad_w=0, const int &pad_h=0, const std::string &name="", const std::string &init="msra"); void add_act(caffe::NetParameter *net_param, const std::string &bottom, const std::string &activation, const double &elu_alpha=1.0, const double &negative_slope=0.0); void add_pooling(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const int &kernel_size, const int &stride, const std::string &type, const int &kernel_w=0, const int &kernel_h=0, const int &stride_w=0, const int &stride_h=0); void add_dropout(caffe::NetParameter *net_param, const std::string &bottom, const double &ratio); void add_bn(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top=""); void add_eltwise(caffe::NetParameter *net_param, const std::string &bottom1, const std::string &bottom2, const std::string &top); void add_reshape(caffe::NetParameter *net_param, const std::string &bottom, const std::string &top, const caffe::ReshapeParameter &r_param); //TODO // requires a fully connected layer (all losses ?) void add_softmax(caffe::NetParameter *net_param, const std::string &bottom, const std::string &label, const std::string &top, const int &num_output, const bool &deploy=false); void add_euclidean_loss(caffe::NetParameter *net_param, const std::string &bottom, const std::string &label, const std::string &top, const int &num_output, const bool &deploy=false); caffe::NetParameter *_net_params; caffe::NetParameter *_dnet_params; }; class NetLossCaffe { public: }; template <class TNetInputCaffe, class TNetLayersCaffe, class TNetLossCaffe> class NetCaffe : public NetGenerator<TNetInputCaffe,TNetLayersCaffe,TNetLossCaffe> { public: NetCaffe(caffe::NetParameter *net_params, caffe::NetParameter *dnet_params) :_net_params(net_params),_dnet_params(dnet_params), _nic(net_params,dnet_params),_nlac(net_params,dnet_params) {} ~NetCaffe() {} public: caffe::NetParameter* _net_params; /**< training net definition. */ caffe::NetParameter* _dnet_params; /**< deploy net definition. */ TNetInputCaffe _nic; TNetLayersCaffe _nlac; //TNetLossCaffe _nloc }; } //#include "net_caffe_mlp.h" #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_rand_square_09.c Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-09.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: rand Set data to result of rand(), which may be zero * GoodSource: Set data to a small, non-zero number (two) * Sinks: square * GoodSink: Ensure there will not be an overflow before squaring data * BadSink : Square data, which can lead to overflow * Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) and if(GLOBAL_CONST_FALSE) * * */ #include "std_testcase.h" #include <math.h> #ifndef OMITBAD void CWE190_Integer_Overflow__int_rand_square_09_bad() { int data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { /* POTENTIAL FLAW: Set data to a random value */ data = RAND32(); } if(GLOBAL_CONST_TRUE) { { /* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */ int result = data * data; printIntLine(result); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G1() - use badsource and goodsink by changing the second GLOBAL_CONST_TRUE to GLOBAL_CONST_FALSE */ static void goodB2G1() { int data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { /* POTENTIAL FLAW: Set data to a random value */ data = RAND32(); } if(GLOBAL_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Add a check to prevent an overflow from occurring */ if (abs((long)data) <= (long)sqrt((double)INT_MAX)) { int result = data * data; printIntLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */ static void goodB2G2() { int data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { /* POTENTIAL FLAW: Set data to a random value */ data = RAND32(); } if(GLOBAL_CONST_TRUE) { /* FIX: Add a check to prevent an overflow from occurring */ if (abs((long)data) <= (long)sqrt((double)INT_MAX)) { int result = data * data; printIntLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } } /* goodG2B1() - use goodsource and badsink by changing the first GLOBAL_CONST_TRUE to GLOBAL_CONST_FALSE */ static void goodG2B1() { int data; /* Initialize data */ data = 0; if(GLOBAL_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */ data = 2; } if(GLOBAL_CONST_TRUE) { { /* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */ int result = data * data; printIntLine(result); } } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */ static void goodG2B2() { int data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { /* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */ data = 2; } if(GLOBAL_CONST_TRUE) { { /* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */ int result = data * data; printIntLine(result); } } } void CWE190_Integer_Overflow__int_rand_square_09_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE190_Integer_Overflow__int_rand_square_09_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE190_Integer_Overflow__int_rand_square_09_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// // EnemiesTableViewController.h // UIRPGController // // Created by Sean on 10/11/14. // Copyright (c) 2014 Sean Herman. All rights reserved. // #import <UIKit/UIKit.h> @interface EnemiesTableViewController : UITableViewController @end
#include "sphia-test.h" // See #51 static void test_clear_similar_keys() { sphia_set(sphia, "key-1", "hello world"); sphia_set(sphia, "key-10", "hello world"); sphia_set(sphia, "00000000", "hello world"); sphia_set(sphia, "000000000", "hello world"); assert(4 == sphia_count(sphia)); assert(0 == sphia_clear(sphia)); assert(0 == sphia_count(sphia)); } TEST(test_clear_similar_keys);
#pragma once #include <vector> #include <algorithm> using namespace std; class Solution { public: int maxProfit(vector<int>& prices) { int states[2][4] = { INT_MIN, 0, INT_MIN, 0 }; // 0: 1 buy, 1: one buy/sell, 2: 2 buys/1 sell, 3, 2 buys/sells int cur = 0, next = 1; for (int i = 0; i < prices.size(); i++) { states[next][0] = max(states[cur][0], -prices[i]); states[next][1] = max(states[cur][1], states[cur][0] + prices[i]); states[next][2] = max(states[cur][2], states[cur][1] - prices[i]); states[next][3] = max(states[cur][3], states[cur][2] + prices[i]); int temp = next; next = cur, cur = temp; } return max(states[cur][1], states[cur][3]); } void call() { vector<int> prices{ 7, 1, 5, 3, 6, 4, 100 }; auto result = maxProfit(prices); } };
//******************************************************************************* // COPYRIGHT NOTES // --------------- // This is a part of the BCGControlBar Library // Copyright (C) 1998-2000 BCGSoft Ltd. // All rights reserved. // // This source code can be used, distributed or modified // only under terms and conditions // of the accompanying license agreement. //******************************************************************************* #if !defined(AFX_BCGMDICHILDWND_H__3BE44BE6_C83D_11D3_A723_009027900694__INCLUDED_) #define AFX_BCGMDICHILDWND_H__3BE44BE6_C83D_11D3_A723_009027900694__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // BCGMDIChildWnd.h : header file // #include "bcgcontrolbar.h" class CBCGMDIFrameWnd; ///////////////////////////////////////////////////////////////////////////// // CBCGMDIChildWnd frame class BCGCONTROLBARDLLEXPORT CBCGMDIChildWnd : public CMDIChildWnd { friend class CBCGMainClientAreaWnd; DECLARE_DYNCREATE(CBCGMDIChildWnd) protected: CBCGMDIChildWnd(); // protected constructor used by dynamic creation // Attributes protected: CBCGMDIFrameWnd* m_pMDIFrame; BOOL m_bToBeDestroyed; // Operations public: void DockControlBarLeftOf(CControlBar* pBar, CControlBar* pLeftOf); // Overrides // Next methods used by MDI tabs: virtual CString GetFrameText () const; virtual HICON GetFrameIcon () const; virtual void OnUpdateFrameTitle(BOOL bAddToTitle); // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CBCGMDIChildWnd) public: virtual BOOL PreTranslateMessage(MSG* pMsg); //}}AFX_VIRTUAL // Implementation protected: virtual ~CBCGMDIChildWnd(); // Generated message map functions //{{AFX_MSG(CBCGMDIChildWnd) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd); //}}AFX_MSG afx_msg LRESULT OnSetText(WPARAM,LPARAM); afx_msg LRESULT OnSetIcon(WPARAM,LPARAM); DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_BCGMDICHILDWND_H__3BE44BE6_C83D_11D3_A723_009027900694__INCLUDED_)
#include "q_constants.h" #include "macros.h" #include "qtypes.h" #include "s_to_f_const_F4.h" void s_to_f_const_F4( float *X, uint64_t nX, float val ) { for ( uint64_t i = 0; i < nX; i++ ) { X[i] = val; } }
// Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2018-2020 The Ion Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NETBASE_H #define BITCOIN_NETBASE_H #if defined(HAVE_CONFIG_H) #include "config/ion-config.h" #endif #include "compat.h" #include "netaddress.h" #include "serialize.h" #include <stdint.h> #include <string> #include <vector> extern int nConnectTimeout; extern bool fNameLookup; //! -timeout default static const int DEFAULT_CONNECT_TIMEOUT = 5000; //! -dns default static const int DEFAULT_NAME_LOOKUP = true; static const bool DEFAULT_ALLOWPRIVATENET = false; class proxyType { public: proxyType(): randomize_credentials(false) {} proxyType(const CService &_proxy, bool _randomize_credentials=false): proxy(_proxy), randomize_credentials(_randomize_credentials) {} bool IsValid() const { return proxy.IsValid(); } CService proxy; bool randomize_credentials; }; enum Network ParseNetwork(std::string net); std::string GetNetworkName(enum Network net); bool SetProxy(enum Network net, const proxyType &addrProxy); bool GetProxy(enum Network net, proxyType &proxyInfoOut); bool IsProxy(const CNetAddr &addr); bool SetNameProxy(const proxyType &addrProxy); bool HaveNameProxy(); bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup); bool LookupHost(const char *pszName, CNetAddr& addr, bool fAllowLookup); bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLookup); bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions); CService LookupNumeric(const char *pszName, int portDefault = 0); bool LookupSubNet(const char *pszName, CSubNet& subnet); bool ConnectSocket(const CService &addr, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed = 0); bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault, int nTimeout, bool *outProxyConnectionFailed = 0); /** Return readable error string for a network error code */ std::string NetworkErrorString(int err); /** Close socket and set hSocket to INVALID_SOCKET */ bool CloseSocket(SOCKET& hSocket); /** Disable or enable blocking-mode for a socket */ bool SetSocketNonBlocking(const SOCKET& hSocket, bool fNonBlocking); /** Set the TCP_NODELAY flag on a socket */ bool SetSocketNoDelay(const SOCKET& hSocket); /** * Convert milliseconds to a struct timeval for e.g. select. */ struct timeval MillisToTimeval(int64_t nTimeout); void InterruptSocks5(bool interrupt); #endif // BITCOIN_NETBASE_H
// // NSDate+Helper.h // YMDPickerVIewDemo // // Created by ronaldo on 7/24/14. // Copyright (c) 2014 ronaldo. All rights reserved. // #import <Foundation/Foundation.h> @interface NSDate (YMDExtensions) + (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; - (NSInteger)year; - (NSInteger)month; - (NSInteger)day; - (NSDate *) dateByAddingDays: (NSInteger) dDays; @end
#import <Foundation/Foundation.h> #import "ERNResourceFactory.h" @interface ERNNullResourceFactory : NSObject <ERNResourceFactory> +(instancetype)create; @end
/** * This file was generated by cmake, do NOT modify. */ #ifndef DUI_UIBUILDCONFIG_H_ #define DUI_UIBUILDCONFIG_H_ /* #undef HAVE_STRICMP */ #define HAVE_STRCASECMP #endif // !DUI_UIBUILDCONFIG_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE416_Use_After_Free__malloc_free_char_11.c Label Definition File: CWE416_Use_After_Free__malloc_free.label.xml Template File: sources-sinks-11.tmpl.c */ /* * @description * CWE: 416 Use After Free * BadSource: Allocate data using malloc(), initialize memory block, and Deallocate data using free() * GoodSource: Allocate data using malloc() and initialize memory block * Sinks: * GoodSink: Do nothing * BadSink : Use data * Flow Variant: 11 Control flow: if(globalReturnsTrue()) and if(globalReturnsFalse()) * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE416_Use_After_Free__malloc_free_char_11_bad() { char * data; /* Initialize data */ data = NULL; if(globalReturnsTrue()) { data = (char *)malloc(100*sizeof(char)); memset(data, 'A', 100-1); data[100-1] = '\0'; /* POTENTIAL FLAW: Free data in the source - the bad sink attempts to use data */ free(data); } if(globalReturnsTrue()) { /* POTENTIAL FLAW: Use of data that may have been freed */ printLine(data); /* POTENTIAL INCIDENTAL - Possible memory leak here if data was not freed */ } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G1() - use badsource and goodsink by changing the second globalReturnsTrue() to globalReturnsFalse() */ static void goodB2G1() { char * data; /* Initialize data */ data = NULL; if(globalReturnsTrue()) { data = (char *)malloc(100*sizeof(char)); memset(data, 'A', 100-1); data[100-1] = '\0'; /* POTENTIAL FLAW: Free data in the source - the bad sink attempts to use data */ free(data); } if(globalReturnsFalse()) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Don't use data that may have been freed already */ /* POTENTIAL INCIDENTAL - Possible memory leak here if data was not freed */ /* do nothing */ ; /* empty statement needed for some flow variants */ } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */ static void goodB2G2() { char * data; /* Initialize data */ data = NULL; if(globalReturnsTrue()) { data = (char *)malloc(100*sizeof(char)); memset(data, 'A', 100-1); data[100-1] = '\0'; /* POTENTIAL FLAW: Free data in the source - the bad sink attempts to use data */ free(data); } if(globalReturnsTrue()) { /* FIX: Don't use data that may have been freed already */ /* POTENTIAL INCIDENTAL - Possible memory leak here if data was not freed */ /* do nothing */ ; /* empty statement needed for some flow variants */ } } /* goodG2B1() - use goodsource and badsink by changing the first globalReturnsTrue() to globalReturnsFalse() */ static void goodG2B1() { char * data; /* Initialize data */ data = NULL; if(globalReturnsFalse()) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { data = (char *)malloc(100*sizeof(char)); memset(data, 'A', 100-1); data[100-1] = '\0'; /* FIX: Do not free data in the source */ } if(globalReturnsTrue()) { /* POTENTIAL FLAW: Use of data that may have been freed */ printLine(data); /* POTENTIAL INCIDENTAL - Possible memory leak here if data was not freed */ } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */ static void goodG2B2() { char * data; /* Initialize data */ data = NULL; if(globalReturnsTrue()) { data = (char *)malloc(100*sizeof(char)); memset(data, 'A', 100-1); data[100-1] = '\0'; /* FIX: Do not free data in the source */ } if(globalReturnsTrue()) { /* POTENTIAL FLAW: Use of data that may have been freed */ printLine(data); /* POTENTIAL INCIDENTAL - Possible memory leak here if data was not freed */ } } void CWE416_Use_After_Free__malloc_free_char_11_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE416_Use_After_Free__malloc_free_char_11_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE416_Use_After_Free__malloc_free_char_11_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/*===========================================================* | icom.h | Copyright (c) 1987-1995 Applied Logic Systems, Inc. | | -- ICode command numbers | | Author: Kevin A. Buettner | Created: 2/12/87 | 10/26/94, C. Houpt -- Ifdefed out makeobp with OBP. *===========================================================*/ #ifndef _ICOM_H_INCLUDED_ #define _ICOM_H_INCLUDED_ 1 #define IC_INIT -1 /* initialize icode buffer */ #define IC_ENDCLAUSE -2 /* end a clause */ #define IC_ASSERTZ -3 /* assertz the icode buffer */ #define IC_ASSERTA -4 /* asserta the icode buffer */ #define IC_EXECQUERY -5 /* execute a query */ #define IC_EXECCOMMAND -6 /* execute a command */ #define IC_CHANGEMOD -7 /* switch modules */ #define IC_ADDUSE -8 /* add a use declaration to the */ /* current module */ #define IC_ENDMODULE -9 /* end the current module */ #define IC_NEWMODULE -10 /* start a different module */ #define IC_EXPORTPRED -11 /* export a predicate from */ /* current module */ #define IC_1STARG -12 /* key for first argument is */ /* passed in */ #define IC_BEGINMACRO -13 /* begin macro expansion */ #define IC_ENDMACRO -14 /* end macro expansion */ #define IC_PUTMACRO -15 /* puts down macro in defn area */ #define IC_ADDCLAUSE -16 /* similar to assertz */ #define IC_ICRESET -18 /* Reset the .obp file */ #define IC_ADDTO_AUTOUSE -21 #define IC_ADDTO_AUTONAME -22 /* add to auto name */ #define IC_CREMODCLOSURE -24 /* creates a module closure */ #define IC_BEGINALLOC -25 #define IC_ENDALLOC -26 #ifdef OBP extern int makeobp; #endif /* OBP */ #endif /* _ICOM_H_INCLUDED_ */
/* RamseyScript * Written in 2012 by * Andrew Poelstra <apoelstra@wpsoftware.net> * * To the extent possible under law, the author(s) have dedicated all * copyright and related and neighboring rights to this software to * the public domain worldwide. This software is distributed without * any warranty. * * You should have received a copy of the CC0 Public Domain Dedication * along with this software. * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. */ /*! \file process.h * \brief Defines script-processing and parsing functions. */ #ifndef PROCESS_H #define PROCESS_H #include "stream.h" /*! \brief Sets default variables before a script run. * * \param [in] in The input stream to use. * \param [in] out The output stream to use. * \param [in] err The error stream to use. * * \return A newly-allocated global_data struct, or NULL on failure. */ struct _global_data *set_defaults (stream_t *in, stream_t *out, stream_t *err); /*! \brief Reads and runs a script from the global state's input stream. * * \param [in] state The global state of the program. */ void process (struct _global_data *state); /*! \brief Outputs a user-friendly usage message to a given stream. * * \param [in] out The stream to output to. */ void ramsey_usage (stream_t *out); #endif
#include "rims.h" /* This is a sample program. You can save/compile/run it, modify it first, or just load a different program. */ /* Sets B0 to 1 as quickly as possible when A0==1 and A1==0*/ /* Note that A0 - A7 can be set by clicking the switches to the left, and B0 - B7 can be viewed as LEDs to the right (green corresponds to '1', red to '0'). */ unsigned char C2F_uc(unsigned char C) { unsigned char F; F = (9/5)*C + 32; return F; } void main() { while (1) { B = C2F_uc(A); } }
/* CoreAnimation - CAEmitterBehavior.h Copyright (c) 2013-2015, Apple Inc. All rights reserved. */ #import <QuartzCore/CALayer.h> @interface CAEmitterBehavior : NSObject <NSCoding> { @private unsigned int _type; NSString *_name; void *_attr; void *_cache; uint32_t _flags; } + (NSArray *)behaviorTypes; + (CAEmitterBehavior *)behaviorWithType:(NSString *)type; - (id)initWithType:(NSString *)type; @property(readonly) NSString *type; @property(copy) NSString *name; @property(getter=isEnabled) BOOL enabled; @end /** Behavior types. **/ /* `wave': Adds a force vector to each particle, modulating the * force value by a time-based wave function. * * CAPoint3D force: force vector [X Y Z]. * * CGFloat frequency: oscillation frequency. The actual modulation * value is a triangular wave of the specified frequency composed with * a quadratic smoothstep function. */ CA_EXTERN NSString * const kCAEmitterBehaviorWave; /* `drag': Adds a constant drag force to each particle. * * CGFloat drag: slowing amount, the force on the particle is * calculated as "V * -drag" where "V" is the particle's current * velocity. */ CA_EXTERN NSString * const kCAEmitterBehaviorDrag; /* `alignToMotion': Aligns the particle image's Y axis to its velocity * vector. * * CGFloat rotation: angle in rotations to apply in addition to * orientation of the velocity vector. * * BOOL preservesDepth: if true will operate in 3D, i.e. by picking * an axis orthogonal to the required rotation. If false (the default) * operates in 2D by rotating about the Z axis. Note that only `plane' * type particles support a 3D orientation. */ CA_EXTERN NSString * const kCAEmitterBehaviorAlignToMotion; /* `valueOverLife': Defines a particle property as a function of * their current time. * * NSString *keyPath: name of the property to change. * NSArray<NSNumber> *values: array of numeric values. * NSArray<NSNumber> *locations: optional array of stop-locations. * * The particles current time is divided by its lifetime to give a * value in the [0,1] range, which is then interpolated into the values * array. The property is then replaced by the color from the gradient. * * Supported property names include: `position.x', `position.y', * `position.z', `velocity.x', `velocity.y', `velocity.z', `mass', * `rotation', `spin', scale', `scaleSpeed', `color.red', * `color.green', `color.blue', `color.alpha'. */ CA_EXTERN NSString * const kCAEmitterBehaviorValueOverLife; /* `colorOverLife': Defines the color of each particle as a function * of their current time. * * NSArray<CGColorRef> *colors: array of gradient color stops. * NSArray<NSNumber> *locations: optional array of stop-locations. * * The particles current time is divided by its lifetime to give a * value in the [0,1] range, which is then interpolated into the * gradient. The particle's color is then replaced by the color from * the gradient. */ CA_EXTERN NSString * const kCAEmitterBehaviorColorOverLife; /* `light': Three-dimensional lighting. * * CGColorRef color: the light's color, alpha is ignored. * CGPoint position: the light's 2D position. * CGFloat zPosition: the light's position on Z axis. * NSNumber falloff, falloffDistance: falloff values. * NSNumber spot: if true, light is a spot-light. * NSNumber appliesAlpha: if true, lit object's alpha is also affected. * * For spot-lights: * NSNumber directionLatitude, directionLongitude: the light's direction. * NSNumber coneAngle, coneEdgeSoftness: the spot's lighting cone. * * See CALight.h for more description of the lighting behavior. */ CA_EXTERN NSString * const kCAEmitterBehaviorLight; /* `attractor': force field. * * NSString attractorType: "radial" (default), "axial" or "planar". * NSNumber stiffness: the spring stiffness. * NSNumber radius: attractor radius, no effect inside. * CGPoint position: the attractor's 2D position. * CGFloat zPosition: the attractor's position on Z axis. * NSNumber orientationLatitude, orientationLongitude: the orientation * used as the axis of axial attractors or normal of planar attractors. * NSNumber falloff, falloffDistance: falloff values. */ CA_EXTERN NSString * const kCAEmitterBehaviorAttractor;
#include <mpi.h> #include <stdio.h> int main (int argc, char* argv[]){ int rank, size; int sum; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Allreduce(&rank, &sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); /* Display the result on all ranks, along with the correct answer */ printf("Rank %2d has sum of ranks %d; Answer %d \n", rank, sum, (size-1)*size/2); MPI_Finalize(); return 0; }
#include <stdio.h> #include <net/ethernet.h> #include <arpa/inet.h> #include "ethernet.h" void ethernet_print_mac (const uint8_t ether_dhost[ETH_ALEN]) { for (int i = 0; i < (ETH_ALEN - 1); i ++) { fprintf(stdout, "%x:", ether_dhost[i]); } fprintf(stdout, "%x", ether_dhost[ETH_ALEN - 1]); } void ethernet_print_type (const uint16_t ether_type) { switch (htons(ether_type)) { case ETHERTYPE_PUP: /* 0x0200 */ fprintf(stdout, "PUP"); break; case ETHERTYPE_SPRITE: /* 0x0500 */ fprintf(stdout, "Sprite"); break; case ETHERTYPE_IP: /* 0x0800 */ fprintf(stdout, "IPv4"); break; case ETHERTYPE_ARP: /* 0x0806 */ fprintf(stdout, "ARP"); break; case ETHERTYPE_REVARP: /* 0x8035 */ fprintf(stdout, "RARP"); break; case ETHERTYPE_AT: /* 0x809B */ fprintf(stdout, "AT"); break; case ETHERTYPE_AARP: /* 0x80F3 */ fprintf(stdout, "AARP"); break; case ETHERTYPE_VLAN: /* 0x8100 */ fprintf(stdout, "VLAN"); break; case ETHERTYPE_IPX: /* 0x8137 */ fprintf(stdout, "IPX"); break; case ETHERTYPE_IPV6: /* 0x86DD */ fprintf(stdout, "IPv6"); break; case ETHERTYPE_LOOPBACK: /* 0x9000 */ fprintf(stdout, "Test"); break; default: fprintf(stdout, "????"); break; } }
/* Copyright (C) 1996-1997 Id Software, 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __ASM_I386__ #define __ASM_I386__ #ifdef ELF #define C(label) label #else #define C(label) _##label #endif // !!! note that this file must match the corresponding C structures at all // times !!! // plane_t structure // !!! if this is changed, it must be changed in model.h too !!! // !!! if the size of this is changed, the array lookup in SV_HullPointContents // must be changed too !!! #define pl_normal 0 #define pl_dist 12 #define pl_type 16 #define pl_signbits 17 #define pl_pad 18 #define pl_size 20 // hull_t structure // !!! if this is changed, it must be changed in model.h too !!! #define hu_clipnodes 0 #define hu_planes 4 #define hu_firstclipnode 8 #define hu_lastclipnode 12 #define hu_clip_mins 16 #define hu_clip_maxs 28 #define hu_size 40 // dnode_t structure // !!! if this is changed, it must be changed in bspfile.h too !!! #define nd_planenum 0 #define nd_children 4 #define nd_mins 8 #define nd_maxs 20 #define nd_firstface 32 #define nd_numfaces 36 #define nd_size 40 // sfxcache_t structure // !!! if this is changed, it much be changed in sound.h too !!! #define sfxc_length 0 #define sfxc_loopstart 4 #define sfxc_speed 8 #define sfxc_width 12 #define sfxc_stereo 16 #define sfxc_data 20 // channel_t structure // !!! if this is changed, it much be changed in sound.h too !!! #define ch_sfx 0 #define ch_leftvol 4 #define ch_rightvol 8 #define ch_end 12 #define ch_pos 16 #define ch_looping 20 #define ch_entnum 24 #define ch_entchannel 28 #define ch_origin 32 #define ch_dist_mult 44 #define ch_master_vol 48 #define ch_size 52 // portable_samplepair_t structure // !!! if this is changed, it much be changed in sound.h too !!! #define psp_left 0 #define psp_right 4 #define psp_size 8 #endif
/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2002 by Alan Korr & Nick Robinson * * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include "config.h" #include "button.h" #include "cpu.h" #include "system.h" #include "kernel.h" #include "serial.h" #include "serial-imx31.h" void serial_setup(void) { #ifdef UART_INT /*enable UART Interrupts */ UCR1_1 |= (EUARTUCR1_TRDYEN | EUARTUCR1_RRDYEN | EUARTUCR1_TXMPTYEN); UCR4_1 |= (EUARTUCR4_TCEN); #else /*disable UART Interrupts*/ UCR1_1 &= ~(EUARTUCR1_TRDYEN | EUARTUCR1_RRDYEN | EUARTUCR1_TXMPTYEN); UCR4_1 &= ~(EUARTUCR4_TCEN); #endif UCR1_1 |= EUARTUCR1_UARTEN; UCR2_1 |= (EUARTUCR2_TXEN | EUARTUCR2_RXEN | EUARTUCR2_IRTS); /* Tx,Rx Interrupt Trigger levels, Disable for now*/ /*UFCR1 |= (UFCR1_TXTL_32 | UFCR1_RXTL_32);*/ } int tx_rdy(void) { if((UTS1 & EUARTUTS_TXEMPTY)) return 1; else return 0; } /*Not ready...After first Rx, UTS1 & UTS1_RXEMPTY keeps returning true*/ int rx_rdy(void) { if(!(UTS1 & EUARTUTS_RXEMPTY)) return 1; else return 0; } void tx_writec(unsigned char c) { UTXD1=(int) c; }
/* BOSCH GYROSCOPE Sensor Driver Header File * * 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 BMG160_H #define BMG160_H #include <linux/ioctl.h> /************************************************************* | sensor | chip id | bit number | 7-bit i2c address | -------------------------------------------------------------| | bmg160 | 0x0F | 16 |0x68(SDO:low),0x69(SDO:high)| *************************************************************/ /* * configuration */ #define BMG_DRIVER_VERSION "V1.4" /* apply low pass filter on output */ /* #define CONFIG_BMG_LOWPASS */ #define SW_CALIBRATION #define BMG_AXIS_X 0 #define BMG_AXIS_Y 1 #define BMG_AXIS_Z 2 #define BMG_AXES_NUM 3 #define BMG_DATA_LEN 6 #define BMG_DEV_NAME "bmg160" #define C_MAX_FIR_LENGTH (32) #define MAX_SENSOR_NAME (32) #define I2C_BUFFER_SIZE (256) /* common definition */ #define BMG_GET_BITSLICE(regvar, bitname)\ ((regvar & bitname##__MSK) >> bitname##__POS) #define BMG_SET_BITSLICE(regvar, bitname, val)\ ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK)) #define BMG_CHIP_ID_REG 0x00 #define BMG_BUFSIZE 128 #define MAX_FIFO_F_LEVEL 100 #define MAX_FIFO_F_BYTES 8 /* *1 rad = PI*degree/180, about 3.1416*degree/180 *1 degree = rad*180/PI, about rad*180/3.1416 */ #define BMG160_OUT_MAGNIFY 131 #define DEGREE_TO_RAD 57 /*********************************[BMG160]*************************************/ /* chip id */ #define BMG160_CHIP_ID 0x0F /* i2c address */ /* *7-bit addr: 0x68 (SDO connected to GND); 0x69 (SDO connected to VDDIO) */ #define BMG160_I2C_ADDRESS 0x68 //#define BMG160_I2C_ADDRESS 0x69 /* bandwidth */ #define C_BMG160_No_Filter_U8X 0 #define C_BMG160_BW_230Hz_U8X 1 #define C_BMG160_BW_116Hz_U8X 2 #define C_BMG160_BW_47Hz_U8X 3 #define C_BMG160_BW_23Hz_U8X 4 #define C_BMG160_BW_12Hz_U8X 5 #define C_BMG160_BW_64Hz_U8X 6 #define C_BMG160_BW_32Hz_U8X 7 #define BMG160_BW_ADDR 0x10 #define BMG160_BW_ADDR__POS 0 #define BMG160_BW_ADDR__LEN 3 #define BMG160_BW_ADDR__MSK 0x07 #define BMG160_BW_ADDR__REG BMG160_BW_ADDR /* range */ #define BMG160_RANGE_2000 0 #define BMG160_RANGE_1000 1 #define BMG160_RANGE_500 2 #define BMG160_RANGE_250 3 #define BMG160_RANGE_125 4 #define BMG160_RANGE_ADDR 0x0F #define BMG160_RANGE_ADDR_RANGE__POS 0 #define BMG160_RANGE_ADDR_RANGE__LEN 3 #define BMG160_RANGE_ADDR_RANGE__MSK 0x07 #define BMG160_RANGE_ADDR_RANGE__REG BMG160_RANGE_ADDR /* power mode */ #define BMG160_SUSPEND_MODE 4 #define BMG160_NORMAL_MODE 0 #define BMG160_MODE_LPM1_ADDR 0x11 #define BMG160_MODE_LPM1__POS 5 #define BMG160_MODE_LPM1__LEN 3 #define BMG160_MODE_LPM1__MSK 0xA0 #define BMG160_MODE_LPM1__REG BMG160_MODE_LPM1_ADDR /* data */ #define BMG160_RATE_X_LSB_ADDR 0x02 #define BMG160_FIFO_DATA_ADDR 0x3F /* self test */ #define BMG160_SELF_TEST_ADDR 0x3C #define BMG160_SELF_TEST_ADDR_RATEOK__POS 4 #define BMG160_SELF_TEST_ADDR_RATEOK__LEN 1 #define BMG160_SELF_TEST_ADDR_RATEOK__MSK 0x10 #define BMG160_SELF_TEST_ADDR_RATEOK__REG BMG160_SELF_TEST_ADDR #define BMG160_SELF_TEST_ADDR_BISTFAIL__POS 2 #define BMG160_SELF_TEST_ADDR_BISTFAIL__LEN 1 #define BMG160_SELF_TEST_ADDR_BISTFAIL__MSK 0x04 #define BMG160_SELF_TEST_ADDR_BISTFAIL__REG BMG160_SELF_TEST_ADDR #define BMG160_SELF_TEST_ADDR_TRIGBIST__POS 0 #define BMG160_SELF_TEST_ADDR_TRIGBIST__LEN 1 #define BMG160_SELF_TEST_ADDR_TRIGBIST__MSK 0x01 #define BMG160_SELF_TEST_ADDR_TRIGBIST__REG BMG160_SELF_TEST_ADDR /* fifo */ #define BMG160_FIFO_CGF0_ADDR 0x3E #define BMG160_FIFO_CGF0_ADDR_MODE__POS 6 #define BMG160_FIFO_CGF0_ADDR_MODE__LEN 2 #define BMG160_FIFO_CGF0_ADDR_MODE__MSK 0xC0 #define BMG160_FIFO_CGF0_ADDR_MODE__REG BMG160_FIFO_CGF0_ADDR #define BMG160_FIFO_STATUS_ADDR 0x0E #define BMG160_FIFO_STATUS_FRAME_COUNTER__POS 0 #define BMG160_FIFO_STATUS_FRAME_COUNTER__LEN 7 #define BMG160_FIFO_STATUS_FRAME_COUNTER__MSK 0x7F #define BMG160_FIFO_STATUS_FRAME_COUNTER__REG BMG160_FIFO_STATUS_ADDR #endif/* BMG160_H */
int get(int a, int b);
/* * * Mon Jun 15 02:38:17 BRT 2015 * author: Joao Gustavo Cabral de Marins * e-mail: jgcmarins@gmail.com * */ #include "headers/InputReader.h" char *inputReader() { char *buffer = NULL; int c, i = 0; do { c = fgetc(stdin); buffer = (char *) realloc(buffer, sizeof(char)*(i+1)); buffer[i++] = c; } while((c != 10) && !feof(stdin)); buffer[i-1] = '\0'; return buffer; }
/*************************************************************************** * qgsgeometrysnapperplugin.h * * ------------------- * * copyright : (C) 2014 by Sandro Mani / Sourcepole AG * * email : smani@sourcepole.ch * ***************************************************************************/ /*************************************************************************** * * * 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 QGS_GEOMETRY_SNAPPER_PLUGIN_H #define QGS_GEOMETRY_SNAPPER_PLUGIN_H #include "qgis.h" #include "qgisplugin.h" #include "qgsgeometrysnapperdialog.h" class QgisInterface; static const QString sName = QApplication::translate( "QgsGeometrySnapperPlugin", "Geometry Snapper" ); static const QString sDescription = QApplication::translate( "QgsGeometrySnapperPlugin", "Snap geometries to a reference layer" ); static const QString sCategory = QApplication::translate( "QgsGeometrySnapperPlugin", "Vector" ); static const QString sPluginVersion = QApplication::translate( "QgsGeometrySnapperPlugin", "Version 0.1" ); static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI; static const QString sPluginIcon = QStringLiteral( ":/geometrysnapper/icons/geometrysnapper.png" ); class QgsGeometrySnapperPlugin : public QObject, public QgisPlugin { Q_OBJECT public: explicit QgsGeometrySnapperPlugin( QgisInterface* iface ); void initGui() override; void unload() override; private: QgisInterface* mIface; QgsGeometrySnapperDialog* mDialog; QAction* mMenuAction; }; #endif // QGS_GEOMETRY_SNAPPER_PLUGIN_H
// Copyright (c) 2014 Jiho Choi. All rights reserved. // To use this source, see LICENSE file. #pragma once namespace dg { class EngineConfig : public Config { public: EngineConfig(); ~EngineConfig(); String global_effect_path_; String default_effect_path_; String sprite_effect_path_; String line_effect_path_; String line2_effect_path_; String blur_effect_path_; String imgui_effect_path_; String shader_package_path_; String system_font_face_; String default_model_; String default_animation_; String default_camera_; String default_scene_; ColorInt background_color_; float model_scale_; float camera_height_; float global_light_brightness_; float global_gamma_correction_; float global_bloom_weight_; Size2 shadow_map_size_; Size2 windowed_screen_size_; Size2 full_screen_screen_size_; bool is_full_screen_; bool is_shadow_enabled_; float sample_frames_per_second_; bool is_draw_frame_rate_; bool is_draw_depth_texture_; bool is_draw_shadow_texture_; bool is_draw_skeleton_; bool is_draw_axis_; bool is_post_process_blur_; bool is_rotate_camera_; protected: virtual bool LoadFrom(IniFile* ini_file); }; extern EngineConfig* g_engine_config; } // namespace dg