text
stringlengths
4
6.14k
#ifndef UI_H_INCLUDED #define UI_H_INCLUDED typedef struct { ; } UI; /// private methods void ui__printMenu(); int ui__getCmd(); int ui__getInteger(const char *message); /// public methods void run(UI *self); void uiInit(UI *self); void uiDestroy(UI *self); /// TODO commands #endif // UI_H_INCLUDED
#include "memory.h" #include <stdint.h> void* kmemcpy(void* dst, const void* src, size_t n) { uint8_t* dst8 = (uint8_t*)dst; const uint8_t* src8 = (const uint8_t*)src; if(n >= 4) { uint32_t* dst32 = (uint32_t*)dst; const uint32_t* src32 = (const uint32_t*)src; size_t n32 = n >> 2; while(n32-- > 0) { *dst32++ = *src32++; } dst8 = (uint8_t*)dst32; src8 = (const uint8_t*)src32; } const size_t rem = n & 3; switch(rem) { case 3: *dst8++ = *src8++; case 2: *dst8++ = *src8++; case 1: *dst8 = *src8; } return dst; } void* kmemset(void* s, int c, size_t n) { uint8_t* dst8 = (uint8_t*)s; uint8_t c8 = (uint8_t)c; if(n >= 4) { uint32_t* dst32 = (uint32_t*)s; const uint32_t c32 = 0 | ((uint32_t)c8) | ((uint32_t)c8 << 8) | ((uint32_t)c8 << 16) | ((uint32_t)c8 << 24); size_t n32 = n >> 2; while(n32-- > 0) { *dst32++ = c32; } dst8 = (uint8_t*)dst32; } const size_t rem = n & 3; switch(rem) { case 3: *dst8++ = c8; case 2: *dst8++ = c8; case 1: *dst8 = c8; } return s; }
// // ReverseString.h // Recursion_HW // // Created by Yongyang Nie on 9/30/16. // Copyright © 2016 Yongyang Nie. All rights reserved. // #import <Foundation/Foundation.h> @interface ReverseString : NSString @property (strong, nonatomic) NSString *reverse; -(void)reverseString:(NSString *)string; @end
///////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009-2014 Alan Wright. All rights reserved. // Distributable under the terms of either the Apache License (Version 2.0) // or the GNU Lesser General Public License. ///////////////////////////////////////////////////////////////////////////// #ifndef DOCINVERTERPERTHREAD_H #define DOCINVERTERPERTHREAD_H #include "DocFieldConsumerPerThread.h" #include "AttributeSource.h" namespace Lucene { /// This is a DocFieldConsumer that inverts each field, separately, from a Document, and accepts a /// InvertedTermsConsumer to process those terms. class DocInverterPerThread : public DocFieldConsumerPerThread { public: DocInverterPerThread(const DocFieldProcessorPerThreadPtr& docFieldProcessorPerThread, const DocInverterPtr& docInverter); virtual ~DocInverterPerThread(); LUCENE_CLASS(DocInverterPerThread); public: DocInverterWeakPtr _docInverter; InvertedDocConsumerPerThreadPtr consumer; InvertedDocEndConsumerPerThreadPtr endConsumer; SingleTokenAttributeSourcePtr singleToken; DocStatePtr docState; FieldInvertStatePtr fieldState; /// Used to read a string value for a field ReusableStringReaderPtr stringReader; public: virtual void initialize(); virtual void startDocument(); virtual DocWriterPtr finishDocument(); virtual void abort(); virtual DocFieldConsumerPerFieldPtr addField(const FieldInfoPtr& fi); }; class SingleTokenAttributeSource : public AttributeSource { public: SingleTokenAttributeSource(); virtual ~SingleTokenAttributeSource(); LUCENE_CLASS(SingleTokenAttributeSource); public: TermAttributePtr termAttribute; OffsetAttributePtr offsetAttribute; public: void reinit(const String& stringValue, int32_t startOffset, int32_t endOffset); }; } #endif
/** ****************************************************************************** * @file ADC/ADC_VBATMeasurement/stm32f4xx_it.h * @author MCD Application Team * @version V1.1.0 * @date 18-January-2013 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); #ifdef __cplusplus } #endif #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// // AppDelegate.h // BPActivityCollection // // Created by Haozhen Li on 15-2-25. // Copyright (c) 2015年 Refineit. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to Intel(R) MKL * LLt decomposition based on LAPACKE_?potrf function. ******************************************************************************** */ #ifndef EIGEN_LLT_MKL_H #define EIGEN_LLT_MKL_H #include "Eigen/src/Core/util/MKL_support.h" #include <iostream> namespace Eigen { namespace internal { template<typename Scalar> struct mkl_llt; #define EIGEN_MKL_LLT(EIGTYPE, MKLTYPE, MKLPREFIX) \ template<> struct mkl_llt<EIGTYPE> \ { \ template<typename MatrixType> \ static inline typename MatrixType::Index potrf(MatrixType& m, char uplo) \ { \ lapack_int matrix_order; \ lapack_int size, lda, info, StorageOrder; \ EIGTYPE* a; \ eigen_assert(m.rows()==m.cols()); \ /* Set up parameters for ?potrf */ \ size = m.rows(); \ StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \ matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ a = &(m.coeffRef(0,0)); \ lda = m.outerStride(); \ \ info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \ info = (info==0) ? Success : NumericalIssue; \ return info; \ } \ }; \ template<> struct llt_inplace<EIGTYPE, Lower> \ { \ template<typename MatrixType> \ static typename MatrixType::Index blocked(MatrixType& m) \ { \ return mkl_llt<EIGTYPE>::potrf(m, 'L'); \ } \ template<typename MatrixType, typename VectorType> \ static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \ }; \ template<> struct llt_inplace<EIGTYPE, Upper> \ { \ template<typename MatrixType> \ static typename MatrixType::Index blocked(MatrixType& m) \ { \ return mkl_llt<EIGTYPE>::potrf(m, 'U'); \ } \ template<typename MatrixType, typename VectorType> \ static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ { \ Transpose<MatrixType> matt(mat); \ return llt_inplace<EIGTYPE, Lower>::rankUpdate(matt, vec.conjugate(), sigma); \ } \ }; EIGEN_MKL_LLT(double, double, d) EIGEN_MKL_LLT(float, float, s) EIGEN_MKL_LLT(dcomplex, MKL_Complex16, z) EIGEN_MKL_LLT(scomplex, MKL_Complex8, c) } // end namespace internal } // end namespace Eigen #endif // EIGEN_LLT_MKL_H
#pragma once #include "world/core/WorldConfig.h" #include "VoxelGrid.h" namespace world { class WORLDAPI_EXPORT VoxelOps { public: VoxelOps() = delete; static void ball(VoxelField &voxels, const vec3d &origin, double radius, double value); static double getPixelDistance(const VoxelField &voxels); static vec3d voxelIdToSpace(const VoxelField &voxels, const vec3u &id); }; } // namespace world
#pragma once #include "gep/interfaces/subsystem.h" #include "gep/math3d/vec3.h" #include "gep/math3d/quaternion.h" #include "gep/weakPtr.h" #include "gep/interfaces/resourceManager.h" namespace gep { // forward declarations class ISoundLibrary; class ISound; class ISoundInstance; /// \brief the sound system interface class ISoundSystem : public ISubsystem { public: virtual ~ISoundSystem(){} virtual ResourcePtr<ISoundLibrary> loadLibrary(const char* filename) = 0; virtual void loadLibraryFromLua(const char* filename) =0; virtual ResourcePtr<ISound> getSound(const char* path) = 0; virtual void setListenerPosition(const vec3& pos) = 0; virtual void setListenerOrientation(const Quaternion& orientation) = 0; virtual void setListenerVelocity(const vec3& velocity) = 0; LUA_BIND_REFERENCE_TYPE_BEGIN LUA_BIND_FUNCTION_NAMED(loadLibraryFromLua, "loadLibrary") LUA_BIND_FUNCTION(setListenerPosition) LUA_BIND_FUNCTION(setListenerOrientation) LUA_BIND_REFERENCE_TYPE_END; }; /// \brief a library containing multiple sounds class ISoundLibrary : public IResource { public: virtual ~ISoundLibrary(){} }; /// \brief interface for a sound parameter class ISoundParameter : public WeakReferenced<ISoundParameter, WeakReferencedExport> { public: virtual ~ISoundParameter(){} virtual Result setValue(float value) = 0; virtual Result getValue(float* value) const = 0; }; /// \brief sound parameter /// can be placed on the stack or inside classes class SoundParameter : public WeakPtr<ISoundParameter, WeakReferencedExport> { public: SoundParameter(){} SoundParameter(ISoundParameter* pImpl) : WeakPtr(pImpl){} inline Result setValue(float value) { ISoundParameter* pImpl = get(); GEP_ASSERT(pImpl != nullptr, "instance does no longer exist"); return pImpl->setValue(value); } inline Result getValue(float* value) const { const ISoundParameter* pImpl = get(); GEP_ASSERT(pImpl != nullptr, "instance does no longer exist"); return pImpl->getValue(value); } }; /// \brief interface for a sound which holds audio data class ISound : public IResource { public: virtual ~ISound(){} virtual ResourcePtr<ISoundInstance> createInstance() = 0; }; /// \brief /// interface of a sound instance. Multiple sound instances can share the same audio data from a single sound. class ISoundInstance : public IResource { public: virtual ~ISoundInstance(){} virtual SoundParameter getParameter(const char* name) = 0; virtual void setPosition(const vec3& position) = 0; virtual void setOrientation(const Quaternion& orientation) = 0; virtual void setVelocity(const vec3& velocity) = 0; virtual void setVolume(float volume) = 0; virtual float getVolume() = 0; virtual void play() = 0; virtual void stop() = 0; virtual void setPaused(bool paused) = 0; virtual bool getPaused() = 0; }; }
// ==================================================================================== // // AGEIA PHYSX // // Content: Tool to read mesh data and cooking flags from cooked mesh file // // Comment: Works for convex and non-convex mesh files // // Author: Michael Sauter // // ==================================================================================== #ifndef COOKED_MESH_READER_H #define COOKED_MESH_READER_H enum CmMeshType { MT_INVALID_MESH = 0, MT_CONVEX_MESH = 1, MT_TRIANGLE_MESH = 2, }; class CmMeshData { public: CmMeshData(); ~CmMeshData(); unsigned int numVertices; // Number of vertices. unsigned int numTriangles; // Number of triangles. unsigned int pointStrideBytes; // Offset between vertex points in bytes. unsigned int triangleStrideBytes; // Offset between triangles in bytes. void* points; // Pointer to array of vertex positions. void* triangles; // Pointer to array of triangle inices. unsigned int flags; // Flags bits. unsigned int materialIndexStride; // Otherwise this is the offset between material indices in bytes. void* materialIndices; // Optional pointer to first material index, or NULL. unsigned int heightFieldVerticalAxis; // The mesh may represent either an arbitrary mesh or a height field. float heightFieldVerticalExtent; // If this mesh is a height field, this sets how far 'below ground' the height volume extends. float convexEdgeThreshold; // Parameter allows you to setup a tolerance for the convex edge detector. }; /** * * Extract mesh data from cooked mesh file * * @param file the cooked mesh file (full path) * @param mesh_type type of mesh in the file (convex or non-convex) * @param meshDesc structure to store extracted mesh data in * @param hintCollisionSpeed hint whether the cooked mesh was optimized for speed or for size * * @return true on success, otherwise false * */ bool GetCookedData(const char* file, CmMeshType& mesh_type, CmMeshData& meshDesc, bool& hintCollisionSpeed); #endif // COOKED_MESH_READER_H
// // Cauly.h // Cauly // // Created by Neil Kwon on 9/2/15. // Copyright (c) 2015 Cauly. All rights reserved. // #import <UIKit/UIKit.h> @interface Cauly : NSObject @end #define TEST_APP_CODE (@"CAULY") #define CAULY_SDK_VERSION (@"3.1.0") #define CAULY_ERR_SUCCESS (0) #define CAULY_ERR_FAILED (1) #define CAULY_ERR_INAVLID_XML (2) #define CAULY_ERR_INAVLID_JSON (3) // 광고 갱신 시간 typedef enum { CaulyReloadTime_30, // 30초 CaulyReloadTime_60, // 60초 CaulyReloadTime_120 // 120초 } CaulyReloadTime; // 광고 크기 typedef enum { CaulyAdSize_IPhone, // 320 * 50 CaulyAdSize_IPadLarge, // 728 * 90 CaulyAdSize_IPadSmall // 468 * 60 } CaulyAdSize; // Native Ad Component type typedef enum { CaulyNativeAdComponentType_None, //No Image nor Icon CaulyNativeAdComponentType_Icon, // Icon Only CaulyNativeAdComponentType_Image, // Image Only CaulyNativeAdComponentType_IconImage // Icon and Image Both } CaulyNativeAdComponentType; // 나이 설정 typedef enum { CaulyAge_10, // 10대 CaulyAge_20, // 20대 CaulyAge_30, // 30대 CaulyAge_40, // 40대 CaulyAge_50, // 50대 CaulyAge_All // 전체 } CaulyAge; // 성별 설정 typedef enum { CaulyGender_Male, // 남자 CaulyGender_Female, // 여자 CaulyGender_All // 전체 } CaulyGender; // 화면 전환 효과 typedef enum { CaulyAnimCurlUp, // Curl Up CaulyAnimCurlDown, // Curl Down CaulyAnimFlipFromLeft, // 뒤집기(Left->Right) CaulyAnimFlipFromRight, // 뒤집기(Right->Left) CaulyAnimFadeOut, // Fade Out CaulyAnimNone // 애니메이션 없음 } CaulyAnim; // Log 레벨 typedef enum { CaulyLogLevelMinimal, CaulyLogLevelRelease, CaulyLogLevelDebug, CaulyLogLevelAll } CaulyLogLevel; // Error Code #define CaulyError_OK (0) #define CaulyError_NO_CHARGED (100) #define CaulyError_NO_FILL_AD (200) #define CaulyError_INVAILD_APP_CODE (400) #define CaulyError_SERVER_ERROR (500) #define CaulyError_NOT_ALLOW_INTERVAL (-200) #define CaulyError_SDK_INNER_ERROR (-100)
#include "pila.h" #include <stdlib.h> /* Definición del struct pila proporcionado por la cátedra. */ struct pila { void** datos; size_t cantidad; // Cantidad de elementos almacenados. size_t capacidad; // Capacidad del arreglo 'datos'. }; /* ***************************************************************** * PRIMITIVAS DE LA PILA * *****************************************************************/ pila_t* pila_crear(void){ size_t tamanio=30; pila_t* pila = malloc(sizeof(pila_t)); if (pila == NULL){ return NULL; } pila->cantidad=0; pila->capacidad=tamanio; pila->datos = malloc(pila->capacidad * sizeof(void*)); if (pila->datos == NULL) { free(pila); return NULL; } return pila; } bool pila_redimensionar(pila_t *pila,size_t tamanio_nuevo) { void* datos_nuevo = realloc(pila->datos, tamanio_nuevo * sizeof(void*)); if (tamanio_nuevo > 0 && datos_nuevo == NULL) { return false; } pila->datos = datos_nuevo; pila->capacidad = tamanio_nuevo; return true; } void pila_destruir(pila_t *pila){ free(pila->datos); free(pila); } bool pila_esta_vacia(const pila_t *pila){ if (pila->cantidad > 0) return false; return true; } bool pila_apilar(pila_t *pila, void* valor){ if (pila->cantidad >= pila->capacidad) pila_redimensionar(pila,(pila->capacidad*2)); pila->datos[pila->cantidad]=valor; pila->cantidad++; return true; } void* pila_ver_tope(const pila_t *pila){ if (pila_esta_vacia(pila)) return NULL; return pila->datos[pila->cantidad-1]; } void* pila_desapilar(pila_t *pila){ if (pila_esta_vacia(pila)) return NULL; if (pila->cantidad <= (pila->capacidad/2)){ pila_redimensionar(pila,pila->capacidad/2); } pila->cantidad--; return pila->datos[pila->cantidad]; }
%% %% KDE4xHb - Bindings libraries for Harbour/xHarbour and KDE 4 %% %% Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com> %% $project=KDE4xHb $module=KDEUI $header $includes $beginSlotsClass $signal=|currentFontChanged( const QFont & font ) $endSlotsClass
#include "alignment_support.h" #include "needleman_wunsch.h" int match_Miss(char column_char_value, char row_char_value) { int match_value; match_value = (column_char_value == row_char_value) ? MATCH_SCORE : MISSMATCH_SCORE; return match_value; } int insideBand(int i , int j , int k){ if (-k <= (i - j) <= k) return 1;//true else return 0;//false } //M>N int insideBandMxN(int n,int m,int i , int j , int k){ if (n-m-k <= (i - j) <= k) return 1;//true else return 0;//false } void init_Kband(int values[255][255],char *secuence1, char *secuence2,int d, int k) { int i, j; for(i = 1; i <= k; i++) values[i][0] = -i*d; for(j = 1; j <= k; j++) values[0][j] = -j*d; } /*gap score d .asumme NXN * Imput: x, y leght n ,integer k * OUtPut: best score B ofglobal aligment at most k diagonals away from main diagonal * before call init_Kband(int values[255][255],char *secuence1, char *secuence2,int d, int k); */ int Kband(int n, int values[255][255], char *secuence1, char *secuence2, int d,int k) { int i, j, h; for(i = 1; i <= n; i++) { for (h = -k ; h < k; h++){ j = (i+h); if ( 1 <= j <= n ){ values[i][j] = values[i-1][j-1] + match_Miss(secuence1[j], secuence2[i]); if (insideBand(i-1 , j , k)) values[i][j] = max(values[i][j], values[i-1][j]-d); if (insideBand(i , j-1 , k)) values[i][j] = max(values[i][j], values[i][j-1]-d); }//insideband } } return values[n][n]; } /*gap score d .asumme MXN * Imput: x, y leght nxm ,integer k * OUtPut: best score B ofglobal aligment at most k diagonals away from main diagonal * before call init_Kband(int values[255][255],char *secuence1, char *secuence2,int d, int k); */ int KbandMxN(int m,int n, int values[255][255], char *secuence1, char *secuence2, int d,int k) { //M>N int i, j, h; for(i = 1; i <= n; i++) { for (h = -k ; h < k; h++){ j = (i+h); if ( 1 <= j <= n ){ values[i][j] = values[i-1][j-1] + match_Miss(secuence1[j], secuence2[i]); if (insideBandMxN(n,m,i-1 , j , k)) values[i][j] = max(values[i][j], values[i-1][j]-d); if (insideBandMxN(n,m,i , j-1 , k)) values[i][j] = max(values[i][j], values[i][j-1]-d); }//insideband } } return values[n][n]; } /*gap score d .asumme NXN * Imput: x, y leght n ,integer k samll number, M macth value y d gap penalty * OUtPut: best score B * before call init_Kband(int values[255][255],char *secuence1, char *secuence2,int d, int k); */ int KBandOptimal(int n, int values[255][255], char *secuence1, char *secuence2, int d,int k, int M){ int alfa; while(1==1){ alfa = Kband(n,values,secuence1,secuence2,d,k) ; if (alfa >= ((M *(n - k-1) ) - ((2 *(k+1))*d)) ) return alfa; k = 2*k; } return 0; } /*gap score d .asumme MxN * Imput: x, y leght n ,integer k samll number, M macth value y d gap penalty * OUtPut: best score B * before call init_Kband(int values[255][255],char *secuence1, char *secuence2,int d, int k); */ int KBandOptimalMxN(int m,int n, int values[255][255], char *secuence1, char *secuence2, int d,int k, int M){ int alfa; while(1==1){ alfa = KbandMxN(m,n,values,secuence1,secuence2,d,k) ; if (alfa >= ((M *(n - k-1) ) - ( ((2 *(k+1)) + (m-n))*d) ) ) return alfa; k = 2*k; } return 0; }
#if 0 // // Generated by Microsoft (R) D3D Shader Disassembler // // // fxc /nologo Raymarching.hlsl /Tvs_4_0 /Zi /Zpc /Qstrip_reflect // /Qstrip_debug /EVS_Main /FhRaymarching_VS_Main.h /VnRaymarching_VS_Main // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------ ------ // POSITION 0 xyzw 0 NONE float xyz // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------ ------ // SV_POSITION 0 xyzw 0 POS float xyzw // TEXCOORD 0 xy 1 NONE float xy // vs_4_0 dcl_constantbuffer cb0[8], immediateIndexed dcl_input v0.xyz dcl_input v1.xy dcl_output_siv o0.xyzw, position dcl_output o1.xy dcl_temps 2 mov r0.xyz, v0.xyzx mov r0.w, l(1.000000) dp4 r1.x, r0.xyzw, cb0[4].xyzw dp4 r1.y, r0.xyzw, cb0[5].xyzw dp4 r1.z, r0.xyzw, cb0[6].xyzw dp4 r1.w, r0.xyzw, cb0[7].xyzw dp4 o0.x, r1.xyzw, cb0[0].xyzw dp4 o0.y, r1.xyzw, cb0[1].xyzw dp4 o0.z, r1.xyzw, cb0[2].xyzw dp4 o0.w, r1.xyzw, cb0[3].xyzw mov o1.xy, v1.xyxx ret // Approximately 0 instruction slots used #endif const BYTE Raymarching_VS_Main[] = { 68, 88, 66, 67, 22, 249, 216, 230, 251, 91, 62, 64, 50, 58, 210, 98, 15, 87, 139, 31, 1, 0, 0, 0, 116, 2, 0, 0, 3, 0, 0, 0, 44, 0, 0, 0, 128, 0, 0, 0, 216, 0, 0, 0, 73, 83, 71, 78, 76, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 7, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 79, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 12, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, 68, 82, 148, 1, 0, 0, 64, 0, 1, 0, 101, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 8, 0, 0, 0, 95, 0, 0, 3, 114, 16, 16, 0, 0, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 1, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 54, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 17, 0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 17, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 5, 0, 0, 0, 17, 0, 0, 8, 66, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 6, 0, 0, 0, 17, 0, 0, 8, 130, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 7, 0, 0, 0, 17, 0, 0, 8, 18, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 8, 34, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 17, 0, 0, 8, 66, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 17, 0, 0, 8, 130, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 1, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 62, 0, 0, 1 };
// // WZC_DataModalParser.h // IXcodeTool // // Created by Symond on 14-4-24. // Copyright (c) 2014年 WZC. All rights reserved. // #import <Foundation/Foundation.h> @interface WZC_DataModalParser : NSObject { } /** * 获取WZC_DataModalParser实例对像 * * @return 返回WZC_DataModalParser实例对像 */ + (WZC_DataModalParser *)getInstance; /** * 通过指定的JSON数据,生成文件到指定路径 * * @param strJson 模板JSON数据 * @param strPath 生成文件的路径 * @param cn 生成的类的名字 * @param pcn 生成的类的父类的名字 * * @return 执行成功返回YES 否则NO */ - (BOOL)makeFileWithString:(NSString *)strJson writeToPath:(NSString *)strPath withClassName:(NSString *)cn withParentClassName:(NSString *)pcn; /** * 通过指定的JSON数据,生成文件到指定路径 * * @param strJson 模板JSON数据 * @param strPath 生成文件的路径 * @param cn 生成的类的名字 * @param pcn 生成的类的父类的名字 * * @return 执行成功返回YES 否则NO */ - (BOOL)makeSwiftFileWithString:(NSString *)strJson writeToPath:(NSString *)strPath withClassName:(NSString *)cn withParentClassName:(NSString *)pcn; - (BOOL)makeBaseFileToPath:(NSString *)strPath; @end
#include "fib.h" #include <time.h> #include <stdio.h> #include <ctype.h> /* Macros for printing colored outputs */ #define KRED "\x1B[31m" #define KGRN "\x1B[32m" #define KBLU "\x1B[34m" #define RESET "\033[0m" // int compare function for passing to qsort function int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int main (int argc, char *argv[]) { // Size of int to be tested unsigned int n = 100; // Checks if test should be ran with custom array size if (argc > 1) { int are_all_digits = 1; char *cp; for (cp = argv[1]; cp && *cp == ' '; ++cp) // Checks if char is not a digit if (!isdigit(*cp)) { are_all_digits = 0; break; } // Checks if all chars were digits if (are_all_digits) // Changes the n variable to first program arg sscanf(argv[1], "%u", &n); } // For mesuring algorithm execution time clock_t start, end; double cpu_time_used; // Sorts the second array using quick_sort function // Calculates execution time for quick_sort function start = clock(); unsigned long long nth_fib = fib(n); end = clock(); cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC; printf("%llu\n", nth_fib); printf(KBLU "Algorithm execution seconds: %lf\n" RESET, cpu_time_used); return 1; }
// // Catamount.h // Tuannv.Animal // // Created by VTIT on 9/10/13. // Copyright (c) 2013 VTIT. All rights reserved. // #import <Foundation/Foundation.h> @interface Catamount : NSObject @end
/* * ITG3200.h * * Created on: April 20, 2013 * Author: Ryler Hockenbury * * Library for ITG3200 3-channel gyroscope sensor * NOTE: Sensor is packaged with HMC5883L and ADXL345 * */ #ifndef ITG3200_h #define ITG3200_h #include "I2Cdev.h" #include <inttypes.h> #define ITG3200_ADDR_LOW 0x68 #define ITG3200_ADDR_HIGH 0x69 #define ITG3200_WHOAMI_REGADDR 0x00 // contains I2C address of ITG3205 #define ITG3200_SMPLRT_REGADDR 0x15 // configures OSR divider #define ITG3200_LPFCFG_REGADDR 0x16 // configures range and low pass filter #define ITG3200_TEMPH_REGADDR 0x1B // contains temperature data #define ITG3200_TEMPL_REGADDR 0x1C #define ITG3200_XOUTH_REGADDR 0x1D // contains X gyro data #define ITG3200_XOUTL_REGADDR 0x1E #define ITG3200_YOUTH_REGADDR 0x1F // contains Y gyro data #define ITG3200_YOUTL_REGADDR 0x20 #define ITG3200_ZOUTH_REGADDR 0x21 // contains Z gyro data #define ITG3200_ZOUTL_REGADDR 0x22 #define ITG3200_PWR_REGADDR 0x3E // configures reset, power modes, and // clock source #define ITG3200_FS_SEL 0x3 // full scale range +/- 2000 deg/sec #define ITG3200_DLPF_256 0x0 // low pass filter bandwidth options #define ITG3200_DLPF_188 0x1 #define ITG3200_DLPF_98 0x2 #define ITG3200_DLPF_42 0x3 #define ITG3200_DLPF_20 0x4 #define ITG3200_DLPF_10 0x5 #define ITG3200_DLPF_5 0x6 #define ITG3200_H_RESET_BIT 256 // power options #define ITG3200_SLEEP_BIT 128 #define ITG3200_STBY_XG_BIT 64 #define ITG3200_STBY_YG_BIT 32 #define ITG3200_STBY_ZG_BIT 16 #define ITG3200_CLK_SEL_INTERN 0x0 // clock options #define ITG3200_CLK_SEL_XGYRO 0x1 #define ITG3200_CLK_SEL_YGYRO 0x2 #define ITG3200_CLK_SEL_ZGRYO 0x3 #define ITG3200_SENSITIVITY 14.375 class ITG3200 { public: ITG3200(); bool init(); bool test(); uint8_t getID(); void setFullRange(); void setSampleRate(uint8_t rate_div); void setLPF(uint8_t LPF); void setClockSource(uint8_t source); void setOffset(); float getTemp(); void getRawData(); void getRate(float rate[]); private: uint8_t devAddr; uint8_t buffer[6]; float offset[3]; int16_t data[3]; bool gyroStatus; }; #endif /* ITG3200_h */
/* * $Id: OfferedDeadlineWatchdog.h 6898 2015-01-30 19:12:02Z mitza $ * * * Distributed under the OpenDDS License. * See: http://www.opendds.org/license.html */ #ifndef OPENDDS_OFFERED_DEADLINE_WATCHDOG_H #define OPENDDS_OFFERED_DEADLINE_WATCHDOG_H #include "dds/DdsDcpsPublicationC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "dds/DCPS/Watchdog.h" #include "dds/DCPS/PublicationInstance.h" #include "ace/Reverse_Lock_T.h" namespace OpenDDS { namespace DCPS { class DataWriterImpl; /** * @class OfferedDeadlineWatchdog * * @brief Watchdog responsible calling the @c DataWriterListener * when the deadline period expires. * * This watchdog object calls the * @c on_offered_deadline_missed() listener callback when the * configured finite deadline period expires. */ class OfferedDeadlineWatchdog : public Watchdog { public: typedef ACE_Recursive_Thread_Mutex lock_type; typedef ACE_Reverse_Lock<lock_type> reverse_lock_type; /// Constructor OfferedDeadlineWatchdog( lock_type & lock, DDS::DeadlineQosPolicy qos, OpenDDS::DCPS::DataWriterImpl * writer_impl, DDS::DataWriter_ptr writer, DDS::OfferedDeadlineMissedStatus & status, CORBA::Long & last_total_count); /// Destructor virtual ~OfferedDeadlineWatchdog(); /// Operation to be executed when the associated timer expires. /** * This @c Watchdog object updates the * @c DDS::OfferedDeadlineMissed structure, and calls * @c DataWriterListener::on_requested_deadline_missed(). */ virtual void execute(void const * act, bool timer_called); // Schedule timer for the supplied instance. void schedule_timer(PublicationInstance* instance); // Cancel timer for the supplied instance. void cancel_timer(PublicationInstance* instance); /// Re-schedule timer for all instances of the DataWriter. virtual void reschedule_deadline(); private: /// Lock for synchronization of @c status_ member. lock_type & status_lock_; /// Reverse lock used for releasing the @c status_lock_ listener upcall. reverse_lock_type reverse_status_lock_; /// Pointer to the @c DataWriterImpl object from which the /// @c DataWriterListener is obtained. OpenDDS::DCPS::DataWriterImpl * const writer_impl_; /// Reference to DataWriter passed to listener when the deadline /// expires. DDS::DataWriter_var writer_; /// Reference to the missed requested deadline status /// structure. DDS::OfferedDeadlineMissedStatus & status_; /// Last total_count when status was last checked. CORBA::Long & last_total_count_; }; } // namespace DCPS } // namespace OpenDDS #endif /* OPENDDS_OFFERED_DEADLINE_WATCHDOG_H */
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // @protocol UXBarPositioning <NSObject> @property(readonly, nonatomic) long long barPosition; @end
// // SVGContext.h // SVGgh // The MIT License (MIT) // Copyright (c) 2011-2014 Glenn R. Howes // 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. // // Created by Glenn Howes on 1/28/14. // #if defined(__has_feature) && __has_feature(modules) @import Foundation; @import UIKit; #else #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #endif NS_ASSUME_NONNULL_BEGIN /*! @brief a protocol followed to communicate state when walking through a tree of SVG objects, passed into nodes/leaves in that tree */ @protocol SVGContext /*! @brief makes a color for a given string found in such SVG attributes as fill, stroke, etc.. * @param svgColorString a string such as 'blue', '#AAA', '#A7A2F9' or 'rgb(122, 255, 0)' which can be mapped to an RGB color * @return a UIColor from the RGB color space * @see UIColorFromSVGColorString */ -(nullable UIColor*) colorForSVGColorString:(NSString*)svgColorString; /*! @brief make a URL relative to the document being parsed * @param subPath a location inside the app's resource bundle * @return an NSURL to some resource (hopefully) */ -(nullable NSURL*) relativeURL:(NSString*)subPath; /*! @brief make a URL * @param absolutePath a file path * @return an NSURL to some resource (hopefully) */ -(nullable NSURL*) absoluteURL:(NSString*)absolutePath; // sort of... /*! @brief find an object whose 'id' or maybe 'xml:id' property have the given name * @param objectName the name key to look for * @return some object (usually an id<GHRenderable> but not always */ -(nullable id) objectNamed:(NSString*)objectName; /*! @brief sometimes objects in SVG are referenced in the form 'URL(#aRef)'. This returns them. * @param aLocation some object in this document probably * @return some object (usually an id<GHRenderable> but not always */ -(nullable id) objectAtURL:(NSString*)aLocation; /*! @brief sometimes SVG colors are specified as 'currentColor'. This sets the starting currentColor before the tree is visited. Good for colorizing artwork. * @param startingCurrentColor a UIColor to start with */ -(void) setCurrentColor:(nullable UIColor*)startingCurrentColor; /*! @brief the value for 'currentColor' at this moment in the process of visiting a document */ -(nullable UIColor*) currentColor; /*! @brief the value for 'opacity' at this moment in the process of visiting a document */ -(CGFloat) opacity; /*! @brief opacity is dependent (via inheritence) as you descend an SVG Document. This opacity is the place to keep track of updated opacity. * @param opacity the current opacity (defaults to 1.0) */ -(void) setOpacity:(CGFloat)opacity; /*! @brief the active language expected by the user like 'en' or 'sp' or 'zh' */ -(nullable NSString*) isoLanguage; /*! @brief if the SVG document specifies a 'non-scaling-stroke' this could be used to scale that. Rarely used. */ -(CGFloat) explicitLineScaling; /*! @brief Does this SVGDocument/renderer have Cascading Style Sheet based attributes. Rarely true. */ -(BOOL) hasCSSAttributes; /*! @brief Look through the CSS attributes for a given styling attribute. * @param attributeName the name of the attribute like 'line-width' * @param listOfClasses the name of the CSS class like 'background' or some other arbitrary item * @param entityName the name of the entity like 'rect' or 'polyline' */ -(nullable NSString*) attributeNamed:(NSString*)attributeName classes:(nullable NSArray<NSString*>*)listOfClasses entityName:(nullable NSString*)entityName; @end NS_ASSUME_NONNULL_END
_SWIZZLE_DECL_(x,0) _SWIZZLE_DECL_(y,1) _SWIZZLE_DECL_(z,2) _SWIZZLE_DECL_(w,3) _SWIZZLE_DECL_(xy,0,1) _SWIZZLE_DECL_(yx,1,0) _SWIZZLE_DECL_(xz,0,2) _SWIZZLE_DECL_(zx,2,0) _SWIZZLE_DECL_(xw,0,3) _SWIZZLE_DECL_(wx,3,0) _SWIZZLE_DECL_(yz,1,2) _SWIZZLE_DECL_(zy,2,1) _SWIZZLE_DECL_(yw,1,3) _SWIZZLE_DECL_(wy,3,1) _SWIZZLE_DECL_(zw,2,3) _SWIZZLE_DECL_(wz,3,2) _SWIZZLE_DECL_(xyz,0,1,2) _SWIZZLE_DECL_(xzy,0,2,1) _SWIZZLE_DECL_(yxz,1,0,2) _SWIZZLE_DECL_(yzx,1,2,0) _SWIZZLE_DECL_(zxy,2,0,1) _SWIZZLE_DECL_(zyx,2,1,0) _SWIZZLE_DECL_(xyw,0,1,3) _SWIZZLE_DECL_(xwy,0,3,1) _SWIZZLE_DECL_(yxw,1,0,3) _SWIZZLE_DECL_(ywx,1,3,0) _SWIZZLE_DECL_(wxy,3,0,1) _SWIZZLE_DECL_(wyx,3,1,0) _SWIZZLE_DECL_(xzw,0,2,3) _SWIZZLE_DECL_(xwz,0,3,2) _SWIZZLE_DECL_(zxw,2,0,3) _SWIZZLE_DECL_(zwx,2,3,0) _SWIZZLE_DECL_(wxz,3,0,2) _SWIZZLE_DECL_(wzx,3,2,0) _SWIZZLE_DECL_(yzw,1,2,3) _SWIZZLE_DECL_(ywz,1,3,2) _SWIZZLE_DECL_(zyw,2,1,3) _SWIZZLE_DECL_(zwy,2,3,1) _SWIZZLE_DECL_(wyz,3,1,2) _SWIZZLE_DECL_(wzy,3,2,1) _SWIZZLE_DECL_(xywz,0,1,3,2) _SWIZZLE_DECL_(xzyw,0,2,1,3) _SWIZZLE_DECL_(xzwy,0,2,3,1) _SWIZZLE_DECL_(xwyz,0,3,1,2) _SWIZZLE_DECL_(xwzy,0,3,2,1) _SWIZZLE_DECL_(yxzw,1,0,2,3) _SWIZZLE_DECL_(yxwz,1,0,3,2) _SWIZZLE_DECL_(yzxw,1,2,0,3) _SWIZZLE_DECL_(yzwx,1,2,3,0) _SWIZZLE_DECL_(ywxz,1,3,0,2) _SWIZZLE_DECL_(ywzx,1,3,2,0) _SWIZZLE_DECL_(zxyw,2,0,1,3) _SWIZZLE_DECL_(zxwy,2,0,3,1) _SWIZZLE_DECL_(zyxw,2,1,0,3) _SWIZZLE_DECL_(zywx,2,1,3,0) _SWIZZLE_DECL_(zwxy,2,3,0,1) _SWIZZLE_DECL_(zwyx,2,3,1,0) _SWIZZLE_DECL_(wxyz,3,0,1,2) _SWIZZLE_DECL_(wxzy,3,0,2,1) _SWIZZLE_DECL_(wyxz,3,1,0,2) _SWIZZLE_DECL_(wyzx,3,1,2,0) _SWIZZLE_DECL_(wzxy,3,2,0,1) _SWIZZLE_DECL_(wzyx,3,2,1,0) _CONST_SWIZZLE_DECL_(xx, 0, 0) _CONST_SWIZZLE_DECL_(yy, 1, 1) _CONST_SWIZZLE_DECL_(zz, 2, 2) _CONST_SWIZZLE_DECL_(ww, 3, 3) _CONST_SWIZZLE_DECL_(xxyy, 0, 0, 1, 1) _CONST_SWIZZLE_DECL_(yyxx, 1, 1, 0, 0) _CONST_SWIZZLE_DECL_(yyzz, 1, 1, 2, 2) _CONST_SWIZZLE_DECL_(zzyy, 2, 2, 1, 1) _CONST_SWIZZLE_DECL_(zzxx, 2, 2, 0, 0) _CONST_SWIZZLE_DECL_(xxzz, 2, 2, 0, 0) _CONST_SWIZZLE_DECL_(zzww, 2, 2, 3, 3) _CONST_SWIZZLE_DECL_(wwzz, 3, 3, 2, 2)
/* * Copyright (c) 2014 Nicholas Trampe * * 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. * */ #import <UIKit/UIKit.h> @class PackController; @class IAPController; @class MoreCoinsViewController; @protocol MoreCoinsViewControllerDelegate <NSObject> - (void)moreCoinsViewControllerDidFinish:(MoreCoinsViewController *)sender; @end @interface MoreCoinsViewController : UIViewController { PackController * sharedPC; IAPController * sharedIAP; } @property (nonatomic, assign) NSObject <MoreCoinsViewControllerDelegate> * delegate; @property (nonatomic, retain) IBOutlet UIView * black; @property (nonatomic, retain) IBOutlet UILabel * lLoading; - (IBAction)donePressed:(id)sender; - (IBAction)get100Pressed:(id)sender; - (IBAction)get300Pressed:(id)sender; - (IBAction)get500Pressed:(id)sender; - (IBAction)restorePressed:(id)sender; - (void)addCoins:(unsigned int)aCoins; - (void)showBlack; - (void)hideBlack; @end
// // XMGNewViewController.h // ProblemSister // // Created by michael on 2016/10/2. // Copyright © 2016年 Michael. All rights reserved. // #import <UIKit/UIKit.h> @interface XMGNewViewController : UIViewController @end
/* ----------------------------------------------------------------------------- This source file is part of ogre-procedural For the latest info, see http://code.google.com/p/ogre-procedural/ Copyright (c) 2010-2013 Michael Broutin 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 __Sample_Primitives_h_ #define __Sample_Primitives_h_ #include "BaseApplication.h" using namespace Ogre; class Sample_Primitives : public BaseApplication { virtual bool frameStarted(const FrameEvent& evt); protected: virtual void createScene(void); virtual void createCamera(void); }; #endif
/** ****************************************************************************** * @file mqtt.h * $Author: ·Éºè̤ѩ $ * $Revision: 17 $ * $Date:: 2012-07-06 11:16:48 +0800 #$ * @brief MQTTÓ¦Óò㺯Êý. ****************************************************************************** * @attention * *<h3><center>&copy; Copyright 2009-2012, EmbedNet</center> *<center><a href="http:\\www.embed-net.com">http://www.embed-net.com</a></center> *<center>All Rights Reserved</center></h3> * ****************************************************************************** */ // Modified a lot by Anthony Lee <don.anthony.lee@gmail.com> 2016 #ifndef __USER_MQTT_H #define __USER_MQTT_H #include "mqtt-config.h" enum { MQTT_SUB_NONBLOCK_CONNECT = 0x01, MQTT_SUB_NONBLOCK_CONNACK = 0x02, MQTT_SUB_NONBLOCK_SUBSCRIBE = 0x04, MQTT_SUB_NONBLOCK_SUBACK = 0x08, MQTT_SUB_NONBLOCK_PINGREQ = 0x10, MQTT_SUB_NONBLOCK_PUBLISH = 0x20, MQTT_SUB_NONBLOCK_WAITTING_SEND_OK = 0x40, MQTT_SUB_NONBLOCK_INVALID = 0x80, }; // token typedef struct { int socket; unsigned int token; int last_packet_id; char stream[MQTT_STREAM_MAX_LENGTH]; int stream_pos; int stream_len; const char *client_id; const char *username; const char *password; } mqtt_connection_t; /** * @brief Ïò´úÀí£¨·þÎñÆ÷£©·¢ËÍÒ»¸öÏûÏ¢ * @param pCon Á¬½ÓÐÅÏ¢½á¹¹Ìå * @param pTopic ÏûÏ¢Ö÷Ìâ * @param pMessage ÏûÏ¢ÄÚÈÝ * @retval СÓÚ0±íʾ·¢ËÍʧ°Ü */ int mqtt_publish(mqtt_connection_t *pCon, char *pTopic, char *pMessage); /** * @brief Ïò´úÀí£¨·þÎñÆ÷£©·¢ËÍÒ»¸öÏûÏ¢ * @param pCon Á¬½ÓÐÅÏ¢½á¹¹Ìå * @param pTopic ÏûÏ¢Ö÷Ìâ * @param pMessage ÏûÏ¢ÄÚÈÝ * @param msglen ÏûÏ¢³¤¶È * @param connect ÊÇ·ñ·¢ËÍÁ¬½Ó/¶Ï¿ª±¨ÎÄ * @param timeout_ms ³¬Ê±ºÁÃëÊý * @retval СÓÚ0±íʾ·¢ËÍʧ°Ü * µ± timeout_ms Ϊ 0 ʱ£¬·µ»Ø 0 ±íʾÐèÔٴγ¢ÊÔ, ·µ»Ø -2 ±íʾÊý¾Ý°üÒѽøÈë·¢ËͶÓÁÐ */ int mqtt_publish_etc(mqtt_connection_t *pCon, char *pTopic, char *pMessage, int msglen, int connect, int timeout_ms); /** * @brief Ïò·þÎñÆ÷¶©ÔÄÒ»¸öÏûÏ¢£¬¸Ãº¯Êý»áÒòΪTCP½ÓÊÕÊý¾Ýº¯Êý¶ø×èÈû * @param pCon Á¬½ÓÐÅÏ¢½á¹¹Ìå * @param pTopic ÏûÏ¢Ö÷Ì⣬´«Èë * @param pMessage ÏûÏ¢ÄÚÈÝ£¬´«³ö * @retval СÓÚ0±íʾ¶©ÔÄÏûϢʧ°Ü */ int mqtt_subscrib(mqtt_connection_t *pCon, char *pTopic, char *pMessage); /** * @brief Ïò·þÎñÆ÷¶©ÔÄÏûÏ¢£¨·Ç×èÈû£© * @param pCon Á¬½ÓÐÅÏ¢½á¹¹Ìå * @param pTopic ÏûÏ¢Ö÷Ì⣬´«Èë * @param pMessage ÏûÏ¢ÄÚÈÝ£¬´«³ö * @param keep_connect 0±íʾȡµÃÏûÏ¢ºóÖÕÖ¹Á¬½Ó * @retval СÓÚ0±íʾ¶©ÔÄÏûϢʧ°Ü, 0±íʾÐèÔÙ´ÎÖØÊÔ, ´óÓÚ0±íʾÒÑÈ¡µÃÏûÏ¢²¢·µ»Ø³¤¶È */ int mqtt_subscribe_nonblock(mqtt_connection_t *pCon, char *pTopic, char *pMessage, int keep_connect); /** * @brief Óë·þÎñÆ÷±£³ÖÁ¬½Ó£¨·Ç×èÈû£© * @param pCon Á¬½ÓÐÅÏ¢½á¹¹Ìå * @retval ·Ç 0 ±íʾ³ö´í */ int mqtt_keep_connection_nonblock(mqtt_connection_t *pCon); #ifdef __IAR_SYSTEMS_ICC__ void MQTT_Subscribe_Test(const char *pTopic); #endif #endif /* __USER_MQTT_H */
// // MainViewController.h // AgeDistinguish // // Created by Mac on 16/6/27. // Copyright © 2016年 chenfengfeng. All rights reserved. // #import <UIKit/UIKit.h> @interface MainViewController : UIViewController @end
/** * @file glfw_buffered_mesh.h * @brief Defines GLFWBufferedMesh. */ #pragma once #include "std/ogle_std.inc" #include "renderer/buffered_mesh.h" namespace ogle { /** * @brief A BufferedMesh implementation for OpenGL, GLSL, and GLFW. */ class GLFWBufferedMesh : public BufferedMesh { public: /** * @brief Constructor. * @param mesh Mesh to prepare buffers for. */ explicit GLFWBufferedMesh(const Mesh& mesh); const VertexBuffer& vertices() const override; const TexCoordUVBuffer& uvs() const override; const NormalBuffer& normals() const override; const IndexBuffer& indices() const override; bool Create() override; protected: /// Vertex buffer. VertexBuffer vertices_; /// 2D texture coordinate buffer. TexCoordUVBuffer uvs_; /// Vertex normals. NormalBuffer normals_; /// Index buffer. IndexBuffer indices_; }; } // namespace ogle
#include <stdlib.h> // So, flex has an option %bison-bridge that gives the yylex function an // additional argument that is the union structure from bison. I'm not using // bison, so I need to do it's job with the YYSTYPE. I define the union in // union.h, but scan.h refers to it and so it must be defined before scan.h #define YYSTYPE attr_t #include "lemon.h" #include "union.h" #include "scan.h" #include "sglib.h" #include "tree.h" #include "semantic.h" #include "gencode.h" #include "symbol_table.h" /* lemon functions */ void *ParseAlloc(); void Parse(); void ParseFree(); extern int parseerr; // set if a parse error occurs int get_next_token(void *lexer, lexer_item *it) { it->type = yylex(&it->attr, lexer); return it->type; } tree_t *root = NULL; tree_t * parse(FILE *f) { void *lexer; yylex_init(&lexer); void *parser = ParseAlloc(malloc); yyset_in(f, lexer); lexer_item val; while (get_next_token(lexer, &val)) { //lexer_item_print(val); Parse(parser, val.type, val, &root); } Parse(parser, 0, val, &root); ParseFree(parser, free); return root; } int main(int argc, char **argv) { errno = 0; FILE *in = stdin; if (argc > 1) { FILE *a = fopen(argv[1], "r"); if (NULL != a) { in = a; } } tree_t * t = parse(in); if (parseerr) { fprintf(stderr, "Fix parse errors to get more errors\n"); return -1; } //print_tree(t); char *builtins[] = {"read", "write"}; symbol_table *table = create_symbol_table(root, builtins, 2); print_tree(t); //print_symbol_table(table); char *check = check_semantics(t, table); if (!check) { gencode(t, "a.out"); } else { fprintf(stderr, "Did not pass semantic checking: %s\n", check); } }
// // FirstViewController.h // CommandCenter // // Created by Evan Wu on 2014/6/11. // Copyright (c) 2014年 Evan Wu. All rights reserved. // #import <UIKit/UIKit.h> #import "BarcodeView.h" @interface ScanViewController : UIViewController <ReceiveCommandHandler, NotificationHandler> @property (nonatomic, assign) IBOutlet UILabel *batteryLabel; @property (nonatomic, assign) IBOutlet UIImageView *connectLight; @property (nonatomic, assign) IBOutlet UIImageView *batteryImageView; @property (nonatomic, assign) IBOutlet UIImageView *transparentImageView; @property (nonatomic, assign) IBOutlet UIView *vibrateView; @property (nonatomic, assign) IBOutlet UIButton *vibrateButton; @property (nonatomic, assign) IBOutlet UIButton *scanButton; @property (nonatomic, strong) IBOutlet BarcodeView *barcodeView; - (IBAction)toggleButton:(id)sender; - (IBAction)vibrateChange:(id)sender; - (IBAction)vibrate0Clcik:(id)sender; - (IBAction)vibrate1Clcik:(id)sender; - (IBAction)vibrate2Clcik:(id)sender; - (IBAction)vibrate3Clcik:(id)sender; - (void)setBlock:(void(^) (NSString * barcode))block; @end
// // CameraPreViewController.h // ObjectRecognition // // Created by stefan on 11/4/14. // Copyright (c) 2014 Silviu Ojog. All rights reserved. // #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> #import "ECSlidingViewController.h" @interface CameraPreViewController : UIViewController <UIGestureRecognizerDelegate> @property (nonatomic, retain) AVCaptureSession *captureSession; @property (nonatomic, retain) AVCaptureVideoPreviewLayer *previewLayer; @end
// // UTStateViewFactoryProtocol // State View Manager // // Created by Paul Taykalo on 7/17/13. // Copyright (c) 2012 Stanfy LLC. All rights reserved. // #import <Foundation/Foundation.h> typedef NS_ENUM(NSUInteger , UTViewState) { UTStateViewStateBase, UTStateViewStateLoading, UTStateViewStateNoData, UTStateViewStateError }; /* View factory */ @protocol UTStateViewFactoryProtocol<NSObject> - (UIView *)viewForState:(UTViewState)state; - (UIView *)viewForState:(UTViewState)state error:(NSError *)error; @end
#import "MOBProjection.h" @interface MOBProjectionEPSG4815 : MOBProjection @end
/* ** $Id: lundump.h,v 1.45.1.1 2017/04/19 17:20:42 roberto Exp $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ #ifndef lundump_h #define lundump_h #include "llimits.h" #include "lobject.h" #include "lzio.h" /* data to catch conversion errors */ #define LUAC_DATA "\x19\x93\r\n\x1a\n" #define LUAC_INT 0x5678 #define LUAC_NUM cast_num(370.5) #define MYINT(s) (s[0]-'0') #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) #define LUAC_FORMAT 0 /* this is the official format */ /* load one chunk; from lundump.c */ LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); /* dump one chunk; from ldump.c */ LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); #endif
// // AppDelegate.h // Bluegogo // // Created by 袁杰 on 2017/6/4. // Copyright © 2017年 VIPLimited. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // DataVersion.h // genera // // Created by Simon Sherrin on 8/01/12. /* Copyright (c) 2011 Museum Victoria 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. */ // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @interface DataVersion : NSManagedObject @property (nonatomic, retain) NSString * versionID; @end
// // MCAppDelegate.h // TestCoreData // // Created by CocoaBob on 24/04/2014. // Copyright (c) 2014 CocoaBob. All rights reserved. // #import <UIKit/UIKit.h> @interface MCAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // try.c // JW Broadcasting // // Created by Austin Zelenka on 11/22/15. // Copyright © 2015 xquared. All rights reserved. // #include "try.h"
// // HAlertView.h // HarryAlertView // // Created by Harry on 14-10-16. // Copyright (c) 2014年 Harry. All rights reserved. // #import <UIKit/UIKit.h> #define Main_Size ([[UIScreen mainScreen] bounds].size) #define HAV_Init_X 18 #define default_cornerRadius 6 #define default_duration 0.3 #define default_line_color [UIColor colorWithRed:220/255.0 green:220/255.0 blue:220/255.0 alpha:1] typedef void (^ animtionTap)(BOOL finished); typedef void (^ buttonTap)(NSInteger tag); typedef NS_ENUM(NSInteger, HAlertView_Type){ HAlertView_Cannel = 0, HAlertView_Sure, }; @interface HAlertView : UIView @property (nonatomic, copy) buttonTap handleButton; - (void)alertViewShow; - (void)alertViewShowWithAnimation:(CGFloat)duration; - (void)alertViewShowWithAnimation:(CGFloat)duration completion:(animtionTap)handleAnimation; - (void)alertViewHide; - (void)alertViewHideWithAnimation:(CGFloat)duration; - (void)alertViewHideWithAnimation:(CGFloat)duration completion:(animtionTap)handleAnimation; @end @interface UIView (Harry) - (CGFloat)bottom; - (CGFloat)right; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "CDStructures.h" #import <IDEKit/IDEDistributionStepViewController.h> @class NSLayoutConstraint; @interface IDEDistributionManifestStepViewController : IDEDistributionStepViewController { NSLayoutConstraint *_centeredViewHeightConstraint; } + (id)keyPathsForValuesAffectingCanGoNext; + (BOOL)skipStepForContext:(id)arg1 assistantDirection:(int)arg2; @property __weak NSLayoutConstraint *centeredViewHeightConstraint; // @synthesize centeredViewHeightConstraint=_centeredViewHeightConstraint; - (void)learnMore:(id)arg1; - (BOOL)canGoNext; - (id)nextButtonTitle; - (id)title; - (void)viewDidLoad; @end
// // DateRangePickerViewController.h // SLexUtil // // Created by Robert Saccone on 9/10/12. // Copyright (c) 2017 Robert Saccone. All rights reserved. // #import <UIKit/UIKit.h> @class DateRangePickerViewController; @protocol DateRangePickerViewControllerDelegate <NSObject> - (void)dateRangePickerViewControllerReadyToBeDismissed:(DateRangePickerViewController *)viewController; @end @interface DateRangePickerViewController : UIViewController - (id)initWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate dateRangeStart:(NSDate *)dateRangeStart dateRangeEnd:(NSDate *)dateRangeEnd; - (IBAction)cancel:(id)sender; - (IBAction)done:(id)sender; @property(nonatomic, weak) IBOutlet UIDatePicker *startDatePicker; @property(nonatomic, weak) IBOutlet UIDatePicker *endDatePicker; @property(nonatomic, strong) NSDate *startDatePicked; @property(nonatomic, strong) NSDate *endDatePicked; @property(nonatomic, weak) id<DateRangePickerViewControllerDelegate> delegate; @property(nonatomic, readonly, assign) BOOL canceled; @end
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd 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. */ #import <AppKit/NSImageRep.h> #import <ApplicationServices/ApplicationServices.h> @interface NSPDFImageRep : NSImageRep { NSData *_pdf; int _currentPage; CGPDFDocumentRef _document; } -initWithData:(NSData *)data; +(NSArray *)imageRepsWithData:(NSData *)data; +imageRepWithData:(NSData *)data; -(NSData *)PDFRepresentation; -(int)pageCount; -(int)currentPage; -(void)setCurrentPage:(int)page; @end
#ifndef TRMAIN_H #define TRMAIN_H #include <QMainWindow> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> #include <sys/select.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <linux/ip.h> #include <linux/icmp.h> #include <string.h> #include <unistd.h> #include <assert.h> #include <fcntl.h> #include <string> #include <vector> namespace Ui { class trMain; } class trMain : public QMainWindow { Q_OBJECT public: explicit trMain(QWidget *parent = 0); ~trMain(); void init(); void showError(int err); private slots: void on_traceButton_clicked(); void on_packetList_clicked(const QModelIndex &index); private: Ui::trMain *ui; }; #endif // TRMAIN_H
#include "CascadeClassifier.h" #ifndef __FF_CASCADECLASSIFIERBINDINGS_H_ #define __FF_CASCADECLASSIFIERBINDINGS_H_ namespace CascadeClassifierBindings { struct NewWorker : CatchCvExceptionWorker { public: std::string xmlFilePath; bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) { return FF::StringConverter::arg(0, &xmlFilePath, info); } std::string executeCatchCvExceptionWorker() { return ""; } }; struct DetectMultiScaleWorker : CatchCvExceptionWorker { public: cv::CascadeClassifier classifier; bool isGpu; DetectMultiScaleWorker(cv::CascadeClassifier classifier, bool isGpu = false) { this->classifier = classifier; this->isGpu = isGpu; } cv::Mat img; double scaleFactor = 1.1; uint minNeighbors = 3; uint flags = 0; cv::Size2d minSize; cv::Size2d maxSize; std::vector<cv::Rect> objectRects; std::vector<int> numDetections; std::string executeCatchCvExceptionWorker() { if (isGpu) { cv::UMat oclMat = img.getUMat(cv::ACCESS_READ); classifier.detectMultiScale(oclMat, objectRects, scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize); } else { classifier.detectMultiScale(img, objectRects, numDetections, scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize); } return ""; } v8::Local<v8::Value> getReturnValue() { if (isGpu) { return Rect::ArrayWithCastConverter<cv::Rect>::wrap(objectRects); } else { v8::Local<v8::Object> ret = Nan::New<v8::Object>(); Nan::Set(ret, FF::newString("objects"), Rect::ArrayWithCastConverter<cv::Rect>::wrap(objectRects)); Nan::Set(ret, FF::newString("numDetections"), FF::IntArrayConverter::wrap(numDetections)); return ret; } } bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) { return Mat::Converter::arg(0, &img, info); } bool unwrapOptionalArgs(Nan::NAN_METHOD_ARGS_TYPE info) { return ( FF::DoubleConverter::optArg(1, &scaleFactor, info) || FF::UintConverter::optArg(2, &minNeighbors, info) || FF::UintConverter::optArg(3, &flags, info) || Size::Converter::optArg(4, &minSize, info) || Size::Converter::optArg(5, &maxSize, info) ); } bool hasOptArgsObject(Nan::NAN_METHOD_ARGS_TYPE info) { return FF::isArgObject(info, 1); } bool unwrapOptionalArgsFromOpts(Nan::NAN_METHOD_ARGS_TYPE info) { v8::Local<v8::Object> opts = info[1]->ToObject(Nan::GetCurrentContext()).ToLocalChecked(); return ( FF::DoubleConverter::optProp(&scaleFactor, "scaleFactor", opts) || FF::UintConverter::optProp(&minNeighbors, "minNeighbors", opts) || FF::UintConverter::optProp(&flags, "flags", opts) || Size::Converter::optProp(&minSize, "minSize", opts) || Size::Converter::optProp(&maxSize, "maxSize", opts) ); } }; struct DetectMultiScaleWithRejectLevelsWorker : public DetectMultiScaleWorker { public: DetectMultiScaleWithRejectLevelsWorker(cv::CascadeClassifier classifier, bool isGpu = false) : DetectMultiScaleWorker(classifier, isGpu) {} std::vector<int> rejectLevels; std::vector<double> levelWeights; std::string executeCatchCvExceptionWorker() { if (isGpu) { cv::UMat oclMat = img.getUMat(cv::ACCESS_READ); classifier.detectMultiScale(oclMat, objectRects, rejectLevels, levelWeights, scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize, true); } else { classifier.detectMultiScale(img, objectRects, rejectLevels, levelWeights, scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize, true); } return ""; } v8::Local<v8::Value> getReturnValue() { v8::Local<v8::Object> ret = Nan::New<v8::Object>(); Nan::Set(ret, FF::newString("objects"), Rect::ArrayWithCastConverter<cv::Rect>::wrap(objectRects)); Nan::Set(ret, FF::newString("rejectLevels"), FF::IntArrayConverter::wrap(rejectLevels)); Nan::Set(ret, FF::newString("levelWeights"), FF::DoubleArrayConverter::wrap(levelWeights)); return ret; } }; } #endif
/* Copyright (C) 2004 loveyou12300liumao@163.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef HHUO_HH_TPREQUEST_H #define HHUO_HH_TPREQUEST_H #include <map> #include <deque> #include <vector> #include <sstream> #include "../HH_Common.h" #include "../HH_Log.h" #include "HH_Msg.h" namespace hhou { /** * websocket请求 */ enum TCP_STATUS { TCP_OK = 0, /// 接收完整 TCP_ERROR /// 数据出错 }; /** * tcpconnection的处理类 * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-------+-------------------------------------------+ * |F|R|R|R| opcode | | * |I|S|S|S| (4) | | * |N|V|V|V| | ID(32) | * | |1|2|3| | | * +-+-+-+-+-------+---------------+ - - - - - - - - - - - - - - - + * | | | Extended payload length | * |ID(continue) |Payload len(8) | (16/64) | * | | | (if payload len==253/254) | * +---------------+---------------+ - - - - - - - - - - - - - - - + * | Extended payload length continued, if payload len == 254 | * + - - - - - - - - - - - - - - - +-------------------------------+ * | | Payload Data | * +-------------------------------+ - - - - - - - - - - - - - - - + * : Payload Data continued ... : * + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * | Payload Data continued ... | * +---------------------------------------------------------------+ * FIN:包是否结束 * RSV:为保留位 * opcode:操作码(0,15保留,1:connect,2:chat,3:ping,4:close,5....diy) * ID: 消息的ID号(服务端需带回) * Payload len:包体的内容长度 */ class HHTpRequest { friend class HHParse; typedef map<string, string>::iterator ReqIter; typedef map<string, string>::const_iterator ReqCIter; public: /** * 构造函数 */ HHTpRequest(); virtual ~HHTpRequest() {} /** * 解析 */ int Parse(const char *szHttpReq, int nDataLen); /** * 建立状态 */ bool Status() {return m_bConntected;} /** * 设置状态 */ void SetStatus(bool bStatus) {m_bConntected = bStatus;} private: bool m_bConntected; /// tcp的状态 deque<shared_ptr<HHMsg>> m_ReadMsg; /// 消息队列 }; } #endif //HHUO_HH_TPREQUEST_H
/* [1] code from: Cheney, Nick, Robert MacCurdy, Jeff Clune, and Hod Lipson. "Unshackling evolution: evolving soft robots with multiple materials and a powerful generative encoding." In Proceeding of the fifteenth annual conference on Genetic and evolutionary computation conference, pp. 167-174. ACM, 2013. */ #ifndef HCUBE_SOFTBOTSCPPNNEAT_H_INCLUDED #define HCUBE_SOFTBOTSCPPNNEAT_H_INCLUDED #include "HCUBE_Experiment.h" #include "Array3D.h" #include "opencv2/opencv.hpp" #include "opencv2/core/core.hpp" #include "NEAT_GeneticIndividualBehavior.h" #include "HCUBE_Defines.h" #include "VoxBotCreator.h" #include <string> #include <iostream> #include <ctime> namespace HCUBE { struct IndividualData { double Fitness; double OrFitness; NEAT::GeneticIndividualBehavior Behavior; unsigned int BehaviorType; bool hasValidBehavior; }; class SoftBotExperiment : public Experiment { protected: unsigned int num_x_voxels; unsigned int num_y_voxels; unsigned int num_z_voxels; unsigned int num_materials; unsigned int numConnections; unsigned int fitnessType; unsigned int fitnessPenaltyType; unsigned int fitnessPenaltyExp; unsigned int behaviorType; bool symmetryInputs; bool progressSimulationInfo; double behaviorRecordInterval; double behaviorRecordStartInterval; bool allBehaviors; bool evolveMaterials; int voxSimAllBehaviors; double bestFit; string outDir; float readVfo(std::string filename); map<std::string, IndividualData > IndividualLookUpTable; void processEvaluation(shared_ptr<NEAT::GeneticIndividual> individual, string individualID, int genNum, double &bestFit); double mapXYvalToNormalizedGridCoord(const int & r_xyVal, const int & r_numVoxelsXorY); void readVfo(std::string filename, bool &valid, double &fitness, double &penalty, NEAT::GeneticIndividualBehavior &behavior); void writeVoxFile(shared_ptr<NEAT::GeneticIndividual> individual, string individualID, CArray3Df ContinuousArray, vector<CArray3Df> ContinuousArrayMaterial); void writeVoxFile(shared_ptr<NEAT::GeneticIndividual> individual, string individualID, CArray3Df ContinuousArray, vector<CArray3Df> ContinuousArrayMaterial, float MaterialsCTE[], float MaterialsDensity[], float MaterialsTempPhase[], float MaterialsPoissons[]); std::string ReadMd5sum(); vector<int> createArrayForVoxSim(CArray3Df ContinuousArray,vector<CArray3Df> ContinuousArrayMaterial); void createDirTimeStamp(); // [1] CArray3Df makeOneShapeOnly(CArray3Df ArrayForVoxelyze); // [1] int leftExists(CArray3Df ArrayForVoxelyze, int currentPosition); // [1] int rightExists(CArray3Df ArrayForVoxelyze, int currentPosition); // [1] int forwardExists(CArray3Df ArrayForVoxelyze, int currentPosition); // [1] int backExists(CArray3Df ArrayForVoxelyze, int currentPosition); // [1] int upExists(CArray3Df ArrayForVoxelyze, int currentPosition); // [1] int downExists(CArray3Df ArrayForVoxelyze, int currentPosition); // [1] pair< queue<int>, list<int> > circleOnce(CArray3Df ArrayForVoxelyze, queue<int> queueToCheck, list<int> alreadyChecked); public: SoftBotExperiment(string _experimentName,int _threadID); virtual ~SoftBotExperiment() {} virtual NEAT::GeneticPopulation* createInitialPopulation(int populationSize); virtual void processGroup(shared_ptr<NEAT::GeneticGeneration> generation); virtual void processIndividualPostHoc(shared_ptr<NEAT::GeneticIndividual> individual); virtual bool performUserEvaluations() { return false; } virtual inline bool isDisplayGenerationResult() { return displayGenerationResult; } virtual inline void setDisplayGenerationResult(bool _displayGenerationResult) { displayGenerationResult=_displayGenerationResult; } virtual inline void toggleDisplayGenerationResult() { displayGenerationResult=!displayGenerationResult; } virtual Experiment* clone(); virtual void resetGenerationData(shared_ptr<NEAT::GeneticGeneration> generation) {} virtual void addGenerationData(shared_ptr<NEAT::GeneticGeneration> generation,shared_ptr<NEAT::GeneticIndividual> individual) {} }; } #endif // HCUBE_SOFTBOTS-CPPN-NEAT_H_INCLUDED
/* 2014, Copyright © Intel Coporation, license MIT, see COPYING file */ #pragma once int unzip (const char *targetdir, const char *zipfile);
/*#include "datatypes.h"*/ /*#include "status.h"*/ /*uint8_t set_status(struct _status_state state){*/ /*if(global_status->latch == 0){*/ /*_reset_status_leds(global_status->led_state);*/ /*global_status = &state; */ /*_set_status_leds(global_status->led_state);*/ /*return 1;*/ /*}*/ /*else{*/ /*return 0;*/ /*}*/ /*}*/ /*void _reset_status_leds(struct _status_led_state state){*/ /*}*/ /*void _set_status_leds(struct _status_led_state state){*/ /*switch(state){*/ /*case NONE:*/ /*break;*/ /*}*/ /*}*/
/* * BkZOO! * * Copyright 2011-2017 yoichibeer. * Released under the MIT license. */ #ifndef BKZ_CONFIG_CONFIGFACTORY_H #define BKZ_CONFIG_CONFIGFACTORY_H #include "Config.h" #include <Windows.h> #include <vector> #include <memory> #include "defs.h" namespace bkzoo { namespace config { class ConfigFactory final { public: static std::unique_ptr<Config> ConfigFactory::create( const config::General& general, const SiteMap& presetSites, const SiteVector& sites ); private: ConfigFactory() = default; ~ConfigFactory() = default; DISALLOW_COPY_AND_ASSIGN(ConfigFactory); }; } } #endif // BKZ_CONFIG_CONFIGFACTORY_H
#include "dbd_mysql.h" int dbd_mysql_statement_create(lua_State *L, connection_t *conn, const char *sql_query); /* * connection,err = DBD.MySQl.New(dbname, user, password, host, port) */ static int connection_new(lua_State *L) { int n = lua_gettop(L); connection_t *conn = NULL; const char *host = NULL; const char *user = NULL; const char *password = NULL; const char *db = NULL; int port = 0; const char *unix_socket = NULL; /* TODO always NULL */ int client_flag = 0; /* TODO always 0, set flags from options table */ /* db, user, password, host, port */ switch (n) { case 5: if (lua_isnil(L, 5) == 0) port = luaL_checkint(L, 5); case 4: if (lua_isnil(L, 4) == 0) host = luaL_checkstring(L, 4); case 3: if (lua_isnil(L, 3) == 0) password = luaL_checkstring(L, 3); case 2: if (lua_isnil(L, 2) == 0) user = luaL_checkstring(L, 2); case 1: /* * db is the only mandatory parameter */ db = luaL_checkstring(L, 1); } conn = (connection_t *)lua_newuserdata(L, sizeof(connection_t)); conn->mysql = mysql_init(NULL); if (!mysql_real_connect(conn->mysql, host, user, password, db, port, unix_socket, client_flag)) { lua_pushnil(L); lua_pushfstring(L, DBI_ERR_CONNECTION_FAILED, mysql_error(conn->mysql)); return 2; } /* * by default turn off autocommit */ mysql_autocommit(conn->mysql, 0); luaL_getmetatable(L, DBD_MYSQL_CONNECTION); lua_setmetatable(L, -2); return 1; } /* * success = connection:autocommit(on) */ static int connection_autocommit(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); int on = lua_toboolean(L, 2); int err = 0; if (conn->mysql) { err = mysql_autocommit(conn->mysql, on); } lua_pushboolean(L, !err); return 1; } /* * success = connection:close() */ static int connection_close(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); int disconnect = 0; if (conn->mysql) { mysql_close(conn->mysql); disconnect = 1; conn->mysql = NULL; } lua_pushboolean(L, disconnect); return 1; } /* * success = connection:commit() */ static int connection_commit(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); int err = 0; if (conn->mysql) { err = mysql_commit(conn->mysql); } lua_pushboolean(L, !err); return 1; } /* * ok = connection:ping() */ static int connection_ping(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); int err = 1; if (conn->mysql) { err = mysql_ping(conn->mysql); } lua_pushboolean(L, !err); return 1; } /* * statement,err = connection:prepare(sql_string) */ static int connection_prepare(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); if (conn->mysql) { return dbd_mysql_statement_create(L, conn, luaL_checkstring(L, 2)); } lua_pushnil(L); lua_pushstring(L, DBI_ERR_DB_UNAVAILABLE); return 2; } /* * quoted = connection:quote(str) */ static int connection_quote(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); size_t len; const char *from = luaL_checklstring(L, 2, &len); char *to = (char *)calloc(len*2+1, sizeof(char)); int quoted_len; if (!conn->mysql) { luaL_error(L, DBI_ERR_DB_UNAVAILABLE); } quoted_len = mysql_real_escape_string(conn->mysql, to, from, len); lua_pushlstring(L, to, quoted_len); free(to); return 1; } /* * success = connection:rollback() */ static int connection_rollback(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); int err = 0; if (conn->mysql) { err = mysql_rollback(conn->mysql); } lua_pushboolean(L, !err); return 1; } /* * insert_id = conn:insert_id() */ static int connection_insert_id(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); if (conn->mysql) { lua_pushnumber(L, mysql_insert_id(conn->mysql)); return 1; } lua_pushnumber(L, -1); return 1; } /* * __gc */ static int connection_gc(lua_State *L) { /* always close the connection */ connection_close(L); return 0; } /* * __tostring */ static int connection_tostring(lua_State *L) { connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_MYSQL_CONNECTION); lua_pushfstring(L, "%s: %p", DBD_MYSQL_CONNECTION, conn); return 1; } int dbd_mysql_connection(lua_State *L) { static const luaL_Reg connection_methods[] = { {"autocommit", connection_autocommit}, {"close", connection_close}, {"commit", connection_commit}, {"ping", connection_ping}, {"prepare", connection_prepare}, {"quote", connection_quote}, {"insert_id", connection_insert_id}, {"rollback", connection_rollback}, {NULL, NULL} }; static const luaL_Reg connection_class_methods[] = { {"New", connection_new}, {NULL, NULL} }; luaL_newmetatable(L, DBD_MYSQL_CONNECTION); luaL_register(L, 0, connection_methods); lua_pushvalue(L,-1); lua_setfield(L, -2, "__index"); lua_pushcfunction(L, connection_gc); lua_setfield(L, -2, "__gc"); lua_pushcfunction(L, connection_tostring); lua_setfield(L, -2, "__tostring"); luaL_register(L, DBD_MYSQL_CONNECTION, connection_class_methods); return 1; }
#ifndef _LPMS_LOGGING_H_ #define _LPMS_LOGGING_H_ // LOGGING MACROS #define LPMS_ERR(label, msg) {\ char errstr[AV_ERROR_MAX_STRING_SIZE] = {0}; \ if (!ret) ret = AVERROR(EINVAL); \ if (ret <-1) av_strerror(ret, errstr, sizeof errstr); \ av_log(NULL, AV_LOG_ERROR, "ERROR: %s:%d] %s : %s\n", __FILE__, __LINE__, msg, errstr); \ goto label; \ } #define LPMS_WARN(msg) {\ av_log(NULL, AV_LOG_WARNING, "WARNING: %s:%d] %s\n", __FILE__, __LINE__, msg); \ } #define LPMS_INFO(msg) {\ av_log(NULL, AV_LOG_INFO, "%s:%d] %s\n", __FILE__, __LINE__, msg); \ } #define LPMS_DEBUG(msg) {\ av_log(NULL, AV_LOG_DEBUG, "%s:%d] %s\n", __FILE__, __LINE__, msg); \ } #endif // _LPMS_LOGGING_H_
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" #import "AVAsynchronousKeyValueLoading-Protocol.h" #import "NSCopying-Protocol.h" @class AVAssetInternal; @interface AVAsset : NSObject <NSCopying, AVAsynchronousKeyValueLoading> { AVAssetInternal *_assetInternal; } + (id)assetWithURL:(id)arg1 figPlaybackItem:(struct OpaqueFigPlaybackItem *)arg2 trackIDs:(id)arg3 dynamicBehavior:(_Bool)arg4; + (id)assetWithURL:(id)arg1; - (_Bool)isCompatibleWithSavedPhotosAlbum; - (_Bool)isComposable; - (_Bool)isReadable; - (_Bool)isExportable; - (_Bool)isPlayable; - (_Bool)hasProtectedContent; - (void)_serverHasDied; - (id)compatibleTrackForCompositionTrack:(id)arg1; - (id)tracksWithMediaCharacteristics:(id)arg1; - (id)tracksWithMediaCharacteristic:(id)arg1; - (id)tracksWithMediaType:(id)arg1; - (id)trackWithTrackID:(int)arg1; - (void)_tracksDidChange; - (id)tracks; - (id)metadata; - (id)metadataForFormat:(id)arg1; - (id)availableMetadataFormats; - (id)commonMetadata; - (id)lyrics; - (id)creationDate; - (id)trackReferences; - (id)mediaSelectionGroupForMediaCharacteristic:(id)arg1; - (id)availableMediaCharacteristicsWithMediaSelectionOptions; - (id)mediaSelectionGroups; - (id)alternateTrackGroups; - (id)subtitleAlternatesTrackGroup; - (id)audioAlternatesTrackGroup; - (id)_firstTrackGroupWithMediaType:(id)arg1; - (id)trackGroups; - (unsigned long long)referenceRestrictions; - (_Bool)providesPreciseDurationAndTiming; - (int)naturalTimeScale; @property(readonly, nonatomic) struct CGSize naturalSize; @property(readonly, nonatomic) struct CGAffineTransform preferredTransform; - (float)preferredSoundCheckVolumeNormalization; @property(readonly, nonatomic) float preferredVolume; @property(readonly, nonatomic) float preferredRate; @property(readonly, nonatomic) CDStruct_1b6d18a9 duration; - (_Bool)_isStreaming; - (id)_absoluteURL; - (struct OpaqueFigPlaybackItem *)_playbackItem; - (struct OpaqueFigFormatReader *)_formatReader; - (struct OpaqueFigAsset *)_figAsset; - (void)cancelLoading; - (void)loadValuesAsynchronouslyForKeys:(id)arg1 keysForCollectionKeys:(id)arg2 completionHandler:(id)arg3; - (void)loadValuesAsynchronouslyForKeys:(id)arg1 completionHandler:(id)arg2; - (long long)statusOfValueForKey:(id)arg1 error:(id *)arg2; - (long long)statusOfValueForKey:(id)arg1; - (id)valueForUndefinedKey:(id)arg1; - (unsigned long long)hash; - (_Bool)isEqual:(id)arg1; - (id)_comparisonToken; - (id)_assetInspectorLoader; - (id)_assetInspector; - (id)_weakReference; - (void)dealloc; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)init; @end
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" @class NSMutableData, NSTimer, NSURLConnection, SWSyncHost; @interface SWSyncServiceConnection : NSObject { SWSyncHost *_host; NSURLConnection *_URLConnection; NSMutableData *_receivedData; NSTimer *_bailOutTimer; } @property(readonly, nonatomic) SWSyncHost *host; // @synthesize host=_host; - (id)delegate; - (void)handleResponse:(id)arg1; - (id)connection:(id)arg1 willCacheResponse:(id)arg2; - (void)connection:(id)arg1 didSendBodyData:(long long)arg2 totalBytesWritten:(long long)arg3 totalBytesExpectedToWrite:(long long)arg4; - (void)connection:(id)arg1 didReceiveResponse:(id)arg2; - (void)connection:(id)arg1 didCancelAuthenticationChallenge:(id)arg2; - (id)connection:(id)arg1 willSendRequest:(id)arg2 redirectResponse:(id)arg3; - (void)connection:(id)arg1 didReceiveAuthenticationChallenge:(id)arg2; - (_Bool)connection:(id)arg1 canAuthenticateAgainstProtectionSpace:(id)arg2; - (_Bool)connectionShouldUseCredentialStorage:(id)arg1; - (void)connectionDidFinishLoading:(id)arg1; - (void)connection:(id)arg1 didReceiveData:(id)arg2; - (void)connection:(id)arg1 didFailWithError:(id)arg2; - (void)_bailOutTimerFired:(id)arg1; - (void)_restartBailOutTimer; - (void)dealloc; - (id)initWithHost:(id)arg1; @end
/** * This header is generated by class-dump-z 0.1-11o. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. */ #import "UIKit-Structs.h" #import <UIKit/UIControl.h> @interface UIRemoveControlMinusButton : UIControl { unsigned _rotated : 1; unsigned _rotating : 1; unsigned _hiding : 1; unsigned _showAsPlus : 1; unsigned _reserved : 28; float _verticalOffset; } +(float)defaultWidth; +(id)minusImage; +(id)plusImage; -(id)initWithRemoveControl:(id)removeControl; -(void)dealloc; -(void)setHiding:(BOOL)hiding; -(BOOL)isHiding; -(void)drawRect:(CGRect)rect; -(void)animator:(id)animator stopAnimation:(id)animation; -(void)toggleRotate:(BOOL)rotate; -(BOOL)isRotated; -(BOOL)isRotating; -(void)_toggleRotateAnimationDidStop:(id)_toggleRotateAnimation finished:(BOOL)finished; @end
/** File: hwm35fd.c Project: DCPU-16 Tools Component: LibDCPU-vm Authors: Jose Manuel Diez Description: Implements the M35FD specification. **/ #include <stdio.h> #include <stdlib.h> #include <debug.h> #include <iio.h> #include "vm.h" #include "dcpuhook.h" #include "dcpuops.h" #include "hw.h" #include "hwm35fd.h" void vm_hw_m35fd_set_state(struct m35fd_hardware* hw, uint16_t state) { hw->state = state; if (hw->interrupt_msg) { vm_interrupt(hw->vm, hw->interrupt_msg); } } void vm_hw_m35fd_set_error(struct m35fd_hardware* hw, uint16_t error) { hw->last_error = error; if (hw->interrupt_msg) { vm_interrupt(hw->vm, hw->interrupt_msg); } } void vm_hw_m35fd_interrupt(vm_t* vm, void* ud) { struct m35fd_hardware* hw = (struct m35fd_hardware*)ud; switch (vm->registers[REG_A]) { case M35FD_INTERRUPT_POLL: vm->registers[REG_B] = hw->state; vm->registers[REG_C] = hw->last_error; hw->last_error = M35FD_ERROR_NONE; case M35FD_INTERRUPT_MSG: hw->interrupt_msg = vm->registers[REG_X]; break; case M35FD_INTERRUPT_READ: if ((hw->state == M35FD_STATE_READY || hw->state == M35FD_STATE_READY_WP) && hw->reading == false && hw->writing == false) { hw->reading = true; hw->sector = vm->registers[REG_X]; hw->position = vm->registers[REG_Y]; vm_hw_m35fd_set_state(hw, M35FD_STATE_BUSY); vm->registers[REG_B] = 1; } else { vm->registers[REG_B] = 0; vm_hw_m35fd_set_error(hw, M35FD_ERROR_BUSY); } break; case M35FD_INTERRUPT_WRITE: if ((hw->state == M35FD_STATE_READY) && hw->reading == false && hw->writing == false) { hw->writing = true; hw->sector = vm->registers[REG_X]; hw->position = vm->registers[REG_Y]; vm_hw_m35fd_set_state(hw, M35FD_STATE_BUSY); vm->registers[REG_B] = 1; } else { vm->registers[REG_B] = 0; vm_hw_m35fd_set_error(hw, M35FD_ERROR_BUSY); } break; } } void vm_hw_m35fd_reset_state(struct m35fd_hardware* hw) { hw->sector = 0; hw->reading = false; hw->writing = false; hw->position = 0; vm_hw_m35fd_set_state(hw, (hw->write_protected) ? M35FD_STATE_READY_WP : M35FD_STATE_READY); } void vm_hw_m35fd_cycle(vm_t* vm, uint16_t pos, void* ud) { struct m35fd_hardware* hw = (struct m35fd_hardware*)ud; int i = 0; uint16_t word = 0; if (hw->state == M35FD_STATE_NO_MEDIA && (hw->reading || hw->writing)) { vm_hw_m35fd_set_error(hw, M35FD_ERROR_NO_MEDIA); vm_hw_m35fd_reset_state(hw); return; } if (hw->disk == NULL && (hw->state == M35FD_STATE_READY_WP || hw->state == M35FD_STATE_READY)) { vm_hw_m35fd_set_error(hw, M35FD_ERROR_EJECT); vm_hw_m35fd_reset_state(hw); } if (hw->sector > 1440) { // There is no error for "The requested sector does not exist." vm_hw_m35fd_reset_state(hw); } if (hw->reading) { fseek(hw->disk, hw->sector * 1024, SEEK_SET); for (i = 0; i < 512; i++) { iread(&word, hw->disk); vm->ram[hw->position + i] = word; } vm_hw_m35fd_reset_state(hw); } if (hw->writing) { fseek(hw->disk, hw->sector * 1024, SEEK_SET); for (i = 0; i < 512; i++) { word = vm->ram[hw->position + i]; iwrite(&word, hw->disk); fflush(hw->disk); } vm_hw_m35fd_reset_state(hw); } } void vm_hw_m35fd_load_disk(struct m35fd_hardware* hw, const char* path) { hw->disk = fopen(path, "rb+"); if (hw->disk != NULL) { vm_hw_m35fd_set_state(hw, (hw->write_protected) ? M35FD_STATE_READY_WP : M35FD_STATE_READY); } } void vm_hw_m35fd_init(vm_t* vm) { struct m35fd_hardware* hw; hw = malloc(sizeof(struct m35fd_hardware)); hw->hw_hook = 0; hw->hw_id = 0; hw->interrupt_msg = 0; hw->state = M35FD_STATE_NO_MEDIA; hw->last_error = M35FD_ERROR_NONE; hw->disk = NULL; hw->sector = 0; hw->position = 0; hw->reading = false; hw->writing = false; hw->write_protected = false; hw->vm = vm; hw->device.id = 0x4fd524c5; hw->device.version = 0x000b; hw->device.manufacturer = 0x1eb37e91; hw->device.handler = &vm_hw_m35fd_interrupt; hw->device.free_handler = NULL; hw->device.userdata = hw; hw->hw_hook = vm_hook_register(vm, &vm_hw_m35fd_cycle, HOOK_ON_60HZ, hw); hw->hw_id = vm_hw_register(vm, &hw->device); vm_hw_m35fd_load_disk(hw, "m35fd.bin"); }
/* ** $Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp $ ** Standard library for bitwise operations ** See Copyright Notice in lua.h */ #define lbitlib_c #define LUA_LIB #include "lprefix.h" #include "lua.h" #include "lauxlib.h" #include "lualib.h" #if defined(LUA_COMPAT_BITLIB) /* { */ #define pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) #define checkunsigned(L,i) ((lua_Unsigned)luaL_checkinteger(L,i)) /* number of bits to consider in a number */ #if !defined(LUA_NBITS) #define LUA_NBITS 32 #endif /* ** a lua_Unsigned with its first LUA_NBITS bits equal to 1. (Shift must ** be made in two parts to avoid problems when LUA_NBITS is equal to the ** number of bits in a lua_Unsigned.) */ #define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) /* macro to trim extra bits */ #define trim(x) ((x) & ALLONES) /* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ #define mask(n) (~((ALLONES << 1) << ((n) - 1))) static lua_Unsigned andaux (lua_State *L) { int i, n = lua_gettop(L); lua_Unsigned r = ~(lua_Unsigned)0; for (i = 1; i <= n; i++) r &= checkunsigned(L, i); return trim(r); } static int b_and (lua_State *L) { lua_Unsigned r = andaux(L); pushunsigned(L, r); return 1; } static int b_test (lua_State *L) { lua_Unsigned r = andaux(L); lua_pushboolean(L, r != 0); return 1; } static int b_or (lua_State *L) { int i, n = lua_gettop(L); lua_Unsigned r = 0; for (i = 1; i <= n; i++) r |= checkunsigned(L, i); pushunsigned(L, trim(r)); return 1; } static int b_xor (lua_State *L) { int i, n = lua_gettop(L); lua_Unsigned r = 0; for (i = 1; i <= n; i++) r ^= checkunsigned(L, i); pushunsigned(L, trim(r)); return 1; } static int b_not (lua_State *L) { lua_Unsigned r = ~checkunsigned(L, 1); pushunsigned(L, trim(r)); return 1; } static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) { if (i < 0) { /* shift right? */ i = -i; r = trim(r); if (i >= LUA_NBITS) r = 0; else r >>= i; } else { /* shift left */ if (i >= LUA_NBITS) r = 0; else r <<= i; r = trim(r); } pushunsigned(L, r); return 1; } static int b_lshift (lua_State *L) { return b_shift(L, checkunsigned(L, 1), luaL_checkinteger(L, 2)); } static int b_rshift (lua_State *L) { return b_shift(L, checkunsigned(L, 1), -luaL_checkinteger(L, 2)); } static int b_arshift (lua_State *L) { lua_Unsigned r = checkunsigned(L, 1); lua_Integer i = luaL_checkinteger(L, 2); if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1)))) return b_shift(L, r, -i); else { /* arithmetic shift for 'negative' number */ if (i >= LUA_NBITS) r = ALLONES; else r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */ pushunsigned(L, r); return 1; } } static int b_rot (lua_State *L, lua_Integer d) { lua_Unsigned r = checkunsigned(L, 1); int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ r = trim(r); if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ r = (r << i) | (r >> (LUA_NBITS - i)); pushunsigned(L, trim(r)); return 1; } static int b_lrot (lua_State *L) { return b_rot(L, luaL_checkinteger(L, 2)); } static int b_rrot (lua_State *L) { return b_rot(L, -luaL_checkinteger(L, 2)); } /* ** get field and width arguments for field-manipulation functions, ** checking whether they are valid. ** ('luaL_error' called without 'return' to avoid later warnings about ** 'width' being used uninitialized.) */ static int fieldargs (lua_State *L, int farg, int *width) { lua_Integer f = luaL_checkinteger(L, farg); lua_Integer w = luaL_optinteger(L, farg + 1, 1); luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); if (f + w > LUA_NBITS) luaL_error(L, "trying to access non-existent bits"); *width = (int)w; return (int)f; } static int b_extract (lua_State *L) { int w; lua_Unsigned r = trim(checkunsigned(L, 1)); int f = fieldargs(L, 2, &w); r = (r >> f) & mask(w); pushunsigned(L, r); return 1; } static int b_replace (lua_State *L) { int w; lua_Unsigned r = trim(checkunsigned(L, 1)); lua_Unsigned v = trim(checkunsigned(L, 2)); int f = fieldargs(L, 3, &w); lua_Unsigned m = mask(w); r = (r & ~(m << f)) | ((v & m) << f); pushunsigned(L, r); return 1; } static const luaL_Reg bitlib[] = { {"arshift", b_arshift}, {"band", b_and}, {"bnot", b_not}, {"bor", b_or}, {"bxor", b_xor}, {"btest", b_test}, {"extract", b_extract}, {"lrotate", b_lrot}, {"lshift", b_lshift}, {"replace", b_replace}, {"rrotate", b_rrot}, {"rshift", b_rshift}, {NULL, NULL} }; LUAMOD_API int luaopen_bit32 (lua_State *L) { luaL_newlib(L, bitlib); return 1; } #else /* }{ */ LUAMOD_API int luaopen_bit32 (lua_State *L) { return luaL_error(L, "library 'bit32' has been deprecated"); } #endif /* } */
#import <UIKit/UIKit.h> #import <OpenGLES/EAGL.h> #import <OpenGLES/ES1/gl.h> #import <OpenGLES/ES1/glext.h> #import "GLViewController.h" @class GLViewController; @interface EAGLView : UIView<UIAccelerometerDelegate> { @private GLint backingWidth; GLint backingHeight; EAGLContext *context; GLuint viewRenderbuffer, viewFramebuffer; GLuint depthRenderbuffer; //NSTimer *animationTimer; NSTimeInterval animationInterval; int render; UIDevice *batterydev; int batteryidx; } @property (nonatomic) NSTimeInterval animationInterval; @property (strong) CADisplayLink *displayLink; - (void)startRender; - (void)stopRender; - (void)startAnimation; - (void)stopAnimation; - (void)drawView; - (void)startDisplayLink; - (void)handleDisplayLink:(CADisplayLink *)sender; - (void)stopDisplayLink; @end
#pragma once #ifndef __WIND32WINDOW_H__ #define __WIND32WINDOW_H__ #include "../Core/Config.h" #include "../Core/Timer.h" #include "../Core/Application.h" namespace WindGE { class WIND_CORE_API Win32Window { public: Win32Window(HINSTANCE hInst); ~Win32Window(); bool init(Application* app, std::wstring titleName); void resize(); int run(); virtual LRESULT msg_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); virtual void on_mouse_down(WPARAM /*btnState*/, int /*x*/, int /*y*/) {} virtual void on_mouse_up(WPARAM /*btnState*/, int /*x*/, int /*y*/) {} virtual void on_mouse_move(WPARAM /*btnState*/, int /*x*/, int /*y*/) {} public: inline HINSTANCE app_instance() const { return __inst; } inline HWND app_hwnd() const { return __hwnd; } protected: bool _init_main_window(); bool _init_app(); void _calculate_frame_stats(); private: HINSTANCE __inst; HWND __hwnd; bool __is_paused; bool __minimized; bool __maximized; bool __resizing; std::wstring __title_name; int __width; int __height; int __frame_count; Application* __app; Timer __timer; }; } #endif // !__WIND32WINDOW_H__
/***************************************************************************** The following code is derived, directly or indirectly, from the SystemC source code Copyright (c) 1996-2008 by all Contributors. All Rights reserved. The contents of this file are subject to the restrictions and limitations set forth in the SystemC Open Source License Version 3.0 (the "License"); You may not use this file except in compliance with such restrictions and limitations. You may obtain instructions on how to receive a copy of the License at http://www.systemc.org/. Software distributed by Contributors under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. *****************************************************************************/ // // Note to the LRM writer : These interfaces are channel specific interfaces // useful in the context of tlm_fifo. // #ifndef __TLM_FIFO_IFS_H__ #define __TLM_FIFO_IFS_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h" namespace tlm { // // Fifo specific interfaces // // Fifo Debug Interface template< typename T > class tlm_fifo_debug_if : public virtual sc_core::sc_interface { public: virtual int used() const = 0; virtual int size() const = 0; virtual void debug() const = 0; // // non blocking peek and poke - no notification // // n is index of data : // 0 <= n < size(), where 0 is most recently written, and size() - 1 // is oldest ie the one about to be read. // virtual bool nb_peek( T & , int n ) const = 0; virtual bool nb_poke( const T & , int n = 0 ) = 0; }; // fifo interfaces = extended + debug template < typename T > class tlm_fifo_put_if : public virtual tlm_put_if<T> , public virtual tlm_fifo_debug_if<T> {}; template < typename T > class tlm_fifo_get_if : public virtual tlm_get_peek_if<T> , public virtual tlm_fifo_debug_if<T> {}; class tlm_fifo_config_size_if : public virtual sc_core::sc_interface { public: virtual void nb_expand( unsigned int n = 1 ) = 0; virtual void nb_unbound( unsigned int n = 16 ) = 0; virtual bool nb_reduce( unsigned int n = 1 ) = 0; virtual bool nb_bound( unsigned int n ) = 0; }; } // namespace tlm #endif
// // SoftwareListVC.h // OSChina // // Created by sky on 15/7/2. // Copyright (c) 2015年 bluesky. All rights reserved. // #import "OSCObjsViewController.h" typedef NS_ENUM(int, SoftwaresType) { SoftwaresTypeRecommended, SoftwaresTypeNewest, SoftwaresTypeHottest, SoftwaresTypeCN }; @interface SoftwareListVC : OSCObjsViewController - (instancetype)initWithSoftwaresType:(SoftwaresType)softwareType; - (instancetype)initWIthSearchTag:(int)searchTag; @end
// // ViewController.h // TONetworkingDemo // // Created by Tony on 16/6/6. // Copyright © 2016年 Tony. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
#ifndef __SGL_MACOSX_COCOA_H__ #define __SGL_MACOSX_COCOA_H__ /** * Copyright (C) 2011 by Tobias Thiel * 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. */ #include <stdio.h> #include <stdlib.h> #import <Cocoa/Cocoa.h> #import <OpenGL/OpenGL.h> #import <Carbon/Carbon.h> // only for the keyCodes, no linking necessary // TODO dynamic checking whether cmd program or not #define COCOA_FROM_CMD 1 @interface SGLApplicationDelegate : NSObject <NSApplicationDelegate> { } - (NSString *)applicationName; - (void)populateApplicationMenu:(NSMenu *)aMenu; - (void)populateWindowMenu:(NSMenu *)aMenu; - (void)populateHelpMenu:(NSMenu *)aMenu; @end @interface SGLWindow : NSWindow <NSWindowDelegate> { sgl_env_t *m_e; sgl_window_t *m_w; } - (sgl_env_t *)sglEnv; - (void)setSglEnv:(sgl_env_t *)theE; - (sgl_window_t *)sglWindow; - (void)setSglWindow:(sgl_window_t *)theW; @end @interface SGLView : NSOpenGLView { sgl_env_t *m_e; sgl_window_t *m_w; NSTrackingArea *m_ta; } - (sgl_env_t *)sglEnv; - (void)setSglEnv:(sgl_env_t *)theE; - (sgl_window_t *)sglWindow; - (void)setSglWindow:(sgl_window_t *)theW; @end typedef struct { SGLApplicationDelegate *ad; SGLWindow *w; SGLView *v; uint8_t fullscreen_transition; } sgl_window_cocoa_t; int8_t sgl_translate_event(sgl_event_t *se, NSEvent *ne, sgl_window_t *w); uint8_t sgl_translate_modifier(NSUInteger modifierFlags); int8_t sgl_translate_key(sgl_event_key_t *ke, unsigned short kc); void sgl_translate_mouse_location(sgl_event_mouse_t *me, NSPoint eventLocation, SGLView *v); #endif /* __SGL_MACOSX_COCOA_H__ */
/* * This file is part of cryptopp-bin+dings-api. * * (c) Stephen Berquet <stephen.berquet@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ #ifndef API_CRYPTOPP_EXCEPTION_H #define API_CRYPTOPP_EXCEPTION_H #include "src/api_cryptopp.h" #include <exception> #include <string> NAMESPACE_BEGIN(CryptoppApi) // API Exception class class Exception : public std::exception { public: Exception(const std::string message) : m_msg(message) , m_code(0) {} Exception(const std::string message, const int code) : m_msg(message) , m_code(code) {} ~Exception() throw() {} // returns exception message std::string getMessage() {return m_msg;} // returns exception code int getCode() {return m_code;} virtual const char* what() const throw() {return m_msg.c_str();} protected: // exception message std::string m_msg; // exception code int m_code; }; NAMESPACE_END #endif /* API_CRYPTOPP_EXCEPTION_H */
// // BNRReminderViewController.h // HypoNerd // // Created by Bo Yan on 6/11/15. // Copyright (c) 2015 Fred Yan. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface BNRReminderViewController : UIViewController @end
#ifndef _ROS_SERVICE_ForcePower_h #define _ROS_SERVICE_ForcePower_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" namespace realsense_camera { static const char FORCEPOWER[] = "realsense_camera/ForcePower"; class ForcePowerRequest : public ros::Msg { public: typedef bool _power_on_type; _power_on_type power_on; ForcePowerRequest(): power_on(0) { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; union { bool real; uint8_t base; } u_power_on; u_power_on.real = this->power_on; *(outbuffer + offset + 0) = (u_power_on.base >> (8 * 0)) & 0xFF; offset += sizeof(this->power_on); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; union { bool real; uint8_t base; } u_power_on; u_power_on.base = 0; u_power_on.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->power_on = u_power_on.real; offset += sizeof(this->power_on); return offset; } const char * getType(){ return FORCEPOWER; }; const char * getMD5(){ return "0a07d78fa0214ec8d773e5045aa5087a"; }; }; class ForcePowerResponse : public ros::Msg { public: ForcePowerResponse() { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; return offset; } const char * getType(){ return FORCEPOWER; }; const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; }; class ForcePower { public: typedef ForcePowerRequest Request; typedef ForcePowerResponse Response; }; } #endif
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "SBIconView.h" #import "_UISettingsKeyObserver-Protocol.h" @class SBFolderSettings; @interface SBFolderIconView : SBIconView <_UISettingsKeyObserver> { SBFolderSettings *_folderSettings; } + (_Bool)canShowUpdatedMark; - (id)_folderIconImageView; - (void)settings:(id)arg1 changedValueForKey:(id)arg2; - (void)_updateAdaptiveColors; - (void)_applyEditingStateAnimated:(_Bool)arg1; - (void)cleanupAfterFloatyFolderCrossfade; - (void)setFloatyFolderCrossfadeFraction:(double)arg1; - (void)prepareToCrossfadeWithFloatyFolderView:(id)arg1 allowFolderInteraction:(_Bool)arg2; - (void)removeDropGlow; - (void)showDropGlow:(_Bool)arg1; - (void)prepareDropGlow; - (void)setBackgroundAndIconGridImageAlpha:(double)arg1; - (void)setIconGridImageAlpha:(double)arg1; - (double)grabDurationForEvent:(id)arg1; - (_Bool)allowsTapWhileEditing; - (id)description; - (id)folder; - (void)scrollToGapOrTopIfFullOfPage:(unsigned long long)arg1 animated:(_Bool)arg2; - (void)scrollToTopOfPage:(unsigned long long)arg1 animated:(_Bool)arg2; - (void)scrollToFirstGapAnimated:(_Bool)arg1; - (void)scrollToTopOfFirstPageAnimated:(_Bool)arg1; - (struct CGRect)visibleImageRelativeFrameForMiniIconAtIndex:(unsigned long long)arg1; - (struct CGRect)frameForMiniIconAtIndex:(unsigned long long)arg1; - (unsigned long long)lastVisibleMiniIconIndex; - (unsigned long long)centerVisibleMiniIconIndex; - (unsigned long long)firstVisibleMiniIconIndex; - (unsigned long long)visibleMiniIconListIndex; - (unsigned long long)visibleMiniIconCount; - (id)iconBackgroundView; - (id)dropGlow; - (void)setIcon:(id)arg1; - (id)folderIcon; - (void)dealloc; - (id)initWithFrame:(struct CGRect)arg1; @end
#pragma once #include "codegen.h" #include "statement.h" namespace CodeGen { struct MADGINE_CODEGEN_EXPORT ShaderFile : File { ShaderFile(); ShaderFile(const ShaderFile &); ShaderFile(ShaderFile &&) = default; ShaderFile &operator=(const ShaderFile &); std::vector<CodeGen::Function> *nextInstance(); void setInstance(std::vector<CodeGen::Function> *instance); void beginFunction(std::string_view name, Type returnType, std::vector<Variable> arguments, std::vector<std::string> annotations = {}); void endFunction(); virtual void statement(Statement statement) override; Struct *getStruct(std::string_view name); std::list<std::vector<Function>> mInstances; std::vector<Function> *mCurrentInstance; std::stack<Function *> mFunctionStack; std::map<std::string, Struct, std::less<>> mStructs; }; }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12). // // Copyright (C) 1997-2019 Steve Nygard. // #import <Foundation/NSMutableOrderedSet.h> @interface NSMutableOrderedSet (DVTNSOrderedSetAdditions) - (void)dvt_addObjectIfNotNil:(id)arg1; @end
#pragma once #include "ofThread.h" /// This is a simple example of a ThreadedObject created by extending ofThread. /// It contains data (count) that will be accessed from within and outside the /// thread and demonstrates several of the data protection mechanisms (aka /// mutexes). class ThreadedObject: public ofThread { public: /// Create a ThreadedObject and initialize the member /// variable in an initialization list. ThreadedObject(): count(0), shouldThrowTestException(false) { } /// Start the thread. void start() { // Mutex blocking is set to true by default // It is rare that one would want to use startThread(false). startThread(); } /// Signal the thread to stop. After calling this method, /// isThreadRunning() will return false and the while loop will stop /// next time it has the chance to. void stop() { stopThread(); } /// Our implementation of threadedFunction. void threadedFunction() { while(isThreadRunning()) { // Attempt to lock the mutex. If blocking is turned on, if(lock()) { // The mutex is now locked and the "count" // variable is protected. Time to modify it. count++; // Here, we simply cause it to reset to zero if it gets big. if(count > 50000) count = 0; // Unlock the mutex. This is only // called if lock() returned true above. unlock(); // Sleep for 1 second. sleep(1000); if(shouldThrowTestException > 0) { shouldThrowTestException = 0; // Throw an exception to test the global ofBaseThreadErrorHandler. // Users that require more specialized exception handling, // should make sure that their threaded objects catch all // exceptions. ofBaseThreadErrorHandler is only used as a // way to provide better debugging / logging information in // the event of an uncaught exception. throw Poco::ApplicationException("We just threw a test exception!"); } } else { // If we reach this else statement, it means that we could not // lock our mutex, and so we do not need to call unlock(). // Calling unlock without locking will lead to problems. ofLogWarning("threadedFunction()") << "Unable to lock mutex."; } } } /// This drawing function cannot be called from the thread itself because /// it includes OpenGL calls (ofDrawBitmapString). void draw() { std::stringstream ss; ss << "I am a slowly increasing thread. " << std::endl; ss << "My current count is: "; if(lock()) { // The mutex is now locked and the "count" // variable is protected. Time to read it. ss << count; // Unlock the mutex. This is only // called if lock() returned true above. unlock(); } else { // If we reach this else statement, it means that we could not // lock our mutex, and so we do not need to call unlock(). // Calling unlock without locking will lead to problems. ofLogWarning("threadedFunction()") << "Unable to lock mutex."; } ofDrawBitmapString(ss.str(), 50, 56); } // Use ofScopedLock to protect a copy of count while getting a copy. int getCount() { ofScopedLock lock(mutex); return count; } void throwTestException() { shouldThrowTestException = 1; } protected: // A flag to check and see if we should throw a test exception. Poco::AtomicCounter shouldThrowTestException; // This is a simple variable that we aim to always access from both the // main thread AND this threaded object. Therefore, we need to protect it // with the mutex. In the case of simple numerical variables, some // garuntee thread safety for small integral types, but for the sake of // illustration, we use an int. This int could represent ANY complex data // type that needs to be protected. // // Note, if we simply want to count in a thread-safe manner without worrying // about mutexes, we might use Poco::AtomicCounter instead. int count; };
// // WDLocalization.h // Bubbles // // Created by 王 得希 on 12-3-18. // Copyright (c) 2012年 BMW Group ConnectedDrive Lab China. All rights reserved. // #ifndef Bubbles_WDLocalization_h #define Bubbles_WDLocalizationr_h #import <Foundation/Foundation.h> // DW: normal actions #define kActionSheetButtonCopy [WDLocalization stringForKey:@"kActionSheetButtonCopy"] #define kActionSheetButtonEmail [WDLocalization stringForKey:@"kActionSheetButtonEmail"] #define kActionSheetButtonSend [WDLocalization stringForKey:@"kActionSheetButtonSend"] #define kActionSheetButtonMessage [WDLocalization stringForKey:@"kActionSheetButtonMessage"] #define kActionSheetButtonPreview [WDLocalization stringForKey:@"kActionSheetButtonPreview"] #define kActionSheetButtonSave [WDLocalization stringForKey:@"kActionSheetButtonSave"] // DW: help actions #define kActionSheetButtonHelpEmail [WDLocalization stringForKey:@"kActionSheetButtonHelpEmail"] #define kActionSheetButtonHelpRate [WDLocalization stringForKey:@"kActionSheetButtonHelpRate"] #define kActionSheetButtonHelpPDF [WDLocalization stringForKey:@"kActionSheetButtonHelpPDF"] #define kActionSheetButtonHelpSplash [WDLocalization stringForKey:@"kActionSheetButtonHelpSplash"] #define kActionSheetButtonMacApp [WDLocalization stringForKey:@"kActionSheetButtonMacApp"] // DW: transfer actions #define kActionSheetButtonTransferTerminate [WDLocalization stringForKey:@"kActionSheetButtonTransferTerminate"] // DW: edit actions #define kActionSheetButtonCancel [WDLocalization stringForKey:@"kActionSheetButtonCancel"] #define kActionSheetButtonDeleteAll [WDLocalization stringForKey:@"kActionSheetButtonDeleteAll"] // DW: main view #define kMainViewText [WDLocalization stringForKey:@"kMainViewText"] #define kMainViewPeers [WDLocalization stringForKey:@"kMainViewPeers"] #define kMainViewVersion [WDLocalization stringForKey:@"kMainViewVersion"] #define kMainViewLocal [WDLocalization stringForKey:@"kMainViewLocal"] // DW: error messages #define kWDBubbleErrorMessageTitle [WDLocalization stringForKey:@"kWDBubbleErrorMessageTitle"] #define kWDBubbleErrorMessageTerminatedBySender [WDLocalization stringForKey:@"kWDBubbleErrorMessageTerminatedBySender"] #define kWDBubbleErrorMessageDisconnectWithError [WDLocalization stringForKey:@"kWDBubbleErrorMessageDisconnectWithError"] #define kWDBubbleErrorMessageDoNotSupportMultiple [WDLocalization stringForKey:@"kWDBubbleErrorMessageDoNotSupportMultiple"] #define kWDBubbleErrorMessageNoDeviceSelected [WDLocalization stringForKey:@"kWDBubbleErrorMessageNoDeviceSelected"] // DW: OS X, Others... #define kWDBubblePreferenceOther [WDLocalization stringForKey:@"kWDBubblePreferenceOther"] // DW: lock #define kLockTitle [WDLocalization stringForKey:@"kLockTitle"] #define kLockContent [WDLocalization stringForKey:@"kLockContent"] // DW: alert view #define kAlertViewOK [WDLocalization stringForKey:@"kAlertViewOK"] #define kAlertViewCancel [WDLocalization stringForKey:@"kAlertViewCancel"] // DW: to developer email #define kEmailToDeveloperSubject [WDLocalization stringForKey:@"kEmailToDeveloperSubject"] #define kEmailToDeveloperBody [WDLocalization stringForKey:@"kEmailToDeveloperBody"] @interface WDLocalization : NSObject + (NSString *)stringForKey:(NSString *)key; @end #endif
#ifndef R_H #define R_H //structures typedef struct { double onShellClosure; double onSubshellClosure; double radioactive; double lowRelativeLevelDensity, highRelativeLevelDensity; int maxDistFromStability; int excludeStable; }nuclide_rank_par; //parameters for ranking nulides #endif
#ifdef __cplusplus extern "C" { #endif uint8_t temprature_sens_read(); #ifdef __cplusplus } #endif
#pragma once #include "../Util.h" /** * @param s1, s2 两线段 * @return false 若两线段不相交 true 若两线段相交 */ bool SegmentIntersection(const Segment &s1, const Segment &s2);
// Determine endian and pointer size based on known defines. // TS_BIG_ENDIAN and TS_PTR_SIZE can be set as -D compiler arguments // to override this. #if !defined(TS_BIG_ENDIAN) #if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \ || (defined( __APPLE_CC__) && (defined(__ppc__) || defined(__ppc64__))) #define TS_BIG_ENDIAN 1 #else #define TS_BIG_ENDIAN 0 #endif #endif #if !defined(TS_PTR_SIZE) #if UINTPTR_MAX == 0xFFFFFFFF #define TS_PTR_SIZE 32 #else #define TS_PTR_SIZE 64 #endif #endif
// // ______ ______ ______ // /\ __ \ /\ ___\ /\ ___\ // \ \ __< \ \ __\_ \ \ __\_ // \ \_____\ \ \_____\ \ \_____\ // \/_____/ \/_____/ \/_____/ // // // Copyright (c) 2014-2015, Geek Zoo Studio // http://www.bee-framework.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. // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) #import "Bee_Precompile.h" #import "Bee_Package.h" #import "Bee_Foundation.h" #import "Bee_ViewPackage.h" #import "Bee_UISignal.h" #import "Bee_UILabel.h" #import "Bee_UICapability.h" #pragma mark - AS_PACKAGE( BeePackage_UI, BeeImageCache, imageCache ); #pragma mark - @class BeeUIActivityIndicatorView; #pragma mark - @interface BeeImageCache : NSObject AS_SINGLETON( BeeImageCache ) - (BOOL)hasCachedForURL:(NSString *)url; - (BOOL)hasFileCachedForURL:(NSString *)url; - (BOOL)hasMemoryCachedForURL:(NSString *)url; - (UIImage *)imageForURL:(NSString *)url; - (UIImage *)fileImageForURL:(NSString *)url; - (UIImage *)memoryImageForURL:(NSString *)url; - (void)saveImage:(UIImage *)image forURL:(NSString *)url; - (void)saveData:(NSData *)data forURL:(NSString *)url; - (void)deleteImageForURL:(NSString *)url; - (void)deleteAllImages; @end #pragma mark - @interface BeeUIImageView : UIImageView AS_SIGNAL( LOAD_START ) // 加载开始 AS_SIGNAL( LOAD_COMPLETED ) // 加载完成 AS_SIGNAL( LOAD_FAILED ) // 加载失败 AS_SIGNAL( LOAD_CANCELLED ) // 加载取消 AS_SIGNAL( LOAD_CACHE ) // 加载缓存 //AS_SIGNAL( WILL_CHANGE ) // 图将要变了 //AS_SIGNAL( DID_CHANGED ) // 图已经变了 @property (nonatomic, assign) BOOL gray; // 是否变为灰色 @property (nonatomic, assign) BOOL round; // 是否裁剪为圆型 @property (nonatomic, assign) BOOL pattern; // 是否平铺 @property (nonatomic, assign) BOOL strech; // 是否裁剪为圆型 @property (nonatomic, assign) UIEdgeInsets strechInsets; // 是否裁剪为圆型 @property (nonatomic, assign) BOOL loading; @property (nonatomic, assign) BOOL loaded; @property (nonatomic, retain) BeeUILabel * altLabel; @property (nonatomic, retain) BeeUIActivityIndicatorView * indicator; @property (nonatomic, assign) UIActivityIndicatorViewStyle indicatorStyle; @property (nonatomic, retain) UIColor * indicatorColor; @property (nonatomic, retain) NSString * loadedURL; @property (nonatomic, retain) UIImage * defaultImage; @property (nonatomic, assign) NSString * url; @property (nonatomic, assign) NSString * file; @property (nonatomic, assign) NSString * resource; - (void)GET:(NSString *)url useCache:(BOOL)useCache; - (void)GET:(NSString *)url useCache:(BOOL)useCache placeHolder:(UIImage *)defaultImage; - (void)clear; @end #endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
// Explores setting a new file position indicator inside a function. // Conclusion: works! #include <stdio.h> void file_center(FILE *); void print_file(FILE *); int main(void) { FILE *file = fopen("fseek_test_1.asc", "r"); file_center(file); print_file(file); fclose(file); return 0; } void file_center(FILE *file) { long start; fseek(file, 0, SEEK_SET); start = ftell(file); long end; fseek(file, 0, SEEK_END); end = ftell(file); fseek(file, (start + end) / 2, SEEK_SET); } void print_file(FILE *file) { int character; while ((character = fgetc(file)) != EOF) putchar(character); }
#ifndef _BSD_SOURCE #define _BSD_SOURCE #endif #include <stdio.h> #include <dirent.h> #include <sys/stat.h> #include <unistd.h> #undef _BSD_SOURCE #include <assert.h> #include "types.h" #include "string_array.h" #include "string_buffer.h" // s1 `is_prefix_of` s2 static bool is_prefix_of(char* s1, char* s2){ assert (s1 != NULL); assert (s2 != NULL); if (*s1 == 0) return false; while (true){ char ch1 = *s1; char ch2 = *s2; if (ch1 == ch2){ if (ch1 == 0){ return false; } else { s1 += 1; s2 += 1; } } else { if (ch1 == 0){ return true; } else { return false; } } } } static void chop_extension (char* string){ assert (string != NULL); char* last_point = NULL; while (*string != 0){ if (*string == '.'){ last_point = string; } string += 1; } if (last_point != NULL){ *last_point = 0; } } int main (int argc, char** argv){ StringArray file_list = {}; StringArray_init(&file_list); StringArray extensionless_list = {}; StringArray_init(&extensionless_list); DIR* dp = opendir ("./"); if (dp != NULL){ struct dirent* ep; while ((ep = readdir (dp))){ struct stat stat_buff = {}; if ( 0 == lstat(ep->d_name, &stat_buff)){ if (S_ISREG(stat_buff.st_mode)){ StringArray_append(&file_list, duplicate_string(ep->d_name)); char* extensionless = duplicate_string(ep->d_name); chop_extension(extensionless); StringArray_append(&extensionless_list, extensionless); } } else { perror ("failed to lstat a directory entry."); } } closedir (dp); } else { perror ("Couldn't open the directory"); return 1; } for (uint i = 0; i < extensionless_list.nStrings; i += 1){ char* current_string_to_test = extensionless_list.data[i]; for (uint j = 0; j < extensionless_list.nStrings; j += 1){ if (i == j) continue; if (is_prefix_of (current_string_to_test, extensionless_list.data[j])){ char* file_to_delete = file_list.data[j]; if ( 0 == unlink(file_to_delete)){ printf("Deleted '%s'\n", file_to_delete); } else { printf("Failed to delete '%s'\n", file_to_delete); } } } } return 0; }
/** * Appcelerator Titanium Mobile * Copyright (c) 2011-2013 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ /** This is generated, do not edit by hand. **/ #include <jni.h> #include "Proxy.h" namespace titanium { namespace ui { class ButtonBarProxy : public titanium::Proxy { public: explicit ButtonBarProxy(jobject javaObject); static void bindProxy(v8::Handle<v8::Object> exports); static v8::Handle<v8::FunctionTemplate> getProxyTemplate(); static void dispose(); static v8::Persistent<v8::FunctionTemplate> proxyTemplate; static jclass javaClass; private: // Methods ----------------------------------------------------------- // Dynamic property accessors ---------------------------------------- }; } // namespace ui } // titanium
int main() { int a[12]; int i; int j; a [i + 1] = a[j*2] + 3; return 0; }
#ifndef TIME_H #define TIME_H #include <kernel/ktime.h> typedef struct timer_user { struct ktimer *timer; } timer_t; void time_usleep(unsigned int usec); void time_oneshot(timer_t *timer, int delay, void (*handler)(void *), void *arg); #endif /* TIME_H */
#include <sys/types.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include "../libft/includes/get_next_line.h" #include "../libft/includes/libft.h" static void ft_chartobin(char c, char *tab); static void send(char c, int pid); void prompt(int pid, char *line) { int i; i = 0; while (line[i]) { send(line[i], pid); i++; } send('\n', pid); send('\0', pid); } void ft_send_len(int pid, size_t len) { int i; i = 32; while (i) { if (len % 2) kill(pid, SIGUSR1); else kill(pid, SIGUSR2); len /= 2; pause(); i--; } } static void send(char c, int pid) { char *tab; int i; tab = (char *)malloc(7 * sizeof(char)); ft_chartobin(c, tab); i = 6; while (i >= 0) { if (tab[i] == 0) kill(pid, SIGUSR2); else kill(pid, SIGUSR1); pause(); i--; } free(tab); } static void ft_chartobin(char c, char *tab) { int i; i = 7; while (i > 0) { i--; tab[i] = c % 2; c /= 2; } }
#pragma once namespace opcua { OPCUA_DEFINE_METHODS(QualifiedName); inline void Copy(const OpcUa_QualifiedName& source, OpcUa_QualifiedName& target) { target.NamespaceIndex = source.NamespaceIndex; Copy(source.Name, target.Name); } class QualifiedName { public: QualifiedName() { Initialize(value_); } QualifiedName(OpcUa_QualifiedName&& source) : value_{source} { Initialize(source); } QualifiedName(QualifiedName&& source) : value_{source.value_} { Initialize(source.value_); } QualifiedName(const QualifiedName& source) = delete; ~QualifiedName() { Clear(value_); } QualifiedName& operator=(const QualifiedName& source) { if (&source != this) Copy(source.value_, value_); return *this; } QualifiedName& operator=(QualifiedName&& source) { if (&source != this) { Clear(value_); value_ = source.value_; Initialize(source.value_); } return *this; } bool empty() const { return ::OpcUa_String_IsEmpty(&value_.Name); } const OpcUa_String& name() const { return value_.Name; } NamespaceIndex namespace_index() const { return value_.NamespaceIndex; } OpcUa_QualifiedName& get() { return value_; } const OpcUa_QualifiedName& get() const { return value_; } private: OpcUa_QualifiedName value_; }; } // namespace opcua
// Generated by Haxe 3.3.0 #ifndef INCLUDED_flixel_input_gamepad_lists_FlxGamepadAnalogStateList #define INCLUDED_flixel_input_gamepad_lists_FlxGamepadAnalogStateList #ifndef HXCPP_H #include <hxcpp.h> #endif HX_DECLARE_CLASS3(flixel,input,gamepad,FlxGamepad) HX_DECLARE_CLASS4(flixel,input,gamepad,lists,FlxGamepadAnalogStateList) HX_DECLARE_CLASS2(flixel,util,IFlxDestroyable) namespace flixel{ namespace input{ namespace gamepad{ namespace lists{ class HXCPP_CLASS_ATTRIBUTES FlxGamepadAnalogStateList_obj : public hx::Object { public: typedef hx::Object super; typedef FlxGamepadAnalogStateList_obj OBJ_; FlxGamepadAnalogStateList_obj(); public: void __construct(Int status, ::flixel::input::gamepad::FlxGamepad gamepad); inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="flixel.input.gamepad.lists.FlxGamepadAnalogStateList") { return hx::Object::operator new(inSize,inContainer,inName); } inline void *operator new(size_t inSize, int extra) { return hx::Object::operator new(inSize+extra,true,"flixel.input.gamepad.lists.FlxGamepadAnalogStateList"); } static hx::ObjectPtr< FlxGamepadAnalogStateList_obj > __new(Int status, ::flixel::input::gamepad::FlxGamepad gamepad); static Dynamic __CreateEmpty(); static Dynamic __Create(hx::DynamicArray inArgs); //~FlxGamepadAnalogStateList_obj(); HX_DO_RTTI_ALL; hx::Val __Field(const ::String &inString, hx::PropertyAccess inCallProp); hx::Val __SetField(const ::String &inString,const hx::Val &inValue, hx::PropertyAccess inCallProp); void __GetFields(Array< ::String> &outFields); static void __register(); void __Mark(HX_MARK_PARAMS); void __Visit(HX_VISIT_PARAMS); ::String __ToString() const { return HX_HCSTRING("FlxGamepadAnalogStateList","\x10","\xe1","\xb0","\xbc"); } ::flixel::input::gamepad::FlxGamepad gamepad; Int status; Bool get_LEFT_STICK(); ::Dynamic get_LEFT_STICK_dyn(); Bool get_LEFT_STICK_X(); ::Dynamic get_LEFT_STICK_X_dyn(); Bool get_LEFT_STICK_Y(); ::Dynamic get_LEFT_STICK_Y_dyn(); Bool get_RIGHT_STICK(); ::Dynamic get_RIGHT_STICK_dyn(); Bool get_RIGHT_STICK_X(); ::Dynamic get_RIGHT_STICK_X_dyn(); Bool get_RIGHT_STICK_Y(); ::Dynamic get_RIGHT_STICK_Y_dyn(); Bool checkXY(Int id); ::Dynamic checkXY_dyn(); Bool checkX(Int id); ::Dynamic checkX_dyn(); Bool checkY(Int id); ::Dynamic checkY_dyn(); Bool checkRaw(Int RawID,Int Status); ::Dynamic checkRaw_dyn(); }; } // end namespace flixel } // end namespace input } // end namespace gamepad } // end namespace lists #endif /* INCLUDED_flixel_input_gamepad_lists_FlxGamepadAnalogStateList */
#ifndef _BITSET_H #define _BITSET_H #include <stdbool.h> #include <stddef.h> #include <stdio.h> /** Defines the base unit of storage used. */ typedef unsigned int BS_WORD; /** * The bit set structure */ typedef struct { /** The storage. */ BS_WORD *bits; /** The number of bits that the set holds. */ size_t n; } BitSet; /** * Initialize the bit set. * * @param bs Pointer to the bit set data structure. * @param n The number of bits that the set holds. * @return true if the data structure was initialized successfully, false otherwise. */ bool bs_init(BitSet *bs, size_t n); /** * Free resources associated with the bit set. * * @param bs Pointer to the bit set data structure to be freed. */ void bs_destroy(BitSet *bs); /** * Set a bit at the specified position. * * @param bs Pointer to the bit set data structure. * @param n The position to set. * @return true if the bit was set successfully, false otherwise. */ bool bs_set(BitSet *bs, size_t n); /** * Clear a bit at the specified position. * * @param bs Pointer to the bit set data structure. * @param n The position to clear. * @return true if the bit was cleared successfully, false otherwise. */ bool bs_clear(BitSet *bs, size_t n); /** * Check if the bit is set in the specified position. * * @param bs Pointer to the bit set data structure. * @param n The position to check. * @return true if the bit is set, false otherwise. */ bool bs_is_set(BitSet *bs, size_t n); /** * Print the bit set to a stream. * * @param bs Pointer to the bit set data structure. * @param f The stream. */ void bs_print(BitSet *bs, FILE *f); #endif // _BITSET_H
#pragma once #include <math.h> #include <GL/freeglut.h> #include "../models/SceneObject.h" class Scene { public: Scene(); ~Scene(); void display(); void special(int, int, int); void key(unsigned char, int, int); private: int cameraIndex = 0; SceneObject* cameraObject = NULL; void initialize(); void drawCamera(); void changeCamera(); };
// // WTtempData.h // wetan-oc // // Created by Sunday on 2017/4/6. // Copyright © 2017年 Carl Sun. All rights reserved. // #import <Foundation/Foundation.h> @interface WTtempData : NSObject + (NSDictionary *)getData; @end
#ifndef QTCOMPONENTS_DEFINE_H #define QTCOMPONENTS_DEFINE_H #ifdef QtComponents_EXPORTS # define QTCOMPONENTS_EXPORT __declspec(dllexport) #else # define QTCOMPONENTS_EXPORT __declspec(dllimport) #endif #endif // QTCOMPONENTS_DEFINE_H
#pragma once // Copyright (c) 2016 Genoil <jw@meneer.net> // Copyright (c) 2016 Jack Grigg <jack@z.cash> // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "libstratum/ZcashStratum.h" #include <iostream> #include <boost/array.hpp> #include <boost/asio.hpp> #include <boost/bind.hpp> #include <mutex> #include <thread> #include <atomic> #include "json/json_spirit_value.h" using namespace std; using namespace boost::asio; using boost::asio::ip::tcp; using namespace json_spirit; #ifndef _MSC_VER #define CONSOLE_COLORS #endif #ifndef CONSOLE_COLORS #define CL_N "" #define CL_RED "" #define CL_GRN "" #define CL_YLW "" #define CL_BLU "" #define CL_MAG "" #define CL_CYN "" #define CL_BLK "" /* black */ #define CL_RD2 "" /* red */ #define CL_GR2 "" /* green */ #define CL_YL2 "" /* dark yellow */ #define CL_BL2 "" /* blue */ #define CL_MA2 "" /* magenta */ #define CL_CY2 "" /* cyan */ #define CL_SIL "" /* gray */ #define CL_GRY "" /* dark gray */ #define CL_LRD "" /* light red */ #define CL_LGR "" /* light green */ #define CL_LYL "" /* tooltips */ #define CL_LBL "" /* light blue */ #define CL_LMA "" /* light magenta */ #define CL_LCY "" /* light cyan */ #define CL_WHT "" /* white */ #else #define CL_N "\x1B[0m" #define CL_RED "\x1B[31m" #define CL_GRN "\x1B[32m" #define CL_YLW "\x1B[33m" #define CL_BLU "\x1B[34m" #define CL_MAG "\x1B[35m" #define CL_CYN "\x1B[36m" #define CL_BLK "\x1B[22;30m" /* black */ #define CL_RD2 "\x1B[22;31m" /* red */ #define CL_GR2 "\x1B[22;32m" /* green */ #define CL_YL2 "\x1B[22;33m" /* dark yellow */ #define CL_BL2 "\x1B[22;34m" /* blue */ #define CL_MA2 "\x1B[22;35m" /* magenta */ #define CL_CY2 "\x1B[22;36m" /* cyan */ #define CL_SIL "\x1B[22;37m" /* gray */ #ifdef WIN32 #define CL_GRY "\x1B[01;30m" /* dark gray */ #else #define CL_GRY "\x1B[90m" /* dark gray selectable in putty */ #endif #define CL_LRD "\x1B[01;31m" /* light red */ #define CL_LGR "\x1B[01;32m" /* light green */ #define CL_LYL "\x1B[01;33m" /* tooltips */ #define CL_LBL "\x1B[01;34m" /* light blue */ #define CL_LMA "\x1B[01;35m" /* light magenta */ #define CL_LCY "\x1B[01;36m" /* light cyan */ #define CL_WHT "\x1B[01;37m" /* white */ #endif typedef struct { string host; string port; string user; string pass; } cred_t; template <typename Miner, typename Job, typename Solution> class StratumClient { public: StratumClient(std::shared_ptr<boost::asio::io_service> io_s, Miner * m, string const & host, string const & port, string const & user, string const & pass, int const & retries, int const & worktimeout); ~StratumClient() { } void setFailover(string const & host, string const & port); void setFailover(string const & host, string const & port, string const & user, string const & pass); bool isRunning() { return m_running; } bool isConnected() { return m_connected && m_authorized; } bool current() { return p_current; } bool submit(const Solution* solution, const std::string& jobid); void reconnect(); void disconnect(); private: void startWorking(); void workLoop(); void connect(); void work_timeout_handler(const boost::system::error_code& ec); void processReponse(const Object& responseObject); cred_t * p_active; cred_t m_primary; cred_t m_failover; bool m_authorized; bool m_connected; bool m_running = true; int m_retries = 0; int m_maxRetries; int m_worktimeout = 60; string m_response; Miner * p_miner; std::mutex x_current; Job * p_current; Job * p_previous; bool m_stale = false; std::unique_ptr<std::thread> m_work; std::shared_ptr<boost::asio::io_service> m_io_service; tcp::socket m_socket; boost::asio::streambuf m_requestBuffer; boost::asio::streambuf m_responseBuffer; boost::asio::deadline_timer * p_worktimer; string m_nextJobTarget; std::atomic_int m_share_id; unsigned char o_index; }; // ZcashStratumClient typedef StratumClient<ZcashMiner, ZcashJob, EquihashSolution> ZcashStratumClient;
#ifndef FONT_H #define FONT_H #include <string> #define GL_ES #include <drawtext.h> class Font { public: Font(); Font(string filename, int sz); ~Font(); void draw(string text); void use(); private: int sz; struct dtx_font* fnth; }; #endif // FONT_H
#ifndef ADMIN_H #define ADMIN_H #include<fstream> #include "teacher.h" #include "student.h" #include<iostream> using namespace std; class admin { public: void addstudent() { ofstream fout; student S; fout.open("student.dat",ios::in|ios::app); cout<<"\n\nEnter the details of the student to be added: "; S.input(); fout.write((char*)&S, sizeof(S)); cout<<"\n\nThe student is added"; fout.close(); } void addteacher() { ofstream fout; teacher T; fout.open("teacher.dat",ios::in|ios::app); cout<<"\n\nEnter the details of the teacher to be added: "; T.input(); fout.write((char*)&T, sizeof(T)); cout<<"\n\nThe teacher is added"; fout.close(); } }; #endif
// // UIImage+Custom.h // Voffice2.1 // // Created by VTIT on 2/24/14. // // #import <UIKit/UIKit.h> @interface UIImage (Custom) + (UIImage *)imageWithOverlayColor:(UIColor *)color; @end
#include <stdlib.h> #include "TRSpeex.h" #include <stdio.h> int TRSpeexDecodeInit(TRSpeexDecodeContex* stDecode) { int modeID = -1; const SpeexMode *decmode=NULL; int nframes; int vbr_enabled; int chan; int rate; void *st; int quality; int dec_frame_size; int complexity; int nbBytes; int ret; int enh_enabled; int decrate; int declookahead; if(stDecode == NULL) return -1; modeID = SPEEX_MODEID_WB; speex_bits_init(&(stDecode->bits)); decmode = speex_lib_get_mode (modeID); stDecode->st = speex_decoder_init(decmode); if(stDecode->st == NULL) return -1; enh_enabled = 1; decrate = 16000; speex_decoder_ctl(stDecode->st, SPEEX_SET_ENH, &enh_enabled); speex_decoder_ctl(stDecode->st, SPEEX_SET_SAMPLING_RATE, &decrate); speex_decoder_ctl(stDecode->st, SPEEX_GET_FRAME_SIZE, &dec_frame_size); speex_decoder_ctl(stDecode->st, SPEEX_GET_LOOKAHEAD, &declookahead); stDecode->frame_size = dec_frame_size; stDecode->pFifo = (PCMFifoBuffer*)malloc(sizeof(PCMFifoBuffer)); if(stDecode->pFifo != NULL) { ret = pcm_fifo_init(stDecode->pFifo, 1024*10000); if(ret == -1) return -1; } else return -1; return 1; } int TRSpeexDecode(TRSpeexDecodeContex* stDecode,char* pInput, int nInputSize, char* pOutput, int* nOutSize) { int nbBytes; char aInputBuffer[MAX_FRAME_BYTES]; int nFrameNo; int nDecSize; int nTmpSize; int ret = 0; if(stDecode == NULL) return -1; if(pInput == NULL) return -1; if(pOutput == NULL) return -1; if(nInputSize < 0) return -1; if(nInputSize > 1024*10000) return -1; if(stDecode->pFifo != NULL) pcm_fifo_write(stDecode->pFifo, (unsigned char*)pInput, nInputSize); else return -1; nFrameNo = 0; nDecSize = 0; nTmpSize = 0; while(pcm_fifo_size(stDecode->pFifo) >= 60) { pcm_fifo_read(stDecode->pFifo, (unsigned char*)aInputBuffer, 60); speex_bits_read_from(&(stDecode->bits), aInputBuffer, 60); ret = speex_decode_int(stDecode->st, &(stDecode->bits), (spx_int16_t*)pOutput+nFrameNo*(stDecode->frame_size)); if(ret == -1 || ret == -2) { nOutSize = 0; return -1; } nTmpSize += stDecode->frame_size*2; nFrameNo ++; } *nOutSize = nTmpSize; return 1; } int TRSpeexDecodeRelease(TRSpeexDecodeContex* stDecode) { if(stDecode == NULL) return -1; if (stDecode->st != NULL) speex_decoder_destroy(stDecode->st); speex_bits_destroy(&(stDecode->bits)); if(stDecode->pFifo != NULL) { pcm_fifo_free(stDecode->pFifo); free(stDecode->pFifo); stDecode->pFifo = NULL; } return 1; }
#pragma once #include <array> #include <stdexcept> #include "util/NonCopyable.h" #include "client/CommonTypes.h" #include "client/Result.h" #include "client/Dispatcher.h" namespace dh { namespace client { class Device : util::NonCopyable { public: Device(Dispatcher& dispatcher, const std::string& name); ~Device(); Dispatcher& dispatcher(); const Dispatcher& dispatcher() const; std::string name() const; uint32_t timeout() const; void set_timeout(uint32_t timeout); typedef std::array<uint8_t, 16> SerialNumber; void query_type(Result<uint32_t>& result); void query_firmware_version(Result<uint16_t>& result); void query_serial(Result<SerialNumber>& result); void query_label(Result<std::string>& result); void assign_label(const std::string& label); template <typename T> void query(uint16_t address, Result<T>& result) { const DeviceCommand command(name(), DeviceCommand::Type_Query, address); dispatcher().send_query(command, result, timeout()); } template <typename T> void send(uint16_t address, const T& value) { Body body; Serializer<T>::serialize(value, body); const DeviceCommand command(name(), DeviceCommand::Type_Send, address, body); dispatcher().send(command); } template <typename T> void subscribe(uint16_t address, const std::function<void(T)>& handler, uint32_t filter_options = 0) { const DeviceCommandHandler proxy = [handler](OptionalDeviceCommand command) { T value = T(); if (command && command->get_value<T>(value)) handler(value); }; const Filter filter(name(), address, 0xffff, filter_options); dispatcher().add_filter(filter, proxy); } private: Dispatcher& dispatcher_; const std::string name_; uint32_t timeout_ = infinite_timeout; }; namespace sync { class Timeout : public std::runtime_error { public: Timeout() : std::runtime_error("Timeout") {} }; template <typename T, typename Dev, void (Dev::*QueryProc)(Result<T>&)> inline T get(Dev& dev) { typedef BlockingResult<T> MyResult; typedef typename MyResult::ValueType MyValue; MyResult result; (dev.*QueryProc)(result); const MyValue value = result.wait(); if (!value) throw Timeout(); return *value; } inline uint32_t get_device_type(Device& device) { return get<uint32_t, Device, &Device::query_type>(device); } inline uint16_t get_device_firmware_version(Device& device) { return get<uint16_t, Device, &Device::query_firmware_version>(device); } inline Device::SerialNumber get_device_serial(Device& device) { return get<Device::SerialNumber, Device, &Device::query_serial>(device); } inline std::string get_device_label(Device& device) { return get<std::string, Device, &Device::query_label>(device); } } } }
// Fill out your copyright notice in the Description page of Project Settings. #pragma once // @third party code - BEGIN #include "AllowWindowsPlatformTypes.h" #include "oscpkt.hh" #include "zmq.h" #include "czmq.h" #include "HideWindowsPlatformTypes.h" // @third party code - END #include "Core.h" #include "Engine.h" #include "Components/ActorComponent.h" #include "ZMQComponent.generated.h" //General Log DECLARE_LOG_CATEGORY_EXTERN(LogZMQ, Log, All); UENUM(BlueprintType) enum class EZMQPatternEnum : uint8 { UE_ZMQ_PUSH UMETA(DisplayName = "PUSH"), UE_ZMQ_PULL UMETA(DisplayName = "PULL"), UE_ZMQ_PUB UMETA(DisplayName = "PUB"), UE_ZMQ_SUB UMETA(DisplayName = "SUB"), UE_ZMQ_CLIENT UMETA(DisplayName = "CLIENT"), UE_ZMQ_SERVER UMETA(DisplayName = "SERVER") }; USTRUCT(BlueprintType, Blueprintable) struct FZSocket { GENERATED_USTRUCT_BODY() zsock_t *ZSocket; }; UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class UEZEROMQPLUGIN_API UZMQComponent : public UActorComponent { GENERATED_BODY() public: // Sets default values for this component's properties UZMQComponent(); virtual ~UZMQComponent(); void _ShutdownZSockets() { if (m_ZSockets.size() > 0) { for (auto iter = m_ZSockets.begin(); iter != m_ZSockets.end(); ++iter) { zsock_destroy(&(*iter).ZSocket); } m_ZSockets.clear(); } } protected: // Called when the game starts virtual void BeginPlay() override; virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; public: // Called every frame virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; UFUNCTION(BluePrintCallable, Category = ZMQ) bool IsZMQIinitialized(); //UFUNCTION(BluePrintCallable, Category = ZMQ) // bool CreateContextZMQ(); //UFUNCTION(BluePrintCallable, Category = ZMQ) // int DestroyContextZMQ(); //UFUNCTION(BluePrintCallable, Category = ZMQ) // int SetContextZMQ(); //UFUNCTION(BluePrintCallable, Category = ZMQ) // int TermContextZMQ(); //UFUNCTION(BluePrintCallable, Category = ZMQ) // bool ShutDownContextZMQ(); UFUNCTION(BluePrintCallable, Category = ZMQ) bool GetSockOpt_IMMEDIATE_ZMQ(const FZSocket _target); UFUNCTION(BluePrintCallable, Category = ZMQ) bool SetSockOpt_IMMEDIATE_ZMQ(const FZSocket _target, const bool _immediate); //UFUNCTION(BluePrintCallable, Category = ZMQ) // bool CreateSocketZMQ(const FString ip, EZMQPatternEnum pattern); UFUNCTION(BluePrintCallable, Category = ZMQ) FZSocket CreateZSocketSubscribe(const FString ip, const int port, FString filter); UFUNCTION(BluePrintCallable, Category = ZMQ) virtual int ReceiveZMQ(const FZSocket _target); protected: bool m_IsInitialized; std::vector<FZSocket> m_ZSockets; /*zsock_t *m_ZMQSubscriber; zsock_t *m_ZMQPublisher; zsock_t *m_ZMQPush; zsock_t *m_ZMQPull;*/ };
//MIT License // //Copyright (c) 2017 tvelliott // //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 __FLASH_SST_H__ #define __FLASH_SST_H__ #include <stdint.h> #define PROTO(x) x #include "protos/flash_sst_proto.h" #endif
// // NSTimeZone+Coordinate.h // // Created by Jason Wray on 2/14/17. // Copyright © 2019 Jason Wray. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreLocation/CoreLocation.h> @interface NSTimeZone (Coordinate) /** Coordinate for the largest populated place within the given time zone. */ @property (readonly) CLLocationCoordinate2D coordinate; @end
// // This source file is part of appleseed. // Visit http://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization // // 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 APPLESEED_FOUNDATION_MATH_SAMPLING_RNGSAMPLINGCONTEXT_H #define APPLESEED_FOUNDATION_MATH_SAMPLING_RNGSAMPLINGCONTEXT_H // appleseed.foundation headers. #include "foundation/math/rng/distribution.h" #include "foundation/math/vector.h" // Standard headers. #include <cstddef> namespace foundation { // // A sampling context implementing random sampling. // template <typename RNG> class RNGSamplingContext { public: // Random number generator type. typedef RNG RNGType; // Construct a sampling context of dimension 0. It cannot be used // directly; only child contexts obtained by splitting can. explicit RNGSamplingContext(RNG& rng); // Construct a sampling context for a given number of dimensions // and samples. Set sample_count to 0 if the required number of // samples is unknown or infinite. RNGSamplingContext( RNG& rng, const size_t dimension, const size_t sample_count, const size_t initial_instance = 0); // Assignment operator. RNGSamplingContext& operator=(const RNGSamplingContext& rhs); // Trajectory splitting: return a child sampling context for // a given number of dimensions and samples. RNGSamplingContext split( const size_t dimension, const size_t sample_count) const; // In-place trajectory splitting. void split_in_place( const size_t dimension, const size_t sample_count); // Return the next sample in [0,1)^N. // Works for scalars and foundation::Vector<>. template <typename T> T next2(); // Return the total dimension of this sampler. size_t get_total_dimension() const; // Return the total instance number of this sampler. size_t get_total_instance() const; private: RNG& m_rng; template <typename T> struct Tag {}; template <typename T> T next2(Tag<T>); template <typename T, size_t N> Vector<T, N> next2(Tag<Vector<T, N> >); }; // // RNGSamplingContext class implementation. // template <typename RNG> inline RNGSamplingContext<RNG>::RNGSamplingContext(RNG& rng) : m_rng(rng) { } template <typename RNG> inline RNGSamplingContext<RNG>::RNGSamplingContext( RNG& rng, const size_t dimension, const size_t sample_count, const size_t initial_instance) : m_rng(rng) { } template <typename RNG> inline RNGSamplingContext<RNG>& RNGSamplingContext<RNG>::operator=(const RNGSamplingContext& rhs) { return *this; } template <typename RNG> inline RNGSamplingContext<RNG> RNGSamplingContext<RNG>::split( const size_t dimension, const size_t sample_count) const { return RNGSamplingContext( m_rng, dimension, sample_count); } template <typename RNG> inline void RNGSamplingContext<RNG>::split_in_place( const size_t dimension, const size_t sample_count) { } template <typename RNG> template <typename T> inline T RNGSamplingContext<RNG>::next2() { return next2(Tag<T>()); } template <typename RNG> inline size_t RNGSamplingContext<RNG>::get_total_dimension() const { return 0; } template <typename RNG> inline size_t RNGSamplingContext<RNG>::get_total_instance() const { return 0; } template <typename RNG> template <typename T> inline T RNGSamplingContext<RNG>::next2(Tag<T>) { return rand_double2(m_rng); } template <typename RNG> template <typename T, size_t N> inline Vector<T, N> RNGSamplingContext<RNG>::next2(Tag<Vector<T, N> >) { Vector<T, N> v; for (size_t i = 0; i < N; ++i) v[i] = rand_double2(m_rng); return v; } } // namespace foundation #endif // !APPLESEED_FOUNDATION_MATH_SAMPLING_RNGSAMPLINGCONTEXT_H
// // NSString+XLESize.h // Pods // // Created by Randy on 15/12/5. // // #import <Foundation/Foundation.h> @interface NSString (XLESize) - (CGSize)XLE_maxSizeWithConstrainedSize:(CGSize)size font:(UIFont *)font lineMode:(NSLineBreakMode)lineMode; @end
/* * The MIT License (MIT) TLS Extensions * Copyright (c) 2015 Daniel Kubec <niel@rtfm.cz> * * 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. */ #include <sys/compiler.h> #include <sys/cpu.h> #include <net/tls/ext.h> /* TODO" add hash function for inxeding because we dont want to eat 64Kb mem */ static const char *__tls_ext_names[] = { [TLS_EXT_RENEGOTIATE] = "renegotiate", [TLS_EXT_HEARTBEAT] = "heartbeat", [TLS_EXT_EC_POINT_FORMATS] = "ec_point_formats", [TLS_EXT_SERVER_NAME] = "server_name", [TLS_EXT_MAX_FRAGMENT_LENGTH] = "max_fragmet_length", [TLS_EXT_CLIENT_CERTIFICATE_URL] = "client_certificate_url", [TLS_EXT_TRUSTED_CA_KEYS] = "trusted_ca_keys", [TLS_EXT_TRUNCATED_HMAC] = "truncated_hmac", [TLS_EXT_STATUS_REQUEST] = "status_request", [TLS_EXT_USER_MAPPING] = "user_mapping", [TLS_EXT_CLIENT_AUTHZ] = "client_authz", [TLS_EXT_SERVER_AUTHZ] = "server_authz", [TLS_EXT_CERT_TYPE] = "cert_type", [TLS_EXT_ELLIPTIC_CURVES] = "elliptic_curves", [TLS_EXT_SRP] = "srp", [TLS_EXT_SIGNATURE_ALGORITHMS] = "signature_algorithms", [TLS_EXT_USE_SRTP] = "use_srtp", [TLS_EXT_SESSION_TICKET] = "session_ticket", [TLS_EXT_NEXT_PROTO_NEG] = "next_proto_neg", [TLS_EXT_ALPN] = "alpn", [TLS_EXT_CHANNEL_ID] = "channel_id", [TLS_EXT_EXTENDED_MASTER_SECRET] = "extended_master_secret", [TLS_EXT_SUPPLEMENTAL_DATA] = "supplemental_data" }; const char * tls_strext(enum tls_ext_e type) { return __tls_ext_names[type]; }